-
Notifications
You must be signed in to change notification settings - Fork 5
Add Bun plugin #439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,932
−36
Merged
Add Bun plugin #439
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
c679758
Update layout.tsx to enhance user experience
yamcodes 89d227d
Update pnpm-lock.yaml to add Bun plugin dependencies
yamcodes 797bc22
Add Bun plugin entry to workspace configuration
yamcodes 71f2605
[autofix.ci] apply automated fixes
autofix-ci[bot] 08a7e73
Implement @arkenv/bun-plugin with environment variable validation
yamcodes c78343e
Add @arkenv/bun-plugin and vitest dependencies
yamcodes 99e52a3
[autofix.ci] apply automated fixes
autofix-ci[bot] 9c58942
Reorganize bun dependency in pnpm-lock.yaml
yamcodes 92e11d4
Update bun dependencies and environment variable handling
yamcodes c432425
Remove unnecessary blank line in bun-plugin-config.ts for cleaner code.
yamcodes 17c6456
Add Bun Plugin for ArkEnv with Configuration Patterns
yamcodes 25d9fb4
chore: add `@types/bun` to bun-plugin dev dependencies
yamcodes 6cd230b
refactor: Use `await Bun.file().text()` for asynchronous file content…
yamcodes 351ce5b
feat: Centralize Bun React playground environment variable definition…
yamcodes 63ef1e5
[autofix.ci] apply automated fixes
autofix-ci[bot] 43ae600
feat: display environment variables in a styled table and add plugin …
yamcodes ddbc008
feat: Add specific public Bun environment variables and refactor SVG/…
yamcodes 408248a
feat: add type column for environment variables display in the UI
yamcodes 0651540
feat: enable sourcemap generation in tsdown configuration
yamcodes 46fe73b
feat: Add `preview` script, display `NODE_ENV` in the app, and remove…
yamcodes f53d087
feat: Update Bun plugin to use named export and support direct regist…
yamcodes f3432a7
feat: Add default static ArkEnv plugin with automatic schema discover…
yamcodes d0beeba
chore: Delete ArkEnv Bun plugin configuration file.
yamcodes 7b75358
[autofix.ci] apply automated fixes
autofix-ci[bot] 08fcca6
feat: Refactor `arkenv` Bun plugin to support hybrid zero-config and …
yamcodes bfe0a9e
feat: configure Bun build to define process.env.NODE_ENV as production
yamcodes f7abcbe
refactor: Initialize Bun plugin environment schema using `build.onSta…
yamcodes 3a59005
feat: introduce a hybrid export for the Bun plugin, clarify usage pat…
yamcodes e3c82b3
feat: Add Bun plugin documentation and update the install button to s…
yamcodes 9b81288
refactor: Remove Vite logger support proposal files and add arkenv al…
yamcodes c811ade
Merge branch 'main' into bun-plugin
yamcodes 761e3ba
Merge branch 'main' into bun-plugin
yamcodes d3bdcbc
chore: add bun to devDependencies
yamcodes 328e867
Update apps/playgrounds/bun-react/bin/build.ts
yamcodes b498d52
docs: clarify how to customize the public environment variable prefix…
yamcodes 754a62c
refactor: update Bun plugin usage to import `arkenv` directly and def…
yamcodes b13f5a3
docs: Update Bun plugin package name from `bun-plugin-arkenv` to `@ar…
yamcodes 5a88d9a
feat: Update Bun plugin package name to `@arkenv/bun-plugin`, switch …
yamcodes f1ba897
feat: update Bun plugin package name and schema definition method fro…
yamcodes 0b345b7
Update packages/bun-plugin/src/index.ts
yamcodes cd702be
[autofix.ci] apply automated fixes
autofix-ci[bot] bad196e
docs: simplify Bun plugin creation function name in examples and desc…
yamcodes a70bde8
docs: Update `ProcessEnvAugmented` example to use default export from…
yamcodes c4047f4
test: improve test isolation by saving and restoring process.env in t…
yamcodes 05e81ca
feat: export `processEnvSchema` function and update tests to directly…
yamcodes df8c39e
docs: add impact section to Bun plugin proposal detailing its opt-in,…
yamcodes 84c6c1f
Replace detailed Bun plugin specification and design with an implemen…
yamcodes 517ce75
docs: update markdown heading levels and formatting in design and pro…
yamcodes 3981063
feat: introduce OpenSpec agent workflows for proposal, apply, and arc…
yamcodes db3ff26
feat: Add arkenv and arktype dependencies, configure production envir…
yamcodes 6cd680c
Merge branch 'main' into bun-plugin
yamcodes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| description: Implement an approved OpenSpec change and keep tasks in sync. | ||
| --- | ||
| <!-- OPENSPEC:START --> | ||
| **Guardrails** | ||
| - Favor straightforward, minimal implementations first and add complexity only when it is requested or clearly required. | ||
| - Keep changes tightly scoped to the requested outcome. | ||
| - Refer to `openspec/AGENTS.md` (located inside the `openspec/` directory—run `ls openspec` or `openspec update` if you don't see it) if you need additional OpenSpec conventions or clarifications. | ||
|
|
||
| **Steps** | ||
| Track these steps as TODOs and complete them one by one. | ||
| 1. Read `changes/<id>/proposal.md`, `design.md` (if present), and `tasks.md` to confirm scope and acceptance criteria. | ||
| 2. Work through tasks sequentially, keeping edits minimal and focused on the requested change. | ||
| 3. Confirm completion before updating statuses—make sure every item in `tasks.md` is finished. | ||
| 4. Update the checklist after all work is done so each task is marked `- [x]` and reflects reality. | ||
| 5. Reference `openspec list` or `openspec show <item>` when additional context is required. | ||
|
|
||
| **Reference** | ||
| - Use `openspec show <id> --json --deltas-only` if you need additional context from the proposal while implementing. | ||
| <!-- OPENSPEC:END --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| --- | ||
| description: Archive a deployed OpenSpec change and update specs. | ||
| --- | ||
| <!-- OPENSPEC:START --> | ||
| **Guardrails** | ||
| - Favor straightforward, minimal implementations first and add complexity only when it is requested or clearly required. | ||
| - Keep changes tightly scoped to the requested outcome. | ||
| - Refer to `openspec/AGENTS.md` (located inside the `openspec/` directory—run `ls openspec` or `openspec update` if you don't see it) if you need additional OpenSpec conventions or clarifications. | ||
|
|
||
| **Steps** | ||
| 1. Determine the change ID to archive: | ||
| - If this prompt already includes a specific change ID (for example inside a `<ChangeId>` block populated by slash-command arguments), use that value after trimming whitespace. | ||
| - If the conversation references a change loosely (for example by title or summary), run `openspec list` to surface likely IDs, share the relevant candidates, and confirm which one the user intends. | ||
| - Otherwise, review the conversation, run `openspec list`, and ask the user which change to archive; wait for a confirmed change ID before proceeding. | ||
| - If you still cannot identify a single change ID, stop and tell the user you cannot archive anything yet. | ||
| 2. Validate the change ID by running `openspec list` (or `openspec show <id>`) and stop if the change is missing, already archived, or otherwise not ready to archive. | ||
| 3. Run `openspec archive <id> --yes` so the CLI moves the change and applies spec updates without prompts (use `--skip-specs` only for tooling-only work). | ||
| 4. Review the command output to confirm the target specs were updated and the change landed in `changes/archive/`. | ||
| 5. Validate with `openspec validate --strict` and inspect with `openspec show <id>` if anything looks off. | ||
|
|
||
| **Reference** | ||
| - Use `openspec list` to confirm change IDs before archiving. | ||
| - Inspect refreshed specs with `openspec list --specs` and address any validation issues before handing off. | ||
| <!-- OPENSPEC:END --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| description: Scaffold a new OpenSpec change and validate strictly. | ||
| --- | ||
| <!-- OPENSPEC:START --> | ||
| **Guardrails** | ||
| - Favor straightforward, minimal implementations first and add complexity only when it is requested or clearly required. | ||
| - Keep changes tightly scoped to the requested outcome. | ||
| - Refer to `openspec/AGENTS.md` (located inside the `openspec/` directory—run `ls openspec` or `openspec update` if you don't see it) if you need additional OpenSpec conventions or clarifications. | ||
| - Identify any vague or ambiguous details and ask the necessary follow-up questions before editing files. | ||
| - Do not write any code during the proposal stage. Only create design documents (proposal.md, tasks.md, design.md, and spec deltas). Implementation happens in the apply stage after approval. | ||
|
|
||
| **Steps** | ||
| 1. Review `openspec/project.md`, run `openspec list` and `openspec list --specs`, and inspect related code or docs (e.g., via `rg`/`ls`) to ground the proposal in current behaviour; note any gaps that require clarification. | ||
| 2. Choose a unique verb-led `change-id` and scaffold `proposal.md`, `tasks.md`, and `design.md` (when needed) under `openspec/changes/<id>/`. | ||
| 3. Map the change into concrete capabilities or requirements, breaking multi-scope efforts into distinct spec deltas with clear relationships and sequencing. | ||
| 4. Capture architectural reasoning in `design.md` when the solution spans multiple systems, introduces new patterns, or demands trade-off discussion before committing to specs. | ||
| 5. Draft spec deltas in `changes/<id>/specs/<capability>/spec.md` (one folder per capability) using `## ADDED|MODIFIED|REMOVED Requirements` with at least one `#### Scenario:` per requirement and cross-reference related capabilities when relevant. | ||
| 6. Draft `tasks.md` as an ordered list of small, verifiable work items that deliver user-visible progress, include validation (tests, tooling), and highlight dependencies or parallelizable work. | ||
| 7. Validate with `openspec validate <id> --strict` and resolve every issue before sharing the proposal. | ||
|
|
||
| **Reference** | ||
| - Use `openspec show <id> --json --deltas-only` or `openspec show <spec> --type spec` to inspect details when validation fails. | ||
| - Search existing requirements with `rg -n "Requirement:|Scenario:" openspec/specs` before writing new ones. | ||
| - Explore the codebase with `rg <keyword>`, `ls`, or direct file reads so proposals align with current implementation realities. | ||
| <!-- OPENSPEC:END --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@arkenv/bun-plugin": minor | ||
| --- | ||
|
|
||
| Add Bun plugin for build-time environment variable validation and type-safe access, similar to the Vite plugin. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| BUN_PUBLIC_API_URL=https://api.example.com | ||
| BUN_PUBLIC_DEBUG=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import arkenv from "@arkenv/bun-plugin"; | ||
|
|
||
| const result = await Bun.build({ | ||
| entrypoints: ["./src/index.html"], | ||
| outdir: "./dist", | ||
| sourcemap: true, | ||
| target: "browser", | ||
| minify: true, | ||
| plugins: [arkenv], | ||
| }); | ||
|
|
||
| if (!result.success) { | ||
| console.error("Build failed:"); | ||
| for (const log of result.logs) { | ||
| console.error(log); | ||
| } | ||
| process.exit(1); | ||
| } | ||
|
|
||
| console.log(`✓ Build succeeded: ${result.outputs.length} files generated`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,23 @@ | ||
| // Generated by `bun init` | ||
| /// <reference types="bun-types" /> | ||
|
|
||
| // Import the Env schema type from env.ts | ||
| type ProcessEnvAugmented = import("@arkenv/bun-plugin").ProcessEnvAugmented< | ||
| typeof import("./src/env").default | ||
| >; | ||
|
|
||
| declare namespace NodeJS { | ||
| interface ProcessEnv extends ProcessEnvAugmented { | ||
| BUN_PUBLIC_API_URL: string; | ||
| BUN_PUBLIC_DEBUG: boolean; | ||
| } | ||
| } | ||
|
|
||
| declare module "*.svg" { | ||
| /** | ||
| * A path to the SVG file | ||
| */ | ||
| const path: `${string}.svg`; | ||
| export = path; | ||
| const content: string; | ||
| export default content; | ||
| } | ||
|
|
||
| declare module "*.module.css" { | ||
| /** | ||
| * A record of class names to their corresponding CSS module classes | ||
| */ | ||
| const classes: { readonly [key: string]: string }; | ||
| export = classes; | ||
| export default classes; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| [serve.static] | ||
| env = "BUN_PUBLIC_*" | ||
| env = "BUN_PUBLIC_*" | ||
| plugins = ["@arkenv/bun-plugin"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { type } from "arkenv"; | ||
|
|
||
| export default type({ | ||
| BUN_PUBLIC_API_URL: "string", | ||
| BUN_PUBLIC_DEBUG: "boolean", | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| "use client"; | ||
|
|
||
| import { Banner as FumadocsBanner } from "fumadocs-ui/components/banner"; | ||
| import { useRouter } from "next/navigation"; | ||
|
|
||
| export function Banner() { | ||
| const router = useRouter(); | ||
| return ( | ||
| <FumadocsBanner | ||
| variant="rainbow" | ||
| id="bun-support-banner" | ||
| onClick={() => router.push("/docs/bun-plugin")} | ||
| className="cursor-pointer" | ||
| > | ||
| 🎉 Official Bun support is here: ArkEnv at build time, fullstack dev | ||
| server | ||
| </FumadocsBanner> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.