@rspack/core 2.0.1 → 2.0.3

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 (47) hide show
  1. package/compiled/http-proxy-middleware/index.d.ts +5 -30
  2. package/compiled/http-proxy-middleware/package.json +1 -1
  3. package/compiled/watchpack/index.d.ts +2 -218
  4. package/compiled/watchpack/index.js +1387 -939
  5. package/compiled/watchpack/package.json +8 -1
  6. package/compiled/watchpack/types/DirectoryWatcher.d.ts +333 -0
  7. package/compiled/watchpack/types/LinkResolver.d.ts +10 -0
  8. package/compiled/watchpack/types/getWatcherManager.d.ts +62 -0
  9. package/compiled/watchpack/types/index.d.ts +261 -0
  10. package/compiled/watchpack/types/reducePlan.d.ts +34 -0
  11. package/compiled/watchpack/types/watchEventSource.d.ts +53 -0
  12. package/compiled/watchpack/types/watchpack.d.ts +2 -0
  13. package/dist/Compilation.d.ts +3 -3
  14. package/dist/MultiCompiler.d.ts +1 -1
  15. package/dist/RuntimeGlobals.d.ts +1 -1
  16. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
  17. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
  18. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
  19. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
  20. package/dist/builtin-plugin/HttpUriPlugin.d.ts +1 -1
  21. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
  22. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
  23. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
  24. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
  25. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
  26. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
  27. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +2 -2
  28. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +1 -1
  29. package/dist/builtin-plugin/WorkerPlugin.d.ts +1 -1
  30. package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +8 -1
  31. package/dist/builtin-plugin/rsc/index.d.ts +6 -6
  32. package/dist/config/target.d.ts +1 -1
  33. package/dist/config/types.d.ts +4 -4
  34. package/dist/exports.d.ts +1 -1
  35. package/dist/index.js +35 -25
  36. package/dist/lib/CacheFacade.d.ts +1 -1
  37. package/dist/runtime/cssExtractHmr.d.ts +2 -2
  38. package/dist/runtime/moduleFederationDefaultRuntime.d.ts +1 -1
  39. package/dist/sharing/ConsumeSharedPlugin.d.ts +2 -2
  40. package/dist/sharing/ProvideSharedPlugin.d.ts +4 -4
  41. package/dist/sharing/SharePlugin.d.ts +4 -4
  42. package/dist/stats/statsFactoryUtils.d.ts +3 -3
  43. package/dist/util/comparators.d.ts +1 -1
  44. package/dist/util/createHash.d.ts +1 -1
  45. package/dist/util/identifier.d.ts +35 -8
  46. package/module.d.ts +6 -0
  47. package/package.json +8 -9
@@ -0,0 +1,53 @@
1
+ export function batch(fn: () => void): void;
2
+ export function getNumberOfWatchers(): number;
3
+ export function watch(filePath: string): Watcher;
4
+ export type FSWatcher = import("fs").FSWatcher;
5
+ export type EventType = import("./index").EventType;
6
+ export type WatcherSet = Set<Watcher>;
7
+ export type WatcherEvents = {
8
+ /**
9
+ * change event
10
+ */
11
+ change: (eventType: EventType, filename?: string) => void;
12
+ /**
13
+ * error event
14
+ */
15
+ error: (err: unknown) => void;
16
+ };
17
+ /**
18
+ * @typedef {object} WatcherEvents
19
+ * @property {(eventType: EventType, filename?: string) => void} change change event
20
+ * @property {(err: unknown) => void} error error event
21
+ */
22
+ /**
23
+ * @extends {EventEmitter<{ [K in keyof WatcherEvents]: Parameters<WatcherEvents[K]> }>}
24
+ */
25
+ export class Watcher extends EventEmitter<{
26
+ /**
27
+ * change event
28
+ */
29
+ change: [
30
+ eventType: import("./index").EventType,
31
+ filename?: string | undefined,
32
+ ];
33
+ /**
34
+ * error event
35
+ */
36
+ error: [err: unknown];
37
+ }> {
38
+ constructor();
39
+ close(): void;
40
+ }
41
+ /**
42
+ * @param {FSWatcher} watcher watcher
43
+ * @param {string} filePath a file path
44
+ * @param {(type: "rename" | "change", filename: string) => void} handleChangeEvent function to handle change
45
+ * @returns {(type: "rename" | "change", filename: string) => void} handler of change event
46
+ */
47
+ export function createHandleChangeEvent(
48
+ watcher: FSWatcher,
49
+ filePath: string,
50
+ handleChangeEvent: (type: "rename" | "change", filename: string) => void,
51
+ ): (type: "rename" | "change", filename: string) => void;
52
+ export const watcherLimit: number;
53
+ import { EventEmitter } from "events";
@@ -0,0 +1,2 @@
1
+ declare const _exports: typeof import("./index");
2
+ export = _exports;
@@ -45,7 +45,7 @@ export interface Asset {
45
45
  info: AssetInfo;
46
46
  }
