@expo/build-tools 18.7.0 → 18.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/builders/ios.js +15 -2
  2. package/dist/common/easBuildInternal.js +3 -27
  3. package/dist/context.js +3 -1
  4. package/dist/ios/fastlane.d.ts +4 -1
  5. package/dist/ios/fastlane.js +9 -1
  6. package/dist/ios/gymfile.d.ts +5 -2
  7. package/dist/ios/gymfile.js +5 -2
  8. package/dist/steps/easFunctions.js +8 -0
  9. package/dist/steps/functionGroups/build.js +4 -0
  10. package/dist/steps/functions/configureIosCredentials.js +9 -3
  11. package/dist/steps/functions/configureIosVersion.js +32 -14
  12. package/dist/steps/functions/deploy.d.ts +2 -0
  13. package/dist/steps/functions/deploy.js +136 -0
  14. package/dist/steps/functions/eagerBundle.js +1 -1
  15. package/dist/steps/functions/export.d.ts +2 -0
  16. package/dist/steps/functions/export.js +115 -0
  17. package/dist/steps/functions/generateGymfileFromTemplate.js +9 -0
  18. package/dist/steps/functions/installNodeModules.js +1 -1
  19. package/dist/steps/functions/parseXcactivitylog.d.ts +2 -0
  20. package/dist/steps/functions/parseXcactivitylog.js +49 -0
  21. package/dist/steps/functions/prebuild.js +1 -1
  22. package/dist/steps/functions/restoreBuildCache.js +1 -1
  23. package/dist/steps/functions/saveBuildCache.js +1 -1
  24. package/dist/steps/functions/startAgentDeviceRemoteSession.d.ts +2 -0
  25. package/dist/steps/functions/startAgentDeviceRemoteSession.js +181 -0
  26. package/dist/steps/utils/ios/xcactivitylog.d.ts +57 -0
  27. package/dist/steps/utils/ios/xcactivitylog.js +278 -0
  28. package/dist/templates/GymfileArchive.d.ts +1 -1
  29. package/dist/templates/GymfileArchive.js +4 -0
  30. package/dist/templates/GymfileSimulator.d.ts +1 -1
  31. package/dist/templates/GymfileSimulator.js +3 -0
  32. package/dist/utils/easCli.d.ts +11 -0
  33. package/dist/utils/easCli.js +57 -0
  34. package/dist/utils/packageManager.d.ts +4 -1
  35. package/dist/utils/packageManager.js +13 -4
  36. package/package.json +4 -4
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createEasExportBuildFunction = createEasExportBuildFunction;
4
+ const eas_build_job_1 = require("@expo/eas-build-job");
5
+ const steps_1 = require("@expo/steps");
6
+ const packageManager_1 = require("../../utils/packageManager");
7
+ const project_1 = require("../../utils/project");
8
+ function createEasExportBuildFunction() {
9
+ return new steps_1.BuildFunction({
10
+ namespace: 'eas',
11
+ id: 'export',
12
+ name: 'Export',
13
+ __metricsId: 'eas/export',
14
+ inputProviders: [
15
+ steps_1.BuildStepInput.createProvider({
16
+ id: 'output_dir',
17
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
18
+ required: false,
19
+ defaultValue: 'dist',
20
+ }),
21
+ steps_1.BuildStepInput.createProvider({
22
+ id: 'dev',
23
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.BOOLEAN,
24
+ required: false,
25
+ }),
26
+ steps_1.BuildStepInput.createProvider({
27
+ id: 'minify',
28
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.BOOLEAN,
29
+ required: false,
30
+ }),
31
+ steps_1.BuildStepInput.createProvider({
32
+ id: 'dump_assetmap',
33
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.BOOLEAN,
34
+ required: false,
35
+ }),
36
+ steps_1.BuildStepInput.createProvider({
37
+ id: 'ssg',
38
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.BOOLEAN,
39
+ required: false,
40
+ }),
41
+ steps_1.BuildStepInput.createProvider({
42
+ id: 'api_only',
43
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.BOOLEAN,
44
+ required: false,
45
+ }),
46
+ steps_1.BuildStepInput.createProvider({
47
+ id: 'platform',
48
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
49
+ required: false,
50
+ defaultValue: 'web',
51
+ }),
52
+ ],
53
+ outputProviders: [
54
+ steps_1.BuildStepOutput.createProvider({
55
+ id: 'export_dir',
56
+ required: true,
57
+ }),
58
+ ],
59
+ fn: async (stepsCtx, { inputs, outputs, env }) => {
60
+ const outputDir = inputs.output_dir.value;
61
+ const dev = inputs.dev.value;
62
+ const minify = inputs.minify.value;
63
+ const dumpAssetmap = inputs.dump_assetmap.value;
64
+ const ssg = inputs.ssg.value;
65
+ const apiOnly = inputs.api_only.value;
66
+ const platform = inputs.platform.value;
67
+ const packageManager = (0, packageManager_1.resolvePackageManager)(stepsCtx.workingDirectory, { env });
68
+ const exportCommand = getExportCommand({
69
+ outputDir,
70
+ dev,
71
+ minify,
72
+ dumpAssetmap,
73
+ ssg,
74
+ apiOnly,
75
+ platform,
76
+ });
77
+ stepsCtx.logger.info(`Running export command: expo ${exportCommand.join(' ')}`);
78
+ try {
79
+ await (0, project_1.runExpoCliCommand)({
80
+ packageManager,
81
+ args: exportCommand,
82
+ options: {
83
+ cwd: stepsCtx.workingDirectory,
84
+ env,
85
+ logger: stepsCtx.logger,
86
+ stdio: 'pipe',
87
+ },
88
+ });
89
+ outputs.export_dir.set(outputDir);
90
+ }
91
+ catch (error) {
92
+ throw new eas_build_job_1.UserError('EXPO_EXPORT_FAILED', `Export command failed: ${error instanceof Error ? error.message : 'unknown error'}`);
93
+ }
94
+ },
95
+ });
96
+ }
97
+ function getExportCommand({ outputDir, dev, minify, dumpAssetmap, ssg, apiOnly, platform, }) {
98
+ const exportCommand = ['export', '--output-dir', outputDir, '--platform', platform];
99
+ if (dev) {
100
+ exportCommand.push('--dev');
101
+ }
102
+ if (minify === false) {
103
+ exportCommand.push('--no-minify');
104
+ }
105
+ if (dumpAssetmap) {
106
+ exportCommand.push('--dump-assetmap');
107
+ }
108
+ if (ssg === false) {
109
+ exportCommand.push('--no-ssg');
110
+ }
111
+ if (apiOnly) {
112
+ exportCommand.push('--api-only');
113
+ }
114
+ return exportCommand;
115
+ }
@@ -10,6 +10,7 @@ const steps_1 = require("@expo/steps");
10
10
  const template_file_1 = require("@expo/template-file");
