@expo/cli 0.16.3 → 0.16.5
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/start/interface/commandsTable.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +3 -3
- 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/build/src/utils/cocoapods.js +0 -1
- package/build/src/utils/cocoapods.js.map +1 -1
- package/package.json +9 -4
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.5");
|
|
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.5"
|
|
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,KAAK,GAAGC,OAAO,CAAC,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AAQ,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,CAAA;;;;;;;;;;;;;;;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M,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/interface/commandsTable.ts"],"sourcesContent":["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,EAAA;AACf,IAAA,SAAW,kCAAX,WAAW,EAAA;AAEpBC,IAAAA,GAAG,mCAAM,WAAW,EAAjB;;;;;;;;;;;;;;;;;;;;;;;;;;;AAER,MAAMC,GAAG,GAAG,QAAQ,AAAC;QAAfA,GAAG,GA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AAG,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"}
|
|
@@ -8,7 +8,7 @@ exports.getTypedRoutesUtils = getTypedRoutesUtils;
|
|
|
8
8
|
exports.extrapolateGroupRoutes = extrapolateGroupRoutes;
|
|
9
9
|
exports.setToUnionType = exports.TYPED_ROUTES_EXCLUSION_REGEX = exports.CAPTURE_GROUP_REGEX = exports.ARRAY_GROUP_REGEX = exports.SLUG = exports.CATCH_ALL = exports.CAPTURE_DYNAMIC_PARAMS = void 0;
|
|
10
10
|
var _promises = _interopRequireDefault(require("fs/promises"));
|
|
11
|
-
var
|
|
11
|
+
var _lodashDebounce = _interopRequireDefault(require("lodash.debounce"));
|
|
12
12
|
var _path = _interopRequireDefault(require("path"));
|
|
13
13
|
var _dir = require("../../../utils/dir");
|
|
14
14
|
var _template = require("../../../utils/template");
|
|
@@ -84,7 +84,7 @@ async function setupTypedRoutes({ server , metro , typesDirectory , projectRoot
|
|
|
84
84
|
/**
|
|
85
85
|
* Generate a router.d.ts file that contains all of the routes in the project.
|
|
86
86
|
* Should be debounced as its very common for developers to make changes to multiple files at once (eg Save All)
|
|
87
|
-
*/ const regenerateRouterDotTS = (0,
|
|
87
|
+
*/ const regenerateRouterDotTS = (0, _lodashDebounce).default(async (typesDir, staticRoutes, dynamicRoutes, dynamicRouteTemplates)=>{
|
|
88
88
|
await _promises.default.mkdir(typesDir, {
|
|
89
89
|
recursive: true
|
|
90
90
|
});
|
|
@@ -443,7 +443,7 @@ declare module "expo-router" {
|
|
|
443
443
|
* @param props.className On web, this sets the HTML \`class\` directly. On native, this can be used with CSS interop tools like Nativewind.
|
|
444
444
|
*/
|
|
445
445
|
export const Link: LinkComponent;
|
|
446
|
-
|
|
446
|
+
|
|
447
447
|
/** Redirects to the href as soon as the component is mounted. */
|
|
448
448
|
export const Redirect: <T>(
|
|
449
449
|
props: React.PropsWithChildren<{ href: Href<T> }>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/type-generation/routes.ts"],"sourcesContent":["import fs from 'fs/promises';\nimport { debounce } from 'lodash';\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;AACH,IAAA,OAAQ,WAAR,QAAQ,CAAA;AAEhB,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEc,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AAC1B,IAAA,SAAyB,WAAzB,yBAAyB,CAAA;AAEd,IAAA,0BAAoC,WAAp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AAC9C,KAAK,CAAC6B,UAAU,CAAChD,iBAAiB,EAAE,EAAE,CAAC,CAACgD,UAAU,SAAS,GAAG,CAAC,CAACE,OAAO,QAAQ,EAAE,CAAC,CAAC,CAAC;IAE/F,MAAMC,KAAK,GAAGhC,KAAK,CAACgC,KAAK,CAACnD,iBAAiB,CAAC,AAAC;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
|
+
{"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","st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AE7B,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,C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,CAAE6B,kCAAkC;QAC7DC,gCAAgC,EAAE9B,CAAAA,IAAuB,GAAvBA,WAAW,CAAC0B,WAAW,SAAgC,GAAvD1B,KAAAA,CAAuD,GAAvDA,IAAuB,CAAE+B,8BAA8B;QACzFC,wCAAwC,EACtChC,CAAAA,IAAuB,GAAvBA,WAAW,CAAC0B,WAAW,SAAwC,GAA/D1B,KAAAA,CAA+D,GAA/DA,IAAuB,CAAEiC,sCAAsC;QACjEC,wBAAwB,EAAElC,CAAAA,KAAuB,GAAvBA,WAAW,CAAC0B,WAAW,SAAwB,GAA/C1B,KAAAA,CAA+C,GAA/CA,KAAuB,CAAEmC,sBAAsB;QACzEC,8BAA8B,EAAEpC,CAAAA,KAAuB,GAAvBA,WAAW,CAAC0B,WAAW,SAA8B,GAArD1B,KAAAA,CAAqD,GAArDA,KAAuB,CAAEqC,4BAA4B;KACtF,CAAC;CACH"}
|
|
@@ -94,7 +94,7 @@ async function logEventAsync(event, properties = {}) {
|
|
|
94
94
|
}
|
|
95
95
|
const { userId , deviceId } = identifyData;
|
|
96
96
|
const commonEventProperties = {
|
|
97
|
-
source_version: "0.16.
|
|
97
|
+
source_version: "0.16.5",
|
|
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.5"
|
|
139
139
|
},
|
|
140
140
|
ci: ciInfo.isCI ? {
|
|
141
141
|
name: ciInfo.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/cocoapods.ts"],"sourcesContent":["import { getPackageJson, PackageJSONConfig } from '@expo/config';\nimport JsonFile from '@expo/json-file';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { ensureDirectoryAsync } from './dir';\nimport { env } from './env';\nimport { AbortCommandError } from './errors';\nimport { logNewSection } from './ora';\nimport * as Log from '../log';\nimport { hashForDependencyMap } from '../prebuild/updatePackageJson';\n\ntype PackageChecksums = {\n /** checksum for the `package.json` dependency object. */\n dependencies: string;\n /** checksum for the `package.json` devDependency object. */\n devDependencies: string;\n};\n\nconst PROJECT_PREBUILD_SETTINGS = '.expo/prebuild';\nconst CACHED_PACKAGE_JSON = 'cached-packages.json';\n\nfunction getTempPrebuildFolder(projectRoot: string): string {\n return path.join(projectRoot, PROJECT_PREBUILD_SETTINGS);\n}\n\nfunction hasNewDependenciesSinceLastBuild(\n projectRoot: string,\n packageChecksums: PackageChecksums\n): boolean {\n // TODO: Maybe comparing lock files would be better...\n const templateDirectory = getTempPrebuildFolder(projectRoot);\n const tempPkgJsonPath = path.join(templateDirectory, CACHED_PACKAGE_JSON);\n if (!fs.existsSync(tempPkgJsonPath)) {\n return true;\n }\n const { dependencies, devDependencies } = JsonFile.read(tempPkgJsonPath);\n // Only change the dependencies if the normalized hash changes, this helps to reduce meaningless changes.\n const hasNewDependencies = packageChecksums.dependencies !== dependencies;\n const hasNewDevDependencies = packageChecksums.devDependencies !== devDependencies;\n\n return hasNewDependencies || hasNewDevDependencies;\n}\n\nfunction createPackageChecksums(pkg: PackageJSONConfig): PackageChecksums {\n return {\n dependencies: hashForDependencyMap(pkg.dependencies || {}),\n devDependencies: hashForDependencyMap(pkg.devDependencies || {}),\n };\n}\n\n/** @returns `true` if the package.json dependency hash does not match the cached hash from the last run. */\nexport async function hasPackageJsonDependencyListChangedAsync(\n projectRoot: string\n): Promise<boolean> {\n const pkg = getPackageJson(projectRoot);\n\n const packages = createPackageChecksums(pkg);\n const hasNewDependencies = hasNewDependenciesSinceLastBuild(projectRoot, packages);\n\n // Cache package.json\n await ensureDirectoryAsync(getTempPrebuildFolder(projectRoot));\n const templateDirectory = path.join(getTempPrebuildFolder(projectRoot), CACHED_PACKAGE_JSON);\n await JsonFile.writeAsync(templateDirectory, packages);\n\n return hasNewDependencies;\n}\n\nexport async function installCocoaPodsAsync(projectRoot: string): Promise<boolean> {\n let step = logNewSection('Installing CocoaPods...');\n if (process.platform !== 'darwin') {\n step.succeed('Skipped installing CocoaPods because operating system is not on macOS.');\n return false;\n }\n\n const packageManager = new PackageManager.CocoaPodsPackageManager({\n cwd: path.join(projectRoot, 'ios'),\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n\n if (!(await packageManager.isCLIInstalledAsync())) {\n try {\n // prompt user -- do you want to install cocoapods right now?\n step.text = 'CocoaPods CLI not found in your PATH, installing it now.';\n step.stopAndPersist();\n await PackageManager.CocoaPodsPackageManager.installCLIAsync({\n nonInteractive: true,\n spawnOptions: {\n ...packageManager.options,\n // Don't silence this part\n stdio: ['inherit', 'inherit', 'pipe'],\n },\n });\n step.succeed('Installed CocoaPods CLI.');\n step = logNewSection('Running `pod install` in the `ios` directory.');\n } catch (error: any) {\n step.stopAndPersist({\n symbol: '⚠️ ',\n text: chalk.red('Unable to install the CocoaPods CLI.'),\n });\n if (error instanceof PackageManager.CocoaPodsError) {\n Log.log(error.message);\n } else {\n Log.log(`Unknown error: ${error.message}`);\n }\n return false;\n }\n }\n\n try {\n await packageManager.installAsync({\n // @ts-expect-error: multiple versions in the monorepo\n spinner: step,\n });\n // Create cached list for later\n await hasPackageJsonDependencyListChangedAsync(projectRoot).catch(() => null);\n step.succeed('Installed CocoaPods');\n return true;\n } catch (error: any) {\n step.stopAndPersist({\n symbol: '⚠️ ',\n text: chalk.red('Something went wrong running `pod install` in the `ios` directory.'),\n });\n if (error instanceof PackageManager.CocoaPodsError) {\n Log.log(error.message);\n } else {\n Log.log(`Unknown error: ${error.message}`);\n }\n return false;\n }\n}\n\nfunction doesProjectUseCocoaPods(projectRoot: string): boolean {\n return fs.existsSync(path.join(projectRoot, 'ios', 'Podfile'));\n}\n\nfunction isLockfileCreated(projectRoot: string): boolean {\n const podfileLockPath = path.join(projectRoot, 'ios', 'Podfile.lock');\n return fs.existsSync(podfileLockPath);\n}\n\nfunction isPodFolderCreated(projectRoot: string): boolean {\n const podFolderPath = path.join(projectRoot, 'ios', 'Pods');\n return fs.existsSync(podFolderPath);\n}\n\n// TODO: Same process but with app.config changes + default plugins.\n// This will ensure the user is prompted for extra setup.\nexport async function maybePromptToSyncPodsAsync(projectRoot: string) {\n if (!doesProjectUseCocoaPods(projectRoot)) {\n // Project does not use CocoaPods\n return;\n }\n if (!isLockfileCreated(projectRoot) || !isPodFolderCreated(projectRoot)) {\n if (!(await installCocoaPodsAsync(projectRoot))) {\n throw new AbortCommandError();\n }\n return;\n }\n\n // Getting autolinked packages can be heavy, optimize around checking every time.\n if (!(await hasPackageJsonDependencyListChangedAsync(projectRoot))) {\n return;\n }\n\n await promptToInstallPodsAsync(projectRoot, []);\n}\n\nasync function promptToInstallPodsAsync(projectRoot: string, missingPods?: string[]) {\n if (missingPods?.length) {\n Log.log(\n `Could not find the following native modules: ${missingPods\n .map((pod) => chalk.bold(pod))\n .join(', ')}. Did you forget to run \"${chalk.bold('pod install')}\" ?`\n );\n }\n\n try {\n if (!(await installCocoaPodsAsync(projectRoot))) {\n throw new AbortCommandError();\n }\n } catch (error) {\n await fs.promises.rm(path.join(getTempPrebuildFolder(projectRoot), CACHED_PACKAGE_JSON), {\n recursive: true,\n force: true,\n });\n throw error;\n }\n}\n"],"names":["hasPackageJsonDependencyListChangedAsync","installCocoaPodsAsync","maybePromptToSyncPodsAsync","PackageManager","Log","PROJECT_PREBUILD_SETTINGS","CACHED_PACKAGE_JSON","getTempPrebuildFolder","projectRoot","path","join","hasNewDependenciesSinceLastBuild","packageChecksums","templateDirectory","tempPkgJsonPath","fs","existsSync","dependencies","devDependencies","JsonFile","read","hasNewDependencies","hasNewDevDependencies","createPackageChecksums","pkg","hashForDependencyMap","getPackageJson","packages","ensureDirectoryAsync","writeAsync","step","logNewSection","process","platform","succeed","packageManager","CocoaPodsPackageManager","cwd","silent","env","EXPO_DEBUG","CI","isCLIInstalledAsync","text","stopAndPersist","installCLIAsync","nonInteractive","spawnOptions","options","stdio","error","symbol","chalk","red","CocoaPodsError","log","message","installAsync","spinner","catch","doesProjectUseCocoaPods","isLockfileCreated","podfileLockPath","isPodFolderCreated","podFolderPath","AbortCommandError","promptToInstallPodsAsync","missingPods","length","map","pod","bold","promises","rm","recursive","force"],"mappings":"AAAA;;;;QAsDsBA,wCAAwC,GAAxCA,wCAAwC;QAgBxCC,qBAAqB,GAArBA,qBAAqB;QAgFrBC,0BAA0B,GAA1BA,0BAA0B;AAtJE,IAAA,OAAc,WAAd,cAAc,CAAA;AAC3C,IAAA,SAAiB,kCAAjB,iBAAiB,EAAA;AAC1BC,IAAAA,cAAc,mCAAM,uBAAuB,EAA7B;AACR,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEc,IAAA,IAAO,WAAP,OAAO,CAAA;AACxB,IAAA,IAAO,WAAP,OAAO,CAAA;AACO,IAAA,OAAU,WAAV,UAAU,CAAA;AACd,IAAA,IAAO,WAAP,OAAO,CAAA;AACzBC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACsB,IAAA,kBAA+B,WAA/B,+BAA+B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AASpE,MAAMC,yBAAyB,GAAG,gBAAgB,AAAC;AACnD,MAAMC,mBAAmB,GAAG,sBAAsB,AAAC;AAEnD,SAASC,qBAAqB,CAACC,WAAmB,EAAU;IAC1D,OAAOC,KAAI,QAAA,CAACC,IAAI,CAACF,WAAW,EAAEH,yBAAyB,CAAC,CAAC;CAC1D;AAED,SAASM,gCAAgC,CACvCH,WAAmB,EACnBI,gBAAkC,EACzB;IACT,sDAAsD;IACtD,MAAMC,iBAAiB,GAAGN,qBAAqB,CAACC,WAAW,CAAC,AAAC;IAC7D,MAAMM,eAAe,GAAGL,KAAI,QAAA,CAACC,IAAI,CAACG,iBAAiB,EAAEP,mBAAmB,CA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ACmB,IAAI,CAACD,GAAG,CAAC;QAAA,CAAC,CAC7B5D,IAAI,CAAC,IAAI,CAAC,CAAC,yBAAyB,EAAE0C,MAAK,QAAA,CAACmB,IAAI,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CACxE,CAAC;KACH;IAED,IAAI;QACF,IAAI,CAAE,MAAMtE,qBAAqB,CAACO,WAAW,CAAC,AAAC,EAAE;YAC/C,MAAM,IAAIyD,OAAiB,kBAAA,EAAE,CAAC;SAC/B;KACF,CAAC,OAAOf,KAAK,EAAE;QACd,MAAMnC,GAAE,QAAA,CAACyD,QAAQ,CAACC,EAAE,CAAChE,KAAI,QAAA,CAACC,IAAI,CAACH,qBAAqB,CAACC,WAAW,CAAC,EAAEF,mBAAmB,CAAC,EAAE;YACvFoE,SAAS,EAAE,IAAI;YACfC,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;QACH,MAAMzB,KAAK,CAAC;KACb;CACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/cocoapods.ts"],"sourcesContent":["import { getPackageJson, PackageJSONConfig } from '@expo/config';\nimport JsonFile from '@expo/json-file';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { ensureDirectoryAsync } from './dir';\nimport { env } from './env';\nimport { AbortCommandError } from './errors';\nimport { logNewSection } from './ora';\nimport * as Log from '../log';\nimport { hashForDependencyMap } from '../prebuild/updatePackageJson';\n\ntype PackageChecksums = {\n /** checksum for the `package.json` dependency object. */\n dependencies: string;\n /** checksum for the `package.json` devDependency object. */\n devDependencies: string;\n};\n\nconst PROJECT_PREBUILD_SETTINGS = '.expo/prebuild';\nconst CACHED_PACKAGE_JSON = 'cached-packages.json';\n\nfunction getTempPrebuildFolder(projectRoot: string): string {\n return path.join(projectRoot, PROJECT_PREBUILD_SETTINGS);\n}\n\nfunction hasNewDependenciesSinceLastBuild(\n projectRoot: string,\n packageChecksums: PackageChecksums\n): boolean {\n // TODO: Maybe comparing lock files would be better...\n const templateDirectory = getTempPrebuildFolder(projectRoot);\n const tempPkgJsonPath = path.join(templateDirectory, CACHED_PACKAGE_JSON);\n if (!fs.existsSync(tempPkgJsonPath)) {\n return true;\n }\n const { dependencies, devDependencies } = JsonFile.read(tempPkgJsonPath);\n // Only change the dependencies if the normalized hash changes, this helps to reduce meaningless changes.\n const hasNewDependencies = packageChecksums.dependencies !== dependencies;\n const hasNewDevDependencies = packageChecksums.devDependencies !== devDependencies;\n\n return hasNewDependencies || hasNewDevDependencies;\n}\n\nfunction createPackageChecksums(pkg: PackageJSONConfig): PackageChecksums {\n return {\n dependencies: hashForDependencyMap(pkg.dependencies || {}),\n devDependencies: hashForDependencyMap(pkg.devDependencies || {}),\n };\n}\n\n/** @returns `true` if the package.json dependency hash does not match the cached hash from the last run. */\nexport async function hasPackageJsonDependencyListChangedAsync(\n projectRoot: string\n): Promise<boolean> {\n const pkg = getPackageJson(projectRoot);\n\n const packages = createPackageChecksums(pkg);\n const hasNewDependencies = hasNewDependenciesSinceLastBuild(projectRoot, packages);\n\n // Cache package.json\n await ensureDirectoryAsync(getTempPrebuildFolder(projectRoot));\n const templateDirectory = path.join(getTempPrebuildFolder(projectRoot), CACHED_PACKAGE_JSON);\n await JsonFile.writeAsync(templateDirectory, packages);\n\n return hasNewDependencies;\n}\n\nexport async function installCocoaPodsAsync(projectRoot: string): Promise<boolean> {\n let step = logNewSection('Installing CocoaPods...');\n if (process.platform !== 'darwin') {\n step.succeed('Skipped installing CocoaPods because operating system is not on macOS.');\n return false;\n }\n\n const packageManager = new PackageManager.CocoaPodsPackageManager({\n cwd: path.join(projectRoot, 'ios'),\n silent: !(env.EXPO_DEBUG || env.CI),\n });\n\n if (!(await packageManager.isCLIInstalledAsync())) {\n try {\n // prompt user -- do you want to install cocoapods right now?\n step.text = 'CocoaPods CLI not found in your PATH, installing it now.';\n step.stopAndPersist();\n await PackageManager.CocoaPodsPackageManager.installCLIAsync({\n nonInteractive: true,\n spawnOptions: {\n ...packageManager.options,\n // Don't silence this part\n stdio: ['inherit', 'inherit', 'pipe'],\n },\n });\n step.succeed('Installed CocoaPods CLI.');\n step = logNewSection('Running `pod install` in the `ios` directory.');\n } catch (error: any) {\n step.stopAndPersist({\n symbol: '⚠️ ',\n text: chalk.red('Unable to install the CocoaPods CLI.'),\n });\n if (error instanceof PackageManager.CocoaPodsError) {\n Log.log(error.message);\n } else {\n Log.log(`Unknown error: ${error.message}`);\n }\n return false;\n }\n }\n\n try {\n await packageManager.installAsync({ spinner: step });\n // Create cached list for later\n await hasPackageJsonDependencyListChangedAsync(projectRoot).catch(() => null);\n step.succeed('Installed CocoaPods');\n return true;\n } catch (error: any) {\n step.stopAndPersist({\n symbol: '⚠️ ',\n text: chalk.red('Something went wrong running `pod install` in the `ios` directory.'),\n });\n if (error instanceof PackageManager.CocoaPodsError) {\n Log.log(error.message);\n } else {\n Log.log(`Unknown error: ${error.message}`);\n }\n return false;\n }\n}\n\nfunction doesProjectUseCocoaPods(projectRoot: string): boolean {\n return fs.existsSync(path.join(projectRoot, 'ios', 'Podfile'));\n}\n\nfunction isLockfileCreated(projectRoot: string): boolean {\n const podfileLockPath = path.join(projectRoot, 'ios', 'Podfile.lock');\n return fs.existsSync(podfileLockPath);\n}\n\nfunction isPodFolderCreated(projectRoot: string): boolean {\n const podFolderPath = path.join(projectRoot, 'ios', 'Pods');\n return fs.existsSync(podFolderPath);\n}\n\n// TODO: Same process but with app.config changes + default plugins.\n// This will ensure the user is prompted for extra setup.\nexport async function maybePromptToSyncPodsAsync(projectRoot: string) {\n if (!doesProjectUseCocoaPods(projectRoot)) {\n // Project does not use CocoaPods\n return;\n }\n if (!isLockfileCreated(projectRoot) || !isPodFolderCreated(projectRoot)) {\n if (!(await installCocoaPodsAsync(projectRoot))) {\n throw new AbortCommandError();\n }\n return;\n }\n\n // Getting autolinked packages can be heavy, optimize around checking every time.\n if (!(await hasPackageJsonDependencyListChangedAsync(projectRoot))) {\n return;\n }\n\n await promptToInstallPodsAsync(projectRoot, []);\n}\n\nasync function promptToInstallPodsAsync(projectRoot: string, missingPods?: string[]) {\n if (missingPods?.length) {\n Log.log(\n `Could not find the following native modules: ${missingPods\n .map((pod) => chalk.bold(pod))\n .join(', ')}. Did you forget to run \"${chalk.bold('pod install')}\" ?`\n );\n }\n\n try {\n if (!(await installCocoaPodsAsync(projectRoot))) {\n throw new AbortCommandError();\n }\n } catch (error) {\n await fs.promises.rm(path.join(getTempPrebuildFolder(projectRoot), CACHED_PACKAGE_JSON), {\n recursive: true,\n force: true,\n });\n throw error;\n }\n}\n"],"names":["hasPackageJsonDependencyListChangedAsync","installCocoaPodsAsync","maybePromptToSyncPodsAsync","PackageManager","Log","PROJECT_PREBUILD_SETTINGS","CACHED_PACKAGE_JSON","getTempPrebuildFolder","projectRoot","path","join","hasNewDependenciesSinceLastBuild","packageChecksums","templateDirectory","tempPkgJsonPath","fs","existsSync","dependencies","devDependencies","JsonFile","read","hasNewDependencies","hasNewDevDependencies","createPackageChecksums","pkg","hashForDependencyMap","getPackageJson","packages","ensureDirectoryAsync","writeAsync","step","logNewSection","process","platform","succeed","packageManager","CocoaPodsPackageManager","cwd","silent","env","EXPO_DEBUG","CI","isCLIInstalledAsync","text","stopAndPersist","installCLIAsync","nonInteractive","spawnOptions","options","stdio","error","symbol","chalk","red","CocoaPodsError","log","message","installAsync","spinner","catch","doesProjectUseCocoaPods","isLockfileCreated","podfileLockPath","isPodFolderCreated","podFolderPath","AbortCommandError","promptToInstallPodsAsync","missingPods","length","map","pod","bold","promises","rm","recursive","force"],"mappings":"AAAA;;;;QAsDsBA,wCAAwC,GAAxCA,wCAAwC;QAgBxCC,qBAAqB,GAArBA,qBAAqB;QA6ErBC,0BAA0B,GAA1BA,0BAA0B;AAnJE,IAAA,OAAc,WAAd,cAAc,CAAA;AAC3C,IAAA,SAAiB,kCAAjB,iBAAiB,EAAA;AAC1BC,IAAAA,cAAc,mCAAM,uBAAuB,EAA7B;AACR,IAAA,MAAO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AC,EAAE;YACvFoE,SAAS,EAAE,IAAI;YACfC,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;QACH,MAAMzB,KAAK,CAAC;KACb;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.5",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -43,16 +43,18 @@
|
|
|
43
43
|
"@expo/config-plugins": "~7.8.0",
|
|
44
44
|
"@expo/devcert": "^1.0.0",
|
|
45
45
|
"@expo/env": "~0.2.0",
|
|
46
|
+
"@expo/image-utils": "^0.4.0",
|
|
46
47
|
"@expo/json-file": "^8.2.37",
|
|
47
48
|
"@expo/metro-config": "~0.17.0",
|
|
48
49
|
"@expo/osascript": "^2.0.31",
|
|
49
50
|
"@expo/package-manager": "^1.1.1",
|
|
50
51
|
"@expo/plist": "^0.1.0",
|
|
51
|
-
"@expo/prebuild-config": "6.7.
|
|
52
|
+
"@expo/prebuild-config": "6.7.2",
|
|
52
53
|
"@expo/rudder-sdk-node": "1.1.1",
|
|
53
54
|
"@expo/server": "^0.3.0",
|
|
54
55
|
"@expo/spawn-async": "1.5.0",
|
|
55
|
-
"@expo/xcpretty": "^4.
|
|
56
|
+
"@expo/xcpretty": "^4.3.0",
|
|
57
|
+
"@react-native/dev-middleware": "^0.73.6",
|
|
56
58
|
"@urql/core": "2.3.6",
|
|
57
59
|
"@urql/exchange-retry": "0.3.0",
|
|
58
60
|
"accepts": "^1.3.8",
|
|
@@ -65,6 +67,7 @@
|
|
|
65
67
|
"connect": "^3.7.0",
|
|
66
68
|
"debug": "^4.3.4",
|
|
67
69
|
"env-editor": "^0.4.1",
|
|
70
|
+
"find-yarn-workspace-root": "~2.0.0",
|
|
68
71
|
"form-data": "^3.0.1",
|
|
69
72
|
"freeport-async": "2.0.0",
|
|
70
73
|
"fs-extra": "~8.1.0",
|
|
@@ -78,6 +81,7 @@
|
|
|
78
81
|
"is-wsl": "^2.1.1",
|
|
79
82
|
"js-yaml": "^3.13.1",
|
|
80
83
|
"json-schema-deref-sync": "^0.13.0",
|
|
84
|
+
"lodash.debounce": "^4.0.8",
|
|
81
85
|
"md5hex": "^1.0.0",
|
|
82
86
|
"minimatch": "^3.0.4",
|
|
83
87
|
"minipass": "3.3.6",
|
|
@@ -133,6 +137,7 @@
|
|
|
133
137
|
"@types/getenv": "^1.0.0",
|
|
134
138
|
"@types/js-yaml": "^3.12.2",
|
|
135
139
|
"@types/klaw-sync": "^6.0.0",
|
|
140
|
+
"@types/lodash.debounce": "^4.0.9",
|
|
136
141
|
"@types/npm-package-arg": "^6.1.0",
|
|
137
142
|
"@types/progress": "^2.0.5",
|
|
138
143
|
"@types/prompts": "^2.0.6",
|
|
@@ -159,5 +164,5 @@
|
|
|
159
164
|
"tree-kill": "^1.2.2",
|
|
160
165
|
"tsd": "^0.28.1"
|
|
161
166
|
},
|
|
162
|
-
"gitHead": "
|
|
167
|
+
"gitHead": "36402c8b2bc9b63f003c04642d97bf091b35fe16"
|
|
163
168
|
}
|