@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
@@ -7,6 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
+ import type binding from '@rspack/binding';
10
11
  import { AsyncParallelHook, AsyncSeriesBailHook, SyncHook } from '../../compiled/@rspack/lite-tapable/dist/index.js';
11
12
  import type { WebpackError } from './WebpackError.js';
12
13
  export interface Etag {
@@ -15,6 +16,7 @@ export interface Etag {
15
16
  export type CallbackCache<T> = (err?: WebpackError | null, result?: T) => void;
16
17
  type GotHandler<T = any> = (result: T | null, callback: (error: Error | null) => void) => void;
17
18
  export declare class Cache {
19
+ #private;
18
20
  static STAGE_DISK: number;
19
21
  static STAGE_MEMORY: number;
20
22
  static STAGE_DEFAULT: number;
@@ -28,6 +30,7 @@ export declare class Cache {
28
30
  shutdown: AsyncParallelHook<[]>;
29
31
  };
30
32
  constructor();
33
+ static __to_binding(cache: Cache): binding.JsCache;
31
34
  /**
32
35
  * @param identifier the cache identifier
33
36
  * @param etag the etag
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { JsBuildMeta } from '@ohos-ports/rspack-binding';
10
+ import type { JsBuildMeta } from '@rspack/binding';
11
11
  import type { Compiler } from '../Compiler.js';
12
12
  export type DllReferencePluginOptions = {
13
13
  /**
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { DependencyLocation } from '@ohos-ports/rspack-binding';
10
+ import type { DependencyLocation } from '@rspack/binding';
11
11
  import type { Chunk } from '../Chunk.js';
12
12
  import type { Module } from '../Module.js';
13
13
  export declare class WebpackError extends Error {
@@ -1,4 +1,4 @@
1
- import type { JsLoaderContext } from '@ohos-ports/rspack-binding';
1
+ import type { JsLoaderContext } from '@rspack/binding';
2
2
  import { type LoaderDependencies, LoaderDependenciesState } from './dependencies.js';
3
3
  type LoaderCacheContent = string | Uint8Array;
4
4
  export type LoaderCacheEntry = {
@@ -6,13 +6,22 @@ export type LoaderCacheEntry = {
6
6
  sourceMap?: Uint8Array;
7
7
  addedDependencies: LoaderDependencies;
8
8
  removedDependencies: LoaderDependencies;
9
+ parseMeta: Record<string, string>;
10
+ };
11
+ export type WorkerCacheResult = {
12
+ type: 'disabled';
13
+ } | {
14
+ type: 'miss';
15
+ } | {
16
+ type: 'hit';
17
+ entry: LoaderCacheEntry;
9
18
  };
10
19
  export declare class LoaderCache {
11
20
  #private;
12
21
  constructor(context: JsLoaderContext, dependencies: LoaderDependenciesState);
13
22
  get(loaderIndex: number, content: LoaderCacheContent | null | undefined, additionalData: unknown): Promise<LoaderCacheEntry | null | undefined>;
14
23
  store(loaderIndex: number, content: LoaderCacheContent | null | undefined, sourceMap: Uint8Array | undefined, additionalData: unknown): Promise<void>;
15
- workerGet(loaderIndex: number, content: LoaderCacheContent | null | undefined, additionalData: unknown): Promise<LoaderCacheEntry | undefined>;
24
+ workerGet(loaderIndex: number, content: LoaderCacheContent | null | undefined, additionalData: unknown): Promise<WorkerCacheResult>;
16
25
  workerStore(loaderIndex: number, content: LoaderCacheContent | null | undefined, sourceMap: Uint8Array | undefined, additionalData: unknown): Promise<void>;
17
26
  }
18
27
  export {};
@@ -1,10 +1,11 @@
1
- import type { JsLoaderContext } from '@ohos-ports/rspack-binding';
1
+ import type { JsLoaderContext } from '@rspack/binding';
2
2
  export type LoaderDependencies = JsLoaderContext['dependencies'];
3
3
  export declare class LoaderDependenciesState {
4
+ #private;
4
5
  readonly existing: LoaderDependencies;
5
- readonly added: import("@ohos-ports/rspack-binding").JsLoaderDependencies;
6
- readonly removed: import("@ohos-ports/rspack-binding").JsLoaderDependencies;
7
6
  constructor(existing: LoaderDependencies);
7
+ get added(): LoaderDependencies;
8
+ get removed(): LoaderDependencies;
8
9
  resetChanges(): void;
9
10
  mergeChanges(): void;
10
11
  addDependencies(dependencies: LoaderDependencies): void;
@@ -1,4 +1,4 @@
1
- import { type JsLoaderContext, type JsLoaderItem } from '@ohos-ports/rspack-binding';
1
+ import { type JsLoaderContext, type JsLoaderItem } from '@rspack/binding';
2
2
  import type { Compiler } from '../Compiler.js';
3
3
  type LoaderObjectOptions = string | (object & {
4
4
  ident?: unknown;
@@ -55,6 +55,7 @@ export declare enum RequestType {
55
55
  SetCacheable = "SetCacheable",
56
56
  ImportModule = "ImportModule",
57
57
  UpdateLoaderObjects = "UpdateLoaderObjects",
58
+ UpdateBuildInfo = "UpdateBuildInfo",
58
59
  LoaderCacheGet = "LoaderCacheGet",
59
60
  LoaderCacheStore = "LoaderCacheStore",
60
61
  CompilationGetPath = "CompilationGetPath",
@@ -67,8 +68,12 @@ export declare enum RequestSyncType {
67
68
  }
68
69
  export type HandleIncomingRequest = (requestType: RequestType, ...args: any[]) => any;
69
70
  type WorkerArgs = any[];
70
- export type WorkerError = Error;
71
+ export type WorkerError = Error & {
72
+ __internal__isAggregateError?: boolean;
73
+ errors?: unknown;
74
+ };
71
75
  export declare function serializeError(error: unknown): WorkerError;
76
+ export declare function deserializeError(error: WorkerError): WorkerError;
72
77
  export declare const run: (loaderName: string, task: any, options: RunOptions & {
73
78
  handleIncomingRequest: HandleIncomingRequest;
74
79
  }, workerOptions?: {
@@ -1,5 +1,5 @@
1
1
  import { type MessagePort } from 'node:worker_threads';
2
- import { JsLoaderState } from '@ohos-ports/rspack-binding';
2
+ import { JsLoaderState } from '@rspack/binding';
3
3
  import type { LoaderContext } from '../config/index.js';
4
4
  interface WorkerOptions {
5
5
  loaderContext: LoaderContext;
package/dist/l~0.js ADDED
@@ -0,0 +1,34 @@
1
+ var modules = {}, moduleCache = {};
2
+ function rspackRequire(moduleId) {
3
+ var cachedModule = moduleCache[moduleId];
4
+ if (void 0 !== cachedModule) return cachedModule.exports;
5
+ var module = moduleCache[moduleId] = {
6
+ exports: {}
7
+ };
8
+ return modules[moduleId](module, module.exports, rspackRequire), module.exports;
9
+ }
10
+ var moduleFactories = modules, compatGetDefaultExport = (module)=>{
11
+ var getter = module && module.__esModule ? ()=>module.default : ()=>module;
12
+ return definePropertyGetters(getter, {
13
+ a: getter
14
+ }), getter;
15
+ }, definePropertyGetters = (exports, getters, values)=>{
16
+ var define = (defs, kind)=>{
17
+ for(var key in defs)hasOwnProperty(defs, key) && !hasOwnProperty(exports, key) && Object.defineProperty(exports, key, {
18
+ enumerable: !0,
19
+ [kind]: defs[key]
20
+ });
21
+ };
22
+ define(getters, "get"), define(values, "value");
23
+ };
24
+ moduleFactories.add = function(modules) {
25
+ Object.assign(moduleFactories, modules);
26
+ };
27
+ var hasOwnProperty = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), makeNamespaceObject = (exports)=>{
28
+ "u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
29
+ value: 'Module'
30
+ }), Object.defineProperty(exports, '__esModule', {
31
+ value: !0
32
+ });
33
+ };
34
+ export { rspackRequire, moduleFactories, compatGetDefaultExport, definePropertyGetters, makeNamespaceObject };
package/dist/l~3.js ADDED
@@ -0,0 +1,34 @@
1
+ var modules = {}, moduleCache = {};
2
+ function rspackRequire(moduleId) {
3
+ var cachedModule = moduleCache[moduleId];
4
+ if (void 0 !== cachedModule) return cachedModule.exports;
5
+ var module = moduleCache[moduleId] = {
6
+ exports: {}
7
+ };
8
+ return modules[moduleId](module, module.exports, rspackRequire), module.exports;
9
+ }
10
+ var moduleFactories = modules, compatGetDefaultExport = (module)=>{
11
+ var getter = module && module.__esModule ? ()=>module.default : ()=>module;
12
+ return definePropertyGetters(getter, {
13
+ a: getter
14
+ }), getter;
15
+ }, definePropertyGetters = (exports, getters, values)=>{
16
+ var define = (defs, kind)=>{
17
+ for(var key in defs)hasOwnProperty(defs, key) && !hasOwnProperty(exports, key) && Object.defineProperty(exports, key, {
18
+ enumerable: !0,
19
+ [kind]: defs[key]
20
+ });
21
+ };
22
+ define(getters, "get"), define(values, "value");
23
+ };
24
+ moduleFactories.add = function(modules) {
25
+ Object.assign(moduleFactories, modules);
26
+ };
27
+ var hasOwnProperty = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), makeNamespaceObject = (exports)=>{
28
+ "u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
29
+ value: 'Module'
30
+ }), Object.defineProperty(exports, '__esModule', {
31
+ value: !0
32
+ });
33
+ };
34
+ export { rspackRequire, moduleFactories, compatGetDefaultExport, definePropertyGetters, makeNamespaceObject };
@@ -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 NormalizedSharedOptions, type ShareScope } from './SharePlugin.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
  export type ConsumeSharedPluginOptions = {
@@ -1,4 +1,4 @@
1
- import { type BuiltinPlugin, BuiltinPluginName, type RawProvideOptions } from '@ohos-ports/rspack-binding';
1
+ import { type BuiltinPlugin, BuiltinPluginName, type RawProvideOptions } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
3
3
  import type { Compiler } from '../Compiler.js';
4
4
  import type { ShareScope } from './SharePlugin.js';
@@ -2,9 +2,21 @@ import type { Compiler } from '../Compiler.js';
2
2
  export type ShareScope = string | string[];
3
3
  export declare function validateShareScope(shareScope: ShareScope, enhanced: boolean, pluginName: string): void;
4
4
  export type SharePluginOptions = {
5
+ /**
6
+ * Share scope(s) used for modules that do not specify their own `shareScope`.
7
+ * @default 'default'
8
+ */
5
9
  shareScope?: ShareScope;
10
+ /**
11
+ * Modules to consume from a share scope and provide as local fallbacks.
12
+ * Set a module's `import` to `false` to consume it without a local fallback.
13
+ */
6
14
  shared: Shared;
7
- enhanced: boolean;
15
+ /**
16
+ * Whether to generate sharing code for the enhanced Module Federation runtime.
17
+ * @default false
18
+ */
19
+ enhanced?: boolean;
8
20
  };
9
21
  export type Shared = (SharedItem | SharedObject)[] | SharedObject;
10
22
  export type SharedItem = string;
@@ -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
  export declare class ShareRuntimePlugin extends RspackBuiltinPlugin {
@@ -1,4 +1,4 @@
1
- import { type BuiltinPlugin, BuiltinPluginName, type RawSharedContainerPluginOptions } from '@ohos-ports/rspack-binding';
1
+ import { type BuiltinPlugin, BuiltinPluginName, type RawSharedContainerPluginOptions } from '@rspack/binding';
2
2
  import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
3
3
  import type { Compiler } from '../Compiler.js';
4
4
  import type { LibraryOptions } from '../config/index.js';
@@ -1,5 +1,5 @@
1
- import type { BuiltinPlugin } from '@ohos-ports/rspack-binding';
2
- import { BuiltinPluginName } from '@ohos-ports/rspack-binding';
1
+ import type { BuiltinPlugin } from '@rspack/binding';
2
+ import { BuiltinPluginName } from '@rspack/binding';
3
3
  import { RspackBuiltinPlugin } from '../builtin-plugin/base.js';
4
4
  import { type ModuleFederationManifestPluginOptions } from '../container/ModuleFederationManifestPlugin.js';
5
5
  import type { NormalizedSharedOptions } from './SharePlugin.js';
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { JsStats, JsStatsCompilation, JsStatsError } from '@ohos-ports/rspack-binding';
10
+ import type { JsStats, JsStatsCompilation, JsStatsError } from '@rspack/binding';
11
11
  import { HookMap, SyncBailHook, SyncWaterfallHook } from '../../compiled/@rspack/lite-tapable/dist/index.js';
12
12
  import type { Compilation } from '../Compilation.js';
13
13
  import { type GroupConfig } from '../util/smartGrouping.js';
@@ -22,7 +22,7 @@ export type KnownStatsFactoryContext = {
22
22
  };
23
23
  export type StatsFactoryContext = KnownStatsFactoryContext & Record<string, any>;
24
24
  type Hooks = Readonly<{
25
- extract: HookMap<SyncBailHook<[Object, any, StatsFactoryContext], undefined>>;
25
+ extract: HookMap<SyncBailHook<[Record<string, any>, any, StatsFactoryContext], undefined>>;
26
26
  filter: HookMap<SyncBailHook<[any, StatsFactoryContext, number, number], undefined>>;
27
27
  filterSorted: HookMap<SyncBailHook<[any, StatsFactoryContext, number, number], undefined>>;
28
28
  groupResults: HookMap<SyncBailHook<[GroupConfig<any>[], StatsFactoryContext], undefined>>;
@@ -46,7 +46,9 @@ export declare class StatsFactory {
46
46
  hooks: Hooks;
47
47
  private _caches;
48
48
  private _inCreate;
49
+ private _itemTypes;
49
50
  constructor();
51
+ private _getItemTypes;
50
52
  _getAllLevelHooks(hookMap: HookMap<any>, cache: CacheHookMap, type: string): any[];
51
53
  _forEachLevel(hookMap: HookMap<any>, cache: CacheHookMap, type: string, fn: CallFn): any;
52
54
  _forEachLevelWaterfall(hookMap: HookMap<any>, cache: CacheHookMap, type: string, data: any, fn: CallFn): any;
@@ -33,11 +33,11 @@ export declare class StatsPrinter {
33
33
  private _inPrint;
34
34
  hooks: Readonly<{
35
35
  sortElements: HookMap<SyncBailHook<[string[], StatsPrinterContext], true | void>>;
36
- printElements: HookMap<SyncBailHook<[PrintedElement[], StatsPrinterContext], string>>;
37
- sortItems: HookMap<SyncBailHook<[any[], StatsPrinterContext], true>>;
38
- getItemName: HookMap<SyncBailHook<[any, StatsPrinterContext], string>>;
39
- printItems: HookMap<SyncBailHook<[string[], StatsPrinterContext], string>>;
40
- print: HookMap<SyncBailHook<[{}, StatsPrinterContext], string>>;
36
+ printElements: HookMap<SyncBailHook<[PrintedElement[], StatsPrinterContext], string | void>>;
37
+ sortItems: HookMap<SyncBailHook<[any[], StatsPrinterContext], true | void>>;
38
+ getItemName: HookMap<SyncBailHook<[any, StatsPrinterContext], string | void>>;
39
+ printItems: HookMap<SyncBailHook<[string[], StatsPrinterContext], string | void>>;
40
+ print: HookMap<SyncBailHook<[{}, StatsPrinterContext], string | void>>;
41
41
  result: HookMap<SyncWaterfallHook<[string, StatsPrinterContext]>>;
42
42
  }>;
43
43
  constructor();
@@ -1,5 +1,5 @@
1
- import type binding from '@ohos-ports/rspack-binding';
2
- import type { JsOriginRecord } from '@ohos-ports/rspack-binding';
1
+ import type binding from '@rspack/binding';
2
+ import type { JsOriginRecord } from '@rspack/binding';
3
3
  import type { Compilation } from '../Compilation.js';
4
4
  import type { StatsOptions } from '../config/index.js';
5
5
  import type { StatsFactory, StatsFactoryContext } from './StatsFactory.js';
@@ -316,7 +316,7 @@ export declare const spaceLimited: (itemsAndGroups: ItemChildren, max: number, f
316
316
  filteredChildren: any;
317
317
  };
318
318
  export declare const countWithChildren: (compilation: Compilation, getItems: (compilation: Compilation, key: string) => any[]) => number;
319
- export declare const sortByField: (field: string) => ((a1: Object, a2: Object) => number);
319
+ export declare const sortByField: (field: string) => ((a1: Record<string, any>, a2: Record<string, any>) => number);
320
320
  export declare const assetGroup: (children: StatsAsset[]) => {
321
321
  size: number;
322
322
  };
@@ -327,10 +327,9 @@ export declare const moduleGroup: (children: {
327
327
  size: number;
328
328
  sizes: Record<string, number>;
329
329
  };
330
- export declare const mergeToObject: (items: {
331
- [key: string]: any;
330
+ export declare const mergeToObject: <T extends {
332
331
  name: string;
333
- }[]) => Object;
332
+ }>(items: T[]) => Record<string, T>;
334
333
  export declare const errorsSpaceLimit: (errors: StatsError[], max: number) => {
335
334
  errors: StatsError[];
336
335
  filtered: number;
package/dist/swc.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { TransformOutput } from '@ohos-ports/rspack-binding';
1
+ import type { TransformOutput } from '@rspack/binding';
2
2
  import type { JsMinifyOptions, Options as TransformOptions } from '../compiled/@swc/types/index.js';
3
3
  export type { JsMinifyOptions, TransformOptions, TransformOutput };
4
4
  export declare function minify(source: string, options?: JsMinifyOptions): Promise<TransformOutput>;
@@ -1,4 +1,4 @@
1
- import binding from '@ohos-ports/rspack-binding';
1
+ import binding from '@rspack/binding';
2
2
  import type { CreatePartialRegisters } from './types.js';
3
3
  export declare class CodeGenerationResult {
4
4
  #private;
@@ -1,4 +1,4 @@
1
- import type binding from '@ohos-ports/rspack-binding';
1
+ import type binding from '@rspack/binding';
2
2
  import type * as liteTapable from '../../compiled/@rspack/lite-tapable/dist/index.js';
3
3
  import type { Compiler } from '../Compiler.js';
4
4
  type CreateHookMapRegisterTaps = <H extends liteTapable.Hook<any, any, any>>(registerKind: binding.RegisterJsTapKind, getHookMap: () => liteTapable.HookMap<H>, createTap: (queried: liteTapable.QueriedHookMap<H>) => any) => (stages: number[]) => binding.JsTap[];
@@ -1,4 +1,4 @@
1
- import type { RawSplitChunkSizes } from '@ohos-ports/rspack-binding';
1
+ import type { RawSplitChunkSizes } from '@rspack/binding';
2
2
  declare class JsSplitChunkSizes {
3
3
  static __to_binding(sizes?: number | Record<string, number>): number | RawSplitChunkSizes | undefined;
4
4
  }
@@ -0,0 +1,7 @@
1
+ declare function applyIndexedArrayUpdates<T>(source: readonly T[], target: T[], commands: Uint32Array): void;
2
+ declare function swapRemoveArrayElements<T>(array: T[], removedIndices: Uint32Array): void;
3
+ export declare const bindingHelpers: {
4
+ applyIndexedArrayUpdates: typeof applyIndexedArrayUpdates;
5
+ swapRemoveArrayElements: typeof swapRemoveArrayElements;
6
+ };
7
+ export {};
package/dist/util/fs.d.ts CHANGED
@@ -144,15 +144,15 @@ export type ReadFile = {
144
144
  (path: PathOrFileDescriptor, callback: BufferCallback): void;
145
145
  };
146
146
  export type ReadFileSync = {
147
- (path: PathOrFileDescriptor, options: {
148
- encoding: null | undefined;
147
+ (path: PathOrFileDescriptor, options?: {
148
+ encoding?: null | undefined;
149
149
  flag?: string;
150
150
  } | null): Buffer;
151
151
  (path: PathOrFileDescriptor, options: {
152
152
  encoding: BufferEncoding;
153
153
  flag?: string;
154
154
  } | BufferEncoding): string;
155
- (path: PathOrFileDescriptor, options: (ObjectEncodingOptions & {
155
+ (path: PathOrFileDescriptor, options?: (ObjectEncodingOptions & {
156
156
  flag?: string;
157
157
  }) | BufferEncoding | null): string | Buffer;
158
158
  };
@@ -174,9 +174,9 @@ export type Readlink = {
174
174
  (path: PathLike, callback: StringCallback): void;
175
175
  };
176
176
  export type ReadlinkSync = {
177
- (path: PathLike, options: EncodingOption): string;
177
+ (path: PathLike, options?: EncodingOption): string;
178
178
  (path: PathLike, options: BufferEncodingOption): Buffer;
179
- (path: PathLike, options: EncodingOption): string | Buffer;
179
+ (path: PathLike, options?: EncodingOption): string | Buffer;
180
180
  };
181
181
  export type Readdir = {
182
182
  (path: PathLike, options: {
@@ -191,7 +191,7 @@ export type Readdir = {
191
191
  } | 'buffer', callback: ReaddirBufferCallback): void;
192
192
  (path: PathLike, callback: ReaddirStringCallback): void;
193
193
  (path: PathLike, options: (ObjectEncodingOptions & {
194
- withFileTypes: true;
194
+ withFileTypes?: false;
195
195
  recursive?: boolean;
196
196
  }) | BufferEncoding | null | undefined, callback: ReaddirStringOrBufferCallback): void;
197
197
  (path: PathLike, options: ObjectEncodingOptions & {
@@ -200,7 +200,7 @@ export type Readdir = {
200
200
  }, callback: ReaddirDirentCallback): void;
201
201
  };
202
202
  export type ReaddirSync = {
203
- (path: PathLike, options: {
203
+ (path: PathLike, options?: {
204
204
  encoding: BufferEncoding | null;
205
205
  withFileTypes?: false;
206
206
  recursive?: boolean;
@@ -210,7 +210,7 @@ export type ReaddirSync = {
210
210
  withFileTypes?: false;
211
211
  recursive?: boolean;
212
212
  } | 'buffer'): Buffer[];
213
- (path: PathLike, options: (ObjectEncodingOptions & {
213
+ (path: PathLike, options?: (ObjectEncodingOptions & {
214
214
  withFileTypes?: false;
215
215
  recursive?: boolean;
216
216
  }) | BufferEncoding | null): string[] | Buffer[];
@@ -333,7 +333,7 @@ export type Read<TBuffer extends ArrayBufferView = Buffer> = (fd: number, option
333
333
  export type WriteAsyncOptions<TBuffer extends ArrayBufferView = Buffer> = {
334
334
  offset?: number;
335
335
  length?: number;
336
- position?: null | number | bigint;
336
+ position?: null | number;
337
337
  buffer?: TBuffer;
338
338
  };
339
339
  export type Write<TBuffer extends ArrayBufferView = Buffer> = (fd: number, content: Buffer, options: WriteAsyncOptions<TBuffer>, callback: (err: null | NodeJS.ErrnoException, bytesWrite: number, buffer: TBuffer) => void) => void;
@@ -1,6 +1,6 @@
1
- import type { JsSource } from '@ohos-ports/rspack-binding';
2
- import { type Source } from '../../compiled/webpack-sources/types.js';
1
+ import type { JsSource, JsSourceWithLazyMap } from '@rspack/binding';
2
+ import { type Source } from '../../compiled/webpack-sources/index.js';
3
3
  export declare class SourceAdapter {
4
- static fromBinding(source: JsSource): Source;
4
+ static fromBinding(cache: JsSource | JsSourceWithLazyMap): Source;
5
5
  static toBinding(source: Source): JsSource;
6
6
  }
@@ -0,0 +1,7 @@
1
+ import type { WatchFileSystem } from './fs.js';
2
+ type WatchCallback = Parameters<WatchFileSystem['watch']>[5];
3
+ type WatchCallbackArgs = Parameters<WatchCallback>;
4
+ type OptionalTimeInfoWatchCallback = (error: WatchCallbackArgs[0], fileTimeInfoEntries: WatchCallbackArgs[1] | undefined, contextTimeInfoEntries: WatchCallbackArgs[2] | undefined, changedFiles: WatchCallbackArgs[3], removedFiles: WatchCallbackArgs[4]) => void;
5
+ export declare function markInternalCallback(callback: OptionalTimeInfoWatchCallback): OptionalTimeInfoWatchCallback;
6
+ export declare function isInternalCallback(callback: WatchCallback): callback is OptionalTimeInfoWatchCallback;
7
+ export {};