@ms-cloudpack/file-watcher 0.4.21 → 0.4.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultWatcher.d.ts","sourceRoot":"","sources":["../src/DefaultWatcher.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C;;GAEG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,mBAAmB,GAAG,eAAe;
|
|
1
|
+
{"version":3,"file":"DefaultWatcher.d.ts","sourceRoot":"","sources":["../src/DefaultWatcher.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C;;GAEG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAC7C,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,mBAAmB,GAAG,eAAe;CA2B9F"}
|
package/lib/DefaultWatcher.js
CHANGED
|
@@ -16,12 +16,15 @@ export class DefaultWatcher extends BaseWatcher {
|
|
|
16
16
|
let watcher = chokidar
|
|
17
17
|
.watch(paths, { ignored, followSymlinks: false, ignoreInitial: true })
|
|
18
18
|
.on('change', (filePath) => {
|
|
19
|
+
console.debug(`DefaultWatcher detected change: ${filePath}`);
|
|
19
20
|
onChange([filePath]);
|
|
20
21
|
})
|
|
21
22
|
.on('add', (filePath) => {
|
|
23
|
+
console.debug(`DefaultWatcher detected add: ${filePath}`);
|
|
22
24
|
onChange([filePath]);
|
|
23
25
|
})
|
|
24
26
|
.on('unlink', (filePath) => {
|
|
27
|
+
console.debug(`DefaultWatcher detected delete: ${filePath}`);
|
|
25
28
|
onChange([filePath]);
|
|
26
29
|
});
|
|
27
30
|
return async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultWatcher.js","sourceRoot":"","sources":["../src/DefaultWatcher.ts"],"names":[],"mappings":"AAAA,OAAO,QAA4B,MAAM,UAAU,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,WAAW;IACnC,MAAM,CAAC,OAA2B,EAAE,QAA6B;QACzE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,GAAG,gBAAgB,EAAE,GAAG,OAAO,CAAC;QAClE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;QACnE,MAAM,KAAK,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;QAC9E,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;QAEhF,6FAA6F;QAC7F,IAAI,OAAO,GAA0B,QAAQ;aAC1C,KAAK,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;aACrE,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE;YACzB,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvB,CAAC,CAAC;aACD,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,EAAE;YACtB,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvB,CAAC,CAAC;aACD,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE;YACzB,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;QAEL,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,OAAO,EAAE,KAAK,EAAE,CAAC;YACvB,OAAO,GAAG,SAAS,CAAC;QACtB,CAAC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import chokidar, { type FSWatcher } from 'chokidar';\nimport path from 'path';\nimport type { UnwatchCallback, WatchChangeCallback, WatchOptionsWithId } from './types/Watcher.js';\nimport { BaseWatcher } from './BaseWatcher.js';\nimport { sourceFilesGlobs } from '@ms-cloudpack/path-utilities';\nimport { separateGlobs } from './separateGlobs.js';\n\n/**\n * Watch for changes using chokidar in the current process.\n */\nexport class DefaultWatcher extends BaseWatcher {\n protected _watch(options: WatchOptionsWithId, onChange: WatchChangeCallback): UnwatchCallback {\n const { path: rootPath, watchPaths = sourceFilesGlobs } = options;\n const { positiveGlobs, negativeGlobs } = separateGlobs(watchPaths);\n const paths = positiveGlobs.map((relPath) => path.resolve(rootPath, relPath));\n const ignored = negativeGlobs.map((relPath) => path.resolve(rootPath, relPath));\n\n // For efficiency, don't follow symlinks, and don't send 'add' events after the initial scan.\n let watcher: FSWatcher | undefined = chokidar\n .watch(paths, { ignored, followSymlinks: false, ignoreInitial: true })\n .on('change', (filePath) => {\n onChange([filePath]);\n })\n .on('add', (filePath) => {\n onChange([filePath]);\n })\n .on('unlink', (filePath) => {\n onChange([filePath]);\n });\n\n return async () => {\n await watcher?.close();\n watcher = undefined;\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"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O,CAAC,KAAK,CAAC,gCAAgC,QAAQ,EAAE,CAAC,CAAC;YAC1D,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvB,CAAC,CAAC;aACD,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE;YACzB,OAAO,CAAC,KAAK,CAAC,mCAAmC,QAAQ,EAAE,CAAC,CAAC;YAC7D,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;QAEL,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,OAAO,EAAE,KAAK,EAAE,CAAC;YACvB,OAAO,GAAG,SAAS,CAAC;QACtB,CAAC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import chokidar, { type FSWatcher } from 'chokidar';\nimport path from 'path';\nimport type { UnwatchCallback, WatchChangeCallback, WatchOptionsWithId } from './types/Watcher.js';\nimport { BaseWatcher } from './BaseWatcher.js';\nimport { sourceFilesGlobs } from '@ms-cloudpack/path-utilities';\nimport { separateGlobs } from './separateGlobs.js';\n\n/**\n * Watch for changes using chokidar in the current process.\n */\nexport class DefaultWatcher extends BaseWatcher {\n protected _watch(options: WatchOptionsWithId, onChange: WatchChangeCallback): UnwatchCallback {\n const { path: rootPath, watchPaths = sourceFilesGlobs } = options;\n const { positiveGlobs, negativeGlobs } = separateGlobs(watchPaths);\n const paths = positiveGlobs.map((relPath) => path.resolve(rootPath, relPath));\n const ignored = negativeGlobs.map((relPath) => path.resolve(rootPath, relPath));\n\n // For efficiency, don't follow symlinks, and don't send 'add' events after the initial scan.\n let watcher: FSWatcher | undefined = chokidar\n .watch(paths, { ignored, followSymlinks: false, ignoreInitial: true })\n .on('change', (filePath) => {\n console.debug(`DefaultWatcher detected change: ${filePath}`);\n onChange([filePath]);\n })\n .on('add', (filePath) => {\n console.debug(`DefaultWatcher detected add: ${filePath}`);\n onChange([filePath]);\n })\n .on('unlink', (filePath) => {\n console.debug(`DefaultWatcher detected delete: ${filePath}`);\n onChange([filePath]);\n });\n\n return async () => {\n await watcher?.close();\n watcher = undefined;\n };\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParcelWatcher.d.ts","sourceRoot":"","sources":["../src/ParcelWatcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C;;GAEG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAK5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAC2E;cAMpF,MAAM,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ParcelWatcher.d.ts","sourceRoot":"","sources":["../src/ParcelWatcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C;;GAEG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAK5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAC2E;cAMpF,MAAM,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC;CAuB7G"}
|
package/lib/ParcelWatcher.js
CHANGED
|
@@ -24,6 +24,7 @@ export class ParcelWatcher extends BaseWatcher {
|
|
|
24
24
|
}
|
|
25
25
|
else if (events.length) {
|
|
26
26
|
const uniquePaths = new Set(events.map((event) => event.path));
|
|
27
|
+
console.debug(`ParcelWatcher detected changes: ${[...uniquePaths].join(', ')}`);
|
|
27
28
|
onChange([...uniquePaths]);
|
|
28
29
|
}
|
|
29
30
|
}, { ignore: negativeGlobs, backend: this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EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC/D,QAAQ,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC,EACD,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,CAClD,CAAC;QAEF,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,OAAO,EAAE,WAAW,EAAE,CAAC;YAC7B,OAAO,GAAG,SAAS,CAAC;QACtB,CAAC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import parcel, { type AsyncSubscription } from '@parcel/watcher';\nimport type { UnwatchCallback, WatchChangeCallback, WatchOptionsWithId } from './types/Watcher.js';\nimport { BaseWatcher } from './BaseWatcher.js';\nimport { sourceFilesGlobs } from '@ms-cloudpack/path-utilities';\nimport { separateGlobs } from './separateGlobs.js';\n\n/**\n * Watch for changes using chokidar in the current process.\n */\nexport class ParcelWatcher extends BaseWatcher {\n // Using watchman in codespaces leads to the following error:\n // watchman::RootResolveError: failed to resolve root: unable to resolve root\n // So we use the default backend based on the platform, based on:\n // https://github.com/microsoft/vscode/blob/b482c0e99d5c424d85d6bd5eabccafca430e8072/src/vs/platform/files/node/watcher/parcel/parcelWatcher.ts#L158\n private readonly _backend =\n process.platform === 'win32' ? 'windows' : process.platform === 'linux' ? 'inotify' : 'fs-events';\n\n // TODO: Ideally if this is called multiple times with a different ID but the same root path and\n // same watch paths, a single watcher should be created and shared. But this involves a\n // lot of extra tracking logic and isn't essential until SSR is actually being used in an app.\n // Tracking: https://github.com/microsoft/cloudpack/issues/3046\n protected async _watch(options: WatchOptionsWithId, onChange: WatchChangeCallback): Promise<UnwatchCallback> {\n const { path: rootPath, watchPaths = sourceFilesGlobs } = options;\n const { negativeGlobs } = separateGlobs(watchPaths);\n\n let watcher: AsyncSubscription | undefined = await parcel.subscribe(\n rootPath,\n (err, events) => {\n if (err) {\n console.error(`Error watching files: ${err}`);\n } else if (events.length) {\n const uniquePaths = new Set(events.map((event) => event.path));\n onChange([...uniquePaths]);\n }\n },\n { ignore: negativeGlobs, backend: this._backend },\n );\n\n return async () => {\n await watcher?.unsubscribe();\n watcher = undefined;\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ParcelWatcher.js","sourceRoot":"","sources":["../src/ParcelWatcher.ts"],"names":[],"mappings":"AAAA,OAAO,MAAkC,MAAM,iBAAiB,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C,6DAA6D;IAC7D,6EAA6E;IAC7E,iEAAiE;IACjE,oJAAoJ;IACnI,QAAQ,GACvB,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC;IAEpG,gGAAgG;IAChG,uFAAuF;IACvF,8FAA8F;IAC9F,+DAA+D;IACrD,KAAK,CAAC,MAAM,CAAC,OAA2B,EAAE,QAA6B;QAC/E,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,GAAG,gBAAgB,EAAE,GAAG,OAAO,CAAC;QAClE,MAAM,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;QAEpD,IAAI,OAAO,GAAkC,MAAM,MAAM,CAAC,SAAS,CACjE,QAAQ,EACR,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACd,IAAI,GAAG,EAAE,CAAC;gBACR,OAAO,CAAC,KAAK,CAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC;YAChD,CAAC;iBAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBACzB,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC/D,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,GAAG,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAChF,QAAQ,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC,EACD,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,CAClD,CAAC;QAEF,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,OAAO,EAAE,WAAW,EAAE,CAAC;YAC7B,OAAO,GAAG,SAAS,CAAC;QACtB,CAAC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import parcel, { type AsyncSubscription } from '@parcel/watcher';\nimport type { UnwatchCallback, WatchChangeCallback, WatchOptionsWithId } from './types/Watcher.js';\nimport { BaseWatcher } from './BaseWatcher.js';\nimport { sourceFilesGlobs } from '@ms-cloudpack/path-utilities';\nimport { separateGlobs } from './separateGlobs.js';\n\n/**\n * Watch for changes using chokidar in the current process.\n */\nexport class ParcelWatcher extends BaseWatcher {\n // Using watchman in codespaces leads to the following error:\n // watchman::RootResolveError: failed to resolve root: unable to resolve root\n // So we use the default backend based on the platform, based on:\n // https://github.com/microsoft/vscode/blob/b482c0e99d5c424d85d6bd5eabccafca430e8072/src/vs/platform/files/node/watcher/parcel/parcelWatcher.ts#L158\n private readonly _backend =\n process.platform === 'win32' ? 'windows' : process.platform === 'linux' ? 'inotify' : 'fs-events';\n\n // TODO: Ideally if this is called multiple times with a different ID but the same root path and\n // same watch paths, a single watcher should be created and shared. But this involves a\n // lot of extra tracking logic and isn't essential until SSR is actually being used in an app.\n // Tracking: https://github.com/microsoft/cloudpack/issues/3046\n protected async _watch(options: WatchOptionsWithId, onChange: WatchChangeCallback): Promise<UnwatchCallback> {\n const { path: rootPath, watchPaths = sourceFilesGlobs } = options;\n const { negativeGlobs } = separateGlobs(watchPaths);\n\n let watcher: AsyncSubscription | undefined = await parcel.subscribe(\n rootPath,\n (err, events) => {\n if (err) {\n console.error(`Error watching files: ${err}`);\n } else if (events.length) {\n const uniquePaths = new Set(events.map((event) => event.path));\n console.debug(`ParcelWatcher detected changes: ${[...uniquePaths].join(', ')}`);\n onChange([...uniquePaths]);\n }\n },\n { ignore: negativeGlobs, backend: this._backend },\n );\n\n return async () => {\n await watcher?.unsubscribe();\n watcher = undefined;\n };\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/file-watcher",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.22",
|
|
4
4
|
"description": "A file watcher abstraction for use with Cloudpack.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,9 +14,20 @@
|
|
|
14
14
|
"import": "./lib/index.js"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"api": "cloudpack-scripts api",
|
|
19
|
+
"build:watch": "cloudpack-scripts build-watch",
|
|
20
|
+
"build": "cloudpack-scripts build",
|
|
21
|
+
"lint:update": "cloudpack-scripts lint-update",
|
|
22
|
+
"lint": "cloudpack-scripts lint",
|
|
23
|
+
"start": "node ./lib/test.js",
|
|
24
|
+
"test:update": "cloudpack-scripts test-update",
|
|
25
|
+
"test:watch": "cloudpack-scripts test-watch",
|
|
26
|
+
"test": "cloudpack-scripts test"
|
|
27
|
+
},
|
|
17
28
|
"dependencies": {
|
|
18
29
|
"@ms-cloudpack/path-string-parsing": "^1.2.7",
|
|
19
|
-
"@ms-cloudpack/path-utilities": "^3.
|
|
30
|
+
"@ms-cloudpack/path-utilities": "^3.2.0",
|
|
20
31
|
"@parcel/watcher": "^2.5.1",
|
|
21
32
|
"chokidar": "^3.5.3",
|
|
22
33
|
"picomatch": "^4.0.3"
|
|
@@ -28,17 +39,6 @@
|
|
|
28
39
|
"@ms-cloudpack/test-utilities": "^0.5.0",
|
|
29
40
|
"@types/picomatch": "^4"
|
|
30
41
|
},
|
|
31
|
-
"scripts": {
|
|
32
|
-
"api": "cloudpack-scripts api",
|
|
33
|
-
"build:watch": "cloudpack-scripts build-watch",
|
|
34
|
-
"build": "cloudpack-scripts build",
|
|
35
|
-
"lint:update": "cloudpack-scripts lint-update",
|
|
36
|
-
"lint": "cloudpack-scripts lint",
|
|
37
|
-
"start": "node ./lib/test.js",
|
|
38
|
-
"test:update": "cloudpack-scripts test-update",
|
|
39
|
-
"test:watch": "cloudpack-scripts test-watch",
|
|
40
|
-
"test": "cloudpack-scripts test"
|
|
41
|
-
},
|
|
42
42
|
"files": [
|
|
43
43
|
"lib/**/!(*.test.*)",
|
|
44
44
|
"lib-commonjs/**/!(*.test.*)"
|