@expo/cli 0.10.1 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +2 -2
- package/build/src/start/index.js +24 -24
- package/build/src/start/index.js.map +1 -1
- package/build/src/start/interface/commandsTable.js +4 -0
- package/build/src/start/interface/commandsTable.js.map +1 -1
- package/build/src/start/server/middleware/ClassicManifestMiddleware.js +1 -1
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js +7 -26
- package/build/src/start/server/middleware/ExpoGoManifestHandlerMiddleware.js.map +1 -1
- package/build/src/start/server/middleware/resolvePlatform.js +2 -2
- package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/package.json +5 -5
package/build/bin/cli
CHANGED
|
@@ -132,7 +132,7 @@ const args = (0, _arg).default({
|
|
|
132
132
|
});
|
|
133
133
|
if (args["--version"]) {
|
|
134
134
|
// Version is added in the build script.
|
|
135
|
-
console.log("0.10.
|
|
135
|
+
console.log("0.10.3");
|
|
136
136
|
process.exit(0);
|
|
137
137
|
}
|
|
138
138
|
if (args["--non-interactive"]) {
|
|
@@ -262,7 +262,7 @@ commands[command]().then((exec)=>{
|
|
|
262
262
|
logEventAsync("action", {
|
|
263
263
|
action: `expo ${command}`,
|
|
264
264
|
source: "expo/cli",
|
|
265
|
-
source_version: "0.10.
|
|
265
|
+
source_version: "0.10.3"
|
|
266
266
|
});
|
|
267
267
|
});
|
|
268
268
|
|
package/build/src/start/index.js
CHANGED
|
@@ -71,35 +71,35 @@ const expoStart = async (argv)=>{
|
|
|
71
71
|
}, argv);
|
|
72
72
|
if (args["--help"]) {
|
|
73
73
|
(0, _args).printHelp(`Start a local dev server for the app`, _chalk.default`npx expo start {dim <dir>}`, [
|
|
74
|
-
_chalk.default`<dir>
|
|
75
|
-
`-a, --android
|
|
76
|
-
`-i, --ios
|
|
77
|
-
`-w, --web
|
|
74
|
+
_chalk.default`<dir> Directory of the Expo project. {dim Default: Current working directory}`,
|
|
75
|
+
`-a, --android Open on a connected Android device`,
|
|
76
|
+
`-i, --ios Open in an iOS simulator`,
|
|
77
|
+
`-w, --web Open in a web browser`,
|
|
78
78
|
``,
|
|
79
|
-
_chalk.default`-d, --dev-client
|
|
80
|
-
_chalk.default`-g, --go
|
|
79
|
+
_chalk.default`-d, --dev-client Launch in a custom native app`,
|
|
80
|
+
_chalk.default`-g, --go Launch in Expo Go`,
|
|
81
81
|
``,
|
|
82
|
-
`-c, --clear
|
|
83
|
-
`--max-workers <number>
|
|
84
|
-
`--no-dev
|
|
85
|
-
`--minify
|
|
82
|
+
`-c, --clear Clear the bundler cache`,
|
|
83
|
+
`--max-workers <number> Maximum number of tasks to allow Metro to spawn`,
|
|
84
|
+
`--no-dev Bundle in production mode`,
|
|
85
|
+
`--minify Minify JavaScript`,
|
|
86
86
|
``,
|
|
87
|
-
_chalk.default`-m, --host <
|
|
88
|
-
_chalk.default`
|
|
89
|
-
_chalk.default`
|
|
90
|
-
_chalk.default`
|
|
91
|
-
`--tunnel
|
|
92
|
-
`--lan
|
|
93
|
-
`--localhost
|
|
87
|
+
_chalk.default`-m, --host <string> Dev server hosting type. {dim Default: lan}`,
|
|
88
|
+
_chalk.default` {bold lan}: Use the local network`,
|
|
89
|
+
_chalk.default` {bold tunnel}: Use any network by tunnel through ngrok`,
|
|
90
|
+
_chalk.default` {bold localhost}: Connect to the dev server over localhost`,
|
|
91
|
+
`--tunnel Same as --host tunnel`,
|
|
92
|
+
`--lan Same as --host lan`,
|
|
93
|
+
`--localhost Same as --host localhost`,
|
|
94
94
|
``,
|
|
95
|
-
`--offline
|
|
96
|
-
`--https
|
|
97
|
-
`--scheme <scheme>
|
|
98
|
-
_chalk.default`-p, --port <number>
|
|
95
|
+
`--offline Skip network requests and use anonymous manifest signatures`,
|
|
96
|
+
`--https Start the dev server with https protocol`,
|
|
97
|
+
`--scheme <scheme> Custom URI protocol to use when launching an app`,
|
|
98
|
+
_chalk.default`-p, --port <number> Port to start the dev server on (does not apply to web or tunnel). {dim Default: 8081}`,
|
|
99
99
|
``,
|
|
100
|
-
`--force-manifest-type <
|
|
101
|
-
_chalk.default`--private-key-path <path>
|
|
102
|
-
`-h, --help
|
|
100
|
+
_chalk.default`--force-manifest-type <string> Override auto detection of manifest type. {dim Options: expo-updates, classic}`,
|
|
101
|
+
_chalk.default`--private-key-path <path> Path to private key for code signing. {dim Default: "private-key.pem" in the same directory as the certificate specified by the expo-updates configuration in app.json.}`,
|
|
102
|
+
`-h, --help Usage info`,
|
|
103
103
|
].join("\n"));
|
|
104
104
|
}
|
|
105
105
|
const projectRoot = (0, _args).getProjectRoot(args);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/start/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 expoStart: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clear': Boolean,\n '--max-workers': Number,\n '--no-dev': Boolean,\n '--minify': Boolean,\n '--https': Boolean,\n '--force-manifest-type': String,\n '--private-key-path': String,\n '--port': Number,\n '--dev-client': Boolean,\n '--scheme': String,\n '--android': Boolean,\n '--ios': Boolean,\n '--web': Boolean,\n '--host': String,\n '--tunnel': Boolean,\n '--lan': Boolean,\n '--localhost': Boolean,\n '--offline': Boolean,\n '--go': Boolean,\n // Aliases\n '-h': '--help',\n '-c': '--clear',\n '-p': '--port',\n '-a': '--android',\n '-i': '--ios',\n '-w': '--web',\n '-m': '--host',\n '-d': '--dev-client',\n '-g': '--go',\n // Alias for adding interop with the Metro docs and RedBox errors.\n '--reset-cache': '--clear',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Start a local dev server for the app`,\n chalk`npx expo start {dim <dir>}`,\n [\n chalk`<dir>
|
|
1
|
+
{"version":3,"sources":["../../../src/start/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 expoStart: Command = async (argv) => {\n const args = assertArgs(\n {\n // Types\n '--help': Boolean,\n '--clear': Boolean,\n '--max-workers': Number,\n '--no-dev': Boolean,\n '--minify': Boolean,\n '--https': Boolean,\n '--force-manifest-type': String,\n '--private-key-path': String,\n '--port': Number,\n '--dev-client': Boolean,\n '--scheme': String,\n '--android': Boolean,\n '--ios': Boolean,\n '--web': Boolean,\n '--host': String,\n '--tunnel': Boolean,\n '--lan': Boolean,\n '--localhost': Boolean,\n '--offline': Boolean,\n '--go': Boolean,\n // Aliases\n '-h': '--help',\n '-c': '--clear',\n '-p': '--port',\n '-a': '--android',\n '-i': '--ios',\n '-w': '--web',\n '-m': '--host',\n '-d': '--dev-client',\n '-g': '--go',\n // Alias for adding interop with the Metro docs and RedBox errors.\n '--reset-cache': '--clear',\n },\n argv\n );\n\n if (args['--help']) {\n printHelp(\n `Start a local dev server for the app`,\n chalk`npx expo start {dim <dir>}`,\n [\n chalk`<dir> Directory of the Expo project. {dim Default: Current working directory}`,\n `-a, --android Open on a connected Android device`,\n `-i, --ios Open in an iOS simulator`,\n `-w, --web Open in a web browser`,\n ``,\n chalk`-d, --dev-client Launch in a custom native app`,\n chalk`-g, --go Launch in Expo Go`,\n ``,\n `-c, --clear Clear the bundler cache`,\n `--max-workers <number> Maximum number of tasks to allow Metro to spawn`,\n `--no-dev Bundle in production mode`,\n `--minify Minify JavaScript`,\n ``,\n chalk`-m, --host <string> Dev server hosting type. {dim Default: lan}`,\n chalk` {bold lan}: Use the local network`,\n chalk` {bold tunnel}: Use any network by tunnel through ngrok`,\n chalk` {bold localhost}: Connect to the dev server over localhost`,\n `--tunnel Same as --host tunnel`,\n `--lan Same as --host lan`,\n `--localhost Same as --host localhost`,\n ``,\n `--offline Skip network requests and use anonymous manifest signatures`,\n `--https Start the dev server with https protocol`,\n `--scheme <scheme> Custom URI protocol to use when launching an app`,\n chalk`-p, --port <number> Port to start the dev server on (does not apply to web or tunnel). {dim Default: 8081}`,\n ``,\n chalk`--force-manifest-type <string> Override auto detection of manifest type. {dim Options: expo-updates, classic}`,\n chalk`--private-key-path <path> Path to private key for code signing. {dim Default: \"private-key.pem\" in the same directory as the certificate specified by the expo-updates configuration in app.json.}`,\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(projectRoot, args).catch(logCmdError);\n\n if (options.offline) {\n const { disableNetwork } = await import('../api/settings');\n disableNetwork();\n }\n\n const { startAsync } = await import('./startAsync');\n return startAsync(projectRoot, options, { webOnly: false }).catch(logCmdError);\n};\n"],"names":["expoStart","argv","args","assertArgs","Boolean","Number","String","printHelp","chalk","join","projectRoot","getProjectRoot","resolveOptionsAsync","options","catch","logCmdError","offline","disableNetwork","startAsync","webOnly"],"mappings":"AAAA;;;;;;AACkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAG6B,IAAA,KAAe,WAAf,eAAe,CAAA;AACzC,IAAA,OAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtC,MAAMA,SAAS,GAAY,OAAOC,IAAI,GAAK;IAChD,MAAMC,IAAI,GAAGC,CAAAA,GAAAA,KAAU,AAqCtB,CAAA,WArCsB,CACrB;QACE,QAAQ;QACR,QAAQ,EAAEC,OAAO;QACjB,SAAS,EAAEA,OAAO;QAClB,eAAe,EAAEC,MAAM;QACvB,UAAU,EAAED,OAAO;QACnB,UAAU,EAAEA,OAAO;QACnB,SAAS,EAAEA,OAAO;QAClB,uBAAuB,EAAEE,MAAM;QAC/B,oBAAoB,EAAEA,MAAM;QAC5B,QAAQ,EAAED,MAAM;QAChB,cAAc,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,CAAC;YACjG,CAAC,qDAAqD,CAAC;YACvD,CAAC,kDAAkD,CAAC;YACpD,CAAC,wDAAwD,CAAC;YAC1D,CAAC,CAAC;YACF,CAAC,2FAA2F,CAAC;YAC7F,CAAC,wEAAwE,CAAC;YAC1E,CAAC,gFAAgF,CAAC;YAClFA,MAAK,QAAA,CAAC,sHAAsH,CAAC;YAC7H,CAAC,CAAC;YACFA,MAAK,QAAA,CAAC,8GAA8G,CAAC;YACrHA,MAAK,QAAA,CAAC,wMAAwM,CAAC;YAC/M,CAAC,0CAA0C,CAAC;SAC7C,CAACC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;KACH;IAED,MAAMC,WAAW,GAAGC,CAAAA,GAAAA,KAAc,AAAM,CAAA,eAAN,CAACT,IAAI,CAAC,AAAC;IACzC,MAAM,EAAEU,mBAAmB,CAAA,EAAE,GAAG,MAAM;+CAAO,kBAAkB;MAAC,AAAC;IACjE,MAAMC,OAAO,GAAG,MAAMD,mBAAmB,CAACF,WAAW,EAAER,IAAI,CAAC,CAACY,KAAK,CAACC,OAAW,YAAA,CAAC,AAAC;IAEhF,IAAIF,OAAO,CAACG,OAAO,EAAE;QACnB,MAAM,EAAEC,cAAc,CAAA,EAAE,GAAG,MAAM;mDAAO,iBAAiB;UAAC,AAAC;QAC3DA,cAAc,EAAE,CAAC;KAClB;IAED,MAAM,EAAEC,UAAU,CAAA,EAAE,GAAG,MAAM;+CAAO,cAAc;MAAC,AAAC;IACpD,OAAOA,UAAU,CAACR,WAAW,EAAEG,OAAO,EAAE;QAAEM,OAAO,EAAE,KAAK;KAAE,CAAC,CAACL,KAAK,CAACC,OAAW,YAAA,CAAC,CAAC;CAChF,AAAC;QAzFWf,SAAS,GAATA,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/start/interface/commandsTable.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport chalk from 'chalk';\nimport qrcode from 'qrcode-terminal';\nimport wrapAnsi from 'wrap-ansi';\n\nimport * as Log from '../../log';\n\nexport const BLT = '\\u203A';\n\nexport type StartOptions = {\n isWebSocketsEnabled?: boolean;\n devClient?: boolean;\n reset?: boolean;\n nonPersistent?: boolean;\n maxWorkers?: number;\n platforms?: ExpoConfig['platforms'];\n};\n\nexport const printHelp = (): void => {\n logCommandsTable([{ key: '?', msg: 'show all commands' }]);\n};\n\n/** Print the world famous 'Expo QR Code'. */\nexport function printQRCode(url: string) {\n qrcode.generate(url, { small: true }, (code) => Log.log(code));\n}\n\nexport const getTerminalColumns = () => process.stdout.columns || 80;\nexport const printItem = (text: string): string =>\n `${BLT} ` + wrapAnsi(text, getTerminalColumns()).trimStart();\n\nexport function printUsage(\n options: Pick<StartOptions, 'devClient' | 'isWebSocketsEnabled' | 'platforms'>,\n { verbose }: { verbose: boolean }\n) {\n const isMac = process.platform === 'darwin';\n\n const { platforms = ['ios', 'android', 'web'] } = options;\n\n const isAndroidDisabled = !platforms.includes('android');\n const isIosDisabled = !platforms.includes('ios');\n const isWebDisable = !platforms.includes('web');\n\n const switchMsg = `switch to ${options.devClient === false ? 'development build' : 'Expo Go'}`;\n const target = options.devClient === false ? `Expo Go` : 'development build';\n\n Log.log();\n Log.log(printItem(chalk`Using {cyan ${target}}`));\n\n if (verbose) {\n logCommandsTable([\n { key: 's', msg: switchMsg },\n {},\n { key: 'a', msg: 'open Android', disabled: isAndroidDisabled },\n { key: 'shift+a', msg: 'select a device or emulator', disabled: isAndroidDisabled },\n isMac && { key: 'i', msg: 'open iOS simulator', disabled: isIosDisabled },\n isMac && { key: 'shift+i', msg: 'select a simulator', disabled: isIosDisabled },\n { key: 'w', msg: 'open web', disabled: isWebDisable },\n {},\n { key: 'r', msg: 'reload app' },\n !!options.isWebSocketsEnabled && { key: 'j', msg: 'open debugger' },\n !!options.isWebSocketsEnabled && { key: 'm', msg: 'toggle menu' },\n !!options.isWebSocketsEnabled && { key: 'shift+m', msg: 'more tools' },\n { key: 'o', msg: 'open project code in your editor' },\n { key: 'c', msg: 'show project QR' },\n {},\n ]);\n } else {\n logCommandsTable([\n { key: 's', msg: switchMsg },\n {},\n { key: 'a', msg: 'open Android', disabled: isAndroidDisabled },\n isMac && { key: 'i', msg: 'open iOS simulator', disabled: isIosDisabled },\n { key: 'w', msg: 'open web', disabled: isWebDisable },\n {},\n { key: 'j', msg: 'open debugger' },\n { key: 'r', msg: 'reload app' },\n !!options.isWebSocketsEnabled && { key: 'm', msg: 'toggle menu' },\n {},\n ]);\n }\n}\n\nfunction logCommandsTable(\n ui: (false | { key?: string; msg?: string; status?: string; disabled?: boolean })[]\n) {\n Log.log(\n ui\n .filter(Boolean)\n // @ts-ignore: filter doesn't work\n .map(({ key, msg, status, disabled }) => {\n if (!key) return '';\n let view = `${BLT} `;\n if (key.length === 1) view += 'Press ';\n view += chalk`{bold ${key}} {dim │} `;\n view += msg;\n if (status) {\n view += ` ${chalk.dim(`(${chalk.italic(status)})`)}`;\n }\n if (disabled) {\n view = chalk.dim(view);\n }\n return view;\n })\n .join('\\n')\n );\n}\n"],"names":["printQRCode","printUsage","Log","BLT","printHelp","logCommandsTable","key","msg","url","qrcode","generate","small","code","log","getTerminalColumns","process","stdout","columns","printItem","text","wrapAnsi","trimStart","options","verbose","isMac","platform","platforms","isAndroidDisabled","includes","isIosDisabled","isWebDisable","switchMsg","devClient","target","chalk","disabled","isWebSocketsEnabled","ui","filter","Boolean","map","status","view","length","dim","italic","join"],"mappings":"AAAA;;;;QAuBgBA,WAAW,GAAXA,WAAW;QAQXC,UAAU,GAAVA,UAAU;;AA9BR,IAAA,MAAO,kCAAP,OAAO,EAAA;AACN,IAAA,eAAiB,kCAAjB,iBAAiB,EAAA;AACf,IAAA,SAAW,kCAAX,WAAW,EAAA;AAEpBC,IAAAA,GAAG,mCAAM,WAAW,EAAjB;;;;;;;;;;;;;;;;;;;;;;;;;;;AAER,MAAMC,GAAG,GAAG,QAAQ,AAAC;QAAfA,GAAG,GAAHA,GAAG;AAWT,MAA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C,IAAI,CAAC7B,GAAG,EAAE,OAAO,EAAE,CAAC;QACpB,IAAIoC,IAAI,GAAG,CAAC,EAAEvC,GAAG,CAAC,CAAC,CAAC,AAAC;QACrB,IAAIG,GAAG,CAACqC,MAAM,KAAK,CAAC,EAAED,IAAI,IAAI,QAAQ,CAAC;QACvCA,IAAI,IAAIR,MAAK,QAAA,CAAC,MAAM,EAAE5B,GAAG,CAAC,YAAU,CAAC,CAAC;QACtCoC,IAAI,IAAInC,GAAG,CAAC;QACZ,IAAIkC,MAAM,EAAE;YACVC,IAAI,IAAI,CAAC,CAAC,EAAER,MAAK,QAAA,CAACU,GAAG,CAAC,CAAC,CAAC,EAAEV,MAAK,QAAA,CAACW,MAAM,CAACJ,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACtD;QACD,IAAIN,QAAQ,EAAE;YACZO,IAAI,GAAGR,MAAK,QAAA,CAACU,GAAG,CAACF,IAAI,CAAC,CAAC;SACxB;QACD,OAAOA,IAAI,CAAC;KACb,CAAC,CACDI,IAAI,CAAC,IAAI,CAAC,CACd,CAAC;CACH"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/start/interface/commandsTable.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\nimport chalk from 'chalk';\nimport qrcode from 'qrcode-terminal';\nimport wrapAnsi from 'wrap-ansi';\n\nimport * as Log from '../../log';\n\nexport const BLT = '\\u203A';\n\nexport type StartOptions = {\n isWebSocketsEnabled?: boolean;\n devClient?: boolean;\n reset?: boolean;\n nonPersistent?: boolean;\n maxWorkers?: number;\n platforms?: ExpoConfig['platforms'];\n};\n\nexport const printHelp = (): void => {\n logCommandsTable([{ key: '?', msg: 'show all commands' }]);\n};\n\n/** Print the world famous 'Expo QR Code'. */\nexport function printQRCode(url: string) {\n qrcode.generate(url, { small: true }, (code) => Log.log(code));\n}\n\nexport const getTerminalColumns = () => process.stdout.columns || 80;\nexport const printItem = (text: string): string =>\n `${BLT} ` + wrapAnsi(text, getTerminalColumns()).trimStart();\n\nexport function printUsage(\n options: Pick<StartOptions, 'devClient' | 'isWebSocketsEnabled' | 'platforms'>,\n { verbose }: { verbose: boolean }\n) {\n const isMac = process.platform === 'darwin';\n\n const { platforms = ['ios', 'android', 'web'] } = options;\n\n const isAndroidDisabled = !platforms.includes('android');\n const isIosDisabled = !platforms.includes('ios');\n const isWebDisable = !platforms.includes('web');\n\n const switchMsg = `switch to ${options.devClient === false ? 'development build' : 'Expo Go'}`;\n const target = options.devClient === false ? `Expo Go` : 'development build';\n\n Log.log();\n Log.log(printItem(chalk`Using {cyan ${target}}`));\n\n if (verbose) {\n logCommandsTable([\n { key: 's', msg: switchMsg },\n {},\n { key: 'a', msg: 'open Android', disabled: isAndroidDisabled },\n { key: 'shift+a', msg: 'select a device or emulator', disabled: isAndroidDisabled },\n isMac && { key: 'i', msg: 'open iOS simulator', disabled: isIosDisabled },\n isMac && { key: 'shift+i', msg: 'select a simulator', disabled: isIosDisabled },\n { key: 'w', msg: 'open web', disabled: isWebDisable },\n {},\n { key: 'r', msg: 'reload app' },\n !!options.isWebSocketsEnabled && { key: 'j', msg: 'open debugger' },\n !!options.isWebSocketsEnabled && { key: 'm', msg: 'toggle menu' },\n !!options.isWebSocketsEnabled && { key: 'shift+m', msg: 'more tools' },\n { key: 'o', msg: 'open project code in your editor' },\n { key: 'c', msg: 'show project QR' },\n {},\n ]);\n } else {\n logCommandsTable([\n { key: 's', msg: switchMsg },\n {},\n { key: 'a', msg: 'open Android', disabled: isAndroidDisabled },\n isMac && { key: 'i', msg: 'open iOS simulator', disabled: isIosDisabled },\n { key: 'w', msg: 'open web', disabled: isWebDisable },\n {},\n { key: 'j', msg: 'open debugger' },\n { key: 'r', msg: 'reload app' },\n !!options.isWebSocketsEnabled && { key: 'm', msg: 'toggle menu' },\n { key: 'o', msg: 'open project code in your editor' },\n {},\n ]);\n }\n}\n\nfunction logCommandsTable(\n ui: (false | { key?: string; msg?: string; status?: string; disabled?: boolean })[]\n) {\n Log.log(\n ui\n .filter(Boolean)\n // @ts-ignore: filter doesn't work\n .map(({ key, msg, status, disabled }) => {\n if (!key) return '';\n let view = `${BLT} `;\n if (key.length === 1) view += 'Press ';\n view += chalk`{bold ${key}} {dim │} `;\n view += msg;\n if (status) {\n view += ` ${chalk.dim(`(${chalk.italic(status)})`)}`;\n }\n if (disabled) {\n view = chalk.dim(view);\n }\n return view;\n })\n .join('\\n')\n );\n}\n"],"names":["printQRCode","printUsage","Log","BLT","printHelp","logCommandsTable","key","msg","url","qrcode","generate","small","code","log","getTerminalColumns","process","stdout","columns","printItem","text","wrapAnsi","trimStart","options","verbose","isMac","platform","platforms","isAndroidDisabled","includes","isIosDisabled","isWebDisable","switchMsg","devClient","target","chalk","disabled","isWebSocketsEnabled","ui","filter","Boolean","map","status","view","length","dim","italic","join"],"mappings":"AAAA;;;;QAuBgBA,WAAW,GAAXA,WAAW;QAQXC,UAAU,GAAVA,UAAU;;AA9BR,IAAA,MAAO,kCAAP,OAAO,EAAA;AACN,IAAA,eAAiB,kCAAjB,iBAAiB,EAAA;AACf,IAAA,SAAW,kCAAX,WAAW,EAAA;AAEpBC,IAAAA,GAAG,mCAAM,WAAW,EAAjB;;;;;;;;;;;;;;;;;;;;;;;;;;;AAER,MAAMC,GAAG,GAAG,QAAQ,AAAC;QAAfA,GAAG,GAAHA,GAAG;AAWT,MAAMC,SAAS,GAAG,IAAY;IACnCC,gBAAgB,CAAC;QAAC;YAAEC,GAAG,EAAE,GAAG;YAAEC,GAAG,EAAE,mBAAmB;SAAE;KAAC,CAAC,CAAC;CAC5D,AAAC;QAFWH,SAAS,GAATA,SAAS;AAKf,SAASJ,WAAW,CAACQ,GAAW,EAAE;IACvCC,eAAM,QAAA,CAACC,QAAQ,CAACF,GAAG,EAAE;QAAEG,KAAK,EAAE,IAAI;KAAE,EAAE,CAACC,IAAI,GAAKV,GAAG,CAACW,GAAG,CAACD,IAAI,CAAC;IAAA,CAAC,CAAC;CAChE;AAEM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;QACZ,IAAIkC,MAAM,EAAE;YACVC,IAAI,IAAI,CAAC,CAAC,EAAER,MAAK,QAAA,CAACU,GAAG,CAAC,CAAC,CAAC,EAAEV,MAAK,QAAA,CAACW,MAAM,CAACJ,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACtD;QACD,IAAIN,QAAQ,EAAE;YACZO,IAAI,GAAGR,MAAK,QAAA,CAACU,GAAG,CAACF,IAAI,CAAC,CAAC;SACxB;QACD,OAAOA,IAAI,CAAC;KACb,CAAC,CACDI,IAAI,CAAC,IAAI,CAAC,CACd,CAAC;CACH"}
|
|
@@ -138,7 +138,7 @@ async function createHostInfoAsync() {
|
|
|
138
138
|
host: await _userSettings.default.getAnonymousIdentifierAsync(),
|
|
139
139
|
server: "expo",
|
|
140
140
|
// Defined in the build step
|
|
141
|
-
serverVersion: "0.10.
|
|
141
|
+
serverVersion: "0.10.3",
|
|
142
142
|
serverDriver: _manifestMiddleware.DEVELOPER_TOOL,
|
|
143
143
|
serverOS: _os.default.platform(),
|
|
144
144
|
serverOSVersion: _os.default.release()
|
|
@@ -10,10 +10,8 @@ var _formData = _interopRequireDefault(require("form-data"));
|
|
|
10
10
|
var _structuredHeaders = require("structured-headers");
|
|
11
11
|
var _userSettings = _interopRequireDefault(require("../../../api/user/UserSettings"));
|
|
12
12
|
var _user = require("../../../api/user/user");
|
|
13
|
-
var Log = _interopRequireWildcard(require("../../../log"));
|
|
14
13
|
var _rudderstackClient = require("../../../utils/analytics/rudderstackClient");
|
|
15
14
|
var _codesigning = require("../../../utils/codesigning");
|
|
16
|
-
var _env = require("../../../utils/env");
|
|
17
15
|
var _errors = require("../../../utils/errors");
|
|
18
16
|
var _url = require("../../../utils/url");
|
|
19
17
|
var _manifestMiddleware = require("./ManifestMiddleware");
|
|
@@ -23,27 +21,6 @@ function _interopRequireDefault(obj) {
|
|
|
23
21
|
default: obj
|
|
24
22
|
};
|
|
25
23
|
}
|
|
26
|
-
function _interopRequireWildcard(obj) {
|
|
27
|
-
if (obj && obj.__esModule) {
|
|
28
|
-
return obj;
|
|
29
|
-
} else {
|
|
30
|
-
var newObj = {};
|
|
31
|
-
if (obj != null) {
|
|
32
|
-
for(var key in obj){
|
|
33
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
34
|
-
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
35
|
-
if (desc.get || desc.set) {
|
|
36
|
-
Object.defineProperty(newObj, key, desc);
|
|
37
|
-
} else {
|
|
38
|
-
newObj[key] = obj[key];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
newObj.default = obj;
|
|
44
|
-
return newObj;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
24
|
const debug = require("debug")("expo:start:server:middleware:ExpoGoManifestHandlerMiddleware");
|
|
48
25
|
var ResponseContentType;
|
|
49
26
|
exports.ResponseContentType = ResponseContentType;
|
|
@@ -57,8 +34,8 @@ class ExpoGoManifestHandlerMiddleware extends _manifestMiddleware.ManifestMiddle
|
|
|
57
34
|
getParsedHeaders(req) {
|
|
58
35
|
let platform = (0, _resolvePlatform).parsePlatformHeader(req);
|
|
59
36
|
if (!platform) {
|
|
60
|
-
debug(`No "expo-platform" header or "platform" query parameter specified. Falling back to "
|
|
61
|
-
platform = "
|
|
37
|
+
debug(`No "expo-platform" header or "platform" query parameter specified. Falling back to "ios".`);
|
|
38
|
+
platform = "ios";
|
|
62
39
|
}
|
|
63
40
|
(0, _resolvePlatform).assertRuntimePlatform(platform);
|
|
64
41
|
// Expo Updates clients explicitly accept "multipart/mixed" responses while browsers implicitly
|
|
@@ -231,7 +208,11 @@ class ExpoGoManifestHandlerMiddleware extends _manifestMiddleware.ManifestMiddle
|
|
|
231
208
|
if (scopeKeyFromCodeSigningInfo) {
|
|
232
209
|
return scopeKeyFromCodeSigningInfo;
|
|
233
210
|
}
|
|
234
|
-
Log.warn(
|
|
211
|
+
// Log.warn(
|
|
212
|
+
// env.EXPO_OFFLINE
|
|
213
|
+
// ? 'Using anonymous scope key in manifest for offline mode.'
|
|
214
|
+
// : 'Using anonymous scope key in manifest.'
|
|
215
|
+
// );
|
|
235
216
|
return await getAnonymousScopeKeyAsync(slug);
|
|
236
217
|
}
|
|
237
218
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/middleware/ExpoGoManifestHandlerMiddleware.ts"],"sourcesContent":["import { ExpoUpdatesManifest } from '@expo/config';\nimport { Updates } from '@expo/config-plugins';\nimport accepts from 'accepts';\nimport crypto from 'crypto';\nimport FormData from 'form-data';\nimport { serializeDictionary, Dictionary } from 'structured-headers';\n\nimport UserSettings from '../../../api/user/UserSettings';\nimport { ANONYMOUS_USERNAME } from '../../../api/user/user';\nimport * as Log from '../../../log';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport {\n CodeSigningInfo,\n getCodeSigningInfoAsync,\n signManifestString,\n} from '../../../utils/codesigning';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { stripPort } from '../../../utils/url';\nimport { ManifestMiddleware, ManifestRequestInfo } from './ManifestMiddleware';\nimport { assertRuntimePlatform, parsePlatformHeader } from './resolvePlatform';\nimport { ServerHeaders, ServerRequest } from './server.types';\n\nconst debug = require('debug')('expo:start:server:middleware:ExpoGoManifestHandlerMiddleware');\n\nexport enum ResponseContentType {\n TEXT_PLAIN,\n APPLICATION_JSON,\n APPLICATION_EXPO_JSON,\n MULTIPART_MIXED,\n}\n\ninterface ExpoGoManifestRequestInfo extends ManifestRequestInfo {\n responseContentType: ResponseContentType;\n expectSignature: string | null;\n}\n\nexport class ExpoGoManifestHandlerMiddleware extends ManifestMiddleware<ExpoGoManifestRequestInfo> {\n public getParsedHeaders(req: ServerRequest): ExpoGoManifestRequestInfo {\n let platform = parsePlatformHeader(req);\n\n if (!platform) {\n debug(\n `No \"expo-platform\" header or \"platform\" query parameter specified. Falling back to \"none\".`\n );\n platform = 'none';\n }\n\n assertRuntimePlatform(platform);\n\n // Expo Updates clients explicitly accept \"multipart/mixed\" responses while browsers implicitly\n // accept them with \"accept: */*\". To make it easier to debug manifest responses by visiting their\n // URLs in a browser, we denote the response as \"text/plain\" if the user agent appears not to be\n // an Expo Updates client.\n const accept = accepts(req);\n const acceptedType = accept.types([\n 'unknown/unknown',\n 'multipart/mixed',\n 'application/json',\n 'application/expo+json',\n 'text/plain',\n ]);\n\n let responseContentType;\n switch (acceptedType) {\n case 'multipart/mixed':\n responseContentType = ResponseContentType.MULTIPART_MIXED;\n break;\n case 'application/json':\n responseContentType = ResponseContentType.APPLICATION_JSON;\n break;\n case 'application/expo+json':\n responseContentType = ResponseContentType.APPLICATION_EXPO_JSON;\n break;\n default:\n responseContentType = ResponseContentType.TEXT_PLAIN;\n break;\n }\n\n const expectSignature = req.headers['expo-expect-signature'];\n\n return {\n responseContentType,\n platform,\n expectSignature: expectSignature ? String(expectSignature) : null,\n hostname: stripPort(req.headers['host']),\n };\n }\n\n private getDefaultResponseHeaders(): ServerHeaders {\n const headers = new Map<string, number | string | readonly string[]>();\n // set required headers for Expo Updates manifest specification\n headers.set('expo-protocol-version', 0);\n headers.set('expo-sfv-version', 0);\n headers.set('cache-control', 'private, max-age=0');\n return headers;\n }\n\n public async _getManifestResponseAsync(requestOptions: ExpoGoManifestRequestInfo): Promise<{\n body: string;\n version: string;\n headers: ServerHeaders;\n }> {\n const { exp, hostUri, expoGoConfig, bundleUrl } = await this._resolveProjectSettingsAsync(\n requestOptions\n );\n\n const runtimeVersion = Updates.getRuntimeVersion(\n { ...exp, runtimeVersion: exp.runtimeVersion ?? { policy: 'sdkVersion' } },\n requestOptions.platform\n );\n if (!runtimeVersion) {\n throw new CommandError(\n 'MANIFEST_MIDDLEWARE',\n `Unable to determine runtime version for platform '${requestOptions.platform}'`\n );\n }\n\n const codeSigningInfo = await getCodeSigningInfoAsync(\n exp,\n requestOptions.expectSignature,\n this.options.privateKeyPath\n );\n\n const easProjectId = exp.extra?.eas?.projectId as string | undefined | null;\n const scopeKey = await ExpoGoManifestHandlerMiddleware.getScopeKeyAsync({\n slug: exp.slug,\n codeSigningInfo,\n });\n\n const expoUpdatesManifest: ExpoUpdatesManifest = {\n id: crypto.randomUUID(),\n createdAt: new Date().toISOString(),\n runtimeVersion,\n launchAsset: {\n key: 'bundle',\n contentType: 'application/javascript',\n url: bundleUrl,\n },\n assets: [], // assets are not used in development\n metadata: {}, // required for the client to detect that this is an expo-updates manifest\n extra: {\n eas: {\n projectId: easProjectId ?? undefined,\n },\n expoClient: {\n ...exp,\n hostUri,\n },\n expoGo: expoGoConfig,\n scopeKey,\n },\n };\n\n const stringifiedManifest = JSON.stringify(expoUpdatesManifest);\n\n let manifestPartHeaders: { 'expo-signature': string } | null = null;\n let certificateChainBody: string | null = null;\n if (codeSigningInfo) {\n const signature = signManifestString(stringifiedManifest, codeSigningInfo);\n manifestPartHeaders = {\n 'expo-signature': serializeDictionary(\n convertToDictionaryItemsRepresentation({\n keyid: codeSigningInfo.keyId,\n sig: signature,\n alg: 'rsa-v1_5-sha256',\n })\n ),\n };\n certificateChainBody = codeSigningInfo.certificateChainForResponse.join('\\n');\n }\n\n const headers = this.getDefaultResponseHeaders();\n\n switch (requestOptions.responseContentType) {\n case ResponseContentType.MULTIPART_MIXED: {\n const form = this.getFormData({\n stringifiedManifest,\n manifestPartHeaders,\n certificateChainBody,\n });\n headers.set('content-type', `multipart/mixed; boundary=${form.getBoundary()}`);\n return {\n body: form.getBuffer().toString(),\n version: runtimeVersion,\n headers,\n };\n }\n case ResponseContentType.APPLICATION_EXPO_JSON:\n case ResponseContentType.APPLICATION_JSON:\n case ResponseContentType.TEXT_PLAIN: {\n headers.set(\n 'content-type',\n ExpoGoManifestHandlerMiddleware.getContentTypeForResponseContentType(\n requestOptions.responseContentType\n )\n );\n if (manifestPartHeaders) {\n Object.entries(manifestPartHeaders).forEach(([key, value]) => {\n headers.set(key, value);\n });\n }\n\n return {\n body: stringifiedManifest,\n version: runtimeVersion,\n headers,\n };\n }\n }\n }\n\n private static getContentTypeForResponseContentType(\n responseContentType: ResponseContentType\n ): string {\n switch (responseContentType) {\n case ResponseContentType.MULTIPART_MIXED:\n return 'multipart/mixed';\n case ResponseContentType.APPLICATION_EXPO_JSON:\n return 'application/expo+json';\n case ResponseContentType.APPLICATION_JSON:\n return 'application/json';\n case ResponseContentType.TEXT_PLAIN:\n return 'text/plain';\n }\n }\n\n private getFormData({\n stringifiedManifest,\n manifestPartHeaders,\n certificateChainBody,\n }: {\n stringifiedManifest: string;\n manifestPartHeaders: { 'expo-signature': string } | null;\n certificateChainBody: string | null;\n }): FormData {\n const form = new FormData();\n form.append('manifest', stringifiedManifest, {\n contentType: 'application/json',\n header: {\n ...manifestPartHeaders,\n },\n });\n if (certificateChainBody && certificateChainBody.length > 0) {\n form.append('certificate_chain', certificateChainBody, {\n contentType: 'application/x-pem-file',\n });\n }\n return form;\n }\n\n protected trackManifest(version?: string) {\n logEventAsync('Serve Expo Updates Manifest', {\n runtimeVersion: version,\n });\n }\n\n private static async getScopeKeyAsync({\n slug,\n codeSigningInfo,\n }: {\n slug: string;\n codeSigningInfo: CodeSigningInfo | null;\n }): Promise<string> {\n const scopeKeyFromCodeSigningInfo = codeSigningInfo?.scopeKey;\n if (scopeKeyFromCodeSigningInfo) {\n return scopeKeyFromCodeSigningInfo;\n }\n\n Log.warn(\n env.EXPO_OFFLINE\n ? 'Using anonymous scope key in manifest for offline mode.'\n : 'Using anonymous scope key in manifest.'\n );\n return await getAnonymousScopeKeyAsync(slug);\n }\n}\n\nasync function getAnonymousScopeKeyAsync(slug: string): Promise<string> {\n const userAnonymousIdentifier = await UserSettings.getAnonymousIdentifierAsync();\n return `@${ANONYMOUS_USERNAME}/${slug}-${userAnonymousIdentifier}`;\n}\n\nfunction convertToDictionaryItemsRepresentation(obj: { [key: string]: string }): Dictionary {\n return new Map(\n Object.entries(obj).map(([k, v]) => {\n return [k, [v, new Map()]];\n })\n );\n}\n"],"names":["Log","debug","require","ResponseContentType","TEXT_PLAIN","APPLICATION_JSON","APPLICATION_EXPO_JSON","MULTIPART_MIXED","ExpoGoManifestHandlerMiddleware","ManifestMiddleware","getParsedHeaders","req","platform","parsePlatformHeader","assertRuntimePlatform","accept","accepts","acceptedType","types","responseContentType","expectSignature","headers","String","hostname","stripPort","getDefaultResponseHeaders","Map","set","_getManifestResponseAsync","requestOptions","exp","hostUri","expoGoConfig","bundleUrl","_resolveProjectSettingsAsync","runtimeVersion","Updates","getRuntimeVersion","policy","CommandError","codeSigningInfo","getCodeSigningInfoAsync","options","privateKeyPath","easProjectId","extra","eas","projectId","scopeKey","getScopeKeyAsync","slug","expoUpdatesManifest","id","crypto","randomUUID","createdAt","Date","toISOString","launchAsset","key","contentType","url","assets","metadata","undefined","expoClient","expoGo","stringifiedManifest","JSON","stringify","manifestPartHeaders","certificateChainBody","signature","signManifestString","serializeDictionary","convertToDictionaryItemsRepresentation","keyid","keyId","sig","alg","certificateChainForResponse","join","form","getFormData","getBoundary","body","getBuffer","toString","version","getContentTypeForResponseContentType","Object","entries","forEach","value","FormData","append","header","length","trackManifest","logEventAsync","scopeKeyFromCodeSigningInfo","warn","env","EXPO_OFFLINE","getAnonymousScopeKeyAsync","userAnonymousIdentifier","UserSettings","getAnonymousIdentifierAsync","ANONYMOUS_USERNAME","obj","map","k","v"],"mappings":"AAAA;;;;;AACwB,IAAA,cAAsB,WAAtB,sBAAsB,CAAA;AAC1B,IAAA,QAAS,kCAAT,SAAS,EAAA;AACV,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACN,IAAA,SAAW,kCAAX,WAAW,EAAA;AACgB,IAAA,kBAAoB,WAApB,oBAAoB,CAAA;AAE3C,IAAA,aAAgC,kCAAhC,gCAAgC,EAAA;AACtB,IAAA,KAAwB,WAAxB,wBAAwB,CAAA;AAC/CA,IAAAA,GAAG,mCAAM,cAAc,EAAp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C,CAAC,CAAC;CACpE;AAED,SAAS9B,sCAAsC,CAACkC,GAA8B,EAAc;IAC1F,OAAO,IAAInF,GAAG,CACZgE,MAAM,CAACC,OAAO,CAACkB,GAAG,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,CAAC,EAAEC,CAAC,CAAC,GAAK;QAClC,OAAO;YAACD,CAAC;YAAE;gBAACC,CAAC;gBAAE,IAAItF,GAAG,EAAE;aAAC;SAAC,CAAC;KAC5B,CAAC,CACH,CAAC;CACH"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/middleware/ExpoGoManifestHandlerMiddleware.ts"],"sourcesContent":["import { ExpoUpdatesManifest } from '@expo/config';\nimport { Updates } from '@expo/config-plugins';\nimport accepts from 'accepts';\nimport crypto from 'crypto';\nimport FormData from 'form-data';\nimport { serializeDictionary, Dictionary } from 'structured-headers';\n\nimport UserSettings from '../../../api/user/UserSettings';\nimport { ANONYMOUS_USERNAME } from '../../../api/user/user';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport {\n CodeSigningInfo,\n getCodeSigningInfoAsync,\n signManifestString,\n} from '../../../utils/codesigning';\nimport { CommandError } from '../../../utils/errors';\nimport { stripPort } from '../../../utils/url';\nimport { ManifestMiddleware, ManifestRequestInfo } from './ManifestMiddleware';\nimport { assertRuntimePlatform, parsePlatformHeader } from './resolvePlatform';\nimport { ServerHeaders, ServerRequest } from './server.types';\n\nconst debug = require('debug')('expo:start:server:middleware:ExpoGoManifestHandlerMiddleware');\n\nexport enum ResponseContentType {\n TEXT_PLAIN,\n APPLICATION_JSON,\n APPLICATION_EXPO_JSON,\n MULTIPART_MIXED,\n}\n\ninterface ExpoGoManifestRequestInfo extends ManifestRequestInfo {\n responseContentType: ResponseContentType;\n expectSignature: string | null;\n}\n\nexport class ExpoGoManifestHandlerMiddleware extends ManifestMiddleware<ExpoGoManifestRequestInfo> {\n public getParsedHeaders(req: ServerRequest): ExpoGoManifestRequestInfo {\n let platform = parsePlatformHeader(req);\n\n if (!platform) {\n debug(\n `No \"expo-platform\" header or \"platform\" query parameter specified. Falling back to \"ios\".`\n );\n platform = 'ios';\n }\n\n assertRuntimePlatform(platform);\n\n // Expo Updates clients explicitly accept \"multipart/mixed\" responses while browsers implicitly\n // accept them with \"accept: */*\". To make it easier to debug manifest responses by visiting their\n // URLs in a browser, we denote the response as \"text/plain\" if the user agent appears not to be\n // an Expo Updates client.\n const accept = accepts(req);\n const acceptedType = accept.types([\n 'unknown/unknown',\n 'multipart/mixed',\n 'application/json',\n 'application/expo+json',\n 'text/plain',\n ]);\n\n let responseContentType;\n switch (acceptedType) {\n case 'multipart/mixed':\n responseContentType = ResponseContentType.MULTIPART_MIXED;\n break;\n case 'application/json':\n responseContentType = ResponseContentType.APPLICATION_JSON;\n break;\n case 'application/expo+json':\n responseContentType = ResponseContentType.APPLICATION_EXPO_JSON;\n break;\n default:\n responseContentType = ResponseContentType.TEXT_PLAIN;\n break;\n }\n\n const expectSignature = req.headers['expo-expect-signature'];\n\n return {\n responseContentType,\n platform,\n expectSignature: expectSignature ? String(expectSignature) : null,\n hostname: stripPort(req.headers['host']),\n };\n }\n\n private getDefaultResponseHeaders(): ServerHeaders {\n const headers = new Map<string, number | string | readonly string[]>();\n // set required headers for Expo Updates manifest specification\n headers.set('expo-protocol-version', 0);\n headers.set('expo-sfv-version', 0);\n headers.set('cache-control', 'private, max-age=0');\n return headers;\n }\n\n public async _getManifestResponseAsync(requestOptions: ExpoGoManifestRequestInfo): Promise<{\n body: string;\n version: string;\n headers: ServerHeaders;\n }> {\n const { exp, hostUri, expoGoConfig, bundleUrl } = await this._resolveProjectSettingsAsync(\n requestOptions\n );\n\n const runtimeVersion = Updates.getRuntimeVersion(\n { ...exp, runtimeVersion: exp.runtimeVersion ?? { policy: 'sdkVersion' } },\n requestOptions.platform\n );\n if (!runtimeVersion) {\n throw new CommandError(\n 'MANIFEST_MIDDLEWARE',\n `Unable to determine runtime version for platform '${requestOptions.platform}'`\n );\n }\n\n const codeSigningInfo = await getCodeSigningInfoAsync(\n exp,\n requestOptions.expectSignature,\n this.options.privateKeyPath\n );\n\n const easProjectId = exp.extra?.eas?.projectId as string | undefined | null;\n const scopeKey = await ExpoGoManifestHandlerMiddleware.getScopeKeyAsync({\n slug: exp.slug,\n codeSigningInfo,\n });\n\n const expoUpdatesManifest: ExpoUpdatesManifest = {\n id: crypto.randomUUID(),\n createdAt: new Date().toISOString(),\n runtimeVersion,\n launchAsset: {\n key: 'bundle',\n contentType: 'application/javascript',\n url: bundleUrl,\n },\n assets: [], // assets are not used in development\n metadata: {}, // required for the client to detect that this is an expo-updates manifest\n extra: {\n eas: {\n projectId: easProjectId ?? undefined,\n },\n expoClient: {\n ...exp,\n hostUri,\n },\n expoGo: expoGoConfig,\n scopeKey,\n },\n };\n\n const stringifiedManifest = JSON.stringify(expoUpdatesManifest);\n\n let manifestPartHeaders: { 'expo-signature': string } | null = null;\n let certificateChainBody: string | null = null;\n if (codeSigningInfo) {\n const signature = signManifestString(stringifiedManifest, codeSigningInfo);\n manifestPartHeaders = {\n 'expo-signature': serializeDictionary(\n convertToDictionaryItemsRepresentation({\n keyid: codeSigningInfo.keyId,\n sig: signature,\n alg: 'rsa-v1_5-sha256',\n })\n ),\n };\n certificateChainBody = codeSigningInfo.certificateChainForResponse.join('\\n');\n }\n\n const headers = this.getDefaultResponseHeaders();\n\n switch (requestOptions.responseContentType) {\n case ResponseContentType.MULTIPART_MIXED: {\n const form = this.getFormData({\n stringifiedManifest,\n manifestPartHeaders,\n certificateChainBody,\n });\n headers.set('content-type', `multipart/mixed; boundary=${form.getBoundary()}`);\n return {\n body: form.getBuffer().toString(),\n version: runtimeVersion,\n headers,\n };\n }\n case ResponseContentType.APPLICATION_EXPO_JSON:\n case ResponseContentType.APPLICATION_JSON:\n case ResponseContentType.TEXT_PLAIN: {\n headers.set(\n 'content-type',\n ExpoGoManifestHandlerMiddleware.getContentTypeForResponseContentType(\n requestOptions.responseContentType\n )\n );\n if (manifestPartHeaders) {\n Object.entries(manifestPartHeaders).forEach(([key, value]) => {\n headers.set(key, value);\n });\n }\n\n return {\n body: stringifiedManifest,\n version: runtimeVersion,\n headers,\n };\n }\n }\n }\n\n private static getContentTypeForResponseContentType(\n responseContentType: ResponseContentType\n ): string {\n switch (responseContentType) {\n case ResponseContentType.MULTIPART_MIXED:\n return 'multipart/mixed';\n case ResponseContentType.APPLICATION_EXPO_JSON:\n return 'application/expo+json';\n case ResponseContentType.APPLICATION_JSON:\n return 'application/json';\n case ResponseContentType.TEXT_PLAIN:\n return 'text/plain';\n }\n }\n\n private getFormData({\n stringifiedManifest,\n manifestPartHeaders,\n certificateChainBody,\n }: {\n stringifiedManifest: string;\n manifestPartHeaders: { 'expo-signature': string } | null;\n certificateChainBody: string | null;\n }): FormData {\n const form = new FormData();\n form.append('manifest', stringifiedManifest, {\n contentType: 'application/json',\n header: {\n ...manifestPartHeaders,\n },\n });\n if (certificateChainBody && certificateChainBody.length > 0) {\n form.append('certificate_chain', certificateChainBody, {\n contentType: 'application/x-pem-file',\n });\n }\n return form;\n }\n\n protected trackManifest(version?: string) {\n logEventAsync('Serve Expo Updates Manifest', {\n runtimeVersion: version,\n });\n }\n\n private static async getScopeKeyAsync({\n slug,\n codeSigningInfo,\n }: {\n slug: string;\n codeSigningInfo: CodeSigningInfo | null;\n }): Promise<string> {\n const scopeKeyFromCodeSigningInfo = codeSigningInfo?.scopeKey;\n if (scopeKeyFromCodeSigningInfo) {\n return scopeKeyFromCodeSigningInfo;\n }\n\n // Log.warn(\n // env.EXPO_OFFLINE\n // ? 'Using anonymous scope key in manifest for offline mode.'\n // : 'Using anonymous scope key in manifest.'\n // );\n return await getAnonymousScopeKeyAsync(slug);\n }\n}\n\nasync function getAnonymousScopeKeyAsync(slug: string): Promise<string> {\n const userAnonymousIdentifier = await UserSettings.getAnonymousIdentifierAsync();\n return `@${ANONYMOUS_USERNAME}/${slug}-${userAnonymousIdentifier}`;\n}\n\nfunction convertToDictionaryItemsRepresentation(obj: { [key: string]: string }): Dictionary {\n return new Map(\n Object.entries(obj).map(([k, v]) => {\n return [k, [v, new Map()]];\n })\n );\n}\n"],"names":["debug","require","ResponseContentType","TEXT_PLAIN","APPLICATION_JSON","APPLICATION_EXPO_JSON","MULTIPART_MIXED","ExpoGoManifestHandlerMiddleware","ManifestMiddleware","getParsedHeaders","req","platform","parsePlatformHeader","assertRuntimePlatform","accept","accepts","acceptedType","types","responseContentType","expectSignature","headers","String","hostname","stripPort","getDefaultResponseHeaders","Map","set","_getManifestResponseAsync","requestOptions","exp","hostUri","expoGoConfig","bundleUrl","_resolveProjectSettingsAsync","runtimeVersion","Updates","getRuntimeVersion","policy","CommandError","codeSigningInfo","getCodeSigningInfoAsync","options","privateKeyPath","easProjectId","extra","eas","projectId","scopeKey","getScopeKeyAsync","slug","expoUpdatesManifest","id","crypto","randomUUID","createdAt","Date","toISOString","launchAsset","key","contentType","url","assets","metadata","undefined","expoClient","expoGo","stringifiedManifest","JSON","stringify","manifestPartHeaders","certificateChainBody","signature","signManifestString","serializeDictionary","convertToDictionaryItemsRepresentation","keyid","keyId","sig","alg","certificateChainForResponse","join","form","getFormData","getBoundary","body","getBuffer","toString","version","getContentTypeForResponseContentType","Object","entries","forEach","value","FormData","append","header","length","trackManifest","logEventAsync","scopeKeyFromCodeSigningInfo","getAnonymousScopeKeyAsync","userAnonymousIdentifier","UserSettings","getAnonymousIdentifierAsync","ANONYMOUS_USERNAME","obj","map","k","v"],"mappings":"AAAA;;;;;AACwB,IAAA,cAAsB,WAAtB,sBAAsB,CAAA;AAC1B,IAAA,QAAS,kCAAT,SAAS,EAAA;AACV,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACN,IAAA,SAAW,kCAAX,WAAW,EAAA;AACgB,IAAA,kBAAoB,WAApB,oBAAoB,CAAA;AAE3C,IAAA,aAAgC,kCAAhC,gCAAgC,EAAA;AACtB,IAAA,KAAwB,WAAxB,wBAAwB,CAAA;AAC7B,IAAA,kBAA4C,WAA5C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AAG,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,CAAC,EAAEC,CAAC,CAAC,GAAK;QAClC,OAAO;YAACD,CAAC;YAAE;gBAACC,CAAC;gBAAE,IAAInF,GAAG,EAAE;aAAC;SAAC,CAAC;KAC5B,CAAC,CACH,CAAC;CACH"}
|
|
@@ -38,9 +38,9 @@ function assertRuntimePlatform(platform) {
|
|
|
38
38
|
if (![
|
|
39
39
|
"android",
|
|
40
40
|
"ios",
|
|
41
|
-
"
|
|
41
|
+
"web"
|
|
42
42
|
].includes(stringifiedPlatform)) {
|
|
43
|
-
throw new _errors.CommandError("PLATFORM_HEADER", `platform must be "android", "ios", or "
|
|
43
|
+
throw new _errors.CommandError("PLATFORM_HEADER", `platform must be "android", "ios", or "web". Received: "${platform}"`);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/middleware/resolvePlatform.ts"],"sourcesContent":["import { parse } from 'url';\n\nimport { CommandError } from '../../../utils/errors';\nimport { ServerRequest } from './server.types';\n\nconst debug = require('debug')(\n 'expo:start:server:middleware:resolvePlatform'\n) as typeof console.log;\n\n/** Supported platforms */\nexport type RuntimePlatform = 'ios' | 'android';\n\n/**\n * Extract the runtime platform from the server request.\n * 1. Query param `platform`: `?platform=ios`\n * 2. Header `expo-platform`: `'expo-platform': ios`\n * 3. Legacy header `exponent-platform`: `'exponent-platform': ios`\n *\n * Returns first item in the case of an array.\n */\nexport function parsePlatformHeader(req: ServerRequest): string | null {\n const url = parse(req.url!, /* parseQueryString */ true);\n const platform =\n url.query?.platform || req.headers['expo-platform'] || req.headers['exponent-platform'];\n return (Array.isArray(platform) ? platform[0] : platform) ?? null;\n}\n\n/** Guess the platform from the user-agent header. */\nexport function resolvePlatformFromUserAgentHeader(req: ServerRequest): string | null {\n let platform = null;\n const userAgent = req.headers['user-agent'];\n if (userAgent?.match(/Android/i)) {\n platform = 'android';\n }\n if (userAgent?.match(/iPhone|iPad/i)) {\n platform = 'ios';\n }\n debug(`Resolved platform ${platform} from user-agent header: ${userAgent}`);\n return platform;\n}\n\n/** Assert if the runtime platform is not included. */\nexport function assertMissingRuntimePlatform(platform?: any): asserts platform {\n if (!platform) {\n throw new CommandError(\n 'PLATFORM_HEADER',\n `Must specify \"expo-platform\" header or \"platform\" query parameter`\n );\n }\n}\n\n/** Assert if the runtime platform is not correct. */\nexport function assertRuntimePlatform(platform: string): asserts platform is RuntimePlatform {\n const stringifiedPlatform = String(platform);\n if (!['android', 'ios', '
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/middleware/resolvePlatform.ts"],"sourcesContent":["import { parse } from 'url';\n\nimport { CommandError } from '../../../utils/errors';\nimport { ServerRequest } from './server.types';\n\nconst debug = require('debug')(\n 'expo:start:server:middleware:resolvePlatform'\n) as typeof console.log;\n\n/** Supported platforms */\nexport type RuntimePlatform = 'ios' | 'android';\n\n/**\n * Extract the runtime platform from the server request.\n * 1. Query param `platform`: `?platform=ios`\n * 2. Header `expo-platform`: `'expo-platform': ios`\n * 3. Legacy header `exponent-platform`: `'exponent-platform': ios`\n *\n * Returns first item in the case of an array.\n */\nexport function parsePlatformHeader(req: ServerRequest): string | null {\n const url = parse(req.url!, /* parseQueryString */ true);\n const platform =\n url.query?.platform || req.headers['expo-platform'] || req.headers['exponent-platform'];\n return (Array.isArray(platform) ? platform[0] : platform) ?? null;\n}\n\n/** Guess the platform from the user-agent header. */\nexport function resolvePlatformFromUserAgentHeader(req: ServerRequest): string | null {\n let platform = null;\n const userAgent = req.headers['user-agent'];\n if (userAgent?.match(/Android/i)) {\n platform = 'android';\n }\n if (userAgent?.match(/iPhone|iPad/i)) {\n platform = 'ios';\n }\n debug(`Resolved platform ${platform} from user-agent header: ${userAgent}`);\n return platform;\n}\n\n/** Assert if the runtime platform is not included. */\nexport function assertMissingRuntimePlatform(platform?: any): asserts platform {\n if (!platform) {\n throw new CommandError(\n 'PLATFORM_HEADER',\n `Must specify \"expo-platform\" header or \"platform\" query parameter`\n );\n }\n}\n\n/** Assert if the runtime platform is not correct. */\nexport function assertRuntimePlatform(platform: string): asserts platform is RuntimePlatform {\n const stringifiedPlatform = String(platform);\n if (!['android', 'ios', 'web'].includes(stringifiedPlatform)) {\n throw new CommandError(\n 'PLATFORM_HEADER',\n `platform must be \"android\", \"ios\", or \"web\". Received: \"${platform}\"`\n );\n }\n}\n"],"names":["parsePlatformHeader","resolvePlatformFromUserAgentHeader","assertMissingRuntimePlatform","assertRuntimePlatform","debug","require","req","url","parse","platform","query","headers","Array","isArray","userAgent","match","CommandError","stringifiedPlatform","String","includes"],"mappings":"AAAA;;;;QAoBgBA,mBAAmB,GAAnBA,mBAAmB;QAQnBC,kCAAkC,GAAlCA,kCAAkC;QAclCC,4BAA4B,GAA5BA,4BAA4B;QAU5BC,qBAAqB,GAArBA,qBAAqB;AApDf,IAAA,IAAK,WAAL,KAAK,CAAA;AAEE,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AAGpD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAC5B,8CAA8C,CAC/C,AAAsB,AAAC;AAajB,SAASL,mBAAmB,CAACM,GAAkB,EAAiB;QAGnEC,GAAS;IAFX,MAAMA,GAAG,GAAGC,CAAAA,GAAAA,IAAK,AAAuC,CAAA,MAAvC,CAACF,GAAG,CAACC,GAAG,EAAG,sBAAsB,CAAC,IAAI,CAAC,AAAC;IACzD,MAAME,QAAQ,GACZF,CAAAA,CAAAA,GAAS,GAATA,GAAG,CAACG,KAAK,SAAU,GAAnBH,KAAAA,CAAmB,GAAnBA,GAAS,CAAEE,QAAQ,CAAA,IAAIH,GAAG,CAACK,OAAO,CAAC,eAAe,CAAC,IAAIL,GAAG,CAACK,OAAO,CAAC,mBAAmB,CAAC,AAAC;QACnF,IAAkD;IAAzD,OAAO,CAAA,IAAkD,GAAjDC,KAAK,CAACC,OAAO,CAACJ,QAAQ,CAAC,GAAGA,QAAQ,CAAC,CAAC,CAAC,GAAGA,QAAQ,YAAjD,IAAkD,GAAI,IAAI,CAAC;CACnE;AAGM,SAASR,kCAAkC,CAACK,GAAkB,EAAiB;IACpF,IAAIG,QAAQ,GAAG,IAAI,AAAC;IACpB,MAAMK,SAAS,GAAGR,GAAG,CAACK,OAAO,CAAC,YAAY,CAAC,AAAC;IAC5C,IAAIG,SAAS,QAAO,GAAhBA,KAAAA,CAAgB,GAAhBA,SAAS,CAAEC,KAAK,YAAY,EAAE;QAChCN,QAAQ,GAAG,SAAS,CAAC;KACtB;IACD,IAAIK,SAAS,QAAO,GAAhBA,KAAAA,CAAgB,GAAhBA,SAAS,CAAEC,KAAK,gBAAgB,EAAE;QACpCN,QAAQ,GAAG,KAAK,CAAC;KAClB;IACDL,KAAK,CAAC,CAAC,kBAAkB,EAAEK,QAAQ,CAAC,yBAAyB,EAAEK,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5E,OAAOL,QAAQ,CAAC;CACjB;AAGM,SAASP,4BAA4B,CAACO,QAAc,EAAoB;IAC7E,IAAI,CAACA,QAAQ,EAAE;QACb,MAAM,IAAIO,OAAY,aAAA,CACpB,iBAAiB,EACjB,CAAC,iEAAiE,CAAC,CACpE,CAAC;KACH;CACF;AAGM,SAASb,qBAAqB,CAACM,QAAgB,EAAuC;IAC3F,MAAMQ,mBAAmB,GAAGC,MAAM,CAACT,QAAQ,CAAC,AAAC;IAC7C,IAAI,CAAC;QAAC,SAAS;QAAE,KAAK;QAAE,KAAK;KAAC,CAACU,QAAQ,CAACF,mBAAmB,CAAC,EAAE;QAC5D,MAAM,IAAID,OAAY,aAAA,CACpB,iBAAiB,EACjB,CAAC,wDAAwD,EAAEP,QAAQ,CAAC,CAAC,CAAC,CACvE,CAAC;KACH;CACF"}
|
|
@@ -94,7 +94,7 @@ async function logEventAsync(event, properties = {}) {
|
|
|
94
94
|
}
|
|
95
95
|
const { userId , deviceId } = identifyData;
|
|
96
96
|
const commonEventProperties = {
|
|
97
|
-
source_version: "0.10.
|
|
97
|
+
source_version: "0.10.3",
|
|
98
98
|
source: "expo"
|
|
99
99
|
};
|
|
100
100
|
const identity = {
|
|
@@ -135,7 +135,7 @@ function getContext() {
|
|
|
135
135
|
},
|
|
136
136
|
app: {
|
|
137
137
|
name: "expo",
|
|
138
|
-
version: "0.10.
|
|
138
|
+
version: "0.10.3"
|
|
139
139
|
},
|
|
140
140
|
ci: ciInfo.isCI ? {
|
|
141
141
|
name: ciInfo.name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"@expo/config": "~8.1.0",
|
|
43
43
|
"@expo/env": "~0.0.2",
|
|
44
44
|
"@expo/config-plugins": "~7.2.0",
|
|
45
|
-
"@expo/dev-server": "0.5.
|
|
45
|
+
"@expo/dev-server": "0.5.1",
|
|
46
46
|
"@expo/devcert": "^1.0.0",
|
|
47
47
|
"@expo/json-file": "^8.2.37",
|
|
48
48
|
"@expo/metro-config": "~0.10.0",
|
|
49
49
|
"@expo/osascript": "^2.0.31",
|
|
50
50
|
"@expo/package-manager": "~1.0.0",
|
|
51
51
|
"@expo/plist": "^0.0.20",
|
|
52
|
-
"@expo/prebuild-config": "6.2.
|
|
52
|
+
"@expo/prebuild-config": "6.2.4",
|
|
53
53
|
"@expo/rudder-sdk-node": "1.1.1",
|
|
54
54
|
"@expo/spawn-async": "1.5.0",
|
|
55
55
|
"@expo/xcpretty": "^4.2.1",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"require-from-string": "^2.0.2",
|
|
90
90
|
"requireg": "^0.2.2",
|
|
91
91
|
"resolve-from": "^5.0.0",
|
|
92
|
-
"semver": "^
|
|
92
|
+
"semver": "^7.5.3",
|
|
93
93
|
"send": "^0.18.0",
|
|
94
94
|
"slugify": "^1.3.4",
|
|
95
95
|
"structured-headers": "^0.4.1",
|
|
@@ -148,5 +148,5 @@
|
|
|
148
148
|
"taskr": "1.1.0",
|
|
149
149
|
"tree-kill": "^1.2.2"
|
|
150
150
|
},
|
|
151
|
-
"gitHead": "
|
|
151
|
+
"gitHead": "aa6bda733cef821234c77a19bbe6008b72c1c594"
|
|
152
152
|
}
|