@ohos-ports/rspack-core 2.2.2-beta.0 → 2.2.9-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 (206) hide show
  1. package/README.md +10 -0
  2. package/compiled/@rspack/lite-tapable/dist/index.d.ts +20 -6
  3. package/compiled/@rspack/lite-tapable/package.json +1 -1
  4. package/compiled/open/package.json +1 -1
  5. package/compiled/tinypool/README.md +4 -4
  6. package/compiled/tinypool/dist/index.d.ts +3 -2
  7. package/compiled/tinypool/dist/index.js +3 -3
  8. package/compiled/tinypool/package.json +1 -1
  9. package/compiled/webpack-sources/index.d.ts +61 -0
  10. package/compiled/webpack-sources/index.js +858 -224
  11. package/compiled/webpack-sources/package.json +8 -1
  12. package/compiled/webpack-sources/types/CachedSource.d.ts +192 -0
  13. package/compiled/webpack-sources/types/CompatSource.d.ts +87 -0
  14. package/compiled/webpack-sources/types/ConcatSource.d.ts +75 -0
  15. package/compiled/webpack-sources/types/OriginalSource.d.ts +87 -0
  16. package/compiled/webpack-sources/types/PrefixSource.d.ts +59 -0
  17. package/compiled/webpack-sources/types/RawSource.d.ts +75 -0
  18. package/compiled/webpack-sources/types/ReplaceSource.d.ts +107 -0
  19. package/compiled/webpack-sources/types/SizeOnlySource.d.ts +24 -0
  20. package/compiled/webpack-sources/types/Source.d.ts +189 -0
  21. package/compiled/webpack-sources/types/SourceMapSource.d.ts +136 -0
  22. package/compiled/webpack-sources/types/helpers/createMappingsSerializer.d.ts +60 -0
  23. package/compiled/webpack-sources/types/helpers/getFromStreamChunks.d.ts +16 -0
  24. package/compiled/webpack-sources/types/helpers/getGeneratedSourceInfo.d.ts +31 -0
  25. package/compiled/webpack-sources/types/helpers/getName.d.ts +15 -0
  26. package/compiled/webpack-sources/types/helpers/getSource.d.ts +15 -0
  27. package/compiled/webpack-sources/types/helpers/readMappings.d.ts +19 -0
  28. package/compiled/webpack-sources/types/helpers/scopes.d.ts +119 -0
  29. package/compiled/webpack-sources/types/helpers/splitIntoLines.d.ts +6 -0
  30. package/compiled/webpack-sources/types/helpers/splitIntoPotentialTokens.d.ts +37 -0
  31. package/compiled/webpack-sources/types/helpers/streamAndGetSourceAndMap.d.ts +39 -0
  32. package/compiled/webpack-sources/types/helpers/streamChunks.d.ts +56 -0
  33. package/compiled/webpack-sources/types/helpers/streamChunksOfCombinedSourceMap.d.ts +42 -0
  34. package/compiled/webpack-sources/types/helpers/streamChunksOfRawSource.d.ts +16 -0
  35. package/compiled/webpack-sources/types/helpers/streamChunksOfSourceMap.d.ts +19 -0
  36. package/compiled/webpack-sources/types/helpers/stringBufferUtils.d.ts +55 -0
  37. package/compiled/webpack-sources/types/index.d.ts +50 -0
  38. package/dist/BuildInfo.d.ts +6 -4
  39. package/dist/Chunk.d.ts +3 -3
  40. package/dist/ChunkGraph.d.ts +2 -2
  41. package/dist/Chunks.d.ts +2 -2
  42. package/dist/CodeGenerationResults.d.ts +6 -1
  43. package/dist/Compilation.d.ts +13 -52
  44. package/dist/Compiler.d.ts +5 -5
  45. package/dist/ConcatenatedModule.d.ts +1 -1
  46. package/dist/ContextModule.d.ts +1 -1
  47. package/dist/Diagnostics.d.ts +2 -6
  48. package/dist/Entrypoint.d.ts +1 -1
  49. package/dist/ExportsInfo.d.ts +1 -1
  50. package/dist/ExternalModule.d.ts +1 -1
  51. package/dist/FileSystem.d.ts +3 -1
  52. package/dist/FileSystemDependencies.d.ts +15 -0
  53. package/dist/Module.d.ts +10 -6
  54. package/dist/ModuleGraph.d.ts +6 -6
  55. package/dist/ModuleGraphConnection.d.ts +1 -1
  56. package/dist/Modules.d.ts +3 -0
  57. package/dist/NativeWatchFileSystem.d.ts +1 -1
  58. package/dist/NormalModule.d.ts +2 -2
  59. package/dist/NormalModuleFactory.d.ts +2 -1
  60. package/dist/Resolver.d.ts +10 -2
  61. package/dist/ResolverFactory.d.ts +1 -1
  62. package/dist/RspackError.d.ts +2 -2
  63. package/dist/RuntimeGlobals.d.ts +4 -3
  64. package/dist/RuntimeModule.d.ts +1 -1
  65. package/dist/builtin-loader/lightningcss/target.d.ts +1 -1
  66. package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
  67. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
  68. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
  69. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
  70. package/dist/builtin-plugin/BannerPlugin.d.ts +2 -2
  71. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
  72. package/dist/builtin-plugin/CaseSensitivePlugin.d.ts +1 -1
  73. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
  74. package/dist/builtin-plugin/CircularCheckRspackPlugin.d.ts +1 -1
  75. package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +1 -1
  76. package/dist/builtin-plugin/CircularModulesInfoPlugin.d.ts +1 -1
  77. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
  78. package/dist/builtin-plugin/CompactHashedChunkIdsPlugin.d.ts +1 -1
  79. package/dist/builtin-plugin/CompactHashedModuleIdsPlugin.d.ts +1 -1
  80. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -1
  81. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +2 -2
  82. package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
  83. package/dist/builtin-plugin/CssHttpExternalsRspackPlugin.d.ts +1 -1
  84. package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
  85. package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
  86. package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
  87. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
  88. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
  89. package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -1
  90. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +2 -2
  91. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
  92. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
  93. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
  94. package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +1 -1
  95. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
  96. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
  97. package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
  98. package/dist/builtin-plugin/EsmNodeTargetPlugin.d.ts +1 -1
  99. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +2 -2
  100. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +2 -2
  101. package/dist/builtin-plugin/ExternalsPlugin.d.ts +1 -1
  102. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
  103. package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
  104. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -1
  105. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
  106. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
  107. package/dist/builtin-plugin/HashedModuleIdsPlugin.d.ts +2 -2
  108. package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +1 -1
  109. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
  110. package/dist/builtin-plugin/HttpUriPlugin.d.ts +5 -1
  111. package/dist/builtin-plugin/IgnorePlugin.d.ts +2 -2
  112. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
  113. package/dist/builtin-plugin/InlineExportsPlugin.d.ts +1 -1
  114. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
  115. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
  116. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
  117. package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -1
  118. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -1
  119. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
  120. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
  121. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
  122. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
  123. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
  124. package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +1 -1
  125. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
  126. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
  127. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
  128. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
  129. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -1
  130. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
  131. package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +1 -1
  132. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +2 -2
  133. package/dist/builtin-plugin/ProgressPlugin.d.ts +2 -2
  134. package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
  135. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
  136. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -1
  137. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
  138. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +2 -2
  139. package/dist/builtin-plugin/RslibPlugin.d.ts +4 -4
  140. package/dist/builtin-plugin/RstestPlugin.d.ts +2 -2
  141. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +2 -2
  142. package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
  143. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
  144. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
  145. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +2 -2
  146. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +1 -1
  147. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +2 -2
  148. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
  149. package/dist/builtin-plugin/SyncModuleIdsPlugin.d.ts +1 -1
  150. package/dist/builtin-plugin/URLPlugin.d.ts +1 -1
  151. package/dist/builtin-plugin/WorkerPlugin.d.ts +1 -1
  152. package/dist/builtin-plugin/base.d.ts +1 -1
  153. package/dist/builtin-plugin/css-extract/index.d.ts +1 -1
  154. package/dist/builtin-plugin/css-extract/utils.d.ts +4 -1
  155. package/dist/builtin-plugin/html-plugin/hooks.d.ts +1 -1
  156. package/dist/builtin-plugin/html-plugin/plugin.d.ts +2 -2
  157. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +3 -3
  158. package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +1 -1
  159. package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +1 -1
  160. package/dist/config/adapter.d.ts +1 -1
  161. package/dist/config/adapterRuleUse.d.ts +3 -2
  162. package/dist/config/normalization.d.ts +6 -9
  163. package/dist/config/types.d.ts +79 -16
  164. package/dist/container/ContainerPlugin.d.ts +1 -1
  165. package/dist/container/ContainerReferencePlugin.d.ts +1 -1
  166. package/dist/container/ModuleFederationManifestPlugin.d.ts +1 -1
  167. package/dist/container/ModuleFederationPluginV1.d.ts +5 -1
  168. package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
  169. package/dist/cssExtractLoader.js +7 -5
  170. package/dist/exports.d.ts +5 -5
  171. package/dist/index.js +885 -408
  172. package/dist/lib/Cache.d.ts +3 -0
  173. package/dist/lib/DllReferencePlugin.d.ts +1 -1
  174. package/dist/lib/WebpackError.d.ts +1 -1
  175. package/dist/loader-runner/cache.d.ts +11 -2
  176. package/dist/loader-runner/dependencies.d.ts +4 -3
  177. package/dist/loader-runner/index.d.ts +1 -1
  178. package/dist/loader-runner/service.d.ts +6 -1
  179. package/dist/loader-runner/worker.d.ts +1 -1
  180. package/dist/l~0.js +34 -0
  181. package/dist/l~3.js +34 -0
  182. package/dist/sharing/CollectSharedEntryPlugin.d.ts +1 -1
  183. package/dist/sharing/ConsumeSharedPlugin.d.ts +1 -1
  184. package/dist/sharing/ProvideSharedPlugin.d.ts +1 -1
  185. package/dist/sharing/SharePlugin.d.ts +13 -1
  186. package/dist/sharing/ShareRuntimePlugin.d.ts +1 -1
  187. package/dist/sharing/SharedContainerPlugin.d.ts +1 -1
  188. package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +2 -2
  189. package/dist/stats/StatsFactory.d.ts +4 -2
  190. package/dist/stats/StatsPrinter.d.ts +5 -5
  191. package/dist/stats/statsFactoryUtils.d.ts +5 -6
  192. package/dist/swc.d.ts +1 -1
  193. package/dist/taps/compilation.d.ts +1 -1
  194. package/dist/taps/types.d.ts +1 -1
  195. package/dist/util/SplitChunkSize.d.ts +1 -1
  196. package/dist/util/bindingHelpers.d.ts +7 -0
  197. package/dist/util/fs.d.ts +9 -9
  198. package/dist/util/source.d.ts +3 -3
  199. package/dist/util/watchTimeInfo.d.ts +7 -0
  200. package/dist/worker.js +78 -43
  201. package/package.json +8 -32
  202. package/compiled/webpack-sources/types.d.ts +0 -500
  203. package/dist/612~0.js +0 -32
  204. package/dist/612~3.js +0 -32
  205. package/dist/util/MergeCaller.d.ts +0 -10
  206. package/dist/util/fake.d.ts +0 -11
