@expo/cli 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +10 -3
- package/build/bin/cli.map +1 -1
- package/build/src/api/user/actions.js +1 -1
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/export/createMetadataJson.js +2 -1
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +50 -3
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/xcodeCompilerLogger.js +97 -0
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -0
- package/build/src/export/exportApp.js +90 -103
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +18 -23
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportAsync.js +1 -1
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/exportHermes.js +0 -90
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +137 -108
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +12 -4
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +74 -49
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +1 -1
- package/build/src/export/metroAssetLocalPath.js.map +1 -1
- package/build/src/export/persistMetroAssets.js +28 -17
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/publicFolder.js +7 -0
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/saveAssets.js +176 -12
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/writeContents.js +8 -107
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/installAsync.js +29 -10
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +9 -2
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/run/hints.js +4 -0
- package/build/src/run/hints.js.map +1 -1
- package/build/src/run/index.js +101 -0
- package/build/src/run/index.js.map +1 -0
- package/build/src/start/doctor/dependencies/bundledNativeModules.js +2 -2
- package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +10 -3
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/resolvePackages.js +66 -0
- package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -0
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +2 -30
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +24 -8
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +8 -4
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +39 -16
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +6 -2
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +18 -1
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/bundleApiRoutes.js +3 -2
- package/build/src/start/server/metro/bundleApiRoutes.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +22 -5
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
- package/build/src/start/server/metro/createJResolver.js +5 -2
- package/build/src/start/server/metro/createJResolver.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js +2 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/{inspector-proxy/device.js → debugging/InspectorDevice.js} +8 -38
- package/build/src/start/server/metro/debugging/InspectorDevice.js.map +1 -0
- package/build/src/start/server/metro/debugging/InspectorProxy.js +116 -0
- package/build/src/start/server/metro/debugging/InspectorProxy.js.map +1 -0
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +45 -0
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/NetworkResponse.js +3 -4
- package/build/src/start/server/metro/debugging/inspectorHandlers/NetworkResponse.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/PageReload.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerGetPossibleBreakpoints.js +2 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerScriptParsed.js +3 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerScriptParsed.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerSetBreakpointByUrl.js +3 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerSetBreakpointByUrl.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeRuntimeCallFunctionOn.js +2 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeCallFunctionOn.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeRuntimeGetProperties.js +5 -4
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeGetProperties.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/types.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js +20 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js.map +1 -0
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +8 -5
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +3 -2
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/router.js +1 -5
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +0 -19
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +20 -4
- package/build/src/start/server/metro/serializeHtml.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +48 -85
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +12 -5
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +22 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +62 -9
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/route.test.js +11 -3
- package/build/src/start/server/type-generation/__typetests__/route.test.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +6 -4
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/codesigning.js +11 -1
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/env.js +7 -1
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js +3 -11
- package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -1
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +22 -12
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -1
- package/package.json +10 -10
- package/static/template/index.html +14 -95
- package/build/src/export/printBundleSizes.js +0 -101
- package/build/src/export/printBundleSizes.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/device.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/NetworkResponse.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/PageReload.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerScriptParsed.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerSetBreakpointByUrl.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeGetProperties.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/types.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/utils.js +0 -11
- package/build/src/start/server/metro/inspector-proxy/handlers/utils.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/index.js +0 -30
- package/build/src/start/server/metro/inspector-proxy/index.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/proxy.js +0 -169
- package/build/src/start/server/metro/inspector-proxy/proxy.js.map +0 -1
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +0 -64
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +0 -1
- /package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/PageReload.js +0 -0
- /package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/types.js +0 -0
package/build/bin/cli
CHANGED
|
@@ -40,6 +40,11 @@ const defaultCmd = "start";
|
|
|
40
40
|
const commands = {
|
|
41
41
|
// Add a new command here
|
|
42
42
|
// NOTE(EvanBacon): Ensure every bundler-related command sets `NODE_ENV` as expected for the command.
|
|
43
|
+
run: ()=>Promise.resolve().then(function() {
|
|
44
|
+
return _interopRequireWildcard(require("../src/run/index.js"));
|
|
45
|
+
}).then((i)=>i.expoRun
|
|
46
|
+
)
|
|
47
|
+
,
|
|
43
48
|
"run:ios": ()=>Promise.resolve().then(function() {
|
|
44
49
|
return _interopRequireWildcard(require("../src/run/ios/index.js"));
|
|
45
50
|
}).then((i)=>i.expoRunIos
|
|
@@ -132,7 +137,7 @@ const args = (0, _arg).default({
|
|
|
132
137
|
});
|
|
133
138
|
if (args["--version"]) {
|
|
134
139
|
// Version is added in the build script.
|
|
135
|
-
console.log("0.
|
|
140
|
+
console.log("0.16.0");
|
|
136
141
|
process.exit(0);
|
|
137
142
|
}
|
|
138
143
|
if (args["--non-interactive"]) {
|
|
@@ -145,7 +150,9 @@ if (!isSubcommand && args["--help"]) {
|
|
|
145
150
|
const { login , logout , whoami , register , start , install , add , export: _export , config , customize , prebuild , "run:ios": runIos , "run:android": runAndroid , // NOTE(EvanBacon): Don't document this command as it's a temporary
|
|
146
151
|
// workaround until we can use `expo export` for all production bundling.
|
|
147
152
|
// https://github.com/expo/expo/pull/21396/files#r1121025873
|
|
148
|
-
"export:embed": exportEmbed_unused ,
|
|
153
|
+
"export:embed": exportEmbed_unused , // Other ignored commands, these are intentially not listed in the `--help` output
|
|
154
|
+
run: _run , // All other commands
|
|
155
|
+
...others } = commands;
|
|
149
156
|
console.log(_chalk.default`
|
|
150
157
|
{bold Usage}
|
|
151
158
|
{dim $} npx expo <command>
|
|
@@ -264,7 +271,7 @@ commands[command]().then((exec)=>{
|
|
|
264
271
|
logEventAsync("action", {
|
|
265
272
|
action: `expo ${command}`,
|
|
266
273
|
source: "expo/cli",
|
|
267
|
-
source_version: "0.
|
|
274
|
+
source_version: "0.16.0"
|
|
268
275
|
});
|
|
269
276
|
}
|
|
270
277
|
});
|
package/build/bin/cli.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport arg from 'arg';\nimport chalk from 'chalk';\nimport Debug from 'debug';\nimport { boolish } from 'getenv';\n\n// Setup before requiring `debug`.\nif (boolish('EXPO_DEBUG', false)) {\n Debug.enable('expo:*');\n} else if (Debug.enabled('expo:')) {\n process.env.EXPO_DEBUG = '1';\n}\n\nconst defaultCmd = 'start';\n\nexport type Command = (argv?: string[]) => void;\n\nconst commands: { [command: string]: () => Promise<Command> } = {\n // Add a new command here\n // NOTE(EvanBacon): Ensure every bundler-related command sets `NODE_ENV` as expected for the command.\n 'run:ios': () => import('../src/run/ios/index.js').then((i) => i.expoRunIos),\n 'run:android': () => import('../src/run/android/index.js').then((i) => i.expoRunAndroid),\n start: () => import('../src/start/index.js').then((i) => i.expoStart),\n prebuild: () => import('../src/prebuild/index.js').then((i) => i.expoPrebuild),\n config: () => import('../src/config/index.js').then((i) => i.expoConfig),\n export: () => import('../src/export/index.js').then((i) => i.expoExport),\n 'export:web': () => import('../src/export/web/index.js').then((i) => i.expoExportWeb),\n 'export:embed': () => import('../src/export/embed/index.js').then((i) => i.expoExportEmbed),\n\n // Auxiliary commands\n install: () => import('../src/install/index.js').then((i) => i.expoInstall),\n add: () => import('../src/install/index.js').then((i) => i.expoInstall),\n customize: () => import('../src/customize/index.js').then((i) => i.expoCustomize),\n\n // Auth\n login: () => import('../src/login/index.js').then((i) => i.expoLogin),\n logout: () => import('../src/logout/index.js').then((i) => i.expoLogout),\n register: () => import('../src/register/index.js').then((i) => i.expoRegister),\n whoami: () => import('../src/whoami/index.js').then((i) => i.expoWhoami),\n};\n\nconst args = arg(\n {\n // Types\n '--version': Boolean,\n '--help': Boolean,\n // NOTE(EvanBacon): This is here to silence warnings from processes that\n // expect the global expo-cli.\n '--non-interactive': Boolean,\n\n // Aliases\n '-v': '--version',\n '-h': '--help',\n },\n {\n permissive: true,\n }\n);\n\nif (args['--version']) {\n // Version is added in the build script.\n console.log(process.env.__EXPO_VERSION);\n process.exit(0);\n}\n\nif (args['--non-interactive']) {\n console.warn(chalk.yellow` {bold --non-interactive} is not supported, use {bold $CI=1} instead`);\n}\n\n// Check if we are running `npx expo <subcommand>` or `npx expo`\nconst isSubcommand = Boolean(commands[args._[0]]);\n\n// Handle `--help` flag\nif (!isSubcommand && args['--help']) {\n const {\n login,\n logout,\n whoami,\n register,\n start,\n install,\n add,\n export: _export,\n config,\n customize,\n prebuild,\n 'run:ios': runIos,\n 'run:android': runAndroid,\n // NOTE(EvanBacon): Don't document this command as it's a temporary\n // workaround until we can use `expo export` for all production bundling.\n // https://github.com/expo/expo/pull/21396/files#r1121025873\n 'export:embed': exportEmbed_unused,\n ...others\n } = commands;\n\n console.log(chalk`\n {bold Usage}\n {dim $} npx expo <command>\n\n {bold Commands}\n ${Object.keys({ start, export: _export, ...others }).join(', ')}\n ${Object.keys({ 'run:ios': runIos, 'run:android': runAndroid, prebuild }).join(', ')}\n ${Object.keys({ install, customize, config }).join(', ')}\n {dim ${Object.keys({ login, logout, whoami, register }).join(', ')}}\n\n {bold Options}\n --version, -v Version number\n --help, -h Usage info\n\n For more info run a command with the {bold --help} flag\n {dim $} npx expo start --help\n`);\n\n process.exit(0);\n}\n\n// NOTE(EvanBacon): Squat some directory names to help with migration,\n// users can still use folders named \"send\" or \"eject\" by using the fully qualified `npx expo start ./send`.\nif (!isSubcommand) {\n const migrationMap: Record<string, string> = {\n init: 'npx create-expo-app',\n eject: 'npx expo prebuild',\n web: 'npx expo start --web',\n 'start:web': 'npx expo start --web',\n 'build:ios': 'eas build -p ios',\n 'build:android': 'eas build -p android',\n 'client:install:ios': 'npx expo start --ios',\n 'client:install:android': 'npx expo start --android',\n doctor: 'npx expo-doctor',\n upgrade: 'https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough/',\n 'customize:web': 'npx expo customize',\n\n publish: 'eas update',\n 'publish:set': 'eas update',\n 'publish:rollback': 'eas update',\n 'publish:history': 'eas update',\n 'publish:details': 'eas update',\n\n 'build:web': 'npx expo export:web',\n\n 'credentials:manager': `eas credentials`,\n 'fetch:ios:certs': `eas credentials`,\n 'fetch:android:keystore': `eas credentials`,\n 'fetch:android:hashes': `eas credentials`,\n 'fetch:android:upload-cert': `eas credentials`,\n 'push:android:upload': `eas credentials`,\n 'push:android:show': `eas credentials`,\n 'push:android:clear': `eas credentials`,\n url: `eas build:list`,\n 'url:ipa': `eas build:list`,\n 'url:apk': `eas build:list`,\n webhooks: `eas webhook`,\n 'webhooks:add': `eas webhook:create`,\n 'webhooks:remove': `eas webhook:delete`,\n 'webhooks:update': `eas webhook:update`,\n\n 'build:status': `eas build:list`,\n 'upload:android': `eas submit -p android`,\n 'upload:ios': `eas submit -p ios`,\n };\n\n // TODO: Log telemetry about invalid command used.\n const subcommand = args._[0];\n if (subcommand in migrationMap) {\n const replacement = migrationMap[subcommand];\n console.log();\n const instruction = subcommand === 'upgrade' ? 'follow this guide' : 'use'\n console.log(\n chalk.yellow` {gray $} {bold expo ${subcommand}} is not supported in the local CLI, please ${instruction} {bold ${replacement}} instead`\n );\n console.log();\n process.exit(1);\n }\n const deprecated = ['send', 'client:ios'];\n if (deprecated.includes(subcommand)) {\n console.log();\n console.log(chalk.yellow` {gray $} {bold expo ${subcommand}} is deprecated`);\n console.log();\n process.exit(1);\n }\n}\n\nconst command = isSubcommand ? args._[0] : defaultCmd;\nconst commandArgs = isSubcommand ? args._.slice(1) : args._;\n\n// Push the help flag to the subcommand args.\nif (args['--help']) {\n commandArgs.push('--help');\n}\n\n// Install exit hooks\nprocess.on('SIGINT', () => process.exit(0));\nprocess.on('SIGTERM', () => process.exit(0));\n\ncommands[command]().then((exec) => {\n exec(commandArgs);\n\n if (!boolish('EXPO_NO_TELEMETRY', false)) {\n // NOTE(EvanBacon): Track some basic telemetry events indicating the command\n // that was run. This can be disabled with the $EXPO_NO_TELEMETRY environment variable.\n // We do this to determine how well deprecations are going before removing a command.\n const { logEventAsync } =\n require('../src/utils/analytics/rudderstackClient') as typeof import('../src/utils/analytics/rudderstackClient');\n logEventAsync('action', {\n action: `expo ${command}`,\n source: 'expo/cli',\n source_version: process.env.__EXPO_VERSION,\n });\n }\n});\n"],"names":["boolish","Debug","enable","enabled","process","env","EXPO_DEBUG","defaultCmd","commands","then","i","expoRunIos","expoRunAndroid","start","expoStart","prebuild","expoPrebuild","config","expoConfig","export","expoExport","expoExportWeb","expoExportEmbed","install","expoInstall","add","customize","expoCustomize","login","expoLogin","logout","expoLogout","register","expoRegister","whoami","expoWhoami","args","arg","Boolean","permissive","console","log","__EXPO_VERSION","exit","warn","chalk","yellow","isSubcommand","_","_export","runIos","runAndroid","exportEmbed_unused","others","Object","keys","join","migrationMap","init","eject","web","doctor","upgrade","publish","url","webhooks","subcommand","replacement","instruction","deprecated","includes","command","commandArgs","slice","push","on","exec","logEventAsync","require","action","source","source_version"],"mappings":"AAAA;;AACgB,IAAA,IAAK,kCAAL,KAAK,EAAA;AACH,IAAA,MAAO,kCAAP,OAAO,EAAA;AACP,IAAA,MAAO,kCAAP,OAAO,EAAA;AACD,IAAA,OAAQ,WAAR,QAAQ,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhC,kCAAkC;AAClC,IAAIA,CAAAA,GAAAA,OAAO,AAAqB,CAAA,QAArB,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE;IAChCC,MAAK,QAAA,CAACC,MAAM,CAAC,QAAQ,CAAC,CAAC;CACxB,MAAM,IAAID,MAAK,QAAA,CAACE,OAAO,CAAC,OAAO,CAAC,EAAE;IACjCC,OAAO,CAACC,GAAG,CAACC,UAAU,GAAG,GAAG,CAAC;CAC9B;AAED,MAAMC,UAAU,GAAG,OAAO,AAAC;AAI3B,MAAMC,QAAQ,GAAkD;IAC9D,yBAAyB;IACzB,qGAAqG;IACrG,SAAS,EAAE,IAAM;mDAAO,yBAAyB;UAAC,CAACC,IAAI,CAAC,CAACC,CAAC,GAAKA,CAAC,CAACC,UAAU;QAAA,CAAC;IAAA;IAC5E,aAAa,EAAE,IAAM;mDAAO,6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AW,CAACE,IAAI,CAAC,QAAQ,CAAC,CAAC;CAC5B;AAED,qBAAqB;AACrBtE,OAAO,CAACuE,EAAE,CAAC,QAAQ,EAAE,IAAMvE,OAAO,CAACuC,IAAI,CAAC,CAAC,CAAC;AAAA,CAAC,CAAC;AAC5CvC,OAAO,CAACuE,EAAE,CAAC,SAAS,EAAE,IAAMvE,OAAO,CAACuC,IAAI,CAAC,CAAC,CAAC;AAAA,CAAC,CAAC;AAE7CnC,QAAQ,CAAC+D,OAAO,CAAC,EAAE,CAAC9D,IAAI,CAAC,CAACmE,IAAI,GAAK;IACjCA,IAAI,CAACJ,WAAW,CAAC,CAAC;IAElB,IAAI,CAACxE,CAAAA,GAAAA,OAAO,AAA4B,CAAA,QAA5B,CAAC,mBAAmB,EAAE,KAAK,CAAC,EAAE;QACxC,4EAA4E;QAC5E,uFAAuF;QACvF,qFAAqF;QACrF,MAAM,EAAE6E,aAAa,CAAA,EAAE,GACrBC,OAAO,CAAC,0CAA0C,CAAC,AAA6D,AAAC;QACnHD,aAAa,CAAC,QAAQ,EAAE;YACtBE,MAAM,EAAE,CAAC,KAAK,EAAER,OAAO,CAAC,CAAC;YACzBS,MAAM,EAAE,UAAU;YAClBC,cAAc,EAAE7E,OAAO,CAACC,GAAG,CAACqC,cAAc;SAC3C,CAAC,CAAC;KACJ;CACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../bin/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport arg from 'arg';\nimport chalk from 'chalk';\nimport Debug from 'debug';\nimport { boolish } from 'getenv';\n\n// Setup before requiring `debug`.\nif (boolish('EXPO_DEBUG', false)) {\n Debug.enable('expo:*');\n} else if (Debug.enabled('expo:')) {\n process.env.EXPO_DEBUG = '1';\n}\n\nconst defaultCmd = 'start';\n\nexport type Command = (argv?: string[]) => void;\n\nconst commands: { [command: string]: () => Promise<Command> } = {\n // Add a new command here\n // NOTE(EvanBacon): Ensure every bundler-related command sets `NODE_ENV` as expected for the command.\n run: () => import('../src/run/index.js').then((i) => i.expoRun),\n 'run:ios': () => import('../src/run/ios/index.js').then((i) => i.expoRunIos),\n 'run:android': () => import('../src/run/android/index.js').then((i) => i.expoRunAndroid),\n start: () => import('../src/start/index.js').then((i) => i.expoStart),\n prebuild: () => import('../src/prebuild/index.js').then((i) => i.expoPrebuild),\n config: () => import('../src/config/index.js').then((i) => i.expoConfig),\n export: () => import('../src/export/index.js').then((i) => i.expoExport),\n 'export:web': () => import('../src/export/web/index.js').then((i) => i.expoExportWeb),\n 'export:embed': () => import('../src/export/embed/index.js').then((i) => i.expoExportEmbed),\n\n // Auxiliary commands\n install: () => import('../src/install/index.js').then((i) => i.expoInstall),\n add: () => import('../src/install/index.js').then((i) => i.expoInstall),\n customize: () => import('../src/customize/index.js').then((i) => i.expoCustomize),\n\n // Auth\n login: () => import('../src/login/index.js').then((i) => i.expoLogin),\n logout: () => import('../src/logout/index.js').then((i) => i.expoLogout),\n register: () => import('../src/register/index.js').then((i) => i.expoRegister),\n whoami: () => import('../src/whoami/index.js').then((i) => i.expoWhoami),\n};\n\nconst args = arg(\n {\n // Types\n '--version': Boolean,\n '--help': Boolean,\n // NOTE(EvanBacon): This is here to silence warnings from processes that\n // expect the global expo-cli.\n '--non-interactive': Boolean,\n\n // Aliases\n '-v': '--version',\n '-h': '--help',\n },\n {\n permissive: true,\n }\n);\n\nif (args['--version']) {\n // Version is added in the build script.\n console.log(process.env.__EXPO_VERSION);\n process.exit(0);\n}\n\nif (args['--non-interactive']) {\n console.warn(chalk.yellow` {bold --non-interactive} is not supported, use {bold $CI=1} instead`);\n}\n\n// Check if we are running `npx expo <subcommand>` or `npx expo`\nconst isSubcommand = Boolean(commands[args._[0]]);\n\n// Handle `--help` flag\nif (!isSubcommand && args['--help']) {\n const {\n login,\n logout,\n whoami,\n register,\n start,\n install,\n add,\n export: _export,\n config,\n customize,\n prebuild,\n 'run:ios': runIos,\n 'run:android': runAndroid,\n // NOTE(EvanBacon): Don't document this command as it's a temporary\n // workaround until we can use `expo export` for all production bundling.\n // https://github.com/expo/expo/pull/21396/files#r1121025873\n 'export:embed': exportEmbed_unused,\n // Other ignored commands, these are intentially not listed in the `--help` output\n run: _run,\n // All other commands\n ...others\n } = commands;\n\n console.log(chalk`\n {bold Usage}\n {dim $} npx expo <command>\n\n {bold Commands}\n ${Object.keys({ start, export: _export, ...others }).join(', ')}\n ${Object.keys({ 'run:ios': runIos, 'run:android': runAndroid, prebuild }).join(', ')}\n ${Object.keys({ install, customize, config }).join(', ')}\n {dim ${Object.keys({ login, logout, whoami, register }).join(', ')}}\n\n {bold Options}\n --version, -v Version number\n --help, -h Usage info\n\n For more info run a command with the {bold --help} flag\n {dim $} npx expo start --help\n`);\n\n process.exit(0);\n}\n\n// NOTE(EvanBacon): Squat some directory names to help with migration,\n// users can still use folders named \"send\" or \"eject\" by using the fully qualified `npx expo start ./send`.\nif (!isSubcommand) {\n const migrationMap: Record<string, string> = {\n init: 'npx create-expo-app',\n eject: 'npx expo prebuild',\n web: 'npx expo start --web',\n 'start:web': 'npx expo start --web',\n 'build:ios': 'eas build -p ios',\n 'build:android': 'eas build -p android',\n 'client:install:ios': 'npx expo start --ios',\n 'client:install:android': 'npx expo start --android',\n doctor: 'npx expo-doctor',\n upgrade: 'https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough/',\n 'customize:web': 'npx expo customize',\n\n publish: 'eas update',\n 'publish:set': 'eas update',\n 'publish:rollback': 'eas update',\n 'publish:history': 'eas update',\n 'publish:details': 'eas update',\n\n 'build:web': 'npx expo export:web',\n\n 'credentials:manager': `eas credentials`,\n 'fetch:ios:certs': `eas credentials`,\n 'fetch:android:keystore': `eas credentials`,\n 'fetch:android:hashes': `eas credentials`,\n 'fetch:android:upload-cert': `eas credentials`,\n 'push:android:upload': `eas credentials`,\n 'push:android:show': `eas credentials`,\n 'push:android:clear': `eas credentials`,\n url: `eas build:list`,\n 'url:ipa': `eas build:list`,\n 'url:apk': `eas build:list`,\n webhooks: `eas webhook`,\n 'webhooks:add': `eas webhook:create`,\n 'webhooks:remove': `eas webhook:delete`,\n 'webhooks:update': `eas webhook:update`,\n\n 'build:status': `eas build:list`,\n 'upload:android': `eas submit -p android`,\n 'upload:ios': `eas submit -p ios`,\n };\n\n // TODO: Log telemetry about invalid command used.\n const subcommand = args._[0];\n if (subcommand in migrationMap) {\n const replacement = migrationMap[subcommand];\n console.log();\n const instruction = subcommand === 'upgrade' ? 'follow this guide' : 'use'\n console.log(\n chalk.yellow` {gray $} {bold expo ${subcommand}} is not supported in the local CLI, please ${instruction} {bold ${replacement}} instead`\n );\n console.log();\n process.exit(1);\n }\n const deprecated = ['send', 'client:ios'];\n if (deprecated.includes(subcommand)) {\n console.log();\n console.log(chalk.yellow` {gray $} {bold expo ${subcommand}} is deprecated`);\n console.log();\n process.exit(1);\n }\n}\n\nconst command = isSubcommand ? args._[0] : defaultCmd;\nconst commandArgs = isSubcommand ? args._.slice(1) : args._;\n\n// Push the help flag to the subcommand args.\nif (args['--help']) {\n commandArgs.push('--help');\n}\n\n// Install exit hooks\nprocess.on('SIGINT', () => process.exit(0));\nprocess.on('SIGTERM', () => process.exit(0));\n\ncommands[command]().then((exec) => {\n exec(commandArgs);\n\n if (!boolish('EXPO_NO_TELEMETRY', false)) {\n // NOTE(EvanBacon): Track some basic telemetry events indicating the command\n // that was run. This can be disabled with the $EXPO_NO_TELEMETRY environment variable.\n // We do this to determine how well deprecations are going before removing a command.\n const { logEventAsync } =\n require('../src/utils/analytics/rudderstackClient') as typeof import('../src/utils/analytics/rudderstackClient');\n logEventAsync('action', {\n action: `expo ${command}`,\n source: 'expo/cli',\n source_version: process.env.__EXPO_VERSION,\n });\n }\n});\n"],"names":["boolish","Debug","enable","enabled","process","env","EXPO_DEBUG","defaultCmd","commands","run","then","i","expoRun","expoRunIos","expoRunAndroid","start","expoStart","prebuild","expoPrebuild","config","expoConfig","export","expoExport","expoExportWeb","expoExportEmbed","install","expoInstall","add","customize","expoCustomize","login","expoLogin","logout","expoLogout","register","expoRegister","whoami","expoWhoami","args","arg","Boolean","permissive","console","log","__EXPO_VERSION","exit","warn","chalk","yellow","isSubcommand","_","_export","runIos","runAndroid","exportEmbed_unused","_run","others","Object","keys","join","migrationMap","init","eject","web","doctor","upgrade","publish","url","webhooks","subcommand","replacement","instruction","deprecated","includes","command","commandArgs","slice","push","on","exec","logEventAsync","require","action","source","source_version"],"mappings":"AAAA;;AACgB,IAAA,IAAK,kCAAL,KAAK,EAAA;AACH,IAAA,MAAO,kCAAP,OAAO,EAAA;AACP,IAAA,MAAO,kCAAP,OAAO,EAAA;AACD,IAAA,OAAQ,WAAR,QAAQ,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhC,kCAAkC;AAClC,IAAIA,CAAAA,GAAAA,OAAO,AAAqB,CAAA,QAArB,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE;IAChCC,MAAK,QAAA,CAACC,MAAM,CAAC,QAAQ,CAAC,CAAC;CACxB,MAAM,IAAID,MAAK,QAAA,CAACE,OAAO,CAAC,OAAO,CAAC,EAAE;IACjCC,OAAO,CAACC,GAAG,CAACC,UAAU,GAAG,GAAG,CAAC;CAC9B;AAED,MAAMC,UAAU,GAAG,OAAO,AAAC;AAI3B,MAAMC,QAAQ,GAAkD;IAC9D,yBAAyB;IACzB,qGAAqG;IACrGC,GAAG,EAAE,IAAM;mDAAO,qBAAqB;UAAC,CAACC,IAAI,CAAC,CAACC,CAAC,GAAKA,CAAC,CAACC,OAAO;QAAA,CAAC;IAAA;IAC/D,SAAS,EAAE,IAAM;mDAAO,yBAAyB;UAAC,CAACF,IAAI,CAAC,CAACC,CAAC,GAAKA,CAAC,CAACE,UAAU;QAAA,CAAC;IAAA;IAC5E,aAAa,EAAE,IAAM;mDAAO,6BAA6B;UAAC,CAACH,IAAI,CAAC,CAACC,CAAC,GAAKA,CAAC,CAACG,cAAc;QAAA,CAAC;IAAA;IACxFC,KAAK,EAAE,IAAM;mDAAO,uBAAuB;UA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zE,OAAO,CAAC0E,EAAE,CAAC,QAAQ,EAAE,IAAM1E,OAAO,CAACyC,IAAI,CAAC,CAAC,CAAC;AAAA,CAAC,CAAC;AAC5CzC,OAAO,CAAC0E,EAAE,CAAC,SAAS,EAAE,IAAM1E,OAAO,CAACyC,IAAI,CAAC,CAAC,CAAC;AAAA,CAAC,CAAC;AAE7CrC,QAAQ,CAACkE,OAAO,CAAC,EAAE,CAAChE,IAAI,CAAC,CAACqE,IAAI,GAAK;IACjCA,IAAI,CAACJ,WAAW,CAAC,CAAC;IAElB,IAAI,CAAC3E,CAAAA,GAAAA,OAAO,AAA4B,CAAA,QAA5B,CAAC,mBAAmB,EAAE,KAAK,CAAC,EAAE;QACxC,4EAA4E;QAC5E,uFAAuF;QACvF,qFAAqF;QACrF,MAAM,EAAEgF,aAAa,CAAA,EAAE,GACrBC,OAAO,CAAC,0CAA0C,CAAC,AAA6D,AAAC;QACnHD,aAAa,CAAC,QAAQ,EAAE;YACtBE,MAAM,EAAE,CAAC,KAAK,EAAER,OAAO,CAAC,CAAC;YACzBS,MAAM,EAAE,UAAU;YAClBC,cAAc,EAAEhF,OAAO,CAACC,GAAG,CAACuC,cAAc;SAC3C,CAAC,CAAC;KACJ;CACF,CAAC,CAAC"}
|
|
@@ -53,7 +53,7 @@ async function showLoginPromptAsync({ printNewLine =false , otp , ...options } =
|
|
|
53
53
|
await (0, _user).ssoLoginAsync();
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
Log.log(hasCredentials ? `Logging in to EAS with email or username (exit and run '
|
|
56
|
+
Log.log(hasCredentials ? `Logging in to EAS with email or username (exit and run 'npx expo login' for other options)` : `Log in to EAS with email or username (exit and run 'npx expo login' for other options)`);
|
|
57
57
|
let username = options.username;
|
|
58
58
|
let password = options.password;
|
|
59
59
|
if (!hasCredentials) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/api/user/actions.ts"],"sourcesContent":["import assert from 'assert';\nimport chalk from 'chalk';\n\nimport { retryUsernamePasswordAuthWithOTPAsync } from './otp';\nimport { Actor, getUserAsync, loginAsync, ssoLoginAsync } from './user';\nimport * as Log from '../../log';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { learnMore } from '../../utils/link';\nimport promptAsync, { Question } from '../../utils/prompts';\nimport { ApiV2Error } from '../rest/client';\n\n/** Show login prompt while prompting for missing credentials. */\nexport async function showLoginPromptAsync({\n printNewLine = false,\n otp,\n ...options\n}: {\n printNewLine?: boolean;\n username?: string;\n password?: string;\n otp?: string;\n sso?: boolean | undefined;\n} = {}): Promise<void> {\n if (env.EXPO_OFFLINE) {\n throw new CommandError('OFFLINE', 'Cannot authenticate in offline-mode');\n }\n const hasCredentials = options.username && options.password;\n const sso = options.sso;\n\n if (printNewLine) {\n Log.log();\n }\n\n if (sso) {\n await ssoLoginAsync();\n return;\n }\n\n Log.log(\n hasCredentials\n ? `Logging in to EAS with email or username (exit and run '
|
|
1
|
+
{"version":3,"sources":["../../../../src/api/user/actions.ts"],"sourcesContent":["import assert from 'assert';\nimport chalk from 'chalk';\n\nimport { retryUsernamePasswordAuthWithOTPAsync } from './otp';\nimport { Actor, getUserAsync, loginAsync, ssoLoginAsync } from './user';\nimport * as Log from '../../log';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { learnMore } from '../../utils/link';\nimport promptAsync, { Question } from '../../utils/prompts';\nimport { ApiV2Error } from '../rest/client';\n\n/** Show login prompt while prompting for missing credentials. */\nexport async function showLoginPromptAsync({\n printNewLine = false,\n otp,\n ...options\n}: {\n printNewLine?: boolean;\n username?: string;\n password?: string;\n otp?: string;\n sso?: boolean | undefined;\n} = {}): Promise<void> {\n if (env.EXPO_OFFLINE) {\n throw new CommandError('OFFLINE', 'Cannot authenticate in offline-mode');\n }\n const hasCredentials = options.username && options.password;\n const sso = options.sso;\n\n if (printNewLine) {\n Log.log();\n }\n\n if (sso) {\n await ssoLoginAsync();\n return;\n }\n\n Log.log(\n hasCredentials\n ? `Logging in to EAS with email or username (exit and run 'npx expo login' for other options)`\n : `Log in to EAS with email or username (exit and run 'npx expo login' for other options)`\n );\n\n let username = options.username;\n let password = options.password;\n\n if (!hasCredentials) {\n const resolved = await promptAsync(\n [\n !options.username && {\n type: 'text',\n name: 'username',\n message: 'Email or username',\n },\n !options.password && {\n type: 'password',\n name: 'password',\n message: 'Password',\n },\n ].filter(Boolean) as Question<string>[],\n {\n nonInteractiveHelp: `Use the EXPO_TOKEN environment variable to authenticate in CI (${learnMore(\n 'https://docs.expo.dev/accounts/programmatic-access/'\n )})`,\n }\n );\n username ??= resolved.username;\n password ??= resolved.password;\n }\n // This is just for the types.\n assert(username && password);\n\n try {\n await loginAsync({\n username,\n password,\n otp,\n });\n } catch (e) {\n if (e instanceof ApiV2Error && e.expoApiV2ErrorCode === 'ONE_TIME_PASSWORD_REQUIRED') {\n await retryUsernamePasswordAuthWithOTPAsync(\n username,\n password,\n e.expoApiV2ErrorMetadata as any\n );\n } else {\n throw e;\n }\n }\n}\n\n/** Ensure the user is logged in, if not, prompt to login. */\nexport async function ensureLoggedInAsync(): Promise<Actor> {\n let user = await getUserAsync().catch(() => null);\n\n if (!user) {\n Log.warn(chalk.yellow`An Expo user account is required to proceed.`);\n await showLoginPromptAsync({ printNewLine: true });\n user = await getUserAsync();\n }\n\n assert(user, 'User should be logged in');\n return user;\n}\n"],"names":["showLoginPromptAsync","ensureLoggedInAsync","Log","printNewLine","otp","options","env","EXPO_OFFLINE","CommandError","hasCredentials","username","password","sso","log","ssoLoginAsync","resolved","promptAsync","type","name","message","filter","Boolean","nonInteractiveHelp","learnMore","assert","loginAsync","e","ApiV2Error","expoApiV2ErrorCode","retryUsernamePasswordAuthWithOTPAsync","expoApiV2ErrorMetadata","user","getUserAsync","catch","warn","chalk","yellow"],"mappings":"AAAA;;;;QAasBA,oBAAoB,GAApBA,oBAAoB;QAiFpBC,mBAAmB,GAAnBA,mBAAmB;AA9FtB,IAAA,OAA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E,CAAA,aAAF,EAAE,CAACC,KAAK,CAAC,IAAM,IAAI;IAAA,CAAC,AAAC;IAElD,IAAI,CAACF,IAAI,EAAE;QACT7B,GAAG,CAACgC,IAAI,CAACC,MAAK,QAAA,CAACC,MAAM,CAAC,4CAA4C,CAAC,CAAC,CAAC;QACrE,MAAMpC,oBAAoB,CAAC;YAAEG,YAAY,EAAE,IAAI;SAAE,CAAC,CAAC;QACnD4B,IAAI,GAAG,MAAMC,CAAAA,GAAAA,KAAY,AAAE,CAAA,aAAF,EAAE,CAAC;KAC7B;IAEDR,CAAAA,GAAAA,OAAM,AAAkC,CAAA,QAAlC,CAACO,IAAI,EAAE,0BAA0B,CAAC,CAAC;IACzC,OAAOA,IAAI,CAAC;CACb"}
|
|
@@ -20,7 +20,8 @@ function createMetadataJson({ bundles , fileNames , embeddedHashSet }) {
|
|
|
20
20
|
...metadata,
|
|
21
21
|
[platform]: {
|
|
22
22
|
// Get the filename for each platform's bundle.
|
|
23
|
-
|
|
23
|
+
// TODO: Add multi-bundle support to EAS Update!!
|
|
24
|
+
bundle: fileNames[platform][0],
|
|
24
25
|
// Collect all of the assets and convert them to the serial format.
|
|
25
26
|
assets: bundle.assets.filter((asset)=>!embeddedHashSet || !embeddedHashSet.has(asset.hash)
|
|
26
27
|
).map((asset)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import path from 'path';\n\nimport { BundleOutput } from './fork-bundleAsync';\n\nexport type BundlePlatform = 'android' | 'ios';\n\ntype PlatformMetadataAsset = { path: string; ext: string };\n\ntype PlatformMetadata = { bundle: string; assets: PlatformMetadataAsset[] };\n\ntype FileMetadata = {\n [key in BundlePlatform]: PlatformMetadata;\n};\n\nexport function createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n}: {\n bundles: Partial<Record<BundlePlatform, Pick<BundleOutput, 'assets'>>>;\n fileNames: Record<string, string
|
|
1
|
+
{"version":3,"sources":["../../../src/export/createMetadataJson.ts"],"sourcesContent":["import path from 'path';\n\nimport { BundleOutput } from './fork-bundleAsync';\n\nexport type BundlePlatform = 'android' | 'ios';\n\ntype PlatformMetadataAsset = { path: string; ext: string };\n\ntype PlatformMetadata = { bundle: string; assets: PlatformMetadataAsset[] };\n\ntype FileMetadata = {\n [key in BundlePlatform]: PlatformMetadata;\n};\n\nexport function createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n}: {\n bundles: Partial<Record<BundlePlatform, Pick<BundleOutput, 'assets'>>>;\n fileNames: Record<string, string[]>;\n embeddedHashSet?: Set<string>;\n}): {\n version: 0;\n bundler: 'metro';\n fileMetadata: FileMetadata;\n} {\n // Build metadata.json\n return {\n version: 0,\n bundler: 'metro',\n fileMetadata: Object.entries(bundles).reduce<Record<string, Partial<PlatformMetadata>>>(\n (metadata, [platform, bundle]) => {\n if (platform === 'web') return metadata;\n\n return {\n ...metadata,\n [platform]: {\n // Get the filename for each platform's bundle.\n // TODO: Add multi-bundle support to EAS Update!!\n bundle: fileNames[platform][0],\n // Collect all of the assets and convert them to the serial format.\n assets: bundle.assets\n .filter((asset) => !embeddedHashSet || !embeddedHashSet.has(asset.hash))\n .map(\n (asset) =>\n // Each asset has multiple hashes which we convert and then flatten.\n asset.fileHashes?.map((hash) => ({\n path: path.join('assets', hash),\n ext: asset.type,\n }))\n )\n .filter(Boolean)\n .flat(),\n },\n };\n },\n {}\n ) as FileMetadata,\n };\n}\n"],"names":["createMetadataJson","bundles","fileNames","embeddedHashSet","version","bundler","fileMetadata","Object","entries","reduce","metadata","platform","bundle","assets","filter","asset","has","hash","map","fileHashes","path","join","ext","type","Boolean","flat"],"mappings":"AAAA;;;;QAcgBA,kBAAkB,GAAlBA,kBAAkB;AAdjB,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAchB,SAASA,kBAAkB,CAAC,EACjCC,OAAO,CAAA,EACPC,SAAS,CAAA,EACTC,eAAe,CAAA,EAKhB,EAIC;IACA,sBAAsB;IACtB,OAAO;QACLC,OAAO,EAAE,CAAC;QACVC,OAAO,EAAE,OAAO;QAChBC,YAAY,EAAEC,MAAM,CAACC,OAAO,CAACP,OAAO,CAAC,CAACQ,MAAM,CAC1C,CAACC,QAAQ,EAAE,CAACC,QAAQ,EAAEC,MAAM,CAAC,GAAK;YAChC,IAAID,QAAQ,KAAK,KAAK,EAAE,OAAOD,QAAQ,CAAC;YAExC,OAAO;gBACL,GAAGA,QAAQ;gBACX,CAACC,QAAQ,CAAC,EAAE;oBACV,+CAA+C;oBAC/C,iDAAiD;oBACjDC,MAAM,EAAEV,SAAS,CAACS,QAAQ,CAAC,CAAC,CAAC,CAAC;oBAC9B,mEAAmE;oBACnEE,MAAM,EAAED,MAAM,CAACC,MAAM,CAClBC,MAAM,CAAC,CAACC,KAAK,GAAK,CAACZ,eAAe,IAAI,CAACA,eAAe,CAACa,GAAG,CAACD,KAAK,CAACE,IAAI,CAAC;oBAAA,CAAC,CACvEC,GAAG,CACF,CAACH,KAAK;4BACJ,oEAAoE;wBACpEA,GAAgB;wBAAhBA,OAAAA,CAAAA,GAAgB,GAAhBA,KAAK,CAACI,UAAU,SAAK,GAArBJ,KAAAA,CAAqB,GAArBA,GAAgB,CAAEG,GAAG,CAAC,CAACD,IAAI,GAAK,CAAC;gCAC/BG,IAAI,EAAEA,KAAI,QAAA,CAACC,IAAI,CAAC,QAAQ,EAAEJ,IAAI,CAAC;gCAC/BK,GAAG,EAAEP,KAAK,CAACQ,IAAI;6BAChB,CAAC;wBAAA,CAAC,CAAA;qBAAA,CACN,CACAT,MAAM,CAACU,OAAO,CAAC,CACfC,IAAI,EAAE;iBACV;aACF,CAAC;SACH,EACD,EAAE,CACH;KACF,CAAC;CACH"}
|
|
@@ -6,12 +6,16 @@ exports.exportEmbedAsync = exportEmbedAsync;
|
|
|
6
6
|
exports.exportEmbedBundleAsync = exportEmbedBundleAsync;
|
|
7
7
|
var _config = require("@expo/config");
|
|
8
8
|
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
+
var _glob = require("glob");
|
|
9
10
|
var _server = _interopRequireDefault(require("metro/src/Server"));
|
|
10
11
|
var _bundle = _interopRequireDefault(require("metro/src/shared/output/bundle"));
|
|
11
12
|
var _path = _interopRequireDefault(require("path"));
|
|
13
|
+
var _xcodeCompilerLogger = require("./xcodeCompilerLogger");
|
|
12
14
|
var _log = require("../../log");
|
|
13
15
|
var _instantiateMetro = require("../../start/server/metro/instantiateMetro");
|
|
14
16
|
var _metroOptions = require("../../start/server/middleware/metroOptions");
|
|
17
|
+
var _ansi = require("../../utils/ansi");
|
|
18
|
+
var _dir = require("../../utils/dir");
|
|
15
19
|
var _nodeEnv = require("../../utils/nodeEnv");
|
|
16
20
|
var _profile = require("../../utils/profile");
|
|
17
21
|
var _exportHermes = require("../exportHermes");
|
|
@@ -22,9 +26,36 @@ function _interopRequireDefault(obj) {
|
|
|
22
26
|
default: obj
|
|
23
27
|
};
|
|
24
28
|
}
|
|
29
|
+
const debug = require("debug")("expo:export:embed");
|
|
30
|
+
function guessCopiedAppleBundlePath(bundleOutput) {
|
|
31
|
+
// Ensure the path is familiar before guessing.
|
|
32
|
+
if (!bundleOutput.match(/\/Xcode\/DerivedData\/.*\/Build\/Products\//)) {
|
|
33
|
+
debug("Bundling to non-standard location:", bundleOutput);
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
const bundleName = _path.default.basename(bundleOutput);
|
|
37
|
+
const bundleParent = _path.default.dirname(bundleOutput);
|
|
38
|
+
const possiblePath = (0, _glob).sync(_path.default.join(bundleParent, `*.app/${bundleName}`), {
|
|
39
|
+
// bundle identifiers can start with dots.
|
|
40
|
+
dot: true
|
|
41
|
+
})[0];
|
|
42
|
+
debug("Possible path for previous bundle:", possiblePath);
|
|
43
|
+
return possiblePath;
|
|
44
|
+
}
|
|
25
45
|
async function exportEmbedAsync(projectRoot, options) {
|
|
26
46
|
(0, _nodeEnv).setNodeEnv(options.dev ? "development" : "production");
|
|
27
47
|
require("@expo/env").load(projectRoot);
|
|
48
|
+
// Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.
|
|
49
|
+
await (0, _dir).removeAsync(options.bundleOutput);
|
|
50
|
+
// The iOS bundle is copied in to the Xcode project, so we need to remove the old one
|
|
51
|
+
// to prevent Xcode from loading the old one after a build failure.
|
|
52
|
+
if (options.platform === "ios") {
|
|
53
|
+
const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);
|
|
54
|
+
if (previousPath && _fs.default.existsSync(previousPath)) {
|
|
55
|
+
debug("Removing previous iOS bundle:", previousPath);
|
|
56
|
+
await (0, _dir).removeAsync(previousPath);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
28
59
|
const { bundle , assets } = await exportEmbedBundleAsync(projectRoot, options);
|
|
29
60
|
_fs.default.mkdirSync(_path.default.dirname(options.bundleOutput), {
|
|
30
61
|
recursive: true,
|
|
@@ -49,7 +80,7 @@ async function exportEmbedBundleAsync(projectRoot, options) {
|
|
|
49
80
|
// TODO: This is slow ~40ms
|
|
50
81
|
const { config } = await (0, _instantiateMetro).loadMetroConfigAsync(projectRoot, {
|
|
51
82
|
maxWorkers: options.maxWorkers,
|
|
52
|
-
resetCache:
|
|
83
|
+
resetCache: false,
|
|
53
84
|
config: options.config
|
|
54
85
|
}, {
|
|
55
86
|
exp,
|
|
@@ -62,13 +93,13 @@ async function exportEmbedBundleAsync(projectRoot, options) {
|
|
|
62
93
|
}
|
|
63
94
|
const bundleRequest = {
|
|
64
95
|
..._server.default.DEFAULT_BUNDLE_OPTIONS,
|
|
65
|
-
...(0, _metroOptions).
|
|
96
|
+
...(0, _metroOptions).getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {
|
|
66
97
|
mainModuleName: options.entryFile,
|
|
67
98
|
platform: options.platform,
|
|
68
99
|
minify: options.minify,
|
|
69
100
|
mode: options.dev ? "development" : "production",
|
|
70
101
|
engine: isHermes ? "hermes" : undefined,
|
|
71
|
-
|
|
102
|
+
isExporting: true
|
|
72
103
|
}),
|
|
73
104
|
sourceMapUrl,
|
|
74
105
|
unstable_transformProfile: options.unstableTransformProfile || (isHermes ? "hermes-stable" : "default")
|
|
@@ -90,9 +121,25 @@ async function exportEmbedBundleAsync(projectRoot, options) {
|
|
|
90
121
|
bundle,
|
|
91
122
|
assets: outputAssets
|
|
92
123
|
};
|
|
124
|
+
} catch (error) {
|
|
125
|
+
if (isError(error)) {
|
|
126
|
+
// Log using Xcode error format so the errors are picked up by xcodebuild.
|
|
127
|
+
// https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script
|
|
128
|
+
if (options.platform === "ios") {
|
|
129
|
+
// If the error is about to be presented in Xcode, strip the ansi characters from the message.
|
|
130
|
+
if ("message" in error && (0, _xcodeCompilerLogger).isExecutingFromXcodebuild()) {
|
|
131
|
+
error.message = (0, _ansi).stripAnsi(error.message);
|
|
132
|
+
}
|
|
133
|
+
(0, _xcodeCompilerLogger).logMetroErrorInXcode(projectRoot, error);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
throw error;
|
|
93
137
|
} finally{
|
|
94
138
|
server.end();
|
|
95
139
|
}
|
|
96
140
|
}
|
|
141
|
+
function isError(error) {
|
|
142
|
+
return error instanceof Error;
|
|
143
|
+
}
|
|
97
144
|
|
|
98
145
|
//# sourceMappingURL=exportEmbedAsync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/export/embed/exportEmbedAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport fs from 'fs';\nimport Server from 'metro/src/Server';\nimport output from 'metro/src/shared/output/bundle';\nimport type { BundleOptions } from 'metro/src/shared/types';\nimport path from 'path';\n\nimport { Options } from './resolveOptions';\nimport { Log } from '../../log';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport {\n getBaseUrlFromExpoConfig,\n getMetroDirectBundleOptions,\n} from '../../start/server/middleware/metroOptions';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { profile } from '../../utils/profile';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { getAssets } from '../fork-bundleAsync';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n const { bundle, assets } = await exportEmbedBundleAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAsync(projectRoot: string, options: Options) {\n const exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // TODO: This is slow ~40ms\n const { config } = await loadMetroConfigAsync(\n projectRoot,\n {\n maxWorkers: options.maxWorkers,\n resetCache: options.resetCache,\n config: options.config,\n },\n {\n exp,\n isExporting: true,\n }\n );\n\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const bundleRequest = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...getMetroDirectBundleOptions({\n mainModuleName: options.entryFile,\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n baseUrl: getBaseUrlFromExpoConfig(exp),\n }),\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n };\n\n const server = new Server(config, {\n watch: false,\n });\n\n try {\n const bundle = await profile(\n server.build.bind(server),\n 'metro-bundle'\n )({\n ...bundleRequest,\n bundleType: 'bundle',\n });\n\n // Save the assets of the bundle\n const outputAssets = await getAssets(server, {\n ...bundleRequest,\n bundleType: 'todo',\n });\n\n return {\n bundle,\n assets: outputAssets,\n };\n } finally {\n server.end();\n }\n}\n"],"names":["exportEmbedAsync","exportEmbedBundleAsync","projectRoot","options","setNodeEnv","dev","require","load","bundle","assets","fs","mkdirSync","path","dirname","bundleOutput","recursive","mode","Promise","all","output","save","Log","log","assetsDest","persistMetroAssetsAsync","platform","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","exp","getConfig","skipSDKVersionRequirement","config","loadMetroConfigAsync","maxWorkers","resetCache","isExporting","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","basename","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","getMetroDirectBundleOptions","mainModuleName","entryFile","minify","engine","undefined","baseUrl","getBaseUrlFromExpoConfig","unstable_transformProfile","unstableTransformProfile","server","watch","profile","build","bind","bundleType","outputAssets","getAssets","end"],"mappings":"AAAA;;;;QAoBsBA,gBAAgB,GAAhBA,gBAAgB;QAuBhBC,sBAAsB,GAAtBA,sBAAsB;AA3ClB,IAAA,OAAc,WAAd,cAAc,CAAA;AACzB,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACA,IAAA,OAAkB,kCAAlB,kBAAkB,EAAA;AAClB,IAAA,OAAgC,kCAAhC,gCAAgC,EAAA;AAElC,IAAA,KAAM,kCAAN,MAAM,EAAA;AAGH,IAAA,IAAW,WAAX,WAAW,CAAA;AACM,IAAA,iBAA2C,WAA3C,2CAA2C,CAAA;AAIzE,IAAA,aAA4C,WAA5C,4CAA4C,CAAA;AACxB,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AACxB,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AACP,IAAA,aAAiB,WAAjB,iBAAiB,CAA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Ae,GAAG,SAAS,CAAC;KAC3C,AAAC;IAEF,MAAMmB,MAAM,GAAG,IAAIZ,OAAM,QAAA,CAACZ,MAAM,EAAE;QAChCyB,KAAK,EAAE,KAAK;KACb,CAAC,AAAC;IAEH,IAAI;QACF,MAAMjD,MAAM,GAAG,MAAMkD,CAAAA,GAAAA,QAAO,AAG3B,CAAA,QAH2B,CAC1BF,MAAM,CAACG,KAAK,CAACC,IAAI,CAACJ,MAAM,CAAC,EACzB,cAAc,CACf,CAAC;YACA,GAAGb,aAAa;YAChBkB,UAAU,EAAE,QAAQ;SACrB,CAAC,AAAC;QAEH,gCAAgC;QAChC,MAAMC,YAAY,GAAG,MAAMC,CAAAA,GAAAA,gBAAS,AAGlC,CAAA,UAHkC,CAACP,MAAM,EAAE;YAC3C,GAAGb,aAAa;YAChBkB,UAAU,EAAE,MAAM;SACnB,CAAC,AAAC;QAEH,OAAO;YACLrD,MAAM;YACNC,MAAM,EAAEqD,YAAY;SACrB,CAAC;KACH,QAAS;QACRN,MAAM,CAACQ,GAAG,EAAE,CAAC;KACd;CACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/embed/exportEmbedAsync.ts"],"sourcesContent":["/**\n * Copyright © 2023 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 { getConfig } from '@expo/config';\nimport fs from 'fs';\nimport { sync as globSync } from 'glob';\nimport Server from 'metro/src/Server';\nimport output from 'metro/src/shared/output/bundle';\nimport type { BundleOptions } from 'metro/src/shared/types';\nimport path from 'path';\n\nimport { Options } from './resolveOptions';\nimport { isExecutingFromXcodebuild, logMetroErrorInXcode } from './xcodeCompilerLogger';\nimport { Log } from '../../log';\nimport { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro';\nimport { getMetroDirectBundleOptionsForExpoConfig } from '../../start/server/middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { removeAsync } from '../../utils/dir';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { profile } from '../../utils/profile';\nimport { isEnableHermesManaged } from '../exportHermes';\nimport { getAssets } from '../fork-bundleAsync';\nimport { persistMetroAssetsAsync } from '../persistMetroAssets';\n\nconst debug = require('debug')('expo:export:embed');\n\nfunction guessCopiedAppleBundlePath(bundleOutput: string) {\n // Ensure the path is familiar before guessing.\n if (!bundleOutput.match(/\\/Xcode\\/DerivedData\\/.*\\/Build\\/Products\\//)) {\n debug('Bundling to non-standard location:', bundleOutput);\n return false;\n }\n const bundleName = path.basename(bundleOutput);\n const bundleParent = path.dirname(bundleOutput);\n const possiblePath = globSync(path.join(bundleParent, `*.app/${bundleName}`), {\n // bundle identifiers can start with dots.\n dot: true,\n })[0];\n debug('Possible path for previous bundle:', possiblePath);\n return possiblePath;\n}\n\nexport async function exportEmbedAsync(projectRoot: string, options: Options) {\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n // Ensure we delete the old bundle to trigger a failure if the bundle cannot be created.\n await removeAsync(options.bundleOutput);\n\n // The iOS bundle is copied in to the Xcode project, so we need to remove the old one\n // to prevent Xcode from loading the old one after a build failure.\n if (options.platform === 'ios') {\n const previousPath = guessCopiedAppleBundlePath(options.bundleOutput);\n if (previousPath && fs.existsSync(previousPath)) {\n debug('Removing previous iOS bundle:', previousPath);\n await removeAsync(previousPath);\n }\n }\n\n const { bundle, assets } = await exportEmbedBundleAsync(projectRoot, options);\n\n fs.mkdirSync(path.dirname(options.bundleOutput), { recursive: true, mode: 0o755 });\n\n // Persist bundle and source maps.\n await Promise.all([\n output.save(bundle, options, Log.log),\n // NOTE(EvanBacon): This may need to be adjusted in the future if want to support baseUrl on native\n // platforms when doing production embeds (unlikely).\n options.assetsDest\n ? persistMetroAssetsAsync(assets, {\n platform: options.platform,\n outputDirectory: options.assetsDest,\n iosAssetCatalogDirectory: options.assetCatalogDest,\n })\n : null,\n ]);\n}\n\nexport async function exportEmbedBundleAsync(projectRoot: string, options: Options) {\n const exp = getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;\n\n // TODO: This is slow ~40ms\n const { config } = await loadMetroConfigAsync(\n projectRoot,\n {\n maxWorkers: options.maxWorkers,\n resetCache: false, //options.resetCache,\n config: options.config,\n },\n {\n exp,\n isExporting: true,\n }\n );\n\n const isHermes = isEnableHermesManaged(exp, options.platform);\n\n let sourceMapUrl = options.sourcemapOutput;\n if (sourceMapUrl && !options.sourcemapUseAbsolutePath) {\n sourceMapUrl = path.basename(sourceMapUrl);\n }\n\n const bundleRequest = {\n ...Server.DEFAULT_BUNDLE_OPTIONS,\n ...getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, {\n mainModuleName: options.entryFile,\n platform: options.platform,\n minify: options.minify,\n mode: options.dev ? 'development' : 'production',\n engine: isHermes ? 'hermes' : undefined,\n isExporting: true,\n }),\n sourceMapUrl,\n unstable_transformProfile: (options.unstableTransformProfile ||\n (isHermes ? 'hermes-stable' : 'default')) as BundleOptions['unstable_transformProfile'],\n };\n\n const server = new Server(config, {\n watch: false,\n });\n\n try {\n const bundle = await profile(\n server.build.bind(server),\n 'metro-bundle'\n )({\n ...bundleRequest,\n bundleType: 'bundle',\n });\n\n // Save the assets of the bundle\n const outputAssets = await getAssets(server, {\n ...bundleRequest,\n bundleType: 'todo',\n });\n\n return {\n bundle,\n assets: outputAssets,\n };\n } catch (error: any) {\n if (isError(error)) {\n // Log using Xcode error format so the errors are picked up by xcodebuild.\n // https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Log-errors-and-warnings-from-your-script\n if (options.platform === 'ios') {\n // If the error is about to be presented in Xcode, strip the ansi characters from the message.\n if ('message' in error && isExecutingFromXcodebuild()) {\n error.message = stripAnsi(error.message) as string;\n }\n logMetroErrorInXcode(projectRoot, error);\n }\n }\n throw error;\n } finally {\n server.end();\n }\n}\n\nfunction isError(error: any): error is Error {\n return error instanceof Error;\n}\n"],"names":["exportEmbedAsync","exportEmbedBundleAsync","debug","require","guessCopiedAppleBundlePath","bundleOutput","match","bundleName","path","basename","bundleParent","dirname","possiblePath","globSync","join","dot","projectRoot","options","setNodeEnv","dev","load","removeAsync","platform","previousPath","fs","existsSync","bundle","assets","mkdirSync","recursive","mode","Promise","all","output","save","Log","log","assetsDest","persistMetroAssetsAsync","outputDirectory","iosAssetCatalogDirectory","assetCatalogDest","exp","getConfig","skipSDKVersionRequirement","config","loadMetroConfigAsync","maxWorkers","resetCache","isExporting","isHermes","isEnableHermesManaged","sourceMapUrl","sourcemapOutput","sourcemapUseAbsolutePath","bundleRequest","Server","DEFAULT_BUNDLE_OPTIONS","getMetroDirectBundleOptionsForExpoConfig","mainModuleName","entryFile","minify","engine","undefined","unstable_transformProfile","unstableTransformProfile","server","watch","profile","build","bind","bundleType","outputAssets","getAssets","error","isError","isExecutingFromXcodebuild","message","stripAnsi","logMetroErrorInXcode","end","Error"],"mappings":"AAMA;;;;QAuCsBA,gBAAgB,GAAhBA,gBAAgB;QAoChBC,sBAAsB,GAAtBA,sBAAsB;AA3ElB,IAAA,OAAc,WAAd,cAAc,CAAA;AACzB,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACc,IAAA,KAAM,WAAN,MAAM,CAAA;AACpB,IAAA,OAAkB,kCAAlB,kBAAkB,EAAA;AAClB,IAAA,OAAgC,kCAAhC,gCAAgC,EAAA;AAElC,IAAA,KAAM,kCAAN,MAAM,EAAA;AAGyC,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AACnE,IAAA,IAAW,WAAX,WAAW,CAAA;AACM,IAAA,iBAA2C,WAA3C,2CAA2C,CAAA;AACvB,IAAA,aAA4C,WAA5C,4CAA4C,CAAA;AAC3E,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AAChB,IAAA,IAAiB,WAAjB,iBAAiB,CAAA;AAClB,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AACxB,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AACP,IAAA,aAAiB,WAAjB,iBAAiB,CAAA;AAC7B,IAAA,gBAA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
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.getXcodeCompilerErrorMessage = getXcodeCompilerErrorMessage;
|
|
6
|
+
exports.logMetroErrorInXcode = logMetroErrorInXcode;
|
|
7
|
+
exports.isExecutingFromXcodebuild = isExecutingFromXcodebuild;
|
|
8
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
+
var _path = _interopRequireDefault(require("path"));
|
|
10
|
+
function _interopRequireDefault(obj) {
|
|
11
|
+
return obj && obj.__esModule ? obj : {
|
|
12
|
+
default: obj
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function isPossiblyUnableToResolveError(error) {
|
|
16
|
+
return "message" in error && typeof error.message === "string" && "originModulePath" in error && typeof error.originModulePath === "string" && "targetModuleName" in error && typeof error.targetModuleName === "string";
|
|
17
|
+
}
|
|
18
|
+
function isPossiblyTransformError(error) {
|
|
19
|
+
return "message" in error && typeof error.message === "string" && "filename" in error && typeof error.filename === "string" && "lineNumber" in error && typeof error.lineNumber === "number";
|
|
20
|
+
}
|
|
21
|
+
function getXcodeCompilerErrorMessage(projectRoot, error) {
|
|
22
|
+
const makeFilepathAbsolute = (filepath)=>filepath.startsWith("/") ? filepath : _path.default.join(projectRoot, filepath)
|
|
23
|
+
;
|
|
24
|
+
if ("message" in error) {
|
|
25
|
+
// Metro's `UnableToResolveError`
|
|
26
|
+
if (isPossiblyUnableToResolveError(error)) {
|
|
27
|
+
const loc = getLineNumberForStringInFile(error.originModulePath, error.targetModuleName);
|
|
28
|
+
return makeXcodeCompilerLog("error", error.message, {
|
|
29
|
+
fileName: error.originModulePath,
|
|
30
|
+
lineNumber: loc == null ? void 0 : loc.lineNumber,
|
|
31
|
+
column: loc == null ? void 0 : loc.column
|
|
32
|
+
});
|
|
33
|
+
} else if (isPossiblyTransformError(error)) {
|
|
34
|
+
return makeXcodeCompilerLog("error", error.message, {
|
|
35
|
+
// Metro generally returns the filename as relative from the project root.
|
|
36
|
+
fileName: makeFilepathAbsolute(error.filename),
|
|
37
|
+
lineNumber: error.lineNumber,
|
|
38
|
+
column: error.column
|
|
39
|
+
});
|
|
40
|
+
// TODO: ResourceNotFoundError, GraphNotFoundError, RevisionNotFoundError, AmbiguousModuleResolutionError
|
|
41
|
+
} else {
|
|
42
|
+
// Unknown error
|
|
43
|
+
return makeXcodeCompilerLog("error", error.message);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
function logMetroErrorInXcode(projectRoot, error) {
|
|
49
|
+
const message = getXcodeCompilerErrorMessage(projectRoot, error);
|
|
50
|
+
if (message != null) {
|
|
51
|
+
console.error(message);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function isExecutingFromXcodebuild() {
|
|
55
|
+
return !!process.env.BUILT_PRODUCTS_DIR;
|
|
56
|
+
}
|
|
57
|
+
function makeXcodeCompilerLog(type, message, { fileName , lineNumber , column } = {}) {
|
|
58
|
+
// TODO: Figure out how to support multi-line logs.
|
|
59
|
+
const firstLine = message.split("\n")[0];
|
|
60
|
+
if (fileName && !(fileName == null ? void 0 : fileName.includes(":"))) {
|
|
61
|
+
return `${fileName}:${lineNumber || 0}:${column != null ? column + ":" : ""} ${type}: ${firstLine}`;
|
|
62
|
+
}
|
|
63
|
+
return `${type}: ${firstLine}`;
|
|
64
|
+
}
|
|
65
|
+
// TODO: Metro doesn't expose this info even though it knows it.
|
|
66
|
+
function getLineNumberForStringInFile(originModulePath, targetModuleName) {
|
|
67
|
+
let file;
|
|
68
|
+
try {
|
|
69
|
+
file = _fs.default.readFileSync(originModulePath, "utf8");
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (error.code === "ENOENT" || error.code === "EISDIR") {
|
|
72
|
+
// We're probably dealing with a virtualised file system where
|
|
73
|
+
// `this.originModulePath` doesn't actually exist on disk.
|
|
74
|
+
// We can't show a code frame, but there's no need to let this I/O
|
|
75
|
+
// error shadow the original module resolution error.
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
const lines = file.split("\n");
|
|
81
|
+
let lineNumber = 0;
|
|
82
|
+
let column = -1;
|
|
83
|
+
for(let line = 0; line < lines.length; line++){
|
|
84
|
+
const columnLocation = lines[line].lastIndexOf(targetModuleName);
|
|
85
|
+
if (columnLocation >= 0) {
|
|
86
|
+
lineNumber = line;
|
|
87
|
+
column = columnLocation;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
lineNumber,
|
|
93
|
+
column
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=xcodeCompilerLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/embed/xcodeCompilerLogger.ts"],"sourcesContent":["/**\n * Copyright © 2023 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 fs from 'fs';\nimport path from 'path';\n\nfunction isPossiblyUnableToResolveError(\n error: any\n): error is { message: string; originModulePath: string; targetModuleName: string } {\n return (\n 'message' in error &&\n typeof error.message === 'string' &&\n 'originModulePath' in error &&\n typeof error.originModulePath === 'string' &&\n 'targetModuleName' in error &&\n typeof error.targetModuleName === 'string'\n );\n}\nfunction isPossiblyTransformError(\n error: any\n): error is { message: string; filename: string; lineNumber: number; column?: number } {\n return (\n 'message' in error &&\n typeof error.message === 'string' &&\n 'filename' in error &&\n typeof error.filename === 'string' &&\n 'lineNumber' in error &&\n typeof error.lineNumber === 'number'\n );\n}\n\nexport function getXcodeCompilerErrorMessage(\n projectRoot: string,\n error: Error | any\n): string | null {\n const makeFilepathAbsolute = (filepath: string) =>\n filepath.startsWith('/') ? filepath : path.join(projectRoot, filepath);\n\n if ('message' in error) {\n // Metro's `UnableToResolveError`\n if (isPossiblyUnableToResolveError(error)) {\n const loc = getLineNumberForStringInFile(error.originModulePath, error.targetModuleName);\n return makeXcodeCompilerLog('error', error.message, {\n fileName: error.originModulePath,\n lineNumber: loc?.lineNumber,\n column: loc?.column,\n });\n } else if (isPossiblyTransformError(error)) {\n return makeXcodeCompilerLog('error', error.message, {\n // Metro generally returns the filename as relative from the project root.\n fileName: makeFilepathAbsolute(error.filename),\n lineNumber: error.lineNumber,\n column: error.column,\n });\n // TODO: ResourceNotFoundError, GraphNotFoundError, RevisionNotFoundError, AmbiguousModuleResolutionError\n } else {\n // Unknown error\n return makeXcodeCompilerLog('error', error.message);\n }\n }\n\n return null;\n}\n\nexport function logMetroErrorInXcode(projectRoot: string, error: Error) {\n const message = getXcodeCompilerErrorMessage(projectRoot, error);\n if (message != null) {\n console.error(message);\n }\n}\n\n// https://developer.apple.com/documentation/xcode/running-custom-scripts-during-a-build#Access-script-related-files-from-environment-variables\nexport function isExecutingFromXcodebuild() {\n return !!process.env.BUILT_PRODUCTS_DIR;\n}\n\nfunction makeXcodeCompilerLog(\n type: 'error' | 'fatal error' | 'warning' | 'note',\n message: string,\n {\n fileName,\n lineNumber,\n column,\n }: {\n /** Absolute file path to link to in Xcode. */\n fileName?: string;\n lineNumber?: number;\n column?: number;\n } = {}\n) {\n // TODO: Figure out how to support multi-line logs.\n const firstLine = message.split('\\n')[0];\n if (fileName && !fileName?.includes(':')) {\n return `${fileName}:${lineNumber || 0}:${\n column != null ? column + ':' : ''\n } ${type}: ${firstLine}`;\n }\n return `${type}: ${firstLine}`;\n}\n\n// TODO: Metro doesn't expose this info even though it knows it.\nfunction getLineNumberForStringInFile(originModulePath: string, targetModuleName: string) {\n let file;\n try {\n file = fs.readFileSync(originModulePath, 'utf8');\n } catch (error: any) {\n if (error.code === 'ENOENT' || error.code === 'EISDIR') {\n // We're probably dealing with a virtualised file system where\n // `this.originModulePath` doesn't actually exist on disk.\n // We can't show a code frame, but there's no need to let this I/O\n // error shadow the original module resolution error.\n return null;\n }\n throw error;\n }\n const lines = file.split('\\n');\n let lineNumber = 0;\n let column = -1;\n for (let line = 0; line < lines.length; line++) {\n const columnLocation = lines[line].lastIndexOf(targetModuleName);\n if (columnLocation >= 0) {\n lineNumber = line;\n column = columnLocation;\n break;\n }\n }\n return { lineNumber, column };\n}\n"],"names":["getXcodeCompilerErrorMessage","logMetroErrorInXcode","isExecutingFromXcodebuild","isPossiblyUnableToResolveError","error","message","originModulePath","targetModuleName","isPossiblyTransformError","filename","lineNumber","projectRoot","makeFilepathAbsolute","filepath","startsWith","path","join","loc","getLineNumberForStringInFile","makeXcodeCompilerLog","fileName","column","console","process","env","BUILT_PRODUCTS_DIR","type","firstLine","split","includes","file","fs","readFileSync","code","lines","line","length","columnLocation","lastIndexOf"],"mappings":"AAMA;;;;QA4BgBA,4BAA4B,GAA5BA,4BAA4B;QAiC5BC,oBAAoB,GAApBA,oBAAoB;QAQpBC,yBAAyB,GAAzBA,yBAAyB;AArE1B,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAEvB,SAASC,8BAA8B,CACrCC,KAAU,EACwE;IAClF,OACE,SAAS,IAAIA,KAAK,IAClB,OAAOA,KAAK,CAACC,OAAO,KAAK,QAAQ,IACjC,kBAAkB,IAAID,KAAK,IAC3B,OAAOA,KAAK,CAACE,gBAAgB,KAAK,QAAQ,IAC1C,kBAAkB,IAAIF,KAAK,IAC3B,OAAOA,KAAK,CAACG,gBAAgB,KAAK,QAAQ,CAC1C;CACH;AACD,SAASC,wBAAwB,CAC/BJ,KAAU,EAC2E;IACrF,OACE,SAAS,IAAIA,KAAK,IAClB,OAAOA,KAAK,CAACC,OAAO,KAAK,QAAQ,IACjC,UAAU,IAAID,KAAK,IACnB,OAAOA,KAAK,CAACK,QAAQ,KAAK,QAAQ,IAClC,YAAY,IAAIL,KAAK,IACrB,OAAOA,KAAK,CAACM,UAAU,KAAK,QAAQ,CACpC;CACH;AAEM,SAASV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