@expo/cli 0.17.4 → 0.17.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +2 -2
- package/build/src/export/embed/exportEmbedAsync.js +1 -0
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/exportApp.js +5 -1
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +3 -1
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/index.js +2 -0
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/resolveOptions.js +1 -0
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +0 -24
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/start/server/AsyncNgrok.js +1 -5
- package/build/src/start/server/AsyncNgrok.js.map +1 -1
- package/build/src/start/server/UrlCreator.js +2 -2
- package/build/src/start/server/UrlCreator.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +5 -12
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +4 -2
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +3 -3
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +2 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +8 -5
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +22 -10
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/serverLogLikeMetro.js +147 -0
- package/build/src/start/server/serverLogLikeMetro.js.map +1 -0
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/createFileTransform.js +1 -0
- package/build/src/utils/createFileTransform.js.map +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/server/AsyncNgrok.ts"],"sourcesContent":["import chalk from 'chalk';\nimport crypto from 'crypto';\nimport * as path from 'path';\nimport slugify from 'slugify';\n\nimport UserSettings from '../../api/user/UserSettings';\nimport { getActorDisplayName, getUserAsync } from '../../api/user/user';\nimport * as Log from '../../log';\nimport { delayAsync, resolveWithTimeout } from '../../utils/delay';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { isNgrokClientError, NgrokInstance, NgrokResolver } from '../doctor/ngrok/NgrokResolver';\nimport { hasAdbReverseAsync, startAdbReverseAsync } from '../platforms/android/adbReverse';\nimport { ProjectSettings } from '../project/settings';\n\nconst debug = require('debug')('expo:start:server:ngrok') as typeof console.log;\n\nconst NGROK_CONFIG = {\n authToken: '5W1bR67GNbWcXqmxZzBG1_56GezNeaX6sSRvn8npeQ8',\n domain: 'exp.direct',\n};\n\nconst TUNNEL_TIMEOUT = 10 * 1000;\n\nexport class AsyncNgrok {\n /** Resolves the best instance of ngrok, exposed for testing. */\n resolver: NgrokResolver;\n\n /** Info about the currently running instance of ngrok. */\n private serverUrl: string | null = null;\n\n constructor(\n private projectRoot: string,\n private port: number\n ) {\n this.resolver = new NgrokResolver(projectRoot);\n }\n\n public getActiveUrl(): string | null {\n return this.serverUrl;\n }\n\n /** Exposed for testing. */\n async _getIdentifyingUrlSegmentsAsync(): Promise<string[]> {\n const user = await getUserAsync();\n if (user?.__typename === 'Robot') {\n throw new CommandError('NGROK_ROBOT', 'Cannot use ngrok with a robot user.');\n }\n const username = getActorDisplayName(user);\n\n return [\n // NOTE: https://github.com/expo/expo/pull/16556#discussion_r822944286\n await this.getProjectRandomnessAsync(),\n slugify(username),\n // Use the port to distinguish between multiple tunnels (webpack, metro).\n String(this.port),\n ];\n }\n\n /** Exposed for testing. */\n async _getProjectHostnameAsync(): Promise<string> {\n return [...(await this._getIdentifyingUrlSegmentsAsync()), NGROK_CONFIG.domain].join('.');\n }\n\n /** Exposed for testing. */\n async _getProjectSubdomainAsync(): Promise<string> {\n return (await this._getIdentifyingUrlSegmentsAsync()).join('-');\n }\n\n /** Start ngrok on the given port for the project. */\n async startAsync({ timeout }: { timeout?: number } = {}): Promise<void> {\n // Ensure the instance is loaded first, this can linger so we should run it before the timeout.\n await this.resolver.resolveAsync({\n // For now, prefer global install since the package has native code (harder to install) and doesn't change very often.\n prefersGlobalInstall: true,\n });\n\n // NOTE(EvanBacon): If the user doesn't have ADB installed,\n // then skip attempting to reverse the port.\n if (hasAdbReverseAsync()) {\n // Ensure ADB reverse is running.\n if (!(await startAdbReverseAsync([this.port]))) {\n // TODO: Better error message.\n throw new CommandError(\n 'NGROK_ADB',\n `Cannot start tunnel URL because \\`adb reverse\\` failed for the connected Android device(s).`\n );\n }\n }\n\n this.serverUrl = await this._connectToNgrokAsync({ timeout });\n\n debug('Tunnel URL:', this.serverUrl);\n Log.log('Tunnel ready.');\n }\n\n /** Stop the ngrok process if it's running. */\n public async stopAsync(): Promise<void> {\n debug('Stopping Tunnel');\n\n await this.resolver.get()?.kill?.();\n this.serverUrl = null;\n }\n\n /** Exposed for testing. */\n async _connectToNgrokAsync(\n options: { timeout?: number } = {},\n attempts: number = 0\n ): Promise<string> {\n // Attempt to stop any hanging processes, this increases the chances of a successful connection.\n await this.stopAsync();\n\n // Get the instance quietly or assert otherwise.\n const instance = await this.resolver.resolveAsync({\n shouldPrompt: false,\n autoInstall: false,\n });\n\n // TODO(Bacon): Consider dropping the timeout functionality:\n // https://github.com/expo/expo/pull/16556#discussion_r822307373\n const results = await resolveWithTimeout(\n () => this.connectToNgrokInternalAsync(instance, attempts),\n {\n timeout: options.timeout ?? TUNNEL_TIMEOUT,\n errorMessage: 'ngrok tunnel took too long to connect.',\n }\n );\n if (typeof results === 'string') {\n return results;\n }\n\n // Wait 100ms and then try again\n await delayAsync(100);\n\n return this._connectToNgrokAsync(options, attempts + 1);\n }\n\n private async _getConnectionPropsAsync(): Promise<{ hostname?: string; subdomain?: string }> {\n const userDefinedSubdomain = env.EXPO_TUNNEL_SUBDOMAIN;\n if (userDefinedSubdomain) {\n const subdomain =\n typeof userDefinedSubdomain === 'string'\n ? userDefinedSubdomain\n : await this._getProjectSubdomainAsync();\n debug('Subdomain:', subdomain);\n return { subdomain };\n } else {\n const hostname = await this._getProjectHostnameAsync();\n debug('Hostname:', hostname);\n return { hostname };\n }\n }\n\n private async connectToNgrokInternalAsync(\n instance: NgrokInstance,\n attempts: number = 0\n ): Promise<string | false> {\n try {\n // Global config path.\n const configPath = path.join(UserSettings.getDirectory(), 'ngrok.yml');\n debug('Global config path:', configPath);\n const urlProps = await this._getConnectionPropsAsync();\n\n const url = await instance.connect({\n ...urlProps,\n authtoken: NGROK_CONFIG.authToken,\n proto: 'http',\n configPath,\n onStatusChange(status) {\n if (status === 'closed') {\n Log.error(\n chalk.red(\n 'Tunnel connection has been closed. This is often related to intermittent connection problems with the Ngrok servers. Restart the dev server to try connecting to Ngrok again.'\n ) + chalk.gray('\\nCheck the Ngrok status page for outages: https://status.ngrok.com/')\n );\n } else if (status === 'connected') {\n Log.log('Tunnel connected.');\n }\n },\n port: this.port,\n });\n return url;\n } catch (error: any) {\n const assertNgrok = () => {\n if (isNgrokClientError(error)) {\n throw new CommandError(\n 'NGROK_CONNECT',\n [\n error.body.msg,\n error.body.details?.err,\n chalk.gray('Check the Ngrok status page for outages: https://status.ngrok.com/'),\n ]\n .filter(Boolean)\n .join('\\n\\n')\n );\n }\n throw new CommandError(\n 'NGROK_CONNECT',\n error.toString() +\n chalk.gray('\\nCheck the Ngrok status page for outages: https://status.ngrok.com/')\n );\n };\n\n // Attempt to connect 3 times\n if (attempts >= 2) {\n assertNgrok();\n }\n\n // Attempt to fix the issue\n if (isNgrokClientError(error) && error.body.error_code === 103) {\n // Assert early if a custom subdomain is used since it cannot\n // be changed and retried. If the tunnel subdomain is a boolean\n // then we can reset the randomness and try again.\n if (typeof env.EXPO_TUNNEL_SUBDOMAIN === 'string') {\n assertNgrok();\n }\n // Change randomness to avoid conflict if killing ngrok doesn't help\n await this._resetProjectRandomnessAsync();\n }\n\n return false;\n }\n }\n\n private async getProjectRandomnessAsync() {\n const { urlRandomness: randomness } = await ProjectSettings.readAsync(this.projectRoot);\n if (randomness) {\n return randomness;\n }\n return await this._resetProjectRandomnessAsync();\n }\n\n async _resetProjectRandomnessAsync() {\n const randomness = crypto.randomBytes(5).toString('base64url');\n await ProjectSettings.setAsync(this.projectRoot, { urlRandomness: randomness });\n debug('Resetting project randomness:', randomness);\n return randomness;\n }\n}\n"],"names":["path","Log","debug","require","NGROK_CONFIG","authToken","domain","TUNNEL_TIMEOUT","AsyncNgrok","constructor","projectRoot","port","serverUrl","resolver","NgrokResolver","getActiveUrl","_getIdentifyingUrlSegmentsAsync","user","getUserAsync","__typename","CommandError","username","getActorDisplayName","getProjectRandomnessAsync","slugify","String","_getProjectHostnameAsync","join","_getProjectSubdomainAsync","startAsync","timeout","resolveAsync","prefersGlobalInstall","hasAdbReverseAsync","startAdbReverseAsync","_connectToNgrokAsync","log","stopAsync","get","kill","options","attempts","instance","shouldPrompt","autoInstall","results","resolveWithTimeout","connectToNgrokInternalAsync","errorMessage","delayAsync","_getConnectionPropsAsync","userDefinedSubdomain","env","EXPO_TUNNEL_SUBDOMAIN","subdomain","hostname","configPath","UserSettings","getDirectory","urlProps","url","connect","authtoken","proto","onStatusChange","status","error","chalk","red","gray","assertNgrok","isNgrokClientError","body","msg","details","err","filter","Boolean","toString","error_code","_resetProjectRandomnessAsync","urlRandomness","randomness","ProjectSettings","readAsync","crypto","randomBytes","setAsync"],"mappings":"AAAA;;;;AAAkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACN,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACfA,IAAAA,IAAI,mCAAM,MAAM,EAAZ;AACI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AK,GAAG,EAAE;gBAC9D,6DAA6D;gBAC7D,+DAA+D;gBAC/D,kDAAkD;gBAClD,IAAI,OAAO3B,IAAG,IAAA,CAACC,qBAAqB,KAAK,QAAQ,EAAE;oBACjDiB,WAAW,EAAE,CAAC;iBACf;gBACD,oEAAoE;gBACpE,MAAM,IAAI,CAACU,4BAA4B,EAAE,CAAC;aAC3C;YAED,OAAO,KAAK,CAAC;SACd;KACF;IAED,MAAczD,yBAAyB,GAAG;QACxC,MAAM,EAAE0D,aAAa,EAAEC,UAAU,CAAA,EAAE,GAAG,MAAMC,SAAe,gBAAA,CAACC,SAAS,CAAC,IAAI,CAAC1E,WAAW,CAAC,AAAC;QACxF,IAAIwE,UAAU,EAAE;YACd,OAAOA,UAAU,CAAC;SACnB;QACD,OAAO,MAAM,IAAI,CAACF,4BAA4B,EAAE,CAAC;KAClD;IAED,MAAMA,4BAA4B,GAAG;QACnC,MAAME,UAAU,GAAGG,OAAM,QAAA,CAACC,WAAW,CAAC,CAAC,CAAC,CAACR,QAAQ,CAAC,WAAW,CAAC,AAAC;QAC/D,MAAMK,SAAe,gBAAA,CAACI,QAAQ,CAAC,IAAI,CAAC7E,WAAW,EAAE;YAAEuE,aAAa,EAAEC,UAAU;SAAE,CAAC,CAAC;QAChFhF,KAAK,CAAC,+BAA+B,EAAEgF,UAAU,CAAC,CAAC;QACnD,OAAOA,UAAU,CAAC;KACnB;CACF;QAtNY1E,UAAU,GAAVA,UAAU"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/server/AsyncNgrok.ts"],"sourcesContent":["import chalk from 'chalk';\nimport crypto from 'crypto';\nimport * as path from 'path';\nimport slugify from 'slugify';\n\nimport UserSettings from '../../api/user/UserSettings';\nimport { getActorDisplayName, getUserAsync } from '../../api/user/user';\nimport * as Log from '../../log';\nimport { delayAsync, resolveWithTimeout } from '../../utils/delay';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { isNgrokClientError, NgrokInstance, NgrokResolver } from '../doctor/ngrok/NgrokResolver';\nimport { hasAdbReverseAsync, startAdbReverseAsync } from '../platforms/android/adbReverse';\nimport { ProjectSettings } from '../project/settings';\n\nconst debug = require('debug')('expo:start:server:ngrok') as typeof console.log;\n\nconst NGROK_CONFIG = {\n authToken: '5W1bR67GNbWcXqmxZzBG1_56GezNeaX6sSRvn8npeQ8',\n domain: 'exp.direct',\n};\n\nconst TUNNEL_TIMEOUT = 10 * 1000;\n\nexport class AsyncNgrok {\n /** Resolves the best instance of ngrok, exposed for testing. */\n resolver: NgrokResolver;\n\n /** Info about the currently running instance of ngrok. */\n private serverUrl: string | null = null;\n\n constructor(\n private projectRoot: string,\n private port: number\n ) {\n this.resolver = new NgrokResolver(projectRoot);\n }\n\n public getActiveUrl(): string | null {\n return this.serverUrl;\n }\n\n /** Exposed for testing. */\n async _getIdentifyingUrlSegmentsAsync(): Promise<string[]> {\n const user = await getUserAsync();\n if (user?.__typename === 'Robot') {\n throw new CommandError('NGROK_ROBOT', 'Cannot use ngrok with a robot user.');\n }\n const username = getActorDisplayName(user);\n\n return [\n // NOTE: https://github.com/expo/expo/pull/16556#discussion_r822944286\n await this.getProjectRandomnessAsync(),\n slugify(username),\n // Use the port to distinguish between multiple tunnels (webpack, metro).\n String(this.port),\n ];\n }\n\n /** Exposed for testing. */\n async _getProjectHostnameAsync(): Promise<string> {\n return `${(await this._getIdentifyingUrlSegmentsAsync()).join('-')}.${NGROK_CONFIG.domain}`;\n }\n\n /** Exposed for testing. */\n async _getProjectSubdomainAsync(): Promise<string> {\n return (await this._getIdentifyingUrlSegmentsAsync()).join('-');\n }\n\n /** Start ngrok on the given port for the project. */\n async startAsync({ timeout }: { timeout?: number } = {}): Promise<void> {\n // Ensure the instance is loaded first, this can linger so we should run it before the timeout.\n await this.resolver.resolveAsync({\n // For now, prefer global install since the package has native code (harder to install) and doesn't change very often.\n prefersGlobalInstall: true,\n });\n\n // NOTE(EvanBacon): If the user doesn't have ADB installed,\n // then skip attempting to reverse the port.\n if (hasAdbReverseAsync()) {\n // Ensure ADB reverse is running.\n if (!(await startAdbReverseAsync([this.port]))) {\n // TODO: Better error message.\n throw new CommandError(\n 'NGROK_ADB',\n `Cannot start tunnel URL because \\`adb reverse\\` failed for the connected Android device(s).`\n );\n }\n }\n\n this.serverUrl = await this._connectToNgrokAsync({ timeout });\n\n debug('Tunnel URL:', this.serverUrl);\n Log.log('Tunnel ready.');\n }\n\n /** Stop the ngrok process if it's running. */\n public async stopAsync(): Promise<void> {\n debug('Stopping Tunnel');\n\n await this.resolver.get()?.kill?.();\n this.serverUrl = null;\n }\n\n /** Exposed for testing. */\n async _connectToNgrokAsync(\n options: { timeout?: number } = {},\n attempts: number = 0\n ): Promise<string> {\n // Attempt to stop any hanging processes, this increases the chances of a successful connection.\n await this.stopAsync();\n\n // Get the instance quietly or assert otherwise.\n const instance = await this.resolver.resolveAsync({\n shouldPrompt: false,\n autoInstall: false,\n });\n\n // TODO(Bacon): Consider dropping the timeout functionality:\n // https://github.com/expo/expo/pull/16556#discussion_r822307373\n const results = await resolveWithTimeout(\n () => this.connectToNgrokInternalAsync(instance, attempts),\n {\n timeout: options.timeout ?? TUNNEL_TIMEOUT,\n errorMessage: 'ngrok tunnel took too long to connect.',\n }\n );\n if (typeof results === 'string') {\n return results;\n }\n\n // Wait 100ms and then try again\n await delayAsync(100);\n\n return this._connectToNgrokAsync(options, attempts + 1);\n }\n\n private async _getConnectionPropsAsync(): Promise<{ hostname?: string; subdomain?: string }> {\n const userDefinedSubdomain = env.EXPO_TUNNEL_SUBDOMAIN;\n if (userDefinedSubdomain) {\n const subdomain =\n typeof userDefinedSubdomain === 'string'\n ? userDefinedSubdomain\n : await this._getProjectSubdomainAsync();\n debug('Subdomain:', subdomain);\n return { subdomain };\n } else {\n const hostname = await this._getProjectHostnameAsync();\n debug('Hostname:', hostname);\n return { hostname };\n }\n }\n\n private async connectToNgrokInternalAsync(\n instance: NgrokInstance,\n attempts: number = 0\n ): Promise<string | false> {\n try {\n // Global config path.\n const configPath = path.join(UserSettings.getDirectory(), 'ngrok.yml');\n debug('Global config path:', configPath);\n const urlProps = await this._getConnectionPropsAsync();\n\n const url = await instance.connect({\n ...urlProps,\n authtoken: NGROK_CONFIG.authToken,\n configPath,\n onStatusChange(status) {\n if (status === 'closed') {\n Log.error(\n chalk.red(\n 'Tunnel connection has been closed. This is often related to intermittent connection problems with the Ngrok servers. Restart the dev server to try connecting to Ngrok again.'\n ) + chalk.gray('\\nCheck the Ngrok status page for outages: https://status.ngrok.com/')\n );\n } else if (status === 'connected') {\n Log.log('Tunnel connected.');\n }\n },\n port: this.port,\n });\n return url;\n } catch (error: any) {\n const assertNgrok = () => {\n if (isNgrokClientError(error)) {\n throw new CommandError(\n 'NGROK_CONNECT',\n [\n error.body.msg,\n error.body.details?.err,\n chalk.gray('Check the Ngrok status page for outages: https://status.ngrok.com/'),\n ]\n .filter(Boolean)\n .join('\\n\\n')\n );\n }\n throw new CommandError(\n 'NGROK_CONNECT',\n error.toString() +\n chalk.gray('\\nCheck the Ngrok status page for outages: https://status.ngrok.com/')\n );\n };\n\n // Attempt to connect 3 times\n if (attempts >= 2) {\n assertNgrok();\n }\n\n // Attempt to fix the issue\n if (isNgrokClientError(error) && error.body.error_code === 103) {\n // Assert early if a custom subdomain is used since it cannot\n // be changed and retried. If the tunnel subdomain is a boolean\n // then we can reset the randomness and try again.\n if (typeof env.EXPO_TUNNEL_SUBDOMAIN === 'string') {\n assertNgrok();\n }\n // Change randomness to avoid conflict if killing ngrok doesn't help\n await this._resetProjectRandomnessAsync();\n }\n\n return false;\n }\n }\n\n private async getProjectRandomnessAsync() {\n const { urlRandomness: randomness } = await ProjectSettings.readAsync(this.projectRoot);\n if (randomness) {\n return randomness;\n }\n return await this._resetProjectRandomnessAsync();\n }\n\n async _resetProjectRandomnessAsync() {\n const randomness = crypto.randomBytes(5).toString('base64url');\n await ProjectSettings.setAsync(this.projectRoot, { urlRandomness: randomness });\n debug('Resetting project randomness:', randomness);\n return randomness;\n }\n}\n"],"names":["path","Log","debug","require","NGROK_CONFIG","authToken","domain","TUNNEL_TIMEOUT","AsyncNgrok","constructor","projectRoot","port","serverUrl","resolver","NgrokResolver","getActiveUrl","_getIdentifyingUrlSegmentsAsync","user","getUserAsync","__typename","CommandError","username","getActorDisplayName","getProjectRandomnessAsync","slugify","String","_getProjectHostnameAsync","join","_getProjectSubdomainAsync","startAsync","timeout","resolveAsync","prefersGlobalInstall","hasAdbReverseAsync","startAdbReverseAsync","_connectToNgrokAsync","log","stopAsync","get","kill","options","attempts","instance","shouldPrompt","autoInstall","results","resolveWithTimeout","connectToNgrokInternalAsync","errorMessage","delayAsync","_getConnectionPropsAsync","userDefinedSubdomain","env","EXPO_TUNNEL_SUBDOMAIN","subdomain","hostname","configPath","UserSettings","getDirectory","urlProps","url","connect","authtoken","onStatusChange","status","error","chalk","red","gray","assertNgrok","isNgrokClientError","body","msg","details","err","filter","Boolean","toString","error_code","_resetProjectRandomnessAsync","urlRandomness","randomness","ProjectSettings","readAsync","crypto","randomBytes","setAsync"],"mappings":"AAAA;;;;AAAkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACN,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACfA,IAAAA,IAAI,mCAAM,MAAM,EAAZ;AACI,IAAA,QAAS,kCAAT,SAAS,EAAA;AAEJ,IAAA,aAA6B,kCAA7B,6BAA6B,EAAA;AACJ,IAAA,KAAqB,WAArB,qBAAqB,CAAA;AAC3DC,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACgC,IAAA,MAAmB,WAAnB,mBAAmB,CAAA;AAC9C,IAAA,IAAiB,WAAjB,iBAAiB,CAAA;AACR,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AACgB,IAAA,cAA+B,WAA/B,+BAA+B,CAAA;AACvC,IAAA,WAAiC,WAAjC,iCAAiC,CAAA;AAC1D,IAAA,SAAqB,WAArB,qBAAqB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErD,MA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AAIuE,UAAU,EAAE;YACd,OAAOA,UAAU,CAAC;SACnB;QACD,OAAO,MAAM,IAAI,CAACF,4BAA4B,EAAE,CAAC;KAClD;IAED,MAAMA,4BAA4B,GAAG;QACnC,MAAME,UAAU,GAAGG,OAAM,QAAA,CAACC,WAAW,CAAC,CAAC,CAAC,CAACR,QAAQ,CAAC,WAAW,CAAC,AAAC;QAC/D,MAAMK,SAAe,gBAAA,CAACI,QAAQ,CAAC,IAAI,CAAC5E,WAAW,EAAE;YAAEsE,aAAa,EAAEC,UAAU;SAAE,CAAC,CAAC;QAChF/E,KAAK,CAAC,+BAA+B,EAAE+E,UAAU,CAAC,CAAC;QACnD,OAAOA,UAAU,CAAC;KACnB;CACF;QArNYzE,UAAU,GAAVA,UAAU"}
|
|
@@ -62,7 +62,7 @@ class UrlCreator {
|
|
|
62
62
|
return loadingUrl;
|
|
63
63
|
}
|
|
64
64
|
/** Create a URI for launching in a native dev client. Returns `null` when no `scheme` can be resolved. */ constructDevClientUrl(options) {
|
|
65
|
-
var ref;
|
|
65
|
+
var ref, ref1;
|
|
66
66
|
const protocol = (options == null ? void 0 : options.scheme) || ((ref = this.defaults) == null ? void 0 : ref.scheme);
|
|
67
67
|
if (!protocol || // Prohibit the use of http(s) in dev client URIs since they'll never be valid.
|
|
68
68
|
[
|
|
@@ -74,7 +74,7 @@ class UrlCreator {
|
|
|
74
74
|
}
|
|
75
75
|
const manifestUrl = this.constructUrl({
|
|
76
76
|
...options,
|
|
77
|
-
scheme: "http"
|
|
77
|
+
scheme: ((ref1 = this.defaults) == null ? void 0 : ref1.hostType) === "tunnel" ? "https" : "http"
|
|
78
78
|
});
|
|
79
79
|
const devClientUrl = `${protocol}://expo-development-client/?url=${encodeURIComponent(manifestUrl)}`;
|
|
80
80
|
debug(`Dev client URL: ${devClientUrl} -- manifestUrl: ${manifestUrl} -- %O`, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/server/UrlCreator.ts"],"sourcesContent":["import assert from 'assert';\nimport { URL } from 'url';\n\nimport * as Log from '../../log';\nimport { getIpAddress } from '../../utils/ip';\n\nconst debug = require('debug')('expo:start:server:urlCreator') as typeof console.log;\n\nexport interface CreateURLOptions {\n /** URL scheme to use when opening apps in custom runtimes. */\n scheme?: string | null;\n /** Type of dev server host to use. */\n hostType?: 'localhost' | 'lan' | 'tunnel';\n /** Requested hostname. */\n hostname?: string | null;\n}\n\ninterface UrlComponents {\n port: string;\n hostname: string;\n protocol: string;\n}\nexport class UrlCreator {\n constructor(\n public defaults: CreateURLOptions | undefined,\n private bundlerInfo: { port: number; getTunnelUrl?: () => string | null }\n ) {}\n\n /**\n * Return a URL for the \"loading\" interstitial page that is used to disambiguate which\n * native runtime to open the dev server with.\n *\n * @param options options for creating the URL\n * @param platform when opening the URL from the CLI to a connected device we can specify the platform as a query parameter, otherwise it will be inferred from the unsafe user agent sniffing.\n *\n * @returns URL like `http://localhost:8081/_expo/loading?platform=ios`\n * @returns URL like `http://localhost:8081/_expo/loading` when no platform is provided.\n */\n public constructLoadingUrl(options: CreateURLOptions, platform: string | null): string {\n const url = new URL('_expo/loading', this.constructUrl({ scheme: 'http', ...options }));\n if (platform) {\n url.search = new URLSearchParams({ platform }).toString();\n }\n const loadingUrl = url.toString();\n debug(`Loading URL: ${loadingUrl}`);\n return loadingUrl;\n }\n\n /** Create a URI for launching in a native dev client. Returns `null` when no `scheme` can be resolved. */\n public constructDevClientUrl(options?: CreateURLOptions): null | string {\n const protocol = options?.scheme || this.defaults?.scheme;\n\n if (\n !protocol ||\n // Prohibit the use of http(s) in dev client URIs since they'll never be valid.\n ['http', 'https'].includes(protocol.toLowerCase()) ||\n // Prohibit the use of `_` characters in the protocol, Node will throw an error when parsing these URLs\n protocol.includes('_')\n ) {\n return null;\n }\n\n const manifestUrl = this.constructUrl({ ...options, scheme: 'http' });\n const devClientUrl = `${protocol}://expo-development-client/?url=${encodeURIComponent(\n manifestUrl\n )}`;\n debug(`Dev client URL: ${devClientUrl} -- manifestUrl: ${manifestUrl} -- %O`, options);\n return devClientUrl;\n }\n\n /** Create a generic URL. */\n public constructUrl(options?: Partial<CreateURLOptions> | null): string {\n const urlComponents = this.getUrlComponents({\n ...this.defaults,\n ...options,\n });\n const url = joinUrlComponents(urlComponents);\n debug(`URL: ${url}`);\n return url;\n }\n\n /** Get the URL components from the Ngrok server URL. */\n private getTunnelUrlComponents(options: Pick<CreateURLOptions, 'scheme'>): UrlComponents | null {\n const tunnelUrl = this.bundlerInfo.getTunnelUrl?.();\n if (!tunnelUrl) {\n return null;\n }\n const parsed = new URL(tunnelUrl);\n return {\n port: parsed.port,\n hostname: parsed.hostname,\n protocol: options.scheme ?? 'http',\n };\n }\n\n private getUrlComponents(options: CreateURLOptions): UrlComponents {\n // Proxy comes first.\n const proxyURL = getProxyUrl();\n if (proxyURL) {\n return getUrlComponentsFromProxyUrl(options, proxyURL);\n }\n\n // Ngrok.\n if (options.hostType === 'tunnel') {\n const components = this.getTunnelUrlComponents(options);\n if (components) {\n return components;\n }\n Log.warn('Tunnel URL not found (it might not be ready yet), falling back to LAN URL.');\n } else if (options.hostType === 'localhost' && !options.hostname) {\n options.hostname = 'localhost';\n }\n\n return {\n hostname: getDefaultHostname(options),\n port: this.bundlerInfo.port.toString(),\n protocol: options.scheme ?? 'http',\n };\n }\n}\n\nfunction getUrlComponentsFromProxyUrl(\n options: Pick<CreateURLOptions, 'scheme'>,\n url: string\n): UrlComponents {\n const parsedProxyUrl = new URL(url);\n let protocol = options.scheme ?? 'http';\n if (parsedProxyUrl.protocol === 'https:') {\n if (protocol === 'http') {\n protocol = 'https';\n }\n if (!parsedProxyUrl.port) {\n parsedProxyUrl.port = '443';\n }\n }\n return {\n port: parsedProxyUrl.port,\n hostname: parsedProxyUrl.hostname,\n protocol,\n };\n}\n\nfunction getDefaultHostname(options: Pick<CreateURLOptions, 'hostname'>) {\n // TODO: Drop REACT_NATIVE_PACKAGER_HOSTNAME\n if (process.env.REACT_NATIVE_PACKAGER_HOSTNAME) {\n return process.env.REACT_NATIVE_PACKAGER_HOSTNAME.trim();\n } else if (options.hostname === 'localhost') {\n // Restrict the use of `localhost`\n // TODO: Note why we do this.\n return '127.0.0.1';\n }\n\n return options.hostname || getIpAddress();\n}\n\nfunction joinUrlComponents({ protocol, hostname, port }: Partial<UrlComponents>): string {\n assert(hostname, 'hostname cannot be inferred.');\n const validProtocol = protocol ? `${protocol}://` : '';\n\n const url = `${validProtocol}${hostname}`;\n\n if (port) {\n return url + `:${port}`;\n }\n\n return url;\n}\n\n/** @deprecated */\nfunction getProxyUrl(): string | undefined {\n return process.env.EXPO_PACKAGER_PROXY_URL;\n}\n\n// TODO: Drop the undocumented env variables:\n// REACT_NATIVE_PACKAGER_HOSTNAME\n// EXPO_PACKAGER_PROXY_URL\n"],"names":["Log","debug","require","UrlCreator","constructor","defaults","bundlerInfo","constructLoadingUrl","options","platform","url","URL","constructUrl","scheme","search","URLSearchParams","toString","loadingUrl","constructDevClientUrl","protocol","includes","toLowerCase","manifestUrl","devClientUrl","encodeURIComponent","urlComponents","getUrlComponents","joinUrlComponents","getTunnelUrlComponents","tunnelUrl","getTunnelUrl","parsed","port","hostname","proxyURL","getProxyUrl","getUrlComponentsFromProxyUrl","hostType","components","warn","getDefaultHostname","parsedProxyUrl","process","env","REACT_NATIVE_PACKAGER_HOSTNAME","trim","getIpAddress","assert","validProtocol","EXPO_PACKAGER_PROXY_URL"],"mappings":"AAAA;;;;AAAmB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACP,IAAA,IAAK,WAAL,KAAK,CAAA;AAEbA,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACc,IAAA,GAAgB,WAAhB,gBAAgB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,8BAA8B,CAAC,AAAsB,AAAC;AAgB9E,MAAMC,UAAU;IACrBC,YACSC,QAAsC,EACrCC,WAA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jC,0BAA0B"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/server/UrlCreator.ts"],"sourcesContent":["import assert from 'assert';\nimport { URL } from 'url';\n\nimport * as Log from '../../log';\nimport { getIpAddress } from '../../utils/ip';\n\nconst debug = require('debug')('expo:start:server:urlCreator') as typeof console.log;\n\nexport interface CreateURLOptions {\n /** URL scheme to use when opening apps in custom runtimes. */\n scheme?: string | null;\n /** Type of dev server host to use. */\n hostType?: 'localhost' | 'lan' | 'tunnel';\n /** Requested hostname. */\n hostname?: string | null;\n}\n\ninterface UrlComponents {\n port: string;\n hostname: string;\n protocol: string;\n}\nexport class UrlCreator {\n constructor(\n public defaults: CreateURLOptions | undefined,\n private bundlerInfo: { port: number; getTunnelUrl?: () => string | null }\n ) {}\n\n /**\n * Return a URL for the \"loading\" interstitial page that is used to disambiguate which\n * native runtime to open the dev server with.\n *\n * @param options options for creating the URL\n * @param platform when opening the URL from the CLI to a connected device we can specify the platform as a query parameter, otherwise it will be inferred from the unsafe user agent sniffing.\n *\n * @returns URL like `http://localhost:8081/_expo/loading?platform=ios`\n * @returns URL like `http://localhost:8081/_expo/loading` when no platform is provided.\n */\n public constructLoadingUrl(options: CreateURLOptions, platform: string | null): string {\n const url = new URL('_expo/loading', this.constructUrl({ scheme: 'http', ...options }));\n if (platform) {\n url.search = new URLSearchParams({ platform }).toString();\n }\n const loadingUrl = url.toString();\n debug(`Loading URL: ${loadingUrl}`);\n return loadingUrl;\n }\n\n /** Create a URI for launching in a native dev client. Returns `null` when no `scheme` can be resolved. */\n public constructDevClientUrl(options?: CreateURLOptions): null | string {\n const protocol = options?.scheme || this.defaults?.scheme;\n\n if (\n !protocol ||\n // Prohibit the use of http(s) in dev client URIs since they'll never be valid.\n ['http', 'https'].includes(protocol.toLowerCase()) ||\n // Prohibit the use of `_` characters in the protocol, Node will throw an error when parsing these URLs\n protocol.includes('_')\n ) {\n return null;\n }\n\n const manifestUrl = this.constructUrl({\n ...options,\n scheme: this.defaults?.hostType === 'tunnel' ? 'https' : 'http',\n });\n const devClientUrl = `${protocol}://expo-development-client/?url=${encodeURIComponent(\n manifestUrl\n )}`;\n debug(`Dev client URL: ${devClientUrl} -- manifestUrl: ${manifestUrl} -- %O`, options);\n return devClientUrl;\n }\n\n /** Create a generic URL. */\n public constructUrl(options?: Partial<CreateURLOptions> | null): string {\n const urlComponents = this.getUrlComponents({\n ...this.defaults,\n ...options,\n });\n const url = joinUrlComponents(urlComponents);\n debug(`URL: ${url}`);\n return url;\n }\n\n /** Get the URL components from the Ngrok server URL. */\n private getTunnelUrlComponents(options: Pick<CreateURLOptions, 'scheme'>): UrlComponents | null {\n const tunnelUrl = this.bundlerInfo.getTunnelUrl?.();\n if (!tunnelUrl) {\n return null;\n }\n const parsed = new URL(tunnelUrl);\n return {\n port: parsed.port,\n hostname: parsed.hostname,\n protocol: options.scheme ?? 'http',\n };\n }\n\n private getUrlComponents(options: CreateURLOptions): UrlComponents {\n // Proxy comes first.\n const proxyURL = getProxyUrl();\n if (proxyURL) {\n return getUrlComponentsFromProxyUrl(options, proxyURL);\n }\n\n // Ngrok.\n if (options.hostType === 'tunnel') {\n const components = this.getTunnelUrlComponents(options);\n if (components) {\n return components;\n }\n Log.warn('Tunnel URL not found (it might not be ready yet), falling back to LAN URL.');\n } else if (options.hostType === 'localhost' && !options.hostname) {\n options.hostname = 'localhost';\n }\n\n return {\n hostname: getDefaultHostname(options),\n port: this.bundlerInfo.port.toString(),\n protocol: options.scheme ?? 'http',\n };\n }\n}\n\nfunction getUrlComponentsFromProxyUrl(\n options: Pick<CreateURLOptions, 'scheme'>,\n url: string\n): UrlComponents {\n const parsedProxyUrl = new URL(url);\n let protocol = options.scheme ?? 'http';\n if (parsedProxyUrl.protocol === 'https:') {\n if (protocol === 'http') {\n protocol = 'https';\n }\n if (!parsedProxyUrl.port) {\n parsedProxyUrl.port = '443';\n }\n }\n return {\n port: parsedProxyUrl.port,\n hostname: parsedProxyUrl.hostname,\n protocol,\n };\n}\n\nfunction getDefaultHostname(options: Pick<CreateURLOptions, 'hostname'>) {\n // TODO: Drop REACT_NATIVE_PACKAGER_HOSTNAME\n if (process.env.REACT_NATIVE_PACKAGER_HOSTNAME) {\n return process.env.REACT_NATIVE_PACKAGER_HOSTNAME.trim();\n } else if (options.hostname === 'localhost') {\n // Restrict the use of `localhost`\n // TODO: Note why we do this.\n return '127.0.0.1';\n }\n\n return options.hostname || getIpAddress();\n}\n\nfunction joinUrlComponents({ protocol, hostname, port }: Partial<UrlComponents>): string {\n assert(hostname, 'hostname cannot be inferred.');\n const validProtocol = protocol ? `${protocol}://` : '';\n\n const url = `${validProtocol}${hostname}`;\n\n if (port) {\n return url + `:${port}`;\n }\n\n return url;\n}\n\n/** @deprecated */\nfunction getProxyUrl(): string | undefined {\n return process.env.EXPO_PACKAGER_PROXY_URL;\n}\n\n// TODO: Drop the undocumented env variables:\n// REACT_NATIVE_PACKAGER_HOSTNAME\n// EXPO_PACKAGER_PROXY_URL\n"],"names":["Log","debug","require","UrlCreator","constructor","defaults","bundlerInfo","constructLoadingUrl","options","platform","url","URL","constructUrl","scheme","search","URLSearchParams","toString","loadingUrl","constructDevClientUrl","protocol","includes","toLowerCase","manifestUrl","hostType","devClientUrl","encodeURIComponent","urlComponents","getUrlComponents","joinUrlComponents","getTunnelUrlComponents","tunnelUrl","getTunnelUrl","parsed","port","hostname","proxyURL","getProxyUrl","getUrlComponentsFromProxyUrl","components","warn","getDefaultHostname","parsedProxyUrl","process","env","REACT_NATIVE_PACKAGER_HOSTNAME","trim","getIpAddress","assert","validProtocol","EXPO_PACKAGER_PROXY_URL"],"mappings":"AAAA;;;;AAAmB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACP,IAAA,IAAK,WAAL,KAAK,CAAA;AAEbA,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACc,IAAA,GAAgB,WAAhB,gBAAgB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7C,MAAMC,KAAK,GAAGC,OAAO,C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ID,IAAI,EAAE;QACR,OAAOvB,GAAG,GAAG,CAAC,CAAC,EAAEuB,IAAI,CAAC,CAAC,CAAC;KACzB;IAED,OAAOvB,GAAG,CAAC;CACZ;AAED,kBAAkB,CAClB,SAAS0B,WAAW,GAAuB;IACzC,OAAOM,OAAO,CAACC,GAAG,CAACM,uBAAuB,CAAC;CAC5C,CAED,6CAA6C;CAC7C,iCAAiC;CACjC,0BAA0B"}
|
|
@@ -13,6 +13,7 @@ var _resolveFrom = _interopRequireDefault(require("resolve-from"));
|
|
|
13
13
|
var _metroErrorInterface = require("./metro/metroErrorInterface");
|
|
14
14
|
var _manifestMiddleware = require("./middleware/ManifestMiddleware");
|
|
15
15
|
var _metroOptions = require("./middleware/metroOptions");
|
|
16
|
+
var _serverLogLikeMetro = require("./serverLogLikeMetro");
|
|
16
17
|
var _ansi = require("../../utils/ansi");
|
|
17
18
|
var _delay = require("../../utils/delay");
|
|
18
19
|
var _errors = require("../../utils/errors");
|
|
@@ -118,7 +119,8 @@ async function createMetroEndpointAsync(projectRoot, devServerUrl, absoluteFileP
|
|
|
118
119
|
isExporting: true,
|
|
119
120
|
asyncRoutes: false,
|
|
120
121
|
routerRoot,
|
|
121
|
-
inlineSourceMap: false
|
|
122
|
+
inlineSourceMap: false,
|
|
123
|
+
bytecode: false
|
|
122
124
|
});
|
|
123
125
|
let url;
|
|
124
126
|
if (devServerUrl) {
|
|
@@ -186,11 +188,7 @@ function evalMetroAndWrapFunctions(projectRoot, script, filename) {
|
|
|
186
188
|
}, {});
|
|
187
189
|
}
|
|
188
190
|
function evalMetro(projectRoot, src, filename) {
|
|
189
|
-
|
|
190
|
-
log: console.log,
|
|
191
|
-
warn: console.warn,
|
|
192
|
-
error: console.error
|
|
193
|
-
};
|
|
191
|
+
(0, _serverLogLikeMetro).augmentLogs(projectRoot);
|
|
194
192
|
try {
|
|
195
193
|
return (0, _profile).profile(_requireFromString.default, "eval-metro-bundle")(src, filename);
|
|
196
194
|
} catch (error) {
|
|
@@ -206,12 +204,7 @@ function evalMetro(projectRoot, src, filename) {
|
|
|
206
204
|
} else {
|
|
207
205
|
throw error;
|
|
208
206
|
}
|
|
209
|
-
} finally{
|
|
210
|
-
// Restore the original console in case it was modified.
|
|
211
|
-
console.log = originalConsole.log;
|
|
212
|
-
console.warn = originalConsole.warn;
|
|
213
|
-
console.error = originalConsole.error;
|
|
214
|
-
}
|
|
207
|
+
} finally{}
|
|
215
208
|
}
|
|
216
209
|
|
|
217
210
|
//# sourceMappingURL=getStaticRenderFunctions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/server/getStaticRenderFunctions.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport fs from 'fs';\nimport fetch from 'node-fetch';\nimport path from 'path';\nimport requireString from 'require-from-string';\nimport resolveFrom from 'resolve-from';\n\nimport { logMetroError, logMetroErrorAsync } from './metro/metroErrorInterface';\nimport { getMetroServerRoot } from './middleware/ManifestMiddleware';\nimport { createBundleUrlPath } from './middleware/metroOptions';\nimport { stripAnsi } from '../../utils/ansi';\nimport { delayAsync } from '../../utils/delay';\nimport { SilentError } from '../../utils/errors';\nimport { memoize } from '../../utils/fn';\nimport { profile } from '../../utils/profile';\n\ntype StaticRenderOptions = {\n // Ensure the style format is `css-xxxx` (prod) instead of `css-view-xxxx` (dev)\n dev?: boolean;\n minify?: boolean;\n platform?: string;\n environment?: 'node';\n engine?: 'hermes';\n baseUrl: string;\n routerRoot: string;\n};\n\nclass MetroNodeError extends Error {\n constructor(\n message: string,\n public rawObject: any\n ) {\n super(message);\n }\n}\n\nconst debug = require('debug')('expo:start:server:node-renderer') as typeof console.log;\n\nconst cachedSourceMaps: Map<string, { url: string; map: string }> = new Map();\n\n// Support unhandled rejections\nrequire('source-map-support').install({\n retrieveSourceMap(source: string) {\n if (cachedSourceMaps.has(source)) {\n return cachedSourceMaps.get(source);\n }\n return null;\n },\n});\n\nfunction wrapBundle(str: string) {\n // Skip the metro runtime so debugging is a bit easier.\n // Replace the __r() call with an export statement.\n // Use gm to apply to the last require line. This is needed when the bundle has side-effects.\n return str.replace(/^(__r\\(.*\\);)$/gm, 'module.exports = $1');\n}\n\n// TODO(EvanBacon): Group all the code together and version.\nconst getRenderModuleId = (projectRoot: string): string => {\n const moduleId = resolveFrom.silent(projectRoot, 'expo-router/node/render.js');\n if (!moduleId) {\n throw new Error(\n `A version of expo-router with Node.js support is not installed in the project.`\n );\n }\n\n return moduleId;\n};\n\nconst moveStaticRenderFunction = memoize(async (projectRoot: string, requiredModuleId: string) => {\n // Copy the file into the project to ensure it works in monorepos.\n // This means the file cannot have any relative imports.\n const tempDir = path.join(projectRoot, '.expo/static');\n await fs.promises.mkdir(tempDir, { recursive: true });\n const moduleId = path.join(tempDir, 'render.js');\n await fs.promises.writeFile(moduleId, await fs.promises.readFile(requiredModuleId, 'utf8'));\n // Sleep to give watchman time to register the file.\n await delayAsync(50);\n return moduleId;\n});\n\n/** @returns the js file contents required to generate the static generation function. */\nasync function getStaticRenderFunctionsContentAsync(\n projectRoot: string,\n devServerUrl: string,\n { dev = false, minify = false, environment, baseUrl, routerRoot }: StaticRenderOptions\n): Promise<{ src: string; filename: string }> {\n const root = getMetroServerRoot(projectRoot);\n const requiredModuleId = getRenderModuleId(root);\n let moduleId = requiredModuleId;\n\n // Cannot be accessed using Metro's server API, we need to move the file\n // into the project root and try again.\n if (path.relative(root, moduleId).startsWith('..')) {\n moduleId = await moveStaticRenderFunction(projectRoot, requiredModuleId);\n }\n\n return requireFileContentsWithMetro(root, devServerUrl, moduleId, {\n dev,\n minify,\n environment,\n baseUrl,\n routerRoot,\n });\n}\n\nasync function ensureFileInRootDirectory(projectRoot: string, otherFile: string) {\n // Cannot be accessed using Metro's server API, we need to move the file\n // into the project root and try again.\n if (!path.relative(projectRoot, otherFile).startsWith('..' + path.sep)) {\n return otherFile;\n }\n\n // Copy the file into the project to ensure it works in monorepos.\n // This means the file cannot have any relative imports.\n const tempDir = path.join(projectRoot, '.expo/static-tmp');\n await fs.promises.mkdir(tempDir, { recursive: true });\n const moduleId = path.join(tempDir, path.basename(otherFile));\n await fs.promises.writeFile(moduleId, await fs.promises.readFile(otherFile, 'utf8'));\n // Sleep to give watchman time to register the file.\n await delayAsync(50);\n return moduleId;\n}\n\nexport async function createMetroEndpointAsync(\n projectRoot: string,\n devServerUrl: string,\n absoluteFilePath: string,\n {\n dev = false,\n platform = 'web',\n minify = false,\n environment,\n engine = 'hermes',\n baseUrl,\n routerRoot,\n }: StaticRenderOptions\n): Promise<string> {\n const root = getMetroServerRoot(projectRoot);\n const safeOtherFile = await ensureFileInRootDirectory(projectRoot, absoluteFilePath);\n const serverPath = path.relative(root, safeOtherFile).replace(/\\.[jt]sx?$/, '');\n\n const urlFragment = createBundleUrlPath({\n platform,\n mode: dev ? 'development' : 'production',\n mainModuleName: serverPath,\n engine,\n environment,\n lazy: false,\n minify,\n baseUrl,\n isExporting: true,\n asyncRoutes: false,\n routerRoot,\n inlineSourceMap: false,\n });\n\n let url: string;\n if (devServerUrl) {\n url = new URL(urlFragment.replace(/^\\//, ''), devServerUrl).toString();\n } else {\n url = '/' + urlFragment.replace(/^\\/+/, '');\n }\n debug('fetching from Metro:', root, serverPath, url);\n return url;\n}\n\nexport async function requireFileContentsWithMetro(\n projectRoot: string,\n devServerUrl: string,\n absoluteFilePath: string,\n props: StaticRenderOptions\n): Promise<{ src: string; filename: string }> {\n const url = await createMetroEndpointAsync(projectRoot, devServerUrl, absoluteFilePath, props);\n\n const res = await fetch(url);\n\n // TODO: Improve error handling\n if (res.status === 500) {\n const text = await res.text();\n if (text.startsWith('{\"originModulePath\"') || text.startsWith('{\"type\":\"TransformError\"')) {\n const errorObject = JSON.parse(text);\n\n throw new MetroNodeError(stripAnsi(errorObject.message) ?? errorObject.message, errorObject);\n }\n throw new Error(`[${res.status}]: ${res.statusText}\\n${text}`);\n }\n\n if (!res.ok) {\n throw new Error(`Error fetching bundle for static rendering: ${res.status} ${res.statusText}`);\n }\n\n const content = await res.text();\n\n const map = await fetch(url.replace('.bundle?', '.map?')).then((r) => r.json());\n cachedSourceMaps.set(url, { url: projectRoot, map });\n\n return { src: wrapBundle(content), filename: url };\n}\n\nexport async function getStaticRenderFunctions(\n projectRoot: string,\n devServerUrl: string,\n options: StaticRenderOptions\n): Promise<Record<string, (...args: any[]) => Promise<any>>> {\n const { src: scriptContents, filename } = await getStaticRenderFunctionsContentAsync(\n projectRoot,\n devServerUrl,\n options\n );\n\n return evalMetroAndWrapFunctions(projectRoot, scriptContents, filename);\n}\n\nfunction evalMetroAndWrapFunctions<T = Record<string, (...args: any[]) => Promise<any>>>(\n projectRoot: string,\n script: string,\n filename: string\n): Promise<T> {\n const contents = evalMetro(projectRoot, script, filename);\n\n // wrap each function with a try/catch that uses Metro's error formatter\n return Object.keys(contents).reduce((acc, key) => {\n const fn = contents[key];\n if (typeof fn !== 'function') {\n return { ...acc, [key]: fn };\n }\n\n acc[key] = async function (...props: any[]) {\n try {\n return await fn.apply(this, props);\n } catch (error: any) {\n await logMetroError(projectRoot, { error });\n throw new SilentError(error);\n }\n };\n return acc;\n }, {} as any);\n}\n\nfunction evalMetro(projectRoot: string, src: string, filename: string) {\n const originalConsole = {\n log: console.log,\n warn: console.warn,\n error: console.error,\n };\n try {\n return profile(requireString, 'eval-metro-bundle')(src, filename);\n } catch (error: any) {\n // Format any errors that were thrown in the global scope of the evaluation.\n if (error instanceof Error) {\n logMetroErrorAsync({ projectRoot, error }).catch((internalError) => {\n debug('Failed to log metro error:', internalError);\n throw error;\n });\n } else {\n throw error;\n }\n } finally {\n // Restore the original console in case it was modified.\n console.log = originalConsole.log;\n console.warn = originalConsole.warn;\n console.error = originalConsole.error;\n }\n}\n"],"names":["createMetroEndpointAsync","requireFileContentsWithMetro","getStaticRenderFunctions","MetroNodeError","Error","constructor","message","rawObject","debug","require","cachedSourceMaps","Map","install","retrieveSourceMap","source","has","get","wrapBundle","str","replace","getRenderModuleId","projectRoot","moduleId","resolveFrom","silent","moveStaticRenderFunction","memoize","requiredModuleId","tempDir","path","join","fs","promises","mkdir","recursive","writeFile","readFile","delayAsync","getStaticRenderFunctionsContentAsync","devServerUrl","dev","minify","environment","baseUrl","routerRoot","root","getMetroServerRoot","relative","startsWith","ensureFileInRootDirectory","otherFile","sep","basename","absoluteFilePath","platform","engine","safeOtherFile","serverPath","urlFragment","createBundleUrlPath","mode","mainModuleName","lazy","isExporting","asyncRoutes","inlineSourceMap","url","URL","toString","props","res","fetch","status","text","errorObject","JSON","parse","stripAnsi","statusText","ok","content","map","then","r","json","set","src","filename","options","scriptContents","evalMetroAndWrapFunctions","script","contents","evalMetro","Object","keys","reduce","acc","key","fn","apply","error","logMetroError","SilentError","originalConsole","log","console","warn","profile","requireString","logMetroErrorAsync","catch","internalError"],"mappings":"AAMA;;;;QA2HsBA,wBAAwB,GAAxBA,wBAAwB;QA2CxBC,4BAA4B,GAA5BA,4BAA4B;QAiC5BC,wBAAwB,GAAxBA,wBAAwB;AAvM/B,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACD,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;AACG,IAAA,kBAAqB,kCAArB,qBAAqB,EAAA;AACvB,IAAA,YAAc,kCAAd,cAAc,EAAA;AAEY,IAAA,oBAA6B,WAA7B,6BAA6B,CAAA;AAC5C,IAAA,mBAAiC,WAAjC,iCAAiC,CAAA;AAChC,IAAA,aAA2B,WAA3B,2BAA2B,CAAA;AACrC,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AACjB,IAAA,MAAmB,WAAnB,mBAAmB,CAAA;AAClB,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AACxB,IAAA,GAAgB,WAAhB,gBAAgB,CAAA;AAChB,IAAA,QAAqB,WAArB,qBAAqB,CAAA;;;;;;AAa7C,MAAMC,cAAc,SAASC,KAAK;IAChC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ACjF,WAAW,EAAE;oBAAEgF,KAAK;iBAAE,CAAC,CAAC;gBAC5C,MAAM,IAAIE,OAAW,YAAA,CAACF,KAAK,CAAC,CAAC;aAC9B;SACF,CAAC;QACF,OAAOJ,GAAG,CAAC;KACZ,EAAE,EAAE,CAAQ,CAAC;CACf;AAED,SAASJ,SAAS,CAACxE,WAAmB,EAAEiE,GAAW,EAAEC,QAAgB,EAAE;IACrE,MAAMiB,eAAe,GAAG;QACtBC,GAAG,EAAEC,OAAO,CAACD,GAAG;QAChBE,IAAI,EAAED,OAAO,CAACC,IAAI;QAClBN,KAAK,EAAEK,OAAO,CAACL,KAAK;KACrB,AAAC;IACF,IAAI;QACF,OAAOO,CAAAA,GAAAA,QAAO,AAAoC,CAAA,QAApC,CAACC,kBAAa,QAAA,EAAE,mBAAmB,CAAC,CAACvB,GAAG,EAAEC,QAAQ,CAAC,CAAC;KACnE,CAAC,OAAOc,KAAK,EAAO;QACnB,4EAA4E;QAC5E,IAAIA,KAAK,YAAYjG,KAAK,EAAE;YAC1B0G,CAAAA,GAAAA,oBAAkB,AAAwB,CAAA,mBAAxB,CAAC;gBAAEzF,WAAW;gBAAEgF,KAAK;aAAE,CAAC,CAACU,KAAK,CAAC,CAACC,aAAa,GAAK;gBAClExG,KAAK,CAAC,4BAA4B,EAAEwG,aAAa,CAAC,CAAC;gBACnD,MAAMX,KAAK,CAAC;aACb,CAAC,CAAC;SACJ,MAAM;YACL,MAAMA,KAAK,CAAC;SACb;KACF,QAAS;QACR,wDAAwD;QACxDK,OAAO,CAACD,GAAG,GAAGD,eAAe,CAACC,GAAG,CAAC;QAClCC,OAAO,CAACC,IAAI,GAAGH,eAAe,CAACG,IAAI,CAAC;QACpCD,OAAO,CAACL,KAAK,GAAGG,eAAe,CAACH,KAAK,CAAC;KACvC;CACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/server/getStaticRenderFunctions.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport fs from 'fs';\nimport fetch from 'node-fetch';\nimport path from 'path';\nimport requireString from 'require-from-string';\nimport resolveFrom from 'resolve-from';\n\nimport { logMetroError, logMetroErrorAsync } from './metro/metroErrorInterface';\nimport { getMetroServerRoot } from './middleware/ManifestMiddleware';\nimport { createBundleUrlPath } from './middleware/metroOptions';\nimport { augmentLogs } from './serverLogLikeMetro';\nimport { stripAnsi } from '../../utils/ansi';\nimport { delayAsync } from '../../utils/delay';\nimport { SilentError } from '../../utils/errors';\nimport { memoize } from '../../utils/fn';\nimport { profile } from '../../utils/profile';\n\ntype StaticRenderOptions = {\n // Ensure the style format is `css-xxxx` (prod) instead of `css-view-xxxx` (dev)\n dev?: boolean;\n minify?: boolean;\n platform?: string;\n environment?: 'node';\n engine?: 'hermes';\n baseUrl: string;\n routerRoot: string;\n};\n\nclass MetroNodeError extends Error {\n constructor(\n message: string,\n public rawObject: any\n ) {\n super(message);\n }\n}\n\nconst debug = require('debug')('expo:start:server:node-renderer') as typeof console.log;\n\nconst cachedSourceMaps: Map<string, { url: string; map: string }> = new Map();\n\n// Support unhandled rejections\nrequire('source-map-support').install({\n retrieveSourceMap(source: string) {\n if (cachedSourceMaps.has(source)) {\n return cachedSourceMaps.get(source);\n }\n return null;\n },\n});\n\nfunction wrapBundle(str: string) {\n // Skip the metro runtime so debugging is a bit easier.\n // Replace the __r() call with an export statement.\n // Use gm to apply to the last require line. This is needed when the bundle has side-effects.\n return str.replace(/^(__r\\(.*\\);)$/gm, 'module.exports = $1');\n}\n\n// TODO(EvanBacon): Group all the code together and version.\nconst getRenderModuleId = (projectRoot: string): string => {\n const moduleId = resolveFrom.silent(projectRoot, 'expo-router/node/render.js');\n if (!moduleId) {\n throw new Error(\n `A version of expo-router with Node.js support is not installed in the project.`\n );\n }\n\n return moduleId;\n};\n\nconst moveStaticRenderFunction = memoize(async (projectRoot: string, requiredModuleId: string) => {\n // Copy the file into the project to ensure it works in monorepos.\n // This means the file cannot have any relative imports.\n const tempDir = path.join(projectRoot, '.expo/static');\n await fs.promises.mkdir(tempDir, { recursive: true });\n const moduleId = path.join(tempDir, 'render.js');\n await fs.promises.writeFile(moduleId, await fs.promises.readFile(requiredModuleId, 'utf8'));\n // Sleep to give watchman time to register the file.\n await delayAsync(50);\n return moduleId;\n});\n\n/** @returns the js file contents required to generate the static generation function. */\nasync function getStaticRenderFunctionsContentAsync(\n projectRoot: string,\n devServerUrl: string,\n { dev = false, minify = false, environment, baseUrl, routerRoot }: StaticRenderOptions\n): Promise<{ src: string; filename: string }> {\n const root = getMetroServerRoot(projectRoot);\n const requiredModuleId = getRenderModuleId(root);\n let moduleId = requiredModuleId;\n\n // Cannot be accessed using Metro's server API, we need to move the file\n // into the project root and try again.\n if (path.relative(root, moduleId).startsWith('..')) {\n moduleId = await moveStaticRenderFunction(projectRoot, requiredModuleId);\n }\n\n return requireFileContentsWithMetro(root, devServerUrl, moduleId, {\n dev,\n minify,\n environment,\n baseUrl,\n routerRoot,\n });\n}\n\nasync function ensureFileInRootDirectory(projectRoot: string, otherFile: string) {\n // Cannot be accessed using Metro's server API, we need to move the file\n // into the project root and try again.\n if (!path.relative(projectRoot, otherFile).startsWith('..' + path.sep)) {\n return otherFile;\n }\n\n // Copy the file into the project to ensure it works in monorepos.\n // This means the file cannot have any relative imports.\n const tempDir = path.join(projectRoot, '.expo/static-tmp');\n await fs.promises.mkdir(tempDir, { recursive: true });\n const moduleId = path.join(tempDir, path.basename(otherFile));\n await fs.promises.writeFile(moduleId, await fs.promises.readFile(otherFile, 'utf8'));\n // Sleep to give watchman time to register the file.\n await delayAsync(50);\n return moduleId;\n}\n\nexport async function createMetroEndpointAsync(\n projectRoot: string,\n devServerUrl: string,\n absoluteFilePath: string,\n {\n dev = false,\n platform = 'web',\n minify = false,\n environment,\n engine = 'hermes',\n baseUrl,\n routerRoot,\n }: StaticRenderOptions\n): Promise<string> {\n const root = getMetroServerRoot(projectRoot);\n const safeOtherFile = await ensureFileInRootDirectory(projectRoot, absoluteFilePath);\n const serverPath = path.relative(root, safeOtherFile).replace(/\\.[jt]sx?$/, '');\n\n const urlFragment = createBundleUrlPath({\n platform,\n mode: dev ? 'development' : 'production',\n mainModuleName: serverPath,\n engine,\n environment,\n lazy: false,\n minify,\n baseUrl,\n isExporting: true,\n asyncRoutes: false,\n routerRoot,\n inlineSourceMap: false,\n bytecode: false,\n });\n\n let url: string;\n if (devServerUrl) {\n url = new URL(urlFragment.replace(/^\\//, ''), devServerUrl).toString();\n } else {\n url = '/' + urlFragment.replace(/^\\/+/, '');\n }\n debug('fetching from Metro:', root, serverPath, url);\n return url;\n}\n\nexport async function requireFileContentsWithMetro(\n projectRoot: string,\n devServerUrl: string,\n absoluteFilePath: string,\n props: StaticRenderOptions\n): Promise<{ src: string; filename: string }> {\n const url = await createMetroEndpointAsync(projectRoot, devServerUrl, absoluteFilePath, props);\n\n const res = await fetch(url);\n\n // TODO: Improve error handling\n if (res.status === 500) {\n const text = await res.text();\n if (text.startsWith('{\"originModulePath\"') || text.startsWith('{\"type\":\"TransformError\"')) {\n const errorObject = JSON.parse(text);\n\n throw new MetroNodeError(stripAnsi(errorObject.message) ?? errorObject.message, errorObject);\n }\n throw new Error(`[${res.status}]: ${res.statusText}\\n${text}`);\n }\n\n if (!res.ok) {\n throw new Error(`Error fetching bundle for static rendering: ${res.status} ${res.statusText}`);\n }\n\n const content = await res.text();\n\n const map = await fetch(url.replace('.bundle?', '.map?')).then((r) => r.json());\n cachedSourceMaps.set(url, { url: projectRoot, map });\n\n return { src: wrapBundle(content), filename: url };\n}\n\nexport async function getStaticRenderFunctions(\n projectRoot: string,\n devServerUrl: string,\n options: StaticRenderOptions\n): Promise<Record<string, (...args: any[]) => Promise<any>>> {\n const { src: scriptContents, filename } = await getStaticRenderFunctionsContentAsync(\n projectRoot,\n devServerUrl,\n options\n );\n\n return evalMetroAndWrapFunctions(projectRoot, scriptContents, filename);\n}\n\nfunction evalMetroAndWrapFunctions<T = Record<string, (...args: any[]) => Promise<any>>>(\n projectRoot: string,\n script: string,\n filename: string\n): Promise<T> {\n const contents = evalMetro(projectRoot, script, filename);\n\n // wrap each function with a try/catch that uses Metro's error formatter\n return Object.keys(contents).reduce((acc, key) => {\n const fn = contents[key];\n if (typeof fn !== 'function') {\n return { ...acc, [key]: fn };\n }\n\n acc[key] = async function (...props: any[]) {\n try {\n return await fn.apply(this, props);\n } catch (error: any) {\n await logMetroError(projectRoot, { error });\n throw new SilentError(error);\n }\n };\n return acc;\n }, {} as any);\n}\n\nfunction evalMetro(projectRoot: string, src: string, filename: string) {\n augmentLogs(projectRoot);\n try {\n return profile(requireString, 'eval-metro-bundle')(src, filename);\n } catch (error: any) {\n // Format any errors that were thrown in the global scope of the evaluation.\n if (error instanceof Error) {\n logMetroErrorAsync({ projectRoot, error }).catch((internalError) => {\n debug('Failed to log metro error:', internalError);\n throw error;\n });\n } else {\n throw error;\n }\n } finally {\n }\n}\n"],"names":["createMetroEndpointAsync","requireFileContentsWithMetro","getStaticRenderFunctions","MetroNodeError","Error","constructor","message","rawObject","debug","require","cachedSourceMaps","Map","install","retrieveSourceMap","source","has","get","wrapBundle","str","replace","getRenderModuleId","projectRoot","moduleId","resolveFrom","silent","moveStaticRenderFunction","memoize","requiredModuleId","tempDir","path","join","fs","promises","mkdir","recursive","writeFile","readFile","delayAsync","getStaticRenderFunctionsContentAsync","devServerUrl","dev","minify","environment","baseUrl","routerRoot","root","getMetroServerRoot","relative","startsWith","ensureFileInRootDirectory","otherFile","sep","basename","absoluteFilePath","platform","engine","safeOtherFile","serverPath","urlFragment","createBundleUrlPath","mode","mainModuleName","lazy","isExporting","asyncRoutes","inlineSourceMap","bytecode","url","URL","toString","props","res","fetch","status","text","errorObject","JSON","parse","stripAnsi","statusText","ok","content","map","then","r","json","set","src","filename","options","scriptContents","evalMetroAndWrapFunctions","script","contents","evalMetro","Object","keys","reduce","acc","key","fn","apply","error","logMetroError","SilentError","augmentLogs","profile","requireString","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EC,QAAQ,CAAC,CAAC;KACnE,CAAC,OAAOc,KAAK,EAAO;QACnB,4EAA4E;QAC5E,IAAIA,KAAK,YAAYlG,KAAK,EAAE;YAC1BwG,CAAAA,GAAAA,oBAAkB,AAAwB,CAAA,mBAAxB,CAAC;gBAAEvF,WAAW;gBAAEiF,KAAK;aAAE,CAAC,CAACO,KAAK,CAAC,CAACC,aAAa,GAAK;gBAClEtG,KAAK,CAAC,4BAA4B,EAAEsG,aAAa,CAAC,CAAC;gBACnD,MAAMR,KAAK,CAAC;aACb,CAAC,CAAC;SACJ,MAAM;YACL,MAAMA,KAAK,CAAC;SACb;KACF,QAAS,EACT;CACF"}
|
|
@@ -169,7 +169,8 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
169
169
|
asyncRoutes,
|
|
170
170
|
baseUrl,
|
|
171
171
|
isExporting,
|
|
172
|
-
routerRoot
|
|
172
|
+
routerRoot,
|
|
173
|
+
bytecode: false
|
|
173
174
|
});
|
|
174
175
|
const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl());
|
|
175
176
|
// Fetch the generated HTML from our custom Metro serializer
|
|
@@ -225,7 +226,8 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
225
226
|
baseUrl,
|
|
226
227
|
isExporting,
|
|
227
228
|
asyncRoutes,
|
|
228
|
-
routerRoot
|
|
229
|
+
routerRoot,
|
|
230
|
+
bytecode: false
|
|
229
231
|
});
|
|
230
232
|
const bundleStaticHtml = async ()=>{
|
|
231
233
|
const { getStaticContent } = await (0, _getStaticRenderFunctions).getStaticRenderFunctions(this.projectRoot, this.getDevServerUrl(), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/MetroBundlerDevServer.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getConfig } from '@expo/config';\nimport * as runtimeEnv from '@expo/env';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport { AssetData } from 'metro';\nimport fetch from 'node-fetch';\nimport path from 'path';\n\nimport { bundleApiRoute, invalidateApiRouteCache } from './bundleApiRoutes';\nimport { createRouteHandlerMiddleware } from './createServerRouteMiddleware';\nimport { ExpoRouterServerManifestV1, fetchManifest } from './fetchRouterManifest';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport {\n getRouterDirectoryModuleIdWithManifest,\n hasWarnedAboutApiRoutes,\n isApiRouteConvention,\n warnInvalidWebOutput,\n} from './router';\nimport { serializeHtmlWithAssets } from './serializeHtml';\nimport { observeAnyFileChanges, observeFileChanges } from './waitForMetroToObserveTypeScriptFile';\nimport { ExportAssetMap } from '../../../export/saveAssets';\nimport { Log } from '../../../log';\nimport getDevClientProperties from '../../../utils/analytics/getDevClientProperties';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { CommandError } from '../../../utils/errors';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport { getStaticRenderFunctions } from '../getStaticRenderFunctions';\nimport { ContextModuleSourceMapsMiddleware } from '../middleware/ContextModuleSourceMapsMiddleware';\nimport { CreateFileMiddleware } from '../middleware/CreateFileMiddleware';\nimport { DevToolsPluginMiddleware } from '../middleware/DevToolsPluginMiddleware';\nimport { FaviconMiddleware } from '../middleware/FaviconMiddleware';\nimport { HistoryFallbackMiddleware } from '../middleware/HistoryFallbackMiddleware';\nimport { InterstitialPageMiddleware } from '../middleware/InterstitialPageMiddleware';\nimport { resolveMainModuleName } from '../middleware/ManifestMiddleware';\nimport { ReactDevToolsPageMiddleware } from '../middleware/ReactDevToolsPageMiddleware';\nimport {\n DeepLinkHandler,\n RuntimeRedirectMiddleware,\n} from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport {\n shouldEnableAsyncImports,\n createBundleUrlPath,\n getBaseUrlFromExpoConfig,\n getAsyncRoutesFromExpoConfig,\n} from '../middleware/metroOptions';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { startTypescriptTypeGenerationAsync } from '../type-generation/startTypescriptTypeGeneration';\n\nexport type ExpoRouterRuntimeManifest = Awaited<\n ReturnType<typeof import('expo-router/build/static/renderStaticContent').getManifest>\n>;\n\nexport class ForwardHtmlError extends CommandError {\n constructor(\n message: string,\n public html: string,\n public statusCode: number\n ) {\n super(message);\n }\n}\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\n/** Default port to use for apps running in Expo Go. */\nconst EXPO_GO_METRO_PORT = 8081;\n\n/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */\nconst DEV_CLIENT_METRO_PORT = 8081;\n\nexport class MetroBundlerDevServer extends BundlerDevServer {\n private metro: import('metro').Server | null = null;\n\n get name(): string {\n return 'metro';\n }\n\n async resolvePortAsync(options: Partial<BundlerStartOptions> = {}): Promise<number> {\n const port =\n // If the manually defined port is busy then an error should be thrown...\n options.port ??\n // Otherwise use the default port based on the runtime target.\n (options.devClient\n ? // Don't check if the port is busy if we're using the dev client since most clients are hardcoded to 8081.\n Number(process.env.RCT_METRO_PORT) || DEV_CLIENT_METRO_PORT\n : // Otherwise (running in Expo Go) use a free port that falls back on the classic 8081 port.\n await getFreePortAsync(EXPO_GO_METRO_PORT));\n\n return port;\n }\n\n async exportExpoRouterApiRoutesAsync({\n mode,\n outputDir,\n prerenderManifest,\n baseUrl,\n routerRoot,\n }: {\n mode: 'development' | 'production';\n outputDir: string;\n // This does not contain the API routes info.\n prerenderManifest: ExpoRouterServerManifestV1;\n baseUrl: string;\n routerRoot: string;\n }): Promise<{ files: ExportAssetMap; manifest: ExpoRouterServerManifestV1<string> }> {\n const appDir = path.join(this.projectRoot, routerRoot);\n const manifest = await this.getExpoRouterRoutesManifestAsync({ appDir });\n\n const files: ExportAssetMap = new Map();\n\n for (const route of manifest.apiRoutes) {\n const filepath = path.join(appDir, route.file);\n const contents = await bundleApiRoute(this.projectRoot, filepath, {\n mode,\n routerRoot,\n port: this.getInstance()?.location.port,\n shouldThrow: true,\n baseUrl,\n });\n const artifactFilename = path.join(\n outputDir,\n path.relative(appDir, filepath.replace(/\\.[tj]sx?$/, '.js'))\n );\n if (contents) {\n files.set(artifactFilename, {\n contents: contents.src,\n targetDomain: 'server',\n });\n }\n // Remap the manifest files to represent the output files.\n route.file = artifactFilename;\n }\n\n return {\n manifest: {\n ...manifest,\n htmlRoutes: prerenderManifest.htmlRoutes,\n },\n files,\n };\n }\n\n async getExpoRouterRoutesManifestAsync({ appDir }: { appDir: string }) {\n // getBuiltTimeServerManifest\n const manifest = await fetchManifest(this.projectRoot, {\n asJson: true,\n appDir,\n });\n\n if (!manifest) {\n throw new CommandError(\n 'EXPO_ROUTER_SERVER_MANIFEST',\n 'Unexpected error: server manifest could not be fetched.'\n );\n }\n\n return manifest;\n }\n\n async getStaticRenderFunctionAsync({\n mode,\n minify = mode !== 'development',\n baseUrl,\n routerRoot,\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n baseUrl: string;\n routerRoot: string;\n }): Promise<{\n serverManifest: ExpoRouterServerManifestV1;\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (path: string) => Promise<string>;\n }> {\n const url = this.getDevServerUrl()!;\n\n const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } =\n await getStaticRenderFunctions(this.projectRoot, url, {\n minify,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n baseUrl,\n routerRoot,\n });\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync(),\n // Get routes from Expo Router.\n manifest: await getManifest({ fetchData: true, preserveApiRoutes: false }),\n // Get route generating function\n async renderAsync(path: string) {\n return await getStaticContent(new URL(path, url));\n },\n };\n }\n\n async getStaticResourcesAsync({\n mode,\n minify = mode !== 'development',\n includeSourceMaps,\n baseUrl,\n mainModuleName,\n isExporting,\n asyncRoutes,\n routerRoot,\n }: {\n isExporting: boolean;\n mode: string;\n minify?: boolean;\n includeSourceMaps?: boolean;\n baseUrl?: string;\n mainModuleName?: string;\n asyncRoutes: boolean;\n routerRoot: string;\n }): Promise<{ artifacts: SerialAsset[]; assets?: AssetData[] }> {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n minify,\n environment: 'client',\n serializerOutput: 'static',\n serializerIncludeMaps: includeSourceMaps,\n mainModuleName:\n mainModuleName ?? resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n asyncRoutes,\n baseUrl,\n isExporting,\n routerRoot,\n });\n\n const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl()!);\n\n // Fetch the generated HTML from our custom Metro serializer\n const results = await fetch(bundleUrl.toString());\n\n const txt = await results.text();\n\n let data: any;\n try {\n data = JSON.parse(txt);\n } catch (error: any) {\n debug(txt);\n\n // Metro can throw this error when the initial module id cannot be resolved.\n if (!results.ok && txt.startsWith('<!DOCTYPE html>')) {\n throw new ForwardHtmlError(\n `Metro failed to bundle the project. Check the console for more information.`,\n txt,\n results.status\n );\n }\n\n Log.error(\n 'Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.'\n );\n throw error;\n }\n\n // NOTE: This could potentially need more validation in the future.\n if ('artifacts' in data && Array.isArray(data.artifacts)) {\n return data;\n }\n\n if (data != null && (data.errors || data.type?.match(/.*Error$/))) {\n // {\n // type: 'InternalError',\n // errors: [],\n // message: 'Metro has encountered an error: While trying to resolve module `stylis` from file `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js`, the package `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs`. Indeed, none of these files exist:\\n' +\n // '\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs/index(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css): /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/metro/src/node-haste/DependencyGraph.js (289:17)\\n' +\n // '\\n' +\n // '\\x1B[0m \\x1B[90m 287 |\\x1B[39m }\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 288 |\\x1B[39m \\x1B[36mif\\x1B[39m (error \\x1B[36minstanceof\\x1B[39m \\x1B[33mInvalidPackageError\\x1B[39m) {\\x1B[0m\\n' +\n // '\\x1B[0m\\x1B[31m\\x1B[1m>\\x1B[22m\\x1B[39m\\x1B[90m 289 |\\x1B[39m \\x1B[36mthrow\\x1B[39m \\x1B[36mnew\\x1B[39m \\x1B[33mPackageResolutionError\\x1B[39m({\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m |\\x1B[39m \\x1B[31m\\x1B[1m^\\x1B[22m\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 290 |\\x1B[39m packageError\\x1B[33m:\\x1B[39m error\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 291 |\\x1B[39m originModulePath\\x1B[33m:\\x1B[39m \\x1B[36mfrom\\x1B[39m\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 292 |\\x1B[39m targetModuleName\\x1B[33m:\\x1B[39m to\\x1B[33m,\\x1B[39m\\x1B[0m'\n // }\n // The Metro logger already showed this error.\n throw new Error(data.message);\n }\n\n throw new Error(\n 'Invalid resources returned from the Metro serializer. Expected array, found: ' + data\n );\n }\n\n private async getStaticPageAsync(\n pathname: string,\n {\n mode,\n minify = mode !== 'development',\n baseUrl,\n routerRoot,\n isExporting,\n asyncRoutes,\n }: {\n isExporting: boolean;\n mode: 'development' | 'production';\n minify?: boolean;\n baseUrl: string;\n asyncRoutes: boolean;\n routerRoot: string;\n }\n ) {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n environment: 'client',\n mainModuleName: resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n baseUrl,\n isExporting,\n asyncRoutes,\n routerRoot,\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await getStaticRenderFunctions(\n this.projectRoot,\n this.getDevServerUrl()!,\n {\n minify: false,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n baseUrl,\n routerRoot,\n }\n );\n\n const location = new URL(pathname, this.getDevServerUrl()!);\n return await getStaticContent(location);\n };\n\n const [{ artifacts: resources }, staticHtml] = await Promise.all([\n this.getStaticResourcesAsync({ isExporting, mode, minify, baseUrl, asyncRoutes, routerRoot }),\n bundleStaticHtml(),\n ]);\n const content = serializeHtmlWithAssets({\n mode,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n baseUrl,\n });\n return {\n content,\n resources,\n };\n }\n\n async watchEnvironmentVariables() {\n if (!this.instance) {\n throw new Error(\n 'Cannot observe environment variable changes without a running Metro instance.'\n );\n }\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process.\n debug('Skipping Environment Variable observation because Metro is not running (headless).');\n return;\n }\n\n const envFiles = runtimeEnv\n .getFiles(process.env.NODE_ENV)\n .map((fileName) => path.join(this.projectRoot, fileName));\n\n observeFileChanges(\n {\n metro: this.metro,\n server: this.instance.server,\n },\n envFiles,\n () => {\n debug('Reloading environment variables...');\n // Force reload the environment variables.\n runtimeEnv.load(this.projectRoot, { force: true });\n }\n );\n }\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n options.port = await this.resolvePortAsync(options);\n this.urlCreator = this.getUrlCreator(options);\n\n const parsedOptions = {\n port: options.port,\n maxWorkers: options.maxWorkers,\n resetCache: options.resetDevServer,\n };\n\n // Required for symbolication:\n process.env.EXPO_DEV_SERVER_ORIGIN = `http://localhost:${options.port}`;\n\n const { metro, server, middleware, messageSocket } = await instantiateMetroAsync(\n this,\n parsedOptions,\n {\n isExporting: !!options.isExporting,\n }\n );\n\n const manifestMiddleware = await this.getManifestMiddlewareAsync(options);\n\n // Important that we noop source maps for context modules as soon as possible.\n prependMiddleware(middleware, new ContextModuleSourceMapsMiddleware().getHandler());\n\n // We need the manifest handler to be the first middleware to run so our\n // routes take precedence over static files. For example, the manifest is\n // served from '/' and if the user has an index.html file in their project\n // then the manifest handler will never run, the static middleware will run\n // and serve index.html instead of the manifest.\n // https://github.com/expo/expo/issues/13114\n prependMiddleware(middleware, manifestMiddleware.getHandler());\n\n middleware.use(\n new InterstitialPageMiddleware(this.projectRoot, {\n // TODO: Prevent this from becoming stale.\n scheme: options.location.scheme ?? null,\n }).getHandler()\n );\n middleware.use(new ReactDevToolsPageMiddleware(this.projectRoot).getHandler());\n middleware.use(\n new DevToolsPluginMiddleware(this.projectRoot, this.devToolsPluginManager).getHandler()\n );\n\n const deepLinkMiddleware = new RuntimeRedirectMiddleware(this.projectRoot, {\n onDeepLink: getDeepLinkHandler(this.projectRoot),\n getLocation: ({ runtime }) => {\n if (runtime === 'custom') {\n return this.urlCreator?.constructDevClientUrl();\n } else {\n return this.urlCreator?.constructUrl({\n scheme: 'exp',\n });\n }\n },\n });\n middleware.use(deepLinkMiddleware.getHandler());\n\n middleware.use(new CreateFileMiddleware(this.projectRoot).getHandler());\n\n // Append support for redirecting unhandled requests to the index.html page on web.\n if (this.isTargetingWeb()) {\n const config = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const { exp } = config;\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\n // This MUST be after the manifest middleware so it doesn't have a chance to serve the template `public/index.html`.\n middleware.use(new ServeStaticMiddleware(this.projectRoot).getHandler());\n\n // This should come after the static middleware so it doesn't serve the favicon from `public/favicon.ico`.\n middleware.use(new FaviconMiddleware(this.projectRoot).getHandler());\n\n if (useServerRendering) {\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n const asyncRoutes = getAsyncRoutesFromExpoConfig(exp, options.mode ?? 'development', 'web');\n const routerRoot = getRouterDirectoryModuleIdWithManifest(this.projectRoot, exp);\n const appDir = path.join(this.projectRoot, routerRoot);\n middleware.use(\n createRouteHandlerMiddleware(this.projectRoot, {\n ...options,\n appDir,\n baseUrl,\n routerRoot,\n config,\n getWebBundleUrl: manifestMiddleware.getWebBundleUrl.bind(manifestMiddleware),\n getStaticPageAsync: (pathname) => {\n return this.getStaticPageAsync(pathname, {\n isExporting: !!options.isExporting,\n mode: options.mode ?? 'development',\n minify: options.minify,\n baseUrl,\n asyncRoutes,\n routerRoot,\n });\n },\n })\n );\n\n observeAnyFileChanges(\n {\n metro,\n server,\n },\n (events) => {\n if (exp.web?.output === 'server') {\n // NOTE(EvanBacon): We aren't sure what files the API routes are using so we'll just invalidate\n // aggressively to ensure we always have the latest. The only caching we really get here is for\n // cases where the user is making subsequent requests to the same API route without changing anything.\n // This is useful for testing but pretty suboptimal. Luckily our caching is pretty aggressive so it makes\n // up for a lot of the overhead.\n invalidateApiRouteCache();\n } else if (!hasWarnedAboutApiRoutes()) {\n for (const event of events) {\n if (\n // If the user did not delete a file that matches the Expo Router API Route convention, then we should warn that\n // API Routes are not enabled in the project.\n event.metadata?.type !== 'd' &&\n // Ensure the file is in the project's routes directory to prevent false positives in monorepos.\n event.filePath.startsWith(appDir) &&\n isApiRouteConvention(event.filePath)\n ) {\n warnInvalidWebOutput();\n }\n }\n }\n }\n );\n } else {\n // This MUST run last since it's the fallback.\n middleware.use(\n new HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler()\n );\n }\n }\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n this.metro = null;\n callback?.(err);\n });\n };\n\n this.metro = metro;\n return {\n server,\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware,\n messageSocket,\n };\n }\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n if (!this.instance) {\n throw new Error('Cannot wait for TypeScript without a running server.');\n }\n\n return new Promise<boolean>((resolve) => {\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process. In this case we can't wait for the TypeScript check to complete because we don't\n // have access to the Metro server.\n debug('Skipping TypeScript check because Metro is not running (headless).');\n return resolve(false);\n }\n\n const off = metroWatchTypeScriptFiles({\n projectRoot: this.projectRoot,\n server: this.instance!.server,\n metro: this.metro,\n tsconfig: true,\n throttle: true,\n eventTypes: ['change', 'add'],\n callback: async () => {\n // Run once, this prevents the TypeScript project prerequisite from running on every file change.\n off();\n const { TypeScriptProjectPrerequisite } = await import(\n '../../doctor/typescript/TypeScriptProjectPrerequisite.js'\n );\n\n try {\n const req = new TypeScriptProjectPrerequisite(this.projectRoot);\n await req.bootstrapAsync();\n resolve(true);\n } catch (error: any) {\n // Ensure the process doesn't fail if the TypeScript check fails.\n // This could happen during the install.\n Log.log();\n Log.error(\n chalk.red`Failed to automatically setup TypeScript for your project. Try restarting the dev server to fix.`\n );\n Log.exception(error);\n resolve(false);\n }\n },\n });\n });\n }\n\n public async startTypeScriptServices() {\n return startTypescriptTypeGenerationAsync({\n server: this.instance?.server,\n metro: this.metro,\n projectRoot: this.projectRoot,\n });\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./metro.config.js', './metro.config.json', './rn-cli.config.js'];\n }\n}\n\nexport function getDeepLinkHandler(projectRoot: string): DeepLinkHandler {\n return async ({ runtime }) => {\n if (runtime === 'expo') return;\n const { exp } = getConfig(projectRoot);\n await logEventAsync('dev client start command', {\n status: 'started',\n ...getDevClientProperties(projectRoot, exp),\n });\n };\n}\n"],"names":["getDeepLinkHandler","runtimeEnv","ForwardHtmlError","CommandError","constructor","message","html","statusCode","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","MetroBundlerDevServer","BundlerDevServer","metro","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","exportExpoRouterApiRoutesAsync","mode","outputDir","prerenderManifest","baseUrl","routerRoot","appDir","path","join","projectRoot","manifest","getExpoRouterRoutesManifestAsync","files","Map","route","apiRoutes","filepath","file","contents","bundleApiRoute","getInstance","location","shouldThrow","artifactFilename","relative","replace","set","src","targetDomain","htmlRoutes","fetchManifest","asJson","getStaticRenderFunctionAsync","minify","url","getDevServerUrl","getStaticContent","getManifest","getBuildTimeServerManifestAsync","getStaticRenderFunctions","dev","environment","serverManifest","fetchData","preserveApiRoutes","renderAsync","URL","getStaticResourcesAsync","includeSourceMaps","mainModuleName","isExporting","asyncRoutes","data","devBundleUrlPathname","createBundleUrlPath","platform","serializerOutput","serializerIncludeMaps","resolveMainModuleName","lazy","shouldEnableAsyncImports","bundleUrl","results","fetch","toString","txt","text","JSON","parse","error","ok","startsWith","status","Log","Array","isArray","artifacts","errors","type","match","Error","getStaticPageAsync","pathname","bundleStaticHtml","resources","staticHtml","Promise","all","content","serializeHtmlWithAssets","template","devBundleUrl","watchEnvironmentVariables","instance","envFiles","getFiles","NODE_ENV","map","fileName","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","parsedOptions","maxWorkers","resetCache","resetDevServer","EXPO_DEV_SERVER_ORIGIN","middleware","messageSocket","instantiateMetroAsync","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","ReactDevToolsPageMiddleware","DevToolsPluginMiddleware","devToolsPluginManager","deepLinkMiddleware","RuntimeRedirectMiddleware","onDeepLink","getLocation","runtime","constructDevClientUrl","constructUrl","CreateFileMiddleware","isTargetingWeb","exp","config","getConfig","skipSDKVersionRequirement","useServerRendering","includes","web","output","ServeStaticMiddleware","FaviconMiddleware","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getRouterDirectoryModuleIdWithManifest","createRouteHandlerMiddleware","getWebBundleUrl","bind","observeAnyFileChanges","events","invalidateApiRouteCache","hasWarnedAboutApiRoutes","event","metadata","filePath","isApiRouteConvention","warnInvalidWebOutput","HistoryFallbackMiddleware","internal","originalClose","close","callback","err","host","protocol","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","req","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","logEventAsync","getDevClientProperties"],"mappings":"AAMA;;;;QAumBgBA,kBAAkB,GAAlBA,kBAAkB;AAvmBR,IAAA,OAAc,WAAd,cAAc,CAAA;AAC5BC,IAAAA,UAAU,mCAAM,WAAW,EAAjB;AAEJ,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEP,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEiC,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AAC9B,IAAA,4BAA+B,WAA/B,+BAA+B,CAAA;AAClB,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AAC3C,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;AAChB,IAAA,0BAA6B,WAA7B,6BAA6B,CAAA;AAMhE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AAC;qBAChB;iBACF;aACF,CAAC,AAAC;SACJ,CAAC,CAAC;KACJ;IAED,MAAaa,uBAAuB,GAAG;YAE3B,GAAa;QADvB,OAAOC,CAAAA,GAAAA,8BAAkC,AAIvC,CAAA,mCAJuC,CAAC;YACxClF,MAAM,EAAE,CAAA,GAAa,GAAb,IAAI,CAACP,QAAQ,SAAQ,GAArB,KAAA,CAAqB,GAArB,GAAa,CAAEO,MAAM;YAC7B/G,KAAK,EAAE,IAAI,CAACA,KAAK;YACjBoB,WAAW,EAAE,IAAI,CAACA,WAAW;SAC9B,CAAC,CAAC;KACJ;IAED,AAAU8K,kBAAkB,GAAa;QACvC,OAAO;YAAC,mBAAmB;YAAE,qBAAqB;YAAE,oBAAoB;SAAC,CAAC;KAC3E;CACF;QA5hBYpM,qBAAqB,GAArBA,qBAAqB;AA8hB3B,SAASZ,kBAAkB,CAACkC,WAAmB,EAAmB;IACvE,OAAO,OAAO,EAAEwH,OAAO,CAAA,EAAE,GAAK;QAC5B,IAAIA,OAAO,KAAK,MAAM,EAAE,OAAO;QAC/B,MAAM,EAAEK,GAAG,CAAA,EAAE,GAAGE,CAAAA,GAAAA,OAAS,AAAa,CAAA,UAAb,CAAC/H,WAAW,CAAC,AAAC;QACvC,MAAM+K,CAAAA,GAAAA,kBAAa,AAGjB,CAAA,cAHiB,CAAC,0BAA0B,EAAE;YAC9ChH,MAAM,EAAE,SAAS;YACjB,GAAGiH,CAAAA,GAAAA,uBAAsB,AAAkB,CAAA,QAAlB,CAAChL,WAAW,EAAE6H,GAAG,CAAC;SAC5C,CAAC,CAAC;KACJ,CAAC;CACH"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/MetroBundlerDevServer.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { getConfig } from '@expo/config';\nimport * as runtimeEnv from '@expo/env';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport { AssetData } from 'metro';\nimport fetch from 'node-fetch';\nimport path from 'path';\n\nimport { bundleApiRoute, invalidateApiRouteCache } from './bundleApiRoutes';\nimport { createRouteHandlerMiddleware } from './createServerRouteMiddleware';\nimport { ExpoRouterServerManifestV1, fetchManifest } from './fetchRouterManifest';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport {\n getRouterDirectoryModuleIdWithManifest,\n hasWarnedAboutApiRoutes,\n isApiRouteConvention,\n warnInvalidWebOutput,\n} from './router';\nimport { serializeHtmlWithAssets } from './serializeHtml';\nimport { observeAnyFileChanges, observeFileChanges } from './waitForMetroToObserveTypeScriptFile';\nimport { ExportAssetMap } from '../../../export/saveAssets';\nimport { Log } from '../../../log';\nimport getDevClientProperties from '../../../utils/analytics/getDevClientProperties';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { CommandError } from '../../../utils/errors';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport { getStaticRenderFunctions } from '../getStaticRenderFunctions';\nimport { ContextModuleSourceMapsMiddleware } from '../middleware/ContextModuleSourceMapsMiddleware';\nimport { CreateFileMiddleware } from '../middleware/CreateFileMiddleware';\nimport { DevToolsPluginMiddleware } from '../middleware/DevToolsPluginMiddleware';\nimport { FaviconMiddleware } from '../middleware/FaviconMiddleware';\nimport { HistoryFallbackMiddleware } from '../middleware/HistoryFallbackMiddleware';\nimport { InterstitialPageMiddleware } from '../middleware/InterstitialPageMiddleware';\nimport { resolveMainModuleName } from '../middleware/ManifestMiddleware';\nimport { ReactDevToolsPageMiddleware } from '../middleware/ReactDevToolsPageMiddleware';\nimport {\n DeepLinkHandler,\n RuntimeRedirectMiddleware,\n} from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport {\n shouldEnableAsyncImports,\n createBundleUrlPath,\n getBaseUrlFromExpoConfig,\n getAsyncRoutesFromExpoConfig,\n} from '../middleware/metroOptions';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { startTypescriptTypeGenerationAsync } from '../type-generation/startTypescriptTypeGeneration';\n\nexport type ExpoRouterRuntimeManifest = Awaited<\n ReturnType<typeof import('expo-router/build/static/renderStaticContent').getManifest>\n>;\n\nexport class ForwardHtmlError extends CommandError {\n constructor(\n message: string,\n public html: string,\n public statusCode: number\n ) {\n super(message);\n }\n}\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\n/** Default port to use for apps running in Expo Go. */\nconst EXPO_GO_METRO_PORT = 8081;\n\n/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */\nconst DEV_CLIENT_METRO_PORT = 8081;\n\nexport class MetroBundlerDevServer extends BundlerDevServer {\n private metro: import('metro').Server | null = null;\n\n get name(): string {\n return 'metro';\n }\n\n async resolvePortAsync(options: Partial<BundlerStartOptions> = {}): Promise<number> {\n const port =\n // If the manually defined port is busy then an error should be thrown...\n options.port ??\n // Otherwise use the default port based on the runtime target.\n (options.devClient\n ? // Don't check if the port is busy if we're using the dev client since most clients are hardcoded to 8081.\n Number(process.env.RCT_METRO_PORT) || DEV_CLIENT_METRO_PORT\n : // Otherwise (running in Expo Go) use a free port that falls back on the classic 8081 port.\n await getFreePortAsync(EXPO_GO_METRO_PORT));\n\n return port;\n }\n\n async exportExpoRouterApiRoutesAsync({\n mode,\n outputDir,\n prerenderManifest,\n baseUrl,\n routerRoot,\n }: {\n mode: 'development' | 'production';\n outputDir: string;\n // This does not contain the API routes info.\n prerenderManifest: ExpoRouterServerManifestV1;\n baseUrl: string;\n routerRoot: string;\n }): Promise<{ files: ExportAssetMap; manifest: ExpoRouterServerManifestV1<string> }> {\n const appDir = path.join(this.projectRoot, routerRoot);\n const manifest = await this.getExpoRouterRoutesManifestAsync({ appDir });\n\n const files: ExportAssetMap = new Map();\n\n for (const route of manifest.apiRoutes) {\n const filepath = path.join(appDir, route.file);\n const contents = await bundleApiRoute(this.projectRoot, filepath, {\n mode,\n routerRoot,\n port: this.getInstance()?.location.port,\n shouldThrow: true,\n baseUrl,\n });\n const artifactFilename = path.join(\n outputDir,\n path.relative(appDir, filepath.replace(/\\.[tj]sx?$/, '.js'))\n );\n if (contents) {\n files.set(artifactFilename, {\n contents: contents.src,\n targetDomain: 'server',\n });\n }\n // Remap the manifest files to represent the output files.\n route.file = artifactFilename;\n }\n\n return {\n manifest: {\n ...manifest,\n htmlRoutes: prerenderManifest.htmlRoutes,\n },\n files,\n };\n }\n\n async getExpoRouterRoutesManifestAsync({ appDir }: { appDir: string }) {\n // getBuiltTimeServerManifest\n const manifest = await fetchManifest(this.projectRoot, {\n asJson: true,\n appDir,\n });\n\n if (!manifest) {\n throw new CommandError(\n 'EXPO_ROUTER_SERVER_MANIFEST',\n 'Unexpected error: server manifest could not be fetched.'\n );\n }\n\n return manifest;\n }\n\n async getStaticRenderFunctionAsync({\n mode,\n minify = mode !== 'development',\n baseUrl,\n routerRoot,\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n baseUrl: string;\n routerRoot: string;\n }): Promise<{\n serverManifest: ExpoRouterServerManifestV1;\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (path: string) => Promise<string>;\n }> {\n const url = this.getDevServerUrl()!;\n\n const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } =\n await getStaticRenderFunctions(this.projectRoot, url, {\n minify,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n baseUrl,\n routerRoot,\n });\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync(),\n // Get routes from Expo Router.\n manifest: await getManifest({ fetchData: true, preserveApiRoutes: false }),\n // Get route generating function\n async renderAsync(path: string) {\n return await getStaticContent(new URL(path, url));\n },\n };\n }\n\n async getStaticResourcesAsync({\n mode,\n minify = mode !== 'development',\n includeSourceMaps,\n baseUrl,\n mainModuleName,\n isExporting,\n asyncRoutes,\n routerRoot,\n }: {\n isExporting: boolean;\n mode: string;\n minify?: boolean;\n includeSourceMaps?: boolean;\n baseUrl?: string;\n mainModuleName?: string;\n asyncRoutes: boolean;\n routerRoot: string;\n }): Promise<{ artifacts: SerialAsset[]; assets?: AssetData[] }> {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n minify,\n environment: 'client',\n serializerOutput: 'static',\n serializerIncludeMaps: includeSourceMaps,\n mainModuleName:\n mainModuleName ?? resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n asyncRoutes,\n baseUrl,\n isExporting,\n routerRoot,\n bytecode: false,\n });\n\n const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl()!);\n\n // Fetch the generated HTML from our custom Metro serializer\n const results = await fetch(bundleUrl.toString());\n\n const txt = await results.text();\n\n let data: any;\n try {\n data = JSON.parse(txt);\n } catch (error: any) {\n debug(txt);\n\n // Metro can throw this error when the initial module id cannot be resolved.\n if (!results.ok && txt.startsWith('<!DOCTYPE html>')) {\n throw new ForwardHtmlError(\n `Metro failed to bundle the project. Check the console for more information.`,\n txt,\n results.status\n );\n }\n\n Log.error(\n 'Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.'\n );\n throw error;\n }\n\n // NOTE: This could potentially need more validation in the future.\n if ('artifacts' in data && Array.isArray(data.artifacts)) {\n return data;\n }\n\n if (data != null && (data.errors || data.type?.match(/.*Error$/))) {\n // {\n // type: 'InternalError',\n // errors: [],\n // message: 'Metro has encountered an error: While trying to resolve module `stylis` from file `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js`, the package `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs`. Indeed, none of these files exist:\\n' +\n // '\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs/index(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css): /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/metro/src/node-haste/DependencyGraph.js (289:17)\\n' +\n // '\\n' +\n // '\\x1B[0m \\x1B[90m 287 |\\x1B[39m }\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 288 |\\x1B[39m \\x1B[36mif\\x1B[39m (error \\x1B[36minstanceof\\x1B[39m \\x1B[33mInvalidPackageError\\x1B[39m) {\\x1B[0m\\n' +\n // '\\x1B[0m\\x1B[31m\\x1B[1m>\\x1B[22m\\x1B[39m\\x1B[90m 289 |\\x1B[39m \\x1B[36mthrow\\x1B[39m \\x1B[36mnew\\x1B[39m \\x1B[33mPackageResolutionError\\x1B[39m({\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m |\\x1B[39m \\x1B[31m\\x1B[1m^\\x1B[22m\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 290 |\\x1B[39m packageError\\x1B[33m:\\x1B[39m error\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 291 |\\x1B[39m originModulePath\\x1B[33m:\\x1B[39m \\x1B[36mfrom\\x1B[39m\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 292 |\\x1B[39m targetModuleName\\x1B[33m:\\x1B[39m to\\x1B[33m,\\x1B[39m\\x1B[0m'\n // }\n // The Metro logger already showed this error.\n throw new Error(data.message);\n }\n\n throw new Error(\n 'Invalid resources returned from the Metro serializer. Expected array, found: ' + data\n );\n }\n\n private async getStaticPageAsync(\n pathname: string,\n {\n mode,\n minify = mode !== 'development',\n baseUrl,\n routerRoot,\n isExporting,\n asyncRoutes,\n }: {\n isExporting: boolean;\n mode: 'development' | 'production';\n minify?: boolean;\n baseUrl: string;\n asyncRoutes: boolean;\n routerRoot: string;\n }\n ) {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n environment: 'client',\n mainModuleName: resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n baseUrl,\n isExporting,\n asyncRoutes,\n routerRoot,\n bytecode: false,\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await getStaticRenderFunctions(\n this.projectRoot,\n this.getDevServerUrl()!,\n {\n minify: false,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n baseUrl,\n routerRoot,\n }\n );\n\n const location = new URL(pathname, this.getDevServerUrl()!);\n return await getStaticContent(location);\n };\n\n const [{ artifacts: resources }, staticHtml] = await Promise.all([\n this.getStaticResourcesAsync({ isExporting, mode, minify, baseUrl, asyncRoutes, routerRoot }),\n bundleStaticHtml(),\n ]);\n const content = serializeHtmlWithAssets({\n mode,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n baseUrl,\n });\n return {\n content,\n resources,\n };\n }\n\n async watchEnvironmentVariables() {\n if (!this.instance) {\n throw new Error(\n 'Cannot observe environment variable changes without a running Metro instance.'\n );\n }\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process.\n debug('Skipping Environment Variable observation because Metro is not running (headless).');\n return;\n }\n\n const envFiles = runtimeEnv\n .getFiles(process.env.NODE_ENV)\n .map((fileName) => path.join(this.projectRoot, fileName));\n\n observeFileChanges(\n {\n metro: this.metro,\n server: this.instance.server,\n },\n envFiles,\n () => {\n debug('Reloading environment variables...');\n // Force reload the environment variables.\n runtimeEnv.load(this.projectRoot, { force: true });\n }\n );\n }\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n options.port = await this.resolvePortAsync(options);\n this.urlCreator = this.getUrlCreator(options);\n\n const parsedOptions = {\n port: options.port,\n maxWorkers: options.maxWorkers,\n resetCache: options.resetDevServer,\n };\n\n // Required for symbolication:\n process.env.EXPO_DEV_SERVER_ORIGIN = `http://localhost:${options.port}`;\n\n const { metro, server, middleware, messageSocket } = await instantiateMetroAsync(\n this,\n parsedOptions,\n {\n isExporting: !!options.isExporting,\n }\n );\n\n const manifestMiddleware = await this.getManifestMiddlewareAsync(options);\n\n // Important that we noop source maps for context modules as soon as possible.\n prependMiddleware(middleware, new ContextModuleSourceMapsMiddleware().getHandler());\n\n // We need the manifest handler to be the first middleware to run so our\n // routes take precedence over static files. For example, the manifest is\n // served from '/' and if the user has an index.html file in their project\n // then the manifest handler will never run, the static middleware will run\n // and serve index.html instead of the manifest.\n // https://github.com/expo/expo/issues/13114\n prependMiddleware(middleware, manifestMiddleware.getHandler());\n\n middleware.use(\n new InterstitialPageMiddleware(this.projectRoot, {\n // TODO: Prevent this from becoming stale.\n scheme: options.location.scheme ?? null,\n }).getHandler()\n );\n middleware.use(new ReactDevToolsPageMiddleware(this.projectRoot).getHandler());\n middleware.use(\n new DevToolsPluginMiddleware(this.projectRoot, this.devToolsPluginManager).getHandler()\n );\n\n const deepLinkMiddleware = new RuntimeRedirectMiddleware(this.projectRoot, {\n onDeepLink: getDeepLinkHandler(this.projectRoot),\n getLocation: ({ runtime }) => {\n if (runtime === 'custom') {\n return this.urlCreator?.constructDevClientUrl();\n } else {\n return this.urlCreator?.constructUrl({\n scheme: 'exp',\n });\n }\n },\n });\n middleware.use(deepLinkMiddleware.getHandler());\n\n middleware.use(new CreateFileMiddleware(this.projectRoot).getHandler());\n\n // Append support for redirecting unhandled requests to the index.html page on web.\n if (this.isTargetingWeb()) {\n const config = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const { exp } = config;\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\n // This MUST be after the manifest middleware so it doesn't have a chance to serve the template `public/index.html`.\n middleware.use(new ServeStaticMiddleware(this.projectRoot).getHandler());\n\n // This should come after the static middleware so it doesn't serve the favicon from `public/favicon.ico`.\n middleware.use(new FaviconMiddleware(this.projectRoot).getHandler());\n\n if (useServerRendering) {\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n const asyncRoutes = getAsyncRoutesFromExpoConfig(exp, options.mode ?? 'development', 'web');\n const routerRoot = getRouterDirectoryModuleIdWithManifest(this.projectRoot, exp);\n const appDir = path.join(this.projectRoot, routerRoot);\n middleware.use(\n createRouteHandlerMiddleware(this.projectRoot, {\n ...options,\n appDir,\n baseUrl,\n routerRoot,\n config,\n getWebBundleUrl: manifestMiddleware.getWebBundleUrl.bind(manifestMiddleware),\n getStaticPageAsync: (pathname) => {\n return this.getStaticPageAsync(pathname, {\n isExporting: !!options.isExporting,\n mode: options.mode ?? 'development',\n minify: options.minify,\n baseUrl,\n asyncRoutes,\n routerRoot,\n });\n },\n })\n );\n\n observeAnyFileChanges(\n {\n metro,\n server,\n },\n (events) => {\n if (exp.web?.output === 'server') {\n // NOTE(EvanBacon): We aren't sure what files the API routes are using so we'll just invalidate\n // aggressively to ensure we always have the latest. The only caching we really get here is for\n // cases where the user is making subsequent requests to the same API route without changing anything.\n // This is useful for testing but pretty suboptimal. Luckily our caching is pretty aggressive so it makes\n // up for a lot of the overhead.\n invalidateApiRouteCache();\n } else if (!hasWarnedAboutApiRoutes()) {\n for (const event of events) {\n if (\n // If the user did not delete a file that matches the Expo Router API Route convention, then we should warn that\n // API Routes are not enabled in the project.\n event.metadata?.type !== 'd' &&\n // Ensure the file is in the project's routes directory to prevent false positives in monorepos.\n event.filePath.startsWith(appDir) &&\n isApiRouteConvention(event.filePath)\n ) {\n warnInvalidWebOutput();\n }\n }\n }\n }\n );\n } else {\n // This MUST run last since it's the fallback.\n middleware.use(\n new HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler()\n );\n }\n }\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n this.metro = null;\n callback?.(err);\n });\n };\n\n this.metro = metro;\n return {\n server,\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware,\n messageSocket,\n };\n }\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n if (!this.instance) {\n throw new Error('Cannot wait for TypeScript without a running server.');\n }\n\n return new Promise<boolean>((resolve) => {\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process. In this case we can't wait for the TypeScript check to complete because we don't\n // have access to the Metro server.\n debug('Skipping TypeScript check because Metro is not running (headless).');\n return resolve(false);\n }\n\n const off = metroWatchTypeScriptFiles({\n projectRoot: this.projectRoot,\n server: this.instance!.server,\n metro: this.metro,\n tsconfig: true,\n throttle: true,\n eventTypes: ['change', 'add'],\n callback: async () => {\n // Run once, this prevents the TypeScript project prerequisite from running on every file change.\n off();\n const { TypeScriptProjectPrerequisite } = await import(\n '../../doctor/typescript/TypeScriptProjectPrerequisite.js'\n );\n\n try {\n const req = new TypeScriptProjectPrerequisite(this.projectRoot);\n await req.bootstrapAsync();\n resolve(true);\n } catch (error: any) {\n // Ensure the process doesn't fail if the TypeScript check fails.\n // This could happen during the install.\n Log.log();\n Log.error(\n chalk.red`Failed to automatically setup TypeScript for your project. Try restarting the dev server to fix.`\n );\n Log.exception(error);\n resolve(false);\n }\n },\n });\n });\n }\n\n public async startTypeScriptServices() {\n return startTypescriptTypeGenerationAsync({\n server: this.instance?.server,\n metro: this.metro,\n projectRoot: this.projectRoot,\n });\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./metro.config.js', './metro.config.json', './rn-cli.config.js'];\n }\n}\n\nexport function getDeepLinkHandler(projectRoot: string): DeepLinkHandler {\n return async ({ runtime }) => {\n if (runtime === 'expo') return;\n const { exp } = getConfig(projectRoot);\n await logEventAsync('dev client start command', {\n status: 'started',\n ...getDevClientProperties(projectRoot, exp),\n });\n };\n}\n"],"names":["getDeepLinkHandler","runtimeEnv","ForwardHtmlError","CommandError","constructor","message","html","statusCode","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","MetroBundlerDevServer","BundlerDevServer","metro","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","exportExpoRouterApiRoutesAsync","mode","outputDir","prerenderManifest","baseUrl","routerRoot","appDir","path","join","projectRoot","manifest","getExpoRouterRoutesManifestAsync","files","Map","route","apiRoutes","filepath","file","contents","bundleApiRoute","getInstance","location","shouldThrow","artifactFilename","relative","replace","set","src","targetDomain","htmlRoutes","fetchManifest","asJson","getStaticRenderFunctionAsync","minify","url","getDevServerUrl","getStaticContent","getManifest","getBuildTimeServerManifestAsync","getStaticRenderFunctions","dev","environment","serverManifest","fetchData","preserveApiRoutes","renderAsync","URL","getStaticResourcesAsync","includeSourceMaps","mainModuleName","isExporting","asyncRoutes","data","devBundleUrlPathname","createBundleUrlPath","platform","serializerOutput","serializerIncludeMaps","resolveMainModuleName","lazy","shouldEnableAsyncImports","bytecode","bundleUrl","results","fetch","toString","txt","text","JSON","parse","error","ok","startsWith","status","Log","Array","isArray","artifacts","errors","type","match","Error","getStaticPageAsync","pathname","bundleStaticHtml","resources","staticHtml","Promise","all","content","serializeHtmlWithAssets","template","devBundleUrl","watchEnvironmentVariables","instance","envFiles","getFiles","NODE_ENV","map","fileName","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","parsedOptions","maxWorkers","resetCache","resetDevServer","EXPO_DEV_SERVER_ORIGIN","middleware","messageSocket","instantiateMetroAsync","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","ReactDevToolsPageMiddleware","DevToolsPluginMiddleware","devToolsPluginManager","deepLinkMiddleware","RuntimeRedirectMiddleware","onDeepLink","getLocation","runtime","constructDevClientUrl","constructUrl","CreateFileMiddleware","isTargetingWeb","exp","config","getConfig","skipSDKVersionRequirement","useServerRendering","includes","web","output","ServeStaticMiddleware","FaviconMiddleware","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getRouterDirectoryModuleIdWithManifest","createRouteHandlerMiddleware","getWebBundleUrl","bind","observeAnyFileChanges","events","invalidateApiRouteCache","hasWarnedAboutApiRoutes","event","metadata","filePath","isApiRouteConvention","warnInvalidWebOutput","HistoryFallbackMiddleware","internal","originalClose","close","callback","err","host","protocol","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","req","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","logEventAsync","getDevClientProperties"],"mappings":"AAMA;;;;QAymBgBA,kBAAkB,GAAlBA,kBAAkB;AAzmBR,IAAA,OAAc,WAAd,cAAc,CAAA;AAC5BC,IAAAA,UAAU,mCAAM,WAAW,EAAjB;AAEJ,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEP,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEiC,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AAC9B,IAAA,4BAA+B,WAA/B,+BAA+B,CAAA;AAClB,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AAC3C,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;AAChB,IAAA,0BAA6B,WAA7B,6BAA6B,CAAA;AAMhE,IAAA,OAAU,WAAV,UAAU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G,OAAO,CAAC,KAAK,CAAC,CAAC;qBAChB;iBACF;aACF,CAAC,AAAC;SACJ,CAAC,CAAC;KACJ;IAED,MAAaa,uBAAuB,GAAG;YAE3B,GAAa;QADvB,OAAOC,CAAAA,GAAAA,8BAAkC,AAIvC,CAAA,mCAJuC,CAAC;YACxClF,MAAM,EAAE,CAAA,GAAa,GAAb,IAAI,CAACP,QAAQ,SAAQ,GAArB,KAAA,CAAqB,GAArB,GAAa,CAAEO,MAAM;YAC7BhH,KAAK,EAAE,IAAI,CAACA,KAAK;YACjBoB,WAAW,EAAE,IAAI,CAACA,WAAW;SAC9B,CAAC,CAAC;KACJ;IAED,AAAU+K,kBAAkB,GAAa;QACvC,OAAO;YAAC,mBAAmB;YAAE,qBAAqB;YAAE,oBAAoB;SAAC,CAAC;KAC3E;CACF;QA9hBYrM,qBAAqB,GAArBA,qBAAqB;AAgiB3B,SAASZ,kBAAkB,CAACkC,WAAmB,EAAmB;IACvE,OAAO,OAAO,EAAEyH,OAAO,CAAA,EAAE,GAAK;QAC5B,IAAIA,OAAO,KAAK,MAAM,EAAE,OAAO;QAC/B,MAAM,EAAEK,GAAG,CAAA,EAAE,GAAGE,CAAAA,GAAAA,OAAS,AAAa,CAAA,UAAb,CAAChI,WAAW,CAAC,AAAC;QACvC,MAAMgL,CAAAA,GAAAA,kBAAa,AAGjB,CAAA,cAHiB,CAAC,0BAA0B,EAAE;YAC9ChH,MAAM,EAAE,SAAS;YACjB,GAAGiH,CAAAA,GAAAA,uBAAsB,AAAkB,CAAA,QAAlB,CAACjL,WAAW,EAAE8H,GAAG,CAAC;SAC5C,CAAC,CAAC;KACJ,CAAC;CACH"}
|
|
@@ -37,11 +37,11 @@ class MetroTerminalReporter extends _terminalReporter.TerminalReporter {
|
|
|
37
37
|
const inProgress = phase === "in_progress";
|
|
38
38
|
const localPath = progress.bundleDetails.entryFile.startsWith(_path.default.sep) ? _path.default.relative(this.projectRoot, progress.bundleDetails.entryFile) : progress.bundleDetails.entryFile;
|
|
39
39
|
if (!inProgress) {
|
|
40
|
-
const status = phase === "done" ? `
|
|
40
|
+
const status = phase === "done" ? `Bundled ` : `Bundling failed `;
|
|
41
41
|
const color = phase === "done" ? _chalk.default.green : _chalk.default.red;
|
|
42
42
|
const startTime = this._bundleTimers.get(progress.bundleDetails.buildID);
|
|
43
43
|
const time = startTime != null ? _chalk.default.dim(this._getElapsedTime(startTime) + "ms") : "";
|
|
44
|
-
// iOS
|
|
44
|
+
// iOS Bundled 150ms
|
|
45
45
|
return color(platform + status) + time + _chalk.default.reset.dim(" (" + localPath + ")");
|
|
46
46
|
}
|
|
47
47
|
const filledBar = Math.floor(progress.ratio * MAX_PROGRESS_BAR_CHAR_WIDTH);
|
|
@@ -161,7 +161,7 @@ function stripMetroInfo(errorMessage) {
|
|
|
161
161
|
// Expo CLI will pass `customTransformOptions.environment = 'node'` when bundling for the server.
|
|
162
162
|
const env = (ref1 = bundleDetails == null ? void 0 : (ref = bundleDetails.customTransformOptions) == null ? void 0 : ref.environment) != null ? ref1 : null;
|
|
163
163
|
if (env === "node") {
|
|
164
|
-
return
|
|
164
|
+
return _chalk.default.bold("\u03BB") + " ";
|
|
165
165
|
}
|
|
166
166
|
return "";
|
|
167
167
|
}
|