Files
orca/config/patches/i18next-cli@1.74.2.patch
T
Neil 0f52bb8be5 perf(ci): use four ARM test workers and remove repeated compilation (#23685)
* ci: benchmark per-job Node compile caching on full unit shards

* ci: measure unit shards with three and four workers

* ci: benchmark localization extraction CLI patch

* perf(build): reuse identical relay bundles across platforms

* ci: compare Vitest 4 and 5 on complete ARM shards

* perf(ci): upgrade localization extraction to skip irrelevant syntax walks

* perf(ci): use all four ARM cores and remove benchmark workflows

* ci: preserve failures while capturing unit source revision

* fix(ci): preserve commented and escaped localization calls

* ci: remove corrected localization benchmark harness
2026-09-28 14:05:30 -07:00

45 lines
2.4 KiB
Diff

diff --git a/dist/cjs/extractor/core/extractor.js b/dist/cjs/extractor/core/extractor.js
index 6d61ade2471c20bf1a253e3784bfadcb01440545..c1b001e78a215f89a8d4da1756a87562a5a6e723 100644
--- a/dist/cjs/extractor/core/extractor.js
+++ b/dist/cjs/extractor/core/extractor.js
@@ -143,6 +143,8 @@ const extractionSiteRegexes = new WeakMap();
* @internal
*/
function mayContainExtractionSite(code, config) {
+ // Escaped identifiers need the parser; comments can separate a name from its call.
+ if (code.includes('\\u')) return true;
let re = extractionSiteRegexes.get(config);
if (!re) {
const calls = new Set(['t']);
@@ -160,7 +162,7 @@ function mayContainExtractionSite(code, config) {
for (const component of config.extract.transComponents || ['Trans'])
names.add(component.split('.').pop());
const alt = (set) => [...set].map(s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|');
- re = new RegExp(`(?<!\\w)(?:(?:${alt(calls)})\\s*(?:\\?\\.\\s*)?[(<]|(?:${alt(names)})(?![\\w$]))`);
+ re = new RegExp(`(?<![\\w$])(?:${alt(calls)}|${alt(names)})(?![\\w$])`);
extractionSiteRegexes.set(config, re);
}
return re.test(code);
diff --git a/dist/esm/extractor/core/extractor.js b/dist/esm/extractor/core/extractor.js
index 910bdb6e25e26c01ea6127191f1a00c7089693c1..00da4a6a7acb6c3da8d4b6fe7be106c409542f8d 100644
--- a/dist/esm/extractor/core/extractor.js
+++ b/dist/esm/extractor/core/extractor.js
@@ -141,6 +141,8 @@ const extractionSiteRegexes = new WeakMap();
* @internal
*/
function mayContainExtractionSite(code, config) {
+ // Escaped identifiers need the parser; comments can separate a name from its call.
+ if (code.includes('\\u')) return true;
let re = extractionSiteRegexes.get(config);
if (!re) {
const calls = new Set(['t']);
@@ -158,7 +160,7 @@ function mayContainExtractionSite(code, config) {
for (const component of config.extract.transComponents || ['Trans'])
names.add(component.split('.').pop());
const alt = (set) => [...set].map(s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|');
- re = new RegExp(`(?<!\\w)(?:(?:${alt(calls)})\\s*(?:\\?\\.\\s*)?[(<]|(?:${alt(names)})(?![\\w$]))`);
+ re = new RegExp(`(?<![\\w$])(?:${alt(calls)}|${alt(names)})(?![\\w$])`);
extractionSiteRegexes.set(config, re);
}
return re.test(code);