@expo/metro-config 58.0.11 → 58.0.13

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.
Files changed (46) hide show
  1. package/build/ExpoMetroConfig.js +25 -61
  2. package/build/ExpoMetroConfig.js.map +1 -1
  3. package/build/serializer/chunking/Chunk.d.ts +45 -0
  4. package/build/serializer/chunking/Chunk.js +409 -0
  5. package/build/serializer/chunking/Chunk.js.map +1 -0
  6. package/build/serializer/chunking/chunkingStrategy.d.ts +40 -0
  7. package/build/serializer/chunking/chunkingStrategy.js +155 -0
  8. package/build/serializer/chunking/chunkingStrategy.js.map +1 -0
  9. package/build/serializer/chunking/computeBitSetChunks.d.ts +49 -0
  10. package/build/serializer/chunking/computeBitSetChunks.js +268 -0
  11. package/build/serializer/chunking/computeBitSetChunks.js.map +1 -0
  12. package/build/serializer/{computeChunkFilenames.d.ts → chunking/computeChunkFilenames.d.ts} +1 -1
  13. package/build/serializer/chunking/computeChunkFilenames.js.map +1 -0
  14. package/build/serializer/chunking/createGranularChunkingStrategy.d.ts +2 -0
  15. package/build/serializer/chunking/createGranularChunkingStrategy.js +282 -0
  16. package/build/serializer/chunking/createGranularChunkingStrategy.js.map +1 -0
  17. package/build/serializer/chunking/createLegacyChunkingStrategy.d.ts +2 -0
  18. package/build/serializer/chunking/createLegacyChunkingStrategy.js +167 -0
  19. package/build/serializer/chunking/createLegacyChunkingStrategy.js.map +1 -0
  20. package/build/serializer/chunking/findUnsupportedWorkerAsyncDependency.d.ts +7 -0
  21. package/build/serializer/chunking/findUnsupportedWorkerAsyncDependency.js +54 -0
  22. package/build/serializer/chunking/findUnsupportedWorkerAsyncDependency.js.map +1 -0
  23. package/build/serializer/exportPath.d.ts +1 -0
  24. package/build/serializer/exportPath.js +18 -3
  25. package/build/serializer/exportPath.js.map +1 -1
  26. package/build/serializer/fork/baseJSBundle.d.ts +5 -1
  27. package/build/serializer/fork/baseJSBundle.js +23 -1
  28. package/build/serializer/fork/baseJSBundle.js.map +1 -1
  29. package/build/serializer/fork/js.d.ts +6 -4
  30. package/build/serializer/fork/js.js +11 -1
  31. package/build/serializer/fork/js.js.map +1 -1
  32. package/build/serializer/fork/processModules.d.ts +4 -14
  33. package/build/serializer/fork/processModules.js +2 -12
  34. package/build/serializer/fork/processModules.js.map +1 -1
  35. package/build/serializer/serializeChunks.d.ts +4 -47
  36. package/build/serializer/serializeChunks.js +17 -655
  37. package/build/serializer/serializeChunks.js.map +1 -1
  38. package/build/serializer/serializerAssets.d.ts +13 -1
  39. package/build/serializer/withExpoSerializers.js +11 -1
  40. package/build/serializer/withExpoSerializers.js.map +1 -1
  41. package/build/utils/getPkgVersion.d.ts +1 -1
  42. package/build/utils/getPkgVersion.js +20 -14
  43. package/build/utils/getPkgVersion.js.map +1 -1
  44. package/package.json +7 -7
  45. package/build/serializer/computeChunkFilenames.js.map +0 -1
  46. /package/build/serializer/{computeChunkFilenames.js → chunking/computeChunkFilenames.js} +0 -0
