Skip to content

Improve plugin docs#891

Open
yamcodes wants to merge 8 commits intomainfrom
improve-plugin-docs
Open

Improve plugin docs#891
yamcodes wants to merge 8 commits intomainfrom
improve-plugin-docs

Conversation

@yamcodes
Copy link
Copy Markdown
Owner

@yamcodes yamcodes commented May 2, 2026

Summary by CodeRabbit

  • Documentation

    • Reorganized Vite plugin docs into a Quickstart with clearer typing guidance and reordered pages
    • Improved Bun plugin docs with stepwise setup and a dedicated typing flow
    • Standardized “typesafety” terminology across guides
  • Improvements

    • Stronger editor typing for env access (better autocomplete and type checking)
    • Added JSX/TSX code-block support in docs and examples

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 2, 2026

⚠️ No Changeset found

Latest commit: 8fdef60

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added docs Improvements or additions to documentation arkenv Changes to the `arkenv` npm package. @arkenv/vite-plugin Issues or Pull Requests involving the Vite plugin for ArkEnv example Issues or Pull Requests concerning at least one ArkEnv example. (Found in the `examples/` directory) www Improvements or additions to arkenv.js.org tests This issue or PR is about adding, removing or changing tests labels May 2, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

Warning

Rate limit exceeded

@coderabbitai[bot] has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 35 minutes and 18 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 215fd851-2ea4-4a11-b61e-6edc1ec015bf

📥 Commits

Reviewing files that changed from the base of the PR and between baa79a9 and 8fdef60.

📒 Files selected for processing (1)
  • apps/www/content/docs/vite-plugin/index.mdx

Walkthrough

This PR standardizes wording to "typesafety", restructures Vite and Bun plugin docs into Quickstarts, adds the missing interface ImportMeta { readonly env: ImportMetaEnv } augmentation in examples/playgrounds, extends MDX/twoslash to support tsx/jsx, and reorders Vite doc pages in meta.json.

Changes

Docs + Typing & Example Wiring

