@rspack/core 1.3.2 → 1.3.4

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.
@@ -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/Module.d.ts CHANGED
@@ -44,6 +44,7 @@ export declare class ContextModuleFactoryAfterResolveData {
44
44
  export type ContextModuleFactoryAfterResolveResult = false | ContextModuleFactoryAfterResolveData;
45
45
  declare module "@rspack/binding" {
46
46
  interface Module {
47
+ identifier(): string;
47
48
  originalSource(): Source | null;
48
49
  emitFile(filename: string, source: Source, assetInfo?: AssetInfo): void;
49
50
  }
@@ -1,7 +1,6 @@
1
- import type { Dependency, JsModuleGraph } from "@rspack/binding";
1
+ import type { Dependency, JsModuleGraph, ModuleGraphConnection } from "@rspack/binding";
2
2
  import { ExportsInfo } from "./ExportsInfo";
3
3
  import type { Module } from "./Module";
4
- import { ModuleGraphConnection } from "./ModuleGraphConnection";
5
4
  export default class ModuleGraph {
6
5
  #private;
7
6
  static __from_binding(binding: JsModuleGraph): ModuleGraph;
@@ -322,3 +322,4 @@ export declare const RuntimeGlobals: {
322
322
  */
323
323
  readonly asyncModule: "__webpack_require__.a";
324
324
  };
325
+ export declare const isReservedRuntimeGlobal: (r: string) => boolean;
@@ -2931,6 +2931,7 @@ export declare const rspackOptions: z.ZodObject<{
2931
2931
  }>, z.ZodLiteral<false>]>>;
2932
2932
  }, "strict", z.ZodTypeAny, {
2933
2933
  name?: string | undefined;
2934
+ resolve?: t.ResolveOptions | undefined;
2934
2935
  module?: {
2935
2936
  parser?: {
2936
2937
  css?: {
@@ -3083,7 +3084,6 @@ export declare const rspackOptions: z.ZodObject<{
3083
3084
  defaultRules?: (false | "" | 0 | "..." | t.RuleSetRule | null | undefined)[] | undefined;
3084
3085
  noParse?: string | RegExp | ((args_0: string, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args: unknown[]) => boolean))[] | undefined;
3085
3086
  } | undefined;
3086
- resolve?: t.ResolveOptions | undefined;
3087
3087
  profile?: boolean | undefined;
3088
3088
  cache?: boolean | undefined;
3089
3089
  context?: string | undefined;
@@ -3545,6 +3545,7 @@ export declare const rspackOptions: z.ZodObject<{
3545
3545
  bail?: boolean | undefined;
3546
3546
  }, {
3547
3547
  name?: string | undefined;
3548
+ resolve?: t.ResolveOptions | undefined;
3548
3549
  module?: {
3549
3550
  parser?: {
3550
3551
  css?: {
@@ -3697,7 +3698,6 @@ export declare const rspackOptions: z.ZodObject<{
3697
3698
  defaultRules?: (false | "" | 0 | "..." | t.RuleSetRule | null | undefined)[] | undefined;
3698
3699
  noParse?: string | RegExp | ((args_0: string, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args: unknown[]) => boolean))[] | undefined;
3699
3700
  } | undefined;
3700
- resolve?: t.ResolveOptions | undefined;
3701
3701
  profile?: boolean | undefined;
3702
3702
  cache?: boolean | undefined;
3703
3703
  context?: string | undefined;
package/dist/exports.d.ts CHANGED
@@ -10,8 +10,9 @@ import { RspackOptionsApply } from "./rspackOptionsApply";
10
10
  export { RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply };
11
11
  export type { Chunk } from "./Chunk";
12
12
  export type { ChunkGroup } from "./ChunkGroup";
13
- export type { Module, ResolveData, ResourceDataWithData } from "./Module";
13
+ export type { ResolveData, ResourceDataWithData } from "./Module";
14
14
  export { MultiStats } from "./MultiStats";
15
+ export { Module } from "./Module";
15
16
  export { NormalModule } from "./NormalModule";
16
17
  export { ContextModule } from "./ContextModule";
17
18
  export { ConcatenatedModule } from "./ConcatenatedModule";
package/dist/index.js CHANGED
@@ -718,6 +718,7 @@ __export(index_exports, {
718
718
  LightningCssMinimizerRspackPlugin: () => LightningCssMinimizerRspackPlugin,
719
719
  LoaderOptionsPlugin: () => LoaderOptionsPlugin,
720
720
  LoaderTargetPlugin: () => LoaderTargetPlugin,
721
+ Module: () => import_binding79.Module,
721
722
  ModuleFilenameHelpers: () => ModuleFilenameHelpers_exports,
722
723
  MultiCompiler: () => MultiCompiler,
723
724
  MultiStats: () => MultiStats,
@@ -791,6 +792,7 @@ __export(exports_exports, {
791
792
  LightningCssMinimizerRspackPlugin: () => LightningCssMinimizerRspackPlugin,
792
793
  LoaderOptionsPlugin: () => LoaderOptionsPlugin,
793
794
  LoaderTargetPlugin: () => LoaderTargetPlugin,
795
+ Module: () => import_binding79.Module,
794
796
  ModuleFilenameHelpers: () => ModuleFilenameHelpers_exports,
795
797
  MultiCompiler: () => MultiCompiler,
796
798
  MultiStats: () => MultiStats,
@@ -1185,53 +1187,6 @@ var ExportsInfo = class _ExportsInfo {
1185
1187
  }
1186
1188
  };
1187
1189
 
1188
- // src/ModuleGraphConnection.ts
1189
- var MODULE_GRAPH_CONNECTION_MAPPINGS = /* @__PURE__ */ new WeakMap();
1190
- var ModuleGraphConnection = class _ModuleGraphConnection {
1191
- #inner;
1192
- static __from_binding(binding14) {
1193
- let connection = MODULE_GRAPH_CONNECTION_MAPPINGS.get(binding14);
1194
- if (connection) {
1195
- return connection;
1196
- }
1197
- connection = new _ModuleGraphConnection(binding14);
1198
- MODULE_GRAPH_CONNECTION_MAPPINGS.set(binding14, connection);
1199
- return connection;
1200
- }
1201
- static __to_binding(data) {
1202
- return data.#inner;
1203
- }
1204
- constructor(binding14) {
1205
- this.#inner = binding14;
1206
- Object.defineProperties(this, {
1207
- module: {
1208
- enumerable: true,
1209
- get() {
1210
- return binding14.module;
1211
- }
1212
- },
1213
- dependency: {
1214
- enumerable: true,
1215
- get() {
1216
- return binding14.dependency;
1217
- }
1218
- },
1219
- resolvedModule: {
1220
- enumerable: true,
1221
- get() {
1222
- return binding14.resolvedModule;
1223
- }
1224
- },
1225
- originModule: {
1226
- enumerable: true,
1227
- get() {
1228
- return binding14.originModule;
1229
- }
1230
- }
1231
- });
1232
- }
1233
- };
1234
-
1235
1190
  // src/ModuleGraph.ts
1236
1191
  var ModuleGraph = class _ModuleGraph {
1237
1192
  static __from_binding(binding14) {
@@ -1257,14 +1212,13 @@ var ModuleGraph = class _ModuleGraph {
1257
1212
  return ExportsInfo.__from_binding(this.#inner.getExportsInfo(module2));
1258
1213
  }
1259
1214
  getConnection(dependency) {
1260
- const binding14 = this.#inner.getConnection(dependency);
1261
- return binding14 ? ModuleGraphConnection.__from_binding(binding14) : null;
1215
+ return this.#inner.getConnection(dependency);
1262
1216
  }
1263
1217
  getOutgoingConnections(module2) {
1264
- return this.#inner.getOutgoingConnections(module2).map((binding14) => ModuleGraphConnection.__from_binding(binding14));
1218
+ return this.#inner.getOutgoingConnections(module2);
1265
1219
  }
1266
1220
  getIncomingConnections(module2) {
1267
- return this.#inner.getIncomingConnections(module2).map((binding14) => ModuleGraphConnection.__from_binding(binding14));
1221
+ return this.#inner.getIncomingConnections(module2);
1268
1222
  }
1269
1223
  getParentBlockIndex(dependency) {
1270
1224
  return this.#inner.getParentBlockIndex(dependency);
@@ -1273,7 +1227,7 @@ var ModuleGraph = class _ModuleGraph {
1273
1227
  return this.#inner.isAsync(module2);
1274
1228
  }
1275
1229
  getOutgoingConnectionsInOrder(module2) {
1276
- return this.#inner.getOutgoingConnectionsInOrder(module2).map((binding14) => ModuleGraphConnection.__from_binding(binding14));
1230
+ return this.#inner.getOutgoingConnectionsInOrder(module2);
1277
1231
  }
1278
1232
  };
1279
1233
 
@@ -5156,6 +5110,13 @@ var import_node_util3 = __toESM(require("util"));
5156
5110
  var binding = __toESM(require("@rspack/binding"));
5157
5111
  var liteTapable4 = __toESM(require("@rspack/lite-tapable"));
5158
5112
  var import_binding2 = require("@rspack/binding");
5113
+ Object.defineProperty(binding.NormalModule.prototype, "identifier", {
5114
+ enumerable: true,
5115
+ configurable: true,
5116
+ value() {
5117
+ return this[binding.MODULE_IDENTIFIER_SYMBOL];
5118
+ }
5119
+ });
5159
5120
  Object.defineProperty(binding.NormalModule.prototype, "originalSource", {
5160
5121
  enumerable: true,
5161
5122
  configurable: true,
@@ -5256,7 +5217,7 @@ var ensureLoaderWorkerPool = async () => {
5256
5217
  if (pool) {
5257
5218
  return pool;
5258
5219
  }
5259
- return pool = import("tinypool").then(({ Tinypool }) => {
5220
+ return pool = import("../compiled/tinypool").then(({ Tinypool }) => {
5260
5221
  const cpus = require("os").cpus().length;
5261
5222
  const availableThreads = Math.max(cpus - 1, 1);
5262
5223
  const pool2 = new Tinypool({
@@ -12771,6 +12732,13 @@ var ContextModuleFactoryAfterResolveData = class _ContextModuleFactoryAfterResol
12771
12732
  });
12772
12733
  }
12773
12734
  };
12735
+ Object.defineProperty(binding5.Module.prototype, "identifier", {
12736
+ enumerable: true,
12737
+ configurable: true,
12738
+ value() {
12739
+ return this[binding5.MODULE_IDENTIFIER_SYMBOL];
12740
+ }
12741
+ });
12774
12742
  Object.defineProperty(binding5.Module.prototype, "originalSource", {
12775
12743
  enumerable: true,
12776
12744
  configurable: true,
@@ -12800,7 +12768,7 @@ var CodeGenerationResult = class {
12800
12768
  };
12801
12769
 
12802
12770
  // src/RuntimeGlobals.ts
12803
- var REVERSE_RUNTIME_GLOBALS = /* @__PURE__ */ new Map();
12771
+ var RESERVED_RUNTIME_GLOBALS = /* @__PURE__ */ new Map();
12804
12772
  function __from_binding_runtime_globals(runtimeRequirements) {
12805
12773
  const res = /* @__PURE__ */ new Set();
12806
12774
  for (const flag of runtimeRequirements.value) {
@@ -12817,7 +12785,7 @@ function __to_binding_runtime_globals(runtimeRequirements) {
12817
12785
  value: []
12818
12786
  };
12819
12787
  for (const flag of Array.from(runtimeRequirements)) {
12820
- const item = REVERSE_RUNTIME_GLOBALS.get(flag);
12788
+ const item = RESERVED_RUNTIME_GLOBALS.get(flag);
12821
12789
  if (typeof item === "string") {
12822
12790
  res.value.push(item);
12823
12791
  } else {
@@ -13139,8 +13107,9 @@ var RuntimeGlobals = {
13139
13107
  asyncModule: "__webpack_require__.a"
13140
13108
  };
13141
13109
  for (const entry2 of Object.entries(RuntimeGlobals)) {
13142
- REVERSE_RUNTIME_GLOBALS.set(entry2[1], entry2[0]);
13110
+ RESERVED_RUNTIME_GLOBALS.set(entry2[1], entry2[0]);
13143
13111
  }
13112
+ var isReservedRuntimeGlobal = (r) => RESERVED_RUNTIME_GLOBALS.has(r);
13144
13113
 
13145
13114
  // src/taps/compilation.ts
13146
13115
  var createCompilationHooksRegisters = (getCompiler, createTap, createMapTap) => {
@@ -13177,9 +13146,21 @@ var createCompilationHooksRegisters = (getCompiler, createTap, createMapTap) =>
13177
13146
  const set = __from_binding_runtime_globals(runtimeRequirements);
13178
13147
  const all = __from_binding_runtime_globals(allRuntimeRequirements);
13179
13148
  const chunk = Chunk.__from_binding(chunkBinding);
13149
+ const customRuntimeGlobals = /* @__PURE__ */ new Set();
13150
+ const originalAdd = all.add.bind(all);
13151
+ const add = function add2(r) {
13152
+ if (all.has(r)) return all;
13153
+ if (isReservedRuntimeGlobal(r)) return originalAdd(r);
13154
+ customRuntimeGlobals.add(r);
13155
+ return originalAdd(r);
13156
+ };
13157
+ all.add = add.bind(add);
13180
13158
  for (const r of set) {
13181
13159
  queried.for(r).call(chunk, all);
13182
13160
  }
13161
+ for (const r of customRuntimeGlobals) {
13162
+ queried.for(r).call(chunk, all);
13163
+ }
13183
13164
  return {
13184
13165
  allRuntimeRequirements: __to_binding_runtime_globals(all)
13185
13166
  };
@@ -18338,6 +18319,13 @@ var RspackOptionsApply = class {
18338
18319
  // src/ContextModule.ts
18339
18320
  var binding11 = __toESM(require("@rspack/binding"));
18340
18321
  var import_binding80 = require("@rspack/binding");
18322
+ Object.defineProperty(binding11.ContextModule.prototype, "identifier", {
18323
+ enumerable: true,
18324
+ configurable: true,
18325
+ value() {
18326
+ return this[binding11.MODULE_IDENTIFIER_SYMBOL];
18327
+ }
18328
+ });
18341
18329
  Object.defineProperty(binding11.ContextModule.prototype, "originalSource", {
18342
18330
  enumerable: true,
18343
18331
  configurable: true,
@@ -18360,6 +18348,13 @@ Object.defineProperty(binding11.ContextModule.prototype, "emitFile", {
18360
18348
  // src/ConcatenatedModule.ts
18361
18349
  var binding12 = __toESM(require("@rspack/binding"));
18362
18350
  var import_binding81 = require("@rspack/binding");
18351
+ Object.defineProperty(binding12.ConcatenatedModule.prototype, "identifier", {
18352
+ enumerable: true,
18353
+ configurable: true,
18354
+ value() {
18355
+ return this[binding12.MODULE_IDENTIFIER_SYMBOL];
18356
+ }
18357
+ });
18363
18358
  Object.defineProperty(binding12.ConcatenatedModule.prototype, "originalSource", {
18364
18359
  enumerable: true,
18365
18360
  configurable: true,
@@ -18382,6 +18377,13 @@ Object.defineProperty(binding12.ConcatenatedModule.prototype, "emitFile", {
18382
18377
  // src/ExternalModule.ts
18383
18378
  var binding13 = __toESM(require("@rspack/binding"));
18384
18379
  var import_binding82 = require("@rspack/binding");
18380
+ Object.defineProperty(binding13.ExternalModule.prototype, "identifier", {
18381
+ enumerable: true,
18382
+ configurable: true,
18383
+ value() {
18384
+ return this[binding13.MODULE_IDENTIFIER_SYMBOL];
18385
+ }
18386
+ });
18385
18387
  Object.defineProperty(binding13.ExternalModule.prototype, "originalSource", {
18386
18388
  enumerable: true,
18387
18389
  configurable: true,
@@ -21280,6 +21282,7 @@ module.exports = rspack;
21280
21282
  LightningCssMinimizerRspackPlugin,
21281
21283
  LoaderOptionsPlugin,
21282
21284
  LoaderTargetPlugin,
21285
+ Module,
21283
21286
  ModuleFilenameHelpers,
21284
21287
  MultiCompiler,
21285
21288
  MultiStats,
@@ -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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -57,14 +57,14 @@
57
57
  "webpack-sources": "3.2.3",
58
58
  "zod": "^3.24.2",
59
59
  "zod-validation-error": "3.4.0",
60
- "@rspack/tracing": "1.3.2"
60
+ "tinypool": "^1.0.2",
61
+ "@rspack/tracing": "1.3.4"
61
62
  },
62
63
  "dependencies": {
63
64
  "@module-federation/runtime-tools": "0.11.2",
64
65
  "@rspack/lite-tapable": "1.0.1",
65
66
  "caniuse-lite": "^1.0.30001707",
66
- "tinypool": "^1.0.2",
67
- "@rspack/binding": "1.3.2"
67
+ "@rspack/binding": "1.3.4"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@rspack/tracing": "^1.x",
@@ -1,12 +0,0 @@
1
- import type { Dependency, JsModuleGraphConnection } from "@rspack/binding";
2
- import type { Module } from "./Module";
3
- export declare class ModuleGraphConnection {
4
- #private;
5
- readonly module: Module | null;
6
- readonly dependency: Dependency;
7
- readonly resolvedModule: Module | null;
8
- readonly originModule: Module | null;
9
- static __from_binding(binding: JsModuleGraphConnection): ModuleGraphConnection;
10
- static __to_binding(data: ModuleGraphConnection): JsModuleGraphConnection;
11
- private constructor();
12
- }