@expo/cli 1.0.0-canary-20250722-599a28f → 54.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.
Files changed (133) hide show
  1. package/build/bin/cli +1 -1
  2. package/build/metro-require/require.js +24 -13
  3. package/build/src/api/getExpoSchema.js +8 -7
  4. package/build/src/api/getExpoSchema.js.map +1 -1
  5. package/build/src/expoUpdatesExports.js +28 -0
  6. package/build/src/expoUpdatesExports.js.map +1 -0
  7. package/build/src/export/embed/exportEmbedAsync.js +26 -25
  8. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  9. package/build/src/export/embed/resolveOptions.js +1 -1
  10. package/build/src/export/embed/resolveOptions.js.map +1 -1
  11. package/build/src/export/exportApp.js +7 -4
  12. package/build/src/export/exportApp.js.map +1 -1
  13. package/build/src/export/exportAssets.js +20 -4
  14. package/build/src/export/exportAssets.js.map +1 -1
  15. package/build/src/export/exportAsync.js +2 -2
  16. package/build/src/export/exportAsync.js.map +1 -1
  17. package/build/src/export/exportHermes.js +34 -9
  18. package/build/src/export/exportHermes.js.map +1 -1
  19. package/build/src/export/exportStaticAsync.js +23 -2
  20. package/build/src/export/exportStaticAsync.js.map +1 -1
  21. package/build/src/export/index.js +1 -0
  22. package/build/src/export/index.js.map +1 -1
  23. package/build/src/export/metroAssetLocalPath.js.map +1 -1
  24. package/build/src/export/persistMetroAssets.js.map +1 -1
  25. package/build/src/export/resolveOptions.js +1 -0
  26. package/build/src/export/resolveOptions.js.map +1 -1
  27. package/build/src/export/saveAssets.js +12 -0
  28. package/build/src/export/saveAssets.js.map +1 -1
  29. package/build/src/install/checkPackages.js +9 -1
  30. package/build/src/install/checkPackages.js.map +1 -1
  31. package/build/src/lint/lintAsync.js +2 -0
  32. package/build/src/lint/lintAsync.js.map +1 -1
  33. package/build/src/prebuild/prebuildAsync.js +18 -0
  34. package/build/src/prebuild/prebuildAsync.js.map +1 -1
  35. package/build/src/prebuild/resolveLocalTemplate.js +42 -0
  36. package/build/src/prebuild/resolveLocalTemplate.js.map +1 -0
  37. package/build/src/prebuild/resolveTemplate.js +17 -7
  38. package/build/src/prebuild/resolveTemplate.js.map +1 -1
  39. package/build/src/prebuild/updateFromTemplate.js +1 -0
  40. package/build/src/prebuild/updateFromTemplate.js.map +1 -1
  41. package/build/src/prebuild/updatePackageJson.js +5 -3
  42. package/build/src/prebuild/updatePackageJson.js.map +1 -1
  43. package/build/src/run/android/resolveOptions.js +2 -2
  44. package/build/src/run/android/resolveOptions.js.map +1 -1
  45. package/build/src/run/ios/options/resolveOptions.js +2 -2
  46. package/build/src/run/ios/options/resolveOptions.js.map +1 -1
  47. package/build/src/run/ios/runIosAsync.js +3 -0
  48. package/build/src/run/ios/runIosAsync.js.map +1 -1
  49. package/build/src/serve/serveAsync.js +5 -2
  50. package/build/src/serve/serveAsync.js.map +1 -1
  51. package/build/src/start/platforms/ExpoGoInstaller.js +1 -1
  52. package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
  53. package/build/src/start/server/DevToolsPluginManager.js +7 -35
  54. package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
  55. package/build/src/start/server/metro/MetroBundlerDevServer.js +88 -56
  56. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  57. package/build/src/start/server/metro/MetroTerminalReporter.js +66 -25
  58. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  59. package/build/src/start/server/metro/TerminalReporter.js +6 -6
  60. package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
  61. package/build/src/start/server/metro/createExpoAutolinkingResolver.js +121 -0
  62. package/build/src/start/server/metro/createExpoAutolinkingResolver.js.map +1 -0
  63. package/build/src/start/server/metro/createExpoFallbackResolver.js +1 -0
  64. package/build/src/start/server/metro/createExpoFallbackResolver.js.map +1 -1
  65. package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
  66. package/build/src/start/server/metro/createJResolver.js.map +1 -1
  67. package/build/src/start/server/metro/createServerComponentsMiddleware.js +4 -4
  68. package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
  69. package/build/src/start/server/metro/createServerRouteMiddleware.js +54 -8
  70. package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
  71. package/build/src/start/server/metro/debugging/attachAtlas.js +2 -0
  72. package/build/src/start/server/metro/debugging/attachAtlas.js.map +1 -1
  73. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +1 -1
  74. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
  75. package/build/src/start/server/metro/fetchRouterManifest.js +1 -0
  76. package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
  77. package/build/src/start/server/metro/formatFileCandidates.js.map +1 -1
  78. package/build/src/start/server/metro/getCssModulesFromBundler.js +10 -9
  79. package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
  80. package/build/src/start/server/metro/instantiateMetro.js +44 -40
  81. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  82. package/build/src/start/server/metro/metroErrorInterface.js +79 -12
  83. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
  84. package/build/src/start/server/metro/metroVirtualModules.js.map +1 -1
  85. package/build/src/start/server/metro/metroWatchTypeScriptFiles.js.map +1 -1
  86. package/build/src/start/server/metro/router.js +75 -0
  87. package/build/src/start/server/metro/router.js.map +1 -1
  88. package/build/src/start/server/metro/runServer-fork.js +19 -19
  89. package/build/src/start/server/metro/runServer-fork.js.map +1 -1
  90. package/build/src/start/server/metro/serializeHtml.js +45 -5
  91. package/build/src/start/server/metro/serializeHtml.js.map +1 -1
  92. package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
  93. package/build/src/start/server/metro/withMetroErrorReportingResolver.js +267 -0
  94. package/build/src/start/server/metro/withMetroErrorReportingResolver.js.map +1 -0
  95. package/build/src/start/server/metro/withMetroMultiPlatform.js +58 -82
  96. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  97. package/build/src/start/server/metro/withMetroResolvers.js +2 -219
  98. package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
  99. package/build/src/start/server/metro/withMetroSupervisingTransformWorker.js +63 -0
  100. package/build/src/start/server/metro/withMetroSupervisingTransformWorker.js.map +1 -0
  101. package/build/src/start/server/middleware/createBuiltinAPIRequestHandler.js +1 -1
  102. package/build/src/start/server/middleware/createBuiltinAPIRequestHandler.js.map +1 -1
  103. package/build/src/start/server/middleware/metroOptions.js +7 -2
  104. package/build/src/start/server/middleware/metroOptions.js.map +1 -1
  105. package/build/src/start/server/middleware/resolvePlatform.js +3 -0
  106. package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
  107. package/build/src/start/server/serverLogLikeMetro.js +13 -11
  108. package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
  109. package/build/src/start/server/type-generation/routes.js.map +1 -1
  110. package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
  111. package/build/src/types.d.ts +2 -0
  112. package/build/src/utils/build-cache-providers/index.js.map +1 -1
  113. package/build/src/utils/dir.js +7 -0
  114. package/build/src/utils/dir.js.map +1 -1
  115. package/build/src/utils/env.js +9 -4
  116. package/build/src/utils/env.js.map +1 -1
  117. package/build/src/utils/errors.js +1 -1
  118. package/build/src/utils/errors.js.map +1 -1
  119. package/build/src/utils/git.js +2 -2
  120. package/build/src/utils/git.js.map +1 -1
  121. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  122. package/build/src/utils/telemetry/utils/context.js +1 -1
  123. package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -1
  124. package/internal/unstable-expo-updates-exports.d.ts +31 -0
  125. package/internal/unstable-expo-updates-exports.js +3 -0
  126. package/package.json +33 -17
  127. package/static/template/[...rsc]+api.ts +1 -1
  128. package/build/src/start/server/metro/createExpoStickyResolver.js +0 -137
  129. package/build/src/start/server/metro/createExpoStickyResolver.js.map +0 -1
  130. package/build/src/start/server/metro/metroPrivateServer.js +0 -28
  131. package/build/src/start/server/metro/metroPrivateServer.js.map +0 -1
  132. package/build/src/utils/jsonSchemaDeref.js +0 -150
  133. package/build/src/utils/jsonSchemaDeref.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/middleware/resolvePlatform.ts"],"sourcesContent":["import { parse } from 'url';\n\nimport { ServerRequest } from './server.types';\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')(\n 'expo:start:server:middleware:resolvePlatform'\n) as typeof console.log;\n\n/** Supported platforms */\nexport type RuntimePlatform = 'ios' | 'android';\n\n/**\n * Extract the runtime platform from the server request.\n * 1. Query param `platform`: `?platform=ios`\n * 2. Header `expo-platform`: `'expo-platform': ios`\n * 3. Legacy header `exponent-platform`: `'exponent-platform': ios`\n *\n * Returns first item in the case of an array.\n */\nexport function parsePlatformHeader(req: ServerRequest): string | null {\n const url = parse(req.url!, /* parseQueryString */ true);\n const platform =\n url.query?.platform || req.headers['expo-platform'] || req.headers['exponent-platform'];\n return (Array.isArray(platform) ? platform[0] : platform) ?? null;\n}\n\n/** Guess the platform from the user-agent header. */\nexport function resolvePlatformFromUserAgentHeader(req: ServerRequest): string | null {\n let platform = null;\n const userAgent = req.headers['user-agent'];\n if (userAgent?.match(/Android/i)) {\n platform = 'android';\n }\n if (userAgent?.match(/iPhone|iPad/i)) {\n platform = 'ios';\n }\n debug(`Resolved platform ${platform} from user-agent header: ${userAgent}`);\n return platform;\n}\n\n/** Assert if the runtime platform is not included. */\nexport function assertMissingRuntimePlatform(platform?: any): asserts platform {\n if (!platform) {\n throw new CommandError(\n 'PLATFORM_HEADER',\n `Must specify \"expo-platform\" header or \"platform\" query parameter`\n );\n }\n}\n\n/** Assert if the runtime platform is not correct. */\nexport function assertRuntimePlatform(platform: string): asserts platform is RuntimePlatform {\n const stringifiedPlatform = String(platform);\n if (!['android', 'ios', 'web'].includes(stringifiedPlatform)) {\n throw new CommandError(\n 'PLATFORM_HEADER',\n `platform must be \"android\", \"ios\", or \"web\". Received: \"${platform}\"`\n );\n }\n}\n"],"names":["assertMissingRuntimePlatform","assertRuntimePlatform","parsePlatformHeader","resolvePlatformFromUserAgentHeader","debug","require","req","url","parse","platform","query","headers","Array","isArray","userAgent","match","CommandError","stringifiedPlatform","String","includes"],"mappings":";;;;;;;;;;;IA0CgBA,4BAA4B;eAA5BA;;IAUAC,qBAAqB;eAArBA;;IAhCAC,mBAAmB;eAAnBA;;IAQAC,kCAAkC;eAAlCA;;;;yBA5BM;;;;;;wBAGO;AAE7B,MAAMC,QAAQC,QAAQ,SACpB;AAcK,SAASH,oBAAoBI,GAAkB;QAGlDC;IAFF,MAAMA,MAAMC,IAAAA,YAAK,EAACF,IAAIC,GAAG,EAAG,oBAAoB,GAAG;IACnD,MAAME,WACJF,EAAAA,aAAAA,IAAIG,KAAK,qBAATH,WAAWE,QAAQ,KAAIH,IAAIK,OAAO,CAAC,gBAAgB,IAAIL,IAAIK,OAAO,CAAC,oBAAoB;IACzF,OAAO,AAACC,CAAAA,MAAMC,OAAO,CAACJ,YAAYA,QAAQ,CAAC,EAAE,GAAGA,QAAO,KAAM;AAC/D;AAGO,SAASN,mCAAmCG,GAAkB;IACnE,IAAIG,WAAW;IACf,MAAMK,YAAYR,IAAIK,OAAO,CAAC,aAAa;IAC3C,IAAIG,6BAAAA,UAAWC,KAAK,CAAC,aAAa;QAChCN,WAAW;IACb;IACA,IAAIK,6BAAAA,UAAWC,KAAK,CAAC,iBAAiB;QACpCN,WAAW;IACb;IACAL,MAAM,CAAC,kBAAkB,EAAEK,SAAS,yBAAyB,EAAEK,WAAW;IAC1E,OAAOL;AACT;AAGO,SAAST,6BAA6BS,QAAc;IACzD,IAAI,CAACA,UAAU;QACb,MAAM,IAAIO,oBAAY,CACpB,mBACA,CAAC,iEAAiE,CAAC;IAEvE;AACF;AAGO,SAASf,sBAAsBQ,QAAgB;IACpD,MAAMQ,sBAAsBC,OAAOT;IACnC,IAAI,CAAC;QAAC;QAAW;QAAO;KAAM,CAACU,QAAQ,CAACF,sBAAsB;QAC5D,MAAM,IAAID,oBAAY,CACpB,mBACA,CAAC,wDAAwD,EAAEP,SAAS,CAAC,CAAC;IAE1E;AACF"}
