Until now, the user code response it's buffered and serialized. This is
mismatching how Vercel works these days.
This PR enables streaming response in `vc dev` for Edge/Serverless.
As part of the implementation, the `node-bridge` which spawns a process
to consume the user code is not necessary anymore.
Some necessary files (like HTTP server helpers) have been moved to live
in node builder package instead.
---------
Co-authored-by: Ethan Arrowood <ethan.arrowood@vercel.com>
Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
The `@vercel/build-utils` package was meant be shared functions necessary for writing a Vercel Builder (aka Runtime).
This package has since bloated into the catch-all package for anything that wasn't a Builder.
This PR removes the bloat in favor of a new package, `@vercel/fs-detectors`. It also removes the need for `@vercel/build-utils` to have a dependency on `@vercel/frameworks`.
- Related to #7951
Adds a new Builder for the Remix framework. This Builder has support for a few different configurations of Remix including the "just the basics" Remix server as well as the "vercel" server build target configuration. If the project does not have the `@remix-run/vercel` runtime adapter as a dependency in package.json then this Builder will implicitly add it when generating the SSR serverless function.
In a follow-up PR, we can make this Builder be used in the frameworks configuration so that it is executed when `remix` framework is selected for the project, and we can update the remix example template in this repo to no longer require the `ENABLE_FILE_SYSTEM_API` env var.
* [cli] Remove initial iteration of `vc build` and Plugins
The `vercel build` command is being restructured, so we'll remove it for
now so that this initial iteration isn't included as part of the stable
CLI release.
* Update packages/cli/src/commands/init/init.ts
Co-authored-by: Steven <steven@ceriously.com>
* Remove more `.output` references
* Remove unnecessary space
* Fix test
* Remove vc dev middleware tests for now
Co-authored-by: Steven <steven@ceriously.com>
* Move loadPlugins to a utils file to be shared w/ dev server.
* Update loadCliPlugins to also return startDevServer and runDevMiddleware based plugins.
* Move plugins back to dependencies.
These can't be bundled as it interferes with plugin resolution.
* Hook up middleware plugins to dev server.
* Pass output object to loadCliPlugins instead of a logging function.
* Allow more than one runDevMiddleware defining plugins.
* Bundle esbuild w/ middleware plugin.
* Keep esbuild as an external
* Update middleware's esbuild.
* set old space size
* Revert "set old space size"
This reverts commit b579194a862949a11769e9087f01c31f2e1f3b60.
* Use --max-old-space-size for CLI unit tests
* Increase memory
* Use `run.js` to set the memory
* Make NODE_OPTIONS optional
Co-authored-by: Leo Lamprecht <leo@vercel.com>
Co-authored-by: Andy <AndyBitz@users.noreply.github.com>
Co-authored-by: Andy Bitz <artzbitz@gmail.com>
* [node] Refactor to Vercel CLI Plugin
* Enforce "index" suffix on output Serverless Functions
So that nesting works properly
* Some cleanup
* Add version
* Use `@vercel/static-config`
* .
* Add support for wildcard routes
* Don't compile dotfiles, underscore prefixed files, files within `node_modules`, nor TypeScript definition files
Matches the logic from `maybeGetBuilder()` in `@vercel/build-utils`.
* Bump version
* Introduce testing framework
* Debug
* Add test without any deps
* Longer timeout to install Node.js for vercel/fun
* Install deps
* Add legacy Node.js server interface test
* More tests
* Test "assets" fixture
* Test "helpers" fixture
* fix
* Support AWS native API
* Remove debugging `console.log()` calls
* Use plugin-node for new plugin instead
* Revert "Use plugin-node for new plugin instead"
This reverts commit f317b8c6ecdc67a74d5f2b12a2e7567a27d4b6b8.
* Move to `plugin-node` directory
* Update plugin-node version in package.json
* Checkout node from main
* Add yarn.lock files for tests
* Update node-bridge
Co-authored-by: Andy <AndyBitz@users.noreply.github.com>
Co-authored-by: Andy Bitz <artzbitz@gmail.com>
* Add initial `vercel-plugin-middleware`
* Ignore `entries.js` from ESLint
* Add `runDevMiddleware()` stub
* Add test
* Add support for "_middleware.{js,ts}" to `vercel dev` (#6880)
* Add websandbox from next.js codebase.
* Use node-fetch instead of next's polyfilled fetch.
* Handle middleware rewrites.
* Add response, headers, and request to websandbox context.
* Move websandbox dependency to middleware plugin.
* Add integration tests, update websandbox to support ts files and json imports.
* commit yarn.lock changes after rebasing
* Clean up left over console.logs, fix some tsc issues, and rebase issue.
* Fix failing test and eslint.
* Fix middleware test on windows.
* [examples] Update Vercel Next.js example template to 12.0.1 (#6905)
* Mark the Plugins as external to CLI's ncc build
* [cli] Improve tracing in vc build (#6898)
* [cli] Fix tracing for `vc build`
* Ignore object when there are no changes
* Make Next < 12 work with FS API w/ nft
* Update packages/cli/src/commands/build.ts
Co-authored-by: Nathan Rajlich <n@n8.io>
* Document how Next.js processing works in build
* [cli] Fix static assets (#6906)
* Make sure output path is .next
* Fix up require-server-files for processing
* Fix typo
* Move static
* Update static rename
Co-authored-by: Andy Bitz <artzbitz@gmail.com>
Co-authored-by: Nathan Rajlich <n@n8.io>
Co-authored-by: Andy <AndyBitz@users.noreply.github.com>
* Publish Canary
- vercel@23.1.3-canary.17
- @vercel/client@10.2.3-canary.15
- @vercel/static-config@0.0.1-canary.0
* [cli] Ignore `.env` and `.gitignore` in "vc build" (#6910)
* Publish Canary
- vercel@23.1.3-canary.18
* Pass workPath to plugins.
The new plugin architecture doesn't pass a full BuildOptions object, previous
to this commit it wasn't passing any options at all. I've added workingPath to
support running dev/build from directories other than the project root.
* Remove error state when package.json exists, but no build script
This allows vercel build to continue working for projects that are not using
frameworks, but use package.json to manage dependencies.
* Fix types, pull in middleware header fix from next.js
Next js PR w/ the header fix:
https://github.com/vercel/next.js/pull/30560
* Fix missing entries file for vc build.
* Update call signature of middleware when using vc build.
Co-authored-by: Drew Bredvick <dbredvick@gmail.com>
Co-authored-by: Nathan Rajlich <n@n8.io>
Co-authored-by: Jared Palmer <jared@jaredpalmer.com>
Co-authored-by: Andy Bitz <artzbitz@gmail.com>
Co-authored-by: Andy <AndyBitz@users.noreply.github.com>
Co-authored-by: Gary Borton <gdborton@gmail.com>
Co-authored-by: Drew Bredvick <dbredvick@gmail.com>
Co-authored-by: Jared Palmer <jared@jaredpalmer.com>
Co-authored-by: Andy Bitz <artzbitz@gmail.com>
Co-authored-by: Andy <AndyBitz@users.noreply.github.com>
This Runtime is very old, outdated, unmaintained, and has never been documented.
Additionally, it no longer compiles with the latest version of Go. So
rather than fixing it, let's just remove it since we don't want to
invest any more time into it.
* remove prefix from codeowners
* remove references from ignore files
* Remove prefix from package json and tests
* Add run js without prefixes
* Rename package folders
* Delete auto generated test files
* Remove now-node in integration test
* Put back deleted vercel json files
* Remove eol
* Add styfle suggestion to comment in utils/run.js
Co-authored-by: Steven <steven@ceriously.com>
This PR converts the `frameworks.json` file to TypeScript, and extends the values with the detection logic from `@vercel/static-build`, so that it's publicly editable. You also don't need to do the type casting downstream anymore.
As a consequence, it also makes Zola a 1st-class framework, as it was previously missing from the `frameworks.json` file, but present in the static-build frameworks. An example has been included based on their "Getting Started" tutorial.
CH-3808
CH-18771
Follow up to #4444 that makes sure we run Next.js tests.
This `--ignore-engines` flag was originally added in https://github.com/vercel/now-builders/pull/463 as a workaround. We can remove it to make sure the version of Node selected will work with the dependencies.
Removing the flag also makes sure that Yarn 2 will work properly, see #4444.
Currently, CI is printing this:
```
Running "test-unit" on branch "(HEAD" with the following packages:
now-cli\test\dev-server.unit.js
now-cli\test\fixtures\unit\now-dev-request-body\api\data-events.js
now-cli\test\fixtures\unit\now-dev-request-body\api\req-body.js
now-node-bridge\src\bridge.ts
now-node\src\dev-server.ts
now-node\src\helpers.ts
now-node\src\launcher.ts
now-cli
[now-cli\test\dev-server.unit.js] Skipping since script "test-unit" is missing from package.json
[now-cli\test\fixtures\unit\now-dev-request-body\api\data-events.js] Skipping since script "test-unit" is missing from package.json
[now-cli\test\fixtures\unit\now-dev-request-body\api\req-body.js] Skipping since script "test-unit" is missing from package.json
[now-node-bridge\src\bridge.ts] Skipping since script "test-unit" is missing from package.json
[now-node\src\dev-server.ts] Skipping since script "test-unit" is missing from package.json
[now-node\src\helpers.ts] Skipping since script "test-unit" is missing from package.json
[now-node\src\launcher.ts] Skipping since script "test-unit" is missing from package.json
```
So, other than `now-cli` which is hard-coded to always run, no other tests were being selected on Windows. This change uses the proper path separator for the OS to fix this.
Also, the branch name detection command is changed to fix the `"(HEAD"` name that is being detected in CI.
With this change, it looks like:
```
Running "test-unit" on branch "fix/tests-windows" with the following packages:
- now-node
- now-cli
[now-node] Running yarn test-unit
…
[now-cli] Running yarn test-unit
…
```
In PR #3514, we added a `/api` directory for functions and a `/public` directory which was created at build time.
This moves the build script to be `now-build` so we don't don't need to build everything in the repo and also no longer need to special case the git env vars.
This adds initial support for Windows in GitHub Actions CI tests.
There is still work to be done to prevent certain tests from hanging in CI so those are skipped for now.
I was getting errors when running `yarn build` locally because the public directory already exists.
This will make sure the public directory is deleted before generating it again.