Skip to content

Commit

Permalink
Merge pull request #535 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 Jul 17, 2023
2 parents a6a3fd2 + 3614076 commit 37d880d
Show file tree
Hide file tree
Showing 18 changed files with 343 additions and 401 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = {
plugins: ['@typescript-eslint'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic',
'plugin:import/typescript',
'prettier',
],
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Changed

- Upgrade dependent packages to the latest versions ([#535](https://github.com/marp-team/marp-cli/pull/535))

## v3.1.0 - 2023-07-09

### Added
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@
"watch": "rollup -w -c"
},
"devDependencies": {
"@babel/preset-env": "^7.22.7",
"@babel/preset-env": "^7.22.9",
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-commonjs": "^25.0.2",
"@rollup/plugin-commonjs": "^25.0.3",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-replace": "^5.0.2",
Expand All @@ -82,15 +82,15 @@
"@tsconfig/node14": "^14.1.0",
"@types/cheerio": "^0.22.31",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.2",
"@types/jest": "^29.5.3",
"@types/markdown-it": "^12.2.3",
"@types/node": "~16.18.38",
"@types/pug": "^2.0.6",
"@types/supertest": "^2.0.12",
"@types/ws": "^8.5.5",
"@types/yargs": "^17.0.24",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"autoprefixer": "^10.4.14",
"babel-plugin-transform-rename-import": "^2.3.0",
"bespoke": "bespokejs/bespoke",
Expand All @@ -100,12 +100,12 @@
"chrome-launcher": "^0.15.2",
"css.escape": "^1.5.1",
"cssnano": "^6.0.1",
"eslint": "^8.44.0",
"eslint": "^8.45.0",
"eslint-config-prettier": "^8.8.0",
"eslint-import-resolver-exports": "^1.0.0-beta.5",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.2",
"eslint-plugin-jest": "^27.2.3",
"express": "^4.18.2",
"fast-plist": "^0.1.3",
"get-stdin": "^9.0.0",
Expand All @@ -124,13 +124,13 @@
"pkg": "^5.8.1",
"pkg-up": "^4.0.0",
"portfinder": "1.0.32",
"postcss": "^8.4.25",
"postcss": "^8.4.26",
"postcss-url": "^10.1.3",
"pptxgenjs": "^3.12.0",
"prettier": "^3.0.0",
"pug": "^3.0.2",
"rimraf": "^5.0.1",
"rollup": "^3.26.2",
"rollup": "^3.26.3",
"rollup-plugin-license": "^3.0.1",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-pug": "^1.1.1",
Expand All @@ -156,7 +156,7 @@
"chokidar": "^3.5.3",
"cosmiconfig": "^8.2.0",
"is-wsl": "^2.2.0",
"puppeteer-core": "20.8.0",
"puppeteer-core": "20.8.2",
"remove": "^0.1.5",
"serve-index": "^1.9.1",
"tmp": "^0.2.1",
Expand Down
7 changes: 1 addition & 6 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import fs from 'fs'
import path from 'path'
import chalk from 'chalk'
import {
cosmiconfig,
cosmiconfigSync,
Options as CosmiconfigOptions,
} from 'cosmiconfig'
import { cosmiconfig, cosmiconfigSync } from 'cosmiconfig'
import { osLocale } from 'os-locale'
import { info, warn, error as cliError } from './cli'
import { ConverterOption, ConvertType } from './converter'
Expand Down
1 change: 0 additions & 1 deletion src/converter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { URL } from 'url'
import type { Marp, MarpOptions } from '@marp-team/marp-core'
import { Marpit, Options as MarpitOptions } from '@marp-team/marpit'
Expand Down
4 changes: 2 additions & 2 deletions src/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class File {
await this.saveToFile()
break
case FileType.StandardIO:
process.stdout.write(this.buffer!) // eslint-disable-line @typescript-eslint/no-non-null-assertion
process.stdout.write(this.buffer!)
}
}

Expand Down Expand Up @@ -153,7 +153,7 @@ export class File {
await fs.promises.mkdir(directory, { recursive: true })
}

await fs.promises.writeFile(savePath, this.buffer!) // eslint-disable-line @typescript-eslint/no-non-null-assertion
await fs.promises.writeFile(savePath, this.buffer!)
}

private static stdinBuffer?: Buffer
Expand Down
6 changes: 4 additions & 2 deletions src/marp-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ export interface MarpCLIInternalOptions {

export type MarpCLIAPIOptions = Pick<MarpCLIInternalOptions, 'baseUrl'>

export type ObservationHelper = { stop: () => void }
export interface ObservationHelper {
stop: () => void
}

const resolversForObservation: Array<(helper: ObservationHelper) => void> = []
const resolversForObservation: ((helper: ObservationHelper) => void)[] = []

const usage = `
Usage:
Expand Down
3 changes: 2 additions & 1 deletion src/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import { isChromeInWSLHost } from './utils/wsl'

export namespace Preview {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- TypedEmitter requires type definition instead of interface
export type Events = {
close: (window: any) => void
exit: () => void
Expand Down Expand Up @@ -118,7 +119,7 @@ export class Preview extends (EventEmitter as new () => TypedEmitter<Preview.Eve

if (url.searchParams.get('__marp_cli_id') === id) {
pptr.off('targetcreated', idMatcher)
;(async () => res((await target.page())!))() // eslint-disable-line @typescript-eslint/no-non-null-assertion
;(async () => res((await target.page())!))()
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ export class Server extends (EventEmitter as new () => TypedEmitter<Server.Event
this.directoryIndex = opts.directoryIndex || []
this.inputDir = converter.options.inputDir
this.options = opts
this.port = Number.parseInt(process.env.PORT!, 10) || 8080 // eslint-disable-line @typescript-eslint/no-non-null-assertion
this.port = Number.parseInt(process.env.PORT!, 10) || 8080
}

async start() {
await this.setup()

return new Promise<void>((res, rej) => {
this.httpServer = this.server!.listen(this.port) // eslint-disable-line @typescript-eslint/no-non-null-assertion
this.httpServer = this.server!.listen(this.port)

this.httpServer.on('listening', res)
this.httpServer.on('error', (err) =>
Expand Down Expand Up @@ -243,6 +243,7 @@ export class Server extends (EventEmitter as new () => TypedEmitter<Server.Event
}

export namespace Server {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- TypedEmitter requires type definition instead of interface
export type Events = {
converted: ConvertedCallback
error: (err: Error) => void
Expand Down
4 changes: 1 addition & 3 deletions src/templates/bespoke/bespoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ const parse = (
return patterns.map(([pat, plugin]) => pat[i] && plugin).filter((p) => p)
}

const bespokeTemplate = (
target = document.getElementById(':$p')! // eslint-disable-line @typescript-eslint/no-non-null-assertion
) => {
const bespokeTemplate = (target = document.getElementById(':$p')!) => {
setViewMode()

const key = popQuery('sync') || undefined
Expand Down
5 changes: 4 additions & 1 deletion src/templates/bespoke/presenter/normal-view.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { generateURLfromParams, storage } from '../utils'
import { presenterPrefix } from './presenter-view'

type BespokeForPresenter = { syncKey: string; [key: string]: any }
interface BespokeForPresenter {
syncKey: string
[key: string]: any
}

const validateDeck = (deck: any): deck is BespokeForPresenter =>
deck.syncKey && typeof deck.syncKey === 'string'
Expand Down
8 changes: 4 additions & 4 deletions src/templates/bespoke/utils/transition.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
export type ResolveAnimationOptions = {
export interface ResolveAnimationOptions {
type: 'incoming' | 'outgoing'
backward?: boolean
duration?: string
}

export type MarpTransitionData = {
export interface MarpTransitionData {
name: string
duration?: string
builtinFallback?: boolean
}

export type MarpTransitionKeyframeSettings = {
export interface MarpTransitionKeyframeSettings {
name: string
defaultDuration?: string
}
Expand Down Expand Up @@ -146,7 +146,7 @@ const fetchMarpTransitionKeyframes = async (
return resolved
})
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion

return resolvedMarpTransitionKeyframes.get(transitionName)!
}

Expand Down
8 changes: 4 additions & 4 deletions src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class Theme {
}

get buffer() {
return this.readBuffer! // eslint-disable-line @typescript-eslint/no-non-null-assertion
return this.readBuffer!
}

get css() {
Expand Down Expand Up @@ -55,13 +55,13 @@ export class ThemeSet {
readonly fnForWatch: string[]

/** The key-value pair from file path to instance */
readonly themes: Map<string, Theme> = new Map()
readonly themes = new Map<string, Theme>()

onThemeUpdated: (path: string) => void = () => {
// No ops
}

private observedMarkdowns: Map<string, string | undefined> = new Map()
private observedMarkdowns = new Map<string, string | undefined>()

private constructor(opts: { fn: string[]; fnForWatch: string[] }) {
this.fn = opts.fn
Expand Down Expand Up @@ -121,7 +121,7 @@ export class ThemeSet {
static async initialize(baseFn: string[], themes: Theme[] = []) {
const fn = [...baseFn, ...themes.map((t) => t.filename)]
const found = await ThemeSet.findPath(fn)
const fnForWatch: Set<string> = new Set(found.map((f) => path.resolve(f)))
const fnForWatch = new Set<string>(found.map((f) => path.resolve(f)))

for (const f of fn) {
// globby's hasMagic (backed by fast-glob) always recognizes "\\" (Windows path separator) as the escape character.
Expand Down
1 change: 0 additions & 1 deletion src/utils/pdf.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import type { PDFDocument, PDFRef } from 'pdf-lib'

// Use pre-bundled pdf-lib to avoid circular dependency warning. pdf-lib as an
Expand Down
3 changes: 1 addition & 2 deletions src/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class Watcher {
}

export class WatchNotifier {
listeners: Map<string, Set<any>> = new Map()
listeners = new Map<string, Set<any>>()

private wss?: WSServer
private portNumber?: number
Expand Down Expand Up @@ -122,7 +122,6 @@ export class WatchNotifier {
if (wsSet !== undefined) {
this.listeners.set(identifier, wsSet.add(ws))

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
ws.on('close', () => this.listeners.get(identifier)!.delete(ws))

ws.send('ready')
Expand Down
15 changes: 6 additions & 9 deletions test/templates/bespoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe("Bespoke template's browser context", () => {
})

targetDocument.body.innerHTML = ret.html
return targetDocument.getElementById(':$p')! // eslint-disable-line @typescript-eslint/no-non-null-assertion
return targetDocument.getElementById(':$p')!
}

const replaceLocation = <T extends void | Promise<void>>(
Expand Down Expand Up @@ -361,7 +361,7 @@ describe("Bespoke template's browser context", () => {

keydown(
{ bubbles: true, key: Key.ArrowRight },
document.getElementById('element')! // eslint-disable-line @typescript-eslint/no-non-null-assertion
document.getElementById('element')!
)
expect(deck.slide()).toBe(0)

Expand Down Expand Up @@ -1296,7 +1296,6 @@ describe("Bespoke template's browser context", () => {
try {
window.addEventListener('storage', resolve, { once: true })

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
foreignFrame.contentWindow!.localStorage.setItem(
storeKey(key),
JSON.stringify({ ...getStore(key), ...data })
Expand Down Expand Up @@ -1580,12 +1579,10 @@ describe("Bespoke template's browser context", () => {
const waitAsync = () =>
new Promise((res) => jest.requireActual('timers').setImmediate(res))

const getCSSText = (rules: CSSRuleList) => {
let style = ''
for (let i = 0; i < rules.length; i += 1) style += rules[i].cssText

return style
}
const getCSSText = (rules: CSSRuleList) =>
Array.from(rules)
.map((rule) => rule.cssText)
.join('')

const getTransitionStyle = (): string | null => {
const style: HTMLStyleElement | null = document.getElementById(
Expand Down
2 changes: 1 addition & 1 deletion test/templates/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('Watch mode notifier on browser context', () => {
server.once('error', (e) => rej(e))
server.once('connection', () => res(socket))

const socket = watch()! // eslint-disable-line @typescript-eslint/no-non-null-assertion
const socket = watch()!
})

await new Promise((res) => {
Expand Down
Loading

0 comments on commit 37d880d

Please sign in to comment.