@ohos-ports/rspack-core 2.2.2-beta.0 → 2.3.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/README.md +9 -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/http-proxy-middleware/index.d.ts +10 -10
  5. package/compiled/http-proxy-middleware/package.json +1 -1
  6. package/compiled/open/package.json +1 -1
  7. package/compiled/tinypool/README.md +4 -4
  8. package/compiled/tinypool/dist/index.d.ts +3 -2
  9. package/compiled/tinypool/dist/index.js +3 -3
  10. package/compiled/tinypool/package.json +1 -1
  11. package/compiled/watchpack/index.js +276 -49
  12. package/compiled/watchpack/package.json +1 -1
  13. package/compiled/watchpack/types/DirectoryWatcher.d.ts +24 -0
  14. package/compiled/watchpack/types/index.d.ts +1 -1
  15. package/compiled/watchpack/types/watchEventSource.d.ts +9 -0
  16. package/compiled/webpack-sources/index.d.ts +61 -0
  17. package/compiled/webpack-sources/index.js +858 -224
  18. package/compiled/webpack-sources/package.json +8 -1
  19. package/compiled/webpack-sources/types/CachedSource.d.ts +192 -0
  20. package/compiled/webpack-sources/types/CompatSource.d.ts +87 -0
  21. package/compiled/webpack-sources/types/ConcatSource.d.ts +75 -0
  22. package/compiled/webpack-sources/types/OriginalSource.d.ts +87 -0
  23. package/compiled/webpack-sources/types/PrefixSource.d.ts +59 -0
  24. package/compiled/webpack-sources/types/RawSource.d.ts +75 -0
  25. package/compiled/webpack-sources/types/ReplaceSource.d.ts +107 -0
  26. package/compiled/webpack-sources/types/SizeOnlySource.d.ts +24 -0
  27. package/compiled/webpack-sources/types/Source.d.ts +189 -0
  28. package/compiled/webpack-sources/types/SourceMapSource.d.ts +136 -0
  29. package/compiled/webpack-sources/types/helpers/createMappingsSerializer.d.ts +60 -0
  30. package/compiled/webpack-sources/types/helpers/getFromStreamChunks.d.ts +16 -0
  31. package/compiled/webpack-sources/types/helpers/getGeneratedSourceInfo.d.ts +31 -0
  32. package/compiled/webpack-sources/types/helpers/getName.d.ts +15 -0
  33. package/compiled/webpack-sources/types/helpers/getSource.d.ts +15 -0
  34. package/compiled/webpack-sources/types/helpers/readMappings.d.ts +19 -0
  35. package/compiled/webpack-sources/types/helpers/scopes.d.ts +119 -0
  36. package/compiled/webpack-sources/types/helpers/splitIntoLines.d.ts +6 -0
  37. package/compiled/webpack-sources/types/helpers/splitIntoPotentialTokens.d.ts +37 -0
  38. package/compiled/webpack-sources/types/helpers/streamAndGetSourceAndMap.d.ts +39 -0
  39. package/compiled/webpack-sources/types/helpers/streamChunks.d.ts +56 -0
  40. package/compiled/webpack-sources/types/helpers/streamChunksOfCombinedSourceMap.d.ts +42 -0
  41. package/compiled/webpack-sources/types/helpers/streamChunksOfRawSource.d.ts +16 -0
  42. package/compiled/webpack-sources/types/helpers/streamChunksOfSourceMap.d.ts +19 -0
  43. package/compiled/webpack-sources/types/helpers/stringBufferUtils.d.ts +55 -0
  44. package/compiled/webpack-sources/types/index.d.ts +50 -0
  45. package/dist/BuildInfo.d.ts +13 -4
  46. package/dist/Chunk.d.ts +3 -3
  47. package/dist/ChunkGraph.d.ts +2 -2
  48. package/dist/Chunks.d.ts +2 -2
  49. package/dist/CodeGenerationResults.d.ts +6 -1
  50. package/dist/Compilation.d.ts +16 -53
  51. package/dist/Compiler.d.ts +9 -10
  52. package/dist/ConcatenatedModule.d.ts +5 -1
  53. package/dist/ContextModule.d.ts +3 -1
  54. package/dist/Diagnostics.d.ts +2 -6
  55. package/dist/Entrypoint.d.ts +1 -1
  56. package/dist/ExportsInfo.d.ts +1 -1
  57. package/dist/ExternalModule.d.ts +7 -6
  58. package/dist/FileSystem.d.ts +3 -1
  59. package/dist/FileSystemDependencies.d.ts +15 -0
  60. package/dist/FileSystemInfo.d.ts +1 -0
  61. package/dist/Module.d.ts +19 -11
  62. package/dist/ModuleGraph.d.ts +6 -6
  63. package/dist/ModuleGraphConnection.d.ts +9 -3
  64. package/dist/Modules.d.ts +3 -0
  65. package/dist/NativeWatchFileSystem.d.ts +20 -8
  66. package/dist/NormalModule.d.ts +14 -6
  67. package/dist/NormalModuleFactory.d.ts +2 -1
  68. package/dist/Resolver.d.ts +10 -2
  69. package/dist/ResolverFactory.d.ts +1 -1
  70. package/dist/RspackError.d.ts +2 -2
  71. package/dist/RuntimeGlobals.d.ts +4 -3
  72. package/dist/RuntimeModule.d.ts +1 -1
  73. package/dist/RuntimeTemplate.d.ts +1 -0
  74. package/dist/Stats.d.ts +1 -1
  75. package/dist/builtin-loader/lightningcss/target.d.ts +1 -1
  76. package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
  77. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
  78. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
  79. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
  80. package/dist/builtin-plugin/BannerPlugin.d.ts +2 -2
  81. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
  82. package/dist/builtin-plugin/CaseSensitivePlugin.d.ts +1 -1
  83. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
  84. package/dist/builtin-plugin/CircularCheckRspackPlugin.d.ts +1 -1
  85. package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +1 -1
  86. package/dist/builtin-plugin/CircularModulesInfoPlugin.d.ts +1 -1
  87. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
  88. package/dist/builtin-plugin/CompactHashedChunkIdsPlugin.d.ts +1 -1
  89. package/dist/builtin-plugin/CompactHashedModuleIdsPlugin.d.ts +1 -1
  90. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -1
  91. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +2 -2
  92. package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
  93. package/dist/builtin-plugin/CssHttpExternalsRspackPlugin.d.ts +1 -1
  94. package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
  95. package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
  96. package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
  97. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
  98. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
  99. package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -1
  100. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +2 -2
  101. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
  102. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
  103. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
  104. package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +1 -1
  105. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
  106. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
  107. package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
  108. package/dist/builtin-plugin/EsmNodeTargetPlugin.d.ts +1 -1
  109. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +2 -2
  110. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +5 -4
  111. package/dist/builtin-plugin/ExternalsPlugin.d.ts +1 -1
  112. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
  113. package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
  114. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -1
  115. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
  116. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
  117. package/dist/builtin-plugin/HashedModuleIdsPlugin.d.ts +2 -2
  118. package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +1 -1
  119. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
  120. package/dist/builtin-plugin/HttpUriPlugin.d.ts +5 -1
  121. package/dist/builtin-plugin/IgnorePlugin.d.ts +2 -2
  122. package/dist/builtin-plugin/ImportedByDeferModulesPlugin.d.ts +9 -0
  123. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
  124. package/dist/builtin-plugin/InlineExportsPlugin.d.ts +1 -1
  125. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
  126. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
  127. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
  128. package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -1
  129. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -1
  130. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
  131. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
  132. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
  133. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
  134. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
  135. package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +1 -1
  136. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
  137. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
  138. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
  139. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
  140. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -1
  141. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
  142. package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +1 -1
  143. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +2 -2
  144. package/dist/builtin-plugin/ProgressPlugin.d.ts +2 -2
  145. package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
  146. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
  147. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -1
  148. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
  149. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +2 -2
  150. package/dist/builtin-plugin/RslibPlugin.d.ts +4 -4
  151. package/dist/builtin-plugin/RstestPlugin.d.ts +2 -2
  152. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +2 -2
  153. package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
  154. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
  155. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
  156. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +2 -2
  157. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +1 -1
  158. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +3 -2
  159. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
  160. package/dist/builtin-plugin/SyncModuleIdsPlugin.d.ts +1 -1
  161. package/dist/builtin-plugin/URLPlugin.d.ts +1 -1
  162. package/dist/builtin-plugin/WorkerPlugin.d.ts +1 -1
  163. package/dist/builtin-plugin/base.d.ts +1 -1
  164. package/dist/builtin-plugin/css-extract/index.d.ts +1 -1
  165. package/dist/builtin-plugin/css-extract/utils.d.ts +4 -1
  166. package/dist/builtin-plugin/html-plugin/hooks.d.ts +1 -1
  167. package/dist/builtin-plugin/html-plugin/plugin.d.ts +2 -2
  168. package/dist/builtin-plugin/index.d.ts +1 -0
  169. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +3 -3
  170. package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +1 -1
  171. package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +1 -1
  172. package/dist/config/adapter.d.ts +1 -1
  173. package/dist/config/adapterRuleUse.d.ts +3 -2
  174. package/dist/config/normalization.d.ts +5 -8
  175. package/dist/config/target.d.ts +2 -0
  176. package/dist/config/types.d.ts +104 -19
  177. package/dist/container/ContainerPlugin.d.ts +1 -1
  178. package/dist/container/ContainerReferencePlugin.d.ts +1 -1
  179. package/dist/container/ModuleFederationManifestPlugin.d.ts +1 -1
  180. package/dist/container/ModuleFederationPluginV1.d.ts +5 -1
  181. package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
  182. package/dist/cssExtractHmr.js +1 -1
  183. package/dist/cssExtractLoader.js +7 -5
  184. package/dist/exports.d.ts +7 -7
  185. package/dist/index.js +1845 -1070
  186. package/dist/lib/Cache.d.ts +3 -0
  187. package/dist/lib/DllReferencePlugin.d.ts +1 -1
  188. package/dist/lib/WebpackError.d.ts +1 -1
  189. package/dist/loader-runner/codeFilter.d.ts +9 -0
  190. package/dist/loader-runner/dependencies.d.ts +5 -4
  191. package/dist/loader-runner/index.d.ts +3 -2
  192. package/dist/loader-runner/service.d.ts +6 -5
  193. package/dist/loader-runner/worker.d.ts +5 -2
  194. package/dist/l~0.js +34 -0
  195. package/dist/l~3.js +34 -0
  196. package/dist/node/NodeWatchFileSystem.d.ts +7 -4
  197. package/dist/sharing/CollectSharedEntryPlugin.d.ts +1 -1
  198. package/dist/sharing/ConsumeSharedPlugin.d.ts +1 -1
  199. package/dist/sharing/ProvideSharedPlugin.d.ts +1 -1
  200. package/dist/sharing/SharePlugin.d.ts +13 -1
  201. package/dist/sharing/ShareRuntimePlugin.d.ts +1 -1
  202. package/dist/sharing/SharedContainerPlugin.d.ts +1 -1
  203. package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +2 -2
  204. package/dist/sources.d.ts +3 -0
  205. package/dist/stats/StatsFactory.d.ts +4 -2
  206. package/dist/stats/StatsPrinter.d.ts +5 -5
  207. package/dist/stats/statsFactoryUtils.d.ts +12 -6
  208. package/dist/swc.d.ts +1 -1
  209. package/dist/taps/compilation.d.ts +1 -1
  210. package/dist/taps/types.d.ts +1 -1
  211. package/dist/util/SplitChunkSize.d.ts +1 -1
  212. package/dist/util/bindingHelpers.d.ts +9 -0
  213. package/dist/util/createModule.d.ts +3 -0
  214. package/dist/util/fs.d.ts +22 -16
  215. package/dist/util/resolveLayerExternals.d.ts +1 -0
  216. package/dist/util/source.d.ts +13 -4
  217. package/dist/util/symbols.d.ts +10 -0
  218. package/dist/util/watchTimeInfo.d.ts +11 -0
  219. package/dist/worker.js +386 -353
  220. package/hot/lazy-compilation-node.js +1 -1
  221. package/hot/lazy-compilation-web.js +1 -1
  222. package/package.json +8 -32
  223. package/compiled/webpack-sources/types.d.ts +0 -500
  224. package/dist/612~0.js +0 -32
  225. package/dist/612~3.js +0 -32
  226. package/dist/loader-runner/cache.d.ts +0 -18
  227. package/dist/util/MergeCaller.d.ts +0 -10
  228. package/dist/util/fake.d.ts +0 -11
