@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,20 +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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./adapter"), exports);
18
- __exportStar(require("./defaults"), exports);
19
- __exportStar(require("./normalization"), exports);
20
- __exportStar(require("./zod"), exports);
@@ -1,299 +0,0 @@
1
- "use strict";
2
- /**
3
- * The following code is modified based on
4
- * https://github.com/webpack/webpack/blob/4b4ca3b/lib/config/normalization.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.getNormalizedRspackOptions = void 0;
13
- const getNormalizedRspackOptions = (config) => {
14
- return {
15
- ignoreWarnings: config.ignoreWarnings !== undefined
16
- ? config.ignoreWarnings.map(ignore => {
17
- if (typeof ignore === "function") {
18
- return ignore;
19
- }
20
- return (warning) => {
21
- return ignore.test(warning.message);
22
- };
23
- })
24
- : undefined,
25
- name: config.name,
26
- dependencies: config.dependencies,
27
- context: config.context,
28
- mode: config.mode,
29
- entry: config.entry === undefined
30
- ? { main: {} }
31
- : typeof config.entry === "function"
32
- ? (fn => () => Promise.resolve().then(fn).then(getNormalizedEntryStatic))(config.entry)
33
- : getNormalizedEntryStatic(config.entry),
34
- output: nestedConfig(config.output, output => {
35
- const { library } = output;
36
- const libraryAsName = library;
37
- const libraryBase = typeof library === "object" &&
38
- library &&
39
- !Array.isArray(library) &&
40
- "type" in library
41
- ? library
42
- : libraryAsName || output.libraryTarget
43
- ? {
44
- name: libraryAsName
45
- }
46
- : undefined;
47
- return {
48
- path: output.path,
49
- pathinfo: output.pathinfo,
50
- publicPath: output.publicPath,
51
- filename: output.filename,
52
- clean: output.clean,
53
- chunkFormat: output.chunkFormat,
54
- chunkLoading: output.chunkLoading,
55
- chunkFilename: output.chunkFilename,
56
- crossOriginLoading: output.crossOriginLoading,
57
- cssHeadDataCompression: output.cssHeadDataCompression,
58
- cssFilename: output.cssFilename,
59
- cssChunkFilename: output.cssChunkFilename,
60
- hotUpdateMainFilename: output.hotUpdateMainFilename,
61
- hotUpdateChunkFilename: output.hotUpdateChunkFilename,
62
- hotUpdateGlobal: output.hotUpdateGlobal,
63
- assetModuleFilename: output.assetModuleFilename,
64
- wasmLoading: output.wasmLoading,
65
- enabledChunkLoadingTypes: output.enabledChunkLoadingTypes
66
- ? [...output.enabledChunkLoadingTypes]
67
- : ["..."],
68
- enabledWasmLoadingTypes: output.enabledWasmLoadingTypes
69
- ? [...output.enabledWasmLoadingTypes]
70
- : ["..."],
71
- webassemblyModuleFilename: output.webassemblyModuleFilename,
72
- uniqueName: output.uniqueName,
73
- chunkLoadingGlobal: output.chunkLoadingGlobal,
74
- enabledLibraryTypes: output.enabledLibraryTypes
75
- ? [...output.enabledLibraryTypes]
76
- : ["..."],
77
- globalObject: output.globalObject,
78
- importFunctionName: output.importFunctionName,
79
- importMetaName: output.importMetaName,
80
- iife: output.iife,
81
- module: output.module,
82
- sourceMapFilename: output.sourceMapFilename,
83
- library: libraryBase && {
84
- type: output.libraryTarget !== undefined
85
- ? output.libraryTarget
86
- : libraryBase.type,
87
- auxiliaryComment: output.auxiliaryComment !== undefined
88
- ? output.auxiliaryComment
89
- : libraryBase.auxiliaryComment,
90
- amdContainer: libraryBase.amdContainer,
91
- export: output.libraryExport !== undefined
92
- ? output.libraryExport
93
- : libraryBase.export,
94
- name: libraryBase.name,
95
- umdNamedDefine: output.umdNamedDefine !== undefined
96
- ? output.umdNamedDefine
97
- : libraryBase.umdNamedDefine
98
- },
99
- strictModuleErrorHandling: output.strictModuleErrorHandling ??
100
- output.strictModuleExceptionHandling,
101
- trustedTypes: optionalNestedConfig(output.trustedTypes, trustedTypes => {
102
- if (trustedTypes === true)
103
- return {};
104
- if (typeof trustedTypes === "string")
105
- return { policyName: trustedTypes };
106
- return { ...trustedTypes };
107
- }),
108
- hashDigest: output.hashDigest,
109
- hashDigestLength: output.hashDigestLength,
110
- hashFunction: output.hashFunction,
111
- hashSalt: output.hashSalt,
112
- asyncChunks: output.asyncChunks,
113
- workerChunkLoading: output.workerChunkLoading,
114
- workerWasmLoading: output.workerWasmLoading,
115
- workerPublicPath: output.workerPublicPath,
116
- scriptType: output.scriptType,
117
- devtoolNamespace: output.devtoolNamespace,
118
- devtoolModuleFilenameTemplate: output.devtoolModuleFilenameTemplate,
119
- devtoolFallbackModuleFilenameTemplate: output.devtoolFallbackModuleFilenameTemplate,
120
- chunkLoadTimeout: output.chunkLoadTimeout,
121
- charset: output.charset,
122
- environment: cloneObject(output.environment)
123
- };
124
- }),
125
- resolve: nestedConfig(config.resolve, resolve => ({
126
- ...resolve,
127
- tsConfig: optionalNestedConfig(resolve.tsConfig, tsConfig => {
128
- return typeof tsConfig === "string"
129
- ? { configFile: tsConfig }
130
- : tsConfig;
131
- })
132
- })),
133
- resolveLoader: nestedConfig(config.resolveLoader, resolve => ({
134
- ...resolve,
135
- tsConfig: optionalNestedConfig(resolve.tsConfig, tsConfig => {
136
- return typeof tsConfig === "string"
137
- ? { configFile: tsConfig }
138
- : tsConfig;
139
- })
140
- })),
141
- module: nestedConfig(config.module, module => ({
142
- noParse: module.noParse,
143
- parser: keyedNestedConfig(module.parser, cloneObject, {}),
144
- generator: keyedNestedConfig(module.generator, cloneObject, {}),
145
- defaultRules: optionalNestedArray(module.defaultRules, r => [...r]),
146
- rules: nestedArray(module.rules, r => [...r])
147
- })),
148
- target: config.target,
149
- externals: config.externals,
150
- externalsType: config.externalsType,
151
- externalsPresets: cloneObject(config.externalsPresets),
152
- infrastructureLogging: cloneObject(config.infrastructureLogging),
153
- devtool: config.devtool,
154
- node: nestedConfig(config.node, node => node && {
155
- ...node
156
- }),
157
- loader: cloneObject(config.loader),
158
- snapshot: nestedConfig(config.snapshot, _snapshot => ({})),
159
- cache: optionalNestedConfig(config.cache, cache => cache),
160
- stats: nestedConfig(config.stats, stats => {
161
- if (stats === false) {
162
- return {
163
- preset: "none"
164
- };
165
- }
166
- if (stats === true) {
167
- return {
168
- preset: "normal"
169
- };
170
- }
171
- if (typeof stats === "string") {
172
- return {
173
- preset: stats
174
- };
175
- }
176
- return {
177
- ...stats
178
- };
179
- }),
180
- optimization: nestedConfig(config.optimization, optimization => {
181
- return {
182
- ...optimization,
183
- runtimeChunk: getNormalizedOptimizationRuntimeChunk(optimization.runtimeChunk),
184
- splitChunks: nestedConfig(optimization.splitChunks, splitChunks => splitChunks && {
185
- ...splitChunks,
186
- defaultSizeTypes: splitChunks.defaultSizeTypes
187
- ? [...splitChunks.defaultSizeTypes]
188
- : ["..."],
189
- cacheGroups: cloneObject(splitChunks.cacheGroups)
190
- })
191
- };
192
- }),
193
- performance: config.performance,
194
- plugins: nestedArray(config.plugins, p => [...p]),
195
- experiments: nestedConfig(config.experiments, experiments => ({
196
- ...experiments,
197
- lazyCompilation: optionalNestedConfig(experiments.lazyCompilation, options => (options === true ? {} : options)),
198
- incremental: optionalNestedConfig(experiments.incremental, options => options === true ? {} : options)
199
- })),
200
- watch: config.watch,
201
- watchOptions: cloneObject(config.watchOptions),
202
- devServer: config.devServer,
203
- profile: config.profile,
204
- bail: config.bail
205
- };
206
- };
207
- exports.getNormalizedRspackOptions = getNormalizedRspackOptions;
208
- const getNormalizedEntryStatic = (entry) => {
209
- if (typeof entry === "string") {
210
- return {
211
- main: {
212
- import: [entry]
213
- }
214
- };
215
- }
216
- if (Array.isArray(entry)) {
217
- return {
218
- main: {
219
- import: entry
220
- }
221
- };
222
- }
223
- const result = {};
224
- for (const key of Object.keys(entry)) {
225
- const value = entry[key];
226
- if (typeof value === "string") {
227
- result[key] = {
228
- import: [value]
229
- };
230
- }
231
- else if (Array.isArray(value)) {
232
- result[key] = {
233
- import: value
234
- };
235
- }
236
- else {
237
- result[key] = {
238
- import: Array.isArray(value.import) ? value.import : [value.import],
239
- runtime: value.runtime,
240
- publicPath: value.publicPath,
241
- baseUri: value.baseUri,
242
- chunkLoading: value.chunkLoading,
243
- asyncChunks: value.asyncChunks,
244
- filename: value.filename,
245
- library: value.library,
246
- layer: value.layer,
247
- dependOn: Array.isArray(value.dependOn)
248
- ? value.dependOn
249
- : value.dependOn
250
- ? [value.dependOn]
251
- : undefined
252
- };
253
- }
254
- }
255
- return result;
256
- };
257
- const getNormalizedOptimizationRuntimeChunk = (runtimeChunk) => {
258
- if (runtimeChunk === undefined)
259
- return undefined;
260
- if (runtimeChunk === false)
261
- return false;
262
- if (runtimeChunk === "single") {
263
- return {
264
- name: "single"
265
- };
266
- }
267
- if (runtimeChunk === true || runtimeChunk === "multiple") {
268
- return {
269
- name: "multiple"
270
- };
271
- }
272
- if (runtimeChunk.name) {
273
- const opts = {
274
- name: runtimeChunk.name
275
- };
276
- return opts;
277
- }
278
- };
279
- const nestedConfig = (value, fn) => value === undefined ? fn({}) : fn(value);
280
- const optionalNestedConfig = (value, fn) => (value === undefined ? undefined : fn(value));
281
- const nestedArray = (value, fn) => Array.isArray(value) ? fn(value) : fn([]);
282
- const optionalNestedArray = (value, fn) => (Array.isArray(value) ? fn(value) : undefined);
283
- const cloneObject = (value) => ({ ...value });
284
- const keyedNestedConfig = (value, fn, customKeys) => {
285
- const result = value === undefined
286
- ? {}
287
- : Object.keys(value).reduce((obj, key) => {
288
- obj[key] = (customKeys && key in customKeys ? customKeys[key] : fn)(value[key]);
289
- return obj;
290
- }, {});
291
- if (customKeys) {
292
- for (const key of Object.keys(customKeys)) {
293
- if (!(key in result)) {
294
- result[key] = customKeys[key]({});
295
- }
296
- }
297
- }
298
- return result;
299
- };
@@ -1,318 +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.getTargetsProperties = exports.getTargetProperties = exports.getDefaultTarget = void 0;
27
- /**
28
- * The following code is modified based on
29
- * https://github.com/webpack/webpack/blob/4b4ca3b/lib/config/target.js
30
- *
31
- * MIT Licensed
32
- * Author Tobias Koppers @sokra
33
- * Copyright (c) JS Foundation and other contributors
34
- * https://github.com/webpack/webpack/blob/main/LICENSE
35
- */
36
- const memoize_1 = require("../util/memoize");
37
- const browserslistTargetHandler = __importStar(require("./browserslistTargetHandler"));
38
- const getBrowserslistTargetHandler = (0, memoize_1.memoize)(() => browserslistTargetHandler);
39
- /**
40
- * @param context the context directory
41
- * @returns default target
42
- */
43
- const getDefaultTarget = (context) => {
44
- const browsers = getBrowserslistTargetHandler().load(null, context);
45
- return browsers ? "browserslist" : "web";
46
- };
47
- exports.getDefaultTarget = getDefaultTarget;
48
- /**
49
- * @param major major version
50
- * @param minor minor version
51
- * @returns check if version is greater or equal
52
- */
53
- const versionDependent = (major, minor) => {
54
- if (!major) {
55
- return () => undefined;
56
- }
57
- const nMajor = +major;
58
- const nMinor = minor ? +minor : 0;
59
- return (vMajor, vMinor = 0) => {
60
- return nMajor > vMajor || (nMajor === vMajor && nMinor >= vMinor);
61
- };
62
- };
63
- const TARGETS = [
64
- [
65
- "browserslist / browserslist:env / browserslist:query / browserslist:path-to-config / browserslist:path-to-config:env",
66
- "Resolve features from browserslist. Will resolve browserslist config automatically. Only browser or node queries are supported (electron is not supported). Examples: 'browserslist:modern' to use 'modern' environment from browserslist config",
67
- /^browserslist(?::(.+))?$/,
68
- (rest, context) => {
69
- const browserslistTargetHandler = getBrowserslistTargetHandler();
70
- const browsers = browserslistTargetHandler.load(rest ? rest.trim() : null, context);
71
- if (!browsers) {
72
- throw new Error(`No browserslist config found to handle the 'browserslist' target.
73
- See https://github.com/browserslist/browserslist#queries for possible ways to provide a config.
74
- The recommended way is to add a 'browserslist' key to your package.json and list supported browsers (resp. node.js versions).
75
- You can also more options via the 'target' option: 'browserslist' / 'browserslist:env' / 'browserslist:query' / 'browserslist:path-to-config' / 'browserslist:path-to-config:env'`);
76
- }
77
- return browserslistTargetHandler.resolve(browsers);
78
- }
79
- ],
80
- [
81
- "web",
82
- "Web browser.",
83
- /^web$/,
84
- () => {
85
- return {
86
- web: true,
87
- browser: true,
88
- webworker: null,
89
- node: false,
90
- electron: false,
91
- nwjs: false,
92
- document: true,
93
- importScriptsInWorker: true,
94
- fetchWasm: true,
95
- nodeBuiltins: false,
96
- importScripts: false,
97
- require: false,
98
- global: false
99
- };
100
- }
101
- ],
102
- [
103
- "webworker",
104
- "Web Worker, SharedWorker or Service Worker.",
105
- /^webworker$/,
106
- () => {
107
- return {
108
- web: true,
109
- browser: true,
110
- webworker: true,
111
- node: false,
112
- electron: false,
113
- nwjs: false,
114
- importScripts: true,
115
- importScriptsInWorker: true,
116
- fetchWasm: true,
117
- nodeBuiltins: false,
118
- require: false,
119
- document: false,
120
- global: false
121
- };
122
- }
123
- ],
124
- [
125
- "[async-]node[X[.Y]]",
126
- "Node.js in version X.Y. The 'async-' prefix will load chunks asynchronously via 'fs' and 'vm' instead of 'require()'. Examples: node14.5, async-node10.",
127
- /^(async-)?node((\d+)(?:\.(\d+))?)?$/,
128
- (asyncFlag, _, major, minor) => {
129
- const v = versionDependent(major, minor);
130
- // see https://node.green/
131
- return {
132
- node: true,
133
- electron: false,
134
- nwjs: false,
135
- web: false,
136
- webworker: false,
137
- browser: false,
138
- require: !asyncFlag,
139
- nodeBuiltins: true,
140
- // v16.0.0, v14.18.0
141
- nodePrefixForCoreModules: +major < 15 ? v(14, 18) : v(16),
142
- global: true,
143
- document: false,
144
- fetchWasm: false,
145
- importScripts: false,
146
- importScriptsInWorker: false,
147
- globalThis: v(12),
148
- const: v(6),
149
- templateLiteral: v(4),
150
- optionalChaining: v(14),
151
- arrowFunction: v(6),
152
- asyncFunction: v(7, 6),
153
- forOf: v(5),
154
- destructuring: v(6),
155
- bigIntLiteral: v(10, 4),
156
- dynamicImport: v(12, 17),
157
- dynamicImportInWorker: major ? false : undefined,
158
- module: v(12, 17)
159
- };
160
- }
161
- ],
162
- [
163
- "electron[X[.Y]]-main/preload/renderer",
164
- "Electron in version X.Y. Script is running in main, preload resp. renderer context.",
165
- /^electron((\d+)(?:\.(\d+))?)?-(main|preload|renderer)$/,
166
- (_, major, minor, context) => {
167
- const v = versionDependent(major, minor);
168
- // see https://node.green/ + https://github.com/electron/releases
169
- return {
170
- node: true,
171
- electron: true,
172
- web: context !== "main",
173
- webworker: false,
174
- browser: false,
175
- nwjs: false,
176
- electronMain: context === "main",
177
- electronPreload: context === "preload",
178
- electronRenderer: context === "renderer",
179
- global: true,
180
- nodeBuiltins: true,
181
- // 15.0.0 - Node.js v16.5
182
- // 14.0.0 - Mode.js v14.17, but prefixes only since v14.18
183
- nodePrefixForCoreModules: v(15),
184
- require: true,
185
- document: context === "renderer",
186
- fetchWasm: context === "renderer",
187
- importScripts: false,
188
- importScriptsInWorker: true,
189
- globalThis: v(5),
190
- const: v(1, 1),
191
- templateLiteral: v(1, 1),
192
- optionalChaining: v(8),
193
- arrowFunction: v(1, 1),
194
- asyncFunction: v(1, 7),
195
- forOf: v(0, 36),
196
- destructuring: v(1, 1),
197
- bigIntLiteral: v(4),
198
- dynamicImport: v(11),
199
- dynamicImportInWorker: major ? false : undefined,
200
- module: v(11)
201
- };
202
- }
203
- ],
204
- [
205
- "nwjs[X[.Y]] / node-webkit[X[.Y]]",
206
- "NW.js in version X.Y.",
207
- /^(?:nwjs|node-webkit)((\d+)(?:\.(\d+))?)?$/,
208
- (_, major, minor) => {
209
- const v = versionDependent(major, minor);
210
- // see https://node.green/ + https://github.com/nwjs/nw.js/blob/nw48/CHANGELOG.md
211
- return {
212
- node: true,
213
- web: true,
214
- nwjs: true,
215
- webworker: null,
216
- browser: false,
217
- electron: false,
218
- global: true,
219
- nodeBuiltins: true,
220
- document: false,
221
- importScriptsInWorker: false,
222
- fetchWasm: false,
223
- importScripts: false,
224
- require: false,
225
- globalThis: v(0, 43),
226
- const: v(0, 15),
227
- templateLiteral: v(0, 13),
228
- optionalChaining: v(0, 44),
229
- arrowFunction: v(0, 15),
230
- asyncFunction: v(0, 21),
231
- forOf: v(0, 13),
232
- destructuring: v(0, 15),
233
- bigIntLiteral: v(0, 32),
234
- dynamicImport: v(0, 43),
235
- dynamicImportInWorker: major ? false : undefined,
236
- module: v(0, 43)
237
- };
238
- }
239
- ],
240
- [
241
- "esX",
242
- "EcmaScript in this version. Examples: es2020, es5.",
243
- /^es(\d+)$/,
244
- version => {
245
- let v = +version;
246
- if (v < 1000)
247
- v = v + 2009;
248
- return {
249
- const: v >= 2015,
250
- templateLiteral: v >= 2015,
251
- optionalChaining: v >= 2020,
252
- arrowFunction: v >= 2015,
253
- forOf: v >= 2015,
254
- destructuring: v >= 2015,
255
- module: v >= 2015,
256
- asyncFunction: v >= 2017,
257
- globalThis: v >= 2020,
258
- bigIntLiteral: v >= 2020,
259
- dynamicImport: v >= 2020,
260
- dynamicImportInWorker: v >= 2020
261
- };
262
- }
263
- ]
264
- ];
265
- /**
266
- * @param target the target
267
- * @param context the context directory
268
- * @returns target properties
269
- */
270
- const getTargetProperties = (target, context) => {
271
- for (const [, , regExp, handler] of TARGETS) {
272
- const match = regExp.exec(target);
273
- if (match) {
274
- const [, ...args] = match;
275
- const result = handler(...args, context);
276
- if (result)
277
- return result;
278
- }
279
- }
280
- throw new Error(`Unknown target '${target}'. The following targets are supported:\n${TARGETS.map(([name, description]) => `* ${name}: ${description}`).join("\n")}`);
281
- };
282
- exports.getTargetProperties = getTargetProperties;
283
- const mergeTargetProperties = (targetProperties) => {
284
- const keys = new Set();
285
- for (const tp of targetProperties) {
286
- for (const key of Object.keys(tp)) {
287
- keys.add(key);
288
- }
289
- }
290
- const result = {};
291
- for (const key of keys) {
292
- let hasTrue = false;
293
- let hasFalse = false;
294
- for (const tp of targetProperties) {
295
- const value = tp[key];
296
- switch (value) {
297
- case true:
298
- hasTrue = true;
299
- break;
300
- case false:
301
- hasFalse = true;
302
- break;
303
- }
304
- }
305
- if (hasTrue || hasFalse)
306
- result[key] = hasFalse && hasTrue ? null : hasTrue;
307
- }
308
- return result;
309
- };
310
- /**
311
- * @param targets the targets
312
- * @param context the context directory
313
- * @returns target properties
314
- */
315
- const getTargetsProperties = (targets, context) => {
316
- return mergeTargetProperties(targets.map(t => (0, exports.getTargetProperties)(t, context)));
317
- };
318
- exports.getTargetsProperties = getTargetsProperties;
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //#endregion