@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.
Files changed (217) hide show
  1. package/dist/builtin-plugin/css-extract/utils.d.ts +1 -0
  2. package/dist/config/types.d.ts +309 -0
  3. package/dist/config/zod.d.ts +22 -534
  4. package/dist/cssExtractHmr.js +224 -0
  5. package/dist/cssExtractLoader.js +277 -0
  6. package/dist/index.js +23347 -31
  7. package/dist/{builtin-plugin/css-extract/hmr/hotModuleReplacement.d.ts → runtime/cssExtractHmr.d.ts} +1 -0
  8. package/dist/runtime/moduleFederationDefaultRuntime.d.ts +2 -0
  9. package/dist/stats/statsFactoryUtils.d.ts +1 -0
  10. package/package.json +8 -5
  11. package/compiled/json-parse-even-better-errors/index.d.ts +0 -1
  12. package/compiled/json-parse-even-better-errors/index.js +0 -193
  13. package/compiled/json-parse-even-better-errors/package.json +0 -1
  14. package/compiled/neo-async/index.d.ts +0 -685
  15. package/compiled/neo-async/index.js +0 -9207
  16. package/compiled/neo-async/license +0 -22
  17. package/compiled/neo-async/package.json +0 -1
  18. package/compiled/zod-validation-error/index.d.ts +0 -41
  19. package/compiled/zod-validation-error/index.js +0 -335
  20. package/compiled/zod-validation-error/license +0 -9
  21. package/compiled/zod-validation-error/package.json +0 -1
  22. package/dist/Chunk.js +0 -118
  23. package/dist/ChunkGraph.js +0 -27
  24. package/dist/ChunkGroup.js +0 -76
  25. package/dist/Compilation.js +0 -854
  26. package/dist/Compiler.js +0 -925
  27. package/dist/ContextModuleFactory.js +0 -36
  28. package/dist/DependenciesBlock.js +0 -30
  29. package/dist/Dependency.js +0 -43
  30. package/dist/Entrypoint.js +0 -21
  31. package/dist/ErrorHelpers.js +0 -62
  32. package/dist/ExecuteModulePlugin.js +0 -46
  33. package/dist/FileSystem.js +0 -34
  34. package/dist/FileSystemInfo.js +0 -2
  35. package/dist/Module.js +0 -226
  36. package/dist/ModuleTypeConstants.js +0 -92
  37. package/dist/MultiCompiler.js +0 -440
  38. package/dist/MultiStats.js +0 -161
  39. package/dist/MultiWatching.js +0 -62
  40. package/dist/NormalModule.js +0 -97
  41. package/dist/NormalModuleFactory.js +0 -43
  42. package/dist/Resolver.js +0 -39
  43. package/dist/ResolverFactory.js +0 -61
  44. package/dist/RspackError.js +0 -21
  45. package/dist/RuleSetCompiler.js +0 -10
  46. package/dist/RuntimeGlobals.js +0 -357
  47. package/dist/RuntimeModule.js +0 -58
  48. package/dist/Stats.js +0 -161
  49. package/dist/Template.js +0 -206
  50. package/dist/Watching.js +0 -290
  51. package/dist/builtin-loader/index.js +0 -17
  52. package/dist/builtin-loader/lightningcss/index.js +0 -175
  53. package/dist/builtin-loader/swc/index.js +0 -5
  54. package/dist/builtin-loader/swc/pluginImport.js +0 -35
  55. package/dist/builtin-loader/swc/react.js +0 -7
  56. package/dist/builtin-loader/swc/types.js +0 -2
  57. package/dist/builtin-plugin/APIPlugin.js +0 -6
  58. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.js +0 -6
  59. package/dist/builtin-plugin/AssetModulesPlugin.js +0 -6
  60. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.js +0 -6
  61. package/dist/builtin-plugin/BannerPlugin.js +0 -22
  62. package/dist/builtin-plugin/BundlerInfoRspackPlugin.js +0 -12
  63. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.js +0 -6
  64. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.js +0 -6
  65. package/dist/builtin-plugin/ContextReplacementPlugin.js +0 -43
  66. package/dist/builtin-plugin/CopyRspackPlugin.js +0 -21
  67. package/dist/builtin-plugin/CssModulesPlugin.js +0 -6
  68. package/dist/builtin-plugin/DataUriPlugin.js +0 -6
  69. package/dist/builtin-plugin/DefinePlugin.js +0 -44
  70. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.js +0 -6
  71. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.js +0 -6
  72. package/dist/builtin-plugin/DynamicEntryPlugin.js +0 -36
  73. package/dist/builtin-plugin/ElectronTargetPlugin.js +0 -6
  74. package/dist/builtin-plugin/EnableChunkLoadingPlugin.js +0 -6
  75. package/dist/builtin-plugin/EnableLibraryPlugin.js +0 -39
  76. package/dist/builtin-plugin/EnableWasmLoadingPlugin.js +0 -6
  77. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.js +0 -6
  78. package/dist/builtin-plugin/EntryPlugin.js +0 -34
  79. package/dist/builtin-plugin/EvalDevToolModulePlugin.js +0 -6
  80. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.js +0 -16
  81. package/dist/builtin-plugin/ExternalsPlugin.js +0 -51
  82. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.js +0 -6
  83. package/dist/builtin-plugin/FileUriPlugin.js +0 -6
  84. package/dist/builtin-plugin/FlagDependencyExportsPlugin.js +0 -6
  85. package/dist/builtin-plugin/FlagDependencyUsagePlugin.js +0 -6
  86. package/dist/builtin-plugin/HotModuleReplacementPlugin.js +0 -18
  87. package/dist/builtin-plugin/HtmlRspackPlugin.js +0 -285
  88. package/dist/builtin-plugin/HttpExternalsRspackPlugin.js +0 -11
  89. package/dist/builtin-plugin/IgnorePlugin.js +0 -20
  90. package/dist/builtin-plugin/InferAsyncModulesPlugin.js +0 -6
  91. package/dist/builtin-plugin/JavascriptModulesPlugin.js +0 -55
  92. package/dist/builtin-plugin/JsLoaderRspackPlugin.js +0 -9
  93. package/dist/builtin-plugin/JsonModulesPlugin.js +0 -6
  94. package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +0 -30
  95. package/dist/builtin-plugin/LimitChunkCountPlugin.js +0 -8
  96. package/dist/builtin-plugin/MangleExportsPlugin.js +0 -6
  97. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.js +0 -6
  98. package/dist/builtin-plugin/ModuleChunkFormatPlugin.js +0 -6
  99. package/dist/builtin-plugin/ModuleConcatenationPlugin.js +0 -6
  100. package/dist/builtin-plugin/NamedChunkIdsPlugin.js +0 -6
  101. package/dist/builtin-plugin/NamedModuleIdsPlugin.js +0 -6
  102. package/dist/builtin-plugin/NaturalChunkIdsPlugin.js +0 -6
  103. package/dist/builtin-plugin/NaturalModuleIdsPlugin.js +0 -6
  104. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.js +0 -6
  105. package/dist/builtin-plugin/NodeTargetPlugin.js +0 -6
  106. package/dist/builtin-plugin/ProgressPlugin.js +0 -15
  107. package/dist/builtin-plugin/ProvidePlugin.js +0 -14
  108. package/dist/builtin-plugin/RealContentHashPlugin.js +0 -6
  109. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.js +0 -6
  110. package/dist/builtin-plugin/RuntimeChunkPlugin.js +0 -6
  111. package/dist/builtin-plugin/RuntimePlugin.js +0 -6
  112. package/dist/builtin-plugin/SideEffectsFlagPlugin.js +0 -6
  113. package/dist/builtin-plugin/SizeLimitsPlugin.js +0 -9
  114. package/dist/builtin-plugin/SourceMapDevToolPlugin.js +0 -14
  115. package/dist/builtin-plugin/SplitChunksPlugin.js +0 -92
  116. package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +0 -80
  117. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.js +0 -6
  118. package/dist/builtin-plugin/WebWorkerTemplatePlugin.js +0 -6
  119. package/dist/builtin-plugin/WorkerPlugin.js +0 -31
  120. package/dist/builtin-plugin/base.js +0 -58
  121. package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +0 -182
  122. package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.d.ts +0 -2
  123. package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.js +0 -31
  124. package/dist/builtin-plugin/css-extract/index.js +0 -105
  125. package/dist/builtin-plugin/css-extract/loader.js +0 -204
  126. package/dist/builtin-plugin/css-extract/utils.js +0 -51
  127. package/dist/builtin-plugin/index.js +0 -84
  128. package/dist/builtin-plugin/lazy-compilation/backend.js +0 -139
  129. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.js +0 -6
  130. package/dist/builtin-plugin/lazy-compilation/plugin.js +0 -60
  131. package/dist/config/adapter.js +0 -691
  132. package/dist/config/adapterRuleUse.js +0 -107
  133. package/dist/config/browserslistTargetHandler.js +0 -345
  134. package/dist/config/defaults.js +0 -876
  135. package/dist/config/index.js +0 -20
  136. package/dist/config/normalization.js +0 -299
  137. package/dist/config/target.js +0 -318
  138. package/dist/config/types.js +0 -3
  139. package/dist/config/zod.js +0 -1030
  140. package/dist/container/ContainerPlugin.js +0 -50
  141. package/dist/container/ContainerReferencePlugin.js +0 -49
  142. package/dist/container/ModuleFederationPlugin.js +0 -137
  143. package/dist/container/ModuleFederationPluginV1.js +0 -63
  144. package/dist/container/ModuleFederationRuntimePlugin.js +0 -6
  145. package/dist/container/options.js +0 -48
  146. package/dist/error/ConcurrentCompilationError.js +0 -20
  147. package/dist/exports.js +0 -183
  148. package/dist/lib/AbstractMethodError.js +0 -51
  149. package/dist/lib/Cache.js +0 -111
  150. package/dist/lib/CacheFacade.js +0 -321
  151. package/dist/lib/Dependency.js +0 -11
  152. package/dist/lib/EntryOptionPlugin.js +0 -89
  153. package/dist/lib/EnvironmentPlugin.js +0 -57
  154. package/dist/lib/HookWebpackError.js +0 -83
  155. package/dist/lib/IgnoreWarningsPlugin.js +0 -35
  156. package/dist/lib/LoaderOptionsPlugin.js +0 -74
  157. package/dist/lib/LoaderTargetPlugin.js +0 -37
  158. package/dist/lib/ModuleFilenameHelpers.js +0 -83
  159. package/dist/lib/NormalModuleReplacementPlugin.js +0 -85
  160. package/dist/lib/WebpackError.js +0 -20
  161. package/dist/lib/cache/MemoryCachePlugin.js +0 -40
  162. package/dist/lib/cache/getLazyHashedEtag.js +0 -73
  163. package/dist/lib/cache/mergeEtags.js +0 -74
  164. package/dist/lib/formatLocation.js +0 -64
  165. package/dist/loader-runner/LoaderLoadingError.js +0 -19
  166. package/dist/loader-runner/index.js +0 -735
  167. package/dist/loader-runner/loadLoader.js +0 -64
  168. package/dist/logging/Logger.js +0 -143
  169. package/dist/logging/createConsoleLogger.js +0 -176
  170. package/dist/logging/runtime.js +0 -37
  171. package/dist/logging/truncateArgs.js +0 -81
  172. package/dist/node/NodeEnvironmentPlugin.js +0 -50
  173. package/dist/node/NodeTemplatePlugin.js +0 -26
  174. package/dist/node/NodeWatchFileSystem.js +0 -144
  175. package/dist/node/nodeConsole.js +0 -146
  176. package/dist/rspack.js +0 -123
  177. package/dist/rspackOptionsApply.js +0 -274
  178. package/dist/sharing/ConsumeSharedPlugin.js +0 -69
  179. package/dist/sharing/ProvideSharedPlugin.js +0 -50
  180. package/dist/sharing/SharePlugin.js +0 -66
  181. package/dist/sharing/ShareRuntimePlugin.js +0 -26
  182. package/dist/sharing/utils.js +0 -8
  183. package/dist/stats/DefaultStatsFactoryPlugin.js +0 -1173
  184. package/dist/stats/DefaultStatsPresetPlugin.js +0 -305
  185. package/dist/stats/DefaultStatsPrinterPlugin.js +0 -1069
  186. package/dist/stats/StatsFactory.js +0 -167
  187. package/dist/stats/StatsPrinter.js +0 -142
  188. package/dist/stats/statsFactoryUtils.js +0 -341
  189. package/dist/util/ArrayQueue.js +0 -108
  190. package/dist/util/AssetInfo.js +0 -39
  191. package/dist/util/IterableHelpers.js +0 -35
  192. package/dist/util/MergeCaller.js +0 -24
  193. package/dist/util/SizeFormatHelpers.js +0 -24
  194. package/dist/util/SplitChunkSize.js +0 -18
  195. package/dist/util/assertNotNil.js +0 -9
  196. package/dist/util/assetCondition.js +0 -2
  197. package/dist/util/bindingVersionCheck.js +0 -124
  198. package/dist/util/cleverMerge.js +0 -504
  199. package/dist/util/comparators.js +0 -108
  200. package/dist/util/createHash.js +0 -161
  201. package/dist/util/createReadonlyMap.js +0 -29
  202. package/dist/util/fake.js +0 -28
  203. package/dist/util/fs.js +0 -120
  204. package/dist/util/hash/BatchedHash.js +0 -69
  205. package/dist/util/hash/index.js +0 -39
  206. package/dist/util/hash/md4.js +0 -27
  207. package/dist/util/hash/wasm-hash.js +0 -167
  208. package/dist/util/hash/xxhash64.js +0 -27
  209. package/dist/util/identifier.js +0 -330
  210. package/dist/util/index.js +0 -123
  211. package/dist/util/memoize.js +0 -61
  212. package/dist/util/scheme.js +0 -57
  213. package/dist/util/smartGrouping.js +0 -148
  214. package/dist/util/source.js +0 -42
  215. package/dist/util/validate.js +0 -77
  216. package/dist/util/webpack.js +0 -27
  217. /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;
@@ -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;