Skip to content

Commit

Permalink
Merge pull request #217 from marp-team/upgrade-dependencies
Browse files Browse the repository at this point in the history
Upgrade dependent packages to the latest version
  • Loading branch information
yhatt committed Apr 18, 2020
2 parents 6902fd6 + c4e04e3 commit 6a08c36
Show file tree
Hide file tree
Showing 48 changed files with 1,378 additions and 1,095 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 [Marpit v1.5.2](https://github.com/marp-team/marpit/releases/tag/v1.5.2) and [Marp Core v1.1.1](https://github.com/marp-team/marp-core/releases/tag/v1.1.1) ([#217](https://github.com/marp-team/marp-cli/pull/217))
- Upgrade dependent packages to the latest version ([#217](https://github.com/marp-team/marp-cli/pull/217))

## v0.17.3 - 2020-03-19

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ It would be useful to convert with a customized engine for supporting the additi
const { Marp } = require('@marp-team/marp-core')
const markdownItMark = require('markdown-it-mark')

module.exports = opts => new Marp(opts).use(markdownItMark)
module.exports = (opts) => new Marp(opts).use(markdownItMark)
```

```bash
Expand Down Expand Up @@ -405,7 +405,7 @@ const container = require('markdown-it-container')

module.exports = {
// Customize engine on configuration file directly
engine: opts => new Marp(opts).use(container, 'custom'),
engine: (opts) => new Marp(opts).use(container, 'custom'),
}
```

Expand Down
2 changes: 1 addition & 1 deletion marp-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
require('v8-compile-cache')
require('./lib/marp-cli.js')
.default(process.argv.slice(2))
.then(exitCode => process.on('exit', () => process.exit(exitCode)))
.then((exitCode) => process.on('exit', () => process.exit(exitCode)))
61 changes: 28 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,82 +63,82 @@
"watch": "rollup -w -c"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-commonjs": "^11.1.0",
"@rollup/plugin-json": "^4.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"@rollup/plugin-node-resolve": "^7.1.3",
"@rollup/plugin-replace": "^2.3.1",
"@rollup/plugin-typescript": "^4.0.0",
"@rollup/plugin-typescript": "^4.1.1",
"@rollup/plugin-url": "^4.0.2",
"@types/cheerio": "^0.22.16",
"@types/express": "^4.17.3",
"@types/jest": "^25.1.4",
"@types/jest-plugin-context": "^2.9.2",
"@types/node": "~12.12.30",
"@types/cheerio": "^0.22.17",
"@types/express": "^4.17.6",
"@types/jest": "^25.2.1",
"@types/jest-plugin-context": "^2.9.3",
"@types/node": "~12.12.36",
"@types/pug": "^2.0.4",
"@types/puppeteer": "^2.0.1",
"@types/supertest": "^2.0.8",
"@types/ws": "^7.2.3",
"@types/ws": "^7.2.4",
"@types/yargs": "^15.0.4",
"autoprefixer": "^9.7.4",
"autoprefixer": "^9.7.6",
"bespoke": "bespokejs/bespoke",
"builtin-modules": "^3.1.0",
"cheerio": "^1.0.0-rc.3",
"codecov": "^3.6.1",
"cssnano": "^4.1.10",
"image-size": "^0.8.3",
"jest": "^25.1.0",
"jest": "^25.3.0",
"jest-junit": "^10.0.0",
"jest-plugin-context": "^2.9.0",
"nanoid": "^2.1.11",
"nanoid": "^3.1.3",
"npm-run-all": "^4.1.5",
"pkg": "^4.4.4",
"pkg": "^4.4.7",
"postcss-url": "^8.0.0",
"prettier": "^1.19.1",
"prettier": "^2.0.4",
"pug": "^2.0.4",
"rimraf": "^3.0.2",
"rollup": "^2.1.0",
"rollup-plugin-postcss": "^2.5.0",
"rollup": "^2.6.1",
"rollup-plugin-postcss": "^2.6.4",
"rollup-plugin-pug": "^1.1.1",
"rollup-plugin-terser": "^5.3.0",
"sass": "^1.26.3",
"screenfull": "^5.0.2",
"stylelint": "^13.2.1",
"stylelint": "^13.3.2",
"stylelint-config-prettier": "^8.0.1",
"stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.15.0",
"stylelint-scss": "^3.17.0",
"supertest": "^4.0.2",
"tar-stream": "^2.1.2",
"ts-jest": "^25.2.1",
"ts-jest": "^25.4.0",
"ts-keycode-enum": "^1.0.6",
"tslib": "^1.11.1",
"tslint": "^6.1.0",
"tslint": "^6.1.1",
"tslint-config-airbnb": "^5.11.2",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.8.3",
"vhtml": "^2.2.0",
"yauzl": "^2.10.0",
"zip-stream": "^2.1.3"
"zip-stream": "^3.0.1"
},
"dependencies": {
"@marp-team/marp-core": "^1.1.0",
"@marp-team/marpit": "^1.5.1",
"@marp-team/marp-core": "^1.1.1",
"@marp-team/marpit": "^1.5.2",
"carlo": "^0.9.46",
"chalk": "^3.0.0",
"chalk": "^4.0.0",
"chokidar": "^3.3.1",
"chrome-launcher": "^0.13.0",
"chrome-launcher": "^0.13.1",
"cosmiconfig": "^6.0.0",
"express": "^4.17.1",
"file-url": "^3.0.0",
"get-stdin": "^7.0.0",
"globby": "^11.0.0",
"import-from": "^3.0.0",
"is-wsl": "^2.1.1",
"mkdirp": "^1.0.3",
"os-locale": "^4.0.0",
"mkdirp": "^1.0.4",
"os-locale": "^5.0.0",
"pkg-up": "^3.1.0",
"portfinder": "^1.0.25",
"pptxgenjs": "^3.1.1",
"puppeteer-core": "~2.1.1",
"puppeteer-core": "~3.0.0",
"serve-index": "^1.9.1",
"strip-ansi": "^6.0.0",
"tmp": "^0.1.0",
Expand All @@ -147,11 +147,6 @@
"ws": "^7.2.3",
"yargs": "^15.3.1"
},
"resolutions": {
"**/chrome-launcher/mkdirp": "^0.5.3",
"**/extract-zip/mkdirp": "^0.5.3",
"**/gonzales-pe/minimist": "^1.2.5"
},
"publishConfig": {
"access": "public"
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const dist = path.resolve(__dirname, '../dist')
const prefix = `marp-cli-v${version}`
const os = (process.env.MATRIX_OS || 'linux,macos,windows').toLowerCase()

const packToTarGz = binary => {
const packToTarGz = (binary) => {
const pack = tar.pack()

pack.entry({ name: binaryName, mode: 0755 }, binary)
Expand Down
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class MarpCLIConfig {
? (Array.isArray(this.conf.themeSet)
? this.conf.themeSet
: [this.conf.themeSet]
).map(f => path.resolve(path.dirname(this.confPath!), f))
).map((f) => path.resolve(path.dirname(this.confPath!), f))
: [])

const themeSet = await ThemeSet.initialize(
Expand Down Expand Up @@ -255,7 +255,7 @@ export class MarpCLIConfig {
e.name !== 'Error' && `(${e.name})`,
confPath !== undefined && `[${confPath}]`,
]
.filter(m => m)
.filter((m) => m)
.join(' ')
)
}
Expand Down
7 changes: 4 additions & 3 deletions src/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class Converter {
isFile(file) && this.options.watch && type === ConvertType.html
? await notifier.register(file.absolutePath)
: undefined,
renderer: tplOpts => {
renderer: (tplOpts) => {
const engine = this.generateEngine(tplOpts)
const ret = engine.render(`${markdown}${additionals}`)
const info = engine[engineInfo]
Expand Down Expand Up @@ -242,8 +242,9 @@ export class Converter {

const screenshot = async (pageNumber?: number) => {
await page.evaluate(
`window.scrollTo(0,${((pageNumber || 1) - 1) *
tpl.rendered.size.height})`
`window.scrollTo(0,${
((pageNumber || 1) - 1) * tpl.rendered.size.height
})`
)

if (opts.type === ConvertType.jpeg)
Expand Down
2 changes: 1 addition & 1 deletion src/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class ResolvedEngine {
from?: string
) {
let resolved
;(Array.isArray(engine) ? engine : [engine]).some(eng => {
;(Array.isArray(engine) ? engine : [engine]).some((eng) => {
if (typeof eng === 'string') {
resolved =
(from && importFrom.silent(path.dirname(path.resolve(from)), eng)) ||
Expand Down
2 changes: 1 addition & 1 deletion src/engine/info-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const engineInfo = Symbol()
export default function infoPlugin(md: any) {
const { marpit } = md

md.core.ruler.push('marp_cli_info', state => {
md.core.ruler.push('marp_cli_info', (state) => {
if (state.inlineMode) return

const { themeSet, lastGlobalDirectives } = marpit
Expand Down
9 changes: 5 additions & 4 deletions src/engine/meta-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import { warn } from '../cli'

export default function metaPlugin({ marpit }: { marpit: Marpit }) {
Object.assign(marpit.customDirectives.global, {
description: v => (typeof v === 'string' ? { marpCLIDescription: v } : {}),
image: v => (typeof v === 'string' ? { marpCLIImage: v } : {}),
title: v => (typeof v === 'string' ? { marpCLITitle: v } : {}),
url: v => {
description: (v) =>
typeof v === 'string' ? { marpCLIDescription: v } : {},
image: (v) => (typeof v === 'string' ? { marpCLIImage: v } : {}),
title: (v) => (typeof v === 'string' ? { marpCLITitle: v } : {}),
url: (v) => {
// URL validation
try {
if (v) new URL(v)
Expand Down
18 changes: 9 additions & 9 deletions src/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ export class File {
case undefined:
return File.initialize(
this.convertName(opts),
f => (f.type = this.type)
(f) => (f.type = this.type)
)

// No output
case false:
return File.initialize(this.path, f => (f.type = FileType.Null))
return File.initialize(this.path, (f) => (f.type = FileType.Null))

// Output to standard IO
case '-':
return File.initialize('-', f => (f.type = FileType.StandardIO))
return File.initialize('-', (f) => (f.type = FileType.StandardIO))
}

// Relative path from output directory
Expand Down Expand Up @@ -190,9 +190,9 @@ export class File {
ignore: ['**/node_modules'],
...opts,
})
).forEach(p => filepaths.add(p))
).forEach((p) => filepaths.add(p))

return [...filepaths.values()].map(p => path.normalize(p))
return [...filepaths.values()].map((p) => path.normalize(p))
}

static async find(...paths: string[]): Promise<File[]> {
Expand All @@ -201,17 +201,17 @@ export class File {
{
expandDirectories: {
extensions: [],
files: markdownExtensions.map(ext => `*.${ext}`),
files: markdownExtensions.map((ext) => `*.${ext}`),
},
},
...paths
)
).map(p => new File(p))
).map((p) => new File(p))
}

static async findDir(directory: string): Promise<File[]> {
const found = await this.find(directory)
found.forEach(p => (p.inputDir = path.resolve(directory)))
found.forEach((p) => (p.inputDir = path.resolve(directory)))

return found
}
Expand All @@ -220,7 +220,7 @@ export class File {
this.stdinBuffer = this.stdinBuffer || (await getStdin.buffer())
if (this.stdinBuffer.length === 0) return undefined

return this.initialize('-', f => {
return this.initialize('-', (f) => {
f.buffer = this.stdinBuffer
f.type = FileType.StandardIO
})
Expand Down
10 changes: 5 additions & 5 deletions src/marp-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Usage:
marp [options] -I <dir>
`.trim()

export default async function(argv: string[] = []): Promise<number> {
export default async function (argv: string[] = []): Promise<number> {
let watcherInstance: Watcher | undefined

try {
Expand Down Expand Up @@ -228,7 +228,7 @@ export default async function(argv: string[] = []): Promise<number> {

// Regular file finding powered by globby
return <File[]>(
[stdin, ...(await File.find(...config.files))].filter(f => f)
[stdin, ...(await File.find(...config.files))].filter((f) => f)
)
}

Expand All @@ -245,7 +245,7 @@ export default async function(argv: string[] = []): Promise<number> {

// Convert markdown into HTML
const convertedFiles: File[] = []
const onConverted: ConvertedCallback = ret => {
const onConverted: ConvertedCallback = (ret) => {
const { file: i, newFile: o } = ret
if (!o) return

Expand Down Expand Up @@ -284,7 +284,7 @@ export default async function(argv: string[] = []): Promise<number> {
finder,
events: {
onConverted,
onError: e =>
onError: (e) =>
cli.error(`Failed converting Markdown. (${e.message})`),
},
mode: cvtOpts.server
Expand All @@ -310,7 +310,7 @@ export default async function(argv: string[] = []): Promise<number> {
directoryIndex: ['index.md', 'PITCHME.md'], // GitPitch compatible
})
server.on('converted', onConverted)
server.on('error', e => cli.error(e.toString()))
server.on('error', (e) => cli.error(e.toString()))

await server.start()

Expand Down
4 changes: 2 additions & 2 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class Server extends TypedEventEmitter<Server.Events> {
httpServer.on('listening', () => {
resolve()
})
httpServer.on('error', err => {
httpServer.on('error', (err) => {
httpServer.close()

if (err['code'] === 'EADDRINUSE') {
Expand Down Expand Up @@ -104,7 +104,7 @@ export class Server extends TypedEventEmitter<Server.Events> {
if (!pathname) return

const qs = querystring.parse(query || '')
const response = async fn => {
const response = async (fn) => {
try {
const ret = await this.convertMarkdown(fn, qs)

Expand Down
4 changes: 2 additions & 2 deletions src/templates/bespoke/bespoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import { getViewMode, popQuery, setQuery, setViewMode, ViewMode } from './utils'
const pattern = [ViewMode.Normal, ViewMode.Presenter, ViewMode.Next] as const

const parse = (...patterns: [[boolean, boolean, boolean], Function][]) => {
const idx = pattern.findIndex(v => getViewMode() === v)
const idx = pattern.findIndex((v) => getViewMode() === v)
if (idx < 0) throw new Error('Invalid view')

return patterns.map(([pat, plugin]) => pat[idx] && plugin).filter(p => p)
return patterns.map(([pat, plugin]) => pat[idx] && plugin).filter((p) => p)
}

export default function bespokeTemplate(
Expand Down
8 changes: 5 additions & 3 deletions src/templates/bespoke/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

export default function bespokeClasses(deck) {
deck.parent.classList.add('bespoke-marp-parent')
deck.slides.map(element => element.classList.add('bespoke-marp-slide'))
deck.slides.map((element) => element.classList.add('bespoke-marp-slide'))

deck.on('activate', e => {
deck.slides.map(element => element.classList.remove('bespoke-marp-active'))
deck.on('activate', (e) => {
deck.slides.map((element) =>
element.classList.remove('bespoke-marp-active')
)
e.slide.classList.add('bespoke-marp-active')
})
}
Loading

0 comments on commit 6a08c36

Please sign in to comment.