@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.
Files changed (219) hide show
  1. package/dist/Dependency.d.ts +7 -6
  2. package/dist/Module.d.ts +19 -17
  3. package/dist/builtin-plugin/css-extract/utils.d.ts +1 -0
  4. package/dist/config/types.d.ts +545 -0
  5. package/dist/config/zod.d.ts +202 -1347
  6. package/dist/cssExtractHmr.js +224 -0
  7. package/dist/cssExtractLoader.js +277 -0
  8. package/dist/index.js +23347 -31
  9. package/dist/{builtin-plugin/css-extract/hmr/hotModuleReplacement.d.ts → runtime/cssExtractHmr.d.ts} +1 -0
  10. package/dist/runtime/moduleFederationDefaultRuntime.d.ts +2 -0
  11. package/dist/stats/statsFactoryUtils.d.ts +1 -0
  12. package/package.json +8 -5
  13. package/compiled/json-parse-even-better-errors/index.d.ts +0 -1
  14. package/compiled/json-parse-even-better-errors/index.js +0 -193
  15. package/compiled/json-parse-even-better-errors/package.json +0 -1
  16. package/compiled/neo-async/index.d.ts +0 -685
  17. package/compiled/neo-async/index.js +0 -9207
  18. package/compiled/neo-async/license +0 -22
  19. package/compiled/neo-async/package.json +0 -1
  20. package/compiled/zod-validation-error/index.d.ts +0 -41
  21. package/compiled/zod-validation-error/index.js +0 -335
  22. package/compiled/zod-validation-error/license +0 -9
  23. package/compiled/zod-validation-error/package.json +0 -1
  24. package/dist/Chunk.js +0 -118
  25. package/dist/ChunkGraph.js +0 -27
  26. package/dist/ChunkGroup.js +0 -76
  27. package/dist/Compilation.js +0 -854
  28. package/dist/Compiler.js +0 -920
  29. package/dist/ContextModuleFactory.js +0 -36
  30. package/dist/DependenciesBlock.js +0 -30
  31. package/dist/Dependency.js +0 -32
  32. package/dist/Entrypoint.js +0 -21
  33. package/dist/ErrorHelpers.js +0 -62
  34. package/dist/ExecuteModulePlugin.js +0 -46
  35. package/dist/FileSystem.js +0 -34
  36. package/dist/FileSystemInfo.js +0 -2
  37. package/dist/Module.js +0 -143
  38. package/dist/ModuleTypeConstants.js +0 -92
  39. package/dist/MultiCompiler.js +0 -440
  40. package/dist/MultiStats.js +0 -161
  41. package/dist/MultiWatching.js +0 -62
  42. package/dist/NormalModule.js +0 -97
  43. package/dist/NormalModuleFactory.js +0 -43
  44. package/dist/Resolver.js +0 -39
  45. package/dist/ResolverFactory.js +0 -61
  46. package/dist/RspackError.js +0 -21
  47. package/dist/RuleSetCompiler.js +0 -10
  48. package/dist/RuntimeGlobals.js +0 -357
  49. package/dist/RuntimeModule.js +0 -58
  50. package/dist/Stats.js +0 -161
  51. package/dist/Template.js +0 -206
  52. package/dist/Watching.js +0 -290
  53. package/dist/builtin-loader/index.js +0 -17
  54. package/dist/builtin-loader/lightningcss/index.js +0 -175
  55. package/dist/builtin-loader/swc/index.js +0 -5
  56. package/dist/builtin-loader/swc/pluginImport.js +0 -35
  57. package/dist/builtin-loader/swc/react.js +0 -7
  58. package/dist/builtin-loader/swc/types.js +0 -2
  59. package/dist/builtin-plugin/APIPlugin.js +0 -6
  60. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.js +0 -6
  61. package/dist/builtin-plugin/AssetModulesPlugin.js +0 -6
  62. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.js +0 -6
  63. package/dist/builtin-plugin/BannerPlugin.js +0 -22
  64. package/dist/builtin-plugin/BundlerInfoRspackPlugin.js +0 -12
  65. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.js +0 -6
  66. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.js +0 -6
  67. package/dist/builtin-plugin/ContextReplacementPlugin.js +0 -43
  68. package/dist/builtin-plugin/CopyRspackPlugin.js +0 -21
  69. package/dist/builtin-plugin/CssModulesPlugin.js +0 -6
  70. package/dist/builtin-plugin/DataUriPlugin.js +0 -6
  71. package/dist/builtin-plugin/DefinePlugin.js +0 -44
  72. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.js +0 -6
  73. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.js +0 -6
  74. package/dist/builtin-plugin/DynamicEntryPlugin.js +0 -36
  75. package/dist/builtin-plugin/ElectronTargetPlugin.js +0 -6
  76. package/dist/builtin-plugin/EnableChunkLoadingPlugin.js +0 -6
  77. package/dist/builtin-plugin/EnableLibraryPlugin.js +0 -39
  78. package/dist/builtin-plugin/EnableWasmLoadingPlugin.js +0 -6
  79. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.js +0 -6
  80. package/dist/builtin-plugin/EntryPlugin.js +0 -34
  81. package/dist/builtin-plugin/EvalDevToolModulePlugin.js +0 -6
  82. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.js +0 -16
  83. package/dist/builtin-plugin/ExternalsPlugin.js +0 -51
  84. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.js +0 -6
  85. package/dist/builtin-plugin/FileUriPlugin.js +0 -6
  86. package/dist/builtin-plugin/FlagDependencyExportsPlugin.js +0 -6
  87. package/dist/builtin-plugin/FlagDependencyUsagePlugin.js +0 -6
  88. package/dist/builtin-plugin/HotModuleReplacementPlugin.js +0 -18
  89. package/dist/builtin-plugin/HtmlRspackPlugin.js +0 -285
  90. package/dist/builtin-plugin/HttpExternalsRspackPlugin.js +0 -11
  91. package/dist/builtin-plugin/IgnorePlugin.js +0 -20
  92. package/dist/builtin-plugin/InferAsyncModulesPlugin.js +0 -6
  93. package/dist/builtin-plugin/JavascriptModulesPlugin.js +0 -55
  94. package/dist/builtin-plugin/JsLoaderRspackPlugin.js +0 -9
  95. package/dist/builtin-plugin/JsonModulesPlugin.js +0 -6
  96. package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +0 -30
  97. package/dist/builtin-plugin/LimitChunkCountPlugin.js +0 -8
  98. package/dist/builtin-plugin/MangleExportsPlugin.js +0 -6
  99. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.js +0 -6
  100. package/dist/builtin-plugin/ModuleChunkFormatPlugin.js +0 -6
  101. package/dist/builtin-plugin/ModuleConcatenationPlugin.js +0 -6
  102. package/dist/builtin-plugin/NamedChunkIdsPlugin.js +0 -6
  103. package/dist/builtin-plugin/NamedModuleIdsPlugin.js +0 -6
  104. package/dist/builtin-plugin/NaturalChunkIdsPlugin.js +0 -6
  105. package/dist/builtin-plugin/NaturalModuleIdsPlugin.js +0 -6
  106. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.js +0 -6
  107. package/dist/builtin-plugin/NodeTargetPlugin.js +0 -6
  108. package/dist/builtin-plugin/ProgressPlugin.js +0 -15
  109. package/dist/builtin-plugin/ProvidePlugin.js +0 -14
  110. package/dist/builtin-plugin/RealContentHashPlugin.js +0 -6
  111. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.js +0 -6
  112. package/dist/builtin-plugin/RuntimeChunkPlugin.js +0 -6
  113. package/dist/builtin-plugin/RuntimePlugin.js +0 -6
  114. package/dist/builtin-plugin/SideEffectsFlagPlugin.js +0 -6
  115. package/dist/builtin-plugin/SizeLimitsPlugin.js +0 -9
  116. package/dist/builtin-plugin/SourceMapDevToolPlugin.js +0 -14
  117. package/dist/builtin-plugin/SplitChunksPlugin.js +0 -92
  118. package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +0 -80
  119. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.js +0 -6
  120. package/dist/builtin-plugin/WebWorkerTemplatePlugin.js +0 -6
  121. package/dist/builtin-plugin/WorkerPlugin.js +0 -31
  122. package/dist/builtin-plugin/base.js +0 -58
  123. package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +0 -182
  124. package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.d.ts +0 -2
  125. package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.js +0 -31
  126. package/dist/builtin-plugin/css-extract/index.js +0 -105
  127. package/dist/builtin-plugin/css-extract/loader.js +0 -204
  128. package/dist/builtin-plugin/css-extract/utils.js +0 -51
  129. package/dist/builtin-plugin/index.js +0 -84
  130. package/dist/builtin-plugin/lazy-compilation/backend.js +0 -139
  131. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.js +0 -6
  132. package/dist/builtin-plugin/lazy-compilation/plugin.js +0 -60
  133. package/dist/config/adapter.js +0 -691
  134. package/dist/config/adapterRuleUse.js +0 -107
  135. package/dist/config/browserslistTargetHandler.js +0 -345
  136. package/dist/config/defaults.js +0 -876
  137. package/dist/config/index.js +0 -20
  138. package/dist/config/normalization.js +0 -299
  139. package/dist/config/target.js +0 -318
  140. package/dist/config/types.js +0 -3
  141. package/dist/config/zod.js +0 -1028
  142. package/dist/container/ContainerPlugin.js +0 -50
  143. package/dist/container/ContainerReferencePlugin.js +0 -49
  144. package/dist/container/ModuleFederationPlugin.js +0 -137
  145. package/dist/container/ModuleFederationPluginV1.js +0 -63
  146. package/dist/container/ModuleFederationRuntimePlugin.js +0 -6
  147. package/dist/container/options.js +0 -48
  148. package/dist/error/ConcurrentCompilationError.js +0 -20
  149. package/dist/exports.js +0 -183
  150. package/dist/lib/AbstractMethodError.js +0 -51
  151. package/dist/lib/Cache.js +0 -111
  152. package/dist/lib/CacheFacade.js +0 -321
  153. package/dist/lib/Dependency.js +0 -11
  154. package/dist/lib/EntryOptionPlugin.js +0 -89
  155. package/dist/lib/EnvironmentPlugin.js +0 -57
  156. package/dist/lib/HookWebpackError.js +0 -83
  157. package/dist/lib/IgnoreWarningsPlugin.js +0 -35
  158. package/dist/lib/LoaderOptionsPlugin.js +0 -74
  159. package/dist/lib/LoaderTargetPlugin.js +0 -37
  160. package/dist/lib/ModuleFilenameHelpers.js +0 -83
  161. package/dist/lib/NormalModuleReplacementPlugin.js +0 -85
  162. package/dist/lib/WebpackError.js +0 -20
  163. package/dist/lib/cache/MemoryCachePlugin.js +0 -40
  164. package/dist/lib/cache/getLazyHashedEtag.js +0 -73
  165. package/dist/lib/cache/mergeEtags.js +0 -74
  166. package/dist/lib/formatLocation.js +0 -64
  167. package/dist/loader-runner/LoaderLoadingError.js +0 -19
  168. package/dist/loader-runner/index.js +0 -735
  169. package/dist/loader-runner/loadLoader.js +0 -64
  170. package/dist/logging/Logger.js +0 -143
  171. package/dist/logging/createConsoleLogger.js +0 -176
  172. package/dist/logging/runtime.js +0 -37
  173. package/dist/logging/truncateArgs.js +0 -81
  174. package/dist/node/NodeEnvironmentPlugin.js +0 -50
  175. package/dist/node/NodeTemplatePlugin.js +0 -26
  176. package/dist/node/NodeWatchFileSystem.js +0 -144
  177. package/dist/node/nodeConsole.js +0 -146
  178. package/dist/rspack.js +0 -123
  179. package/dist/rspackOptionsApply.js +0 -274
  180. package/dist/sharing/ConsumeSharedPlugin.js +0 -69
  181. package/dist/sharing/ProvideSharedPlugin.js +0 -50
  182. package/dist/sharing/SharePlugin.js +0 -66
  183. package/dist/sharing/ShareRuntimePlugin.js +0 -26
  184. package/dist/sharing/utils.js +0 -8
  185. package/dist/stats/DefaultStatsFactoryPlugin.js +0 -1173
  186. package/dist/stats/DefaultStatsPresetPlugin.js +0 -305
  187. package/dist/stats/DefaultStatsPrinterPlugin.js +0 -1069
  188. package/dist/stats/StatsFactory.js +0 -167
  189. package/dist/stats/StatsPrinter.js +0 -142
  190. package/dist/stats/statsFactoryUtils.js +0 -341
  191. package/dist/util/ArrayQueue.js +0 -108
  192. package/dist/util/AssetInfo.js +0 -39
  193. package/dist/util/IterableHelpers.js +0 -35
  194. package/dist/util/MergeCaller.js +0 -24
  195. package/dist/util/SizeFormatHelpers.js +0 -24
  196. package/dist/util/SplitChunkSize.js +0 -18
  197. package/dist/util/assertNotNil.js +0 -9
  198. package/dist/util/assetCondition.js +0 -2
  199. package/dist/util/bindingVersionCheck.js +0 -124
  200. package/dist/util/cleverMerge.js +0 -504
  201. package/dist/util/comparators.js +0 -108
  202. package/dist/util/createHash.js +0 -161
  203. package/dist/util/createReadonlyMap.js +0 -29
  204. package/dist/util/fake.js +0 -28
  205. package/dist/util/fs.js +0 -120
  206. package/dist/util/hash/BatchedHash.js +0 -69
  207. package/dist/util/hash/index.js +0 -39
  208. package/dist/util/hash/md4.js +0 -27
  209. package/dist/util/hash/wasm-hash.js +0 -167
  210. package/dist/util/hash/xxhash64.js +0 -27
  211. package/dist/util/identifier.js +0 -330
  212. package/dist/util/index.js +0 -123
  213. package/dist/util/memoize.js +0 -61
  214. package/dist/util/scheme.js +0 -57
  215. package/dist/util/smartGrouping.js +0 -148
  216. package/dist/util/source.js +0 -42
  217. package/dist/util/validate.js +0 -77
  218. package/dist/util/webpack.js +0 -27
  219. /package/dist/{container/default.runtime.js → moduleFederationDefaultRuntime.js} +0 -0
