@expo/cli 0.26.8 → 0.26.9
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 +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js +1 -1
- package/build/src/start/platforms/ExpoGoInstaller.js.map +1 -1
- package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +1 -1
- package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +3 -3
package/build/bin/cli
CHANGED
|
@@ -117,7 +117,7 @@ class ExpoGoInstaller {
|
|
|
117
117
|
// Only prompt once per device, per run.
|
|
118
118
|
const confirm = await (0, _prompts.confirmAsync)({
|
|
119
119
|
initial: true,
|
|
120
|
-
message: `Expo Go ${expectedExpoGoVersion} is recommended for SDK ${this.sdkVersion} (${deviceManager.name} is using ${installedExpoGoVersion}). ${(0, _link.learnMore)('https://docs.expo.dev/
|
|
120
|
+
message: `Expo Go ${expectedExpoGoVersion} is recommended for SDK ${this.sdkVersion} (${deviceManager.name} is using ${installedExpoGoVersion}). ${(0, _link.learnMore)('https://docs.expo.dev/develop/tools/#expo-go')}. Install the recommended Expo Go version?`
|
|
121
121
|
});
|
|
122
122
|
if (confirm) {
|
|
123
123
|
// Don't need to uninstall to update on iOS.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/platforms/ExpoGoInstaller.ts"],"sourcesContent":["import semver from 'semver';\n\nimport type { DeviceManager } from './DeviceManager';\nimport { getVersionsAsync } from '../../api/getVersions';\nimport * as Log from '../../log';\nimport { downloadExpoGoAsync } from '../../utils/downloadExpoGoAsync';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { learnMore } from '../../utils/link';\nimport { logNewSection } from '../../utils/ora';\nimport { confirmAsync } from '../../utils/prompts';\n\nconst debug = require('debug')('expo:utils:ExpoGoInstaller') as typeof console.log;\n\n/** Given a platform, appId, and sdkVersion, this module will ensure that Expo Go is up-to-date on the provided device. */\nexport class ExpoGoInstaller<IDevice> {\n // Keep a list of [platform-deviceId] so we can prevent asking multiple times if a user wants to upgrade.\n // This can prevent annoying interactions when they don't want to upgrade for whatever reason.\n static cache: Record<string, boolean> = {};\n\n constructor(\n private platform: 'ios' | 'android',\n // Ultimately this should be inlined since we know the platform.\n private appId: string,\n private sdkVersion: string\n ) {}\n\n /** Returns true if the installed app matching the previously provided `appId` is outdated. */\n isInstalledClientVersionMismatched(\n installedVersion: string | null,\n expectedExpoGoVersion: string | null\n ): boolean {\n if (!installedVersion) {\n return true;\n }\n\n debug(\n `Expected Expo Go version: ${expectedExpoGoVersion}, installed version: ${installedVersion}`\n );\n return expectedExpoGoVersion ? !semver.eq(installedVersion, expectedExpoGoVersion) : true;\n }\n\n /** Returns the expected version of Expo Go given the project SDK Version. Exposed for testing. */\n async getExpectedExpoGoClientVersionAsync(): Promise<string | null> {\n const versions = await getVersionsAsync();\n // Like `sdkVersions['44.0.0']['androidClientVersion'] = '1.0.0'`\n const specificVersion =\n versions?.sdkVersions?.[this.sdkVersion]?.[`${this.platform}ClientVersion`];\n const latestVersion = versions[`${this.platform}Version`];\n return specificVersion ?? latestVersion ?? null;\n }\n\n /** Returns a boolean indicating if Expo Go should be installed. Returns `true` if the app was uninstalled. */\n async promptForUninstallExpoGoIfInstalledClientVersionMismatchedAndReturnShouldInstallAsync(\n deviceManager: DeviceManager<IDevice>,\n { containerPath }: { containerPath?: string } = {}\n ): Promise<boolean> {\n const cacheId = `${this.platform}-${deviceManager.identifier}`;\n\n if (ExpoGoInstaller.cache[cacheId]) {\n debug('skipping subsequent upgrade check');\n return false;\n }\n ExpoGoInstaller.cache[cacheId] = true;\n\n const [installedExpoGoVersion, expectedExpoGoVersion] = await Promise.all([\n deviceManager.getAppVersionAsync(this.appId, {\n containerPath,\n }),\n this.getExpectedExpoGoClientVersionAsync(),\n ]);\n\n if (this.isInstalledClientVersionMismatched(installedExpoGoVersion, expectedExpoGoVersion)) {\n if (this.sdkVersion === 'UNVERSIONED') {\n // This should only happen in the expo/expo repo, e.g. `apps/test-suite`\n Log.log(\n `Skipping Expo Go upgrade check for UNVERSIONED project. Manually ensure the Expo Go app is built from source.`\n );\n return false;\n }\n\n // Only prompt once per device, per run.\n const confirm = await confirmAsync({\n initial: true,\n message: `Expo Go ${expectedExpoGoVersion} is recommended for SDK ${this.sdkVersion} (${\n deviceManager.name\n } is using ${installedExpoGoVersion}). ${learnMore(\n 'https://docs.expo.dev/
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/platforms/ExpoGoInstaller.ts"],"sourcesContent":["import semver from 'semver';\n\nimport type { DeviceManager } from './DeviceManager';\nimport { getVersionsAsync } from '../../api/getVersions';\nimport * as Log from '../../log';\nimport { downloadExpoGoAsync } from '../../utils/downloadExpoGoAsync';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport { learnMore } from '../../utils/link';\nimport { logNewSection } from '../../utils/ora';\nimport { confirmAsync } from '../../utils/prompts';\n\nconst debug = require('debug')('expo:utils:ExpoGoInstaller') as typeof console.log;\n\n/** Given a platform, appId, and sdkVersion, this module will ensure that Expo Go is up-to-date on the provided device. */\nexport class ExpoGoInstaller<IDevice> {\n // Keep a list of [platform-deviceId] so we can prevent asking multiple times if a user wants to upgrade.\n // This can prevent annoying interactions when they don't want to upgrade for whatever reason.\n static cache: Record<string, boolean> = {};\n\n constructor(\n private platform: 'ios' | 'android',\n // Ultimately this should be inlined since we know the platform.\n private appId: string,\n private sdkVersion: string\n ) {}\n\n /** Returns true if the installed app matching the previously provided `appId` is outdated. */\n isInstalledClientVersionMismatched(\n installedVersion: string | null,\n expectedExpoGoVersion: string | null\n ): boolean {\n if (!installedVersion) {\n return true;\n }\n\n debug(\n `Expected Expo Go version: ${expectedExpoGoVersion}, installed version: ${installedVersion}`\n );\n return expectedExpoGoVersion ? !semver.eq(installedVersion, expectedExpoGoVersion) : true;\n }\n\n /** Returns the expected version of Expo Go given the project SDK Version. Exposed for testing. */\n async getExpectedExpoGoClientVersionAsync(): Promise<string | null> {\n const versions = await getVersionsAsync();\n // Like `sdkVersions['44.0.0']['androidClientVersion'] = '1.0.0'`\n const specificVersion =\n versions?.sdkVersions?.[this.sdkVersion]?.[`${this.platform}ClientVersion`];\n const latestVersion = versions[`${this.platform}Version`];\n return specificVersion ?? latestVersion ?? null;\n }\n\n /** Returns a boolean indicating if Expo Go should be installed. Returns `true` if the app was uninstalled. */\n async promptForUninstallExpoGoIfInstalledClientVersionMismatchedAndReturnShouldInstallAsync(\n deviceManager: DeviceManager<IDevice>,\n { containerPath }: { containerPath?: string } = {}\n ): Promise<boolean> {\n const cacheId = `${this.platform}-${deviceManager.identifier}`;\n\n if (ExpoGoInstaller.cache[cacheId]) {\n debug('skipping subsequent upgrade check');\n return false;\n }\n ExpoGoInstaller.cache[cacheId] = true;\n\n const [installedExpoGoVersion, expectedExpoGoVersion] = await Promise.all([\n deviceManager.getAppVersionAsync(this.appId, {\n containerPath,\n }),\n this.getExpectedExpoGoClientVersionAsync(),\n ]);\n\n if (this.isInstalledClientVersionMismatched(installedExpoGoVersion, expectedExpoGoVersion)) {\n if (this.sdkVersion === 'UNVERSIONED') {\n // This should only happen in the expo/expo repo, e.g. `apps/test-suite`\n Log.log(\n `Skipping Expo Go upgrade check for UNVERSIONED project. Manually ensure the Expo Go app is built from source.`\n );\n return false;\n }\n\n // Only prompt once per device, per run.\n const confirm = await confirmAsync({\n initial: true,\n message: `Expo Go ${expectedExpoGoVersion} is recommended for SDK ${this.sdkVersion} (${\n deviceManager.name\n } is using ${installedExpoGoVersion}). ${learnMore(\n 'https://docs.expo.dev/develop/tools/#expo-go'\n )}. Install the recommended Expo Go version?`,\n });\n\n if (confirm) {\n // Don't need to uninstall to update on iOS.\n if (this.platform !== 'ios') {\n Log.log(`Uninstalling Expo Go from ${this.platform} device ${deviceManager.name}.`);\n await deviceManager.uninstallAppAsync(this.appId);\n }\n return true;\n }\n }\n return false;\n }\n\n /** Check if a given device has Expo Go installed, if not then download and install it. */\n async ensureAsync(deviceManager: DeviceManager<IDevice>): Promise<boolean> {\n const isExpoGoInstalledAndIfSoContainerPathForIOS =\n await deviceManager.isAppInstalledAndIfSoReturnContainerPathForIOSAsync(this.appId);\n let shouldInstall = !isExpoGoInstalledAndIfSoContainerPathForIOS;\n if (env.EXPO_OFFLINE) {\n if (isExpoGoInstalledAndIfSoContainerPathForIOS) {\n Log.warn(`Skipping Expo Go version validation in offline mode`);\n return false;\n }\n throw new CommandError(\n 'NO_EXPO_GO',\n `Expo Go is not installed on device \"${deviceManager.name}\", while running in offline mode. Manually install Expo Go or run without --offline flag (or EXPO_OFFLINE environment variable).`\n );\n }\n\n if (isExpoGoInstalledAndIfSoContainerPathForIOS) {\n shouldInstall =\n await this.promptForUninstallExpoGoIfInstalledClientVersionMismatchedAndReturnShouldInstallAsync(\n deviceManager,\n {\n // iOS optimization to prevent duplicate calls to `getContainerPathAsync`.\n containerPath:\n typeof isExpoGoInstalledAndIfSoContainerPathForIOS === 'string'\n ? isExpoGoInstalledAndIfSoContainerPathForIOS\n : undefined,\n }\n );\n }\n\n if (shouldInstall) {\n // Download the Expo Go app from the Expo servers.\n const binaryPath = await downloadExpoGoAsync(this.platform, { sdkVersion: this.sdkVersion });\n // Install the app on the device.\n const ora = logNewSection(`Installing Expo Go on ${deviceManager.name}`);\n try {\n await deviceManager.installAppAsync(binaryPath);\n } finally {\n ora.stop();\n }\n return true;\n }\n return false;\n }\n}\n"],"names":["ExpoGoInstaller","debug","require","cache","constructor","platform","appId","sdkVersion","isInstalledClientVersionMismatched","installedVersion","expectedExpoGoVersion","semver","eq","getExpectedExpoGoClientVersionAsync","versions","getVersionsAsync","specificVersion","sdkVersions","latestVersion","promptForUninstallExpoGoIfInstalledClientVersionMismatchedAndReturnShouldInstallAsync","deviceManager","containerPath","cacheId","identifier","installedExpoGoVersion","Promise","all","getAppVersionAsync","Log","log","confirm","confirmAsync","initial","message","name","learnMore","uninstallAppAsync","ensureAsync","isExpoGoInstalledAndIfSoContainerPathForIOS","isAppInstalledAndIfSoReturnContainerPathForIOSAsync","shouldInstall","env","EXPO_OFFLINE","warn","CommandError","undefined","binaryPath","downloadExpoGoAsync","ora","logNewSection","installAppAsync","stop"],"mappings":"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"}
|
|
@@ -72,7 +72,7 @@ const metroOpenStackFrameMiddleware = (req, res, next)=>{
|
|
|
72
72
|
};
|
|
73
73
|
function createMetroStatusMiddleware(metroConfig) {
|
|
74
74
|
return (_req, res)=>{
|
|
75
|
-
res.setHeader('X-React-Native-Project-Root', metroConfig.projectRoot);
|
|
75
|
+
res.setHeader('X-React-Native-Project-Root', encodeURI(metroConfig.projectRoot));
|
|
76
76
|
res.end('packager-status:running');
|
|
77
77
|
};
|
|
78
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/dev-server/createMetroMiddleware.ts"],"sourcesContent":["import type { MetroConfig } from '@expo/metro/metro';\nimport connect from 'connect';\n\nimport { createEventsSocket } from './createEventSocket';\nimport { createMessagesSocket } from './createMessageSocket';\nimport { Log } from '../../../../log';\nimport { openInEditorAsync } from '../../../../utils/editor';\n\nconst compression = require('compression');\n\nexport function createMetroMiddleware(metroConfig: Pick<MetroConfig, 'projectRoot'>) {\n const messages = createMessagesSocket({ logger: Log });\n const events = createEventsSocket(messages);\n\n const middleware = connect()\n .use(noCacheMiddleware)\n .use(compression())\n // Support opening stack frames from clients directly in the editor\n .use('/open-stack-frame', rawBodyMiddleware)\n .use('/open-stack-frame', metroOpenStackFrameMiddleware)\n // Support the symbolication endpoint of Metro\n // See: https://github.com/facebook/metro/blob/a792d85ffde3c21c3fbf64ac9404ab0afe5ff957/packages/metro/src/Server.js#L1266\n .use('/symbolicate', rawBodyMiddleware)\n // Support status check to detect if the packager needs to be started from the native side\n .use('/status', createMetroStatusMiddleware(metroConfig));\n\n return {\n middleware,\n messagesSocket: messages,\n eventsSocket: events,\n websocketEndpoints: {\n [messages.endpoint]: messages.server,\n [events.endpoint]: events.server,\n },\n };\n}\n\nconst noCacheMiddleware: connect.NextHandleFunction = (req, res, next) => {\n res.setHeader('Surrogate-Control', 'no-store');\n res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');\n res.setHeader('Pragma', 'no-cache');\n res.setHeader('Expires', '0');\n next();\n};\n\nconst rawBodyMiddleware: connect.NextHandleFunction = (req, _res, next) => {\n const reqWithBody = req as typeof req & { rawBody: string };\n reqWithBody.setEncoding('utf8');\n reqWithBody.rawBody = '';\n reqWithBody.on('data', (chunk) => (reqWithBody.rawBody += chunk));\n reqWithBody.on('end', next);\n};\n\nconst metroOpenStackFrameMiddleware: connect.NextHandleFunction = (req, res, next) => {\n // Only accept POST requests\n if (req.method !== 'POST') return next();\n // Only handle requests with a raw body\n if (!('rawBody' in req) || !req.rawBody) {\n res.statusCode = 406;\n return res.end('Open stack frame requires the JSON stack frame as request body');\n }\n\n const frame = JSON.parse(req.rawBody as string);\n openInEditorAsync(frame.file, frame.lineNumber).finally(() => res.end('OK'));\n};\n\nfunction createMetroStatusMiddleware(\n metroConfig: Pick<MetroConfig, 'projectRoot'>\n): connect.NextHandleFunction {\n return (_req, res) => {\n res.setHeader('X-React-Native-Project-Root', metroConfig.projectRoot!);\n res.end('packager-status:running');\n };\n}\n"],"names":["createMetroMiddleware","compression","require","metroConfig","messages","createMessagesSocket","logger","Log","events","createEventsSocket","middleware","connect","use","noCacheMiddleware","rawBodyMiddleware","metroOpenStackFrameMiddleware","createMetroStatusMiddleware","messagesSocket","eventsSocket","websocketEndpoints","endpoint","server","req","res","next","setHeader","_res","reqWithBody","setEncoding","rawBody","on","chunk","method","statusCode","end","frame","JSON","parse","openInEditorAsync","file","lineNumber","finally","_req","projectRoot"],"mappings":";;;;+BAUgBA;;;eAAAA;;;;gEATI;;;;;;mCAEe;qCACE;qBACjB;wBACc;;;;;;AAElC,MAAMC,cAAcC,QAAQ;AAErB,SAASF,sBAAsBG,WAA6C;IACjF,MAAMC,WAAWC,IAAAA,yCAAoB,EAAC;QAAEC,QAAQC,QAAG;IAAC;IACpD,MAAMC,SAASC,IAAAA,qCAAkB,EAACL;IAElC,MAAMM,aAAaC,IAAAA,kBAAO,IACvBC,GAAG,CAACC,mBACJD,GAAG,CAACX,cACL,mEAAmE;KAClEW,GAAG,CAAC,qBAAqBE,mBACzBF,GAAG,CAAC,qBAAqBG,8BAC1B,8CAA8C;IAC9C,0HAA0H;KACzHH,GAAG,CAAC,gBAAgBE,kBACrB,0FAA0F;KACzFF,GAAG,CAAC,WAAWI,4BAA4Bb;IAE9C,OAAO;QACLO;QACAO,gBAAgBb;QAChBc,cAAcV;QACdW,oBAAoB;YAClB,CAACf,SAASgB,QAAQ,CAAC,EAAEhB,SAASiB,MAAM;YACpC,CAACb,OAAOY,QAAQ,CAAC,EAAEZ,OAAOa,MAAM;QAClC;IACF;AACF;AAEA,MAAMR,oBAAgD,CAACS,KAAKC,KAAKC;IAC/DD,IAAIE,SAAS,CAAC,qBAAqB;IACnCF,IAAIE,SAAS,CAAC,iBAAiB;IAC/BF,IAAIE,SAAS,CAAC,UAAU;IACxBF,IAAIE,SAAS,CAAC,WAAW;IACzBD;AACF;AAEA,MAAMV,oBAAgD,CAACQ,KAAKI,MAAMF;IAChE,MAAMG,cAAcL;IACpBK,YAAYC,WAAW,CAAC;IACxBD,YAAYE,OAAO,GAAG;IACtBF,YAAYG,EAAE,CAAC,QAAQ,CAACC,QAAWJ,YAAYE,OAAO,IAAIE;IAC1DJ,YAAYG,EAAE,CAAC,OAAON;AACxB;AAEA,MAAMT,gCAA4D,CAACO,KAAKC,KAAKC;IAC3E,4BAA4B;IAC5B,IAAIF,IAAIU,MAAM,KAAK,QAAQ,OAAOR;IAClC,uCAAuC;IACvC,IAAI,CAAE,CAAA,aAAaF,GAAE,KAAM,CAACA,IAAIO,OAAO,EAAE;QACvCN,IAAIU,UAAU,GAAG;QACjB,OAAOV,IAAIW,GAAG,CAAC;IACjB;IAEA,MAAMC,QAAQC,KAAKC,KAAK,CAACf,IAAIO,OAAO;IACpCS,IAAAA,yBAAiB,EAACH,MAAMI,IAAI,EAAEJ,MAAMK,UAAU,EAAEC,OAAO,CAAC,IAAMlB,IAAIW,GAAG,CAAC;AACxE;AAEA,SAASlB,4BACPb,WAA6C;IAE7C,OAAO,CAACuC,MAAMnB;QACZA,IAAIE,SAAS,CAAC,+BAA+
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/metro/dev-server/createMetroMiddleware.ts"],"sourcesContent":["import type { MetroConfig } from '@expo/metro/metro';\nimport connect from 'connect';\n\nimport { createEventsSocket } from './createEventSocket';\nimport { createMessagesSocket } from './createMessageSocket';\nimport { Log } from '../../../../log';\nimport { openInEditorAsync } from '../../../../utils/editor';\n\nconst compression = require('compression');\n\nexport function createMetroMiddleware(metroConfig: Pick<MetroConfig, 'projectRoot'>) {\n const messages = createMessagesSocket({ logger: Log });\n const events = createEventsSocket(messages);\n\n const middleware = connect()\n .use(noCacheMiddleware)\n .use(compression())\n // Support opening stack frames from clients directly in the editor\n .use('/open-stack-frame', rawBodyMiddleware)\n .use('/open-stack-frame', metroOpenStackFrameMiddleware)\n // Support the symbolication endpoint of Metro\n // See: https://github.com/facebook/metro/blob/a792d85ffde3c21c3fbf64ac9404ab0afe5ff957/packages/metro/src/Server.js#L1266\n .use('/symbolicate', rawBodyMiddleware)\n // Support status check to detect if the packager needs to be started from the native side\n .use('/status', createMetroStatusMiddleware(metroConfig));\n\n return {\n middleware,\n messagesSocket: messages,\n eventsSocket: events,\n websocketEndpoints: {\n [messages.endpoint]: messages.server,\n [events.endpoint]: events.server,\n },\n };\n}\n\nconst noCacheMiddleware: connect.NextHandleFunction = (req, res, next) => {\n res.setHeader('Surrogate-Control', 'no-store');\n res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');\n res.setHeader('Pragma', 'no-cache');\n res.setHeader('Expires', '0');\n next();\n};\n\nconst rawBodyMiddleware: connect.NextHandleFunction = (req, _res, next) => {\n const reqWithBody = req as typeof req & { rawBody: string };\n reqWithBody.setEncoding('utf8');\n reqWithBody.rawBody = '';\n reqWithBody.on('data', (chunk) => (reqWithBody.rawBody += chunk));\n reqWithBody.on('end', next);\n};\n\nconst metroOpenStackFrameMiddleware: connect.NextHandleFunction = (req, res, next) => {\n // Only accept POST requests\n if (req.method !== 'POST') return next();\n // Only handle requests with a raw body\n if (!('rawBody' in req) || !req.rawBody) {\n res.statusCode = 406;\n return res.end('Open stack frame requires the JSON stack frame as request body');\n }\n\n const frame = JSON.parse(req.rawBody as string);\n openInEditorAsync(frame.file, frame.lineNumber).finally(() => res.end('OK'));\n};\n\nfunction createMetroStatusMiddleware(\n metroConfig: Pick<MetroConfig, 'projectRoot'>\n): connect.NextHandleFunction {\n return (_req, res) => {\n res.setHeader('X-React-Native-Project-Root', encodeURI(metroConfig.projectRoot!));\n res.end('packager-status:running');\n };\n}\n"],"names":["createMetroMiddleware","compression","require","metroConfig","messages","createMessagesSocket","logger","Log","events","createEventsSocket","middleware","connect","use","noCacheMiddleware","rawBodyMiddleware","metroOpenStackFrameMiddleware","createMetroStatusMiddleware","messagesSocket","eventsSocket","websocketEndpoints","endpoint","server","req","res","next","setHeader","_res","reqWithBody","setEncoding","rawBody","on","chunk","method","statusCode","end","frame","JSON","parse","openInEditorAsync","file","lineNumber","finally","_req","encodeURI","projectRoot"],"mappings":";;;;+BAUgBA;;;eAAAA;;;;gEATI;;;;;;mCAEe;qCACE;qBACjB;wBACc;;;;;;AAElC,MAAMC,cAAcC,QAAQ;AAErB,SAASF,sBAAsBG,WAA6C;IACjF,MAAMC,WAAWC,IAAAA,yCAAoB,EAAC;QAAEC,QAAQC,QAAG;IAAC;IACpD,MAAMC,SAASC,IAAAA,qCAAkB,EAACL;IAElC,MAAMM,aAAaC,IAAAA,kBAAO,IACvBC,GAAG,CAACC,mBACJD,GAAG,CAACX,cACL,mEAAmE;KAClEW,GAAG,CAAC,qBAAqBE,mBACzBF,GAAG,CAAC,qBAAqBG,8BAC1B,8CAA8C;IAC9C,0HAA0H;KACzHH,GAAG,CAAC,gBAAgBE,kBACrB,0FAA0F;KACzFF,GAAG,CAAC,WAAWI,4BAA4Bb;IAE9C,OAAO;QACLO;QACAO,gBAAgBb;QAChBc,cAAcV;QACdW,oBAAoB;YAClB,CAACf,SAASgB,QAAQ,CAAC,EAAEhB,SAASiB,MAAM;YACpC,CAACb,OAAOY,QAAQ,CAAC,EAAEZ,OAAOa,MAAM;QAClC;IACF;AACF;AAEA,MAAMR,oBAAgD,CAACS,KAAKC,KAAKC;IAC/DD,IAAIE,SAAS,CAAC,qBAAqB;IACnCF,IAAIE,SAAS,CAAC,iBAAiB;IAC/BF,IAAIE,SAAS,CAAC,UAAU;IACxBF,IAAIE,SAAS,CAAC,WAAW;IACzBD;AACF;AAEA,MAAMV,oBAAgD,CAACQ,KAAKI,MAAMF;IAChE,MAAMG,cAAcL;IACpBK,YAAYC,WAAW,CAAC;IACxBD,YAAYE,OAAO,GAAG;IACtBF,YAAYG,EAAE,CAAC,QAAQ,CAACC,QAAWJ,YAAYE,OAAO,IAAIE;IAC1DJ,YAAYG,EAAE,CAAC,OAAON;AACxB;AAEA,MAAMT,gCAA4D,CAACO,KAAKC,KAAKC;IAC3E,4BAA4B;IAC5B,IAAIF,IAAIU,MAAM,KAAK,QAAQ,OAAOR;IAClC,uCAAuC;IACvC,IAAI,CAAE,CAAA,aAAaF,GAAE,KAAM,CAACA,IAAIO,OAAO,EAAE;QACvCN,IAAIU,UAAU,GAAG;QACjB,OAAOV,IAAIW,GAAG,CAAC;IACjB;IAEA,MAAMC,QAAQC,KAAKC,KAAK,CAACf,IAAIO,OAAO;IACpCS,IAAAA,yBAAiB,EAACH,MAAMI,IAAI,EAAEJ,MAAMK,UAAU,EAAEC,OAAO,CAAC,IAAMlB,IAAIW,GAAG,CAAC;AACxE;AAEA,SAASlB,4BACPb,WAA6C;IAE7C,OAAO,CAACuC,MAAMnB;QACZA,IAAIE,SAAS,CAAC,+BAA+BkB,UAAUxC,YAAYyC,WAAW;QAC9ErB,IAAIW,GAAG,CAAC;IACV;AACF"}
|
|
@@ -33,7 +33,7 @@ class FetchClient {
|
|
|
33
33
|
this.headers = {
|
|
34
34
|
accept: 'application/json',
|
|
35
35
|
'content-type': 'application/json',
|
|
36
|
-
'user-agent': `expo-cli/${"0.26.
|
|
36
|
+
'user-agent': `expo-cli/${"0.26.9"}`,
|
|
37
37
|
authorization: 'Basic ' + _nodebuffer().Buffer.from(`${target}:`).toString('base64')
|
|
38
38
|
};
|
|
39
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.9",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@expo/image-utils": "^0.8.6",
|
|
50
50
|
"@expo/json-file": "^10.0.6",
|
|
51
51
|
"@expo/metro": "~0.1.1",
|
|
52
|
-
"@expo/metro-config": "~0.21.
|
|
52
|
+
"@expo/metro-config": "~0.21.11",
|
|
53
53
|
"@expo/osascript": "^2.3.6",
|
|
54
54
|
"@expo/package-manager": "^1.9.6",
|
|
55
55
|
"@expo/plist": "^0.4.6",
|
|
@@ -167,5 +167,5 @@
|
|
|
167
167
|
"tree-kill": "^1.2.2",
|
|
168
168
|
"tsd": "^0.28.1"
|
|
169
169
|
},
|
|
170
|
-
"gitHead": "
|
|
170
|
+
"gitHead": "d087a2182086089f23bcee65e27434f21db50128"
|
|
171
171
|
}
|