@rspack-debug/core 1.4.9 → 1.6.2
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 +15 -5
- package/compiled/@swc/types/package.json +1 -1
- package/compiled/browserslist-load-config/index.d.ts +11 -0
- package/compiled/browserslist-load-config/index.js +26 -40
- package/compiled/browserslist-load-config/package.json +1 -1
- package/compiled/watchpack/index.js +1157 -20
- package/compiled/webpack-sources/index.js +82 -82
- package/dist/Compilation.d.ts +17 -20
- package/dist/Compiler.d.ts +63 -32
- package/dist/Module.d.ts +3 -14
- package/dist/MultiCompiler.d.ts +8 -4
- package/dist/MultiStats.d.ts +3 -2
- package/dist/MultiWatching.d.ts +1 -1
- package/dist/NativeWatchFileSystem.d.ts +8 -2
- package/dist/NormalModuleFactory.d.ts +2 -2
- package/dist/Resolver.d.ts +13 -7
- package/dist/ResolverFactory.d.ts +8 -5
- package/dist/RspackError.d.ts +3 -0
- package/dist/RuntimeGlobals.d.ts +3 -0
- package/dist/RuntimeModule.d.ts +1 -1
- package/dist/VirtualModulesPlugin.d.ts +12 -0
- package/dist/Watching.d.ts +9 -0
- package/dist/builtin-loader/swc/collectTypeScriptInfo.d.ts +13 -0
- package/dist/builtin-loader/swc/pluginImport.d.ts +2 -2
- package/dist/builtin-loader/swc/types.d.ts +4 -0
- package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BannerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DefinePlugin.d.ts +2 -2
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -2
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -2
- package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +11 -0
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +5 -3
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -2
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/InlineExportsPlugin.d.ts +9 -0
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -2
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -2
- package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -2
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -2
- package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +10 -0
- package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +7 -3
- package/dist/builtin-plugin/RslibPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RstestPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +1 -2
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +3 -2
- package/dist/builtin-plugin/URLPlugin.d.ts +9 -0
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/base.d.ts +2 -2
- package/dist/builtin-plugin/css-extract/index.d.ts +2 -2
- package/dist/builtin-plugin/html-plugin/options.d.ts +0 -1
- package/dist/builtin-plugin/html-plugin/plugin.d.ts +2 -2
- package/dist/builtin-plugin/index.d.ts +4 -0
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +3 -17
- package/dist/config/adapterRuleUse.d.ts +65 -7
- package/dist/config/defaults.d.ts +0 -9
- package/dist/config/devServer.d.ts +12 -13
- package/dist/config/index.d.ts +1 -0
- package/dist/config/normalization.d.ts +18 -3
- package/dist/config/types.d.ts +123 -19
- package/dist/container/ModuleFederationManifestPlugin.d.ts +37 -0
- package/dist/container/ModuleFederationPlugin.d.ts +3 -1
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
- package/dist/cssExtractHmr.js +12 -13
- package/dist/cssExtractLoader.js +63 -62
- package/dist/exports.d.ts +16 -9
- package/dist/index.js +1723 -5626
- package/dist/lib/Cache.d.ts +1 -1
- package/dist/loader-runner/ModuleError.d.ts +7 -1
- package/dist/loader-runner/loadLoader.d.ts +2 -1
- package/dist/loader-runner/service.d.ts +2 -2
- package/dist/loader-runner/utils.d.ts +2 -1
- package/dist/moduleFederationDefaultRuntime.js +1 -1
- package/dist/stats/DefaultStatsFactoryPlugin.d.ts +16 -0
- package/dist/stats/statsFactoryUtils.d.ts +17 -1
- package/dist/util/ArrayQueue.d.ts +2 -2
- package/dist/util/bindingVersionCheck.d.ts +1 -1
- package/dist/util/comparators.d.ts +1 -1
- package/dist/util/fs.d.ts +25 -2
- package/dist/util/index.d.ts +0 -3
- package/dist/util/source.d.ts +5 -6
- package/dist/util/validateConfig.d.ts +5 -0
- package/dist/worker.js +152 -118
- package/hot/lazy-compilation-node.js +1 -3
- package/hot/lazy-compilation-web.js +4 -3
- package/module.d.ts +11 -14
- package/package.json +20 -21
- package/compiled/glob-to-regexp/index.d.ts +0 -11
- package/compiled/glob-to-regexp/index.js +0 -187
- package/compiled/glob-to-regexp/package.json +0 -1
- package/compiled/graceful-fs/index.d.ts +0 -13
- package/compiled/graceful-fs/index.js +0 -1063
- package/compiled/graceful-fs/license +0 -15
- package/compiled/graceful-fs/package.json +0 -1
- package/dist/lib/NormalModuleReplacementPlugin.d.ts +0 -29
- package/dist/loader-runner/ModuleWarning.d.ts +0 -7
- package/dist/schema/config.d.ts +0 -996
- package/dist/schema/loaders.d.ts +0 -400
- package/dist/schema/plugins.d.ts +0 -163
- package/dist/schema/utils.d.ts +0 -4
- package/dist/schema/validate.d.ts +0 -10
package/dist/config/types.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ import type { Module } from "../Module";
|
|
|
9
9
|
import type ModuleGraph from "../ModuleGraph";
|
|
10
10
|
import type { ResolveCallback } from "./adapterRuleUse";
|
|
11
11
|
import type { DevServerOptions } from "./devServer";
|
|
12
|
+
/** https://github.com/microsoft/TypeScript/issues/29729 */
|
|
13
|
+
export type LiteralUnion<T extends U, U> = T | (U & Record<never, never>);
|
|
12
14
|
export type FilenameTemplate = string;
|
|
13
15
|
export type Filename = FilenameTemplate | ((pathData: PathData, assetInfo?: AssetInfo) => string);
|
|
14
16
|
/** Name of the configuration. Used when loading multiple configurations. */
|
|
@@ -27,17 +29,17 @@ export type Context = string;
|
|
|
27
29
|
export type Mode = "development" | "production" | "none";
|
|
28
30
|
export type Falsy = false | "" | 0 | null | undefined;
|
|
29
31
|
/** The publicPath of the resource referenced by this entry. */
|
|
30
|
-
export type PublicPath = "auto" | Filename
|
|
32
|
+
export type PublicPath = LiteralUnion<"auto", string> | Exclude<Filename, string>;
|
|
31
33
|
/** The baseURI of the resource referenced by this entry. */
|
|
32
34
|
export type BaseUri = string;
|
|
33
35
|
/** How this entry load other chunks. */
|
|
34
|
-
export type ChunkLoadingType =
|
|
36
|
+
export type ChunkLoadingType = LiteralUnion<"jsonp" | "import-scripts" | "require" | "async-node" | "import", string>;
|
|
35
37
|
/** How this entry load other chunks. */
|
|
36
38
|
export type ChunkLoading = false | ChunkLoadingType;
|
|
37
39
|
/** Whether to create a load-on-demand asynchronous chunk for entry. */
|
|
38
40
|
export type AsyncChunks = boolean;
|
|
39
41
|
/** Option to set the method of loading WebAssembly Modules. */
|
|
40
|
-
export type WasmLoadingType =
|
|
42
|
+
export type WasmLoadingType = LiteralUnion<"fetch-streaming" | "fetch" | "async-node", string>;
|
|
41
43
|
/** Option to set the method of loading WebAssembly Modules. */
|
|
42
44
|
export type WasmLoading = false | WasmLoadingType;
|
|
43
45
|
export type ScriptType = false | "text/javascript" | "module";
|
|
@@ -61,7 +63,7 @@ export type AuxiliaryComment = string | LibraryCustomUmdCommentObject;
|
|
|
61
63
|
/** Specify which export should be exposed as a library. */
|
|
62
64
|
export type LibraryExport = string | string[];
|
|
63
65
|
/** Configure how the library will be exposed. */
|
|
64
|
-
export type LibraryType =
|
|
66
|
+
export type LibraryType = LiteralUnion<"var" | "module" | "assign" | "assign-properties" | "this" | "window" | "self" | "global" | "commonjs" | "commonjs2" | "commonjs-module" | "commonjs-static" | "amd" | "amd-require" | "umd" | "umd2" | "jsonp" | "system", string>;
|
|
65
67
|
/** When using output.library.type: "umd", setting output.library.umdNamedDefine to true will name the AMD module of the UMD build. */
|
|
66
68
|
export type UmdNamedDefine = boolean;
|
|
67
69
|
/** Options for library. */
|
|
@@ -224,8 +226,32 @@ export type HashSalt = string;
|
|
|
224
226
|
export type SourceMapFilename = string;
|
|
225
227
|
/** This option determines the module's namespace */
|
|
226
228
|
export type DevtoolNamespace = string;
|
|
229
|
+
export interface ModuleFilenameTemplateContext {
|
|
230
|
+
/** The identifier of the module */
|
|
231
|
+
identifier: string;
|
|
232
|
+
/** The shortened identifier of the module */
|
|
233
|
+
shortIdentifier: string;
|
|
234
|
+
/** The resource of the module request */
|
|
235
|
+
resource: string;
|
|
236
|
+
/** The resource path of the module request */
|
|
237
|
+
resourcePath: string;
|
|
238
|
+
/** The absolute resource path of the module request */
|
|
239
|
+
absoluteResourcePath: string;
|
|
240
|
+
/** The loaders of the module request */
|
|
241
|
+
loaders: string;
|
|
242
|
+
/** All loaders of the module request */
|
|
243
|
+
allLoaders: string;
|
|
244
|
+
/** The query of the module identifier */
|
|
245
|
+
query: string;
|
|
246
|
+
/** The module id of the module */
|
|
247
|
+
moduleId: string;
|
|
248
|
+
/** The hash of the module identifier */
|
|
249
|
+
hash: string;
|
|
250
|
+
/** The module namespace */
|
|
251
|
+
namespace: string;
|
|
252
|
+
}
|
|
227
253
|
/** This option is only used when devtool uses an option that requires module names. */
|
|
228
|
-
export type DevtoolModuleFilenameTemplate = string | ((
|
|
254
|
+
export type DevtoolModuleFilenameTemplate = string | ((context: ModuleFilenameTemplateContext) => string);
|
|
229
255
|
/** A fallback is used when the template string or function above yields duplicates. */
|
|
230
256
|
export type DevtoolFallbackModuleFilenameTemplate = DevtoolModuleFilenameTemplate;
|
|
231
257
|
/** Tell Rspack what kind of ES-features may be used in the generated runtime-code. */
|
|
@@ -495,7 +521,10 @@ export type ResolveTsConfig = string | {
|
|
|
495
521
|
export type ResolveOptions = {
|
|
496
522
|
/** Path alias */
|
|
497
523
|
alias?: ResolveAlias;
|
|
498
|
-
/**
|
|
524
|
+
/**
|
|
525
|
+
* Specifies the condition names used to match entry points in the `exports` field of a package.
|
|
526
|
+
* @link https://nodejs.org/api/packages.html#packages_exports
|
|
527
|
+
*/
|
|
499
528
|
conditionNames?: string[];
|
|
500
529
|
/**
|
|
501
530
|
* Parse modules in order.
|
|
@@ -661,6 +690,8 @@ export type RuleSetRule = {
|
|
|
661
690
|
oneOf?: (RuleSetRule | Falsy)[];
|
|
662
691
|
/** A kind of Nested Rule, an array of Rules that is also used when the parent Rule matches. */
|
|
663
692
|
rules?: (RuleSetRule | Falsy)[];
|
|
693
|
+
/** Whether to extract source maps from the module. */
|
|
694
|
+
extractSourceMap?: boolean;
|
|
664
695
|
};
|
|
665
696
|
/** A list of rules. */
|
|
666
697
|
export type RuleSetRules = ("..." | RuleSetRule | Falsy)[];
|
|
@@ -724,6 +755,11 @@ export type CssModuleParserOptions = {
|
|
|
724
755
|
url?: CssParserUrl;
|
|
725
756
|
};
|
|
726
757
|
type ExportsPresence = "error" | "warn" | "auto" | false;
|
|
758
|
+
export type JavascriptParserCommonjsExports = boolean | "skipInEsm";
|
|
759
|
+
export type JavascriptParserCommonjsOption = boolean | {
|
|
760
|
+
/** Controls how CommonJS export mutations are handled. */
|
|
761
|
+
exports?: JavascriptParserCommonjsExports;
|
|
762
|
+
};
|
|
727
763
|
export type JavascriptParserOptions = {
|
|
728
764
|
/**
|
|
729
765
|
* Specifies global mode for dynamic import.
|
|
@@ -754,12 +790,17 @@ export type JavascriptParserOptions = {
|
|
|
754
790
|
* Enable parsing of new URL() syntax.
|
|
755
791
|
* @default true
|
|
756
792
|
* */
|
|
757
|
-
url?: "relative" | boolean;
|
|
793
|
+
url?: "relative" | "new-url-relative" | boolean;
|
|
758
794
|
/**
|
|
759
795
|
* Enable warnings for full dynamic dependencies
|
|
760
796
|
* @default true
|
|
761
797
|
* */
|
|
762
798
|
exprContextCritical?: boolean;
|
|
799
|
+
/**
|
|
800
|
+
* Enable warnings for unknown dynamic dependencies
|
|
801
|
+
* @default true
|
|
802
|
+
* */
|
|
803
|
+
unknownContextCritical?: boolean;
|
|
763
804
|
/**
|
|
764
805
|
* Enable warnings for partial dynamic dependencies
|
|
765
806
|
* @default false
|
|
@@ -787,11 +828,24 @@ export type JavascriptParserOptions = {
|
|
|
787
828
|
requireAsExpression?: boolean;
|
|
788
829
|
requireDynamic?: boolean;
|
|
789
830
|
requireResolve?: boolean;
|
|
831
|
+
/**
|
|
832
|
+
* CommonJS-specific parser options. `true` enables the default behaviour, `{ exports: 'skipInEsm' }` preserves CommonJS export mutations when executed inside ESM.
|
|
833
|
+
* @default true
|
|
834
|
+
*/
|
|
835
|
+
commonjs?: JavascriptParserCommonjsOption;
|
|
790
836
|
importDynamic?: boolean;
|
|
837
|
+
/**
|
|
838
|
+
* Enable magic comments for CommonJS require() expressions.
|
|
839
|
+
*/
|
|
840
|
+
commonjsMagicComments?: boolean;
|
|
791
841
|
/** Inline const values in this module */
|
|
792
842
|
inlineConst?: boolean;
|
|
793
843
|
/** Whether to tolerant exportsPresence for type reexport */
|
|
794
844
|
typeReexportsPresence?: "no-tolerant" | "tolerant" | "tolerant-no-check";
|
|
845
|
+
/** Whether to enable JSX parsing */
|
|
846
|
+
jsx?: boolean;
|
|
847
|
+
/** Whether to enable defer import */
|
|
848
|
+
deferImport?: boolean;
|
|
795
849
|
};
|
|
796
850
|
export type JsonParserOptions = {
|
|
797
851
|
/**
|
|
@@ -964,6 +1018,10 @@ export type ModuleOptions = {
|
|
|
964
1018
|
generator?: GeneratorOptionsByModuleType;
|
|
965
1019
|
/** Keep module mechanism of the matched modules as-is, such as module.exports, require, import. */
|
|
966
1020
|
noParse?: NoParseOption;
|
|
1021
|
+
/**
|
|
1022
|
+
* Cache the resolving of module requests.
|
|
1023
|
+
*/
|
|
1024
|
+
unsafeCache?: boolean | RegExp;
|
|
967
1025
|
};
|
|
968
1026
|
type AllowTarget = "web" | "webworker" | "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "es2023" | "es2024" | "es2025" | "node" | "async-node" | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | "electron-main" | `electron${number}-main` | `electron${number}.${number}-main` | "electron-renderer" | `electron${number}-renderer` | `electron${number}.${number}-renderer` | "electron-preload" | `electron${number}-preload` | `electron${number}.${number}-preload` | "nwjs" | `nwjs${number}` | `nwjs${number}.${number}` | "node-webkit" | `node-webkit${number}` | `node-webkit${number}.${number}` | "browserslist" | `browserslist:${string}`;
|
|
969
1027
|
/** Used to configure the target environment of Rspack output and the ECMAScript version of Rspack runtime code. */
|
|
@@ -1167,9 +1225,35 @@ export type SnapshotOptions = {};
|
|
|
1167
1225
|
* cache: false
|
|
1168
1226
|
*/
|
|
1169
1227
|
export type CacheOptions = boolean;
|
|
1170
|
-
type StatsPresets = "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary";
|
|
1228
|
+
export type StatsPresets = "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary";
|
|
1171
1229
|
type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
|
|
1172
1230
|
type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
|
|
1231
|
+
export type StatsColorOptions = {
|
|
1232
|
+
/**
|
|
1233
|
+
* Custom color for bold text.
|
|
1234
|
+
*/
|
|
1235
|
+
bold?: string;
|
|
1236
|
+
/**
|
|
1237
|
+
* Custom color for cyan text.
|
|
1238
|
+
*/
|
|
1239
|
+
cyan?: string;
|
|
1240
|
+
/**
|
|
1241
|
+
* Custom color for green text.
|
|
1242
|
+
*/
|
|
1243
|
+
green?: string;
|
|
1244
|
+
/**
|
|
1245
|
+
* Custom color for magenta text.
|
|
1246
|
+
*/
|
|
1247
|
+
magenta?: string;
|
|
1248
|
+
/**
|
|
1249
|
+
* Custom color for red text.
|
|
1250
|
+
*/
|
|
1251
|
+
red?: string;
|
|
1252
|
+
/**
|
|
1253
|
+
* Custom color for yellow text.
|
|
1254
|
+
*/
|
|
1255
|
+
yellow?: string;
|
|
1256
|
+
};
|
|
1173
1257
|
/** Options for stats */
|
|
1174
1258
|
export type StatsOptions = {
|
|
1175
1259
|
/**
|
|
@@ -1229,7 +1313,7 @@ export type StatsOptions = {
|
|
|
1229
1313
|
* Enables or disables the use of colors in the output.
|
|
1230
1314
|
* @default false
|
|
1231
1315
|
*/
|
|
1232
|
-
colors?: boolean;
|
|
1316
|
+
colors?: boolean | StatsColorOptions;
|
|
1233
1317
|
/**
|
|
1234
1318
|
* Enables or disables the display of the hash.
|
|
1235
1319
|
* @default true
|
|
@@ -1542,6 +1626,9 @@ export type StatsOptions = {
|
|
|
1542
1626
|
*/
|
|
1543
1627
|
warningsSpace?: number;
|
|
1544
1628
|
};
|
|
1629
|
+
export type MultiStatsOptions = Omit<StatsOptions, "children"> & {
|
|
1630
|
+
children?: StatsValue | (StatsValue | undefined)[];
|
|
1631
|
+
};
|
|
1545
1632
|
/**
|
|
1546
1633
|
* Represents the value for stats configuration.
|
|
1547
1634
|
*/
|
|
@@ -1700,7 +1787,7 @@ export type Optimization = {
|
|
|
1700
1787
|
* Customize the minimizer.
|
|
1701
1788
|
* By default, `rspack.SwcJsMinimizerRspackPlugin` and `rspack.LightningCssMinimizerRspackPlugin` are used.
|
|
1702
1789
|
*/
|
|
1703
|
-
minimizer?:
|
|
1790
|
+
minimizer?: ("..." | Plugin)[];
|
|
1704
1791
|
/**
|
|
1705
1792
|
* Whether to merge chunks which contain the same modules.
|
|
1706
1793
|
* Setting optimization.mergeDuplicateChunks to false will disable this optimization.
|
|
@@ -1809,9 +1896,9 @@ export type ExperimentCacheOptions = boolean | {
|
|
|
1809
1896
|
buildDependencies?: string[];
|
|
1810
1897
|
version?: string;
|
|
1811
1898
|
snapshot?: {
|
|
1812
|
-
immutablePaths?:
|
|
1813
|
-
unmanagedPaths?:
|
|
1814
|
-
managedPaths?:
|
|
1899
|
+
immutablePaths?: (string | RegExp)[];
|
|
1900
|
+
unmanagedPaths?: (string | RegExp)[];
|
|
1901
|
+
managedPaths?: (string | RegExp)[];
|
|
1815
1902
|
};
|
|
1816
1903
|
storage?: {
|
|
1817
1904
|
type: "filesystem";
|
|
@@ -1968,6 +2055,7 @@ export type Experiments = {
|
|
|
1968
2055
|
cache?: ExperimentCacheOptions;
|
|
1969
2056
|
/**
|
|
1970
2057
|
* Enable lazy compilation.
|
|
2058
|
+
* @deprecated Please use the configuration top-level `lazyCompilation` option instead.
|
|
1971
2059
|
* @default false
|
|
1972
2060
|
*/
|
|
1973
2061
|
lazyCompilation?: boolean | LazyCompilationOptions;
|
|
@@ -2002,6 +2090,7 @@ export type Experiments = {
|
|
|
2002
2090
|
css?: boolean;
|
|
2003
2091
|
/**
|
|
2004
2092
|
* Enable module layers feature.
|
|
2093
|
+
* @deprecated This option is deprecated, layers is enabled since v1.6.0
|
|
2005
2094
|
* @default false
|
|
2006
2095
|
*/
|
|
2007
2096
|
layers?: boolean;
|
|
@@ -2011,6 +2100,7 @@ export type Experiments = {
|
|
|
2011
2100
|
incremental?: IncrementalPresets | Incremental;
|
|
2012
2101
|
/**
|
|
2013
2102
|
* Enable multi-threaded code splitting algorithm.
|
|
2103
|
+
* @deprecated This option is deprecated, it has a huge regression in some edge cases where the chunk graph has lots of cycles. We'll improve the performance of build_chunk_graph in the future instead
|
|
2014
2104
|
*/
|
|
2015
2105
|
parallelCodeSplitting?: boolean;
|
|
2016
2106
|
/**
|
|
@@ -2038,15 +2128,15 @@ export type Experiments = {
|
|
|
2038
2128
|
*/
|
|
2039
2129
|
useInputFileSystem?: UseInputFileSystem;
|
|
2040
2130
|
/**
|
|
2041
|
-
* Enable
|
|
2131
|
+
* Enable native watcher
|
|
2042
2132
|
* @default false
|
|
2043
2133
|
*/
|
|
2044
|
-
|
|
2134
|
+
nativeWatcher?: boolean;
|
|
2045
2135
|
/**
|
|
2046
|
-
* Enable
|
|
2136
|
+
* Enable inline const feature
|
|
2047
2137
|
* @default false
|
|
2048
2138
|
*/
|
|
2049
|
-
|
|
2139
|
+
inlineConst?: boolean;
|
|
2050
2140
|
/**
|
|
2051
2141
|
* Enable inline enum feature
|
|
2052
2142
|
* @default false
|
|
@@ -2057,6 +2147,16 @@ export type Experiments = {
|
|
|
2057
2147
|
* @default false
|
|
2058
2148
|
*/
|
|
2059
2149
|
typeReexportsPresence?: boolean;
|
|
2150
|
+
/**
|
|
2151
|
+
* Enable lazy make side effects free barrel file
|
|
2152
|
+
* @default false
|
|
2153
|
+
*/
|
|
2154
|
+
lazyBarrel?: boolean;
|
|
2155
|
+
/**
|
|
2156
|
+
* Enable defer import feature
|
|
2157
|
+
* @default false
|
|
2158
|
+
*/
|
|
2159
|
+
deferImport?: boolean;
|
|
2060
2160
|
};
|
|
2061
2161
|
export type Watch = boolean;
|
|
2062
2162
|
/** Options for watch mode. */
|
|
@@ -2089,8 +2189,7 @@ export type WatchOptions = {
|
|
|
2089
2189
|
/**
|
|
2090
2190
|
* Options for devServer, it based on `webpack-dev-server@5`
|
|
2091
2191
|
* */
|
|
2092
|
-
export
|
|
2093
|
-
}
|
|
2192
|
+
export type DevServer = DevServerOptions;
|
|
2094
2193
|
export type { Middleware as DevServerMiddleware } from "./devServer";
|
|
2095
2194
|
/**
|
|
2096
2195
|
* Ignore specific warnings.
|
|
@@ -2274,6 +2373,11 @@ export type RspackOptions = {
|
|
|
2274
2373
|
* Performance optimization options.
|
|
2275
2374
|
*/
|
|
2276
2375
|
performance?: Performance;
|
|
2376
|
+
/**
|
|
2377
|
+
* Enable lazy compilation.
|
|
2378
|
+
* @default false
|
|
2379
|
+
*/
|
|
2380
|
+
lazyCompilation?: boolean | LazyCompilationOptions;
|
|
2277
2381
|
};
|
|
2278
2382
|
/** Configuration for Rspack */
|
|
2279
2383
|
export type Configuration = RspackOptions;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
3
|
+
import type { Compiler } from "../Compiler";
|
|
4
|
+
export type RemoteAliasMap = Record<string, {
|
|
5
|
+
name: string;
|
|
6
|
+
entry?: string;
|
|
7
|
+
}>;
|
|
8
|
+
export type ManifestExposeOption = {
|
|
9
|
+
path: string;
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
export type ManifestSharedOption = {
|
|
13
|
+
name: string;
|
|
14
|
+
version?: string;
|
|
15
|
+
requiredVersion?: string;
|
|
16
|
+
singleton?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type ModuleFederationManifestPluginOptions = {
|
|
19
|
+
name?: string;
|
|
20
|
+
globalName?: string;
|
|
21
|
+
filePath?: string;
|
|
22
|
+
disableAssetsAnalyze?: boolean;
|
|
23
|
+
fileName?: string;
|
|
24
|
+
remoteAliasMap?: RemoteAliasMap;
|
|
25
|
+
exposes?: ManifestExposeOption[];
|
|
26
|
+
shared?: ManifestSharedOption[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* JS-side post-processing plugin: reads mf-manifest.json and mf-stats.json, executes additionalData callback and merges/overwrites manifest.
|
|
30
|
+
* To avoid cross-NAPI callback complexity, this plugin runs at the afterProcessAssets stage to ensure Rust-side MfManifestPlugin has already output its artifacts.
|
|
31
|
+
*/
|
|
32
|
+
export declare class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
33
|
+
name: BuiltinPluginName;
|
|
34
|
+
private opts;
|
|
35
|
+
constructor(opts: ModuleFederationManifestPluginOptions);
|
|
36
|
+
raw(compiler: Compiler): BuiltinPlugin;
|
|
37
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Compiler } from "../Compiler";
|
|
2
|
+
import { type ModuleFederationManifestPluginOptions } from "./ModuleFederationManifestPlugin";
|
|
2
3
|
import type { ModuleFederationPluginV1Options } from "./ModuleFederationPluginV1";
|
|
3
4
|
export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPluginV1Options, "enhanced"> {
|
|
4
5
|
runtimePlugins?: RuntimePlugins;
|
|
5
6
|
implementation?: string;
|
|
6
7
|
shareStrategy?: "version-first" | "loaded-first";
|
|
8
|
+
manifest?: boolean | Omit<ModuleFederationManifestPluginOptions, "remoteAliasMap" | "globalName" | "name" | "exposes" | "shared">;
|
|
7
9
|
}
|
|
8
|
-
export type RuntimePlugins = string[];
|
|
10
|
+
export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
|
|
9
11
|
export declare class ModuleFederationPlugin {
|
|
10
12
|
private _options;
|
|
11
13
|
constructor(_options: ModuleFederationPluginOptions);
|
|
@@ -5,7 +5,7 @@ export declare const ModuleFederationRuntimePlugin: {
|
|
|
5
5
|
new (options?: ModuleFederationRuntimeOptions | undefined): {
|
|
6
6
|
name: string;
|
|
7
7
|
_args: [options?: ModuleFederationRuntimeOptions | undefined];
|
|
8
|
-
affectedHooks:
|
|
8
|
+
affectedHooks: keyof import("..").CompilerHooks | undefined;
|
|
9
9
|
raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
10
10
|
apply(compiler: import("..").Compiler): void;
|
|
11
11
|
};
|
package/dist/cssExtractHmr.js
CHANGED
|
@@ -34,16 +34,17 @@ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_expo
|
|
|
34
34
|
cssReload: ()=>cssReload,
|
|
35
35
|
normalizeUrl: ()=>normalizeUrl
|
|
36
36
|
});
|
|
37
|
-
|
|
37
|
+
const srcByModuleId = Object.create(null), noDocument = "undefined" == typeof document, { forEach } = Array.prototype;
|
|
38
38
|
function noop() {}
|
|
39
39
|
function updateCss(el, url) {
|
|
40
40
|
let normalizedUrl;
|
|
41
41
|
if (url) normalizedUrl = url;
|
|
42
42
|
else {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
let href = el.getAttribute("href");
|
|
44
|
+
if (!href) return;
|
|
45
|
+
normalizedUrl = href.split("?")[0];
|
|
45
46
|
}
|
|
46
|
-
if (!isUrlRequest(
|
|
47
|
+
if (!isUrlRequest(el.href) || !1 === el.isLoaded || !normalizedUrl || !(normalizedUrl.indexOf(".css") > -1)) return;
|
|
47
48
|
el.visited = !0;
|
|
48
49
|
let newEl = el.cloneNode();
|
|
49
50
|
newEl.isLoaded = !1, newEl.addEventListener("load", ()=>{
|
|
@@ -93,14 +94,13 @@ function cssReload(moduleId, options) {
|
|
|
93
94
|
if (!src) return !1;
|
|
94
95
|
let elements = document.querySelectorAll("link"), loaded = !1;
|
|
95
96
|
return forEach.call(elements, (el)=>{
|
|
97
|
+
var href;
|
|
98
|
+
let ret, normalizedHref;
|
|
96
99
|
if (!el.href) return;
|
|
97
|
-
let url =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}), ret;
|
|
102
|
-
}(el.href, src);
|
|
103
|
-
isUrlRequest(url) && !0 !== el.visited && url && (updateCss(el, url), loaded = !0);
|
|
100
|
+
let url = (href = el.href, ret = "", normalizedHref = normalizeUrl(href), src.some((url)=>{
|
|
101
|
+
normalizedHref.indexOf(src) > -1 && (ret = url);
|
|
102
|
+
}), ret);
|
|
103
|
+
!isUrlRequest(url) || !0 !== el.visited && url && (updateCss(el, url), loaded = !0);
|
|
104
104
|
}), loaded;
|
|
105
105
|
}(src);
|
|
106
106
|
if (options.locals) {
|
|
@@ -108,8 +108,7 @@ function cssReload(moduleId, options) {
|
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
reloaded ? console.log("[HMR] CSS reload %s", src && src.join(" ")) : (console.log("[HMR] Reload all CSS"), reloadAll());
|
|
111
|
-
}, timeout = 0, function() {
|
|
112
|
-
for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key];
|
|
111
|
+
}, timeout = 0, function(...args) {
|
|
113
112
|
let self = this;
|
|
114
113
|
clearTimeout(timeout), timeout = setTimeout(function() {
|
|
115
114
|
return fn.apply(self, args);
|
package/dist/cssExtractLoader.js
CHANGED
|
@@ -19,21 +19,21 @@ __webpack_require__.n = (module)=>{
|
|
|
19
19
|
};
|
|
20
20
|
var __webpack_exports__ = {};
|
|
21
21
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
22
|
-
|
|
22
|
+
hotLoader: ()=>hotLoader,
|
|
23
23
|
default: ()=>css_extract_loader,
|
|
24
|
-
|
|
24
|
+
ABSOLUTE_PUBLIC_PATH: ()=>ABSOLUTE_PUBLIC_PATH,
|
|
25
25
|
MODULE_TYPE: ()=>MODULE_TYPE,
|
|
26
|
-
BASE_URI: ()=>BASE_URI,
|
|
27
|
-
hotLoader: ()=>hotLoader,
|
|
28
26
|
AUTO_PUBLIC_PATH: ()=>AUTO_PUBLIC_PATH,
|
|
29
|
-
pitch: ()=>pitch
|
|
27
|
+
pitch: ()=>pitch,
|
|
28
|
+
SINGLE_DOT_PATH_SEGMENT: ()=>SINGLE_DOT_PATH_SEGMENT,
|
|
29
|
+
BASE_URI: ()=>BASE_URI
|
|
30
30
|
});
|
|
31
|
-
|
|
31
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
32
32
|
var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
|
|
33
33
|
function isAbsolutePath(str) {
|
|
34
34
|
return external_node_path_default().posix.isAbsolute(str) || external_node_path_default().win32.isAbsolute(str);
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
const PLUGIN_NAME = "css-extract-rspack-plugin", RELATIVE_PATH_REGEXP = /^\.\.?[/\\]/, BASE_URI = "webpack://", MODULE_TYPE = "css/mini-extract", AUTO_PUBLIC_PATH = "__mini_css_extract_plugin_public_path_auto__", ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`, SINGLE_DOT_PATH_SEGMENT = "__mini_css_extract_plugin_single_dot_path_segment__";
|
|
37
37
|
function hotLoader(content, context) {
|
|
38
38
|
let localsJsonString = JSON.stringify(JSON.stringify(context.locals));
|
|
39
39
|
return `${content}
|
|
@@ -72,7 +72,7 @@ function hotLoader(content, context) {
|
|
|
72
72
|
}
|
|
73
73
|
`;
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
const pitch = function(request, _, data) {
|
|
76
76
|
let publicPathForExtract;
|
|
77
77
|
if (this._compiler?.options?.experiments?.css && this._module && ("css" === this._module.type || "css/auto" === this._module.type || "css/global" === this._module.type || "css/module" === this._module.type)) {
|
|
78
78
|
let e = Error("use type 'css' and `CssExtractRspackPlugin` together, please set `experiments.css` to `false` or set `{ type: \"javascript/auto\" }` for rules with `CssExtractRspackPlugin` in your rspack config (now `CssExtractRspackPlugin` does nothing).");
|
|
@@ -82,64 +82,65 @@ let pitch = function(request, _, data) {
|
|
|
82
82
|
let options = this.getOptions(), emit = void 0 === options.emit || options.emit, callback = this.async(), filepath = this.resourcePath;
|
|
83
83
|
this.addDependency(filepath);
|
|
84
84
|
let { publicPath } = this._compilation.outputOptions;
|
|
85
|
-
"string" == typeof options.publicPath ? publicPath = options.publicPath : "function" == typeof options.publicPath && (publicPath = options.publicPath(this.resourcePath, this.rootContext)), "auto" === publicPath && (publicPath = AUTO_PUBLIC_PATH), publicPathForExtract = "string" == typeof publicPath ? /^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(publicPath) ? publicPath : `${ABSOLUTE_PUBLIC_PATH}${publicPath.replace(/\./g, SINGLE_DOT_PATH_SEGMENT)}` : publicPath
|
|
85
|
+
"string" == typeof options.publicPath ? publicPath = options.publicPath : "function" == typeof options.publicPath && (publicPath = options.publicPath(this.resourcePath, this.rootContext)), "auto" === publicPath && (publicPath = AUTO_PUBLIC_PATH), publicPathForExtract = "string" == typeof publicPath ? /^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(publicPath) ? publicPath : `${ABSOLUTE_PUBLIC_PATH}${publicPath.replace(/\./g, SINGLE_DOT_PATH_SEGMENT)}` : publicPath;
|
|
86
|
+
let handleExports = (originalExports)=>{
|
|
87
|
+
let locals, namedExport, esModule = void 0 === options.esModule || options.esModule, dependencies = [];
|
|
88
|
+
try {
|
|
89
|
+
let exports1 = originalExports.__esModule ? originalExports.default : originalExports;
|
|
90
|
+
if (namedExport = originalExports.__esModule && (!originalExports.default || !("locals" in originalExports.default))) for (let key of Object.keys(originalExports))"default" !== key && (locals || (locals = {}), locals[key] = originalExports[key]);
|
|
91
|
+
else locals = exports1?.locals;
|
|
92
|
+
if (Array.isArray(exports1) && emit) {
|
|
93
|
+
let identifierCountMap = new Map();
|
|
94
|
+
dependencies = exports1.map(([id, content, media, sourceMap, supports, layer])=>{
|
|
95
|
+
let context = this.rootContext, count = identifierCountMap.get(id) || 0;
|
|
96
|
+
return identifierCountMap.set(id, count + 1), {
|
|
97
|
+
identifier: id,
|
|
98
|
+
context,
|
|
99
|
+
content,
|
|
100
|
+
media,
|
|
101
|
+
supports,
|
|
102
|
+
layer,
|
|
103
|
+
identifierIndex: count,
|
|
104
|
+
sourceMap: sourceMap ? JSON.stringify(sourceMap) : void 0,
|
|
105
|
+
filepath
|
|
106
|
+
};
|
|
107
|
+
}).filter((item)=>null !== item);
|
|
108
|
+
}
|
|
109
|
+
} catch (e) {
|
|
110
|
+
callback(e);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
let result = function() {
|
|
114
|
+
if (locals) {
|
|
115
|
+
if (namedExport) {
|
|
116
|
+
let identifiers = Array.from(function*() {
|
|
117
|
+
let identifierId = 0;
|
|
118
|
+
for (let key of Object.keys(locals))identifierId += 1, yield [
|
|
119
|
+
`_${identifierId.toString(16)}`,
|
|
120
|
+
key
|
|
121
|
+
];
|
|
122
|
+
}()), localsString = identifiers.map(([id, key])=>{
|
|
123
|
+
var value;
|
|
124
|
+
return `\nvar ${id} = ${"function" == typeof (value = locals[key]) ? value.toString() : JSON.stringify(value)};`;
|
|
125
|
+
}).join(""), exportsString = `export { ${identifiers.map(([id, key])=>`${id} as ${JSON.stringify(key)}`).join(", ")} }`;
|
|
126
|
+
return void 0 !== options.defaultExport && options.defaultExport ? `${localsString}\n${exportsString}\nexport default { ${identifiers.map(([id, key])=>`${JSON.stringify(key)}: ${id}`).join(", ")} }\n` : `${localsString}\n${exportsString}\n`;
|
|
127
|
+
}
|
|
128
|
+
return `\n${esModule ? "export default" : "module.exports = "} ${JSON.stringify(locals)};`;
|
|
129
|
+
}
|
|
130
|
+
return esModule ? "\nexport {};" : "";
|
|
131
|
+
}(), resultSource = `// extracted by ${PLUGIN_NAME}`;
|
|
132
|
+
resultSource += this.hot && emit ? hotLoader(result, {
|
|
133
|
+
loaderContext: this,
|
|
134
|
+
options,
|
|
135
|
+
locals: locals
|
|
136
|
+
}) : result, dependencies.length > 0 && this.__internal__setParseMeta(PLUGIN_NAME, JSON.stringify(dependencies)), callback(null, resultSource, void 0, data);
|
|
137
|
+
};
|
|
138
|
+
this.importModule(`${this.resourcePath}.webpack[javascript/auto]!=!!!${request}`, {
|
|
86
139
|
layer: options.layer,
|
|
87
140
|
publicPath: publicPathForExtract,
|
|
88
141
|
baseUri: `${BASE_URI}/`
|
|
89
142
|
}, (error, exports1)=>{
|
|
90
|
-
|
|
91
|
-
((originalExports)=>{
|
|
92
|
-
let locals, namedExport, esModule = void 0 === options.esModule || options.esModule, dependencies = [];
|
|
93
|
-
try {
|
|
94
|
-
let exports1 = originalExports.__esModule ? originalExports.default : originalExports;
|
|
95
|
-
if (namedExport = originalExports.__esModule && (!originalExports.default || !("locals" in originalExports.default))) for (let key of Object.keys(originalExports))"default" !== key && (locals || (locals = {}), locals[key] = originalExports[key]);
|
|
96
|
-
else locals = exports1?.locals;
|
|
97
|
-
if (Array.isArray(exports1) && emit) {
|
|
98
|
-
let identifierCountMap = new Map();
|
|
99
|
-
dependencies = exports1.map(([id, content, media, sourceMap, supports, layer])=>{
|
|
100
|
-
let context = this.rootContext, count = identifierCountMap.get(id) || 0;
|
|
101
|
-
return identifierCountMap.set(id, count + 1), {
|
|
102
|
-
identifier: id,
|
|
103
|
-
context,
|
|
104
|
-
content,
|
|
105
|
-
media,
|
|
106
|
-
supports,
|
|
107
|
-
layer,
|
|
108
|
-
identifierIndex: count,
|
|
109
|
-
sourceMap: sourceMap ? JSON.stringify(sourceMap) : void 0,
|
|
110
|
-
filepath
|
|
111
|
-
};
|
|
112
|
-
}).filter((item)=>null !== item);
|
|
113
|
-
}
|
|
114
|
-
} catch (e) {
|
|
115
|
-
callback(e);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
let result = function() {
|
|
119
|
-
if (locals) {
|
|
120
|
-
if (namedExport) {
|
|
121
|
-
let identifiers = Array.from(function*() {
|
|
122
|
-
let identifierId = 0;
|
|
123
|
-
for (let key of Object.keys(locals))identifierId += 1, yield [
|
|
124
|
-
`_${identifierId.toString(16)}`,
|
|
125
|
-
key
|
|
126
|
-
];
|
|
127
|
-
}()), localsString = identifiers.map(([id, key])=>{
|
|
128
|
-
var value;
|
|
129
|
-
return `\nvar ${id} = ${"function" == typeof (value = locals[key]) ? value.toString() : JSON.stringify(value)};`;
|
|
130
|
-
}).join(""), exportsString = `export { ${identifiers.map(([id, key])=>`${id} as ${JSON.stringify(key)}`).join(", ")} }`;
|
|
131
|
-
return void 0 !== options.defaultExport && options.defaultExport ? `${localsString}\n${exportsString}\nexport default { ${identifiers.map(([id, key])=>`${JSON.stringify(key)}: ${id}`).join(", ")} }\n` : `${localsString}\n${exportsString}\n`;
|
|
132
|
-
}
|
|
133
|
-
return `\n${esModule ? "export default" : "module.exports = "} ${JSON.stringify(locals)};`;
|
|
134
|
-
}
|
|
135
|
-
return esModule ? "\nexport {};" : "";
|
|
136
|
-
}(), resultSource = `// extracted by ${PLUGIN_NAME}`;
|
|
137
|
-
resultSource += this.hot && emit ? hotLoader(result, {
|
|
138
|
-
loaderContext: this,
|
|
139
|
-
options,
|
|
140
|
-
locals: locals
|
|
141
|
-
}) : result, dependencies.length > 0 && this.__internal__setParseMeta(PLUGIN_NAME, JSON.stringify(dependencies)), callback(null, resultSource, void 0, data);
|
|
142
|
-
})(exports1);
|
|
143
|
+
error ? callback(error) : handleExports(exports1);
|
|
143
144
|
});
|
|
144
145
|
}, css_extract_loader = function(content) {
|
|
145
146
|
if (this._compiler?.options?.experiments?.css && this._module && ("css" === this._module.type || "css/auto" === this._module.type || "css/global" === this._module.type || "css/module" === this._module.type)) return content;
|