react-native-update-cli 2.27.0 → 2.28.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/lib/locales/en.js CHANGED
@@ -4,7 +4,7 @@ exports.default = {
4
4
  accountSummary: 'Account: {{account}} | Plan: {{tier}} | Expires at: {{expiry}}',
5
5
  accountUnknown: 'Unknown',
6
6
  accountNoExpiry: 'No expiry specified',
7
- accountRenewalWarning: '[Warning] Your Pushy paid plan expires in {{days}} days. Renew soon to avoid service disruption: {{url}}',
7
+ accountRenewalWarning: '[Notice] Your Pushy paid plan expires in {{days}} days. Renew soon to avoid service disruption: {{url}}',
8
8
  accountLookupFailed: '[Warning] Unable to retrieve account information. Continuing with the command.',
9
9
  addedToGitignore: 'Added {{line}} to .gitignore',
10
10
  androidCrunchPngsWarning: 'The crunchPngs option of android seems not disabled (Please ignore this warning if already disabled), which may cause abnormal consumption of mobile network traffic. Please refer to https://cresc.dev/docs/getting-started#disable-crunchpngs-on-android \n',
package/lib/locales/zh.js CHANGED
@@ -4,7 +4,7 @@ exports.default = {
4
4
  accountSummary: '当前账号:{{account}} | 等级:{{tier}} | 有效期至:{{expiry}}',
5
5
  accountUnknown: '未知',
6
6
  accountNoExpiry: '未设置有效期',
7
- accountRenewalWarning: '[警告] 您的 Pushy 付费套餐将在 {{days}} 天内到期,请及时续费,以免影响服务:{{url}}',
7
+ accountRenewalWarning: '[注意] 您的 Pushy 付费套餐将在 {{days}} 天内到期,请及时续费,以免影响服务:{{url}}',
8
8
  accountLookupFailed: '[警告] 暂时无法获取账号信息,将继续执行命令。',
9
9
  addedToGitignore: '已将 {{line}} 添加到 .gitignore',
10
10
  androidCrunchPngsWarning: 'android 的 crunchPngs 选项似乎尚未禁用(如已禁用则请忽略此提示),这可能导致热更包体积异常增大,具体请参考 https://pushy.reactnative.cn/docs/getting-started.html#%E7%A6%81%E7%94%A8-android-%E7%9A%84-crunch-%E4%BC%98%E5%8C%96 \n',
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Replace the parts of a detail line that can only come from the user's code:
3
+ * quoted string operands (property names, string literals), function names,
4
+ * and filesystem paths that reach the line through a compiler's stderr. What
5
+ * stays is the shape a fix is reasoned about -- opcodes, registers, counts,
6
+ * literal kinds -- plus each redacted value's length and character class.
7
+ *
8
+ * This is redaction by class, not a proof: it covers the shapes the comparison
9
+ * and the compilers are known to emit. Anything that arrives in an unknown
10
+ * shape still has its paths and quoted runs stripped, so a new detail format
11
+ * cannot silently start leaking identifiers.
12
+ */
13
+ export declare function redactFailureDetail(detail: string): string;
14
+ /**
15
+ * The grouping key: a redacted detail with everything that varies between two
16
+ * occurrences of the same defect removed -- registers, ids, offsets, labels,
17
+ * counts and the redaction tokens themselves. Sixteen bytes; the server stores
18
+ * it as 32 hex characters.
19
+ */
20
+ export declare function failureFingerprint(detail: string): string;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.redactFailureDetail = redactFailureDetail;
4
+ exports.failureFingerprint = failureFingerprint;
5
+ /**
6
+ * One implementation of the failure fingerprint, shared by everything that
7
+ * groups the same failure: the version/create report, the fuzzer's dedup of
8
+ * its findings, and (later) the replay of the stored corpus. Two
9
+ * implementations would mean the counts behind "how often does this happen"
10
+ * are fiction, so callers import from here rather than writing their own
11
+ * regexes.
12
+ *
13
+ * Redaction is the other half. A detail line carries whatever hermesc printed,
14
+ * which is the user's own code: the first rejection seen in production named
15
+ * the property `promotionRequestItemId`. Details travel to the server, into
16
+ * issue lists and -- once the fix loop runs -- into public pull requests and CI
17
+ * fixtures, so the identifiers are replaced by tokens *before* the report
18
+ * leaves the machine. The local console keeps the unredacted text: that is
19
+ * where the name is actually useful.
20
+ */
21
+ const node_crypto_1 = require("node:crypto");
22
+ const sha = (value) => (0, node_crypto_1.createHash)('sha256').update(value).digest('hex');
23
+ /** stable stand-in for one redacted value; the same input always yields it */
24
+ const token = (kind, value) => `${kind}#${sha(value).slice(0, 8)}`;
25
+ /**
26
+ * Replace the parts of a detail line that can only come from the user's code:
27
+ * quoted string operands (property names, string literals), function names,
28
+ * and filesystem paths that reach the line through a compiler's stderr. What
29
+ * stays is the shape a fix is reasoned about -- opcodes, registers, counts,
30
+ * literal kinds -- plus each redacted value's length and character class.
31
+ *
32
+ * This is redaction by class, not a proof: it covers the shapes the comparison
33
+ * and the compilers are known to emit. Anything that arrives in an unknown
34
+ * shape still has its paths and quoted runs stripped, so a new detail format
35
+ * cannot silently start leaking identifiers.
36
+ */
37
+ function redactFailureDetail(detail) {
38
+ return (detail
39
+ // Paths first: a compiler's stderr reaches the line with them, and
40
+ // running this pass after the others would eat the `/<length>` suffix
41
+ // the string pass writes.
42
+ .replace(/(?:\.{0,2}\/)[^\s:,)"']*/g, (path) => {
43
+ const ext = /\.([A-Za-z0-9]+)$/.exec(path);
44
+ return `${token('path', path)}${ext ? `.${ext[1]}` : ''}`;
45
+ })
46
+ // Function<name>(…) headers, including the raw-audit variants
47
+ .replace(/\b(Function|NCFunction|Constructor)<([^>]*)>/g, (_all, kind, name) => `${kind}<${name ? token('fn', name) : ''}>`)
48
+ // Quoted operands. hermesc does not escape quotes inside strings, so the
49
+ // run is taken as-is up to the next quote; a stray tail keeps whatever
50
+ // the earlier passes left rather than being reconstructed.
51
+ .replace(/"([^"\n]*)"/g, (_all, value) => {
52
+ const units = Array.from(value);
53
+ const ascii = units.every((char) => char.charCodeAt(0) < 0x80);
54
+ return `"${token('str', value)}/${units.length}${ascii ? '' : '/u16'}"`;
55
+ }));
56
+ }
57
+ /**
58
+ * The grouping key: a redacted detail with everything that varies between two
59
+ * occurrences of the same defect removed -- registers, ids, offsets, labels,
60
+ * counts and the redaction tokens themselves. Sixteen bytes; the server stores
61
+ * it as 32 hex characters.
62
+ */
63
+ function failureFingerprint(detail) {
64
+ const shape = redactFailureDetail(detail)
65
+ .replace(/#[0-9a-f]{8}/g, '#')
66
+ .replace(/\br\d+\b/g, 'r')
67
+ .replace(/\bL\d+\b/g, 'L')
68
+ .replace(/\d+/g, 'N')
69
+ .replace(/\s+/g, ' ')
70
+ .trim();
71
+ return sha(shape).slice(0, 32);
72
+ }
@@ -40,8 +40,17 @@ export interface HermesBaseMeta {
40
40
  baseHash: string | null;
41
41
  /** absent (never null) when the bundle step did not run hermesc */
42
42
  hermesBaseOutcome?: HermesBaseOutcome;
43
- /** first difference / failure reason; absent when there is none */
43
+ /**
44
+ * First difference / failure reason, redacted (see redactFailureDetail):
45
+ * the raw text carries the user's own property and string names. Absent
46
+ * when there is none.
47
+ */
44
48
  hermesBaseDetail?: string;
49
+ /**
50
+ * Grouping key for the same defect across builds and apps, computed from
51
+ * the unredacted detail. Absent with the detail.
52
+ */
53
+ hermesBaseFingerprint?: string;
45
54
  }
46
55
  /**
47
56
  * Hermes V1 (static_h) builds before 2025-07-11 carried a delta-mode bug when a
@@ -81,7 +81,9 @@ const path_1 = __importDefault(require("path"));
81
81
  const stream_1 = require("stream");
82
82
  const promises_1 = require("stream/promises");
83
83
  const constants_1 = require("./constants");
84
+ const failure_fingerprint_1 = require("./failure-fingerprint");
84
85
  const hbcTransform_1 = require("./hbcTransform");
86
+ const hermes_cached_object_1 = require("./hermes-cached-object");
85
87
  const hermes_literals_1 = require("./hermes-literals");
86
88
  const hermes_raw_1 = require("./hermes-raw");
87
89
  const hermes_timeout_1 = require("./hermes-timeout");
@@ -816,9 +818,13 @@ function hermesBaseMeta(selection, bytecodeVersion, check) {
816
818
  };
817
819
  if (check) {
818
820
  meta.hermesBaseOutcome = check.outcome;
819
- const detail = truncateHermesBaseDetail(check.detail);
820
- if (detail)
821
+ // The console above keeps the real text -- that is where the property
822
+ // name helps. What leaves the machine is redacted and fingerprinted.
823
+ const detail = truncateHermesBaseDetail((0, failure_fingerprint_1.redactFailureDetail)(check.detail ?? ''));
824
+ if (detail) {
821
825
  meta.hermesBaseDetail = detail;
826
+ meta.hermesBaseFingerprint = (0, failure_fingerprint_1.failureFingerprint)(check.detail ?? '');
827
+ }
822
828
  }
823
829
  return meta;
824
830
  }
@@ -898,6 +904,9 @@ function normalizeDisassemblyLine(line, strings, literals) {
898
904
  if (opcode === 'Offset' && line.startsWith('Offset in debug table', indent)) {
899
905
  return null;
900
906
  }
907
+ if (opcode === 'CacheNewObject') {
908
+ return (0, hermes_cached_object_1.normalizeCachedObjectInstruction)(line, literals);
909
+ }
901
910
  let m;
902
911
  if (opcode.startsWith('New') && opcode.includes('WithBuffer')) {
903
912
  // v98's AndParent form takes the parent object in a second register,
@@ -925,12 +934,26 @@ function normalizeDisassemblyLine(line, strings, literals) {
925
934
  return `${m[1]} ${m[3]}${normalizeOperandSpacing(m[4])}`;
926
935
  }
927
936
  if (opcode.startsWith('DefineOwnById')) {
928
- m = /^(\s*DefineOwnById\w*\s+r\d+, r\d+, \d+, )(\d+)$/.exec(line);
937
+ // BytecodeList.def annotates the string operand of DefineOwnByIdLong but
938
+ // not of DefineOwnById, so one instruction has two pretty renderings: the
939
+ // plain compile keeps small ids and prints the bare id, while a base
940
+ // compile inherits the base's string table, spills past 16 bits, picks the
941
+ // Long form and prints the *text* — cut to hermesc's display budget
942
+ // (`"equivalenceCheckP"...` for `equivalenceCheckPropertyName`). Neither side can
943
+ // be turned into the other: that budget also drops non-ASCII silently and
944
+ // without a marker (`ab\u4e2d` prints as `"ab"`), so a resolved name never
945
+ // equals a printed one. The operand is folded away here and the property
946
+ // name is compared by the raw audit, which decodes it from the string
947
+ // table in full (STRING_OPERANDS supplies the missing annotation).
948
+ m = /^(\s*DefineOwnById\w*\s+r\d+, r\d+, \d+, )(\d+)?.*$/.exec(line);
929
949
  if (m) {
930
- const text = strings.get(Number(m[2]));
931
- if (text === undefined)
950
+ // An id form whose id is not in the table means the string table was
951
+ // not read at all; that still fails closed rather than folding an
952
+ // operand nothing could resolve.
953
+ if (m[2] !== undefined && !strings.has(Number(m[2]))) {
932
954
  throw new Error(`unresolved string id ${m[2]}`);
933
- line = `${m[1]}${JSON.stringify(text)}`;
955
+ }
956
+ line = `${m[1]}<str>`;
934
957
  }
935
958
  }
936
959
  // Operand-width variants of one instruction (GetByIdShort/GetById/GetByIdLong,
@@ -0,0 +1,3 @@
1
+ import type { LiteralResolver } from './hermes-literals';
2
+ /** Normalize the shape reference, not the registers or the per-function cache. */
3
+ export declare function normalizeCachedObjectInstruction(line: string, literals?: LiteralResolver): string;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeCachedObjectInstruction = normalizeCachedObjectInstruction;
4
+ /** Normalize the shape reference, not the registers or the per-function cache. */
5
+ function normalizeCachedObjectInstruction(line, literals) {
6
+ const m = /^(\s*)CacheNewObject\s+(r\d+),\s*(r\d+),\s*(\d+),\s*(\d+)\s*$/.exec(line);
7
+ if (!m)
8
+ throw new Error(`unsupported cached object operands: ${line.trim()}`);
9
+ const prefix = `${m[1]}CacheNewObject ${m[2]}, ${m[3]}, `;
10
+ // Diagnostic-only fallback: compareHermesBytecode still requires readable
11
+ // binary data and a successful raw audit before returning equivalent.
12
+ if (!literals)
13
+ return `${prefix}<shape>, ${m[5]}`;
14
+ const shape = literals.shape(Number(m[4]));
15
+ const keys = shape && literals.objectKeys(shape.keyOffset, shape.count);
16
+ if (!shape || !keys) {
17
+ throw new Error(`undecodable cached object shape ${m[4]}`);
18
+ }
19
+ // JSON preserves key order, complete string contents and significant spaces.
20
+ return `${prefix}keys=${JSON.stringify(keys)}, ${m[5]}`;
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update-cli",
3
- "version": "2.27.0",
3
+ "version": "2.28.0",
4
4
  "description": "command line tool for react-native-update (remote updates for react native)",
5
5
  "main": "lib/exports.js",
6
6
  "types": "lib/exports.d.ts",