@rsbuild/core 2.0.0-beta.7 → 2.0.0-beta.8
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/bin/rsbuild.js +13 -0
- package/compiled/connect-next/index.d.ts +56 -0
- package/compiled/{connect → connect-next}/license +1 -0
- package/compiled/connect-next/package.json +1 -0
- package/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/jiti/dist/babel.cjs +60 -60
- package/compiled/jiti/dist/jiti.cjs +2 -2
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rslog/index.d.ts +17 -1
- package/compiled/rslog/package.json +1 -1
- package/dist/{131.js → 958.js} +254 -357
- package/dist/chokidar.js +59 -57
- package/dist/client/hmr.js +1 -1
- package/dist/client/overlay.js +1 -1
- package/dist/connect-next.js +268 -0
- package/dist/{connect.js.LICENSE.txt → connect-next.js.LICENSE.txt} +3 -13
- package/dist/cors.js +2 -2
- package/dist/http-proxy-middleware.js +57 -552
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +23 -8
- package/dist/manifest-plugin.js +18 -18
- package/dist/memfs.js +178 -717
- package/dist/{710.js → mrmime.js} +2 -1
- package/dist/open.js +35 -32
- package/dist/range-parser.js +2 -2
- package/dist/remapping.js +2 -2
- package/dist/rslib-runtime.js +3 -3
- package/dist/sirv.js +14 -14
- package/dist/src.js +510 -0
- package/dist/tinyglobby.js +25 -25
- package/dist/transformLoader.mjs +38 -1
- package/dist/transformRawLoader.mjs +1 -1
- package/dist/ws.js +1541 -0
- package/dist-types/helpers/index.d.ts +1 -1
- package/dist-types/helpers/vendors.d.ts +0 -1
- package/dist-types/server/runner/asModule.d.ts +1 -1
- package/dist-types/server/socketServer.d.ts +1 -1
- package/dist-types/types/thirdParty.d.ts +1 -1
- package/package.json +7 -8
- package/compiled/connect/index.d.ts +0 -90
- package/compiled/connect/package.json +0 -1
- package/compiled/ws/index.d.ts +0 -437
- package/compiled/ws/index.js +0 -3166
- package/compiled/ws/license +0 -20
- package/compiled/ws/package.json +0 -1
- package/dist/397.js +0 -11
- package/dist/7.js +0 -1
- package/dist/712.js +0 -15
- package/dist/743.js +0 -7
- package/dist/88.js +0 -40
- package/dist/connect.js +0 -574
- package/dist-types/helpers/color.d.ts +0 -4
- /package/dist/{131.js.LICENSE.txt → 958.js.LICENSE.txt} +0 -0
- /package/dist/client/{59.js → 797.js} +0 -0
- /package/dist/{31.js → trace-mapping.js} +0 -0
package/dist/chokidar.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
import {
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
/*! LICENSE: chokidar.js.LICENSE.txt */
|
|
2
|
+
import { EventEmitter } from "node:events";
|
|
3
|
+
import { stat as external_node_fs_stat, unwatchFile, watch, watchFile } from "node:fs";
|
|
4
|
+
import { lstat, open as promises_open, readdir, realpath as promises_realpath, stat as promises_stat } from "node:fs/promises";
|
|
5
|
+
import { basename as external_node_path_basename, dirname as external_node_path_dirname, extname, isAbsolute, join, normalize, relative as external_node_path_relative, resolve as external_node_path_resolve, sep } from "node:path";
|
|
6
|
+
import { Readable } from "node:stream";
|
|
7
|
+
import { type as external_node_os_type } from "node:os";
|
|
8
|
+
let EntryTypes_FILE_TYPE = 'files', EntryTypes_DIR_TYPE = 'directories', EntryTypes_FILE_DIR_TYPE = 'files_directories', defaultOptions = {
|
|
7
9
|
root: '.',
|
|
8
10
|
fileFilter: (_entryInfo)=>!0,
|
|
9
11
|
directoryFilter: (_entryInfo)=>!0,
|
|
@@ -46,7 +48,7 @@ let RECURSIVE_ERROR_CODE = 'READDIRP_RECURSIVE_ERROR', NORMAL_FLOW_ERRORS = new
|
|
|
46
48
|
}
|
|
47
49
|
return emptyFn;
|
|
48
50
|
};
|
|
49
|
-
class ReaddirpStream extends
|
|
51
|
+
class ReaddirpStream extends Readable {
|
|
50
52
|
parents;
|
|
51
53
|
reading;
|
|
52
54
|
parent;
|
|
@@ -75,7 +77,7 @@ class ReaddirpStream extends external_node_stream_.Readable {
|
|
|
75
77
|
let statMethod = opts.lstat ? lstat : promises_stat;
|
|
76
78
|
wantBigintFsStats ? this._stat = (path)=>statMethod(path, {
|
|
77
79
|
bigint: !0
|
|
78
|
-
}) : this._stat = statMethod, this._maxDepth = null != opts.depth && Number.isSafeInteger(opts.depth) ? opts.depth : defaultOptions.depth, this._wantsDir = !!type && DIR_TYPES.has(type), this._wantsFile = !!type && FILE_TYPES.has(type), this._wantsEverything = 'all' === type, this._root = (
|
|
80
|
+
}) : this._stat = statMethod, this._maxDepth = null != opts.depth && Number.isSafeInteger(opts.depth) ? opts.depth : defaultOptions.depth, this._wantsDir = !!type && DIR_TYPES.has(type), this._wantsFile = !!type && FILE_TYPES.has(type), this._wantsEverything = 'all' === type, this._root = external_node_path_resolve(root), this._isDirent = !opts.alwaysStat, this._statsProp = this._isDirent ? 'dirent' : 'stats', this._rdOptions = {
|
|
79
81
|
encoding: 'utf8',
|
|
80
82
|
withFileTypes: this._isDirent
|
|
81
83
|
}, this.parents = [
|
|
@@ -128,9 +130,9 @@ class ReaddirpStream extends external_node_stream_.Readable {
|
|
|
128
130
|
async _formatEntry(dirent, path) {
|
|
129
131
|
let entry, basename = this._isDirent ? dirent.name : dirent;
|
|
130
132
|
try {
|
|
131
|
-
let fullPath = (
|
|
133
|
+
let fullPath = external_node_path_resolve(join(path, basename));
|
|
132
134
|
(entry = {
|
|
133
|
-
path: (
|
|
135
|
+
path: external_node_path_relative(this._root, fullPath),
|
|
134
136
|
fullPath,
|
|
135
137
|
basename
|
|
136
138
|
})[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
@@ -155,7 +157,7 @@ class ReaddirpStream extends external_node_stream_.Readable {
|
|
|
155
157
|
if (entryRealPathStats.isFile()) return 'file';
|
|
156
158
|
if (entryRealPathStats.isDirectory()) {
|
|
157
159
|
let len = entryRealPath.length;
|
|
158
|
-
if (full.startsWith(entryRealPath) && full.substr(len, 1) ===
|
|
160
|
+
if (full.startsWith(entryRealPath) && full.substr(len, 1) === sep) {
|
|
159
161
|
let recursiveError = Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
|
|
160
162
|
return recursiveError.code = RECURSIVE_ERROR_CODE, this._onError(recursiveError);
|
|
161
163
|
}
|
|
@@ -179,7 +181,7 @@ function readdirp(root, options = {}) {
|
|
|
179
181
|
} else throw Error('readdirp: root argument is required. Usage: readdirp(root, options)');
|
|
180
182
|
return options.root = root, new ReaddirpStream(options);
|
|
181
183
|
}
|
|
182
|
-
let
|
|
184
|
+
let EMPTY_FN = ()=>{}, pl = process.platform, isWindows = 'win32' === pl, isMacos = 'darwin' === pl, isLinux = 'linux' === pl, isFreeBSD = 'freebsd' === pl, isIBMi = 'OS400' === external_node_os_type(), EVENTS_ALL = 'all', EVENTS_READY = 'ready', EVENTS_ADD = 'add', EVENTS_CHANGE = 'change', EVENTS_ADD_DIR = 'addDir', EVENTS_UNLINK = 'unlink', EVENTS_UNLINK_DIR = 'unlinkDir', EVENTS_RAW = 'raw', EVENTS_ERROR = 'error', statMethods = {
|
|
183
185
|
lstat: lstat,
|
|
184
186
|
stat: promises_stat
|
|
185
187
|
}, KEY_LISTENERS = 'listeners', KEY_ERR = 'errHandlers', KEY_RAW = 'rawEmitters', HANDLER_KEYS = [
|
|
@@ -461,12 +463,12 @@ let external_node_fs_ = __webpack_require__("node:fs"), external_node_os_ = __we
|
|
|
461
463
|
}, isEmptySet = (val)=>val instanceof Set ? 0 === val.size : !val, FsWatchInstances = new Map();
|
|
462
464
|
function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
|
|
463
465
|
try {
|
|
464
|
-
return
|
|
466
|
+
return watch(path, {
|
|
465
467
|
persistent: options.persistent
|
|
466
468
|
}, (rawEvent, evPath)=>{
|
|
467
469
|
listener(path), emitRaw(rawEvent, evPath, {
|
|
468
470
|
watchedPath: path
|
|
469
|
-
}), evPath && path !== evPath && fsWatchBroadcast(
|
|
471
|
+
}), evPath && path !== evPath && fsWatchBroadcast(external_node_path_resolve(path, evPath), KEY_LISTENERS, join(path, evPath));
|
|
470
472
|
});
|
|
471
473
|
} catch (error) {
|
|
472
474
|
errHandler(error);
|
|
@@ -486,18 +488,18 @@ class NodeFsHandler {
|
|
|
486
488
|
this.fsw = fsW, this._boundHandleError = (error)=>fsW._handleError(error);
|
|
487
489
|
}
|
|
488
490
|
_watchWithNodeFs(path, listener) {
|
|
489
|
-
let closer, opts = this.fsw.options, directory =
|
|
491
|
+
let closer, opts = this.fsw.options, directory = external_node_path_dirname(path), basename = external_node_path_basename(path);
|
|
490
492
|
this.fsw._getWatchedDir(directory).add(basename);
|
|
491
|
-
let absolutePath =
|
|
493
|
+
let absolutePath = external_node_path_resolve(path), options = {
|
|
492
494
|
persistent: opts.persistent
|
|
493
495
|
};
|
|
494
|
-
if (listener || (listener = EMPTY_FN), opts.usePolling) options.interval = opts.interval !== opts.binaryInterval && binaryExtensions.has(
|
|
496
|
+
if (listener || (listener = EMPTY_FN), opts.usePolling) options.interval = opts.interval !== opts.binaryInterval && binaryExtensions.has(extname(basename).slice(1).toLowerCase()) ? opts.binaryInterval : opts.interval, closer = ((path, fullPath, options, handlers)=>{
|
|
495
497
|
let { listener, rawEmitter } = handlers, cont = FsWatchFileInstances.get(fullPath), copts = cont && cont.options;
|
|
496
|
-
return copts && (copts.persistent < options.persistent || copts.interval > options.interval) && (
|
|
498
|
+
return copts && (copts.persistent < options.persistent || copts.interval > options.interval) && (unwatchFile(fullPath), cont = void 0), cont ? (addAndConvert(cont, KEY_LISTENERS, listener), addAndConvert(cont, KEY_RAW, rawEmitter)) : (cont = {
|
|
497
499
|
listeners: listener,
|
|
498
500
|
rawEmitters: rawEmitter,
|
|
499
501
|
options,
|
|
500
|
-
watcher:
|
|
502
|
+
watcher: watchFile(fullPath, options, (curr, prev)=>{
|
|
501
503
|
foreach(cont.rawEmitters, (rawEmitter)=>{
|
|
502
504
|
rawEmitter(EVENTS_CHANGE, fullPath, {
|
|
503
505
|
curr,
|
|
@@ -508,7 +510,7 @@ class NodeFsHandler {
|
|
|
508
510
|
(curr.size !== prev.size || currmtime > prev.mtimeMs || 0 === currmtime) && foreach(cont.listeners, (listener)=>listener(path, curr));
|
|
509
511
|
})
|
|
510
512
|
}, FsWatchFileInstances.set(fullPath, cont)), ()=>{
|
|
511
|
-
delFromSet(cont, KEY_LISTENERS, listener), delFromSet(cont, KEY_RAW, rawEmitter), isEmptySet(cont.listeners) && (FsWatchFileInstances.delete(fullPath),
|
|
513
|
+
delFromSet(cont, KEY_LISTENERS, listener), delFromSet(cont, KEY_RAW, rawEmitter), isEmptySet(cont.listeners) && (FsWatchFileInstances.delete(fullPath), unwatchFile(fullPath), cont.options = cont.watcher = void 0, Object.freeze(cont));
|
|
512
514
|
};
|
|
513
515
|
})(path, absolutePath, options, {
|
|
514
516
|
listener,
|
|
@@ -555,7 +557,7 @@ class NodeFsHandler {
|
|
|
555
557
|
}
|
|
556
558
|
_handleFile(file, stats, initialAdd) {
|
|
557
559
|
if (this.fsw.closed) return;
|
|
558
|
-
let dirname =
|
|
560
|
+
let dirname = external_node_path_dirname(file), basename = external_node_path_basename(file), parent = this.fsw._getWatchedDir(dirname), prevStats = stats;
|
|
559
561
|
if (parent.has(basename)) return;
|
|
560
562
|
let listener = async (path, newStats)=>{
|
|
561
563
|
if (this.fsw._throttle('watch', file, 5)) if (newStats && 0 !== newStats.mtimeMs) {
|
|
@@ -600,7 +602,7 @@ class NodeFsHandler {
|
|
|
600
602
|
this.fsw._symlinkPaths.set(full, !0);
|
|
601
603
|
}
|
|
602
604
|
_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
|
|
603
|
-
directory =
|
|
605
|
+
directory = join(directory, '');
|
|
604
606
|
let throttleKey = target ? `${directory}:${target}` : directory;
|
|
605
607
|
if (!(throttler = this.fsw._throttle('readdir', throttleKey, 1000))) return;
|
|
606
608
|
let previous = this.fsw._getWatchedDir(wh.path), current = new Set(), stream = this.fsw._readdirp(directory, {
|
|
@@ -612,13 +614,13 @@ class NodeFsHandler {
|
|
|
612
614
|
stream = void 0;
|
|
613
615
|
return;
|
|
614
616
|
}
|
|
615
|
-
let item = entry.path, path =
|
|
617
|
+
let item = entry.path, path = join(directory, item);
|
|
616
618
|
if (current.add(item), !(entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item))) {
|
|
617
619
|
if (this.fsw.closed) {
|
|
618
620
|
stream = void 0;
|
|
619
621
|
return;
|
|
620
622
|
}
|
|
621
|
-
item !== target && (target || previous.has(item)) || (this.fsw._incrReadyCount(), path =
|
|
623
|
+
item !== target && (target || previous.has(item)) || (this.fsw._incrReadyCount(), path = join(dir, external_node_path_relative(dir, path)), this._addToNodeFs(path, initialAdd, wh, depth + 1));
|
|
622
624
|
}
|
|
623
625
|
}).on(EVENTS_ERROR, this._boundHandleError), new Promise((resolve, reject)=>{
|
|
624
626
|
if (!stream) return reject();
|
|
@@ -635,8 +637,8 @@ class NodeFsHandler {
|
|
|
635
637
|
});
|
|
636
638
|
}
|
|
637
639
|
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
|
|
638
|
-
let throttler, closer, parentDir = this.fsw._getWatchedDir(
|
|
639
|
-
initialAdd && this.fsw.options.ignoreInitial || target || tracked || this.fsw._emit(EVENTS_ADD_DIR, dir, stats), parentDir.add(
|
|
640
|
+
let throttler, closer, parentDir = this.fsw._getWatchedDir(external_node_path_dirname(dir)), tracked = parentDir.has(external_node_path_basename(dir));
|
|
641
|
+
initialAdd && this.fsw.options.ignoreInitial || target || tracked || this.fsw._emit(EVENTS_ADD_DIR, dir, stats), parentDir.add(external_node_path_basename(dir)), this.fsw._getWatchedDir(dir);
|
|
640
642
|
let oDepth = this.fsw.options.depth;
|
|
641
643
|
if ((null == oDepth || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) {
|
|
642
644
|
if (!target && (await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler), this.fsw.closed)) return;
|
|
@@ -657,15 +659,15 @@ class NodeFsHandler {
|
|
|
657
659
|
if (this.fsw._isIgnored(wh.watchPath, stats)) return ready(), !1;
|
|
658
660
|
let follow = this.fsw.options.followSymlinks;
|
|
659
661
|
if (stats.isDirectory()) {
|
|
660
|
-
let absPath =
|
|
662
|
+
let absPath = external_node_path_resolve(path), targetPath = follow ? await promises_realpath(path) : path;
|
|
661
663
|
if (this.fsw.closed || (closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath), this.fsw.closed)) return;
|
|
662
664
|
absPath !== targetPath && void 0 !== targetPath && this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
663
665
|
} else if (stats.isSymbolicLink()) {
|
|
664
666
|
let targetPath = follow ? await promises_realpath(path) : path;
|
|
665
667
|
if (this.fsw.closed) return;
|
|
666
|
-
let parent =
|
|
668
|
+
let parent = external_node_path_dirname(wh.watchPath);
|
|
667
669
|
if (this.fsw._getWatchedDir(parent).add(wh.watchPath), this.fsw._emit(EVENTS_ADD, wh.watchPath, stats), closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath), this.fsw.closed) return;
|
|
668
|
-
void 0 !== targetPath && this.fsw._symlinkPaths.set(
|
|
670
|
+
void 0 !== targetPath && this.fsw._symlinkPaths.set(external_node_path_resolve(path), targetPath);
|
|
669
671
|
} else closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
670
672
|
return ready(), closer && this.fsw._addPathCloser(path, closer), !1;
|
|
671
673
|
} catch (error) {
|
|
@@ -673,7 +675,7 @@ class NodeFsHandler {
|
|
|
673
675
|
}
|
|
674
676
|
}
|
|
675
677
|
}
|
|
676
|
-
let
|
|
678
|
+
let BACK_SLASH_RE = /\\/g, DOUBLE_SLASH_RE = /\/\//g, DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/, REPLACER_RE = /^\.[/\\]/;
|
|
677
679
|
function arrify(item) {
|
|
678
680
|
return Array.isArray(item) ? item : [
|
|
679
681
|
item
|
|
@@ -684,15 +686,15 @@ function createPattern(matcher) {
|
|
|
684
686
|
return 'function' == typeof matcher ? matcher : 'string' == typeof matcher ? (string)=>matcher === string : matcher instanceof RegExp ? (string)=>matcher.test(string) : 'object' == typeof matcher && null !== matcher ? (string)=>{
|
|
685
687
|
if (matcher.path === string) return !0;
|
|
686
688
|
if (matcher.recursive) {
|
|
687
|
-
let relative =
|
|
688
|
-
return !!relative && !relative.startsWith('..') && !
|
|
689
|
+
let relative = external_node_path_relative(matcher.path, string);
|
|
690
|
+
return !!relative && !relative.startsWith('..') && !isAbsolute(relative);
|
|
689
691
|
}
|
|
690
692
|
return !1;
|
|
691
693
|
} : ()=>!1;
|
|
692
694
|
}
|
|
693
695
|
function normalizePath(path) {
|
|
694
696
|
if ('string' != typeof path) throw Error('string expected');
|
|
695
|
-
path = (path =
|
|
697
|
+
path = (path = normalize(path)).replace(/\\/g, '/');
|
|
696
698
|
let prepend = !1;
|
|
697
699
|
return path.startsWith('//') && (prepend = !0), path = path.replace(DOUBLE_SLASH_RE, '/'), prepend && (path = '/' + path), path;
|
|
698
700
|
}
|
|
@@ -713,7 +715,7 @@ let unifyPaths = (paths_)=>{
|
|
|
713
715
|
}, toUnix = (string)=>{
|
|
714
716
|
let str = string.replace(BACK_SLASH_RE, '/'), prepend = !1;
|
|
715
717
|
return str.startsWith('//') && (prepend = !0), str = str.replace(DOUBLE_SLASH_RE, '/'), prepend && (str = '/' + str), str;
|
|
716
|
-
}, normalizePathToUnix = (path)=>toUnix(
|
|
718
|
+
}, normalizePathToUnix = (path)=>toUnix(normalize(toUnix(path))), normalizeIgnored = (cwd = '')=>(path)=>'string' == typeof path ? normalizePathToUnix(isAbsolute(path) ? path : join(cwd, path)) : path, EMPTY_SET = Object.freeze(new Set());
|
|
717
719
|
class DirEntry {
|
|
718
720
|
path;
|
|
719
721
|
_removeWatcher;
|
|
@@ -732,7 +734,7 @@ class DirEntry {
|
|
|
732
734
|
try {
|
|
733
735
|
await readdir(dir);
|
|
734
736
|
} catch (err) {
|
|
735
|
-
this._removeWatcher && this._removeWatcher(
|
|
737
|
+
this._removeWatcher && this._removeWatcher(external_node_path_dirname(dir), external_node_path_basename(dir));
|
|
736
738
|
}
|
|
737
739
|
}
|
|
738
740
|
has(item) {
|
|
@@ -760,12 +762,12 @@ class WatchHelper {
|
|
|
760
762
|
constructor(path, follow, fsw){
|
|
761
763
|
this.fsw = fsw;
|
|
762
764
|
let watchPath = path;
|
|
763
|
-
this.path = path = path.replace(REPLACER_RE, ''), this.watchPath = watchPath, this.fullWatchPath =
|
|
765
|
+
this.path = path = path.replace(REPLACER_RE, ''), this.watchPath = watchPath, this.fullWatchPath = external_node_path_resolve(watchPath), this.dirParts = [], this.dirParts.forEach((parts)=>{
|
|
764
766
|
parts.length > 1 && parts.pop();
|
|
765
767
|
}), this.followSymlinks = follow, this.statMethod = follow ? 'stat' : 'lstat';
|
|
766
768
|
}
|
|
767
769
|
entryPath(entry) {
|
|
768
|
-
return
|
|
770
|
+
return join(this.watchPath, external_node_path_relative(this.watchPath, entry.fullPath));
|
|
769
771
|
}
|
|
770
772
|
filterPath(entry) {
|
|
771
773
|
let { stats } = entry;
|
|
@@ -777,7 +779,7 @@ class WatchHelper {
|
|
|
777
779
|
return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
|
|
778
780
|
}
|
|
779
781
|
}
|
|
780
|
-
class FSWatcher extends
|
|
782
|
+
class FSWatcher extends EventEmitter {
|
|
781
783
|
closed;
|
|
782
784
|
options;
|
|
783
785
|
_closers;
|
|
@@ -843,14 +845,14 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
843
845
|
let { cwd } = this.options;
|
|
844
846
|
this.closed = !1, this._closePromise = void 0;
|
|
845
847
|
let paths = unifyPaths(paths_);
|
|
846
|
-
return cwd && (paths = paths.map((path)=>
|
|
848
|
+
return cwd && (paths = paths.map((path)=>isAbsolute(path) ? path : join(cwd, path))), paths.forEach((path)=>{
|
|
847
849
|
this._removeIgnoredPath(path);
|
|
848
850
|
}), this._userIgnored = void 0, this._readyCount || (this._readyCount = 0), this._readyCount += paths.length, Promise.all(paths.map(async (path)=>{
|
|
849
851
|
let res = await this._nodeFsHandler._addToNodeFs(path, !_internal, void 0, 0, _origAdd);
|
|
850
852
|
return res && this._emitReady(), res;
|
|
851
853
|
})).then((results)=>{
|
|
852
854
|
this.closed || results.forEach((item)=>{
|
|
853
|
-
item && this.add(
|
|
855
|
+
item && this.add(external_node_path_dirname(item), external_node_path_basename(_origAdd || item));
|
|
854
856
|
});
|
|
855
857
|
}), this;
|
|
856
858
|
}
|
|
@@ -858,7 +860,7 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
858
860
|
if (this.closed) return this;
|
|
859
861
|
let paths = unifyPaths(paths_), { cwd } = this.options;
|
|
860
862
|
return paths.forEach((path)=>{
|
|
861
|
-
|
|
863
|
+
isAbsolute(path) || this._closers.has(path) || (cwd && (path = join(cwd, path)), path = external_node_path_resolve(path)), this._closePath(path), this._addIgnoredPath(path), this._watched.has(path) && this._addIgnoredPath({
|
|
862
864
|
path,
|
|
863
865
|
recursive: !0
|
|
864
866
|
}), this._userIgnored = void 0;
|
|
@@ -876,7 +878,7 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
876
878
|
getWatched() {
|
|
877
879
|
let watchList = {};
|
|
878
880
|
return this._watched.forEach((entry, dir)=>{
|
|
879
|
-
watchList[(this.options.cwd ?
|
|
881
|
+
watchList[(this.options.cwd ? external_node_path_relative(this.options.cwd, dir) : dir) || '.'] = entry.getChildren().sort();
|
|
880
882
|
}), watchList;
|
|
881
883
|
}
|
|
882
884
|
emitWithAll(event, args) {
|
|
@@ -886,7 +888,7 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
886
888
|
let pw;
|
|
887
889
|
if (this.closed) return;
|
|
888
890
|
let opts = this.options;
|
|
889
|
-
isWindows && (path =
|
|
891
|
+
isWindows && (path = normalize(path)), opts.cwd && (path = external_node_path_relative(opts.cwd, path));
|
|
890
892
|
let args = [
|
|
891
893
|
path
|
|
892
894
|
];
|
|
@@ -912,7 +914,7 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
912
914
|
}
|
|
913
915
|
if (event === EVENTS_CHANGE && !this._throttle(EVENTS_CHANGE, path, 50)) return this;
|
|
914
916
|
if (opts.alwaysStat && void 0 === stats && (event === EVENTS_ADD || event === EVENTS_ADD_DIR || event === EVENTS_CHANGE)) {
|
|
915
|
-
let stats, fullPath = opts.cwd ?
|
|
917
|
+
let stats, fullPath = opts.cwd ? join(opts.cwd, path) : path;
|
|
916
918
|
try {
|
|
917
919
|
stats = await promises_stat(fullPath);
|
|
918
920
|
} catch (err) {}
|
|
@@ -949,10 +951,10 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
949
951
|
let timeoutHandler, awf = this.options.awaitWriteFinish;
|
|
950
952
|
if ('object' != typeof awf) return;
|
|
951
953
|
let pollInterval = awf.pollInterval, fullPath = path;
|
|
952
|
-
this.options.cwd && !
|
|
954
|
+
this.options.cwd && !isAbsolute(path) && (fullPath = join(this.options.cwd, path));
|
|
953
955
|
let now = new Date(), writes = this._pendingWrites;
|
|
954
956
|
function awaitWriteFinishFn(prevStat) {
|
|
955
|
-
(
|
|
957
|
+
external_node_fs_stat(fullPath, (err, curStat)=>{
|
|
956
958
|
if (err || !writes.has(path)) {
|
|
957
959
|
err && 'ENOENT' !== err.code && awfEmit(err);
|
|
958
960
|
return;
|
|
@@ -986,28 +988,28 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
986
988
|
return new WatchHelper(path, this.options.followSymlinks, this);
|
|
987
989
|
}
|
|
988
990
|
_getWatchedDir(directory) {
|
|
989
|
-
let dir =
|
|
991
|
+
let dir = external_node_path_resolve(directory);
|
|
990
992
|
return this._watched.has(dir) || this._watched.set(dir, new DirEntry(dir, this._boundRemove)), this._watched.get(dir);
|
|
991
993
|
}
|
|
992
994
|
_hasReadPermissions(stats) {
|
|
993
995
|
return !!this.options.ignorePermissionErrors || !!(256 & Number(stats.mode));
|
|
994
996
|
}
|
|
995
997
|
_remove(directory, item, isDirectory) {
|
|
996
|
-
let path =
|
|
998
|
+
let path = join(directory, item), fullPath = external_node_path_resolve(path);
|
|
997
999
|
if (isDirectory = null != isDirectory ? isDirectory : this._watched.has(path) || this._watched.has(fullPath), !this._throttle('remove', path, 100)) return;
|
|
998
1000
|
isDirectory || 1 !== this._watched.size || this.add(directory, item, !0), this._getWatchedDir(path).getChildren().forEach((nested)=>this._remove(path, nested));
|
|
999
1001
|
let parent = this._getWatchedDir(directory), wasTracked = parent.has(item);
|
|
1000
1002
|
parent.remove(item), this._symlinkPaths.has(fullPath) && this._symlinkPaths.delete(fullPath);
|
|
1001
1003
|
let relPath = path;
|
|
1002
|
-
if (this.options.cwd && (relPath =
|
|
1004
|
+
if (this.options.cwd && (relPath = external_node_path_relative(this.options.cwd, path)), this.options.awaitWriteFinish && this._pendingWrites.has(relPath) && this._pendingWrites.get(relPath).cancelWait() === EVENTS_ADD) return;
|
|
1003
1005
|
this._watched.delete(path), this._watched.delete(fullPath);
|
|
1004
1006
|
let eventName = isDirectory ? EVENTS_UNLINK_DIR : EVENTS_UNLINK;
|
|
1005
1007
|
wasTracked && !this._isIgnored(path) && this._emit(eventName, path), this._closePath(path);
|
|
1006
1008
|
}
|
|
1007
1009
|
_closePath(path) {
|
|
1008
1010
|
this._closeFile(path);
|
|
1009
|
-
let dir =
|
|
1010
|
-
this._getWatchedDir(dir).remove(
|
|
1011
|
+
let dir = external_node_path_dirname(path);
|
|
1012
|
+
this._getWatchedDir(dir).remove(external_node_path_basename(path));
|
|
1011
1013
|
}
|
|
1012
1014
|
_closeFile(path) {
|
|
1013
1015
|
let closers = this._closers.get(path);
|
|
@@ -1034,11 +1036,11 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
1034
1036
|
}), stream;
|
|
1035
1037
|
}
|
|
1036
1038
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1039
|
+
function chokidar_watch(paths, options = {}) {
|
|
1040
|
+
let watcher = new FSWatcher(options);
|
|
1041
|
+
return watcher.add(paths), watcher;
|
|
1042
|
+
}
|
|
1043
|
+
export default {
|
|
1044
|
+
watch: chokidar_watch,
|
|
1042
1045
|
FSWatcher: FSWatcher
|
|
1043
1046
|
};
|
|
1044
|
-
export { chokidar };
|
package/dist/client/hmr.js
CHANGED
package/dist/client/overlay.js
CHANGED