@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,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 => Dependency_1.Dependency.__from_binding(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,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Dependency = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- class Dependency {
6
- static __from_binding(binding) {
7
- return new Dependency(binding);
8
- }
9
- constructor(binding) {
10
- Object.defineProperties(this, {
11
- type: {
12
- enumerable: true,
13
- get() {
14
- return binding.type;
15
- }
16
- },
17
- category: {
18
- enumerable: true,
19
- get() {
20
- return binding.category;
21
- }
22
- },
23
- request: {
24
- enumerable: true,
25
- get() {
26
- return binding.request;
27
- }
28
- },
29
- critical: {
30
- enumerable: true,
31
- get() {
32
- return binding.critical;
33
- },
34
- set(val) {
35
- if (binding instanceof binding_1.JsDependencyMut) {
36
- binding.critical = val;
37
- }
38
- }
39
- }
40
- });
41
- }
42
- }
43
- exports.Dependency = Dependency;
@@ -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,226 +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 _ContextModuleFactoryBeforeResolveData_inner, _ContextModuleFactoryAfterResolveData_inner, _Module_inner, _Module_originalSource, _CodeGenerationResult_inner;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.CodeGenerationResults = exports.CodeGenerationResult = exports.Module = exports.ContextModuleFactoryAfterResolveData = exports.ContextModuleFactoryBeforeResolveData = void 0;
16
- const DependenciesBlock_1 = require("./DependenciesBlock");
17
- const Dependency_1 = require("./Dependency");
18
- const source_1 = require("./util/source");
19
- class ContextModuleFactoryBeforeResolveData {
20
- static __from_binding(binding) {
21
- return new ContextModuleFactoryBeforeResolveData(binding);
22
- }
23
- static __to_binding(data) {
24
- return __classPrivateFieldGet(data, _ContextModuleFactoryBeforeResolveData_inner, "f");
25
- }
26
- constructor(binding) {
27
- _ContextModuleFactoryBeforeResolveData_inner.set(this, void 0);
28
- __classPrivateFieldSet(this, _ContextModuleFactoryBeforeResolveData_inner, binding, "f");
29
- Object.defineProperties(this, {
30
- context: {
31
- enumerable: true,
32
- get() {
33
- return binding.context;
34
- },
35
- set(val) {
36
- binding.context = val;
37
- }
38
- },
39
- request: {
40
- enumerable: true,
41
- get() {
42
- return binding.request;
43
- },
44
- set(val) {
45
- binding.request = val;
46
- }
47
- },
48
- regExp: {
49
- enumerable: true,
50
- get() {
51
- if (!binding.regExp) {
52
- return undefined;
53
- }
54
- const { source, flags } = binding.regExp;
55
- return new RegExp(source, flags);
56
- },
57
- set(val) {
58
- if (!val) {
59
- binding.regExp = undefined;
60
- return;
61
- }
62
- binding.regExp = {
63
- source: val.source,
64
- flags: val.flags
65
- };
66
- }
67
- },
68
- recursive: {
69
- enumerable: true,
70
- get() {
71
- return binding.recursive;
72
- },
73
- set(val) {
74
- binding.recursive = val;
75
- }
76
- }
77
- });
78
- }
79
- }
80
- exports.ContextModuleFactoryBeforeResolveData = ContextModuleFactoryBeforeResolveData;
81
- _ContextModuleFactoryBeforeResolveData_inner = new WeakMap();
82
- class ContextModuleFactoryAfterResolveData {
83
- static __from_binding(binding) {
84
- return new ContextModuleFactoryAfterResolveData(binding);
85
- }
86
- static __to_binding(data) {
87
- return __classPrivateFieldGet(data, _ContextModuleFactoryAfterResolveData_inner, "f");
88
- }
89
- constructor(binding) {
90
- _ContextModuleFactoryAfterResolveData_inner.set(this, void 0);
91
- __classPrivateFieldSet(this, _ContextModuleFactoryAfterResolveData_inner, binding, "f");
92
- Object.defineProperties(this, {
93
- resource: {
94
- enumerable: true,
95
- get() {
96
- return binding.resource;
97
- },
98
- set(val) {
99
- binding.resource = val;
100
- }
101
- },
102
- context: {
103
- enumerable: true,
104
- get() {
105
- return binding.context;
106
- },
107
- set(val) {
108
- binding.context = val;
109
- }
110
- },
111
- request: {
112
- enumerable: true,
113
- get() {
114
- return binding.request;
115
- },
116
- set(val) {
117
- binding.request = val;
118
- }
119
- },
120
- regExp: {
121
- enumerable: true,
122
- get() {
123
- if (!binding.regExp) {
124
- return undefined;
125
- }
126
- const { source, flags } = binding.regExp;
127
- return new RegExp(source, flags);
128
- },
129
- set(val) {
130
- if (!val) {
131
- binding.regExp = undefined;
132
- return;
133
- }
134
- binding.regExp = {
135
- source: val.source,
136
- flags: val.flags
137
- };
138
- }
139
- },
140
- recursive: {
141
- enumerable: true,
142
- get() {
143
- return binding.recursive;
144
- },
145
- set(val) {
146
- binding.recursive = val;
147
- }
148
- },
149
- dependencies: {
150
- enumerable: true,
151
- get() {
152
- return binding.dependencies.map(dep => Dependency_1.Dependency.__from_binding(dep));
153
- }
154
- }
155
- });
156
- }
157
- }
158
- exports.ContextModuleFactoryAfterResolveData = ContextModuleFactoryAfterResolveData;
159
- _ContextModuleFactoryAfterResolveData_inner = new WeakMap();
160
- class Module {
161
- static __from_binding(module, compilation) {
162
- return new Module(module, compilation);
163
- }
164
- constructor(module, compilation) {
165
- _Module_inner.set(this, void 0);
166
- _Module_originalSource.set(this, void 0);
167
- __classPrivateFieldSet(this, _Module_inner, module, "f");
168
- this.type = module.type;
169
- this.layer = module.layer ?? null;
170
- this.context = module.context;
171
- this.resource = module.resource;
172
- this.request = module.request;
173
- this.userRequest = module.userRequest;
174
- this.rawRequest = module.rawRequest;
175
- this.factoryMeta = module.factoryMeta;
176
- const customModule = compilation?.__internal__getCustomModule(module.moduleIdentifier);
177
- this.buildInfo = customModule?.buildInfo || {};
178
- this.buildMeta = customModule?.buildMeta || {};
179
- }
180
- originalSource() {
181
- if (__classPrivateFieldGet(this, _Module_originalSource, "f"))
182
- return __classPrivateFieldGet(this, _Module_originalSource, "f");
183
- if (__classPrivateFieldGet(this, _Module_inner, "f").originalSource) {
184
- __classPrivateFieldSet(this, _Module_originalSource, source_1.JsSource.__from_binding(__classPrivateFieldGet(this, _Module_inner, "f").originalSource), "f");
185
- return __classPrivateFieldGet(this, _Module_originalSource, "f");
186
- }
187
- return null;
188
- }
189
- identifier() {
190
- return __classPrivateFieldGet(this, _Module_inner, "f").moduleIdentifier;
191
- }
192
- nameForCondition() {
193
- if (typeof __classPrivateFieldGet(this, _Module_inner, "f").nameForCondition === "string") {
194
- return __classPrivateFieldGet(this, _Module_inner, "f").nameForCondition;
195
- }
196
- return null;
197
- }
198
- get blocks() {
199
- if ("blocks" in __classPrivateFieldGet(this, _Module_inner, "f")) {
200
- return __classPrivateFieldGet(this, _Module_inner, "f").blocks.map(b => new DependenciesBlock_1.DependenciesBlock(b));
201
- }
202
- return [];
203
- }
204
- size(type) {
205
- if ("size" in __classPrivateFieldGet(this, _Module_inner, "f")) {
206
- return __classPrivateFieldGet(this, _Module_inner, "f").size(type);
207
- }
208
- return 0;
209
- }
210
- }
211
- exports.Module = Module;
212
- _Module_inner = new WeakMap(), _Module_originalSource = new WeakMap();
213
- class CodeGenerationResult {
214
- constructor(result) {
215
- _CodeGenerationResult_inner.set(this, void 0);
216
- __classPrivateFieldSet(this, _CodeGenerationResult_inner, result, "f");
217
- }
218
- get(sourceType) {
219
- return __classPrivateFieldGet(this, _CodeGenerationResult_inner, "f").sources[sourceType];
220
- }
221
- }
222
- exports.CodeGenerationResult = CodeGenerationResult;
223
- _CodeGenerationResult_inner = new WeakMap();
224
- class CodeGenerationResults {
225
- }
226
- 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";