@rspack/core 1.0.10 → 1.0.12

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/compiled/browserslist/index.js +94 -49
  2. package/compiled/browserslist/package.json +1 -1
  3. package/dist/builtin-plugin/css-extract/utils.d.ts +1 -0
  4. package/dist/config/types.d.ts +309 -0
  5. package/dist/config/zod.d.ts +22 -534
  6. package/dist/cssExtractHmr.js +224 -0
  7. package/dist/cssExtractLoader.js +277 -0
  8. package/dist/index.js +23255 -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 -925
  29. package/dist/ContextModuleFactory.js +0 -36
  30. package/dist/DependenciesBlock.js +0 -30
  31. package/dist/Dependency.js +0 -43
  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 -226
  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 -1030
  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,175 +0,0 @@
1
- "use strict";
2
- // code modified based on https://github.com/parcel-bundler/lightningcss/blob/34b67a431c043fda5d4979bcdccb3008d082e243/node/browserslistToTargets.js
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Features = exports.toFeatures = exports.browserslistToTargets = void 0;
5
- /**
6
- MIT License
7
-
8
- Copyright (c) 2021-present Devon Govett
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
- */
28
- const BROWSER_MAPPING = {
29
- and_chr: "chrome",
30
- and_ff: "firefox",
31
- ie_mob: "ie",
32
- op_mob: "opera",
33
- and_qq: null,
34
- and_uc: null,
35
- baidu: null,
36
- bb: null,
37
- kaios: null,
38
- op_mini: null
39
- };
40
- function browserslistToTargets(browserslist) {
41
- const targets = {};
42
- for (const browser of browserslist) {
43
- const [name, v] = browser.split(" ");
44
- if (BROWSER_MAPPING[name] === null) {
45
- continue;
46
- }
47
- const version = parseVersion(v);
48
- if (version == null) {
49
- continue;
50
- }
51
- if (targets[name] == null || version < targets[name]) {
52
- targets[name] = version;
53
- }
54
- }
55
- return targets;
56
- }
57
- exports.browserslistToTargets = browserslistToTargets;
58
- function toFeatures(featureOptions) {
59
- let feature = 0;
60
- for (const key of Reflect.ownKeys(featureOptions)) {
61
- if (featureOptions[key] !== true) {
62
- continue;
63
- }
64
- switch (key) {
65
- case "nesting":
66
- feature |= Features.Nesting;
67
- break;
68
- case "notSelectorList":
69
- feature |= Features.NotSelectorList;
70
- break;
71
- case "dirSelector":
72
- feature |= Features.DirSelector;
73
- break;
74
- case "langSelectorList":
75
- feature |= Features.LangSelectorList;
76
- break;
77
- case "isSelector":
78
- feature |= Features.IsSelector;
79
- break;
80
- case "textDecorationThicknessPercent":
81
- feature |= Features.TextDecorationThicknessPercent;
82
- break;
83
- case "mediaIntervalSyntax":
84
- feature |= Features.MediaIntervalSyntax;
85
- break;
86
- case "mediaRangeSyntax":
87
- feature |= Features.MediaRangeSyntax;
88
- break;
89
- case "customMediaQueries":
90
- feature |= Features.CustomMediaQueries;
91
- break;
92
- case "clampFunction":
93
- feature |= Features.ClampFunction;
94
- break;
95
- case "colorFunction":
96
- feature |= Features.ColorFunction;
97
- break;
98
- case "oklabColors":
99
- feature |= Features.OklabColors;
100
- break;
101
- case "labColors":
102
- feature |= Features.LabColors;
103
- break;
104
- case "p3Colors":
105
- feature |= Features.P3Colors;
106
- break;
107
- case "hexAlphaColors":
108
- feature |= Features.HexAlphaColors;
109
- break;
110
- case "spaceSeparatedColorNotation":
111
- feature |= Features.SpaceSeparatedColorNotation;
112
- break;
113
- case "fontFamilySystemUi":
114
- feature |= Features.FontFamilySystemUi;
115
- break;
116
- case "doublePositionGradients":
117
- feature |= Features.DoublePositionGradients;
118
- break;
119
- case "vendorPrefixes":
120
- feature |= Features.VendorPrefixes;
121
- break;
122
- case "logicalProperties":
123
- feature |= Features.LogicalProperties;
124
- break;
125
- case "selectors":
126
- feature |= Features.Selectors;
127
- break;
128
- case "mediaQueries":
129
- feature |= Features.MediaQueries;
130
- break;
131
- case "color":
132
- feature |= Features.Color;
133
- break;
134
- }
135
- }
136
- return feature;
137
- }
138
- exports.toFeatures = toFeatures;
139
- function parseVersion(version) {
140
- const [major, minor = 0, patch = 0] = version
141
- .split("-")[0]
142
- .split(".")
143
- .map(v => Number.parseInt(v, 10));
144
- if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch)) {
145
- return null;
146
- }
147
- return (major << 16) | (minor << 8) | patch;
148
- }
149
- var Features;
150
- (function (Features) {
151
- Features[Features["Empty"] = 0] = "Empty";
152
- Features[Features["Nesting"] = 1] = "Nesting";
153
- Features[Features["NotSelectorList"] = 2] = "NotSelectorList";
154
- Features[Features["DirSelector"] = 4] = "DirSelector";
155
- Features[Features["LangSelectorList"] = 8] = "LangSelectorList";
156
- Features[Features["IsSelector"] = 16] = "IsSelector";
157
- Features[Features["TextDecorationThicknessPercent"] = 32] = "TextDecorationThicknessPercent";
158
- Features[Features["MediaIntervalSyntax"] = 64] = "MediaIntervalSyntax";
159
- Features[Features["MediaRangeSyntax"] = 128] = "MediaRangeSyntax";
160
- Features[Features["CustomMediaQueries"] = 256] = "CustomMediaQueries";
161
- Features[Features["ClampFunction"] = 512] = "ClampFunction";
162
- Features[Features["ColorFunction"] = 1024] = "ColorFunction";
163
- Features[Features["OklabColors"] = 2048] = "OklabColors";
164
- Features[Features["LabColors"] = 4096] = "LabColors";
165
- Features[Features["P3Colors"] = 8192] = "P3Colors";
166
- Features[Features["HexAlphaColors"] = 16384] = "HexAlphaColors";
167
- Features[Features["SpaceSeparatedColorNotation"] = 32768] = "SpaceSeparatedColorNotation";
168
- Features[Features["FontFamilySystemUi"] = 65536] = "FontFamilySystemUi";
169
- Features[Features["DoublePositionGradients"] = 131072] = "DoublePositionGradients";
170
- Features[Features["VendorPrefixes"] = 262144] = "VendorPrefixes";
171
- Features[Features["LogicalProperties"] = 524288] = "LogicalProperties";
172
- Features[Features["Selectors"] = 31] = "Selectors";
173
- Features[Features["MediaQueries"] = 448] = "MediaQueries";
174
- Features[Features["Color"] = 64512] = "Color";
175
- })(Features = exports.Features || (exports.Features = {}));
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolvePluginImport = void 0;
4
- var pluginImport_1 = require("./pluginImport");
5
- Object.defineProperty(exports, "resolvePluginImport", { enumerable: true, get: function () { return pluginImport_1.resolvePluginImport; } });
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolvePluginImport = void 0;
4
- function isObject(val) {
5
- return Object.prototype.toString.call(val) === "[object Object]";
6
- }
7
- function resolvePluginImport(pluginImport) {
8
- if (!pluginImport) {
9
- return undefined;
10
- }
11
- return pluginImport.map(config => {
12
- const rawConfig = {
13
- ...config,
14
- style: {} // As babel-plugin-import style config is very flexible, we convert it to a more specific structure
15
- };
16
- if (typeof config.style === "boolean") {
17
- rawConfig.style.bool = config.style;
18
- }
19
- else if (typeof config.style === "string") {
20
- const isTpl = config.style.includes("{{");
21
- rawConfig.style[isTpl ? "custom" : "css"] = config.style;
22
- }
23
- else if (isObject(config.style)) {
24
- // for child compiler
25
- // see https://github.com/web-infra-dev/rspack/issues/4597
26
- rawConfig.style = config.style;
27
- }
28
- // This option will overrides the behavior of style
29
- if (config.styleLibraryDirectory) {
30
- rawConfig.style = { styleLibraryDirectory: config.styleLibraryDirectory };
31
- }
32
- return rawConfig;
33
- });
34
- }
35
- exports.resolvePluginImport = resolvePluginImport;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveReact = void 0;
4
- function resolveReact(react) {
5
- return react ?? {};
6
- }
7
- exports.resolveReact = resolveReact;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.APIPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.APIPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.APIPlugin, () => { });
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ArrayPushCallbackChunkFormatPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.ArrayPushCallbackChunkFormatPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.ArrayPushCallbackChunkFormatPlugin, () => { });
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AssetModulesPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.AssetModulesPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.AssetModulesPlugin, () => { }, "compilation");
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AsyncWebAssemblyModulesPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.AsyncWebAssemblyModulesPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.AsyncWebAssemblyModulesPlugin, () => { }, "compilation");
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BannerPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.BannerPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.BannerPlugin, (args) => {
7
- if (typeof args === "string" || typeof args === "function") {
8
- return {
9
- banner: args
10
- };
11
- }
12
- return {
13
- banner: args.banner,
14
- entryOnly: args.entryOnly,
15
- footer: args.footer,
16
- raw: args.raw,
17
- test: args.test,
18
- stage: args.stage,
19
- include: args.include,
20
- exclude: args.exclude
21
- };
22
- });
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BundlerInfoRspackPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.BundlerInfoRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.BundlerInfoRspackPlugin, (options) => {
7
- return {
8
- version: options.version || "unknown",
9
- bundler: options.bundler || "rspack",
10
- force: options.force ?? true
11
- };
12
- });
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChunkPrefetchPreloadPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.ChunkPrefetchPreloadPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.ChunkPrefetchPreloadPlugin, () => { });
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommonJsChunkFormatPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.CommonJsChunkFormatPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.CommonJsChunkFormatPlugin, () => { });
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContextReplacementPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.ContextReplacementPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.ContextReplacementPlugin, (resourceRegExp, newContentResource, newContentRecursive, newContentRegExp) => {
7
- const rawOptions = {
8
- resourceRegExp
9
- };
10
- if (typeof newContentResource === "function") {
11
- // rawOptions.newContentCallback = newContentResource;
12
- }
13
- else if (typeof newContentResource === "string" &&
14
- typeof newContentRecursive === "object") {
15
- rawOptions.newContentResource = newContentResource;
16
- rawOptions.newContentCreateContextMap = newContentRecursive;
17
- }
18
- else if (typeof newContentResource === "string" &&
19
- typeof newContentRecursive === "function") {
20
- rawOptions.newContentResource = newContentResource;
21
- // rawOptions.newContentCreateContextMap = newContentRecursive;
22
- }
23
- else {
24
- if (typeof newContentResource !== "string") {
25
- // biome-ignore lint/style/noParameterAssign: based on webpack's logic
26
- newContentRegExp = newContentRecursive;
27
- // biome-ignore lint/style/noParameterAssign: based on webpack's logic
28
- newContentRecursive = newContentResource;
29
- // biome-ignore lint/style/noParameterAssign: based on webpack's logic
30
- newContentResource = undefined;
31
- }
32
- if (typeof newContentRecursive !== "boolean") {
33
- // biome-ignore lint/style/noParameterAssign: based on webpack's logic
34
- newContentRegExp = newContentRecursive;
35
- // biome-ignore lint/style/noParameterAssign: based on webpack's logic
36
- newContentRecursive = undefined;
37
- }
38
- rawOptions.newContentResource = newContentResource;
39
- rawOptions.newContentRecursive = newContentRecursive;
40
- rawOptions.newContentRegExp = newContentRegExp;
41
- }
42
- return rawOptions;
43
- });
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CopyRspackPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.CopyRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.CopyRspackPlugin, (copy) => {
7
- const ret = {
8
- patterns: []
9
- };
10
- ret.patterns = (copy.patterns || []).map(pattern => {
11
- if (typeof pattern === "string") {
12
- pattern = { from: pattern };
13
- }
14
- pattern.force ??= false;
15
- pattern.noErrorOnMissing ??= false;
16
- pattern.priority ??= 0;
17
- pattern.globOptions ??= {};
18
- return pattern;
19
- });
20
- return ret;
21
- });
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CssModulesPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.CssModulesPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.CssModulesPlugin, () => { }, "compilation");
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DataUriPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.DataUriPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.DataUriPlugin, () => { }, "compilation");
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefinePlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.DefinePlugin = (0, base_1.create)(binding_1.BuiltinPluginName.DefinePlugin, function (define) {
7
- const supportsBigIntLiteral = this.options.output.environment?.bigIntLiteral ?? false;
8
- return normalizeValue(define, supportsBigIntLiteral);
9
- }, "compilation");
10
- const normalizeValue = (define, supportsBigIntLiteral) => {
11
- const normalizePrimitive = (p) => {
12
- if (p === undefined) {
13
- return "undefined";
14
- }
15
- if (Object.is(p, -0)) {
16
- return "-0";
17
- }
18
- if (p instanceof RegExp) {
19
- return p.toString();
20
- }
21
- if (typeof p === "function") {
22
- return `(${p.toString()})`;
23
- }
24
- if (typeof p === "bigint") {
25
- return supportsBigIntLiteral ? `${p}n` : `BigInt("${p}")`;
26
- }
27
- // assume `p` is a valid JSON value
28
- return p;
29
- };
30
- const normalizeObject = (define) => {
31
- if (Array.isArray(define)) {
32
- return define.map(normalizeObject);
33
- }
34
- if (define instanceof RegExp) {
35
- return normalizePrimitive(define);
36
- }
37
- if (define && typeof define === "object") {
38
- const keys = Object.keys(define);
39
- return Object.fromEntries(keys.map(k => [k, normalizeObject(define[k])]));
40
- }
41
- return normalizePrimitive(define);
42
- };
43
- return normalizeObject(define);
44
- };
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeterministicChunkIdsPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.DeterministicChunkIdsPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.DeterministicChunkIdsPlugin, () => { }, "compilation");
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeterministicModuleIdsPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.DeterministicModuleIdsPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.DeterministicModuleIdsPlugin, () => { }, "compilation");
@@ -1,36 +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.DynamicEntryPlugin = void 0;
7
- const binding_1 = require("@rspack/binding");
8
- const EntryOptionPlugin_1 = __importDefault(require("../lib/EntryOptionPlugin"));
9
- const EntryPlugin_1 = require("./EntryPlugin");
10
- const base_1 = require("./base");
11
- class DynamicEntryPlugin extends base_1.RspackBuiltinPlugin {
12
- constructor(context, entry) {
13
- super();
14
- this.context = context;
15
- this.entry = entry;
16
- this.name = binding_1.BuiltinPluginName.DynamicEntryPlugin;
17
- this.affectedHooks = "make";
18
- }
19
- raw(compiler) {
20
- const raw = {
21
- context: this.context,
22
- entry: async () => {
23
- const result = await this.entry();
24
- return Object.entries(result).map(([name, desc]) => {
25
- const options = EntryOptionPlugin_1.default.entryDescriptionToOptions(compiler, name, desc);
26
- return {
27
- import: desc.import,
28
- options: (0, EntryPlugin_1.getRawEntryOptions)(options)
29
- };
30
- });
31
- }
32
- };
33
- return (0, base_1.createBuiltinPlugin)(this.name, raw);
34
- }
35
- }
36
- exports.DynamicEntryPlugin = DynamicEntryPlugin;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ElectronTargetPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.ElectronTargetPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.ElectronTargetPlugin, (context) => context ?? "none");
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnableChunkLoadingPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.EnableChunkLoadingPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.EnableChunkLoadingPlugin, (type) => type);
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnableLibraryPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- const enabledTypes = new WeakMap();
7
- const getEnabledTypes = (compiler) => {
8
- let set = enabledTypes.get(compiler);
9
- if (set === undefined) {
10
- set = new Set();
11
- enabledTypes.set(compiler, set);
12
- }
13
- return set;
14
- };
15
- class EnableLibraryPlugin extends base_1.RspackBuiltinPlugin {
16
- constructor(type) {
17
- super();
18
- this.type = type;
19
- this.name = binding_1.BuiltinPluginName.EnableLibraryPlugin;
20
- }
21
- static setEnabled(compiler, type) {
22
- getEnabledTypes(compiler).add(type);
23
- }
24
- static checkEnabled(compiler, type) {
25
- if (!getEnabledTypes(compiler).has(type)) {
26
- throw new Error(`Library type "${type}" is not enabled. EnableLibraryPlugin need to be used to enable this type of library. This usually happens through the "output.enabledLibraryTypes" option. If you are using a function as entry which sets "library", you need to add all potential library types to "output.enabledLibraryTypes". These types are enabled: ${Array.from(getEnabledTypes(compiler)).join(", ")}`);
27
- }
28
- }
29
- raw(compiler) {
30
- const { type } = this;
31
- // Only enable once
32
- const enabled = getEnabledTypes(compiler);
33
- if (enabled.has(type))
34
- return;
35
- enabled.add(type);
36
- return (0, base_1.createBuiltinPlugin)(this.name, type);
37
- }
38
- }
39
- exports.EnableLibraryPlugin = EnableLibraryPlugin;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnableWasmLoadingPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.EnableWasmLoadingPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.EnableWasmLoadingPlugin, (type) => type);
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnsureChunkConditionsPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.EnsureChunkConditionsPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.EnsureChunkConditionsPlugin, () => { });
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRawEntryOptions = exports.EntryPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const config_1 = require("../config");
6
- const util_1 = require("../util");
7
- const base_1 = require("./base");
8
- exports.EntryPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.EntryPlugin, (context, entry, options = "") => {
9
- const entryOptions = typeof options === "string" ? { name: options } : options;
10
- return {
11
- context,
12
- entry,
13
- options: getRawEntryOptions(entryOptions)
14
- };
15
- }, "make");
16
- function getRawEntryOptions(entry) {
17
- const runtime = entry.runtime;
18
- const chunkLoading = entry.chunkLoading;
19
- return {
20
- name: entry.name,
21
- publicPath: entry.publicPath,
22
- baseUri: entry.baseUri,
23
- runtime,
24
- chunkLoading: !(0, util_1.isNil)(chunkLoading)
25
- ? (0, config_1.getRawChunkLoading)(chunkLoading)
26
- : undefined,
27
- asyncChunks: entry.asyncChunks,
28
- filename: entry.filename,
29
- library: entry.library && (0, config_1.getRawLibrary)(entry.library),
30
- layer: entry.layer ?? undefined,
31
- dependOn: entry.dependOn
32
- };
33
- }
34
- exports.getRawEntryOptions = getRawEntryOptions;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EvalDevToolModulePlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.EvalDevToolModulePlugin = (0, base_1.create)(binding_1.BuiltinPluginName.EvalDevToolModulePlugin, (options) => options, "compilation");
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EvalSourceMapDevToolPlugin = void 0;
4
- const binding_1 = require("@rspack/binding");
5
- const base_1 = require("./base");
6
- exports.EvalSourceMapDevToolPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.EvalSourceMapDevToolPlugin, (options) => {
7
- return {
8
- filename: options.filename || undefined,
9
- append: options.append,
10
- namespace: options.namespace ?? "",
11
- columns: options.columns ?? true,
12
- noSources: options.noSources ?? false,
13
- publicPath: options.publicPath,
14
- module: options.module
15
- };
16
- }, "compilation");