@rspack/core 1.0.14 → 1.1.0
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.
- package/compiled/@swc/types/index.d.ts +1962 -0
- package/compiled/@swc/types/index.js +19 -0
- package/compiled/@swc/types/license +201 -0
- package/compiled/@swc/types/package.json +1 -0
- package/compiled/enhanced-resolve/CachedInputFileSystem.js +267 -80
- package/compiled/enhanced-resolve/index.d.ts +849 -236
- package/compiled/enhanced-resolve/package.json +1 -1
- package/compiled/graceful-fs/index.js +10 -10
- package/compiled/graceful-fs/package.json +1 -1
- package/compiled/zod/index.d.ts +2 -2
- package/dist/Compilation.d.ts +7 -18
- package/dist/DependenciesBlock.d.ts +6 -4
- package/dist/FileSystem.d.ts +7 -2
- package/dist/Module.d.ts +17 -14
- package/dist/builtin-loader/swc/types.d.ts +9 -435
- package/dist/builtin-plugin/EntryPlugin.d.ts +14 -11
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +10 -10
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +10 -10
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +8 -10
- package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +10 -0
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +8 -8
- package/dist/builtin-plugin/SplitChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/index.d.ts +4 -2
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +3 -3
- package/dist/builtin-plugin/lazy-compilation/plugin.d.ts +3 -3
- package/dist/config/adapter.d.ts +1 -1
- package/dist/config/adapterRuleUse.d.ts +1 -1
- package/dist/config/index.d.ts +1 -0
- package/dist/config/normalization.d.ts +4 -11
- package/dist/config/types.d.ts +417 -9
- package/dist/config/zod.d.ts +1044 -1303
- package/dist/exports.d.ts +4 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1023 -5103
- package/dist/util/ArrayQueue.d.ts +1 -9
- package/dist/util/asyncLib.d.ts +54 -0
- package/package.json +9 -9
- package/dist/builtin-loader/swc/react.d.ts +0 -15
- package/dist/lib/Dependency.d.ts +0 -23
- package/dist/lib/formatLocation.d.ts +0 -16
- package/dist/logging/runtime.d.ts +0 -16
- package/dist/util/IterableHelpers.d.ts +0 -12
- package/dist/util/scheme.d.ts +0 -6
- package/dist/util/webpack.d.ts +0 -4
- /package/dist/builtin-plugin/{LightningCssMiminizerRspackPlugin.d.ts → LightningCssMinimizerRspackPlugin.d.ts} +0 -0
|
@@ -1,439 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
* Some types are modified from https://github.com/swc-project/swc/blob/16a38851/packages/types/index.ts#L647
|
|
3
|
-
* license at https://github.com/swc-project/swc/blob/main/LICENSE
|
|
4
|
-
*/
|
|
1
|
+
import type { Config, EnvConfig, EsParserConfig, JscConfig, ModuleConfig, ParserConfig, TransformConfig, TsParserConfig } from "../../../compiled/@swc/types";
|
|
5
2
|
import type { PluginImportOptions } from "./pluginImport";
|
|
6
|
-
|
|
7
|
-
export type
|
|
8
|
-
export type
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
tsx?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Defaults to `false`.
|
|
17
|
-
*/
|
|
18
|
-
decorators?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Defaults to `false`
|
|
21
|
-
*/
|
|
22
|
-
dynamicImport?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export interface SwcLoaderEsParserConfig {
|
|
25
|
-
syntax: "ecmascript";
|
|
26
|
-
/**
|
|
27
|
-
* Defaults to false.
|
|
28
|
-
*/
|
|
29
|
-
jsx?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Defaults to `false`
|
|
32
|
-
*/
|
|
33
|
-
functionBind?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Defaults to `false`
|
|
36
|
-
*/
|
|
37
|
-
decorators?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Defaults to `false`
|
|
40
|
-
*/
|
|
41
|
-
decoratorsBeforeExport?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Defaults to `false`
|
|
44
|
-
*/
|
|
45
|
-
exportDefaultFrom?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Defaults to `false`
|
|
48
|
-
*/
|
|
49
|
-
importAssertions?: boolean;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* - `import { DEBUG } from '@ember/env-flags';`
|
|
53
|
-
* - `import { FEATURE_A, FEATURE_B } from '@ember/features';`
|
|
54
|
-
*
|
|
55
|
-
* See: https://github.com/swc-project/swc/issues/18#issuecomment-466272558
|
|
56
|
-
*/
|
|
57
|
-
export type ConstModulesConfig = {
|
|
58
|
-
globals?: {
|
|
59
|
-
[module: string]: {
|
|
60
|
-
[name: string]: string;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Options for inline-global pass.
|
|
66
|
-
*/
|
|
67
|
-
export interface GlobalPassOption {
|
|
68
|
-
/**
|
|
69
|
-
* Global variables that should be inlined with passed value.
|
|
70
|
-
*
|
|
71
|
-
* e.g. `{ __DEBUG__: true }`
|
|
72
|
-
*/
|
|
73
|
-
vars?: Record<string, string>;
|
|
74
|
-
/**
|
|
75
|
-
* Names of environment variables that should be inlined with the value of corresponding env during build.
|
|
76
|
-
*
|
|
77
|
-
* Defaults to `["NODE_ENV", "SWC_ENV"]`
|
|
78
|
-
*/
|
|
79
|
-
envs?: string[] | Record<string, string>;
|
|
80
|
-
/**
|
|
81
|
-
* Replaces typeof calls for passed variables with corresponding value
|
|
82
|
-
*
|
|
83
|
-
* e.g. `{ window: 'object' }`
|
|
84
|
-
*/
|
|
85
|
-
typeofs?: Record<string, string>;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* https://swc.rs/docs/configuring-swc.html#jsctransformoptimizerjsonify
|
|
89
|
-
*/
|
|
90
|
-
export type OptimizerConfig = {
|
|
91
|
-
/**
|
|
92
|
-
* https://swc.rs/docs/configuration/compilation#jsctransformoptimizersimplify
|
|
93
|
-
*/
|
|
94
|
-
simplify?: boolean;
|
|
95
|
-
/**
|
|
96
|
-
* https://swc.rs/docs/configuring-swc.html#jsctransformoptimizerglobals
|
|
97
|
-
*/
|
|
98
|
-
globals?: GlobalPassOption;
|
|
99
|
-
/**
|
|
100
|
-
* https://swc.rs/docs/configuring-swc.html#jsctransformoptimizerjsonify
|
|
101
|
-
*/
|
|
102
|
-
jsonify?: {
|
|
103
|
-
minCost: number;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
export interface SwcLoaderTransformConfig {
|
|
107
|
-
/**
|
|
108
|
-
* Effective only if `syntax` supports ƒ.
|
|
109
|
-
*/
|
|
110
|
-
react?: ReactOptions;
|
|
111
|
-
constModules?: ConstModulesConfig;
|
|
112
|
-
/**
|
|
113
|
-
* Defaults to null, which skips optimizer pass.
|
|
114
|
-
*/
|
|
115
|
-
optimizer?: OptimizerConfig;
|
|
116
|
-
/**
|
|
117
|
-
* https://swc.rs/docs/configuring-swc.html#jsctransformlegacydecorator
|
|
118
|
-
*/
|
|
119
|
-
legacyDecorator?: boolean;
|
|
120
|
-
/**
|
|
121
|
-
* https://swc.rs/docs/configuring-swc.html#jsctransformdecoratormetadata
|
|
122
|
-
*/
|
|
123
|
-
decoratorMetadata?: boolean;
|
|
124
|
-
/**
|
|
125
|
-
* https://swc.rs/docs/configuration/compilation#jsctransformdecoratorversion
|
|
126
|
-
*/
|
|
127
|
-
decoratorVersion?: "2021-12" | "2022-03";
|
|
128
|
-
treatConstEnumAsEnum?: boolean;
|
|
129
|
-
useDefineForClassFields?: boolean;
|
|
130
|
-
}
|
|
131
|
-
export interface SwcLoaderEnvConfig {
|
|
132
|
-
mode?: "usage" | "entry";
|
|
133
|
-
debug?: boolean;
|
|
134
|
-
dynamicImport?: boolean;
|
|
135
|
-
loose?: boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Transpiles the broken syntax to the closest non-broken modern syntax
|
|
138
|
-
* Defaults to false.
|
|
139
|
-
*/
|
|
140
|
-
bugfixes?: boolean;
|
|
141
|
-
/**
|
|
142
|
-
* Skipped es features.
|
|
143
|
-
* e.g.)
|
|
144
|
-
* - `core-js/modules/foo`
|
|
145
|
-
*/
|
|
146
|
-
skip?: string[];
|
|
147
|
-
include?: string[];
|
|
148
|
-
exclude?: string[];
|
|
149
|
-
/**
|
|
150
|
-
* The version of the used core js.
|
|
151
|
-
*/
|
|
152
|
-
coreJs?: string;
|
|
153
|
-
targets?: any;
|
|
154
|
-
path?: string;
|
|
155
|
-
shippedProposals?: boolean;
|
|
156
|
-
/**
|
|
157
|
-
* Enable all transforms
|
|
158
|
-
*/
|
|
159
|
-
forceAllTransforms?: boolean;
|
|
160
|
-
}
|
|
161
|
-
export interface SwcLoaderJscConfig {
|
|
162
|
-
loose?: boolean;
|
|
163
|
-
/**
|
|
164
|
-
* Defaults to EsParserConfig
|
|
165
|
-
*/
|
|
166
|
-
parser?: SwcLoaderParserConfig;
|
|
167
|
-
transform?: SwcLoaderTransformConfig;
|
|
168
|
-
/**
|
|
169
|
-
* Use `@swc/helpers` instead of inline helpers.
|
|
170
|
-
*/
|
|
171
|
-
externalHelpers?: boolean;
|
|
172
|
-
/**
|
|
173
|
-
* Defaults to `es3` (which enabled **all** pass).
|
|
174
|
-
*/
|
|
175
|
-
target?: JscTarget;
|
|
176
|
-
/**
|
|
177
|
-
* Keep class names.
|
|
178
|
-
*/
|
|
179
|
-
keepClassNames?: boolean;
|
|
180
|
-
/**
|
|
181
|
-
* This is experimental, and can be removed without a major version bump.
|
|
182
|
-
*/
|
|
183
|
-
experimental?: {
|
|
184
|
-
optimizeHygiene?: boolean;
|
|
185
|
-
/**
|
|
186
|
-
* Preserve `with` in imports and exports.
|
|
187
|
-
*/
|
|
188
|
-
keepImportAttributes?: boolean;
|
|
189
|
-
/**
|
|
190
|
-
* Use `assert` instead of `with` for imports and exports.
|
|
191
|
-
* This option only works when `keepImportAttributes` is `true`.
|
|
192
|
-
*/
|
|
193
|
-
emitAssertForImportAttributes?: boolean;
|
|
194
|
-
/**
|
|
195
|
-
* Specify the location where SWC stores its intermediate cache files.
|
|
196
|
-
* Currently only transform plugin uses this. If not specified, SWC will
|
|
197
|
-
* create `.swc` directories.
|
|
198
|
-
*/
|
|
199
|
-
cacheRoot?: string;
|
|
200
|
-
/**
|
|
201
|
-
* List of custom transform plugins written in WebAssembly.
|
|
202
|
-
* First parameter of tuple indicates the name of the plugin - it can be either
|
|
203
|
-
* a name of the npm package can be resolved, or absolute path to .wasm binary.
|
|
204
|
-
*
|
|
205
|
-
* Second parameter of tuple is JSON based configuration for the plugin.
|
|
206
|
-
*/
|
|
207
|
-
plugins?: Array<[string, Record<string, any>]>;
|
|
208
|
-
/**
|
|
209
|
-
* Disable builtin transforms. If enabled, only Wasm plugins are used.
|
|
210
|
-
*/
|
|
211
|
-
disableBuiltinTransformsForInternalTesting?: boolean;
|
|
212
|
-
};
|
|
213
|
-
baseUrl?: string;
|
|
214
|
-
paths?: {
|
|
215
|
-
[from: string]: [string];
|
|
216
|
-
};
|
|
217
|
-
preserveAllComments?: boolean;
|
|
218
|
-
}
|
|
219
|
-
export type SwcLoaderModuleConfig = Es6Config | CommonJsConfig | UmdConfig | AmdConfig | NodeNextConfig | SystemjsConfig;
|
|
220
|
-
export interface BaseModuleConfig {
|
|
221
|
-
/**
|
|
222
|
-
* By default, when using exports with babel a non-enumerable `__esModule`
|
|
223
|
-
* property is exported. In some cases this property is used to determine
|
|
224
|
-
* if the import is the default export or if it contains the default export.
|
|
225
|
-
*
|
|
226
|
-
* In order to prevent the __esModule property from being exported, you
|
|
227
|
-
* can set the strict option to true.
|
|
228
|
-
*
|
|
229
|
-
* Defaults to `false`.
|
|
230
|
-
*/
|
|
231
|
-
strict?: boolean;
|
|
232
|
-
/**
|
|
233
|
-
* Emits 'use strict' directive.
|
|
234
|
-
*
|
|
235
|
-
* Defaults to `true`.
|
|
236
|
-
*/
|
|
237
|
-
strictMode?: boolean;
|
|
238
|
-
/**
|
|
239
|
-
* Changes Babel's compiled import statements to be lazily evaluated when their imported bindings are used for the first time.
|
|
240
|
-
*
|
|
241
|
-
* This can improve initial load time of your module because evaluating dependencies up
|
|
242
|
-
* front is sometimes entirely un-necessary. This is especially the case when implementing
|
|
243
|
-
* a library module.
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
* The value of `lazy` has a few possible effects:
|
|
247
|
-
*
|
|
248
|
-
* - `false` - No lazy initialization of any imported module.
|
|
249
|
-
* - `true` - Do not lazy-initialize local `./foo` imports, but lazy-init `foo` dependencies.
|
|
250
|
-
*
|
|
251
|
-
* Local paths are much more likely to have circular dependencies, which may break if loaded lazily,
|
|
252
|
-
* so they are not lazy by default, whereas dependencies between independent modules are rarely cyclical.
|
|
253
|
-
*
|
|
254
|
-
* - `Array<string>` - Lazy-initialize all imports with source matching one of the given strings.
|
|
255
|
-
*
|
|
256
|
-
* -----
|
|
257
|
-
*
|
|
258
|
-
* The two cases where imports can never be lazy are:
|
|
259
|
-
*
|
|
260
|
-
* - `import "foo";`
|
|
261
|
-
*
|
|
262
|
-
* Side-effect imports are automatically non-lazy since their very existence means
|
|
263
|
-
* that there is no binding to later kick off initialization.
|
|
264
|
-
*
|
|
265
|
-
* - `export * from "foo"`
|
|
266
|
-
*
|
|
267
|
-
* Re-exporting all names requires up-front execution because otherwise there is no
|
|
268
|
-
* way to know what names need to be exported.
|
|
269
|
-
*
|
|
270
|
-
* Defaults to `false`.
|
|
271
|
-
*/
|
|
272
|
-
lazy?: boolean | string[];
|
|
273
|
-
/**
|
|
274
|
-
* @deprecated Use the `importInterop` option instead.
|
|
275
|
-
*
|
|
276
|
-
* By default, when using exports with swc a non-enumerable __esModule property is exported.
|
|
277
|
-
* This property is then used to determine if the import is the default export or if
|
|
278
|
-
* it contains the default export.
|
|
279
|
-
*
|
|
280
|
-
* In cases where the auto-unwrapping of default is not needed, you can set the noInterop option
|
|
281
|
-
* to true to avoid the usage of the interopRequireDefault helper (shown in inline form above).
|
|
282
|
-
*
|
|
283
|
-
* Defaults to `false`.
|
|
284
|
-
*/
|
|
285
|
-
noInterop?: boolean;
|
|
286
|
-
/**
|
|
287
|
-
* Defaults to `swc`.
|
|
288
|
-
*
|
|
289
|
-
* CommonJS modules and ECMAScript modules are not fully compatible.
|
|
290
|
-
* However, compilers, bundlers and JavaScript runtimes developed different strategies
|
|
291
|
-
* to make them work together as well as possible.
|
|
292
|
-
*
|
|
293
|
-
* - `swc` (alias: `babel`)
|
|
294
|
-
*
|
|
295
|
-
* When using exports with `swc` a non-enumerable `__esModule` property is exported
|
|
296
|
-
* This property is then used to determine if the import is the default export
|
|
297
|
-
* or if it contains the default export.
|
|
298
|
-
*
|
|
299
|
-
* ```javascript
|
|
300
|
-
* import foo from "foo";
|
|
301
|
-
* import { bar } from "bar";
|
|
302
|
-
* foo;
|
|
303
|
-
* bar;
|
|
304
|
-
*
|
|
305
|
-
* // Is compiled to ...
|
|
306
|
-
*
|
|
307
|
-
* "use strict";
|
|
308
|
-
*
|
|
309
|
-
* function _interop_require_default(obj) {
|
|
310
|
-
* return obj && obj.__esModule ? obj : { default: obj };
|
|
311
|
-
* }
|
|
312
|
-
*
|
|
313
|
-
* var _foo = _interop_require_default(require("foo"));
|
|
314
|
-
* var _bar = require("bar");
|
|
315
|
-
*
|
|
316
|
-
* _foo.default;
|
|
317
|
-
* _bar.bar;
|
|
318
|
-
* ```
|
|
319
|
-
*
|
|
320
|
-
* When this import interop is used, if both the imported and the importer module are compiled
|
|
321
|
-
* with swc they behave as if none of them was compiled.
|
|
322
|
-
*
|
|
323
|
-
* This is the default behavior.
|
|
324
|
-
*
|
|
325
|
-
* - `node`
|
|
326
|
-
*
|
|
327
|
-
* When importing CommonJS files (either directly written in CommonJS, or generated with a compiler)
|
|
328
|
-
* Node.js always binds the `default` export to the value of `module.exports`.
|
|
329
|
-
*
|
|
330
|
-
* ```javascript
|
|
331
|
-
* import foo from "foo";
|
|
332
|
-
* import { bar } from "bar";
|
|
333
|
-
* foo;
|
|
334
|
-
* bar;
|
|
335
|
-
*
|
|
336
|
-
* // Is compiled to ...
|
|
337
|
-
*
|
|
338
|
-
* "use strict";
|
|
339
|
-
*
|
|
340
|
-
* var _foo = require("foo");
|
|
341
|
-
* var _bar = require("bar");
|
|
342
|
-
*
|
|
343
|
-
* _foo;
|
|
344
|
-
* _bar.bar;
|
|
345
|
-
* ```
|
|
346
|
-
* This is not exactly the same as what Node.js does since swc allows accessing any property of `module.exports`
|
|
347
|
-
* as a named export, while Node.js only allows importing statically analyzable properties of `module.exports`.
|
|
348
|
-
* However, any import working in Node.js will also work when compiled with swc using `importInterop: "node"`.
|
|
349
|
-
*
|
|
350
|
-
* - `none`
|
|
351
|
-
*
|
|
352
|
-
* If you know that the imported file has been transformed with a compiler that stores the `default` export on
|
|
353
|
-
* `exports.default` (such as swc or Babel), you can safely omit the `_interop_require_default` helper.
|
|
354
|
-
*
|
|
355
|
-
* ```javascript
|
|
356
|
-
* import foo from "foo";
|
|
357
|
-
* import { bar } from "bar";
|
|
358
|
-
* foo;
|
|
359
|
-
* bar;
|
|
360
|
-
*
|
|
361
|
-
* // Is compiled to ...
|
|
362
|
-
*
|
|
363
|
-
* "use strict";
|
|
364
|
-
*
|
|
365
|
-
* var _foo = require("foo");
|
|
366
|
-
* var _bar = require("bar");
|
|
367
|
-
*
|
|
368
|
-
* _foo.default;
|
|
369
|
-
* _bar.bar;
|
|
370
|
-
* ```
|
|
371
|
-
*/
|
|
372
|
-
importInterop?: "swc" | "babel" | "node" | "none";
|
|
373
|
-
/**
|
|
374
|
-
* Emits `cjs-module-lexer` annotation
|
|
375
|
-
* `cjs-module-lexer` is used in Node.js core for detecting the named exports available when importing a CJS module into ESM.
|
|
376
|
-
* swc will emit `cjs-module-lexer` detectable annotation with this option enabled.
|
|
377
|
-
*
|
|
378
|
-
* Defaults to `true` if import_interop is Node, else `false`
|
|
379
|
-
*/
|
|
380
|
-
exportInteropAnnotation?: boolean;
|
|
381
|
-
/**
|
|
382
|
-
* If set to true, dynamic imports will be preserved.
|
|
383
|
-
*/
|
|
384
|
-
ignoreDynamic?: boolean;
|
|
385
|
-
allowTopLevelThis?: boolean;
|
|
386
|
-
preserveImportMeta?: boolean;
|
|
387
|
-
}
|
|
388
|
-
export interface Es6Config extends BaseModuleConfig {
|
|
389
|
-
type: "es6";
|
|
390
|
-
}
|
|
391
|
-
export interface NodeNextConfig extends BaseModuleConfig {
|
|
392
|
-
type: "nodenext";
|
|
393
|
-
}
|
|
394
|
-
export interface CommonJsConfig extends BaseModuleConfig {
|
|
395
|
-
type: "commonjs";
|
|
396
|
-
}
|
|
397
|
-
export interface UmdConfig extends BaseModuleConfig {
|
|
398
|
-
type: "umd";
|
|
399
|
-
globals?: {
|
|
400
|
-
[key: string]: string;
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
export interface AmdConfig extends BaseModuleConfig {
|
|
404
|
-
type: "amd";
|
|
405
|
-
moduleId?: string;
|
|
406
|
-
}
|
|
407
|
-
export interface SystemjsConfig {
|
|
408
|
-
type: "systemjs";
|
|
409
|
-
allowTopLevelThis?: boolean;
|
|
410
|
-
}
|
|
411
|
-
export type SwcLoaderOptions = {
|
|
412
|
-
/**
|
|
413
|
-
* Note: The type is string because it follows rust's regex syntax.
|
|
414
|
-
*/
|
|
415
|
-
test?: string | string[];
|
|
416
|
-
/**
|
|
417
|
-
* Note: The type is string because it follows rust's regex syntax.
|
|
418
|
-
*/
|
|
419
|
-
exclude?: string | string[];
|
|
420
|
-
env?: SwcLoaderEnvConfig;
|
|
421
|
-
jsc?: SwcLoaderJscConfig;
|
|
422
|
-
module?: SwcLoaderModuleConfig;
|
|
423
|
-
minify?: boolean;
|
|
424
|
-
/**
|
|
425
|
-
* - true to generate a sourcemap for the code and include it in the result object.
|
|
426
|
-
* - "inline" to generate a sourcemap and append it as a data URL to the end of the code, but not include it in the result object.
|
|
427
|
-
*
|
|
428
|
-
* `swc-cli` overloads some of these to also affect how maps are written to disk:
|
|
429
|
-
*
|
|
430
|
-
* - true will write the map to a .map file on disk
|
|
431
|
-
* - "inline" will write the file directly, so it will have a data: containing the map
|
|
432
|
-
* - Note: These options are bit weird, so it may make the most sense to just use true
|
|
433
|
-
* and handle the rest in your own code, depending on your use case.
|
|
434
|
-
*/
|
|
435
|
-
sourceMaps?: boolean;
|
|
436
|
-
inlineSourcesContent?: boolean;
|
|
3
|
+
export type SwcLoaderEnvConfig = EnvConfig;
|
|
4
|
+
export type SwcLoaderJscConfig = JscConfig;
|
|
5
|
+
export type SwcLoaderModuleConfig = ModuleConfig;
|
|
6
|
+
export type SwcLoaderParserConfig = ParserConfig;
|
|
7
|
+
export type SwcLoaderEsParserConfig = EsParserConfig;
|
|
8
|
+
export type SwcLoaderTsParserConfig = TsParserConfig;
|
|
9
|
+
export type SwcLoaderTransformConfig = TransformConfig;
|
|
10
|
+
export type SwcLoaderOptions = Config & {
|
|
437
11
|
isModule?: boolean | "unknown";
|
|
438
12
|
/**
|
|
439
13
|
* Experimental features provided by Rspack.
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { BuiltinPluginName, type JsEntryOptions } from "@rspack/binding";
|
|
2
|
-
import { type
|
|
3
|
-
|
|
2
|
+
import { type EntryDescriptionNormalized } from "../config";
|
|
3
|
+
/**
|
|
4
|
+
* Options for the `EntryPlugin`.
|
|
5
|
+
*/
|
|
6
|
+
export type EntryOptions = Omit<EntryDescriptionNormalized, "import"> & {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the entry chunk.
|
|
9
|
+
*/
|
|
4
10
|
name?: string;
|
|
5
|
-
runtime?: EntryRuntime;
|
|
6
|
-
chunkLoading?: ChunkLoading;
|
|
7
|
-
asyncChunks?: boolean;
|
|
8
|
-
publicPath?: PublicPath;
|
|
9
|
-
baseUri?: string;
|
|
10
|
-
filename?: Filename;
|
|
11
|
-
library?: LibraryOptions;
|
|
12
|
-
layer?: Layer;
|
|
13
|
-
dependOn?: string[];
|
|
14
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* The entry plugin that will handle creation of the `EntryDependency`.
|
|
14
|
+
* It adds an entry chunk on compilation. The chunk is named `options.name` and
|
|
15
|
+
* contains only one module (plus dependencies). The module is resolved from
|
|
16
|
+
* `entry` in `context` (absolute path).
|
|
17
|
+
*/
|
|
15
18
|
export declare const EntryPlugin: {
|
|
16
19
|
new (context: string, entry: string, options?: string | EntryOptions | undefined): {
|
|
17
20
|
name: BuiltinPluginName;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
|
+
import { RspackBuiltinPlugin } from "./base";
|
|
4
|
+
export declare class FlagDependencyUsagePlugin extends RspackBuiltinPlugin {
|
|
5
|
+
private global;
|
|
6
|
+
name: BuiltinPluginName;
|
|
7
|
+
affectedHooks: "compilation";
|
|
8
|
+
constructor(global: boolean);
|
|
9
|
+
raw(compiler: Compiler): BuiltinPlugin;
|
|
10
|
+
}
|
|
@@ -11,7 +11,7 @@ export type HtmlRspackPluginOptions = {
|
|
|
11
11
|
* The file to write the HTML to. You can specify a subdirectory here too (eg: pages/index.html).
|
|
12
12
|
* @default 'index.html'
|
|
13
13
|
*/
|
|
14
|
-
filename?: string;
|
|
14
|
+
filename?: string | ((entry: string) => string);
|
|
15
15
|
/** The template file path. */
|
|
16
16
|
template?: string;
|
|
17
17
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
|
+
import { RspackBuiltinPlugin } from "./base";
|
|
4
|
+
export declare class MangleExportsPlugin extends RspackBuiltinPlugin {
|
|
5
|
+
private deterministic;
|
|
6
|
+
name: BuiltinPluginName;
|
|
7
|
+
affectedHooks: "compilation";
|
|
8
|
+
constructor(deterministic: boolean);
|
|
9
|
+
raw(compiler: Compiler): BuiltinPlugin;
|
|
10
|
+
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
};
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
|
+
import { RspackBuiltinPlugin } from "./base";
|
|
4
|
+
export declare class ModuleConcatenationPlugin extends RspackBuiltinPlugin {
|
|
5
|
+
name: BuiltinPluginName;
|
|
6
|
+
affectedHooks: "compilation";
|
|
7
|
+
raw(compiler: Compiler): BuiltinPlugin;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
export declare const RemoveDuplicateModulesPlugin: {
|
|
3
|
+
new (): {
|
|
4
|
+
name: BuiltinPluginName;
|
|
5
|
+
_args: [];
|
|
6
|
+
affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
7
|
+
raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
8
|
+
apply(compiler: import("..").Compiler): void;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
2
|
export declare const SizeLimitsPlugin: {
|
|
3
3
|
new (options: {
|
|
4
|
-
assetFilter?: (
|
|
5
|
-
hints?: false | "
|
|
6
|
-
maxAssetSize?: number
|
|
7
|
-
maxEntrypointSize?: number
|
|
4
|
+
assetFilter?: (assetFilename: string) => boolean;
|
|
5
|
+
hints?: false | "warning" | "error";
|
|
6
|
+
maxAssetSize?: number;
|
|
7
|
+
maxEntrypointSize?: number;
|
|
8
8
|
}): {
|
|
9
9
|
name: BuiltinPluginName;
|
|
10
10
|
_args: [options: {
|
|
11
|
-
assetFilter?: (
|
|
12
|
-
hints?: false | "
|
|
13
|
-
maxAssetSize?: number
|
|
14
|
-
maxEntrypointSize?: number
|
|
11
|
+
assetFilter?: (assetFilename: string) => boolean;
|
|
12
|
+
hints?: false | "warning" | "error";
|
|
13
|
+
maxAssetSize?: number;
|
|
14
|
+
maxEntrypointSize?: number;
|
|
15
15
|
}];
|
|
16
16
|
affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
17
17
|
raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
2
|
import type { Compiler } from "../Compiler";
|
|
3
|
-
import type { OptimizationSplitChunksOptions } from "../config
|
|
3
|
+
import type { OptimizationSplitChunksOptions } from "../config";
|
|
4
4
|
import { RspackBuiltinPlugin } from "./base";
|
|
5
5
|
export declare class SplitChunksPlugin extends RspackBuiltinPlugin {
|
|
6
6
|
private options;
|
|
@@ -8,7 +8,7 @@ export * from "./BundlerInfoRspackPlugin";
|
|
|
8
8
|
export * from "./ChunkPrefetchPreloadPlugin";
|
|
9
9
|
export * from "./CommonJsChunkFormatPlugin";
|
|
10
10
|
export * from "./CopyRspackPlugin";
|
|
11
|
-
export * from "./css-extract";
|
|
11
|
+
export * from "./css-extract/index";
|
|
12
12
|
export * from "./CssModulesPlugin";
|
|
13
13
|
export * from "./DataUriPlugin";
|
|
14
14
|
export * from "./DefinePlugin";
|
|
@@ -56,7 +56,9 @@ export * from "./SideEffectsFlagPlugin";
|
|
|
56
56
|
export * from "./SizeLimitsPlugin";
|
|
57
57
|
export * from "./SourceMapDevToolPlugin";
|
|
58
58
|
export * from "./SplitChunksPlugin";
|
|
59
|
-
export * from "./
|
|
59
|
+
export * from "./LightningCssMinimizerRspackPlugin";
|
|
60
|
+
export * from "./RemoveDuplicateModulesPlugin";
|
|
61
|
+
export * from "./LightningCssMinimizerRspackPlugin";
|
|
60
62
|
export * from "./SwcJsMinimizerPlugin";
|
|
61
63
|
export * from "./WarnCaseSensitiveModulesPlugin";
|
|
62
64
|
export * from "./WebWorkerTemplatePlugin";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuiltinPluginName, type JsModule
|
|
1
|
+
import { BuiltinPluginName, type JsModule } from "@rspack/binding";
|
|
2
2
|
export declare const BuiltinLazyCompilationPlugin: {
|
|
3
3
|
new (module: (args: {
|
|
4
4
|
module: string;
|
|
@@ -7,7 +7,7 @@ export declare const BuiltinLazyCompilationPlugin: {
|
|
|
7
7
|
active: boolean;
|
|
8
8
|
data: string;
|
|
9
9
|
client: string;
|
|
10
|
-
}, cacheable: boolean, entries: boolean, imports: boolean, test?:
|
|
10
|
+
}, cacheable: boolean, entries: boolean, imports: boolean, test?: RegExp | ((m: JsModule) => boolean) | undefined): {
|
|
11
11
|
name: BuiltinPluginName;
|
|
12
12
|
_args: [module: (args: {
|
|
13
13
|
module: string;
|
|
@@ -16,7 +16,7 @@ export declare const BuiltinLazyCompilationPlugin: {
|
|
|
16
16
|
active: boolean;
|
|
17
17
|
data: string;
|
|
18
18
|
client: string;
|
|
19
|
-
}, cacheable: boolean, entries: boolean, imports: boolean, test?:
|
|
19
|
+
}, cacheable: boolean, entries: boolean, imports: boolean, test?: RegExp | ((m: JsModule) => boolean) | undefined];
|
|
20
20
|
affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
21
21
|
raw(compiler: import("../..").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
22
22
|
apply(compiler: import("../..").Compiler): void;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { JsModule
|
|
1
|
+
import type { JsModule } from "@rspack/binding";
|
|
2
2
|
import type { Compiler } from "../..";
|
|
3
3
|
import { type LazyCompilationDefaultBackendOptions } from "./backend";
|
|
4
4
|
export default class LazyCompilationPlugin {
|
|
5
5
|
cacheable: boolean;
|
|
6
6
|
entries: boolean;
|
|
7
7
|
imports: boolean;
|
|
8
|
-
test?:
|
|
8
|
+
test?: RegExp | ((m: JsModule) => boolean);
|
|
9
9
|
backend?: LazyCompilationDefaultBackendOptions;
|
|
10
|
-
constructor(cacheable: boolean, entries: boolean, imports: boolean, test?:
|
|
10
|
+
constructor(cacheable: boolean, entries: boolean, imports: boolean, test?: RegExp | ((m: JsModule) => boolean), backend?: LazyCompilationDefaultBackendOptions);
|
|
11
11
|
apply(compiler: Compiler): void;
|
|
12
12
|
}
|
|
13
13
|
export { LazyCompilationPlugin };
|