@rspack/core 0.5.8 → 0.5.9-canary-6bcb6c4-20240326140146
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/dist/Chunk.d.ts +2 -0
- package/dist/Chunk.js +4 -0
- package/dist/Compilation.d.ts +25 -33
- package/dist/Compilation.js +16 -25
- package/dist/Compiler.d.ts +12 -5
- package/dist/Compiler.js +158 -184
- package/dist/ContextModuleFactory.d.ts +4 -7
- package/dist/ContextModuleFactory.js +25 -1
- package/dist/Module.d.ts +23 -1
- package/dist/Module.js +12 -0
- package/dist/NormalModuleFactory.d.ts +2 -17
- package/dist/NormalModuleFactory.js +1 -1
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BannerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +11 -10
- package/dist/builtin-plugin/EnableLibraryPlugin.js +39 -1
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.js +3 -1
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +1 -1
- package/dist/builtin-plugin/base.d.ts +2 -2
- package/dist/config/adapter.js +1 -2
- package/dist/config/normalization.js +1 -1
- package/dist/config/zod.d.ts +359 -51
- package/dist/config/zod.js +8 -5
- package/dist/container/ContainerPlugin.d.ts +2 -2
- package/dist/exports.d.ts +74 -29
- package/dist/rspackOptionsApply.js +0 -1
- package/dist/sharing/ShareRuntimePlugin.d.ts +1 -1
- package/dist/sharing/ShareRuntimePlugin.js +1 -1
- package/dist/util/comparators.d.ts +1 -1
- package/package.json +5 -5
- package/dist/util/normalization.d.ts +0 -5
- package/dist/util/normalization.js +0 -9
package/dist/Compiler.js
CHANGED
|
@@ -36,20 +36,30 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
36
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
|
-
var _Compiler_instances, _Compiler_instance, _Compiler_disabledHooks,
|
|
39
|
+
var _Compiler_instances, _Compiler_instance, _Compiler_disabledHooks, _Compiler_nonSkippableRegisters, _Compiler_registers, _Compiler_moduleExecutionResultsMap, _Compiler_getInstance, _Compiler_updateNonSkippableRegisters, _Compiler_updateDisabledHooks, _Compiler_contextModuleFactoryAfterResolve, _Compiler_normalModuleFactoryCreateModule, _Compiler_normalModuleFactoryResolveForScheme, _Compiler_decorateUpdateDisabledHooks, _Compiler_createRegisterTaps, _Compiler_createCompilation, _Compiler_resetThisCompilation, _Compiler_newCompilationParams;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.Compiler = void 0;
|
|
42
|
+
/**
|
|
43
|
+
* The following code is modified based on
|
|
44
|
+
* https://github.com/webpack/webpack/blob/4b4ca3bb53f36a5b8fc6bc1bd976ed7af161bd80/lib/Compiler.js
|
|
45
|
+
*
|
|
46
|
+
* MIT Licensed
|
|
47
|
+
* Author Tobias Koppers @sokra
|
|
48
|
+
* Copyright (c) JS Foundation and other contributors
|
|
49
|
+
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
50
|
+
*/
|
|
51
|
+
const binding = __importStar(require("@rspack/binding"));
|
|
42
52
|
const index_1 = require("./index");
|
|
43
53
|
const fs_1 = __importDefault(require("fs"));
|
|
44
54
|
const tapable = __importStar(require("tapable"));
|
|
45
55
|
const liteTapable = __importStar(require("./lite-tapable"));
|
|
46
56
|
const tapable_1 = require("tapable");
|
|
57
|
+
const config_1 = require("./config");
|
|
47
58
|
const RuleSetCompiler_1 = require("./RuleSetCompiler");
|
|
48
59
|
const Stats_1 = require("./Stats");
|
|
49
60
|
const Compilation_1 = require("./Compilation");
|
|
50
61
|
const ContextModuleFactory_1 = require("./ContextModuleFactory");
|
|
51
62
|
const ResolverFactory_1 = __importDefault(require("./ResolverFactory"));
|
|
52
|
-
const config_1 = require("./config");
|
|
53
63
|
const ConcurrentCompilationError_1 = __importDefault(require("./error/ConcurrentCompilationError"));
|
|
54
64
|
const fileSystem_1 = require("./fileSystem");
|
|
55
65
|
const Cache_1 = __importDefault(require("./lib/Cache"));
|
|
@@ -58,8 +68,6 @@ const Logger_1 = require("./logging/Logger");
|
|
|
58
68
|
const NormalModuleFactory_1 = require("./NormalModuleFactory");
|
|
59
69
|
const bindingVersionCheck_1 = require("./util/bindingVersionCheck");
|
|
60
70
|
const Watching_1 = require("./Watching");
|
|
61
|
-
const NormalModule_1 = require("./NormalModule");
|
|
62
|
-
const normalization_1 = require("./util/normalization");
|
|
63
71
|
const builtin_plugin_1 = require("./builtin-plugin");
|
|
64
72
|
const rspackOptionsApply_1 = require("./rspackOptionsApply");
|
|
65
73
|
const defaults_1 = require("./config/defaults");
|
|
@@ -69,6 +77,7 @@ const HookWebpackError_1 = require("./lib/HookWebpackError");
|
|
|
69
77
|
const Module_1 = require("./Module");
|
|
70
78
|
const base_1 = require("./builtin-plugin/base");
|
|
71
79
|
const ExecuteModulePlugin_1 = __importDefault(require("./ExecuteModulePlugin"));
|
|
80
|
+
const Chunk_1 = require("./Chunk");
|
|
72
81
|
class Compiler {
|
|
73
82
|
constructor(context, options) {
|
|
74
83
|
_Compiler_instances.add(this);
|
|
@@ -77,6 +86,8 @@ class Compiler {
|
|
|
77
86
|
// TODO: remove this after remove rebuild on the rust side.
|
|
78
87
|
this.first = true;
|
|
79
88
|
_Compiler_disabledHooks.set(this, void 0);
|
|
89
|
+
_Compiler_nonSkippableRegisters.set(this, void 0);
|
|
90
|
+
_Compiler_registers.set(this, void 0);
|
|
80
91
|
_Compiler_moduleExecutionResultsMap.set(this, void 0);
|
|
81
92
|
this.outputFileSystem = fs_1.default;
|
|
82
93
|
this.options = options;
|
|
@@ -98,9 +109,9 @@ class Compiler {
|
|
|
98
109
|
afterDone: new tapable.SyncHook(["stats"]),
|
|
99
110
|
beforeRun: new tapable.AsyncSeriesHook(["compiler"]),
|
|
100
111
|
run: new tapable.AsyncSeriesHook(["compiler"]),
|
|
101
|
-
emit: new
|
|
102
|
-
assetEmitted: new
|
|
103
|
-
afterEmit: new
|
|
112
|
+
emit: new liteTapable.AsyncSeriesHook(["compilation"]),
|
|
113
|
+
assetEmitted: new liteTapable.AsyncSeriesHook(["file", "info"]),
|
|
114
|
+
afterEmit: new liteTapable.AsyncSeriesHook(["compilation"]),
|
|
104
115
|
thisCompilation: new liteTapable.SyncHook(["compilation", "params"]),
|
|
105
116
|
compilation: new liteTapable.SyncHook([
|
|
106
117
|
"compilation",
|
|
@@ -126,14 +137,15 @@ class Compiler {
|
|
|
126
137
|
make: new liteTapable.AsyncParallelHook(["compilation"]),
|
|
127
138
|
beforeCompile: new tapable.AsyncSeriesHook(["params"]),
|
|
128
139
|
afterCompile: new tapable.AsyncSeriesHook(["compilation"]),
|
|
129
|
-
finishMake: new
|
|
130
|
-
finishModules: new tapable.AsyncSeriesHook(["modules"]),
|
|
140
|
+
finishMake: new liteTapable.AsyncSeriesHook(["compilation"]),
|
|
131
141
|
entryOption: new tapable.SyncBailHook(["context", "entry"])
|
|
132
142
|
};
|
|
133
143
|
this.modifiedFiles = undefined;
|
|
134
144
|
this.removedFiles = undefined;
|
|
135
145
|
__classPrivateFieldSet(this, _Compiler_disabledHooks, [], "f");
|
|
146
|
+
__classPrivateFieldSet(this, _Compiler_nonSkippableRegisters, [], "f");
|
|
136
147
|
__classPrivateFieldSet(this, _Compiler_moduleExecutionResultsMap, new Map(), "f");
|
|
148
|
+
new builtin_plugin_1.JsLoaderRspackPlugin(this).apply(this);
|
|
137
149
|
new ExecuteModulePlugin_1.default().apply(this);
|
|
138
150
|
}
|
|
139
151
|
/**
|
|
@@ -485,7 +497,7 @@ class Compiler {
|
|
|
485
497
|
}
|
|
486
498
|
}
|
|
487
499
|
exports.Compiler = Compiler;
|
|
488
|
-
_Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Compiler_moduleExecutionResultsMap = new WeakMap(), _Compiler_instances = new WeakSet(), _Compiler_getInstance = function _Compiler_getInstance(callback) {
|
|
500
|
+
_Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Compiler_nonSkippableRegisters = new WeakMap(), _Compiler_registers = new WeakMap(), _Compiler_moduleExecutionResultsMap = new WeakMap(), _Compiler_instances = new WeakSet(), _Compiler_getInstance = function _Compiler_getInstance(callback) {
|
|
489
501
|
const error = (0, bindingVersionCheck_1.checkVersion)();
|
|
490
502
|
if (error) {
|
|
491
503
|
return callback(error);
|
|
@@ -502,40 +514,92 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
502
514
|
options.builtins = (0, builtin_plugin_1.deprecated_resolveBuiltins)(options.builtins, options);
|
|
503
515
|
const rawOptions = (0, config_1.getRawOptions)(options, this);
|
|
504
516
|
const instanceBinding = require("@rspack/binding");
|
|
505
|
-
__classPrivateFieldSet(this,
|
|
506
|
-
|
|
507
|
-
emit: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_emit).bind(this),
|
|
508
|
-
assetEmitted: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_assetEmitted).bind(this),
|
|
509
|
-
afterEmit: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_afterEmit).bind(this),
|
|
510
|
-
afterProcessAssets: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_afterProcessAssets).bind(this),
|
|
511
|
-
optimizeModules: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_optimizeModules).bind(this),
|
|
512
|
-
afterOptimizeModules: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_afterOptimizeModules).bind(this),
|
|
513
|
-
optimizeTree: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_optimizeTree).bind(this),
|
|
514
|
-
optimizeChunkModules: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_optimizeChunkModules).bind(this),
|
|
515
|
-
finishModules: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_finishModules).bind(this),
|
|
516
|
-
normalModuleFactoryCreateModule: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_normalModuleFactoryCreateModule).bind(this),
|
|
517
|
-
normalModuleFactoryResolveForScheme: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_normalModuleFactoryResolveForScheme).bind(this),
|
|
518
|
-
chunkAsset: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_chunkAsset).bind(this),
|
|
519
|
-
afterResolve: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_afterResolve).bind(this),
|
|
520
|
-
contextModuleFactoryBeforeResolve: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_contextModuleFactoryBeforeResolve).bind(this),
|
|
521
|
-
contextModuleFactoryAfterResolve: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_contextModuleFactoryAfterResolve).bind(this),
|
|
522
|
-
succeedModule: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_succeedModule).bind(this),
|
|
523
|
-
stillValidModule: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_stillValidModule).bind(this),
|
|
524
|
-
buildModule: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_buildModule).bind(this),
|
|
525
|
-
executeModule: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_executeModule).bind(this),
|
|
526
|
-
runtimeModule: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_runtimeModule).bind(this)
|
|
527
|
-
}, {
|
|
528
|
-
registerCompilerThisCompilationTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, () => this.hooks.thisCompilation, queried => (native) => {
|
|
517
|
+
__classPrivateFieldSet(this, _Compiler_registers, {
|
|
518
|
+
registerCompilerThisCompilationTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerThisCompilation, () => this.hooks.thisCompilation, queried => (native) => {
|
|
529
519
|
if (this.compilation === undefined) {
|
|
530
520
|
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createCompilation).call(this, native);
|
|
531
521
|
}
|
|
532
522
|
queried.call(this.compilation, this.compilationParams);
|
|
533
523
|
}),
|
|
534
|
-
registerCompilerCompilationTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, () => this.hooks.compilation, queried => () => queried.call(this.compilation, this.compilationParams)),
|
|
535
|
-
registerCompilerMakeTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, () => this.hooks.make, queried => async () => await queried.promise(this.compilation)),
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
524
|
+
registerCompilerCompilationTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerCompilation, () => this.hooks.compilation, queried => () => queried.call(this.compilation, this.compilationParams)),
|
|
525
|
+
registerCompilerMakeTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerMake, () => this.hooks.make, queried => async () => await queried.promise(this.compilation)),
|
|
526
|
+
registerCompilerFinishMakeTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerFinishMake, () => this.hooks.finishMake, queried => async () => await queried.promise(this.compilation)),
|
|
527
|
+
registerCompilerShouldEmitTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerShouldEmit, () => this.hooks.shouldEmit, queried => () => queried.call(this.compilation)),
|
|
528
|
+
registerCompilerEmitTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerEmit, () => this.hooks.emit, queried => async () => await queried.promise(this.compilation)),
|
|
529
|
+
registerCompilerAfterEmitTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerAfterEmit, () => this.hooks.afterEmit, queried => async () => await queried.promise(this.compilation)),
|
|
530
|
+
registerCompilerAssetEmittedTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerAssetEmitted, () => this.hooks.assetEmitted, queried => async ({ filename, targetPath, outputPath }) => await queried.promise(filename, {
|
|
531
|
+
compilation: this.compilation,
|
|
532
|
+
targetPath,
|
|
533
|
+
outputPath,
|
|
534
|
+
get source() {
|
|
535
|
+
var _a;
|
|
536
|
+
return (_a = this.compilation.getAsset(filename)) === null || _a === void 0 ? void 0 : _a.source;
|
|
537
|
+
},
|
|
538
|
+
get content() {
|
|
539
|
+
var _a;
|
|
540
|
+
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.buffer();
|
|
541
|
+
}
|
|
542
|
+
})),
|
|
543
|
+
registerCompilationRuntimeModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationRuntimeModule, () => this.compilation.hooks.runtimeModule, queried => ({ module, chunk }) => {
|
|
544
|
+
var _a, _b;
|
|
545
|
+
const originSource = (_a = module.source) === null || _a === void 0 ? void 0 : _a.source;
|
|
546
|
+
queried.call(module, Chunk_1.Chunk.__from_binding(chunk, this.compilation));
|
|
547
|
+
const newSource = (_b = module.source) === null || _b === void 0 ? void 0 : _b.source;
|
|
548
|
+
if (newSource && newSource !== originSource) {
|
|
549
|
+
return module;
|
|
550
|
+
}
|
|
551
|
+
return;
|
|
552
|
+
}),
|
|
553
|
+
registerCompilationBuildModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationBuildModule, () => this.compilation.hooks.buildModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m))),
|
|
554
|
+
registerCompilationStillValidModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationStillValidModule, () => this.compilation.hooks.stillValidModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m))),
|
|
555
|
+
registerCompilationSucceedModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationSucceedModule, () => this.compilation.hooks.succeedModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m))),
|
|
556
|
+
registerCompilationExecuteModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationExecuteModule, () => this.compilation.hooks.executeModule, queried => ({ entry, id, codegenResults, runtimeModules }) => {
|
|
557
|
+
const __webpack_require__ = (id) => {
|
|
558
|
+
const cached = moduleCache[id];
|
|
559
|
+
if (cached !== undefined) {
|
|
560
|
+
if (cached.error)
|
|
561
|
+
throw cached.error;
|
|
562
|
+
return cached.exports;
|
|
563
|
+
}
|
|
564
|
+
var execOptions = {
|
|
565
|
+
id,
|
|
566
|
+
module: {
|
|
567
|
+
id,
|
|
568
|
+
exports: {},
|
|
569
|
+
loaded: false,
|
|
570
|
+
error: undefined
|
|
571
|
+
},
|
|
572
|
+
require: __webpack_require__
|
|
573
|
+
};
|
|
574
|
+
interceptModuleExecution.forEach((handler) => handler(execOptions));
|
|
575
|
+
const result = codegenResults.map[id]["build time"];
|
|
576
|
+
const moduleObject = execOptions.module;
|
|
577
|
+
if (id)
|
|
578
|
+
moduleCache[id] = moduleObject;
|
|
579
|
+
(0, HookWebpackError_1.tryRunOrWebpackError)(() => queried.call({
|
|
580
|
+
codeGenerationResult: new Module_1.CodeGenerationResult(result),
|
|
581
|
+
moduleObject
|
|
582
|
+
}, { __webpack_require__ }), "Compilation.hooks.executeModule");
|
|
583
|
+
moduleObject.loaded = true;
|
|
584
|
+
return moduleObject.exports;
|
|
585
|
+
};
|
|
586
|
+
const moduleCache = (__webpack_require__[RuntimeGlobals_1.RuntimeGlobals.moduleCache.replace(`${RuntimeGlobals_1.RuntimeGlobals.require}.`, "")] = {});
|
|
587
|
+
const interceptModuleExecution = (__webpack_require__[RuntimeGlobals_1.RuntimeGlobals.interceptModuleExecution.replace(`${RuntimeGlobals_1.RuntimeGlobals.require}.`, "")] = []);
|
|
588
|
+
for (const runtimeModule of runtimeModules) {
|
|
589
|
+
__webpack_require__(runtimeModule);
|
|
590
|
+
}
|
|
591
|
+
const executeResult = __webpack_require__(entry);
|
|
592
|
+
__classPrivateFieldGet(this, _Compiler_moduleExecutionResultsMap, "f").set(id, executeResult);
|
|
593
|
+
}),
|
|
594
|
+
registerCompilationFinishModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationFinishModules, () => this.compilation.hooks.finishModules, queried => async () => await queried.promise(this.compilation.modules)),
|
|
595
|
+
registerCompilationOptimizeModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationOptimizeModules, () => this.compilation.hooks.optimizeModules, queried => () => queried.call(this.compilation.modules)),
|
|
596
|
+
registerCompilationAfterOptimizeModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterOptimizeModules, () => this.compilation.hooks.afterOptimizeModules, queried => () => queried.call(this.compilation.modules)),
|
|
597
|
+
registerCompilationOptimizeTreeTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationOptimizeTree, () => this.compilation.hooks.optimizeTree, queried => async () => await queried.promise(this.compilation.chunks, this.compilation.modules)),
|
|
598
|
+
registerCompilationOptimizeChunkModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationOptimizeChunkModules, () => this.compilation.hooks.optimizeChunkModules, queried => async () => await queried.promise(this.compilation.chunks, this.compilation.modules)),
|
|
599
|
+
registerCompilationChunkAssetTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationChunkAsset, () => this.compilation.hooks.chunkAsset, queried => ({ chunk, filename }) => queried.call(Chunk_1.Chunk.__from_binding(chunk, this.compilation), filename)),
|
|
600
|
+
registerCompilationProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationProcessAssets, () => this.compilation.hooks.processAssets, queried => async () => await queried.promise(this.compilation.assets)),
|
|
601
|
+
registerCompilationAfterProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterProcessAssets, () => this.compilation.hooks.afterProcessAssets, queried => () => queried.call(this.compilation.assets)),
|
|
602
|
+
registerNormalModuleFactoryBeforeResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.NormalModuleFactoryBeforeResolve, () => this.compilationParams.normalModuleFactory.hooks.beforeResolve, queried => async (resolveData) => {
|
|
539
603
|
const normalizedResolveData = {
|
|
540
604
|
request: resolveData.request,
|
|
541
605
|
context: resolveData.context,
|
|
@@ -547,34 +611,59 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
547
611
|
resolveData.request = normalizedResolveData.request;
|
|
548
612
|
resolveData.context = normalizedResolveData.context;
|
|
549
613
|
return [ret, resolveData];
|
|
614
|
+
}),
|
|
615
|
+
registerNormalModuleFactoryAfterResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.NormalModuleFactoryAfterResolve, () => this.compilationParams.normalModuleFactory.hooks.afterResolve, queried => async (arg) => {
|
|
616
|
+
const data = {
|
|
617
|
+
request: arg.request,
|
|
618
|
+
context: arg.context,
|
|
619
|
+
fileDependencies: arg.fileDependencies,
|
|
620
|
+
missingDependencies: arg.missingDependencies,
|
|
621
|
+
contextDependencies: arg.contextDependencies,
|
|
622
|
+
factoryMeta: arg.factoryMeta,
|
|
623
|
+
createData: arg.createData
|
|
624
|
+
};
|
|
625
|
+
const ret = await queried.promise(data);
|
|
626
|
+
return [ret, data.createData];
|
|
627
|
+
}),
|
|
628
|
+
registerContextModuleFactoryBeforeResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, binding.RegisterJsTapKind.ContextModuleFactoryBeforeResolve, () => this.compilationParams.contextModuleFactory.hooks.beforeResolve, queried => async (arg) => {
|
|
629
|
+
const data = {
|
|
630
|
+
request: arg.request,
|
|
631
|
+
context: arg.context,
|
|
632
|
+
fileDependencies: [],
|
|
633
|
+
missingDependencies: [],
|
|
634
|
+
contextDependencies: []
|
|
635
|
+
};
|
|
636
|
+
const ret = await queried.promise(data);
|
|
637
|
+
return [ret, data];
|
|
550
638
|
})
|
|
551
|
-
},
|
|
639
|
+
}, "f");
|
|
640
|
+
__classPrivateFieldSet(this, _Compiler_instance, new instanceBinding.Rspack(rawOptions, this.builtinPlugins, {
|
|
641
|
+
normalModuleFactoryCreateModule: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_normalModuleFactoryCreateModule).bind(this),
|
|
642
|
+
normalModuleFactoryResolveForScheme: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_normalModuleFactoryResolveForScheme).bind(this),
|
|
643
|
+
contextModuleFactoryAfterResolve: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_contextModuleFactoryAfterResolve).bind(this)
|
|
644
|
+
}, __classPrivateFieldGet(this, _Compiler_registers, "f"), (0, fileSystem_1.createThreadsafeNodeFSFromRaw)(this.outputFileSystem)), "f");
|
|
552
645
|
callback(null, __classPrivateFieldGet(this, _Compiler_instance, "f"));
|
|
646
|
+
}, _Compiler_updateNonSkippableRegisters = function _Compiler_updateNonSkippableRegisters() {
|
|
647
|
+
const kinds = [];
|
|
648
|
+
for (const { getHook, registerKind } of Object.values(__classPrivateFieldGet(this, _Compiler_registers, "f"))) {
|
|
649
|
+
const hook = getHook();
|
|
650
|
+
if (hook.isUsed()) {
|
|
651
|
+
kinds.push(registerKind);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
if (__classPrivateFieldGet(this, _Compiler_nonSkippableRegisters, "f").join() !== kinds.join()) {
|
|
655
|
+
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
|
|
656
|
+
instance.setNonSkippableRegisters(kinds);
|
|
657
|
+
__classPrivateFieldSet(this, _Compiler_nonSkippableRegisters, kinds, "f");
|
|
658
|
+
});
|
|
659
|
+
}
|
|
553
660
|
}, _Compiler_updateDisabledHooks = function _Compiler_updateDisabledHooks(callback) {
|
|
554
|
-
var _a, _b, _c
|
|
661
|
+
var _a, _b, _c;
|
|
555
662
|
const disabledHooks = [];
|
|
556
663
|
const hookMap = {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
afterEmit: this.hooks.afterEmit,
|
|
561
|
-
afterProcessAssets: this.compilation.hooks.afterProcessAssets,
|
|
562
|
-
optimizeTree: this.compilation.hooks.optimizeTree,
|
|
563
|
-
finishModules: this.compilation.hooks.finishModules,
|
|
564
|
-
optimizeModules: this.compilation.hooks.optimizeModules,
|
|
565
|
-
afterOptimizeModules: this.compilation.hooks.afterOptimizeModules,
|
|
566
|
-
chunkAsset: this.compilation.hooks.chunkAsset,
|
|
567
|
-
afterResolve: (_a = this.compilationParams) === null || _a === void 0 ? void 0 : _a.normalModuleFactory.hooks.afterResolve,
|
|
568
|
-
succeedModule: this.compilation.hooks.succeedModule,
|
|
569
|
-
stillValidModule: this.compilation.hooks.stillValidModule,
|
|
570
|
-
buildModule: this.compilation.hooks.buildModule,
|
|
571
|
-
optimizeChunkModules: this.compilation.hooks.optimizeChunkModules,
|
|
572
|
-
contextModuleFactoryBeforeResolve: (_b = this.compilationParams) === null || _b === void 0 ? void 0 : _b.contextModuleFactory.hooks.beforeResolve,
|
|
573
|
-
contextModuleFactoryAfterResolve: (_c = this.compilationParams) === null || _c === void 0 ? void 0 : _c.contextModuleFactory.hooks.afterResolve,
|
|
574
|
-
normalModuleFactoryCreateModule: (_d = this.compilationParams) === null || _d === void 0 ? void 0 : _d.normalModuleFactory.hooks.createModule,
|
|
575
|
-
normalModuleFactoryResolveForScheme: (_e = this.compilationParams) === null || _e === void 0 ? void 0 : _e.normalModuleFactory.hooks.resolveForScheme,
|
|
576
|
-
executeModule: undefined,
|
|
577
|
-
runtimeModule: this.compilation.hooks.runtimeModule
|
|
664
|
+
contextModuleFactoryAfterResolve: (_a = this.compilationParams) === null || _a === void 0 ? void 0 : _a.contextModuleFactory.hooks.afterResolve,
|
|
665
|
+
normalModuleFactoryCreateModule: (_b = this.compilationParams) === null || _b === void 0 ? void 0 : _b.normalModuleFactory.hooks.createModule,
|
|
666
|
+
normalModuleFactoryResolveForScheme: (_c = this.compilationParams) === null || _c === void 0 ? void 0 : _c.normalModuleFactory.hooks.resolveForScheme
|
|
578
667
|
};
|
|
579
668
|
for (const [name, hook] of Object.entries(hookMap)) {
|
|
580
669
|
if (typeof hook !== "undefined" &&
|
|
@@ -596,31 +685,6 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
596
685
|
__classPrivateFieldSet(this, _Compiler_disabledHooks, disabledHooks, "f");
|
|
597
686
|
});
|
|
598
687
|
}
|
|
599
|
-
}, _Compiler_finishMake = async function _Compiler_finishMake() {
|
|
600
|
-
await this.hooks.finishMake.promise(this.compilation);
|
|
601
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
602
|
-
}, _Compiler_buildModule = async function _Compiler_buildModule(module) {
|
|
603
|
-
const normalized = (0, normalization_1.normalizeJsModule)(module);
|
|
604
|
-
this.compilation.hooks.buildModule.call(normalized);
|
|
605
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
606
|
-
}, _Compiler_afterProcessAssets = async function _Compiler_afterProcessAssets() {
|
|
607
|
-
await this.compilation.hooks.afterProcessAssets.promise(this.compilation.assets);
|
|
608
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
609
|
-
}, _Compiler_afterResolve = async function _Compiler_afterResolve(resolveData) {
|
|
610
|
-
let res = await this.compilationParams.normalModuleFactory.hooks.afterResolve.promise(resolveData);
|
|
611
|
-
NormalModule_1.NormalModule.getCompilationHooks(this.compilation).loader.tap("sideEffectFreePropPlugin", (loaderContext) => {
|
|
612
|
-
loaderContext._module = {
|
|
613
|
-
factoryMeta: {
|
|
614
|
-
sideEffectFree: !!resolveData.factoryMeta.sideEffectFree
|
|
615
|
-
}
|
|
616
|
-
};
|
|
617
|
-
});
|
|
618
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
619
|
-
return [res, resolveData.createData];
|
|
620
|
-
}, _Compiler_contextModuleFactoryBeforeResolve = async function _Compiler_contextModuleFactoryBeforeResolve(resourceData) {
|
|
621
|
-
let res = await this.compilationParams.contextModuleFactory.hooks.beforeResolve.promise(resourceData);
|
|
622
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
623
|
-
return res;
|
|
624
688
|
}, _Compiler_contextModuleFactoryAfterResolve = async function _Compiler_contextModuleFactoryAfterResolve(resourceData) {
|
|
625
689
|
let res = await this.compilationParams.contextModuleFactory.hooks.afterResolve.promise(resourceData);
|
|
626
690
|
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
@@ -640,101 +704,6 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
640
704
|
resourceData: input.resourceData,
|
|
641
705
|
stop: stop === true
|
|
642
706
|
};
|
|
643
|
-
}, _Compiler_optimizeChunkModules = async function _Compiler_optimizeChunkModules() {
|
|
644
|
-
await this.compilation.hooks.optimizeChunkModules.promise(this.compilation.chunks, this.compilation.modules);
|
|
645
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
646
|
-
}, _Compiler_optimizeTree = async function _Compiler_optimizeTree() {
|
|
647
|
-
await this.compilation.hooks.optimizeTree.promise(this.compilation.chunks, this.compilation.modules);
|
|
648
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
649
|
-
}, _Compiler_optimizeModules = async function _Compiler_optimizeModules() {
|
|
650
|
-
await this.compilation.hooks.optimizeModules.promise(this.compilation.modules);
|
|
651
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
652
|
-
}, _Compiler_afterOptimizeModules = async function _Compiler_afterOptimizeModules() {
|
|
653
|
-
await this.compilation.hooks.afterOptimizeModules.promise(this.compilation.modules);
|
|
654
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
655
|
-
}, _Compiler_chunkAsset = function _Compiler_chunkAsset(assetArg) {
|
|
656
|
-
this.compilation.hooks.chunkAsset.call(assetArg.chunk, assetArg.filename);
|
|
657
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
658
|
-
}, _Compiler_finishModules = async function _Compiler_finishModules() {
|
|
659
|
-
await this.compilation.hooks.finishModules.promise(this.compilation.modules);
|
|
660
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
661
|
-
}, _Compiler_emit = async function _Compiler_emit() {
|
|
662
|
-
await this.hooks.emit.promise(this.compilation);
|
|
663
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
664
|
-
}, _Compiler_assetEmitted = async function _Compiler_assetEmitted(args) {
|
|
665
|
-
const filename = args.filename;
|
|
666
|
-
const info = {
|
|
667
|
-
compilation: this.compilation,
|
|
668
|
-
outputPath: args.outputPath,
|
|
669
|
-
targetPath: args.targetPath,
|
|
670
|
-
get source() {
|
|
671
|
-
var _a;
|
|
672
|
-
return (_a = this.compilation.getAsset(args.filename)) === null || _a === void 0 ? void 0 : _a.source;
|
|
673
|
-
},
|
|
674
|
-
get content() {
|
|
675
|
-
var _a;
|
|
676
|
-
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.buffer();
|
|
677
|
-
}
|
|
678
|
-
};
|
|
679
|
-
await this.hooks.assetEmitted.promise(filename, info);
|
|
680
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
681
|
-
}, _Compiler_afterEmit = async function _Compiler_afterEmit() {
|
|
682
|
-
await this.hooks.afterEmit.promise(this.compilation);
|
|
683
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
684
|
-
}, _Compiler_succeedModule = function _Compiler_succeedModule(module) {
|
|
685
|
-
this.compilation.hooks.succeedModule.call(module);
|
|
686
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
687
|
-
}, _Compiler_stillValidModule = function _Compiler_stillValidModule(module) {
|
|
688
|
-
this.compilation.hooks.stillValidModule.call(module);
|
|
689
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
690
|
-
}, _Compiler_runtimeModule = function _Compiler_runtimeModule(arg) {
|
|
691
|
-
var _a, _b;
|
|
692
|
-
let { module, chunk } = arg;
|
|
693
|
-
const originSource = (_a = module.source) === null || _a === void 0 ? void 0 : _a.source;
|
|
694
|
-
this.compilation.hooks.runtimeModule.call(module, chunk);
|
|
695
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
696
|
-
const newSource = (_b = module.source) === null || _b === void 0 ? void 0 : _b.source;
|
|
697
|
-
if (newSource && newSource !== originSource) {
|
|
698
|
-
return module;
|
|
699
|
-
}
|
|
700
|
-
return;
|
|
701
|
-
}, _Compiler_executeModule = async function _Compiler_executeModule({ entry, request, options, runtimeModules, codegenResults, id }) {
|
|
702
|
-
const __webpack_require__ = (id) => {
|
|
703
|
-
const cached = moduleCache[id];
|
|
704
|
-
if (cached !== undefined) {
|
|
705
|
-
if (cached.error)
|
|
706
|
-
throw cached.error;
|
|
707
|
-
return cached.exports;
|
|
708
|
-
}
|
|
709
|
-
var execOptions = {
|
|
710
|
-
id,
|
|
711
|
-
module: {
|
|
712
|
-
id,
|
|
713
|
-
exports: {},
|
|
714
|
-
loaded: false,
|
|
715
|
-
error: undefined
|
|
716
|
-
},
|
|
717
|
-
require: __webpack_require__
|
|
718
|
-
};
|
|
719
|
-
interceptModuleExecution.forEach((handler) => handler(execOptions));
|
|
720
|
-
const result = codegenResults.map[id]["build time"];
|
|
721
|
-
const moduleObject = execOptions.module;
|
|
722
|
-
if (id)
|
|
723
|
-
moduleCache[id] = moduleObject;
|
|
724
|
-
(0, HookWebpackError_1.tryRunOrWebpackError)(() => this.compilation.hooks.executeModule.call({
|
|
725
|
-
codeGenerationResult: new Module_1.CodeGenerationResult(result),
|
|
726
|
-
moduleObject
|
|
727
|
-
}, { __webpack_require__ }), "Compilation.hooks.executeModule");
|
|
728
|
-
moduleObject.loaded = true;
|
|
729
|
-
return moduleObject.exports;
|
|
730
|
-
};
|
|
731
|
-
const moduleCache = (__webpack_require__[RuntimeGlobals_1.RuntimeGlobals.moduleCache.replace(`${RuntimeGlobals_1.RuntimeGlobals.require}.`, "")] = {});
|
|
732
|
-
const interceptModuleExecution = (__webpack_require__[RuntimeGlobals_1.RuntimeGlobals.interceptModuleExecution.replace(`${RuntimeGlobals_1.RuntimeGlobals.require}.`, "")] = []);
|
|
733
|
-
for (const runtimeModule of runtimeModules) {
|
|
734
|
-
__webpack_require__(runtimeModule);
|
|
735
|
-
}
|
|
736
|
-
const executeResult = __webpack_require__(entry);
|
|
737
|
-
__classPrivateFieldGet(this, _Compiler_moduleExecutionResultsMap, "f").set(id, executeResult);
|
|
738
707
|
}, _Compiler_decorateUpdateDisabledHooks = function _Compiler_decorateUpdateDisabledHooks(jsTaps) {
|
|
739
708
|
if (jsTaps.length > 0) {
|
|
740
709
|
const last = jsTaps[jsTaps.length - 1];
|
|
@@ -744,15 +713,17 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
744
713
|
if (result && typeof result.then === "function") {
|
|
745
714
|
return result.then((r) => {
|
|
746
715
|
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
716
|
+
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateNonSkippableRegisters).call(this);
|
|
747
717
|
return r;
|
|
748
718
|
});
|
|
749
719
|
}
|
|
750
720
|
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
721
|
+
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateNonSkippableRegisters).call(this);
|
|
751
722
|
return result;
|
|
752
723
|
};
|
|
753
724
|
}
|
|
754
|
-
}, _Compiler_createRegisterTaps = function _Compiler_createRegisterTaps(getHook, createTap) {
|
|
755
|
-
|
|
725
|
+
}, _Compiler_createRegisterTaps = function _Compiler_createRegisterTaps(registerKind, getHook, createTap) {
|
|
726
|
+
const getTaps = (stages) => {
|
|
756
727
|
const hook = getHook();
|
|
757
728
|
if (!hook.isUsed())
|
|
758
729
|
return [];
|
|
@@ -777,6 +748,9 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
777
748
|
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_decorateUpdateDisabledHooks).call(this, jsTaps);
|
|
778
749
|
return jsTaps;
|
|
779
750
|
};
|
|
751
|
+
getTaps.registerKind = registerKind;
|
|
752
|
+
getTaps.getHook = getHook;
|
|
753
|
+
return getTaps;
|
|
780
754
|
}, _Compiler_createCompilation = function _Compiler_createCompilation(native) {
|
|
781
755
|
const compilation = new Compilation_1.Compilation(this, native);
|
|
782
756
|
compilation.name = this.name;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { AsyncSeriesBailHook } from "tapable";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
request: string;
|
|
5
|
-
};
|
|
2
|
+
import * as liteTapable from "./lite-tapable";
|
|
3
|
+
import { ResolveData } from "./Module";
|
|
6
4
|
export declare class ContextModuleFactory {
|
|
7
5
|
hooks: {
|
|
8
|
-
beforeResolve: AsyncSeriesBailHook<[ResolveData],
|
|
9
|
-
afterResolve: AsyncSeriesBailHook<[ResolveData],
|
|
6
|
+
beforeResolve: liteTapable.AsyncSeriesBailHook<[ResolveData], false | void>;
|
|
7
|
+
afterResolve: AsyncSeriesBailHook<[ResolveData], false | void>;
|
|
10
8
|
};
|
|
11
9
|
constructor();
|
|
12
10
|
}
|
|
13
|
-
export {};
|
|
@@ -1,7 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.ContextModuleFactory = void 0;
|
|
4
27
|
const tapable_1 = require("tapable");
|
|
28
|
+
const liteTapable = __importStar(require("./lite-tapable"));
|
|
5
29
|
class ContextModuleFactory {
|
|
6
30
|
constructor() {
|
|
7
31
|
this.hooks = {
|
|
@@ -18,7 +42,7 @@ class ContextModuleFactory {
|
|
|
18
42
|
// /** @type {AsyncSeriesBailHook<[ResolveData], Module>} */
|
|
19
43
|
// factorize: new AsyncSeriesBailHook(["resolveData"]),
|
|
20
44
|
// /** @type {AsyncSeriesBailHook<[ResolveData], false | void>} */
|
|
21
|
-
beforeResolve: new
|
|
45
|
+
beforeResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
|
|
22
46
|
afterResolve: new tapable_1.AsyncSeriesBailHook(["resolveData"])
|
|
23
47
|
// /** @type {AsyncSeriesBailHook<[ResolveData["createData"], ResolveData], Module | void>} */
|
|
24
48
|
// createModule: new AsyncSeriesBailHook(["createData", "resolveData"]),
|
package/dist/Module.d.ts
CHANGED
|
@@ -1,10 +1,32 @@
|
|
|
1
|
-
import { JsCodegenerationResult, JsCodegenerationResults, JsModule } from "@rspack/binding";
|
|
1
|
+
import { JsCodegenerationResult, JsCodegenerationResults, JsCreateData, JsFactoryMeta, JsModule } from "@rspack/binding";
|
|
2
|
+
import { Source } from "webpack-sources";
|
|
3
|
+
export type ResourceData = {
|
|
4
|
+
resource: string;
|
|
5
|
+
path: string;
|
|
6
|
+
query?: string;
|
|
7
|
+
fragment?: string;
|
|
8
|
+
};
|
|
9
|
+
export type ResourceDataWithData = ResourceData & {
|
|
10
|
+
data?: Record<string, any>;
|
|
11
|
+
};
|
|
12
|
+
export type CreateData = Partial<JsCreateData>;
|
|
13
|
+
export type ResolveData = {
|
|
14
|
+
context: string;
|
|
15
|
+
request: string;
|
|
16
|
+
fileDependencies: string[];
|
|
17
|
+
missingDependencies: string[];
|
|
18
|
+
contextDependencies: string[];
|
|
19
|
+
factoryMeta?: JsFactoryMeta;
|
|
20
|
+
createData?: CreateData;
|
|
21
|
+
};
|
|
2
22
|
export declare class Module {
|
|
3
23
|
#private;
|
|
24
|
+
_originalSource?: Source;
|
|
4
25
|
static __from_binding(module: JsModule): Module;
|
|
5
26
|
constructor(module: JsModule);
|
|
6
27
|
get context(): string | undefined;
|
|
7
28
|
get resource(): string | undefined;
|
|
29
|
+
get originalSource(): Source | null;
|
|
8
30
|
identifier(): string;
|
|
9
31
|
nameForCondition(): string | null;
|
|
10
32
|
}
|
package/dist/Module.js
CHANGED
|
@@ -13,6 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
var _Module_inner, _CodeGenerationResult_inner, _CodeGenerationResults_inner;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CodeGenerationResults = exports.CodeGenerationResult = exports.Module = void 0;
|
|
16
|
+
const createSource_1 = require("./util/createSource");
|
|
16
17
|
class Module {
|
|
17
18
|
static __from_binding(module) {
|
|
18
19
|
return new Module(module);
|
|
@@ -27,6 +28,17 @@ class Module {
|
|
|
27
28
|
get resource() {
|
|
28
29
|
return __classPrivateFieldGet(this, _Module_inner, "f").resource;
|
|
29
30
|
}
|
|
31
|
+
get originalSource() {
|
|
32
|
+
if (this._originalSource)
|
|
33
|
+
return this._originalSource;
|
|
34
|
+
if (__classPrivateFieldGet(this, _Module_inner, "f").originalSource) {
|
|
35
|
+
this._originalSource = (0, createSource_1.createSourceFromRaw)(__classPrivateFieldGet(this, _Module_inner, "f").originalSource);
|
|
36
|
+
return this._originalSource;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
30
42
|
identifier() {
|
|
31
43
|
return __classPrivateFieldGet(this, _Module_inner, "f").moduleIdentifier;
|
|
32
44
|
}
|
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
import { AsyncSeriesBailHook, HookMap } from "tapable";
|
|
2
2
|
import * as liteTapable from "./lite-tapable";
|
|
3
3
|
import type * as binding from "@rspack/binding";
|
|
4
|
-
|
|
5
|
-
resource: string;
|
|
6
|
-
path: string;
|
|
7
|
-
query?: string;
|
|
8
|
-
fragment?: string;
|
|
9
|
-
};
|
|
10
|
-
type ResourceDataWithData = ResourceData & {
|
|
11
|
-
data?: Record<string, any>;
|
|
12
|
-
};
|
|
13
|
-
type ResolveData = {
|
|
14
|
-
context?: string;
|
|
15
|
-
request: string;
|
|
16
|
-
fileDependencies: string[];
|
|
17
|
-
missingDependencies: string[];
|
|
18
|
-
contextDependencies: string[];
|
|
19
|
-
};
|
|
4
|
+
import { ResolveData, ResourceDataWithData } from "./Module";
|
|
20
5
|
type CreateModuleData = binding.CreateModuleData & {
|
|
21
6
|
settings: {};
|
|
22
7
|
matchResource: string;
|
|
@@ -25,7 +10,7 @@ export declare class NormalModuleFactory {
|
|
|
25
10
|
hooks: {
|
|
26
11
|
resolveForScheme: HookMap<AsyncSeriesBailHook<[ResourceDataWithData], true | void>>;
|
|
27
12
|
beforeResolve: liteTapable.AsyncSeriesBailHook<[ResolveData], false | void>;
|
|
28
|
-
afterResolve: AsyncSeriesBailHook<[ResolveData],
|
|
13
|
+
afterResolve: liteTapable.AsyncSeriesBailHook<[ResolveData], false | void>;
|
|
29
14
|
createModule: AsyncSeriesBailHook<[CreateModuleData, {}], void>;
|
|
30
15
|
};
|
|
31
16
|
constructor();
|
|
@@ -42,7 +42,7 @@ class NormalModuleFactory {
|
|
|
42
42
|
// /** @type {AsyncSeriesBailHook<[ResolveData], false | void>} */
|
|
43
43
|
beforeResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
|
|
44
44
|
// /** @type {AsyncSeriesBailHook<[ResolveData], false | void>} */
|
|
45
|
-
afterResolve: new
|
|
45
|
+
afterResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
|
|
46
46
|
// /** @type {AsyncSeriesBailHook<[ResolveData["createData"], ResolveData], Module | void>} */
|
|
47
47
|
createModule: new tapable_1.AsyncSeriesBailHook(["createData", "resolveData"])
|
|
48
48
|
// /** @type {SyncWaterfallHook<[Module, ResolveData["createData"], ResolveData], Module>} */
|