47
47
  export type ChunkPathData = {
48
- id?: string;
48
+ id?: string | number;
49
49
  name?: string;
50
50
  hash?: string;
51
51
  contentHash?: Record<string, string>;
@@ -56,7 +56,7 @@ export type PathData = {
56
56
  contentHash?: string;
57
57
  runtime?: string;
58
58
  url?: string;
59
- id?: string;
59
+ id?: string | number;
60
60
  chunk?: Chunk | ChunkPathData;
61
61
  contentHashType?: string;
62
62
  };
@@ -235,7 +235,7 @@ export declare class Compilation {
235
235
  *
236
236
  * Note: This is a proxy for webpack internal API, only method `get`, `keys`, `values` and `entries` are supported now.
237
237
  */
238
- get namedChunks(): ReadonlyMap<string, Readonly<binding.Chunk>>;
238
+ get namedChunks(): ReadonlyMap<string, Readonly<Chunk>>;
239
239
  get entries(): Map<string, EntryData>;
240
240
  get codeGenerationResults(): binding.CodeGenerationResults;
241
241
  getCache(name: string): import("./lib/CacheFacade.js").CacheFacade;
@@ -45,7 +45,7 @@ export declare class MultiCompiler {
45
45
  get options(): import("./config/index.js").RspackOptionsNormalized[] & MultiCompilerOptions;
46
46
  get outputPath(): string;
47
47
  get inputFileSystem(): InputFileSystem;
48
- get outputFileSystem(): typeof import("fs");
48
+ get outputFileSystem(): typeof import('fs');
49
49
  get watchFileSystem(): WatchFileSystem;
50
50
  get intermediateFileSystem(): IntermediateFileSystem;
51
51
  set inputFileSystem(value: InputFileSystem);
@@ -352,5 +352,5 @@ export declare enum RuntimeVariable {
352
352
  }
353
353
  export declare function renderRuntimeVariables(variable: RuntimeVariable, _compilerOptions?: RspackOptionsNormalized): string;
354
354
  export declare function createCompilerRuntimeGlobals(compilerOptions?: RspackOptionsNormalized): Record<keyof typeof RuntimeGlobals, string>;
355
- declare const DefaultRuntimeGlobals: Record<"module" | "publicPath" | "chunkName" | "moduleId" | "exports" | "require" | "global" | "system" | "requireScope" | "thisAsExports" | "returnExportsFromRuntime" | "moduleLoaded" | "entryModuleId" | "moduleCache" | "moduleFactories" | "moduleFactoriesAddOnly" | "ensureChunk" | "ensureChunkHandlers" | "ensureChunkIncludeEntries" | "prefetchChunk" | "prefetchChunkHandlers" | "preloadChunk" | "preloadChunkHandlers" | "definePropertyGetters" | "makeNamespaceObject" | "createFakeNamespaceObject" | "compatGetDefaultExport" | "harmonyModuleDecorator" | "nodeModuleDecorator" | "getFullHash" | "wasmInstances" | "instantiateWasm" | "uncaughtErrorHandler" | "scriptNonce" | "loadScript" | "createScript" | "createScriptUrl" | "getTrustedTypesPolicy" | "hasFetchPriority" | "runtimeId" | "getChunkScriptFilename" | "getChunkCssFilename" | "rspackVersion" | "hasCssModules" | "rspackUniqueId" | "getChunkUpdateScriptFilename" | "getChunkUpdateCssFilename" | "startup" | "startupNoDefault" | "startupOnlyAfter" | "startupOnlyBefore" | "chunkCallback" | "startupEntrypoint" | "startupChunkDependencies" | "onChunksLoaded" | "externalInstallChunk" | "interceptModuleExecution" | "shareScopeMap" | "initializeSharing" | "currentRemoteGetScope" | "getUpdateManifestFilename" | "hmrDownloadManifest" | "hmrDownloadUpdateHandlers" | "hmrModuleData" | "hmrInvalidateModuleHandlers" | "hmrRuntimeStatePrefix" | "amdDefine" | "amdOptions" | "hasOwnProperty" | "systemContext" | "baseURI" | "relativeUrl" | "asyncModule" | "asyncModuleExportSymbol" | "makeDeferredNamespaceObject" | "makeDeferredNamespaceObjectSymbol", string>;
355
+ declare const DefaultRuntimeGlobals: Record<"amdDefine" | "amdOptions" | "asyncModule" | "asyncModuleExportSymbol" | "baseURI" | "chunkCallback" | "chunkName" | "compatGetDefaultExport" | "createFakeNamespaceObject" | "createScript" | "createScriptUrl" | "currentRemoteGetScope" | "definePropertyGetters" | "ensureChunk" | "ensureChunkHandlers" | "ensureChunkIncludeEntries" | "entryModuleId" | "exports" | "externalInstallChunk" | "getChunkCssFilename" | "getChunkScriptFilename" | "getChunkUpdateCssFilename" | "getChunkUpdateScriptFilename" | "getFullHash" | "getTrustedTypesPolicy" | "getUpdateManifestFilename" | "global" | "harmonyModuleDecorator" | "hasCssModules" | "hasFetchPriority" | "hasOwnProperty" | "hmrDownloadManifest" | "hmrDownloadUpdateHandlers" | "hmrInvalidateModuleHandlers" | "hmrModuleData" | "hmrRuntimeStatePrefix" | "initializeSharing" | "instantiateWasm" | "interceptModuleExecution" | "loadScript" | "makeDeferredNamespaceObject" | "makeDeferredNamespaceObjectSymbol" | "makeNamespaceObject" | "module" | "moduleCache" | "moduleFactories" | "moduleFactoriesAddOnly" | "moduleId" | "moduleLoaded" | "nodeModuleDecorator" | "onChunksLoaded" | "prefetchChunk" | "prefetchChunkHandlers" | "preloadChunk" | "preloadChunkHandlers" | "publicPath" | "relativeUrl" | "require" | "requireScope" | "returnExportsFromRuntime" | "rspackUniqueId" | "rspackVersion" | "runtimeId" | "scriptNonce" | "shareScopeMap" | "startup" | "startupChunkDependencies" | "startupEntrypoint" | "startupNoDefault" | "startupOnlyAfter" | "startupOnlyBefore" | "system" | "systemContext" | "thisAsExports" | "uncaughtErrorHandler" | "wasmInstances", string>;
356
356
  export { DefaultRuntimeGlobals as RuntimeGlobals };
@@ -2,6 +2,6 @@ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from './base.js';
3
3
  export declare class DeterministicChunkIdsPlugin extends RspackBuiltinPlugin {
4
4
  name: BuiltinPluginName;
5
- affectedHooks: "compilation";
5
+ affectedHooks: 'compilation';
6
6
  raw(): BuiltinPlugin;
7
7
  }
@@ -2,6 +2,6 @@ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from './base.js';
3
3
  export declare class DeterministicModuleIdsPlugin extends RspackBuiltinPlugin {
4
4
  name: BuiltinPluginName;
5
- affectedHooks: "compilation";
5
+ affectedHooks: 'compilation';
6
6
  raw(): BuiltinPlugin;
7
7
  }
@@ -6,7 +6,7 @@ export declare class DynamicEntryPlugin extends RspackBuiltinPlugin {
6
6
  private context;
7
7
  private entry;
8
8
  name: BuiltinPluginName;
9
- affectedHooks: "make";
9
+ affectedHooks: 'make';
10
10
  constructor(context: string, entry: EntryDynamicNormalized);
11
11
  raw(compiler: Compiler): BuiltinPlugin | undefined;
12
12
  }
@@ -3,7 +3,7 @@ import { RspackBuiltinPlugin } from './base.js';
3
3
  export declare class FlagDependencyUsagePlugin extends RspackBuiltinPlugin {
4
4
  private global;
5
5
  name: BuiltinPluginName;
6
- affectedHooks: "compilation";
6
+ affectedHooks: 'compilation';
7
7
  constructor(global: boolean);
8
8
  raw(): BuiltinPlugin;
9
9
  }
@@ -30,7 +30,7 @@ export type HttpUriPluginOptions = {
30
30
  export declare class HttpUriPlugin extends RspackBuiltinPlugin {
31
31
  private options;
32
32
  name: BuiltinPluginName;
33
- affectedHooks: "compilation";
33
+ affectedHooks: 'compilation';
34
34
  constructor(options: HttpUriPluginOptions);
35
35
  raw(compiler: Compiler): BuiltinPlugin | undefined;
36
36
  }
@@ -9,7 +9,7 @@ export type CompilationHooks = {
9
9
  };
10
10
  export declare class JavascriptModulesPlugin extends RspackBuiltinPlugin {
11
11
  name: BuiltinPluginName;
12
- affectedHooks: "compilation";
12
+ affectedHooks: 'compilation';
13
13
  raw(): BuiltinPlugin;
14
14
  static getCompilationHooks(compilation: Compilation): CompilationHooks;
15
15
  }
@@ -3,7 +3,7 @@ import { RspackBuiltinPlugin } from './base.js';
3
3
  export declare class MangleExportsPlugin extends RspackBuiltinPlugin {
4
4
  private deterministic;
5
5
  name: BuiltinPluginName;
6
- affectedHooks: "compilation";
6
+ affectedHooks: 'compilation';
7
7
  constructor(deterministic: boolean);
8
8
  raw(): BuiltinPlugin;
9
9
  }
@@ -2,6 +2,6 @@ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from './base.js';
3
3
  export declare class ModuleConcatenationPlugin extends RspackBuiltinPlugin {
4
4
  name: BuiltinPluginName;
5
- affectedHooks: "compilation";
5
+ affectedHooks: 'compilation';
6
6
  raw(): BuiltinPlugin;
7
7
  }
@@ -2,6 +2,6 @@ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from './base.js';
3
3
  export declare class NaturalChunkIdsPlugin extends RspackBuiltinPlugin {
4
4
  name: BuiltinPluginName;
5
- affectedHooks: "compilation";
5
+ affectedHooks: 'compilation';
6
6
  raw(): BuiltinPlugin;
7
7
  }
@@ -2,6 +2,6 @@ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from './base.js';
3
3
  export declare class NaturalModuleIdsPlugin extends RspackBuiltinPlugin {
4
4
  name: BuiltinPluginName;
5
- affectedHooks: "compilation";
5
+ affectedHooks: 'compilation';
6
6
  raw(): BuiltinPlugin;
7
7
  }
@@ -3,7 +3,7 @@ import { RspackBuiltinPlugin } from './base.js';
3
3
  export declare class SideEffectsFlagPlugin extends RspackBuiltinPlugin {
4
4
  private analyzeSideEffectsFree;
5
5
  name: BuiltinPluginName;
6
- affectedHooks: "compilation";
6
+ affectedHooks: 'compilation';
7
7
  constructor(analyzeSideEffectsFree?: boolean);
8
8
  raw(): BuiltinPlugin;
9
9
  }
@@ -1,14 +1,14 @@
1
1
  export declare const SizeLimitsPlugin: {
2
2
  new (options: {
3
3
  assetFilter?: (assetFilename: string) => boolean;
4
- hints?: false | "warning" | "error";
4
+ hints?: false | 'warning' | 'error';
5
5
  maxAssetSize?: number;
6
6
  maxEntrypointSize?: number;
7
7
  }): {
8
8
  name: string;
9
9
  _args: [options: {
10
10
  assetFilter?: (assetFilename: string) => boolean;
11
- hints?: false | "warning" | "error";
11
+ hints?: false | 'warning' | 'error';
12
12
  maxAssetSize?: number;
13
13
  maxEntrypointSize?: number;
14
14
  }];
@@ -5,7 +5,7 @@ import { RspackBuiltinPlugin } from './base.js';
5
5
  export declare class SplitChunksPlugin extends RspackBuiltinPlugin {
6
6
  private options;
7
7
  name: BuiltinPluginName;
8
- affectedHooks: "thisCompilation";
8
+ affectedHooks: 'thisCompilation';
9
9
  constructor(options: OptimizationSplitChunksOptions);
10
10
  raw(compiler: Compiler): BuiltinPlugin;
11
11
  }
@@ -8,7 +8,7 @@ export declare class WorkerPlugin extends RspackBuiltinPlugin {
8
8
  private module;
9
9
  private workerPublicPath;
10
10
  name: BuiltinPluginName;
11
- affectedHooks: "compilation";
11
+ affectedHooks: 'compilation';
12
12
  constructor(chunkLoading: ChunkLoading, wasmLoading: WasmLoading, module: OutputModule, workerPublicPath: WorkerPublicPath);
13
13
  raw(compiler: Compiler): BuiltinPlugin;
14
14
  }
@@ -24,12 +24,19 @@ export interface RscManifestPerEntry {
24
24
  moduleLoading: RscModuleLoading;
25
25
  entryCssFiles: Record<string, string[]>;
26
26
  entryJsFiles: string[];
27
+ cssLinkProps: RscCssLinkProps;
27
28
  }
28
29
  /** Full RSC manifest (all entries) passed to onManifest. Map from entry name to per-entry manifest. */
29
30
  export type RscManifest = Record<string, RscManifestPerEntry>;
31
+ export type RscCssLinkProps = Record<string, string>;
32
+ export type RscCssLinkOptions = {
33
+ precedence?: string | false;
34
+ props?: RscCssLinkProps;
35
+ };
30
36
  export type RscServerPluginOptions = {
31
37
  coordinator: Coordinator;
32
- onServerComponentChanges?: () => Promise<void>;
38
+ cssLink?: RscCssLinkOptions | null;
39
+ onServerComponentChanges?: () => void | Promise<void>;
33
40
  onManifest?: (manifest: RscManifest) => void | Promise<void>;
34
41
  };
35
42
  export declare class RscServerPlugin extends RspackBuiltinPlugin {
@@ -1,24 +1,24 @@
1
- import { RscClientPlugin, type RscClientPluginOptions } from './RscClientPlugin.js';
2
- import { RscServerPlugin } from './RscServerPlugin.js';
1
+ import { RscClientPlugin } from './RscClientPlugin.js';
2
+ import { RscServerPlugin, type RscServerPluginOptions } from './RscServerPlugin.js';
3
3
  declare class ServerPlugin extends RscServerPlugin {
4
- constructor(options?: Omit<RscClientPluginOptions, 'coordinator'>);
4
+ constructor(options?: Omit<RscServerPluginOptions, 'coordinator'>);
5
5
  }
6
6
  declare class ClientPlugin extends RscClientPlugin {
7
7
  }
8
8
  export declare const rsc: {
9
9
  createPlugins: () => {
10
- ServerPlugin: new (options?: Omit<RscClientPluginOptions, "coordinator">) => ServerPlugin;
10
+ ServerPlugin: new (options?: Omit<RscServerPluginOptions, 'coordinator'>) => ServerPlugin;
11
11
  ClientPlugin: new () => ClientPlugin;
12
12
  };
13
13
  Layers: {
14
14
  /**
15
15
  * The layer for server-only runtime and picking up `react-server` export conditions.
16
16
  */
17
- readonly rsc: "react-server-components";
17
+ readonly rsc: 'react-server-components';
18
18
  /**
19
19
  * Server Side Rendering layer for app.
20
20
  */
21
- readonly ssr: "server-side-rendering";
21
+ readonly ssr: 'server-side-rendering';
22
22
  };
23
23
  };
24
24
  export {};
@@ -11,7 +11,7 @@
11
11
  * @param context the context directory
12
12
  * @returns default target
13
13
  */
14
- export declare const getDefaultTarget: (context: string) => "browserslist" | "web";
14
+ export declare const getDefaultTarget: (context: string) => 'browserslist' | 'web';
15
15
  export type PlatformTargetProperties = {
16
16
  /** web platform, importing of http(s) and std: is available */
17
17
  web?: boolean | null;
@@ -189,7 +189,7 @@ export type Clean = boolean | {
189
189
  export type OutputModule = boolean;
190
190
  /** Tell Rspack to remove a module from the module instance cache (require.cache) if it throws an exception when it is required. */
191
191
  export type StrictModuleExceptionHandling = boolean;
192
- /** Handle error in module loading as per EcmaScript Modules spec at a performance cost. */
192
+ /** Handle error in module loading as per ECMAScript Modules spec at a performance cost. */
193
193
  export type StrictModuleErrorHandling = boolean;
194
194
  /** Indicates what global object will be used to mount the library. */
195
195
  export type GlobalObject = string;
@@ -272,7 +272,7 @@ export type Environment = {
272
272
  destructuring?: boolean;
273
273
  /** The environment supports 'document' variable. */
274
274
  document?: boolean;
275
- /** The environment supports an async import() function to import EcmaScript modules. */
275
+ /** The environment supports an async import() function to import ECMAScript modules. */
276
276
  dynamicImport?: boolean;
277
277
  /** The environment supports an async import() when creating a worker, only for web targets at the moment. */
278
278
  dynamicImportInWorker?: boolean;
@@ -373,7 +373,7 @@ export type Output = {
373
373
  /** Tell Rspack to remove a module from the module instance cache (require.cache) if it throws an exception when it is required. */
374
374
  strictModuleExceptionHandling?: StrictModuleExceptionHandling;
375
375
  /**
376
- * Handle error in module loading as per EcmaScript Modules spec at a performance cost.
376
+ * Handle error in module loading as per ECMAScript Modules spec at a performance cost.
377
377
  * @default false
378
378
  * */
379
379
  strictModuleErrorHandling?: StrictModuleErrorHandling;
@@ -1099,7 +1099,7 @@ export type Target = false | AllowTarget | AllowTarget[];
1099
1099
  * `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.
1100
1100
  * @default 'var'
1101
1101
  */
1102
- 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';
1102
+ 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' | 'modern-module' | 'script' | 'node-commonjs' | 'commonjs-import';
1103
1103
  /**
1104
1104
  * External item object when both library.type and externalsType is 'umd'
1105
1105
  */
package/dist/exports.d.ts CHANGED
@@ -44,7 +44,7 @@ type Config = {
44
44
  export declare const config: Config;
45
45
  export type * from './config/index.js';
46
46
  export declare const util: {
47
- createHash: (algorithm: "xxhash64" | "md4" | "native-md4" | (string & {}) | (new () => import("./util/hash/index.js").default)) => import("./util/hash/index.js").default;
47
+ createHash: (algorithm: 'xxhash64' | 'md4' | 'native-md4' | (string & {}) | (new () => import("./util/hash/index.js").default)) => import("./util/hash/index.js").default;
48
48
  cleverMerge: <First, Second>(first: First, second: Second) => First | Second | (First & Second);
49
49
  };
50
50
  export type { BannerPluginArgument, DefinePluginOptions, EntryOptions, ProgressPluginHandlerInfo, ProgressPluginOptions, ProvidePluginOptions, } from './builtin-plugin/index.js';
package/dist/index.js CHANGED
@@ -34,7 +34,7 @@ __webpack_require__.m = __webpack_modules__, __webpack_require__.n = (module)=>{
34
34
  value: !0
35
35
  });
36
36
  }, __webpack_require__.add({
37
- "../../node_modules/.pnpm/enhanced-resolve@5.21.0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js" (module, __unused_rspack_exports, __webpack_require__) {
37
+ "../../node_modules/.pnpm/enhanced-resolve@5.21.2/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js" (module, __unused_rspack_exports, __webpack_require__) {
38
38
  let { nextTick } = __webpack_require__("process"), dirname = (path)=>{
39
39
  let idx = path.length - 1;
40
40
  for(; idx >= 0;){
@@ -1671,7 +1671,7 @@ Object.defineProperty(binding_namespaceObject.Chunk.prototype, 'files', {
1671
1671
  let chunkHashMap = {}, chunkContentHashMap = {}, chunkNameMap = {};
1672
1672
  for (let chunk of this.getAllAsyncChunks()){
1673
1673
  let id = chunk.id;
1674
- if (!id) continue;
1674
+ if (void 0 === id) continue;
1675
1675
  let chunkHash = realHash ? chunk.hash : chunk.renderedHash;
1676
1676
  for (let key of (chunkHash && (chunkHashMap[id] = chunkHash), Object.keys(chunk.contentHash)))chunkContentHashMap[key] || (chunkContentHashMap[key] = {}), chunkContentHashMap[key][id] = chunk.contentHash[key];
1677
1677
  chunk.name && (chunkNameMap[id] = chunk.name);
@@ -1848,6 +1848,20 @@ function _to_property_key(arg) {
1848
1848
  function _type_of(obj) {
1849
1849
  return obj && "u" > typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
1850
1850
  }
1851
+ function normalizePathData(data = {}) {
1852
+ let pathData = {
1853
+ filename: data.filename,
1854
+ hash: data.hash,
1855
+ contentHash: data.contentHash,
1856
+ runtime: data.runtime,
1857
+ url: data.url
1858
+ };
1859
+ return void 0 !== data.id && (pathData.id = String(data.id)), data.chunk && (pathData.chunk = {
1860
+ id: void 0 !== data.chunk.id ? String(data.chunk.id) : void 0,
1861
+ name: data.chunk.name,
1862
+ hash: data.chunk.hash
1863
+ }), pathData;
1864
+ }
1851
1865
  let checkCompilation = (compilation)=>{
1852
1866
  if (!(compilation instanceof Compilation)) throw TypeError('The \'compilation\' argument must be an instance of Compilation. This usually occurs when multiple versions of "@rspack/core" are used, or when the code in "@rspack/core" is executed multiple times.');
1853
1867
  };
@@ -2159,27 +2173,19 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
2159
2173
  this.#warnings || (this.#warnings = createDiagnosticArray(this.#inner.warnings)), this.#warnings.splice(0, this.#warnings.length, ...warnings);
2160
2174
  }
2161
2175
  getPath(filename, data = {}) {
2162
- let pathData = {
2163
- ...data
2164
- };
2176
+ let pathData = normalizePathData(data);
2165
2177
  return data.contentHashType && data.chunk?.contentHash && (pathData.contentHash = data.chunk.contentHash[data.contentHashType]), this.#inner.getPath(filename, pathData);
2166
2178
  }
2167
2179
  getPathWithInfo(filename, data = {}) {
2168
- let pathData = {
2169
- ...data
2170
- };
2180
+ let pathData = normalizePathData(data);
2171
2181
  return data.contentHashType && data.chunk?.contentHash && (pathData.contentHash = data.chunk.contentHash[data.contentHashType]), this.#inner.getPathWithInfo(filename, pathData);
2172
2182
  }
2173
2183
  getAssetPath(filename, data = {}) {
2174
- let pathData = {
2175
- ...data
2176
- };
2184
+ let pathData = normalizePathData(data);
2177
2185
  return data.contentHashType && data.chunk?.contentHash && (pathData.contentHash = data.chunk.contentHash[data.contentHashType]), this.#inner.getAssetPath(filename, pathData);
2178
2186
  }
2179
2187
  getAssetPathWithInfo(filename, data = {}) {
2180
- let pathData = {
2181
- ...data
2182
- };
2188
+ let pathData = normalizePathData(data);
2183
2189
  return data.contentHashType && data.chunk?.contentHash && (pathData.contentHash = data.chunk.contentHash[data.contentHashType]), this.#inner.getAssetPathWithInfo(filename, pathData);
2184
2190
  }
2185
2191
  getLogger(name) {
@@ -5192,6 +5198,7 @@ class RscServerPlugin extends RspackBuiltinPlugin {
5192
5198
  let { coordinator, onServerComponentChanges } = this.#options;
5193
5199
  return this.#options.onManifest && (onManifest = (json)=>Promise.resolve(this.#options.onManifest(JSON.parse(json)))), createBuiltinPlugin(this.name, {
5194
5200
  coordinator: coordinator[GET_OR_INIT_BINDING](),
5201
+ cssLink: this.#options.cssLink,
5195
5202
  onServerComponentChanges,
5196
5203
  onManifest
5197
5204
  });
@@ -6458,7 +6465,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6458
6465
  ],
6459
6466
  [
6460
6467
  'esX',
6461
- 'EcmaScript in this version. Examples: es2020, es5.',
6468
+ 'ECMAScript in this version. Examples: es2020, es5.',
6462
6469
  /^es(\d+)$/,
6463
6470
  (version)=>{
6464
6471
  let v = +version;
@@ -6553,7 +6560,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6553
6560
  targetProperties,
6554
6561
  buildHttp: !!options.experiments.buildHttp,
6555
6562
  outputModule: options.output.module
6556
- }), F(options, 'externalsType', ()=>options.output.library ? options.output.library.type : options.output.module ? 'module-import' : 'var'), applyNodeDefaults(options.node, {
6563
+ }), F(options, 'externalsType', ()=>options.output.library?.type && 'modern-module' !== options.output.library.type ? options.output.library.type : options.output.module ? 'module-import' : 'var'), applyNodeDefaults(options.node, {
6557
6564
  targetProperties,
6558
6565
  outputModule: options.output.module
6559
6566
  }), applyLoaderDefaults(options.loader, {
@@ -6865,7 +6872,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6865
6872
  return output.wasmLoading && enabledWasmLoadingTypes.add(output.wasmLoading), output.workerWasmLoading && enabledWasmLoadingTypes.add(output.workerWasmLoading), forEachEntry((desc)=>{
6866
6873
  desc.wasmLoading && enabledWasmLoadingTypes.add(desc.wasmLoading);
6867
6874
  }), Array.from(enabledWasmLoadingTypes);
6868
- }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.1"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !1));
6875
+ }), D(output, 'bundlerInfo', {}), 'object' == typeof output.bundlerInfo && (D(output.bundlerInfo, 'version', "2.0.3"), D(output.bundlerInfo, 'bundler', 'rspack'), D(output.bundlerInfo, 'force', !1));
6869
6876
  }, applyExternalsPresetsDefaults = (externalsPresets, { targetProperties, buildHttp, outputModule })=>{
6870
6877
  let isUniversal = (key)=>!!(outputModule && targetProperties && null === targetProperties[key]);
6871
6878
  D(externalsPresets, 'web', !buildHttp && targetProperties && (targetProperties.web || isUniversal('node'))), D(externalsPresets, 'node', targetProperties && (targetProperties.node || isUniversal('node'))), D(externalsPresets, 'electron', targetProperties && targetProperties.electron || isUniversal('electron')), D(externalsPresets, 'electronMain', targetProperties && !!targetProperties.electron && (targetProperties.electronMain || isUniversal('electronMain'))), D(externalsPresets, 'electronPreload', targetProperties && !!targetProperties.electron && (targetProperties.electronPreload || isUniversal('electronPreload'))), D(externalsPresets, 'electronRenderer', targetProperties && !!targetProperties.electron && (targetProperties.electronRenderer || isUniversal('electronRenderer'))), D(externalsPresets, 'nwjs', targetProperties && (targetProperties.nwjs || isUniversal('nwjs')));
@@ -8119,7 +8126,7 @@ class MultiStats {
8119
8126
  obj.children = this.stats.map((stat, idx)=>{
8120
8127
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
8121
8128
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
8122
- }), childOptions.version && (obj.rspackVersion = "2.0.1", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
8129
+ }), childOptions.version && (obj.rspackVersion = "2.0.3", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
8123
8130
  let mapError = (j, obj)=>({
8124
8131
  ...obj,
8125
8132
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -8628,7 +8635,7 @@ let arraySum = (array)=>{
8628
8635
  let str = `${a}`, length = lengths[i];
8629
8636
  return str.length === length ? str : length > 5 ? `...${str.slice(-length + 3)}` : length > 0 ? str.slice(-length) : '';
8630
8637
  });
8631
- }, CachedInputFileSystem = __webpack_require__("../../node_modules/.pnpm/enhanced-resolve@5.21.0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js");
8638
+ }, CachedInputFileSystem = __webpack_require__("../../node_modules/.pnpm/enhanced-resolve@5.21.2/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js");
8632
8639
  var CachedInputFileSystem_default = __webpack_require__.n(CachedInputFileSystem);
8633
8640
  class NodeEnvironmentPlugin {
8634
8641
  options;
@@ -9246,7 +9253,7 @@ let iterateConfig = (config, options, fn)=>{
9246
9253
  }, SORTERS = {
9247
9254
  'compilation.chunks': {
9248
9255
  _: (comparators)=>{
9249
- comparators.push(compareSelect((c)=>c.id, compareIds));
9256
+ comparators.push(compareSelect((c)=>void 0 === c.id ? void 0 : String(c.id), compareIds));
9250
9257
  }
9251
9258
  },
9252
9259
  'compilation.modules': MODULES_SORTER,
@@ -9342,7 +9349,10 @@ let iterateConfig = (config, options, fn)=>{
9342
9349
  ]) : 'error' === logging ? getLogTypesBitFlag([
9343
9350
  LogType.error
9344
9351
  ]) : getLogTypesBitFlag([]), object.logging = {};
9345
- let compilationLogging = compilation.logging;
9352
+ let compilationLogging = new Map();
9353
+ for (let [origin, logEntries] of compilation.logging)compilationLogging.set(origin, [
9354
+ ...logEntries
9355
+ ]);
9346
9356
  for (let { name, ...rest } of context.getInner(compilation).getLogging(acceptedTypes)){
9347
9357
  let value = compilationLogging.get(name), entry = {
9348
9358
  type: rest.type,
@@ -9390,7 +9400,7 @@ let iterateConfig = (config, options, fn)=>{
9390
9400
  object.hash = context.getStatsCompilation(compilation).hash;
9391
9401
  },
9392
9402
  version: (object)=>{
9393
- object.version = "5.75.0", object.rspackVersion = "2.0.1";
9403
+ object.version = "5.75.0", object.rspackVersion = "2.0.3";
9394
9404
  },
9395
9405
  env: (object, _compilation, _context, { _env })=>{
9396
9406
  object.env = _env;
@@ -11048,7 +11058,7 @@ class TraceHookPlugin {
11048
11058
  });
11049
11059
  }
11050
11060
  }
11051
- let CORE_VERSION = "2.0.1", VFILES_BY_COMPILER = new WeakMap();
11061
+ let CORE_VERSION = "2.0.3", VFILES_BY_COMPILER = new WeakMap();
11052
11062
  class VirtualModulesPlugin {
11053
11063
  #staticModules;
11054
11064
  #compiler;
@@ -13328,7 +13338,7 @@ class ContainerReferencePlugin extends RspackBuiltinPlugin {
13328
13338
  for (let external of config.external){
13329
13339
  if (external.startsWith('internal ')) continue;
13330
13340
  let request = `webpack/container/reference/${key}${i ? `/fallback-${i}` : ''}`;
13331
- ('module' === remoteType || 'module-import' === remoteType) && external.startsWith('.') ? importExternals[request] = external : remoteExternals[request] = external, i++;
13341
+ ('module' === remoteType || 'module-import' === remoteType || 'modern-module' === remoteType) && external.startsWith('.') ? importExternals[request] = external : remoteExternals[request] = external, i++;
13332
13342
  }
13333
13343
  }
13334
13344
  new ExternalsPlugin(remoteType, remoteExternals, !0).apply(compiler), Object.keys(importExternals).length > 0 && new ExternalsPlugin('import', importExternals, !0).apply(compiler), new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
@@ -13351,7 +13361,7 @@ async function transform(source, options) {
13351
13361
  let _options = JSON.stringify(options || {});
13352
13362
  return binding_default().transform(source, _options);
13353
13363
  }
13354
- let exports_rspackVersion = "2.0.1", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
13364
+ let exports_rspackVersion = "2.0.3", exports_version = "5.75.0", exports_WebpackError = Error, exports_config = {
13355
13365
  getNormalizedRspackOptions: getNormalizedRspackOptions,
13356
13366
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
13357
13367
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -134,6 +134,6 @@ export declare class CacheFacade {
134
134
  * @param computer function to compute the value if not cached
135
135
  * @returns promise with the data
136
136
  */
137
- providePromise<T>(identifier: string, etag: Etag | null, computer: () => Promise<T> | T): Promise<{} | T | null>;
137
+ providePromise<T>(identifier: string, etag: Etag | null, computer: () => Promise<T> | T): Promise<T | {} | null>;
138
138
  }
139
139
  export default CacheFacade;
@@ -1,4 +1,4 @@
1
1
  export declare function normalizeUrl(url: string): string;
2
- declare function noop(): void;
3
- declare function cssReload(moduleId: string, options: Record<string, any>): typeof noop;
2
+ type DebouncedFunction<T extends (...args: any[]) => any> = (...args: Parameters<T>) => void;
3
+ declare function cssReload(moduleId: string, options: Record<string, any>): DebouncedFunction<() => void>;
4
4
  export { cssReload };
@@ -1 +1 @@
1
- export default function _default(): void;
1
+ export default function (): void;
@@ -31,7 +31,7 @@ export declare function normalizeConsumeShareOptions(consumes: Consumes, shareSc
31
31
  packageName: string | undefined;
32
32
  singleton: boolean;
33
33
  eager: boolean;
34
- treeShakingMode: "server-calc" | "runtime-infer" | undefined;
34
+ treeShakingMode: "runtime-infer" | "server-calc" | undefined;
35
35
  }][];
36
36
  export declare class ConsumeSharedPlugin extends RspackBuiltinPlugin {
37
37
  name: BuiltinPluginName;
@@ -45,7 +45,7 @@ export declare class ConsumeSharedPlugin extends RspackBuiltinPlugin {
45
45
  packageName: string | undefined;
46
46
  singleton: boolean;
47
47
  eager: boolean;
48
- treeShakingMode: "server-calc" | "runtime-infer" | undefined;
48
+ treeShakingMode: "runtime-infer" | "server-calc" | undefined;
49
49
  }][];
50
50
  enhanced: boolean;
51
51
  };
@@ -35,14 +35,14 @@ export declare function normalizeProvideShareOptions<Enhanced extends boolean =
35
35
  shareScope: ShareScope;
36
36
  eager: boolean;
37
37
  } | {
38
- singleton: boolean | undefined;
39
- requiredVersion: string | false | undefined;
40
- strictVersion: boolean | undefined;
41
- treeShakingMode: "server-calc" | "runtime-infer" | undefined;
42
38
  shareKey: string;
43
39
  version: string | false | undefined;
44
40
  shareScope: ShareScope;
45
41
  eager: boolean;
42
+ singleton: boolean | undefined;
43
+ requiredVersion: string | false | undefined;
44
+ strictVersion: boolean | undefined;
45
+ treeShakingMode: "runtime-infer" | "server-calc" | undefined;
46
46
  }][];
47
47
  export declare class ProvideSharedPlugin<Enhanced extends boolean = false> extends RspackBuiltinPlugin {
48
48
  name: BuiltinPluginName;