@rspack/core 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Dependency.d.ts +7 -6
- package/dist/Module.d.ts +19 -17
- package/dist/builtin-plugin/css-extract/utils.d.ts +1 -0
- package/dist/config/types.d.ts +545 -0
- package/dist/config/zod.d.ts +202 -1347
- package/dist/cssExtractHmr.js +224 -0
- package/dist/cssExtractLoader.js +277 -0
- package/dist/index.js +23347 -31
- package/dist/{builtin-plugin/css-extract/hmr/hotModuleReplacement.d.ts → runtime/cssExtractHmr.d.ts} +1 -0
- package/dist/runtime/moduleFederationDefaultRuntime.d.ts +2 -0
- package/dist/stats/statsFactoryUtils.d.ts +1 -0
- package/package.json +8 -5
- package/compiled/json-parse-even-better-errors/index.d.ts +0 -1
- package/compiled/json-parse-even-better-errors/index.js +0 -193
- package/compiled/json-parse-even-better-errors/package.json +0 -1
- package/compiled/neo-async/index.d.ts +0 -685
- package/compiled/neo-async/index.js +0 -9207
- package/compiled/neo-async/license +0 -22
- package/compiled/neo-async/package.json +0 -1
- package/compiled/zod-validation-error/index.d.ts +0 -41
- package/compiled/zod-validation-error/index.js +0 -335
- package/compiled/zod-validation-error/license +0 -9
- package/compiled/zod-validation-error/package.json +0 -1
- package/dist/Chunk.js +0 -118
- package/dist/ChunkGraph.js +0 -27
- package/dist/ChunkGroup.js +0 -76
- package/dist/Compilation.js +0 -854
- package/dist/Compiler.js +0 -920
- package/dist/ContextModuleFactory.js +0 -36
- package/dist/DependenciesBlock.js +0 -30
- package/dist/Dependency.js +0 -32
- package/dist/Entrypoint.js +0 -21
- package/dist/ErrorHelpers.js +0 -62
- package/dist/ExecuteModulePlugin.js +0 -46
- package/dist/FileSystem.js +0 -34
- package/dist/FileSystemInfo.js +0 -2
- package/dist/Module.js +0 -143
- package/dist/ModuleTypeConstants.js +0 -92
- package/dist/MultiCompiler.js +0 -440
- package/dist/MultiStats.js +0 -161
- package/dist/MultiWatching.js +0 -62
- package/dist/NormalModule.js +0 -97
- package/dist/NormalModuleFactory.js +0 -43
- package/dist/Resolver.js +0 -39
- package/dist/ResolverFactory.js +0 -61
- package/dist/RspackError.js +0 -21
- package/dist/RuleSetCompiler.js +0 -10
- package/dist/RuntimeGlobals.js +0 -357
- package/dist/RuntimeModule.js +0 -58
- package/dist/Stats.js +0 -161
- package/dist/Template.js +0 -206
- package/dist/Watching.js +0 -290
- package/dist/builtin-loader/index.js +0 -17
- package/dist/builtin-loader/lightningcss/index.js +0 -175
- package/dist/builtin-loader/swc/index.js +0 -5
- package/dist/builtin-loader/swc/pluginImport.js +0 -35
- package/dist/builtin-loader/swc/react.js +0 -7
- package/dist/builtin-loader/swc/types.js +0 -2
- package/dist/builtin-plugin/APIPlugin.js +0 -6
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.js +0 -6
- package/dist/builtin-plugin/AssetModulesPlugin.js +0 -6
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.js +0 -6
- package/dist/builtin-plugin/BannerPlugin.js +0 -22
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.js +0 -12
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.js +0 -6
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.js +0 -6
- package/dist/builtin-plugin/ContextReplacementPlugin.js +0 -43
- package/dist/builtin-plugin/CopyRspackPlugin.js +0 -21
- package/dist/builtin-plugin/CssModulesPlugin.js +0 -6
- package/dist/builtin-plugin/DataUriPlugin.js +0 -6
- package/dist/builtin-plugin/DefinePlugin.js +0 -44
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.js +0 -6
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.js +0 -6
- package/dist/builtin-plugin/DynamicEntryPlugin.js +0 -36
- package/dist/builtin-plugin/ElectronTargetPlugin.js +0 -6
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.js +0 -6
- package/dist/builtin-plugin/EnableLibraryPlugin.js +0 -39
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.js +0 -6
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.js +0 -6
- package/dist/builtin-plugin/EntryPlugin.js +0 -34
- package/dist/builtin-plugin/EvalDevToolModulePlugin.js +0 -6
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.js +0 -16
- package/dist/builtin-plugin/ExternalsPlugin.js +0 -51
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.js +0 -6
- package/dist/builtin-plugin/FileUriPlugin.js +0 -6
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.js +0 -6
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.js +0 -6
- package/dist/builtin-plugin/HotModuleReplacementPlugin.js +0 -18
- package/dist/builtin-plugin/HtmlRspackPlugin.js +0 -285
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.js +0 -11
- package/dist/builtin-plugin/IgnorePlugin.js +0 -20
- package/dist/builtin-plugin/InferAsyncModulesPlugin.js +0 -6
- package/dist/builtin-plugin/JavascriptModulesPlugin.js +0 -55
- package/dist/builtin-plugin/JsLoaderRspackPlugin.js +0 -9
- package/dist/builtin-plugin/JsonModulesPlugin.js +0 -6
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +0 -30
- package/dist/builtin-plugin/LimitChunkCountPlugin.js +0 -8
- package/dist/builtin-plugin/MangleExportsPlugin.js +0 -6
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.js +0 -6
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.js +0 -6
- package/dist/builtin-plugin/ModuleConcatenationPlugin.js +0 -6
- package/dist/builtin-plugin/NamedChunkIdsPlugin.js +0 -6
- package/dist/builtin-plugin/NamedModuleIdsPlugin.js +0 -6
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.js +0 -6
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.js +0 -6
- package/dist/builtin-plugin/NoEmitOnErrorsPlugin.js +0 -6
- package/dist/builtin-plugin/NodeTargetPlugin.js +0 -6
- package/dist/builtin-plugin/ProgressPlugin.js +0 -15
- package/dist/builtin-plugin/ProvidePlugin.js +0 -14
- package/dist/builtin-plugin/RealContentHashPlugin.js +0 -6
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.js +0 -6
- package/dist/builtin-plugin/RuntimeChunkPlugin.js +0 -6
- package/dist/builtin-plugin/RuntimePlugin.js +0 -6
- package/dist/builtin-plugin/SideEffectsFlagPlugin.js +0 -6
- package/dist/builtin-plugin/SizeLimitsPlugin.js +0 -9
- package/dist/builtin-plugin/SourceMapDevToolPlugin.js +0 -14
- package/dist/builtin-plugin/SplitChunksPlugin.js +0 -92
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +0 -80
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.js +0 -6
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.js +0 -6
- package/dist/builtin-plugin/WorkerPlugin.js +0 -31
- package/dist/builtin-plugin/base.js +0 -58
- package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +0 -182
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.d.ts +0 -2
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.js +0 -31
- package/dist/builtin-plugin/css-extract/index.js +0 -105
- package/dist/builtin-plugin/css-extract/loader.js +0 -204
- package/dist/builtin-plugin/css-extract/utils.js +0 -51
- package/dist/builtin-plugin/index.js +0 -84
- package/dist/builtin-plugin/lazy-compilation/backend.js +0 -139
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.js +0 -6
- package/dist/builtin-plugin/lazy-compilation/plugin.js +0 -60
- package/dist/config/adapter.js +0 -691
- package/dist/config/adapterRuleUse.js +0 -107
- package/dist/config/browserslistTargetHandler.js +0 -345
- package/dist/config/defaults.js +0 -876
- package/dist/config/index.js +0 -20
- package/dist/config/normalization.js +0 -299
- package/dist/config/target.js +0 -318
- package/dist/config/types.js +0 -3
- package/dist/config/zod.js +0 -1028
- package/dist/container/ContainerPlugin.js +0 -50
- package/dist/container/ContainerReferencePlugin.js +0 -49
- package/dist/container/ModuleFederationPlugin.js +0 -137
- package/dist/container/ModuleFederationPluginV1.js +0 -63
- package/dist/container/ModuleFederationRuntimePlugin.js +0 -6
- package/dist/container/options.js +0 -48
- package/dist/error/ConcurrentCompilationError.js +0 -20
- package/dist/exports.js +0 -183
- package/dist/lib/AbstractMethodError.js +0 -51
- package/dist/lib/Cache.js +0 -111
- package/dist/lib/CacheFacade.js +0 -321
- package/dist/lib/Dependency.js +0 -11
- package/dist/lib/EntryOptionPlugin.js +0 -89
- package/dist/lib/EnvironmentPlugin.js +0 -57
- package/dist/lib/HookWebpackError.js +0 -83
- package/dist/lib/IgnoreWarningsPlugin.js +0 -35
- package/dist/lib/LoaderOptionsPlugin.js +0 -74
- package/dist/lib/LoaderTargetPlugin.js +0 -37
- package/dist/lib/ModuleFilenameHelpers.js +0 -83
- package/dist/lib/NormalModuleReplacementPlugin.js +0 -85
- package/dist/lib/WebpackError.js +0 -20
- package/dist/lib/cache/MemoryCachePlugin.js +0 -40
- package/dist/lib/cache/getLazyHashedEtag.js +0 -73
- package/dist/lib/cache/mergeEtags.js +0 -74
- package/dist/lib/formatLocation.js +0 -64
- package/dist/loader-runner/LoaderLoadingError.js +0 -19
- package/dist/loader-runner/index.js +0 -735
- package/dist/loader-runner/loadLoader.js +0 -64
- package/dist/logging/Logger.js +0 -143
- package/dist/logging/createConsoleLogger.js +0 -176
- package/dist/logging/runtime.js +0 -37
- package/dist/logging/truncateArgs.js +0 -81
- package/dist/node/NodeEnvironmentPlugin.js +0 -50
- package/dist/node/NodeTemplatePlugin.js +0 -26
- package/dist/node/NodeWatchFileSystem.js +0 -144
- package/dist/node/nodeConsole.js +0 -146
- package/dist/rspack.js +0 -123
- package/dist/rspackOptionsApply.js +0 -274
- package/dist/sharing/ConsumeSharedPlugin.js +0 -69
- package/dist/sharing/ProvideSharedPlugin.js +0 -50
- package/dist/sharing/SharePlugin.js +0 -66
- package/dist/sharing/ShareRuntimePlugin.js +0 -26
- package/dist/sharing/utils.js +0 -8
- package/dist/stats/DefaultStatsFactoryPlugin.js +0 -1173
- package/dist/stats/DefaultStatsPresetPlugin.js +0 -305
- package/dist/stats/DefaultStatsPrinterPlugin.js +0 -1069
- package/dist/stats/StatsFactory.js +0 -167
- package/dist/stats/StatsPrinter.js +0 -142
- package/dist/stats/statsFactoryUtils.js +0 -341
- package/dist/util/ArrayQueue.js +0 -108
- package/dist/util/AssetInfo.js +0 -39
- package/dist/util/IterableHelpers.js +0 -35
- package/dist/util/MergeCaller.js +0 -24
- package/dist/util/SizeFormatHelpers.js +0 -24
- package/dist/util/SplitChunkSize.js +0 -18
- package/dist/util/assertNotNil.js +0 -9
- package/dist/util/assetCondition.js +0 -2
- package/dist/util/bindingVersionCheck.js +0 -124
- package/dist/util/cleverMerge.js +0 -504
- package/dist/util/comparators.js +0 -108
- package/dist/util/createHash.js +0 -161
- package/dist/util/createReadonlyMap.js +0 -29
- package/dist/util/fake.js +0 -28
- package/dist/util/fs.js +0 -120
- package/dist/util/hash/BatchedHash.js +0 -69
- package/dist/util/hash/index.js +0 -39
- package/dist/util/hash/md4.js +0 -27
- package/dist/util/hash/wasm-hash.js +0 -167
- package/dist/util/hash/xxhash64.js +0 -27
- package/dist/util/identifier.js +0 -330
- package/dist/util/index.js +0 -123
- package/dist/util/memoize.js +0 -61
- package/dist/util/scheme.js +0 -57
- package/dist/util/smartGrouping.js +0 -148
- package/dist/util/source.js +0 -42
- package/dist/util/validate.js +0 -77
- package/dist/util/webpack.js +0 -27
- /package/dist/{container/default.runtime.js → moduleFederationDefaultRuntime.js} +0 -0
package/dist/Compiler.js
DELETED
|
@@ -1,920 +0,0 @@
|
|
|
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
|
-
};
|
|
25
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
26
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
27
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
28
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
29
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
30
|
-
};
|
|
31
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
32
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
33
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
34
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
35
|
-
};
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
var _Compiler_instances, _Compiler_instance, _Compiler_initial, _Compiler_compilation, _Compiler_compilationParams, _Compiler_builtinPlugins, _Compiler_moduleExecutionResultsMap, _Compiler_nonSkippableRegisters, _Compiler_registers, _Compiler_ruleSet, _Compiler_build, _Compiler_createCompilation, _Compiler_resetThisCompilation, _Compiler_newCompilationParams, _Compiler_getInstance, _Compiler_updateNonSkippableRegisters, _Compiler_decorateJsTaps, _Compiler_createHookRegisterTaps, _Compiler_createHookMapRegisterTaps;
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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"));
|
|
52
|
-
const liteTapable = __importStar(require("@rspack/lite-tapable"));
|
|
53
|
-
const ExecuteModulePlugin_1 = __importDefault(require("./ExecuteModulePlugin"));
|
|
54
|
-
const ConcurrentCompilationError_1 = __importDefault(require("./error/ConcurrentCompilationError"));
|
|
55
|
-
const Cache_1 = __importDefault(require("./lib/Cache"));
|
|
56
|
-
const CacheFacade_1 = __importDefault(require("./lib/CacheFacade"));
|
|
57
|
-
const RuntimeGlobals_1 = require("./RuntimeGlobals");
|
|
58
|
-
const builtin_plugin_1 = require("./builtin-plugin");
|
|
59
|
-
const Chunk_1 = require("./Chunk");
|
|
60
|
-
const Compilation_1 = require("./Compilation");
|
|
61
|
-
const ContextModuleFactory_1 = require("./ContextModuleFactory");
|
|
62
|
-
const FileSystem_1 = require("./FileSystem");
|
|
63
|
-
const Module_1 = require("./Module");
|
|
64
|
-
const NormalModuleFactory_1 = require("./NormalModuleFactory");
|
|
65
|
-
const ResolverFactory_1 = require("./ResolverFactory");
|
|
66
|
-
const RuleSetCompiler_1 = require("./RuleSetCompiler");
|
|
67
|
-
const Stats_1 = require("./Stats");
|
|
68
|
-
const Watching_1 = require("./Watching");
|
|
69
|
-
const config_1 = require("./config");
|
|
70
|
-
const index_1 = require("./index");
|
|
71
|
-
const util_1 = require("./util");
|
|
72
|
-
const base_1 = require("./builtin-plugin/base");
|
|
73
|
-
const defaults_1 = require("./config/defaults");
|
|
74
|
-
const HookWebpackError_1 = require("./lib/HookWebpackError");
|
|
75
|
-
const Logger_1 = require("./logging/Logger");
|
|
76
|
-
const assertNotNil_1 = require("./util/assertNotNil");
|
|
77
|
-
const bindingVersionCheck_1 = require("./util/bindingVersionCheck");
|
|
78
|
-
const createHash_1 = require("./util/createHash");
|
|
79
|
-
const identifier_1 = require("./util/identifier");
|
|
80
|
-
class Compiler {
|
|
81
|
-
constructor(context, options) {
|
|
82
|
-
_Compiler_instances.add(this);
|
|
83
|
-
_Compiler_instance.set(this, void 0);
|
|
84
|
-
_Compiler_initial.set(this, void 0);
|
|
85
|
-
_Compiler_compilation.set(this, void 0);
|
|
86
|
-
_Compiler_compilationParams.set(this, void 0);
|
|
87
|
-
_Compiler_builtinPlugins.set(this, void 0);
|
|
88
|
-
_Compiler_moduleExecutionResultsMap.set(this, void 0);
|
|
89
|
-
_Compiler_nonSkippableRegisters.set(this, void 0);
|
|
90
|
-
_Compiler_registers.set(this, void 0);
|
|
91
|
-
_Compiler_ruleSet.set(this, void 0);
|
|
92
|
-
__classPrivateFieldSet(this, _Compiler_initial, true, "f");
|
|
93
|
-
__classPrivateFieldSet(this, _Compiler_builtinPlugins, [], "f");
|
|
94
|
-
__classPrivateFieldSet(this, _Compiler_nonSkippableRegisters, [], "f");
|
|
95
|
-
__classPrivateFieldSet(this, _Compiler_moduleExecutionResultsMap, new Map(), "f");
|
|
96
|
-
__classPrivateFieldSet(this, _Compiler_ruleSet, new RuleSetCompiler_1.RuleSetCompiler(), "f");
|
|
97
|
-
this.hooks = {
|
|
98
|
-
initialize: new liteTapable.SyncHook([]),
|
|
99
|
-
shouldEmit: new liteTapable.SyncBailHook(["compilation"]),
|
|
100
|
-
done: new liteTapable.AsyncSeriesHook(["stats"]),
|
|
101
|
-
afterDone: new liteTapable.SyncHook(["stats"]),
|
|
102
|
-
beforeRun: new liteTapable.AsyncSeriesHook(["compiler"]),
|
|
103
|
-
run: new liteTapable.AsyncSeriesHook(["compiler"]),
|
|
104
|
-
emit: new liteTapable.AsyncSeriesHook(["compilation"]),
|
|
105
|
-
assetEmitted: new liteTapable.AsyncSeriesHook(["file", "info"]),
|
|
106
|
-
afterEmit: new liteTapable.AsyncSeriesHook(["compilation"]),
|
|
107
|
-
thisCompilation: new liteTapable.SyncHook(["compilation", "params"]),
|
|
108
|
-
compilation: new liteTapable.SyncHook([
|
|
109
|
-
"compilation",
|
|
110
|
-
"params"
|
|
111
|
-
]),
|
|
112
|
-
invalid: new liteTapable.SyncHook(["filename", "changeTime"]),
|
|
113
|
-
compile: new liteTapable.SyncHook(["params"]),
|
|
114
|
-
infrastructureLog: new liteTapable.SyncBailHook([
|
|
115
|
-
"origin",
|
|
116
|
-
"type",
|
|
117
|
-
"args"
|
|
118
|
-
]),
|
|
119
|
-
failed: new liteTapable.SyncHook(["error"]),
|
|
120
|
-
shutdown: new liteTapable.AsyncSeriesHook([]),
|
|
121
|
-
normalModuleFactory: new liteTapable.SyncHook([
|
|
122
|
-
"normalModuleFactory"
|
|
123
|
-
]),
|
|
124
|
-
contextModuleFactory: new liteTapable.SyncHook([
|
|
125
|
-
"contextModuleFactory"
|
|
126
|
-
]),
|
|
127
|
-
watchRun: new liteTapable.AsyncSeriesHook(["compiler"]),
|
|
128
|
-
watchClose: new liteTapable.SyncHook([]),
|
|
129
|
-
environment: new liteTapable.SyncHook([]),
|
|
130
|
-
afterEnvironment: new liteTapable.SyncHook([]),
|
|
131
|
-
afterPlugins: new liteTapable.SyncHook(["compiler"]),
|
|
132
|
-
afterResolvers: new liteTapable.SyncHook(["compiler"]),
|
|
133
|
-
make: new liteTapable.AsyncParallelHook(["compilation"]),
|
|
134
|
-
beforeCompile: new liteTapable.AsyncSeriesHook(["params"]),
|
|
135
|
-
afterCompile: new liteTapable.AsyncSeriesHook(["compilation"]),
|
|
136
|
-
finishMake: new liteTapable.AsyncSeriesHook(["compilation"]),
|
|
137
|
-
entryOption: new liteTapable.SyncBailHook(["context", "entry"])
|
|
138
|
-
};
|
|
139
|
-
this.webpack = index_1.rspack;
|
|
140
|
-
this.rspack = index_1.rspack;
|
|
141
|
-
this.root = this;
|
|
142
|
-
this.outputPath = "";
|
|
143
|
-
this.inputFileSystem = null;
|
|
144
|
-
this.intermediateFileSystem = null;
|
|
145
|
-
this.outputFileSystem = null;
|
|
146
|
-
this.watchFileSystem = null;
|
|
147
|
-
this.records = {};
|
|
148
|
-
this.options = options;
|
|
149
|
-
this.resolverFactory = new ResolverFactory_1.ResolverFactory();
|
|
150
|
-
this.context = context;
|
|
151
|
-
this.cache = new Cache_1.default();
|
|
152
|
-
this.compilerPath = "";
|
|
153
|
-
this.running = false;
|
|
154
|
-
this.idle = false;
|
|
155
|
-
this.watchMode = false;
|
|
156
|
-
new builtin_plugin_1.JsLoaderRspackPlugin(this).apply(this);
|
|
157
|
-
new ExecuteModulePlugin_1.default().apply(this);
|
|
158
|
-
}
|
|
159
|
-
get recordsInputPath() {
|
|
160
|
-
return (0, util_1.unsupported)("Compiler.recordsInputPath");
|
|
161
|
-
}
|
|
162
|
-
get recordsOutputPath() {
|
|
163
|
-
return (0, util_1.unsupported)("Compiler.recordsOutputPath");
|
|
164
|
-
}
|
|
165
|
-
get managedPaths() {
|
|
166
|
-
return (0, util_1.unsupported)("Compiler.managedPaths");
|
|
167
|
-
}
|
|
168
|
-
get immutablePaths() {
|
|
169
|
-
return (0, util_1.unsupported)("Compiler.immutablePaths");
|
|
170
|
-
}
|
|
171
|
-
get _lastCompilation() {
|
|
172
|
-
return __classPrivateFieldGet(this, _Compiler_compilation, "f");
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
176
|
-
* @internal
|
|
177
|
-
*/
|
|
178
|
-
get __internal__builtinPlugins() {
|
|
179
|
-
return __classPrivateFieldGet(this, _Compiler_builtinPlugins, "f");
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
183
|
-
* @internal
|
|
184
|
-
*/
|
|
185
|
-
get __internal__ruleSet() {
|
|
186
|
-
return __classPrivateFieldGet(this, _Compiler_ruleSet, "f");
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* @param name - cache name
|
|
190
|
-
* @returns the cache facade instance
|
|
191
|
-
*/
|
|
192
|
-
getCache(name) {
|
|
193
|
-
return new CacheFacade_1.default(this.cache, `${this.compilerPath}${name}`, this.options.output.hashFunction);
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* @param name - name of the logger, or function called once to get the logger name
|
|
197
|
-
* @returns a logger with that name
|
|
198
|
-
*/
|
|
199
|
-
getInfrastructureLogger(name) {
|
|
200
|
-
if (!name) {
|
|
201
|
-
throw new TypeError("Compiler.getInfrastructureLogger(name) called without a name");
|
|
202
|
-
}
|
|
203
|
-
let normalizedName = name;
|
|
204
|
-
return new Logger_1.Logger((type, args) => {
|
|
205
|
-
if (typeof normalizedName === "function") {
|
|
206
|
-
normalizedName = normalizedName();
|
|
207
|
-
if (!normalizedName) {
|
|
208
|
-
throw new TypeError("Compiler.getInfrastructureLogger(name) called with a function not returning a name");
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
if (this.hooks.infrastructureLog.call(normalizedName, type, args) ===
|
|
213
|
-
undefined) {
|
|
214
|
-
if (this.infrastructureLogger !== undefined) {
|
|
215
|
-
this.infrastructureLogger(normalizedName, type, args);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}, (childName) => {
|
|
220
|
-
let normalizedChildName = childName;
|
|
221
|
-
if (typeof normalizedName === "function") {
|
|
222
|
-
if (typeof normalizedChildName === "function") {
|
|
223
|
-
return this.getInfrastructureLogger(() => {
|
|
224
|
-
if (typeof normalizedName === "function") {
|
|
225
|
-
normalizedName = normalizedName();
|
|
226
|
-
if (!normalizedName) {
|
|
227
|
-
throw new TypeError("Compiler.getInfrastructureLogger(name) called with a function not returning a name");
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
if (typeof normalizedChildName === "function") {
|
|
231
|
-
normalizedChildName = normalizedChildName();
|
|
232
|
-
if (!normalizedChildName) {
|
|
233
|
-
throw new TypeError("Logger.getChildLogger(name) called with a function not returning a name");
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
return `${normalizedName}/${normalizedChildName}`;
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
return this.getInfrastructureLogger(() => {
|
|
240
|
-
if (typeof normalizedName === "function") {
|
|
241
|
-
normalizedName = normalizedName();
|
|
242
|
-
if (!normalizedName) {
|
|
243
|
-
throw new TypeError("Compiler.getInfrastructureLogger(name) called with a function not returning a name");
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
return `${normalizedName}/${normalizedChildName}`;
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
if (typeof normalizedChildName === "function") {
|
|
250
|
-
return this.getInfrastructureLogger(() => {
|
|
251
|
-
if (typeof normalizedChildName === "function") {
|
|
252
|
-
normalizedChildName = normalizedChildName();
|
|
253
|
-
if (!normalizedChildName) {
|
|
254
|
-
throw new TypeError("Logger.getChildLogger(name) called with a function not returning a name");
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return `${normalizedName}/${normalizedChildName}`;
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
return this.getInfrastructureLogger(`${normalizedName}/${normalizedChildName}`);
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* @param watchOptions - the watcher's options
|
|
265
|
-
* @param handler - signals when the call finishes
|
|
266
|
-
* @returns a compiler watcher
|
|
267
|
-
*/
|
|
268
|
-
watch(watchOptions, handler) {
|
|
269
|
-
if (this.running) {
|
|
270
|
-
// cannot be resolved without assertion
|
|
271
|
-
// copy from webpack
|
|
272
|
-
// Type 'void' is not assignable to type 'Watching'.
|
|
273
|
-
return handler(new ConcurrentCompilationError_1.default());
|
|
274
|
-
}
|
|
275
|
-
this.running = true;
|
|
276
|
-
this.watchMode = true;
|
|
277
|
-
this.watching = new Watching_1.Watching(this, watchOptions, handler);
|
|
278
|
-
return this.watching;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* @param callback - signals when the call finishes
|
|
282
|
-
*/
|
|
283
|
-
run(callback) {
|
|
284
|
-
if (this.running) {
|
|
285
|
-
return callback(new ConcurrentCompilationError_1.default());
|
|
286
|
-
}
|
|
287
|
-
const startTime = Date.now();
|
|
288
|
-
this.running = true;
|
|
289
|
-
const doRun = () => {
|
|
290
|
-
const finalCallback = (err, stats) => {
|
|
291
|
-
this.idle = true;
|
|
292
|
-
this.cache.beginIdle();
|
|
293
|
-
this.idle = true;
|
|
294
|
-
this.running = false;
|
|
295
|
-
if (err) {
|
|
296
|
-
this.hooks.failed.call(err);
|
|
297
|
-
}
|
|
298
|
-
if (callback) {
|
|
299
|
-
callback(err, stats);
|
|
300
|
-
}
|
|
301
|
-
this.hooks.afterDone.call(stats);
|
|
302
|
-
};
|
|
303
|
-
this.hooks.beforeRun.callAsync(this, err => {
|
|
304
|
-
if (err) {
|
|
305
|
-
return finalCallback(err);
|
|
306
|
-
}
|
|
307
|
-
this.hooks.run.callAsync(this, err => {
|
|
308
|
-
if (err) {
|
|
309
|
-
return finalCallback(err);
|
|
310
|
-
}
|
|
311
|
-
this.compile(err => {
|
|
312
|
-
if (err) {
|
|
313
|
-
return finalCallback(err);
|
|
314
|
-
}
|
|
315
|
-
__classPrivateFieldGet(this, _Compiler_compilation, "f").startTime = startTime;
|
|
316
|
-
__classPrivateFieldGet(this, _Compiler_compilation, "f").endTime = Date.now();
|
|
317
|
-
const stats = new Stats_1.Stats(__classPrivateFieldGet(this, _Compiler_compilation, "f"));
|
|
318
|
-
this.hooks.done.callAsync(stats, err => {
|
|
319
|
-
if (err) {
|
|
320
|
-
return finalCallback(err);
|
|
321
|
-
}
|
|
322
|
-
return finalCallback(null, stats);
|
|
323
|
-
});
|
|
324
|
-
});
|
|
325
|
-
});
|
|
326
|
-
});
|
|
327
|
-
};
|
|
328
|
-
if (this.idle) {
|
|
329
|
-
this.cache.endIdle(err => {
|
|
330
|
-
if (err)
|
|
331
|
-
return callback(err);
|
|
332
|
-
this.idle = false;
|
|
333
|
-
doRun();
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
337
|
-
doRun();
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
runAsChild(callback) {
|
|
341
|
-
const finalCallback = (err, entries, compilation) => {
|
|
342
|
-
try {
|
|
343
|
-
callback(err, entries, compilation);
|
|
344
|
-
}
|
|
345
|
-
catch (e) {
|
|
346
|
-
const err = new Error(`compiler.runAsChild callback error: ${e}`);
|
|
347
|
-
// err.details = e.stack;
|
|
348
|
-
this.parentCompilation.errors.push(err);
|
|
349
|
-
// TODO: remove once this works
|
|
350
|
-
console.log(e);
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
this.compile((err, compilation) => {
|
|
354
|
-
if (err) {
|
|
355
|
-
return finalCallback(err);
|
|
356
|
-
}
|
|
357
|
-
(0, assertNotNil_1.assertNotNill)(compilation);
|
|
358
|
-
this.parentCompilation.children.push(compilation);
|
|
359
|
-
for (const { name, source, info } of compilation.getAssets()) {
|
|
360
|
-
// Do not emit asset if source is not available.
|
|
361
|
-
// Webpack will emit it anyway.
|
|
362
|
-
if (source) {
|
|
363
|
-
this.parentCompilation.emitAsset(name, source, info);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
const entries = [];
|
|
367
|
-
for (const ep of compilation.entrypoints.values()) {
|
|
368
|
-
entries.push(...ep.chunks);
|
|
369
|
-
}
|
|
370
|
-
return finalCallback(null, entries, compilation);
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
purgeInputFileSystem() {
|
|
374
|
-
this.inputFileSystem?.purge?.();
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* @param compilation - the compilation
|
|
378
|
-
* @param compilerName - the compiler's name
|
|
379
|
-
* @param compilerIndex - the compiler's index
|
|
380
|
-
* @param outputOptions - the output options
|
|
381
|
-
* @param plugins - the plugins to apply
|
|
382
|
-
* @returns a child compiler
|
|
383
|
-
*/
|
|
384
|
-
createChildCompiler(compilation, compilerName, compilerIndex, outputOptions, plugins) {
|
|
385
|
-
const options = {
|
|
386
|
-
...this.options,
|
|
387
|
-
output: {
|
|
388
|
-
...this.options.output,
|
|
389
|
-
...outputOptions
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
(0, defaults_1.applyRspackOptionsDefaults)(options);
|
|
393
|
-
const childCompiler = new Compiler(this.context, options);
|
|
394
|
-
childCompiler.name = compilerName;
|
|
395
|
-
childCompiler.outputPath = this.outputPath;
|
|
396
|
-
childCompiler.inputFileSystem = this.inputFileSystem;
|
|
397
|
-
childCompiler.outputFileSystem = null;
|
|
398
|
-
childCompiler.modifiedFiles = this.modifiedFiles;
|
|
399
|
-
childCompiler.removedFiles = this.removedFiles;
|
|
400
|
-
childCompiler.fileTimestamps = this.fileTimestamps;
|
|
401
|
-
childCompiler.contextTimestamps = this.contextTimestamps;
|
|
402
|
-
childCompiler.fsStartTime = this.fsStartTime;
|
|
403
|
-
childCompiler.cache = this.cache;
|
|
404
|
-
childCompiler.compilerPath = `${this.compilerPath}${compilerName}|${compilerIndex}|`;
|
|
405
|
-
const relativeCompilerName = (0, identifier_1.makePathsRelative)(this.context, compilerName, this.root);
|
|
406
|
-
if (!this.records[relativeCompilerName]) {
|
|
407
|
-
this.records[relativeCompilerName] = [];
|
|
408
|
-
}
|
|
409
|
-
if (this.records[relativeCompilerName][compilerIndex]) {
|
|
410
|
-
childCompiler.records = this.records[relativeCompilerName][compilerIndex];
|
|
411
|
-
}
|
|
412
|
-
else {
|
|
413
|
-
this.records[relativeCompilerName].push((childCompiler.records = {}));
|
|
414
|
-
}
|
|
415
|
-
childCompiler.parentCompilation = compilation;
|
|
416
|
-
childCompiler.root = this.root;
|
|
417
|
-
if (Array.isArray(plugins)) {
|
|
418
|
-
for (const plugin of plugins) {
|
|
419
|
-
if (plugin) {
|
|
420
|
-
plugin.apply(childCompiler);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
__classPrivateFieldSet(childCompiler, _Compiler_builtinPlugins, [
|
|
425
|
-
...__classPrivateFieldGet(childCompiler, _Compiler_builtinPlugins, "f"),
|
|
426
|
-
...__classPrivateFieldGet(this, _Compiler_builtinPlugins, "f").filter(plugin => plugin.canInherentFromParent === true)
|
|
427
|
-
], "f");
|
|
428
|
-
for (const hookName in this.hooks) {
|
|
429
|
-
const name = hookName;
|
|
430
|
-
if ((0, base_1.canInherentFromParent)(name)) {
|
|
431
|
-
if (childCompiler.hooks[name]) {
|
|
432
|
-
childCompiler.hooks[name].taps = this.hooks[name].taps.slice();
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
compilation.hooks.childCompiler.call(childCompiler, compilerName, compilerIndex);
|
|
437
|
-
return childCompiler;
|
|
438
|
-
}
|
|
439
|
-
isChild() {
|
|
440
|
-
const isRoot = this.root === this;
|
|
441
|
-
return !isRoot;
|
|
442
|
-
}
|
|
443
|
-
compile(callback) {
|
|
444
|
-
const startTime = Date.now();
|
|
445
|
-
const params = __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_newCompilationParams).call(this);
|
|
446
|
-
this.hooks.beforeCompile.callAsync(params, (err) => {
|
|
447
|
-
if (err) {
|
|
448
|
-
return callback(err);
|
|
449
|
-
}
|
|
450
|
-
this.hooks.compile.call(params);
|
|
451
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_resetThisCompilation).call(this);
|
|
452
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_build).call(this, err => {
|
|
453
|
-
if (err) {
|
|
454
|
-
return callback(err);
|
|
455
|
-
}
|
|
456
|
-
__classPrivateFieldGet(this, _Compiler_compilation, "f").startTime = startTime;
|
|
457
|
-
__classPrivateFieldGet(this, _Compiler_compilation, "f").endTime = Date.now();
|
|
458
|
-
this.hooks.afterCompile.callAsync(__classPrivateFieldGet(this, _Compiler_compilation, "f"), err => {
|
|
459
|
-
if (err) {
|
|
460
|
-
return callback(err);
|
|
461
|
-
}
|
|
462
|
-
return callback(null, __classPrivateFieldGet(this, _Compiler_compilation, "f"));
|
|
463
|
-
});
|
|
464
|
-
});
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
close(callback) {
|
|
468
|
-
if (this.watching) {
|
|
469
|
-
// When there is still an active watching, close this #initial
|
|
470
|
-
this.watching.close(() => {
|
|
471
|
-
this.close(callback);
|
|
472
|
-
});
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
this.hooks.shutdown.callAsync(err => {
|
|
476
|
-
if (err)
|
|
477
|
-
return callback(err);
|
|
478
|
-
this.cache.shutdown(callback);
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
483
|
-
* @internal
|
|
484
|
-
*/
|
|
485
|
-
__internal__rebuild(modifiedFiles, removedFiles, callback) {
|
|
486
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
|
|
487
|
-
if (error) {
|
|
488
|
-
return callback?.(error);
|
|
489
|
-
}
|
|
490
|
-
instance.rebuild(Array.from(modifiedFiles || []), Array.from(removedFiles || []), error => {
|
|
491
|
-
if (error) {
|
|
492
|
-
return callback?.(error);
|
|
493
|
-
}
|
|
494
|
-
callback?.(null);
|
|
495
|
-
});
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
__internal__registerBuiltinPlugin(plugin) {
|
|
499
|
-
__classPrivateFieldGet(this, _Compiler_builtinPlugins, "f").push(plugin);
|
|
500
|
-
}
|
|
501
|
-
__internal__getModuleExecutionResult(id) {
|
|
502
|
-
return __classPrivateFieldGet(this, _Compiler_moduleExecutionResultsMap, "f").get(id);
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
exports.Compiler = Compiler;
|
|
506
|
-
_Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler_compilation = new WeakMap(), _Compiler_compilationParams = new WeakMap(), _Compiler_builtinPlugins = new WeakMap(), _Compiler_moduleExecutionResultsMap = new WeakMap(), _Compiler_nonSkippableRegisters = new WeakMap(), _Compiler_registers = new WeakMap(), _Compiler_ruleSet = new WeakMap(), _Compiler_instances = new WeakSet(), _Compiler_build = function _Compiler_build(callback) {
|
|
507
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
|
|
508
|
-
if (error) {
|
|
509
|
-
return callback?.(error);
|
|
510
|
-
}
|
|
511
|
-
if (!__classPrivateFieldGet(this, _Compiler_initial, "f")) {
|
|
512
|
-
instance.rebuild(Array.from(this.modifiedFiles || []), Array.from(this.removedFiles || []), error => {
|
|
513
|
-
if (error) {
|
|
514
|
-
return callback?.(error);
|
|
515
|
-
}
|
|
516
|
-
callback?.(null);
|
|
517
|
-
});
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
__classPrivateFieldSet(this, _Compiler_initial, false, "f");
|
|
521
|
-
instance.build(error => {
|
|
522
|
-
if (error) {
|
|
523
|
-
return callback?.(error);
|
|
524
|
-
}
|
|
525
|
-
callback?.(null);
|
|
526
|
-
});
|
|
527
|
-
});
|
|
528
|
-
}, _Compiler_createCompilation = function _Compiler_createCompilation(native) {
|
|
529
|
-
const compilation = new Compilation_1.Compilation(this, native);
|
|
530
|
-
compilation.name = this.name;
|
|
531
|
-
__classPrivateFieldSet(this, _Compiler_compilation, compilation, "f");
|
|
532
|
-
return compilation;
|
|
533
|
-
}, _Compiler_resetThisCompilation = function _Compiler_resetThisCompilation() {
|
|
534
|
-
// reassign new compilation in thisCompilation
|
|
535
|
-
__classPrivateFieldSet(this, _Compiler_compilation, undefined, "f");
|
|
536
|
-
// ensure thisCompilation must call
|
|
537
|
-
this.hooks.thisCompilation.intercept({
|
|
538
|
-
call: () => { }
|
|
539
|
-
});
|
|
540
|
-
}, _Compiler_newCompilationParams = function _Compiler_newCompilationParams() {
|
|
541
|
-
const normalModuleFactory = new NormalModuleFactory_1.NormalModuleFactory();
|
|
542
|
-
this.hooks.normalModuleFactory.call(normalModuleFactory);
|
|
543
|
-
const contextModuleFactory = new ContextModuleFactory_1.ContextModuleFactory();
|
|
544
|
-
this.hooks.contextModuleFactory.call(contextModuleFactory);
|
|
545
|
-
const params = {
|
|
546
|
-
normalModuleFactory,
|
|
547
|
-
contextModuleFactory
|
|
548
|
-
};
|
|
549
|
-
__classPrivateFieldSet(this, _Compiler_compilationParams, params, "f");
|
|
550
|
-
return params;
|
|
551
|
-
}, _Compiler_getInstance = function _Compiler_getInstance(callback) {
|
|
552
|
-
const error = (0, bindingVersionCheck_1.checkVersion)();
|
|
553
|
-
if (error) {
|
|
554
|
-
return callback(error);
|
|
555
|
-
}
|
|
556
|
-
if (__classPrivateFieldGet(this, _Compiler_instance, "f")) {
|
|
557
|
-
return callback(null, __classPrivateFieldGet(this, _Compiler_instance, "f"));
|
|
558
|
-
}
|
|
559
|
-
const options = this.options;
|
|
560
|
-
const rawOptions = (0, config_1.getRawOptions)(options, this);
|
|
561
|
-
rawOptions.__references = Object.fromEntries(__classPrivateFieldGet(this, _Compiler_ruleSet, "f").builtinReferences.entries());
|
|
562
|
-
const instanceBinding = require("@rspack/binding");
|
|
563
|
-
__classPrivateFieldSet(this, _Compiler_registers, {
|
|
564
|
-
registerCompilerThisCompilationTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerThisCompilation, () => this.hooks.thisCompilation, queried => (native) => {
|
|
565
|
-
if (__classPrivateFieldGet(this, _Compiler_compilation, "f") === undefined) {
|
|
566
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createCompilation).call(this, native);
|
|
567
|
-
}
|
|
568
|
-
queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f"), __classPrivateFieldGet(this, _Compiler_compilationParams, "f"));
|
|
569
|
-
}),
|
|
570
|
-
registerCompilerCompilationTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerCompilation, () => this.hooks.compilation, queried => () => queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f"), __classPrivateFieldGet(this, _Compiler_compilationParams, "f"))),
|
|
571
|
-
registerCompilerMakeTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerMake, () => this.hooks.make, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f"))),
|
|
572
|
-
registerCompilerFinishMakeTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerFinishMake, () => this.hooks.finishMake, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f"))),
|
|
573
|
-
registerCompilerShouldEmitTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerShouldEmit, () => this.hooks.shouldEmit, queried => () => queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f"))),
|
|
574
|
-
registerCompilerEmitTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerEmit, () => this.hooks.emit, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f"))),
|
|
575
|
-
registerCompilerAfterEmitTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerAfterEmit, () => this.hooks.afterEmit, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f"))),
|
|
576
|
-
registerCompilerAssetEmittedTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilerAssetEmitted, () => this.hooks.assetEmitted, queried => async ({ filename, targetPath, outputPath }) => {
|
|
577
|
-
return queried.promise(filename, {
|
|
578
|
-
compilation: __classPrivateFieldGet(this, _Compiler_compilation, "f"),
|
|
579
|
-
targetPath,
|
|
580
|
-
outputPath,
|
|
581
|
-
get source() {
|
|
582
|
-
return this.compilation.getAsset(filename)?.source;
|
|
583
|
-
},
|
|
584
|
-
get content() {
|
|
585
|
-
return this.source?.buffer();
|
|
586
|
-
}
|
|
587
|
-
});
|
|
588
|
-
}),
|
|
589
|
-
registerCompilationAdditionalTreeRuntimeRequirements: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind
|
|
590
|
-
.CompilationAdditionalTreeRuntimeRequirements, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.additionalTreeRuntimeRequirements, queried => ({ chunk, runtimeRequirements }) => {
|
|
591
|
-
const set = (0, RuntimeGlobals_1.__from_binding_runtime_globals)(runtimeRequirements);
|
|
592
|
-
queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), set);
|
|
593
|
-
return {
|
|
594
|
-
runtimeRequirements: (0, RuntimeGlobals_1.__to_binding_runtime_globals)(set)
|
|
595
|
-
};
|
|
596
|
-
}),
|
|
597
|
-
registerCompilationRuntimeRequirementInTree: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookMapRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationRuntimeRequirementInTree, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.runtimeRequirementInTree, queried => ({ chunk: rawChunk, runtimeRequirements }) => {
|
|
598
|
-
const set = (0, RuntimeGlobals_1.__from_binding_runtime_globals)(runtimeRequirements);
|
|
599
|
-
const chunk = Chunk_1.Chunk.__from_binding(rawChunk, __classPrivateFieldGet(this, _Compiler_compilation, "f"));
|
|
600
|
-
for (const r of set) {
|
|
601
|
-
queried.for(r).call(chunk, set);
|
|
602
|
-
}
|
|
603
|
-
return {
|
|
604
|
-
runtimeRequirements: (0, RuntimeGlobals_1.__to_binding_runtime_globals)(set)
|
|
605
|
-
};
|
|
606
|
-
}),
|
|
607
|
-
registerCompilationRuntimeModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationRuntimeModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.runtimeModule, queried => ({ module, chunk }) => {
|
|
608
|
-
const originSource = module.source?.source;
|
|
609
|
-
queried.call(module, Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")));
|
|
610
|
-
const newSource = module.source?.source;
|
|
611
|
-
if (newSource && newSource !== originSource) {
|
|
612
|
-
return module;
|
|
613
|
-
}
|
|
614
|
-
return;
|
|
615
|
-
}),
|
|
616
|
-
registerCompilationBuildModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationBuildModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.buildModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m, __classPrivateFieldGet(this, _Compiler_compilation, "f")))),
|
|
617
|
-
registerCompilationStillValidModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationStillValidModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.stillValidModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m, __classPrivateFieldGet(this, _Compiler_compilation, "f")))),
|
|
618
|
-
registerCompilationSucceedModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationSucceedModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.succeedModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m, __classPrivateFieldGet(this, _Compiler_compilation, "f")))),
|
|
619
|
-
registerCompilationExecuteModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationExecuteModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.executeModule, queried => ({ entry, id, codegenResults, runtimeModules }) => {
|
|
620
|
-
const __webpack_require__ = (id) => {
|
|
621
|
-
const cached = moduleCache[id];
|
|
622
|
-
if (cached !== undefined) {
|
|
623
|
-
if (cached.error)
|
|
624
|
-
throw cached.error;
|
|
625
|
-
return cached.exports;
|
|
626
|
-
}
|
|
627
|
-
const execOptions = {
|
|
628
|
-
id,
|
|
629
|
-
module: {
|
|
630
|
-
id,
|
|
631
|
-
exports: {},
|
|
632
|
-
loaded: false,
|
|
633
|
-
error: undefined
|
|
634
|
-
},
|
|
635
|
-
require: __webpack_require__
|
|
636
|
-
};
|
|
637
|
-
for (const handler of interceptModuleExecution) {
|
|
638
|
-
handler(execOptions);
|
|
639
|
-
}
|
|
640
|
-
const result = codegenResults.map[id]["build time"];
|
|
641
|
-
const moduleObject = execOptions.module;
|
|
642
|
-
if (id)
|
|
643
|
-
moduleCache[id] = moduleObject;
|
|
644
|
-
(0, HookWebpackError_1.tryRunOrWebpackError)(() => queried.call({
|
|
645
|
-
codeGenerationResult: new Module_1.CodeGenerationResult(result),
|
|
646
|
-
moduleObject
|
|
647
|
-
}, { __webpack_require__ }), "Compilation.hooks.executeModule");
|
|
648
|
-
moduleObject.loaded = true;
|
|
649
|
-
return moduleObject.exports;
|
|
650
|
-
};
|
|
651
|
-
const moduleCache = (__webpack_require__[RuntimeGlobals_1.RuntimeGlobals.moduleCache.replace(`${RuntimeGlobals_1.RuntimeGlobals.require}.`, "")] = {});
|
|
652
|
-
const interceptModuleExecution = (__webpack_require__[RuntimeGlobals_1.RuntimeGlobals.interceptModuleExecution.replace(`${RuntimeGlobals_1.RuntimeGlobals.require}.`, "")] = []);
|
|
653
|
-
for (const runtimeModule of runtimeModules) {
|
|
654
|
-
__webpack_require__(runtimeModule);
|
|
655
|
-
}
|
|
656
|
-
const executeResult = __webpack_require__(entry);
|
|
657
|
-
__classPrivateFieldGet(this, _Compiler_moduleExecutionResultsMap, "f").set(id, executeResult);
|
|
658
|
-
}),
|
|
659
|
-
registerCompilationFinishModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationFinishModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.finishModules, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f").modules)),
|
|
660
|
-
registerCompilationOptimizeModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationOptimizeModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.optimizeModules, queried => () => queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f").modules.values())),
|
|
661
|
-
registerCompilationAfterOptimizeModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterOptimizeModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.afterOptimizeModules, queried => () => {
|
|
662
|
-
queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f").modules.values());
|
|
663
|
-
}),
|
|
664
|
-
registerCompilationOptimizeTreeTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationOptimizeTree, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.optimizeTree, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f").chunks, __classPrivateFieldGet(this, _Compiler_compilation, "f").modules)),
|
|
665
|
-
registerCompilationOptimizeChunkModulesTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationOptimizeChunkModules, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.optimizeChunkModules, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f").chunks, __classPrivateFieldGet(this, _Compiler_compilation, "f").modules)),
|
|
666
|
-
registerCompilationChunkHashTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationChunkHash, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.chunkHash, queried => (chunk) => {
|
|
667
|
-
if (!this.options.output.hashFunction) {
|
|
668
|
-
throw new Error("'output.hashFunction' cannot be undefined");
|
|
669
|
-
}
|
|
670
|
-
const hash = (0, createHash_1.createHash)(this.options.output.hashFunction);
|
|
671
|
-
queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), hash);
|
|
672
|
-
const digestResult = hash.digest(this.options.output.hashDigest);
|
|
673
|
-
return Buffer.from(digestResult);
|
|
674
|
-
}),
|
|
675
|
-
registerCompilationChunkAssetTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationChunkAsset, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.chunkAsset, queried => ({ chunk, filename }) => queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), filename)),
|
|
676
|
-
registerCompilationProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationProcessAssets, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.processAssets, queried => async () => await queried.promise(__classPrivateFieldGet(this, _Compiler_compilation, "f").assets)),
|
|
677
|
-
registerCompilationAfterProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterProcessAssets, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.afterProcessAssets, queried => () => queried.call(__classPrivateFieldGet(this, _Compiler_compilation, "f").assets)),
|
|
678
|
-
registerCompilationSealTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationSeal, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.seal, queried => () => queried.call()),
|
|
679
|
-
registerCompilationAfterSealTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterSeal, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.afterSeal, queried => async () => await queried.promise()),
|
|
680
|
-
registerNormalModuleFactoryBeforeResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.NormalModuleFactoryBeforeResolve, () => __classPrivateFieldGet(this, _Compiler_compilationParams, "f").normalModuleFactory.hooks.beforeResolve, queried => async (resolveData) => {
|
|
681
|
-
const normalizedResolveData = {
|
|
682
|
-
contextInfo: {
|
|
683
|
-
issuer: resolveData.issuer
|
|
684
|
-
},
|
|
685
|
-
request: resolveData.request,
|
|
686
|
-
context: resolveData.context,
|
|
687
|
-
fileDependencies: [],
|
|
688
|
-
missingDependencies: [],
|
|
689
|
-
contextDependencies: []
|
|
690
|
-
};
|
|
691
|
-
const ret = await queried.promise(normalizedResolveData);
|
|
692
|
-
resolveData.request = normalizedResolveData.request;
|
|
693
|
-
resolveData.context = normalizedResolveData.context;
|
|
694
|
-
return [ret, resolveData];
|
|
695
|
-
}),
|
|
696
|
-
registerNormalModuleFactoryFactorizeTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.NormalModuleFactoryFactorize, () => __classPrivateFieldGet(this, _Compiler_compilationParams, "f").normalModuleFactory.hooks.factorize, queried => async (resolveData) => {
|
|
697
|
-
const normalizedResolveData = {
|
|
698
|
-
contextInfo: {
|
|
699
|
-
issuer: resolveData.issuer
|
|
700
|
-
},
|
|
701
|
-
request: resolveData.request,
|
|
702
|
-
context: resolveData.context,
|
|
703
|
-
fileDependencies: [],
|
|
704
|
-
missingDependencies: [],
|
|
705
|
-
contextDependencies: []
|
|
706
|
-
};
|
|
707
|
-
await queried.promise(normalizedResolveData);
|
|
708
|
-
resolveData.request = normalizedResolveData.request;
|
|
709
|
-
resolveData.context = normalizedResolveData.context;
|
|
710
|
-
return resolveData;
|
|
711
|
-
}),
|
|
712
|
-
registerNormalModuleFactoryResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.NormalModuleFactoryResolve, () => __classPrivateFieldGet(this, _Compiler_compilationParams, "f").normalModuleFactory.hooks.resolve, queried => async (resolveData) => {
|
|
713
|
-
const normalizedResolveData = {
|
|
714
|
-
contextInfo: {
|
|
715
|
-
issuer: resolveData.issuer
|
|
716
|
-
},
|
|
717
|
-
request: resolveData.request,
|
|
718
|
-
context: resolveData.context,
|
|
719
|
-
fileDependencies: [],
|
|
720
|
-
missingDependencies: [],
|
|
721
|
-
contextDependencies: []
|
|
722
|
-
};
|
|
723
|
-
await queried.promise(normalizedResolveData);
|
|
724
|
-
resolveData.request = normalizedResolveData.request;
|
|
725
|
-
resolveData.context = normalizedResolveData.context;
|
|
726
|
-
return resolveData;
|
|
727
|
-
}),
|
|
728
|
-
registerNormalModuleFactoryResolveForSchemeTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookMapRegisterTaps).call(this, binding.RegisterJsTapKind.NormalModuleFactoryResolveForScheme, () => __classPrivateFieldGet(this, _Compiler_compilationParams, "f").normalModuleFactory.hooks.resolveForScheme, queried => async (args) => {
|
|
729
|
-
const ret = await queried
|
|
730
|
-
.for(args.scheme)
|
|
731
|
-
.promise(args.resourceData);
|
|
732
|
-
return [ret, args.resourceData];
|
|
733
|
-
}),
|
|
734
|
-
registerNormalModuleFactoryAfterResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.NormalModuleFactoryAfterResolve, () => __classPrivateFieldGet(this, _Compiler_compilationParams, "f").normalModuleFactory.hooks.afterResolve, queried => async (arg) => {
|
|
735
|
-
const data = {
|
|
736
|
-
contextInfo: {
|
|
737
|
-
issuer: arg.issuer
|
|
738
|
-
},
|
|
739
|
-
request: arg.request,
|
|
740
|
-
context: arg.context,
|
|
741
|
-
fileDependencies: arg.fileDependencies,
|
|
742
|
-
missingDependencies: arg.missingDependencies,
|
|
743
|
-
contextDependencies: arg.contextDependencies,
|
|
744
|
-
createData: arg.createData
|
|
745
|
-
};
|
|
746
|
-
const ret = await queried.promise(data);
|
|
747
|
-
return [ret, data.createData];
|
|
748
|
-
}),
|
|
749
|
-
registerNormalModuleFactoryCreateModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.NormalModuleFactoryCreateModule, () => __classPrivateFieldGet(this, _Compiler_compilationParams, "f").normalModuleFactory.hooks.createModule, queried => async (args) => {
|
|
750
|
-
const data = {
|
|
751
|
-
...args,
|
|
752
|
-
settings: {}
|
|
753
|
-
};
|
|
754
|
-
await queried.promise(data, {});
|
|
755
|
-
}),
|
|
756
|
-
registerContextModuleFactoryBeforeResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.ContextModuleFactoryBeforeResolve, () => __classPrivateFieldGet(this, _Compiler_compilationParams, "f").contextModuleFactory.hooks.beforeResolve, queried => async (bindingData) => {
|
|
757
|
-
return queried.promise(bindingData);
|
|
758
|
-
}),
|
|
759
|
-
registerContextModuleFactoryAfterResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.ContextModuleFactoryAfterResolve, () => __classPrivateFieldGet(this, _Compiler_compilationParams, "f").contextModuleFactory.hooks.afterResolve, queried => async (bindingData) => {
|
|
760
|
-
const data = bindingData
|
|
761
|
-
? Module_1.ContextModuleFactoryAfterResolveData.__from_binding(bindingData)
|
|
762
|
-
: false;
|
|
763
|
-
const ret = await queried.promise(data);
|
|
764
|
-
const result = ret
|
|
765
|
-
? Module_1.ContextModuleFactoryAfterResolveData.__to_binding(ret)
|
|
766
|
-
: false;
|
|
767
|
-
return result;
|
|
768
|
-
}),
|
|
769
|
-
registerJavascriptModulesChunkHashTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.JavascriptModulesChunkHash, () => builtin_plugin_1.JavascriptModulesPlugin.getCompilationHooks(__classPrivateFieldGet(this, _Compiler_compilation, "f"))
|
|
770
|
-
.chunkHash, queried => (chunk) => {
|
|
771
|
-
if (!this.options.output.hashFunction) {
|
|
772
|
-
throw new Error("'output.hashFunction' cannot be undefined");
|
|
773
|
-
}
|
|
774
|
-
const hash = (0, createHash_1.createHash)(this.options.output.hashFunction);
|
|
775
|
-
queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), hash);
|
|
776
|
-
const digestResult = hash.digest(this.options.output.hashDigest);
|
|
777
|
-
return Buffer.from(digestResult);
|
|
778
|
-
}),
|
|
779
|
-
registerHtmlPluginBeforeAssetTagGenerationTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.HtmlPluginBeforeAssetTagGeneration, () => builtin_plugin_1.HtmlRspackPlugin.getCompilationHooks(__classPrivateFieldGet(this, _Compiler_compilation, "f"))
|
|
780
|
-
.beforeAssetTagGeneration, queried => async (data) => {
|
|
781
|
-
return await queried.promise({
|
|
782
|
-
...data,
|
|
783
|
-
plugin: {
|
|
784
|
-
options: builtin_plugin_1.HtmlRspackPlugin.getCompilationOptions(__classPrivateFieldGet(this, _Compiler_compilation, "f")) ||
|
|
785
|
-
{}
|
|
786
|
-
}
|
|
787
|
-
});
|
|
788
|
-
}),
|
|
789
|
-
registerHtmlPluginAlterAssetTagsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.HtmlPluginAlterAssetTags, () => builtin_plugin_1.HtmlRspackPlugin.getCompilationHooks(__classPrivateFieldGet(this, _Compiler_compilation, "f"))
|
|
790
|
-
.alterAssetTags, queried => async (data) => {
|
|
791
|
-
return await queried.promise(data);
|
|
792
|
-
}),
|
|
793
|
-
registerHtmlPluginAlterAssetTagGroupsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.HtmlPluginAlterAssetTagGroups, () => builtin_plugin_1.HtmlRspackPlugin.getCompilationHooks(__classPrivateFieldGet(this, _Compiler_compilation, "f"))
|
|
794
|
-
.alterAssetTagGroups, queried => async (data) => {
|
|
795
|
-
return await queried.promise({
|
|
796
|
-
...data,
|
|
797
|
-
plugin: {
|
|
798
|
-
options: builtin_plugin_1.HtmlRspackPlugin.getCompilationOptions(__classPrivateFieldGet(this, _Compiler_compilation, "f")) || {}
|
|
799
|
-
}
|
|
800
|
-
});
|
|
801
|
-
}),
|
|
802
|
-
registerHtmlPluginAfterTemplateExecutionTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.HtmlPluginAfterTemplateExecution, () => builtin_plugin_1.HtmlRspackPlugin.getCompilationHooks(__classPrivateFieldGet(this, _Compiler_compilation, "f"))
|
|
803
|
-
.afterTemplateExecution, queried => async (data) => {
|
|
804
|
-
return await queried.promise({
|
|
805
|
-
...data,
|
|
806
|
-
plugin: {
|
|
807
|
-
options: builtin_plugin_1.HtmlRspackPlugin.getCompilationOptions(__classPrivateFieldGet(this, _Compiler_compilation, "f")) ||
|
|
808
|
-
{}
|
|
809
|
-
}
|
|
810
|
-
});
|
|
811
|
-
}),
|
|
812
|
-
registerHtmlPluginBeforeEmitTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.HtmlPluginBeforeEmit, () => builtin_plugin_1.HtmlRspackPlugin.getCompilationHooks(__classPrivateFieldGet(this, _Compiler_compilation, "f")).beforeEmit, queried => async (data) => {
|
|
813
|
-
return await queried.promise({
|
|
814
|
-
...data,
|
|
815
|
-
plugin: {
|
|
816
|
-
options: builtin_plugin_1.HtmlRspackPlugin.getCompilationOptions(__classPrivateFieldGet(this, _Compiler_compilation, "f")) || {}
|
|
817
|
-
}
|
|
818
|
-
});
|
|
819
|
-
}),
|
|
820
|
-
registerHtmlPluginAfterEmitTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.HtmlPluginAfterEmit, () => builtin_plugin_1.HtmlRspackPlugin.getCompilationHooks(__classPrivateFieldGet(this, _Compiler_compilation, "f")).afterEmit, queried => async (data) => {
|
|
821
|
-
return await queried.promise({
|
|
822
|
-
...data,
|
|
823
|
-
plugin: {
|
|
824
|
-
options: builtin_plugin_1.HtmlRspackPlugin.getCompilationOptions(__classPrivateFieldGet(this, _Compiler_compilation, "f")) || {}
|
|
825
|
-
}
|
|
826
|
-
});
|
|
827
|
-
})
|
|
828
|
-
}, "f");
|
|
829
|
-
__classPrivateFieldSet(this, _Compiler_instance, new instanceBinding.Rspack(rawOptions, __classPrivateFieldGet(this, _Compiler_builtinPlugins, "f"), __classPrivateFieldGet(this, _Compiler_registers, "f"), FileSystem_1.ThreadsafeWritableNodeFS.__to_binding(this.outputFileSystem), ResolverFactory_1.ResolverFactory.__to_binding(this.resolverFactory)), "f");
|
|
830
|
-
callback(null, __classPrivateFieldGet(this, _Compiler_instance, "f"));
|
|
831
|
-
}, _Compiler_updateNonSkippableRegisters = function _Compiler_updateNonSkippableRegisters() {
|
|
832
|
-
const kinds = [];
|
|
833
|
-
for (const { getHook, getHookMap, registerKind } of Object.values(__classPrivateFieldGet(this, _Compiler_registers, "f"))) {
|
|
834
|
-
const get = getHook ?? getHookMap;
|
|
835
|
-
const hookOrMap = get();
|
|
836
|
-
if (hookOrMap.isUsed()) {
|
|
837
|
-
kinds.push(registerKind);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
if (__classPrivateFieldGet(this, _Compiler_nonSkippableRegisters, "f").join() !== kinds.join()) {
|
|
841
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (_error, instance) => {
|
|
842
|
-
instance.setNonSkippableRegisters(kinds);
|
|
843
|
-
__classPrivateFieldSet(this, _Compiler_nonSkippableRegisters, kinds, "f");
|
|
844
|
-
});
|
|
845
|
-
}
|
|
846
|
-
}, _Compiler_decorateJsTaps = function _Compiler_decorateJsTaps(jsTaps) {
|
|
847
|
-
if (jsTaps.length > 0) {
|
|
848
|
-
const last = jsTaps[jsTaps.length - 1];
|
|
849
|
-
const old = last.function;
|
|
850
|
-
last.function = (...args) => {
|
|
851
|
-
const result = old(...args);
|
|
852
|
-
if (result && typeof result.then === "function") {
|
|
853
|
-
return result.then((r) => {
|
|
854
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateNonSkippableRegisters).call(this);
|
|
855
|
-
return r;
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateNonSkippableRegisters).call(this);
|
|
859
|
-
return result;
|
|
860
|
-
};
|
|
861
|
-
}
|
|
862
|
-
}, _Compiler_createHookRegisterTaps = function _Compiler_createHookRegisterTaps(registerKind, getHook, createTap) {
|
|
863
|
-
const getTaps = (stages) => {
|
|
864
|
-
const hook = getHook();
|
|
865
|
-
if (!hook.isUsed())
|
|
866
|
-
return [];
|
|
867
|
-
const breakpoints = [
|
|
868
|
-
liteTapable.minStage,
|
|
869
|
-
...stages,
|
|
870
|
-
liteTapable.maxStage
|
|
871
|
-
];
|
|
872
|
-
const jsTaps = [];
|
|
873
|
-
for (let i = 0; i < breakpoints.length - 1; i++) {
|
|
874
|
-
const from = breakpoints[i];
|
|
875
|
-
const to = breakpoints[i + 1];
|
|
876
|
-
const stageRange = [from, to];
|
|
877
|
-
const queried = hook.queryStageRange(stageRange);
|
|
878
|
-
if (!queried.isUsed())
|
|
879
|
-
continue;
|
|
880
|
-
jsTaps.push({
|
|
881
|
-
function: createTap(queried),
|
|
882
|
-
stage: liteTapable.safeStage(from + 1)
|
|
883
|
-
});
|
|
884
|
-
}
|
|
885
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_decorateJsTaps).call(this, jsTaps);
|
|
886
|
-
return jsTaps;
|
|
887
|
-
};
|
|
888
|
-
getTaps.registerKind = registerKind;
|
|
889
|
-
getTaps.getHook = getHook;
|
|
890
|
-
return getTaps;
|
|
891
|
-
}, _Compiler_createHookMapRegisterTaps = function _Compiler_createHookMapRegisterTaps(registerKind, getHookMap, createTap) {
|
|
892
|
-
const getTaps = (stages) => {
|
|
893
|
-
const map = getHookMap();
|
|
894
|
-
if (!map.isUsed())
|
|
895
|
-
return [];
|
|
896
|
-
const breakpoints = [
|
|
897
|
-
liteTapable.minStage,
|
|
898
|
-
...stages,
|
|
899
|
-
liteTapable.maxStage
|
|
900
|
-
];
|
|
901
|
-
const jsTaps = [];
|
|
902
|
-
for (let i = 0; i < breakpoints.length - 1; i++) {
|
|
903
|
-
const from = breakpoints[i];
|
|
904
|
-
const to = breakpoints[i + 1];
|
|
905
|
-
const stageRange = [from, to];
|
|
906
|
-
const queried = map.queryStageRange(stageRange);
|
|
907
|
-
if (!queried.isUsed())
|
|
908
|
-
continue;
|
|
909
|
-
jsTaps.push({
|
|
910
|
-
function: createTap(queried),
|
|
911
|
-
stage: liteTapable.safeStage(from + 1)
|
|
912
|
-
});
|
|
913
|
-
}
|
|
914
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_decorateJsTaps).call(this, jsTaps);
|
|
915
|
-
return jsTaps;
|
|
916
|
-
};
|
|
917
|
-
getTaps.registerKind = registerKind;
|
|
918
|
-
getTaps.getHookMap = getHookMap;
|
|
919
|
-
return getTaps;
|
|
920
|
-
};
|