11
11
  const assert_1 = __importDefault(require("assert"));
12
12
  const fs_extra_1 = __importDefault(require("fs-extra"));
13
+ const os_1 = __importDefault(require("os"));
13
14
  const path_1 = __importDefault(require("path"));
14
15
  const credentials_1 = require("../utils/ios/credentials/credentials");
15
16
  const manager_1 = __importDefault(require("../utils/ios/credentials/manager"));
@@ -38,6 +39,10 @@ const DEFAULT_CREDENTIALS_TEMPLATE = `
38
39
  disable_xcpretty(true)
39
40
  buildlog_path("<%- LOGS_DIRECTORY %>")
40
41
 
42
+ derived_data_path("<%- DERIVED_DATA_PATH %>")
43
+ result_bundle(true)
44
+ result_bundle_path("<%- RESULT_BUNDLE_PATH %>")
45
+
41
46
  output_directory("<%- OUTPUT_DIRECTORY %>")
42
47
  `;
43
48
  const DEFAULT_SIMULATOR_TEMPLATE = `
@@ -56,6 +61,9 @@ const DEFAULT_SIMULATOR_TEMPLATE = `
56
61
 
57
62
  disable_xcpretty(true)
58
63
  buildlog_path("<%- LOGS_DIRECTORY %>")
