Skip to content

feat(vitepress): add @i18n-micro/vitepress package - #247

Merged
s00d merged 8 commits into
mainfrom
feat/vitepress-i18n-package
Aug 5, 2026
Merged

feat(vitepress): add @i18n-micro/vitepress package#247
s00d merged 8 commits into
mainfrom
feat/vitepress-i18n-package

Conversation

@s00d

@s00d s00d commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • New workspace package @i18n-micro/vitepress for runtime i18n in VitePress docs (JSON dictionaries, $t / <I18nT> / <I18nLink>, path sync with built-in locales).
  • DX: withI18nMicro from /config + defineI18nTheme(DefaultTheme) — no manual import.meta.glob; virtual modules load root + optional pages/** dictionaries.
  • Complements (does not replace) VitePress markdown locales and vitepress-i18n theme chrome; serializable createI18nRoutingFromAdapter for the default globe menu.

Test plan

  • pnpm --filter @i18n-micro/vitepress test
  • pnpm --filter @i18n-micro/vitepress build && pnpm --filter @i18n-micro/vitepress check:package
  • pnpm --filter @i18n-micro/vitepress playground:build
  • Smoke playground: switch en↔fr via VP globe; check $t / page-scoped pageNote / <I18nLink> on /guide/demo and /fr/guide/demo
  • Skim docs: VitePress Package + news entry

Made with Cursor


Summary by cubic

Introduce @i18n-micro/vitepress, a VitePress integration for runtime i18n with JSON dictionaries, $t/components in markdown, and locale-aware routing synced with VitePress locales. Adds withI18nMicro (config) and defineI18nTheme (theme) to remove glob boilerplate and unify the navbar globe with a serializable i18nRouting.

  • New Features

    • New package @i18n-micro/vitepress with withI18nMicro (Node) that injects virtual:i18n-micro/config and virtual:i18n-micro/messages (root + optional pages/**).
    • defineI18nTheme(DefaultTheme) installs @i18n-micro/vue with $t, <I18nT>, <I18nLink>, <I18nSwitcher>; initial locale derives from the current path.
    • createVitePressRouterAdapter and createI18nRoutingFromAdapter implement prefix-except-default routing, support localeKeyToCode (VitePress keys vs i18n codes), and produce a serializable themeConfig.i18nRouting.
    • Extras: messagesFromGlob, Node loaders loadMessages/loadTranslationBuckets; docs and a playground included.
  • Bug Fixes

    • Correctly map VitePress locale keys (root, fr) to i18n codes while keeping VP keys in URLs; built-in globe and <I18nSwitcher> resolve paths the same way.
    • Stable path→locale sync across multiple Vue apps: per-app plugin install, re-chained router.onAfterRouteChange, and no routing strategy reset on re-enhance.
    • Preserve root dictionaries when routeMessages are provided; only unwrap real Vite module namespaces; stricter JSON loading; skip disk watchers when both maps are inline.
    • <I18nLink> active state ignores hash; query/hash preserved on locale switches.
    • Typecheck/package fixes: cast virtual:i18n-micro/* imports, relax test router setters, dual DTS outputs; version tooling skips cascading bumps for brand-new packages.
    • Release alignment: published @i18n-micro/vitepress@1.0.1 after bumping @i18n-micro/vue to 1.3.11.

Written for commit 941d981. Summary will update on new commits.

Review in cubic

Runtime dictionaries for VitePress MD/themes via defineI18nTheme +
withI18nMicro, path sync, page locales, and serializable i18nRouting.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@cursor

cursor Bot commented Aug 5, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 41 files

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

Re-trigger cubic

Comment thread packages/vitepress/src/router/adapter.ts Outdated
Comment thread packages/vitepress/src/define-theme.ts
Comment thread packages/vitepress/src/with-i18n-micro.ts Outdated
Comment thread packages/vitepress/src/define-theme.ts
Comment thread packages/vitepress/src/load-messages.ts Outdated
Comment thread packages/vitepress/src/index.ts Outdated
Comment thread packages/vitepress/tests/load-messages.test.ts Outdated
Comment thread packages/vitepress/tests/with-i18n-micro.test.ts
Comment thread packages/vitepress/playground/index.md Outdated
Comment thread packages/vitepress/package.json
s00d and others added 2 commits August 5, 2026 18:34
Map VP locale keys vs i18n codes, keep disk roots with
routeMessages, harden load/glob, re-chain enhanceApp, CI lint.

Co-authored-by: Cursor <cursoragent@cursor.com>
Cast virtual imports past Astro ambient clash; loosen test
router setters; cast dts plugin for duplicate Vite types.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 20 files (changes from recent commits).

Tip: instead of fixing issues one by one fix them all with cubic
Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread packages/vitepress/src/create.ts Outdated
Comment thread packages/vitepress/src/with-i18n-micro.ts
Comment thread packages/vitepress/src/messages-from-glob.ts Outdated
Comment thread packages/vitepress/src/with-i18n-micro.ts
Comment thread packages/vitepress/src/router/adapter.ts
Comment thread packages/vitepress/src/router/adapter.ts Outdated
s00d and others added 3 commits August 5, 2026 18:58
Per-app plugin install, stricter glob unwrap, routeName 2-arg,
skip full-inline disk watch; I18nLink active ignores hash.

Co-authored-by: Cursor <cursoragent@cursor.com>
check: versions requires dependents republish when vue pins change.
Co-authored-by: Cursor <cursoragent@cursor.com>
New packages have no baseline; first publish already pins
workspace deps — cascade must not demand an extra bump.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 12 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

Comment thread packages/vitepress/src/create.ts Outdated
vue setRoutingStrategy targets last-installed app; calling it
again from app1 after app2 install clobbers app2's adapter.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Requires human review: The core implementation of the new @i18n-micro/vitepress package is not visible in the truncated diffs; the change introduces complex virtual modules, router adapters, and theme integration that require human review.

Re-trigger cubic

Keep main news unchanged (no vitepress news entry).

Co-authored-by: Cursor <cursoragent@cursor.com>
@s00d
s00d merged commit 872e0b4 into main Aug 5, 2026
1 of 2 checks passed
@s00d
s00d deleted the feat/vitepress-i18n-package branch August 5, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant