@let-value/translate-extract 1.2.3 → 1.2.4
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/bin/cli.cjs +1 -1
- package/dist/bin/cli.mjs +1 -1
- package/dist/{configuration-DLSMbmU5.d.cts → configuration-CoElcSHz.d.cts} +6 -2
- package/dist/{configuration-Bwtek7Fh.d.mts.map → configuration-CoElcSHz.d.cts.map} +1 -1
- package/dist/{configuration-Bwtek7Fh.d.mts → configuration-s7zv58Wf.d.mts} +6 -2
- package/dist/{configuration-DLSMbmU5.d.cts.map → configuration-s7zv58Wf.d.mts.map} +1 -1
- package/dist/{run-CzeTVOug.mjs → run-Bv_HcDXZ.mjs} +85 -10
- package/dist/run-Bv_HcDXZ.mjs.map +1 -0
- package/dist/{run-Bcz92fEY.cjs → run-E1x_uibM.cjs} +84 -9
- package/dist/src/core.d.cts +1 -1
- package/dist/src/core.d.mts +1 -1
- package/dist/src/core.mjs.map +1 -1
- package/dist/src/index.cjs +1 -1
- package/dist/src/index.d.cts +1 -1
- package/dist/src/index.d.mts +1 -1
- package/dist/src/index.mjs +1 -1
- package/dist/src/static.d.cts +1 -1
- package/dist/src/static.d.mts +1 -1
- package/package.json +3 -3
- package/dist/run-CzeTVOug.mjs.map +0 -1
package/dist/bin/cli.cjs
CHANGED
package/dist/bin/cli.mjs
CHANGED
|
@@ -233,7 +233,11 @@ interface UserConfig {
|
|
|
233
233
|
*/
|
|
234
234
|
walk?: boolean;
|
|
235
235
|
/**
|
|
236
|
-
* Paths or patterns to exclude from extraction, applied to all entrypoints
|
|
236
|
+
* Paths or patterns to exclude from extraction, applied to all entrypoints.
|
|
237
|
+
* Also matched against the specifier of an import that could not be
|
|
238
|
+
* resolved, so it doubles as an ignore list for such imports — a matching
|
|
239
|
+
* specifier is skipped without a warning. Bundler-virtual specifiers
|
|
240
|
+
* (`virtual:…`, `\0…`, URL schemes) are skipped without configuration.
|
|
237
241
|
* @default [/node_modules/, /dist/, /build/]
|
|
238
242
|
* @see Can be overridden per entrypoint via `exclude` in {@link EntrypointConfig}.
|
|
239
243
|
*/
|
|
@@ -265,4 +269,4 @@ interface ResolvedConfig {
|
|
|
265
269
|
declare function defineConfig(config: UserConfig): ResolvedConfig;
|
|
266
270
|
//#endregion
|
|
267
271
|
export { po as A, ProcessHook as C, StaticPlugin as D, UniversalPlugin as E, cleanup$1 as F, Logger as I, react$1 as M, po$1 as N, cleanup as O, core$1 as P, ProcessArgs as S, SourceArgs as T, LoadArgs as _, ExcludeFn as a, OutputsHook as b, ResolvedEntrypoint as c, Build as d, CollectedArgs as f, ImportReference as g, FileTranslations as h, ExcludeConfig as i, react as j, core as k, UserConfig as l, Context as m, EntrypointConfig as n, ObsoleteStrategy as o, CollectedHook as p, Exclude as r, ResolvedConfig as s, DestinationFn as t, defineConfig as u, LoadHook as v, ResolveArgs as w, Plugin as x, OutputsArgs as y };
|
|
268
|
-
//# sourceMappingURL=configuration-
|
|
272
|
+
//# sourceMappingURL=configuration-CoElcSHz.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration-
|
|
1
|
+
{"version":3,"file":"configuration-CoElcSHz.d.cts","names":[],"sources":["../src/logger.ts","../src/plugins/core/queries/types.ts","../src/plugins/cleanup/cleanup.ts","../src/plugins/core/core.ts","../src/plugins/po/po.ts","../src/plugins/react/react.ts","../src/static.ts","../src/plugin.ts","../src/exclude.ts","../src/configuration.ts"],"mappings":";;;;KAIY,SAAS,IAAI;KACb,gBAAgB,IAAI;KACpB,WAAW;;;UCHN;EACb;EACA;EACA;EACA;EACA;;UAGa;EACb;EACA;EACA;EACA;EACA,WAAW;EACX;;;;iBCVY,aAAW;;;iBCEX,UAAQ;;;iBCCR,QAAM;;;iBCLN,WAAS;;;iBCAT,QAAQ,OAAO,kBAAkB;;;;;;iBASjC,SAAS,OAAO,kBAAkB;;;;;;iBAQlC,MAAM,OAAO,kBAAkB;;;;;;iBAS/B,WAA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;;;;;;;;EAUA,UAAU;;;;;EAKV,WAAW;;UAGE,2BAA2B,KAAK;EAC7C,UAAU;;UAGG;EACb,SAAS;EACT,aAAa;EACb;EACA;EACA,aAAa;EACb,UAAU;EACV;EACA,UAAU;EACV,SAAS;;;;;;iBA+CG,aAAa,QAAQ,aAAa"}
|
|
@@ -233,7 +233,11 @@ interface UserConfig {
|
|
|
233
233
|
*/
|
|
234
234
|
walk?: boolean;
|
|
235
235
|
/**
|
|
236
|
-
* Paths or patterns to exclude from extraction, applied to all entrypoints
|
|
236
|
+
* Paths or patterns to exclude from extraction, applied to all entrypoints.
|
|
237
|
+
* Also matched against the specifier of an import that could not be
|
|
238
|
+
* resolved, so it doubles as an ignore list for such imports — a matching
|
|
239
|
+
* specifier is skipped without a warning. Bundler-virtual specifiers
|
|
240
|
+
* (`virtual:…`, `\0…`, URL schemes) are skipped without configuration.
|
|
237
241
|
* @default [/node_modules/, /dist/, /build/]
|
|
238
242
|
* @see Can be overridden per entrypoint via `exclude` in {@link EntrypointConfig}.
|
|
239
243
|
*/
|
|
@@ -265,4 +269,4 @@ interface ResolvedConfig {
|
|
|
265
269
|
declare function defineConfig(config: UserConfig): ResolvedConfig;
|
|
266
270
|
//#endregion
|
|
267
271
|
export { po as A, ProcessHook as C, StaticPlugin as D, UniversalPlugin as E, cleanup$1 as F, Logger as I, react$1 as M, po$1 as N, cleanup as O, core$1 as P, ProcessArgs as S, SourceArgs as T, LoadArgs as _, ExcludeFn as a, OutputsHook as b, ResolvedEntrypoint as c, Build as d, CollectedArgs as f, ImportReference as g, FileTranslations as h, ExcludeConfig as i, react as j, core as k, UserConfig as l, Context as m, EntrypointConfig as n, ObsoleteStrategy as o, CollectedHook as p, Exclude as r, ResolvedConfig as s, DestinationFn as t, defineConfig as u, LoadHook as v, ResolveArgs as w, Plugin as x, OutputsArgs as y };
|
|
268
|
-
//# sourceMappingURL=configuration-
|
|
272
|
+
//# sourceMappingURL=configuration-s7zv58Wf.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration-
|
|
1
|
+
{"version":3,"file":"configuration-s7zv58Wf.d.mts","names":[],"sources":["../src/logger.ts","../src/plugins/core/queries/types.ts","../src/plugins/cleanup/cleanup.ts","../src/plugins/core/core.ts","../src/plugins/po/po.ts","../src/plugins/react/react.ts","../src/static.ts","../src/plugin.ts","../src/exclude.ts","../src/configuration.ts"],"mappings":";;;;KAIY,SAAS,IAAI;KACb,gBAAgB,IAAI;KACpB,WAAW;;;UCHN;EACb;EACA;EACA;EACA;EACA;;UAGa;EACb;EACA;EACA;EACA;EACA,WAAW;EACX;;;;iBCVY,aAAW;;;iBCEX,UAAQ;;;iBCCR,QAAM;;;iBCLN,WAAS;;;iBCAT,QAAQ,OAAO,kBAAkB;;;;;;iBASjC,SAAS,OAAO,kBAAkB;;;;;;iBAQlC,MAAM,OAAO,kBAAkB;;;;;;iBAS/B,WAAW,OAAO,kBAAkB;;;;;;KASxC,eACN,kBAAkB,QAClB,kBAAkB,SAClB,kBAAkB,MAClB,kBAAkB;;;KCvCnB,aAAa,KAAK,IAAI,QAAQ;UAElB;EACb,QAAQ;EACR,aAAa;;EAEb,OAAO;EACP,SAAS;;UAGI;EACb;EACA;EACA;;;UAIa,YAAY;EACzB;EACA;EACA;EACA,SAAS;EACT,OAAO;;UAGM;EACb;EACA;EACA,SAAS;;UAGI;EACb;EACA;;;KAIQ,YAAY,MAAM,aAAa;UAE1B;EACb;EACA;EACA;;EAEA,KAAK,cAAc;;;KAIX,eAAe,MAAM,gBAAgB;UAEhC;EACb;EACA,cAAc;;UAGD;EACb;;EAEA,OAAO;;;;;;;EAOP,OAAO,cAAc,eAAe;;;KAI5B,iBAAiB,MAAM,kBAAkB;UAEpC;;EAEb;;;KAIQ,eAAe,MAAM,gBAAgB;UAEhC;EACb,SAAS;;;;;;;EAOT,OAAO,MAAM;EACb,OAAO,QAAQ,QAAQ,MAAM;EAC7B,UAAU,QAAQ,QAAQ,MAAM;EAChC,YAAY,MAAM;EAClB,UAAU,MAAM;;UAGH;EACb;EACA,MAAM,OAAO;;KAGL,kBAAkB,SAAS;;;cC3F1B;WACW,YAAA,QAAA;WACH,SAAA,QAAA;WACC,UAAA,QAAA;WACO,UAAA,QAAA,OAAA;;KAGjB,wBAAwB;;;KCZxB,iBAAiB;EAAQ;EAAgB;EAAoB;;KAC7D,aAAa,MAAM;KACnB,UAAU,SAAS;KACnB,gBAAgB,SAAS,cAAc,gBAAgB,mBAAmB;cAEhF;;;;;KACD,wBAAwB;;;;;;KAOjB;UAEK;EACb;EACA,cAAc;EACd,WAAW;EACX;EACA,UAAU;;UAGG;;;;;;EAMb,gBAAgB;;;;;;EAMhB,UAAU;;;;;;EAMV,UAAU,sBAAsB,gBAAgB,mBAAmB;;;;;;;;EAQnE,sBAAsB,mBAAmB,eAAe;;;;;;;EAOxD,cAAc;;;;;;;EAOd,WAAW;;;;;;EAMX;;;;;;;;;;EAUA,UAAU;;;;;EAKV,WAAW;;UAGE,2BAA2B,KAAK;EAC7C,UAAU;;UAGG;EACb,SAAS;EACT,aAAa;EACb;EACA;EACA,aAAa;EACb,UAAU;EACV;EACA,UAAU;EACV,SAAS;;;;;;iBA+CG,aAAa,QAAQ,aAAa"}
|
|
@@ -552,6 +552,16 @@ function isBuiltin(spec) {
|
|
|
552
552
|
const [base, subpath] = (spec.startsWith("node:") ? spec.slice(5) : spec).split("/", 2);
|
|
553
553
|
return subpath !== void 0 && builtins.has(base);
|
|
554
554
|
}
|
|
555
|
+
const schemePattern = /^[a-z][a-z\d+\-.]+:/i;
|
|
556
|
+
/**
|
|
557
|
+
* Specifiers that exist only inside a bundler's plugin pipeline — Vite virtual
|
|
558
|
+
* modules (`virtual:pwa-register`), their resolved `\0` form, and URL schemes.
|
|
559
|
+
* Extraction runs without that pipeline, so they can never resolve on disk and
|
|
560
|
+
* reporting them as unresolved is noise.
|
|
561
|
+
*/
|
|
562
|
+
function isExternal(spec) {
|
|
563
|
+
return spec.startsWith("\0") || schemePattern.test(spec);
|
|
564
|
+
}
|
|
555
565
|
function getResolver(dir) {
|
|
556
566
|
const tsconfig = findTsconfig(dir);
|
|
557
567
|
const key = tsconfig ?? "__default__";
|
|
@@ -591,10 +601,15 @@ function resolveImportResults(file, imports) {
|
|
|
591
601
|
const resolver = getResolver(dir);
|
|
592
602
|
const resolved = [];
|
|
593
603
|
const unresolved = [];
|
|
604
|
+
const external = [];
|
|
594
605
|
for (const imp of imports) {
|
|
595
606
|
const ref = normalizeImportReference(imp);
|
|
596
607
|
const { spec } = ref;
|
|
597
608
|
if (isBuiltin(spec)) continue;
|
|
609
|
+
if (isExternal(spec)) {
|
|
610
|
+
external.push(spec);
|
|
611
|
+
continue;
|
|
612
|
+
}
|
|
598
613
|
try {
|
|
599
614
|
const res = resolver.sync(dir, spec);
|
|
600
615
|
if (res.path) resolved.push({
|
|
@@ -617,7 +632,8 @@ function resolveImportResults(file, imports) {
|
|
|
617
632
|
}
|
|
618
633
|
return {
|
|
619
634
|
resolved,
|
|
620
|
-
unresolved
|
|
635
|
+
unresolved,
|
|
636
|
+
external
|
|
621
637
|
};
|
|
622
638
|
}
|
|
623
639
|
//#endregion
|
|
@@ -628,6 +644,12 @@ function core() {
|
|
|
628
644
|
name: "core",
|
|
629
645
|
setup(build) {
|
|
630
646
|
build.context.logger?.debug("core plugin initialized");
|
|
647
|
+
const reported = /* @__PURE__ */ new Set();
|
|
648
|
+
const warnOnce = (message) => {
|
|
649
|
+
if (reported.has(message)) return;
|
|
650
|
+
reported.add(message);
|
|
651
|
+
build.context.logger?.warn(message);
|
|
652
|
+
};
|
|
631
653
|
build.onLoad(filter$1, ({ path }) => readFile(path, "utf8"));
|
|
632
654
|
build.onProcess(filter$1, ({ entrypoint, path, contents, emit }) => {
|
|
633
655
|
const result = parseSource$1(contents, path);
|
|
@@ -640,7 +662,11 @@ function core() {
|
|
|
640
662
|
}
|
|
641
663
|
const { translations, imports, warnings } = result;
|
|
642
664
|
if (build.context.config.walk) {
|
|
643
|
-
const { resolved, unresolved } = resolveImportResults(path, imports);
|
|
665
|
+
const { resolved, unresolved, external } = resolveImportResults(path, imports);
|
|
666
|
+
for (const spec of external) build.context.logger?.debug({
|
|
667
|
+
path,
|
|
668
|
+
spec
|
|
669
|
+
}, "skipping external import");
|
|
644
670
|
for (const result of resolved) {
|
|
645
671
|
if (build.context.paths.has(result.path)) continue;
|
|
646
672
|
build.source({
|
|
@@ -657,16 +683,57 @@ function core() {
|
|
|
657
683
|
namespace: "source",
|
|
658
684
|
import: imp
|
|
659
685
|
}, build.context.config.exclude)) continue;
|
|
660
|
-
|
|
686
|
+
warnOnce(`Unable to resolve import "${spec}" from ${path}${error ? `: ${error}` : ""}`);
|
|
661
687
|
}
|
|
662
688
|
}
|
|
663
|
-
for (const warning of warnings)
|
|
689
|
+
for (const warning of warnings) warnOnce(`${warning.error} at ${warning.reference}`);
|
|
664
690
|
emit(translations);
|
|
665
691
|
});
|
|
666
692
|
}
|
|
667
693
|
};
|
|
668
694
|
}
|
|
669
695
|
//#endregion
|
|
696
|
+
//#region src/plugins/po/references.ts
|
|
697
|
+
const referencePattern = /^(.*?):(\d+)(?::(\d+))?$/;
|
|
698
|
+
function parseReference(reference) {
|
|
699
|
+
const match = referencePattern.exec(reference);
|
|
700
|
+
if (!match) return {
|
|
701
|
+
path: reference,
|
|
702
|
+
line: -1,
|
|
703
|
+
column: -1
|
|
704
|
+
};
|
|
705
|
+
return {
|
|
706
|
+
path: match[1],
|
|
707
|
+
line: Number(match[2]),
|
|
708
|
+
column: match[3] ? Number(match[3]) : -1
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
function comparePaths(left, right) {
|
|
712
|
+
if (left === right) return 0;
|
|
713
|
+
return left < right ? -1 : 1;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Orders reference comments canonically — by file path, then line, then column —
|
|
717
|
+
* so that a catalog does not record the order in which the module graph happened
|
|
718
|
+
* to be walked.
|
|
719
|
+
*/
|
|
720
|
+
function sortReferences(references) {
|
|
721
|
+
return [...references].map((reference) => ({
|
|
722
|
+
reference,
|
|
723
|
+
parsed: parseReference(reference)
|
|
724
|
+
})).sort((left, right) => {
|
|
725
|
+
const byPath = comparePaths(left.parsed.path, right.parsed.path);
|
|
726
|
+
if (byPath !== 0) return byPath;
|
|
727
|
+
if (left.parsed.line !== right.parsed.line) return left.parsed.line - right.parsed.line;
|
|
728
|
+
if (left.parsed.column !== right.parsed.column) return left.parsed.column - right.parsed.column;
|
|
729
|
+
return comparePaths(left.reference, right.reference);
|
|
730
|
+
}).map(({ reference }) => reference);
|
|
731
|
+
}
|
|
732
|
+
/** Orders message keys (contexts and msgids) canonically. */
|
|
733
|
+
function sortKeys(keys) {
|
|
734
|
+
return [...keys].sort(comparePaths);
|
|
735
|
+
}
|
|
736
|
+
//#endregion
|
|
670
737
|
//#region src/plugins/po/collect.ts
|
|
671
738
|
function collect(source, locale) {
|
|
672
739
|
const translations = { "": {} };
|
|
@@ -693,7 +760,7 @@ function collect(source, locale) {
|
|
|
693
760
|
comments: {
|
|
694
761
|
...existing?.comments,
|
|
695
762
|
...comments,
|
|
696
|
-
reference: refs.size ?
|
|
763
|
+
reference: refs.size ? sortReferences(refs).join("\n") : void 0
|
|
697
764
|
},
|
|
698
765
|
obsolete: existing?.obsolete ?? obsolete
|
|
699
766
|
};
|
|
@@ -780,14 +847,16 @@ function merge(sources, existing, obsolete, locale, generatedAt) {
|
|
|
780
847
|
comments: {
|
|
781
848
|
...existing?.comments,
|
|
782
849
|
...entry.comments,
|
|
783
|
-
reference: refs.size ?
|
|
850
|
+
reference: refs.size ? sortReferences(refs).join("\n") : void 0
|
|
784
851
|
}
|
|
785
852
|
};
|
|
786
853
|
}
|
|
787
854
|
}
|
|
788
|
-
for (const
|
|
855
|
+
for (const ctx of sortKeys(Object.keys(collected))) {
|
|
856
|
+
const msgs = collected[ctx];
|
|
789
857
|
if (!translations[ctx]) translations[ctx] = {};
|
|
790
|
-
for (const
|
|
858
|
+
for (const id of sortKeys(Object.keys(msgs))) {
|
|
859
|
+
const entry = msgs[id];
|
|
791
860
|
const existingEntry = translations[ctx][id] ?? obsoleteTranslations[ctx]?.[id];
|
|
792
861
|
if (existingEntry) {
|
|
793
862
|
entry.msgstr = existingEntry.msgstr;
|
|
@@ -1164,9 +1233,15 @@ function react() {
|
|
|
1164
1233
|
name: "react",
|
|
1165
1234
|
setup(build) {
|
|
1166
1235
|
build.context.logger?.debug("react plugin initialized");
|
|
1236
|
+
const reported = /* @__PURE__ */ new Set();
|
|
1167
1237
|
build.onProcess(filter, ({ path, contents, emit }) => {
|
|
1168
1238
|
const { translations, warnings } = parseSource(contents, path);
|
|
1169
|
-
for (const warning of warnings)
|
|
1239
|
+
for (const warning of warnings) {
|
|
1240
|
+
const message = `${warning.error} at ${warning.reference}`;
|
|
1241
|
+
if (reported.has(message)) continue;
|
|
1242
|
+
reported.add(message);
|
|
1243
|
+
build.context.logger?.warn(message);
|
|
1244
|
+
}
|
|
1170
1245
|
emit(translations);
|
|
1171
1246
|
});
|
|
1172
1247
|
}
|
|
@@ -1982,4 +2057,4 @@ async function run(entrypoint, { config, logger }) {
|
|
|
1982
2057
|
//#endregion
|
|
1983
2058
|
export { cleanup as a, core as i, react as n, po as r, run as t };
|
|
1984
2059
|
|
|
1985
|
-
//# sourceMappingURL=run-
|
|
2060
|
+
//# sourceMappingURL=run-Bv_HcDXZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-Bv_HcDXZ.mjs","names":["messageQuery","allowed","msgCall","msgArg","pluralQuery","queries","messageQuery","pluralQuery","parseSource","queries","fs","filter","parseSource","normalize","#root","#resolve","#finished","#nodes","#dormant","#pending","#wake","#settle","#enqueue","#started","#pump","#reaches","#concurrency","#controller","#finish","#ready","#slotWaiters","#runningCount","#start","#suspendedCount","#complete","#demand","#acquire","#errors","#graph","#parent","#children","#entries","#create","#completions","#prefix","#collect","#allMembers","#attach","#assertOpen","#members","resolvePath"],"sources":["../src/plugins/cleanup/cleanup.ts","../src/plugins/core/queries/comment.ts","../src/plugins/core/queries/entrypoint.ts","../src/plugins/core/queries/import.ts","../src/plugins/core/queries/utils.ts","../src/plugins/core/queries/message.ts","../src/plugins/core/queries/plural-utils.ts","../src/plugins/core/queries/context.ts","../src/plugins/core/queries/gettext.ts","../src/plugins/core/queries/ngettext.ts","../src/plugins/core/queries/npgettext.ts","../src/plugins/core/queries/pgettext.ts","../src/plugins/core/queries/plural.ts","../src/plugins/core/queries/index.ts","../src/plugins/core/parse.ts","../src/plugins/core/resolve.ts","../src/plugins/core/core.ts","../src/plugins/po/references.ts","../src/plugins/po/collect.ts","../src/plugins/po/hasChanges.ts","../src/plugins/po/merge.ts","../src/plugins/po/po.ts","../src/plugins/react/queries/utils.ts","../src/plugins/react/queries/message.ts","../src/plugins/react/queries/plural.ts","../src/plugins/react/queries/index.ts","../src/plugins/react/parse.ts","../src/plugins/react/react.ts","../../graph/dist/index.mjs","../src/plugins/static.ts","../src/run.ts"],"sourcesContent":["import fs from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\n\nimport * as gettextParser from \"gettext-parser\";\n\nimport type { Plugin } from \"../../plugin.ts\";\n\nexport function cleanup(): Plugin {\n return {\n name: \"cleanup\",\n setup(build) {\n build.context.logger?.debug(\"cleanup plugin initialized\");\n\n build.onOutputs(async ({ outputs }) => {\n const generated = new Set(outputs);\n const dirs = new Set(outputs.map((path) => dirname(path)));\n\n for (const dir of dirs) {\n const files = await fs.readdir(dir).catch(() => []);\n for (const file of files.filter((name) => name.endsWith(\".po\"))) {\n const full = join(dir, file);\n const contents = await fs.readFile(full).catch(() => undefined);\n if (!contents) {\n continue;\n }\n const parsed = gettextParser.po.parse(contents);\n const hasTranslations = Object.entries(parsed.translations || {}).some(([ctx, msgs]) =>\n Object.keys(msgs).some((id) => !(ctx === \"\" && id === \"\")),\n );\n if (!hasTranslations && generated.has(full)) {\n await fs.unlink(full);\n }\n if (hasTranslations && !generated.has(full)) {\n build.context.logger?.warn({ path: full }, \"stray translation file\");\n }\n }\n }\n });\n },\n };\n}\n","import { relative } from \"node:path\";\nimport type Parser from \"@keqingmoe/tree-sitter\";\n\nimport type { Context, QuerySpec } from \"./types.ts\";\n\nexport function getReference(node: Parser.SyntaxNode, { path }: Context) {\n const line = node.startPosition.row + 1;\n const rel = relative(process.cwd(), path).replace(/\\\\+/g, \"/\");\n return `${rel}:${line}`;\n}\n\nexport function getComment(node: Parser.SyntaxNode): string {\n const text = node.text;\n if (text.startsWith(\"/*\")) {\n return text\n .slice(2, -2)\n .replace(/^\\s*\\*?\\s*/gm, \"\")\n .trim();\n }\n return text.replace(/^\\/\\/\\s?/, \"\").trim();\n}\n\nexport const withComment = (query: QuerySpec): QuerySpec => ({\n pattern: `(\n\t((comment) @comment)?\n .\n\t(_ ${query.pattern})\n)`,\n extract(match) {\n const result = query.extract(match);\n if (!result?.translation) {\n return result;\n }\n\n const comment = match.captures.find((c) => c.name === \"comment\")?.node;\n if (!comment) {\n return result;\n }\n\n if (comment) {\n result.translation.comments = {\n ...result.translation.comments,\n extracted: getComment(comment),\n };\n }\n\n return result;\n },\n});\n","import type Parser from \"@keqingmoe/tree-sitter\";\nimport { getComment } from \"./comment.ts\";\nimport type { EntrypointSpec } from \"./types.ts\";\n\nconst entrypointCommentPattern = /(?:^|\\s)@?translate-entrypoint(?:\\s|$)/;\n\nexport const entrypointQuery: EntrypointSpec = {\n pattern: `(comment) @comment`,\n extract(match: Parser.QueryMatch): boolean | undefined {\n return match.captures\n .filter((capture) => capture.name === \"comment\")\n .some((capture) => entrypointCommentPattern.test(getComment(capture.node)));\n },\n};\n","import type Parser from \"@keqingmoe/tree-sitter\";\nimport type { ImportReference } from \"../../../plugin.ts\";\nimport type { ImportQuerySpec } from \"./types.ts\";\n\nfunction findImportParent(node: Parser.SyntaxNode): Parser.SyntaxNode | undefined {\n let current: Parser.SyntaxNode | null = node;\n while (current) {\n if (\n current.type === \"import_statement\" ||\n current.type === \"export_statement\" ||\n current.type === \"call_expression\"\n ) {\n return current;\n }\n current = current.parent;\n }\n return undefined;\n}\n\nfunction isTypeOnly(parent: Parser.SyntaxNode | undefined) {\n if (!parent) {\n return false;\n }\n\n const text = parent.text.trimStart();\n return (\n /^import\\s+type\\b/.test(text) ||\n /^export\\s+type\\b/.test(text) ||\n /^export\\s*{\\s*type\\b[^}]*}\\s*from\\b/.test(text)\n );\n}\n\nexport const importQuery: ImportQuerySpec = {\n pattern: `\n [\n (import_statement\n source: (string (string_fragment) @import))\n (export_statement\n source: (string (string_fragment) @import))\n (call_expression\n function: (identifier) @func\n arguments: (arguments (string (string_fragment) @import))\n (#eq? @func \"require\"))\n (call_expression\n function: (member_expression\n object: (identifier) @obj\n property: (property_identifier) @method)\n arguments: (arguments (string (string_fragment) @import))\n (#eq? @obj \"require\")\n (#eq? @method \"resolve\"))\n (call_expression\n function: (import) @dynamic\n arguments: (arguments (string (string_fragment) @import)))\n ]\n `,\n extract(match: Parser.QueryMatch): ImportReference | undefined {\n const node = match.captures.find((c) => c.name === \"import\")?.node;\n if (!node) {\n return undefined;\n }\n\n const parent = findImportParent(node);\n return {\n spec: node.text,\n kind: match.captures.some((c) => c.name === \"dynamic\") ? \"dynamic\" : \"static\",\n typeOnly: isTypeOnly(parent),\n };\n },\n};\n","import type Parser from \"@keqingmoe/tree-sitter\";\n\nexport const callPattern = (fnName: string, args: string, allowMember = true): string => `(\n (call_expression\n function: ${\n allowMember\n ? `[\n (identifier) @func\n (member_expression property: (property_identifier) @func)\n ]`\n : `(identifier) @func`\n }\n arguments: ${args}\n ) @call\n (#eq? @func \"${fnName}\")\n)`;\n\nexport function isDescendant(node: Parser.SyntaxNode, ancestor: Parser.SyntaxNode): boolean {\n let current: Parser.SyntaxNode | null = node;\n while (current) {\n if (current.id === ancestor.id) return true;\n current = current.parent;\n }\n return false;\n}\n","import type Parser from \"@keqingmoe/tree-sitter\";\nimport { withComment } from \"./comment.ts\";\nimport type { MessageMatch, QuerySpec } from \"./types.ts\";\nimport { callPattern } from \"./utils.ts\";\n\nconst notInPlural = (query: QuerySpec): QuerySpec => ({\n pattern: query.pattern,\n extract(match) {\n const result = query.extract(match);\n if (!result?.node) {\n return result;\n }\n\n let parent = result.node.parent;\n\n if (parent && parent.type === \"arguments\") {\n parent = parent.parent;\n }\n\n if (parent && parent.type === \"call_expression\") {\n const fn = parent.childForFieldName(\"function\");\n if (fn) {\n if (\n (fn.type === \"identifier\" &&\n (fn.text === \"plural\" ||\n fn.text === \"ngettext\" ||\n fn.text === \"pgettext\" ||\n fn.text === \"npgettext\")) ||\n (fn.type === \"member_expression\" &&\n [\"plural\", \"ngettext\", \"pgettext\", \"npgettext\"].includes(\n fn.childForFieldName(\"property\")?.text ?? \"\",\n ))\n ) {\n return undefined;\n }\n }\n }\n\n return result;\n },\n});\n\nexport const messageArg = `[\n (string (string_fragment) @msgid)\n (object\n (_)*\n (pair\n key: (property_identifier) @id_key\n value: (string (string_fragment) @id)\n (#eq? @id_key \"id\")\n )?\n (_)*\n (pair\n key: (property_identifier) @msg_key\n value: (string (string_fragment) @message)\n (#eq? @msg_key \"message\")\n )?\n (_)*\n )\n (template_string) @tpl\n]`;\n\nexport const messageArgs = `[ (arguments ${messageArg}) (template_string) @tpl ]`;\n\nexport const extractMessage =\n (name: string) =>\n (match: Parser.QueryMatch): MessageMatch | undefined => {\n const node = match.captures.find((c) => c.name === \"call\")?.node;\n if (!node) {\n return undefined;\n }\n\n const msgid = match.captures.find((c) => c.name === \"msgid\")?.node.text;\n if (msgid) {\n return {\n node,\n translation: {\n id: msgid,\n message: [msgid],\n },\n };\n }\n\n const tpl = match.captures.find((c) => c.name === \"tpl\")?.node;\n if (tpl) {\n for (const child of tpl.children) {\n if (child.type !== \"template_substitution\") {\n continue;\n }\n\n const expr = child.namedChildren[0];\n if (!expr || expr.type !== \"identifier\") {\n return {\n node,\n error: `${name}() template expressions must be simple identifiers`,\n };\n }\n }\n\n const text = tpl.text.slice(1, -1);\n\n return {\n node,\n translation: { id: text, message: [text] },\n };\n }\n\n const id = match.captures.find((c) => c.name === \"id\")?.node.text;\n const message = match.captures.find((c) => c.name === \"message\")?.node.text;\n const msgId = id ?? message;\n if (!msgId) {\n return undefined;\n }\n\n const msgstr = message ?? id ?? \"\";\n\n return {\n node,\n translation: {\n id: msgId,\n message: [msgstr],\n },\n };\n };\n\nexport const messageQuery: QuerySpec = notInPlural(\n withComment({\n pattern: callPattern(\"message\", messageArgs),\n extract: extractMessage(\"message\"),\n }),\n);\n\nconst allowed = new Set([\"string\", \"object\", \"template_string\"]);\n\nexport const messageInvalidQuery: QuerySpec = notInPlural({\n pattern: callPattern(\"message\", \"(arguments (_) @arg)\"),\n extract(match) {\n const call = match.captures.find((c) => c.name === \"call\")?.node;\n const node = match.captures.find((c) => c.name === \"arg\")?.node;\n\n if (!call || !node) {\n return undefined;\n }\n\n if (allowed.has(node.type)) {\n return undefined;\n }\n\n return {\n node,\n error: \"message() argument must be a string literal, object literal, or template literal\",\n };\n },\n});\n","import type Parser from \"@keqingmoe/tree-sitter\";\nimport { extractMessage } from \"./message.ts\";\nimport type { MessageMatch, Translation } from \"./types.ts\";\nimport { isDescendant } from \"./utils.ts\";\n\nexport const extractPluralForms =\n (name: string) =>\n (match: Parser.QueryMatch): MessageMatch | undefined => {\n const call = match.captures.find((c) => c.name === \"call\")?.node;\n const n = match.captures.find((c) => c.name === \"n\")?.node;\n if (!call || !n || n.nextNamedSibling) {\n return undefined;\n }\n\n const msgctxt = match.captures.find((c) => c.name === \"msgctxt\")?.node?.text;\n const msgNodes = match.captures.filter((c) => c.name === \"msg\").map((c) => c.node);\n\n const ids: string[] = [];\n const strs: string[] = [];\n\n for (const node of msgNodes) {\n const relevant = match.captures.filter(\n (c) => [\"msgid\", \"id\", \"message\", \"tpl\"].includes(c.name) && isDescendant(c.node, node),\n );\n\n const subMatch: Parser.QueryMatch = {\n pattern: 0,\n captures: [{ name: \"call\", node }, ...relevant],\n };\n\n const result = extractMessage(name)(subMatch);\n if (!result) continue;\n if (result.error) {\n return { node: call, error: result.error };\n }\n if (result.translation) {\n ids.push(result.translation.id);\n strs.push(result.translation.message[0] ?? \"\");\n }\n }\n\n if (ids.length === 0) {\n return undefined;\n }\n\n const translation: Translation = {\n id: ids[0],\n plural: ids[1],\n message: strs,\n };\n if (msgctxt) translation.context = msgctxt;\n\n return { node: call, translation };\n };\n","import { withComment } from \"./comment.ts\";\nimport { extractMessage, messageArgs } from \"./message.ts\";\nimport { extractPluralForms } from \"./plural-utils.ts\";\nimport type { QuerySpec } from \"./types.ts\";\nimport { callPattern } from \"./utils.ts\";\n\nconst ctxCall = callPattern(\n \"context\",\n `[\n (arguments (string (string_fragment) @msgctxt))\n (template_string) @msgctxt\n]`,\n)\n .replace(/@call/g, \"@ctx\")\n .replace(/@func/g, \"@ctxfn\");\n\nexport const contextMsgQuery: QuerySpec = withComment({\n pattern: `(\n (call_expression\n function: (member_expression\n object: ${ctxCall}\n property: (property_identifier) @func\n )\n arguments: ${messageArgs}\n ) @call\n (#eq? @func \"message\")\n)`,\n extract(match) {\n const result = extractMessage(\"context.message\")(match);\n const contextNode = match.captures.find((c) => c.name === \"msgctxt\")?.node;\n if (!result || !result.translation || !contextNode) {\n return result;\n }\n\n if (contextNode.type === \"template_string\") {\n for (const child of contextNode.children) {\n if (child.type !== \"template_substitution\") {\n continue;\n }\n\n const expr = child.namedChildren[0];\n if (!expr || expr.type !== \"identifier\") {\n return {\n node: contextNode,\n error: \"context() template expressions must be simple identifiers\",\n };\n }\n }\n }\n\n const contextText = contextNode.type === \"template_string\" ? contextNode.text.slice(1, -1) : contextNode.text;\n return {\n node: result.node,\n translation: {\n ...result.translation,\n context: contextText,\n },\n };\n },\n});\n\nconst msgCall = callPattern(\"message\", messageArgs, false).replace(/@call/g, \"@msg\").replace(/@func/g, \"@msgfn\");\n\nexport const contextPluralQuery: QuerySpec = withComment({\n pattern: `(\n (call_expression\n function: (member_expression\n object: ${ctxCall}\n property: (property_identifier) @func\n )\n arguments: (arguments (\n (${msgCall} (\",\" )?)+\n (number) @n\n ))\n ) @call\n (#eq? @func \"plural\")\n)`,\n extract: extractPluralForms(\"context.plural\"),\n});\n\nexport const contextInvalidQuery: QuerySpec = withComment({\n pattern: ctxCall,\n extract(match) {\n const call = match.captures.find((c) => c.name === \"ctx\")?.node;\n if (!call) {\n return undefined;\n }\n\n const parent = call.parent;\n if (parent && parent.type === \"member_expression\" && parent.childForFieldName(\"object\")?.id === call.id) {\n const property = parent.childForFieldName(\"property\")?.text;\n const grandparent = parent.parent;\n if (\n grandparent &&\n grandparent.type === \"call_expression\" &&\n grandparent.childForFieldName(\"function\")?.id === parent.id &&\n (property === \"message\" || property === \"plural\")\n ) {\n return undefined;\n }\n }\n\n return {\n node: call,\n error: \"context() must be used with message() or plural() in the same expression\",\n };\n },\n});\n","import { withComment } from \"./comment.ts\";\nimport { extractMessage, messageArgs } from \"./message.ts\";\nimport type { QuerySpec } from \"./types.ts\";\nimport { callPattern } from \"./utils.ts\";\n\nexport const gettextQuery: QuerySpec = withComment({\n pattern: callPattern(\"gettext\", messageArgs),\n extract: extractMessage(\"gettext\"),\n});\n\nconst allowed = new Set([\"string\", \"object\", \"template_string\", \"identifier\", \"call_expression\"]);\n\nexport const gettextInvalidQuery: QuerySpec = {\n pattern: callPattern(\"gettext\", \"(arguments (_) @arg)\"),\n extract(match) {\n const call = match.captures.find((c) => c.name === \"call\")?.node;\n const node = match.captures.find((c) => c.name === \"arg\")?.node;\n\n if (!call || !node) {\n return undefined;\n }\n\n if (allowed.has(node.type)) {\n return undefined;\n }\n\n return {\n node,\n error: \"gettext() argument must be a string literal, object literal, or template literal\",\n };\n },\n};\n","import { withComment } from \"./comment.ts\";\nimport { messageArg, messageArgs } from \"./message.ts\";\nimport { extractPluralForms } from \"./plural-utils.ts\";\nimport type { QuerySpec } from \"./types.ts\";\nimport { callPattern } from \"./utils.ts\";\n\nconst msgCall = callPattern(\"message\", messageArgs).replace(/@call/g, \"@msg\").replace(/@func/g, \"@msgfn\");\nconst plainMsg = `(${messageArg}) @msg`;\nconst msgArg = `[${msgCall} ${plainMsg}]`;\n\nexport const ngettextQuery: QuerySpec = withComment({\n pattern: callPattern(\"ngettext\", `(arguments ${msgArg} \",\" ${msgArg} (\",\" ${msgArg})* \",\" (_) @n)`),\n extract: extractPluralForms(\"ngettext\"),\n});\n","import { withComment } from \"./comment.ts\";\nimport { messageArg, messageArgs } from \"./message.ts\";\nimport { extractPluralForms } from \"./plural-utils.ts\";\nimport type { QuerySpec } from \"./types.ts\";\nimport { callPattern } from \"./utils.ts\";\n\nconst msgCall = callPattern(\"message\", messageArgs).replace(/@call/g, \"@msg\").replace(/@func/g, \"@msgfn\");\nconst plainMsg = `(${messageArg}) @msg`;\nconst msgArg = `[${msgCall} ${plainMsg}]`;\n\nexport const npgettextQuery: QuerySpec = withComment({\n pattern: callPattern(\n \"npgettext\",\n `(arguments (string (string_fragment) @msgctxt) \",\" ${msgArg} \",\" ${msgArg} (\",\" ${msgArg})* \",\" (_) @n)`,\n ),\n extract: extractPluralForms(\"npgettext\"),\n});\n","import { withComment } from \"./comment.ts\";\nimport { extractMessage, messageArg } from \"./message.ts\";\nimport type { QuerySpec } from \"./types.ts\";\nimport { callPattern } from \"./utils.ts\";\n\nexport const pgettextQuery: QuerySpec = withComment({\n pattern: callPattern(\"pgettext\", `(arguments (string (string_fragment) @msgctxt) \",\" ${messageArg})`),\n extract(match) {\n const result = extractMessage(\"pgettext\")(match);\n const contextNode = match.captures.find((c) => c.name === \"msgctxt\")?.node;\n if (!result || !contextNode || !result.translation) {\n return result;\n }\n return {\n node: result.node,\n translation: {\n ...result.translation,\n context: contextNode.text,\n },\n };\n },\n});\n","import { withComment } from \"./comment.ts\";\nimport { messageArgs } from \"./message.ts\";\nimport { extractPluralForms } from \"./plural-utils.ts\";\nimport type { QuerySpec } from \"./types.ts\";\nimport { callPattern } from \"./utils.ts\";\n\nconst msgCall = callPattern(\"message\", messageArgs, false).replace(/@call/g, \"@msg\").replace(/@func/g, \"@msgfn\");\n\nexport const pluralQuery: QuerySpec = withComment({\n pattern: callPattern(\n \"plural\",\n `(arguments (\n (${msgCall} (\",\" )?)+\n (number) @n\n ))`,\n false,\n ),\n extract: extractPluralForms(\"plural\"),\n});\n","import { contextInvalidQuery, contextMsgQuery, contextPluralQuery } from \"./context.ts\";\nimport { gettextInvalidQuery, gettextQuery } from \"./gettext.ts\";\nimport { messageInvalidQuery, messageQuery } from \"./message.ts\";\nimport { ngettextQuery } from \"./ngettext.ts\";\nimport { npgettextQuery } from \"./npgettext.ts\";\nimport { pgettextQuery } from \"./pgettext.ts\";\nimport { pluralQuery } from \"./plural.ts\";\nimport type { QuerySpec } from \"./types.ts\";\n\nexport type { MessageMatch, QuerySpec } from \"./types.ts\";\n\nexport const queries: QuerySpec[] = [\n contextMsgQuery,\n contextPluralQuery,\n contextInvalidQuery,\n messageQuery,\n messageInvalidQuery,\n gettextQuery,\n gettextInvalidQuery,\n pluralQuery,\n ngettextQuery,\n pgettextQuery,\n npgettextQuery,\n];\n","import fs from \"node:fs\";\nimport { extname, resolve } from \"node:path\";\n\nimport Parser from \"@keqingmoe/tree-sitter\";\nimport JavaScript from \"tree-sitter-javascript\";\nimport TS from \"tree-sitter-typescript\";\n\nimport type { ImportReference } from \"../../plugin.ts\";\nimport { getReference } from \"./queries/comment.ts\";\nimport { entrypointQuery } from \"./queries/entrypoint.ts\";\nimport { importQuery } from \"./queries/import.ts\";\nimport { queries } from \"./queries/index.ts\";\nimport type { Context, Translation, Warning } from \"./queries/types.ts\";\n\nexport interface ParseResult {\n translations: Translation[];\n imports: ImportReference[];\n warnings: Warning[];\n entrypoint: boolean;\n}\n\nfunction getLanguage(ext: string) {\n switch (ext) {\n case \".ts\":\n return TS.typescript;\n case \".tsx\":\n return TS.tsx;\n default:\n return JavaScript;\n }\n}\n\nconst parserCache = new Map<string, { parser: Parser; language: Parser.Language }>();\nconst queryCache = new WeakMap<Parser.Language, Map<string, Parser.Query>>();\n\nfunction getCachedParser(ext: string) {\n let cached = parserCache.get(ext);\n if (!cached) {\n const parser = new Parser();\n const language = getLanguage(ext) as Parser.Language;\n parser.setLanguage(language);\n cached = { parser, language };\n parserCache.set(ext, cached);\n }\n return cached;\n}\n\nfunction getCachedQuery(language: Parser.Language, pattern: string) {\n let cache = queryCache.get(language);\n if (!cache) {\n cache = new Map();\n queryCache.set(language, cache);\n }\n\n let query = cache.get(pattern);\n if (!query) {\n query = new Parser.Query(language, pattern);\n cache.set(pattern, query);\n }\n\n return query;\n}\n\nexport function getParser(path: string) {\n const ext = extname(path);\n return getCachedParser(ext);\n}\n\nexport function getQuery(language: Parser.Language, pattern: string) {\n return getCachedQuery(language, pattern);\n}\n\nexport function parseFile(filePath: string): ParseResult {\n const path = resolve(filePath);\n const source = fs.readFileSync(path, \"utf8\");\n return parseSource(source, path);\n}\n\nexport function parseSource(source: string, path: string): ParseResult {\n const context: Context = {\n path,\n };\n\n const { parser, language } = getParser(path);\n const tree = parser.parse(source);\n\n const commentQuery = getCachedQuery(language, entrypointQuery.pattern);\n const entrypoint = commentQuery.matches(tree.rootNode).some(entrypointQuery.extract);\n\n const translations: Translation[] = [];\n const warnings: Warning[] = [];\n const imports: ImportReference[] = [];\n\n const seen = new Set<number>();\n\n for (const spec of queries) {\n const query = getCachedQuery(language, spec.pattern);\n for (const match of query.matches(tree.rootNode)) {\n const message = spec.extract(match);\n if (!message) {\n continue;\n }\n\n const { node, translation, error } = message;\n if (seen.has(node.id)) {\n continue;\n }\n seen.add(node.id);\n const reference = getReference(node, context);\n\n if (translation) {\n translations.push({\n ...translation,\n comments: {\n ...translation.comments,\n reference,\n },\n });\n }\n\n if (error) {\n warnings.push({\n error,\n reference,\n });\n }\n }\n }\n\n const importTreeQuery = getCachedQuery(language, importQuery.pattern);\n for (const match of importTreeQuery.matches(tree.rootNode)) {\n const imp = importQuery.extract(match);\n if (imp) {\n imports.push(imp);\n }\n }\n\n return { translations, imports, warnings, entrypoint };\n}\n","import fs from \"node:fs\";\nimport { builtinModules } from \"node:module\";\nimport path from \"node:path\";\nimport { ResolverFactory } from \"oxc-resolver\";\nimport type { ImportReference } from \"../../plugin.ts\";\n\nexport interface UnresolvedImport {\n spec: string;\n error?: string;\n}\n\nexport interface ResolveImportsResult {\n resolved: Array<{ path: string; import: ImportReference }>;\n unresolved: UnresolvedImport[];\n /** Specifiers only a bundler plugin pipeline can resolve; skipped without a warning. */\n external: string[];\n}\n\nfunction findTsconfig(dir: string): string | undefined {\n let current = dir;\n while (true) {\n const config = path.join(current, \"tsconfig.json\");\n if (fs.existsSync(config)) {\n return config;\n }\n const parent = path.dirname(current);\n if (parent === current) {\n return undefined;\n }\n current = parent;\n }\n}\n\nconst resolverCache = new Map<string, ResolverFactory>();\nconst builtins = new Set([...builtinModules, ...builtinModules.map((name) => `node:${name}`)]);\n\nfunction isBuiltin(spec: string) {\n if (builtins.has(spec)) {\n return true;\n }\n\n const withoutNodePrefix = spec.startsWith(\"node:\") ? spec.slice(\"node:\".length) : spec;\n const [base, subpath] = withoutNodePrefix.split(\"/\", 2);\n return subpath !== undefined && builtins.has(base);\n}\n\n// Two or more characters, so a Windows drive letter (\"C:/app/main.ts\") is not\n// mistaken for a URI scheme.\nconst schemePattern = /^[a-z][a-z\\d+\\-.]+:/i;\n\n/**\n * Specifiers that exist only inside a bundler's plugin pipeline — Vite virtual\n * modules (`virtual:pwa-register`), their resolved `\\0` form, and URL schemes.\n * Extraction runs without that pipeline, so they can never resolve on disk and\n * reporting them as unresolved is noise.\n */\nexport function isExternal(spec: string) {\n return spec.startsWith(\"\\0\") || schemePattern.test(spec);\n}\n\nfunction getResolver(dir: string) {\n const tsconfig = findTsconfig(dir);\n const key = tsconfig ?? \"__default__\";\n let resolver = resolverCache.get(key);\n if (!resolver) {\n resolver = new ResolverFactory({\n extensions: [\".ts\", \".tsx\", \".js\", \".jsx\", \".mjs\", \".cjs\", \".json\"],\n conditionNames: [\"import\", \"require\", \"node\"],\n ...(tsconfig ? { tsconfig: { configFile: tsconfig } } : {}),\n });\n resolverCache.set(key, resolver);\n }\n return resolver;\n}\n\nfunction resolveFromDir(dir: string, spec: string): string | undefined {\n const resolver = getResolver(dir);\n const res = resolver.sync(dir, spec) as { path?: string };\n return res.path;\n}\n\nexport function resolveImport(file: string, spec: string): string | undefined {\n if (isBuiltin(spec) || isExternal(spec)) {\n return undefined;\n }\n\n const dir = path.dirname(path.resolve(file));\n try {\n return resolveFromDir(dir, spec);\n } catch {\n return undefined;\n }\n}\n\nexport function resolveImports(file: string, imports: Array<string | ImportReference>): string[] {\n return resolveImportResults(file, imports).resolved.map((result) => result.path);\n}\n\nfunction normalizeImportReference(imp: string | ImportReference): ImportReference {\n if (typeof imp === \"string\") {\n return { spec: imp, kind: \"static\", typeOnly: false };\n }\n return imp;\n}\n\nexport function resolveImportResults(file: string, imports: Array<string | ImportReference>): ResolveImportsResult {\n const dir = path.dirname(path.resolve(file));\n const resolver = getResolver(dir);\n const resolved: Array<{ path: string; import: ImportReference }> = [];\n const unresolved: UnresolvedImport[] = [];\n const external: string[] = [];\n\n for (const imp of imports) {\n const ref = normalizeImportReference(imp);\n const { spec } = ref;\n if (isBuiltin(spec)) {\n continue;\n }\n if (isExternal(spec)) {\n external.push(spec);\n continue;\n }\n\n try {\n const res = resolver.sync(dir, spec) as { error?: string; path?: string };\n if (res.path) {\n resolved.push({ path: res.path, import: { ...ref, spec: res.path } });\n } else {\n unresolved.push({ spec, error: res.error });\n }\n } catch (error) {\n unresolved.push({\n spec,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n return { resolved, unresolved, external };\n}\n","import { readFile } from \"node:fs/promises\";\n\nimport { isExcluded } from \"../../exclude.ts\";\nimport type { Plugin } from \"../../plugin.ts\";\nimport { parseSource } from \"./parse.ts\";\nimport { resolveImportResults } from \"./resolve.ts\";\n\nconst filter = /\\.([cm]?tsx?|jsx?)$/;\n\nexport function core(): Plugin {\n return {\n name: \"core\",\n setup(build) {\n build.context.logger?.debug(\"core plugin initialized\");\n\n // A module shared by several entrypoints is processed once per\n // entrypoint, so without this the same warning is repeated as many\n // times as there are entrypoints reaching it.\n const reported = new Set<string>();\n const warnOnce = (message: string) => {\n if (reported.has(message)) {\n return;\n }\n reported.add(message);\n build.context.logger?.warn(message);\n };\n\n build.onLoad(filter, ({ path }) => readFile(path, \"utf8\"));\n\n build.onProcess(filter, ({ entrypoint, path, contents, emit }) => {\n const result = parseSource(contents, path);\n\n if (result.entrypoint && entrypoint !== path) {\n // Promote to its own extraction pipeline and keep its\n // messages out of the current entrypoint.\n build.source({ entrypoint: path, path });\n return true;\n }\n\n const { translations, imports, warnings } = result;\n\n if (build.context.config.walk) {\n const { resolved, unresolved, external } = resolveImportResults(path, imports);\n for (const spec of external) {\n build.context.logger?.debug({ path, spec }, \"skipping external import\");\n }\n for (const result of resolved) {\n if (build.context.paths.has(result.path)) {\n continue;\n }\n\n build.source({ entrypoint, path: result.path, import: result.import });\n }\n for (const { spec, error } of unresolved) {\n const imp = imports.find((imp) => imp.spec === spec);\n if (\n imp &&\n isExcluded(\n { entrypoint, path: spec, namespace: \"source\", import: imp },\n build.context.config.exclude,\n )\n ) {\n continue;\n }\n warnOnce(`Unable to resolve import \"${spec}\" from ${path}${error ? `: ${error}` : \"\"}`);\n }\n }\n\n for (const warning of warnings) {\n warnOnce(`${warning.error} at ${warning.reference}`);\n }\n\n emit(translations);\n return undefined;\n });\n },\n };\n}\n","/** A reference comment, split into the parts that order it. */\ninterface ParsedReference {\n path: string;\n line: number;\n column: number;\n}\n\nconst referencePattern = /^(.*?):(\\d+)(?::(\\d+))?$/;\n\nfunction parseReference(reference: string): ParsedReference {\n const match = referencePattern.exec(reference);\n if (!match) {\n return { path: reference, line: -1, column: -1 };\n }\n return { path: match[1], line: Number(match[2]), column: match[3] ? Number(match[3]) : -1 };\n}\n\nfunction comparePaths(left: string, right: string) {\n // Code unit order rather than localeCompare: the result must not depend on\n // the machine's locale.\n if (left === right) return 0;\n return left < right ? -1 : 1;\n}\n\n/**\n * Orders reference comments canonically — by file path, then line, then column —\n * so that a catalog does not record the order in which the module graph happened\n * to be walked.\n */\nexport function sortReferences(references: Iterable<string>): string[] {\n return [...references]\n .map((reference) => ({ reference, parsed: parseReference(reference) }))\n .sort((left, right) => {\n const byPath = comparePaths(left.parsed.path, right.parsed.path);\n if (byPath !== 0) return byPath;\n if (left.parsed.line !== right.parsed.line) return left.parsed.line - right.parsed.line;\n if (left.parsed.column !== right.parsed.column) return left.parsed.column - right.parsed.column;\n return comparePaths(left.reference, right.reference);\n })\n .map(({ reference }) => reference);\n}\n\n/** Orders message keys (contexts and msgids) canonically. */\nexport function sortKeys(keys: Iterable<string>): string[] {\n return [...keys].sort(comparePaths);\n}\n","import type { GetTextTranslationRecord } from \"gettext-parser\";\nimport { getNPlurals } from \"plural-forms\";\n\nimport type { Translation } from \"../core/queries/types.ts\";\nimport { sortReferences } from \"./references.ts\";\n\nexport function collect(source: Translation[], locale?: string): GetTextTranslationRecord {\n const translations: GetTextTranslationRecord = { \"\": {} };\n const nplurals = locale ? Number(getNPlurals(locale)) : undefined;\n\n for (const { context, id, message, comments, obsolete, plural } of source) {\n const ctx = context || \"\";\n if (!translations[ctx]) {\n translations[ctx] = {};\n }\n\n const length = plural ? (nplurals ?? message.length) : 1;\n\n const existing = translations[ctx][id];\n const refs = new Set<string>();\n if (existing?.comments?.reference) {\n existing.comments.reference.split(/\\r?\\n|\\r/).forEach((r) => {\n refs.add(r);\n });\n }\n if (comments?.reference) {\n comments.reference.split(/\\r?\\n|\\r/).forEach((r) => {\n refs.add(r);\n });\n }\n\n const msgstr = existing?.msgstr ? existing.msgstr.slice(0, length) : Array.from({ length }, () => \"\");\n while (msgstr.length < length) msgstr.push(\"\");\n\n translations[ctx][id] = {\n msgctxt: context || undefined,\n msgid: id,\n msgid_plural: plural,\n msgstr,\n comments: {\n ...existing?.comments,\n ...comments,\n reference: refs.size ? sortReferences(refs).join(\"\\n\") : undefined,\n },\n obsolete: existing?.obsolete ?? obsolete,\n };\n }\n\n return translations;\n}\n","import { isDeepStrictEqual } from \"node:util\";\nimport type { GetTextTranslations } from \"gettext-parser\";\nimport * as gettextParser from \"gettext-parser\";\n\nconst IGNORED_HEADER_KEYS = new Set([\"pot-creation-date\", \"po-revision-date\"]);\nconst IGNORED_HEADER_LINE_PREFIXES = [\"pot-creation-date:\", \"po-revision-date:\"];\n\nfunction normalizeHeaderString(value: string): string {\n const lines = value.split(\"\\n\");\n const hadTrailingNewline = value.endsWith(\"\\n\");\n\n const filtered = lines\n .filter((line) => {\n const trimmed = line.trimStart().toLowerCase();\n return !IGNORED_HEADER_LINE_PREFIXES.some((prefix) => trimmed.startsWith(prefix));\n })\n .map((line) => {\n const separatorIndex = line.indexOf(\":\");\n if (separatorIndex === -1) {\n return line;\n }\n\n const key = line.slice(0, separatorIndex).trim().toLowerCase();\n const value = line.slice(separatorIndex + 1);\n return `${key}:${value}`;\n });\n\n if (hadTrailingNewline && filtered[filtered.length - 1] !== \"\") {\n filtered.push(\"\");\n }\n\n return filtered.join(\"\\n\");\n}\n\nfunction normalize(translations: GetTextTranslations): GetTextTranslations {\n const compiled = gettextParser.po.compile(translations);\n const parsed = gettextParser.po.parse(compiled);\n\n if (parsed.headers) {\n const normalizedHeaders: Record<string, string> = {};\n for (const [key, value] of Object.entries(parsed.headers)) {\n if (!IGNORED_HEADER_KEYS.has(key.toLowerCase())) {\n normalizedHeaders[key.toLowerCase()] = value as string;\n }\n }\n parsed.headers = normalizedHeaders;\n }\n\n const headerMessage = parsed.translations?.[\"\"]?.[\"\"];\n if (headerMessage?.msgstr) {\n headerMessage.msgstr = headerMessage.msgstr.map((item) => normalizeHeaderString(item));\n }\n\n return parsed;\n}\n\nexport function hasChanges(left: GetTextTranslations, right?: GetTextTranslations): boolean {\n if (!right) {\n return true;\n }\n\n const normalizedLeft = normalize(left);\n const normalizedRight = normalize(right);\n\n return !isDeepStrictEqual(normalizedLeft, normalizedRight);\n}\n","import type { GetTextTranslationRecord, GetTextTranslations } from \"gettext-parser\";\nimport { getFormula, getNPlurals } from \"plural-forms\";\n\nimport type { ObsoleteStrategy } from \"../../configuration.ts\";\nimport { sortKeys, sortReferences } from \"./references.ts\";\n\nexport interface Collected {\n translations: GetTextTranslationRecord;\n}\n\nexport function formatDate(date: Date): string {\n const pad = (n: number) => n.toString().padStart(2, \"0\");\n const year = date.getFullYear();\n const month = pad(date.getMonth() + 1);\n const day = pad(date.getDate());\n const hours = pad(date.getHours());\n const minutes = pad(date.getMinutes());\n const tzo = -date.getTimezoneOffset();\n const sign = tzo >= 0 ? \"+\" : \"-\";\n const offsetHours = pad(Math.floor(Math.abs(tzo) / 60));\n const offsetMinutes = pad(Math.abs(tzo) % 60);\n return `${year}-${month}-${day} ${hours}:${minutes}${sign}${offsetHours}${offsetMinutes}`;\n}\n\nexport function merge(\n sources: Collected[],\n existing: GetTextTranslations | undefined,\n obsolete: ObsoleteStrategy,\n locale: string,\n generatedAt: Date,\n): GetTextTranslations {\n let headers: Record<string, string> = {};\n let translations: GetTextTranslationRecord = { \"\": {} };\n let obsoleteTranslations: GetTextTranslationRecord = {};\n const nplurals = Number(getNPlurals(locale));\n\n if (existing) {\n headers = existing.headers ? structuredClone(existing.headers) : {};\n translations = existing.translations ? structuredClone(existing.translations) : { \"\": {} };\n obsoleteTranslations = existing.obsolete ? structuredClone(existing.obsolete) : {};\n for (const ctx of Object.keys(translations)) {\n for (const id of Object.keys(translations[ctx])) {\n if (ctx === \"\" && id === \"\") continue;\n translations[ctx][id].obsolete = true;\n }\n }\n }\n\n const collected: GetTextTranslationRecord = { \"\": {} };\n for (const { translations } of sources) {\n for (const [ctx, msgs] of Object.entries(translations)) {\n if (!collected[ctx]) collected[ctx] = {};\n for (const [id, entry] of Object.entries(msgs)) {\n const existing = collected[ctx][id];\n const refs = new Set<string>();\n if (existing?.comments?.reference) {\n existing.comments.reference.split(/\\r?\\n|\\r/).forEach((r) => {\n refs.add(r);\n });\n }\n if (entry.comments?.reference) {\n entry.comments.reference.split(/\\r?\\n|\\r/).forEach((r) => {\n refs.add(r);\n });\n }\n collected[ctx][id] = {\n ...existing,\n ...entry,\n comments: {\n ...existing?.comments,\n ...entry.comments,\n reference: refs.size ? sortReferences(refs).join(\"\\n\") : undefined,\n },\n };\n }\n }\n }\n\n // Canonical key order, so that messages an existing catalog does not have\n // yet are appended in a stable order instead of the order the module graph\n // happened to be walked in. Keys the catalog already has keep their place:\n // assigning to an existing key does not move it.\n for (const ctx of sortKeys(Object.keys(collected))) {\n const msgs = collected[ctx];\n if (!translations[ctx]) translations[ctx] = {};\n for (const id of sortKeys(Object.keys(msgs))) {\n const entry = msgs[id];\n const existingEntry = translations[ctx][id] ?? obsoleteTranslations[ctx]?.[id];\n if (existingEntry) {\n entry.msgstr = existingEntry.msgstr;\n entry.comments = {\n ...entry.comments,\n translator: existingEntry.comments?.translator,\n };\n }\n delete entry.obsolete;\n entry.msgstr = entry.msgstr.slice(0, nplurals);\n while (entry.msgstr.length < nplurals) {\n entry.msgstr.push(\"\");\n }\n translations[ctx][id] = entry;\n if (obsoleteTranslations[ctx]) {\n delete obsoleteTranslations[ctx][id];\n }\n }\n }\n\n for (const ctx of Object.keys(translations)) {\n for (const id of Object.keys(translations[ctx])) {\n if (ctx === \"\" && id === \"\") {\n continue;\n }\n const entry = translations[ctx][id];\n if (entry.obsolete) {\n if (!obsoleteTranslations[ctx]) {\n obsoleteTranslations[ctx] = {};\n }\n obsoleteTranslations[ctx][id] = entry;\n delete translations[ctx][id];\n }\n }\n }\n\n headers = {\n ...headers,\n \"Content-Type\": headers[\"Content-Type\"] || \"text/plain; charset=UTF-8\",\n \"Plural-Forms\": `nplurals=${nplurals}; plural=${getFormula(locale)};`,\n language: locale,\n \"MIME-Version\": \"1.0\",\n \"Content-Transfer-Encoding\": \"8bit\",\n \"POT-Creation-Date\": formatDate(generatedAt),\n \"x-generator\": \"@let-value/translate-extract\",\n };\n\n return {\n charset: \"utf-8\",\n headers,\n translations,\n ...(obsolete === \"mark\" && Object.keys(obsoleteTranslations).length ? { obsolete: obsoleteTranslations } : {}),\n };\n}\n","import fs from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport * as gettextParser from \"gettext-parser\";\n\nimport type { Plugin } from \"../../plugin.ts\";\nimport type { Translation } from \"../core/queries/types.ts\";\nimport { collect } from \"./collect.ts\";\nimport { hasChanges } from \"./hasChanges.ts\";\nimport { merge } from \"./merge.ts\";\n\nexport function po(): Plugin {\n return {\n name: \"po\",\n setup(build) {\n build.context.logger?.debug(\"po plugin initialized\");\n\n // Several entrypoints can map to the same destination file, so\n // collection spans the whole run rather than a single entrypoint:\n // one .po is written from every translation that targets it, and a\n // later entrypoint never re-merges the file against a subset of its\n // own messages (which would obsolete or drop the others').\n // Every onCollected hook runs before any writer does, so a writer\n // registered by the first entrypoint still sees the complete set.\n const collections = new Map<string, { locale: string; translations: Translation[] }>();\n\n build.onCollected(({ entrypoint, files, output }) => {\n for (const { path, translations } of files) {\n for (const locale of build.context.config.locales) {\n const destination = build.context.config.destination({ entrypoint, locale, path });\n const collection = collections.get(destination);\n if (collection) {\n collection.translations.push(...translations);\n continue;\n }\n\n const created = { locale, translations: [...translations] };\n collections.set(destination, created);\n\n output(destination, async () => {\n const contents = await fs.readFile(destination).catch(() => undefined);\n const existing = contents ? gettextParser.po.parse(contents) : undefined;\n\n const record = collect(created.translations, created.locale);\n const out = merge(\n [{ translations: record }],\n existing as never,\n build.context.config.obsolete,\n created.locale,\n build.context.generatedAt,\n );\n\n if (hasChanges(out, existing as never)) {\n await fs.mkdir(dirname(destination), { recursive: true });\n await fs.writeFile(destination, gettextParser.po.compile(out));\n }\n });\n }\n }\n });\n },\n };\n}\n","import type Parser from \"@keqingmoe/tree-sitter\";\n\nexport function buildTemplate(node: Parser.SyntaxNode): { text: string; error?: string } {\n const source = node.tree.rootNode.text;\n const open = node.childForFieldName(\"open_tag\");\n const close = node.childForFieldName(\"close_tag\");\n const contentStart = open?.endIndex ?? node.startIndex;\n const contentEnd = close?.startIndex ?? node.endIndex;\n\n type Part = { kind: \"text\"; text: string; raw: boolean } | { kind: \"expr\"; value: string };\n\n const parts: Part[] = [];\n let segmentStart = contentStart;\n\n const pushRawText = (endIndex: number) => {\n if (endIndex <= segmentStart) {\n segmentStart = Math.max(segmentStart, endIndex);\n return;\n }\n const text = source.slice(segmentStart, endIndex);\n if (text) {\n parts.push({ kind: \"text\", text, raw: true });\n }\n segmentStart = endIndex;\n };\n\n const children = node.namedChildren.slice(1, -1);\n for (const child of children) {\n if (child.type === \"jsx_expression\") {\n pushRawText(child.startIndex);\n const expr = child.namedChildren[0];\n if (!expr) {\n return { text: \"\", error: \"Empty JSX expression\" };\n }\n\n if (expr.type === \"identifier\") {\n parts.push({ kind: \"expr\", value: expr.text });\n } else if (expr.type === \"string\") {\n parts.push({ kind: \"text\", text: expr.text.slice(1, -1), raw: false });\n } else if (expr.type === \"template_string\") {\n const hasSubstitutions = expr.children.some((c) => c.type === \"template_substitution\");\n if (hasSubstitutions) {\n return { text: \"\", error: \"JSX expressions with template substitutions are not supported\" };\n }\n parts.push({ kind: \"text\", text: expr.text.slice(1, -1), raw: false });\n } else {\n return { text: \"\", error: \"JSX expressions must be simple identifiers, strings, or template literals\" };\n }\n segmentStart = child.endIndex;\n } else if (child.type === \"string\") {\n pushRawText(child.startIndex);\n parts.push({ kind: \"text\", text: child.text.slice(1, -1), raw: false });\n segmentStart = child.endIndex;\n } else if (child.type === \"jsx_text\" || child.type === \"html_character_reference\" || child.isError) {\n } else {\n return { text: \"\", error: \"Unsupported JSX child\" };\n }\n }\n\n pushRawText(contentEnd);\n\n const firstRawIndex = parts.findIndex((part) => part.kind === \"text\" && part.raw);\n if (firstRawIndex === 0) {\n const part = parts[firstRawIndex] as Extract<Part, { kind: \"text\" }>;\n part.text = part.text.replace(/^\\s+/, \"\");\n }\n\n let lastRawIndex = -1;\n for (let i = parts.length - 1; i >= 0; i--) {\n const part = parts[i];\n if (part.kind === \"text\" && part.raw) {\n lastRawIndex = i;\n break;\n }\n }\n if (lastRawIndex !== -1 && lastRawIndex === parts.length - 1) {\n const part = parts[lastRawIndex] as Extract<Part, { kind: \"text\" }>;\n part.text = part.text.replace(/\\s+$/, \"\");\n }\n\n const strings: string[] = [\"\"];\n const values: string[] = [];\n for (const part of parts) {\n if (part.kind === \"text\") {\n if (part.text) {\n strings[strings.length - 1] += part.text;\n }\n } else {\n values.push(part.value);\n strings.push(\"\");\n }\n }\n\n let text = \"\";\n for (let i = 0; i < strings.length; i++) {\n text += strings[i];\n if (values[i]) {\n text += `\\${${values[i]}}`;\n }\n }\n return { text };\n}\n\nexport function buildAttrValue(node: Parser.SyntaxNode): { text: string; error?: string } {\n if (node.type === \"string\") {\n return { text: node.text.slice(1, -1) };\n }\n if (node.type === \"jsx_expression\") {\n const expr = node.namedChildren[0];\n if (!expr) {\n return { text: \"\", error: \"Empty JSX expression\" };\n }\n\n if (expr.type === \"identifier\") {\n return { text: `\\${${expr.text}}` };\n } else if (expr.type === \"string\") {\n return { text: expr.text.slice(1, -1) };\n } else if (expr.type === \"template_string\") {\n // Check if it's a simple template string with no substitutions\n const hasSubstitutions = expr.children.some((c) => c.type === \"template_substitution\");\n if (hasSubstitutions) {\n return { text: \"\", error: \"JSX expressions with template substitutions are not supported\" };\n }\n // Extract the text content from the template string\n const content = expr.text.slice(1, -1); // Remove backticks\n return { text: content };\n } else {\n return { text: \"\", error: \"JSX expressions must be simple identifiers, strings, or template literals\" };\n }\n }\n return { text: \"\", error: \"Unsupported JSX child\" };\n}\n","import type Parser from \"@keqingmoe/tree-sitter\";\n\nimport { withComment } from \"../../core/queries/comment.ts\";\nimport type { MessageMatch, QuerySpec, Translation } from \"../../core/queries/types.ts\";\nimport { buildAttrValue, buildTemplate } from \"./utils.ts\";\n\nexport const messageQuery: QuerySpec = withComment({\n pattern: `(\n [\n (jsx_element (jsx_opening_element name: (identifier) @name)) @call\n (jsx_self_closing_element name: (identifier) @name) @call\n (lexical_declaration \n (variable_declarator \n value: [\n (jsx_element (jsx_opening_element name: (identifier) @name)) @call\n (jsx_self_closing_element name: (identifier) @name) @call\n ]\n )\n )\n ]\n (#eq? @name \"Message\")\n )`,\n extract(match: Parser.QueryMatch): MessageMatch | undefined {\n const node = match.captures.find((c) => c.name === \"call\")?.node;\n if (!node) return undefined;\n let attrs: Parser.SyntaxNode[] = [];\n if (node.type === \"jsx_element\") {\n const open = node.childForFieldName(\"open_tag\");\n if (open) attrs = open.namedChildren;\n } else if (node.type === \"jsx_self_closing_element\") {\n attrs = node.namedChildren.slice(1);\n }\n let msgctxt: string | undefined;\n let childValue: Parser.SyntaxNode | undefined;\n for (const child of attrs) {\n if (child.type !== \"jsx_attribute\") continue;\n const name = child.child(0);\n const value = child.child(child.childCount - 1);\n if (name?.text === \"context\" && value?.type === \"string\") {\n msgctxt = value.text.slice(1, -1);\n } else if (name?.text === \"children\" && value) {\n childValue = value;\n }\n }\n let text = \"\";\n let error: string | undefined;\n if (node.type === \"jsx_element\") {\n ({ text, error } = buildTemplate(node));\n } else if (childValue) {\n ({ text, error } = buildAttrValue(childValue));\n }\n if (error) {\n return { node, error };\n }\n if (!text) return undefined;\n const translation: Translation = {\n id: text,\n message: [text],\n };\n if (msgctxt) translation.context = msgctxt;\n return { node, translation };\n },\n});\n","import type Parser from \"@keqingmoe/tree-sitter\";\n\nimport { withComment } from \"../../core/queries/comment.ts\";\nimport type { MessageMatch, QuerySpec, Translation } from \"../../core/queries/types.ts\";\nimport { buildTemplate } from \"./utils.ts\";\n\nfunction parseForms(node: Parser.SyntaxNode): { forms: string[]; error?: string } {\n const forms: string[] = [];\n if (node.type === \"jsx_expression\") {\n const arr = node.namedChildren[0];\n if (!arr || arr.type !== \"array\") {\n return { forms: [], error: \"Plural forms must be an array\" };\n }\n for (const el of arr.namedChildren) {\n if (el.type === \"jsx_element\" || el.type === \"jsx_fragment\") {\n const { text, error } = buildTemplate(el);\n if (error) return { forms: [], error };\n forms.push(text);\n } else if (el.type === \"string\") {\n forms.push(el.text.slice(1, -1));\n } else {\n return { forms: [], error: \"Unsupported plural form\" };\n }\n }\n }\n return { forms };\n}\n\nexport const pluralQuery: QuerySpec = withComment({\n pattern: `(\n [\n (jsx_element (jsx_opening_element name: (identifier) @name))\n (jsx_self_closing_element name: (identifier) @name)\n ] @call\n (#eq? @name \"Plural\")\n )`,\n extract(match: Parser.QueryMatch): MessageMatch | undefined {\n const node = match.captures.find((c) => c.name === \"call\")?.node;\n if (!node) return undefined;\n let attrs: Parser.SyntaxNode[] = [];\n if (node.type === \"jsx_element\") {\n const open = node.childForFieldName(\"open_tag\");\n if (open) attrs = open.namedChildren;\n } else if (node.type === \"jsx_self_closing_element\") {\n attrs = node.namedChildren.slice(1);\n }\n let msgctxt: string | undefined;\n let formsNode: Parser.SyntaxNode | null | undefined;\n for (const child of attrs) {\n if (child.type !== \"jsx_attribute\") continue;\n const name = child.child(0);\n const value = child.child(child.childCount - 1);\n if (name?.text === \"context\" && value?.type === \"string\") {\n msgctxt = value.text.slice(1, -1);\n } else if (name?.text === \"forms\" && value) {\n formsNode = value;\n }\n }\n if (!formsNode) return undefined;\n const { forms, error } = parseForms(formsNode);\n if (error) {\n return { node, error };\n }\n if (forms.length === 0) return undefined;\n const translation: Translation = {\n id: forms[0],\n plural: forms[1],\n message: forms,\n };\n if (msgctxt) translation.context = msgctxt;\n return { node, translation };\n },\n});\n","import type { QuerySpec } from \"../../core/queries/types.ts\";\nimport { messageQuery } from \"./message.ts\";\nimport { pluralQuery } from \"./plural.ts\";\n\nexport const queries: QuerySpec[] = [messageQuery, pluralQuery];\n","import fs from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { getParser, getQuery } from \"../core/parse.ts\";\nimport { getReference } from \"../core/queries/comment.ts\";\n\nimport type { Context, Translation, Warning } from \"../core/queries/types.ts\";\nimport { queries } from \"./queries/index.ts\";\n\nexport interface ParseResult {\n translations: Translation[];\n warnings: Warning[];\n}\n\nexport function parseFile(filePath: string): ParseResult {\n const path = resolve(filePath);\n const source = fs.readFileSync(path, \"utf8\");\n return parseSource(source, path);\n}\n\nexport function parseSource(source: string, path: string): ParseResult {\n const context: Context = { path };\n const { parser, language } = getParser(path);\n const tree = parser.parse(source);\n\n const translations: Translation[] = [];\n const warnings: Warning[] = [];\n const seen = new Set<number>();\n\n for (const spec of queries) {\n const query = getQuery(language, spec.pattern);\n for (const match of query.matches(tree.rootNode)) {\n const message = spec.extract(match);\n if (!message) continue;\n const { node, translation, error } = message;\n if (seen.has(node.id)) continue;\n seen.add(node.id);\n const reference = getReference(node, context);\n if (translation) {\n translations.push({\n ...translation,\n comments: {\n ...translation.comments,\n reference,\n },\n });\n }\n if (error) {\n warnings.push({\n error,\n reference,\n });\n }\n }\n }\n\n return { translations, warnings };\n}\n","import type { Plugin } from \"../../plugin.ts\";\nimport { parseSource } from \"./parse.ts\";\n\nconst filter = /\\.[cm]?[jt]sx$/;\n\nexport function react(): Plugin {\n return {\n name: \"react\",\n setup(build) {\n build.context.logger?.debug(\"react plugin initialized\");\n\n // A file reached from several entrypoints is processed once per\n // entrypoint; its warnings are about the file, not the walk.\n const reported = new Set<string>();\n\n build.onProcess(filter, ({ path, contents, emit }) => {\n const { translations, warnings } = parseSource(contents, path);\n\n for (const warning of warnings) {\n const message = `${warning.error} at ${warning.reference}`;\n if (reported.has(message)) {\n continue;\n }\n reported.add(message);\n build.context.logger?.warn(message);\n }\n\n emit(translations);\n return undefined;\n });\n },\n };\n}\n","//#region src/graph.ts\nvar CycleError = class extends Error {\n\tconstructor(dependency, dependent) {\n\t\tsuper(`Adding edge \"${dependency}\" -> \"${dependent}\" would create a cycle`);\n\t\tthis.name = \"CycleError\";\n\t}\n};\nvar SkippedError = class extends Error {\n\tconstructor(id) {\n\t\tsuper(`Node \"${id}\" was skipped because a dependency failed or the run was aborted`);\n\t\tthis.name = \"SkippedError\";\n\t}\n};\nvar NodeState = class {\n\tid;\n\tstatus = \"pending\";\n\tresult;\n\treason;\n\tlazy = false;\n\t/**\n\t* Dependencies that have not fulfilled yet. Readiness is maintained as\n\t* edges are added and dependencies settle, so scheduling never has to\n\t* rescan the pending set.\n\t*/\n\tunresolved = 0;\n\t/** Whether the node is already sitting in the ready queue. */\n\tqueued = false;\n\t/** Resumers of demanders suspended on this node, flushed on settle. */\n\twaiters;\n\t/** Ordered data dependencies, passed as run arguments. */\n\targuments_;\n\t/** All dependencies, including ordering-only edges added via connect(). */\n\tdependencies = /* @__PURE__ */ new Set();\n\tdependents = /* @__PURE__ */ new Set();\n\texecute;\n\tconstructor(id, arguments_, execute) {\n\t\tthis.id = id;\n\t\tthis.arguments_ = arguments_;\n\t\tthis.execute = execute;\n\t\tfor (const dependency of arguments_) this.dependencies.add(dependency);\n\t}\n\tget value() {\n\t\tif (this.status !== \"fulfilled\") throw new Error(`Node \"${this.id}\" has no value (status: ${this.status})`);\n\t\treturn this.result;\n\t}\n\tget error() {\n\t\treturn this.reason;\n\t}\n};\n/**\n* A dynamic, asynchronous DAG of computations.\n*\n* Nodes can be added before or during a run, so a running node can discover\n* and schedule new work. Edges added with {@link Graph.connect} impose\n* ordering without contributing run arguments, which lets consumers build\n* barriers: a node that only starts once a dynamically growing set of\n* predecessors has finished.\n*/\nvar Graph = class {\n\t#nodes = /* @__PURE__ */ new Map();\n\t#root;\n\t#pending = /* @__PURE__ */ new Set();\n\t#dormant = /* @__PURE__ */ new Set();\n\t/** Pending nodes whose dependencies have all fulfilled. */\n\t#ready = [];\n\t/** Demanders that finished waiting and need a slot before resuming. */\n\t#slotWaiters = [];\n\t#runningCount = 0;\n\t#suspendedCount = 0;\n\t#concurrency = Infinity;\n\t#controller;\n\t#finish;\n\t#started = false;\n\t#finished = false;\n\t#errors = [];\n\tconstructor() {\n\t\tINTERNALS.set(this, {\n\t\t\tkinds: /* @__PURE__ */ new Map(),\n\t\t\tworkers: /* @__PURE__ */ new Map(),\n\t\t\twrappers: /* @__PURE__ */ new Map(),\n\t\t\tfrozen: false\n\t\t});\n\t\tthis.#root = new Scope(this, void 0, \"\");\n\t}\n\t/** The root scope. Nodes added here belong to no named scope. */\n\tget root() {\n\t\treturn this.#root;\n\t}\n\t/** Creates or returns a named child scope of the root scope. */\n\tscope(name) {\n\t\treturn this.#root.scope(name);\n\t}\n\t/** Declares a typed node kind. Kind names are unique per graph. */\n\tkind(name) {\n\t\tconst internals = INTERNALS.get(this);\n\t\tif (internals.kinds.has(name)) throw new Error(`Kind \"${name}\" is already registered`);\n\t\tconst kind = { name };\n\t\tinternals.kinds.set(name, kind);\n\t\treturn kind;\n\t}\n\t/**\n\t* Registers a worker that runs for every node of `source`, in the same\n\t* scope as that node. Worker results form their own kind, so they can be\n\t* awaited and collected with scope.completion(). Part of the graph's\n\t* definition: allowed until run() starts, and applies to nodes added\n\t* before the registration as well.\n\t*/\n\teach(source, name, worker) {\n\t\tconst internals = INTERNALS.get(this);\n\t\tif (internals.frozen) throw new Error(`Cannot register worker \"${name}\" after run() started`);\n\t\tconst kind = this.kind(name);\n\t\tconst registrations = internals.workers.get(source.name) ?? [];\n\t\tregistrations.push({\n\t\t\tkind,\n\t\t\tworker\n\t\t});\n\t\tinternals.workers.set(source.name, registrations);\n\t\treturn kind;\n\t}\n\t/**\n\t* Interposes on every node of a kind: consumers of the node receive the\n\t* outermost wrapper's value instead of the raw computation. The chain is\n\t* materialized as real intermediate nodes (\"<id>@raw\", \"<id>@<name>\"),\n\t* evaluated on demand: a wrapper that never calls next() (e.g. a cache\n\t* hit) keeps the inner nodes from running at all. Wrappers compose; the\n\t* last registered one is outermost. Part of the graph's definition:\n\t* allowed until run() starts.\n\t*/\n\twrap(kind, name, wrapper) {\n\t\tconst internals = INTERNALS.get(this);\n\t\tif (internals.frozen) throw new Error(`Cannot register wrapper \"${name}\" after run() started`);\n\t\tconst registrations = internals.wrappers.get(kind.name) ?? [];\n\t\tregistrations.push({\n\t\t\tname,\n\t\t\twrap: wrapper\n\t\t});\n\t\tinternals.wrappers.set(kind.name, registrations);\n\t}\n\t/** Whether `node` transitively depends on `dependency`. */\n\tdependsOn(node, dependency) {\n\t\tconst target = this.#resolve(dependency);\n\t\tconst stack = [...this.#resolve(node).dependencies];\n\t\tconst seen = /* @__PURE__ */ new Set();\n\t\twhile (stack.length > 0) {\n\t\t\tconst current = stack.pop();\n\t\t\tif (current === target) return true;\n\t\t\tif (seen.has(current)) continue;\n\t\t\tseen.add(current);\n\t\t\tstack.push(...current.dependencies);\n\t\t}\n\t\treturn false;\n\t}\n\tadd(id, options) {\n\t\tif (this.#finished) throw new Error(`Cannot add node \"${id}\": the graph has already finished`);\n\t\tif (this.#nodes.has(id)) throw new Error(`Node \"${id}\" already exists`);\n\t\tconst dependencies = (options.dependencies ?? []).map((dependency) => this.#resolve(dependency));\n\t\tconst node = new NodeState(id, dependencies, options.run);\n\t\tnode.lazy = options.lazy ?? false;\n\t\tlet doomed;\n\t\tfor (const dependency of dependencies) {\n\t\t\tdependency.dependents.add(node);\n\t\t\tif (dependency.status === \"rejected\" || dependency.status === \"skipped\") doomed ??= dependency;\n\t\t\telse if (dependency.status !== \"fulfilled\") node.unresolved += 1;\n\t\t}\n\t\tthis.#nodes.set(id, node);\n\t\tif (node.lazy) this.#dormant.add(node);\n\t\telse {\n\t\t\tthis.#pending.add(node);\n\t\t\tfor (const dependency of dependencies) this.#wake(dependency);\n\t\t}\n\t\tif (doomed) this.#settle(node, \"skipped\", void 0, new SkippedError(node.id));\n\t\telse if (!node.lazy) this.#enqueue(node);\n\t\tif (this.#started) queueMicrotask(() => this.#pump());\n\t\treturn node;\n\t}\n\t/**\n\t* Adds an ordering-only edge: `dependent` will not start until\n\t* `dependency` has fulfilled. The dependency's value is not passed to the\n\t* dependent's run function; read it from the node handle if needed.\n\t*/\n\tconnect(dependency, dependent) {\n\t\tconst from = this.#resolve(dependency);\n\t\tconst to = this.#resolve(dependent);\n\t\tif (to.status !== \"pending\") throw new Error(`Cannot add dependency to node \"${to.id}\": it has already started`);\n\t\tif (from === to || this.#reaches(to, from)) throw new CycleError(from.id, to.id);\n\t\tif (to.dependencies.has(from)) return;\n\t\tto.dependencies.add(from);\n\t\tfrom.dependents.add(to);\n\t\tif (from.status === \"rejected\" || from.status === \"skipped\") {\n\t\t\tthis.#settle(to, \"skipped\", void 0, new SkippedError(to.id));\n\t\t\treturn;\n\t\t}\n\t\tif (from.status !== \"fulfilled\") to.unresolved += 1;\n\t\tif (!this.#dormant.has(to)) this.#wake(from);\n\t\tif (this.#started) queueMicrotask(() => this.#pump());\n\t}\n\tget(id) {\n\t\treturn this.#nodes.get(id);\n\t}\n\tget nodes() {\n\t\treturn this.#nodes;\n\t}\n\t/**\n\t* Runs the graph until every node has settled, including nodes added\n\t* while running. Rejects with an AggregateError if any node rejected, or\n\t* with the abort reason if the signal aborted. Can only be called once.\n\t*/\n\tasync run(options = {}) {\n\t\tif (this.#started) throw new Error(\"Graph is already running or has finished\");\n\t\tScope.materialize(this.#root);\n\t\tINTERNALS.get(this).frozen = true;\n\t\tthis.#started = true;\n\t\tthis.#concurrency = options.concurrency ?? Infinity;\n\t\tif (this.#concurrency < 1) throw new Error(\"concurrency must be at least 1\");\n\t\tthis.#controller = new AbortController();\n\t\tconst signal = options.signal;\n\t\tif (signal) if (signal.aborted) this.#controller.abort(signal.reason);\n\t\telse signal.addEventListener(\"abort\", () => {\n\t\t\tthis.#controller?.abort(signal.reason);\n\t\t\tthis.#pump();\n\t\t});\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.#finish = {\n\t\t\t\tresolve,\n\t\t\t\treject\n\t\t\t};\n\t\t\tthis.#pump();\n\t\t});\n\t}\n\t#resolve(handle) {\n\t\tconst node = this.#nodes.get(handle.id);\n\t\tif (!node || node !== handle) throw new Error(`Node \"${handle.id}\" does not belong to this graph`);\n\t\treturn node;\n\t}\n\t#reaches(from, target) {\n\t\tconst stack = [...from.dependents];\n\t\tconst seen = /* @__PURE__ */ new Set();\n\t\twhile (stack.length > 0) {\n\t\t\tconst node = stack.pop();\n\t\t\tif (node === target) return true;\n\t\t\tif (seen.has(node)) continue;\n\t\t\tseen.add(node);\n\t\t\tstack.push(...node.dependents);\n\t\t}\n\t\treturn false;\n\t}\n\t/** Offers a pending node to the scheduler once its dependencies are in. */\n\t#enqueue(node) {\n\t\tif (node.queued || node.unresolved > 0 || node.status !== \"pending\" || this.#dormant.has(node)) return;\n\t\tnode.queued = true;\n\t\tthis.#ready.push(node);\n\t}\n\t#pump() {\n\t\tif (!this.#started || this.#finished || !this.#finish) return;\n\t\tif (this.#controller?.signal.aborted) {\n\t\t\twhile (this.#slotWaiters.length > 0) {\n\t\t\t\tthis.#runningCount += 1;\n\t\t\t\tthis.#slotWaiters.shift()();\n\t\t\t}\n\t\t\tfor (const node of [...this.#pending]) this.#settle(node, \"skipped\", void 0, new SkippedError(node.id));\n\t\t} else {\n\t\t\twhile (this.#slotWaiters.length > 0 && this.#runningCount < this.#concurrency) {\n\t\t\t\tthis.#runningCount += 1;\n\t\t\t\tthis.#slotWaiters.shift()();\n\t\t\t}\n\t\t\twhile (this.#ready.length > 0 && this.#runningCount < this.#concurrency) {\n\t\t\t\tconst node = this.#ready.shift();\n\t\t\t\tnode.queued = false;\n\t\t\t\tif (node.unresolved === 0 && node.status === \"pending\") this.#start(node);\n\t\t\t}\n\t\t}\n\t\tif (this.#pending.size === 0 && this.#runningCount === 0 && this.#suspendedCount === 0) this.#complete();\n\t}\n\t/** Moves a dormant lazy node (and its dormant dependencies) into scheduling. */\n\t#wake(node) {\n\t\tconst stack = [node];\n\t\twhile (stack.length > 0) {\n\t\t\tconst current = stack.pop();\n\t\t\tif (!this.#dormant.delete(current)) continue;\n\t\t\tthis.#pending.add(current);\n\t\t\tthis.#enqueue(current);\n\t\t\tstack.push(...current.dependencies);\n\t\t}\n\t}\n\t/**\n\t* Takes a concurrency slot, waiting for one when the graph is at its\n\t* limit. The slot is reserved by #pump at hand-off, so a granted slot\n\t* cannot be taken by anything else in the meantime.\n\t*/\n\t#acquire() {\n\t\tif (this.#runningCount < this.#concurrency) {\n\t\t\tthis.#runningCount += 1;\n\t\t\treturn;\n\t\t}\n\t\treturn new Promise((resume) => {\n\t\t\tthis.#slotWaiters.push(resume);\n\t\t});\n\t}\n\tasync #demand(demander, handle) {\n\t\tif (demander.status !== \"running\") throw new Error(`Node \"${demander.id}\" called demand() while it is \"${demander.status}\": a node context is only usable for as long as its node runs`);\n\t\tconst target = this.#resolve(handle);\n\t\tif (target === demander || this.#reaches(demander, target)) throw new CycleError(target.id, demander.id);\n\t\tif (!demander.dependencies.has(target)) {\n\t\t\tdemander.dependencies.add(target);\n\t\t\ttarget.dependents.add(demander);\n\t\t}\n\t\tthis.#wake(target);\n\t\tif (target.status === \"pending\" || target.status === \"running\") this.#pump();\n\t\tif (target.status === \"pending\" || target.status === \"running\") {\n\t\t\tthis.#runningCount -= 1;\n\t\t\tthis.#suspendedCount += 1;\n\t\t\tthis.#pump();\n\t\t\tawait new Promise((resume) => {\n\t\t\t\t(target.waiters ??= []).push(resume);\n\t\t\t});\n\t\t\tawait this.#acquire();\n\t\t\tthis.#suspendedCount -= 1;\n\t\t}\n\t\tif (target.status === \"fulfilled\") return target.result;\n\t\tif (target.status === \"rejected\") throw target.reason;\n\t\tthrow new SkippedError(target.id);\n\t}\n\t#start(node) {\n\t\tthis.#pending.delete(node);\n\t\tnode.status = \"running\";\n\t\tthis.#runningCount += 1;\n\t\tconst context = {\n\t\t\tid: node.id,\n\t\t\tsignal: this.#controller?.signal,\n\t\t\tdemand: (handle) => this.#demand(node, handle)\n\t\t};\n\t\tconst values = node.arguments_.map((dependency) => dependency.value);\n\t\tPromise.resolve().then(() => node.execute(context, ...values)).then((value) => {\n\t\t\tthis.#runningCount -= 1;\n\t\t\tthis.#settle(node, \"fulfilled\", value, void 0);\n\t\t\tthis.#pump();\n\t\t}, (reason) => {\n\t\t\tthis.#runningCount -= 1;\n\t\t\tthis.#errors.push(reason);\n\t\t\tthis.#settle(node, \"rejected\", void 0, reason);\n\t\t\tthis.#pump();\n\t\t});\n\t}\n\t/**\n\t* Settles a node and propagates the consequences to its dependents: a\n\t* fulfilled node makes them one dependency readier, a failed or skipped\n\t* one skips them in turn. Iterative, so a long chain of skips cannot\n\t* overflow the stack.\n\t*/\n\t#settle(node, status, value, reason) {\n\t\tconst stack = [{\n\t\t\tnode,\n\t\t\tstatus,\n\t\t\tvalue,\n\t\t\treason\n\t\t}];\n\t\twhile (stack.length > 0) {\n\t\t\tconst current = stack.pop();\n\t\t\tconst settled = current.node;\n\t\t\tif (settled.status !== \"pending\" && settled.status !== \"running\") continue;\n\t\t\tthis.#pending.delete(settled);\n\t\t\tthis.#dormant.delete(settled);\n\t\t\tsettled.status = current.status;\n\t\t\tsettled.result = current.value;\n\t\t\tsettled.reason = current.reason;\n\t\t\tconst waiters = settled.waiters;\n\t\t\tsettled.waiters = void 0;\n\t\t\twaiters?.forEach((resume) => resume());\n\t\t\tconst doomed = current.status === \"rejected\" || current.status === \"skipped\";\n\t\t\tfor (const dependent of settled.dependents) {\n\t\t\t\tif (doomed) {\n\t\t\t\t\tif (dependent.status === \"pending\") stack.push({\n\t\t\t\t\t\tnode: dependent,\n\t\t\t\t\t\tstatus: \"skipped\",\n\t\t\t\t\t\tvalue: void 0,\n\t\t\t\t\t\treason: new SkippedError(dependent.id)\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (dependent.unresolved > 0) {\n\t\t\t\t\tdependent.unresolved -= 1;\n\t\t\t\t\tthis.#enqueue(dependent);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t#complete() {\n\t\tconst finish = this.#finish;\n\t\tif (!finish) return;\n\t\tfor (const node of [...this.#dormant]) this.#settle(node, \"skipped\", void 0, new SkippedError(node.id));\n\t\tthis.#finished = true;\n\t\tthis.#finish = void 0;\n\t\tif (this.#controller?.signal.aborted) finish.reject(this.#controller.signal.reason);\n\t\telse if (this.#errors.length > 0) finish.reject(new AggregateError(this.#errors, \"One or more graph nodes failed\"));\n\t\telse finish.resolve();\n\t}\n};\nconst INTERNALS = /* @__PURE__ */ new WeakMap();\nfunction normalize(spec) {\n\treturn typeof spec === \"function\" ? { run: spec } : spec;\n}\n/**\n* A hierarchical namespace of kinded nodes. Scopes make phase completion\n* automatic: scope.completion(kind) fulfills once every node in the scope\n* (and its descendants) has settled — including nodes that are created\n* dynamically while the graph runs — without the producers having to wire\n* any edges themselves.\n*/\nvar Scope = class Scope {\n\tname;\n\tpath;\n\t#graph;\n\t#parent;\n\t#children = /* @__PURE__ */ new Map();\n\t#entries = /* @__PURE__ */ new Map();\n\t/** Nodes this scope's completions must wait for (kinded nodes + workers). */\n\t#members = [];\n\t#completions = /* @__PURE__ */ new Map();\n\t/** @internal Use graph.scope() or scope.scope() instead. */\n\tconstructor(graph, parent, name) {\n\t\tthis.#graph = graph;\n\t\tthis.#parent = parent;\n\t\tthis.name = name;\n\t\tthis.path = parent && parent.path ? `${parent.path}/${name}` : name;\n\t}\n\t/** Creates or returns a named child scope. */\n\tscope(name) {\n\t\tlet child = this.#children.get(name);\n\t\tif (!child) {\n\t\t\tchild = new Scope(this.#graph, this, name);\n\t\t\tthis.#children.set(name, child);\n\t\t}\n\t\treturn child;\n\t}\n\tget(kind, key) {\n\t\treturn this.#entries.get(kind.name)?.get(key);\n\t}\n\tadd(kind, key, spec) {\n\t\tif (this.get(kind, key)) throw new Error(`Node \"${kind.name}:${key}\" already exists in scope \"${this.path || \"(root)\"}\"`);\n\t\treturn this.#create(kind, key, normalize(spec));\n\t}\n\t/** Like add(), but returns the existing node if the key is already present. */\n\tensure(kind, key, spec) {\n\t\treturn this.get(kind, key) ?? this.#create(kind, key, normalize(spec));\n\t}\n\t/**\n\t* A barrier node that fulfills once this scope is quiescent: every node\n\t* in the scope and its descendants has settled, except nodes that\n\t* transitively depend on the barrier itself (its consumers). Its value is\n\t* the collected values of all `kind` nodes in the scope subtree. After it\n\t* fires the scope is sealed: adding non-consumer nodes throws.\n\t*/\n\tcompletion(kind) {\n\t\tconst existing = this.#completions.get(kind.name);\n\t\tif (existing) return existing;\n\t\tconst completion = this.#graph.add(`${this.#prefix()}${kind.name}:$completion`, { run: () => this.#collect(kind) });\n\t\tthis.#completions.set(kind.name, completion);\n\t\tfor (const member of this.#allMembers()) this.#attach(member, completion);\n\t\treturn completion;\n\t}\n\t#prefix() {\n\t\treturn this.path ? `${this.path}/` : \"\";\n\t}\n\t#create(kind, key, options) {\n\t\tconst internals = INTERNALS.get(this.#graph);\n\t\tconst dependencies = options.dependencies ?? [];\n\t\tthis.#assertOpen(`${kind.name}:${key}`, dependencies);\n\t\tconst scope = this;\n\t\tconst graph = this.#graph;\n\t\tconst id = `${this.#prefix()}${kind.name}:${key}`;\n\t\tconst node = graph.add(id, {\n\t\t\tdependencies,\n\t\t\trun: (context, ...values) => {\n\t\t\t\tconst scoped = {\n\t\t\t\t\tid: context.id,\n\t\t\t\t\tkey,\n\t\t\t\t\tsignal: context.signal,\n\t\t\t\t\tscope,\n\t\t\t\t\tdemand: context.demand\n\t\t\t\t};\n\t\t\t\tconst compute = () => options.run(scoped, ...values);\n\t\t\t\tconst wrappers = internals.wrappers.get(kind.name) ?? [];\n\t\t\t\tif (wrappers.length === 0) return compute();\n\t\t\t\tlet inner = graph.add(`${id}@raw`, {\n\t\t\t\t\tlazy: true,\n\t\t\t\t\trun: () => compute()\n\t\t\t\t});\n\t\t\t\tfor (const registration of wrappers.slice(0, -1)) {\n\t\t\t\t\tconst previous = inner;\n\t\t\t\t\tinner = graph.add(`${id}@${registration.name}`, {\n\t\t\t\t\t\tlazy: true,\n\t\t\t\t\t\trun: (innerContext) => registration.wrap({\n\t\t\t\t\t\t\t...scoped,\n\t\t\t\t\t\t\tid: innerContext.id,\n\t\t\t\t\t\t\tdemand: innerContext.demand\n\t\t\t\t\t\t}, () => {\n\t\t\t\t\t\t\treturn innerContext.demand(previous);\n\t\t\t\t\t\t})\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn wrappers[wrappers.length - 1].wrap(scoped, () => context.demand(inner));\n\t\t\t}\n\t\t});\n\t\tlet byKey = this.#entries.get(kind.name);\n\t\tif (!byKey) {\n\t\t\tbyKey = /* @__PURE__ */ new Map();\n\t\t\tthis.#entries.set(kind.name, byKey);\n\t\t}\n\t\tbyKey.set(key, node);\n\t\tthis.#members.push(node);\n\t\tfor (let ancestor = this; ancestor; ancestor = ancestor.#parent) for (const completion of ancestor.#completions.values()) this.#attach(node, completion);\n\t\tfor (const registration of internals.workers.get(kind.name) ?? []) this.#create(registration.kind, key, {\n\t\t\tdependencies: [node],\n\t\t\trun: (context, value) => registration.worker(context, value, node)\n\t\t});\n\t\treturn node;\n\t}\n\t/**\n\t* Attaches workers registered after some nodes of their kind were\n\t* already added. Runs once when the definition phase ends (run()).\n\t*/\n\tstatic materialize(scope) {\n\t\tconst internals = INTERNALS.get(scope.#graph);\n\t\tfor (const [kindName, byKey] of scope.#entries) for (const registration of internals.workers.get(kindName) ?? []) for (const [key, node] of [...byKey]) {\n\t\t\tif (scope.#entries.get(registration.kind.name)?.has(key)) continue;\n\t\t\tscope.#create(registration.kind, key, {\n\t\t\t\tdependencies: [node],\n\t\t\t\trun: (context, value) => registration.worker(context, value, node)\n\t\t\t});\n\t\t}\n\t\tfor (const child of scope.#children.values()) Scope.materialize(child);\n\t}\n\t/**\n\t* A scope seals once a completion fires: new nodes are only allowed if\n\t* they are consumers of that completion (depend on it), since the\n\t* completion has already reported the scope as done.\n\t*/\n\t#assertOpen(label, dependencies) {\n\t\tfor (let ancestor = this; ancestor; ancestor = ancestor.#parent) for (const completion of ancestor.#completions.values()) {\n\t\t\tif (completion.status === \"pending\") continue;\n\t\t\tif (!dependencies.some((dependency) => dependency === completion || this.#graph.dependsOn(dependency, completion))) throw new Error(`Cannot add \"${label}\" to scope \"${ancestor.path || \"(root)\"}\": its completion \"${completion.id}\" has already fired`);\n\t\t}\n\t}\n\t#attach(member, completion) {\n\t\tif (completion.status !== \"pending\") return;\n\t\tif (member === completion || this.#graph.dependsOn(member, completion)) return;\n\t\tthis.#graph.connect(member, completion);\n\t}\n\t#allMembers() {\n\t\tconst members = [...this.#members];\n\t\tfor (const child of this.#children.values()) members.push(...child.#allMembers());\n\t\treturn members;\n\t}\n\t#collect(kind) {\n\t\tconst values = [];\n\t\tconst byKey = this.#entries.get(kind.name);\n\t\tif (byKey) {\n\t\t\tfor (const node of byKey.values()) if (node.status === \"fulfilled\") values.push(node.value);\n\t\t}\n\t\tfor (const child of this.#children.values()) values.push(...child.#collect(kind));\n\t\treturn values;\n\t}\n};\n//#endregion\nexport { CycleError, Graph, Scope, SkippedError };\n\n//# sourceMappingURL=index.mjs.map","import type { Plugin, UniversalPlugin } from \"../plugin.ts\";\n\nimport { cleanup, core, po, react } from \"./index.ts\";\n\nconst original = {\n cleanup,\n core,\n po,\n react,\n} as const;\n\nexport function resolveStaticPlugin(item: UniversalPlugin): Plugin {\n if (\"static\" in item) {\n return original[item.static.name](...item.static.props);\n }\n\n return item;\n}\n","import { realpathSync } from \"node:fs\";\nimport { resolve as resolvePath } from \"node:path\";\nimport { Graph, type Scope } from \"@let-value/graph\";\nimport glob from \"fast-glob\";\nimport type { ResolvedConfig, ResolvedEntrypoint } from \"./configuration.ts\";\nimport { isExcluded } from \"./exclude.ts\";\nimport type { Logger } from \"./logger.ts\";\nimport type {\n Build,\n CollectedHook,\n Context,\n FileTranslations,\n ImportReference,\n LoadHook,\n OutputsHook,\n ProcessHook,\n} from \"./plugin.ts\";\nimport type { Translation } from \"./plugins/core/queries/types.ts\";\nimport { resolveStaticPlugin } from \"./plugins/static.ts\";\n\n/** A pending write requested by an onCollected hook via output(). */\ntype Contribution = { path: string; produce: () => unknown };\n\nasync function getPaths(entrypoint: ResolvedEntrypoint) {\n const pattern = entrypoint.entrypoint.replace(/\\\\/g, \"/\");\n const paths = glob.isDynamicPattern(pattern) ? await glob(pattern, { onlyFiles: true }) : [entrypoint.entrypoint];\n return new Set(paths.map((path) => resolvePath(path)));\n}\n\nfunction toRealPath(path: string) {\n const abs = resolvePath(path);\n try {\n return realpathSync(abs);\n } catch {\n return abs;\n }\n}\n\nexport async function run(\n entrypoint: ResolvedEntrypoint,\n { config, logger }: { config: ResolvedConfig; logger?: Logger },\n) {\n const destination = entrypoint.destination ?? config.destination;\n const obsolete = entrypoint.obsolete ?? config.obsolete;\n const exclude = entrypoint.exclude ?? config.exclude;\n const walk = entrypoint.walk ?? config.walk;\n\n const context: Context = {\n config: { ...config, destination, obsolete, exclude, walk },\n generatedAt: new Date(),\n paths: new Set<string>(),\n logger,\n };\n\n logger?.info(entrypoint, \"starting extraction\");\n\n const loaders: { filter: RegExp; hook: LoadHook }[] = [];\n const processors: { filter: RegExp; hook: ProcessHook }[] = [];\n const collectors: CollectedHook[] = [];\n const finalizers: OutputsHook[] = [];\n\n // Failures are contained at the entrypoint boundary instead of rejecting\n // the node that hit them: letting a rejection propagate would skip every\n // downstream node in the run, so one unreadable file would leave every\n // other entrypoint without output. A broken entrypoint still writes\n // nothing — a .po merged from a partial source set would obsolete or drop\n // the messages it failed to see — and the run rejects once at the end.\n const failures: unknown[] = [];\n const failed = new Set<string>();\n\n /** Records a failure that leaves `scope`'s translations incomplete. */\n function fail(scope: string, path: string, error: unknown) {\n failed.add(scope);\n record({ entrypoint: scope, path }, error);\n }\n\n /** Records a failure that no longer has an entrypoint to invalidate. */\n function record(where: Record<string, string>, error: unknown) {\n failures.push(error);\n logger?.error({ ...where, error }, \"extraction failed\");\n }\n\n const graph = new Graph();\n const source = graph.kind<string | undefined>(\"source\");\n // A collect node's value is what its hook asked to write; a root plan\n // node fans contributions in per destination, so writers of the same\n // output path become a single node instead of racing.\n const collect = graph.kind<Contribution[]>(\"collect\");\n const plan = graph.kind<void>(\"plan\");\n const output = graph.kind<string | undefined>(\"output\");\n const finalize = graph.kind<void>(\"finalize\");\n\n // One worker per source file runs the processor hooks in registration\n // order; a hook returning non-undefined stops the chain for that file.\n // Whatever the hooks emit becomes the worker's value, which the\n // per-entrypoint completion collects.\n const processed = graph.each(source, \"process\", async (node, contents): Promise<FileTranslations | undefined> => {\n if (contents === undefined) {\n return undefined;\n }\n const path = node.key;\n let emitted: FileTranslations | undefined;\n const args = {\n entrypoint: node.scope.name,\n path,\n contents,\n emit(translations: Translation[]) {\n emitted ??= { path, translations: [] };\n emitted.translations.push(...translations);\n },\n };\n try {\n for (const { filter, hook } of processors) {\n if (!filter.test(path)) {\n continue;\n }\n if ((await hook(args)) !== undefined) {\n break;\n }\n }\n } catch (error) {\n fail(node.scope.name, path, error);\n return undefined;\n }\n return emitted;\n });\n\n function addSource(scope: Scope, path: string, importReference?: ImportReference) {\n if (scope.get(source, path)) {\n return;\n }\n const args = { entrypoint: scope.name, path, namespace: \"source\", import: importReference };\n if (isExcluded(args, context.config.exclude)) {\n logger?.debug(args, \"excluded\");\n return;\n }\n logger?.debug({ entrypoint: scope.name, path }, \"source\");\n scope.add(source, path, async () => {\n try {\n for (const { filter, hook } of loaders) {\n if (!filter.test(path)) {\n continue;\n }\n const contents = await hook({ entrypoint: scope.name, path });\n if (contents !== undefined) {\n return contents;\n }\n }\n } catch (error) {\n fail(scope.name, path, error);\n }\n return undefined;\n });\n }\n\n // Each entrypoint (initial or promoted mid-run) gets its own scope: its\n // walk, translation collection, and outputs are independent from other\n // entrypoints in the same run.\n function pipeline(path: string) {\n if (context.paths.has(path)) {\n return;\n }\n context.paths.add(path);\n const scope = graph.scope(path);\n addSource(scope, path);\n\n const collected = scope.completion(processed);\n collectors.forEach((hook, index) => {\n scope.add(collect, String(index), {\n dependencies: [collected],\n run: async (_node, files) => {\n if (failed.has(path)) {\n logger?.warn({ entrypoint: path }, \"skipping outputs: entrypoint failed\");\n return [];\n }\n const contributions: Contribution[] = [];\n try {\n await hook({\n entrypoint: path,\n files: files.filter((file) => file !== undefined),\n output: (outputPath, produce) => {\n contributions.push({ path: outputPath, produce });\n },\n });\n } catch (error) {\n fail(path, path, error);\n return [];\n }\n return contributions;\n },\n });\n });\n }\n\n const build: Build = {\n context,\n source({ entrypoint: sourceEntrypoint, path, import: importReference }) {\n if (sourceEntrypoint === path) {\n pipeline(toRealPath(path));\n return;\n }\n addSource(graph.scope(sourceEntrypoint), path, importReference);\n },\n onLoad(filter, hook) {\n loaders.push({ filter, hook });\n },\n onProcess(filter, hook) {\n processors.push({ filter, hook });\n },\n onCollected(hook) {\n collectors.push(hook);\n },\n onOutputs(hook) {\n finalizers.push(hook);\n },\n };\n\n for (const item of config.plugins) {\n const plugin = resolveStaticPlugin(item);\n logger?.debug({ plugin: plugin.name }, \"setting up plugin\");\n plugin.setup(build);\n }\n\n // Once every entrypoint has collected, group contributions by destination\n // and spawn one writer node per output path: same-file writes are ordered\n // by structure, not by locks.\n const contributed = graph.root.completion(collect);\n graph.root.add(plan, \"outputs\", {\n dependencies: [contributed],\n run: (_node, collections) => {\n const byPath = new Map<string, Contribution[]>();\n for (const contribution of collections.flat()) {\n const group = byPath.get(contribution.path) ?? [];\n group.push(contribution);\n byPath.set(contribution.path, group);\n }\n for (const [outputPath, contributions] of byPath) {\n graph.root.add(output, outputPath, {\n dependencies: [contributed],\n run: async () => {\n try {\n for (const { produce } of contributions) {\n await produce();\n }\n } catch (error) {\n // A half-written artifact is not reported as an\n // output, so finalizers never treat it as ours.\n record({ output: outputPath }, error);\n return undefined;\n }\n return outputPath;\n },\n });\n }\n },\n });\n\n // Finalizers see the outputs of every entrypoint of this run, so cleanup\n // can reason about directories shared between entrypoints.\n const outputs = graph.root.completion(output);\n finalizers.forEach((hook, index) => {\n graph.root.add(finalize, String(index), {\n dependencies: [outputs],\n run: async (_node, produced) => {\n try {\n await hook({ outputs: produced.filter((path) => path !== undefined) });\n } catch (error) {\n record({ finalizer: String(index) }, error);\n }\n },\n });\n });\n\n for (const path of await getPaths(entrypoint)) {\n pipeline(toRealPath(path));\n }\n\n // Nothing above rethrows, so a rejection here is the scheduler itself\n // failing rather than a hook.\n await graph.run().catch((error: unknown) => {\n record({ graph: \"run\" }, error);\n });\n\n if (failures.length > 0) {\n throw new AggregateError(failures, `Extraction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