@@ -0,0 +1,49 @@
1
+ import type { MixedOutput, Module, ReadOnlyGraph } from '@expo/metro/metro/DeltaBundler/types';
2
+ /**
3
+ * Some bitsets represent entries; others represent groups of modules called atoms.
4
+ * Entry bits record which entries need a module through synchronous dependencies.
5
+ * Modules needed by the same entries form a raw atom. Atom bits record which groups
6
+ * an entry needs or is guaranteed to have registered before it loads.
7
+ *
8
+ * An entry can stop owning an atom when its modules are guaranteed to be registered
9
+ * before that entry loads. The planner checks this for every path to the entry.
10
+ */
11
+ export type BitSet = bigint;
12
+ type GraphModule = Module<MixedOutput>;
13
+ export declare function bitIndices(bits: BitSet): IterableIterator<number>;
14
+ export interface PlannerEntryPoint {
15
+ readonly module: GraphModule;
16
+ readonly kind: 'initial' | 'dynamic';
17
+ }
18
+ export interface BitSetGraphAnalysis {
19
+ readonly entryPoints: readonly PlannerEntryPoint[];
20
+ readonly dependentEntriesByModule: ReadonlyMap<GraphModule, BitSet>;
21
+ readonly dynamicImportsByEntry: readonly BitSet[];
22
+ readonly workerEntries: readonly GraphModule[];
23
+ }
24
+ /** Modules with the same entrypoint owners. */
25
+ export interface ChunkAtom {
26
+ /**
27
+ * Raw atoms start with all dependent entries as owners. An owner is removed only when
28
+ * these modules are guaranteed to be registered before that entry loads on every import path.
29
+ */
30
+ readonly ownerEntries: BitSet;
31
+ readonly modules: ReadonlySet<GraphModule>;
32
+ }
33
+ export interface BitSetChunkPlan extends BitSetGraphAnalysis {
34
+ readonly rawAtoms: readonly ChunkAtom[];
35
+ /** Bits refer to rawAtoms, not entrypoints. */
36
+ readonly syncDependencyAtomsByEntry: readonly BitSet[];
37
+ readonly guaranteedLoadedAtomsByEntry: readonly BitSet[];
38
+ readonly chunks: readonly ChunkAtom[];
39
+ /** All chunks needed by each entry, including ones already loaded. */
40
+ readonly requiredChunksByEntryPath: ReadonlyMap<string, readonly ChunkAtom[]>;
41
+ }
42
+ export declare function computeBitSetChunkPlan(initialEntries: readonly GraphModule[], graph: ReadOnlyGraph, options: {
43
+ isLazyBundle: boolean;
44
+ }): BitSetChunkPlan;
45
+ /** Analyze a complete application graph, excluding worker dependencies. */
46
+ export declare function analyzeBitSetGraph(initialEntries: readonly GraphModule[], graph: ReadOnlyGraph, options: {
47
+ isLazyBundle: boolean;
48
+ }): BitSetGraphAnalysis;
49
+ export {};
@@ -0,0 +1,268 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ 0 && (module.exports = {
6
+ analyzeBitSetGraph: null,
7
+ bitIndices: null,
8
+ computeBitSetChunkPlan: null
9
+ });
10
+ function _export(target, all) {
11
+ for(var name in all)Object.defineProperty(target, name, {
12
+ enumerable: true,
13
+ get: Object.getOwnPropertyDescriptor(all, name).get
14
+ });
15
+ }
16
+ _export(exports, {
17
+ get analyzeBitSetGraph () {
18
+ return analyzeBitSetGraph;
19
+ },
20
+ get bitIndices () {
21
+ return bitIndices;
22
+ },
23
+ get computeBitSetChunkPlan () {
24
+ return computeBitSetChunkPlan;
25
+ }
26
+ });
27
+ function _isResolvedDependency() {
28
+ const data = require("@expo/metro/metro/lib/isResolvedDependency");
29
+ _isResolvedDependency = function() {
30
+ return data;
31
+ };
32
+ return data;
33
+ }
34
+ function* bitIndices(bits) {
35
+ if (bits < 0n) throw new Error('BitSet operations require a non-negative value.');
36
+ for(let index = 0; bits !== 0n; index++, bits >>= 1n){
37
+ if ((bits & 1n) !== 0n) yield index;
38
+ }
39
+ }
40
+ function groupModulesByOwners(ownersByModule) {
41
+ const modulesByOwners = new Map();
42
+ for (const [module1, bits] of ownersByModule){
43
+ let modules = modulesByOwners.get(bits);
44
+ if (!modules) {
45
+ modules = [];
46
+ modulesByOwners.set(bits, modules);
47
+ }
48
+ modules.push(module1);
49
+ }
50
+ return [
51
+ ...modulesByOwners
52
+ ].sort(([a], [b])=>a < b ? -1 : a > b ? 1 : 0).map(([ownerEntries, modules])=>({
53
+ ownerEntries,
54
+ modules: new Set(modules.sort(compareModules))
55
+ }));
56
+ }
57
+ function computeBitSetChunkPlan(initialEntries, graph, options) {
58
+ const analysis = analyzeBitSetGraph(initialEntries, graph, options);
59
+ const { entryPoints, dependentEntriesByModule, dynamicImportsByEntry } = analysis;
60
+ const rawAtoms = groupModulesByOwners(dependentEntriesByModule);
61
+ const syncDependencyAtomsByEntry = getSyncDependencyAtomsByEntry(entryPoints, rawAtoms);
62
+ const guaranteedLoadedAtomsByEntry = computeGuaranteedLoadedAtoms(entryPoints, dynamicImportsByEntry, syncDependencyAtomsByEntry, rawAtoms.length);
63
+ const chunks = normalizeAtomOwners(rawAtoms, guaranteedLoadedAtomsByEntry);
64
+ const requiredChunksByEntryPath = getRequiredChunksByEntryPath(entryPoints, chunks, dependentEntriesByModule);
65
+ return {
66
+ ...analysis,
67
+ rawAtoms,
68
+ syncDependencyAtomsByEntry,
69
+ guaranteedLoadedAtomsByEntry,
70
+ chunks,
71
+ requiredChunksByEntryPath
72
+ };
73
+ }
74
+ /**
75
+ * For each entry, collect the atoms containing the entry and its direct or indirect
76
+ * synchronous dependencies.
77
+ */ function getSyncDependencyAtomsByEntry(entryPoints, rawAtoms) {
78
+ const syncDependencyAtomsByEntry = entryPoints.map(()=>0n);
79
+ for (const [atomIndex, atom] of rawAtoms.entries()){
80
+ const atomMask = 1n << BigInt(atomIndex);
81
+ for (const entryIndex of bitIndices(atom.ownerEntries)){
82
+ syncDependencyAtomsByEntry[entryIndex] = syncDependencyAtomsByEntry[entryIndex] | atomMask;
83
+ }
84
+ }
85
+ return syncDependencyAtomsByEntry;
86
+ }
87
+ /** Find atoms guaranteed to be registered before each entry loads, across all importer paths. */ function computeGuaranteedLoadedAtoms(entryPoints, dynamicImportsByEntry, syncDependencyAtomsByEntry, atomCount) {
88
+ const allAtoms = (1n << BigInt(atomCount)) - 1n;
89
+ // Initial entries have no modules guaranteed to be registered beforehand. For dynamic
90
+ // entries, start with all atoms as candidates and remove those not provided on every import path.
91
+ const guaranteedLoadedAtomsByEntry = entryPoints.map((entry)=>entry.kind === 'initial' ? 0n : allAtoms);
92
+ const pendingEntries = new Set();
93
+ for (const [index, entry] of entryPoints.entries()){
94
+ if (entry.kind === 'initial') pendingEntries.add(index);
95
+ }
96
+ for (const entryIndex of pendingEntries){
97
+ pendingEntries.delete(entryIndex);
98
+ const availableAtoms = syncDependencyAtomsByEntry[entryIndex] | guaranteedLoadedAtomsByEntry[entryIndex];
99
+ for (const targetIndex of bitIndices(dynamicImportsByEntry[entryIndex])){
100
+ // An importer provides its synchronous dependencies plus modules already registered
101
+ // before it loads. Keep only atoms available through every importer. Each update only
102
+ // removes bits, so repeating the calculation eventually stops, even with circular imports.
103
+ const updatedLoadedAtoms = guaranteedLoadedAtomsByEntry[targetIndex] & availableAtoms;
104
+ if (updatedLoadedAtoms === guaranteedLoadedAtomsByEntry[targetIndex]) continue;
105
+ guaranteedLoadedAtomsByEntry[targetIndex] = updatedLoadedAtoms;
106
+ pendingEntries.add(targetIndex);
107
+ }
108
+ }
109
+ return guaranteedLoadedAtomsByEntry;
110
+ }
111
+ /**
112
+ * Remove owners when the atom's modules are guaranteed to be registered before the entry loads.
113
+ * Then merge groups with the same remaining owners.
114
+ * For main => a => b, with a -> shared and b -> shared, only a needs to own shared.
115
+ * Adding main => b prevents that removal: b can now load without a supplying shared.
116
+ * Here => is a dynamic import and -> is a synchronous dependency.
117
+ */ function normalizeAtomOwners(rawAtoms, guaranteedLoadedAtomsByEntry) {
118
+ const normalizedOwnersByModule = new Map();
119
+ for (const [atomIndex, atom] of rawAtoms.entries()){
120
+ let owners = atom.ownerEntries;
121
+ for (const entryIndex of bitIndices(owners)){
122
+ if ((guaranteedLoadedAtomsByEntry[entryIndex] & 1n << BigInt(atomIndex)) !== 0n) {
123
+ owners &= ~(1n << BigInt(entryIndex));
124
+ }
125
+ }
126
+ // Along any path from an initial entry, the first entry that needs this atom must supply it.
127
+ // Earlier entries do not contain it, so at least one owner must remain.
128
+ if (owners === 0n) {
129
+ throw new Error(`BitSet atom containing ${[
130
+ ...atom.modules
131
+ ][0].path} lost every owner. ` + 'Check initial-root reachability and complete dynamic importer tracking.');
132
+ }
133
+ for (const module1 of atom.modules)normalizedOwnersByModule.set(module1, owners);
134
+ }
135
+ return groupModulesByOwners(normalizedOwnersByModule);
136
+ }
137
+ /** Keep every chunk an entry needs, including chunks already loaded by its importers. */ function getRequiredChunksByEntryPath(entryPoints, chunks, dependentEntriesByModule) {
138
+ const requiredChunksByEntry = entryPoints.map(()=>[]);
139
+ for (const chunk of chunks){
140
+ let requiredBy = 0n;
141
+ for (const module1 of chunk.modules){
142
+ requiredBy |= dependentEntriesByModule.get(module1);
143
+ }
144
+ for (const entryIndex of bitIndices(requiredBy)){
145
+ requiredChunksByEntry[entryIndex].push(chunk);
146
+ }
147
+ }
148
+ return new Map(entryPoints.map((entry, index)=>[
149
+ entry.module.path,
150
+ requiredChunksByEntry[index]
151
+ ]));
152
+ }
153
+ function compareModules(a, b) {
154
+ return a.path < b.path ? -1 : a.path > b.path ? 1 : 0;
155
+ }
156
+ function analyzeBitSetGraph(initialEntries, graph, options) {
157
+ const { entryPoints, edgesByModule, workerEntries } = discoverEntryGraph(initialEntries, graph, options);
158
+ return {
159
+ entryPoints,
160
+ ...computeEntryReachability(entryPoints, edgesByModule),
161
+ workerEntries
162
+ };
163
+ }
164
+ /** Start at the initial entries so unreachable modules, including circular imports, are excluded. */ function discoverEntryGraph(initialEntries, graph, { isLazyBundle }) {
165
+ if (isLazyBundle) {
166
+ throw new Error('BitSet chunking requires a complete non-lazy export graph. Disable lazy bundling.');
167
+ }
168
+ if (initialEntries.length === 0) {
169
+ throw new Error('BitSet chunking requires an initial entry. Pass the export entry module.');
170
+ }
171
+ const entriesByPath = new Map();
172
+ for (const entry of initialEntries){
173
+ const module1 = graph.dependencies.get(entry.path);
174
+ if (!module1) {
175
+ throw new Error(`BitSet initial entry ${entry.path} is missing. Supply a complete export graph.`);
176
+ }
177
+ entriesByPath.set(module1.path, {
178
+ module: module1,
179
+ kind: 'initial'
180
+ });
181
+ }
182
+ const edgesByModule = new Map();
183
+ const workerEntries = new Set();
184
+ const pendingModules = [
185
+ ...entriesByPath.values()
186
+ ].map((entry)=>entry.module);
187
+ for(let index = 0; index < pendingModules.length; index++){
188
+ const module1 = pendingModules[index];
189
+ if (edgesByModule.has(module1)) continue;
190
+ const moduleEdges = [];
191
+ edgesByModule.set(module1, moduleEdges);
192
+ for (const dependency of module1.dependencies.values()){
193
+ const asyncType = dependency.data.data.asyncType;
194
+ if (!(0, _isResolvedDependency().isResolvedDependency)(dependency) || asyncType === 'weak') continue;
195
+ const target = graph.dependencies.get(dependency.absolutePath);
196
+ if (!target) {
197
+ throw new Error(`BitSet dependency from ${module1.path} to ${dependency.absolutePath} is missing. ` + 'Production chunking requires a complete export graph; check graph transforms and disable lazy bundling.');
198
+ }
199
+ if (asyncType === 'worker') {
200
+ workerEntries.add(target);
201
+ continue;
202
+ }
203
+ const isDynamic = asyncType != null;
204
+ if (isDynamic && !entriesByPath.has(target.path)) {
205
+ entriesByPath.set(target.path, {
206
+ module: target,
207
+ kind: 'dynamic'
208
+ });
209
+ }
210
+ moduleEdges.push({
211
+ target,
212
+ isDynamic
213
+ });
214
+ pendingModules.push(target);
215
+ }
216
+ }
217
+ const entryPoints = [
218
+ ...entriesByPath.values()
219
+ ].sort((a, b)=>compareModules(a.module, b.module));
220
+ return {
221
+ entryPoints,
222
+ edgesByModule,
223
+ workerEntries: [
224
+ ...workerEntries
225
+ ].sort(compareModules)
226
+ };
227
+ }
228
+ /**
229
+ * Follow synchronous dependencies for each entry. Record dynamic import targets without
230
+ * following their dependencies during this traversal.
231
+ */ function computeEntryReachability(entryPoints, edgesByModule) {
232
+ const entryIndexByPath = new Map(entryPoints.map((entry, index)=>[
233
+ entry.module.path,
234
+ index
235
+ ]));
236
+ const dependentEntriesByModule = new Map();
237
+ const dynamicImportsByEntry = entryPoints.map(()=>0n);
238
+ for (const [entryIndex, entry] of entryPoints.entries()){
239
+ const pendingDependencies = [
240
+ entry.module
241
+ ];
242
+ const entryMask = 1n << BigInt(entryIndex);
243
+ for(let index = 0; index < pendingDependencies.length; index++){
244
+ const module1 = pendingDependencies[index];
245
+ const owners = dependentEntriesByModule.get(module1) ?? 0n;
246
+ if ((owners & entryMask) !== 0n) continue;
247
+ dependentEntriesByModule.set(module1, owners | entryMask);
248
+ for (const edge of edgesByModule.get(module1)){
249
+ if (!edge.isDynamic) {
250
+ pendingDependencies.push(edge.target);
251
+ } else {
252
+ const targetIndex = entryIndexByPath.get(edge.target.path);
253
+ if (entryPoints[targetIndex].kind !== 'initial') {
254
+ dynamicImportsByEntry[entryIndex] = dynamicImportsByEntry[entryIndex] | 1n << BigInt(targetIndex);
255
+ }
256
+ }
257
+ }
258
+ }
259
+ }
260
+ return {
261
+ dependentEntriesByModule: new Map([
262
+ ...dependentEntriesByModule
263
+ ].sort(([a], [b])=>compareModules(a, b))),
264
+ dynamicImportsByEntry
265
+ };
266
+ }
267
+
268
+ //# sourceMappingURL=computeBitSetChunks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["serializer/chunking/computeBitSetChunks.ts"],"sourcesContent":[null],"names":["analyzeBitSetGraph","bitIndices","computeBitSetChunkPlan","bits","Error","index","groupModulesByOwners","ownersByModule","modulesByOwners","Map","module","modules","get","set","push","sort","a","b","map","ownerEntries","Set","compareModules","initialEntries","graph","options","analysis","entryPoints","dependentEntriesByModule","dynamicImportsByEntry","rawAtoms","syncDependencyAtomsByEntry","getSyncDependencyAtomsByEntry","guaranteedLoadedAtomsByEntry","computeGuaranteedLoadedAtoms","length","chunks","normalizeAtomOwners","requiredChunksByEntryPath","getRequiredChunksByEntryPath","atomIndex","atom","entries","atomMask","BigInt","entryIndex","atomCount","allAtoms","entry","kind","pendingEntries","add","delete","availableAtoms","targetIndex","updatedLoadedAtoms","normalizedOwnersByModule","owners","path","requiredChunksByEntry","chunk","requiredBy","edgesByModule","workerEntries","discoverEntryGraph","computeEntryReachability","isLazyBundle","entriesByPath","dependencies","pendingModules","values","has","moduleEdges","dependency","asyncType","data","isResolvedDependency","target","absolutePath","isDynamic","entryIndexByPath","pendingDependencies","entryMask","edge"],"mappings":";;;;;;;;;;;;;;;;QA0NgBA;eAAAA;;QAzMCC;eAAAA;;QAyDDC;eAAAA;;;;yBAzEqB;;;;;;AAgB9B,UAAUD,WAAWE,IAAY;IACtC,IAAIA,OAAO,EAAE,EAAE,MAAM,IAAIC,MAAM;IAC/B,IAAK,IAAIC,QAAQ,GAAGF,SAAS,EAAE,EAAEE,SAASF,SAAS,EAAE,CAAE;QACrD,IAAI,AAACA,CAAAA,OAAO,EAAE,AAAD,MAAO,EAAE,EAAE,MAAME;IAChC;AACF;AAkCA,SAASC,qBAAqBC,cAAgD;IAC5E,MAAMC,kBAAkB,IAAIC;IAC5B,KAAK,MAAM,CAACC,SAAQP,KAAK,IAAII,eAAgB;QAC3C,IAAII,UAAUH,gBAAgBI,GAAG,CAACT;QAClC,IAAI,CAACQ,SAAS;YACZA,UAAU,EAAE;YACZH,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MAAM;YACzC,MAAMmD,SAAS7B,yBAAyBf,GAAG,CAACF,YAAW,EAAE;YACzD,IAAI,AAAC8C,CAAAA,SAASyB,SAAQ,MAAO,EAAE,EAAE;YACjCtD,yBAAyBd,GAAG,CAACH,SAAQ8C,SAASyB;YAC9C,KAAK,MAAMC,QAAQrB,cAAcjD,GAAG,CAACF,SAAU;gBAC7C,IAAI,CAACwE,KAAKJ,SAAS,EAAE;oBACnBE,oBAAoBlE,IAAI,CAACoE,KAAKN,MAAM;gBACtC,OAAO;oBACL,MAAMvB,cAAc0B,iBAAiBnE,GAAG,CAACsE,KAAKN,MAAM,CAACnB,IAAI;oBACzD,IAAI/B,WAAW,CAAC2B,YAAY,CAAEL,IAAI,KAAK,WAAW;wBAChDpB,qBAAqB,CAACgB,WAAW,GAC/BhB,qBAAqB,CAACgB,WAAW,GAAK,EAAE,IAAID,OAAOU;oBACvD;gBACF;YACF;QACF;IACF;IAEA,OAAO;QACL1B,0BAA0B,IAAIlB,IAC5B;eAAIkB;SAAyB,CAACZ,IAAI,CAAC,CAAC,CAACC,EAAE,EAAE,CAACC,EAAE,GAAKI,eAAeL,GAAGC;QAErEW;IACF;AACF"}
@@ -1,5 +1,5 @@
1
1
  import type { SerializerConfigT } from '@expo/metro/metro-config';
