Commit graph

29 commits

Author SHA1 Message Date
JJ Kasper
8373776f5e
Revert turborepo to 1.13.3-canary.2 cont. (#64895)
Continues https://github.com/vercel/next.js/pull/64892 which reverted
original upgrade first before applying the upgrade to version we think
should be clear.

Closes NEXT-3198
2024-04-22 23:40:49 +00:00
JJ Kasper
75c9e2b85e
Revert turborepo to 1.13.3-canary.2 (#64892)
Reverts turborepo bump while investigating some issues

reverts: https://github.com/vercel/next.js/pull/64767
reverts: https://github.com/vercel/next.js/pull/64842 

x-ref: [slack
thread](https://vercel.slack.com/archives/C04KC8A53T7/p1713816363062429)

Closes NEXT-3195
2024-04-22 21:29:13 +00:00
Tim Neutkens
2c14ea5258
Move next-swc Turborepo config to packages/next-swc (#64789)
## What?

Turborepo supports nested `turbo.json`. Moving this config down into
`packages/next-swc` so that the `next-swc` specific config is not in the
global config file.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes NEXT-3169
2024-04-21 20:17:05 +02:00
Tim Neutkens
bd6ab041a4
Upgrade Turborepo (#64767)
## What?

Upgrade Turborepo to the latest version and enable the new terminal UI
to dogfood: https://turbo.build/blog/turbo-1-13-0#new-terminal-ui.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes NEXT-3164
2024-04-19 18:26:54 +00:00
OJ Kwon
9cadae5eef
feat(next-swc): support wasm32-* build target (#61586)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### How?

Closes NEXT-
Fixes #

-->

### What?

This PR introduces a ground work to generate wasm bindings package from
our napi bindings. This doesn't actually replace anything yet, however
aim to establish our napi bindings package can be built against wasm32
target.

### Why?

We currently have two bindings package to generate native / wasm target
support, one for napi and one other for wasm. Recently napi-rs started
to support to generate bindings for the wasm directly - which means we
can get rid of the wasm-pack based bindings code entirely and maintain a
single bindings code only.

This'll makes our `next-swc` simpler as well, since the invocation to
the bindings now becomes identical we don't have to additional wasm
specific logics to invoke functions (i.e transform, transformsync..).
Also napi generates wasi-supported wasm bindings, provides few more
features to the current wasm bindings.

#### Good
- Async napi binding fn works transparently (`transform`, `minify`...)
- (Experimental) thread supports depends on node.js runtime
- Wasi support: i.e it can even read filesystem directly!

#### Things to consider
- node.js's wasi support is experimental yet
- napi-rs's wasm support is in beta yet, specifically `packaging`
generated wasm output.

Due to `things to consider` reasons, this PR does not replace existing
wasm target yet. We should be able to plan out things later.

**What happens to the turbopack api in napi bindings?**

Simply put, this **does not support turbopack in wasm**. Build works by
disabling turbopack (more notably, underlying dependency doesn't support
wasm) features. It is something to explore separately.


Closes PACK-2367


There is a branch at https://github.com/vercel/next.js/pull/61586 shows
quick demo for importing, running sync / async / read external files.
2024-02-06 10:15:13 -08:00
OJ Kwon
46370d816b
refactor(next/core): reorganize next.js custom transforms for next-swc/turbopack (#60400)
<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change



-->

### What?

This PR refactors organization for the rust side packages to build
`next-swc`.

### Why?

We had some historical legacy around package structures, have ambiguous
name for `core` / `next-core`. One contains swc transform visitor for
the next.js, and the other one is new for turbopack's core next.js
features. In addition to that, there was a package dependency chain
prevents to use `core` in the turobpack / next-swc both, so each time
porting a transformer into turbopack it requires to extract new
dependency to be imported in the both place.

PR touches its organization - while PR is large to touch various files,
the crux is summarized at
2cedd06ea5
:

1. `core` becomes `next-custom-transforms`, also this becomes an
agnostic pkg can be imported in turbopack / wasm / next-swc
2. simplify dependency chain to import next-custom-transforms, organized
as below

```mermaid
flowchart TD
    C(next-custom-transforms) --> A(napi)
    C(next-custom-transforms) --> B(wasm)
    D(next-core) --> A(napi)
    E(next-build) --> A(napi)
    F(next-api) --> A(napi)
    C(next-custom-transforms) --> D
    D(next-core) --> F(next-api)
    D(next-core) --> E(next-build)
```

`impl CustomTransformer` for the each transform still lives in
`next-core`, so turbopack specific dependency is isolated under
`next-core/build/api`.


Closes PACK-2201
Closes PACK-2202

---------

Co-authored-by: hrmny <8845940+ForsakenHarmony@users.noreply.github.com>
2024-01-09 12:23:47 -08:00
JJ Kasper
8997ab0812
Implement granular rust caching (#54582)
This fixes our caching for the docker builds as they were missing inputs
the other jobs had also enables caching the rust target cache which
improves build times when only changing our package and the lockfile
isn't invalidated.

Tested here https://github.com/vercel/next.js/actions/runs/5987764387
2023-08-26 18:54:14 -07:00
JJ Kasper
9a6ae144a9
Update swc runners config (#53939)
This fixes unexpected cache hits occurring causing latest next-swc
changes to not be built for the docker based builds. Noticed in our
turbo run summaries for these builds that no input files were detected
most likely due to older Node.js/pnpm versions being used from the old
Docker image.

This also updates to leverage new runner labels for better build perf
cutting build times down from over an hour down to around 20 min.

Fixes build issue on aarch64-linux-musl due to `TurboMalloc` not being
able to resolve. Test build done here
https://github.com/vercel/next.js/actions/runs/5850893681/job/15860929304

x-ref:
https://github.com/vercel/next.js/actions/runs/5843580924/job/15845848384

x-ref:
https://github.com/vercel/next.js/actions/runs/5837652747/job/15833506858
x-ref:
https://github.com/vercel/next.js/actions/runs/5837652747/job/15833506925
x-ref:
https://github.com/vercel/next.js/actions/runs/5837652747/job/15833507067
x-ref:
https://github.com/vercel/next.js/actions/runs/5837652747/job/15833507135
2023-08-13 19:02:48 -07:00
JJ Kasper
0c70b9fff6
Fix build-native turbo config (#53380)
The turbo cache is currently not being invalidated for our `build-native` jobs when the root `Cargo.lock` is changed so https://github.com/vercel/next.js/pull/53308 never actually got re-built/applied in CI and tests are unexpectedly passing. 

x-ref: [slack thread](https://vercel.slack.com/archives/C04DUD7EB1B/p1690808468319679)

- Related to https://github.com/vercel/next.js/pull/52414
2023-07-31 14:00:30 +00:00
Steven
0abc874ed5
chore(ci): fix turbo input path globs (#52414)
This PR fixes turbo.json inputs to avoid cache hit when it should be cache miss.

Example PR it was incorrectly cached:

- [PR 52407](https://github.com/vercel/next.js/pull/52407)
- [Commit 06b780](06b780e15e)
- [Logs with cache hit](https://github.com/vercel/next.js/actions/runs/5488474758/jobs/10001427837#step:27:29)

The docs mention the glob is relative to the workspace (aka package) directory, not the monorepo root.

> inputs globs must be specified as relative paths rooted at the workspace directory.

https://turbo.build/repo/docs/reference/configuration#inputs
2023-07-08 01:57:24 +00:00
JJ Kasper
32ac3ef549
Ensure we run cargo-integration on next change (#51736)
This is currently only running for `next-swc` change but we want this
running on `next` change as well as they both impact these tests.

x-ref:
https://github.com/vercel/next.js/actions/runs/5362063391/jobs/9728782834
2023-06-23 21:57:29 -07:00
Leah
5d54eaaf18
type check tests (and convert next-test-utils.js to ts) (#51071)
Enables type checking for tests in CI and fixes a bunch of things related to that
2023-06-23 17:42:50 +00:00
Alex Kirszenberg
c6313606c9
Next Build Turbo POC (2) (#51546)
Another attempt at getting https://github.com/vercel/next.js/pull/49942 in.

This time, the mold install step is gated to Linux.
2023-06-22 08:03:44 +00:00
JJ Kasper
41ce805de5
Revert "Next Build Turbo POC (#49942)" (#51538)
This reverts commit 7d0bdab83e.

This is failing all builds blocking releases so this reverts it for now
to allow further investigation async.
2023-06-19 21:54:04 -07:00
Alex Kirszenberg
7d0bdab83e
Next Build Turbo POC (#49942)
This contains the original POC for `next build --turbo`. The implementation is _just enough_ to get pages building, and doesn't support the app router yet.

I'll write more details here on the implementation and what the next steps are next week.

Necessary changes on the Turbo side: https://github.com/vercel/turbo/pull/4998
2023-06-19 14:36:05 +00:00
Tobias Koppers
6b0a6f0c25
add turbopack integration tests to CI (#50904)
### What?

* enable turbopack tests in new CI
* split pre-build step into native and JS builds to allow to start
native tests faster
* update swc_core to sync with turbo
* update turbopack

### Why?

Running our test suite is still important as long we don't have the full
integration test suite enabled.

### Turbopack updates

* https://github.com/vercel/turbo/pull/5215 <!-- OJ Kwon - ci(workflow):
upload benchmark results to datadog -->
* https://github.com/vercel/turbo/pull/5239 <!-- OJ Kwon -
fix(swc_plugin): use shared runtime -->
* https://github.com/vercel/turbo/pull/3090 <!-- CHEN Yuan - Docs: prior
to run testcases, add guides to install dependencies for testcases. -->
* https://github.com/vercel/turbo/pull/5264 <!-- Tobias Koppers - update
test runner -->

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-06-12 07:47:43 -07:00
JJ Kasper
a3ab542630
Add new build and test workflow (#50436)
This adds new `build and test` and `build and deploy` workflows in favor
of the existing massive `build, test, and deploy` workflow. Since the
new workflows will use `pull_request_target` this waits to remove the
existing workflow until the new one is tested.

While testing this new workflow flakey behavior in tests have also been
addressed. Along with the new workflow we will also be leveraging new
runners which allow us to run tests against the production binary of
`next-swc` so this avoids slight differences in tests we've seen due to
running against the dev binary.

Furthermore we will have a new flow for allowing workflow runs on PRs
from external forks which will either require a comment be checking a
box approving the run after each change or a label added by the team.

The new flow also no longer relies on `actions/cache` or similar which
have proven to be pretty unreliable.

Tests runs with the new workflow can be seen here
https://github.com/vercel/next.js/actions/runs/5100673508/jobs/9169416949
2023-05-27 21:02:31 -07:00
Donny/강동윤
54ea0d95a0
feat: Allow trace-level logging for non-published release builds (#49564)
### What?

Disable `tracing/release_max_level_info` for non-published release
builds. I modified CI script to strip out logging for published
binaries.

### Why?

x-ref: https://vercel.slack.com/archives/C03EWR7LGEN/p1683621374204959

It's required to print logging for turbopack.

### How?

Closes WEB-1032

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2023-05-10 14:50:36 +02:00
Jan Kaifer
902bb40454
Remove unused code from test-pack turbo task (#48487)
We decided in https://github.com/vercel/next.js/pull/48308 that we won't
use `turbo` when packing packages for tests.

This PR removes all code associated with that effort. The whole thing
fas behind a flag, so it shouldn't affect anything.
fix NEXT-1025
2023-04-18 12:12:00 +00:00
Jan Kaifer
558d61f5fc
Fix turbo cache miss due to depending on gitignored files (#45166)
Workaround for this issue in turbo https://github.com/vercel/turbo/issues/2560

It caused that we always cache-missed.
2023-01-24 11:53:07 +00:00
Jan Kaifer
d7307cffb7
Fix turbo usage in tests (#44715) 2023-01-18 20:35:28 +01:00
OJ Kwon
3dd9af785c
build(cargo): fix turbopack + next-swc build (#43983)
Fixes WEB-301. 

This PR fixes build failure with latest turbopack, also update necessary
dependencies.

---

Edit by @kdy1:
 - Closes https://github.com/vercel/next.js/issues/43052
2022-12-19 13:10:02 -08:00
JJ Kasper
ea9c5aac5f
Update caching for swc turbo builds (#42929)
Updates to leverage turbo remote caching for the swc builds and
normalize the package versions to prevent repo version bumps from
un-necessarily invalidating the cache.

Full cache hits can be seen in this test run
https://github.com/vercel/next.js/actions/runs/3469932131/jobs/5797559609
2022-11-15 08:24:04 -08:00
Balázs Orbán
a83cfcdc78
chore: make sure polyfills are built for pnpm dev (#41062)
Re-lands #40335 but without modifying the lock file.


## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2022-09-30 14:54:38 +00:00
Tim Neutkens
a78ce92ede Revert "chore: make sure polyfills are built for pnpm dev (#40335)"
This reverts commit 24f573f8be.
2022-09-30 15:16:17 +02:00
Balázs Orbán
24f573f8be
chore: make sure polyfills are built for pnpm dev (#40335)
Utilize `turbo` for `dev`, and make sure polyfills are built. Fixes #40334

Another option would be to document that an initial `pnpm build` is necessary in  [`CONTRIBUTING.md`](https://github.com/vercel/next.js/blob/canary/contributing.md#developing).

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
2022-09-30 02:03:47 +00:00
JJ Kasper
1d1ffc88b7
Update to leverage turbo for build/prepublish (#37280)
* Update to leverage turbo for build/prepublish

* update path

* remove extra turbo config
2022-05-30 19:05:27 -05:00
OJ Kwon
951b29e5cc
build(actions): skip plugin features for non supported platform (#37229)
* build(actions): skip plugin features for non supported platform

* test builds

* update turbo config

* Revert "test builds"

This reverts commit 50bdb9765b9fcd4c09e4dcf6566f512ac1a30da0.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-05-26 20:32:43 -05:00
LongYinan
2012f4e7c6
Update components in GitHub Actions (#36669)
`build-native` jobs tested on https://github.com/vercel/next.js/runs/6288266017
2022-05-04 18:51:25 +00:00