chore: update optional deps (ws & node-watch)

Updates node-watch dep to ^0.7.1 which is a breaking change in the interface of watch function for compatibility on certain windows systems that don't give event and filename info.

Also updates ws dep to v^7.4.3, minor version and bug fixes.
This commit is contained in:
M. George Hansen 2021-02-28 08:26:02 -08:00
parent 868eca4011
commit efafec2c56
Signed by: mgeorgehansen
SSH key fingerprint: SHA256:JlIGiQLPyQ2RHTH3a2oVlb20Xkh9Glr8DUF4YTXHJxM
3 changed files with 18 additions and 14 deletions

18
package-lock.json generated
View file

@ -78,9 +78,9 @@
"dev": true
},
"@types/ws": {
"version": "7.2.4",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.2.4.tgz",
"integrity": "sha512-9S6Ask71vujkVyeEXKxjBSUV8ZUB0mjL5la4IncBoheu04bDaYyUKErh1BQcY9+WzOUOiKqz/OnpJHYckbMfNg==",
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.0.tgz",
"integrity": "sha512-Y29uQ3Uy+58bZrFLhX36hcI3Np37nqWE7ky5tjiDoy1GDZnIwVxS0CgF+s+1bXMzjKBFy+fqaRfb708iNzdinw==",
"dev": true,
"requires": {
"@types/node": "*"
@ -1077,9 +1077,9 @@
"dev": true
},
"node-watch": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/node-watch/-/node-watch-0.6.4.tgz",
"integrity": "sha512-cI6CHzivIFESe8djiK3Wh90CtWQBxLwMem8x8S+2GSvCvFgoMuOKVlfJtQ/2v3Afg3wOnHl/+tXotEs8z5vOrg==",
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/node-watch/-/node-watch-0.7.1.tgz",
"integrity": "sha512-UWblPYuZYrkCQCW5PxAwYSxaELNBLUckrTBBk8xr1/bUgyOkYYTsUcV4e3ytcazFEOyiRyiUrsG37pu6I0I05g==",
"optional": true
},
"object-assign": {
@ -1676,9 +1676,9 @@
}
},
"ws": {
"version": "7.3.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.3.0.tgz",
"integrity": "sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w==",
"version": "7.4.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.3.tgz",
"integrity": "sha512-hr6vCR76GsossIRsr8OLR9acVVm1jyfEWvhbNjtgPOrfvAlKzvyeg/P6r8RuDjRyrcQoPQT7K0DGEPc7Ae6jzA==",
"optional": true
},
"xregexp": {

View file

@ -36,7 +36,7 @@
},
"devDependencies": {
"@types/node": "~10",
"@types/ws": "^7.2.4",
"@types/ws": "^7.4.0",
"@typescript-eslint/eslint-plugin": "^3.0.2",
"@typescript-eslint/parser": "^3.0.2",
"eslint": "^7.1.0",
@ -48,7 +48,7 @@
"typescript": "~3.9.3"
},
"optionalDependencies": {
"node-watch": "^0.6.4",
"ws": "^7.3.0"
"node-watch": "^0.7.1",
"ws": "^7.4.3"
}
}

View file

@ -209,7 +209,7 @@ const startWebSocketServer = async (
const watchFolders = async (
folders: string[],
listener: (eventType: "update" | "remove", fileName: string) => void,
listener: (eventType?: "update" | "remove", fileName?: string) => void,
): Promise<void> => {
// Try to load node-watch, falling back to fs watch if node-watch isn't
// available.
@ -282,7 +282,11 @@ const devCommand: Command = {
existsSync(filePath),
);
await watchFolders(watchedFolders, async (event, filePath) => {
console.log(`${filePath}:${event} triggering rebuild...`);
const filePathForLog = filePath || "<UNKNOWN_FILE>";
const eventForLog = event || "<UNKNOWN_EVENT>";
console.log(
`${filePathForLog}:${eventForLog} triggering rebuild...`,
);
await rebuild();
if (wsServer != null) {
console.log(`rebuild finished, reloading browsers...`);