2
- import type { Chunk } from './serializeChunks';
2
+ import type { Chunk } from './Chunk';
3
3
  interface PrecomputeChunkFilenamesInput {
4
4
  chunks: Set<Chunk>;
5
5
  chunksByPath: Map<string, Chunk>;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["serializer/chunking/computeChunkFilenames.ts"],"sourcesContent":[null],"names":["precomputeChunkFilenames","makeTopologicalSet","chunks","chunksByPath","discoveryIndex","Map","lowLink","onPath","Set","path","groupOf","nextIndex","visit","node","set","push","add","neighbor","getAsyncChunkTargets","has","Math","min","get","component","member","pop","delete","chunk","_closureCache","collect","group","cached","closure","target","transitiveGroup","reachable","getReachable","makeIntrinsics","serializerConfig","source","hashes","intrinsics","getSource","src","undefined","getStableChunkSource","getHash","hash","getFilename","recomputeChunkNames","filenames","name","topology","parts","candidate","join"],"mappings":";;;;+BA6HgBA;;;eAAAA;;;AArHhB,4EAA4E,GAC5E,MAAMC,qBAAqB,CACzBC,QACAC;IAEA,MAAMC,iBAAiB,IAAIC;IAC3B,MAAMC,UAAU,IAAID;IACpB,MAAME,SAAS,IAAIC;IACnB,MAAMC,OAAgB,EAAE;IACxB,MAAMC,UAAU,IAAIL;IACpB,IAAIM,YAAY;IAEhB,MAAMC,QAAQ,CAACC;QACbT,eAAeU,GAAG,CAACD,MAAMF;QACzBL,QAAQQ,GAAG,CAACD,MAAMF;QAClBA;QACAF,KAAKM,IAAI,CAACF;QACVN,OAAOS,GAAG,CAACH;QAEX,KAAK,MAAMI,YAAYJ,KAAKK,oBAAoB,CAACf,cAAe;YAC9D,IAAI,CAACC,eAAee,GAAG,CAACF,WAAW;gBACjCL,MAAMK;gBACNX,QAAQQ,GAAG,CAACD,MAAMO,KAAKC,GAAG,CAACf,QAAQgB,GAAG,CAACT,OAAQP,QAAQgB,GAAG,CAACL;YAC7D,OAAO,IAAIV,OAAOY,GAAG,CAACF,WAAW;gBAC/BX,QAAQQ,GAAG,CAACD,MAAMO,KAAKC,GAAG,CAACf,QAAQgB,GAAG,CAACT,OAAQT,eAAekB,GAAG,CAACL;YACpE;QACF;QAEA,2EAA2E;QAC3E,IAAIX,QAAQgB,GAAG,CAACT,UAAUT,eAAekB,GAAG,CAACT,OAAO;YAClD,MAAMU,YAAY,IAAIf;YACtB,IAAIgB;YACJ,GAAG;gBACDA,SAASf,KAAKgB,GAAG;gBACjBlB,OAAOmB,MAAM,CAACF;gBACdD,UAAUP,GAAG,CAACQ;gBACdd,QAAQI,GAAG,CAACU,QAAQD;YACtB,QAASC,WAAWX,KAAM;QAC5B;IACF;IAEA,KAAK,MAAMc,SAASzB,OAAQ;QAC1B,IAAI,CAACE,eAAee,GAAG,CAACQ,QAAQ;YAC9Bf,MAAMe;QACR;IACF;IAEA,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AA0D;IAC1D,IAAI,CAAC4C,qBAAqB;QACxB,KAAK,MAAMtB,SAASzB,OAAQ;YAC1BgD,UAAUpC,GAAG,CAACa,OAAOA,MAAMwB,IAAI;QACjC;QACA,OAAOD;IACT;IAEA,MAAMT,aAAaJ,eAAeC;IAClC,MAAMc,WAAWnD,mBAAmBC,QAAQC;IAE5C,KAAK,MAAMwB,SAASzB,OAAQ;QAC1B,MAAMmD,QAAQ;YAACZ,WAAWC,SAAS,CAACf;SAAO;QAC3C,KAAK,MAAM2B,aAAaF,SAAShB,YAAY,CAACT,OAAQ;YACpD,IAAI2B,cAAc3B,OAAO;gBACvB0B,MAAMtC,IAAI,CAAC0B,WAAWK,OAAO,CAACQ;YAChC;QACF;QACAJ,UAAUpC,GAAG,CAACa,OAAOA,MAAMqB,WAAW,CAACK,MAAME,IAAI,CAAC;IACpD;IACA,OAAOL;AACT"}
