@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.
Files changed (41) hide show
  1. package/build/serializer/chunking/Chunk.d.ts +45 -0
  2. package/build/serializer/chunking/Chunk.js +409 -0
  3. package/build/serializer/chunking/Chunk.js.map +1 -0
  4. package/build/serializer/chunking/chunkingStrategy.d.ts +40 -0
  5. package/build/serializer/chunking/chunkingStrategy.js +155 -0
  6. package/build/serializer/chunking/chunkingStrategy.js.map +1 -0
  7. package/build/serializer/chunking/computeBitSetChunks.d.ts +49 -0
  8. package/build/serializer/chunking/computeBitSetChunks.js +268 -0
  9. package/build/serializer/chunking/computeBitSetChunks.js.map +1 -0
  10. package/build/serializer/{computeChunkFilenames.d.ts → chunking/computeChunkFilenames.d.ts} +1 -1
  11. package/build/serializer/chunking/computeChunkFilenames.js.map +1 -0
  12. package/build/serializer/chunking/createGranularChunkingStrategy.d.ts +2 -0
  13. package/build/serializer/chunking/createGranularChunkingStrategy.js +282 -0
  14. package/build/serializer/chunking/createGranularChunkingStrategy.js.map +1 -0
  15. package/build/serializer/chunking/createLegacyChunkingStrategy.d.ts +2 -0
  16. package/build/serializer/chunking/createLegacyChunkingStrategy.js +167 -0
  17. package/build/serializer/chunking/createLegacyChunkingStrategy.js.map +1 -0
  18. package/build/serializer/chunking/findUnsupportedWorkerAsyncDependency.d.ts +7 -0
  19. package/build/serializer/chunking/findUnsupportedWorkerAsyncDependency.js +54 -0
  20. package/build/serializer/chunking/findUnsupportedWorkerAsyncDependency.js.map +1 -0
  21. package/build/serializer/exportPath.d.ts +1 -0
  22. package/build/serializer/exportPath.js +18 -3
  23. package/build/serializer/exportPath.js.map +1 -1
  24. package/build/serializer/fork/baseJSBundle.d.ts +5 -1
  25. package/build/serializer/fork/baseJSBundle.js +23 -1
  26. package/build/serializer/fork/baseJSBundle.js.map +1 -1
  27. package/build/serializer/fork/js.d.ts +6 -4
  28. package/build/serializer/fork/js.js +11 -1
  29. package/build/serializer/fork/js.js.map +1 -1
  30. package/build/serializer/fork/processModules.d.ts +4 -14
  31. package/build/serializer/fork/processModules.js +2 -12
  32. package/build/serializer/fork/processModules.js.map +1 -1
  33. package/build/serializer/serializeChunks.d.ts +4 -47
  34. package/build/serializer/serializeChunks.js +17 -655
  35. package/build/serializer/serializeChunks.js.map +1 -1
  36. package/build/serializer/serializerAssets.d.ts +13 -1
  37. package/build/serializer/withExpoSerializers.js +11 -1
  38. package/build/serializer/withExpoSerializers.js.map +1 -1
  39. package/package.json +3 -3
  40. package/build/serializer/computeChunkFilenames.js.map +0 -1
  41. /package/build/serializer/{computeChunkFilenames.js → chunking/computeChunkFilenames.js} +0 -0
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ 0 && (module.exports = {
6
+ createChunkCollector: null,
7
+ createRuntimeChunk: null,
8
+ serializeChunksAsync: 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 createChunkCollector () {
18
+ return createChunkCollector;
19
+ },
20
+ get createRuntimeChunk () {
21
+ return createRuntimeChunk;
22
+ },
23
+ get serializeChunksAsync () {
24
+ return serializeChunksAsync;
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 _assert() {
35
+ const data = /*#__PURE__*/ _interop_require_default(require("assert"));
36
+ _assert = function() {
37
+ return data;
38
+ };
39
+ return data;
40
+ }
41
+ const _Chunk = require("./Chunk");
42
+ const _computeChunkFilenames = require("./computeChunkFilenames");
43
+ function _interop_require_default(obj) {
44
+ return obj && obj.__esModule ? obj : {
45
+ default: obj
46
+ };
47
+ }
48
+ function createChunkCollector({ graph, options, preModules: runtimePremodules }, strategy, chunks, shouldTraverseDependency) {
49
+ const chunksByEntryPath = new Map();
50
+ return function collectChunk(entryPath, preModules, isAsync = false, isEntry = false) {
51
+ const existingChunk = chunksByEntryPath.get(entryPath);
52
+ if (existingChunk) return existingChunk;
53
+ const entryModule = graph.dependencies.get(entryPath);
54
+ if (!entryModule) return undefined;
55
+ const entryChunk = new _Chunk.Chunk(entryPath, new Set([
56
+ entryModule
57
+ ]), graph, options, strategy, isAsync, false, isEntry);
58
+ entryChunk.preModules = new Set(preModules);
59
+ // Register before walking dependencies so circular imports reuse this chunk.
60
+ chunksByEntryPath.set(entryPath, entryChunk);
61
+ chunks.add(entryChunk);
62
+ function includeModule(entryModule) {
63
+ const splitChunks = entryChunk.options.serializerOptions?.splitChunks !== false;
64
+ for (const dependency of entryModule.dependencies.values()){
65
+ const asyncType = dependency.data.data.asyncType;
66
+ const isWorker = asyncType === 'worker';
67
+ if (!(0, _isResolvedDependency().isResolvedDependency)(dependency) || !shouldTraverseDependency(dependency)) {
68
+ continue;
69
+ } else if (asyncType && // Workers require standalone bundles even when ordinary chunk splitting is disabled.
70
+ (isWorker || splitChunks)) {
71
+ if (isWorker && options.includeAsyncPaths) {
72
+ continue;
73
+ }
74
+ const asyncChunk = collectChunk(dependency.absolutePath, isWorker ? runtimePremodules : [], true, isWorker);
75
+ // Workers must be self-sufficient chunks.
76
+ if (isWorker) {
77
+ (0, _assert().default)(asyncChunk, `Worker chunk not found for: ${dependency.absolutePath}`);
78
+ asyncChunk.seal();
79
+ }
80
+ } else {
81
+ const module1 = graph.dependencies.get(dependency.absolutePath);
82
+ if (module1) {
83
+ // Prevent circular dependencies from creating infinite loops.
84
+ if (!entryChunk.deps.has(module1)) {
85
+ entryChunk.deps.add(module1);
86
+ includeModule(module1);
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ includeModule(entryModule);
93
+ return entryChunk;
94
+ };
95
+ }
96
+ function createRuntimeChunk(entryChunk, chunks, strategy, requiredBy = chunks) {
97
+ const runtimeChunk = new _Chunk.Chunk('/__expo-metro-runtime.js', new Set(), entryChunk.graph, entryChunk.options, strategy, false, true);
98
+ // All premodules (including metro-runtime) should load first
99
+ for (const preModule of entryChunk.preModules){
100
+ runtimeChunk.preModules.add(preModule);
101
+ }
102
+ entryChunk.preModules = new Set();
103
+ for (const chunk of requiredBy){
104
+ chunk.requiredChunks.add(runtimeChunk);
105
+ }
106
+ chunks.add(runtimeChunk);
107
+ }
108
+ function makeChunkByPathLookupMap(chunks) {
109
+ const chunkByPath = new Map();
110
+ // First, we populate chunks with entry module paths
111
+ for (const chunk of chunks){
112
+ for (const entry of chunk.entries){
113
+ if (!chunkByPath.has(entry.path)) {
114
+ chunkByPath.set(entry.path, chunk);
115
+ }
116
+ }
117
+ }
118
+ // We then populate the chunks' module paths, excluding sealed chunks...
119
+ for (const chunk of chunks){
120
+ if (!chunk.sealed) {
121
+ for (const module1 of chunk.deps){
122
+ if (!chunkByPath.has(module1.path)) {
123
+ chunkByPath.set(module1.path, chunk);
124
+ }
125
+ }
126
+ }
127
+ }
128
+ // ...then populate with missing paths from sealed chunks.
129
+ // This gives precedence for modules from unsealed chunks after entry modules
130
+ for (const chunk of chunks){
131
+ if (chunk.sealed) {
132
+ for (const module1 of chunk.deps){
133
+ if (!chunkByPath.has(module1.path)) {
134
+ chunkByPath.set(module1.path, chunk);
135
+ }
136
+ }
137
+ }
138
+ }
139
+ return chunkByPath;
140
+ }
141
+ async function serializeChunksAsync(chunks, { serializerConfig, serializeChunkOptions, options }) {
142
+ const chunksByPath = makeChunkByPathLookupMap(chunks);
143
+ const filenamesByChunk = (0, _computeChunkFilenames.precomputeChunkFilenames)({
144
+ chunks,
145
+ chunksByPath,
146
+ serializerConfig,
147
+ recomputeChunkNames: !!options.serializerOptions?.exporting
148
+ });
149
+ const assets = await Promise.all([
150
+ ...chunks
151
+ ].map((chunk)=>chunk.serializeToAssetsAsync(serializerConfig, chunksByPath, filenamesByChunk, serializeChunkOptions)));
152
+ return assets.flat();
153
+ }
154
+
155
+ //# sourceMappingURL=chunkingStrategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["serializer/chunking/chunkingStrategy.ts"],"sourcesContent":[null],"names":["createChunkCollector","createRuntimeChunk","serializeChunksAsync","graph","options","preModules","runtimePremodules","strategy","chunks","shouldTraverseDependency","chunksByEntryPath","Map","collectChunk","entryPath","isAsync","isEntry","existingChunk","get","entryModule","dependencies","undefined","entryChunk","Chunk","Set","set","add","includeModule","splitChunks","serializerOptions","dependency","values","asyncType","data","isWorker","isResolvedDependency","includeAsyncPaths","asyncChunk","absolutePath","assert","seal","module","deps","has","requiredBy","runtimeChunk","preModule","chunk","requiredChunks","makeChunkByPathLookupMap","chunkByPath","entry","entries","path","sealed","serializerConfig","serializeChunkOptions","chunksByPath","filenamesByChunk","precomputeChunkFilenames","recomputeChunkNames","exporting","assets","Promise","all","map","serializeToAssetsAsync","flat"],"mappings":";;;;;;;;;;;;;;;;QAsEgBA;eAAAA;;QA+EAC;eAAAA;;QA8DMC;eAAAA;;;;yBA5Me;;;;;;;gEAClB;;;;;;uBAMG;uCACmB;;;;;;AAuDlC,SAASF,qBACd,EAAEG,KAAK,EAAEC,OAAO,EAAEC,YAAYC,iBAAiB,EAAmB,EAClEC,QAAgC,EAChCC,MAAkB,EAClBC,wBAAqE;IAErE,MAAMC,oBAAoB,IAAIC;IAC9B,OAAO,SAASC,aACdC,SAAiB,EACjBR,UAA6B,EAC7BS,UAAmB,KAAK,EACxBC,UAAmB,KAAK;QAExB,MAAMC,gBAAgBN,kBAAkBO,GAAG,CAACJ;QAC5C,IAAIG,eAAe,OAAOA;QAC1B,MAAME,cAAcf,MAAMgB,YAAY,CAACF,GAAG,CAACJ;QAC3C,IAAI,CAACK,aAAa,OAAOE;QAEzB,MAAMC,aAAa,IAAIC,YAAK,CAC1BT,WACA,IAAIU,IAAI;YAACL;SAAY,GACrBf,OACAC,SACAG,UACAO,S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,EAAEC,qBAAqB,EAAEnD,OAAO,EAAmB;IAErE,MAAMoD,eAAeR,yBAAyBxC;IAC9C,MAAMiD,mBAAmBC,IAAAA,+CAAwB,EAAC;QAChDlD;QACAgD;QACAF;QACAK,qBAAqB,CAAC,CAACvD,QAAQwB,iBAAiB,EAAEgC;IACpD;IACA,MAAMC,SAAS,MAAMC,QAAQC,GAAG,CAC9B;WAAIvD;KAAO,CAACwD,GAAG,CAAC,CAAClB,QACfA,MAAMmB,sBAAsB,CAC1BX,kBACAE,cACAC,kBACAF;IAIN,OAAOM,OAAOK,IAAI;AACpB"}
@@ -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,gBAAgBK,GAAG,CAACV,MAAMQ;QAC5B;QACAA,QAAQG,IAAI,CAACJ;IACf;IACA,OAAO;WAAIF;KAAgB,CACxBO,IAAI,CAAC,CAAC,CAACC,EAAE,EAAE,CAACC,EAAE,GAAMD,IAAIC,IAAI,CAAC,IAAID,IAAIC,IAAI,IAAI,GAC7CC,GAAG,CAAC,CAAC,CAACC,cAAcR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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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B,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;