@@ -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, 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, 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';
14
14
  export declare const getNormalizedRspackOptions: (config: RspackOptions) => RspackOptionsNormalized;
15
15
  export type EntryDynamicNormalized = () => Promise<EntryStaticNormalized>;
16
16
  export type EntryNormalized = EntryDynamicNormalized | EntryStaticNormalized;
@@ -78,22 +78,18 @@ export interface ModuleOptionsNormalized {
78
78
  generator: GeneratorOptionsByModuleType;
79
79
  noParse?: NoParseOption;
80
80
  }
81
- export type CacheSnapshotNormalized = {
82
- immutablePaths?: (string | RegExp)[];
83
- unmanagedPaths?: (string | RegExp)[];
84
- managedPaths?: (string | RegExp)[];
85
- };
81
+ /** @deprecated Use the top-level `snapshot` option. */
82
+ export type CacheSnapshotNormalized = SnapshotOptions;
86
83
  export type CacheNormalized = false | {
87
84
  type: 'memory';
88
- snapshot: CacheSnapshotNormalized;
89
- } | {
85
+ } | FileSystemCacheOptions | {
90
86
  type: 'persistent';
91
87
  name?: string;
92
88
  buildDependencies: string[];
93
89
  version?: string;
94
90
  maxAge?: number;
91
+ maxMemoryGenerations?: number;
95
92
  maxVersions?: number;
96
- snapshot: CacheSnapshotNormalized;
97
93
  storage: {
98
94
  type: 'filesystem';
99
95
  directory?: string;
@@ -140,6 +136,7 @@ export interface RspackOptionsNormalized {
140
136
  node: Node;
141
137
  loader: Loader;
142
138
  cache?: CacheNormalized;
139
+ snapshot: SnapshotOptions;
143
140
  stats: StatsValue;
144
141
  optimization: Optimization;
145
142
  plugins: Plugins;
@@ -1,4 +1,4 @@
1
- import type { AssetInfo, RawFuncUseCtx } from '@ohos-ports/rspack-binding';
1
+ import type { AssetInfo, RawFuncUseCtx } from '@rspack/binding';
2
2
  import type { HttpUriPluginOptions } from '../builtin-plugin/HttpUriPlugin.js';
3
3
  import type { ChunkGraph } from '../ChunkGraph.js';
4
4
  import type { Compilation, PathData } from '../Compilation.js';
@@ -617,7 +617,7 @@ export type ResolveOptions = {
617
617
  * A list of resolve restrictions to restrict the paths that a request can be resolved on.
618
618
  * @default []
619
619
  * */
620
- restrictions?: string[];
620
+ restrictions?: (string | RegExp)[];
621
621
  /**
622
622
  * A list of directories where server-relative URLs (beginning with '/') are resolved.
623
623
  * On systems other than Windows, these requests are initially resolved as an absolute path.
@@ -667,8 +667,8 @@ export type RuleSetLoaderWithOptions = {
667
667
  cache?: boolean;
668
668
  options?: RuleSetLoaderOptions;
669
669
  };
670
- export type RuleSetUseItem = RuleSetLoader | RuleSetLoaderWithOptions;
671
- export type RuleSetUse = RuleSetUseItem | RuleSetUseItem[] | ((data: RawFuncUseCtx) => RuleSetUseItem[]);
670
+ export type RuleSetUseItem = RuleSetLoader | RuleSetLoaderWithOptions | Falsy;
671
+ export type RuleSetUse = RuleSetUseItem | RuleSetUseItem[] | ((data: RawFuncUseCtx) => RuleSetUseItem | RuleSetUseItem[]);
672
672
  export type RuleSetRuleUseAndLoader = {
673
673
  /** A loader name */
674
674
  loader: RuleSetLoader;
@@ -1304,7 +1304,7 @@ export type Target = false | AllowTarget | AllowTarget[];
1304
1304
  * `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.
1305
1305
  * @default 'var'
1306
1306
  */
1307
- 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';
1307
+ 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' | 'asset' | 'asset-url' | 'css-import';
1308
1308
  /**
1309
1309
  * External item object when both library.type and externalsType is 'umd'
1310
1310
  */
@@ -1345,8 +1345,9 @@ export type ExternalItemFunctionData = {
1345
1345
  };
1346
1346
  /**
1347
1347
  * Get a resolve function with the current resolver options.
1348
+ * The returned function accepts a callback or returns a Promise when called without one.
1348
1349
  */
1349
- getResolve?: (options?: ResolveOptions) => ((context: string, request: string, callback: ResolveCallback) => void) | ((context: string, request: string) => Promise<string>);
1350
+ getResolve?: (options?: ResolveOptions) => ((context: string, request: string, callback: ResolveCallback) => void) & ((context: string, request: string) => Promise<string | undefined>);
1350
1351
  };
1351
1352
  /**
1352
1353
  * Prevent bundling of certain imported package and instead retrieve these external dependencies at runtime.
@@ -1361,7 +1362,7 @@ export type ExternalItemFunctionData = {
1361
1362
  * }
1362
1363
  * ```
1363
1364
  * */
1364
- export type ExternalItem = string | RegExp | ExternalItemObjectUnknown | ((data: ExternalItemFunctionData) => ExternalItemValue) | ((data: ExternalItemFunctionData, callback: (err?: Error, result?: ExternalItemValue, type?: ExternalsType) => void) => void) | ((data: ExternalItemFunctionData) => Promise<ExternalItemValue>);
1365
+ export type ExternalItem = string | RegExp | ExternalItemObjectUnknown | ((data: ExternalItemFunctionData, callback: (err?: Error | null, result?: ExternalItemValue, type?: ExternalsType) => void) => ExternalItemValue | void | Promise<ExternalItemValue | void>);
1365
1366
  /**
1366
1367
  * Prevent bundling of certain imported packages and instead retrieve these external dependencies at runtime.
1367
1368
  *
@@ -1488,7 +1489,7 @@ export type Loader = Record<string, any>;
1488
1489
  /**
1489
1490
  * Snapshot options for determining which files have been modified.
1490
1491
  */
1491
- export type CacheSnapshotOptions = {
1492
+ export type SnapshotOptions = {
1492
1493
  /**
1493
1494
  * An array of paths to immutable files, changes to these paths will be ignored during hot restart.
1494
1495
  */
@@ -1502,7 +1503,25 @@ export type CacheSnapshotOptions = {
1502
1503
  * @default [/[\\/]node_modules[\\/][^.]/]
1503
1504
  */
1504
1505
  managedPaths?: (string | RegExp)[];
1506
+ /** Snapshot strategy for build dependencies. */
1507
+ buildDependencies?: SnapshotStrategyOptions;
1508
+ /** Snapshot strategy for resolving build dependencies. */
1509
+ resolveBuildDependencies?: SnapshotStrategyOptions;
1510
+ /** Snapshot strategy for module dependencies. */
1511
+ module?: SnapshotStrategyOptions;
1512
+ /** Snapshot strategy for context modules. */
1513
+ contextModule?: SnapshotStrategyOptions;
1514
+ /** Snapshot strategy for resolving requests. */
1515
+ resolve?: SnapshotStrategyOptions;
1505
1516
  };
1517
+ export type SnapshotStrategyOptions = {
1518
+ /** Use content hashes to detect changes. */
1519
+ hash?: boolean;
1520
+ /** Use timestamps to detect changes. */
1521
+ timestamp?: boolean;
1522
+ };
1523
+ /** @deprecated Use `SnapshotOptions` and the top-level `snapshot` option. */
1524
+ export type CacheSnapshotOptions = SnapshotOptions;
1506
1525
  /**
1507
1526
  * Storage options for persistent cache.
1508
1527
  */
@@ -1552,14 +1571,19 @@ export type PersistentCacheOptions = {
1552
1571
  * @default 7 * 24 * 60 * 60
1553
1572
  */
1554
1573
  maxAge?: number;
1574
+ /**
1575
+ * Number of generations that unused cache entries stay in the additional
1576
+ * memory cache. Set to 0 to disable the memory cache, or Infinity to keep
1577
+ * entries forever.
1578
+ * @default 5 in development mode, Infinity otherwise
1579
+ */
1580
+ maxMemoryGenerations?: number;
1555
1581
  /**
1556
1582
  * @deprecated This option has no effect. Rspack keeps only one persistent
1557
1583
  * cache per compiler path.
1558
1584
  */
1559
1585
  maxVersions?: number;
1560
- /**
1561
- * Snapshot options for determining which files have been modified.
1562
- */
1586
+ /** @deprecated Use the top-level `snapshot` option instead. */
1563
1587
  snapshot?: CacheSnapshotOptions;
1564
1588
  /**
1565
1589
  * Storage options for cache.
@@ -1586,10 +1610,34 @@ export type MemoryCacheOptions = {
1586
1610
  * Cache type.
1587
1611
  */
1588
1612
  type: 'memory';
1613
+ };
1614
+ /** Filesystem cache options. Requires `experiments.newCache` to be enabled. */
1615
+ export type FileSystemCacheOptions = {
1616
+ type: 'filesystem';
1617
+ /** Name for the cache. Different names create coexisting caches. */
1618
+ name?: string;
1619
+ /** Build dependencies grouped by category. Changes invalidate the cache. */
1620
+ buildDependencies?: Record<string, string[]>;
1621
+ /** Base directory for the cache. Defaults to `node_modules/.cache/rspack`. */
1622
+ cacheDirectory?: string;
1623
+ /** Cache location. Defaults to `<cacheDirectory>/<name>`. */
1624
+ cacheLocation?: string;
1625
+ /** Cache version. Changing this value invalidates the cache. Defaults to `""`. */
1626
+ version?: string;
1627
+ /** Read existing cache data without writing to disk. Defaults to `false`. */
1628
+ readonly?: boolean;
1589
1629
  /**
1590
- * Snapshot options for determining which files have been modified.
1591
- */
1592
- snapshot?: CacheSnapshotOptions;
1630
+ * Generations to retain unused entries in memory. Use 0 to disable the memory
1631
+ * cache or Infinity to retain entries forever. Defaults to 5 in development,
1632
+ * Infinity otherwise.
1633
+ */
1634
+ maxMemoryGenerations?: number;
1635
+ /** Idle time before writing to disk, in milliseconds. Defaults to 60000. */
1636
+ idleTimeout?: number;
1637
+ /** Idle time before the initial write, in milliseconds. Defaults to 5000. */
1638
+ idleTimeoutForInitialStore?: number;
1639
+ /** Idle time after large changes, in milliseconds. Defaults to 1000. */
1640
+ idleTimeoutAfterLargeChanges?: number;
1593
1641
  };
1594
1642
  /**
1595
1643
  * Options for caching snapshots and intermediate products during the build process.
@@ -1602,7 +1650,7 @@ export type MemoryCacheOptions = {
1602
1650
  * // Disable caching
1603
1651
  * cache: false
1604
1652
  */
1605
- export type CacheOptions = boolean | MemoryCacheOptions | PersistentCacheOptions;
1653
+ export type CacheOptions = boolean | MemoryCacheOptions | PersistentCacheOptions | FileSystemCacheOptions;
1606
1654
  export type StatsPresets = 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings' | 'minimal' | 'detailed' | 'summary';
1607
1655
  type AssetFilterItemTypes = RegExp | string | ((name: string, asset: any) => boolean);
1608
1656
  type AssetFilterTypes = boolean | AssetFilterItemTypes | AssetFilterItemTypes[];
@@ -2133,6 +2181,13 @@ export type OptimizationSplitChunksCacheGroup = {
2133
2181
  } & SharedOptimizationSplitChunksCacheGroup;
2134
2182
  /** Tell Rspack how to splitting chunks. */
2135
2183
  export type OptimizationSplitChunksOptions = {
2184
+ /**
2185
+ * Maximum rounds of intersection discovery for additional shared-module groups.
2186
+ * Defaults to `1` (pairwise intersections) in production and `0` otherwise.
2187
+ * Set `0` to disable discovery.
2188
+ * Higher depths allow newly discovered intersections to participate in the next round.
2189
+ */
2190
+ dedupDepth?: number;
2136
2191
  /**
2137
2192
  * Options for module cache group
2138
2193
  * */
@@ -2412,12 +2467,16 @@ export type UseInputFileSystem = false | RegExp[];
2412
2467
  export type NewCache = {
2413
2468
  /** Enable the module code generation cache. @default true */
2414
2469
  codeGeneration?: boolean;
2470
+ /** Enable the module build cache. @default true */
2471
+ module?: boolean;
2415
2472
  /** Enable the devtool asset cache. @default true */
2416
2473
  devtool?: boolean;
2417
2474
  /** Enable the per-loader cache. @default true */
2418
2475
  loader?: boolean;
2419
2476
  /** Enable the asset minimization cache. @default true */
2420
2477
  minimize?: boolean;
2478
+ /** Enable the module and loader resolution cache. @default true */
2479
+ resolver?: boolean;
2421
2480
  };
2422
2481
  export type NewCachePresets = boolean;
2423
2482
  /**
@@ -2514,8 +2573,10 @@ export type WatchOptions = {
2514
2573
  followSymlinks?: boolean;
2515
2574
  /**
2516
2575
  * Ignore some files from being watched.
2576
+ * A function receives each entry and must return `true` to ignore it; unlike
2577
+ * the other forms, its path keeps the platform separators.
2517
2578
  */
2518
- ignored?: string | RegExp | string[];
2579
+ ignored?: string | RegExp | string[] | ((entry: string) => boolean);
2519
2580
  /**
2520
2581
  * Turn on polling by passing true, or specifying a poll interval in milliseconds.
2521
2582
  * @default false
@@ -2632,6 +2693,8 @@ export type RspackOptions = {
2632
2693
  * Options for caching.
2633
2694
  */
2634
2695
  cache?: CacheOptions;
2696
+ /** Options for detecting changes to dependencies. */
2697
+ snapshot?: SnapshotOptions;
2635
2698
  /**
2636
2699
  * The context in which the compilation should occur.
2637
2700
  */
@@ -1,4 +1,4 @@
1
- import { type BuiltinPlugin, BuiltinPluginName } from '@ohos-ports/rspack-binding';
1
+ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
3
3
  import type { Compiler } from '../Compiler.js';
4
4
  import type { EntryRuntime, FilenameTemplate, LibraryOptions } from '../config/index.js';
@@ -1,4 +1,4 @@
1
- import { type BuiltinPlugin, BuiltinPluginName } from '@ohos-ports/rspack-binding';
1
+ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
3
3
  import type { Compiler } from '../Compiler.js';
4
4
  import type { ExternalsType } from '../config/index.js';
@@ -1,4 +1,4 @@
1
- import { type BuiltinPlugin, BuiltinPluginName } from '@ohos-ports/rspack-binding';
1
+ import { type BuiltinPlugin, BuiltinPluginName } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
3
3
  import type { Compiler } from '../Compiler.js';
4
4
  import { type ModuleFederationPluginOptions } from './ModuleFederationPlugin.js';
@@ -7,7 +7,11 @@ export interface ModuleFederationPluginV1Options {
7
7
  exposes?: Exposes;
8
8
  filename?: string;
9
9
  library?: LibraryOptions;
10
- name: string;
10
+ /**
11
+ * The container name. A non-empty string is required when exposing modules
12
+ * or enabling shared dependency tree shaking.
13
+ */
14
+ name?: string;
11
15
  remoteType?: ExternalsType;
12
16
  remotes?: Remotes;
13
17
  runtime?: EntryRuntime;
@@ -10,7 +10,7 @@ export declare const ModuleFederationRuntimePlugin: {
10
10
  name: string;
11
11
  _args: [options?: ModuleFederationRuntimeOptions | undefined];
12
12
  affectedHooks: keyof import("../index.js").CompilerHooks | undefined;
13
- raw(compiler: import("../index.js").Compiler): import("@ohos-ports/rspack-binding").BuiltinPlugin;
13
+ raw(compiler: import("../index.js").Compiler): import("@rspack/binding").BuiltinPlugin;
14
14
  apply(compiler: import("../index.js").Compiler): void;
15
15
  };
16
16
  };
@@ -2,9 +2,11 @@ import node_path from "node:path";
2
2
  function isAbsolutePath(str) {
3
3
  return node_path.posix.isAbsolute(str) || node_path.win32.isAbsolute(str);
4
4
  }
5
- let PLUGIN_NAME = 'css-extract-rspack-plugin', pluginSymbol = Symbol.for(PLUGIN_NAME), 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__';
5
+ let PLUGIN_NAME = 'css-extract-rspack-plugin', pluginSymbol = Symbol.for(PLUGIN_NAME), 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__', getPublicPathForExtract = (publicPath)=>/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(publicPath) ? publicPath : `${ABSOLUTE_PUBLIC_PATH}${publicPath.replace(/\./g, SINGLE_DOT_PATH_SEGMENT)}`;
6
6
  function hotLoader(content, context) {
7
- let localsJsonString = JSON.stringify(JSON.stringify(context.locals)), pluginData = context.loaderContext[pluginSymbol], changeSignal = pluginData?.runtime === !1 ? `\n // ${Date.now()}` : '';
7
+ let pluginData, localsJsonString = JSON.stringify(JSON.stringify(context.locals)), compilation = context.loaderContext._compilation;
8
+ for(; compilation;)pluginData = compilation[pluginSymbol] ?? pluginData, compilation = compilation.compiler?.parentCompilation;
9
+ let changeSignal = pluginData?.runtime === !1 ? `\n // ${Date.now()}` : '';
8
10
  return `${content}
9
11
  if(module.hot) {
10
12
  (function() {
@@ -40,7 +42,7 @@ function hotLoader(content, context) {
40
42
  }
41
43
  `;
42
44
  }
43
- let pitch = function(request, _, data) {
45
+ let pitch = function(request) {
44
46
  let publicPathForExtract;
45
47
  if (this._module && ('css' === this._module.type || 'css/auto' === this._module.type || 'css/global' === this._module.type || 'css/module' === this._module.type)) {
46
48
  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).");
@@ -50,7 +52,7 @@ let pitch = function(request, _, data) {
50
52
  let options = this.getOptions(), emit = void 0 === options.emit || options.emit, callback = this.async(), filepath = this.resourcePath;
51
53
  this.addDependency(filepath);
52
54
  let { publicPath } = this._compilation.outputOptions;
53
- 'string' == typeof options.publicPath ? publicPath = options.publicPath : 'function' == typeof options.publicPath && (publicPath = options.publicPath(this.resourcePath, this.rootContext)), 'auto' === publicPath && (publicPath = AUTO_PUBLIC_PATH), publicPathForExtract = 'string' == typeof publicPath ? /^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(publicPath) ? publicPath : `${ABSOLUTE_PUBLIC_PATH}${publicPath.replace(/\./g, SINGLE_DOT_PATH_SEGMENT)}` : publicPath;
55
+ 'string' == typeof options.publicPath ? publicPath = options.publicPath : 'function' == typeof options.publicPath && (publicPath = options.publicPath(this.resourcePath, this.rootContext)), 'auto' === publicPath && (publicPath = AUTO_PUBLIC_PATH), publicPathForExtract = 'string' == typeof publicPath ? getPublicPathForExtract(publicPath) : 'function' == typeof publicPath ? (pathData, assetInfo)=>getPublicPathForExtract(publicPath(pathData, assetInfo)) : publicPath;
54
56
  let handleExports = (originalExports)=>{
55
57
  let locals, namedExport, esModule = void 0 === options.esModule || options.esModule, dependencies = [];
56
58
  try {
@@ -101,7 +103,7 @@ let pitch = function(request, _, data) {
101
103
  loaderContext: this,
102
104
  options,
103
105
  locals: locals
104
- }) : result, dependencies.length > 0 && this.__internal__setParseMeta(PLUGIN_NAME, JSON.stringify(dependencies)), callback(null, resultSource, void 0, data);
106
+ }) : result, dependencies.length > 0 && this.__internal__setParseMeta(PLUGIN_NAME, JSON.stringify(dependencies)), callback(null, resultSource);
105
107
  };
106
108
  this.importModule(`${this.resourcePath}.rspack[javascript/auto]!=!!!${request}`, {
107
109
  layer: options.layer,
package/dist/exports.d.ts CHANGED
@@ -7,8 +7,8 @@ export type { MultiCompilerOptions, MultiRspackOptions } from './MultiCompiler.j
7
7
  export { MultiCompiler } from './MultiCompiler.js';
8
8
  export { rspackVersion, version };
9
9
  import { RspackOptionsApply } from './rspackOptionsApply.js';
10
- export type { ChunkGroup } from '@ohos-ports/rspack-binding';
11
- export { AsyncDependenciesBlock, Dependency, EntryDependency, } from '@ohos-ports/rspack-binding';
10
+ export type { ChunkGroup } from '@rspack/binding';
11
+ export { AsyncDependenciesBlock, Dependency, EntryDependency, } from '@rspack/binding';
12
12
  export type { Chunk } from './Chunk.js';
13
13
  export { ConcatenatedModule } from './ConcatenatedModule.js';
14
14
  export { ContextModule } from './ContextModule.js';
@@ -34,7 +34,7 @@ export type { ConcatenationArg } from './RuntimeTemplate.js';
34
34
  export { ModuleFilenameHelpers };
35
35
  export declare const WebpackError: ErrorConstructor;
36
36
  export type { Watching } from './Watching.js';
37
- import * as sources from '../compiled/webpack-sources/types.js';
37
+ import * as sources from '../compiled/webpack-sources/index.js';
38
38
  export { sources };
39
39
  import { applyRspackOptionsDefaults, getNormalizedRspackOptions } from './config/index.js';
40
40
  type Config = {
@@ -59,7 +59,7 @@ export { default as EntryOptionPlugin } from './lib/EntryOptionPlugin.js';
59
59
  export { EnvironmentPlugin } from './lib/EnvironmentPlugin.js';
60
60
  export { LoaderOptionsPlugin } from './lib/LoaderOptionsPlugin.js';
61
61
  export { LoaderTargetPlugin } from './lib/LoaderTargetPlugin.js';
62
- export type { OutputFileSystem, WatchFileSystem } from './util/fs.js';
62
+ export type { InputFileSystem, OutputFileSystem, WatchFileSystem, } from './util/fs.js';
63
63
  import { FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, rsc, SubresourceIntegrityPlugin } from './builtin-plugin/index.js';
64
64
  import JsonpTemplatePlugin from './web/JsonpTemplatePlugin.js';
65
65
  export { SubresourceIntegrityPlugin };
@@ -156,7 +156,7 @@ export type { FeatureOptions as LightningcssFeatureOptions, LoaderOptions as Lig
156
156
  export type { SwcLoaderEnvConfig, SwcLoaderEsParserConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderOptions, SwcLoaderParserConfig, SwcLoaderTransformConfig, SwcLoaderTsParserConfig, } from './builtin-loader/swc/index.js';
157
157
  export type { CircularCheckRspackPluginOptions, CircularDependencyRspackPluginOptions, CopyRspackPluginOptions, CssExtractRspackLoaderOptions, CssExtractRspackPluginOptions, EvalDevToolModulePluginOptions, HtmlRspackPluginOptions, LightningCssMinimizerRspackPluginOptions, RsdoctorPluginData, RsdoctorPluginHooks, SourceMapDevToolPluginOptions, SubresourceIntegrityPluginOptions, SwcJsMinimizerRspackPluginOptions, } from './builtin-plugin/index.js';
158
158
  export { CircularCheckRspackPlugin, CircularDependencyRspackPlugin, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, HtmlRspackPlugin, LightningCssMinimizerRspackPlugin, NormalModuleReplacementPlugin, SourceMapDevToolPlugin, SwcJsMinimizerRspackPlugin, } from './builtin-plugin/index.js';
159
- import { EnforceExtension, ResolverFactory, async as resolveAsync, sync as resolveSync } from '@ohos-ports/rspack-binding';
159
+ import { EnforceExtension, ResolverFactory, async as resolveAsync, sync as resolveSync } from '@rspack/binding';
160
160
  import { createNativePlugin } from './builtin-plugin/index.js';
161
161
  import { minify, minifySync, transform, transformSync } from './swc.js';
162
162
  import { VirtualModulesPlugin } from './VirtualModulesPlugin.js';