@ohos-ports/rspack-core 2.2.9-beta.0 → 2.3.2-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 (52) hide show
  1. package/README.md +5 -6
  2. package/compiled/http-proxy-middleware/index.d.ts +10 -10
  3. package/compiled/http-proxy-middleware/package.json +1 -1
  4. package/compiled/watchpack/index.js +276 -49
  5. package/compiled/watchpack/package.json +1 -1
  6. package/compiled/watchpack/types/DirectoryWatcher.d.ts +24 -0
  7. package/compiled/watchpack/types/index.d.ts +1 -1
  8. package/compiled/watchpack/types/watchEventSource.d.ts +9 -0
  9. package/dist/BuildInfo.d.ts +7 -0
  10. package/dist/Compilation.d.ts +3 -1
  11. package/dist/Compiler.d.ts +5 -6
  12. package/dist/ConcatenatedModule.d.ts +5 -1
  13. package/dist/ContextModule.d.ts +3 -1
  14. package/dist/ExternalModule.d.ts +7 -6
  15. package/dist/FileSystemInfo.d.ts +1 -0
  16. package/dist/Module.d.ts +12 -8
  17. package/dist/ModuleGraphConnection.d.ts +9 -3
  18. package/dist/NativeWatchFileSystem.d.ts +19 -7
  19. package/dist/NormalModule.d.ts +14 -6
  20. package/dist/RuntimeTemplate.d.ts +1 -0
  21. package/dist/Stats.d.ts +1 -1
  22. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +3 -2
  23. package/dist/builtin-plugin/ImportedByDeferModulesPlugin.d.ts +9 -0
  24. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +1 -0
  25. package/dist/builtin-plugin/index.d.ts +1 -0
  26. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +2 -2
  27. package/dist/config/normalization.d.ts +2 -2
  28. package/dist/config/target.d.ts +2 -0
  29. package/dist/config/types.d.ts +57 -35
  30. package/dist/cssExtractHmr.js +1 -1
  31. package/dist/exports.d.ts +3 -3
  32. package/dist/index.js +1140 -842
  33. package/dist/loader-runner/codeFilter.d.ts +9 -0
  34. package/dist/loader-runner/dependencies.d.ts +1 -1
  35. package/dist/loader-runner/index.d.ts +2 -1
  36. package/dist/loader-runner/service.d.ts +0 -4
  37. package/dist/loader-runner/worker.d.ts +4 -1
  38. package/dist/node/NodeWatchFileSystem.d.ts +7 -4
  39. package/dist/sources.d.ts +3 -0
  40. package/dist/stats/statsFactoryUtils.d.ts +7 -0
  41. package/dist/util/bindingHelpers.d.ts +2 -0
  42. package/dist/util/createModule.d.ts +3 -0
  43. package/dist/util/fs.d.ts +13 -7
  44. package/dist/util/resolveLayerExternals.d.ts +1 -0
  45. package/dist/util/source.d.ts +12 -3
  46. package/dist/util/symbols.d.ts +10 -0
  47. package/dist/util/watchTimeInfo.d.ts +5 -1
  48. package/dist/worker.js +323 -325
  49. package/hot/lazy-compilation-node.js +1 -1
  50. package/hot/lazy-compilation-web.js +1 -1
  51. package/package.json +3 -3
  52. package/dist/loader-runner/cache.d.ts +0 -27
