@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.
- package/README.md +10 -0
- package/compiled/@rspack/lite-tapable/dist/index.d.ts +20 -6
- package/compiled/@rspack/lite-tapable/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/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 +6 -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 +13 -52
- package/dist/Compiler.d.ts +5 -5
- package/dist/ConcatenatedModule.d.ts +1 -1
- package/dist/ContextModule.d.ts +1 -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 +1 -1
- package/dist/FileSystem.d.ts +3 -1
- package/dist/FileSystemDependencies.d.ts +15 -0
- package/dist/Module.d.ts +10 -6
- package/dist/ModuleGraph.d.ts +6 -6
- package/dist/ModuleGraphConnection.d.ts +1 -1
- package/dist/Modules.d.ts +3 -0
- package/dist/NativeWatchFileSystem.d.ts +1 -1
- package/dist/NormalModule.d.ts +2 -2
- 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/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 +2 -2
- 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/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 +2 -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/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 +6 -9
- package/dist/config/types.d.ts +79 -16
- 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/cssExtractLoader.js +7 -5
- package/dist/exports.d.ts +5 -5
- package/dist/index.js +885 -408
- 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/cache.d.ts +11 -2
- package/dist/loader-runner/dependencies.d.ts +4 -3
- package/dist/loader-runner/index.d.ts +1 -1
- package/dist/loader-runner/service.d.ts +6 -1
- package/dist/loader-runner/worker.d.ts +1 -1
- package/dist/l~0.js +34 -0
- package/dist/l~3.js +34 -0
- 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/stats/StatsFactory.d.ts +4 -2
- package/dist/stats/StatsPrinter.d.ts +5 -5
- package/dist/stats/statsFactoryUtils.d.ts +5 -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 +7 -0
- package/dist/util/fs.d.ts +9 -9
- package/dist/util/source.d.ts +3 -3
- package/dist/util/watchTimeInfo.d.ts +7 -0
- package/dist/worker.js +78 -43
- 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/util/MergeCaller.d.ts +0 -10
- package/dist/util/fake.d.ts +0 -11
package/README.md
CHANGED
|
@@ -13,3 +13,13 @@ 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.2.9`. Identical JS content;
|
|
20
|
+
the `@rspack/binding` dependency is aliased to `@ohos-ports/rspack-binding`
|
|
21
|
+
(`"@rspack/binding": "npm:@ohos-ports/rspack-binding@2.2.9-beta.0"`), so the
|
|
22
|
+
bundled dist code's `require('@rspack/binding')` transparently resolves to
|
|
23
|
+
the ported loader, which probes the OpenHarmony arm64 native binary slot
|
|
24
|
+
`@ohos-ports/rspack-binding-openharmony-arm64` (compiled from rspack v2.2.9
|
|
25
|
+
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"}
|
|
@@ -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",
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public type entry point of `webpack-sources`.
|
|
3
|
+
*
|
|
4
|
+
* The declarations under `types/` are generated from the JSDoc in `lib/` by
|
|
5
|
+
* `npm run build:types`; don't edit them by hand. This file re-exports them in
|
|
6
|
+
* the package's public shape: every class is available as both a value and a
|
|
7
|
+
* type, next to the public helper types.
|
|
8
|
+
*
|
|
9
|
+
* TODO: remove this file in the next major release and point `types` in
|
|
10
|
+
* `package.json` at the generated `types/index.d.ts`. That requires the
|
|
11
|
+
* exports in `lib/index.js` to be typed so the classes are exported as types
|
|
12
|
+
* too (e.g. `Source` usable in `let source: Source`), which is a breaking
|
|
13
|
+
* change for the shape of the public types.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import CachedSource = require("./types/CachedSource");
|
|
17
|
+
import CompatSource = require("./types/CompatSource");
|
|
18
|
+
import ConcatSource = require("./types/ConcatSource");
|
|
19
|
+
import OriginalSource = require("./types/OriginalSource");
|
|
20
|
+
import PrefixSource = require("./types/PrefixSource");
|
|
21
|
+
import RawSource = require("./types/RawSource");
|
|
22
|
+
import ReplaceSource = require("./types/ReplaceSource");
|
|
23
|
+
import SizeOnlySource = require("./types/SizeOnlySource");
|
|
24
|
+
import Source = require("./types/Source");
|
|
25
|
+
import SourceMapSource = require("./types/SourceMapSource");
|
|
26
|
+
import GetGeneratedSourceInfo = require("./types/helpers/getGeneratedSourceInfo");
|
|
27
|
+
import Scopes = require("./types/helpers/scopes");
|
|
28
|
+
import StreamChunks = require("./types/helpers/streamChunks");
|
|
29
|
+
import StringBufferUtils = require("./types/helpers/stringBufferUtils");
|
|
30
|
+
|
|
31
|
+
export namespace util {
|
|
32
|
+
export import scopes = Scopes;
|
|
33
|
+
export import stringBufferUtils = StringBufferUtils;
|
|
34
|
+
}
|
|
35
|
+
export type OnChunk = StreamChunks.OnChunk;
|
|
36
|
+
export type OnName = StreamChunks.OnName;
|
|
37
|
+
export type OnSource = StreamChunks.OnSource;
|
|
38
|
+
export type CachedData = CachedSource.CachedData;
|
|
39
|
+
export type SourceLike = CompatSource.SourceLike;
|
|
40
|
+
export type ConcatSourceChild = ConcatSource.Child;
|
|
41
|
+
export import Replacement = ReplaceSource.Replacement;
|
|
42
|
+
export type HashLike = Source.HashLike;
|
|
43
|
+
export type MapOptions = Source.MapOptions;
|
|
44
|
+
export type RawSourceMap = Source.RawSourceMap;
|
|
45
|
+
export type SourceAndMap = Source.SourceAndMap;
|
|
46
|
+
export type SourceValue = Source.SourceValue;
|
|
47
|
+
export type GeneratedSourceInfo = GetGeneratedSourceInfo.GeneratedSourceInfo;
|
|
48
|
+
export type StreamChunksOptions = StreamChunks.Options;
|
|
49
|
+
export {
|
|
50
|
+
Source,
|
|
51
|
+
RawSource,
|
|
52
|
+
OriginalSource,
|
|
53
|
+
SourceMapSource,
|
|
54
|
+
CachedSource,
|
|
55
|
+
ConcatSource,
|
|
56
|
+
ReplaceSource,
|
|
57
|
+
PrefixSource,
|
|
58
|
+
SizeOnlySource,
|
|
59
|
+
CompatSource,
|
|
60
|
+
};
|
|
61
|
+
|