@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
@@ -0,0 +1,39 @@
1
+ export = streamAndGetSourceAndMap;
2
+ /**
3
+ * @param {SourceMaybeWithStreamChunksFunction} inputSource input source
4
+ * @param {Options} options options
5
+ * @param {OnChunk} onChunk on chunk
6
+ * @param {OnSource} onSource on source
7
+ * @param {OnName} onName on name
8
+ * @returns {{ result: GeneratedSourceInfo, source: string, map: RawSourceMap | null }} result
9
+ */
10
+ declare function streamAndGetSourceAndMap(
11
+ inputSource: SourceMaybeWithStreamChunksFunction,
12
+ options: Options,
13
+ onChunk: OnChunk,
14
+ onSource: OnSource,
15
+ onName: OnName,
16
+ ): {
17
+ result: GeneratedSourceInfo;
18
+ source: string;
19
+ map: RawSourceMap | null;
20
+ };
21
+ declare namespace streamAndGetSourceAndMap {
22
+ export {
23
+ RawSourceMap,
24
+ GeneratedSourceInfo,
25
+ OnChunk,
26
+ OnName,
27
+ OnSource,
28
+ Options,
29
+ SourceMaybeWithStreamChunksFunction,
30
+ };
31
+ }
32
+ type RawSourceMap = import("../Source").RawSourceMap;
33
+ type GeneratedSourceInfo = import("./streamChunks").GeneratedSourceInfo;
34
+ type OnChunk = import("./streamChunks").OnChunk;
35
+ type OnName = import("./streamChunks").OnName;
36
+ type OnSource = import("./streamChunks").OnSource;
37
+ type Options = import("./streamChunks").Options;
38
+ type SourceMaybeWithStreamChunksFunction =
39
+ import("./streamChunks").SourceMaybeWithStreamChunksFunction;
@@ -0,0 +1,56 @@
1
+ declare namespace _exports {
2
+ export {
3
+ Source,
4
+ GeneratedSourceInfo,
5
+ OnChunk,
6
+ ScopeBindings,
7
+ OnSource,
8
+ OnName,
9
+ Options,
10
+ StreamChunksFunction,
11
+ SourceMaybeWithStreamChunksFunction,
12
+ };
13
+ }
14
+ declare function _exports(
15
+ source: SourceMaybeWithStreamChunksFunction,
16
+ options: Options,
17
+ onChunk: OnChunk,
18
+ onSource: OnSource,
19
+ onName: OnName,
20
+ ): GeneratedSourceInfo;
21
+ export = _exports;
22
+ type Source = import("../Source");
23
+ type GeneratedSourceInfo =
24
+ import("./getGeneratedSourceInfo").GeneratedSourceInfo;
25
+ type OnChunk = (
26
+ chunk: string | undefined,
27
+ generatedLine: number,
28
+ generatedColumn: number,
29
+ sourceIndex: number,
30
+ originalLine: number,
31
+ originalColumn: number,
32
+ nameIndex: number,
33
+ ) => void;
34
+ type ScopeBindings = Map<string, string>;
35
+ type OnSource = (
36
+ sourceIndex: number,
37
+ source: string | null,
38
+ sourceContent: string | undefined,
39
+ scopeBindings?: ScopeBindings,
40
+ ) => void;
41
+ type OnName = (nameIndex: number, name: string) => void;
42
+ type Options = {
43
+ source?: boolean;
44
+ finalSource?: boolean;
45
+ columns?: boolean;
46
+ scopes?: boolean;
47
+ };
48
+ type StreamChunksFunction = (
49
+ options: Options,
50
+ onChunk: OnChunk,
51
+ onSource: OnSource,
52
+ onName: OnName,
53
+ ) => any;
54
+ type SourceMaybeWithStreamChunksFunction = Source & {
55
+ streamChunks?: StreamChunksFunction;
56
+ };
@@ -0,0 +1,42 @@
1
+ export = streamChunksOfCombinedSourceMap;
2
+ /** @typedef {import("../Source").RawSourceMap} RawSourceMap */
3
+ /** @typedef {import("./getGeneratedSourceInfo").GeneratedSourceInfo} GeneratedSourceInfo */
4
+ /** @typedef {import("./streamChunks").OnChunk} onChunk */
5
+ /** @typedef {import("./streamChunks").OnName} OnName */
6
+ /** @typedef {import("./streamChunks").OnSource} OnSource */
7
+ /**
8
+ * @param {string} source source
9
+ * @param {RawSourceMap} sourceMap source map
10
+ * @param {string} innerSourceName inner source name
11
+ * @param {string} innerSource inner source
12
+ * @param {RawSourceMap} innerSourceMap inner source map
13
+ * @param {boolean | undefined} removeInnerSource do remove inner source
14
+ * @param {onChunk} onChunk on chunk
15
+ * @param {OnSource} onSource on source
16
+ * @param {OnName} onName on name
17
+ * @param {boolean} finalSource finalSource
18
+ * @param {boolean} columns columns
19
+ * @returns {GeneratedSourceInfo} generated source info
20
+ */
21
+ declare function streamChunksOfCombinedSourceMap(
22
+ source: string,
23
+ sourceMap: RawSourceMap,
24
+ innerSourceName: string,
25
+ innerSource: string,
26
+ innerSourceMap: RawSourceMap,
27
+ removeInnerSource: boolean | undefined,
28
+ onChunk: onChunk,
29
+ onSource: OnSource,
30
+ onName: OnName,
31
+ finalSource: boolean,
32
+ columns: boolean,
33
+ ): GeneratedSourceInfo;
34
+ declare namespace streamChunksOfCombinedSourceMap {
35
+ export { RawSourceMap, GeneratedSourceInfo, onChunk, OnName, OnSource };
36
+ }
37
+ type RawSourceMap = import("../Source").RawSourceMap;
38
+ type GeneratedSourceInfo =
39
+ import("./getGeneratedSourceInfo").GeneratedSourceInfo;
40
+ type onChunk = import("./streamChunks").OnChunk;
41
+ type OnName = import("./streamChunks").OnName;
42
+ type OnSource = import("./streamChunks").OnSource;
@@ -0,0 +1,16 @@
1
+ declare namespace _exports {
2
+ export { GeneratedSourceInfo, OnChunk, OnName, OnSource };
3
+ }
4
+ declare function _exports(
5
+ source: string,
6
+ onChunk: OnChunk,
7
+ onSource: OnSource,
8
+ onName: OnName,
9
+ finalSource: boolean,
10
+ ): GeneratedSourceInfo;
11
+ export = _exports;
12
+ type GeneratedSourceInfo =
13
+ import("./getGeneratedSourceInfo").GeneratedSourceInfo;
14
+ type OnChunk = import("./streamChunks").OnChunk;
15
+ type OnName = import("./streamChunks").OnName;
16
+ type OnSource = import("./streamChunks").OnSource;
@@ -0,0 +1,19 @@
1
+ declare namespace _exports {
2
+ export { RawSourceMap, GeneratedSourceInfo, OnChunk, OnName, OnSource };
3
+ }
4
+ declare function _exports(
5
+ source: string,
6
+ sourceMap: RawSourceMap,
7
+ onChunk: OnChunk,
8
+ onSource: OnSource,
9
+ onName: OnName,
10
+ finalSource: boolean,
11
+ columns: boolean,
12
+ ): GeneratedSourceInfo;
13
+ export = _exports;
14
+ type RawSourceMap = import("../Source").RawSourceMap;
15
+ type GeneratedSourceInfo =
16
+ import("./getGeneratedSourceInfo").GeneratedSourceInfo;
17
+ type OnChunk = import("./streamChunks").OnChunk;
18
+ type OnName = import("./streamChunks").OnName;
19
+ type OnSource = import("./streamChunks").OnSource;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Disables the optimization to save both string and buffer in memory. This
3
+ * may increase performance but should reduce memory usage in the Webpack
4
+ * compiler.
5
+ * @returns {void}
6
+ */
7
+ export function disableDualStringBufferCaching(): void;
8
+ /**
9
+ * Enables an optimization to save both string and buffer in memory to avoid
10
+ * repeat conversions between the two formats when they are requested. This
11
+ * is enabled by default. This option can improve performance but can consume
12
+ * additional memory since values are stored twice.
13
+ * @returns {void}
14
+ */
15
+ export function enableDualStringBufferCaching(): void;
16
+ /**
17
+ * Starts a memory optimization to avoid repeat copies of the same string in
18
+ * memory by caching a single reference to the string. This can reduce memory
19
+ * usage if the same string is repeated many times in the compiler, such as
20
+ * when Webpack layers are used with the same files.
21
+ *
22
+ * {@link exitStringInterningRange} should be called when string interning is
23
+ * no longer necessary to free up the memory used by the interned strings. If
24
+ * {@link enterStringInterningRange} has been called multiple times, then
25
+ * this method may not immediately free all the memory until
26
+ * {@link exitStringInterningRange} has been called to end all string
27
+ * interning ranges.
28
+ * @returns {void}
29
+ */
30
+ export function enterStringInterningRange(): void;
31
+ /**
32
+ * Stops the current string interning range. Once all string interning ranges
33
+ * have been exited, this method will free all the memory used by the interned
34
+ * strings. This method should be called once for each time that
35
+ * {@link enterStringInterningRange} was called.
36
+ * @returns {void}
37
+ */
38
+ export function exitStringInterningRange(): void;
39
+ /**
40
+ * Saves the string in a map to ensure that only one copy of the string exists
41
+ * in memory at a given time. This is controlled by {@link enableStringInterning}
42
+ * and {@link disableStringInterning}. Callers are expect to manage the memory
43
+ * of the interned strings by calling {@link disableStringInterning} after the
44
+ * compiler no longer needs to save the interned memory.
45
+ * @param {string} str A string to be interned.
46
+ * @returns {string} The original string or a reference to an existing string of the same value if it has already been interned.
47
+ */
48
+ export function internString(str: string): string;
49
+ /**
50
+ * @returns {boolean} Whether the optimization to cache copies of both the
51
+ * string and buffer version of source content is enabled. This is enabled by
52
+ * default to improve performance but can consume more memory since values are
53
+ * stored twice.
54
+ */
55
+ export function isDualStringBufferCachingEnabled(): boolean;
@@ -0,0 +1,50 @@
1
+ declare namespace _exports {
2
+ export {
3
+ CachedData,
4
+ SourceLike,
5
+ ConcatSourceChild,
6
+ Replacement,
7
+ HashLike,
8
+ MapOptions,
9
+ RawSourceMap,
10
+ SourceAndMap,
11
+ SourceValue,
12
+ GeneratedSourceInfo,
13
+ OnChunk,
14
+ OnName,
15
+ OnSource,
16
+ StreamChunksOptions,
17
+ };
18
+ }
19
+ declare namespace _exports {
20
+ const Source: typeof import("./Source");
21
+ const RawSource: typeof import("./RawSource");
22
+ const OriginalSource: typeof import("./OriginalSource");
23
+ const SourceMapSource: typeof import("./SourceMapSource");
24
+ const CachedSource: typeof import("./CachedSource");
25
+ const ConcatSource: typeof import("./ConcatSource");
26
+ const ReplaceSource: typeof import("./ReplaceSource");
27
+ const PrefixSource: typeof import("./PrefixSource");
28
+ const SizeOnlySource: typeof import("./SizeOnlySource");
29
+ const CompatSource: typeof import("./CompatSource");
30
+ namespace util {
31
+ const scopes: typeof import("./helpers/scopes");
32
+ const stringBufferUtils: typeof import("./helpers/stringBufferUtils");
33
+ }
34
+ }
35
+ export = _exports;
36
+ type CachedData = import("./CachedSource").CachedData;
37
+ type SourceLike = import("./CompatSource").SourceLike;
38
+ type ConcatSourceChild = import("./ConcatSource").Child;
39
+ type Replacement = import("./ReplaceSource").Replacement;
40
+ type HashLike = import("./Source").HashLike;
41
+ type MapOptions = import("./Source").MapOptions;
42
+ type RawSourceMap = import("./Source").RawSourceMap;
43
+ type SourceAndMap = import("./Source").SourceAndMap;
44
+ type SourceValue = import("./Source").SourceValue;
45
+ type GeneratedSourceInfo =
46
+ import("./helpers/getGeneratedSourceInfo").GeneratedSourceInfo;
47
+ type OnChunk = import("./helpers/streamChunks").OnChunk;
48
+ type OnName = import("./helpers/streamChunks").OnName;
49
+ type OnSource = import("./helpers/streamChunks").OnSource;
50
+ type StreamChunksOptions = import("./helpers/streamChunks").Options;
@@ -1,7 +1,7 @@
1
- import binding from '@ohos-ports/rspack-binding';
2
- import type { Source } from '../compiled/webpack-sources/types.js';
1
+ import binding from '@rspack/binding';
2
+ import type { Source } from '../compiled/webpack-sources/index.js';
3
3
  declare const $assets: unique symbol;
