@rsbuild/core 2.0.0-beta.1 → 2.0.0-beta.11
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/compiled/chokidar/index.d.ts +197 -29
- package/compiled/chokidar/package.json +1 -1
- package/compiled/connect-next/index.d.ts +56 -0
- package/compiled/connect-next/license +26 -0
- package/compiled/connect-next/package.json +1 -0
- package/compiled/cors/index.d.ts +56 -0
- package/compiled/cors/license +22 -0
- package/compiled/cors/package.json +1 -0
- package/compiled/css-loader/index.js +2 -2
- package/compiled/css-loader/package.json +1 -1
- package/compiled/html-rspack-plugin/index.js +29 -74
- package/compiled/html-rspack-plugin/package.json +1 -1
- package/compiled/jiti/LICENSE +21 -0
- package/compiled/jiti/README.md +243 -0
- package/compiled/jiti/dist/babel.cjs +46699 -0
- package/compiled/jiti/dist/jiti.cjs +4842 -0
- package/compiled/jiti/lib/jiti-cli.mjs +19 -0
- package/compiled/jiti/lib/jiti-hooks.mjs +89 -0
- package/compiled/jiti/lib/jiti-native.mjs +76 -0
- package/compiled/jiti/lib/jiti-register.d.mts +1 -0
- package/compiled/jiti/lib/jiti-register.mjs +2 -0
- package/compiled/jiti/lib/jiti.cjs +24 -0
- package/compiled/jiti/lib/jiti.d.cts +8 -0
- package/compiled/jiti/lib/jiti.d.mts +8 -0
- package/compiled/jiti/lib/jiti.mjs +23 -0
- package/compiled/jiti/lib/types.d.ts +363 -0
- package/compiled/jiti/package.json +133 -0
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/lib/at-rule.d.ts +1 -1
- package/compiled/postcss/lib/comment.d.ts +1 -1
- package/compiled/postcss/lib/container.d.ts +1 -1
- package/compiled/postcss/lib/css-syntax-error.d.ts +1 -1
- package/compiled/postcss/lib/declaration.d.ts +1 -1
- package/compiled/postcss/lib/document.d.ts +1 -1
- package/compiled/postcss/lib/input.d.ts +1 -1
- package/compiled/postcss/lib/lazy-result.d.ts +1 -1
- package/compiled/postcss/lib/no-work-result.d.ts +1 -1
- package/compiled/postcss/lib/node.d.ts +1 -1
- package/compiled/postcss/lib/previous-map.d.ts +1 -1
- package/compiled/postcss/lib/processor.d.ts +1 -1
- package/compiled/postcss/lib/result.d.ts +1 -1
- package/compiled/postcss/lib/root.d.ts +1 -1
- package/compiled/postcss/lib/rule.d.ts +1 -1
- package/compiled/postcss/lib/stringifier.d.ts +1 -1
- package/compiled/postcss/lib/warning.d.ts +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +10 -9
- package/compiled/postcss-loader/package.json +1 -1
- package/compiled/rslog/index.d.ts +34 -3
- package/compiled/rslog/package.json +1 -1
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-chain/types/index.d.ts +0 -5
- package/compiled/rspack-manifest-plugin/index.d.ts +48 -0
- package/compiled/rspack-manifest-plugin/license +21 -0
- package/compiled/rspack-manifest-plugin/package.json +1 -0
- package/compiled/style-loader/index.js +37 -94
- package/compiled/style-loader/package.json +1 -1
- package/dist/{rslib-runtime.js → 1~rslib-runtime.js} +4 -4
- package/dist/{131.js → 552.js} +1753 -1573
- package/dist/chokidar.js +60 -57
- package/dist/client/hmr.js +3 -3
- package/dist/client/overlay.js +2 -2
- package/dist/connect-next.js +264 -0
- package/dist/{connect.js.LICENSE.txt → connect-next.js.LICENSE.txt} +3 -13
- package/dist/cors.js +3 -3
- package/dist/debug.js +503 -0
- package/dist/http-proxy-middleware.js +2947 -0
- package/dist/http-proxy-middleware.js.LICENSE.txt +69 -0
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +81 -20
- package/dist/manifest-plugin.js +12 -19
- package/dist/memfs.js +223 -781
- package/dist/open.js +32 -28
- package/dist/range-parser.js +3 -3
- package/dist/remapping.js +2 -2
- package/dist/sirv.js +18 -18
- package/dist/tinyglobby.js +115 -70
- package/dist/transformLoader.mjs +38 -1
- package/dist/transformRawLoader.mjs +1 -1
- package/dist/ws.js +1513 -0
- package/dist-types/createContext.d.ts +3 -2
- package/dist-types/helpers/format.d.ts +2 -1
- package/dist-types/helpers/fs.d.ts +2 -1
- package/dist-types/helpers/index.d.ts +1 -1
- package/dist-types/helpers/stats.d.ts +4 -3
- package/dist-types/helpers/vendors.d.ts +0 -2
- package/dist-types/hooks.d.ts +3 -3
- package/dist-types/index.d.ts +4 -3
- package/dist-types/initPlugins.d.ts +2 -1
- package/dist-types/logger.d.ts +9 -3
- package/dist-types/pluginManager.d.ts +2 -1
- package/dist-types/restart.d.ts +4 -2
- package/dist-types/server/assets-middleware/index.d.ts +3 -2
- package/dist-types/server/assets-middleware/setupWriteToDisk.d.ts +2 -1
- package/dist-types/server/cliShortcuts.d.ts +4 -1
- package/dist-types/server/devMiddlewares.d.ts +4 -6
- package/dist-types/server/devServer.d.ts +8 -42
- package/dist-types/server/helper.d.ts +50 -16
- package/dist-types/server/historyApiFallback.d.ts +2 -1
- package/dist-types/server/middlewares.d.ts +5 -3
- package/dist-types/server/open.d.ts +4 -2
- package/dist-types/server/previewServer.d.ts +4 -0
- package/dist-types/server/proxy.d.ts +3 -2
- package/dist-types/server/runner/asModule.d.ts +1 -1
- package/dist-types/server/serverSetup.d.ts +2 -0
- package/dist-types/server/socketServer.d.ts +4 -1
- package/dist-types/server/watchFiles.d.ts +1 -1
- package/dist-types/types/config.d.ts +110 -17
- package/dist-types/types/context.d.ts +3 -0
- package/dist-types/types/hooks.d.ts +17 -15
- package/dist-types/types/plugin.d.ts +14 -11
- package/dist-types/types/rsbuild.d.ts +11 -4
- package/dist-types/types/thirdParty.d.ts +15 -6
- package/package.json +25 -28
- package/types.d.ts +1 -1
- package/compiled/chokidar/handler.d.ts +0 -90
- package/compiled/http-proxy-middleware/index.js +0 -6132
- 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/743.js +0 -7
- package/dist/88.js +0 -40
- package/dist/connect.js +0 -581
- package/dist-types/server/prodServer.d.ts +0 -24
- /package/compiled/html-rspack-plugin/{loader.js → htmlLoader.js} +0 -0
- /package/dist/{131.js.LICENSE.txt → 552.js.LICENSE.txt} +0 -0
- /package/dist/client/{59.js → 797.js} +0 -0
- /package/dist/{710.js → mrmime.js} +0 -0
- /package/dist/{31.js → trace-mapping.js} +0 -0
package/dist/chokidar.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
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 { join, 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
|
+
import * as __rspack_external_node_path_c5b9b54f from "node:path";
|
|
9
|
+
let EntryTypes_FILE_TYPE = 'files', EntryTypes_DIR_TYPE = 'directories', EntryTypes_FILE_DIR_TYPE = 'files_directories', defaultOptions = {
|
|
7
10
|
root: '.',
|
|
8
11
|
fileFilter: (_entryInfo)=>!0,
|
|
9
12
|
directoryFilter: (_entryInfo)=>!0,
|
|
@@ -46,7 +49,7 @@ let RECURSIVE_ERROR_CODE = 'READDIRP_RECURSIVE_ERROR', NORMAL_FLOW_ERRORS = new
|
|
|
46
49
|
}
|
|
47
50
|
return emptyFn;
|
|
48
51
|
};
|
|
49
|
-
class ReaddirpStream extends
|
|
52
|
+
class ReaddirpStream extends Readable {
|
|
50
53
|
parents;
|
|
51
54
|
reading;
|
|
52
55
|
parent;
|
|
@@ -75,7 +78,7 @@ class ReaddirpStream extends external_node_stream_.Readable {
|
|
|
75
78
|
let statMethod = opts.lstat ? lstat : promises_stat;
|
|
76
79
|
wantBigintFsStats ? this._stat = (path)=>statMethod(path, {
|
|
77
80
|
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 = (
|
|
81
|
+
}) : 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
82
|
encoding: 'utf8',
|
|
80
83
|
withFileTypes: this._isDirent
|
|
81
84
|
}, this.parents = [
|
|
@@ -128,9 +131,9 @@ class ReaddirpStream extends external_node_stream_.Readable {
|
|
|
128
131
|
async _formatEntry(dirent, path) {
|
|
129
132
|
let entry, basename = this._isDirent ? dirent.name : dirent;
|
|
130
133
|
try {
|
|
131
|
-
let fullPath = (
|
|
134
|
+
let fullPath = external_node_path_resolve(join(path, basename));
|
|
132
135
|
(entry = {
|
|
133
|
-
path: (
|
|
136
|
+
path: external_node_path_relative(this._root, fullPath),
|
|
134
137
|
fullPath,
|
|
135
138
|
basename
|
|
136
139
|
})[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
|
@@ -155,7 +158,7 @@ class ReaddirpStream extends external_node_stream_.Readable {
|
|
|
155
158
|
if (entryRealPathStats.isFile()) return 'file';
|
|
156
159
|
if (entryRealPathStats.isDirectory()) {
|
|
157
160
|
let len = entryRealPath.length;
|
|
158
|
-
if (full.startsWith(entryRealPath) && full.substr(len, 1) ===
|
|
161
|
+
if (full.startsWith(entryRealPath) && full.substr(len, 1) === sep) {
|
|
159
162
|
let recursiveError = Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
|
|
160
163
|
return recursiveError.code = RECURSIVE_ERROR_CODE, this._onError(recursiveError);
|
|
161
164
|
}
|
|
@@ -179,7 +182,7 @@ function readdirp(root, options = {}) {
|
|
|
179
182
|
} else throw Error('readdirp: root argument is required. Usage: readdirp(root, options)');
|
|
180
183
|
return options.root = root, new ReaddirpStream(options);
|
|
181
184
|
}
|
|
182
|
-
let
|
|
185
|
+
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
186
|
lstat: lstat,
|
|
184
187
|
stat: promises_stat
|
|
185
188
|
}, KEY_LISTENERS = 'listeners', KEY_ERR = 'errHandlers', KEY_RAW = 'rawEmitters', HANDLER_KEYS = [
|
|
@@ -461,12 +464,12 @@ let external_node_fs_ = __webpack_require__("node:fs"), EMPTY_FN = ()=>{}, pl =
|
|
|
461
464
|
}, isEmptySet = (val)=>val instanceof Set ? 0 === val.size : !val, FsWatchInstances = new Map();
|
|
462
465
|
function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
|
|
463
466
|
try {
|
|
464
|
-
return
|
|
467
|
+
return watch(path, {
|
|
465
468
|
persistent: options.persistent
|
|
466
469
|
}, (rawEvent, evPath)=>{
|
|
467
470
|
listener(path), emitRaw(rawEvent, evPath, {
|
|
468
471
|
watchedPath: path
|
|
469
|
-
}), evPath && path !== evPath && fsWatchBroadcast(
|
|
472
|
+
}), evPath && path !== evPath && fsWatchBroadcast(__rspack_external_node_path_c5b9b54f.resolve(path, evPath), KEY_LISTENERS, __rspack_external_node_path_c5b9b54f.join(path, evPath));
|
|
470
473
|
});
|
|
471
474
|
} catch (error) {
|
|
472
475
|
errHandler(error);
|
|
@@ -486,18 +489,18 @@ class NodeFsHandler {
|
|
|
486
489
|
this.fsw = fsW, this._boundHandleError = (error)=>fsW._handleError(error);
|
|
487
490
|
}
|
|
488
491
|
_watchWithNodeFs(path, listener) {
|
|
489
|
-
let closer, opts = this.fsw.options, directory =
|
|
492
|
+
let closer, opts = this.fsw.options, directory = __rspack_external_node_path_c5b9b54f.dirname(path), basename = __rspack_external_node_path_c5b9b54f.basename(path);
|
|
490
493
|
this.fsw._getWatchedDir(directory).add(basename);
|
|
491
|
-
let absolutePath =
|
|
494
|
+
let absolutePath = __rspack_external_node_path_c5b9b54f.resolve(path), options = {
|
|
492
495
|
persistent: opts.persistent
|
|
493
496
|
};
|
|
494
|
-
if (listener || (listener = EMPTY_FN), opts.usePolling) options.interval = opts.interval !== opts.binaryInterval && binaryExtensions.has(
|
|
497
|
+
if (listener || (listener = EMPTY_FN), opts.usePolling) options.interval = opts.interval !== opts.binaryInterval && binaryExtensions.has(__rspack_external_node_path_c5b9b54f.extname(basename).slice(1).toLowerCase()) ? opts.binaryInterval : opts.interval, closer = ((path, fullPath, options, handlers)=>{
|
|
495
498
|
let { listener, rawEmitter } = handlers, cont = FsWatchFileInstances.get(fullPath), copts = cont && cont.options;
|
|
496
|
-
return copts && (copts.persistent < options.persistent || copts.interval > options.interval) && (
|
|
499
|
+
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
500
|
listeners: listener,
|
|
498
501
|
rawEmitters: rawEmitter,
|
|
499
502
|
options,
|
|
500
|
-
watcher:
|
|
503
|
+
watcher: watchFile(fullPath, options, (curr, prev)=>{
|
|
501
504
|
foreach(cont.rawEmitters, (rawEmitter)=>{
|
|
502
505
|
rawEmitter(EVENTS_CHANGE, fullPath, {
|
|
503
506
|
curr,
|
|
@@ -508,7 +511,7 @@ class NodeFsHandler {
|
|
|
508
511
|
(curr.size !== prev.size || currmtime > prev.mtimeMs || 0 === currmtime) && foreach(cont.listeners, (listener)=>listener(path, curr));
|
|
509
512
|
})
|
|
510
513
|
}, FsWatchFileInstances.set(fullPath, cont)), ()=>{
|
|
511
|
-
delFromSet(cont, KEY_LISTENERS, listener), delFromSet(cont, KEY_RAW, rawEmitter), isEmptySet(cont.listeners) && (FsWatchFileInstances.delete(fullPath),
|
|
514
|
+
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
515
|
};
|
|
513
516
|
})(path, absolutePath, options, {
|
|
514
517
|
listener,
|
|
@@ -555,7 +558,7 @@ class NodeFsHandler {
|
|
|
555
558
|
}
|
|
556
559
|
_handleFile(file, stats, initialAdd) {
|
|
557
560
|
if (this.fsw.closed) return;
|
|
558
|
-
let dirname =
|
|
561
|
+
let dirname = __rspack_external_node_path_c5b9b54f.dirname(file), basename = __rspack_external_node_path_c5b9b54f.basename(file), parent = this.fsw._getWatchedDir(dirname), prevStats = stats;
|
|
559
562
|
if (parent.has(basename)) return;
|
|
560
563
|
let listener = async (path, newStats)=>{
|
|
561
564
|
if (this.fsw._throttle('watch', file, 5)) if (newStats && 0 !== newStats.mtimeMs) {
|
|
@@ -600,7 +603,7 @@ class NodeFsHandler {
|
|
|
600
603
|
this.fsw._symlinkPaths.set(full, !0);
|
|
601
604
|
}
|
|
602
605
|
_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
|
|
603
|
-
directory =
|
|
606
|
+
directory = __rspack_external_node_path_c5b9b54f.join(directory, '');
|
|
604
607
|
let throttleKey = target ? `${directory}:${target}` : directory;
|
|
605
608
|
if (!(throttler = this.fsw._throttle('readdir', throttleKey, 1000))) return;
|
|
606
609
|
let previous = this.fsw._getWatchedDir(wh.path), current = new Set(), stream = this.fsw._readdirp(directory, {
|
|
@@ -612,13 +615,13 @@ class NodeFsHandler {
|
|
|
612
615
|
stream = void 0;
|
|
613
616
|
return;
|
|
614
617
|
}
|
|
615
|
-
let item = entry.path, path =
|
|
618
|
+
let item = entry.path, path = __rspack_external_node_path_c5b9b54f.join(directory, item);
|
|
616
619
|
if (current.add(item), !(entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item))) {
|
|
617
620
|
if (this.fsw.closed) {
|
|
618
621
|
stream = void 0;
|
|
619
622
|
return;
|
|
620
623
|
}
|
|
621
|
-
item !== target && (target || previous.has(item)) || (this.fsw._incrReadyCount(), path =
|
|
624
|
+
item !== target && (target || previous.has(item)) || (this.fsw._incrReadyCount(), path = __rspack_external_node_path_c5b9b54f.join(dir, __rspack_external_node_path_c5b9b54f.relative(dir, path)), this._addToNodeFs(path, initialAdd, wh, depth + 1));
|
|
622
625
|
}
|
|
623
626
|
}).on(EVENTS_ERROR, this._boundHandleError), new Promise((resolve, reject)=>{
|
|
624
627
|
if (!stream) return reject();
|
|
@@ -635,8 +638,8 @@ class NodeFsHandler {
|
|
|
635
638
|
});
|
|
636
639
|
}
|
|
637
640
|
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(
|
|
641
|
+
let throttler, closer, parentDir = this.fsw._getWatchedDir(__rspack_external_node_path_c5b9b54f.dirname(dir)), tracked = parentDir.has(__rspack_external_node_path_c5b9b54f.basename(dir));
|
|
642
|
+
initialAdd && this.fsw.options.ignoreInitial || target || tracked || this.fsw._emit(EVENTS_ADD_DIR, dir, stats), parentDir.add(__rspack_external_node_path_c5b9b54f.basename(dir)), this.fsw._getWatchedDir(dir);
|
|
640
643
|
let oDepth = this.fsw.options.depth;
|
|
641
644
|
if ((null == oDepth || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) {
|
|
642
645
|
if (!target && (await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler), this.fsw.closed)) return;
|
|
@@ -657,15 +660,15 @@ class NodeFsHandler {
|
|
|
657
660
|
if (this.fsw._isIgnored(wh.watchPath, stats)) return ready(), !1;
|
|
658
661
|
let follow = this.fsw.options.followSymlinks;
|
|
659
662
|
if (stats.isDirectory()) {
|
|
660
|
-
let absPath =
|
|
663
|
+
let absPath = __rspack_external_node_path_c5b9b54f.resolve(path), targetPath = follow ? await promises_realpath(path) : path;
|
|
661
664
|
if (this.fsw.closed || (closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath), this.fsw.closed)) return;
|
|
662
665
|
absPath !== targetPath && void 0 !== targetPath && this.fsw._symlinkPaths.set(absPath, targetPath);
|
|
663
666
|
} else if (stats.isSymbolicLink()) {
|
|
664
667
|
let targetPath = follow ? await promises_realpath(path) : path;
|
|
665
668
|
if (this.fsw.closed) return;
|
|
666
|
-
let parent =
|
|
669
|
+
let parent = __rspack_external_node_path_c5b9b54f.dirname(wh.watchPath);
|
|
667
670
|
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(
|
|
671
|
+
void 0 !== targetPath && this.fsw._symlinkPaths.set(__rspack_external_node_path_c5b9b54f.resolve(path), targetPath);
|
|
669
672
|
} else closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
|
670
673
|
return ready(), closer && this.fsw._addPathCloser(path, closer), !1;
|
|
671
674
|
} catch (error) {
|
|
@@ -673,7 +676,7 @@ class NodeFsHandler {
|
|
|
673
676
|
}
|
|
674
677
|
}
|
|
675
678
|
}
|
|
676
|
-
let
|
|
679
|
+
let BACK_SLASH_RE = /\\/g, DOUBLE_SLASH_RE = /\/\//g, DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/, REPLACER_RE = /^\.[/\\]/;
|
|
677
680
|
function arrify(item) {
|
|
678
681
|
return Array.isArray(item) ? item : [
|
|
679
682
|
item
|
|
@@ -684,15 +687,15 @@ function createPattern(matcher) {
|
|
|
684
687
|
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
688
|
if (matcher.path === string) return !0;
|
|
686
689
|
if (matcher.recursive) {
|
|
687
|
-
let relative =
|
|
688
|
-
return !!relative && !relative.startsWith('..') && !
|
|
690
|
+
let relative = __rspack_external_node_path_c5b9b54f.relative(matcher.path, string);
|
|
691
|
+
return !!relative && !relative.startsWith('..') && !__rspack_external_node_path_c5b9b54f.isAbsolute(relative);
|
|
689
692
|
}
|
|
690
693
|
return !1;
|
|
691
694
|
} : ()=>!1;
|
|
692
695
|
}
|
|
693
696
|
function normalizePath(path) {
|
|
694
697
|
if ('string' != typeof path) throw Error('string expected');
|
|
695
|
-
path = (path =
|
|
698
|
+
path = (path = __rspack_external_node_path_c5b9b54f.normalize(path)).replace(/\\/g, '/');
|
|
696
699
|
let prepend = !1;
|
|
697
700
|
return path.startsWith('//') && (prepend = !0), path = path.replace(DOUBLE_SLASH_RE, '/'), prepend && (path = '/' + path), path;
|
|
698
701
|
}
|
|
@@ -713,7 +716,7 @@ let unifyPaths = (paths_)=>{
|
|
|
713
716
|
}, toUnix = (string)=>{
|
|
714
717
|
let str = string.replace(BACK_SLASH_RE, '/'), prepend = !1;
|
|
715
718
|
return str.startsWith('//') && (prepend = !0), str = str.replace(DOUBLE_SLASH_RE, '/'), prepend && (str = '/' + str), str;
|
|
716
|
-
}, normalizePathToUnix = (path)=>toUnix(
|
|
719
|
+
}, normalizePathToUnix = (path)=>toUnix(__rspack_external_node_path_c5b9b54f.normalize(toUnix(path))), normalizeIgnored = (cwd = '')=>(path)=>'string' == typeof path ? normalizePathToUnix(__rspack_external_node_path_c5b9b54f.isAbsolute(path) ? path : __rspack_external_node_path_c5b9b54f.join(cwd, path)) : path, EMPTY_SET = Object.freeze(new Set());
|
|
717
720
|
class DirEntry {
|
|
718
721
|
path;
|
|
719
722
|
_removeWatcher;
|
|
@@ -732,7 +735,7 @@ class DirEntry {
|
|
|
732
735
|
try {
|
|
733
736
|
await readdir(dir);
|
|
734
737
|
} catch (err) {
|
|
735
|
-
this._removeWatcher && this._removeWatcher(
|
|
738
|
+
this._removeWatcher && this._removeWatcher(__rspack_external_node_path_c5b9b54f.dirname(dir), __rspack_external_node_path_c5b9b54f.basename(dir));
|
|
736
739
|
}
|
|
737
740
|
}
|
|
738
741
|
has(item) {
|
|
@@ -760,12 +763,12 @@ class WatchHelper {
|
|
|
760
763
|
constructor(path, follow, fsw){
|
|
761
764
|
this.fsw = fsw;
|
|
762
765
|
let watchPath = path;
|
|
763
|
-
this.path = path = path.replace(REPLACER_RE, ''), this.watchPath = watchPath, this.fullWatchPath =
|
|
766
|
+
this.path = path = path.replace(REPLACER_RE, ''), this.watchPath = watchPath, this.fullWatchPath = __rspack_external_node_path_c5b9b54f.resolve(watchPath), this.dirParts = [], this.dirParts.forEach((parts)=>{
|
|
764
767
|
parts.length > 1 && parts.pop();
|
|
765
768
|
}), this.followSymlinks = follow, this.statMethod = follow ? 'stat' : 'lstat';
|
|
766
769
|
}
|
|
767
770
|
entryPath(entry) {
|
|
768
|
-
return
|
|
771
|
+
return __rspack_external_node_path_c5b9b54f.join(this.watchPath, __rspack_external_node_path_c5b9b54f.relative(this.watchPath, entry.fullPath));
|
|
769
772
|
}
|
|
770
773
|
filterPath(entry) {
|
|
771
774
|
let { stats } = entry;
|
|
@@ -777,7 +780,7 @@ class WatchHelper {
|
|
|
777
780
|
return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
|
|
778
781
|
}
|
|
779
782
|
}
|
|
780
|
-
class FSWatcher extends
|
|
783
|
+
class FSWatcher extends EventEmitter {
|
|
781
784
|
closed;
|
|
782
785
|
options;
|
|
783
786
|
_closers;
|
|
@@ -843,14 +846,14 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
843
846
|
let { cwd } = this.options;
|
|
844
847
|
this.closed = !1, this._closePromise = void 0;
|
|
845
848
|
let paths = unifyPaths(paths_);
|
|
846
|
-
return cwd && (paths = paths.map((path)=>
|
|
849
|
+
return cwd && (paths = paths.map((path)=>__rspack_external_node_path_c5b9b54f.isAbsolute(path) ? path : __rspack_external_node_path_c5b9b54f.join(cwd, path))), paths.forEach((path)=>{
|
|
847
850
|
this._removeIgnoredPath(path);
|
|
848
851
|
}), this._userIgnored = void 0, this._readyCount || (this._readyCount = 0), this._readyCount += paths.length, Promise.all(paths.map(async (path)=>{
|
|
849
852
|
let res = await this._nodeFsHandler._addToNodeFs(path, !_internal, void 0, 0, _origAdd);
|
|
850
853
|
return res && this._emitReady(), res;
|
|
851
854
|
})).then((results)=>{
|
|
852
855
|
this.closed || results.forEach((item)=>{
|
|
853
|
-
item && this.add(
|
|
856
|
+
item && this.add(__rspack_external_node_path_c5b9b54f.dirname(item), __rspack_external_node_path_c5b9b54f.basename(_origAdd || item));
|
|
854
857
|
});
|
|
855
858
|
}), this;
|
|
856
859
|
}
|
|
@@ -858,7 +861,7 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
858
861
|
if (this.closed) return this;
|
|
859
862
|
let paths = unifyPaths(paths_), { cwd } = this.options;
|
|
860
863
|
return paths.forEach((path)=>{
|
|
861
|
-
|
|
864
|
+
__rspack_external_node_path_c5b9b54f.isAbsolute(path) || this._closers.has(path) || (cwd && (path = __rspack_external_node_path_c5b9b54f.join(cwd, path)), path = __rspack_external_node_path_c5b9b54f.resolve(path)), this._closePath(path), this._addIgnoredPath(path), this._watched.has(path) && this._addIgnoredPath({
|
|
862
865
|
path,
|
|
863
866
|
recursive: !0
|
|
864
867
|
}), this._userIgnored = void 0;
|
|
@@ -876,7 +879,7 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
876
879
|
getWatched() {
|
|
877
880
|
let watchList = {};
|
|
878
881
|
return this._watched.forEach((entry, dir)=>{
|
|
879
|
-
watchList[(this.options.cwd ?
|
|
882
|
+
watchList[(this.options.cwd ? __rspack_external_node_path_c5b9b54f.relative(this.options.cwd, dir) : dir) || '.'] = entry.getChildren().sort();
|
|
880
883
|
}), watchList;
|
|
881
884
|
}
|
|
882
885
|
emitWithAll(event, args) {
|
|
@@ -886,7 +889,7 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
886
889
|
let pw;
|
|
887
890
|
if (this.closed) return;
|
|
888
891
|
let opts = this.options;
|
|
889
|
-
isWindows && (path =
|
|
892
|
+
isWindows && (path = __rspack_external_node_path_c5b9b54f.normalize(path)), opts.cwd && (path = __rspack_external_node_path_c5b9b54f.relative(opts.cwd, path));
|
|
890
893
|
let args = [
|
|
891
894
|
path
|
|
892
895
|
];
|
|
@@ -912,7 +915,7 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
912
915
|
}
|
|
913
916
|
if (event === EVENTS_CHANGE && !this._throttle(EVENTS_CHANGE, path, 50)) return this;
|
|
914
917
|
if (opts.alwaysStat && void 0 === stats && (event === EVENTS_ADD || event === EVENTS_ADD_DIR || event === EVENTS_CHANGE)) {
|
|
915
|
-
let stats, fullPath = opts.cwd ?
|
|
918
|
+
let stats, fullPath = opts.cwd ? __rspack_external_node_path_c5b9b54f.join(opts.cwd, path) : path;
|
|
916
919
|
try {
|
|
917
920
|
stats = await promises_stat(fullPath);
|
|
918
921
|
} catch (err) {}
|
|
@@ -949,10 +952,10 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
949
952
|
let timeoutHandler, awf = this.options.awaitWriteFinish;
|
|
950
953
|
if ('object' != typeof awf) return;
|
|
951
954
|
let pollInterval = awf.pollInterval, fullPath = path;
|
|
952
|
-
this.options.cwd && !
|
|
955
|
+
this.options.cwd && !__rspack_external_node_path_c5b9b54f.isAbsolute(path) && (fullPath = __rspack_external_node_path_c5b9b54f.join(this.options.cwd, path));
|
|
953
956
|
let now = new Date(), writes = this._pendingWrites;
|
|
954
957
|
function awaitWriteFinishFn(prevStat) {
|
|
955
|
-
(
|
|
958
|
+
external_node_fs_stat(fullPath, (err, curStat)=>{
|
|
956
959
|
if (err || !writes.has(path)) {
|
|
957
960
|
err && 'ENOENT' !== err.code && awfEmit(err);
|
|
958
961
|
return;
|
|
@@ -986,28 +989,28 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
986
989
|
return new WatchHelper(path, this.options.followSymlinks, this);
|
|
987
990
|
}
|
|
988
991
|
_getWatchedDir(directory) {
|
|
989
|
-
let dir =
|
|
992
|
+
let dir = __rspack_external_node_path_c5b9b54f.resolve(directory);
|
|
990
993
|
return this._watched.has(dir) || this._watched.set(dir, new DirEntry(dir, this._boundRemove)), this._watched.get(dir);
|
|
991
994
|
}
|
|
992
995
|
_hasReadPermissions(stats) {
|
|
993
996
|
return !!this.options.ignorePermissionErrors || !!(256 & Number(stats.mode));
|
|
994
997
|
}
|
|
995
998
|
_remove(directory, item, isDirectory) {
|
|
996
|
-
let path =
|
|
999
|
+
let path = __rspack_external_node_path_c5b9b54f.join(directory, item), fullPath = __rspack_external_node_path_c5b9b54f.resolve(path);
|
|
997
1000
|
if (isDirectory = null != isDirectory ? isDirectory : this._watched.has(path) || this._watched.has(fullPath), !this._throttle('remove', path, 100)) return;
|
|
998
1001
|
isDirectory || 1 !== this._watched.size || this.add(directory, item, !0), this._getWatchedDir(path).getChildren().forEach((nested)=>this._remove(path, nested));
|
|
999
1002
|
let parent = this._getWatchedDir(directory), wasTracked = parent.has(item);
|
|
1000
1003
|
parent.remove(item), this._symlinkPaths.has(fullPath) && this._symlinkPaths.delete(fullPath);
|
|
1001
1004
|
let relPath = path;
|
|
1002
|
-
if (this.options.cwd && (relPath =
|
|
1005
|
+
if (this.options.cwd && (relPath = __rspack_external_node_path_c5b9b54f.relative(this.options.cwd, path)), this.options.awaitWriteFinish && this._pendingWrites.has(relPath) && this._pendingWrites.get(relPath).cancelWait() === EVENTS_ADD) return;
|
|
1003
1006
|
this._watched.delete(path), this._watched.delete(fullPath);
|
|
1004
1007
|
let eventName = isDirectory ? EVENTS_UNLINK_DIR : EVENTS_UNLINK;
|
|
1005
1008
|
wasTracked && !this._isIgnored(path) && this._emit(eventName, path), this._closePath(path);
|
|
1006
1009
|
}
|
|
1007
1010
|
_closePath(path) {
|
|
1008
1011
|
this._closeFile(path);
|
|
1009
|
-
let dir =
|
|
1010
|
-
this._getWatchedDir(dir).remove(
|
|
1012
|
+
let dir = __rspack_external_node_path_c5b9b54f.dirname(path);
|
|
1013
|
+
this._getWatchedDir(dir).remove(__rspack_external_node_path_c5b9b54f.basename(path));
|
|
1011
1014
|
}
|
|
1012
1015
|
_closeFile(path) {
|
|
1013
1016
|
let closers = this._closers.get(path);
|
|
@@ -1034,11 +1037,11 @@ class FSWatcher extends external_node_events_.EventEmitter {
|
|
|
1034
1037
|
}), stream;
|
|
1035
1038
|
}
|
|
1036
1039
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1040
|
+
function chokidar_watch(paths, options = {}) {
|
|
1041
|
+
let watcher = new FSWatcher(options);
|
|
1042
|
+
return watcher.add(paths), watcher;
|
|
1043
|
+
}
|
|
1044
|
+
export default {
|
|
1045
|
+
watch: chokidar_watch,
|
|
1042
1046
|
FSWatcher: FSWatcher
|
|
1043
1047
|
};
|
|
1044
|
-
export { chokidar };
|
package/dist/client/hmr.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger } from "./
|
|
1
|
+
import { logger } from "./797.js";
|
|
2
2
|
let createOverlay;
|
|
3
3
|
let clearOverlay;
|
|
4
4
|
function setupCustomHMRListeners(customListenersMap) {
|
|
@@ -200,7 +200,7 @@ function init(token, config, serverHost, serverPort, liveReload, browserLogs, lo
|
|
|
200
200
|
} else if ('string' == typeof reason) message = reason;
|
|
201
201
|
else try {
|
|
202
202
|
message = JSON.stringify(reason);
|
|
203
|
-
} catch (
|
|
203
|
+
} catch (unused) {
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
206
206
|
sendError(`Uncaught (in promise) ${message}`, stack);
|
|
@@ -232,7 +232,7 @@ function init(token, config, serverHost, serverPort, liveReload, browserLogs, lo
|
|
|
232
232
|
});
|
|
233
233
|
window.addEventListener('unhandledrejection', onUnhandledRejection);
|
|
234
234
|
}
|
|
235
|
-
if (
|
|
235
|
+
if (import.meta.webpackHot) setupCustomHMRListeners(customListenersMap);
|
|
236
236
|
connect();
|
|
237
237
|
}
|
|
238
238
|
export { init, registerOverlay };
|
package/dist/client/overlay.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { registerOverlay } from "./hmr.js";
|
|
2
|
-
import { logger } from "./
|
|
2
|
+
import { logger } from "./797.js";
|
|
3
3
|
function _define_property(obj, key, value) {
|
|
4
4
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
5
5
|
value: value,
|
|
@@ -201,7 +201,7 @@ function createOverlay(title, content) {
|
|
|
201
201
|
const overlay = document.createElement(overlayId);
|
|
202
202
|
overlay.init(getOverlayHtml(title, content));
|
|
203
203
|
document.body.appendChild(overlay);
|
|
204
|
-
} catch (
|
|
204
|
+
} catch (unused) {
|
|
205
205
|
warn();
|
|
206
206
|
}
|
|
207
207
|
}
|