@expo/cli 1.0.0-canary-20250729-d8899ae → 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.
- package/build/bin/cli +1 -1
- package/build/metro-require/require.js +24 -13
- package/build/src/api/getExpoSchema.js +8 -7
- package/build/src/api/getExpoSchema.js.map +1 -1
- package/build/src/expoUpdatesExports.js +28 -0
- package/build/src/expoUpdatesExports.js.map +1 -0
- package/build/src/export/embed/exportEmbedAsync.js +4 -2
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/exportApp.js +7 -4
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +20 -4
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportHermes.js +34 -9
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +19 -2
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/index.js +1 -0
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/resolveOptions.js +1 -0
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +12 -0
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/install/checkPackages.js +9 -1
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/lint/lintAsync.js +2 -0
- package/build/src/lint/lintAsync.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +18 -0
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/resolveLocalTemplate.js +42 -0
- package/build/src/prebuild/resolveLocalTemplate.js.map +1 -0
- package/build/src/prebuild/resolveTemplate.js +17 -7
- package/build/src/prebuild/resolveTemplate.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +1 -0
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +5 -3
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/run/android/resolveOptions.js +2 -2
- package/build/src/run/android/resolveOptions.js.map +1 -1
- package/build/src/run/ios/options/resolveOptions.js +2 -2
- package/build/src/run/ios/options/resolveOptions.js.map +1 -1
- package/build/src/run/ios/runIosAsync.js +3 -0
- package/build/src/run/ios/runIosAsync.js.map +1 -1
- package/build/src/serve/serveAsync.js +5 -2
- package/build/src/serve/serveAsync.js.map +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
- package/build/src/start/server/DevToolsPluginManager.js +7 -35
- package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +68 -29
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +63 -18
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/createExpoAutolinkingResolver.js +121 -0
- package/build/src/start/server/metro/createExpoAutolinkingResolver.js.map +1 -0
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +4 -4
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js +54 -8
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +1 -1
- package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js +1 -0
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +20 -18
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +20 -13
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/router.js +75 -0
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +45 -5
- package/build/src/start/server/metro/serializeHtml.js.map +1 -1
- package/build/src/start/server/metro/withMetroErrorReportingResolver.js +267 -0
- package/build/src/start/server/metro/withMetroErrorReportingResolver.js.map +1 -0
- package/build/src/start/server/metro/withMetroMultiPlatform.js +50 -35
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js +0 -176
- package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
- package/build/src/start/server/metro/withMetroSupervisingTransformWorker.js +63 -0
- package/build/src/start/server/metro/withMetroSupervisingTransformWorker.js.map +1 -0
- package/build/src/start/server/middleware/createBuiltinAPIRequestHandler.js +1 -1
- package/build/src/start/server/middleware/createBuiltinAPIRequestHandler.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +7 -2
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/serverLogLikeMetro.js +13 -11
- package/build/src/start/server/serverLogLikeMetro.js.map +1 -1
- package/build/src/utils/build-cache-providers/index.js.map +1 -1
- package/build/src/utils/dir.js +7 -0
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/env.js +3 -1
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/errors.js +1 -1
- package/build/src/utils/errors.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/internal/unstable-expo-updates-exports.d.ts +31 -0
- package/internal/unstable-expo-updates-exports.js +3 -0
- package/package.json +33 -18
- package/static/template/[...rsc]+api.ts +1 -1
- package/build/src/start/server/metro/createExpoStickyResolver.js +0 -137
- package/build/src/start/server/metro/createExpoStickyResolver.js.map +0 -1
- package/build/src/utils/jsonSchemaDeref.js +0 -150
- package/build/src/utils/jsonSchemaDeref.js.map +0 -1
|
@@ -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 /**\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. */\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":";;;;;;;;;;;IAqRaA,GAAG;eAAHA;;IAEGC,iBAAiB;eAAjBA;;;;yBAvRqB;;;;;;;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,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AEA,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,4BAA4B;IA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O,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(
|
|
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);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/errors.ts"],"sourcesContent":["import { AssertionError } from 'assert';\nimport chalk from 'chalk';\nimport { execSync } from 'child_process';\n\nimport { exit, exception, warn } from '../log';\n\nconst ERROR_PREFIX = 'Error: ';\n\n/**\n * General error, formatted as a message in red text when caught by expo-cli (no stack trace is printed). Should be used in favor of `log.error()` in most cases.\n */\nexport class CommandError extends Error {\n name = 'CommandError';\n readonly isCommandError = true;\n\n constructor(\n public code: string,\n message: string = ''\n ) {\n super('');\n // If e.toString() was called to get `message` we don't want it to look\n // like \"Error: Error:\".\n if (message.startsWith(ERROR_PREFIX)) {\n message = message.substring(ERROR_PREFIX.length);\n }\n\n this.message = message || code;\n }\n}\n\nexport class AbortCommandError extends CommandError {\n constructor() {\n super('ABORTED', 'Interactive prompt was cancelled.');\n }\n}\n\n/**\n * Used to end a CLI process without printing a stack trace in the Expo CLI. Should be used in favor of `process.exit`.\n */\nexport class SilentError extends CommandError {\n constructor(messageOrError?: string | Error) {\n const message =\n (typeof messageOrError === 'string' ? messageOrError : messageOrError?.message) ??\n 'This error should fail silently in the CLI';\n super('SILENT', message);\n if (typeof messageOrError !== 'string') {\n // forward the props of the incoming error for tests or processes outside of expo-cli that use expo cli internals.\n this.stack = messageOrError?.stack ?? this.stack;\n this.name = messageOrError?.name ?? this.name;\n }\n }\n}\n\nexport function logCmdError(error: any): never {\n if (!(error instanceof Error)) {\n throw error;\n }\n if (error instanceof AbortCommandError || error instanceof SilentError) {\n // Do nothing, this is used for prompts or other cases that were custom logged.\n process.exit(
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/errors.ts"],"sourcesContent":["import { AssertionError } from 'assert';\nimport chalk from 'chalk';\nimport { execSync } from 'child_process';\n\nimport { exit, exception, warn } from '../log';\n\nconst ERROR_PREFIX = 'Error: ';\n\n/**\n * General error, formatted as a message in red text when caught by expo-cli (no stack trace is printed). Should be used in favor of `log.error()` in most cases.\n */\nexport class CommandError extends Error {\n name = 'CommandError';\n readonly isCommandError = true;\n\n constructor(\n public code: string,\n message: string = ''\n ) {\n super('');\n // If e.toString() was called to get `message` we don't want it to look\n // like \"Error: Error:\".\n if (message.startsWith(ERROR_PREFIX)) {\n message = message.substring(ERROR_PREFIX.length);\n }\n\n this.message = message || code;\n }\n}\n\nexport class AbortCommandError extends CommandError {\n constructor() {\n super('ABORTED', 'Interactive prompt was cancelled.');\n }\n}\n\n/**\n * Used to end a CLI process without printing a stack trace in the Expo CLI. Should be used in favor of `process.exit`.\n */\nexport class SilentError extends CommandError {\n constructor(messageOrError?: string | Error) {\n const message =\n (typeof messageOrError === 'string' ? messageOrError : messageOrError?.message) ??\n 'This error should fail silently in the CLI';\n super('SILENT', message);\n if (typeof messageOrError !== 'string') {\n // forward the props of the incoming error for tests or processes outside of expo-cli that use expo cli internals.\n this.stack = messageOrError?.stack ?? this.stack;\n this.name = messageOrError?.name ?? this.name;\n }\n }\n}\n\nexport function logCmdError(error: any): never {\n if (!(error instanceof Error)) {\n throw error;\n }\n if (error instanceof AbortCommandError || error instanceof SilentError) {\n // Do nothing, this is used for prompts or other cases that were custom logged.\n process.exit(1);\n } else if (\n error instanceof CommandError ||\n error instanceof AssertionError ||\n error.name === 'ApiV2Error' ||\n error.name === 'ConfigError'\n ) {\n // Print the stack trace in debug mode only.\n exit(error);\n }\n\n const errorDetails = error.stack ? '\\n' + chalk.gray(error.stack) : '';\n\n exit(chalk.red(error.toString()) + errorDetails);\n}\n\n/** This should never be thrown in production. */\nexport class UnimplementedError extends Error {\n constructor() {\n super('Unimplemented');\n this.name = 'UnimplementedError';\n }\n}\n\n/**\n * Add additional information when EMFILE errors are encountered.\n * These errors originate from Metro's FSEventsWatcher due to `fsevents` going over MacOS system limit.\n * Unfortunately, these limits in macOS are relatively low compared to an average React Native project.\n *\n * @see https://github.com/expo/expo/issues/29083\n * @see https://github.com/facebook/metro/issues/834\n * @see https://github.com/fsevents/fsevents/issues/42#issuecomment-62632234\n */\nfunction handleTooManyOpenFileErrors(error: any) {\n // Only enable special logging when running on macOS and are running into the `EMFILE` error\n if ('code' in error && error.code === 'EMFILE' && process.platform === 'darwin') {\n try {\n // Try to recover watchman, if it's not installed this will throw\n execSync('watchman shutdown-server', { stdio: 'ignore' });\n // NOTE(cedric): this both starts the watchman server and resets all watchers\n execSync('watchman watch-del-all', { stdio: 'ignore' });\n\n warn(\n 'Watchman is installed but was likely not enabled when starting Metro, try starting your project again.\\nIf this problem persists, follow the troubleshooting guide of Watchman: https://facebook.github.io/watchman/docs/troubleshooting'\n );\n } catch {\n warn(\n `Your macOS system limit does not allow enough watchers for Metro, install Watchman instead. Learn more: https://facebook.github.io/watchman/docs/install`\n );\n }\n\n exception(error);\n process.exit(1);\n }\n\n throw error;\n}\n\nprocess.on('uncaughtException', handleTooManyOpenFileErrors);\n"],"names":["AbortCommandError","CommandError","SilentError","UnimplementedError","logCmdError","ERROR_PREFIX","Error","constructor","code","message","name","isCommandError","startsWith","substring","length","messageOrError","stack","error","process","exit","AssertionError","errorDetails","chalk","gray","red","toString","handleTooManyOpenFileErrors","platform","exec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BAAiBhB,gBACjBgB,iBAAiBG,wBAAc,IAC/BH,MAAMP,IAAI,KAAK,gBACfO,MAAMP,IAAI,KAAK,eACf;QACA,4CAA4C;QAC5CS,IAAAA,SAAI,EAACF;IACP;IAEA,MAAMI,eAAeJ,MAAMD,KAAK,GAAG,OAAOM,gBAAK,CAACC,IAAI,CAACN,MAAMD,KAAK,IAAI;IAEpEG,IAAAA,SAAI,EAACG,gBAAK,CAACE,GAAG,CAACP,MAAMQ,QAAQ,MAAMJ;AACrC;AAGO,MAAMlB,2BAA2BG;IACtCC,aAAc;QACZ,KAAK,CAAC;QACN,IAAI,CAACG,IAAI,GAAG;IACd;AACF;AAEA;;;;;;;;CAQC,GACD,SAASgB,4BAA4BT,KAAU;IAC7C,4FAA4F;IAC5F,IAAI,UAAUA,SAASA,MAAMT,IAAI,KAAK,YAAYU,QAAQS,QAAQ,KAAK,UAAU;QAC/E,IAAI;YACF,iEAAiE;YACjEC,IAAAA,yBAAQ,EAAC,4BAA4B;gBAAEC,OAAO;YAAS;YACvD,6EAA6E;YAC7ED,IAAAA,yBAAQ,EAAC,0BAA0B;gBAAEC,OAAO;YAAS;YAErDC,IAAAA,SAAI,EACF;QAEJ,EAAE,OAAM;YACNA,IAAAA,SAAI,EACF,CAAC,wJAAwJ,CAAC;QAE9J;QAEAC,IAAAA,cAAS,EAACd;QACVC,QAAQC,IAAI,CAAC;IACf;IAEA,MAAMF;AACR;AAEAC,QAAQc,EAAE,CAAC,qBAAqBN"}
|
|
@@ -33,7 +33,7 @@ class FetchClient {
|
|
|
33
33
|
this.headers = {
|
|
34
34
|
accept: 'application/json',
|
|
35
35
|
'content-type': 'application/json',
|
|
36
|
-
'user-agent': `expo-cli/${"
|
|
36
|
+
'user-agent': `expo-cli/${"54.0.0"}`,
|
|
37
37
|
authorization: 'Basic ' + _nodebuffer().Buffer.from(`${target}:`).toString('base64')
|
|
38
38
|
};
|
|
39
39
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// WARN: Internal re-export, don't rely on this to be a public API or use it outside of `expo/expo`'s monorepo
|
|
2
|
+
// NOTE for Expo Maintainers: Do not add to this file. We want to remove this
|
|
3
|
+
|
|
4
|
+
import type { HashedAssetData } from '@expo/metro-config/build/transform-worker/getAssets';
|
|
5
|
+
import type { BundleOptions } from '@expo/metro/metro/shared/types.flow';
|
|
6
|
+
import type Server from '@expo/metro/metro/Server';
|
|
7
|
+
|
|
8
|
+
export const drawableFileTypes: Set<string>;
|
|
9
|
+
|
|
10
|
+
export function createMetroServerAndBundleRequestAsync(
|
|
11
|
+
projectRoot: string,
|
|
12
|
+
options: {
|
|
13
|
+
maxWorkers?: number;
|
|
14
|
+
config?: string;
|
|
15
|
+
platform: string;
|
|
16
|
+
sourcemapOutput?: string;
|
|
17
|
+
sourcemapUseAbsolutePath: boolean;
|
|
18
|
+
entryFile: string;
|
|
19
|
+
minify?: boolean;
|
|
20
|
+
dev: boolean;
|
|
21
|
+
resetCache: boolean;
|
|
22
|
+
unstableTransformProfile?: string;
|
|
23
|
+
}
|
|
24
|
+
): Promise<{ server: Server; bundleRequest: BundleOptions }>;
|
|
25
|
+
|
|
26
|
+
export function exportEmbedAssetsAsync(
|
|
27
|
+
server: Server,
|
|
28
|
+
bundleRequest: BundleOptions,
|
|
29
|
+
projectRoot: string,
|
|
30
|
+
options: { platform: string },
|
|
31
|
+
): Promise<HashedAssetData[]>;
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "54.0.0",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
7
7
|
"expo-internal": "build/bin/cli"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
+
"internal",
|
|
10
11
|
"static",
|
|
11
12
|
"build"
|
|
12
13
|
],
|
|
@@ -40,24 +41,25 @@
|
|
|
40
41
|
"homepage": "https://github.com/expo/expo/tree/main/packages/@expo/cli",
|
|
41
42
|
"dependencies": {
|
|
42
43
|
"@0no-co/graphql.web": "^1.0.8",
|
|
43
|
-
"@babel/runtime": "^7.20.0",
|
|
44
44
|
"@expo/code-signing-certificates": "^0.0.5",
|
|
45
|
-
"@expo/config": "
|
|
46
|
-
"@expo/config-plugins": "
|
|
45
|
+
"@expo/config": "~12.0.7",
|
|
46
|
+
"@expo/config-plugins": "~54.0.0",
|
|
47
47
|
"@expo/devcert": "^1.1.2",
|
|
48
|
-
"@expo/env": "
|
|
49
|
-
"@expo/image-utils": "0.
|
|
50
|
-
"@expo/json-file": "
|
|
51
|
-
"@expo/metro": "~0.1.
|
|
52
|
-
"@expo/metro-config": "0.
|
|
53
|
-
"@expo/osascript": "2.
|
|
54
|
-
"@expo/package-manager": "1.
|
|
55
|
-
"@expo/plist": "0.
|
|
56
|
-
"@expo/prebuild-config": "
|
|
48
|
+
"@expo/env": "~2.0.6",
|
|
49
|
+
"@expo/image-utils": "^0.8.6",
|
|
50
|
+
"@expo/json-file": "^10.0.6",
|
|
51
|
+
"@expo/metro": "~0.1.1",
|
|
52
|
+
"@expo/metro-config": "~54.0.0",
|
|
53
|
+
"@expo/osascript": "^2.3.6",
|
|
54
|
+
"@expo/package-manager": "^1.9.6",
|
|
55
|
+
"@expo/plist": "^0.4.6",
|
|
56
|
+
"@expo/prebuild-config": "^54.0.0",
|
|
57
|
+
"@expo/schema-utils": "^0.1.6",
|
|
58
|
+
"@expo/server": "^0.7.3",
|
|
57
59
|
"@expo/spawn-async": "^1.7.2",
|
|
58
60
|
"@expo/ws-tunnel": "^1.0.1",
|
|
59
61
|
"@expo/xcpretty": "^4.3.0",
|
|
60
|
-
"@react-native/dev-middleware": "0.
|
|
62
|
+
"@react-native/dev-middleware": "0.81.4",
|
|
61
63
|
"@urql/core": "^5.0.6",
|
|
62
64
|
"@urql/exchange-retry": "^1.3.0",
|
|
63
65
|
"accepts": "^1.3.8",
|
|
@@ -74,8 +76,8 @@
|
|
|
74
76
|
"freeport-async": "^2.0.0",
|
|
75
77
|
"getenv": "^2.0.0",
|
|
76
78
|
"glob": "^10.4.2",
|
|
77
|
-
"minimatch": "^9.0.0",
|
|
78
79
|
"lan-network": "^0.1.6",
|
|
80
|
+
"minimatch": "^9.0.0",
|
|
79
81
|
"node-forge": "^1.3.1",
|
|
80
82
|
"npm-package-arg": "^11.0.0",
|
|
81
83
|
"ora": "^3.4.0",
|
|
@@ -107,10 +109,22 @@
|
|
|
107
109
|
"./taskfile-swc.js"
|
|
108
110
|
]
|
|
109
111
|
},
|
|
112
|
+
"peerDependencies": {
|
|
113
|
+
"expo": "*",
|
|
114
|
+
"expo-router": "*",
|
|
115
|
+
"react-native": "*"
|
|
116
|
+
},
|
|
117
|
+
"peerDependenciesMeta": {
|
|
118
|
+
"expo-router": {
|
|
119
|
+
"optional": true
|
|
120
|
+
},
|
|
121
|
+
"react-native": {
|
|
122
|
+
"optional": true
|
|
123
|
+
}
|
|
124
|
+
},
|
|
110
125
|
"devDependencies": {
|
|
111
126
|
"@expo/multipart-body-parser": "^1.0.0",
|
|
112
127
|
"@expo/ngrok": "4.1.3",
|
|
113
|
-
"@expo/server": "0.6.4-canary-20250729-d8899ae",
|
|
114
128
|
"@graphql-codegen/cli": "^2.16.3",
|
|
115
129
|
"@graphql-codegen/typescript": "^2.8.7",
|
|
116
130
|
"@graphql-codegen/typescript-operations": "^2.5.12",
|
|
@@ -140,7 +154,7 @@
|
|
|
140
154
|
"@types/ws": "^8.5.4",
|
|
141
155
|
"devtools-protocol": "^0.0.1113120",
|
|
142
156
|
"expo-atlas": "^0.4.1",
|
|
143
|
-
"expo-module-scripts": "
|
|
157
|
+
"expo-module-scripts": "^5.0.7",
|
|
144
158
|
"find-process": "^1.4.7",
|
|
145
159
|
"jest-runner-tsd": "^6.0.0",
|
|
146
160
|
"klaw-sync": "^6.0.0",
|
|
@@ -152,5 +166,6 @@
|
|
|
152
166
|
"taskr": "^1.1.0",
|
|
153
167
|
"tree-kill": "^1.2.2",
|
|
154
168
|
"tsd": "^0.28.1"
|
|
155
|
-
}
|
|
169
|
+
},
|
|
170
|
+
"gitHead": "87186d10c8239c6469e055417e67bd4d0ed63efb"
|
|
156
171
|
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
_dependenciesToRegex: function() {
|
|
13
|
-
return _dependenciesToRegex;
|
|
14
|
-
},
|
|
15
|
-
createStickyModuleResolver: function() {
|
|
16
|
-
return createStickyModuleResolver;
|
|
17
|
-
},
|
|
18
|
-
createStickyModuleResolverInput: function() {
|
|
19
|
-
return createStickyModuleResolverInput;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const debug = require('debug')('expo:start:server:metro:sticky-resolver');
|
|
23
|
-
const AUTOLINKING_PLATFORMS = [
|
|
24
|
-
'android',
|
|
25
|
-
'ios',
|
|
26
|
-
'web'
|
|
27
|
-
];
|
|
28
|
-
const escapeDependencyName = (dependency)=>dependency.replace(/[*.?()[\]]/g, (x)=>`\\${x}`);
|
|
29
|
-
const _dependenciesToRegex = (dependencies)=>new RegExp(`^(${dependencies.map(escapeDependencyName).join('|')})($|/.*)`);
|
|
30
|
-
/** Creates a function to load a dependency of the `expo` package */ const createExpoDependencyLoader = (request)=>{
|
|
31
|
-
let mod;
|
|
32
|
-
return ()=>{
|
|
33
|
-
if (!mod) {
|
|
34
|
-
const expoPath = require.resolve('expo/package.json');
|
|
35
|
-
const autolinkingPath = require.resolve(request, {
|
|
36
|
-
paths: [
|
|
37
|
-
expoPath
|
|
38
|
-
]
|
|
39
|
-
});
|
|
40
|
-
return mod = require(autolinkingPath);
|
|
41
|
-
}
|
|
42
|
-
return mod;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
const getAutolinkingModule = createExpoDependencyLoader('expo-modules-autolinking/exports');
|
|
46
|
-
const getReactNativeConfigModule = createExpoDependencyLoader('expo-modules-autolinking/build/reactNativeConfig');
|
|
47
|
-
const getAutolinkingOptions = async (projectRoot, platform)=>{
|
|
48
|
-
const autolinking = getAutolinkingModule();
|
|
49
|
-
return await autolinking.mergeLinkingOptionsAsync({
|
|
50
|
-
searchPaths: [],
|
|
51
|
-
projectRoot,
|
|
52
|
-
platform: platform === 'ios' ? 'apple' : platform,
|
|
53
|
-
onlyProjectDeps: true,
|
|
54
|
-
silent: true
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
const getAutolinkingResolutions = async (opts)=>{
|
|
58
|
-
const autolinking = getAutolinkingModule();
|
|
59
|
-
const resolvedModules = await autolinking.findModulesAsync(opts);
|
|
60
|
-
return Object.fromEntries(Object.entries(resolvedModules).map(([key, entry])=>[
|
|
61
|
-
key,
|
|
62
|
-
entry.path
|
|
63
|
-
]));
|
|
64
|
-
};
|
|
65
|
-
const getReactNativeConfigResolutions = async (opts)=>{
|
|
66
|
-
const reactNativeConfigModule = getReactNativeConfigModule();
|
|
67
|
-
const configResult = await reactNativeConfigModule.createReactNativeConfigAsync({
|
|
68
|
-
...opts,
|
|
69
|
-
// NOTE(@kitten): web will use ios here. This is desired since this function only accepts android|ios.
|
|
70
|
-
// However, we'd still like to sticky resolve dependencies for web
|
|
71
|
-
platform: opts.platform === 'android' ? 'android' : 'ios',
|
|
72
|
-
// TODO(@kitten): Unclear if this should be populated or directly relates to sticky resolution
|
|
73
|
-
transitiveLinkingDependencies: []
|
|
74
|
-
});
|
|
75
|
-
return Object.fromEntries(Object.entries(configResult.dependencies).map(([key, entry])=>[
|
|
76
|
-
key,
|
|
77
|
-
entry.root
|
|
78
|
-
]));
|
|
79
|
-
};
|
|
80
|
-
const getPlatformModuleDescription = async (projectRoot, platform)=>{
|
|
81
|
-
const searchOptions = await getAutolinkingOptions(projectRoot, platform);
|
|
82
|
-
const autolinkingResolutions$ = getAutolinkingResolutions(searchOptions);
|
|
83
|
-
const reactNativeConfigResolutions$ = getReactNativeConfigResolutions(searchOptions);
|
|
84
|
-
const resolvedModulePaths = {
|
|
85
|
-
...await reactNativeConfigResolutions$,
|
|
86
|
-
...await autolinkingResolutions$
|
|
87
|
-
};
|
|
88
|
-
const resolvedModuleNames = Object.keys(resolvedModulePaths);
|
|
89
|
-
debug(`Sticky resolution for ${platform} registered ${resolvedModuleNames.length} resolutions:`, resolvedModuleNames);
|
|
90
|
-
return {
|
|
91
|
-
platform,
|
|
92
|
-
moduleTestRe: _dependenciesToRegex(resolvedModuleNames),
|
|
93
|
-
resolvedModulePaths
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
async function createStickyModuleResolverInput({ platforms, projectRoot }) {
|
|
97
|
-
return Object.fromEntries(await Promise.all(platforms.filter((platform)=>AUTOLINKING_PLATFORMS.includes(platform)).map(async (platform)=>{
|
|
98
|
-
const platformModuleDescription = await getPlatformModuleDescription(projectRoot, platform);
|
|
99
|
-
return [
|
|
100
|
-
platformModuleDescription.platform,
|
|
101
|
-
platformModuleDescription
|
|
102
|
-
];
|
|
103
|
-
})));
|
|
104
|
-
}
|
|
105
|
-
function createStickyModuleResolver(input, { getStrictResolver }) {
|
|
106
|
-
if (!input) {
|
|
107
|
-
return undefined;
|
|
108
|
-
}
|
|
109
|
-
const fileSpecifierRe = /^[\\/]|^\.\.?(?:$|[\\/])/i;
|
|
110
|
-
const isAutolinkingPlatform = (platform)=>!!platform && input[platform] != null;
|
|
111
|
-
return function requestStickyModule(immutableContext, moduleName, platform) {
|
|
112
|
-
if (!isAutolinkingPlatform(platform)) {
|
|
113
|
-
return null;
|
|
114
|
-
} else if (fileSpecifierRe.test(moduleName)) {
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
const moduleDescription = input[platform];
|
|
118
|
-
const moduleMatch = moduleDescription.moduleTestRe.exec(moduleName);
|
|
119
|
-
if (moduleMatch) {
|
|
120
|
-
const resolvedModulePath = moduleDescription.resolvedModulePaths[moduleMatch[1]] || moduleName;
|
|
121
|
-
// We instead resolve as if it was a dependency from within the module (self-require/import)
|
|
122
|
-
const context = {
|
|
123
|
-
...immutableContext,
|
|
124
|
-
nodeModulesPaths: [
|
|
125
|
-
resolvedModulePath
|
|
126
|
-
],
|
|
127
|
-
originModulePath: resolvedModulePath
|
|
128
|
-
};
|
|
129
|
-
const res = getStrictResolver(context, platform)(moduleName);
|
|
130
|
-
debug(`Sticky resolution for ${platform}: ${moduleName} -> ${resolvedModulePath}`);
|
|
131
|
-
return res;
|
|
132
|
-
}
|
|
133
|
-
return null;
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
//# sourceMappingURL=createExpoStickyResolver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/createExpoStickyResolver.ts"],"sourcesContent":["import type { ResolutionContext } from '@expo/metro/metro-resolver';\nimport type { SearchOptions as AutolinkingSearchOptions } from 'expo-modules-autolinking/exports';\n\nimport type { StrictResolverFactory } from './withMetroMultiPlatform';\nimport type { ExpoCustomMetroResolver } from './withMetroResolvers';\n\nconst debug = require('debug')('expo:start:server:metro:sticky-resolver') as typeof console.log;\n\nconst AUTOLINKING_PLATFORMS = ['android', 'ios', 'web'] as const;\ntype AutolinkingPlatform = (typeof AUTOLINKING_PLATFORMS)[number];\n\nconst escapeDependencyName = (dependency: string) =>\n dependency.replace(/[*.?()[\\]]/g, (x) => `\\\\${x}`);\n\n/** Converts a list of module names to a regex that may either match bare module names or sub-modules of modules */\nexport const _dependenciesToRegex = (dependencies: string[]) =>\n new RegExp(`^(${dependencies.map(escapeDependencyName).join('|')})($|/.*)`);\n\n/** Creates a function to load a dependency of the `expo` package */\nconst createExpoDependencyLoader = <T>(request: string) => {\n let mod: T | undefined;\n return (): T => {\n if (!mod) {\n const expoPath = require.resolve('expo/package.json');\n const autolinkingPath = require.resolve(request, {\n paths: [expoPath],\n });\n return (mod = require(autolinkingPath));\n }\n return mod;\n };\n};\n\nconst getAutolinkingModule = createExpoDependencyLoader<\n typeof import('expo-modules-autolinking/exports')\n>('expo-modules-autolinking/exports');\n\nconst getReactNativeConfigModule = createExpoDependencyLoader<\n typeof import('expo-modules-autolinking/build/reactNativeConfig')\n>('expo-modules-autolinking/build/reactNativeConfig');\n\nconst getAutolinkingOptions = async (\n projectRoot: string,\n platform: AutolinkingPlatform\n): Promise<AutolinkingSearchOptions> => {\n const autolinking = getAutolinkingModule();\n return await autolinking.mergeLinkingOptionsAsync({\n searchPaths: [],\n projectRoot,\n platform: platform === 'ios' ? 'apple' : platform,\n onlyProjectDeps: true,\n silent: true,\n });\n};\n\nconst getAutolinkingResolutions = async (\n opts: AutolinkingSearchOptions\n): Promise<Record<string, string>> => {\n const autolinking = getAutolinkingModule();\n const resolvedModules = await autolinking.findModulesAsync(opts);\n return Object.fromEntries(\n Object.entries(resolvedModules).map(([key, entry]) => [key, entry.path])\n );\n};\n\nconst getReactNativeConfigResolutions = async (\n opts: AutolinkingSearchOptions\n): Promise<Record<string, string>> => {\n const reactNativeConfigModule = getReactNativeConfigModule();\n const configResult = await reactNativeConfigModule.createReactNativeConfigAsync({\n ...opts,\n // NOTE(@kitten): web will use ios here. This is desired since this function only accepts android|ios.\n // However, we'd still like to sticky resolve dependencies for web\n platform: opts.platform === 'android' ? 'android' : 'ios',\n // TODO(@kitten): Unclear if this should be populated or directly relates to sticky resolution\n transitiveLinkingDependencies: [],\n });\n return Object.fromEntries(\n Object.entries(configResult.dependencies).map(([key, entry]) => [key, entry.root])\n );\n};\n\ninterface PlatformModuleDescription {\n platform: AutolinkingPlatform;\n moduleTestRe: RegExp;\n resolvedModulePaths: Record<string, string>;\n}\n\nconst getPlatformModuleDescription = async (\n projectRoot: string,\n platform: AutolinkingPlatform\n): Promise<PlatformModuleDescription> => {\n const searchOptions = await getAutolinkingOptions(projectRoot, platform);\n const autolinkingResolutions$ = getAutolinkingResolutions(searchOptions);\n const reactNativeConfigResolutions$ = getReactNativeConfigResolutions(searchOptions);\n const resolvedModulePaths = {\n ...(await reactNativeConfigResolutions$),\n ...(await autolinkingResolutions$),\n };\n const resolvedModuleNames = Object.keys(resolvedModulePaths);\n debug(\n `Sticky resolution for ${platform} registered ${resolvedModuleNames.length} resolutions:`,\n resolvedModuleNames\n );\n return {\n platform,\n moduleTestRe: _dependenciesToRegex(resolvedModuleNames),\n resolvedModulePaths,\n };\n};\n\nexport type StickyModuleResolverInput = {\n [platform in AutolinkingPlatform]?: PlatformModuleDescription;\n};\n\nexport async function createStickyModuleResolverInput({\n platforms,\n projectRoot,\n}: {\n projectRoot: string;\n platforms: string[];\n}): Promise<StickyModuleResolverInput> {\n return Object.fromEntries(\n await Promise.all(\n platforms\n .filter((platform): platform is AutolinkingPlatform =>\n AUTOLINKING_PLATFORMS.includes(platform as any)\n )\n .map(async (platform) => {\n const platformModuleDescription = await getPlatformModuleDescription(\n projectRoot,\n platform\n );\n return [platformModuleDescription.platform, platformModuleDescription] as const;\n })\n )\n ) as StickyModuleResolverInput;\n}\n\nexport function createStickyModuleResolver(\n input: StickyModuleResolverInput | undefined,\n { getStrictResolver }: { getStrictResolver: StrictResolverFactory }\n): ExpoCustomMetroResolver | undefined {\n if (!input) {\n return undefined;\n }\n\n const fileSpecifierRe = /^[\\\\/]|^\\.\\.?(?:$|[\\\\/])/i;\n const isAutolinkingPlatform = (platform: string | null): platform is AutolinkingPlatform =>\n !!platform && (input as any)[platform] != null;\n\n return function requestStickyModule(immutableContext, moduleName, platform) {\n if (!isAutolinkingPlatform(platform)) {\n return null;\n } else if (fileSpecifierRe.test(moduleName)) {\n return null;\n }\n\n const moduleDescription = input[platform]!;\n const moduleMatch = moduleDescription.moduleTestRe.exec(moduleName);\n if (moduleMatch) {\n const resolvedModulePath =\n moduleDescription.resolvedModulePaths[moduleMatch[1]] || moduleName;\n // We instead resolve as if it was a dependency from within the module (self-require/import)\n const context: ResolutionContext = {\n ...immutableContext,\n nodeModulesPaths: [resolvedModulePath],\n originModulePath: resolvedModulePath,\n };\n const res = getStrictResolver(context, platform)(moduleName);\n debug(`Sticky resolution for ${platform}: ${moduleName} -> ${resolvedModulePath}`);\n return res;\n }\n\n return null;\n };\n}\n"],"names":["_dependenciesToRegex","createStickyModuleResolver","createStickyModuleResolverInput","debug","require","AUTOLINKING_PLATFORMS","escapeDependencyName","dependency","replace","x","dependencies","RegExp","map","join","createExpoDependencyLoader","request","mod","expoPath","resolve","autolinkingPath","paths","getAutolinkingModule","getReactNativeConfigModule","getAutolinkingOptions","projectRoot","platform","autolinking","mergeLinkingOptionsAsync","searchPaths","onlyProjectDeps","silent","getAutolinkingResolutions","opts","resolvedModules","findModulesAsync","Object","fromEntries","entries","key","entry","path","getReactNativeConfigResolutions","reactNativeConfigModule","configResult","createReactNativeConfigAsync","transitiveLinkingDependencies","root","getPlatformModuleDescription","searchOptions","autolinkingResolutions$","reactNativeConfigResolutions$","resolvedModulePaths","resolvedModuleNames","keys","length","moduleTestRe","platforms","Promise","all","filter","includes","platformModuleDescription","input","getStrictResolver","undefined","fileSpecifierRe","isAutolinkingPlatform","requestStickyModule","immutableContext","moduleName","test","moduleDescription","moduleMatch","exec","resolvedModulePath","context","nodeModulesPaths","originModulePath","res"],"mappings":";;;;;;;;;;;IAeaA,oBAAoB;eAApBA;;IA4HGC,0BAA0B;eAA1BA;;IAxBMC,+BAA+B;eAA/BA;;;AA7GtB,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,MAAMC,wBAAwB;IAAC;IAAW;IAAO;CAAM;AAGvD,MAAMC,uBAAuB,CAACC,aAC5BA,WAAWC,OAAO,CAAC,eAAe,CAACC,IAAM,CAAC,EAAE,EAAEA,GAAG;AAG5C,MAAMT,uBAAuB,CAACU,eACnC,IAAIC,OA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,cAAcD,kBAAkBhB,YAAY,CAACkB,IAAI,CAACJ;QACxD,IAAIG,aAAa;YACf,MAAME,qBACJH,kBAAkBpB,mBAAmB,CAACqB,WAAW,CAAC,EAAE,CAAC,IAAIH;YAC3D,4FAA4F;YAC5F,MAAMM,UAA6B;gBACjC,GAAGP,gBAAgB;gBACnBQ,kBAAkB;oBAACF;iBAAmB;gBACtCG,kBAAkBH;YACpB;YACA,MAAMI,MAAMf,kBAAkBY,SAASlD,UAAU4C;YACjDlE,MAAM,CAAC,sBAAsB,EAAEsB,SAAS,EAAE,EAAE4C,WAAW,IAAI,EAAEK,oBAAoB;YACjF,OAAOI;QACT;QAEA,OAAO;IACT;AACF"}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "jsonSchemaDeref", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return jsonSchemaDeref;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
/** Return JSON schema ref if input is of `NodeRef` type */ const getRef = (node)=>node != null && typeof node === 'object' && '$ref' in node && typeof node.$ref === 'string' ? node.$ref : undefined;
|
|
12
|
-
/** Parse a JSON schema ref into a path array, or return undefined */ const parseRefMaybe = (ref)=>{
|
|
13
|
-
if (ref[0] !== '#') {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
const props = [];
|
|
17
|
-
let startIndex = 1;
|
|
18
|
-
let index = 1;
|
|
19
|
-
let char;
|
|
20
|
-
while(index < ref.length){
|
|
21
|
-
while((char = ref.charCodeAt(index++)) && char !== 47 /*'/'*/ );
|
|
22
|
-
const prop = ref.slice(startIndex, index - 1);
|
|
23
|
-
startIndex = index;
|
|
24
|
-
if (prop) props.push(prop);
|
|
25
|
-
}
|
|
26
|
-
return props.length ? props : undefined;
|
|
27
|
-
};
|
|
28
|
-
const NOT_FOUND_SYMBOL = Symbol();
|
|
29
|
-
/** Get value at given JSON schema path or return `NOT_FOUND_SYMBOL` */ const getValueAtPath = (input, ref)=>{
|
|
30
|
-
let node = input;
|
|
31
|
-
for(let index = 0; index < ref.length; index++){
|
|
32
|
-
const part = ref[index];
|
|
33
|
-
if (node != null && typeof node === 'object' && part in node) {
|
|
34
|
-
node = node[part];
|
|
35
|
-
} else {
|
|
36
|
-
node = NOT_FOUND_SYMBOL;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return node;
|
|
41
|
-
};
|
|
42
|
-
/** Find all JSON schema refs recursively and add them to `refs` Map */ const findRefsRec = (node, refs, path)=>{
|
|
43
|
-
if (node == null || typeof node !== 'object') {} else if (Array.isArray(node)) {
|
|
44
|
-
for(let index = 0, l = node.length; index < l; index++){
|
|
45
|
-
const value = node[index];
|
|
46
|
-
const ref = getRef(value);
|
|
47
|
-
if (ref) {
|
|
48
|
-
const targetRef = parseRefMaybe(ref);
|
|
49
|
-
if (targetRef) refs.set([
|
|
50
|
-
...path,
|
|
51
|
-
index
|
|
52
|
-
], targetRef);
|
|
53
|
-
} else if (value != null && typeof value === 'object') {
|
|
54
|
-
path.push(index);
|
|
55
|
-
findRefsRec(value, refs, path);
|
|
56
|
-
path.pop();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
} else {
|
|
60
|
-
const record = node;
|
|
61
|
-
for(const key in record){
|
|
62
|
-
const value = record[key];
|
|
63
|
-
const ref = getRef(value);
|
|
64
|
-
if (ref) {
|
|
65
|
-
const targetRef = parseRefMaybe(ref);
|
|
66
|
-
if (targetRef) refs.set([
|
|
67
|
-
...path,
|
|
68
|
-
key
|
|
69
|
-
], targetRef);
|
|
70
|
-
} else if (value != null && typeof value === 'object') {
|
|
71
|
-
path.push(key);
|
|
72
|
-
findRefsRec(value, refs, path);
|
|
73
|
-
path.pop();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
/** Detect whether target (where we set the source value) is a nested path inside the source path */ const isSelfReferencingRefEntry = (target, source)=>{
|
|
79
|
-
for(let index = 0; index < source.length; index++){
|
|
80
|
-
if (source[index] !== target[index]) return false;
|
|
81
|
-
}
|
|
82
|
-
return true;
|
|
83
|
-
};
|
|
84
|
-
/** Return sorted refs entries. Longest target paths will be returned first */ const getSortedRefEntries = (refs)=>{
|
|
85
|
-
const entries = [
|
|
86
|
-
...refs.entries()
|
|
87
|
-
].sort((a, b)=>b[1].length - a[1].length);
|
|
88
|
-
// Filter out self-referenceing paths. If we set nested targets to source values, we'd
|
|
89
|
-
// create unserializable circular references
|
|
90
|
-
return entries.filter((entry)=>!isSelfReferencingRefEntry(entry[0], entry[1]));
|
|
91
|
-
};
|
|
92
|
-
function jsonSchemaDeref(input) {
|
|
93
|
-
// Find all JSON schema refs paths
|
|
94
|
-
const refs = new Map();
|
|
95
|
-
findRefsRec(input, refs, []);
|
|
96
|
-
// Shallow copy output
|
|
97
|
-
const output = {
|
|
98
|
-
...input
|
|
99
|
-
};
|
|
100
|
-
// Process all ref entries with deepest targets first
|
|
101
|
-
nextRef: for (const [target, source] of getSortedRefEntries(refs)){
|
|
102
|
-
let inputNode = input;
|
|
103
|
-
let outputNode = output;
|
|
104
|
-
let targetIndex = 0;
|
|
105
|
-
// For each path part on the target, traverse the output and clone the input
|
|
106
|
-
// to not pollute it
|
|
107
|
-
for(; targetIndex < target.length - 1; targetIndex++){
|
|
108
|
-
const part = target[targetIndex];
|
|
109
|
-
if (inputNode == null || typeof inputNode !== 'object' || !(part in inputNode)) {
|
|
110
|
-
break;
|
|
111
|
-
} else if (outputNode[part] === inputNode[part]) {
|
|
112
|
-
// Copy the input on the output if references are equal
|
|
113
|
-
outputNode[part] = Array.isArray(inputNode[part]) ? [
|
|
114
|
-
...inputNode[part]
|
|
115
|
-
] : {
|
|
116
|
-
...inputNode[part]
|
|
117
|
-
};
|
|
118
|
-
inputNode = inputNode[part];
|
|
119
|
-
outputNode = outputNode[part];
|
|
120
|
-
} else {
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
// For each remaining part on the target, continue traversing the output
|
|
125
|
-
for(; targetIndex < target.length - 1; targetIndex++){
|
|
126
|
-
const part = target[targetIndex];
|
|
127
|
-
if (outputNode == null || typeof outputNode !== 'object' || !(part in outputNode)) {
|
|
128
|
-
continue nextRef;
|
|
129
|
-
} else {
|
|
130
|
-
outputNode = outputNode[part];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
// Get value from output
|
|
134
|
-
let sourceValue = getValueAtPath(output, source);
|
|
135
|
-
if (sourceValue === NOT_FOUND_SYMBOL) {
|
|
136
|
-
// If no value was found, try to get a value from the input instead
|
|
137
|
-
sourceValue = getValueAtPath(input, source);
|
|
138
|
-
// Otherwise, skip this ref
|
|
139
|
-
if (sourceValue === NOT_FOUND_SYMBOL) continue;
|
|
140
|
-
}
|
|
141
|
-
// Set the source value on the target path
|
|
142
|
-
// The for-loops prior have made sure that the output has already been deeply
|
|
143
|
-
// cloned and traversed for the entire path
|
|
144
|
-
outputNode[target[target.length - 1]] = sourceValue;
|
|
145
|
-
}
|
|
146
|
-
// Return the output with resolved refs
|
|
147
|
-
return output;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
//# sourceMappingURL=jsonSchemaDeref.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/jsonSchemaDeref.ts"],"sourcesContent":["type RefPath = readonly (string | number)[];\n\ninterface NodeRef {\n $ref: string;\n}\n\n/** Return JSON schema ref if input is of `NodeRef` type */\nconst getRef = (node: NodeRef | unknown): string | undefined =>\n node != null && typeof node === 'object' && '$ref' in node && typeof node.$ref === 'string'\n ? node.$ref\n : undefined;\n\n/** Parse a JSON schema ref into a path array, or return undefined */\nconst parseRefMaybe = (ref: string): RefPath | undefined => {\n if (ref[0] !== '#') {\n return undefined;\n }\n const props = [];\n let startIndex = 1;\n let index = 1;\n let char: number;\n while (index < ref.length) {\n while ((char = ref.charCodeAt(index++)) && char !== 47 /*'/'*/);\n const prop = ref.slice(startIndex, index - 1);\n startIndex = index;\n if (prop) props.push(prop);\n }\n return props.length ? props : undefined;\n};\n\nconst NOT_FOUND_SYMBOL = Symbol();\n\n/** Get value at given JSON schema path or return `NOT_FOUND_SYMBOL` */\nconst getValueAtPath = (input: unknown, ref: RefPath): unknown | typeof NOT_FOUND_SYMBOL => {\n let node = input;\n for (let index = 0; index < ref.length; index++) {\n const part = ref[index];\n if (node != null && typeof node === 'object' && part in node) {\n node = (node as Record<string, unknown>)[part];\n } else {\n node = NOT_FOUND_SYMBOL;\n break;\n }\n }\n return node;\n};\n\n/** Find all JSON schema refs recursively and add them to `refs` Map */\nconst findRefsRec = (\n node: unknown,\n refs: Map<RefPath, RefPath>,\n path: (string | number)[]\n): void => {\n if (node == null || typeof node !== 'object') {\n } else if (Array.isArray(node)) {\n for (let index = 0, l = node.length; index < l; index++) {\n const value = node[index];\n const ref = getRef(value);\n if (ref) {\n const targetRef = parseRefMaybe(ref);\n if (targetRef) refs.set([...path, index], targetRef);\n } else if (value != null && typeof value === 'object') {\n path.push(index);\n findRefsRec(value, refs, path);\n path.pop();\n }\n }\n } else {\n const record = node as Record<string, unknown>;\n for (const key in record) {\n const value = record[key];\n const ref = getRef(value);\n if (ref) {\n const targetRef = parseRefMaybe(ref);\n if (targetRef) refs.set([...path, key], targetRef);\n } else if (value != null && typeof value === 'object') {\n path.push(key);\n findRefsRec(value, refs, path);\n path.pop();\n }\n }\n }\n};\n\n/** Detect whether target (where we set the source value) is a nested path inside the source path */\nconst isSelfReferencingRefEntry = (target: RefPath, source: RefPath) => {\n for (let index = 0; index < source.length; index++) {\n if (source[index] !== target[index]) return false;\n }\n return true;\n};\n\n/** Return sorted refs entries. Longest target paths will be returned first */\nconst getSortedRefEntries = (refs: Map<RefPath, RefPath>): readonly [RefPath, RefPath][] => {\n const entries = [...refs.entries()].sort((a, b) => b[1].length - a[1].length);\n // Filter out self-referenceing paths. If we set nested targets to source values, we'd\n // create unserializable circular references\n return entries.filter((entry) => !isSelfReferencingRefEntry(entry[0], entry[1]));\n};\n\n/** Dereference JSON schema pointers.\n *\n * @remarks\n * This is a minimal reimplementation of `json-schema-deref-sync` without\n * file reference, URL/web reference, and loader support.\n *\n * @see https://github.com/cvent/json-schema-deref-sync\n */\nexport function jsonSchemaDeref(input: any): any {\n // Find all JSON schema refs paths\n const refs = new Map<RefPath, RefPath>();\n findRefsRec(input, refs, []);\n // Shallow copy output\n const output = { ...input };\n // Process all ref entries with deepest targets first\n nextRef: for (const [target, source] of getSortedRefEntries(refs)) {\n let inputNode = input;\n let outputNode = output;\n let targetIndex = 0;\n // For each path part on the target, traverse the output and clone the input\n // to not pollute it\n for (; targetIndex < target.length - 1; targetIndex++) {\n const part = target[targetIndex];\n if (inputNode == null || typeof inputNode !== 'object' || !(part in inputNode)) {\n // If the part doesn't exist, we abort\n break;\n } else if (outputNode[part] === inputNode[part]) {\n // Copy the input on the output if references are equal\n outputNode[part] = Array.isArray(inputNode[part])\n ? [...inputNode[part]]\n : { ...inputNode[part] };\n inputNode = inputNode[part];\n outputNode = outputNode[part];\n } else {\n // If this part has already been copied, abort\n break;\n }\n }\n // For each remaining part on the target, continue traversing the output\n for (; targetIndex < target.length - 1; targetIndex++) {\n const part = target[targetIndex];\n if (outputNode == null || typeof outputNode !== 'object' || !(part in outputNode)) {\n // If the part doesn't exist, skip the entire ref\n continue nextRef;\n } else {\n outputNode = outputNode[part];\n }\n }\n // Get value from output\n let sourceValue = getValueAtPath(output, source);\n if (sourceValue === NOT_FOUND_SYMBOL) {\n // If no value was found, try to get a value from the input instead\n sourceValue = getValueAtPath(input, source);\n // Otherwise, skip this ref\n if (sourceValue === NOT_FOUND_SYMBOL) continue;\n }\n // Set the source value on the target path\n // The for-loops prior have made sure that the output has already been deeply\n // cloned and traversed for the entire path\n outputNode[target[target.length - 1]] = sourceValue;\n }\n // Return the output with resolved refs\n return output;\n}\n"],"names":["jsonSchemaDeref","getRef","node","$ref","undefined","parseRefMaybe","ref","props","startIndex","index","char","length","charCodeAt","prop","slice","push","NOT_FOUND_SYMBOL","Symbol","getValueAtPath","input","part","findRefsRec","refs","path","Array","isArray","l","value","targetRef","set","pop","record","key","isSelfReferencingRefEntry","target","source","getSortedRefEntries","entries","sort","a","b","filter","entry","Map","output","nextRef","inputNode","outputNode","targetIndex","sourceValue"],"mappings":";;;;+BA4GgBA;;;eAAAA;;;AAtGhB,yDAAyD,GACzD,MAAMC,SAAS,CAACC,OACdA,QAAQ,QAAQ,OAAOA,SAAS,YAAY,UAAUA,QAAQ,OAAOA,KAAKC,IAAI,KAAK,WAC/ED,KAAKC,IAAI,GACTC;AAEN,mEAAmE,GACnE,MAAMC,gBAAgB,CAACC;IACrB,IAAIA,GAAG,CAAC,EAAE,KAAK,KAAK;QAClB,OAAOF;IACT;IACA,MAAMG,QAAQ,EAAE;IAChB,IAAIC,aAAa;IACjB,IAAIC,QAAQ;IACZ,IAAIC;IACJ,MAAOD,QAAQH,IAAIK,MAAM,CAAE;QACzB,MAAO,AAACD,CAAAA,OAAOJ,IAAIM,UAAU,CAACH,QAAO,KAAMC,SAAS,GAAG,KAAK;QAC5D,MAAMG,OAAOP,IAAIQ,KAAK,CAACN,YAAYC,QAAQ;QAC3CD,aAAaC;QACb,IAAII,MAAMN,MAAMQ,IAAI,CAACF;IACvB;IACA,OAAON,MAAMI,MAAM,GAAGJ,QAAQH;AAChC;AAEA,MAAMY,mBAAmBC;AAEzB,qEAAqE,GACrE,MAAMC,iBAAiB,CAACC,OAAgBb;IACtC,IAAIJ,OAAOiB;IACX,IAAK,IAAIV,QAAQ,GAAGA,QAAQH,IAAIK,MAAM,EAAEF,QAAS;QAC/C,MAAMW,OAAOd,GAAG,CAACG,MAAM;QACvB,IAAIP,QAAQ,QAAQ,OAAOA,SAAS,YAAYkB,QAAQlB,MAAM;YAC5DA,OAA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