package/README.md CHANGED
@@ -13,3 +13,12 @@ See <https://rspack.rs> for details.
13
13
  ## License
14
14
 
15
15
  Rspack is [MIT licensed](https://github.com/web-infra-dev/rspack/blob/main/LICENSE).
16
+
17
+ ## OpenHarmony port
18
+
19
+ `@ohos-ports` distribution of `@rspack/core@2.3.2`. The bundled dist code's
20
+ `@rspack/binding` references are rewritten to `@ohos-ports/rspack-binding`
21
+ (dependency `"@ohos-ports/rspack-binding": "2.3.2-beta.0"`), whose loader
22
+ probes the OpenHarmony arm64 native binary slot
23
+ `@ohos-ports/rspack-binding-openharmony-arm64` (compiled from rspack v2.3.2
24
+ Rust source for `aarch64-unknown-linux-ohos`, signed).
@@ -61,11 +61,17 @@ export interface Hook<T = any, R = any, AdditionalOptions = UnsetAdditionalOptio
61
61
  withOptions(opt: TapOptions & IfSet<AdditionalOptions>): Hook<T, R, AdditionalOptions>;
62
62
  queryStageRange(stageRange: StageRange): QueriedHook<T, R, AdditionalOptions>;
63
63
  }
64
+ type AllStageTaps<Tap> = {
65
+ source: Tap[];
66
+ length: number;
67
+ taps: Tap[];
68
+ };
64
69
  export declare class HookBase<T, R, AdditionalOptions = UnsetAdditionalOptions> implements Hook<T, R, AdditionalOptions> {
65
70
  args: ArgumentNames<AsArray<T>>;
66
71
  name?: string;
67
72
  taps: (FullTap & IfSet<AdditionalOptions>)[];
68
73
  interceptors: HookInterceptor<T, R, AdditionalOptions>[];
74
+ _allStageTaps: AllStageTaps<FullTap & IfSet<AdditionalOptions>> | undefined;
69
75
  constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
70
76
  intercept(interceptor: HookInterceptor<T, R, AdditionalOptions>): void;
71
77
  _runRegisterInterceptors(options: FullTap & IfSet<AdditionalOptions>): FullTap & IfSet<AdditionalOptions>;
@@ -86,6 +92,14 @@ export declare class HookBase<T, R, AdditionalOptions = UnsetAdditionalOptions>
86
92
  tapPromise(options: Options<AdditionalOptions>, fn: FnPromise<T, R>): void;
87
93
  _tap(type: 'sync' | 'async' | 'promise', options: Options<AdditionalOptions>, fn: TapFunction): void;
88
94
  _insert(item: FullTap & IfSet<AdditionalOptions>): void;
95
+ /**
96
+ * The taps `queryStageRange(allStageRange)` would select, reused across calls.
97
+ *
98
+ * `tap()` always grows `this.taps`, and code that replaces or splices it changes its
99
+ * identity or length, so both are checked. An interceptor's `register` rewrites taps in
100
+ * place, but hooks with interceptors never take the path that reads this.
101
+ */
102
+ _tapsInAllStages(): (FullTap & IfSet<AdditionalOptions>)[];
89
103
  _prepareArgs(args: AsArray<T>): (T | undefined)[];
90
104
  }