1
+ {"version":3,"sources":["../../../../../src/start/server/middleware/resolvePlatform.ts"],"sourcesContent":["import { parse } from 'url';\n\nimport { ServerRequest } from './server.types';\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')(\n 'expo:start:server:middleware:resolvePlatform'\n) as typeof console.log;\n\n/** Supported platforms */\nexport type RuntimePlatform = 'ios' | 'android';\n\n/**\n * Extract the runtime platform from the server request.\n * 1. Query param `platform`: `?platform=ios`\n * 2. Header `expo-platform`: `'expo-platform': ios`\n * 3. Legacy header `exponent-platform`: `'exponent-platform': ios`\n *\n * Returns first item in the case of an array.\n */\nexport function parsePlatformHeader(req: ServerRequest): string | null {\n const url = parse(req.url!, /* parseQueryString */ true);\n const platform =\n url.query?.platform || req.headers['expo-platform'] || req.headers['exponent-platform'];\n return (Array.isArray(platform) ? platform[0] : platform) ?? null;\n}\n\n/** Guess the platform from the user-agent header. */\nexport function resolvePlatformFromUserAgentHeader(req: ServerRequest): string | null {\n let platform = null;\n const userAgent = req.headers['user-agent'];\n if (userAgent?.match(/Android/i)) {\n platform = 'android';\n }\n if (userAgent?.match(/OculusBrowser|Quest/i)) {\n platform = 'android';\n }\n if (userAgent?.match(/iPhone|iPad/i)) {\n platform = 'ios';\n }\n debug(`Resolved platform ${platform} from user-agent header: ${userAgent}`);\n return platform;\n}\n\n/** Assert if the runtime platform is not included. */\nexport function assertMissingRuntimePlatform(platform?: any): asserts platform {\n if (!platform) {\n throw new CommandError(\n 'PLATFORM_HEADER',\n `Must specify \"expo-platform\" header or \"platform\" query parameter`\n );\n }\n}\n\n/** Assert if the runtime platform is not correct. */\nexport function assertRuntimePlatform(platform: string): asserts platform is RuntimePlatform {\n const stringifiedPlatform = String(platform);\n if (!['android', 'ios', 'web'].includes(stringifiedPlatform)) {\n throw new CommandError(\n 'PLATFORM_HEADER',\n `platform must be \"android\", \"ios\", or \"web\". Received: \"${platform}\"`\n );\n }\n}\n"],"names":["assertMissingRuntimePlatform","assertRuntimePlatform","parsePlatformHeader","resolvePlatformFromUserAgentHeader","debug","require","req","url","parse","platform","query","headers","Array","isArray","userAgent","match","CommandError","stringifiedPlatform","String","includes"],"mappings":";;;;;;;;;;;IA6CgBA,4BAA4B;eAA5BA;;IAUAC,qBAAqB;eAArBA;;IAnCAC,mBAAmB;eAAnBA;;IAQAC,kCAAkC;eAAlCA;;;;yBA5BM;;;;;;wBAGO;AAE7B,MAAMC,QAAQC,QAAQ,SACpB;AAcK,SAASH,oBAAoBI,GAAkB;QAGlDC;IAFF,MAAMA,MAAMC,IAAAA,YAAK,EAACF,IAAIC,GAAG,EAAG,oBAAoB,GAAG;IACnD,MAAME,WACJF,EAAAA,aAAAA,IAAIG,KAAK,qBAATH,WAAWE,QAAQ,KAAIH,IAAIK,OAAO,CAAC,gBAAgB,IAAIL,IAAIK,OAAO,CAAC,oBAAoB;IACzF,OAAO,AAACC,CAAAA,MAAMC,OAAO,CAACJ,YAAYA,QAAQ,CAAC,EAAE,GAAGA,QAAO,KAAM;AAC/D;AAGO,SAASN,mCAAmCG,GAAkB;IACnE,IAAIG,WAAW;IACf,MAAMK,YAAYR,IAAIK,OAAO,CAAC,aAAa;IAC3C,IAAIG,6BAAAA,UAAWC,KAAK,CAAC,aAAa;QAChCN,WAAW;IACb;IACA,IAAIK,6BAAAA,UAAWC,KAAK,CAAC,yBAAyB;QAC5CN,WAAW;IACb;IACA,IAAIK,6BAAAA,UAAWC,KAAK,CAAC,iBAAiB;QACpCN,WAAW;IACb;IACAL,MAAM,CAAC,kBAAkB,EAAEK,SAAS,yBAAyB,EAAEK,WAAW;IAC1E,OAAOL;AACT;AAGO,SAAST,6BAA6BS,QAAc;IACzD,IAAI,CAACA,UAAU;QACb,MAAM,IAAIO,oBAAY,CACpB,mBACA,CAAC,iEAAiE,CAAC;IAEvE;AACF;AAGO,SAASf,sBAAsBQ,QAAgB;IACpD,MAAMQ,sBAAsBC,OAAOT;IACnC,IAAI,CAAC;QAAC;QAAW;QAAO;KAAM,CAACU,QAAQ,CAACF,sBAAsB;QAC5D,MAAM,IAAID,oBAAY,CACpB,mBACA,CAAC,wDAAwD,EAAEP,SAAS,CAAC,CAAC;IAE1E;AACF"}
@@ -23,8 +23,8 @@ _export(exports, {
23
23
  logLikeMetro: function() {
24
24
  return logLikeMetro;
25
25
  },
26
- maybeSymbolicateAndFormatReactErrorLogAsync: function() {
27
- return maybeSymbolicateAndFormatReactErrorLogAsync;
26
+ maybeSymbolicateAndFormatJSErrorStackLogAsync: function() {
27
+ return maybeSymbolicateAndFormatJSErrorStackLogAsync;
28
28
  },
29
29
  parseErrorStringToObject: function() {
30
30
  return parseErrorStringToObject;
@@ -155,7 +155,7 @@ function logLikeMetro(originalLogFunction, level, platform, ...data) {
155
155
  }
156
156
  const escapedPathSep = _path().default.sep === '\\' ? '\\\\' : _path().default.sep;
157
157
  const SERVER_STACK_MATCHER = new RegExp(`${escapedPathSep}(react-dom|metro-runtime|expo-router)${escapedPathSep}`);
158
- async function maybeSymbolicateAndFormatReactErrorLogAsync(projectRoot, level, error) {
158
+ async function maybeSymbolicateAndFormatJSErrorStackLogAsync(projectRoot, level, error) {
159
159
  var _log_symbolicated_stack, _log_symbolicated;
160
160
  const log = new _LogBoxLog.LogBoxLog({
161
161
  level: level,
@@ -169,14 +169,16 @@ async function maybeSymbolicateAndFormatReactErrorLogAsync(projectRoot, level, e
169
169
  componentStack: []
170
170
  });
171
171
  await new Promise((res)=>log.symbolicate('stack', res));
172
- const symbolicatedErrorMessageAndStackLog = [
173
- log.message.content,
174
- (0, _metroErrorInterface.getStackAsFormattedLog)(projectRoot, {
175
- stack: ((_log_symbolicated = log.symbolicated) == null ? void 0 : (_log_symbolicated_stack = _log_symbolicated.stack) == null ? void 0 : _log_symbolicated_stack.stack) ?? [],
176
- codeFrame: log.codeFrame
177
- })
178
- ].join('\n\n');
179
- return symbolicatedErrorMessageAndStackLog;
172
+ const formatted = (0, _metroErrorInterface.getStackAsFormattedLog)(projectRoot, {
173
+ stack: ((_log_symbolicated = log.symbolicated) == null ? void 0 : (_log_symbolicated_stack = _log_symbolicated.stack) == null ? void 0 : _log_symbolicated_stack.stack) ?? [],
174
+ codeFrame: log.codeFrame
175
+ });
176
+ // NOTE: Message is printed above stack by the default Metro logic. So we don't need to include it here.
177
+ const symbolicatedErrorStackLog = `\n\n${formatted.stack}`;
178
+ return {
179
+ isFallback: formatted.isFallback,
180
+ stack: symbolicatedErrorStackLog
181
+ };
180
182
  }
181
183
  function parseErrorStringToObject(errorString) {
182
184
  // Find the first line of the possible stack trace
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/start/server/serverLogLikeMetro.ts"],"sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { INTERNAL_CALLSITES_REGEX } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport path from 'path';\n// @ts-expect-error\nimport { mapSourcePosition } from 'source-map-support';\nimport * as stackTraceParser from 'stacktrace-parser';\n\nimport { parseErrorStack, StackFrame } from './metro/log-box/LogBoxSymbolication';\nimport { env } from '../../utils/env';\nimport { memoize } from '../../utils/fn';\nimport { LogBoxLog } from './metro/log-box/LogBoxLog';\nimport { getStackAsFormattedLog } from './metro/metroErrorInterface';\n\nconst debug = require('debug')('expo:metro:logger') as typeof console.log;\n\nconst groupStack: any = [];\nlet collapsedGuardTimer: ReturnType<typeof setTimeout> | undefined;\n\nexport function logLikeMetro(\n originalLogFunction: (...args: any[]) => void,\n level: string,\n platform: string,\n ...data: any[]\n) {\n // @ts-expect-error\n const logFunction = console[level] && level !== 'trace' ? level : 'log';\n const color =\n level === 'error'\n ? chalk.inverse.red\n : level === 'warn'\n ? chalk.inverse.yellow\n : chalk.inverse.white;\n\n if (level === 'group') {\n groupStack.push(level);\n } else if (level === 'groupCollapsed') {\n groupStack.push(level);\n clearTimeout(collapsedGuardTimer);\n // Inform users that logs get swallowed if they forget to call `groupEnd`.\n collapsedGuardTimer = setTimeout(() => {\n if (groupStack.includes('groupCollapsed')) {\n originalLogFunction(\n chalk.inverse.yellow.bold(' WARN '),\n 'Expected `console.groupEnd` to be called after `console.groupCollapsed`.'\n );\n groupStack.length = 0;\n }\n }, 3000);\n return;\n } else if (level === 'groupEnd') {\n groupStack.pop();\n if (!groupStack.length) {\n clearTimeout(collapsedGuardTimer);\n }\n return;\n }\n\n if (!groupStack.includes('groupCollapsed')) {\n // Remove excess whitespace at the end of a log message, if possible.\n const lastItem = data[data.length - 1];\n if (typeof lastItem === 'string') {\n data[data.length - 1] = lastItem.trimEnd();\n }\n\n const modePrefix = platform === '' ? '' : chalk.bold`${platform} `;\n originalLogFunction(\n modePrefix +\n color.bold(` ${logFunction.toUpperCase()} `) +\n ''.padEnd(groupStack.length * 2, ' '),\n ...data\n );\n }\n}\n\nconst escapedPathSep = path.sep === '\\\\' ? '\\\\\\\\' : path.sep;\nconst SERVER_STACK_MATCHER = new RegExp(\n `${escapedPathSep}(react-dom|metro-runtime|expo-router)${escapedPathSep}`\n);\n\nexport async function maybeSymbolicateAndFormatReactErrorLogAsync(\n projectRoot: string,\n level: 'error' | 'warn',\n error: {\n message: string;\n stack: StackFrame[];\n }\n): Promise<string> {\n const log = new LogBoxLog({\n level: level as 'error' | 'warn',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack: error.stack,\n category: 'static',\n componentStack: [],\n });\n\n await new Promise((res) => log.symbolicate('stack', res));\n\n const symbolicatedErrorMessageAndStackLog = [\n log.message.content,\n getStackAsFormattedLog(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n }),\n ].join('\\n\\n');\n\n return symbolicatedErrorMessageAndStackLog;\n}\n\n/** Attempt to parse an error message string to an unsymbolicated stack. */\nexport function parseErrorStringToObject(errorString: string) {\n // Find the first line of the possible stack trace\n const stackStartIndex = errorString.indexOf('\\n at ');\n if (stackStartIndex === -1) {\n // No stack trace found, return the original error string\n return null;\n }\n const message = errorString.slice(0, stackStartIndex).trim();\n const stack = errorString.slice(stackStartIndex + 1);\n\n try {\n const parsedStack = parseErrorStack(stack);\n\n return {\n message,\n stack: parsedStack,\n };\n } catch (e) {\n // If parsing fails, return the original error string\n debug('Failed to parse error stack:', e);\n return null;\n }\n}\n\nfunction augmentLogsInternal(projectRoot: string) {\n const augmentLog = (name: string, fn: typeof console.log) => {\n // @ts-expect-error: TypeScript doesn't know about polyfilled functions.\n if (fn.__polyfilled) {\n return fn;\n }\n const originalFn = fn.bind(console);\n function logWithStack(...args: any[]) {\n const stack = new Error().stack;\n // Check if the log originates from the server.\n const isServerLog = !!stack?.match(SERVER_STACK_MATCHER);\n\n if (isServerLog) {\n if (name === 'error' || name === 'warn') {\n if (\n args.length === 2 &&\n typeof args[1] === 'string' &&\n args[1].trim().startsWith('at ')\n ) {\n // react-dom custom stacks which are always broken.\n // A stack string like:\n // at div\n // at http://localhost:8081/node_modules/expo-router/node/render.bundle?platform=web&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app&resolver.environment=node&transform.environment=node:38008:27\n // at Background (http://localhost:8081/node_modules/expo-router/node/render.bundle?platform=web&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app&resolver.environment=node&transform.environment=node:151009:7)\n const customStack = args[1];\n\n try {\n const parsedStack = parseErrorStack(customStack);\n const symbolicatedStack = parsedStack.map((line: any) => {\n const mapped = mapSourcePosition({\n source: line.file,\n line: line.lineNumber,\n column: line.column,\n }) as {\n // '/Users/evanbacon/Documents/GitHub/lab/sdk51-beta/node_modules/react-native-web/dist/exports/View/index.js',\n source: string;\n line: number;\n column: number;\n // 'hrefAttrs'\n name: string | null;\n };\n\n const fallbackName = mapped.name ?? '<unknown>';\n return {\n file: mapped.source,\n lineNumber: mapped.line,\n column: mapped.column,\n // Attempt to preserve the react component name if possible.\n methodName: line.methodName\n ? line.methodName === '<unknown>'\n ? fallbackName\n : line.methodName\n : fallbackName,\n arguments: line.arguments ?? [],\n };\n });\n\n // Replace args[1] with the formatted stack.\n args[1] = '\\n' + formatParsedStackLikeMetro(projectRoot, symbolicatedStack, true);\n } catch {\n // If symbolication fails, log the original stack.\n args.push('\\n' + formatStackLikeMetro(projectRoot, customStack));\n }\n } else {\n args.push('\\n' + formatStackLikeMetro(projectRoot, stack!));\n }\n }\n\n logLikeMetro(originalFn, name, 'λ', ...args);\n } else {\n originalFn(...args);\n }\n }\n logWithStack.__polyfilled = true;\n return logWithStack;\n };\n\n ['trace', 'info', 'error', 'warn', 'log', 'group', 'groupCollapsed', 'groupEnd', 'debug'].forEach(\n (name) => {\n // @ts-expect-error\n console[name] = augmentLog(name, console[name]);\n }\n );\n}\n\nexport function formatStackLikeMetro(projectRoot: string, stack: string) {\n // Remove `Error: ` from the beginning of the stack trace.\n // Dim traces that match `INTERNAL_CALLSITES_REGEX`\n\n const stackTrace = stackTraceParser.parse(stack);\n return formatParsedStackLikeMetro(projectRoot, stackTrace);\n}\n\nfunction formatParsedStackLikeMetro(\n projectRoot: string,\n stackTrace: stackTraceParser.StackFrame[],\n isComponentStack = false\n) {\n // Remove `Error: ` from the beginning of the stack trace.\n // Dim traces that match `INTERNAL_CALLSITES_REGEX`\n\n return stackTrace\n .filter(\n (line) =>\n line.file &&\n // Ignore unsymbolicated stack frames. It's not clear how this is possible but it sometimes happens when the graph changes.\n !/^https?:\\/\\//.test(line.file) &&\n (isComponentStack ? true : line.file !== '<anonymous>')\n )\n .map((line) => {\n // Use the same regex we use in Metro config to filter out traces:\n const isCollapsed = INTERNAL_CALLSITES_REGEX.test(line.file!);\n if (!isComponentStack && isCollapsed && !env.EXPO_DEBUG) {\n return null;\n }\n // If a file is collapsed, print it with dim styling.\n const style = isCollapsed ? chalk.dim : chalk.gray;\n // Use the `at` prefix to match Node.js\n let fileName = line.file!;\n if (fileName.startsWith(path.sep)) {\n fileName = path.relative(projectRoot, fileName);\n }\n if (line.lineNumber != null) {\n fileName += `:${line.lineNumber}`;\n if (line.column != null) {\n fileName += `:${line.column}`;\n }\n }\n\n return style(` ${line.methodName} (${fileName})`);\n })\n .filter(Boolean)\n .join('\\n');\n}\n\n/** Augment console logs to check the stack trace and format like Metro logs if we think the log came from the SSR renderer or an API route. */\nexport const augmentLogs = memoize(augmentLogsInternal);\n"],"names":["augmentLogs","formatStackLikeMetro","logLikeMetro","maybeSymbolicateAndFormatReactErrorLogAsync","parseErrorStringToObject","debug","require","groupStack","collapsedGuardTimer","originalLogFunction","level","platform","data","logFunction","console","color","chalk","inverse","red","yellow","white","push","clearTimeout","setTimeout","includes","bold","length","pop","lastItem","trimEnd","modePrefix","toUpperCase","padEnd","escapedPathSep","path","sep","SERVER_STACK_MATCHER","RegExp","projectRoot","error","log","LogBoxLog","message","content","substitutions","isComponentError","stack","category","componentStack","Promise","res","symbolicate","symbolicatedErrorMessageAndStackLog","getStackAsFormattedLog","symbolicated","codeFrame","join","errorString","stackStartIndex","indexOf","slice","trim","parsedStack","parseErrorStack","e","augmentLogsInternal","augmentLog","name","fn","__polyfilled","originalFn","bind","logWithStack","args","Error","isServerLog","match","startsWith","customStack","symbolicatedStack","map","line","mapped","mapSourcePosition","source","file","lineNumber","column","fallbackName","methodName","arguments","formatParsedStackLikeMetro","forEach","stackTrace","stackTraceParser","parse","isComponentStack","filter","test","isCollapsed","INTERNAL_CALLSITES_REGEX","env","EXPO_DEBUG","style","dim","gray","fileName","relative","Boolean","memoize"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;IAkRYA,WAAW;eAAXA;;IAnDGC,oBAAoB;eAApBA;;IA5MAC,YAAY;eAAZA;;IA6DMC,2CAA2C;eAA3CA;;IAkCNC,wBAAwB;eAAxBA;;;;yBAjHyB;;;;;;;gEACvB;;;;;;;gEACD;;;;;;;yBAEiB;;;;;;;iEACA;;;;;;qCAEU;qBACxB;oBACI;2BACE;qCACa;;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BAAoBG,eAAe,CAACE,QAAG,CAACC,UAAU,EAAE;YACvD,OAAO;QACT;QACA,qDAAqD;QACrD,MAAMC,QAAQJ,cAAcnF,gBAAK,CAACwF,GAAG,GAAGxF,gBAAK,CAACyF,IAAI;QAClD,uCAAuC;QACvC,IAAIC,WAAWzB,KAAKI,IAAI;QACxB,IAAIqB,SAAS7B,UAAU,CAAC3C,eAAI,CAACC,GAAG,GAAG;YACjCuE,WAAWxE,eAAI,CAACyE,QAAQ,CAACrE,aAAaoE;QACxC;QACA,IAAIzB,KAAKK,UAAU,IAAI,MAAM;YAC3BoB,YAAY,CAAC,CAAC,EAAEzB,KAAKK,UAAU,EAAE;YACjC,IAAIL,KAAKM,MAAM,IAAI,MAAM;gBACvBmB,YAAY,CAAC,CAAC,EAAEzB,KAAKM,MAAM,EAAE;YAC/B;QACF;QAEA,OAAOgB,MAAM,CAAC,EAAE,EAAEtB,KAAKQ,UAAU,CAAC,EAAE,EAAEiB,SAAS,CAAC,CAAC;IACnD,GACCT,MAAM,CAACW,SACPpD,IAAI,CAAC;AACV;AAGO,MAAMxD,cAAc6G,IAAAA,WAAO,EAAC5C"}
1
+ {"version":3,"sources":["../../../../src/start/server/serverLogLikeMetro.ts"],"sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { INTERNAL_CALLSITES_REGEX } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport path from 'path';\n// @ts-expect-error\nimport { mapSourcePosition } from 'source-map-support';\nimport * as stackTraceParser from 'stacktrace-parser';\n\nimport { parseErrorStack, StackFrame } from './metro/log-box/LogBoxSymbolication';\nimport { env } from '../../utils/env';\nimport { memoize } from '../../utils/fn';\nimport { LogBoxLog } from './metro/log-box/LogBoxLog';\nimport { getStackAsFormattedLog } from './metro/metroErrorInterface';\n\nconst debug = require('debug')('expo:metro:logger') as typeof console.log;\n\nconst groupStack: any = [];\nlet collapsedGuardTimer: ReturnType<typeof setTimeout> | undefined;\n\nexport function logLikeMetro(\n originalLogFunction: (...args: any[]) => void,\n level: string,\n platform: string,\n ...data: any[]\n) {\n // @ts-expect-error\n const logFunction = console[level] && level !== 'trace' ? level : 'log';\n const color =\n level === 'error'\n ? chalk.inverse.red\n : level === 'warn'\n ? chalk.inverse.yellow\n : chalk.inverse.white;\n\n if (level === 'group') {\n groupStack.push(level);\n } else if (level === 'groupCollapsed') {\n groupStack.push(level);\n clearTimeout(collapsedGuardTimer);\n // Inform users that logs get swallowed if they forget to call `groupEnd`.\n collapsedGuardTimer = setTimeout(() => {\n if (groupStack.includes('groupCollapsed')) {\n originalLogFunction(\n chalk.inverse.yellow.bold(' WARN '),\n 'Expected `console.groupEnd` to be called after `console.groupCollapsed`.'\n );\n groupStack.length = 0;\n }\n }, 3000);\n return;\n } else if (level === 'groupEnd') {\n groupStack.pop();\n if (!groupStack.length) {\n clearTimeout(collapsedGuardTimer);\n }\n return;\n }\n\n if (!groupStack.includes('groupCollapsed')) {\n // Remove excess whitespace at the end of a log message, if possible.\n const lastItem = data[data.length - 1];\n if (typeof lastItem === 'string') {\n data[data.length - 1] = lastItem.trimEnd();\n }\n\n const modePrefix = platform === '' ? '' : chalk.bold`${platform} `;\n originalLogFunction(\n modePrefix +\n color.bold(` ${logFunction.toUpperCase()} `) +\n ''.padEnd(groupStack.length * 2, ' '),\n ...data\n );\n }\n}\n\nconst escapedPathSep = path.sep === '\\\\' ? '\\\\\\\\' : path.sep;\nconst SERVER_STACK_MATCHER = new RegExp(\n `${escapedPathSep}(react-dom|metro-runtime|expo-router)${escapedPathSep}`\n);\n\nexport async function maybeSymbolicateAndFormatJSErrorStackLogAsync(\n projectRoot: string,\n level: 'error' | 'warn',\n error: {\n message: string;\n stack: StackFrame[];\n }\n): Promise<{\n isFallback: boolean;\n stack: string;\n}> {\n const log = new LogBoxLog({\n level: level as 'error' | 'warn',\n message: {\n content: error.message,\n substitutions: [],\n },\n isComponentError: false,\n stack: error.stack,\n category: 'static',\n componentStack: [],\n });\n\n await new Promise((res) => log.symbolicate('stack', res));\n\n const formatted = getStackAsFormattedLog(projectRoot, {\n stack: log.symbolicated?.stack?.stack ?? [],\n codeFrame: log.codeFrame,\n });\n\n // NOTE: Message is printed above stack by the default Metro logic. So we don't need to include it here.\n const symbolicatedErrorStackLog = `\\n\\n${formatted.stack}`;\n\n return {\n isFallback: formatted.isFallback,\n stack: symbolicatedErrorStackLog,\n };\n}\n\n/**\n * Attempt to parse an error message string to an unsymbolicated stack.\n */\nexport function parseErrorStringToObject(errorString: string) {\n // Find the first line of the possible stack trace\n const stackStartIndex = errorString.indexOf('\\n at ');\n if (stackStartIndex === -1) {\n // No stack trace found, return the original error string\n return null;\n }\n const message = errorString.slice(0, stackStartIndex).trim();\n const stack = errorString.slice(stackStartIndex + 1);\n\n try {\n const parsedStack = parseErrorStack(stack);\n\n return {\n message,\n stack: parsedStack,\n };\n } catch (e) {\n // If parsing fails, return the original error string\n debug('Failed to parse error stack:', e);\n return null;\n }\n}\n\nfunction augmentLogsInternal(projectRoot: string) {\n const augmentLog = (name: string, fn: typeof console.log) => {\n // @ts-expect-error: TypeScript doesn't know about polyfilled functions.\n if (fn.__polyfilled) {\n return fn;\n }\n const originalFn = fn.bind(console);\n function logWithStack(...args: any[]) {\n const stack = new Error().stack;\n // Check if the log originates from the server.\n const isServerLog = !!stack?.match(SERVER_STACK_MATCHER);\n\n if (isServerLog) {\n if (name === 'error' || name === 'warn') {\n if (\n args.length === 2 &&\n typeof args[1] === 'string' &&\n args[1].trim().startsWith('at ')\n ) {\n // react-dom custom stacks which are always broken.\n // A stack string like:\n // at div\n // at http://localhost:8081/node_modules/expo-router/node/render.bundle?platform=web&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app&resolver.environment=node&transform.environment=node:38008:27\n // at Background (http://localhost:8081/node_modules/expo-router/node/render.bundle?platform=web&dev=true&hot=false&transform.engine=hermes&transform.routerRoot=app&resolver.environment=node&transform.environment=node:151009:7)\n const customStack = args[1];\n\n try {\n const parsedStack = parseErrorStack(customStack);\n const symbolicatedStack = parsedStack.map((line: any) => {\n const mapped = mapSourcePosition({\n source: line.file,\n line: line.lineNumber,\n column: line.column,\n }) as {\n // '/Users/evanbacon/Documents/GitHub/lab/sdk51-beta/node_modules/react-native-web/dist/exports/View/index.js',\n source: string;\n line: number;\n column: number;\n // 'hrefAttrs'\n name: string | null;\n };\n\n const fallbackName = mapped.name ?? '<unknown>';\n return {\n file: mapped.source,\n lineNumber: mapped.line,\n column: mapped.column,\n // Attempt to preserve the react component name if possible.\n methodName: line.methodName\n ? line.methodName === '<unknown>'\n ? fallbackName\n : line.methodName\n : fallbackName,\n arguments: line.arguments ?? [],\n };\n });\n\n // Replace args[1] with the formatted stack.\n args[1] = '\\n' + formatParsedStackLikeMetro(projectRoot, symbolicatedStack, true);\n } catch {\n // If symbolication fails, log the original stack.\n args.push('\\n' + formatStackLikeMetro(projectRoot, customStack));\n }\n } else {\n args.push('\\n' + formatStackLikeMetro(projectRoot, stack!));\n }\n }\n\n logLikeMetro(originalFn, name, 'λ', ...args);\n } else {\n originalFn(...args);\n }\n }\n logWithStack.__polyfilled = true;\n return logWithStack;\n };\n\n ['trace', 'info', 'error', 'warn', 'log', 'group', 'groupCollapsed', 'groupEnd', 'debug'].forEach(\n (name) => {\n // @ts-expect-error\n console[name] = augmentLog(name, console[name]);\n }\n );\n}\n\nexport function formatStackLikeMetro(projectRoot: string, stack: string) {\n // Remove `Error: ` from the beginning of the stack trace.\n // Dim traces that match `INTERNAL_CALLSITES_REGEX`\n\n const stackTrace = stackTraceParser.parse(stack);\n return formatParsedStackLikeMetro(projectRoot, stackTrace);\n}\n\nfunction formatParsedStackLikeMetro(\n projectRoot: string,\n stackTrace: stackTraceParser.StackFrame[],\n isComponentStack = false\n) {\n // Remove `Error: ` from the beginning of the stack trace.\n // Dim traces that match `INTERNAL_CALLSITES_REGEX`\n\n return stackTrace\n .filter(\n (line) =>\n line.file &&\n // Ignore unsymbolicated stack frames. It's not clear how this is possible but it sometimes happens when the graph changes.\n !/^https?:\\/\\//.test(line.file) &&\n (isComponentStack ? true : line.file !== '<anonymous>')\n )\n .map((line) => {\n // Use the same regex we use in Metro config to filter out traces:\n const isCollapsed = INTERNAL_CALLSITES_REGEX.test(line.file!);\n if (!isComponentStack && isCollapsed && !env.EXPO_DEBUG) {\n return null;\n }\n // If a file is collapsed, print it with dim styling.\n const style = isCollapsed ? chalk.dim : chalk.gray;\n // Use the `at` prefix to match Node.js\n let fileName = line.file!;\n if (fileName.startsWith(path.sep)) {\n fileName = path.relative(projectRoot, fileName);\n }\n if (line.lineNumber != null) {\n fileName += `:${line.lineNumber}`;\n if (line.column != null) {\n fileName += `:${line.column}`;\n }\n }\n\n return style(` ${line.methodName} (${fileName})`);\n })\n .filter(Boolean)\n .join('\\n');\n}\n\n/** Augment console logs to check the stack trace and format like Metro logs if we think the log came from the SSR renderer or an API route. */\nexport const augmentLogs = memoize(augmentLogsInternal);\n"],"names":["augmentLogs","formatStackLikeMetro","logLikeMetro","maybeSymbolicateAndFormatJSErrorStackLogAsync","parseErrorStringToObject","debug","require","groupStack","collapsedGuardTimer","originalLogFunction","level","platform","data","logFunction","console","color","chalk","inverse","red","yellow","white","push","clearTimeout","setTimeout","includes","bold","length","pop","lastItem","trimEnd","modePrefix","toUpperCase","padEnd","escapedPathSep","path","sep","SERVER_STACK_MATCHER","RegExp","projectRoot","error","log","LogBoxLog","message","content","substitutions","isComponentError","stack","category","componentStack","Promise","res","symbolicate","formatted","getStackAsFormattedLog","symbolicated","codeFrame","symbolicatedErrorStackLog","isFallback","errorString","stackStartIndex","indexOf","slice","trim","parsedStack","parseErrorStack","e","augmentLogsInternal","augmentLog","name","fn","__polyfilled","originalFn","bind","logWithStack","args","Error","isServerLog","match","startsWith","customStack","symbolicatedStack","map","line","mapped","mapSourcePosition","source","file","lineNumber","column","fallbackName","methodName","arguments","formatParsedStackLikeMetro","forEach","stackTrace","stackTraceParser","parse","isComponentStack","filter","test","isCollapsed","INTERNAL_CALLSITES_REGEX","env","EXPO_DEBUG","style","dim","gray","fileName","relative","Boolean","join","memoize"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;IA0RYA,WAAW;eAAXA;;IAnDGC,oBAAoB;eAApBA;;IApNAC,YAAY;eAAZA;;IA6DMC,6CAA6C;eAA7CA;;IA0CNC,wBAAwB;eAAxBA;;;;yBAzHyB;;;;;;;gEACvB;;;;;;;gEACD;;;;;;;yBAEiB;;;;;;;iEACA;;;;;;qCAEU;qBACxB;oBACI;2BACE;qCACa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvC,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,MAAMC,aAAkB,EAAE;AAC1B,IAAIC;AAEG,SAASN,aACdO,mBAA6C,EAC7CC,KAAa,EACbC,QAAgB,EAChB,GAAGC,IAAW;IAEd,mBAAmB;IACnB,MAAMC,cAAcC,OAAO,CAACJ,MAAM,IAAIA,UAAU,UAAUA,QAAQ;IAClE,MAAMK,QACJL,UAAU,UACNM,gBAAK,CAACC,OAAO,CAACC,GAAG,GACjBR,UAAU,SACRM,gBAAK,CAACC,OAAO,CAACE,MAAM,GACpBH,gBAAK,CAACC,OAAO,CAACG,KAAK;IAE3B,IAAIV,UAAU,SAAS;QACrBH,WAAWc,IAAI,CAACX;IAClB,OAAO,IAAIA,UAAU,kBAAkB;QACrCH,WAAWc,IAAI,CAACX;QAChBY,aAAad;QACb,0EAA0E;QAC1EA,sBAAsBe,WAAW;YAC/B,IAAIhB,WAAWiB,QAAQ,CAAC,mBAAmB;gBACzCf,oBACEO,gBAAK,CAACC,OAAO,CAACE,MAAM,CAACM,IAAI,CAAC,WAC1B;gBAEFlB,WAAWmB,MAAM,GAAG;YACtB;QACF,GAAG;QACH;IACF,OAAO,IAAIhB,UAAU,YAAY;QAC/BH,WAAWoB,GAAG;QACd,IAAI,CAACpB,WAAWmB,MAAM,EAAE;YACtBJ,aAA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BAA2BtD,aAAawD;AACjD;AAEA,SAASF,2BACPtD,WAAmB,EACnBwD,UAAyC,EACzCG,mBAAmB,KAAK;IAExB,0DAA0D;IAC1D,mDAAmD;IAEnD,OAAOH,WACJI,MAAM,CACL,CAAChB,OACCA,KAAKI,IAAI,IACT,2HAA2H;QAC3H,CAAC,eAAea,IAAI,CAACjB,KAAKI,IAAI,KAC7BW,CAAAA,mBAAmB,OAAOf,KAAKI,IAAI,KAAK,aAAY,GAExDL,GAAG,CAAC,CAACC;QACJ,kEAAkE;QAClE,MAAMkB,cAAcC,uCAAwB,CAACF,IAAI,CAACjB,KAAKI,IAAI;QAC3D,IAAI,CAACW,oBAAoBG,eAAe,CAACE,QAAG,CAACC,UAAU,EAAE;YACvD,OAAO;QACT;QACA,qDAAqD;QACrD,MAAMC,QAAQJ,cAAcpF,gBAAK,CAACyF,GAAG,GAAGzF,gBAAK,CAAC0F,IAAI;QAClD,uCAAuC;QACvC,IAAIC,WAAWzB,KAAKI,IAAI;QACxB,IAAIqB,SAAS7B,UAAU,CAAC5C,eAAI,CAACC,GAAG,GAAG;YACjCwE,WAAWzE,eAAI,CAAC0E,QAAQ,CAACtE,aAAaqE;QACxC;QACA,IAAIzB,KAAKK,UAAU,IAAI,MAAM;YAC3BoB,YAAY,CAAC,CAAC,EAAEzB,KAAKK,UAAU,EAAE;YACjC,IAAIL,KAAKM,MAAM,IAAI,MAAM;gBACvBmB,YAAY,CAAC,CAAC,EAAEzB,KAAKM,MAAM,EAAE;YAC/B;QACF;QAEA,OAAOgB,MAAM,CAAC,EAAE,EAAEtB,KAAKQ,UAAU,CAAC,EAAE,EAAEiB,SAAS,CAAC,CAAC;IACnD,GACCT,MAAM,CAACW,SACPC,IAAI,CAAC;AACV;AAGO,MAAM9G,cAAc+G,IAAAA,WAAO,EAAC7C"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/type-generation/routes.ts"],"sourcesContent":["import fs from 'fs/promises';\nimport { Server } from 'metro';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { directoryExistsAsync } from '../../../utils/dir';\nimport { unsafeTemplate } from '../../../utils/template';\nimport { ServerLike } from '../BundlerDevServer';\nimport { metroWatchTypeScriptFiles } from '../metro/metroWatchTypeScriptFiles';\n\n// /test/[...param1]/[param2]/[param3] - captures [\"param1\", \"param2\", \"param3\"]\nexport const CAPTURE_DYNAMIC_PARAMS = /\\[(?:\\.{3})?(\\w*?)[\\]$]/g;\n// /[...param1]/ - Match [...param1]\nexport const CATCH_ALL = /\\[\\.\\.\\..+?\\]/g;\n// /[param1] - Match [param1]\nexport const SLUG = /\\[.+?\\]/g;\n// /(group1,group2,group3)/test - match (group1,group2,group3)\nexport const ARRAY_GROUP_REGEX = /\\(\\s*\\w[\\w\\s]*?,.*?\\)/g;\n// /(group1,group2,group3)/test - captures [\"group1\", \"group2\", \"group3\"]\nexport const CAPTURE_GROUP_REGEX = /[\\\\(,]\\s*(\\w[\\w\\s]*?)\\s*(?=[,\\\\)])/g;\n/**\n * Match:\n * - _layout files, +html, +not-found, string+api, etc\n * - Routes can still use `+`, but it cannot be in the last segment.\n */\nexport const TYPED_ROUTES_EXCLUSION_REGEX = /(_layout|[^/]*?\\+[^/]*?)\\.[tj]sx?$/;\n\nexport interface SetupTypedRoutesOptions {\n server?: ServerLike;\n metro?: Server | null;\n typesDirectory: string;\n projectRoot: string;\n /** Absolute expo router routes directory. */\n routerDirectory: string;\n plugin?: Record<string, any>;\n}\n\nexport async function setupTypedRoutes(options: SetupTypedRoutesOptions) {\n /*\n * In SDK 51, TypedRoutes was moved out of cli and into expo-router. For now we need to support both\n * the legacy and new versions of TypedRoutes.\n *\n * TODO (@marklawlor): Remove this check in SDK 53, only support Expo Router v4 and above.\n */\n const typedRoutesModule = resolveFrom.silent(\n options.projectRoot,\n 'expo-router/build/typed-routes'\n );\n return typedRoutesModule ? typedRoutes(typedRoutesModule, options) : legacyTypedRoutes(options);\n}\n\nasync function typedRoutes(\n typedRoutesModulePath: any,\n { server, metro, typesDirectory, projectRoot, routerDirectory, plugin }: SetupTypedRoutesOptions\n) {\n /*\n * Expo Router uses EXPO_ROUTER_APP_ROOT in multiple places to determine the root of the project.\n * In apps compiled by Metro, this code is compiled away. But Typed Routes run in NodeJS with no compilation\n * so we need to explicitly set it.\n */\n process.env.EXPO_ROUTER_APP_ROOT = routerDirectory;\n\n const typedRoutesModule = require(typedRoutesModulePath);\n\n /*\n * Typed Routes can be run with out Metro or a Server, e.g. `expo customize tsconfig.json`\n */\n if (metro && server) {\n // Setup out watcher first\n metroWatchTypeScriptFiles({\n projectRoot,\n server,\n metro,\n eventTypes: ['add', 'delete', 'change'],\n callback: typedRoutesModule.getWatchHandler(typesDirectory),\n });\n }\n\n /*\n * In SDK 52, the `regenerateDeclarations` was changed to accept plugin options.\n * This function has an optional parameter that we cannot override, so we need to ensure the user\n * is using a compatible version of `expo-router`. Otherwise, we will fallback to the old method.\n *\n * TODO(@marklawlor): In SDK53+ we should remove this check and always use the new method.\n */\n if ('version' in typedRoutesModule && typedRoutesModule.version >= 52) {\n typedRoutesModule.regenerateDeclarations(typesDirectory, plugin);\n } else {\n typedRoutesModule.regenerateDeclarations(typesDirectory);\n }\n}\n\nasync function legacyTypedRoutes({\n server,\n metro,\n typesDirectory,\n projectRoot,\n routerDirectory,\n}: SetupTypedRoutesOptions) {\n const { filePathToRoute, staticRoutes, dynamicRoutes, addFilePath, isRouteFile } =\n getTypedRoutesUtils(routerDirectory);\n\n // Typed Routes can be run with out Metro or a Server, e.g. `expo customize tsconfig.json`\n if (metro && server) {\n metroWatchTypeScriptFiles({\n projectRoot,\n server,\n metro,\n eventTypes: ['add', 'delete', 'change'],\n async callback({ filePath, type }) {\n if (!isRouteFile(filePath)) {\n return;\n }\n\n let shouldRegenerate = false;\n\n if (type === 'delete') {\n const route = filePathToRoute(filePath);\n staticRoutes.delete(route);\n dynamicRoutes.delete(route);\n shouldRegenerate = true;\n } else {\n shouldRegenerate = addFilePath(filePath);\n }\n\n if (shouldRegenerate) {\n regenerateRouterDotTS(\n typesDirectory,\n new Set([...staticRoutes.values()].flatMap((v) => Array.from(v))),\n new Set([...dynamicRoutes.values()].flatMap((v) => Array.from(v))),\n new Set(dynamicRoutes.keys())\n );\n }\n },\n });\n }\n\n if (await directoryExistsAsync(routerDirectory)) {\n // Do we need to walk the entire tree on startup?\n // Idea: Store the list of files in the last write, then simply check Git for what files have changed\n await walk(routerDirectory, addFilePath);\n }\n\n regenerateRouterDotTS(\n typesDirectory,\n new Set([...staticRoutes.values()].flatMap((v) => Array.from(v))),\n new Set([...dynamicRoutes.values()].flatMap((v) => Array.from(v))),\n new Set(dynamicRoutes.keys())\n );\n}\n\nfunction debounce<U, T extends (this: U, ...args: any[]) => void>(fn: T, delay: number): T {\n let timeoutId: NodeJS.Timeout | undefined;\n return function (this: U, ...args: any[]) {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => fn.apply(this, args), delay);\n } as T;\n}\n\n/**\n * Generate a router.d.ts file that contains all of the routes in the project.\n * Should be debounced as its very common for developers to make changes to multiple files at once (eg Save All)\n */\nconst regenerateRouterDotTS = debounce(\n async (\n typesDir: string,\n staticRoutes: Set<string>,\n dynamicRoutes: Set<string>,\n dynamicRouteTemplates: Set<string>\n ) => {\n await fs.mkdir(typesDir, { recursive: true });\n await fs.writeFile(\n path.resolve(typesDir, './router.d.ts'),\n getTemplateString(staticRoutes, dynamicRoutes, dynamicRouteTemplates)\n );\n },\n 100\n);\n\n/*\n * This is exported for testing purposes\n */\nexport function getTemplateString(\n staticRoutes: Set<string>,\n dynamicRoutes: Set<string>,\n dynamicRouteTemplates: Set<string>\n) {\n return routerDotTSTemplate({\n staticRoutes: setToUnionType(staticRoutes),\n dynamicRoutes: setToUnionType(dynamicRoutes),\n dynamicRouteParams: setToUnionType(dynamicRouteTemplates),\n });\n}\n\n/**\n * Utility functions for typed routes\n *\n * These are extracted for easier testing\n */\nexport function getTypedRoutesUtils(appRoot: string, filePathSeperator = path.sep) {\n /*\n * staticRoutes are a map where the key if the route without groups and the value\n * is another set of all group versions of the route. e.g,\n * Map([\n * [\"/\", [\"/(app)/(notes)\", \"/(app)/(profile)\"]\n * ])\n */\n const staticRoutes = new Map<string, Set<string>>([['/', new Set('/')]]);\n /*\n * dynamicRoutes are the same as staticRoutes (key if the resolved route,\n * and the value is a set of possible routes). e.g:\n *\n * /[...fruits] -> /${CatchAllRoutePart<T>}\n * /color/[color] -> /color/${SingleRoutePart<T>}\n *\n * The keys of this map are also important, as they can be used as \"static\" types\n * <Link href={{ pathname: \"/[...fruits]\",params: { fruits: [\"apple\"] } }} />\n */\n const dynamicRoutes = new Map<string, Set<string>>();\n\n function normalizedFilePath(filePath: string) {\n return filePath.replaceAll(filePathSeperator, '/');\n }\n\n const normalizedAppRoot = normalizedFilePath(appRoot);\n\n const filePathToRoute = (filePath: string) => {\n return normalizedFilePath(filePath)\n .replace(normalizedAppRoot, '')\n .replace(/index\\.[jt]sx?/, '')\n .replace(/\\.[jt]sx?$/, '');\n };\n\n const isRouteFile = (filePath: string) => {\n if (filePath.match(TYPED_ROUTES_EXCLUSION_REGEX)) {\n return false;\n }\n\n // Route files must be nested with in the appRoot\n const relative = path.relative(appRoot, filePath);\n return relative && !relative.startsWith('..') && !path.isAbsolute(relative);\n };\n\n const addFilePath = (filePath: string): boolean => {\n if (!isRouteFile(filePath)) {\n return false;\n }\n\n const route = filePathToRoute(filePath);\n\n // We have already processed this file\n if (staticRoutes.has(route) || dynamicRoutes.has(route)) {\n return false;\n }\n\n const dynamicParams = new Set(\n [...route.matchAll(CAPTURE_DYNAMIC_PARAMS)].map((match) => match[1])\n );\n const isDynamic = dynamicParams.size > 0;\n\n const addRoute = (originalRoute: string, route: string) => {\n if (isDynamic) {\n let set = dynamicRoutes.get(originalRoute);\n\n if (!set) {\n set = new Set();\n dynamicRoutes.set(originalRoute, set);\n }\n\n set.add(\n route\n .replaceAll(CATCH_ALL, '${CatchAllRoutePart<T>}')\n .replaceAll(SLUG, '${SingleRoutePart<T>}')\n );\n } else {\n let set = staticRoutes.get(originalRoute);\n\n if (!set) {\n set = new Set();\n staticRoutes.set(originalRoute, set);\n }\n\n set.add(route);\n }\n };\n\n if (!route.match(ARRAY_GROUP_REGEX)) {\n addRoute(route, route);\n }\n\n // Does this route have a group? eg /(group)\n if (route.includes('/(')) {\n const routeWithoutGroups = route.replace(/\\/\\(.+?\\)/g, '');\n addRoute(route, routeWithoutGroups);\n\n // If there are multiple groups, we need to expand them\n // eg /(test1,test2)/page => /test1/page & /test2/page\n for (const routeWithSingleGroup of extrapolateGroupRoutes(route)) {\n addRoute(route, routeWithSingleGroup);\n }\n }\n\n return true;\n };\n\n return {\n staticRoutes,\n dynamicRoutes,\n filePathToRoute,\n addFilePath,\n isRouteFile,\n };\n}\n\nexport const setToUnionType = <T>(set: Set<T>) => {\n return set.size > 0 ? [...set].map((s) => `\\`${s}\\``).join(' | ') : 'never';\n};\n\n/**\n * Recursively walk a directory and call the callback with the file path.\n */\nasync function walk(directory: string, callback: (filePath: string) => void) {\n const files = await fs.readdir(directory);\n for (const file of files) {\n const p = path.join(directory, file);\n if ((await fs.stat(p)).isDirectory()) {\n await walk(p, callback);\n } else {\n // Normalise the paths so they are easier to convert to URLs\n const normalizedPath = p.replaceAll(path.sep, '/');\n callback(normalizedPath);\n }\n }\n}\n\n/**\n * Given a route, return all possible routes that could be generated from it.\n */\nexport function extrapolateGroupRoutes(\n route: string,\n routes: Set<string> = new Set()\n): Set<string> {\n // Create a version with no groups. We will then need to cleanup double and/or trailing slashes\n routes.add(route.replaceAll(ARRAY_GROUP_REGEX, '').replaceAll(/\\/+/g, '/').replace(/\\/$/, ''));\n\n const match = route.match(ARRAY_GROUP_REGEX);\n\n if (!match) {\n routes.add(route);\n return routes;\n }\n\n const groupsMatch = match[0];\n\n for (const group of groupsMatch.matchAll(CAPTURE_GROUP_REGEX)) {\n extrapolateGroupRoutes(route.replace(groupsMatch, `(${group[1].trim()})`), routes);\n }\n\n return routes;\n}\n\n/**\n * NOTE: This code refers to a specific version of `expo-router` and is therefore unsafe to\n * mix with arbitrary versions.\n * TODO: Version this code with `expo-router` or version expo-router with `@expo/cli`.\n */\nconst routerDotTSTemplate = unsafeTemplate`/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/ban-types */\ndeclare module \"expo-router\" {\n import type { LinkProps as OriginalLinkProps } from 'expo-router/build/link/Link';\n import type { Router as OriginalRouter } from 'expo-router/build/types';\n export * from 'expo-router/build';\n\n // prettier-ignore\n type StaticRoutes = ${'staticRoutes'};\n // prettier-ignore\n type DynamicRoutes<T extends string> = ${'dynamicRoutes'};\n // prettier-ignore\n type DynamicRouteTemplate = ${'dynamicRouteParams'};\n\n type RelativePathString = \\`./\\${string}\\` | \\`../\\${string}\\` | '..';\n type AbsoluteRoute = DynamicRouteTemplate | StaticRoutes;\n type ExternalPathString = \\`\\${string}:\\${string}\\`;\n\n type ExpoRouterRoutes = DynamicRouteTemplate | StaticRoutes | RelativePathString;\n export type AllRoutes = ExpoRouterRoutes | ExternalPathString;\n\n /****************\n * Route Utils *\n ****************/\n\n type SearchOrHash = \\`?\\${string}\\` | \\`#\\${string}\\`;\n type UnknownInputParams = Record<string, string | number | (string | number)[]>;\n type UnknownOutputParams = Record<string, string | string[]>;\n\n /**\n * Return only the RoutePart of a string. If the string has multiple parts return never\n *\n * string | type\n * ---------|------\n * 123 | 123\n * /123/abc | never\n * 123?abc | never\n * ./123 | never\n * /123 | never\n * 123/../ | never\n */\n type SingleRoutePart<S extends string> = S extends \\`\\${string}/\\${string}\\`\n ? never\n : S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S extends \\`(\\${string})\\`\n ? never\n : S extends \\`[\\${string}]\\`\n ? never\n : S;\n\n /**\n * Return only the CatchAll router part. If the string has search parameters or a hash return never\n */\n type CatchAllRoutePart<S extends string> = S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S extends \\`\\${string}(\\${string})\\${string}\\`\n ? never\n : S extends \\`\\${string}[\\${string}]\\${string}\\`\n ? never\n : S;\n\n // type OptionalCatchAllRoutePart<S extends string> = S extends \\`\\${string}\\${SearchOrHash}\\` ? never : S\n\n /**\n * Return the name of a route parameter\n * '[test]' -> 'test'\n * 'test' -> never\n * '[...test]' -> '...test'\n */\n type IsParameter<Part> = Part extends \\`[\\${infer ParamName}]\\` ? ParamName : never;\n\n /**\n * Return a union of all parameter names. If there are no names return never\n *\n * /[test] -> 'test'\n * /[abc]/[...def] -> 'abc'|'...def'\n */\n type ParameterNames<Path> = Path extends \\`\\${infer PartA}/\\${infer PartB}\\`\n ? IsParameter<PartA> | ParameterNames<PartB>\n : IsParameter<Path>;\n\n /**\n * Returns all segements of a route.\n *\n * /(group)/123/abc/[id]/[...rest] -> ['(group)', '123', 'abc', '[id]', '[...rest]'\n */\n type RouteSegments<Path> = Path extends \\`\\${infer PartA}/\\${infer PartB}\\`\n ? PartA extends '' | '.'\n ? [...RouteSegments<PartB>]\n : [PartA, ...RouteSegments<PartB>]\n : Path extends ''\n ? []\n : [Path];\n\n /**\n * Returns a Record of the routes parameters as strings and CatchAll parameters\n *\n * There are two versions, input and output, as you can input 'string | number' but\n * the output will always be 'string'\n *\n * /[id]/[...rest] -> { id: string, rest: string[] }\n * /no-params -> {}\n */\n type InputRouteParams<Path> = {\n [Key in ParameterNames<Path> as Key extends \\`...\\${infer Name}\\`\n ? Name\n : Key]: Key extends \\`...\\${string}\\` ? (string | number)[] : string | number;\n } & UnknownInputParams;\n\n type OutputRouteParams<Path> = {\n [Key in ParameterNames<Path> as Key extends \\`...\\${infer Name}\\`\n ? Name\n : Key]: Key extends \\`...\\${string}\\` ? string[] : string;\n } & UnknownOutputParams;\n\n /**\n * Returns the search parameters for a route.\n */\n export type SearchParams<T extends AllRoutes> = T extends DynamicRouteTemplate\n ? OutputRouteParams<T>\n : T extends StaticRoutes\n ? never\n : UnknownOutputParams;\n\n /**\n * Route is mostly used as part of Href to ensure that a valid route is provided\n *\n * Given a dynamic route, this will return never. This is helpful for conditional logic\n *\n * /test -> /test, /test2, etc\n * /test/[abc] -> never\n * /test/resolve -> /test, /test2, etc\n *\n * Note that if we provide a value for [abc] then the route is allowed\n *\n * This is named Route to prevent confusion, as users they will often see it in tooltips\n */\n export type Route<T> = T extends string\n ? T extends DynamicRouteTemplate\n ? never\n :\n | StaticRoutes\n | RelativePathString\n | ExternalPathString\n | (T extends \\`\\${infer P}\\${SearchOrHash}\\`\n ? P extends DynamicRoutes<infer _>\n ? T\n : never\n : T extends DynamicRoutes<infer _>\n ? T\n : never)\n : never;\n\n /*********\n * Href *\n *********/\n\n export type Href<T> = T extends Record<'pathname', string> ? HrefObject<T> : Route<T>;\n\n export type HrefObject<\n R extends Record<'pathname', string>,\n P = R['pathname'],\n > = P extends DynamicRouteTemplate\n ? { pathname: P; params: InputRouteParams<P> }\n : P extends Route<P>\n ? { pathname: Route<P> | DynamicRouteTemplate; params?: never | InputRouteParams<never> }\n : never;\n\n /***********************\n * Expo Router Exports *\n ***********************/\n\n export type Router = Omit<OriginalRouter, 'push' | 'replace' | 'setParams'> & {\n /** Navigate to the provided href. */\n push: <T>(href: Href<T>) => void;\n /** Navigate to route without appending to the history. */\n replace: <T>(href: Href<T>) => void;\n /** Update the current route query params. */\n setParams: <T = ''>(params?: T extends '' ? Record<string, string> : InputRouteParams<T>) => void;\n };\n\n /** The imperative router. */\n export const router: Router;\n\n /************\n * <Link /> *\n ************/\n export interface LinkProps<T> extends OriginalLinkProps {\n href: Href<T>;\n }\n\n export interface LinkComponent {\n <T>(props: React.PropsWithChildren<LinkProps<T>>): JSX.Element;\n /** Helper method to resolve an Href object into a string. */\n resolveHref: <T>(href: Href<T>) => string;\n }\n\n /**\n * Component to render link to another route using a path.\n * Uses an anchor tag on the web.\n *\n * @param props.href Absolute path to route (e.g. \\`/feeds/hot\\`).\n * @param props.replace Should replace the current route without adding to the history.\n * @param props.asChild Forward props to child component. Useful for custom buttons.\n * @param props.children Child elements to render the content.\n * @param props.className On web, this sets the HTML \\`class\\` directly. On native, this can be used with CSS interop tools like Nativewind.\n */\n export const Link: LinkComponent;\n\n /** Redirects to the href as soon as the component is mounted. */\n export const Redirect: <T>(\n props: React.PropsWithChildren<{ href: Href<T> }>\n ) => JSX.Element;\n\n /************\n * Hooks *\n ************/\n export function useRouter(): Router;\n\n export function useLocalSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n >(): T extends AllRoutes ? SearchParams<T> : T;\n\n /** @deprecated renamed to \\`useGlobalSearchParams\\` */\n export function useSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n >(): T extends AllRoutes ? SearchParams<T> : T;\n\n export function useGlobalSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n >(): T extends AllRoutes ? SearchParams<T> : T;\n\n export function useSegments<\n T extends AbsoluteRoute | RouteSegments<AbsoluteRoute> | RelativePathString,\n >(): T extends AbsoluteRoute ? RouteSegments<T> : T extends string ? string[] : T;\n}\n`;\n"],"names":["ARRAY_GROUP_REGEX","CAPTURE_DYNAMIC_PARAMS","CAPTURE_GROUP_REGEX","CATCH_ALL","SLUG","TYPED_ROUTES_EXCLUSION_REGEX","extrapolateGroupRoutes","getTemplateString","getTypedRoutesUtils","setToUnionType","setupTypedRoutes","options","typedRoutesModule","resolveFrom","silent","projectRoot","typedRoutes","legacyTypedRoutes","typedRoutesModulePath","server","metro","typesDirectory","routerDirectory","plugin","process","env","EXPO_ROUTER_APP_ROOT","require","metroWatchTypeScriptFiles","eventTypes","callback","getWatchHandler","version","regenerateDeclarations","filePathToRoute","staticRoutes","dynamicRoutes","addFilePath","isRouteFile","filePath","type","shouldRegenerate","route","delete","regenerateRouterDotTS","Set","values","flatMap","v","Array","from","keys","directoryExistsAsync","walk","debounce","fn","delay","timeoutId","args","clearTimeout","setTimeout","apply","typesDir","dynamicRouteTemplates","fs","mkdir","recursive","writeFile","path","resolve","routerDotTSTemplate","dynamicRouteParams","appRoot","filePathSeperator","sep","Map","normalizedFilePath","replaceAll","normalizedAppRoot","replace","match","relative","startsWith","isAbsolute","has","dynamicParams","matchAll","map","isDynamic","size","addRoute","originalRoute","set","get","add","includes","routeWithoutGroups","routeWithSingleGroup","s","join","directory","files","readdir","file","p","stat","isDirectory","normalizedPath","routes","groupsMatch","group","trim","unsafeTemplate"],"mappings":";;;;;;;;;;;IAiBaA,iBAAiB;eAAjBA;;IANAC,sBAAsB;eAAtBA;;IAQAC,mBAAmB;eAAnBA;;IANAC,SAAS;eAATA;;IAEAC,IAAI;eAAJA;;IAUAC,4BAA4B;eAA5BA;;IAyTGC,sBAAsB;eAAtBA;;IA5JAC,iBAAiB;eAAjBA;;IAiBAC,mBAAmB;eAAnBA;;IAmHHC,cAAc;eAAdA;;IArRSC,gBAAgB;eAAhBA;;;;gEArCP;;;;;;;gEAEE;;;;;;;gEACO;;;;;;qBAEa;0BACN;2CAEW;;;;;;AAGnC,MAAMT,yBAAyB;AAE/B,MAAME,YAAY;AAElB,MAAMC,OAAO;AAEb,MAAMJ,oBAAoB;AAE1B,MAAME,sBAAsB;AAM5B,MAAMG,+BAA+B;AAYrC,eAAeK,iBAAiBC,OAAgC;IACrE;;;;;GAKC,GACD,MAAMC,oBAAoBC,sBAAW,CAACC,MAAM,CAC1CH,QAAQI,WAAW,EACnB;IAEF,OAAOH,oBAAoBI,YAAYJ,mBAAmBD,WAAWM,kBAAkBN;AACzF;AAEA,eAAeK,YACbE,qBAA0B,EAC1B,EAAEC,MAAM,EAAEC,KAAK,EAAEC,cAAc,EAAEN,WAAW,EAAEO,eAAe,EAAEC,MAAM,EAA2B;IAEhG;;;;GAIC,GACDC,QAAQC,GAAG,CAACC,oBAAoB,GAAGJ;IAEnC,MAAMV,oBAAoBe,QAAQT;IAElC;;GAEC,GACD,IAAIE,SAASD,QAAQ;QACnB,0BAA0B;QAC1BS,IAAAA,oDAAyB,EAAC;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CAAC,OAAO;IAE1F,MAAMC,QAAQtC,MAAMsC,KAAK,CAAChF;IAE1B,IAAI,CAACgF,OAAO;QACV4B,OAAOd,GAAG,CAACpD;QACX,OAAOkE;IACT;IAEA,MAAMC,cAAc7B,KAAK,CAAC,EAAE;IAE5B,KAAK,MAAM8B,SAASD,YAAYvB,QAAQ,CAACpF,qBAAsB;QAC7DI,uBAAuBoC,MAAMqC,OAAO,CAAC8B,aAAa,CAAC,CAAC,EAAEC,KAAK,CAAC,EAAE,CAACC,IAAI,GAAG,CAAC,CAAC,GAAGH;IAC7E;IAEA,OAAOA;AACT;AAEA;;;;CAIC,GACD,MAAMtC,sBAAsB0C,IAAAA,wBAAc,CAAA,CAAC;;;;;;;;;sBASrB,EAAE,eAAe;;yCAEE,EAAE,gBAAgB;;8BAE7B,EAAE,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqOrD,CAAC"}
1
+ {"version":3,"sources":["../../../../../src/start/server/type-generation/routes.ts"],"sourcesContent":["import type Server from '@expo/metro/metro/Server';\nimport fs from 'fs/promises';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { directoryExistsAsync } from '../../../utils/dir';\nimport { unsafeTemplate } from '../../../utils/template';\nimport { ServerLike } from '../BundlerDevServer';\nimport { metroWatchTypeScriptFiles } from '../metro/metroWatchTypeScriptFiles';\n\n// /test/[...param1]/[param2]/[param3] - captures [\"param1\", \"param2\", \"param3\"]\nexport const CAPTURE_DYNAMIC_PARAMS = /\\[(?:\\.{3})?(\\w*?)[\\]$]/g;\n// /[...param1]/ - Match [...param1]\nexport const CATCH_ALL = /\\[\\.\\.\\..+?\\]/g;\n// /[param1] - Match [param1]\nexport const SLUG = /\\[.+?\\]/g;\n// /(group1,group2,group3)/test - match (group1,group2,group3)\nexport const ARRAY_GROUP_REGEX = /\\(\\s*\\w[\\w\\s]*?,.*?\\)/g;\n// /(group1,group2,group3)/test - captures [\"group1\", \"group2\", \"group3\"]\nexport const CAPTURE_GROUP_REGEX = /[\\\\(,]\\s*(\\w[\\w\\s]*?)\\s*(?=[,\\\\)])/g;\n/**\n * Match:\n * - _layout files, +html, +not-found, string+api, etc\n * - Routes can still use `+`, but it cannot be in the last segment.\n */\nexport const TYPED_ROUTES_EXCLUSION_REGEX = /(_layout|[^/]*?\\+[^/]*?)\\.[tj]sx?$/;\n\nexport interface SetupTypedRoutesOptions {\n server?: ServerLike;\n metro?: Server | null;\n typesDirectory: string;\n projectRoot: string;\n /** Absolute expo router routes directory. */\n routerDirectory: string;\n plugin?: Record<string, any>;\n}\n\nexport async function setupTypedRoutes(options: SetupTypedRoutesOptions) {\n /*\n * In SDK 51, TypedRoutes was moved out of cli and into expo-router. For now we need to support both\n * the legacy and new versions of TypedRoutes.\n *\n * TODO (@marklawlor): Remove this check in SDK 53, only support Expo Router v4 and above.\n */\n const typedRoutesModule = resolveFrom.silent(\n options.projectRoot,\n 'expo-router/build/typed-routes'\n );\n return typedRoutesModule ? typedRoutes(typedRoutesModule, options) : legacyTypedRoutes(options);\n}\n\nasync function typedRoutes(\n typedRoutesModulePath: any,\n { server, metro, typesDirectory, projectRoot, routerDirectory, plugin }: SetupTypedRoutesOptions\n) {\n /*\n * Expo Router uses EXPO_ROUTER_APP_ROOT in multiple places to determine the root of the project.\n * In apps compiled by Metro, this code is compiled away. But Typed Routes run in NodeJS with no compilation\n * so we need to explicitly set it.\n */\n process.env.EXPO_ROUTER_APP_ROOT = routerDirectory;\n\n const typedRoutesModule = require(typedRoutesModulePath);\n\n /*\n * Typed Routes can be run with out Metro or a Server, e.g. `expo customize tsconfig.json`\n */\n if (metro && server) {\n // Setup out watcher first\n metroWatchTypeScriptFiles({\n projectRoot,\n server,\n metro,\n eventTypes: ['add', 'delete', 'change'],\n callback: typedRoutesModule.getWatchHandler(typesDirectory),\n });\n }\n\n /*\n * In SDK 52, the `regenerateDeclarations` was changed to accept plugin options.\n * This function has an optional parameter that we cannot override, so we need to ensure the user\n * is using a compatible version of `expo-router`. Otherwise, we will fallback to the old method.\n *\n * TODO(@marklawlor): In SDK53+ we should remove this check and always use the new method.\n */\n if ('version' in typedRoutesModule && typedRoutesModule.version >= 52) {\n typedRoutesModule.regenerateDeclarations(typesDirectory, plugin);\n } else {\n typedRoutesModule.regenerateDeclarations(typesDirectory);\n }\n}\n\nasync function legacyTypedRoutes({\n server,\n metro,\n typesDirectory,\n projectRoot,\n routerDirectory,\n}: SetupTypedRoutesOptions) {\n const { filePathToRoute, staticRoutes, dynamicRoutes, addFilePath, isRouteFile } =\n getTypedRoutesUtils(routerDirectory);\n\n // Typed Routes can be run with out Metro or a Server, e.g. `expo customize tsconfig.json`\n if (metro && server) {\n metroWatchTypeScriptFiles({\n projectRoot,\n server,\n metro,\n eventTypes: ['add', 'delete', 'change'],\n async callback({ filePath, type }) {\n if (!isRouteFile(filePath)) {\n return;\n }\n\n let shouldRegenerate = false;\n\n if (type === 'delete') {\n const route = filePathToRoute(filePath);\n staticRoutes.delete(route);\n dynamicRoutes.delete(route);\n shouldRegenerate = true;\n } else {\n shouldRegenerate = addFilePath(filePath);\n }\n\n if (shouldRegenerate) {\n regenerateRouterDotTS(\n typesDirectory,\n new Set([...staticRoutes.values()].flatMap((v) => Array.from(v))),\n new Set([...dynamicRoutes.values()].flatMap((v) => Array.from(v))),\n new Set(dynamicRoutes.keys())\n );\n }\n },\n });\n }\n\n if (await directoryExistsAsync(routerDirectory)) {\n // Do we need to walk the entire tree on startup?\n // Idea: Store the list of files in the last write, then simply check Git for what files have changed\n await walk(routerDirectory, addFilePath);\n }\n\n regenerateRouterDotTS(\n typesDirectory,\n new Set([...staticRoutes.values()].flatMap((v) => Array.from(v))),\n new Set([...dynamicRoutes.values()].flatMap((v) => Array.from(v))),\n new Set(dynamicRoutes.keys())\n );\n}\n\nfunction debounce<U, T extends (this: U, ...args: any[]) => void>(fn: T, delay: number): T {\n let timeoutId: NodeJS.Timeout | undefined;\n return function (this: U, ...args: any[]) {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => fn.apply(this, args), delay);\n } as T;\n}\n\n/**\n * Generate a router.d.ts file that contains all of the routes in the project.\n * Should be debounced as its very common for developers to make changes to multiple files at once (eg Save All)\n */\nconst regenerateRouterDotTS = debounce(\n async (\n typesDir: string,\n staticRoutes: Set<string>,\n dynamicRoutes: Set<string>,\n dynamicRouteTemplates: Set<string>\n ) => {\n await fs.mkdir(typesDir, { recursive: true });\n await fs.writeFile(\n path.resolve(typesDir, './router.d.ts'),\n getTemplateString(staticRoutes, dynamicRoutes, dynamicRouteTemplates)\n );\n },\n 100\n);\n\n/*\n * This is exported for testing purposes\n */\nexport function getTemplateString(\n staticRoutes: Set<string>,\n dynamicRoutes: Set<string>,\n dynamicRouteTemplates: Set<string>\n) {\n return routerDotTSTemplate({\n staticRoutes: setToUnionType(staticRoutes),\n dynamicRoutes: setToUnionType(dynamicRoutes),\n dynamicRouteParams: setToUnionType(dynamicRouteTemplates),\n });\n}\n\n/**\n * Utility functions for typed routes\n *\n * These are extracted for easier testing\n */\nexport function getTypedRoutesUtils(appRoot: string, filePathSeperator = path.sep) {\n /*\n * staticRoutes are a map where the key if the route without groups and the value\n * is another set of all group versions of the route. e.g,\n * Map([\n * [\"/\", [\"/(app)/(notes)\", \"/(app)/(profile)\"]\n * ])\n */\n const staticRoutes = new Map<string, Set<string>>([['/', new Set('/')]]);\n /*\n * dynamicRoutes are the same as staticRoutes (key if the resolved route,\n * and the value is a set of possible routes). e.g:\n *\n * /[...fruits] -> /${CatchAllRoutePart<T>}\n * /color/[color] -> /color/${SingleRoutePart<T>}\n *\n * The keys of this map are also important, as they can be used as \"static\" types\n * <Link href={{ pathname: \"/[...fruits]\",params: { fruits: [\"apple\"] } }} />\n */\n const dynamicRoutes = new Map<string, Set<string>>();\n\n function normalizedFilePath(filePath: string) {\n return filePath.replaceAll(filePathSeperator, '/');\n }\n\n const normalizedAppRoot = normalizedFilePath(appRoot);\n\n const filePathToRoute = (filePath: string) => {\n return normalizedFilePath(filePath)\n .replace(normalizedAppRoot, '')\n .replace(/index\\.[jt]sx?/, '')\n .replace(/\\.[jt]sx?$/, '');\n };\n\n const isRouteFile = (filePath: string) => {\n if (filePath.match(TYPED_ROUTES_EXCLUSION_REGEX)) {\n return false;\n }\n\n // Route files must be nested with in the appRoot\n const relative = path.relative(appRoot, filePath);\n return relative && !relative.startsWith('..') && !path.isAbsolute(relative);\n };\n\n const addFilePath = (filePath: string): boolean => {\n if (!isRouteFile(filePath)) {\n return false;\n }\n\n const route = filePathToRoute(filePath);\n\n // We have already processed this file\n if (staticRoutes.has(route) || dynamicRoutes.has(route)) {\n return false;\n }\n\n const dynamicParams = new Set(\n [...route.matchAll(CAPTURE_DYNAMIC_PARAMS)].map((match) => match[1])\n );\n const isDynamic = dynamicParams.size > 0;\n\n const addRoute = (originalRoute: string, route: string) => {\n if (isDynamic) {\n let set = dynamicRoutes.get(originalRoute);\n\n if (!set) {\n set = new Set();\n dynamicRoutes.set(originalRoute, set);\n }\n\n set.add(\n route\n .replaceAll(CATCH_ALL, '${CatchAllRoutePart<T>}')\n .replaceAll(SLUG, '${SingleRoutePart<T>}')\n );\n } else {\n let set = staticRoutes.get(originalRoute);\n\n if (!set) {\n set = new Set();\n staticRoutes.set(originalRoute, set);\n }\n\n set.add(route);\n }\n };\n\n if (!route.match(ARRAY_GROUP_REGEX)) {\n addRoute(route, route);\n }\n\n // Does this route have a group? eg /(group)\n if (route.includes('/(')) {\n const routeWithoutGroups = route.replace(/\\/\\(.+?\\)/g, '');\n addRoute(route, routeWithoutGroups);\n\n // If there are multiple groups, we need to expand them\n // eg /(test1,test2)/page => /test1/page & /test2/page\n for (const routeWithSingleGroup of extrapolateGroupRoutes(route)) {\n addRoute(route, routeWithSingleGroup);\n }\n }\n\n return true;\n };\n\n return {\n staticRoutes,\n dynamicRoutes,\n filePathToRoute,\n addFilePath,\n isRouteFile,\n };\n}\n\nexport const setToUnionType = <T>(set: Set<T>) => {\n return set.size > 0 ? [...set].map((s) => `\\`${s}\\``).join(' | ') : 'never';\n};\n\n/**\n * Recursively walk a directory and call the callback with the file path.\n */\nasync function walk(directory: string, callback: (filePath: string) => void) {\n const files = await fs.readdir(directory);\n for (const file of files) {\n const p = path.join(directory, file);\n if ((await fs.stat(p)).isDirectory()) {\n await walk(p, callback);\n } else {\n // Normalise the paths so they are easier to convert to URLs\n const normalizedPath = p.replaceAll(path.sep, '/');\n callback(normalizedPath);\n }\n }\n}\n\n/**\n * Given a route, return all possible routes that could be generated from it.\n */\nexport function extrapolateGroupRoutes(\n route: string,\n routes: Set<string> = new Set()\n): Set<string> {\n // Create a version with no groups. We will then need to cleanup double and/or trailing slashes\n routes.add(route.replaceAll(ARRAY_GROUP_REGEX, '').replaceAll(/\\/+/g, '/').replace(/\\/$/, ''));\n\n const match = route.match(ARRAY_GROUP_REGEX);\n\n if (!match) {\n routes.add(route);\n return routes;\n }\n\n const groupsMatch = match[0];\n\n for (const group of groupsMatch.matchAll(CAPTURE_GROUP_REGEX)) {\n extrapolateGroupRoutes(route.replace(groupsMatch, `(${group[1].trim()})`), routes);\n }\n\n return routes;\n}\n\n/**\n * NOTE: This code refers to a specific version of `expo-router` and is therefore unsafe to\n * mix with arbitrary versions.\n * TODO: Version this code with `expo-router` or version expo-router with `@expo/cli`.\n */\nconst routerDotTSTemplate = unsafeTemplate`/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/ban-types */\ndeclare module \"expo-router\" {\n import type { LinkProps as OriginalLinkProps } from 'expo-router/build/link/Link';\n import type { Router as OriginalRouter } from 'expo-router/build/types';\n export * from 'expo-router/build';\n\n // prettier-ignore\n type StaticRoutes = ${'staticRoutes'};\n // prettier-ignore\n type DynamicRoutes<T extends string> = ${'dynamicRoutes'};\n // prettier-ignore\n type DynamicRouteTemplate = ${'dynamicRouteParams'};\n\n type RelativePathString = \\`./\\${string}\\` | \\`../\\${string}\\` | '..';\n type AbsoluteRoute = DynamicRouteTemplate | StaticRoutes;\n type ExternalPathString = \\`\\${string}:\\${string}\\`;\n\n type ExpoRouterRoutes = DynamicRouteTemplate | StaticRoutes | RelativePathString;\n export type AllRoutes = ExpoRouterRoutes | ExternalPathString;\n\n /****************\n * Route Utils *\n ****************/\n\n type SearchOrHash = \\`?\\${string}\\` | \\`#\\${string}\\`;\n type UnknownInputParams = Record<string, string | number | (string | number)[]>;\n type UnknownOutputParams = Record<string, string | string[]>;\n\n /**\n * Return only the RoutePart of a string. If the string has multiple parts return never\n *\n * string | type\n * ---------|------\n * 123 | 123\n * /123/abc | never\n * 123?abc | never\n * ./123 | never\n * /123 | never\n * 123/../ | never\n */\n type SingleRoutePart<S extends string> = S extends \\`\\${string}/\\${string}\\`\n ? never\n : S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S extends \\`(\\${string})\\`\n ? never\n : S extends \\`[\\${string}]\\`\n ? never\n : S;\n\n /**\n * Return only the CatchAll router part. If the string has search parameters or a hash return never\n */\n type CatchAllRoutePart<S extends string> = S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S extends \\`\\${string}(\\${string})\\${string}\\`\n ? never\n : S extends \\`\\${string}[\\${string}]\\${string}\\`\n ? never\n : S;\n\n // type OptionalCatchAllRoutePart<S extends string> = S extends \\`\\${string}\\${SearchOrHash}\\` ? never : S\n\n /**\n * Return the name of a route parameter\n * '[test]' -> 'test'\n * 'test' -> never\n * '[...test]' -> '...test'\n */\n type IsParameter<Part> = Part extends \\`[\\${infer ParamName}]\\` ? ParamName : never;\n\n /**\n * Return a union of all parameter names. If there are no names return never\n *\n * /[test] -> 'test'\n * /[abc]/[...def] -> 'abc'|'...def'\n */\n type ParameterNames<Path> = Path extends \\`\\${infer PartA}/\\${infer PartB}\\`\n ? IsParameter<PartA> | ParameterNames<PartB>\n : IsParameter<Path>;\n\n /**\n * Returns all segements of a route.\n *\n * /(group)/123/abc/[id]/[...rest] -> ['(group)', '123', 'abc', '[id]', '[...rest]'\n */\n type RouteSegments<Path> = Path extends \\`\\${infer PartA}/\\${infer PartB}\\`\n ? PartA extends '' | '.'\n ? [...RouteSegments<PartB>]\n : [PartA, ...RouteSegments<PartB>]\n : Path extends ''\n ? []\n : [Path];\n\n /**\n * Returns a Record of the routes parameters as strings and CatchAll parameters\n *\n * There are two versions, input and output, as you can input 'string | number' but\n * the output will always be 'string'\n *\n * /[id]/[...rest] -> { id: string, rest: string[] }\n * /no-params -> {}\n */\n type InputRouteParams<Path> = {\n [Key in ParameterNames<Path> as Key extends \\`...\\${infer Name}\\`\n ? Name\n : Key]: Key extends \\`...\\${string}\\` ? (string | number)[] : string | number;\n } & UnknownInputParams;\n\n type OutputRouteParams<Path> = {\n [Key in ParameterNames<Path> as Key extends \\`...\\${infer Name}\\`\n ? Name\n : Key]: Key extends \\`...\\${string}\\` ? string[] : string;\n } & UnknownOutputParams;\n\n /**\n * Returns the search parameters for a route.\n */\n export type SearchParams<T extends AllRoutes> = T extends DynamicRouteTemplate\n ? OutputRouteParams<T>\n : T extends StaticRoutes\n ? never\n : UnknownOutputParams;\n\n /**\n * Route is mostly used as part of Href to ensure that a valid route is provided\n *\n * Given a dynamic route, this will return never. This is helpful for conditional logic\n *\n * /test -> /test, /test2, etc\n * /test/[abc] -> never\n * /test/resolve -> /test, /test2, etc\n *\n * Note that if we provide a value for [abc] then the route is allowed\n *\n * This is named Route to prevent confusion, as users they will often see it in tooltips\n */\n export type Route<T> = T extends string\n ? T extends DynamicRouteTemplate\n ? never\n :\n | StaticRoutes\n | RelativePathString\n | ExternalPathString\n | (T extends \\`\\${infer P}\\${SearchOrHash}\\`\n ? P extends DynamicRoutes<infer _>\n ? T\n : never\n : T extends DynamicRoutes<infer _>\n ? T\n : never)\n : never;\n\n /*********\n * Href *\n *********/\n\n export type Href<T> = T extends Record<'pathname', string> ? HrefObject<T> : Route<T>;\n\n export type HrefObject<\n R extends Record<'pathname', string>,\n P = R['pathname'],\n > = P extends DynamicRouteTemplate\n ? { pathname: P; params: InputRouteParams<P> }\n : P extends Route<P>\n ? { pathname: Route<P> | DynamicRouteTemplate; params?: never | InputRouteParams<never> }\n : never;\n\n /***********************\n * Expo Router Exports *\n ***********************/\n\n export type Router = Omit<OriginalRouter, 'push' | 'replace' | 'setParams'> & {\n /** Navigate to the provided href. */\n push: <T>(href: Href<T>) => void;\n /** Navigate to route without appending to the history. */\n replace: <T>(href: Href<T>) => void;\n /** Update the current route query params. */\n setParams: <T = ''>(params?: T extends '' ? Record<string, string> : InputRouteParams<T>) => void;\n };\n\n /** The imperative router. */\n export const router: Router;\n\n /************\n * <Link /> *\n ************/\n export interface LinkProps<T> extends OriginalLinkProps {\n href: Href<T>;\n }\n\n export interface LinkComponent {\n <T>(props: React.PropsWithChildren<LinkProps<T>>): JSX.Element;\n /** Helper method to resolve an Href object into a string. */\n resolveHref: <T>(href: Href<T>) => string;\n }\n\n /**\n * Component to render link to another route using a path.\n * Uses an anchor tag on the web.\n *\n * @param props.href Absolute path to route (e.g. \\`/feeds/hot\\`).\n * @param props.replace Should replace the current route without adding to the history.\n * @param props.asChild Forward props to child component. Useful for custom buttons.\n * @param props.children Child elements to render the content.\n * @param props.className On web, this sets the HTML \\`class\\` directly. On native, this can be used with CSS interop tools like Nativewind.\n */\n export const Link: LinkComponent;\n\n /** Redirects to the href as soon as the component is mounted. */\n export const Redirect: <T>(\n props: React.PropsWithChildren<{ href: Href<T> }>\n ) => JSX.Element;\n\n /************\n * Hooks *\n ************/\n export function useRouter(): Router;\n\n export function useLocalSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n >(): T extends AllRoutes ? SearchParams<T> : T;\n\n /** @deprecated renamed to \\`useGlobalSearchParams\\` */\n export function useSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n >(): T extends AllRoutes ? SearchParams<T> : T;\n\n export function useGlobalSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n >(): T extends AllRoutes ? SearchParams<T> : T;\n\n export function useSegments<\n T extends AbsoluteRoute | RouteSegments<AbsoluteRoute> | RelativePathString,\n >(): T extends AbsoluteRoute ? RouteSegments<T> : T extends string ? string[] : T;\n}\n`;\n"],"names":["ARRAY_GROUP_REGEX","CAPTURE_DYNAMIC_PARAMS","CAPTURE_GROUP_REGEX","CATCH_ALL","SLUG","TYPED_ROUTES_EXCLUSION_REGEX","extrapolateGroupRoutes","getTemplateString","getTypedRoutesUtils","setToUnionType","setupTypedRoutes","options","typedRoutesModule","resolveFrom","silent","projectRoot","typedRoutes","legacyTypedRoutes","typedRoutesModulePath","server","metro","typesDirectory","routerDirectory","plugin","process","env","EXPO_ROUTER_APP_ROOT","require","metroWatchTypeScriptFiles","eventTypes","callback","getWatchHandler","version","regenerateDeclarations","filePathToRoute","staticRoutes","dynamicRoutes","addFilePath","isRouteFile","filePath","type","shouldRegenerate","route","delete","regenerateRouterDotTS","Set","values","flatMap","v","Array","from","keys","directoryExistsAsync","walk","debounce","fn","delay","timeoutId","args","clearTimeout","setTimeout","apply","typesDir","dynamicRouteTemplates","fs","mkdir","recursive","writeFile","path","resolve","routerDotTSTemplate","dynamicRouteParams","appRoot","filePathSeperator","sep","Map","normalizedFilePath","replaceAll","normalizedAppRoot","replace","match","relative","startsWith","isAbsolute","has","dynamicParams","matchAll","map","isDynamic","size","addRoute","originalRoute","set","get","add","includes","routeWithoutGroups","routeWithSingleGroup","s","join","directory","files","readdir","file","p","stat","isDirectory","normalizedPath","routes","groupsMatch","group","trim","unsafeTemplate"],"mappings":";;;;;;;;;;;IAiBaA,iBAAiB;eAAjBA;;IANAC,s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,GAAG,CAAC,CAAC,GAAGH;IAC7E;IAEA,OAAOA;AACT;AAEA;;;;CAIC,GACD,MAAMtC,sBAAsB0C,IAAAA,wBAAc,CAAA,CAAC;;;;;;;;;sBASrB,EAAE,eAAe;;yCAEE,EAAE,gBAAgB;;8BAE7B,EAAE,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqOrD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/type-generation/startTypescriptTypeGeneration.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport fs from 'fs/promises';\nimport { Server } from 'metro';\nimport path from 'path';\n\nimport { removeExpoEnvDTS, writeExpoEnvDTS } from './expo-env';\nimport { setupTypedRoutes } from './routes';\nimport { forceRemovalTSConfig, forceUpdateTSConfig } from './tsconfig';\nimport { upsertGitIgnoreContents } from '../../../utils/mergeGitIgnorePaths';\nimport { ensureDotExpoProjectDirectoryInitialized } from '../../project/dotExpo';\nimport { ServerLike } from '../BundlerDevServer';\nimport { getRouterDirectoryModuleIdWithManifest } from '../metro/router';\n\nexport interface TypeScriptTypeGenerationOptions {\n server?: ServerLike;\n metro?: Server | null;\n projectRoot: string;\n}\n\nconst debug = require('debug')('expo:typed-routes') as typeof console.log;\n\n/** Setup all requisite features for statically typed routes in Expo Router v2 / SDK +49. */\nexport async function startTypescriptTypeGenerationAsync({\n metro,\n projectRoot,\n server,\n}: TypeScriptTypeGenerationOptions) {\n const { exp } = getConfig(projectRoot);\n\n // If typed routes are disabled, remove any files that were added.\n if (!exp.experiments?.typedRoutes) {\n debug('Removing typed routes side-effects (experiments.typedRoutes: false)');\n await Promise.all([forceRemovalTSConfig(projectRoot), removeExpoEnvDTS(projectRoot)]);\n } else {\n const dotExpoDir = ensureDotExpoProjectDirectoryInitialized(projectRoot);\n const typesDirectory = path.resolve(dotExpoDir, './types');\n debug(\n 'Ensuring typed routes side-effects are setup (experiments.typedRoutes: true, typesDirectory: %s)',\n typesDirectory\n );\n\n // Ensure the types directory exists.\n await fs.mkdir(typesDirectory, { recursive: true });\n\n await Promise.all([\n upsertGitIgnoreContents(path.join(projectRoot, '.gitignore'), 'expo-env.d.ts'),\n writeExpoEnvDTS(projectRoot),\n forceUpdateTSConfig(projectRoot),\n setupTypedRoutes({\n metro,\n server,\n typesDirectory,\n projectRoot,\n routerDirectory: path.join(\n projectRoot,\n getRouterDirectoryModuleIdWithManifest(projectRoot, exp)\n ),\n plugin: exp?.extra?.router,\n }),\n ]);\n }\n}\n"],"names":["startTypescriptTypeGenerationAsync","debug","require","metro","projectRoot","server","exp","getConfig","experiments","typedRoutes","Promise","all","forceRemovalTSConfig","removeExpoEnvDTS","dotExpoDir","ensureDotExpoProjectDirectoryInitialized","typesDirectory","path","resolve","fs","mkdir","recursive","upsertGitIgnoreContents","join","writeExpoEnvDTS","forceUpdateTSConfig","setupTypedRoutes","routerDirectory","getRouterDirectoryModuleIdWithManifest","plugin","extra","router"],"mappings":";;;;+BAsBsBA;;;eAAAA;;;;yBAtBI;;;;;;;gEACX;;;;;;;gEAEE;;;;;;yBAEiC;wBACjB;0BACyB;qCAClB;yBACiB;wBAEF;;;;;;AAQvD,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,eAAeF,mCAAmC,EACvDG,KAAK,EACLC,WAAW,EACXC,MAAM,EAC0B;QAI3BC;IAHL,MAAM,EAAEA,GAAG,EAAE,GAAGC,IAAAA,mBAAS,EAACH;IAE1B,kEAAkE;IAClE,IAAI,GAACE,mBAAAA,IAAIE,WAAW,qBAAfF,iBAAiBG,WAAW,GAAE;QACjCR,MAAM;QACN,MAAMS,QAAQC,GAAG,CAAC;YAACC,IAAAA,8BAAoB,EAACR;YAAcS,IAAAA,yBAAgB,EAACT;SAAa;IACtF,OAAO;YAwBOE;QAvBZ,MAAMQ,aAAaC,IAAAA,iDAAwC,EAACX;QAC5D,MAAMY,iBAAiBC,eAAI,CAACC,OAAO,CAACJ,YAAY;QAChDb,MACE,oGACAe;QAGF,qCAAqC;QACrC,MAAMG,mBAAE,CAACC,KAAK,CAACJ,gBAAgB;YAAEK,WAAW;QAAK;QAEjD,MAAMX,QAAQC,GAAG,CAAC;YAChBW,IAAAA,4CAAuB,EAACL,eAAI,CAACM,IAAI,CAACnB,aAAa,eAAe;YAC9DoB,IAAAA,wBAAe,EAACpB;YAChBqB,IAAAA,6BAAmB,EAACrB;YACpBsB,IAAAA,wBAAgB,EAAC;gBACfvB;gBACAE;gBACAW;gBACAZ;gBACAuB,iBAAiBV,eAAI,CAACM,IAAI,CACxBnB,aACAwB,IAAAA,8CAAsC,EAACxB,aAAaE;gBAEtDuB,MAAM,EAAEvB,wBAAAA,aAAAA,IAAKwB,KAAK,qBAAVxB,WAAYyB,MAAM;YAC5B;SACD;IACH;AACF"}
1
+ {"version":3,"sources":["../../../../../src/start/server/type-generation/startTypescriptTypeGeneration.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport type Server from '@expo/metro/metro/Server';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { removeExpoEnvDTS, writeExpoEnvDTS } from './expo-env';\nimport { setupTypedRoutes } from './routes';\nimport { forceRemovalTSConfig, forceUpdateTSConfig } from './tsconfig';\nimport { upsertGitIgnoreContents } from '../../../utils/mergeGitIgnorePaths';\nimport { ensureDotExpoProjectDirectoryInitialized } from '../../project/dotExpo';\nimport { ServerLike } from '../BundlerDevServer';\nimport { getRouterDirectoryModuleIdWithManifest } from '../metro/router';\n\nexport interface TypeScriptTypeGenerationOptions {\n server?: ServerLike;\n metro?: Server | null;\n projectRoot: string;\n}\n\nconst debug = require('debug')('expo:typed-routes') as typeof console.log;\n\n/** Setup all requisite features for statically typed routes in Expo Router v2 / SDK +49. */\nexport async function startTypescriptTypeGenerationAsync({\n metro,\n projectRoot,\n server,\n}: TypeScriptTypeGenerationOptions) {\n const { exp } = getConfig(projectRoot);\n\n // If typed routes are disabled, remove any files that were added.\n if (!exp.experiments?.typedRoutes) {\n debug('Removing typed routes side-effects (experiments.typedRoutes: false)');\n await Promise.all([forceRemovalTSConfig(projectRoot), removeExpoEnvDTS(projectRoot)]);\n } else {\n const dotExpoDir = ensureDotExpoProjectDirectoryInitialized(projectRoot);\n const typesDirectory = path.resolve(dotExpoDir, './types');\n debug(\n 'Ensuring typed routes side-effects are setup (experiments.typedRoutes: true, typesDirectory: %s)',\n typesDirectory\n );\n\n // Ensure the types directory exists.\n await fs.mkdir(typesDirectory, { recursive: true });\n\n await Promise.all([\n upsertGitIgnoreContents(path.join(projectRoot, '.gitignore'), 'expo-env.d.ts'),\n writeExpoEnvDTS(projectRoot),\n forceUpdateTSConfig(projectRoot),\n setupTypedRoutes({\n metro,\n server,\n typesDirectory,\n projectRoot,\n routerDirectory: path.join(\n projectRoot,\n getRouterDirectoryModuleIdWithManifest(projectRoot, exp)\n ),\n plugin: exp?.extra?.router,\n }),\n ]);\n }\n}\n"],"names":["startTypescriptTypeGenerationAsync","debug","require","metro","projectRoot","server","exp","getConfig","experiments","typedRoutes","Promise","all","forceRemovalTSConfig","removeExpoEnvDTS","dotExpoDir","ensureDotExpoProjectDirectoryInitialized","typesDirectory","path","resolve","fs","mkdir","recursive","upsertGitIgnoreContents","join","writeExpoEnvDTS","forceUpdateTSConfig","setupTypedRoutes","routerDirectory","getRouterDirectoryModuleIdWithManifest","plugin","extra","router"],"mappings":";;;;+BAsBsBA;;;eAAAA;;;;yBAtBI;;;;;;;gEAEX;;;;;;;gEACE;;;;;;yBAEiC;wBACjB;0BACyB;qCAClB;yBACiB;wBAEF;;;;;;AAQvD,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,eAAeF,mCAAmC,EACvDG,KAAK,EACLC,WAAW,EACXC,MAAM,EAC0B;QAI3BC;IAHL,MAAM,EAAEA,GAAG,EAAE,GAAGC,IAAAA,mBAAS,EAACH;IAE1B,kEAAkE;IAClE,IAAI,GAACE,mBAAAA,IAAIE,WAAW,qBAAfF,iBAAiBG,WAAW,GAAE;QACjCR,MAAM;QACN,MAAMS,QAAQC,GAAG,CAAC;YAACC,IAAAA,8BAAoB,EAACR;YAAcS,IAAAA,yBAAgB,EAACT;SAAa;IACtF,OAAO;YAwBOE;QAvBZ,MAAMQ,aAAaC,IAAAA,iDAAwC,EAACX;QAC5D,MAAMY,iBAAiBC,eAAI,CAACC,OAAO,CAACJ,YAAY;QAChDb,MACE,oGACAe;QAGF,qCAAqC;QACrC,MAAMG,mBAAE,CAACC,KAAK,CAACJ,gBAAgB;YAAEK,WAAW;QAAK;QAEjD,MAAMX,QAAQC,GAAG,CAAC;YAChBW,IAAAA,4CAAuB,EAACL,eAAI,CAACM,IAAI,CAACnB,aAAa,eAAe;YAC9DoB,IAAAA,wBAAe,EAACpB;YAChBqB,IAAAA,6BAAmB,EAACrB;YACpBsB,IAAAA,wBAAgB,EAAC;gBACfvB;gBACAE;gBACAW;gBACAZ;gBACAuB,iBAAiBV,eAAI,CAACM,IAAI,CACxBnB,aACAwB,IAAAA,8CAAsC,EAACxB,aAAaE;gBAEtDuB,MAAM,EAAEvB,wBAAAA,aAAAA,IAAKwB,KAAK,qBAAVxB,WAAYyB,MAAM;YAC5B;SACD;IACH;AACF"}
@@ -0,0 +1,2 @@
1
+ // NOTE(@kitten): Provide type augmentations for `@expo/metro`
2
+ import 'expo-module-scripts/types/expo-metro-augmentations.d.ts';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utils/build-cache-providers/index.ts"],"sourcesContent":["import { ExpoConfig, BuildCacheProviderPlugin, BuildCacheProvider, RunOptions } from '@expo/config';\nimport fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { moduleNameIsDirectFileReference, moduleNameIsPackageReference } from './helpers';\nimport * as Log from '../../log';\nimport { ensureDependenciesAsync } from '../../start/doctor/dependencies/ensureDependenciesAsync';\nimport { CommandError } from '../errors';\n\nconst debug = require('debug')('expo:run:build-cache-provider') as typeof console.log;\n\nexport const resolveBuildCacheProvider = async (\n provider: Required<Required<ExpoConfig>['experiments']>['buildCacheProvider'] | undefined,\n projectRoot: string\n): Promise<BuildCacheProvider | undefined> => {\n if (!provider) {\n return;\n }\n\n if (provider === 'eas') {\n try {\n await ensureDependenciesAsync(projectRoot, {\n isProjectMutable: true,\n installMessage:\n 'eas-build-cache-provider package is required to use the EAS build cache.\\n',\n warningMessage: 'Unable to to use the EAS remote build cache.',\n requiredPackages: [\n {\n pkg: 'eas-build-cache-provider',\n file: 'eas-build-cache-provider/package.json',\n dev: true,\n },\n ],\n });\n\n // We need to manually load dependencies installed on the fly\n const plugin = await manuallyLoadDependency(projectRoot, 'eas-build-cache-provider');\n\n return {\n plugin: plugin.default ?? plugin,\n options: {},\n };\n } catch (error: any) {\n if (error instanceof CommandError) {\n Log.warn(error.message);\n } else {\n throw error;\n }\n return undefined;\n }\n }\n\n if (typeof provider === 'object' && typeof provider.plugin === 'string') {\n const plugin = resolvePluginFunction(projectRoot, provider.plugin);\n\n return { plugin, options: provider.options };\n }\n\n throw new Error('Invalid build cache provider');\n};\n\nexport async function resolveBuildCache({\n projectRoot,\n platform,\n provider,\n runOptions,\n}: {\n projectRoot: string;\n platform: 'android' | 'ios';\n provider: BuildCacheProvider;\n runOptions: RunOptions;\n}): Promise<string | null> {\n const fingerprintHash = await calculateFingerprintHashAsync({\n projectRoot,\n platform,\n provider,\n runOptions,\n });\n if (!fingerprintHash) {\n return null;\n }\n\n if ('resolveRemoteBuildCache' in provider.plugin) {\n Log.warn('The resolveRemoteBuildCache function is deprecated. Use resolveBuildCache instead.');\n return await provider.plugin.resolveRemoteBuildCache(\n { fingerprintHash, platform, runOptions, projectRoot },\n provider.options\n );\n }\n return await provider.plugin.resolveBuildCache(\n { fingerprintHash, platform, runOptions, projectRoot },\n provider.options\n );\n}\n\nexport async function uploadBuildCache({\n projectRoot,\n platform,\n provider,\n buildPath,\n runOptions,\n}: {\n projectRoot: string;\n platform: 'android' | 'ios';\n provider: BuildCacheProvider;\n buildPath: string;\n runOptions: RunOptions;\n}): Promise<void> {\n const fingerprintHash = await calculateFingerprintHashAsync({\n projectRoot,\n platform,\n provider,\n runOptions,\n });\n if (!fingerprintHash) {\n debug('No fingerprint hash found, skipping upload');\n return;\n }\n\n if ('uploadRemoteBuildCache' in provider.plugin) {\n Log.warn('The uploadRemoteBuildCache function is deprecated. Use uploadBuildCache instead.');\n await provider.plugin.uploadRemoteBuildCache(\n {\n projectRoot,\n platform,\n fingerprintHash,\n buildPath,\n runOptions,\n },\n provider.options\n );\n } else {\n await provider.plugin.uploadBuildCache(\n {\n projectRoot,\n platform,\n fingerprintHash,\n buildPath,\n runOptions,\n },\n provider.options\n );\n }\n}\n\nasync function calculateFingerprintHashAsync({\n projectRoot,\n platform,\n provider,\n runOptions,\n}: {\n projectRoot: string;\n platform: 'android' | 'ios';\n provider: BuildCacheProvider;\n runOptions: RunOptions;\n}): Promise<string | null> {\n if (provider.plugin.calculateFingerprintHash) {\n return await provider.plugin.calculateFingerprintHash(\n { projectRoot, platform, runOptions },\n provider.options\n );\n }\n\n const Fingerprint = importFingerprintForDev(projectRoot);\n if (!Fingerprint) {\n debug('@expo/fingerprint is not installed in the project, unable to calculate fingerprint');\n return null;\n }\n const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);\n\n return fingerprint.hash;\n}\n\nfunction importFingerprintForDev(projectRoot: string): null | typeof import('@expo/fingerprint') {\n try {\n return require(require.resolve('@expo/fingerprint', { paths: [projectRoot] }));\n } catch (error: any) {\n if ('code' in error && error.code === 'MODULE_NOT_FOUND') {\n return null;\n }\n throw error;\n }\n}\n\n/**\n * Resolve the provider plugin from a node module or package.\n * If the module or package does not include a provider plugin, this function throws.\n * The resolution is done in following order:\n * 1. Is the reference a relative file path or an import specifier with file path? e.g. `./file.js`, `pkg/file.js` or `@org/pkg/file.js`?\n * - Resolve the provider plugin as-is\n * 2. Does the module have a valid provider plugin in the `main` field?\n * - Resolve the `main` entry point as provider plugin\n */\nfunction resolvePluginFilePathForModule(projectRoot: string, pluginReference: string) {\n if (moduleNameIsDirectFileReference(pluginReference)) {\n // Only resolve `./file.js`, `package/file.js`, `@org/package/file.js`\n const pluginScriptFile = resolveFrom.silent(projectRoot, pluginReference);\n if (pluginScriptFile) {\n return pluginScriptFile;\n }\n } else if (moduleNameIsPackageReference(pluginReference)) {\n // Try to resole the `main` entry as config plugin\n return resolveFrom(projectRoot, pluginReference);\n }\n\n throw new Error(\n `Failed to resolve provider plugin for module \"${pluginReference}\" relative to \"${projectRoot}\". Do you have node modules installed?`\n );\n}\n\n// Resolve the module function and assert type\nexport function resolvePluginFunction(\n projectRoot: string,\n pluginReference: string\n): BuildCacheProviderPlugin {\n const pluginFile = resolvePluginFilePathForModule(projectRoot, pluginReference);\n\n try {\n let plugin = require(pluginFile);\n if (plugin?.default != null) {\n plugin = plugin.default;\n }\n\n if (\n typeof plugin !== 'object' ||\n (typeof plugin.resolveRemoteBuildCache !== 'function' &&\n typeof plugin.resolveBuildCache !== 'function') ||\n (typeof plugin.uploadRemoteBuildCache !== 'function' &&\n typeof plugin.uploadBuildCache !== 'function')\n ) {\n throw new Error(`\n The provider plugin \"${pluginReference}\" must export an object containing\n the resolveBuildCache and uploadBuildCache functions.\n `);\n }\n return plugin;\n } catch (error) {\n if (error instanceof SyntaxError) {\n // Add error linking to the docs of how create a valid provider plugin\n }\n throw error;\n }\n}\n\nasync function manuallyLoadDependency(projectRoot: string, packageName: string) {\n const possiblePaths = [\n path.join(projectRoot, 'node_modules'),\n ...(require.resolve.paths(packageName) ?? []),\n ];\n const nodeModulesFolder = possiblePaths?.find((p) => {\n const packagePath = path.join(p, packageName);\n return fs.existsSync(packagePath);\n });\n if (!nodeModulesFolder) {\n throw new Error(`Package ${packageName} not found in ${possiblePaths}`);\n }\n\n const { main } = await import(path.join(nodeModulesFolder, packageName, 'package.json'));\n return import(path.join(nodeModulesFolder, packageName, main));\n}\n"],"names":["resolveBuildCache","resolveBuildCacheProvider","resolvePluginFunction","uploadBuildCache","debug","require","provider","projectRoot","ensureDependenciesAsync","isProjectMutable","installMessage","warningMessage","requiredPackages","pkg","file","dev","plugin","manuallyLoadDependency","default","options","error","CommandError","Log","warn","message","undefined","Error","platform","runOptions","fingerprintHash","calculateFingerprintHashAsync","resolveRemoteBuildCache","buildPath","uploadRemoteBuildCache","calculateFingerprintHash","Fingerprint","importFingerprintForDev","fingerprint","createFingerprintAsync","hash","resolve","paths","code","resolvePluginFilePathForModule","pluginReference","moduleNameIsDirectFileReference","pluginScriptFile","resolveFrom","silent","moduleNameIsPackageReference","pluginFile","SyntaxError","packageName","possiblePaths","path","join","nodeModulesFolder","find","p","packagePath","fs","existsSync","main"],"mappings":";;;;;;;;;;;IA8DsBA,iBAAiB;eAAjBA;;IAlDTC,yBAAyB;eAAzBA;;IAwMGC,qBAAqB;eAArBA;;IApHMC,gBAAgB;eAAhBA;;;;gEA/FP;;;;;;;gEACE;;;;;;;gEACO;;;;;;yBAEsD;6DACzD;yCACmB;wBACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAExB,MAAMJ,4BAA4B,OACvCK,UACAC;IAEA,IAAI,CAACD,UAAU;QACb;IACF;IAEA,IAAIA,aAAa,OAAO;QACtB,IAAI;YACF,MAAME,IAAAA,gDAAuB,EAACD,aAAa;gBACzCE,kBAAkB;gBAClBC,gBACE;gBACFC,gBAAgB;gBAChBC,kBAAkB;oBAChB;wBACEC,KAAK;wBACLC,MAAM;wBACNC,KAAK;oBACP;iBACD;YACH;YAEA,6DAA6D;YAC7D,MAAMC,SAAS,MAAMC,uBAAuBV,aAAa;YAEzD,OAAO;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ACT"}
1
+ {"version":3,"sources":["../../../../src/utils/build-cache-providers/index.ts"],"sourcesContent":["import { ExpoConfig, BuildCacheProviderPlugin, BuildCacheProvider, RunOptions } from '@expo/config';\nimport fs from 'fs';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { moduleNameIsDirectFileReference, moduleNameIsPackageReference } from './helpers';\nimport * as Log from '../../log';\nimport { ensureDependenciesAsync } from '../../start/doctor/dependencies/ensureDependenciesAsync';\nimport { CommandError } from '../errors';\n\nconst debug = require('debug')('expo:run:build-cache-provider') as typeof console.log;\n\nexport const resolveBuildCacheProvider = async (\n provider: Required<ExpoConfig>['buildCacheProvider'] | undefined,\n projectRoot: string\n): Promise<BuildCacheProvider | undefined> => {\n if (!provider) {\n return;\n }\n\n if (provider === 'eas') {\n try {\n await ensureDependenciesAsync(projectRoot, {\n isProjectMutable: true,\n installMessage:\n 'eas-build-cache-provider package is required to use the EAS build cache.\\n',\n warningMessage: 'Unable to to use the EAS remote build cache.',\n requiredPackages: [\n {\n pkg: 'eas-build-cache-provider',\n file: 'eas-build-cache-provider/package.json',\n dev: true,\n },\n ],\n });\n\n // We need to manually load dependencies installed on the fly\n const plugin = await manuallyLoadDependency(projectRoot, 'eas-build-cache-provider');\n\n return {\n plugin: plugin.default ?? plugin,\n options: {},\n };\n } catch (error: any) {\n if (error instanceof CommandError) {\n Log.warn(error.message);\n } else {\n throw error;\n }\n return undefined;\n }\n }\n\n if (typeof provider === 'object' && typeof provider.plugin === 'string') {\n const plugin = resolvePluginFunction(projectRoot, provider.plugin);\n\n return { plugin, options: provider.options };\n }\n\n throw new Error('Invalid build cache provider');\n};\n\nexport async function resolveBuildCache({\n projectRoot,\n platform,\n provider,\n runOptions,\n}: {\n projectRoot: string;\n platform: 'android' | 'ios';\n provider: BuildCacheProvider;\n runOptions: RunOptions;\n}): Promise<string | null> {\n const fingerprintHash = await calculateFingerprintHashAsync({\n projectRoot,\n platform,\n provider,\n runOptions,\n });\n if (!fingerprintHash) {\n return null;\n }\n\n if ('resolveRemoteBuildCache' in provider.plugin) {\n Log.warn('The resolveRemoteBuildCache function is deprecated. Use resolveBuildCache instead.');\n return await provider.plugin.resolveRemoteBuildCache(\n { fingerprintHash, platform, runOptions, projectRoot },\n provider.options\n );\n }\n return await provider.plugin.resolveBuildCache(\n { fingerprintHash, platform, runOptions, projectRoot },\n provider.options\n );\n}\n\nexport async function uploadBuildCache({\n projectRoot,\n platform,\n provider,\n buildPath,\n runOptions,\n}: {\n projectRoot: string;\n platform: 'android' | 'ios';\n provider: BuildCacheProvider;\n buildPath: string;\n runOptions: RunOptions;\n}): Promise<void> {\n const fingerprintHash = await calculateFingerprintHashAsync({\n projectRoot,\n platform,\n provider,\n runOptions,\n });\n if (!fingerprintHash) {\n debug('No fingerprint hash found, skipping upload');\n return;\n }\n\n if ('uploadRemoteBuildCache' in provider.plugin) {\n Log.warn('The uploadRemoteBuildCache function is deprecated. Use uploadBuildCache instead.');\n await provider.plugin.uploadRemoteBuildCache(\n {\n projectRoot,\n platform,\n fingerprintHash,\n buildPath,\n runOptions,\n },\n provider.options\n );\n } else {\n await provider.plugin.uploadBuildCache(\n {\n projectRoot,\n platform,\n fingerprintHash,\n buildPath,\n runOptions,\n },\n provider.options\n );\n }\n}\n\nasync function calculateFingerprintHashAsync({\n projectRoot,\n platform,\n provider,\n runOptions,\n}: {\n projectRoot: string;\n platform: 'android' | 'ios';\n provider: BuildCacheProvider;\n runOptions: RunOptions;\n}): Promise<string | null> {\n if (provider.plugin.calculateFingerprintHash) {\n return await provider.plugin.calculateFingerprintHash(\n { projectRoot, platform, runOptions },\n provider.options\n );\n }\n\n const Fingerprint = importFingerprintForDev(projectRoot);\n if (!Fingerprint) {\n debug('@expo/fingerprint is not installed in the project, unable to calculate fingerprint');\n return null;\n }\n const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);\n\n return fingerprint.hash;\n}\n\nfunction importFingerprintForDev(projectRoot: string): null | typeof import('@expo/fingerprint') {\n try {\n return require(require.resolve('@expo/fingerprint', { paths: [projectRoot] }));\n } catch (error: any) {\n if ('code' in error && error.code === 'MODULE_NOT_FOUND') {\n return null;\n }\n throw error;\n }\n}\n\n/**\n * Resolve the provider plugin from a node module or package.\n * If the module or package does not include a provider plugin, this function throws.\n * The resolution is done in following order:\n * 1. Is the reference a relative file path or an import specifier with file path? e.g. `./file.js`, `pkg/file.js` or `@org/pkg/file.js`?\n * - Resolve the provider plugin as-is\n * 2. Does the module have a valid provider plugin in the `main` field?\n * - Resolve the `main` entry point as provider plugin\n */\nfunction resolvePluginFilePathForModule(projectRoot: string, pluginReference: string) {\n if (moduleNameIsDirectFileReference(pluginReference)) {\n // Only resolve `./file.js`, `package/file.js`, `@org/package/file.js`\n const pluginScriptFile = resolveFrom.silent(projectRoot, pluginReference);\n if (pluginScriptFile) {\n return pluginScriptFile;\n }\n } else if (moduleNameIsPackageReference(pluginReference)) {\n // Try to resole the `main` entry as config plugin\n return resolveFrom(projectRoot, pluginReference);\n }\n\n throw new Error(\n `Failed to resolve provider plugin for module \"${pluginReference}\" relative to \"${projectRoot}\". Do you have node modules installed?`\n );\n}\n\n// Resolve the module function and assert type\nexport function resolvePluginFunction(\n projectRoot: string,\n pluginReference: string\n): BuildCacheProviderPlugin {\n const pluginFile = resolvePluginFilePathForModule(projectRoot, pluginReference);\n\n try {\n let plugin = require(pluginFile);\n if (plugin?.default != null) {\n plugin = plugin.default;\n }\n\n if (\n typeof plugin !== 'object' ||\n (typeof plugin.resolveRemoteBuildCache !== 'function' &&\n typeof plugin.resolveBuildCache !== 'function') ||\n (typeof plugin.uploadRemoteBuildCache !== 'function' &&\n typeof plugin.uploadBuildCache !== 'function')\n ) {\n throw new Error(`\n The provider plugin \"${pluginReference}\" must export an object containing\n the resolveBuildCache and uploadBuildCache functions.\n `);\n }\n return plugin;\n } catch (error) {\n if (error instanceof SyntaxError) {\n // Add error linking to the docs of how create a valid provider plugin\n }\n throw error;\n }\n}\n\nasync function manuallyLoadDependency(projectRoot: string, packageName: string) {\n const possiblePaths = [\n path.join(projectRoot, 'node_modules'),\n ...(require.resolve.paths(packageName) ?? []),\n ];\n const nodeModulesFolder = possiblePaths?.find((p) => {\n const packagePath = path.join(p, packageName);\n return fs.existsSync(packagePath);\n });\n if (!nodeModulesFolder) {\n throw new Error(`Package ${packageName} not found in ${possiblePaths}`);\n }\n\n const { main } = await import(path.join(nodeModulesFolder, packageName, 'package.json'));\n return import(path.join(nodeModulesFolder, packageName, main));\n}\n"],"names":["resolveBuildCache","resolveBuildCacheProvider","resolvePluginFunction","uploadBuildCache","debug","require","provider","projectRoot","ensureDependenciesAsync","isProjectMutable","installMessage","warningMessage","requiredPackages","pkg","file","dev","plugin","manuallyLoadDependency","default","options","error","CommandError","Log","warn","message","undefined","Error","platform","runOptions","fingerprintHash","calculateFingerprintHashAsync","resolveRemoteBuildCache","buildPath","uploadRemoteBuildCache","calculateFingerprintHash","Fingerprint","importFingerprintForDev","fingerprint","createFingerprintAsync","hash","resolve","paths","code","resolvePluginFilePathForModule","pluginReference","moduleNameIsDirectFileReference","pluginScriptFile","resolveFrom","silent","moduleNameIsPackageReference","pluginFile","SyntaxError","packageName","possiblePaths","path","join","nodeModulesFolder","find","p","packagePath","fs","existsSync","main"],"mappings":";;;;;;;;;;;IA8DsBA,iBAAiB;eAAjBA;;IAlDTC,yBAAyB;eAAzBA;;IAwMGC,qBAAqB;eAArBA;;IApHMC,gBAAgB;eAAhBA;;;;gEA/FP;;;;;;;gEACE;;;;;;;gEACO;;;;;;yBAEsD;6DACzD;yCACmB;wBACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAExB,MAAMJ,4BAA4B,OACvCK,UACAC;IAEA,IAAI,CAACD,UAAU;QACb;IACF;IAEA,IAAIA,aAAa,OAAO;QACtB,IAAI;YACF,MAAME,IAAAA,gDAAuB,EAACD,aAAa;gBACzCE,kBAAkB;gBAClBC,gBAC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EA,MAAM,EAAES,IAAI,EAAE,GAAG,MAAM,gBAAOR,eAAI,CAACC,IAAI,CAACC,mBAAmBJ,aAAa,mEAAjD;IACvB,OAAO,gBAAOE,eAAI,CAACC,IAAI,CAACC,mBAAmBJ,aAAaU,yDAAjD;AACT"}
@@ -33,6 +33,9 @@ _export(exports, {
33
33
  fileExistsSync: function() {
34
34
  return fileExistsSync;
35
35
  },
36
+ isPathInside: function() {
37
+ return isPathInside;
38
+ },
36
39
  removeAsync: function() {
37
40
  return removeAsync;
38
41
  }
@@ -110,5 +113,9 @@ const removeAsync = (path)=>{
110
113
  force: true
111
114
  });
112
115
  };
116
+ function isPathInside(child, parent) {
117
+ const relative = _path().default.relative(parent, child);
118
+ return !!relative && !relative.startsWith('..') && !_path().default.isAbsolute(relative);
119
+ }
113
120
 
114
121
  //# sourceMappingURL=dir.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/dir.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nexport function fileExistsSync(file: string): boolean {\n return !!fs\n .statSync(file, {\n throwIfNoEntry: false,\n })\n ?.isFile();\n}\n\nexport function directoryExistsSync(file: string): boolean {\n return !!fs\n .statSync(file, {\n throwIfNoEntry: false,\n })\n ?.isDirectory();\n}\n\nexport async function directoryExistsAsync(file: string): Promise<boolean> {\n return (await fs.promises.stat(file).catch(() => null))?.isDirectory() ?? false;\n}\n\nexport async function fileExistsAsync(file: string): Promise<boolean> {\n return (await fs.promises.stat(file).catch(() => null))?.isFile() ?? false;\n}\n\nexport const ensureDirectoryAsync = (path: string) => fs.promises.mkdir(path, { recursive: true });\n\nexport const ensureDirectory = (path: string): void => {\n fs.mkdirSync(path, {\n recursive: true,\n });\n};\n\nexport const copySync = (src: string, dest: string): void => {\n const destParent = path.dirname(dest);\n if (!fs.existsSync(destParent)) ensureDirectory(destParent);\n fs.cpSync(src, dest, {\n recursive: true,\n force: true,\n });\n};\n\nexport const copyAsync = async (src: string, dest: string): Promise<void> => {\n const destParent = path.dirname(dest);\n if (!fs.existsSync(destParent)) {\n await fs.promises.mkdir(destParent, { recursive: true });\n }\n await fs.promises.cp(src, dest, {\n recursive: true,\n force: true,\n });\n};\n\nexport const removeAsync = (path: string): Promise<void> => {\n return fs.promises.rm(path, {\n recursive: true,\n force: true,\n });\n};\n"],"names":["copyAsync","copySync","directoryExistsAsync","directoryExistsSync","ensureDirectory","ensureDirectoryAsync","fileExistsAsync","fileExistsSync","removeAsync","file","fs","statSync","throwIfNoEntry","isFile","isDirectory","promises","stat","catch","path","mkdir","recursive","mkdirSync","src","dest","destParent","dirname","existsSync","cpSync","force","cp","rm"],"mappings":";;;;;;;;;;;IA4CaA,SAAS;eAATA;;IATAC,QAAQ;eAARA;;IAhBSC,oBAAoB;eAApBA;;IARNC,mBAAmB;eAAnBA;;IAkBHC,eAAe;eAAfA;;IAFAC,oBAAoB;eAApBA;;IAJSC,eAAe;eAAfA;;IApBNC,cAAc;eAAdA;;IAoDHC,WAAW;eAAXA;;;;gEAvDE;;;;;;;gEACE;;;;;;;;;;;AAEV,SAASD,eAAeE,IAAY;QAChCC;IAAT,OAAO,CAAC,GAACA,eAAAA,aAAE,CACRC,QAAQ,CAACF,MAAM;QACdG,gBAAgB;IAClB,uBAHOF,aAILG,MAAM;AACZ;AAEO,SAASV,oBAAoBM,IAAY;QACrCC;IAAT,OAAO,CAAC,GAACA,eAAAA,aAAE,CACRC,QAAQ,CAACF,MAAM;QACdG,gBAAgB;IAClB,uBAHOF,aAILI,WAAW;AACjB;AAEO,eAAeZ,qBAAqBO,IAAY;QAC7C;IAAR,OAAO,EAAC,QAAA,MAAMC,aAAE,CAACK,QAAQ,CAACC,IAAI,CAACP,MAAMQ,KAAK,CAAC,IAAM,0BAA1C,AAAC,MAAiDH,WAAW,OAAM;AAC5E;AAEO,eAAeR,gBAAgBG,IAAY;QACxC;IAAR,OAAO,EAAC,QAAA,MAAMC,aAAE,CAACK,QAAQ,CAACC,IAAI,CAACP,MAAMQ,KAAK,CAAC,IAAM,0BAA1C,AAAC,MAAiDJ,MAAM,OAAM;AACvE;AAEO,MAAMR,uBAAuB,CAACa,OAAiBR,aAAE,CAACK,QAAQ,CAACI,KAAK,CAACD,MAAM;QAAEE,WAAW;IAAK;AAEzF,MAAMhB,kBAAkB,CAACc;IAC9BR,aAAE,CAACW,SAAS,CAACH,MAAM;QACjBE,WAAW;IACb;AACF;AAEO,MAAMnB,WAAW,CAACqB,KAAaC;IACpC,MAAMC,aAAaN,eAAI,CAACO,OAAO,CAACF;IAChC,IAAI,CAACb,aAAE,CAACgB,UAAU,CAACF,aAAapB,gBAAgBoB;IAChDd,aAAE,CAACiB,MAAM,CAACL,KAAKC,MAAM;QACnBH,WAAW;QACXQ,OAAO;IACT;AACF;AAEO,MAAM5B,YAAY,OAAOsB,KAAaC;IAC3C,MAAMC,aAAaN,eAAI,CAACO,OAAO,CAACF;IAChC,IAAI,CAACb,aAAE,CAACgB,UAAU,CAACF,aAAa;QAC9B,MAAMd,aAAE,CAACK,QAAQ,CAACI,KAAK,CAACK,YAAY;YAAEJ,WAAW;QAAK;IACxD;IACA,MAAMV,aAAE,CAACK,QAAQ,CAACc,EAAE,CAACP,KAAKC,MAAM;QAC9BH,WAAW;QACXQ,OAAO;IACT;AACF;AAEO,MAAMpB,cAAc,CAACU;IAC1B,OAAOR,aAAE,CAACK,QAAQ,CAACe,EAAE,CAACZ,MAAM;QAC1BE,WAAW;QACXQ,OAAO;IACT;AACF"}
1
+ {"version":3,"sources":["../../../src/utils/dir.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nexport function fileExistsSync(file: string): boolean {\n return !!fs\n .statSync(file, {\n throwIfNoEntry: false,\n })\n ?.isFile();\n}\n\nexport function directoryExistsSync(file: string): boolean {\n return !!fs\n .statSync(file, {\n throwIfNoEntry: false,\n })\n ?.isDirectory();\n}\n\nexport async function directoryExistsAsync(file: string): Promise<boolean> {\n return (await fs.promises.stat(file).catch(() => null))?.isDirectory() ?? false;\n}\n\nexport async function fileExistsAsync(file: string): Promise<boolean> {\n return (await fs.promises.stat(file).catch(() => null))?.isFile() ?? false;\n}\n\nexport const ensureDirectoryAsync = (path: string) => fs.promises.mkdir(path, { recursive: true });\n\nexport const ensureDirectory = (path: string): void => {\n fs.mkdirSync(path, {\n recursive: true,\n });\n};\n\nexport const copySync = (src: string, dest: string): void => {\n const destParent = path.dirname(dest);\n if (!fs.existsSync(destParent)) ensureDirectory(destParent);\n fs.cpSync(src, dest, {\n recursive: true,\n force: true,\n });\n};\n\nexport const copyAsync = async (src: string, dest: string): Promise<void> => {\n const destParent = path.dirname(dest);\n if (!fs.existsSync(destParent)) {\n await fs.promises.mkdir(destParent, { recursive: true });\n }\n await fs.promises.cp(src, dest, {\n recursive: true,\n force: true,\n });\n};\n\nexport const removeAsync = (path: string): Promise<void> => {\n return fs.promises.rm(path, {\n recursive: true,\n force: true,\n });\n};\n\nexport function isPathInside(child: string, parent: string): boolean {\n const relative = path.relative(parent, child);\n return !!relative && !relative.startsWith('..') && !path.isAbsolute(relative);\n}\n"],"names":["copyAsync","copySync","directoryExistsAsync","directoryExistsSync","ensureDirectory","ensureDirectoryAsync","fileExistsAsync","fileExistsSync","isPathInside","removeAsync","file","fs","statSync","throwIfNoEntry","isFile","isDirectory","promises","stat","catch","path","mkdir","recursive","mkdirSync","src","dest","destParent","dirname","existsSync","cpSync","force","cp","rm","child","parent","relative","startsWith","isAbsolute"],"mappings":";;;;;;;;;;;IA4CaA,SAAS;eAATA;;IATAC,QAAQ;eAARA;;IAhBSC,oBAAoB;eAApBA;;IARNC,mBAAmB;eAAnBA;;IAkBHC,eAAe;eAAfA;;IAFAC,oBAAoB;eAApBA;;IAJSC,eAAe;eAAfA;;IApBNC,cAAc;eAAdA;;IA2DAC,YAAY;eAAZA;;IAPHC,WAAW;eAAXA;;;;gEAvDE;;;;;;;gEACE;;;;;;;;;;;AAEV,SAASF,eAAeG,IAAY;QAChCC;IAAT,OAAO,CAAC,GAACA,eAAA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AACc,EAAE,CAACP,KAAKC,MAAM;QAC9BH,WAAW;QACXQ,OAAO;IACT;AACF;AAEO,MAAMpB,cAAc,CAACU;IAC1B,OAAOR,aAAE,CAACK,QAAQ,CAACe,EAAE,CAACZ,MAAM;QAC1BE,WAAW;QACXQ,OAAO;IACT;AACF;AAEO,SAASrB,aAAawB,KAAa,EAAEC,MAAc;IACxD,MAAMC,WAAWf,eAAI,CAACe,QAAQ,CAACD,QAAQD;IACvC,OAAO,CAAC,CAACE,YAAY,CAACA,SAASC,UAAU,CAAC,SAAS,CAAChB,eAAI,CAACiB,UAAU,CAACF;AACtE"}
@@ -149,10 +149,15 @@ class Env {
149
149
  /** Disable lazy bundling in Metro bundler. */ get EXPO_NO_METRO_LAZY() {
150
150
  return (0, _getenv().boolish)('EXPO_NO_METRO_LAZY', false);
151
151
  }
152
- /** Enable the unstable inverse dependency stack trace for Metro bundling errors. */ get EXPO_METRO_UNSTABLE_ERRORS() {
153
- return (0, _getenv().boolish)('EXPO_METRO_UNSTABLE_ERRORS', false);
154
- }
155
- /** Enable the experimental sticky resolver for Metro. */ get EXPO_USE_STICKY_RESOLVER() {
152
+ /**
153
+ * Enable the unstable inverse dependency stack trace for Metro bundling errors.
154
+ * @deprecated This will be removed in the future.
155
+ */ get EXPO_METRO_UNSTABLE_ERRORS() {
156
+ return (0, _getenv().boolish)('EXPO_METRO_UNSTABLE_ERRORS', true);
157
+ }
158
+ /** Enable the experimental sticky resolver for Metro (Uses Expo Autolinking results and applies them to Metro's resolution)
159
+ * @deprecated Replaced by `exp.experiments.autolinkingModuleResolution`
160
+ */ get EXPO_USE_STICKY_RESOLVER() {
156
161
  return (0, _getenv().boolish)('EXPO_USE_STICKY_RESOLVER', false);
157
162
  }
158
163
  /** Enable the unstable fast resolver for Metro. */ get EXPO_USE_FAST_RESOLVER() {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/env.ts"],"sourcesContent":["import { boolish, int, string } from 'getenv';\nimport process from 'node:process';\n\n// @expo/webpack-config -> expo-pwa -> @expo/image-utils: EXPO_IMAGE_UTILS_NO_SHARP\n\n// TODO: EXPO_CLI_USERNAME, EXPO_CLI_PASSWORD\n\nclass Env {\n /** Enable profiling metrics */\n get EXPO_PROFILE() {\n return boolish('EXPO_PROFILE', false);\n }\n\n /** Enable debug logging */\n get EXPO_DEBUG() {\n return boolish('EXPO_DEBUG', false);\n }\n\n /** Disable all network requests */\n get EXPO_OFFLINE() {\n return boolish('EXPO_OFFLINE', false);\n }\n\n /** Enable the beta version of Expo (TODO: Should this just be in the beta version of expo releases?) */\n get EXPO_BETA() {\n return boolish('EXPO_BETA', false);\n }\n\n /** Enable staging API environment */\n get EXPO_STAGING() {\n return boolish('EXPO_STAGING', false);\n }\n\n /** Enable local API environment */\n get EXPO_LOCAL() {\n return boolish('EXPO_LOCAL', false);\n }\n\n /** Is running in non-interactive CI mode */\n get CI() {\n return boolish('CI', false);\n }\n\n /** Disable telemetry (analytics) */\n get EXPO_NO_TELEMETRY() {\n return boolish('EXPO_NO_TELEMETRY', false);\n }\n\n /** Disable detaching telemetry to separate process */\n get EXPO_NO_TELEMETRY_DETACH() {\n return boolish('EXPO_NO_TELEMETRY_DETACH', false);\n }\n\n /** local directory to the universe repo for testing locally */\n get EXPO_UNIVERSE_DIR() {\n return string('EXPO_UNIVERSE_DIR', '');\n }\n\n /** @deprecated Default Webpack host string */\n get WEB_HOST() {\n return string('WEB_HOST', '0.0.0.0');\n }\n\n /** Skip warning users about a dirty git status */\n get EXPO_NO_GIT_STATUS() {\n return boolish('EXPO_NO_GIT_STATUS', false);\n }\n /** Disable auto web setup */\n get EXPO_NO_WEB_SETUP() {\n return boolish('EXPO_NO_WEB_SETUP', false);\n }\n /** Disable auto TypeScript setup */\n get EXPO_NO_TYPESCRIPT_SETUP() {\n return boolish('EXPO_NO_TYPESCRIPT_SETUP', false);\n }\n /** Disable all API caches. Does not disable bundler caches. */\n get EXPO_NO_CACHE() {\n return boolish('EXPO_NO_CACHE', false);\n }\n /** Disable the app select redirect page. */\n get EXPO_NO_REDIRECT_PAGE() {\n return boolish('EXPO_NO_REDIRECT_PAGE', false);\n }\n /** The React Metro port that's baked into react-native scripts and tools. */\n get RCT_METRO_PORT() {\n return int('RCT_METRO_PORT', 0);\n }\n /** Skip validating the manifest during `export`. */\n get EXPO_SKIP_MANIFEST_VALIDATION_TOKEN(): boolean {\n return !!string('EXPO_SKIP_MANIFEST_VALIDATION_TOKEN', '');\n }\n\n /** Public folder path relative to the project root. Default to `public` */\n get EXPO_PUBLIC_FOLDER(): string {\n return string('EXPO_PUBLIC_FOLDER', 'public');\n }\n\n /** Higher priority `$EDIOTR` variable for indicating which editor to use when pressing `o` in the Terminal UI. */\n get EXPO_EDITOR(): string {\n return string('EXPO_EDITOR', '');\n }\n\n /**\n * Overwrite the dev server URL, disregarding the `--port`, `--host`, `--tunnel`, `--lan`, `--localhost` arguments.\n * This is useful for browser editors that require custom proxy URLs.\n */\n get EXPO_PACKAGER_PROXY_URL(): string {\n return string('EXPO_PACKAGER_PROXY_URL', '');\n }\n\n /**\n * **Experimental** - Disable using `exp.direct` as the hostname for\n * `--tunnel` connections. This enables **https://** forwarding which\n * can be used to test universal links on iOS.\n *\n * This may cause issues with `expo-linking` and Expo Go.\n *\n * Select the exact subdomain by passing a string value that is not one of: `true`, `false`, `1`, `0`.\n */\n get EXPO_TUNNEL_SUBDOMAIN(): string | boolean {\n const subdomain = string('EXPO_TUNNEL_SUBDOMAIN', '');\n if (['0', 'false', ''].includes(subdomain)) {\n return false;\n } else if (['1', 'true'].includes(subdomain)) {\n return true;\n }\n return subdomain;\n }\n\n /**\n * Force Expo CLI to use the [`resolver.resolverMainFields`](https://facebook.github.io/metro/docs/configuration/#resolvermainfields) from the project `metro.config.js` for all platforms.\n *\n * By default, Expo CLI will use `['browser', 'module', 'main']` (default for Webpack) for web and the user-defined main fields for other platforms.\n */\n get EXPO_METRO_NO_MAIN_FIELD_OVERRIDE(): boolean {\n return boolish('EXPO_METRO_NO_MAIN_FIELD_OVERRIDE', false);\n }\n\n /**\n * HTTP/HTTPS proxy to connect to for network requests. Configures [https-proxy-agent](https://www.npmjs.com/package/https-proxy-agent).\n */\n get HTTP_PROXY(): string {\n return process.env.HTTP_PROXY || process.env.http_proxy || '';\n }\n\n /**\n * Use the network inspector by overriding the metro inspector proxy with a custom version.\n * @deprecated This has been replaced by `@react-native/dev-middleware` and is now unused.\n */\n get EXPO_NO_INSPECTOR_PROXY(): boolean {\n return boolish('EXPO_NO_INSPECTOR_PROXY', false);\n }\n\n /** Disable lazy bundling in Metro bundler. */\n get EXPO_NO_METRO_LAZY() {\n return boolish('EXPO_NO_METRO_LAZY', false);\n }\n\n /** Enable the unstable inverse dependency stack trace for Metro bundling errors. */\n get EXPO_METRO_UNSTABLE_ERRORS() {\n return boolish('EXPO_METRO_UNSTABLE_ERRORS', false);\n }\n\n /** Enable the experimental sticky resolver for Metro. */\n get EXPO_USE_STICKY_RESOLVER() {\n return boolish('EXPO_USE_STICKY_RESOLVER', false);\n }\n\n /** Enable the unstable fast resolver for Metro. */\n get EXPO_USE_FAST_RESOLVER() {\n return boolish('EXPO_USE_FAST_RESOLVER', false);\n }\n\n /** Disable Environment Variable injection in client bundles. */\n get EXPO_NO_CLIENT_ENV_VARS(): boolean {\n return boolish('EXPO_NO_CLIENT_ENV_VARS', false);\n }\n\n /** Set the default `user` that should be passed to `--user` with ADB commands. Used for installing APKs on Android devices with multiple profiles. Defaults to `0`. */\n get EXPO_ADB_USER(): string {\n return string('EXPO_ADB_USER', '0');\n }\n\n /** Used internally to enable E2E utilities. This behavior is not stable to external users. */\n get __EXPO_E2E_TEST(): boolean {\n return boolish('__EXPO_E2E_TEST', false);\n }\n\n /** Unstable: Force single-bundle exports in production. */\n get EXPO_NO_BUNDLE_SPLITTING(): boolean {\n return boolish('EXPO_NO_BUNDLE_SPLITTING', false);\n }\n\n /**\n * Enable Atlas to gather bundle information during development or export.\n * Note, because this used to be an experimental feature, both `EXPO_ATLAS` and `EXPO_UNSTABLE_ATLAS` are supported.\n */\n get EXPO_ATLAS() {\n return boolish('EXPO_ATLAS', boolish('EXPO_UNSTABLE_ATLAS', false));\n }\n\n /** Unstable: Enable tree shaking for Metro. */\n get EXPO_UNSTABLE_TREE_SHAKING() {\n return boolish('EXPO_UNSTABLE_TREE_SHAKING', false);\n }\n\n /** Unstable: Enable eager bundling where transformation runs uncached after the entire bundle has been created. This is required for production tree shaking and less optimized for development bundling. */\n get EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH() {\n return boolish('EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH', false);\n }\n\n /** Enable the use of Expo's custom metro require implementation. The custom require supports better debugging, tree shaking, and React Server Components. */\n get EXPO_USE_METRO_REQUIRE() {\n return boolish('EXPO_USE_METRO_REQUIRE', false);\n }\n\n /** Internal key used to pass eager bundle data from the CLI to the native run scripts during `npx expo run` commands. */\n get __EXPO_EAGER_BUNDLE_OPTIONS() {\n return string('__EXPO_EAGER_BUNDLE_OPTIONS', '');\n }\n\n /** Disable server deployment during production builds (during `expo export:embed`). This is useful for testing API routes and server components against a local server. */\n get EXPO_NO_DEPLOY(): boolean {\n return boolish('EXPO_NO_DEPLOY', false);\n }\n\n /** Enable hydration during development when rendering Expo Web */\n get EXPO_WEB_DEV_HYDRATE(): boolean {\n return boolish('EXPO_WEB_DEV_HYDRATE', false);\n }\n\n /** Enable experimental React Server Functions support. */\n get EXPO_UNSTABLE_SERVER_FUNCTIONS(): boolean {\n return boolish('EXPO_UNSTABLE_SERVER_FUNCTIONS', false);\n }\n\n /** Enable unstable/experimental mode where React Native Web isn't required to run Expo apps on web. */\n get EXPO_NO_REACT_NATIVE_WEB(): boolean {\n return boolish('EXPO_NO_REACT_NATIVE_WEB', false);\n }\n\n /** Enable unstable/experimental support for deploying the native server in `npx expo run` commands. */\n get EXPO_UNSTABLE_DEPLOY_SERVER(): boolean {\n return boolish('EXPO_UNSTABLE_DEPLOY_SERVER', false);\n }\n\n /** Is running in EAS Build. This is set by EAS: https://docs.expo.dev/eas/environment-variables/ */\n get EAS_BUILD(): boolean {\n return boolish('EAS_BUILD', false);\n }\n\n /** Disable the React Native Directory compatibility check for new architecture when installing packages */\n get EXPO_NO_NEW_ARCH_COMPAT_CHECK(): boolean {\n return boolish('EXPO_NO_NEW_ARCH_COMPAT_CHECK', false);\n }\n\n /** Disable the dependency validation when installing other dependencies and starting the project */\n get EXPO_NO_DEPENDENCY_VALIDATION(): boolean {\n // Default to disabling when running in a web container (stackblitz, bolt, etc).\n const isWebContainer = process.versions.webcontainer != null;\n return boolish('EXPO_NO_DEPENDENCY_VALIDATION', isWebContainer);\n }\n\n /** Force Expo CLI to run in webcontainer mode, this has impact on which URL Expo is using by default */\n get EXPO_FORCE_WEBCONTAINER_ENV(): boolean {\n return boolish('EXPO_FORCE_WEBCONTAINER_ENV', false);\n }\n\n /** Disable by falsy value live binding in experimental import export support. Enabled by default. */\n get EXPO_UNSTABLE_LIVE_BINDINGS(): boolean {\n return boolish('EXPO_UNSTABLE_LIVE_BINDINGS', true);\n }\n}\n\nexport const env = new Env();\n\nexport function envIsWebcontainer() {\n // See: https://github.com/unjs/std-env/blob/4b1e03c4efce58249858efc2cc5f5eac727d0adb/src/providers.ts#L134-L143\n return (\n env.EXPO_FORCE_WEBCONTAINER_ENV ||\n (process.env.SHELL === '/bin/jsh' && !!process.versions.webcontainer)\n );\n}\n"],"names":["env","envIsWebcontainer","Env","EXPO_PROFILE","boolish","EXPO_DEBUG","EXPO_OFFLINE","EXPO_BETA","EXPO_STAGING","EXPO_LOCAL","CI","EXPO_NO_TELEMETRY","EXPO_NO_TELEMETRY_DETACH","EXPO_UNIVERSE_DIR","string","WEB_HOST","EXPO_NO_GIT_STATUS","EXPO_NO_WEB_SETUP","EXPO_NO_TYPESCRIPT_SETUP","EXPO_NO_CACHE","EXPO_NO_REDIRECT_PAGE","RCT_METRO_PORT","int","EXPO_SKIP_MANIFEST_VALIDATION_TOKEN","EXPO_PUBLIC_FOLDER","EXPO_EDITOR","EXPO_PACKAGER_PROXY_URL","EXPO_TUNNEL_SUBDOMAIN","subdomain","includes","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","HTTP_PROXY","process","http_proxy","EXPO_NO_INSPECTOR_PROXY","EXPO_NO_METRO_LAZY","EXPO_METRO_UNSTABLE_ERRORS","EXPO_USE_STICKY_RESOLVER","EXPO_USE_FAST_RESOLVER","EXPO_NO_CLIENT_ENV_VARS","EXPO_ADB_USER","__EXPO_E2E_TEST","EXPO_NO_BUNDLE_SPLITTING","EXPO_ATLAS","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","EXPO_USE_METRO_REQUIRE","__EXPO_EAGER_BUNDLE_OPTIONS","EXPO_NO_DEPLOY","EXPO_WEB_DEV_HYDRATE","EXPO_UNSTABLE_SERVER_FUNCTIONS","EXPO_NO_REACT_NATIVE_WEB","EXPO_UNSTABLE_DEPLOY_SERVER","EAS_BUILD","EXPO_NO_NEW_ARCH_COMPAT_CHECK","EXPO_NO_DEPENDENCY_VALIDATION","isWebContainer","versions","webcontainer","EXPO_FORCE_WEBCONTAINER_ENV","EXPO_UNSTABLE_LIVE_BINDINGS","SHELL"],"mappings":";;;;;;;;;;;IAkRaA,GAAG;eAAHA;;IAEGC,iBAAiB;eAAjBA;;;;yBApRqB;;;;;;;gEACjB;;;;;;;;;;;AAEpB,mFAAmF;AAEnF,6CAA6C;AAE7C,MAAMC;IACJ,6BAA6B,GAC7B,IAAIC,eAAe;QACjB,OAAOC,IAAAA,iBAAO,EAAC,gBAAgB;IACjC;IAEA,yBAAyB,GACzB,IAAIC,aAAa;QACf,OAAOD,IAAAA,iBAAO,EAAC,cAAc;IAC/B;IAEA,iCAAiC,GACjC,IAAIE,eAAe;QACjB,OAAOF,IAAAA,iBAAO,EAAC,gBAAgB;IACjC;IAEA,sGAAsG,GACtG,IAAIG,YAAY;QACd,OAAOH,IAAAA,iBAAO,EAAC,aAAa;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aAAa;IAC9B;IAEA,yGAAyG,GACzG,IAAIkD,gCAAyC;QAC3C,OAAOlD,IAAAA,iBAAO,EAAC,iCAAiC;IAClD;IAEA,kGAAkG,GAClG,IAAImD,gCAAyC;QAC3C,gFAAgF;QAChF,MAAMC,iBAAiBxB,sBAAO,CAACyB,QAAQ,CAACC,YAAY,IAAI;QACxD,OAAOtD,IAAAA,iBAAO,EAAC,iCAAiCoD;IAClD;IAEA,sGAAsG,GACtG,IAAIG,8BAAuC;QACzC,OAAOvD,IAAAA,iBAAO,EAAC,+BAA+B;IAChD;IAEA,mGAAmG,GACnG,IAAIwD,8BAAuC;QACzC,OAAOxD,IAAAA,iBAAO,EAAC,+BAA+B;IAChD;AACF;AAEO,MAAMJ,MAAM,IAAIE;AAEhB,SAASD;IACd,gHAAgH;IAChH,OACED,IAAI2D,2BAA2B,IAC9B3B,sBAAO,CAAChC,GAAG,CAAC6D,KAAK,KAAK,cAAc,CAAC,CAAC7B,sBAAO,CAACyB,QAAQ,CAACC,YAAY;AAExE"}
1
+ {"version":3,"sources":["../../../src/utils/env.ts"],"sourcesContent":["import { boolish, int, string } from 'getenv';\nimport process from 'node:process';\n\n// @expo/webpack-config -> expo-pwa -> @expo/image-utils: EXPO_IMAGE_UTILS_NO_SHARP\n\n// TODO: EXPO_CLI_USERNAME, EXPO_CLI_PASSWORD\n\nclass Env {\n /** Enable profiling metrics */\n get EXPO_PROFILE() {\n return boolish('EXPO_PROFILE', false);\n }\n\n /** Enable debug logging */\n get EXPO_DEBUG() {\n return boolish('EXPO_DEBUG', false);\n }\n\n /** Disable all network requests */\n get EXPO_OFFLINE() {\n return boolish('EXPO_OFFLINE', false);\n }\n\n /** Enable the beta version of Expo (TODO: Should this just be in the beta version of expo releases?) */\n get EXPO_BETA() {\n return boolish('EXPO_BETA', false);\n }\n\n /** Enable staging API environment */\n get EXPO_STAGING() {\n return boolish('EXPO_STAGING', false);\n }\n\n /** Enable local API environment */\n get EXPO_LOCAL() {\n return boolish('EXPO_LOCAL', false);\n }\n\n /** Is running in non-interactive CI mode */\n get CI() {\n return boolish('CI', false);\n }\n\n /** Disable telemetry (analytics) */\n get EXPO_NO_TELEMETRY() {\n return boolish('EXPO_NO_TELEMETRY', false);\n }\n\n /** Disable detaching telemetry to separate process */\n get EXPO_NO_TELEMETRY_DETACH() {\n return boolish('EXPO_NO_TELEMETRY_DETACH', false);\n }\n\n /** local directory to the universe repo for testing locally */\n get EXPO_UNIVERSE_DIR() {\n return string('EXPO_UNIVERSE_DIR', '');\n }\n\n /** @deprecated Default Webpack host string */\n get WEB_HOST() {\n return string('WEB_HOST', '0.0.0.0');\n }\n\n /** Skip warning users about a dirty git status */\n get EXPO_NO_GIT_STATUS() {\n return boolish('EXPO_NO_GIT_STATUS', false);\n }\n /** Disable auto web setup */\n get EXPO_NO_WEB_SETUP() {\n return boolish('EXPO_NO_WEB_SETUP', false);\n }\n /** Disable auto TypeScript setup */\n get EXPO_NO_TYPESCRIPT_SETUP() {\n return boolish('EXPO_NO_TYPESCRIPT_SETUP', false);\n }\n /** Disable all API caches. Does not disable bundler caches. */\n get EXPO_NO_CACHE() {\n return boolish('EXPO_NO_CACHE', false);\n }\n /** Disable the app select redirect page. */\n get EXPO_NO_REDIRECT_PAGE() {\n return boolish('EXPO_NO_REDIRECT_PAGE', false);\n }\n /** The React Metro port that's baked into react-native scripts and tools. */\n get RCT_METRO_PORT() {\n return int('RCT_METRO_PORT', 0);\n }\n /** Skip validating the manifest during `export`. */\n get EXPO_SKIP_MANIFEST_VALIDATION_TOKEN(): boolean {\n return !!string('EXPO_SKIP_MANIFEST_VALIDATION_TOKEN', '');\n }\n\n /** Public folder path relative to the project root. Default to `public` */\n get EXPO_PUBLIC_FOLDER(): string {\n return string('EXPO_PUBLIC_FOLDER', 'public');\n }\n\n /** Higher priority `$EDIOTR` variable for indicating which editor to use when pressing `o` in the Terminal UI. */\n get EXPO_EDITOR(): string {\n return string('EXPO_EDITOR', '');\n }\n\n /**\n * Overwrite the dev server URL, disregarding the `--port`, `--host`, `--tunnel`, `--lan`, `--localhost` arguments.\n * This is useful for browser editors that require custom proxy URLs.\n */\n get EXPO_PACKAGER_PROXY_URL(): string {\n return string('EXPO_PACKAGER_PROXY_URL', '');\n }\n\n /**\n * **Experimental** - Disable using `exp.direct` as the hostname for\n * `--tunnel` connections. This enables **https://** forwarding which\n * can be used to test universal links on iOS.\n *\n * This may cause issues with `expo-linking` and Expo Go.\n *\n * Select the exact subdomain by passing a string value that is not one of: `true`, `false`, `1`, `0`.\n */\n get EXPO_TUNNEL_SUBDOMAIN(): string | boolean {\n const subdomain = string('EXPO_TUNNEL_SUBDOMAIN', '');\n if (['0', 'false', ''].includes(subdomain)) {\n return false;\n } else if (['1', 'true'].includes(subdomain)) {\n return true;\n }\n return subdomain;\n }\n\n /**\n * Force Expo CLI to use the [`resolver.resolverMainFields`](https://facebook.github.io/metro/docs/configuration/#resolvermainfields) from the project `metro.config.js` for all platforms.\n *\n * By default, Expo CLI will use `['browser', 'module', 'main']` (default for Webpack) for web and the user-defined main fields for other platforms.\n */\n get EXPO_METRO_NO_MAIN_FIELD_OVERRIDE(): boolean {\n return boolish('EXPO_METRO_NO_MAIN_FIELD_OVERRIDE', false);\n }\n\n /**\n * HTTP/HTTPS proxy to connect to for network requests. Configures [https-proxy-agent](https://www.npmjs.com/package/https-proxy-agent).\n */\n get HTTP_PROXY(): string {\n return process.env.HTTP_PROXY || process.env.http_proxy || '';\n }\n\n /**\n * Use the network inspector by overriding the metro inspector proxy with a custom version.\n * @deprecated This has been replaced by `@react-native/dev-middleware` and is now unused.\n */\n get EXPO_NO_INSPECTOR_PROXY(): boolean {\n return boolish('EXPO_NO_INSPECTOR_PROXY', false);\n }\n\n /** Disable lazy bundling in Metro bundler. */\n get EXPO_NO_METRO_LAZY() {\n return boolish('EXPO_NO_METRO_LAZY', false);\n }\n\n /**\n * Enable the unstable inverse dependency stack trace for Metro bundling errors.\n * @deprecated This will be removed in the future.\n */\n get EXPO_METRO_UNSTABLE_ERRORS() {\n return boolish('EXPO_METRO_UNSTABLE_ERRORS', true);\n }\n\n /** Enable the experimental sticky resolver for Metro (Uses Expo Autolinking results and applies them to Metro's resolution)\n * @deprecated Replaced by `exp.experiments.autolinkingModuleResolution`\n */\n get EXPO_USE_STICKY_RESOLVER() {\n return boolish('EXPO_USE_STICKY_RESOLVER', false);\n }\n\n /** Enable the unstable fast resolver for Metro. */\n get EXPO_USE_FAST_RESOLVER() {\n return boolish('EXPO_USE_FAST_RESOLVER', false);\n }\n\n /** Disable Environment Variable injection in client bundles. */\n get EXPO_NO_CLIENT_ENV_VARS(): boolean {\n return boolish('EXPO_NO_CLIENT_ENV_VARS', false);\n }\n\n /** Set the default `user` that should be passed to `--user` with ADB commands. Used for installing APKs on Android devices with multiple profiles. Defaults to `0`. */\n get EXPO_ADB_USER(): string {\n return string('EXPO_ADB_USER', '0');\n }\n\n /** Used internally to enable E2E utilities. This behavior is not stable to external users. */\n get __EXPO_E2E_TEST(): boolean {\n return boolish('__EXPO_E2E_TEST', false);\n }\n\n /** Unstable: Force single-bundle exports in production. */\n get EXPO_NO_BUNDLE_SPLITTING(): boolean {\n return boolish('EXPO_NO_BUNDLE_SPLITTING', false);\n }\n\n /**\n * Enable Atlas to gather bundle information during development or export.\n * Note, because this used to be an experimental feature, both `EXPO_ATLAS` and `EXPO_UNSTABLE_ATLAS` are supported.\n */\n get EXPO_ATLAS() {\n return boolish('EXPO_ATLAS', boolish('EXPO_UNSTABLE_ATLAS', false));\n }\n\n /** Unstable: Enable tree shaking for Metro. */\n get EXPO_UNSTABLE_TREE_SHAKING() {\n return boolish('EXPO_UNSTABLE_TREE_SHAKING', false);\n }\n\n /** Unstable: Enable eager bundling where transformation runs uncached after the entire bundle has been created. This is required for production tree shaking and less optimized for development bundling. */\n get EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH() {\n return boolish('EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH', false);\n }\n\n /** Enable the use of Expo's custom metro require implementation. The custom require supports better debugging, tree shaking, and React Server Components. */\n get EXPO_USE_METRO_REQUIRE() {\n return boolish('EXPO_USE_METRO_REQUIRE', false);\n }\n\n /** Internal key used to pass eager bundle data from the CLI to the native run scripts during `npx expo run` commands. */\n get __EXPO_EAGER_BUNDLE_OPTIONS() {\n return string('__EXPO_EAGER_BUNDLE_OPTIONS', '');\n }\n\n /** Disable server deployment during production builds (during `expo export:embed`). This is useful for testing API routes and server components against a local server. */\n get EXPO_NO_DEPLOY(): boolean {\n return boolish('EXPO_NO_DEPLOY', false);\n }\n\n /** Enable hydration during development when rendering Expo Web */\n get EXPO_WEB_DEV_HYDRATE(): boolean {\n return boolish('EXPO_WEB_DEV_HYDRATE', false);\n }\n\n /** Enable experimental React Server Functions support. */\n get EXPO_UNSTABLE_SERVER_FUNCTIONS(): boolean {\n return boolish('EXPO_UNSTABLE_SERVER_FUNCTIONS', false);\n }\n\n /** Enable unstable/experimental mode where React Native Web isn't required to run Expo apps on web. */\n get EXPO_NO_REACT_NATIVE_WEB(): boolean {\n return boolish('EXPO_NO_REACT_NATIVE_WEB', false);\n }\n\n /** Enable unstable/experimental support for deploying the native server in `npx expo run` commands. */\n get EXPO_UNSTABLE_DEPLOY_SERVER(): boolean {\n return boolish('EXPO_UNSTABLE_DEPLOY_SERVER', false);\n }\n\n /** Is running in EAS Build. This is set by EAS: https://docs.expo.dev/eas/environment-variables/ */\n get EAS_BUILD(): boolean {\n return boolish('EAS_BUILD', false);\n }\n\n /** Disable the React Native Directory compatibility check for new architecture when installing packages */\n get EXPO_NO_NEW_ARCH_COMPAT_CHECK(): boolean {\n return boolish('EXPO_NO_NEW_ARCH_COMPAT_CHECK', false);\n }\n\n /** Disable the dependency validation when installing other dependencies and starting the project */\n get EXPO_NO_DEPENDENCY_VALIDATION(): boolean {\n // Default to disabling when running in a web container (stackblitz, bolt, etc).\n const isWebContainer = process.versions.webcontainer != null;\n return boolish('EXPO_NO_DEPENDENCY_VALIDATION', isWebContainer);\n }\n\n /** Force Expo CLI to run in webcontainer mode, this has impact on which URL Expo is using by default */\n get EXPO_FORCE_WEBCONTAINER_ENV(): boolean {\n return boolish('EXPO_FORCE_WEBCONTAINER_ENV', false);\n }\n\n /** Disable by falsy value live binding in experimental import export support. Enabled by default. */\n get EXPO_UNSTABLE_LIVE_BINDINGS(): boolean {\n return boolish('EXPO_UNSTABLE_LIVE_BINDINGS', true);\n }\n}\n\nexport const env = new Env();\n\nexport function envIsWebcontainer() {\n // See: https://github.com/unjs/std-env/blob/4b1e03c4efce58249858efc2cc5f5eac727d0adb/src/providers.ts#L134-L143\n return (\n env.EXPO_FORCE_WEBCONTAINER_ENV ||\n (process.env.SHELL === '/bin/jsh' && !!process.versions.webcontainer)\n );\n}\n"],"names":["env","envIsWebcontainer","Env","EXPO_PROFILE","boolish","EXPO_DEBUG","EXPO_OFFLINE","EXPO_BETA","EXPO_STAGING","EXPO_LOCAL","CI","EXPO_NO_TELEMETRY","EXPO_NO_TELEMETRY_DETACH","EXPO_UNIVERSE_DIR","string","WEB_HOST","EXPO_NO_GIT_STATUS","EXPO_NO_WEB_SETUP","EXPO_NO_TYPESCRIPT_SETUP","EXPO_NO_CACHE","EXPO_NO_REDIRECT_PAGE","RCT_METRO_PORT","int","EXPO_SKIP_MANIFEST_VALIDATION_TOKEN","EXPO_PUBLIC_FOLDER","EXPO_EDITOR","EXPO_PACKAGER_PROXY_URL","EXPO_TUNNEL_SUBDOMAIN","subdomain","includes","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","HTTP_PROXY","process","http_proxy","EXPO_NO_INSPECTOR_PROXY","EXPO_NO_METRO_LAZY","EXPO_METRO_UNSTABLE_ERRORS","EXPO_USE_STICKY_RESOLVER","EXPO_USE_FAST_RESOLVER","EXPO_NO_CLIENT_ENV_VARS","EXPO_ADB_USER","__EXPO_E2E_TEST","EXPO_NO_BUNDLE_SPLITTING","EXPO_ATLAS","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","EXPO_USE_METRO_REQUIRE","__EXPO_EAGER_BUNDLE_OPTIONS","EXPO_NO_DEPLOY","EXPO_WEB_DEV_HYDRATE","EXPO_UNSTABLE_SERVER_FUNCTIONS","EXPO_NO_REACT_NATIVE_WEB","EXPO_UNSTABLE_DEPLOY_SERVER","EAS_BUILD","EXPO_NO_NEW_ARCH_COMPAT_CHECK","EXPO_NO_DEPENDENCY_VALIDATION","isWebContainer","versions","webcontainer","EXPO_FORCE_WEBCONTAINER_ENV","EXPO_UNSTABLE_LIVE_BINDINGS","SHELL"],"mappings":";;;;;;;;;;;IAuRaA,GAAG;eAAHA;;IAEGC,iBAAiB;eAAjBA;;;;yBAzRqB;;;;;;;gEACjB;;;;;;;;;;;AAEpB,mFAAmF;AAEnF,6CAA6C;AAE7C,MAAMC;IACJ,6BAA6B,GAC7B,IAAIC,eAAe;QACjB,OAAOC,IAAAA,iBAAO,EAAC,gBAAgB;IACjC;IAEA,yBAAyB,GACzB,IAAIC,aAAa;QACf,OAAOD,IAAAA,iBAAO,EAAC,cAAc;IAC/B;IAEA,iCAAiC,GACjC,IAAIE,eAAe;QACjB,OAAOF,IAAAA,iBAAO,EAAC,gBAAgB;IACjC;IAEA,sGAAsG,GACtG,IAAIG,YAAY;QACd,OAAOH,IAAAA,iBAAO,EAAC,aAAa;IAC9B;IAEA,mCAAmC,GACnC,IAAII,eAAe;QACjB,OAAOJ,IAAAA,iBAAO,EAAC,gBAAgB;IACjC;IAEA,iCAAiC,GACjC,IAAIK,aAAa;QACf,OAAOL,IAAAA,iBAAO,EAAC,cAAc;IAC/B;IAEA,0CAA0C,GAC1C,IAAIM,KAAK;QACP,OAAON,IAAAA,iBAAO,EAAC,MAAM;IACvB;IAEA,kCAAkC,GAClC,IAAIO,oBAAoB;QACtB,OAAOP,IAAAA,iBAAO,EAAC,qBAAqB;IACtC;IAEA,oDAAoD,GACpD,IAAIQ,2BAA2B;QAC7B,OAAOR,IAAAA,iBAAO,EAAC,4BA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A,iBAAO,EAAC,+BAA+B;IAChD;AACF;AAEO,MAAMJ,MAAM,IAAIE;AAEhB,SAASD;IACd,gHAAgH;IAChH,OACED,IAAI2D,2BAA2B,IAC9B3B,sBAAO,CAAChC,GAAG,CAAC6D,KAAK,KAAK,cAAc,CAAC,CAAC7B,sBAAO,CAACyB,QAAQ,CAACC,YAAY;AAExE"}
@@ -86,7 +86,7 @@ function logCmdError(error) {
86
86
  }
87
87
  if (error instanceof AbortCommandError || error instanceof SilentError) {
88
88
  // Do nothing, this is used for prompts or other cases that were custom logged.
89
- process.exit(0);
89
+ process.exit(1);
90
90
  } else if (error instanceof CommandError || error instanceof _assert().AssertionError || error.name === 'ApiV2Error' || error.name === 'ConfigError') {
91
91
  // Print the stack trace in debug mode only.
92
92
  (0, _log.exit)(error);