@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
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/IgnoreWarningsPlugin.js
|
|
5
|
-
*
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
* Author Tobias Koppers @sokra
|
|
8
|
-
* Copyright (c) JS Foundation and other contributors
|
|
9
|
-
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
class IgnoreWarningsPlugin {
|
|
13
|
-
/**
|
|
14
|
-
* @param ignoreWarnings conditions to ignore warnings
|
|
15
|
-
*/
|
|
16
|
-
constructor(ignorePattern) {
|
|
17
|
-
this.name = "IgnoreWarningsPlugin";
|
|
18
|
-
this._ignorePattern = ignorePattern;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Apply the plugin
|
|
22
|
-
* @param compiler the compiler instance
|
|
23
|
-
* @returns
|
|
24
|
-
*/
|
|
25
|
-
apply(compiler) {
|
|
26
|
-
compiler.hooks.compilation.tap(this.name, compilation => {
|
|
27
|
-
compilation.hooks.processWarnings.tap(this.name, warnings => {
|
|
28
|
-
return warnings.filter(warning => {
|
|
29
|
-
return !this._ignorePattern.some(ignore => ignore(warning, compilation));
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.default = IgnoreWarningsPlugin;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/LoaderOptionsPlugin.js
|
|
5
|
-
*
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
* Author Tobias Koppers @sokra
|
|
8
|
-
* Copyright (c) JS Foundation and other contributors
|
|
9
|
-
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
|
-
*/
|
|
11
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
-
if (k2 === undefined) k2 = k;
|
|
13
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
-
}
|
|
17
|
-
Object.defineProperty(o, k2, desc);
|
|
18
|
-
}) : (function(o, m, k, k2) {
|
|
19
|
-
if (k2 === undefined) k2 = k;
|
|
20
|
-
o[k2] = m[k];
|
|
21
|
-
}));
|
|
22
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
-
}) : function(o, v) {
|
|
25
|
-
o["default"] = v;
|
|
26
|
-
});
|
|
27
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.LoaderOptionsPlugin = void 0;
|
|
36
|
-
const NormalModule_1 = require("../NormalModule");
|
|
37
|
-
const ModuleFilenameHelpers = __importStar(require("./ModuleFilenameHelpers"));
|
|
38
|
-
class LoaderOptionsPlugin {
|
|
39
|
-
/**
|
|
40
|
-
* @param options options object
|
|
41
|
-
*/
|
|
42
|
-
constructor(options = {}) {
|
|
43
|
-
if (!options.test) {
|
|
44
|
-
options.test = {
|
|
45
|
-
test: () => true
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
this.options = options;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Apply the plugin
|
|
52
|
-
* @param compiler the compiler instance
|
|
53
|
-
* @returns
|
|
54
|
-
*/
|
|
55
|
-
apply(compiler) {
|
|
56
|
-
const options = this.options;
|
|
57
|
-
compiler.hooks.compilation.tap("LoaderOptionsPlugin", compilation => {
|
|
58
|
-
NormalModule_1.NormalModule.getCompilationHooks(compilation).loader.tap("LoaderOptionsPlugin", context => {
|
|
59
|
-
const resource = context.resourcePath;
|
|
60
|
-
if (!resource)
|
|
61
|
-
return;
|
|
62
|
-
if (ModuleFilenameHelpers.matchObject(options, resource)) {
|
|
63
|
-
for (const key of Object.keys(options)) {
|
|
64
|
-
if (key === "include" || key === "exclude" || key === "test") {
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
context[key] = options[key];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
exports.LoaderOptionsPlugin = LoaderOptionsPlugin;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/LoaderTargetPlugin.js
|
|
5
|
-
*
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
* Author Tobias Koppers @sokra
|
|
8
|
-
* Copyright (c) JS Foundation and other contributors
|
|
9
|
-
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
|
-
*/
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.LoaderTargetPlugin = void 0;
|
|
16
|
-
const NormalModule_1 = __importDefault(require("../NormalModule"));
|
|
17
|
-
class LoaderTargetPlugin {
|
|
18
|
-
/**
|
|
19
|
-
* @param target the target
|
|
20
|
-
*/
|
|
21
|
-
constructor(target) {
|
|
22
|
-
this.target = target;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Apply the plugin
|
|
26
|
-
* @param compiler the compiler instance
|
|
27
|
-
* @returns
|
|
28
|
-
*/
|
|
29
|
-
apply(compiler) {
|
|
30
|
-
compiler.hooks.compilation.tap("LoaderTargetPlugin", compilation => {
|
|
31
|
-
NormalModule_1.default.getCompilationHooks(compilation).loader.tap("LoaderTargetPlugin", loaderContext => {
|
|
32
|
-
loaderContext.target = this.target;
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.LoaderTargetPlugin = LoaderTargetPlugin;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/ModuleFilenameHelpers.js
|
|
5
|
-
*
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
* Author Tobias Koppers @sokra
|
|
8
|
-
* Copyright (c) JS Foundation and other contributors
|
|
9
|
-
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.matchObject = exports.matchPart = exports.asRegExp = void 0;
|
|
13
|
-
/**
|
|
14
|
-
* Returns a function that returns the string with the token replaced with the replacement
|
|
15
|
-
* @example
|
|
16
|
-
* ```js
|
|
17
|
-
* const test = asRegExp("test");
|
|
18
|
-
* test.test("test"); // true
|
|
19
|
-
*
|
|
20
|
-
* const test2 = asRegExp(/test/);
|
|
21
|
-
* test2.test("test"); // true
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
const asRegExp = (test) => {
|
|
25
|
-
if (typeof test === "string") {
|
|
26
|
-
// Escape special characters in the string to prevent them from being interpreted as special characters in a regular expression. Do this by
|
|
27
|
-
// adding a backslash before each special character
|
|
28
|
-
return new RegExp(`^${test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")}`);
|
|
29
|
-
}
|
|
30
|
-
return test;
|
|
31
|
-
};
|
|
32
|
-
exports.asRegExp = asRegExp;
|
|
33
|
-
const matchPart = (str, test) => {
|
|
34
|
-
if (!test)
|
|
35
|
-
return true;
|
|
36
|
-
if (Array.isArray(test)) {
|
|
37
|
-
return test.map(exports.asRegExp).some(regExp => regExp.test(str));
|
|
38
|
-
}
|
|
39
|
-
return (0, exports.asRegExp)(test).test(str);
|
|
40
|
-
};
|
|
41
|
-
exports.matchPart = matchPart;
|
|
42
|
-
/**
|
|
43
|
-
* Tests if a string matches a match object. The match object can have the following properties:
|
|
44
|
-
* - `test`: a RegExp or an array of RegExp
|
|
45
|
-
* - `include`: a RegExp or an array of RegExp
|
|
46
|
-
* - `exclude`: a RegExp or an array of RegExp
|
|
47
|
-
*
|
|
48
|
-
* The `test` property is tested first, then `include` and then `exclude`.
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```js
|
|
52
|
-
* ModuleFilenameHelpers.matchObject({ test: "foo.js" }, "foo.js"); // true
|
|
53
|
-
* ModuleFilenameHelpers.matchObject({ test: /^foo/ }, "foo.js"); // true
|
|
54
|
-
* ModuleFilenameHelpers.matchObject({ test: [/^foo/, "bar"] }, "foo.js"); // true
|
|
55
|
-
* ModuleFilenameHelpers.matchObject({ test: [/^foo/, "bar"] }, "baz.js"); // false
|
|
56
|
-
* ModuleFilenameHelpers.matchObject({ include: "foo.js" }, "foo.js"); // true
|
|
57
|
-
* ModuleFilenameHelpers.matchObject({ include: "foo.js" }, "bar.js"); // false
|
|
58
|
-
* ModuleFilenameHelpers.matchObject({ include: /^foo/ }, "foo.js"); // true
|
|
59
|
-
* ModuleFilenameHelpers.matchObject({ include: [/^foo/, "bar"] }, "foo.js"); // true
|
|
60
|
-
* ModuleFilenameHelpers.matchObject({ include: [/^foo/, "bar"] }, "baz.js"); // false
|
|
61
|
-
* ModuleFilenameHelpers.matchObject({ exclude: "foo.js" }, "foo.js"); // false
|
|
62
|
-
* ModuleFilenameHelpers.matchObject({ exclude: [/^foo/, "bar"] }, "foo.js"); // false
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
const matchObject = (obj, str) => {
|
|
66
|
-
if (obj.test) {
|
|
67
|
-
if (!(0, exports.matchPart)(str, obj.test)) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (obj.include) {
|
|
72
|
-
if (!(0, exports.matchPart)(str, obj.include)) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (obj.exclude) {
|
|
77
|
-
if ((0, exports.matchPart)(str, obj.exclude)) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return true;
|
|
82
|
-
};
|
|
83
|
-
exports.matchObject = matchObject;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/NormalModuleReplacementPlugin.js
|
|
5
|
-
*
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
* Author Tobias Koppers @sokra
|
|
8
|
-
* Copyright (c) JS Foundation and other contributors
|
|
9
|
-
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
|
-
*/
|
|
11
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
-
if (k2 === undefined) k2 = k;
|
|
13
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
-
}
|
|
17
|
-
Object.defineProperty(o, k2, desc);
|
|
18
|
-
}) : (function(o, m, k, k2) {
|
|
19
|
-
if (k2 === undefined) k2 = k;
|
|
20
|
-
o[k2] = m[k];
|
|
21
|
-
}));
|
|
22
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
-
}) : function(o, v) {
|
|
25
|
-
o["default"] = v;
|
|
26
|
-
});
|
|
27
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.NormalModuleReplacementPlugin = void 0;
|
|
36
|
-
const NodePath = __importStar(require("node:path"));
|
|
37
|
-
class NormalModuleReplacementPlugin {
|
|
38
|
-
/**
|
|
39
|
-
* Create an instance of the plugin
|
|
40
|
-
* @param resourceRegExp the resource matcher
|
|
41
|
-
* @param newResource the resource replacement
|
|
42
|
-
*/
|
|
43
|
-
constructor(resourceRegExp, newResource) {
|
|
44
|
-
this.resourceRegExp = resourceRegExp;
|
|
45
|
-
this.newResource = newResource;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Apply the plugin
|
|
49
|
-
* @param compiler the compiler instance
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
|
-
apply(compiler) {
|
|
53
|
-
const { resourceRegExp, newResource } = this;
|
|
54
|
-
compiler.hooks.normalModuleFactory.tap("NormalModuleReplacementPlugin", nmf => {
|
|
55
|
-
nmf.hooks.beforeResolve.tap("NormalModuleReplacementPlugin", result => {
|
|
56
|
-
if (resourceRegExp.test(result.request)) {
|
|
57
|
-
if (typeof newResource === "function") {
|
|
58
|
-
newResource(result);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
result.request = newResource;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
nmf.hooks.afterResolve.tap("NormalModuleReplacementPlugin", result => {
|
|
66
|
-
const createData = result.createData || {};
|
|
67
|
-
if (resourceRegExp.test(createData.resource || "")) {
|
|
68
|
-
if (typeof newResource === "function") {
|
|
69
|
-
newResource(result);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
if (NodePath.posix.isAbsolute(newResource) ||
|
|
73
|
-
NodePath.win32.isAbsolute(newResource)) {
|
|
74
|
-
createData.resource = newResource;
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
createData.resource = NodePath.join(NodePath.dirname(createData.resource || ""), newResource);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
exports.NormalModuleReplacementPlugin = NormalModuleReplacementPlugin;
|
package/dist/lib/WebpackError.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/WebpackError.js
|
|
5
|
-
*
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
* Author Tobias Koppers @sokra
|
|
8
|
-
* Copyright (c) JS Foundation and other contributors
|
|
9
|
-
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.WebpackError = void 0;
|
|
13
|
-
const node_util_1 = require("node:util");
|
|
14
|
-
class WebpackError extends Error {
|
|
15
|
-
[node_util_1.inspect.custom]() {
|
|
16
|
-
return this.stack + (this.details ? `\n${this.details}` : "");
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.WebpackError = WebpackError;
|
|
20
|
-
exports.default = WebpackError;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const Cache_1 = require("../Cache");
|
|
4
|
-
class MemoryCachePlugin {
|
|
5
|
-
apply(compiler) {
|
|
6
|
-
const cache = new Map();
|
|
7
|
-
compiler.cache.hooks.store.tap({ name: MemoryCachePlugin.PLUGIN_NAME, stage: Cache_1.Cache.STAGE_MEMORY }, (identifier, etag, data) => {
|
|
8
|
-
const dataEtag = typeof etag?.toString === "function"
|
|
9
|
-
? etag.toString()
|
|
10
|
-
: etag;
|
|
11
|
-
cache.set(identifier, { etag: dataEtag, data });
|
|
12
|
-
});
|
|
13
|
-
compiler.cache.hooks.get.tap({ name: MemoryCachePlugin.PLUGIN_NAME, stage: Cache_1.Cache.STAGE_MEMORY }, (identifier, etag, gotHandlers) => {
|
|
14
|
-
const cacheEntry = cache.get(identifier);
|
|
15
|
-
const dataEtag = typeof etag?.toString === "function"
|
|
16
|
-
? etag.toString()
|
|
17
|
-
: etag;
|
|
18
|
-
if (cacheEntry === null) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
if (cacheEntry !== undefined) {
|
|
22
|
-
return cacheEntry.etag === dataEtag ? cacheEntry.data : null;
|
|
23
|
-
}
|
|
24
|
-
gotHandlers.push((result, callback) => {
|
|
25
|
-
if (result === undefined) {
|
|
26
|
-
cache.set(identifier, null);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
cache.set(identifier, { etag: dataEtag, data: result });
|
|
30
|
-
}
|
|
31
|
-
return callback(null);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
compiler.cache.hooks.shutdown.tap({ name: MemoryCachePlugin.PLUGIN_NAME, stage: Cache_1.Cache.STAGE_MEMORY }, () => {
|
|
35
|
-
cache.clear();
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
MemoryCachePlugin.PLUGIN_NAME = "MemoryCachePlugin";
|
|
40
|
-
exports.default = MemoryCachePlugin;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/cache/getLazyHashedEtag.js
|
|
5
|
-
*
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
* Author Tobias Koppers @sokra
|
|
8
|
-
* Copyright (c) JS Foundation and other contributors
|
|
9
|
-
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getter = void 0;
|
|
13
|
-
const createHash_1 = require("../../util/createHash");
|
|
14
|
-
class LazyHashedEtag {
|
|
15
|
-
/**
|
|
16
|
-
* @param obj object with updateHash method
|
|
17
|
-
* @param hashFunction the hash function to use
|
|
18
|
-
*/
|
|
19
|
-
constructor(obj, hashFunction = "md4") {
|
|
20
|
-
this._obj = obj;
|
|
21
|
-
this._hash = undefined;
|
|
22
|
-
this._hashFunction = hashFunction;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @returns hash of object
|
|
26
|
-
*/
|
|
27
|
-
toString() {
|
|
28
|
-
if (this._hash === undefined) {
|
|
29
|
-
const hash = (0, createHash_1.createHash)(this._hashFunction);
|
|
30
|
-
this._obj.updateHash(hash);
|
|
31
|
-
this._hash = hash.digest("base64");
|
|
32
|
-
}
|
|
33
|
-
return this._hash;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
const mapStrings = new Map();
|
|
37
|
-
const mapObjects = new WeakMap();
|
|
38
|
-
/**
|
|
39
|
-
* @param obj object with updateHash method
|
|
40
|
-
* @param ashFunction the hash function to use
|
|
41
|
-
* @returns etag
|
|
42
|
-
*/
|
|
43
|
-
const getter = (obj, hashFunction = "md4") => {
|
|
44
|
-
let innerMap;
|
|
45
|
-
if (typeof hashFunction === "string") {
|
|
46
|
-
innerMap = mapStrings.get(hashFunction);
|
|
47
|
-
if (innerMap === undefined) {
|
|
48
|
-
const newHash = new LazyHashedEtag(obj, hashFunction);
|
|
49
|
-
innerMap = new WeakMap();
|
|
50
|
-
innerMap.set(obj, newHash);
|
|
51
|
-
mapStrings.set(hashFunction, innerMap);
|
|
52
|
-
return newHash;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
innerMap = mapObjects.get(hashFunction);
|
|
57
|
-
if (innerMap === undefined) {
|
|
58
|
-
const newHash = new LazyHashedEtag(obj, hashFunction);
|
|
59
|
-
innerMap = new WeakMap();
|
|
60
|
-
innerMap.set(obj, newHash);
|
|
61
|
-
mapObjects.set(hashFunction, innerMap);
|
|
62
|
-
return newHash;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const hash = innerMap.get(obj);
|
|
66
|
-
if (hash !== undefined)
|
|
67
|
-
return hash;
|
|
68
|
-
const newHash = new LazyHashedEtag(obj, hashFunction);
|
|
69
|
-
innerMap.set(obj, newHash);
|
|
70
|
-
return newHash;
|
|
71
|
-
};
|
|
72
|
-
exports.getter = getter;
|
|
73
|
-
exports.default = exports.getter;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/cache/mergeEtags.js
|
|
5
|
-
*
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
* Author Tobias Koppers @sokra
|
|
8
|
-
* Copyright (c) JS Foundation and other contributors
|
|
9
|
-
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.mergeEtags = void 0;
|
|
13
|
-
class MergedEtag {
|
|
14
|
-
/**
|
|
15
|
-
* @param a first
|
|
16
|
-
* @param b second
|
|
17
|
-
*/
|
|
18
|
-
constructor(a, b) {
|
|
19
|
-
this.a = a;
|
|
20
|
-
this.b = b;
|
|
21
|
-
}
|
|
22
|
-
toString() {
|
|
23
|
-
return `${this.a.toString()}|${this.b.toString()}`;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
const dualObjectMap = new WeakMap();
|
|
27
|
-
const objectStringMap = new WeakMap();
|
|
28
|
-
/**
|
|
29
|
-
* @param first first
|
|
30
|
-
* @param second second
|
|
31
|
-
* @returns result
|
|
32
|
-
*/
|
|
33
|
-
const mergeEtags = (first, second) => {
|
|
34
|
-
let a = first;
|
|
35
|
-
let b = second;
|
|
36
|
-
if (typeof a === "string") {
|
|
37
|
-
if (typeof b === "string") {
|
|
38
|
-
return `${a}|${b}`;
|
|
39
|
-
}
|
|
40
|
-
const temp = b;
|
|
41
|
-
b = a;
|
|
42
|
-
a = temp;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
if (typeof b !== "string") {
|
|
46
|
-
// both a and b are objects
|
|
47
|
-
let map = dualObjectMap.get(a);
|
|
48
|
-
if (map === undefined) {
|
|
49
|
-
dualObjectMap.set(a, (map = new WeakMap()));
|
|
50
|
-
}
|
|
51
|
-
const mergedEtag = map.get(b);
|
|
52
|
-
if (mergedEtag === undefined) {
|
|
53
|
-
const newMergedEtag = new MergedEtag(a, b);
|
|
54
|
-
map.set(b, newMergedEtag);
|
|
55
|
-
return newMergedEtag;
|
|
56
|
-
}
|
|
57
|
-
return mergedEtag;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
// a is object, b is string
|
|
61
|
-
let map = objectStringMap.get(a);
|
|
62
|
-
if (map === undefined) {
|
|
63
|
-
objectStringMap.set(a, (map = new Map()));
|
|
64
|
-
}
|
|
65
|
-
const mergedEtag = map.get(b);
|
|
66
|
-
if (mergedEtag === undefined) {
|
|
67
|
-
const newMergedEtag = new MergedEtag(a, b);
|
|
68
|
-
map.set(b, newMergedEtag);
|
|
69
|
-
return newMergedEtag;
|
|
70
|
-
}
|
|
71
|
-
return mergedEtag;
|
|
72
|
-
};
|
|
73
|
-
exports.mergeEtags = mergeEtags;
|
|
74
|
-
exports.default = exports.mergeEtags;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/formatLocation.js
|
|
5
|
-
*
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
* Author Tobias Koppers @sokra
|
|
8
|
-
* Copyright (c) JS Foundation and other contributors
|
|
9
|
-
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
/**
|
|
13
|
-
* @param pos position
|
|
14
|
-
* @returns formatted position
|
|
15
|
-
*/
|
|
16
|
-
const formatPosition = (pos) => {
|
|
17
|
-
if (pos && typeof pos === "object") {
|
|
18
|
-
if ("line" in pos && "column" in pos) {
|
|
19
|
-
return `${pos.line}:${pos.column}`;
|
|
20
|
-
}
|
|
21
|
-
if ("line" in pos) {
|
|
22
|
-
return `${pos.line}:?`;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return "";
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* @param loc location
|
|
29
|
-
* @returns formatted location
|
|
30
|
-
*/
|
|
31
|
-
const formatLocation = (loc) => {
|
|
32
|
-
if (loc && typeof loc === "object") {
|
|
33
|
-
if ("start" in loc && loc.start && "end" in loc && loc.end) {
|
|
34
|
-
if (typeof loc.start === "object" &&
|
|
35
|
-
typeof loc.start.line === "number" &&
|
|
36
|
-
typeof loc.end === "object" &&
|
|
37
|
-
typeof loc.end.line === "number" &&
|
|
38
|
-
typeof loc.end.column === "number" &&
|
|
39
|
-
loc.start.line === loc.end.line) {
|
|
40
|
-
return `${formatPosition(loc.start)}-${loc.end.column}`;
|
|
41
|
-
}
|
|
42
|
-
if (typeof loc.start === "object" &&
|
|
43
|
-
typeof loc.start.line === "number" &&
|
|
44
|
-
typeof loc.start.column !== "number" &&
|
|
45
|
-
typeof loc.end === "object" &&
|
|
46
|
-
typeof loc.end.line === "number" &&
|
|
47
|
-
typeof loc.end.column !== "number") {
|
|
48
|
-
return `${loc.start.line}-${loc.end.line}`;
|
|
49
|
-
}
|
|
50
|
-
return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`;
|
|
51
|
-
}
|
|
52
|
-
if ("start" in loc && loc.start) {
|
|
53
|
-
return formatPosition(loc.start);
|
|
54
|
-
}
|
|
55
|
-
if ("name" in loc && "index" in loc) {
|
|
56
|
-
return `${loc.name}[${loc.index}]`;
|
|
57
|
-
}
|
|
58
|
-
if ("name" in loc) {
|
|
59
|
-
return loc.name;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return "";
|
|
63
|
-
};
|
|
64
|
-
exports.default = formatLocation;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is from
|
|
4
|
-
* https://github.com/webpack/loader-runner
|
|
5
|
-
*
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
* Author Tobias Koppers @sokra
|
|
8
|
-
* Copyright (c) JS Foundation and other contributors
|
|
9
|
-
* https://github.com/webpack/loader-runner/blob/main/LICENSE
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
class LoadingLoaderError extends Error {
|
|
13
|
-
constructor(message) {
|
|
14
|
-
super(message);
|
|
15
|
-
this.name = "LoaderRunnerError";
|
|
16
|
-
Error.captureStackTrace(this, this.constructor);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.default = LoadingLoaderError;
|