Skip to content

Commit

Permalink
Merge pull request #76 from marp-team/upgrade-dependencies
Browse files Browse the repository at this point in the history
Upgrade dependent packages to the latest
  • Loading branch information
yhatt authored Mar 10, 2019
2 parents 7fe9a64 + afbaac9 commit ccb495b
Show file tree
Hide file tree
Showing 10 changed files with 818 additions and 599 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## [Unreleased]

### Changed

- Upgrade Marp Core to [v0.6.2](https://github.com/marp-team/marp-core/releases/tag/v0.6.2) ([#76](https://github.com/marp-team/marp-cli/pull/76))
- Upgrade dependent packages to latest ([#76](https://github.com/marp-team/marp-cli/pull/76))

## v0.6.2 - 2019-02-17

### Fixed
Expand Down
50 changes: 25 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,27 @@
"watch": "rollup -w -c"
},
"devDependencies": {
"@types/cheerio": "^0.22.10",
"@types/chokidar": "^1.7.5",
"@types/cheerio": "^0.22.11",
"@types/chokidar": "^2.1.3",
"@types/cosmiconfig": "^5.0.3",
"@types/express": "^4.16.1",
"@types/get-stdin": "^5.0.1",
"@types/jest": "^24.0.5",
"@types/jest": "^24.0.11",
"@types/jest-plugin-context": "^2.9.2",
"@types/node": "^11.9.4",
"@types/node": "^11.11.0",
"@types/pug": "^2.0.4",
"@types/puppeteer": "^1.12.1",
"@types/puppeteer": "^1.12.2",
"@types/supertest": "^2.0.7",
"@types/ws": "^6.0.1",
"@types/yargs": "^12.0.9",
"autoprefixer": "^9.4.7",
"autoprefixer": "^9.4.10",
"bespoke": "^1.1.0",
"bespoke-forms": "^1.0.0",
"bespoke-keys": "^1.1.0",
"cheerio": "^1.0.0-rc.2",
"codecov": "^3.2.0",
"cssnano": "^4.1.10",
"jest": "^24.1.0",
"jest": "^24.3.1",
"jest-junit": "^6.3.0",
"jest-plugin-context": "^2.9.0",
"node-sass": "^4.11.0",
Expand All @@ -74,52 +74,52 @@
"prettier": "^1.16.4",
"pug": "^2.0.3",
"rimraf": "^2.6.3",
"rollup": "^1.1.2",
"rollup-plugin-commonjs": "^9.2.0",
"rollup": "^1.6.0",
"rollup-plugin-commonjs": "^9.2.1",
"rollup-plugin-json": "^3.1.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-postcss": "^2.0.3",
"rollup-plugin-pug": "^1.1.0",
"rollup-plugin-terser": "^4.0.4",
"rollup-plugin-typescript": "^1.0.0",
"rollup-plugin-url": "^2.2.0",
"screenfull": "^4.0.0",
"strip-ansi": "^5.0.0",
"screenfull": "^4.0.1",
"strip-ansi": "^5.1.0",
"stylelint": "^9.10.1",
"stylelint-config-prettier": "^4.0.0",
"stylelint-config-prettier": "^5.0.0",
"stylelint-config-standard": "^18.2.0",
"stylelint-scss": "^3.5.3",
"supertest": "^3.4.2",
"ts-jest": "23.10.5",
"stylelint-scss": "^3.5.4",
"supertest": "^4.0.0",
"ts-jest": "24.0.0",
"ts-keycode-enum": "^1.0.6",
"tslib": "^1.9.3",
"tslint": "^5.12.1",
"tslint": "^5.13.1",
"tslint-config-airbnb": "^5.11.1",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.3.3"
"typescript": "^3.3.3333"
},
"dependencies": {
"@marp-team/marp-core": "^0.6.1",
"@marp-team/marp-core": "^0.6.2",
"@marp-team/marpit": "^0.7.2",
"carlo": "^0.9.43",
"chalk": "^2.4.2",
"chokidar": "^2.1.1",
"chokidar": "^2.1.2",
"chrome-launcher": "^0.10.5",
"cosmiconfig": "^5.0.7",
"cosmiconfig": "^5.1.0",
"express": "^4.16.4",
"get-stdin": "^6.0.0",
"globby": "^9.0.0",
"globby": "^9.1.0",
"import-from": "^2.1.0",
"is-wsl": "^1.1.0",
"mkdirp": "^0.5.1",
"os-locale": "^3.1.0",
"pkg-up": "^2.0.0",
"portfinder": "^1.0.20",
"puppeteer-core": "^1.12.2",
"puppeteer-core": "^1.13.0",
"serve-index": "^1.9.1",
"terminate": "^2.1.2",
"tmp": "^0.0.33",
"ws": "^6.1.4",
"yargs": "^13.2.0"
"ws": "^6.2.0",
"yargs": "^13.2.2"
}
}
9 changes: 2 additions & 7 deletions src/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,8 @@ export class Converter {

private generateEngine(mergeOptions: MarpitOptions): Marpit {
const { html, options } = this.options
const opts: any = { ...options, ...mergeOptions }

// for marp-core
if (html !== undefined) opts.html = html

const { prototype } = this.options.engine
const opts = { ...options, ...mergeOptions, html }

const engine =
prototype && prototype.hasOwnProperty('constructor')
Expand All @@ -211,8 +207,7 @@ export class Converter {
if (typeof engine.render !== 'function')
error('Specified engine has not implemented render() method.')

// for Marpit engine
if (!(engine instanceof Marp)) engine.markdown.set({ html: !!html })
engine.markdown.set({ html })

// Plugins
engine.use(metaPlugin, engine)
Expand Down
5 changes: 4 additions & 1 deletion src/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ export class File {
static async find(...pathes: string[]): Promise<File[]> {
return (await globby(pathes, {
absolute: true,
expandDirectories: { files: markdownExtensions.map(ext => `*.${ext}`) },
expandDirectories: {
extensions: [],
files: markdownExtensions.map(ext => `*.${ext}`),
},
ignore: ['**/node_modules'],
})).map(p => new File(p))
}
Expand Down
2 changes: 1 addition & 1 deletion src/templates/bespoke/bespoke.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ $progressHeight: 5px;
}

@mixin icon-button($icon, $size: 32px) {
background-size: contain;
background: transparent url($icon) no-repeat center center;
background-size: contain;
height: $size;
overflow: hidden;
text-indent: 100%;
Expand Down
9 changes: 6 additions & 3 deletions src/theme.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Marpit } from '@marp-team/marpit'
import fs from 'fs'
import globby from 'globby'
import globby, { hasMagic } from 'globby'
import path from 'path'
import { promisify } from 'util'
import { warn } from './cli'
Expand Down Expand Up @@ -128,7 +128,7 @@ export class ThemeSet {
const fnForWatch: Set<string> = new Set(found.map(f => path.resolve(f)))

for (const f of fn) {
if (!globby.hasMagic(f)) {
if (!hasMagic(f)) {
try {
const stat: fs.Stats = await lstat(f)

Expand All @@ -149,7 +149,10 @@ export class ThemeSet {
private static async findPath(fn: string[]): Promise<string[]> {
return await globby(fn, {
absolute: true,
expandDirectories: { files: themeExtensions },
expandDirectories: {
extensions: [],
files: themeExtensions,
},
ignore: ['**/node_modules'],
})
}
Expand Down
4 changes: 2 additions & 2 deletions test/marp-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,12 @@ describe('Marp CLI', () => {
expect(cliError).toHaveBeenCalledWith(expect.stringContaining('FAIL'))
})

context('with --pdf option', () =>
context('with --pdf option', () => {
it('converts file with PDF type', async () => {
const cmd = [onePath, '--pdf']
expect((await convertion(...cmd)).options.type).toBe(ConvertType.pdf)
})
)
})

context('with --image option', () => {
it('converts file with PNG type by specified png', async () => {
Expand Down
12 changes: 6 additions & 6 deletions test/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,23 +126,23 @@ describe('#fileToURI', () => {
context('with passing file', () => {
const { posix, win32 } = <any>path

context('in posix file system', () =>
context('in posix file system', () => {
it('returns file schema URI', () => {
posix()
expect(fileToURI(new File('/a/b/c'), ConvertType.html)).toBe(
'file:///a/b/c'
)
})
)
})

context('in Windows file system', () =>
context('in Windows file system', () => {
it('returns file schema URI', () => {
win32()
expect(fileToURI(new File('c:\\abc'), ConvertType.html)).toBe(
'file:///c:/abc'
)
})
)
})
})

context('with passing standard IO buffer', () => {
Expand Down Expand Up @@ -171,9 +171,9 @@ describe('#fileToURI', () => {
)
})

context('when buffer is not ready', () =>
context('when buffer is not ready', () => {
it('throws CLIError', () =>
expect(() => fileToURI(file(), ConvertType.html)).toThrow(CLIError))
)
})
})
})
16 changes: 8 additions & 8 deletions test/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,19 @@ describe('Server', () => {

context('when the requested file is not found', () => {
it('returns 404', async () => {
const server = await startServer()
const response = await request(server.server).get('/__NOT_FOUND__')

expect(response.status).toBe(404)
const { server } = await startServer()
expect(request(server).get('/__NOT_FOUND__')).rejects.toThrow(
'Not Found'
)
})
})

context('when the directory traversal attack is detected', () => {
it('returns 403', async () => {
const server = await startServer()
const response = await request(server.server).get('/../../README.md')

expect(response.status).toBe(403)
const { server } = await startServer()
expect(request(server).get('/../../README.md')).rejects.toThrow(
'Forbidden'
)
})
})
})
Expand Down
Loading

0 comments on commit ccb495b

Please sign in to comment.