@expo/cli 0.13.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +30 -27
- package/build/bin/cli.map +1 -1
- package/build/src/api/getVersions.js.map +1 -1
- package/build/src/api/rest/cache/response.js.map +1 -1
- package/build/src/api/rest/client.js +2 -2
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/config/configAsync.js +1 -1
- package/build/src/config/configAsync.js.map +1 -1
- package/build/src/config/index.js +2 -2
- package/build/src/config/index.js.map +1 -1
- package/build/src/customize/generate.js +1 -1
- package/build/src/customize/generate.js.map +1 -1
- package/build/src/customize/typescript.js +6 -4
- package/build/src/customize/typescript.js.map +1 -1
- package/build/src/export/createMetadataJson.js +3 -2
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +44 -17
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/index.js +4 -4
- package/build/src/export/embed/index.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +3 -3
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/exportApp.js +74 -83
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +81 -21
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportHermes.js +24 -14
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +109 -58
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +2 -2
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +56 -23
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/index.js +11 -9
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +101 -0
- package/build/src/export/metroAssetLocalPath.js.map +1 -0
- package/build/src/export/persistMetroAssets.js +94 -21
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/resolveOptions.js +1 -1
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +9 -48
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/web/exportWebAsync.js +1 -1
- package/build/src/export/web/exportWebAsync.js.map +1 -1
- package/build/src/export/web/index.js +2 -2
- package/build/src/export/web/index.js.map +1 -1
- package/build/src/export/writeContents.js +6 -3
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/applyPlugins.js +52 -0
- package/build/src/install/applyPlugins.js.map +1 -0
- package/build/src/install/checkPackages.js +2 -2
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/fixPackages.js +84 -0
- package/build/src/install/fixPackages.js.map +1 -0
- package/build/src/install/installAsync.js +32 -61
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/installExpoPackage.js +79 -0
- package/build/src/install/installExpoPackage.js.map +1 -0
- package/build/src/login/index.js +1 -1
- package/build/src/login/index.js.map +1 -1
- package/build/src/logout/index.js +1 -1
- package/build/src/logout/index.js.map +1 -1
- package/build/src/prebuild/clearNativeFolder.js +1 -1
- package/build/src/prebuild/clearNativeFolder.js.map +1 -1
- package/build/src/prebuild/configureProjectAsync.js +3 -3
- package/build/src/prebuild/configureProjectAsync.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +21 -30
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/index.js +3 -3
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +39 -17
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +2 -2
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +6 -6
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +49 -36
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/prebuild/validateTemplatePlatforms.js +2 -2
- package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
- package/build/src/register/index.js +1 -1
- package/build/src/register/index.js.map +1 -1
- package/build/src/run/android/index.js +2 -2
- package/build/src/run/android/index.js.map +1 -1
- package/build/src/run/ios/appleDevice/AppleDevice.js +35 -2
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
- package/build/src/run/ios/index.js +2 -2
- package/build/src/run/ios/index.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +12 -4
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +20 -3
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/index.js +3 -3
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +30 -11
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +14 -10
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +6 -1
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevToolsPluginManager.js +63 -0
- package/build/src/start/server/DevToolsPluginManager.js.map +1 -0
- package/build/src/start/server/getStaticRenderFunctions.js +21 -20
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +67 -64
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/bundleApiRoutes.js +4 -19
- package/build/src/start/server/metro/bundleApiRoutes.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +187 -0
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -0
- package/build/src/start/server/metro/createJResolver.js +149 -0
- package/build/src/start/server/metro/createJResolver.js.map +1 -0
- package/build/src/start/server/metro/createServerRouteMiddleware.js +13 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/externals.js +25 -3
- package/build/src/start/server/metro/externals.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/formatFileCandidates.js +72 -0
- package/build/src/start/server/metro/formatFileCandidates.js.map +1 -0
- package/build/src/start/server/metro/inspector-proxy/device.js +3 -1
- package/build/src/start/server/metro/inspector-proxy/device.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js +3 -4
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.js +24 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.js.map +1 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/utils.js +11 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/utils.js.map +1 -0
- package/build/src/start/server/metro/inspector-proxy/index.js +10 -7
- package/build/src/start/server/metro/inspector-proxy/index.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +37 -16
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +3 -2
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/router.js +6 -3
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +19 -10
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +43 -0
- package/build/src/start/server/metro/serializeHtml.js.map +1 -0
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +1 -2
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +268 -191
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js +114 -40
- package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +61 -0
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/ExpoMiddleware.js +2 -2
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +45 -68
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js +30 -26
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js +7 -7
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js +5 -2
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js +3 -2
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js +8 -7
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +123 -0
- package/build/src/start/server/middleware/metroOptions.js.map +1 -0
- package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -1
- package/build/src/start/server/type-generation/expo-env.js +1 -1
- package/build/src/start/server/type-generation/expo-env.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +1 -0
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/utils/analytics/getMetroDebugProperties.js +1 -2
- package/build/src/utils/analytics/getMetroDebugProperties.js.map +1 -1
- package/build/src/utils/analytics/getMetroProperties.js +1 -2
- package/build/src/utils/analytics/getMetroProperties.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/args.js +4 -2
- package/build/src/utils/args.js.map +1 -1
- package/build/src/utils/cocoapods.js +2 -1
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/dir.js +18 -8
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/env.js +6 -0
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +2 -4
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/prompts.js +1 -28
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/whoami/index.js +1 -1
- package/build/src/whoami/index.js.map +1 -1
- package/package.json +16 -16
- package/static/shims/react-native-web/dist/cjs/exports/AppRegistry/AppContainer.js +13 -0
- package/static/shims/react-native-web/dist/cjs/exports/BackHandler/index.js +10 -0
- package/static/shims/react-native-web/dist/exports/AppRegistry/AppContainer.js +12 -0
- package/static/shims/react-native-web/dist/exports/BackHandler/index.js +7 -0
- package/build/src/export/createBundles.js +0 -37
- package/build/src/export/createBundles.js.map +0 -1
- package/build/src/start/server/metro/resolveFromProject.js +0 -90
- package/build/src/start/server/metro/resolveFromProject.js.map +0 -1
- package/build/src/start/server/middleware/resolveEntryPoint.js +0 -42
- package/build/src/start/server/middleware/resolveEntryPoint.js.map +0 -1
|
@@ -9,13 +9,14 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
9
9
|
var _launchBrowserTypes = require("./LaunchBrowser.types");
|
|
10
10
|
class LaunchBrowserImplWindows {
|
|
11
11
|
MAP = {
|
|
12
|
-
[_launchBrowserTypes.
|
|
13
|
-
appId: "chrome"
|
|
14
|
-
fullName: "Google Chrome"
|
|
12
|
+
[_launchBrowserTypes.LaunchBrowserTypesEnum.CHROME]: {
|
|
13
|
+
appId: "chrome"
|
|
15
14
|
},
|
|
16
|
-
[_launchBrowserTypes.
|
|
17
|
-
appId: "msedge"
|
|
18
|
-
|
|
15
|
+
[_launchBrowserTypes.LaunchBrowserTypesEnum.EDGE]: {
|
|
16
|
+
appId: "msedge"
|
|
17
|
+
},
|
|
18
|
+
[_launchBrowserTypes.LaunchBrowserTypesEnum.BRAVE]: {
|
|
19
|
+
appId: "brave"
|
|
19
20
|
}
|
|
20
21
|
};
|
|
21
22
|
async isSupportedBrowser(browserType) {
|
|
@@ -24,7 +25,7 @@ class LaunchBrowserImplWindows {
|
|
|
24
25
|
const env = await this.getPowershellEnv();
|
|
25
26
|
const { status } = await (0, _spawnAsync).default("powershell.exe", [
|
|
26
27
|
"-c",
|
|
27
|
-
`Get-Package -Name '${
|
|
28
|
+
`Get-Package -Name '${browserType}'`
|
|
28
29
|
], {
|
|
29
30
|
// @ts-expect-error: Missing NODE_ENV
|
|
30
31
|
env,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/middleware/inspector/LaunchBrowserImplWindows.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport open from 'open';\nimport path from 'path';\n\nimport {\n LaunchBrowserTypes,\n type
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/middleware/inspector/LaunchBrowserImplWindows.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport open from 'open';\nimport path from 'path';\n\nimport {\n LaunchBrowserTypes,\n type LaunchBrowser,\n type LaunchBrowserInstance,\n LaunchBrowserTypesEnum,\n} from './LaunchBrowser.types';\n\nconst IS_WSL = require('is-wsl') && !require('is-docker')();\n\n/**\n * Browser implementation for Windows and WSL\n *\n * To minimize the difference between Windows and WSL, the implementation wraps all spawn calls through powershell.\n */\nexport default class LaunchBrowserImplWindows implements LaunchBrowser, LaunchBrowserInstance {\n private _appId: string | undefined;\n private _powershellEnv: { [key: string]: string } | undefined;\n\n MAP = {\n [LaunchBrowserTypesEnum.CHROME]: {\n appId: 'chrome',\n },\n [LaunchBrowserTypesEnum.EDGE]: {\n appId: 'msedge',\n },\n [LaunchBrowserTypesEnum.BRAVE]: {\n appId: 'brave',\n },\n };\n\n async isSupportedBrowser(browserType: LaunchBrowserTypes): Promise<boolean> {\n let result = false;\n try {\n const env = await this.getPowershellEnv();\n const { status } = await spawnAsync(\n 'powershell.exe',\n ['-c', `Get-Package -Name '${browserType}'`],\n {\n // @ts-expect-error: Missing NODE_ENV\n env,\n stdio: 'ignore',\n }\n );\n result = status === 0;\n } catch {\n result = false;\n }\n return result;\n }\n\n async createTempBrowserDir(baseDirName: string) {\n let tmpDir;\n if (IS_WSL) {\n // On WSL, the browser is actually launched in host, the `temp-dir` returns the linux /tmp path where host browsers cannot reach into.\n // We should get the temp path through the `$TEMP` windows environment variable.\n tmpDir = (await spawnAsync('powershell.exe', ['-c', 'echo \"$Env:TEMP\"'])).stdout.trim();\n return `${tmpDir}\\\\${baseDirName}`;\n } else {\n tmpDir = require('temp-dir');\n return path.join(tmpDir, baseDirName);\n }\n }\n\n async launchAsync(\n browserType: LaunchBrowserTypes,\n args: string[]\n ): Promise<LaunchBrowserInstance> {\n const appId = this.MAP[browserType].appId;\n await openWithSystemRootEnvironment(appId, { arguments: args });\n this._appId = appId;\n return this;\n }\n\n async close(): Promise<void> {\n if (this._appId != null) {\n try {\n // Since we wrap all spawn calls through powershell as well as from `open.openApp`, the returned ChildProcess is not the browser process.\n // And we cannot just call `process.kill()` kill it.\n // The implementation tries to find the pid of target chromium browser process (with --app=https://chrome-devtools-frontend.appspot.com in command arguments),\n // and uses taskkill to terminate the process.\n const env = await this.getPowershellEnv();\n await spawnAsync(\n 'powershell.exe',\n [\n '-c',\n `taskkill.exe /pid @(Get-WmiObject Win32_Process -Filter \"name = '${this._appId}.exe' AND CommandLine LIKE '%chrome-devtools-frontend.appspot.com%'\" | Select-Object -ExpandProperty ProcessId)`,\n ],\n {\n // @ts-expect-error: Missing NODE_ENV\n env,\n stdio: 'ignore',\n }\n );\n } catch {}\n this._appId = undefined;\n }\n }\n\n /**\n * This method is used to get the powershell environment variables for `Get-Package` command.\n * Especially for powershell 7, its default `PSModulePath` is different from powershell 5 and `Get-Package` command is not available.\n * We need to set the PSModulePath to include the default value of powershell 5.\n */\n private async getPowershellEnv(): Promise<{ [key: string]: string }> {\n if (this._powershellEnv) {\n return this._powershellEnv;\n }\n const PSModulePath = (\n await spawnAsync('powershell.exe', ['-c', 'echo \"$PSHOME\\\\Modules\"'])\n ).stdout.trim();\n this._powershellEnv = {\n PSModulePath,\n };\n return this._powershellEnv;\n }\n}\n\n/**\n * Due to a bug in `open` on Windows PowerShell, we need to ensure `process.env.SYSTEMROOT` is set.\n * This environment variable is set by Windows on `SystemRoot`, causing `open` to execute a command with an \"unknown\" drive letter.\n *\n * @see https://github.com/sindresorhus/open/issues/205\n */\nasync function openWithSystemRootEnvironment(\n appId: string | Readonly<string[]>,\n options?: open.OpenAppOptions\n): Promise<import('child_process').ChildProcess> {\n const oldSystemRoot = process.env.SYSTEMROOT;\n try {\n process.env.SYSTEMROOT = process.env.SYSTEMROOT ?? process.env.SystemRoot;\n return await open.openApp(appId, options);\n } finally {\n process.env.SYSTEMROOT = oldSystemRoot;\n }\n}\n"],"names":["LaunchBrowserImplWindows","MAP","LaunchBrowserTypesEnum","CHROME","appId","EDGE","BRAVE","isSupportedBrowser","browserType","result","env","getPowershellEnv","status","spawnAsync","stdio","createTempBrowserDir","baseDirName","tmpDir","IS_WSL","stdout","trim","require","path","join","launchAsync","args","openWithSystemRootEnvironment","arguments","_appId","close","undefined","_powershellEnv","PSModulePath","options","oldSystemRoot","process","SYSTEMROOT","SystemRoot","open","openApp"],"mappings":"AAAA;;;;;AAAuB,IAAA,WAAmB,kCAAnB,mBAAmB,EAAA;AACzB,IAAA,KAAM,kCAAN,MAAM,EAAA;AACN,IAAA,KAAM,kCAAN,MAAM,EAAA;AAOhB,IAAA,mBAAuB,WAAvB,uBAAuB,CAAA;AASf,MAAMA,wBAAwB;IAI3CC,GAAG,GAAG;QACJ,CAACC,mBAAsB,uBAAA,CAACC,MAAM,CAAC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;QACF,OAAO,IAAI,CAACD,cAAc,CAAC;KAC5B;CACF;kBArGoB/B,wBAAwB;;;;;;AAP7C,MAAMkB,MAAM,GAAGG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAACA,OAAO,CAAC,WAAW,CAAC,EAAE,AAAC;AA8G5D;;;;;GAKG,CACH,eAAeK,6BAA6B,CAC1CtB,KAAkC,EAClC6B,OAA6B,EACkB;IAC/C,MAAMC,aAAa,GAAGC,OAAO,CAACzB,GAAG,CAAC0B,UAAU,AAAC;IAC7C,IAAI;YACuBD,WAAsB;QAA/CA,OAAO,CAACzB,GAAG,CAAC0B,UAAU,GAAGD,CAAAA,WAAsB,GAAtBA,OAAO,CAACzB,GAAG,CAAC0B,UAAU,YAAtBD,WAAsB,GAAIA,OAAO,CAACzB,GAAG,CAAC2B,UAAU,CAAC;QAC1E,OAAO,MAAMC,KAAI,QAAA,CAACC,OAAO,CAACnC,KAAK,EAAE6B,OAAO,CAAC,CAAC;KAC3C,QAAS;QACRE,OAAO,CAACzB,GAAG,CAAC0B,UAAU,GAAGF,aAAa,CAAC;KACxC;CACF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.shouldEnableAsyncImports = shouldEnableAsyncImports;
|
|
6
|
+
exports.getBaseUrlFromExpoConfig = getBaseUrlFromExpoConfig;
|
|
7
|
+
exports.getMetroDirectBundleOptions = getMetroDirectBundleOptions;
|
|
8
|
+
exports.createBundleUrlPath = createBundleUrlPath;
|
|
9
|
+
var _resolveFrom = _interopRequireDefault(require("resolve-from"));
|
|
10
|
+
var _env = require("../../../utils/env");
|
|
11
|
+
function _interopRequireDefault(obj) {
|
|
12
|
+
return obj && obj.__esModule ? obj : {
|
|
13
|
+
default: obj
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const debug = require("debug")("expo:metro:options");
|
|
17
|
+
function shouldEnableAsyncImports(projectRoot) {
|
|
18
|
+
if (_env.env.EXPO_NO_METRO_LAZY) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
// `@expo/metro-runtime` includes support for the fetch + eval runtime code required
|
|
22
|
+
// to support async imports. If it's not installed, we can't support async imports.
|
|
23
|
+
// If it is installed, the user MUST import it somewhere in their project.
|
|
24
|
+
// Expo Router automatically pulls this in, so we can check for it.
|
|
25
|
+
return _resolveFrom.default.silent(projectRoot, "@expo/metro-runtime") != null;
|
|
26
|
+
}
|
|
27
|
+
function withDefaults({ mode ="development" , minify =mode === "production" , preserveEnvVars =_env.env.EXPO_NO_CLIENT_ENV_VARS , ...props }) {
|
|
28
|
+
return {
|
|
29
|
+
mode,
|
|
30
|
+
minify,
|
|
31
|
+
preserveEnvVars,
|
|
32
|
+
...props
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function getBaseUrlFromExpoConfig(exp) {
|
|
36
|
+
var ref, ref1;
|
|
37
|
+
var ref2;
|
|
38
|
+
return (ref2 = (ref = exp.experiments) == null ? void 0 : (ref1 = ref.baseUrl) == null ? void 0 : ref1.trim().replace(/\/+$/, "")) != null ? ref2 : "";
|
|
39
|
+
}
|
|
40
|
+
function getMetroDirectBundleOptions(options) {
|
|
41
|
+
const { mainModuleName , platform , mode , minify , environment , serializerOutput , serializerIncludeMaps , lazy , engine , preserveEnvVars , baseUrl , } = withDefaults(options);
|
|
42
|
+
const dev = mode !== "production";
|
|
43
|
+
const isHermes = engine === "hermes";
|
|
44
|
+
if (!dev && platform !== "web") {
|
|
45
|
+
debug("Disabling lazy bundling for non-web platform in production mode");
|
|
46
|
+
options.lazy = false;
|
|
47
|
+
}
|
|
48
|
+
let fakeSourceUrl;
|
|
49
|
+
let fakeSourceMapUrl;
|
|
50
|
+
// TODO: Upstream support to Metro for passing custom serializer options.
|
|
51
|
+
if (serializerIncludeMaps != null || serializerOutput != null) {
|
|
52
|
+
fakeSourceUrl = new URL(createBundleUrlPath(options).replace(/^\//, ""), "http://localhost:8081").toString();
|
|
53
|
+
if (serializerIncludeMaps) {
|
|
54
|
+
fakeSourceMapUrl = fakeSourceUrl.replace(".bundle?", ".map?");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const bundleOptions = {
|
|
58
|
+
platform,
|
|
59
|
+
entryFile: mainModuleName,
|
|
60
|
+
dev,
|
|
61
|
+
minify: !isHermes && (minify != null ? minify : !dev),
|
|
62
|
+
inlineSourceMap: false,
|
|
63
|
+
lazy,
|
|
64
|
+
unstable_transformProfile: isHermes ? "hermes-stable" : "default",
|
|
65
|
+
customTransformOptions: {
|
|
66
|
+
__proto__: null,
|
|
67
|
+
engine,
|
|
68
|
+
preserveEnvVars,
|
|
69
|
+
environment,
|
|
70
|
+
baseUrl
|
|
71
|
+
},
|
|
72
|
+
customResolverOptions: {
|
|
73
|
+
__proto__: null,
|
|
74
|
+
environment
|
|
75
|
+
},
|
|
76
|
+
sourceMapUrl: fakeSourceMapUrl,
|
|
77
|
+
sourceUrl: fakeSourceUrl,
|
|
78
|
+
serializerOptions: {
|
|
79
|
+
output: serializerOutput,
|
|
80
|
+
includeMaps: serializerIncludeMaps
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
return bundleOptions;
|
|
84
|
+
}
|
|
85
|
+
function createBundleUrlPath(options) {
|
|
86
|
+
const { platform , mainModuleName , mode , minify , environment , serializerOutput , serializerIncludeMaps , lazy , engine , preserveEnvVars , baseUrl , } = withDefaults(options);
|
|
87
|
+
const dev = String(mode !== "production");
|
|
88
|
+
const queryParams = new URLSearchParams({
|
|
89
|
+
platform: encodeURIComponent(platform),
|
|
90
|
+
dev,
|
|
91
|
+
// TODO: Is this still needed?
|
|
92
|
+
hot: String(false)
|
|
93
|
+
});
|
|
94
|
+
// Lazy bundling must be disabled for bundle splitting to work.
|
|
95
|
+
if (lazy && !dev) {
|
|
96
|
+
queryParams.append("lazy", String(lazy));
|
|
97
|
+
}
|
|
98
|
+
if (minify) {
|
|
99
|
+
queryParams.append("minify", String(minify));
|
|
100
|
+
}
|
|
101
|
+
if (engine) {
|
|
102
|
+
queryParams.append("transform.engine", engine);
|
|
103
|
+
}
|
|
104
|
+
if (preserveEnvVars) {
|
|
105
|
+
queryParams.append("transform.preserveEnvVars", String(preserveEnvVars));
|
|
106
|
+
}
|
|
107
|
+
if (baseUrl) {
|
|
108
|
+
queryParams.append("transform.baseUrl", baseUrl);
|
|
109
|
+
}
|
|
110
|
+
if (environment) {
|
|
111
|
+
queryParams.append("resolver.environment", environment);
|
|
112
|
+
queryParams.append("transform.environment", environment);
|
|
113
|
+
}
|
|
114
|
+
if (serializerOutput) {
|
|
115
|
+
queryParams.append("serializer.output", serializerOutput);
|
|
116
|
+
}
|
|
117
|
+
if (serializerIncludeMaps) {
|
|
118
|
+
queryParams.append("serializer.map", String(serializerIncludeMaps));
|
|
119
|
+
}
|
|
120
|
+
return `/${encodeURI(mainModuleName)}.bundle?${queryParams.toString()}`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=metroOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/middleware/metroOptions.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport type { BundleOptions as MetroBundleOptions } from 'metro/src/shared/types';\nimport resolveFrom from 'resolve-from';\n\nimport { env } from '../../../utils/env';\n\nconst debug = require('debug')('expo:metro:options') as typeof console.log;\n\nexport function shouldEnableAsyncImports(projectRoot: string): boolean {\n if (env.EXPO_NO_METRO_LAZY) {\n return false;\n }\n\n // `@expo/metro-runtime` includes support for the fetch + eval runtime code required\n // to support async imports. If it's not installed, we can't support async imports.\n // If it is installed, the user MUST import it somewhere in their project.\n // Expo Router automatically pulls this in, so we can check for it.\n return resolveFrom.silent(projectRoot, '@expo/metro-runtime') != null;\n}\n\nexport type ExpoMetroOptions = {\n platform: string;\n mainModuleName: string;\n mode: string;\n minify?: boolean;\n environment?: string;\n serializerOutput?: 'static';\n serializerIncludeMaps?: boolean;\n lazy?: boolean;\n engine?: 'hermes';\n preserveEnvVars?: boolean;\n baseUrl?: string;\n};\n\nfunction withDefaults({\n mode = 'development',\n minify = mode === 'production',\n preserveEnvVars = env.EXPO_NO_CLIENT_ENV_VARS,\n ...props\n}: ExpoMetroOptions): ExpoMetroOptions {\n return {\n mode,\n minify,\n preserveEnvVars,\n ...props,\n };\n}\n\nexport type SerializerOptions = {\n includeMaps?: boolean;\n output?: 'static';\n};\n\nexport type ExpoMetroBundleOptions = MetroBundleOptions & {\n serializerOptions?: SerializerOptions;\n};\n\nexport function getBaseUrlFromExpoConfig(exp: ExpoConfig) {\n return exp.experiments?.baseUrl?.trim().replace(/\\/+$/, '') ?? '';\n}\n\nexport function getMetroDirectBundleOptions(\n options: ExpoMetroOptions\n): Partial<ExpoMetroBundleOptions> {\n const {\n mainModuleName,\n platform,\n mode,\n minify,\n environment,\n serializerOutput,\n serializerIncludeMaps,\n lazy,\n engine,\n preserveEnvVars,\n baseUrl,\n } = withDefaults(options);\n\n const dev = mode !== 'production';\n const isHermes = engine === 'hermes';\n\n if (!dev && platform !== 'web') {\n debug('Disabling lazy bundling for non-web platform in production mode');\n options.lazy = false;\n }\n\n let fakeSourceUrl: string | undefined;\n let fakeSourceMapUrl: string | undefined;\n\n // TODO: Upstream support to Metro for passing custom serializer options.\n if (serializerIncludeMaps != null || serializerOutput != null) {\n fakeSourceUrl = new URL(\n createBundleUrlPath(options).replace(/^\\//, ''),\n 'http://localhost:8081'\n ).toString();\n if (serializerIncludeMaps) {\n fakeSourceMapUrl = fakeSourceUrl.replace('.bundle?', '.map?');\n }\n }\n\n const bundleOptions: Partial<ExpoMetroBundleOptions> = {\n platform,\n entryFile: mainModuleName,\n dev,\n minify: !isHermes && (minify ?? !dev),\n inlineSourceMap: false,\n lazy,\n unstable_transformProfile: isHermes ? 'hermes-stable' : 'default',\n customTransformOptions: {\n __proto__: null,\n engine,\n preserveEnvVars,\n environment,\n baseUrl,\n },\n customResolverOptions: {\n __proto__: null,\n environment,\n },\n sourceMapUrl: fakeSourceMapUrl,\n sourceUrl: fakeSourceUrl,\n serializerOptions: {\n output: serializerOutput,\n includeMaps: serializerIncludeMaps,\n },\n };\n\n return bundleOptions;\n}\n\nexport function createBundleUrlPath(options: ExpoMetroOptions): string {\n const {\n platform,\n mainModuleName,\n mode,\n minify,\n environment,\n serializerOutput,\n serializerIncludeMaps,\n lazy,\n engine,\n preserveEnvVars,\n baseUrl,\n } = withDefaults(options);\n\n const dev = String(mode !== 'production');\n const queryParams = new URLSearchParams({\n platform: encodeURIComponent(platform),\n dev,\n // TODO: Is this still needed?\n hot: String(false),\n });\n\n // Lazy bundling must be disabled for bundle splitting to work.\n if (lazy && !dev) {\n queryParams.append('lazy', String(lazy));\n }\n\n if (minify) {\n queryParams.append('minify', String(minify));\n }\n\n if (engine) {\n queryParams.append('transform.engine', engine);\n }\n\n if (preserveEnvVars) {\n queryParams.append('transform.preserveEnvVars', String(preserveEnvVars));\n }\n if (baseUrl) {\n queryParams.append('transform.baseUrl', baseUrl);\n }\n\n if (environment) {\n queryParams.append('resolver.environment', environment);\n queryParams.append('transform.environment', environment);\n }\n\n if (serializerOutput) {\n queryParams.append('serializer.output', serializerOutput);\n }\n if (serializerIncludeMaps) {\n queryParams.append('serializer.map', String(serializerIncludeMaps));\n }\n\n return `/${encodeURI(mainModuleName)}.bundle?${queryParams.toString()}`;\n}\n"],"names":["shouldEnableAsyncImports","getBaseUrlFromExpoConfig","getMetroDirectBundleOptions","createBundleUrlPath","debug","require","projectRoot","env","EXPO_NO_METRO_LAZY","resolveFrom","silent","withDefaults","mode","minify","preserveEnvVars","EXPO_NO_CLIENT_ENV_VARS","props","exp","experiments","baseUrl","trim","replace","options","mainModuleName","platform","environment","serializerOutput","serializerIncludeMaps","lazy","engine","dev","isHermes","fakeSourceUrl","fakeSourceMapUrl","URL","toString","bundleOptions","entryFile","inlineSourceMap","unstable_transformProfile","customTransformOptions","__proto__","customResolverOptions","sourceMapUrl","sourceUrl","serializerOptions","output","includeMaps","String","queryParams","URLSearchParams","encodeURIComponent","hot","append","encodeURI"],"mappings":"AAAA;;;;QAQgBA,wBAAwB,GAAxBA,wBAAwB;QAiDxBC,wBAAwB,GAAxBA,wBAAwB;QAIxBC,2BAA2B,GAA3BA,2BAA2B;QAqE3BC,mBAAmB,GAAnBA,mBAAmB;AAhIX,IAAA,YAAc,kCAAd,cAAc,EAAA;AAElB,IAAA,IAAoB,WAApB,oBAAoB,CAAA;;;;;;AAExC,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,AAAsB,AAAC;AAEpE,SAASL,wBAAwB,CAACM,WAAmB,EAAW;IACrE,IAAIC,IAAG,IAAA,CAACC,kBAAkB,EAAE;QAC1B,OAAO,KAAK,CAAC;KACd;IAED,oFAAoF;IACpF,mFAAmF;IACnF,0EAA0E;IAC1E,mEAAmE;IACnE,OAAOC,YAAW,QAAA,CAACC,MAAM,CAACJ,WAAW,EAAE,qBAAqB,CAAC,IAAI,IAAI,CAAC;CACvE;AAgBD,SAASK,YAAY,CAAC,EACpBC,IAAI,EAAG,aAAa,CAAA,EACpBC,MAAM,EAAGD,IAAI,KAAK,YAAY,CAAA,EAC9BE,eAAe,EAAGP,IAAG,IAAA,CAACQ,uBAAuB,CAAA,EAC7C,GAAGC,KAAK,EACS,EAAoB;IACrC,OAAO;QACLJ,IAAI;QACJC,MAAM;QACNC,eAAe;QACf,GAAGE,KAAK;KACT,CAAC;CACH;AAWM,SAASf,wBAAwB,CAACgB,GAAe,EAAE;QACjDA,GAAe;QAAfA,IAAoD;IAA3D,OAAOA,CAAAA,IAAoD,GAApDA,CAAAA,GAAe,GAAfA,GAAG,CAACC,WAAW,SAAS,GAAxBD,KAAAA,CAAwB,GAAxBA,QAAAA,GAAe,CAAEE,OAAO,SAAA,GAAxBF,KAAAA,CAAwB,GAAxBA,KAA0BG,IAAI,EAAE,CA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,CAAC,CAAC,CAAC;KAC9C;IAED,IAAIgB,MAAM,EAAE;QACVoB,WAAW,CAACI,MAAM,CAAC,kBAAkB,EAAExB,MAAM,CAAC,CAAC;KAChD;IAED,IAAIf,eAAe,EAAE;QACnBmC,WAAW,CAACI,MAAM,CAAC,2BAA2B,EAAEL,MAAM,CAAClC,eAAe,CAAC,CAAC,CAAC;KAC1E;IACD,IAAIK,OAAO,EAAE;QACX8B,WAAW,CAACI,MAAM,CAAC,mBAAmB,EAAElC,OAAO,CAAC,CAAC;KAClD;IAED,IAAIM,WAAW,EAAE;QACfwB,WAAW,CAACI,MAAM,CAAC,sBAAsB,EAAE5B,WAAW,CAAC,CAAC;QACxDwB,WAAW,CAACI,MAAM,CAAC,uBAAuB,EAAE5B,WAAW,CAAC,CAAC;KAC1D;IAED,IAAIC,gBAAgB,EAAE;QACpBuB,WAAW,CAACI,MAAM,CAAC,mBAAmB,EAAE3B,gBAAgB,CAAC,CAAC;KAC3D;IACD,IAAIC,qBAAqB,EAAE;QACzBsB,WAAW,CAACI,MAAM,CAAC,gBAAgB,EAAEL,MAAM,CAACrB,qBAAqB,CAAC,CAAC,CAAC;KACrE;IAED,OAAO,CAAC,CAAC,EAAE2B,SAAS,CAAC/B,cAAc,CAAC,CAAC,QAAQ,EAAE0B,WAAW,CAACd,QAAQ,EAAE,CAAC,CAAC,CAAC;CACzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/middleware/resolveAssets.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { getAssetSchemasAsync } from '../../../api/getExpoSchema';\nimport { BundleAssetWithFileHashes } from '../../../export/fork-bundleAsync';\nimport * as Log from '../../../log';\nimport { fileExistsAsync } from '../../../utils/dir';\nimport { CommandError } from '../../../utils/errors';\nimport { get, set } from '../../../utils/obj';\nimport { validateUrl } from '../../../utils/url';\n\ntype ManifestAsset = { fileHashes: string[]; files: string[]; hash: string };\n\nexport type Asset = ManifestAsset | BundleAssetWithFileHashes;\n\ntype ManifestResolutionError = Error & {\n localAssetPath?: string;\n manifestField?: string;\n};\n\n/** Inline the contents of each platform's `googleServicesFile` so runtimes can access them. */\nexport async function resolveGoogleServicesFile(\n projectRoot: string,\n manifest: Pick<ExpoConfig, 'android' | 'ios'
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/middleware/resolveAssets.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { getAssetSchemasAsync } from '../../../api/getExpoSchema';\nimport { BundleAssetWithFileHashes } from '../../../export/fork-bundleAsync';\nimport * as Log from '../../../log';\nimport { fileExistsAsync } from '../../../utils/dir';\nimport { CommandError } from '../../../utils/errors';\nimport { get, set } from '../../../utils/obj';\nimport { validateUrl } from '../../../utils/url';\n\ntype ManifestAsset = { fileHashes: string[]; files: string[]; hash: string };\n\nexport type Asset = ManifestAsset | BundleAssetWithFileHashes;\n\ntype ManifestResolutionError = Error & {\n localAssetPath?: string;\n manifestField?: string;\n};\n\n/** Inline the contents of each platform's `googleServicesFile` so runtimes can access them. */\nexport async function resolveGoogleServicesFile(\n projectRoot: string,\n manifest: Partial<Pick<ExpoConfig, 'android' | 'ios'>>\n) {\n if (manifest.android?.googleServicesFile) {\n try {\n const contents = await fs.readFile(\n path.resolve(projectRoot, manifest.android.googleServicesFile),\n 'utf8'\n );\n manifest.android.googleServicesFile = contents;\n } catch {\n Log.warn(\n `Could not parse Expo config: android.googleServicesFile: \"${manifest.android.googleServicesFile}\"`\n );\n // Delete the field so Expo Go doesn't attempt to read it.\n delete manifest.android.googleServicesFile;\n }\n }\n if (manifest.ios?.googleServicesFile) {\n try {\n const contents = await fs.readFile(\n path.resolve(projectRoot, manifest.ios.googleServicesFile),\n 'base64'\n );\n manifest.ios.googleServicesFile = contents;\n } catch {\n Log.warn(\n `Could not parse Expo config: ios.googleServicesFile: \"${manifest.ios.googleServicesFile}\"`\n );\n // Delete the field so Expo Go doesn't attempt to read it.\n delete manifest.ios.googleServicesFile;\n }\n }\n return manifest;\n}\n\n/**\n * Get all fields in the manifest that match assets, then filter the ones that aren't set.\n *\n * @param manifest\n * @returns Asset fields that the user has set like [\"icon\", \"splash.image\", ...]\n */\nexport async function getAssetFieldPathsForManifestAsync(manifest: ExpoConfig): Promise<string[]> {\n // String array like [\"icon\", \"notification.icon\", \"loading.icon\", \"loading.backgroundImage\", \"ios.icon\", ...]\n const sdkAssetFieldPaths = await getAssetSchemasAsync(manifest.sdkVersion);\n return sdkAssetFieldPaths.filter((assetSchema) => get(manifest, assetSchema));\n}\n\n/** Resolve all assets in the app.json inline. */\nexport async function resolveManifestAssets(\n projectRoot: string,\n {\n manifest,\n resolver,\n strict,\n }: {\n manifest: ExpoConfig;\n resolver: (assetPath: string) => Promise<string>;\n strict?: boolean;\n }\n) {\n try {\n // Asset fields that the user has set like [\"icon\", \"splash.image\"]\n const assetSchemas = await getAssetFieldPathsForManifestAsync(manifest);\n // Get the URLs\n const urls = await Promise.all(\n assetSchemas.map(async (manifestField) => {\n const pathOrURL = get(manifest, manifestField);\n // URL\n if (validateUrl(pathOrURL, { requireProtocol: true })) {\n return pathOrURL;\n }\n\n // File path\n if (await fileExistsAsync(path.resolve(projectRoot, pathOrURL))) {\n return await resolver(pathOrURL);\n }\n\n // Unknown\n const err: ManifestResolutionError = new CommandError(\n 'MANIFEST_ASSET',\n 'Could not resolve local asset: ' + pathOrURL\n );\n err.localAssetPath = pathOrURL;\n err.manifestField = manifestField;\n throw err;\n })\n );\n\n // Set the corresponding URL fields\n assetSchemas.forEach((manifestField, index: number) =>\n set(manifest, `${manifestField}Url`, urls[index])\n );\n } catch (error: any) {\n if (error.localAssetPath) {\n Log.warn(\n `Unable to resolve asset \"${error.localAssetPath}\" from \"${error.manifestField}\" in your app.json or app.config.js`\n );\n } else {\n Log.warn(\n `Warning: Unable to resolve manifest assets. Icons and fonts might not work. ${error.message}.`\n );\n }\n\n if (strict) {\n throw new CommandError(\n 'MANIFEST_ASSET',\n 'Failed to export manifest assets: ' + error.message\n );\n }\n }\n}\n"],"names":["resolveGoogleServicesFile","getAssetFieldPathsForManifestAsync","resolveManifestAssets","Log","projectRoot","manifest","android","googleServicesFile","contents","fs","readFile","path","resolve","warn","ios","sdkAssetFieldPaths","getAssetSchemasAsync","sdkVersion","filter","assetSchema","get","resolver","strict","assetSchemas","urls","Promise","all","map","manifestField","pathOrURL","validateUrl","requireProtocol","fileExistsAsync","err","CommandError","localAssetPath","forEach","index","set","error","message"],"mappings":"AAAA;;;;QAsBsBA,yBAAyB,GAAzBA,yBAAyB;QA2CzBC,kCAAkC,GAAlCA,kCAAkC;QAOlCC,qBAAqB,GAArBA,qBAAqB;AAvE5B,IAAA,SAAa,kCAAb,aAAa,EAAA;AACX,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEc,IAAA,cAA4B,WAA5B,4BAA4B,CAAA;AAErDC,IAAAA,GAAG,mCAAM,cAAc,EAApB;AACiB,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACvB,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AAC3B,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AACjB,IAAA,IAAoB,WAApB,oBAAoB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYzC,eAAeH,yBAAyB,CAC7CI,WAAmB,EACnBC,QAAsD,EACtD;QACIA,GAAgB,EAehBA,IAAY;IAfhB,IAAIA,CAAAA,GAAgB,GAAhBA,QAAQ,CAACC,OAAO,SAAoB,GAApCD,KAAAA,CAAoC,GAApCA,GAAgB,CAAEE,kBAAkB,EAAE;QACxC,IAAI;YACF,MAAMC,QAAQ,GAAG,MAAMC,SAAE,QAAA,CAACC,QAAQ,CAChCC,KAAI,QAAA,CAACC,OAAO,CAACR,WAAW,EAAEC,QAAQ,CAACC,OAAO,CAACC,kBAAkB,CAAC,EAC9D,MAAM,CACP,AAAC;YACFF,QAAQ,C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AC;KACH,CAAC,OAAOE,KAAK,EAAO;QACnB,IAAIA,KAAK,CAACJ,cAAc,EAAE;YACxBhC,GAAG,CAACU,IAAI,CACN,CAAC,yBAAyB,EAAE0B,KAAK,CAACJ,cAAc,CAAC,QAAQ,EAAEI,KAAK,CAACX,aAAa,CAAC,mCAAmC,CAAC,CACpH,CAAC;SACH,MAAM;YACLzB,GAAG,CAACU,IAAI,CACN,CAAC,4EAA4E,EAAE0B,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAChG,CAAC;SACH;QAED,IAAIlB,MAAM,EAAE;YACV,MAAM,IAAIY,OAAY,aAAA,CACpB,gBAAgB,EAChB,oCAAoC,GAAGK,KAAK,CAACC,OAAO,CACrD,CAAC;SACH;KACF;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/type-generation/__typetests__/fixtures/basic.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/ban-types */\n\nimport type { LinkProps as OriginalLinkProps } from 'expo-router/build/link/Link';\nimport type { Router as OriginalRouter } from 'expo-router/src/types';\nexport * from 'expo-router/build';\n\n// prettier-ignore\ntype StaticRoutes = `/apple` | `/banana`;\n// prettier-ignore\ntype DynamicRoutes<T extends string> = `/colors/${SingleRoutePart<T>}` | `/animals/${CatchAllRoutePart<T>}` | `/mix/${SingleRoutePart<T>}/${SingleRoutePart<T>}/${CatchAllRoutePart<T>}`;\n// prettier-ignore\ntype DynamicRouteTemplate = `/colors/[color]` | `/animals/[...animal]` | `/mix/[fruit]/[color]/[...animals]`;\n\ntype RelativePathString = `./${string}` | `../${string}` | '..';\ntype AbsoluteRoute = DynamicRouteTemplate | StaticRoutes;\ntype ExternalPathString = `http${string}`;\ntype ExpoRouterRoutes = DynamicRouteTemplate | StaticRoutes | RelativePathString;\ntype AllRoutes = ExpoRouterRoutes | ExternalPathString;\n\n/****************\n * Route Utils *\n ****************/\n\ntype SearchOrHash = `?${string}` | `#${string}`;\ntype UnknownInputParams = Record<string, string | number | (string | number)[]>;\ntype 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 */\ntype 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 */\ntype 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 */\ntype 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 */\ntype 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 */\ntype 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 */\ntype 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\ntype 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 */\nexport 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 */\nexport 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\nexport type Href<T> = T extends Record<'pathname', string> ? HrefObject<T> : Route<T>;\n\nexport 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\nexport 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. */\nexport declare const router: Router;\n\n/************\n * <Link /> *\n ************/\nexport interface LinkProps<T> extends OriginalLinkProps {\n href: Href<T>;\n}\n\nexport 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 */\nexport declare const Link: LinkComponent;\n\n/** Redirects to the href as soon as the component is mounted. */\nexport declare const Redirect: <T>(\n props: React.PropsWithChildren<{ href: Href<T> }>\n) => JSX.Element;\n\n/************\n * Hooks *\n ************/\nexport declare function useRouter(): Router;\n\nexport declare function useLocalSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n>(): T extends AllRoutes ? SearchParams<T> : T;\n\n/** @deprecated renamed to `useGlobalSearchParams` */\nexport declare function useSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n>(): T extends AllRoutes ? SearchParams<T> : T;\n\nexport declare function useGlobalSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n>(): T extends AllRoutes ? SearchParams<T> : T;\n\nexport declare function useSegments<\n T extends AbsoluteRoute | RouteSegments<AbsoluteRoute> | RelativePathString,\n>(): T extends AbsoluteRoute ? RouteSegments<T> : T extends string ? string[] : T;\n"],"names":[],"mappings":"AAIA;;;;6CAEc,mBAAmB;AAAjC,YAAA,MAAkC;;2CAAlC,MAAkC;;;;mBAAlC,MAAkC;;;EAAA"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/start/server/type-generation/__typetests__/fixtures/basic.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/ban-types */\n\nimport type { LinkProps as OriginalLinkProps } from 'expo-router/build/link/Link';\nimport type { Router as OriginalRouter } from 'expo-router/src/types';\nexport * from 'expo-router/build';\n\n// prettier-ignore\ntype StaticRoutes = `/apple` | `/banana`;\n// prettier-ignore\ntype DynamicRoutes<T extends string> = `/colors/${SingleRoutePart<T>}` | `/animals/${CatchAllRoutePart<T>}` | `/mix/${SingleRoutePart<T>}/${SingleRoutePart<T>}/${CatchAllRoutePart<T>}`;\n// prettier-ignore\ntype DynamicRouteTemplate = `/colors/[color]` | `/animals/[...animal]` | `/mix/[fruit]/[color]/[...animals]`;\n\ntype RelativePathString = `./${string}` | `../${string}` | '..';\ntype AbsoluteRoute = DynamicRouteTemplate | StaticRoutes;\ntype ExternalPathString = `http${string}`;\ntype ExpoRouterRoutes = DynamicRouteTemplate | StaticRoutes | RelativePathString;\ntype AllRoutes = ExpoRouterRoutes | ExternalPathString;\n\n/****************\n * Route Utils *\n ****************/\n\ntype SearchOrHash = `?${string}` | `#${string}`;\ntype UnknownInputParams = Record<string, string | number | (string | number)[]>;\ntype 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 */\ntype 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 */\ntype 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 */\ntype 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 */\ntype 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 */\ntype 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 */\ntype 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\ntype 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 */\nexport 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 */\nexport 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\nexport type Href<T> = T extends Record<'pathname', string> ? HrefObject<T> : Route<T>;\n\nexport 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\nexport 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. */\nexport declare const router: Router;\n\n/************\n * <Link /> *\n ************/\nexport interface LinkProps<T> extends OriginalLinkProps {\n href: Href<T>;\n}\n\nexport 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 */\nexport declare const Link: LinkComponent;\n\n/** Redirects to the href as soon as the component is mounted. */\nexport declare const Redirect: <T>(\n props: React.PropsWithChildren<{ href: Href<T> }>\n) => JSX.Element;\n\n/************\n * Hooks *\n ************/\nexport declare function useRouter(): Router;\n\nexport declare function useLocalSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n>(): T extends AllRoutes ? SearchParams<T> : T;\n\n/** @deprecated renamed to `useGlobalSearchParams` */\nexport declare function useSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n>(): T extends AllRoutes ? SearchParams<T> : T;\n\nexport declare function useGlobalSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n>(): T extends AllRoutes ? SearchParams<T> : T;\n\nexport declare function useSegments<\n T extends AbsoluteRoute | RouteSegments<AbsoluteRoute> | RelativePathString,\n>(): T extends AbsoluteRoute ? RouteSegments<T> : T extends string ? string[] : T;\n"],"names":[],"mappings":"AAIA;;;;6CAEc,mBAAmB;AAAjC,YAAA,MAAkC;;2CAAlC,MAAkC;;;;mBAAlC,MAAkC;;;EAAA"}
|
|
@@ -11,7 +11,7 @@ function _interopRequireDefault(obj) {
|
|
|
11
11
|
default: obj
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
const template = `/// <reference types="expo
|
|
14
|
+
const template = `/// <reference types="expo/types" />
|
|
15
15
|
|
|
16
16
|
// NOTE: This file should not be edited and should be in your git ignore`;
|
|
17
17
|
async function writeExpoEnvDTS(projectRoot) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/type-generation/expo-env.ts"],"sourcesContent":["import fs from 'fs/promises';\nimport path from 'path';\n\nconst template = `/// <reference types=\"expo
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/type-generation/expo-env.ts"],"sourcesContent":["import fs from 'fs/promises';\nimport path from 'path';\n\nconst template = `/// <reference types=\"expo/types\" />\n\n// NOTE: This file should not be edited and should be in your git ignore`;\n\nexport async function writeExpoEnvDTS(projectRoot: string) {\n return fs.writeFile(path.join(projectRoot, 'expo-env.d.ts'), template);\n}\n\nexport async function removeExpoEnvDTS(projectRoot: string) {\n // Force removal of expo-env.d.ts - Ignore any errors if the file does not exist\n return fs.rm(path.join(projectRoot, 'expo-env.d.ts'), { force: true });\n}\n"],"names":["writeExpoEnvDTS","removeExpoEnvDTS","template","projectRoot","fs","writeFile","path","join","rm","force"],"mappings":"AAAA;;;;QAOsBA,eAAe,GAAfA,eAAe;QAIfC,gBAAgB,GAAhBA,gBAAgB;AAXvB,IAAA,SAAa,kCAAb,aAAa,EAAA;AACX,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAEvB,MAAMC,QAAQ,GAAG,CAAC;;wEAEsD,CAAC,AAAC;AAEnE,eAAeF,eAAe,CAACG,WAAmB,EAAE;IACzD,OAAOC,SAAE,QAAA,CAACC,SAAS,CAACC,KAAI,QAAA,CAACC,IAAI,CAACJ,WAAW,EAAE,eAAe,CAAC,EAAED,QAAQ,CAAC,CAAC;CACxE;AAEM,eAAeD,gBAAgB,CAACE,WAAmB,EAAE;IAC1D,gFAAgF;IAChF,OAAOC,SAAE,QAAA,CAACI,EAAE,CAACF,KAAI,QAAA,CAACC,IAAI,CAACJ,WAAW,EAAE,eAAe,CAAC,EAAE;QAAEM,KAAK,EAAE,IAAI;KAAE,CAAC,CAAC;CACxE"}
|
|
@@ -438,6 +438,7 @@ declare module "expo-router" {
|
|
|
438
438
|
* @param props.replace Should replace the current route without adding to the history.
|
|
439
439
|
* @param props.asChild Forward props to child component. Useful for custom buttons.
|
|
440
440
|
* @param props.children Child elements to render the content.
|
|
441
|
+
* @param props.className On web, this sets the HTML \`class\` directly. On native, this can be used with CSS interop tools like Nativewind.
|
|
441
442
|
*/
|
|
442
443
|
export const Link: LinkComponent;
|
|
443
444
|
|
|
@@ -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\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 // Layout and filenames starting with `+` are not routes\n if (filePath.match(/_layout\\.[tj]sx?$/) || filePath.match(/\\/\\+/)) {\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 = \\`http\\${string}\\`;\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 */\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","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;;;;QA8BsBA,gBAAgB,GAAhBA,gBAAgB;QAkFtBC,iBAAiB,GAAjBA,iBAAiB;QAiBjBC,mBAAmB,GAAnBA,mBAAmB;QA4InBC,sBAAsB,GAAtBA,sBAAsB;;AA7QvB,IAAA,SAAa,kCAAb,aAAa,EAAA;AACH,IAAA,OAAQ,WAAR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AmOrD,CAAC,AAAC"}
|
|
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\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 // Layout and filenames starting with `+` are not routes\n if (filePath.match(/_layout\\.[tj]sx?$/) || filePath.match(/\\/\\+/)) {\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 = \\`http\\${string}\\`;\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","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","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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoOrD,CAAC,AAAC"}
|
|
@@ -3,11 +3,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.getMetroDebugProperties = getMetroDebugProperties;
|
|
6
|
-
var _resolveFromProject = require("../../start/server/metro/resolveFromProject");
|
|
7
6
|
function getMetroDebugProperties(projectRoot, exp, debugTool) {
|
|
8
7
|
return {
|
|
9
8
|
sdkVersion: exp.sdkVersion,
|
|
10
|
-
metroVersion: (
|
|
9
|
+
metroVersion: require("metro/package.json").version,
|
|
11
10
|
toolName: debugTool.name,
|
|
12
11
|
toolVersion: debugTool.version
|
|
13
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/utils/analytics/getMetroDebugProperties.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\n\
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/analytics/getMetroDebugProperties.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\n\nexport type DebugTool = {\n name: string;\n version?: string;\n};\n\nexport function getMetroDebugProperties(\n projectRoot: string,\n exp: ExpoConfig,\n debugTool: DebugTool\n) {\n return {\n sdkVersion: exp.sdkVersion,\n metroVersion: require('metro/package.json').version,\n toolName: debugTool.name,\n toolVersion: debugTool.version,\n };\n}\n"],"names":["getMetroDebugProperties","projectRoot","exp","debugTool","sdkVersion","metroVersion","require","version","toolName","name","toolVersion"],"mappings":"AAAA;;;;QAOgBA,uBAAuB,GAAvBA,uBAAuB;AAAhC,SAASA,uBAAuB,CACrCC,WAAmB,EACnBC,GAAe,EACfC,SAAoB,EACpB;IACA,OAAO;QACLC,UAAU,EAAEF,GAAG,CAACE,UAAU;QAC1BC,YAAY,EAAEC,OAAO,CAAC,oBAAoB,CAAC,CAACC,OAAO;QACnDC,QAAQ,EAAEL,SAAS,CAACM,IAAI;QACxBC,WAAW,EAAEP,SAAS,CAACI,OAAO;KAC/B,CAAC;CACH"}
|
|
@@ -3,12 +3,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.getMetroProperties = getMetroProperties;
|
|
6
|
-
var _resolveFromProject = require("../../start/server/metro/resolveFromProject");
|
|
7
6
|
function getMetroProperties(projectRoot, exp, metroConfig = {}) {
|
|
8
7
|
var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11;
|
|
9
8
|
return {
|
|
10
9
|
sdkVersion: exp.sdkVersion,
|
|
11
|
-
metroVersion: (
|
|
10
|
+
metroVersion: require("metro/package.json").version,
|
|
12
11
|
fileMapCacheManagerFactory: Boolean(metroConfig.unstable_fileMapCacheManagerFactory) || undefined,
|
|
13
12
|
perfLogger: Boolean(metroConfig.unstable_perfLogger) || undefined,
|
|
14
13
|
resolverEnableSymlinks: (ref = metroConfig.resolver) == null ? void 0 : ref.unstable_enableSymlinks,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/utils/analytics/getMetroProperties.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/analytics/getMetroProperties.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\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,GAAnDZ,KAAAA,CAAmD,GAAnDA,IAAoB,CAAEmB,6BAA6B;QAEjFC,yBAAyB,EAAEpB,CAAAA,IAAkB,GAAlBA,WAAW,CAACqB,MAAM,SAAiC,GAAnDrB,KAAAA,CAAmD,GAAnDA,IAAkB,CAAEsB,+BAA+B;QAC9EC,gBAAgB,EAAEjB,OAAO,CAACN,CAAAA,IAAkB,GAAlBA,WAAW,CAACqB,MAAM,SAAqB,GAAvCrB,KAAAA,CAAuC,GAAvCA,IAAkB,CAAEwB,mBAAmB,CAAC,IAAIhB,SAAS;QAE/EiB,kCAAkC,EAAEzB,CAAAA,IAAuB,GAAvBA,WAAW,CAAC0B,WAAW,SAAkC,GAAzD1B,KAAAA,CAAyD,GAAzDA,IAAuB,CAAE2B,gCAAgC;QAC7FC,oCAAoC,EAClC5B,CAAAA,IAAuB,GAAvBA,WAAW,CAAC0B,WAAW,SAAoC,GAA3D1B,KAAAA,CAA2D,GAA3DA,IAAuB,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.
|
|
97
|
+
source_version: "0.15.0",
|
|
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.
|
|
138
|
+
version: "0.15.0"
|
|
139
139
|
},
|
|
140
140
|
ci: ciInfo.isCI ? {
|
|
141
141
|
name: ciInfo.name,
|
package/build/src/utils/args.js
CHANGED
|
@@ -53,8 +53,10 @@ function assertWithOptionsArgs(schema, options) {
|
|
|
53
53
|
try {
|
|
54
54
|
return (0, _arg).default(schema, options);
|
|
55
55
|
} catch (error) {
|
|
56
|
-
//
|
|
57
|
-
|
|
56
|
+
// Handle errors caused by user input.
|
|
57
|
+
// Only errors from `arg`, which does not start with `ARG_CONFIG_` are user input errors.
|
|
58
|
+
// See: https://github.com/vercel/arg/releases/tag/5.0.0
|
|
59
|
+
if ("code" in error && error.code.startsWith("ARG_") && !error.code.startsWith("ARG_CONFIG_")) {
|
|
58
60
|
Log.exit(error.message, 1);
|
|
59
61
|
}
|
|
60
62
|
// Otherwise rethrow the error.
|