rollup 4.6.1 → 4.8.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/LICENSE.md +22 -0
- package/dist/bin/rollup +2 -2
- 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 +163 -148
- package/dist/es/shared/parseAst.js +2 -2
- package/dist/es/shared/watch.js +2 -2
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/native.js +23 -0
- package/dist/parseAst.js +2 -2
- package/dist/rollup.js +76 -8
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +2 -2
- package/dist/shared/rollup.js +163 -148
- package/dist/shared/watch-cli.js +4 -4
- package/dist/shared/watch.js +2 -2
- package/package.json +36 -34
- package/dist/shared/watch-proxy.js +0 -88
package/LICENSE.md
CHANGED
|
@@ -50,6 +50,28 @@ License: MIT
|
|
|
50
50
|
By: Rich Harris
|
|
51
51
|
Repository: rollup/plugins
|
|
52
52
|
|
|
53
|
+
> The MIT License (MIT)
|
|
54
|
+
>
|
|
55
|
+
> Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors)
|
|
56
|
+
>
|
|
57
|
+
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
58
|
+
> of this software and associated documentation files (the "Software"), to deal
|
|
59
|
+
> in the Software without restriction, including without limitation the rights
|
|
60
|
+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
61
|
+
> copies of the Software, and to permit persons to whom the Software is
|
|
62
|
+
> furnished to do so, subject to the following conditions:
|
|
63
|
+
>
|
|
64
|
+
> The above copyright notice and this permission notice shall be included in
|
|
65
|
+
> all copies or substantial portions of the Software.
|
|
66
|
+
>
|
|
67
|
+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
68
|
+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
69
|
+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
70
|
+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
71
|
+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
72
|
+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
73
|
+
> THE SOFTWARE.
|
|
74
|
+
|
|
53
75
|
---------------------------------------
|
|
54
76
|
|
|
55
77
|
## anymatch
|
package/dist/bin/rollup
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*
|
|
3
3
|
@license
|
|
4
|
-
Rollup.js v4.
|
|
5
|
-
|
|
4
|
+
Rollup.js v4.8.0
|
|
5
|
+
Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
8
8
|
|
package/dist/es/getLogFilter.js
CHANGED
package/dist/es/parseAst.js
CHANGED
package/dist/es/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.8.0
|
|
4
|
+
Mon, 11 Dec 2023 06:24:24 GMT - commit 62b648e1cc6a1f00260bb85aa2050097bb4afd2b
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -16,7 +16,7 @@ import { xxhashBase64Url } from '../../native.js';
|
|
|
16
16
|
import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/promises';
|
|
17
17
|
import * as tty from 'tty';
|
|
18
18
|
|
|
19
|
-
var version = "4.
|
|
19
|
+
var version = "4.8.0";
|
|
20
20
|
|
|
21
21
|
const comma = ','.charCodeAt(0);
|
|
22
22
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -15913,11 +15913,15 @@ function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize, log
|
|
|
15913
15913
|
const { chunkDefinitions, modulesInManualChunks } = getChunkDefinitionsFromManualChunks(manualChunkAliasByEntry);
|
|
15914
15914
|
const { allEntries, dependentEntriesByModule, dynamicallyDependentEntriesByDynamicEntry, dynamicImportsByEntry } = analyzeModuleGraph(entries);
|
|
15915
15915
|
// Each chunk is identified by its position in this array
|
|
15916
|
-
const
|
|
15917
|
-
|
|
15918
|
-
//
|
|
15919
|
-
|
|
15920
|
-
|
|
15916
|
+
const chunkAtoms = getChunksWithSameDependentEntries(getModulesWithDependentEntries(dependentEntriesByModule, modulesInManualChunks));
|
|
15917
|
+
const staticDependencyAtomsByEntry = getStaticDependencyAtomsByEntry(allEntries, chunkAtoms);
|
|
15918
|
+
// Warning: This will consume dynamicallyDependentEntriesByDynamicEntry.
|
|
15919
|
+
// If we no longer want this, we should make a copy here.
|
|
15920
|
+
const alreadyLoadedAtomsByEntry = getAlreadyLoadedAtomsByEntry(staticDependencyAtomsByEntry, dynamicallyDependentEntriesByDynamicEntry, dynamicImportsByEntry, allEntries);
|
|
15921
|
+
// This mutates the dependentEntries in chunkAtoms
|
|
15922
|
+
removeUnnecessaryDependentEntries(chunkAtoms, alreadyLoadedAtomsByEntry);
|
|
15923
|
+
const { chunks, sideEffectAtoms, sizeByAtom } = getChunksWithSameDependentEntriesAndCorrelatedAtoms(chunkAtoms, staticDependencyAtomsByEntry, alreadyLoadedAtomsByEntry, minChunkSize);
|
|
15924
|
+
chunkDefinitions.push(...getOptimizedChunks(chunks, minChunkSize, sideEffectAtoms, sizeByAtom, log).map(({ modules }) => ({
|
|
15921
15925
|
alias: null,
|
|
15922
15926
|
modules
|
|
15923
15927
|
})));
|
|
@@ -16026,7 +16030,7 @@ function getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule,
|
|
|
16026
16030
|
}
|
|
16027
16031
|
return dynamicallyDependentEntriesByDynamicEntry;
|
|
16028
16032
|
}
|
|
16029
|
-
function
|
|
16033
|
+
function getChunksWithSameDependentEntries(modulesWithDependentEntries) {
|
|
16030
16034
|
const chunkModules = Object.create(null);
|
|
16031
16035
|
for (const { dependentEntries, modules } of modulesWithDependentEntries) {
|
|
16032
16036
|
let chunkSignature = 0n;
|
|
@@ -16047,55 +16051,152 @@ function* getModulesWithDependentEntries(dependentEntriesByModule, modulesInManu
|
|
|
16047
16051
|
}
|
|
16048
16052
|
}
|
|
16049
16053
|
}
|
|
16050
|
-
|
|
16051
|
-
|
|
16052
|
-
* first argument. It will also consume its second argument, so if
|
|
16053
|
-
* dynamicallyDependentEntriesByDynamicEntry is ever needed after this, we
|
|
16054
|
-
* should make a copy.
|
|
16055
|
-
*/
|
|
16056
|
-
function removeUnnecessaryDependentEntries(chunks, dynamicallyDependentEntriesByDynamicEntry, dynamicImportsByEntry, allEntries) {
|
|
16057
|
-
// The indices correspond to the indices in allEntries. The chunks correspond
|
|
16054
|
+
function getStaticDependencyAtomsByEntry(allEntries, chunkAtoms) {
|
|
16055
|
+
// The indices correspond to the indices in allEntries. The atoms correspond
|
|
16058
16056
|
// to bits in the bigint values where chunk 0 is the lowest bit.
|
|
16059
|
-
const
|
|
16060
|
-
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
for (const { dependentEntries } of chunks) {
|
|
16057
|
+
const staticDependencyAtomsByEntry = allEntries.map(() => 0n);
|
|
16058
|
+
// This toggles the bits for each atom that is a dependency of an entry
|
|
16059
|
+
let atomMask = 1n;
|
|
16060
|
+
for (const { dependentEntries } of chunkAtoms) {
|
|
16064
16061
|
for (const entryIndex of dependentEntries) {
|
|
16065
|
-
|
|
16066
|
-
}
|
|
16067
|
-
|
|
16068
|
-
}
|
|
16069
|
-
|
|
16070
|
-
|
|
16071
|
-
|
|
16072
|
-
|
|
16073
|
-
|
|
16074
|
-
|
|
16075
|
-
|
|
16076
|
-
|
|
16077
|
-
|
|
16078
|
-
|
|
16079
|
-
|
|
16080
|
-
|
|
16081
|
-
|
|
16062
|
+
staticDependencyAtomsByEntry[entryIndex] |= atomMask;
|
|
16063
|
+
}
|
|
16064
|
+
atomMask <<= 1n;
|
|
16065
|
+
}
|
|
16066
|
+
return staticDependencyAtomsByEntry;
|
|
16067
|
+
}
|
|
16068
|
+
// Warning: This will consume dynamicallyDependentEntriesByDynamicEntry.
|
|
16069
|
+
function getAlreadyLoadedAtomsByEntry(staticDependencyAtomsByEntry, dynamicallyDependentEntriesByDynamicEntry, dynamicImportsByEntry, allEntries) {
|
|
16070
|
+
// Dynamic entries have all atoms as already loaded initially because we then
|
|
16071
|
+
// intersect with the static dependency atoms of all dynamic importers.
|
|
16072
|
+
// Static entries cannot have already loaded atoms.
|
|
16073
|
+
const alreadyLoadedAtomsByEntry = allEntries.map((_entry, entryIndex) => dynamicallyDependentEntriesByDynamicEntry.has(entryIndex) ? -1n : 0n);
|
|
16074
|
+
for (const [dynamicEntryIndex, dynamicallyDependentEntries] of dynamicallyDependentEntriesByDynamicEntry) {
|
|
16075
|
+
// We delete here so that they can be added again if necessary to be handled
|
|
16076
|
+
// again by the loop
|
|
16077
|
+
dynamicallyDependentEntriesByDynamicEntry.delete(dynamicEntryIndex);
|
|
16078
|
+
const knownLoadedAtoms = alreadyLoadedAtomsByEntry[dynamicEntryIndex];
|
|
16079
|
+
let updatedLoadedAtoms = knownLoadedAtoms;
|
|
16080
|
+
for (const entryIndex of dynamicallyDependentEntries) {
|
|
16081
|
+
updatedLoadedAtoms &=
|
|
16082
|
+
staticDependencyAtomsByEntry[entryIndex] | alreadyLoadedAtomsByEntry[entryIndex];
|
|
16083
|
+
}
|
|
16084
|
+
// If the knownLoadedAtoms changed, all dependent dynamic entries need to be
|
|
16085
|
+
// updated again
|
|
16086
|
+
if (updatedLoadedAtoms !== knownLoadedAtoms) {
|
|
16087
|
+
alreadyLoadedAtomsByEntry[dynamicEntryIndex] = updatedLoadedAtoms;
|
|
16082
16088
|
for (const dynamicImport of dynamicImportsByEntry[dynamicEntryIndex]) {
|
|
16083
|
-
|
|
16089
|
+
// If this adds an entry that was deleted before, it will be handled
|
|
16090
|
+
// again. This is the reason why we delete every entry from this map
|
|
16091
|
+
// that we processed.
|
|
16092
|
+
getOrCreate(dynamicallyDependentEntriesByDynamicEntry, dynamicImport, (getNewSet)).add(dynamicEntryIndex);
|
|
16084
16093
|
}
|
|
16085
16094
|
}
|
|
16086
16095
|
}
|
|
16096
|
+
return alreadyLoadedAtomsByEntry;
|
|
16097
|
+
}
|
|
16098
|
+
/**
|
|
16099
|
+
* This removes all unnecessary dynamic entries from the dependentEntries in its
|
|
16100
|
+
* first argument if a chunk is already loaded without that entry.
|
|
16101
|
+
*/
|
|
16102
|
+
function removeUnnecessaryDependentEntries(chunkAtoms, alreadyLoadedAtomsByEntry) {
|
|
16087
16103
|
// Remove entries from dependent entries if a chunk is already loaded without
|
|
16088
16104
|
// that entry.
|
|
16089
|
-
chunkMask = 1n;
|
|
16090
|
-
for (const { dependentEntries } of
|
|
16105
|
+
let chunkMask = 1n;
|
|
16106
|
+
for (const { dependentEntries } of chunkAtoms) {
|
|
16091
16107
|
for (const entryIndex of dependentEntries) {
|
|
16092
|
-
if ((
|
|
16108
|
+
if ((alreadyLoadedAtomsByEntry[entryIndex] & chunkMask) === chunkMask) {
|
|
16093
16109
|
dependentEntries.delete(entryIndex);
|
|
16094
16110
|
}
|
|
16095
16111
|
}
|
|
16096
16112
|
chunkMask <<= 1n;
|
|
16097
16113
|
}
|
|
16098
16114
|
}
|
|
16115
|
+
function getChunksWithSameDependentEntriesAndCorrelatedAtoms(chunkAtoms, staticDependencyAtomsByEntry, alreadyLoadedAtomsByEntry, minChunkSize) {
|
|
16116
|
+
const chunksBySignature = Object.create(null);
|
|
16117
|
+
const chunkByModule = new Map();
|
|
16118
|
+
const sizeByAtom = [];
|
|
16119
|
+
let sideEffectAtoms = 0n;
|
|
16120
|
+
let atomMask = 1n;
|
|
16121
|
+
for (const { dependentEntries, modules } of chunkAtoms) {
|
|
16122
|
+
let chunkSignature = 0n;
|
|
16123
|
+
let correlatedAtoms = -1n;
|
|
16124
|
+
for (const entryIndex of dependentEntries) {
|
|
16125
|
+
chunkSignature |= 1n << BigInt(entryIndex);
|
|
16126
|
+
// Correlated atoms are the atoms that are guaranteed to be loaded as
|
|
16127
|
+
// well when a given atom is loaded. It is the intersection of the already
|
|
16128
|
+
// loaded modules of each chunk merged with its static dependencies.
|
|
16129
|
+
correlatedAtoms &=
|
|
16130
|
+
staticDependencyAtomsByEntry[entryIndex] | alreadyLoadedAtomsByEntry[entryIndex];
|
|
16131
|
+
}
|
|
16132
|
+
const chunk = (chunksBySignature[String(chunkSignature)] ||= {
|
|
16133
|
+
containedAtoms: 0n,
|
|
16134
|
+
correlatedAtoms,
|
|
16135
|
+
dependencies: new Set(),
|
|
16136
|
+
dependentChunks: new Set(),
|
|
16137
|
+
dependentEntries: new Set(dependentEntries),
|
|
16138
|
+
modules: [],
|
|
16139
|
+
pure: true,
|
|
16140
|
+
size: 0
|
|
16141
|
+
});
|
|
16142
|
+
let atomSize = 0;
|
|
16143
|
+
let pure = true;
|
|
16144
|
+
for (const module of modules) {
|
|
16145
|
+
chunkByModule.set(module, chunk);
|
|
16146
|
+
// Unfortunately, we cannot take tree-shaking into account here because
|
|
16147
|
+
// rendering did not happen yet, but we can detect empty modules
|
|
16148
|
+
if (module.isIncluded()) {
|
|
16149
|
+
pure &&= !module.hasEffects();
|
|
16150
|
+
// we use a trivial size for the default minChunkSize to improve
|
|
16151
|
+
// performance
|
|
16152
|
+
atomSize += minChunkSize > 1 ? module.estimateSize() : 1;
|
|
16153
|
+
}
|
|
16154
|
+
}
|
|
16155
|
+
if (!pure) {
|
|
16156
|
+
sideEffectAtoms |= atomMask;
|
|
16157
|
+
}
|
|
16158
|
+
sizeByAtom.push(atomSize);
|
|
16159
|
+
chunk.containedAtoms |= atomMask;
|
|
16160
|
+
chunk.modules.push(...modules);
|
|
16161
|
+
chunk.pure &&= pure;
|
|
16162
|
+
chunk.size += atomSize;
|
|
16163
|
+
atomMask <<= 1n;
|
|
16164
|
+
}
|
|
16165
|
+
const chunks = Object.values(chunksBySignature);
|
|
16166
|
+
sideEffectAtoms |= addChunkDependenciesAndGetExternalSideEffectAtoms(chunks, chunkByModule, atomMask);
|
|
16167
|
+
return { chunks, sideEffectAtoms, sizeByAtom };
|
|
16168
|
+
}
|
|
16169
|
+
function addChunkDependenciesAndGetExternalSideEffectAtoms(chunks, chunkByModule, nextAvailableAtomMask) {
|
|
16170
|
+
const signatureByExternalModule = new Map();
|
|
16171
|
+
let externalSideEffectAtoms = 0n;
|
|
16172
|
+
for (const chunk of chunks) {
|
|
16173
|
+
const { dependencies, modules } = chunk;
|
|
16174
|
+
for (const module of modules) {
|
|
16175
|
+
for (const dependency of module.getDependenciesToBeIncluded()) {
|
|
16176
|
+
if (dependency instanceof ExternalModule) {
|
|
16177
|
+
if (dependency.info.moduleSideEffects) {
|
|
16178
|
+
const signature = getOrCreate(signatureByExternalModule, dependency, () => {
|
|
16179
|
+
const signature = nextAvailableAtomMask;
|
|
16180
|
+
nextAvailableAtomMask <<= 1n;
|
|
16181
|
+
externalSideEffectAtoms |= signature;
|
|
16182
|
+
return signature;
|
|
16183
|
+
});
|
|
16184
|
+
chunk.containedAtoms |= signature;
|
|
16185
|
+
chunk.correlatedAtoms |= signature;
|
|
16186
|
+
}
|
|
16187
|
+
}
|
|
16188
|
+
else {
|
|
16189
|
+
const dependencyChunk = chunkByModule.get(dependency);
|
|
16190
|
+
if (dependencyChunk && dependencyChunk !== chunk) {
|
|
16191
|
+
dependencies.add(dependencyChunk);
|
|
16192
|
+
dependencyChunk.dependentChunks.add(chunk);
|
|
16193
|
+
}
|
|
16194
|
+
}
|
|
16195
|
+
}
|
|
16196
|
+
}
|
|
16197
|
+
}
|
|
16198
|
+
return externalSideEffectAtoms;
|
|
16199
|
+
}
|
|
16099
16200
|
/**
|
|
16100
16201
|
* This function tries to get rid of small chunks by merging them with other
|
|
16101
16202
|
* chunks.
|
|
@@ -16172,77 +16273,44 @@ function removeUnnecessaryDependentEntries(chunks, dynamicallyDependentEntriesBy
|
|
|
16172
16273
|
* following the rule (a), starting with the smallest chunks to look for
|
|
16173
16274
|
* possible merge targets.
|
|
16174
16275
|
*/
|
|
16175
|
-
function getOptimizedChunks(
|
|
16276
|
+
function getOptimizedChunks(chunks, minChunkSize, sideEffectAtoms, sizeByAtom, log) {
|
|
16176
16277
|
timeStart('optimize chunks', 3);
|
|
16177
|
-
const chunkPartition = getPartitionedChunks(
|
|
16278
|
+
const chunkPartition = getPartitionedChunks(chunks, minChunkSize);
|
|
16178
16279
|
if (!chunkPartition) {
|
|
16179
16280
|
timeEnd('optimize chunks', 3);
|
|
16180
|
-
return
|
|
16281
|
+
return chunks; // the actual modules
|
|
16181
16282
|
}
|
|
16182
16283
|
minChunkSize > 1 &&
|
|
16183
|
-
log('info', logOptimizeChunkStatus(
|
|
16184
|
-
mergeChunks(chunkPartition, minChunkSize);
|
|
16284
|
+
log('info', logOptimizeChunkStatus(chunks.length, chunkPartition.small.size, 'Initially'));
|
|
16285
|
+
mergeChunks(chunkPartition, minChunkSize, sideEffectAtoms, sizeByAtom);
|
|
16185
16286
|
minChunkSize > 1 &&
|
|
16186
16287
|
log('info', logOptimizeChunkStatus(chunkPartition.small.size + chunkPartition.big.size, chunkPartition.small.size, 'After merging chunks'));
|
|
16187
16288
|
timeEnd('optimize chunks', 3);
|
|
16188
16289
|
return [...chunkPartition.small, ...chunkPartition.big];
|
|
16189
16290
|
}
|
|
16190
|
-
function getPartitionedChunks(
|
|
16291
|
+
function getPartitionedChunks(chunks, minChunkSize) {
|
|
16191
16292
|
const smallChunks = [];
|
|
16192
16293
|
const bigChunks = [];
|
|
16193
|
-
const
|
|
16194
|
-
|
|
16195
|
-
let sideEffectAtoms = 0n;
|
|
16196
|
-
let containedAtoms = 1n;
|
|
16197
|
-
for (const { dependentEntries, modules } of initialChunks) {
|
|
16198
|
-
const chunkDescription = {
|
|
16199
|
-
containedAtoms,
|
|
16200
|
-
correlatedAtoms: 0n,
|
|
16201
|
-
dependencies: new Set(),
|
|
16202
|
-
dependentChunks: new Set(),
|
|
16203
|
-
dependentEntries,
|
|
16204
|
-
modules,
|
|
16205
|
-
pure: true,
|
|
16206
|
-
size: 0
|
|
16207
|
-
};
|
|
16208
|
-
let size = 0;
|
|
16209
|
-
let pure = true;
|
|
16210
|
-
for (const module of modules) {
|
|
16211
|
-
chunkByModule.set(module, chunkDescription);
|
|
16212
|
-
// Unfortunately, we cannot take tree-shaking into account here because
|
|
16213
|
-
// rendering did not happen yet, but we can detect empty modules
|
|
16214
|
-
if (module.isIncluded()) {
|
|
16215
|
-
pure &&= !module.hasEffects();
|
|
16216
|
-
// we use a trivial size for the default minChunkSize to improve
|
|
16217
|
-
// performance
|
|
16218
|
-
size += minChunkSize > 1 ? module.estimateSize() : 1;
|
|
16219
|
-
}
|
|
16220
|
-
}
|
|
16221
|
-
chunkDescription.pure = pure;
|
|
16222
|
-
chunkDescription.size = size;
|
|
16223
|
-
sizeByAtom.push(size);
|
|
16224
|
-
if (!pure) {
|
|
16225
|
-
sideEffectAtoms |= containedAtoms;
|
|
16226
|
-
}
|
|
16227
|
-
(size < minChunkSize ? smallChunks : bigChunks).push(chunkDescription);
|
|
16228
|
-
containedAtoms <<= 1n;
|
|
16294
|
+
for (const chunk of chunks) {
|
|
16295
|
+
(chunk.size < minChunkSize ? smallChunks : bigChunks).push(chunk);
|
|
16229
16296
|
}
|
|
16230
|
-
// If there are no small chunks, we will not optimize
|
|
16231
16297
|
if (smallChunks.length === 0) {
|
|
16232
16298
|
return null;
|
|
16233
16299
|
}
|
|
16234
|
-
|
|
16300
|
+
smallChunks.sort(compareChunkSize);
|
|
16301
|
+
bigChunks.sort(compareChunkSize);
|
|
16235
16302
|
return {
|
|
16236
16303
|
big: new Set(bigChunks),
|
|
16237
|
-
sideEffectAtoms,
|
|
16238
|
-
sizeByAtom,
|
|
16239
16304
|
small: new Set(smallChunks)
|
|
16240
16305
|
};
|
|
16241
16306
|
}
|
|
16242
|
-
function
|
|
16307
|
+
function compareChunkSize({ size: sizeA }, { size: sizeB }) {
|
|
16308
|
+
return sizeA - sizeB;
|
|
16309
|
+
}
|
|
16310
|
+
function mergeChunks(chunkPartition, minChunkSize, sideEffectAtoms, sizeByAtom) {
|
|
16243
16311
|
const { small } = chunkPartition;
|
|
16244
16312
|
for (const mergedChunk of small) {
|
|
16245
|
-
const bestTargetChunk = findBestMergeTarget(mergedChunk, chunkPartition,
|
|
16313
|
+
const bestTargetChunk = findBestMergeTarget(mergedChunk, chunkPartition, sideEffectAtoms, sizeByAtom,
|
|
16246
16314
|
// In the default case, we do not accept size increases
|
|
16247
16315
|
minChunkSize <= 1 ? 1 : Infinity);
|
|
16248
16316
|
if (bestTargetChunk) {
|
|
@@ -16274,57 +16342,7 @@ function mergeChunks(chunkPartition, minChunkSize) {
|
|
|
16274
16342
|
}
|
|
16275
16343
|
}
|
|
16276
16344
|
}
|
|
16277
|
-
function
|
|
16278
|
-
const signatureByExternalModule = new Map();
|
|
16279
|
-
let sideEffectAtoms = 0n;
|
|
16280
|
-
const atomsByEntry = [];
|
|
16281
|
-
for (let index = 0; index < numberOfEntries; index++) {
|
|
16282
|
-
atomsByEntry.push(0n);
|
|
16283
|
-
}
|
|
16284
|
-
for (const chunks of chunkLists) {
|
|
16285
|
-
chunks.sort(compareChunkSize);
|
|
16286
|
-
for (const chunk of chunks) {
|
|
16287
|
-
const { dependencies, dependentEntries, modules } = chunk;
|
|
16288
|
-
for (const module of modules) {
|
|
16289
|
-
for (const dependency of module.getDependenciesToBeIncluded()) {
|
|
16290
|
-
if (dependency instanceof ExternalModule) {
|
|
16291
|
-
if (dependency.info.moduleSideEffects) {
|
|
16292
|
-
chunk.containedAtoms |= getOrCreate(signatureByExternalModule, dependency, () => {
|
|
16293
|
-
const signature = nextAtomSignature;
|
|
16294
|
-
nextAtomSignature <<= 1n;
|
|
16295
|
-
sideEffectAtoms |= signature;
|
|
16296
|
-
return signature;
|
|
16297
|
-
});
|
|
16298
|
-
}
|
|
16299
|
-
}
|
|
16300
|
-
else {
|
|
16301
|
-
const dependencyChunk = chunkByModule.get(dependency);
|
|
16302
|
-
if (dependencyChunk && dependencyChunk !== chunk) {
|
|
16303
|
-
dependencies.add(dependencyChunk);
|
|
16304
|
-
dependencyChunk.dependentChunks.add(chunk);
|
|
16305
|
-
}
|
|
16306
|
-
}
|
|
16307
|
-
}
|
|
16308
|
-
}
|
|
16309
|
-
const { containedAtoms } = chunk;
|
|
16310
|
-
for (const entryIndex of dependentEntries) {
|
|
16311
|
-
atomsByEntry[entryIndex] |= containedAtoms;
|
|
16312
|
-
}
|
|
16313
|
-
}
|
|
16314
|
-
}
|
|
16315
|
-
for (const chunks of chunkLists) {
|
|
16316
|
-
for (const chunk of chunks) {
|
|
16317
|
-
const { dependentEntries } = chunk;
|
|
16318
|
-
// Correlated atoms are the intersection of all entry atoms
|
|
16319
|
-
chunk.correlatedAtoms = -1n;
|
|
16320
|
-
for (const entryIndex of dependentEntries) {
|
|
16321
|
-
chunk.correlatedAtoms &= atomsByEntry[entryIndex];
|
|
16322
|
-
}
|
|
16323
|
-
}
|
|
16324
|
-
}
|
|
16325
|
-
return sideEffectAtoms;
|
|
16326
|
-
}
|
|
16327
|
-
function findBestMergeTarget(mergedChunk, { big, sideEffectAtoms, sizeByAtom, small }, smallestAdditionalSize) {
|
|
16345
|
+
function findBestMergeTarget(mergedChunk, { big, small }, sideEffectAtoms, sizeByAtom, smallestAdditionalSize) {
|
|
16328
16346
|
let bestTargetChunk = null;
|
|
16329
16347
|
// In the default case, we do not accept size increases
|
|
16330
16348
|
for (const targetChunk of concatLazy([small, big])) {
|
|
@@ -16340,12 +16358,6 @@ function findBestMergeTarget(mergedChunk, { big, sideEffectAtoms, sizeByAtom, sm
|
|
|
16340
16358
|
}
|
|
16341
16359
|
return bestTargetChunk;
|
|
16342
16360
|
}
|
|
16343
|
-
function getChunksInPartition(chunk, minChunkSize, chunkPartition) {
|
|
16344
|
-
return chunk.size < minChunkSize ? chunkPartition.small : chunkPartition.big;
|
|
16345
|
-
}
|
|
16346
|
-
function compareChunkSize({ size: sizeA }, { size: sizeB }) {
|
|
16347
|
-
return sizeA - sizeB;
|
|
16348
|
-
}
|
|
16349
16361
|
/**
|
|
16350
16362
|
* Determine the additional unused code size that would be added by merging the
|
|
16351
16363
|
* two chunks. This is not an exact measurement but rather an upper bound. If
|
|
@@ -16403,6 +16415,9 @@ function getAtomsSizeIfBelowLimit(atoms, currentAdditionalSize, sizeByAtom) {
|
|
|
16403
16415
|
}
|
|
16404
16416
|
return size;
|
|
16405
16417
|
}
|
|
16418
|
+
function getChunksInPartition(chunk, minChunkSize, chunkPartition) {
|
|
16419
|
+
return chunk.size < minChunkSize ? chunkPartition.small : chunkPartition.big;
|
|
16420
|
+
}
|
|
16406
16421
|
|
|
16407
16422
|
// ported from https://github.com/substack/node-commondir
|
|
16408
16423
|
function commondir(files) {
|
package/dist/es/shared/watch.js
CHANGED
package/dist/getLogFilter.js
CHANGED
package/dist/loadConfigFile.js
CHANGED
package/dist/native.js
CHANGED
|
@@ -16,6 +16,7 @@ const bindingsByPlatformAndArch = {
|
|
|
16
16
|
linux: {
|
|
17
17
|
arm: { base: 'linux-arm-gnueabihf', musl: null },
|
|
18
18
|
arm64: { base: 'linux-arm64-gnu', musl: 'linux-arm64-musl' },
|
|
19
|
+
riscv64: { base: 'linux-riscv64-gnu', musl: null },
|
|
19
20
|
x64: { base: 'linux-x64-gnu', musl: 'linux-x64-musl' }
|
|
20
21
|
},
|
|
21
22
|
win32: {
|
|
@@ -25,6 +26,12 @@ const bindingsByPlatformAndArch = {
|
|
|
25
26
|
}
|
|
26
27
|
};
|
|
27
28
|
|
|
29
|
+
const msvcLinkFilenameByArch = {
|
|
30
|
+
arm64: 'vc_redist.arm64.exe',
|
|
31
|
+
ia32: 'vc_redist.x86.exe',
|
|
32
|
+
x64: 'vc_redist.x64.exe'
|
|
33
|
+
};
|
|
34
|
+
|
|
28
35
|
const packageBase = getPackageBase();
|
|
29
36
|
|
|
30
37
|
if (!packageBase) {
|
|
@@ -61,6 +68,22 @@ const requireWithFriendlyError = id => {
|
|
|
61
68
|
try {
|
|
62
69
|
return require(id);
|
|
63
70
|
} catch (error) {
|
|
71
|
+
if (
|
|
72
|
+
platform === 'win32' &&
|
|
73
|
+
error instanceof Error &&
|
|
74
|
+
error.code === 'ERR_DLOPEN_FAILED' &&
|
|
75
|
+
error.message.includes('The specified module could not be found')
|
|
76
|
+
) {
|
|
77
|
+
const msvcDownloadLink = `https://aka.ms/vs/17/release/${msvcLinkFilenameByArch[arch]}`;
|
|
78
|
+
throw new Error(
|
|
79
|
+
`Failed to load module ${id}. ` +
|
|
80
|
+
'Required DLL was not found. ' +
|
|
81
|
+
'This error usually happens when Microsoft Visual C++ Redistributable is not installed. ' +
|
|
82
|
+
`You can download it from ${msvcDownloadLink}`,
|
|
83
|
+
{ cause: error }
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
64
87
|
throw new Error(
|
|
65
88
|
`Cannot find module ${id}. ` +
|
|
66
89
|
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
package/dist/parseAst.js
CHANGED