@@ -46,8 +46,12 @@ declare class DirectoryWatcher extends EventEmitter<{
46
46
  files: Map<string, Entry>;
47
47
  /** @type {Map<string, number>} */
48
48
  filesWithoutCase: Map<string, number>;
49
+ /** @type {boolean | undefined} */
50
+ caseInsensitive: boolean | undefined;
49
51
  /** @type {Map<string, Watcher<DirectoryWatcherEvents> | boolean>} */
50
52
  directories: Map<string, Watcher<DirectoryWatcherEvents> | boolean>;
53
+ /** @type {Map<string, number>} */
54
+ directorySafeTimes: Map<string, number>;
51
55
  /** @type {Map<string, Watcher<FileWatcherEvents>>} */
52
56
  _symlinkTargetWatchers: Map<string, Watcher<FileWatcherEvents>>;
53
57
  lastWatchEvent: number;
@@ -62,6 +66,8 @@ declare class DirectoryWatcher extends EventEmitter<{
62
66
  initialScanRemoved: null | InitialScanRemoved;
63
67
  /** @type {undefined | number} */
64
68
  initialScanFinished: undefined | number;
69
+ /** @type {Map<string, number>} */
70
+ removedTimes: Map<string, number>;
65
71
  /** @type {Map<string, Set<Watcher<DirectoryWatcherEvents> | Watcher<FileWatcherEvents>>>} */
66
72
  watchers: Map<
67
73
  string,
@@ -69,6 +75,8 @@ declare class DirectoryWatcher extends EventEmitter<{
69
75
  >;
70
76
  /** @type {Watcher<FileWatcherEvents> | null} */
71
77
  parentWatcher: Watcher<FileWatcherEvents> | null;
78
+ /** @type {undefined | NodeJS.Timeout} */
79
+ retryTimeout: undefined | NodeJS.Timeout;
72
80
  refs: number;
73
81
  /** @type {Map<string, boolean>} */
74
82
  _activeEvents: Map<string, boolean>;
@@ -145,6 +153,11 @@ declare class DirectoryWatcher extends EventEmitter<{
145
153
  * @param {unknown=} err error
146
154
  */
147
155
  onWatcherError(err?: unknown | undefined): void;
156
+ /**
157
+ * Polls the directory, which still exists, when the OS cannot watch it.
158
+ * @param {unknown} err watcher limit error
159
+ */
160
+ pollAfterWatcherLimit(err: unknown): void;
148
161
  /**
149
162
  * @param {Error | NodeJS.ErrnoException=} err error
150
163
  */
@@ -158,6 +171,12 @@ declare class DirectoryWatcher extends EventEmitter<{
158
171
  * @param {string} reason a reason
159
172
  */
160
173
  onDirectoryRemoved(reason: string): void;
174
+ /**
175
+ * Creates the watcher once the parent directory reports this path.
176
+ * @param {number} mtime mtime
177
+ * @param {EventType} type type
178
+ */
179
+ retryWatcher(mtime: number, type: EventType): void;
161
180
  watchInParentDirectory(): void;
162
181
  /**
163
182
  * @param {boolean} initial true when initial, otherwise false
@@ -176,6 +195,11 @@ declare class DirectoryWatcher extends EventEmitter<{
176
195
  fileTimestamps: TimeInfoEntries,
177
196
  directoryTimestamps: TimeInfoEntries,
178
197
  ): number;
198
+ /**
199
+ * @param {string} target a watched path that is not in `files`
200
+ * @returns {string | undefined} the file it names on a case-insensitive file system
201
+ */
202
+ getFileWithOtherCase(target: string): string | undefined;
179
203
  close(): void;
180
204
  }
181
205
  declare namespace DirectoryWatcher {
@@ -35,7 +35,7 @@ type FileWatcherEvents = import("./DirectoryWatcher").FileWatcherEvents;
35
35
  type EventMap = Record<string, (...args: any[]) => any>;
36
36
  type Watcher<T extends EventMap> = import("./DirectoryWatcher").Watcher<T>;
37
37
  type IgnoredFunction = (item: string) => boolean;
38
- type Ignored = string[] | RegExp | string | IgnoredFunction;
38
+ type Ignored = (string | RegExp)[] | RegExp | string | IgnoredFunction;
39
39
  type WatcherOptions = {
40
40
  /**
41
41
  * true when need to resolve symlinks and watch symlink and real file, otherwise false
@@ -13,11 +13,16 @@ export type WatcherEvents = {
13
13
  * error event
14
14
  */
15
15
  error: (err: unknown) => void;
16
+ /**
17
+ * rescan event, when events may have been lost
18
+ */
19
+ rescan: () => void;
16
20
  };
17
21
  /**
18
22
  * @typedef {object} WatcherEvents
19
23
  * @property {(eventType: EventType, filename?: string) => void} change change event
20
24
  * @property {(err: unknown) => void} error error event
25
+ * @property {() => void} rescan rescan event, when events may have been lost
21
26
  */
22
27
  /**
23
28
  * @extends {EventEmitter<{ [K in keyof WatcherEvents]: Parameters<WatcherEvents[K]> }>}
@@ -34,6 +39,10 @@ export class Watcher extends EventEmitter<{
34
39
  * error event
35
40
  */
36
41
  error: [err: unknown];
42
+ /**
43
+ * rescan event, when events may have been lost
44
+ */
45
+ rescan: [];
37
46
  }> {
38
47
  constructor();
39
48
  close(): void;
@@ -1,11 +1,18 @@
1
1
  import binding from '@rspack/binding';
2
2
  import type { Source } from '../compiled/webpack-sources/index.js';
3
+ import { BUILD_INFO_ASSETS_SYMBOL, BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL, BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL, BUILD_INFO_FILE_DEPENDENCIES_SYMBOL, BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL, COMMIT_CUSTOM_FIELDS_SYMBOL } from './util/symbols.js';
3
4
  declare const $assets: unique symbol;
4
5
  declare module '@rspack/binding' {
5
6
  interface Assets {
6
7
  [$assets]: Record<string, Source>;
7
8
  }
8
9
  interface KnownBuildInfo {
10
+ [BUILD_INFO_ASSETS_SYMBOL]: binding.Assets;
11
+ [BUILD_INFO_FILE_DEPENDENCIES_SYMBOL]: string[];
12
+ [BUILD_INFO_CONTEXT_DEPENDENCIES_SYMBOL]: string[];
13
+ [BUILD_INFO_MISSING_DEPENDENCIES_SYMBOL]: string[];
14
+ [BUILD_INFO_BUILD_DEPENDENCIES_SYMBOL]: string[];
15
+ [COMMIT_CUSTOM_FIELDS_SYMBOL](): void;
9
16
  assets: Record<string, Source>;
10
17
  fileDependencies: Set<string>;
11
18
  contextDependencies: Set<string>;
@@ -39,6 +39,7 @@ import './ChunkGraph.js';
39
39
  import './CodeGenerationResults.js';
40
40
  import { type FileSystemDependencies } from './FileSystemDependencies.js';
41
41
  import type { CodeGenerationResult } from './taps/compilation.js';
42
+ import { COMPILATION_HOOKS_MAP_SYMBOL } from './util/symbols.js';
42
43
  export type Assets = Record<string, Source>;
43
44
  export interface Asset {
44
45
  name: string;
@@ -134,6 +135,7 @@ export interface KnownNormalizedStatsOptions {
134
135
  optimizationBailout: boolean;
135
136
  depth: boolean;
136
137
  assets: boolean;
138
+ cacheInfo: boolean;
137
139
  chunks: boolean;
138
140
  errors: boolean;
139
141
  errorsCount: boolean;
@@ -211,7 +213,7 @@ export declare class Compilation {
211
213
  createSnapshot(): null;
212
214
  };
213
215
  needAdditionalPass: boolean;
214
- [binding.COMPILATION_HOOKS_MAP_SYMBOL]: WeakMap<object, unknown>;
216
+ [COMPILATION_HOOKS_MAP_SYMBOL]: WeakMap<object, unknown>;
215
217
  constructor(compiler: Compiler, inner: JsCompilation);
216
218
  get hash(): Readonly<string | null>;
217
219
  get fullHash(): Readonly<string | null>;
@@ -9,13 +9,12 @@
9
9
  */
10
10
  import type binding from '@rspack/binding';
11
11
  import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.js';
12
- import type Watchpack from '../compiled/watchpack/index.js';
13
12
  import type { Source } from '../compiled/webpack-sources/index.js';
14
13
  import type { Chunk } from './Chunk.js';
15
14
  import type { CompilationParams } from './Compilation.js';
16
15
  import { Compilation } from './Compilation.js';
17
16
  import { ContextModuleFactory } from './ContextModuleFactory.js';
18
- import type { EntryNormalized, Falsy, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance } from './config/index.js';
17
+ import type { EntryNormalized, Falsy, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance, WatchOptions } from './config/index.js';
19
18
  import type { ExtractedTargetProperties, PlatformTargetProperties } from './config/target.js';
20
19
  import type { FileSystemInfoEntry } from './FileSystemInfo.js';
21
20
  import type { rspack } from './index.js';
@@ -26,7 +25,7 @@ import { NormalModuleFactory } from './NormalModuleFactory.js';
26
25
  import { ResolverFactory } from './ResolverFactory.js';
27
26
  import { RuleSetCompiler } from './RuleSetCompiler.js';
28
27
  import { Stats } from './Stats.js';
29
- import type { InputFileSystem, IntermediateFileSystem, OutputFileSystem, WatchFileSystem } from './util/fs.js';
28
+ import type { ExistenceOnlyTimeEntry, InputFileSystem, IntermediateFileSystem, OutputFileSystem, WatchFileSystem } from './util/fs.js';
30
29
  import { Watching } from './Watching.js';
31
30
  export interface AssetEmittedInfo {
32
31
  content: Buffer;
@@ -101,8 +100,8 @@ declare class Compiler {
101
100
  records: Record<string, any[]>;
102
101
  modifiedFiles?: ReadonlySet<string>;
103
102
  removedFiles?: ReadonlySet<string>;
104
- fileTimestamps?: ReadonlyMap<string, FileSystemInfoEntry | 'ignore' | null>;
105
- contextTimestamps?: ReadonlyMap<string, FileSystemInfoEntry | 'ignore' | null>;
103
+ fileTimestamps?: ReadonlyMap<string, FileSystemInfoEntry | ExistenceOnlyTimeEntry | 'ignore' | null>;
104
+ contextTimestamps?: ReadonlyMap<string, FileSystemInfoEntry | ExistenceOnlyTimeEntry | 'ignore' | null>;
106
105
  fsStartTime?: number;
107
106
  watchMode: boolean;
108
107
  context: string;
@@ -157,7 +156,7 @@ declare class Compiler {
157
156
  * @param handler - signals when the call finishes
158
157
  * @returns a compiler watcher
159
158
  */
160
- watch(watchOptions: Watchpack.WatchOptions, handler: liteTapable.Callback<Error, Stats>): Watching;
159
+ watch(watchOptions: WatchOptions, handler: liteTapable.Callback<Error, Stats>): Watching;
161
160
  /**
162
161
  * @param callback - signals when the call finishes
163
162
  * @param options - additional data like modifiedFiles, removedFiles
@@ -1 +1,5 @@
1
- export { ConcatenatedModule } from '@rspack/binding';
1
+ import { Module } from './Module.js';
2
+ export declare class ConcatenatedModule extends Module {
3
+ get rootModule(): Module;
4
+ get modules(): Module[];
5
+ }
@@ -1 +1,3 @@
1
- export { ContextModule } from '@rspack/binding';
1
+ import { Module } from './Module.js';
2
+ export declare class ContextModule extends Module {
3
+ }
@@ -1,15 +1,16 @@
1
- import binding from '@rspack/binding';
2
1
  import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.js';
3
2
  import type { Chunk } from './Chunk.js';
4
3
  import { type Compilation } from './Compilation.js';
5
- export type ExternalModule = binding.ExternalModule;
4
+ import { Module } from './Module.js';
6
5
  export type ExternalModuleCompilationHooks = {
7
6
  chunkCondition: liteTapable.SyncBailHook<[
8
7
  Chunk,
9
8
  Compilation
10
9
  ], boolean | undefined>;
11
10
  };
12
- declare const ExternalModule: typeof binding.ExternalModule & {
13
- getCompilationHooks(compilation: Compilation): ExternalModuleCompilationHooks;
14
- };
15
- export { ExternalModule };
11
+ export declare class ExternalModule extends Module {
12
+ #private;
13
+ readonly userRequest: string;
14
+ constructor();
15
+ static getCompilationHooks(compilation: Compilation): ExternalModuleCompilationHooks;
16
+ }
@@ -1,5 +1,6 @@
1
1
  interface FileSystemInfoEntry {
2
2
  safeTime: number;
3
3
  timestamp?: number;
4
+ accuracy?: number;
4
5
  }
5
6
  export type { FileSystemInfoEntry };
package/dist/Module.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import binding, { type AssetInfo } from '@rspack/binding';
1
+ import binding from '@rspack/binding';
2
2
  import type { Source } from '../compiled/webpack-sources/index.js';
3
3
  import type { ResourceData } from './Resolver.js';
4
4
  import './BuildInfo.js';
@@ -11,6 +11,12 @@ export type ResolveData = binding.JsResolveData & {
11
11
  contextDependencies: string[];
12
12
  missingDependencies: string[];
13
13
  };
14
+ declare module '@rspack/binding' {
15
+ interface Module {
16
+ originalSource(): Source | null;
17
+ emitFile(filename: string, source: Source, assetInfo?: binding.AssetInfo): void;
18
+ }
19
+ }
14
20
  export declare class ContextModuleFactoryBeforeResolveData {
15
21
  #private;
16
22
  context: string;
@@ -35,11 +41,9 @@ export declare class ContextModuleFactoryAfterResolveData {
35
41
  private constructor();
36
42
  }
37
43
  export type ContextModuleFactoryAfterResolveResult = false | ContextModuleFactoryAfterResolveData;
38
- declare module '@rspack/binding' {
39
- interface Module {
40
- identifier(): string;
41
- originalSource(): Source | null;
42
- emitFile(filename: string, source: Source, assetInfo?: AssetInfo): void;
43
- }
44
+ export interface Module extends binding.Module {
44
45
  }
45
- export { Module } from '@rspack/binding';
46
+ export declare const Module: {
47
+ new (): Module;
48
+ readonly prototype: Module;
49
+ };
@@ -1,10 +1,16 @@
1
- import binding, { ModuleGraphConnection as BindingModuleGraphConnection } from '@rspack/binding';
1
+ import { ModuleGraphConnection as BindingModuleGraphConnection } from '@rspack/binding';
2
+ import { CIRCULAR_CONNECTION_SYMBOL, TRANSITIVE_ONLY_SYMBOL } from './util/symbols.js';
2
3
  type ModuleGraphConnectionConstructor = typeof BindingModuleGraphConnection & {
3
- readonly TRANSITIVE_ONLY: typeof binding.TRANSITIVE_ONLY_SYMBOL;
4
- readonly CIRCULAR_CONNECTION: typeof binding.CIRCULAR_CONNECTION_SYMBOL;
4
+ readonly TRANSITIVE_ONLY: typeof TRANSITIVE_ONLY_SYMBOL;
5
+ readonly CIRCULAR_CONNECTION: typeof CIRCULAR_CONNECTION_SYMBOL;
5
6
  };
6
7
  export interface ModuleGraphConnection extends BindingModuleGraphConnection {
7
8
  }
8
9
  export declare const ModuleGraphConnection: ModuleGraphConnectionConstructor;
9
10
  export type ConnectionState = boolean | typeof ModuleGraphConnection.TRANSITIVE_ONLY | typeof ModuleGraphConnection.CIRCULAR_CONNECTION;
11
+ declare module '@rspack/binding' {
12
+ interface ModuleGraphConnection {
13
+ getActiveState(runtime: string | string[] | undefined): ConnectionState;
14
+ }
15
+ }
10
16
  export {};
@@ -1,7 +1,7 @@
1
1
  import { EventEmitter } from 'node:events';
2
2
  import binding from '@rspack/binding';
3
- import type Watchpack from '../compiled/watchpack/index.js';
4
- import type { FileSystemInfoEntry, InputFileSystem, Watcher, WatchFileSystem } from './util/fs.js';
3
+ import type { WatchOptions } from './config/index.js';
4
+ import type { InputFileSystem, TimeInfoEntries, Watcher, WatchFileSystem } from './util/fs.js';
5
5
  /**
6
6
  * Minimal watchpack-compatible shim exposed as `NativeWatchFileSystem.watcher`.
7
7
  *
@@ -9,15 +9,20 @@ import type { FileSystemInfoEntry, InputFileSystem, Watcher, WatchFileSystem } f
9
9
  * `fork-ts-checker-webpack-plugin` rely on — `on`/`once` for `change`/`remove`,
10
10
  * plus `_onChange`/`_onRemove` to inject events — onto the native watcher, so
11
11
  * those plugins keep working under `experiments.nativeWatcher` unmodified.
12
+ * The times API (`getTimes`/`getTimeInfoEntries`/`collectTimeInfoEntries`) is
13
+ * forwarded to the owning file system, which reads it off the native watcher.
12
14
  *
13
15
  * APIs that iterate `fileWatchers`/`directoryWatchers` are intentionally not
14
16
  * supported; plugins needing those should use `WatchFileSystem.emit` instead.
15
17
  */
16
18
  declare class NativeWatcherShim extends EventEmitter {
17
19
  #private;
18
- constructor(trigger: (kind: 'change' | 'remove', path: string) => void);
20
+ constructor(fileSystem: NativeWatchFileSystem);
19
21
  _onChange(item: string, _mtime?: number, file?: string, _type?: string): void;
20
22
  _onRemove(item: string, file?: string, _type?: string): void;
23
+ getTimes(): Record<string, number | null>;
24
+ getTimeInfoEntries(): TimeInfoEntries;
25
+ collectTimeInfoEntries(fileTimestamps: TimeInfoEntries, directoryTimestamps: TimeInfoEntries): void;
21
26
  }
22
27
  export default class NativeWatchFileSystem implements WatchFileSystem {
23
28
  #private;
@@ -32,13 +37,20 @@ export default class NativeWatchFileSystem implements WatchFileSystem {
32
37
  }, missing: Iterable<string> & {
33
38
  added?: Iterable<string>;
34
39
  removed?: Iterable<string>;
35
- }, startTime: number, options: Watchpack.WatchOptions, callback: (error: Error | null, fileTimeInfoEntries: Map<string, FileSystemInfoEntry | 'ignore'>, contextTimeInfoEntries: Map<string, FileSystemInfoEntry | 'ignore'>, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
36
- getNativeWatcher(options: Watchpack.WatchOptions): binding.NativeWatcher;
40
+ }, startTime: number, options: WatchOptions, callback: (error: Error | null, fileTimeInfoEntries: TimeInfoEntries, contextTimeInfoEntries: TimeInfoEntries, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
41
+ /**
42
+ * watchpack's times API, served from the native watcher's registered paths.
43
+ * Empty before the first `watch()` and after `close()`.
44
+ */
45
+ getTimes(): Record<string, number | null>;
46
+ getTimeInfoEntries(): TimeInfoEntries;
47
+ collectTimeInfoEntries(fileTimestamps: TimeInfoEntries, directoryTimestamps: TimeInfoEntries): void;
48
+ getNativeWatcher(options: WatchOptions): binding.NativeWatcher;
37
49
  triggerEvent(kind: 'change' | 'remove' | 'create', path: string): void;
38
- on(event: 'change', listener: (filename: string, mtime: number) => void): this;
50
+ on(event: 'change', listener: (filename: string, mtime: number | null) => void): this;
39
51
  on(event: 'remove', listener: (filename: string) => void): this;
40
52
  on(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
41
- once(event: 'change', listener: (filename: string, mtime: number) => void): this;
53
+ once(event: 'change', listener: (filename: string, mtime: number | null) => void): this;
42
54
  once(event: 'remove', listener: (filename: string) => void): this;
43
55
  once(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
44
56
  emit(event: 'change', filename: string, mtime: number): boolean;
@@ -1,14 +1,22 @@
1
+ import binding from '@rspack/binding';
1
2
  import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.js';
2
3
  import { type Compilation } from './Compilation.js';
3
4
  import type { LoaderContext } from './config/index.js';
4
- import type { Module } from './Module.js';
5
+ import { Module } from './Module.js';
5
6
  export interface NormalModuleCompilationHooks {
6
7
  loader: liteTapable.SyncHook<[LoaderContext, Module]>;
7
8
  readResource: liteTapable.HookMap<liteTapable.AsyncSeriesBailHook<[LoaderContext], string | Buffer>>;
8
9
  }
9
- declare module '@rspack/binding' {
10
- interface NormalModuleConstructor {
11
- getCompilationHooks(compilation: Compilation): NormalModuleCompilationHooks;
12
- }
10
+ export declare class NormalModule extends Module {
11
+ #private;
12
+ readonly resource: string;
13
+ readonly request: string;
14
+ readonly userRequest: string;
15
+ readonly rawRequest: string;
16
+ readonly resourceResolveData: Readonly<binding.JsResourceData> | undefined;
17
+ readonly loaders: binding.JsLoaderItem[];
18
+ matchResource: string | undefined;
19
+ readonly error: binding.RspackError | undefined;
20
+ constructor();
21
+ static getCompilationHooks(compilation: Compilation): NormalModuleCompilationHooks;
13
22
  }
14
- export { NormalModule } from '@rspack/binding';
@@ -55,6 +55,7 @@ export declare class RuntimeTemplate {
55
55
  supportsDynamicImport(): boolean;
56
56
  supportsEcmaScriptModuleSyntax(): boolean;
57
57
  supportTemplateLiteral(): boolean;
58
+ supportsTopLevelAwait(): boolean;
58
59
  supportNodePrefixForCoreModules(): boolean;
59
60
  /**
60
61
  * @param mod a module
package/dist/Stats.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { Compilation } from './Compilation.js';
2
2
  import type { StatsOptions, StatsValue } from './config/index.js';
3
3
  import type { StatsCompilation } from './stats/statsFactoryUtils.js';
4
- export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule, } from './stats/statsFactoryUtils.js';
4
+ export type { StatsAsset, StatsCacheInfo, StatsChunk, StatsCompilation, StatsError, StatsModule, } from './stats/statsFactoryUtils.js';
5
5
  export declare class Stats {
6
6
  #private;
7
7
  constructor(compilation: Compilation);
@@ -1,8 +1,9 @@
1
1
  import { type SourceMapDevToolPluginOptions } from '@rspack/binding';
2
+ export type EvalSourceMapDevToolPluginOptions = Pick<SourceMapDevToolPluginOptions, 'columns' | 'debugIds' | 'exclude' | 'ignoreList' | 'include' | 'module' | 'moduleFilenameTemplate' | 'namespace' | 'noSources' | 'sourceRoot' | 'test'>;
2
3
  export declare const EvalSourceMapDevToolPlugin: {
3
- new (options: SourceMapDevToolPluginOptions): {
4
+ new (options: EvalSourceMapDevToolPluginOptions): {
4
5
  name: string;
5
- _args: [options: SourceMapDevToolPluginOptions];
6
+ _args: [options: EvalSourceMapDevToolPluginOptions];
6
7
  affectedHooks: keyof import("../index.js").CompilerHooks | undefined;
7
8
  raw(compiler: import("../index.js").Compiler): import("@rspack/binding").BuiltinPlugin;
8
9
  apply(compiler: import("../index.js").Compiler): void;
@@ -0,0 +1,9 @@
1
+ export declare const ImportedByDeferModulesPlugin: {
2
+ new (): {
3
+ name: string;
4
+ _args: [];
5
+ affectedHooks: keyof import("../index.js").CompilerHooks | undefined;
6
+ raw(compiler: import("../index.js").Compiler): import("@rspack/binding").BuiltinPlugin;
7
+ apply(compiler: import("../index.js").Compiler): void;
8
+ };
9
+ };
@@ -8,6 +8,7 @@ export type SubresourceIntegrityPluginOptions = {
8
8
  ];
9
9
  htmlPlugin?: string | false;
10
10
  enabled?: 'auto' | boolean;
11
+ hashLoading?: 'eager' | 'lazy';
11
12
  };
12
13
  export type NativeSubresourceIntegrityPluginOptions = Omit<RawSubresourceIntegrityPluginOptions, 'htmlPlugin'> & {
13
14
  htmlPlugin: string | false;
@@ -48,6 +48,7 @@ export * from './HttpUriPlugin.js';
48
48
  export * from './html-plugin/index.js';
49
49
  export * from './IgnorePlugin.js';
50
50
  export * from './InferAsyncModulesPlugin.js';
51
+ export * from './ImportedByDeferModulesPlugin.js';
51
52
  export * from './InlineExportsPlugin.js';
52
53
  export * from './JavascriptModulesPlugin.js';
53
54
  export * from './JsLoaderRspackPlugin.js';
@@ -1,8 +1,8 @@
1
1
  import type { Module } from '../../Module.js';
2
2
  export declare const BuiltinLazyCompilationPlugin: {
3
- new (takeNewlyActiveModules: () => Set<string>, entries: boolean, imports: boolean, client: string, reservedExternals: string[], test?: RegExp | ((module: Module) => boolean) | undefined): {
3
+ new (takeNewlyActiveModules: () => Set<string>, entries: boolean, imports: boolean, client: string, collectReservedExternals: (layer?: string | null) => string[], test?: RegExp | ((module: Module) => boolean) | undefined): {
4
4
  name: string;
5
- _args: [takeNewlyActiveModules: () => Set<string>, entries: boolean, imports: boolean, client: string, reservedExternals: string[], test?: RegExp | ((module: Module) => boolean) | undefined];
5
+ _args: [takeNewlyActiveModules: () => Set<string>, entries: boolean, imports: boolean, client: string, collectReservedExternals: (layer?: string | null) => string[], test?: RegExp | ((module: Module) => boolean) | undefined];
6
6
  affectedHooks: keyof import("../../index.js").CompilerHooks | undefined;
7
7
  raw(compiler: import("../../index.js").Compiler): import("@rspack/binding").BuiltinPlugin;
8
8
  apply(compiler: import("../../index.js").Compiler): void;
@@ -10,7 +10,7 @@
10
10
  import type { HttpUriPluginOptions } from '../builtin-plugin/index.js';
11
11
  import type { Compilation } from '../Compilation.js';
12
12
  import type WebpackError from '../lib/WebpackError.js';
13
- import type { Amd, AssetModuleFilename, Bail, BundlerInfoOptions, SnapshotOptions, FileSystemCacheOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryDescription, Environment, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, ImportMetaName, Incremental, InfrastructureLogging, LazyCompilationOptions, LibraryOptions, Loader, Mode, NewCache, Name, Node, NoParseOption, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, PublicPath, Resolve, RspackOptions, RuleSetRules, ScriptType, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, WasmStreamingFallback, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from './types.js';
13
+ import type { Amd, AssetModuleFilename, Bail, BundlerInfoOptions, SnapshotOptions, ChunkFilename, ChunkLoading, ChunkLoadingGlobal, Clean, Context, CrossOriginLoading, CssChunkFilename, CssFilename, Dependencies, DevServer, DevTool, DevtoolFallbackModuleFilenameTemplate, DevtoolModuleFilenameTemplate, DevtoolNamespace, EnabledLibraryTypes, EnabledWasmLoadingTypes, EntryDescription, Environment, Externals, ExternalsPresets, ExternalsType, Filename, GeneratorOptionsByModuleType, GlobalObject, HashDigest, HashDigestLength, HashFunction, HashSalt, HotUpdateChunkFilename, HotUpdateGlobal, HotUpdateMainFilename, Iife, ImportFunctionName, ImportMetaName, Incremental, InfrastructureLogging, LazyCompilationOptions, LibraryOptions, Loader, Mode, NewCache, Name, Node, NoParseOption, Optimization, OutputModule, ParserOptionsByModuleType, Path, Performance, Plugins, PublicPath, Resolve, RspackOptions, RuleSetRules, ScriptType, SourceMapFilename, StatsValue, StrictModuleErrorHandling, Target, TrustedTypes, UniqueName, WasmLoading, WasmStreamingFallback, Watch, WatchOptions, WebassemblyModuleFilename, WorkerPublicPath } from './types.js';
14
14
  export declare const getNormalizedRspackOptions: (config: RspackOptions) => RspackOptionsNormalized;
15
15
  export type EntryDynamicNormalized = () => Promise<EntryStaticNormalized>;
16
16
  export type EntryNormalized = EntryDynamicNormalized | EntryStaticNormalized;
@@ -82,7 +82,7 @@ export interface ModuleOptionsNormalized {
82
82
  export type CacheSnapshotNormalized = SnapshotOptions;
83
83
  export type CacheNormalized = false | {
84
84
  type: 'memory';
85
- } | FileSystemCacheOptions | {
85
+ } | {
86
86
  type: 'persistent';
87
87
  name?: string;
88
88
  buildDependencies: string[];
@@ -85,6 +85,8 @@ export type EcmaTargetProperties = {
85
85
  templateLiteral: boolean | null;
86
86
  /** async functions and await are available */
87
87
  asyncFunction: boolean | null;
88
+ /** top-level await is available */
89
+ topLevelAwait: boolean | null;
88
90
  };
89
91
  export type ExtractedTargetProperties = {
90
92
  esVersion?: number | null;