@rspack/core 1.5.7 → 1.6.0-beta.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.
Files changed (35) hide show
  1. package/dist/Compilation.d.ts +2 -2
  2. package/dist/MultiCompiler.d.ts +1 -1
  3. package/dist/RuntimeModule.d.ts +1 -1
  4. package/dist/builtin-loader/swc/pluginImport.d.ts +2 -2
  5. package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +1 -1
  6. package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
  7. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -2
  8. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -2
  9. package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +5 -0
  10. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -2
  11. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -2
  12. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -2
  13. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -2
  14. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -2
  15. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +2 -2
  16. package/dist/builtin-plugin/URLPlugin.d.ts +9 -0
  17. package/dist/builtin-plugin/html-plugin/plugin.d.ts +1 -1
  18. package/dist/builtin-plugin/index.d.ts +2 -0
  19. package/dist/config/adapterRuleUse.d.ts +4 -1
  20. package/dist/config/devServer.d.ts +4 -4
  21. package/dist/config/normalization.d.ts +6 -3
  22. package/dist/config/types.d.ts +45 -6
  23. package/dist/container/ModuleFederationPlugin.d.ts +1 -1
  24. package/dist/cssExtractHmr.js +7 -8
  25. package/dist/cssExtractLoader.js +4 -5
  26. package/dist/exports.d.ts +3 -2
  27. package/dist/index.js +685 -679
  28. package/dist/moduleFederationDefaultRuntime.js +1 -1
  29. package/dist/schema/config.d.ts +16 -4
  30. package/dist/stats/statsFactoryUtils.d.ts +17 -0
  31. package/dist/util/ArrayQueue.d.ts +2 -2
  32. package/dist/util/comparators.d.ts +1 -1
  33. package/dist/worker.js +47 -48
  34. package/module.d.ts +0 -2
  35. package/package.json +9 -9
@@ -222,7 +222,7 @@ export declare class Compilation {
222
222
  * Get a map of all entrypoints.
223
223
  */
224
224
  get entrypoints(): ReadonlyMap<string, Entrypoint>;
225
- get chunkGroups(): ReadonlyArray<ChunkGroup>;
225
+ get chunkGroups(): readonly ChunkGroup[];
226
226
  /**
227
227
  * Get the named chunk groups.
228
228
  *
@@ -261,7 +261,7 @@ export declare class Compilation {
261
261
  /**
262
262
  * Get an array of Asset
263
263
  */
264
- getAssets(): ReadonlyArray<Asset>;
264
+ getAssets(): readonly Asset[];
265
265
  getAsset(name: string): Readonly<Asset> | void;
266
266
  /**
267
267
  * Note: This is not a webpack public API, maybe removed in future.
@@ -19,7 +19,7 @@ export interface MultiCompilerOptions {
19
19
  */
20
20
  parallelism?: number;
21
21
  }
