@expo/cli 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +10 -3
- package/build/bin/cli.map +1 -1
- package/build/src/api/user/actions.js +1 -1
- package/build/src/api/user/actions.js.map +1 -1
- package/build/src/export/createMetadataJson.js +2 -1
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +50 -3
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/xcodeCompilerLogger.js +97 -0
- package/build/src/export/embed/xcodeCompilerLogger.js.map +1 -0
- package/build/src/export/exportApp.js +90 -103
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +18 -23
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportAsync.js +1 -1
- package/build/src/export/exportAsync.js.map +1 -1
- package/build/src/export/exportHermes.js +0 -90
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +137 -108
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +12 -4
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +74 -49
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +1 -1
- package/build/src/export/metroAssetLocalPath.js.map +1 -1
- package/build/src/export/persistMetroAssets.js +28 -17
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/publicFolder.js +7 -0
- package/build/src/export/publicFolder.js.map +1 -1
- package/build/src/export/saveAssets.js +176 -12
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/writeContents.js +8 -107
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/installAsync.js +29 -10
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +9 -2
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/run/hints.js +4 -0
- package/build/src/run/hints.js.map +1 -1
- package/build/src/run/index.js +101 -0
- package/build/src/run/index.js.map +1 -0
- package/build/src/start/doctor/dependencies/bundledNativeModules.js +2 -2
- package/build/src/start/doctor/dependencies/bundledNativeModules.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +10 -3
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/resolvePackages.js +66 -0
- package/build/src/start/doctor/dependencies/resolvePackages.js.map +1 -0
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +2 -30
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +24 -8
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/server/getStaticRenderFunctions.js +8 -4
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +39 -16
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/MetroTerminalReporter.js +6 -2
- package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/TerminalReporter.js +18 -1
- package/build/src/start/server/metro/TerminalReporter.js.map +1 -1
- package/build/src/start/server/metro/bundleApiRoutes.js +3 -2
- package/build/src/start/server/metro/bundleApiRoutes.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +22 -5
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -1
- package/build/src/start/server/metro/createJResolver.js +5 -2
- package/build/src/start/server/metro/createJResolver.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js +2 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/{inspector-proxy/device.js → debugging/InspectorDevice.js} +8 -38
- package/build/src/start/server/metro/debugging/InspectorDevice.js.map +1 -0
- package/build/src/start/server/metro/debugging/InspectorProxy.js +116 -0
- package/build/src/start/server/metro/debugging/InspectorProxy.js.map +1 -0
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js +45 -0
- package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/NetworkResponse.js +3 -4
- package/build/src/start/server/metro/debugging/inspectorHandlers/NetworkResponse.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/PageReload.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerGetPossibleBreakpoints.js +2 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerScriptParsed.js +3 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerScriptParsed.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeDebuggerSetBreakpointByUrl.js +3 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeDebuggerSetBreakpointByUrl.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeRuntimeCallFunctionOn.js +2 -2
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeCallFunctionOn.js.map +1 -0
- package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/VscodeRuntimeGetProperties.js +5 -4
- package/build/src/start/server/metro/debugging/inspectorHandlers/VscodeRuntimeGetProperties.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/types.js.map +1 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js +20 -0
- package/build/src/start/server/metro/debugging/inspectorHandlers/utils.js.map +1 -0
- package/build/src/start/server/metro/getCssModulesFromBundler.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +8 -5
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +3 -2
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/router.js +1 -5
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +0 -19
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +20 -4
- package/build/src/start/server/metro/serializeHtml.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +48 -85
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +12 -5
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +22 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +62 -9
- package/build/src/start/server/middleware/metroOptions.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/route.test.js +11 -3
- package/build/src/start/server/type-generation/__typetests__/route.test.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +6 -4
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js +1 -1
- package/build/src/start/server/type-generation/startTypescriptTypeGeneration.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/codesigning.js +11 -1
- package/build/src/utils/codesigning.js.map +1 -1
- package/build/src/utils/env.js +7 -1
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/tsconfig/loadTsConfigPaths.js +3 -11
- package/build/src/utils/tsconfig/loadTsConfigPaths.js.map +1 -1
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js +22 -12
- package/build/src/utils/tsconfig/resolveWithTsConfigPaths.js.map +1 -1
- package/package.json +10 -10
- package/static/template/index.html +14 -95
- package/build/src/export/printBundleSizes.js +0 -101
- package/build/src/export/printBundleSizes.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/device.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/NetworkResponse.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/PageReload.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerScriptParsed.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerSetBreakpointByUrl.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeGetProperties.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/types.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/utils.js +0 -11
- package/build/src/start/server/metro/inspector-proxy/handlers/utils.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/index.js +0 -30
- package/build/src/start/server/metro/inspector-proxy/index.js.map +0 -1
- package/build/src/start/server/metro/inspector-proxy/proxy.js +0 -169
- package/build/src/start/server/metro/inspector-proxy/proxy.js.map +0 -1
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js +0 -64
- package/build/src/start/server/middleware/inspector/createJsInspectorMiddleware.js.map +0 -1
- /package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/PageReload.js +0 -0
- /package/build/src/start/server/metro/{inspector-proxy/handlers → debugging/inspectorHandlers}/types.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportHermes.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport spawnAsync from '@expo/spawn-async';\nimport fs from 'fs-extra';\nimport { composeSourceMaps } from 'metro-source-map';\nimport os from 'os';\nimport path from 'path';\nimport process from 'process';\nimport resolveFrom from 'resolve-from';\n\nexport function importHermesCommandFromProject(projectRoot: string): string {\n const platformExecutable = getHermesCommandPlatform();\n const hermescLocations = [\n // Override hermesc dir by environment variables\n process.env['REACT_NATIVE_OVERRIDE_HERMES_DIR']\n ? `${process.env['REACT_NATIVE_OVERRIDE_HERMES_DIR']}/build/bin/hermesc`\n : '',\n\n // Building hermes from source\n 'react-native/ReactAndroid/hermes-engine/build/hermes/bin/hermesc',\n\n // Prebuilt hermesc in official react-native 0.69+\n `react-native/sdks/hermesc/${platformExecutable}`,\n\n // Legacy hermes-engine package\n `hermes-engine/${platformExecutable}`,\n ];\n\n for (const location of hermescLocations) {\n try {\n return resolveFrom(projectRoot, location);\n } catch {}\n }\n throw new Error('Cannot find the hermesc executable.');\n}\n\nfunction getHermesCommandPlatform(): string {\n switch (os.platform()) {\n case 'darwin':\n return 'osx-bin/hermesc';\n case 'linux':\n return 'linux64-bin/hermesc';\n case 'win32':\n return 'win64-bin/hermesc.exe';\n default:\n throw new Error(`Unsupported host platform for Hermes compiler: ${os.platform()}`);\n }\n}\n\nexport function isEnableHermesManaged(\n expoConfig: Partial<Pick<ExpoConfig, 'ios' | 'android' | 'jsEngine'>>,\n platform: string\n): boolean {\n switch (platform) {\n case 'android': {\n return (expoConfig.android?.jsEngine ?? expoConfig.jsEngine) !== 'jsc';\n }\n case 'ios': {\n return (expoConfig.ios?.jsEngine ?? expoConfig.jsEngine) !== 'jsc';\n }\n default:\n return false;\n }\n}\n\ninterface HermesBundleOutput {\n hbc: Uint8Array;\n sourcemap: string | null;\n}\nexport async function buildHermesBundleAsync(\n projectRoot: string,\n {\n code,\n map,\n minify = false,\n }: {\n code: string;\n map: string | null;\n minify?: boolean;\n }\n): Promise<HermesBundleOutput> {\n const tempDir = path.join(os.tmpdir(), `expo-bundler-${process.pid}`);\n await fs.ensureDir(tempDir);\n try {\n const tempBundleFile = path.join(tempDir, 'index.bundle');\n await fs.writeFile(tempBundleFile, code);\n\n if (map) {\n const tempSourcemapFile = path.join(tempDir, 'index.bundle.map');\n await fs.writeFile(tempSourcemapFile, map);\n }\n\n const tempHbcFile = path.join(tempDir, 'index.hbc');\n const hermesCommand = importHermesCommandFromProject(projectRoot);\n const args = ['-emit-binary', '-out', tempHbcFile, tempBundleFile];\n if (minify) {\n args.push('-O');\n }\n if (map) {\n args.push('-output-source-map');\n }\n await spawnAsync(hermesCommand, args);\n\n let hbc: Buffer;\n let sourcemap: string | null = null;\n\n if (!map) {\n hbc = await fs.readFile(tempHbcFile);\n } else {\n [hbc, sourcemap] = await Promise.all([\n fs.readFile(tempHbcFile),\n createHermesSourcemapAsync(projectRoot, map, `${tempHbcFile}.map`),\n ]);\n }\n return {\n hbc,\n sourcemap,\n };\n } finally {\n await fs.remove(tempDir);\n }\n}\n\nexport async function createHermesSourcemapAsync(\n projectRoot: string,\n sourcemap: string,\n hermesMapFile: string\n): Promise<string> {\n const bundlerSourcemap = JSON.parse(sourcemap);\n const hermesSourcemap = await fs.readJSON(hermesMapFile);\n return JSON.stringify(composeSourceMaps([bundlerSourcemap, hermesSourcemap]));\n}\n\nexport function parseGradleProperties(content: string): Record<string, string> {\n const result: Record<string, string> = {};\n for (let line of content.split('\\n')) {\n line = line.trim();\n if (!line || line.startsWith('#')) {\n continue;\n }\n\n const sepIndex = line.indexOf('=');\n const key = line.substr(0, sepIndex);\n const value = line.substr(sepIndex + 1);\n result[key] = value;\n }\n return result;\n}\n\nexport async function maybeThrowFromInconsistentEngineAsync(\n projectRoot: string,\n configFilePath: string,\n platform: string,\n isHermesManaged: boolean\n): Promise<void> {\n const configFileName = path.basename(configFilePath);\n if (\n platform === 'android' &&\n (await maybeInconsistentEngineAndroidAsync(projectRoot, isHermesManaged))\n ) {\n throw new Error(\n `JavaScript engine configuration is inconsistent between ${configFileName} and Android native project.\\n` +\n `In ${configFileName}: Hermes is ${isHermesManaged ? 'enabled' : 'not enabled'}\\n` +\n `In Android native project: Hermes is ${isHermesManaged ? 'not enabled' : 'enabled'}\\n` +\n `Please check the following files for inconsistencies:\\n` +\n ` - ${configFilePath}\\n` +\n ` - ${path.join(projectRoot, 'android', 'gradle.properties')}\\n` +\n ` - ${path.join(projectRoot, 'android', 'app', 'build.gradle')}\\n` +\n 'Learn more: https://expo.fyi/hermes-android-config'\n );\n }\n\n if (platform === 'ios' && (await maybeInconsistentEngineIosAsync(projectRoot, isHermesManaged))) {\n throw new Error(\n `JavaScript engine configuration is inconsistent between ${configFileName} and iOS native project.\\n` +\n `In ${configFileName}: Hermes is ${isHermesManaged ? 'enabled' : 'not enabled'}\\n` +\n `In iOS native project: Hermes is ${isHermesManaged ? 'not enabled' : 'enabled'}\\n` +\n `Please check the following files for inconsistencies:\\n` +\n ` - ${configFilePath}\\n` +\n ` - ${path.join(projectRoot, 'ios', 'Podfile')}\\n` +\n ` - ${path.join(projectRoot, 'ios', 'Podfile.properties.json')}\\n` +\n 'Learn more: https://expo.fyi/hermes-ios-config'\n );\n }\n}\n\nexport async function maybeInconsistentEngineAndroidAsync(\n projectRoot: string,\n isHermesManaged: boolean\n): Promise<boolean> {\n // Trying best to check android native project if by chance to be consistent between app config\n\n // Check gradle.properties from prebuild template\n const gradlePropertiesPath = path.join(projectRoot, 'android', 'gradle.properties');\n if (fs.existsSync(gradlePropertiesPath)) {\n const props = parseGradleProperties(await fs.readFile(gradlePropertiesPath, 'utf8'));\n const isHermesBare = props['hermesEnabled'] === 'true';\n if (isHermesManaged !== isHermesBare) {\n return true;\n }\n }\n\n return false;\n}\n\nexport async function maybeInconsistentEngineIosAsync(\n projectRoot: string,\n isHermesManaged: boolean\n): Promise<boolean> {\n // Trying best to check ios native project if by chance to be consistent between app config\n\n // Check ios/Podfile for \":hermes_enabled => true\"\n const podfilePath = path.join(projectRoot, 'ios', 'Podfile');\n if (fs.existsSync(podfilePath)) {\n const content = await fs.readFile(podfilePath, 'utf8');\n const isPropsReference =\n content.search(\n /^\\s*:hermes_enabled\\s*=>\\s*podfile_properties\\['expo.jsEngine'\\]\\s*==\\s*nil\\s*\\|\\|\\s*podfile_properties\\['expo.jsEngine'\\]\\s*==\\s*'hermes',?/m\n ) >= 0;\n const isHermesBare = content.search(/^\\s*:hermes_enabled\\s*=>\\s*true,?\\s+/m) >= 0;\n if (!isPropsReference && isHermesManaged !== isHermesBare) {\n return true;\n }\n }\n\n // Check Podfile.properties.json from prebuild template\n const podfilePropertiesPath = path.join(projectRoot, 'ios', 'Podfile.properties.json');\n if (fs.existsSync(podfilePropertiesPath)) {\n const props = await parsePodfilePropertiesAsync(podfilePropertiesPath);\n const isHermesBare = props['expo.jsEngine'] === 'hermes';\n if (isHermesManaged !== isHermesBare) {\n return true;\n }\n }\n\n return false;\n}\n\n// https://github.com/facebook/hermes/blob/release-v0.5/include/hermes/BCGen/HBC/BytecodeFileFormat.h#L24-L25\nconst HERMES_MAGIC_HEADER = 'c61fbc03c103191f';\n\nexport async function isHermesBytecodeBundleAsync(file: string): Promise<boolean> {\n const header = await readHermesHeaderAsync(file);\n return header.slice(0, 8).toString('hex') === HERMES_MAGIC_HEADER;\n}\n\nexport async function getHermesBytecodeBundleVersionAsync(file: string): Promise<number> {\n const header = await readHermesHeaderAsync(file);\n if (header.slice(0, 8).toString('hex') !== HERMES_MAGIC_HEADER) {\n throw new Error('Invalid hermes bundle file');\n }\n return header.readUInt32LE(8);\n}\n\nasync function readHermesHeaderAsync(file: string): Promise<Buffer> {\n const fd = await fs.open(file, 'r');\n const buffer = Buffer.alloc(12);\n await fs.read(fd, buffer, 0, 12, null);\n await fs.close(fd);\n return buffer;\n}\n\nasync function parsePodfilePropertiesAsync(\n podfilePropertiesPath: string\n): Promise<Record<string, string>> {\n try {\n return JSON.parse(await fs.readFile(podfilePropertiesPath, 'utf8'));\n } catch {\n return {};\n }\n}\n"],"names":["importHermesCommandFromProject","isEnableHermesManaged","buildHermesBundleAsync","createHermesSourcemapAsync","parseGradleProperties","maybeThrowFromInconsistentEngineAsync","maybeInconsistentEngineAndroidAsync","maybeInconsistentEngineIosAsync","isHermesBytecodeBundleAsync","getHermesBytecodeBundleVersionAsync","projectRoot","platformExecutable","getHermesCommandPlatform","hermescLocations","process","env","location","resolveFrom","Error","os","platform","expoConfig","android","jsEngine","ios","code","map","minify","tempDir","path","join","tmpdir","pid","fs","ensureDir","tempBundleFile","writeFile","tempSourcemapFile","tempHbcFile","hermesCommand","args","push","spawnAsync","hbc","sourcemap","readFile","Promise","all","remove","hermesMapFile","bundlerSourcemap","JSON","parse","hermesSourcemap","readJSON","stringify","composeSourceMaps","content","result","line","split","trim","startsWith","sepIndex","indexOf","key","substr","value","configFilePath","isHermesManaged","configFileName","basename","gradlePropertiesPath","existsSync","props","isHermesBare","podfilePath","isPropsReference","search","podfilePropertiesPath","parsePodfilePropertiesAsync","HERMES_MAGIC_HEADER","file","header","readHermesHeaderAsync","slice","toString","readUInt32LE","fd","open","buffer","Buffer","alloc","read","close"],"mappings":"AAAA;;;;QASgBA,8BAA8B,GAA9BA,8BAA8B;QAuC9BC,qBAAqB,GAArBA,qBAAqB;QAoBfC,sBAAsB,GAAtBA,sBAAsB;QAsDtBC,0BAA0B,GAA1BA,0BAA0B;QAUhCC,qBAAqB,GAArBA,qBAAqB;QAgBfC,qCAAqC,GAArCA,qCAAqC;QAqCrCC,mCAAmC,GAAnCA,mCAAmC;QAmBnCC,+BAA+B,GAA/BA,+BAA+B;QAoC/BC,2BAA2B,GAA3BA,2BAA2B;QAK3BC,mCAAmC,GAAnCA,mCAAmC;AApPlC,IAAA,WAAmB,kCAAnB,mBAAmB,EAAA;AAC3B,IAAA,QAAU,kCAAV,UAAU,EAAA;AACS,IAAA,eAAkB,WAAlB,kBAAkB,CAAA;AACrC,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AACH,IAAA,QAAS,kCAAT,SAAS,EAAA;AACL,IAAA,YAAc,kCAAd,cAAc,EAAA;;;;;;AAE/B,SAAST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QACF,OAAO5B,IAAI,CAACC,KAAK,CAAC,MAAMnB,QAAE,QAAA,CAACY,QAAQ,CAACkC,qBAAqB,EAAE,MAAM,CAAC,CAAC,CAAC;KACrE,CAAC,OAAM;QACN,OAAO,EAAE,CAAC;KACX;CACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportHermes.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nexport function isEnableHermesManaged(\n expoConfig: Partial<Pick<ExpoConfig, 'ios' | 'android' | 'jsEngine'>>,\n platform: string\n): boolean {\n switch (platform) {\n case 'android': {\n return (expoConfig.android?.jsEngine ?? expoConfig.jsEngine) !== 'jsc';\n }\n case 'ios': {\n return (expoConfig.ios?.jsEngine ?? expoConfig.jsEngine) !== 'jsc';\n }\n default:\n return false;\n }\n}\n\nexport function parseGradleProperties(content: string): Record<string, string> {\n const result: Record<string, string> = {};\n for (let line of content.split('\\n')) {\n line = line.trim();\n if (!line || line.startsWith('#')) {\n continue;\n }\n\n const sepIndex = line.indexOf('=');\n const key = line.substr(0, sepIndex);\n const value = line.substr(sepIndex + 1);\n result[key] = value;\n }\n return result;\n}\n\nexport async function maybeThrowFromInconsistentEngineAsync(\n projectRoot: string,\n configFilePath: string,\n platform: string,\n isHermesManaged: boolean\n): Promise<void> {\n const configFileName = path.basename(configFilePath);\n if (\n platform === 'android' &&\n (await maybeInconsistentEngineAndroidAsync(projectRoot, isHermesManaged))\n ) {\n throw new Error(\n `JavaScript engine configuration is inconsistent between ${configFileName} and Android native project.\\n` +\n `In ${configFileName}: Hermes is ${isHermesManaged ? 'enabled' : 'not enabled'}\\n` +\n `In Android native project: Hermes is ${isHermesManaged ? 'not enabled' : 'enabled'}\\n` +\n `Please check the following files for inconsistencies:\\n` +\n ` - ${configFilePath}\\n` +\n ` - ${path.join(projectRoot, 'android', 'gradle.properties')}\\n` +\n ` - ${path.join(projectRoot, 'android', 'app', 'build.gradle')}\\n` +\n 'Learn more: https://expo.fyi/hermes-android-config'\n );\n }\n\n if (platform === 'ios' && (await maybeInconsistentEngineIosAsync(projectRoot, isHermesManaged))) {\n throw new Error(\n `JavaScript engine configuration is inconsistent between ${configFileName} and iOS native project.\\n` +\n `In ${configFileName}: Hermes is ${isHermesManaged ? 'enabled' : 'not enabled'}\\n` +\n `In iOS native project: Hermes is ${isHermesManaged ? 'not enabled' : 'enabled'}\\n` +\n `Please check the following files for inconsistencies:\\n` +\n ` - ${configFilePath}\\n` +\n ` - ${path.join(projectRoot, 'ios', 'Podfile')}\\n` +\n ` - ${path.join(projectRoot, 'ios', 'Podfile.properties.json')}\\n` +\n 'Learn more: https://expo.fyi/hermes-ios-config'\n );\n }\n}\n\nexport async function maybeInconsistentEngineAndroidAsync(\n projectRoot: string,\n isHermesManaged: boolean\n): Promise<boolean> {\n // Trying best to check android native project if by chance to be consistent between app config\n\n // Check gradle.properties from prebuild template\n const gradlePropertiesPath = path.join(projectRoot, 'android', 'gradle.properties');\n if (fs.existsSync(gradlePropertiesPath)) {\n const props = parseGradleProperties(await fs.readFile(gradlePropertiesPath, 'utf8'));\n const isHermesBare = props['hermesEnabled'] === 'true';\n if (isHermesManaged !== isHermesBare) {\n return true;\n }\n }\n\n return false;\n}\n\nexport async function maybeInconsistentEngineIosAsync(\n projectRoot: string,\n isHermesManaged: boolean\n): Promise<boolean> {\n // Trying best to check ios native project if by chance to be consistent between app config\n\n // Check ios/Podfile for \":hermes_enabled => true\"\n const podfilePath = path.join(projectRoot, 'ios', 'Podfile');\n if (fs.existsSync(podfilePath)) {\n const content = await fs.readFile(podfilePath, 'utf8');\n const isPropsReference =\n content.search(\n /^\\s*:hermes_enabled\\s*=>\\s*podfile_properties\\['expo.jsEngine'\\]\\s*==\\s*nil\\s*\\|\\|\\s*podfile_properties\\['expo.jsEngine'\\]\\s*==\\s*'hermes',?/m\n ) >= 0;\n const isHermesBare = content.search(/^\\s*:hermes_enabled\\s*=>\\s*true,?\\s+/m) >= 0;\n if (!isPropsReference && isHermesManaged !== isHermesBare) {\n return true;\n }\n }\n\n // Check Podfile.properties.json from prebuild template\n const podfilePropertiesPath = path.join(projectRoot, 'ios', 'Podfile.properties.json');\n if (fs.existsSync(podfilePropertiesPath)) {\n const props = await parsePodfilePropertiesAsync(podfilePropertiesPath);\n const isHermesBare = props['expo.jsEngine'] === 'hermes';\n if (isHermesManaged !== isHermesBare) {\n return true;\n }\n }\n\n return false;\n}\n\n// https://github.com/facebook/hermes/blob/release-v0.5/include/hermes/BCGen/HBC/BytecodeFileFormat.h#L24-L25\nconst HERMES_MAGIC_HEADER = 'c61fbc03c103191f';\n\nexport async function isHermesBytecodeBundleAsync(file: string): Promise<boolean> {\n const header = await readHermesHeaderAsync(file);\n return header.slice(0, 8).toString('hex') === HERMES_MAGIC_HEADER;\n}\n\nexport async function getHermesBytecodeBundleVersionAsync(file: string): Promise<number> {\n const header = await readHermesHeaderAsync(file);\n if (header.slice(0, 8).toString('hex') !== HERMES_MAGIC_HEADER) {\n throw new Error('Invalid hermes bundle file');\n }\n return header.readUInt32LE(8);\n}\n\nasync function readHermesHeaderAsync(file: string): Promise<Buffer> {\n const fd = await fs.open(file, 'r');\n const buffer = Buffer.alloc(12);\n await fs.read(fd, buffer, 0, 12, null);\n await fs.close(fd);\n return buffer;\n}\n\nasync function parsePodfilePropertiesAsync(\n podfilePropertiesPath: string\n): Promise<Record<string, string>> {\n try {\n return JSON.parse(await fs.readFile(podfilePropertiesPath, 'utf8'));\n } catch {\n return {};\n }\n}\n"],"names":["isEnableHermesManaged","parseGradleProperties","maybeThrowFromInconsistentEngineAsync","maybeInconsistentEngineAndroidAsync","maybeInconsistentEngineIosAsync","isHermesBytecodeBundleAsync","getHermesBytecodeBundleVersionAsync","expoConfig","platform","android","jsEngine","ios","content","result","line","split","trim","startsWith","sepIndex","indexOf","key","substr","value","projectRoot","configFilePath","isHermesManaged","configFileName","path","basename","Error","join","gradlePropertiesPath","fs","existsSync","props","readFile","isHermesBare","podfilePath","isPropsReference","search","podfilePropertiesPath","parsePodfilePropertiesAsync","HERMES_MAGIC_HEADER","file","header","readHermesHeaderAsync","slice","toString","readUInt32LE","fd","open","buffer","Buffer","alloc","read","close","JSON","parse"],"mappings":"AAAA;;;;QAIgBA,qBAAqB,GAArBA,qBAAqB;QAgBrBC,qBAAqB,GAArBA,qBAAqB;QAgBfC,qCAAqC,GAArCA,qCAAqC;QAqCrCC,mCAAmC,GAAnCA,mCAAmC;QAmBnCC,+BAA+B,GAA/BA,+BAA+B;QAoC/BC,2BAA2B,GAA3BA,2BAA2B;QAK3BC,mCAAmC,GAAnCA,mCAAmC;AApI1C,IAAA,QAAU,kCAAV,UAAU,EAAA;AACR,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAEhB,SAASN,qBAAqB,CACnCO,UAAqE,EACrEC,QAAgB,EACP;IACT,OAAQA,QAAQ;QACd,KAAK,SAAS;YAAE;oBACND,GAAkB;oBAAlBA,IAA4B;gBAApC,OAAO,CAACA,CAAAA,IAA4B,GAA5BA,CAAAA,GAAkB,GAAlBA,UAAU,CAACE,OAAO,SAAU,GAA5BF,KAAAA,CAA4B,GAA5BA,GAAkB,CAAEG,QAAQ,YAA5BH,IAA4B,GAAIA,UAAU,CAACG,QAAQ,CAAC,KAAK,KAAK,CAAC;aACxE;QACD,KAAK,KAAK;YAAE;oBACFH,IAAc;oBAAdA,IAAwB;gBAAhC,OAAO,CAACA,CAAAA,IAAwB,GAAxBA,CAAAA,IAAc,GAAdA,UAAU,CAACI,GAAG,SAAU,GAAxBJ,KAAAA,CAAwB,GAAxBA,IAAc,CAAEG,QAAQ,YAAxBH,IAAwB,GAAIA,UAAU,CAACG,QAAQ,CAAC,KAAK,KAAK,CAAC;aACpE;QACD;YACE,OAAO,KAAK,CAAC;KAChB;CACF;AAEM,SAAST,qBAAqB,CAACW,OAAe,EAA0B;IAC7E,MAAMC,MAAM,GAA2B,EAAE,AAAC;IAC1C,KAAK,IAAIC,IAAI,IAAIF,OAAO,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aticAsync = unstable_exportStaticAsync;
|
|
6
6
|
exports.getFilesToExportFromServerAsync = getFilesToExportFromServerAsync;
|
|
7
|
-
exports.exportFromServerAsync = exportFromServerAsync;
|
|
8
|
-
exports.getFilesFromSerialAssets = getFilesFromSerialAssets;
|
|
9
|
-
exports.persistMetroFilesAsync = persistMetroFilesAsync;
|
|
10
|
-
exports.modifyBundlesWithSourceMaps = modifyBundlesWithSourceMaps;
|
|
11
7
|
exports.getHtmlFiles = getHtmlFiles;
|
|
12
8
|
exports.getPathVariations = getPathVariations;
|
|
13
|
-
var _config = require("@expo/config");
|
|
14
9
|
var _assert = _interopRequireDefault(require("assert"));
|
|
15
10
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
16
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
17
11
|
var _path = _interopRequireDefault(require("path"));
|
|
18
|
-
var
|
|
12
|
+
var _resolveFrom = _interopRequireDefault(require("resolve-from"));
|
|
19
13
|
var _util = require("util");
|
|
20
14
|
var _favicon = require("./favicon");
|
|
21
15
|
var _persistMetroAssets = require("./persistMetroAssets");
|
|
16
|
+
var _saveAssets = require("./saveAssets");
|
|
22
17
|
var _log = require("../log");
|
|
23
18
|
var _devServerManager = require("../start/server/DevServerManager");
|
|
24
19
|
var _metroBundlerDevServer = require("../start/server/metro/MetroBundlerDevServer");
|
|
@@ -34,7 +29,7 @@ function _interopRequireDefault(obj) {
|
|
|
34
29
|
}
|
|
35
30
|
const debug = require("debug")("expo:export:generateStaticRoutes");
|
|
36
31
|
async function unstable_exportStaticAsync(projectRoot, options) {
|
|
37
|
-
_log.Log.
|
|
32
|
+
_log.Log.log(`Static rendering is enabled. ` + (0, _link).learnMore("https://docs.expo.dev/router/reference/static-rendering/"));
|
|
38
33
|
// Useful for running parallel e2e tests in CI.
|
|
39
34
|
const port = await (0, _port).getFreePortAsync(8082);
|
|
40
35
|
// TODO: Prevent starting the watcher.
|
|
@@ -43,7 +38,8 @@ async function unstable_exportStaticAsync(projectRoot, options) {
|
|
|
43
38
|
mode: "production",
|
|
44
39
|
port,
|
|
45
40
|
location: {},
|
|
46
|
-
resetDevServer: options.clear
|
|
41
|
+
resetDevServer: options.clear,
|
|
42
|
+
maxWorkers: options.maxWorkers
|
|
47
43
|
});
|
|
48
44
|
await devServerManager.startAsync([
|
|
49
45
|
{
|
|
@@ -52,12 +48,13 @@ async function unstable_exportStaticAsync(projectRoot, options) {
|
|
|
52
48
|
port,
|
|
53
49
|
location: {},
|
|
54
50
|
isExporting: true,
|
|
55
|
-
resetDevServer: options.clear
|
|
51
|
+
resetDevServer: options.clear,
|
|
52
|
+
maxWorkers: options.maxWorkers
|
|
56
53
|
}
|
|
57
54
|
},
|
|
58
55
|
]);
|
|
59
56
|
try {
|
|
60
|
-
await exportFromServerAsync(projectRoot, devServerManager, options);
|
|
57
|
+
return await exportFromServerAsync(projectRoot, devServerManager, options);
|
|
61
58
|
} finally{
|
|
62
59
|
await devServerManager.stopAsync();
|
|
63
60
|
}
|
|
@@ -66,18 +63,31 @@ async function unstable_exportStaticAsync(projectRoot, options) {
|
|
|
66
63
|
var ref;
|
|
67
64
|
return (ref = name.match(/^\(([^/]+?)\)$/)) == null ? void 0 : ref[1];
|
|
68
65
|
}
|
|
69
|
-
async function getFilesToExportFromServerAsync(projectRoot, { manifest , renderAsync ,
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
async function getFilesToExportFromServerAsync(projectRoot, { manifest , renderAsync , // Servers can handle group routes automatically and therefore
|
|
67
|
+
// don't require the build-time generation of every possible group
|
|
68
|
+
// variation.
|
|
69
|
+
exportServer , // name : contents
|
|
70
|
+
files =new Map() }) {
|
|
72
71
|
await Promise.all(getHtmlFiles({
|
|
73
72
|
manifest,
|
|
74
|
-
includeGroupVariations
|
|
75
|
-
}).map(async (
|
|
76
|
-
const pathname = outputPath.replace(/(?:index)?\.html$/, "");
|
|
73
|
+
includeGroupVariations: !exportServer
|
|
74
|
+
}).map(async ({ route , filePath , pathname })=>{
|
|
77
75
|
try {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
const targetDomain = exportServer ? "server" : "client";
|
|
77
|
+
files.set(filePath, {
|
|
78
|
+
contents: "",
|
|
79
|
+
targetDomain
|
|
80
|
+
});
|
|
81
|
+
const data = await renderAsync({
|
|
82
|
+
route,
|
|
83
|
+
filePath,
|
|
84
|
+
pathname
|
|
85
|
+
});
|
|
86
|
+
files.set(filePath, {
|
|
87
|
+
contents: data,
|
|
88
|
+
routeId: pathname,
|
|
89
|
+
targetDomain
|
|
90
|
+
});
|
|
81
91
|
} catch (e) {
|
|
82
92
|
await (0, _metroErrorInterface).logMetroErrorAsync({
|
|
83
93
|
error: e,
|
|
@@ -88,47 +98,75 @@ async function getFilesToExportFromServerAsync(projectRoot, { manifest , renderA
|
|
|
88
98
|
}));
|
|
89
99
|
return files;
|
|
90
100
|
}
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
101
|
+
function modifyRouteNodeInRuntimeManifest(manifest, callback) {
|
|
102
|
+
const iterateScreens = (screens)=>{
|
|
103
|
+
Object.values(screens).map((value)=>{
|
|
104
|
+
if (typeof value !== "string") {
|
|
105
|
+
if (value._route) callback(value._route);
|
|
106
|
+
iterateScreens(value.screens);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
iterateScreens(manifest.screens);
|
|
111
|
+
}
|
|
112
|
+
// TODO: Do this earlier in the process.
|
|
113
|
+
function makeRuntimeEntryPointsAbsolute(manifest, appDir) {
|
|
114
|
+
modifyRouteNodeInRuntimeManifest(manifest, (route)=>{
|
|
115
|
+
if (Array.isArray(route.entryPoints)) {
|
|
116
|
+
route.entryPoints = route.entryPoints.map((entryPoint)=>{
|
|
117
|
+
if (entryPoint.startsWith(".")) {
|
|
118
|
+
return _path.default.resolve(appDir, entryPoint);
|
|
119
|
+
} else if (!_path.default.isAbsolute(entryPoint)) {
|
|
120
|
+
return (0, _resolveFrom).default(appDir, entryPoint);
|
|
121
|
+
}
|
|
122
|
+
return entryPoint;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
94
125
|
});
|
|
95
|
-
|
|
126
|
+
}
|
|
127
|
+
/** Perform all fs commits */ async function exportFromServerAsync(projectRoot, devServerManager, { outputDir , baseUrl , exportServer , minify , includeSourceMaps , routerRoot , asyncRoutes , files =new Map() }) {
|
|
128
|
+
const appDir = _path.default.join(projectRoot, routerRoot);
|
|
96
129
|
const injectFaviconTag = await (0, _favicon).getVirtualFaviconAssetsAsync(projectRoot, {
|
|
97
130
|
outputDir,
|
|
98
|
-
baseUrl
|
|
131
|
+
baseUrl,
|
|
132
|
+
files
|
|
99
133
|
});
|
|
100
134
|
const devServer = devServerManager.getDefaultDevServer();
|
|
101
135
|
(0, _assert).default(devServer instanceof _metroBundlerDevServer.MetroBundlerDevServer);
|
|
102
136
|
const [resources, { manifest , serverManifest , renderAsync }] = await Promise.all([
|
|
103
137
|
devServer.getStaticResourcesAsync({
|
|
138
|
+
isExporting: true,
|
|
104
139
|
mode: "production",
|
|
105
140
|
minify,
|
|
106
|
-
|
|
107
|
-
baseUrl
|
|
141
|
+
includeSourceMaps,
|
|
142
|
+
baseUrl,
|
|
143
|
+
asyncRoutes,
|
|
144
|
+
routerRoot
|
|
108
145
|
}),
|
|
109
146
|
devServer.getStaticRenderFunctionAsync({
|
|
110
147
|
mode: "production",
|
|
111
148
|
minify,
|
|
112
|
-
baseUrl
|
|
149
|
+
baseUrl,
|
|
150
|
+
routerRoot
|
|
113
151
|
}),
|
|
114
152
|
]);
|
|
153
|
+
makeRuntimeEntryPointsAbsolute(manifest, appDir);
|
|
115
154
|
debug("Routes:\n", (0, _util).inspect(manifest, {
|
|
116
155
|
colors: true,
|
|
117
156
|
depth: null
|
|
118
157
|
}));
|
|
119
|
-
|
|
158
|
+
await getFilesToExportFromServerAsync(projectRoot, {
|
|
159
|
+
files,
|
|
120
160
|
manifest,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
// variation.
|
|
124
|
-
includeGroupVariations: !exportServer,
|
|
125
|
-
async renderAsync (pathname) {
|
|
161
|
+
exportServer,
|
|
162
|
+
async renderAsync ({ pathname , route }) {
|
|
126
163
|
const template = await renderAsync(pathname);
|
|
127
164
|
let html = await (0, _serializeHtml).serializeHtmlWithAssets({
|
|
128
165
|
mode: "production",
|
|
129
166
|
resources: resources.artifacts,
|
|
130
167
|
template,
|
|
131
|
-
baseUrl
|
|
168
|
+
baseUrl,
|
|
169
|
+
route
|
|
132
170
|
});
|
|
133
171
|
if (injectFaviconTag) {
|
|
134
172
|
html = injectFaviconTag(html);
|
|
@@ -136,12 +174,16 @@ async function exportFromServerAsync(projectRoot, devServerManager, { outputDir
|
|
|
136
174
|
return html;
|
|
137
175
|
}
|
|
138
176
|
});
|
|
139
|
-
getFilesFromSerialAssets(resources.artifacts, {
|
|
140
|
-
|
|
177
|
+
(0, _saveAssets).getFilesFromSerialAssets(resources.artifacts, {
|
|
178
|
+
platform: "web",
|
|
179
|
+
includeSourceMaps,
|
|
141
180
|
files
|
|
142
181
|
});
|
|
143
182
|
if (resources.assets) {
|
|
183
|
+
// TODO: Collect files without writing to disk.
|
|
184
|
+
// NOTE(kitten): Re. above, this is now using `files` except for iOS catalog output, which isn't used here
|
|
144
185
|
await (0, _persistMetroAssets).persistMetroAssetsAsync(resources.assets, {
|
|
186
|
+
files,
|
|
145
187
|
platform: "web",
|
|
146
188
|
outputDirectory: outputDir,
|
|
147
189
|
baseUrl
|
|
@@ -151,7 +193,7 @@ async function exportFromServerAsync(projectRoot, devServerManager, { outputDir
|
|
|
151
193
|
const apiRoutes = await exportApiRoutesAsync({
|
|
152
194
|
outputDir,
|
|
153
195
|
server: devServer,
|
|
154
|
-
|
|
196
|
+
routerRoot,
|
|
155
197
|
manifest: serverManifest,
|
|
156
198
|
baseUrl
|
|
157
199
|
});
|
|
@@ -162,86 +204,58 @@ async function exportFromServerAsync(projectRoot, devServerManager, { outputDir
|
|
|
162
204
|
} else {
|
|
163
205
|
warnPossibleInvalidExportType(appDir);
|
|
164
206
|
}
|
|
165
|
-
await persistMetroFilesAsync(files, outputDir);
|
|
166
|
-
}
|
|
167
|
-
function getFilesFromSerialAssets(resources, { includeMaps , files =new Map() }) {
|
|
168
|
-
resources.forEach((resource)=>{
|
|
169
|
-
files.set(resource.filename, modifyBundlesWithSourceMaps(resource.filename, resource.source, includeMaps));
|
|
170
|
-
});
|
|
171
207
|
return files;
|
|
172
208
|
}
|
|
173
|
-
async function persistMetroFilesAsync(files, outputDir) {
|
|
174
|
-
_fs.default.mkdirSync(_path.default.join(outputDir), {
|
|
175
|
-
recursive: true
|
|
176
|
-
});
|
|
177
|
-
_log.Log.log("");
|
|
178
|
-
_log.Log.log(_chalk.default.bold`Exporting ${files.size} files:`);
|
|
179
|
-
await Promise.all([
|
|
180
|
-
...files.entries()
|
|
181
|
-
].sort(([a], [b])=>a.localeCompare(b)
|
|
182
|
-
).map(async ([file, contents])=>{
|
|
183
|
-
const length = Buffer.byteLength(contents, "utf8");
|
|
184
|
-
_log.Log.log(file, _chalk.default.gray`(${(0, _prettyBytes).default(length)})`);
|
|
185
|
-
const outputPath = _path.default.join(outputDir, file);
|
|
186
|
-
await _fs.default.promises.mkdir(_path.default.dirname(outputPath), {
|
|
187
|
-
recursive: true
|
|
188
|
-
});
|
|
189
|
-
await _fs.default.promises.writeFile(outputPath, contents);
|
|
190
|
-
}));
|
|
191
|
-
_log.Log.log("");
|
|
192
|
-
}
|
|
193
|
-
function modifyBundlesWithSourceMaps(filename, source, includeMaps) {
|
|
194
|
-
if (filename.endsWith(".js")) {
|
|
195
|
-
// If the bundle ends with source map URLs then update them to point to the correct location.
|
|
196
|
-
// TODO: baseUrl support
|
|
197
|
-
const normalizedFilename = "/" + filename.replace(/^\/+/, "");
|
|
198
|
-
// Ref: https://developer.chrome.com/blog/sourcemaps/#sourceurl-and-displayname-in-action-eval-and-anonymous-functions
|
|
199
|
-
//# sourceMappingURL=//localhost:8085/index.map?platform=web&dev=false&hot=false&lazy=true&minify=true&resolver.environment=client&transform.environment=client&serializer.output=static
|
|
200
|
-
//# sourceURL=http://localhost:8085/index.bundle//&platform=web&dev=false&hot=false&lazy=true&minify=true&resolver.environment=client&transform.environment=client&serializer.output=static
|
|
201
|
-
return source.replace(/^\/\/# (sourceMappingURL|sourceURL)=.*$/gm, (...props)=>{
|
|
202
|
-
if (includeMaps) {
|
|
203
|
-
if (props[1] === "sourceURL") {
|
|
204
|
-
return `//# ${props[1]}=` + normalizedFilename;
|
|
205
|
-
} else if (props[1] === "sourceMappingURL") {
|
|
206
|
-
const mapName = normalizedFilename + ".map";
|
|
207
|
-
return `//# ${props[1]}=` + mapName;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
return "";
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
return source;
|
|
214
|
-
}
|
|
215
209
|
function getHtmlFiles({ manifest , includeGroupVariations }) {
|
|
216
210
|
const htmlFiles = new Set();
|
|
217
|
-
function traverseScreens(screens, baseUrl = "") {
|
|
211
|
+
function traverseScreens(screens, route, baseUrl = "") {
|
|
218
212
|
for (const value of Object.values(screens)){
|
|
213
|
+
let leaf = null;
|
|
219
214
|
if (typeof value === "string") {
|
|
220
|
-
|
|
221
|
-
|
|
215
|
+
leaf = value;
|
|
216
|
+
} else if (Object.keys(value.screens).length === 0) {
|
|
217
|
+
leaf = value.path;
|
|
218
|
+
var __route;
|
|
219
|
+
route = (__route = value._route) != null ? __route : null;
|
|
220
|
+
}
|
|
221
|
+
if (leaf != null) {
|
|
222
|
+
let filePath = baseUrl + leaf;
|
|
223
|
+
if (leaf === "") {
|
|
222
224
|
filePath = baseUrl === "" ? "index" : baseUrl.endsWith("/") ? baseUrl + "index" : baseUrl.slice(0, -1);
|
|
223
225
|
}
|
|
226
|
+
// This should never happen, the type of `string | object` originally comes from React Navigation.
|
|
227
|
+
if (!route) {
|
|
228
|
+
throw new Error(`Internal error: Route not found for "${filePath}" while collecting static export paths.`);
|
|
229
|
+
}
|
|
224
230
|
if (includeGroupVariations) {
|
|
225
231
|
// TODO: Dedupe requests for alias routes.
|
|
226
|
-
addOptionalGroups(filePath);
|
|
232
|
+
addOptionalGroups(filePath, route);
|
|
227
233
|
} else {
|
|
228
|
-
htmlFiles.add(
|
|
234
|
+
htmlFiles.add({
|
|
235
|
+
filePath,
|
|
236
|
+
route
|
|
237
|
+
});
|
|
229
238
|
}
|
|
230
239
|
} else if (typeof value === "object" && (value == null ? void 0 : value.screens)) {
|
|
231
240
|
const newPath = baseUrl + value.path + "/";
|
|
232
|
-
|
|
241
|
+
var __route1;
|
|
242
|
+
traverseScreens(value.screens, (__route1 = value._route) != null ? __route1 : null, newPath);
|
|
233
243
|
}
|
|
234
244
|
}
|
|
235
245
|
}
|
|
236
|
-
function addOptionalGroups(path) {
|
|
246
|
+
function addOptionalGroups(path, route) {
|
|
237
247
|
const variations = getPathVariations(path);
|
|
238
248
|
for (const variation of variations){
|
|
239
|
-
htmlFiles.add(
|
|
249
|
+
htmlFiles.add({
|
|
250
|
+
filePath: variation,
|
|
251
|
+
route
|
|
252
|
+
});
|
|
240
253
|
}
|
|
241
254
|
}
|
|
242
|
-
traverseScreens(manifest.screens);
|
|
243
|
-
return Array.from(htmlFiles)
|
|
244
|
-
|
|
255
|
+
traverseScreens(manifest.screens, null);
|
|
256
|
+
return uniqueBy(Array.from(htmlFiles), (value)=>value.filePath
|
|
257
|
+
).map((value)=>{
|
|
258
|
+
const parts = value.filePath.split("/");
|
|
245
259
|
// Replace `:foo` with `[foo]` and `*foo` with `[...foo]`
|
|
246
260
|
const partsWithGroups = parts.map((part)=>{
|
|
247
261
|
if (part === "*not-found") {
|
|
@@ -253,9 +267,27 @@ function getHtmlFiles({ manifest , includeGroupVariations }) {
|
|
|
253
267
|
}
|
|
254
268
|
return part;
|
|
255
269
|
});
|
|
256
|
-
|
|
270
|
+
const filePathLocation = partsWithGroups.join("/");
|
|
271
|
+
const filePath = filePathLocation + ".html";
|
|
272
|
+
return {
|
|
273
|
+
...value,
|
|
274
|
+
filePath,
|
|
275
|
+
pathname: filePathLocation.replace(/(\/?index)?$/, "")
|
|
276
|
+
};
|
|
257
277
|
});
|
|
258
278
|
}
|
|
279
|
+
function uniqueBy(array, key) {
|
|
280
|
+
const seen = new Set();
|
|
281
|
+
const result = [];
|
|
282
|
+
for (const value of array){
|
|
283
|
+
const id = key(value);
|
|
284
|
+
if (!seen.has(id)) {
|
|
285
|
+
seen.add(id);
|
|
286
|
+
result.push(value);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return result;
|
|
290
|
+
}
|
|
259
291
|
function getPathVariations(routePath) {
|
|
260
292
|
const variations = new Set();
|
|
261
293
|
const segments1 = routePath.split("/");
|
|
@@ -265,7 +297,6 @@ function getPathVariations(routePath) {
|
|
|
265
297
|
return;
|
|
266
298
|
}
|
|
267
299
|
const [head, ...rest] = segments;
|
|
268
|
-
if (head.startsWith("(foo,foo")) {}
|
|
269
300
|
if (matchGroupName(head)) {
|
|
270
301
|
const groups = head.slice(1, -1).split(",");
|
|
271
302
|
if (groups.length > 1) {
|
|
@@ -292,21 +323,19 @@ function getPathVariations(routePath) {
|
|
|
292
323
|
generateVariations(segments1);
|
|
293
324
|
return Array.from(variations);
|
|
294
325
|
}
|
|
295
|
-
async function exportApiRoutesAsync({ outputDir , server ,
|
|
296
|
-
const functionsDir = "_expo/functions";
|
|
297
|
-
const funcDir = _path.default.join(outputDir, functionsDir);
|
|
298
|
-
_fs.default.mkdirSync(_path.default.join(funcDir), {
|
|
299
|
-
recursive: true
|
|
300
|
-
});
|
|
326
|
+
async function exportApiRoutesAsync({ outputDir , server , routerRoot , baseUrl , ...props }) {
|
|
301
327
|
const { manifest , files } = await server.exportExpoRouterApiRoutesAsync({
|
|
302
328
|
mode: "production",
|
|
303
|
-
|
|
304
|
-
outputDir:
|
|
329
|
+
routerRoot,
|
|
330
|
+
outputDir: "_expo/functions",
|
|
305
331
|
prerenderManifest: props.manifest,
|
|
306
332
|
baseUrl
|
|
307
333
|
});
|
|
308
334
|
_log.Log.log(_chalk.default.bold`Exporting ${files.size} API Routes.`);
|
|
309
|
-
files.set("_expo/routes.json",
|
|
335
|
+
files.set("_expo/routes.json", {
|
|
336
|
+
contents: JSON.stringify(manifest, null, 2),
|
|
337
|
+
targetDomain: "server"
|
|
338
|
+
});
|
|
310
339
|
return files;
|
|
311
340
|
}
|
|
312
341
|
function warnPossibleInvalidExportType(appDir) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/exportStaticAsync.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 { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\nimport prettyBytes from 'pretty-bytes';\nimport { inspect } from 'util';\n\nimport { getVirtualFaviconAssetsAsync } from './favicon';\nimport { persistMetroAssetsAsync } from './persistMetroAssets';\nimport { Log } from '../log';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport { MetroBundlerDevServer } from '../start/server/metro/MetroBundlerDevServer';\nimport { ExpoRouterServerManifestV1 } from '../start/server/metro/fetchRouterManifest';\nimport { logMetroErrorAsync } from '../start/server/metro/metroErrorInterface';\nimport {\n getApiRoutesForDirectory,\n getRouterDirectoryWithManifest,\n} from '../start/server/metro/router';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport { learnMore } from '../utils/link';\nimport { getFreePortAsync } from '../utils/port';\n\nconst debug = require('debug')('expo:export:generateStaticRoutes') as typeof console.log;\n\ntype Options = {\n outputDir: string;\n minify: boolean;\n exportServer: boolean;\n baseUrl: string;\n includeMaps: boolean;\n entryPoint?: string;\n clear: boolean;\n};\n\n/** @private */\nexport async function unstable_exportStaticAsync(projectRoot: string, options: Options) {\n Log.warn(\n `Experimental static rendering is enabled. ` +\n learnMore('https://docs.expo.dev/router/reference/static-rendering/')\n );\n\n // Useful for running parallel e2e tests in CI.\n const port = await getFreePortAsync(8082);\n\n // TODO: Prevent starting the watcher.\n const devServerManager = new DevServerManager(projectRoot, {\n minify: options.minify,\n mode: 'production',\n port,\n location: {},\n resetDevServer: options.clear,\n });\n await devServerManager.startAsync([\n {\n type: 'metro',\n options: {\n port,\n location: {},\n isExporting: true,\n resetDevServer: options.clear,\n },\n },\n ]);\n\n try {\n await exportFromServerAsync(projectRoot, devServerManager, options);\n } finally {\n await devServerManager.stopAsync();\n }\n}\n\n/** Match `(page)` -> `page` */\nfunction matchGroupName(name: string): string | undefined {\n return name.match(/^\\(([^/]+?)\\)$/)?.[1];\n}\n\nexport async function getFilesToExportFromServerAsync(\n projectRoot: string,\n {\n manifest,\n renderAsync,\n includeGroupVariations,\n }: {\n manifest: any;\n renderAsync: (pathname: string) => Promise<string>;\n includeGroupVariations?: boolean;\n }\n): Promise<Map<string, string>> {\n // name : contents\n const files = new Map<string, string>();\n\n await Promise.all(\n getHtmlFiles({ manifest, includeGroupVariations }).map(async (outputPath) => {\n const pathname = outputPath.replace(/(?:index)?\\.html$/, '');\n try {\n files.set(outputPath, '');\n const data = await renderAsync(pathname);\n files.set(outputPath, data);\n } catch (e: any) {\n await logMetroErrorAsync({ error: e, projectRoot });\n throw new Error('Failed to statically export route: ' + pathname);\n }\n })\n );\n\n return files;\n}\n\n/** Perform all fs commits */\nexport async function exportFromServerAsync(\n projectRoot: string,\n devServerManager: DevServerManager,\n { outputDir, baseUrl, exportServer, minify, includeMaps }: Options\n): Promise<void> {\n const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const appDir = getRouterDirectoryWithManifest(projectRoot, exp);\n\n const injectFaviconTag = await getVirtualFaviconAssetsAsync(projectRoot, { outputDir, baseUrl });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const [resources, { manifest, serverManifest, renderAsync }] = await Promise.all([\n devServer.getStaticResourcesAsync({ mode: 'production', minify, includeMaps, baseUrl }),\n devServer.getStaticRenderFunctionAsync({\n mode: 'production',\n minify,\n baseUrl,\n }),\n ]);\n\n debug('Routes:\\n', inspect(manifest, { colors: true, depth: null }));\n\n const files = await getFilesToExportFromServerAsync(projectRoot, {\n manifest,\n // Servers can handle group routes automatically and therefore\n // don't require the build-time generation of every possible group\n // variation.\n includeGroupVariations: !exportServer,\n async renderAsync(pathname: string) {\n const template = await renderAsync(pathname);\n let html = await serializeHtmlWithAssets({\n mode: 'production',\n resources: resources.artifacts,\n template,\n baseUrl,\n });\n\n if (injectFaviconTag) {\n html = injectFaviconTag(html);\n }\n\n return html;\n },\n });\n\n getFilesFromSerialAssets(resources.artifacts, {\n includeMaps,\n files,\n });\n\n if (resources.assets) {\n await persistMetroAssetsAsync(resources.assets, {\n platform: 'web',\n outputDirectory: outputDir,\n baseUrl,\n });\n }\n\n if (exportServer) {\n const apiRoutes = await exportApiRoutesAsync({\n outputDir,\n server: devServer,\n appDir,\n manifest: serverManifest,\n baseUrl,\n });\n\n // Add the api routes to the files to export.\n for (const [route, contents] of apiRoutes) {\n files.set(route, contents);\n }\n } else {\n warnPossibleInvalidExportType(appDir);\n }\n\n await persistMetroFilesAsync(files, outputDir);\n}\n\n// TODO: Move source map modification to the serializer\nexport function getFilesFromSerialAssets(\n resources: SerialAsset[],\n {\n includeMaps,\n files = new Map<string, string>(),\n }: {\n includeMaps: boolean;\n files?: Map<string, string>;\n }\n) {\n resources.forEach((resource) => {\n files.set(\n resource.filename,\n modifyBundlesWithSourceMaps(resource.filename, resource.source, includeMaps)\n );\n });\n\n return files;\n}\n\nexport async function persistMetroFilesAsync(files: Map<string, string>, outputDir: string) {\n fs.mkdirSync(path.join(outputDir), { recursive: true });\n\n Log.log('');\n\n Log.log(chalk.bold`Exporting ${files.size} files:`);\n await Promise.all(\n [...files.entries()]\n .sort(([a], [b]) => a.localeCompare(b))\n .map(async ([file, contents]) => {\n const length = Buffer.byteLength(contents, 'utf8');\n Log.log(file, chalk.gray`(${prettyBytes(length)})`);\n const outputPath = path.join(outputDir, file);\n await fs.promises.mkdir(path.dirname(outputPath), { recursive: true });\n await fs.promises.writeFile(outputPath, contents);\n })\n );\n Log.log('');\n}\n\nexport function modifyBundlesWithSourceMaps(\n filename: string,\n source: string,\n includeMaps: boolean\n): string {\n if (filename.endsWith('.js')) {\n // If the bundle ends with source map URLs then update them to point to the correct location.\n\n // TODO: baseUrl support\n const normalizedFilename = '/' + filename.replace(/^\\/+/, '');\n // Ref: https://developer.chrome.com/blog/sourcemaps/#sourceurl-and-displayname-in-action-eval-and-anonymous-functions\n //# sourceMappingURL=//localhost:8085/index.map?platform=web&dev=false&hot=false&lazy=true&minify=true&resolver.environment=client&transform.environment=client&serializer.output=static\n //# sourceURL=http://localhost:8085/index.bundle//&platform=web&dev=false&hot=false&lazy=true&minify=true&resolver.environment=client&transform.environment=client&serializer.output=static\n return source.replace(/^\\/\\/# (sourceMappingURL|sourceURL)=.*$/gm, (...props) => {\n if (includeMaps) {\n if (props[1] === 'sourceURL') {\n return `//# ${props[1]}=` + normalizedFilename;\n } else if (props[1] === 'sourceMappingURL') {\n const mapName = normalizedFilename + '.map';\n return `//# ${props[1]}=` + mapName;\n }\n }\n return '';\n });\n }\n return source;\n}\n\nexport function getHtmlFiles({\n manifest,\n includeGroupVariations,\n}: {\n manifest: any;\n includeGroupVariations?: boolean;\n}): string[] {\n const htmlFiles = new Set<string>();\n\n function traverseScreens(screens: string | { screens: any; path: string }, baseUrl = '') {\n for (const value of Object.values(screens)) {\n if (typeof value === 'string') {\n let filePath = baseUrl + value;\n if (value === '') {\n filePath =\n baseUrl === ''\n ? 'index'\n : baseUrl.endsWith('/')\n ? baseUrl + 'index'\n : baseUrl.slice(0, -1);\n }\n if (includeGroupVariations) {\n // TODO: Dedupe requests for alias routes.\n addOptionalGroups(filePath);\n } else {\n htmlFiles.add(filePath);\n }\n } else if (typeof value === 'object' && value?.screens) {\n const newPath = baseUrl + value.path + '/';\n traverseScreens(value.screens, newPath);\n }\n }\n }\n\n function addOptionalGroups(path: string) {\n const variations = getPathVariations(path);\n for (const variation of variations) {\n htmlFiles.add(variation);\n }\n }\n\n traverseScreens(manifest.screens);\n\n return Array.from(htmlFiles).map((value) => {\n const parts = value.split('/');\n // Replace `:foo` with `[foo]` and `*foo` with `[...foo]`\n const partsWithGroups = parts.map((part) => {\n if (part === '*not-found') {\n return `+not-found`;\n } else if (part.startsWith(':')) {\n return `[${part.slice(1)}]`;\n } else if (part.startsWith('*')) {\n return `[...${part.slice(1)}]`;\n }\n return part;\n });\n return partsWithGroups.join('/') + '.html';\n });\n}\n\n// Given a route like `(foo)/bar/(baz)`, return all possible variations of the route.\n// e.g. `(foo)/bar/(baz)`, `(foo)/bar/baz`, `foo/bar/(baz)`, `foo/bar/baz`,\nexport function getPathVariations(routePath: string): string[] {\n const variations = new Set<string>();\n const segments = routePath.split('/');\n\n function generateVariations(segments: string[], current = ''): void {\n if (segments.length === 0) {\n if (current) variations.add(current);\n return;\n }\n\n const [head, ...rest] = segments;\n\n if (head.startsWith('(foo,foo')) {\n }\n\n if (matchGroupName(head)) {\n const groups = head.slice(1, -1).split(',');\n\n if (groups.length > 1) {\n for (const group of groups) {\n // If there are multiple groups, recurse on each group.\n generateVariations([`(${group.trim()})`, ...rest], current);\n }\n return;\n } else {\n // Start a fork where this group is included\n generateVariations(rest, current ? `${current}/(${groups[0]})` : `(${groups[0]})`);\n // This code will continue and add paths without this group included`\n }\n } else if (current) {\n current = `${current}/${head}`;\n } else {\n current = head;\n }\n\n generateVariations(rest, current);\n }\n\n generateVariations(segments);\n\n return Array.from(variations);\n}\n\nasync function exportApiRoutesAsync({\n outputDir,\n server,\n appDir,\n baseUrl,\n ...props\n}: {\n outputDir: string;\n server: MetroBundlerDevServer;\n appDir: string;\n manifest: ExpoRouterServerManifestV1;\n baseUrl: string;\n}): Promise<Map<string, string>> {\n const functionsDir = '_expo/functions';\n const funcDir = path.join(outputDir, functionsDir);\n fs.mkdirSync(path.join(funcDir), { recursive: true });\n\n const { manifest, files } = await server.exportExpoRouterApiRoutesAsync({\n mode: 'production',\n appDir,\n outputDir: functionsDir,\n prerenderManifest: props.manifest,\n baseUrl,\n });\n\n Log.log(chalk.bold`Exporting ${files.size} API Routes.`);\n\n files.set('_expo/routes.json', JSON.stringify(manifest, null, 2));\n\n return files;\n}\n\nfunction warnPossibleInvalidExportType(appDir: string) {\n const apiRoutes = getApiRoutesForDirectory(appDir);\n if (apiRoutes.length) {\n // TODO: Allow API Routes for native-only.\n Log.warn(\n chalk.yellow`Skipping export for API routes because \\`web.output\\` is not \"server\". You may want to remove the routes: ${apiRoutes\n .map((v) => path.relative(appDir, v))\n .join(', ')}`\n );\n }\n}\n"],"names":["unstable_exportStaticAsync","getFilesToExportFromServerAsync","exportFromServerAsync","getFilesFromSerialAssets","persistMetroFilesAsync","modifyBundlesWithSourceMaps","getHtmlFiles","getPathVariations","debug","require","projectRoot","options","Log","warn","learnMore","port","getFreePortAsync","devServerManager","DevServerManager","minify","mode","location","resetDevServer","clear","startAsync","type","isExporting","stopAsync","matchGroupName","name","match","manifest","renderAsync","includeGroupVariations","files","Map","Promise","all","map","outputPath","pathname","replace","set","data","e","logMetroErrorAsync","error","Error","outputDir","baseUrl","exportServer","includeMaps","exp","getConfig","skipSDKVersionRequirement","appDir","getRouterDirectoryWithManifest","injectFaviconTag","getVirtualFaviconAssetsAsync","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","resources","serverManifest","getStaticResourcesAsync","getStaticRenderFunctionAsync","inspect","colors","depth","template","html","serializeHtmlWithAssets","artifacts","assets","persistMetroAssetsAsync","platform","outputDirectory","apiRoutes","exportApiRoutesAsync","server","route","contents","warnPossibleInvalidExportType","forEach","resource","filename","source","fs","mkdirSync","path","join","recursive","log","chalk","bold","size","entries","sort","a","b","localeCompare","file","length","Buffer","byteLength","gray","prettyBytes","promises","mkdir","dirname","writeFile","endsWith","normalizedFilename","props","mapName","htmlFiles","Set","traverseScreens","screens","value","Object","values","filePath","slice","addOptionalGroups","add","newPath","variations","variation","Array","from","parts","split","partsWithGroups","part","startsWith","routePath","segments","generateVariations","current","head","rest","groups","group","trim","functionsDir","funcDir","exportExpoRouterApiRoutesAsync","prerenderManifest","JSON","stringify","getApiRoutesForDirectory","yellow","v","relative"],"mappings":"AAMA;;;;QAqCsBA,0BAA0B,GAA1BA,0BAA0B;QAyC1BC,+BAA+B,GAA/BA,+BAA+B;QAiC/BC,qBAAqB,GAArBA,qBAAqB;QAiF3BC,wBAAwB,GAAxBA,wBAAwB;QAoBlBC,sBAAsB,GAAtBA,sBAAsB;QAoB5BC,2BAA2B,GAA3BA,2BAA2B;QA4B3BC,YAAY,GAAZA,YAAY;QA8DZC,iBAAiB,GAAjBA,iBAAiB;AAlUP,IAAA,OAAc,WAAd,cAAc,CAAA;AAErB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AACV,IAAA,GAAI,kCAAJ,IAAI,EAAA;AACF,IAAA,KAAM,kCAAN,MAAM,EAAA;AACC,IAAA,YAAc,kCAAd,cAAc,EAAA;AACd,IAAA,KAAM,WAAN,MAAM,CAAA;AAEe,IAAA,QAAW,WAAX,WAAW,CAAA;AAChB,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AAC1C,IAAA,IAAQ,WAAR,QAAQ,CAAA;AACK,IAAA,iBAAkC,WAAlC,kCAAkC,CAAA;AAC7B,IAAA,sBAA6C,WAA7C,6CAA6C,CAAA;AAEhD,IAAA,oBAA2C,WAA3C,2CAA2C,CAAA;AAIvE,IAAA,OAA8B,WAA9B,8BAA8B,CAAA;AACG,IAAA,cAAqC,WAArC,qCAAqC,CAAA;AACnD,IAAA,KAAe,WAAf,eAAe,CAAA;AACR,IAAA,KAAe,WAAf,eAAe,CAAA;;;;;;AAEhD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,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;KACH;CACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/exportStaticAsync.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 assert from 'assert';\nimport chalk from 'chalk';\nimport { RouteNode } from 'expo-router/build/Route';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\nimport { inspect } from 'util';\n\nimport { getVirtualFaviconAssetsAsync } from './favicon';\nimport { persistMetroAssetsAsync } from './persistMetroAssets';\nimport { ExportAssetMap, getFilesFromSerialAssets } from './saveAssets';\nimport { Log } from '../log';\nimport { DevServerManager } from '../start/server/DevServerManager';\nimport {\n ExpoRouterRuntimeManifest,\n MetroBundlerDevServer,\n} from '../start/server/metro/MetroBundlerDevServer';\nimport { ExpoRouterServerManifestV1 } from '../start/server/metro/fetchRouterManifest';\nimport { logMetroErrorAsync } from '../start/server/metro/metroErrorInterface';\nimport { getApiRoutesForDirectory } from '../start/server/metro/router';\nimport { serializeHtmlWithAssets } from '../start/server/metro/serializeHtml';\nimport { learnMore } from '../utils/link';\nimport { getFreePortAsync } from '../utils/port';\n\nconst debug = require('debug')('expo:export:generateStaticRoutes') as typeof console.log;\n\ntype Options = {\n files?: ExportAssetMap;\n outputDir: string;\n minify: boolean;\n exportServer: boolean;\n baseUrl: string;\n includeSourceMaps: boolean;\n entryPoint?: string;\n clear: boolean;\n asyncRoutes: boolean;\n routerRoot: string;\n maxWorkers?: number;\n};\n\ntype HtmlRequestLocation = {\n /** The output file path name to use relative to the static folder. */\n filePath: string;\n /** The pathname to make requests to in order to fetch the HTML. */\n pathname: string;\n /** The runtime route node object, used to associate async modules with the static HTML. */\n route: RouteNode;\n};\n\n/** @private */\nexport async function unstable_exportStaticAsync(projectRoot: string, options: Options) {\n Log.log(\n `Static rendering is enabled. ` +\n learnMore('https://docs.expo.dev/router/reference/static-rendering/')\n );\n\n // Useful for running parallel e2e tests in CI.\n const port = await getFreePortAsync(8082);\n\n // TODO: Prevent starting the watcher.\n const devServerManager = new DevServerManager(projectRoot, {\n minify: options.minify,\n mode: 'production',\n port,\n location: {},\n resetDevServer: options.clear,\n maxWorkers: options.maxWorkers,\n });\n await devServerManager.startAsync([\n {\n type: 'metro',\n options: {\n port,\n location: {},\n isExporting: true,\n resetDevServer: options.clear,\n maxWorkers: options.maxWorkers,\n },\n },\n ]);\n\n try {\n return await exportFromServerAsync(projectRoot, devServerManager, options);\n } finally {\n await devServerManager.stopAsync();\n }\n}\n\n/** Match `(page)` -> `page` */\nfunction matchGroupName(name: string): string | undefined {\n return name.match(/^\\(([^/]+?)\\)$/)?.[1];\n}\n\nexport async function getFilesToExportFromServerAsync(\n projectRoot: string,\n {\n manifest,\n renderAsync,\n // Servers can handle group routes automatically and therefore\n // don't require the build-time generation of every possible group\n // variation.\n exportServer,\n // name : contents\n files = new Map(),\n }: {\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (requestLocation: HtmlRequestLocation) => Promise<string>;\n exportServer?: boolean;\n files?: ExportAssetMap;\n }\n): Promise<ExportAssetMap> {\n await Promise.all(\n getHtmlFiles({ manifest, includeGroupVariations: !exportServer }).map(\n async ({ route, filePath, pathname }) => {\n try {\n const targetDomain = exportServer ? 'server' : 'client';\n files.set(filePath, { contents: '', targetDomain });\n const data = await renderAsync({ route, filePath, pathname });\n files.set(filePath, {\n contents: data,\n routeId: pathname,\n targetDomain,\n });\n } catch (e: any) {\n await logMetroErrorAsync({ error: e, projectRoot });\n throw new Error('Failed to statically export route: ' + pathname);\n }\n }\n )\n );\n\n return files;\n}\n\nfunction modifyRouteNodeInRuntimeManifest(\n manifest: ExpoRouterRuntimeManifest,\n callback: (route: RouteNode) => any\n) {\n const iterateScreens = (screens: ExpoRouterRuntimeManifest['screens']) => {\n Object.values(screens).map((value) => {\n if (typeof value !== 'string') {\n if (value._route) callback(value._route);\n iterateScreens(value.screens);\n }\n });\n };\n\n iterateScreens(manifest.screens);\n}\n\n// TODO: Do this earlier in the process.\nfunction makeRuntimeEntryPointsAbsolute(manifest: ExpoRouterRuntimeManifest, appDir: string) {\n modifyRouteNodeInRuntimeManifest(manifest, (route) => {\n if (Array.isArray(route.entryPoints)) {\n route.entryPoints = route.entryPoints.map((entryPoint) => {\n if (entryPoint.startsWith('.')) {\n return path.resolve(appDir, entryPoint);\n } else if (!path.isAbsolute(entryPoint)) {\n return resolveFrom(appDir, entryPoint);\n }\n return entryPoint;\n });\n }\n });\n}\n\n/** Perform all fs commits */\nasync function exportFromServerAsync(\n projectRoot: string,\n devServerManager: DevServerManager,\n {\n outputDir,\n baseUrl,\n exportServer,\n minify,\n includeSourceMaps,\n routerRoot,\n asyncRoutes,\n files = new Map(),\n }: Options\n): Promise<ExportAssetMap> {\n const appDir = path.join(projectRoot, routerRoot);\n const injectFaviconTag = await getVirtualFaviconAssetsAsync(projectRoot, {\n outputDir,\n baseUrl,\n files,\n });\n\n const devServer = devServerManager.getDefaultDevServer();\n assert(devServer instanceof MetroBundlerDevServer);\n\n const [resources, { manifest, serverManifest, renderAsync }] = await Promise.all([\n devServer.getStaticResourcesAsync({\n isExporting: true,\n mode: 'production',\n minify,\n includeSourceMaps,\n baseUrl,\n asyncRoutes,\n routerRoot,\n }),\n devServer.getStaticRenderFunctionAsync({\n mode: 'production',\n minify,\n baseUrl,\n routerRoot,\n }),\n ]);\n\n makeRuntimeEntryPointsAbsolute(manifest, appDir);\n\n debug('Routes:\\n', inspect(manifest, { colors: true, depth: null }));\n\n await getFilesToExportFromServerAsync(projectRoot, {\n files,\n manifest,\n exportServer,\n async renderAsync({ pathname, route }) {\n const template = await renderAsync(pathname);\n let html = await serializeHtmlWithAssets({\n mode: 'production',\n resources: resources.artifacts,\n template,\n baseUrl,\n route,\n });\n\n if (injectFaviconTag) {\n html = injectFaviconTag(html);\n }\n\n return html;\n },\n });\n\n getFilesFromSerialAssets(resources.artifacts, {\n platform: 'web',\n includeSourceMaps,\n files,\n });\n\n if (resources.assets) {\n // TODO: Collect files without writing to disk.\n // NOTE(kitten): Re. above, this is now using `files` except for iOS catalog output, which isn't used here\n await persistMetroAssetsAsync(resources.assets, {\n files,\n platform: 'web',\n outputDirectory: outputDir,\n baseUrl,\n });\n }\n\n if (exportServer) {\n const apiRoutes = await exportApiRoutesAsync({\n outputDir,\n server: devServer,\n routerRoot,\n manifest: serverManifest,\n baseUrl,\n });\n\n // Add the api routes to the files to export.\n for (const [route, contents] of apiRoutes) {\n files.set(route, contents);\n }\n } else {\n warnPossibleInvalidExportType(appDir);\n }\n\n return files;\n}\n\nexport function getHtmlFiles({\n manifest,\n includeGroupVariations,\n}: {\n manifest: ExpoRouterRuntimeManifest;\n includeGroupVariations?: boolean;\n}): HtmlRequestLocation[] {\n const htmlFiles = new Set<Omit<HtmlRequestLocation, 'pathname'>>();\n\n function traverseScreens(\n screens: ExpoRouterRuntimeManifest['screens'],\n route: RouteNode | null,\n baseUrl = ''\n ) {\n for (const value of Object.values(screens)) {\n let leaf: string | null = null;\n if (typeof value === 'string') {\n leaf = value;\n } else if (Object.keys(value.screens).length === 0) {\n leaf = value.path;\n route = value._route ?? null;\n }\n\n if (leaf != null) {\n let filePath = baseUrl + leaf;\n if (leaf === '') {\n filePath =\n baseUrl === ''\n ? 'index'\n : baseUrl.endsWith('/')\n ? baseUrl + 'index'\n : baseUrl.slice(0, -1);\n }\n\n // This should never happen, the type of `string | object` originally comes from React Navigation.\n if (!route) {\n throw new Error(\n `Internal error: Route not found for \"${filePath}\" while collecting static export paths.`\n );\n }\n\n if (includeGroupVariations) {\n // TODO: Dedupe requests for alias routes.\n addOptionalGroups(filePath, route);\n } else {\n htmlFiles.add({\n filePath,\n route,\n });\n }\n } else if (typeof value === 'object' && value?.screens) {\n const newPath = baseUrl + value.path + '/';\n traverseScreens(value.screens, value._route ?? null, newPath);\n }\n }\n }\n\n function addOptionalGroups(path: string, route: RouteNode) {\n const variations = getPathVariations(path);\n for (const variation of variations) {\n htmlFiles.add({ filePath: variation, route });\n }\n }\n\n traverseScreens(manifest.screens, null);\n\n return uniqueBy(Array.from(htmlFiles), (value) => value.filePath).map((value) => {\n const parts = value.filePath.split('/');\n // Replace `:foo` with `[foo]` and `*foo` with `[...foo]`\n const partsWithGroups = parts.map((part) => {\n if (part === '*not-found') {\n return `+not-found`;\n } else if (part.startsWith(':')) {\n return `[${part.slice(1)}]`;\n } else if (part.startsWith('*')) {\n return `[...${part.slice(1)}]`;\n }\n return part;\n });\n const filePathLocation = partsWithGroups.join('/');\n const filePath = filePathLocation + '.html';\n return {\n ...value,\n filePath,\n pathname: filePathLocation.replace(/(\\/?index)?$/, ''),\n };\n });\n}\n\nfunction uniqueBy<T>(array: T[], key: (value: T) => string): T[] {\n const seen = new Set<string>();\n const result: T[] = [];\n for (const value of array) {\n const id = key(value);\n if (!seen.has(id)) {\n seen.add(id);\n result.push(value);\n }\n }\n return result;\n}\n\n// Given a route like `(foo)/bar/(baz)`, return all possible variations of the route.\n// e.g. `(foo)/bar/(baz)`, `(foo)/bar/baz`, `foo/bar/(baz)`, `foo/bar/baz`,\nexport function getPathVariations(routePath: string): string[] {\n const variations = new Set<string>();\n const segments = routePath.split('/');\n\n function generateVariations(segments: string[], current = ''): void {\n if (segments.length === 0) {\n if (current) variations.add(current);\n return;\n }\n\n const [head, ...rest] = segments;\n\n if (matchGroupName(head)) {\n const groups = head.slice(1, -1).split(',');\n\n if (groups.length > 1) {\n for (const group of groups) {\n // If there are multiple groups, recurse on each group.\n generateVariations([`(${group.trim()})`, ...rest], current);\n }\n return;\n } else {\n // Start a fork where this group is included\n generateVariations(rest, current ? `${current}/(${groups[0]})` : `(${groups[0]})`);\n // This code will continue and add paths without this group included`\n }\n } else if (current) {\n current = `${current}/${head}`;\n } else {\n current = head;\n }\n\n generateVariations(rest, current);\n }\n\n generateVariations(segments);\n\n return Array.from(variations);\n}\n\nasync function exportApiRoutesAsync({\n outputDir,\n server,\n routerRoot,\n baseUrl,\n ...props\n}: {\n outputDir: string;\n server: MetroBundlerDevServer;\n routerRoot: string;\n manifest: ExpoRouterServerManifestV1;\n baseUrl: string;\n}): Promise<ExportAssetMap> {\n const { manifest, files } = await server.exportExpoRouterApiRoutesAsync({\n mode: 'production',\n routerRoot,\n outputDir: '_expo/functions',\n prerenderManifest: props.manifest,\n baseUrl,\n });\n\n Log.log(chalk.bold`Exporting ${files.size} API Routes.`);\n\n files.set('_expo/routes.json', {\n contents: JSON.stringify(manifest, null, 2),\n targetDomain: 'server',\n });\n\n return files;\n}\n\nfunction warnPossibleInvalidExportType(appDir: string) {\n const apiRoutes = getApiRoutesForDirectory(appDir);\n if (apiRoutes.length) {\n // TODO: Allow API Routes for native-only.\n Log.warn(\n chalk.yellow`Skipping export for API routes because \\`web.output\\` is not \"server\". You may want to remove the routes: ${apiRoutes\n .map((v) => path.relative(appDir, v))\n .join(', ')}`\n );\n }\n}\n"],"names":["unstable_exportStaticAsync","getFilesToExportFromServerAsync","getHtmlFiles","getPathVariations","debug","require","projectRoot","options","Log","log","learnMore","port","getFreePortAsync","devServerManager","DevServerManager","minify","mode","location","resetDevServer","clear","maxWorkers","startAsync","type","isExporting","exportFromServerAsync","stopAsync","matchGroupName","name","match","manifest","renderAsync","exportServer","files","Map","Promise","all","includeGroupVariations","map","route","filePath","pathname","targetDomain","set","contents","data","routeId","e","logMetroErrorAsync","error","Error","modifyRouteNodeInRuntimeManifest","callback","iterateScreens","screens","Object","values","value","_route","makeRuntimeEntryPointsAbsolute","appDir","Array","isArray","entryPoints","entryPoint","startsWith","path","resolve","isAbsolute","resolveFrom","outputDir","baseUrl","includeSourceMaps","routerRoot","asyncRoutes","join","injectFaviconTag","getVirtualFaviconAssetsAsync","devServer","getDefaultDevServer","assert","MetroBundlerDevServer","resources","serverManifest","getStaticResourcesAsync","getStaticRenderFunctionAsync","inspect","colors","depth","template","html","serializeHtmlWithAssets","artifacts","getFilesFromSerialAssets","platform","assets","persistMetroAssetsAsync","outputDirectory","apiRoutes","exportApiRoutesAsync","server","warnPossibleInvalidExportType","htmlFiles","Set","traverseScreens","leaf","keys","length","endsWith","slice","addOptionalGroups","add","newPath","variations","variation","uniqueBy","from","parts","split","partsWithGroups","part","filePathLocation","replace","array","key","seen","result","id","has","push","routePath","segments","generateVariations","current","head","rest","groups","group","trim","props","exportExpoRouterApiRoutesAsync","prerenderManifest","chalk","bold","size","JSON","stringify","getApiRoutesForDirectory","warn","yellow","v","relative"],"mappings":"AAMA;;;;QAiDsBA,0BAA0B,GAA1BA,0BAA0B;QA2C1BC,+BAA+B,GAA/BA,+BAA+B;QAmLrCC,YAAY,GAAZA,YAAY;QAwGZC,iBAAiB,GAAjBA,iBAAiB;AAvXd,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AAER,IAAA,KAAM,kCAAN,MAAM,EAAA;AACC,IAAA,YAAc,kCAAd,cAAc,EAAA;AACd,IAAA,KAAM,WAAN,MAAM,CAAA;AAEe,IAAA,QAAW,WAAX,WAAW,CAAA;AAChB,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACL,IAAA,WAAc,WAAd,cAAc,CAAA;AACnD,IAAA,IAAQ,WAAR,QAAQ,CAAA;AACK,IAAA,iBAAkC,WAAlC,kCAAkC,CAAA;AAI5D,IAAA,sBAA6C,WAA7C,6CAA6C,CAAA;AAEjB,IAAA,oBAA2C,WAA3C,2CAA2C,CAAA;AACrC,IAAA,OAA8B,WAA9B,8BAA8B,CAAA;AAC/B,IAAA,cAAqC,WAArC,qCAAqC,CAAA;AACnD,IAAA,KAAe,WAAf,eAAe,CAAA;AACR,IAAA,KAAe,WAAf,eAAe,CAAA;;;;;;AAEhD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,kCAAkC,CAAC,AAAsB,AAAC;AA0BlF,eAAeL,0BAA0B,CAACM,WAAmB,EAAEC,OAAgB,EAAE;IACtFC,IAAG,IAAA,CAACC,GAAG,CACL,CAAC,6BAA6B,CAAC,GAC7BC,CAAAA,GAAAA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