91
105
  export type StageRange = readonly [number, number];
@@ -116,11 +130,11 @@ export declare class SyncBailHook<T, R, AdditionalOptions = UnsetAdditionalOptio
116
130
  tapAsync(): never;
117
131
  tapPromise(): never;
118
132
  }
119
- export declare class SyncWaterfallHook<T, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, AsArray<T>[0], AdditionalOptions> {
133
+ export declare class SyncWaterfallHook<T, R = AsArray<T>[0], AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, R, AdditionalOptions> {
120
134
  constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
121
- callAsyncStageRange(queried: QueriedHook<T, AsArray<T>[0], AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, AsArray<T>[0]>>): void;
122
- call(...args: AsArray<T>): AsArray<T>[0];
123
- callStageRange(queried: QueriedHook<T, AsArray<T>[0], AdditionalOptions>, ...args: AsArray<T>): AsArray<T>[0];
135
+ callAsyncStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, R>>): void;
136
+ call(...args: AsArray<T>): R;
137
+ callStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: AsArray<T>): R;
124
138
  tapAsync(): never;
125
139
  tapPromise(): never;
126
140
  }
@@ -133,9 +147,9 @@ export declare class AsyncSeriesHook<T, AdditionalOptions = UnsetAdditionalOptio
133
147
  export declare class AsyncSeriesBailHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, R, AdditionalOptions> {
134
148
  callAsyncStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, R>>): void;