22
- export type MultiRspackOptions = ReadonlyArray<RspackOptions> & MultiCompilerOptions;
22
+ export type MultiRspackOptions = readonly RspackOptions[] & MultiCompilerOptions;
23
23
  export declare class MultiCompiler {
24
24
  #private;
25
25
  compilers: Compiler[];
@@ -13,7 +13,7 @@ export declare class RuntimeModule {
13
13
  static STAGE_BASIC: RuntimeModuleStage;
14
14
  static STAGE_ATTACH: RuntimeModuleStage;
15
15
  static STAGE_TRIGGER: RuntimeModuleStage;
16
- static __to_binding(compilation: Compilation, module: RuntimeModule): JsAddingRuntimeModule;
16
+ static __to_binding(module: RuntimeModule): JsAddingRuntimeModule;
17
17
  private _name;
18
18
  private _stage;
19
19
  fullHash: boolean;
@@ -12,8 +12,8 @@ type RawPluginImportConfig = {
12
12
  style?: RawStyleConfig;
13
13
  camelToDashComponentName?: boolean;
14
14
  transformToDefaultImport?: boolean;
15
- ignoreEsComponent?: Array<string>;
16
- ignoreStyleComponent?: Array<string>;
15
+ ignoreEsComponent?: string[];
16
+ ignoreStyleComponent?: string[];
17
17
  };
18
18
  type PluginImportConfig = {
19
19
  libraryName: string;
@@ -31,7 +31,7 @@ export type CircularDependencyRspackPluginOptions = {
31
31
  * module "app/design/components/Button.tsx". When the entry is a RegExp,
32
32
  * it is tested against the entire identifier.
33
33
  */
34
- ignoredConnections?: Array<[string | RegExp, string | RegExp]>;
34
+ ignoredConnections?: [string | RegExp, string | RegExp][];
35
35
  /**
36
36
  * Called once for every detected cycle. Providing this handler overrides the
37
37
  * default behavior of adding diagnostics to the compilation.
@@ -12,5 +12,5 @@ type CodeValue = RecursiveArrayOrRecord<CodeValuePrimitive>;
12
12
  type CodeValuePrimitive = null | undefined | RegExp | Function | string | number | boolean | bigint;
13
13
  type RecursiveArrayOrRecord<T> = {
14
14
  [index: string]: RecursiveArrayOrRecord<T>;
15
- } | Array<RecursiveArrayOrRecord<T>> | T;
15
+ } | RecursiveArrayOrRecord<T>[] | T;
16
16
  export {};
@@ -1,8 +1,7 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
2
- import type { Compiler } from "../Compiler";
3
2
  import { RspackBuiltinPlugin } from "./base";
4
3
  export declare class DeterministicChunkIdsPlugin extends RspackBuiltinPlugin {
5
4
  name: BuiltinPluginName;
6
5
  affectedHooks: "compilation";
7
- raw(compiler: Compiler): BuiltinPlugin;
6
+ raw(): BuiltinPlugin;
8
7
  }
@@ -1,8 +1,7 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
2
- import type { Compiler } from "../Compiler";
3
2
  import { RspackBuiltinPlugin } from "./base";
4
3
  export declare class DeterministicModuleIdsPlugin extends RspackBuiltinPlugin {
5
4
  name: BuiltinPluginName;
6
5
  affectedHooks: "compilation";
7
- raw(compiler: Compiler): BuiltinPlugin;
6
+ raw(): BuiltinPlugin;
8
7
  }
@@ -0,0 +1,5 @@
1
+ import type { Compiler } from "../Compiler";
2
+ export declare class EsmLibraryPlugin {
3
+ static PLUGIN_NAME: string;
4
+ apply(compiler: Compiler): void;
5
+ }
@@ -1,10 +1,9 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
2
- import type { Compiler } from "../Compiler";
3
2
  import { RspackBuiltinPlugin } from "./base";
4
3
  export declare class FlagDependencyUsagePlugin extends RspackBuiltinPlugin {
5
4
  private global;
6
5
  name: BuiltinPluginName;
7
6
  affectedHooks: "compilation";
8
7
  constructor(global: boolean);
9
- raw(compiler: Compiler): BuiltinPlugin;
8
+ raw(): BuiltinPlugin;
10
9
  }
@@ -1,10 +1,9 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
2
- import type { Compiler } from "../Compiler";
3
2
  import { RspackBuiltinPlugin } from "./base";
4
3
  export declare class MangleExportsPlugin extends RspackBuiltinPlugin {
5
4
  private deterministic;
6
5
  name: BuiltinPluginName;
7
6
  affectedHooks: "compilation";
8
7
  constructor(deterministic: boolean);
9
- raw(compiler: Compiler): BuiltinPlugin;
8
+ raw(): BuiltinPlugin;
10
9
  }
@@ -1,8 +1,7 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
2
- import type { Compiler } from "../Compiler";
3
2
  import { RspackBuiltinPlugin } from "./base";
4
3
  export declare class ModuleConcatenationPlugin extends RspackBuiltinPlugin {
5
4
  name: BuiltinPluginName;
6
5
  affectedHooks: "compilation";
7
- raw(compiler: Compiler): BuiltinPlugin;
6
+ raw(): BuiltinPlugin;
8
7
  }
@@ -1,8 +1,7 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
2
- import type { Compiler } from "../Compiler";
3
2
  import { RspackBuiltinPlugin } from "./base";
4
3
  export declare class NaturalChunkIdsPlugin extends RspackBuiltinPlugin {
5
4
  name: BuiltinPluginName;
6
5
  affectedHooks: "compilation";
7
- raw(compiler: Compiler): BuiltinPlugin;
6
+ raw(): BuiltinPlugin;
8
7
  }
@@ -1,8 +1,7 @@
1
1
  import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
2
- import type { Compiler } from "../Compiler";
3
2
  import { RspackBuiltinPlugin } from "./base";
4
3
  export declare class NaturalModuleIdsPlugin extends RspackBuiltinPlugin {
5
4
  name: BuiltinPluginName;
6
5
  affectedHooks: "compilation";
7
- raw(compiler: Compiler): BuiltinPlugin;
6
+ raw(): BuiltinPlugin;
8
7
  }
@@ -7,8 +7,8 @@ export declare namespace RsdoctorPluginData {
7
7
  export type { JsRsdoctorAsset as RsdoctorAsset, JsRsdoctorChunkGraph as RsdoctorChunkGraph, JsRsdoctorModuleGraph as RsdoctorModuleGraph, JsRsdoctorChunk as RsdoctorChunk, JsRsdoctorModule as RsdoctorModule, JsRsdoctorSideEffect as RsdoctorSideEffect, JsRsdoctorExportInfo as RsdoctorExportInfo, JsRsdoctorVariable as RsdoctorVariable, JsRsdoctorDependency as RsdoctorDependency, JsRsdoctorEntrypoint as RsdoctorEntrypoint, JsRsdoctorStatement as RsdoctorStatement, JsRsdoctorSourceRange as RsdoctorSourceRange, JsRsdoctorSourcePosition as RsdoctorSourcePosition, JsRsdoctorModuleGraphModule as RsdoctorModuleGraphModule, JsRsdoctorModuleIdsPatch as RsdoctorModuleIdsPatch, JsRsdoctorModuleOriginalSource as RsdoctorModuleOriginalSource, JsRsdoctorAssetPatch as RsdoctorAssetPatch, JsRsdoctorChunkAssets as RsdoctorChunkAssets, JsRsdoctorEntrypointAssets as RsdoctorEntrypointAssets, JsRsdoctorChunkModules as RsdoctorChunkModules, JsRsdoctorModuleSourcesPatch as RsdoctorModuleSourcesPatch };
8
8
  }
9
9
  export type RsdoctorPluginOptions = {
10
- moduleGraphFeatures?: boolean | Array<"graph" | "ids" | "sources">;
11
- chunkGraphFeatures?: boolean | Array<"graph" | "assets">;
10
+ moduleGraphFeatures?: boolean | ("graph" | "ids" | "sources")[];
11
+ chunkGraphFeatures?: boolean | ("graph" | "assets")[];
12
12
  sourceMapFeatures?: {
13
13
  module?: boolean;
14
14
  cheap?: boolean;
@@ -0,0 +1,9 @@
1
+ export declare const URLPlugin: {
2
+ new (): {
3
+ name: string;
4
+ _args: [];
5
+ affectedHooks: keyof import("..").CompilerHooks | undefined;
6
+ raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
7
+ apply(compiler: import("..").Compiler): void;
8
+ };
9
+ };
@@ -18,7 +18,7 @@ declare const HtmlRspackPlugin: typeof HtmlRspackPluginImpl & {
18
18
  */
19
19
  getHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
20
20
  getCompilationHooks: (compilation: Compilation) => HtmlRspackPluginHooks;
21
- createHtmlTagObject: (tagName: string, attributes?: Record<string, string | boolean>, innerHTML?: string | undefined) => JsHtmlPluginTag;
21
+ createHtmlTagObject: (tagName: string, attributes?: Record<string, string | boolean>, innerHTML?: string) => JsHtmlPluginTag;
22
22
  version: number;
23
23
  };
24
24
  export { HtmlRspackPlugin };
@@ -26,6 +26,7 @@ export * from "./EnableLibraryPlugin";
26
26
  export * from "./EnableWasmLoadingPlugin";
27
27
  export * from "./EnsureChunkConditionsPlugin";
28
28
  export * from "./EntryPlugin";
29
+ export * from "./EsmLibraryPlugin";
29
30
  export * from "./EvalDevToolModulePlugin";
30
31
  export * from "./EvalSourceMapDevToolPlugin";
31
32
  export * from "./ExternalsPlugin";
@@ -76,6 +77,7 @@ export * from "./SourceMapDevToolPlugin";
76
77
  export * from "./SplitChunksPlugin";
77
78
  export * from "./SubresourceIntegrityPlugin";
78
79
  export * from "./SwcJsMinimizerPlugin";
80
+ export * from "./URLPlugin";
79
81
  export * from "./WarnCaseSensitiveModulesPlugin";
80
82
  export * from "./WebWorkerTemplatePlugin";
81
83
  export * from "./WorkerPlugin";
@@ -79,10 +79,13 @@ export interface Diagnostic {
79
79
  sourceCode?: string;
80
80
  /**
81
81
  * Location to the source code.
82
- *
83
82
  * If `sourceCode` is not provided, location will be omitted.
84
83
  */
85
84
  location?: DiagnosticLocation;
85
+ /**
86
+ * Optional filename to show.
87
+ * If provided, it becomes the `StatsError.file` value in stats.
88
+ */
86
89
  file?: string;
87
90
  severity: "error" | "warning";
88
91
  }
@@ -28,10 +28,10 @@ type ResponseData = {
28
28
  byteLength: number;
29
29
  };
30
30
  type ModifyResponseData<RequestInternal extends IncomingMessage = IncomingMessage, ResponseInternal extends ServerResponse = ServerResponse> = (req: RequestInternal, res: ResponseInternal, data: Buffer | ReadStream, byteLength: number) => ResponseData;
31
- type Headers = Array<{
31
+ type Headers = {
32
32
  key: string;
33
33
  value: string;
34
- }> | Record<string, string | string[]>;
34
+ }[] | Record<string, string | string[]>;
35
35
  type OutputFileSystem = import("..").OutputFileSystem & {
36
36
  createReadStream?: typeof import("fs").createReadStream;
37
37
  statSync: import("fs").StatSyncFn;
@@ -131,8 +131,8 @@ type ProxyConfigArrayItem = {
131
131
  [key: string]: any;
132
132
  };
133
133
  type ByPass = (req: Request, res: Response, proxyConfig: ProxyConfigArrayItem) => any;
134
- type ProxyConfigArray = (ProxyConfigArrayItem | ((req?: Request | undefined, res?: Response | undefined, next?: NextFunction | undefined) => ProxyConfigArrayItem))[];
135
- type Callback = (stats?: Stats | MultiStats | undefined) => any;
134
+ type ProxyConfigArray = (ProxyConfigArrayItem | ((req?: Request, res?: Response, next?: NextFunction) => ProxyConfigArrayItem))[];
135
+ type Callback = (stats?: Stats | MultiStats) => any;
136
136
  type DevMiddlewareContext<_RequestInternal extends IncomingMessage = IncomingMessage, _ResponseInternal extends ServerResponse = ServerResponse> = {
137
137
  state: boolean;
138
138
  stats: Stats | MultiStats | undefined;
@@ -84,9 +84,9 @@ export type ExperimentCacheNormalized = boolean | {
84
84
  buildDependencies: string[];
85
85
  version: string;
86
86
  snapshot: {
87
- immutablePaths: Array<string | RegExp>;
88
- unmanagedPaths: Array<string | RegExp>;
89
- managedPaths: Array<string | RegExp>;
87
+ immutablePaths: (string | RegExp)[];
88
+ unmanagedPaths: (string | RegExp)[];
89
+ managedPaths: (string | RegExp)[];
90
90
  };
91
91
  storage: {
92
92
  type: "filesystem";
@@ -105,6 +105,9 @@ export interface ExperimentsNormalized {
105
105
  outputModule?: boolean;
106
106
  topLevelAwait?: boolean;
107
107
  css?: boolean;
108
+ /**
109
+ * @deprecated This option is deprecated, layers is enabled since v1.6.0
110
+ */
108
111
  layers?: boolean;
109
112
  incremental?: false | Incremental;
110
113
  parallelCodeSplitting?: boolean;
@@ -664,6 +664,8 @@ export type RuleSetRule = {
664
664
  oneOf?: (RuleSetRule | Falsy)[];
665
665
  /** A kind of Nested Rule, an array of Rules that is also used when the parent Rule matches. */
666
666
  rules?: (RuleSetRule | Falsy)[];
667
+ /** Whether to extract source maps from the module. */
668
+ extractSourceMap?: boolean;
667
669
  };
668
670
  /** A list of rules. */
669
671
  export type RuleSetRules = ("..." | RuleSetRule | Falsy)[];
@@ -727,6 +729,11 @@ export type CssModuleParserOptions = {
727
729
  url?: CssParserUrl;
728
730
  };
729
731
  type ExportsPresence = "error" | "warn" | "auto" | false;
732
+ export type JavascriptParserCommonjsExports = boolean | "skipInEsm";
733
+ export type JavascriptParserCommonjsOption = boolean | {
734
+ /** Controls how CommonJS export mutations are handled. */
735
+ exports?: JavascriptParserCommonjsExports;
736
+ };
730
737
  export type JavascriptParserOptions = {
731
738
  /**
732
739
  * Specifies global mode for dynamic import.
@@ -757,7 +764,7 @@ export type JavascriptParserOptions = {
757
764
  * Enable parsing of new URL() syntax.
758
765
  * @default true
759
766
  * */
760
- url?: "relative" | boolean;
767
+ url?: "relative" | "new-url-relative" | boolean;
761
768
  /**
762
769
  * Enable warnings for full dynamic dependencies
763
770
  * @default true
@@ -795,6 +802,11 @@ export type JavascriptParserOptions = {
795
802
  requireAsExpression?: boolean;
796
803
  requireDynamic?: boolean;
797
804
  requireResolve?: boolean;
805
+ /**
806
+ * CommonJS-specific parser options. `true` enables the default behaviour, `{ exports: 'skipInEsm' }` preserves CommonJS export mutations when executed inside ESM.
807
+ * @default true
808
+ */
809
+ commonjs?: JavascriptParserCommonjsOption;
798
810
  importDynamic?: boolean;
799
811
  /**
800
812
  * Enable magic comments for CommonJS require() expressions.
@@ -1184,6 +1196,32 @@ export type CacheOptions = boolean;
1184
1196
  type StatsPresets = "normal" | "none" | "verbose" | "errors-only" | "errors-warnings" | "minimal" | "detailed" | "summary";
1185
1197
  type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
1186
1198
  type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
1199
+ export type StatsColorOptions = {
1200
+ /**
1201
+ * Custom color for bold text.
1202
+ */
1203
+ bold?: string;
1204
+ /**
1205
+ * Custom color for cyan text.
1206
+ */
1207
+ cyan?: string;
1208
+ /**
1209
+ * Custom color for green text.
1210
+ */
1211
+ green?: string;
1212
+ /**
1213
+ * Custom color for magenta text.
1214
+ */
1215
+ magenta?: string;
1216
+ /**
1217
+ * Custom color for red text.
1218
+ */
1219
+ red?: string;
1220
+ /**
1221
+ * Custom color for yellow text.
1222
+ */
1223
+ yellow?: string;
1224
+ };
1187
1225
  /** Options for stats */
1188
1226
  export type StatsOptions = {
1189
1227
  /**
@@ -1243,7 +1281,7 @@ export type StatsOptions = {
1243
1281
  * Enables or disables the use of colors in the output.
1244
1282
  * @default false
1245
1283
  */
1246
- colors?: boolean;
1284
+ colors?: boolean | StatsColorOptions;
1247
1285
  /**
1248
1286
  * Enables or disables the display of the hash.
1249
1287
  * @default true
@@ -1714,7 +1752,7 @@ export type Optimization = {
1714
1752
  * Customize the minimizer.
1715
1753
  * By default, `rspack.SwcJsMinimizerRspackPlugin` and `rspack.LightningCssMinimizerRspackPlugin` are used.
1716
1754
  */
1717
- minimizer?: Array<"..." | Plugin>;
1755
+ minimizer?: ("..." | Plugin)[];
1718
1756
  /**
1719
1757
  * Whether to merge chunks which contain the same modules.
1720
1758
  * Setting optimization.mergeDuplicateChunks to false will disable this optimization.
@@ -1823,9 +1861,9 @@ export type ExperimentCacheOptions = boolean | {
1823
1861
  buildDependencies?: string[];
1824
1862
  version?: string;
1825
1863
  snapshot?: {
1826
- immutablePaths?: Array<string | RegExp>;
1827
- unmanagedPaths?: Array<string | RegExp>;
1828
- managedPaths?: Array<string | RegExp>;
1864
+ immutablePaths?: (string | RegExp)[];
1865
+ unmanagedPaths?: (string | RegExp)[];
1866
+ managedPaths?: (string | RegExp)[];
1829
1867
  };
1830
1868
  storage?: {
1831
1869
  type: "filesystem";
@@ -2017,6 +2055,7 @@ export type Experiments = {
2017
2055
  css?: boolean;
2018
2056
  /**
2019
2057
  * Enable module layers feature.
2058
+ * @deprecated This option is deprecated, layers is enabled since v1.6.0
2020
2059
  * @default false
2021
2060
  */
2022
2061
  layers?: boolean;
@@ -5,7 +5,7 @@ export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPlug
5
5
  implementation?: string;
6
6
  shareStrategy?: "version-first" | "loaded-first";
7
7
  }
8
- export type RuntimePlugins = string[];
8
+ export type RuntimePlugins = string[] | [string, Record<string, unknown>][];
9
9
  export declare class ModuleFederationPlugin {
10
10
  private _options;
11
11
  constructor(_options: ModuleFederationPluginOptions);
@@ -34,7 +34,7 @@ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_expo
34
34
  cssReload: ()=>cssReload,
35
35
  normalizeUrl: ()=>normalizeUrl
36
36
  });
37
- let srcByModuleId = Object.create(null), noDocument = "undefined" == typeof document, { forEach } = Array.prototype;
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;
@@ -94,14 +94,13 @@ function cssReload(moduleId, options) {
94
94
  if (!src) return !1;
95
95
  let elements = document.querySelectorAll("link"), loaded = !1;
96
96
  return forEach.call(elements, (el)=>{
97
+ var href;
98
+ let ret, normalizedHref;
97
99
  if (!el.href) return;
98
- let url = function(href, src) {
99
- let ret = "", normalizedHref = normalizeUrl(href);
100
- return src.some((url)=>{
101
- normalizedHref.indexOf(src) > -1 && (ret = url);
102
- }), ret;
103
- }(el.href, src);
104
- 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);
105
104
  }), loaded;
106
105
  }(src);
107
106
  if (options.locals) {
@@ -28,12 +28,12 @@ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_expo
28
28
  AUTO_PUBLIC_PATH: ()=>AUTO_PUBLIC_PATH,
29
29
  pitch: ()=>pitch
30
30
  });
31
- let external_node_path_namespaceObject = require("node:path");
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
- let 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__";
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
- let pitch = function(request, _, data) {
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).");
@@ -140,8 +140,7 @@ let pitch = function(request, _, data) {
140
140
  publicPath: publicPathForExtract,
141
141
  baseUri: `${BASE_URI}/`
142
142
  }, (error, exports1)=>{
143
- if (error) return void callback(error);
144
- handleExports(exports1);
143
+ error ? callback(error) : handleExports(exports1);
145
144
  });
146
145
  }, css_extract_loader = function(content) {
147
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;
package/dist/exports.d.ts CHANGED
@@ -56,8 +56,8 @@ export { default as EntryOptionPlugin } from "./lib/EntryOptionPlugin";
56
56
  export { EnvironmentPlugin } from "./lib/EnvironmentPlugin";
57
57
  export { LoaderOptionsPlugin } from "./lib/LoaderOptionsPlugin";
58
58
  export { LoaderTargetPlugin } from "./lib/LoaderTargetPlugin";
59
- export type { OutputFileSystem } from "./util/fs";
60
- import { FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, SubresourceIntegrityPlugin } from "./builtin-plugin";
59
+ export type { OutputFileSystem, WatchFileSystem } from "./util/fs";
60
+ import { EsmLibraryPlugin, FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, SubresourceIntegrityPlugin } from "./builtin-plugin";
61
61
  interface Web {
62
62
  FetchCompileAsyncWasmPlugin: typeof FetchCompileAsyncWasmPlugin;
63
63
  }
@@ -143,6 +143,7 @@ interface Experiments {
143
143
  cleanup: () => Promise<void>;
144
144
  };
145
145
  RemoveDuplicateModulesPlugin: typeof RemoveDuplicateModulesPlugin;
146
+ EsmLibraryPlugin: typeof EsmLibraryPlugin;
146
147
  RsdoctorPlugin: typeof RsdoctorPlugin;
147
148
  RstestPlugin: typeof RstestPlugin;
148
149
  RslibPlugin: typeof RslibPlugin;