@expo/cli 56.1.16 → 57.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,14 +9,14 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ get generateFaviconAssetAsync () {
13
+ return generateFaviconAssetAsync;
14
+ },
12
15
  get getFaviconFromExpoConfigAsync () {
13
16
  return getFaviconFromExpoConfigAsync;
14
17
  },
15
18
  get getUserDefinedFaviconFile () {
16
19
  return getUserDefinedFaviconFile;
17
- },
18
- get getVirtualFaviconAssetsAsync () {
19
- return getVirtualFaviconAssetsAsync;
20
20
  }
21
21
  });
22
22
  function _config() {
@@ -33,16 +33,16 @@ function _imageutils() {
33
33
  };
34
34
  return data;
35
35
  }
36
- function _fs() {
37
- const data = /*#__PURE__*/ _interop_require_default(require("fs"));
38
- _fs = function() {
36
+ function _nodefs() {
37
+ const data = /*#__PURE__*/ _interop_require_default(require("node:fs"));
38
+ _nodefs = function() {
39
39
  return data;
40
40
  };
41
41
  return data;
42
42
  }
43
- function _path() {
44
- const data = /*#__PURE__*/ _interop_require_default(require("path"));
45
- _path = function() {
43
+ function _nodepath() {
44
+ const data = /*#__PURE__*/ _interop_require_default(require("node:path"));
45
+ _nodepath = function() {
46
46
  return data;
47
47
  };
48
48
  return data;
@@ -60,7 +60,7 @@ function getUserDefinedFaviconFile(projectRoot) {
60
60
  './favicon.ico'
61
61
  ]);
62
62
  }
63
- async function getVirtualFaviconAssetsAsync(projectRoot, { baseUrl, outputDir, files, exp }) {
63
+ async function generateFaviconAssetAsync(projectRoot, { baseUrl, outputDir, files, exp }) {
64
64
  const existing = getUserDefinedFaviconFile(projectRoot);
65
65
  if (existing) {
66
66
  debug('Using user-defined favicon.ico file.');
@@ -72,28 +72,20 @@ async function getVirtualFaviconAssetsAsync(projectRoot, { baseUrl, outputDir, f
72
72
  if (!data) {
73
73
  return null;
74
74
  }
75
- await Promise.all([
76
- data
77
- ].map(async (asset)=>{
78
- const assetPath = _path().default.join(outputDir, asset.path);
79
- if (files) {
80
- debug('Storing asset for persisting: ' + assetPath);
81
- files == null ? void 0 : files.set(asset.path, {
82
- contents: asset.source,
83
- targetDomain: 'client'
84
- });
85
- } else {
86
- debug('Writing asset to disk: ' + assetPath);
87
- await _fs().default.promises.writeFile(assetPath, asset.source);
88
- }
89
- }));
90
- function injectFaviconTag(html) {
91
- if (!html.includes('</head>')) {
92
- return html;
93
- }
94
- return html.replace('</head>', `<link rel="icon" href="${baseUrl}/favicon.ico" /></head>`);
75
+ const assetPath = _nodepath().default.join(outputDir, data.path);
76
+ if (files) {
77
+ debug('Storing asset for persisting: ' + assetPath);
78
+ files.set(data.path, {
79
+ contents: data.source,
80
+ targetDomain: 'client'
81
+ });
82
+ } else {
83
+ debug('Writing asset to disk: ' + assetPath);
84
+ await _nodefs().default.promises.writeFile(assetPath, data.source);
95
85
  }
96
- return injectFaviconTag;
86
+ return {
87
+ href: `${baseUrl}/${data.path}`
88
+ };
97
89
  }
98
90
  async function getFaviconFromExpoConfigAsync(projectRoot, { force = false, exp = (0, _config().getConfig)(projectRoot).exp } = {}) {
99
91
  var _exp_web;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/favicon.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\nimport { getConfig } from '@expo/config';\nimport { generateFaviconAsync, generateImageAsync } from '@expo/image-utils';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { getUserDefinedFile } from './publicFolder';\nimport type { ExportAssetMap } from './saveAssets';\nimport { Log } from '../log';\n\nconst debug = require('debug')('expo:favicon') as typeof console.log;\n\n/** @returns the file system path for a user-defined favicon.ico file in the public folder. */\nexport function getUserDefinedFaviconFile(projectRoot: string): string | null {\n return getUserDefinedFile(projectRoot, ['./favicon.ico']);\n}\n\nexport async function getVirtualFaviconAssetsAsync(\n projectRoot: string,\n {\n baseUrl,\n outputDir,\n files,\n exp,\n }: { outputDir: string; baseUrl: string; files?: ExportAssetMap; exp?: ExpoConfig }\n): Promise<((html: string) => string) | null> {\n const existing = getUserDefinedFaviconFile(projectRoot);\n if (existing) {\n debug('Using user-defined favicon.ico file.');\n return null;\n }\n\n const data = await getFaviconFromExpoConfigAsync(projectRoot, {\n exp,\n });\n\n if (!data) {\n return null;\n }\n\n await Promise.all(\n [data].map(async (asset) => {\n const assetPath = path.join(outputDir, asset.path);\n if (files) {\n debug('Storing asset for persisting: ' + assetPath);\n files?.set(asset.path, {\n contents: asset.source,\n targetDomain: 'client',\n });\n } else {\n debug('Writing asset to disk: ' + assetPath);\n await fs.promises.writeFile(assetPath, asset.source);\n }\n })\n );\n\n function injectFaviconTag(html: string): string {\n if (!html.includes('</head>')) {\n return html;\n }\n return html.replace('</head>', `<link rel=\"icon\" href=\"${baseUrl}/favicon.ico\" /></head>`);\n }\n\n return injectFaviconTag;\n}\n\nexport async function getFaviconFromExpoConfigAsync(\n projectRoot: string,\n { force = false, exp = getConfig(projectRoot).exp }: { force?: boolean; exp?: ExpoConfig } = {}\n) {\n const src = exp.web?.favicon ?? null;\n if (!src) {\n return null;\n }\n\n const dims = [16, 32, 48];\n const cacheType = 'favicon';\n\n const size = dims[dims.length - 1]!;\n try {\n const { source } = await generateImageAsync(\n { projectRoot, cacheType },\n {\n resizeMode: 'contain',\n src,\n backgroundColor: 'transparent',\n width: size,\n height: size,\n name: `favicon-${size}.png`,\n }\n );\n\n const faviconBuffer = await generateFaviconAsync(source, dims);\n\n return { source: faviconBuffer, path: 'favicon.ico' };\n } catch (error: any) {\n // Check for ENOENT\n if (!force && error.code === 'ENOENT') {\n Log.warn(`Favicon source file in Expo config (web.favicon) does not exist: ${src}`);\n return null;\n }\n throw error;\n }\n}\n"],"names":["getFaviconFromExpoConfigAsync","getUserDefinedFaviconFile","getVirtualFaviconAssetsAsync","debug","require","projectRoot","getUserDefinedFile","baseUrl","outputDir","files","exp","existing","data","Promise","all","map","asset","assetPath","path","join","set","contents","source","targetDomain","fs","promises","writeFile","injectFaviconTag","html","includes","replace","force","getConfig","src","web","favicon","dims","cacheType","size","length","generateImageAsync","resizeMode","backgroundColor","width","height","name","faviconBuffer","generateFaviconAsync","error","code","Log","warn"],"mappings":";;;;;;;;;;;QAkEsBA;eAAAA;;QArDNC;eAAAA;;QAIMC;eAAAA;;;;yBAhBI;;;;;;;yBAC+B;;;;;;;gEAC1C;;;;;;;gEACE;;;;;;8BAEkB;qBAEf;;;;;;AAEpB,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,SAASH,0BAA0BI,WAAmB;IAC3D,OAAOC,IAAAA,gCAAkB,EAACD,aAAa;QAAC;KAAgB;AAC1D;AAEO,eAAeH,6BACpBG,WAAmB,EACnB,EACEE,OAAO,EACPC,SAAS,EACTC,KAAK,EACLC,GAAG,EAC8E;IAEnF,MAAMC,WAAWV,0BAA0BI;IAC3C,IAAIM,UAAU;QACZR,MAAM;QACN,OAAO;IACT;IAEA,MAAMS,OAAO,MAAMZ,8BAA8BK,aAAa;QAC5DK;IACF;IAEA,IAAI,CAACE,MAAM;QACT,OAAO;IACT;IAEA,MAAMC,QAAQC,GAAG,CACf;QAACF;KAAK,CAACG,GAAG,CAAC,OAAOC;QAChB,MAAMC,YAAYC,eAAI,CAACC,IAAI,CAACX,WAAWQ,MAAME,IAAI;QACjD,IAAIT,OAAO;YACTN,MAAM,mCAAmCc;YACzCR,yBAAAA,MAAOW,GAAG,CAACJ,MAAME,IAAI,EAAE;gBACrBG,UAAUL,MAAMM,MAAM;gBACtBC,cAAc;YAChB;QACF,OAAO;YACLpB,MAAM,4BAA4Bc;YAClC,MAAMO,aAAE,CAACC,QAAQ,CAACC,SAAS,CAACT,WAAWD,MAAMM,MAAM;QACrD;IACF;IAGF,SAASK,iBAAiBC,IAAY;QACpC,IAAI,CAACA,KAAKC,QAAQ,CAAC,YAAY;YAC7B,OAAOD;QACT;QACA,OAAOA,KAAKE,OAAO,CAAC,WAAW,CAAC,uBAAuB,EAAEvB,QAAQ,uBAAuB,CAAC;IAC3F;IAEA,OAAOoB;AACT;AAEO,eAAe3B,8BACpBK,WAAmB,EACnB,EAAE0B,QAAQ,KAAK,EAAErB,MAAMsB,IAAAA,mBAAS,EAAC3B,aAAaK,GAAG,EAAyC,GAAG,CAAC,CAAC;QAEnFA;IAAZ,MAAMuB,MAAMvB,EAAAA,WAAAA,IAAIwB,GAAG,qBAAPxB,SAASyB,OAAO,KAAI;IAChC,IAAI,CAACF,KAAK;QACR,OAAO;IACT;IAEA,MAAMG,OAAO;QAAC;QAAI;QAAI;KAAG;IACzB,MAAMC,YAAY;IAElB,MAAMC,OAAOF,IAAI,CAACA,KAAKG,MAAM,GAAG,EAAE;IAClC,IAAI;QACF,MAAM,EAAEjB,MAAM,EAAE,GAAG,MAAMkB,IAAAA,gCAAkB,EACzC;YAAEnC;YAAagC;QAAU,GACzB;YACEI,YAAY;YACZR;YACAS,iBAAiB;YACjBC,OAAOL;YACPM,QAAQN;YACRO,MAAM,CAAC,QAAQ,EAAEP,KAAK,IAAI,CAAC;QAC7B;QAGF,MAAMQ,gBAAgB,MAAMC,IAAAA,kCAAoB,EAACzB,QAAQc;QAEzD,OAAO;YAAEd,QAAQwB;YAAe5B,MAAM;QAAc;IACtD,EAAE,OAAO8B,OAAY;QACnB,mBAAmB;QACnB,IAAI,CAACjB,SAASiB,MAAMC,IAAI,KAAK,UAAU;YACrCC,QAAG,CAACC,IAAI,CAAC,CAAC,iEAAiE,EAAElB,KAAK;YAClF,OAAO;QACT;QACA,MAAMe;IACR;AACF"}
1
+ {"version":3,"sources":["../../../src/export/favicon.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\nimport { getConfig } from '@expo/config';\nimport { generateFaviconAsync, generateImageAsync } from '@expo/image-utils';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { getUserDefinedFile } from './publicFolder';\nimport type { ExportAssetMap } from './saveAssets';\nimport { Log } from '../log';\n\nconst debug = require('debug')('expo:favicon') as typeof console.log;\n\n/** @returns the file system path for a user-defined favicon.ico file in the public folder. */\nexport function getUserDefinedFaviconFile(projectRoot: string): string | null {\n return getUserDefinedFile(projectRoot, ['./favicon.ico']);\n}\n\n/**\n * Generate a favicon.ico from `web.favicon` in the Expo config and write it into the asset map\n * (or to disk if no asset map is provided).\n *\n * @returns the public href for the generated favicon, or `null` when a user-supplied\n * `favicon.ico` already exists in the public folder (browsers resolve it at `/favicon.ico`\n * automatically) or when no `web.favicon` is configured.\n */\nexport async function generateFaviconAssetAsync(\n projectRoot: string,\n {\n baseUrl,\n outputDir,\n files,\n exp,\n }: { outputDir: string; baseUrl: string; files?: ExportAssetMap; exp?: ExpoConfig }\n): Promise<{ href: string } | null> {\n const existing = getUserDefinedFaviconFile(projectRoot);\n if (existing) {\n debug('Using user-defined favicon.ico file.');\n return null;\n }\n\n const data = await getFaviconFromExpoConfigAsync(projectRoot, {\n exp,\n });\n\n if (!data) {\n return null;\n }\n\n const assetPath = path.join(outputDir, data.path);\n if (files) {\n debug('Storing asset for persisting: ' + assetPath);\n files.set(data.path, {\n contents: data.source,\n targetDomain: 'client',\n });\n } else {\n debug('Writing asset to disk: ' + assetPath);\n await fs.promises.writeFile(assetPath, data.source);\n }\n\n return { href: `${baseUrl}/${data.path}` };\n}\n\nexport async function getFaviconFromExpoConfigAsync(\n projectRoot: string,\n { force = false, exp = getConfig(projectRoot).exp }: { force?: boolean; exp?: ExpoConfig } = {}\n) {\n const src = exp.web?.favicon ?? null;\n if (!src) {\n return null;\n }\n\n const dims = [16, 32, 48];\n const cacheType = 'favicon';\n\n const size = dims[dims.length - 1]!;\n try {\n const { source } = await generateImageAsync(\n { projectRoot, cacheType },\n {\n resizeMode: 'contain',\n src,\n backgroundColor: 'transparent',\n width: size,\n height: size,\n name: `favicon-${size}.png`,\n }\n );\n\n const faviconBuffer = await generateFaviconAsync(source, dims);\n\n return { source: faviconBuffer, path: 'favicon.ico' };\n } catch (error: any) {\n // Check for ENOENT\n if (!force && error.code === 'ENOENT') {\n Log.warn(`Favicon source file in Expo config (web.favicon) does not exist: ${src}`);\n return null;\n }\n throw error;\n }\n}\n"],"names":["generateFaviconAssetAsync","getFaviconFromExpoConfigAsync","getUserDefinedFaviconFile","debug","require","projectRoot","getUserDefinedFile","baseUrl","outputDir","files","exp","existing","data","assetPath","path","join","set","contents","source","targetDomain","fs","promises","writeFile","href","force","getConfig","src","web","favicon","dims","cacheType","size","length","generateImageAsync","resizeMode","backgroundColor","width","height","name","faviconBuffer","generateFaviconAsync","error","code","Log","warn"],"mappings":";;;;;;;;;;;QAyBsBA;eAAAA;;QAsCAC;eAAAA;;QAlDNC;eAAAA;;;;yBAZU;;;;;;;yBAC+B;;;;;;;gEAC1C;;;;;;;gEACE;;;;;;8BAEkB;qBAEf;;;;;;AAEpB,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,SAASF,0BAA0BG,WAAmB;IAC3D,OAAOC,IAAAA,gCAAkB,EAACD,aAAa;QAAC;KAAgB;AAC1D;AAUO,eAAeL,0BACpBK,WAAmB,EACnB,EACEE,OAAO,EACPC,SAAS,EACTC,KAAK,EACLC,GAAG,EAC8E;IAEnF,MAAMC,WAAWT,0BAA0BG;IAC3C,IAAIM,UAAU;QACZR,MAAM;QACN,OAAO;IACT;IAEA,MAAMS,OAAO,MAAMX,8BAA8BI,aAAa;QAC5DK;IACF;IAEA,IAAI,CAACE,MAAM;QACT,OAAO;IACT;IAEA,MAAMC,YAAYC,mBAAI,CAACC,IAAI,CAACP,WAAWI,KAAKE,IAAI;IAChD,IAAIL,OAAO;QACTN,MAAM,mCAAmCU;QACzCJ,MAAMO,GAAG,CAACJ,KAAKE,IAAI,EAAE;YACnBG,UAAUL,KAAKM,MAAM;YACrBC,cAAc;QAChB;IACF,OAAO;QACLhB,MAAM,4BAA4BU;QAClC,MAAMO,iBAAE,CAACC,QAAQ,CAACC,SAAS,CAACT,WAAWD,KAAKM,MAAM;IACpD;IAEA,OAAO;QAAEK,MAAM,GAAGhB,QAAQ,CAAC,EAAEK,KAAKE,IAAI,EAAE;IAAC;AAC3C;AAEO,eAAeb,8BACpBI,WAAmB,EACnB,EAAEmB,QAAQ,KAAK,EAAEd,MAAMe,IAAAA,mBAAS,EAACpB,aAAaK,GAAG,EAAyC,GAAG,CAAC,CAAC;QAEnFA;IAAZ,MAAMgB,MAAMhB,EAAAA,WAAAA,IAAIiB,GAAG,qBAAPjB,SAASkB,OAAO,KAAI;IAChC,IAAI,CAACF,KAAK;QACR,OAAO;IACT;IAEA,MAAMG,OAAO;QAAC;QAAI;QAAI;KAAG;IACzB,MAAMC,YAAY;IAElB,MAAMC,OAAOF,IAAI,CAACA,KAAKG,MAAM,GAAG,EAAE;IAClC,IAAI;QACF,MAAM,EAAEd,MAAM,EAAE,GAAG,MAAMe,IAAAA,gCAAkB,EACzC;YAAE5B;YAAayB;QAAU,GACzB;YACEI,YAAY;YACZR;YACAS,iBAAiB;YACjBC,OAAOL;YACPM,QAAQN;YACRO,MAAM,CAAC,QAAQ,EAAEP,KAAK,IAAI,CAAC;QAC7B;QAGF,MAAMQ,gBAAgB,MAAMC,IAAAA,kCAAoB,EAACtB,QAAQW;QAEzD,OAAO;YAAEX,QAAQqB;YAAezB,MAAM;QAAc;IACtD,EAAE,OAAO2B,OAAY;QACnB,mBAAmB;QACnB,IAAI,CAACjB,SAASiB,MAAMC,IAAI,KAAK,UAAU;YACrCC,QAAG,CAACC,IAAI,CAAC,CAAC,iEAAiE,EAAElB,KAAK;YAClF,OAAO;QACT;QACA,MAAMe;IACR;AACF"}
@@ -12,6 +12,9 @@ _export(exports, {
12
12
  get clearNativeFolder () {
13
13
  return clearNativeFolder;
14
14
  },
15
+ get getExistingNativePlatformsAsync () {
16
+ return getExistingNativePlatformsAsync;
17
+ },
15
18
  get getMalformedNativeProjectsAsync () {
16
19
  return getMalformedNativeProjectsAsync;
17
20
  },
@@ -152,13 +155,7 @@ async function hasRequiredIOSFilesAsync(projectRoot) {
152
155
  return false;
153
156
  }
154
157
  }
155
- /**
156
- * Filter out platforms that do not have an existing platform folder.
157
- * If the user wants to validate that neither of ['ios', 'android'] are malformed then we should
158
- * first check that both `ios` and `android` folders exist.
159
- *
160
- * This optimization prevents us from prompting to clear a "malformed" project that doesn't exist yet.
161
- */ async function filterPlatformsThatDoNotExistAsync(projectRoot, platforms) {
158
+ async function getExistingNativePlatformsAsync(projectRoot, platforms) {
162
159
  const valid = await Promise.all(platforms.map(async (platform)=>{
163
160
  if (await (0, _dir.directoryExistsAsync)(_path().default.join(projectRoot, platform))) {
164
161
  return platform;
@@ -173,7 +170,7 @@ async function getMalformedNativeProjectsAsync(projectRoot, platforms) {
173
170
  ios: hasRequiredIOSFilesAsync
174
171
  };
175
172
  const checkablePlatforms = platforms.filter((platform)=>platform in VERIFIERS);
176
- const checkPlatforms = await filterPlatformsThatDoNotExistAsync(projectRoot, checkablePlatforms);
173
+ const checkPlatforms = await getExistingNativePlatformsAsync(projectRoot, checkablePlatforms);
177
174
  return (await Promise.all(checkPlatforms.map(async (platform)=>{
178
175
  if (!VERIFIERS[platform]) {
179
176
  return false;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/prebuild/clearNativeFolder.ts"],"sourcesContent":["import type { ModPlatform } from '@expo/config-plugins';\nimport { AndroidConfig, IOSConfig } from '@expo/config-plugins';\nimport chalk from 'chalk';\nimport { isNativeModuleAsync } from 'expo/internal/unstable-autolinking-exports';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { directoryExistsAsync } from '../utils/dir';\nimport { isInteractive } from '../utils/interactive';\nimport { logNewSection } from '../utils/ora';\nimport { confirmAsync } from '../utils/prompts';\n\ntype ArbitraryPlatform = ModPlatform | string;\n\n/** Delete the input native folders and print a loading step. */\nexport async function clearNativeFolder(projectRoot: string, folders: string[]) {\n const step = logNewSection(`Clearing ${folders.join(', ')}`);\n try {\n await Promise.all(\n folders.map((folderName) =>\n fs.promises.rm(path.join(projectRoot, folderName), {\n recursive: true,\n force: true,\n })\n )\n );\n step.succeed(`Cleared ${folders.join(', ')} code`);\n } catch (error: any) {\n step.fail(`Failed to delete ${folders.join(', ')} code: ${error.message}`);\n throw error;\n }\n}\n\n/**\n * Returns `true` if a certain subset of required Android project files are intact.\n *\n * This isn't perfect but it serves the purpose of indicating that the user should\n * be warned to nuke the project files, most commonly when git is cleared and the root folder\n * remains in memory.\n */\nexport async function hasRequiredAndroidFilesAsync(projectRoot: string): Promise<boolean> {\n try {\n await Promise.all([\n AndroidConfig.Paths.getAppBuildGradleAsync(projectRoot),\n AndroidConfig.Paths.getProjectBuildGradleAsync(projectRoot),\n AndroidConfig.Paths.getAndroidManifestAsync(projectRoot),\n AndroidConfig.Paths.getMainApplicationAsync(projectRoot),\n ]);\n return true;\n } catch {\n return false;\n }\n}\n\n/** Returns `true` if a certain subset of required iOS project files are intact. */\nexport async function hasRequiredIOSFilesAsync(projectRoot: string) {\n try {\n // If any of the following required files are missing, then the project is malformed.\n await Promise.all([\n IOSConfig.Paths.getAllXcodeProjectPaths(projectRoot),\n IOSConfig.Paths.getAllPBXProjectPaths(projectRoot),\n ]);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Filter out platforms that do not have an existing platform folder.\n * If the user wants to validate that neither of ['ios', 'android'] are malformed then we should\n * first check that both `ios` and `android` folders exist.\n *\n * This optimization prevents us from prompting to clear a \"malformed\" project that doesn't exist yet.\n */\nasync function filterPlatformsThatDoNotExistAsync(\n projectRoot: string,\n platforms: ArbitraryPlatform[]\n): Promise<ArbitraryPlatform[]> {\n const valid = await Promise.all(\n platforms.map(async (platform) => {\n if (await directoryExistsAsync(path.join(projectRoot, platform))) {\n return platform;\n }\n return null;\n })\n );\n return valid.filter(Boolean) as ArbitraryPlatform[];\n}\n\n/** Get a list of native platforms that have existing directories which contain malformed projects. */\nexport async function getMalformedNativeProjectsAsync(\n projectRoot: string,\n platforms: ArbitraryPlatform[]\n): Promise<ArbitraryPlatform[]> {\n const VERIFIERS: Record<ArbitraryPlatform, (root: string) => Promise<boolean>> = {\n android: hasRequiredAndroidFilesAsync,\n ios: hasRequiredIOSFilesAsync,\n };\n\n const checkablePlatforms = platforms.filter((platform) => platform in VERIFIERS);\n const checkPlatforms = await filterPlatformsThatDoNotExistAsync(projectRoot, checkablePlatforms);\n return (\n await Promise.all(\n checkPlatforms.map(async (platform) => {\n if (!VERIFIERS[platform]) {\n return false;\n }\n if (await VERIFIERS[platform](projectRoot)) {\n return false;\n }\n return platform;\n })\n )\n ).filter(Boolean) as ArbitraryPlatform[];\n}\n\nexport async function promptToClearMalformedNativeProjectsAsync(\n projectRoot: string,\n checkPlatforms: ArbitraryPlatform[]\n) {\n const platforms = await getMalformedNativeProjectsAsync(projectRoot, checkPlatforms);\n\n if (!platforms.length) {\n return;\n } else if (await maybeBailOnNativeModuleAsync(projectRoot)) {\n return;\n }\n\n const displayPlatforms = platforms.map((platform) => chalk.cyan(platform));\n // Prompt which platforms to reset.\n const message =\n platforms.length > 1\n ? `The ${displayPlatforms[0]} and ${displayPlatforms[1]} projects are malformed`\n : `The ${displayPlatforms[0]} project is malformed`;\n\n if (\n // If the process is non-interactive, default to clearing the malformed native project.\n // This would only happen on re-running prebuild.\n !isInteractive() ||\n // Prompt to clear the native folders.\n (await confirmAsync({\n message: `${message}, would you like to clear the project files and reinitialize them?`,\n initial: true,\n }))\n ) {\n if (!isInteractive()) {\n Log.warn(`${message}, project files will be cleared and reinitialized.`);\n }\n await clearNativeFolder(projectRoot, platforms);\n } else {\n // Warn the user that the process may fail.\n Log.warn('Continuing with malformed native projects');\n }\n}\n\nexport async function maybeBailOnNativeModuleAsync(projectRoot: string) {\n let isNativeModule = false;\n try {\n isNativeModule = await isNativeModuleAsync(projectRoot);\n } catch {\n // We don't care too much about a failure here\n // TODO(@kitten): Remove try/catch; this is only to protect against version misalignment\n // Remove this when we're bumping to SDK 56\n }\n if (isNativeModule) {\n if (!isInteractive()) {\n Log.warn(\n `Current project was detected as a native module, but the command will continue because the terminal is not interactive.`\n );\n return false;\n } else {\n Log.warn('Current project was detected as a native module and not an Expo app.');\n }\n\n const answer = await confirmAsync({\n message: `Continue anyway?`,\n });\n if (!answer) {\n return true;\n }\n\n Log.log();\n }\n\n return false;\n}\n"],"names":["clearNativeFolder","getMalformedNativeProjectsAsync","hasRequiredAndroidFilesAsync","hasRequiredIOSFilesAsync","maybeBailOnNativeModuleAsync","promptToClearMalformedNativeProjectsAsync","projectRoot","folders","step","logNewSection","join","Promise","all","map","folderName","fs","promises","rm","path","recursive","force","succeed","error","fail","message","AndroidConfig","Paths","getAppBuildGradleAsync","getProjectBuildGradleAsync","getAndroidManifestAsync","getMainApplicationAsync","IOSConfig","getAllXcodeProjectPaths","getAllPBXProjectPaths","filterPlatformsThatDoNotExistAsync","platforms","valid","platform","directoryExistsAsync","filter","Boolean","VERIFIERS","android","ios","checkablePlatforms","checkPlatforms","length","displayPlatforms","chalk","cyan","isInteractive","confirmAsync","initial","Log","warn","isNativeModule","isNativeModuleAsync","answer","log"],"mappings":";;;;;;;;;;;QAgBsBA;eAAAA;;QA4EAC;eAAAA;;QAnDAC;eAAAA;;QAeAC;eAAAA;;QAqGAC;eAAAA;;QAvCAC;eAAAA;;;;yBArHmB;;;;;;;gEACvB;;;;;;;yBACkB;;;;;;;gEACrB;;;;;;;gEACE;;;;;;6DAEI;qBACgB;6BACP;qBACA;yBACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKtB,eAAeL,kBAAkBM,WAAmB,EAAEC,OAAiB;IAC5E,MAAMC,OAAOC,IAAAA,kBAAa,EAAC,CAAC,SAAS,EAAEF,QAAQG,IAAI,CAAC,OAAO;IAC3D,IAAI;QACF,MAAMC,QAAQC,GAAG,CACfL,QAAQM,GAAG,CAAC,CAACC,aACXC,aAAE,CAACC,QAAQ,CAACC,EAAE,CAACC,eAAI,CAACR,IAAI,CAACJ,aAAaQ,aAAa;gBACjDK,WAAW;gBACXC,OAAO;YACT;QAGJZ,KAAKa,OAAO,CAAC,CAAC,QAAQ,EAAEd,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ACFA,iBAAiB,MAAMC,IAAAA,iDAAmB,EAAClD;IAC7C,EAAE,OAAM;IACN,8CAA8C;IAC9C,wFAAwF;IACxF,2CAA2C;IAC7C;IACA,IAAIiD,gBAAgB;QAClB,IAAI,CAACL,IAAAA,0BAAa,KAAI;YACpBG,KAAIC,IAAI,CACN,CAAC,uHAAuH,CAAC;YAE3H,OAAO;QACT,OAAO;YACLD,KAAIC,IAAI,CAAC;QACX;QAEA,MAAMG,SAAS,MAAMN,IAAAA,qBAAY,EAAC;YAChC3B,SAAS,CAAC,gBAAgB,CAAC;QAC7B;QACA,IAAI,CAACiC,QAAQ;YACX,OAAO;QACT;QAEAJ,KAAIK,GAAG;IACT;IAEA,OAAO;AACT"}
1
+ {"version":3,"sources":["../../../src/prebuild/clearNativeFolder.ts"],"sourcesContent":["import type { ModPlatform } from '@expo/config-plugins';\nimport { AndroidConfig, IOSConfig } from '@expo/config-plugins';\nimport chalk from 'chalk';\nimport { isNativeModuleAsync } from 'expo/internal/unstable-autolinking-exports';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../log';\nimport { directoryExistsAsync } from '../utils/dir';\nimport { isInteractive } from '../utils/interactive';\nimport { logNewSection } from '../utils/ora';\nimport { confirmAsync } from '../utils/prompts';\n\ntype ArbitraryPlatform = ModPlatform | string;\n\n/** Delete the input native folders and print a loading step. */\nexport async function clearNativeFolder(projectRoot: string, folders: string[]) {\n const step = logNewSection(`Clearing ${folders.join(', ')}`);\n try {\n await Promise.all(\n folders.map((folderName) =>\n fs.promises.rm(path.join(projectRoot, folderName), {\n recursive: true,\n force: true,\n })\n )\n );\n step.succeed(`Cleared ${folders.join(', ')} code`);\n } catch (error: any) {\n step.fail(`Failed to delete ${folders.join(', ')} code: ${error.message}`);\n throw error;\n }\n}\n\n/**\n * Returns `true` if a certain subset of required Android project files are intact.\n *\n * This isn't perfect but it serves the purpose of indicating that the user should\n * be warned to nuke the project files, most commonly when git is cleared and the root folder\n * remains in memory.\n */\nexport async function hasRequiredAndroidFilesAsync(projectRoot: string): Promise<boolean> {\n try {\n await Promise.all([\n AndroidConfig.Paths.getAppBuildGradleAsync(projectRoot),\n AndroidConfig.Paths.getProjectBuildGradleAsync(projectRoot),\n AndroidConfig.Paths.getAndroidManifestAsync(projectRoot),\n AndroidConfig.Paths.getMainApplicationAsync(projectRoot),\n ]);\n return true;\n } catch {\n return false;\n }\n}\n\n/** Returns `true` if a certain subset of required iOS project files are intact. */\nexport async function hasRequiredIOSFilesAsync(projectRoot: string) {\n try {\n // If any of the following required files are missing, then the project is malformed.\n await Promise.all([\n IOSConfig.Paths.getAllXcodeProjectPaths(projectRoot),\n IOSConfig.Paths.getAllPBXProjectPaths(projectRoot),\n ]);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Returns the subset of `platforms` that have an existing native folder on disk.\n *\n * Used to avoid prompting to clear a \"malformed\" project that doesn't exist yet, and to gate the\n * clean-by-default guards so a first-ever prebuild doesn't run the git status check.\n */\nexport async function getExistingNativePlatformsAsync(\n projectRoot: string,\n platforms: ArbitraryPlatform[]\n): Promise<ArbitraryPlatform[]> {\n const valid = await Promise.all(\n platforms.map(async (platform) => {\n if (await directoryExistsAsync(path.join(projectRoot, platform))) {\n return platform;\n }\n return null;\n })\n );\n return valid.filter(Boolean) as ArbitraryPlatform[];\n}\n\n/** Get a list of native platforms that have existing directories which contain malformed projects. */\nexport async function getMalformedNativeProjectsAsync(\n projectRoot: string,\n platforms: ArbitraryPlatform[]\n): Promise<ArbitraryPlatform[]> {\n const VERIFIERS: Record<ArbitraryPlatform, (root: string) => Promise<boolean>> = {\n android: hasRequiredAndroidFilesAsync,\n ios: hasRequiredIOSFilesAsync,\n };\n\n const checkablePlatforms = platforms.filter((platform) => platform in VERIFIERS);\n const checkPlatforms = await getExistingNativePlatformsAsync(projectRoot, checkablePlatforms);\n return (\n await Promise.all(\n checkPlatforms.map(async (platform) => {\n if (!VERIFIERS[platform]) {\n return false;\n }\n if (await VERIFIERS[platform](projectRoot)) {\n return false;\n }\n return platform;\n })\n )\n ).filter(Boolean) as ArbitraryPlatform[];\n}\n\nexport async function promptToClearMalformedNativeProjectsAsync(\n projectRoot: string,\n checkPlatforms: ArbitraryPlatform[]\n) {\n const platforms = await getMalformedNativeProjectsAsync(projectRoot, checkPlatforms);\n\n if (!platforms.length) {\n return;\n } else if (await maybeBailOnNativeModuleAsync(projectRoot)) {\n return;\n }\n\n const displayPlatforms = platforms.map((platform) => chalk.cyan(platform));\n // Prompt which platforms to reset.\n const message =\n platforms.length > 1\n ? `The ${displayPlatforms[0]} and ${displayPlatforms[1]} projects are malformed`\n : `The ${displayPlatforms[0]} project is malformed`;\n\n if (\n // If the process is non-interactive, default to clearing the malformed native project.\n // This would only happen on re-running prebuild.\n !isInteractive() ||\n // Prompt to clear the native folders.\n (await confirmAsync({\n message: `${message}, would you like to clear the project files and reinitialize them?`,\n initial: true,\n }))\n ) {\n if (!isInteractive()) {\n Log.warn(`${message}, project files will be cleared and reinitialized.`);\n }\n await clearNativeFolder(projectRoot, platforms);\n } else {\n // Warn the user that the process may fail.\n Log.warn('Continuing with malformed native projects');\n }\n}\n\nexport async function maybeBailOnNativeModuleAsync(projectRoot: string) {\n let isNativeModule = false;\n try {\n isNativeModule = await isNativeModuleAsync(projectRoot);\n } catch {\n // We don't care too much about a failure here\n // TODO(@kitten): Remove try/catch; this is only to protect against version misalignment\n // Remove this when we're bumping to SDK 56\n }\n if (isNativeModule) {\n if (!isInteractive()) {\n Log.warn(\n `Current project was detected as a native module, but the command will continue because the terminal is not interactive.`\n );\n return false;\n } else {\n Log.warn('Current project was detected as a native module and not an Expo app.');\n }\n\n const answer = await confirmAsync({\n message: `Continue anyway?`,\n });\n if (!answer) {\n return true;\n }\n\n Log.log();\n }\n\n return false;\n}\n"],"names":["clearNativeFolder","getExistingNativePlatformsAsync","getMalformedNativeProjectsAsync","hasRequiredAndroidFilesAsync","hasRequiredIOSFilesAsync","maybeBailOnNativeModuleAsync","promptToClearMalformedNativeProjectsAsync","projectRoot","folders","step","logNewSection","join","Promise","all","map","folderName","fs","promises","rm","path","recursive","force","succeed","error","fail","message","AndroidConfig","Paths","getAppBuildGradleAsync","getProjectBuildGradleAsync","getAndroidManifestAsync","getMainApplicationAsync","IOSConfig","getAllXcodeProjectPaths","getAllPBXProjectPaths","platforms","valid","platform","directoryExistsAsync","filter","Boolean","VERIFIERS","android","ios","checkablePlatforms","checkPlatforms","length","displayPlatforms","chalk","cyan","isInteractive","confirmAsync","initial","Log","warn","isNativeModule","isNativeModuleAsync","answer","log"],"mappings":";;;;;;;;;;;QAgBsBA;eAAAA;;QA2DAC;eAAAA;;QAgBAC;eAAAA;;QAlDAC;eAAAA;;QAeAC;eAAAA;;QAoGAC;eAAAA;;QAvCAC;eAAAA;;;;yBApHmB;;;;;;;gEACvB;;;;;;;yBACkB;;;;;;;gEACrB;;;;;;;gEACE;;;;;;6DAEI;qBACgB;6BACP;qBACA;yBACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKtB,eAAeN,kBAAkBO,WAAmB,EAAEC,OAAiB;IAC5E,MAAMC,OAAOC,IAAAA,kBAAa,EAAC,CAAC,SAAS,EAAEF,QAAQG,IAAI,CAAC,OAAO;IAC3D,IAAI;QACF,MAAMC,QAAQC,GAAG,CACfL,QAAQM,GAAG,CAAC,CAACC,aACXC,aAAE,CAACC,QAAQ,CAACC,EAAE,CAACC,eAAI,CAACR,IAAI,CAACJ,aAAaQ,aAAa;gBACjDK,WAAW;gBACXC,OAAO;YACT;QAGJZ,KAAKa,OAAO,CAAC,CAAC,QAAQ,EAAEd,QAAQG,IAAI,CAAC,MAAM,KAAK,CAAC;IACnD,EAAE,OAAOY,OAAY;QACnBd,KAAKe,IAAI,CAAC,CAAC,iBAAiB,EAAEhB,QAAQG,IAAI,CAAC,MAAM,OAAO,EAAEY,MAAME,OAAO,EAAE;QACzE,MAAMF;IACR;AACF;AASO,eAAepB,6BAA6BI,WAAmB;IACpE,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O;YACLD,KAAIC,IAAI,CAAC;QACX;QAEA,MAAMG,SAAS,MAAMN,IAAAA,qBAAY,EAAC;YAChC1B,SAAS,CAAC,gBAAgB,CAAC;QAC7B;QACA,IAAI,CAACgC,QAAQ;YACX,OAAO;QACT;QAEAJ,KAAIK,GAAG;IACT;IAEA,OAAO;AACT"}
@@ -68,6 +68,7 @@ const expoPrebuild = async (argv)=>{
68
68
  // Types
69
69
  '--help': Boolean,
70
70
  '--clean': Boolean,
71
+ '--no-clean': Boolean,
71
72
  '--npm': Boolean,
72
73
  '--pnpm': Boolean,
73
74
  '--yarn': Boolean,
@@ -85,7 +86,7 @@ const expoPrebuild = async (argv)=>{
85
86
  (0, _args.printHelp)(`Create native iOS and Android project files for building natively`, (0, _chalk().default)`npx expo prebuild {dim <dir>}`, [
86
87
  (0, _chalk().default)`<dir> Directory of the Expo project. {dim Default: Current working directory}`,
87
88
  `--no-install Skip installing npm packages and CocoaPods`,
88
- `--clean Delete the native folders and regenerate them before applying changes`,
89
+ `--no-clean Apply changes to the existing native folders instead of recreating them`,
89
90
  (0, _chalk().default)`--npm Use npm to install dependencies. {dim Default when package-lock.json exists}`,
90
91
  (0, _chalk().default)`--yarn Use Yarn to install dependencies. {dim Default when yarn.lock exists}`,
91
92
  (0, _chalk().default)`--bun Use bun to install dependencies. {dim Default when bun.lock or bun.lockb exists}`,
@@ -108,7 +109,7 @@ const expoPrebuild = async (argv)=>{
108
109
  return (()=>{
109
110
  return prebuildAsync((0, _args.getProjectRoot)(args), {
110
111
  // Parsed options
111
- clean: args['--clean'],
112
+ clean: !args['--no-clean'],
112
113
  packageManager: resolvePackageManagerOptions(args),
113
114
  install: !args['--no-install'],
114
115
  platforms: resolvePlatformOption(args['--platform']),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/prebuild/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport type { 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.lock or 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, npm package 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.js'),\n import('./resolveOptions.js'),\n import('../utils/errors.js'),\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":";;;;;+BAMaA;;;eAAAA;;;;gEALK;;;;;;sBAGoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/C,MAAMA,eAAwB,OAAOC;IAC1C,MAAMC,OAAOC,IAAAA,gBAAU,EACrB;QACE,QAAQ;QACR,UAAUC;QACV,WAAWA;QACX,SAASA;QACT,UAAUA;QACV,UAAUA;QACV,SAASA;QACT,gBAAgBA;QAChB,cAAcC;QACd,cAAcA;QACd,4BAA4BA;QAC5B,UAAU;QACV,MAAM;QACN,MAAM;QACN,MAAM;IACR,GACAJ;IAGF,IAAIC,IAAI,CAAC,SAAS,EAAE;QAClBI,IAAAA,eAAS,EACP,CAAC,iEAAiE,CAAC,EACnEC,IAAAA,gBAAK,CAAA,CAAC,6BAA6B,CAAC,EACpC;YACEA,IAAAA,gBAAK,CAAA,CAAC,gHAAgH,CAAC;YACvH,CAAC,mFAAmF,CAAC;YACrF,CAAC,8GAA8G,CAAC;YAChHA,IAAAA,gBAAK,CAAA,CAAC,qHAAqH,CAAC;YAC5HA,IAAAA,gBAAK,CAAA,CAAC,8GAA8G,CAAC;YACrHA,IAAAA,gBAAK,CAAA,CAAC,yHAAyH,CAAC;YAChIA,IAAAA,gBAAK,CAAA,CAAC,mHAAmH,CAAC;YAC1H,CAAC,6IAA6I,CAAC;YAC/IA,IAAAA,gBAAK,CAAA,CAAC,iGAAiG,CAAC;YACxG,CAAC,qHAAqH,CAAC;YACvH,CAAC,mDAAmD,CAAC;SACtD,CAACC,IAAI,CAAC;IAEX;IAEA,0FAA0F;IAC1F,MAAM,CACJ,kBAAkB;IAClB,EAAEC,aAAa,EAAE,EACjB,mBAAmB;IACnB,EAAEC,qBAAqB,EAAEC,4BAA4B,EAAEC,2BAA2B,EAAE,EACpF,kBAAkB;IAClB,EAAEC,WAAW,EAAE,CAChB,GAAG,MAAMC,QAAQC,GAAG,CAAC;QACpB,mEAAA,QAAO;QACP,mEAAA,QAAO;QACP,mEAAA,QAAO;KACR;IAED,OAAO,AAAC,CAAA;QACN,OAAON,cAAcO,IAAAA,oBAAc,EAACd,OAAO;YACzC,iBAAiB;YACjBe,OAAOf,IAAI,CAAC,UAAU;YAEtBgB,gBAAgBP,6BAA6BT;YAC7CiB,SAAS,CAACjB,IAAI,CAAC,eAAe;YAC9BkB,WAAWV,sBAAsBR,IAAI,CAAC,aAAa;YACnD,cAAc;YACdmB,sBAAsBT,4BAA4BV,IAAI,CAAC,2BAA2B;YAClFoB,UAAUpB,IAAI,CAAC,aAAa;QAC9B;IACF,CAAA,IAAKqB,KAAK,CAACV;AACb"}
1
+ {"version":3,"sources":["../../../src/prebuild/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport type { 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 '--no-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 `--no-clean Apply changes to the existing native folders instead of recreating them`,\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.lock or 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, npm package 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.js'),\n import('./resolveOptions.js'),\n import('../utils/errors.js'),\n ]);\n\n return (() => {\n return prebuildAsync(getProjectRoot(args), {\n // Parsed options\n clean: !args['--no-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":";;;;;+BAMaA;;;eAAAA;;;;gEALK;;;;;;sBAGoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/C,MAAMA,eAAwB,OAAOC;IAC1C,MAAMC,OAAOC,IAAAA,gBAAU,EACrB;QACE,QAAQ;QACR,UAAUC;QACV,WAAWA;QACX,cAAcA;Q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sBAAsBR,IAAI,CAAC,aAAa;YACnD,cAAc;YACdmB,sBAAsBT,4BAA4BV,IAAI,CAAC,2BAA2B;YAClFoB,UAAUpB,IAAI,CAAC,aAAa;QAC9B;IACF,CAAA,IAAKqB,KAAK,CAACV;AACb"}
@@ -105,17 +105,22 @@ async function prebuildAsync(projectRoot, options) {
105
105
  }
106
106
  }
107
107
  if (options.clean) {
108
- const { maybeBailOnGitStatusAsync } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../utils/git.js")));
109
- // Clean the project folders...
110
- if (await maybeBailOnGitStatusAsync()) {
111
- return null;
112
- }
113
- // Check if the target project is actually a native module, which we don't want to erase
114
- if (await (0, _clearNativeFolder.maybeBailOnNativeModuleAsync)(projectRoot)) {
115
- return null;
108
+ // Only run the destructive-path guards when there are native folders to delete, so a
109
+ // first-ever prebuild doesn't prompt on git status or native module detection.
110
+ const existingPlatforms = await (0, _clearNativeFolder.getExistingNativePlatformsAsync)(projectRoot, options.platforms);
111
+ if (existingPlatforms.length) {
112
+ const { maybeBailOnGitStatusAsync } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../utils/git.js")));
113
+ // Clean the project folders...
114
+ if (await maybeBailOnGitStatusAsync()) {
115
+ return null;
116
+ }
117
+ // Check if the target project is actually a native module, which we don't want to erase
118
+ if (await (0, _clearNativeFolder.maybeBailOnNativeModuleAsync)(projectRoot)) {
119
+ return null;
120
+ }
121
+ // Clear the native folders before syncing
122
+ await (0, _clearNativeFolder.clearNativeFolder)(projectRoot, options.platforms);
116
123
  }
117
- // Clear the native folders before syncing
118
- await (0, _clearNativeFolder.clearNativeFolder)(projectRoot, options.platforms);
119
124
  } else {
120
125
  // Check if the existing project folders are malformed.
121
126
  await (0, _clearNativeFolder.promptToClearMalformedNativeProjectsAsync)(projectRoot, options.platforms);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\nimport { getConfig } from '@expo/config';\nimport type { ModPlatform } from '@expo/config-plugins';\nimport { updateXcodeProject } from '@expo/inline-modules';\nimport chalk from 'chalk';\n\nimport {\n clearNativeFolder,\n promptToClearMalformedNativeProjectsAsync,\n maybeBailOnNativeModuleAsync,\n} 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 { Log } from '../log';\nimport { env } from '../utils/env';\nimport { setNodeEnv, loadEnvFiles } from '../utils/nodeEnv';\nimport { clearNodeModulesAsync } from '../utils/nodeModules';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\nimport { confirmAsync } from '../utils/prompts';\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 loadEnvFiles(projectRoot);\n\n const { platforms } = getConfig(projectRoot).exp;\n if (platforms?.length) {\n // Filter out platforms that aren't in the app.json.\n const finalPlatforms = options.platforms.filter((platform) => platforms.includes(platform));\n if (finalPlatforms.length > 0) {\n options.platforms = finalPlatforms;\n } else {\n const requestedPlatforms = options.platforms.join(', ');\n Log.warn(\n chalk`⚠️ Requested prebuild for \"${requestedPlatforms}\", but only \"${platforms.join(', ')}\" is present in app config (\"expo.platforms\" entry). Continuing with \"${requestedPlatforms}\".`\n );\n }\n }\n if (options.clean) {\n const { maybeBailOnGitStatusAsync } = await import('../utils/git.js');\n // Clean the project folders...\n if (await maybeBailOnGitStatusAsync()) {\n return null;\n }\n // Check if the target project is actually a native module, which we don't want to erase\n if (await maybeBailOnNativeModuleAsync(projectRoot)) {\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, templateChecksum, changedDependencies } =\n await updateFromTemplateAsync(projectRoot, {\n exp,\n pkg,\n template: options.template != null ? resolveTemplateOption(options.template) : undefined,\n platforms: options.platforms,\n skipDependencyUpdate: options.skipDependencyUpdate,\n });\n\n // Install node modules\n if (options.install) {\n if (changedDependencies.length) {\n if (options.packageManager?.npm) {\n await clearNodeModulesAsync(projectRoot);\n }\n\n Log.log(chalk.gray(chalk`Dependencies in the {bold package.json} changed:`));\n Log.log(chalk.gray(' ' + changedDependencies.join(', ')));\n\n // Installing dependencies is a legacy feature from the unversioned\n // command. We know opt to not change dependencies unless a template\n // indicates a new dependency is required, or if the core dependencies are wrong.\n if (\n await confirmAsync({\n message: `Install the updated dependencies?`,\n initial: true,\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 }\n\n // Apply Expo config to native projects. Prevent log-spew from ora when running in debug mode.\n const configSyncingStep: { succeed(text?: string): unknown; fail(text?: string): unknown } =\n env.EXPO_DEBUG\n ? {\n succeed(text) {\n Log.log(text!);\n },\n fail(text) {\n Log.error(text!);\n },\n }\n : logNewSection('Running prebuild');\n try {\n await profile(configureProjectAsync)(projectRoot, {\n platforms: options.platforms,\n exp,\n templateChecksum,\n });\n configSyncingStep.succeed('Finished prebuild');\n } catch (error) {\n configSyncingStep.fail('Prebuild 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.js');\n\n podsInstalled = await installCocoaPodsAsync(projectRoot);\n } else {\n debug('Skipped pod install');\n }\n const inlineModules = exp.experiments?.inlineModules ?? false;\n if (inlineModules && options.platforms.includes('ios')) {\n await updateXcodeProject(projectRoot, {\n watchedDirectories: inlineModules.watchedDirectories ?? [],\n xcodeProjectTargets: inlineModules.xcodeProjectTargets,\n name: exp.name,\n });\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","exp","setNodeEnv","loadEnvFiles","platforms","getConfig","length","finalPlatforms","filter","platform","includes","requestedPlatforms","join","Log","warn","chalk","clean","maybeBailOnGitStatusAsync","maybeBailOnNativeModuleAsync","clearNativeFolder","promptToClearMalformedNativeProjectsAsync","ensureValidPlatforms","assertPlatforms","pkg","ensureConfigAsync","hasNewProjectFiles","needsPodInstall","templateChecksum","changedDependencies","updateFromTemplateAsync","template","resolveTemplateOption","undefined","skipDependencyUpdate","install","packageManager","npm","clearNodeModulesAsync","log","gray","confirmAsync","message","initial","installAsync","yarn","pnpm","bun","silent","env","EXPO_DEBUG","CI","configSyncingStep","succeed","text","fail","error","logNewSection","profile","configureProjectAsync","podsInstalled","installCocoaPodsAsync","inlineModules","experiments","updateXcodeProject","watchedDirectories","xcodeProjectTargets","name","nodeInstall","podInstall"],"mappings":";;;;+BAgDsBA;;;eAAAA;;;;yBA/CI;;;;;;;yBAES;;;;;;;gEACjB;;;;;;mCAMX;uCAC+B;mCACJ;gCAC2C;oCACrC;8BACX;qBACT;qBACA;yBACqB;6BACH;qBACR;yBACN;yBACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAwBxB,eAAeF,cACpBG,WAAmB,EACnBC,OAkBC;QAqHqBC;IAnHtBC,IAAAA,mBAAU,EAAC;IACXC,IAAAA,qBAAY,EAACJ;IAEb,MAAM,EAAEK,SAAS,EAAE,GAAGC,IAAAA,mBAAS,EAACN,aAAaE,GAAG;IAChD,IAAIG,6BAAAA,UAAWE,MAAM,EAAE;QACrB,oDAAoD;QACpD,MAAMC,iBAAiBP,QAAQI,SAAS,CAACI,MAAM,CAAC,CAACC,WAAaL,UAAUM,QAAQ,CAACD;QACjF,IAAIF,eAAeD,MAAM,GAAG,GAAG;YAC7BN,QAAQI,SAAS,GAAGG;QACtB,OAAO;YACL,MAAMI,qBAAqBX,QAAQI,SAAS,CAACQ,IAAI,CAAC;YAClDC,QAAG,CAACC,IAAI,CACNC,IAAAA,gBAAK,CAAA,CAAC,4BAA4B,EAAEJ,mBAAmB,aAAa,EAAEP,UAAUQ,IAAI,CAAC,MAAM,sEAAsE,EAAED,mBAAmB,E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C;QACvB,MAAMC;IACR;IAEA,oBAAoB;IACpB,IAAII,gBAAyB;IAC7B,8GAA8G;IAC9G,IAAI3D,QAAQI,SAAS,CAACM,QAAQ,CAAC,UAAUV,QAAQkC,OAAO,IAAIR,iBAAiB;QAC3E,MAAM,EAAEkC,qBAAqB,EAAE,GAAG,MAAM,mEAAA,QAAO;QAE/CD,gBAAgB,MAAMC,sBAAsB7D;IAC9C,OAAO;QACLF,MAAM;IACR;IACA,MAAMgE,gBAAgB5D,EAAAA,mBAAAA,IAAI6D,WAAW,qBAAf7D,iBAAiB4D,aAAa,KAAI;IACxD,IAAIA,iBAAiB7D,QAAQI,SAAS,CAACM,QAAQ,CAAC,QAAQ;QACtD,MAAMqD,IAAAA,mCAAkB,EAAChE,aAAa;YACpCiE,oBAAoBH,cAAcG,kBAAkB,IAAI,EAAE;YAC1DC,qBAAqBJ,cAAcI,mBAAmB;YACtDC,MAAMjE,IAAIiE,IAAI;QAChB;IACF;IAEA,OAAO;QACLC,aAAa,CAAC,CAACnE,QAAQkC,OAAO;QAC9BkC,YAAY,CAACT;QACbvD,WAAWJ,QAAQI,SAAS;QAC5BqB;QACAxB;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/prebuild/prebuildAsync.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config';\nimport { getConfig } from '@expo/config';\nimport type { ModPlatform } from '@expo/config-plugins';\nimport { updateXcodeProject } from '@expo/inline-modules';\nimport chalk from 'chalk';\n\nimport {\n clearNativeFolder,\n getExistingNativePlatformsAsync,\n promptToClearMalformedNativeProjectsAsync,\n maybeBailOnNativeModuleAsync,\n} 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 { Log } from '../log';\nimport { env } from '../utils/env';\nimport { setNodeEnv, loadEnvFiles } from '../utils/nodeEnv';\nimport { clearNodeModulesAsync } from '../utils/nodeModules';\nimport { logNewSection } from '../utils/ora';\nimport { profile } from '../utils/profile';\nimport { confirmAsync } from '../utils/prompts';\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 loadEnvFiles(projectRoot);\n\n const { platforms } = getConfig(projectRoot).exp;\n if (platforms?.length) {\n // Filter out platforms that aren't in the app.json.\n const finalPlatforms = options.platforms.filter((platform) => platforms.includes(platform));\n if (finalPlatforms.length > 0) {\n options.platforms = finalPlatforms;\n } else {\n const requestedPlatforms = options.platforms.join(', ');\n Log.warn(\n chalk`⚠️ Requested prebuild for \"${requestedPlatforms}\", but only \"${platforms.join(', ')}\" is present in app config (\"expo.platforms\" entry). Continuing with \"${requestedPlatforms}\".`\n );\n }\n }\n if (options.clean) {\n // Only run the destructive-path guards when there are native folders to delete, so a\n // first-ever prebuild doesn't prompt on git status or native module detection.\n const existingPlatforms = await getExistingNativePlatformsAsync(projectRoot, options.platforms);\n if (existingPlatforms.length) {\n const { maybeBailOnGitStatusAsync } = await import('../utils/git.js');\n // Clean the project folders...\n if (await maybeBailOnGitStatusAsync()) {\n return null;\n }\n // Check if the target project is actually a native module, which we don't want to erase\n if (await maybeBailOnNativeModuleAsync(projectRoot)) {\n return null;\n }\n // Clear the native folders before syncing\n await clearNativeFolder(projectRoot, options.platforms);\n }\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, templateChecksum, changedDependencies } =\n await updateFromTemplateAsync(projectRoot, {\n exp,\n pkg,\n template: options.template != null ? resolveTemplateOption(options.template) : undefined,\n platforms: options.platforms,\n skipDependencyUpdate: options.skipDependencyUpdate,\n });\n\n // Install node modules\n if (options.install) {\n if (changedDependencies.length) {\n if (options.packageManager?.npm) {\n await clearNodeModulesAsync(projectRoot);\n }\n\n Log.log(chalk.gray(chalk`Dependencies in the {bold package.json} changed:`));\n Log.log(chalk.gray(' ' + changedDependencies.join(', ')));\n\n // Installing dependencies is a legacy feature from the unversioned\n // command. We know opt to not change dependencies unless a template\n // indicates a new dependency is required, or if the core dependencies are wrong.\n if (\n await confirmAsync({\n message: `Install the updated dependencies?`,\n initial: true,\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 }\n\n // Apply Expo config to native projects. Prevent log-spew from ora when running in debug mode.\n const configSyncingStep: { succeed(text?: string): unknown; fail(text?: string): unknown } =\n env.EXPO_DEBUG\n ? {\n succeed(text) {\n Log.log(text!);\n },\n fail(text) {\n Log.error(text!);\n },\n }\n : logNewSection('Running prebuild');\n try {\n await profile(configureProjectAsync)(projectRoot, {\n platforms: options.platforms,\n exp,\n templateChecksum,\n });\n configSyncingStep.succeed('Finished prebuild');\n } catch (error) {\n configSyncingStep.fail('Prebuild 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.js');\n\n podsInstalled = await installCocoaPodsAsync(projectRoot);\n } else {\n debug('Skipped pod install');\n }\n const inlineModules = exp.experiments?.inlineModules ?? false;\n if (inlineModules && options.platforms.includes('ios')) {\n await updateXcodeProject(projectRoot, {\n watchedDirectories: inlineModules.watchedDirectories ?? [],\n xcodeProjectTargets: inlineModules.xcodeProjectTargets,\n name: exp.name,\n });\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","exp","setNodeEnv","loadEnvFiles","platforms","getConfig","length","finalPlatforms","filter","platform","includes","requestedPlatforms","join","Log","warn","chalk","clean","existingPlatforms","getExistingNativePlatformsAsync","maybeBailOnGitStatusAsync","maybeBailOnNativeModuleAsync","clearNativeFolder","promptToClearMalformedNativeProjectsAsync","ensureValidPlatforms","assertPlatforms","pkg","ensureConfigAsync","hasNewProjectFiles","needsPodInstall","templateChecksum","changedDependencies","updateFromTemplateAsync","template","resolveTemplateOption","undefined","skipDependencyUpdate","install","packageManager","npm","clearNodeModulesAsync","log","gray","confirmAsync","message","initial","installAsync","yarn","pnpm","bun","silent","env","EXPO_DEBUG","CI","configSyncingStep","succeed","text","fail","error","logNewSection","profile","configureProjectAsync","podsInstalled","installCocoaPodsAsync","inlineModules","experiments","updateXcodeProject","watchedDirectories","xcodeProjectTargets","name","nodeInstall","podInstall"],"mappings":";;;;+BAiDsBA;;;eAAAA;;;;yBAhDI;;;;;;;yBAES;;;;;;;gEACjB;;;;;;mCAOX;uCAC+B;mCACJ;gCAC2C;oCACrC;8BACX;qBACT;qBACA;yBACqB;6BACH;qBACR;yBACN;yBACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAwBxB,eAAeF,cACpBG,WAAmB,EACnBC,OAkBC;QA0HqBC;IAxHtBC,IAAAA,mBAAU,EAAC;IACXC,IAAAA,qBAAY,EAACJ;IAEb,MAAM,EAAEK,SAAS,EAAE,GAAGC,IAAAA,mBAAS,EAACN,aAAaE,GAAG;IAChD,IAAIG,6BAAAA,UAAWE,MAAM,EAAE;QACrB,oDAAoD;QACpD,MAAMC,iBAAiBP,QAAQI,SAAS,CAACI,MAAM,CAAC,CAACC,WAAaL,UAAUM,QAAQ,CAACD;QACjF,IAAIF,eAAeD,MAAM,GAAG,GAAG;YAC7BN,QAAQI,SAAS,GAAGG;QACtB,OAAO;YACL,MAAMI,qBAAqBX,QAAQI,SAAS,CAACQ,IAAI,CAAC;YAClDC,QAAG,CAACC,IAAI,CACNC,IAAAA,gBAAK,CAAA,CAAC,4BAA4B,EAAEJ,mBAAmB,aAAa,EAAEP,UAAUQ,IAAI,CAAC,MAAM,sEAAsE,EAAED,mBAAmB,EAAE,CAAC;QAE7L;IACF;IACA,IAAIX,QAAQgB,KAAK,EAAE;QACjB,qFAAqF;QACrF,+EAA+E;QAC/E,MAAMC,oBAAoB,MAAMC,IAAAA,kDAA+B,EAACnB,aAAaC,QAAQI,SAAS;QAC9F,IAAIa,kBAAkBX,MAAM,EAAE;YAC5B,MAAM,EAAEa,yBAAyB,EAAE,GAAG,MAAM,mEAAA,Q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AACM,QAAQ,CAAC,UAAUV,QAAQoC,OAAO,IAAIR,iBAAiB;QAC3E,MAAM,EAAEkC,qBAAqB,EAAE,GAAG,MAAM,mEAAA,QAAO;QAE/CD,gBAAgB,MAAMC,sBAAsB/D;IAC9C,OAAO;QACLF,MAAM;IACR;IACA,MAAMkE,gBAAgB9D,EAAAA,mBAAAA,IAAI+D,WAAW,qBAAf/D,iBAAiB8D,aAAa,KAAI;IACxD,IAAIA,iBAAiB/D,QAAQI,SAAS,CAACM,QAAQ,CAAC,QAAQ;QACtD,MAAMuD,IAAAA,mCAAkB,EAAClE,aAAa;YACpCmE,oBAAoBH,cAAcG,kBAAkB,IAAI,EAAE;YAC1DC,qBAAqBJ,cAAcI,mBAAmB;YACtDC,MAAMnE,IAAImE,IAAI;QAChB;IACF;IAEA,OAAO;QACLC,aAAa,CAAC,CAACrE,QAAQoC,OAAO;QAC9BkC,YAAY,CAACT;QACbzD,WAAWJ,QAAQI,SAAS;QAC5BuB;QACA1B;IACF;AACF"}
@@ -525,7 +525,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
525
525
  const { artifacts: resources } = await this.getStaticResourcesAsync({
526
526
  clientBoundaries: []
527
527
  });
528
- const { cssHrefs, inlineCss } = getStreamingCssAssetsFromSerialAssets(resources);
528
+ const { cssHrefs, externalCss, inlineCss } = getStreamingCssAssetsFromSerialAssets(resources);
529
529
  const { loader, metadata } = await this.getDevServerRenderOptionsAsync({
530
530
  location,
531
531
  route,
@@ -538,6 +538,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
538
538
  request: request,
539
539
  assets: {
540
540
  css: cssHrefs,
541
+ externalCss,
541
542
  inlineCss,
542
543
  js: [
543
544
  devBundleUrlPathname
@@ -1758,6 +1759,7 @@ function unique(array) {
1758
1759
  }
1759
1760
  function getStreamingCssAssetsFromSerialAssets(resources) {
1760
1761
  const cssHrefs = [];
1762
+ const externalCss = [];
1761
1763
  const inlineCss = [];
1762
1764
  for (const asset of resources){
1763
1765
  if (asset.type === 'css') {
@@ -1766,11 +1768,15 @@ function getStreamingCssAssetsFromSerialAssets(resources) {
1766
1768
  hmrId: asset.metadata.hmrId
1767
1769
  });
1768
1770
  } else if (asset.type === 'css-external') {
1769
- cssHrefs.push(asset.filename);
1771
+ externalCss.push({
1772
+ href: asset.filename,
1773
+ media: asset.metadata.media
1774
+ });
1770
1775
  }
1771
1776
  }
1772
1777
  return {
1773
1778
  cssHrefs,
1779
+ externalCss,
1774
1780
  inlineCss
1775
1781
  };
1776
1782
  }