@expo/metro-config 58.0.11 → 58.0.12
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/build/serializer/chunking/Chunk.d.ts +45 -0
- package/build/serializer/chunking/Chunk.js +409 -0
- package/build/serializer/chunking/Chunk.js.map +1 -0
- package/build/serializer/chunking/chunkingStrategy.d.ts +40 -0
- package/build/serializer/chunking/chunkingStrategy.js +155 -0
- package/build/serializer/chunking/chunkingStrategy.js.map +1 -0
- package/build/serializer/chunking/computeBitSetChunks.d.ts +49 -0
- package/build/serializer/chunking/computeBitSetChunks.js +268 -0
- package/build/serializer/chunking/computeBitSetChunks.js.map +1 -0
- package/build/serializer/{computeChunkFilenames.d.ts → chunking/computeChunkFilenames.d.ts} +1 -1
- package/build/serializer/chunking/computeChunkFilenames.js.map +1 -0
- package/build/serializer/chunking/createGranularChunkingStrategy.d.ts +2 -0
- package/build/serializer/chunking/createGranularChunkingStrategy.js +282 -0
- package/build/serializer/chunking/createGranularChunkingStrategy.js.map +1 -0
- package/build/serializer/chunking/createLegacyChunkingStrategy.d.ts +2 -0
- package/build/serializer/chunking/createLegacyChunkingStrategy.js +167 -0
- package/build/serializer/chunking/createLegacyChunkingStrategy.js.map +1 -0
- package/build/serializer/chunking/findUnsupportedWorkerAsyncDependency.d.ts +7 -0
- package/build/serializer/chunking/findUnsupportedWorkerAsyncDependency.js +54 -0
- package/build/serializer/chunking/findUnsupportedWorkerAsyncDependency.js.map +1 -0
- package/build/serializer/exportPath.d.ts +1 -0
- package/build/serializer/exportPath.js +18 -3
- package/build/serializer/exportPath.js.map +1 -1
- package/build/serializer/fork/baseJSBundle.d.ts +5 -1
- package/build/serializer/fork/baseJSBundle.js +23 -1
- package/build/serializer/fork/baseJSBundle.js.map +1 -1
- package/build/serializer/fork/js.d.ts +6 -4
- package/build/serializer/fork/js.js +11 -1
- package/build/serializer/fork/js.js.map +1 -1
- package/build/serializer/fork/processModules.d.ts +4 -14
- package/build/serializer/fork/processModules.js +2 -12
- package/build/serializer/fork/processModules.js.map +1 -1
- package/build/serializer/serializeChunks.d.ts +4 -47
- package/build/serializer/serializeChunks.js +17 -655
- package/build/serializer/serializeChunks.js.map +1 -1
- package/build/serializer/serializerAssets.d.ts +13 -1
- package/build/serializer/withExpoSerializers.js +11 -1
- package/build/serializer/withExpoSerializers.js.map +1 -1
- package/package.json +3 -3
- package/build/serializer/computeChunkFilenames.js.map +0 -1
- /package/build/serializer/{computeChunkFilenames.js → chunking/computeChunkFilenames.js} +0 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "createGranularChunkingStrategy", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return createGranularChunkingStrategy;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function _isResolvedDependency() {
|
|
12
|
+
const data = require("@expo/metro/metro/lib/isResolvedDependency");
|
|
13
|
+
_isResolvedDependency = function() {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
function _assert() {
|
|
19
|
+
const data = /*#__PURE__*/ _interop_require_default(require("assert"));
|
|
20
|
+
_assert = function() {
|
|
21
|
+
return data;
|
|
22
|
+
};
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
25
|
+
function _crypto() {
|
|
26
|
+
const data = require("crypto");
|
|
27
|
+
_crypto = function() {
|
|
28
|
+
return data;
|
|
29
|
+
};
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
function _path() {
|
|
33
|
+
const data = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
34
|
+
_path = function() {
|
|
35
|
+
return data;
|
|
36
|
+
};
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
const _filePath = require("../../utils/filePath");
|
|
40
|
+
const _exportPath = require("../exportPath");
|
|
41
|
+
const _Chunk = require("./Chunk");
|
|
42
|
+
const _chunkingStrategy = require("./chunkingStrategy");
|
|
43
|
+
const _computeBitSetChunks = require("./computeBitSetChunks");
|
|
44
|
+
function _interop_require_default(obj) {
|
|
45
|
+
return obj && obj.__esModule ? obj : {
|
|
46
|
+
default: obj
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function createGranularChunkingStrategy(context) {
|
|
50
|
+
const { entryFile, graph, options } = context;
|
|
51
|
+
let entryPathsByChunk = new Map();
|
|
52
|
+
let requiredChunksByEntryPath = new Map();
|
|
53
|
+
let workerChunksByEntryPath = new Map();
|
|
54
|
+
function getChunkTargets(chunk, dependency) {
|
|
55
|
+
const asyncType = dependency.data.data.asyncType;
|
|
56
|
+
if (asyncType == null || asyncType === 'weak') return [];
|
|
57
|
+
if (asyncType === 'worker') {
|
|
58
|
+
const workerChunk = workerChunksByEntryPath.get(dependency.absolutePath);
|
|
59
|
+
(0, _assert().default)(workerChunk, `Worker chunk not found for: ${dependency.absolutePath}`);
|
|
60
|
+
return [
|
|
61
|
+
workerChunk
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
const targets = requiredChunksByEntryPath.get(dependency.absolutePath);
|
|
65
|
+
(0, _assert().default)(targets, `Granular async entry not found: ${dependency.absolutePath}`);
|
|
66
|
+
// The importing chunk is already loaded. Return the other chunks needed by
|
|
67
|
+
// the imported entry; the loader skips files it has already loaded.
|
|
68
|
+
return targets.filter((target)=>target !== chunk);
|
|
69
|
+
}
|
|
70
|
+
const strategy = {
|
|
71
|
+
async serializeAsync () {
|
|
72
|
+
const entryModule = graph.dependencies.get(entryFile);
|
|
73
|
+
(0, _assert().default)(entryModule, `Granular entry is missing from the export graph: ${entryFile}`);
|
|
74
|
+
const plan = (0, _computeBitSetChunks.computeBitSetChunkPlan)([
|
|
75
|
+
entryModule
|
|
76
|
+
], graph, {
|
|
77
|
+
isLazyBundle: options.includeAsyncPaths
|
|
78
|
+
});
|
|
79
|
+
const materializedPlan = materializeChunkPlan(context, strategy, plan);
|
|
80
|
+
const { chunks, entryChunk } = materializedPlan;
|
|
81
|
+
entryPathsByChunk = materializedPlan.entryPathsByChunk;
|
|
82
|
+
requiredChunksByEntryPath = assignEntryChunkRequirements(plan, materializedPlan);
|
|
83
|
+
const workers = collectWorkerChunks(context, strategy, plan.workerEntries);
|
|
84
|
+
workerChunksByEntryPath = workers.chunksByEntryPath;
|
|
85
|
+
for (const workerChunk of workers.chunks)chunks.add(workerChunk);
|
|
86
|
+
// Application chunks share one module registry. Extract its runtime so it can load
|
|
87
|
+
// before dependent chunks; sealed workers already carry independent runtimes.
|
|
88
|
+
if ([
|
|
89
|
+
...chunks
|
|
90
|
+
].some((chunk)=>chunk.isAsync && !chunk.sealed)) {
|
|
91
|
+
(0, _chunkingStrategy.createRuntimeChunk)(entryChunk, chunks, strategy, [
|
|
92
|
+
...chunks
|
|
93
|
+
].filter((chunk)=>!chunk.sealed));
|
|
94
|
+
}
|
|
95
|
+
const orderedChunks = new Set([
|
|
96
|
+
entryChunk,
|
|
97
|
+
...[
|
|
98
|
+
...chunks
|
|
99
|
+
].filter((chunk)=>chunk !== entryChunk).sort((a, b)=>a.name.localeCompare(b.name, 'en'))
|
|
100
|
+
]);
|
|
101
|
+
assignModuleIds(orderedChunks, options.createModuleId);
|
|
102
|
+
return (0, _chunkingStrategy.serializeChunksAsync)(orderedChunks, context);
|
|
103
|
+
},
|
|
104
|
+
getAsyncChunkTargets (chunk) {
|
|
105
|
+
const targets = new Set();
|
|
106
|
+
if (options.includeAsyncPaths) return targets;
|
|
107
|
+
for (const module of chunk.deps){
|
|
108
|
+
for (const dependency of module.dependencies.values()){
|
|
109
|
+
if ((0, _isResolvedDependency().isResolvedDependency)(dependency) && dependency.data.data.asyncType) {
|
|
110
|
+
for (const target of getChunkTargets(chunk, dependency))targets.add(target);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return targets;
|
|
115
|
+
},
|
|
116
|
+
getStableSerializationOptions (chunk) {
|
|
117
|
+
return {
|
|
118
|
+
includeChunkCompletion: chunk.isAsync && !chunk.sealed,
|
|
119
|
+
includeAsyncPaths: false,
|
|
120
|
+
unstable_getAsyncDependencyPath: undefined
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
getSerializationOptions (chunk, _chunksByPath, filenamesByChunk) {
|
|
124
|
+
return {
|
|
125
|
+
computedAsyncModulePaths: null,
|
|
126
|
+
includeAsyncPaths: true,
|
|
127
|
+
unstable_getAsyncDependencyPath: (dependency)=>{
|
|
128
|
+
const targets = getChunkTargets(chunk, dependency);
|
|
129
|
+
const chunkUrls = targets.map((target)=>{
|
|
130
|
+
const filename = filenamesByChunk.get(target);
|
|
131
|
+
(0, _assert().default)(filename, `Precomputed filename missing for chunk: ${target.name}`);
|
|
132
|
+
return (0, _exportPath.getChunkUrl)((0, _Chunk.getBaseUrlOption)(graph, options), filename);
|
|
133
|
+
});
|
|
134
|
+
return dependency.data.data.asyncType === 'worker' ? chunkUrls[0] ?? null : chunkUrls.length ? chunkUrls : null;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
getMetadata (chunk, filenamesByChunk) {
|
|
139
|
+
const modulePaths = [
|
|
140
|
+
...chunk.deps
|
|
141
|
+
].map((module)=>module.path);
|
|
142
|
+
return {
|
|
143
|
+
chunkingStrategy: 'granular',
|
|
144
|
+
...chunk.isEntry && !chunk.sealed && {
|
|
145
|
+
entryChunks: Object.fromEntries([
|
|
146
|
+
...requiredChunksByEntryPath
|
|
147
|
+
].map(([entryPath, requiredChunks])=>[
|
|
148
|
+
entryPath,
|
|
149
|
+
requiredChunks.map((requiredChunk)=>{
|
|
150
|
+
const filename = filenamesByChunk.get(requiredChunk);
|
|
151
|
+
(0, _assert().default)(filename, `Required chunk was not emitted: ${requiredChunk.name}`);
|
|
152
|
+
return filename;
|
|
153
|
+
})
|
|
154
|
+
]))
|
|
155
|
+
},
|
|
156
|
+
entryPaths: [
|
|
157
|
+
...entryPathsByChunk.get(chunk) ?? []
|
|
158
|
+
].sort(),
|
|
159
|
+
modulePaths: chunk.sealed ? modulePaths : modulePaths.sort()
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
return strategy;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Create a chunk for each group of modules with the same owners, and track which entries
|
|
167
|
+
* each chunk represents.
|
|
168
|
+
*/ function materializeChunkPlan({ entryFile, preModules, graph, options }, strategy, plan) {
|
|
169
|
+
const chunks = new Set();
|
|
170
|
+
const entryPathsByChunk = new Map();
|
|
171
|
+
const facadesByEntryPath = new Map();
|
|
172
|
+
for (const { module, kind } of plan.entryPoints){
|
|
173
|
+
const facade = new _Chunk.Chunk(module.path, new Set([
|
|
174
|
+
module
|
|
175
|
+
]), graph, options, strategy, kind !== 'initial', false, kind === 'initial');
|
|
176
|
+
facade.deps.clear();
|
|
177
|
+
entryPathsByChunk.set(facade, [
|
|
178
|
+
module.path
|
|
179
|
+
]);
|
|
180
|
+
facadesByEntryPath.set(module.path, facade);
|
|
181
|
+
chunks.add(facade);
|
|
182
|
+
}
|
|
183
|
+
const entryChunk = facadesByEntryPath.get(entryFile);
|
|
184
|
+
entryChunk.preModules = new Set(preModules);
|
|
185
|
+
const chunksByAtom = new Map();
|
|
186
|
+
for (const atom of plan.chunks){
|
|
187
|
+
const entryIndices = [
|
|
188
|
+
...(0, _computeBitSetChunks.bitIndices)(atom.ownerEntries)
|
|
189
|
+
];
|
|
190
|
+
let ownerChunk;
|
|
191
|
+
if (entryIndices.length === 1) {
|
|
192
|
+
ownerChunk = facadesByEntryPath.get(plan.entryPoints[entryIndices[0]].module.path);
|
|
193
|
+
} else {
|
|
194
|
+
// Owner paths remain stable when unrelated entries shift the planner's bit positions.
|
|
195
|
+
const ownerPaths = entryIndices.map((index)=>(0, _filePath.toPosixPath)(_path().default.relative(options.serverRoot ?? options.projectRoot, plan.entryPoints[index].module.path))).sort();
|
|
196
|
+
const hash = (0, _crypto().createHash)('sha256').update(JSON.stringify(ownerPaths)).digest('hex').slice(0, 16);
|
|
197
|
+
ownerChunk = new _Chunk.Chunk(`/__shared-${hash}.js`, new Set(), graph, options, strategy, true);
|
|
198
|
+
chunks.add(ownerChunk);
|
|
199
|
+
}
|
|
200
|
+
ownerChunk.deps = new Set(atom.modules);
|
|
201
|
+
chunksByAtom.set(atom, ownerChunk);
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
chunks,
|
|
205
|
+
entryChunk,
|
|
206
|
+
entryPathsByChunk,
|
|
207
|
+
facadesByEntryPath,
|
|
208
|
+
chunksByAtom
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Map each entry to its required files. If its modules are all in other chunks,
|
|
213
|
+
* remove its empty entry chunk but keep that mapping.
|
|
214
|
+
* The returned map includes the entry's own file when emitted, and excludes the initial chunk.
|
|
215
|
+
*/ function assignEntryChunkRequirements(plan, { chunks, entryChunk, entryPathsByChunk, facadesByEntryPath, chunksByAtom }) {
|
|
216
|
+
const requiredChunksByEntryPath = new Map();
|
|
217
|
+
for (const [entryPath, atoms] of plan.requiredChunksByEntryPath){
|
|
218
|
+
const facade = facadesByEntryPath.get(entryPath);
|
|
219
|
+
const requiredChunks = new Set([
|
|
220
|
+
facade,
|
|
221
|
+
...atoms.map((atom)=>chunksByAtom.get(atom))
|
|
222
|
+
]);
|
|
223
|
+
requiredChunks.delete(entryChunk);
|
|
224
|
+
if (facade !== entryChunk && facade.deps.size === 0) {
|
|
225
|
+
chunks.delete(facade);
|
|
226
|
+
entryPathsByChunk.delete(facade);
|
|
227
|
+
requiredChunks.delete(facade);
|
|
228
|
+
// An entry supplied entirely by the initial bundle has no additional files to request.
|
|
229
|
+
if (requiredChunks.size === 0) entryPathsByChunk.get(entryChunk).push(entryPath);
|
|
230
|
+
}
|
|
231
|
+
// Asset ordering needs the dependencies before the entry's file, excluding the file itself.
|
|
232
|
+
for (const ownerChunk of requiredChunks){
|
|
233
|
+
if (ownerChunk !== facade) facade.requiredChunks.add(ownerChunk);
|
|
234
|
+
}
|
|
235
|
+
requiredChunksByEntryPath.set(entryPath, [
|
|
236
|
+
...requiredChunks
|
|
237
|
+
]);
|
|
238
|
+
}
|
|
239
|
+
return requiredChunksByEntryPath;
|
|
240
|
+
}
|
|
241
|
+
function collectWorkerChunks(context, strategy, workerEntries) {
|
|
242
|
+
const { preModules } = context;
|
|
243
|
+
const workerChunksByEntryPath = new Map();
|
|
244
|
+
// Graphs with async imports inside workers use legacy chunking before this planner runs.
|
|
245
|
+
// Supported workers keep their own runtime and copies of dependencies shared with the application.
|
|
246
|
+
const workerChunks = new Set();
|
|
247
|
+
const collectChunk = (0, _chunkingStrategy.createChunkCollector)(context, strategy, workerChunks, (dependency)=>dependency.data.data.asyncType !== 'weak');
|
|
248
|
+
for (const module of workerEntries){
|
|
249
|
+
const chunk = collectChunk(module.path, preModules, true, true);
|
|
250
|
+
(0, _assert().default)(chunk, `Worker chunk not found for: ${module.path}`);
|
|
251
|
+
chunk.seal();
|
|
252
|
+
}
|
|
253
|
+
for (const workerChunk of workerChunks){
|
|
254
|
+
(0, _assert().default)(workerChunk.sealed, 'Worker async edges must fall back to legacy before Granular planning.');
|
|
255
|
+
for (const module of workerChunk.entries)workerChunksByEntryPath.set(module.path, workerChunk);
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
chunks: workerChunks,
|
|
259
|
+
chunksByEntryPath: workerChunksByEntryPath
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function assignModuleIds(chunks, createModuleId) {
|
|
263
|
+
// Assign module IDs before serialization so chunk order does not determine them.
|
|
264
|
+
// Keep previously assigned module IDs.
|
|
265
|
+
const modulePaths = new Set();
|
|
266
|
+
for (const chunk of chunks){
|
|
267
|
+
for (const module of [
|
|
268
|
+
...chunk.preModules,
|
|
269
|
+
...chunk.deps
|
|
270
|
+
]){
|
|
271
|
+
modulePaths.add(module.path);
|
|
272
|
+
for (const dependency of module.dependencies.values()){
|
|
273
|
+
if ((0, _isResolvedDependency().isResolvedDependency)(dependency)) modulePaths.add(dependency.absolutePath);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
for (const modulePath of [
|
|
278
|
+
...modulePaths
|
|
279
|
+
].sort())createModuleId(modulePath);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
//# sourceMappingURL=createGranularChunkingStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["serializer/chunking/createGranularChunkingStrategy.ts"],"sourcesContent":[null],"names":["createGranularChunkingStrategy","context","entryFile","graph","options","entryPathsByChunk","Map","requiredChunksByEntryPath","workerChunksByEntryPath","getChunkTargets","chunk","dependency","asyncType","data","workerChunk","get","absolutePath","assert","targets","filter","target","strategy","serializeAsync","entryModule","dependencies","plan","computeBitSetChunkPlan","isLazyBundle","includeAsyncPaths","materializedPlan","materializeChunkPlan","chunks","entryChunk","assignEntryChunkRequirements","workers","collectWorkerChunks","workerEntries","chunksByEntryPath","add","some","isAsync","sealed","createRuntimeChunk","orderedChunks","Set","sort","a","b","name","localeCompare","assignModuleIds","createModuleId","serializeChunksAsync","getAsyncChunkTargets","module","deps","values","isResolvedDependency","getStableSerializationOptions","includeChunkCompletion","unstable_getAsyncDependencyPath","undefined","getSerializationOptions","_chunksByPath","filenamesByChunk","computedAsyncModulePaths","chunkUrls","map","filename","getChunkUrl","getBaseUrlOption","length","getMetadata","modulePaths","path","chunkingStrategy","isEntry","entryChunks","Object","fromEntries","entryPath","requiredChunks","requiredChunk","entryPaths","preModules","facadesByEntryPath","kind","entryPoints","facade","Chunk","clear","set","chunksByAtom","atom","entryIndices","bitIndices","ownerEntries","ownerChunk","ownerPaths","index","toPosixPath","relative","serverRoot","projectRoot","hash","createHash","update","JSON","stringify","digest","slice","modules","atoms","delete","size","push","workerChunks","collect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OAAQ;QAC1B,KAAK,MAAMuB,UAAU;eAAI5C,MAAM0E,UAAU;eAAK1E,MAAM6C,IAAI;SAAC,CAAE;YACzDkB,YAAYnC,GAAG,CAACgB,OAAOoB,IAAI;YAC3B,KAAK,MAAM/D,cAAc2C,OAAO9B,YAAY,CAACgC,MAAM,GAAI;gBACrD,IAAIC,IAAAA,4CAAoB,EAAC9C,aAAa8D,YAAYnC,GAAG,CAAC3B,WAAWK,YAAY;YAC/E;QACF;IACF;IACA,KAAK,MAAMyG,cAAc;WAAIhD;KAAY,CAAC5B,IAAI,GAAIM,eAAesE;AACnE"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "createLegacyChunkingStrategy", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return createLegacyChunkingStrategy;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function _isResolvedDependency() {
|
|
12
|
+
const data = require("@expo/metro/metro/lib/isResolvedDependency");
|
|
13
|
+
_isResolvedDependency = function() {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
function _assert() {
|
|
19
|
+
const data = /*#__PURE__*/ _interop_require_default(require("assert"));
|
|
20
|
+
_assert = function() {
|
|
21
|
+
return data;
|
|
22
|
+
};
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
25
|
+
const _Chunk = require("./Chunk");
|
|
26
|
+
const _chunkingStrategy = require("./chunkingStrategy");
|
|
27
|
+
function _interop_require_default(obj) {
|
|
28
|
+
return obj && obj.__esModule ? obj : {
|
|
29
|
+
default: obj
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function createLegacyChunkingStrategy(context) {
|
|
33
|
+
const { entryFile, preModules, graph, options } = context;
|
|
34
|
+
const strategy = {
|
|
35
|
+
async serializeAsync () {
|
|
36
|
+
// Create chunks for splitting.
|
|
37
|
+
const chunks = new Set();
|
|
38
|
+
const collectChunk = (0, _chunkingStrategy.createChunkCollector)(context, strategy, chunks, ()=>true);
|
|
39
|
+
const entryChunk = collectChunk(entryFile, preModules, false, true);
|
|
40
|
+
if (entryChunk) {
|
|
41
|
+
removeEntryDepsFromAsyncChunks(entryChunk, chunks);
|
|
42
|
+
const commonChunk = extractCommonChunk(chunks, graph, options, strategy);
|
|
43
|
+
if (commonChunk) {
|
|
44
|
+
entryChunk.requiredChunks.add(commonChunk);
|
|
45
|
+
chunks.add(commonChunk);
|
|
46
|
+
}
|
|
47
|
+
deduplicateAgainstKnownChunks(chunks, entryChunk, commonChunk);
|
|
48
|
+
removeEmptyChunks(chunks);
|
|
49
|
+
if (commonChunk) {
|
|
50
|
+
(0, _chunkingStrategy.createRuntimeChunk)(entryChunk, chunks, strategy);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return (0, _chunkingStrategy.serializeChunksAsync)(chunks, context);
|
|
54
|
+
},
|
|
55
|
+
getAsyncChunkTargets (chunk, chunksByPath) {
|
|
56
|
+
const targets = new Set();
|
|
57
|
+
if (options.includeAsyncPaths) return targets;
|
|
58
|
+
for (const module of chunk.deps){
|
|
59
|
+
for (const dependency of module.dependencies.values()){
|
|
60
|
+
if ((0, _isResolvedDependency().isResolvedDependency)(dependency) && dependency.data.data.asyncType) {
|
|
61
|
+
const target = chunksByPath.get(dependency.absolutePath);
|
|
62
|
+
// Merges can leave async imports pointing at eagerly loaded chunks.
|
|
63
|
+
if (target?.isAsync) targets.add(target);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return targets;
|
|
68
|
+
},
|
|
69
|
+
getStableSerializationOptions () {
|
|
70
|
+
return {};
|
|
71
|
+
},
|
|
72
|
+
getSerializationOptions (chunk, chunksByPath, filenamesByChunk) {
|
|
73
|
+
return {
|
|
74
|
+
computedAsyncModulePaths: getComputedPathsForAsyncDependencies(chunk, chunksByPath, filenamesByChunk)
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
getMetadata (chunk) {
|
|
78
|
+
return {
|
|
79
|
+
modulePaths: [
|
|
80
|
+
...chunk.deps
|
|
81
|
+
].map((module)=>module.path)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
return strategy;
|
|
86
|
+
}
|
|
87
|
+
function getComputedPathsForAsyncDependencies(chunk, chunksByPath, filenamesByChunk) {
|
|
88
|
+
const baseUrl = (0, _Chunk.getBaseUrlOption)(chunk.graph, chunk.options);
|
|
89
|
+
// Only calculate production paths when all chunks are being exported.
|
|
90
|
+
if (chunk.options.includeAsyncPaths) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
const computedAsyncModulePaths = {};
|
|
94
|
+
chunk.deps.forEach((module)=>{
|
|
95
|
+
module.dependencies.forEach((dependency)=>{
|
|
96
|
+
if ((0, _isResolvedDependency().isResolvedDependency)(dependency) && dependency.data.data.asyncType) {
|
|
97
|
+
const chunkContainingModule = chunksByPath.get(dependency.absolutePath);
|
|
98
|
+
(0, _assert().default)(chunkContainingModule, 'Chunk containing module not found: ' + dependency.absolutePath);
|
|
99
|
+
if (chunkContainingModule.isAsync) {
|
|
100
|
+
const moduleIdName = filenamesByChunk.get(chunkContainingModule);
|
|
101
|
+
(0, _assert().default)(moduleIdName, 'Precomputed filename missing for async chunk: ' + chunkContainingModule.name);
|
|
102
|
+
computedAsyncModulePaths[dependency.absolutePath] = (baseUrl ?? '/') + moduleIdName;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
return computedAsyncModulePaths;
|
|
108
|
+
}
|
|
109
|
+
function removeEntryDepsFromAsyncChunks(entryChunk, chunks) {
|
|
110
|
+
for (const chunk of chunks){
|
|
111
|
+
if (!chunk.sealed && !chunk.isEntry && chunk.isAsync) {
|
|
112
|
+
for (const dep of chunk.deps){
|
|
113
|
+
if (entryChunk.deps.has(dep)) {
|
|
114
|
+
// Remove the dependency from the async chunk since it will be loaded in the main chunk.
|
|
115
|
+
chunk.deps.delete(dep);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function extractCommonChunk(chunks, graph, options, strategy) {
|
|
122
|
+
const toCompare = [
|
|
123
|
+
...chunks.values()
|
|
124
|
+
].filter((chunk)=>!chunk.sealed);
|
|
125
|
+
const commonDependencies = new Set();
|
|
126
|
+
while(toCompare.length){
|
|
127
|
+
const chunk = toCompare.shift();
|
|
128
|
+
for (const chunk2 of toCompare){
|
|
129
|
+
if (chunk !== chunk2 && chunk.isAsync && chunk2.isAsync) {
|
|
130
|
+
for (const dep of chunk.deps){
|
|
131
|
+
if (chunk2.deps.has(dep)) {
|
|
132
|
+
chunk.deps.delete(dep);
|
|
133
|
+
chunk2.deps.delete(dep);
|
|
134
|
+
commonDependencies.add(dep);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// If common dependencies were found, extract them to the shared chunk.
|
|
141
|
+
if (commonDependencies.size) {
|
|
142
|
+
return new _Chunk.Chunk('/__common.js', commonDependencies, graph, options, strategy, false, true);
|
|
143
|
+
}
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
function deduplicateAgainstKnownChunks(chunks, entryChunk, commonChunk) {
|
|
147
|
+
// TODO: Optimize this pass more.
|
|
148
|
+
// Remove all dependencies from async chunks that are already in the common chunk.
|
|
149
|
+
for (const chunk of chunks){
|
|
150
|
+
if (!chunk.sealed && !chunk.isEntry && chunk !== commonChunk) {
|
|
151
|
+
for (const dep of chunk.deps){
|
|
152
|
+
if (entryChunk.deps.has(dep) || commonChunk?.deps.has(dep)) {
|
|
153
|
+
chunk.deps.delete(dep);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function removeEmptyChunks(chunks) {
|
|
160
|
+
for (const chunk of chunks){
|
|
161
|
+
if (!chunk.sealed && !chunk.isEntry && chunk.deps.size === 0) {
|
|
162
|
+
chunks.delete(chunk);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
//# sourceMappingURL=createLegacyChunkingStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["serializer/chunking/createLegacyChunkingStrategy.ts"],"sourcesContent":[null],"names":["createLegacyChunkingStrategy","context","entryFile","preModules","graph","options","strategy","serializeAsync","chunks","Set","collectChunk","createChunkCollector","entryChunk","removeEntryDepsFromAsyncChunks","commonChunk","extractCommonChunk","requiredChunks","add","deduplicateAgainstKnownChunks","removeEmptyChunks","createRuntimeChunk","serializeChunksAsync","getAsyncChunkTargets","chunk","chunksByPath","targets","includeAsyncPaths","module","deps","dependency","dependencies","values","isResolvedDependency","data","asyncType","target","get","absolutePath","isAsync","getStableSerializationOptions","getSerializationOptions","filenamesByChunk","computedAsyncModulePaths","getComputedPathsForAsyncDependencies","getMetadata","modulePaths","map","path","baseUrl","getBaseUrlOption","forEach","chunkContainingModule","assert","moduleIdName","name","sealed","isEntry","dep","has","delete","toCompare","filter","commonDependencies","length","shift","chunk2","size","Chunk","undefined"],"mappings":";;;;+BAcgBA;;;eAAAA;;;;yBAbqB;;;;;;;gEAClB;;;;;;uBAGqB;kCAOjC;;;;;;AAEA,SAASA,6BAA6BC,OAAwB;IACnE,MAAM,EAAEC,SAAS,EAAEC,UAAU,EAAEC,KAAK,EAAEC,OAAO,EAAE,GAAGJ;IAClD,MAAMK,WAAmC;QACvC,MAAMC;YACJ,+BAA+B;YAC/B,MAAMC,SAAS,IAAIC;YACnB,MAAMC,eAAeC,IAAAA,sCAAoB,EAACV,SAASK,UAAUE,QAAQ,IAAM;YAC3E,MAAMI,aAAaF,aAAaR,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I,KAAK,GAAG;YAC5D1D,OAAOmD,MAAM,CAACpC;QAChB;IACF;AACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReadOnlyGraph } from '@expo/metro/metro/DeltaBundler/types';
|
|
2
|
+
export declare function findUnsupportedWorkerAsyncDependency(entryFile: string, graph: ReadOnlyGraph): {
|
|
3
|
+
workerEntry: string;
|
|
4
|
+
importer: string;
|
|
5
|
+
target: string;
|
|
6
|
+
asyncType: 'async' | 'maybeSync' | 'prefetch';
|
|
7
|
+
} | undefined;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "findUnsupportedWorkerAsyncDependency", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return findUnsupportedWorkerAsyncDependency;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function _isResolvedDependency() {
|
|
12
|
+
const data = require("@expo/metro/metro/lib/isResolvedDependency");
|
|
13
|
+
_isResolvedDependency = function() {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
function findUnsupportedWorkerAsyncDependency(entryFile, graph) {
|
|
19
|
+
// A module can run in both the application and a worker, so track their dependencies separately.
|
|
20
|
+
const pending = [
|
|
21
|
+
{
|
|
22
|
+
modulePath: entryFile
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
const visitedPages = new Set();
|
|
26
|
+
const visitedWorkers = new Set();
|
|
27
|
+
for(let index = 0; index < pending.length; index++){
|
|
28
|
+
const { modulePath, workerEntry } = pending[index];
|
|
29
|
+
const visited = workerEntry === undefined ? visitedPages : visitedWorkers;
|
|
30
|
+
if (visited.has(modulePath)) continue;
|
|
31
|
+
visited.add(modulePath);
|
|
32
|
+
const module = graph.dependencies.get(modulePath);
|
|
33
|
+
if (!module) continue;
|
|
34
|
+
for (const dependency of module.dependencies.values()){
|
|
35
|
+
const asyncType = dependency.data.data.asyncType;
|
|
36
|
+
if (!(0, _isResolvedDependency().isResolvedDependency)(dependency) || asyncType === 'weak') continue;
|
|
37
|
+
if (workerEntry !== undefined && (asyncType === 'async' || asyncType === 'maybeSync' || asyncType === 'prefetch')) {
|
|
38
|
+
return {
|
|
39
|
+
workerEntry,
|
|
40
|
+
importer: modulePath,
|
|
41
|
+
target: dependency.absolutePath,
|
|
42
|
+
asyncType
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
pending.push({
|
|
46
|
+
modulePath: dependency.absolutePath,
|
|
47
|
+
workerEntry: asyncType === 'worker' ? dependency.absolutePath : workerEntry
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=findUnsupportedWorkerAsyncDependency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["serializer/chunking/findUnsupportedWorkerAsyncDependency.ts"],"sourcesContent":[null],"names":["findUnsupportedWorkerAsyncDependency","entryFile","graph","pending","modulePath","visitedPages","Set","visitedWorkers","index","length","workerEntry","visited","undefined","has","add","module","dependencies","get","dependency","values","asyncType","data","isResolvedDependency","importer","target","absolutePath","push"],"mappings":";;;;+BAKgBA;;;eAAAA;;;;yBAJqB;;;;;;AAI9B,SAASA,qCACdC,SAAiB,EACjBC,KAAoB;IASpB,iGAAiG;IACjG,MAAMC,UAA0D;QAAC;YAAEC,YAAYH;QAAU;KAAE;IAC3F,MAAMI,eAAe,IAAIC;IACzB,MAAMC,iBAAiB,IAAID;IAC3B,IAAK,IAAIE,QAAQ,GAAGA,QAAQL,QAAQM,MAAM,EAAED,QAAS;QACnD,MAAM,EAAEJ,UAAU,EAAEM,WAAW,EAAE,GAAGP,OAAO,CAACK,MAAM;QAClD,MAAMG,UAAUD,gBAAgBE,YAAYP,eAAeE;QAC3D,IAAII,QAAQE,GAAG,CAACT,aAAa;QAC7BO,QAAQG,GAAG,CAACV;QACZ,MAAMW,SAASb,MAAMc,YAAY,CAACC,GAAG,CAACb;QACtC,IAAI,CAACW,QAAQ;QACb,KAAK,MAAMG,cAAcH,OAAOC,YAAY,CAACG,MAAM,GAAI;YACrD,MAAMC,YAAYF,WAAWG,IAAI,CAACA,IAAI,CAACD,SAAS;YAChD,IAAI,CAACE,IAAAA,4CAAoB,EAACJ,eAAeE,cAAc,QAAQ;YAC/D,IACEV,gBAAgBE,aACfQ,CAAAA,cAAc,WAAWA,cAAc,eAAeA,cAAc,UAAS,GAC9E;gBACA,OAAO;oBACLV;oBACAa,UAAUnB;oBACVoB,QAAQN,WAAWO,YAAY;oBAC/BL;gBACF;YACF;YACAjB,QAAQuB,IAAI,CAAC;gBACXtB,YAAYc,WAAWO,YAAY;gBACnCf,aAAaU,cAAc,WAAWF,WAAWO,YAAY,GAAGf;YAClE;QACF;IACF;IACA,OAAOE;AACT"}
|
|
@@ -7,9 +7,21 @@
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
0 && (module.exports = {
|
|
11
|
+
getChunkUrl: null,
|
|
12
|
+
getExportPathForDependencyWithOptions: null
|
|
13
|
+
});
|
|
14
|
+
function _export(target, all) {
|
|
15
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
_export(exports, {
|
|
21
|
+
get getChunkUrl () {
|
|
22
|
+
return getChunkUrl;
|
|
23
|
+
},
|
|
24
|
+
get getExportPathForDependencyWithOptions () {
|
|
13
25
|
return getExportPathForDependencyWithOptions;
|
|
14
26
|
}
|
|
15
27
|
});
|
|
@@ -26,6 +38,9 @@ function _interop_require_default(obj) {
|
|
|
26
38
|
default: obj
|
|
27
39
|
};
|
|
28
40
|
}
|
|
41
|
+
function getChunkUrl(baseUrl, filename) {
|
|
42
|
+
return baseUrl.replace(/\/+$/, '') + '/' + filename.replace(/^\/+/, '');
|
|
43
|
+
}
|
|
29
44
|
function getExportPathForDependencyWithOptions(dependencyPath, { platform, src, serverRoot }) {
|
|
30
45
|
const bundlePath = _path().default.relative(serverRoot, dependencyPath);
|
|
31
46
|
const relativePathname = _path().default.join(_path().default.dirname(bundlePath), // Strip the file extension
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["serializer/exportPath.ts"],"sourcesContent":[null],"names":["getExportPathForDependencyWithOptions","dependencyPath","platform","src","serverRoot","bundlePath","path","relative","relativePathname","join","dirname","basename","extname","name","fileNameFromContents","filepath"],"mappings":"AAAA;;;;;CAKC
|
|
1
|
+
{"version":3,"sources":["serializer/exportPath.ts"],"sourcesContent":[null],"names":["getChunkUrl","getExportPathForDependencyWithOptions","baseUrl","filename","replace","dependencyPath","platform","src","serverRoot","bundlePath","path","relative","relativePathname","join","dirname","basename","extname","name","fileNameFromContents","filepath"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;;;;;QAKeA;eAAAA;;QAIAC;eAAAA;;;;gEARC;;;;;;4BAEoB;;;;;;AAE9B,SAASD,YAAYE,OAAe,EAAEC,QAAgB;IAC3D,OAAOD,QAAQE,OAAO,CAAC,QAAQ,MAAM,MAAMD,SAASC,OAAO,CAAC,QAAQ;AACtE;AAEO,SAASH,sCACdI,cAAsB,EACtB,EAAEC,QAAQ,EAAEC,GAAG,EAAEC,UAAU,EAAyD;IAEpF,MAAMC,aAAaC,eAAI,CAACC,QAAQ,CAACH,YAAYH;IAC7C,MAAMO,mBAAmBF,eAAI,CAACG,IAAI,CAChCH,eAAI,CAACI,OAAO,CAACL,aACb,2BAA2B;IAC3BC,eAAI,CAACK,QAAQ,CAACN,YAAYC,eAAI,CAACM,OAAO,CAACP;IAEzC,MAAMQ,OAAOC,IAAAA,gCAAoB,EAAC;QAChCC,UAAUP;QACVL;IACF;IACA,OAAO,CAAC,gBAAgB,EAAED,SAAS,CAAC,EAAEW,KAAK,GAAG,CAAC;AACjD"}
|
|
@@ -9,19 +9,23 @@
|
|
|
9
9
|
* https://github.com/facebook/metro/blob/bbdd7d7c5e6e0feb50a9967ffae1f723c1d7c4e8/packages/metro/src/DeltaBundler/Serializers/baseJSBundle.js#L1
|
|
10
10
|
*/
|
|
11
11
|
import type { MixedOutput, Module, ReadOnlyGraph, SerializerOptions } from '@expo/metro/metro/DeltaBundler/types';
|
|
12
|
+
import type { AsyncModulePaths, ChunkingStrategy } from '../serializerAssets';
|
|
12
13
|
export type ModuleMap = [number, string][];
|
|
13
14
|
export type Bundle = {
|
|
14
15
|
modules: ModuleMap;
|
|
15
16
|
post: string;
|
|
16
17
|
pre: string;
|
|
17
|
-
paths: Record<string,
|
|
18
|
+
paths: Record<string, AsyncModulePaths>;
|
|
18
19
|
};
|
|
19
20
|
export type ExpoSerializerOptions = SerializerOptions & {
|
|
21
|
+
/** Append a footer that records this chunk's completed module registration. */
|
|
22
|
+
includeChunkCompletion?: boolean;
|
|
20
23
|
serializerOptions?: {
|
|
21
24
|
baseUrl?: string;
|
|
22
25
|
skipWrapping?: boolean;
|
|
23
26
|
usedExports?: boolean;
|
|
24
27
|
splitChunks?: boolean;
|
|
28
|
+
chunkingStrategy?: ChunkingStrategy;
|
|
25
29
|
output?: string;
|
|
26
30
|
includeSourceMaps?: boolean;
|
|
27
31
|
exporting?: boolean;
|