@expo/metro-config 58.0.23 → 58.0.24
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/ExpoMetroConfig.js +2 -5
- package/build/ExpoMetroConfig.js.map +1 -1
- package/build/serializer/chunking/Chunk.d.ts +12 -6
- package/build/serializer/chunking/Chunk.js +81 -115
- package/build/serializer/chunking/Chunk.js.map +1 -1
- package/build/serializer/chunking/chunkingStrategy.js +6 -3
- package/build/serializer/chunking/chunkingStrategy.js.map +1 -1
- package/build/serializer/chunking/computeChunkFilenames.d.ts +7 -1
- package/build/serializer/chunking/computeChunkFilenames.js +37 -6
- package/build/serializer/chunking/computeChunkFilenames.js.map +1 -1
- package/build/serializer/chunking/createLegacyChunkingStrategy.d.ts +1 -0
- package/build/serializer/chunking/createLegacyChunkingStrategy.js +52 -35
- package/build/serializer/chunking/createLegacyChunkingStrategy.js.map +1 -1
- package/build/serializer/domArtifacts.d.ts +5 -0
- package/build/serializer/domArtifacts.js +109 -0
- package/build/serializer/domArtifacts.js.map +1 -0
- package/build/serializer/exportPath.d.ts +6 -0
- package/build/serializer/exportPath.js +17 -1
- package/build/serializer/exportPath.js.map +1 -1
- package/build/serializer/fork/baseJSBundle.d.ts +7 -3
- package/build/serializer/fork/baseJSBundle.js +22 -5
- package/build/serializer/fork/baseJSBundle.js.map +1 -1
- package/build/serializer/fork/hmrJSBundle.js +0 -1
- package/build/serializer/fork/hmrJSBundle.js.map +1 -1
- package/build/serializer/fork/js.d.ts +0 -1
- package/build/serializer/fork/js.js +1 -1
- package/build/serializer/fork/js.js.map +1 -1
- package/build/serializer/getServerRunModuleStatement.d.ts +4 -0
- package/build/serializer/getServerRunModuleStatement.js +27 -0
- package/build/serializer/getServerRunModuleStatement.js.map +1 -0
- package/build/serializer/hermesArtifacts.d.ts +1 -0
- package/build/serializer/hermesArtifacts.js +23 -4
- package/build/serializer/hermesArtifacts.js.map +1 -1
- package/build/serializer/serializeChunks.d.ts +9 -1
- package/build/serializer/serializeChunks.js +38 -16
- package/build/serializer/serializeChunks.js.map +1 -1
- package/build/serializer/serializeJavaScriptArtifacts.d.ts +20 -0
- package/build/serializer/serializeJavaScriptArtifacts.js +69 -0
- package/build/serializer/serializeJavaScriptArtifacts.js.map +1 -0
- package/build/serializer/serializeServerBundle.d.ts +9 -0
- package/build/serializer/serializeServerBundle.js +118 -0
- package/build/serializer/serializeServerBundle.js.map +1 -0
- package/build/serializer/serializerAssets.d.ts +7 -0
- package/build/serializer/serializerAssets.js +30 -0
- package/build/serializer/serializerAssets.js.map +1 -1
- package/build/serializer/sourceMap.d.ts +7 -0
- package/build/serializer/sourceMap.js +79 -3
- package/build/serializer/sourceMap.js.map +1 -1
- package/build/serializer/withExpoSerializers.d.ts +0 -1
- package/build/serializer/withExpoSerializers.js +76 -144
- package/build/serializer/withExpoSerializers.js.map +1 -1
- package/build/transform-worker/collect-dependencies.js +7 -3
- package/build/transform-worker/collect-dependencies.js.map +1 -1
- package/build/transform-worker/noxcturnal/plugins/metro-dependency.js +3 -1
- package/build/transform-worker/noxcturnal/plugins/metro-dependency.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "getServerRunModuleStatement", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return getServerRunModuleStatement;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
// Nested serializer boundaries must not export the same entry more than once.
|
|
12
|
+
const originalStatements = new WeakMap();
|
|
13
|
+
function getServerRunModuleStatement(entryPoint, options) {
|
|
14
|
+
const original = originalStatements.get(options.getRunModuleStatement) ?? options.getRunModuleStatement;
|
|
15
|
+
const getRunModuleStatement = (moduleId, ...args)=>{
|
|
16
|
+
const statement = original(moduleId, ...args);
|
|
17
|
+
if (moduleId !== options.createModuleId(entryPoint)) return statement;
|
|
18
|
+
const prefix = (args[0] ?? '').replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
19
|
+
const requireName = prefix ? `(?:${prefix}__r|__r)` : '__r';
|
|
20
|
+
const entryCall = new RegExp(`(^|[;\\n])(\\s*)(${requireName}\\s*\\([^;\\n]*?\\)\\s*)(?=;|$|\\n)`, 'g');
|
|
21
|
+
return statement.replace(entryCall, '$1$2module.exports = $3');
|
|
22
|
+
};
|
|
23
|
+
originalStatements.set(getRunModuleStatement, original);
|
|
24
|
+
return getRunModuleStatement;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=getServerRunModuleStatement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["serializer/getServerRunModuleStatement.ts"],"sourcesContent":[null],"names":["getServerRunModuleStatement","originalStatements","WeakMap","entryPoint","options","original","get","getRunModuleStatement","moduleId","args","statement","createModuleId","prefix","replace","requireName","entryCall","RegExp","set"],"mappings":";;;;+BAOgBA;;;eAAAA;;;AAHhB,8EAA8E;AAC9E,MAAMC,qBAAqB,IAAIC;AAExB,SAASF,4BACdG,UAAkB,EAClBC,OAA4E;IAE5E,MAAMC,WACJJ,mBAAmBK,GAAG,CAACF,QAAQG,qBAAqB,KAAKH,QAAQG,qBAAqB;IACxF,MAAMA,wBAA4C,CAACC,UAAU,GAAGC;QAC9D,MAAMC,YAAYL,SAASG,aAAaC;QACxC,IAAID,aAAaJ,QAAQO,cAAc,CAACR,aAAa,OAAOO;QAC5D,MAAME,SAAS,AAACH,CAAAA,IAAI,CAAC,EAAE,IAAI,EAAC,EAAGI,OAAO,CAAC,uBAAuB;QAC9D,MAAMC,cAAcF,SAAS,CAAC,GAAG,EAAEA,OAAO,QAAQ,CAAC,GAAG;QACtD,MAAMG,YAAY,IAAIC,OACpB,CAAC,iBAAiB,EAAEF,YAAY,mCAAmC,CAAC,EACpE;QAEF,OAAOJ,UAAUG,OAAO,CAACE,WAAW;IACtC;IACAd,mBAAmBgB,GAAG,CAACV,uBAAuBF;IAC9C,OAAOE;AACT"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { SerialAsset } from './serializerAssets';
|
|
2
|
+
export declare function compileHermesArtifactsAsync(projectRoot: string, artifacts: SerialAsset[]): Promise<void>;
|
|
2
3
|
export declare function transformJsAssetToHermesBytecodeAsync(projectRoot: string, jsAsset: SerialAsset, mapAsset?: SerialAsset): Promise<void>;
|
|
@@ -2,9 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
0 && (module.exports = {
|
|
6
|
+
compileHermesArtifactsAsync: null,
|
|
7
|
+
transformJsAssetToHermesBytecodeAsync: null
|
|
8
|
+
});
|
|
9
|
+
function _export(target, all) {
|
|
10
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
_export(exports, {
|
|
16
|
+
get compileHermesArtifactsAsync () {
|
|
17
|
+
return compileHermesArtifactsAsync;
|
|
18
|
+
},
|
|
19
|
+
get transformJsAssetToHermesBytecodeAsync () {
|
|
8
20
|
return transformJsAssetToHermesBytecodeAsync;
|
|
9
21
|
}
|
|
10
22
|
});
|
|
@@ -31,6 +43,13 @@ function _interop_require_default(obj) {
|
|
|
31
43
|
}
|
|
32
44
|
// Lazy-loaded to avoid pulling in metro-source-map at startup
|
|
33
45
|
let _buildHermesBundleAsync;
|
|
46
|
+
async function compileHermesArtifactsAsync(projectRoot, artifacts) {
|
|
47
|
+
for (const artifact of artifacts){
|
|
48
|
+
if (artifact.type !== 'js' || Buffer.isBuffer(artifact.source)) continue;
|
|
49
|
+
const map = artifacts.find((asset)=>asset.type === 'map' && asset.filename === artifact.filename + '.map');
|
|
50
|
+
await transformJsAssetToHermesBytecodeAsync(projectRoot, artifact, map);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
34
53
|
function getBuildHermesBundleAsync() {
|
|
35
54
|
if (!_buildHermesBundleAsync) {
|
|
36
55
|
_buildHermesBundleAsync = require('./exportHermes').buildHermesBundleAsync;
|
|
@@ -39,7 +58,7 @@ function getBuildHermesBundleAsync() {
|
|
|
39
58
|
}
|
|
40
59
|
async function transformJsAssetToHermesBytecodeAsync(projectRoot, jsAsset, mapAsset) {
|
|
41
60
|
if (Buffer.isBuffer(jsAsset.source)) return;
|
|
42
|
-
const debugId = (0, _debugId.stringToUUID)(_path().default.basename(jsAsset.filename, _path().default.extname(jsAsset.filename)));
|
|
61
|
+
const debugId = (mapAsset && JSON.parse(mapAsset.source).debugId) ?? (0, _debugId.stringToUUID)(_path().default.basename(jsAsset.filename, _path().default.extname(jsAsset.filename)));
|
|
43
62
|
const adjustedSource = jsAsset.source.replace(/^\/\/# (sourceMappingURL)=(.*)$/gm, (...props)=>{
|
|
44
63
|
if (props[1] === 'sourceMappingURL') {
|
|
45
64
|
const mapName = props[2].replace(/\.js\.map$/, '.hbc.map');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["serializer/hermesArtifacts.ts"],"sourcesContent":[null],"names":["transformJsAssetToHermesBytecodeAsync","_buildHermesBundleAsync","
|
|
1
|
+
{"version":3,"sources":["serializer/hermesArtifacts.ts"],"sourcesContent":[null],"names":["compileHermesArtifactsAsync","transformJsAssetToHermesBytecodeAsync","_buildHermesBundleAsync","projectRoot","artifacts","artifact","type","Buffer","isBuffer","source","map","find","asset","filename","getBuildHermesBundleAsync","require","buildHermesBundleAsync","jsAsset","mapAsset","debugId","JSON","parse","stringToUUID","path","basename","extname","adjustedSource","replace","props","mapName","hermesBundleOutput","resolve","originFilename","code","minify","hbc","metadata","paths","rewrittenPaths","moduleId","modulePaths","Object","entries","rewrittenModulePaths","dependencyId","targetPath","assert","sourcem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
import type { ConfigT } from '@expo/metro/metro-config';
|
|
9
|
+
import type { MixedOutput, ReadOnlyGraph } from '@expo/metro/metro/DeltaBundler/types';
|
|
10
|
+
import { Chunk } from './chunking/Chunk';
|
|
9
11
|
import type { SerializeChunkOptions } from './chunking/chunkingStrategy';
|
|
12
|
+
import type { ExpoSerializerOptions } from './fork/baseJSBundle';
|
|
10
13
|
import type { SerialAsset } from './serializerAssets';
|
|
11
14
|
export { Chunk, getSortedModules } from './chunking/Chunk';
|
|
12
15
|
export type { SerializeChunkOptions } from './chunking/chunkingStrategy';
|
|
13
16
|
type Serializer = NonNullable<ConfigT['serializer']['customSerializer']>;
|
|
14
17
|
type SerializerParameters = Parameters<Serializer>;
|
|
15
18
|
export declare function graphToSerialAssetsAsync(config: MetroConfig, serializeChunkOptions: SerializeChunkOptions, ...props: SerializerParameters): Promise<{
|
|
16
|
-
artifacts: SerialAsset[]
|
|
19
|
+
artifacts: SerialAsset[];
|
|
20
|
+
assets: AssetData[];
|
|
21
|
+
}>;
|
|
22
|
+
export declare function graphToSingleChunk(...props: SerializerParameters): Chunk;
|
|
23
|
+
export declare function collectGraphResourcesAsync(config: Partial<MetroConfig>, entryFile: string, graph: ReadOnlyGraph<MixedOutput>, options: ExpoSerializerOptions): Promise<{
|
|
24
|
+
artifacts: SerialAsset[];
|
|
17
25
|
assets: AssetData[];
|
|
18
26
|
}>;
|
|
@@ -9,8 +9,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
0 && (module.exports = {
|
|
11
11
|
Chunk: null,
|
|
12
|
+
collectGraphResourcesAsync: null,
|
|
12
13
|
getSortedModules: null,
|
|
13
|
-
graphToSerialAssetsAsync: null
|
|
14
|
+
graphToSerialAssetsAsync: null,
|
|
15
|
+
graphToSingleChunk: null
|
|
14
16
|
});
|
|
15
17
|
function _export(target, all) {
|
|
16
18
|
for(var name in all)Object.defineProperty(target, name, {
|
|
@@ -22,11 +24,17 @@ _export(exports, {
|
|
|
22
24
|
get Chunk () {
|
|
23
25
|
return _Chunk.Chunk;
|
|
24
26
|
},
|
|
27
|
+
get collectGraphResourcesAsync () {
|
|
28
|
+
return collectGraphResourcesAsync;
|
|
29
|
+
},
|
|
25
30
|
get getSortedModules () {
|
|
26
31
|
return _Chunk.getSortedModules;
|
|
27
32
|
},
|
|
28
33
|
get graphToSerialAssetsAsync () {
|
|
29
34
|
return graphToSerialAssetsAsync;
|
|
35
|
+
},
|
|
36
|
+
get graphToSingleChunk () {
|
|
37
|
+
return graphToSingleChunk;
|
|
30
38
|
}
|
|
31
39
|
});
|
|
32
40
|
const _getAssets = /*#__PURE__*/ _interop_require_default(require("../transform-worker/getAssets"));
|
|
@@ -41,10 +49,6 @@ function _interop_require_default(obj) {
|
|
|
41
49
|
}
|
|
42
50
|
async function graphToSerialAssetsAsync(config, serializeChunkOptions, ...props) {
|
|
43
51
|
const [entryFile, preModules, graph, options] = props;
|
|
44
|
-
const cssDeps = (0, _getCssDeps.getCssSerialAssets)(graph.dependencies, {
|
|
45
|
-
entryFile,
|
|
46
|
-
projectRoot: options.projectRoot
|
|
47
|
-
});
|
|
48
52
|
const context = {
|
|
49
53
|
serializerConfig: config.serializer ?? {},
|
|
50
54
|
serializeChunkOptions,
|
|
@@ -55,18 +59,39 @@ async function graphToSerialAssetsAsync(config, serializeChunkOptions, ...props)
|
|
|
55
59
|
};
|
|
56
60
|
const strategy = serializeChunkOptions.chunkingStrategy === 'granular' ? (0, _createGranularChunkingStrategy.createGranularChunkingStrategy)(context) : (0, _createLegacyChunkingStrategy.createLegacyChunkingStrategy)(context);
|
|
57
61
|
const jsAssets = await strategy.serializeAsync();
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
const resources = await collectGraphResourcesAsync(config, entryFile, graph, options);
|
|
63
|
+
return {
|
|
64
|
+
artifacts: [
|
|
65
|
+
...jsAssets,
|
|
66
|
+
...resources.artifacts
|
|
67
|
+
],
|
|
68
|
+
assets: resources.assets
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function graphToSingleChunk(...props) {
|
|
72
|
+
const [entryFile, preModules, graph, options] = props;
|
|
73
|
+
const entry = graph.dependencies.get(entryFile);
|
|
74
|
+
const chunk = new _Chunk.Chunk(entryFile, new Set(entry ? [
|
|
75
|
+
entry
|
|
76
|
+
] : []), graph, options, _createLegacyChunkingStrategy.legacyChunkSerialization, false, false, true);
|
|
77
|
+
chunk.deps = new Set(graph.dependencies.values());
|
|
78
|
+
chunk.preModules = new Set(preModules);
|
|
79
|
+
return chunk;
|
|
80
|
+
}
|
|
81
|
+
async function collectGraphResourcesAsync(config, entryFile, graph, options) {
|
|
82
|
+
const cssDeps = (0, _getCssDeps.getCssSerialAssets)(graph.dependencies, {
|
|
83
|
+
entryFile,
|
|
84
|
+
projectRoot: options.projectRoot
|
|
85
|
+
});
|
|
60
86
|
const baseUrl = (0, _Chunk.getBaseUrlOption)(graph, {
|
|
61
|
-
serializerOptions:
|
|
87
|
+
serializerOptions: options.serializerOptions ?? {}
|
|
62
88
|
});
|
|
63
|
-
const assetPublicUrl =
|
|
89
|
+
const assetPublicUrl = baseUrl.replace(/\/+$/, '') + '/assets';
|
|
64
90
|
const platform = (0, _Chunk.getPlatformOption)(graph, options) ?? 'web';
|
|
65
91
|
const customTransformOptions = graph.transformOptions?.customTransformOptions;
|
|
66
|
-
const isHosted = platform === 'web' || customTransformOptions?.hosted
|
|
67
|
-
const publicPath =
|
|
92
|
+
const isHosted = platform === 'web' || !!customTransformOptions?.hosted;
|
|
93
|
+
const publicPath = isHosted ? `/assets?export_path=${assetPublicUrl}` : assetPublicUrl;
|
|
68
94
|
// TODO: Convert to serial assets
|
|
69
|
-
// TODO: Disable this call dynamically in development since assets are fetched differently.
|
|
70
95
|
const metroAssets = await (0, _getAssets.default)(graph.dependencies, {
|
|
71
96
|
processModuleFilter: options.processModuleFilter,
|
|
72
97
|
assetPlugins: config.transformer?.assetPlugins ?? [],
|
|
@@ -76,10 +101,7 @@ async function graphToSerialAssetsAsync(config, serializeChunkOptions, ...props)
|
|
|
76
101
|
isHosted
|
|
77
102
|
});
|
|
78
103
|
return {
|
|
79
|
-
artifacts:
|
|
80
|
-
...jsAssets,
|
|
81
|
-
...cssDeps
|
|
82
|
-
],
|
|
104
|
+
artifacts: cssDeps,
|
|
83
105
|
assets: metroAssets
|
|
84
106
|
};
|
|
85
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["serializer/serializeChunks.ts"],"sourcesContent":[null],"names":["Chunk","getSortedModules","graphToSerialAssetsAsync","config","serializeChunkOptions","props","entryFile","preModules","graph","options","
|
|
1
|
+
{"version":3,"sources":["serializer/serializeChunks.ts"],"sourcesContent":[null],"names":["Chunk","collectGraphResourcesAsync","getSortedModules","graphToSerialAssetsAsync","graphToSingleChunk","config","serializeChunkOptions","props","entryFile","preModules","graph","options","context","serializerConfig","serializer","strategy","chunkingStrategy","createGranularChunkingStrategy","createLegacyChunkingStrategy","jsAssets","serializeAsync","resources","artifacts","assets","entry","dependencies","get","chunk","Set","legacyChunkSerialization","deps","values","cssDeps","getCssSerialAssets","projectRoot","baseUrl","getBaseUrlOption","serializerOptions","assetPublicUrl","replace","platform","getPlatformOption","customTransformOptions","transformOptions","isHosted","hosted","publicPath","metroAssets","getMetroAssets","processModuleFilter","assetPlugins","transformer"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;;;;;;;;QAkBQA;eAAAA,YAAK;;QAoDQC;eAAAA;;QApDNC;eAAAA,uBAAgB;;QAMVC;eAAAA;;QA4BNC;eAAAA;;;kEA/CW;uBAEgC;gDAEZ;8CAIxC;4BAE4B;;;;;;AAS5B,eAAeD,yBACpBE,MAAmB,EACnBC,qBAA4C,EAC5C,GAAGC,KAA2B;IAK9B,MAAM,CAACC,WAAWC,YAAYC,OAAOC,QAAQ,GAAGJ;IAEhD,MAAMK,UAAU;QACdC,kBAAkBR,OAAOS,UAAU,IAAI,CAAC;QACxCR;QACAE;QACAC;QACAC;QACAC;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wBG;IACjE,MAAMC,aAAaF,WAAW,CAAC,oBAAoB,EAAEN,gBAAgB,GAAGA;IAExE,iCAAiC;IACjC,MAAMS,cAAc,MAAMC,IAAAA,kBAAc,EAACtC,MAAMe,YAAY,EAAE;QAC3DwB,qBAAqBtC,QAAQsC,mBAAmB;QAChDC,cAAc7C,OAAO8C,WAAW,EAAED,gBAAgB,EAAE;QACpDV;QACAN,aAAavB,QAAQuB,WAAW;QAChCY;QACAF;IACF;IAEA,OAAO;QACLtB,WAAWU;QACXT,QAAQwB;IACV;AACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SerialAsset } from './serializerAssets';
|
|
2
|
+
type SourceMap = {
|
|
3
|
+
source: string;
|
|
4
|
+
debugId?: string;
|
|
5
|
+
};
|
|
6
|
+
type BundleAnnotations = {
|
|
7
|
+
sourceMapUrl?: string | null;
|
|
8
|
+
debugId?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const TRAILING_BUNDLE_ANNOTATIONS: RegExp;
|
|
11
|
+
export declare function replaceSourceMapUrl(source: string, url: string): string;
|
|
12
|
+
export declare function serializeJavaScriptArtifactsAsync({ includeSourceMaps, inlineSourceMap, sourceMapUrl, debugId, getSourceMap, artifact, }: {
|
|
13
|
+
includeSourceMaps: boolean;
|
|
14
|
+
inlineSourceMap: boolean;
|
|
15
|
+
sourceMapUrl?: string | null;
|
|
16
|
+
debugId?: string;
|
|
17
|
+
getSourceMap: () => SourceMap | Promise<SourceMap>;
|
|
18
|
+
artifact: SerialAsset | ((annotations: BundleAnnotations) => SerialAsset);
|
|
19
|
+
}): Promise<SerialAsset[]>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
0 && (module.exports = {
|
|
6
|
+
TRAILING_BUNDLE_ANNOTATIONS: null,
|
|
7
|
+
replaceSourceMapUrl: null,
|
|
8
|
+
serializeJavaScriptArtifactsAsync: 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 TRAILING_BUNDLE_ANNOTATIONS () {
|
|
18
|
+
return TRAILING_BUNDLE_ANNOTATIONS;
|
|
19
|
+
},
|
|
20
|
+
get replaceSourceMapUrl () {
|
|
21
|
+
return replaceSourceMapUrl;
|
|
22
|
+
},
|
|
23
|
+
get serializeJavaScriptArtifactsAsync () {
|
|
24
|
+
return serializeJavaScriptArtifactsAsync;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
function _getInlineSourceMappingURL() {
|
|
28
|
+
const data = /*#__PURE__*/ _interop_require_default(require("@expo/metro/metro/DeltaBundler/Serializers/helpers/getInlineSourceMappingURL"));
|
|
29
|
+
_getInlineSourceMappingURL = function() {
|
|
30
|
+
return data;
|
|
31
|
+
};
|
|
32
|
+
return data;
|
|
33
|
+
}
|
|
34
|
+
function _interop_require_default(obj) {
|
|
35
|
+
return obj && obj.__esModule ? obj : {
|
|
36
|
+
default: obj
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const TRAILING_BUNDLE_ANNOTATIONS = /((?:^|\n)\/\/# (?:sourceMappingURL|sourceURL|debugId)=[^\n]*)+\s*$/;
|
|
40
|
+
function replaceSourceMapUrl(source, url) {
|
|
41
|
+
return source.replace(TRAILING_BUNDLE_ANNOTATIONS, (annotations)=>annotations.replace(/(^|\n)(\/\/# sourceMappingURL=)[^\r\n]*/g, '$1$2' + url));
|
|
42
|
+
}
|
|
43
|
+
async function serializeJavaScriptArtifactsAsync({ includeSourceMaps, inlineSourceMap, sourceMapUrl, debugId, getSourceMap, artifact }) {
|
|
44
|
+
const map = includeSourceMaps || inlineSourceMap ? await getSourceMap() : undefined;
|
|
45
|
+
const annotations = {
|
|
46
|
+
sourceMapUrl: inlineSourceMap ? (0, _getInlineSourceMappingURL().default)(map.source) : sourceMapUrl,
|
|
47
|
+
debugId: inlineSourceMap ? undefined : map?.debugId ?? debugId
|
|
48
|
+
};
|
|
49
|
+
// A producer owns annotation emission so Metro can still filter annotation modules.
|
|
50
|
+
const asset = typeof artifact === 'function' ? artifact(annotations) : {
|
|
51
|
+
...artifact,
|
|
52
|
+
source: artifact.source + (annotations.sourceMapUrl ? '\n//# sourceMappingURL=' + annotations.sourceMapUrl : '') + (annotations.debugId != null ? '\n//# debugId=' + annotations.debugId : '')
|
|
53
|
+
};
|
|
54
|
+
const artifacts = [
|
|
55
|
+
asset
|
|
56
|
+
];
|
|
57
|
+
if (includeSourceMaps && !inlineSourceMap) {
|
|
58
|
+
artifacts.push({
|
|
59
|
+
filename: asset.filename + '.map',
|
|
60
|
+
originFilename: asset.originFilename,
|
|
61
|
+
type: 'map',
|
|
62
|
+
metadata: {},
|
|
63
|
+
source: map.source
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return artifacts;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=serializeJavaScriptArtifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["serializer/serializeJavaScriptArtifacts.ts"],"sourcesContent":[null],"names":["TRAILING_BUNDLE_ANNOTATIONS","replaceSourceMapUrl","serializeJavaScriptArtifactsAsync","source","url","replace","annotations","includeSourceMaps","inlineSourceMap","sourceMapUrl","debugId","getSourceMap","artifact","map","undefined","getInlineSourceMappingURL","asset","artifacts","push","filename","originFilename","type","metadata"],"mappings":";;;;;;;;;;;;;;;;QAOaA;eAAAA;;QAGGC;eAAAA;;QAMMC;eAAAA;;;;gEAhBgB;;;;;;;;;;;AAO/B,MAAMF,8BACX;AAEK,SAASC,oBAAoBE,MAAc,EAAEC,GAAW;IAC7D,OAAOD,OAAOE,OAAO,CAACL,6BAA6B,CAACM,cAClDA,YAAYD,OAAO,CAAC,4CAA4C,SAASD;AAE7E;AAEO,eAAeF,kCAAkC,EACtDK,iBAAiB,EACjBC,eAAe,EACfC,YAAY,EACZC,OAAO,EACPC,YAAY,EACZC,QAAQ,EAQT;IACC,MAAMC,MAAMN,qBAAqBC,kBAAkB,MAAMG,iBAAiBG;IAC1E,MAAMR,cAAc;QAClBG,cAAcD,kBAAkBO,IAAAA,oCAAyB,EAACF,IAAKV,MAAM,IAAIM;QACzEC,SAASF,kBAAkBM,YAAaD,KAAKH,WAAWA;IAC1D;IACA,oFAAoF;IACpF,MAAMM,QACJ,OAAOJ,aAAa,aAChBA,SAASN,eACT;QACE,GAAGM,QAAQ;QACXT,QACES,SAAST,MAAM,GACdG,CAAAA,YAAYG,YAAY,GAAG,4BAA4BH,YAAYG,YAAY,GAAG,EAAC,IACnFH,CAAAA,YAAYI,OAAO,IAAI,OAAO,mBAAmBJ,YAAYI,OAAO,GAAG,EAAC;IAC7E;IACN,MAAMO,YAAY;QAACD;KAAM;IACzB,IAAIT,qBAAqB,CAACC,iBAAiB;QACzCS,UAAUC,IAAI,CAAC;YACbC,UAAUH,MAAMG,QAAQ,GAAG;YAC3BC,gBAAgBJ,MAAMI,cAAc;YACpCC,MAAM;YACNC,UAAU,CAAC;YACXnB,QAAQU,IAAKV,MAAM;QACrB;IACF;IACA,OAAOc;AACT"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AssetData, MetroConfig } from '@expo/metro/metro';
|
|
2
|
+
import type { MixedOutput, Module, ReadOnlyGraph } from '@expo/metro/metro/DeltaBundler/types';
|
|
3
|
+
import type { ExpoSerializerOptions } from './fork/baseJSBundle';
|
|
4
|
+
import { type SerialAsset } from './serializerAssets';
|
|
5
|
+
/** Adapts legacy serializers' single bundles to server artifacts without reserializing their code. */
|
|
6
|
+
export declare function serializeServerBundleAsync(bundle: unknown, entryPoint: string, preModules: readonly Module<MixedOutput>[], graph: ReadOnlyGraph<MixedOutput>, options: ExpoSerializerOptions, config?: Partial<MetroConfig>): Promise<{
|
|
7
|
+
artifacts: SerialAsset[];
|
|
8
|
+
assets?: readonly AssetData[];
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "serializeServerBundleAsync", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return serializeServerBundleAsync;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function _assert() {
|
|
12
|
+
const data = /*#__PURE__*/ _interop_require_default(require("assert"));
|
|
13
|
+
_assert = function() {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
function _path() {
|
|
19
|
+
const data = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
20
|
+
_path = function() {
|
|
21
|
+
return data;
|
|
22
|
+
};
|
|
23
|
+
return data;
|
|
24
|
+
}
|
|
25
|
+
const _filePath = require("../utils/filePath");
|
|
26
|
+
const _Chunk = require("./chunking/Chunk");
|
|
27
|
+
const _debugId = require("./debugId");
|
|
28
|
+
const _exportPath = require("./exportPath");
|
|
29
|
+
const _serializeChunks = require("./serializeChunks");
|
|
30
|
+
const _serializeJavaScriptArtifacts = require("./serializeJavaScriptArtifacts");
|
|
31
|
+
const _serializerAssets = require("./serializerAssets");
|
|
32
|
+
const _sourceMap = require("./sourceMap");
|
|
33
|
+
function _interop_require_default(obj) {
|
|
34
|
+
return obj && obj.__esModule ? obj : {
|
|
35
|
+
default: obj
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
async function serializeServerBundleAsync(bundle, entryPoint, preModules, graph, options, config = {}) {
|
|
39
|
+
if (typeof bundle === 'string') {
|
|
40
|
+
try {
|
|
41
|
+
const parsed = JSON.parse(bundle);
|
|
42
|
+
if (parsed && typeof parsed === 'object' && 'artifacts' in parsed) bundle = parsed;
|
|
43
|
+
} catch {
|
|
44
|
+
// Metro serializers may return JavaScript instead of Expo's JSON-encoded artifacts.
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (bundle != null && typeof bundle === 'object' && 'artifacts' in bundle) {
|
|
48
|
+
(0, _assert().default)(Array.isArray(bundle.artifacts), 'Serializer did not return expected format. Expected an array of serializer artifacts.');
|
|
49
|
+
return bundle;
|
|
50
|
+
}
|
|
51
|
+
(0, _assert().default)(typeof bundle === 'string' || bundle != null && typeof bundle === 'object' && 'code' in bundle && typeof bundle.code === 'string' && 'map' in bundle && typeof bundle.map === 'string', 'Serializer did not return expected format. Expected serializer artifacts, JavaScript, or a { code, map } bundle.');
|
|
52
|
+
const singleBundle = bundle;
|
|
53
|
+
const serializerOptions = options.serializerOptions;
|
|
54
|
+
const source = typeof singleBundle === 'string' ? singleBundle : singleBundle.code;
|
|
55
|
+
const annotations = source.match(_serializeJavaScriptArtifacts.TRAILING_BUNDLE_ANNOTATIONS)?.[0] ?? '';
|
|
56
|
+
const code = source.slice(0, source.length - annotations.length);
|
|
57
|
+
const contentFilename = (0, _exportPath.getExportPathForDependencyWithOptions)(entryPoint, {
|
|
58
|
+
src: code,
|
|
59
|
+
platform: graph.transformOptions.platform ?? 'web',
|
|
60
|
+
serverRoot: options.serverRoot
|
|
61
|
+
});
|
|
62
|
+
const filename = (0, _exportPath.getExportFilename)(contentFilename, serializerOptions ?? {});
|
|
63
|
+
const originFilename = (0, _filePath.toPosixPath)(_path().default.relative(options.projectRoot, entryPoint));
|
|
64
|
+
const modules = [
|
|
65
|
+
...graph.dependencies.values()
|
|
66
|
+
];
|
|
67
|
+
const artifacts = await (0, _serializeJavaScriptArtifacts.serializeJavaScriptArtifactsAsync)({
|
|
68
|
+
includeSourceMaps: !!serializerOptions?.includeSourceMaps,
|
|
69
|
+
inlineSourceMap: !!options.inlineSourceMap,
|
|
70
|
+
sourceMapUrl: serializerOptions?.includeSourceMaps ? (0, _exportPath.getSiblingSourceMapUrl)(filename) : undefined,
|
|
71
|
+
getSourceMap: async ()=>{
|
|
72
|
+
const mapOptions = (0, _sourceMap.getSourceMapOptions)(options, true);
|
|
73
|
+
const encodedMap = annotations.match(/sourceMappingURL=data:application\/json[^,]*;base64,([^\s]+)/)?.[1];
|
|
74
|
+
const suppliedMap = typeof singleBundle !== 'string' && singleBundle.map || encodedMap && Buffer.from(encodedMap, 'base64').toString();
|
|
75
|
+
// Legacy string serializers may omit a map; only then fall back to the graph's mappings.
|
|
76
|
+
const json = suppliedMap || await (0, _sourceMap.sourceMapStringNonBlocking)([
|
|
77
|
+
...options.modulesOnly ? [] : preModules,
|
|
78
|
+
...(0, _Chunk.getSortedModules)([
|
|
79
|
+
...graph.dependencies.values()
|
|
80
|
+
], options)
|
|
81
|
+
], {
|
|
82
|
+
...mapOptions,
|
|
83
|
+
flatten: false
|
|
84
|
+
});
|
|
85
|
+
const parsed = JSON.parse(json);
|
|
86
|
+
const debugId = parsed.debugId ?? annotations.match(/debugId=([^\s]+)/)?.[1] ?? (0, _debugId.stringToUUID)(code);
|
|
87
|
+
// Generated maps already contain virtual paths that can resemble filesystem paths.
|
|
88
|
+
const map = suppliedMap ? (0, _sourceMap.normalizeExportSourceMapPaths)(parsed, options.serverRoot ?? options.projectRoot) : parsed;
|
|
89
|
+
return {
|
|
90
|
+
source: (0, _sourceMap.normalizeSourceMapString)(map, {
|
|
91
|
+
...mapOptions,
|
|
92
|
+
debugId
|
|
93
|
+
}),
|
|
94
|
+
debugId
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
artifact: {
|
|
98
|
+
filename,
|
|
99
|
+
originFilename,
|
|
100
|
+
type: 'js',
|
|
101
|
+
source: code,
|
|
102
|
+
metadata: {
|
|
103
|
+
modulePaths: modules.map((module)=>module.path),
|
|
104
|
+
...(0, _serializerAssets.getModuleReferences)(modules)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const resources = await (0, _serializeChunks.collectGraphResourcesAsync)(config, entryPoint, graph, options);
|
|
109
|
+
return {
|
|
110
|
+
artifacts: [
|
|
111
|
+
...artifacts,
|
|
112
|
+
...resources.artifacts
|
|
113
|
+
],
|
|
114
|
+
assets: resources.assets
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=serializeServerBundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["serializer/serializeServerBundle.ts"],"sourcesContent":[null],"names":["serializeServerBundleAsync","bundle","entryPoint","preModules","graph","options","config","parsed","JSON","parse","assert","Array","isArray","artifacts","code","map","singleBundle","serializerOptions","source","annotations","match","TRAILING_BUNDLE_ANNOTATIONS","slice","length","contentFilename","getExportPathForDependencyWithOptions","src","platform","transformOptions","serverRoot","filename","getExportFilename","originFilename","toPosixPath","path","relative","projectRoot","modules","dependencies","values","serializeJavaScriptArtifactsAsync","includeSourceMaps","inlineSourceMap","sourceMapUrl","getSiblingSourceMapUrl","undefined","getSourceMap","mapOptions","getSourceMapOptions","encodedMap","suppliedMap","Buffer","from","toString","json","sourceMapStringNonBlocking","modulesOnly","getSortedModules","flatten","debugId","stringToUUID","normalizeExportSourceMapPaths","normalizeSourceMapString","artifact","type","metadata","modulePaths","module","getModuleReferences","resources","collectGraphResourcesAsync","assets"],"mappings":";;;;+BA4BsBA;;;eAAAA;;;;gEA1BH;;;;;;;gEACF;;;;;;0BAEW;uBACK;yBACJ;4BAKtB;iCAEoC;8CAIpC;kCAC+C;2BAM/C;;;;;;AAGA,eAAeA,2BACpBC,MAAe,EACfC,UAAkB,EAClBC,UAA0C,EAC1CC,KAAiC,EACjCC,OAA8B,EAC9BC,SAA+B,CAAC,CAAC;IAEjC,IAAI,OAAOL,WAAW,UAAU;QAC9B,IAAI;YACF,MAAMM,SAASC,KAAKC,KAAK,CAACR;YAC1B,IAAIM,UAAU,OAAOA,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QAAE0D,QAAQF,UAAUE,MAAM;IAAC;AACvF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Module } from '@expo/metro/metro/DeltaBundler/types';
|
|
1
2
|
export type ChunkingStrategy = 'granular' | 'legacy';
|
|
2
3
|
export type AsyncModulePath = string | readonly string[];
|
|
3
4
|
export type AsyncModulePaths = Record<string, AsyncModulePath>;
|
|
@@ -29,3 +30,9 @@ export type SerialAsset = {
|
|
|
29
30
|
requires?: string[];
|
|
30
31
|
};
|
|
31
32
|
};
|
|
33
|
+
export declare function getModuleReferences(modules: Iterable<Module>): {
|
|
34
|
+
expoDomComponentReferences: string[];
|
|
35
|
+
reactClientReferences: string[];
|
|
36
|
+
reactServerReferences: string[];
|
|
37
|
+
loaderReferences: string[];
|
|
38
|
+
};
|
|
@@ -2,5 +2,35 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
+
Object.defineProperty(exports, "getModuleReferences", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return getModuleReferences;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function getModuleReferences(modules) {
|
|
12
|
+
const dependencies = [
|
|
13
|
+
...modules
|
|
14
|
+
];
|
|
15
|
+
return {
|
|
16
|
+
expoDomComponentReferences: collectOutputReferences(dependencies, 'expoDomComponentReference'),
|
|
17
|
+
reactClientReferences: collectOutputReferences(dependencies, 'reactClientReference'),
|
|
18
|
+
reactServerReferences: collectOutputReferences(dependencies, 'reactServerReference'),
|
|
19
|
+
loaderReferences: collectOutputReferences(dependencies, 'loaderReference')
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function collectOutputReferences(modules, key) {
|
|
23
|
+
const references = new Set();
|
|
24
|
+
for (const module of modules){
|
|
25
|
+
for (const output of module.output){
|
|
26
|
+
// TODO: This is a mess. This needs to be properly typed
|
|
27
|
+
const data = output.data;
|
|
28
|
+
if (typeof data[key] === 'string') references.add(data[key]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return [
|
|
32
|
+
...references
|
|
33
|
+
];
|
|
34
|
+
}
|
|
5
35
|
|
|
6
36
|
//# sourceMappingURL=serializerAssets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":["serializer/serializerAssets.ts"],"sourcesContent":[null],"names":["getModuleReferences","modules","dependencies","expoDomComponentReferences","collectOutputReferences","reactClientReferences","reactServerReferences","loaderReferences","key","references","Set","module","output","data","add"],"mappings":";;;;+BA2CgBA;;;eAAAA;;;AAAT,SAASA,oBAAoBC,OAAyB;IAC3D,MAAMC,eAAe;WAAID;KAAQ;IACjC,OAAO;QACLE,4BAA4BC,wBAAwBF,cAAc;QAClEG,uBAAuBD,wBAAwBF,cAAc;QAC7DI,uBAAuBF,wBAAwBF,cAAc;QAC7DK,kBAAkBH,wBAAwBF,cAAc;IAC1D;AACF;AAEA,SAASE,wBAAwBH,OAA0B,EAAEO,GAAW;IACtE,MAAMC,aAAa,IAAIC;IACvB,KAAK,MAAMC,UAAUV,QAAS;QAC5B,KAAK,MAAMW,UAAUD,OAAOC,MAAM,CAAE;YAClC,wDAAwD;YACxD,MAAMC,OAAOD,OAAOC,IAAI;YACxB,IAAI,OAAOA,IAAI,CAACL,IAAI,KAAK,UAAUC,WAAWK,GAAG,CAACD,IAAI,CAACL,IAAI;QAC7D;IACF;IACA,OAAO;WAAIC;KAAW;AACxB"}
|
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
import type { BabelDecodedMap, BabelSourceMapSegment, BasicSourceMap, FBSourceFunctionMap, HermesFunctionOffsets, MetroSourceMapSegmentTuple, MixedSourceMap, VlqMap } from '@expo/metro/metro-source-map';
|
|
8
8
|
import type { SourceMapGeneratorOptions } from '@expo/metro/metro/DeltaBundler/Serializers/sourceMapGenerator';
|
|
9
9
|
import type { Module } from '@expo/metro/metro/DeltaBundler/types';
|
|
10
|
+
import type { ExpoSerializerOptions } from './fork/baseJSBundle';
|
|
11
|
+
export declare function getSourceMapOptions(options: ExpoSerializerOptions, isServer: boolean): ExpoSourceMapOptions;
|
|
10
12
|
export type { BabelDecodedMap, BabelSourceMapSegment, BasicSourceMap, FBSourceFunctionMap, HermesFunctionOffsets, MetroSourceMapSegmentTuple, MixedSourceMap, SourceMapGeneratorOptions, VlqMap, };
|
|
11
13
|
export interface ComposableSourceMap {
|
|
12
14
|
version: number;
|
|
15
|
+
debugId?: string;
|
|
13
16
|
file?: string;
|
|
14
17
|
mappings: string;
|
|
15
18
|
names: string[];
|
|
@@ -23,6 +26,7 @@ export interface ComposableSourceMap {
|
|
|
23
26
|
/** An indexed source map, as Metro emits for bundles */
|
|
24
27
|
export interface IndexedSourceMap {
|
|
25
28
|
version: number;
|
|
29
|
+
debugId?: string;
|
|
26
30
|
file?: string;
|
|
27
31
|
sections: {
|
|
28
32
|
offset: {
|
|
@@ -38,6 +42,7 @@ export interface IndexedSourceMap {
|
|
|
38
42
|
* flat ones.
|
|
39
43
|
*/
|
|
40
44
|
export declare function flattenSourceMap(map: ComposableSourceMap | IndexedSourceMap): ComposableSourceMap;
|
|
45
|
+
export declare function normalizeExportSourceMapPaths(map: ComposableSourceMap | IndexedSourceMap, serverRoot: string): ComposableSourceMap;
|
|
41
46
|
/** An encoded source map's `mappings` and `names`, such as a minifier's output */
|
|
42
47
|
export interface EncodedMappings {
|
|
43
48
|
mappings: string;
|
|
@@ -58,11 +63,13 @@ export declare function vlqMapFromEncodedMap(encoded: EncodedMappings, code: str
|
|
|
58
63
|
map: VlqMap;
|
|
59
64
|
};
|
|
60
65
|
export interface ExpoSourceMapOptions extends SourceMapGeneratorOptions {
|
|
66
|
+
flatten?: boolean;
|
|
61
67
|
debugId?: string;
|
|
62
68
|
}
|
|
63
69
|
export declare function appendDebugIdToSourceMap(sourceMap: string, debugId: string): string;
|
|
64
70
|
export declare function sourceMapString(modules: readonly Module[], options: ExpoSourceMapOptions): string;
|
|
65
71
|
export declare function sourceMapStringNonBlocking(modules: readonly Module[], options: ExpoSourceMapOptions): Promise<string>;
|
|
72
|
+
export declare function normalizeSourceMapString(json: string | ComposableSourceMap | IndexedSourceMap, { debugId, flatten, excludeSource, }: Partial<Pick<ExpoSourceMapOptions, 'debugId' | 'flatten' | 'excludeSource'>>): string;
|
|
66
73
|
export declare function composeSourceMaps(maps: readonly (ComposableSourceMap | IndexedSourceMap)[]): ComposableSourceMap;
|
|
67
74
|
export interface EncodedTransformerSourceMap {
|
|
68
75
|
version: 3;
|