@rsbuild/core 2.0.0-beta.0 → 2.0.0-beta.10
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.d.ts +102 -1
- package/compiled/html-rspack-plugin/index.js +863 -20
- package/compiled/html-rspack-plugin/package.json +1 -1
- package/compiled/http-proxy-middleware/index.d.ts +268 -43
- package/compiled/http-proxy-middleware/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 +33 -2
- 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/{131.js → 958.js} +1706 -1655
- package/dist/chokidar.js +59 -57
- package/dist/client/hmr.js +3 -3
- package/dist/client/overlay.js +2 -2
- 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 +2985 -0
- package/dist/http-proxy-middleware.js.LICENSE.txt +69 -0
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +96 -16
- package/dist/manifest-plugin.js +543 -21
- package/dist/memfs.js +241 -776
- package/dist/{710.js → mrmime.js} +2 -1
- package/dist/open.js +32 -28
- package/dist/range-parser.js +2 -2
- package/dist/remapping.js +2 -2
- package/dist/rslib-runtime.js +4 -4
- package/dist/sirv.js +14 -14
- package/dist/src.js +510 -0
- package/dist/tinyglobby.js +114 -69
- package/dist/transformLoader.mjs +38 -1
- package/dist/transformRawLoader.mjs +1 -1
- package/dist/ws.js +1549 -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 +123 -25
- 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 +23 -26
- package/compiled/chokidar/handler.d.ts +0 -90
- package/compiled/http-proxy-middleware/index.js +0 -5284
- 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 → 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/manifest-plugin.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
|
|
2
|
+
import * as __rspack_external_node_path_c5b9b54f from "node:path";
|
|
2
3
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
|
-
import "./131.js";
|
|
4
4
|
__webpack_require__.add({
|
|
5
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}), exports.transformFiles = exports.reduceChunk = exports.reduceAssets = exports.generateManifest = void 0;
|
|
9
|
-
let node_path_1 = __webpack_require__("node:path");
|
|
5
|
+
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-beta.8_@module-federation+runtime-tools@2.2.3_@swc+helpers@0.5.19_/node_modules/rspack-manifest-plugin/dist/helpers.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
6
|
+
exports.transformFiles = exports.reduceChunk = exports.reduceAssets = exports.generateManifest = void 0;
|
|
7
|
+
let node_path_1 = __webpack_require__("node:path?f6bc");
|
|
10
8
|
exports.generateManifest = (compilation, files, { generate, seed = {} })=>generate ? generate(seed, files, Array.from(compilation.entrypoints.entries()).reduce((e, [name, entrypoint])=>Object.assign(e, {
|
|
11
9
|
[name]: entrypoint.getFiles()
|
|
12
10
|
}), {}), {
|
|
@@ -64,11 +62,9 @@ __webpack_require__.add({
|
|
|
64
62
|
'sort'
|
|
65
63
|
].filter((fname)=>!!options[fname]).reduce((prev, fname)=>prev[fname](options[fname]), files).map(standardizeFilePaths);
|
|
66
64
|
},
|
|
67
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}), exports.normalModuleLoaderHook = exports.getCompilerHooks = exports.emitHook = exports.beforeRunHook = void 0;
|
|
71
|
-
let node_fs_1 = __webpack_require__("node:fs"), node_path_1 = __webpack_require__("node:path"), lite_tapable_1 = __webpack_require__("@rspack/lite-tapable"), helpers_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-alpha.1_@module-federation+runtime-tools@0.23.0_@swc+helpers@0.5.18_/node_modules/rspack-manifest-plugin/dist/helpers.js"), compilerHookMap = new WeakMap(), getCompilerHooks = (compiler)=>{
|
|
65
|
+
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-beta.8_@module-federation+runtime-tools@2.2.3_@swc+helpers@0.5.19_/node_modules/rspack-manifest-plugin/dist/hooks.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
66
|
+
exports.getCompilerHooks = exports.emitHook = exports.beforeRunHook = void 0;
|
|
67
|
+
let node_fs_1 = __webpack_require__("node:fs?9b01"), node_path_1 = __webpack_require__("node:path?f6bc"), 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.0-beta.8_@module-federation+runtime-tools@2.2.3_@swc+helpers@0.5.19_/node_modules/rspack-manifest-plugin/dist/helpers.js"), compilerHookMap = new WeakMap(), getCompilerHooks = (compiler)=>{
|
|
72
68
|
let hooks = compilerHookMap.get(compiler);
|
|
73
69
|
return void 0 === hooks && (hooks = {
|
|
74
70
|
afterEmit: new lite_tapable_1.SyncWaterfallHook([
|
|
@@ -115,16 +111,11 @@ __webpack_require__.add({
|
|
|
115
111
|
}), (0, node_fs_1.writeFileSync)(manifestFileName, output));
|
|
116
112
|
}
|
|
117
113
|
getCompilerHooks(compiler).afterEmit.call(manifest);
|
|
118
|
-
}, exports.normalModuleLoaderHook = ({ moduleAssets }, context, module)=>{
|
|
119
|
-
let { emitFile } = context;
|
|
120
|
-
context.emitFile = (file, content, sourceMap)=>(module.userRequest && !moduleAssets[file] && Object.assign(moduleAssets, {
|
|
121
|
-
[file]: (0, node_path_1.join)((0, node_path_1.dirname)(file), (0, node_path_1.basename)(module.userRequest))
|
|
122
|
-
}), emitFile.call(module, file, content, sourceMap));
|
|
123
114
|
};
|
|
124
115
|
},
|
|
125
|
-
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-
|
|
116
|
+
"../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-beta.8_@module-federation+runtime-tools@2.2.3_@swc+helpers@0.5.19_/node_modules/rspack-manifest-plugin/dist/index.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
126
117
|
exports.RspackManifestPlugin = void 0;
|
|
127
|
-
let node_path_1 = __webpack_require__("node:path"), hooks_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-
|
|
118
|
+
let node_path_1 = __webpack_require__("node:path?f6bc"), hooks_1 = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-beta.8_@module-federation+runtime-tools@2.2.3_@swc+helpers@0.5.19_/node_modules/rspack-manifest-plugin/dist/hooks.js"), emitCountMap = new Map(), defaults = {
|
|
128
119
|
assetHookStage: 1 / 0,
|
|
129
120
|
basePath: '',
|
|
130
121
|
fileName: 'manifest.json',
|
|
@@ -166,7 +157,538 @@ __webpack_require__.add({
|
|
|
166
157
|
}
|
|
167
158
|
};
|
|
168
159
|
},
|
|
169
|
-
"
|
|
170
|
-
module.exports =
|
|
160
|
+
"node:fs?9b01" (module) {
|
|
161
|
+
module.exports = __rspack_external_node_fs_5ea92f0c;
|
|
162
|
+
},
|
|
163
|
+
"node:path?f6bc" (module) {
|
|
164
|
+
module.exports = __rspack_external_node_path_c5b9b54f;
|
|
165
|
+
},
|
|
166
|
+
"../../node_modules/.pnpm/@rspack+lite-tapable@1.1.0/node_modules/@rspack/lite-tapable/dist/index.cjs" (__unused_rspack_module, exports) {
|
|
167
|
+
var __nested_rspack_require_18_37__ = {};
|
|
168
|
+
__nested_rspack_require_18_37__.d = (exports1, definition)=>{
|
|
169
|
+
for(var key in definition)__nested_rspack_require_18_37__.o(definition, key) && !__nested_rspack_require_18_37__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
170
|
+
enumerable: !0,
|
|
171
|
+
get: definition[key]
|
|
172
|
+
});
|
|
173
|
+
}, __nested_rspack_require_18_37__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __nested_rspack_require_18_37__.r = (exports1)=>{
|
|
174
|
+
"u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
175
|
+
value: 'Module'
|
|
176
|
+
}), Object.defineProperty(exports1, '__esModule', {
|
|
177
|
+
value: !0
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
var __nested_rspack_exports__ = {};
|
|
181
|
+
function _define_property(obj, key, value) {
|
|
182
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
183
|
+
value: value,
|
|
184
|
+
enumerable: !0,
|
|
185
|
+
configurable: !0,
|
|
186
|
+
writable: !0
|
|
187
|
+
}) : obj[key] = value, obj;
|
|
188
|
+
}
|
|
189
|
+
__nested_rspack_require_18_37__.r(__nested_rspack_exports__), __nested_rspack_require_18_37__.d(__nested_rspack_exports__, {
|
|
190
|
+
AsyncParallelHook: ()=>AsyncParallelHook,
|
|
191
|
+
AsyncSeriesBailHook: ()=>AsyncSeriesBailHook,
|
|
192
|
+
AsyncSeriesHook: ()=>AsyncSeriesHook,
|
|
193
|
+
AsyncSeriesWaterfallHook: ()=>AsyncSeriesWaterfallHook,
|
|
194
|
+
HookBase: ()=>HookBase,
|
|
195
|
+
HookMap: ()=>HookMap,
|
|
196
|
+
MultiHook: ()=>MultiHook,
|
|
197
|
+
QueriedHook: ()=>QueriedHook,
|
|
198
|
+
QueriedHookMap: ()=>QueriedHookMap,
|
|
199
|
+
SyncBailHook: ()=>SyncBailHook,
|
|
200
|
+
SyncHook: ()=>SyncHook,
|
|
201
|
+
SyncWaterfallHook: ()=>SyncWaterfallHook,
|
|
202
|
+
maxStage: ()=>maxStage,
|
|
203
|
+
minStage: ()=>minStage,
|
|
204
|
+
safeStage: ()=>safeStage
|
|
205
|
+
});
|
|
206
|
+
class HookBase {
|
|
207
|
+
intercept(interceptor) {
|
|
208
|
+
if (this.interceptors.push(Object.assign({}, interceptor)), interceptor.register) for(let i = 0; i < this.taps.length; i++)this.taps[i] = interceptor.register(this.taps[i]);
|
|
209
|
+
}
|
|
210
|
+
_runRegisterInterceptors(options) {
|
|
211
|
+
return this.interceptors.reduce((options, interceptor)=>interceptor.register?.(options) ?? options, options);
|
|
212
|
+
}
|
|
213
|
+
_runCallInterceptors(...args) {
|
|
214
|
+
for (let interceptor of this.interceptors)interceptor.call && interceptor.call(...args);
|
|
215
|
+
}
|
|
216
|
+
_runErrorInterceptors(e) {
|
|
217
|
+
for (let interceptor of this.interceptors)interceptor.error && interceptor.error(e);
|
|
218
|
+
}
|
|
219
|
+
_runTapInterceptors(tap) {
|
|
220
|
+
for (let interceptor of this.interceptors)interceptor.tap && interceptor.tap(tap);
|
|
221
|
+
}
|
|
222
|
+
_runDoneInterceptors() {
|
|
223
|
+
for (let interceptor of this.interceptors)interceptor.done && interceptor.done();
|
|
224
|
+
}
|
|
225
|
+
_runResultInterceptors(r) {
|
|
226
|
+
for (let interceptor of this.interceptors)interceptor.result && interceptor.result(r);
|
|
227
|
+
}
|
|
228
|
+
withOptions(options) {
|
|
229
|
+
let mergeOptions = (opt)=>Object.assign({}, options, 'string' == typeof opt ? {
|
|
230
|
+
name: opt
|
|
231
|
+
} : opt);
|
|
232
|
+
return {
|
|
233
|
+
name: this.name,
|
|
234
|
+
tap: (opt, fn)=>this.tap(mergeOptions(opt), fn),
|
|
235
|
+
tapAsync: (opt, fn)=>this.tapAsync(mergeOptions(opt), fn),
|
|
236
|
+
tapPromise: (opt, fn)=>this.tapPromise(mergeOptions(opt), fn),
|
|
237
|
+
intercept: (interceptor)=>this.intercept(interceptor),
|
|
238
|
+
isUsed: ()=>this.isUsed(),
|
|
239
|
+
withOptions: (opt)=>this.withOptions(mergeOptions(opt)),
|
|
240
|
+
queryStageRange: (stageRange)=>this.queryStageRange(stageRange)
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
isUsed() {
|
|
244
|
+
return this.taps.length > 0 || this.interceptors.length > 0;
|
|
245
|
+
}
|
|
246
|
+
queryStageRange(stageRange) {
|
|
247
|
+
return new QueriedHook(stageRange, this);
|
|
248
|
+
}
|
|
249
|
+
callAsyncStageRange(queried) {
|
|
250
|
+
throw Error('Hook should implement there own _callAsyncStageRange');
|
|
251
|
+
}
|
|
252
|
+
callAsync(...args) {
|
|
253
|
+
return this.callAsyncStageRange(this.queryStageRange(allStageRange), ...args);
|
|
254
|
+
}
|
|
255
|
+
promiseStageRange(queried, ...args) {
|
|
256
|
+
return new Promise((resolve, reject)=>{
|
|
257
|
+
this.callAsyncStageRange(queried, ...args, (e, r)=>e ? reject(e) : resolve(r));
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
promise(...args) {
|
|
261
|
+
return this.promiseStageRange(this.queryStageRange(allStageRange), ...args);
|
|
262
|
+
}
|
|
263
|
+
tap(options, fn) {
|
|
264
|
+
this._tap('sync', options, fn);
|
|
265
|
+
}
|
|
266
|
+
tapAsync(options, fn) {
|
|
267
|
+
this._tap('async', options, fn);
|
|
268
|
+
}
|
|
269
|
+
tapPromise(options, fn) {
|
|
270
|
+
this._tap('promise', options, fn);
|
|
271
|
+
}
|
|
272
|
+
_tap(type, options, fn) {
|
|
273
|
+
let normalizedOptions = options;
|
|
274
|
+
if ('string' == typeof options) normalizedOptions = {
|
|
275
|
+
name: options.trim()
|
|
276
|
+
};
|
|
277
|
+
else if ('object' != typeof options || null === options) throw Error('Invalid tap options');
|
|
278
|
+
if ('string' != typeof normalizedOptions.name || '' === normalizedOptions.name) throw Error('Missing name for tap');
|
|
279
|
+
this._insert(this._runRegisterInterceptors(Object.assign({
|
|
280
|
+
type,
|
|
281
|
+
fn
|
|
282
|
+
}, normalizedOptions)));
|
|
283
|
+
}
|
|
284
|
+
_insert(item) {
|
|
285
|
+
let before;
|
|
286
|
+
'string' == typeof item.before ? before = new Set([
|
|
287
|
+
item.before
|
|
288
|
+
]) : Array.isArray(item.before) && (before = new Set(item.before));
|
|
289
|
+
let stage = 0;
|
|
290
|
+
'number' == typeof item.stage && (stage = item.stage);
|
|
291
|
+
let i = this.taps.length;
|
|
292
|
+
for(; i > 0;){
|
|
293
|
+
i--;
|
|
294
|
+
let x = this.taps[i];
|
|
295
|
+
this.taps[i + 1] = x;
|
|
296
|
+
let xStage = x.stage || 0;
|
|
297
|
+
if (before) {
|
|
298
|
+
if (before.has(x.name)) {
|
|
299
|
+
before.delete(x.name);
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
if (before.size > 0) continue;
|
|
303
|
+
}
|
|
304
|
+
if (!(xStage > stage)) {
|
|
305
|
+
i++;
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
this.taps[i] = item;
|
|
310
|
+
}
|
|
311
|
+
_prepareArgs(args) {
|
|
312
|
+
let len = this.args.length;
|
|
313
|
+
return args.length < len ? (args.length = len, args.fill(void 0, args.length, len)) : (args.length > len && (args.length = len), args);
|
|
314
|
+
}
|
|
315
|
+
constructor(args = [], name){
|
|
316
|
+
_define_property(this, "args", void 0), _define_property(this, "name", void 0), _define_property(this, "taps", void 0), _define_property(this, "interceptors", void 0), this.args = args, this.name = name, this.taps = [], this.interceptors = [];
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
let minStage = -1 / 0, maxStage = 1 / 0, allStageRange = [
|
|
320
|
+
minStage,
|
|
321
|
+
1 / 0
|
|
322
|
+
], i32MAX = 2147483648 - 1, safeStage = (stage)=>stage < -2147483648 ? -2147483648 : stage > i32MAX ? i32MAX : stage;
|
|
323
|
+
class QueriedHook {
|
|
324
|
+
isUsed() {
|
|
325
|
+
return !!(this.tapsInRange.length > 0 || this.stageRange[0] === minStage && this.hook.interceptors.some((i)=>i.call) || this.stageRange[1] === maxStage && this.hook.interceptors.some((i)=>i.done));
|
|
326
|
+
}
|
|
327
|
+
call(...args) {
|
|
328
|
+
if ('function' != typeof this.hook.callStageRange) throw Error('hook is not a SyncHook, call methods only exists on SyncHook');
|
|
329
|
+
return this.hook.callStageRange(this, ...args);
|
|
330
|
+
}
|
|
331
|
+
callAsync(...args) {
|
|
332
|
+
return this.hook.callAsyncStageRange(this, ...args);
|
|
333
|
+
}
|
|
334
|
+
promise(...args) {
|
|
335
|
+
return this.hook.promiseStageRange(this, ...args);
|
|
336
|
+
}
|
|
337
|
+
constructor(stageRange, hook){
|
|
338
|
+
_define_property(this, "stageRange", void 0), _define_property(this, "hook", void 0), _define_property(this, "tapsInRange", void 0);
|
|
339
|
+
let tapsInRange = [], [from, to] = stageRange;
|
|
340
|
+
for (let tap of hook.taps){
|
|
341
|
+
let stage = tap.stage ?? 0;
|
|
342
|
+
from <= stage && stage < to ? tapsInRange.push(tap) : to === maxStage && stage === maxStage && tapsInRange.push(tap);
|
|
343
|
+
}
|
|
344
|
+
this.stageRange = stageRange, this.hook = hook, this.tapsInRange = tapsInRange;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
class SyncHook extends HookBase {
|
|
348
|
+
callAsyncStageRange(queried, ...args) {
|
|
349
|
+
let { stageRange: [from, to], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
|
|
350
|
+
for (let tap of (from === minStage && this._runCallInterceptors(...args2), tapsInRange)){
|
|
351
|
+
this._runTapInterceptors(tap);
|
|
352
|
+
try {
|
|
353
|
+
tap.fn(...args2);
|
|
354
|
+
} catch (e) {
|
|
355
|
+
return this._runErrorInterceptors(e), cb(e);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
to === maxStage && (this._runDoneInterceptors(), cb(null));
|
|
359
|
+
}
|
|
360
|
+
call(...args) {
|
|
361
|
+
return this.callStageRange(this.queryStageRange(allStageRange), ...args);
|
|
362
|
+
}
|
|
363
|
+
callStageRange(queried, ...args) {
|
|
364
|
+
let result, error;
|
|
365
|
+
if (this.callAsyncStageRange(queried, ...args, (e, r)=>{
|
|
366
|
+
error = e, result = r;
|
|
367
|
+
}), error) throw error;
|
|
368
|
+
return result;
|
|
369
|
+
}
|
|
370
|
+
tapAsync() {
|
|
371
|
+
throw Error('tapAsync is not supported on a SyncHook');
|
|
372
|
+
}
|
|
373
|
+
tapPromise() {
|
|
374
|
+
throw Error('tapPromise is not supported on a SyncHook');
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
class SyncBailHook extends HookBase {
|
|
378
|
+
callAsyncStageRange(queried, ...args) {
|
|
379
|
+
let { stageRange: [from, to], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
|
|
380
|
+
for (let tap of (from === minStage && this._runCallInterceptors(...args2), tapsInRange)){
|
|
381
|
+
let r;
|
|
382
|
+
this._runTapInterceptors(tap);
|
|
383
|
+
try {
|
|
384
|
+
r = tap.fn(...args2);
|
|
385
|
+
} catch (e) {
|
|
386
|
+
return this._runErrorInterceptors(e), cb(e);
|
|
387
|
+
}
|
|
388
|
+
if (void 0 !== r) return this._runResultInterceptors(r), cb(null, r);
|
|
389
|
+
}
|
|
390
|
+
to === maxStage && (this._runDoneInterceptors(), cb(null));
|
|
391
|
+
}
|
|
392
|
+
call(...args) {
|
|
393
|
+
return this.callStageRange(this.queryStageRange(allStageRange), ...args);
|
|
394
|
+
}
|
|
395
|
+
callStageRange(queried, ...args) {
|
|
396
|
+
let result, error;
|
|
397
|
+
if (this.callAsyncStageRange(queried, ...args, (e, r)=>{
|
|
398
|
+
error = e, result = r;
|
|
399
|
+
}), error) throw error;
|
|
400
|
+
return result;
|
|
401
|
+
}
|
|
402
|
+
tapAsync() {
|
|
403
|
+
throw Error('tapAsync is not supported on a SyncBailHook');
|
|
404
|
+
}
|
|
405
|
+
tapPromise() {
|
|
406
|
+
throw Error('tapPromise is not supported on a SyncBailHook');
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
class SyncWaterfallHook extends HookBase {
|
|
410
|
+
callAsyncStageRange(queried, ...args) {
|
|
411
|
+
let { stageRange: [from, to], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
|
|
412
|
+
for (let tap of (from === minStage && this._runCallInterceptors(...args2), tapsInRange)){
|
|
413
|
+
this._runTapInterceptors(tap);
|
|
414
|
+
try {
|
|
415
|
+
let r = tap.fn(...args2);
|
|
416
|
+
void 0 !== r && (args2[0] = r);
|
|
417
|
+
} catch (e) {
|
|
418
|
+
return this._runErrorInterceptors(e), cb(e);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
to === maxStage && (this._runDoneInterceptors(), cb(null, args2[0]));
|
|
422
|
+
}
|
|
423
|
+
call(...args) {
|
|
424
|
+
return this.callStageRange(this.queryStageRange(allStageRange), ...args);
|
|
425
|
+
}
|
|
426
|
+
callStageRange(queried, ...args) {
|
|
427
|
+
let result, error;
|
|
428
|
+
if (this.callAsyncStageRange(queried, ...args, (e, r)=>{
|
|
429
|
+
error = e, result = r;
|
|
430
|
+
}), error) throw error;
|
|
431
|
+
return result;
|
|
432
|
+
}
|
|
433
|
+
tapAsync() {
|
|
434
|
+
throw Error('tapAsync is not supported on a SyncWaterfallHook');
|
|
435
|
+
}
|
|
436
|
+
tapPromise() {
|
|
437
|
+
throw Error('tapPromise is not supported on a SyncWaterfallHook');
|
|
438
|
+
}
|
|
439
|
+
constructor(args = [], name){
|
|
440
|
+
if (args.length < 1) throw Error('Waterfall hooks must have at least one argument');
|
|
441
|
+
super(args, name);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
class AsyncParallelHook extends HookBase {
|
|
445
|
+
callAsyncStageRange(queried, ...args) {
|
|
446
|
+
let { stageRange: [from], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
|
|
447
|
+
from === minStage && this._runCallInterceptors(...args2);
|
|
448
|
+
let done = ()=>{
|
|
449
|
+
this._runDoneInterceptors(), cb(null);
|
|
450
|
+
}, error = (e)=>{
|
|
451
|
+
this._runErrorInterceptors(e), cb(e);
|
|
452
|
+
};
|
|
453
|
+
if (0 === tapsInRange.length) return done();
|
|
454
|
+
let counter = tapsInRange.length;
|
|
455
|
+
for (let tap of tapsInRange){
|
|
456
|
+
if (this._runTapInterceptors(tap), 'promise' === tap.type) {
|
|
457
|
+
let promise = tap.fn(...args2);
|
|
458
|
+
if (!promise || !promise.then) throw Error(`Tap function (tapPromise) did not return promise (returned ${promise})`);
|
|
459
|
+
promise.then(()=>{
|
|
460
|
+
0 == (counter -= 1) && done();
|
|
461
|
+
}, (e)=>{
|
|
462
|
+
counter = 0, error(e);
|
|
463
|
+
});
|
|
464
|
+
} else if ('async' === tap.type) tap.fn(...args2, (e)=>{
|
|
465
|
+
e ? (counter = 0, error(e)) : 0 == (counter -= 1) && done();
|
|
466
|
+
});
|
|
467
|
+
else {
|
|
468
|
+
let hasError = !1;
|
|
469
|
+
try {
|
|
470
|
+
tap.fn(...args2);
|
|
471
|
+
} catch (e) {
|
|
472
|
+
hasError = !0, counter = 0, error(e);
|
|
473
|
+
}
|
|
474
|
+
hasError || 0 != --counter || done();
|
|
475
|
+
}
|
|
476
|
+
if (counter <= 0) return;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
class AsyncSeriesHook extends HookBase {
|
|
481
|
+
callAsyncStageRange(queried, ...args) {
|
|
482
|
+
let { stageRange: [from], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
|
|
483
|
+
from === minStage && this._runCallInterceptors(...args2);
|
|
484
|
+
let done = ()=>{
|
|
485
|
+
this._runDoneInterceptors(), cb(null);
|
|
486
|
+
}, error = (e)=>{
|
|
487
|
+
this._runErrorInterceptors(e), cb(e);
|
|
488
|
+
};
|
|
489
|
+
if (0 === tapsInRange.length) return done();
|
|
490
|
+
let index = 0, next = ()=>{
|
|
491
|
+
let tap = tapsInRange[index];
|
|
492
|
+
if (this._runTapInterceptors(tap), 'promise' === tap.type) {
|
|
493
|
+
let promise = tap.fn(...args2);
|
|
494
|
+
if (!promise || !promise.then) throw Error(`Tap function (tapPromise) did not return promise (returned ${promise})`);
|
|
495
|
+
promise.then(()=>{
|
|
496
|
+
(index += 1) === tapsInRange.length ? done() : next();
|
|
497
|
+
}, (e)=>{
|
|
498
|
+
index = tapsInRange.length, error(e);
|
|
499
|
+
});
|
|
500
|
+
} else if ('async' === tap.type) tap.fn(...args2, (e)=>{
|
|
501
|
+
e ? (index = tapsInRange.length, error(e)) : (index += 1) === tapsInRange.length ? done() : next();
|
|
502
|
+
});
|
|
503
|
+
else {
|
|
504
|
+
let hasError = !1;
|
|
505
|
+
try {
|
|
506
|
+
tap.fn(...args2);
|
|
507
|
+
} catch (e) {
|
|
508
|
+
hasError = !0, index = tapsInRange.length, error(e);
|
|
509
|
+
}
|
|
510
|
+
hasError || ((index += 1) === tapsInRange.length ? done() : next());
|
|
511
|
+
}
|
|
512
|
+
if (index === tapsInRange.length) return;
|
|
513
|
+
};
|
|
514
|
+
next();
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
class AsyncSeriesBailHook extends HookBase {
|
|
518
|
+
callAsyncStageRange(queried, ...args) {
|
|
519
|
+
let { stageRange: [from], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
|
|
520
|
+
from === minStage && this._runCallInterceptors(...args2);
|
|
521
|
+
let done = ()=>{
|
|
522
|
+
this._runDoneInterceptors(), cb(null);
|
|
523
|
+
}, error = (e)=>{
|
|
524
|
+
this._runErrorInterceptors(e), cb(e);
|
|
525
|
+
}, result = (r)=>{
|
|
526
|
+
this._runResultInterceptors(r), cb(null, r);
|
|
527
|
+
};
|
|
528
|
+
if (0 === tapsInRange.length) return done();
|
|
529
|
+
let index = 0, next = ()=>{
|
|
530
|
+
let tap = tapsInRange[index];
|
|
531
|
+
if (this._runTapInterceptors(tap), 'promise' === tap.type) {
|
|
532
|
+
let promise = tap.fn(...args2);
|
|
533
|
+
if (!promise || !promise.then) throw Error(`Tap function (tapPromise) did not return promise (returned ${promise})`);
|
|
534
|
+
promise.then((r)=>{
|
|
535
|
+
index += 1, void 0 !== r ? result(r) : index === tapsInRange.length ? done() : next();
|
|
536
|
+
}, (e)=>{
|
|
537
|
+
index = tapsInRange.length, error(e);
|
|
538
|
+
});
|
|
539
|
+
} else if ('async' === tap.type) tap.fn(...args2, (e, r)=>{
|
|
540
|
+
e ? (index = tapsInRange.length, error(e)) : (index += 1, void 0 !== r ? result(r) : index === tapsInRange.length ? done() : next());
|
|
541
|
+
});
|
|
542
|
+
else {
|
|
543
|
+
let r, hasError = !1;
|
|
544
|
+
try {
|
|
545
|
+
r = tap.fn(...args2);
|
|
546
|
+
} catch (e) {
|
|
547
|
+
hasError = !0, index = tapsInRange.length, error(e);
|
|
548
|
+
}
|
|
549
|
+
hasError || (index += 1, void 0 !== r ? result(r) : index === tapsInRange.length ? done() : next());
|
|
550
|
+
}
|
|
551
|
+
if (index === tapsInRange.length) return;
|
|
552
|
+
};
|
|
553
|
+
next();
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
class AsyncSeriesWaterfallHook extends HookBase {
|
|
557
|
+
callAsyncStageRange(queried, ...args) {
|
|
558
|
+
let { stageRange: [from], tapsInRange } = queried, argsWithoutCb = args.slice(0, args.length - 1), cb = args[args.length - 1], args2 = this._prepareArgs(argsWithoutCb);
|
|
559
|
+
from === minStage && this._runCallInterceptors(...args2);
|
|
560
|
+
let result = (r)=>{
|
|
561
|
+
this._runResultInterceptors(r), cb(null, r);
|
|
562
|
+
}, error = (e)=>{
|
|
563
|
+
this._runErrorInterceptors(e), cb(e);
|
|
564
|
+
};
|
|
565
|
+
if (0 === tapsInRange.length) return result(args2[0]);
|
|
566
|
+
let index = 0, next = ()=>{
|
|
567
|
+
let tap = tapsInRange[index];
|
|
568
|
+
if (this._runTapInterceptors(tap), 'promise' === tap.type) {
|
|
569
|
+
let promise = tap.fn(...args2);
|
|
570
|
+
if (!promise || !promise.then) throw Error(`Tap function (tapPromise) did not return promise (returned ${promise})`);
|
|
571
|
+
promise.then((r)=>{
|
|
572
|
+
index += 1, void 0 !== r && (args2[0] = r), index === tapsInRange.length ? result(args2[0]) : next();
|
|
573
|
+
}, (e)=>{
|
|
574
|
+
index = tapsInRange.length, error(e);
|
|
575
|
+
});
|
|
576
|
+
} else if ('async' === tap.type) tap.fn(...args2, (e, r)=>{
|
|
577
|
+
e ? (index = tapsInRange.length, error(e)) : (index += 1, void 0 !== r && (args2[0] = r), index === tapsInRange.length ? result(args2[0]) : next());
|
|
578
|
+
});
|
|
579
|
+
else {
|
|
580
|
+
let hasError = !1;
|
|
581
|
+
try {
|
|
582
|
+
let r = tap.fn(...args2);
|
|
583
|
+
void 0 !== r && (args2[0] = r);
|
|
584
|
+
} catch (e) {
|
|
585
|
+
hasError = !0, index = tapsInRange.length, error(e);
|
|
586
|
+
}
|
|
587
|
+
hasError || ((index += 1) === tapsInRange.length ? result(args2[0]) : next());
|
|
588
|
+
}
|
|
589
|
+
if (index === tapsInRange.length) return;
|
|
590
|
+
};
|
|
591
|
+
next();
|
|
592
|
+
}
|
|
593
|
+
constructor(args = [], name){
|
|
594
|
+
if (args.length < 1) throw Error('Waterfall hooks must have at least one argument');
|
|
595
|
+
super(args, name);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
let defaultFactory = (key, hook)=>hook;
|
|
599
|
+
class HookMap {
|
|
600
|
+
get(key) {
|
|
601
|
+
return this._map.get(key);
|
|
602
|
+
}
|
|
603
|
+
for(key) {
|
|
604
|
+
let hook = this.get(key);
|
|
605
|
+
if (void 0 !== hook) return hook;
|
|
606
|
+
let newHook = this._factory(key), interceptors = this._interceptors;
|
|
607
|
+
for(let i = 0; i < interceptors.length; i++){
|
|
608
|
+
let factory = interceptors[i].factory;
|
|
609
|
+
factory && (newHook = factory(key, newHook));
|
|
610
|
+
}
|
|
611
|
+
return this._map.set(key, newHook), newHook;
|
|
612
|
+
}
|
|
613
|
+
intercept(interceptor) {
|
|
614
|
+
this._interceptors.push(Object.assign({
|
|
615
|
+
factory: defaultFactory
|
|
616
|
+
}, interceptor));
|
|
617
|
+
}
|
|
618
|
+
isUsed() {
|
|
619
|
+
for (let key of this._map.keys()){
|
|
620
|
+
let hook = this.get(key);
|
|
621
|
+
if (hook?.isUsed()) return !0;
|
|
622
|
+
}
|
|
623
|
+
return !1;
|
|
624
|
+
}
|
|
625
|
+
queryStageRange(stageRange) {
|
|
626
|
+
return new QueriedHookMap(stageRange, this);
|
|
627
|
+
}
|
|
628
|
+
constructor(factory, name){
|
|
629
|
+
_define_property(this, "_map", new Map()), _define_property(this, "_factory", void 0), _define_property(this, "name", void 0), _define_property(this, "_interceptors", void 0), this.name = name, this._factory = factory, this._interceptors = [];
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
class QueriedHookMap {
|
|
633
|
+
get(key) {
|
|
634
|
+
return this.hookMap.get(key)?.queryStageRange(this.stageRange);
|
|
635
|
+
}
|
|
636
|
+
for(key) {
|
|
637
|
+
return this.hookMap.for(key).queryStageRange(this.stageRange);
|
|
638
|
+
}
|
|
639
|
+
isUsed() {
|
|
640
|
+
for (let key of this.hookMap._map.keys())if (this.get(key)?.isUsed()) return !0;
|
|
641
|
+
return !1;
|
|
642
|
+
}
|
|
643
|
+
constructor(stageRange, hookMap){
|
|
644
|
+
_define_property(this, "stageRange", void 0), _define_property(this, "hookMap", void 0), this.stageRange = stageRange, this.hookMap = hookMap;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
class MultiHook {
|
|
648
|
+
tap(options, fn) {
|
|
649
|
+
for (let hook of this.hooks)hook.tap(options, fn);
|
|
650
|
+
}
|
|
651
|
+
tapAsync(options, fn) {
|
|
652
|
+
for (let hook of this.hooks)hook.tapAsync(options, fn);
|
|
653
|
+
}
|
|
654
|
+
tapPromise(options, fn) {
|
|
655
|
+
for (let hook of this.hooks)hook.tapPromise(options, fn);
|
|
656
|
+
}
|
|
657
|
+
isUsed() {
|
|
658
|
+
for (let hook of this.hooks)if (hook.isUsed()) return !0;
|
|
659
|
+
return !1;
|
|
660
|
+
}
|
|
661
|
+
intercept(interceptor) {
|
|
662
|
+
for (let hook of this.hooks)hook.intercept(interceptor);
|
|
663
|
+
}
|
|
664
|
+
withOptions(options) {
|
|
665
|
+
return new MultiHook(this.hooks.map((h)=>h.withOptions(options)), this.name);
|
|
666
|
+
}
|
|
667
|
+
constructor(hooks, name){
|
|
668
|
+
_define_property(this, "hooks", void 0), _define_property(this, "name", void 0), this.hooks = hooks, this.name = name;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
for(var __webpack_i__ in exports.AsyncParallelHook = __nested_rspack_exports__.AsyncParallelHook, exports.AsyncSeriesBailHook = __nested_rspack_exports__.AsyncSeriesBailHook, exports.AsyncSeriesHook = __nested_rspack_exports__.AsyncSeriesHook, exports.AsyncSeriesWaterfallHook = __nested_rspack_exports__.AsyncSeriesWaterfallHook, exports.HookBase = __nested_rspack_exports__.HookBase, exports.HookMap = __nested_rspack_exports__.HookMap, exports.MultiHook = __nested_rspack_exports__.MultiHook, exports.QueriedHook = __nested_rspack_exports__.QueriedHook, exports.QueriedHookMap = __nested_rspack_exports__.QueriedHookMap, exports.SyncBailHook = __nested_rspack_exports__.SyncBailHook, exports.SyncHook = __nested_rspack_exports__.SyncHook, exports.SyncWaterfallHook = __nested_rspack_exports__.SyncWaterfallHook, exports.maxStage = __nested_rspack_exports__.maxStage, exports.minStage = __nested_rspack_exports__.minStage, exports.safeStage = __nested_rspack_exports__.safeStage, __nested_rspack_exports__)-1 === [
|
|
672
|
+
"AsyncParallelHook",
|
|
673
|
+
"AsyncSeriesBailHook",
|
|
674
|
+
"AsyncSeriesHook",
|
|
675
|
+
"AsyncSeriesWaterfallHook",
|
|
676
|
+
"HookBase",
|
|
677
|
+
"HookMap",
|
|
678
|
+
"MultiHook",
|
|
679
|
+
"QueriedHook",
|
|
680
|
+
"QueriedHookMap",
|
|
681
|
+
"SyncBailHook",
|
|
682
|
+
"SyncHook",
|
|
683
|
+
"SyncWaterfallHook",
|
|
684
|
+
"maxStage",
|
|
685
|
+
"minStage",
|
|
686
|
+
"safeStage"
|
|
687
|
+
].indexOf(__webpack_i__) && (exports[__webpack_i__] = __nested_rspack_exports__[__webpack_i__]);
|
|
688
|
+
Object.defineProperty(exports, "__esModule", {
|
|
689
|
+
value: !0
|
|
690
|
+
});
|
|
171
691
|
}
|
|
172
692
|
});
|
|
693
|
+
var RspackManifestPlugin = __webpack_require__("../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-beta.8_@module-federation+runtime-tools@2.2.3_@swc+helpers@0.5.19_/node_modules/rspack-manifest-plugin/dist/index.js").RspackManifestPlugin;
|
|
694
|
+
export { RspackManifestPlugin };
|