@rspack/core 1.4.1 → 1.4.2
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 +1 -1
- package/compiled/tinypool/README.md +1 -1
- package/compiled/tinypool/dist/entry/worker.js +1 -0
- package/compiled/tinypool/dist/index.js +6 -2
- package/compiled/tinypool/package.json +1 -1
- package/dist/index.js +18 -15
- package/dist/trace/index.d.ts +7 -1
- package/package.json +2 -2
package/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
> Piscina: A fast, efficient Node.js Worker Thread Pool implementation
|
4
4
|
|
5
|
-
Tinypool is a fork of piscina. What we try to achieve in this library, is to eliminate some dependencies and features that our target users don't need (currently, our main user will be Vitest). Tinypool's install size (38KB) can then be smaller than Piscina's install size (6MB). If you need features like [utilization](https://github.com/piscinajs/piscina#property-utilization-readonly) or OS-specific thread priority setting, [Piscina](https://github.com/piscinajs/piscina) is a better choice for you. We think that Piscina is an amazing library, and we may try to upstream some of the dependencies optimization in this fork.
|
5
|
+
Tinypool is a fork of piscina. What we try to achieve in this library, is to eliminate some dependencies and features that our target users don't need (currently, our main user will be Vitest). Tinypool's install size (38KB) can then be smaller than Piscina's install size (6MB when Tinypool was created, Piscina has since reduced it's size to ~800KB). If you need features like [utilization](https://github.com/piscinajs/piscina#property-utilization-readonly) or OS-specific thread priority setting, [Piscina](https://github.com/piscinajs/piscina) is a better choice for you. We think that Piscina is an amazing library, and we may try to upstream some of the dependencies optimization in this fork.
|
6
6
|
|
7
7
|
- ✅ Smaller install size, 38KB
|
8
8
|
- ✅ Minimal
|
@@ -20,6 +20,7 @@ parentPort.on("message", (message) => {
|
|
20
20
|
if (filename !== null) await getHandler(filename, name);
|
21
21
|
const readyMessage = { ready: true };
|
22
22
|
parentPort.postMessage(readyMessage);
|
23
|
+
port.start();
|
23
24
|
port.on("message", onMessage.bind(null, port, sharedBuffer));
|
24
25
|
atomicsWaitLoop(port, sharedBuffer);
|
25
26
|
})().catch(throwInNextTick);
|
@@ -141,7 +141,10 @@ var ProcessWorker = class {
|
|
141
141
|
}
|
142
142
|
postMessage(message, transferListItem) {
|
143
143
|
transferListItem?.forEach((item) => {
|
144
|
-
if (item instanceof MessagePort)
|
144
|
+
if (item instanceof MessagePort) {
|
145
|
+
this.port = item;
|
146
|
+
this.port.start();
|
147
|
+
}
|
145
148
|
});
|
146
149
|
if (this.port) this.port.on("message", (message$1) => this.send({
|
147
150
|
...message$1,
|
@@ -173,7 +176,7 @@ var ProcessWorker = class {
|
|
173
176
|
}
|
174
177
|
unref() {
|
175
178
|
this.port?.unref();
|
176
|
-
this.process.channel?.unref();
|
179
|
+
this.process.channel?.unref?.();
|
177
180
|
if (hasUnref(this.process.stdout)) this.process.stdout.unref();
|
178
181
|
if (hasUnref(this.process.stderr)) this.process.stderr.unref();
|
179
182
|
return this.process.unref();
|
@@ -573,6 +576,7 @@ var ThreadPool = class {
|
|
573
576
|
worker.postMessage(message, [port2]);
|
574
577
|
worker.on("message", (message$1) => {
|
575
578
|
if (message$1.ready === true) {
|
579
|
+
port1.start();
|
576
580
|
if (workerInfo.currentUsage() === 0) workerInfo.unref();
|
577
581
|
if (!workerInfo.isReady()) workerInfo.markAsReady();
|
578
582
|
return;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "tinypool",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.1.
|
4
|
+
"version": "1.1.1",
|
5
5
|
"packageManager": "pnpm@9.0.6",
|
6
6
|
"description": "A minimal and tiny Node.js Worker Thread Pool implementation, a fork of piscina, but with fewer features",
|
7
7
|
"license": "MIT",
|
package/dist/index.js
CHANGED
@@ -3152,6 +3152,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
3152
3152
|
}
|
3153
3153
|
}
|
3154
3154
|
class JavaScriptTracer {
|
3155
|
+
static state = "uninitialized";
|
3155
3156
|
static startTime;
|
3156
3157
|
static events;
|
3157
3158
|
static layer;
|
@@ -3160,7 +3161,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
3160
3161
|
static counter = 10000;
|
3161
3162
|
static async initJavaScriptTrace(layer, output) {
|
3162
3163
|
let { Session } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "node:inspector"));
|
3163
|
-
this.session = new Session(), this.layer = layer, this.output = output, this.events = [], this.startTime = process.hrtime.bigint();
|
3164
|
+
this.session = new Session(), this.layer = layer, this.output = output, this.events = [], this.state = "on", this.startTime = process.hrtime.bigint();
|
3164
3165
|
}
|
3165
3166
|
static uuid() {
|
3166
3167
|
return this.counter++;
|
@@ -3169,7 +3170,8 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
3169
3170
|
this.layer && (this.session.connect(), this.session.post("Profiler.enable"), this.session.post("Profiler.start"));
|
3170
3171
|
}
|
3171
3172
|
static async cleanupJavaScriptTrace() {
|
3172
|
-
if (
|
3173
|
+
if ("uninitialized" === this.state) throw Error("JavaScriptTracer is not initialized, please call initJavaScriptTrace first");
|
3174
|
+
if (!this.layer || "off" === this.state) return;
|
3173
3175
|
let profileHandler = (err, param)=>{
|
3174
3176
|
let cpu_profile;
|
3175
3177
|
if (err ? console.error("Error stopping profiler:", err) : cpu_profile = param.profile, cpu_profile) {
|
@@ -3208,7 +3210,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
3208
3210
|
});
|
3209
3211
|
}
|
3210
3212
|
};
|
3211
|
-
|
3213
|
+
await new Promise((resolve, reject)=>{
|
3212
3214
|
this.session.post("Profiler.stop", (err, params)=>{
|
3213
3215
|
if (err) reject(err);
|
3214
3216
|
else try {
|
@@ -3217,7 +3219,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
3217
3219
|
reject(err);
|
3218
3220
|
}
|
3219
3221
|
});
|
3220
|
-
});
|
3222
|
+
}), this.state = "off";
|
3221
3223
|
}
|
3222
3224
|
static getTs() {
|
3223
3225
|
return process.hrtime.bigint() - this.startTime;
|
@@ -8510,12 +8512,13 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
8510
8512
|
var hashFuncNames, source;
|
8511
8513
|
if (tag.attributes && "integrity" in tag.attributes) return;
|
8512
8514
|
let tagSrc = function(tag) {
|
8513
|
-
if (
|
8514
|
-
"script"
|
8515
|
-
"link"
|
8516
|
-
|
8517
|
-
|
8518
|
-
|
8515
|
+
if (tag.attributes) {
|
8516
|
+
if ("script" === tag.tagName && "string" == typeof tag.attributes.src) return tag.attributes.src;
|
8517
|
+
if ("link" === tag.tagName && "string" == typeof tag.attributes.href) {
|
8518
|
+
let rel = tag.attributes.rel;
|
8519
|
+
if ("string" != typeof rel) return;
|
8520
|
+
return "stylesheet" === rel || "modulepreload" === rel || "preload" === rel && ("script" === tag.attributes.as || "style" === tag.attributes.as) ? tag.attributes.href : void 0;
|
8521
|
+
}
|
8519
8522
|
}
|
8520
8523
|
}(tag);
|
8521
8524
|
if (!tagSrc) return;
|
@@ -9433,7 +9436,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
9433
9436
|
}, applyExperimentsDefaults = (experiments, { production, development })=>{
|
9434
9437
|
defaults_F(experiments, "cache", ()=>development), D(experiments, "futureDefaults", !1), D(experiments, "lazyCompilation", !1), D(experiments, "asyncWebAssembly", experiments.futureDefaults), D(experiments, "css", !!experiments.futureDefaults || void 0), D(experiments, "layers", !1), D(experiments, "topLevelAwait", !0), D(experiments, "buildHttp", void 0), experiments.buildHttp && "object" == typeof experiments.buildHttp && D(experiments.buildHttp, "upgrade", !1), D(experiments, "incremental", {}), "object" == typeof experiments.incremental && (D(experiments.incremental, "silent", !0), D(experiments.incremental, "make", !0), D(experiments.incremental, "inferAsyncModules", !0), D(experiments.incremental, "providedExports", !0), D(experiments.incremental, "dependenciesDiagnostics", !0), D(experiments.incremental, "sideEffects", !0), D(experiments.incremental, "buildChunkGraph", !0), D(experiments.incremental, "moduleIds", !0), D(experiments.incremental, "chunkIds", !0), D(experiments.incremental, "modulesHashes", !0), D(experiments.incremental, "modulesCodegen", !0), D(experiments.incremental, "modulesRuntimeRequirements", !0), D(experiments.incremental, "chunksRuntimeRequirements", !0), D(experiments.incremental, "chunksHashes", !0), D(experiments.incremental, "chunksRender", !0), D(experiments.incremental, "emitAssets", !0)), D(experiments, "rspackFuture", {}), D(experiments, "parallelCodeSplitting", !0), D(experiments, "parallelLoader", !1), D(experiments, "useInputFileSystem", !1), D(experiments, "inlineConst", !1), D(experiments, "inlineEnum", !1), D(experiments, "typeReexportsPresence", !1);
|
9435
9438
|
}, applybundlerInfoDefaults = (rspackFuture, library)=>{
|
9436
|
-
"object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.4.
|
9439
|
+
"object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.4.2"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
|
9437
9440
|
}, applySnapshotDefaults = (_snapshot, _env)=>{}, applyJavascriptParserOptionsDefaults = (parserOptions)=>{
|
9438
9441
|
D(parserOptions, "dynamicImportMode", "lazy"), D(parserOptions, "dynamicImportPrefetch", !1), D(parserOptions, "dynamicImportPreload", !1), D(parserOptions, "url", !0), D(parserOptions, "exprContextCritical", !0), D(parserOptions, "wrappedContextCritical", !1), D(parserOptions, "wrappedContextRegExp", /.*/), D(parserOptions, "strictExportPresence", !1), D(parserOptions, "requireAsExpression", !0), D(parserOptions, "requireDynamic", !0), D(parserOptions, "requireResolve", !0), D(parserOptions, "importDynamic", !0), D(parserOptions, "worker", [
|
9439
9442
|
"..."
|
@@ -10339,7 +10342,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
10339
10342
|
},
|
10340
10343
|
arm: "gnueabihf"
|
10341
10344
|
}
|
10342
|
-
}, BINDING_VERSION = __webpack_require__("@rspack/binding/package.json").version, CORE_VERSION = "1.4.
|
10345
|
+
}, BINDING_VERSION = __webpack_require__("@rspack/binding/package.json").version, CORE_VERSION = "1.4.2", getAddonPlatformArchAbi = ()=>{
|
10343
10346
|
let { platform, arch } = process, binding = "";
|
10344
10347
|
binding += platform;
|
10345
10348
|
let abi = NodePlatformArchToAbi[platform][arch];
|
@@ -11638,7 +11641,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
11638
11641
|
obj.children = this.stats.map((stat, idx)=>{
|
11639
11642
|
let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
|
11640
11643
|
return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
|
11641
|
-
}), childOptions.version && (obj.rspackVersion = "1.4.
|
11644
|
+
}), childOptions.version && (obj.rspackVersion = "1.4.2", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
|
11642
11645
|
let mapError = (j, obj)=>({
|
11643
11646
|
...obj,
|
11644
11647
|
compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
|
@@ -12541,7 +12544,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
12541
12544
|
object.hash = context.getStatsCompilation(compilation).hash;
|
12542
12545
|
},
|
12543
12546
|
version: (object)=>{
|
12544
|
-
object.version = "5.75.0", object.rspackVersion = "1.4.
|
12547
|
+
object.version = "5.75.0", object.rspackVersion = "1.4.2";
|
12545
12548
|
},
|
12546
12549
|
env: (object, _compilation, _context, { _env })=>{
|
12547
12550
|
object.env = _env;
|
@@ -16021,7 +16024,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
16021
16024
|
let _options = JSON.stringify(options || {});
|
16022
16025
|
return binding_default().transform(source, _options);
|
16023
16026
|
}
|
16024
|
-
let exports_rspackVersion = "1.4.
|
16027
|
+
let exports_rspackVersion = "1.4.2", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
|
16025
16028
|
getNormalizedRspackOptions: getNormalizedRspackOptions,
|
16026
16029
|
applyRspackOptionsDefaults: applyRspackOptionsDefaults,
|
16027
16030
|
getNormalizedWebpackOptions: getNormalizedRspackOptions,
|
package/dist/trace/index.d.ts
CHANGED
@@ -13,17 +13,23 @@ export interface ChromeEvent {
|
|
13
13
|
type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
14
14
|
type PartialChromeEvent = MakeOptional<ChromeEvent, "ts" | "ph">;
|
15
15
|
export declare class JavaScriptTracer {
|
16
|
+
static state: "uninitialized" | "on" | "off";
|
16
17
|
static startTime: bigint;
|
17
18
|
static events: ChromeEvent[];
|
18
19
|
static layer: string;
|
19
20
|
static output: string;
|
20
21
|
static session: import("node:inspector").Session;
|
21
22
|
private static counter;
|
23
|
+
/**
|
24
|
+
* only first call take effects, subsequent calls will be ignored
|
25
|
+
* @param layer tracing layer
|
26
|
+
* @param output tracing output file path
|
27
|
+
*/
|
22
28
|
static initJavaScriptTrace(layer: string, output: string): Promise<void>;
|
23
29
|
static uuid(): number;
|
24
30
|
static initCpuProfiler(): void;
|
25
31
|
/**
|
26
|
-
*
|
32
|
+
* only first call take effects, subsequent calls will be ignored
|
27
33
|
* @param isEnd true means we are at the end of tracing,and can append ']' to close the json
|
28
34
|
* @returns
|
29
35
|
*/
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspack/core",
|
3
|
-
"version": "1.4.
|
3
|
+
"version": "1.4.2",
|
4
4
|
"webpackVersion": "5.75.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
@@ -57,7 +57,7 @@
|
|
57
57
|
"dependencies": {
|
58
58
|
"@module-federation/runtime-tools": "0.15.0",
|
59
59
|
"@rspack/lite-tapable": "1.0.1",
|
60
|
-
"@rspack/binding": "1.4.
|
60
|
+
"@rspack/binding": "1.4.2"
|
61
61
|
},
|
62
62
|
"peerDependencies": {
|
63
63
|
"@swc/helpers": ">=0.5.1"
|