4
- declare module '@ohos-ports/rspack-binding' {
4
+ declare module '@rspack/binding' {
5
5
  interface Assets {
6
6
  [$assets]: Record<string, Source>;
7
7
  }
@@ -13,5 +13,7 @@ declare module '@ohos-ports/rspack-binding' {
13
13
  buildDependencies: Set<string>;
14
14
  }
15
15
  }
16
- export type { BuildInfo } from '@ohos-ports/rspack-binding';
16
+ export type { BuildInfo } from '@rspack/binding';
17
17
  export declare const commitCustomFieldsToRust: (buildInfo: binding.BuildInfo) => void;
18
+ export declare const pickCustomBuildInfoFields: (buildInfo: Record<string, unknown> | undefined) => Record<string, unknown>;
19
+ export declare const replaceCustomBuildInfoFields: (buildInfo: Record<string, unknown>, custom: Record<string, unknown>) => void;
package/dist/Chunk.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { type ChunkGroup } from '@ohos-ports/rspack-binding';
1
+ import { type ChunkGroup } from '@rspack/binding';
2
2
  interface ChunkMaps {
3
3
  hash: Record<string | number, string>;
4
4
  contentHash: Record<string | number, Record<string, string>>;
5
5
  name: Record<string | number, string>;
6
6
  }
7
- declare module '@ohos-ports/rspack-binding' {
7
+ declare module '@rspack/binding' {
8
8
  interface Chunk {
9
9
  readonly files: ReadonlySet<string>;
10
10
  readonly runtime: ReadonlySet<string>;
@@ -13,4 +13,4 @@ declare module '@ohos-ports/rspack-binding' {
13
13
  getChunkMaps(realHash: boolean): ChunkMaps;
14
14
  }
15
15
  }
16
- export { Chunk } from '@ohos-ports/rspack-binding';
16
+ export { Chunk } from '@rspack/binding';
@@ -1,9 +1,9 @@
1
1
  import type { RuntimeSpec } from './util/runtime.js';
2
- declare module '@ohos-ports/rspack-binding' {
2
+ declare module '@rspack/binding' {
3
3
  interface ChunkGraph {
4
4
  getModuleChunksIterable(module: Module): Iterable<Chunk>;
5
5
  getOrderedChunkModulesIterable(chunk: Chunk, compareFn: (a: Module, b: Module) => number): Iterable<Module>;
6
6
  getModuleHash(module: Module, runtime: RuntimeSpec): string | null;
7
7
  }
8
8
  }
9
- export { ChunkGraph } from '@ohos-ports/rspack-binding';
9
+ export { ChunkGraph } from '@rspack/binding';
package/dist/Chunks.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Chunks } from '@ohos-ports/rspack-binding';
2
- declare module '@ohos-ports/rspack-binding' {
1
+ import { Chunks } from '@rspack/binding';
2
+ declare module '@rspack/binding' {
3
3
  interface Chunks {
4
4
  [Symbol.iterator](): SetIterator<Chunk>;
5
5
  entries(): SetIterator<[Chunk, Chunk]>;
@@ -1 +1,6 @@
1
- export {};
1
+ import type { Source } from '../compiled/webpack-sources/index.js';
2
+ declare module '@rspack/binding' {
3
+ interface Sources {
4
+ get(sourceType: string): Source | null;
5
+ }
6
+ }
@@ -7,18 +7,18 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { AssetInfo, ChunkGroup, Dependency, ExternalObject, JsCompilation } from '@ohos-ports/rspack-binding';
11
- import binding from '@ohos-ports/rspack-binding';
12
- export type { AssetInfo } from '@ohos-ports/rspack-binding';
10
+ import type { AssetInfo, ChunkGroup, Dependency, ExternalObject, JsCompilation } from '@rspack/binding';
11
+ import binding from '@rspack/binding';
12
+ export type { AssetInfo } from '@rspack/binding';
13
13
  import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.js';
14
- import type { Source } from '../compiled/webpack-sources/types.js';
14
+ import type { Source } from '../compiled/webpack-sources/index.js';
15
15
  import type { EntryOptions, EntryPlugin } from './builtin-plugin/index.js';
16
16
  import './Chunk.js';
17
17
  import type { Chunk } from './Chunk.js';
18
18
  import type { ChunkGraph } from './ChunkGraph.js';
19
19
  import type { Compiler } from './Compiler.js';
20
20
  import type { ContextModuleFactory } from './ContextModuleFactory.js';
21
- import type { Filename, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance, StatsOptions, StatsValue } from './config/index.js';
21
+ import type { Falsy, Filename, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance, StatsOptions, StatsValue } from './config/index.js';
22
22
  import type { Entrypoint } from './Entrypoint.js';
23
23
  import WebpackError from './lib/WebpackError.js';
24
24
  import { Logger } from './logging/Logger.js';
@@ -37,6 +37,7 @@ import type Hash from './util/hash/index.js';
37
37
  import './Chunks.js';
38
38
  import './ChunkGraph.js';
39
39
  import './CodeGenerationResults.js';
40
+ import { type FileSystemDependencies } from './FileSystemDependencies.js';
40
41
  import type { CodeGenerationResult } from './taps/compilation.js';
41
42
  export type Assets = Record<string, Source>;
42
43
  export interface Asset {
@@ -190,7 +191,7 @@ export declare class Compilation {
190
191
  runtimeModule: liteTapable.SyncHook<[RuntimeModule, Chunk]>;
191
192
  seal: liteTapable.SyncHook<[]>;
192
193
  afterSeal: liteTapable.AsyncSeriesHook<[], void>;
193
- needAdditionalPass: liteTapable.SyncBailHook<[], boolean>;
194
+ needAdditionalPass: liteTapable.SyncBailHook<[], boolean | void>;
194
195
  }>;
195
196
  name?: string;
196
197
  startTime?: number;
@@ -262,7 +263,7 @@ export declare class Compilation {
262
263
  * Get an array of Asset
263
264
  */
264
265
  getAssets(): readonly Asset[];
265
- getAsset(name: string): Readonly<Asset> | void;
266
+ getAsset(name: string): Readonly<Asset> | undefined;
266
267
  /**
267
268
  * Note: This is not a webpack public API, maybe removed in future.
268
269
  *
@@ -296,58 +297,18 @@ export declare class Compilation {
296
297
  info: AssetInfo;
297
298
  };
298
299
  getLogger(name: string | (() => string)): Logger;
299
- fileDependencies: {
300
- [Symbol.iterator](): Generator<string, void, unknown>;
301
- has: (dep: string) => boolean;
302
- add: (dep: string) => void;
303
- addAll: (deps: Iterable<string>) => void;
304
- delete: (dep: string) => boolean;
305
- keys(): SetIterator<string>;
306
- values(): SetIterator<string>;
307
- entries(): SetIterator<[string, string]>;
308
- readonly size: number;
309
- };
310
300
  get __internal__addedFileDependencies(): string[];
311
301
  get __internal__removedFileDependencies(): string[];
312
302
  get __internal__addedContextDependencies(): string[];
313
303
  get __internal__removedContextDependencies(): string[];
314
304
  get __internal__addedMissingDependencies(): string[];
315
305
  get __internal__removedMissingDependencies(): string[];
316
- contextDependencies: {
317
- [Symbol.iterator](): Generator<string, void, unknown>;
318
- has: (dep: string) => boolean;
319
- add: (dep: string) => void;
320
- addAll: (deps: Iterable<string>) => void;
321
- delete: (dep: string) => boolean;
322
- keys(): SetIterator<string>;
323
- values(): SetIterator<string>;
324
- entries(): SetIterator<[string, string]>;
325
- readonly size: number;
326
- };
327
- missingDependencies: {
328
- [Symbol.iterator](): Generator<string, void, unknown>;
329
- has: (dep: string) => boolean;
330
- add: (dep: string) => void;
331
- addAll: (deps: Iterable<string>) => void;
332
- delete: (dep: string) => boolean;
333
- keys(): SetIterator<string>;
334
- values(): SetIterator<string>;
335
- entries(): SetIterator<[string, string]>;
336
- readonly size: number;
337
- };
338
- buildDependencies: {
339
- [Symbol.iterator](): Generator<string, void, unknown>;
340
- has: (dep: string) => boolean;
341
- add: (dep: string) => void;
342
- addAll: (deps: Iterable<string>) => void;
343
- delete: (dep: string) => boolean;
344
- keys(): SetIterator<string>;
345
- values(): SetIterator<string>;
346
- entries(): SetIterator<[string, string]>;
347
- readonly size: number;
348
- };
306
+ fileDependencies: FileSystemDependencies;
307
+ contextDependencies: FileSystemDependencies;
308
+ missingDependencies: FileSystemDependencies;
309
+ buildDependencies: FileSystemDependencies;
349
310
  getStats(): Stats;
350
- createChildCompiler(name: string, outputOptions: OutputNormalized, plugins: RspackPluginInstance[]): Compiler;
311
+ createChildCompiler(name: string, outputOptions: OutputNormalized, plugins?: (RspackPluginInstance | Falsy)[]): Compiler;
351
312
  rebuildModule(module: Module, f: (err: Error | null, module: Module | null) => void): void;
352
313
  addRuntimeModule(chunk: Chunk, runtimeModule: RuntimeModule): void;
353
314
  addInclude(context: string, dependency: ReturnType<typeof EntryPlugin.createDependency>, options: EntryOptions, callback: (err?: null | WebpackError, module?: Module) => void): void;
@@ -7,15 +7,15 @@
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 '@ohos-ports/rspack-binding';
10
+ import type binding from '@rspack/binding';
11
11
  import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.js';
12
12
  import type Watchpack from '../compiled/watchpack/index.js';
13
- import type { Source } from '../compiled/webpack-sources/types.js';
13
+ import type { Source } from '../compiled/webpack-sources/index.js';
14
14
  import type { Chunk } from './Chunk.js';
15
15
  import type { CompilationParams } from './Compilation.js';
16
16
  import { Compilation } from './Compilation.js';
17
17
  import { ContextModuleFactory } from './ContextModuleFactory.js';
18
- import type { EntryNormalized, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance } from './config/index.js';
18
+ import type { EntryNormalized, Falsy, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance } from './config/index.js';
19
19
  import type { ExtractedTargetProperties, PlatformTargetProperties } from './config/target.js';
20
20
  import type { FileSystemInfoEntry } from './FileSystemInfo.js';
21
21
  import type { rspack } from './index.js';
@@ -45,7 +45,7 @@ export type CompilerHooks = {
45
45
  normalModuleFactory: liteTapable.SyncHook<NormalModuleFactory>;
46
46
  contextModuleFactory: liteTapable.SyncHook<ContextModuleFactory>;
47
47
  initialize: liteTapable.SyncHook<[]>;
48
- shouldEmit: liteTapable.SyncBailHook<[Compilation], boolean>;
48
+ shouldEmit: liteTapable.SyncBailHook<[Compilation], boolean | void>;
49
49
  /**
50
50
  * Called when infrastructure logging is triggered, allowing plugins to intercept, modify, or handle log messages.
51
51
  * If the hook returns `true`, the default infrastructure logging will be prevented.
@@ -176,7 +176,7 @@ declare class Compiler {
176
176
  * @param plugins - the plugins to apply
177
177
  * @returns a child compiler
178
178
  */
179
- createChildCompiler(compilation: Compilation, compilerName: string, compilerIndex: number, outputOptions: OutputNormalized, plugins: RspackPluginInstance[]): Compiler;
179
+ createChildCompiler(compilation: Compilation, compilerName: string, compilerIndex: number, outputOptions: OutputNormalized, plugins?: (RspackPluginInstance | Falsy)[]): Compiler;
180
180
  isChild(): boolean;
181
181
  /**
182
182
  * Create a compilation and run it, which is the basic method that `compiler.run` and `compiler.watch` depend on.
@@ -1 +1 @@
1
- export { ConcatenatedModule } from '@ohos-ports/rspack-binding';
1
+ export { ConcatenatedModule } from '@rspack/binding';
@@ -1 +1 @@
1
- export { ContextModule } from '@ohos-ports/rspack-binding';
1
+ export { ContextModule } from '@rspack/binding';
@@ -1,7 +1,3 @@
1
- import type { Diagnostics } from '@ohos-ports/rspack-binding';
1
+ import type { Diagnostics } from '@rspack/binding';
2
2
  import type { RspackError } from './RspackError.js';
3
- declare const $proxy: unique symbol;
4
- export declare function createDiagnosticArray(adm: Diagnostics & {
5
- [$proxy]?: RspackError[];
6
- }): RspackError[];
7
- export {};
3
+ export declare function createDiagnosticArray(adm: Diagnostics): RspackError[];
@@ -1,2 +1,2 @@
1
- import type { ChunkGroup } from '@ohos-ports/rspack-binding';
1
+ import type { ChunkGroup } from '@rspack/binding';
2
2
  export type Entrypoint = ChunkGroup;
@@ -1,4 +1,4 @@
1
- import type { JsExportsInfo } from '@ohos-ports/rspack-binding';
1
+ import type { JsExportsInfo } from '@rspack/binding';
2
2
  import type { RuntimeSpec } from './util/runtime.js';
3
3
  /**
4
4
  * Unused: 0
@@ -1,4 +1,4 @@
1
- import binding from '@ohos-ports/rspack-binding';
1
+ import binding from '@rspack/binding';
2
2
  import * as liteTapable from '../compiled/@rspack/lite-tapable/dist/index.js';
3
3
  import type { Chunk } from './Chunk.js';
4
4
  import { type Compilation } from './Compilation.js';
@@ -1,4 +1,4 @@
1
- import type { NodeFsStats, ThreadsafeNodeFS } from '@ohos-ports/rspack-binding';
1
+ import type { NodeFsStats, ThreadsafeNodeFS } from '@rspack/binding';
2
2
  import { type InputFileSystem, type IntermediateFileSystem, type OutputFileSystem } from './util/fs.js';
3
3
  declare class ThreadsafeInputNodeFS implements ThreadsafeNodeFS {
4
4
  writeFile: (name: string, content: Buffer) => Promise<void>;
@@ -10,6 +10,7 @@ declare class ThreadsafeInputNodeFS implements ThreadsafeNodeFS {
10
10
  readFile: (name: string) => Promise<Buffer | string | void>;
11
11
  stat: (name: string) => Promise<NodeFsStats | void>;
12
12
  lstat: (name: string) => Promise<NodeFsStats | void>;
13
+ readlink: (name: string) => Promise<string | void>;
13
14
  chmod?: (name: string, mode: number) => Promise<void>;
14
15
  realpath: (name: string) => Promise<string | void>;
15
16
  open: (name: string, flags: string) => Promise<number | void>;
@@ -34,6 +35,7 @@ declare class ThreadsafeOutputNodeFS implements ThreadsafeNodeFS {
34
35
  readFile: (name: string) => Promise<Buffer | string | void>;
35
36
  stat: (name: string) => Promise<NodeFsStats | void>;
36
37
  lstat: (name: string) => Promise<NodeFsStats | void>;
38
+ readlink: (name: string) => Promise<string | void>;
37
39
  chmod?: (name: string, mode: number) => Promise<void>;
38
40
  realpath: (name: string) => Promise<string | void>;
39
41
  open: (name: string, flags: string) => Promise<number | void>;
@@ -0,0 +1,15 @@
1
+ import type { FileSystemDependencies as BindingFileSystemDependencies } from '@rspack/binding';
2
+ export interface FileSystemDependencies {
3
+ readonly size: number;
4
+ has(value: string): boolean;
5
+ add(value: string): this;
6
+ addAll(deps: Iterable<string>): void;
7
+ delete(value: string): boolean;
8
+ clear(): void;
9
+ keys(): IterableIterator<string>;
10
+ values(): IterableIterator<string>;
11
+ entries(): IterableIterator<[string, string]>;
12
+ [Symbol.iterator](): IterableIterator<string>;
13
+ forEach(callback: (value: string, key: string, set: FileSystemDependencies) => void, thisArg?: unknown): void;
14
+ }
15
+ export declare function createFileSystemDependencies(binding: BindingFileSystemDependencies): FileSystemDependencies;
package/dist/Module.d.ts CHANGED
@@ -1,12 +1,16 @@
1
- import binding, { type AssetInfo } from '@ohos-ports/rspack-binding';
2
- import type { Source } from '../compiled/webpack-sources/types.js';
1
+ import binding, { type AssetInfo } from '@rspack/binding';
2
+ import type { Source } from '../compiled/webpack-sources/index.js';
3
3
  import type { ResourceData } from './Resolver.js';
4
4
  import './BuildInfo.js';
5
5
  export type ResourceDataWithData = ResourceData & {
6
6
  data?: Record<string, any>;
7
7
  };
8
8
  export type ContextInfo = binding.ContextInfo;
9
- export type ResolveData = binding.JsResolveData;
9
+ export type ResolveData = binding.JsResolveData & {
10
+ fileDependencies: string[];
11
+ contextDependencies: string[];
12
+ missingDependencies: string[];
13
+ };
10
14
  export declare class ContextModuleFactoryBeforeResolveData {
11
15
  #private;
12
16
  context: string;
@@ -20,7 +24,7 @@ export declare class ContextModuleFactoryBeforeResolveData {
20
24
  export type ContextModuleFactoryBeforeResolveResult = false | ContextModuleFactoryBeforeResolveData;
21
25
  export declare class ContextModuleFactoryAfterResolveData {
22
26
  #private;
23
- resource: number;
27
+ resource: string;
24
28
  context: string;
25
29
  request: string;
26
30
  regExp: RegExp | undefined;
@@ -31,11 +35,11 @@ export declare class ContextModuleFactoryAfterResolveData {
31
35
  private constructor();
32
36
  }
33
37
  export type ContextModuleFactoryAfterResolveResult = false | ContextModuleFactoryAfterResolveData;
34
- declare module '@ohos-ports/rspack-binding' {
38
+ declare module '@rspack/binding' {
35
39
  interface Module {
36
40
  identifier(): string;
37
41
  originalSource(): Source | null;
38
42
  emitFile(filename: string, source: Source, assetInfo?: AssetInfo): void;
39
43
  }
40
44
  }
41
- export { Module } from '@ohos-ports/rspack-binding';
45
+ export { Module } from '@rspack/binding';