@rspack/core 1.0.10 → 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/builtin-plugin/css-extract/utils.d.ts +1 -0
- package/dist/config/types.d.ts +309 -0
- package/dist/config/zod.d.ts +22 -534
- 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 -925
- package/dist/ContextModuleFactory.js +0 -36
- package/dist/DependenciesBlock.js +0 -30
- package/dist/Dependency.js +0 -43
- 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 -226
- 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 -1030
- 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/Compilation.js
DELETED
|
@@ -1,854 +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 _Compilation_instances, _Compilation_inner, _Compilation_customModules, _Compilation_createCachedAssets, _Compilation_rebuildModuleCaller, _Entries_data;
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.Entries = exports.Compilation = void 0;
|
|
42
|
-
const binding_1 = require("@rspack/binding");
|
|
43
|
-
const liteTapable = __importStar(require("@rspack/lite-tapable"));
|
|
44
|
-
const Chunk_1 = require("./Chunk");
|
|
45
|
-
const ChunkGraph_1 = require("./ChunkGraph");
|
|
46
|
-
const ChunkGroup_1 = require("./ChunkGroup");
|
|
47
|
-
const Entrypoint_1 = require("./Entrypoint");
|
|
48
|
-
const ErrorHelpers_1 = require("./ErrorHelpers");
|
|
49
|
-
const Module_1 = require("./Module");
|
|
50
|
-
const RspackError_1 = require("./RspackError");
|
|
51
|
-
const RuntimeModule_1 = require("./RuntimeModule");
|
|
52
|
-
const Stats_1 = require("./Stats");
|
|
53
|
-
const Logger_1 = require("./logging/Logger");
|
|
54
|
-
const StatsFactory_1 = require("./stats/StatsFactory");
|
|
55
|
-
const StatsPrinter_1 = require("./stats/StatsPrinter");
|
|
56
|
-
const AssetInfo_1 = require("./util/AssetInfo");
|
|
57
|
-
const MergeCaller_1 = __importDefault(require("./util/MergeCaller"));
|
|
58
|
-
const createReadonlyMap_1 = require("./util/createReadonlyMap");
|
|
59
|
-
const fake_1 = require("./util/fake");
|
|
60
|
-
const memoize_1 = require("./util/memoize");
|
|
61
|
-
const source_1 = require("./util/source");
|
|
62
|
-
class Compilation {
|
|
63
|
-
constructor(compiler, inner) {
|
|
64
|
-
_Compilation_instances.add(this);
|
|
65
|
-
_Compilation_inner.set(this, void 0);
|
|
66
|
-
this.fileSystemInfo = {
|
|
67
|
-
createSnapshot() {
|
|
68
|
-
// fake implement to support html-webpack-plugin
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Records the dynamically added fields for Module on the JavaScript side, using the Module identifier for association.
|
|
74
|
-
* These fields are generally used within a plugin, so they do not need to be passed back to the Rust side.
|
|
75
|
-
*/
|
|
76
|
-
_Compilation_customModules.set(this, void 0);
|
|
77
|
-
this.fileDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").dependencies().fileDependencies, d => __classPrivateFieldGet(this, _Compilation_inner, "f").addFileDependencies(d));
|
|
78
|
-
this.contextDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").dependencies().contextDependencies, d => __classPrivateFieldGet(this, _Compilation_inner, "f").addContextDependencies(d));
|
|
79
|
-
this.missingDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").dependencies().missingDependencies, d => __classPrivateFieldGet(this, _Compilation_inner, "f").addMissingDependencies(d));
|
|
80
|
-
this.buildDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").dependencies().buildDependencies, d => __classPrivateFieldGet(this, _Compilation_inner, "f").addBuildDependencies(d));
|
|
81
|
-
_Compilation_rebuildModuleCaller.set(this, ((compilation) => new MergeCaller_1.default((args) => {
|
|
82
|
-
__classPrivateFieldGet(compilation, _Compilation_inner, "f").rebuildModule(args.map(item => item[0]), (err, modules) => {
|
|
83
|
-
for (const [id, callback] of args) {
|
|
84
|
-
const m = modules.find(item => item.moduleIdentifier === id);
|
|
85
|
-
if (m) {
|
|
86
|
-
callback(err, Module_1.Module.__from_binding(m, compilation));
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
callback(err || new Error("module no found"), null);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}, 10))(this));
|
|
94
|
-
__classPrivateFieldSet(this, _Compilation_inner, inner, "f");
|
|
95
|
-
__classPrivateFieldSet(this, _Compilation_customModules, {}, "f");
|
|
96
|
-
const processAssetsHook = new liteTapable.AsyncSeriesHook([
|
|
97
|
-
"assets"
|
|
98
|
-
]);
|
|
99
|
-
const createProcessAssetsHook = (name, stage, getArgs, code) => {
|
|
100
|
-
const errorMessage = (reason) => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
|
|
101
|
-
BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
|
|
102
|
-
const getOptions = (options) => {
|
|
103
|
-
const isString = typeof options === "string";
|
|
104
|
-
if (!isString && options.stage) {
|
|
105
|
-
throw new Error(errorMessage("it's using the 'stage' option"));
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
...(isString ? { name: options } : options),
|
|
109
|
-
stage: stage
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
return Object.freeze({
|
|
113
|
-
name,
|
|
114
|
-
intercept() {
|
|
115
|
-
throw new Error(errorMessage("it's using 'intercept'"));
|
|
116
|
-
},
|
|
117
|
-
tap: (options, fn) => {
|
|
118
|
-
processAssetsHook.tap(getOptions(options), () => fn(...getArgs()));
|
|
119
|
-
},
|
|
120
|
-
tapAsync: (options, fn) => {
|
|
121
|
-
processAssetsHook.tapAsync(getOptions(options), (assets, callback) => fn(...getArgs(), callback));
|
|
122
|
-
},
|
|
123
|
-
tapPromise: (options, fn) => {
|
|
124
|
-
processAssetsHook.tapPromise(getOptions(options), () => fn(...getArgs()));
|
|
125
|
-
},
|
|
126
|
-
_fakeHook: true
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
this.hooks = {
|
|
130
|
-
processAssets: processAssetsHook,
|
|
131
|
-
afterProcessAssets: new liteTapable.SyncHook(["assets"]),
|
|
132
|
-
/** @deprecated */
|
|
133
|
-
additionalAssets: createProcessAssetsHook("additionalAssets", Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, () => []),
|
|
134
|
-
childCompiler: new liteTapable.SyncHook([
|
|
135
|
-
"childCompiler",
|
|
136
|
-
"compilerName",
|
|
137
|
-
"compilerIndex"
|
|
138
|
-
]),
|
|
139
|
-
log: new liteTapable.SyncBailHook(["origin", "logEntry"]),
|
|
140
|
-
optimizeModules: new liteTapable.SyncBailHook(["modules"]),
|
|
141
|
-
afterOptimizeModules: new liteTapable.SyncBailHook(["modules"]),
|
|
142
|
-
optimizeTree: new liteTapable.AsyncSeriesHook(["chunks", "modules"]),
|
|
143
|
-
optimizeChunkModules: new liteTapable.AsyncSeriesBailHook([
|
|
144
|
-
"chunks",
|
|
145
|
-
"modules"
|
|
146
|
-
]),
|
|
147
|
-
finishModules: new liteTapable.AsyncSeriesHook(["modules"]),
|
|
148
|
-
chunkHash: new liteTapable.SyncHook(["chunk", "hash"]),
|
|
149
|
-
chunkAsset: new liteTapable.SyncHook(["chunk", "filename"]),
|
|
150
|
-
processWarnings: new liteTapable.SyncWaterfallHook(["warnings"]),
|
|
151
|
-
succeedModule: new liteTapable.SyncHook(["module"]),
|
|
152
|
-
stillValidModule: new liteTapable.SyncHook(["module"]),
|
|
153
|
-
statsPreset: new liteTapable.HookMap(() => new liteTapable.SyncHook(["options", "context"])),
|
|
154
|
-
statsNormalize: new liteTapable.SyncHook(["options", "context"]),
|
|
155
|
-
statsFactory: new liteTapable.SyncHook(["statsFactory", "options"]),
|
|
156
|
-
statsPrinter: new liteTapable.SyncHook(["statsPrinter", "options"]),
|
|
157
|
-
buildModule: new liteTapable.SyncHook(["module"]),
|
|
158
|
-
executeModule: new liteTapable.SyncHook(["options", "context"]),
|
|
159
|
-
additionalTreeRuntimeRequirements: new liteTapable.SyncHook([
|
|
160
|
-
"chunk",
|
|
161
|
-
"runtimeRequirements"
|
|
162
|
-
]),
|
|
163
|
-
runtimeRequirementInTree: new liteTapable.HookMap(() => new liteTapable.SyncBailHook(["chunk", "runtimeRequirements"])),
|
|
164
|
-
runtimeModule: new liteTapable.SyncHook(["module", "chunk"]),
|
|
165
|
-
seal: new liteTapable.SyncHook([]),
|
|
166
|
-
afterSeal: new liteTapable.AsyncSeriesHook([])
|
|
167
|
-
};
|
|
168
|
-
this.compiler = compiler;
|
|
169
|
-
this.resolverFactory = compiler.resolverFactory;
|
|
170
|
-
this.inputFileSystem = compiler.inputFileSystem;
|
|
171
|
-
this.options = compiler.options;
|
|
172
|
-
this.outputOptions = compiler.options.output;
|
|
173
|
-
this.logging = new Map();
|
|
174
|
-
this.childrenCounters = {};
|
|
175
|
-
this.children = [];
|
|
176
|
-
this.chunkGraph = new ChunkGraph_1.ChunkGraph(this);
|
|
177
|
-
}
|
|
178
|
-
get hash() {
|
|
179
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").hash;
|
|
180
|
-
}
|
|
181
|
-
get fullHash() {
|
|
182
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").hash;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Get a map of all assets.
|
|
186
|
-
*/
|
|
187
|
-
get assets() {
|
|
188
|
-
return (0, memoize_1.memoizeValue)(() => __classPrivateFieldGet(this, _Compilation_instances, "m", _Compilation_createCachedAssets).call(this));
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Get a map of all entrypoints.
|
|
192
|
-
*/
|
|
193
|
-
get entrypoints() {
|
|
194
|
-
return (0, memoize_1.memoizeValue)(() => new Map(Object.entries(__classPrivateFieldGet(this, _Compilation_inner, "f").entrypoints).map(([n, e]) => [
|
|
195
|
-
n,
|
|
196
|
-
Entrypoint_1.Entrypoint.__from_binding(e, __classPrivateFieldGet(this, _Compilation_inner, "f"))
|
|
197
|
-
])));
|
|
198
|
-
}
|
|
199
|
-
get chunkGroups() {
|
|
200
|
-
return (0, memoize_1.memoizeValue)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").chunkGroups.map(cg => ChunkGroup_1.ChunkGroup.__from_binding(cg, __classPrivateFieldGet(this, _Compilation_inner, "f"))));
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Get the named chunk groups.
|
|
204
|
-
*
|
|
205
|
-
* Note: This is a proxy for webpack internal API, only method `get`, `keys`, `values` and `entries` are supported now.
|
|
206
|
-
*/
|
|
207
|
-
get namedChunkGroups() {
|
|
208
|
-
return (0, createReadonlyMap_1.createReadonlyMap)({
|
|
209
|
-
keys: () => {
|
|
210
|
-
const names = __classPrivateFieldGet(this, _Compilation_inner, "f").getNamedChunkGroupKeys();
|
|
211
|
-
return names[Symbol.iterator]();
|
|
212
|
-
},
|
|
213
|
-
get: (property) => {
|
|
214
|
-
if (typeof property === "string") {
|
|
215
|
-
const chunk = __classPrivateFieldGet(this, _Compilation_inner, "f").getNamedChunkGroup(property) || undefined;
|
|
216
|
-
return chunk && ChunkGroup_1.ChunkGroup.__from_binding(chunk, __classPrivateFieldGet(this, _Compilation_inner, "f"));
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
get modules() {
|
|
222
|
-
return new Set(__classPrivateFieldGet(this, _Compilation_inner, "f").modules.map(module => Module_1.Module.__from_binding(module, this)));
|
|
223
|
-
}
|
|
224
|
-
get builtModules() {
|
|
225
|
-
return new Set(__classPrivateFieldGet(this, _Compilation_inner, "f").builtModules.map(module => Module_1.Module.__from_binding(module, this)));
|
|
226
|
-
}
|
|
227
|
-
get chunks() {
|
|
228
|
-
return (0, memoize_1.memoizeValue)(() => new Set(this.__internal__getChunks()));
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Get the named chunks.
|
|
232
|
-
*
|
|
233
|
-
* Note: This is a proxy for webpack internal API, only method `get`, `keys`, `values` and `entries` are supported now.
|
|
234
|
-
*/
|
|
235
|
-
get namedChunks() {
|
|
236
|
-
return (0, createReadonlyMap_1.createReadonlyMap)({
|
|
237
|
-
keys: () => {
|
|
238
|
-
const names = __classPrivateFieldGet(this, _Compilation_inner, "f").getNamedChunkKeys();
|
|
239
|
-
return names[Symbol.iterator]();
|
|
240
|
-
},
|
|
241
|
-
get: (property) => {
|
|
242
|
-
if (typeof property === "string") {
|
|
243
|
-
const chunk = __classPrivateFieldGet(this, _Compilation_inner, "f").getNamedChunk(property) || undefined;
|
|
244
|
-
return chunk && Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compilation_inner, "f"));
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
get entries() {
|
|
250
|
-
return new Entries(__classPrivateFieldGet(this, _Compilation_inner, "f").entries);
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
254
|
-
*
|
|
255
|
-
* @internal
|
|
256
|
-
*/
|
|
257
|
-
__internal__getCustomModule(moduleIdentifier) {
|
|
258
|
-
let module = __classPrivateFieldGet(this, _Compilation_customModules, "f")[moduleIdentifier];
|
|
259
|
-
if (!module) {
|
|
260
|
-
module = __classPrivateFieldGet(this, _Compilation_customModules, "f")[moduleIdentifier] = {
|
|
261
|
-
buildInfo: {},
|
|
262
|
-
buildMeta: {}
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
return module;
|
|
266
|
-
}
|
|
267
|
-
getCache(name) {
|
|
268
|
-
return this.compiler.getCache(name);
|
|
269
|
-
}
|
|
270
|
-
createStatsOptions(statsValue, context = {}) {
|
|
271
|
-
let optionsOrPreset = statsValue;
|
|
272
|
-
if (typeof optionsOrPreset === "boolean" ||
|
|
273
|
-
typeof optionsOrPreset === "string") {
|
|
274
|
-
optionsOrPreset = { preset: optionsOrPreset };
|
|
275
|
-
}
|
|
276
|
-
if (typeof optionsOrPreset === "object" && optionsOrPreset !== null) {
|
|
277
|
-
// We use this method of shallow cloning this object to include
|
|
278
|
-
// properties in the prototype chain
|
|
279
|
-
const options = {};
|
|
280
|
-
for (const key in optionsOrPreset) {
|
|
281
|
-
options[key] =
|
|
282
|
-
optionsOrPreset[key];
|
|
283
|
-
}
|
|
284
|
-
if (options.preset !== undefined) {
|
|
285
|
-
this.hooks.statsPreset.for(options.preset).call(options, context);
|
|
286
|
-
}
|
|
287
|
-
this.hooks.statsNormalize.call(options, context);
|
|
288
|
-
return options;
|
|
289
|
-
}
|
|
290
|
-
const options = {};
|
|
291
|
-
this.hooks.statsNormalize.call(options, context);
|
|
292
|
-
return options;
|
|
293
|
-
}
|
|
294
|
-
createStatsFactory(options) {
|
|
295
|
-
const statsFactory = new StatsFactory_1.StatsFactory();
|
|
296
|
-
this.hooks.statsFactory.call(statsFactory, options);
|
|
297
|
-
return statsFactory;
|
|
298
|
-
}
|
|
299
|
-
createStatsPrinter(options) {
|
|
300
|
-
const statsPrinter = new StatsPrinter_1.StatsPrinter();
|
|
301
|
-
this.hooks.statsPrinter.call(statsPrinter, options);
|
|
302
|
-
return statsPrinter;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Update an existing asset. Trying to update an asset that doesn't exist will throw an error.
|
|
306
|
-
*/
|
|
307
|
-
updateAsset(filename, newSourceOrFunction, assetInfoUpdateOrFunction) {
|
|
308
|
-
let compatNewSourceOrFunction;
|
|
309
|
-
if (typeof newSourceOrFunction === "function") {
|
|
310
|
-
compatNewSourceOrFunction = function newSourceFunction(source) {
|
|
311
|
-
return source_1.JsSource.__to_binding(newSourceOrFunction(source_1.JsSource.__from_binding(source)));
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
else {
|
|
315
|
-
compatNewSourceOrFunction = source_1.JsSource.__to_binding(newSourceOrFunction);
|
|
316
|
-
}
|
|
317
|
-
__classPrivateFieldGet(this, _Compilation_inner, "f").updateAsset(filename, compatNewSourceOrFunction, assetInfoUpdateOrFunction === undefined
|
|
318
|
-
? assetInfoUpdateOrFunction
|
|
319
|
-
: typeof assetInfoUpdateOrFunction === "function"
|
|
320
|
-
? jsAssetInfo => AssetInfo_1.JsAssetInfo.__to_binding(assetInfoUpdateOrFunction(jsAssetInfo))
|
|
321
|
-
: AssetInfo_1.JsAssetInfo.__to_binding(assetInfoUpdateOrFunction));
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Emit an not existing asset. Trying to emit an asset that already exists will throw an error.
|
|
325
|
-
*
|
|
326
|
-
* @param file - file name
|
|
327
|
-
* @param source - asset source
|
|
328
|
-
* @param assetInfo - extra asset information
|
|
329
|
-
*/
|
|
330
|
-
emitAsset(filename, source, assetInfo) {
|
|
331
|
-
__classPrivateFieldGet(this, _Compilation_inner, "f").emitAsset(filename, source_1.JsSource.__to_binding(source), AssetInfo_1.JsAssetInfo.__to_binding(assetInfo));
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
335
|
-
*
|
|
336
|
-
* @internal
|
|
337
|
-
*/
|
|
338
|
-
__internal__emit_asset_from_loader(filename, source, assetInfo, module) {
|
|
339
|
-
__classPrivateFieldGet(this, _Compilation_inner, "f").emitAssetFromLoader(filename, source_1.JsSource.__to_binding(source), AssetInfo_1.JsAssetInfo.__to_binding(assetInfo), module);
|
|
340
|
-
}
|
|
341
|
-
deleteAsset(filename) {
|
|
342
|
-
__classPrivateFieldGet(this, _Compilation_inner, "f").deleteAsset(filename);
|
|
343
|
-
}
|
|
344
|
-
renameAsset(filename, newFilename) {
|
|
345
|
-
__classPrivateFieldGet(this, _Compilation_inner, "f").renameAsset(filename, newFilename);
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Get an array of Asset
|
|
349
|
-
*/
|
|
350
|
-
getAssets() {
|
|
351
|
-
const assets = __classPrivateFieldGet(this, _Compilation_inner, "f").getAssets();
|
|
352
|
-
return assets.map(asset => {
|
|
353
|
-
return Object.defineProperties(asset, {
|
|
354
|
-
info: {
|
|
355
|
-
value: AssetInfo_1.JsAssetInfo.__from_binding(asset.info)
|
|
356
|
-
},
|
|
357
|
-
source: {
|
|
358
|
-
get: () => this.__internal__getAssetSource(asset.name)
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
getAsset(name) {
|
|
364
|
-
const asset = __classPrivateFieldGet(this, _Compilation_inner, "f").getAsset(name);
|
|
365
|
-
if (!asset) {
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
return Object.defineProperties(asset, {
|
|
369
|
-
info: {
|
|
370
|
-
value: AssetInfo_1.JsAssetInfo.__from_binding(asset.info)
|
|
371
|
-
},
|
|
372
|
-
source: {
|
|
373
|
-
get: () => this.__internal__getAssetSource(asset.name)
|
|
374
|
-
}
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
379
|
-
*
|
|
380
|
-
* @internal
|
|
381
|
-
*/
|
|
382
|
-
__internal__pushRspackDiagnostic(diagnostic) {
|
|
383
|
-
__classPrivateFieldGet(this, _Compilation_inner, "f").pushDiagnostic(diagnostic);
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
387
|
-
*
|
|
388
|
-
* @internal
|
|
389
|
-
*/
|
|
390
|
-
__internal__pushDiagnostic(diagnostic) {
|
|
391
|
-
__classPrivateFieldGet(this, _Compilation_inner, "f").pushNativeDiagnostic(diagnostic);
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
395
|
-
*
|
|
396
|
-
* @internal
|
|
397
|
-
*/
|
|
398
|
-
__internal__pushDiagnostics(diagnostics) {
|
|
399
|
-
__classPrivateFieldGet(this, _Compilation_inner, "f").pushNativeDiagnostics(diagnostics);
|
|
400
|
-
}
|
|
401
|
-
get errors() {
|
|
402
|
-
const inner = __classPrivateFieldGet(this, _Compilation_inner, "f");
|
|
403
|
-
const errors = inner.getErrors();
|
|
404
|
-
const proxyMethod = [
|
|
405
|
-
{
|
|
406
|
-
method: "push",
|
|
407
|
-
handler(target, thisArg, errs) {
|
|
408
|
-
for (let i = 0; i < errs.length; i++) {
|
|
409
|
-
const error = errs[i];
|
|
410
|
-
inner.pushDiagnostic(RspackError_1.JsRspackDiagnostic.__to_binding(error, binding_1.JsRspackSeverity.Error));
|
|
411
|
-
}
|
|
412
|
-
return Reflect.apply(target, thisArg, errs);
|
|
413
|
-
}
|
|
414
|
-
},
|
|
415
|
-
{
|
|
416
|
-
method: "pop",
|
|
417
|
-
handler(target, thisArg) {
|
|
418
|
-
inner.spliceDiagnostic(errors.length - 1, errors.length, []);
|
|
419
|
-
return Reflect.apply(target, thisArg, []);
|
|
420
|
-
}
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
method: "shift",
|
|
424
|
-
handler(target, thisArg) {
|
|
425
|
-
inner.spliceDiagnostic(0, 1, []);
|
|
426
|
-
return Reflect.apply(target, thisArg, []);
|
|
427
|
-
}
|
|
428
|
-
},
|
|
429
|
-
{
|
|
430
|
-
method: "unshift",
|
|
431
|
-
handler(target, thisArg, errs) {
|
|
432
|
-
const errList = errs.map(error => {
|
|
433
|
-
return RspackError_1.JsRspackDiagnostic.__to_binding(error, binding_1.JsRspackSeverity.Error);
|
|
434
|
-
});
|
|
435
|
-
inner.spliceDiagnostic(0, 0, errList);
|
|
436
|
-
return Reflect.apply(target, thisArg, errs);
|
|
437
|
-
}
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
method: "splice",
|
|
441
|
-
handler(target, thisArg, [startIdx, delCount, ...errors]) {
|
|
442
|
-
const errList = errors.map(error => {
|
|
443
|
-
return RspackError_1.JsRspackDiagnostic.__to_binding(error, binding_1.JsRspackSeverity.Error);
|
|
444
|
-
});
|
|
445
|
-
inner.spliceDiagnostic(startIdx, startIdx + delCount, errList);
|
|
446
|
-
return Reflect.apply(target, thisArg, [
|
|
447
|
-
startIdx,
|
|
448
|
-
delCount,
|
|
449
|
-
...errors
|
|
450
|
-
]);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
];
|
|
454
|
-
for (const item of proxyMethod) {
|
|
455
|
-
const proxiedMethod = new Proxy(errors[item.method], {
|
|
456
|
-
apply: item.handler
|
|
457
|
-
});
|
|
458
|
-
errors[item.method] = proxiedMethod;
|
|
459
|
-
}
|
|
460
|
-
return errors;
|
|
461
|
-
}
|
|
462
|
-
get warnings() {
|
|
463
|
-
const inner = __classPrivateFieldGet(this, _Compilation_inner, "f");
|
|
464
|
-
const processWarningsHook = this.hooks.processWarnings;
|
|
465
|
-
const warnings = inner.getWarnings();
|
|
466
|
-
const proxyMethod = [
|
|
467
|
-
{
|
|
468
|
-
method: "push",
|
|
469
|
-
handler(target, thisArg, warns) {
|
|
470
|
-
return Reflect.apply(target, thisArg, processWarningsHook.call(warns).map(warn => {
|
|
471
|
-
inner.pushDiagnostic(RspackError_1.JsRspackDiagnostic.__to_binding(warn, binding_1.JsRspackSeverity.Warn));
|
|
472
|
-
return warn;
|
|
473
|
-
}));
|
|
474
|
-
}
|
|
475
|
-
},
|
|
476
|
-
{
|
|
477
|
-
method: "pop",
|
|
478
|
-
handler(target, thisArg) {
|
|
479
|
-
inner.spliceDiagnostic(warnings.length - 1, warnings.length, []);
|
|
480
|
-
return Reflect.apply(target, thisArg, []);
|
|
481
|
-
}
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
method: "shift",
|
|
485
|
-
handler(target, thisArg) {
|
|
486
|
-
inner.spliceDiagnostic(0, 1, []);
|
|
487
|
-
return Reflect.apply(target, thisArg, []);
|
|
488
|
-
}
|
|
489
|
-
},
|
|
490
|
-
{
|
|
491
|
-
method: "unshift",
|
|
492
|
-
handler(target, thisArg, warns) {
|
|
493
|
-
const warnings = processWarningsHook.call(warns);
|
|
494
|
-
inner.spliceDiagnostic(0, 0, warnings.map(warn => {
|
|
495
|
-
return RspackError_1.JsRspackDiagnostic.__to_binding(warn, binding_1.JsRspackSeverity.Warn);
|
|
496
|
-
}));
|
|
497
|
-
return Reflect.apply(target, thisArg, warnings);
|
|
498
|
-
}
|
|
499
|
-
},
|
|
500
|
-
{
|
|
501
|
-
method: "splice",
|
|
502
|
-
handler(target, thisArg, [startIdx, delCount, ...warns]) {
|
|
503
|
-
warns = processWarningsHook.call(warns);
|
|
504
|
-
const warnList = warns.map(warn => {
|
|
505
|
-
return RspackError_1.JsRspackDiagnostic.__to_binding(warn, binding_1.JsRspackSeverity.Warn);
|
|
506
|
-
});
|
|
507
|
-
inner.spliceDiagnostic(startIdx, startIdx + delCount, warnList);
|
|
508
|
-
return Reflect.apply(target, thisArg, [
|
|
509
|
-
startIdx,
|
|
510
|
-
delCount,
|
|
511
|
-
...warnList
|
|
512
|
-
]);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
];
|
|
516
|
-
for (const item of proxyMethod) {
|
|
517
|
-
const proxiedMethod = new Proxy(warnings[item.method], {
|
|
518
|
-
apply: item.handler
|
|
519
|
-
});
|
|
520
|
-
warnings[item.method] = proxiedMethod;
|
|
521
|
-
}
|
|
522
|
-
return warnings;
|
|
523
|
-
}
|
|
524
|
-
getPath(filename, data = {}) {
|
|
525
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").getPath(filename, {
|
|
526
|
-
...data,
|
|
527
|
-
chunk: data.chunk instanceof Chunk_1.Chunk
|
|
528
|
-
? data.chunk.__internal_to_path_data_chunk()
|
|
529
|
-
: data.chunk
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
getPathWithInfo(filename, data = {}) {
|
|
533
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").getPathWithInfo(filename, {
|
|
534
|
-
...data,
|
|
535
|
-
chunk: data.chunk instanceof Chunk_1.Chunk
|
|
536
|
-
? data.chunk.__internal_to_path_data_chunk()
|
|
537
|
-
: data.chunk
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
getAssetPath(filename, data = {}) {
|
|
541
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").getAssetPath(filename, {
|
|
542
|
-
...data,
|
|
543
|
-
chunk: data.chunk instanceof Chunk_1.Chunk
|
|
544
|
-
? data.chunk.__internal_to_path_data_chunk()
|
|
545
|
-
: data.chunk
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
getAssetPathWithInfo(filename, data = {}) {
|
|
549
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").getAssetPathWithInfo(filename, {
|
|
550
|
-
...data,
|
|
551
|
-
chunk: data.chunk instanceof Chunk_1.Chunk
|
|
552
|
-
? data.chunk.__internal_to_path_data_chunk()
|
|
553
|
-
: data.chunk
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
getLogger(name) {
|
|
557
|
-
if (!name) {
|
|
558
|
-
throw new TypeError("Compilation.getLogger(name) called without a name");
|
|
559
|
-
}
|
|
560
|
-
let logName = name;
|
|
561
|
-
let logEntries;
|
|
562
|
-
return new Logger_1.Logger((type, args) => {
|
|
563
|
-
if (typeof logName === "function") {
|
|
564
|
-
logName = logName();
|
|
565
|
-
if (!logName) {
|
|
566
|
-
throw new TypeError("Compilation.getLogger(name) called with a function not returning a name");
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
let trace;
|
|
570
|
-
switch (type) {
|
|
571
|
-
case Logger_1.LogType.warn:
|
|
572
|
-
case Logger_1.LogType.error:
|
|
573
|
-
case Logger_1.LogType.trace:
|
|
574
|
-
trace = (0, ErrorHelpers_1.cutOffLoaderExecution)(new Error("Trace").stack)
|
|
575
|
-
.split("\n")
|
|
576
|
-
.slice(3);
|
|
577
|
-
break;
|
|
578
|
-
}
|
|
579
|
-
const logEntry = {
|
|
580
|
-
time: Date.now(),
|
|
581
|
-
type,
|
|
582
|
-
args,
|
|
583
|
-
trace
|
|
584
|
-
};
|
|
585
|
-
if (this.hooks.log.call(logName, logEntry) === undefined) {
|
|
586
|
-
if (logEntry.type === Logger_1.LogType.profileEnd) {
|
|
587
|
-
if (typeof console.profileEnd === "function") {
|
|
588
|
-
console.profileEnd(`[${logName}] ${logEntry.args[0]}`);
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
if (logEntries === undefined) {
|
|
592
|
-
logEntries = this.logging.get(logName);
|
|
593
|
-
if (logEntries === undefined) {
|
|
594
|
-
logEntries = [];
|
|
595
|
-
this.logging.set(logName, logEntries);
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
logEntries.push(logEntry);
|
|
599
|
-
if (logEntry.type === Logger_1.LogType.profile) {
|
|
600
|
-
if (typeof console.profile === "function") {
|
|
601
|
-
console.profile(`[${logName}] ${logEntry.args[0]}`);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
}, (childName) => {
|
|
606
|
-
let normalizedChildName = childName;
|
|
607
|
-
if (typeof logName === "function") {
|
|
608
|
-
if (typeof normalizedChildName === "function") {
|
|
609
|
-
return this.getLogger(() => {
|
|
610
|
-
if (typeof logName === "function") {
|
|
611
|
-
logName = logName();
|
|
612
|
-
if (!logName) {
|
|
613
|
-
throw new TypeError("Compilation.getLogger(name) called with a function not returning a name");
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
if (typeof normalizedChildName === "function") {
|
|
617
|
-
normalizedChildName = normalizedChildName();
|
|
618
|
-
if (!normalizedChildName) {
|
|
619
|
-
throw new TypeError("Logger.getChildLogger(name) called with a function not returning a name");
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
return `${logName}/${normalizedChildName}`;
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
return this.getLogger(() => {
|
|
626
|
-
if (typeof logName === "function") {
|
|
627
|
-
logName = logName();
|
|
628
|
-
if (!logName) {
|
|
629
|
-
throw new TypeError("Compilation.getLogger(name) called with a function not returning a name");
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
return `${logName}/${normalizedChildName}`;
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
if (typeof normalizedChildName === "function") {
|
|
636
|
-
return this.getLogger(() => {
|
|
637
|
-
if (typeof normalizedChildName === "function") {
|
|
638
|
-
normalizedChildName = normalizedChildName();
|
|
639
|
-
if (!normalizedChildName) {
|
|
640
|
-
throw new TypeError("Logger.getChildLogger(name) called with a function not returning a name");
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
return `${logName}/${normalizedChildName}`;
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
return this.getLogger(`${logName}/${normalizedChildName}`);
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
getStats() {
|
|
650
|
-
return new Stats_1.Stats(this);
|
|
651
|
-
}
|
|
652
|
-
createChildCompiler(name, outputOptions, plugins) {
|
|
653
|
-
const idx = this.childrenCounters[name] || 0;
|
|
654
|
-
this.childrenCounters[name] = idx + 1;
|
|
655
|
-
return this.compiler.createChildCompiler(this, name, idx, outputOptions, plugins);
|
|
656
|
-
}
|
|
657
|
-
rebuildModule(m, f) {
|
|
658
|
-
__classPrivateFieldGet(this, _Compilation_rebuildModuleCaller, "f").push([m.identifier(), f]);
|
|
659
|
-
}
|
|
660
|
-
addRuntimeModule(chunk, runtimeModule) {
|
|
661
|
-
runtimeModule.attach(this, chunk, this.chunkGraph);
|
|
662
|
-
__classPrivateFieldGet(this, _Compilation_inner, "f").addRuntimeModule(chunk.__internal__innerUkey(), RuntimeModule_1.RuntimeModule.__to_binding(this, runtimeModule));
|
|
663
|
-
}
|
|
664
|
-
/**
|
|
665
|
-
* Get the `Source` of a given asset filename.
|
|
666
|
-
*
|
|
667
|
-
* Note: This is not a webpack public API, maybe removed in the future.
|
|
668
|
-
*
|
|
669
|
-
* @internal
|
|
670
|
-
*/
|
|
671
|
-
__internal__getAssetSource(filename) {
|
|
672
|
-
const rawSource = __classPrivateFieldGet(this, _Compilation_inner, "f").getAssetSource(filename);
|
|
673
|
-
if (!rawSource) {
|
|
674
|
-
return;
|
|
675
|
-
}
|
|
676
|
-
return source_1.JsSource.__from_binding(rawSource);
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* Set the `Source` of an given asset filename.
|
|
680
|
-
*
|
|
681
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
682
|
-
*
|
|
683
|
-
* @internal
|
|
684
|
-
*/
|
|
685
|
-
__internal__setAssetSource(filename, source) {
|
|
686
|
-
__classPrivateFieldGet(this, _Compilation_inner, "f").setAssetSource(filename, source_1.JsSource.__to_binding(source));
|
|
687
|
-
}
|
|
688
|
-
/**
|
|
689
|
-
* Delete the `Source` of an given asset filename.
|
|
690
|
-
*
|
|
691
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
692
|
-
*
|
|
693
|
-
* @internal
|
|
694
|
-
*/
|
|
695
|
-
__internal__deleteAssetSource(filename) {
|
|
696
|
-
__classPrivateFieldGet(this, _Compilation_inner, "f").deleteAssetSource(filename);
|
|
697
|
-
}
|
|
698
|
-
/**
|
|
699
|
-
* Get a list of asset filenames.
|
|
700
|
-
*
|
|
701
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
702
|
-
*
|
|
703
|
-
* @internal
|
|
704
|
-
*/
|
|
705
|
-
__internal__getAssetFilenames() {
|
|
706
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").getAssetFilenames();
|
|
707
|
-
}
|
|
708
|
-
/**
|
|
709
|
-
* Test if an asset exists.
|
|
710
|
-
*
|
|
711
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
712
|
-
*
|
|
713
|
-
* @internal
|
|
714
|
-
*/
|
|
715
|
-
__internal__hasAsset(name) {
|
|
716
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f").hasAsset(name);
|
|
717
|
-
}
|
|
718
|
-
/**
|
|
719
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
720
|
-
*
|
|
721
|
-
* @internal
|
|
722
|
-
*/
|
|
723
|
-
__internal__getChunks() {
|
|
724
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f")
|
|
725
|
-
.getChunks()
|
|
726
|
-
.map(c => Chunk_1.Chunk.__from_binding(c, __classPrivateFieldGet(this, _Compilation_inner, "f")));
|
|
727
|
-
}
|
|
728
|
-
/**
|
|
729
|
-
* Note: This is not a webpack public API, maybe removed in future.
|
|
730
|
-
*
|
|
731
|
-
* @internal
|
|
732
|
-
*/
|
|
733
|
-
__internal_getInner() {
|
|
734
|
-
return __classPrivateFieldGet(this, _Compilation_inner, "f");
|
|
735
|
-
}
|
|
736
|
-
seal() { }
|
|
737
|
-
unseal() { }
|
|
738
|
-
}
|
|
739
|
-
_Compilation_inner = new WeakMap(), _Compilation_customModules = new WeakMap(), _Compilation_rebuildModuleCaller = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
|
|
740
|
-
return new Proxy({}, {
|
|
741
|
-
get: (_, property) => {
|
|
742
|
-
if (typeof property === "string") {
|
|
743
|
-
return this.__internal__getAssetSource(property);
|
|
744
|
-
}
|
|
745
|
-
},
|
|
746
|
-
set: (_, p, newValue) => {
|
|
747
|
-
if (typeof p === "string") {
|
|
748
|
-
this.__internal__setAssetSource(p, newValue);
|
|
749
|
-
return true;
|
|
750
|
-
}
|
|
751
|
-
return false;
|
|
752
|
-
},
|
|
753
|
-
deleteProperty: (_, p) => {
|
|
754
|
-
if (typeof p === "string") {
|
|
755
|
-
this.__internal__deleteAssetSource(p);
|
|
756
|
-
return true;
|
|
757
|
-
}
|
|
758
|
-
return false;
|
|
759
|
-
},
|
|
760
|
-
has: (_, property) => {
|
|
761
|
-
if (typeof property === "string") {
|
|
762
|
-
return this.__internal__hasAsset(property);
|
|
763
|
-
}
|
|
764
|
-
return false;
|
|
765
|
-
},
|
|
766
|
-
ownKeys: _ => {
|
|
767
|
-
return this.__internal__getAssetFilenames();
|
|
768
|
-
},
|
|
769
|
-
getOwnPropertyDescriptor() {
|
|
770
|
-
// To work with `Object.keys`, you should mark the property as enumerable.
|
|
771
|
-
// See: https://262.ecma-international.org/7.0/#sec-enumerableownnames
|
|
772
|
-
return {
|
|
773
|
-
enumerable: true,
|
|
774
|
-
configurable: true
|
|
775
|
-
};
|
|
776
|
-
}
|
|
777
|
-
});
|
|
778
|
-
};
|
|
779
|
-
Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL = -2000;
|
|
780
|
-
Compilation.PROCESS_ASSETS_STAGE_PRE_PROCESS = -1000;
|
|
781
|
-
Compilation.PROCESS_ASSETS_STAGE_DERIVED = -200;
|
|
782
|
-
Compilation.PROCESS_ASSETS_STAGE_ADDITIONS = -100;
|
|
783
|
-
Compilation.PROCESS_ASSETS_STAGE_NONE = 0;
|
|
784
|
-
Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE = 100;
|
|
785
|
-
Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT = 200;
|
|
786
|
-
Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY = 300;
|
|
787
|
-
Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE = 400;
|
|
788
|
-
Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING = 500;
|
|
789
|
-
Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE = 700;
|
|
790
|
-
Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE = 1000;
|
|
791
|
-
Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH = 2500;
|
|
792
|
-
Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER = 3000;
|
|
793
|
-
Compilation.PROCESS_ASSETS_STAGE_ANALYSE = 4000;
|
|
794
|
-
Compilation.PROCESS_ASSETS_STAGE_REPORT = 5000;
|
|
795
|
-
exports.Compilation = Compilation;
|
|
796
|
-
class Entries {
|
|
797
|
-
constructor(data) {
|
|
798
|
-
_Entries_data.set(this, void 0);
|
|
799
|
-
__classPrivateFieldSet(this, _Entries_data, data, "f");
|
|
800
|
-
}
|
|
801
|
-
clear() {
|
|
802
|
-
__classPrivateFieldGet(this, _Entries_data, "f").clear();
|
|
803
|
-
}
|
|
804
|
-
forEach(callback, thisArg) {
|
|
805
|
-
for (const [key, value] of this) {
|
|
806
|
-
callback.call(thisArg, value, key, this);
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
get size() {
|
|
810
|
-
return __classPrivateFieldGet(this, _Entries_data, "f").size;
|
|
811
|
-
}
|
|
812
|
-
entries() {
|
|
813
|
-
const self = this;
|
|
814
|
-
const keys = this.keys();
|
|
815
|
-
return {
|
|
816
|
-
[Symbol.iterator]() {
|
|
817
|
-
return this;
|
|
818
|
-
},
|
|
819
|
-
next() {
|
|
820
|
-
const { done, value } = keys.next();
|
|
821
|
-
return {
|
|
822
|
-
done,
|
|
823
|
-
value: done ? undefined : [value, self.get(value)]
|
|
824
|
-
};
|
|
825
|
-
}
|
|
826
|
-
};
|
|
827
|
-
}
|
|
828
|
-
values() {
|
|
829
|
-
return __classPrivateFieldGet(this, _Entries_data, "f").values()[Symbol.iterator]();
|
|
830
|
-
}
|
|
831
|
-
[(_Entries_data = new WeakMap(), Symbol.iterator)]() {
|
|
832
|
-
return this.entries();
|
|
833
|
-
}
|
|
834
|
-
get [Symbol.toStringTag]() {
|
|
835
|
-
return "Map";
|
|
836
|
-
}
|
|
837
|
-
has(key) {
|
|
838
|
-
return __classPrivateFieldGet(this, _Entries_data, "f").has(key);
|
|
839
|
-
}
|
|
840
|
-
set(key, value) {
|
|
841
|
-
__classPrivateFieldGet(this, _Entries_data, "f").set(key, value);
|
|
842
|
-
return this;
|
|
843
|
-
}
|
|
844
|
-
delete(key) {
|
|
845
|
-
return __classPrivateFieldGet(this, _Entries_data, "f").delete(key);
|
|
846
|
-
}
|
|
847
|
-
get(key) {
|
|
848
|
-
return __classPrivateFieldGet(this, _Entries_data, "f").get(key);
|
|
849
|
-
}
|
|
850
|
-
keys() {
|
|
851
|
-
return __classPrivateFieldGet(this, _Entries_data, "f").keys()[Symbol.iterator]();
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
exports.Entries = Entries;
|