@@ -1,36 +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
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ContextModuleFactory = void 0;
27
- const liteTapable = __importStar(require("@rspack/lite-tapable"));
28
- class ContextModuleFactory {
29
- constructor() {
30
- this.hooks = {
31
- beforeResolve: new liteTapable.AsyncSeriesWaterfallHook(["resolveData"]),
32
- afterResolve: new liteTapable.AsyncSeriesWaterfallHook(["resolveData"])
33
- };
34
- }
35
- }
36
- exports.ContextModuleFactory = ContextModuleFactory;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- 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");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- 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");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _DependenciesBlock_binding;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.DependenciesBlock = void 0;
16
- const Dependency_1 = require("./Dependency");
17
- class DependenciesBlock {
18
- constructor(binding) {
19
- _DependenciesBlock_binding.set(this, void 0);
20
- __classPrivateFieldSet(this, _DependenciesBlock_binding, binding, "f");
21
- }
22
- get dependencies() {
23
- return __classPrivateFieldGet(this, _DependenciesBlock_binding, "f").dependencies.map(d => new Dependency_1.Dependency(d));
24
- }
25
- get blocks() {
26
- return __classPrivateFieldGet(this, _DependenciesBlock_binding, "f").blocks.map(b => new DependenciesBlock(b));
27
- }
28
- }
29
- exports.DependenciesBlock = DependenciesBlock;
30
- _DependenciesBlock_binding = new WeakMap();
@@ -1,32 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- 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");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- 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");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _Dependency_binding;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.Dependency = void 0;
16
- class Dependency {
17
- constructor(binding) {
18
- _Dependency_binding.set(this, void 0);
19
- __classPrivateFieldSet(this, _Dependency_binding, binding, "f");
20
- }
21
- get type() {
22
- return __classPrivateFieldGet(this, _Dependency_binding, "f").type;
23
- }
24
- get category() {
25
- return __classPrivateFieldGet(this, _Dependency_binding, "f").category;
26
- }
27
- get request() {
28
- return __classPrivateFieldGet(this, _Dependency_binding, "f").request;
29
- }
30
- }
31
- exports.Dependency = Dependency;
32
- _Dependency_binding = new WeakMap();
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Entrypoint = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const Chunk_1 = require("./Chunk");
6
- const ChunkGroup_1 = require("./ChunkGroup");
7
- class Entrypoint extends ChunkGroup_1.ChunkGroup {
8
- static __from_binding(chunk, compilation) {
9
- return new Entrypoint(chunk, compilation);
10
- }
11
- constructor(inner, compilation) {
12
- super(inner, compilation);
13
- }
14
- getRuntimeChunk() {
15
- const c = (0, binding_1.__entrypoint_inner_get_runtime_chunk)(this.__internal__innerUkey(), this.__internal__innerCompilation());
16
- if (c)
17
- return Chunk_1.Chunk.__from_binding(c, this.__internal__innerCompilation());
18
- return null;
19
- }
20
- }
21
- exports.Entrypoint = Entrypoint;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- /**
3
- * The following code is modified based on
4
- * https://github.com/webpack/webpack/blob/4b4ca3b/lib/ErrorHelpers.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.cleanUpWebpackOptions = exports.cleanUp = exports.cutOffMessage = exports.cutOffMultilineMessage = exports.cutOffWebpackOptions = exports.cutOffLoaderExecution = exports.cutOffByFlag = void 0;
13
- const loaderFlag = "LOADER_EXECUTION";
14
- const webpackOptionsFlag = "WEBPACK_OPTIONS";
15
- const cutOffByFlag = (stack, flag) => {
16
- const stacks = stack.split("\n");
17
- for (let i = 0; i < stacks.length; i++) {
18
- if (stacks[i].includes(flag)) {
19
- stacks.length = i;
20
- }
21
- }
22
- return stacks.join("\n");
23
- };
24
- exports.cutOffByFlag = cutOffByFlag;
25
- const cutOffLoaderExecution = (stack) => (0, exports.cutOffByFlag)(stack, loaderFlag);
26
- exports.cutOffLoaderExecution = cutOffLoaderExecution;
27
- const cutOffWebpackOptions = (stack) => (0, exports.cutOffByFlag)(stack, webpackOptionsFlag);
28
- exports.cutOffWebpackOptions = cutOffWebpackOptions;
29
- const cutOffMultilineMessage = (stack, message) => {
30
- const stacks = stack.split("\n");
31
- const messages = message.split("\n");
32
- const result = [];
33
- stacks.forEach((line, idx) => {
34
- if (!line.includes(messages[idx]))
35
- result.push(line);
36
- });
37
- return result.join("\n");
38
- };
39
- exports.cutOffMultilineMessage = cutOffMultilineMessage;
40
- const cutOffMessage = (stack, message) => {
41
- const nextLine = stack.indexOf("\n");
42
- if (nextLine === -1) {
43
- return stack === message ? "" : stack;
44
- }
45
- const firstLine = stack.slice(0, nextLine);
46
- return firstLine === message ? stack.slice(nextLine + 1) : stack;
47
- };
48
- exports.cutOffMessage = cutOffMessage;
49
- const cleanUp = (stack, message) => {
50
- let str = stack;
51
- str = (0, exports.cutOffLoaderExecution)(str);
52
- str = (0, exports.cutOffMessage)(str, message);
53
- return str;
54
- };
55
- exports.cleanUp = cleanUp;
56
- const cleanUpWebpackOptions = (stack, message) => {
57
- let str = stack;
58
- str = (0, exports.cutOffWebpackOptions)(str);
59
- str = (0, exports.cutOffMultilineMessage)(str, message);
60
- return str;
61
- };
62
- exports.cleanUpWebpackOptions = cleanUpWebpackOptions;
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const node_vm_1 = __importDefault(require("node:vm"));
7
- const _1 = require(".");
8
- class ExecuteModulePlugin {
9
- apply(compiler) {
10
- compiler.hooks.compilation.tap("executeModule", compilation => {
11
- compilation.hooks.executeModule.tap("executeModule", (options, context) => {
12
- const moduleObject = options.moduleObject;
13
- const source = options.codeGenerationResult.get("javascript");
14
- try {
15
- const fn = node_vm_1.default.runInThisContext(`(function(module, __webpack_module__, __webpack_exports__, exports, ${_1.RuntimeGlobals.require}) {\n${source}\n})`, {
16
- filename: moduleObject.id
17
- });
18
- fn.call(moduleObject.exports, moduleObject, moduleObject, moduleObject.exports, moduleObject.exports, context.__webpack_require__);
19
- }
20
- catch (e) {
21
- const err = e instanceof Error ? e : new Error(e);
22
- err.stack += printGeneratedCodeForStack(moduleObject.id, source);
23
- throw err;
24
- }
25
- });
26
- });
27
- }
28
- }
29
- exports.default = ExecuteModulePlugin;
30
- const printGeneratedCodeForStack = (moduleId, code) => {
31
- const lines = code.split("\n");
32
- const n = `${lines.length}`.length;
33
- return `\n\nGenerated code for ${moduleId}\n${lines
34
- .map(
35
- /**
36
- * @param {string} line the line
37
- * @param {number} i the index
38
- * @param {string[]} lines the lines
39
- * @returns {string} the line with line number
40
- */
41
- (line, i, lines) => {
42
- const iStr = `${i + 1}`;
43
- return `${" ".repeat(n - iStr.length)}${iStr} | ${line}`;
44
- })
45
- .join("\n")}`;
46
- };
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ThreadsafeWritableNodeFS = void 0;
7
- const node_util_1 = __importDefault(require("node:util"));
8
- const fs_1 = require("./util/fs");
9
- const memoize_1 = require("./util/memoize");
10
- const NOOP_FILESYSTEM = {
11
- writeFile() { },
12
- removeFile() { },
13
- mkdir() { },
14
- mkdirp() { },
15
- removeDirAll() { }
16
- };
17
- class ThreadsafeWritableNodeFS {
18
- constructor(fs) {
19
- if (!fs) {
20
- // This happens when located in a child compiler.
21
- Object.assign(this, NOOP_FILESYSTEM);
22
- return;
23
- }
24
- this.writeFile = (0, memoize_1.memoizeFn)(() => node_util_1.default.promisify(fs.writeFile.bind(fs)));
25
- this.removeFile = (0, memoize_1.memoizeFn)(() => node_util_1.default.promisify(fs.unlink.bind(fs)));
26
- this.mkdir = (0, memoize_1.memoizeFn)(() => node_util_1.default.promisify(fs.mkdir.bind(fs)));
27
- this.mkdirp = (0, memoize_1.memoizeFn)(() => node_util_1.default.promisify(fs_1.mkdirp.bind(null, fs)));
28
- this.removeDirAll = (0, memoize_1.memoizeFn)(() => node_util_1.default.promisify(fs_1.rmrf.bind(null, fs)));
29
- }
30
- static __to_binding(fs) {
31
- return new this(fs);
32
- }
33
- }
34
- exports.ThreadsafeWritableNodeFS = ThreadsafeWritableNodeFS;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/dist/Module.js DELETED
@@ -1,143 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
- 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");
5
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
- };
7
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
- if (kind === "m") throw new TypeError("Private method is not writable");
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
- 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");
11
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
- };
13
- var _ContextModuleFactoryAfterResolveData_inner, _Module_inner, _Module_originalSource, _CodeGenerationResult_inner;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.CodeGenerationResults = exports.CodeGenerationResult = exports.Module = exports.ContextModuleFactoryAfterResolveData = void 0;
16
- const DependenciesBlock_1 = require("./DependenciesBlock");
17
- const source_1 = require("./util/source");
18
- class ContextModuleFactoryAfterResolveData {
19
- static __from_binding(binding) {
20
- return new ContextModuleFactoryAfterResolveData(binding);
21
- }
22
- static __to_binding(data) {
23
- return __classPrivateFieldGet(data, _ContextModuleFactoryAfterResolveData_inner, "f");
24
- }
25
- constructor(data) {
26
- _ContextModuleFactoryAfterResolveData_inner.set(this, void 0);
27
- __classPrivateFieldSet(this, _ContextModuleFactoryAfterResolveData_inner, data, "f");
28
- }
29
- get resource() {
30
- return __classPrivateFieldGet(this, _ContextModuleFactoryAfterResolveData_inner, "f").resource;
31
- }
32
- set resource(val) {
33
- __classPrivateFieldGet(this, _ContextModuleFactoryAfterResolveData_inner, "f").resource = val;
34
- }
35
- get context() {
36
- return __classPrivateFieldGet(this, _ContextModuleFactoryAfterResolveData_inner, "f").context;
37
- }
38
- set context(val) {
39
- __classPrivateFieldGet(this, _ContextModuleFactoryAfterResolveData_inner, "f").context = val;
40
- }
41
- get request() {
42
- return __classPrivateFieldGet(this, _ContextModuleFactoryAfterResolveData_inner, "f").request;
43
- }
44
- set request(val) {
45
- __classPrivateFieldGet(this, _ContextModuleFactoryAfterResolveData_inner, "f").request = val;
46
- }
47
- get regExp() {
48
- if (!__classPrivateFieldGet(this, _ContextModuleFactoryAfterResolveData_inner, "f").regExp) {
49
- return undefined;
50
- }
51
- const { source, flags } = __classPrivateFieldGet(this, _ContextModuleFactoryAfterResolveData_inner, "f").regExp;
52
- return new RegExp(source, flags);
53
- }
54
- set regExp(val) {
55
- if (!val) {
56
- __classPrivateFieldGet(this, _ContextModuleFactoryAfterResolveData_inner, "f").regExp = undefined;
57
- return;
58
- }
59
- __classPrivateFieldGet(this, _ContextModuleFactoryAfterResolveData_inner, "f").regExp = {
60
- source: val.source,
61
- flags: val.flags
62
- };
63
- }
64
- get recursive() {
65
- return __classPrivateFieldGet(this, _ContextModuleFactoryAfterResolveData_inner, "f").recursive;
66
- }
67
- set recursive(val) {
68
- __classPrivateFieldGet(this, _ContextModuleFactoryAfterResolveData_inner, "f").recursive = val;
69
- }
70
- get dependencies() {
71
- // TODO: Dependencies are not fully supported yet; this is a placeholder to prevent errors in moment-locales-webpack-plugin.
72
- return [];
73
- }
74
- }
75
- exports.ContextModuleFactoryAfterResolveData = ContextModuleFactoryAfterResolveData;
76
- _ContextModuleFactoryAfterResolveData_inner = new WeakMap();
77
- class Module {
78
- static __from_binding(module, compilation) {
79
- return new Module(module, compilation);
80
- }
81
- constructor(module, compilation) {
82
- _Module_inner.set(this, void 0);
83
- _Module_originalSource.set(this, void 0);
84
- __classPrivateFieldSet(this, _Module_inner, module, "f");
85
- this.type = module.type;
86
- this.layer = module.layer ?? null;
87
- this.context = module.context;
88
- this.resource = module.resource;
89
- this.request = module.request;
90
- this.userRequest = module.userRequest;
91
- this.rawRequest = module.rawRequest;
92
- this.factoryMeta = module.factoryMeta;
93
- const customModule = compilation?.__internal__getCustomModule(module.moduleIdentifier);
94
- this.buildInfo = customModule?.buildInfo || {};
95
- this.buildMeta = customModule?.buildMeta || {};
96
- }
97
- originalSource() {
98
- if (__classPrivateFieldGet(this, _Module_originalSource, "f"))
99
- return __classPrivateFieldGet(this, _Module_originalSource, "f");
100
- if (__classPrivateFieldGet(this, _Module_inner, "f").originalSource) {
101
- __classPrivateFieldSet(this, _Module_originalSource, source_1.JsSource.__from_binding(__classPrivateFieldGet(this, _Module_inner, "f").originalSource), "f");
102
- return __classPrivateFieldGet(this, _Module_originalSource, "f");
103
- }
104
- return null;
105
- }
106
- identifier() {
107
- return __classPrivateFieldGet(this, _Module_inner, "f").moduleIdentifier;
108
- }
109
- nameForCondition() {
110
- if (typeof __classPrivateFieldGet(this, _Module_inner, "f").nameForCondition === "string") {
111
- return __classPrivateFieldGet(this, _Module_inner, "f").nameForCondition;
112
- }
113
- return null;
114
- }
115
- get blocks() {
116
- if ("blocks" in __classPrivateFieldGet(this, _Module_inner, "f")) {
117
- return __classPrivateFieldGet(this, _Module_inner, "f").blocks.map(b => new DependenciesBlock_1.DependenciesBlock(b));
118
- }
119
- return [];
120
- }
121
- size(type) {
122
- if ("size" in __classPrivateFieldGet(this, _Module_inner, "f")) {
123
- return __classPrivateFieldGet(this, _Module_inner, "f").size(type);
124
- }
125
- return 0;
126
- }
127
- }
128
- exports.Module = Module;
129
- _Module_inner = new WeakMap(), _Module_originalSource = new WeakMap();
130
- class CodeGenerationResult {
131
- constructor(result) {
132
- _CodeGenerationResult_inner.set(this, void 0);
133
- __classPrivateFieldSet(this, _CodeGenerationResult_inner, result, "f");
134
- }
135
- get(sourceType) {
136
- return __classPrivateFieldGet(this, _CodeGenerationResult_inner, "f").sources[sourceType];
137
- }
138
- }
139
- exports.CodeGenerationResult = CodeGenerationResult;
140
- _CodeGenerationResult_inner = new WeakMap();
141
- class CodeGenerationResults {
142
- }
143
- exports.CodeGenerationResults = CodeGenerationResults;
@@ -1,92 +0,0 @@
1
- "use strict";
2
- /*
3
- MIT License http://www.opensource.org/licenses/mit-license.php
4
- Author Sean Larkin @TheLarkInn
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY = exports.WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE = exports.WEBPACK_MODULE_TYPE_PROVIDE = exports.WEBPACK_MODULE_TYPE_REMOTE = exports.WEBPACK_MODULE_TYPE_FALLBACK = exports.WEBPACK_MODULE_TYPE_RUNTIME = exports.ASSET_MODULE_TYPE_RAW_DATA_URL = exports.ASSET_MODULE_TYPE_SOURCE = exports.ASSET_MODULE_TYPE_RESOURCE = exports.ASSET_MODULE_TYPE_INLINE = exports.ASSET_MODULE_TYPE = exports.CSS_MODULE_TYPE_AUTO = exports.CSS_MODULE_TYPE_MODULE = exports.CSS_MODULE_TYPE_GLOBAL = exports.CSS_MODULE_TYPE = exports.WEBASSEMBLY_MODULE_TYPE_SYNC = exports.WEBASSEMBLY_MODULE_TYPE_ASYNC = exports.JSON_MODULE_TYPE = exports.JAVASCRIPT_MODULE_TYPE_ESM = exports.JAVASCRIPT_MODULE_TYPE_DYNAMIC = exports.JAVASCRIPT_MODULE_TYPE_AUTO = void 0;
8
- exports.JAVASCRIPT_MODULE_TYPE_AUTO = "javascript/auto";
9
- exports.JAVASCRIPT_MODULE_TYPE_DYNAMIC = "javascript/dynamic";
10
- /**
11
- * This is the module type used for _strict_ ES Module syntax. This means that all legacy formats
12
- * that webpack supports (CommonJS, AMD, SystemJS) are not supported.
13
- */
14
- exports.JAVASCRIPT_MODULE_TYPE_ESM = "javascript/esm";
15
- /**
16
- * This is the module type used for JSON files. JSON files are always parsed as ES Module.
17
- */
18
- exports.JSON_MODULE_TYPE = "json";
19
- /**
20
- * This is the module type used for WebAssembly modules. In webpack 5 they are always treated as async modules.
21
- *
22
- */
23
- exports.WEBASSEMBLY_MODULE_TYPE_ASYNC = "webassembly/async";
24
- /**
25
- * This is the module type used for WebAssembly modules. In webpack 4 they are always treated as sync modules.
26
- * There is a legacy option to support this usage in webpack 5 and up.
27
- */
28
- exports.WEBASSEMBLY_MODULE_TYPE_SYNC = "webassembly/sync";
29
- /**
30
- * This is the module type used for CSS files.
31
- */
32
- exports.CSS_MODULE_TYPE = "css";
33
- /**
34
- * This is the module type used for CSS modules files where you need to use `:local` in selector list to hash classes.
35
- */
36
- exports.CSS_MODULE_TYPE_GLOBAL = "css/global";
37
- /**
38
- * This is the module type used for CSS modules files, by default all classes are hashed.
39
- */
40
- exports.CSS_MODULE_TYPE_MODULE = "css/module";
41
- /**
42
- * This is the module type used for CSS files, the module will be parsed as CSS modules if it's filename contains `.module.` or `.modules.`.
43
- */
44
- exports.CSS_MODULE_TYPE_AUTO = "css/auto";
45
- /**
46
- * This is the module type used for automatically choosing between `asset/inline`, `asset/resource` based on asset size limit (8096).
47
- */
48
- exports.ASSET_MODULE_TYPE = "asset";
49
- /**
50
- * This is the module type used for assets that are inlined as a data URI. This is the equivalent of `url-loader`.
51
- */
52
- exports.ASSET_MODULE_TYPE_INLINE = "asset/inline";
53
- /**
54
- * This is the module type used for assets that are copied to the output directory. This is the equivalent of `file-loader`.
55
- */
56
- exports.ASSET_MODULE_TYPE_RESOURCE = "asset/resource";
57
- /**
58
- * @type {Readonly<"asset/source">}
59
- * This is the module type used for assets that are imported as source code. This is the equivalent of `raw-loader`.
60
- */
61
- exports.ASSET_MODULE_TYPE_SOURCE = "asset/source";
62
- /**
63
- * TODO: Document what this asset type is for. See css-loader tests for its usage.
64
- */
65
- exports.ASSET_MODULE_TYPE_RAW_DATA_URL = "asset/raw-data-url";
66
- /**
67
- * This is the module type used for the webpack runtime abstractions.
68
- */
69
- exports.WEBPACK_MODULE_TYPE_RUNTIME = "runtime";
70
- /**
71
- * This is the module type used for the ModuleFederation feature's FallbackModule class.
72
- * TODO: Document this better.
73
- */
74
- exports.WEBPACK_MODULE_TYPE_FALLBACK = "fallback-module";
75
- /**
76
- * This is the module type used for the ModuleFederation feature's RemoteModule class.
77
- * TODO: Document this better.
78
- */
79
- exports.WEBPACK_MODULE_TYPE_REMOTE = "remote-module";
80
- /**
81
- * This is the module type used for the ModuleFederation feature's ProvideModule class.
82
- * TODO: Document this better.
83
- */
84
- exports.WEBPACK_MODULE_TYPE_PROVIDE = "provide-module";
85
- /**
86
- * This is the module type used for the ModuleFederation feature's ConsumeSharedModule class.
87
- */
88
- exports.WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE = "consume-shared-module";
89
- /**
90
- * Module type used for `experiments.lazyCompilation` feature. See `LazyCompilationPlugin` for more information.
91
- */
92
- exports.WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY = "lazy-compilation-proxy";