@x18n/builtins 0.0.7 → 0.0.9
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/extractors.mjs +2 -2
- package/dist/finders.mjs +1 -1
- package/dist/{formats-BAogSrvw.mjs → formats-CFkM5co0.mjs} +61 -22
- package/dist/formats.mjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{presets-DNnE_2MQ.mjs → presets-DJrGl3HR.mjs} +62 -2
- package/dist/presets.d.mts +2 -0
- package/dist/presets.mjs +1 -1
- package/dist/reporters.d.mts +1 -1
- package/dist/reporters.mjs +34 -17
- package/dist/{sfc-blocks-BwJwCUka.mjs → sfc-blocks-BIPqKcvd.mjs} +1 -1
- package/package.json +2 -2
package/dist/extractors.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createLineIndex, errors, pathMatcher } from "@x18n/core";
|
|
2
2
|
//#region src/extractors/index.ts
|
|
3
3
|
const textKinds = /* @__PURE__ */ new Set([
|
|
4
4
|
"jsx-text",
|
|
@@ -301,7 +301,7 @@ function toPlanFile(project, candidates) {
|
|
|
301
301
|
function extractItems(project, items) {
|
|
302
302
|
return items.map((item) => {
|
|
303
303
|
const text = project.text(item.path);
|
|
304
|
-
if (text === void 0 || text.slice(item.range.start, item.range.end) !== item.original) throw
|
|
304
|
+
if (text === void 0 || text.slice(item.range.start, item.range.end) !== item.original) throw errors.X18N4004({ path: item.path });
|
|
305
305
|
return {
|
|
306
306
|
path: item.path,
|
|
307
307
|
range: item.range,
|
package/dist/finders.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as patternFinder, i as pattern, n as guessResources, r as namespaceFromPath, t as compilePattern } from "./finders-CqTGh4OJ.mjs";
|
|
2
|
-
import { n as sfcFluentBlocks, t as sfcBlocks } from "./sfc-blocks-
|
|
2
|
+
import { n as sfcFluentBlocks, t as sfcBlocks } from "./sfc-blocks-BIPqKcvd.mjs";
|
|
3
3
|
export { compilePattern, guessResources, namespaceFromPath, pattern, patternFinder, sfcBlocks, sfcFluentBlocks };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { applyMessageOps, applyTextEdits, buildTree, diffText, errors, isMessageLeaf, isMessageTree, pathId, walkLeaves } from "@x18n/core";
|
|
2
2
|
import { parseSync } from "oxc-parser";
|
|
3
3
|
import { applyEdits, modify, parseTree, printParseErrorCode } from "jsonc-parser";
|
|
4
4
|
import JSON5 from "json5";
|
|
@@ -179,14 +179,21 @@ function readObject(node, path, module, text, fail) {
|
|
|
179
179
|
return out;
|
|
180
180
|
}
|
|
181
181
|
function readModule(text, path) {
|
|
182
|
-
const fail = (code, node,
|
|
183
|
-
throw
|
|
182
|
+
const fail = (code, node, reason) => {
|
|
183
|
+
throw errors[code]({
|
|
184
|
+
path,
|
|
185
|
+
line: text.slice(0, node.start).split("\n").length,
|
|
186
|
+
reason
|
|
187
|
+
});
|
|
184
188
|
};
|
|
185
189
|
const result = parseSync(path, text, {
|
|
186
190
|
lang: /\.[mc]?ts$/.test(path) ? "ts" : "js",
|
|
187
191
|
sourceType: "module"
|
|
188
192
|
});
|
|
189
|
-
if (result.errors.length > 0) throw
|
|
193
|
+
if (result.errors.length > 0) throw errors.X18N2002({
|
|
194
|
+
path,
|
|
195
|
+
reason: result.errors[0].message
|
|
196
|
+
});
|
|
190
197
|
const root = findRoot(result.program, fail);
|
|
191
198
|
const found = {
|
|
192
199
|
ranges: /* @__PURE__ */ new Map(),
|
|
@@ -317,7 +324,11 @@ function read$3(text, path) {
|
|
|
317
324
|
continue;
|
|
318
325
|
}
|
|
319
326
|
if (/^[ \t]/.test(content)) {
|
|
320
|
-
if (!current) throw
|
|
327
|
+
if (!current) throw errors.X18N2002({
|
|
328
|
+
path,
|
|
329
|
+
line: lineNumber,
|
|
330
|
+
reason: "indented line outside a message"
|
|
331
|
+
});
|
|
321
332
|
const attribute = /^[ \t]+\.([a-z][\w-]*)[ \t]*=[ \t]*/i.exec(content);
|
|
322
333
|
if (attribute) {
|
|
323
334
|
const nameStart = line.start + attribute[0].indexOf(".") + 1;
|
|
@@ -357,7 +368,11 @@ function read$3(text, path) {
|
|
|
357
368
|
continue;
|
|
358
369
|
}
|
|
359
370
|
const message = /^(-?[a-z][\w-]*)[ \t]*=[ \t]*/i.exec(content);
|
|
360
|
-
if (!message) throw
|
|
371
|
+
if (!message) throw errors.X18N2002({
|
|
372
|
+
path,
|
|
373
|
+
line: lineNumber,
|
|
374
|
+
reason: "expected a message, a term or a comment"
|
|
375
|
+
});
|
|
361
376
|
current = {
|
|
362
377
|
id: message[1],
|
|
363
378
|
idRange: {
|
|
@@ -534,7 +549,11 @@ function read$2(text, path) {
|
|
|
534
549
|
let section = "";
|
|
535
550
|
let lineNumber = 0;
|
|
536
551
|
const fail = (message) => {
|
|
537
|
-
throw
|
|
552
|
+
throw errors.X18N2002({
|
|
553
|
+
path,
|
|
554
|
+
line: lineNumber,
|
|
555
|
+
reason: message
|
|
556
|
+
});
|
|
538
557
|
};
|
|
539
558
|
for (const line of splitLines(text)) {
|
|
540
559
|
lineNumber++;
|
|
@@ -669,21 +688,24 @@ function createJsonFormat(id, extensions, allowComments, defaultIndent) {
|
|
|
669
688
|
id,
|
|
670
689
|
extensions,
|
|
671
690
|
parse(text, ctx) {
|
|
672
|
-
const
|
|
673
|
-
const root = parseTree(text,
|
|
691
|
+
const problems = [];
|
|
692
|
+
const root = parseTree(text, problems, {
|
|
674
693
|
allowTrailingComma: true,
|
|
675
694
|
disallowComments: !allowComments
|
|
676
695
|
});
|
|
677
|
-
if (
|
|
678
|
-
const first =
|
|
679
|
-
throw
|
|
696
|
+
if (problems.length > 0) {
|
|
697
|
+
const first = problems[0];
|
|
698
|
+
throw errors.X18N2002({
|
|
699
|
+
path: ctx.path,
|
|
700
|
+
reason: `${printParseErrorCode(first.error)} at offset ${first.offset}`
|
|
701
|
+
});
|
|
680
702
|
}
|
|
681
703
|
if (!root || root.type !== "object") {
|
|
682
704
|
if (text.trim() === "") return {
|
|
683
705
|
tree: {},
|
|
684
706
|
ranges: /* @__PURE__ */ new Map()
|
|
685
707
|
};
|
|
686
|
-
throw
|
|
708
|
+
throw errors.X18N2003({ path: ctx.path });
|
|
687
709
|
}
|
|
688
710
|
const ranges = /* @__PURE__ */ new Map();
|
|
689
711
|
return {
|
|
@@ -732,9 +754,13 @@ function json5() {
|
|
|
732
754
|
try {
|
|
733
755
|
data = JSON5.parse(text);
|
|
734
756
|
} catch (error) {
|
|
735
|
-
throw
|
|
757
|
+
throw errors.X18N2002({
|
|
758
|
+
path: ctx.path,
|
|
759
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
760
|
+
cause: error
|
|
761
|
+
});
|
|
736
762
|
}
|
|
737
|
-
if (!isMessageTree(data)) throw
|
|
763
|
+
if (!isMessageTree(data)) throw errors.X18N2003({ path: ctx.path });
|
|
738
764
|
return { tree: data };
|
|
739
765
|
},
|
|
740
766
|
serialize: (tree, ctx) => `${JSON5.stringify(tree, null, ctx.indent === "tab" ? " " : ctx.indent ?? 2)}\n`
|
|
@@ -765,9 +791,12 @@ function decodeDouble(raw, fail) {
|
|
|
765
791
|
}
|
|
766
792
|
function parseFile(text, path) {
|
|
767
793
|
let pos = 0;
|
|
768
|
-
const fail = (code,
|
|
769
|
-
|
|
770
|
-
|
|
794
|
+
const fail = (code, reason) => {
|
|
795
|
+
throw errors[code]({
|
|
796
|
+
path,
|
|
797
|
+
line: text.slice(0, pos).split("\n").length,
|
|
798
|
+
reason
|
|
799
|
+
});
|
|
771
800
|
};
|
|
772
801
|
const skip = () => {
|
|
773
802
|
for (;;) {
|
|
@@ -1008,7 +1037,11 @@ function read$1(text, path) {
|
|
|
1008
1037
|
const entries = [];
|
|
1009
1038
|
let lineNumber = 0;
|
|
1010
1039
|
const fail = (message) => {
|
|
1011
|
-
throw
|
|
1040
|
+
throw errors.X18N2002({
|
|
1041
|
+
path,
|
|
1042
|
+
line: lineNumber,
|
|
1043
|
+
reason: message
|
|
1044
|
+
});
|
|
1012
1045
|
};
|
|
1013
1046
|
let draft;
|
|
1014
1047
|
let field;
|
|
@@ -1128,7 +1161,10 @@ function unescape(raw, path) {
|
|
|
1128
1161
|
while (isSpace(raw[i + 1])) i++;
|
|
1129
1162
|
} else if (next === "u") {
|
|
1130
1163
|
const hex = raw.slice(i + 1, i + 5);
|
|
1131
|
-
if (!/^[0-9a-f]{4}$/i.test(hex)) throw
|
|
1164
|
+
if (!/^[0-9a-f]{4}$/i.test(hex)) throw errors.X18N2002({
|
|
1165
|
+
path,
|
|
1166
|
+
reason: `malformed \\u escape "\\u${hex}"`
|
|
1167
|
+
});
|
|
1132
1168
|
out += String.fromCharCode(Number.parseInt(hex, 16));
|
|
1133
1169
|
i += 4;
|
|
1134
1170
|
} else out += escapes[next] ?? next;
|
|
@@ -1267,7 +1303,10 @@ function parse$1(text, path) {
|
|
|
1267
1303
|
keepSourceTokens: true,
|
|
1268
1304
|
uniqueKeys: false
|
|
1269
1305
|
});
|
|
1270
|
-
if (doc.errors.length > 0) throw
|
|
1306
|
+
if (doc.errors.length > 0) throw errors.X18N2002({
|
|
1307
|
+
path,
|
|
1308
|
+
reason: doc.errors[0].message
|
|
1309
|
+
});
|
|
1271
1310
|
return doc;
|
|
1272
1311
|
}
|
|
1273
1312
|
function scalarText(value, type) {
|
|
@@ -1292,7 +1331,7 @@ function yaml() {
|
|
|
1292
1331
|
tree: {},
|
|
1293
1332
|
ranges
|
|
1294
1333
|
};
|
|
1295
|
-
if (!isMap(doc.contents)) throw
|
|
1334
|
+
if (!isMap(doc.contents)) throw errors.X18N2003({ path: ctx.path });
|
|
1296
1335
|
return {
|
|
1297
1336
|
tree: readMap(doc.contents, [], ranges),
|
|
1298
1337
|
ranges
|
package/dist/formats.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { u as ecmascript, l as ftl, c as ini, o as json, a as json5, s as jsonc, i as php, r as po, n as properties, t as yaml } from "./formats-
|
|
1
|
+
export { u as ecmascript, l as ftl, c as ini, o as json, a as json5, s as jsonc, i as php, r as po, n as properties, t as yaml } from "./formats-CFkM5co0.mjs";
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { recommended } from "./checks.mjs";
|
|
2
2
|
import { i as pattern } from "./finders-CqTGh4OJ.mjs";
|
|
3
|
-
import { a as json5, c as ini, i as php, l as ftl, n as properties, o as json, r as po, s as jsonc, t as yaml, u as ecmascript } from "./formats-
|
|
3
|
+
import { a as json5, c as ini, i as php, l as ftl, n as properties, o as json, r as po, s as jsonc, t as yaml, u as ecmascript } from "./formats-CFkM5co0.mjs";
|
|
4
4
|
import { i as js, n as vue } from "./vue-5GFR5hft.mjs";
|
|
5
5
|
import { manifests } from "./manifests.mjs";
|
|
6
6
|
import { n as regex } from "./regex-B9TBGgXC.mjs";
|
|
7
|
-
import { t as presets } from "./presets-
|
|
7
|
+
import { t as presets } from "./presets-DJrGl3HR.mjs";
|
|
8
8
|
import { reporters } from "./reporters.mjs";
|
|
9
9
|
import { t as svelte } from "./scanners-B27IEH4_.mjs";
|
|
10
10
|
//#region src/index.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defaultTemplates } from "./extractors.mjs";
|
|
2
|
-
import { n as sfcFluentBlocks, t as sfcBlocks } from "./sfc-blocks-
|
|
2
|
+
import { n as sfcFluentBlocks, t as sfcBlocks } from "./sfc-blocks-BIPqKcvd.mjs";
|
|
3
3
|
import { braces, colon, dollars, doubleBraces, fluent, icu, linked, nesting, percentBraces, placeholders, printf } from "./placeholders.mjs";
|
|
4
4
|
import { r as regexScopes } from "./regex-B9TBGgXC.mjs";
|
|
5
5
|
import { isMessageLeaf } from "@x18n/core";
|
|
@@ -1083,6 +1083,64 @@ function chromeExtension() {
|
|
|
1083
1083
|
]
|
|
1084
1084
|
};
|
|
1085
1085
|
}
|
|
1086
|
+
function solidPrimitivesI18n() {
|
|
1087
|
+
return {
|
|
1088
|
+
name: "solid-primitives-i18n",
|
|
1089
|
+
detect: dependsOn(["@solid-primitives/i18n"]),
|
|
1090
|
+
plugins: [library({
|
|
1091
|
+
name: "solid-primitives-i18n",
|
|
1092
|
+
calls: [{ callee: ["t", "i18n.t"] }],
|
|
1093
|
+
templates: [
|
|
1094
|
+
{
|
|
1095
|
+
template: "{t('{key}'{args})}",
|
|
1096
|
+
kinds: ["jsx-text"]
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
template: "{attr}={t('{key}'{args})}",
|
|
1100
|
+
kinds: ["jsx-attribute"]
|
|
1101
|
+
},
|
|
1102
|
+
{
|
|
1103
|
+
template: "t('{key}'{args})",
|
|
1104
|
+
kinds: ["js-string", "js-template"]
|
|
1105
|
+
}
|
|
1106
|
+
]
|
|
1107
|
+
}), placeholders(doubleBraces)]
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
function paraglide() {
|
|
1111
|
+
return {
|
|
1112
|
+
name: "paraglide",
|
|
1113
|
+
detect: dependsOn([
|
|
1114
|
+
"@inlang/paraglide-js",
|
|
1115
|
+
"@inlang/paraglide-sveltekit",
|
|
1116
|
+
"@inlang/paraglide-next",
|
|
1117
|
+
"@inlang/paraglide-astro",
|
|
1118
|
+
"@inlang/paraglide-vite"
|
|
1119
|
+
]),
|
|
1120
|
+
plugins: [library({
|
|
1121
|
+
name: "paraglide",
|
|
1122
|
+
regex: [{
|
|
1123
|
+
extensions: [
|
|
1124
|
+
...scriptExtensions,
|
|
1125
|
+
"vue",
|
|
1126
|
+
"svelte",
|
|
1127
|
+
"astro"
|
|
1128
|
+
],
|
|
1129
|
+
patterns: ["\\bm\\.({key})\\(", "\\bm\\[\\s*['\"`]({key})['\"`]\\s*\\]\\("]
|
|
1130
|
+
}],
|
|
1131
|
+
resources: [{ pattern: "messages/{locale}.json" }],
|
|
1132
|
+
templates: [{
|
|
1133
|
+
template: "{m.{key}({args})}",
|
|
1134
|
+
kinds: ["jsx-text", "svelte-text"],
|
|
1135
|
+
imports: ["import { m } from '$lib/paraglide/messages'"]
|
|
1136
|
+
}, {
|
|
1137
|
+
template: "m.{key}({args})",
|
|
1138
|
+
kinds: ["js-string", "js-template"],
|
|
1139
|
+
imports: ["import { m } from '$lib/paraglide/messages'"]
|
|
1140
|
+
}]
|
|
1141
|
+
}), placeholders(braces)]
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1086
1144
|
//#endregion
|
|
1087
1145
|
//#region src/presets/index.ts
|
|
1088
1146
|
/**
|
|
@@ -1101,6 +1159,8 @@ const presets = {
|
|
|
1101
1159
|
"next-intl": () => nextIntl(),
|
|
1102
1160
|
"react-intl": () => reactIntl(),
|
|
1103
1161
|
"svelte-i18n": () => svelteI18n(),
|
|
1162
|
+
"solid-primitives-i18n": () => solidPrimitivesI18n(),
|
|
1163
|
+
"paraglide": () => paraglide(),
|
|
1104
1164
|
"ngx-translate": () => ngxTranslate(),
|
|
1105
1165
|
"transloco": () => transloco(),
|
|
1106
1166
|
"lingui": () => lingui(),
|
|
@@ -1121,4 +1181,4 @@ const presets = {
|
|
|
1121
1181
|
"general": () => general()
|
|
1122
1182
|
};
|
|
1123
1183
|
//#endregion
|
|
1124
|
-
export {
|
|
1184
|
+
export { vscodeExtension as A, general as C, reactI18next as D, nuxtI18n as E, ngxTranslate as M, transloco as N, reactIntl as O, flutter as S, nextIntl as T, laravel as _, globalize as a, railsLazyKey as b, i18nextShopify as c, nextTranslate as d, paraglide as f, jekyll as g, ui5 as h, fluentVue as i, vueI18n as j, svelteI18n as k, lingui as l, solidPrimitivesI18n as m, chromeExtension as n, i18nJs as o, polyglot as p, emberIntl as r, i18nTag as s, presets as t, nextInternational as u, phpGettext as v, i18next as w, rubyRails as x, phpJoomla as y };
|
package/dist/presets.d.mts
CHANGED
|
@@ -46,6 +46,8 @@ export declare function emberIntl(): Preset;
|
|
|
46
46
|
export declare function i18nJs(): Preset;
|
|
47
47
|
/** Chrome and WebExtension `_locales/{locale}/messages.json`: `{ "name": { "message": "..." } }` reads as `name`. */
|
|
48
48
|
export declare function chromeExtension(): Preset;
|
|
49
|
+
export declare function solidPrimitivesI18n(): Preset;
|
|
50
|
+
export declare function paraglide(): Preset;
|
|
49
51
|
//#endregion
|
|
50
52
|
//#region src/presets/index.d.ts
|
|
51
53
|
/**
|
package/dist/presets.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as chromeExtension, r as emberIntl, i as fluentVue,
|
|
1
|
+
export { n as chromeExtension, r as emberIntl, i as fluentVue, S as flutter, C as general, a as globalize, o as i18nJs, s as i18nTag, w as i18next, c as i18nextShopify, g as jekyll, _ as laravel, l as lingui, u as nextInternational, T as nextIntl, d as nextTranslate, M as ngxTranslate, E as nuxtI18n, f as paraglide, v as phpGettext, y as phpJoomla, p as polyglot, t as presets, b as railsLazyKey, D as reactI18next, O as reactIntl, x as rubyRails, m as solidPrimitivesI18n, k as svelteI18n, N as transloco, h as ui5, A as vscodeExtension, j as vueI18n } from "./presets-DJrGl3HR.mjs";
|
package/dist/reporters.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin, Reporter } from "@x18n/core";
|
|
2
2
|
//#region src/reporters/index.d.ts
|
|
3
|
-
/**
|
|
3
|
+
/** `path:line:col`, then the severity, message and check, a code frame, and a summary. */
|
|
4
4
|
export declare const prettyReporter: Reporter;
|
|
5
5
|
/** The versioned JSON contract of `x18n check --json`. */
|
|
6
6
|
export declare const jsonReporter: Reporter;
|
package/dist/reporters.mjs
CHANGED
|
@@ -33,40 +33,57 @@ const severityColor = {
|
|
|
33
33
|
info: "blue",
|
|
34
34
|
hint: "gray"
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
/** The severity as a highlighted label, like ` ERROR `. */
|
|
37
|
+
function badge(ctx, severity) {
|
|
38
|
+
const label = ` ${severity.toUpperCase()} `;
|
|
39
|
+
return ctx.color ? `\u001B[1;7;${codes[severityColor[severity]]}m${label}\u001B[0m` : label;
|
|
40
|
+
}
|
|
41
|
+
/** The marked line with one line of context on each side, and `~` under the range. */
|
|
42
|
+
function codeFrame(text, start, end, severity, ctx) {
|
|
37
43
|
const index = createLineIndex(text);
|
|
38
44
|
const from = index.position(start);
|
|
39
45
|
const to = index.position(end);
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const gutter = "
|
|
44
|
-
|
|
46
|
+
const first = Math.max(0, from.line - 1);
|
|
47
|
+
const last = Math.min(index.lineCount - 1, from.line + 1);
|
|
48
|
+
const pad = String(last + 1).length;
|
|
49
|
+
const gutter = (n) => `${paint(ctx, "gray", n.padStart(pad))} ${paint(ctx, "gray", "│")} `;
|
|
50
|
+
const width = Math.max(1, (to.line === from.line ? to.character : index.line(from.line).length) - from.character);
|
|
51
|
+
const lines = [];
|
|
52
|
+
for (let n = first; n <= last; n++) {
|
|
53
|
+
const line = index.line(n);
|
|
54
|
+
lines.push(`${gutter(String(n + 1))}${n === from.line ? line : paint(ctx, "gray", line)}`);
|
|
55
|
+
if (n === from.line) lines.push(`${gutter("")}${" ".repeat(from.character)}${paint(ctx, severityColor[severity], "~".repeat(width))}`);
|
|
56
|
+
}
|
|
57
|
+
return lines.join("\n");
|
|
45
58
|
}
|
|
46
|
-
/**
|
|
59
|
+
/** `path:line:col`, then the severity, message and check, a code frame, and a summary. */
|
|
47
60
|
const prettyReporter = {
|
|
48
61
|
id: "pretty",
|
|
49
62
|
report(inputs, ctx) {
|
|
50
|
-
const
|
|
63
|
+
const blocks = [];
|
|
51
64
|
for (const input of inputs) for (const d of input.diagnostics) {
|
|
52
|
-
const head = `${
|
|
65
|
+
const head = `${badge(ctx, d.severity)} ${d.message} ${paint(ctx, "gray", d.code)}`;
|
|
53
66
|
if (!d.location) {
|
|
54
|
-
|
|
67
|
+
blocks.push(head);
|
|
55
68
|
continue;
|
|
56
69
|
}
|
|
57
70
|
const text = input.text(d.location.path);
|
|
58
71
|
const position = createLineIndex(text ?? "").position(d.location.range.start);
|
|
59
|
-
const where = `${paint(ctx, "cyan", ctx.displayPath(d.location.path, input.project))}
|
|
60
|
-
const frame = text !== void 0 && d.location.range.end > d.location.range.start ? `\n${codeFrame(text, d.location.range.start, d.location.range.end, ctx)}
|
|
61
|
-
|
|
72
|
+
const where = `${paint(ctx, "cyan", ctx.displayPath(d.location.path, input.project))}${paint(ctx, "gray", `:${position.line + 1}:${position.character + 1}`)}`;
|
|
73
|
+
const frame = text !== void 0 && d.location.range.end > d.location.range.start ? `\n${codeFrame(text, d.location.range.start, d.location.range.end, d.severity, ctx)}` : "";
|
|
74
|
+
blocks.push(`${where}\n${head}${frame}`);
|
|
62
75
|
}
|
|
63
76
|
const sum = totals(inputs);
|
|
64
|
-
if (sum.errors + sum.warnings === 0)
|
|
77
|
+
if (sum.errors + sum.warnings === 0) blocks.push(paint(ctx, "gray", "Found no errors."));
|
|
65
78
|
else {
|
|
66
|
-
const parts = [
|
|
67
|
-
|
|
79
|
+
const parts = [
|
|
80
|
+
sum.errors ? paint(ctx, "red", `✖ ${plural(sum.errors, "error")}`) : "",
|
|
81
|
+
sum.warnings ? paint(ctx, "yellow", `⚠ ${plural(sum.warnings, "warning")}`) : "",
|
|
82
|
+
paint(ctx, "gray", plural(sum.files, "file"))
|
|
83
|
+
].filter(Boolean);
|
|
84
|
+
blocks.push(parts.join(" "));
|
|
68
85
|
}
|
|
69
|
-
return `${
|
|
86
|
+
return `${blocks.join("\n\n")}\n`;
|
|
70
87
|
}
|
|
71
88
|
};
|
|
72
89
|
/** The versioned JSON contract of `x18n check --json`. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as json5, o as json, t as yaml } from "./formats-
|
|
1
|
+
import { a as json5, o as json, t as yaml } from "./formats-CFkM5co0.mjs";
|
|
2
2
|
import { t as loadVueCompiler } from "./vue-5GFR5hft.mjs";
|
|
3
3
|
import { isMessageLeaf, pathId } from "@x18n/core";
|
|
4
4
|
//#region src/finders/sfc-blocks.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x18n/builtins",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.9",
|
|
5
5
|
"description": "Built-in x18n plugins and presets: formats, locale finders, scanners, checks and reporters",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@vue/compiler-sfc": "^3.5.44",
|
|
36
|
-
"@x18n/core": "0.0.
|
|
36
|
+
"@x18n/core": "0.0.9",
|
|
37
37
|
"json5": "^2.2.3",
|
|
38
38
|
"jsonc-parser": "^3.3.1",
|
|
39
39
|
"oxc-parser": "^0.155.0",
|