@rsbuild/core 2.0.6 → 2.0.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/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/style-loader/index.js +10 -10
- package/dist/{753.js → 756.js} +245 -161
- package/dist/chokidar.js +2 -2
- package/dist/client/hmr.js +1 -1
- package/dist/client/overlay.js +1 -1
- package/dist/http-proxy-middleware.js +10 -112
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +1 -1
- package/dist/manifest-plugin.js +7 -7
- package/dist/memfs.js +3 -3
- package/dist/workerLoader.mjs +94 -0
- package/dist/ws.js +48 -32
- package/dist-types/configChain.d.ts +3 -0
- package/dist-types/constants.d.ts +5 -0
- package/dist-types/helpers/packageJson.d.ts +9 -0
- package/dist-types/index.d.ts +1 -1
- package/dist-types/loader/workerLoader.d.ts +6 -0
- package/dist-types/mergeConfig.d.ts +6 -0
- package/dist-types/plugins/css.d.ts +1 -1
- package/dist-types/plugins/externals.d.ts +8 -1
- package/dist-types/plugins/worker.d.ts +2 -0
- package/dist-types/server/helper.d.ts +3 -2
- package/dist-types/types/config.d.ts +48 -7
- package/dist-types/types/plugin.d.ts +3 -3
- package/dist-types/types/rsbuild.d.ts +1 -1
- package/package.json +11 -11
- package/types.d.ts +42 -0
- /package/dist/{753.js.LICENSE.txt → 756.js.LICENSE.txt} +0 -0
- /package/dist/client/{797.js → 60.js} +0 -0
package/dist/chokidar.js
CHANGED
|
@@ -1030,9 +1030,9 @@ class FSWatcher extends EventEmitter {
|
|
|
1030
1030
|
...opts,
|
|
1031
1031
|
depth: 0
|
|
1032
1032
|
});
|
|
1033
|
-
return this._streams.add(stream), stream.once(
|
|
1033
|
+
return this._streams.add(stream), stream.once("close", ()=>{
|
|
1034
1034
|
stream = void 0;
|
|
1035
|
-
}), stream.once(
|
|
1035
|
+
}), stream.once("end", ()=>{
|
|
1036
1036
|
stream && (this._streams.delete(stream), stream = void 0);
|
|
1037
1037
|
}), stream;
|
|
1038
1038
|
}
|
package/dist/client/hmr.js
CHANGED
package/dist/client/overlay.js
CHANGED
|
@@ -10,10 +10,7 @@ import { URL as external_url_URL } from "url";
|
|
|
10
10
|
import "node:zlib";
|
|
11
11
|
import "node:querystring";
|
|
12
12
|
import { __webpack_require__ } from "./1~rslib-runtime.js";
|
|
13
|
-
import "./
|
|
14
|
-
import * as __rspack_external_node_os_74b4b876 from "node:os";
|
|
15
|
-
import * as __rspack_external_node_process_786449bf from "node:process";
|
|
16
|
-
import * as __rspack_external_node_tty_c64aab7e from "node:tty";
|
|
13
|
+
import "./756.js";
|
|
17
14
|
__webpack_require__.add({
|
|
18
15
|
"../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
19
16
|
let stringify = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js"), compile = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js"), expand = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js"), parse = __webpack_require__("../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js"), braces = (input, options = {})=>{
|
|
@@ -386,7 +383,7 @@ __webpack_require__.add({
|
|
|
386
383
|
return flat(args), result;
|
|
387
384
|
};
|
|
388
385
|
},
|
|
389
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
386
|
+
"../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js" (module, exports, __webpack_require__) {
|
|
390
387
|
let warned;
|
|
391
388
|
function useColors() {
|
|
392
389
|
let m;
|
|
@@ -497,7 +494,7 @@ __webpack_require__.add({
|
|
|
497
494
|
'#FF9933',
|
|
498
495
|
'#FFCC00',
|
|
499
496
|
'#FFCC33'
|
|
500
|
-
], exports.log = console.debug || console.log || (()=>{}), module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.
|
|
497
|
+
], exports.log = console.debug || console.log || (()=>{}), module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js")(exports);
|
|
501
498
|
let { formatters } = module.exports;
|
|
502
499
|
formatters.j = function(v) {
|
|
503
500
|
try {
|
|
@@ -507,7 +504,7 @@ __webpack_require__.add({
|
|
|
507
504
|
}
|
|
508
505
|
};
|
|
509
506
|
},
|
|
510
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
507
|
+
"../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
511
508
|
module.exports = function setup(env) {
|
|
512
509
|
function selectColor(namespace) {
|
|
513
510
|
let hash = 0;
|
|
@@ -581,10 +578,10 @@ __webpack_require__.add({
|
|
|
581
578
|
}), createDebug.names = [], createDebug.skips = [], createDebug.formatters = {}, createDebug.selectColor = selectColor, createDebug.enable(createDebug.load()), createDebug;
|
|
582
579
|
};
|
|
583
580
|
},
|
|
584
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
585
|
-
"u" < typeof process || 'renderer' === process.type || !0 === process.browser || process.__nwjs ? module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.
|
|
581
|
+
"../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
582
|
+
"u" < typeof process || 'renderer' === process.type || !0 === process.browser || process.__nwjs ? module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js") : module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.js");
|
|
586
583
|
},
|
|
587
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
584
|
+
"../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.js" (module, exports, __webpack_require__) {
|
|
588
585
|
let tty = __webpack_require__("tty"), util = __webpack_require__("util");
|
|
589
586
|
exports.init = init, exports.log = log, exports.formatArgs = formatArgs, exports.save = save, exports.load = load, exports.useColors = useColors, exports.destroy = util.deprecate(()=>{}, 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'), exports.colors = [
|
|
590
587
|
6,
|
|
@@ -595,7 +592,7 @@ __webpack_require__.add({
|
|
|
595
592
|
1
|
|
596
593
|
];
|
|
597
594
|
try {
|
|
598
|
-
let supportsColor = __webpack_require__("
|
|
595
|
+
let supportsColor = __webpack_require__("supports-color");
|
|
599
596
|
supportsColor && (supportsColor.stderr || supportsColor).level >= 2 && (exports.colors = [
|
|
600
597
|
20,
|
|
601
598
|
21,
|
|
@@ -705,7 +702,7 @@ __webpack_require__.add({
|
|
|
705
702
|
exports.inspectOpts = Object.keys(process.env).filter((key)=>/^debug_/i.test(key)).reduce((obj, key)=>{
|
|
706
703
|
let prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k)=>k.toUpperCase()), val = process.env[key];
|
|
707
704
|
return val = !!/^(yes|on|true|enabled)$/i.test(val) || !/^(no|off|false|disabled)$/i.test(val) && ('null' === val ? null : Number(val)), obj[prop] = val, obj;
|
|
708
|
-
}, {}), module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.
|
|
705
|
+
}, {}), module.exports = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js")(exports);
|
|
709
706
|
let { formatters } = module.exports;
|
|
710
707
|
formatters.o = function(v) {
|
|
711
708
|
return this.inspectOpts.colors = this.useColors, util.inspect(v, this.inspectOpts).split('\n').map((str)=>str.trim()).join(' ');
|
|
@@ -2240,105 +2237,6 @@ __webpack_require__.add({
|
|
|
2240
2237
|
}
|
|
2241
2238
|
}
|
|
2242
2239
|
toRegexRange.cache = {}, toRegexRange.clearCache = ()=>toRegexRange.cache = {}, module.exports = toRegexRange;
|
|
2243
|
-
},
|
|
2244
|
-
"node:os?3b8c" (module) {
|
|
2245
|
-
module.exports = __rspack_external_node_os_74b4b876;
|
|
2246
|
-
},
|
|
2247
|
-
"node:process?aa5c" (module) {
|
|
2248
|
-
module.exports = __rspack_external_node_process_786449bf;
|
|
2249
|
-
},
|
|
2250
|
-
"node:tty?4724" (module) {
|
|
2251
|
-
module.exports = __rspack_external_node_tty_c64aab7e;
|
|
2252
|
-
},
|
|
2253
|
-
"../../node_modules/.pnpm/supports-color@10.2.2/node_modules/supports-color/index.js" (__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2254
|
-
let flagForceColor;
|
|
2255
|
-
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
2256
|
-
createSupportsColor: ()=>createSupportsColor,
|
|
2257
|
-
default: ()=>__rspack_default_export
|
|
2258
|
-
});
|
|
2259
|
-
var node_process__rspack_import_0 = __webpack_require__("node:process?aa5c"), node_os__rspack_import_1 = __webpack_require__("node:os?3b8c"), node_tty__rspack_import_2 = __webpack_require__("node:tty?4724");
|
|
2260
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process__rspack_import_0.default.argv) {
|
|
2261
|
-
let prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--', position = argv.indexOf(prefix + flag), terminatorPosition = argv.indexOf('--');
|
|
2262
|
-
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
2263
|
-
}
|
|
2264
|
-
let { env } = node_process__rspack_import_0.default;
|
|
2265
|
-
function envForceColor() {
|
|
2266
|
-
if (!('FORCE_COLOR' in env)) return;
|
|
2267
|
-
if ('true' === env.FORCE_COLOR) return 1;
|
|
2268
|
-
if ('false' === env.FORCE_COLOR) return 0;
|
|
2269
|
-
if (0 === env.FORCE_COLOR.length) return 1;
|
|
2270
|
-
let level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
2271
|
-
if ([
|
|
2272
|
-
0,
|
|
2273
|
-
1,
|
|
2274
|
-
2,
|
|
2275
|
-
3
|
|
2276
|
-
].includes(level)) return level;
|
|
2277
|
-
}
|
|
2278
|
-
function translateLevel(level) {
|
|
2279
|
-
return 0 !== level && {
|
|
2280
|
-
level,
|
|
2281
|
-
hasBasic: !0,
|
|
2282
|
-
has256: level >= 2,
|
|
2283
|
-
has16m: level >= 3
|
|
2284
|
-
};
|
|
2285
|
-
}
|
|
2286
|
-
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = !0 } = {}) {
|
|
2287
|
-
let noFlagForceColor = envForceColor();
|
|
2288
|
-
void 0 !== noFlagForceColor && (flagForceColor = noFlagForceColor);
|
|
2289
|
-
let forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
2290
|
-
if (0 === forceColor) return 0;
|
|
2291
|
-
if (sniffFlags) {
|
|
2292
|
-
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3;
|
|
2293
|
-
if (hasFlag('color=256')) return 2;
|
|
2294
|
-
}
|
|
2295
|
-
if ('TF_BUILD' in env && 'AGENT_NAME' in env) return 1;
|
|
2296
|
-
if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
|
|
2297
|
-
let min = forceColor || 0;
|
|
2298
|
-
if ('dumb' === env.TERM) return min;
|
|
2299
|
-
if ('win32' === node_process__rspack_import_0.default.platform) {
|
|
2300
|
-
let osRelease = node_os__rspack_import_1.default.release().split('.');
|
|
2301
|
-
return Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586 ? Number(osRelease[2]) >= 14931 ? 3 : 2 : 1;
|
|
2302
|
-
}
|
|
2303
|
-
if ('CI' in env) return [
|
|
2304
|
-
'GITHUB_ACTIONS',
|
|
2305
|
-
'GITEA_ACTIONS',
|
|
2306
|
-
'CIRCLECI'
|
|
2307
|
-
].some((key)=>key in env) ? 3 : [
|
|
2308
|
-
'TRAVIS',
|
|
2309
|
-
'APPVEYOR',
|
|
2310
|
-
'GITLAB_CI',
|
|
2311
|
-
'BUILDKITE',
|
|
2312
|
-
'DRONE'
|
|
2313
|
-
].some((sign)=>sign in env) || 'codeship' === env.CI_NAME ? 1 : min;
|
|
2314
|
-
if ('TEAMCITY_VERSION' in env) return +!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION);
|
|
2315
|
-
if ('truecolor' === env.COLORTERM || 'xterm-kitty' === env.TERM || 'xterm-ghostty' === env.TERM || 'wezterm' === env.TERM) return 3;
|
|
2316
|
-
if ('TERM_PROGRAM' in env) {
|
|
2317
|
-
let version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
2318
|
-
switch(env.TERM_PROGRAM){
|
|
2319
|
-
case 'iTerm.app':
|
|
2320
|
-
return version >= 3 ? 3 : 2;
|
|
2321
|
-
case 'Apple_Terminal':
|
|
2322
|
-
return 2;
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
return /-256(color)?$/i.test(env.TERM) ? 2 : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM) || 'COLORTERM' in env ? 1 : min;
|
|
2326
|
-
}
|
|
2327
|
-
function createSupportsColor(stream, options = {}) {
|
|
2328
|
-
return translateLevel(_supportsColor(stream, {
|
|
2329
|
-
streamIsTTY: stream && stream.isTTY,
|
|
2330
|
-
...options
|
|
2331
|
-
}));
|
|
2332
|
-
}
|
|
2333
|
-
hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never') ? flagForceColor = 0 : (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) && (flagForceColor = 1);
|
|
2334
|
-
let __rspack_default_export = {
|
|
2335
|
-
stdout: createSupportsColor({
|
|
2336
|
-
isTTY: node_tty__rspack_import_2.default.isatty(1)
|
|
2337
|
-
}),
|
|
2338
|
-
stderr: createSupportsColor({
|
|
2339
|
-
isTTY: node_tty__rspack_import_2.default.isatty(2)
|
|
2340
|
-
})
|
|
2341
|
-
};
|
|
2342
2240
|
}
|
|
2343
2241
|
});
|
|
2344
2242
|
let upgradeHeader = /(^|,)\s*upgrade\s*($|,)/i, defaultAgents = {
|
|
@@ -2742,7 +2640,7 @@ function verifyConfig(options) {
|
|
|
2742
2640
|
if (!options.target && !options.router) throw Error(errors_ERRORS.ERR_CONFIG_FACTORY_TARGET_MISSING);
|
|
2743
2641
|
}
|
|
2744
2642
|
(ERRORS = errors_ERRORS || (errors_ERRORS = {})).ERR_CONFIG_FACTORY_TARGET_MISSING = "[HPM] Missing \"target\" option. Example: {target: \"http://www.example.org\"}", ERRORS.ERR_CONTEXT_MATCHER_GENERIC = "[HPM] Invalid pathFilter. Expecting something like: \"/api\" or [\"/api\", \"/ajax\"]", ERRORS.ERR_CONTEXT_MATCHER_INVALID_ARRAY = "[HPM] Invalid pathFilter. Plain paths (e.g. \"/api\") can not be mixed with globs (e.g. \"/api/**\"). Expecting something like: [\"/api\", \"/ajax\"] or [\"/api/**\", \"!**.html\"].", ERRORS.ERR_PATH_REWRITER_CONFIG = "[HPM] Invalid pathRewrite config. Expecting object with pathRewrite config or a rewrite function";
|
|
2745
|
-
let Debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.
|
|
2643
|
+
let Debug = __webpack_require__("../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js")('http-proxy-middleware'), debug = Debug.extend('debug-proxy-errors-plugin'), debugProxyErrorsPlugin = (proxyServer)=>{
|
|
2746
2644
|
proxyServer.on('error', (error, req, res, target)=>{
|
|
2747
2645
|
debug(`httpxy error event: \n%O`, error);
|
|
2748
2646
|
}), proxyServer.on('proxyReq', (proxyReq, req, socket)=>{
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createLogger, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig, loadEnv, logger, mergeRsbuildConfig, rspack, runCLI, version } from "./
|
|
1
|
+
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createLogger, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig, loadEnv, logger, mergeRsbuildConfig, rspack, runCLI, version } from "./756.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __webpack_require__ } from "./1~rslib-runtime.js";
|
|
2
|
-
import "./
|
|
2
|
+
import "./756.js";
|
|
3
3
|
__webpack_require__.add({
|
|
4
4
|
"../../node_modules/.pnpm/launch-editor-middleware@2.13.2/node_modules/launch-editor-middleware/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
5
5
|
let path = __webpack_require__("path?aeb1"), launch = __webpack_require__("../../node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/index.js");
|
package/dist/manifest-plugin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __webpack_require__ } from "./1~rslib-runtime.js";
|
|
2
|
-
import "./
|
|
2
|
+
import "./756.js";
|
|
3
3
|
__webpack_require__.add({
|
|
4
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.
|
|
4
|
+
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.5/node_modules/rspack-manifest-plugin/dist/helpers.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
5
5
|
exports.transformFiles = exports.reduceChunk = exports.reduceAssets = exports.generateManifest = void 0;
|
|
6
6
|
let node_path_1 = __webpack_require__("node:path?435f");
|
|
7
7
|
exports.generateManifest = (compilation, files, { generate, seed = {} })=>generate ? generate(seed, files, Array.from(compilation.entrypoints.entries()).reduce((e, [name, entrypoint])=>Object.assign(e, {
|
|
@@ -61,9 +61,9 @@ __webpack_require__.add({
|
|
|
61
61
|
'sort'
|
|
62
62
|
].filter((fname)=>!!options[fname]).reduce((prev, fname)=>prev[fname](options[fname]), files).map(standardizeFilePaths);
|
|
63
63
|
},
|
|
64
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.
|
|
64
|
+
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.5/node_modules/rspack-manifest-plugin/dist/hooks.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
65
65
|
exports.getCompilerHooks = exports.emitHook = exports.beforeRunHook = void 0;
|
|
66
|
-
let node_fs_1 = __webpack_require__("node:fs?9592"), node_path_1 = __webpack_require__("node:path?435f"), lite_tapable_1 = __webpack_require__("../../node_modules/.pnpm/@rspack+lite-tapable@1.1.0/node_modules/@rspack/lite-tapable/dist/index.cjs"), helpers_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.
|
|
66
|
+
let node_fs_1 = __webpack_require__("node:fs?9592"), node_path_1 = __webpack_require__("node:path?435f"), lite_tapable_1 = __webpack_require__("../../node_modules/.pnpm/@rspack+lite-tapable@1.1.0/node_modules/@rspack/lite-tapable/dist/index.cjs"), helpers_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.5/node_modules/rspack-manifest-plugin/dist/helpers.js"), compilerHookMap = new WeakMap(), getCompilerHooks = (compiler)=>{
|
|
67
67
|
let hooks = compilerHookMap.get(compiler);
|
|
68
68
|
return void 0 === hooks && (hooks = {
|
|
69
69
|
afterEmit: new lite_tapable_1.SyncWaterfallHook([
|
|
@@ -112,9 +112,9 @@ __webpack_require__.add({
|
|
|
112
112
|
getCompilerHooks(compiler).afterEmit.call(manifest);
|
|
113
113
|
};
|
|
114
114
|
},
|
|
115
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.
|
|
115
|
+
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.5/node_modules/rspack-manifest-plugin/dist/index.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
116
116
|
exports.RspackManifestPlugin = void 0;
|
|
117
|
-
let node_path_1 = __webpack_require__("node:path?435f"), hooks_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.
|
|
117
|
+
let node_path_1 = __webpack_require__("node:path?435f"), hooks_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.5/node_modules/rspack-manifest-plugin/dist/hooks.js"), emitCountMap = new Map(), defaults = {
|
|
118
118
|
assetHookStage: 1 / 0,
|
|
119
119
|
basePath: '',
|
|
120
120
|
fileName: 'manifest.json',
|
|
@@ -683,5 +683,5 @@ __webpack_require__.add({
|
|
|
683
683
|
});
|
|
684
684
|
}
|
|
685
685
|
});
|
|
686
|
-
var RspackManifestPlugin = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.
|
|
686
|
+
var RspackManifestPlugin = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.5/node_modules/rspack-manifest-plugin/dist/index.js").RspackManifestPlugin;
|
|
687
687
|
export { RspackManifestPlugin };
|
package/dist/memfs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __webpack_require__ } from "./1~rslib-runtime.js";
|
|
2
|
-
import "./
|
|
2
|
+
import "./756.js";
|
|
3
3
|
__webpack_require__.add({
|
|
4
4
|
"../../node_modules/.pnpm/@jsonjoy.com+base64@17.67.0_tslib@2.8.1/node_modules/@jsonjoy.com/base64/lib/constants.js" (__unused_rspack_module, exports) {
|
|
5
5
|
exports.alphabet = void 0, exports.alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', 'function' == typeof Buffer && Buffer.from;
|
|
@@ -5399,7 +5399,7 @@ __webpack_require__.add({
|
|
|
5399
5399
|
return RegExp('^' + regexStr + '$', options?.nocase ? 'i' : '');
|
|
5400
5400
|
};
|
|
5401
5401
|
},
|
|
5402
|
-
"../../node_modules/.pnpm/memfs@4.57.
|
|
5402
|
+
"../../node_modules/.pnpm/memfs@4.57.2/node_modules/memfs/lib/index.js" (module, exports, __webpack_require__) {
|
|
5403
5403
|
Object.defineProperty(exports, "__esModule", {
|
|
5404
5404
|
value: !0
|
|
5405
5405
|
}), exports.memfs = exports.fs = exports.vol = exports.Volume = void 0, exports.createFsFromVolume = createFsFromVolume;
|
|
@@ -5516,6 +5516,6 @@ __webpack_require__.add({
|
|
|
5516
5516
|
}
|
|
5517
5517
|
}
|
|
5518
5518
|
});
|
|
5519
|
-
let memfs_lib = __webpack_require__("../../node_modules/.pnpm/memfs@4.57.
|
|
5519
|
+
let memfs_lib = __webpack_require__("../../node_modules/.pnpm/memfs@4.57.2/node_modules/memfs/lib/index.js");
|
|
5520
5520
|
var Volume = memfs_lib.Volume, createFsFromVolume = memfs_lib.createFsFromVolume, fs = memfs_lib.fs, memfs = memfs_lib.memfs, semantic = memfs_lib.semantic, vol = memfs_lib.vol, lib__esModule = !0;
|
|
5521
5521
|
export { Volume, createFsFromVolume, fs, lib__esModule as __esModule, memfs, semantic, vol };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import node_path from "node:path";
|
|
2
|
+
let INLINE_QUERY_REGEX = /[?&]inline(?:&|=|$)/, JS_FILE_REGEX = /\.m?js(?:\?.*)?$/, SOURCE_MAPPING_URL_REGEX = /(?:\/\*# sourceMappingURL=.*?\*\/|\/\/# sourceMappingURL=.*)$/gm, getWorkerOptionsCode = (isModule)=>`{
|
|
3
|
+
${isModule ? 'type: "module",' : ''}
|
|
4
|
+
name: options && options.name
|
|
5
|
+
}`, deleteAsset = (compilation, filename)=>{
|
|
6
|
+
compilation.getAsset(filename) && compilation.deleteAsset(filename);
|
|
7
|
+
}, workerLoader_workerLoader = async function workerLoader() {
|
|
8
|
+
let callback = this.async(), isModule = !!this._compilation.outputOptions.module;
|
|
9
|
+
try {
|
|
10
|
+
if (!INLINE_QUERY_REGEX.test(this.resourceQuery)) return void callback(null, (({ resourcePath, isModule })=>{
|
|
11
|
+
let resourcePath1, workerRequest = (resourcePath1 = resourcePath, `./${node_path.basename(resourcePath1).replace(/\\/g, '/')}`), workerOptions = getWorkerOptionsCode(isModule);
|
|
12
|
+
return `export default function WorkerWrapper(options) {
|
|
13
|
+
return new Worker(new URL(${JSON.stringify(workerRequest)}, import.meta.url), ${workerOptions});
|
|
14
|
+
}`;
|
|
15
|
+
})({
|
|
16
|
+
resourcePath: this.resourcePath,
|
|
17
|
+
isModule
|
|
18
|
+
}));
|
|
19
|
+
let source = await ((context)=>{
|
|
20
|
+
let compiler = context._compiler, compilation = context._compilation, { rspack } = compiler, { outputOptions } = compilation, compilerName = `rsbuild-worker ${context.resourcePath}`, childCompiler = compilation.createChildCompiler(compilerName, {
|
|
21
|
+
publicPath: outputOptions.publicPath,
|
|
22
|
+
globalObject: 'self',
|
|
23
|
+
module: outputOptions.module,
|
|
24
|
+
chunkFormat: outputOptions.module ? 'module' : void 0,
|
|
25
|
+
chunkLoading: outputOptions.module ? 'import' : void 0,
|
|
26
|
+
workerChunkLoading: outputOptions.workerChunkLoading,
|
|
27
|
+
wasmLoading: outputOptions.wasmLoading,
|
|
28
|
+
workerWasmLoading: outputOptions.workerWasmLoading
|
|
29
|
+
}, []);
|
|
30
|
+
new rspack.webworker.WebWorkerTemplatePlugin().apply(childCompiler);
|
|
31
|
+
let moduleOptions = childCompiler.options.module, parserOptions = moduleOptions.parser ?? {};
|
|
32
|
+
return childCompiler.options.module = {
|
|
33
|
+
...moduleOptions,
|
|
34
|
+
parser: {
|
|
35
|
+
...parserOptions,
|
|
36
|
+
javascript: {
|
|
37
|
+
...parserOptions.javascript,
|
|
38
|
+
dynamicImportMode: 'eager'
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, new rspack.LoaderTargetPlugin('webworker').apply(childCompiler), new rspack.EntryPlugin(context.context ?? node_path.dirname(context.resourcePath), context.resourcePath, node_path.parse(context.resourcePath).name).apply(childCompiler), new Promise((resolve, reject)=>{
|
|
42
|
+
childCompiler.runAsChild((error, entries, childCompilation)=>{
|
|
43
|
+
if (error) return void reject(error);
|
|
44
|
+
let entry = entries?.[0];
|
|
45
|
+
if (!entry || !childCompilation) return void reject(Error(`[rsbuild:worker] Failed to compile inline worker "${context.resourcePath}".`));
|
|
46
|
+
let workerFilename = [
|
|
47
|
+
...entry.files
|
|
48
|
+
].filter((file)=>JS_FILE_REGEX.test(file))[0];
|
|
49
|
+
if (!workerFilename) return void reject(Error(`[rsbuild:worker] Failed to find the inline worker output for "${context.resourcePath}".`));
|
|
50
|
+
if (childCompilation.getAssets().map((asset)=>asset.name).filter((file)=>file !== workerFilename && JS_FILE_REGEX.test(file)).length > 0) return void reject(Error(`[rsbuild:worker] Inline workers do not support code splitting yet. Use ?worker instead, or remove dynamic imports from "${context.resourcePath}".`));
|
|
51
|
+
let asset = childCompilation.getAsset(workerFilename);
|
|
52
|
+
if (!asset) return void reject(Error(`[rsbuild:worker] Failed to read the inline worker output "${workerFilename}".`));
|
|
53
|
+
for (let file of (deleteAsset(compilation, workerFilename), deleteAsset(compilation, `${workerFilename}.map`), childCompilation.fileDependencies))context.addDependency(file);
|
|
54
|
+
for (let dir of childCompilation.contextDependencies)context.addContextDependency(dir);
|
|
55
|
+
for (let missing of childCompilation.missingDependencies)context.addMissingDependency(missing);
|
|
56
|
+
resolve(asset.source.source().toString());
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
})(this);
|
|
60
|
+
callback(null, (({ source, isModule })=>{
|
|
61
|
+
let workerOptions = getWorkerOptionsCode(isModule), revokeCode = isModule ? 'URL.revokeObjectURL(import.meta.url);' : '(self.URL || self.webkitURL).revokeObjectURL(self.location.href);';
|
|
62
|
+
return `const jsContent = ${JSON.stringify(source.replace(SOURCE_MAPPING_URL_REGEX, ''))};
|
|
63
|
+
const workerURL = typeof self !== "undefined" && (self.URL || self.webkitURL);
|
|
64
|
+
const blob = workerURL && self.Blob && new Blob([${JSON.stringify(revokeCode)}, jsContent], { type: "text/javascript;charset=utf-8" });
|
|
65
|
+
|
|
66
|
+
export default function WorkerWrapper(options) {
|
|
67
|
+
let objURL;
|
|
68
|
+
try {
|
|
69
|
+
objURL = blob && workerURL.createObjectURL(blob);
|
|
70
|
+
if (!objURL) throw "";
|
|
71
|
+
const worker = new Worker(objURL, ${workerOptions});
|
|
72
|
+
worker.addEventListener("error", () => {
|
|
73
|
+
workerURL.revokeObjectURL(objURL);
|
|
74
|
+
});
|
|
75
|
+
return worker;
|
|
76
|
+
} catch (e) {
|
|
77
|
+
if (objURL) {
|
|
78
|
+
workerURL.revokeObjectURL(objURL);
|
|
79
|
+
}
|
|
80
|
+
return new Worker(
|
|
81
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(jsContent),
|
|
82
|
+
${workerOptions}
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}`;
|
|
86
|
+
})({
|
|
87
|
+
source,
|
|
88
|
+
isModule
|
|
89
|
+
}));
|
|
90
|
+
} catch (error) {
|
|
91
|
+
callback(error instanceof Error ? error : Error(String(error)));
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
export default workerLoader_workerLoader;
|