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 b5cc33df0c
commit a611240366
3 changed files with 18 additions and 14 deletions

18
package-lock.json generated
View file

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

View file

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

View file

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