@expo/cli 0.12.0 → 0.13.1
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 +2 -2
- package/build/src/export/createBundles.js +0 -30
- package/build/src/export/createBundles.js.map +1 -1
- package/build/src/export/createMetadataJson.js +1 -0
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +2 -0
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/exportApp.js +42 -15
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +2 -2
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportHermes.js +204 -0
- package/build/src/export/exportHermes.js.map +1 -0
- package/build/src/export/exportStaticAsync.js +58 -3
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +7 -7
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +9 -11
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/persistMetroAssets.js +118 -0
- package/build/src/export/persistMetroAssets.js.map +1 -0
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/writeContents.js +2 -2
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/index.js +1 -0
- package/build/src/install/index.js.map +1 -1
- package/build/src/install/installAsync.js +1 -0
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/resolveOptions.js +7 -4
- package/build/src/install/resolveOptions.js.map +1 -1
- package/build/src/prebuild/index.js +2 -0
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +2 -1
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +4 -2
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/run/android/runAndroidAsync.js +5 -0
- package/build/src/run/android/runAndroidAsync.js.map +1 -1
- package/build/src/run/ios/runIosAsync.js +5 -0
- package/build/src/run/ios/runIosAsync.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +3 -3
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +7 -12
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +78 -54
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/bundleApiRoutes.js +67 -0
- package/build/src/start/server/metro/bundleApiRoutes.js.map +1 -0
- package/build/src/start/server/metro/createServerRouteMiddleware.js +112 -0
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -0
- package/build/src/start/server/metro/fetchRouterManifest.js +60 -0
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -0
- package/build/src/start/server/metro/instantiateMetro.js +31 -11
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +70 -10
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/resolveFromProject.js +13 -0
- package/build/src/start/server/metro/resolveFromProject.js.map +1 -1
- package/build/src/start/server/metro/router.js +32 -0
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +22 -0
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +18 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js +3 -3
- package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +5 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +69 -0
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js +57 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js.map +1 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js +13 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js.map +1 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js +79 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js.map +1 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js +78 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js.map +1 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js +123 -0
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js.map +1 -0
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +64 -0
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/inspector/middlwareMutations.js +19 -0
- package/build/src/start/server/middleware/inspector/middlwareMutations.js.map +1 -0
- package/build/src/start/server/middleware/mutations.js +19 -0
- package/build/src/start/server/middleware/mutations.js.map +1 -0
- package/build/src/start/server/middleware/remoteDevtoolsCorsMiddleware.js +31 -0
- package/build/src/start/server/middleware/remoteDevtoolsCorsMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/remoteDevtoolsSecurityHeadersMiddleware.js +17 -0
- package/build/src/start/server/middleware/remoteDevtoolsSecurityHeadersMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
- package/build/src/start/server/middleware/suppressErrorMiddleware.js +16 -0
- package/build/src/start/server/middleware/suppressErrorMiddleware.js.map +1 -0
- package/build/src/start/server/type-generation/routes.js +3 -4
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +1 -3
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +9 -82
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/port.js +45 -17
- package/build/src/utils/port.js.map +1 -1
- package/package.json +18 -12
- package/build/src/start/server/middleware/createDevServerMiddleware.js +0 -24
- package/build/src/start/server/middleware/createDevServerMiddleware.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/saveAssets.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../../src/export/saveAssets.ts"],"sourcesContent":["import path from 'path';\n\nimport { BundleAssetWithFileHashes } from './fork-bundleAsync';\nimport * as Log from '../log';\nimport { chunk } from '../utils/array';\nimport { copyAsync } from '../utils/dir';\n\nconst debug = require('debug')('expo:export:saveAssets') as typeof console.log;\n\nexport type ManifestAsset = { fileHashes: string[]; files: string[]; hash: string };\n\nexport type Asset = ManifestAsset | BundleAssetWithFileHashes;\n\nfunction logAssetTask(projectRoot: string, action: 'uploading' | 'saving', pathName: string) {\n debug(`${action} ${pathName}`);\n\n const relativePath = pathName.replace(projectRoot, '');\n Log.log(`${action} ${relativePath}`);\n}\n\nfunction collectAssetPaths(assets: Asset[]): Record<string, string> {\n // Collect paths by key, also effectively handles duplicates in the array\n const paths: { [fileHash: string]: string } = {};\n assets.forEach((asset) => {\n asset.files.forEach((path: string, index: number) => {\n paths[asset.fileHashes[index]] = path;\n });\n });\n return paths;\n}\n\nexport async function saveAssetsAsync(\n projectRoot: string,\n { assets, outputDir }: { assets: Asset[]; outputDir: string }\n) {\n // Collect paths by key, also effectively handles duplicates in the array\n const paths = collectAssetPaths(assets);\n\n // save files one chunk at a time\n for (const keys of chunk(Object.entries(paths), 5)) {\n await Promise.all(\n keys.map(([key, pathName]) => {\n logAssetTask(projectRoot, 'saving', pathName);\n // copy file over to assetPath\n return copyAsync(pathName, path.join(outputDir, 'assets', key));\n })\n );\n }\n Log.log('Files successfully saved.');\n}\n"],"names":["saveAssetsAsync","Log","debug","require","logAssetTask","projectRoot","action","pathName","relativePath","replace","log","collectAssetPaths","assets","paths","forEach","asset","files","path","index","fileHashes","outputDir","keys","chunk","Object","entries","Promise","all","map","key","copyAsync","join"],"mappings":"AAAA;;;;QA+BsBA,eAAe,GAAfA,eAAe;AA/BpB,IAAA,KAAM,kCAAN,MAAM,EAAA;AAGXC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACO,IAAA,MAAgB,WAAhB,gBAAgB,CAAA;AACZ,IAAA,IAAc,WAAd,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExC,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,wBAAwB,CAAC,AAAsB,AAAC;AAM/E,SAASC,YAAY,CAACC,WAAmB,EAAEC,MAA8B,EAAEC,QAAgB,EAAE;IAC3FL,KAAK,CAAC,CAAC,EAAEI,MAAM,CAAC,CAAC,EAAEC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE/B,MAAMC,YAAY,GAAGD,QAAQ,CAACE,OAAO,CAACJ,WAAW,EAAE,EAAE,CAAC,AAAC;IACvDJ,GAAG,CAACS,GAAG,CAAC,CAAC,EAAEJ,MAAM,CAAC,CAAC,EAAEE,YAAY,CAAC,CAAC,CAAC,CAAC;CACtC;AAED,SAASG,iBAAiB,CAACC,MAAe,EAA0B;IAClE,yEAAyE;IACzE,MAAMC,KAAK,GAAmC,EAAE,AAAC;IACjDD,MAAM,CAACE,OAAO,CAAC,CAACC,KAAK,GAAK;QACxBA,KAAK,CAACC,KAAK,CAACF,OAAO,CAAC,CAACG,IAAY,EAAEC,KAAa,GAAK;YACnDL,KAAK,CAACE,KAAK,CAACI,UAAU,CAACD,KAAK,CAAC,CAAC,GAAGD,IAAI,CAAC;SACvC,CAAC,CAAC;KACJ,CAAC,CAAC;IACH,OAAOJ,KAAK,CAAC;CACd;AAEM,eAAeb,eAAe,CACnCK,WAAmB,EACnB,EAAEO,MAAM,CAAA,EAAEQ,SAAS,CAAA,EAA0C,EAC7D;IACA,yEAAyE;IACzE,MAAMP,KAAK,GAAGF,iBAAiB,CAACC,MAAM,CAAC,AAAC;IAExC,iCAAiC;IACjC,KAAK,MAAMS,IAAI,IAAIC,CAAAA,GAAAA,MAAK,AAA0B,CAAA,MAA1B,CAACC,MAAM,CAACC,OAAO,CAACX,KAAK,CAAC,EAAE,CAAC,CAAC,CAAE;QAClD,MAAMY,OAAO,CAACC,GAAG,CACfL,IAAI,CAACM,GAAG,CAAC,CAAC,CAACC,GAAG,EAAErB,QAAQ,CAAC,GAAK;YAC5BH,YAAY,CAACC,WAAW,EAAE,QAAQ,EAAEE,QAAQ,CAAC,CAAC;YAC9C,8BAA8B;YAC9B,OAAOsB,CAAAA,GAAAA,IAAS,AAA+C,CAAA,UAA/C,CAACtB,QAAQ,EAAEU,KAAI,QAAA,CAACa,IAAI,CAACV,SAAS,EAAE,QAAQ,EAAEQ,GAAG,CAAC,CAAC,CAAC;SACjE,CAAC,CACH,CAAC;KACH;IACD3B,GAAG,CAACS,GAAG,CAAC,2BAA2B,CAAC,CAAC;CACtC"}
|
|
@@ -31,12 +31,12 @@ const debug = require("debug")("expo:export:write");
|
|
|
31
31
|
*/ function createBundleHash(bundle) {
|
|
32
32
|
return _crypto.default.createHash("md5").update(bundle).digest("hex");
|
|
33
33
|
}
|
|
34
|
-
async function writeBundlesAsync({ bundles , outputDir ,
|
|
34
|
+
async function writeBundlesAsync({ bundles , outputDir , useServerRendering }) {
|
|
35
35
|
const hashes = {};
|
|
36
36
|
const fileNames = {};
|
|
37
37
|
for (const [platform, bundleOutput] of Object.entries(bundles)){
|
|
38
38
|
// TODO: Move native to use the newer `_expo/...` bundle writing system.
|
|
39
|
-
if (platform === "web" &&
|
|
39
|
+
if (platform === "web" && useServerRendering) {
|
|
40
40
|
continue;
|
|
41
41
|
}
|
|
42
42
|
var _hermesBytecodeBundle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/writeContents.ts"],"sourcesContent":["import { Platform } from '@expo/config';\nimport crypto from 'crypto';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { createMetadataJson } from './createMetadataJson';\nimport { BundleOutput } from './fork-bundleAsync';\nimport { Asset } from './saveAssets';\n\nconst debug = require('debug')('expo:export:write') as typeof console.log;\n\n/**\n * @param props.platform native platform for the bundle\n * @param props.format extension to use for the name\n * @param props.hash crypto hash for the bundle contents\n * @returns filename for the JS bundle.\n */\nfunction createBundleFileName({\n platform,\n format,\n hash,\n}: {\n platform: string;\n format: 'javascript' | 'bytecode';\n hash: string;\n}): string {\n return `${platform}-${hash}.${format === 'javascript' ? 'js' : 'hbc'}`;\n}\n\n/**\n * @param bundle JS bundle as a string\n * @returns crypto hash for the provided bundle\n */\nfunction createBundleHash(bundle: string | Uint8Array): string {\n return crypto.createHash('md5').update(bundle).digest('hex');\n}\n\nexport async function writeBundlesAsync({\n bundles,\n outputDir,\n useWebSSG,\n}: {\n bundles: Partial<Record<Platform, Pick<BundleOutput, 'hermesBytecodeBundle' | 'code'>>>;\n outputDir: string;\n useWebSSG?: boolean;\n}) {\n const hashes: Partial<Record<Platform, string>> = {};\n const fileNames: Partial<Record<Platform, string>> = {};\n\n for (const [platform, bundleOutput] of Object.entries(bundles) as [\n Platform,\n Pick<BundleOutput, 'hermesBytecodeBundle' | 'code'>,\n ][]) {\n // TODO: Move native to use the newer `_expo/...` bundle writing system.\n if (platform === 'web' && useWebSSG) {\n continue;\n }\n const bundle = bundleOutput.hermesBytecodeBundle ?? bundleOutput.code;\n const hash = createBundleHash(bundle);\n const fileName = createBundleFileName({\n platform,\n format: bundleOutput.hermesBytecodeBundle ? 'bytecode' : 'javascript',\n hash,\n });\n\n hashes[platform] = hash;\n fileNames[platform] = fileName;\n await fs.writeFile(path.join(outputDir, fileName), bundle);\n }\n\n return { hashes, fileNames };\n}\n\ntype SourceMapWriteResult = {\n platform: string;\n fileName: string;\n hash: string;\n map: string;\n comment: string;\n};\n\nexport async function writeSourceMapsAsync({\n bundles,\n hashes,\n fileNames,\n outputDir,\n}: {\n bundles: Record<\n string,\n Pick<BundleOutput, 'hermesSourcemap' | 'map' | 'hermesBytecodeBundle' | 'code'>\n >;\n hashes?: Record<string, string>;\n fileNames?: Record<string, string>;\n outputDir: string;\n}): Promise<SourceMapWriteResult[]> {\n return (\n await Promise.all(\n Object.entries(bundles).map(async ([platform, bundle]) => {\n const sourceMap = bundle.hermesSourcemap ?? bundle.map;\n if (!sourceMap) {\n debug(`Skip writing sourcemap (platform: ${platform})`);\n return null;\n }\n\n const hash =\n hashes?.[platform] ?? createBundleHash(bundle.hermesBytecodeBundle ?? bundle.code);\n const mapName = `${platform}-${hash}.map`;\n await fs.writeFile(path.join(outputDir, mapName), sourceMap);\n\n const jsBundleFileName =\n fileNames?.[platform] ??\n createBundleFileName({\n platform,\n format: bundle.hermesBytecodeBundle ? 'bytecode' : 'javascript',\n hash,\n });\n const jsPath = path.join(outputDir, jsBundleFileName);\n\n // Add correct mapping to sourcemap paths\n const mappingComment = `\\n//# sourceMappingURL=${mapName}`;\n await fs.appendFile(jsPath, mappingComment);\n return {\n platform,\n fileName: mapName,\n hash,\n map: sourceMap,\n comment: mappingComment,\n };\n })\n )\n ).filter(Boolean) as SourceMapWriteResult[];\n}\n\nexport async function writeMetadataJsonAsync({\n outputDir,\n bundles,\n fileNames,\n}: {\n outputDir: string;\n bundles: Record<string, Pick<BundleOutput, 'assets'>>;\n fileNames: Record<string, string>;\n}) {\n const contents = createMetadataJson({\n bundles,\n fileNames,\n });\n const metadataPath = path.join(outputDir, 'metadata.json');\n debug(`Writing metadata.json to ${metadataPath}`);\n await fs.writeFile(metadataPath, JSON.stringify(contents));\n return contents;\n}\n\nexport async function writeAssetMapAsync({\n outputDir,\n assets,\n}: {\n outputDir: string;\n assets: Asset[];\n}) {\n // Convert the assets array to a k/v pair where the asset hash is the key and the asset is the value.\n const contents = Object.fromEntries(assets.map((asset) => [asset.hash, asset]));\n await fs.writeFile(path.join(outputDir, 'assetmap.json'), JSON.stringify(contents));\n return contents;\n}\n\nexport async function writeDebugHtmlAsync({\n outputDir,\n fileNames,\n}: {\n outputDir: string;\n fileNames: Record<string, string>;\n}) {\n // Make a debug html so user can debug their bundles\n const contents = `\n ${Object.values(fileNames)\n .map((fileName) => `<script src=\"${path.join('bundles', fileName)}\"></script>`)\n .join('\\n ')}\n Open up this file in Chrome. In the JavaScript developer console, navigate to the Source tab.\n You can see a red colored folder containing the original source code from your bundle.\n `;\n\n await fs.writeFile(path.join(outputDir, 'debug.html'), contents);\n return contents;\n}\n"],"names":["writeBundlesAsync","writeSourceMapsAsync","writeMetadataJsonAsync","writeAssetMapAsync","writeDebugHtmlAsync","debug","require","createBundleFileName","platform","format","hash","createBundleHash","bundle","crypto","createHash","update","digest","bundles","outputDir","useWebSSG","hashes","fileNames","bundleOutput","Object","entries","hermesBytecodeBundle","code","fileName","fs","writeFile","path","join","Promise","all","map","sourceMap","hermesSourcemap","mapName","jsBundleFileName","jsPath","mappingComment","appendFile","comment","filter","Boolean","contents","createMetadataJson","metadataPath","JSON","stringify","assets","fromEntries","asset","values"],"mappings":"AAAA;;;;QAqCsBA,iBAAiB,GAAjBA,iBAAiB;QA4CjBC,oBAAoB,GAApBA,oBAAoB;QAoDpBC,sBAAsB,GAAtBA,sBAAsB;QAmBtBC,kBAAkB,GAAlBA,kBAAkB;QAalBC,mBAAmB,GAAnBA,mBAAmB;AApKtB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACZ,IAAA,SAAa,kCAAb,aAAa,EAAA;AACX,IAAA,KAAM,kCAAN,MAAM,EA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.ts"],"sourcesContent":["import { Platform } from '@expo/config';\nimport crypto from 'crypto';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { createMetadataJson } from './createMetadataJson';\nimport { BundleOutput } from './fork-bundleAsync';\nimport { Asset } from './saveAssets';\n\nconst debug = require('debug')('expo:export:write') as typeof console.log;\n\n/**\n * @param props.platform native platform for the bundle\n * @param props.format extension to use for the name\n * @param props.hash crypto hash for the bundle contents\n * @returns filename for the JS bundle.\n */\nfunction createBundleFileName({\n platform,\n format,\n hash,\n}: {\n platform: string;\n format: 'javascript' | 'bytecode';\n hash: string;\n}): string {\n return `${platform}-${hash}.${format === 'javascript' ? 'js' : 'hbc'}`;\n}\n\n/**\n * @param bundle JS bundle as a string\n * @returns crypto hash for the provided bundle\n */\nfunction createBundleHash(bundle: string | Uint8Array): string {\n return crypto.createHash('md5').update(bundle).digest('hex');\n}\n\nexport async function writeBundlesAsync({\n bundles,\n outputDir,\n useServerRendering,\n}: {\n bundles: Partial<Record<Platform, Pick<BundleOutput, 'hermesBytecodeBundle' | 'code'>>>;\n outputDir: string;\n useServerRendering?: boolean;\n}) {\n const hashes: Partial<Record<Platform, string>> = {};\n const fileNames: Partial<Record<Platform, string>> = {};\n\n for (const [platform, bundleOutput] of Object.entries(bundles) as [\n Platform,\n Pick<BundleOutput, 'hermesBytecodeBundle' | 'code'>,\n ][]) {\n // TODO: Move native to use the newer `_expo/...` bundle writing system.\n if (platform === 'web' && useServerRendering) {\n continue;\n }\n const bundle = bundleOutput.hermesBytecodeBundle ?? bundleOutput.code;\n const hash = createBundleHash(bundle);\n const fileName = createBundleFileName({\n platform,\n format: bundleOutput.hermesBytecodeBundle ? 'bytecode' : 'javascript',\n hash,\n });\n\n hashes[platform] = hash;\n fileNames[platform] = fileName;\n await fs.writeFile(path.join(outputDir, fileName), bundle);\n }\n\n return { hashes, fileNames };\n}\n\ntype SourceMapWriteResult = {\n platform: string;\n fileName: string;\n hash: string;\n map: string;\n comment: string;\n};\n\nexport async function writeSourceMapsAsync({\n bundles,\n hashes,\n fileNames,\n outputDir,\n}: {\n bundles: Record<\n string,\n Pick<BundleOutput, 'hermesSourcemap' | 'map' | 'hermesBytecodeBundle' | 'code'>\n >;\n hashes?: Record<string, string>;\n fileNames?: Record<string, string>;\n outputDir: string;\n}): Promise<SourceMapWriteResult[]> {\n return (\n await Promise.all(\n Object.entries(bundles).map(async ([platform, bundle]) => {\n const sourceMap = bundle.hermesSourcemap ?? bundle.map;\n if (!sourceMap) {\n debug(`Skip writing sourcemap (platform: ${platform})`);\n return null;\n }\n\n const hash =\n hashes?.[platform] ?? createBundleHash(bundle.hermesBytecodeBundle ?? bundle.code);\n const mapName = `${platform}-${hash}.map`;\n await fs.writeFile(path.join(outputDir, mapName), sourceMap);\n\n const jsBundleFileName =\n fileNames?.[platform] ??\n createBundleFileName({\n platform,\n format: bundle.hermesBytecodeBundle ? 'bytecode' : 'javascript',\n hash,\n });\n const jsPath = path.join(outputDir, jsBundleFileName);\n\n // Add correct mapping to sourcemap paths\n const mappingComment = `\\n//# sourceMappingURL=${mapName}`;\n await fs.appendFile(jsPath, mappingComment);\n return {\n platform,\n fileName: mapName,\n hash,\n map: sourceMap,\n comment: mappingComment,\n };\n })\n )\n ).filter(Boolean) as SourceMapWriteResult[];\n}\n\nexport async function writeMetadataJsonAsync({\n outputDir,\n bundles,\n fileNames,\n}: {\n outputDir: string;\n bundles: Record<string, Pick<BundleOutput, 'assets'>>;\n fileNames: Record<string, string>;\n}) {\n const contents = createMetadataJson({\n bundles,\n fileNames,\n });\n const metadataPath = path.join(outputDir, 'metadata.json');\n debug(`Writing metadata.json to ${metadataPath}`);\n await fs.writeFile(metadataPath, JSON.stringify(contents));\n return contents;\n}\n\nexport async function writeAssetMapAsync({\n outputDir,\n assets,\n}: {\n outputDir: string;\n assets: Asset[];\n}) {\n // Convert the assets array to a k/v pair where the asset hash is the key and the asset is the value.\n const contents = Object.fromEntries(assets.map((asset) => [asset.hash, asset]));\n await fs.writeFile(path.join(outputDir, 'assetmap.json'), JSON.stringify(contents));\n return contents;\n}\n\nexport async function writeDebugHtmlAsync({\n outputDir,\n fileNames,\n}: {\n outputDir: string;\n fileNames: Record<string, string>;\n}) {\n // Make a debug html so user can debug their bundles\n const contents = `\n ${Object.values(fileNames)\n .map((fileName) => `<script src=\"${path.join('bundles', fileName)}\"></script>`)\n .join('\\n ')}\n Open up this file in Chrome. In the JavaScript developer console, navigate to the Source tab.\n You can see a red colored folder containing the original source code from your bundle.\n `;\n\n await fs.writeFile(path.join(outputDir, 'debug.html'), contents);\n return contents;\n}\n"],"names":["writeBundlesAsync","writeSourceMapsAsync","writeMetadataJsonAsync","writeAssetMapAsync","writeDebugHtmlAsync","debug","require","createBundleFileName","platform","format","hash","createBundleHash","bundle","crypto","createHash","update","digest","bundles","outputDir","useServerRendering","hashes","fileNames","bundleOutput","Object","entries","hermesBytecodeBundle","code","fileName","fs","writeFile","path","join","Promise","all","map","sourceMap","hermesSourcemap","mapName","jsBundleFileName","jsPath","mappingComment","appendFile","comment","filter","Boolean","contents","createMetadataJson","metadataPath","JSON","stringify","assets","fromEntries","asset","values"],"mappings":"AAAA;;;;QAqCsBA,iBAAiB,GAAjBA,iBAAiB;QA4CjBC,oBAAoB,GAApBA,oBAAoB;QAoDpBC,sBAAsB,GAAtBA,sBAAsB;QAmBtBC,kBAAkB,GAAlBA,kBAAkB;QAalBC,mBAAmB,GAAnBA,mBAAmB;AApKtB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACZ,IAAA,SAAa,kCAAb,aAAa,EAAA;AACX,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEY,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;;;;;;AAIzD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,AAAsB,AAAC;AAE1E;;;;;GAKG,CACH,SAASC,oBAAoB,CAAC,EAC5BC,QAAQ,CAAA,EACRC,MAAM,CAAA,EACNC,IAAI,CAA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ACvCe,SAAS,CAAA,EACTgC,MAAM,CAAA,EAIP,EAAE;IACD,qGAAqG;IACrG,MAAML,QAAQ,GAAGtB,MAAM,CAAC4B,WAAW,CAACD,MAAM,CAAChB,GAAG,CAAC,CAACkB,KAAK,GAAK;YAACA,KAAK,CAAC1C,IAAI;YAAE0C,KAAK;SAAC;IAAA,CAAC,CAAC,AAAC;IAChF,MAAMxB,SAAE,QAAA,CAACC,SAAS,CAACC,KAAI,QAAA,CAACC,IAAI,CAACb,SAAS,EAAE,eAAe,CAAC,EAAE8B,IAAI,CAACC,SAAS,CAACJ,QAAQ,CAAC,CAAC,CAAC;IACpF,OAAOA,QAAQ,CAAC;CACjB;AAEM,eAAezC,mBAAmB,CAAC,EACxCc,SAAS,CAAA,EACTG,SAAS,CAAA,EAIV,EAAE;IACD,oDAAoD;IACpD,MAAMwB,QAAQ,GAAG,CAAC;MACd,EAAEtB,MAAM,CAAC8B,MAAM,CAAChC,SAAS,CAAC,CACvBa,GAAG,CAAC,CAACP,QAAQ,GAAK,CAAC,aAAa,EAAEG,KAAI,QAAA,CAACC,IAAI,CAAC,SAAS,EAAEJ,QAAQ,CAAC,CAAC,WAAW,CAAC;IAAA,CAAC,CAC9EI,IAAI,CAAC,UAAU,CAAC,CAAC;;;MAGpB,CAAC,AAAC;IAEN,MAAMH,SAAE,QAAA,CAACC,SAAS,CAACC,KAAI,QAAA,CAACC,IAAI,CAACb,SAAS,EAAE,YAAY,CAAC,EAAE2B,QAAQ,CAAC,CAAC;IACjE,OAAOA,QAAQ,CAAC;CACjB"}
|
|
@@ -28,6 +28,7 @@ const expoInstall = async (argv)=>{
|
|
|
28
28
|
`--fix Automatically update any invalid package versions`,
|
|
29
29
|
_chalk.default`--npm Use npm to install dependencies. {dim Default when package-lock.json exists}`,
|
|
30
30
|
_chalk.default`--yarn Use Yarn to install dependencies. {dim Default when yarn.lock exists}`,
|
|
31
|
+
_chalk.default`--bun Use bun to install dependencies. {dim Default when bun.lockb exists}`,
|
|
31
32
|
_chalk.default`--pnpm Use pnpm to install dependencies. {dim Default when pnpm-lock.yaml exists}`,
|
|
32
33
|
`-h, --help Usage info`,
|
|
33
34
|
].join("\n"), [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/install/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertWithOptionsArgs, printHelp } from '../utils/args';\n\nexport const expoInstall: Command = async (argv) => {\n const args = assertWithOptionsArgs(\n {\n // Other options are parsed manually.\n '--help': Boolean,\n // Aliases\n '-h': '--help',\n },\n {\n argv,\n // Allow other options, we'll throw an error if unexpected values are passed.\n permissive: true,\n }\n );\n\n if (args['--help']) {\n printHelp(\n `Install a module or other package to a project`,\n `npx expo install`,\n [\n `--check Check which installed packages need to be updated`,\n `--fix Automatically update any invalid package versions`,\n chalk`--npm Use npm to install dependencies. {dim Default when package-lock.json exists}`,\n chalk`--yarn Use Yarn to install dependencies. {dim Default when yarn.lock exists}`,\n chalk`--pnpm Use pnpm to install dependencies. {dim Default when pnpm-lock.yaml exists}`,\n `-h, --help Usage info`,\n ].join('\\n'),\n [\n '',\n chalk` Additional options can be passed to the underlying install command by using {bold --}`,\n chalk` {dim $} npx expo install react -- --verbose`,\n chalk` {dim >} yarn add react --verbose`,\n '',\n ].join('\\n')\n );\n }\n\n // Load modules after the help prompt so `npx expo install -h` shows as fast as possible.\n const { installAsync } = require('./installAsync') as typeof import('./installAsync');\n const { logCmdError } = require('../utils/errors') as typeof import('../utils/errors');\n const { resolveArgsAsync } = require('./resolveOptions') as typeof import('./resolveOptions');\n\n const { variadic, options, extras } = await resolveArgsAsync(process.argv.slice(3)).catch(\n logCmdError\n );\n return installAsync(variadic, options, extras).catch(logCmdError);\n};\n"],"names":["expoInstall","argv","args","assertWithOptionsArgs","Boolean","permissive","printHelp","chalk","join","installAsync","require","logCmdError","resolveArgsAsync","variadic","options","extras","process","slice","catch"],"mappings":"AAAA;;;;;;AACkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAGwB,IAAA,KAAe,WAAf,eAAe,CAAA;;;;;;AAEzD,MAAMA,WAAW,GAAY,OAAOC,IAAI,GAAK;IAClD,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAqB,AAYjC,CAAA,sBAZiC,CAChC;QACE,qCAAqC;QACrC,QAAQ,EAAEC,OAAO;QACjB,UAAU;QACV,IAAI,EAAE,QAAQ;KACf,EACD;QACEH,IAAI;QACJ,6EAA6E;QAC7EI,UAAU,EAAE,IAAI;KACjB,CACF,AAAC;IAEF,IAAIH,IAAI,CAAC,QAAQ,CAAC,EAAE;QAClBI,CAAAA,GAAAA,KAAS,
|
|
1
|
+
{"version":3,"sources":["../../../src/install/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertWithOptionsArgs, printHelp } from '../utils/args';\n\nexport const expoInstall: Command = async (argv) => {\n const args = assertWithOptionsArgs(\n {\n // Other options are parsed manually.\n '--help': Boolean,\n // Aliases\n '-h': '--help',\n },\n {\n argv,\n // Allow other options, we'll throw an error if unexpected values are passed.\n permissive: true,\n }\n );\n\n if (args['--help']) {\n printHelp(\n `Install a module or other package to a project`,\n `npx expo install`,\n [\n `--check Check which installed packages need to be updated`,\n `--fix Automatically update any invalid package versions`,\n chalk`--npm Use npm to install dependencies. {dim Default when package-lock.json exists}`,\n chalk`--yarn Use Yarn to install dependencies. {dim Default when yarn.lock exists}`,\n chalk`--bun Use bun to install dependencies. {dim Default when bun.lockb exists}`,\n chalk`--pnpm Use pnpm to install dependencies. {dim Default when pnpm-lock.yaml exists}`,\n `-h, --help Usage info`,\n ].join('\\n'),\n [\n '',\n chalk` Additional options can be passed to the underlying install command by using {bold --}`,\n chalk` {dim $} npx expo install react -- --verbose`,\n chalk` {dim >} yarn add react --verbose`,\n '',\n ].join('\\n')\n );\n }\n\n // Load modules after the help prompt so `npx expo install -h` shows as fast as possible.\n const { installAsync } = require('./installAsync') as typeof import('./installAsync');\n const { logCmdError } = require('../utils/errors') as typeof import('../utils/errors');\n const { resolveArgsAsync } = require('./resolveOptions') as typeof import('./resolveOptions');\n\n const { variadic, options, extras } = await resolveArgsAsync(process.argv.slice(3)).catch(\n logCmdError\n );\n return installAsync(variadic, options, extras).catch(logCmdError);\n};\n"],"names":["expoInstall","argv","args","assertWithOptionsArgs","Boolean","permissive","printHelp","chalk","join","installAsync","require","logCmdError","resolveArgsAsync","variadic","options","extras","process","slice","catch"],"mappings":"AAAA;;;;;;AACkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAGwB,IAAA,KAAe,WAAf,eAAe,CAAA;;;;;;AAEzD,MAAMA,WAAW,GAAY,OAAOC,IAAI,GAAK;IAClD,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAqB,AAYjC,CAAA,sBAZiC,CAChC;QACE,qCAAqC;QACrC,QAAQ,EAAEC,OAAO;QACjB,UAAU;QACV,IAAI,EAAE,QAAQ;KACf,EACD;QACEH,IAAI;QACJ,6EAA6E;QAC7EI,UAAU,EAAE,IAAI;KACjB,CACF,AAAC;IAEF,IAAIH,IAAI,CAAC,QAAQ,CAAC,EAAE;QAClBI,CAAAA,GAAAA,KAAS,AAmBR,CAAA,UAnBQ,CACP,CAAC,8CAA8C,CAAC,EAChD,CAAC,gBAAgB,CAAC,EAClB;YACE,CAAC,6DAA6D,CAAC;YAC/D,CAAC,6DAA6D,CAAC;YAC/DC,MAAK,QAAA,CAAC,wFAAwF,CAAC;YAC/FA,MAAK,QAAA,CAAC,iFAAiF,CAAC;YACxFA,MAAK,QAAA,CAAC,gFAAgF,CAAC;YACvFA,MAAK,QAAA,CAAC,sFAAsF,CAAC;YAC7F,CAAC,sBAAsB,CAAC;SACzB,CAACC,IAAI,CAAC,IAAI,CAAC,EACZ;YACE,EAAE;YACFD,MAAK,QAAA,CAAC,uFAAuF,CAAC;YAC9FA,MAAK,QAAA,CAAC,+CAA+C,CAAC;YACtDA,MAAK,QAAA,CAAC,oCAAoC,CAAC;YAC3C,EAAE;SACH,CAACC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;KACH;IAED,yFAAyF;IACzF,MAAM,EAAEC,YAAY,CAAA,EAAE,GAAGC,OAAO,CAAC,gBAAgB,CAAC,AAAmC,AAAC;IACtF,MAAM,EAAEC,WAAW,CAAA,EAAE,GAAGD,OAAO,CAAC,iBAAiB,CAAC,AAAoC,AAAC;IACvF,MAAM,EAAEE,gBAAgB,CAAA,EAAE,GAAGF,OAAO,CAAC,kBAAkB,CAAC,AAAqC,AAAC;IAE9F,MAAM,EAAEG,QAAQ,CAAA,EAAEC,OAAO,CAAA,EAAEC,MAAM,CAAA,EAAE,GAAG,MAAMH,gBAAgB,CAACI,OAAO,CAACf,IAAI,CAACgB,KAAK,CAAC,CAAC,CAAC,CAAC,CAACC,KAAK,CACvFP,WAAW,CACZ,AAAC;IACF,OAAOF,YAAY,CAACI,QAAQ,EAAEC,OAAO,EAAEC,MAAM,CAAC,CAACG,KAAK,CAACP,WAAW,CAAC,CAAC;CACnE,AAAC;QA/CWX,WAAW,GAAXA,WAAW"}
|
|
@@ -53,6 +53,7 @@ async function installAsync(packages, options, packageManagerArguments = []) {
|
|
|
53
53
|
const packageManager = PackageManager.createForProject(projectRoot, {
|
|
54
54
|
npm: options.npm,
|
|
55
55
|
yarn: options.yarn,
|
|
56
|
+
bun: options.bun,
|
|
56
57
|
pnpm: options.pnpm,
|
|
57
58
|
silent: options.silent,
|
|
58
59
|
log: Log.log
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/install/installAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport { checkPackagesAsync } from './checkPackages';\nimport { Options } from './resolveOptions';\nimport * as Log from '../log';\nimport {\n getOperationLog,\n getVersionedPackagesAsync,\n} from '../start/doctor/dependencies/getVersionedPackages';\nimport { getVersionedDependenciesAsync } from '../start/doctor/dependencies/validateDependenciesVersions';\nimport { groupBy } from '../utils/array';\nimport { findUpProjectRootOrAssert } from '../utils/findUp';\nimport { learnMore } from '../utils/link';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { joinWithCommasAnd } from '../utils/strings';\n\nexport async function installAsync(\n packages: string[],\n options: Options & { projectRoot?: string },\n packageManagerArguments: string[] = []\n) {\n setNodeEnv('development');\n // Locate the project root based on the process current working directory.\n // This enables users to run `npx expo install` from a subdirectory of the project.\n const projectRoot = options.projectRoot ?? findUpProjectRootOrAssert(process.cwd());\n require('@expo/env').load(projectRoot);\n\n // Resolve the package manager used by the project, or based on the provided arguments.\n const packageManager = PackageManager.createForProject(projectRoot, {\n npm: options.npm,\n yarn: options.yarn,\n pnpm: options.pnpm,\n silent: options.silent,\n log: Log.log,\n });\n\n if (options.check || options.fix) {\n return await checkPackagesAsync(projectRoot, {\n packages,\n options,\n packageManager,\n packageManagerArguments,\n });\n }\n\n // Read the project Expo config without plugins.\n const { exp } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n // Resolve the versioned packages, then install them.\n return installPackagesAsync(projectRoot, {\n packageManager,\n packages,\n packageManagerArguments,\n sdkVersion: exp.sdkVersion!,\n });\n}\n\n/** Version packages and install in a project. */\nexport async function installPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n sdkVersion,\n packageManagerArguments,\n }: {\n /**\n * List of packages to version, grouped by the type of dependency.\n * @example ['uuid', 'react-native-reanimated@latest']\n */\n packages: string[];\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * SDK to version `packages` for.\n * @example '44.0.0'\n */\n sdkVersion: string;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n): Promise<void> {\n // Read the project Expo config without plugins.\n const { pkg } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n //assertNotInstallingExcludedPackages(projectRoot, packages, pkg);\n\n const versioning = await getVersionedPackagesAsync(projectRoot, {\n packages,\n // sdkVersion is always defined because we don't skipSDKVersionRequirement in getConfig.\n sdkVersion,\n pkg,\n });\n\n Log.log(\n chalk`\\u203A Installing ${\n versioning.messages.length ? versioning.messages.join(' and ') + ' ' : ''\n }using {bold ${packageManager.name}}`\n );\n\n if (versioning.excludedNativeModules.length) {\n Log.log(\n chalk`\\u203A Using latest version instead of ${joinWithCommasAnd(\n versioning.excludedNativeModules.map(\n ({ bundledNativeVersion, name }) => `${bundledNativeVersion} for ${name}`\n )\n )} because ${\n versioning.excludedNativeModules.length > 1 ? 'they are' : 'it is'\n } listed in {bold expo.install.exclude} in package.json. ${learnMore(\n 'https://expo.dev/more/expo-cli/#configuring-dependency-validation'\n )}`\n );\n }\n\n await packageManager.addAsync([...packageManagerArguments, ...versioning.packages]);\n\n await applyPluginsAsync(projectRoot, versioning.packages);\n}\n\nexport async function fixPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n sdkVersion,\n packageManagerArguments,\n }: {\n packages: Awaited<ReturnType<typeof getVersionedDependenciesAsync>>;\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * SDK to version `packages` for.\n * @example '44.0.0'\n */\n sdkVersion: string;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n): Promise<void> {\n if (!packages.length) {\n return;\n }\n\n const { dependencies = [], devDependencies = [] } = groupBy(packages, (dep) => dep.packageType);\n const versioningMessages = getOperationLog({\n othersCount: 0, // All fixable packages are versioned\n nativeModulesCount: packages.length,\n sdkVersion,\n });\n\n Log.log(\n chalk`\\u203A Installing ${\n versioningMessages.length ? versioningMessages.join(' and ') + ' ' : ''\n }using {bold ${packageManager.name}}`\n );\n\n if (dependencies.length) {\n const versionedPackages = dependencies.map(\n (dep) => `${dep.packageName}@${dep.expectedVersionOrRange}`\n );\n\n await packageManager.addAsync([...packageManagerArguments, ...versionedPackages]);\n\n await applyPluginsAsync(projectRoot, versionedPackages);\n }\n\n if (devDependencies.length) {\n await packageManager.addDevAsync([\n ...packageManagerArguments,\n ...devDependencies.map((dep) => `${dep.packageName}@${dep.expectedVersionOrRange}`),\n ]);\n }\n}\n\n/**\n * A convenience feature for automatically applying Expo Config Plugins to the `app.json` after installing them.\n * This should be dropped in favor of autolinking in the future.\n */\nasync function applyPluginsAsync(projectRoot: string, packages: string[]) {\n const { autoAddConfigPluginsAsync } = await import('./utils/autoAddConfigPlugins');\n\n try {\n const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n\n // Only auto add plugins if the plugins array is defined or if the project is using SDK +42.\n await autoAddConfigPluginsAsync(\n projectRoot,\n exp,\n // Split any possible NPM tags. i.e. `expo@latest` -> `expo`\n packages.map((pkg) => pkg.split('@')[0]).filter(Boolean)\n );\n } catch (error: any) {\n // If we fail to apply plugins, the log a warning and continue.\n if (error.isPluginError) {\n Log.warn(`Skipping config plugin check: ` + error.message);\n return;\n }\n // Any other error, rethrow.\n throw error;\n }\n}\n"],"names":["installAsync","installPackagesAsync","fixPackagesAsync","PackageManager","Log","packages","options","packageManagerArguments","setNodeEnv","projectRoot","findUpProjectRootOrAssert","process","cwd","require","load","packageManager","createForProject","npm","yarn","pnpm","silent","log","check","fix","checkPackagesAsync","exp","getConfig","skipPlugins","sdkVersion","pkg","versioning","getVersionedPackagesAsync","chalk","messages","length","join","name","excludedNativeModules","joinWithCommasAnd","map","bundledNativeVersion","learnMore","addAsync","applyPluginsAsync","dependencies","devDependencies","groupBy","dep","packageType","versioningMessages","getOperationLog","othersCount","nativeModulesCount","versionedPackages","packageName","expectedVersionOrRange","addDevAsync","autoAddConfigPluginsAsync","skipSDKVersionRequirement","split","filter","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,QAAkB,EAAE;IACxE,MAAM,EAAEoD,yBAAyB,CAAA,EAAE,GAAG,MAAM;+CAAO,8BAA8B;MAAC,AAAC;IAEnF,IAAI;QACF,MAAM,EAAEhC,GAAG,CAAA,EAAE,GAAGC,CAAAA,GAAAA,OAAS,AAAkD,CAAA,UAAlD,CAACjB,WAAW,EAAE;YAAEiD,yBAAyB,EAAE,IAAI;SAAE,CAAC,AAAC;QAE5E,4FAA4F;QAC5F,MAAMD,yBAAyB,CAC7BhD,WAAW,EACXgB,GAAG,EACH,4DAA4D;QAC5DpB,QAAQ,CAACkC,GAAG,CAAC,CAACV,GAAG,GAAKA,GAAG,CAAC8B,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAAA,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC,CACzD,CAAC;KACH,CAAC,OAAOC,KAAK,EAAO;QACnB,+DAA+D;QAC/D,IAAIA,KAAK,CAACC,aAAa,EAAE;YACvB3D,GAAG,CAAC4D,IAAI,CAAC,CAAC,8BAA8B,CAAC,GAAGF,KAAK,CAACG,OAAO,CAAC,CAAC;YAC3D,OAAO;SACR;QACD,4BAA4B;QAC5B,MAAMH,KAAK,CAAC;KACb;CACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/install/installAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport { checkPackagesAsync } from './checkPackages';\nimport { Options } from './resolveOptions';\nimport * as Log from '../log';\nimport {\n getOperationLog,\n getVersionedPackagesAsync,\n} from '../start/doctor/dependencies/getVersionedPackages';\nimport { getVersionedDependenciesAsync } from '../start/doctor/dependencies/validateDependenciesVersions';\nimport { groupBy } from '../utils/array';\nimport { findUpProjectRootOrAssert } from '../utils/findUp';\nimport { learnMore } from '../utils/link';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { joinWithCommasAnd } from '../utils/strings';\n\nexport async function installAsync(\n packages: string[],\n options: Options & { projectRoot?: string },\n packageManagerArguments: string[] = []\n) {\n setNodeEnv('development');\n // Locate the project root based on the process current working directory.\n // This enables users to run `npx expo install` from a subdirectory of the project.\n const projectRoot = options.projectRoot ?? findUpProjectRootOrAssert(process.cwd());\n require('@expo/env').load(projectRoot);\n\n // Resolve the package manager used by the project, or based on the provided arguments.\n const packageManager = PackageManager.createForProject(projectRoot, {\n npm: options.npm,\n yarn: options.yarn,\n bun: options.bun,\n pnpm: options.pnpm,\n silent: options.silent,\n log: Log.log,\n });\n\n if (options.check || options.fix) {\n return await checkPackagesAsync(projectRoot, {\n packages,\n options,\n packageManager,\n packageManagerArguments,\n });\n }\n\n // Read the project Expo config without plugins.\n const { exp } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n // Resolve the versioned packages, then install them.\n return installPackagesAsync(projectRoot, {\n packageManager,\n packages,\n packageManagerArguments,\n sdkVersion: exp.sdkVersion!,\n });\n}\n\n/** Version packages and install in a project. */\nexport async function installPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n sdkVersion,\n packageManagerArguments,\n }: {\n /**\n * List of packages to version, grouped by the type of dependency.\n * @example ['uuid', 'react-native-reanimated@latest']\n */\n packages: string[];\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * SDK to version `packages` for.\n * @example '44.0.0'\n */\n sdkVersion: string;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n): Promise<void> {\n // Read the project Expo config without plugins.\n const { pkg } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n //assertNotInstallingExcludedPackages(projectRoot, packages, pkg);\n\n const versioning = await getVersionedPackagesAsync(projectRoot, {\n packages,\n // sdkVersion is always defined because we don't skipSDKVersionRequirement in getConfig.\n sdkVersion,\n pkg,\n });\n\n Log.log(\n chalk`\\u203A Installing ${\n versioning.messages.length ? versioning.messages.join(' and ') + ' ' : ''\n }using {bold ${packageManager.name}}`\n );\n\n if (versioning.excludedNativeModules.length) {\n Log.log(\n chalk`\\u203A Using latest version instead of ${joinWithCommasAnd(\n versioning.excludedNativeModules.map(\n ({ bundledNativeVersion, name }) => `${bundledNativeVersion} for ${name}`\n )\n )} because ${\n versioning.excludedNativeModules.length > 1 ? 'they are' : 'it is'\n } listed in {bold expo.install.exclude} in package.json. ${learnMore(\n 'https://expo.dev/more/expo-cli/#configuring-dependency-validation'\n )}`\n );\n }\n\n await packageManager.addAsync([...packageManagerArguments, ...versioning.packages]);\n\n await applyPluginsAsync(projectRoot, versioning.packages);\n}\n\nexport async function fixPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n sdkVersion,\n packageManagerArguments,\n }: {\n packages: Awaited<ReturnType<typeof getVersionedDependenciesAsync>>;\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * SDK to version `packages` for.\n * @example '44.0.0'\n */\n sdkVersion: string;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n): Promise<void> {\n if (!packages.length) {\n return;\n }\n\n const { dependencies = [], devDependencies = [] } = groupBy(packages, (dep) => dep.packageType);\n const versioningMessages = getOperationLog({\n othersCount: 0, // All fixable packages are versioned\n nativeModulesCount: packages.length,\n sdkVersion,\n });\n\n Log.log(\n chalk`\\u203A Installing ${\n versioningMessages.length ? versioningMessages.join(' and ') + ' ' : ''\n }using {bold ${packageManager.name}}`\n );\n\n if (dependencies.length) {\n const versionedPackages = dependencies.map(\n (dep) => `${dep.packageName}@${dep.expectedVersionOrRange}`\n );\n\n await packageManager.addAsync([...packageManagerArguments, ...versionedPackages]);\n\n await applyPluginsAsync(projectRoot, versionedPackages);\n }\n\n if (devDependencies.length) {\n await packageManager.addDevAsync([\n ...packageManagerArguments,\n ...devDependencies.map((dep) => `${dep.packageName}@${dep.expectedVersionOrRange}`),\n ]);\n }\n}\n\n/**\n * A convenience feature for automatically applying Expo Config Plugins to the `app.json` after installing them.\n * This should be dropped in favor of autolinking in the future.\n */\nasync function applyPluginsAsync(projectRoot: string, packages: string[]) {\n const { autoAddConfigPluginsAsync } = await import('./utils/autoAddConfigPlugins');\n\n try {\n const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n\n // Only auto add plugins if the plugins array is defined or if the project is using SDK +42.\n await autoAddConfigPluginsAsync(\n projectRoot,\n exp,\n // Split any possible NPM tags. i.e. `expo@latest` -> `expo`\n packages.map((pkg) => pkg.split('@')[0]).filter(Boolean)\n );\n } catch (error: any) {\n // If we fail to apply plugins, the log a warning and continue.\n if (error.isPluginError) {\n Log.warn(`Skipping config plugin check: ` + error.message);\n return;\n }\n // Any other error, rethrow.\n throw error;\n }\n}\n"],"names":["installAsync","installPackagesAsync","fixPackagesAsync","PackageManager","Log","packages","options","packageManagerArguments","setNodeEnv","projectRoot","findUpProjectRootOrAssert","process","cwd","require","load","packageManager","createForProject","npm","yarn","bun","pnpm","silent","log","check","fix","checkPackagesAsync","exp","getConfig","skipPlugins","sdkVersion","pkg","versioning","getVersionedPackagesAsync","chalk","messages","length","join","name","excludedNativeModules","joinWithCommasAnd","map","bundledNativeVersion","learnMore","addAsync","applyPluginsAsync","dependencies","devDependencies","groupBy","dep","packageType","versioningMessages","getOperationLog","othersCount","nativeModulesCount","versionedPackages","packageName","expectedVersionOrRange","addDevAsync","autoAddConfigPluginsAsync","skipSDKVersionRequirement","split","filter","Boolean","error","isPluginError","warn","message"],"mappings":"AAAA;;;;QAkBsBA,YAAY,GAAZA,YAAY;QA+CZC,oBAAoB,GAApBA,oBAAoB;QAoEpBC,gBAAgB,GAAhBA,gBAAgB;AArIZ,IAAA,OAAc,WAAd,cAAc,CAAA;AAC5BC,IAAAA,cAAc,mCAAM,uBAAuB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GAAAA,OAAS,AAAkD,CAAA,UAAlD,CAAClB,WAAW,EAAE;YAAEkD,yBAAyB,EAAE,IAAI;SAAE,CAAC,AAAC;QAE5E,4FAA4F;QAC5F,MAAMD,yBAAyB,CAC7BjD,WAAW,EACXiB,GAAG,EACH,4DAA4D;QAC5DrB,QAAQ,CAACmC,GAAG,CAAC,CAACV,GAAG,GAAKA,GAAG,CAAC8B,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAAA,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC,CACzD,CAAC;KACH,CAAC,OAAOC,KAAK,EAAO;QACnB,+DAA+D;QAC/D,IAAIA,KAAK,CAACC,aAAa,EAAE;YACvB5D,GAAG,CAAC6D,IAAI,CAAC,CAAC,8BAA8B,CAAC,GAAGF,KAAK,CAACG,OAAO,CAAC,CAAC;YAC3D,OAAO;SACR;QACD,4BAA4B;QAC5B,MAAMH,KAAK,CAAC;KACb;CACF"}
|
|
@@ -12,9 +12,10 @@ function resolveOptions(options) {
|
|
|
12
12
|
if ([
|
|
13
13
|
options.npm,
|
|
14
14
|
options.pnpm,
|
|
15
|
-
options.yarn
|
|
15
|
+
options.yarn,
|
|
16
|
+
options.bun
|
|
16
17
|
].filter(Boolean).length > 1) {
|
|
17
|
-
throw new _errors.CommandError("BAD_ARGS", "Specify at most one of: --npm, --pnpm, --yarn");
|
|
18
|
+
throw new _errors.CommandError("BAD_ARGS", "Specify at most one of: --npm, --pnpm, --yarn, --bun");
|
|
18
19
|
}
|
|
19
20
|
return {
|
|
20
21
|
...options
|
|
@@ -27,7 +28,8 @@ async function resolveArgsAsync(argv) {
|
|
|
27
28
|
"--fix",
|
|
28
29
|
"--npm",
|
|
29
30
|
"--pnpm",
|
|
30
|
-
"--yarn"
|
|
31
|
+
"--yarn",
|
|
32
|
+
"--bun"
|
|
31
33
|
], {
|
|
32
34
|
variadic,
|
|
33
35
|
extras,
|
|
@@ -41,7 +43,8 @@ async function resolveArgsAsync(argv) {
|
|
|
41
43
|
check: !!flags["--check"],
|
|
42
44
|
yarn: !!flags["--yarn"],
|
|
43
45
|
npm: !!flags["--npm"],
|
|
44
|
-
pnpm: !!flags["--pnpm"]
|
|
46
|
+
pnpm: !!flags["--pnpm"],
|
|
47
|
+
bun: !!flags["--bun"]
|
|
45
48
|
}),
|
|
46
49
|
extras
|
|
47
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/install/resolveOptions.ts"],"sourcesContent":["import { NodePackageManagerForProject } from '@expo/package-manager';\n\nimport { CommandError } from '../utils/errors';\nimport { assertUnexpectedVariadicFlags, parseVariadicArguments } from '../utils/variadic';\n\nexport type Options = Pick<NodePackageManagerForProject, 'npm' | 'pnpm' | 'yarn'> & {\n /** Check which packages need to be updated, does not install any provided packages. */\n check?: boolean;\n /** Should the dependencies be fixed automatically. */\n fix?: boolean;\n /** Should disable install output, used for commands like `prebuild` that run install internally. */\n silent?: boolean;\n};\n\nfunction resolveOptions(options: Options): Options {\n if (options.fix && options.check) {\n throw new CommandError('BAD_ARGS', 'Specify at most one of: --check, --fix');\n }\n if ([options.npm, options.pnpm, options.yarn].filter(Boolean).length > 1) {\n throw new CommandError('BAD_ARGS', 'Specify at most one of: --npm, --pnpm, --yarn');\n }\n return {\n ...options,\n };\n}\n\nexport async function resolveArgsAsync(\n argv: string[]\n): Promise<{ variadic: string[]; options: Options; extras: string[] }> {\n const { variadic, extras, flags } = parseVariadicArguments(argv);\n\n assertUnexpectedVariadicFlags(\n ['--check', '--fix', '--npm', '--pnpm', '--yarn'],\n { variadic, extras, flags },\n 'npx expo install'\n );\n\n return {\n // Variadic arguments like `npx expo install react react-dom` -> ['react', 'react-dom']\n variadic,\n options: resolveOptions({\n fix: !!flags['--fix'],\n check: !!flags['--check'],\n yarn: !!flags['--yarn'],\n npm: !!flags['--npm'],\n pnpm: !!flags['--pnpm'],\n }),\n extras,\n };\n}\n"],"names":["resolveArgsAsync","resolveOptions","options","fix","check","CommandError","npm","pnpm","yarn","filter","Boolean","length","argv","variadic","extras","flags","parseVariadicArguments","assertUnexpectedVariadicFlags"],"mappings":"AAAA;;;;QA0BsBA,gBAAgB,GAAhBA,gBAAgB;AAxBT,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AACwB,IAAA,SAAmB,WAAnB,mBAAmB,CAAA;AAWzF,SAASC,cAAc,CAACC,OAAgB,EAAW;IACjD,IAAIA,OAAO,CAACC,GAAG,IAAID,OAAO,CAACE,KAAK,EAAE;QAChC,MAAM,IAAIC,OAAY,aAAA,CAAC,UAAU,EAAE,wCAAwC,CAAC,CAAC;KAC9E;IACD,IAAI;QAACH,OAAO,CAACI,GAAG;QAAEJ,OAAO,CAACK,IAAI;QAAEL,OAAO,CAACM,IAAI;KAAC,CAACC,MAAM,CAACC,OAAO,CAAC,CAACC,MAAM,GAAG,CAAC,EAAE;
|
|
1
|
+
{"version":3,"sources":["../../../src/install/resolveOptions.ts"],"sourcesContent":["import { NodePackageManagerForProject } from '@expo/package-manager';\n\nimport { CommandError } from '../utils/errors';\nimport { assertUnexpectedVariadicFlags, parseVariadicArguments } from '../utils/variadic';\n\nexport type Options = Pick<NodePackageManagerForProject, 'npm' | 'pnpm' | 'yarn' | 'bun'> & {\n /** Check which packages need to be updated, does not install any provided packages. */\n check?: boolean;\n /** Should the dependencies be fixed automatically. */\n fix?: boolean;\n /** Should disable install output, used for commands like `prebuild` that run install internally. */\n silent?: boolean;\n};\n\nfunction resolveOptions(options: Options): Options {\n if (options.fix && options.check) {\n throw new CommandError('BAD_ARGS', 'Specify at most one of: --check, --fix');\n }\n if ([options.npm, options.pnpm, options.yarn, options.bun].filter(Boolean).length > 1) {\n throw new CommandError('BAD_ARGS', 'Specify at most one of: --npm, --pnpm, --yarn, --bun');\n }\n return {\n ...options,\n };\n}\n\nexport async function resolveArgsAsync(\n argv: string[]\n): Promise<{ variadic: string[]; options: Options; extras: string[] }> {\n const { variadic, extras, flags } = parseVariadicArguments(argv);\n\n assertUnexpectedVariadicFlags(\n ['--check', '--fix', '--npm', '--pnpm', '--yarn', '--bun'],\n { variadic, extras, flags },\n 'npx expo install'\n );\n\n return {\n // Variadic arguments like `npx expo install react react-dom` -> ['react', 'react-dom']\n variadic,\n options: resolveOptions({\n fix: !!flags['--fix'],\n check: !!flags['--check'],\n yarn: !!flags['--yarn'],\n npm: !!flags['--npm'],\n pnpm: !!flags['--pnpm'],\n bun: !!flags['--bun'],\n }),\n extras,\n };\n}\n"],"names":["resolveArgsAsync","resolveOptions","options","fix","check","CommandError","npm","pnpm","yarn","bun","filter","Boolean","length","argv","variadic","extras","flags","parseVariadicArguments","assertUnexpectedVariadicFlags"],"mappings":"AAAA;;;;QA0BsBA,gBAAgB,GAAhBA,gBAAgB;AAxBT,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AACwB,IAAA,SAAmB,WAAnB,mBAAmB,CAAA;AAWzF,SAASC,cAAc,CAACC,OAAgB,EAAW;IACjD,IAAIA,OAAO,CAACC,GAAG,IAAID,OAAO,CAACE,KAAK,EAAE;QAChC,MAAM,IAAIC,OAAY,aAAA,CAAC,UAAU,EAAE,wCAAwC,CAAC,CAAC;KAC9E;IACD,IAAI;QAACH,OAAO,CAACI,GAAG;QAAEJ,OAAO,CAACK,IAAI;QAAEL,OAAO,CAACM,IAAI;QAAEN,OAAO,CAACO,GAAG;KAAC,CAACC,MAAM,CAACC,OAAO,CAAC,CAACC,MAAM,GAAG,CAAC,EAAE;QACrF,MAAM,IAAIP,OAAY,aAAA,CAAC,UAAU,EAAE,sDAAsD,CAAC,CAAC;KAC5F;IACD,OAAO;QACL,GAAGH,OAAO;KACX,CAAC;CACH;AAEM,eAAeF,gBAAgB,CACpCa,IAAc,EACuD;IACrE,MAAM,EAAEC,QAAQ,CAAA,EAAEC,MAAM,CAAA,EAAEC,KAAK,CAAA,EAAE,GAAGC,CAAAA,GAAAA,SAAsB,AAAM,CAAA,uBAAN,CAACJ,IAAI,CAAC,AAAC;IAEjEK,CAAAA,GAAAA,SAA6B,AAI5B,CAAA,8BAJ4B,CAC3B;QAAC,SAAS;QAAE,OAAO;QAAE,OAAO;QAAE,QAAQ;QAAE,QAAQ;QAAE,OAAO;KAAC,EAC1D;QAAEJ,QAAQ;QAAEC,MAAM;QAAEC,KAAK;KAAE,EAC3B,kBAAkB,CACnB,CAAC;IAEF,OAAO;QACL,uFAAuF;QACvFF,QAAQ;QACRZ,OAAO,EAAED,cAAc,CAAC;YACtBE,GAAG,EAAE,CAAC,CAACa,KAAK,CAAC,OAAO,CAAC;YACrBZ,KAAK,EAAE,CAAC,CAACY,KAAK,CAAC,SAAS,CAAC;YACzBR,IAAI,EAAE,CAAC,CAACQ,KAAK,CAAC,QAAQ,CAAC;YACvBV,GAAG,EAAE,CAAC,CAACU,KAAK,CAAC,OAAO,CAAC;YACrBT,IAAI,EAAE,CAAC,CAACS,KAAK,CAAC,QAAQ,CAAC;YACvBP,GAAG,EAAE,CAAC,CAACO,KAAK,CAAC,OAAO,CAAC;SACtB,CAAC;QACFD,MAAM;KACP,CAAC;CACH"}
|
|
@@ -40,6 +40,7 @@ const expoPrebuild = async (argv)=>{
|
|
|
40
40
|
"--npm": Boolean,
|
|
41
41
|
"--pnpm": Boolean,
|
|
42
42
|
"--yarn": Boolean,
|
|
43
|
+
"--bun": Boolean,
|
|
43
44
|
"--no-install": Boolean,
|
|
44
45
|
"--template": String,
|
|
45
46
|
"--platform": String,
|
|
@@ -56,6 +57,7 @@ const expoPrebuild = async (argv)=>{
|
|
|
56
57
|
`--clean Delete the native folders and regenerate them before applying changes`,
|
|
57
58
|
_chalk.default`--npm Use npm to install dependencies. {dim Default when package-lock.json exists}`,
|
|
58
59
|
_chalk.default`--yarn Use Yarn to install dependencies. {dim Default when yarn.lock exists}`,
|
|
60
|
+
_chalk.default`--bun Use bun to install dependencies. {dim Default when bun.lockb exists}`,
|
|
59
61
|
_chalk.default`--pnpm Use pnpm to install dependencies. {dim Default when pnpm-lock.yaml exists}`,
|
|
60
62
|
`--template <template> Project template to clone from. File path pointing to a local tar file or a github repo`,
|
|
61
63
|
_chalk.default`-p, --platform <all|android|ios> Platforms to sync: ios, android, all. {dim Default: all}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../utils/args';\n\nexport const expoPrebuild: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clean': Boolean,\n '--npm': Boolean,\n '--pnpm': Boolean,\n '--yarn': Boolean,\n '--no-install': Boolean,\n '--template': String,\n '--platform': String,\n '--skip-dependency-update': String,\n // Aliases\n '-h': '--help',\n '-p': '--platform',\n '-t': '--type',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Create native iOS and Android project files for building natively`,\n chalk`npx expo prebuild {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `--no-install Skip installing npm packages and CocoaPods`,\n `--clean Delete the native folders and regenerate them before applying changes`,\n chalk`--npm Use npm to install dependencies. {dim Default when package-lock.json exists}`,\n chalk`--yarn Use Yarn to install dependencies. {dim Default when yarn.lock exists}`,\n chalk`--pnpm Use pnpm to install dependencies. {dim Default when pnpm-lock.yaml exists}`,\n `--template <template> Project template to clone from. File path pointing to a local tar file or a github repo`,\n chalk`-p, --platform <all|android|ios> Platforms to sync: ios, android, all. {dim Default: all}`,\n `--skip-dependency-update <dependencies> Preserves versions of listed packages in package.json (comma separated list)`,\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n // Load modules after the help prompt so `npx expo prebuild -h` shows as fast as possible.\n const [\n // ./prebuildAsync\n { prebuildAsync },\n // ./resolveOptions\n { resolvePlatformOption, resolvePackageManagerOptions, resolveSkipDependencyUpdate },\n // ../utils/errors\n { logCmdError },\n ] = await Promise.all([\n import('./prebuildAsync'),\n import('./resolveOptions'),\n import('../utils/errors'),\n ]);\n\n return (() => {\n return prebuildAsync(getProjectRoot(args), {\n // Parsed options\n clean: args['--clean'],\n\n packageManager: resolvePackageManagerOptions(args),\n install: !args['--no-install'],\n platforms: resolvePlatformOption(args['--platform']),\n // TODO: Parse\n skipDependencyUpdate: resolveSkipDependencyUpdate(args['--skip-dependency-update']),\n template: args['--template'],\n });\n })().catch(logCmdError);\n};\n"],"names":["expoPrebuild","argv","args","assertArgs","Boolean","String","printHelp","chalk","join","prebuildAsync","resolvePlatformOption","resolvePackageManagerOptions","resolveSkipDependencyUpdate","logCmdError","Promise","all","getProjectRoot","clean","packageManager","install","platforms","skipDependencyUpdate","template","catch"],"mappings":"AAAA;;;;;;AACkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAG6B,IAAA,KAAe,WAAf,eAAe,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9D,MAAMA,YAAY,GAAY,OAAOC,IAAI,GAAK;IACnD,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAU,
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../utils/args';\n\nexport const expoPrebuild: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clean': Boolean,\n '--npm': Boolean,\n '--pnpm': Boolean,\n '--yarn': Boolean,\n '--bun': Boolean,\n '--no-install': Boolean,\n '--template': String,\n '--platform': String,\n '--skip-dependency-update': String,\n // Aliases\n '-h': '--help',\n '-p': '--platform',\n '-t': '--type',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Create native iOS and Android project files for building natively`,\n chalk`npx expo prebuild {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `--no-install Skip installing npm packages and CocoaPods`,\n `--clean Delete the native folders and regenerate them before applying changes`,\n chalk`--npm Use npm to install dependencies. {dim Default when package-lock.json exists}`,\n chalk`--yarn Use Yarn to install dependencies. {dim Default when yarn.lock exists}`,\n chalk`--bun Use bun to install dependencies. {dim Default when bun.lockb exists}`,\n chalk`--pnpm Use pnpm to install dependencies. {dim Default when pnpm-lock.yaml exists}`,\n `--template <template> Project template to clone from. File path pointing to a local tar file or a github repo`,\n chalk`-p, --platform <all|android|ios> Platforms to sync: ios, android, all. {dim Default: all}`,\n `--skip-dependency-update <dependencies> Preserves versions of listed packages in package.json (comma separated list)`,\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n // Load modules after the help prompt so `npx expo prebuild -h` shows as fast as possible.\n const [\n // ./prebuildAsync\n { prebuildAsync },\n // ./resolveOptions\n { resolvePlatformOption, resolvePackageManagerOptions, resolveSkipDependencyUpdate },\n // ../utils/errors\n { logCmdError },\n ] = await Promise.all([\n import('./prebuildAsync'),\n import('./resolveOptions'),\n import('../utils/errors'),\n ]);\n\n return (() => {\n return prebuildAsync(getProjectRoot(args), {\n // Parsed options\n clean: args['--clean'],\n\n packageManager: resolvePackageManagerOptions(args),\n install: !args['--no-install'],\n platforms: resolvePlatformOption(args['--platform']),\n // TODO: Parse\n skipDependencyUpdate: resolveSkipDependencyUpdate(args['--skip-dependency-update']),\n template: args['--template'],\n });\n })().catch(logCmdError);\n};\n"],"names":["expoPrebuild","argv","args","assertArgs","Boolean","String","printHelp","chalk","join","prebuildAsync","resolvePlatformOption","resolvePackageManagerOptions","resolveSkipDependencyUpdate","logCmdError","Promise","all","getProjectRoot","clean","packageManager","install","platforms","skipDependencyUpdate","template","catch"],"mappings":"AAAA;;;;;;AACkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAG6B,IAAA,KAAe,WAAf,eAAe,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE9D,MAAMA,YAAY,GAAY,OAAOC,IAAI,GAAK;IACnD,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAU,AAmBtB,CAAA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,CAAC;QACpB;mDAAO,iBAAiB;UAAC;QACzB;mDAAO,kBAAkB;UAAC;QAC1B;mDAAO,iBAAiB;UAAC;KAC1B,CAAC,AAAC;IAEH,OAAO,CAAC,IAAM;QACZ,OAAON,aAAa,CAACO,CAAAA,GAAAA,KAAc,AAAM,CAAA,eAAN,CAACd,IAAI,CAAC,EAAE;YACzC,iBAAiB;YACjBe,KAAK,EAAEf,IAAI,CAAC,SAAS,CAAC;YAEtBgB,cAAc,EAAEP,4BAA4B,CAACT,IAAI,CAAC;YAClDiB,OAAO,EAAE,CAACjB,IAAI,CAAC,cAAc,CAAC;YAC9BkB,SAAS,EAAEV,qBAAqB,CAACR,IAAI,CAAC,YAAY,CAAC,CAAC;YACpD,cAAc;YACdmB,oBAAoB,EAAET,2BAA2B,CAACV,IAAI,CAAC,0BAA0B,CAAC,CAAC;YACnFoB,QAAQ,EAAEpB,IAAI,CAAC,YAAY,CAAC;SAC7B,CAAC,CAAC;KACJ,CAAC,EAAE,CAACqB,KAAK,CAACV,WAAW,CAAC,CAAC;CACzB,AAAC;QArEWb,YAAY,GAAZA,YAAY"}
|
|
@@ -71,7 +71,7 @@ async function prebuildAsync(projectRoot, options) {
|
|
|
71
71
|
});
|
|
72
72
|
// Install node modules
|
|
73
73
|
if (options.install) {
|
|
74
|
-
var ref, ref1, ref2, ref3;
|
|
74
|
+
var ref, ref1, ref2, ref3, ref4;
|
|
75
75
|
if (hasNewDependencies && ((ref = options.packageManager) == null ? void 0 : ref.npm)) {
|
|
76
76
|
await (0, _nodeModules).clearNodeModulesAsync(projectRoot);
|
|
77
77
|
}
|
|
@@ -79,6 +79,7 @@ async function prebuildAsync(projectRoot, options) {
|
|
|
79
79
|
npm: !!((ref1 = options.packageManager) == null ? void 0 : ref1.npm),
|
|
80
80
|
yarn: !!((ref2 = options.packageManager) == null ? void 0 : ref2.yarn),
|
|
81
81
|
pnpm: !!((ref3 = options.packageManager) == null ? void 0 : ref3.pnpm),
|
|
82
|
+
bun: !!((ref4 = options.packageManager) == null ? void 0 : ref4.bun),
|
|
82
83
|
silent: !(_env.env.EXPO_DEBUG || _env.env.CI)
|
|
83
84
|
});
|
|
84
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\n\nimport { clearNativeFolder, promptToClearMalformedNativeProjectsAsync } from './clearNativeFolder';\nimport { configureProjectAsync } from './configureProjectAsync';\nimport { ensureConfigAsync } from './ensureConfigAsync';\nimport { assertPlatforms, ensureValidPlatforms, resolveTemplateOption } from './resolveOptions';\nimport { updateFromTemplateAsync } from './updateFromTemplate';\nimport { installAsync } from '../install/installAsync';\nimport { env } from '../utils/env';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { clearNodeModulesAsync } from '../utils/nodeModules';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\n\nconst debug = require('debug')('expo:prebuild') as typeof console.log;\n\nexport type PrebuildResults = {\n /** Expo config. */\n exp: ExpoConfig;\n /** Indicates if the process created new files. */\n hasNewProjectFiles: boolean;\n /** The platforms that were prebuilt. */\n platforms: ModPlatform[];\n /** Indicates if pod install was run. */\n podInstall: boolean;\n /** Indicates if node modules were installed. */\n nodeInstall: boolean;\n};\n\n/**\n * Entry point into the prebuild process, delegates to other helpers to perform various steps.\n *\n * 0. Attempt to clean the project folders.\n * 1. Create native projects (ios, android).\n * 2. Install node modules.\n * 3. Apply config to native projects.\n * 4. Install CocoaPods.\n */\nexport async function prebuildAsync(\n projectRoot: string,\n options: {\n /** Should install node modules and cocoapods. */\n install?: boolean;\n /** List of platforms to prebuild. */\n platforms: ModPlatform[];\n /** Should delete the native folders before attempting to prebuild. */\n clean?: boolean;\n /** URL or file path to the prebuild template. */\n template?: string;\n /** Name of the node package manager to install with. */\n packageManager?: {\n npm?: boolean;\n yarn?: boolean;\n pnpm?: boolean;\n };\n /** List of node modules to skip updating. */\n skipDependencyUpdate?: string[];\n }\n): Promise<PrebuildResults | null> {\n setNodeEnv('development');\n require('@expo/env').load(projectRoot);\n\n if (options.clean) {\n const { maybeBailOnGitStatusAsync } = await import('../utils/git');\n // Clean the project folders...\n if (await maybeBailOnGitStatusAsync()) {\n return null;\n }\n // Clear the native folders before syncing\n await clearNativeFolder(projectRoot, options.platforms);\n } else {\n // Check if the existing project folders are malformed.\n await promptToClearMalformedNativeProjectsAsync(projectRoot, options.platforms);\n }\n\n // Warn if the project is attempting to prebuild an unsupported platform (iOS on Windows).\n options.platforms = ensureValidPlatforms(options.platforms);\n // Assert if no platforms are left over after filtering.\n assertPlatforms(options.platforms);\n\n // Get the Expo config, create it if missing.\n const { exp, pkg } = await ensureConfigAsync(projectRoot, { platforms: options.platforms });\n\n // Create native projects from template.\n const { hasNewProjectFiles, needsPodInstall, hasNewDependencies } = await updateFromTemplateAsync(\n projectRoot,\n {\n exp,\n pkg,\n template: options.template != null ? resolveTemplateOption(options.template) : undefined,\n platforms: options.platforms,\n skipDependencyUpdate: options.skipDependencyUpdate,\n }\n );\n\n // Install node modules\n if (options.install) {\n if (hasNewDependencies && options.packageManager?.npm) {\n await clearNodeModulesAsync(projectRoot);\n }\n\n await installAsync([], {\n npm: !!options.packageManager?.npm,\n yarn: !!options.packageManager?.yarn,\n pnpm: !!options.packageManager?.pnpm,\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n }\n\n // Apply Expo config to native projects\n const configSyncingStep = logNewSection('Config syncing');\n try {\n await profile(configureProjectAsync)(projectRoot, {\n platforms: options.platforms,\n });\n configSyncingStep.succeed('Config synced');\n } catch (error) {\n configSyncingStep.fail('Config sync failed');\n throw error;\n }\n\n // Install CocoaPods\n let podsInstalled: boolean = false;\n // err towards running pod install less because it's slow and users can easily run npx pod-install afterwards.\n if (options.platforms.includes('ios') && options.install && needsPodInstall) {\n const { installCocoaPodsAsync } = await import('../utils/cocoapods');\n\n podsInstalled = await installCocoaPodsAsync(projectRoot);\n } else {\n debug('Skipped pod install');\n }\n\n return {\n nodeInstall: !!options.install,\n podInstall: !podsInstalled,\n platforms: options.platforms,\n hasNewProjectFiles,\n exp,\n };\n}\n"],"names":["prebuildAsync","debug","require","projectRoot","options","setNodeEnv","load","clean","maybeBailOnGitStatusAsync","clearNativeFolder","platforms","promptToClearMalformedNativeProjectsAsync","ensureValidPlatforms","assertPlatforms","exp","pkg","ensureConfigAsync","hasNewProjectFiles","needsPodInstall","hasNewDependencies","updateFromTemplateAsync","template","resolveTemplateOption","undefined","skipDependencyUpdate","install","packageManager","npm","clearNodeModulesAsync","installAsync","yarn","pnpm","silent","env","EXPO_DEBUG","CI","configSyncingStep","logNewSection","profile","configureProjectAsync","succeed","error","fail","podsInstalled","includes","installCocoaPodsAsync","nodeInstall","podInstall"],"mappings":"AAAA;;;;QAuCsBA,aAAa,GAAbA,aAAa;AApC0C,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AAC5D,IAAA,sBAAyB,WAAzB,yBAAyB,CAAA;AAC7B,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AACsB,IAAA,eAAkB,WAAlB,kBAAkB,CAAA;AACvD,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACjC,IAAA,aAAyB,WAAzB,yBAAyB,CAAA;AAClC,IAAA,IAAc,WAAd,cAAc,CAAA;AACP,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACP,IAAA,YAAsB,WAAtB,sBAAsB,CAAA;AAC9B,IAAA,IAAc,WAAd,cAAc,CAAA;AACpB,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;;;;;;;;;;;;;;;;;;;;;;AAE1C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,AAAsB,AAAC;AAwB/D,eAAeF,aAAa,CACjCG,WAAmB,EACnBC,
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\n\nimport { clearNativeFolder, promptToClearMalformedNativeProjectsAsync } from './clearNativeFolder';\nimport { configureProjectAsync } from './configureProjectAsync';\nimport { ensureConfigAsync } from './ensureConfigAsync';\nimport { assertPlatforms, ensureValidPlatforms, resolveTemplateOption } from './resolveOptions';\nimport { updateFromTemplateAsync } from './updateFromTemplate';\nimport { installAsync } from '../install/installAsync';\nimport { env } from '../utils/env';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { clearNodeModulesAsync } from '../utils/nodeModules';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\n\nconst debug = require('debug')('expo:prebuild') as typeof console.log;\n\nexport type PrebuildResults = {\n /** Expo config. */\n exp: ExpoConfig;\n /** Indicates if the process created new files. */\n hasNewProjectFiles: boolean;\n /** The platforms that were prebuilt. */\n platforms: ModPlatform[];\n /** Indicates if pod install was run. */\n podInstall: boolean;\n /** Indicates if node modules were installed. */\n nodeInstall: boolean;\n};\n\n/**\n * Entry point into the prebuild process, delegates to other helpers to perform various steps.\n *\n * 0. Attempt to clean the project folders.\n * 1. Create native projects (ios, android).\n * 2. Install node modules.\n * 3. Apply config to native projects.\n * 4. Install CocoaPods.\n */\nexport async function prebuildAsync(\n projectRoot: string,\n options: {\n /** Should install node modules and cocoapods. */\n install?: boolean;\n /** List of platforms to prebuild. */\n platforms: ModPlatform[];\n /** Should delete the native folders before attempting to prebuild. */\n clean?: boolean;\n /** URL or file path to the prebuild template. */\n template?: string;\n /** Name of the node package manager to install with. */\n packageManager?: {\n npm?: boolean;\n yarn?: boolean;\n pnpm?: boolean;\n bun?: boolean;\n };\n /** List of node modules to skip updating. */\n skipDependencyUpdate?: string[];\n }\n): Promise<PrebuildResults | null> {\n setNodeEnv('development');\n require('@expo/env').load(projectRoot);\n\n if (options.clean) {\n const { maybeBailOnGitStatusAsync } = await import('../utils/git');\n // Clean the project folders...\n if (await maybeBailOnGitStatusAsync()) {\n return null;\n }\n // Clear the native folders before syncing\n await clearNativeFolder(projectRoot, options.platforms);\n } else {\n // Check if the existing project folders are malformed.\n await promptToClearMalformedNativeProjectsAsync(projectRoot, options.platforms);\n }\n\n // Warn if the project is attempting to prebuild an unsupported platform (iOS on Windows).\n options.platforms = ensureValidPlatforms(options.platforms);\n // Assert if no platforms are left over after filtering.\n assertPlatforms(options.platforms);\n\n // Get the Expo config, create it if missing.\n const { exp, pkg } = await ensureConfigAsync(projectRoot, { platforms: options.platforms });\n\n // Create native projects from template.\n const { hasNewProjectFiles, needsPodInstall, hasNewDependencies } = await updateFromTemplateAsync(\n projectRoot,\n {\n exp,\n pkg,\n template: options.template != null ? resolveTemplateOption(options.template) : undefined,\n platforms: options.platforms,\n skipDependencyUpdate: options.skipDependencyUpdate,\n }\n );\n\n // Install node modules\n if (options.install) {\n if (hasNewDependencies && options.packageManager?.npm) {\n await clearNodeModulesAsync(projectRoot);\n }\n\n await installAsync([], {\n npm: !!options.packageManager?.npm,\n yarn: !!options.packageManager?.yarn,\n pnpm: !!options.packageManager?.pnpm,\n bun: !!options.packageManager?.bun,\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n }\n\n // Apply Expo config to native projects\n const configSyncingStep = logNewSection('Config syncing');\n try {\n await profile(configureProjectAsync)(projectRoot, {\n platforms: options.platforms,\n });\n configSyncingStep.succeed('Config synced');\n } catch (error) {\n configSyncingStep.fail('Config sync failed');\n throw error;\n }\n\n // Install CocoaPods\n let podsInstalled: boolean = false;\n // err towards running pod install less because it's slow and users can easily run npx pod-install afterwards.\n if (options.platforms.includes('ios') && options.install && needsPodInstall) {\n const { installCocoaPodsAsync } = await import('../utils/cocoapods');\n\n podsInstalled = await installCocoaPodsAsync(projectRoot);\n } else {\n debug('Skipped pod install');\n }\n\n return {\n nodeInstall: !!options.install,\n podInstall: !podsInstalled,\n platforms: options.platforms,\n hasNewProjectFiles,\n exp,\n };\n}\n"],"names":["prebuildAsync","debug","require","projectRoot","options","setNodeEnv","load","clean","maybeBailOnGitStatusAsync","clearNativeFolder","platforms","promptToClearMalformedNativeProjectsAsync","ensureValidPlatforms","assertPlatforms","exp","pkg","ensureConfigAsync","hasNewProjectFiles","needsPodInstall","hasNewDependencies","updateFromTemplateAsync","template","resolveTemplateOption","undefined","skipDependencyUpdate","install","packageManager","npm","clearNodeModulesAsync","installAsync","yarn","pnpm","bun","silent","env","EXPO_DEBUG","CI","configSyncingStep","logNewSection","profile","configureProjectAsync","succeed","error","fail","podsInstalled","includes","installCocoaPodsAsync","nodeInstall","podInstall"],"mappings":"AAAA;;;;QAuCsBA,aAAa,GAAbA,aAAa;AApC0C,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AAC5D,IAAA,sBAAyB,WAAzB,yBAAyB,CAAA;AAC7B,IAAA,kBAAqB,WAArB,qBAAqB,CAAA;AACsB,IAAA,eAAkB,WAAlB,kBAAkB,CAAA;AACvD,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACjC,IAAA,aAAyB,WAAzB,yBAAyB,CAAA;AAClC,IAAA,IAAc,WAAd,cAAc,CAAA;AACP,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACP,IAAA,YAAsB,WAAtB,sBAAsB,CAAA;AAC9B,IAAA,IAAc,WAAd,cAAc,CAAA;AACpB,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;;;;;;;;;;;;;;;;;;;;;;AAE1C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,AAAsB,AAAC;AAwB/D,eAAeF,aAAa,CACjCG,WAAmB,EACnBC,OAkBC,EACgC;IACjCC,CAAAA,GAAAA,QAAU,AAAe,CAAA,WAAf,CAAC,aAAa,CAAC,CAAC;IAC1BH,OAAO,CAAC,WAAW,CAAC,CAACI,IAAI,CAACH,WAAW,CAAC,CAAC;IAEvC,IAAIC,OAAO,CAACG,KAAK,EAAE;QACjB,MAAM,EAAEC,yBAAyB,CAAA,EAAE,GAAG,MAAM;mDAAO,cAAc;UA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AlB,CAAC,gBAAgB,CAAC,AAAC;IAC1D,IAAI;QACF,MAAMC,CAAAA,GAAAA,QAAO,AAAuB,CAAA,QAAvB,CAACC,sBAAqB,sBAAA,CAAC,CAACrC,WAAW,EAAE;YAChDO,SAAS,EAAEN,OAAO,CAACM,SAAS;SAC7B,CAAC,CAAC;QACH2B,iBAAiB,CAACI,OAAO,CAAC,eAAe,CAAC,CAAC;KAC5C,CAAC,OAAOC,KAAK,EAAE;QACdL,iBAAiB,CAACM,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAC7C,MAAMD,KAAK,CAAC;KACb;IAED,oBAAoB;IACpB,IAAIE,aAAa,GAAY,KAAK,AAAC;IACnC,8GAA8G;IAC9G,IAAIxC,OAAO,CAACM,SAAS,CAACmC,QAAQ,CAAC,KAAK,CAAC,IAAIzC,OAAO,CAACqB,OAAO,IAAIP,eAAe,EAAE;QAC3E,MAAM,EAAE4B,qBAAqB,CAAA,EAAE,GAAG,MAAM;mDAAO,oBAAoB;UAAC,AAAC;QAErEF,aAAa,GAAG,MAAME,qBAAqB,CAAC3C,WAAW,CAAC,CAAC;KAC1D,MAAM;QACLF,KAAK,CAAC,qBAAqB,CAAC,CAAC;KAC9B;IAED,OAAO;QACL8C,WAAW,EAAE,CAAC,CAAC3C,OAAO,CAACqB,OAAO;QAC9BuB,UAAU,EAAE,CAACJ,aAAa;QAC1BlC,SAAS,EAAEN,OAAO,CAACM,SAAS;QAC5BO,kBAAkB;QAClBH,GAAG;KACJ,CAAC;CACH"}
|
|
@@ -45,15 +45,17 @@ function resolvePackageManagerOptions(args) {
|
|
|
45
45
|
const managers = {
|
|
46
46
|
npm: args["--npm"],
|
|
47
47
|
yarn: args["--yarn"],
|
|
48
|
-
pnpm: args["--pnpm"]
|
|
48
|
+
pnpm: args["--pnpm"],
|
|
49
|
+
bun: args["--bun"]
|
|
49
50
|
};
|
|
50
51
|
if ([
|
|
51
52
|
managers.npm,
|
|
52
53
|
managers.pnpm,
|
|
53
54
|
managers.yarn,
|
|
55
|
+
managers.bun,
|
|
54
56
|
!!args["--no-install"]
|
|
55
57
|
].filter(Boolean).length > 1) {
|
|
56
|
-
throw new _errors.CommandError("BAD_ARGS", "Specify at most one of: --no-install, --npm, --pnpm, --yarn");
|
|
58
|
+
throw new _errors.CommandError("BAD_ARGS", "Specify at most one of: --no-install, --npm, --pnpm, --yarn, --bun");
|
|
57
59
|
}
|
|
58
60
|
return managers;
|
|
59
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/resolveOptions.ts"],"sourcesContent":["import { ModPlatform } from '@expo/config-plugins';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { CommandError } from '../utils/errors';\nimport { validateUrl } from '../utils/url';\n\nexport function resolvePackageManagerOptions(args: any) {\n const managers: Record<string, boolean> = {\n npm: args['--npm'],\n yarn: args['--yarn'],\n pnpm: args['--pnpm'],\n };\n\n if (\n [managers.npm, managers.pnpm, managers.yarn, !!args['--no-install']].filter(Boolean).length > 1\n ) {\n throw new CommandError(\n 'BAD_ARGS',\n 'Specify at most one of: --no-install, --npm, --pnpm, --yarn'\n );\n }\n\n return managers;\n}\n\n/** Resolves a template option as a URL or file path pointing to a tar file. */\nexport function resolveTemplateOption(template: string) {\n if (validateUrl(template)) {\n return template;\n }\n const templatePath = path.resolve(template);\n assert(fs.existsSync(templatePath), 'template file does not exist: ' + templatePath);\n assert(\n fs.statSync(templatePath).isFile(),\n 'template must be a tar file created by running `npm pack` in a project: ' + templatePath\n );\n\n return templatePath;\n}\n\n/** Resolves dependencies to skip from a string joined by `,`. Example: `react-native,expo,lodash` */\nexport function resolveSkipDependencyUpdate(value: any) {\n if (!value || typeof value !== 'string') {\n return [];\n }\n return value.split(',');\n}\n\n/** Returns an array of platforms based on the input platform identifier and runtime constraints. */\nexport function resolvePlatformOption(\n platform: string = 'all',\n { loose }: { loose?: boolean } = {}\n): ModPlatform[] {\n switch (platform) {\n case 'ios':\n return ['ios'];\n case 'android':\n return ['android'];\n case 'all':\n return loose || process.platform !== 'win32' ? ['android', 'ios'] : ['android'];\n default:\n return [platform as ModPlatform];\n }\n}\n\n/** Warns and filters out unsupported platforms based on the runtime constraints. Essentially this means no iOS on Windows devices. */\nexport function ensureValidPlatforms(platforms: ModPlatform[]): ModPlatform[] {\n // Skip ejecting for iOS on Windows\n if (process.platform === 'win32' && platforms.includes('ios')) {\n Log.warn(\n chalk`⚠️ Skipping generating the iOS native project files. Run {bold expo eject} again from macOS or Linux to generate the iOS project.\\n`\n );\n return platforms.filter((platform) => platform !== 'ios');\n }\n return platforms;\n}\n\n/** Asserts platform length must be greater than zero. */\nexport function assertPlatforms(platforms: ModPlatform[]) {\n if (!platforms?.length) {\n throw new CommandError('At least one platform must be enabled when syncing');\n }\n}\n"],"names":["resolvePackageManagerOptions","resolveTemplateOption","resolveSkipDependencyUpdate","resolvePlatformOption","ensureValidPlatforms","assertPlatforms","Log","args","managers","npm","yarn","pnpm","filter","Boolean","length","CommandError","template","validateUrl","templatePath","path","resolve","assert","fs","existsSync","statSync","isFile","value","split","platform","loose","process","platforms","includes","warn","chalk"],"mappings":"AAAA;;;;QAUgBA,4BAA4B,GAA5BA,4BAA4B;
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/resolveOptions.ts"],"sourcesContent":["import { ModPlatform } from '@expo/config-plugins';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { CommandError } from '../utils/errors';\nimport { validateUrl } from '../utils/url';\n\nexport function resolvePackageManagerOptions(args: any) {\n const managers: Record<string, boolean> = {\n npm: args['--npm'],\n yarn: args['--yarn'],\n pnpm: args['--pnpm'],\n bun: args['--bun'],\n };\n\n if (\n [managers.npm, managers.pnpm, managers.yarn, managers.bun, !!args['--no-install']].filter(\n Boolean\n ).length > 1\n ) {\n throw new CommandError(\n 'BAD_ARGS',\n 'Specify at most one of: --no-install, --npm, --pnpm, --yarn, --bun'\n );\n }\n\n return managers;\n}\n\n/** Resolves a template option as a URL or file path pointing to a tar file. */\nexport function resolveTemplateOption(template: string) {\n if (validateUrl(template)) {\n return template;\n }\n const templatePath = path.resolve(template);\n assert(fs.existsSync(templatePath), 'template file does not exist: ' + templatePath);\n assert(\n fs.statSync(templatePath).isFile(),\n 'template must be a tar file created by running `npm pack` in a project: ' + templatePath\n );\n\n return templatePath;\n}\n\n/** Resolves dependencies to skip from a string joined by `,`. Example: `react-native,expo,lodash` */\nexport function resolveSkipDependencyUpdate(value: any) {\n if (!value || typeof value !== 'string') {\n return [];\n }\n return value.split(',');\n}\n\n/** Returns an array of platforms based on the input platform identifier and runtime constraints. */\nexport function resolvePlatformOption(\n platform: string = 'all',\n { loose }: { loose?: boolean } = {}\n): ModPlatform[] {\n switch (platform) {\n case 'ios':\n return ['ios'];\n case 'android':\n return ['android'];\n case 'all':\n return loose || process.platform !== 'win32' ? ['android', 'ios'] : ['android'];\n default:\n return [platform as ModPlatform];\n }\n}\n\n/** Warns and filters out unsupported platforms based on the runtime constraints. Essentially this means no iOS on Windows devices. */\nexport function ensureValidPlatforms(platforms: ModPlatform[]): ModPlatform[] {\n // Skip ejecting for iOS on Windows\n if (process.platform === 'win32' && platforms.includes('ios')) {\n Log.warn(\n chalk`⚠️ Skipping generating the iOS native project files. Run {bold expo eject} again from macOS or Linux to generate the iOS project.\\n`\n );\n return platforms.filter((platform) => platform !== 'ios');\n }\n return platforms;\n}\n\n/** Asserts platform length must be greater than zero. */\nexport function assertPlatforms(platforms: ModPlatform[]) {\n if (!platforms?.length) {\n throw new CommandError('At least one platform must be enabled when syncing');\n }\n}\n"],"names":["resolvePackageManagerOptions","resolveTemplateOption","resolveSkipDependencyUpdate","resolvePlatformOption","ensureValidPlatforms","assertPlatforms","Log","args","managers","npm","yarn","pnpm","bun","filter","Boolean","length","CommandError","template","validateUrl","templatePath","path","resolve","assert","fs","existsSync","statS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3B,GAAG,CAAC4B,IAAI,CACNC,MAAK,QAAA,CAAC,wIAAoI,CAAC,CAC5I,CAAC;QACF,OAAOH,SAAS,CAACnB,MAAM,CAAC,CAACgB,QAAQ,GAAKA,QAAQ,KAAK,KAAK;QAAA,CAAC,CAAC;KAC3D;IACD,OAAOG,SAAS,CAAC;CAClB;AAGM,SAAS3B,eAAe,CAAC2B,SAAwB,EAAE;IACxD,IAAI,CAACA,CAAAA,SAAS,QAAQ,GAAjBA,KAAAA,CAAiB,GAAjBA,SAAS,CAAEjB,MAAM,CAAA,EAAE;QACtB,MAAM,IAAIC,OAAY,aAAA,CAAC,oDAAoD,CAAC,CAAC;KAC9E;CACF"}
|
|
@@ -9,6 +9,7 @@ var _resolveOptions = require("./resolveOptions");
|
|
|
9
9
|
var _log = require("../../log");
|
|
10
10
|
var _gradle = require("../../start/platforms/android/gradle");
|
|
11
11
|
var _nodeEnv = require("../../utils/nodeEnv");
|
|
12
|
+
var _port = require("../../utils/port");
|
|
12
13
|
var _scheme = require("../../utils/scheme");
|
|
13
14
|
var _ensureNativeProject = require("../ensureNativeProject");
|
|
14
15
|
var _hints = require("../hints");
|
|
@@ -38,6 +39,10 @@ async function runAndroidAsync(projectRoot, { install , ...options }) {
|
|
|
38
39
|
appName: props.appName,
|
|
39
40
|
buildCache: props.buildCache
|
|
40
41
|
});
|
|
42
|
+
// Ensure the port hasn't become busy during the build.
|
|
43
|
+
if (props.shouldStartBundler && !await (0, _port).ensurePortAvailabilityAsync(projectRoot, props)) {
|
|
44
|
+
props.shouldStartBundler = false;
|
|
45
|
+
}
|
|
41
46
|
const manager = await (0, _startBundler).startBundlerAsync(projectRoot, {
|
|
42
47
|
port: props.port,
|
|
43
48
|
// If a scheme is specified then use that instead of the package name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/run/android/runAndroidAsync.ts"],"sourcesContent":["import path from 'path';\n\nimport { resolveInstallApkNameAsync } from './resolveInstallApkName';\nimport { Options, ResolvedOptions, resolveOptionsAsync } from './resolveOptions';\nimport { Log } from '../../log';\nimport { assembleAsync, installAsync } from '../../start/platforms/android/gradle';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { getSchemesForAndroidAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { startBundlerAsync } from '../startBundler';\n\nconst debug = require('debug')('expo:run:android');\n\nexport async function runAndroidAsync(projectRoot: string, { install, ...options }: Options) {\n // NOTE: This is a guess, the developer can overwrite with `NODE_ENV`.\n setNodeEnv(options.variant === 'release' ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n await ensureNativeProjectAsync(projectRoot, { platform: 'android', install });\n\n const props = await resolveOptionsAsync(projectRoot, options);\n\n debug('Package name: ' + props.packageName);\n Log.log('› Building app...');\n\n const androidProjectRoot = path.join(projectRoot, 'android');\n\n await assembleAsync(androidProjectRoot, {\n variant: props.variant,\n port: props.port,\n appName: props.appName,\n buildCache: props.buildCache,\n });\n\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n // If a scheme is specified then use that instead of the package name.\n scheme: (await getSchemesForAndroidAsync(projectRoot))?.[0],\n headless: !props.shouldStartBundler,\n });\n\n await installAppAsync(androidProjectRoot, props);\n\n await manager.getDefaultDevServer().openCustomRuntimeAsync(\n 'emulator',\n {\n applicationId: props.packageName,\n },\n { device: props.device.device }\n );\n\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n }\n}\n\nasync function installAppAsync(androidProjectRoot: string, props: ResolvedOptions) {\n // Find the APK file path\n const apkFile = await resolveInstallApkNameAsync(props.device.device, props);\n\n if (apkFile) {\n // Attempt to install the APK from the file path\n const binaryPath = path.join(props.apkVariantDirectory, apkFile);\n debug('Installing:', binaryPath);\n await props.device.installAppAsync(binaryPath);\n } else {\n // If we cannot resolve the APK file path then we can attempt to install using Gradle.\n // This offers more advanced resolution that we may not have first class support for.\n Log.log('› Failed to locate binary file, installing with Gradle...');\n await installAsync(androidProjectRoot, {\n variant: props.variant ?? 'debug',\n appName: props.appName ?? 'app',\n port: props.port,\n });\n }\n}\n"],"names":["runAndroidAsync","debug","require","projectRoot","install","options","setNodeEnv","variant","load","ensureNativeProjectAsync","platform","props","resolveOptionsAsync","packageName","Log","log","androidProjectRoot","path","join","assembleAsync","port","appName","buildCache","manager","startBundlerAsync","scheme","getSchemesForAndroidAsync","headless","
|
|
1
|
+
{"version":3,"sources":["../../../../src/run/android/runAndroidAsync.ts"],"sourcesContent":["import path from 'path';\n\nimport { resolveInstallApkNameAsync } from './resolveInstallApkName';\nimport { Options, ResolvedOptions, resolveOptionsAsync } from './resolveOptions';\nimport { Log } from '../../log';\nimport { assembleAsync, installAsync } from '../../start/platforms/android/gradle';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport { getSchemesForAndroidAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { startBundlerAsync } from '../startBundler';\n\nconst debug = require('debug')('expo:run:android');\n\nexport async function runAndroidAsync(projectRoot: string, { install, ...options }: Options) {\n // NOTE: This is a guess, the developer can overwrite with `NODE_ENV`.\n setNodeEnv(options.variant === 'release' ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n await ensureNativeProjectAsync(projectRoot, { platform: 'android', install });\n\n const props = await resolveOptionsAsync(projectRoot, options);\n\n debug('Package name: ' + props.packageName);\n Log.log('› Building app...');\n\n const androidProjectRoot = path.join(projectRoot, 'android');\n\n await assembleAsync(androidProjectRoot, {\n variant: props.variant,\n port: props.port,\n appName: props.appName,\n buildCache: props.buildCache,\n });\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n // If a scheme is specified then use that instead of the package name.\n scheme: (await getSchemesForAndroidAsync(projectRoot))?.[0],\n headless: !props.shouldStartBundler,\n });\n\n await installAppAsync(androidProjectRoot, props);\n\n await manager.getDefaultDevServer().openCustomRuntimeAsync(\n 'emulator',\n {\n applicationId: props.packageName,\n },\n { device: props.device.device }\n );\n\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n }\n}\n\nasync function installAppAsync(androidProjectRoot: string, props: ResolvedOptions) {\n // Find the APK file path\n const apkFile = await resolveInstallApkNameAsync(props.device.device, props);\n\n if (apkFile) {\n // Attempt to install the APK from the file path\n const binaryPath = path.join(props.apkVariantDirectory, apkFile);\n debug('Installing:', binaryPath);\n await props.device.installAppAsync(binaryPath);\n } else {\n // If we cannot resolve the APK file path then we can attempt to install using Gradle.\n // This offers more advanced resolution that we may not have first class support for.\n Log.log('› Failed to locate binary file, installing with Gradle...');\n await installAsync(androidProjectRoot, {\n variant: props.variant ?? 'debug',\n appName: props.appName ?? 'app',\n port: props.port,\n });\n }\n}\n"],"names":["runAndroidAsync","debug","require","projectRoot","install","options","setNodeEnv","variant","load","ensureNativeProjectAsync","platform","props","resolveOptionsAsync","packageName","Log","log","androidProjectRoot","path","join","assembleAsync","port","appName","buildCache","shouldStartBundler","ensurePortAvailabilityAsync","manager","startBundlerAsync","scheme","getSchemesForAndroidAsync","headless","installAppAsync","getDefaultDevServer","openCustomRuntimeAsync","applicationId","device","logProjectLogsLocation","apkFile","resolveInstallApkNameAsync","binaryPath","apkVariantDirectory","installAsync"],"mappings":"AAAA;;;;QAesBA,eAAe,GAAfA,eAAe;AAfpB,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEoB,IAAA,sBAAyB,WAAzB,yBAAyB,CAAA;AACN,IAAA,eAAkB,WAAlB,kBAAkB,CAAA;AAC5D,IAAA,IAAW,WAAX,WAAW,CAAA;AACa,IAAA,OAAsC,WAAtC,sCAAsC,CAAA;AACvD,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AACJ,IAAA,KAAkB,WAAl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AAIyB,OAAO,EAAE;QACX,gDAAgD;QAChD,MAAME,UAAU,GAAGrB,KAAI,QAAA,CAACC,IAAI,CAACP,KAAK,CAAC4B,mBAAmB,EAAEH,OAAO,CAAC,AAAC;QACjEnC,KAAK,CAAC,aAAa,EAAEqC,UAAU,CAAC,CAAC;QACjC,MAAM3B,KAAK,CAACuB,MAAM,CAACJ,eAAe,CAACQ,UAAU,CAAC,CAAC;KAChD,MAAM;QACL,sFAAsF;QACtF,qFAAqF;QACrFxB,IAAG,IAAA,CAACC,GAAG,CAAC,gEAA2D,CAAC,CAAC;YAE1DJ,QAAa,EACbA,QAAa;QAFxB,MAAM6B,CAAAA,GAAAA,OAAY,AAIhB,CAAA,aAJgB,CAACxB,kBAAkB,EAAE;YACrCT,OAAO,EAAEI,CAAAA,QAAa,GAAbA,KAAK,CAACJ,OAAO,YAAbI,QAAa,GAAI,OAAO;YACjCU,OAAO,EAAEV,CAAAA,QAAa,GAAbA,KAAK,CAACU,OAAO,YAAbV,QAAa,GAAI,KAAK;YAC/BS,IAAI,EAAET,KAAK,CAACS,IAAI;SACjB,CAAC,CAAC;KACJ;CACF"}
|
|
@@ -10,6 +10,7 @@ var _resolveOptions = require("./options/resolveOptions");
|
|
|
10
10
|
var Log = _interopRequireWildcard(require("../../log"));
|
|
11
11
|
var _cocoapods = require("../../utils/cocoapods");
|
|
12
12
|
var _nodeEnv = require("../../utils/nodeEnv");
|
|
13
|
+
var _port = require("../../utils/port");
|
|
13
14
|
var _profile = require("../../utils/profile");
|
|
14
15
|
var _scheme = require("../../utils/scheme");
|
|
15
16
|
var _ensureNativeProject = require("../ensureNativeProject");
|
|
@@ -60,6 +61,10 @@ async function runIosAsync(projectRoot, options) {
|
|
|
60
61
|
// Find the path to the built app binary, this will be used to install the binary
|
|
61
62
|
// on a device.
|
|
62
63
|
const binaryPath = await (0, _profile).profile(XcodeBuild.getAppBinaryPath)(buildOutput);
|
|
64
|
+
// Ensure the port hasn't become busy during the build.
|
|
65
|
+
if (props.shouldStartBundler && !await (0, _port).ensurePortAvailabilityAsync(projectRoot, props)) {
|
|
66
|
+
props.shouldStartBundler = false;
|
|
67
|
+
}
|
|
63
68
|
// Start the dev server which creates all of the required info for
|
|
64
69
|
// launching the app on a simulator.
|
|
65
70
|
const manager = await (0, _startBundler).startBundlerAsync(projectRoot, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/run/ios/runIosAsync.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport * as XcodeBuild from './XcodeBuild';\nimport { Options } from './XcodeBuild.types';\nimport { launchAppAsync } from './launchApp';\nimport { resolveOptionsAsync } from './options/resolveOptions';\nimport * as Log from '../../log';\nimport { maybePromptToSyncPodsAsync } from '../../utils/cocoapods';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { profile } from '../../utils/profile';\nimport { getSchemesForIosAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { startBundlerAsync } from '../startBundler';\n\nexport async function runIosAsync(projectRoot: string, options: Options) {\n setNodeEnv(options.configuration === 'Release' ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n assertPlatform();\n\n const install = !!options.install;\n\n if ((await ensureNativeProjectAsync(projectRoot, { platform: 'ios', install })) && install) {\n await maybePromptToSyncPodsAsync(projectRoot);\n }\n\n // Resolve the CLI arguments into useable options.\n const props = await resolveOptionsAsync(projectRoot, options);\n\n // Spawn the `xcodebuild` process to create the app binary.\n const buildOutput = await XcodeBuild.buildAsync(props);\n\n // Find the path to the built app binary, this will be used to install the binary\n // on a device.\n const binaryPath = await profile(XcodeBuild.getAppBinaryPath)(buildOutput);\n\n // Start the dev server which creates all of the required info for\n // launching the app on a simulator.\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n headless: !props.shouldStartBundler,\n // If a scheme is specified then use that instead of the package name.\n scheme: (await getSchemesForIosAsync(projectRoot))?.[0],\n });\n\n // Install and launch the app binary on a device.\n await launchAppAsync(binaryPath, manager, {\n isSimulator: props.isSimulator,\n device: props.device,\n shouldStartBundler: props.shouldStartBundler,\n });\n\n // Log the location of the JS logs for the device.\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n }\n}\n\nfunction assertPlatform() {\n if (process.platform !== 'darwin') {\n Log.exit(\n chalk`iOS apps can only be built on macOS devices. Use {cyan eas build -p ios} to build in the cloud.`\n );\n }\n}\n"],"names":["runIosAsync","XcodeBuild","Log","projectRoot","options","setNodeEnv","configuration","require","load","assertPlatform","install","ensureNativeProjectAsync","platform","maybePromptToSyncPodsAsync","props","resolveOptionsAsync","buildOutput","buildAsync","binaryPath","profile","getAppBinaryPath","manager","startBundlerAsync","port","headless","
|
|
1
|
+
{"version":3,"sources":["../../../../src/run/ios/runIosAsync.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport * as XcodeBuild from './XcodeBuild';\nimport { Options } from './XcodeBuild.types';\nimport { launchAppAsync } from './launchApp';\nimport { resolveOptionsAsync } from './options/resolveOptions';\nimport * as Log from '../../log';\nimport { maybePromptToSyncPodsAsync } from '../../utils/cocoapods';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport { profile } from '../../utils/profile';\nimport { getSchemesForIosAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { startBundlerAsync } from '../startBundler';\n\nexport async function runIosAsync(projectRoot: string, options: Options) {\n setNodeEnv(options.configuration === 'Release' ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n assertPlatform();\n\n const install = !!options.install;\n\n if ((await ensureNativeProjectAsync(projectRoot, { platform: 'ios', install })) && install) {\n await maybePromptToSyncPodsAsync(projectRoot);\n }\n\n // Resolve the CLI arguments into useable options.\n const props = await resolveOptionsAsync(projectRoot, options);\n\n // Spawn the `xcodebuild` process to create the app binary.\n const buildOutput = await XcodeBuild.buildAsync(props);\n\n // Find the path to the built app binary, this will be used to install the binary\n // on a device.\n const binaryPath = await profile(XcodeBuild.getAppBinaryPath)(buildOutput);\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n\n // Start the dev server which creates all of the required info for\n // launching the app on a simulator.\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n headless: !props.shouldStartBundler,\n // If a scheme is specified then use that instead of the package name.\n scheme: (await getSchemesForIosAsync(projectRoot))?.[0],\n });\n\n // Install and launch the app binary on a device.\n await launchAppAsync(binaryPath, manager, {\n isSimulator: props.isSimulator,\n device: props.device,\n shouldStartBundler: props.shouldStartBundler,\n });\n\n // Log the location of the JS logs for the device.\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n }\n}\n\nfunction assertPlatform() {\n if (process.platform !== 'darwin') {\n Log.exit(\n chalk`iOS apps can only be built on macOS devices. Use {cyan eas build -p ios} to build in the cloud.`\n );\n }\n}\n"],"names":["runIosAsync","XcodeBuild","Log","projectRoot","options","setNodeEnv","configuration","require","load","assertPlatform","install","ensureNativeProjectAsync","platform","maybePromptToSyncPodsAsync","props","resolveOptionsAsync","buildOutput","buildAsync","binaryPath","profile","getAppBinaryPath","shouldStartBundler","ensurePortAvailabilityAsync","manager","startBundlerAsync","port","headless","scheme","getSchemesForIosAsync","launchAppAsync","isSimulator","device","logProjectLogsLocation","process","exit","chalk"],"mappings":"AAAA;;;;QAgBsBA,WAAW,GAAXA,WAAW;AAhBf,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbC,IAAAA,UAAU,mCAAM,cAAc,EAApB;AAES,IAAA,UAAa,WAAb,aAAa,CAAA;AACR,IAAA,eAA0B,WAA1B,0BAA0B,CAAA;AAClDC,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AAC4B,IAAA,UAAuB,WAAvB,uBAAuB,CAAA;AACvC,IAAA,QAAqB,WAArB,qBAA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ports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
var _devServer = require("@expo/dev-server");
|
|
6
5
|
var _assert = _interopRequireDefault(require("assert"));
|
|
7
6
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
7
|
var _commandsTable = require("./commandsTable");
|
|
@@ -12,6 +11,7 @@ var _link = require("../../utils/link");
|
|
|
12
11
|
var _open = require("../../utils/open");
|
|
13
12
|
var _prompts = require("../../utils/prompts");
|
|
14
13
|
var _reactDevToolsProxy = require("../server/ReactDevToolsProxy");
|
|
14
|
+
var _jsInspector = require("../server/middleware/inspector/JsInspector");
|
|
15
15
|
function _interopRequireDefault(obj) {
|
|
16
16
|
return obj && obj.__esModule ? obj : {
|
|
17
17
|
default: obj
|
|
@@ -91,14 +91,14 @@ class DevServerManagerActions {
|
|
|
91
91
|
Log.log("Opening JavaScript inspector in the browser...");
|
|
92
92
|
const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();
|
|
93
93
|
(0, _assert).default(metroServerOrigin, "Metro dev server is not running");
|
|
94
|
-
const apps = await (0,
|
|
94
|
+
const apps = await (0, _jsInspector).queryAllInspectorAppsAsync(metroServerOrigin);
|
|
95
95
|
if (!apps.length) {
|
|
96
96
|
Log.warn(`No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine. ${(0, _link).learnMore("https://docs.expo.dev/guides/using-hermes/")}`);
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
try {
|
|
100
100
|
for (const app of apps){
|
|
101
|
-
await (0,
|
|
101
|
+
await (0, _jsInspector).openJsInspector(app);
|
|
102
102
|
}
|
|
103
103
|
} catch (error) {
|
|
104
104
|
Log.error("Failed to open JavaScript inspector. This is often an issue with Google Chrome.");
|