@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.
- package/README.md +9 -0
- package/compiled/@rspack/lite-tapable/dist/index.d.ts +20 -6
- package/compiled/@rspack/lite-tapable/package.json +1 -1
- package/compiled/http-proxy-middleware/index.d.ts +10 -10
- package/compiled/http-proxy-middleware/package.json +1 -1
- package/compiled/open/package.json +1 -1
- package/compiled/tinypool/README.md +4 -4
- package/compiled/tinypool/dist/index.d.ts +3 -2
- package/compiled/tinypool/dist/index.js +3 -3
- package/compiled/tinypool/package.json +1 -1
- package/compiled/watchpack/index.js +276 -49
- package/compiled/watchpack/package.json +1 -1
- package/compiled/watchpack/types/DirectoryWatcher.d.ts +24 -0
- package/compiled/watchpack/types/index.d.ts +1 -1
- package/compiled/watchpack/types/watchEventSource.d.ts +9 -0
- package/compiled/webpack-sources/index.d.ts +61 -0
- package/compiled/webpack-sources/index.js +858 -224
- package/compiled/webpack-sources/package.json +8 -1
- package/compiled/webpack-sources/types/CachedSource.d.ts +192 -0
- package/compiled/webpack-sources/types/CompatSource.d.ts +87 -0
- package/compiled/webpack-sources/types/ConcatSource.d.ts +75 -0
- package/compiled/webpack-sources/types/OriginalSource.d.ts +87 -0
- package/compiled/webpack-sources/types/PrefixSource.d.ts +59 -0
- package/compiled/webpack-sources/types/RawSource.d.ts +75 -0
- package/compiled/webpack-sources/types/ReplaceSource.d.ts +107 -0
- package/compiled/webpack-sources/types/SizeOnlySource.d.ts +24 -0
- package/compiled/webpack-sources/types/Source.d.ts +189 -0
- package/compiled/webpack-sources/types/SourceMapSource.d.ts +136 -0
- package/compiled/webpack-sources/types/helpers/createMappingsSerializer.d.ts +60 -0
- package/compiled/webpack-sources/types/helpers/getFromStreamChunks.d.ts +16 -0
- package/compiled/webpack-sources/types/helpers/getGeneratedSourceInfo.d.ts +31 -0
- package/compiled/webpack-sources/types/helpers/getName.d.ts +15 -0
- package/compiled/webpack-sources/types/helpers/getSource.d.ts +15 -0
- package/compiled/webpack-sources/types/helpers/readMappings.d.ts +19 -0
- package/compiled/webpack-sources/types/helpers/scopes.d.ts +119 -0
- package/compiled/webpack-sources/types/helpers/splitIntoLines.d.ts +6 -0
- package/compiled/webpack-sources/types/helpers/splitIntoPotentialTokens.d.ts +37 -0
- package/compiled/webpack-sources/types/helpers/streamAndGetSourceAndMap.d.ts +39 -0
- package/compiled/webpack-sources/types/helpers/streamChunks.d.ts +56 -0
- package/compiled/webpack-sources/types/helpers/streamChunksOfCombinedSourceMap.d.ts +42 -0
- package/compiled/webpack-sources/types/helpers/streamChunksOfRawSource.d.ts +16 -0
- package/compiled/webpack-sources/types/helpers/streamChunksOfSourceMap.d.ts +19 -0
- package/compiled/webpack-sources/types/helpers/stringBufferUtils.d.ts +55 -0
- package/compiled/webpack-sources/types/index.d.ts +50 -0
- package/dist/BuildInfo.d.ts +13 -4
- package/dist/Chunk.d.ts +3 -3
- package/dist/ChunkGraph.d.ts +2 -2
- package/dist/Chunks.d.ts +2 -2
- package/dist/CodeGenerationResults.d.ts +6 -1
- package/dist/Compilation.d.ts +16 -53
- package/dist/Compiler.d.ts +9 -10
- package/dist/ConcatenatedModule.d.ts +5 -1
- package/dist/ContextModule.d.ts +3 -1
- package/dist/Diagnostics.d.ts +2 -6
- package/dist/Entrypoint.d.ts +1 -1
- package/dist/ExportsInfo.d.ts +1 -1
- package/dist/ExternalModule.d.ts +7 -6
- package/dist/FileSystem.d.ts +3 -1
- package/dist/FileSystemDependencies.d.ts +15 -0
- package/dist/FileSystemInfo.d.ts +1 -0
- package/dist/Module.d.ts +19 -11
- package/dist/ModuleGraph.d.ts +6 -6
- package/dist/ModuleGraphConnection.d.ts +9 -3
- package/dist/Modules.d.ts +3 -0
- package/dist/NativeWatchFileSystem.d.ts +20 -8
- package/dist/NormalModule.d.ts +14 -6
- package/dist/NormalModuleFactory.d.ts +2 -1
- package/dist/Resolver.d.ts +10 -2
- package/dist/ResolverFactory.d.ts +1 -1
- package/dist/RspackError.d.ts +2 -2
- package/dist/RuntimeGlobals.d.ts +4 -3
- package/dist/RuntimeModule.d.ts +1 -1
- package/dist/RuntimeTemplate.d.ts +1 -0
- package/dist/Stats.d.ts +1 -1
- package/dist/builtin-loader/lightningcss/target.d.ts +1 -1
- package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BannerPlugin.d.ts +2 -2
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CaseSensitivePlugin.d.ts +1 -1
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CircularCheckRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CircularModulesInfoPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CompactHashedChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CompactHashedModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +2 -2
- package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssHttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +2 -2
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
- package/dist/builtin-plugin/EsmNodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +2 -2
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +5 -4
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
- package/dist/builtin-plugin/HashedModuleIdsPlugin.d.ts +2 -2
- package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +1 -1
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/HttpUriPlugin.d.ts +5 -1
- package/dist/builtin-plugin/IgnorePlugin.d.ts +2 -2
- package/dist/builtin-plugin/ImportedByDeferModulesPlugin.d.ts +9 -0
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/InlineExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +1 -1
- package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +2 -2
- package/dist/builtin-plugin/ProgressPlugin.d.ts +2 -2
- package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +2 -2
- package/dist/builtin-plugin/RslibPlugin.d.ts +4 -4
- package/dist/builtin-plugin/RstestPlugin.d.ts +2 -2
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +2 -2
- package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +2 -2
- package/dist/builtin-plugin/SplitChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +3 -2
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SyncModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/URLPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WorkerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/base.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/index.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/utils.d.ts +4 -1
- package/dist/builtin-plugin/html-plugin/hooks.d.ts +1 -1
- package/dist/builtin-plugin/html-plugin/plugin.d.ts +2 -2
- package/dist/builtin-plugin/index.d.ts +1 -0
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +3 -3
- package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +1 -1
- package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +1 -1
- package/dist/config/adapter.d.ts +1 -1
- package/dist/config/adapterRuleUse.d.ts +3 -2
- package/dist/config/normalization.d.ts +5 -8
- package/dist/config/target.d.ts +2 -0
- package/dist/config/types.d.ts +104 -19
- package/dist/container/ContainerPlugin.d.ts +1 -1
- package/dist/container/ContainerReferencePlugin.d.ts +1 -1
- package/dist/container/ModuleFederationManifestPlugin.d.ts +1 -1
- package/dist/container/ModuleFederationPluginV1.d.ts +5 -1
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
- package/dist/cssExtractHmr.js +1 -1
- package/dist/cssExtractLoader.js +7 -5
- package/dist/exports.d.ts +7 -7
- package/dist/index.js +1845 -1070
- package/dist/lib/Cache.d.ts +3 -0
- package/dist/lib/DllReferencePlugin.d.ts +1 -1
- package/dist/lib/WebpackError.d.ts +1 -1
- package/dist/loader-runner/codeFilter.d.ts +9 -0
- package/dist/loader-runner/dependencies.d.ts +5 -4
- package/dist/loader-runner/index.d.ts +3 -2
- package/dist/loader-runner/service.d.ts +6 -5
- package/dist/loader-runner/worker.d.ts +5 -2
- package/dist/l~0.js +34 -0
- package/dist/l~3.js +34 -0
- package/dist/node/NodeWatchFileSystem.d.ts +7 -4
- package/dist/sharing/CollectSharedEntryPlugin.d.ts +1 -1
- package/dist/sharing/ConsumeSharedPlugin.d.ts +1 -1
- package/dist/sharing/ProvideSharedPlugin.d.ts +1 -1
- package/dist/sharing/SharePlugin.d.ts +13 -1
- package/dist/sharing/ShareRuntimePlugin.d.ts +1 -1
- package/dist/sharing/SharedContainerPlugin.d.ts +1 -1
- package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +2 -2
- package/dist/sources.d.ts +3 -0
- package/dist/stats/StatsFactory.d.ts +4 -2
- package/dist/stats/StatsPrinter.d.ts +5 -5
- package/dist/stats/statsFactoryUtils.d.ts +12 -6
- package/dist/swc.d.ts +1 -1
- package/dist/taps/compilation.d.ts +1 -1
- package/dist/taps/types.d.ts +1 -1
- package/dist/util/SplitChunkSize.d.ts +1 -1
- package/dist/util/bindingHelpers.d.ts +9 -0
- package/dist/util/createModule.d.ts +3 -0
- package/dist/util/fs.d.ts +22 -16
- package/dist/util/resolveLayerExternals.d.ts +1 -0
- package/dist/util/source.d.ts +13 -4
- package/dist/util/symbols.d.ts +10 -0
- package/dist/util/watchTimeInfo.d.ts +11 -0
- package/dist/worker.js +386 -353
- package/hot/lazy-compilation-node.js +1 -1
- package/hot/lazy-compilation-web.js +1 -1
- package/package.json +8 -32
- package/compiled/webpack-sources/types.d.ts +0 -500
- package/dist/612~0.js +0 -32
- package/dist/612~3.js +0 -32
- package/dist/loader-runner/cache.d.ts +0 -18
- package/dist/util/MergeCaller.d.ts +0 -10
- 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,
|
|
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,
|
|
122
|
-
call(...args: AsArray<T>):
|
|
123
|
-
callStageRange(queried: QueriedHook<T,
|
|
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,
|
|
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,
|
|
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
|
+
{"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?:
|
|
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?:
|
|
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:
|
|
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:
|
|
158
|
-
start?: (req: TReq, res: TRes, target:
|
|
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:
|
|
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,
|
|
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?:
|
|
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.
|
|
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
|
+
{"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)
|
|
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)
|
|
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)
|
|
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)
|
|
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(
|
|
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.
|
|
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",
|