@expo/cli 0.14.0 → 0.16.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 +13 -5
- package/build/bin/cli.map +1 -1
- package/build/src/api/getVersions.js.map +1 -1
- package/build/src/api/rest/cache/response.js.map +1 -1
- package/build/src/api/rest/client.js +2 -2
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/api/user/actions.js +1 -1
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/customize/typescript.js +3 -1
- package/build/src/customize/typescript.js.map +1 -1
- package/build/src/export/createMetadataJson.js +5 -3
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +92 -18
- 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/embed/xcodeCompilerLogger.js +97 -0
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -0
- package/build/src/export/exportApp.js +106 -130
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +93 -38
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportAsync.js +1 -1
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/exportHermes.js +0 -90
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +165 -101
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +13 -5
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +84 -57
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/index.js +9 -7
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +101 -0
- package/build/src/export/metroAssetLocalPath.js.map +1 -0
- package/build/src/export/persistMetroAssets.js +115 -31
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/publicFolder.js +7 -0
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/resolveOptions.js +1 -1
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +168 -43
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/web/exportWebAsync.js +1 -1
- package/build/src/export/web/exportWebAsync.js.map +1 -1
- package/build/src/export/writeContents.js +8 -106
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/applyPlugins.js +52 -0
- package/build/src/install/applyPlugins.js.map +1 -0
- package/build/src/install/checkPackages.js +2 -2
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/fixPackages.js +84 -0
- package/build/src/install/fixPackages.js.map +1 -0
- package/build/src/install/installAsync.js +50 -60
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/installExpoPackage.js +79 -0
- package/build/src/install/installExpoPackage.js.map +1 -0
- package/build/src/prebuild/clearNativeFolder.js +1 -1
- package/build/src/prebuild/clearNativeFolder.js.map +1 -1
- package/build/src/prebuild/configureProjectAsync.js +3 -3
- package/build/src/prebuild/configureProjectAsync.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +21 -30
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +45 -16
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +2 -2
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +6 -6
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +49 -36
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/prebuild/validateTemplatePlatforms.js +2 -2
- package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
- package/build/src/run/hints.js +4 -0
- package/build/src/run/hints.js.map +1 -1
- package/build/src/run/index.js +101 -0
- package/build/src/run/index.js.map +1 -0
- package/build/src/start/doctor/dependencies/bundledNativeModules.js +2 -2
- package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +22 -7
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/resolvePackages.js +66 -0
- package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -0
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +22 -33
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +54 -19
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +14 -10
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +6 -1
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevToolsPluginManager.js +63 -0
- package/build/src/start/server/DevToolsPluginManager.js.map +1 -0
- package/build/src/start/server/getStaticRenderFunctions.js +25 -23
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +76 -69
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +6 -2
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +18 -1
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/bundleApiRoutes.js +5 -3
- package/build/src/start/server/metro/bundleApiRoutes.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +80 -46
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
- package/build/src/start/server/metro/createJResolver.js +152 -0
- package/build/src/start/server/metro/createJResolver.js.map +1 -0
- package/build/src/start/server/metro/createServerRouteMiddleware.js +15 -2
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/{inspector-proxy/device.js → debugging/InspectorDevice.js} +10 -38
- package/build/src/start/server/metro/debugging/InspectorDevice.js.map +1 -0
- package/build/src/start/server/metro/debugging/InspectorProxy.js +116 -0
- package/build/src/start/server/metro/debugging/InspectorProxy.js.map +1 -0
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +45 -0
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/NetworkResponse.js +3 -4
- package/build/src/start/server/metro/debugging/inspectorHandlers/NetworkResponse.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/PageReload.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerGetPossibleBreakpoints.js +5 -6
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerScriptParsed.js +3 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerScriptParsed.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerSetBreakpointByUrl.js +3 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerSetBreakpointByUrl.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeCallFunctionOn.js +24 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeCallFunctionOn.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeRuntimeGetProperties.js +5 -4
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeGetProperties.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/types.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js +20 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js.map +1 -0
- package/build/src/start/server/metro/externals.js +25 -3
- package/build/src/start/server/metro/externals.js.map +1 -1
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +40 -15
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +3 -2
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/router.js +5 -6
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +17 -27
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +59 -0
- package/build/src/start/server/metro/serializeHtml.js.map +1 -0
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +1 -2
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +237 -214
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js +114 -40
- package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +61 -0
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/ExpoMiddleware.js +2 -2
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +22 -66
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +23 -2
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js +30 -26
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js +7 -7
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js +5 -2
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js +3 -2
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js +8 -7
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +176 -0
- package/build/src/start/server/middleware/metroOptions.js.map +1 -0
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/route.test.js +11 -3
- package/build/src/start/server/type-generation/__typetests__/route.test.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +6 -4
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/utils/analytics/getMetroDebugProperties.js +1 -2
- package/build/src/utils/analytics/getMetroDebugProperties.js.map +1 -1
- package/build/src/utils/analytics/getMetroProperties.js +1 -2
- package/build/src/utils/analytics/getMetroProperties.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/args.js +4 -2
- package/build/src/utils/args.js.map +1 -1
- package/build/src/utils/cocoapods.js +1 -1
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/codesigning.js +11 -1
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/dir.js +18 -8
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/env.js +10 -1
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +2 -4
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/prompts.js +1 -28
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js +3 -11
- package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -1
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +22 -12
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -1
- package/package.json +19 -18
- package/static/shims/react-native-web/dist/cjs/exports/AppRegistry/AppContainer.js +13 -0
- package/static/shims/react-native-web/dist/exports/AppRegistry/AppContainer.js +12 -0
- package/static/template/index.html +14 -95
- package/build/src/export/printBundleSizes.js +0 -101
- package/build/src/export/printBundleSizes.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/device.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/NetworkResponse.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/PageReload.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerScriptParsed.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerSetBreakpointByUrl.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeGetProperties.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/types.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/index.js +0 -27
- package/build/src/start/server/metro/inspector-proxy/index.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/proxy.js +0 -169
- package/build/src/start/server/metro/inspector-proxy/proxy.js.map +0 -1
- package/build/src/start/server/metro/resolveFromProject.js +0 -90
- package/build/src/start/server/metro/resolveFromProject.js.map +0 -1
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +0 -64
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +0 -1
- /package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/PageReload.js +0 -0
- /package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/types.js +0 -0
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports.
|
|
5
|
+
exports.assetPatternsToBeBundled = assetPatternsToBeBundled;
|
|
6
|
+
exports.resolveAssetPatternsToBeBundled = resolveAssetPatternsToBeBundled;
|
|
6
7
|
exports.exportAssetsAsync = exportAssetsAsync;
|
|
7
|
-
exports.exportCssAssetsAsync = exportCssAssetsAsync;
|
|
8
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
9
9
|
var _minimatch = _interopRequireDefault(require("minimatch"));
|
|
10
10
|
var _path = _interopRequireDefault(require("path"));
|
|
11
|
-
var
|
|
11
|
+
var _persistMetroAssets = require("./persistMetroAssets");
|
|
12
12
|
var Log = _interopRequireWildcard(require("../log"));
|
|
13
13
|
var _resolveAssets = require("../start/server/middleware/resolveAssets");
|
|
14
14
|
var _array = require("../utils/array");
|
|
@@ -39,17 +39,39 @@ function _interopRequireWildcard(obj) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
const debug = require("debug")("expo:export:exportAssets");
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
function mapAssetHashToAssetString(asset, hash) {
|
|
43
|
+
return "asset_" + hash + ("type" in asset && asset.type ? "." + asset.type : "");
|
|
44
|
+
}
|
|
45
|
+
function assetPatternsToBeBundled(exp) {
|
|
46
|
+
var ref, ref1, ref2, ref3, ref4;
|
|
47
|
+
return (exp == null ? void 0 : (ref = exp.extra) == null ? void 0 : (ref1 = ref.updates) == null ? void 0 : (ref2 = ref1.assetPatternsToBeBundled) == null ? void 0 : ref2.length) ? exp == null ? void 0 : (ref3 = exp.extra) == null ? void 0 : (ref4 = ref3.updates) == null ? void 0 : ref4.assetPatternsToBeBundled : undefined;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Given an asset and a set of strings representing the assets to be bundled, returns true if
|
|
51
|
+
* the asset is part of the set to be bundled.
|
|
52
|
+
* @param asset Asset object
|
|
53
|
+
* @param bundledAssetsSet Set of strings
|
|
54
|
+
* @returns true if the asset should be bundled
|
|
55
|
+
*/ function assetShouldBeIncludedInExport(asset, bundledAssetsSet) {
|
|
56
|
+
if (!bundledAssetsSet) {
|
|
57
|
+
return true;
|
|
47
58
|
}
|
|
59
|
+
return asset.fileHashes.filter((hash)=>bundledAssetsSet.has(mapAssetHashToAssetString(asset, hash))
|
|
60
|
+
).length > 0;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Computes a set of strings representing the assets to be bundled with an export, given an array of assets,
|
|
64
|
+
* and a set of patterns to match
|
|
65
|
+
* @param assets The asset array
|
|
66
|
+
* @param assetPatternsToBeBundled An array of strings with glob patterns to match
|
|
67
|
+
* @param projectRoot The project root
|
|
68
|
+
* @returns A set of asset strings
|
|
69
|
+
*/ function setOfAssetsToBeBundled(assets, assetPatternsToBeBundled1, projectRoot) {
|
|
48
70
|
// Convert asset patterns to a list of asset strings that match them.
|
|
49
71
|
// Assets strings are formatted as `asset_<hash>.<type>` and represent
|
|
50
72
|
// the name that the file will have in the app bundle. The `asset_` prefix is
|
|
51
73
|
// needed because android doesn't support assets that start with numbers.
|
|
52
|
-
const fullPatterns =
|
|
74
|
+
const fullPatterns = assetPatternsToBeBundled1.map((p)=>_path.default.join(projectRoot, p)
|
|
53
75
|
);
|
|
54
76
|
logPatterns(fullPatterns);
|
|
55
77
|
const allBundledAssets = assets.map((asset)=>{
|
|
@@ -57,18 +79,24 @@ async function resolveAssetBundlePatternsAsync(projectRoot, exp, assets) {
|
|
|
57
79
|
if (shouldBundle) {
|
|
58
80
|
var ref;
|
|
59
81
|
debug(`${shouldBundle ? "Include" : "Exclude"} asset ${(ref = asset.files) == null ? void 0 : ref[0]}`);
|
|
60
|
-
return asset.fileHashes.map((hash)=>
|
|
82
|
+
return asset.fileHashes.map((hash)=>mapAssetHashToAssetString(asset, hash)
|
|
61
83
|
);
|
|
62
84
|
}
|
|
63
85
|
return [];
|
|
64
86
|
}).flat();
|
|
65
87
|
// The assets returned by the RN packager has duplicates so make sure we
|
|
66
88
|
// only bundle each once.
|
|
67
|
-
(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
89
|
+
return new Set(allBundledAssets);
|
|
90
|
+
}
|
|
91
|
+
function resolveAssetPatternsToBeBundled(projectRoot, exp, assets) {
|
|
92
|
+
if (!assetPatternsToBeBundled(exp)) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
var ref;
|
|
96
|
+
const bundledAssets = setOfAssetsToBeBundled(assets, (ref = assetPatternsToBeBundled(exp)) != null ? ref : [
|
|
97
|
+
"**/*"
|
|
98
|
+
], projectRoot);
|
|
99
|
+
return bundledAssets;
|
|
72
100
|
}
|
|
73
101
|
function logPatterns(patterns) {
|
|
74
102
|
// Only log the patterns in debug mode, if they aren't already defined in the app.json, then all files will be targeted.
|
|
@@ -82,41 +110,68 @@ function shouldBundleAsset(asset, patterns) {
|
|
|
82
110
|
return !!("__packager_asset" in asset && asset.__packager_asset && file && patterns.some((pattern)=>(0, _minimatch).default(file, pattern)
|
|
83
111
|
));
|
|
84
112
|
}
|
|
85
|
-
async function exportAssetsAsync(projectRoot, { exp , outputDir , bundles }) {
|
|
113
|
+
async function exportAssetsAsync(projectRoot, { exp , outputDir , bundles: { web , ...bundles } , baseUrl , files =new Map() }) {
|
|
86
114
|
var ref;
|
|
115
|
+
// NOTE: We use a different system for static web
|
|
116
|
+
if (web) {
|
|
117
|
+
// Save assets like a typical bundler, preserving the file paths on web.
|
|
118
|
+
// TODO: Update React Native Web to support loading files from asset hashes.
|
|
119
|
+
await (0, _persistMetroAssets).persistMetroAssetsAsync(web.assets, {
|
|
120
|
+
files,
|
|
121
|
+
platform: "web",
|
|
122
|
+
outputDirectory: outputDir,
|
|
123
|
+
baseUrl
|
|
124
|
+
});
|
|
125
|
+
}
|
|
87
126
|
const assets = (0, _array).uniqBy(Object.values(bundles).flatMap((bundle)=>bundle.assets
|
|
88
127
|
), (asset)=>asset.hash
|
|
89
128
|
);
|
|
129
|
+
let bundledAssetsSet = undefined;
|
|
130
|
+
let filteredAssets = assets;
|
|
131
|
+
const embeddedHashSet = new Set();
|
|
90
132
|
if ((ref = assets[0]) == null ? void 0 : ref.fileHashes) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
133
|
+
debug(`Assets = ${JSON.stringify(assets, null, 2)}`);
|
|
134
|
+
// Updates the manifest to reflect additional asset bundling + configs
|
|
135
|
+
// Get only asset strings for assets we will save
|
|
136
|
+
bundledAssetsSet = resolveAssetPatternsToBeBundled(projectRoot, exp, assets);
|
|
137
|
+
if (bundledAssetsSet) {
|
|
138
|
+
debug(`Bundled assets = ${JSON.stringify([
|
|
139
|
+
...bundledAssetsSet
|
|
140
|
+
], null, 2)}`);
|
|
141
|
+
// Filter asset objects to only ones that include assetPatternsToBeBundled matches
|
|
142
|
+
filteredAssets = assets.filter((asset)=>{
|
|
143
|
+
const shouldInclude = assetShouldBeIncludedInExport(asset, bundledAssetsSet);
|
|
144
|
+
if (!shouldInclude) {
|
|
145
|
+
embeddedHashSet.add(asset.hash);
|
|
146
|
+
}
|
|
147
|
+
return shouldInclude;
|
|
148
|
+
});
|
|
149
|
+
debug(`Filtered assets count = ${filteredAssets.length}`);
|
|
150
|
+
}
|
|
151
|
+
const hashes = new Set();
|
|
152
|
+
// Add assets to copy.
|
|
153
|
+
filteredAssets.forEach((asset)=>{
|
|
154
|
+
const assetId = "fileSystemLocation" in asset ? _path.default.relative(projectRoot, _path.default.join(asset.fileSystemLocation, asset.name)) + (asset.type ? "." + asset.type : "") : undefined;
|
|
155
|
+
asset.files.forEach((fp, index)=>{
|
|
156
|
+
const hash = asset.fileHashes[index];
|
|
157
|
+
if (hashes.has(hash)) return;
|
|
158
|
+
hashes.add(hash);
|
|
159
|
+
files.set(_path.default.join("assets", hash), {
|
|
160
|
+
originFilename: _path.default.relative(projectRoot, fp),
|
|
161
|
+
contents: _fs.default.readFileSync(fp),
|
|
162
|
+
assetId
|
|
163
|
+
});
|
|
164
|
+
});
|
|
95
165
|
});
|
|
96
166
|
}
|
|
97
167
|
// Add google services file if it exists
|
|
98
168
|
await (0, _resolveAssets).resolveGoogleServicesFile(projectRoot, exp);
|
|
99
|
-
// Updates the manifest to reflect additional asset bundling + configs
|
|
100
|
-
await resolveAssetBundlePatternsAsync(projectRoot, exp, assets);
|
|
101
169
|
return {
|
|
102
170
|
exp,
|
|
103
|
-
assets
|
|
171
|
+
assets,
|
|
172
|
+
embeddedHashSet,
|
|
173
|
+
files
|
|
104
174
|
};
|
|
105
175
|
}
|
|
106
|
-
async function exportCssAssetsAsync({ outputDir , bundles , basePath }) {
|
|
107
|
-
var ref;
|
|
108
|
-
const assets = (0, _array).uniqBy(Object.values(bundles).flatMap((bundle)=>bundle.css
|
|
109
|
-
), (asset)=>asset.filename
|
|
110
|
-
);
|
|
111
|
-
const cssDirectory = (ref = assets[0]) == null ? void 0 : ref.filename;
|
|
112
|
-
if (!cssDirectory) return [];
|
|
113
|
-
await _fs.default.promises.mkdir(_path.default.join(outputDir, _path.default.dirname(cssDirectory)), {
|
|
114
|
-
recursive: true
|
|
115
|
-
});
|
|
116
|
-
await Promise.all(assets.map((v)=>_fs.default.promises.writeFile(_path.default.join(outputDir, v.filename), v.source)
|
|
117
|
-
));
|
|
118
|
-
return assets.map((v)=>basePath + "/" + v.filename
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
176
|
|
|
122
177
|
//# sourceMappingURL=exportAssets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportAssets.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport fs from 'fs';\nimport minimatch from 'minimatch';\nimport path from 'path';\n\nimport { BundleOutput } from './fork-bundleAsync';\nimport { Asset, saveAssetsAsync } from './saveAssets';\nimport * as Log from '../log';\nimport { resolveGoogleServicesFile } from '../start/server/middleware/resolveAssets';\nimport { uniqBy } from '../utils/array';\n\nconst debug = require('debug')('expo:export:exportAssets') as typeof console.log;\n\n/**\n * Resolves the assetBundlePatterns from the manifest and returns a list of assets to bundle.\n *\n * @modifies {exp}\n */\nexport async function resolveAssetBundlePatternsAsync<T extends ExpoConfig>(\n projectRoot: string,\n exp: T,\n assets: Asset[]\n): Promise<Omit<T, 'assetBundlePatterns'> & { bundledAssets?: string[] }> {\n if (!exp.assetBundlePatterns?.length || !assets.length) {\n delete exp.assetBundlePatterns;\n return exp;\n }\n // Convert asset patterns to a list of asset strings that match them.\n // Assets strings are formatted as `asset_<hash>.<type>` and represent\n // the name that the file will have in the app bundle. The `asset_` prefix is\n // needed because android doesn't support assets that start with numbers.\n\n const fullPatterns: string[] = exp.assetBundlePatterns.map((p: string) =>\n path.join(projectRoot, p)\n );\n\n logPatterns(fullPatterns);\n\n const allBundledAssets = assets\n .map((asset) => {\n const shouldBundle = shouldBundleAsset(asset, fullPatterns);\n if (shouldBundle) {\n debug(`${shouldBundle ? 'Include' : 'Exclude'} asset ${asset.files?.[0]}`);\n return asset.fileHashes.map(\n (hash) => 'asset_' + hash + ('type' in asset && asset.type ? '.' + asset.type : '')\n );\n }\n return [];\n })\n .flat();\n\n // The assets returned by the RN packager has duplicates so make sure we\n // only bundle each once.\n (exp as any).bundledAssets = [...new Set(allBundledAssets)];\n delete exp.assetBundlePatterns;\n\n return exp;\n}\n\nfunction logPatterns(patterns: string[]) {\n // Only log the patterns in debug mode, if they aren't already defined in the app.json, then all files will be targeted.\n Log.log('\\nProcessing asset bundle patterns:');\n patterns.forEach((p) => Log.log('- ' + p));\n}\n\nfunction shouldBundleAsset(asset: Asset, patterns: string[]) {\n const file = asset.files?.[0];\n return !!(\n '__packager_asset' in asset &&\n asset.__packager_asset &&\n file &&\n patterns.some((pattern) => minimatch(file, pattern))\n );\n}\n\nexport async function exportAssetsAsync(\n projectRoot: string,\n {\n exp,\n outputDir,\n bundles,\n }: {\n exp: ExpoConfig;\n bundles: Partial<Record<ModPlatform, BundleOutput>>;\n outputDir: string;\n }\n) {\n const assets: Asset[] = uniqBy(\n Object.values(bundles).flatMap((bundle) => bundle!.assets),\n (asset) => asset.hash\n );\n\n if (assets[0]?.fileHashes) {\n Log.log('Saving assets');\n await saveAssetsAsync(projectRoot, { assets, outputDir });\n }\n\n // Add google services file if it exists\n await resolveGoogleServicesFile(projectRoot, exp);\n\n // Updates the manifest to reflect additional asset bundling + configs\n await resolveAssetBundlePatternsAsync(projectRoot, exp, assets);\n\n return { exp, assets };\n}\n\nexport async function exportCssAssetsAsync({\n outputDir,\n bundles,\n basePath,\n}: {\n bundles: Partial<Record<ModPlatform, BundleOutput>>;\n outputDir: string;\n basePath: string;\n}) {\n const assets = uniqBy(\n Object.values(bundles).flatMap((bundle) => bundle!.css),\n (asset) => asset.filename\n );\n\n const cssDirectory = assets[0]?.filename;\n if (!cssDirectory) return [];\n\n await fs.promises.mkdir(path.join(outputDir, path.dirname(cssDirectory)), { recursive: true });\n\n await Promise.all(\n assets.map((v) => fs.promises.writeFile(path.join(outputDir, v.filename), v.source))\n );\n\n return assets.map((v) => basePath + '/' + v.filename);\n}\n"],"names":["resolveAssetBundlePatternsAsync","exportAssetsAsync","exportCssAssetsAsync","Log","debug","require","projectRoot","exp","assets","assetBundlePatterns","length","fullPatterns","map","p","path","join","logPatterns","allBundledAssets","asset","shouldBundle","shouldBundleAsset","files","fileHashes","hash","type","flat","bundledAssets","Set","patterns","log","forEach","file","__packager_asset","some","pattern","minimatch","outputDir","bundles","uniqBy","Object","values","flatMap","bundle","saveAssetsAsync","resolveGoogleServicesFile","basePath","css","filename","cssDirectory","fs","promises","mkdir","dirname","recursive","Promise","all","v","writeFile","source"],"mappings":"AAAA;;;;QAmBsBA,+BAA+B,GAA/BA,+BAA+B;QAyD/BC,iBAAiB,GAAjBA,iBAAiB;QA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M,CAACH,OAAO,CAAC,CAACI,OAAO,CAAC,CAACC,MAAM,GAAKA,MAAM,CAAEI,GAAG;IAAA,CAAC,EACvD,CAAC5B,KAAK,GAAKA,KAAK,CAAC6B,QAAQ;IAAA,CAC1B,AAAC;IAEF,MAAMC,YAAY,GAAGxC,CAAAA,GAAS,GAATA,MAAM,CAAC,CAAC,CAAC,SAAU,GAAnBA,KAAAA,CAAmB,GAAnBA,GAAS,CAAEuC,QAAQ,AAAC;IACzC,IAAI,CAACC,YAAY,EAAE,OAAO,EAAE,CAAC;IAE7B,MAAMC,GAAE,QAAA,CAACC,QAAQ,CAACC,KAAK,CAACrC,KAAI,QAAA,CAACC,IAAI,CAACqB,SAAS,EAAEtB,KAAI,QAAA,CAACsC,OAAO,CAACJ,YAAY,CAAC,CAAC,EAAE;QAAEK,SAAS,EAAE,IAAI;KAAE,CAAC,CAAC;IAE/F,MAAMC,OAAO,CAACC,GAAG,CACf/C,MAAM,CAACI,GAAG,CAAC,CAAC4C,CAAC,GAAKP,GAAE,QAAA,CAACC,QAAQ,CAACO,SAAS,CAAC3C,KAAI,QAAA,CAACC,IAAI,CAACqB,SAAS,EAAEoB,CAAC,CAACT,QAAQ,CAAC,EAAES,CAAC,CAACE,MAAM,CAAC;IAAA,CAAC,CACrF,CAAC;IAEF,OAAOlD,MAAM,CAACI,GAAG,CAAC,CAAC4C,CAAC,GAAKX,QAAQ,GAAG,GAAG,GAAGW,CAAC,CAACT,QAAQ;IAAA,CAAC,CAAC;CACvD"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportAssets.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport fs from 'fs';\nimport minimatch from 'minimatch';\nimport path from 'path';\n\nimport { BundleOutput } from './fork-bundleAsync';\nimport { persistMetroAssetsAsync } from './persistMetroAssets';\nimport { Asset, ExportAssetMap } from './saveAssets';\nimport * as Log from '../log';\nimport { resolveGoogleServicesFile } from '../start/server/middleware/resolveAssets';\nimport { uniqBy } from '../utils/array';\n\nconst debug = require('debug')('expo:export:exportAssets') as typeof console.log;\n\nfunction mapAssetHashToAssetString(asset: Asset, hash: string) {\n return 'asset_' + hash + ('type' in asset && asset.type ? '.' + asset.type : '');\n}\n\nexport function assetPatternsToBeBundled(\n exp: ExpoConfig & { extra?: { updates?: { assetPatternsToBeBundled?: string[] } } }\n): string[] | undefined {\n return exp?.extra?.updates?.assetPatternsToBeBundled?.length\n ? exp?.extra?.updates?.assetPatternsToBeBundled\n : undefined;\n}\n\n/**\n * Given an asset and a set of strings representing the assets to be bundled, returns true if\n * the asset is part of the set to be bundled.\n * @param asset Asset object\n * @param bundledAssetsSet Set of strings\n * @returns true if the asset should be bundled\n */\nfunction assetShouldBeIncludedInExport(asset: Asset, bundledAssetsSet: Set<string> | undefined) {\n if (!bundledAssetsSet) {\n return true;\n }\n return (\n asset.fileHashes.filter((hash) => bundledAssetsSet.has(mapAssetHashToAssetString(asset, hash)))\n .length > 0\n );\n}\n\n/**\n * Computes a set of strings representing the assets to be bundled with an export, given an array of assets,\n * and a set of patterns to match\n * @param assets The asset array\n * @param assetPatternsToBeBundled An array of strings with glob patterns to match\n * @param projectRoot The project root\n * @returns A set of asset strings\n */\nfunction setOfAssetsToBeBundled(\n assets: Asset[],\n assetPatternsToBeBundled: string[],\n projectRoot: string\n): Set<string> | undefined {\n // Convert asset patterns to a list of asset strings that match them.\n // Assets strings are formatted as `asset_<hash>.<type>` and represent\n // the name that the file will have in the app bundle. The `asset_` prefix is\n // needed because android doesn't support assets that start with numbers.\n\n const fullPatterns: string[] = assetPatternsToBeBundled.map((p: string) =>\n path.join(projectRoot, p)\n );\n\n logPatterns(fullPatterns);\n\n const allBundledAssets = assets\n .map((asset) => {\n const shouldBundle = shouldBundleAsset(asset, fullPatterns);\n if (shouldBundle) {\n debug(`${shouldBundle ? 'Include' : 'Exclude'} asset ${asset.files?.[0]}`);\n return asset.fileHashes.map((hash) => mapAssetHashToAssetString(asset, hash));\n }\n return [];\n })\n .flat();\n\n // The assets returned by the RN packager has duplicates so make sure we\n // only bundle each once.\n return new Set(allBundledAssets);\n}\n\n/**\n * Resolves the assetBundlePatterns from the manifest and returns the set of assets to bundle.\n *\n * @modifies {exp}\n */\nexport function resolveAssetPatternsToBeBundled<T extends ExpoConfig>(\n projectRoot: string,\n exp: T,\n assets: Asset[]\n): Set<string> | undefined {\n if (!assetPatternsToBeBundled(exp)) {\n return undefined;\n }\n const bundledAssets = setOfAssetsToBeBundled(\n assets,\n assetPatternsToBeBundled(exp) ?? ['**/*'],\n projectRoot\n );\n return bundledAssets;\n}\n\nfunction logPatterns(patterns: string[]) {\n // Only log the patterns in debug mode, if they aren't already defined in the app.json, then all files will be targeted.\n Log.log('\\nProcessing asset bundle patterns:');\n patterns.forEach((p) => Log.log('- ' + p));\n}\n\nfunction shouldBundleAsset(asset: Asset, patterns: string[]) {\n const file = asset.files?.[0];\n return !!(\n '__packager_asset' in asset &&\n asset.__packager_asset &&\n file &&\n patterns.some((pattern) => minimatch(file, pattern))\n );\n}\n\nexport async function exportAssetsAsync(\n projectRoot: string,\n {\n exp,\n outputDir,\n bundles: { web, ...bundles },\n baseUrl,\n files = new Map(),\n }: {\n exp: ExpoConfig;\n bundles: Partial<Record<string, BundleOutput>>;\n outputDir: string;\n baseUrl: string;\n files?: ExportAssetMap;\n }\n) {\n // NOTE: We use a different system for static web\n if (web) {\n // Save assets like a typical bundler, preserving the file paths on web.\n // TODO: Update React Native Web to support loading files from asset hashes.\n await persistMetroAssetsAsync(web.assets, {\n files,\n platform: 'web',\n outputDirectory: outputDir,\n baseUrl,\n });\n }\n\n const assets: Asset[] = uniqBy(\n Object.values(bundles).flatMap((bundle) => bundle!.assets),\n (asset) => asset.hash\n );\n\n let bundledAssetsSet: Set<string> | undefined = undefined;\n let filteredAssets = assets;\n const embeddedHashSet: Set<string> = new Set();\n\n if (assets[0]?.fileHashes) {\n debug(`Assets = ${JSON.stringify(assets, null, 2)}`);\n // Updates the manifest to reflect additional asset bundling + configs\n // Get only asset strings for assets we will save\n bundledAssetsSet = resolveAssetPatternsToBeBundled(projectRoot, exp, assets);\n if (bundledAssetsSet) {\n debug(`Bundled assets = ${JSON.stringify([...bundledAssetsSet], null, 2)}`);\n // Filter asset objects to only ones that include assetPatternsToBeBundled matches\n filteredAssets = assets.filter((asset) => {\n const shouldInclude = assetShouldBeIncludedInExport(asset, bundledAssetsSet);\n if (!shouldInclude) {\n embeddedHashSet.add(asset.hash);\n }\n return shouldInclude;\n });\n debug(`Filtered assets count = ${filteredAssets.length}`);\n }\n\n const hashes = new Set<string>();\n\n // Add assets to copy.\n filteredAssets.forEach((asset) => {\n const assetId =\n 'fileSystemLocation' in asset\n ? path.relative(projectRoot, path.join(asset.fileSystemLocation, asset.name)) +\n (asset.type ? '.' + asset.type : '')\n : undefined;\n\n asset.files.forEach((fp: string, index: number) => {\n const hash = asset.fileHashes[index];\n if (hashes.has(hash)) return;\n hashes.add(hash);\n files.set(path.join('assets', hash), {\n originFilename: path.relative(projectRoot, fp),\n contents: fs.readFileSync(fp),\n assetId,\n });\n });\n });\n }\n\n // Add google services file if it exists\n await resolveGoogleServicesFile(projectRoot, exp);\n\n return { exp, assets, embeddedHashSet, files };\n}\n"],"names":["assetPatternsToBeBundled","resolveAssetPatternsToBeBundled","exportAssetsAsync","Log","debug","require","mapAssetHashToAssetString","asset","hash","type","exp","extra","updates","length","undefined","assetShouldBeIncludedInExport","bundledAssetsSet","fileHashes","filter","has","setOfAssetsToBeBundled","assets","projectRoot","fullPatterns","map","p","path","join","logPatterns","allBundledAssets","shouldBundle","shouldBundleAsset","files","flat","Set","bundledAssets","patterns","log","forEach","file","__packager_asset","some","pattern","minimatch","outputDir","bundles","web","baseUrl","Map","persistMetroAssetsAsync","platform","outputDirectory","uniqBy","Object","values","flatMap","bundle","filteredAssets","embeddedHashSet","JSON","stringify","shouldInclude","add","hashes","assetId","relative","fileSystemLocation","name","fp","index","set","originFilename","contents","fs","readFileSync","resolveGoogleServicesFile"],"mappings":"A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D,MAAM,CAACD,GAAG,CAACtD,IAAI,CAAC,CAAC;gBACjBwB,KAAK,CAACsC,GAAG,CAAC5C,KAAI,QAAA,CAACC,IAAI,CAAC,QAAQ,EAAEnB,IAAI,CAAC,EAAE;oBACnC+D,cAAc,EAAE7C,KAAI,QAAA,CAACuC,QAAQ,CAAC3C,WAAW,EAAE8C,EAAE,CAAC;oBAC9CI,QAAQ,EAAEC,GAAE,QAAA,CAACC,YAAY,CAACN,EAAE,CAAC;oBAC7BJ,OAAO;iBACR,CAAC,CAAC;aACJ,CAAC,CAAC;SACJ,CAAC,CAAC;KACJ;IAED,wCAAwC;IACxC,MAAMW,CAAAA,GAAAA,cAAyB,AAAkB,CAAA,0BAAlB,CAACrD,WAAW,EAAEZ,GAAG,CAAC,CAAC;IAElD,OAAO;QAAEA,GAAG;QAAEW,MAAM;QAAEqC,eAAe;QAAE1B,KAAK;KAAE,CAAC;CAChD"}
|
|
@@ -46,7 +46,7 @@ async function exportAsync(projectRoot, options) {
|
|
|
46
46
|
// Stop any file watchers to prevent the CLI from hanging.
|
|
47
47
|
_fileNotifier.FileNotifier.stopAll();
|
|
48
48
|
// Final notes
|
|
49
|
-
Log.log(`
|
|
49
|
+
Log.log(`App exported to: ${options.outputDir}`);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
//# sourceMappingURL=exportAsync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportAsync.ts"],"sourcesContent":["import path from 'path';\n\nimport { exportAppAsync } from './exportApp';\nimport { Options } from './resolveOptions';\nimport * as Log from '../log';\nimport { FileNotifier } from '../utils/FileNotifier';\nimport { ensureDirectoryAsync, removeAsync } from '../utils/dir';\n\nexport async function exportAsync(projectRoot: string, options: Options) {\n // Ensure the output directory is created\n const outputPath = path.resolve(projectRoot, options.outputDir);\n // Delete the output directory if it exists\n await removeAsync(outputPath);\n // Create the output directory\n await ensureDirectoryAsync(outputPath);\n\n // Export the app\n await exportAppAsync(projectRoot, options);\n\n // Stop any file watchers to prevent the CLI from hanging.\n FileNotifier.stopAll();\n\n // Final notes\n Log.log(`
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportAsync.ts"],"sourcesContent":["import path from 'path';\n\nimport { exportAppAsync } from './exportApp';\nimport { Options } from './resolveOptions';\nimport * as Log from '../log';\nimport { FileNotifier } from '../utils/FileNotifier';\nimport { ensureDirectoryAsync, removeAsync } from '../utils/dir';\n\nexport async function exportAsync(projectRoot: string, options: Options) {\n // Ensure the output directory is created\n const outputPath = path.resolve(projectRoot, options.outputDir);\n // Delete the output directory if it exists\n await removeAsync(outputPath);\n // Create the output directory\n await ensureDirectoryAsync(outputPath);\n\n // Export the app\n await exportAppAsync(projectRoot, options);\n\n // Stop any file watchers to prevent the CLI from hanging.\n FileNotifier.stopAll();\n\n // Final notes\n Log.log(`App exported to: ${options.outputDir}`);\n}\n"],"names":["exportAsync","Log","projectRoot","options","outputPath","path","resolve","outputDir","removeAsync","ensureDirectoryAsync","exportAppAsync","FileNotifier","stopAll","log"],"mappings":"AAAA;;;;QAQsBA,WAAW,GAAXA,WAAW;AARhB,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEQ,IAAA,UAAa,WAAb,aAAa,CAAA;AAEhCC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACc,IAAA,aAAuB,WAAvB,uBAAuB,CAAA;AACF,IAAA,IAAc,WAAd,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzD,eAAeD,WAAW,CAACE,WAAmB,EAAEC,OAAgB,EAAE;IACvE,yCAAyC;IACzC,MAAMC,UAAU,GAAGC,KAAI,QAAA,CAACC,OAAO,CAACJ,WAAW,EAAEC,OAAO,CAACI,SAAS,CAAC,AAAC;IAChE,2CAA2C;IAC3C,MAAMC,CAAAA,GAAAA,IAAW,AAAY,CAAA,YAAZ,CAACJ,UAAU,CAAC,CAAC;IAC9B,8BAA8B;IAC9B,MAAMK,CAAAA,GAAAA,IAAoB,AAAY,CAAA,qBAAZ,CAACL,UAAU,CAAC,CAAC;IAEvC,iBAAiB;IACjB,MAAMM,CAAAA,GAAAA,UAAc,AAAsB,CAAA,eAAtB,CAACR,WAAW,EAAEC,OAAO,CAAC,CAAC;IAE3C,0DAA0D;IAC1DQ,aAAY,aAAA,CAACC,OAAO,EAAE,CAAC;IAEvB,cAAc;IACdX,GAAG,CAACY,GAAG,CAAC,CAAC,iBAAiB,EAAEV,OAAO,CAACI,SAAS,CAAC,CAAC,CAAC,CAAC;CAClD"}
|
|
@@ -2,58 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports.importHermesCommandFromProject = importHermesCommandFromProject;
|
|
6
5
|
exports.isEnableHermesManaged = isEnableHermesManaged;
|
|
7
|
-
exports.buildHermesBundleAsync = buildHermesBundleAsync;
|
|
8
|
-
exports.createHermesSourcemapAsync = createHermesSourcemapAsync;
|
|
9
6
|
exports.parseGradleProperties = parseGradleProperties;
|
|
10
7
|
exports.maybeThrowFromInconsistentEngineAsync = maybeThrowFromInconsistentEngineAsync;
|
|
11
8
|
exports.maybeInconsistentEngineAndroidAsync = maybeInconsistentEngineAndroidAsync;
|
|
12
9
|
exports.maybeInconsistentEngineIosAsync = maybeInconsistentEngineIosAsync;
|
|
13
10
|
exports.isHermesBytecodeBundleAsync = isHermesBytecodeBundleAsync;
|
|
14
11
|
exports.getHermesBytecodeBundleVersionAsync = getHermesBytecodeBundleVersionAsync;
|
|
15
|
-
var _spawnAsync = _interopRequireDefault(require("@expo/spawn-async"));
|
|
16
12
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
17
|
-
var _os = _interopRequireDefault(require("os"));
|
|
18
13
|
var _path = _interopRequireDefault(require("path"));
|
|
19
|
-
var _process = _interopRequireDefault(require("process"));
|
|
20
|
-
var _resolveFromProject = require("../start/server/metro/resolveFromProject");
|
|
21
14
|
function _interopRequireDefault(obj) {
|
|
22
15
|
return obj && obj.__esModule ? obj : {
|
|
23
16
|
default: obj
|
|
24
17
|
};
|
|
25
18
|
}
|
|
26
|
-
function importHermesCommandFromProject(projectRoot) {
|
|
27
|
-
const platformExecutable = getHermesCommandPlatform();
|
|
28
|
-
const hermescLocations = [
|
|
29
|
-
// Override hermesc dir by environment variables
|
|
30
|
-
_process.default.env["REACT_NATIVE_OVERRIDE_HERMES_DIR"] ? `${_process.default.env["REACT_NATIVE_OVERRIDE_HERMES_DIR"]}/build/bin/hermesc` : "",
|
|
31
|
-
// Building hermes from source
|
|
32
|
-
"react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc",
|
|
33
|
-
// Prebuilt hermesc in official react-native 0.69+
|
|
34
|
-
`react-native/sdks/hermesc/${platformExecutable}`,
|
|
35
|
-
// Legacy hermes-engine package
|
|
36
|
-
`hermes-engine/${platformExecutable}`,
|
|
37
|
-
];
|
|
38
|
-
for (const location of hermescLocations){
|
|
39
|
-
try {
|
|
40
|
-
return (0, _resolveFromProject).resolveFromProject(projectRoot, location);
|
|
41
|
-
} catch {}
|
|
42
|
-
}
|
|
43
|
-
throw new Error("Cannot find the hermesc executable.");
|
|
44
|
-
}
|
|
45
|
-
function getHermesCommandPlatform() {
|
|
46
|
-
switch(_os.default.platform()){
|
|
47
|
-
case "darwin":
|
|
48
|
-
return "osx-bin/hermesc";
|
|
49
|
-
case "linux":
|
|
50
|
-
return "linux64-bin/hermesc";
|
|
51
|
-
case "win32":
|
|
52
|
-
return "win64-bin/hermesc.exe";
|
|
53
|
-
default:
|
|
54
|
-
throw new Error(`Unsupported host platform for Hermes compiler: ${_os.default.platform()}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
19
|
function isEnableHermesManaged(expoConfig, platform) {
|
|
58
20
|
switch(platform){
|
|
59
21
|
case "android":
|
|
@@ -72,58 +34,6 @@ function isEnableHermesManaged(expoConfig, platform) {
|
|
|
72
34
|
return false;
|
|
73
35
|
}
|
|
74
36
|
}
|
|
75
|
-
async function buildHermesBundleAsync(projectRoot, { code , map , minify =false }) {
|
|
76
|
-
const tempDir = _path.default.join(_os.default.tmpdir(), `expo-bundler-${_process.default.pid}`);
|
|
77
|
-
await _fsExtra.default.ensureDir(tempDir);
|
|
78
|
-
try {
|
|
79
|
-
const tempBundleFile = _path.default.join(tempDir, "index.bundle");
|
|
80
|
-
await _fsExtra.default.writeFile(tempBundleFile, code);
|
|
81
|
-
if (map) {
|
|
82
|
-
const tempSourcemapFile = _path.default.join(tempDir, "index.bundle.map");
|
|
83
|
-
await _fsExtra.default.writeFile(tempSourcemapFile, map);
|
|
84
|
-
}
|
|
85
|
-
const tempHbcFile = _path.default.join(tempDir, "index.hbc");
|
|
86
|
-
const hermesCommand = importHermesCommandFromProject(projectRoot);
|
|
87
|
-
const args = [
|
|
88
|
-
"-emit-binary",
|
|
89
|
-
"-out",
|
|
90
|
-
tempHbcFile,
|
|
91
|
-
tempBundleFile
|
|
92
|
-
];
|
|
93
|
-
if (minify) {
|
|
94
|
-
args.push("-O");
|
|
95
|
-
}
|
|
96
|
-
if (map) {
|
|
97
|
-
args.push("-output-source-map");
|
|
98
|
-
}
|
|
99
|
-
await (0, _spawnAsync).default(hermesCommand, args);
|
|
100
|
-
let hbc;
|
|
101
|
-
let sourcemap = null;
|
|
102
|
-
if (!map) {
|
|
103
|
-
hbc = await _fsExtra.default.readFile(tempHbcFile);
|
|
104
|
-
} else {
|
|
105
|
-
[hbc, sourcemap] = await Promise.all([
|
|
106
|
-
_fsExtra.default.readFile(tempHbcFile),
|
|
107
|
-
createHermesSourcemapAsync(projectRoot, map, `${tempHbcFile}.map`),
|
|
108
|
-
]);
|
|
109
|
-
}
|
|
110
|
-
return {
|
|
111
|
-
hbc,
|
|
112
|
-
sourcemap
|
|
113
|
-
};
|
|
114
|
-
} finally{
|
|
115
|
-
await _fsExtra.default.remove(tempDir);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
async function createHermesSourcemapAsync(projectRoot, sourcemap, hermesMapFile) {
|
|
119
|
-
const composeSourceMaps = (0, _resolveFromProject).importMetroSourceMapComposeSourceMapsFromProject(projectRoot);
|
|
120
|
-
const bundlerSourcemap = JSON.parse(sourcemap);
|
|
121
|
-
const hermesSourcemap = await _fsExtra.default.readJSON(hermesMapFile);
|
|
122
|
-
return JSON.stringify(composeSourceMaps([
|
|
123
|
-
bundlerSourcemap,
|
|
124
|
-
hermesSourcemap
|
|
125
|
-
]));
|
|
126
|
-
}
|
|
127
37
|
function parseGradleProperties(content) {
|
|
128
38
|
const result = {};
|
|
129
39
|
for (let line of content.split("\n")){
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportHermes.ts"],"sourcesContent":["import type { ExpoConfig, Platform } from '@expo/config';\nimport spawnAsync from '@expo/spawn-async';\nimport fs from 'fs-extra';\nimport os from 'os';\nimport path from 'path';\nimport process from 'process';\n\nimport {\n importMetroSourceMapComposeSourceMapsFromProject,\n resolveFromProject,\n} from '../start/server/metro/resolveFromProject';\n\nexport function importHermesCommandFromProject(projectRoot: string): string {\n const platformExecutable = getHermesCommandPlatform();\n const hermescLocations = [\n // Override hermesc dir by environment variables\n process.env['REACT_NATIVE_OVERRIDE_HERMES_DIR']\n ? `${process.env['REACT_NATIVE_OVERRIDE_HERMES_DIR']}/build/bin/hermesc`\n : '',\n\n // Building hermes from source\n 'react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc',\n\n // Prebuilt hermesc in official react-native 0.69+\n `react-native/sdks/hermesc/${platformExecutable}`,\n\n // Legacy hermes-engine package\n `hermes-engine/${platformExecutable}`,\n ];\n\n for (const location of hermescLocations) {\n try {\n return resolveFromProject(projectRoot, location);\n } catch {}\n }\n throw new Error('Cannot find the hermesc executable.');\n}\n\nfunction getHermesCommandPlatform(): string {\n switch (os.platform()) {\n case 'darwin':\n return 'osx-bin/hermesc';\n case 'linux':\n return 'linux64-bin/hermesc';\n case 'win32':\n return 'win64-bin/hermesc.exe';\n default:\n throw new Error(`Unsupported host platform for Hermes compiler: ${os.platform()}`);\n }\n}\n\nexport function isEnableHermesManaged(\n expoConfig: Partial<Pick<ExpoConfig, 'ios' | 'android' | 'jsEngine'>>,\n platform: Platform\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\ninterface HermesBundleOutput {\n hbc: Uint8Array;\n sourcemap: string | null;\n}\nexport async function buildHermesBundleAsync(\n projectRoot: string,\n {\n code,\n map,\n minify = false,\n }: {\n code: string;\n map: string | null;\n minify?: boolean;\n }\n): Promise<HermesBundleOutput> {\n const tempDir = path.join(os.tmpdir(), `expo-bundler-${process.pid}`);\n await fs.ensureDir(tempDir);\n try {\n const tempBundleFile = path.join(tempDir, 'index.bundle');\n await fs.writeFile(tempBundleFile, code);\n\n if (map) {\n const tempSourcemapFile = path.join(tempDir, 'index.bundle.map');\n await fs.writeFile(tempSourcemapFile, map);\n }\n\n const tempHbcFile = path.join(tempDir, 'index.hbc');\n const hermesCommand = importHermesCommandFromProject(projectRoot);\n const args = ['-emit-binary', '-out', tempHbcFile, tempBundleFile];\n if (minify) {\n args.push('-O');\n }\n if (map) {\n args.push('-output-source-map');\n }\n await spawnAsync(hermesCommand, args);\n\n let hbc: Buffer;\n let sourcemap: string | null = null;\n\n if (!map) {\n hbc = await fs.readFile(tempHbcFile);\n } else {\n [hbc, sourcemap] = await Promise.all([\n fs.readFile(tempHbcFile),\n createHermesSourcemapAsync(projectRoot, map, `${tempHbcFile}.map`),\n ]);\n }\n return {\n hbc,\n sourcemap,\n };\n } finally {\n await fs.remove(tempDir);\n }\n}\n\nexport async function createHermesSourcemapAsync(\n projectRoot: string,\n sourcemap: string,\n hermesMapFile: string\n): Promise<string> {\n const composeSourceMaps = importMetroSourceMapComposeSourceMapsFromProject(projectRoot);\n const bundlerSourcemap = JSON.parse(sourcemap);\n const hermesSourcemap = await fs.readJSON(hermesMapFile);\n return JSON.stringify(composeSourceMaps([bundlerSourcemap, hermesSourcemap]));\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":["importHermesCommandFromProject","isEnableHermesManaged","buildHermesBundleAsync","createHermesSourcemapAsync","parseGradleProperties","maybeThrowFromInconsistentEngineAsync","maybeInconsistentEngineAndroidAsync","maybeInconsistentEngineIosAsync","isHermesBytecodeBundleAsync","getHermesBytecodeBundleVersionAsync","projectRoot","platformExecutable","getHermesCommandPlatform","hermescLocations","process","env","location","resolveFromProject","Error","os","platform","expoConfig","android","jsEngine","ios","code","map","minify","tempDir","path","join","tmpdir","pid","fs","ensureDir","tempBundleFile","writeFile","tempSourcemapFile","tempHbcFile","hermesCommand","args","push","spawnAsync","hbc","sourcemap","readFile","Promise","all","remove","hermesMapFile","composeSourceMaps","importMetroSourceMapComposeSourceMapsFromProject","bundlerSourcemap","JSON","parse","hermesSourcemap","readJSON","stringify","content","result","line","split","trim","startsWith","sepIndex","indexOf","key","substr","value","configFilePath","isHermesManaged","configFileName","basename","gradlePropertiesPath","existsSync","props","isHermesBare","podfilePath","isPropsReference","search","podfilePropertiesPath","parsePodfilePropertiesAsync","HERMES_MAGIC_HEADER","file","header","readHermesHeaderAsync","slice","toString","readUInt32LE","fd","open","buffer","Buffer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AM,CAACE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAACC,QAAQ,CAAC,KAAK,CAAC,KAAKL,mBAAmB,EAAE;QAC9D,MAAM,IAAIhE,KAAK,CAAC,4BAA4B,CAAC,CAAC;KAC/C;IACD,OAAOkE,MAAM,CAACI,YAAY,CAAC,CAAC,CAAC,CAAC;CAC/B;AAED,eAAeH,qBAAqB,CAACF,IAAY,EAAmB;IAClE,MAAMM,EAAE,GAAG,MAAMxD,QAAE,QAAA,CAACyD,IAAI,CAACP,IAAI,EAAE,GAAG,CAAC,AAAC;IACpC,MAAMQ,MAAM,GAAGC,MAAM,CAACC,KAAK,CAAC,EAAE,CAAC,AAAC;IAChC,MAAM5D,QAAE,QAAA,CAAC6D,IAAI,CAACL,EAAE,EAAEE,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IACvC,MAAM1D,QAAE,QAAA,CAAC8D,KAAK,CAACN,EAAE,CAAC,CAAC;IACnB,OAAOE,MAAM,CAAC;CACf;AAED,eAAeV,2BAA2B,CACxCD,qBAA6B,EACI;IACjC,IAAI;QACF,OAAO3B,IAAI,CAACC,KAAK,CAAC,MAAMrB,QAAE,QAAA,CAACY,QAAQ,CAACmC,qBAAqB,EAAE,MAAM,CAAC,CAAC,CAAC;KACrE,CAAC,OAAM;QACN,OAAO,EAAE,CAAC;KACX;CACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportHermes.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport fs from 'fs-extra';\nimport path from 'path';\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":["isEnableHermesManaged","parseGradleProperties","maybeThrowFromInconsistentEngineAsync","maybeInconsistentEngineAndroidAsync","maybeInconsistentEngineIosAsync","isHermesBytecodeBundleAsync","getHermesBytecodeBundleVersionAsync","expoConfig","platform","android","jsEngine","ios","content","result","line","split","trim","startsWith","sepIndex","indexOf","key","substr","value","projectRoot","configFilePath","isHermesManaged","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;;;;QAIgBA,qBAAqB,GAArBA,qBAAqB;QAgBrBC,qBAAqB,GAArBA,qBAAqB;QAgBfC,qCAAqC,GAArCA,qCAAqC;QAqCrCC,mCAAmC,GAAnCA,mCAAmC;QAmBnCC,+BAA+B,GAA/BA,+BAA+B;QAoC/BC,2BAA2B,GAA3BA,2BAA2B;QAK3BC,mCAAmC,GAAnCA,mCAAmC;AApI1C,IAAA,QAAU,kCAAV,UAAU,EAAA;AACR,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAEhB,SAASN,qBAAqB,CACnCO,UAAqE,EACrEC,QAAgB,EACP;IACT,OAAQA,QAAQ;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