@rollup/wasm-node 4.9.5 → 4.10.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/dist/bin/rollup +88 -50
- package/dist/es/getLogFilter.js +2 -2
- package/dist/es/parseAst.js +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +105 -42
- package/dist/es/shared/parseAst.js +322 -361
- package/dist/es/shared/watch.js +6 -3
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/native.js +8 -1
- package/dist/parseAst.js +2 -2
- package/dist/rollup.d.ts +4 -0
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +6 -3
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +322 -361
- package/dist/shared/rollup.js +104 -41
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/dist/wasm-node/bindings_wasm.js +57 -14
- package/dist/wasm-node/bindings_wasm_bg.wasm +0 -0
- package/package.json +29 -27
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.10.0
|
|
4
|
+
Sat, 10 Feb 2024 05:58:12 GMT - commit 762420860765e8e46e24d48b38f5b98ca31735fa
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
|
|
|
31
31
|
|
|
32
32
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
33
33
|
|
|
34
|
-
var version = "4.
|
|
34
|
+
var version = "4.10.0";
|
|
35
35
|
|
|
36
36
|
function ensureArray$1(items) {
|
|
37
37
|
if (Array.isArray(items)) {
|
|
@@ -51,21 +51,23 @@ var BuildPhase;
|
|
|
51
51
|
})(BuildPhase || (BuildPhase = {}));
|
|
52
52
|
|
|
53
53
|
let textEncoder;
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const getHash64 = input => native_js.xxhashBase64Url(ensureBuffer(input));
|
|
55
|
+
const getHash36 = input => native_js.xxhashBase36(ensureBuffer(input));
|
|
56
|
+
const getHash16 = input => native_js.xxhashBase16(ensureBuffer(input));
|
|
57
|
+
const hasherByType = {
|
|
58
|
+
base36: getHash36,
|
|
59
|
+
base64: getHash64,
|
|
60
|
+
hex: getHash16
|
|
61
|
+
};
|
|
62
|
+
function ensureBuffer(input) {
|
|
56
63
|
if (typeof input === 'string') {
|
|
57
64
|
if (typeof Buffer === 'undefined') {
|
|
58
65
|
textEncoder ??= new TextEncoder();
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
buffer = Buffer.from(input);
|
|
66
|
+
return textEncoder.encode(input);
|
|
63
67
|
}
|
|
68
|
+
return Buffer.from(input);
|
|
64
69
|
}
|
|
65
|
-
|
|
66
|
-
buffer = input;
|
|
67
|
-
}
|
|
68
|
-
return native_js.xxhashBase64Url(buffer);
|
|
70
|
+
return input;
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
function getOrCreate(map, key, init) {
|
|
@@ -102,13 +104,13 @@ const hashPlaceholderLeft = '!~{';
|
|
|
102
104
|
const hashPlaceholderRight = '}~';
|
|
103
105
|
const hashPlaceholderOverhead = hashPlaceholderLeft.length + hashPlaceholderRight.length;
|
|
104
106
|
// This is the size of a 128-bits xxhash with base64url encoding
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
+
const MAX_HASH_SIZE = 22;
|
|
108
|
+
const DEFAULT_HASH_SIZE = 8;
|
|
107
109
|
const getHashPlaceholderGenerator = () => {
|
|
108
110
|
let nextIndex = 0;
|
|
109
|
-
return (optionName, hashSize
|
|
110
|
-
if (hashSize >
|
|
111
|
-
return parseAst_js.error(parseAst_js.logFailedValidation(`Hashes cannot be longer than ${
|
|
111
|
+
return (optionName, hashSize) => {
|
|
112
|
+
if (hashSize > MAX_HASH_SIZE) {
|
|
113
|
+
return parseAst_js.error(parseAst_js.logFailedValidation(`Hashes cannot be longer than ${MAX_HASH_SIZE} characters, received ${hashSize}. Check the "${optionName}" option.`));
|
|
112
114
|
}
|
|
113
115
|
const placeholder = `${hashPlaceholderLeft}${toBase64(++nextIndex).padStart(hashSize - hashPlaceholderOverhead, '0')}${hashPlaceholderRight}`;
|
|
114
116
|
if (placeholder.length > hashSize) {
|
|
@@ -117,7 +119,7 @@ const getHashPlaceholderGenerator = () => {
|
|
|
117
119
|
return placeholder;
|
|
118
120
|
};
|
|
119
121
|
};
|
|
120
|
-
const REPLACER_REGEX = new RegExp(`${hashPlaceholderLeft}[0-9a-zA-Z_$]{1,${
|
|
122
|
+
const REPLACER_REGEX = new RegExp(`${hashPlaceholderLeft}[0-9a-zA-Z_$]{1,${MAX_HASH_SIZE - hashPlaceholderOverhead}}${hashPlaceholderRight}`, 'g');
|
|
121
123
|
const replacePlaceholders = (code, hashesByPlaceholder) => code.replace(REPLACER_REGEX, placeholder => hashesByPlaceholder.get(placeholder) || placeholder);
|
|
122
124
|
const replaceSinglePlaceholder = (code, placeholder, value) => code.replace(REPLACER_REGEX, match => (match === placeholder ? value : match));
|
|
123
125
|
const replacePlaceholdersWithDefaultAndGetContainedPlaceholders = (code, placeholders) => {
|
|
@@ -208,7 +210,7 @@ function generateAssetFileName(name, source, sourceHash, outputOptions, bundle)
|
|
|
208
210
|
: outputOptions.assetFileNames, 'output.assetFileNames', {
|
|
209
211
|
ext: () => node_path.extname(emittedName).slice(1),
|
|
210
212
|
extname: () => node_path.extname(emittedName),
|
|
211
|
-
hash: size => sourceHash.slice(0, Math.max(0, size ||
|
|
213
|
+
hash: size => sourceHash.slice(0, Math.max(0, size || DEFAULT_HASH_SIZE)),
|
|
212
214
|
name: () => emittedName.slice(0, Math.max(0, emittedName.length - node_path.extname(emittedName).length))
|
|
213
215
|
}), bundle);
|
|
214
216
|
}
|
|
@@ -317,9 +319,11 @@ class FileEmitter {
|
|
|
317
319
|
this.facadeChunkByModule = facadeChunkByModule;
|
|
318
320
|
};
|
|
319
321
|
this.setOutputBundle = (bundle, outputOptions) => {
|
|
322
|
+
const getHash = hasherByType[outputOptions.hashCharacters];
|
|
320
323
|
const output = (this.output = {
|
|
321
324
|
bundle,
|
|
322
325
|
fileNamesBySource: new Map(),
|
|
326
|
+
getHash,
|
|
323
327
|
outputOptions
|
|
324
328
|
});
|
|
325
329
|
for (const emittedFile of this.filesByReferenceId.values()) {
|
|
@@ -334,7 +338,7 @@ class FileEmitter {
|
|
|
334
338
|
this.finalizeAdditionalAsset(consumedFile, consumedFile.source, output);
|
|
335
339
|
}
|
|
336
340
|
else {
|
|
337
|
-
const sourceHash =
|
|
341
|
+
const sourceHash = getHash(consumedFile.source);
|
|
338
342
|
getOrCreate(consumedAssetsByHash, sourceHash, () => []).push(consumedFile);
|
|
339
343
|
}
|
|
340
344
|
}
|
|
@@ -357,7 +361,7 @@ class FileEmitter {
|
|
|
357
361
|
assignReferenceId(file, idBase) {
|
|
358
362
|
let referenceId = idBase;
|
|
359
363
|
do {
|
|
360
|
-
referenceId =
|
|
364
|
+
referenceId = getHash64(referenceId).slice(0, 8).replaceAll('-', '$');
|
|
361
365
|
} while (this.filesByReferenceId.has(referenceId) ||
|
|
362
366
|
this.outputFileEmitters.some(({ filesByReferenceId }) => filesByReferenceId.has(referenceId)));
|
|
363
367
|
file.referenceId = referenceId;
|
|
@@ -468,11 +472,11 @@ class FileEmitter {
|
|
|
468
472
|
}
|
|
469
473
|
return referenceId;
|
|
470
474
|
}
|
|
471
|
-
finalizeAdditionalAsset(consumedFile, source, { bundle, fileNamesBySource, outputOptions }) {
|
|
475
|
+
finalizeAdditionalAsset(consumedFile, source, { bundle, fileNamesBySource, getHash, outputOptions }) {
|
|
472
476
|
let { fileName, needsCodeReference, referenceId } = consumedFile;
|
|
473
477
|
// Deduplicate assets if an explicit fileName is not provided
|
|
474
478
|
if (!fileName) {
|
|
475
|
-
const sourceHash =
|
|
479
|
+
const sourceHash = getHash(source);
|
|
476
480
|
fileName = fileNamesBySource.get(sourceHash);
|
|
477
481
|
if (!fileName) {
|
|
478
482
|
fileName = generateAssetFileName(consumedFile.name, source, sourceHash, outputOptions, bundle);
|
|
@@ -1275,6 +1279,7 @@ async function mergeOutputOptions(config, overrides, log) {
|
|
|
1275
1279
|
freeze: getOption('freeze'),
|
|
1276
1280
|
generatedCode: getObjectOption(config, overrides, 'generatedCode', objectifyOptionWithPresets(generatedCodePresets, 'output.generatedCode', parseAst_js.URL_OUTPUT_GENERATEDCODE, '')),
|
|
1277
1281
|
globals: getOption('globals'),
|
|
1282
|
+
hashCharacters: getOption('hashCharacters'),
|
|
1278
1283
|
hoistTransitiveImports: getOption('hoistTransitiveImports'),
|
|
1279
1284
|
indent: getOption('indent'),
|
|
1280
1285
|
inlineDynamicImports: getOption('inlineDynamicImports'),
|
|
@@ -1745,6 +1750,16 @@ let Chunk$1 = class Chunk {
|
|
|
1745
1750
|
this.intro = content + this.intro;
|
|
1746
1751
|
}
|
|
1747
1752
|
|
|
1753
|
+
reset() {
|
|
1754
|
+
this.intro = '';
|
|
1755
|
+
this.outro = '';
|
|
1756
|
+
if (this.edited) {
|
|
1757
|
+
this.content = this.original;
|
|
1758
|
+
this.storeName = false;
|
|
1759
|
+
this.edited = false;
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1748
1763
|
split(index) {
|
|
1749
1764
|
const sliceIndex = index - this.start;
|
|
1750
1765
|
|
|
@@ -1835,8 +1850,8 @@ let Chunk$1 = class Chunk {
|
|
|
1835
1850
|
};
|
|
1836
1851
|
|
|
1837
1852
|
function getBtoa() {
|
|
1838
|
-
if (typeof
|
|
1839
|
-
return (str) =>
|
|
1853
|
+
if (typeof globalThis !== 'undefined' && typeof globalThis.btoa === 'function') {
|
|
1854
|
+
return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
|
|
1840
1855
|
} else if (typeof Buffer === 'function') {
|
|
1841
1856
|
return (str) => Buffer.from(str, 'utf-8').toString('base64');
|
|
1842
1857
|
} else {
|
|
@@ -2513,6 +2528,28 @@ class MagicString {
|
|
|
2513
2528
|
return this;
|
|
2514
2529
|
}
|
|
2515
2530
|
|
|
2531
|
+
reset(start, end) {
|
|
2532
|
+
while (start < 0) start += this.original.length;
|
|
2533
|
+
while (end < 0) end += this.original.length;
|
|
2534
|
+
|
|
2535
|
+
if (start === end) return this;
|
|
2536
|
+
|
|
2537
|
+
if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');
|
|
2538
|
+
if (start > end) throw new Error('end must be greater than start');
|
|
2539
|
+
|
|
2540
|
+
this._split(start);
|
|
2541
|
+
this._split(end);
|
|
2542
|
+
|
|
2543
|
+
let chunk = this.byStart[start];
|
|
2544
|
+
|
|
2545
|
+
while (chunk) {
|
|
2546
|
+
chunk.reset();
|
|
2547
|
+
|
|
2548
|
+
chunk = end > chunk.end ? this.byStart[chunk.end] : null;
|
|
2549
|
+
}
|
|
2550
|
+
return this;
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2516
2553
|
lastChar() {
|
|
2517
2554
|
if (this.outro.length) return this.outro[this.outro.length - 1];
|
|
2518
2555
|
let chunk = this.lastChunk;
|
|
@@ -6268,8 +6305,15 @@ class Method extends ExpressionEntity {
|
|
|
6268
6305
|
this.description = description;
|
|
6269
6306
|
}
|
|
6270
6307
|
deoptimizeArgumentsOnInteractionAtPath({ args, type }, path) {
|
|
6271
|
-
if (type === INTERACTION_CALLED && path.length === 0
|
|
6272
|
-
|
|
6308
|
+
if (type === INTERACTION_CALLED && path.length === 0) {
|
|
6309
|
+
if (this.description.mutatesSelfAsArray) {
|
|
6310
|
+
args[0]?.deoptimizePath(UNKNOWN_INTEGER_PATH);
|
|
6311
|
+
}
|
|
6312
|
+
if (this.description.mutatesArgs) {
|
|
6313
|
+
for (let index = 1; index < args.length; index++) {
|
|
6314
|
+
args[index].deoptimizePath(UNKNOWN_PATH);
|
|
6315
|
+
}
|
|
6316
|
+
}
|
|
6273
6317
|
}
|
|
6274
6318
|
}
|
|
6275
6319
|
getReturnExpressionWhenCalledAtPath(path, { args }) {
|
|
@@ -6309,6 +6353,7 @@ class Method extends ExpressionEntity {
|
|
|
6309
6353
|
const METHOD_RETURNS_BOOLEAN = [
|
|
6310
6354
|
new Method({
|
|
6311
6355
|
callsArgs: null,
|
|
6356
|
+
mutatesArgs: false,
|
|
6312
6357
|
mutatesSelfAsArray: false,
|
|
6313
6358
|
returns: null,
|
|
6314
6359
|
returnsPrimitive: UNKNOWN_LITERAL_BOOLEAN
|
|
@@ -6317,6 +6362,7 @@ const METHOD_RETURNS_BOOLEAN = [
|
|
|
6317
6362
|
const METHOD_RETURNS_STRING = [
|
|
6318
6363
|
new Method({
|
|
6319
6364
|
callsArgs: null,
|
|
6365
|
+
mutatesArgs: false,
|
|
6320
6366
|
mutatesSelfAsArray: false,
|
|
6321
6367
|
returns: null,
|
|
6322
6368
|
returnsPrimitive: UNKNOWN_LITERAL_STRING
|
|
@@ -6325,6 +6371,7 @@ const METHOD_RETURNS_STRING = [
|
|
|
6325
6371
|
const METHOD_RETURNS_NUMBER = [
|
|
6326
6372
|
new Method({
|
|
6327
6373
|
callsArgs: null,
|
|
6374
|
+
mutatesArgs: false,
|
|
6328
6375
|
mutatesSelfAsArray: false,
|
|
6329
6376
|
returns: null,
|
|
6330
6377
|
returnsPrimitive: UNKNOWN_LITERAL_NUMBER
|
|
@@ -6333,6 +6380,7 @@ const METHOD_RETURNS_NUMBER = [
|
|
|
6333
6380
|
const METHOD_RETURNS_UNKNOWN = [
|
|
6334
6381
|
new Method({
|
|
6335
6382
|
callsArgs: null,
|
|
6383
|
+
mutatesArgs: false,
|
|
6336
6384
|
mutatesSelfAsArray: false,
|
|
6337
6385
|
returns: null,
|
|
6338
6386
|
returnsPrimitive: UNKNOWN_EXPRESSION
|
|
@@ -6747,6 +6795,7 @@ const NEW_ARRAY_PROPERTIES = [
|
|
|
6747
6795
|
const METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_BOOLEAN = [
|
|
6748
6796
|
new Method({
|
|
6749
6797
|
callsArgs: [0],
|
|
6798
|
+
mutatesArgs: false,
|
|
6750
6799
|
mutatesSelfAsArray: 'deopt-only',
|
|
6751
6800
|
returns: null,
|
|
6752
6801
|
returnsPrimitive: UNKNOWN_LITERAL_BOOLEAN
|
|
@@ -6755,6 +6804,7 @@ const METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_BOOLEAN = [
|
|
|
6755
6804
|
const METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER = [
|
|
6756
6805
|
new Method({
|
|
6757
6806
|
callsArgs: [0],
|
|
6807
|
+
mutatesArgs: false,
|
|
6758
6808
|
mutatesSelfAsArray: 'deopt-only',
|
|
6759
6809
|
returns: null,
|
|
6760
6810
|
returnsPrimitive: UNKNOWN_LITERAL_NUMBER
|
|
@@ -6763,6 +6813,7 @@ const METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER = [
|
|
|
6763
6813
|
const METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY = [
|
|
6764
6814
|
new Method({
|
|
6765
6815
|
callsArgs: null,
|
|
6816
|
+
mutatesArgs: false,
|
|
6766
6817
|
mutatesSelfAsArray: true,
|
|
6767
6818
|
returns: () => new ObjectEntity(NEW_ARRAY_PROPERTIES, ARRAY_PROTOTYPE),
|
|
6768
6819
|
returnsPrimitive: null
|
|
@@ -6771,6 +6822,7 @@ const METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY = [
|
|
|
6771
6822
|
const METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY = [
|
|
6772
6823
|
new Method({
|
|
6773
6824
|
callsArgs: null,
|
|
6825
|
+
mutatesArgs: false,
|
|
6774
6826
|
mutatesSelfAsArray: 'deopt-only',
|
|
6775
6827
|
returns: () => new ObjectEntity(NEW_ARRAY_PROPERTIES, ARRAY_PROTOTYPE),
|
|
6776
6828
|
returnsPrimitive: null
|
|
@@ -6779,14 +6831,16 @@ const METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY = [
|
|
|
6779
6831
|
const METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY = [
|
|
6780
6832
|
new Method({
|
|
6781
6833
|
callsArgs: [0],
|
|
6834
|
+
mutatesArgs: false,
|
|
6782
6835
|
mutatesSelfAsArray: 'deopt-only',
|
|
6783
6836
|
returns: () => new ObjectEntity(NEW_ARRAY_PROPERTIES, ARRAY_PROTOTYPE),
|
|
6784
6837
|
returnsPrimitive: null
|
|
6785
6838
|
})
|
|
6786
6839
|
];
|
|
6787
|
-
const
|
|
6840
|
+
const METHOD_MUTATES_SELF_AND_ARGS_RETURNS_NUMBER = [
|
|
6788
6841
|
new Method({
|
|
6789
6842
|
callsArgs: null,
|
|
6843
|
+
mutatesArgs: true,
|
|
6790
6844
|
mutatesSelfAsArray: true,
|
|
6791
6845
|
returns: null,
|
|
6792
6846
|
returnsPrimitive: UNKNOWN_LITERAL_NUMBER
|
|
@@ -6795,6 +6849,7 @@ const METHOD_MUTATES_SELF_RETURNS_NUMBER = [
|
|
|
6795
6849
|
const METHOD_MUTATES_SELF_RETURNS_UNKNOWN = [
|
|
6796
6850
|
new Method({
|
|
6797
6851
|
callsArgs: null,
|
|
6852
|
+
mutatesArgs: false,
|
|
6798
6853
|
mutatesSelfAsArray: true,
|
|
6799
6854
|
returns: null,
|
|
6800
6855
|
returnsPrimitive: UNKNOWN_EXPRESSION
|
|
@@ -6803,6 +6858,7 @@ const METHOD_MUTATES_SELF_RETURNS_UNKNOWN = [
|
|
|
6803
6858
|
const METHOD_DEOPTS_SELF_RETURNS_UNKNOWN = [
|
|
6804
6859
|
new Method({
|
|
6805
6860
|
callsArgs: null,
|
|
6861
|
+
mutatesArgs: false,
|
|
6806
6862
|
mutatesSelfAsArray: 'deopt-only',
|
|
6807
6863
|
returns: null,
|
|
6808
6864
|
returnsPrimitive: UNKNOWN_EXPRESSION
|
|
@@ -6811,6 +6867,7 @@ const METHOD_DEOPTS_SELF_RETURNS_UNKNOWN = [
|
|
|
6811
6867
|
const METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN = [
|
|
6812
6868
|
new Method({
|
|
6813
6869
|
callsArgs: [0],
|
|
6870
|
+
mutatesArgs: false,
|
|
6814
6871
|
mutatesSelfAsArray: 'deopt-only',
|
|
6815
6872
|
returns: null,
|
|
6816
6873
|
returnsPrimitive: UNKNOWN_EXPRESSION
|
|
@@ -6819,6 +6876,7 @@ const METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN = [
|
|
|
6819
6876
|
const METHOD_MUTATES_SELF_RETURNS_SELF = [
|
|
6820
6877
|
new Method({
|
|
6821
6878
|
callsArgs: null,
|
|
6879
|
+
mutatesArgs: false,
|
|
6822
6880
|
mutatesSelfAsArray: true,
|
|
6823
6881
|
returns: 'self',
|
|
6824
6882
|
returnsPrimitive: null
|
|
@@ -6827,6 +6885,7 @@ const METHOD_MUTATES_SELF_RETURNS_SELF = [
|
|
|
6827
6885
|
const METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_SELF = [
|
|
6828
6886
|
new Method({
|
|
6829
6887
|
callsArgs: [0],
|
|
6888
|
+
mutatesArgs: false,
|
|
6830
6889
|
mutatesSelfAsArray: true,
|
|
6831
6890
|
returns: 'self',
|
|
6832
6891
|
returnsPrimitive: null
|
|
@@ -6856,7 +6915,7 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
6856
6915
|
lastIndexOf: METHOD_RETURNS_NUMBER,
|
|
6857
6916
|
map: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
6858
6917
|
pop: METHOD_MUTATES_SELF_RETURNS_UNKNOWN,
|
|
6859
|
-
push:
|
|
6918
|
+
push: METHOD_MUTATES_SELF_AND_ARGS_RETURNS_NUMBER,
|
|
6860
6919
|
reduce: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
6861
6920
|
reduceRight: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
6862
6921
|
reverse: METHOD_MUTATES_SELF_RETURNS_SELF,
|
|
@@ -6867,7 +6926,7 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
6867
6926
|
splice: METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY,
|
|
6868
6927
|
toLocaleString: METHOD_RETURNS_STRING,
|
|
6869
6928
|
toString: METHOD_RETURNS_STRING,
|
|
6870
|
-
unshift:
|
|
6929
|
+
unshift: METHOD_MUTATES_SELF_AND_ARGS_RETURNS_NUMBER,
|
|
6871
6930
|
values: METHOD_DEOPTS_SELF_RETURNS_UNKNOWN
|
|
6872
6931
|
}, OBJECT_PROTOTYPE, true);
|
|
6873
6932
|
|
|
@@ -14180,7 +14239,7 @@ class Module {
|
|
|
14180
14239
|
this.ast.bind();
|
|
14181
14240
|
}
|
|
14182
14241
|
error(properties, pos) {
|
|
14183
|
-
this.addLocationToLogProps(properties, pos);
|
|
14242
|
+
pos !== undefined && this.addLocationToLogProps(properties, pos);
|
|
14184
14243
|
return parseAst_js.error(properties);
|
|
14185
14244
|
}
|
|
14186
14245
|
// sum up the length of all ast nodes that are included
|
|
@@ -16357,7 +16416,8 @@ class Chunk {
|
|
|
16357
16416
|
: [chunkFileNames, 'output.chunkFileNames'];
|
|
16358
16417
|
fileName = renderNamePattern(typeof pattern === 'function' ? pattern(this.getPreRenderedChunkInfo()) : pattern, patternName, {
|
|
16359
16418
|
format: () => format,
|
|
16360
|
-
hash: size => hashPlaceholder ||
|
|
16419
|
+
hash: size => hashPlaceholder ||
|
|
16420
|
+
(hashPlaceholder = this.getPlaceholder(patternName, size || DEFAULT_HASH_SIZE)),
|
|
16361
16421
|
name: () => this.getChunkName()
|
|
16362
16422
|
});
|
|
16363
16423
|
if (!hashPlaceholder) {
|
|
@@ -16385,7 +16445,8 @@ class Chunk {
|
|
|
16385
16445
|
sourcemapFileName = renderNamePattern(typeof pattern === 'function' ? pattern(this.getPreRenderedChunkInfo()) : pattern, patternName, {
|
|
16386
16446
|
chunkhash: () => this.getPreliminaryFileName().hashPlaceholder || '',
|
|
16387
16447
|
format: () => format,
|
|
16388
|
-
hash: size => hashPlaceholder ||
|
|
16448
|
+
hash: size => hashPlaceholder ||
|
|
16449
|
+
(hashPlaceholder = this.getPlaceholder(patternName, size || DEFAULT_HASH_SIZE)),
|
|
16389
16450
|
name: () => this.getChunkName()
|
|
16390
16451
|
});
|
|
16391
16452
|
if (!hashPlaceholder) {
|
|
@@ -18094,9 +18155,10 @@ async function renderChunks(chunks, bundle, pluginDriver, outputOptions, log) {
|
|
|
18094
18155
|
const renderedChunks = await Promise.all(chunks.map(chunk => chunk.render()));
|
|
18095
18156
|
timeEnd('render chunks', 2);
|
|
18096
18157
|
timeStart('transform chunks', 2);
|
|
18158
|
+
const getHash = hasherByType[outputOptions.hashCharacters];
|
|
18097
18159
|
const chunkGraph = getChunkGraph(chunks);
|
|
18098
|
-
const { initialHashesByPlaceholder, nonHashedChunksWithPlaceholders, renderedChunksByPlaceholder, hashDependenciesByPlaceholder } = await transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver, log);
|
|
18099
|
-
const hashesByPlaceholder = generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, initialHashesByPlaceholder, bundle);
|
|
18160
|
+
const { initialHashesByPlaceholder, nonHashedChunksWithPlaceholders, renderedChunksByPlaceholder, hashDependenciesByPlaceholder } = await transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver, getHash, log);
|
|
18161
|
+
const hashesByPlaceholder = generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, initialHashesByPlaceholder, bundle, getHash);
|
|
18100
18162
|
addChunksToBundle(renderedChunksByPlaceholder, hashesByPlaceholder, bundle, nonHashedChunksWithPlaceholders, pluginDriver, outputOptions);
|
|
18101
18163
|
timeEnd('transform chunks', 2);
|
|
18102
18164
|
}
|
|
@@ -18176,7 +18238,7 @@ async function transformChunk(magicString, fileName, usedModules, chunkGraph, op
|
|
|
18176
18238
|
map
|
|
18177
18239
|
};
|
|
18178
18240
|
}
|
|
18179
|
-
async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver, log) {
|
|
18241
|
+
async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver, getHash, log) {
|
|
18180
18242
|
const nonHashedChunksWithPlaceholders = [];
|
|
18181
18243
|
const renderedChunksByPlaceholder = new Map();
|
|
18182
18244
|
const hashDependenciesByPlaceholder = new Map();
|
|
@@ -18211,7 +18273,7 @@ async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGrap
|
|
|
18211
18273
|
renderedChunksByPlaceholder.set(hashPlaceholder, transformedChunk);
|
|
18212
18274
|
hashDependenciesByPlaceholder.set(hashPlaceholder, {
|
|
18213
18275
|
containedPlaceholders,
|
|
18214
|
-
contentHash:
|
|
18276
|
+
contentHash: getHash(contentToHash)
|
|
18215
18277
|
});
|
|
18216
18278
|
}
|
|
18217
18279
|
else {
|
|
@@ -18219,7 +18281,7 @@ async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGrap
|
|
|
18219
18281
|
}
|
|
18220
18282
|
const sourcemapHashPlaceholder = preliminarySourcemapFileName?.hashPlaceholder;
|
|
18221
18283
|
if (map && sourcemapHashPlaceholder) {
|
|
18222
|
-
initialHashesByPlaceholder.set(preliminarySourcemapFileName.hashPlaceholder,
|
|
18284
|
+
initialHashesByPlaceholder.set(preliminarySourcemapFileName.hashPlaceholder, getHash(map.toString()).slice(0, preliminarySourcemapFileName.hashPlaceholder.length));
|
|
18223
18285
|
}
|
|
18224
18286
|
}));
|
|
18225
18287
|
return {
|
|
@@ -18229,7 +18291,7 @@ async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGrap
|
|
|
18229
18291
|
renderedChunksByPlaceholder
|
|
18230
18292
|
};
|
|
18231
18293
|
}
|
|
18232
|
-
function generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, initialHashesByPlaceholder, bundle) {
|
|
18294
|
+
function generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, initialHashesByPlaceholder, bundle, getHash) {
|
|
18233
18295
|
const hashesByPlaceholder = new Map(initialHashesByPlaceholder);
|
|
18234
18296
|
for (const [placeholder, { fileName }] of renderedChunksByPlaceholder) {
|
|
18235
18297
|
let contentToHash = '';
|
|
@@ -18249,7 +18311,7 @@ function generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlac
|
|
|
18249
18311
|
if (finalHash) {
|
|
18250
18312
|
contentToHash = finalHash;
|
|
18251
18313
|
}
|
|
18252
|
-
finalHash =
|
|
18314
|
+
finalHash = getHash(contentToHash).slice(0, placeholder.length);
|
|
18253
18315
|
finalFileName = replaceSinglePlaceholder(fileName, placeholder, finalHash);
|
|
18254
18316
|
} while (bundle[lowercaseBundleKeys].has(finalFileName.toLowerCase()));
|
|
18255
18317
|
bundle[finalFileName] = FILE_PLACEHOLDER;
|
|
@@ -19614,6 +19676,7 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
19614
19676
|
freeze: config.freeze ?? true,
|
|
19615
19677
|
generatedCode,
|
|
19616
19678
|
globals: config.globals || {},
|
|
19679
|
+
hashCharacters: config.hashCharacters ?? 'base64',
|
|
19617
19680
|
hoistTransitiveImports: config.hoistTransitiveImports ?? true,
|
|
19618
19681
|
indent: getIndent(config, compact),
|
|
19619
19682
|
inlineDynamicImports,
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED
|
@@ -99,6 +99,7 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
99
99
|
const ret = encodeString(arg, view);
|
|
100
100
|
|
|
101
101
|
offset += ret.written;
|
|
102
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
WASM_VECTOR_LEN = offset;
|
|
@@ -160,6 +161,48 @@ module.exports.xxhashBase64Url = function(input) {
|
|
|
160
161
|
}
|
|
161
162
|
};
|
|
162
163
|
|
|
164
|
+
/**
|
|
165
|
+
* @param {Uint8Array} input
|
|
166
|
+
* @returns {string}
|
|
167
|
+
*/
|
|
168
|
+
module.exports.xxhashBase36 = function(input) {
|
|
169
|
+
let deferred1_0;
|
|
170
|
+
let deferred1_1;
|
|
171
|
+
try {
|
|
172
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
173
|
+
wasm.xxhashBase36(retptr, addHeapObject(input));
|
|
174
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
175
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
176
|
+
deferred1_0 = r0;
|
|
177
|
+
deferred1_1 = r1;
|
|
178
|
+
return getStringFromWasm0(r0, r1);
|
|
179
|
+
} finally {
|
|
180
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
181
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @param {Uint8Array} input
|
|
187
|
+
* @returns {string}
|
|
188
|
+
*/
|
|
189
|
+
module.exports.xxhashBase16 = function(input) {
|
|
190
|
+
let deferred1_0;
|
|
191
|
+
let deferred1_1;
|
|
192
|
+
try {
|
|
193
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
194
|
+
wasm.xxhashBase16(retptr, addHeapObject(input));
|
|
195
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
196
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
197
|
+
deferred1_0 = r0;
|
|
198
|
+
deferred1_1 = r1;
|
|
199
|
+
return getStringFromWasm0(r0, r1);
|
|
200
|
+
} finally {
|
|
201
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
202
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
163
206
|
function handleError(f, args) {
|
|
164
207
|
try {
|
|
165
208
|
return f.apply(this, args);
|
|
@@ -231,12 +274,12 @@ module.exports.__wbg_getRandomValues_7e42b4fb8779dc6d = function() { return hand
|
|
|
231
274
|
getObject(arg0).getRandomValues(getObject(arg1));
|
|
232
275
|
}, arguments) };
|
|
233
276
|
|
|
234
|
-
module.exports.
|
|
277
|
+
module.exports.__wbg_newnoargs_cfecb3965268594c = function(arg0, arg1) {
|
|
235
278
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
236
279
|
return addHeapObject(ret);
|
|
237
280
|
};
|
|
238
281
|
|
|
239
|
-
module.exports.
|
|
282
|
+
module.exports.__wbg_call_3f093dd26d5569f8 = function() { return handleError(function (arg0, arg1) {
|
|
240
283
|
const ret = getObject(arg0).call(getObject(arg1));
|
|
241
284
|
return addHeapObject(ret);
|
|
242
285
|
}, arguments) };
|
|
@@ -246,22 +289,22 @@ module.exports.__wbindgen_object_clone_ref = function(arg0) {
|
|
|
246
289
|
return addHeapObject(ret);
|
|
247
290
|
};
|
|
248
291
|
|
|
249
|
-
module.exports.
|
|
292
|
+
module.exports.__wbg_self_05040bd9523805b9 = function() { return handleError(function () {
|
|
250
293
|
const ret = self.self;
|
|
251
294
|
return addHeapObject(ret);
|
|
252
295
|
}, arguments) };
|
|
253
296
|
|
|
254
|
-
module.exports.
|
|
297
|
+
module.exports.__wbg_window_adc720039f2cb14f = function() { return handleError(function () {
|
|
255
298
|
const ret = window.window;
|
|
256
299
|
return addHeapObject(ret);
|
|
257
300
|
}, arguments) };
|
|
258
301
|
|
|
259
|
-
module.exports.
|
|
302
|
+
module.exports.__wbg_globalThis_622105db80c1457d = function() { return handleError(function () {
|
|
260
303
|
const ret = globalThis.globalThis;
|
|
261
304
|
return addHeapObject(ret);
|
|
262
305
|
}, arguments) };
|
|
263
306
|
|
|
264
|
-
module.exports.
|
|
307
|
+
module.exports.__wbg_global_f56b013ed9bcf359 = function() { return handleError(function () {
|
|
265
308
|
const ret = global.global;
|
|
266
309
|
return addHeapObject(ret);
|
|
267
310
|
}, arguments) };
|
|
@@ -271,41 +314,41 @@ module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
|
271
314
|
return ret;
|
|
272
315
|
};
|
|
273
316
|
|
|
274
|
-
module.exports.
|
|
317
|
+
module.exports.__wbg_call_67f2111acd2dfdb6 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
275
318
|
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
276
319
|
return addHeapObject(ret);
|
|
277
320
|
}, arguments) };
|
|
278
321
|
|
|
279
|
-
module.exports.
|
|
322
|
+
module.exports.__wbg_buffer_b914fb8b50ebbc3e = function(arg0) {
|
|
280
323
|
const ret = getObject(arg0).buffer;
|
|
281
324
|
return addHeapObject(ret);
|
|
282
325
|
};
|
|
283
326
|
|
|
284
|
-
module.exports.
|
|
327
|
+
module.exports.__wbg_newwithbyteoffsetandlength_0de9ee56e9f6ee6e = function(arg0, arg1, arg2) {
|
|
285
328
|
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
286
329
|
return addHeapObject(ret);
|
|
287
330
|
};
|
|
288
331
|
|
|
289
|
-
module.exports.
|
|
332
|
+
module.exports.__wbg_new_b1f2d6842d615181 = function(arg0) {
|
|
290
333
|
const ret = new Uint8Array(getObject(arg0));
|
|
291
334
|
return addHeapObject(ret);
|
|
292
335
|
};
|
|
293
336
|
|
|
294
|
-
module.exports.
|
|
337
|
+
module.exports.__wbg_set_7d988c98e6ced92d = function(arg0, arg1, arg2) {
|
|
295
338
|
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
|
296
339
|
};
|
|
297
340
|
|
|
298
|
-
module.exports.
|
|
341
|
+
module.exports.__wbg_length_21c4b0ae73cba59d = function(arg0) {
|
|
299
342
|
const ret = getObject(arg0).length;
|
|
300
343
|
return ret;
|
|
301
344
|
};
|
|
302
345
|
|
|
303
|
-
module.exports.
|
|
346
|
+
module.exports.__wbg_newwithlength_0d03cef43b68a530 = function(arg0) {
|
|
304
347
|
const ret = new Uint8Array(arg0 >>> 0);
|
|
305
348
|
return addHeapObject(ret);
|
|
306
349
|
};
|
|
307
350
|
|
|
308
|
-
module.exports.
|
|
351
|
+
module.exports.__wbg_subarray_adc418253d76e2f1 = function(arg0, arg1, arg2) {
|
|
309
352
|
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
|
310
353
|
return addHeapObject(ret);
|
|
311
354
|
};
|
|
Binary file
|