@hot-updater/expo 1.1.4 → 1.2.0-rc.1

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/dist/index.cjs CHANGED
@@ -926,7 +926,7 @@ var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
926
926
  //#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
927
927
  var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
928
928
  const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
929
- const path$11 = require("path");
929
+ const path$10 = require("path");
930
930
  const COLON = isWindows ? ";" : ":";
931
931
  const isexe = require_isexe();
932
932
  const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -957,7 +957,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
957
957
  if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
958
958
  const ppRaw = pathEnv[i];
959
959
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
960
- const pCmd = path$11.join(pathPart, cmd);
960
+ const pCmd = path$10.join(pathPart, cmd);
961
961
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
962
962
  resolve(subStep(p, i, 0));
963
963
  });
@@ -981,7 +981,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
981
981
  for (let i = 0; i < pathEnv.length; i++) {
982
982
  const ppRaw = pathEnv[i];
983
983
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
984
- const pCmd = path$11.join(pathPart, cmd);
984
+ const pCmd = path$10.join(pathPart, cmd);
985
985
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
986
986
  for (let j = 0; j < pathExt.length; j++) {
987
987
  const cur = p + pathExt[j];
@@ -1014,7 +1014,7 @@ var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1014
1014
  //#endregion
1015
1015
  //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
1016
1016
  var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1017
- const path$10 = require("path");
1017
+ const path$9 = require("path");
1018
1018
  const which = require_which();
1019
1019
  const getPathKey = require_path_key();
1020
1020
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -1029,12 +1029,12 @@ var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) =>
1029
1029
  try {
1030
1030
  resolved = which.sync(parsed.command, {
1031
1031
  path: env[getPathKey({ env })],
1032
- pathExt: withoutPathExt ? path$10.delimiter : void 0
1032
+ pathExt: withoutPathExt ? path$9.delimiter : void 0
1033
1033
  });
1034
1034
  } catch (e) {} finally {
1035
1035
  if (shouldSwitchCwd) process.chdir(cwd);
1036
1036
  }
1037
- if (resolved) resolved = path$10.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
1037
+ if (resolved) resolved = path$9.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
1038
1038
  return resolved;
1039
1039
  }
