@expo/cli 0.13.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +30 -27
- package/build/bin/cli.map +1 -1
- package/build/src/api/getVersions.js.map +1 -1
- package/build/src/api/rest/cache/response.js.map +1 -1
- package/build/src/api/rest/client.js +2 -2
- package/build/src/api/rest/client.js.map +1 -1
- package/build/src/config/configAsync.js +1 -1
- package/build/src/config/configAsync.js.map +1 -1
- package/build/src/config/index.js +2 -2
- package/build/src/config/index.js.map +1 -1
- package/build/src/customize/generate.js +1 -1
- package/build/src/customize/generate.js.map +1 -1
- package/build/src/customize/typescript.js +6 -4
- package/build/src/customize/typescript.js.map +1 -1
- package/build/src/export/createMetadataJson.js +3 -2
- package/build/src/export/createMetadataJson.js.map +1 -1
- package/build/src/export/embed/exportEmbedAsync.js +44 -17
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/export/embed/index.js +4 -4
- package/build/src/export/embed/index.js.map +1 -1
- package/build/src/export/embed/resolveOptions.js +3 -3
- package/build/src/export/embed/resolveOptions.js.map +1 -1
- package/build/src/export/exportApp.js +74 -83
- package/build/src/export/exportApp.js.map +1 -1
- package/build/src/export/exportAssets.js +81 -21
- package/build/src/export/exportAssets.js.map +1 -1
- package/build/src/export/exportHermes.js +24 -14
- package/build/src/export/exportHermes.js.map +1 -1
- package/build/src/export/exportStaticAsync.js +109 -58
- package/build/src/export/exportStaticAsync.js.map +1 -1
- package/build/src/export/favicon.js +2 -2
- package/build/src/export/favicon.js.map +1 -1
- package/build/src/export/fork-bundleAsync.js +56 -23
- package/build/src/export/fork-bundleAsync.js.map +1 -1
- package/build/src/export/index.js +11 -9
- package/build/src/export/index.js.map +1 -1
- package/build/src/export/metroAssetLocalPath.js +101 -0
- package/build/src/export/metroAssetLocalPath.js.map +1 -0
- package/build/src/export/persistMetroAssets.js +94 -21
- package/build/src/export/persistMetroAssets.js.map +1 -1
- package/build/src/export/resolveOptions.js +1 -1
- package/build/src/export/resolveOptions.js.map +1 -1
- package/build/src/export/saveAssets.js +9 -48
- package/build/src/export/saveAssets.js.map +1 -1
- package/build/src/export/web/exportWebAsync.js +1 -1
- package/build/src/export/web/exportWebAsync.js.map +1 -1
- package/build/src/export/web/index.js +2 -2
- package/build/src/export/web/index.js.map +1 -1
- package/build/src/export/writeContents.js +6 -3
- package/build/src/export/writeContents.js.map +1 -1
- package/build/src/install/applyPlugins.js +52 -0
- package/build/src/install/applyPlugins.js.map +1 -0
- package/build/src/install/checkPackages.js +2 -2
- package/build/src/install/checkPackages.js.map +1 -1
- package/build/src/install/fixPackages.js +84 -0
- package/build/src/install/fixPackages.js.map +1 -0
- package/build/src/install/installAsync.js +32 -61
- package/build/src/install/installAsync.js.map +1 -1
- package/build/src/install/installExpoPackage.js +79 -0
- package/build/src/install/installExpoPackage.js.map +1 -0
- package/build/src/login/index.js +1 -1
- package/build/src/login/index.js.map +1 -1
- package/build/src/logout/index.js +1 -1
- package/build/src/logout/index.js.map +1 -1
- package/build/src/prebuild/clearNativeFolder.js +1 -1
- package/build/src/prebuild/clearNativeFolder.js.map +1 -1
- package/build/src/prebuild/configureProjectAsync.js +3 -3
- package/build/src/prebuild/configureProjectAsync.js.map +1 -1
- package/build/src/prebuild/copyTemplateFiles.js +21 -30
- package/build/src/prebuild/copyTemplateFiles.js.map +1 -1
- package/build/src/prebuild/index.js +3 -3
- package/build/src/prebuild/index.js.map +1 -1
- package/build/src/prebuild/prebuildAsync.js +39 -17
- package/build/src/prebuild/prebuildAsync.js.map +1 -1
- package/build/src/prebuild/resolveOptions.js +2 -2
- package/build/src/prebuild/resolveOptions.js.map +1 -1
- package/build/src/prebuild/updateFromTemplate.js +6 -6
- package/build/src/prebuild/updateFromTemplate.js.map +1 -1
- package/build/src/prebuild/updatePackageJson.js +49 -36
- package/build/src/prebuild/updatePackageJson.js.map +1 -1
- package/build/src/prebuild/validateTemplatePlatforms.js +2 -2
- package/build/src/prebuild/validateTemplatePlatforms.js.map +1 -1
- package/build/src/register/index.js +1 -1
- package/build/src/register/index.js.map +1 -1
- package/build/src/run/android/index.js +2 -2
- package/build/src/run/android/index.js.map +1 -1
- package/build/src/run/ios/appleDevice/AppleDevice.js +35 -2
- package/build/src/run/ios/appleDevice/AppleDevice.js.map +1 -1
- package/build/src/run/ios/index.js +2 -2
- package/build/src/run/ios/index.js.map +1 -1
- package/build/src/start/doctor/dependencies/getVersionedPackages.js +12 -4
- package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +20 -3
- package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
- package/build/src/start/index.js +3 -3
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/interface/interactiveActions.js +30 -11
- package/build/src/start/interface/interactiveActions.js.map +1 -1
- package/build/src/start/server/BundlerDevServer.js +14 -10
- package/build/src/start/server/BundlerDevServer.js.map +1 -1
- package/build/src/start/server/DevServerManager.js +6 -1
- package/build/src/start/server/DevServerManager.js.map +1 -1
- package/build/src/start/server/DevToolsPluginManager.js +63 -0
- package/build/src/start/server/DevToolsPluginManager.js.map +1 -0
- package/build/src/start/server/getStaticRenderFunctions.js +21 -20
- package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +67 -64
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/bundleApiRoutes.js +4 -19
- package/build/src/start/server/metro/bundleApiRoutes.js.map +1 -1
- package/build/src/start/server/metro/createExpoMetroResolver.js +187 -0
- package/build/src/start/server/metro/createExpoMetroResolver.js.map +1 -0
- package/build/src/start/server/metro/createJResolver.js +149 -0
- package/build/src/start/server/metro/createJResolver.js.map +1 -0
- package/build/src/start/server/metro/createServerRouteMiddleware.js +13 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/externals.js +25 -3
- package/build/src/start/server/metro/externals.js.map +1 -1
- package/build/src/start/server/metro/fetchRouterManifest.js.map +1 -1
- package/build/src/start/server/metro/formatFileCandidates.js +72 -0
- package/build/src/start/server/metro/formatFileCandidates.js.map +1 -0
- package/build/src/start/server/metro/inspector-proxy/device.js +3 -1
- package/build/src/start/server/metro/inspector-proxy/device.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js +3 -4
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeDebuggerGetPossibleBreakpoints.js.map +1 -1
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.js +24 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/VscodeRuntimeCallFunctionOn.js.map +1 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/utils.js +11 -0
- package/build/src/start/server/metro/inspector-proxy/handlers/utils.js.map +1 -0
- package/build/src/start/server/metro/inspector-proxy/index.js +10 -7
- package/build/src/start/server/metro/inspector-proxy/index.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +37 -16
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/metro/metroErrorInterface.js +3 -2
- package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
- package/build/src/start/server/metro/router.js +6 -3
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/runServer-fork.js +19 -10
- package/build/src/start/server/metro/runServer-fork.js.map +1 -1
- package/build/src/start/server/metro/serializeHtml.js +43 -0
- package/build/src/start/server/metro/serializeHtml.js.map +1 -0
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +1 -2
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/start/server/metro/withMetroMultiPlatform.js +268 -191
- package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
- package/build/src/start/server/metro/withMetroResolvers.js +114 -40
- package/build/src/start/server/metro/withMetroResolvers.js.map +1 -1
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js +61 -0
- package/build/src/start/server/middleware/DevToolsPluginMiddleware.js.map +1 -0
- package/build/src/start/server/middleware/ExpoMiddleware.js +2 -2
- package/build/src/start/server/middleware/ExpoMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/ManifestMiddleware.js +45 -68
- package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js +1 -1
- package/build/src/start/server/middleware/inspector/JsInspector.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js +30 -26
- package/build/src/start/server/middleware/inspector/LaunchBrowser.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js +7 -7
- package/build/src/start/server/middleware/inspector/LaunchBrowser.types.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js +5 -2
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplLinux.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js +3 -2
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplMacOS.js.map +1 -1
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js +8 -7
- package/build/src/start/server/middleware/inspector/LaunchBrowserImplWindows.js.map +1 -1
- package/build/src/start/server/middleware/metroOptions.js +123 -0
- package/build/src/start/server/middleware/metroOptions.js.map +1 -0
- package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -1
- package/build/src/start/server/type-generation/expo-env.js +1 -1
- package/build/src/start/server/type-generation/expo-env.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +1 -0
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/utils/analytics/getMetroDebugProperties.js +1 -2
- package/build/src/utils/analytics/getMetroDebugProperties.js.map +1 -1
- package/build/src/utils/analytics/getMetroProperties.js +1 -2
- package/build/src/utils/analytics/getMetroProperties.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/args.js +4 -2
- package/build/src/utils/args.js.map +1 -1
- package/build/src/utils/cocoapods.js +2 -1
- package/build/src/utils/cocoapods.js.map +1 -1
- package/build/src/utils/dir.js +18 -8
- package/build/src/utils/dir.js.map +1 -1
- package/build/src/utils/env.js +6 -0
- package/build/src/utils/env.js.map +1 -1
- package/build/src/utils/getOrPromptApplicationId.js +2 -4
- package/build/src/utils/getOrPromptApplicationId.js.map +1 -1
- package/build/src/utils/prompts.js +1 -28
- package/build/src/utils/prompts.js.map +1 -1
- package/build/src/whoami/index.js +1 -1
- package/build/src/whoami/index.js.map +1 -1
- package/package.json +16 -16
- package/static/shims/react-native-web/dist/cjs/exports/AppRegistry/AppContainer.js +13 -0
- package/static/shims/react-native-web/dist/cjs/exports/BackHandler/index.js +10 -0
- package/static/shims/react-native-web/dist/exports/AppRegistry/AppContainer.js +12 -0
- package/static/shims/react-native-web/dist/exports/BackHandler/index.js +7 -0
- package/build/src/export/createBundles.js +0 -37
- package/build/src/export/createBundles.js.map +0 -1
- package/build/src/start/server/metro/resolveFromProject.js +0 -90
- package/build/src/start/server/metro/resolveFromProject.js.map +0 -1
- package/build/src/start/server/middleware/resolveEntryPoint.js +0 -42
- package/build/src/start/server/middleware/resolveEntryPoint.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/saveAssets.ts"],"sourcesContent":["import path from 'path';\n\nimport { BundleAssetWithFileHashes } from './fork-bundleAsync';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/export/saveAssets.ts"],"sourcesContent":["import path from 'path';\n\nimport { BundleAssetWithFileHashes } from './fork-bundleAsync';\nimport { copyInBatchesAsync } from './persistMetroAssets';\n\nexport type ManifestAsset = { fileHashes: string[]; files: string[]; hash: string };\n\nexport type Asset = ManifestAsset | BundleAssetWithFileHashes;\n\nexport async function saveAssetsAsync({\n assets,\n outputDir,\n}: {\n assets: Asset[];\n outputDir: string;\n}) {\n const paths: Record<string, string> = {};\n const hashes = new Set<string>();\n assets.forEach((asset) => {\n asset.files.forEach((fp: string, index: number) => {\n const hash = asset.fileHashes[index];\n if (hashes.has(hash)) return;\n hashes.add(hash);\n paths[fp] = path.join(outputDir, 'assets', hash);\n });\n });\n\n await copyInBatchesAsync(paths);\n}\n"],"names":["saveAssetsAsync","assets","outputDir","paths","hashes","Set","forEach","asset","files","fp","index","hash","fileHashes","has","add","path","join","copyInBatchesAsync"],"mappings":"AAAA;;;;QASsBA,eAAe,GAAfA,eAAe;AATpB,IAAA,KAAM,kCAAN,MAAM,EAAA;AAGY,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;;;;;;AAMlD,eAAeA,eAAe,CAAC,EACpCC,MAAM,CAAA,EACNC,SAAS,CAAA,EAIV,EAAE;IACD,MAAMC,KAAK,GAA2B,EAAE,AAAC;IACzC,MAAMC,MAAM,GAAG,IAAIC,GAAG,EAAU,AAAC;IACjCJ,MAAM,CAACK,OAAO,CAAC,CAACC,KAAK,GAAK;QACxBA,KAAK,CAACC,KAAK,CAACF,OAAO,CAAC,CAACG,EAAU,EAAEC,KAAa,GAAK;YACjD,MAAMC,IAAI,GAAGJ,KAAK,CAACK,UAAU,CAACF,KAAK,CAAC,AAAC;YACrC,IAAIN,MAAM,CAACS,GAAG,CAACF,IAAI,CAAC,EAAE,OAAO;YAC7BP,MAAM,CAACU,GAAG,CAACH,IAAI,CAAC,CAAC;YACjBR,KAAK,CAACM,EAAE,CAAC,GAAGM,KAAI,QAAA,CAACC,IAAI,CAACd,SAAS,EAAE,QAAQ,EAAES,IAAI,CAAC,CAAC;SAClD,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,MAAMM,CAAAA,GAAAA,mBAAkB,AAAO,CAAA,mBAAP,CAACd,KAAK,CAAC,CAAC;CACjC"}
|
|
@@ -24,7 +24,7 @@ async function exportWebAsync(projectRoot, options) {
|
|
|
24
24
|
const { exp } = (0, _config).getConfig(projectRoot);
|
|
25
25
|
const platformBundlers = (0, _platformBundlers).getPlatformBundlers(exp);
|
|
26
26
|
// Create a bundler interface
|
|
27
|
-
const bundler = new _webpackBundlerDevServer.WebpackBundlerDevServer(projectRoot, platformBundlers
|
|
27
|
+
const bundler = new _webpackBundlerDevServer.WebpackBundlerDevServer(projectRoot, platformBundlers);
|
|
28
28
|
// If the user set `web.bundler: 'metro'` then they should use `expo export` instead.
|
|
29
29
|
if (!bundler.isTargetingWeb()) {
|
|
30
30
|
throw new _errors.CommandError(_chalk.default`{bold expo export:web} can only be used with Webpack. Use {bold expo export} for other bundlers.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/export/web/exportWebAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\n\nimport { Options } from './resolveOptions';\nimport { Log } from '../../log';\nimport { WebSupportProjectPrerequisite } from '../../start/doctor/web/WebSupportProjectPrerequisite';\nimport { getPlatformBundlers } from '../../start/server/platformBundlers';\nimport { WebpackBundlerDevServer } from '../../start/server/webpack/WebpackBundlerDevServer';\nimport { CommandError } from '../../utils/errors';\nimport { setNodeEnv } from '../../utils/nodeEnv';\n\nexport async function exportWebAsync(projectRoot: string, options: Options) {\n // Ensure webpack is available\n await new WebSupportProjectPrerequisite(projectRoot).assertAsync();\n\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n const { exp } = getConfig(projectRoot);\n const platformBundlers = getPlatformBundlers(exp);\n // Create a bundler interface\n const bundler = new WebpackBundlerDevServer(projectRoot, platformBundlers
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/web/exportWebAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\n\nimport { Options } from './resolveOptions';\nimport { Log } from '../../log';\nimport { WebSupportProjectPrerequisite } from '../../start/doctor/web/WebSupportProjectPrerequisite';\nimport { getPlatformBundlers } from '../../start/server/platformBundlers';\nimport { WebpackBundlerDevServer } from '../../start/server/webpack/WebpackBundlerDevServer';\nimport { CommandError } from '../../utils/errors';\nimport { setNodeEnv } from '../../utils/nodeEnv';\n\nexport async function exportWebAsync(projectRoot: string, options: Options) {\n // Ensure webpack is available\n await new WebSupportProjectPrerequisite(projectRoot).assertAsync();\n\n setNodeEnv(options.dev ? 'development' : 'production');\n require('@expo/env').load(projectRoot);\n\n const { exp } = getConfig(projectRoot);\n const platformBundlers = getPlatformBundlers(exp);\n // Create a bundler interface\n const bundler = new WebpackBundlerDevServer(projectRoot, platformBundlers);\n\n // If the user set `web.bundler: 'metro'` then they should use `expo export` instead.\n if (!bundler.isTargetingWeb()) {\n throw new CommandError(\n chalk`{bold expo export:web} can only be used with Webpack. Use {bold expo export} for other bundlers.`\n );\n }\n\n Log.log(`Exporting with Webpack...`);\n\n // Bundle the app\n await bundler.bundleAsync({\n mode: options.dev ? 'development' : 'production',\n clear: options.clear,\n });\n}\n"],"names":["exportWebAsync","projectRoot","options","WebSupportProjectPrerequisite","assertAsync","setNodeEnv","dev","require","load","exp","getConfig","platformBundlers","getPlatformBundlers","bundler","WebpackBundlerDevServer","isTargetingWeb","CommandError","chalk","Log","log","bundleAsync","mode","clear"],"mappings":"AAAA;;;;QAWsBA,cAAc,GAAdA,cAAc;AAXV,IAAA,OAAc,WAAd,cAAc,CAAA;AACtB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAGL,IAAA,IAAW,WAAX,WAAW,CAAA;AACe,IAAA,8BAAsD,WAAtD,sDAAsD,CAAA;AAChE,IAAA,iBAAqC,WAArC,qCAAqC,CAAA;AACjC,IAAA,wBAAoD,WAApD,oDAAoD,CAAA;AAC/D,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AACtB,IAAA,QAAqB,WAArB,qBAAqB,CAAA;;;;;;AAEzC,eAAeA,cAAc,CAACC,WAAmB,EAAEC,OAAgB,EAAE;IAC1E,8BAA8B;IAC9B,MAAM,IAAIC,8BAA6B,8BAAA,CAACF,WAAW,CAAC,CAACG,WAAW,EAAE,CAAC;IAEnEC,CAAAA,GAAAA,QAAU,AAA4C,CAAA,WAA5C,CAACH,OAAO,CAACI,GAAG,GAAG,aAAa,GAAG,YAAY,CAAC,CAAC;IACvDC,OAAO,CAAC,WAAW,CAAC,CAACC,IAAI,CAACP,WAAW,CAAC,CAAC;IAEvC,MAAM,EAAEQ,GAAG,CAAA,EAAE,GAAGC,CAAAA,GAAAA,OAAS,AAAa,CAAA,UAAb,CAACT,WAAW,CAAC,AAAC;IACvC,MAAMU,gBAAgB,GAAGC,CAAAA,GAAAA,iBAAmB,AAAK,CAAA,oBAAL,CAACH,GAAG,CAAC,AAAC;IAClD,6BAA6B;IAC7B,MAAMI,OAAO,GAAG,IAAIC,wBAAuB,wBAAA,CAACb,WAAW,EAAEU,gBAAgB,CAAC,AAAC;IAE3E,qFAAqF;IACrF,IAAI,CAACE,OAAO,CAACE,cAAc,EAAE,EAAE;QAC7B,MAAM,IAAIC,OAAY,aAAA,CACpBC,MAAK,QAAA,CAAC,gGAAgG,CAAC,CACxG,CAAC;KACH;IAEDC,IAAG,IAAA,CAACC,GAAG,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC;IAErC,iBAAiB;IACjB,MAAMN,OAAO,CAACO,WAAW,CAAC;QACxBC,IAAI,EAAEnB,OAAO,CAACI,GAAG,GAAG,aAAa,GAAG,YAAY;QAChDgB,KAAK,EAAEpB,OAAO,CAACoB,KAAK;KACrB,CAAC,CAAC;CACJ"}
|
|
@@ -53,11 +53,11 @@ const expoExportWeb = async (argv)=>{
|
|
|
53
53
|
}
|
|
54
54
|
const projectRoot = (0, _args).getProjectRoot(args);
|
|
55
55
|
const { resolveOptionsAsync } = await Promise.resolve().then(function() {
|
|
56
|
-
return _interopRequireWildcard(require("./resolveOptions"));
|
|
56
|
+
return _interopRequireWildcard(require("./resolveOptions.js"));
|
|
57
57
|
});
|
|
58
58
|
const options = await resolveOptionsAsync(args).catch(_errors.logCmdError);
|
|
59
59
|
const { exportWebAsync } = await Promise.resolve().then(function() {
|
|
60
|
-
return _interopRequireWildcard(require("./exportWebAsync"));
|
|
60
|
+
return _interopRequireWildcard(require("./exportWebAsync.js"));
|
|
61
61
|
});
|
|
62
62
|
return exportWebAsync(projectRoot, options).catch(_errors.logCmdError);
|
|
63
63
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/export/web/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../../utils/args';\nimport { logCmdError } from '../../utils/errors';\n\nexport const expoExportWeb: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clear': Boolean,\n '--dev': Boolean,\n // Aliases\n '-h': '--help',\n '-c': '--clear',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Export the static files of the web app for hosting on a web server`,\n chalk`npx expo export:web {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `--dev Bundle in development mode`,\n `-c, --clear Clear the bundler cache`,\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n const projectRoot = getProjectRoot(args);\n const { resolveOptionsAsync } = await import('./resolveOptions');\n const options = await resolveOptionsAsync(args).catch(logCmdError);\n\n const { exportWebAsync } = await import('./exportWebAsync');\n return exportWebAsync(projectRoot, options).catch(logCmdError);\n};\n"],"names":["expoExportWeb","argv","args","assertArgs","Boolean","printHelp","chalk","join","projectRoot","getProjectRoot","resolveOptionsAsync","options","catch","logCmdError","exportWebAsync"],"mappings":"AAAA;;;;;;AACkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAG6B,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AAC5C,IAAA,OAAoB,WAApB,oBAAoB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzC,MAAMA,aAAa,GAAY,OAAOC,IAAI,GAAK;IACpD,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAU,AAWtB,CAAA,WAXsB,CACrB;QACE,QAAQ;QACR,QAAQ,EAAEC,OAAO;QACjB,SAAS,EAAEA,OAAO;QAClB,OAAO,EAAEA,OAAO;QAChB,UAAU;QACV,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,SAAS;KAChB,EACDH,IAAI,CACL,AAAC;IAEF,IAAIC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAClBG,CAAAA,GAAAA,KAAS,AASR,CAAA,UATQ,CACP,CAAC,kEAAkE,CAAC,EACpEC,MAAK,QAAA,CAAC,+BAA+B,CAAC,EACtC;YACEA,MAAK,QAAA,CAAC,qGAAqG,CAAC;YAC5G,CAAC,wDAAwD,CAAC;YAC1D,CAAC,qDAAqD,CAAC;YACvD,CAAC,wCAAwC,CAAC;SAC3C,CAACC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;KACH;IAED,MAAMC,WAAW,GAAGC,CAAAA,GAAAA,KAAc,AAAM,CAAA,eAAN,CAACP,IAAI,CAAC,AAAC;IACzC,MAAM,EAAEQ,mBAAmB,CAAA,EAAE,GAAG,MAAM;+CAAO,
|
|
1
|
+
{"version":3,"sources":["../../../../src/export/web/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk';\n\nimport { Command } from '../../../bin/cli';\nimport { assertArgs, getProjectRoot, printHelp } from '../../utils/args';\nimport { logCmdError } from '../../utils/errors';\n\nexport const expoExportWeb: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clear': Boolean,\n '--dev': Boolean,\n // Aliases\n '-h': '--help',\n '-c': '--clear',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Export the static files of the web app for hosting on a web server`,\n chalk`npx expo export:web {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `--dev Bundle in development mode`,\n `-c, --clear Clear the bundler cache`,\n `-h, --help Usage info`,\n ].join('\\n')\n );\n }\n\n const projectRoot = getProjectRoot(args);\n const { resolveOptionsAsync } = await import('./resolveOptions.js');\n const options = await resolveOptionsAsync(args).catch(logCmdError);\n\n const { exportWebAsync } = await import('./exportWebAsync.js');\n return exportWebAsync(projectRoot, options).catch(logCmdError);\n};\n"],"names":["expoExportWeb","argv","args","assertArgs","Boolean","printHelp","chalk","join","projectRoot","getProjectRoot","resolveOptionsAsync","options","catch","logCmdError","exportWebAsync"],"mappings":"AAAA;;;;;;AACkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAG6B,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AAC5C,IAAA,OAAoB,WAApB,oBAAoB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzC,MAAMA,aAAa,GAAY,OAAOC,IAAI,GAAK;IACpD,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAU,AAWtB,CAAA,WAXsB,CACrB;QACE,QAAQ;QACR,QAAQ,EAAEC,OAAO;QACjB,SAAS,EAAEA,OAAO;QAClB,OAAO,EAAEA,OAAO;QAChB,UAAU;QACV,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,SAAS;KAChB,EACDH,IAAI,CACL,AAAC;IAEF,IAAIC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAClBG,CAAAA,GAAAA,KAAS,AASR,CAAA,UATQ,CACP,CAAC,kEAAkE,CAAC,EACpEC,MAAK,QAAA,CAAC,+BAA+B,CAAC,EACtC;YACEA,MAAK,QAAA,CAAC,qGAAqG,CAAC;YAC5G,CAAC,wDAAwD,CAAC;YAC1D,CAAC,qDAAqD,CAAC;YACvD,CAAC,wCAAwC,CAAC;SAC3C,CAACC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;KACH;IAED,MAAMC,WAAW,GAAGC,CAAAA,GAAAA,KAAc,AAAM,CAAA,eAAN,CAACP,IAAI,CAAC,AAAC;IACzC,MAAM,EAAEQ,mBAAmB,CAAA,EAAE,GAAG,MAAM;+CAAO,qBAAqB;MAAC,AAAC;IACpE,MAAMC,OAAO,GAAG,MAAMD,mBAAmB,CAACR,IAAI,CAAC,CAACU,KAAK,CAACC,OAAW,YAAA,CAAC,AAAC;IAEnE,MAAM,EAAEC,cAAc,CAAA,EAAE,GAAG,MAAM;+CAAO,qBAAqB;MAAC,AAAC;IAC/D,OAAOA,cAAc,CAACN,WAAW,EAAEG,OAAO,CAAC,CAACC,KAAK,CAACC,OAAW,YAAA,CAAC,CAAC;CAChE,AAAC;QAjCWb,aAAa,GAAbA,aAAa"}
|
|
@@ -58,6 +58,7 @@ async function writeBundlesAsync({ bundles , outputDir , useServerRendering })
|
|
|
58
58
|
}
|
|
59
59
|
async function writeSourceMapsAsync({ bundles , hashes , fileNames , outputDir }) {
|
|
60
60
|
return (await Promise.all(Object.entries(bundles).map(async ([platform, bundle])=>{
|
|
61
|
+
if (!bundle) return null;
|
|
61
62
|
var _hermesSourcemap;
|
|
62
63
|
const sourceMap = (_hermesSourcemap = bundle.hermesSourcemap) != null ? _hermesSourcemap : bundle.map;
|
|
63
64
|
if (!sourceMap) {
|
|
@@ -87,10 +88,11 @@ async function writeSourceMapsAsync({ bundles , hashes , fileNames , outputDir
|
|
|
87
88
|
};
|
|
88
89
|
}))).filter(Boolean);
|
|
89
90
|
}
|
|
90
|
-
async function writeMetadataJsonAsync({ outputDir , bundles , fileNames }) {
|
|
91
|
+
async function writeMetadataJsonAsync({ outputDir , bundles , fileNames , embeddedHashSet }) {
|
|
91
92
|
const contents = (0, _createMetadataJson).createMetadataJson({
|
|
92
93
|
bundles,
|
|
93
|
-
fileNames
|
|
94
|
+
fileNames,
|
|
95
|
+
embeddedHashSet
|
|
94
96
|
});
|
|
95
97
|
const metadataPath = _path.default.join(outputDir, "metadata.json");
|
|
96
98
|
debug(`Writing metadata.json to ${metadataPath}`);
|
|
@@ -110,7 +112,8 @@ async function writeAssetMapAsync({ outputDir , assets }) {
|
|
|
110
112
|
async function writeDebugHtmlAsync({ outputDir , fileNames }) {
|
|
111
113
|
// Make a debug html so user can debug their bundles
|
|
112
114
|
const contents = `
|
|
113
|
-
${Object.values(fileNames).
|
|
115
|
+
${Object.values(fileNames).filter((value)=>value != null
|
|
116
|
+
).map((fileName)=>`<script src="${_path.default.join("bundles", fileName)}"></script>`
|
|
114
117
|
).join("\n ")}
|
|
115
118
|
Open up this file in Chrome. In the JavaScript developer console, navigate to the Source tab.
|
|
116
119
|
You can see a red colored folder containing the original source code from your bundle.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/writeContents.ts"],"sourcesContent":["import { Platform } from '@expo/config';\nimport crypto from 'crypto';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { createMetadataJson } from './createMetadataJson';\nimport { BundleOutput } from './fork-bundleAsync';\nimport { Asset } from './saveAssets';\n\nconst debug = require('debug')('expo:export:write') as typeof console.log;\n\n/**\n * @param props.platform native platform for the bundle\n * @param props.format extension to use for the name\n * @param props.hash crypto hash for the bundle contents\n * @returns filename for the JS bundle.\n */\nfunction createBundleFileName({\n platform,\n format,\n hash,\n}: {\n platform: string;\n format: 'javascript' | 'bytecode';\n hash: string;\n}): string {\n return `${platform}-${hash}.${format === 'javascript' ? 'js' : 'hbc'}`;\n}\n\n/**\n * @param bundle JS bundle as a string\n * @returns crypto hash for the provided bundle\n */\nfunction createBundleHash(bundle: string | Uint8Array): string {\n return crypto.createHash('md5').update(bundle).digest('hex');\n}\n\nexport async function writeBundlesAsync({\n bundles,\n outputDir,\n useServerRendering,\n}: {\n bundles: Partial<Record<Platform, Pick<BundleOutput, 'hermesBytecodeBundle' | 'code'>>>;\n outputDir: string;\n useServerRendering?: boolean;\n}) {\n const hashes: Partial<Record<Platform, string>> = {};\n const fileNames: Partial<Record<Platform, string>> = {};\n\n for (const [platform, bundleOutput] of Object.entries(bundles) as [\n Platform,\n Pick<BundleOutput, 'hermesBytecodeBundle' | 'code'>,\n ][]) {\n // TODO: Move native to use the newer `_expo/...` bundle writing system.\n if (platform === 'web' && useServerRendering) {\n continue;\n }\n const bundle = bundleOutput.hermesBytecodeBundle ?? bundleOutput.code;\n const hash = createBundleHash(bundle);\n const fileName = createBundleFileName({\n platform,\n format: bundleOutput.hermesBytecodeBundle ? 'bytecode' : 'javascript',\n hash,\n });\n\n hashes[platform] = hash;\n fileNames[platform] = fileName;\n await fs.writeFile(path.join(outputDir, fileName), bundle);\n }\n\n return { hashes, fileNames };\n}\n\ntype SourceMapWriteResult = {\n platform: string;\n fileName: string;\n hash: string;\n map: string;\n comment: string;\n};\n\nexport async function writeSourceMapsAsync({\n bundles,\n hashes,\n fileNames,\n outputDir,\n}: {\n bundles: Record<\n string,\n Pick<BundleOutput, 'hermesSourcemap' | 'map' | 'hermesBytecodeBundle' | 'code'>\n >;\n hashes?: Record<string, string>;\n fileNames?: Record<string, string>;\n outputDir: string;\n}): Promise<SourceMapWriteResult[]> {\n return (\n await Promise.all(\n Object.entries(bundles).map(async ([platform, bundle]) => {\n const sourceMap = bundle.hermesSourcemap ?? bundle.map;\n if (!sourceMap) {\n debug(`Skip writing sourcemap (platform: ${platform})`);\n return null;\n }\n\n const hash =\n hashes?.[platform] ?? createBundleHash(bundle.hermesBytecodeBundle ?? bundle.code);\n const mapName = `${platform}-${hash}.map`;\n await fs.writeFile(path.join(outputDir, mapName), sourceMap);\n\n const jsBundleFileName =\n fileNames?.[platform] ??\n createBundleFileName({\n platform,\n format: bundle.hermesBytecodeBundle ? 'bytecode' : 'javascript',\n hash,\n });\n const jsPath = path.join(outputDir, jsBundleFileName);\n\n // Add correct mapping to sourcemap paths\n const mappingComment = `\\n//# sourceMappingURL=${mapName}`;\n await fs.appendFile(jsPath, mappingComment);\n return {\n platform,\n fileName: mapName,\n hash,\n map: sourceMap,\n comment: mappingComment,\n };\n })\n )\n ).filter(Boolean) as SourceMapWriteResult[];\n}\n\nexport async function writeMetadataJsonAsync({\n outputDir,\n bundles,\n fileNames,\n}: {\n outputDir: string;\n bundles: Record<string, Pick<BundleOutput, 'assets'>>;\n fileNames: Record<string, string>;\n}) {\n const contents = createMetadataJson({\n bundles,\n fileNames,\n });\n const metadataPath = path.join(outputDir, 'metadata.json');\n debug(`Writing metadata.json to ${metadataPath}`);\n await fs.writeFile(metadataPath, JSON.stringify(contents));\n return contents;\n}\n\nexport async function writeAssetMapAsync({\n outputDir,\n assets,\n}: {\n outputDir: string;\n assets: Asset[];\n}) {\n // Convert the assets array to a k/v pair where the asset hash is the key and the asset is the value.\n const contents = Object.fromEntries(assets.map((asset) => [asset.hash, asset]));\n await fs.writeFile(path.join(outputDir, 'assetmap.json'), JSON.stringify(contents));\n return contents;\n}\n\nexport async function writeDebugHtmlAsync({\n outputDir,\n fileNames,\n}: {\n outputDir: string;\n fileNames: Record<string, string>;\n}) {\n // Make a debug html so user can debug their bundles\n const contents = `\n ${Object.values(fileNames)\n .map((fileName) => `<script src=\"${path.join('bundles', fileName)}\"></script>`)\n .join('\\n ')}\n Open up this file in Chrome. In the JavaScript developer console, navigate to the Source tab.\n You can see a red colored folder containing the original source code from your bundle.\n `;\n\n await fs.writeFile(path.join(outputDir, 'debug.html'), contents);\n return contents;\n}\n"],"names":["writeBundlesAsync","writeSourceMapsAsync","writeMetadataJsonAsync","writeAssetMapAsync","writeDebugHtmlAsync","debug","require","createBundleFileName","platform","format","hash","createBundleHash","bundle","crypto","createHash","update","digest","bundles","outputDir","useServerRendering","hashes","fileNames","bundleOutput","Object","entries","hermesBytecodeBundle","code","fileName","fs","writeFile","path","join","Promise","all","map","sourceMap","hermesSourcemap","mapName","jsBundleFileName","jsPath","mappingComment","appendFile","comment","filter","Boolean","contents","createMetadataJson","metadataPath","JSON","stringify","assets","fromEntries","asset","values"],"mappings":"AAAA;;;;QAqCsBA,iBAAiB,GAAjBA,iBAAiB;QA4CjBC,oBAAoB,GAApBA,oBAAoB;QAoDpBC,sBAAsB,GAAtBA,sBAAsB;QAmBtBC,kBAAkB,GAAlBA,kBAAkB;QAalBC,mBAA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,IAAI,CAACb,SAAS,EAAE,YAAY,CAAC,EAAE2B,QAAQ,CAAC,CAAC;IACjE,OAAOA,QAAQ,CAAC;CACjB"}
|
|
1
|
+
{"version":3,"sources":["../../../src/export/writeContents.ts"],"sourcesContent":["import { Platform } from '@expo/config';\nimport crypto from 'crypto';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { createMetadataJson } from './createMetadataJson';\nimport { BundleOutput } from './fork-bundleAsync';\nimport { Asset } from './saveAssets';\n\nconst debug = require('debug')('expo:export:write') as typeof console.log;\n\n/**\n * @param props.platform native platform for the bundle\n * @param props.format extension to use for the name\n * @param props.hash crypto hash for the bundle contents\n * @returns filename for the JS bundle.\n */\nfunction createBundleFileName({\n platform,\n format,\n hash,\n}: {\n platform: string;\n format: 'javascript' | 'bytecode';\n hash: string;\n}): string {\n return `${platform}-${hash}.${format === 'javascript' ? 'js' : 'hbc'}`;\n}\n\n/**\n * @param bundle JS bundle as a string\n * @returns crypto hash for the provided bundle\n */\nfunction createBundleHash(bundle: string | Uint8Array): string {\n return crypto.createHash('md5').update(bundle).digest('hex');\n}\n\nexport async function writeBundlesAsync({\n bundles,\n outputDir,\n useServerRendering,\n}: {\n bundles: Partial<Record<Platform, Pick<BundleOutput, 'hermesBytecodeBundle' | 'code'>>>;\n outputDir: string;\n useServerRendering?: boolean;\n}) {\n const hashes: Partial<Record<Platform, string>> = {};\n const fileNames: Partial<Record<Platform, string>> = {};\n\n for (const [platform, bundleOutput] of Object.entries(bundles) as [\n Platform,\n Pick<BundleOutput, 'hermesBytecodeBundle' | 'code'>,\n ][]) {\n // TODO: Move native to use the newer `_expo/...` bundle writing system.\n if (platform === 'web' && useServerRendering) {\n continue;\n }\n const bundle = bundleOutput.hermesBytecodeBundle ?? bundleOutput.code;\n const hash = createBundleHash(bundle);\n const fileName = createBundleFileName({\n platform,\n format: bundleOutput.hermesBytecodeBundle ? 'bytecode' : 'javascript',\n hash,\n });\n\n hashes[platform] = hash;\n fileNames[platform] = fileName;\n await fs.writeFile(path.join(outputDir, fileName), bundle);\n }\n\n return { hashes, fileNames };\n}\n\ntype SourceMapWriteResult = {\n platform: string;\n fileName: string;\n hash: string;\n map: string;\n comment: string;\n};\n\nexport async function writeSourceMapsAsync({\n bundles,\n hashes,\n fileNames,\n outputDir,\n}: {\n bundles: Partial<\n Record<string, Pick<BundleOutput, 'hermesSourcemap' | 'map' | 'hermesBytecodeBundle' | 'code'>>\n >;\n hashes?: Record<string, string | undefined>;\n fileNames?: Record<string, string | undefined>;\n outputDir: string;\n}): Promise<SourceMapWriteResult[]> {\n return (\n await Promise.all(\n Object.entries(bundles).map(async ([platform, bundle]) => {\n if (!bundle) return null;\n const sourceMap = bundle.hermesSourcemap ?? bundle.map;\n if (!sourceMap) {\n debug(`Skip writing sourcemap (platform: ${platform})`);\n return null;\n }\n\n const hash =\n hashes?.[platform] ?? createBundleHash(bundle.hermesBytecodeBundle ?? bundle.code!);\n const mapName = `${platform}-${hash}.map`;\n await fs.writeFile(path.join(outputDir, mapName), sourceMap);\n\n const jsBundleFileName =\n fileNames?.[platform] ??\n createBundleFileName({\n platform,\n format: bundle.hermesBytecodeBundle ? 'bytecode' : 'javascript',\n hash,\n });\n const jsPath = path.join(outputDir, jsBundleFileName);\n\n // Add correct mapping to sourcemap paths\n const mappingComment = `\\n//# sourceMappingURL=${mapName}`;\n await fs.appendFile(jsPath, mappingComment);\n return {\n platform,\n fileName: mapName,\n hash,\n map: sourceMap,\n comment: mappingComment,\n };\n })\n )\n ).filter(Boolean) as SourceMapWriteResult[];\n}\n\nexport async function writeMetadataJsonAsync({\n outputDir,\n bundles,\n fileNames,\n embeddedHashSet,\n}: {\n outputDir: string;\n bundles: Record<string, Pick<BundleOutput, 'assets'> | undefined>;\n fileNames: Record<string, string | undefined>;\n embeddedHashSet?: Set<string>;\n}) {\n const contents = createMetadataJson({\n bundles,\n fileNames,\n embeddedHashSet,\n });\n const metadataPath = path.join(outputDir, 'metadata.json');\n debug(`Writing metadata.json to ${metadataPath}`);\n await fs.writeFile(metadataPath, JSON.stringify(contents));\n return contents;\n}\n\nexport async function writeAssetMapAsync({\n outputDir,\n assets,\n}: {\n outputDir: string;\n assets: Asset[];\n}) {\n // Convert the assets array to a k/v pair where the asset hash is the key and the asset is the value.\n const contents = Object.fromEntries(assets.map((asset) => [asset.hash, asset]));\n await fs.writeFile(path.join(outputDir, 'assetmap.json'), JSON.stringify(contents));\n return contents;\n}\n\nexport async function writeDebugHtmlAsync({\n outputDir,\n fileNames,\n}: {\n outputDir: string;\n fileNames: Record<string, string | undefined>;\n}) {\n // Make a debug html so user can debug their bundles\n const contents = `\n ${Object.values(fileNames)\n .filter((value) => value != null)\n .map((fileName) => `<script src=\"${path.join('bundles', fileName!)}\"></script>`)\n .join('\\n ')}\n Open up this file in Chrome. In the JavaScript developer console, navigate to the Source tab.\n You can see a red colored folder containing the original source code from your bundle.\n `;\n\n await fs.writeFile(path.join(outputDir, 'debug.html'), contents);\n return contents;\n}\n"],"names":["writeBundlesAsync","writeSourceMapsAsync","writeMetadataJsonAsync","writeAssetMapAsync","writeDebugHtmlAsync","debug","require","createBundleFileName","platform","format","hash","createBundleHash","bundle","crypto","createHash","update","digest","bundles","outputDir","useServerRendering","hashes","fileNames","bundleOutput","Object","entries","hermesBytecodeBundle","code","fileName","fs","writeFile","path","join","Promise","all","map","sourceMap","hermesSourcemap","mapName","jsBundleFileName","jsPath","mappingComment","appendFile","comment","filter","Boolean","embeddedHashSet","contents","createMetadataJson","metadataPath","JSON","stringify","assets","fromEntries","asset","values","value"],"mappings":"AAAA;;;;QAqCsBA,iBAAiB,GAAjBA,iBAAiB;QA4CjBC,oBAAoB,GAApBA,oBAAoB;QAoDpBC,sBAAsB,GAAtBA,sBAAsB;QAsBtBC,kBAAkB,GAAlBA,kBAAkB;QAalBC,mBAAmB,GAAnBA,mBAAmB;AAvKtB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACZ,IAAA,SAAa,kCAAb,aAAa,EAAA;AACX,IA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AAMH,SAAE,QAAA,CAACC,SAAS,CAACC,KAAI,QAAA,CAACC,IAAI,CAACb,SAAS,EAAE,YAAY,CAAC,EAAE4B,QAAQ,CAAC,CAAC;IACjE,OAAOA,QAAQ,CAAC;CACjB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.applyPluginsAsync = applyPluginsAsync;
|
|
6
|
+
var _config = require("@expo/config");
|
|
7
|
+
var Log = _interopRequireWildcard(require("../log"));
|
|
8
|
+
function _interopRequireWildcard(obj) {
|
|
9
|
+
if (obj && obj.__esModule) {
|
|
10
|
+
return obj;
|
|
11
|
+
} else {
|
|
12
|
+
var newObj = {};
|
|
13
|
+
if (obj != null) {
|
|
14
|
+
for(var key in obj){
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
16
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
17
|
+
if (desc.get || desc.set) {
|
|
18
|
+
Object.defineProperty(newObj, key, desc);
|
|
19
|
+
} else {
|
|
20
|
+
newObj[key] = obj[key];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
newObj.default = obj;
|
|
26
|
+
return newObj;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function applyPluginsAsync(projectRoot, packages) {
|
|
30
|
+
const { autoAddConfigPluginsAsync } = await Promise.resolve().then(function() {
|
|
31
|
+
return _interopRequireWildcard(require("./utils/autoAddConfigPlugins.js"));
|
|
32
|
+
});
|
|
33
|
+
try {
|
|
34
|
+
const { exp } = (0, _config).getConfig(projectRoot, {
|
|
35
|
+
skipSDKVersionRequirement: true
|
|
36
|
+
});
|
|
37
|
+
// Only auto add plugins if the plugins array is defined or if the project is using SDK +42.
|
|
38
|
+
await autoAddConfigPluginsAsync(projectRoot, exp, // Split any possible NPM tags. i.e. `expo@latest` -> `expo`
|
|
39
|
+
packages.map((pkg)=>pkg.split("@")[0]
|
|
40
|
+
).filter(Boolean));
|
|
41
|
+
} catch (error) {
|
|
42
|
+
// If we fail to apply plugins, the log a warning and continue.
|
|
43
|
+
if (error.isPluginError) {
|
|
44
|
+
Log.warn(`Skipping config plugin check: ` + error.message);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// Any other error, rethrow.
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=applyPlugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/install/applyPlugins.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\n\nimport * as Log from '../log';\n\n/**\n * A convenience feature for automatically applying Expo Config Plugins to the `app.json` after installing them.\n * This should be dropped in favor of autolinking in the future.\n */\nexport async function applyPluginsAsync(projectRoot: string, packages: string[]) {\n const { autoAddConfigPluginsAsync } = await import('./utils/autoAddConfigPlugins.js');\n\n try {\n const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n\n // Only auto add plugins if the plugins array is defined or if the project is using SDK +42.\n await autoAddConfigPluginsAsync(\n projectRoot,\n exp,\n // Split any possible NPM tags. i.e. `expo@latest` -> `expo`\n packages.map((pkg) => pkg.split('@')[0]).filter(Boolean)\n );\n } catch (error: any) {\n // If we fail to apply plugins, the log a warning and continue.\n if (error.isPluginError) {\n Log.warn(`Skipping config plugin check: ` + error.message);\n return;\n }\n // Any other error, rethrow.\n throw error;\n }\n}\n"],"names":["applyPluginsAsync","Log","projectRoot","packages","autoAddConfigPluginsAsync","exp","getConfig","skipSDKVersionRequirement","map","pkg","split","filter","Boolean","error","isPluginError","warn","message"],"mappings":"AAAA;;;;QAQsBA,iBAAiB,GAAjBA,iBAAiB;AARb,IAAA,OAAc,WAAd,cAAc,CAAA;AAE5BC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;;;;;;;;;;;;;;;;;;;;;;AAMR,eAAeD,iBAAiB,CAACE,WAAmB,EAAEC,QAAkB,EAAE;IAC/E,MAAM,EAAEC,yBAAyB,CAAA,EAAE,GAAG,MAAM;+CAAO,iCAAiC;MAAC,AAAC;IAEtF,IAAI;QACF,MAAM,EAAEC,GAAG,CAAA,EAAE,GAAGC,CAAAA,GAAAA,OAAS,AAAkD,CAAA,UAAlD,CAACJ,WAAW,EAAE;YAAEK,yBAAyB,EAAE,IAAI;SAAE,CAAC,AAAC;QAE5E,4FAA4F;QAC5F,MAAMH,yBAAyB,CAC7BF,WAAW,EACXG,GAAG,EACH,4DAA4D;QAC5DF,QAAQ,CAACK,GAAG,CAAC,CAACC,GAAG,GAAKA,GAAG,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAAA,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC,CACzD,CAAC;KACH,CAAC,OAAOC,KAAK,EAAO;QACnB,+DAA+D;QAC/D,IAAIA,KAAK,CAACC,aAAa,EAAE;YACvBb,GAAG,CAACc,IAAI,CAAC,CAAC,8BAA8B,CAAC,GAAGF,KAAK,CAACG,OAAO,CAAC,CAAC;YAC3D,OAAO;SACR;QACD,4BAA4B;QAC5B,MAAMH,KAAK,CAAC;KACb;CACF"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
exports.checkPackagesAsync = checkPackagesAsync;
|
|
6
6
|
var _config = require("@expo/config");
|
|
7
7
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
8
|
-
var
|
|
8
|
+
var _fixPackages = require("./fixPackages");
|
|
9
9
|
var Log = _interopRequireWildcard(require("../log"));
|
|
10
10
|
var _validateDependenciesVersions = require("../start/doctor/dependencies/validateDependenciesVersions");
|
|
11
11
|
var _interactive = require("../utils/interactive");
|
|
@@ -64,7 +64,7 @@ async function checkPackagesAsync(projectRoot, { packages , packageManager , opt
|
|
|
64
64
|
if (value) {
|
|
65
65
|
debug("Installing fixed dependencies:", dependencies);
|
|
66
66
|
// Install the corrected dependencies.
|
|
67
|
-
return (0,
|
|
67
|
+
return (0, _fixPackages).fixPackagesAsync(projectRoot, {
|
|
68
68
|
packageManager,
|
|
69
69
|
packages: dependencies,
|
|
70
70
|
packageManagerArguments,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/install/checkPackages.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport { fixPackagesAsync } from './
|
|
1
|
+
{"version":3,"sources":["../../../src/install/checkPackages.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport { fixPackagesAsync } from './fixPackages';\nimport { Options } from './resolveOptions';\nimport * as Log from '../log';\nimport {\n getVersionedDependenciesAsync,\n logIncorrectDependencies,\n} from '../start/doctor/dependencies/validateDependenciesVersions';\nimport { isInteractive } from '../utils/interactive';\nimport { learnMore } from '../utils/link';\nimport { confirmAsync } from '../utils/prompts';\nimport { joinWithCommasAnd } from '../utils/strings';\n\nconst debug = require('debug')('expo:install:check') as typeof console.log;\n\n/**\n * Handles `expo install --fix|check'.\n * Checks installed dependencies against bundledNativeModules and versions endpoints to find any incompatibilities.\n * If `--fix` is passed, it will install the correct versions of the dependencies.\n * If `--check` is passed, it will prompt the user to install the correct versions of the dependencies (on interactive terminal).\n */\nexport async function checkPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n options: { fix },\n packageManagerArguments,\n }: {\n /**\n * List of packages to version\n * @example ['uuid', 'react-native-reanimated@latest']\n */\n packages: string[];\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n\n /** How the check should resolve */\n options: Pick<Options, 'fix'>;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n) {\n // Read the project Expo config without plugins.\n const { exp, pkg } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n if (pkg.expo?.install?.exclude?.length) {\n Log.log(\n chalk`Skipped ${fix ? 'fixing' : 'checking'} dependencies: ${joinWithCommasAnd(\n pkg.expo.install.exclude\n )}. These dependencies are listed in {bold expo.install.exclude} in package.json. ${learnMore(\n 'https://expo.dev/more/expo-cli/#configuring-dependency-validation'\n )}`\n );\n }\n\n const dependencies = await getVersionedDependenciesAsync(projectRoot, exp, pkg, packages);\n\n if (!dependencies.length) {\n Log.exit(chalk.greenBright('Dependencies are up to date'), 0);\n }\n\n logIncorrectDependencies(dependencies);\n\n const value =\n // If `--fix` then always fix.\n fix ||\n // Otherwise prompt to fix when not running in CI.\n (isInteractive() && (await confirmAsync({ message: 'Fix dependencies?' }).catch(() => false)));\n\n if (value) {\n debug('Installing fixed dependencies:', dependencies);\n // Install the corrected dependencies.\n return fixPackagesAsync(projectRoot, {\n packageManager,\n packages: dependencies,\n packageManagerArguments,\n sdkVersion: exp.sdkVersion!,\n });\n }\n // Exit with non-zero exit code if any of the dependencies are out of date.\n Log.exit(chalk.red('Found outdated dependencies'), 1);\n}\n"],"names":["checkPackagesAsync","Log","debug","require","projectRoot","packages","packageManager","options","fix","packageManagerArguments","pkg","exp","getConfig","skipPlugins","expo","install","exclude","length","log","chalk","joinWithCommasAnd","learnMore","dependencies","getVersionedDependenciesAsync","exit","greenBright","logIncorrectDependencies","value","isInteractive","confirmAsync","message","catch","fixPackagesAsync","sdkVersion","red"],"mappings":"AAAA;;;;QAwBsBA,kBAAkB,GAAlBA,kBAAkB;AAxBd,IAAA,OAAc,WAAd,cAAc,CAAA;AAEtB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEQ,IAAA,YAAe,WAAf,eAAe,CAAA;AAEpCC,IAAAA,GAAG,mCAAM,QAAQ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+
exports.fixPackagesAsync = fixPackagesAsync;
|
|
6
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
7
|
+
var _applyPlugins = require("./applyPlugins");
|
|
8
|
+
var _installExpoPackage = require("./installExpoPackage");
|
|
9
|
+
var Log = _interopRequireWildcard(require("../log"));
|
|
10
|
+
var _getVersionedPackages = require("../start/doctor/dependencies/getVersionedPackages");
|
|
11
|
+
var _array = require("../utils/array");
|
|
12
|
+
function _interopRequireDefault(obj) {
|
|
13
|
+
return obj && obj.__esModule ? obj : {
|
|
14
|
+
default: obj
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function _interopRequireWildcard(obj) {
|
|
18
|
+
if (obj && obj.__esModule) {
|
|
19
|
+
return obj;
|
|
20
|
+
} else {
|
|
21
|
+
var newObj = {};
|
|
22
|
+
if (obj != null) {
|
|
23
|
+
for(var key in obj){
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
25
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
26
|
+
if (desc.get || desc.set) {
|
|
27
|
+
Object.defineProperty(newObj, key, desc);
|
|
28
|
+
} else {
|
|
29
|
+
newObj[key] = obj[key];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
newObj.default = obj;
|
|
35
|
+
return newObj;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async function fixPackagesAsync(projectRoot, { packages , packageManager , sdkVersion , packageManagerArguments }) {
|
|
39
|
+
if (!packages.length) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const { dependencies =[] , devDependencies =[] } = (0, _array).groupBy(packages, (dep)=>dep.packageType
|
|
43
|
+
);
|
|
44
|
+
const versioningMessages = (0, _getVersionedPackages).getOperationLog({
|
|
45
|
+
othersCount: 0,
|
|
46
|
+
nativeModulesCount: packages.length,
|
|
47
|
+
sdkVersion
|
|
48
|
+
});
|
|
49
|
+
// display all packages to update, including expo package
|
|
50
|
+
Log.log(_chalk.default`\u203A Installing ${versioningMessages.length ? versioningMessages.join(" and ") + " " : ""}using {bold ${packageManager.name}}`);
|
|
51
|
+
// if updating expo package, install this first, then run expo install --fix again under new version
|
|
52
|
+
const expoDep = dependencies.find((dep)=>dep.packageName === "expo"
|
|
53
|
+
);
|
|
54
|
+
if (expoDep) {
|
|
55
|
+
await (0, _installExpoPackage).installExpoPackageAsync(projectRoot, {
|
|
56
|
+
packageManager,
|
|
57
|
+
packageManagerArguments,
|
|
58
|
+
expoPackageToInstall: `expo@${expoDep.expectedVersionOrRange}`,
|
|
59
|
+
followUpCommandArgs: [
|
|
60
|
+
"--fix"
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
// follow-up commands will be spawned in a detached process, so return immediately
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (dependencies.length) {
|
|
67
|
+
const versionedPackages = dependencies.map((dep)=>`${dep.packageName}@${dep.expectedVersionOrRange}`
|
|
68
|
+
);
|
|
69
|
+
await packageManager.addAsync([
|
|
70
|
+
...packageManagerArguments,
|
|
71
|
+
...versionedPackages
|
|
72
|
+
]);
|
|
73
|
+
await (0, _applyPlugins).applyPluginsAsync(projectRoot, versionedPackages);
|
|
74
|
+
}
|
|
75
|
+
if (devDependencies.length) {
|
|
76
|
+
await packageManager.addDevAsync([
|
|
77
|
+
...packageManagerArguments,
|
|
78
|
+
...devDependencies.map((dep)=>`${dep.packageName}@${dep.expectedVersionOrRange}`
|
|
79
|
+
),
|
|
80
|
+
]);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=fixPackages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/install/fixPackages.ts"],"sourcesContent":["import * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport { applyPluginsAsync } from './applyPlugins';\nimport { installExpoPackageAsync } from './installExpoPackage';\nimport * as Log from '../log';\nimport { getOperationLog } from '../start/doctor/dependencies/getVersionedPackages';\nimport { getVersionedDependenciesAsync } from '../start/doctor/dependencies/validateDependenciesVersions';\nimport { groupBy } from '../utils/array';\n\n/**\n * Given a list of incompatible packages, installs the correct versions of the packages with the package manager used for the project.\n */\nexport async function fixPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n sdkVersion,\n packageManagerArguments,\n }: {\n packages: Awaited<ReturnType<typeof getVersionedDependenciesAsync>>;\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * SDK to version `packages` for.\n * @example '44.0.0'\n */\n sdkVersion: string;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n): Promise<void> {\n if (!packages.length) {\n return;\n }\n\n const { dependencies = [], devDependencies = [] } = groupBy(packages, (dep) => dep.packageType);\n const versioningMessages = getOperationLog({\n othersCount: 0, // All fixable packages are versioned\n nativeModulesCount: packages.length,\n sdkVersion,\n });\n\n // display all packages to update, including expo package\n Log.log(\n chalk`\\u203A Installing ${\n versioningMessages.length ? versioningMessages.join(' and ') + ' ' : ''\n }using {bold ${packageManager.name}}`\n );\n\n // if updating expo package, install this first, then run expo install --fix again under new version\n const expoDep = dependencies.find((dep) => dep.packageName === 'expo');\n if (expoDep) {\n await installExpoPackageAsync(projectRoot, {\n packageManager,\n packageManagerArguments,\n expoPackageToInstall: `expo@${expoDep.expectedVersionOrRange}`,\n followUpCommandArgs: ['--fix'],\n });\n // follow-up commands will be spawned in a detached process, so return immediately\n return;\n }\n\n if (dependencies.length) {\n const versionedPackages = dependencies.map(\n (dep) => `${dep.packageName}@${dep.expectedVersionOrRange}`\n );\n\n await packageManager.addAsync([...packageManagerArguments, ...versionedPackages]);\n\n await applyPluginsAsync(projectRoot, versionedPackages);\n }\n\n if (devDependencies.length) {\n await packageManager.addDevAsync([\n ...packageManagerArguments,\n ...devDependencies.map((dep) => `${dep.packageName}@${dep.expectedVersionOrRange}`),\n ]);\n }\n}\n"],"names":["fixPackagesAsync","Log","projectRoot","packages","packageManager","sdkVersion","packageManagerArguments","length","dependencies","devDependencies","groupBy","dep","packageType","versioningMessages","getOperationLog","othersCount","nativeModulesCount","log","chalk","join","name","expoDep","find","packageName","installExpoPackageAsync","expoPackageToInstall","expectedVersionOrRange","followUpCommandArgs","versionedPackages","map","addAsync","applyPluginsAsync","addDevAsync"],"mappings":"AAAA;;;;QAasBA,gBAAgB,GAAhBA,gBAAgB;AAZpB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAES,IAAA,aAAgB,WAAhB,gBAAgB,CAAA;AACV,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AAClDC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AACiB,IAAA,qBAAmD,WAAnD,mDAAmD,CAAA;AAE3D,IAAA,MAAgB,WAAhB,gBAAgB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKjC,eAAeD,gBAAgB,CACpCE,WAAmB,EACnB,EACEC,QAAQ,CAAA,EACRC,cAAc,CAAA,EACdC,UAAU,CAAA,EACVC,uBAAuB,CAAA,EAexB,EACc;IACf,IAAI,CAACH,QAAQ,CAACI,MAAM,EAAE;QACpB,OAAO;KACR;IAED,MAAM,EAAEC,YAAY,EAAG,EAAE,CAAA,EAAEC,eAAe,EAAG,EAAE,CAAA,EAAE,GAAGC,CAAAA,GAAAA,MAAO,AAAoC,CAAA,QAApC,CAACP,QAAQ,EAAE,CAACQ,GAAG,GAAKA,GAAG,CAACC,WAAW;IAAA,CAAC,AAAC;IAChG,MAAMC,kBAAkB,GAAGC,CAAAA,GAAAA,qBAAe,AAIxC,CAAA,gBAJwC,CAAC;QACzCC,WAAW,EAAE,CAAC;QACdC,kBAAkB,EAAEb,QAAQ,CAACI,MAAM;QACnCF,UAAU;KACX,CAAC,AAAC;IAEH,yDAAyD;IACzDJ,GAAG,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,CAAC,CAAC,EAAEZ,GAAG,CAACe,sBAAsB,CAAC,CAAC;YAAA,CAAC;SACpF,CAAC,CAAC;KACJ;CACF"}
|
|
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
exports.installAsync = installAsync;
|
|
6
6
|
exports.installPackagesAsync = installPackagesAsync;
|
|
7
|
-
exports.fixPackagesAsync = fixPackagesAsync;
|
|
8
7
|
var _config = require("@expo/config");
|
|
9
8
|
var PackageManager = _interopRequireWildcard(require("@expo/package-manager"));
|
|
10
9
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
10
|
+
var _applyPlugins = require("./applyPlugins");
|
|
11
11
|
var _checkPackages = require("./checkPackages");
|
|
12
|
+
var _installExpoPackage = require("./installExpoPackage");
|
|
12
13
|
var Log = _interopRequireWildcard(require("../log"));
|
|
13
14
|
var _getVersionedPackages = require("../start/doctor/dependencies/getVersionedPackages");
|
|
14
|
-
var _array = require("../utils/array");
|
|
15
15
|
var _findUp = require("../utils/findUp");
|
|
16
16
|
var _link = require("../utils/link");
|
|
17
17
|
var _nodeEnv = require("../utils/nodeEnv");
|
|
@@ -82,7 +82,7 @@ async function installAsync(packages, options, packageManagerArguments = []) {
|
|
|
82
82
|
}
|
|
83
83
|
async function installPackagesAsync(projectRoot, { packages , packageManager , sdkVersion , packageManagerArguments }) {
|
|
84
84
|
// Read the project Expo config without plugins.
|
|
85
|
-
const { pkg } = (0, _config).getConfig(projectRoot, {
|
|
85
|
+
const { pkg: pkg1 } = (0, _config).getConfig(projectRoot, {
|
|
86
86
|
// Sometimes users will add a plugin to the config before installing the library,
|
|
87
87
|
// this wouldn't work unless we dangerously disable plugin serialization.
|
|
88
88
|
skipPlugins: true
|
|
@@ -92,72 +92,43 @@ async function installPackagesAsync(projectRoot, { packages , packageManager , s
|
|
|
92
92
|
packages,
|
|
93
93
|
// sdkVersion is always defined because we don't skipSDKVersionRequirement in getConfig.
|
|
94
94
|
sdkVersion,
|
|
95
|
-
pkg
|
|
95
|
+
pkg: pkg1
|
|
96
96
|
});
|
|
97
97
|
Log.log(_chalk.default`\u203A Installing ${versioning.messages.length ? versioning.messages.join(" and ") + " " : ""}using {bold ${packageManager.name}}`);
|
|
98
98
|
if (versioning.excludedNativeModules.length) {
|
|
99
|
-
|
|
100
|
-
)
|
|
99
|
+
const alreadyExcluded = versioning.excludedNativeModules.filter((module)=>module.isExcludedFromValidation
|
|
100
|
+
);
|
|
101
|
+
const specifiedExactVersion = versioning.excludedNativeModules.filter((module)=>!module.isExcludedFromValidation
|
|
102
|
+
);
|
|
103
|
+
if (alreadyExcluded.length) {
|
|
104
|
+
Log.log(_chalk.default`\u203A Using ${(0, _strings).joinWithCommasAnd(alreadyExcluded.map(({ bundledNativeVersion , name , specifiedVersion })=>`${specifiedVersion || "latest"} instead of ${bundledNativeVersion} for ${name}`
|
|
105
|
+
))} because ${alreadyExcluded.length > 1 ? "they are" : "it is"} listed in {bold expo.install.exclude} in package.json. ${(0, _link).learnMore("https://expo.dev/more/expo-cli/#configuring-dependency-validation")}`);
|
|
106
|
+
}
|
|
107
|
+
if (specifiedExactVersion.length) {
|
|
108
|
+
Log.log(_chalk.default`\u203A Using ${(0, _strings).joinWithCommasAnd(specifiedExactVersion.map(({ bundledNativeVersion , name , specifiedVersion })=>`${specifiedVersion} instead of ${bundledNativeVersion} for ${name}`
|
|
109
|
+
))} because ${specifiedExactVersion.length > 1 ? "these versions" : "this version"} was explicitly provided. Packages excluded from dependency validation should be listed in {bold expo.install.exclude} in package.json. ${(0, _link).learnMore("https://expo.dev/more/expo-cli/#configuring-dependency-validation")}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// if updating expo package, install this first, then re-run the command minus expo to install everything else
|
|
113
|
+
if (packages.find((pkg)=>pkg === "expo"
|
|
114
|
+
)) {
|
|
115
|
+
const packagesMinusExpo = packages.filter((pkg)=>pkg !== "expo"
|
|
116
|
+
);
|
|
117
|
+
await (0, _installExpoPackage).installExpoPackageAsync(projectRoot, {
|
|
118
|
+
packageManager,
|
|
119
|
+
packageManagerArguments,
|
|
120
|
+
expoPackageToInstall: versioning.packages.find((pkg)=>pkg.startsWith("expo@")
|
|
121
|
+
),
|
|
122
|
+
followUpCommandArgs: packagesMinusExpo
|
|
123
|
+
});
|
|
124
|
+
// follow-up commands will be spawned in a detached process, so return immediately
|
|
125
|
+
return;
|
|
101
126
|
}
|
|
102
127
|
await packageManager.addAsync([
|
|
103
128
|
...packageManagerArguments,
|
|
104
129
|
...versioning.packages
|
|
105
130
|
]);
|
|
106
|
-
await applyPluginsAsync(projectRoot, versioning.packages);
|
|
107
|
-
}
|
|
108
|
-
async function fixPackagesAsync(projectRoot, { packages , packageManager , sdkVersion , packageManagerArguments }) {
|
|
109
|
-
if (!packages.length) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const { dependencies =[] , devDependencies =[] } = (0, _array).groupBy(packages, (dep)=>dep.packageType
|
|
113
|
-
);
|
|
114
|
-
const versioningMessages = (0, _getVersionedPackages).getOperationLog({
|
|
115
|
-
othersCount: 0,
|
|
116
|
-
nativeModulesCount: packages.length,
|
|
117
|
-
sdkVersion
|
|
118
|
-
});
|
|
119
|
-
Log.log(_chalk.default`\u203A Installing ${versioningMessages.length ? versioningMessages.join(" and ") + " " : ""}using {bold ${packageManager.name}}`);
|
|
120
|
-
if (dependencies.length) {
|
|
121
|
-
const versionedPackages = dependencies.map((dep)=>`${dep.packageName}@${dep.expectedVersionOrRange}`
|
|
122
|
-
);
|
|
123
|
-
await packageManager.addAsync([
|
|
124
|
-
...packageManagerArguments,
|
|
125
|
-
...versionedPackages
|
|
126
|
-
]);
|
|
127
|
-
await applyPluginsAsync(projectRoot, versionedPackages);
|
|
128
|
-
}
|
|
129
|
-
if (devDependencies.length) {
|
|
130
|
-
await packageManager.addDevAsync([
|
|
131
|
-
...packageManagerArguments,
|
|
132
|
-
...devDependencies.map((dep)=>`${dep.packageName}@${dep.expectedVersionOrRange}`
|
|
133
|
-
),
|
|
134
|
-
]);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* A convenience feature for automatically applying Expo Config Plugins to the `app.json` after installing them.
|
|
139
|
-
* This should be dropped in favor of autolinking in the future.
|
|
140
|
-
*/ async function applyPluginsAsync(projectRoot, packages) {
|
|
141
|
-
const { autoAddConfigPluginsAsync } = await Promise.resolve().then(function() {
|
|
142
|
-
return _interopRequireWildcard(require("./utils/autoAddConfigPlugins"));
|
|
143
|
-
});
|
|
144
|
-
try {
|
|
145
|
-
const { exp } = (0, _config).getConfig(projectRoot, {
|
|
146
|
-
skipSDKVersionRequirement: true
|
|
147
|
-
});
|
|
148
|
-
// Only auto add plugins if the plugins array is defined or if the project is using SDK +42.
|
|
149
|
-
await autoAddConfigPluginsAsync(projectRoot, exp, // Split any possible NPM tags. i.e. `expo@latest` -> `expo`
|
|
150
|
-
packages.map((pkg)=>pkg.split("@")[0]
|
|
151
|
-
).filter(Boolean));
|
|
152
|
-
} catch (error) {
|
|
153
|
-
// If we fail to apply plugins, the log a warning and continue.
|
|
154
|
-
if (error.isPluginError) {
|
|
155
|
-
Log.warn(`Skipping config plugin check: ` + error.message);
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
// Any other error, rethrow.
|
|
159
|
-
throw error;
|
|
160
|
-
}
|
|
131
|
+
await (0, _applyPlugins).applyPluginsAsync(projectRoot, versioning.packages);
|
|
161
132
|
}
|
|
162
133
|
|
|
163
134
|
//# sourceMappingURL=installAsync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/install/installAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport { checkPackagesAsync } from './checkPackages';\nimport { Options } from './resolveOptions';\nimport * as Log from '../log';\nimport {\n getOperationLog,\n getVersionedPackagesAsync,\n} from '../start/doctor/dependencies/getVersionedPackages';\nimport { getVersionedDependenciesAsync } from '../start/doctor/dependencies/validateDependenciesVersions';\nimport { groupBy } from '../utils/array';\nimport { findUpProjectRootOrAssert } from '../utils/findUp';\nimport { learnMore } from '../utils/link';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { joinWithCommasAnd } from '../utils/strings';\n\nexport async function installAsync(\n packages: string[],\n options: Options & { projectRoot?: string },\n packageManagerArguments: string[] = []\n) {\n setNodeEnv('development');\n // Locate the project root based on the process current working directory.\n // This enables users to run `npx expo install` from a subdirectory of the project.\n const projectRoot = options.projectRoot ?? findUpProjectRootOrAssert(process.cwd());\n require('@expo/env').load(projectRoot);\n\n // Resolve the package manager used by the project, or based on the provided arguments.\n const packageManager = PackageManager.createForProject(projectRoot, {\n npm: options.npm,\n yarn: options.yarn,\n bun: options.bun,\n pnpm: options.pnpm,\n silent: options.silent,\n log: Log.log,\n });\n\n if (options.check || options.fix) {\n return await checkPackagesAsync(projectRoot, {\n packages,\n options,\n packageManager,\n packageManagerArguments,\n });\n }\n\n // Read the project Expo config without plugins.\n const { exp } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n // Resolve the versioned packages, then install them.\n return installPackagesAsync(projectRoot, {\n packageManager,\n packages,\n packageManagerArguments,\n sdkVersion: exp.sdkVersion!,\n });\n}\n\n/** Version packages and install in a project. */\nexport async function installPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n sdkVersion,\n packageManagerArguments,\n }: {\n /**\n * List of packages to version, grouped by the type of dependency.\n * @example ['uuid', 'react-native-reanimated@latest']\n */\n packages: string[];\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * SDK to version `packages` for.\n * @example '44.0.0'\n */\n sdkVersion: string;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n): Promise<void> {\n // Read the project Expo config without plugins.\n const { pkg } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n //assertNotInstallingExcludedPackages(projectRoot, packages, pkg);\n\n const versioning = await getVersionedPackagesAsync(projectRoot, {\n packages,\n // sdkVersion is always defined because we don't skipSDKVersionRequirement in getConfig.\n sdkVersion,\n pkg,\n });\n\n Log.log(\n chalk`\\u203A Installing ${\n versioning.messages.length ? versioning.messages.join(' and ') + ' ' : ''\n }using {bold ${packageManager.name}}`\n );\n\n if (versioning.excludedNativeModules.length) {\n Log.log(\n chalk`\\u203A Using latest version instead of ${joinWithCommasAnd(\n versioning.excludedNativeModules.map(\n ({ bundledNativeVersion, name }) => `${bundledNativeVersion} for ${name}`\n )\n )} because ${\n versioning.excludedNativeModules.length > 1 ? 'they are' : 'it is'\n } listed in {bold expo.install.exclude} in package.json. ${learnMore(\n 'https://expo.dev/more/expo-cli/#configuring-dependency-validation'\n )}`\n );\n }\n\n await packageManager.addAsync([...packageManagerArguments, ...versioning.packages]);\n\n await applyPluginsAsync(projectRoot, versioning.packages);\n}\n\nexport async function fixPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n sdkVersion,\n packageManagerArguments,\n }: {\n packages: Awaited<ReturnType<typeof getVersionedDependenciesAsync>>;\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * SDK to version `packages` for.\n * @example '44.0.0'\n */\n sdkVersion: string;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n): Promise<void> {\n if (!packages.length) {\n return;\n }\n\n const { dependencies = [], devDependencies = [] } = groupBy(packages, (dep) => dep.packageType);\n const versioningMessages = getOperationLog({\n othersCount: 0, // All fixable packages are versioned\n nativeModulesCount: packages.length,\n sdkVersion,\n });\n\n Log.log(\n chalk`\\u203A Installing ${\n versioningMessages.length ? versioningMessages.join(' and ') + ' ' : ''\n }using {bold ${packageManager.name}}`\n );\n\n if (dependencies.length) {\n const versionedPackages = dependencies.map(\n (dep) => `${dep.packageName}@${dep.expectedVersionOrRange}`\n );\n\n await packageManager.addAsync([...packageManagerArguments, ...versionedPackages]);\n\n await applyPluginsAsync(projectRoot, versionedPackages);\n }\n\n if (devDependencies.length) {\n await packageManager.addDevAsync([\n ...packageManagerArguments,\n ...devDependencies.map((dep) => `${dep.packageName}@${dep.expectedVersionOrRange}`),\n ]);\n }\n}\n\n/**\n * A convenience feature for automatically applying Expo Config Plugins to the `app.json` after installing them.\n * This should be dropped in favor of autolinking in the future.\n */\nasync function applyPluginsAsync(projectRoot: string, packages: string[]) {\n const { autoAddConfigPluginsAsync } = await import('./utils/autoAddConfigPlugins');\n\n try {\n const { exp } = getConfig(projectRoot, { skipSDKVersionRequirement: true });\n\n // Only auto add plugins if the plugins array is defined or if the project is using SDK +42.\n await autoAddConfigPluginsAsync(\n projectRoot,\n exp,\n // Split any possible NPM tags. i.e. `expo@latest` -> `expo`\n packages.map((pkg) => pkg.split('@')[0]).filter(Boolean)\n );\n } catch (error: any) {\n // If we fail to apply plugins, the log a warning and continue.\n if (error.isPluginError) {\n Log.warn(`Skipping config plugin check: ` + error.message);\n return;\n }\n // Any other error, rethrow.\n throw error;\n }\n}\n"],"names":["installAsync","installPackagesAsync","fixPackagesAsync","PackageManager","Log","packages","options","packageManagerArguments","setNodeEnv","projectRoot","findUpProjectRootOrAssert","process","cwd","require","load","packageManager","createForProject","npm","yarn","bun","pnpm","silent","log","check","fix","checkPackagesAsync","exp","getConfig","skipPlugins","sdkVersion","pkg","versioning","getVersionedPackagesAsync","chalk","messages","length","join","name","excludedNativeModules","joinWithCommasAnd","map","bundledNativeVersion","learnMore","addAsync","applyPluginsAsync","dependencies","devDependencies","groupBy","dep","packageType","versioningMessages","getOperationLog","othersCount","nativeModulesCount","versionedPackages","packageName","expectedVersionOrRange","addDevAsync","autoAddConfigPluginsAsync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AAC;KACJ;CACF;AAED;;;GAGG,CACH,eAAeZ,iBAAiB,CAACnC,WAAmB,EAAEJ,QAAkB,EAAE;IACxE,MAAM,EAAEqD,yBAAyB,CAAA,EAAE,GAAG,MAAM;+CAAO,8BAA8B;MAAC,AAAC;IAEnF,IAAI;QACF,MAAM,EAAEhC,GAAG,CAAA,EAAE,GAAGC,CAAAA,GAAAA,OAAS,AAAkD,CAAA,UAAlD,CAAClB,WAAW,EAAE;YAAEkD,yBAAyB,EAAE,IAAI;SAAE,CAAC,AAAC;QAE5E,4FAA4F;QAC5F,MAAMD,yBAAyB,CAC7BjD,WAAW,EACXiB,GAAG,EACH,4DAA4D;QAC5DrB,QAAQ,CAACmC,GAAG,CAAC,CAACV,GAAG,GAAKA,GAAG,CAAC8B,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAAA,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC,CACzD,CAAC;KACH,CAAC,OAAOC,KAAK,EAAO;QACnB,+DAA+D;QAC/D,IAAIA,KAAK,CAACC,aAAa,EAAE;YACvB5D,GAAG,CAAC6D,IAAI,CAAC,CAAC,8BAA8B,CAAC,GAAGF,KAAK,CAACG,OAAO,CAAC,CAAC;YAC3D,OAAO;SACR;QACD,4BAA4B;QAC5B,MAAMH,KAAK,CAAC;KACb;CACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/install/installAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport * as PackageManager from '@expo/package-manager';\nimport chalk from 'chalk';\n\nimport { applyPluginsAsync } from './applyPlugins';\nimport { checkPackagesAsync } from './checkPackages';\nimport { installExpoPackageAsync } from './installExpoPackage';\nimport { Options } from './resolveOptions';\nimport * as Log from '../log';\nimport { getVersionedPackagesAsync } from '../start/doctor/dependencies/getVersionedPackages';\nimport { findUpProjectRootOrAssert } from '../utils/findUp';\nimport { learnMore } from '../utils/link';\nimport { setNodeEnv } from '../utils/nodeEnv';\nimport { joinWithCommasAnd } from '../utils/strings';\n\n/**\n * Installs versions of specified packages compatible with the current Expo SDK version, or\n * checks/ fixes dependencies in project if they don't match compatible versions specified in bundledNativeModules or versions endpoints.\n *\n * @param packages list of packages to install, if installing specific packages and not checking/ fixing\n * @param options options, including check or fix\n * @param packageManagerArguments arguments to forward to the package manager invoked while installing\n * @returns Promise<void>\n */\nexport async function installAsync(\n packages: string[],\n options: Options & { projectRoot?: string },\n packageManagerArguments: string[] = []\n) {\n setNodeEnv('development');\n // Locate the project root based on the process current working directory.\n // This enables users to run `npx expo install` from a subdirectory of the project.\n const projectRoot = options.projectRoot ?? findUpProjectRootOrAssert(process.cwd());\n require('@expo/env').load(projectRoot);\n\n // Resolve the package manager used by the project, or based on the provided arguments.\n const packageManager = PackageManager.createForProject(projectRoot, {\n npm: options.npm,\n yarn: options.yarn,\n bun: options.bun,\n pnpm: options.pnpm,\n silent: options.silent,\n log: Log.log,\n });\n\n if (options.check || options.fix) {\n return await checkPackagesAsync(projectRoot, {\n packages,\n options,\n packageManager,\n packageManagerArguments,\n });\n }\n\n // Read the project Expo config without plugins.\n const { exp } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n // Resolve the versioned packages, then install them.\n return installPackagesAsync(projectRoot, {\n packageManager,\n packages,\n packageManagerArguments,\n sdkVersion: exp.sdkVersion!,\n });\n}\n\n/** Version packages and install in a project. */\nexport async function installPackagesAsync(\n projectRoot: string,\n {\n packages,\n packageManager,\n sdkVersion,\n packageManagerArguments,\n }: {\n /**\n * List of packages to version, grouped by the type of dependency.\n * @example ['uuid', 'react-native-reanimated@latest']\n */\n packages: string[];\n /** Package manager to use when installing the versioned packages. */\n packageManager: PackageManager.NodePackageManager;\n /**\n * SDK to version `packages` for.\n * @example '44.0.0'\n */\n sdkVersion: string;\n /**\n * Extra parameters to pass to the `packageManager` when installing versioned packages.\n * @example ['--no-save']\n */\n packageManagerArguments: string[];\n }\n): Promise<void> {\n // Read the project Expo config without plugins.\n const { pkg } = getConfig(projectRoot, {\n // Sometimes users will add a plugin to the config before installing the library,\n // this wouldn't work unless we dangerously disable plugin serialization.\n skipPlugins: true,\n });\n\n //assertNotInstallingExcludedPackages(projectRoot, packages, pkg);\n\n const versioning = await getVersionedPackagesAsync(projectRoot, {\n packages,\n // sdkVersion is always defined because we don't skipSDKVersionRequirement in getConfig.\n sdkVersion,\n pkg,\n });\n\n Log.log(\n chalk`\\u203A Installing ${\n versioning.messages.length ? versioning.messages.join(' and ') + ' ' : ''\n }using {bold ${packageManager.name}}`\n );\n\n if (versioning.excludedNativeModules.length) {\n const alreadyExcluded = versioning.excludedNativeModules.filter(\n (module) => module.isExcludedFromValidation\n );\n const specifiedExactVersion = versioning.excludedNativeModules.filter(\n (module) => !module.isExcludedFromValidation\n );\n\n if (alreadyExcluded.length) {\n Log.log(\n chalk`\\u203A Using ${joinWithCommasAnd(\n alreadyExcluded.map(\n ({ bundledNativeVersion, name, specifiedVersion }) =>\n `${specifiedVersion || 'latest'} instead of ${bundledNativeVersion} for ${name}`\n )\n )} because ${\n alreadyExcluded.length > 1 ? 'they are' : 'it is'\n } listed in {bold expo.install.exclude} in package.json. ${learnMore(\n 'https://expo.dev/more/expo-cli/#configuring-dependency-validation'\n )}`\n );\n }\n\n if (specifiedExactVersion.length) {\n Log.log(\n chalk`\\u203A Using ${joinWithCommasAnd(\n specifiedExactVersion.map(\n ({ bundledNativeVersion, name, specifiedVersion }) =>\n `${specifiedVersion} instead of ${bundledNativeVersion} for ${name}`\n )\n )} because ${\n specifiedExactVersion.length > 1 ? 'these versions' : 'this version'\n } was explicitly provided. Packages excluded from dependency validation should be listed in {bold expo.install.exclude} in package.json. ${learnMore(\n 'https://expo.dev/more/expo-cli/#configuring-dependency-validation'\n )}`\n );\n }\n }\n\n // if updating expo package, install this first, then re-run the command minus expo to install everything else\n if (packages.find((pkg) => pkg === 'expo')) {\n const packagesMinusExpo = packages.filter((pkg) => pkg !== 'expo');\n\n await installExpoPackageAsync(projectRoot, {\n packageManager,\n packageManagerArguments,\n expoPackageToInstall: versioning.packages.find((pkg) => pkg.startsWith('expo@'))!,\n followUpCommandArgs: packagesMinusExpo,\n });\n\n // follow-up commands will be spawned in a detached process, so return immediately\n return;\n }\n\n await packageManager.addAsync([...packageManagerArguments, ...versioning.packages]);\n\n await applyPluginsAsync(projectRoot, versioning.packages);\n}\n"],"names":["installAsync","installPackagesAsync","PackageManager","Log","packages","options","packageManagerArguments","setNodeEnv","projectRoot","findUpProjectRootOrAssert","process","cwd","require","load","packageManager","createForProject","npm","yarn","bun","pnpm","silent","log","check","fix","checkPackagesAsync","exp","getConfig","skipPlugins","sdkVersion","pkg","versioning","getVersionedPackagesAsync","chalk","messages","length","join","name","excludedNativeModules","alreadyExcluded","filter","module","isExcludedFromValidation","specifiedExactVersion","joinWithCommasAnd","map","bundledNativeVersion","specifiedVersion","learnMore","find","packagesMinusExpo","installExpoPackageAsync","expoPackageToInstall","startsWith","followUpCommandArgs","addAsync","applyPluginsAsync"],"mappings":"AAAA;;;;QAwBsBA,YAAY,GAAZA,YAAY;QA+CZC,oBAAoB,GAApBA,oBAAoB;AAvEhB,IAAA,OAAc,WAAd,cAAc,CAAA;AAC5BC,IAAAA,cAAc,mCAAM,uBAAuB,EAA7B;AACR,IAAA,MAAO,kCAAP,OAAO,EAAA;AAES,IAAA,aAAgB,WAAhB,gBAAgB,CAAA;AACf,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AACZ,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AAElDC,IAAAA,GAAG,mCAAM,QAAQ,EAAd;AAC2B,IAAA,qBAAmD,WAAnD,mDAAmD,CAAA;AACnD,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;AACjC,IAAA,KAAe,WAAf,eAAe,CAAA;AACd,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;AACX,IAAA,QAAkB,WAAlB,kBAAkB,CAAA;;;;;;;;;;;;;;;;;;;;;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