@rspack/core 1.3.1 → 1.3.3
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/compiled/@swc/types/index.d.ts +26 -1
- package/compiled/@swc/types/package.json +1 -1
- package/compiled/tinypool/LICENSE +24 -0
- package/compiled/tinypool/README.md +212 -0
- package/compiled/tinypool/dist/chunk-6LX4VMOV.js +31 -0
- package/compiled/tinypool/dist/chunk-ACQHDOFQ.js +12 -0
- package/compiled/tinypool/dist/chunk-E2J7JLFN.js +53 -0
- package/compiled/tinypool/dist/chunk-UBWFVGJX.js +38 -0
- package/compiled/tinypool/dist/entry/process.d.ts +2 -0
- package/compiled/tinypool/dist/entry/process.js +92 -0
- package/compiled/tinypool/dist/entry/utils.d.ts +5 -0
- package/compiled/tinypool/dist/entry/utils.js +9 -0
- package/compiled/tinypool/dist/entry/worker.d.ts +2 -0
- package/compiled/tinypool/dist/entry/worker.js +103 -0
- package/compiled/tinypool/dist/index.d.ts +188 -0
- package/compiled/tinypool/dist/index.js +1080 -0
- package/compiled/tinypool/package.json +55 -0
- package/dist/RuntimeGlobals.d.ts +1 -0
- package/dist/index.js +71 -9
- package/dist/loader-runner/service.d.ts +7 -2
- package/dist/worker.js +55 -4
- package/package.json +10 -10
@@ -0,0 +1,55 @@
|
|
1
|
+
{
|
2
|
+
"name": "tinypool",
|
3
|
+
"type": "module",
|
4
|
+
"version": "1.0.2",
|
5
|
+
"description": "A minimal and tiny Node.js Worker Thread Pool implementation, a fork of piscina, but with fewer features",
|
6
|
+
"license": "MIT",
|
7
|
+
"homepage": "https://github.com/tinylibs/tinypool#readme",
|
8
|
+
"repository": {
|
9
|
+
"type": "git",
|
10
|
+
"url": "https://github.com/tinylibs/tinypool.git"
|
11
|
+
},
|
12
|
+
"bugs": {
|
13
|
+
"url": "https://github.com/tinylibs/tinypool/issues"
|
14
|
+
},
|
15
|
+
"keywords": [
|
16
|
+
"fast",
|
17
|
+
"worker threads",
|
18
|
+
"thread pool"
|
19
|
+
],
|
20
|
+
"exports": {
|
21
|
+
".": {
|
22
|
+
"types": "./dist/index.d.ts",
|
23
|
+
"default": "./dist/index.js"
|
24
|
+
},
|
25
|
+
"./package.json": "./package.json"
|
26
|
+
},
|
27
|
+
"main": "./dist/index.js",
|
28
|
+
"module": "./dist/index.js",
|
29
|
+
"types": "./dist/index.d.ts",
|
30
|
+
"files": [
|
31
|
+
"dist"
|
32
|
+
],
|
33
|
+
"devDependencies": {
|
34
|
+
"@types/node": "^20.12.8",
|
35
|
+
"clean-publish": "^3.4.4",
|
36
|
+
"eslint": "^9.4.0",
|
37
|
+
"eslint-config-prettier": "^9.1.0",
|
38
|
+
"eslint-plugin-prettier": "^5.1.3",
|
39
|
+
"eslint-plugin-unicorn": "^53.0.0",
|
40
|
+
"prettier": "^3.3.2",
|
41
|
+
"tsup": "^8.0.2",
|
42
|
+
"typescript": "^5.4.5",
|
43
|
+
"typescript-eslint": "^7.13.0",
|
44
|
+
"vite": "^5.2.11",
|
45
|
+
"vitest": "^2.0.5"
|
46
|
+
},
|
47
|
+
"scripts": {
|
48
|
+
"test": "vitest",
|
49
|
+
"bench": "vitest bench",
|
50
|
+
"dev": "tsup --watch",
|
51
|
+
"build": "tsup",
|
52
|
+
"lint": "eslint --max-warnings=0",
|
53
|
+
"typecheck": "tsc --noEmit"
|
54
|
+
}
|
55
|
+
}
|
package/dist/RuntimeGlobals.d.ts
CHANGED
package/dist/index.js
CHANGED
@@ -5256,7 +5256,7 @@ var ensureLoaderWorkerPool = async () => {
|
|
5256
5256
|
if (pool) {
|
5257
5257
|
return pool;
|
5258
5258
|
}
|
5259
|
-
return pool = import("tinypool").then(({ Tinypool }) => {
|
5259
|
+
return pool = import("../compiled/tinypool").then(({ Tinypool }) => {
|
5260
5260
|
const cpus = require("os").cpus().length;
|
5261
5261
|
const availableThreads = Math.max(cpus - 1, 1);
|
5262
5262
|
const pool2 = new Tinypool({
|
@@ -5354,10 +5354,14 @@ var run = async (task, options) => ensureLoaderWorkerPool().then(async (pool2) =
|
|
5354
5354
|
switch (message.requestType) {
|
5355
5355
|
case "WaitForPendingRequest" /* WaitForPendingRequest */: {
|
5356
5356
|
const pendingRequestId = message.data[0];
|
5357
|
-
const
|
5357
|
+
const isArray = Array.isArray(pendingRequestId);
|
5358
|
+
const ids = isArray ? pendingRequestId : [pendingRequestId];
|
5358
5359
|
result2 = await Promise.all(
|
5359
5360
|
ids.map((id) => pendingRequests.get(id))
|
5360
5361
|
);
|
5362
|
+
if (!isArray) {
|
5363
|
+
result2 = result2[0];
|
5364
|
+
}
|
5361
5365
|
break;
|
5362
5366
|
}
|
5363
5367
|
default:
|
@@ -6078,6 +6082,7 @@ async function runLoaders(compiler, context2) {
|
|
6078
6082
|
get: () => context2.__internal__parseMeta
|
6079
6083
|
});
|
6080
6084
|
const getWorkerLoaderContext = () => {
|
6085
|
+
const normalModule = loaderContext._module instanceof import_binding2.NormalModule ? loaderContext._module : void 0;
|
6081
6086
|
const workerLoaderContext = {
|
6082
6087
|
hot: loaderContext.hot,
|
6083
6088
|
context: loaderContext.context,
|
@@ -6109,11 +6114,27 @@ async function runLoaders(compiler, context2) {
|
|
6109
6114
|
}
|
6110
6115
|
},
|
6111
6116
|
_compilation: {
|
6112
|
-
|
6117
|
+
options: {
|
6118
|
+
output: {
|
6119
|
+
// css-loader
|
6120
|
+
environment: compiler._lastCompilation.outputOptions.environment
|
6121
|
+
}
|
6122
|
+
},
|
6123
|
+
// css-loader
|
6124
|
+
outputOptions: {
|
6125
|
+
hashSalt: compiler._lastCompilation.outputOptions.hashSalt,
|
6126
|
+
hashFunction: compiler._lastCompilation.outputOptions.hashFunction,
|
6127
|
+
hashDigest: compiler._lastCompilation.outputOptions.hashDigest,
|
6128
|
+
hashDigestLength: compiler._lastCompilation.outputOptions.hashDigestLength
|
6129
|
+
}
|
6113
6130
|
},
|
6114
6131
|
_module: {
|
6115
6132
|
type: loaderContext._module.type,
|
6116
|
-
identifier: loaderContext._module.identifier()
|
6133
|
+
identifier: loaderContext._module.identifier(),
|
6134
|
+
matchResource: normalModule == null ? void 0 : normalModule.matchResource,
|
6135
|
+
request: normalModule == null ? void 0 : normalModule.request,
|
6136
|
+
userRequest: normalModule == null ? void 0 : normalModule.userRequest,
|
6137
|
+
rawRequest: normalModule == null ? void 0 : normalModule.rawRequest
|
6117
6138
|
}
|
6118
6139
|
};
|
6119
6140
|
Object.assign(workerLoaderContext, compiler.options.loader);
|
@@ -6207,6 +6228,9 @@ async function runLoaders(compiler, context2) {
|
|
6207
6228
|
loaderContext.cacheable(cacheable);
|
6208
6229
|
break;
|
6209
6230
|
}
|
6231
|
+
case "ImportModule" /* ImportModule */: {
|
6232
|
+
return loaderContext.importModule(args[0], args[1]);
|
6233
|
+
}
|
6210
6234
|
case "UpdateLoaderObjects" /* UpdateLoaderObjects */: {
|
6211
6235
|
const updates = args[0];
|
6212
6236
|
loaderContext.loaders = loaderContext.loaders.map((item, index) => {
|
@@ -6222,6 +6246,29 @@ async function runLoaders(compiler, context2) {
|
|
6222
6246
|
});
|
6223
6247
|
break;
|
6224
6248
|
}
|
6249
|
+
case "CompilationGetPath" /* CompilationGetPath */: {
|
6250
|
+
const filename2 = args[0];
|
6251
|
+
const data = args[1];
|
6252
|
+
return compiler._lastCompilation.getPath(filename2, data);
|
6253
|
+
}
|
6254
|
+
case "CompilationGetPathWithInfo" /* CompilationGetPathWithInfo */: {
|
6255
|
+
const filename2 = args[0];
|
6256
|
+
const data = args[1];
|
6257
|
+
return compiler._lastCompilation.getPathWithInfo(filename2, data);
|
6258
|
+
}
|
6259
|
+
case "CompilationGetAssetPath" /* CompilationGetAssetPath */: {
|
6260
|
+
const filename2 = args[0];
|
6261
|
+
const data = args[1];
|
6262
|
+
return compiler._lastCompilation.getAssetPath(filename2, data);
|
6263
|
+
}
|
6264
|
+
case "CompilationGetAssetPathWithInfo" /* CompilationGetAssetPathWithInfo */: {
|
6265
|
+
const filename2 = args[0];
|
6266
|
+
const data = args[1];
|
6267
|
+
return compiler._lastCompilation.getAssetPathWithInfo(
|
6268
|
+
filename2,
|
6269
|
+
data
|
6270
|
+
);
|
6271
|
+
}
|
6225
6272
|
default: {
|
6226
6273
|
throw new Error(`Unknown request type: ${requestType}`);
|
6227
6274
|
}
|
@@ -12753,7 +12800,7 @@ var CodeGenerationResult = class {
|
|
12753
12800
|
};
|
12754
12801
|
|
12755
12802
|
// src/RuntimeGlobals.ts
|
12756
|
-
var
|
12803
|
+
var RESERVED_RUNTIME_GLOBALS = /* @__PURE__ */ new Map();
|
12757
12804
|
function __from_binding_runtime_globals(runtimeRequirements) {
|
12758
12805
|
const res = /* @__PURE__ */ new Set();
|
12759
12806
|
for (const flag of runtimeRequirements.value) {
|
@@ -12770,7 +12817,7 @@ function __to_binding_runtime_globals(runtimeRequirements) {
|
|
12770
12817
|
value: []
|
12771
12818
|
};
|
12772
12819
|
for (const flag of Array.from(runtimeRequirements)) {
|
12773
|
-
const item =
|
12820
|
+
const item = RESERVED_RUNTIME_GLOBALS.get(flag);
|
12774
12821
|
if (typeof item === "string") {
|
12775
12822
|
res.value.push(item);
|
12776
12823
|
} else {
|
@@ -13092,8 +13139,9 @@ var RuntimeGlobals = {
|
|
13092
13139
|
asyncModule: "__webpack_require__.a"
|
13093
13140
|
};
|
13094
13141
|
for (const entry2 of Object.entries(RuntimeGlobals)) {
|
13095
|
-
|
13142
|
+
RESERVED_RUNTIME_GLOBALS.set(entry2[1], entry2[0]);
|
13096
13143
|
}
|
13144
|
+
var isReservedRuntimeGlobal = (r) => RESERVED_RUNTIME_GLOBALS.has(r);
|
13097
13145
|
|
13098
13146
|
// src/taps/compilation.ts
|
13099
13147
|
var createCompilationHooksRegisters = (getCompiler, createTap, createMapTap) => {
|
@@ -13124,15 +13172,29 @@ var createCompilationHooksRegisters = (getCompiler, createTap, createMapTap) =>
|
|
13124
13172
|
function(queried) {
|
13125
13173
|
return function({
|
13126
13174
|
chunk: chunkBinding,
|
13175
|
+
allRuntimeRequirements,
|
13127
13176
|
runtimeRequirements
|
13128
13177
|
}) {
|
13129
13178
|
const set = __from_binding_runtime_globals(runtimeRequirements);
|
13179
|
+
const all = __from_binding_runtime_globals(allRuntimeRequirements);
|
13130
13180
|
const chunk = Chunk.__from_binding(chunkBinding);
|
13181
|
+
const customRuntimeGlobals = /* @__PURE__ */ new Set();
|
13182
|
+
const originalAdd = all.add.bind(all);
|
13183
|
+
const add = function add2(r) {
|
13184
|
+
if (all.has(r)) return all;
|
13185
|
+
if (isReservedRuntimeGlobal(r)) return originalAdd(r);
|
13186
|
+
customRuntimeGlobals.add(r);
|
13187
|
+
return originalAdd(r);
|
13188
|
+
};
|
13189
|
+
all.add = add.bind(add);
|
13131
13190
|
for (const r of set) {
|
13132
|
-
queried.for(r).call(chunk,
|
13191
|
+
queried.for(r).call(chunk, all);
|
13192
|
+
}
|
13193
|
+
for (const r of customRuntimeGlobals) {
|
13194
|
+
queried.for(r).call(chunk, all);
|
13133
13195
|
}
|
13134
13196
|
return {
|
13135
|
-
|
13197
|
+
allRuntimeRequirements: __to_binding_runtime_globals(all)
|
13136
13198
|
};
|
13137
13199
|
};
|
13138
13200
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { Tinypool } from "tinypool" with { "resolution-mode": "import" };
|
1
|
+
import type { Tinypool } from "../../compiled/tinypool" with { "resolution-mode": "import" };
|
2
2
|
type RunOptions = Parameters<Tinypool["run"]>[1];
|
3
3
|
export interface WorkerResponseMessage {
|
4
4
|
type: "response";
|
@@ -51,7 +51,12 @@ export declare enum RequestType {
|
|
51
51
|
EmitFile = "EmitFile",
|
52
52
|
EmitDiagnostic = "EmitDiagnostic",
|
53
53
|
SetCacheable = "SetCacheable",
|
54
|
-
|
54
|
+
ImportModule = "ImportModule",
|
55
|
+
UpdateLoaderObjects = "UpdateLoaderObjects",
|
56
|
+
CompilationGetPath = "CompilationGetPath",
|
57
|
+
CompilationGetPathWithInfo = "CompilationGetPathWithInfo",
|
58
|
+
CompilationGetAssetPath = "CompilationGetAssetPath",
|
59
|
+
CompilationGetAssetPathWithInfo = "CompilationGetAssetPathWithInfo"
|
55
60
|
}
|
56
61
|
export declare enum RequestSyncType {
|
57
62
|
WaitForPendingRequest = "WaitForPendingRequest"
|
package/dist/worker.js
CHANGED
@@ -1461,9 +1461,6 @@ async function loaderImpl({ args, loaderContext, loaderState }, sendRequest, wai
|
|
1461
1461
|
loaderContext.clearDependencies = function clearDependencies() {
|
1462
1462
|
pendingDependencyRequest.push(sendRequest("ClearDependencies" /* ClearDependencies */));
|
1463
1463
|
};
|
1464
|
-
loaderContext.importModule = function() {
|
1465
|
-
throw new Error("importModule is not supported in worker");
|
1466
|
-
};
|
1467
1464
|
loaderContext.resolve = function resolve(context, request, callback) {
|
1468
1465
|
sendRequest("Resolve" /* Resolve */, context, request).then(
|
1469
1466
|
(result) => {
|
@@ -1598,7 +1595,7 @@ async function loaderImpl({ args, loaderContext, loaderState }, sendRequest, wai
|
|
1598
1595
|
};
|
1599
1596
|
loaderContext._compiler = {
|
1600
1597
|
...loaderContext._compiler,
|
1601
|
-
// @ts-
|
1598
|
+
// @ts-expect-error: some properties are missing.
|
1602
1599
|
webpack: {
|
1603
1600
|
util: {
|
1604
1601
|
createHash: (init_createHash(), __toCommonJS(createHash_exports)).createHash,
|
@@ -1606,13 +1603,67 @@ async function loaderImpl({ args, loaderContext, loaderState }, sendRequest, wai
|
|
1606
1603
|
}
|
1607
1604
|
}
|
1608
1605
|
};
|
1606
|
+
loaderContext._compilation = {
|
1607
|
+
...loaderContext._compilation,
|
1608
|
+
getPath(filename, data) {
|
1609
|
+
return sendRequest("CompilationGetPath" /* CompilationGetPath */, filename, data).wait();
|
1610
|
+
},
|
1611
|
+
getPathWithInfo(filename, data) {
|
1612
|
+
return sendRequest(
|
1613
|
+
"CompilationGetPathWithInfo" /* CompilationGetPathWithInfo */,
|
1614
|
+
filename,
|
1615
|
+
data
|
1616
|
+
).wait();
|
1617
|
+
},
|
1618
|
+
getAssetPath(filename, data) {
|
1619
|
+
return sendRequest(
|
1620
|
+
"CompilationGetAssetPath" /* CompilationGetAssetPath */,
|
1621
|
+
filename,
|
1622
|
+
data
|
1623
|
+
).wait();
|
1624
|
+
},
|
1625
|
+
getAssetPathWithInfo(filename, data) {
|
1626
|
+
return sendRequest(
|
1627
|
+
"CompilationGetAssetPathWithInfo" /* CompilationGetAssetPathWithInfo */,
|
1628
|
+
filename,
|
1629
|
+
data
|
1630
|
+
).wait();
|
1631
|
+
}
|
1632
|
+
};
|
1609
1633
|
const _module = loaderContext._module;
|
1610
1634
|
loaderContext._module = {
|
1611
1635
|
type: _module.type,
|
1612
1636
|
identifier() {
|
1613
1637
|
return _module.identifier;
|
1638
|
+
},
|
1639
|
+
matchResource: _module.matchResource,
|
1640
|
+
request: _module.request,
|
1641
|
+
userRequest: _module.userRequest,
|
1642
|
+
rawRequest: _module.rawRequest
|
1643
|
+
};
|
1644
|
+
loaderContext.importModule = function importModule(request, options, callback) {
|
1645
|
+
if (!callback) {
|
1646
|
+
return new Promise((resolve, reject) => {
|
1647
|
+
sendRequest("ImportModule" /* ImportModule */, request, options).then(
|
1648
|
+
(result) => {
|
1649
|
+
resolve(result);
|
1650
|
+
},
|
1651
|
+
(err) => {
|
1652
|
+
reject(err);
|
1653
|
+
}
|
1654
|
+
);
|
1655
|
+
});
|
1614
1656
|
}
|
1657
|
+
sendRequest("ImportModule" /* ImportModule */, request, options).then(
|
1658
|
+
(result) => {
|
1659
|
+
callback(null, result);
|
1660
|
+
},
|
1661
|
+
(err) => {
|
1662
|
+
callback(err);
|
1663
|
+
}
|
1664
|
+
);
|
1615
1665
|
};
|
1666
|
+
loaderContext.fs = require("fs");
|
1616
1667
|
Object.defineProperty(loaderContext, "request", {
|
1617
1668
|
enumerable: true,
|
1618
1669
|
get: () => loaderContext.loaders.map((o) => o.request).concat(loaderContext.resource || "").join("!")
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspack/core",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.3",
|
4
4
|
"webpackVersion": "5.75.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
@@ -37,8 +37,8 @@
|
|
37
37
|
"directory": "packages/rspack"
|
38
38
|
},
|
39
39
|
"devDependencies": {
|
40
|
-
"@swc/core": "1.11.
|
41
|
-
"@swc/types": "0.1.
|
40
|
+
"@swc/core": "1.11.13",
|
41
|
+
"@swc/types": "0.1.20",
|
42
42
|
"@types/graceful-fs": "4.1.9",
|
43
43
|
"@types/watchpack": "^2.4.4",
|
44
44
|
"@types/webpack-sources": "3.2.3",
|
@@ -48,23 +48,23 @@
|
|
48
48
|
"graceful-fs": "^4.2.11",
|
49
49
|
"json-parse-even-better-errors": "^3.0.2",
|
50
50
|
"prebundle": "^1.2.7",
|
51
|
-
"tsc-alias": "^1.8.
|
51
|
+
"tsc-alias": "^1.8.13",
|
52
52
|
"tsup": "^8.4.0",
|
53
53
|
"tsx": "^4.19.3",
|
54
54
|
"typescript": "^5.7.3",
|
55
55
|
"watchpack": "^2.4.2",
|
56
|
-
"webpack-dev-server": "5.2.
|
56
|
+
"webpack-dev-server": "5.2.1",
|
57
57
|
"webpack-sources": "3.2.3",
|
58
58
|
"zod": "^3.24.2",
|
59
59
|
"zod-validation-error": "3.4.0",
|
60
|
-
"
|
60
|
+
"tinypool": "^1.0.2",
|
61
|
+
"@rspack/tracing": "1.3.3"
|
61
62
|
},
|
62
63
|
"dependencies": {
|
63
|
-
"@module-federation/runtime-tools": "0.11.
|
64
|
+
"@module-federation/runtime-tools": "0.11.2",
|
64
65
|
"@rspack/lite-tapable": "1.0.1",
|
65
|
-
"caniuse-lite": "^1.0.
|
66
|
-
"
|
67
|
-
"@rspack/binding": "1.3.1"
|
66
|
+
"caniuse-lite": "^1.0.30001707",
|
67
|
+
"@rspack/binding": "1.3.3"
|
68
68
|
},
|
69
69
|
"peerDependencies": {
|
70
70
|
"@rspack/tracing": "^1.x",
|