@rspack/core 1.7.3 → 2.0.0-canary.20260120
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/dist/ChunkGraph.d.ts +1 -1
- package/dist/Compilation.d.ts +27 -27
- package/dist/Compiler.d.ts +19 -17
- package/dist/ContextModuleFactory.d.ts +1 -1
- package/dist/Diagnostics.d.ts +1 -1
- package/dist/ExecuteModulePlugin.d.ts +1 -1
- package/dist/ExportsInfo.d.ts +1 -1
- package/dist/FileSystem.d.ts +1 -1
- package/dist/Module.d.ts +2 -2
- package/dist/ModuleGraph.d.ts +2 -2
- package/dist/MultiCompiler.d.ts +7 -7
- package/dist/MultiStats.d.ts +3 -3
- package/dist/MultiWatching.d.ts +2 -2
- package/dist/NativeWatchFileSystem.d.ts +1 -1
- package/dist/NormalModule.d.ts +3 -3
- package/dist/NormalModuleFactory.d.ts +3 -3
- package/dist/Resolver.d.ts +1 -1
- package/dist/ResolverFactory.d.ts +2 -2
- package/dist/RuntimeGlobals.d.ts +2 -2
- package/dist/RuntimeModule.d.ts +3 -3
- package/dist/Stats.d.ts +4 -4
- package/dist/VirtualModulesPlugin.d.ts +1 -1
- package/dist/Watching.d.ts +4 -4
- package/dist/builtin-loader/lightningcss/index.d.ts +11 -14
- package/dist/builtin-loader/lightningcss/target.d.ts +4 -0
- package/dist/builtin-loader/swc/index.d.ts +5 -5
- package/dist/builtin-loader/swc/types.d.ts +2 -8
- package/dist/builtin-plugin/APIPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +3 -3
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/BannerPlugin.d.ts +3 -3
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +3 -3
- package/dist/builtin-plugin/CaseSensitivePlugin.d.ts +3 -3
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +3 -3
- package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +3 -3
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +3 -3
- package/dist/builtin-plugin/CssChunkingPlugin.d.ts +3 -3
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DataUriPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DefinePlugin.d.ts +3 -3
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DllEntryPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +2 -2
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +2 -2
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EntryPlugin.d.ts +4 -4
- package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +3 -1
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +3 -3
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +2 -2
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FileUriPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
- package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +2 -2
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +3 -3
- package/dist/builtin-plugin/HttpUriPlugin.d.ts +2 -2
- package/dist/builtin-plugin/IgnorePlugin.d.ts +3 -3
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/InlineExportsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +4 -4
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +2 -2
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/LibManifestPlugin.d.ts +3 -3
- package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +7 -11
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +3 -3
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +4 -4
- package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ProgressPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ProvidePlugin.d.ts +3 -3
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +3 -3
- package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +3 -3
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +4 -8
- package/dist/builtin-plugin/RslibPlugin.d.ts +3 -3
- package/dist/builtin-plugin/RstestPlugin.d.ts +3 -3
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +3 -3
- package/dist/builtin-plugin/RuntimePlugin.d.ts +6 -10
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +3 -3
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +3 -3
- package/dist/builtin-plugin/SplitChunksPlugin.d.ts +3 -3
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +2 -2
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +6 -5
- package/dist/builtin-plugin/URLPlugin.d.ts +3 -3
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +2 -2
- package/dist/builtin-plugin/WorkerPlugin.d.ts +3 -3
- package/dist/builtin-plugin/base.d.ts +3 -3
- package/dist/builtin-plugin/css-extract/index.d.ts +3 -3
- package/dist/builtin-plugin/css-extract/loader.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/utils.d.ts +1 -1
- package/dist/builtin-plugin/html-plugin/hooks.d.ts +2 -2
- package/dist/builtin-plugin/html-plugin/index.d.ts +2 -2
- package/dist/builtin-plugin/html-plugin/options.d.ts +1 -6
- package/dist/builtin-plugin/html-plugin/plugin.d.ts +5 -9
- package/dist/builtin-plugin/html-plugin/taps.d.ts +1 -1
- package/dist/builtin-plugin/index.d.ts +84 -84
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +4 -4
- package/dist/builtin-plugin/lazy-compilation/middleware.d.ts +2 -2
- package/dist/config/adapter.d.ts +4 -4
- package/dist/config/adapterRuleUse.d.ts +10 -9
- package/dist/config/browserslistTargetHandler.d.ts +1 -1
- package/dist/config/defaults.d.ts +5 -3
- package/dist/config/devServer.d.ts +3 -3
- package/dist/config/index.d.ts +5 -5
- package/dist/config/normalization.d.ts +7 -35
- package/dist/config/target.d.ts +14 -11
- package/dist/config/types.d.ts +80 -157
- package/dist/container/ContainerPlugin.d.ts +3 -3
- package/dist/container/ContainerReferencePlugin.d.ts +3 -3
- package/dist/container/ModuleFederationManifestPlugin.d.ts +2 -2
- package/dist/container/ModuleFederationPlugin.d.ts +3 -3
- package/dist/container/ModuleFederationPluginV1.d.ts +5 -5
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +3 -3
- package/dist/container/index.d.ts +4 -4
- package/dist/cssExtractHmr.js +2 -27
- package/dist/cssExtractLoader.js +18 -60
- package/dist/exports.d.ts +69 -81
- package/dist/index.d.ts +3 -3
- package/dist/index.js +11661 -11726
- package/dist/lib/AbstractMethodError.d.ts +1 -1
- package/dist/lib/Cache.d.ts +1 -1
- package/dist/lib/CacheFacade.d.ts +3 -3
- package/dist/lib/DllPlugin.d.ts +2 -2
- package/dist/lib/DllReferencePlugin.d.ts +3 -3
- package/dist/lib/EntryOptionPlugin.d.ts +2 -2
- package/dist/lib/EnvironmentPlugin.d.ts +1 -1
- package/dist/lib/HookWebpackError.d.ts +1 -1
- package/dist/lib/IgnoreWarningsPlugin.d.ts +1 -1
- package/dist/lib/LoaderOptionsPlugin.d.ts +2 -2
- package/dist/lib/LoaderTargetPlugin.d.ts +2 -2
- package/dist/lib/WebpackError.d.ts +2 -2
- package/dist/lib/cache/MemoryCachePlugin.d.ts +1 -1
- package/dist/lib/cache/getLazyHashedEtag.d.ts +1 -1
- package/dist/lib/cache/mergeEtags.d.ts +1 -1
- package/dist/loader-runner/ModuleError.d.ts +1 -1
- package/dist/loader-runner/index.d.ts +1 -1
- package/dist/loader-runner/loadLoader.d.ts +2 -2
- package/dist/loader-runner/utils.d.ts +3 -3
- package/dist/loader-runner/worker.d.ts +1 -1
- package/dist/logging/createConsoleLogger.d.ts +2 -2
- package/dist/moduleFederationDefaultRuntime.js +1 -1
- package/dist/node/NodeEnvironmentPlugin.d.ts +2 -2
- package/dist/node/NodeTemplatePlugin.d.ts +1 -1
- package/dist/node/NodeWatchFileSystem.d.ts +1 -1
- package/dist/node/nodeConsole.d.ts +1 -1
- package/dist/rslib-runtime.js +29 -0
- package/dist/rspack.d.ts +5 -5
- package/dist/rspackOptionsApply.d.ts +1 -1
- package/dist/runtime/moduleFederationDefaultRuntime.d.ts +1 -2
- package/dist/sharing/ConsumeSharedPlugin.d.ts +2 -2
- package/dist/sharing/ProvideSharedPlugin.d.ts +2 -2
- package/dist/sharing/SharePlugin.d.ts +1 -1
- package/dist/sharing/ShareRuntimePlugin.d.ts +2 -2
- package/dist/stats/DefaultStatsFactoryPlugin.d.ts +1 -1
- package/dist/stats/DefaultStatsPresetPlugin.d.ts +1 -1
- package/dist/stats/DefaultStatsPrinterPlugin.d.ts +1 -1
- package/dist/stats/StatsFactory.d.ts +2 -2
- package/dist/stats/StatsPrinter.d.ts +1 -1
- package/dist/stats/statsFactoryUtils.d.ts +3 -6
- package/dist/taps/compilation.d.ts +1 -1
- package/dist/taps/compiler.d.ts +1 -1
- package/dist/taps/contextModuleFactory.d.ts +1 -1
- package/dist/taps/index.d.ts +6 -6
- package/dist/taps/javascriptModules.d.ts +1 -1
- package/dist/taps/normalModuleFactory.d.ts +1 -1
- package/dist/taps/types.d.ts +1 -1
- package/dist/trace/traceHookPlugin.d.ts +1 -1
- package/dist/util/createHash.d.ts +1 -1
- package/dist/util/fs.d.ts +1 -1
- package/dist/util/hash/md4.d.ts +1 -1
- package/dist/util/hash/xxhash64.d.ts +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/targetsVersion.d.ts +2 -0
- package/dist/util/validateConfig.d.ts +1 -1
- package/dist/worker.js +846 -918
- package/hot/dev-server.js +12 -9
- package/hot/emitter.js +5 -1
- package/hot/lazy-compilation-node.js +4 -1
- package/hot/lazy-compilation-web.js +2 -3
- package/hot/log-apply-result.js +8 -5
- package/hot/log.js +17 -7
- package/hot/only-dev-server.js +13 -10
- package/hot/poll.js +11 -8
- package/hot/signal.js +13 -9
- package/package.json +10 -6
- package/compiled/browserslist-load-config/index.d.ts +0 -21
- package/compiled/browserslist-load-config/index.js +0 -252
- package/compiled/browserslist-load-config/license +0 -21
- package/compiled/browserslist-load-config/package.json +0 -1
- package/dist/builtin-loader/index.d.ts +0 -1
package/dist/config/types.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { AssetInfo, RawFuncUseCtx } from '@rspack/binding';
|
|
2
|
-
import type { HttpUriPluginOptions } from '../builtin-plugin/HttpUriPlugin';
|
|
3
|
-
import type { ChunkGraph } from '../ChunkGraph';
|
|
4
|
-
import type { Compilation, PathData } from '../Compilation';
|
|
5
|
-
import type { Compiler } from '../Compiler';
|
|
6
|
-
import type { Chunk } from '../exports';
|
|
7
|
-
import type WebpackError from '../lib/WebpackError';
|
|
8
|
-
import type { Module } from '../Module';
|
|
9
|
-
import type ModuleGraph from '../ModuleGraph';
|
|
10
|
-
import type { ResolveCallback } from './adapterRuleUse';
|
|
11
|
-
import type { DevServerOptions } from './devServer';
|
|
2
|
+
import type { HttpUriPluginOptions } from '../builtin-plugin/HttpUriPlugin.js';
|
|
3
|
+
import type { ChunkGraph } from '../ChunkGraph.js';
|
|
4
|
+
import type { Compilation, PathData } from '../Compilation.js';
|
|
5
|
+
import type { Compiler } from '../Compiler.js';
|
|
6
|
+
import type { Chunk } from '../exports.js';
|
|
7
|
+
import type WebpackError from '../lib/WebpackError.js';
|
|
8
|
+
import type { Module } from '../Module.js';
|
|
9
|
+
import type ModuleGraph from '../ModuleGraph.js';
|
|
10
|
+
import type { ResolveCallback } from './adapterRuleUse.js';
|
|
11
|
+
import type { DevServerOptions } from './devServer.js';
|
|
12
12
|
/** https://github.com/microsoft/TypeScript/issues/29729 */
|
|
13
13
|
export type LiteralUnion<T extends U, U> = T | (U & Record<never, never>);
|
|
14
14
|
export type FilenameTemplate = string;
|
|
@@ -83,6 +83,10 @@ export type LibraryOptions = {
|
|
|
83
83
|
* Otherwise, an anonymous define is used.
|
|
84
84
|
* */
|
|
85
85
|
umdNamedDefine?: UmdNamedDefine;
|
|
86
|
+
/**
|
|
87
|
+
* PreserveModules only works for `modern-module`
|
|
88
|
+
*/
|
|
89
|
+
preserveModules?: string;
|
|
86
90
|
};
|
|
87
91
|
/** Options for library. */
|
|
88
92
|
export type Library = LibraryName | LibraryOptions | undefined;
|
|
@@ -325,14 +329,6 @@ export type Output = {
|
|
|
325
329
|
crossOriginLoading?: CrossOriginLoading;
|
|
326
330
|
/** This option determines the name of CSS output files on disk. */
|
|
327
331
|
cssFilename?: CssFilename;
|
|
328
|
-
/**
|
|
329
|
-
* @deprecated this config is unused, and will be removed in the future.
|
|
330
|
-
* Rspack adds some metadata in CSS to parse CSS modules, and this configuration determines whether to compress these metadata.
|
|
331
|
-
*
|
|
332
|
-
* The value is `true` in production mode.
|
|
333
|
-
* The value is `false` in development mode.
|
|
334
|
-
* */
|
|
335
|
-
cssHeadDataCompression?: boolean;
|
|
336
332
|
/** This option determines the name of non-initial CSS output files on disk. */
|
|
337
333
|
cssChunkFilename?: CssChunkFilename;
|
|
338
334
|
/**
|
|
@@ -347,7 +343,7 @@ export type Output = {
|
|
|
347
343
|
hotUpdateChunkFilename?: HotUpdateChunkFilename;
|
|
348
344
|
/**
|
|
349
345
|
* Only used when target is set to 'web', which uses JSONP for loading hot updates.
|
|
350
|
-
* @default '
|
|
346
|
+
* @default 'rspackHotUpdate' + output.uniqueName
|
|
351
347
|
* */
|
|
352
348
|
hotUpdateGlobal?: HotUpdateGlobal;
|
|
353
349
|
/**
|
|
@@ -369,26 +365,6 @@ export type Output = {
|
|
|
369
365
|
enabledLibraryTypes?: EnabledLibraryTypes;
|
|
370
366
|
/** Output a library exposing the exports of your entry point. */
|
|
371
367
|
library?: Library;
|
|
372
|
-
/**
|
|
373
|
-
* Specify which export should be exposed as a library.
|
|
374
|
-
* @deprecated We might drop support for this, so prefer to use output.library.export
|
|
375
|
-
* */
|
|
376
|
-
libraryExport?: LibraryExport;
|
|
377
|
-
/**
|
|
378
|
-
* Configure how the library will be exposed.
|
|
379
|
-
* @deprecated Use output.library.type instead as we might drop support for output.libraryTarget in the future.
|
|
380
|
-
* */
|
|
381
|
-
libraryTarget?: LibraryType;
|
|
382
|
-
/**
|
|
383
|
-
* When using output.library.type: "umd", setting output.umdNamedDefine to true will name the AMD module of the UMD build.
|
|
384
|
-
* @deprecated Use output.library.umdNamedDefine instead.
|
|
385
|
-
*/
|
|
386
|
-
umdNamedDefine?: UmdNamedDefine;
|
|
387
|
-
/**
|
|
388
|
-
* Add a comment in the UMD wrapper.
|
|
389
|
-
* @deprecated use output.library.auxiliaryComment instead.
|
|
390
|
-
* */
|
|
391
|
-
auxiliaryComment?: AuxiliaryComment;
|
|
392
368
|
/**
|
|
393
369
|
* Output JavaScript files as module type.
|
|
394
370
|
* Disabled by default as it's an experimental feature. To use it, you must set experiments.outputModule to true.
|
|
@@ -501,17 +477,16 @@ export type Output = {
|
|
|
501
477
|
* @default 120000
|
|
502
478
|
* */
|
|
503
479
|
chunkLoadTimeout?: number;
|
|
504
|
-
/**
|
|
505
|
-
* Add charset="utf-8" to the HTML <script> tag.
|
|
506
|
-
* @default true
|
|
507
|
-
* */
|
|
508
|
-
charset?: boolean;
|
|
509
480
|
/** Tell Rspack what kind of ES-features may be used in the generated runtime-code. */
|
|
510
481
|
environment?: Environment;
|
|
511
482
|
/**
|
|
512
483
|
* Check if to be emitted file already exists and have the same content before writing to output filesystem.
|
|
513
484
|
*/
|
|
514
485
|
compareBeforeEmit?: boolean;
|
|
486
|
+
/**
|
|
487
|
+
* Information about the bundler.
|
|
488
|
+
*/
|
|
489
|
+
bundlerInfo?: BundlerInfoOptions;
|
|
515
490
|
};
|
|
516
491
|
/**
|
|
517
492
|
* Path alias
|
|
@@ -855,17 +830,33 @@ export type JavascriptParserOptions = {
|
|
|
855
830
|
overrideStrict?: 'strict' | 'non-strict';
|
|
856
831
|
/**
|
|
857
832
|
* Control whether renaming of the CommonJS `require` function will be parsed and transformed.
|
|
858
|
-
* @default
|
|
833
|
+
* @default false
|
|
859
834
|
*/
|
|
860
835
|
requireAlias?: boolean;
|
|
836
|
+
/**
|
|
837
|
+
* Control whether `require` used as an expression (e.g., `const req = require; req('./module')`) will be parsed.
|
|
838
|
+
* @default true
|
|
839
|
+
*/
|
|
861
840
|
requireAsExpression?: boolean;
|
|
841
|
+
/**
|
|
842
|
+
* Control whether dynamic `require` calls (e.g., `require(variable)`) will be parsed.
|
|
843
|
+
* @default true
|
|
844
|
+
*/
|
|
862
845
|
requireDynamic?: boolean;
|
|
846
|
+
/**
|
|
847
|
+
* Control whether `require.resolve()` calls will be parsed.
|
|
848
|
+
* @default true
|
|
849
|
+
*/
|
|
863
850
|
requireResolve?: boolean;
|
|
864
851
|
/**
|
|
865
852
|
* CommonJS-specific parser options. `true` enables the default behaviour, `{ exports: 'skipInEsm' }` preserves CommonJS export mutations when executed inside ESM.
|
|
866
853
|
* @default true
|
|
867
854
|
*/
|
|
868
855
|
commonjs?: JavascriptParserCommonjsOption;
|
|
856
|
+
/**
|
|
857
|
+
* Control whether dynamic `import()` calls (e.g., `import(variable)`) will be parsed.
|
|
858
|
+
* @default true
|
|
859
|
+
*/
|
|
869
860
|
importDynamic?: boolean;
|
|
870
861
|
/**
|
|
871
862
|
* Enable magic comments for CommonJS require() expressions.
|
|
@@ -875,7 +866,11 @@ export type JavascriptParserOptions = {
|
|
|
875
866
|
typeReexportsPresence?: 'no-tolerant' | 'tolerant' | 'tolerant-no-check';
|
|
876
867
|
/** Whether to enable JSX parsing */
|
|
877
868
|
jsx?: boolean;
|
|
878
|
-
/**
|
|
869
|
+
/**
|
|
870
|
+
* Whether to enable defer import.
|
|
871
|
+
* This option is controlled by `experiments.deferImport` and should not be set directly.
|
|
872
|
+
* @default false
|
|
873
|
+
*/
|
|
879
874
|
deferImport?: boolean;
|
|
880
875
|
};
|
|
881
876
|
export type JsonParserOptions = {
|
|
@@ -1059,12 +1054,12 @@ type AllowTarget = 'web' | 'webworker' | 'es3' | 'es5' | 'es2015' | 'es2016' | '
|
|
|
1059
1054
|
export type Target = false | AllowTarget | AllowTarget[];
|
|
1060
1055
|
/**
|
|
1061
1056
|
* Specify the default type of externals.
|
|
1062
|
-
* `amd`, `umd`, `system` and `jsonp` externals depend on the `output.
|
|
1057
|
+
* `amd`, `umd`, `system` and `jsonp` externals depend on the `output.library.type` being set to the same value e.g. you can only consume amd externals within an amd library.
|
|
1063
1058
|
* @default 'var'
|
|
1064
1059
|
*/
|
|
1065
1060
|
export type ExternalsType = 'var' | 'module' | 'assign' | 'this' | 'window' | 'self' | 'global' | 'commonjs' | 'commonjs2' | 'commonjs-module' | 'commonjs-static' | 'amd' | 'amd-require' | 'umd' | 'umd2' | 'jsonp' | 'system' | 'promise' | 'import' | 'module-import' | 'script' | 'node-commonjs' | 'commonjs-import';
|
|
1066
1061
|
/**
|
|
1067
|
-
* External item object when both
|
|
1062
|
+
* External item object when both library.type and externalsType is 'umd'
|
|
1068
1063
|
*/
|
|
1069
1064
|
export type ExternalItemUmdValue = {
|
|
1070
1065
|
root: string | string[];
|
|
@@ -1081,7 +1076,7 @@ export type ExternalItemObjectValue = Record<string, string | string[]>;
|
|
|
1081
1076
|
*/
|
|
1082
1077
|
export type ExternalItemValue = string | boolean | string[] | ExternalItemUmdValue
|
|
1083
1078
|
/**
|
|
1084
|
-
* when
|
|
1079
|
+
* when library.type and externalsType is not 'umd'
|
|
1085
1080
|
*/
|
|
1086
1081
|
| ExternalItemObjectValue;
|
|
1087
1082
|
/**
|
|
@@ -1255,7 +1250,22 @@ export type SnapshotOptions = {};
|
|
|
1255
1250
|
* // Disable caching
|
|
1256
1251
|
* cache: false
|
|
1257
1252
|
*/
|
|
1258
|
-
export type CacheOptions = boolean
|
|
1253
|
+
export type CacheOptions = boolean | {
|
|
1254
|
+
type: 'memory';
|
|
1255
|
+
} | {
|
|
1256
|
+
type: 'persistent';
|
|
1257
|
+
buildDependencies?: string[];
|
|
1258
|
+
version?: string;
|
|
1259
|
+
snapshot?: {
|
|
1260
|
+
immutablePaths?: (string | RegExp)[];
|
|
1261
|
+
unmanagedPaths?: (string | RegExp)[];
|
|
1262
|
+
managedPaths?: (string | RegExp)[];
|
|
1263
|
+
};
|
|
1264
|
+
storage?: {
|
|
1265
|
+
type: 'filesystem';
|
|
1266
|
+
directory?: string;
|
|
1267
|
+
};
|
|
1268
|
+
};
|
|
1259
1269
|
export type StatsPresets = 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings' | 'minimal' | 'detailed' | 'summary';
|
|
1260
1270
|
type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
|
|
1261
1271
|
type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
|
|
@@ -1917,53 +1927,21 @@ export type Optimization = {
|
|
|
1917
1927
|
avoidEntryIife?: boolean;
|
|
1918
1928
|
};
|
|
1919
1929
|
/**
|
|
1920
|
-
*
|
|
1921
|
-
* @description Controls whether caching is enabled or disabled.
|
|
1922
|
-
* @default true in development mode, false in production mode
|
|
1923
|
-
* @example
|
|
1924
|
-
* // Enable caching
|
|
1925
|
-
* cache: true
|
|
1926
|
-
*
|
|
1927
|
-
* // Disable caching
|
|
1928
|
-
* cache: false
|
|
1930
|
+
* Information about the bundler.
|
|
1929
1931
|
*/
|
|
1930
|
-
export type
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
buildDependencies?: string[];
|
|
1932
|
+
export type BundlerInfoOptions = {
|
|
1933
|
+
/**
|
|
1934
|
+
* Version of the bundler.
|
|
1935
|
+
*/
|
|
1935
1936
|
version?: string;
|
|
1936
|
-
snapshot?: {
|
|
1937
|
-
immutablePaths?: (string | RegExp)[];
|
|
1938
|
-
unmanagedPaths?: (string | RegExp)[];
|
|
1939
|
-
managedPaths?: (string | RegExp)[];
|
|
1940
|
-
};
|
|
1941
|
-
storage?: {
|
|
1942
|
-
type: 'filesystem';
|
|
1943
|
-
directory?: string;
|
|
1944
|
-
};
|
|
1945
|
-
};
|
|
1946
|
-
/**
|
|
1947
|
-
* Options for future Rspack features.
|
|
1948
|
-
*/
|
|
1949
|
-
export type RspackFutureOptions = {
|
|
1950
1937
|
/**
|
|
1951
|
-
*
|
|
1938
|
+
* Name of the bundler.
|
|
1952
1939
|
*/
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
/**
|
|
1959
|
-
* Name of the bundler.
|
|
1960
|
-
*/
|
|
1961
|
-
bundler?: string;
|
|
1962
|
-
/**
|
|
1963
|
-
* Force specific features.
|
|
1964
|
-
*/
|
|
1965
|
-
force?: boolean | ('version' | 'uniqueId')[];
|
|
1966
|
-
};
|
|
1940
|
+
bundler?: string;
|
|
1941
|
+
/**
|
|
1942
|
+
* Force specific features.
|
|
1943
|
+
*/
|
|
1944
|
+
force?: boolean | ('version' | 'uniqueId')[];
|
|
1967
1945
|
};
|
|
1968
1946
|
/**
|
|
1969
1947
|
* Options for lazy compilation.
|
|
@@ -2087,16 +2065,6 @@ export type UseInputFileSystem = false | RegExp[];
|
|
|
2087
2065
|
* Experimental features configuration.
|
|
2088
2066
|
*/
|
|
2089
2067
|
export type Experiments = {
|
|
2090
|
-
/**
|
|
2091
|
-
* Enable new cache.
|
|
2092
|
-
*/
|
|
2093
|
-
cache?: ExperimentCacheOptions;
|
|
2094
|
-
/**
|
|
2095
|
-
* Enable lazy compilation.
|
|
2096
|
-
* @deprecated Please use the configuration top-level `lazyCompilation` option instead.
|
|
2097
|
-
* @default false
|
|
2098
|
-
*/
|
|
2099
|
-
lazyCompilation?: boolean | LazyCompilationOptions;
|
|
2100
2068
|
/**
|
|
2101
2069
|
* Enable async WebAssembly.
|
|
2102
2070
|
* Support the new WebAssembly according to the [updated specification](https://github.com/WebAssembly/esm-integration), it makes a WebAssembly module an async module.
|
|
@@ -2108,12 +2076,6 @@ export type Experiments = {
|
|
|
2108
2076
|
* @default false
|
|
2109
2077
|
*/
|
|
2110
2078
|
outputModule?: boolean;
|
|
2111
|
-
/**
|
|
2112
|
-
* Enable top-level await.
|
|
2113
|
-
* @deprecated This option is deprecated, top-level await is enabled by default.
|
|
2114
|
-
* @default true
|
|
2115
|
-
*/
|
|
2116
|
-
topLevelAwait?: boolean;
|
|
2117
2079
|
/**
|
|
2118
2080
|
* Enable CSS support.
|
|
2119
2081
|
*
|
|
@@ -2125,14 +2087,16 @@ export type Experiments = {
|
|
|
2125
2087
|
* - `module.generator["css/auto"]`
|
|
2126
2088
|
* - `module.generator.css`
|
|
2127
2089
|
* - `module.generator["css/module"]`
|
|
2090
|
+
*
|
|
2091
|
+
* @deprecated This option is deprecated. In Rspack 2.0, users need to manually add CSS rules to enable CSS support.
|
|
2092
|
+
* Example:
|
|
2093
|
+
* ```js
|
|
2094
|
+
* module: {
|
|
2095
|
+
* rules: [{ test: /\.css$/, type: "css/auto" }]
|
|
2096
|
+
* }
|
|
2097
|
+
* ```
|
|
2128
2098
|
*/
|
|
2129
2099
|
css?: boolean;
|
|
2130
|
-
/**
|
|
2131
|
-
* Enable module layers feature.
|
|
2132
|
-
* @deprecated This option is deprecated, layers is enabled since v1.6.0
|
|
2133
|
-
* @default false
|
|
2134
|
-
*/
|
|
2135
|
-
layers?: boolean;
|
|
2136
2100
|
/**
|
|
2137
2101
|
* Enable incremental builds.
|
|
2138
2102
|
*/
|
|
@@ -2142,20 +2106,11 @@ export type Experiments = {
|
|
|
2142
2106
|
* @default false
|
|
2143
2107
|
*/
|
|
2144
2108
|
futureDefaults?: boolean;
|
|
2145
|
-
/**
|
|
2146
|
-
* Enable future Rspack features default options.
|
|
2147
|
-
*/
|
|
2148
|
-
rspackFuture?: RspackFutureOptions;
|
|
2149
2109
|
/**
|
|
2150
2110
|
* Enable loading of modules via HTTP/HTTPS requests.
|
|
2151
2111
|
* @default false
|
|
2152
2112
|
*/
|
|
2153
2113
|
buildHttp?: HttpUriOptions;
|
|
2154
|
-
/**
|
|
2155
|
-
* Enable parallel loader
|
|
2156
|
-
* @default false
|
|
2157
|
-
*/
|
|
2158
|
-
parallelLoader?: boolean;
|
|
2159
2114
|
/**
|
|
2160
2115
|
* Enable Node.js input file system
|
|
2161
2116
|
* @default false
|
|
@@ -2166,30 +2121,6 @@ export type Experiments = {
|
|
|
2166
2121
|
* @default false
|
|
2167
2122
|
*/
|
|
2168
2123
|
nativeWatcher?: boolean;
|
|
2169
|
-
/**
|
|
2170
|
-
* Enable inline const feature
|
|
2171
|
-
* @default false
|
|
2172
|
-
* @deprecated This option is deprecated, it's already stable and enabled by default, Rspack will remove this option in future version
|
|
2173
|
-
*/
|
|
2174
|
-
inlineConst?: boolean;
|
|
2175
|
-
/**
|
|
2176
|
-
* Enable inline enum feature
|
|
2177
|
-
* @default false
|
|
2178
|
-
* @deprecated This option is deprecated, it's already stable. Rspack will remove this option in future version
|
|
2179
|
-
*/
|
|
2180
|
-
inlineEnum?: boolean;
|
|
2181
|
-
/**
|
|
2182
|
-
* Enable type reexports presence feature
|
|
2183
|
-
* @default false
|
|
2184
|
-
* @deprecated This option is deprecated, it's already stable. Rspack will remove this option in future version
|
|
2185
|
-
*/
|
|
2186
|
-
typeReexportsPresence?: boolean;
|
|
2187
|
-
/**
|
|
2188
|
-
* Enable lazy make side effects free barrel file
|
|
2189
|
-
* @default false
|
|
2190
|
-
* @deprecated This option is deprecated, it's already stable and enabled by default, Rspack will remove this option in future version
|
|
2191
|
-
*/
|
|
2192
|
-
lazyBarrel?: boolean;
|
|
2193
2124
|
/**
|
|
2194
2125
|
* Enable defer import feature
|
|
2195
2126
|
* @default false
|
|
@@ -2228,7 +2159,7 @@ export type WatchOptions = {
|
|
|
2228
2159
|
* Options for devServer, it based on `webpack-dev-server@5`
|
|
2229
2160
|
* */
|
|
2230
2161
|
export type DevServer = DevServerOptions;
|
|
2231
|
-
export type { Middleware as DevServerMiddleware } from './devServer';
|
|
2162
|
+
export type { Middleware as DevServerMiddleware } from './devServer.js';
|
|
2232
2163
|
/**
|
|
2233
2164
|
* Ignore specific warnings.
|
|
2234
2165
|
*/
|
|
@@ -2246,10 +2177,6 @@ export type IgnoreWarnings = (RegExp | {
|
|
|
2246
2177
|
*/
|
|
2247
2178
|
module?: RegExp;
|
|
2248
2179
|
} | ((warning: WebpackError, compilation: Compilation) => boolean))[];
|
|
2249
|
-
/**
|
|
2250
|
-
* Capture a "profile" of the application, including statistics and hints, which can then be dissected using the Analyze tool.
|
|
2251
|
-
* */
|
|
2252
|
-
export type Profile = boolean;
|
|
2253
2180
|
/**
|
|
2254
2181
|
* Set the value of `require.amd` and `define.amd`. Or disable AMD support.
|
|
2255
2182
|
*/
|
|
@@ -2405,10 +2332,6 @@ export type RspackOptions = {
|
|
|
2405
2332
|
* Options for module configuration.
|
|
2406
2333
|
*/
|
|
2407
2334
|
module?: ModuleOptions;
|
|
2408
|
-
/**
|
|
2409
|
-
* Whether to capture a profile of the application.
|
|
2410
|
-
*/
|
|
2411
|
-
profile?: Profile;
|
|
2412
2335
|
/**
|
|
2413
2336
|
* Set the value of `require.amd` or `define.amd`.
|
|
2414
2337
|
* Setting `amd` to false will disable rspack's AMD support.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
|
|
2
|
-
import { RspackBuiltinPlugin } from '../builtin-plugin/base';
|
|
3
|
-
import type { Compiler } from '../Compiler';
|
|
4
|
-
import type { EntryRuntime, FilenameTemplate, LibraryOptions } from '../config';
|
|
2
|
+
import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
|
|
3
|
+
import type { Compiler } from '../Compiler.js';
|
|
4
|
+
import type { EntryRuntime, FilenameTemplate, LibraryOptions } from '../config/index.js';
|
|
5
5
|
export type ContainerPluginOptions = {
|
|
6
6
|
exposes: Exposes;
|
|
7
7
|
filename?: FilenameTemplate;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
|
|
2
|
-
import { RspackBuiltinPlugin } from '../builtin-plugin/base';
|
|
3
|
-
import type { Compiler } from '../Compiler';
|
|
4
|
-
import type { ExternalsType } from '../config';
|
|
2
|
+
import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
|
|
3
|
+
import type { Compiler } from '../Compiler.js';
|
|
4
|
+
import type { ExternalsType } from '../config/index.js';
|
|
5
5
|
export type ContainerReferencePluginOptions = {
|
|
6
6
|
remoteType: ExternalsType;
|
|
7
7
|
remotes: Remotes;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
|
|
2
|
-
import { RspackBuiltinPlugin } from '../builtin-plugin/base';
|
|
3
|
-
import type { Compiler } from '../Compiler';
|
|
2
|
+
import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
|
|
3
|
+
import type { Compiler } from '../Compiler.js';
|
|
4
4
|
export type RemoteAliasMap = Record<string, {
|
|
5
5
|
name: string;
|
|
6
6
|
entry?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Compiler } from '../Compiler';
|
|
2
|
-
import { type ModuleFederationManifestPluginOptions } from './ModuleFederationManifestPlugin';
|
|
3
|
-
import type { ModuleFederationPluginV1Options } from './ModuleFederationPluginV1';
|
|
1
|
+
import type { Compiler } from '../Compiler.js';
|
|
2
|
+
import { type ModuleFederationManifestPluginOptions } from './ModuleFederationManifestPlugin.js';
|
|
3
|
+
import type { ModuleFederationPluginV1Options } from './ModuleFederationPluginV1.js';
|
|
4
4
|
export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPluginV1Options, 'enhanced'> {
|
|
5
5
|
runtimePlugins?: RuntimePlugins;
|
|
6
6
|
implementation?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Compiler } from '../Compiler';
|
|
2
|
-
import type { EntryRuntime, ExternalsType, LibraryOptions } from '../config';
|
|
3
|
-
import { type Shared } from '../sharing/SharePlugin';
|
|
4
|
-
import { type Exposes } from './ContainerPlugin';
|
|
5
|
-
import { type Remotes } from './ContainerReferencePlugin';
|
|
1
|
+
import type { Compiler } from '../Compiler.js';
|
|
2
|
+
import type { EntryRuntime, ExternalsType, LibraryOptions } from '../config/index.js';
|
|
3
|
+
import { type Shared } from '../sharing/SharePlugin.js';
|
|
4
|
+
import { type Exposes } from './ContainerPlugin.js';
|
|
5
|
+
import { type Remotes } from './ContainerReferencePlugin.js';
|
|
6
6
|
export interface ModuleFederationPluginV1Options {
|
|
7
7
|
exposes?: Exposes;
|
|
8
8
|
filename?: string;
|
|
@@ -5,8 +5,8 @@ export declare const ModuleFederationRuntimePlugin: {
|
|
|
5
5
|
new (options?: ModuleFederationRuntimeOptions | undefined): {
|
|
6
6
|
name: string;
|
|
7
7
|
_args: [options?: ModuleFederationRuntimeOptions | undefined];
|
|
8
|
-
affectedHooks: keyof import("
|
|
9
|
-
raw(compiler: import("
|
|
10
|
-
apply(compiler: import("
|
|
8
|
+
affectedHooks: keyof import("../index.js").CompilerHooks | undefined;
|
|
9
|
+
raw(compiler: import("../index.js").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
10
|
+
apply(compiler: import("../index.js").Compiler): void;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './ContainerPlugin';
|
|
2
|
-
export * from './ContainerReferencePlugin';
|
|
3
|
-
export * from './ModuleFederationPlugin';
|
|
4
|
-
export * from './ModuleFederationPluginV1';
|
|
1
|
+
export * from './ContainerPlugin.js';
|
|
2
|
+
export * from './ContainerReferencePlugin.js';
|
|
3
|
+
export * from './ModuleFederationPlugin.js';
|
|
4
|
+
export * from './ModuleFederationPluginV1.js';
|
package/dist/cssExtractHmr.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
4
|
-
for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
5
|
-
enumerable: !0,
|
|
6
|
-
get: definition[key]
|
|
7
|
-
});
|
|
8
|
-
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
|
|
9
|
-
"u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
10
|
-
value: 'Module'
|
|
11
|
-
}), Object.defineProperty(exports1, '__esModule', {
|
|
12
|
-
value: !0
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
var __webpack_exports__ = {};
|
|
16
1
|
function normalizeUrl(url) {
|
|
17
2
|
let urlString = url.trim();
|
|
18
3
|
if (/^data:/i.test(urlString)) return urlString;
|
|
@@ -30,11 +15,7 @@ function normalizeUrl(url) {
|
|
|
30
15
|
return accumulator;
|
|
31
16
|
}, []).join('/');
|
|
32
17
|
}
|
|
33
|
-
|
|
34
|
-
cssReload: ()=>cssReload,
|
|
35
|
-
normalizeUrl: ()=>normalizeUrl
|
|
36
|
-
});
|
|
37
|
-
const srcByModuleId = Object.create(null), noDocument = "u" < typeof document, { forEach } = Array.prototype;
|
|
18
|
+
let srcByModuleId = Object.create(null), noDocument = "u" < typeof document, { forEach: forEach } = Array.prototype;
|
|
38
19
|
function noop() {}
|
|
39
20
|
function updateCss(el, url) {
|
|
40
21
|
let normalizedUrl;
|
|
@@ -115,10 +96,4 @@ function cssReload(moduleId, options) {
|
|
|
115
96
|
}, 50);
|
|
116
97
|
};
|
|
117
98
|
}
|
|
118
|
-
|
|
119
|
-
"cssReload",
|
|
120
|
-
"normalizeUrl"
|
|
121
|
-
].indexOf(__rspack_i) && (exports[__rspack_i] = __webpack_exports__[__rspack_i]);
|
|
122
|
-
Object.defineProperty(exports, '__esModule', {
|
|
123
|
-
value: !0
|
|
124
|
-
});
|
|
99
|
+
export { cssReload, normalizeUrl };
|
package/dist/cssExtractLoader.js
CHANGED
|
@@ -1,39 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
__webpack_require__.n = (module)=>{
|
|
4
|
-
var getter = module && module.__esModule ? ()=>module.default : ()=>module;
|
|
5
|
-
return __webpack_require__.d(getter, {
|
|
6
|
-
a: getter
|
|
7
|
-
}), getter;
|
|
8
|
-
}, __webpack_require__.d = (exports1, definition)=>{
|
|
9
|
-
for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
10
|
-
enumerable: !0,
|
|
11
|
-
get: definition[key]
|
|
12
|
-
});
|
|
13
|
-
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
|
|
14
|
-
"u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
15
|
-
value: 'Module'
|
|
16
|
-
}), Object.defineProperty(exports1, '__esModule', {
|
|
17
|
-
value: !0
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
var __webpack_exports__ = {};
|
|
21
|
-
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
22
|
-
hotLoader: ()=>hotLoader,
|
|
23
|
-
default: ()=>css_extract_loader,
|
|
24
|
-
ABSOLUTE_PUBLIC_PATH: ()=>ABSOLUTE_PUBLIC_PATH,
|
|
25
|
-
MODULE_TYPE: ()=>MODULE_TYPE,
|
|
26
|
-
AUTO_PUBLIC_PATH: ()=>AUTO_PUBLIC_PATH,
|
|
27
|
-
pitch: ()=>pitch,
|
|
28
|
-
SINGLE_DOT_PATH_SEGMENT: ()=>SINGLE_DOT_PATH_SEGMENT,
|
|
29
|
-
BASE_URI: ()=>BASE_URI
|
|
30
|
-
});
|
|
31
|
-
const external_node_path_namespaceObject = require("node:path");
|
|
32
|
-
var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
|
|
1
|
+
import node_path from "node:path";
|
|
33
2
|
function isAbsolutePath(str) {
|
|
34
|
-
return
|
|
3
|
+
return node_path.posix.isAbsolute(str) || node_path.win32.isAbsolute(str);
|
|
35
4
|
}
|
|
36
|
-
|
|
5
|
+
let PLUGIN_NAME = 'css-extract-rspack-plugin', RELATIVE_PATH_REGEXP = /^\.\.?[/\\]/, BASE_URI = 'rspack-css-extract://', MODULE_TYPE = 'css/mini-extract', AUTO_PUBLIC_PATH = '__css_extract_public_path_auto__', ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/css-extract-plugin/`, SINGLE_DOT_PATH_SEGMENT = '__css_extract_single_dot_path_segment__';
|
|
37
6
|
function hotLoader(content, context) {
|
|
38
7
|
let localsJsonString = JSON.stringify(JSON.stringify(context.locals));
|
|
39
8
|
return `${content}
|
|
@@ -48,12 +17,12 @@ function hotLoader(content, context) {
|
|
|
48
17
|
let splittedPart = part.match(/^(.*?)(\?.*)/), query = splittedPart ? splittedPart[2] : '', singlePath = splittedPart ? splittedPart[1] : part;
|
|
49
18
|
if (isAbsolutePath(singlePath) && context) {
|
|
50
19
|
var str;
|
|
51
|
-
if (isAbsolutePath(singlePath =
|
|
20
|
+
if (isAbsolutePath(singlePath = node_path.relative(context, singlePath))) return singlePath + query;
|
|
52
21
|
str = singlePath, RELATIVE_PATH_REGEXP.test(str) || (singlePath = `./${singlePath}`);
|
|
53
22
|
}
|
|
54
23
|
return singlePath.replace(/\\/g, '/') + query;
|
|
55
24
|
}).join('!'));
|
|
56
|
-
}(context.loaderContext,
|
|
25
|
+
}(context.loaderContext, node_path.join(import.meta.dirname, 'cssExtractHmr.js'))}).cssReload(module.id, ${JSON.stringify(context.options ?? {})});
|
|
57
26
|
// only invalidate when locals change
|
|
58
27
|
if (
|
|
59
28
|
module.hot.data &&
|
|
@@ -72,10 +41,10 @@ function hotLoader(content, context) {
|
|
|
72
41
|
}
|
|
73
42
|
`;
|
|
74
43
|
}
|
|
75
|
-
|
|
44
|
+
let pitch = function(request, _, data) {
|
|
76
45
|
let publicPathForExtract;
|
|
77
|
-
if (this.
|
|
78
|
-
let e = Error("use type 'css' and `CssExtractRspackPlugin` together, please set `
|
|
46
|
+
if (this._module && ('css' === this._module.type || 'css/auto' === this._module.type || 'css/global' === this._module.type || 'css/module' === this._module.type)) {
|
|
47
|
+
let e = Error("use type 'css' and `CssExtractRspackPlugin` together, please set `{ type: \"javascript/auto\" }` for rules with `CssExtractRspackPlugin` in your rspack config (now `CssExtractRspackPlugin` does nothing).");
|
|
79
48
|
e.stack = void 0, this.emitWarning(e);
|
|
80
49
|
return;
|
|
81
50
|
}
|
|
@@ -86,12 +55,12 @@ const pitch = function(request, _, data) {
|
|
|
86
55
|
let handleExports = (originalExports)=>{
|
|
87
56
|
let locals, namedExport, esModule = void 0 === options.esModule || options.esModule, dependencies = [];
|
|
88
57
|
try {
|
|
89
|
-
let
|
|
58
|
+
let exports = originalExports.__esModule ? originalExports.default : originalExports;
|
|
90
59
|
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 =
|
|
92
|
-
if (Array.isArray(
|
|
60
|
+
else locals = exports?.locals;
|
|
61
|
+
if (Array.isArray(exports) && emit) {
|
|
93
62
|
let identifierCountMap = new Map();
|
|
94
|
-
dependencies =
|
|
63
|
+
dependencies = exports.map(([id, content, media, sourceMap, supports, layer])=>{
|
|
95
64
|
let context = this.rootContext, count = identifierCountMap.get(id) || 0;
|
|
96
65
|
return identifierCountMap.set(id, count + 1), {
|
|
97
66
|
identifier: id,
|
|
@@ -139,22 +108,11 @@ const pitch = function(request, _, data) {
|
|
|
139
108
|
layer: options.layer,
|
|
140
109
|
publicPath: publicPathForExtract,
|
|
141
110
|
baseUri: `${BASE_URI}/`
|
|
142
|
-
}, (error,
|
|
143
|
-
error ? callback(error) : handleExports(
|
|
111
|
+
}, (error, exports)=>{
|
|
112
|
+
error ? callback(error) : handleExports(exports);
|
|
144
113
|
});
|
|
145
|
-
}, css_extract_loader = function(content) {
|
|
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;
|
|
147
114
|
};
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
"MODULE_TYPE",
|
|
153
|
-
"SINGLE_DOT_PATH_SEGMENT",
|
|
154
|
-
"default",
|
|
155
|
-
"hotLoader",
|
|
156
|
-
"pitch"
|
|
157
|
-
].indexOf(__rspack_i) && (exports[__rspack_i] = __webpack_exports__[__rspack_i]);
|
|
158
|
-
Object.defineProperty(exports, '__esModule', {
|
|
159
|
-
value: !0
|
|
160
|
-
});
|
|
115
|
+
export default function(content) {
|
|
116
|
+
if (this._module && ('css' === this._module.type || 'css/auto' === this._module.type || 'css/global' === this._module.type || 'css/module' === this._module.type)) return content;
|
|
117
|
+
};
|
|
118
|
+
export { ABSOLUTE_PUBLIC_PATH, AUTO_PUBLIC_PATH, BASE_URI, MODULE_TYPE, SINGLE_DOT_PATH_SEGMENT, hotLoader, pitch };
|