healkite 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/healkite.mjs +46 -36
  2. package/package.json +5 -5
package/dist/healkite.mjs CHANGED
@@ -23777,11 +23777,11 @@ async function buildBundle(opts) {
23777
23777
  if (composer && existsSync(hbcMap)) {
23778
23778
  await run("node", [composer, metroMap, hbcMap, "-o", composed], opts.projectDir);
23779
23779
  await rm2(hbcMap, { force: true });
23780
- return { dir: opts.outDir, entry, sourcemap: composed };
23780
+ return { dir: opts.outDir, entry, sourcemap: composed, metroSourcemap: metroMap };
23781
23781
  }
23782
23782
  await rm2(hbcMap, { force: true });
23783
- opts.log("Couldn't compose the Hermes source map (react-native/scripts/compose-source-maps.js not found); using function names only.");
23784
- return { dir: opts.outDir, entry };
23783
+ opts.log("Couldn't compose the Hermes source map (react-native/scripts/compose-source-maps.js not found); bytecode-offset frames use function names only.");
23784
+ return { dir: opts.outDir, entry, metroSourcemap: metroMap };
23785
23785
  }
23786
23786
  }
23787
23787
  return { dir: opts.outDir, entry, ...opts.sourcemap ? { sourcemap: metroMap } : {} };
