@rspack/core 1.3.3 → 1.3.5
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/enhanced-resolve/index.d.ts +2 -1
- package/compiled/zod/index.d.ts +8 -6
- package/dist/Compilation.d.ts +3 -1
- package/dist/Module.d.ts +1 -0
- package/dist/ModuleGraph.d.ts +1 -2
- package/dist/NormalModule.d.ts +2 -2
- package/dist/exports.d.ts +2 -1
- package/dist/index.js +322 -352
- package/dist/util/hash/BatchedHash.d.ts +2 -6
- package/dist/util/hash/index.d.ts +15 -6
- package/dist/worker.js +53 -93
- package/package.json +4 -4
- package/dist/ModuleGraphConnection.d.ts +0 -12
@@ -20,10 +20,6 @@ export default class BatchedHash extends Hash {
|
|
20
20
|
* @returns updated hash
|
21
21
|
*/
|
22
22
|
update(data: string | Buffer, inputEncoding?: string): this;
|
23
|
-
|
24
|
-
|
25
|
-
* @param encoding encoding of the return value
|
26
|
-
* @returns digest
|
27
|
-
*/
|
28
|
-
digest(encoding?: string): string | Buffer;
|
23
|
+
digest(): Buffer;
|
24
|
+
digest(encoding: string): string;
|
29
25
|
}
|
@@ -1,17 +1,26 @@
|
|
1
1
|
export default class Hash {
|
2
2
|
/**
|
3
|
-
* Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
|
4
|
-
* @abstract
|
5
3
|
* @param data data
|
6
4
|
* @param inputEncoding data encoding
|
7
5
|
* @returns updated hash
|
8
6
|
*/
|
9
|
-
update(data: string
|
7
|
+
update(data: string, inputEncoding: string): this;
|
8
|
+
/**
|
9
|
+
* @param data data
|
10
|
+
* @returns updated hash
|
11
|
+
*/
|
12
|
+
update(data: Buffer): this;
|
13
|
+
/**
|
14
|
+
* Calculates the digest without encoding
|
15
|
+
* @abstract
|
16
|
+
* @returns {Buffer} digest
|
17
|
+
*/
|
18
|
+
digest(): Buffer;
|
10
19
|
/**
|
11
|
-
* Calculates the digest
|
20
|
+
* Calculates the digest with encoding
|
12
21
|
* @abstract
|
13
22
|
* @param encoding encoding of the return value
|
14
|
-
* @returns
|
23
|
+
* @returns {string} digest
|
15
24
|
*/
|
16
|
-
digest(encoding
|
25
|
+
digest(encoding: string): string;
|
17
26
|
}
|
package/dist/worker.js
CHANGED
@@ -99,9 +99,8 @@ var init_hash = __esm({
|
|
99
99
|
/* istanbul ignore next */
|
100
100
|
/**
|
101
101
|
* Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
|
102
|
-
* @
|
103
|
-
* @
|
104
|
-
* @returns digest
|
102
|
+
* @param {string=} encoding encoding of the return value
|
103
|
+
* @returns {string|Buffer} digest
|
105
104
|
*/
|
106
105
|
digest(encoding) {
|
107
106
|
throw new AbstractMethodError_default();
|
@@ -263,63 +262,6 @@ var init_wasm_hash = __esm({
|
|
263
262
|
}
|
264
263
|
});
|
265
264
|
|
266
|
-
// src/util/hash/BatchedHash.ts
|
267
|
-
var BatchedHash;
|
268
|
-
var init_BatchedHash = __esm({
|
269
|
-
"src/util/hash/BatchedHash.ts"() {
|
270
|
-
"use strict";
|
271
|
-
init_hash();
|
272
|
-
init_wasm_hash();
|
273
|
-
BatchedHash = class extends Hash {
|
274
|
-
constructor(hash) {
|
275
|
-
super();
|
276
|
-
this.string = void 0;
|
277
|
-
this.encoding = void 0;
|
278
|
-
this.hash = hash;
|
279
|
-
}
|
280
|
-
/**
|
281
|
-
* Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
|
282
|
-
* @param data data
|
283
|
-
* @param inputEncoding data encoding
|
284
|
-
* @returns updated hash
|
285
|
-
*/
|
286
|
-
update(data, inputEncoding) {
|
287
|
-
if (this.string !== void 0) {
|
288
|
-
if (typeof data === "string" && inputEncoding === this.encoding && this.string.length + data.length < MAX_SHORT_STRING) {
|
289
|
-
this.string += data;
|
290
|
-
return this;
|
291
|
-
}
|
292
|
-
this.hash.update(this.string, this.encoding);
|
293
|
-
this.string = void 0;
|
294
|
-
}
|
295
|
-
if (typeof data === "string") {
|
296
|
-
if (data.length < MAX_SHORT_STRING && // base64 encoding is not valid since it may contain padding chars
|
297
|
-
(!inputEncoding || !inputEncoding.startsWith("ba"))) {
|
298
|
-
this.string = data;
|
299
|
-
this.encoding = inputEncoding;
|
300
|
-
} else {
|
301
|
-
this.hash.update(data, inputEncoding);
|
302
|
-
}
|
303
|
-
} else {
|
304
|
-
this.hash.update(data);
|
305
|
-
}
|
306
|
-
return this;
|
307
|
-
}
|
308
|
-
/**
|
309
|
-
* Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
|
310
|
-
* @param encoding encoding of the return value
|
311
|
-
* @returns digest
|
312
|
-
*/
|
313
|
-
digest(encoding) {
|
314
|
-
if (this.string !== void 0) {
|
315
|
-
this.hash.update(this.string, this.encoding);
|
316
|
-
}
|
317
|
-
return this.hash.digest(encoding);
|
318
|
-
}
|
319
|
-
};
|
320
|
-
}
|
321
|
-
});
|
322
|
-
|
323
265
|
// src/util/hash/md4.ts
|
324
266
|
var createMd4, md4_default;
|
325
267
|
var init_md4 = __esm({
|
@@ -369,13 +311,12 @@ var createHash_exports = {};
|
|
369
311
|
__export(createHash_exports, {
|
370
312
|
createHash: () => createHash
|
371
313
|
});
|
372
|
-
var import_node_crypto, BULK_SIZE, digestCaches, BulkUpdateDecorator, DebugHash, createHash;
|
314
|
+
var import_node_crypto, BULK_SIZE, digestCaches, BulkUpdateDecorator, DebugHash, WasmHashAdapter, createHash;
|
373
315
|
var init_createHash = __esm({
|
374
316
|
"src/util/createHash.ts"() {
|
375
317
|
"use strict";
|
376
318
|
import_node_crypto = __toESM(require("crypto"));
|
377
319
|
init_hash();
|
378
|
-
init_BatchedHash();
|
379
320
|
init_md4();
|
380
321
|
init_xxhash64();
|
381
322
|
BULK_SIZE = 2e3;
|
@@ -397,25 +338,23 @@ var init_createHash = __esm({
|
|
397
338
|
}
|
398
339
|
this.buffer = "";
|
399
340
|
}
|
400
|
-
/**
|
401
|
-
* Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
|
402
|
-
* @param data data
|
403
|
-
* @param inputEncoding data encoding
|
404
|
-
* @returns updated hash
|
405
|
-
*/
|
406
341
|
update(data, inputEncoding) {
|
407
342
|
if (inputEncoding !== void 0 || typeof data !== "string" || data.length > BULK_SIZE) {
|
408
343
|
if (this.hash === void 0) this.hash = this.hashFactory();
|
409
344
|
if (this.buffer.length > 0) {
|
410
|
-
this.hash.update(this.buffer);
|
345
|
+
this.hash.update(Buffer.from(this.buffer));
|
411
346
|
this.buffer = "";
|
412
347
|
}
|
413
|
-
|
348
|
+
if (Buffer.isBuffer(data)) {
|
349
|
+
this.hash.update(data);
|
350
|
+
} else {
|
351
|
+
this.hash.update(data, inputEncoding);
|
352
|
+
}
|
414
353
|
} else {
|
415
354
|
this.buffer += data;
|
416
355
|
if (this.buffer.length > BULK_SIZE) {
|
417
356
|
if (this.hash === void 0) this.hash = this.hashFactory();
|
418
|
-
this.hash.update(this.buffer);
|
357
|
+
this.hash.update(Buffer.from(this.buffer));
|
419
358
|
this.buffer = "";
|
420
359
|
}
|
421
360
|
}
|
@@ -423,8 +362,8 @@ var init_createHash = __esm({
|
|
423
362
|
}
|
424
363
|
/**
|
425
364
|
* Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
|
426
|
-
* @param encoding encoding of the return value
|
427
|
-
* @returns digest
|
365
|
+
* @param {string=} encoding encoding of the return value
|
366
|
+
* @returns {string|Buffer} digest
|
428
367
|
*/
|
429
368
|
digest(encoding) {
|
430
369
|
let digestCache;
|
@@ -436,15 +375,15 @@ var init_createHash = __esm({
|
|
436
375
|
digestCache = digestCaches[cacheKey] = /* @__PURE__ */ new Map();
|
437
376
|
}
|
438
377
|
const cacheEntry = digestCache.get(buffer);
|
439
|
-
if (cacheEntry !== void 0)
|
378
|
+
if (cacheEntry !== void 0)
|
379
|
+
return encoding ? cacheEntry : Buffer.from(cacheEntry, "hex");
|
440
380
|
this.hash = this.hashFactory();
|
441
381
|
}
|
442
382
|
if (buffer.length > 0) {
|
443
|
-
this.hash.update(buffer);
|
383
|
+
this.hash.update(Buffer.from(buffer));
|
444
384
|
}
|
445
|
-
const
|
446
|
-
|
447
|
-
if (digestCache !== void 0) {
|
385
|
+
const result = encoding ? this.hash.digest(encoding) : this.hash.digest();
|
386
|
+
if (digestCache !== void 0 && typeof result === "string") {
|
448
387
|
digestCache.set(buffer, result);
|
449
388
|
}
|
450
389
|
return result;
|
@@ -455,16 +394,10 @@ var init_createHash = __esm({
|
|
455
394
|
super();
|
456
395
|
this.string = "";
|
457
396
|
}
|
458
|
-
|
459
|
-
* Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
|
460
|
-
* @param data data
|
461
|
-
* @param _inputEncoding data encoding
|
462
|
-
* @returns updated hash
|
463
|
-
*/
|
464
|
-
update(data, _inputEncoding) {
|
397
|
+
update(data, inputEncoding) {
|
465
398
|
var _a;
|
466
399
|
let normalizedData;
|
467
|
-
if (
|
400
|
+
if (Buffer.isBuffer(data)) {
|
468
401
|
normalizedData = data.toString("utf-8");
|
469
402
|
} else {
|
470
403
|
normalizedData = data;
|
@@ -481,11 +414,34 @@ var init_createHash = __esm({
|
|
481
414
|
}
|
482
415
|
/**
|
483
416
|
* Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
|
484
|
-
* @param encoding encoding of the return value
|
485
|
-
* @returns digest
|
417
|
+
* @param {string=} encoding encoding of the return value
|
418
|
+
* @returns {string|Buffer} digest
|
486
419
|
*/
|
487
420
|
digest(encoding) {
|
488
|
-
|
421
|
+
const result = `debug-digest-${Buffer.from(this.string).toString("hex")}`;
|
422
|
+
return encoding ? result : Buffer.from(result);
|
423
|
+
}
|
424
|
+
};
|
425
|
+
WasmHashAdapter = class extends Hash {
|
426
|
+
constructor(wasmHash) {
|
427
|
+
super();
|
428
|
+
this.wasmHash = wasmHash;
|
429
|
+
}
|
430
|
+
update(data, inputEncoding) {
|
431
|
+
if (Buffer.isBuffer(data)) {
|
432
|
+
this.wasmHash.update(data);
|
433
|
+
} else {
|
434
|
+
this.wasmHash.update(data, inputEncoding);
|
435
|
+
}
|
436
|
+
return this;
|
437
|
+
}
|
438
|
+
/**
|
439
|
+
* Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding}
|
440
|
+
* @param {string=} encoding encoding of the return value
|
441
|
+
* @returns {string|Buffer} digest
|
442
|
+
*/
|
443
|
+
digest(encoding) {
|
444
|
+
return encoding ? this.wasmHash.digest(encoding) : this.wasmHash.digest();
|
489
445
|
}
|
490
446
|
};
|
491
447
|
createHash = (algorithm) => {
|
@@ -496,10 +452,14 @@ var init_createHash = __esm({
|
|
496
452
|
// TODO add non-cryptographic algorithm here
|
497
453
|
case "debug":
|
498
454
|
return new DebugHash();
|
499
|
-
case "xxhash64":
|
500
|
-
|
501
|
-
|
502
|
-
|
455
|
+
case "xxhash64": {
|
456
|
+
const hash = xxhash64_default();
|
457
|
+
return new WasmHashAdapter(hash);
|
458
|
+
}
|
459
|
+
case "md4": {
|
460
|
+
const hash = md4_default();
|
461
|
+
return new WasmHashAdapter(hash);
|
462
|
+
}
|
503
463
|
case "native-md4":
|
504
464
|
return new BulkUpdateDecorator(() => import_node_crypto.default.createHash("md4"), "md4");
|
505
465
|
default:
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspack/core",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.5",
|
4
4
|
"webpackVersion": "5.75.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
@@ -47,7 +47,7 @@
|
|
47
47
|
"enhanced-resolve": "5.18.1",
|
48
48
|
"graceful-fs": "^4.2.11",
|
49
49
|
"json-parse-even-better-errors": "^3.0.2",
|
50
|
-
"prebundle": "^1.
|
50
|
+
"prebundle": "^1.3.3",
|
51
51
|
"tsc-alias": "^1.8.13",
|
52
52
|
"tsup": "^8.4.0",
|
53
53
|
"tsx": "^4.19.3",
|
@@ -58,13 +58,13 @@
|
|
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.
|
61
|
+
"@rspack/tracing": "1.3.5"
|
62
62
|
},
|
63
63
|
"dependencies": {
|
64
64
|
"@module-federation/runtime-tools": "0.11.2",
|
65
65
|
"@rspack/lite-tapable": "1.0.1",
|
66
66
|
"caniuse-lite": "^1.0.30001707",
|
67
|
-
"@rspack/binding": "1.3.
|
67
|
+
"@rspack/binding": "1.3.5"
|
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
|
-
}
|