64
+
65
+ result_bundle(true)
66
+ result_bundle_path("<%- RESULT_BUNDLE_PATH %>")
59
67
  `;
60
68
  function generateGymfileFromTemplateFunction() {
61
69
  return new steps_1.BuildFunction({
@@ -158,6 +166,7 @@ function generateGymfileFromTemplateFunction() {
158
166
  ICLOUD_CONTAINER_ENVIRONMENT,
159
167
  SCHEME_SIMULATOR_DESTINATION: simulatorDestination,
160
168
  DERIVED_DATA_PATH: './build',
169
+ RESULT_BUNDLE_PATH: path_1.default.join(os_1.default.tmpdir(), `result-bundle-${Date.now()}.xcresult`),
161
170
  ...(PROFILES ? { PROFILES } : {}),
162
171
  ...(credentials
163
172
  ? {
@@ -23,7 +23,7 @@ function createInstallNodeModulesBuildFunction() {
23
23
  }
24
24
  async function installNodeModules(stepCtx, env) {
25
25
  const { logger } = stepCtx;
26
- const packageManager = (0, packageManager_1.resolvePackageManager)(stepCtx.workingDirectory);
26
+ const packageManager = (0, packageManager_1.resolvePackageManager)(stepCtx.workingDirectory, { env });
27
27
  const packagerRunDir = (0, packageManager_1.findPackagerRootDir)(stepCtx.workingDirectory);
28
28
  if (packagerRunDir !== stepCtx.workingDirectory) {
29
29
  const relativeReactNativeProjectDirectory = path_1.default.relative(stepCtx.global.projectTargetDirectory, stepCtx.workingDirectory);
@@ -0,0 +1,2 @@
1
+ import { BuildFunction } from '@expo/steps';
2
+ export declare function parseXcactivitylogFunction(): BuildFunction;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.parseXcactivitylogFunction = parseXcactivitylogFunction;
7
+ const steps_1 = require("@expo/steps");
8
+ const path_1 = __importDefault(require("path"));
9
+ const xcactivitylog_1 = require("../utils/ios/xcactivitylog");
10
+ function parseXcactivitylogFunction() {
11
+ return new steps_1.BuildFunction({
12
+ namespace: 'eas',
13
+ id: 'parse_xcactivitylog',
14
+ name: 'Analyze build performance',
15
+ __metricsId: 'eas/parse_xcactivitylog',
16
+ supportedRuntimePlatforms: [steps_1.BuildRuntimePlatform.DARWIN],
17
+ inputProviders: [
18
+ steps_1.BuildStepInput.createProvider({
19
+ id: 'derived_data_path',
20
+ required: false,
21
+ defaultValue: 'ios/build',
22
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
23
+ }),
24
+ steps_1.BuildStepInput.createProvider({
25
+ id: 'workspace_path',
26
+ required: false,
27
+ defaultValue: 'ios',
28
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
29
+ }),
30
+ steps_1.BuildStepInput.createProvider({
31
+ id: 'xclogparser_version',
32
+ required: false,
33
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
34
+ }),
35
+ ],
36
+ fn: async (stepCtx, { inputs, env }) => {
37
+ const derivedDataPath = inputs.derived_data_path.value;
38
+ const workspacePath = inputs.workspace_path.value;
39
+ const version = inputs.xclogparser_version.value;
40
+ await (0, xcactivitylog_1.parseAndReportXcactivitylog)({
41
+ derivedDataPath: path_1.default.resolve(stepCtx.workingDirectory, derivedDataPath),
42
+ workspacePath: path_1.default.resolve(stepCtx.workingDirectory, workspacePath),
43
+ xclogparserVersion: version,
44
+ logger: stepCtx.logger,
45
+ proxyBaseUrl: env.EAS_BUILD_COCOAPODS_CACHE_URL,
46
+ });
47
+ },
48
+ });
49
+ }
@@ -35,7 +35,7 @@ function createPrebuildBuildFunction() {
35
35
  fn: async (stepCtx, { inputs, env }) => {
36
36
  const { logger } = stepCtx;
37
37
  const appleTeamId = inputs.apple_team_id.value;
38
- const packageManager = (0, packageManager_1.resolvePackageManager)(stepCtx.workingDirectory);
38
+ const packageManager = (0, packageManager_1.resolvePackageManager)(stepCtx.workingDirectory, { env });
39
39
  const defaultPlatform = process.platform === 'darwin' ? 'ios' : 'android';
40
40
  const job = stepCtx.global.staticContext.job;
41
41
  const prebuildCommandArgs = getPrebuildCommandArgs({
@@ -154,7 +154,7 @@ async function restoreCcacheAsync({ logger, workingDirectory, platform, env, sec
154
154
  }
155
155
  }
156
156
  async function restoreGradleCacheAsync({ logger, workingDirectory, env, secrets, }) {
157
- if (env.EXPERIMENTAL_EAS_GRADLE_CACHE !== '1') {
157
+ if (env.EAS_GRADLE_CACHE !== '1') {
158
158
  return;
159
159
  }
160
160
  try {
@@ -112,7 +112,7 @@ async function saveCcacheAsync({ logger, workingDirectory, platform, evictUsedBe
112
112
  }
113
113
  }
114
114
  async function saveGradleCacheAsync({ logger, workingDirectory, env, secrets, }) {
115
- if (env.EXPERIMENTAL_EAS_GRADLE_CACHE !== '1') {
115
+ if (env.EAS_GRADLE_CACHE !== '1') {
116
116
  return;
117
117
  }
118
118
  const gradleCachesPath = path_1.default.join(os_1.default.homedir(), '.gradle', 'caches');
@@ -0,0 +1,2 @@
1
+ import { BuildFunction } from '@expo/steps';
2
+ export declare function createStartAgentDeviceRemoteSessionBuildFunction(): BuildFunction;
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createStartAgentDeviceRemoteSessionBuildFunction = createStartAgentDeviceRemoteSessionBuildFunction;
7
+ const steps_1 = require("@expo/steps");
8
+ const turtle_spawn_1 = __importDefault(require("@expo/turtle-spawn"));
9
+ const node_child_process_1 = __importDefault(require("node:child_process"));
10
+ const node_fs_1 = __importDefault(require("node:fs"));
11
+ const node_os_1 = __importDefault(require("node:os"));
12
+ const node_path_1 = __importDefault(require("node:path"));
13
+ const retry_1 = require("../../utils/retry");
14
+ const AGENT_DEVICE_REPO_URL = 'https://github.com/callstackincubator/agent-device.git';
15
+ const SRC_DIR = '/tmp/agent-device-src';
16
+ const RUN_DIR = '/tmp/agent-device';
17
+ const DAEMON_LOG = node_path_1.default.join(RUN_DIR, 'daemon.log');
18
+ const TUNNEL_LOG = node_path_1.default.join(RUN_DIR, 'cloudflared.log');
19
+ const DAEMON_JSON_PATH = node_path_1.default.join(node_os_1.default.homedir(), '.agent-device', 'daemon.json');
20
+ const XCODE_DEVELOPER_DIR = '/Applications/Xcode.app/Contents/Developer';
21
+ const STARTUP_TIMEOUT_MS = 60_000;
22
+ function createStartAgentDeviceRemoteSessionBuildFunction() {
23
+ return new steps_1.BuildFunction({
24
+ namespace: 'eas',
25
+ id: 'start_agent_device_remote_session',
26
+ name: 'Start agent device remote session',
27
+ __metricsId: 'eas/start_agent_device_remote_session',
28
+ inputProviders: [
29
+ steps_1.BuildStepInput.createProvider({
30
+ id: 'package_version',
31
+ required: false,
32
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
33
+ }),
34
+ ],
35
+ fn: async ({ logger }, { inputs, env }) => {
36
+ const packageVersion = inputs.package_version.value;
37
+ logger.info(`Starting agent-device remote session (version: ${packageVersion ?? 'latest'}).`);
38
+ logger.info(`Preparing runtime directory at ${RUN_DIR}.`);
39
+ await node_fs_1.default.promises.mkdir(RUN_DIR, { recursive: true });
40
+ logger.info(`Selecting Xcode developer directory: ${XCODE_DEVELOPER_DIR}.`);
41
+ await (0, turtle_spawn_1.default)('sudo', ['xcode-select', '-s', XCODE_DEVELOPER_DIR], { env, logger });
42
+ logger.info('Ensuring cloudflared is installed.');
43
+ await ensureCloudflaredInstalledAsync({ env, logger });
44
+ logger.info('Ensuring bun is installed.');
45
+ await ensureBunInstalledAsync({ env, logger });
46
+ logger.info(packageVersion
47
+ ? `Cloning agent-device @ v${packageVersion} into ${SRC_DIR}.`
48
+ : `Cloning agent-device (latest) into ${SRC_DIR}.`);
49
+ await cloneAgentDeviceAsync({ packageVersion, env, logger });
50
+ logger.info('Installing agent-device dependencies.');
51
+ await (0, turtle_spawn_1.default)('bun', ['install', '--production'], {
52
+ cwd: SRC_DIR,
53
+ env,
54
+ logger,
55
+ });
56
+ logger.info(`Launching agent-device daemon (log file: ${DAEMON_LOG}).`);
57
+ await spawnDetachedAsync({
58
+ command: 'bun run src/daemon.ts',
59
+ cwd: SRC_DIR,
60
+ logFile: DAEMON_LOG,
61
+ env: { ...env, AGENT_DEVICE_DAEMON_SERVER_MODE: 'http' },
62
+ logger,
63
+ });
64
+ logger.info(`Waiting for daemon credentials at ${DAEMON_JSON_PATH}.`);
65
+ await waitForFileAsync({
66
+ filePath: DAEMON_JSON_PATH,
67
+ timeoutMs: STARTUP_TIMEOUT_MS,
68
+ description: 'agent-device daemon',
69
+ });
70
+ const { port: daemonPort, token: daemonToken } = readDaemonInfo(DAEMON_JSON_PATH);
71
+ logger.info(`Daemon is listening on port ${daemonPort}; loaded auth token.`);
72
+ logger.info(`Starting cloudflared tunnel to http://localhost:${daemonPort} (log file: ${TUNNEL_LOG}).`);
73
+ await spawnDetachedAsync({
74
+ command: `cloudflared tunnel --url "http://localhost:${daemonPort}"`,
75
+ logFile: TUNNEL_LOG,
76
+ env,
77
+ logger,
78
+ });
79
+ logger.info('Waiting for a public tunnel URL.');
80
+ const tunnelUrl = await waitForMatchInLogAsync({
81
+ logFile: TUNNEL_LOG,
82
+ pattern: /https:\/\/[a-z0-9-]+\.trycloudflare\.com/,
83
+ timeoutMs: STARTUP_TIMEOUT_MS,
84
+ description: 'cloudflared tunnel',
85
+ });
86
+ logger.info(`Tunnel is ready at ${tunnelUrl}.`);
87
+ logger.info('Emitting agent-device credentials for the CLI to pick up:');
88
+ logger.info(`export AGENT_DEVICE_DAEMON_BASE_URL="${tunnelUrl}"`);
89
+ logger.info(`export AGENT_DEVICE_DAEMON_AUTH_TOKEN="${daemonToken}"`);
90
+ logger.info('Remote session is live. Keeping the job alive until the session is stopped.');
91
+ // Keep the turtle job alive so the daemon and tunnel stay reachable
92
+ // until stopDeviceRunSession cancels the run.
93
+ await new Promise(() => { });
94
+ },
95
+ });
96
+ }
97
+ async function ensureCloudflaredInstalledAsync({ env, logger, }) {
98
+ await ensureBrewPackageInstalledAsync({ name: 'cloudflared', env, logger });
99
+ }
100
+ async function ensureBunInstalledAsync({ env, logger, }) {
101
+ await ensureBrewPackageInstalledAsync({ name: 'bun', env, logger });
102
+ }
103
+ async function ensureBrewPackageInstalledAsync({ name, env, logger, }) {
104
+ await (0, turtle_spawn_1.default)('bash', ['-c', `command -v ${name} >/dev/null 2>&1 || HOMEBREW_NO_AUTO_UPDATE=1 brew install ${name}`], { env, logger });
105
+ }
106
+ async function cloneAgentDeviceAsync({ packageVersion, env, logger, }) {
107
+ const branchArgs = packageVersion ? ['--branch', `v${packageVersion}`] : [];
108
+ await (0, turtle_spawn_1.default)('git', ['clone', '--depth', '1', ...branchArgs, AGENT_DEVICE_REPO_URL, SRC_DIR], {
109
+ env,
110
+ logger,
111
+ });
112
+ }
113
+ async function spawnDetachedAsync({ command, cwd, logFile, env, logger, }) {
114
+ // Launch the process fully detached so this function returns immediately and
115
+ // the grandchild survives the step. Stdio goes to a log file so the daemon
116
+ // output can be polled, and we unref so Node doesn't wait on it.
117
+ const fd = node_fs_1.default.openSync(logFile, 'a');
118
+ try {
119
+ const child = node_child_process_1.default.spawn('bash', ['-c', command], {
120
+ cwd,
121
+ env,
122
+ detached: true,
123
+ stdio: ['ignore', fd, fd],
124
+ });
125
+ if (!child.pid) {
126
+ throw new Error(`Failed to spawn detached process: ${command}`);
127
+ }
128
+ child.unref();
129
+ logger.info(`Started detached process (pid ${child.pid}).`);
130
+ }
131
+ finally {
132
+ node_fs_1.default.closeSync(fd);
133
+ }
134
+ }
135
+ async function waitForMatchInLogAsync({ logFile, pattern, timeoutMs, description, }) {
136
+ const deadline = Date.now() + timeoutMs;
137
+ while (Date.now() < deadline) {
138
+ const content = await readFileOrEmptyAsync(logFile);
139
+ const match = pattern.exec(content);
140
+ if (match) {
141
+ return match[1] ?? match[0];
142
+ }
143
+ await (0, retry_1.sleepAsync)(1_000);
144
+ }
145
+ const tail = await readFileOrEmptyAsync(logFile);
146
+ throw new Error(`Timed out waiting for ${description} to start. Last log contents:\n${tail || '<empty>'}`);
147
+ }
148
+ async function waitForFileAsync({ filePath, timeoutMs, description, }) {
149
+ const deadline = Date.now() + timeoutMs;
150
+ while (Date.now() < deadline) {
151
+ try {
152
+ await node_fs_1.default.promises.access(filePath);
153
+ return;
154
+ }
155
+ catch {
156
+ // not yet; keep polling
157
+ }
158
+ await (0, retry_1.sleepAsync)(1_000);
159
+ }
160
+ throw new Error(`Timed out waiting for ${description} to write ${filePath}.`);
161
+ }
162
+ async function readFileOrEmptyAsync(filePath) {
163
+ try {
164
+ return await node_fs_1.default.promises.readFile(filePath, 'utf8');
165
+ }
166
+ catch {
167
+ return '';
168
+ }
169
+ }
170
+ function readDaemonInfo(filePath) {
171
+ const raw = node_fs_1.default.readFileSync(filePath, 'utf8');
172
+ const parsed = JSON.parse(raw);
173
+ if (!parsed ||
174
+ typeof parsed !== 'object' ||
175
+ typeof parsed.httpPort !== 'number' ||
176
+ typeof parsed.token !== 'string') {
177
+ throw new Error(`Expected ${filePath} to contain { "httpPort": <number>, "token": "..." }.`);
178
+ }
179
+ const { httpPort, token } = parsed;
180
+ return { port: httpPort, token };
181
+ }
@@ -0,0 +1,57 @@
1
+ import { bunyan } from '@expo/logger';
2
+ import { z } from 'zod';
3
+ /**
4
+ * Download xclogparser, parse xcactivitylog from derived data, and log a
5
+ * compile metrics report. Never throws — all errors are logged at debug level.
6
+ *
7
+ * Can be called from both the step-based flow (BuildFunction) and the
8
+ * traditional builder flow (runBuildPhase).
9
+ */
10
+ export declare function parseAndReportXcactivitylog({ derivedDataPath, workspacePath, xclogparserVersion, logger, proxyBaseUrl, }: {
11
+ derivedDataPath: string;
12
+ workspacePath: string;
13
+ xclogparserVersion?: string;
14
+ logger: bunyan;
15
+ proxyBaseUrl?: string;
16
+ }): Promise<void>;
17
+ declare const XcactivitylogStepSchemaZ: z.ZodObject<{
18
+ title: z.ZodOptional<z.ZodString>;
19
+ detailStepType: z.ZodOptional<z.ZodString>;
20
+ signature: z.ZodOptional<z.ZodString>;
21
+ duration: z.ZodOptional<z.ZodNumber>;
22
+ startTimestamp: z.ZodOptional<z.ZodNumber>;
23
+ endTimestamp: z.ZodOptional<z.ZodNumber>;
24
+ subSteps: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strip>>>;
25
+ }, z.core.$strip>;
26
+ declare const XcactivitylogDataSchemaZ: z.ZodObject<{
27
+ schema: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
28
+ name: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strip>]>>;
30
+ subSteps: z.ZodOptional<z.ZodArray<z.ZodObject<{
31
+ title: z.ZodOptional<z.ZodString>;
32
+ detailStepType: z.ZodOptional<z.ZodString>;
33
+ signature: z.ZodOptional<z.ZodString>;
34
+ duration: z.ZodOptional<z.ZodNumber>;
35
+ startTimestamp: z.ZodOptional<z.ZodNumber>;
36
+ endTimestamp: z.ZodOptional<z.ZodNumber>;
37
+ subSteps: z.ZodOptional<z.ZodArray<z.ZodObject</*elided*/ any, z.core.$strip>>>;
38
+ }, z.core.$strip>>>;
39
+ }, z.core.$strip>;
40
+ type XcactivitylogStep = z.infer<typeof XcactivitylogStepSchemaZ>;
41
+ type XcactivitylogData = z.infer<typeof XcactivitylogDataSchemaZ>;
42
+ interface TargetMetric {
43
+ moduleName: string;
44
+ taskSeconds: number;
45
+ wallSpan: number;
46
+ activeWallTime: number;
47
+ }
48
+ export declare function isCompileStep(step: Partial<XcactivitylogStep>): boolean;
49
+ export declare function collectTopLevelCompileSteps(step: XcactivitylogStep, results?: XcactivitylogStep[]): XcactivitylogStep[];
50
+ export declare function buildTargetMetrics(data: XcactivitylogData, { minTaskSeconds }?: {
51
+ minTaskSeconds?: number;
52
+ }): {
53
+ results: TargetMetric[];
54
+ totalTaskSeconds: number;
55
+ };
56
+ export declare function formatReport(data: XcactivitylogData): string;
57
+ export {};