135
149
  }
136
- export declare class AsyncSeriesWaterfallHook<T, AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, AsArray<T>[0], AdditionalOptions> {
150
+ export declare class AsyncSeriesWaterfallHook<T, R = AsArray<T>[0], AdditionalOptions = UnsetAdditionalOptions> extends HookBase<T, R, AdditionalOptions> {
137
151
  constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
138
- callAsyncStageRange(queried: QueriedHook<T, AsArray<T>[0], AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, AsArray<T>[0]>>): void;
152
+ callAsyncStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, R>>): void;
139
153
  }
140
154
  export type HookMapKey = any;
141
155
  export type HookFactory<H> = (key: HookMapKey, hook?: H) => H;
@@ -1 +1 @@
1
- {"name":"@rspack/lite-tapable","version":"1.1.5","license":"MIT","types":"./dist/index.d.ts","type":"module"}
1
+ {"name":"@rspack/lite-tapable","version":"1.3.0","license":"MIT","types":"./dist/index.d.ts","type":"module"}
@@ -136,7 +136,7 @@ declare class ProxyServer<Req extends http__default.IncomingMessage | http2.Http
136
136
  * https://github.com/DefinitelyTyped/DefinitelyTyped/blob/6f529c6c67a447190f86bfbf894d1061e41e07b7/types/http-proxy-middleware/index.d.ts
