@expo/cli 0.23.2 → 0.23.4
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/README.md +33 -24
- package/build/bin/cli +1 -1
- package/build/src/run/android/runAndroidAsync.js +29 -1
- package/build/src/run/android/runAndroidAsync.js.map +1 -1
- package/build/src/run/ios/runIosAsync.js +29 -1
- package/build/src/run/ios/runIosAsync.js.map +1 -1
- package/build/src/run/remoteBuildCache.js +135 -0
- package/build/src/run/remoteBuildCache.js.map +1 -0
- package/build/src/start/index.js +1 -1
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/resolveOptions.js +3 -0
- package/build/src/start/resolveOptions.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/package.json +4 -4
package/README.md
CHANGED
|
@@ -9,29 +9,37 @@
|
|
|
9
9
|
<p align="center">The fastest way to build and run universal React Native apps for Android, iOS, and the web</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
+
<a aria-label="expo documentation" href="https://docs.expo.dev/more/expo-cli/">📚 Read the Documentation</a>
|
|
13
|
+
 • 
|
|
14
|
+
<a aria-label="expo documentation" href="https://expo.dev/blog">Learn more on our blog</a>
|
|
15
|
+
 • 
|
|
16
|
+
<a aria-label="Contribute to Expo CLI" href="#contributing">Contribute to Expo CLI</a>
|
|
17
|
+
</p>
|
|
12
18
|
|
|
19
|
+
<p align="center">
|
|
13
20
|
<a aria-label="Join the Expo Discord" href="https://discord.gg/4gtbPAdpaE" target="_blank">
|
|
14
|
-
<img alt="Discord" src="https://img.shields.io/discord/695411232856997968.svg?style=
|
|
21
|
+
<img alt="Discord" src="https://img.shields.io/discord/695411232856997968.svg?style=for-the-badge&color=5865F2&logo=discord&logoColor=FFFFFF" />
|
|
15
22
|
</a>
|
|
16
|
-
<a aria-label="Browse the Expo forums" href="https://forums.expo.dev" target="_blank">
|
|
17
|
-
<img alt="" src="https://img.shields.io/badge/Ask%20Questions%20-000.svg?style=flat-square&logo=discourse&logoWidth=15&labelColor=000000&color=000000">
|
|
18
|
-
</a>
|
|
19
|
-
|
|
20
23
|
</p>
|
|
21
24
|
|
|
22
25
|
<p align="center">
|
|
23
|
-
<a aria-label="expo
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<a aria-label="Follow @expo on
|
|
30
|
-
<img
|
|
31
|
-
</a
|
|
32
|
-
<a aria-label="Follow
|
|
33
|
-
<img
|
|
26
|
+
<a aria-label="Follow @expo on X" href="https://x.com/intent/follow?screen_name=expo" target="_blank">
|
|
27
|
+
<img alt="Expo on X" src="https://img.shields.io/badge/X-000000?style=for-the-badge&logo=x&logoColor=white" target="_blank" />
|
|
28
|
+
</a>
|
|
29
|
+
<a aria-label="Follow @expo on GitHub" href="https://github.com/expo" target="_blank">
|
|
30
|
+
<img alt="Expo on GitHub" src="https://img.shields.io/badge/GitHub-222222?style=for-the-badge&logo=github&logoColor=white" target="_blank" />
|
|
31
|
+
</a>
|
|
32
|
+
<a aria-label="Follow @expo on Reddit" href="https://www.reddit.com/r/expo/" target="_blank">
|
|
33
|
+
<img alt="Expo on Reddit" src="https://img.shields.io/badge/Reddit-FF4500?style=for-the-badge&logo=reddit&logoColor=white" target="_blank" />
|
|
34
|
+
</a>
|
|
35
|
+
<a aria-label="Follow @expo on Bluesky" href="https://bsky.app/profile/expo.dev" target="_blank">
|
|
36
|
+
<img alt="Expo on LinkedIn" src="https://img.shields.io/badge/Bluesky-1DA1F2?style=for-the-badge&logo=bluesky&logoColor=white" target="_blank" />
|
|
37
|
+
</a>
|
|
38
|
+
<a aria-label="Follow @expo on LinkedIn" href="https://www.linkedin.com/company/expo-dev" target="_blank">
|
|
39
|
+
<img alt="Expo on LinkedIn" src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=LinkedIn&logoColor=white" target="_blank" />
|
|
34
40
|
</a>
|
|
41
|
+
|
|
42
|
+
<p align="center">⭐️ Be sure to star the Expo GitHub repo if you enjoy using the project! ⭐️</p>
|
|
35
43
|
</p>
|
|
36
44
|
|
|
37
45
|
---
|
|
@@ -49,9 +57,9 @@ npx expo
|
|
|
49
57
|
This CLI has the following purposes:
|
|
50
58
|
|
|
51
59
|
- Be a minimal interface for starting a local development server that emulates a production EAS Updates server. The development server is the proxy between a native runtime (Expo Go, Dev Client) and a JS Bundler (Metro, Webpack).
|
|
52
|
-
- To accomplish secure manifest signing
|
|
60
|
+
- To accomplish secure manifest signing for the web, like AsyncStorage or Permissions where both require https/SSL, we need an authenticated Expo account. This is the only reason we include the authentication commands `login`, `logout`, `whoami`, `register`. Standard web CLIs don't have authentication commands because they either don't set up https or they use emulation via packages like `devcert`.
|
|
53
61
|
- Orchestrating various native tools like Xcode, `Simulator.app`, Android Studio, ADB, etc. to make native builds as painless as possible. `run:ios`, `run:android` commands.
|
|
54
|
-
- Implementing a versioned `prebuild` command that can reliably work with a project for long periods of time. Prebuild is like a bundler for native code, it generates the
|
|
62
|
+
- Implementing a versioned `prebuild` command that can reliably work with a project for long periods of time. Prebuild is like a bundler for native code, it generates the **android** and **ios** folders based on the project Expo config (**app.json**).
|
|
55
63
|
- `npx expo config` is auxiliary to `npx expo prebuild` and used for debugging/introspection.
|
|
56
64
|
- Installing versioned libraries with `npx expo install` this is a minimal utility born out of pure necessity since versioning in React Native is hard to get right.
|
|
57
65
|
|
|
@@ -63,7 +71,7 @@ To develop the CLI run (defaults to watch mode):
|
|
|
63
71
|
yarn build
|
|
64
72
|
```
|
|
65
73
|
|
|
66
|
-
We highly recommend setting up an alias for the Expo CLI so you can try it in projects all around your computer. Open your
|
|
74
|
+
We highly recommend setting up an alias for the Expo CLI so you can try it in projects all around your computer. Open your **.zshrc** or other config file and add:
|
|
67
75
|
|
|
68
76
|
```
|
|
69
77
|
alias nexpo="/path/to/expo/packages/@expo/cli/build/bin/cli"
|
|
@@ -75,7 +83,7 @@ Then use it with `nexpo` like `nexpo config`. You can also set up a debug versio
|
|
|
75
83
|
alias expo-inspect="node --inspect /path/to/expo/packages/@expo/cli/build/bin/cli"
|
|
76
84
|
```
|
|
77
85
|
|
|
78
|
-
Then you can run it and visit `chrome://inspect/#devices` in Chrome, and press "Open dedicated DevTools for Node" to get a debugger attached to your process. When debugging the CLI, you'll want to disable workers whenever possible, this will make all code run on the same thread, this is mostly applicable to the `start` command, i.e. `expo-inspect start --max-workers 0`.
|
|
86
|
+
Then you can run it and visit `chrome://inspect/#devices` in Chrome, and press **"Open dedicated DevTools for Node"** to get a debugger attached to your process. When debugging the CLI, you'll want to disable workers whenever possible, this will make all code run on the same thread, this is mostly applicable to the `start` command, i.e. `expo-inspect start --max-workers 0`.
|
|
79
87
|
|
|
80
88
|
## Format
|
|
81
89
|
|
|
@@ -97,7 +105,7 @@ Then you can run it and visit `chrome://inspect/#devices` in Chrome, and press "
|
|
|
97
105
|
- Unlike the legacy global Expo CLI, this CLI is shipped with `expo` meaning the SDK Version is always present.
|
|
98
106
|
- Reduce SDK specific tasks since only one SDK should be accounted for in a single version of `@expo/cli`.
|
|
99
107
|
- The `@expo/config` method `getConfig` does not need the `skipSDKVersionRequirement` in any case since `expo` should always be installed. Ex: `getConfig('...', { skipSDKVersionRequirement: true });` shouldn't be used.
|
|
100
|
-
- Also unlike the global Expo CLI we can assume that node modules are always installed since this CLI should be used via a project's local
|
|
108
|
+
- Also unlike the global Expo CLI we can assume that node modules are always installed since this CLI should be used via a project's local **node_modules** folder.
|
|
101
109
|
- This means we can't perform operations that upgrade the `expo` package as these may kill the running process. Features that need this pattern (like `expo upgrade`) should live in standalone global tools.
|
|
102
110
|
|
|
103
111
|
## Testing
|
|
@@ -105,7 +113,7 @@ Then you can run it and visit `chrome://inspect/#devices` in Chrome, and press "
|
|
|
105
113
|
There are two testing scripts:
|
|
106
114
|
|
|
107
115
|
- `yarn test`: Controlled unit and integration tests.
|
|
108
|
-
- `yarn test:e2e`: End to end testing for CLI commands. This requires the files to be built with `yarn build
|
|
116
|
+
- `yarn test:e2e`: End to end testing for CLI commands. This requires the files to be built with `yarn build`.
|
|
109
117
|
|
|
110
118
|
---
|
|
111
119
|
|
|
@@ -126,7 +134,8 @@ There are two testing scripts:
|
|
|
126
134
|
### E2E Testing Guidelines
|
|
127
135
|
|
|
128
136
|
- E2E tests should be resilient and reliable, be sure to give them plenty of time for network requests.
|
|
129
|
-
- When testing locally you
|
|
137
|
+
- When testing locally you had to have [Bun installed](https://bun.sh/docs/installation).
|
|
138
|
+
- When testing locally you should attempt to reuse node modules for faster results. In the `npx expo prebuild` and `npx expo start` commands for instance, we utilize a helper method that will default to reusing a project + **node_modules** when run locally. This can be [toggled off](https://github.com/expo/expo/blob/11a5a4d27b7e1c8e4d6ddf0401397d789d89f52a/packages/%40expo/cli/e2e/__tests__/utils.ts#L174) to bootstrap a fresh project every time.
|
|
130
139
|
- When bootstrapping test projects, utilize the temporary folder `os.tmpdir()` as this folder is automatically cleaned up when the computer restarts.
|
|
131
140
|
|
|
132
141
|
## Coming from Expo CLI
|
|
@@ -139,6 +148,6 @@ The legacy global `expo-cli` package was deprecated in favor of this versioned `
|
|
|
139
148
|
- `expo-cli` worked for almost all versions of the `expo` package, meaning it was getting more complex with every release.
|
|
140
149
|
- `expo-cli` combined service commands (like the legacy `build`, `submit`, `publish`) with project-level commands like `expo start`. We've since divided services into `eas-cli` and project commands into `npx expo` (`@expo/cli`). This structure is more optimal/faster for developers since they can install/update commands when they need them.
|
|
141
150
|
- This CLI utilizes more Node.js standard features like `$EDITOR` instead of the custom `$EXPO_EDITOR` environment variable. Also transitioning away from `$EXPO_DEBUG` and more towards `$DEBUG=expo:*`. These types of changes make Expo CLI play nicer with existing tooling.
|
|
142
|
-
- The DevTools UI has been deprecated to reduce the net
|
|
151
|
+
- The DevTools UI has been deprecated to reduce the net installation size, minimize complexity, and make room for future debugging UIs (Hermes/v8 Chrome debugger).
|
|
143
152
|
- The `expo start:web` and `expo web` commands have been rolled into `npx expo start` as we now lazily load platforms until the device requests them.
|
|
144
153
|
- Other missing or beta features from `expo-cli` may still be getting migrated over to this new CLI. For a more comprehensive breakdown see the [start command PR](https://github.com/expo/expo/pull/16160).
|
package/build/bin/cli
CHANGED
|
@@ -8,6 +8,13 @@ Object.defineProperty(exports, "runAndroidAsync", {
|
|
|
8
8
|
return runAndroidAsync;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
function _config() {
|
|
12
|
+
const data = require("@expo/config");
|
|
13
|
+
_config = function() {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
11
18
|
function _chalk() {
|
|
12
19
|
const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
|
13
20
|
_chalk = function() {
|
|
@@ -40,6 +47,7 @@ const _port = require("../../utils/port");
|
|
|
40
47
|
const _scheme = require("../../utils/scheme");
|
|
41
48
|
const _ensureNativeProject = require("../ensureNativeProject");
|
|
42
49
|
const _hints = require("../hints");
|
|
50
|
+
const _remoteBuildCache = require("../remoteBuildCache");
|
|
43
51
|
const _startBundler = require("../startBundler");
|
|
44
52
|
function _interop_require_default(obj) {
|
|
45
53
|
return obj && obj.__esModule ? obj : {
|
|
@@ -48,11 +56,22 @@ function _interop_require_default(obj) {
|
|
|
48
56
|
}
|
|
49
57
|
const debug = require('debug')('expo:run:android');
|
|
50
58
|
async function runAndroidAsync(projectRoot, { install, ...options }) {
|
|
51
|
-
var _options_variant, _this;
|
|
59
|
+
var _options_variant, _projectConfig_exp_experiments, _this, _projectConfig_exp_experiments1;
|
|
52
60
|
// NOTE: This is a guess, the developer can overwrite with `NODE_ENV`.
|
|
53
61
|
const isProduction = (_options_variant = options.variant) == null ? void 0 : _options_variant.toLowerCase().endsWith('release');
|
|
54
62
|
(0, _nodeEnv.setNodeEnv)(isProduction ? 'production' : 'development');
|
|
55
63
|
require('@expo/env').load(projectRoot);
|
|
64
|
+
const projectConfig = (0, _config().getConfig)(projectRoot);
|
|
65
|
+
if (!options.binary && ((_projectConfig_exp_experiments = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments.remoteBuildCache)) {
|
|
66
|
+
var _projectConfig_exp_experiments2;
|
|
67
|
+
const localPath = await (0, _remoteBuildCache.resolveRemoteBuildCache)(projectRoot, {
|
|
68
|
+
platform: 'android',
|
|
69
|
+
provider: (_projectConfig_exp_experiments2 = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments2.remoteBuildCache.provider
|
|
70
|
+
});
|
|
71
|
+
if (localPath) {
|
|
72
|
+
options.binary = localPath;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
56
75
|
await (0, _ensureNativeProject.ensureNativeProjectAsync)(projectRoot, {
|
|
57
76
|
platform: 'android',
|
|
58
77
|
install
|
|
@@ -61,6 +80,7 @@ async function runAndroidAsync(projectRoot, { install, ...options }) {
|
|
|
61
80
|
debug('Package name: ' + props.packageName);
|
|
62
81
|
_log.Log.log('› Building app...');
|
|
63
82
|
const androidProjectRoot = _path().default.join(projectRoot, 'android');
|
|
83
|
+
let shouldUpdateBuildCache = false;
|
|
64
84
|
if (!options.binary) {
|
|
65
85
|
let eagerBundleOptions;
|
|
66
86
|
if (isProduction) {
|
|
@@ -77,6 +97,7 @@ async function runAndroidAsync(projectRoot, { install, ...options }) {
|
|
|
77
97
|
architectures: props.architectures,
|
|
78
98
|
eagerBundleOptions
|
|
79
99
|
});
|
|
100
|
+
shouldUpdateBuildCache = true;
|
|
80
101
|
// Ensure the port hasn't become busy during the build.
|
|
81
102
|
if (props.shouldStartBundler && !await (0, _port.ensurePortAvailabilityAsync)(projectRoot, props)) {
|
|
82
103
|
props.shouldStartBundler = false;
|
|
@@ -111,6 +132,13 @@ async function runAndroidAsync(projectRoot, { install, ...options }) {
|
|
|
111
132
|
} else {
|
|
112
133
|
await manager.stopAsync();
|
|
113
134
|
}
|
|
135
|
+
if (shouldUpdateBuildCache && ((_projectConfig_exp_experiments1 = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments1.remoteBuildCache)) {
|
|
136
|
+
var _projectConfig_exp_experiments3;
|
|
137
|
+
await (0, _remoteBuildCache.uploadRemoteBuildCache)(projectRoot, {
|
|
138
|
+
platform: 'android',
|
|
139
|
+
provider: (_projectConfig_exp_experiments3 = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments3.remoteBuildCache.provider
|
|
140
|
+
});
|
|
141
|
+
}
|
|
114
142
|
}
|
|
115
143
|
async function installAppAsync(androidProjectRoot, props) {
|
|
116
144
|
// Find the APK file path
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/run/android/runAndroidAsync.ts"],"sourcesContent":["import chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { resolveInstallApkNameAsync } from './resolveInstallApkName';\nimport { Options, ResolvedOptions, resolveOptionsAsync } from './resolveOptions';\nimport { exportEagerAsync } from '../../export/embed/exportEager';\nimport { Log } from '../../log';\nimport type { AndroidOpenInCustomProps } from '../../start/platforms/android/AndroidPlatformManager';\nimport { assembleAsync, installAsync } from '../../start/platforms/android/gradle';\nimport { CommandError } from '../../utils/errors';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport { getSchemesForAndroidAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { startBundlerAsync } from '../startBundler';\n\nconst debug = require('debug')('expo:run:android');\n\nexport async function runAndroidAsync(projectRoot: string, { install, ...options }: Options) {\n // NOTE: This is a guess, the developer can overwrite with `NODE_ENV`.\n const isProduction = options.variant?.toLowerCase().endsWith('release');\n setNodeEnv(isProduction ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n await ensureNativeProjectAsync(projectRoot, { platform: 'android', install });\n\n const props = await resolveOptionsAsync(projectRoot, options);\n\n debug('Package name: ' + props.packageName);\n Log.log('› Building app...');\n\n const androidProjectRoot = path.join(projectRoot, 'android');\n\n if (!options.binary) {\n let eagerBundleOptions: string | undefined;\n\n if (isProduction) {\n eagerBundleOptions = JSON.stringify(\n await exportEagerAsync(projectRoot, {\n dev: false,\n platform: 'android',\n })\n );\n }\n\n await assembleAsync(androidProjectRoot, {\n variant: props.variant,\n port: props.port,\n appName: props.appName,\n buildCache: props.buildCache,\n architectures: props.architectures,\n eagerBundleOptions,\n });\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n }\n\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n // If a scheme is specified then use that instead of the package name.\n scheme: (await getSchemesForAndroidAsync(projectRoot))?.[0],\n headless: !props.shouldStartBundler,\n });\n\n if (options.binary) {\n // Attempt to install the APK from the file path\n const binaryPath = path.join(options.binary);\n\n if (!fs.existsSync(binaryPath)) {\n throw new CommandError(`The path to the custom Android binary does not exist: ${binaryPath}`);\n }\n Log.log(chalk.gray`\\u203A Installing ${binaryPath}`);\n await props.device.installAppAsync(binaryPath);\n } else {\n await installAppAsync(androidProjectRoot, props);\n }\n\n await manager.getDefaultDevServer().openCustomRuntimeAsync<AndroidOpenInCustomProps>(\n 'emulator',\n {\n applicationId: props.packageName,\n customAppId: props.customAppId,\n launchActivity: props.launchActivity,\n },\n { device: props.device.device }\n );\n\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n } else {\n await manager.stopAsync();\n }\n}\n\nasync function installAppAsync(androidProjectRoot: string, props: ResolvedOptions) {\n // Find the APK file path\n const apkFile = await resolveInstallApkNameAsync(props.device.device, props);\n\n if (apkFile) {\n // Attempt to install the APK from the file path\n const binaryPath = path.join(props.apkVariantDirectory, apkFile);\n Log.log(chalk.gray`\\u203A Installing ${binaryPath}`);\n await props.device.installAppAsync(binaryPath);\n } else {\n // If we cannot resolve the APK file path then we can attempt to install using Gradle.\n // This offers more advanced resolution that we may not have first class support for.\n Log.log('› Failed to locate binary file, installing with Gradle...');\n await installAsync(androidProjectRoot, {\n variant: props.variant ?? 'debug',\n appName: props.appName ?? 'app',\n port: props.port,\n });\n }\n}\n"],"names":["runAndroidAsync","debug","require","projectRoot","install","options","isProduction","variant","toLowerCase","endsWith","setNodeEnv","load","
|
|
1
|
+
{"version":3,"sources":["../../../../src/run/android/runAndroidAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { resolveInstallApkNameAsync } from './resolveInstallApkName';\nimport { Options, ResolvedOptions, resolveOptionsAsync } from './resolveOptions';\nimport { exportEagerAsync } from '../../export/embed/exportEager';\nimport { Log } from '../../log';\nimport type { AndroidOpenInCustomProps } from '../../start/platforms/android/AndroidPlatformManager';\nimport { assembleAsync, installAsync } from '../../start/platforms/android/gradle';\nimport { CommandError } from '../../utils/errors';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport { getSchemesForAndroidAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { resolveRemoteBuildCache, uploadRemoteBuildCache } from '../remoteBuildCache';\nimport { startBundlerAsync } from '../startBundler';\n\nconst debug = require('debug')('expo:run:android');\n\nexport async function runAndroidAsync(projectRoot: string, { install, ...options }: Options) {\n // NOTE: This is a guess, the developer can overwrite with `NODE_ENV`.\n const isProduction = options.variant?.toLowerCase().endsWith('release');\n setNodeEnv(isProduction ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n const projectConfig = getConfig(projectRoot);\n if (!options.binary && projectConfig.exp.experiments?.remoteBuildCache) {\n const localPath = await resolveRemoteBuildCache(projectRoot, {\n platform: 'android',\n provider: projectConfig.exp.experiments?.remoteBuildCache.provider,\n });\n if (localPath) {\n options.binary = localPath;\n }\n }\n\n await ensureNativeProjectAsync(projectRoot, { platform: 'android', install });\n\n const props = await resolveOptionsAsync(projectRoot, options);\n\n debug('Package name: ' + props.packageName);\n Log.log('› Building app...');\n\n const androidProjectRoot = path.join(projectRoot, 'android');\n\n let shouldUpdateBuildCache = false;\n if (!options.binary) {\n let eagerBundleOptions: string | undefined;\n\n if (isProduction) {\n eagerBundleOptions = JSON.stringify(\n await exportEagerAsync(projectRoot, {\n dev: false,\n platform: 'android',\n })\n );\n }\n\n await assembleAsync(androidProjectRoot, {\n variant: props.variant,\n port: props.port,\n appName: props.appName,\n buildCache: props.buildCache,\n architectures: props.architectures,\n eagerBundleOptions,\n });\n shouldUpdateBuildCache = true;\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n }\n\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n // If a scheme is specified then use that instead of the package name.\n scheme: (await getSchemesForAndroidAsync(projectRoot))?.[0],\n headless: !props.shouldStartBundler,\n });\n\n if (options.binary) {\n // Attempt to install the APK from the file path\n const binaryPath = path.join(options.binary);\n\n if (!fs.existsSync(binaryPath)) {\n throw new CommandError(`The path to the custom Android binary does not exist: ${binaryPath}`);\n }\n Log.log(chalk.gray`\\u203A Installing ${binaryPath}`);\n await props.device.installAppAsync(binaryPath);\n } else {\n await installAppAsync(androidProjectRoot, props);\n }\n\n await manager.getDefaultDevServer().openCustomRuntimeAsync<AndroidOpenInCustomProps>(\n 'emulator',\n {\n applicationId: props.packageName,\n customAppId: props.customAppId,\n launchActivity: props.launchActivity,\n },\n { device: props.device.device }\n );\n\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n } else {\n await manager.stopAsync();\n }\n\n if (shouldUpdateBuildCache && projectConfig.exp.experiments?.remoteBuildCache) {\n await uploadRemoteBuildCache(projectRoot, {\n platform: 'android',\n provider: projectConfig.exp.experiments?.remoteBuildCache.provider,\n });\n }\n}\n\nasync function installAppAsync(androidProjectRoot: string, props: ResolvedOptions) {\n // Find the APK file path\n const apkFile = await resolveInstallApkNameAsync(props.device.device, props);\n\n if (apkFile) {\n // Attempt to install the APK from the file path\n const binaryPath = path.join(props.apkVariantDirectory, apkFile);\n Log.log(chalk.gray`\\u203A Installing ${binaryPath}`);\n await props.device.installAppAsync(binaryPath);\n } else {\n // If we cannot resolve the APK file path then we can attempt to install using Gradle.\n // This offers more advanced resolution that we may not have first class support for.\n Log.log('› Failed to locate binary file, installing with Gradle...');\n await installAsync(androidProjectRoot, {\n variant: props.variant ?? 'debug',\n appName: props.appName ?? 'app',\n port: props.port,\n });\n }\n}\n"],"names":["runAndroidAsync","debug","require","projectRoot","install","options","projectConfig","isProduction","variant","toLowerCase","endsWith","setNodeEnv","load","getConfig","binary","exp","experiments","remoteBuildCache","localPath","resolveRemoteBuildCache","platform","provider","ensureNativeProjectAsync","props","resolveOptionsAsync","packageName","Log","log","androidProjectRoot","path","join","shouldUpdateBuildCache","eagerBundleOptions","JSON","stringify","exportEagerAsync","dev","assembleAsync","port","appName","buildCache","architectures","shouldStartBundler","ensurePortAvailabilityAsync","manager","startBundlerAsync","scheme","getSchemesForAndroidAsync","headless","binaryPath","fs","existsSync","CommandError","chalk","gray","device","installAppAsync","getDefaultDevServer","openCustomRuntimeAsync","applicationId","customAppId","launchActivity","logProjectLogsLocation","stopAsync","uploadRemoteBuildCache","apkFile","resolveInstallApkNameAsync","apkVariantDirectory","installAsync"],"mappings":";;;;+BAsBsBA;;;eAAAA;;;;yBAtBI;;;;;;;gEACR;;;;;;;gEACH;;;;;;;gEACE;;;;;;uCAE0B;gCACmB;6BAC7B;qBACb;wBAEwB;wBACf;yBACF;sBACiB;wBACF;qCACD;uBACF;kCACyB;8BAC9B;;;;;;AAElC,MAAMC,QAAQC,QAAQ,SAAS;AAExB,eAAeF,gBAAgBG,WAAmB,EAAE,EAAEC,OAAO,EAAE,GAAGC,SAAkB;QAEpEA,kBAKEC,gCAmDZ,OAiCmBA;IA1F9B,sEAAsE;IACtE,MAAMC,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EAAC7D,aAAa;YACxCiB,UAAU;YACVC,QAAQ,GAAEf,kCAAAA,cAAcS,GAAG,CAACC,WAAW,qBAA7BV,gCAA+BW,gBAAgB,CAACI,QAAQ;QACpE;IACF;AACF;AAEA,eAAemC,gBAAgB5B,kBAA0B,EAAEL,KAAsB;IAC/E,yBAAyB;IACzB,MAAM0C,UAAU,MAAMC,IAAAA,iDAA0B,EAAC3C,MAAMgC,MAAM,CAACA,MAAM,EAAEhC;IAEtE,IAAI0C,SAAS;QACX,gDAAgD;QAChD,MAAMhB,aAAapB,eAAI,CAACC,IAAI,CAACP,MAAM4C,mBAAmB,EAAEF;QACxDvC,QAAG,CAACC,GAAG,CAAC0B,gBAAK,CAACC,IAAI,CAAC,kBAAkB,EAAEL,WAAW,CAAC;QACnD,MAAM1B,MAAMgC,MAAM,CAACC,eAAe,CAACP;IACrC,OAAO;QACL,sFAAsF;QACtF,qFAAqF;QACrFvB,QAAG,CAACC,GAAG,CAAC;QACR,MAAMyC,IAAAA,oBAAY,EAACxC,oBAAoB;YACrCpB,SAASe,MAAMf,OAAO,IAAI;YAC1B+B,SAAShB,MAAMgB,OAAO,IAAI;YAC1BD,MAAMf,MAAMe,IAAI;QAClB;IACF;AACF"}
|
|
@@ -8,6 +8,13 @@ Object.defineProperty(exports, "runIosAsync", {
|
|
|
8
8
|
return runIosAsync;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
function _config() {
|
|
12
|
+
const data = require("@expo/config");
|
|
13
|
+
_config = function() {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
11
18
|
function _spawnasync() {
|
|
12
19
|
const data = /*#__PURE__*/ _interop_require_default(require("@expo/spawn-async"));
|
|
13
20
|
_spawnasync = function() {
|
|
@@ -45,6 +52,7 @@ const _profile = require("../../utils/profile");
|
|
|
45
52
|
const _scheme = require("../../utils/scheme");
|
|
46
53
|
const _ensureNativeProject = require("../ensureNativeProject");
|
|
47
54
|
const _hints = require("../hints");
|
|
55
|
+
const _remoteBuildCache = require("../remoteBuildCache");
|
|
48
56
|
const _startBundler = require("../startBundler");
|
|
49
57
|
const _XcodeBuild = /*#__PURE__*/ _interop_require_wildcard(require("./XcodeBuild"));
|
|
50
58
|
const _launchApp = require("./launchApp");
|
|
@@ -101,7 +109,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
101
109
|
}
|
|
102
110
|
const debug = require('debug')('expo:run:ios');
|
|
103
111
|
async function runIosAsync(projectRoot, options) {
|
|
104
|
-
var _this;
|
|
112
|
+
var _projectConfig_exp_experiments, _this, _projectConfig_exp_experiments1;
|
|
105
113
|
(0, _nodeEnv.setNodeEnv)(options.configuration === 'Release' ? 'production' : 'development');
|
|
106
114
|
require('@expo/env').load(projectRoot);
|
|
107
115
|
assertPlatform();
|
|
@@ -114,6 +122,17 @@ async function runIosAsync(projectRoot, options) {
|
|
|
114
122
|
}
|
|
115
123
|
// Resolve the CLI arguments into useable options.
|
|
116
124
|
const props = await (0, _profile.profile)(_resolveOptions.resolveOptionsAsync)(projectRoot, options);
|
|
125
|
+
const projectConfig = (0, _config().getConfig)(projectRoot);
|
|
126
|
+
if (!options.binary && ((_projectConfig_exp_experiments = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments.remoteBuildCache) && props.isSimulator) {
|
|
127
|
+
var _projectConfig_exp_experiments2;
|
|
128
|
+
const localPath = await (0, _remoteBuildCache.resolveRemoteBuildCache)(projectRoot, {
|
|
129
|
+
platform: 'ios',
|
|
130
|
+
provider: (_projectConfig_exp_experiments2 = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments2.remoteBuildCache.provider
|
|
131
|
+
});
|
|
132
|
+
if (localPath) {
|
|
133
|
+
options.binary = localPath;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
117
136
|
if (options.rebundle) {
|
|
118
137
|
_log.warn(`The --unstable-rebundle flag is experimental and may not work as expected.`);
|
|
119
138
|
// Get the existing binary path to re-bundle the app.
|
|
@@ -157,6 +176,7 @@ async function runIosAsync(projectRoot, options) {
|
|
|
157
176
|
}
|
|
158
177
|
}
|
|
159
178
|
let binaryPath;
|
|
179
|
+
let shouldUpdateBuildCache = false;
|
|
160
180
|
if (options.binary) {
|
|
161
181
|
binaryPath = await (0, _validateExternalBinary.getValidBinaryPathAsync)(options.binary, props);
|
|
162
182
|
_log.log('Using custom binary path:', binaryPath);
|
|
@@ -176,6 +196,7 @@ async function runIosAsync(projectRoot, options) {
|
|
|
176
196
|
// Find the path to the built app binary, this will be used to install the binary
|
|
177
197
|
// on a device.
|
|
178
198
|
binaryPath = await (0, _profile.profile)(_XcodeBuild.getAppBinaryPath)(buildOutput);
|
|
199
|
+
shouldUpdateBuildCache = true;
|
|
179
200
|
}
|
|
180
201
|
debug('Binary path:', binaryPath);
|
|
181
202
|
// Ensure the port hasn't become busy during the build.
|
|
@@ -217,6 +238,13 @@ async function runIosAsync(projectRoot, options) {
|
|
|
217
238
|
} else {
|
|
218
239
|
await manager.stopAsync();
|
|
219
240
|
}
|
|
241
|
+
if (shouldUpdateBuildCache && ((_projectConfig_exp_experiments1 = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments1.remoteBuildCache)) {
|
|
242
|
+
var _projectConfig_exp_experiments3;
|
|
243
|
+
await (0, _remoteBuildCache.uploadRemoteBuildCache)(projectRoot, {
|
|
244
|
+
platform: 'ios',
|
|
245
|
+
provider: (_projectConfig_exp_experiments3 = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments3.remoteBuildCache.provider
|
|
246
|
+
});
|
|
247
|
+
}
|
|
220
248
|
}
|
|
221
249
|
function assertPlatform() {
|
|
222
250
|
if (process.platform !== 'darwin') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/run/ios/runIosAsync.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../../log';\nimport { AppleAppIdResolver } from '../../start/platforms/ios/AppleAppIdResolver';\nimport { maybePromptToSyncPodsAsync } from '../../utils/cocoapods';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport { profile } from '../../utils/profile';\nimport { getSchemesForIosAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { startBundlerAsync } from '../startBundler';\nimport * as XcodeBuild from './XcodeBuild';\nimport { Options } from './XcodeBuild.types';\nimport { getLaunchInfoForBinaryAsync, launchAppAsync } from './launchApp';\nimport { resolveOptionsAsync } from './options/resolveOptions';\nimport { getValidBinaryPathAsync } from './validateExternalBinary';\nimport { exportEagerAsync } from '../../export/embed/exportEager';\nimport { getContainerPathAsync, simctlAsync } from '../../start/platforms/ios/simctl';\nimport { CommandError } from '../../utils/errors';\n\nconst debug = require('debug')('expo:run:ios');\n\nexport async function runIosAsync(projectRoot: string, options: Options) {\n setNodeEnv(options.configuration === 'Release' ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n assertPlatform();\n\n const install = !!options.install;\n\n if ((await ensureNativeProjectAsync(projectRoot, { platform: 'ios', install })) && install) {\n await maybePromptToSyncPodsAsync(projectRoot);\n }\n\n // Resolve the CLI arguments into useable options.\n const props = await profile(resolveOptionsAsync)(projectRoot, options);\n\n if (options.rebundle) {\n Log.warn(`The --unstable-rebundle flag is experimental and may not work as expected.`);\n // Get the existing binary path to re-bundle the app.\n\n let binaryPath: string;\n if (!options.binary) {\n if (!props.isSimulator) {\n throw new Error('Re-bundling on physical devices requires the --binary flag.');\n }\n const appId = await new AppleAppIdResolver(projectRoot).getAppIdAsync();\n const possibleBinaryPath = await getContainerPathAsync(props.device, {\n appId,\n });\n if (!possibleBinaryPath) {\n throw new CommandError(\n `Cannot rebundle because no --binary was provided and no existing binary was found on the device for ID: ${appId}.`\n );\n }\n binaryPath = possibleBinaryPath;\n Log.log('Re-using existing binary path:', binaryPath);\n // Set the binary path to the existing binary path.\n options.binary = binaryPath;\n }\n\n Log.log('Rebundling the Expo config file');\n // Re-bundle the config file the same way the app was originally bundled.\n await spawnAsync('node', [\n path.join(require.resolve('expo-constants/package.json'), '../scripts/getAppConfig.js'),\n projectRoot,\n path.join(options.binary, 'EXConstants.bundle'),\n ]);\n // Re-bundle the app.\n\n const possibleBundleOutput = path.join(options.binary, 'main.jsbundle');\n\n if (fs.existsSync(possibleBundleOutput)) {\n Log.log('Rebundling the app...');\n await exportEagerAsync(projectRoot, {\n resetCache: false,\n dev: false,\n platform: 'ios',\n assetsDest: path.join(options.binary, 'assets'),\n bundleOutput: possibleBundleOutput,\n });\n } else {\n Log.warn('Bundle output not found at expected location:', possibleBundleOutput);\n }\n }\n\n let binaryPath: string;\n if (options.binary) {\n binaryPath = await getValidBinaryPathAsync(options.binary, props);\n Log.log('Using custom binary path:', binaryPath);\n } else {\n let eagerBundleOptions: string | undefined;\n\n if (options.configuration === 'Release') {\n eagerBundleOptions = JSON.stringify(\n await exportEagerAsync(projectRoot, {\n dev: false,\n platform: 'ios',\n })\n );\n }\n\n // Spawn the `xcodebuild` process to create the app binary.\n const buildOutput = await XcodeBuild.buildAsync({\n ...props,\n eagerBundleOptions,\n });\n\n // Find the path to the built app binary, this will be used to install the binary\n // on a device.\n binaryPath = await profile(XcodeBuild.getAppBinaryPath)(buildOutput);\n }\n debug('Binary path:', binaryPath);\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n\n const launchInfo = await getLaunchInfoForBinaryAsync(binaryPath);\n const isCustomBinary = !!options.binary;\n\n // Always close the app before launching on a simulator. Otherwise certain cached resources like the splashscreen will not be available.\n if (props.isSimulator) {\n try {\n await simctlAsync(['terminate', props.device.udid, launchInfo.bundleId]);\n } catch (error) {\n // If we failed it's likely that the app was not running to begin with and we will get an `invalid device` error\n debug('Failed to terminate app (possibly because it was not running):', error);\n }\n }\n\n // Start the dev server which creates all of the required info for\n // launching the app on a simulator.\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n headless: !props.shouldStartBundler,\n // If a scheme is specified then use that instead of the package name.\n\n scheme: isCustomBinary\n ? // If launching a custom binary, use the schemes in the Info.plist.\n launchInfo.schemes[0]\n : // If a scheme is specified then use that instead of the package name.\n (await getSchemesForIosAsync(projectRoot))?.[0],\n });\n\n // Install and launch the app binary on a device.\n await launchAppAsync(\n binaryPath,\n manager,\n {\n isSimulator: props.isSimulator,\n device: props.device,\n shouldStartBundler: props.shouldStartBundler,\n },\n launchInfo.bundleId\n );\n\n // Log the location of the JS logs for the device.\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n } else {\n await manager.stopAsync();\n }\n}\n\nfunction assertPlatform() {\n if (process.platform !== 'darwin') {\n Log.exit(\n chalk`iOS apps can only be built on macOS devices. Use {cyan eas build -p ios} to build in the cloud.`\n );\n }\n}\n"],"names":["runIosAsync","debug","require","projectRoot","options","setNodeEnv","configuration","load","assertPlatform","install","ensureNativeProjectAsync","platform","maybePromptToSyncPodsAsync","props","profile","resolveOptionsAsync","rebundle","Log","warn","binaryPath","binary","isSimulator","Error","appId","AppleAppIdResolver","getAppIdAsync","possibleBinaryPath","getContainerPathAsync","device","CommandError","log","spawnAsync","path","join","resolve","possibleBundleOutput","fs","existsSync","exportEagerAsync","resetCache","dev","assetsDest","bundleOutput","getValidBinaryPathAsync","eagerBundleOptions","JSON","stringify","buildOutput","XcodeBuild","buildAsync","getAppBinaryPath","shouldStartBundler","ensurePortAvailabilityAsync","launchInfo","getLaunchInfoForBinaryAsync","isCustomBinary","simctlAsync","udid","bundleId","error","manager","startBundlerAsync","port","headless","scheme","schemes","getSchemesForIosAsync","launchAppAsync","logProjectLogsLocation","stopAsync","process","exit","chalk"],"mappings":";;;;+BA0BsBA;;;eAAAA;;;;gEA1BC;;;;;;;gEACL;;;;;;;gEACH;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aU,QAAS;QACxFA,MAAMsC,kBAAkB,GAAG;IAC7B;IAEA,MAAME,aAAa,MAAMC,IAAAA,sCAA2B,EAACnC;IACrD,MAAMoC,iBAAiB,CAAC,CAACnD,QAAQgB,MAAM;IAEvC,wIAAwI;IACxI,IAAIP,MAAMQ,WAAW,EAAE;QACrB,IAAI;YACF,MAAMmC,IAAAA,mBAAW,EAAC;gBAAC;gBAAa3C,MAAMe,MAAM,CAAC6B,IAAI;gBAAEJ,WAAWK,QAAQ;aAAC;QACzE,EAAE,OAAOC,OAAO;YACd,gHAAgH;YAChH1D,MAAM,kEAAkE0D;QAC1E;IACF;IAEA,kEAAkE;IAClE,oCAAoC;IACpC,MAAMC,UAAU,MAAMC,IAAAA,+BAAiB,EAAC1D,aAAa;QACnD2D,MAAMjD,MAAMiD,IAAI;QAChBC,UAAU,CAAClD,MAAMsC,kBAAkB;QACnC,sEAAsE;QAEtEa,QAAQT,iBAEJF,WAAWY,OAAO,CAAC,EAAE,IAEpB,QAAA,MAAMC,IAAAA,6BAAqB,EAAC/D,iCAA7B,AAAC,KAA2C,CAAC,EAAE;IACrD;IAEA,iDAAiD;IACjD,MAAMgE,IAAAA,yBAAc,EAClBhD,YACAyC,SACA;QACEvC,aAAaR,MAAMQ,WAAW;QAC9BO,QAAQf,MAAMe,MAAM;QACpBuB,oBAAoBtC,MAAMsC,kBAAkB;IAC9C,GACAE,WAAWK,QAAQ;IAGrB,kDAAkD;IAClD,IAAI7C,MAAMsC,kBAAkB,EAAE;QAC5BiB,IAAAA,6BAAsB;IACxB,OAAO;QACL,MAAMR,QAAQS,SAAS;IACzB;AACF;AAEA,SAAS7D;IACP,IAAI8D,QAAQ3D,QAAQ,KAAK,UAAU;QACjCM,KAAIsD,IAAI,CACNC,IAAAA,gBAAK,CAAA,CAAC,+FAA+F,CAAC;IAE1G;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/run/ios/runIosAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../../log';\nimport { AppleAppIdResolver } from '../../start/platforms/ios/AppleAppIdResolver';\nimport { maybePromptToSyncPodsAsync } from '../../utils/cocoapods';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport { profile } from '../../utils/profile';\nimport { getSchemesForIosAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { uploadRemoteBuildCache, resolveRemoteBuildCache } from '../remoteBuildCache';\nimport { startBundlerAsync } from '../startBundler';\nimport * as XcodeBuild from './XcodeBuild';\nimport { Options } from './XcodeBuild.types';\nimport { getLaunchInfoForBinaryAsync, launchAppAsync } from './launchApp';\nimport { resolveOptionsAsync } from './options/resolveOptions';\nimport { getValidBinaryPathAsync } from './validateExternalBinary';\nimport { exportEagerAsync } from '../../export/embed/exportEager';\nimport { getContainerPathAsync, simctlAsync } from '../../start/platforms/ios/simctl';\nimport { CommandError } from '../../utils/errors';\n\nconst debug = require('debug')('expo:run:ios');\n\nexport async function runIosAsync(projectRoot: string, options: Options) {\n setNodeEnv(options.configuration === 'Release' ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n assertPlatform();\n\n const install = !!options.install;\n\n if ((await ensureNativeProjectAsync(projectRoot, { platform: 'ios', install })) && install) {\n await maybePromptToSyncPodsAsync(projectRoot);\n }\n\n // Resolve the CLI arguments into useable options.\n const props = await profile(resolveOptionsAsync)(projectRoot, options);\n\n const projectConfig = getConfig(projectRoot);\n if (!options.binary && projectConfig.exp.experiments?.remoteBuildCache && props.isSimulator) {\n const localPath = await resolveRemoteBuildCache(projectRoot, {\n platform: 'ios',\n provider: projectConfig.exp.experiments?.remoteBuildCache.provider,\n });\n if (localPath) {\n options.binary = localPath;\n }\n }\n\n if (options.rebundle) {\n Log.warn(`The --unstable-rebundle flag is experimental and may not work as expected.`);\n // Get the existing binary path to re-bundle the app.\n\n let binaryPath: string;\n if (!options.binary) {\n if (!props.isSimulator) {\n throw new Error('Re-bundling on physical devices requires the --binary flag.');\n }\n const appId = await new AppleAppIdResolver(projectRoot).getAppIdAsync();\n const possibleBinaryPath = await getContainerPathAsync(props.device, {\n appId,\n });\n if (!possibleBinaryPath) {\n throw new CommandError(\n `Cannot rebundle because no --binary was provided and no existing binary was found on the device for ID: ${appId}.`\n );\n }\n binaryPath = possibleBinaryPath;\n Log.log('Re-using existing binary path:', binaryPath);\n // Set the binary path to the existing binary path.\n options.binary = binaryPath;\n }\n\n Log.log('Rebundling the Expo config file');\n // Re-bundle the config file the same way the app was originally bundled.\n await spawnAsync('node', [\n path.join(require.resolve('expo-constants/package.json'), '../scripts/getAppConfig.js'),\n projectRoot,\n path.join(options.binary, 'EXConstants.bundle'),\n ]);\n // Re-bundle the app.\n\n const possibleBundleOutput = path.join(options.binary, 'main.jsbundle');\n\n if (fs.existsSync(possibleBundleOutput)) {\n Log.log('Rebundling the app...');\n await exportEagerAsync(projectRoot, {\n resetCache: false,\n dev: false,\n platform: 'ios',\n assetsDest: path.join(options.binary, 'assets'),\n bundleOutput: possibleBundleOutput,\n });\n } else {\n Log.warn('Bundle output not found at expected location:', possibleBundleOutput);\n }\n }\n\n let binaryPath: string;\n let shouldUpdateBuildCache = false;\n if (options.binary) {\n binaryPath = await getValidBinaryPathAsync(options.binary, props);\n Log.log('Using custom binary path:', binaryPath);\n } else {\n let eagerBundleOptions: string | undefined;\n\n if (options.configuration === 'Release') {\n eagerBundleOptions = JSON.stringify(\n await exportEagerAsync(projectRoot, {\n dev: false,\n platform: 'ios',\n })\n );\n }\n\n // Spawn the `xcodebuild` process to create the app binary.\n const buildOutput = await XcodeBuild.buildAsync({\n ...props,\n eagerBundleOptions,\n });\n\n // Find the path to the built app binary, this will be used to install the binary\n // on a device.\n binaryPath = await profile(XcodeBuild.getAppBinaryPath)(buildOutput);\n shouldUpdateBuildCache = true;\n }\n debug('Binary path:', binaryPath);\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n\n const launchInfo = await getLaunchInfoForBinaryAsync(binaryPath);\n const isCustomBinary = !!options.binary;\n\n // Always close the app before launching on a simulator. Otherwise certain cached resources like the splashscreen will not be available.\n if (props.isSimulator) {\n try {\n await simctlAsync(['terminate', props.device.udid, launchInfo.bundleId]);\n } catch (error) {\n // If we failed it's likely that the app was not running to begin with and we will get an `invalid device` error\n debug('Failed to terminate app (possibly because it was not running):', error);\n }\n }\n\n // Start the dev server which creates all of the required info for\n // launching the app on a simulator.\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n headless: !props.shouldStartBundler,\n // If a scheme is specified then use that instead of the package name.\n\n scheme: isCustomBinary\n ? // If launching a custom binary, use the schemes in the Info.plist.\n launchInfo.schemes[0]\n : // If a scheme is specified then use that instead of the package name.\n (await getSchemesForIosAsync(projectRoot))?.[0],\n });\n\n // Install and launch the app binary on a device.\n await launchAppAsync(\n binaryPath,\n manager,\n {\n isSimulator: props.isSimulator,\n device: props.device,\n shouldStartBundler: props.shouldStartBundler,\n },\n launchInfo.bundleId\n );\n\n // Log the location of the JS logs for the device.\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n } else {\n await manager.stopAsync();\n }\n\n if (shouldUpdateBuildCache && projectConfig.exp.experiments?.remoteBuildCache) {\n await uploadRemoteBuildCache(projectRoot, {\n platform: 'ios',\n provider: projectConfig.exp.experiments?.remoteBuildCache.provider,\n });\n }\n}\n\nfunction assertPlatform() {\n if (process.platform !== 'darwin') {\n Log.exit(\n chalk`iOS apps can only be built on macOS devices. Use {cyan eas build -p ios} to build in the cloud.`\n );\n }\n}\n"],"names":["runIosAsync","debug","require","projectRoot","options","projectConfig","setNodeEnv","configuration","load","assertPlatform","install","ensureNativeProjectAsync","platform","maybePromptToSyncPodsAsync","props","profile","resolveOptionsAsync","getConfig","binary","exp","experiments","remoteBuildCache","isSimulator","localPath","resolveRemoteBuildCache","provider","rebundle","Log","warn","binaryPath","Error","appId","AppleAppIdResolver","getAppIdAsync","possibleBinaryPath","getContainerPathAsync","device","CommandError","log","spawnAsync","path","join","resolve","possibleBundleOutput","fs","existsSync","exportEagerAsync","resetCache","dev","assetsDest","bundleOutput","shouldUpdateBuildCache","getValidBinaryPathAsync","eagerBundleOptions","JSON","stringify","buildOutput","XcodeBuild","buildAsync","getAppBinaryPath","shouldStartBundler","ensurePortAvailabilityAsync","launchInfo","getLaunchInfoForBinaryAsync","isCustomBinary","simctlAsync","udid","bundleId","error","manager","startBundlerAsync","port","headless","scheme","schemes","getSchemesForIosAsync","launchAppAsync","logProjectLogsLocation","stopAsync","uploadRemoteBuildCache","process","exit","chalk"],"mappings":";;;;+BA4BsBA;;;eAAAA;;;;yBA5BI;;;;;;;gEACH;;;;;;;gEACL;;;;;;;gEACH;;;;;;;gEACE;;;;;;6DAEI;oCACc;2BACQ;yBAChB;sBACiB;yBACpB;wBACc;qCACG;uBACF;kCACyB;8BAC9B;oEACN;2BAEgC;gCACxB;wCACI;6BACP;wBACkB;wBACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAExB,eAAeF,YAAYG,WAAmB,EAAEC,OAAgB;QAgB9CC,gCAsHhB,OAsBuBA;IA3J9BC,IAAAA,mBAAU,EAACF,QAAQG,aAAa,KAAK,YAAY,eAAe;IAChEL,QAAQ,aAAaM,IAAI,CAACL;IAE1BM;IAEA,MAAMC,UAAU,CAAC,CAACN,QAAQM,OAAO;IAEjC,IAAI,AAAC,MAAMC,IAAAA,6CAAwB,EAACR,aAAa;QAAES,UAAU;QAAOF;IAAQ,MAAOA,SAAS;QAC1F,MAAMG,IAAAA,qCAA0B,EAACV;IACnC;IAEA,kDAAkD;IAClD,MAAMW,QAAQ,MAAMC,I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AA,CAAC,+FAA+F,CAAC;IAE1G;AACF"}
|
|
@@ -0,0 +1,135 @@
|
|
|
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
|
+
resolveRemoteBuildCache: function() {
|
|
13
|
+
return resolveRemoteBuildCache;
|
|
14
|
+
},
|
|
15
|
+
uploadRemoteBuildCache: function() {
|
|
16
|
+
return uploadRemoteBuildCache;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
function _spawnasync() {
|
|
20
|
+
const data = /*#__PURE__*/ _interop_require_default(require("@expo/spawn-async"));
|
|
21
|
+
_spawnasync = function() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
function _fs() {
|
|
27
|
+
const data = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
28
|
+
_fs = function() {
|
|
29
|
+
return data;
|
|
30
|
+
};
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
function _path() {
|
|
34
|
+
const data = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
35
|
+
_path = function() {
|
|
36
|
+
return data;
|
|
37
|
+
};
|
|
38
|
+
return data;
|
|
39
|
+
}
|
|
40
|
+
const _log = require("../log");
|
|
41
|
+
function _interop_require_default(obj) {
|
|
42
|
+
return obj && obj.__esModule ? obj : {
|
|
43
|
+
default: obj
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const debug = require('debug')('expo:run:remote-build');
|
|
47
|
+
async function resolveRemoteBuildCache(projectRoot, { platform, provider }) {
|
|
48
|
+
const Fingerprint = importFingerprintForDev(projectRoot);
|
|
49
|
+
if (!Fingerprint) {
|
|
50
|
+
debug('@expo/fingerprint is not installed in the project, skip checking for remote builds');
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);
|
|
54
|
+
if (provider === 'eas') {
|
|
55
|
+
const easJsonPath = _path().default.join(projectRoot, 'eas.json');
|
|
56
|
+
if (!_fs().default.existsSync(easJsonPath)) {
|
|
57
|
+
debug('eas.json not found, skip checking for remote builds');
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
_log.Log.log(`Searching builds with matching fingerprint on EAS servers`);
|
|
61
|
+
try {
|
|
62
|
+
const results = await (0, _spawnasync().default)('npx', [
|
|
63
|
+
'eas-cli',
|
|
64
|
+
'build:download',
|
|
65
|
+
`--platform=${platform}`,
|
|
66
|
+
`--fingerprint=${fingerprint.hash}`,
|
|
67
|
+
'--non-interactive',
|
|
68
|
+
'--dev-client',
|
|
69
|
+
'--json'
|
|
70
|
+
], {
|
|
71
|
+
cwd: projectRoot
|
|
72
|
+
});
|
|
73
|
+
_log.Log.log(`Successfully downloaded cached build`);
|
|
74
|
+
// {
|
|
75
|
+
// "path": "/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app"
|
|
76
|
+
// }
|
|
77
|
+
const json = JSON.parse(results.stdout.trim());
|
|
78
|
+
return json == null ? void 0 : json.path;
|
|
79
|
+
} catch (error) {
|
|
80
|
+
debug('eas-cli error:', error);
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
async function uploadRemoteBuildCache(projectRoot, { platform, provider }) {
|
|
87
|
+
const Fingerprint = importFingerprintForDev(projectRoot);
|
|
88
|
+
if (!Fingerprint) {
|
|
89
|
+
debug('@expo/fingerprint is not installed in the project, skip checking for remote builds');
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);
|
|
93
|
+
if (provider === 'eas') {
|
|
94
|
+
const easJsonPath = _path().default.join(projectRoot, 'eas.json');
|
|
95
|
+
if (!_fs().default.existsSync(easJsonPath)) {
|
|
96
|
+
debug('eas.json not found, skip checking for remote builds');
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
_log.Log.log('Uploading build to remote cache');
|
|
101
|
+
const results = await (0, _spawnasync().default)('npx', [
|
|
102
|
+
'eas-cli',
|
|
103
|
+
'upload',
|
|
104
|
+
`--platform=${platform}`,
|
|
105
|
+
`--fingerprint=${fingerprint.hash}`,
|
|
106
|
+
'--non-interactive',
|
|
107
|
+
'--json'
|
|
108
|
+
], {
|
|
109
|
+
cwd: projectRoot
|
|
110
|
+
});
|
|
111
|
+
// {
|
|
112
|
+
// "url": "/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app"
|
|
113
|
+
// }
|
|
114
|
+
const json = JSON.parse(results.stdout.trim());
|
|
115
|
+
_log.Log.log(`Build successfully uploaded: ${json == null ? void 0 : json.url}`);
|
|
116
|
+
} catch (error) {
|
|
117
|
+
debug('eas-cli error:', error);
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
function importFingerprintForDev(projectRoot) {
|
|
124
|
+
try {
|
|
125
|
+
return require(require.resolve('@expo/fingerprint', {
|
|
126
|
+
paths: [
|
|
127
|
+
projectRoot
|
|
128
|
+
]
|
|
129
|
+
}));
|
|
130
|
+
} catch {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
//# sourceMappingURL=remoteBuildCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/run/remoteBuildCache.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport spawnAsync from '@expo/spawn-async';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { Log } from '../log';\n\nconst debug = require('debug')('expo:run:remote-build') as typeof console.log;\n\nexport async function resolveRemoteBuildCache(\n projectRoot: string,\n {\n platform,\n provider,\n }: {\n platform: ModPlatform;\n provider?: Required<Required<ExpoConfig>['experiments']>['remoteBuildCache']['provider'];\n }\n): Promise<string | null> {\n const Fingerprint = importFingerprintForDev(projectRoot);\n if (!Fingerprint) {\n debug('@expo/fingerprint is not installed in the project, skip checking for remote builds');\n return null;\n }\n const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);\n\n if (provider === 'eas') {\n const easJsonPath = path.join(projectRoot, 'eas.json');\n if (!fs.existsSync(easJsonPath)) {\n debug('eas.json not found, skip checking for remote builds');\n return null;\n }\n\n Log.log(`Searching builds with matching fingerprint on EAS servers`);\n try {\n const results = await spawnAsync(\n 'npx',\n [\n 'eas-cli',\n 'build:download',\n `--platform=${platform}`,\n `--fingerprint=${fingerprint.hash}`,\n '--non-interactive',\n '--dev-client',\n '--json',\n ],\n {\n cwd: projectRoot,\n }\n );\n\n Log.log(`Successfully downloaded cached build`);\n // {\n // \"path\": \"/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app\"\n // }\n const json = JSON.parse(results.stdout.trim());\n return json?.path;\n } catch (error) {\n debug('eas-cli error:', error);\n return null;\n }\n }\n\n return null;\n}\n\nexport async function uploadRemoteBuildCache(\n projectRoot: string,\n {\n platform,\n provider,\n }: {\n platform: ModPlatform;\n provider?: Required<Required<ExpoConfig>['experiments']>['remoteBuildCache']['provider'];\n }\n): Promise<string | null> {\n const Fingerprint = importFingerprintForDev(projectRoot);\n if (!Fingerprint) {\n debug('@expo/fingerprint is not installed in the project, skip checking for remote builds');\n return null;\n }\n const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);\n\n if (provider === 'eas') {\n const easJsonPath = path.join(projectRoot, 'eas.json');\n if (!fs.existsSync(easJsonPath)) {\n debug('eas.json not found, skip checking for remote builds');\n return null;\n }\n\n try {\n Log.log('Uploading build to remote cache');\n const results = await spawnAsync(\n 'npx',\n [\n 'eas-cli',\n 'upload',\n `--platform=${platform}`,\n `--fingerprint=${fingerprint.hash}`,\n '--non-interactive',\n '--json',\n ],\n {\n cwd: projectRoot,\n }\n );\n // {\n // \"url\": \"/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app\"\n // }\n const json = JSON.parse(results.stdout.trim());\n Log.log(`Build successfully uploaded: ${json?.url}`);\n } catch (error) {\n debug('eas-cli error:', error);\n return null;\n }\n }\n\n return null;\n}\n\nfunction importFingerprintForDev(projectRoot: string): null | typeof import('@expo/fingerprint') {\n try {\n return require(require.resolve('@expo/fingerprint', { paths: [projectRoot] }));\n } catch {\n return null;\n }\n}\n"],"names":["resolveRemoteBuildCache","uploadRemoteBuildCache","debug","require","projectRoot","platform","provider","Fingerprint","importFingerprintForDev","fingerprint","createFingerprintAsync","easJsonPath","path","join","fs","existsSync","Log","log","results","spawnAsync","hash","cwd","json","JSON","parse","stdout","trim","error","url","resolve","paths"],"mappings":";;;;;;;;;;;IAUsBA,uBAAuB;eAAvBA;;IAyDAC,sBAAsB;eAAtBA;;;;gEAjEC;;;;;;;gEACR;;;;;;;gEACE;;;;;;qBAEG;;;;;;AAEpB,MAAMC,QAAQC,QAAQ,SAAS;AAExB,eAAeH,wBACpBI,WAAmB,EACnB,EACEC,QAAQ,EACRC,QAAQ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ACR,MAAMC,UAAU,MAAMC,IAAAA,qBAAU,EAC9B,OACA;gBACE;gBACA;gBACA,CAAC,WAAW,EAAEd,UAAU;gBACxB,CAAC,cAAc,EAAEI,YAAYW,IAAI,EAAE;gBACnC;gBACA;aACD,EACD;gBACEC,KAAKjB;YACP;YAEF,IAAI;YACJ,+KAA+K;YAC/K,IAAI;YACJ,MAAMkB,OAAOC,KAAKC,KAAK,CAACN,QAAQO,MAAM,CAACC,IAAI;YAC3CV,QAAG,CAACC,GAAG,CAAC,CAAC,6BAA6B,EAAEK,wBAAAA,KAAMM,GAAG,EAAE;QACrD,EAAE,OAAOD,OAAO;YACdzB,MAAM,kBAAkByB;YACxB,OAAO;QACT;IACF;IAEA,OAAO;AACT;AAEA,SAASnB,wBAAwBJ,WAAmB;IAClD,IAAI;QACF,OAAOD,QAAQA,QAAQ0B,OAAO,CAAC,qBAAqB;YAAEC,OAAO;gBAAC1B;aAAY;QAAC;IAC7E,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
|
package/build/src/start/index.js
CHANGED
|
@@ -123,7 +123,7 @@ const expoStart = async (argv)=>{
|
|
|
123
123
|
`--localhost Same as --host localhost`,
|
|
124
124
|
``,
|
|
125
125
|
`--offline Skip network requests and use anonymous manifest signatures`,
|
|
126
|
-
`--https Start the dev server with https protocol`,
|
|
126
|
+
(0, _chalk().default)`--https Start the dev server with https protocol. {bold Deprecated in favor of --tunnel}`,
|
|
127
127
|
`--scheme <scheme> Custom URI protocol to use when launching an app`,
|
|
128
128
|
(0, _chalk().default)`-p, --port <number> Port to start the dev server on (does not apply to web or tunnel). {dim Default: 8081}`,
|
|
129
129
|
``,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/start/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../utils/args';\nimport { logCmdError } from '../utils/errors';\n\nexport const expoStart: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clear': Boolean,\n '--max-workers': Number,\n '--no-dev': Boolean,\n '--minify': Boolean,\n '--https': Boolean,\n '--private-key-path': String,\n '--port': Number,\n '--dev-client': Boolean,\n '--scheme': String,\n '--android': Boolean,\n '--ios': Boolean,\n '--web': Boolean,\n '--host': String,\n '--tunnel': Boolean,\n '--lan': Boolean,\n '--localhost': Boolean,\n '--offline': Boolean,\n '--go': Boolean,\n // Aliases\n '-h': '--help',\n '-c': '--clear',\n '-p': '--port',\n '-a': '--android',\n '-i': '--ios',\n '-w': '--web',\n '-m': '--host',\n '-d': '--dev-client',\n '-g': '--go',\n // Alias for adding interop with the Metro docs and RedBox errors.\n '--reset-cache': '--clear',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Start a local dev server for the app`,\n chalk`npx expo start {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `-a, --android Open on a connected Android device`,\n `-i, --ios Open in an iOS simulator`,\n `-w, --web Open in a web browser`,\n ``,\n chalk`-d, --dev-client Launch in a custom native app`,\n chalk`-g, --go Launch in Expo Go`,\n ``,\n `-c, --clear Clear the bundler cache`,\n `--max-workers <number> Maximum number of tasks to allow Metro to spawn`,\n `--no-dev Bundle in production mode`,\n `--minify Minify JavaScript`,\n ``,\n chalk`-m, --host <string> Dev server hosting type. {dim Default: lan}`,\n chalk` {bold lan}: Use the local network`,\n chalk` {bold tunnel}: Use any network by tunnel through ngrok`,\n chalk` {bold localhost}: Connect to the dev server over localhost`,\n `--tunnel Same as --host tunnel`,\n `--lan Same as --host lan`,\n `--localhost Same as --host localhost`,\n ``,\n `--offline Skip network requests and use anonymous manifest signatures`,\n `--https Start the dev server with https protocol`,\n `--scheme <scheme> Custom URI protocol to use when launching an app`,\n chalk`-p, --port <number> Port to start the dev server on (does not apply to web or tunnel). {dim Default: 8081}`,\n ``,\n chalk`--private-key-path <path> Path to private key for code signing. {dim Default: \"private-key.pem\" in the same directory as the certificate specified by the expo-updates configuration in app.json.}`,\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n const projectRoot = getProjectRoot(args);\n\n // NOTE(cedric): `./resolveOptions` loads the expo config when using dev clients, this needs to be initialized before that\n const { setNodeEnv, loadEnvFiles } = await import('../utils/nodeEnv.js');\n setNodeEnv(!args['--no-dev'] ? 'development' : 'production');\n loadEnvFiles(projectRoot);\n\n const { resolveOptionsAsync } = await import('./resolveOptions.js');\n const options = await resolveOptionsAsync(projectRoot, args).catch(logCmdError);\n\n if (options.offline) {\n const { disableNetwork } = await import('../api/settings.js');\n disableNetwork();\n }\n\n const { startAsync } = await import('./startAsync.js');\n return startAsync(projectRoot, options, { webOnly: false }).catch(logCmdError);\n};\n"],"names":["expoStart","argv","args","assertArgs","Boolean","Number","String","printHelp","chalk","join","projectRoot","getProjectRoot","setNodeEnv","loadEnvFiles","resolveOptionsAsync","options","catch","logCmdError","offline","disableNetwork","startAsync","webOnly"],"mappings":";;;;;+BAOaA;;;eAAAA;;;;gEANK;;;;;;sBAGoC;wBAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,MAAMA,YAAqB,OAAOC;IACvC,MAAMC,OAAOC,IAAAA,gBAAU,EACrB;QACE,QAAQ;QACR,UAAUC;QACV,WAAWA;QACX,iBAAiBC;QACjB,YAAYD;QACZ,YAAYA;QACZ,WAAWA;QACX,sBAAsBE;QACtB,UAAUD;QACV,gBAAgBD;QAChB,YAAYE;QACZ,aAAaF;QACb,SAASA;QACT,SAASA;QACT,UAAUE;QACV,YAAYF;QACZ,SAASA;QACT,eAAeA;QACf,aAAaA;QACb,QAAQA;QACR,UAAU;QACV,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,kEAAkE;QAClE,iBAAiB;IACnB,GACAH;IAGF,IAAIC,IAAI,CAAC,SAAS,EAAE;QAClBK,IAAAA,eAAS,EACP,CAAC,oCAAoC,CAAC,EACtCC,IAAAA,gBAAK,CAAA,CAAC,0BAA0B,CAAC,EACjC;YACEA,IAAAA,gBAAK,CAAA,CAAC,uGAAuG,CAAC;YAC9G,CAAC,kEAAkE,CAAC;YACpE,CAAC,wDAAwD,CAAC;YAC1D,CAAC,qDAAqD,CAAC;YACvD,EAAE;YACFA,IAAAA,gBAAK,CAAA,CAAC,6DAA6D,CAAC;YACpEA,IAAAA,gBAAK,CAAA,CAAC,iDAAiD,CAAC;YACxD,EAAE;YACF,CAAC,uDAAuD,CAAC;YACzD,CAAC,+EAA+E,CAAC;YACjF,CAAC,yDAAyD,CAAC;YAC3D,CAAC,iDAAiD,CAAC;YACnD,EAAE;YACFA,IAAAA,gBAAK,CAAA,CAAC,2EAA2E,CAAC;YAClFA,IAAAA,gBAAK,CAAA,CAAC,iEAAiE,CAAC;YACxEA,IAAAA,gBAAK,CAAA,CAAC,sFAAsF,CAAC;YAC7FA,IAAAA,gBAAK,CAAA,CAAC,0FAA0F,CAAC;YACjG,CAAC,qDAAqD,CAAC;YACvD,CAAC,kDAAkD,CAAC;YACpD,CAAC,wDAAwD,CAAC;YAC1D,EAAE;YACF,CAAC,2FAA2F,CAAC;
|
|
1
|
+
{"version":3,"sources":["../../../src/start/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../utils/args';\nimport { logCmdError } from '../utils/errors';\n\nexport const expoStart: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clear': Boolean,\n '--max-workers': Number,\n '--no-dev': Boolean,\n '--minify': Boolean,\n '--https': Boolean,\n '--private-key-path': String,\n '--port': Number,\n '--dev-client': Boolean,\n '--scheme': String,\n '--android': Boolean,\n '--ios': Boolean,\n '--web': Boolean,\n '--host': String,\n '--tunnel': Boolean,\n '--lan': Boolean,\n '--localhost': Boolean,\n '--offline': Boolean,\n '--go': Boolean,\n // Aliases\n '-h': '--help',\n '-c': '--clear',\n '-p': '--port',\n '-a': '--android',\n '-i': '--ios',\n '-w': '--web',\n '-m': '--host',\n '-d': '--dev-client',\n '-g': '--go',\n // Alias for adding interop with the Metro docs and RedBox errors.\n '--reset-cache': '--clear',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Start a local dev server for the app`,\n chalk`npx expo start {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `-a, --android Open on a connected Android device`,\n `-i, --ios Open in an iOS simulator`,\n `-w, --web Open in a web browser`,\n ``,\n chalk`-d, --dev-client Launch in a custom native app`,\n chalk`-g, --go Launch in Expo Go`,\n ``,\n `-c, --clear Clear the bundler cache`,\n `--max-workers <number> Maximum number of tasks to allow Metro to spawn`,\n `--no-dev Bundle in production mode`,\n `--minify Minify JavaScript`,\n ``,\n chalk`-m, --host <string> Dev server hosting type. {dim Default: lan}`,\n chalk` {bold lan}: Use the local network`,\n chalk` {bold tunnel}: Use any network by tunnel through ngrok`,\n chalk` {bold localhost}: Connect to the dev server over localhost`,\n `--tunnel Same as --host tunnel`,\n `--lan Same as --host lan`,\n `--localhost Same as --host localhost`,\n ``,\n `--offline Skip network requests and use anonymous manifest signatures`,\n chalk`--https Start the dev server with https protocol. {bold Deprecated in favor of --tunnel}`,\n `--scheme <scheme> Custom URI protocol to use when launching an app`,\n chalk`-p, --port <number> Port to start the dev server on (does not apply to web or tunnel). {dim Default: 8081}`,\n ``,\n chalk`--private-key-path <path> Path to private key for code signing. {dim Default: \"private-key.pem\" in the same directory as the certificate specified by the expo-updates configuration in app.json.}`,\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n const projectRoot = getProjectRoot(args);\n\n // NOTE(cedric): `./resolveOptions` loads the expo config when using dev clients, this needs to be initialized before that\n const { setNodeEnv, loadEnvFiles } = await import('../utils/nodeEnv.js');\n setNodeEnv(!args['--no-dev'] ? 'development' : 'production');\n loadEnvFiles(projectRoot);\n\n const { resolveOptionsAsync } = await import('./resolveOptions.js');\n const options = await resolveOptionsAsync(projectRoot, args).catch(logCmdError);\n\n if (options.offline) {\n const { disableNetwork } = await import('../api/settings.js');\n disableNetwork();\n }\n\n const { startAsync } = await import('./startAsync.js');\n return startAsync(projectRoot, options, { webOnly: false }).catch(logCmdError);\n};\n"],"names":["expoStart","argv","args","assertArgs","Boolean","Number","String","printHelp","chalk","join","projectRoot","getProjectRoot","setNodeEnv","loadEnvFiles","resolveOptionsAsync","options","catch","logCmdError","offline","disableNetwork","startAsync","webOnly"],"mappings":";;;;;+BAOaA;;;eAAAA;;;;gEANK;;;;;;sBAGoC;wBAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,MAAMA,YAAqB,OAAOC;IACvC,MAAMC,OAAOC,IAAAA,gBAAU,EACrB;QACE,QAAQ;QACR,UAAUC;QACV,WAAWA;QACX,iBAAiBC;QACjB,YAAYD;QACZ,YAAYA;QACZ,WAAWA;QACX,sBAAsBE;QACtB,UAAUD;QACV,gBAAgBD;QAChB,YAAYE;QACZ,aAAaF;QACb,SAASA;QACT,SAASA;QACT,UAAUE;QACV,YAAYF;QACZ,SAASA;QACT,eAAeA;QACf,aAAaA;QACb,QAAQA;QACR,UAAU;QACV,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,kEAAkE;QAClE,iBAAiB;IACnB,GACAH;IAGF,IAAIC,IAAI,CAAC,SAAS,EAAE;QAClBK,IAAAA,eAAS,EACP,CAAC,oCAAoC,CAAC,EACtCC,IAAAA,gBAAK,CAAA,CAAC,0BAA0B,CAAC,EACjC;YACEA,IAAAA,gBAAK,CAAA,CAAC,uGAAuG,CAAC;YAC9G,CAAC,kEAAkE,CAAC;YACpE,CAAC,wDAAwD,CAAC;YAC1D,CAAC,qDAAqD,C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AM,EAAEC,UAAU,EAAE,GAAG,MAAM,mEAAA,QAAO;IACpC,OAAOA,WAAWV,aAAaK,SAAS;QAAEM,SAAS;IAAM,GAAGL,KAAK,CAACC,mBAAW;AAC/E"}
|
|
@@ -57,6 +57,9 @@ async function resolveOptionsAsync(projectRoot, args) {
|
|
|
57
57
|
localhost: args['--localhost'],
|
|
58
58
|
tunnel: args['--tunnel']
|
|
59
59
|
});
|
|
60
|
+
if (args['--https']) {
|
|
61
|
+
_log.Log.warn((0, _chalk().default)`{bold --https} option is deprecated in favor of {bold --tunnel}`);
|
|
62
|
+
}
|
|
60
63
|
// User can force the default target by passing either `--dev-client` or `--go`. They can also
|
|
61
64
|
// swap between them during development by pressing `s`.
|
|
62
65
|
const isUserDefinedDevClient = !!args['--dev-client'] || (args['--go'] == null ? false : !args['--go']);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/start/resolveOptions.ts"],"sourcesContent":["import assert from 'assert';\nimport chalk from 'chalk';\n\nimport { canResolveDevClient, hasDirectDevClientDependency } from './detectDevClient';\nimport { Log } from '../log';\nimport { envIsWebcontainer } from '../utils/env';\nimport { AbortCommandError, CommandError } from '../utils/errors';\nimport { resolvePortAsync } from '../utils/port';\n\nexport type Options = {\n privateKeyPath: string | null;\n android: boolean;\n web: boolean;\n ios: boolean;\n offline: boolean;\n clear: boolean;\n dev: boolean;\n https: boolean;\n maxWorkers: number;\n port: number;\n /** Should instruct the bundler to create minified bundles. */\n minify: boolean;\n devClient: boolean;\n scheme: string | null;\n host: 'localhost' | 'lan' | 'tunnel';\n};\n\nexport async function resolveOptionsAsync(projectRoot: string, args: any): Promise<Options> {\n if (args['--dev-client'] && args['--go']) {\n throw new CommandError('BAD_ARGS', 'Cannot use both --dev-client and --go together.');\n }\n const host = resolveHostType({\n host: args['--host'],\n offline: args['--offline'],\n lan: args['--lan'],\n localhost: args['--localhost'],\n tunnel: args['--tunnel'],\n });\n\n // User can force the default target by passing either `--dev-client` or `--go`. They can also\n // swap between them during development by pressing `s`.\n const isUserDefinedDevClient =\n !!args['--dev-client'] || (args['--go'] == null ? false : !args['--go']);\n\n // If the user didn't specify `--dev-client` or `--go` we check if they have the dev client package\n // in their package.json.\n const isAutoDevClient =\n args['--dev-client'] == null &&\n args['--go'] == null &&\n hasDirectDevClientDependency(projectRoot);\n\n const isDevClient = isAutoDevClient || isUserDefinedDevClient;\n\n const scheme = await resolveSchemeAsync(projectRoot, {\n scheme: args['--scheme'],\n devClient: isDevClient,\n });\n\n return {\n privateKeyPath: args['--private-key-path'] ?? null,\n\n android: !!args['--android'],\n web: !!args['--web'],\n ios: !!args['--ios'],\n offline: !!args['--offline'],\n\n clear: !!args['--clear'],\n dev: !args['--no-dev'],\n https: !!args['--https'],\n maxWorkers: args['--max-workers'],\n port: args['--port'],\n minify: !!args['--minify'],\n\n devClient: isDevClient,\n\n scheme,\n host,\n };\n}\n\nexport async function resolveSchemeAsync(\n projectRoot: string,\n options: { scheme?: string; devClient?: boolean }\n): Promise<string | null> {\n if (typeof options.scheme === 'string') {\n // Use the custom scheme\n return options.scheme ?? null;\n }\n\n if (options.devClient || canResolveDevClient(projectRoot)) {\n const { getOptionalDevClientSchemeAsync } =\n require('../utils/scheme') as typeof import('../utils/scheme');\n // Attempt to find the scheme or warn the user how to setup a custom scheme\n const resolvedScheme = await getOptionalDevClientSchemeAsync(projectRoot);\n if (!resolvedScheme.scheme) {\n if (resolvedScheme.resolution === 'shared') {\n // This can happen if one of the native projects has no URI schemes defined in it.\n // Normally, this should never happen.\n Log.warn(\n chalk`Could not find a shared URI scheme for the dev client between the local {bold /ios} and {bold /android} directories. App launches (QR code, interstitial, terminal keys) may not work as expected. You can configure a custom scheme using the {bold --scheme} option, or by running {bold npx expo prebuild} to regenerate the native directories with URI schemes.`\n );\n } else if (['ios', 'android'].includes(resolvedScheme.resolution)) {\n Log.warn(\n chalk`The {bold /${resolvedScheme.resolution}} project does not contain any URI schemes. Expo CLI will not be able to use links to launch the project. You can configure a custom URI scheme using the {bold --scheme} option.`\n );\n }\n }\n return resolvedScheme.scheme;\n } else {\n // Ensure this is reset when users don't use `--scheme`, `--dev-client` and don't have the `expo-dev-client` package installed.\n return null;\n }\n}\n\n/** Resolve and assert host type options. */\nexport function resolveHostType(options: {\n host?: string;\n offline?: boolean;\n lan?: boolean;\n localhost?: boolean;\n tunnel?: boolean;\n}): 'lan' | 'tunnel' | 'localhost' {\n if (\n [options.offline, options.host, options.lan, options.localhost, options.tunnel].filter((i) => i)\n .length > 1\n ) {\n throw new CommandError(\n 'BAD_ARGS',\n 'Specify at most one of: --offline, --host, --tunnel, --lan, --localhost'\n );\n }\n\n if (options.offline) {\n // Force `lan` in offline mode.\n return 'lan';\n } else if (options.host) {\n assert.match(options.host, /^(lan|tunnel|localhost)$/);\n return options.host as 'lan' | 'tunnel' | 'localhost';\n } else if (options.tunnel) {\n return 'tunnel';\n } else if (options.lan) {\n return 'lan';\n } else if (options.localhost) {\n return 'localhost';\n }\n\n // If no option is provided, and we are running in Stackblitz, enable tunnel by default\n if (envIsWebcontainer()) {\n return 'tunnel';\n }\n\n return 'lan';\n}\n\n/** Resolve the port options for all supported bundlers. */\nexport async function resolvePortsAsync(\n projectRoot: string,\n options: Partial<Pick<Options, 'port' | 'devClient'>>,\n settings: { webOnly?: boolean }\n) {\n const multiBundlerSettings: { webpackPort?: number; metroPort?: number } = {};\n\n if (settings.webOnly) {\n const webpackPort = await resolvePortAsync(projectRoot, {\n defaultPort: options.port,\n // Default web port\n fallbackPort: 19006,\n });\n if (!webpackPort) {\n throw new AbortCommandError();\n }\n multiBundlerSettings.webpackPort = webpackPort;\n } else {\n const fallbackPort = process.env.RCT_METRO_PORT\n ? parseInt(process.env.RCT_METRO_PORT, 10)\n : 8081;\n const metroPort = await resolvePortAsync(projectRoot, {\n defaultPort: options.port,\n fallbackPort,\n });\n if (!metroPort) {\n throw new AbortCommandError();\n }\n multiBundlerSettings.metroPort = metroPort;\n }\n\n return multiBundlerSettings;\n}\n"],"names":["resolveHostType","resolveOptionsAsync","resolvePortsAsync","resolveSchemeAsync","projectRoot","args","CommandError","host","offline","lan","localhost","tunnel","isUserDefinedDevClient","isAutoDevClient","hasDirectDevClientDependency","isDevClient","scheme","devClient","privateKeyPath","android","web","ios","clear","dev","https","maxWorkers","port","minify","options","canResolveDevClient","getOptionalDevClientSchemeAsync","require","resolvedScheme","resolution","Log","warn","chalk","includes","filter","i","length","assert","match","envIsWebcontainer","settings","multiBundlerSettings","webOnly","webpackPort","resolvePortAsync","defaultPort","fallbackPort","AbortCommandError","process","env","RCT_METRO_PORT","parseInt","metroPort"],"mappings":";;;;;;;;;;;IAmHgBA,eAAe;eAAfA;;IAxFMC,mBAAmB;eAAnBA;;IAgIAC,iBAAiB;eAAjBA;;IA3EAC,kBAAkB;eAAlBA;;;;gEAhFH;;;;;;;gEACD;;;;;;iCAEgD;qBAC9C;qBACc;wBACc;sBACf;;;;;;AAoB1B,eAAeF,oBAAoBG,WAAmB,EAAEC,IAAS;IACtE,IAAIA,IAAI,CAAC,eAAe,IAAIA,IAAI,CAAC,OAAO,EAAE;QACxC,MAAM,IAAIC,oBAAY,CAAC,YAAY;IACrC;IACA,MAAMC,OAAOP,gBAAgB;QAC3BO,MAAMF,IAAI,CAAC,SAAS;QACpBG,SAASH,IAAI,CAAC,YAAY;QAC1BI,KAAKJ,IAAI,CAAC,QAAQ;QAClBK,WAAWL,IAAI,CAAC,cAAc;QAC9BM,QAAQN,IAAI,CAAC,WAAW;IAC1B;IAEA,8FAA8F;IAC9F,wDAAwD;IACxD,MAAMO,yBACJ,CAAC,CAACP,IAAI,CAAC,eAAe,IAAKA,CAAAA,IAAI,CAAC,OAAO,IAAI,OAAO,QAAQ,CAACA,IAAI,CAAC,OAAO,AAAD;IAExE,mGAAmG;IACnG,yBAAyB;IACzB,MAAMQ,kBACJR,IAAI,CAAC,eAAe,IAAI,QACxBA,IAAI,CAAC,OAAO,IAAI,QAChBS,IAAAA,6CAA4B,EAACV;I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AAMG,eAAeE,QAAQC,GAAG,CAACC,cAAc,GAC3CC,SAASH,QAAQC,GAAG,CAACC,cAAc,EAAE,MACrC;QACJ,MAAME,YAAY,MAAMR,IAAAA,sBAAgB,EAAC5C,aAAa;YACpD6C,aAAarB,QAAQF,IAAI;YACzBwB;QACF;QACA,IAAI,CAACM,WAAW;YACd,MAAM,IAAIL,yBAAiB;QAC7B;QACAN,qBAAqBW,SAAS,GAAGA;IACnC;IAEA,OAAOX;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../src/start/resolveOptions.ts"],"sourcesContent":["import assert from 'assert';\nimport chalk from 'chalk';\n\nimport { canResolveDevClient, hasDirectDevClientDependency } from './detectDevClient';\nimport { Log } from '../log';\nimport { envIsWebcontainer } from '../utils/env';\nimport { AbortCommandError, CommandError } from '../utils/errors';\nimport { resolvePortAsync } from '../utils/port';\n\nexport type Options = {\n privateKeyPath: string | null;\n android: boolean;\n web: boolean;\n ios: boolean;\n offline: boolean;\n clear: boolean;\n dev: boolean;\n https: boolean;\n maxWorkers: number;\n port: number;\n /** Should instruct the bundler to create minified bundles. */\n minify: boolean;\n devClient: boolean;\n scheme: string | null;\n host: 'localhost' | 'lan' | 'tunnel';\n};\n\nexport async function resolveOptionsAsync(projectRoot: string, args: any): Promise<Options> {\n if (args['--dev-client'] && args['--go']) {\n throw new CommandError('BAD_ARGS', 'Cannot use both --dev-client and --go together.');\n }\n const host = resolveHostType({\n host: args['--host'],\n offline: args['--offline'],\n lan: args['--lan'],\n localhost: args['--localhost'],\n tunnel: args['--tunnel'],\n });\n\n if (args['--https']) {\n Log.warn(chalk`{bold --https} option is deprecated in favor of {bold --tunnel}`);\n }\n\n // User can force the default target by passing either `--dev-client` or `--go`. They can also\n // swap between them during development by pressing `s`.\n const isUserDefinedDevClient =\n !!args['--dev-client'] || (args['--go'] == null ? false : !args['--go']);\n\n // If the user didn't specify `--dev-client` or `--go` we check if they have the dev client package\n // in their package.json.\n const isAutoDevClient =\n args['--dev-client'] == null &&\n args['--go'] == null &&\n hasDirectDevClientDependency(projectRoot);\n\n const isDevClient = isAutoDevClient || isUserDefinedDevClient;\n\n const scheme = await resolveSchemeAsync(projectRoot, {\n scheme: args['--scheme'],\n devClient: isDevClient,\n });\n\n return {\n privateKeyPath: args['--private-key-path'] ?? null,\n\n android: !!args['--android'],\n web: !!args['--web'],\n ios: !!args['--ios'],\n offline: !!args['--offline'],\n\n clear: !!args['--clear'],\n dev: !args['--no-dev'],\n https: !!args['--https'],\n maxWorkers: args['--max-workers'],\n port: args['--port'],\n minify: !!args['--minify'],\n\n devClient: isDevClient,\n\n scheme,\n host,\n };\n}\n\nexport async function resolveSchemeAsync(\n projectRoot: string,\n options: { scheme?: string; devClient?: boolean }\n): Promise<string | null> {\n if (typeof options.scheme === 'string') {\n // Use the custom scheme\n return options.scheme ?? null;\n }\n\n if (options.devClient || canResolveDevClient(projectRoot)) {\n const { getOptionalDevClientSchemeAsync } =\n require('../utils/scheme') as typeof import('../utils/scheme');\n // Attempt to find the scheme or warn the user how to setup a custom scheme\n const resolvedScheme = await getOptionalDevClientSchemeAsync(projectRoot);\n if (!resolvedScheme.scheme) {\n if (resolvedScheme.resolution === 'shared') {\n // This can happen if one of the native projects has no URI schemes defined in it.\n // Normally, this should never happen.\n Log.warn(\n chalk`Could not find a shared URI scheme for the dev client between the local {bold /ios} and {bold /android} directories. App launches (QR code, interstitial, terminal keys) may not work as expected. You can configure a custom scheme using the {bold --scheme} option, or by running {bold npx expo prebuild} to regenerate the native directories with URI schemes.`\n );\n } else if (['ios', 'android'].includes(resolvedScheme.resolution)) {\n Log.warn(\n chalk`The {bold /${resolvedScheme.resolution}} project does not contain any URI schemes. Expo CLI will not be able to use links to launch the project. You can configure a custom URI scheme using the {bold --scheme} option.`\n );\n }\n }\n return resolvedScheme.scheme;\n } else {\n // Ensure this is reset when users don't use `--scheme`, `--dev-client` and don't have the `expo-dev-client` package installed.\n return null;\n }\n}\n\n/** Resolve and assert host type options. */\nexport function resolveHostType(options: {\n host?: string;\n offline?: boolean;\n lan?: boolean;\n localhost?: boolean;\n tunnel?: boolean;\n}): 'lan' | 'tunnel' | 'localhost' {\n if (\n [options.offline, options.host, options.lan, options.localhost, options.tunnel].filter((i) => i)\n .length > 1\n ) {\n throw new CommandError(\n 'BAD_ARGS',\n 'Specify at most one of: --offline, --host, --tunnel, --lan, --localhost'\n );\n }\n\n if (options.offline) {\n // Force `lan` in offline mode.\n return 'lan';\n } else if (options.host) {\n assert.match(options.host, /^(lan|tunnel|localhost)$/);\n return options.host as 'lan' | 'tunnel' | 'localhost';\n } else if (options.tunnel) {\n return 'tunnel';\n } else if (options.lan) {\n return 'lan';\n } else if (options.localhost) {\n return 'localhost';\n }\n\n // If no option is provided, and we are running in Stackblitz, enable tunnel by default\n if (envIsWebcontainer()) {\n return 'tunnel';\n }\n\n return 'lan';\n}\n\n/** Resolve the port options for all supported bundlers. */\nexport async function resolvePortsAsync(\n projectRoot: string,\n options: Partial<Pick<Options, 'port' | 'devClient'>>,\n settings: { webOnly?: boolean }\n) {\n const multiBundlerSettings: { webpackPort?: number; metroPort?: number } = {};\n\n if (settings.webOnly) {\n const webpackPort = await resolvePortAsync(projectRoot, {\n defaultPort: options.port,\n // Default web port\n fallbackPort: 19006,\n });\n if (!webpackPort) {\n throw new AbortCommandError();\n }\n multiBundlerSettings.webpackPort = webpackPort;\n } else {\n const fallbackPort = process.env.RCT_METRO_PORT\n ? parseInt(process.env.RCT_METRO_PORT, 10)\n : 8081;\n const metroPort = await resolvePortAsync(projectRoot, {\n defaultPort: options.port,\n fallbackPort,\n });\n if (!metroPort) {\n throw new AbortCommandError();\n }\n multiBundlerSettings.metroPort = metroPort;\n }\n\n return multiBundlerSettings;\n}\n"],"names":["resolveHostType","resolveOptionsAsync","resolvePortsAsync","resolveSchemeAsync","projectRoot","args","CommandError","host","offline","lan","localhost","tunnel","Log","warn","chalk","isUserDefinedDevClient","isAutoDevClient","hasDirectDevClientDependency","isDevClient","scheme","devClient","privateKeyPath","android","web","ios","clear","dev","https","maxWorkers","port","minify","options","canResolveDevClient","getOptionalDevClientSchemeAsync","require","resolvedScheme","resolution","includes","filter","i","length","assert","match","envIsWebcontainer","settings","multiBundlerSettings","webOnly","webpackPort","resolvePortAsync","defaultPort","fallbackPort","AbortCommandError","process","env","RCT_METRO_PORT","parseInt","metroPort"],"mappings":";;;;;;;;;;;IAuHgBA,eAAe;eAAfA;;IA5FMC,mBAAmB;eAAnBA;;IAoIAC,iBAAiB;eAAjBA;;IA3EAC,kBAAkB;eAAlBA;;;;gEApFH;;;;;;;gEACD;;;;;;iCAEgD;qBAC9C;qBACc;wBACc;sBACf;;;;;;AAoB1B,eAAeF,oBAAoBG,WAAmB,EAAEC,IAAS;IACtE,IAAIA,IAAI,CAAC,eAAe,IAAIA,IAAI,CAAC,OAAO,EAAE;QACxC,MAAM,IAAIC,oBAAY,CAAC,YAAY;IACrC;IACA,MAAMC,OAAOP,gBAAgB;QAC3BO,MAAMF,IAAI,CAAC,SAAS;QACpBG,SAASH,IAAI,CAAC,YAAY;QAC1BI,KAAKJ,IAAI,CAAC,QAAQ;QAClBK,WAAWL,IAAI,CAAC,cAAc;QAC9BM,QAAQN,IAAI,CAAC,WAAW;IAC1B;IAEA,IAAIA,IAAI,CAAC,UAAU,EAAE;QACnBO,QAAG,CAACC,IAAI,CAACC,IAAAA,gBAAK,CAAA,CAAC,+DAA+D,CAAC;IACjF;IAEA,8FAA8F;IAC9F,wDAAwD;IACxD,MAAMC,yBACJ,CAAC,CAACV,IAAI,CAAC,eAAe,IAAKA,CAAAA,IAAI,CAAC,OAAO,IAAI,OAAO,QAAQ,CAACA,IAAI,CAAC,OAAO,AAAD;IAExE,mGAAmG;IACnG,yBAAyB;IACzB,MAAMW,kBACJX,IAAI,CAAC,eAAe,IAAI,QACxBA,IAAI,CAAC,OAAO,IAAI,QAChBY,IAAAA,6CAA4B,EAACb;IAE/B,MAAMc,cAAcF,mBAAmBD;IAEvC,MAAMI,SAAS,MAAMh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SAASH,QAAQC,GAAG,CAACC,cAAc,EAAE,MACrC;QACJ,MAAME,YAAY,MAAMR,IAAAA,sBAAgB,EAAC5C,aAAa;YACpD6C,aAAalB,QAAQF,IAAI;YACzBqB;QACF;QACA,IAAI,CAACM,WAAW;YACd,MAAM,IAAIL,yBAAiB;QAC7B;QACAN,qBAAqBW,SAAS,GAAGA;IACnC;IAEA,OAAOX;AACT"}
|
|
@@ -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/${"0.23.
|
|
36
|
+
'user-agent': `expo-cli/${"0.23.4"}`,
|
|
37
37
|
authorization: 'Basic ' + _nodebuffer().Buffer.from(`${target}:`).toString('base64')
|
|
38
38
|
};
|
|
39
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.4",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@expo/osascript": "^2.2.1",
|
|
53
53
|
"@expo/package-manager": "^1.8.1",
|
|
54
54
|
"@expo/plist": "^0.3.1",
|
|
55
|
-
"@expo/prebuild-config": "^8.1.
|
|
55
|
+
"@expo/prebuild-config": "^8.1.3",
|
|
56
56
|
"@expo/spawn-async": "^1.7.2",
|
|
57
57
|
"@expo/ws-tunnel": "^1.0.1",
|
|
58
58
|
"@expo/xcpretty": "^4.3.0",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"devDependencies": {
|
|
110
110
|
"@expo/multipart-body-parser": "^1.0.0",
|
|
111
111
|
"@expo/ngrok": "4.1.3",
|
|
112
|
-
"@expo/server": "^0.6.
|
|
112
|
+
"@expo/server": "^0.6.2",
|
|
113
113
|
"@graphql-codegen/cli": "^2.16.3",
|
|
114
114
|
"@graphql-codegen/typescript": "^2.8.7",
|
|
115
115
|
"@graphql-codegen/typescript-operations": "^2.5.12",
|
|
@@ -152,5 +152,5 @@
|
|
|
152
152
|
"tree-kill": "^1.2.2",
|
|
153
153
|
"tsd": "^0.28.1"
|
|
154
154
|
},
|
|
155
|
-
"gitHead": "
|
|
155
|
+
"gitHead": "c81263062bf24ad09e51e019f1d7dc29fa651c55"
|
|
156
156
|
}
|