@hot-updater/expo 1.0.0-rc.5 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +28 -44
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +6 -24
- package/package.json +5 -5
- package/plugin/build/transformers.js +0 -30
- package/plugin/build/withHotUpdater.js +0 -11
package/dist/index.cjs
CHANGED
|
@@ -37,7 +37,8 @@ node_process = __toESM(node_process, 1);
|
|
|
37
37
|
let node_tty = require("node:tty");
|
|
38
38
|
node_tty = __toESM(node_tty, 1);
|
|
39
39
|
let node_path = require("node:path");
|
|
40
|
-
node_path = __toESM(node_path, 1);
|
|
40
|
+
let node_path$1 = __toESM(node_path, 1);
|
|
41
|
+
node_path = __toESM(node_path);
|
|
41
42
|
let node_timers_promises = require("node:timers/promises");
|
|
42
43
|
let node_os = require("node:os");
|
|
43
44
|
let node_events = require("node:events");
|
|
@@ -47,6 +48,7 @@ let node_stream_promises = require("node:stream/promises");
|
|
|
47
48
|
let node_stream = require("node:stream");
|
|
48
49
|
let node_buffer = require("node:buffer");
|
|
49
50
|
let uuidv7 = require("uuidv7");
|
|
51
|
+
let node_module = require("node:module");
|
|
50
52
|
//#region ../../node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js
|
|
51
53
|
function isPlainObject(value) {
|
|
52
54
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -924,7 +926,7 @@ var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
924
926
|
//#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
925
927
|
var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
926
928
|
const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
927
|
-
const path$
|
|
929
|
+
const path$10 = require("path");
|
|
928
930
|
const COLON = isWindows ? ";" : ":";
|
|
929
931
|
const isexe = require_isexe();
|
|
930
932
|
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -955,7 +957,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
955
957
|
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
956
958
|
const ppRaw = pathEnv[i];
|
|
957
959
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
958
|
-
const pCmd = path$
|
|
960
|
+
const pCmd = path$10.join(pathPart, cmd);
|
|
959
961
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
960
962
|
resolve(subStep(p, i, 0));
|
|
961
963
|
});
|
|
@@ -979,7 +981,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
979
981
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
980
982
|
const ppRaw = pathEnv[i];
|
|
981
983
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
982
|
-
const pCmd = path$
|
|
984
|
+
const pCmd = path$10.join(pathPart, cmd);
|
|
983
985
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
984
986
|
for (let j = 0; j < pathExt.length; j++) {
|
|
985
987
|
const cur = p + pathExt[j];
|
|
@@ -1012,7 +1014,7 @@ var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1012
1014
|
//#endregion
|
|
1013
1015
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
1014
1016
|
var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1015
|
-
const path$
|
|
1017
|
+
const path$9 = require("path");
|
|
1016
1018
|
const which = require_which();
|
|
1017
1019
|
const getPathKey = require_path_key();
|
|
1018
1020
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -1027,12 +1029,12 @@ var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
1027
1029
|
try {
|
|
1028
1030
|
resolved = which.sync(parsed.command, {
|
|
1029
1031
|
path: env[getPathKey({ env })],
|
|
1030
|
-
pathExt: withoutPathExt ? path$
|
|
1032
|
+
pathExt: withoutPathExt ? path$9.delimiter : void 0
|
|
1031
1033
|
});
|
|
1032
1034
|
} catch (e) {} finally {
|
|
1033
1035
|
if (shouldSwitchCwd) process.chdir(cwd);
|
|
1034
1036
|
}
|
|
1035
|
-
if (resolved) resolved = path$
|
|
1037
|
+
if (resolved) resolved = path$9.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
1036
1038
|
return resolved;
|
|
1037
1039
|
}
|
|
1038
1040
|
function resolveCommand(parsed) {
|
|
@@ -1099,7 +1101,7 @@ var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1099
1101
|
//#endregion
|
|
1100
1102
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
1101
1103
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1102
|
-
const path$
|
|
1104
|
+
const path$8 = require("path");
|
|
1103
1105
|
const resolveCommand = require_resolveCommand();
|
|
1104
1106
|
const escape = require_escape();
|
|
1105
1107
|
const readShebang = require_readShebang();
|
|
@@ -1122,7 +1124,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1122
1124
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
1123
1125
|
if (parsed.options.forceShell || needsShell) {
|
|
1124
1126
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
1125
|
-
parsed.command = path$
|
|
1127
|
+
parsed.command = path$8.normalize(parsed.command);
|
|
1126
1128
|
parsed.command = escape.command(parsed.command);
|
|
1127
1129
|
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
1128
1130
|
parsed.args = [
|
|
@@ -1231,33 +1233,33 @@ function toPath(urlOrPath) {
|
|
|
1231
1233
|
}
|
|
1232
1234
|
function traversePathUp(startPath) {
|
|
1233
1235
|
return { *[Symbol.iterator]() {
|
|
1234
|
-
let currentPath = node_path.default.resolve(toPath(startPath));
|
|
1236
|
+
let currentPath = node_path$1.default.resolve(toPath(startPath));
|
|
1235
1237
|
let previousPath;
|
|
1236
1238
|
while (previousPath !== currentPath) {
|
|
1237
1239
|
yield currentPath;
|
|
1238
1240
|
previousPath = currentPath;
|
|
1239
|
-
currentPath = node_path.default.resolve(currentPath, "..");
|
|
1241
|
+
currentPath = node_path$1.default.resolve(currentPath, "..");
|
|
1240
1242
|
}
|
|
1241
1243
|
} };
|
|
1242
1244
|
}
|
|
1243
1245
|
//#endregion
|
|
1244
1246
|
//#region ../../node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
|
|
1245
1247
|
const npmRunPath = ({ cwd = node_process.default.cwd(), path: pathOption = node_process.default.env[pathKey()], preferLocal = true, execPath = node_process.default.execPath, addExecPath = true } = {}) => {
|
|
1246
|
-
const cwdPath = node_path.default.resolve(toPath(cwd));
|
|
1248
|
+
const cwdPath = node_path$1.default.resolve(toPath(cwd));
|
|
1247
1249
|
const result = [];
|
|
1248
|
-
const pathParts = pathOption.split(node_path.default.delimiter);
|
|
1250
|
+
const pathParts = pathOption.split(node_path$1.default.delimiter);
|
|
1249
1251
|
if (preferLocal) applyPreferLocal(result, pathParts, cwdPath);
|
|
1250
1252
|
if (addExecPath) applyExecPath(result, pathParts, execPath, cwdPath);
|
|
1251
|
-
return pathOption === "" || pathOption === node_path.default.delimiter ? `${result.join(node_path.default.delimiter)}${pathOption}` : [...result, pathOption].join(node_path.default.delimiter);
|
|
1253
|
+
return pathOption === "" || pathOption === node_path$1.default.delimiter ? `${result.join(node_path$1.default.delimiter)}${pathOption}` : [...result, pathOption].join(node_path$1.default.delimiter);
|
|
1252
1254
|
};
|
|
1253
1255
|
const applyPreferLocal = (result, pathParts, cwdPath) => {
|
|
1254
1256
|
for (const directory of traversePathUp(cwdPath)) {
|
|
1255
|
-
const pathPart = node_path.default.join(directory, "node_modules/.bin");
|
|
1257
|
+
const pathPart = node_path$1.default.join(directory, "node_modules/.bin");
|
|
1256
1258
|
if (!pathParts.includes(pathPart)) result.push(pathPart);
|
|
1257
1259
|
}
|
|
1258
1260
|
};
|
|
1259
1261
|
const applyExecPath = (result, pathParts, execPath, cwdPath) => {
|
|
1260
|
-
const pathPart = node_path.default.resolve(cwdPath, toPath(execPath), "..");
|
|
1262
|
+
const pathPart = node_path$1.default.resolve(cwdPath, toPath(execPath), "..");
|
|
1261
1263
|
if (!pathParts.includes(pathPart)) result.push(pathPart);
|
|
1262
1264
|
};
|
|
1263
1265
|
const npmRunPathEnv = ({ env = node_process.default.env, ...options } = {}) => {
|
|
@@ -2269,7 +2271,7 @@ const mapNode = ({ options }) => {
|
|
|
2269
2271
|
const handleNodeOption = (file, commandArguments, { node: shouldHandleNode = false, nodePath = node_process.execPath, nodeOptions = node_process.execArgv.filter((nodeOption) => !nodeOption.startsWith("--inspect")), cwd, execPath: formerNodePath, ...options }) => {
|
|
2270
2272
|
if (formerNodePath !== void 0) throw new TypeError("The \"execPath\" option has been removed. Please use the \"nodePath\" option instead.");
|
|
2271
2273
|
const normalizedNodePath = safeNormalizeFileUrl(nodePath, "The \"nodePath\" option");
|
|
2272
|
-
const resolvedNodePath = node_path.default.resolve(cwd, normalizedNodePath);
|
|
2274
|
+
const resolvedNodePath = node_path$1.default.resolve(cwd, normalizedNodePath);
|
|
2273
2275
|
const newOptions = {
|
|
2274
2276
|
...options,
|
|
2275
2277
|
nodePath: resolvedNodePath,
|
|
@@ -2281,7 +2283,7 @@ const handleNodeOption = (file, commandArguments, { node: shouldHandleNode = fal
|
|
|
2281
2283
|
commandArguments,
|
|
2282
2284
|
newOptions
|
|
2283
2285
|
];
|
|
2284
|
-
if (node_path.default.basename(file, ".exe") === "node") throw new TypeError("When the \"node\" option is true, the first argument does not need to be \"node\".");
|
|
2286
|
+
if (node_path$1.default.basename(file, ".exe") === "node") throw new TypeError("When the \"node\" option is true, the first argument does not need to be \"node\".");
|
|
2285
2287
|
return [
|
|
2286
2288
|
resolvedNodePath,
|
|
2287
2289
|
[
|
|
@@ -2365,7 +2367,7 @@ const serializeEncoding = (encoding) => typeof encoding === "string" ? `"${encod
|
|
|
2365
2367
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/arguments/cwd.js
|
|
2366
2368
|
const normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
2367
2369
|
const cwdString = safeNormalizeFileUrl(cwd, "The \"cwd\" option");
|
|
2368
|
-
return node_path.default.resolve(cwdString);
|
|
2370
|
+
return node_path$1.default.resolve(cwdString);
|
|
2369
2371
|
};
|
|
2370
2372
|
const getDefaultCwd = () => {
|
|
2371
2373
|
try {
|
|
@@ -2404,7 +2406,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
2404
2406
|
options.killSignal = normalizeKillSignal(options.killSignal);
|
|
2405
2407
|
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
|
|
2406
2408
|
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
|
|
2407
|
-
if (node_process.default.platform === "win32" && node_path.default.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
|
|
2409
|
+
if (node_process.default.platform === "win32" && node_path$1.default.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
|
|
2408
2410
|
return {
|
|
2409
2411
|
file,
|
|
2410
2412
|
commandArguments,
|
|
@@ -6261,20 +6263,9 @@ createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
|
|
|
6261
6263
|
const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
|
|
6262
6264
|
//#endregion
|
|
6263
6265
|
//#region src/expoConfig.ts
|
|
6264
|
-
const
|
|
6265
|
-
const isMissingModule = (error, specifier) => error instanceof Error && "code" in error && error.code === "ERR_MODULE_NOT_FOUND" && error.message.includes(specifier);
|
|
6266
|
-
const loadExpoConfig = async () => {
|
|
6267
|
-
try {
|
|
6268
|
-
const module = await importExpoConfigModule("expo/config.js");
|
|
6269
|
-
return module.getConfig ? module : module.default;
|
|
6270
|
-
} catch (error) {
|
|
6271
|
-
if (!isMissingModule(error, "expo/config.js")) throw error;
|
|
6272
|
-
}
|
|
6273
|
-
const module = await importExpoConfigModule("expo/config/index.js");
|
|
6274
|
-
return module.getConfig ? module : module.default;
|
|
6275
|
-
};
|
|
6266
|
+
const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
6276
6267
|
const getConfig = async (...args) => {
|
|
6277
|
-
return (
|
|
6268
|
+
return require$1(require$1.resolve("expo/config", { paths: [node_path.default.resolve(args[0])] })).getConfig(...args);
|
|
6278
6269
|
};
|
|
6279
6270
|
//#endregion
|
|
6280
6271
|
//#region src/resolveMain.ts
|
|
@@ -6357,23 +6348,16 @@ const getExpoBundleSigningPublicKey = async (cwd) => {
|
|
|
6357
6348
|
if (typeof publicKeyPath !== "string" || !publicKeyPath.trim()) throw new Error("@hot-updater/expo publicKeyPath must be a non-empty path.");
|
|
6358
6349
|
return { publicKey: await (0, _hot_updater_cli_tools.readBundleSigningPublicKeyFile)(publicKeyPath, { cwd }) };
|
|
6359
6350
|
};
|
|
6360
|
-
const isHermesEnabled = (cwd, platform) => {
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
const { expo } = JSON.parse(fs.default.readFileSync(appJsonPath, "utf-8"));
|
|
6364
|
-
const platformJsEngine = expo?.[platform]?.jsEngine;
|
|
6365
|
-
const commonJsEngine = expo?.jsEngine;
|
|
6366
|
-
if (platformJsEngine !== void 0) return platformJsEngine === "hermes";
|
|
6367
|
-
if (commonJsEngine !== void 0) return commonJsEngine === "hermes";
|
|
6368
|
-
} catch {}
|
|
6369
|
-
return true;
|
|
6351
|
+
const isHermesEnabled = async (cwd, platform) => {
|
|
6352
|
+
const { exp } = await getConfig(cwd, { skipSDKVersionRequirement: true });
|
|
6353
|
+
return (exp[platform]?.jsEngine ?? exp.jsEngine ?? "hermes") === "hermes";
|
|
6370
6354
|
};
|
|
6371
6355
|
const runBundle = async ({ cwd, platform, buildPath, sourcemap, resetCache }) => {
|
|
6372
6356
|
const filename = `index.${platform}`;
|
|
6373
6357
|
const bundleOutput = path.default.join(buildPath, `${filename}.bundle`);
|
|
6374
6358
|
const entryFile = resolveMain(cwd);
|
|
6375
6359
|
const bundleId = (0, uuidv7.uuidv7)();
|
|
6376
|
-
const enableHermes = isHermesEnabled(cwd, platform);
|
|
6360
|
+
const enableHermes = await isHermesEnabled(cwd, platform);
|
|
6377
6361
|
const args = [
|
|
6378
6362
|
"expo",
|
|
6379
6363
|
"export:embed",
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuildAdapter, BuildAdapterArgs, BuildAdapterConfig } from "@hot-updater/plugin-core";
|
|
2
2
|
//#region src/expo.d.ts
|
|
3
3
|
declare const getExpoFingerprintExtraSources: (cwd: string) => Promise<string[]>;
|
|
4
4
|
declare const getExpoBundleSigningPublicKey: (cwd: string) => Promise<{
|
|
5
5
|
readonly publicKey: string;
|
|
6
6
|
} | null>;
|
|
7
|
-
interface
|
|
7
|
+
interface ExpoAdapterConfig extends BuildAdapterConfig {
|
|
8
8
|
/**
|
|
9
9
|
* @default false
|
|
10
10
|
* Whether to generate sourcemap for the bundle.
|
|
@@ -16,6 +16,6 @@ interface ExpoPluginConfig extends BuildPluginConfig {
|
|
|
16
16
|
*/
|
|
17
17
|
resetCache?: boolean;
|
|
18
18
|
}
|
|
19
|
-
declare const expo: (config?:
|
|
19
|
+
declare const expo: (config?: ExpoAdapterConfig) => ({ cwd }: BuildAdapterArgs) => BuildAdapter;
|
|
20
20
|
//#endregion
|
|
21
|
-
export {
|
|
21
|
+
export { ExpoAdapterConfig, expo, getExpoBundleSigningPublicKey, getExpoFingerprintExtraSources };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuildAdapter, BuildAdapterArgs, BuildAdapterConfig } from "@hot-updater/plugin-core";
|
|
2
2
|
//#region src/expo.d.ts
|
|
3
3
|
declare const getExpoFingerprintExtraSources: (cwd: string) => Promise<string[]>;
|
|
4
4
|
declare const getExpoBundleSigningPublicKey: (cwd: string) => Promise<{
|
|
5
5
|
readonly publicKey: string;
|
|
6
6
|
} | null>;
|
|
7
|
-
interface
|
|
7
|
+
interface ExpoAdapterConfig extends BuildAdapterConfig {
|
|
8
8
|
/**
|
|
9
9
|
* @default false
|
|
10
10
|
* Whether to generate sourcemap for the bundle.
|
|
@@ -16,6 +16,6 @@ interface ExpoPluginConfig extends BuildPluginConfig {
|
|
|
16
16
|
*/
|
|
17
17
|
resetCache?: boolean;
|
|
18
18
|
}
|
|
19
|
-
declare const expo: (config?:
|
|
19
|
+
declare const expo: (config?: ExpoAdapterConfig) => ({ cwd }: BuildAdapterArgs) => BuildAdapter;
|
|
20
20
|
//#endregion
|
|
21
|
-
export {
|
|
21
|
+
export { ExpoAdapterConfig, expo, getExpoBundleSigningPublicKey, getExpoFingerprintExtraSources };
|
package/dist/index.mjs
CHANGED
|
@@ -6259,20 +6259,9 @@ createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
|
|
|
6259
6259
|
const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
|
|
6260
6260
|
//#endregion
|
|
6261
6261
|
//#region src/expoConfig.ts
|
|
6262
|
-
const
|
|
6263
|
-
const isMissingModule = (error, specifier) => error instanceof Error && "code" in error && error.code === "ERR_MODULE_NOT_FOUND" && error.message.includes(specifier);
|
|
6264
|
-
const loadExpoConfig = async () => {
|
|
6265
|
-
try {
|
|
6266
|
-
const module = await importExpoConfigModule("expo/config.js");
|
|
6267
|
-
return module.getConfig ? module : module.default;
|
|
6268
|
-
} catch (error) {
|
|
6269
|
-
if (!isMissingModule(error, "expo/config.js")) throw error;
|
|
6270
|
-
}
|
|
6271
|
-
const module = await importExpoConfigModule("expo/config/index.js");
|
|
6272
|
-
return module.getConfig ? module : module.default;
|
|
6273
|
-
};
|
|
6262
|
+
const require$1 = createRequire(import.meta.url);
|
|
6274
6263
|
const getConfig = async (...args) => {
|
|
6275
|
-
return (
|
|
6264
|
+
return require$1(require$1.resolve("expo/config", { paths: [path$1.resolve(args[0])] })).getConfig(...args);
|
|
6276
6265
|
};
|
|
6277
6266
|
//#endregion
|
|
6278
6267
|
//#region src/resolveMain.ts
|
|
@@ -6355,23 +6344,16 @@ const getExpoBundleSigningPublicKey = async (cwd) => {
|
|
|
6355
6344
|
if (typeof publicKeyPath !== "string" || !publicKeyPath.trim()) throw new Error("@hot-updater/expo publicKeyPath must be a non-empty path.");
|
|
6356
6345
|
return { publicKey: await readBundleSigningPublicKeyFile(publicKeyPath, { cwd }) };
|
|
6357
6346
|
};
|
|
6358
|
-
const isHermesEnabled = (cwd, platform) => {
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
const { expo } = JSON.parse(fs.readFileSync(appJsonPath, "utf-8"));
|
|
6362
|
-
const platformJsEngine = expo?.[platform]?.jsEngine;
|
|
6363
|
-
const commonJsEngine = expo?.jsEngine;
|
|
6364
|
-
if (platformJsEngine !== void 0) return platformJsEngine === "hermes";
|
|
6365
|
-
if (commonJsEngine !== void 0) return commonJsEngine === "hermes";
|
|
6366
|
-
} catch {}
|
|
6367
|
-
return true;
|
|
6347
|
+
const isHermesEnabled = async (cwd, platform) => {
|
|
6348
|
+
const { exp } = await getConfig(cwd, { skipSDKVersionRequirement: true });
|
|
6349
|
+
return (exp[platform]?.jsEngine ?? exp.jsEngine ?? "hermes") === "hermes";
|
|
6368
6350
|
};
|
|
6369
6351
|
const runBundle = async ({ cwd, platform, buildPath, sourcemap, resetCache }) => {
|
|
6370
6352
|
const filename = `index.${platform}`;
|
|
6371
6353
|
const bundleOutput = path.join(buildPath, `${filename}.bundle`);
|
|
6372
6354
|
const entryFile = resolveMain(cwd);
|
|
6373
6355
|
const bundleId = uuidv7();
|
|
6374
|
-
const enableHermes = isHermesEnabled(cwd, platform);
|
|
6356
|
+
const enableHermes = await isHermesEnabled(cwd, platform);
|
|
6375
6357
|
const args = [
|
|
6376
6358
|
"expo",
|
|
6377
6359
|
"export:embed",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/expo",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
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.0.0
|
|
32
|
-
"@hot-updater/
|
|
33
|
-
"@hot-updater/
|
|
31
|
+
"@hot-updater/bare": "1.0.0",
|
|
32
|
+
"@hot-updater/cli-tools": "1.0.0",
|
|
33
|
+
"@hot-updater/plugin-core": "1.0.0"
|
|
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.0.0
|
|
40
|
+
"hot-updater": "1.0.0"
|
|
41
41
|
},
|
|
42
42
|
"exports": {
|
|
43
43
|
".": {
|
|
@@ -65,20 +65,6 @@ function transformAndroidReactHost(contents) {
|
|
|
65
65
|
return result;
|
|
66
66
|
}
|
|
67
67
|
const callContents = result.slice(callStartIndex, closeParenIndex + 1);
|
|
68
|
-
const kotlinLegacyBundlePathRegex = /^([ \t]*)jsBundleFilePath = HotUpdater\.getJSBundleFile\(applicationContext\),[ \t]*\r?$/m;
|
|
69
|
-
const legacyBundlePathMatch = callContents.match(kotlinLegacyBundlePathRegex);
|
|
70
|
-
if (legacyBundlePathMatch) {
|
|
71
|
-
const paramIndent = legacyBundlePathMatch[1];
|
|
72
|
-
const jsBundleLines = [
|
|
73
|
-
`${paramIndent}jsBundleFilePath = if (BuildConfig.DEBUG) {`,
|
|
74
|
-
`${paramIndent} null`,
|
|
75
|
-
`${paramIndent}} else {`,
|
|
76
|
-
`${paramIndent} HotUpdater.getJSBundleFile(applicationContext)`,
|
|
77
|
-
`${paramIndent}},`,
|
|
78
|
-
];
|
|
79
|
-
const migratedCallContents = callContents.replace(kotlinLegacyBundlePathRegex, jsBundleLines.join("\n"));
|
|
80
|
-
return `${result.slice(0, callStartIndex)}${migratedCallContents}${result.slice(closeParenIndex + 1)}`;
|
|
81
|
-
}
|
|
82
68
|
if (callContents.includes("jsBundleFilePath")) {
|
|
83
69
|
return result;
|
|
84
70
|
}
|
|
@@ -134,7 +120,6 @@ function transformAndroidDefaultHost(contents) {
|
|
|
134
120
|
const kotlinImportAnchor = "import com.facebook.react.ReactApplication";
|
|
135
121
|
const kotlinReactNativeHostAnchor = "object : DefaultReactNativeHost(this) {";
|
|
136
122
|
const kotlinMethodCheck = "HotUpdater.getJSBundleFile(applicationContext)";
|
|
137
|
-
const kotlinLegacyMethodRegex = /^([ \t]*)override fun getJSBundleFile\(\): String\? \{[ \t]*\r?\n([ \t]*)return HotUpdater\.getJSBundleFile\(applicationContext\)[ \t]*\r?\n\1\}[ \t]*$/m;
|
|
138
123
|
const kotlinExistingMethodRegex = /^\s*override fun getJSBundleFile\(\): String\?\s*\{[\s\S]*?^\s*\}/gm;
|
|
139
124
|
const kotlinHermesAnchor = "override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED";
|
|
140
125
|
const kotlinNewArchAnchor = "override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED";
|
|
@@ -144,21 +129,6 @@ function transformAndroidDefaultHost(contents) {
|
|
|
144
129
|
}
|
|
145
130
|
// 1. Add import if missing
|
|
146
131
|
let result = addLinesOnce(contents, kotlinImportAnchor, [kotlinImport]);
|
|
147
|
-
const legacyMethodMatch = result.match(kotlinLegacyMethodRegex);
|
|
148
|
-
if (legacyMethodMatch) {
|
|
149
|
-
const methodIndent = legacyMethodMatch[1];
|
|
150
|
-
const bodyIndent = legacyMethodMatch[2];
|
|
151
|
-
const methodLines = [
|
|
152
|
-
`${methodIndent}override fun getJSBundleFile(): String? {`,
|
|
153
|
-
`${bodyIndent}return if (BuildConfig.DEBUG) {`,
|
|
154
|
-
`${bodyIndent} null`,
|
|
155
|
-
`${bodyIndent}} else {`,
|
|
156
|
-
`${bodyIndent} HotUpdater.getJSBundleFile(applicationContext)`,
|
|
157
|
-
`${bodyIndent}}`,
|
|
158
|
-
`${methodIndent}}`,
|
|
159
|
-
];
|
|
160
|
-
result = result.replace(kotlinLegacyMethodRegex, methodLines.join("\n"));
|
|
161
|
-
}
|
|
162
132
|
// 2. Add/Replace getJSBundleFile method if needed
|
|
163
133
|
if (!result.includes(kotlinMethodCheck)) {
|
|
164
134
|
// Remove potentially existing (different) override first
|
|
@@ -157,17 +157,6 @@ const withHotUpdaterConfigAsync = (props) => (config) => {
|
|
|
157
157
|
}
|
|
158
158
|
return cfg;
|
|
159
159
|
});
|
|
160
|
-
// Remove legacy Hot Updater string resources when prebuild reuses a tree.
|
|
161
|
-
modifiedConfig = (0, config_plugins_1.withStringsXml)(modifiedConfig, (cfg) => {
|
|
162
|
-
const strings = cfg.modResults.resources?.string;
|
|
163
|
-
if (!strings) {
|
|
164
|
-
return cfg;
|
|
165
|
-
}
|
|
166
|
-
cfg.modResults.resources.string = (Array.isArray(strings) ? strings : [strings]).filter((item) => item.$?.name !== "hot_updater_channel" &&
|
|
167
|
-
item.$?.name !== "hot_updater_fingerprint_hash" &&
|
|
168
|
-
item.$?.name !== "hot_updater_public_key");
|
|
169
|
-
return cfg;
|
|
170
|
-
});
|
|
171
160
|
return modifiedConfig;
|
|
172
161
|
};
|
|
173
162
|
/**
|