@@ -24422,7 +24422,7 @@ async function findSuspects(errors, changes, deps2) {
24422
24422
  const w = errWeight / (i + 1) ** 2;
24423
24423
  let file2 = null;
24424
24424
  let line = 0;
24425
- const pos = deps2.map?.lookup(f.line, f.column) ?? null;
24425
+ const pos = (f.line > 1 ? deps2.bundleMap ?? deps2.map : deps2.map)?.lookup(f.line, f.column) ?? null;
24426
24426
  if (pos) {
24427
24427
  file2 = projectRelative(pos.source, deps2.projectDir);
24428
24428
  line = pos.line;
@@ -25434,7 +25434,7 @@ async function api() {
25434
25434
  if (!config2) throw new Error("Not logged in. Run `healkite login --api-url <url> --token <hk_\u2026>` or set HEALKITE_API_URL/HEALKITE_TOKEN.");
25435
25435
  return new ApiClient(config2);
25436
25436
  }
25437
- var program2 = new Command().name("healkite").description("Self-healing over-the-air updates for React Native").version("0.3.0");
25437
+ var program2 = new Command().name("healkite").description("Self-healing over-the-air updates for React Native").version("0.3.1");
25438
25438
  program2.command("login").description("Save API credentials to ~/.healkite/config.json").requiredOption("--api-url <url>", "Healkite API URL, e.g. https://api.healkite.com").requiredOption("--token <token>", "access key (hk_\u2026)").action(async (o) => {
25439
25439
  const client = new ApiClient({ apiUrl: o.apiUrl, token: o.token });
25440
25440
  await client.request("GET", "/v1/apps");
@@ -26091,6 +26091,7 @@ program2.command("blame").description("Find the change that broke a release: sym
26091
26091
  const head = await headCommit(projectDir);
26092
26092
  if (head !== source.commit) log(`Note: HEAD is ${head.slice(0, 8)}; the release was built from ${source.commit.slice(0, 8)}. Line numbers are blamed at the release commit.`);
26093
26093
  let map2 = null;
26094
+ let bundleMap = null;
26094
26095
  if (o.sourcemap) map2 = new SourceMap(await readFile5(o.sourcemap, "utf8"));
26095
26096
  else if (o.build && errors.some((e) => e.stack)) {
26096
26097
  log("Rebuilding the release with a source map\u2026");
@@ -26101,14 +26102,18 @@ program2.command("blame").description("Find the change that broke a release: sym
26101
26102
  outDir: join6(projectDir, ".healkite/blame", release.platform),
26102
26103
  hermes: o.hermes,
26103
26104
  sourcemap: true,
26104
- log
26105
+ log,
26106
+ // Same instrumentation as `healkite release`, so the rebuild matches the released bytes (and lines).
26107
+ env: await hasLogpointPlugin(projectDir) ? { HEALKITE_STARTUP_PROFILE: "1", HEALKITE_PROJECT_ROOT: projectDir, ...existsSync4(join6(projectDir, o.entryFile)) ? { HEALKITE_ENTRY: join6(projectDir, o.entryFile) } : {} } : void 0
26105
26108
  });
26106
26109
  const packed = await packDirectory(built);
26107
- if (packed.sha256 !== release.bundleSha256) log("The rebuilt bundle differs from the released one (different dependencies or build settings); mapping may be approximate.");
26110
+ if (packed.sha256 !== release.bundleSha256) log("Note: the rebuild (with source maps) isn't byte-identical to the release. If dependencies changed since it was published, line numbers may be slightly off.");
26108
26111
  if (built.sourcemap) map2 = new SourceMap(await readFile5(built.sourcemap, "utf8"));
26112
+ if (built.metroSourcemap && built.metroSourcemap !== built.sourcemap) bundleMap = new SourceMap(await readFile5(built.metroSourcemap, "utf8"));
26109
26113
  }
26110
26114
  const result = await findSuspects(errors, source.changes, {
26111
26115
  map: map2,
26116
+ bundleMap,
26112
26117
  projectDir,
26113
26118
  blame: (file2, line) => blameLine(projectDir, source.commit, file2, line)
26114
26119
  });
@@ -26235,6 +26240,39 @@ async function releaseAction(o) {
26235
26240
  const maxSize = o.maxSize ? parseSize(o.maxSize) : void 0;
26236
26241
  const maxGrowthPct = o.maxGrowth !== void 0 ? parsePercent(o.maxGrowth) : void 0;
26237
26242
  const signingKey = await loadSigningKey(o.sign);
26243
+ let pre = null;
26244
+ if (!o.out) {
26245
+ const client2 = await api();
26246
+ const latest2 = (await client2.request(
26247
+ "GET",
26248
+ `/v1/channels/${o.channel}/releases?${new URLSearchParams({ platform: o.platform, runtimeVersion: o.runtimeVersion, limit: "1" })}`
26249
+ )).releases[0];
26250
+ let source2 = null;
26251
+ if (!o.skipSource) {
26252
+ try {
26253
+ const prev = latest2 ? (await client2.request("GET", `/v1/releases/${latest2.id}/source`).catch(() => ({ source: null }))).source : null;
26254
+ source2 = await releaseSource(projectDir, prev?.commit ?? null, log);
26255
+ if (source2) log(`Source: ${source2.commit.slice(0, 8)}${source2.changes.length ? `, ${source2.changes.length} change${source2.changes.length === 1 ? "" : "s"} since ${latest2?.label}` : ""}`);
26256
+ } catch (e) {
26257
+ log(`Couldn't read git history (${e.message}); publishing without it.`);
26258
+ }
26259
+ }
26260
+ let review2 = null;
26261
+ if (!o.skipSource && source2?.baseCommit && !o.noStoreCheck && o.storeCheck !== false) {
26262
+ try {
26263
+ review2 = await otaCheck(projectDir, source2.baseCommit);
26264
+ log(`Store check: ${review2.summary}`);
26265
+ for (const f of review2.findings.filter((x) => x.severity !== "info")) log(` ${f.severity.toUpperCase()}: ${f.title}`);
26266
+ if (review2.verdict === "blocked" && !o.force) {
26267
+ throw new Error("This update can't safely ship over the air (see above). Ship a store build, or pass --force if you're sure.");
26268
+ }
26269
+ } catch (e) {
26270
+ if (e.message.startsWith("This update can't")) throw e;
26271
+ log(`Store check skipped (${e.message})`);
26272
+ }
26273
+ }
26274
+ pre = { client: client2, latest: latest2, source: source2, review: review2 };
26275
+ }
26238
26276
  const profileEnv = !o.buildEnv && o.startupProfile !== false && await hasLogpointPlugin(projectDir) ? {
26239
26277
  HEALKITE_STARTUP_PROFILE: "1",
26240
26278
  HEALKITE_PROJECT_ROOT: projectDir,
@@ -26303,11 +26341,7 @@ async function releaseAction(o) {
26303
26341
  log(`Released ${r.manifest.release?.label} locally (${store.description})`);
26304
26342
  return;
26305
26343
  }
26306
- const client = await api();
26307
- const latest = (await client.request(
26308
- "GET",
26309
- `/v1/channels/${o.channel}/releases?${new URLSearchParams({ platform: o.platform, runtimeVersion: o.runtimeVersion, limit: "1" })}`
26310
- )).releases[0];
26344
+ const { client, latest, source, review } = pre;
26311
26345
  const budget = checkBudget({ size: packed.hkb.byteLength, previous: latest ? { label: latest.label, size: latest.bundleSize } : null, maxSize, maxGrowthPct });
26312
26346
  log(budget.summary);
26313
26347
  if (!budget.ok) throw new Error(`Size budget exceeded: ${budget.problems.join("; ")}. Nothing was uploaded.`);
@@ -26332,30 +26366,6 @@ async function releaseAction(o) {
26332
26366
  });
26333
26367
  for (const p of patchList) await client.uploadBlob(p.hkp, p.sha256, "patch");
26334
26368
  }
26335
- let source = null;
26336
- if (!o.skipSource) {
26337
- try {
26338
- const prev = latest ? (await client.request("GET", `/v1/releases/${latest.id}/source`).catch(() => ({ source: null }))).source : null;
26339
- source = await releaseSource(projectDir, prev?.commit ?? null, log);
26340
- if (source) log(`Source: ${source.commit.slice(0, 8)}${source.changes.length ? `, ${source.changes.length} change${source.changes.length === 1 ? "" : "s"} since ${latest?.label}` : ""}`);
26341
- } catch (e) {
26342
- log(`Couldn't read git history (${e.message}); publishing without it.`);
26343
- }
26344
- }
26345
- let review = null;
26346
- if (!o.skipSource && source?.baseCommit && !o.noStoreCheck && o.storeCheck !== false) {
26347
- try {
26348
- review = await otaCheck(projectDir, source.baseCommit);
26349
- log(`Store check: ${review.summary}`);
26350
- for (const f of review.findings.filter((x) => x.severity !== "info")) log(` ${f.severity.toUpperCase()}: ${f.title}`);
26351
- if (review.verdict === "blocked" && !o.force) {
26352
- throw new Error("This update can't safely ship over the air (see above). Ship a store build, or pass --force if you're sure.");
26353
- }
26354
- } catch (e) {
26355
- if (e.message.startsWith("This update can't")) throw e;
26356
- log(`Store check skipped (${e.message})`);
26357
- }
26358
- }
26359
26369
  const githubOidcToken = await githubOidc();
26360
26370
  if (githubOidcToken) log("Build provenance: GitHub Actions identity attached");
26361
26371
  const release = await client.request("POST", "/v1/releases", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "healkite",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Healkite CLI — release, promote and roll back over-the-air React Native updates.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -13,11 +13,11 @@
13
13
  "@types/node": "^24",
14
14
  "typescript": "~6.0.3",
15
15
  "vitest": "^5.1.0",
16
- "@healkite/adapter-blob-s3": "0.0.0",
17
- "@healkite/core": "0.0.0",
18
- "healkite-protocol": "0.3.0",
16
+ "@healkite/adapter-blob-fs": "0.0.0",
19
17
  "@healkite/adapter-cdn-cloudflare": "0.0.0",
20
- "@healkite/adapter-blob-fs": "0.0.0"
18
+ "@healkite/core": "0.0.0",
19
+ "healkite-protocol": "0.3.1",
20
+ "@healkite/adapter-blob-s3": "0.0.0"
21
21
  },
22
22
  "author": "Healkite",
23
23
  "homepage": "https://healkite.com",