137
137
  */
138
138
 
139
- type NextFunction<T = (err?: any) => void> = T;
139
+ type NextFunction<T = (err?: unknown) => void> = T;
140
140
  interface RequestHandler<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse, TNext = NextFunction> {
141
141
  (req: TReq, res: TRes, next?: TNext): Promise<void>;
142
142
  upgrade: (req: TReq, socket: net.Socket, head: Buffer) => void;
@@ -149,15 +149,15 @@ interface Plugin<TReq extends http.IncomingMessage = http.IncomingMessage, TRes
149
149
  (proxyServer: ProxyServer<TReq, TRes>, options: Options<TReq, TRes>): void;
150
150
  }
151
151
  interface OnProxyEvent<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse> {
152
- error?: (err: Error, req: TReq, res: TRes | net.Socket, target?: string | Partial<URL>) => void;
152
+ error?: (err: Error, req: TReq, res: TRes | net.Socket, target?: ProxyTarget) => void;
153
153
  proxyReq?: (proxyReq: http.ClientRequest, req: TReq, res: TRes, options: ProxyServerOptions) => void;
154
- proxyReqWs?: (proxyReq: http.ClientRequest, req: TReq, socket: net.Socket, options: ProxyServerOptions, head: any) => void;
154
+ proxyReqWs?: (proxyReq: http.ClientRequest, req: TReq, socket: net.Socket, options: ProxyServerOptions, head: Buffer) => void;
155
155
  proxyRes?: (proxyRes: TReq, req: TReq, res: TRes) => void | Promise<void>;
156
156
  open?: (proxySocket: net.Socket) => void;
157
- close?: (proxyRes: TReq, proxySocket: net.Socket, proxyHead: any) => void;
158
- start?: (req: TReq, res: TRes, target: string | Partial<URL>) => void;
157
+ close?: (proxyRes: TReq, proxySocket: net.Socket, proxyHead: Buffer) => void;
158
+ start?: (req: TReq, res: TRes, target: ProxyTarget) => void;
159
159
  end?: (req: TReq, res: TRes, proxyRes: TReq) => void;
160
- econnreset?: (err: Error, req: TReq, res: TRes, target: string | Partial<URL>) => void;
160
+ econnreset?: (err: Error, req: TReq, res: TRes, target: ProxyTarget) => void;
161
161
  }