1040
1040
  function resolveCommand(parsed) {
@@ -1101,7 +1101,7 @@ var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1101
1101
  //#endregion
1102
1102
  //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
1103
1103
  var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1104
- const path$9 = require("path");
1104
+ const path$8 = require("path");
1105
1105
  const resolveCommand = require_resolveCommand();
1106
1106
  const escape = require_escape();
1107
1107
  const readShebang = require_readShebang();
@@ -1124,7 +1124,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1124
1124
  const needsShell = !isExecutableRegExp.test(commandFile);
1125
1125
  if (parsed.options.forceShell || needsShell) {
1126
1126
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
1127
- parsed.command = path$9.normalize(parsed.command);
1127
+ parsed.command = path$8.normalize(parsed.command);
1128
1128
  parsed.command = escape.command(parsed.command);
1129
1129
  parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
1130
1130
  parsed.args = [
@@ -6263,13 +6263,14 @@ createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
6263
6263
  const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
6264
6264
  //#endregion
6265
6265
  //#region src/expoConfig.ts
6266
- const require$2 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
6266
+ const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
6267
6267
  const getConfig = async (...args) => {
6268
- return require$2(require$2.resolve("expo/config", { paths: [node_path.default.resolve(args[0])] })).getConfig(...args);
6268
+ return require$1(require$1.resolve("expo/config", { paths: [node_path.default.resolve(args[0])] })).getConfig(...args);
6269
6269
  };
6270
+ /** The project's own `expo/config-plugins`, which prebuild writes with. */
6271
+ const getConfigPlugins = (cwd) => require$1(require$1.resolve("expo/config-plugins", { paths: [node_path.default.resolve(cwd)] }));
6270
6272
  //#endregion
6271
6273
  //#region src/expoFingerprint.ts
6272
- const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
6273
6274
  /**
6274
6275
  * The engine settings an Expo app declares, for one platform: the JavaScript
6275
6276
  * engine and the architecture. A bare app records them in
@@ -6284,24 +6285,6 @@ const readExpoSettings = (exp, platform) => {
6284
6285
  return settings;
6285
6286
  };
6286
6287
  /**
6287
- * The command that lists the React Native packages a build links, chosen as
6288
- * Expo and @expo/fingerprint choose it: Expo's autolinking from
6289
- * expo-modules-autolinking 1.12 (SDK 52), else React Native CLI. The native
6290
- * templates also fall back to React Native CLI when
6291
- * `EXPO_USE_COMMUNITY_AUTOLINKING=1`, as Expo documents.
6292
- */
6293
- const reactNativeConfigCommand = (cwd, platform, env = process.env) => {
6294
- const autolinking = (0, _hot_updater_cli_tools.resolveExpoAutolinking)(cwd);
6295
- if (autolinking.linksReactNative && env["EXPO_USE_COMMUNITY_AUTOLINKING"] !== "1") return [
6296
- autolinking.bin,
6297
- "react-native-config",
6298
- "--platform",
6299
- platform,
6300
- "--json"
6301
- ];
6302
- return [node_path.default.join(node_path.default.dirname(require$1.resolve("react-native/package.json", { paths: [cwd] })), "cli.js"), "config"];
6303
- };
6304
- /**
6305
6288
  * The Expo adapter's native fingerprint: the bare and Rock adapters' engine,
6306
6289
  * fed the native packages Expo's autolinking links and the engine settings
6307
6290
  * the app config declares. Neither needs the generated ios/ and android/
@@ -6314,7 +6297,7 @@ const expoFingerprint = async (cwd, options) => {
6314
6297
  const nativeInterface = await (0, _hot_updater_cli_tools.readReactNativeInterface)({
6315
6298
  cwd,
6316
6299
  command: process.execPath,
6317
- args: reactNativeConfigCommand(cwd, options.platform),
6300
+ args: (0, _hot_updater_cli_tools.reactNativeConfigCommand)(cwd, options.platform),
6318
6301
  platform: options.platform,
6319
6302
  settings
6320
6303
  });
@@ -6381,12 +6364,29 @@ const runExpoPrebuild = async ({ platform }) => {
6381
6364
  };
6382
6365
  //#endregion
6383
6366
  //#region src/expo.ts
6367
+ const isHotUpdaterExpoPlugin = (name) => name === "@hot-updater/expo" || name === "@hot-updater/expo/app.plugin.js";
6384
6368
  const getHotUpdaterExpoPluginProps = (plugins) => {
6385
- const entry = plugins?.find((plugin) => Array.isArray(plugin) && (plugin[0] === "@hot-updater/expo" || plugin[0] === "@hot-updater/expo/app.plugin.js"));
6369
+ const entry = plugins?.find((plugin) => Array.isArray(plugin) && isHotUpdaterExpoPlugin(plugin[0]));
6386
6370
  if (!entry || !Array.isArray(entry)) return void 0;
6387
6371
  const props = entry[1];
6388
6372
  return typeof props === "object" && props !== null ? props : void 0;
6389
6373
  };
6374
+ /**
6375
+ * What `expo prebuild` would write into a platform's native project, from
6376
+ * the Expo config and with the project's own config plugins, without
6377
+ * writing it: the version Expo's version plugin writes, and the channel the
6378
+ * `@hot-updater/expo` config plugin writes when the config lists it.
6379
+ */
6380
+ const getExpoNativeProjectValues = async (cwd, platform) => {
6381
+ const { exp } = await getConfig(cwd, { skipSDKVersionRequirement: true });
6382
+ const { AndroidConfig, IOSConfig } = getConfigPlugins(cwd);
6383
+ const appVersion = platform === "ios" ? IOSConfig.Version.getVersion(exp) : AndroidConfig.Version.getVersionName(exp);
6384
+ const listsPlugin = (exp.plugins ?? []).some((plugin) => isHotUpdaterExpoPlugin(Array.isArray(plugin) ? plugin[0] : plugin));
6385
+ return {
6386
+ ...appVersion ? { appVersion } : {},
6387
+ ...listsPlugin ? { channel: getHotUpdaterExpoPluginProps(exp.plugins)?.channel || "production" } : {}
6388
+ };
6389
+ };
6390
6390
  const getExpoFingerprintExtraSources = async (cwd) => {
6391
6391
  const { exp } = await getConfig(cwd, { skipSDKVersionRequirement: true });
6392
6392
  const publicKeyPath = getHotUpdaterExpoPluginProps(exp.plugins)?.publicKeyPath;
@@ -6465,6 +6465,7 @@ const expo = (config = {
6465
6465
  fingerprint: (options) => expoFingerprint(cwd, options),
6466
6466
  getBundleSigningPublicKey: () => getExpoBundleSigningPublicKey(cwd),
6467
6467
  getFingerprintExtraSources: async () => getExpoFingerprintExtraSources(cwd),
6468
+ getNativeProjectValues: ({ platform }) => getExpoNativeProjectValues(cwd, platform),
6468
6469
  prebuild: async ({ platform }) => {
6469
6470
  await runExpoPrebuild({ platform });
6470
6471
  }
@@ -6497,3 +6498,4 @@ exports.expo = expo;
6497
6498
  exports.expoFingerprint = expoFingerprint;
6498
6499
  exports.getExpoBundleSigningPublicKey = getExpoBundleSigningPublicKey;
6499
6500
  exports.getExpoFingerprintExtraSources = getExpoFingerprintExtraSources;
6501
+ exports.getExpoNativeProjectValues = getExpoNativeProjectValues;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,15 @@
1
- import { BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, NativeFingerprintOptions } from "@hot-updater/plugin-core";
1
+ import { BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, NativeFingerprintOptions, Platform } from "@hot-updater/plugin-core";
2
2
  //#region src/expo.d.ts
3
+ /**
4
+ * What `expo prebuild` would write into a platform's native project, from
5
+ * the Expo config and with the project's own config plugins, without
6
+ * writing it: the version Expo's version plugin writes, and the channel the
7
+ * `@hot-updater/expo` config plugin writes when the config lists it.
8
+ */
9
+ declare const getExpoNativeProjectValues: (cwd: string, platform: Platform) => Promise<{
10
+ appVersion?: string;
11
+ channel?: string;
12
+ }>;
3
13
  declare const getExpoFingerprintExtraSources: (cwd: string) => Promise<string[]>;
4
14
  declare const getExpoBundleSigningPublicKey: (cwd: string) => Promise<{
5
15
  readonly publicKey: string;
@@ -28,4 +38,4 @@ declare const expo: (config?: ExpoAdapterConfig) => ({ cwd }: BuildAdapterArgs)
28
38
  */
29
39
  declare const expoFingerprint: (cwd: string, options: NativeFingerprintOptions) => Promise<import("@hot-updater/plugin-core").NativeFingerprint>;
30
40
  //#endregion
31
- export { ExpoAdapterConfig, expo, expoFingerprint, getExpoBundleSigningPublicKey, getExpoFingerprintExtraSources };
41
+ export { ExpoAdapterConfig, expo, expoFingerprint, getExpoBundleSigningPublicKey, getExpoFingerprintExtraSources, getExpoNativeProjectValues };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,15 @@
1
- import { BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, NativeFingerprintOptions } from "@hot-updater/plugin-core";
1
+ import { BuildAdapter, BuildAdapterArgs, BuildAdapterConfig, NativeFingerprintOptions, Platform } from "@hot-updater/plugin-core";
2
2
  //#region src/expo.d.ts
3
+ /**
4
+ * What `expo prebuild` would write into a platform's native project, from
5
+ * the Expo config and with the project's own config plugins, without
6
+ * writing it: the version Expo's version plugin writes, and the channel the
7
+ * `@hot-updater/expo` config plugin writes when the config lists it.
8
+ */
9
+ declare const getExpoNativeProjectValues: (cwd: string, platform: Platform) => Promise<{
10
+ appVersion?: string;
11
+ channel?: string;
12
+ }>;
3
13
  declare const getExpoFingerprintExtraSources: (cwd: string) => Promise<string[]>;
4
14
  declare const getExpoBundleSigningPublicKey: (cwd: string) => Promise<{
5
15
  readonly publicKey: string;
@@ -28,4 +38,4 @@ declare const expo: (config?: ExpoAdapterConfig) => ({ cwd }: BuildAdapterArgs)
28
38
  */
29
39
  declare const expoFingerprint: (cwd: string, options: NativeFingerprintOptions) => Promise<import("@hot-updater/plugin-core").NativeFingerprint>;
30
40
  //#endregion
31
- export { ExpoAdapterConfig, expo, expoFingerprint, getExpoBundleSigningPublicKey, getExpoFingerprintExtraSources };
41
+ export { ExpoAdapterConfig, expo, expoFingerprint, getExpoBundleSigningPublicKey, getExpoFingerprintExtraSources, getExpoNativeProjectValues };
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import fs from "fs";
4
4
  import * as path$2 from "path";
5
5
  import path from "path";
6
6
  import { compileHermes } from "@hot-updater/bare";
7
- import { createInterfaceFingerprint, log, p, readBundleSigningPublicKeyFile, readReactNativeInterface, resolveExpoAutolinking } from "@hot-updater/cli-tools";
7
+ import { createInterfaceFingerprint, log, p, reactNativeConfigCommand, readBundleSigningPublicKeyFile, readReactNativeInterface } from "@hot-updater/cli-tools";
8
8
  import { fileURLToPath } from "node:url";
9
9
  import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
10
10
  import { StringDecoder } from "node:string_decoder";
@@ -6259,13 +6259,14 @@ createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
6259
6259
  const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
6260
6260
  //#endregion
6261
6261
  //#region src/expoConfig.ts
6262
- const require$2 = createRequire(import.meta.url);
6262
+ const require$1 = createRequire(import.meta.url);
6263
6263
  const getConfig = async (...args) => {
6264
- return require$2(require$2.resolve("expo/config", { paths: [path$1.resolve(args[0])] })).getConfig(...args);
6264
+ return require$1(require$1.resolve("expo/config", { paths: [path$1.resolve(args[0])] })).getConfig(...args);
6265
6265
  };
6266
+ /** The project's own `expo/config-plugins`, which prebuild writes with. */
6267
+ const getConfigPlugins = (cwd) => require$1(require$1.resolve("expo/config-plugins", { paths: [path$1.resolve(cwd)] }));
6266
6268
  //#endregion
6267
6269
  //#region src/expoFingerprint.ts
6268
- const require$1 = createRequire(import.meta.url);
6269
6270
  /**
6270
6271
  * The engine settings an Expo app declares, for one platform: the JavaScript
6271
6272
  * engine and the architecture. A bare app records them in
@@ -6280,24 +6281,6 @@ const readExpoSettings = (exp, platform) => {
6280
6281
  return settings;
6281
6282
  };
6282
6283
  /**
6283
- * The command that lists the React Native packages a build links, chosen as
6284
- * Expo and @expo/fingerprint choose it: Expo's autolinking from
6285
- * expo-modules-autolinking 1.12 (SDK 52), else React Native CLI. The native
6286
- * templates also fall back to React Native CLI when
6287
- * `EXPO_USE_COMMUNITY_AUTOLINKING=1`, as Expo documents.
6288
- */
6289
- const reactNativeConfigCommand = (cwd, platform, env = process.env) => {
6290
- const autolinking = resolveExpoAutolinking(cwd);
6291
- if (autolinking.linksReactNative && env["EXPO_USE_COMMUNITY_AUTOLINKING"] !== "1") return [
6292
- autolinking.bin,
6293
- "react-native-config",
6294
- "--platform",
6295
- platform,
6296
- "--json"
6297
- ];
6298
- return [path$1.join(path$1.dirname(require$1.resolve("react-native/package.json", { paths: [cwd] })), "cli.js"), "config"];
6299
- };
6300
- /**
6301
6284
  * The Expo adapter's native fingerprint: the bare and Rock adapters' engine,
6302
6285
  * fed the native packages Expo's autolinking links and the engine settings
6303
6286
  * the app config declares. Neither needs the generated ios/ and android/
@@ -6377,12 +6360,29 @@ const runExpoPrebuild = async ({ platform }) => {
6377
6360
  };
6378
6361
  //#endregion
6379
6362
  //#region src/expo.ts
6363
+ const isHotUpdaterExpoPlugin = (name) => name === "@hot-updater/expo" || name === "@hot-updater/expo/app.plugin.js";
6380
6364
  const getHotUpdaterExpoPluginProps = (plugins) => {
6381
- const entry = plugins?.find((plugin) => Array.isArray(plugin) && (plugin[0] === "@hot-updater/expo" || plugin[0] === "@hot-updater/expo/app.plugin.js"));
6365
+ const entry = plugins?.find((plugin) => Array.isArray(plugin) && isHotUpdaterExpoPlugin(plugin[0]));
6382
6366
  if (!entry || !Array.isArray(entry)) return void 0;
6383
6367
  const props = entry[1];
6384
6368
  return typeof props === "object" && props !== null ? props : void 0;
6385
6369
  };
6370
+ /**
6371
+ * What `expo prebuild` would write into a platform's native project, from
6372
+ * the Expo config and with the project's own config plugins, without
6373
+ * writing it: the version Expo's version plugin writes, and the channel the
6374
+ * `@hot-updater/expo` config plugin writes when the config lists it.
6375
+ */
6376
+ const getExpoNativeProjectValues = async (cwd, platform) => {
6377
+ const { exp } = await getConfig(cwd, { skipSDKVersionRequirement: true });
6378
+ const { AndroidConfig, IOSConfig } = getConfigPlugins(cwd);
6379
+ const appVersion = platform === "ios" ? IOSConfig.Version.getVersion(exp) : AndroidConfig.Version.getVersionName(exp);
6380
+ const listsPlugin = (exp.plugins ?? []).some((plugin) => isHotUpdaterExpoPlugin(Array.isArray(plugin) ? plugin[0] : plugin));
6381
+ return {
6382
+ ...appVersion ? { appVersion } : {},
6383
+ ...listsPlugin ? { channel: getHotUpdaterExpoPluginProps(exp.plugins)?.channel || "production" } : {}
6384
+ };
6385
+ };
6386
6386
  const getExpoFingerprintExtraSources = async (cwd) => {
6387
6387
  const { exp } = await getConfig(cwd, { skipSDKVersionRequirement: true });
6388
6388
  const publicKeyPath = getHotUpdaterExpoPluginProps(exp.plugins)?.publicKeyPath;
@@ -6461,6 +6461,7 @@ const expo = (config = {
6461
6461
  fingerprint: (options) => expoFingerprint(cwd, options),
6462
6462
  getBundleSigningPublicKey: () => getExpoBundleSigningPublicKey(cwd),
6463
6463
  getFingerprintExtraSources: async () => getExpoFingerprintExtraSources(cwd),
6464
+ getNativeProjectValues: ({ platform }) => getExpoNativeProjectValues(cwd, platform),
6464
6465
  prebuild: async ({ platform }) => {
6465
6466
  await runExpoPrebuild({ platform });
6466
6467
  }
@@ -6489,4 +6490,4 @@ const expo = (config = {
6489
6490
  };
6490
6491
  };
6491
6492
  //#endregion
6492
- export { expo, expoFingerprint, getExpoBundleSigningPublicKey, getExpoFingerprintExtraSources };
6493
+ export { expo, expoFingerprint, getExpoBundleSigningPublicKey, getExpoFingerprintExtraSources, getExpoNativeProjectValues };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/expo",
3
- "version": "1.1.4",
3
+ "version": "1.2.0-rc.1",
4
4
  "description": "Hot Updater build and config plugin for Expo",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -28,16 +28,16 @@
28
28
  "@babel/core": "7.26.0",
29
29
  "@babel/types": "7.26.0",
30
30
  "uuidv7": "^1.0.2",
31
- "@hot-updater/bare": "1.1.4",
32
- "@hot-updater/cli-tools": "1.1.4",
33
- "@hot-updater/plugin-core": "1.1.4"
31
+ "@hot-updater/bare": "1.2.0-rc.1",
32
+ "@hot-updater/cli-tools": "1.2.0-rc.1",
33
+ "@hot-updater/plugin-core": "1.2.0-rc.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^20",
37
37
  "expo": "^50.0.0",
38
38
  "execa": "9.5.2",
39
39
  "vitest": "4.1.4",
40
- "hot-updater": "1.1.4"
40
+ "hot-updater": "1.2.0-rc.1"
41
41
  },
42
42
  "exports": {
43
43
  ".": {