Skip to content

Commit f026b01

Browse files
authored
Merge pull request #371 from marp-team/upgrade-dependencies
Upgrade dependent packages to the latest version
2 parents c2071b1 + 9f07a52 commit f026b01

File tree

11 files changed

+432
-426
lines changed

11 files changed

+432
-426
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module.exports = {
1414
'import/resolver': {
1515
node: { extensions: ['.mjs', '.js', '.jsx', '.json', '.ts', '.tsx'] },
1616
},
17+
'import/ignore': ['@rollup/plugin-node-resolve'],
1718
},
1819
overrides: [
1920
{

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
- `--pdf-notes` option to add presenter notes into PDF as annotations ([#261](https://github.com/marp-team/marp-cli/issues/261), [#369](https://github.com/marp-team/marp-cli/pull/369))
99
- `author` and `keywords` metadata options / global directives ([#367](https://github.com/marp-team/marp-cli/issues/367), [#370](https://github.com/marp-team/marp-cli/pull/370))
1010

11+
### Changed
12+
13+
- Upgrade dependent packages to the latest version ([#371](https://github.com/marp-team/marp-cli/pull/371))
14+
1115
## v1.2.0 - 2021-07-22
1216

1317
### Added

jest.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
const { jsWithBabel } = require('ts-jest/presets')
22

3-
const esModules = ['ansi-regex', 'array-union', 'globby', 'slash', 'strip-ansi']
3+
const esModules = [
4+
'ansi-regex',
5+
'array-union',
6+
'globby',
7+
'os-locale',
8+
'slash',
9+
'strip-ansi',
10+
]
411

512
module.exports = {
613
collectCoverageFrom: ['src/**/*.ts', 'src/**/*.tsx'],

package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,35 +63,35 @@
6363
"watch": "rollup -w -c"
6464
},
6565
"devDependencies": {
66-
"@babel/preset-env": "^7.14.8",
67-
"@rollup/plugin-alias": "^3.1.4",
68-
"@rollup/plugin-commonjs": "^19.0.1",
66+
"@babel/preset-env": "^7.15.0",
67+
"@rollup/plugin-alias": "^3.1.5",
68+
"@rollup/plugin-commonjs": "^20.0.0",
6969
"@rollup/plugin-json": "^4.1.0",
70-
"@rollup/plugin-node-resolve": "^13.0.2",
70+
"@rollup/plugin-node-resolve": "^13.0.4",
7171
"@rollup/plugin-replace": "^3.0.0",
72-
"@rollup/plugin-typescript": "^8.2.3",
73-
"@rollup/plugin-url": "^6.0.0",
72+
"@rollup/plugin-typescript": "^8.2.5",
73+
"@rollup/plugin-url": "^6.1.0",
7474
"@types/cheerio": "^0.22.30",
7575
"@types/express": "^4.17.13",
76-
"@types/jest": "^26.0.24",
76+
"@types/jest": "^27.0.0",
7777
"@types/node": "~14.17.5",
7878
"@types/pug": "^2.0.5",
7979
"@types/supertest": "^2.0.11",
8080
"@types/ws": "^7.4.7",
8181
"@types/yargs": "^17.0.2",
82-
"@typescript-eslint/eslint-plugin": "^4.28.4",
83-
"@typescript-eslint/parser": "^4.28.4",
82+
"@typescript-eslint/eslint-plugin": "^4.29.1",
83+
"@typescript-eslint/parser": "^4.29.1",
8484
"autoprefixer": "^10.3.1",
8585
"babel-plugin-transform-rename-import": "^2.3.0",
8686
"bespoke": "bespokejs/bespoke",
8787
"builtin-modules": "^3.2.0",
88-
"chalk": "^4.1.1",
88+
"chalk": "^4.1.2",
8989
"cheerio": "^1.0.0-rc.10",
9090
"codecov": "^3.8.3",
9191
"cssnano": "^5.0.7",
92-
"eslint": "^7.31.0",
92+
"eslint": "^7.32.0",
9393
"eslint-config-prettier": "^8.3.0",
94-
"eslint-plugin-import": "^2.23.4",
94+
"eslint-plugin-import": "^2.24.0",
9595
"eslint-plugin-jest": "^24.4.0",
9696
"get-stdin": "^9.0.0",
9797
"globby": "^12.0.0",
@@ -101,7 +101,7 @@
101101
"jest-junit": "^12.2.0",
102102
"nanoid": "^3.1.23",
103103
"npm-run-all": "^4.1.5",
104-
"os-locale": "^5.0.0",
104+
"os-locale": "^6.0.0",
105105
"pkg": "^5.3.1",
106106
"pkg-up": "^3.1.0",
107107
"portfinder": "^1.0.28",
@@ -110,12 +110,12 @@
110110
"prettier": "^2.3.2",
111111
"pug": "^3.0.2",
112112
"rimraf": "^3.0.2",
113-
"rollup": "^2.53.3",
113+
"rollup": "^2.56.2",
114114
"rollup-plugin-license": "^2.5.0",
115115
"rollup-plugin-postcss": "^4.0.0",
116116
"rollup-plugin-pug": "^1.1.1",
117117
"rollup-plugin-terser": "^7.0.2",
118-
"sass": "^1.35.2",
118+
"sass": "^1.37.5",
119119
"screenfull": "^5.1.0",
120120
"strip-ansi": "^7.0.0",
121121
"stylelint": "^13.13.1",
@@ -143,12 +143,12 @@
143143
"import-from": "^4.0.0",
144144
"pdf-lib": "^1.16.0",
145145
"pptxgenjs": "^3.7.1",
146-
"puppeteer-core": "10.1.0",
146+
"puppeteer-core": "10.2.0",
147147
"serve-index": "^1.9.1",
148148
"tmp": "^0.2.1",
149149
"v8-compile-cache": "^2.3.0",
150-
"ws": "^7.5.3",
151-
"yargs": "^17.0.1"
150+
"ws": "^8.0.0",
151+
"yargs": "^17.1.0"
152152
},
153153
"resolutions": {
154154
"cssnano": "^5.0.7",

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from 'path'
22
import alias from '@rollup/plugin-alias'
33
import commonjs from '@rollup/plugin-commonjs'
44
import json from '@rollup/plugin-json'
5-
import nodeResolve from '@rollup/plugin-node-resolve'
5+
import { nodeResolve } from '@rollup/plugin-node-resolve'
66
import replace from '@rollup/plugin-replace'
77
import typescript from '@rollup/plugin-typescript'
88
import url from '@rollup/plugin-url'

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from 'path'
44
import { Marp } from '@marp-team/marp-core'
55
import chalk from 'chalk'
66
import { cosmiconfig } from 'cosmiconfig'
7-
import osLocale from 'os-locale'
7+
import { osLocale } from 'os-locale'
88
import { info, warn } from './cli'
99
import { ConverterOption, ConvertType } from './converter'
1010
import resolveEngine, { ResolvableEngine, ResolvedEngine } from './engine'

src/marp-cli.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,8 @@ export const marpCli = async (
396396

397397
return e.errorCode
398398
} finally {
399-
notifier.stop()
400-
401399
await Promise.all([
400+
notifier.stop(),
402401
Converter.closeBrowser(),
403402
server?.stop(),
404403
watcherInstance?.chokidar.close(),

src/watcher.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,21 @@ export class WatchNotifier {
132132
})
133133
}
134134

135-
stop() {
136-
if (this.wss !== undefined) {
137-
this.wss.close()
138-
this.wss = undefined
139-
}
135+
async stop() {
136+
return new Promise<boolean>((resolve) => {
137+
if (this.wss !== undefined) {
138+
const { wss } = this
139+
140+
wss.close(() => {
141+
for (const ws of wss.clients) ws.terminate()
142+
resolve(true)
143+
})
144+
145+
this.wss = undefined
146+
} else {
147+
resolve(false)
148+
}
149+
})
140150
}
141151

142152
static sha256(fn: string) {

test/templates/watch.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ describe('Watch mode notifier on browser context', () => {
9595
await new Promise((res) => {
9696
clientSocket.addEventListener('close', res)
9797
server.close()
98+
99+
// ws v8 requires closing the connections manually.
100+
for (const ws of server.clients) ws.terminate()
98101
})
99102

100103
server = await createWSServer()

test/watcher.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jest.mock('chokidar', () => ({
1616
}))
1717
jest.mock('ws', () => ({
1818
Server: jest.fn(() => ({
19-
close: jest.fn(),
19+
clients: [],
20+
close: jest.fn((callback) => callback()),
2021
on: mockWsOn,
2122
})),
2223
}))
@@ -228,8 +229,8 @@ describe('WatchNotifier', () => {
228229
expect(socketB.send).toHaveBeenCalledWith('command')
229230
})
230231

231-
it('returns false when WebSocket server is stopped', () => {
232-
instance.stop()
232+
it('returns false when WebSocket server is stopped', async () => {
233+
await instance.stop()
233234
expect(instance.sendTo('test', 'command')).toBe(false)
234235
expect(socketA.send).not.toHaveBeenCalled()
235236
expect(socketB.send).not.toHaveBeenCalled()

0 commit comments

Comments
 (0)