162
162
  type Logger = Pick<Console, 'info' | 'warn' | 'error'>;
163
163
  type PathRewriteConfig<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse> = {
@@ -254,7 +254,7 @@ interface Options<TReq extends http.IncomingMessage = http.IncomingMessage, TRes
254
254
  *
255
255
  * @link https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/router.md
256
256
  */
257
- router?: Record<string, ProxyServerOptions['target']> | ((req: TReq, res: TRes | undefined, options: Options<TReq, TRes>) => ProxyServerOptions['target']) | ((req: TReq, res: TRes | undefined, options: Options<TReq, TRes>) => Promise<ProxyServerOptions['target']>);
257
+ router?: Record<string, ProxyTarget> | ((req: TReq, res: TRes | undefined, options: Options<TReq, TRes>) => ProxyTarget) | ((req: TReq, res: TRes | undefined, options: Options<TReq, TRes>) => Promise<ProxyTarget>);
258
258
  /**
259
259
  * Log information from http-proxy-middleware
260
260
  * @example
@@ -345,7 +345,7 @@ interface Options<TReq extends http.IncomingMessage = http.IncomingMessage, TRes
345
345
  * @see https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/pathRewrite.md
346
346
  * @see https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/response-interceptor.md
347
347
  */
348
- declare function createProxyMiddleware<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse, TNext = NextFunction>(options: Options<TReq, TRes>): RequestHandler<TReq, TRes, TNext>;
348
+ declare function createProxyMiddleware<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse, TNext extends (err?: unknown) => void = NextFunction>(options: Options<TReq, TRes>): RequestHandler<TReq, TRes, TNext>;
349
349
 
350
350
  type Interceptor<TReq = http.IncomingMessage, TRes = http.ServerResponse> = (buffer: Buffer, proxyRes: http.IncomingMessage, req: TReq, res: TRes) => Promise<Buffer | string>;
351
351
  /**
@@ -373,8 +373,8 @@ type Interceptor<TReq = http.IncomingMessage, TRes = http.ServerResponse> = (buf
373
373
  */
374
374
  declare function responseInterceptor<TReq extends http.IncomingMessage = http.IncomingMessage, TRes extends http.ServerResponse = http.ServerResponse>(interceptor: Interceptor<TReq, TRes>): (proxyRes: http.IncomingMessage, req: TReq, res: TRes) => Promise<void>;
375
375
 
376
- type BodyParserLikeRequest = http.IncomingMessage & {
377
- body?: any;
376
+ type BodyParserLikeRequest<TBody = unknown> = http.IncomingMessage & {
377
+ body?: TBody;
378
378
  };
379
379
  /**
380
380
  * Fix proxied body if bodyParser is involved.
@@ -1 +1 @@
1
- {"name":"http-proxy-middleware","author":"Steven Chim","version":"4.2.0","license":"MIT","types":"index.d.ts","type":"module"}
1
+ {"name":"http-proxy-middleware","author":"Steven Chim","version":"4.2.1","license":"MIT","types":"index.d.ts","type":"module"}
@@ -1 +1 @@
1
- {"name":"open","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"version":"11.0.1","funding":"https://github.com/sponsors/sindresorhus","license":"MIT","types":"index.d.ts","type":"module"}
1
+ {"name":"open","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"version":"11.0.4","funding":"https://github.com/sponsors/sindresorhus","license":"MIT","types":"index.d.ts","type":"module"}
@@ -27,7 +27,7 @@ _In case you need more tiny libraries like tinypool or tinyspy, please consider
27
27
  import Tinypool from 'tinypool'
28
28
 
29
29
  const pool = new Tinypool({
30
- filename: new URL('./worker.mjs', import.meta.url).href,
30
+ filename: new URL('./worker.mjs', import.meta.url),
31
31
  })
32
32
  const result = await pool.run({ a: 4, b: 6 })
33
33
  console.log(result) // Prints 10
@@ -55,7 +55,7 @@ import Tinypool from 'tinypool'
55
55
  import { MessageChannel } from 'node:worker_threads'
56
56
 
57
57
  const pool = new Tinypool({
58
- filename: new URL('./worker.mjs', import.meta.url).href,
58
+ filename: new URL('./worker.mjs', import.meta.url),
59
59
  })
60
60
  const { port1, port2 } = new MessageChannel()
61
61
  const promise = pool.run({ port: port1 }, { transferList: [port1] })
@@ -98,7 +98,7 @@ import Tinypool from 'tinypool'
98
98
 
99
99
  const pool = new Tinypool({
100
100
  runtime: 'child_process',
101
- filename: new URL('./worker.mjs', import.meta.url).href,
101
+ filename: new URL('./worker.mjs', import.meta.url),
102
102
  })
103
103
  const result = await pool.run({ a: 4, b: 6 })
104
104
  console.log(result) // Prints 10
@@ -124,7 +124,7 @@ import Tinypool from 'tinypool'
124
124
 
125
125
  const pool = new Tinypool({
126
126
  runtime: 'child_process',
127
- filename: new URL('./worker.mjs', import.meta.url).href,
127
+ filename: new URL('./worker.mjs', import.meta.url),
128
128
  })
129
129
 
130
130
  const messages = []
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { MessagePort, TransferListItem } from "node:worker_threads";
3
3
  import { EventEmitterAsyncResource } from "node:events";
4
+ import { URL } from "node:url";
4
5
  import { SerializationType } from "node:child_process";
5
6
 
6
7
  //#region src/common.d.ts
@@ -127,7 +128,7 @@ type ResourceLimits = Worker extends {
127
128
  resourceLimits?: infer T;
128
129
  } ? T : object;
129
130
  interface Options {
130
- filename?: string | null;
131
+ filename?: string | URL | null;
131
132
  runtime?: 'worker_threads' | 'child_process';
132
133
  name?: string;
133
134
  minThreads?: number;
@@ -164,7 +165,7 @@ interface FilledOptions extends Options {
164
165
  interface RunOptions {
165
166
  transferList?: TransferList;
166
167
  channel?: TinypoolChannel;
167
- filename?: string | null;
168
+ filename?: string | URL | null;
168
169
  signal?: AbortSignalAny | null;
169
170
  name?: string | null;
170
171
  runtime?: Options['runtime'];
@@ -3,7 +3,6 @@ import { MessageChannel, MessagePort, Worker, receiveMessageOnPort } from "node:
3
3
  import { EventEmitterAsyncResource, once } from "node:events";
4
4
  import { AsyncResource } from "node:async_hooks";
5
5
  import { URL, fileURLToPath } from "node:url";
6
- import { join } from "node:path";
7
6
  import { inspect, types } from "node:util";
8
7
  import assert from "node:assert";
9
8
  import { performance } from "node:perf_hooks";
@@ -238,6 +237,7 @@ var ArrayBufferViewTransferable = class {
238
237
  };
239
238
  let taskIdCounter = 0;
240
239
  function maybeFileURLToPath(filename) {
240
+ if (typeof filename !== "string") return filename.protocol === "file:" ? fileURLToPath(filename) : filename.href;
241
241
  return filename.startsWith("file:") ? fileURLToPath(new URL(filename)) : filename;
242
242
  }
243
243
  var TaskInfo = class extends AsyncResource {
@@ -598,7 +598,7 @@ var ThreadPool = class {
598
598
  const { transferList = [], signal = null, channel } = options;
599
599
  if (filename == null) filename = this.options.filename;
600
600
  if (name == null) name = this.options.name;
601
- if (typeof filename !== "string") return Promise.reject(Errors.FilenameNotProvided());
601
+ if (typeof filename !== "string" && !(filename instanceof URL)) return Promise.reject(Errors.FilenameNotProvided());
602
602
  filename = maybeFileURLToPath(filename);
603
603
  let resolve;
604
604
  let reject;
@@ -756,7 +756,7 @@ var Tinypool = class extends EventEmitterAsyncResource {
756
756
  return process.__tinypool_state__?.workerData || void 0;
757
757
  }
758
758
  static get version() {
759
- const { version } = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8"));
759
+ const { version } = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
760
760
  return version;
761
761
  }
762
762
  static move(val) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tinypool",
3
3
  "type": "module",
4
- "version": "2.1.2",
4
+ "version": "2.2.0",
5
5
  "description": "A minimal and tiny Node.js Worker Thread Pool implementation, a fork of piscina, but with fewer features",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/tinylibs/tinypool#readme",