@x18n/builtins 0.0.13 → 0.0.15
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/angular-templates-DqIOGfzT.mjs +8 -0
- package/dist/checks.d.mts +1 -0
- package/dist/checks.mjs +26 -1
- package/dist/extractors.mjs +7 -3
- package/dist/finders.d.mts +4 -1
- package/dist/finders.mjs +1 -1
- package/dist/formats/ecmascript.d.mts +5 -0
- package/dist/formats/ecmascript.mjs +232 -0
- package/dist/formats/ftl.d.mts +5 -0
- package/dist/formats/ftl.mjs +234 -0
- package/dist/formats/ini.d.mts +5 -0
- package/dist/formats/ini.mjs +158 -0
- package/dist/formats/json.d.mts +6 -0
- package/dist/formats/json.mjs +10 -0
- package/dist/formats/json5.d.mts +5 -0
- package/dist/formats/json5.mjs +143 -0
- package/dist/formats/jsonc.d.mts +6 -0
- package/dist/formats/jsonc.mjs +10 -0
- package/dist/formats/php.d.mts +5 -0
- package/dist/formats/php.mjs +198 -0
- package/dist/formats/po.d.mts +5 -0
- package/dist/formats/po.mjs +177 -0
- package/dist/formats/properties.d.mts +5 -0
- package/dist/formats/properties.mjs +123 -0
- package/dist/formats/resx.d.mts +6 -0
- package/dist/formats/resx.mjs +202 -0
- package/dist/formats/yaml.d.mts +5 -0
- package/dist/formats/yaml.mjs +140 -0
- package/dist/formats.d.mts +10 -34
- package/dist/formats.mjs +61 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +30 -22
- package/dist/{vue-CF4pe-Yr.mjs → js-CV-ECNJG.mjs} +67 -222
- package/dist/json-CGNSGS97.mjs +109 -0
- package/dist/json-CyjI8bjp.d.mts +8 -0
- package/dist/jsx-templates-B1J0no3i.mjs +17 -0
- package/dist/literal-gIdB1VGy.mjs +125 -0
- package/dist/locale-root-C_rch3IQ.mjs +15 -0
- package/dist/manifests.d.mts +8 -0
- package/dist/manifests.mjs +66 -2
- package/dist/placeholders.d.mts +11 -0
- package/dist/placeholders.mjs +28 -1
- package/dist/plugin-Cb1b0axD.mjs +83 -0
- package/dist/plural-forms-B7_QX4nG.mjs +12 -0
- package/dist/presets/cargo-i18n.d.mts +6 -0
- package/dist/presets/cargo-i18n.mjs +28 -0
- package/dist/presets/chrome-extension.d.mts +6 -0
- package/dist/presets/chrome-extension.mjs +52 -0
- package/dist/presets/dotnet-resx.d.mts +6 -0
- package/dist/presets/dotnet-resx.mjs +64 -0
- package/dist/presets/easy-localization.d.mts +6 -0
- package/dist/presets/easy-localization.mjs +36 -0
- package/dist/presets/ember-intl.d.mts +5 -0
- package/dist/presets/ember-intl.mjs +31 -0
- package/dist/presets/fluent-react.d.mts +5 -0
- package/dist/presets/fluent-react.mjs +46 -0
- package/dist/presets/fluent-vue.d.mts +5 -0
- package/dist/presets/fluent-vue.mjs +51 -0
- package/dist/presets/flutter-translate.d.mts +6 -0
- package/dist/presets/flutter-translate.mjs +30 -0
- package/dist/presets/flutter.d.mts +6 -0
- package/dist/presets/flutter.mjs +21 -0
- package/dist/presets/general.d.mts +6 -0
- package/dist/presets/general.mjs +17 -0
- package/dist/presets/globalize.d.mts +5 -0
- package/dist/presets/globalize.mjs +25 -0
- package/dist/presets/gravity-ui-i18n.d.mts +6 -0
- package/dist/presets/gravity-ui-i18n.mjs +41 -0
- package/dist/presets/i18n-tag.d.mts +5 -0
- package/dist/presets/i18n-tag.mjs +21 -0
- package/dist/presets/i18next-shopify.d.mts +6 -0
- package/dist/presets/i18next-shopify.mjs +23 -0
- package/dist/presets/i18next.d.mts +5 -0
- package/dist/presets/i18next.mjs +10 -0
- package/dist/presets/i18nice.d.mts +6 -0
- package/dist/presets/i18nice.mjs +29 -0
- package/dist/presets/jekyll.d.mts +5 -0
- package/dist/presets/jekyll.mjs +23 -0
- package/dist/presets/laravel-vue-i18n.d.mts +6 -0
- package/dist/presets/laravel-vue-i18n.mjs +54 -0
- package/dist/presets/laravel.d.mts +6 -0
- package/dist/presets/laravel.mjs +23 -0
- package/dist/presets/lingui.d.mts +5 -0
- package/dist/presets/lingui.mjs +61 -0
- package/dist/presets/next-international.d.mts +5 -0
- package/dist/presets/next-international.mjs +27 -0
- package/dist/presets/next-intl.d.mts +5 -0
- package/dist/presets/next-intl.mjs +55 -0
- package/dist/presets/next-translate.d.mts +5 -0
- package/dist/presets/next-translate.mjs +53 -0
- package/dist/presets/ngx-translate.d.mts +5 -0
- package/dist/presets/ngx-translate.mjs +41 -0
- package/dist/presets/nuxt-i18n-micro.d.mts +5 -0
- package/dist/presets/nuxt-i18n-micro.mjs +81 -0
- package/dist/presets/nuxt-i18n.d.mts +5 -0
- package/dist/presets/nuxt-i18n.mjs +23 -0
- package/dist/presets/paraglide.d.mts +5 -0
- package/dist/presets/paraglide.mjs +38 -0
- package/dist/presets/php-gettext.d.mts +6 -0
- package/dist/presets/php-gettext.mjs +27 -0
- package/dist/presets/php-joomla.d.mts +6 -0
- package/dist/presets/php-joomla.mjs +22 -0
- package/dist/presets/polyglot.d.mts +5 -0
- package/dist/presets/polyglot.mjs +23 -0
- package/dist/presets/python-gettext.d.mts +6 -0
- package/dist/presets/python-gettext.mjs +44 -0
- package/dist/presets/react-i18next.d.mts +5 -0
- package/dist/presets/react-i18next.mjs +67 -0
- package/dist/presets/react-intl.d.mts +5 -0
- package/dist/presets/react-intl.mjs +47 -0
- package/dist/presets/ruby-i18n-js.d.mts +5 -0
- package/dist/presets/ruby-i18n-js.mjs +19 -0
- package/dist/presets/ruby-rails.d.mts +7 -0
- package/dist/presets/ruby-rails.mjs +44 -0
- package/dist/presets/solid-primitives-i18n.d.mts +5 -0
- package/dist/presets/solid-primitives-i18n.mjs +29 -0
- package/dist/presets/svelte-i18n.d.mts +5 -0
- package/dist/presets/svelte-i18n.mjs +33 -0
- package/dist/presets/svelte-i18next.d.mts +5 -0
- package/dist/presets/svelte-i18next.mjs +27 -0
- package/dist/presets/transloco.d.mts +5 -0
- package/dist/presets/transloco.mjs +44 -0
- package/dist/presets/typesafe-i18n.d.mts +6 -0
- package/dist/presets/typesafe-i18n.mjs +61 -0
- package/dist/presets/ui5.d.mts +5 -0
- package/dist/presets/ui5.mjs +35 -0
- package/dist/presets/vscode-extension.d.mts +5 -0
- package/dist/presets/vscode-extension.mjs +53 -0
- package/dist/presets/vue-i18n.d.mts +5 -0
- package/dist/presets/vue-i18n.mjs +59 -0
- package/dist/presets.d.mts +7 -54
- package/dist/presets.mjs +346 -1
- package/dist/reporters/github.d.mts +6 -0
- package/dist/reporters/github.mjs +27 -0
- package/dist/reporters/json.d.mts +6 -0
- package/dist/reporters/json.mjs +24 -0
- package/dist/reporters/markdown.d.mts +6 -0
- package/dist/reporters/markdown.mjs +37 -0
- package/dist/reporters/pretty.d.mts +6 -0
- package/dist/reporters/pretty.mjs +64 -0
- package/dist/reporters/sarif.d.mts +6 -0
- package/dist/reporters/sarif.mjs +48 -0
- package/dist/reporters.d.mts +5 -12
- package/dist/reporters.mjs +8 -218
- package/dist/reviews.d.mts +6 -0
- package/dist/reviews.mjs +35 -0
- package/dist/scanners/astro.d.mts +6 -0
- package/dist/scanners/astro.mjs +256 -0
- package/dist/scanners/js.d.mts +6 -0
- package/dist/scanners/js.mjs +33 -0
- package/dist/scanners/regex-scopes.d.mts +14 -0
- package/dist/scanners/regex-scopes.mjs +41 -0
- package/dist/scanners/regex.d.mts +9 -0
- package/dist/{regex-AYVhuSb6.mjs → scanners/regex.mjs} +2 -40
- package/dist/scanners/svelte.d.mts +6 -0
- package/dist/{scanners-DhnnVp7s.mjs → scanners/svelte.mjs} +3 -3
- package/dist/scanners/vue.d.mts +6 -0
- package/dist/scanners/vue.mjs +172 -0
- package/dist/scanners.d.mts +9 -50
- package/dist/scanners.mjs +36 -4
- package/dist/sfc-blocks-DaGKDZsb.mjs +213 -0
- package/dist/shared-C7ceptwi.mjs +55 -0
- package/dist/shared-D-tbsYmc.mjs +30 -0
- package/dist/shared-D4NJBKEP.mjs +17 -0
- package/dist/shared-Tq06G0gp.mjs +6 -0
- package/dist/shared-meYeVckh.mjs +11 -0
- package/dist/vue-compiler-0sfLIiiL.mjs +8 -0
- package/package.json +68 -3
- package/dist/formats-CFkM5co0.mjs +0 -1370
- package/dist/presets-Co5SlnKr.mjs +0 -1187
- package/dist/sfc-blocks-BqQ8m9rX.mjs +0 -161
- package/dist/yaml-plugin.d.mts +0 -8
- package/dist/yaml-plugin.mjs +0 -68
package/dist/presets.mjs
CHANGED
|
@@ -1 +1,346 @@
|
|
|
1
|
-
|
|
1
|
+
import { t as dependsOn } from "./shared-D4NJBKEP.mjs";
|
|
2
|
+
//#region src/presets/cargo-i18n/entry.ts
|
|
3
|
+
const entry$42 = {
|
|
4
|
+
detect: dependsOn(["i18n-embed-fl", "i18n-embed"]),
|
|
5
|
+
load: () => import("./presets/cargo-i18n.mjs")
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/presets/chrome-extension/entry.ts
|
|
9
|
+
/** A Chrome or WebExtension manifest that declares `default_locale`. */
|
|
10
|
+
async function hasDefaultLocale(ctx) {
|
|
11
|
+
for (const path of [
|
|
12
|
+
"manifest.json",
|
|
13
|
+
"src/manifest.json",
|
|
14
|
+
"public/manifest.json"
|
|
15
|
+
]) if ((await ctx.host.readFile(path))?.includes("\"default_locale\"")) return true;
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const entry$41 = {
|
|
19
|
+
detect: hasDefaultLocale,
|
|
20
|
+
load: () => import("./presets/chrome-extension.mjs")
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/presets/dotnet-resx/entry.ts
|
|
24
|
+
const entry$40 = {
|
|
25
|
+
detect: async (ctx) => await ctx.fileExists("**/*.{csproj,vbproj,fsproj}") && await ctx.fileExists("**/*.resx"),
|
|
26
|
+
load: () => import("./presets/dotnet-resx.mjs")
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/presets/easy-localization/entry.ts
|
|
30
|
+
const entry$39 = {
|
|
31
|
+
detect: dependsOn(["easy_localization"]),
|
|
32
|
+
load: () => import("./presets/easy-localization.mjs")
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/presets/ember-intl/entry.ts
|
|
36
|
+
const entry$38 = {
|
|
37
|
+
detect: dependsOn(["ember-intl"]),
|
|
38
|
+
load: () => import("./presets/ember-intl.mjs")
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/presets/fluent-react/entry.ts
|
|
42
|
+
const entry$37 = {
|
|
43
|
+
detect: dependsOn(["@fluent/react"]),
|
|
44
|
+
load: () => import("./presets/fluent-react.mjs")
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/presets/fluent-vue/entry.ts
|
|
48
|
+
const entry$36 = {
|
|
49
|
+
detect: dependsOn([
|
|
50
|
+
"fluent-vue",
|
|
51
|
+
"fluent-vue-loader",
|
|
52
|
+
"rollup-plugin-fluent-vue",
|
|
53
|
+
"unplugin-fluent-vue"
|
|
54
|
+
]),
|
|
55
|
+
load: () => import("./presets/fluent-vue.mjs")
|
|
56
|
+
};
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/presets/flutter-translate/entry.ts
|
|
59
|
+
const entry$35 = {
|
|
60
|
+
detect: dependsOn(["flutter_translate"]),
|
|
61
|
+
load: () => import("./presets/flutter-translate.mjs")
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/presets/flutter/entry.ts
|
|
65
|
+
const entry$34 = {
|
|
66
|
+
detect: dependsOn(["flutter_i18n"]),
|
|
67
|
+
load: () => import("./presets/flutter.mjs")
|
|
68
|
+
};
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/presets/general/entry.ts
|
|
71
|
+
const entry$33 = {
|
|
72
|
+
detect: () => true,
|
|
73
|
+
load: () => import("./presets/general.mjs")
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/presets/globalize/entry.ts
|
|
77
|
+
const entry$32 = {
|
|
78
|
+
detect: dependsOn(["globalize"]),
|
|
79
|
+
load: () => import("./presets/globalize.mjs")
|
|
80
|
+
};
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/presets/gravity-ui-i18n/entry.ts
|
|
83
|
+
const entry$31 = {
|
|
84
|
+
detect: dependsOn(["@gravity-ui/i18n"]),
|
|
85
|
+
load: () => import("./presets/gravity-ui-i18n.mjs")
|
|
86
|
+
};
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/presets/i18n-tag/entry.ts
|
|
89
|
+
const entry$30 = {
|
|
90
|
+
detect: dependsOn(["es2015-i18n-tag"]),
|
|
91
|
+
load: () => import("./presets/i18n-tag.mjs")
|
|
92
|
+
};
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/presets/i18next-shopify/entry.ts
|
|
95
|
+
const entry$29 = {
|
|
96
|
+
detect: dependsOn(["@shopify/i18next-shopify"]),
|
|
97
|
+
load: () => import("./presets/i18next-shopify.mjs")
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/presets/i18next/entry.ts
|
|
101
|
+
const entry$28 = {
|
|
102
|
+
detect: dependsOn(["i18next"]),
|
|
103
|
+
load: () => import("./presets/i18next.mjs")
|
|
104
|
+
};
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/presets/i18nice/entry.ts
|
|
107
|
+
const entry$27 = {
|
|
108
|
+
detect: dependsOn(["i18nice", "python-i18n"]),
|
|
109
|
+
load: () => import("./presets/i18nice.mjs")
|
|
110
|
+
};
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/presets/jekyll/entry.ts
|
|
113
|
+
const entry$26 = {
|
|
114
|
+
detect: dependsOn(["jekyll-multiple-languages-plugin"]),
|
|
115
|
+
load: () => import("./presets/jekyll.mjs")
|
|
116
|
+
};
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/presets/laravel-vue-i18n/entry.ts
|
|
119
|
+
const entry$25 = {
|
|
120
|
+
detect: dependsOn(["laravel-vue-i18n"]),
|
|
121
|
+
load: () => import("./presets/laravel-vue-i18n.mjs")
|
|
122
|
+
};
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/presets/laravel/entry.ts
|
|
125
|
+
const entry$24 = {
|
|
126
|
+
detect: dependsOn(["laravel/framework"]),
|
|
127
|
+
exclusive: true,
|
|
128
|
+
load: () => import("./presets/laravel.mjs")
|
|
129
|
+
};
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/presets/lingui/entry.ts
|
|
132
|
+
const entry$23 = {
|
|
133
|
+
detect: dependsOn([
|
|
134
|
+
"@lingui/core",
|
|
135
|
+
"@lingui/react",
|
|
136
|
+
"@lingui/macro"
|
|
137
|
+
]),
|
|
138
|
+
load: () => import("./presets/lingui.mjs")
|
|
139
|
+
};
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/presets/next-international/entry.ts
|
|
142
|
+
const entry$22 = {
|
|
143
|
+
detect: dependsOn(["next-international"]),
|
|
144
|
+
load: () => import("./presets/next-international.mjs")
|
|
145
|
+
};
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/presets/next-intl/entry.ts
|
|
148
|
+
const entry$21 = {
|
|
149
|
+
detect: dependsOn(["next-intl", "use-intl"]),
|
|
150
|
+
load: () => import("./presets/next-intl.mjs")
|
|
151
|
+
};
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/presets/next-translate/entry.ts
|
|
154
|
+
const entry$20 = {
|
|
155
|
+
detect: dependsOn(["next-translate"]),
|
|
156
|
+
load: () => import("./presets/next-translate.mjs")
|
|
157
|
+
};
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/presets/ngx-translate/entry.ts
|
|
160
|
+
const entry$19 = {
|
|
161
|
+
detect: dependsOn(["@ngx-translate/core"]),
|
|
162
|
+
load: () => import("./presets/ngx-translate.mjs")
|
|
163
|
+
};
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/presets/nuxt-i18n-micro/entry.ts
|
|
166
|
+
const entry$18 = {
|
|
167
|
+
detect: dependsOn(["nuxt-i18n-micro"]),
|
|
168
|
+
load: () => import("./presets/nuxt-i18n-micro.mjs")
|
|
169
|
+
};
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/presets/nuxt-i18n/entry.ts
|
|
172
|
+
const entry$17 = {
|
|
173
|
+
detect: dependsOn(["@nuxtjs/i18n", "nuxt-i18n"]),
|
|
174
|
+
load: () => import("./presets/nuxt-i18n.mjs")
|
|
175
|
+
};
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region src/presets/paraglide/entry.ts
|
|
178
|
+
const entry$16 = {
|
|
179
|
+
detect: dependsOn([
|
|
180
|
+
"@inlang/paraglide-js",
|
|
181
|
+
"@inlang/paraglide-sveltekit",
|
|
182
|
+
"@inlang/paraglide-next",
|
|
183
|
+
"@inlang/paraglide-astro",
|
|
184
|
+
"@inlang/paraglide-vite"
|
|
185
|
+
]),
|
|
186
|
+
load: () => import("./presets/paraglide.mjs")
|
|
187
|
+
};
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/presets/php-gettext/entry.ts
|
|
190
|
+
const entry$15 = {
|
|
191
|
+
exclusive: true,
|
|
192
|
+
load: () => import("./presets/php-gettext.mjs")
|
|
193
|
+
};
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/presets/php-joomla/entry.ts
|
|
196
|
+
const entry$14 = {
|
|
197
|
+
detect: dependsOn(["joomla/application", "joomla/cms"]),
|
|
198
|
+
load: () => import("./presets/php-joomla.mjs")
|
|
199
|
+
};
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region src/presets/polyglot/entry.ts
|
|
202
|
+
const entry$13 = {
|
|
203
|
+
detect: dependsOn(["node-polyglot"]),
|
|
204
|
+
load: () => import("./presets/polyglot.mjs")
|
|
205
|
+
};
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/presets/python-gettext/entry.ts
|
|
208
|
+
const entry$12 = {
|
|
209
|
+
detect: dependsOn(["django", "flask-babel"]),
|
|
210
|
+
load: () => import("./presets/python-gettext.mjs")
|
|
211
|
+
};
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/presets/react-i18next/entry.ts
|
|
214
|
+
const entry$11 = {
|
|
215
|
+
detect: dependsOn(["react-i18next", "next-i18next"]),
|
|
216
|
+
load: () => import("./presets/react-i18next.mjs")
|
|
217
|
+
};
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/presets/react-intl/entry.ts
|
|
220
|
+
const entry$10 = {
|
|
221
|
+
detect: dependsOn(["react-intl"], ["@formatjs/"]),
|
|
222
|
+
load: () => import("./presets/react-intl.mjs")
|
|
223
|
+
};
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/presets/ruby-i18n-js/entry.ts
|
|
226
|
+
const entry$9 = {
|
|
227
|
+
detect: dependsOn(["i18n-js"]),
|
|
228
|
+
load: () => import("./presets/ruby-i18n-js.mjs")
|
|
229
|
+
};
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/presets/ruby-rails/entry.ts
|
|
232
|
+
const entry$8 = {
|
|
233
|
+
detect: dependsOn([
|
|
234
|
+
"rails",
|
|
235
|
+
"rails-i18n",
|
|
236
|
+
"railties"
|
|
237
|
+
]),
|
|
238
|
+
load: () => import("./presets/ruby-rails.mjs")
|
|
239
|
+
};
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/presets/solid-primitives-i18n/entry.ts
|
|
242
|
+
const entry$7 = {
|
|
243
|
+
detect: dependsOn(["@solid-primitives/i18n"]),
|
|
244
|
+
load: () => import("./presets/solid-primitives-i18n.mjs")
|
|
245
|
+
};
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/presets/svelte-i18n/entry.ts
|
|
248
|
+
const entry$6 = {
|
|
249
|
+
detect: dependsOn([
|
|
250
|
+
"svelte-i18n",
|
|
251
|
+
"sveltekit-i18n",
|
|
252
|
+
"@sveltekit-i18n/base"
|
|
253
|
+
]),
|
|
254
|
+
load: () => import("./presets/svelte-i18n.mjs")
|
|
255
|
+
};
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/presets/svelte-i18next/entry.ts
|
|
258
|
+
const entry$5 = {
|
|
259
|
+
detect: dependsOn(["svelte-i18next"]),
|
|
260
|
+
load: () => import("./presets/svelte-i18next.mjs")
|
|
261
|
+
};
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/presets/transloco/entry.ts
|
|
264
|
+
const entry$4 = {
|
|
265
|
+
detect: dependsOn(["@jsverse/transloco", "@ngneat/transloco"]),
|
|
266
|
+
load: () => import("./presets/transloco.mjs")
|
|
267
|
+
};
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region src/presets/typesafe-i18n/entry.ts
|
|
270
|
+
const entry$3 = {
|
|
271
|
+
detect: dependsOn(["typesafe-i18n"]),
|
|
272
|
+
load: () => import("./presets/typesafe-i18n.mjs")
|
|
273
|
+
};
|
|
274
|
+
//#endregion
|
|
275
|
+
//#region src/presets/ui5/entry.ts
|
|
276
|
+
const entry$2 = {
|
|
277
|
+
detect: dependsOn(["@ui5/cli"]),
|
|
278
|
+
load: () => import("./presets/ui5.mjs")
|
|
279
|
+
};
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/presets/index.ts
|
|
282
|
+
/**
|
|
283
|
+
* Built-in presets by name, in detection order: every i18n-ally framework has one.
|
|
284
|
+
* A preset is a folder. `<name>/entry.ts` holds its detection and a `load` for `<name>/index.ts`,
|
|
285
|
+
* the preset itself; it is cheap and always loaded, while the preset is imported only when detection passes
|
|
286
|
+
* or the config lists it.
|
|
287
|
+
* Presets that share plugins (react-i18next, svelte-i18next and i18next) apply them once.
|
|
288
|
+
*/
|
|
289
|
+
const presets = {
|
|
290
|
+
"nuxt-i18n": entry$17,
|
|
291
|
+
"nuxt-i18n-micro": entry$18,
|
|
292
|
+
"vue-i18n": {
|
|
293
|
+
detect: dependsOn([
|
|
294
|
+
"vue-i18n",
|
|
295
|
+
"vuex-i18n",
|
|
296
|
+
"petite-vue-i18n",
|
|
297
|
+
"vue-i18n-bridge"
|
|
298
|
+
], ["@intlify/"]),
|
|
299
|
+
load: () => import("./presets/vue-i18n.mjs")
|
|
300
|
+
},
|
|
301
|
+
"fluent-vue": entry$36,
|
|
302
|
+
"fluent-react": entry$37,
|
|
303
|
+
"i18next-shopify": entry$29,
|
|
304
|
+
"react-i18next": entry$11,
|
|
305
|
+
"svelte-i18next": entry$5,
|
|
306
|
+
"next-translate": entry$20,
|
|
307
|
+
"next-international": entry$22,
|
|
308
|
+
"i18next": entry$28,
|
|
309
|
+
"next-intl": entry$21,
|
|
310
|
+
"react-intl": entry$10,
|
|
311
|
+
"svelte-i18n": entry$6,
|
|
312
|
+
"solid-primitives-i18n": entry$7,
|
|
313
|
+
"paraglide": entry$16,
|
|
314
|
+
"gravity-ui-i18n": entry$31,
|
|
315
|
+
"typesafe-i18n": entry$3,
|
|
316
|
+
"ngx-translate": entry$19,
|
|
317
|
+
"transloco": entry$4,
|
|
318
|
+
"lingui": entry$23,
|
|
319
|
+
"ember-intl": entry$38,
|
|
320
|
+
"polyglot": entry$13,
|
|
321
|
+
"globalize": entry$32,
|
|
322
|
+
"i18n-tag": entry$30,
|
|
323
|
+
"ruby-i18n-js": entry$9,
|
|
324
|
+
"ui5": entry$2,
|
|
325
|
+
"chrome-extension": entry$41,
|
|
326
|
+
"vscode-extension": {
|
|
327
|
+
detect: (ctx) => ctx.hasAnyDependency(["vscode", "@types/vscode"]),
|
|
328
|
+
load: () => import("./presets/vscode-extension.mjs")
|
|
329
|
+
},
|
|
330
|
+
"laravel-vue-i18n": entry$25,
|
|
331
|
+
"laravel": entry$24,
|
|
332
|
+
"php-joomla": entry$14,
|
|
333
|
+
"php-gettext": entry$15,
|
|
334
|
+
"ruby-rails": entry$8,
|
|
335
|
+
"jekyll": entry$26,
|
|
336
|
+
"flutter": entry$34,
|
|
337
|
+
"easy-localization": entry$39,
|
|
338
|
+
"flutter-translate": entry$35,
|
|
339
|
+
"python-gettext": entry$12,
|
|
340
|
+
"i18nice": entry$27,
|
|
341
|
+
"cargo-i18n": entry$42,
|
|
342
|
+
"dotnet-resx": entry$40,
|
|
343
|
+
"general": entry$33
|
|
344
|
+
};
|
|
345
|
+
//#endregion
|
|
346
|
+
export { presets };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { toWireDiagnostic } from "@x18n/core";
|
|
2
|
+
//#region src/reporters/github.ts
|
|
3
|
+
function escapeProperty(text) {
|
|
4
|
+
return text.replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A").replace(/:/g, "%3A").replace(/,/g, "%2C");
|
|
5
|
+
}
|
|
6
|
+
function escapeData(text) {
|
|
7
|
+
return text.replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A");
|
|
8
|
+
}
|
|
9
|
+
/** GitHub Actions workflow commands, which become annotations on the PR. */
|
|
10
|
+
const githubReporter = {
|
|
11
|
+
id: "github",
|
|
12
|
+
report(inputs, ctx) {
|
|
13
|
+
const out = [];
|
|
14
|
+
for (const input of inputs) for (const d of input.diagnostics) {
|
|
15
|
+
const level = d.severity === "error" ? "error" : d.severity === "warning" ? "warning" : "notice";
|
|
16
|
+
const props = [`title=${escapeProperty(`x18n ${d.code}`)}`];
|
|
17
|
+
if (d.location) {
|
|
18
|
+
const wire = toWireDiagnostic(input.project, d, input.text).range;
|
|
19
|
+
props.unshift(`file=${escapeProperty(ctx.displayPath(d.location.path, input.project))}`, `line=${wire.line}`, `col=${wire.column}`, `endLine=${wire.endLine}`, `endColumn=${wire.endColumn}`);
|
|
20
|
+
}
|
|
21
|
+
out.push(`::${level} ${props.join(",")}::${escapeData(d.message)}`);
|
|
22
|
+
}
|
|
23
|
+
return out.length ? `${out.join("\n")}\n` : "";
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { githubReporter as default, githubReporter };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { envelope, toWireDiagnostic } from "@x18n/core";
|
|
2
|
+
//#region src/reporters/json.ts
|
|
3
|
+
/** The versioned JSON contract of `x18n check --json`. */
|
|
4
|
+
const jsonReporter = {
|
|
5
|
+
id: "json",
|
|
6
|
+
report(inputs) {
|
|
7
|
+
const diagnostics = inputs.flatMap((input) => input.diagnostics.map((d) => toWireDiagnostic(input.project, d, input.text)));
|
|
8
|
+
const data = { projects: inputs.map((input) => ({
|
|
9
|
+
name: input.project,
|
|
10
|
+
summary: input.summary,
|
|
11
|
+
coverage: input.coverage.map((c) => ({
|
|
12
|
+
locale: c.locale,
|
|
13
|
+
total: c.total,
|
|
14
|
+
translated: c.translated,
|
|
15
|
+
missing: c.missing.length,
|
|
16
|
+
empty: c.empty.length,
|
|
17
|
+
outdated: c.outdated.length
|
|
18
|
+
}))
|
|
19
|
+
})) };
|
|
20
|
+
return `${JSON.stringify(envelope("check", data, diagnostics), null, 2)}\n`;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { jsonReporter as default, jsonReporter };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { i as totals, r as plural } from "../shared-D-tbsYmc.mjs";
|
|
2
|
+
import { createLineIndex } from "@x18n/core";
|
|
3
|
+
//#region src/reporters/markdown.ts
|
|
4
|
+
function escapeCell(text) {
|
|
5
|
+
return text.replace(/\|/g, "\\|").replace(/\n/g, " ");
|
|
6
|
+
}
|
|
7
|
+
/** Summary and tables for PR comments and agent context. */
|
|
8
|
+
const markdownReporter = {
|
|
9
|
+
id: "markdown",
|
|
10
|
+
report(inputs, ctx) {
|
|
11
|
+
const sum = totals(inputs);
|
|
12
|
+
const out = [
|
|
13
|
+
"## x18n check",
|
|
14
|
+
"",
|
|
15
|
+
`**${plural(sum.errors, "error")}**, ${plural(sum.warnings, "warning")} in ${plural(sum.files, "file")}.`,
|
|
16
|
+
""
|
|
17
|
+
];
|
|
18
|
+
for (const input of inputs) {
|
|
19
|
+
if (inputs.length > 1) out.push(`### ${input.project}`, "");
|
|
20
|
+
out.push("| Locale | Translated | Missing | Empty |", "| --- | --- | --- | --- |");
|
|
21
|
+
for (const c of input.coverage) out.push(`| ${c.locale} | ${c.translated}/${c.total} | ${c.missing.length} | ${c.empty.length} |`);
|
|
22
|
+
out.push("");
|
|
23
|
+
if (input.diagnostics.length === 0) continue;
|
|
24
|
+
out.push("| Severity | Check | Location | Message |", "| --- | --- | --- | --- |");
|
|
25
|
+
for (const d of input.diagnostics.slice(0, 200)) {
|
|
26
|
+
const line = d.location ? createLineIndex(input.text(d.location.path) ?? "").position(d.location.range.start).line + 1 : void 0;
|
|
27
|
+
const where = d.location ? `\`${ctx.displayPath(d.location.path, input.project)}:${line}\`` : "";
|
|
28
|
+
out.push(`| ${d.severity} | \`${d.code}\` | ${where} | ${escapeCell(d.message)} |`);
|
|
29
|
+
}
|
|
30
|
+
if (input.diagnostics.length > 200) out.push("", `_${input.diagnostics.length - 200} more not shown._`);
|
|
31
|
+
out.push("");
|
|
32
|
+
}
|
|
33
|
+
return `${out.join("\n")}\n`;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { markdownReporter as default, markdownReporter };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Reporter } from "@x18n/core";
|
|
2
|
+
//#region src/reporters/pretty.d.ts
|
|
3
|
+
/** `path:line:col`, then the severity, message and check, a code frame, and a summary. */
|
|
4
|
+
export declare const prettyReporter: Reporter;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { prettyReporter as default };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { i as totals, n as paint, r as plural, t as codes } from "../shared-D-tbsYmc.mjs";
|
|
2
|
+
import { createLineIndex } from "@x18n/core";
|
|
3
|
+
//#region src/reporters/pretty.ts
|
|
4
|
+
const severityColor = {
|
|
5
|
+
error: "red",
|
|
6
|
+
warning: "yellow",
|
|
7
|
+
info: "blue",
|
|
8
|
+
hint: "gray"
|
|
9
|
+
};
|
|
10
|
+
/** The severity as a highlighted label, like ` ERROR `. */
|
|
11
|
+
function badge(ctx, severity) {
|
|
12
|
+
const label = ` ${severity.toUpperCase()} `;
|
|
13
|
+
return ctx.color ? `\u001B[1;7;${codes[severityColor[severity]]}m${label}\u001B[0m` : label;
|
|
14
|
+
}
|
|
15
|
+
/** The marked line with one line of context on each side, and `~` under the range. */
|
|
16
|
+
function codeFrame(text, start, end, severity, ctx) {
|
|
17
|
+
const index = createLineIndex(text);
|
|
18
|
+
const from = index.position(start);
|
|
19
|
+
const to = index.position(end);
|
|
20
|
+
const first = Math.max(0, from.line - 1);
|
|
21
|
+
const last = Math.min(index.lineCount - 1, from.line + 1);
|
|
22
|
+
const pad = String(last + 1).length;
|
|
23
|
+
const gutter = (n) => `${paint(ctx, "gray", n.padStart(pad))} ${paint(ctx, "gray", "│")} `;
|
|
24
|
+
const width = Math.max(1, (to.line === from.line ? to.character : index.line(from.line).length) - from.character);
|
|
25
|
+
const lines = [];
|
|
26
|
+
for (let n = first; n <= last; n++) {
|
|
27
|
+
const line = index.line(n);
|
|
28
|
+
lines.push(`${gutter(String(n + 1))}${n === from.line ? line : paint(ctx, "gray", line)}`);
|
|
29
|
+
if (n === from.line) lines.push(`${gutter("")}${" ".repeat(from.character)}${paint(ctx, severityColor[severity], "~".repeat(width))}`);
|
|
30
|
+
}
|
|
31
|
+
return lines.join("\n");
|
|
32
|
+
}
|
|
33
|
+
/** `path:line:col`, then the severity, message and check, a code frame, and a summary. */
|
|
34
|
+
const prettyReporter = {
|
|
35
|
+
id: "pretty",
|
|
36
|
+
report(inputs, ctx) {
|
|
37
|
+
const blocks = [];
|
|
38
|
+
for (const input of inputs) for (const d of input.diagnostics) {
|
|
39
|
+
const head = `${badge(ctx, d.severity)} ${d.message} ${paint(ctx, "gray", d.code)}`;
|
|
40
|
+
if (!d.location) {
|
|
41
|
+
blocks.push(head);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const text = input.text(d.location.path);
|
|
45
|
+
const position = createLineIndex(text ?? "").position(d.location.range.start);
|
|
46
|
+
const where = `${paint(ctx, "cyan", ctx.displayPath(d.location.path, input.project))}${paint(ctx, "gray", `:${position.line + 1}:${position.character + 1}`)}`;
|
|
47
|
+
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)}` : "";
|
|
48
|
+
blocks.push(`${where}\n${head}${frame}`);
|
|
49
|
+
}
|
|
50
|
+
const sum = totals(inputs);
|
|
51
|
+
if (sum.errors + sum.warnings === 0) blocks.push(paint(ctx, "gray", "Found no errors."));
|
|
52
|
+
else {
|
|
53
|
+
const parts = [
|
|
54
|
+
sum.errors ? paint(ctx, "red", `✖ ${plural(sum.errors, "error")}`) : "",
|
|
55
|
+
sum.warnings ? paint(ctx, "yellow", `⚠ ${plural(sum.warnings, "warning")}`) : "",
|
|
56
|
+
paint(ctx, "gray", plural(sum.files, "file"))
|
|
57
|
+
].filter(Boolean);
|
|
58
|
+
blocks.push(parts.join(" "));
|
|
59
|
+
}
|
|
60
|
+
return `${blocks.join("\n\n")}\n`;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { prettyReporter as default, prettyReporter };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { toWireDiagnostic } from "@x18n/core";
|
|
2
|
+
//#region src/reporters/sarif.ts
|
|
3
|
+
/** SARIF 2.1.0 for code scanning. */
|
|
4
|
+
const sarifReporter = {
|
|
5
|
+
id: "sarif",
|
|
6
|
+
report(inputs, ctx) {
|
|
7
|
+
const all = inputs.flatMap((input) => input.diagnostics.map((d) => ({
|
|
8
|
+
input,
|
|
9
|
+
d
|
|
10
|
+
})));
|
|
11
|
+
const rules = [...new Set(all.map(({ d }) => d.code))].sort();
|
|
12
|
+
const results = all.map(({ input, d }) => {
|
|
13
|
+
const wire = toWireDiagnostic(input.project, d, input.text);
|
|
14
|
+
return {
|
|
15
|
+
ruleId: d.code,
|
|
16
|
+
level: d.severity === "error" ? "error" : d.severity === "warning" ? "warning" : "note",
|
|
17
|
+
message: { text: d.message },
|
|
18
|
+
locations: d.location && wire.range ? [{ physicalLocation: {
|
|
19
|
+
artifactLocation: { uri: ctx.displayPath(d.location.path, input.project) },
|
|
20
|
+
region: {
|
|
21
|
+
startLine: wire.range.line,
|
|
22
|
+
startColumn: wire.range.column,
|
|
23
|
+
endLine: wire.range.endLine,
|
|
24
|
+
endColumn: wire.range.endColumn
|
|
25
|
+
}
|
|
26
|
+
} }] : []
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
const log = {
|
|
30
|
+
$schema: "https://json.schemastore.org/sarif-2.1.0.json",
|
|
31
|
+
version: "2.1.0",
|
|
32
|
+
runs: [{
|
|
33
|
+
tool: { driver: {
|
|
34
|
+
name: "x18n",
|
|
35
|
+
informationUri: "https://x18n.antfu.dev",
|
|
36
|
+
rules: rules.map((id) => ({
|
|
37
|
+
id,
|
|
38
|
+
helpUri: `https://x18n.antfu.dev/checks/${id}`
|
|
39
|
+
}))
|
|
40
|
+
} },
|
|
41
|
+
results
|
|
42
|
+
}]
|
|
43
|
+
};
|
|
44
|
+
return `${JSON.stringify(log, null, 2)}\n`;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export { sarifReporter as default, sarifReporter };
|
package/dist/reporters.d.mts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReporterLoader } from "@x18n/core";
|
|
2
2
|
//#region src/reporters/index.d.ts
|
|
3
|
-
/**
|
|
4
|
-
export declare const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/** Summary and tables for PR comments and agent context. */
|
|
8
|
-
export declare const markdownReporter: Reporter;
|
|
9
|
-
/** GitHub Actions workflow commands, which become annotations on the PR. */
|
|
10
|
-
export declare const githubReporter: Reporter;
|
|
11
|
-
/** SARIF 2.1.0 for code scanning. */
|
|
12
|
-
export declare const sarifReporter: Reporter;
|
|
13
|
-
export declare function reporters(): Plugin;
|
|
3
|
+
/** Reporters by id. Each is also its own module, `@x18n/builtins/reporters/<id>`. */
|
|
4
|
+
export declare const reporters: {
|
|
5
|
+
readonly [id: string]: ReporterLoader;
|
|
6
|
+
};
|
|
14
7
|
//#endregion
|