Commit Graph

29 Commits

Author SHA1 Message Date
Kiko Beats
6dded87426 [node] Add streaming support for vc dev (#9745)
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>
2023-04-19 23:56:41 +02:00
Ethan Arrowood
9c768b98b7 [tests] Migrate from yarn to pnpm (#9198)
<picture data-single-emoji=":pnpm:" title=":pnpm:"><img class="emoji" src="https://single-emoji.vercel.app/api/emoji/eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..4mJzrO94AnSn0Pue.4apgaKtTUdQ-wxNyahjdJj28u8bbXreLoTA8AGqYjLta3MrsFvbo9DsQFth4CoIkBgXFhQ5_BVcKNfYbwLg4bKzyIvItKe4OFS8AzG7Kkicz2kUUZk0.nXyK_PvHzZFGA-MQB6XHfA" alt=":pnpm:" width="20" height="auto" align="absmiddle"></picture> 

yarn has become increasingly more difficult to use as the v1 we rely on no longer receives updates. pnpm is faster and is actively maintained. 

This PR migrates us to pnpm.
2023-01-11 23:35:13 +00:00
Steven
51fe09d5e9 [build-utils][fs-detectors][cli] MAJOR: move some of build-utils into new fs-detectors (#8054)
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
2022-06-30 21:14:07 +00:00
Nathan Rajlich
474770e9b0 [remix] Add @vercel/remix Builder (#7814)
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.
2022-05-19 22:54:00 +00:00
Nathan Rajlich
623e43f865 [next] Add @vercel/next Builder (#7793) 2022-05-18 23:51:48 +00:00
Sean Massa
4ee064bb61 [static-build] Add @vercel/static-build Builder (#7536) 2022-03-10 13:21:24 -06:00
Sean Massa
db10383bc8 [redwood] Add @vercel/redwood Builder (#7503) 2022-03-02 15:17:29 -08:00
Nathan Rajlich
983946650e [cli] Remove initial iteration of vc build and Plugins (#7390)
* [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>
2022-02-14 19:00:15 -08:00
Steven
144e890bfa Add plugin packages for go/python/ruby (#6961)
* Add plugin packages

* Fix usage

* Fix build

* Fix workspace linking to build-utils
2021-11-09 12:48:40 -05:00
Gary Borton
d3e98cdb73 [cli] Run middleware as a plugin instead of running directly (#6941)
* 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>
2021-11-08 19:38:13 +01:00
Nathan Rajlich
5b5197d2c5 [node] Create vercel-plugin-node (#6874)
* [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>
2021-11-08 14:59:01 +01:00
Nathan Rajlich
44868d79b6 Add initial vercel-plugin-middleware (#6892)
* 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>
2021-10-29 17:15:20 -07:00
Nathan Rajlich
306f3a1312 Add to "static-config" to run.js script 2021-10-27 17:36:32 -07:00
Nathan Rajlich
646c29600e [cgi] Remove @vercel/cgi Runtime (#6361)
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.
2021-06-14 20:49:05 -07:00
Nathan Rajlich
8d96a57117 Update references of default branch to "main" (#6114) 2021-04-15 10:11:13 -04:00
ernestd
cfae7ec3c2 [all] Remove now prefix in packages (#5928)
* 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>
2021-03-05 16:55:30 -08:00
Nathan Rajlich
ffa36c12d5 [frameworks] Convert to TypeScript (#5740)
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
2021-02-09 22:55:49 +00:00
Nathan Rajlich
375a55ebed [next][redwood][static-build] Remove frontend runtimes (#5640) 2021-01-05 14:11:55 -08:00
Steven
b118e461b1 [redwoood] Add runtime @vercel/redwood (#4676)
### Changes
- Add new Runtime: `@vercel/redwood`
- Update `run.js` script to sort packages properly

### Related
- Related to #4539 
- Related to #4535
- Depends on https://github.com/apollographql/apollo-server/pull/4311
2020-07-23 16:22:48 -04:00
Steven
ee9b3710ec [build-utils] Remove --ignore-engines flag (#4508)
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.
2020-05-27 16:10:42 -04:00
Nathan Rajlich
820ecc7254 [tests] Fix Windows tests filtering logic and branch name detection (#4441)
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
…
```
2020-05-21 16:03:34 +00:00
Steven
921327d878 [api] Update build script (#4224)
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.
2020-05-01 09:42:40 -04:00
Steven
28e01528c5 [all] Rename ZEIT Now to Vercel (#4112)
https://vercel.com/blog/zeit-is-now-vercel

Co-authored-by: Nathan Rajlich <n@n8.io>
2020-04-21 19:11:12 -04:00
Shu Uesugi
e10b42bfdc Rename zeit.co/new → zeit.co/import (#3834)
* zeit.co/new → zeit.co/import

* Update docs URL
2020-02-25 01:35:12 +01:00
Andy
a9bf011f2c [api] Add rewrite to frameworks API (#3794)
* [api] Add rewrite to frameworks API

* Adjust now.json

* Change output file
2020-02-14 00:30:58 +01:00
Steven
eb793ba139 [tests] Add windows to CI unit tests (#3727)
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.
2020-02-11 01:16:14 +00:00
Steven
5e8541b936 [tests] Don't run tests in forks (#3713)
There is no need to run the tests in a fork because when the forked repo submits a PR to this repo, the tests will run.
2020-01-31 18:49:56 -05:00
Steven
aea3f58970 [api] Fix build script (#3615)
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.
2020-01-17 13:08:41 -05:00
Andy
4dd640636c Clean up files in the repo (#3528)
Clean up files in the repo
2020-01-09 14:16:46 +00:00