Commit Graph

1635 Commits

Author SHA1 Message Date
Steve Faulkner 8dac26c0e5 fix(dotenv): load .env files with Next.js precedence (#70)
* feat(cli): load .env files with Next.js precedence

* fix(dotenv): address review feedback on .env loading

- Document Vite double-loading interaction in loadDotenv JSDoc
- Fix escaped dollar sign bug ($100 was not unescaped when $ wasn't
  followed by a valid variable name)
- Add type cast for parseEnv return value
- Expand test coverage: loadedEnv assertions, production mode
  precedence, ${VAR} expansion, escaped dollars, circular refs,
  missing files, empty result
- Add getDotenvFiles unit tests for all three modes
- Add 'Prefer Node.js Built-in APIs' guideline to AGENTS.md

Co-authored-by: liuxiaopai-ai <liuxiaopai-ai@users.noreply.github.com>

* test(dotenv): add cross-file expansion and multi-line value tests

Address review suggestions: test that .env can reference vars from
higher-priority .env.development.local, and that parseEnv handles
quoted multi-line values correctly.

---------

Co-authored-by: root <root@localhost.localdomain>
Co-authored-by: liuxiaopai-ai <liuxiaopai-ai@users.noreply.github.com>
v0.0.9
2026-02-25 14:21:48 -06:00
Steve Faulkner f1e5c31c2e Fix AI Gateway auth (use cf-aig-authorization) and show Google Chat error body (#69) 2026-02-25 13:47:39 -06:00
Steve Faulkner bc75de3548 Skip deploy previews for fork PRs that lack Cloudflare secrets (#67)
Fork PRs don't have access to repository secrets (CLOUDFLARE_API_TOKEN,
CLOUDFLARE_ACCOUNT_ID), so deploy/smoke-test/comment steps always fail.
Add a fork detection condition to skip these steps gracefully. The build
steps still run, so example builds are still validated for fork PRs.
2026-02-25 13:47:24 -06:00
Steve Faulkner 4d0a008644 Add AI-generated release summary + Google Chat notification to publish workflow (#68)
* Skip deploy previews for fork PRs that lack Cloudflare secrets

Fork PRs don't have access to repository secrets (CLOUDFLARE_API_TOKEN,
CLOUDFLARE_ACCOUNT_ID), so deploy/smoke-test/comment steps always fail.
Add a fork detection condition to skip these steps gracefully. The build
steps still run, so example builds are still validated for fork PRs.

* Add AI-generated release summary + Google Chat notification to publish workflow
v0.0.8
2026-02-25 13:09:16 -06:00
Ivan Torres 36ab8b0f18 fix: replace glob npm package with native node:fs/promises glob (#52)
* fix: replace glob npm package with native node:fs/promises glob

Migrate pagesRouter, apiRouter, and appRouter from the third-party 'glob'
package to Node.js built-in glob (node:fs/promises), available since
Node 22. This removes a dependency and fixes path handling issues on
Windows where dynamic route segments (e.g. [slug]) were incorrectly
parsed due to premature path separator normalization.

Changes:
- Use for-await with glob() from node:fs/promises
- Use exclude callbacks instead of post-filtering
- Normalize pagePath/routePath with replaceAll('\\', '/') in output
- Remove glob dependency from package.json

* fix: address review feedback on native glob migration

- Fix excludePrivate over-exclusion: the native glob exclude callback
  fires at every directory depth, not just the root. Replace with
  post-filtering on the first path segment to match the old glob
  package's root-relative ignore behavior.
- Remove redundant .replaceAll('\\', '/') normalization from
  pagePath/routePath in app-router.ts — consumers already normalize
  backslashes, and this was inconsistent with pages-router.ts.
- Add engines field (node >= 22) since fs.glob requires Node 22+.

* refactor: use glob pattern arrays instead of callbacks for exclude

- app-router: replace hasSlotSegment callback with ['**/@*'] pattern
- pages-router: replace excludePrivate callback with ['api', '**/_*'] patterns
- Simplify iteration: process glob results directly instead of collecting into intermediate arrays

---------

Co-authored-by: Steve Faulkner <sfaulkner@cloudflare.com>
2026-02-25 12:31:41 -06:00
Skywalker512 cb15a16aaa fix: link to Vite RSC plugin in README (#39)
Updated the link for the Vite RSC plugin to point to the correct repository.
2026-02-25 10:55:21 -06:00
Steve Faulkner f6ba607258 fix: make chat notification non-fatal and add charset to content-type (#62) 2026-02-25 16:21:08 +00:00
Steve Faulkner c0acaa6e57 fix: read CLI version from package.json instead of hardcoded value (#61) 2026-02-25 16:14:19 +00:00
Steve Faulkner 8558c2d68e ci: notify Google Chat on npm publish (#55) v0.0.7 2026-02-25 15:41:11 +00:00
Steve Faulkner 0866ddaa2f ci: wire up npm publishing with OIDC trusted publishing (#54)
- Add version bump input (patch/minor/major) to publish workflow
- Gate publish on full CI suite (lint, typecheck, vitest, e2e)
- Use npm OIDC trusted publishing instead of long-lived NPM_TOKEN
- Tag releases in git after publish
- Make ci.yml callable via workflow_call
- Fix repository URL format in package.json for OIDC validation
v0.0.6
2026-02-25 09:03:57 -06:00
Steve Faulkner 61554eaf37 fix: install react-server-dom-webpack during init and deploy for App Router (#31)
* fix: install react-server-dom-webpack during init and deploy for App Router

vinext init was missing react-server-dom-webpack from its dependency list,
causing 'Could not resolve react-server-dom-webpack/server.edge' errors on
fresh create-next-app projects. Additionally, react-server-dom-webpack@19.2.4
requires react@^19.2.4, but create-next-app ships react@19.2.3 -- the version
mismatch caused npm to nest rsdw inside vinext/node_modules where Vite can't
resolve it.

Fix: add react-server-dom-webpack to getInitDeps for App Router, detect when
the installed React version is too old, and upgrade react/react-dom as regular
dependencies before installing dev deps (avoiding ERESOLVE peer-dep conflicts
and keeping react in 'dependencies' rather than 'devDependencies').

Also applies the same fix to vinext deploy for parity, and adds a CI job that
scaffolds a real create-next-app project, runs vinext init, and verifies the
dev server returns HTTP 200.

Closes #22

* refactor: use createRequire for package resolution instead of direct node_modules reads

Address review feedback (PR #18 pattern): replace fs.existsSync(node_modules/...)
with createRequire-based resolution, which handles hoisting, pnpm symlinks,
monorepos, and Yarn PnP correctly.

- deploy.ts: extract isPackageResolvable() helper using createRequire, use it
  in getMissingDeps for react-server-dom-webpack detection
- init.ts: refactor getReactUpgradeDeps() to use createRequire + findPackageVersion
  walk-up pattern instead of reading node_modules/react/package.json directly
- tests: add isPackageResolvable unit tests, use dependency injection for
  getMissingDeps rsdw test (Vitest's createRequire intercepts resolution)

* ci: add Windows to create-next-app smoke test

Run the create-next-app compatibility test on both ubuntu-latest and
windows-latest. Replace bash-specific server health check (curl, kill,
backgrounding) with a cross-platform Node script using child_process
and http. Use runner.temp instead of /tmp for portable paths.

* fix: use pathToFileURL for dynamic import() calls on Windows

On Windows, Node's ESM loader requires file:// URLs for absolute paths.
Bare paths like D:\... are rejected with ERR_UNSUPPORTED_ESM_URL_SCHEME.

Wrap all dynamic import() calls that receive absolute paths from
require.resolve() or path.join() with pathToFileURL().href:

- index.ts: RSC plugin import, RSC transforms import, PostCSS config
  loading, PostCSS plugin resolution (5 call sites)
- cli.ts: Vite module import from project root

* fix: pathToFileURL for cache-runtime codegen and test imports

Additional Windows fixes found via PR #43 review:

- index.ts: use pathToFileURL for runtimeModulePath in 'use cache'
  transform code generation (2 locations) — these embed absolute paths
  into generated import() statements via JSON.stringify
- pages-router.test.ts: wrap 9 import(serverEntryPath) calls with
  pathToFileURL so tests work on Windows
2026-02-25 08:38:54 -06:00
Steve Faulkner 05ef04788c feat(deploy): add --env support with security and parsing improvements (#49)
* feat(deploy): add --env support for wrangler deploy

Adds vinext deploy --env <name> and threads it through to wrangler deploy --env <name>. Keeps --preview working as shorthand for preview environment, adds unit tests for wrangler arg construction, and updates README/help examples. Refs #33.

* fix(deploy): use execFileSync and util.parseArgs for --env support

Build on #44 by liuxiaopai-ai — adds --env flag for wrangler deploy.

Security: switch from execSync(shell string) to execFileSync(binary, args)
to eliminate command injection via unsanitized --env/--name values.

Replace hand-rolled flag parsing (parseStringFlag, parseNumericFlag,
rawArgs.includes) with Node.js built-in util.parseArgs. This gives us
strict mode (throws on unknown flags), automatic --flag=value handling,
and proper error messages for missing values.

Also: buildWranglerDeployArgs now returns { args, env } directly instead
of re-parsing the args array for the log message.

---------

Co-authored-by: root <root@localhost.localdomain>
2026-02-25 06:57:44 -06:00
Tiago Linares 0d5b42c79e fix: preserve binary API response bytes in prod-server (#30)
Updated the production server to handle binary responses correctly by using Buffer.from with arrayBuffer instead of text(). Added a test to ensure binary data integrity and created a new fixture for testing binary API responses.
2026-02-25 04:36:28 +00:00
Marcus Reinhardt 9f5550579e fix vite-rsc link (#20) 2026-02-24 22:35:25 -06:00
Steve Faulkner 388d3e6b79 ci: use --pnpm flag for pkg-pr-new publish (#36) 2026-02-24 21:44:59 -06:00
Steve Faulkner f22eb8fc9b docs: add SECURITY.md with vulnerability reporting info (#35) 2026-02-25 03:07:42 +00:00
Steve Faulkner ecdebab977 ci: add pkg.pr.new preview releases for PRs (#34) 2026-02-25 02:51:33 +00:00
Steve Faulkner 7a26409e88 chore: bump version to 0.0.5 (#29) 2026-02-24 21:56:22 +00:00
Steve Faulkner 197f42106a docs: add LICENSE, sync package README, add bug reporting guidance (#26)
* docs: update README — add blog link, lead with agent skill, fix examples, remove stale benchmarks

* docs: add LICENSE, sync package README from root, add bug reporting guidance

- Add MIT LICENSE to repo root
- Copy root README into package at prepack time instead of maintaining two copies
- Add 'Reporting bugs' section encouraging AI-assisted diagnosis

* fix: update LICENSE copyright to Cloudflare, Inc.
2026-02-24 15:40:12 -06:00
Steve Faulkner 2c732add55 docs: update README — add blog link, lead with agent skill, fix examples, remove stale benchmarks (#19) 2026-02-24 20:11:37 +00:00
Steve Faulkner 97d7e204bf v0.0.4 (#17) 2026-02-24 13:22:02 -06:00
Steve Faulkner bec45ebb3b fix: don't tell users to run vinext init when already inside vinext init (#14) 2026-02-24 19:01:08 +00:00
Steve Faulkner 6c3a8897de chore: bump version to 0.0.3 (#16) 2026-02-24 12:54:13 -06:00
Fred K. Schott 2b04681406 fix: resolve vinext init issues with missing dep, duplicate rsc plugin, and peer dep conflict (#15)
- Install vinext itself as a devDependency during init (#11)
- Remove explicit rsc() from generated configs since vinext auto-registers it (#12)
- Widen react/react-dom peer dep to >=19.2.0 for create-next-app compat (#13)

Co-authored-by: Fred K. Schott <fschott@cloudflare.com>
2026-02-24 12:29:26 -06:00
Steve Faulkner 01793e79d9 ci: disable scheduled tip workflow for now (#10) 2026-02-24 12:36:48 -05:00
Steve Faulkner 5c44676f64 chore: bump version to 0.0.2 (#8) 2026-02-24 11:32:03 -06:00
Sunil Pai acd1110b04 fix: inline source content in sourcemaps to prevent missing source warnings (#5)
When vinext is installed from npm, the .ts source files aren't in the
package but .js.map files reference them, causing Vite to log many
'points to missing source files' warnings.

Adding inlineSources: true to tsconfig embeds the original TypeScript
source content directly in the .js.map files so no separate .ts files
are needed.

Fixes #2
2026-02-24 11:13:41 -06:00
Sunil Pai 493a4c1b70 fix: add 'use client' to next/dynamic shim for App Router RSC compatibility (#7)
When a server component imports next/dynamic, the RSC serializer must
treat it as a client boundary. Without 'use client', the dynamic()
function executes inline in the RSC environment — for ssr:false, this
serializes null into the RSC payload and the client never loads the
component.

Adding 'use client' matches Next.js's App Router behavior where
next/dynamic is a client module. The RSC serializer emits a client
reference, and the client executes the full dynamic logic including
the ssr:false mount-on-client behavior.

Updated test fixtures that called dynamic() from server modules to
include 'use client' — this is required since dynamic() is now a
client export and can only be called from client modules.

Added E2E test for ssr:false from a server component page.
2026-02-24 11:13:29 -06:00
Sunil Pai 3ed38d1c4a fix: exclude vinext from optimizeDeps to prevent virtual module resolution errors (#3)
* fix: exclude vinext from optimizeDeps to prevent virtual module resolution errors

When vinext is installed from npm (not symlinked), esbuild's dependency
optimization scans vinext/dist/ and hits virtual:vinext-* imports that
only exist at Vite plugin resolution time. This causes build failures
in all three environments (client, rsc, ssr).

Adding optimizeDeps.exclude: ['vinext'] at the top level and in each
environment prevents esbuild from scanning vinext's dist files entirely.

Fixes #1

* test: verify optimizeDeps.exclude contains vinext for all environments
2026-02-24 11:13:28 -06:00
Matt Silverlock 009ace26bf add migrate-to-vinext agent skill (#6)
* add migrate-to-vinext agent skill

* Apply suggestion from @elithrar

* remove .claude/skills in favor of .agents/skills
2026-02-24 16:53:38 +00:00
Matt Silverlock 45224abbc7 ci: Bonk should fail faster (#4)
* Bonk should fail faster

Check for mentions earlier in the action.

* Update bigbonk.yml
2026-02-24 16:44:52 +00:00
Steve Faulkner d1180e11e9 chore: set version 0.0.1, disable auto-publish for now 2026-02-24 09:57:54 -06:00
Steve Faulkner 8c3a0e0802 ci: add npm publish workflow with OIDC trusted publishing (#422) 2026-02-24 09:48:37 -06:00
skeptrune 4349af3ecc fix: decode URL-encoded directory names and improve route precedence (#386)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 09:29:45 -06:00
Steve Faulkner 12fea722b6 Initial public release of vinext 2026-02-24 09:29:39 -06:00