@@ -0,0 +1,2 @@
1
+ import { type ChunkingContext, type ChunkingImplementation } from './chunkingStrategy';
2
+ export declare function createGranularChunkingStrategy(context: ChunkingContext): ChunkingImplementation;
@@ -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","collectChunk","createChunkCollector","seal","entries","modulePath"],"mappings":";;;;+BAwBgBA;;;eAAAA;;;;yBAvBqB;;;;;;;gEAClB;;;;;;;yBACQ;;;;;;;gEACV;;;;;;0BAGW;4BACA;uBACY;kCAOjC;qCAMA;;;;;;AAEA,SAASA,+BAA+BC,OAAwB;IACrE,MAAM,EAAEC,SAAS,EAAEC,KAAK,EAAEC,OAAO,EAAE,GAAGH;IACtC,IAAII,oBAAoB,IAAIC;IAC5B,IAAIC,4BAA4B,IAAID;IACpC,IAAIE,0BAA0B,IAAIF;IAElC,SAASG,gBAAgBC,KAAY,EAAEC,UAA8B;QACnE,MAAMC,YAAYD,WAAWE,IAAI,CAACA,IAAI,CAACD,SAAS;QAChD,IAAIA,aAAa,Q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IACpC,yFAAyF;IACzF,mGAAmG;IACnG,MAAM8G,eAAe,IAAIxE;IACzB,MAAMyE,eAAeC,IAAAA,sCAAoB,EACvCrH,SACAoB,UACA+F,cACA,CAACzG,aAAeA,WAAWE,IAAI,CAACA,IAAI,CAACD,SAAS,KAAK;IAErD,KAAK,MAAM0C,UAAUlB,cAAe;QAClC,MAAM1B,QAAQ2G,aAAa/D,OAAOoB,IAAI,EAAEU,YAAY,MAAM;QAC1DnE,IAAAA,iBAAM,EAACP,OAAO,CAAC,4BAA4B,EAAE4C,OAAOoB,IAAI,EAAE;QAC1DhE,MAAM6G,IAAI;IACZ;IACA,KAAK,MAAMzG,eAAesG,aAAc;QACtCnG,IAAAA,iBAAM,EACJH,YAAY2B,MAAM,EAClB;QAEF,KAAK,MAAMa,UAAUxC,YAAY0G,OAAO,CAAEhH,wBAAwBmF,GAAG,CAACrC,OAAOoB,IAAI,EAAE5D;IACrF;IACA,OAAO;QAAEiB,QAAQqF;QAAc/E,mBAAmB7B;IAAwB;AAC5E;AAEA,SAAS0C,gBACPnB,MAAuB,EACvBoB,cAA4D;IAE5D,iFAAiF;IACjF,uCAAuC;IACvC,MAAMsB,cAAc,IAAI7B;IACxB,KAAK,MAAMlC,SAASqB,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,2 @@
1
+ import { type ChunkingContext, type ChunkingImplementation } from './chunkingStrategy';
2
+ export declare function createLegacyChunkingStrategy(context: ChunkingContext): ChunkingImplementation;