nitro-nightly 3.0.1-alpha.1 → 3.0.1-alpha.2
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.
- package/README.md +2 -0
- package/dist/_build/common.mjs +24924 -52
- package/dist/_build/rolldown.mjs +29 -63
- package/dist/_build/rollup.mjs +22 -110
- package/dist/_build/vite.build.mjs +3 -43
- package/dist/{_dev.mjs → _chunks/dev.mjs} +45 -43
- package/dist/_chunks/{B-D1JOIz.mjs → nitro.mjs} +144 -308
- package/dist/_chunks/nitro2.mjs +101 -0
- package/dist/_chunks/utils.mjs +254 -0
- package/dist/{_chunks/Bqks5huO.mjs → _common.mjs} +24 -10
- package/dist/_libs/c12+giget+readdirp+chokidar.d.mts +214 -0
- package/dist/_libs/citty.mjs +140 -110
- package/dist/_libs/{plugin-commonjs.mjs → commondir+is-reference.mjs} +59 -250
- package/dist/_libs/compatx.d.mts +47 -0
- package/dist/_libs/confbox.mjs +388 -799
- package/dist/_libs/esbuild.d.mts +20 -0
- package/dist/_libs/estree-walker.mjs +1 -144
- package/dist/_libs/{plugin-node-resolve.mjs → hasown+resolve+deepmerge.mjs} +497 -78
- package/dist/_libs/httpxy.d.mts +79 -0
- package/dist/_libs/httpxy.mjs +6 -1
- package/dist/_libs/magic-string.d.mts +220 -0
- package/dist/_libs/mlly.d.mts +57 -0
- package/dist/_libs/nypm+giget+tinyexec.mjs +3603 -0
- package/dist/_libs/pkg-types.d.mts +23 -0
- package/dist/_libs/plugin-alias.mjs +4 -2
- package/dist/_libs/plugin-inject.mjs +5 -5
- package/dist/_libs/plugin-json.mjs +2 -2
- package/dist/_libs/pluginutils+plugin-commonjs.d.mts +241 -0
- package/dist/_libs/{vite-plugin-fullstack.mjs → pluginutils.mjs} +244 -153
- package/dist/_libs/rc9+c12+dotenv.mjs +972 -0
- package/dist/_libs/{chokidar.mjs → readdirp+chokidar.mjs} +237 -187
- package/dist/_libs/remapping.mjs +1 -1
- package/dist/_libs/{gen-mapping.mjs → resolve-uri+gen-mapping.mjs} +2 -166
- package/dist/_libs/rou3.d.mts +43 -0
- package/dist/_libs/rou3.mjs +9 -6
- package/dist/_libs/std-env.d.mts +4 -0
- package/dist/_libs/tsconfck.mjs +3 -3
- package/dist/_libs/{unimport.mjs → unimport+unplugin.mjs} +226 -1961
- package/dist/_libs/unplugin+unimport.d.mts +426 -0
- package/dist/_libs/unwasm.d.mts +29 -0
- package/dist/_presets.mjs +130 -80
- package/dist/builder.d.mts +4 -4
- package/dist/builder.mjs +6 -30
- package/dist/cli/_chunks/build.mjs +1 -1
- package/dist/cli/_chunks/dev.mjs +5 -11
- package/dist/cli/_chunks/list.mjs +1 -1
- package/dist/cli/_chunks/prepare.mjs +1 -1
- package/dist/cli/_chunks/run.mjs +1 -1
- package/dist/node_modules/@poppinss/colors/build/index.js +130 -160
- package/dist/node_modules/@poppinss/colors/package.json +20 -18
- package/dist/node_modules/@poppinss/exception/build/index.js +36 -55
- package/dist/node_modules/@poppinss/exception/package.json +19 -16
- package/dist/node_modules/@sindresorhus/is/distribution/index.js +46 -5
- package/dist/node_modules/@sindresorhus/is/package.json +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/index.js +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/terminal.js +1 -1
- package/dist/node_modules/@speed-highlight/core/package.json +2 -2
- package/dist/node_modules/hookable/dist/index.mjs +5 -6
- package/dist/node_modules/hookable/package.json +13 -13
- package/dist/node_modules/ufo/dist/index.mjs +16 -9
- package/dist/node_modules/ufo/package.json +15 -14
- package/dist/node_modules/unctx/package.json +16 -16
- package/dist/node_modules/youch/build/{chunk-4XB2BYKC.js → chunk-7QV3D5YX.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-PUHGL6HA.js → chunk-AUGPHE32.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-F4I6KX4R.js → chunk-CM7DWJNZ.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-YYEJ3AGB.js → chunk-EJH674NB.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-EUJBVOYB.js → chunk-OIJ3WD7L.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-HFSXRSKS.js → chunk-P36L72PL.js} +5 -3
- package/dist/node_modules/youch/build/{chunk-4YEN7HVQ.js → chunk-PE3GG3TN.js} +5 -1
- package/dist/node_modules/youch/build/{chunk-PINJDICN.js → chunk-X53OIOJH.js} +2 -4
- package/dist/node_modules/youch/build/index.js +8 -9
- package/dist/node_modules/youch/build/public/error_info/style.css +1 -0
- package/dist/node_modules/youch/build/public/error_metadata/style.css +3 -0
- package/dist/node_modules/youch/build/public/error_stack/style.css +2 -3
- package/dist/node_modules/youch/package.json +1 -1
- package/dist/presets/_nitro/runtime/nitro-dev.d.mts +1 -1
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +5 -6
- package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +1 -1
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +1 -1
- package/dist/presets/_nitro/runtime/service-worker.d.mts +1 -1
- package/dist/presets/_nitro/runtime/service-worker.mjs +2 -2
- package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +1 -1
- package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +1 -1
- package/dist/presets/aws-lambda/runtime/_utils.d.mts +0 -5
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +1 -1
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +9 -11
- package/dist/presets/aws-lambda/runtime/aws-lambda.d.mts +1 -1
- package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +1 -1
- package/dist/presets/azure/runtime/azure-swa.d.mts +1 -1
- package/dist/presets/azure/runtime/azure-swa.mjs +1 -1
- package/dist/presets/bun/runtime/bun.d.mts +1 -1
- package/dist/presets/bun/runtime/bun.mjs +7 -8
- package/dist/presets/cloudflare/runtime/_module-handler.d.mts +3 -3
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +19 -17
- package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +17 -16
- package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +8 -9
- package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +12 -18
- package/dist/presets/deno/runtime/deno-deploy.d.mts +1 -1
- package/dist/presets/deno/runtime/deno-deploy.mjs +4 -5
- package/dist/presets/deno/runtime/deno-server.d.mts +1 -1
- package/dist/presets/deno/runtime/deno-server.mjs +5 -6
- package/dist/presets/netlify/runtime/netlify-edge.d.mts +1 -2
- package/dist/presets/netlify/runtime/netlify-edge.mjs +3 -2
- package/dist/presets/netlify/runtime/netlify.d.mts +3 -2
- package/dist/presets/netlify/runtime/netlify.mjs +3 -1
- package/dist/presets/node/runtime/node-cluster.d.mts +1 -1
- package/dist/presets/node/runtime/node-cluster.mjs +5 -6
- package/dist/presets/node/runtime/node-middleware.d.mts +1 -1
- package/dist/presets/node/runtime/node-middleware.mjs +4 -5
- package/dist/presets/node/runtime/node-server.d.mts +1 -1
- package/dist/presets/node/runtime/node-server.mjs +5 -6
- package/dist/presets/standard/runtime/server.d.mts +1 -1
- package/dist/presets/standard/runtime/server.mjs +1 -1
- package/dist/presets/stormkit/runtime/stormkit.d.mts +1 -1
- package/dist/presets/stormkit/runtime/stormkit.mjs +1 -1
- package/dist/presets/vercel/runtime/isr.d.mts +2 -0
- package/dist/presets/vercel/runtime/isr.mjs +19 -0
- package/dist/presets/vercel/runtime/vercel.node.d.mts +1 -1
- package/dist/presets/vercel/runtime/vercel.node.mjs +16 -7
- package/dist/presets/vercel/runtime/vercel.web.d.mts +1 -1
- package/dist/presets/vercel/runtime/vercel.web.mjs +18 -13
- package/dist/presets/winterjs/runtime/winterjs.d.mts +1 -2
- package/dist/presets/winterjs/runtime/winterjs.mjs +1 -1
- package/dist/presets/zeabur/runtime/zeabur.d.mts +1 -1
- package/dist/presets/zeabur/runtime/zeabur.mjs +1 -1
- package/dist/runtime/app.d.mts +1 -1
- package/dist/runtime/app.mjs +1 -1
- package/dist/runtime/internal/app.d.mts +7 -3
- package/dist/runtime/internal/app.mjs +29 -22
- package/dist/runtime/internal/database.mjs +1 -1
- package/dist/runtime/internal/error/dev.d.mts +0 -1
- package/dist/runtime/internal/error/dev.mjs +1 -1
- package/dist/runtime/internal/route-rules.d.mts +0 -4
- package/dist/runtime/internal/routes/dev-tasks.mjs +1 -1
- package/dist/runtime/internal/routes/openapi.d.mts +0 -1
- package/dist/runtime/internal/routes/openapi.mjs +3 -3
- package/dist/runtime/internal/routes/renderer-template.dev.mjs +1 -1
- package/dist/runtime/internal/routes/renderer-template.mjs +1 -1
- package/dist/runtime/internal/routes/scalar.d.mts +0 -1
- package/dist/runtime/internal/routes/scalar.mjs +4 -4
- package/dist/runtime/internal/routes/swagger.d.mts +0 -1
- package/dist/runtime/internal/routes/swagger.mjs +3 -3
- package/dist/runtime/internal/runtime-config.mjs +8 -8
- package/dist/runtime/internal/static.mjs +1 -1
- package/dist/runtime/internal/storage.mjs +1 -1
- package/dist/runtime/internal/task.mjs +1 -1
- package/dist/runtime/internal/vite/dev-entry.mjs +3 -4
- package/dist/runtime/internal/vite/{dev-worker.mjs → node-runner.mjs} +51 -6
- package/dist/runtime/meta.d.mts +1 -1
- package/dist/runtime/meta.mjs +1 -1
- package/dist/runtime/nitro.d.mts +0 -3
- package/dist/runtime/nitro.mjs +1 -1
- package/dist/runtime/virtual/_runtime_warn.d.mts +1 -0
- package/dist/runtime/virtual/_runtime_warn.mjs +5 -0
- package/dist/runtime/virtual/database.d.mts +8 -0
- package/dist/runtime/virtual/database.mjs +2 -0
- package/dist/runtime/virtual/error-handler.d.mts +6 -0
- package/dist/runtime/virtual/error-handler.mjs +9 -0
- package/dist/runtime/virtual/feature-flags.d.mts +7 -0
- package/dist/runtime/virtual/feature-flags.mjs +7 -0
- package/dist/runtime/virtual/plugins.d.mts +3 -0
- package/dist/runtime/virtual/plugins.mjs +2 -0
- package/dist/runtime/virtual/polyfills.d.mts +3 -0
- package/dist/runtime/virtual/polyfills.mjs +2 -0
- package/dist/runtime/virtual/public-assets.d.mts +9 -0
- package/dist/runtime/virtual/public-assets.mjs +8 -0
- package/dist/runtime/virtual/renderer-template.d.mts +4 -0
- package/dist/runtime/virtual/renderer-template.mjs +7 -0
- package/dist/runtime/virtual/routing-meta.d.mts +7 -0
- package/dist/runtime/virtual/routing-meta.mjs +2 -0
- package/dist/runtime/virtual/routing.d.mts +8 -0
- package/dist/runtime/virtual/routing.mjs +11 -0
- package/dist/runtime/virtual/runtime-config.d.mts +3 -0
- package/dist/runtime/virtual/runtime-config.mjs +5 -0
- package/dist/runtime/virtual/server-assets.d.mts +6 -0
- package/dist/runtime/virtual/server-assets.mjs +12 -0
- package/dist/runtime/virtual/storage.d.mts +3 -0
- package/dist/runtime/virtual/storage.mjs +5 -0
- package/dist/runtime/virtual/tasks.d.mts +10 -0
- package/dist/runtime/virtual/tasks.mjs +3 -0
- package/dist/types/index.d.mts +292 -371
- package/dist/types/index.mjs +10 -0
- package/dist/vite.d.mts +7 -12
- package/dist/vite.mjs +734 -41
- package/lib/vite.types.d.mts +26 -0
- package/lib/vite.types.mjs +2 -0
- package/package.json +82 -53
- package/dist/_build/common2.mjs +0 -772
- package/dist/_build/vite.plugin.mjs +0 -768
- package/dist/_chunks/ANM1K1bE.mjs +0 -304
- package/dist/_chunks/BX9-zVkM.mjs +0 -59
- package/dist/_chunks/C7CbzoI1.mjs +0 -39
- package/dist/_libs/acorn.mjs +0 -5034
- package/dist/_libs/c12.mjs +0 -2858
- package/dist/_libs/commondir.mjs +0 -22
- package/dist/_libs/deepmerge.mjs +0 -86
- package/dist/_libs/dot-prop.mjs +0 -138
- package/dist/_libs/duplexer.mjs +0 -71
- package/dist/_libs/etag.mjs +0 -80
- package/dist/_libs/fdir.mjs +0 -514
- package/dist/_libs/function-bind.mjs +0 -63
- package/dist/_libs/giget.mjs +0 -19289
- package/dist/_libs/gzip-size.mjs +0 -21
- package/dist/_libs/hasown.mjs +0 -14
- package/dist/_libs/is-core-module.mjs +0 -220
- package/dist/_libs/is-module.mjs +0 -13
- package/dist/_libs/is-reference.mjs +0 -32
- package/dist/_libs/js-tokens.mjs +0 -382
- package/dist/_libs/knitwork.mjs +0 -124
- package/dist/_libs/local-pkg.mjs +0 -1686
- package/dist/_libs/magic-string.mjs +0 -939
- package/dist/_libs/mime.mjs +0 -1391
- package/dist/_libs/node-fetch-native.mjs +0 -173
- package/dist/_libs/path-parse.mjs +0 -47
- package/dist/_libs/pathe.mjs +0 -41
- package/dist/_libs/picomatch.mjs +0 -1673
- package/dist/_libs/plugin-replace.mjs +0 -104
- package/dist/_libs/pretty-bytes.mjs +0 -116
- package/dist/_libs/std-env.mjs +0 -158
- package/dist/_libs/strip-literal.mjs +0 -51
- package/dist/_libs/tinyglobby.mjs +0 -292
- package/dist/_libs/untyped.mjs +0 -271
- package/dist/_libs/unwasm.mjs +0 -5836
- package/dist/cli/_chunks/detect-acorn.mjs +0 -12
- package/dist/cli/_chunks/dist.mjs +0 -3
- package/dist/cli/_chunks/dist2.mjs +0 -3
- package/dist/cli/_chunks/dist3.mjs +0 -3
- package/dist/cli/_chunks/dist4.mjs +0 -4
- package/dist/cli/_chunks/dist5.mjs +0 -4
- package/dist/cli/_chunks/esm.mjs +0 -3
- package/dist/cli/_chunks/json5.mjs +0 -4
- package/dist/cli/_chunks/jsonc.mjs +0 -4
- package/dist/cli/_chunks/multipart-parser.mjs +0 -6
- package/dist/cli/_chunks/toml.mjs +0 -4
- package/dist/cli/_chunks/yaml.mjs +0 -4
- package/dist/node_modules/kleur/index.js +0 -110
- package/dist/node_modules/youch/build/chunk-OSUFJZHZ.js +0 -6
- package/lib/deps/ofetch.mjs +0 -1
- package/lib/deps/ofetch.mts +0 -1
- /package/dist/runtime/{vite-runtime.d.mts → vite.d.mts} +0 -0
- /package/dist/runtime/{vite-runtime.mjs → vite.mjs} +0 -0
- /package/lib/{deps/h3.d.mts → h3.d.mts} +0 -0
- /package/lib/{deps/h3.mjs → h3.mjs} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { n as __exportAll } from "../_common.mjs";
|
|
2
|
+
import { Stats, stat, unwatchFile, watch, watchFile } from "node:fs";
|
|
3
|
+
import { lstat, open, readdir, realpath, stat as stat$1 } from "node:fs/promises";
|
|
4
|
+
import { type } from "node:os";
|
|
5
|
+
import * as sp from "node:path";
|
|
1
6
|
import { join, relative, resolve, sep } from "node:path";
|
|
2
|
-
import {
|
|
3
|
-
import { stat as stat$1, unwatchFile, watch, watchFile } from "fs";
|
|
4
|
-
import * as sysPath from "path";
|
|
5
|
-
import { type } from "os";
|
|
6
|
-
import { lstat as lstat$1, open, readdir as readdir$1, realpath as realpath$1, stat as stat$2 } from "fs/promises";
|
|
7
|
-
import { EventEmitter } from "events";
|
|
7
|
+
import { EventEmitter } from "node:events";
|
|
8
8
|
import { Readable } from "node:stream";
|
|
9
9
|
|
|
10
|
-
//#region node_modules/.pnpm/readdirp@
|
|
10
|
+
//#region node_modules/.pnpm/readdirp@5.0.0/node_modules/readdirp/index.js
|
|
11
11
|
const EntryTypes = {
|
|
12
12
|
FILE_TYPE: "files",
|
|
13
13
|
DIR_TYPE: "directories",
|
|
@@ -67,6 +67,20 @@ const normalizeFilter = (filter) => {
|
|
|
67
67
|
};
|
|
68
68
|
/** Readable readdir stream, emitting new files as they're being listed. */
|
|
69
69
|
var ReaddirpStream = class extends Readable {
|
|
70
|
+
parents;
|
|
71
|
+
reading;
|
|
72
|
+
parent;
|
|
73
|
+
_stat;
|
|
74
|
+
_maxDepth;
|
|
75
|
+
_wantsDir;
|
|
76
|
+
_wantsFile;
|
|
77
|
+
_wantsEverything;
|
|
78
|
+
_root;
|
|
79
|
+
_isDirent;
|
|
80
|
+
_statsProp;
|
|
81
|
+
_rdOptions;
|
|
82
|
+
_fileFilter;
|
|
83
|
+
_directoryFilter;
|
|
70
84
|
constructor(options = {}) {
|
|
71
85
|
super({
|
|
72
86
|
objectMode: true,
|
|
@@ -80,10 +94,10 @@ var ReaddirpStream = class extends Readable {
|
|
|
80
94
|
const { root, type: type$1 } = opts;
|
|
81
95
|
this._fileFilter = normalizeFilter(opts.fileFilter);
|
|
82
96
|
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
|
83
|
-
const statMethod = opts.lstat ? lstat : stat;
|
|
84
|
-
if (wantBigintFsStats) this._stat = (path$
|
|
97
|
+
const statMethod = opts.lstat ? lstat : stat$1;
|
|
98
|
+
if (wantBigintFsStats) this._stat = (path$1) => statMethod(path$1, { bigint: true });
|
|
85
99
|
else this._stat = statMethod;
|
|
86
|
-
this._maxDepth = opts.depth
|
|
100
|
+
this._maxDepth = opts.depth != null && Number.isSafeInteger(opts.depth) ? opts.depth : defaultOptions.depth;
|
|
87
101
|
this._wantsDir = type$1 ? DIR_TYPES.has(type$1) : false;
|
|
88
102
|
this._wantsFile = type$1 ? FILE_TYPES.has(type$1) : false;
|
|
89
103
|
this._wantsEverything = type$1 === EntryTypes.EVERYTHING_TYPE;
|
|
@@ -106,8 +120,8 @@ var ReaddirpStream = class extends Readable {
|
|
|
106
120
|
const par = this.parent;
|
|
107
121
|
const fil = par && par.files;
|
|
108
122
|
if (fil && fil.length > 0) {
|
|
109
|
-
const { path: path$
|
|
110
|
-
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path$
|
|
123
|
+
const { path: path$1, depth } = par;
|
|
124
|
+
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path$1));
|
|
111
125
|
const awaited = await Promise.all(slice);
|
|
112
126
|
for (const entry of awaited) {
|
|
113
127
|
if (!entry) continue;
|
|
@@ -142,28 +156,28 @@ var ReaddirpStream = class extends Readable {
|
|
|
142
156
|
this.reading = false;
|
|
143
157
|
}
|
|
144
158
|
}
|
|
145
|
-
async _exploreDir(path$
|
|
159
|
+
async _exploreDir(path$1, depth) {
|
|
146
160
|
let files;
|
|
147
161
|
try {
|
|
148
|
-
files = await readdir(path$
|
|
162
|
+
files = await readdir(path$1, this._rdOptions);
|
|
149
163
|
} catch (error) {
|
|
150
164
|
this._onError(error);
|
|
151
165
|
}
|
|
152
166
|
return {
|
|
153
167
|
files,
|
|
154
168
|
depth,
|
|
155
|
-
path: path$
|
|
169
|
+
path: path$1
|
|
156
170
|
};
|
|
157
171
|
}
|
|
158
|
-
async _formatEntry(dirent, path$
|
|
172
|
+
async _formatEntry(dirent, path$1) {
|
|
159
173
|
let entry;
|
|
160
|
-
const basename$
|
|
174
|
+
const basename$1 = this._isDirent ? dirent.name : dirent;
|
|
161
175
|
try {
|
|
162
|
-
const fullPath = resolve(join(path$
|
|
176
|
+
const fullPath = resolve(join(path$1, basename$1));
|
|
163
177
|
entry = {
|
|
164
178
|
path: relative(this._root, fullPath),
|
|
165
179
|
fullPath,
|
|
166
|
-
basename: basename$
|
|
180
|
+
basename: basename$1
|
|
167
181
|
};
|
|
168
182
|
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
169
183
|
} catch (err) {
|
|
@@ -225,7 +239,7 @@ function readdirp(root, options = {}) {
|
|
|
225
239
|
}
|
|
226
240
|
|
|
227
241
|
//#endregion
|
|
228
|
-
//#region node_modules/.pnpm/chokidar@
|
|
242
|
+
//#region node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/handler.js
|
|
229
243
|
const STR_DATA = "data";
|
|
230
244
|
const STR_END = "end";
|
|
231
245
|
const STR_CLOSE = "close";
|
|
@@ -250,8 +264,8 @@ const EVENTS = {
|
|
|
250
264
|
const EV = EVENTS;
|
|
251
265
|
const THROTTLE_MODE_WATCH = "watch";
|
|
252
266
|
const statMethods = {
|
|
253
|
-
lstat
|
|
254
|
-
stat: stat$
|
|
267
|
+
lstat,
|
|
268
|
+
stat: stat$1
|
|
255
269
|
};
|
|
256
270
|
const KEY_LISTENERS = "listeners";
|
|
257
271
|
const KEY_ERR = "errHandlers";
|
|
@@ -524,7 +538,7 @@ const binaryExtensions = new Set([
|
|
|
524
538
|
"zip",
|
|
525
539
|
"zipx"
|
|
526
540
|
]);
|
|
527
|
-
const isBinaryPath = (filePath) => binaryExtensions.has(
|
|
541
|
+
const isBinaryPath = (filePath) => binaryExtensions.has(sp.extname(filePath).slice(1).toLowerCase());
|
|
528
542
|
const foreach = (val, fn) => {
|
|
529
543
|
if (val instanceof Set) val.forEach(fn);
|
|
530
544
|
else fn(val);
|
|
@@ -555,14 +569,14 @@ const FsWatchInstances = /* @__PURE__ */ new Map();
|
|
|
555
569
|
* @param emitRaw emits raw event data
|
|
556
570
|
* @returns {NativeFsWatcher}
|
|
557
571
|
*/
|
|
558
|
-
function createFsWatchInstance(path$
|
|
572
|
+
function createFsWatchInstance(path$1, options, listener, errHandler, emitRaw) {
|
|
559
573
|
const handleEvent = (rawEvent, evPath) => {
|
|
560
|
-
listener(path$
|
|
561
|
-
emitRaw(rawEvent, evPath, { watchedPath: path$
|
|
562
|
-
if (evPath && path$
|
|
574
|
+
listener(path$1);
|
|
575
|
+
emitRaw(rawEvent, evPath, { watchedPath: path$1 });
|
|
576
|
+
if (evPath && path$1 !== evPath) fsWatchBroadcast(sp.resolve(path$1, evPath), KEY_LISTENERS, sp.join(path$1, evPath));
|
|
563
577
|
};
|
|
564
578
|
try {
|
|
565
|
-
return watch(path$
|
|
579
|
+
return watch(path$1, { persistent: options.persistent }, handleEvent);
|
|
566
580
|
} catch (error) {
|
|
567
581
|
errHandler(error);
|
|
568
582
|
return;
|
|
@@ -587,12 +601,12 @@ const fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
|
|
|
587
601
|
* @param options to be passed to fs_watch
|
|
588
602
|
* @param handlers container for event listener functions
|
|
589
603
|
*/
|
|
590
|
-
const setFsWatchListener = (path$
|
|
604
|
+
const setFsWatchListener = (path$1, fullPath, options, handlers) => {
|
|
591
605
|
const { listener, errHandler, rawEmitter } = handlers;
|
|
592
606
|
let cont = FsWatchInstances.get(fullPath);
|
|
593
607
|
let watcher;
|
|
594
608
|
if (!options.persistent) {
|
|
595
|
-
watcher = createFsWatchInstance(path$
|
|
609
|
+
watcher = createFsWatchInstance(path$1, options, listener, errHandler, rawEmitter);
|
|
596
610
|
if (!watcher) return;
|
|
597
611
|
return watcher.close.bind(watcher);
|
|
598
612
|
}
|
|
@@ -601,13 +615,13 @@ const setFsWatchListener = (path$2, fullPath, options, handlers) => {
|
|
|
601
615
|
addAndConvert(cont, KEY_ERR, errHandler);
|
|
602
616
|
addAndConvert(cont, KEY_RAW, rawEmitter);
|
|
603
617
|
} else {
|
|
604
|
-
watcher = createFsWatchInstance(path$
|
|
618
|
+
watcher = createFsWatchInstance(path$1, options, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
|
|
605
619
|
if (!watcher) return;
|
|
606
620
|
watcher.on(EV.ERROR, async (error) => {
|
|
607
621
|
const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
|
|
608
622
|
if (cont) cont.watcherUnusable = true;
|
|
609
623
|
if (isWindows && error.code === "EPERM") try {
|
|
610
|
-
await (await open(path$
|
|
624
|
+
await (await open(path$1, "r")).close();
|
|
611
625
|
broadcastErr(error);
|
|
612
626
|
} catch (err) {}
|
|
613
627
|
else broadcastErr(error);
|
|
@@ -643,7 +657,7 @@ const FsWatchFileInstances = /* @__PURE__ */ new Map();
|
|
|
643
657
|
* @param handlers container for event listener functions
|
|
644
658
|
* @returns closer
|
|
645
659
|
*/
|
|
646
|
-
const setFsWatchFileListener = (path$
|
|
660
|
+
const setFsWatchFileListener = (path$1, fullPath, options, handlers) => {
|
|
647
661
|
const { listener, rawEmitter } = handlers;
|
|
648
662
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
649
663
|
const copts = cont && cont.options;
|
|
@@ -667,7 +681,7 @@ const setFsWatchFileListener = (path$2, fullPath, options, handlers) => {
|
|
|
667
681
|
});
|
|
668
682
|
});
|
|
669
683
|
const currmtime = curr.mtimeMs;
|
|
670
|
-
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) foreach(cont.listeners, (listener$1) => listener$1(path$
|
|
684
|
+
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) foreach(cont.listeners, (listener$1) => listener$1(path$1, curr));
|
|
671
685
|
})
|
|
672
686
|
};
|
|
673
687
|
FsWatchFileInstances.set(fullPath, cont);
|
|
@@ -687,6 +701,8 @@ const setFsWatchFileListener = (path$2, fullPath, options, handlers) => {
|
|
|
687
701
|
* @mixin
|
|
688
702
|
*/
|
|
689
703
|
var NodeFsHandler = class {
|
|
704
|
+
fsw;
|
|
705
|
+
_boundHandleError;
|
|
690
706
|
constructor(fsW) {
|
|
691
707
|
this.fsw = fsW;
|
|
692
708
|
this._boundHandleError = (error) => fsW._handleError(error);
|
|
@@ -697,22 +713,22 @@ var NodeFsHandler = class {
|
|
|
697
713
|
* @param listener on fs change
|
|
698
714
|
* @returns closer for the watcher instance
|
|
699
715
|
*/
|
|
700
|
-
_watchWithNodeFs(path$
|
|
716
|
+
_watchWithNodeFs(path$1, listener) {
|
|
701
717
|
const opts = this.fsw.options;
|
|
702
|
-
const directory =
|
|
703
|
-
const basename$
|
|
704
|
-
this.fsw._getWatchedDir(directory).add(basename$
|
|
705
|
-
const absolutePath =
|
|
718
|
+
const directory = sp.dirname(path$1);
|
|
719
|
+
const basename$1 = sp.basename(path$1);
|
|
720
|
+
this.fsw._getWatchedDir(directory).add(basename$1);
|
|
721
|
+
const absolutePath = sp.resolve(path$1);
|
|
706
722
|
const options = { persistent: opts.persistent };
|
|
707
723
|
if (!listener) listener = EMPTY_FN;
|
|
708
724
|
let closer;
|
|
709
725
|
if (opts.usePolling) {
|
|
710
|
-
options.interval = opts.interval !== opts.binaryInterval && isBinaryPath(basename$
|
|
711
|
-
closer = setFsWatchFileListener(path$
|
|
726
|
+
options.interval = opts.interval !== opts.binaryInterval && isBinaryPath(basename$1) ? opts.binaryInterval : opts.interval;
|
|
727
|
+
closer = setFsWatchFileListener(path$1, absolutePath, options, {
|
|
712
728
|
listener,
|
|
713
729
|
rawEmitter: this.fsw._emitRaw
|
|
714
730
|
});
|
|
715
|
-
} else closer = setFsWatchListener(path$
|
|
731
|
+
} else closer = setFsWatchListener(path$1, absolutePath, options, {
|
|
716
732
|
listener,
|
|
717
733
|
errHandler: this._boundHandleError,
|
|
718
734
|
rawEmitter: this.fsw._emitRaw
|
|
@@ -725,29 +741,29 @@ var NodeFsHandler = class {
|
|
|
725
741
|
*/
|
|
726
742
|
_handleFile(file, stats, initialAdd) {
|
|
727
743
|
if (this.fsw.closed) return;
|
|
728
|
-
const dirname$
|
|
729
|
-
const basename$
|
|
730
|
-
const parent = this.fsw._getWatchedDir(dirname$
|
|
744
|
+
const dirname$1 = sp.dirname(file);
|
|
745
|
+
const basename$1 = sp.basename(file);
|
|
746
|
+
const parent = this.fsw._getWatchedDir(dirname$1);
|
|
731
747
|
let prevStats = stats;
|
|
732
|
-
if (parent.has(basename$
|
|
733
|
-
const listener = async (path$
|
|
748
|
+
if (parent.has(basename$1)) return;
|
|
749
|
+
const listener = async (path$1, newStats) => {
|
|
734
750
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return;
|
|
735
751
|
if (!newStats || newStats.mtimeMs === 0) try {
|
|
736
|
-
const newStats$1 = await stat$
|
|
752
|
+
const newStats$1 = await stat$1(file);
|
|
737
753
|
if (this.fsw.closed) return;
|
|
738
754
|
const at = newStats$1.atimeMs;
|
|
739
755
|
const mt = newStats$1.mtimeMs;
|
|
740
756
|
if (!at || at <= mt || mt !== prevStats.mtimeMs) this.fsw._emit(EV.CHANGE, file, newStats$1);
|
|
741
757
|
if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats$1.ino) {
|
|
742
|
-
this.fsw._closeFile(path$
|
|
758
|
+
this.fsw._closeFile(path$1);
|
|
743
759
|
prevStats = newStats$1;
|
|
744
760
|
const closer$1 = this._watchWithNodeFs(file, listener);
|
|
745
|
-
if (closer$1) this.fsw._addPathCloser(path$
|
|
761
|
+
if (closer$1) this.fsw._addPathCloser(path$1, closer$1);
|
|
746
762
|
} else prevStats = newStats$1;
|
|
747
763
|
} catch (error) {
|
|
748
|
-
this.fsw._remove(dirname$
|
|
764
|
+
this.fsw._remove(dirname$1, basename$1);
|
|
749
765
|
}
|
|
750
|
-
else if (parent.has(basename$
|
|
766
|
+
else if (parent.has(basename$1)) {
|
|
751
767
|
const at = newStats.atimeMs;
|
|
752
768
|
const mt = newStats.mtimeMs;
|
|
753
769
|
if (!at || at <= mt || mt !== prevStats.mtimeMs) this.fsw._emit(EV.CHANGE, file, newStats);
|
|
@@ -769,7 +785,7 @@ var NodeFsHandler = class {
|
|
|
769
785
|
* @param item basename of this item
|
|
770
786
|
* @returns true if no more processing is needed for this entry.
|
|
771
787
|
*/
|
|
772
|
-
async _handleSymlink(entry, directory, path$
|
|
788
|
+
async _handleSymlink(entry, directory, path$1, item) {
|
|
773
789
|
if (this.fsw.closed) return;
|
|
774
790
|
const full = entry.fullPath;
|
|
775
791
|
const dir = this.fsw._getWatchedDir(directory);
|
|
@@ -777,7 +793,7 @@ var NodeFsHandler = class {
|
|
|
777
793
|
this.fsw._incrReadyCount();
|
|
778
794
|
let linkPath;
|
|
779
795
|
try {
|
|
780
|
-
linkPath = await realpath
|
|
796
|
+
linkPath = await realpath(path$1);
|
|
781
797
|
} catch (e) {
|
|
782
798
|
this.fsw._emitReady();
|
|
783
799
|
return true;
|
|
@@ -786,12 +802,12 @@ var NodeFsHandler = class {
|
|
|
786
802
|
if (dir.has(item)) {
|
|
787
803
|
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
|
788
804
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
789
|
-
this.fsw._emit(EV.CHANGE, path$
|
|
805
|
+
this.fsw._emit(EV.CHANGE, path$1, entry.stats);
|
|
790
806
|
}
|
|
791
807
|
} else {
|
|
792
808
|
dir.add(item);
|
|
793
809
|
this.fsw._symlinkPaths.set(full, linkPath);
|
|
794
|
-
this.fsw._emit(EV.ADD, path$
|
|
810
|
+
this.fsw._emit(EV.ADD, path$1, entry.stats);
|
|
795
811
|
}
|
|
796
812
|
this.fsw._emitReady();
|
|
797
813
|
return true;
|
|
@@ -800,8 +816,9 @@ var NodeFsHandler = class {
|
|
|
800
816
|
this.fsw._symlinkPaths.set(full, true);
|
|
801
817
|
}
|
|
802
818
|
_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
|
|
803
|
-
directory =
|
|
804
|
-
|
|
819
|
+
directory = sp.join(directory, "");
|
|
820
|
+
const throttleKey = target ? `${directory}:${target}` : directory;
|
|
821
|
+
throttler = this.fsw._throttle("readdir", throttleKey, 1e3);
|
|
805
822
|
if (!throttler) return;
|
|
806
823
|
const previous = this.fsw._getWatchedDir(wh.path);
|
|
807
824
|
const current = /* @__PURE__ */ new Set();
|
|
@@ -816,20 +833,20 @@ var NodeFsHandler = class {
|
|
|
816
833
|
return;
|
|
817
834
|
}
|
|
818
835
|
const item = entry.path;
|
|
819
|
-
let path$
|
|
836
|
+
let path$1 = sp.join(directory, item);
|
|
820
837
|
current.add(item);
|
|
821
|
-
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path$
|
|
838
|
+
if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path$1, item)) return;
|
|
822
839
|
if (this.fsw.closed) {
|
|
823
840
|
stream = void 0;
|
|
824
841
|
return;
|
|
825
842
|
}
|
|
826
843
|
if (item === target || !target && !previous.has(item)) {
|
|
827
844
|
this.fsw._incrReadyCount();
|
|
828
|
-
path$
|
|
829
|
-
this._addToNodeFs(path$
|
|
845
|
+
path$1 = sp.join(dir, sp.relative(dir, path$1));
|
|
846
|
+
this._addToNodeFs(path$1, initialAdd, wh, depth + 1);
|
|
830
847
|
}
|
|
831
848
|
}).on(EV.ERROR, this._boundHandleError);
|
|
832
|
-
return new Promise((resolve$
|
|
849
|
+
return new Promise((resolve$1, reject) => {
|
|
833
850
|
if (!stream) return reject();
|
|
834
851
|
stream.once(STR_END, () => {
|
|
835
852
|
if (this.fsw.closed) {
|
|
@@ -837,7 +854,7 @@ var NodeFsHandler = class {
|
|
|
837
854
|
return;
|
|
838
855
|
}
|
|
839
856
|
const wasThrottled = throttler ? throttler.clear() : false;
|
|
840
|
-
resolve$
|
|
857
|
+
resolve$1(void 0);
|
|
841
858
|
previous.getChildren().filter((item) => {
|
|
842
859
|
return item !== directory && !current.has(item);
|
|
843
860
|
}).forEach((item) => {
|
|
@@ -859,16 +876,16 @@ var NodeFsHandler = class {
|
|
|
859
876
|
* @param realpath
|
|
860
877
|
* @returns closer for the watcher instance.
|
|
861
878
|
*/
|
|
862
|
-
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath$
|
|
863
|
-
const parentDir = this.fsw._getWatchedDir(
|
|
864
|
-
const tracked = parentDir.has(
|
|
879
|
+
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath$1) {
|
|
880
|
+
const parentDir = this.fsw._getWatchedDir(sp.dirname(dir));
|
|
881
|
+
const tracked = parentDir.has(sp.basename(dir));
|
|
865
882
|
if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) this.fsw._emit(EV.ADD_DIR, dir, stats);
|
|
866
|
-
parentDir.add(
|
|
883
|
+
parentDir.add(sp.basename(dir));
|
|
867
884
|
this.fsw._getWatchedDir(dir);
|
|
868
885
|
let throttler;
|
|
869
886
|
let closer;
|
|
870
887
|
const oDepth = this.fsw.options.depth;
|
|
871
|
-
if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath$
|
|
888
|
+
if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath$1)) {
|
|
872
889
|
if (!target) {
|
|
873
890
|
await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler);
|
|
874
891
|
if (this.fsw.closed) return;
|
|
@@ -889,13 +906,13 @@ var NodeFsHandler = class {
|
|
|
889
906
|
* @param depth Child path actually targeted for watch
|
|
890
907
|
* @param target Child path actually targeted for watch
|
|
891
908
|
*/
|
|
892
|
-
async _addToNodeFs(path$
|
|
909
|
+
async _addToNodeFs(path$1, initialAdd, priorWh, depth, target) {
|
|
893
910
|
const ready = this.fsw._emitReady;
|
|
894
|
-
if (this.fsw._isIgnored(path$
|
|
911
|
+
if (this.fsw._isIgnored(path$1) || this.fsw.closed) {
|
|
895
912
|
ready();
|
|
896
913
|
return false;
|
|
897
914
|
}
|
|
898
|
-
const wh = this.fsw._getWatchHelpers(path$
|
|
915
|
+
const wh = this.fsw._getWatchHelpers(path$1);
|
|
899
916
|
if (priorWh) {
|
|
900
917
|
wh.filterPath = (entry) => priorWh.filterPath(entry);
|
|
901
918
|
wh.filterDir = (entry) => priorWh.filterDir(entry);
|
|
@@ -910,44 +927,50 @@ var NodeFsHandler = class {
|
|
|
910
927
|
const follow = this.fsw.options.followSymlinks;
|
|
911
928
|
let closer;
|
|
912
929
|
if (stats.isDirectory()) {
|
|
913
|
-
const absPath =
|
|
914
|
-
const targetPath = follow ? await realpath
|
|
930
|
+
const absPath = sp.resolve(path$1);
|
|
931
|
+
const targetPath = follow ? await realpath(path$1) : path$1;
|
|
915
932
|
if (this.fsw.closed) return;
|
|
916
933
|
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
|
917
934
|
if (this.fsw.closed) return;
|
|
918
935
|
if (absPath !== targetPath && targetPath !== void 0) this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
919
936
|
} else if (stats.isSymbolicLink()) {
|
|
920
|
-
const targetPath = follow ? await realpath
|
|
937
|
+
const targetPath = follow ? await realpath(path$1) : path$1;
|
|
921
938
|
if (this.fsw.closed) return;
|
|
922
|
-
const parent =
|
|
939
|
+
const parent = sp.dirname(wh.watchPath);
|
|
923
940
|
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
|
924
941
|
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
|
925
|
-
closer = await this._handleDir(parent, stats, initialAdd, depth, path$
|
|
942
|
+
closer = await this._handleDir(parent, stats, initialAdd, depth, path$1, wh, targetPath);
|
|
926
943
|
if (this.fsw.closed) return;
|
|
927
|
-
if (targetPath !== void 0) this.fsw._symlinkPaths.set(
|
|
944
|
+
if (targetPath !== void 0) this.fsw._symlinkPaths.set(sp.resolve(path$1), targetPath);
|
|
928
945
|
} else closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
929
946
|
ready();
|
|
930
|
-
if (closer) this.fsw._addPathCloser(path$
|
|
947
|
+
if (closer) this.fsw._addPathCloser(path$1, closer);
|
|
931
948
|
return false;
|
|
932
949
|
} catch (error) {
|
|
933
950
|
if (this.fsw._handleError(error)) {
|
|
934
951
|
ready();
|
|
935
|
-
return path$
|
|
952
|
+
return path$1;
|
|
936
953
|
}
|
|
937
954
|
}
|
|
938
955
|
}
|
|
939
956
|
};
|
|
940
957
|
|
|
941
958
|
//#endregion
|
|
942
|
-
//#region node_modules/.pnpm/chokidar@
|
|
959
|
+
//#region node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/index.js
|
|
943
960
|
/*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
|
|
961
|
+
var chokidar_exports = /* @__PURE__ */ __exportAll({
|
|
962
|
+
FSWatcher: () => FSWatcher,
|
|
963
|
+
WatchHelper: () => WatchHelper,
|
|
964
|
+
default: () => chokidar_default,
|
|
965
|
+
watch: () => watch$1
|
|
966
|
+
});
|
|
944
967
|
const SLASH = "/";
|
|
945
968
|
const SLASH_SLASH = "//";
|
|
946
969
|
const ONE_DOT = ".";
|
|
947
970
|
const TWO_DOTS = "..";
|
|
948
971
|
const STRING_TYPE = "string";
|
|
949
972
|
const BACK_SLASH_RE = /\\/g;
|
|
950
|
-
const DOUBLE_SLASH_RE =
|
|
973
|
+
const DOUBLE_SLASH_RE = /\/\//g;
|
|
951
974
|
const DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
|
|
952
975
|
const REPLACER_RE = /^\.[/\\]/;
|
|
953
976
|
function arrify(item) {
|
|
@@ -961,30 +984,29 @@ function createPattern(matcher) {
|
|
|
961
984
|
if (typeof matcher === "object" && matcher !== null) return (string) => {
|
|
962
985
|
if (matcher.path === string) return true;
|
|
963
986
|
if (matcher.recursive) {
|
|
964
|
-
const relative$
|
|
965
|
-
if (!relative$
|
|
966
|
-
return !relative$
|
|
987
|
+
const relative$1 = sp.relative(matcher.path, string);
|
|
988
|
+
if (!relative$1) return false;
|
|
989
|
+
return !relative$1.startsWith("..") && !sp.isAbsolute(relative$1);
|
|
967
990
|
}
|
|
968
991
|
return false;
|
|
969
992
|
};
|
|
970
993
|
return () => false;
|
|
971
994
|
}
|
|
972
|
-
function normalizePath(path$
|
|
973
|
-
if (typeof path$
|
|
974
|
-
path$
|
|
975
|
-
path$
|
|
995
|
+
function normalizePath(path$1) {
|
|
996
|
+
if (typeof path$1 !== "string") throw new Error("string expected");
|
|
997
|
+
path$1 = sp.normalize(path$1);
|
|
998
|
+
path$1 = path$1.replace(/\\/g, "/");
|
|
976
999
|
let prepend = false;
|
|
977
|
-
if (path$
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
return path$2;
|
|
1000
|
+
if (path$1.startsWith("//")) prepend = true;
|
|
1001
|
+
path$1 = path$1.replace(DOUBLE_SLASH_RE, "/");
|
|
1002
|
+
if (prepend) path$1 = "/" + path$1;
|
|
1003
|
+
return path$1;
|
|
982
1004
|
}
|
|
983
1005
|
function matchPatterns(patterns, testString, stats) {
|
|
984
|
-
const path$
|
|
1006
|
+
const path$1 = normalizePath(testString);
|
|
985
1007
|
for (let index = 0; index < patterns.length; index++) {
|
|
986
1008
|
const pattern = patterns[index];
|
|
987
|
-
if (pattern(path$
|
|
1009
|
+
if (pattern(path$1, stats)) return true;
|
|
988
1010
|
}
|
|
989
1011
|
return false;
|
|
990
1012
|
}
|
|
@@ -1005,24 +1027,27 @@ const toUnix = (string) => {
|
|
|
1005
1027
|
let str = string.replace(BACK_SLASH_RE, SLASH);
|
|
1006
1028
|
let prepend = false;
|
|
1007
1029
|
if (str.startsWith(SLASH_SLASH)) prepend = true;
|
|
1008
|
-
|
|
1030
|
+
str = str.replace(DOUBLE_SLASH_RE, SLASH);
|
|
1009
1031
|
if (prepend) str = SLASH + str;
|
|
1010
1032
|
return str;
|
|
1011
1033
|
};
|
|
1012
|
-
const normalizePathToUnix = (path$
|
|
1013
|
-
const normalizeIgnored = (cwd = "") => (path$
|
|
1014
|
-
if (typeof path$
|
|
1015
|
-
else return path$
|
|
1034
|
+
const normalizePathToUnix = (path$1) => toUnix(sp.normalize(toUnix(path$1)));
|
|
1035
|
+
const normalizeIgnored = (cwd = "") => (path$1) => {
|
|
1036
|
+
if (typeof path$1 === "string") return normalizePathToUnix(sp.isAbsolute(path$1) ? path$1 : sp.join(cwd, path$1));
|
|
1037
|
+
else return path$1;
|
|
1016
1038
|
};
|
|
1017
|
-
const getAbsolutePath = (path$
|
|
1018
|
-
if (
|
|
1019
|
-
return
|
|
1039
|
+
const getAbsolutePath = (path$1, cwd) => {
|
|
1040
|
+
if (sp.isAbsolute(path$1)) return path$1;
|
|
1041
|
+
return sp.join(cwd, path$1);
|
|
1020
1042
|
};
|
|
1021
1043
|
const EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
|
|
1022
1044
|
/**
|
|
1023
1045
|
* Directory entry.
|
|
1024
1046
|
*/
|
|
1025
1047
|
var DirEntry = class {
|
|
1048
|
+
path;
|
|
1049
|
+
_removeWatcher;
|
|
1050
|
+
items;
|
|
1026
1051
|
constructor(dir, removeWatcher) {
|
|
1027
1052
|
this.path = dir;
|
|
1028
1053
|
this._removeWatcher = removeWatcher;
|
|
@@ -1040,9 +1065,9 @@ var DirEntry = class {
|
|
|
1040
1065
|
if (items.size > 0) return;
|
|
1041
1066
|
const dir = this.path;
|
|
1042
1067
|
try {
|
|
1043
|
-
await readdir
|
|
1068
|
+
await readdir(dir);
|
|
1044
1069
|
} catch (err) {
|
|
1045
|
-
if (this._removeWatcher) this._removeWatcher(
|
|
1070
|
+
if (this._removeWatcher) this._removeWatcher(sp.dirname(dir), sp.basename(dir));
|
|
1046
1071
|
}
|
|
1047
1072
|
}
|
|
1048
1073
|
has(item) {
|
|
@@ -1066,12 +1091,19 @@ var DirEntry = class {
|
|
|
1066
1091
|
const STAT_METHOD_F = "stat";
|
|
1067
1092
|
const STAT_METHOD_L = "lstat";
|
|
1068
1093
|
var WatchHelper = class {
|
|
1069
|
-
|
|
1094
|
+
fsw;
|
|
1095
|
+
path;
|
|
1096
|
+
watchPath;
|
|
1097
|
+
fullWatchPath;
|
|
1098
|
+
dirParts;
|
|
1099
|
+
followSymlinks;
|
|
1100
|
+
statMethod;
|
|
1101
|
+
constructor(path$1, follow, fsw) {
|
|
1070
1102
|
this.fsw = fsw;
|
|
1071
|
-
const watchPath = path$
|
|
1072
|
-
this.path = path$
|
|
1103
|
+
const watchPath = path$1;
|
|
1104
|
+
this.path = path$1 = path$1.replace(REPLACER_RE, "");
|
|
1073
1105
|
this.watchPath = watchPath;
|
|
1074
|
-
this.fullWatchPath =
|
|
1106
|
+
this.fullWatchPath = sp.resolve(watchPath);
|
|
1075
1107
|
this.dirParts = [];
|
|
1076
1108
|
this.dirParts.forEach((parts) => {
|
|
1077
1109
|
if (parts.length > 1) parts.pop();
|
|
@@ -1080,7 +1112,7 @@ var WatchHelper = class {
|
|
|
1080
1112
|
this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
|
|
1081
1113
|
}
|
|
1082
1114
|
entryPath(entry) {
|
|
1083
|
-
return
|
|
1115
|
+
return sp.join(this.watchPath, sp.relative(this.watchPath, entry.fullPath));
|
|
1084
1116
|
}
|
|
1085
1117
|
filterPath(entry) {
|
|
1086
1118
|
const { stats } = entry;
|
|
@@ -1101,6 +1133,24 @@ var WatchHelper = class {
|
|
|
1101
1133
|
* .on('add', path => log('File', path, 'was added'))
|
|
1102
1134
|
*/
|
|
1103
1135
|
var FSWatcher = class extends EventEmitter {
|
|
1136
|
+
closed;
|
|
1137
|
+
options;
|
|
1138
|
+
_closers;
|
|
1139
|
+
_ignoredPaths;
|
|
1140
|
+
_throttled;
|
|
1141
|
+
_streams;
|
|
1142
|
+
_symlinkPaths;
|
|
1143
|
+
_watched;
|
|
1144
|
+
_pendingWrites;
|
|
1145
|
+
_pendingUnlinks;
|
|
1146
|
+
_readyCount;
|
|
1147
|
+
_emitReady;
|
|
1148
|
+
_closePromise;
|
|
1149
|
+
_userIgnored;
|
|
1150
|
+
_readyEmitted;
|
|
1151
|
+
_emitRaw;
|
|
1152
|
+
_boundRemove;
|
|
1153
|
+
_nodeFsHandler;
|
|
1104
1154
|
constructor(_opts = {}) {
|
|
1105
1155
|
super();
|
|
1106
1156
|
this.closed = false;
|
|
@@ -1182,23 +1232,23 @@ var FSWatcher = class extends EventEmitter {
|
|
|
1182
1232
|
this.closed = false;
|
|
1183
1233
|
this._closePromise = void 0;
|
|
1184
1234
|
let paths = unifyPaths(paths_);
|
|
1185
|
-
if (cwd) paths = paths.map((path$
|
|
1186
|
-
return getAbsolutePath(path$
|
|
1235
|
+
if (cwd) paths = paths.map((path$1) => {
|
|
1236
|
+
return getAbsolutePath(path$1, cwd);
|
|
1187
1237
|
});
|
|
1188
|
-
paths.forEach((path$
|
|
1189
|
-
this._removeIgnoredPath(path$
|
|
1238
|
+
paths.forEach((path$1) => {
|
|
1239
|
+
this._removeIgnoredPath(path$1);
|
|
1190
1240
|
});
|
|
1191
1241
|
this._userIgnored = void 0;
|
|
1192
1242
|
if (!this._readyCount) this._readyCount = 0;
|
|
1193
1243
|
this._readyCount += paths.length;
|
|
1194
|
-
Promise.all(paths.map(async (path$
|
|
1195
|
-
const res = await this._nodeFsHandler._addToNodeFs(path$
|
|
1244
|
+
Promise.all(paths.map(async (path$1) => {
|
|
1245
|
+
const res = await this._nodeFsHandler._addToNodeFs(path$1, !_internal, void 0, 0, _origAdd);
|
|
1196
1246
|
if (res) this._emitReady();
|
|
1197
1247
|
return res;
|
|
1198
1248
|
})).then((results) => {
|
|
1199
1249
|
if (this.closed) return;
|
|
1200
1250
|
results.forEach((item) => {
|
|
1201
|
-
if (item) this.add(
|
|
1251
|
+
if (item) this.add(sp.dirname(item), sp.basename(_origAdd || item));
|
|
1202
1252
|
});
|
|
1203
1253
|
});
|
|
1204
1254
|
return this;
|
|
@@ -1210,15 +1260,15 @@ var FSWatcher = class extends EventEmitter {
|
|
|
1210
1260
|
if (this.closed) return this;
|
|
1211
1261
|
const paths = unifyPaths(paths_);
|
|
1212
1262
|
const { cwd } = this.options;
|
|
1213
|
-
paths.forEach((path$
|
|
1214
|
-
if (!
|
|
1215
|
-
if (cwd) path$
|
|
1216
|
-
path$
|
|
1263
|
+
paths.forEach((path$1) => {
|
|
1264
|
+
if (!sp.isAbsolute(path$1) && !this._closers.has(path$1)) {
|
|
1265
|
+
if (cwd) path$1 = sp.join(cwd, path$1);
|
|
1266
|
+
path$1 = sp.resolve(path$1);
|
|
1217
1267
|
}
|
|
1218
|
-
this._closePath(path$
|
|
1219
|
-
this._addIgnoredPath(path$
|
|
1220
|
-
if (this._watched.has(path$
|
|
1221
|
-
path: path$
|
|
1268
|
+
this._closePath(path$1);
|
|
1269
|
+
this._addIgnoredPath(path$1);
|
|
1270
|
+
if (this._watched.has(path$1)) this._addIgnoredPath({
|
|
1271
|
+
path: path$1,
|
|
1222
1272
|
recursive: true
|
|
1223
1273
|
});
|
|
1224
1274
|
this._userIgnored = void 0;
|
|
@@ -1257,7 +1307,7 @@ var FSWatcher = class extends EventEmitter {
|
|
|
1257
1307
|
getWatched() {
|
|
1258
1308
|
const watchList = {};
|
|
1259
1309
|
this._watched.forEach((entry, dir) => {
|
|
1260
|
-
const index = (this.options.cwd ?
|
|
1310
|
+
const index = (this.options.cwd ? sp.relative(this.options.cwd, dir) : dir) || ONE_DOT;
|
|
1261
1311
|
watchList[index] = entry.getChildren().sort();
|
|
1262
1312
|
});
|
|
1263
1313
|
return watchList;
|
|
@@ -1274,34 +1324,34 @@ var FSWatcher = class extends EventEmitter {
|
|
|
1274
1324
|
* @param stats arguments to be passed with event
|
|
1275
1325
|
* @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
|
1276
1326
|
*/
|
|
1277
|
-
async _emit(event, path$
|
|
1327
|
+
async _emit(event, path$1, stats) {
|
|
1278
1328
|
if (this.closed) return;
|
|
1279
1329
|
const opts = this.options;
|
|
1280
|
-
if (isWindows) path$
|
|
1281
|
-
if (opts.cwd) path$
|
|
1282
|
-
const args = [path$
|
|
1330
|
+
if (isWindows) path$1 = sp.normalize(path$1);
|
|
1331
|
+
if (opts.cwd) path$1 = sp.relative(opts.cwd, path$1);
|
|
1332
|
+
const args = [path$1];
|
|
1283
1333
|
if (stats != null) args.push(stats);
|
|
1284
1334
|
const awf = opts.awaitWriteFinish;
|
|
1285
1335
|
let pw;
|
|
1286
|
-
if (awf && (pw = this._pendingWrites.get(path$
|
|
1336
|
+
if (awf && (pw = this._pendingWrites.get(path$1))) {
|
|
1287
1337
|
pw.lastChange = /* @__PURE__ */ new Date();
|
|
1288
1338
|
return this;
|
|
1289
1339
|
}
|
|
1290
1340
|
if (opts.atomic) {
|
|
1291
1341
|
if (event === EVENTS.UNLINK) {
|
|
1292
|
-
this._pendingUnlinks.set(path$
|
|
1342
|
+
this._pendingUnlinks.set(path$1, [event, ...args]);
|
|
1293
1343
|
setTimeout(() => {
|
|
1294
|
-
this._pendingUnlinks.forEach((entry, path$
|
|
1344
|
+
this._pendingUnlinks.forEach((entry, path$2) => {
|
|
1295
1345
|
this.emit(...entry);
|
|
1296
1346
|
this.emit(EVENTS.ALL, ...entry);
|
|
1297
|
-
this._pendingUnlinks.delete(path$
|
|
1347
|
+
this._pendingUnlinks.delete(path$2);
|
|
1298
1348
|
});
|
|
1299
1349
|
}, typeof opts.atomic === "number" ? opts.atomic : 100);
|
|
1300
1350
|
return this;
|
|
1301
1351
|
}
|
|
1302
|
-
if (event === EVENTS.ADD && this._pendingUnlinks.has(path$
|
|
1352
|
+
if (event === EVENTS.ADD && this._pendingUnlinks.has(path$1)) {
|
|
1303
1353
|
event = EVENTS.CHANGE;
|
|
1304
|
-
this._pendingUnlinks.delete(path$
|
|
1354
|
+
this._pendingUnlinks.delete(path$1);
|
|
1305
1355
|
}
|
|
1306
1356
|
}
|
|
1307
1357
|
if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
|
|
@@ -1316,17 +1366,17 @@ var FSWatcher = class extends EventEmitter {
|
|
|
1316
1366
|
this.emitWithAll(event, args);
|
|
1317
1367
|
}
|
|
1318
1368
|
};
|
|
1319
|
-
this._awaitWriteFinish(path$
|
|
1369
|
+
this._awaitWriteFinish(path$1, awf.stabilityThreshold, event, awfEmit);
|
|
1320
1370
|
return this;
|
|
1321
1371
|
}
|
|
1322
1372
|
if (event === EVENTS.CHANGE) {
|
|
1323
|
-
if (!this._throttle(EVENTS.CHANGE, path$
|
|
1373
|
+
if (!this._throttle(EVENTS.CHANGE, path$1, 50)) return this;
|
|
1324
1374
|
}
|
|
1325
1375
|
if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
|
|
1326
|
-
const fullPath = opts.cwd ?
|
|
1376
|
+
const fullPath = opts.cwd ? sp.join(opts.cwd, path$1) : path$1;
|
|
1327
1377
|
let stats$1;
|
|
1328
1378
|
try {
|
|
1329
|
-
stats$1 = await stat$
|
|
1379
|
+
stats$1 = await stat$1(fullPath);
|
|
1330
1380
|
} catch (err) {}
|
|
1331
1381
|
if (!stats$1 || this.closed) return;
|
|
1332
1382
|
args.push(stats$1);
|
|
@@ -1350,20 +1400,20 @@ var FSWatcher = class extends EventEmitter {
|
|
|
1350
1400
|
* @param timeout duration of time to suppress duplicate actions
|
|
1351
1401
|
* @returns tracking object or false if action should be suppressed
|
|
1352
1402
|
*/
|
|
1353
|
-
_throttle(actionType, path$
|
|
1403
|
+
_throttle(actionType, path$1, timeout) {
|
|
1354
1404
|
if (!this._throttled.has(actionType)) this._throttled.set(actionType, /* @__PURE__ */ new Map());
|
|
1355
1405
|
const action = this._throttled.get(actionType);
|
|
1356
1406
|
if (!action) throw new Error("invalid throttle");
|
|
1357
|
-
const actionPath = action.get(path$
|
|
1407
|
+
const actionPath = action.get(path$1);
|
|
1358
1408
|
if (actionPath) {
|
|
1359
1409
|
actionPath.count++;
|
|
1360
1410
|
return false;
|
|
1361
1411
|
}
|
|
1362
1412
|
let timeoutObject;
|
|
1363
1413
|
const clear = () => {
|
|
1364
|
-
const item = action.get(path$
|
|
1414
|
+
const item = action.get(path$1);
|
|
1365
1415
|
const count = item ? item.count : 0;
|
|
1366
|
-
action.delete(path$
|
|
1416
|
+
action.delete(path$1);
|
|
1367
1417
|
clearTimeout(timeoutObject);
|
|
1368
1418
|
if (item) clearTimeout(item.timeoutObject);
|
|
1369
1419
|
return count;
|
|
@@ -1374,7 +1424,7 @@ var FSWatcher = class extends EventEmitter {
|
|
|
1374
1424
|
clear,
|
|
1375
1425
|
count: 0
|
|
1376
1426
|
};
|
|
1377
|
-
action.set(path$
|
|
1427
|
+
action.set(path$1, thr);
|
|
1378
1428
|
return thr;
|
|
1379
1429
|
}
|
|
1380
1430
|
_incrReadyCount() {
|
|
@@ -1388,34 +1438,34 @@ var FSWatcher = class extends EventEmitter {
|
|
|
1388
1438
|
* @param event
|
|
1389
1439
|
* @param awfEmit Callback to be called when ready for event to be emitted.
|
|
1390
1440
|
*/
|
|
1391
|
-
_awaitWriteFinish(path$
|
|
1441
|
+
_awaitWriteFinish(path$1, threshold, event, awfEmit) {
|
|
1392
1442
|
const awf = this.options.awaitWriteFinish;
|
|
1393
1443
|
if (typeof awf !== "object") return;
|
|
1394
1444
|
const pollInterval = awf.pollInterval;
|
|
1395
1445
|
let timeoutHandler;
|
|
1396
|
-
let fullPath = path$
|
|
1397
|
-
if (this.options.cwd && !
|
|
1446
|
+
let fullPath = path$1;
|
|
1447
|
+
if (this.options.cwd && !sp.isAbsolute(path$1)) fullPath = sp.join(this.options.cwd, path$1);
|
|
1398
1448
|
const now = /* @__PURE__ */ new Date();
|
|
1399
1449
|
const writes = this._pendingWrites;
|
|
1400
1450
|
function awaitWriteFinishFn(prevStat) {
|
|
1401
|
-
stat
|
|
1402
|
-
if (err || !writes.has(path$
|
|
1451
|
+
stat(fullPath, (err, curStat) => {
|
|
1452
|
+
if (err || !writes.has(path$1)) {
|
|
1403
1453
|
if (err && err.code !== "ENOENT") awfEmit(err);
|
|
1404
1454
|
return;
|
|
1405
1455
|
}
|
|
1406
1456
|
const now$1 = Number(/* @__PURE__ */ new Date());
|
|
1407
|
-
if (prevStat && curStat.size !== prevStat.size) writes.get(path$
|
|
1408
|
-
if (now$1 - writes.get(path$
|
|
1409
|
-
writes.delete(path$
|
|
1457
|
+
if (prevStat && curStat.size !== prevStat.size) writes.get(path$1).lastChange = now$1;
|
|
1458
|
+
if (now$1 - writes.get(path$1).lastChange >= threshold) {
|
|
1459
|
+
writes.delete(path$1);
|
|
1410
1460
|
awfEmit(void 0, curStat);
|
|
1411
1461
|
} else timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
|
|
1412
1462
|
});
|
|
1413
1463
|
}
|
|
1414
|
-
if (!writes.has(path$
|
|
1415
|
-
writes.set(path$
|
|
1464
|
+
if (!writes.has(path$1)) {
|
|
1465
|
+
writes.set(path$1, {
|
|
1416
1466
|
lastChange: now,
|
|
1417
1467
|
cancelWait: () => {
|
|
1418
|
-
writes.delete(path$
|
|
1468
|
+
writes.delete(path$1);
|
|
1419
1469
|
clearTimeout(timeoutHandler);
|
|
1420
1470
|
return event;
|
|
1421
1471
|
}
|
|
@@ -1426,31 +1476,31 @@ var FSWatcher = class extends EventEmitter {
|
|
|
1426
1476
|
/**
|
|
1427
1477
|
* Determines whether user has asked to ignore this path.
|
|
1428
1478
|
*/
|
|
1429
|
-
_isIgnored(path$
|
|
1430
|
-
if (this.options.atomic && DOT_RE.test(path$
|
|
1479
|
+
_isIgnored(path$1, stats) {
|
|
1480
|
+
if (this.options.atomic && DOT_RE.test(path$1)) return true;
|
|
1431
1481
|
if (!this._userIgnored) {
|
|
1432
1482
|
const { cwd } = this.options;
|
|
1433
1483
|
const ignored = (this.options.ignored || []).map(normalizeIgnored(cwd));
|
|
1434
1484
|
this._userIgnored = anymatch([...[...this._ignoredPaths].map(normalizeIgnored(cwd)), ...ignored], void 0);
|
|
1435
1485
|
}
|
|
1436
|
-
return this._userIgnored(path$
|
|
1486
|
+
return this._userIgnored(path$1, stats);
|
|
1437
1487
|
}
|
|
1438
|
-
_isntIgnored(path$
|
|
1439
|
-
return !this._isIgnored(path$
|
|
1488
|
+
_isntIgnored(path$1, stat$2) {
|
|
1489
|
+
return !this._isIgnored(path$1, stat$2);
|
|
1440
1490
|
}
|
|
1441
1491
|
/**
|
|
1442
1492
|
* Provides a set of common helpers and properties relating to symlink handling.
|
|
1443
1493
|
* @param path file or directory pattern being watched
|
|
1444
1494
|
*/
|
|
1445
|
-
_getWatchHelpers(path$
|
|
1446
|
-
return new WatchHelper(path$
|
|
1495
|
+
_getWatchHelpers(path$1) {
|
|
1496
|
+
return new WatchHelper(path$1, this.options.followSymlinks, this);
|
|
1447
1497
|
}
|
|
1448
1498
|
/**
|
|
1449
1499
|
* Provides directory tracking objects
|
|
1450
1500
|
* @param directory path of the directory
|
|
1451
1501
|
*/
|
|
1452
1502
|
_getWatchedDir(directory) {
|
|
1453
|
-
const dir =
|
|
1503
|
+
const dir = sp.resolve(directory);
|
|
1454
1504
|
if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove));
|
|
1455
1505
|
return this._watched.get(dir);
|
|
1456
1506
|
}
|
|
@@ -1469,50 +1519,50 @@ var FSWatcher = class extends EventEmitter {
|
|
|
1469
1519
|
* @param item base path of item/directory
|
|
1470
1520
|
*/
|
|
1471
1521
|
_remove(directory, item, isDirectory) {
|
|
1472
|
-
const path$
|
|
1473
|
-
const fullPath =
|
|
1474
|
-
isDirectory = isDirectory != null ? isDirectory : this._watched.has(path$
|
|
1475
|
-
if (!this._throttle("remove", path$
|
|
1522
|
+
const path$1 = sp.join(directory, item);
|
|
1523
|
+
const fullPath = sp.resolve(path$1);
|
|
1524
|
+
isDirectory = isDirectory != null ? isDirectory : this._watched.has(path$1) || this._watched.has(fullPath);
|
|
1525
|
+
if (!this._throttle("remove", path$1, 100)) return;
|
|
1476
1526
|
if (!isDirectory && this._watched.size === 1) this.add(directory, item, true);
|
|
1477
|
-
this._getWatchedDir(path$
|
|
1527
|
+
this._getWatchedDir(path$1).getChildren().forEach((nested) => this._remove(path$1, nested));
|
|
1478
1528
|
const parent = this._getWatchedDir(directory);
|
|
1479
1529
|
const wasTracked = parent.has(item);
|
|
1480
1530
|
parent.remove(item);
|
|
1481
1531
|
if (this._symlinkPaths.has(fullPath)) this._symlinkPaths.delete(fullPath);
|
|
1482
|
-
let relPath = path$
|
|
1483
|
-
if (this.options.cwd) relPath =
|
|
1532
|
+
let relPath = path$1;
|
|
1533
|
+
if (this.options.cwd) relPath = sp.relative(this.options.cwd, path$1);
|
|
1484
1534
|
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
|
1485
1535
|
if (this._pendingWrites.get(relPath).cancelWait() === EVENTS.ADD) return;
|
|
1486
1536
|
}
|
|
1487
|
-
this._watched.delete(path$
|
|
1537
|
+
this._watched.delete(path$1);
|
|
1488
1538
|
this._watched.delete(fullPath);
|
|
1489
1539
|
const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
|
|
1490
|
-
if (wasTracked && !this._isIgnored(path$
|
|
1491
|
-
this._closePath(path$
|
|
1540
|
+
if (wasTracked && !this._isIgnored(path$1)) this._emit(eventName, path$1);
|
|
1541
|
+
this._closePath(path$1);
|
|
1492
1542
|
}
|
|
1493
1543
|
/**
|
|
1494
1544
|
* Closes all watchers for a path
|
|
1495
1545
|
*/
|
|
1496
|
-
_closePath(path$
|
|
1497
|
-
this._closeFile(path$
|
|
1498
|
-
const dir =
|
|
1499
|
-
this._getWatchedDir(dir).remove(
|
|
1546
|
+
_closePath(path$1) {
|
|
1547
|
+
this._closeFile(path$1);
|
|
1548
|
+
const dir = sp.dirname(path$1);
|
|
1549
|
+
this._getWatchedDir(dir).remove(sp.basename(path$1));
|
|
1500
1550
|
}
|
|
1501
1551
|
/**
|
|
1502
1552
|
* Closes only file-specific watchers
|
|
1503
1553
|
*/
|
|
1504
|
-
_closeFile(path$
|
|
1505
|
-
const closers = this._closers.get(path$
|
|
1554
|
+
_closeFile(path$1) {
|
|
1555
|
+
const closers = this._closers.get(path$1);
|
|
1506
1556
|
if (!closers) return;
|
|
1507
1557
|
closers.forEach((closer) => closer());
|
|
1508
|
-
this._closers.delete(path$
|
|
1558
|
+
this._closers.delete(path$1);
|
|
1509
1559
|
}
|
|
1510
|
-
_addPathCloser(path$
|
|
1560
|
+
_addPathCloser(path$1, closer) {
|
|
1511
1561
|
if (!closer) return;
|
|
1512
|
-
let list = this._closers.get(path$
|
|
1562
|
+
let list = this._closers.get(path$1);
|
|
1513
1563
|
if (!list) {
|
|
1514
1564
|
list = [];
|
|
1515
|
-
this._closers.set(path$
|
|
1565
|
+
this._closers.set(path$1, list);
|
|
1516
1566
|
}
|
|
1517
1567
|
list.push(closer);
|
|
1518
1568
|
}
|
|
@@ -1552,10 +1602,10 @@ function watch$1(paths, options = {}) {
|
|
|
1552
1602
|
watcher.add(paths);
|
|
1553
1603
|
return watcher;
|
|
1554
1604
|
}
|
|
1555
|
-
var
|
|
1605
|
+
var chokidar_default = {
|
|
1556
1606
|
watch: watch$1,
|
|
1557
1607
|
FSWatcher
|
|
1558
1608
|
};
|
|
1559
1609
|
|
|
1560
1610
|
//#endregion
|
|
1561
|
-
export { watch$1 as
|
|
1611
|
+
export { watch$1 as n, chokidar_exports as t };
|