Skip to content

Commit 39216c3

Browse files
committed
feat: add WASM badge
fix: Update CONTRIBUTING.md i18n: add `package.metrics.wasm` key
1 parent b9623a9 commit 39216c3

File tree

4 files changed

+49
-33
lines changed

4 files changed

+49
-33
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,11 +462,8 @@ The following scripts help manage translation files. `en.json` is the reference
462462

463463
| Command | Description |
464464
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
465-
| `pnpm i18n:check [locale]` | Compares `en.json` with other locale files. Shows missing and extra keys. Optionally filter output by locale (e.g. `pnpm i18n:check ja-JP`). |
466-
| `pnpm i18n:check:fix [locale]` | Same as check, but adds missing keys to other locales with English placeholders. |
467-
| `pnpm i18n:report` | Audits translation keys against code usage in `.vue` and `.ts` files. Reports missing keys (used in code but not in locale), unused keys (in locale but not in code), and dynamic keys. |
465+
| `pnpm i18n:check:fix [locale]` | Adds missing keys to other locales with English placeholders. |
468466
| `pnpm i18n:report:fix` | Removes unused keys from `en.json` and all other locale files. |
469-
| `pnpm i18n:schema` | Generates a JSON Schema from `en.json` at `i18n/schema.json`. Locale files reference this schema for IDE validation and autocompletion. |
470467

471468
### Adding a new locale
472469

app/components/Package/MetricsBadges.vue

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ const hasCjs = computed(() => {
2626
return analysis.value.moduleFormat === 'cjs' || analysis.value.moduleFormat === 'dual'
2727
})
2828
29+
const isWasm = computed(() => {
30+
if (!analysis.value) return false
31+
return analysis.value.moduleFormat === 'wasm'
32+
})
33+
2934
// Types support
3035
const hasTypes = computed(() => {
3136
if (!analysis.value) return false
@@ -80,35 +85,45 @@ const typesHref = computed(() => {
8085
</TooltipApp>
8186
</li>
8287

83-
<!-- ESM badge (show with X if missing) -->
84-
<li class="contents">
85-
<TooltipApp
86-
:text="isLoading ? '' : hasEsm ? $t('package.metrics.esm') : $t('package.metrics.no_esm')"
87-
strategy="fixed"
88-
>
89-
<TagStatic
90-
tabindex="0"
91-
:variant="hasEsm && !isLoading ? 'default' : 'ghost'"
92-
:classicon="
93-
isLoading ? 'i-svg-spinners:ring-resize ' : hasEsm ? 'i-lucide:check' : 'i-lucide:x'
94-
"
95-
>
96-
ESM
97-
</TagStatic>
98-
</TooltipApp>
99-
</li>
88+
<template v-if="isWasm && !isLoading">
89+
<li class="contents">
90+
<TooltipApp :text="$t('package.metrics.wasm')" strategy="fixed">
91+
<TagStatic tabindex="0" variant="default">WASM</TagStatic>
92+
</TooltipApp>
93+
</li>
94+
</template>
10095

101-
<!-- CJS badge -->
102-
<li v-if="isLoading || hasCjs" class="contents">
103-
<TooltipApp :text="isLoading ? '' : $t('package.metrics.cjs')" strategy="fixed">
104-
<TagStatic
105-
tabindex="0"
106-
:variant="isLoading ? 'ghost' : 'default'"
107-
:classicon="isLoading ? 'i-svg-spinners:ring-resize ' : 'i-lucide:check'"
96+
<template v-else>
97+
<!-- ESM badge (show with X if missing) -->
98+
<li class="contents">
99+
<TooltipApp
100+
:text="isLoading ? '' : hasEsm ? $t('package.metrics.esm') : $t('package.metrics.no_esm')"
101+
strategy="fixed"
108102
>
109-
CJS
110-
</TagStatic>
111-
</TooltipApp>
112-
</li>
103+
<TagStatic
104+
tabindex="0"
105+
:variant="hasEsm && !isLoading ? 'default' : 'ghost'"
106+
:classicon="
107+
isLoading ? 'i-svg-spinners:ring-resize ' : hasEsm ? 'i-lucide:check' : 'i-lucide:x'
108+
"
109+
>
110+
ESM
111+
</TagStatic>
112+
</TooltipApp>
113+
</li>
114+
115+
<!-- CJS badge -->
116+
<li v-if="isLoading || hasCjs" class="contents">
117+
<TooltipApp :text="isLoading ? '' : $t('package.metrics.cjs')" strategy="fixed">
118+
<TagStatic
119+
tabindex="0"
120+
:variant="isLoading ? 'ghost' : 'default'"
121+
:classicon="isLoading ? 'i-svg-spinners:ring-resize ' : 'i-lucide:check'"
122+
>
123+
CJS
124+
</TagStatic>
125+
</TooltipApp>
126+
</li>
127+
</template>
113128
</ul>
114129
</template>

i18n/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,9 @@
530530
},
531531
"metrics": {
532532
"esm": "ES Modules supported",
533-
"cjs": "CommonJS supported",
533+
"cjs": "CommonJS supported",,
534534
"no_esm": "ES Modules unsupported",
535+
"wasm": "Has Web Assembly"
535536
"types_label": "Types",
536537
"types_included": "Types included",
537538
"types_available": "Types available via {package}",

i18n/schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,6 +1600,9 @@
16001600
"no_esm": {
16011601
"type": "string"
16021602
},
1603+
"wasm": {
1604+
"type": "string"
1605+
},
16031606
"types_label": {
16041607
"type": "string"
16051608
},

0 commit comments

Comments
 (0)