@expo/cli 0.19.13 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +1 -1
- package/build/src/api/graphql/client.js +0 -1
- package/build/src/api/graphql/client.js.map +1 -1
- package/build/src/api/graphql/queries/AppQuery.js +6 -17
- package/build/src/api/graphql/queries/AppQuery.js.map +1 -1
- package/build/src/api/graphql/queries/UserQuery.js +4 -9
- package/build/src/api/graphql/queries/UserQuery.js.map +1 -1
- package/build/src/api/graphql/types/App.js +4 -9
- package/build/src/api/graphql/types/App.js.map +1 -1
- package/build/src/api/user/user.js +7 -12
- package/build/src/api/user/user.js.map +1 -1
- package/build/src/export/createMetadataJson.js +14 -10
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +38 -95
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +3 -3
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/exportApp.js +32 -1
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportDomComponents.js +156 -0
- package/build/src/export/exportDomComponents.js.map +1 -0
- package/build/src/export/exportHermes.js +49 -1
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/install/installExpoPackage.js +15 -15
- package/build/src/install/installExpoPackage.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +2 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +21 -5
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +2 -2
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +20 -5
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +3 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/utils/codesigning.js +8 -8
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/exit.js +59 -2
- package/build/src/utils/exit.js.map +1 -1
- package/build/src/utils/filePath.js +28 -0
- package/build/src/utils/filePath.js.map +1 -0
- package/build/src/utils/ip.js +89 -1
- package/build/src/utils/ip.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/clients/RudderDetachedClient.js +13 -13
- package/build/src/utils/telemetry/clients/RudderDetachedClient.js.map +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +5 -6
- package/build/src/export/embed/guessHermes.js +0 -69
- package/build/src/export/embed/guessHermes.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportDomComponents.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\nimport assert from 'assert';\nimport crypto from 'crypto';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { type PlatformMetadata } from './createMetadataJson';\nimport { type BundleOutput, type ExportAssetMap, getFilesFromSerialAssets } from './saveAssets';\nimport { type MetroBundlerDevServer } from '../start/server/metro/MetroBundlerDevServer';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport {\n getDomComponentHtml,\n DOM_COMPONENTS_BUNDLE_DIR,\n} from '../start/server/middleware/DomComponentsMiddleware';\nimport { env } from '../utils/env';\nimport { resolveRealEntryFilePath } from '../utils/filePath';\n\nconst debug = require('debug')('expo:export:exportDomComponents') as typeof console.log;\n\n// TODO(EvanBacon): determine how to support DOM Components with hosting.\nexport async function exportDomComponentAsync({\n filePath,\n projectRoot,\n dev,\n devServer,\n isHermes,\n includeSourceMaps,\n exp,\n files,\n}: {\n filePath: string;\n projectRoot: string;\n dev: boolean;\n devServer: MetroBundlerDevServer;\n isHermes: boolean;\n includeSourceMaps: boolean;\n exp: ExpoConfig;\n files: ExportAssetMap;\n}): Promise<{\n bundle: BundleOutput;\n htmlOutputName: string;\n}> {\n const virtualEntry = resolveFrom(projectRoot, 'expo/dom/entry.js');\n debug('Bundle DOM Component:', filePath);\n // MUST MATCH THE BABEL PLUGIN!\n const hash = crypto.createHash('sha1').update(filePath).digest('hex');\n const outputName = `${DOM_COMPONENTS_BUNDLE_DIR}/${hash}.html`;\n const generatedEntryPath = filePath.startsWith('file://') ? filePath.slice(7) : filePath;\n const baseUrl = `/${DOM_COMPONENTS_BUNDLE_DIR}`;\n const relativeImport = './' + path.relative(path.dirname(virtualEntry), generatedEntryPath);\n // Run metro bundler and create the JS bundles/source maps.\n const bundle = await devServer.legacySinglePageExportBundleAsync({\n platform: 'web',\n domRoot: encodeURI(relativeImport),\n splitChunks: !env.EXPO_NO_BUNDLE_SPLITTING,\n mainModuleName: resolveRealEntryFilePath(projectRoot, virtualEntry),\n mode: dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n serializerIncludeMaps: includeSourceMaps,\n bytecode: false,\n reactCompiler: !!exp.experiments?.reactCompiler,\n baseUrl: './',\n // Minify may be false because it's skipped on native when Hermes is enabled, default to true.\n minify: true,\n });\n\n const html = await serializeHtmlWithAssets({\n isExporting: true,\n resources: bundle.artifacts,\n template: getDomComponentHtml(),\n baseUrl: './',\n });\n\n const serialAssets = bundle.artifacts.map((a) => {\n return {\n ...a,\n filename: path.join(baseUrl, a.filename),\n };\n });\n\n getFilesFromSerialAssets(serialAssets, {\n includeSourceMaps,\n files,\n platform: 'web',\n });\n\n files.set(outputName, {\n contents: html,\n });\n\n return {\n bundle,\n htmlOutputName: outputName,\n };\n}\n\n/**\n * For EAS Updates exports,\n * post-processes the DOM component bundle and updates the asset paths to use flattened MD5 naming.\n */\nexport function updateDomComponentAssetsForMD5Naming({\n domComponentReference,\n nativeBundle,\n domComponentBundle,\n files,\n htmlOutputName,\n}: {\n domComponentReference: string;\n nativeBundle: BundleOutput;\n domComponentBundle: BundleOutput;\n files: ExportAssetMap;\n htmlOutputName: string;\n}): PlatformMetadata['assets'] {\n const assetsMetadata: PlatformMetadata['assets'] = [];\n\n for (const artifact of domComponentBundle.artifacts) {\n if (artifact.type !== 'js') {\n continue;\n }\n const artifactAssetName = `/${DOM_COMPONENTS_BUNDLE_DIR}/${artifact.filename}`;\n let source = artifact.source;\n\n // [0] Updates asset paths in the DOM component JS bundle (which is a web bundle)\n for (const asset of domComponentBundle.assets) {\n const prefix = asset.httpServerLocation.startsWith('./')\n ? asset.httpServerLocation.slice(2)\n : asset.httpServerLocation;\n const uri = `${prefix}/${asset.name}.${asset.type}`;\n const regexp = new RegExp(`(uri:\")(${uri})(\")`, 'g');\n const index = asset.scales.findIndex((s) => s === 1) ?? 0; // DOM components (web) uses 1x assets\n const md5 = asset.fileHashes[index];\n source = source.replace(regexp, `$1${md5}.${asset.type}$3`);\n\n const domJsAssetEntity = files.get(artifactAssetName);\n assert(domJsAssetEntity);\n domJsAssetEntity.contents = source;\n }\n\n // [1] Updates JS artifacts in HTML\n const md5 = crypto.createHash('md5').update(source).digest('hex');\n const htmlAssetEntity = files.get(htmlOutputName);\n assert(htmlAssetEntity);\n const regexp = new RegExp(`(<script src=\")(.*${artifact.filename})(\" defer></script>)`, 'g');\n htmlAssetEntity.contents = htmlAssetEntity.contents.toString().replace(regexp, `$1${md5}.js$3`);\n\n assetsMetadata.push({\n path: artifactAssetName.slice(1),\n ext: 'js',\n });\n }\n\n // [2] Updates HTML names from native bundle\n const htmlContent = files.get(htmlOutputName);\n assert(htmlContent);\n const htmlMd5 = crypto.createHash('md5').update(htmlContent.contents.toString()).digest('hex');\n const hash = crypto.createHash('sha1').update(domComponentReference).digest('hex');\n for (const artifact of nativeBundle.artifacts) {\n if (artifact.type !== 'js') {\n continue;\n }\n const assetEntity = files.get(artifact.filename);\n assert(assetEntity);\n const regexp = new RegExp(`(['\"])${hash}\\\\.html(['\"])`, 'g');\n assetEntity.contents = assetEntity.contents.toString().replace(regexp, `$1${htmlMd5}.html$2`);\n }\n assetsMetadata.push({\n path: htmlOutputName,\n ext: 'html',\n });\n\n return assetsMetadata;\n}\n"],"names":["exportDomComponentAsync","updateDomComponentAssetsForMD5Naming","debug","require","filePath","projectRoot","dev","devServer","isHermes","includeSourceMaps","exp","files","virtualEntry","resolveFrom","hash","crypto","createHash","update","digest","outputName","DOM_COMPONENTS_BUNDLE_DIR","generatedEntryPath","startsWith","slice","baseUrl","relativeImport","path","relative","dirname","bundle","legacySinglePageExportBundleAsync","platform","domRoot","encodeURI","splitChunks","env","EXPO_NO_BUNDLE_SPLITTING","mainModuleName","resolveRealEntryFilePath","mode","engine","undefined","serializerIncludeMaps","bytecode","reactCompiler","experiments","minify","html","serializeHtmlWithAssets","isExporting","resources","artifacts","template","getDomComponentHtml","serialAssets","map","a","filename","join","getFilesFromSerialAssets","set","contents","htmlOutputName","domComponentReference","nativeBundle","domComponentBundle","assetsMetadata","artifact","type","artifactAssetName","source","asset","assets","prefix","httpServerLocation","uri","name","regexp","RegExp","index","scales","findIndex","s","md5","fileHashes","replace","domJsAssetEntity","get","assert","htmlAssetEntity","toString","push","ext","htmlContent","htmlMd5","assetEntity"],"mappings":"AAAA;;;;;;;;;;;IAoBsBA,uBAAuB,MAAvBA,uBAAuB;IAgF7BC,oCAAoC,MAApCA,oCAAoC;;;8DAnGjC,QAAQ;;;;;;;8DACR,QAAQ;;;;;;;8DACV,MAAM;;;;;;;8DACC,cAAc;;;;;;4BAG2C,cAAc;+BAEvD,qCAAqC;yCAItE,oDAAoD;qBACvC,cAAc;0BACO,mBAAmB;;;;;;AAE5D,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,iCAAiC,CAAC,AAAsB,AAAC;AAGjF,eAAeH,uBAAuB,CAAC,EAC5CI,QAAQ,CAAA,EACRC,WAAW,CAAA,EACXC,GAAG,CAAA,EACHC,SAA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E,MAAM,CAAC,KAAK,CAAC,AAAC;IAC/F,MAAMJ,IAAI,GAAGC,OAAM,EAAA,QAAA,CAACC,UAAU,CAAC,MAAM,CAAC,CAACC,MAAM,CAAC8C,qBAAqB,CAAC,CAAC7C,MAAM,CAAC,KAAK,CAAC,AAAC;IACnF,KAAK,MAAMiD,SAAQ,IAAIH,YAAY,CAACb,SAAS,CAAE;QAC7C,IAAIgB,SAAQ,CAACC,IAAI,KAAK,IAAI,EAAE;YAC1B,SAAS;QACX,CAAC;QACD,MAAM2B,WAAW,GAAGpF,KAAK,CAAC4E,GAAG,CAACpB,SAAQ,CAACV,QAAQ,CAAC,AAAC;QACjD+B,IAAAA,OAAM,EAAA,QAAA,EAACO,WAAW,CAAC,CAAC;QACpB,MAAMlB,OAAM,GAAG,IAAIC,MAAM,CAAC,CAAC,MAAM,EAAEhE,IAAI,CAAC,aAAa,CAAC,EAAE,GAAG,CAAC,AAAC;QAC7DiF,WAAW,CAAClC,QAAQ,GAAGkC,WAAW,CAAClC,QAAQ,CAAC6B,QAAQ,EAAE,CAACL,OAAO,CAACR,OAAM,EAAE,CAAC,EAAE,EAAEiB,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAChG,CAAC;IACD5B,cAAc,CAACyB,IAAI,CAAC;QAClBjE,IAAI,EAAEoC,cAAc;QACpB8B,GAAG,EAAE,MAAM;KACZ,CAAC,CAAC;IAEH,OAAO1B,cAAc,CAAC;AACxB,CAAC"}
|
|
@@ -14,9 +14,12 @@ _export(exports, {
|
|
|
14
14
|
parseGradleProperties: ()=>parseGradleProperties,
|
|
15
15
|
maybeThrowFromInconsistentEngineAsync: ()=>maybeThrowFromInconsistentEngineAsync,
|
|
16
16
|
maybeInconsistentEngineAndroidAsync: ()=>maybeInconsistentEngineAndroidAsync,
|
|
17
|
+
isHermesPossiblyEnabled: ()=>isHermesPossiblyEnabled,
|
|
17
18
|
maybeInconsistentEngineIosAsync: ()=>maybeInconsistentEngineIosAsync,
|
|
18
19
|
isHermesBytecodeBundleAsync: ()=>isHermesBytecodeBundleAsync,
|
|
19
|
-
getHermesBytecodeBundleVersionAsync: ()=>getHermesBytecodeBundleVersionAsync
|
|
20
|
+
getHermesBytecodeBundleVersionAsync: ()=>getHermesBytecodeBundleVersionAsync,
|
|
21
|
+
isAndroidUsingHermes: ()=>isAndroidUsingHermes,
|
|
22
|
+
isIosUsingHermes: ()=>isIosUsingHermes
|
|
20
23
|
});
|
|
21
24
|
function _config() {
|
|
22
25
|
const data = require("@expo/config");
|
|
@@ -25,6 +28,13 @@ function _config() {
|
|
|
25
28
|
};
|
|
26
29
|
return data;
|
|
27
30
|
}
|
|
31
|
+
function _jsonFile() {
|
|
32
|
+
const data = /*#__PURE__*/ _interopRequireDefault(require("@expo/json-file"));
|
|
33
|
+
_jsonFile = function() {
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
28
38
|
function _fsExtra() {
|
|
29
39
|
const data = /*#__PURE__*/ _interopRequireDefault(require("fs-extra"));
|
|
30
40
|
_fsExtra = function() {
|
|
@@ -102,6 +112,30 @@ async function maybeInconsistentEngineAndroidAsync(projectRoot, isHermesManaged)
|
|
|
102
112
|
}
|
|
103
113
|
return false;
|
|
104
114
|
}
|
|
115
|
+
function isHermesPossiblyEnabled(projectRoot) {
|
|
116
|
+
// Trying best to check ios native project if by chance to be consistent between app config
|
|
117
|
+
// Check ios/Podfile for ":hermes_enabled => true"
|
|
118
|
+
const podfilePath = _path().default.join(projectRoot, "ios", "Podfile");
|
|
119
|
+
if (_fsExtra().default.existsSync(podfilePath)) {
|
|
120
|
+
const content = _fsExtra().default.readFileSync(podfilePath, "utf8");
|
|
121
|
+
const isPropsReference = content.search(/^\s*:hermes_enabled\s*=>\s*podfile_properties\['expo.jsEngine'\]\s*==\s*nil\s*\|\|\s*podfile_properties\['expo.jsEngine'\]\s*==\s*'hermes',?/m) >= 0;
|
|
122
|
+
const isHermesBare = content.search(/^\s*:hermes_enabled\s*=>\s*true,?\s+/m) >= 0;
|
|
123
|
+
if (!isPropsReference && isHermesBare) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Check Podfile.properties.json from prebuild template
|
|
128
|
+
const podfilePropertiesPath = _path().default.join(projectRoot, "ios", "Podfile.properties.json");
|
|
129
|
+
if (_fsExtra().default.existsSync(podfilePropertiesPath)) {
|
|
130
|
+
try {
|
|
131
|
+
const props = _jsonFile().default.read(podfilePropertiesPath);
|
|
132
|
+
return props["expo.jsEngine"] === "hermes";
|
|
133
|
+
} catch {
|
|
134
|
+
// ignore
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
105
139
|
async function maybeInconsistentEngineIosAsync(projectRoot, isHermesManaged) {
|
|
106
140
|
// Trying best to check ios native project if by chance to be consistent between app config
|
|
107
141
|
// Check ios/Podfile for ":hermes_enabled => true"
|
|
@@ -152,5 +186,19 @@ async function parsePodfilePropertiesAsync(podfilePropertiesPath) {
|
|
|
152
186
|
return {};
|
|
153
187
|
}
|
|
154
188
|
}
|
|
189
|
+
function isAndroidUsingHermes(projectRoot) {
|
|
190
|
+
// Check gradle.properties from prebuild template
|
|
191
|
+
const gradlePropertiesPath = _path().default.join(projectRoot, "android", "gradle.properties");
|
|
192
|
+
if (_fsExtra().default.existsSync(gradlePropertiesPath)) {
|
|
193
|
+
const props = parseGradleProperties(_fsExtra().default.readFileSync(gradlePropertiesPath, "utf8"));
|
|
194
|
+
return props["hermesEnabled"] === "true";
|
|
195
|
+
}
|
|
196
|
+
// Assume Hermes is used by default.
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
function isIosUsingHermes(projectRoot) {
|
|
200
|
+
// If nullish, then assume Hermes is used.
|
|
201
|
+
return isHermesPossiblyEnabled(projectRoot) !== false;
|
|
202
|
+
}
|
|
155
203
|
|
|
156
204
|
//# sourceMappingURL=exportHermes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportHermes.ts"],"sourcesContent":["import { ExpoConfig, getConfigFilePaths, Platform } from '@expo/config';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nexport async function assertEngineMismatchAsync(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'ios' | 'android' | 'jsEngine'>,\n platform: Platform\n) {\n const isHermesManaged = isEnableHermesManaged(exp, platform);\n const paths = getConfigFilePaths(projectRoot);\n const configFilePath = paths.dynamicConfigPath ?? paths.staticConfigPath ?? 'app.json';\n await maybeThrowFromInconsistentEngineAsync(\n projectRoot,\n configFilePath,\n platform,\n isHermesManaged\n );\n}\n\nexport function isEnableHermesManaged(\n expoConfig: Partial<Pick<ExpoConfig, 'ios' | 'android' | 'jsEngine'>>,\n platform: string\n): boolean {\n switch (platform) {\n case 'android': {\n return (expoConfig.android?.jsEngine ?? expoConfig.jsEngine) !== 'jsc';\n }\n case 'ios': {\n return (expoConfig.ios?.jsEngine ?? expoConfig.jsEngine) !== 'jsc';\n }\n default:\n return false;\n }\n}\n\nexport function parseGradleProperties(content: string): Record<string, string> {\n const result: Record<string, string> = {};\n for (let line of content.split('\\n')) {\n line = line.trim();\n if (!line || line.startsWith('#')) {\n continue;\n }\n\n const sepIndex = line.indexOf('=');\n const key = line.substr(0, sepIndex);\n const value = line.substr(sepIndex + 1);\n result[key] = value;\n }\n return result;\n}\n\nexport async function maybeThrowFromInconsistentEngineAsync(\n projectRoot: string,\n configFilePath: string,\n platform: string,\n isHermesManaged: boolean\n): Promise<void> {\n const configFileName = path.basename(configFilePath);\n if (\n platform === 'android' &&\n (await maybeInconsistentEngineAndroidAsync(projectRoot, isHermesManaged))\n ) {\n throw new Error(\n `JavaScript engine configuration is inconsistent between ${configFileName} and Android native project.\\n` +\n `In ${configFileName}: Hermes is ${isHermesManaged ? 'enabled' : 'not enabled'}\\n` +\n `In Android native project: Hermes is ${isHermesManaged ? 'not enabled' : 'enabled'}\\n` +\n `Please check the following files for inconsistencies:\\n` +\n ` - ${configFilePath}\\n` +\n ` - ${path.join(projectRoot, 'android', 'gradle.properties')}\\n` +\n ` - ${path.join(projectRoot, 'android', 'app', 'build.gradle')}\\n` +\n 'Learn more: https://expo.fyi/hermes-android-config'\n );\n }\n\n if (platform === 'ios' && (await maybeInconsistentEngineIosAsync(projectRoot, isHermesManaged))) {\n throw new Error(\n `JavaScript engine configuration is inconsistent between ${configFileName} and iOS native project.\\n` +\n `In ${configFileName}: Hermes is ${isHermesManaged ? 'enabled' : 'not enabled'}\\n` +\n `In iOS native project: Hermes is ${isHermesManaged ? 'not enabled' : 'enabled'}\\n` +\n `Please check the following files for inconsistencies:\\n` +\n ` - ${configFilePath}\\n` +\n ` - ${path.join(projectRoot, 'ios', 'Podfile')}\\n` +\n ` - ${path.join(projectRoot, 'ios', 'Podfile.properties.json')}\\n` +\n 'Learn more: https://expo.fyi/hermes-ios-config'\n );\n }\n}\n\nexport async function maybeInconsistentEngineAndroidAsync(\n projectRoot: string,\n isHermesManaged: boolean\n): Promise<boolean> {\n // Trying best to check android native project if by chance to be consistent between app config\n\n // Check gradle.properties from prebuild template\n const gradlePropertiesPath = path.join(projectRoot, 'android', 'gradle.properties');\n if (fs.existsSync(gradlePropertiesPath)) {\n const props = parseGradleProperties(await fs.readFile(gradlePropertiesPath, 'utf8'));\n const isHermesBare = props['hermesEnabled'] === 'true';\n if (isHermesManaged !== isHermesBare) {\n return true;\n }\n }\n\n return false;\n}\n\nexport async function maybeInconsistentEngineIosAsync(\n projectRoot: string,\n isHermesManaged: boolean\n): Promise<boolean> {\n // Trying best to check ios native project if by chance to be consistent between app config\n\n // Check ios/Podfile for \":hermes_enabled => true\"\n const podfilePath = path.join(projectRoot, 'ios', 'Podfile');\n if (fs.existsSync(podfilePath)) {\n const content = await fs.readFile(podfilePath, 'utf8');\n const isPropsReference =\n content.search(\n /^\\s*:hermes_enabled\\s*=>\\s*podfile_properties\\['expo.jsEngine'\\]\\s*==\\s*nil\\s*\\|\\|\\s*podfile_properties\\['expo.jsEngine'\\]\\s*==\\s*'hermes',?/m\n ) >= 0;\n const isHermesBare = content.search(/^\\s*:hermes_enabled\\s*=>\\s*true,?\\s+/m) >= 0;\n if (!isPropsReference && isHermesManaged !== isHermesBare) {\n return true;\n }\n }\n\n // Check Podfile.properties.json from prebuild template\n const podfilePropertiesPath = path.join(projectRoot, 'ios', 'Podfile.properties.json');\n if (fs.existsSync(podfilePropertiesPath)) {\n const props = await parsePodfilePropertiesAsync(podfilePropertiesPath);\n const isHermesBare = props['expo.jsEngine'] === 'hermes';\n if (isHermesManaged !== isHermesBare) {\n return true;\n }\n }\n\n return false;\n}\n\n// https://github.com/facebook/hermes/blob/release-v0.5/include/hermes/BCGen/HBC/BytecodeFileFormat.h#L24-L25\nconst HERMES_MAGIC_HEADER = 'c61fbc03c103191f';\n\nexport async function isHermesBytecodeBundleAsync(file: string): Promise<boolean> {\n const header = await readHermesHeaderAsync(file);\n return header.slice(0, 8).toString('hex') === HERMES_MAGIC_HEADER;\n}\n\nexport async function getHermesBytecodeBundleVersionAsync(file: string): Promise<number> {\n const header = await readHermesHeaderAsync(file);\n if (header.slice(0, 8).toString('hex') !== HERMES_MAGIC_HEADER) {\n throw new Error('Invalid hermes bundle file');\n }\n return header.readUInt32LE(8);\n}\n\nasync function readHermesHeaderAsync(file: string): Promise<Buffer> {\n const fd = await fs.open(file, 'r');\n const buffer = Buffer.alloc(12);\n await fs.read(fd, buffer, 0, 12, null);\n await fs.close(fd);\n return buffer;\n}\n\nasync function parsePodfilePropertiesAsync(\n podfilePropertiesPath: string\n): Promise<Record<string, string>> {\n try {\n return JSON.parse(await fs.readFile(podfilePropertiesPath, 'utf8'));\n } catch {\n return {};\n }\n}\n"],"names":["assertEngineMismatchAsync","isEnableHermesManaged","parseGradleProperties","maybeThrowFromInconsistentEngineAsync","maybeInconsistentEngineAndroidAsync","maybeInconsistentEngineIosAsync","isHermesBytecodeBundleAsync","getHermesBytecodeBundleVersionAsync","projectRoot","exp","platform","isHermesManaged","paths","getConfigFilePaths","configFilePath","dynamicConfigPath","staticConfigPath","expoConfig","android","jsEngine","ios","content","result","line","split","trim","startsWith","sepIndex","indexOf","key","substr","value","configFileName","path","basename","Error","join","gradlePropertiesPath","fs","existsSync","props","readFile","isHermesBare","podfilePath","isPropsReference","search","podfilePropertiesPath","parsePodfilePropertiesAsync","HERMES_MAGIC_HEADER","file","header","readHermesHeaderAsync","slice","toString","readUInt32LE","fd","open","buffer","Buffer","alloc","read","close","JSON","parse"],"mappings":"AAAA;;;;;;;;;;;IAIsBA,yBAAyB,MAAzBA,yBAAyB;IAgB/BC,qBAAqB,MAArBA,qBAAqB;IAgBrBC,qBAAqB,MAArBA,qBAAqB;IAgBfC,qCAAqC,MAArCA,qCAAqC;IAqCrCC,mCAAmC,MAAnCA,mCAAmC;IAmBnCC,+BAA+B,MAA/BA,+BAA+B;IAoC/BC,2BAA2B,MAA3BA,2BAA2B;IAK3BC,mCAAmC,MAAnCA,mCAAmC;;;yBArJA,cAAc;;;;;;;8DACxD,UAAU;;;;;;;8DACR,MAAM;;;;;;;;;;;AAEhB,eAAeP,yBAAyB,CAC7CQ,WAAmB,EACnBC,GAAqD,EACrDC,QAAkB,EAClB;IACA,MAAMC,eAAe,GAAGV,qBAAqB,CAACQ,GAAG,EAAEC,QAAQ,CAAC,AAAC;IAC7D,MAAME,KAAK,GAAGC,IAAAA,OAAkB,EAAA,mBAAA,EAACL,WAAW,CAAC,AAAC;IAC9C,MAAMM,cAAc,GAAGF,KAAK,CAACG,iBAAiB,IAAIH,KAAK,CAACI,gBAAgB,IAAI,UAAU,AAAC;IACvF,MAAMb,qCAAqC,CACzCK,WAAW,EACXM,cAAc,EACdJ,QAAQ,EACRC,eAAe,CAChB,CAAC;AACJ,CAAC;AAEM,SAASV,qBAAqB,CACnCgB,UAAqE,EACrEP,QAAgB,EACP;IACT,OAAQA,QAAQ;QACd,KAAK,SAAS;YAAE;oBACNO,GAAkB;gBAA1B,OAAO,CAACA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AAC;IACD,OAAOe,MAAM,CAACI,YAAY,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC;AAED,eAAeH,qBAAqB,CAACF,IAAY,EAAmB;IAClE,MAAMM,EAAE,GAAG,MAAMjB,QAAE,EAAA,QAAA,CAACkB,IAAI,CAACP,IAAI,EAAE,GAAG,CAAC,AAAC;IACpC,MAAMQ,MAAM,GAAGC,MAAM,CAACC,KAAK,CAAC,EAAE,CAAC,AAAC;IAChC,MAAMrB,QAAE,EAAA,QAAA,CAACsB,IAAI,CAACL,EAAE,EAAEE,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IACvC,MAAMnB,QAAE,EAAA,QAAA,CAACuB,KAAK,CAACN,EAAE,CAAC,CAAC;IACnB,OAAOE,MAAM,CAAC;AAChB,CAAC;AAED,eAAeV,2BAA2B,CACxCD,qBAA6B,EACI;IACjC,IAAI;QACF,OAAOgB,IAAI,CAACC,KAAK,CAAC,MAAMzB,QAAE,EAAA,QAAA,CAACG,QAAQ,CAACK,qBAAqB,EAAE,MAAM,CAAC,CAAC,CAAC;IACtE,EAAE,OAAM;QACN,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportHermes.ts"],"sourcesContent":["import { ExpoConfig, getConfigFilePaths, Platform } from '@expo/config';\nimport JsonFile from '@expo/json-file';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nexport async function assertEngineMismatchAsync(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'ios' | 'android' | 'jsEngine'>,\n platform: Platform\n) {\n const isHermesManaged = isEnableHermesManaged(exp, platform);\n const paths = getConfigFilePaths(projectRoot);\n const configFilePath = paths.dynamicConfigPath ?? paths.staticConfigPath ?? 'app.json';\n await maybeThrowFromInconsistentEngineAsync(\n projectRoot,\n configFilePath,\n platform,\n isHermesManaged\n );\n}\n\nexport function isEnableHermesManaged(\n expoConfig: Partial<Pick<ExpoConfig, 'ios' | 'android' | 'jsEngine'>>,\n platform: string\n): boolean {\n switch (platform) {\n case 'android': {\n return (expoConfig.android?.jsEngine ?? expoConfig.jsEngine) !== 'jsc';\n }\n case 'ios': {\n return (expoConfig.ios?.jsEngine ?? expoConfig.jsEngine) !== 'jsc';\n }\n default:\n return false;\n }\n}\n\nexport function parseGradleProperties(content: string): Record<string, string> {\n const result: Record<string, string> = {};\n for (let line of content.split('\\n')) {\n line = line.trim();\n if (!line || line.startsWith('#')) {\n continue;\n }\n\n const sepIndex = line.indexOf('=');\n const key = line.substr(0, sepIndex);\n const value = line.substr(sepIndex + 1);\n result[key] = value;\n }\n return result;\n}\n\nexport async function maybeThrowFromInconsistentEngineAsync(\n projectRoot: string,\n configFilePath: string,\n platform: string,\n isHermesManaged: boolean\n): Promise<void> {\n const configFileName = path.basename(configFilePath);\n if (\n platform === 'android' &&\n (await maybeInconsistentEngineAndroidAsync(projectRoot, isHermesManaged))\n ) {\n throw new Error(\n `JavaScript engine configuration is inconsistent between ${configFileName} and Android native project.\\n` +\n `In ${configFileName}: Hermes is ${isHermesManaged ? 'enabled' : 'not enabled'}\\n` +\n `In Android native project: Hermes is ${isHermesManaged ? 'not enabled' : 'enabled'}\\n` +\n `Please check the following files for inconsistencies:\\n` +\n ` - ${configFilePath}\\n` +\n ` - ${path.join(projectRoot, 'android', 'gradle.properties')}\\n` +\n ` - ${path.join(projectRoot, 'android', 'app', 'build.gradle')}\\n` +\n 'Learn more: https://expo.fyi/hermes-android-config'\n );\n }\n\n if (platform === 'ios' && (await maybeInconsistentEngineIosAsync(projectRoot, isHermesManaged))) {\n throw new Error(\n `JavaScript engine configuration is inconsistent between ${configFileName} and iOS native project.\\n` +\n `In ${configFileName}: Hermes is ${isHermesManaged ? 'enabled' : 'not enabled'}\\n` +\n `In iOS native project: Hermes is ${isHermesManaged ? 'not enabled' : 'enabled'}\\n` +\n `Please check the following files for inconsistencies:\\n` +\n ` - ${configFilePath}\\n` +\n ` - ${path.join(projectRoot, 'ios', 'Podfile')}\\n` +\n ` - ${path.join(projectRoot, 'ios', 'Podfile.properties.json')}\\n` +\n 'Learn more: https://expo.fyi/hermes-ios-config'\n );\n }\n}\n\nexport async function maybeInconsistentEngineAndroidAsync(\n projectRoot: string,\n isHermesManaged: boolean\n): Promise<boolean> {\n // Trying best to check android native project if by chance to be consistent between app config\n\n // Check gradle.properties from prebuild template\n const gradlePropertiesPath = path.join(projectRoot, 'android', 'gradle.properties');\n if (fs.existsSync(gradlePropertiesPath)) {\n const props = parseGradleProperties(await fs.readFile(gradlePropertiesPath, 'utf8'));\n const isHermesBare = props['hermesEnabled'] === 'true';\n if (isHermesManaged !== isHermesBare) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function isHermesPossiblyEnabled(projectRoot: string): boolean | null {\n // Trying best to check ios native project if by chance to be consistent between app config\n\n // Check ios/Podfile for \":hermes_enabled => true\"\n const podfilePath = path.join(projectRoot, 'ios', 'Podfile');\n if (fs.existsSync(podfilePath)) {\n const content = fs.readFileSync(podfilePath, 'utf8');\n const isPropsReference =\n content.search(\n /^\\s*:hermes_enabled\\s*=>\\s*podfile_properties\\['expo.jsEngine'\\]\\s*==\\s*nil\\s*\\|\\|\\s*podfile_properties\\['expo.jsEngine'\\]\\s*==\\s*'hermes',?/m\n ) >= 0;\n const isHermesBare = content.search(/^\\s*:hermes_enabled\\s*=>\\s*true,?\\s+/m) >= 0;\n if (!isPropsReference && isHermesBare) {\n return true;\n }\n }\n\n // Check Podfile.properties.json from prebuild template\n const podfilePropertiesPath = path.join(projectRoot, 'ios', 'Podfile.properties.json');\n if (fs.existsSync(podfilePropertiesPath)) {\n try {\n const props = JsonFile.read(podfilePropertiesPath);\n return props['expo.jsEngine'] === 'hermes';\n } catch {\n // ignore\n }\n }\n\n return null;\n}\n\nexport async function maybeInconsistentEngineIosAsync(\n projectRoot: string,\n isHermesManaged: boolean\n): Promise<boolean> {\n // Trying best to check ios native project if by chance to be consistent between app config\n\n // Check ios/Podfile for \":hermes_enabled => true\"\n const podfilePath = path.join(projectRoot, 'ios', 'Podfile');\n if (fs.existsSync(podfilePath)) {\n const content = await fs.readFile(podfilePath, 'utf8');\n const isPropsReference =\n content.search(\n /^\\s*:hermes_enabled\\s*=>\\s*podfile_properties\\['expo.jsEngine'\\]\\s*==\\s*nil\\s*\\|\\|\\s*podfile_properties\\['expo.jsEngine'\\]\\s*==\\s*'hermes',?/m\n ) >= 0;\n const isHermesBare = content.search(/^\\s*:hermes_enabled\\s*=>\\s*true,?\\s+/m) >= 0;\n if (!isPropsReference && isHermesManaged !== isHermesBare) {\n return true;\n }\n }\n\n // Check Podfile.properties.json from prebuild template\n const podfilePropertiesPath = path.join(projectRoot, 'ios', 'Podfile.properties.json');\n if (fs.existsSync(podfilePropertiesPath)) {\n const props = await parsePodfilePropertiesAsync(podfilePropertiesPath);\n const isHermesBare = props['expo.jsEngine'] === 'hermes';\n if (isHermesManaged !== isHermesBare) {\n return true;\n }\n }\n\n return false;\n}\n\n// https://github.com/facebook/hermes/blob/release-v0.5/include/hermes/BCGen/HBC/BytecodeFileFormat.h#L24-L25\nconst HERMES_MAGIC_HEADER = 'c61fbc03c103191f';\n\nexport async function isHermesBytecodeBundleAsync(file: string): Promise<boolean> {\n const header = await readHermesHeaderAsync(file);\n return header.slice(0, 8).toString('hex') === HERMES_MAGIC_HEADER;\n}\n\nexport async function getHermesBytecodeBundleVersionAsync(file: string): Promise<number> {\n const header = await readHermesHeaderAsync(file);\n if (header.slice(0, 8).toString('hex') !== HERMES_MAGIC_HEADER) {\n throw new Error('Invalid hermes bundle file');\n }\n return header.readUInt32LE(8);\n}\n\nasync function readHermesHeaderAsync(file: string): Promise<Buffer> {\n const fd = await fs.open(file, 'r');\n const buffer = Buffer.alloc(12);\n await fs.read(fd, buffer, 0, 12, null);\n await fs.close(fd);\n return buffer;\n}\n\nasync function parsePodfilePropertiesAsync(\n podfilePropertiesPath: string\n): Promise<Record<string, string>> {\n try {\n return JSON.parse(await fs.readFile(podfilePropertiesPath, 'utf8'));\n } catch {\n return {};\n }\n}\n\nexport function isAndroidUsingHermes(projectRoot: string) {\n // Check gradle.properties from prebuild template\n const gradlePropertiesPath = path.join(projectRoot, 'android', 'gradle.properties');\n if (fs.existsSync(gradlePropertiesPath)) {\n const props = parseGradleProperties(fs.readFileSync(gradlePropertiesPath, 'utf8'));\n return props['hermesEnabled'] === 'true';\n }\n\n // Assume Hermes is used by default.\n return true;\n}\n\nexport function isIosUsingHermes(projectRoot: string) {\n // If nullish, then assume Hermes is used.\n return isHermesPossiblyEnabled(projectRoot) !== false;\n}\n"],"names":["assertEngineMismatchAsync","isEnableHermesManaged","parseGradleProperties","maybeThrowFromInconsistentEngineAsync","maybeInconsistentEngineAndroidAsync","isHermesPossiblyEnabled","maybeInconsistentEngineIosAsync","isHermesBytecodeBundleAsync","getHermesBytecodeBundleVersionAsync","isAndroidUsingHermes","isIosUsingHermes","projectRoot","exp","platform","isHermesManaged","paths","getConfigFilePaths","configFilePath","dynamicConfigPath","staticConfigPath","expoConfig","android","jsEngine","ios","content","result","line","split","trim","startsWith","sepIndex","indexOf","key","substr","value","configFileName","path","basename","Error","join","gradlePropertiesPath","fs","existsSync","props","readFile","isHermesBare","podfilePath","readFileSync","isPropsReference","search","podfilePropertiesPath","JsonFile","read","parsePodfilePropertiesAsync","HERMES_MAGIC_HEADER","file","header","readHermesHeaderAsync","slice","toString","readUInt32LE","fd","open","buffer","Buffer","alloc","close","JSON","parse"],"mappings":"AAAA;;;;;;;;;;;IAKsBA,yBAAyB,MAAzBA,yBAAyB;IAgB/BC,qBAAqB,MAArBA,qBAAqB;IAgBrBC,qBAAqB,MAArBA,qBAAqB;IAgBfC,qCAAqC,MAArCA,qCAAqC;IAqCrCC,mCAAmC,MAAnCA,mCAAmC;IAmBzCC,uBAAuB,MAAvBA,uBAAuB;IA+BjBC,+BAA+B,MAA/BA,+BAA+B;IAoC/BC,2BAA2B,MAA3BA,2BAA2B;IAK3BC,mCAAmC,MAAnCA,mCAAmC;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C;AACH,CAAC;AAEM,SAASzC,oBAAoB,CAACE,WAAmB,EAAE;IACxD,iDAAiD;IACjD,MAAM6B,oBAAoB,GAAGJ,KAAI,EAAA,QAAA,CAACG,IAAI,CAAC5B,WAAW,EAAE,SAAS,EAAE,mBAAmB,CAAC,AAAC;IACpF,IAAI8B,QAAE,EAAA,QAAA,CAACC,UAAU,CAACF,oBAAoB,CAAC,EAAE;QACvC,MAAMG,KAAK,GAAGzC,qBAAqB,CAACuC,QAAE,EAAA,QAAA,CAACM,YAAY,CAACP,oBAAoB,EAAE,MAAM,CAAC,CAAC,AAAC;QACnF,OAAOG,KAAK,CAAC,eAAe,CAAC,KAAK,MAAM,CAAC;IAC3C,CAAC;IAED,oCAAoC;IACpC,OAAO,IAAI,CAAC;AACd,CAAC;AAEM,SAASjC,gBAAgB,CAACC,WAAmB,EAAE;IACpD,0CAA0C;IAC1C,OAAON,uBAAuB,CAACM,WAAW,CAAC,KAAK,KAAK,CAAC;AACxD,CAAC"}
|
|
@@ -83,22 +83,22 @@ async function installExpoPackageAsync(projectRoot, { packageManager , packageMa
|
|
|
83
83
|
_log.error((0, _chalk().default)`Cannot install the latest Expo package. Install {bold expo@latest} with ${packageManager.name} and then run {bold npx expo install} again.`);
|
|
84
84
|
throw error;
|
|
85
85
|
}
|
|
86
|
-
|
|
87
|
-
let commandSegments = [
|
|
88
|
-
"expo",
|
|
89
|
-
"install",
|
|
90
|
-
...followUpCommandArgs
|
|
91
|
-
];
|
|
92
|
-
if (packageManagerArguments.length) {
|
|
93
|
-
commandSegments = [
|
|
94
|
-
...commandSegments,
|
|
95
|
-
"--",
|
|
96
|
-
...packageManagerArguments
|
|
97
|
-
];
|
|
98
|
-
}
|
|
99
|
-
_log.log("> " + commandSegments.join(" "));
|
|
100
|
-
// Spawn a new process to install the rest of the packages, as only then will the latest Expo package be used
|
|
86
|
+
// Spawn a new process to install the rest of the packages if there are any, as only then will the latest Expo package be used
|
|
101
87
|
if (followUpCommandArgs.length) {
|
|
88
|
+
let commandSegments = [
|
|
89
|
+
"expo",
|
|
90
|
+
"install",
|
|
91
|
+
...followUpCommandArgs
|
|
92
|
+
];
|
|
93
|
+
if (packageManagerArguments.length) {
|
|
94
|
+
commandSegments = [
|
|
95
|
+
...commandSegments,
|
|
96
|
+
"--",
|
|
97
|
+
...packageManagerArguments
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
_log.log((0, _chalk().default)`\u203A Running {bold npx expo install} under the updated expo version`);
|
|
101
|
+
_log.log("> " + commandSegments.join(" "));
|
|
102
102
|
await (0, _spawnAsync().default)("npx", commandSegments, {
|
|
103
103
|
stdio: "inherit",
|
|
104
104
|
cwd: projectRoot,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/install/installExpoPackage.ts"],"sourcesContent":["import * as PackageManager from '@expo/package-manager';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport { getRunningProcess } from '../utils/getRunningProcess';\n\n/**\n * Given a list of incompatible packages, installs the correct versions of the packages with the package manager used for the project.\n * This exits immediately after spawning the install command, since the command shouldn't remain running while it is being updated.\n */\nexport async function installExpoPackageAsync(\n projectRoot: string,\n {\n packageManager,\n packageManagerArguments,\n expoPackageToInstall,\n followUpCommandArgs,\n }: {\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n expoPackageToInstall: string;\n followUpCommandArgs: string[];\n }\n) {\n // Check if there's potentially a dev server running in the current folder and warn about it\n // (not guaranteed to be Expo CLI, and the CLI isn't always running on 8081, but it's a good guess)\n const isExpoMaybeRunningForProject = !!(await getRunningProcess(8081));\n\n if (isExpoMaybeRunningForProject) {\n Log.warn(\n 'The Expo CLI appears to be running this project in another terminal window. Close and restart any Expo CLI instances after the installation to complete the update.'\n );\n }\n\n // Safe to use current process to upgrade Expo package- doesn't affect current process\n try {\n await packageManager.addAsync([...packageManagerArguments, expoPackageToInstall]);\n } catch (error) {\n Log.error(\n chalk`Cannot install the latest Expo package. Install {bold expo@latest} with ${packageManager.name} and then run {bold npx expo install} again.`\n );\n throw error;\n }\n\n
|
|
1
|
+
{"version":3,"sources":["../../../src/install/installExpoPackage.ts"],"sourcesContent":["import * as PackageManager from '@expo/package-manager';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\n\nimport * as Log from '../log';\nimport { getRunningProcess } from '../utils/getRunningProcess';\n\n/**\n * Given a list of incompatible packages, installs the correct versions of the packages with the package manager used for the project.\n * This exits immediately after spawning the install command, since the command shouldn't remain running while it is being updated.\n */\nexport async function installExpoPackageAsync(\n projectRoot: string,\n {\n packageManager,\n packageManagerArguments,\n expoPackageToInstall,\n followUpCommandArgs,\n }: {\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n expoPackageToInstall: string;\n followUpCommandArgs: string[];\n }\n) {\n // Check if there's potentially a dev server running in the current folder and warn about it\n // (not guaranteed to be Expo CLI, and the CLI isn't always running on 8081, but it's a good guess)\n const isExpoMaybeRunningForProject = !!(await getRunningProcess(8081));\n\n if (isExpoMaybeRunningForProject) {\n Log.warn(\n 'The Expo CLI appears to be running this project in another terminal window. Close and restart any Expo CLI instances after the installation to complete the update.'\n );\n }\n\n // Safe to use current process to upgrade Expo package- doesn't affect current process\n try {\n await packageManager.addAsync([...packageManagerArguments, expoPackageToInstall]);\n } catch (error) {\n Log.error(\n chalk`Cannot install the latest Expo package. Install {bold expo@latest} with ${packageManager.name} and then run {bold npx expo install} again.`\n );\n throw error;\n }\n\n // Spawn a new process to install the rest of the packages if there are any, as only then will the latest Expo package be used\n if (followUpCommandArgs.length) {\n let commandSegments = ['expo', 'install', ...followUpCommandArgs];\n if (packageManagerArguments.length) {\n commandSegments = [...commandSegments, '--', ...packageManagerArguments];\n }\n\n Log.log(chalk`\\u203A Running {bold npx expo install} under the updated expo version`);\n Log.log('> ' + commandSegments.join(' '));\n\n await spawnAsync('npx', commandSegments, {\n stdio: 'inherit',\n cwd: projectRoot,\n env: { ...process.env },\n });\n }\n}\n"],"names":["installExpoPackageAsync","projectRoot","packageManager","packageManagerArguments","expoPackageToInstall","followUpCommandArgs","isExpoMaybeRunningForProject","getRunningProcess","Log","warn","addAsync","error","chalk","name","length","commandSegments","log","join","spawnAsync","stdio","cwd","env","process"],"mappings":"AAAA;;;;+BAWsBA,yBAAuB;;aAAvBA,uBAAuB;;;8DAVtB,mBAAmB;;;;;;;8DACxB,OAAO;;;;;;2DAEJ,QAAQ;mCACK,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMvD,eAAeA,uBAAuB,CAC3CC,WAAmB,EACnB,EACEC,cAAc,CAAA,EACdC,uBAAuB,CAAA,EACvBC,oBAAoB,CAAA,EACpBC,mBAAmB,CAAA,EAWpB,EACD;IACA,4FAA4F;IAC5F,mGAAmG;IACnG,MAAMC,4BAA4B,GAAG,CAAC,CAAE,MAAMC,IAAAA,kBAAiB,kBAAA,EAAC,IAAI,CAAC,AAAC,AAAC;IAEvE,IAAID,4BAA4B,EAAE;QAChCE,IAAG,CAACC,IAAI,CACN,qKAAqK,CACtK,CAAC;IACJ,CAAC;IAED,sFAAsF;IACtF,IAAI;QACF,MAAMP,cAAc,CAACQ,QAAQ,CAAC;eAAIP,uBAAuB;YAAEC,oBAAoB;SAAC,CAAC,CAAC;IACpF,EAAE,OAAOO,KAAK,EAAE;QACdH,IAAG,CAACG,KAAK,CACPC,IAAAA,MAAK,EAAA,QAAA,CAAA,CAAC,wEAAwE,EAAEV,cAAc,CAACW,IAAI,CAAC,4CAA4C,CAAC,CAClJ,CAAC;QACF,MAAMF,KAAK,CAAC;IACd,CAAC;IAED,8HAA8H;IAC9H,IAAIN,mBAAmB,CAACS,MAAM,EAAE;QAC9B,IAAIC,eAAe,GAAG;YAAC,MAAM;YAAE,SAAS;eAAKV,mBAAmB;SAAC,AAAC;QAClE,IAAIF,uBAAuB,CAACW,MAAM,EAAE;YAClCC,eAAe,GAAG;mBAAIA,eAAe;gBAAE,IAAI;mBAAKZ,uBAAuB;aAAC,CAAC;QAC3E,CAAC;QAEDK,IAAG,CAACQ,GAAG,CAACJ,IAAAA,MAAK,EAAA,QAAA,CAAA,CAAC,qEAAqE,CAAC,CAAC,CAAC;QACtFJ,IAAG,CAACQ,GAAG,CAAC,IAAI,GAAGD,eAAe,CAACE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAE1C,MAAMC,IAAAA,WAAU,EAAA,QAAA,EAAC,KAAK,EAAEH,eAAe,EAAE;YACvCI,KAAK,EAAE,SAAS;YAChBC,GAAG,EAAEnB,WAAW;YAChBoB,GAAG,EAAE;gBAAE,GAAGC,OAAO,CAACD,GAAG;aAAE;SACxB,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -524,7 +524,8 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
524
524
|
async singlePageReactServerComponentExportAsync(options, files, extraOptions = {}) {
|
|
525
525
|
// NOTE(EvanBacon): This will not support any code elimination since it's a static pass.
|
|
526
526
|
let { reactClientReferences: clientBoundaries , reactServerReferences: serverActionReferencesInServer , cssModules , } = await this.rscRenderer.getExpoRouterClientReferencesAsync({
|
|
527
|
-
platform: options.platform
|
|
527
|
+
platform: options.platform,
|
|
528
|
+
domRoot: options.domRoot
|
|
528
529
|
}, files);
|
|
529
530
|
// TODO: The output keys should be in production format or use a lookup manifest.
|
|
530
531
|
debug("Evaluated client boundaries:", clientBoundaries);
|