@expo/cli 0.16.4 → 0.16.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +2 -2
- package/build/src/prebuild/resolveTemplate.js.map +1 -1
- package/build/src/run/ios/appleDevice/AppleDevice.js +26 -9
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
- package/build/src/start/interface/commandsTable.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +1 -1
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/utils/analytics/getMetroProperties.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/package.json +3 -3
package/build/bin/cli
CHANGED
|
@@ -137,7 +137,7 @@ const args = (0, _arg).default({
|
|
|
137
137
|
});
|
|
138
138
|
if (args["--version"]) {
|
|
139
139
|
// Version is added in the build script.
|
|
140
|
-
console.log("0.16.
|
|
140
|
+
console.log("0.16.6");
|
|
141
141
|
process.exit(0);
|
|
142
142
|
}
|
|
143
143
|
if (args["--non-interactive"]) {
|
|
@@ -271,7 +271,7 @@ commands[command]().then((exec)=>{
|
|
|
271
271
|
logEventAsync("action", {
|
|
272
272
|
action: `expo ${command}`,
|
|
273
273
|
source: "expo/cli",
|
|
274
|
-
source_version: "0.16.
|
|
274
|
+
source_version: "0.16.6"
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
277
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/prebuild/resolveTemplate.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport { Ora } from 'ora';\nimport path from 'path';\nimport semver from 'semver';\n\nimport { fetchAsync } from '../api/rest/client';\nimport * as Log from '../log';\nimport { AbortCommandError, CommandError } from '../utils/errors';\nimport {\n downloadAndExtractNpmModuleAsync,\n extractLocalNpmTarballAsync,\n extractNpmTarballFromUrlAsync,\n} from '../utils/npm';\nimport { isUrlOk } from '../utils/url';\n\nconst debug = require('debug')('expo:prebuild:resolveTemplate') as typeof console.log;\n\ntype RepoInfo = {\n username: string;\n name: string;\n branch: string;\n filePath: string;\n};\n\nexport async function cloneTemplateAsync({\n templateDirectory,\n template,\n exp,\n ora,\n}: {\n templateDirectory: string;\n template?: string;\n exp: Pick<ExpoConfig, 'name' | 'sdkVersion'>;\n ora: Ora;\n}) {\n if (template) {\n await resolveTemplateArgAsync(templateDirectory, ora, exp.name, template);\n } else {\n const templatePackageName = await getTemplateNpmPackageName(exp.sdkVersion);\n await downloadAndExtractNpmModuleAsync(templatePackageName, {\n cwd: templateDirectory,\n name: exp.name,\n });\n }\n}\n\n/** Given an `sdkVersion` like `44.0.0` return a fully qualified NPM package name like: `expo-template-bare-minimum@sdk-44` */\nfunction getTemplateNpmPackageName(sdkVersion?: string): string {\n // When undefined or UNVERSIONED, we use the latest version.\n if (!sdkVersion || sdkVersion === 'UNVERSIONED') {\n Log.log('Using an unspecified Expo SDK version. The latest template will be used.');\n return `expo-template-bare-minimum@latest`;\n }\n return `expo-template-bare-minimum@sdk-${semver.major(sdkVersion)}`;\n}\n\nasync function getRepoInfo(url: any, examplePath?: string): Promise<RepoInfo | undefined> {\n const [, username, name, t, _branch, ...file] = url.pathname.split('/');\n const filePath = examplePath ? examplePath.replace(/^\\//, '') : file.join('/');\n\n // Support repos whose entire purpose is to be an example, e.g.\n // https://github.com/:username/:my-cool-example-repo-name.\n if (t === undefined) {\n const infoResponse = await fetchAsync(`https://api.github.com/repos/${username}/${name}`);\n if (infoResponse.status !== 200) {\n return;\n }\n const info = await infoResponse.json();\n return { username, name, branch: info['default_branch'], filePath };\n }\n\n // If examplePath is available, the branch name takes the entire path\n const branch = examplePath\n ? `${_branch}/${file.join('/')}`.replace(new RegExp(`/${filePath}|/$`), '')\n : _branch;\n\n if (username && name && branch && t === 'tree') {\n return { username, name, branch, filePath };\n }\n return undefined;\n}\n\nfunction hasRepo({ username, name, branch, filePath }: RepoInfo) {\n const contentsUrl = `https://api.github.com/repos/${username}/${name}/contents`;\n const packagePath = `${filePath ? `/${filePath}` : ''}/package.json`;\n\n return isUrlOk(contentsUrl + packagePath + `?ref=${branch}`);\n}\n\nasync function downloadAndExtractRepoAsync(\n root: string,\n { username, name, branch, filePath }: RepoInfo\n): Promise<void> {\n const projectName = path.basename(root);\n\n const strip = filePath ? filePath.split('/').length + 1 : 1;\n\n const url = `https://codeload.github.com/${username}/${name}/tar.gz/${branch}`;\n debug('Downloading tarball from:', url);\n await extractNpmTarballFromUrlAsync(url, {\n cwd: root,\n name: projectName,\n strip,\n fileList: [`${name}-${branch}${filePath ? `/${filePath}` : ''}`],\n });\n}\n\nexport async function resolveTemplateArgAsync(\n templateDirectory: string,\n oraInstance: Ora,\n appName: string,\n template: string,\n templatePath?: string\n) {\n let repoInfo: RepoInfo | undefined;\n\n if (template) {\n // @ts-ignore\n let repoUrl: URL | undefined;\n\n try {\n // @ts-ignore\n repoUrl = new URL(template);\n } catch (error: any) {\n if (error.code !== 'ERR_INVALID_URL') {\n oraInstance.fail(error);\n throw error;\n }\n }\n\n // On Windows, we can actually create a URL from a local path\n // Double-check if the created URL is not a path to avoid mixing up URLs and paths\n if (process.platform === 'win32' && repoUrl && path.isAbsolute(repoUrl.toString())) {\n repoUrl = undefined;\n }\n\n if (!repoUrl) {\n const templatePath = path.resolve(template);\n if (!fs.existsSync(templatePath)) {\n throw new CommandError(`template file does not exist: ${templatePath}`);\n }\n\n await extractLocalNpmTarballAsync(templatePath, { cwd: templateDirectory, name: appName });\n return templateDirectory;\n }\n\n if (repoUrl.origin !== 'https://github.com') {\n oraInstance.fail(\n `Invalid URL: ${chalk.red(\n `\"${template}\"`\n )}. Only GitHub repositories are supported. Please use a GitHub URL and try again.`\n );\n throw new AbortCommandError();\n }\n\n repoInfo = await getRepoInfo(repoUrl, templatePath);\n\n if (!repoInfo) {\n oraInstance.fail(\n `Found invalid GitHub URL: ${chalk.red(`\"${template}\"`)}. Please fix the URL and try again.`\n );\n throw new AbortCommandError();\n }\n\n const found = await hasRepo(repoInfo);\n\n if (!found) {\n oraInstance.fail(\n `Could not locate the repository for ${chalk.red(\n `\"${template}\"`\n )}. Please check that the repository exists and try again.`\n );\n throw new AbortCommandError();\n }\n }\n\n if (repoInfo) {\n oraInstance.text = chalk.bold(\n `Downloading files from repo ${chalk.cyan(template)}. This might take a moment.`\n );\n\n await downloadAndExtractRepoAsync(templateDirectory, repoInfo);\n }\n\n return true;\n}\n"],"names":["cloneTemplateAsync","resolveTemplateArgAsync","Log","debug","require","templateDirectory","template","exp","ora","name","templatePackageName","getTemplateNpmPackageName","sdkVersion","downloadAndExtractNpmModuleAsync","cwd","log","semver","major","getRepoInfo","url","examplePath","username","t","_branch","file","pathname","split","filePath","replace","join","undefined","infoResponse","fetchAsync","status","info","json","branch","RegExp","hasRepo","contentsUrl","packagePath","isUrlOk","downloadAndExtractRepoAsync","root","projectName","path","basename","strip","length","extractNpmTarballFromUrlAsync","fileList","oraInstance","appName","templatePath","repoInfo","repoUrl","URL","error","code","fail","process","platform","isAbsolute","toString","resolve","fs","existsSync","CommandError","extractLocalNpmTarballAsync","origin","chalk","red","AbortCommandError","found","text","bold","cyan"],"mappings":"AAAA;;;;QA0BsBA,kBAAkB,GAAlBA,kBAAkB;QAmFlBC,uBAAuB,GAAvBA,uBAAuB;AA5G3B,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AAEF,IAAA,KAAM,kCAAN,MAAM,EAAA;AACJ,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AAEA,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AACnCC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACiC,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AAK1D,IAAA,IAAc,WAAd,cAAc,CAAA;AACG,IAAA,IAAc,WAAd,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtC,MAAMC,KAA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AAC;SAC/B;QAEDlB,QAAQ,GAAG,MAAMpC,WAAW,CAACqC,OAAO,EAAEF,YAAY,CAAC,CAAC;QAEpD,IAAI,CAACC,QAAQ,EAAE;YACbH,WAAW,CAACQ,IAAI,CACd,CAAC,0BAA0B,EAAEW,MAAK,QAAA,CAACC,GAAG,CAAC,CAAC,CAAC,EAAEjE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAC7F,CAAC;YACF,MAAM,IAAIkE,OAAiB,kBAAA,EAAE,CAAC;SAC/B;QAED,MAAMC,KAAK,GAAG,MAAMnC,OAAO,CAACgB,QAAQ,CAAC,AAAC;QAEtC,IAAI,CAACmB,KAAK,EAAE;YACVtB,WAAW,CAACQ,IAAI,CACd,CAAC,oCAAoC,EAAEW,MAAK,QAAA,CAACC,GAAG,CAC9C,CAAC,CAAC,EAAEjE,QAAQ,CAAC,CAAC,CAAC,CAChB,CAAC,wDAAwD,CAAC,CAC5D,CAAC;YACF,MAAM,IAAIkE,OAAiB,kBAAA,EAAE,CAAC;SAC/B;KACF;IAED,IAAIlB,QAAQ,EAAE;QACZH,WAAW,CAACuB,IAAI,GAAGJ,MAAK,QAAA,CAACK,IAAI,CAC3B,CAAC,4BAA4B,EAAEL,MAAK,QAAA,CAACM,IAAI,CAACtE,QAAQ,CAAC,CAAC,2BAA2B,CAAC,CACjF,CAAC;QAEF,MAAMoC,2BAA2B,CAACrC,iBAAiB,EAAEiD,QAAQ,CAAC,CAAC;KAChE;IAED,OAAO,IAAI,CAAC;CACb"}
|
|
1
|
+
{"version":3,"sources":["../../../src/prebuild/resolveTemplate.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport { Ora } from 'ora';\nimport path from 'path';\nimport semver from 'semver';\n\nimport { fetchAsync } from '../api/rest/client';\nimport * as Log from '../log';\nimport { AbortCommandError, CommandError } from '../utils/errors';\nimport {\n downloadAndExtractNpmModuleAsync,\n extractLocalNpmTarballAsync,\n extractNpmTarballFromUrlAsync,\n} from '../utils/npm';\nimport { isUrlOk } from '../utils/url';\n\nconst debug = require('debug')('expo:prebuild:resolveTemplate') as typeof console.log;\n\ntype RepoInfo = {\n username: string;\n name: string;\n branch: string;\n filePath: string;\n};\n\nexport async function cloneTemplateAsync({\n templateDirectory,\n template,\n exp,\n ora,\n}: {\n templateDirectory: string;\n template?: string;\n exp: Pick<ExpoConfig, 'name' | 'sdkVersion'>;\n ora: Ora;\n}) {\n if (template) {\n await resolveTemplateArgAsync(templateDirectory, ora, exp.name, template);\n } else {\n const templatePackageName = await getTemplateNpmPackageName(exp.sdkVersion);\n await downloadAndExtractNpmModuleAsync(templatePackageName, {\n cwd: templateDirectory,\n name: exp.name,\n });\n }\n}\n\n/** Given an `sdkVersion` like `44.0.0` return a fully qualified NPM package name like: `expo-template-bare-minimum@sdk-44` */\nfunction getTemplateNpmPackageName(sdkVersion?: string): string {\n // When undefined or UNVERSIONED, we use the latest version.\n if (!sdkVersion || sdkVersion === 'UNVERSIONED') {\n Log.log('Using an unspecified Expo SDK version. The latest template will be used.');\n return `expo-template-bare-minimum@latest`;\n }\n return `expo-template-bare-minimum@sdk-${semver.major(sdkVersion)}`;\n}\n\nasync function getRepoInfo(url: any, examplePath?: string): Promise<RepoInfo | undefined> {\n const [, username, name, t, _branch, ...file] = url.pathname.split('/');\n const filePath = examplePath ? examplePath.replace(/^\\//, '') : file.join('/');\n\n // Support repos whose entire purpose is to be an example, e.g.\n // https://github.com/:username/:my-cool-example-repo-name.\n if (t === undefined) {\n const infoResponse = await fetchAsync(`https://api.github.com/repos/${username}/${name}`);\n if (infoResponse.status !== 200) {\n return;\n }\n const info = await infoResponse.json();\n return { username, name, branch: info['default_branch'], filePath };\n }\n\n // If examplePath is available, the branch name takes the entire path\n const branch = examplePath\n ? `${_branch}/${file.join('/')}`.replace(new RegExp(`/${filePath}|/$`), '')\n : _branch;\n\n if (username && name && branch && t === 'tree') {\n return { username, name, branch, filePath };\n }\n return undefined;\n}\n\nfunction hasRepo({ username, name, branch, filePath }: RepoInfo) {\n const contentsUrl = `https://api.github.com/repos/${username}/${name}/contents`;\n const packagePath = `${filePath ? `/${filePath}` : ''}/package.json`;\n\n return isUrlOk(contentsUrl + packagePath + `?ref=${branch}`);\n}\n\nasync function downloadAndExtractRepoAsync(\n root: string,\n { username, name, branch, filePath }: RepoInfo\n): Promise<void> {\n const projectName = path.basename(root);\n\n const strip = filePath ? filePath.split('/').length + 1 : 1;\n\n const url = `https://codeload.github.com/${username}/${name}/tar.gz/${branch}`;\n debug('Downloading tarball from:', url);\n await extractNpmTarballFromUrlAsync(url, {\n cwd: root,\n name: projectName,\n strip,\n fileList: [`${name}-${branch}${filePath ? `/${filePath}` : ''}`],\n });\n}\n\nexport async function resolveTemplateArgAsync(\n templateDirectory: string,\n oraInstance: Ora,\n appName: string,\n template: string,\n templatePath?: string\n) {\n let repoInfo: RepoInfo | undefined;\n\n if (template) {\n // @ts-ignore\n let repoUrl: URL | undefined;\n\n try {\n // @ts-ignore\n repoUrl = new URL(template);\n } catch (error: any) {\n if (error.code !== 'ERR_INVALID_URL') {\n oraInstance.fail(error);\n throw error;\n }\n }\n\n // On Windows, we can actually create a URL from a local path\n // Double-check if the created URL is not a path to avoid mixing up URLs and paths\n if (process.platform === 'win32' && repoUrl && path.isAbsolute(repoUrl.toString())) {\n repoUrl = undefined;\n }\n\n if (!repoUrl) {\n const templatePath = path.resolve(template);\n if (!fs.existsSync(templatePath)) {\n throw new CommandError(`template file does not exist: ${templatePath}`);\n }\n\n await extractLocalNpmTarballAsync(templatePath, { cwd: templateDirectory, name: appName });\n return templateDirectory;\n }\n\n if (repoUrl.origin !== 'https://github.com') {\n oraInstance.fail(\n `Invalid URL: ${chalk.red(\n `\"${template}\"`\n )}. Only GitHub repositories are supported. Please use a GitHub URL and try again.`\n );\n throw new AbortCommandError();\n }\n\n repoInfo = await getRepoInfo(repoUrl, templatePath);\n\n if (!repoInfo) {\n oraInstance.fail(\n `Found invalid GitHub URL: ${chalk.red(`\"${template}\"`)}. Please fix the URL and try again.`\n );\n throw new AbortCommandError();\n }\n\n const found = await hasRepo(repoInfo);\n\n if (!found) {\n oraInstance.fail(\n `Could not locate the repository for ${chalk.red(\n `\"${template}\"`\n )}. Please check that the repository exists and try again.`\n );\n throw new AbortCommandError();\n }\n }\n\n if (repoInfo) {\n oraInstance.text = chalk.bold(\n `Downloading files from repo ${chalk.cyan(template)}. This might take a moment.`\n );\n\n await downloadAndExtractRepoAsync(templateDirectory, repoInfo);\n }\n\n return true;\n}\n"],"names":["cloneTemplateAsync","resolveTemplateArgAsync","Log","debug","require","templateDirectory","template","exp","ora","name","templatePackageName","getTemplateNpmPackageName","sdkVersion","downloadAndExtractNpmModuleAsync","cwd","log","semver","major","getRepoInfo","url","examplePath","username","t","_branch","file","pathname","split","filePath","replace","join","undefined","infoResponse","fetchAsync","status","info","json","branch","RegExp","hasRepo","contentsUrl","packagePath","isUrlOk","downloadAndExtractRepoAsync","root","projectName","path","basename","strip","length","extractNpmTarballFromUrlAsync","fileList","oraInstance","appName","templatePath","repoInfo","repoUrl","URL","error","code","fail","process","platform","isAbsolute","toString","resolve","fs","existsSync","CommandError","extractLocalNpmTarballAsync","origin","chalk","red","AbortCommandError","found","text","bold","cyan"],"mappings":"AAAA;;;;QA0BsBA,kBAAkB,GAAlBA,kBAAkB;QAmFlBC,uBAAuB,GAAvBA,uBAAuB;AA5G3B,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AAEF,IAAA,KAAM,kCAAN,MAAM,EAAA;AACJ,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AAEA,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AACnCC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACiC,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AAK1D,IAAA,IAAc,WAAd,cAAc,CAAA;AACG,IAAA,IAAc,WAAd,cAAc,C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,CACpF,CAAC;YACF,MAAM,IAAIkE,OAAiB,kBAAA,EAAE,CAAC;SAC/B;QAEDlB,QAAQ,GAAG,MAAMpC,WAAW,CAACqC,OAAO,EAAEF,YAAY,CAAC,CAAC;QAEpD,IAAI,CAACC,QAAQ,EAAE;YACbH,WAAW,CAACQ,IAAI,CACd,CAAC,0BAA0B,EAAEW,MAAK,QAAA,CAACC,GAAG,CAAC,CAAC,CAAC,EAAEjE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAC7F,CAAC;YACF,MAAM,IAAIkE,OAAiB,kBAAA,EAAE,CAAC;SAC/B;QAED,MAAMC,KAAK,GAAG,MAAMnC,OAAO,CAACgB,QAAQ,CAAC,AAAC;QAEtC,IAAI,CAACmB,KAAK,EAAE;YACVtB,WAAW,CAACQ,IAAI,CACd,CAAC,oCAAoC,EAAEW,MAAK,QAAA,CAACC,GAAG,CAC9C,CAAC,CAAC,EAAEjE,QAAQ,CAAC,CAAC,CAAC,CAChB,CAAC,wDAAwD,CAAC,CAC5D,CAAC;YACF,MAAM,IAAIkE,OAAiB,kBAAA,EAAE,CAAC;SAC/B;KACF;IAED,IAAIlB,QAAQ,EAAE;QACZH,WAAW,CAACuB,IAAI,GAAGJ,MAAK,QAAA,CAACK,IAAI,CAC3B,CAAC,4BAA4B,EAAEL,MAAK,QAAA,CAACM,IAAI,CAACtE,QAAQ,CAAC,CAAC,2BAA2B,CAAC,CACjF,CAAC;QAEF,MAAMoC,2BAA2B,CAACrC,iBAAiB,EAAEiD,QAAQ,CAAC,CAAC;KAChE;IAED,OAAO,IAAI,CAAC;CACb"}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
exports.getConnectedDevicesAsync = getConnectedDevicesAsync;
|
|
6
6
|
exports.runOnDevice = runOnDevice;
|
|
7
|
+
exports.launchAppWithDeviceCtl = launchAppWithDeviceCtl;
|
|
7
8
|
var _debug = _interopRequireDefault(require("debug"));
|
|
8
9
|
var _fs = _interopRequireDefault(require("fs"));
|
|
9
10
|
var _path = _interopRequireDefault(require("path"));
|
|
@@ -161,15 +162,31 @@ async function launchAppWithUsbmux(clientManager, { appInfo , detach }) {
|
|
|
161
162
|
throw new _errors.CommandError("Unable to launch app, number of tries exceeded");
|
|
162
163
|
}
|
|
163
164
|
async function launchAppWithDeviceCtl(deviceId, bundleId) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
165
|
+
try {
|
|
166
|
+
await (0, _xcrun).xcrunAsync([
|
|
167
|
+
"devicectl",
|
|
168
|
+
"device",
|
|
169
|
+
"process",
|
|
170
|
+
"launch",
|
|
171
|
+
"--device",
|
|
172
|
+
deviceId,
|
|
173
|
+
bundleId
|
|
174
|
+
]);
|
|
175
|
+
} catch (error) {
|
|
176
|
+
if ("stderr" in error) {
|
|
177
|
+
const errorCodes = getDeviceCtlErrorCodes(error.stderr);
|
|
178
|
+
if (errorCodes.includes("Locked")) {
|
|
179
|
+
throw new _errors.CommandError("APPLE_DEVICE_LOCKED", "Device is locked, unlock and try again.");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
throw new _errors.CommandError(`There was an error launching app: ${error}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/** Find all error codes from the output log */ function getDeviceCtlErrorCodes(log) {
|
|
186
|
+
return [
|
|
187
|
+
...log.matchAll(/BSErrorCodeDescription\s+=\s+(.*)$/gim)
|
|
188
|
+
].map(([_line, code])=>code
|
|
189
|
+
);
|
|
173
190
|
}
|
|
174
191
|
/**
|
|
175
192
|
* iOS 17 introduces a new protocol called RemoteXPC.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/run/ios/appleDevice/AppleDevice.ts"],"sourcesContent":["import Debug from 'debug';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { ClientManager } from './ClientManager';\nimport { IPLookupResult, OnInstallProgressCallback } from './client/InstallationProxyClient';\nimport { LockdowndClient } from './client/LockdowndClient';\nimport { UsbmuxdClient } from './client/UsbmuxdClient';\nimport { AFC_STATUS, AFCError } from './protocol/AFCProtocol';\nimport { Log } from '../../../log';\nimport { XcodeDeveloperDiskImagePrerequisite } from '../../../start/doctor/apple/XcodeDeveloperDiskImagePrerequisite';\nimport { xcrunAsync } from '../../../start/platforms/ios/xcrun';\nimport { delayAsync } from '../../../utils/delay';\nimport { CommandError } from '../../../utils/errors';\nimport { installExitHooks } from '../../../utils/exit';\n\nconst debug = Debug('expo:apple-device');\n\n// NOTE(EvanBacon): I have a feeling this shape will change with new iOS versions (tested against iOS 15).\nexport interface ConnectedDevice {\n /** @example `00008101-001964A22629003A` */\n udid: string;\n /** @example `Evan's phone` */\n name: string;\n /** @example `iPhone13,4` */\n model: string;\n /** @example `device` */\n deviceType: 'device' | 'catalyst';\n /** @example `USB` */\n connectionType: 'USB' | 'Network';\n /** @example `15.4.1` */\n osVersion: string;\n}\n\n/** @returns a list of connected Apple devices. */\nexport async function getConnectedDevicesAsync(): Promise<ConnectedDevice[]> {\n const client = new UsbmuxdClient(UsbmuxdClient.connectUsbmuxdSocket());\n const devices = await client.getDevices();\n client.socket.end();\n\n return Promise.all(\n devices.map(async (device): Promise<ConnectedDevice> => {\n const socket = await new UsbmuxdClient(UsbmuxdClient.connectUsbmuxdSocket()).connect(\n device,\n 62078\n );\n const deviceValues = await new LockdowndClient(socket).getAllValues();\n socket.end();\n // TODO(EvanBacon): Add support for osType (ipad, watchos, etc)\n return {\n // TODO(EvanBacon): Better name\n name: deviceValues.DeviceName ?? deviceValues.ProductType ?? 'unknown iOS device',\n model: deviceValues.ProductType,\n osVersion: deviceValues.ProductVersion,\n deviceType: 'device',\n connectionType: device.Properties.ConnectionType,\n udid: device.Properties.SerialNumber,\n };\n })\n );\n}\n\n/** Install and run an Apple app binary on a connected Apple device. */\nexport async function runOnDevice({\n udid,\n appPath,\n bundleId,\n waitForApp,\n deltaPath,\n onProgress,\n}: {\n /** Apple device UDID */\n udid: string;\n /** File path to the app binary (ipa) */\n appPath: string;\n /** Bundle identifier for the app at `appPath` */\n bundleId: string;\n /** Wait for the app to launch before returning */\n waitForApp: boolean;\n /** File path to the app deltas folder to use for faster subsequent installs */\n deltaPath: string;\n /** Callback to be called with progress updates */\n onProgress: OnInstallProgressCallback;\n}) {\n const clientManager = await ClientManager.create(udid);\n\n try {\n await mountDeveloperDiskImage(clientManager);\n\n const packageName = path.basename(appPath);\n const destPackagePath = path.join('PublicStaging', packageName);\n\n await uploadApp(clientManager, { appBinaryPath: appPath, destinationPath: destPackagePath });\n\n const installer = await clientManager.getInstallationProxyClient();\n await installer.installApp(\n destPackagePath,\n bundleId,\n {\n // https://github.com/ios-control/ios-deploy/blob/0f2ffb1e564aa67a2dfca7cdf13de47ce489d835/src/ios-deploy/ios-deploy.m#L2491-L2508\n ApplicationsType: 'Any',\n\n CFBundleIdentifier: bundleId,\n CloseOnInvalidate: '1',\n InvalidateOnDetach: '1',\n IsUserInitiated: '1',\n // Disable checking for wifi devices, this is nominally faster.\n PreferWifi: '0',\n // Only info I could find on these:\n // https://github.com/wwxxyx/Quectel_BG96/blob/310876f90fc1093a59e45e381160eddcc31697d0/Apple_Homekit/homekit_certification_tools/ATS%206/ATS%206/ATS.app/Contents/Frameworks/CaptureKit.framework/Versions/A/Resources/MobileDevice/MobileInstallation.h#L112-L121\n PackageType: 'Developer',\n ShadowParentKey: deltaPath,\n // SkipUninstall: '1'\n },\n onProgress\n );\n\n const {\n // TODO(EvanBacon): This can be undefined when querying App Clips.\n [bundleId]: appInfo,\n } = await installer.lookupApp([bundleId]);\n\n if (appInfo) {\n // launch fails with EBusy or ENotFound if you try to launch immediately after install\n await delayAsync(200);\n const debugServerClient = await launchApp(clientManager, {\n bundleId,\n appInfo,\n detach: !waitForApp,\n });\n\n if (waitForApp && debugServerClient) {\n installExitHooks(async () => {\n // causes continue() to return\n debugServerClient.halt();\n // give continue() time to return response\n await delayAsync(64);\n });\n\n debug(`Waiting for app to close...\\n`);\n const result = await debugServerClient.continue();\n // TODO: I have no idea what this packet means yet (successful close?)\n // if not a close (ie, most likely due to halt from onBeforeExit), then kill the app\n if (result !== 'W00') {\n await debugServerClient.kill();\n }\n }\n } else {\n Log.warn(`App \"${bundleId}\" installed but couldn't be launched. Open on device manually.`);\n }\n } finally {\n clientManager.end();\n }\n}\n\n/** Mount the developer disk image for Xcode. */\nasync function mountDeveloperDiskImage(clientManager: ClientManager) {\n const imageMounter = await clientManager.getMobileImageMounterClient();\n // Check if already mounted. If not, mount.\n if (!(await imageMounter.lookupImage()).ImageSignature) {\n // verify DeveloperDiskImage exists (TODO: how does this work on Windows/Linux?)\n // TODO: if windows/linux, download?\n const version = await (await clientManager.getLockdowndClient()).getValue('ProductVersion');\n const developerDiskImagePath = await XcodeDeveloperDiskImagePrerequisite.instance.assertAsync({\n version,\n });\n const developerDiskImageSig = fs.readFileSync(`${developerDiskImagePath}.signature`);\n await imageMounter.uploadImage(developerDiskImagePath, developerDiskImageSig);\n await imageMounter.mountImage(developerDiskImagePath, developerDiskImageSig);\n }\n}\n\nasync function uploadApp(\n clientManager: ClientManager,\n { appBinaryPath, destinationPath }: { appBinaryPath: string; destinationPath: string }\n) {\n const afcClient = await clientManager.getAFCClient();\n try {\n await afcClient.getFileInfo('PublicStaging');\n } catch (err: any) {\n if (err instanceof AFCError && err.status === AFC_STATUS.OBJECT_NOT_FOUND) {\n await afcClient.makeDirectory('PublicStaging');\n } else {\n throw err;\n }\n }\n await afcClient.uploadDirectory(appBinaryPath, destinationPath);\n}\n\nasync function launchAppWithUsbmux(\n clientManager: ClientManager,\n { appInfo, detach }: { appInfo: IPLookupResult[string]; detach?: boolean }\n) {\n let tries = 0;\n while (tries < 3) {\n const debugServerClient = await clientManager.getDebugserverClient();\n await debugServerClient.setMaxPacketSize(1024);\n await debugServerClient.setWorkingDir(appInfo.Container);\n await debugServerClient.launchApp(appInfo.Path, appInfo.CFBundleExecutable);\n\n const result = await debugServerClient.checkLaunchSuccess();\n if (result === 'OK') {\n if (detach) {\n // https://github.com/libimobiledevice/libimobiledevice/blob/25059d4c7d75e03aab516af2929d7c6e6d4c17de/tools/idevicedebug.c#L455-L464\n const res = await debugServerClient.sendCommand('D', []);\n debug('Disconnect from debug server request:', res);\n if (res !== 'OK') {\n console.warn(\n 'Something went wrong while attempting to disconnect from iOS debug server, you may need to reopen the app manually.'\n );\n }\n }\n\n return debugServerClient;\n } else if (result === 'EBusy' || result === 'ENotFound') {\n debug('Device busy or app not found, trying to launch again in .5s...');\n tries++;\n debugServerClient.socket.end();\n await delayAsync(500);\n } else {\n throw new CommandError(`There was an error launching app: ${result}`);\n }\n }\n throw new CommandError('Unable to launch app, number of tries exceeded');\n}\n\nasync function launchAppWithDeviceCtl(deviceId: string, bundleId: string) {\n await xcrunAsync(['devicectl', 'device', 'process', 'launch', '--device', deviceId, bundleId]);\n}\n\n/**\n * iOS 17 introduces a new protocol called RemoteXPC.\n * This is not yet implemented, so we fallback to devicectl.\n *\n * @see https://github.com/doronz88/pymobiledevice3/blob/master/misc/RemoteXPC.md#process-remoted\n */\nasync function launchApp(\n clientManager: ClientManager,\n {\n bundleId,\n appInfo,\n detach,\n }: { bundleId: string; appInfo: IPLookupResult[string]; detach?: boolean }\n) {\n try {\n return await launchAppWithUsbmux(clientManager, { appInfo, detach });\n } catch (error) {\n debug('Failed to launch app with Usbmuxd, falling back to xcrun...', error);\n\n // Get the device UDID and close the connection, to allow `xcrun devicectl` to connect\n const deviceId = clientManager.device.Properties.SerialNumber;\n clientManager.end();\n\n // Fallback to devicectl for iOS 17 support\n return await launchAppWithDeviceCtl(deviceId, bundleId);\n }\n}\n"],"names":["getConnectedDevicesAsync","runOnDevice","debug","Debug","client","UsbmuxdClient","connectUsbmuxdSocket","devices","getDevices","socket","end","Promise","all","map","device","connect","deviceValues","LockdowndClient","getAllValues","name","DeviceName","ProductType","model","osVersion","ProductVersion","deviceType","connectionType","Properties","ConnectionType","udid","SerialNumber","appPath","bundleId","waitForApp","deltaPath","onProgress","clientManager","ClientManager","create","mountDeveloperDiskImage","packageName","path","basename","destPackagePath","join","uploadApp","appBinaryPath","destinationPath","installer","getInstallationProxyClient","installApp","ApplicationsType","CFBundleIdentifier","CloseOnInvalidate","InvalidateOnDetach","IsUserInitiated","PreferWifi","PackageType","ShadowParentKey","appInfo","lookupApp","delayAsync","debugServerClient","launchApp","detach","installExitHooks","halt","result","continue","kill","Log","warn","imageMounter","getMobileImageMounterClient","lookupImage","ImageSignature","version","getLockdowndClient","getValue","developerDiskImagePath","XcodeDeveloperDiskImagePrerequisite","instance","assertAsync","developerDiskImageSig","fs","readFileSync","uploadImage","mountImage","afcClient","getAFCClient","getFileInfo","err","AFCError","status","AFC_STATUS","OBJECT_NOT_FOUND","makeDirectory","uploadDirectory","launchAppWithUsbmux","tries","getDebugserverClient","setMaxPacketSize","setWorkingDir","Container","Path","CFBundleExecutable","checkLaunchSuccess","res","sendCommand","console","CommandError","launchAppWithDeviceCtl","deviceId","xcrunAsync","error"],"mappings":"AAAA;;;;QAmCsBA,wBAAwB,GAAxBA,wBAAwB;QA4BxBC,WAAW,GAAXA,WAAW;AA/Df,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEO,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AAEf,IAAA,gBAA0B,WAA1B,0BAA0B,CAAA;AAC5B,IAAA,cAAwB,WAAxB,wBAAwB,CAAA;AACjB,IAAA,YAAwB,WAAxB,wBAAwB,CAAA;AACzC,IAAA,IAAc,WAAd,cAAc,CAAA;AACkB,IAAA,oCAAiE,WAAjE,iEAAiE,CAAA;AAC1F,IAAA,MAAoC,WAApC,oCAAoC,CAAA;AACpC,IAAA,MAAsB,WAAtB,sBAAsB,CAAA;AACpB,I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AAE,QAAQ;QAAE,UAAU;QAAED,QAAQ;QAAEhF,QAAQ;KAAC,CAAC,CAAC;CAChG;AAED;;;;;GAKG,CACH,eAAe+B,SAAS,CACtB3B,aAA4B,EAC5B,EACEJ,QAAQ,CAAA,EACR2B,OAAO,CAAA,EACPK,MAAM,CAAA,EACkE,EAC1E;IACA,IAAI;QACF,OAAO,MAAMkC,mBAAmB,CAAC9D,aAAa,EAAE;YAAEuB,OAAO;YAAEK,MAAM;SAAE,CAAC,CAAC;KACtE,CAAC,OAAOkD,KAAK,EAAE;QACdhH,KAAK,CAAC,6DAA6D,EAAEgH,KAAK,CAAC,CAAC;QAE5E,sFAAsF;QACtF,MAAMF,QAAQ,GAAG5E,aAAa,CAACtB,MAAM,CAACa,UAAU,CAACG,YAAY,AAAC;QAC9DM,aAAa,CAAC1B,GAAG,EAAE,CAAC;QAEpB,2CAA2C;QAC3C,OAAO,MAAMqG,sBAAsB,CAACC,QAAQ,EAAEhF,QAAQ,CAAC,CAAC;KACzD;CACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/run/ios/appleDevice/AppleDevice.ts"],"sourcesContent":["import Debug from 'debug';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { ClientManager } from './ClientManager';\nimport { IPLookupResult, OnInstallProgressCallback } from './client/InstallationProxyClient';\nimport { LockdowndClient } from './client/LockdowndClient';\nimport { UsbmuxdClient } from './client/UsbmuxdClient';\nimport { AFC_STATUS, AFCError } from './protocol/AFCProtocol';\nimport { Log } from '../../../log';\nimport { XcodeDeveloperDiskImagePrerequisite } from '../../../start/doctor/apple/XcodeDeveloperDiskImagePrerequisite';\nimport { xcrunAsync } from '../../../start/platforms/ios/xcrun';\nimport { delayAsync } from '../../../utils/delay';\nimport { CommandError } from '../../../utils/errors';\nimport { installExitHooks } from '../../../utils/exit';\n\nconst debug = Debug('expo:apple-device');\n\n// NOTE(EvanBacon): I have a feeling this shape will change with new iOS versions (tested against iOS 15).\nexport interface ConnectedDevice {\n /** @example `00008101-001964A22629003A` */\n udid: string;\n /** @example `Evan's phone` */\n name: string;\n /** @example `iPhone13,4` */\n model: string;\n /** @example `device` */\n deviceType: 'device' | 'catalyst';\n /** @example `USB` */\n connectionType: 'USB' | 'Network';\n /** @example `15.4.1` */\n osVersion: string;\n}\n\n/** @returns a list of connected Apple devices. */\nexport async function getConnectedDevicesAsync(): Promise<ConnectedDevice[]> {\n const client = new UsbmuxdClient(UsbmuxdClient.connectUsbmuxdSocket());\n const devices = await client.getDevices();\n client.socket.end();\n\n return Promise.all(\n devices.map(async (device): Promise<ConnectedDevice> => {\n const socket = await new UsbmuxdClient(UsbmuxdClient.connectUsbmuxdSocket()).connect(\n device,\n 62078\n );\n const deviceValues = await new LockdowndClient(socket).getAllValues();\n socket.end();\n // TODO(EvanBacon): Add support for osType (ipad, watchos, etc)\n return {\n // TODO(EvanBacon): Better name\n name: deviceValues.DeviceName ?? deviceValues.ProductType ?? 'unknown iOS device',\n model: deviceValues.ProductType,\n osVersion: deviceValues.ProductVersion,\n deviceType: 'device',\n connectionType: device.Properties.ConnectionType,\n udid: device.Properties.SerialNumber,\n };\n })\n );\n}\n\n/** Install and run an Apple app binary on a connected Apple device. */\nexport async function runOnDevice({\n udid,\n appPath,\n bundleId,\n waitForApp,\n deltaPath,\n onProgress,\n}: {\n /** Apple device UDID */\n udid: string;\n /** File path to the app binary (ipa) */\n appPath: string;\n /** Bundle identifier for the app at `appPath` */\n bundleId: string;\n /** Wait for the app to launch before returning */\n waitForApp: boolean;\n /** File path to the app deltas folder to use for faster subsequent installs */\n deltaPath: string;\n /** Callback to be called with progress updates */\n onProgress: OnInstallProgressCallback;\n}) {\n const clientManager = await ClientManager.create(udid);\n\n try {\n await mountDeveloperDiskImage(clientManager);\n\n const packageName = path.basename(appPath);\n const destPackagePath = path.join('PublicStaging', packageName);\n\n await uploadApp(clientManager, { appBinaryPath: appPath, destinationPath: destPackagePath });\n\n const installer = await clientManager.getInstallationProxyClient();\n await installer.installApp(\n destPackagePath,\n bundleId,\n {\n // https://github.com/ios-control/ios-deploy/blob/0f2ffb1e564aa67a2dfca7cdf13de47ce489d835/src/ios-deploy/ios-deploy.m#L2491-L2508\n ApplicationsType: 'Any',\n\n CFBundleIdentifier: bundleId,\n CloseOnInvalidate: '1',\n InvalidateOnDetach: '1',\n IsUserInitiated: '1',\n // Disable checking for wifi devices, this is nominally faster.\n PreferWifi: '0',\n // Only info I could find on these:\n // https://github.com/wwxxyx/Quectel_BG96/blob/310876f90fc1093a59e45e381160eddcc31697d0/Apple_Homekit/homekit_certification_tools/ATS%206/ATS%206/ATS.app/Contents/Frameworks/CaptureKit.framework/Versions/A/Resources/MobileDevice/MobileInstallation.h#L112-L121\n PackageType: 'Developer',\n ShadowParentKey: deltaPath,\n // SkipUninstall: '1'\n },\n onProgress\n );\n\n const {\n // TODO(EvanBacon): This can be undefined when querying App Clips.\n [bundleId]: appInfo,\n } = await installer.lookupApp([bundleId]);\n\n if (appInfo) {\n // launch fails with EBusy or ENotFound if you try to launch immediately after install\n await delayAsync(200);\n const debugServerClient = await launchApp(clientManager, {\n bundleId,\n appInfo,\n detach: !waitForApp,\n });\n\n if (waitForApp && debugServerClient) {\n installExitHooks(async () => {\n // causes continue() to return\n debugServerClient.halt();\n // give continue() time to return response\n await delayAsync(64);\n });\n\n debug(`Waiting for app to close...\\n`);\n const result = await debugServerClient.continue();\n // TODO: I have no idea what this packet means yet (successful close?)\n // if not a close (ie, most likely due to halt from onBeforeExit), then kill the app\n if (result !== 'W00') {\n await debugServerClient.kill();\n }\n }\n } else {\n Log.warn(`App \"${bundleId}\" installed but couldn't be launched. Open on device manually.`);\n }\n } finally {\n clientManager.end();\n }\n}\n\n/** Mount the developer disk image for Xcode. */\nasync function mountDeveloperDiskImage(clientManager: ClientManager) {\n const imageMounter = await clientManager.getMobileImageMounterClient();\n // Check if already mounted. If not, mount.\n if (!(await imageMounter.lookupImage()).ImageSignature) {\n // verify DeveloperDiskImage exists (TODO: how does this work on Windows/Linux?)\n // TODO: if windows/linux, download?\n const version = await (await clientManager.getLockdowndClient()).getValue('ProductVersion');\n const developerDiskImagePath = await XcodeDeveloperDiskImagePrerequisite.instance.assertAsync({\n version,\n });\n const developerDiskImageSig = fs.readFileSync(`${developerDiskImagePath}.signature`);\n await imageMounter.uploadImage(developerDiskImagePath, developerDiskImageSig);\n await imageMounter.mountImage(developerDiskImagePath, developerDiskImageSig);\n }\n}\n\nasync function uploadApp(\n clientManager: ClientManager,\n { appBinaryPath, destinationPath }: { appBinaryPath: string; destinationPath: string }\n) {\n const afcClient = await clientManager.getAFCClient();\n try {\n await afcClient.getFileInfo('PublicStaging');\n } catch (err: any) {\n if (err instanceof AFCError && err.status === AFC_STATUS.OBJECT_NOT_FOUND) {\n await afcClient.makeDirectory('PublicStaging');\n } else {\n throw err;\n }\n }\n await afcClient.uploadDirectory(appBinaryPath, destinationPath);\n}\n\nasync function launchAppWithUsbmux(\n clientManager: ClientManager,\n { appInfo, detach }: { appInfo: IPLookupResult[string]; detach?: boolean }\n) {\n let tries = 0;\n while (tries < 3) {\n const debugServerClient = await clientManager.getDebugserverClient();\n await debugServerClient.setMaxPacketSize(1024);\n await debugServerClient.setWorkingDir(appInfo.Container);\n await debugServerClient.launchApp(appInfo.Path, appInfo.CFBundleExecutable);\n\n const result = await debugServerClient.checkLaunchSuccess();\n if (result === 'OK') {\n if (detach) {\n // https://github.com/libimobiledevice/libimobiledevice/blob/25059d4c7d75e03aab516af2929d7c6e6d4c17de/tools/idevicedebug.c#L455-L464\n const res = await debugServerClient.sendCommand('D', []);\n debug('Disconnect from debug server request:', res);\n if (res !== 'OK') {\n console.warn(\n 'Something went wrong while attempting to disconnect from iOS debug server, you may need to reopen the app manually.'\n );\n }\n }\n\n return debugServerClient;\n } else if (result === 'EBusy' || result === 'ENotFound') {\n debug('Device busy or app not found, trying to launch again in .5s...');\n tries++;\n debugServerClient.socket.end();\n await delayAsync(500);\n } else {\n throw new CommandError(`There was an error launching app: ${result}`);\n }\n }\n throw new CommandError('Unable to launch app, number of tries exceeded');\n}\n\n/** @internal Exposed for testing */\nexport async function launchAppWithDeviceCtl(deviceId: string, bundleId: string) {\n try {\n await xcrunAsync(['devicectl', 'device', 'process', 'launch', '--device', deviceId, bundleId]);\n } catch (error: any) {\n if ('stderr' in error) {\n const errorCodes = getDeviceCtlErrorCodes(error.stderr);\n if (errorCodes.includes('Locked')) {\n throw new CommandError('APPLE_DEVICE_LOCKED', 'Device is locked, unlock and try again.');\n }\n }\n\n throw new CommandError(`There was an error launching app: ${error}`);\n }\n}\n\n/** Find all error codes from the output log */\nfunction getDeviceCtlErrorCodes(log: string): string[] {\n return [...log.matchAll(/BSErrorCodeDescription\\s+=\\s+(.*)$/gim)].map(([_line, code]) => code);\n}\n\n/**\n * iOS 17 introduces a new protocol called RemoteXPC.\n * This is not yet implemented, so we fallback to devicectl.\n *\n * @see https://github.com/doronz88/pymobiledevice3/blob/master/misc/RemoteXPC.md#process-remoted\n */\nasync function launchApp(\n clientManager: ClientManager,\n {\n bundleId,\n appInfo,\n detach,\n }: { bundleId: string; appInfo: IPLookupResult[string]; detach?: boolean }\n) {\n try {\n return await launchAppWithUsbmux(clientManager, { appInfo, detach });\n } catch (error) {\n debug('Failed to launch app with Usbmuxd, falling back to xcrun...', error);\n\n // Get the device UDID and close the connection, to allow `xcrun devicectl` to connect\n const deviceId = clientManager.device.Properties.SerialNumber;\n clientManager.end();\n\n // Fallback to devicectl for iOS 17 support\n return await launchAppWithDeviceCtl(deviceId, bundleId);\n }\n}\n"],"names":["getConnectedDevicesAsync","runOnDevice","launchAppWithDeviceCtl","debug","Debug","client","UsbmuxdClient","connectUsbmuxdSocket","devices","getDevices","socket","end","Promise","all","map","device","connect","deviceValues","LockdowndClient","getAllValues","name","DeviceName","ProductType","model","osVersion","ProductVersion","deviceType","connectionType","Properties","ConnectionType","udid","SerialNumber","appPath","bundleId","waitForApp","deltaPath","onProgress","clientManager","ClientManager","create","mountDeveloperDiskImage","packageName","path","basename","destPackagePath","join","uploadApp","appBinaryPath","destinationPath","installer","getInstallationProxyClient","installApp","ApplicationsType","CFBundleIdentifier","CloseOnInvalidate","InvalidateOnDetach","IsUserInitiated","PreferWifi","PackageType","ShadowParentKey","appInfo","lookupApp","delayAsync","debugServerClient","launchApp","detach","installExitHooks","halt","result","continue","kill","Log","warn","imageMounter","getMobileImageMounterClient","lookupImage","ImageSignature","version","getLockdowndClient","getValue","developerDiskImagePath","XcodeDeveloperDiskImagePrerequisite","instance","assertAsync","developerDiskImageSig","fs","readFileSync","uploadImage","mountImage","afcClient","getAFCClient","getFileInfo","err","AFCError","status","AFC_STATUS","OBJECT_NOT_FOUND","makeDirectory","uploadDirectory","launchAppWithUsbmux","tries","getDebugserverClient","setMaxPacketSize","setWorkingDir","Container","Path","CFBundleExecutable","checkLaunchSuccess","res","sendCommand","console","CommandError","deviceId","xcrunAsync","error","errorCodes","getDeviceCtlErrorCodes","stderr","includes","log","matchAll","_line","code"],"mappings":"AAAA;;;;QAmCsBA,wBAAwB,GAAxBA,wBAAwB;QA4BxBC,WAAW,GAAXA,WAAW;QAoKXC,sBAAsB,GAAtBA,sBAAsB;AAnO1B,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEO,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AAEf,IAAA,gBAA0B,WAA1B,0BAA0B,CAAA;AAC5B,IAAA,cAAwB,WAAxB,wBAAwB,CAAA;AACjB,IAAA,YAAwB,WAAxB,wBAAwB,CAAA;AACzC,IAAA,IAAc,WAAd,cAAc,CAAA;AACkB,IAAA,oCAAiE,WAAjE,iEAAiE,CAAA;AAC1F,IAAA,MAAoC,WAApC,oCAAoC,CAAA;AACpC,IAAA,MAAsB,WAAtB,sBAAsB,CAAA;AACpB,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACnB,IAAA,KAAqB,WAArB,qBAAqB,CAAA;;;;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esContent":["import { ExpoConfig } from '@expo/config
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/interface/commandsTable.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport chalk from 'chalk';\nimport qrcode from 'qrcode-terminal';\nimport wrapAnsi from 'wrap-ansi';\n\nimport * as Log from '../../log';\n\nexport const BLT = '\\u203A';\n\nexport type StartOptions = {\n isWebSocketsEnabled?: boolean;\n devClient?: boolean;\n reset?: boolean;\n nonPersistent?: boolean;\n maxWorkers?: number;\n platforms?: ExpoConfig['platforms'];\n};\n\nexport const printHelp = (): void => {\n logCommandsTable([{ key: '?', msg: 'show all commands' }]);\n};\n\n/** Print the world famous 'Expo QR Code'. */\nexport function printQRCode(url: string) {\n qrcode.generate(url, { small: true }, (code) => Log.log(code));\n}\n\nexport const getTerminalColumns = () => process.stdout.columns || 80;\nexport const printItem = (text: string): string =>\n `${BLT} ` + wrapAnsi(text, getTerminalColumns()).trimStart();\n\nexport function printUsage(\n options: Pick<StartOptions, 'devClient' | 'isWebSocketsEnabled' | 'platforms'>,\n { verbose }: { verbose: boolean }\n) {\n const isMac = process.platform === 'darwin';\n\n const { platforms = ['ios', 'android', 'web'] } = options;\n\n const isAndroidDisabled = !platforms.includes('android');\n const isIosDisabled = !platforms.includes('ios');\n const isWebDisable = !platforms.includes('web');\n\n const switchMsg = `switch to ${options.devClient === false ? 'development build' : 'Expo Go'}`;\n const target = options.devClient === false ? `Expo Go` : 'development build';\n\n Log.log();\n Log.log(printItem(chalk`Using {cyan ${target}}`));\n\n if (verbose) {\n logCommandsTable([\n { key: 's', msg: switchMsg },\n {},\n { key: 'a', msg: 'open Android', disabled: isAndroidDisabled },\n { key: 'shift+a', msg: 'select a device or emulator', disabled: isAndroidDisabled },\n isMac && { key: 'i', msg: 'open iOS simulator', disabled: isIosDisabled },\n isMac && { key: 'shift+i', msg: 'select a simulator', disabled: isIosDisabled },\n { key: 'w', msg: 'open web', disabled: isWebDisable },\n {},\n { key: 'r', msg: 'reload app' },\n !!options.isWebSocketsEnabled && { key: 'j', msg: 'open debugger' },\n !!options.isWebSocketsEnabled && { key: 'm', msg: 'toggle menu' },\n !!options.isWebSocketsEnabled && { key: 'shift+m', msg: 'more tools' },\n { key: 'o', msg: 'open project code in your editor' },\n { key: 'c', msg: 'show project QR' },\n {},\n ]);\n } else {\n logCommandsTable([\n { key: 's', msg: switchMsg },\n {},\n { key: 'a', msg: 'open Android', disabled: isAndroidDisabled },\n isMac && { key: 'i', msg: 'open iOS simulator', disabled: isIosDisabled },\n { key: 'w', msg: 'open web', disabled: isWebDisable },\n {},\n { key: 'j', msg: 'open debugger' },\n { key: 'r', msg: 'reload app' },\n !!options.isWebSocketsEnabled && { key: 'm', msg: 'toggle menu' },\n { key: 'o', msg: 'open project code in your editor' },\n {},\n ]);\n }\n}\n\nfunction logCommandsTable(\n ui: (false | { key?: string; msg?: string; status?: string; disabled?: boolean })[]\n) {\n Log.log(\n ui\n .filter(Boolean)\n // @ts-ignore: filter doesn't work\n .map(({ key, msg, status, disabled }) => {\n if (!key) return '';\n let view = `${BLT} `;\n if (key.length === 1) view += 'Press ';\n view += chalk`{bold ${key}} {dim │} `;\n view += msg;\n if (status) {\n view += ` ${chalk.dim(`(${chalk.italic(status)})`)}`;\n }\n if (disabled) {\n view = chalk.dim(view);\n }\n return view;\n })\n .join('\\n')\n );\n}\n"],"names":["printQRCode","printUsage","Log","BLT","printHelp","logCommandsTable","key","msg","url","qrcode","generate","small","code","log","getTerminalColumns","process","stdout","columns","printItem","text","wrapAnsi","trimStart","options","verbose","isMac","platform","platforms","isAndroidDisabled","includes","isIosDisabled","isWebDisable","switchMsg","devClient","target","chalk","disabled","isWebSocketsEnabled","ui","filter","Boolean","map","status","view","length","dim","italic","join"],"mappings":"AAAA;;;;QAuBgBA,WAAW,GAAXA,WAAW;QAQXC,UAAU,GAAVA,UAAU;;AA9BR,IAAA,MAAO,kCAAP,OAAO,EAAA;AACN,IAAA,eAAiB,kCAAjB,iBAAiB,EA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J;CACF;AAED,SAASF,gBAAgB,CACvBgC,EAAmF,EACnF;IACAnC,GAAG,CAACW,GAAG,CACLwB,EAAE,CACCC,MAAM,CAACC,OAAO,CAAC,AAChB,kCAAkC;KACjCC,GAAG,CAAC,CAAC,EAAElC,GAAG,CAAA,EAAEC,GAAG,CAAA,EAAEkC,MAAM,CAAA,EAAEN,QAAQ,CAAA,EAAE,GAAK;QACvC,IAAI,CAAC7B,GAAG,EAAE,OAAO,EAAE,CAAC;QACpB,IAAIoC,IAAI,GAAG,CAAC,EAAEvC,GAAG,CAAC,CAAC,CAAC,AAAC;QACrB,IAAIG,GAAG,CAACqC,MAAM,KAAK,CAAC,EAAED,IAAI,IAAI,QAAQ,CAAC;QACvCA,IAAI,IAAIR,MAAK,QAAA,CAAC,MAAM,EAAE5B,GAAG,CAAC,YAAU,CAAC,CAAC;QACtCoC,IAAI,IAAInC,GAAG,CAAC;QACZ,IAAIkC,MAAM,EAAE;YACVC,IAAI,IAAI,CAAC,CAAC,EAAER,MAAK,QAAA,CAACU,GAAG,CAAC,CAAC,CAAC,EAAEV,MAAK,QAAA,CAACW,MAAM,CAACJ,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACtD;QACD,IAAIN,QAAQ,EAAE;YACZO,IAAI,GAAGR,MAAK,QAAA,CAACU,GAAG,CAACF,IAAI,CAAC,CAAC;SACxB;QACD,OAAOA,IAAI,CAAC;KACb,CAAC,CACDI,IAAI,CAAC,IAAI,CAAC,CACd,CAAC;CACH"}
|
|
@@ -234,7 +234,7 @@ function extrapolateGroupRoutes(route, routes = new Set()) {
|
|
|
234
234
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
235
235
|
declare module "expo-router" {
|
|
236
236
|
import type { LinkProps as OriginalLinkProps } from 'expo-router/build/link/Link';
|
|
237
|
-
import type { Router as OriginalRouter } from 'expo-router/
|
|
237
|
+
import type { Router as OriginalRouter } from 'expo-router/build/types';
|
|
238
238
|
export * from 'expo-router/build';
|
|
239
239
|
|
|
240
240
|
// prettier-ignore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/type-generation/routes.ts"],"sourcesContent":["import fs from 'fs/promises';\nimport debounce from 'lodash.debounce';\nimport { Server } from 'metro';\nimport path from 'path';\n\nimport { directoryExistsAsync } from '../../../utils/dir';\nimport { unsafeTemplate } from '../../../utils/template';\nimport { ServerLike } from '../BundlerDevServer';\nimport { metroWatchTypeScriptFiles } from '../metro/metroWatchTypeScriptFiles';\n\n// /test/[...param1]/[param2]/[param3] - captures [\"param1\", \"param2\", \"param3\"]\nexport const CAPTURE_DYNAMIC_PARAMS = /\\[(?:\\.{3})?(\\w*?)[\\]$]/g;\n// /[...param1]/ - Match [...param1]\nexport const CATCH_ALL = /\\[\\.\\.\\..+?\\]/g;\n// /[param1] - Match [param1]\nexport const SLUG = /\\[.+?\\]/g;\n// /(group1,group2,group3)/test - match (group1,group2,group3)\nexport const ARRAY_GROUP_REGEX = /\\(\\s*\\w[\\w\\s]*?,.*?\\)/g;\n// /(group1,group2,group3)/test - captures [\"group1\", \"group2\", \"group3\"]\nexport const CAPTURE_GROUP_REGEX = /[\\\\(,]\\s*(\\w[\\w\\s]*?)\\s*(?=[,\\\\)])/g;\n/**\n * Match:\n * - _layout files, +html, +not-found, string+api, etc\n * - Routes can still use `+`, but it cannot be in the last segment.\n */\nexport const TYPED_ROUTES_EXCLUSION_REGEX = /(_layout|[^/]*?\\+[^/]*?)\\.[tj]sx?$/;\n\nexport interface SetupTypedRoutesOptions {\n server?: ServerLike;\n metro?: Server | null;\n typesDirectory: string;\n projectRoot: string;\n /** Absolute expo router routes directory. */\n routerDirectory: string;\n}\n\nexport async function setupTypedRoutes({\n server,\n metro,\n typesDirectory,\n projectRoot,\n routerDirectory,\n}: SetupTypedRoutesOptions) {\n const { filePathToRoute, staticRoutes, dynamicRoutes, addFilePath, isRouteFile } =\n getTypedRoutesUtils(routerDirectory);\n\n if (metro && server) {\n // Setup out watcher first\n metroWatchTypeScriptFiles({\n projectRoot,\n server,\n metro,\n eventTypes: ['add', 'delete', 'change'],\n async callback({ filePath, type }) {\n if (!isRouteFile(filePath)) {\n return;\n }\n\n let shouldRegenerate = false;\n\n if (type === 'delete') {\n const route = filePathToRoute(filePath);\n staticRoutes.delete(route);\n dynamicRoutes.delete(route);\n shouldRegenerate = true;\n } else {\n shouldRegenerate = addFilePath(filePath);\n }\n\n if (shouldRegenerate) {\n regenerateRouterDotTS(\n typesDirectory,\n new Set([...staticRoutes.values()].flatMap((v) => Array.from(v))),\n new Set([...dynamicRoutes.values()].flatMap((v) => Array.from(v))),\n new Set(dynamicRoutes.keys())\n );\n }\n },\n });\n }\n\n if (await directoryExistsAsync(routerDirectory)) {\n // Do we need to walk the entire tree on startup?\n // Idea: Store the list of files in the last write, then simply check Git for what files have changed\n await walk(routerDirectory, addFilePath);\n }\n\n regenerateRouterDotTS(\n typesDirectory,\n new Set([...staticRoutes.values()].flatMap((v) => Array.from(v))),\n new Set([...dynamicRoutes.values()].flatMap((v) => Array.from(v))),\n new Set(dynamicRoutes.keys())\n );\n}\n\n/**\n * Generate a router.d.ts file that contains all of the routes in the project.\n * Should be debounced as its very common for developers to make changes to multiple files at once (eg Save All)\n */\nconst regenerateRouterDotTS = debounce(\n async (\n typesDir: string,\n staticRoutes: Set<string>,\n dynamicRoutes: Set<string>,\n dynamicRouteTemplates: Set<string>\n ) => {\n await fs.mkdir(typesDir, { recursive: true });\n await fs.writeFile(\n path.resolve(typesDir, './router.d.ts'),\n getTemplateString(staticRoutes, dynamicRoutes, dynamicRouteTemplates)\n );\n },\n 100\n);\n\n/*\n * This is exported for testing purposes\n */\nexport function getTemplateString(\n staticRoutes: Set<string>,\n dynamicRoutes: Set<string>,\n dynamicRouteTemplates: Set<string>\n) {\n return routerDotTSTemplate({\n staticRoutes: setToUnionType(staticRoutes),\n dynamicRoutes: setToUnionType(dynamicRoutes),\n dynamicRouteParams: setToUnionType(dynamicRouteTemplates),\n });\n}\n\n/**\n * Utility functions for typed routes\n *\n * These are extracted for easier testing\n */\nexport function getTypedRoutesUtils(appRoot: string, filePathSeperator = path.sep) {\n /*\n * staticRoutes are a map where the key if the route without groups and the value\n * is another set of all group versions of the route. e.g,\n * Map([\n * [\"/\", [\"/(app)/(notes)\", \"/(app)/(profile)\"]\n * ])\n */\n const staticRoutes = new Map<string, Set<string>>([['/', new Set('/')]]);\n /*\n * dynamicRoutes are the same as staticRoutes (key if the resolved route,\n * and the value is a set of possible routes). e.g:\n *\n * /[...fruits] -> /${CatchAllRoutePart<T>}\n * /color/[color] -> /color/${SingleRoutePart<T>}\n *\n * The keys of this map are also important, as they can be used as \"static\" types\n * <Link href={{ pathname: \"/[...fruits]\",params: { fruits: [\"apple\"] } }} />\n */\n const dynamicRoutes = new Map<string, Set<string>>();\n\n function normalizedFilePath(filePath: string) {\n return filePath.replaceAll(filePathSeperator, '/');\n }\n\n const normalizedAppRoot = normalizedFilePath(appRoot);\n\n const filePathToRoute = (filePath: string) => {\n return normalizedFilePath(filePath)\n .replace(normalizedAppRoot, '')\n .replace(/index\\.[jt]sx?/, '')\n .replace(/\\.[jt]sx?$/, '');\n };\n\n const isRouteFile = (filePath: string) => {\n if (filePath.match(TYPED_ROUTES_EXCLUSION_REGEX)) {\n return false;\n }\n\n // Route files must be nested with in the appRoot\n const relative = path.relative(appRoot, filePath);\n return relative && !relative.startsWith('..') && !path.isAbsolute(relative);\n };\n\n const addFilePath = (filePath: string): boolean => {\n if (!isRouteFile(filePath)) {\n return false;\n }\n\n const route = filePathToRoute(filePath);\n\n // We have already processed this file\n if (staticRoutes.has(route) || dynamicRoutes.has(route)) {\n return false;\n }\n\n const dynamicParams = new Set(\n [...route.matchAll(CAPTURE_DYNAMIC_PARAMS)].map((match) => match[1])\n );\n const isDynamic = dynamicParams.size > 0;\n\n const addRoute = (originalRoute: string, route: string) => {\n if (isDynamic) {\n let set = dynamicRoutes.get(originalRoute);\n\n if (!set) {\n set = new Set();\n dynamicRoutes.set(originalRoute, set);\n }\n\n set.add(\n route\n .replaceAll(CATCH_ALL, '${CatchAllRoutePart<T>}')\n .replaceAll(SLUG, '${SingleRoutePart<T>}')\n );\n } else {\n let set = staticRoutes.get(originalRoute);\n\n if (!set) {\n set = new Set();\n staticRoutes.set(originalRoute, set);\n }\n\n set.add(route);\n }\n };\n\n if (!route.match(ARRAY_GROUP_REGEX)) {\n addRoute(route, route);\n }\n\n // Does this route have a group? eg /(group)\n if (route.includes('/(')) {\n const routeWithoutGroups = route.replace(/\\/\\(.+?\\)/g, '');\n addRoute(route, routeWithoutGroups);\n\n // If there are multiple groups, we need to expand them\n // eg /(test1,test2)/page => /test1/page & /test2/page\n for (const routeWithSingleGroup of extrapolateGroupRoutes(route)) {\n addRoute(route, routeWithSingleGroup);\n }\n }\n\n return true;\n };\n\n return {\n staticRoutes,\n dynamicRoutes,\n filePathToRoute,\n addFilePath,\n isRouteFile,\n };\n}\n\nexport const setToUnionType = <T>(set: Set<T>) => {\n return set.size > 0 ? [...set].map((s) => `\\`${s}\\``).join(' | ') : 'never';\n};\n\n/**\n * Recursively walk a directory and call the callback with the file path.\n */\nasync function walk(directory: string, callback: (filePath: string) => void) {\n const files = await fs.readdir(directory);\n for (const file of files) {\n const p = path.join(directory, file);\n if ((await fs.stat(p)).isDirectory()) {\n await walk(p, callback);\n } else {\n // Normalise the paths so they are easier to convert to URLs\n const normalizedPath = p.replaceAll(path.sep, '/');\n callback(normalizedPath);\n }\n }\n}\n\n/**\n * Given a route, return all possible routes that could be generated from it.\n */\nexport function extrapolateGroupRoutes(\n route: string,\n routes: Set<string> = new Set()\n): Set<string> {\n // Create a version with no groups. We will then need to cleanup double and/or trailing slashes\n routes.add(route.replaceAll(ARRAY_GROUP_REGEX, '').replaceAll(/\\/+/g, '/').replace(/\\/$/, ''));\n\n const match = route.match(ARRAY_GROUP_REGEX);\n\n if (!match) {\n routes.add(route);\n return routes;\n }\n\n const groupsMatch = match[0];\n\n for (const group of groupsMatch.matchAll(CAPTURE_GROUP_REGEX)) {\n extrapolateGroupRoutes(route.replace(groupsMatch, `(${group[1].trim()})`), routes);\n }\n\n return routes;\n}\n\n/**\n * NOTE: This code refers to a specific version of `expo-router` and is therefore unsafe to\n * mix with arbitrary versions.\n * TODO: Version this code with `expo-router` or version expo-router with `@expo/cli`.\n */\nconst routerDotTSTemplate = unsafeTemplate`/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/ban-types */\ndeclare module \"expo-router\" {\n import type { LinkProps as OriginalLinkProps } from 'expo-router/build/link/Link';\n import type { Router as OriginalRouter } from 'expo-router/src/types';\n export * from 'expo-router/build';\n\n // prettier-ignore\n type StaticRoutes = ${'staticRoutes'};\n // prettier-ignore\n type DynamicRoutes<T extends string> = ${'dynamicRoutes'};\n // prettier-ignore\n type DynamicRouteTemplate = ${'dynamicRouteParams'};\n\n type RelativePathString = \\`./\\${string}\\` | \\`../\\${string}\\` | '..';\n type AbsoluteRoute = DynamicRouteTemplate | StaticRoutes;\n type ExternalPathString = \\`\\${string}:\\${string}\\`;\n\n type ExpoRouterRoutes = DynamicRouteTemplate | StaticRoutes | RelativePathString;\n type AllRoutes = ExpoRouterRoutes | ExternalPathString;\n\n /****************\n * Route Utils *\n ****************/\n\n type SearchOrHash = \\`?\\${string}\\` | \\`#\\${string}\\`;\n type UnknownInputParams = Record<string, string | number | (string | number)[]>;\n type UnknownOutputParams = Record<string, string | string[]>;\n\n /**\n * Return only the RoutePart of a string. If the string has multiple parts return never\n *\n * string | type\n * ---------|------\n * 123 | 123\n * /123/abc | never\n * 123?abc | never\n * ./123 | never\n * /123 | never\n * 123/../ | never\n */\n type SingleRoutePart<S extends string> = S extends \\`\\${string}/\\${string}\\`\n ? never\n : S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S extends \\`(\\${string})\\`\n ? never\n : S extends \\`[\\${string}]\\`\n ? never\n : S;\n\n /**\n * Return only the CatchAll router part. If the string has search parameters or a hash return never\n */\n type CatchAllRoutePart<S extends string> = S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S extends \\`\\${string}(\\${string})\\${string}\\`\n ? never\n : S extends \\`\\${string}[\\${string}]\\${string}\\`\n ? never\n : S;\n\n // type OptionalCatchAllRoutePart<S extends string> = S extends \\`\\${string}\\${SearchOrHash}\\` ? never : S\n\n /**\n * Return the name of a route parameter\n * '[test]' -> 'test'\n * 'test' -> never\n * '[...test]' -> '...test'\n */\n type IsParameter<Part> = Part extends \\`[\\${infer ParamName}]\\` ? ParamName : never;\n\n /**\n * Return a union of all parameter names. If there are no names return never\n *\n * /[test] -> 'test'\n * /[abc]/[...def] -> 'abc'|'...def'\n */\n type ParameterNames<Path> = Path extends \\`\\${infer PartA}/\\${infer PartB}\\`\n ? IsParameter<PartA> | ParameterNames<PartB>\n : IsParameter<Path>;\n\n /**\n * Returns all segements of a route.\n *\n * /(group)/123/abc/[id]/[...rest] -> ['(group)', '123', 'abc', '[id]', '[...rest]'\n */\n type RouteSegments<Path> = Path extends \\`\\${infer PartA}/\\${infer PartB}\\`\n ? PartA extends '' | '.'\n ? [...RouteSegments<PartB>]\n : [PartA, ...RouteSegments<PartB>]\n : Path extends ''\n ? []\n : [Path];\n\n /**\n * Returns a Record of the routes parameters as strings and CatchAll parameters\n *\n * There are two versions, input and output, as you can input 'string | number' but\n * the output will always be 'string'\n *\n * /[id]/[...rest] -> { id: string, rest: string[] }\n * /no-params -> {}\n */\n type InputRouteParams<Path> = {\n [Key in ParameterNames<Path> as Key extends \\`...\\${infer Name}\\`\n ? Name\n : Key]: Key extends \\`...\\${string}\\` ? (string | number)[] : string | number;\n } & UnknownInputParams;\n\n type OutputRouteParams<Path> = {\n [Key in ParameterNames<Path> as Key extends \\`...\\${infer Name}\\`\n ? Name\n : Key]: Key extends \\`...\\${string}\\` ? string[] : string;\n } & UnknownOutputParams;\n\n /**\n * Returns the search parameters for a route.\n */\n export type SearchParams<T extends AllRoutes> = T extends DynamicRouteTemplate\n ? OutputRouteParams<T>\n : T extends StaticRoutes\n ? never\n : UnknownOutputParams;\n\n /**\n * Route is mostly used as part of Href to ensure that a valid route is provided\n *\n * Given a dynamic route, this will return never. This is helpful for conditional logic\n *\n * /test -> /test, /test2, etc\n * /test/[abc] -> never\n * /test/resolve -> /test, /test2, etc\n *\n * Note that if we provide a value for [abc] then the route is allowed\n *\n * This is named Route to prevent confusion, as users they will often see it in tooltips\n */\n export type Route<T> = T extends string\n ? T extends DynamicRouteTemplate\n ? never\n :\n | StaticRoutes\n | RelativePathString\n | ExternalPathString\n | (T extends \\`\\${infer P}\\${SearchOrHash}\\`\n ? P extends DynamicRoutes<infer _>\n ? T\n : never\n : T extends DynamicRoutes<infer _>\n ? T\n : never)\n : never;\n\n /*********\n * Href *\n *********/\n\n export type Href<T> = T extends Record<'pathname', string> ? HrefObject<T> : Route<T>;\n\n export type HrefObject<\n R extends Record<'pathname', string>,\n P = R['pathname'],\n > = P extends DynamicRouteTemplate\n ? { pathname: P; params: InputRouteParams<P> }\n : P extends Route<P>\n ? { pathname: Route<P> | DynamicRouteTemplate; params?: never | InputRouteParams<never> }\n : never;\n\n /***********************\n * Expo Router Exports *\n ***********************/\n\n export type Router = Omit<OriginalRouter, 'push' | 'replace' | 'setParams'> & {\n /** Navigate to the provided href. */\n push: <T>(href: Href<T>) => void;\n /** Navigate to route without appending to the history. */\n replace: <T>(href: Href<T>) => void;\n /** Update the current route query params. */\n setParams: <T = ''>(params?: T extends '' ? Record<string, string> : InputRouteParams<T>) => void;\n };\n\n /** The imperative router. */\n export const router: Router;\n\n /************\n * <Link /> *\n ************/\n export interface LinkProps<T> extends OriginalLinkProps {\n href: Href<T>;\n }\n\n export interface LinkComponent {\n <T>(props: React.PropsWithChildren<LinkProps<T>>): JSX.Element;\n /** Helper method to resolve an Href object into a string. */\n resolveHref: <T>(href: Href<T>) => string;\n }\n\n /**\n * Component to render link to another route using a path.\n * Uses an anchor tag on the web.\n *\n * @param props.href Absolute path to route (e.g. \\`/feeds/hot\\`).\n * @param props.replace Should replace the current route without adding to the history.\n * @param props.asChild Forward props to child component. Useful for custom buttons.\n * @param props.children Child elements to render the content.\n * @param props.className On web, this sets the HTML \\`class\\` directly. On native, this can be used with CSS interop tools like Nativewind.\n */\n export const Link: LinkComponent;\n\n /** Redirects to the href as soon as the component is mounted. */\n export const Redirect: <T>(\n props: React.PropsWithChildren<{ href: Href<T> }>\n ) => JSX.Element;\n\n /************\n * Hooks *\n ************/\n export function useRouter(): Router;\n\n export function useLocalSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n >(): T extends AllRoutes ? SearchParams<T> : T;\n\n /** @deprecated renamed to \\`useGlobalSearchParams\\` */\n export function useSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n >(): T extends AllRoutes ? SearchParams<T> : T;\n\n export function useGlobalSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n >(): T extends AllRoutes ? SearchParams<T> : T;\n\n export function useSegments<\n T extends AbsoluteRoute | RouteSegments<AbsoluteRoute> | RelativePathString,\n >(): T extends AbsoluteRoute ? RouteSegments<T> : T extends string ? string[] : T;\n}\n`;\n"],"names":["setupTypedRoutes","getTemplateString","getTypedRoutesUtils","extrapolateGroupRoutes","CAPTURE_DYNAMIC_PARAMS","CATCH_ALL","SLUG","ARRAY_GROUP_REGEX","CAPTURE_GROUP_REGEX","TYPED_ROUTES_EXCLUSION_REGEX","server","metro","typesDirectory","projectRoot","routerDirectory","filePathToRoute","staticRoutes","dynamicRoutes","addFilePath","isRouteFile","metroWatchTypeScriptFiles","eventTypes","callback","filePath","type","shouldRegenerate","route","delete","regenerateRouterDotTS","Set","values","flatMap","v","Array","from","keys","directoryExistsAsync","walk","debounce","typesDir","dynamicRouteTemplates","fs","mkdir","recursive","writeFile","path","resolve","routerDotTSTemplate","setToUnionType","dynamicRouteParams","appRoot","filePathSeperator","sep","Map","normalizedFilePath","replaceAll","normalizedAppRoot","replace","match","relative","startsWith","isAbsolute","has","dynamicParams","matchAll","map","isDynamic","size","addRoute","originalRoute","set","get","add","includes","routeWithoutGroups","routeWithSingleGroup","s","join","directory","files","readdir","file","p","stat","isDirectory","normalizedPath","routes","groupsMatch","group","trim","unsafeTemplate"],"mappings":"AAAA;;;;QAoCsBA,gBAAgB,GAAhBA,gBAAgB;QAkFtBC,iBAAiB,GAAjBA,iBAAiB;QAiBjBC,mBAAmB,GAAnBA,mBAAmB;QA2InBC,sBAAsB,GAAtBA,sBAAsB;;AAlRvB,IAAA,SAAa,kCAAb,aAAa,EAAA;AACP,IAAA,eAAiB,kCAAjB,iBAAiB,EAAA;AAErB,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEc,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AAC1B,IAAA,SAAyB,WAAzB,yBAAyB,CAAA;AAEd,IAAA,0BAAoC,WAApC,oCAAoC,CAAA;;;;;;AAGvE,MAAMC,sBAAsB,6BAA6B,AAAC;QAApDA,sBAAsB,GAAtBA,sBAAsB;AAE5B,MAAMC,SAAS,mBAAmB,AAAC;QAA7BA,SAAS,GAATA,SAAS;AAEf,MAAMC,IAAI,aAAa,AAAC;QAAlBA,IAAI,GAAJA,IAAI;AAEV,MAAMC,iBAAiB,2BAA2B,AAAC;QAA7CA,iBAAiB,GAAjBA,iBAAiB;AAEvB,MAAMC,mBAAmB,wCAAwC,AAAC;QAA5DA,mBAAmB,GAAnBA,mBAAmB;AAMzB,MAAMC,4BAA4B,uCAAuC,AAAC;QAApEA,4BAA4B,GAA5BA,4BAA4B;AAWlC,eAAeT,gBAAgB,CAAC,EACrCU,MAAM,CAAA,EACNC,KAAK,CAAA,EACLC,cAAc,CAAA,EACdC,WAAW,CAAA,EACXC,eAAe,CAAA,EACS,EAAE;IAC1B,MAAM,EAAEC,eAAe,CAAA,EAAEC,YAAY,CAAA,EAAEC,aAAa,CAAA,EAAEC,WAAW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AC;KACpF;IAED,OAAOA,MAAM,CAAC;CACf;AAED;;;;GAIG,CACH,MAAMvC,mBAAmB,GAAG2C,SAAc,eAAA,CAAC;;;;;;;;;sBASrB,EAAE,cAAc,CAAC;;yCAEE,EAAE,eAAe,CAAC;;8BAE7B,EAAE,oBAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqOrD,CAAC,AAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/type-generation/routes.ts"],"sourcesContent":["import fs from 'fs/promises';\nimport debounce from 'lodash.debounce';\nimport { Server } from 'metro';\nimport path from 'path';\n\nimport { directoryExistsAsync } from '../../../utils/dir';\nimport { unsafeTemplate } from '../../../utils/template';\nimport { ServerLike } from '../BundlerDevServer';\nimport { metroWatchTypeScriptFiles } from '../metro/metroWatchTypeScriptFiles';\n\n// /test/[...param1]/[param2]/[param3] - captures [\"param1\", \"param2\", \"param3\"]\nexport const CAPTURE_DYNAMIC_PARAMS = /\\[(?:\\.{3})?(\\w*?)[\\]$]/g;\n// /[...param1]/ - Match [...param1]\nexport const CATCH_ALL = /\\[\\.\\.\\..+?\\]/g;\n// /[param1] - Match [param1]\nexport const SLUG = /\\[.+?\\]/g;\n// /(group1,group2,group3)/test - match (group1,group2,group3)\nexport const ARRAY_GROUP_REGEX = /\\(\\s*\\w[\\w\\s]*?,.*?\\)/g;\n// /(group1,group2,group3)/test - captures [\"group1\", \"group2\", \"group3\"]\nexport const CAPTURE_GROUP_REGEX = /[\\\\(,]\\s*(\\w[\\w\\s]*?)\\s*(?=[,\\\\)])/g;\n/**\n * Match:\n * - _layout files, +html, +not-found, string+api, etc\n * - Routes can still use `+`, but it cannot be in the last segment.\n */\nexport const TYPED_ROUTES_EXCLUSION_REGEX = /(_layout|[^/]*?\\+[^/]*?)\\.[tj]sx?$/;\n\nexport interface SetupTypedRoutesOptions {\n server?: ServerLike;\n metro?: Server | null;\n typesDirectory: string;\n projectRoot: string;\n /** Absolute expo router routes directory. */\n routerDirectory: string;\n}\n\nexport async function setupTypedRoutes({\n server,\n metro,\n typesDirectory,\n projectRoot,\n routerDirectory,\n}: SetupTypedRoutesOptions) {\n const { filePathToRoute, staticRoutes, dynamicRoutes, addFilePath, isRouteFile } =\n getTypedRoutesUtils(routerDirectory);\n\n if (metro && server) {\n // Setup out watcher first\n metroWatchTypeScriptFiles({\n projectRoot,\n server,\n metro,\n eventTypes: ['add', 'delete', 'change'],\n async callback({ filePath, type }) {\n if (!isRouteFile(filePath)) {\n return;\n }\n\n let shouldRegenerate = false;\n\n if (type === 'delete') {\n const route = filePathToRoute(filePath);\n staticRoutes.delete(route);\n dynamicRoutes.delete(route);\n shouldRegenerate = true;\n } else {\n shouldRegenerate = addFilePath(filePath);\n }\n\n if (shouldRegenerate) {\n regenerateRouterDotTS(\n typesDirectory,\n new Set([...staticRoutes.values()].flatMap((v) => Array.from(v))),\n new Set([...dynamicRoutes.values()].flatMap((v) => Array.from(v))),\n new Set(dynamicRoutes.keys())\n );\n }\n },\n });\n }\n\n if (await directoryExistsAsync(routerDirectory)) {\n // Do we need to walk the entire tree on startup?\n // Idea: Store the list of files in the last write, then simply check Git for what files have changed\n await walk(routerDirectory, addFilePath);\n }\n\n regenerateRouterDotTS(\n typesDirectory,\n new Set([...staticRoutes.values()].flatMap((v) => Array.from(v))),\n new Set([...dynamicRoutes.values()].flatMap((v) => Array.from(v))),\n new Set(dynamicRoutes.keys())\n );\n}\n\n/**\n * Generate a router.d.ts file that contains all of the routes in the project.\n * Should be debounced as its very common for developers to make changes to multiple files at once (eg Save All)\n */\nconst regenerateRouterDotTS = debounce(\n async (\n typesDir: string,\n staticRoutes: Set<string>,\n dynamicRoutes: Set<string>,\n dynamicRouteTemplates: Set<string>\n ) => {\n await fs.mkdir(typesDir, { recursive: true });\n await fs.writeFile(\n path.resolve(typesDir, './router.d.ts'),\n getTemplateString(staticRoutes, dynamicRoutes, dynamicRouteTemplates)\n );\n },\n 100\n);\n\n/*\n * This is exported for testing purposes\n */\nexport function getTemplateString(\n staticRoutes: Set<string>,\n dynamicRoutes: Set<string>,\n dynamicRouteTemplates: Set<string>\n) {\n return routerDotTSTemplate({\n staticRoutes: setToUnionType(staticRoutes),\n dynamicRoutes: setToUnionType(dynamicRoutes),\n dynamicRouteParams: setToUnionType(dynamicRouteTemplates),\n });\n}\n\n/**\n * Utility functions for typed routes\n *\n * These are extracted for easier testing\n */\nexport function getTypedRoutesUtils(appRoot: string, filePathSeperator = path.sep) {\n /*\n * staticRoutes are a map where the key if the route without groups and the value\n * is another set of all group versions of the route. e.g,\n * Map([\n * [\"/\", [\"/(app)/(notes)\", \"/(app)/(profile)\"]\n * ])\n */\n const staticRoutes = new Map<string, Set<string>>([['/', new Set('/')]]);\n /*\n * dynamicRoutes are the same as staticRoutes (key if the resolved route,\n * and the value is a set of possible routes). e.g:\n *\n * /[...fruits] -> /${CatchAllRoutePart<T>}\n * /color/[color] -> /color/${SingleRoutePart<T>}\n *\n * The keys of this map are also important, as they can be used as \"static\" types\n * <Link href={{ pathname: \"/[...fruits]\",params: { fruits: [\"apple\"] } }} />\n */\n const dynamicRoutes = new Map<string, Set<string>>();\n\n function normalizedFilePath(filePath: string) {\n return filePath.replaceAll(filePathSeperator, '/');\n }\n\n const normalizedAppRoot = normalizedFilePath(appRoot);\n\n const filePathToRoute = (filePath: string) => {\n return normalizedFilePath(filePath)\n .replace(normalizedAppRoot, '')\n .replace(/index\\.[jt]sx?/, '')\n .replace(/\\.[jt]sx?$/, '');\n };\n\n const isRouteFile = (filePath: string) => {\n if (filePath.match(TYPED_ROUTES_EXCLUSION_REGEX)) {\n return false;\n }\n\n // Route files must be nested with in the appRoot\n const relative = path.relative(appRoot, filePath);\n return relative && !relative.startsWith('..') && !path.isAbsolute(relative);\n };\n\n const addFilePath = (filePath: string): boolean => {\n if (!isRouteFile(filePath)) {\n return false;\n }\n\n const route = filePathToRoute(filePath);\n\n // We have already processed this file\n if (staticRoutes.has(route) || dynamicRoutes.has(route)) {\n return false;\n }\n\n const dynamicParams = new Set(\n [...route.matchAll(CAPTURE_DYNAMIC_PARAMS)].map((match) => match[1])\n );\n const isDynamic = dynamicParams.size > 0;\n\n const addRoute = (originalRoute: string, route: string) => {\n if (isDynamic) {\n let set = dynamicRoutes.get(originalRoute);\n\n if (!set) {\n set = new Set();\n dynamicRoutes.set(originalRoute, set);\n }\n\n set.add(\n route\n .replaceAll(CATCH_ALL, '${CatchAllRoutePart<T>}')\n .replaceAll(SLUG, '${SingleRoutePart<T>}')\n );\n } else {\n let set = staticRoutes.get(originalRoute);\n\n if (!set) {\n set = new Set();\n staticRoutes.set(originalRoute, set);\n }\n\n set.add(route);\n }\n };\n\n if (!route.match(ARRAY_GROUP_REGEX)) {\n addRoute(route, route);\n }\n\n // Does this route have a group? eg /(group)\n if (route.includes('/(')) {\n const routeWithoutGroups = route.replace(/\\/\\(.+?\\)/g, '');\n addRoute(route, routeWithoutGroups);\n\n // If there are multiple groups, we need to expand them\n // eg /(test1,test2)/page => /test1/page & /test2/page\n for (const routeWithSingleGroup of extrapolateGroupRoutes(route)) {\n addRoute(route, routeWithSingleGroup);\n }\n }\n\n return true;\n };\n\n return {\n staticRoutes,\n dynamicRoutes,\n filePathToRoute,\n addFilePath,\n isRouteFile,\n };\n}\n\nexport const setToUnionType = <T>(set: Set<T>) => {\n return set.size > 0 ? [...set].map((s) => `\\`${s}\\``).join(' | ') : 'never';\n};\n\n/**\n * Recursively walk a directory and call the callback with the file path.\n */\nasync function walk(directory: string, callback: (filePath: string) => void) {\n const files = await fs.readdir(directory);\n for (const file of files) {\n const p = path.join(directory, file);\n if ((await fs.stat(p)).isDirectory()) {\n await walk(p, callback);\n } else {\n // Normalise the paths so they are easier to convert to URLs\n const normalizedPath = p.replaceAll(path.sep, '/');\n callback(normalizedPath);\n }\n }\n}\n\n/**\n * Given a route, return all possible routes that could be generated from it.\n */\nexport function extrapolateGroupRoutes(\n route: string,\n routes: Set<string> = new Set()\n): Set<string> {\n // Create a version with no groups. We will then need to cleanup double and/or trailing slashes\n routes.add(route.replaceAll(ARRAY_GROUP_REGEX, '').replaceAll(/\\/+/g, '/').replace(/\\/$/, ''));\n\n const match = route.match(ARRAY_GROUP_REGEX);\n\n if (!match) {\n routes.add(route);\n return routes;\n }\n\n const groupsMatch = match[0];\n\n for (const group of groupsMatch.matchAll(CAPTURE_GROUP_REGEX)) {\n extrapolateGroupRoutes(route.replace(groupsMatch, `(${group[1].trim()})`), routes);\n }\n\n return routes;\n}\n\n/**\n * NOTE: This code refers to a specific version of `expo-router` and is therefore unsafe to\n * mix with arbitrary versions.\n * TODO: Version this code with `expo-router` or version expo-router with `@expo/cli`.\n */\nconst routerDotTSTemplate = unsafeTemplate`/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/ban-types */\ndeclare module \"expo-router\" {\n import type { LinkProps as OriginalLinkProps } from 'expo-router/build/link/Link';\n import type { Router as OriginalRouter } from 'expo-router/build/types';\n export * from 'expo-router/build';\n\n // prettier-ignore\n type StaticRoutes = ${'staticRoutes'};\n // prettier-ignore\n type DynamicRoutes<T extends string> = ${'dynamicRoutes'};\n // prettier-ignore\n type DynamicRouteTemplate = ${'dynamicRouteParams'};\n\n type RelativePathString = \\`./\\${string}\\` | \\`../\\${string}\\` | '..';\n type AbsoluteRoute = DynamicRouteTemplate | StaticRoutes;\n type ExternalPathString = \\`\\${string}:\\${string}\\`;\n\n type ExpoRouterRoutes = DynamicRouteTemplate | StaticRoutes | RelativePathString;\n type AllRoutes = ExpoRouterRoutes | ExternalPathString;\n\n /****************\n * Route Utils *\n ****************/\n\n type SearchOrHash = \\`?\\${string}\\` | \\`#\\${string}\\`;\n type UnknownInputParams = Record<string, string | number | (string | number)[]>;\n type UnknownOutputParams = Record<string, string | string[]>;\n\n /**\n * Return only the RoutePart of a string. If the string has multiple parts return never\n *\n * string | type\n * ---------|------\n * 123 | 123\n * /123/abc | never\n * 123?abc | never\n * ./123 | never\n * /123 | never\n * 123/../ | never\n */\n type SingleRoutePart<S extends string> = S extends \\`\\${string}/\\${string}\\`\n ? never\n : S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S extends \\`(\\${string})\\`\n ? never\n : S extends \\`[\\${string}]\\`\n ? never\n : S;\n\n /**\n * Return only the CatchAll router part. If the string has search parameters or a hash return never\n */\n type CatchAllRoutePart<S extends string> = S extends \\`\\${string}\\${SearchOrHash}\\`\n ? never\n : S extends ''\n ? never\n : S extends \\`\\${string}(\\${string})\\${string}\\`\n ? never\n : S extends \\`\\${string}[\\${string}]\\${string}\\`\n ? never\n : S;\n\n // type OptionalCatchAllRoutePart<S extends string> = S extends \\`\\${string}\\${SearchOrHash}\\` ? never : S\n\n /**\n * Return the name of a route parameter\n * '[test]' -> 'test'\n * 'test' -> never\n * '[...test]' -> '...test'\n */\n type IsParameter<Part> = Part extends \\`[\\${infer ParamName}]\\` ? ParamName : never;\n\n /**\n * Return a union of all parameter names. If there are no names return never\n *\n * /[test] -> 'test'\n * /[abc]/[...def] -> 'abc'|'...def'\n */\n type ParameterNames<Path> = Path extends \\`\\${infer PartA}/\\${infer PartB}\\`\n ? IsParameter<PartA> | ParameterNames<PartB>\n : IsParameter<Path>;\n\n /**\n * Returns all segements of a route.\n *\n * /(group)/123/abc/[id]/[...rest] -> ['(group)', '123', 'abc', '[id]', '[...rest]'\n */\n type RouteSegments<Path> = Path extends \\`\\${infer PartA}/\\${infer PartB}\\`\n ? PartA extends '' | '.'\n ? [...RouteSegments<PartB>]\n : [PartA, ...RouteSegments<PartB>]\n : Path extends ''\n ? []\n : [Path];\n\n /**\n * Returns a Record of the routes parameters as strings and CatchAll parameters\n *\n * There are two versions, input and output, as you can input 'string | number' but\n * the output will always be 'string'\n *\n * /[id]/[...rest] -> { id: string, rest: string[] }\n * /no-params -> {}\n */\n type InputRouteParams<Path> = {\n [Key in ParameterNames<Path> as Key extends \\`...\\${infer Name}\\`\n ? Name\n : Key]: Key extends \\`...\\${string}\\` ? (string | number)[] : string | number;\n } & UnknownInputParams;\n\n type OutputRouteParams<Path> = {\n [Key in ParameterNames<Path> as Key extends \\`...\\${infer Name}\\`\n ? Name\n : Key]: Key extends \\`...\\${string}\\` ? string[] : string;\n } & UnknownOutputParams;\n\n /**\n * Returns the search parameters for a route.\n */\n export type SearchParams<T extends AllRoutes> = T extends DynamicRouteTemplate\n ? OutputRouteParams<T>\n : T extends StaticRoutes\n ? never\n : UnknownOutputParams;\n\n /**\n * Route is mostly used as part of Href to ensure that a valid route is provided\n *\n * Given a dynamic route, this will return never. This is helpful for conditional logic\n *\n * /test -> /test, /test2, etc\n * /test/[abc] -> never\n * /test/resolve -> /test, /test2, etc\n *\n * Note that if we provide a value for [abc] then the route is allowed\n *\n * This is named Route to prevent confusion, as users they will often see it in tooltips\n */\n export type Route<T> = T extends string\n ? T extends DynamicRouteTemplate\n ? never\n :\n | StaticRoutes\n | RelativePathString\n | ExternalPathString\n | (T extends \\`\\${infer P}\\${SearchOrHash}\\`\n ? P extends DynamicRoutes<infer _>\n ? T\n : never\n : T extends DynamicRoutes<infer _>\n ? T\n : never)\n : never;\n\n /*********\n * Href *\n *********/\n\n export type Href<T> = T extends Record<'pathname', string> ? HrefObject<T> : Route<T>;\n\n export type HrefObject<\n R extends Record<'pathname', string>,\n P = R['pathname'],\n > = P extends DynamicRouteTemplate\n ? { pathname: P; params: InputRouteParams<P> }\n : P extends Route<P>\n ? { pathname: Route<P> | DynamicRouteTemplate; params?: never | InputRouteParams<never> }\n : never;\n\n /***********************\n * Expo Router Exports *\n ***********************/\n\n export type Router = Omit<OriginalRouter, 'push' | 'replace' | 'setParams'> & {\n /** Navigate to the provided href. */\n push: <T>(href: Href<T>) => void;\n /** Navigate to route without appending to the history. */\n replace: <T>(href: Href<T>) => void;\n /** Update the current route query params. */\n setParams: <T = ''>(params?: T extends '' ? Record<string, string> : InputRouteParams<T>) => void;\n };\n\n /** The imperative router. */\n export const router: Router;\n\n /************\n * <Link /> *\n ************/\n export interface LinkProps<T> extends OriginalLinkProps {\n href: Href<T>;\n }\n\n export interface LinkComponent {\n <T>(props: React.PropsWithChildren<LinkProps<T>>): JSX.Element;\n /** Helper method to resolve an Href object into a string. */\n resolveHref: <T>(href: Href<T>) => string;\n }\n\n /**\n * Component to render link to another route using a path.\n * Uses an anchor tag on the web.\n *\n * @param props.href Absolute path to route (e.g. \\`/feeds/hot\\`).\n * @param props.replace Should replace the current route without adding to the history.\n * @param props.asChild Forward props to child component. Useful for custom buttons.\n * @param props.children Child elements to render the content.\n * @param props.className On web, this sets the HTML \\`class\\` directly. On native, this can be used with CSS interop tools like Nativewind.\n */\n export const Link: LinkComponent;\n\n /** Redirects to the href as soon as the component is mounted. */\n export const Redirect: <T>(\n props: React.PropsWithChildren<{ href: Href<T> }>\n ) => JSX.Element;\n\n /************\n * Hooks *\n ************/\n export function useRouter(): Router;\n\n export function useLocalSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n >(): T extends AllRoutes ? SearchParams<T> : T;\n\n /** @deprecated renamed to \\`useGlobalSearchParams\\` */\n export function useSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n >(): T extends AllRoutes ? SearchParams<T> : T;\n\n export function useGlobalSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n >(): T extends AllRoutes ? SearchParams<T> : T;\n\n export function useSegments<\n T extends AbsoluteRoute | RouteSegments<AbsoluteRoute> | RelativePathString,\n >(): T extends AbsoluteRoute ? RouteSegments<T> : T extends string ? string[] : T;\n}\n`;\n"],"names":["setupTypedRoutes","getTemplateString","getTypedRoutesUtils","extrapolateGroupRoutes","CAPTURE_DYNAMIC_PARAMS","CATCH_ALL","SLUG","ARRAY_GROUP_REGEX","CAPTURE_GROUP_REGEX","TYPED_ROUTES_EXCLUSION_REGEX","server","metro","typesDirectory","projectRoot","routerDirectory","filePathToRoute","staticRoutes","dynamicRoutes","addFilePath","isRouteFile","metroWatchTypeScriptFiles","eventTypes","callback","filePath","type","shouldRegenerate","route","delete","regenerateRouterDotTS","Set","values","flatMap","v","Array","from","keys","directoryExistsAsync","walk","debounce","typesDir","dynamicRouteTemplates","fs","mkdir","recursive","writeFile","path","resolve","routerDotTSTemplate","setToUnionType","dynamicRouteParams","appRoot","filePathSeperator","sep","Map","normalizedFilePath","replaceAll","normalizedAppRoot","replace","match","relative","startsWith","isAbsolute","has","dynamicParams","matchAll","map","isDynamic","size","addRoute","originalRoute","set","get","add","includes","routeWithoutGroups","routeWithSingleGroup","s","join","directory","files","readdir","file","p","stat","isDirectory","normalizedPath","routes","groupsMatch","group","trim","unsafeTemplate"],"mappings":"AAAA;;;;QAoCsBA,gBAAgB,GAAhBA,gBAAgB;QAkFtBC,iBAAiB,GAAjBA,iBAAiB;QAiBjBC,mBAAmB,GAAnBA,mBAAmB;QA2InBC,sBAAsB,GAAtBA,sBAAsB;;AAlRvB,IAAA,SAAa,kCAAb,aAAa,EAAA;AACP,IAAA,eAAiB,kCAAjB,iBAAiB,EAAA;AAErB,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEc,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AAC1B,IAAA,SAAyB,WAAzB,yBAAyB,CAAA;AAEd,IAAA,0BAAoC,WAApC,oCAAoC,CAAA;;;;;;AAGvE,MAAMC,sBAAsB,6BAA6B,AAAC;QAApDA,sBAAsB,GAAtBA,sBAAsB;AAE5B,MAAMC,SAAS,mBAAmB,AAAC;QAA7BA,SAAS,GAATA,SAAS;AAEf,MAAMC,IAAI,aAAa,AAAC;QAAlBA,IAAI,GAAJA,IA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C;IAE7C,IAAI,CAACmD,KAAK,EAAE;QACV4B,MAAM,CAACd,GAAG,CAAC9C,KAAK,CAAC,CAAC;QAClB,OAAO4D,MAAM,CAAC;KACf;IAED,MAAMC,WAAW,GAAG7B,KAAK,CAAC,CAAC,CAAC,AAAC;IAE7B,KAAK,MAAM8B,KAAK,IAAID,WAAW,CAACvB,QAAQ,CAACxD,mBAAmB,CAAC,CAAE;QAC7DL,sBAAsB,CAACuB,KAAK,CAAC+B,OAAO,CAAC8B,WAAW,EAAE,CAAC,CAAC,EAAEC,KAAK,CAAC,CAAC,CAAC,CAACC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAEH,MAAM,CAAC,CAAC;KACpF;IAED,OAAOA,MAAM,CAAC;CACf;AAED;;;;GAIG,CACH,MAAMvC,mBAAmB,GAAG2C,SAAc,eAAA,CAAC;;;;;;;;;sBASrB,EAAE,cAAc,CAAC;;yCAEE,EAAE,eAAe,CAAC;;8BAE7B,EAAE,oBAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqOrD,CAAC,AAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/utils/analytics/getMetroProperties.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/analytics/getMetroProperties.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\n\n/**\n * Get the unstable / experimental properties used within the Metro config.\n * Note that this should match `metro-config`, but uses newer features that are not yet typed.\n *\n * @see https://github.com/facebook/metro/blob/1d51ffd33f54dba25c54b49ff059543dac519f21/packages/metro-config/src/configTypes.flow.js\n */\nexport function getMetroProperties(\n projectRoot: string,\n exp: ExpoConfig,\n metroConfig: Record<string, any> = {}\n) {\n return {\n sdkVersion: exp.sdkVersion,\n metroVersion: require('metro/package.json').version,\n\n fileMapCacheManagerFactory:\n Boolean(metroConfig.unstable_fileMapCacheManagerFactory) || undefined, // CacheManagerFactory\n perfLogger: Boolean(metroConfig.unstable_perfLogger) || undefined, // PerfLoggerFactory\n\n resolverEnableSymlinks: metroConfig.resolver?.unstable_enableSymlinks, // boolean\n resolverConditionNames: metroConfig.resolver?.unstable_conditionNames, // string[]\n resolverConditionsByPlatform: metroConfig.resolver?.unstable_conditionsByPlatform, // { [platform: string]: string[] }\n resolverEnablePackageExports: metroConfig.resolver?.unstable_enablePackageExports, // boolean\n\n serverImportBundleSupport: metroConfig.server?.experimentalImportBundleSupport, // boolean\n serverServerRoot: Boolean(metroConfig.server?.unstable_serverRoot) || undefined, // string | null\n\n transformerCollectDependenciesPath: metroConfig.transformer?.unstable_collectDependenciesPath, // string\n transformerDependencyMapReservedName:\n metroConfig.transformer?.unstable_dependencyMapReservedName, // string | null\n transformerDisableModuleWrapping: metroConfig.transformer?.unstable_disableModuleWrapping, // boolean\n transformerDisableNormalizePseudoGlobals:\n metroConfig.transformer?.unstable_disableNormalizePseudoGlobals, // boolean\n transformerCompactOutput: metroConfig.transformer?.unstable_compactOutput, // boolean\n transformerAllowRequireContext: metroConfig.transformer?.unstable_allowRequireContext, // boolean\n };\n}\n"],"names":["getMetroProperties","projectRoot","exp","metroConfig","sdkVersion","metroVersion","require","version","fileMapCacheManagerFactory","Boolean","unstable_fileMapCacheManagerFactory","undefined","perfLogger","unstable_perfLogger","resolverEnableSymlinks","resolver","unstable_enableSymlinks","resolverConditionNames","unstable_conditionNames","resolverConditionsByPlatform","unstable_conditionsByPlatform","resolverEnablePackageExports","unstable_enablePackageExports","serverImportBundleSupport","server","experimentalImportBundleSupport","serverServerRoot","unstable_serverRoot","transformerCollectDependenciesPath","transformer","unstable_collectDependenciesPath","transformerDependencyMapReservedName","unstable_dependencyMapReservedName","transformerDisableModuleWrapping","unstable_disableModuleWrapping","transformerDisableNormalizePseudoGlobals","unstable_disableNormalizePseudoGlobals","transformerCompactOutput","unstable_compactOutput","transformerAllowRequireContext","unstable_allowRequireContext"],"mappings":"AAAA;;;;QAQgBA,kBAAkB,GAAlBA,kBAAkB;AAA3B,SAASA,kBAAkB,CAChCC,WAAmB,EACnBC,GAAe,EACfC,WAAgC,GAAG,EAAE,EACrC;QAS0BA,GAAoB,EACpBA,IAAoB,EACdA,IAAoB,EACpBA,IAAoB,EAEvBA,IAAkB,EACnBA,IAAkB,EAERA,IAAuB,EAEzDA,IAAuB,EACSA,IAAuB,EAEvDA,IAAuB,EACCA,KAAuB,EACjBA,KAAuB;IAvBzD,OAAO;QACLC,UAAU,EAAEF,GAAG,CAACE,UAAU;QAC1BC,YAAY,EAAEC,OAAO,CAAC,oBAAoB,CAAC,CAACC,OAAO;QAEnDC,0BAA0B,EACxBC,OAAO,CAACN,WAAW,CAACO,mCAAmC,CAAC,IAAIC,SAAS;QACvEC,UAAU,EAAEH,OAAO,CAACN,WAAW,CAACU,mBAAmB,CAAC,IAAIF,SAAS;QAEjEG,sBAAsB,EAAEX,CAAAA,GAAoB,GAApBA,WAAW,CAACY,QAAQ,SAAyB,GAA7CZ,KAAAA,CAA6C,GAA7CA,GAAoB,CAAEa,uBAAuB;QACrEC,sBAAsB,EAAEd,CAAAA,IAAoB,GAApBA,WAAW,CAACY,QAAQ,SAAyB,GAA7CZ,KAAAA,CAA6C,GAA7CA,IAAoB,CAAEe,uBAAuB;QACrEC,4BAA4B,EAAEhB,CAAAA,IAAoB,GAApBA,WAAW,CAACY,QAAQ,SAA+B,GAAnDZ,KAAAA,CAAmD,GAAnDA,IAAoB,CAAEiB,6BAA6B;QACjFC,4BAA4B,EAAElB,CAAAA,IAAoB,GAApBA,WAAW,CAACY,QAAQ,SAA+B,GAAn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Id , deviceId } = identifyData;
|
|
96
96
|
const commonEventProperties = {
|
|
97
|
-
source_version: "0.16.
|
|
97
|
+
source_version: "0.16.6",
|
|
98
98
|
source: "expo"
|
|
99
99
|
};
|
|
100
100
|
const identity = {
|
|
@@ -135,7 +135,7 @@ function getContext() {
|
|
|
135
135
|
},
|
|
136
136
|
app: {
|
|
137
137
|
name: "expo",
|
|
138
|
-
version: "0.16.
|
|
138
|
+
version: "0.16.6"
|
|
139
139
|
},
|
|
140
140
|
ci: ciInfo.isCI ? {
|
|
141
141
|
name: ciInfo.name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.6",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@expo/osascript": "^2.0.31",
|
|
50
50
|
"@expo/package-manager": "^1.1.1",
|
|
51
51
|
"@expo/plist": "^0.1.0",
|
|
52
|
-
"@expo/prebuild-config": "6.7.
|
|
52
|
+
"@expo/prebuild-config": "6.7.3",
|
|
53
53
|
"@expo/rudder-sdk-node": "1.1.1",
|
|
54
54
|
"@expo/server": "^0.3.0",
|
|
55
55
|
"@expo/spawn-async": "1.5.0",
|
|
@@ -164,5 +164,5 @@
|
|
|
164
164
|
"tree-kill": "^1.2.2",
|
|
165
165
|
"tsd": "^0.28.1"
|
|
166
166
|
},
|
|
167
|
-
"gitHead": "
|
|
167
|
+
"gitHead": "b5a3db3c8993f3b22e8cba1e2c6005fee57988c2"
|
|
168
168
|
}
|