Layer / File(s) Summary
Type augmentation (data shape)
apps/playgrounds/vite/src/vite-env.d.ts, examples/with-vite-react/src/vite-env.d.ts
Adds interface ImportMeta { readonly env: ImportMetaEnv } so import.meta.env is typed.
Docs & code examples (core content)
apps/www/content/docs/vite-plugin/index.mdx, apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx, apps/www/content/docs/bun-plugin/index.mdx, apps/www/content/docs/bun-plugin/typing-process-env.mdx, apps/playgrounds/vite/README.md, examples/with-vite-react/README.md
Rewrites plugin docs into Quickstarts, inserts typing snippets (including ImportMeta), adds "Add Typesafety" guidance, and updates example README wording from "Type Safety" → "Typesafety".
Integration / site config
apps/www/content/docs/vite-plugin/meta.json, apps/www/lib/twoslash-options.ts, apps/www/source.config.ts, apps/www/bin/twoslash-mdx.ts
Reorders Vite sidebar pages (typing-import-meta-env before arkenv-in-viteconfig); expands twoslash/code-language support and MDX rehype code langs to include tsx and jsx; updates twoslash extraction regex.
Specs / proposals / changelogs / tests (narrative / labels)
openspec/**, packages/arkenv/CHANGELOG.md, packages/vite-plugin/CHANGELOG.md, packages/arkenv/src/standard-mode.test.ts
Normalizes phrasing "type safety" → "typesafety" across specs, proposals, changelogs, and a test description; no behavioral code changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐇 A rabbit’s note on docs refined

I hopped through docs and tightened lines,
"typesafety" now in gentle shrines.
ImportMeta wears its coat so neat,
Examples sing, and codeblocks tweet —
Happy hops for docs complete. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Improve plugin docs' directly matches the primary change: comprehensive documentation improvements across Vite and Bun plugin guides, including restructured quickstart flows, type augmentation examples, and sidebar reordering.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improve-plugin-docs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 35 minutes and 18 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 2, 2026

Open in StackBlitz

npm i https://pkg.pr.new/arkenv@891
npm i https://pkg.pr.new/@arkenv/bun-plugin@891
npm i https://pkg.pr.new/@arkenv/fumadocs-ui@891
npm i https://pkg.pr.new/@arkenv/vite-plugin@891

commit: 8fdef60

@arkenv-bot
Copy link
Copy Markdown
Contributor

arkenv-bot Bot commented May 2, 2026

📦 Bundle Size Report

Package Size Limit Diff Status
arkenv 1.73 kB 1.95 kB 0.0%
arkenv/standard 1.01 kB 1.07 kB 0.0%
arkenv/core 441 B 500 B 0.0%
@arkenv/vite-plugin 1.91 kB 2.93 kB 0.0%

All size limits passed!

@arkenv-bot
Copy link
Copy Markdown
Contributor

arkenv-bot Bot commented May 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (Asia/Almaty)
arkenv Ready Ready Preview, Comment May 3 2026, 12:16 AM (Asia/Almaty)

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/www/content/docs/bun-plugin/index.mdx`:
- Around line 121-150: Add a short prerequisite note to this section stating
that external validators (e.g., Zod or Valibot) must be installed when used
alongside ArkType; specifically call out the imported symbol "z" from "zod" in
the src/env.ts example and provide a one-line install suggestion (e.g., install
zod or valibot) so readers don't get an unresolved-module error when copying the
snippet; update the prose around the code block mentioning the dependency and,
if helpful, list the package names "zod" and "valibot" as optional
prerequisites.

In `@apps/www/content/docs/vite-plugin/index.mdx`:
- Around line 87-106: Add a brief prerequisite note above the "Using Standard
Schema validators (Zod, Valibot)" example that calls out external validator
packages must be installed (e.g., zod or valibot) when using Standard Schema
validators; reference the example's import { z } from "zod" and the Env = type({
... }) usage so readers know to run npm/yarn install for those validator
packages before copying the vite.config.ts snippet.

In `@apps/www/lib/twoslash-options.ts`:
- Line 28: The CLI's MDX twoslash regex in apps/www/bin/twoslash-mdx.ts
currently only matches (ts|js) code blocks so newly added "tsx"/"jsx" blocks
from twoslash-options.ts won't be processed; update the regex (the
codeBlockRegex or equivalent constant used in twoslash-mdx.ts) to include tsx
and jsx (i.e. match ts|tsx|js|jsx) so the CLI path picks up those code fences
and captures their content the same way as ts/js blocks.

In `@openspec/changes/improve-plugin-docs/design.md`:
- Line 44: The doc mentions arkenvVitePlugin(Env) but the implemented docs use
arkenv(Env); update the reference in the design text to match the implemented
API by replacing arkenvVitePlugin(Env) with arkenv(Env) (or vice versa if you
intend to change the implementation) and ensure the example and any surrounding
text refer to the same symbol (arkenv(Env)) as used in
apps/www/content/docs/vite-plugin/index.mdx.

In `@openspec/changes/improve-plugin-docs/walkthrough.md`:
- Line 38: The walkthrough uses a different env key (VITE_MY_ENV) than the
examples (VITE_MY_VAR); update the walkthrough sentence that mentions export
const Env in the vite.config.ts / vite-env.d.ts snippet to use the same key name
as the examples (VITE_MY_VAR) so import.meta.env.VITE_MY_VAR is consistently
referenced across the walkthrough and example schema.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1e6dbfcf-0618-4235-9d38-11cdb88f2457

📥 Commits

Reviewing files that changed from the base of the PR and between 7d70eea and 49f5978.

📒 Files selected for processing (28)
  • apps/playgrounds/vite/README.md
  • apps/playgrounds/vite/src/vite-env.d.ts
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/bun-plugin/typing-process-env.mdx
  • apps/www/content/docs/vite-plugin/arkenv-in-viteconfig.mdx
  • apps/www/content/docs/vite-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/meta.json
  • apps/www/content/docs/vite-plugin/typing-import-meta-env.mdx
  • apps/www/lib/twoslash-options.ts
  • apps/www/source.config.ts
  • examples/with-vite-react/README.md
  • openspec/changes/archive/2025-11-20-add-arkenv-vite-config/design.md
  • openspec/changes/archive/2025-11-20-add-arkenv-vite-config/proposal.md
  • openspec/changes/archive/2025-11-20-add-arkenv-vite-config/specs/vite-config-usage/spec.md
  • openspec/changes/archive/2025-11-20-add-arkenv-vite-config/tasks.md
  • openspec/changes/archive/2025-11-20-fix-vite-plugin-env-filter/design.md
  • openspec/changes/archive/2025-11-28-add-bun-plugin/design.md
  • openspec/changes/archive/2025-11-28-add-bun-plugin/proposal.md
  • openspec/changes/archive/2025-12-22-coercion-public-api/proposal.md
  • openspec/changes/archive/2026-01-21-fix-standard-mode-inference/proposal.md
  • openspec/changes/improve-plugin-docs/design.md
  • openspec/changes/improve-plugin-docs/proposal.md
  • openspec/changes/improve-plugin-docs/tasks.md
  • openspec/changes/improve-plugin-docs/walkthrough.md
  • openspec/specs/vite-config-usage/spec.md
  • packages/arkenv/CHANGELOG.md
  • packages/arkenv/src/standard-mode.test.ts
  • packages/vite-plugin/CHANGELOG.md

Comment thread apps/www/content/docs/bun-plugin/index.mdx
Comment thread apps/www/content/docs/vite-plugin/index.mdx
Comment thread apps/www/lib/twoslash-options.ts
Comment thread openspec/changes/improve-plugin-docs/design.md Outdated
Comment thread openspec/changes/improve-plugin-docs/walkthrough.md Outdated
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 5 file(s) based on 5 unresolved review comments.

Files modified:

  • apps/www/bin/twoslash-mdx.ts
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/index.mdx
  • openspec/changes/improve-plugin-docs/design.md
  • openspec/changes/improve-plugin-docs/walkthrough.md

Commit: 7f807dc0c1b1af94d8b06b18763040a0c9e1cfb4

The changes have been pushed to the improve-plugin-docs branch.

Time taken: 7m 55s

coderabbitai Bot and others added 2 commits May 2, 2026 18:49
Fixed 5 file(s) based on 5 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/www/bin/twoslash-mdx.ts (1)

17-18: ⚡ Quick win

Derive fence languages from shared Twoslash config to prevent drift.

This regex duplicates arktypeTwoslashOptions.langs; future updates can silently desync extraction vs processing. Build the alternation from the shared langs list instead.

♻️ Proposed refactor
-const codeBlockRegex =
-	/```(ts|tsx|js|jsx) twoslash(?:.*)\r?\n([\s\S]*?)\r?\n```/g;
+const escapedLangs = arktypeTwoslashOptions.langs
+	.map((lang) => lang.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
+	.join("|");
+
+const codeBlockRegex = new RegExp(
+	"```(" + escapedLangs + ")\\s+twoslash(?:.*)\\r?\\n([\\s\\S]*?)\\r?\\n```",
+	"g",
+);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/www/bin/twoslash-mdx.ts` around lines 17 - 18, Replace the hard-coded
language alternation in the existing const codeBlockRegex with a RegExp built
from arktypeTwoslashOptions.langs: map and escape each lang (escape special
regex chars), join them with "|" to form the alternation, then construct a new
RegExp string that captures the language group and the twoslash code block body
(preserving the same capture groups and \r?\n handling) and instantiate it with
the "g" flag; overwrite the previous codeBlockRegex declaration so extraction
stays in sync with arktypeTwoslashOptions.langs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/www/content/docs/vite-plugin/index.mdx`:
- Line 4: Update the description string at the top of the MDX (the line that
currently reads "The ArkEnv plugin for Vite lets you validate environment
variables at build-time with ArkEnv") to end with "with ArkType" instead of
"with ArkEnv" so it reads "The ArkEnv plugin for Vite lets you validate
environment variables at build-time with ArkType"; edit the description field in
the document (the same line shown in the diff) to replace the trailing "ArkEnv"
with "ArkType".
- Line 4: Update the description frontmatter in
apps/www/content/docs/vite-plugin/index.mdx: replace the trailing phrase "with
ArkEnv" with "with ArkType" so the sentence reads "The ArkEnv plugin for Vite
lets you validate environment variables at build-time with ArkType." Locate and
edit the description string in the file's frontmatter (the line starting with
description:) to make this one-word replacement.

---

Nitpick comments:
In `@apps/www/bin/twoslash-mdx.ts`:
- Around line 17-18: Replace the hard-coded language alternation in the existing
const codeBlockRegex with a RegExp built from arktypeTwoslashOptions.langs: map
and escape each lang (escape special regex chars), join them with "|" to form
the alternation, then construct a new RegExp string that captures the language
group and the twoslash code block body (preserving the same capture groups and
\r?\n handling) and instantiate it with the "g" flag; overwrite the previous
codeBlockRegex declaration so extraction stays in sync with
arktypeTwoslashOptions.langs.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6c12d0b9-2578-457c-8e25-2a146913fa32

📥 Commits

Reviewing files that changed from the base of the PR and between 49f5978 and baa79a9.

⛔ Files ignored due to path filters (2)
  • examples/with-bun-react/bun.lock is excluded by !**/*.lock
  • examples/with-bun/bun.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • apps/www/bin/twoslash-mdx.ts
  • apps/www/content/docs/bun-plugin/index.mdx
  • apps/www/content/docs/vite-plugin/index.mdx
  • examples/with-vite-react/src/vite-env.d.ts
  • openspec/changes/improve-plugin-docs/design.md
  • openspec/changes/improve-plugin-docs/walkthrough.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • openspec/changes/improve-plugin-docs/walkthrough.md
  • apps/www/content/docs/bun-plugin/index.mdx
  • openspec/changes/improve-plugin-docs/design.md

Comment thread apps/www/content/docs/vite-plugin/index.mdx Outdated
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • apps/www/content/docs/vite-plugin/index.mdx

Commit: 8fdef603b555ba873cefda2bf532e574e4b8fd56

The changes have been pushed to the improve-plugin-docs branch.

Time taken: 4m 9s

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@arkenv/vite-plugin Issues or Pull Requests involving the Vite plugin for ArkEnv arkenv Changes to the `arkenv` npm package. docs Improvements or additions to documentation example Issues or Pull Requests concerning at least one ArkEnv example. (Found in the `examples/` directory) tests This issue or PR is about adding, removing or changing tests www Improvements or additions to arkenv.js.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant