Commit graph

329 commits

Author SHA1 Message Date
Justin Ridgewell
5337e1fedb Fix nitpicks with load-next-config (vercel/turbo#3064)
Re: code review nits from vercel/turbo#2955
2022-12-18 21:03:08 +08:00
LongYinan
2182d7df0a Load next config (vercel/turbo#2955)
Load next.config.js via turbopack-node

Closes WEB-158

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2022-12-18 01:35:43 +01:00
Justin Ridgewell
f583c9809b Remove chunk item source maps from the asset graph (vercel/turbo#3059)
In order to serve source maps with HMR updates, we (used to) reference a source map asset for every chunk item using the items version hash (see vercel/turbo#2464 and vercel/turbo#2474 for the headaches this can cause).

This update changes that, so that a chunk becomes responsible for giving access to one of its item's source map. We already have the `GenerateSourceMap` trait which assembles the chunk's `Sectioned` source map from all chunk items, so why not just allow access to an individual section? Coupled with a `ContentSource` that can retrieve the chunk, we can then provide access to that chunk's current item source maps per request.
2022-12-17 22:31:38 +00:00
OJ Kwon
4e59cabbc0 cargo(build): expose tls for next-binding (vercel/turbo#3040) 2022-12-16 20:59:10 -08:00
Will Binns-Smith
3ca10da03b Fix flakey next-dev integration tests (vercel/turbo#3020)
Fixes WEB-259

This should address the known cases of flakiness in the next-dev
integration test suite. Most notably, it wraps the call to
`browser.new_page`, which not only opens a new tab, it also navigates to
the destination and waits for it to load. It also:

* Migrates test code to `anyhow::Result`, and adds `context` to the
`new_page` call should it fail again.
* Mitigates flakiness resulting from browser-side Jest timeouts by
moving the circular correctness test to a new directory called
`__flakey__`. These tests aren't run at all -- unfortunatley it's not
possible to customize Jest's timeout with this particular version of
`jest-circus-browser`. WEB-319 tracks updating this dependency, which
hasn't been maintained in a while, unlike `jest-circus` itself.

Test Plan:
* [x] Run the Rust test suite in CI until confident there are no
intermittent failures.
2022-12-16 10:56:19 -08:00
OJ Kwon
339777a16e feat(mdx): initial turbopack-mdx asset (vercel/turbo#2979)
Implements / fix WEB-86. This PR is an initial attempt to support mdx
natively inside of turbopack.

It uses mdxrs (https://github.com/wooorm/mdxjs-rs) internally to interop
- compile - mdx inputs into renderable ecma outputs. PR creates a new
type of asset `MDXAsset`, and then let its extension (`.mdx`) can be
consumed by turbopack.

Since mdx is a variant of ecma asset to be rendered, it requires to
perform all of the ecma transforms in the current running turbopack
session. But since its AST is not compatible to plain swc (or ecma), it
also cannot be passed into existing ecmaassets. MDXAsset does interop
for those, by creating a virtualasset for the ecma once mdx is compiled
into plain ecma. This might not be feasible appoarch and requires
different way to chain asset types, something I'd like to address in
this PR. I guess this will be needed for other types of assets in a long
run - where input is not an ecma but requires ecma transforms (i.e vue,
ng templates).
2022-12-15 09:22:03 -08:00
OJ Kwon
9e7bf34b21 build(next/core): allow to specify tls backend for reqwest (vercel/turbo#2994)
Implement / fixes WEB-306.

We can't rely on default tls backend for reqwest and hope to work with
every target platform we support, due to several constraints. Some
target cannot use -sys (openssl-sys), and some can't build rustls due to
trasnsitive dep support issue.

PR creates explicit opt-in features for those and let upstream
application can specify what they need. `next-dev` currently sets
`native-tls` as default for the general dev workflow conveniences, but
that doesn't mean we promote it as default feature set - next-swc, or
other like standalone turbopack will configure features by themselves
when build binaries for their own.
2022-12-14 17:07:04 -08:00
Justin Ridgewell
f590196931 Add support for new URL (vercel/turbo#2944)
Implements `new URL('./path', import.meta.url)`, so that the referenced file acts as a static output file, and transforms the URL into to point to that file in the graph.

This is, well, complicated. As you'll see in the comments, we have an "inert" asset that acts as a placeholder until the module chunking algorithm gives us access to a `ChunkingContextVc`. It's unfortunately not available when we're doing the file parsing, but we can insert a reference to that inert asset. That inert asset will eventually create a `UrlAssetChunk` instance, and with that we can finally generate the correct output path for the URL referenced file.

We actually discussed whether this could use a `StaticAsset`/`StaticModuleAsset` (a `StaticAsset` can be inserted at parse time), but it turns out that won't give us the necessary control to generate the final `URL` instance. A `StaticModuleAsset` always outputs an absolute path as it's default export, and that just won't work when we're trying to reference the file in node SSR.

Fixes WEB-142.
Pending WEB-279 for full node SSR support.

Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
2022-12-14 23:44:32 +00:00
OJ Kwon
650b80366b style(turbopack): clippy --fix (vercel/turbo#3014)
Easy clippy improvements via `clippy --fix`.
2022-12-14 21:53:12 +00:00
Nicholas Yang
8f3b7ec7bc feat(rust-port): Split up shim and cli (vercel/turbo#2970)
* Created two separate chains for executing commands: One that uses the parsed arguments from clap that are
serialized to json, the other that still uses Cobra. Now to test to ensure that both do the same thing

* Adjusted json serialization. Now debugging

* Hooked up new CLI to commands

* Fixing compile error

* fixing lint error

* Fixing more Go lint errors

* Fixing lint errors

* fixing up tests

* Only using turbo state with link, login, and logout commands

* Reverting changes

* Removing more changes

* Deleting code and fixing lints

* Removed unlink command

* Fixing bugs

* Reverting more changes

* fixed all tests

* Refactored away duplicates using CLIConfigProvider interface

* Lint fixes

* Minor order tweak

* Added error if command is not handled

* PR feedback

* Minor fixes. Adding --__test-run flag

* Added workaround for subcommand help

* Moved logic around to accomodate login/logout/link/unlink

* Added some documentation, removed some printf

* Adding more tests.

* Hooked up link/login/unlink to --__test-run flag. Also added prysk tests for it.

* Split up derive into multiple lines

* Added comment explaining clap v3 in Cargo.toml

* Ported daemon

* Cleaning up code. Removed imports

* Fix lints

* Fixing lints

* Ported prune to Rust CLI

* Going all the way. Porting run to Rust CLI and upgrading back to clap v4

* Always gotta be testing

* Always be testing. Always. Be. Testing.

* Added tests for each singular flag. Now for combination tests

* WIP: Hooking up Rust CLI to Go run logic

* Disable color

* Removed root inference from Go side

* Fixing compile errors

* Update cli/cmd/turbo/main.go

Co-authored-by: Chris Olszewski <chrisdolszewski@gmail.com>

* Patching up code for run

* PR changes

* Restored labeler

* Restore og.tsx

* Reverted run changes that somehow made it in here

* Fix run

* Update cli/internal/turbostate/turbostate.go

Co-authored-by: Chris Olszewski <chrisdolszewski@gmail.com>

* feat: polyfill `global` with `globalThis` (vercel/turbo#2666)

This PR changes the ecmascript chunk logic to polyfill `global` with `globalThis`. A more complex and less performant solution (but with the benefit of us knowing the runtime environment) would be to add an effect for simple identifier expressions.

* delete IsYarn util (vercel/turbo#2668)

* feat(docs): new authors & consistent filesnames (vercel/turbo#2680)

* Added caveat to environment variables docs (vercel/turbo#2703)

Co-authored-by: Thomas Knickman <tom.knickman@vercel.com>

* Fix publish workflow (vercel/turbo#2681)

* change from yarn to pnpm (vercel/turbo#2686)

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>

* Reverted workflow changes

* Fixing tests. Added run args to base

* Trying to fix tests

* Rewrote some logic around run args handling

* Fixing up tests by adding flags and fixing parsing bugs

* Hooked up RepoState to Go code

* Fixing e2e tests

* Fixing e2e

* Gotta build shim, not turbo in package.json

* Patched integration test

* Reverted Cargo.toml

* Cargo.lock too

* Fixing tests

* Moving turbo binary to shim

* Fixed tests and CI

* Check for TURBO_BINARY_PATH

* Ported shell completions to Rust

* Fixed logic issue with TURBO_BINARY_PATH

* Created .gitignore file with generated rust and header files

* Second try on cleaning up generated files

* More CI fixes

* Realized we still need some inference

* Removed files that are edited by run-examples.sh

* Switched order of `cargo fmt --check` and `cargo clippy` because `cargo clippy` generates files needed for `cargo fmt --check`.

* Cleaning up changes.

* Fix one thing break another

* Accept integration changes

* Deleting more unused code

* Test fixes

* No longer need this line now that src/ffi.rs is gitignored

* PR feedback

* Update cli/internal/run/run.go

Co-authored-by: Chris Olszewski <chrisdolszewski@gmail.com>

* Fixing typo

* Merged main

* PR feedback

* PR feedback

* Merge main

* Reverted workflow change

* Error on invalid unicode instead of lossy conversion

* PR feedback

* Squashed commit of the following:

commit 096b8b8b357abe985e4116108af8a87aaba968cb
Author: David Barrat <david@barrat.io>
Date:   Mon Dec 5 15:29:41 2022 +0100

    Docs: Add Authdog to Turbo Showcase page (vercel/turbo#2921)

    [Authdog](https://www.authdog.com/)  is an Identity and Access Management as a Service platform, built upon Serverless technologies (AWS Lambda, Vercel, Fastly and Cloudflare Workers). I started looking for alternatives to Nx, some times ago and experimented with Turbo, decided to migrate some projects to this tool, awesome stuff!

commit e39d65eb5b97140fe6338dabfbd0ac3be2987d8f
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date:   Mon Dec 5 15:23:40 2022 +0100

    enable id reusing (vercel/turbo#2895)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 6b99818abd358ebb4fa3506b493e2fae34372d25
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date:   Mon Dec 5 15:22:53 2022 +0100

    Reduce wrapper tasks by eagerly resolving Vcs (vercel/turbo#2933)

    * resolve codegenerateable before calling it

    * eagerly resolve some constructors to avoid creating many wrapper tasks

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit ce4c445cd2c17021b4397c8e3cf93d91921146ef
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date:   Mon Dec 5 15:22:32 2022 +0100

    Share TaskInputs between task cache and task (vercel/turbo#2923)

    Move bound task function into TaskState to allow unloading

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit e1bf5e2cde7ca2006c8a4c3455dec38e971aa3eb
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date:   Mon Dec 5 14:32:24 2022 +0100

    make sure that removing collectibles will cleanup helper entries (vercel/turbo#2872)

commit 532eff76326fb9237a450345b45073c1061e5a37
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date:   Mon Dec 5 13:27:22 2022 +0100

    Reduce the number of Strings and wrapper tasks (vercel/turbo#2834)

    * use Cow to avoid creating Strings for trait function names
    * trait calls avoid the resolve trait wrapper task when called on a resolved VC
    * eagerly resolve some Vc that would otherwise create a lot of wrapper tasks

    Depends on vercel/turbo#2416

commit dc36fc41586e5763520b4a16d249cdd6779bc902
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date:   Mon Dec 5 11:00:10 2022 +0100

    reduce number of allocations (vercel/turbo#2833)

    VecDeque::new always allocates 7 elements

commit 4f247be94b03f44765ac8bd334194545cd992b9b
Author: Nathan Hammond <nathan.hammond@vercel.com>
Date:   Mon Dec 5 15:39:15 2022 +0800

    Upgrade to Next.js 13 (vercel/turbo#2906)

    This gets our site updated to Next.js 13 and Nextra 2. As a bonus, this should help prevent some of the issues we're seeing in Sentry.

commit 1e818068241c308cd3260bd83eba294d890a6151
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date:   Mon Dec 5 07:42:19 2022 +0100

    shrink lists and sets that are stored in Tasks (vercel/turbo#2873)

    Reduces memory usage by 14%

commit cac79bbe35c5ee7d2bf14625bb709dff8010b8ad
Author: Ahab <ahabhgk@gmail.com>
Date:   Sun Dec 4 13:23:26 2022 +0800

    make lazy bundling for dynamic import more lazy (vercel/turbo#2918)

    For example:

    ```js
    // index.js
    setTimeout(() => {
      import('./async.js').then(() => console.log('async.js loaded'))
    }, 1000)
    ```

    ```js
    // async.js
    import './async.css';
    console.log('async.js content')
    ```

    For now the graph generated by above code will be like this:

    <img width="1461" alt="Screen Shot 2022-12-03 at 21 22 24" src="https://user-images.githubusercontent.com/42857895/205442932-ebfd5126-ef3d-4205-b5b5-434126ad46f7.png">

    The `ChunkGroup_async` will be a async chunk group of `ChunkGroup_index`, pushed at [turbopack-core/src/chunk/mod.rs#L462](e1a9bcb94d/crates/turbopack-core/src/chunk/mod.rs (L462)), and it will have a reference between `ChunkGroup_index` and `ChunkGroup_async`, but `ChunkGroup_async` will also be a chunk group of `ChunkGroup_async-manifest-chunk` created at [turbopack-ecmascript/src/chunk/loader.rs#L165](e1a9bcb94d/crates/turbopack-ecmascript/src/chunk/loader.rs (L165)), and will have a reference between `ChunkGroup_async-manifest-chunk` and `ChunkGroup_async`.

    This leads to when the browser request '/_a8a837.js', turbopack will compile chunks in `ChunkGroup_index` ('/_a8a837.js'), `ChunkGroup_async-manifest-chunk` ('/src_async.js_manifest-chunk.js'), and also chunks in `ChunkGroup_async` ('/src_async.js', '/src_async.css'), because of the reference between `ChunkGroup_index` and `ChunkGroup_async`.

    But the expected behavior is only compile chunks in `ChunkGroup_index` and `ChunkGroup_async-manifest-chunk`, so this PR deleted the reference between `ChunkGroup_index` and `ChunkGroup_async`, makes the graph be like this:

    <img width="1461" alt="Screen Shot 2022-12-03 at 21 50 29" src="https://user-images.githubusercontent.com/42857895/205444165-7b266dce-9aa6-4829-b8dc-d2bf74642aff.png">

    And makes chunks in `ChunkGroup_async` to be compiled only when the browser request '/src_async.js_manifest-chunk.js'.

commit fd09f2e7cba7bcff030c1f10f31fc0155dd055fe
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Sun Dec 4 03:26:37 2022 +0000

    chore(deps): update dependency @types/node to v18.11.10 (vercel/turbo#2928)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: Thomas Knickman <tom.knickman@vercel.com>

commit 429e91eae5c313556fe8cb0bde87ab521e28d7cf
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Sat Dec 3 22:21:26 2022 -0500

    chore(deps): update dependency @babel/core to v7.20.5 (vercel/turbo#2919)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit c2d5a07dc58a57434cf2aed00a1ce428215f585e
Author: Tobias Koppers <tobias.koppers@googlemail.com>
Date:   Sat Dec 3 22:11:10 2022 +0100

    update chromiumoxide (vercel/turbo#2916)

    updating in hope that this fixes the random errors in test runs

commit e1a9bcb94d439856982fd7edb522ba3122699f2d
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Sat Dec 3 08:54:50 2022 +0000

    chore(deps): update rust crate futures to 0.3.25 (vercel/turbo#2915)

    [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

    This PR contains the following updates:

    | Package | Type | Update | Change |
    |---|---|---|---|
    | [futures](https://rust-lang.github.io/futures-rs) ([source](https://togithub.com/rust-lang/futures-rs)) | dev-dependencies | patch | `0.3.21` -> `0.3.25` |
    | [futures](https://rust-lang.github.io/futures-rs) ([source](https://togithub.com/rust-lang/futures-rs)) | dependencies | patch | `0.3.21` -> `0.3.25` |
    | [futures](https://rust-lang.github.io/futures-rs) ([source](https://togithub.com/rust-lang/futures-rs)) | dependencies | patch | `0.3.24` -> `0.3.25` |

    ---

    ### ⚠ Dependency Lookup Warnings ⚠

    Warnings were logged while processing this repo. Please check the Dependency Dashboard for more information.

    ---

    ### Release Notes

    <details>
    <summary>rust-lang/futures-rs</summary>

    ### [`v0.3.25`](https://togithub.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#&vercel/turbo#8203;0325---2022-10-20)

    [Compare Source](https://togithub.com/rust-lang/futures-rs/compare/0.3.24...0.3.25)

    -   Fix soundness issue in `join!` and `try_join!` macros ([#&vercel/turbo#8203;2649](https://togithub.com/rust-lang/futures-rs/issues/2649))
    -   Implement `Clone` for `sink::Drain` ([#&vercel/turbo#8203;2650](https://togithub.com/rust-lang/futures-rs/issues/2650))

    ### [`v0.3.24`](https://togithub.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#&vercel/turbo#8203;0324---2022-08-29)

    [Compare Source](https://togithub.com/rust-lang/futures-rs/compare/0.3.23...0.3.24)

    -   Fix incorrect termination of `select_with_strategy` streams ([#&vercel/turbo#8203;2635](https://togithub.com/rust-lang/futures-rs/issues/2635))

    ### [`v0.3.23`](https://togithub.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#&vercel/turbo#8203;0323---2022-08-14)

    [Compare Source](https://togithub.com/rust-lang/futures-rs/compare/0.3.22...0.3.23)

    -   Work around MSRV increase due to a cargo bug.

    ### [`v0.3.22`](https://togithub.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#&vercel/turbo#8203;0322---2022-08-14)

    [Compare Source](https://togithub.com/rust-lang/futures-rs/compare/0.3.21...0.3.22)

    -   Fix `Sync` impl of `BiLockGuard` ([#&vercel/turbo#8203;2570](https://togithub.com/rust-lang/futures-rs/issues/2570))
    -   Fix partial iteration in `FuturesUnordered` ([#&vercel/turbo#8203;2574](https://togithub.com/rust-lang/futures-rs/issues/2574))
    -   Fix false detection of inner panics in `Shared` ([#&vercel/turbo#8203;2576](https://togithub.com/rust-lang/futures-rs/issues/2576))
    -   Add `Mutex::lock_owned` and `Mutex::try_lock_owned` ([#&vercel/turbo#8203;2571](https://togithub.com/rust-lang/futures-rs/issues/2571))
    -   Add `io::copy_buf_abortable` ([#&vercel/turbo#8203;2507](https://togithub.com/rust-lang/futures-rs/issues/2507))
    -   Remove `Unpin` bound from `TryStreamExt::into_async_read` ([#&vercel/turbo#8203;2599](https://togithub.com/rust-lang/futures-rs/issues/2599))
    -   Make `run_until_stalled` handle self-waking futures ([#&vercel/turbo#8203;2593](https://togithub.com/rust-lang/futures-rs/issues/2593))
    -   Use `FuturesOrdered` in `try_join_all` ([#&vercel/turbo#8203;2556](https://togithub.com/rust-lang/futures-rs/issues/2556))
    -   Fix orderings in `LocalPool` waker ([#&vercel/turbo#8203;2608](https://togithub.com/rust-lang/futures-rs/issues/2608))
    -   Fix `stream::Chunk` adapters size hints ([#&vercel/turbo#8203;2611](https://togithub.com/rust-lang/futures-rs/issues/2611))
    -   Add `push_front` and `push_back` to `FuturesOrdered` ([#&vercel/turbo#8203;2591](https://togithub.com/rust-lang/futures-rs/issues/2591))
    -   Deprecate `FuturesOrdered::push` in favor of `FuturesOrdered::push_back` ([#&vercel/turbo#8203;2591](https://togithub.com/rust-lang/futures-rs/issues/2591))
    -   Performance improvements ([#&vercel/turbo#8203;2583](https://togithub.com/rust-lang/futures-rs/issues/2583), [#&vercel/turbo#8203;2626](https://togithub.com/rust-lang/futures-rs/issues/2626))
    -   Documentation improvements ([#&vercel/turbo#8203;2579](https://togithub.com/rust-lang/futures-rs/issues/2579), [#&vercel/turbo#8203;2604](https://togithub.com/rust-lang/futures-rs/issues/2604), [#&vercel/turbo#8203;2613](https://togithub.com/rust-lang/futures-rs/issues/2613))

    </details>

    ---

    ### Configuration

    📅 **Schedule**: Branch creation - "after 10pm every weekday,before 5am every weekday,every weekend" (UTC), Automerge - At any time (no schedule defined).

    🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

    ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

    ---

     - [ ] If you want to rebase/retry this PR, check this box

    ---

    This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/vercel/turbo).

commit 93222f2b22d43bd9c1d917350f810e5398ca9d49
Author: Anthony Shew <anthony.shew@vercel.com>
Date:   Fri Dec 2 16:36:55 2022 -0800

    feat(docs): document topology outside of a task (vercel/turbo#2879)

    * Docs for topology outside of a task

    Documentation for behavior in vercel/turbo#2855!

    * Minor cleanup.

    * Some copy updates and add image.

    Co-authored-by: Thomas Knickman <tom.knickman@vercel.com>

commit f8aaf81cb7c833f672001eb36d30d700e1cf6cc9
Author: Will Binns-Smith <wbinnssmith@gmail.com>
Date:   Fri Dec 2 16:32:35 2022 -0800

    Link to Turbopack's architecture.md from CONTRIBUTING.md (vercel/turbo#2913)

commit 07231701892cbca7b73e35bfb490f2514770628e
Author: Thomas Knickman <tom.knickman@vercel.com>
Date:   Fri Dec 2 16:40:08 2022 -0500

    feat(docs): add github (vercel/turbo#2912)

commit c69298c4a31516129bb62263f163a1da9c5614da
Author: OJ Kwon <1210596+kwonoj@users.noreply.github.com>
Date:   Fri Dec 2 11:58:55 2022 -0800

    build(cargo): update swc_core, dependencies to resolve circular deps (vercel/turbo#2869)

    * build(cargo): bump up swc_core

    * build(cargo): unpin indexmap

    * build(cargo): update dependencies

    * style(cargo): adjust format

commit 6965cb81ef5693b3e7a23e6a999be04d6590fad5
Author: Leah <github.leah@hrmny.sh>
Date:   Fri Dec 2 19:42:05 2022 +0100

    set correct cwd for server renderer (vercel/turbo#2886)

commit 934567015bc99eb8aa80311623e52ea924cbc424
Author: Leah <github.leah@hrmny.sh>
Date:   Fri Dec 2 18:27:02 2022 +0100

    fix dynamic paths (vercel/turbo#2884)

commit eead9063968a3b8571e3ba2c7a897522f890e2fc
Author: Nathan Hammond <nathan.hammond@vercel.com>
Date:   Fri Dec 2 16:09:08 2022 +0800

    Fix the missing links. (vercel/turbo#2707)

    This PR does three things:
    1. Prevents double redirects by setting the correct destination the first time.
    2. Redirects URLs accidentally recreated in the new scope. 🤦‍♂️
    3. Removes a catch-all to trigger any additional missing links to appear.

    Changes are easy to review commit-by-commit.

commit b8c0c3c74636fd4b0586951011919bc05e1f651d
Author: Nathan Hammond <nathan.hammond@vercel.com>
Date:   Fri Dec 2 14:37:03 2022 +0800

    Update lint-staged behavior. (vercel/turbo#2904)

    Before vercel/turbo#2859:
    `eslint --quiet --fix`

    After vercel/turbo#2859:
    `pnpm run lint --quiet --fix --`
    =>
    `eslint . --ext js,jsx,ts,tsx --quiet --fix --`

    After this:
    `eslint --ext js,jsx,ts,tsx --quiet --fix --`

    Removes the sneaky `.`.

commit 336ea22098ff8825e83baa2561d8ec0acf5b52af
Author: Nathan Hammond <nathan.hammond@vercel.com>
Date:   Fri Dec 2 08:33:21 2022 +0800

    Add additional detailed warning message if no tasks were run. (vercel/turbo#2778)

    This is a quality of life improvement output log so that you don't have to tease it out from the overall run summary and the situation is more-apparent.

commit dcb1ab33d1f9571177b9db51e3e0cbbbe8e021e1
Author: Leah <github.leah@hrmny.sh>
Date:   Thu Dec 1 21:02:33 2022 +0100

    simplify `next-binding` (vercel/turbo#2899)

commit 22c1440283ed4dfd1e310210108244c4c12d4c56
Author: Justin Ridgewell <justin@ridgewell.name>
Date:   Thu Dec 1 13:55:15 2022 -0500

    Implement import.meta (vercel/turbo#2816)

    I chose to have the `import.meta.url` to have the relative project path on disk.

    Webpack makes it the absolute system path, but that would make the JS output system dependent and I didn't like that. Vite doesn't bundle and uses the browser's behavior, which is the dev server path.

    I'm splitting this from the in-progress PR to implement `new URL(…, import.meta.url)` support. That requires a bunch of changes to the analysis code and a new FS content source, so it's taking longer to ship.

    Fixes WEB-137.

commit 75a7d1ea450cdaa629920464b509f3098997ae06
Author: Thomas Knickman <tom.knickman@vercel.com>
Date:   Thu Dec 1 11:40:15 2022 -0500

    fix(examples): cra pnpm fix (vercel/turbo#2897)

* Merged main

* Reverting changes that snuck in

* Fixing tests

* Final fixes for tests

* Moving shim to crates/turborepo

* More refactoring

* First pass at splitting up shim and cli

* Fixing tests

* Added detection for help flag so users can get help outside of a valid repo

* Update crates/turborepo-lib/src/shim.rs

Co-authored-by: Chris Olszewski <chrisdolszewski@gmail.com>

* Update crates/turborepo/Cargo.toml

Co-authored-by: Chris Olszewski <chrisdolszewski@gmail.com>

* PR feedback and test fixing

* Set process's cwd

* Have to do inference even with TURBO_BINARY_PATH

* Comments

* PR feedback

* Moved single_package back to RunArgs

* Removed print

* Fixing bugs

* Fixing rust tests

* fixing bug with verbosity and Go tests

* add local turbo version checking

* remove ffi inclusion

* Fixed integration tests

* Linting fixes

* Integrated local_turbo_supports_skip_shim

* Fixed bug with cwd and restored yarn.lock

* Okay back to setting current_dir

* Fixed bug with canonicalization

* Removed print
starting

Co-authored-by: Chris Olszewski <chrisdolszewski@gmail.com>
Co-authored-by: Florentin / 珞辰 <ecklf@icloud.com>
Co-authored-by: Chris Olszewski <chris.olszewski@vercel.com>
Co-authored-by: Thomas Knickman <tom.knickman@vercel.com>
Co-authored-by: Matt Pocock <mattpocockvoice@gmail.com>
Co-authored-by: Mehul Kar <mehul.kar@vercel.com>
Co-authored-by: Yota Hada <hadayota33@gmail.com>
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2022-12-13 11:07:19 -05:00
Will Binns-Smith
bcb256acf0 @next/font/google: Hash filenames used in virtual file paths (vercel/turbo#2978)
* Implement `DeterministicHash` for `&str`

* @next/font/google: Hash filenames used in virtual file paths

* Apply suggestions from code review

Co-authored-by: Leah <github.leah@hrmny.sh>

Co-authored-by: Leah <github.leah@hrmny.sh>
2022-12-12 19:42:05 -08:00
Will Binns-Smith
3db16aac57 Unmark @next/font/google as unsupported and move feature to gate @next/font/local only (vercel/turbo#2965) 2022-12-12 17:40:30 -08:00
Will Binns-Smith
d486563104 turbo-tasks-fetch: Emit issues on failed fetches (vercel/turbo#2964)
* Initial implementation of FetchIssue

* turbo-tasks-fetch: Emit issues for failed fetches

* Use FetchResult and handle failure in `@next/font/google`

* Apply suggestions from code review

Co-authored-by: Leah <github.leah@hrmny.sh>

Co-authored-by: Leah <github.leah@hrmny.sh>
2022-12-12 17:13:40 -08:00
Will Binns-Smith
e3d210fbcb Add font weight, style to css and js properties (vercel/turbo#2963) 2022-12-12 16:22:52 -08:00
Will Binns-Smith
5904885ba2 Run setup-node in update-google-fonts workflow (vercel/turbo#2980)
* Run setup-node in update-google-fonts workflow

* Update Google font-data.json (ce83bb98897404b791fd96f562a95fc0b20b40da)

Co-authored-by: wbinnssmith <wbinnssmith@users.noreply.github.com>
2022-12-12 15:39:06 -08:00
Leah
6483da8991 update npm deps (vercel/turbo#2960) 2022-12-13 00:38:21 +01:00
Leah
30fa74d3ab page json route (vercel/turbo#2949) 2022-12-10 01:01:58 +01:00
Will Binns-Smith
9d03416cc5 Remove next_static_source (vercel/turbo#2971) 2022-12-09 14:20:15 -08:00
Leah
69ea0005fb page chunk loader (vercel/turbo#2948) 2022-12-09 20:11:41 +00:00
Will Binns-Smith
38ab8397a4 [6/n] @next/font/google: Cache stylesheet locally (vercel/turbo#2940)
* Add font-data.json

* Initial implementation of dynamic ImportMapping replacement

* Extract font urls

* Download fonts

* Update stylesheet

* Vc-ify

* Apply suggestions from code review

Co-authored-by: Alex Kirszenberg <alex.kirszenberg@vercel.com>

* Check in font-data.json update script and update font-data.json

* Add font update to ci schedule

* assert -> bail

* Remove extraction and caching of fonts

Co-authored-by: Alex Kirszenberg <alex.kirszenberg@vercel.com>
2022-12-08 08:54:11 -08:00
Will Binns-Smith
199ed0ea0f [5/n] @next/font/google: Port utilities for generating stylesheet urls (vercel/turbo#2856)
* Implement get_font_axes

* Implement get_stylesheet_url

* Handle font axes without wght

Co-authored-by: Hannes Bornö <hannes.borno@vercel.com>

* Implement extract_font_urls

* Update crates/next-core/src/next_font_google/util.rs

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>

* Remove extraction of fonts

Co-authored-by: Hannes Bornö <hannes.borno@vercel.com>
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2022-12-07 19:38:30 -08:00
Will Binns-Smith
080390e254 Validate @next/font/google query options (vercel/turbo#2812) 2022-12-07 18:20:24 -08:00
Alex Kirszenberg
93703ccca5 Remove unused dependencies (vercel/turbo#2934)
* Remove unused dependencies

* Add back lazy static as a dev dep

* Add back bench dependencies
2022-12-06 15:15:57 +01:00
Will Binns-Smith
5bd8c37921 @next/font [2/n] Apply next/font swc transform (vercel/turbo#2742)
* Check in next-font transform from Next.js repo

* Use next-font transform

* Run transform via custom rule

* Place next/font transform behind cargo feature
2022-12-05 16:09:17 -08:00
Tobias Koppers
807c2b4146 add memory usage tracking (vercel/turbo#2865) 2022-12-05 22:57:30 +00:00
Will Binns-Smith
1b8c636e1e @next/font [1/n] Add query structure to module requests (vercel/turbo#2743)
* Add query structure to module requests

* Update crates/next-dev/src/lib.rs

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2022-12-05 13:47:21 -08:00
Leah
03d6610412 support _devPageManifest.json (vercel/turbo#2885) 2022-12-05 17:30:28 +00:00
Tobias Koppers
4d60d684e6 update chromiumoxide (vercel/turbo#2916)
updating in hope that this fixes the random errors in test runs
2022-12-03 21:11:10 +00:00
renovate[bot]
45079f3afd chore(deps): update rust crate futures to 0.3.25 (vercel/turbo#2915)
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [futures](https://rust-lang.github.io/futures-rs) ([source](https://togithub.com/rust-lang/futures-rs)) | dev-dependencies | patch | `0.3.21` -> `0.3.25` |
| [futures](https://rust-lang.github.io/futures-rs) ([source](https://togithub.com/rust-lang/futures-rs)) | dependencies | patch | `0.3.21` -> `0.3.25` |
| [futures](https://rust-lang.github.io/futures-rs) ([source](https://togithub.com/rust-lang/futures-rs)) | dependencies | patch | `0.3.24` -> `0.3.25` |

---

### ⚠ Dependency Lookup Warnings ⚠

Warnings were logged while processing this repo. Please check the Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>rust-lang/futures-rs</summary>

### [`v0.3.25`](https://togithub.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#&vercel/turbo#8203;0325---2022-10-20)

[Compare Source](https://togithub.com/rust-lang/futures-rs/compare/0.3.24...0.3.25)

-   Fix soundness issue in `join!` and `try_join!` macros ([#&vercel/turbo#8203;2649](https://togithub.com/rust-lang/futures-rs/issues/2649))
-   Implement `Clone` for `sink::Drain` ([#&vercel/turbo#8203;2650](https://togithub.com/rust-lang/futures-rs/issues/2650))

### [`v0.3.24`](https://togithub.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#&vercel/turbo#8203;0324---2022-08-29)

[Compare Source](https://togithub.com/rust-lang/futures-rs/compare/0.3.23...0.3.24)

-   Fix incorrect termination of `select_with_strategy` streams ([#&vercel/turbo#8203;2635](https://togithub.com/rust-lang/futures-rs/issues/2635))

### [`v0.3.23`](https://togithub.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#&vercel/turbo#8203;0323---2022-08-14)

[Compare Source](https://togithub.com/rust-lang/futures-rs/compare/0.3.22...0.3.23)

-   Work around MSRV increase due to a cargo bug.

### [`v0.3.22`](https://togithub.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#&vercel/turbo#8203;0322---2022-08-14)

[Compare Source](https://togithub.com/rust-lang/futures-rs/compare/0.3.21...0.3.22)

-   Fix `Sync` impl of `BiLockGuard` ([#&vercel/turbo#8203;2570](https://togithub.com/rust-lang/futures-rs/issues/2570))
-   Fix partial iteration in `FuturesUnordered` ([#&vercel/turbo#8203;2574](https://togithub.com/rust-lang/futures-rs/issues/2574))
-   Fix false detection of inner panics in `Shared` ([#&vercel/turbo#8203;2576](https://togithub.com/rust-lang/futures-rs/issues/2576))
-   Add `Mutex::lock_owned` and `Mutex::try_lock_owned` ([#&vercel/turbo#8203;2571](https://togithub.com/rust-lang/futures-rs/issues/2571))
-   Add `io::copy_buf_abortable` ([#&vercel/turbo#8203;2507](https://togithub.com/rust-lang/futures-rs/issues/2507))
-   Remove `Unpin` bound from `TryStreamExt::into_async_read` ([#&vercel/turbo#8203;2599](https://togithub.com/rust-lang/futures-rs/issues/2599))
-   Make `run_until_stalled` handle self-waking futures ([#&vercel/turbo#8203;2593](https://togithub.com/rust-lang/futures-rs/issues/2593))
-   Use `FuturesOrdered` in `try_join_all` ([#&vercel/turbo#8203;2556](https://togithub.com/rust-lang/futures-rs/issues/2556))
-   Fix orderings in `LocalPool` waker ([#&vercel/turbo#8203;2608](https://togithub.com/rust-lang/futures-rs/issues/2608))
-   Fix `stream::Chunk` adapters size hints ([#&vercel/turbo#8203;2611](https://togithub.com/rust-lang/futures-rs/issues/2611))
-   Add `push_front` and `push_back` to `FuturesOrdered` ([#&vercel/turbo#8203;2591](https://togithub.com/rust-lang/futures-rs/issues/2591))
-   Deprecate `FuturesOrdered::push` in favor of `FuturesOrdered::push_back` ([#&vercel/turbo#8203;2591](https://togithub.com/rust-lang/futures-rs/issues/2591))
-   Performance improvements ([#&vercel/turbo#8203;2583](https://togithub.com/rust-lang/futures-rs/issues/2583), [#&vercel/turbo#8203;2626](https://togithub.com/rust-lang/futures-rs/issues/2626))
-   Documentation improvements ([#&vercel/turbo#8203;2579](https://togithub.com/rust-lang/futures-rs/issues/2579), [#&vercel/turbo#8203;2604](https://togithub.com/rust-lang/futures-rs/issues/2604), [#&vercel/turbo#8203;2613](https://togithub.com/rust-lang/futures-rs/issues/2613))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 10pm every weekday,before 5am every weekday,every weekend" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/vercel/turbo).
2022-12-03 08:54:50 +00:00
Leah
122983cf39 fix dynamic paths (vercel/turbo#2884) 2022-12-02 18:27:02 +01:00
Leah
b1eb3ea7a6 simplify next-binding (vercel/turbo#2899) 2022-12-01 21:02:33 +01:00
Justin Ridgewell
32d4cad89a Support basic next/image loading (vercel/turbo#2481)
This implements basic support for serving the images requested by `next/image` and `next/future/image`. The big missing features are:

- image width resizing (and thus blurry image placeholders)
- image quality encoding
- format re-encoding

This required a lot more work than I expected, because we have to also override the `remotePatterns` to allow using `next/image` with remote images. The only way I found to do this was to override the `__NEXT_IMAGE_OPTS` env var, which is a special object value injected by webpack's `DefinePlugin` as if it were an `process.env` value.

Fixes https://github.com/vercel/web-tooling-internal/issues/5
Porting from https://github.com/vercel/the-three-body/pull/212
Fixes WEB-150
Fixes WEB-2
2022-12-01 14:25:52 +00:00
LongYinan
235b3c3c08 Split turbopack-node from next-core (vercel/turbo#2874) 2022-12-01 05:51:58 +00:00
Will Binns-Smith
d1e72c8b49 Run taplo format and check consistency in CI (vercel/turbo#2866)
* Add GitHub action step for taplo --check

* Run taplo format
2022-11-30 19:05:07 -08:00
Leah
65016c65e3 display multiple issues in overlay (vercel/turbo#2803) 2022-11-29 18:05:52 +01:00
Leah
b680327280 error overlay redesign (vercel/turbo#2831)
* refactor exports

* tabs + styles + icons
2022-11-29 14:38:22 +01:00
Alex Kirszenberg
4ebc389478 Make task stats take less memory by default (vercel/turbo#2765)
* Make task stats take less memory by default

* Swap order of condition operands

* TaskStats -> ExportedTaskStats

* Add full stats disclaimers

* Clippy

* Fix duplicate labels

* Move stats type reporting to TurboTasks

* Fix turbotrace and turbopack visualization

* Store last duration and execution as SmallDurations

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2022-11-29 11:48:57 +01:00
Tobias Koppers
e489b1effe fix and improve hanging detection (vercel/turbo#2827)
Commit 1: It took me hours to figure out this unsafe problem...

Commit 2: updates tokio

Commit 3: improves hanging detection to allow to attach notes to event listeners
2022-11-29 02:03:35 +00:00
OJ Kwon
1f38dcdf39 build(cargo): setup next-binding package (vercel/turbo#2813)
* build(cargo): setup next-binding package

* build(cargo): update dependencies

* style(toml): update config

* ci(actions): check next-binding

* feat(next-binding): reexports

* build(cargo): update lockfile
2022-11-28 09:18:46 -08:00
Alex Kirszenberg
e2880a14c2 Sample many modules in benchmarks + reliability fixes (vercel/turbo#2750)
* Sample many modules in benchmarks + reliability fixes

* Fix depth sampling to be uniform

* Fix Webpack benchmark

* Only use detector component for RSC

* Clippy

* Clippy
2022-11-28 16:42:32 +01:00
Leah
c0b3e0a1c1 get upstream error overlay changes and fix typescript errors (vercel/turbo#2830)
* pull upstream changes

* ts fixes
2022-11-25 21:06:37 +01:00
Leah
1603cd2cff fix fallback overlay (vercel/turbo#2829) 2022-11-25 17:46:40 +01:00
OJ Kwon
4a6959da43 fix(next-dev): disable git version info (vercel/turbo#2815) 2022-11-22 19:55:56 -08:00
OJ Kwon
0b841ad61f feat(next/dev): allow to display version (vercel/turbo#2793) 2022-11-22 08:50:27 -08:00
OJ Kwon
4a05036850 feat(next-dev): support port via env variable (vercel/turbo#2770) 2022-11-18 17:31:31 -08:00
Tobias Koppers
fd2688b984 add benchmarks for Vite SSR and SWC (vercel/turbo#2751) 2022-11-17 15:58:19 +01:00
Tobias Koppers
16e27669da fix HMR for RSC benchmarking (vercel/turbo#2698)
measure hmr_to_commit with detector component

add Next.js 13 to benchmarks with RSC and RCC measurements

this tests RSC HMR

make HMR warmup faster

make browser launch lazy

test benchmarks for other bundlers on CI too

# Conflicts:
#	.github/workflows/test.yml
#	crates/next-dev/benches/mod.rs
2022-11-16 18:59:09 +01:00
Tobias Koppers
3c8bf5cb33 use latest version for parcel and webpack too (vercel/turbo#2678) 2022-11-16 16:14:46 +01:00
Tobias Koppers
7e2173c092 use iterations feature from criterion (vercel/turbo#2708)
* use iterations feature from criterion

move startup, warmup and teardown out of the iteration loop to avoid tracking this time as elapsed time
this allows criterion to use the measurement time correctly for the measured task

prefer slope over mean when possible as it estimates the real time (excluding warmup)

* remove warmup argument

* stop server for next iteration

* refactor

* restore verbose info, exclude file read from timing

* add a little bit of delay between HMR updates

* make a warmup change

* no need to copy template dir for HMR benchmark

* add delay after warmup change

* add watch benchmark

* add/fix comments

* fix env var in CI
2022-11-16 15:45:11 +01:00
Florentin / 珞辰
6225f75a06 feat: polyfill global with globalThis (vercel/turbo#2666)
This PR changes the ecmascript chunk logic to polyfill `global` with `globalThis`. A more complex and less performant solution (but with the benefit of us knowing the runtime environment) would be to add an effect for simple identifier expressions.
2022-11-14 18:10:08 +00:00
Tobias Koppers
886a86d98b retry launching browser in test suite (vercel/turbo#2695) 2022-11-14 15:32:54 +01:00
Tobias Koppers
5320ba564f update next.js to 13.0.3 (vercel/turbo#2677) 2022-11-14 10:57:59 +00:00
Tobias Koppers
32593ea30d retry CI setup steps if needed (vercel/turbo#2692)
* retry setup steps if needed

* retry install nextest step

* retry browser launch

* ignore errors from PR comment failing due to PR from fork
2022-11-14 10:35:06 +01:00
Alex Kirszenberg
9711a7ef4a Add profiling docs (vercel/turbo#2664)
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2022-11-14 10:26:39 +01:00
OJ Kwon
af6d90d2b6 feat(next-dev): align devserver cli options to napi bindings (vercel/turbo#2653) 2022-11-11 17:42:32 -08:00
Tobias Koppers
00b15975bb clippy (vercel/turbo#2662) 2022-11-10 10:54:31 +01:00
Tobias Koppers
810508aed0 add different keyed app route elements (vercel/turbo#2636)
* add different keyed app route elements

* update for latest next.js canary version

* fix header name

* setup next.js version in benchmark
2022-11-09 21:04:57 +01:00
Tobias Koppers
3d690b2778 order routes by specificity (vercel/turbo#2614)
* bugfix source maps in app dir

* add specificity

static assets are preferred over dynamic matches
2022-11-08 17:44:57 +01:00
Tobias Koppers
b893baacf8 add RSC and RCC for turbopack to benchmarks (vercel/turbo#2620)
* fixup ropes

* add RSC and RCC for turbopack to benchmarks

RSC: whole page is a server component
RCC: whole page is a client component

add `app` directory to test app
2022-11-07 17:51:35 +01:00
Justin Ridgewell
35ae595de5 Implement Ropes for shared string construction (vercel/turbo#2525) 2022-11-04 15:42:18 -04:00
OJ Kwon
26cfc649d6 refactor(next/dev): do not expose unsupported cli options (vercel/turbo#2586) 2022-11-03 13:44:23 -07:00
Justin Ridgewell
196ac9717c Fix React Refresh boundary finding for CSR (vercel/turbo#2574)
* Fix React Refresh boundary finding

We forgot to enable the transform, which means we were rendering from the root of the app instead of the changed component.

* Update snapshots

* Add comment

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-03 16:28:47 +01:00
LongYinan
e08865cafd Merge turbo crate into cargo workspace (vercel/turbo#2577) 2022-11-03 23:01:50 +08:00
Alex Kirszenberg
e8c027ffb2 Use mimalloc in next-dev (vercel/turbo#2467) 2022-11-03 07:01:39 +00:00
Tobias Koppers
beed9fb626 add benchmark documentation and blog post (vercel/turbo#2492)
Co-authored-by: Anthony Shew <anthony.shew@vercel.com>
Co-authored-by: Jared Palmer <jared@jaredpalmer.com>
Co-authored-by: Maia Teegarden <dev@padmaia.rocks>
Co-authored-by: Will Binns-Smith <wbinnssmith@gmail.com>
Co-authored-by: Alex Kirszenberg <alex.kirszenberg@vercel.com>
Co-authored-by: Matt Pocock <mattpocockvoice@gmail.com>
2022-11-01 00:08:56 +01:00
OJ Kwon
36daa2bf52 feat(next/dev): allow to retry bind (vercel/turbo#2480) 2022-10-30 12:05:37 -07:00
Tobias Koppers
091af50322 add TURBOPACK_BENCH_PROGRESS to show captured values during bench (vercel/turbo#2490) 2022-10-29 18:13:39 +02:00
Alex Kirszenberg
9b5c2e39ea Simplify benchmark warmup (vercel/turbo#2483)
* Simplify benchmark warmup

* Update crates/next-dev/benches/mod.rs

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>

* fmt

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2022-10-29 09:37:52 +02:00
Justin Ridgewell
9fc8c13877 Faster source map tracing (vercel/turbo#2426)
* Store the sourcemap::SourceMap directly, instead of encoding it

* Implement GenerateSourceMap trait and use it to retrieve live maps

* Cleanup and comments!

* Update safety comment

* Rename var

* Update snapshots

* Update snapshots

* Fix tracing errors in SSR

SSR has access to `EcmascriptChunkVc`, not `EcmascriptChunkContentVc`. Client gets access only to `EcmascriptChunkContentVc`

* Fix source map sources on client

Because the JS is nested in dirs, the source needs to be an absolute path.

Co-authored-by: Jared Palmer <jared@jaredpalmer.com>
2022-10-29 01:16:05 +02:00
Tobias Koppers
befc272a8c remove require hook (vercel/turbo#2473) 2022-10-29 00:24:25 +02:00
Tobias Koppers
f9fb452b32 improve startup and warmup of benchmarks (vercel/turbo#2463) 2022-10-28 21:56:33 +02:00
Tobias Koppers
69d98a5bde make sure to exit the process in case of errors during errors sending (vercel/turbo#2457) 2022-10-28 20:56:40 +02:00
OJ Kwon
2af748edd4 refactor(next/dev): reusable start_server (vercel/turbo#2455) 2022-10-28 09:41:46 -07:00
阿豪
5f00509321 chore: typo (vercel/turbo#2404)
* chore: typo

* Remove hot_module_replacement from snapshot tests

Re: vercel/turbo#2351

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2022-10-28 11:59:21 -04:00
Alex Kirszenberg
f2d661c0bb Fix large regression with turning ModuleRuleCondition::matches into a tt::fun (vercel/turbo#2450)
* Fix large regression with turning ModuleRuleConditionVc::matches into a tt::fun

* Remove Vcs from ModuleRule altogether
2022-10-28 17:53:13 +02:00
OJ Kwon
0d12445d6a refactor(next/dev): allow devserver args serializable (vercel/turbo#2446) 2022-10-28 08:28:04 -07:00
Allan
b12e0d8f46 Fix unnecessary question mark warnings (vercel/turbo#2443)
* Fix unused question marks warnings

Fix some return types that were giving clippy warnings, mostly `needless_question_mark`.
Remaining warnings are either `too_many_arguments` or `type_complexity`.

* Fix unncessary let binding

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2022-10-28 01:40:49 -04:00
Tobias Koppers
2e4f40ae31 prettier fixes (vercel/turbo#2436) 2022-10-28 00:39:56 -04:00
Alex Kirszenberg
eca1e994f1 Update Next.js dependency for the TP benchmark (vercel/turbo#2435) 2022-10-28 00:39:33 -04:00
Alex Kirszenberg
201259af94 More forgiving timeout when waiting for Node.js to connect (vercel/turbo#2417)
* More forgiving timeout when waiting for Node.js to connect

* 10ms -> 30s
2022-10-28 00:35:30 -04:00
Justin Ridgewell
d4cb480fca Source map tracing fixes (vercel/turbo#2402) 2022-10-27 21:30:30 -07:00
JJ Kasper
8788e1f7d1 Add Next.js require hook (vercel/turbo#2434)
This hook is needed to ensure we properly map compiled modules like `styled-jsx` correctly. 

x-ref: [slack thread](https://vercel.slack.com/archives/CGU8HUTUH/p1666824437456749?thread_ts=1666819473.031139&cid=CGU8HUTUH)
2022-10-27 22:19:47 +00:00
Will Binns-Smith
52da74e39d Implement nsObj helper from webpack tests and pass basic import test (vercel/turbo#2385) 2022-10-27 01:22:58 +02:00
Tobias Koppers
d80eb2e0a0 fix node.js 18.9 (vercel/turbo#302) 2022-10-25 10:19:03 +02:00
Tobias Koppers
9c352406ee sort errors by relevance (vercel/turbo#299) 2022-10-25 09:15:51 +02:00
Tobias Koppers
50ca47eb8f fix inconsistent asset writes (vercel/turbo#296) 2022-10-25 09:01:03 +02:00
Tobias Koppers
2bc7c10228 use error overlay in app layouts (vercel/turbo#294) 2022-10-25 08:33:16 +02:00
LongYinan
ce4a8ed6bb Fix format check (vercel/turbo#289) 2022-10-25 13:45:08 +08:00
Tobias Koppers
395dbc9402 improve node.js pool process error handling (vercel/turbo#287) 2022-10-25 07:05:16 +02:00
Alex Kirszenberg
7d6212b064 Use a TCP connection for IPC between Node and TP (vercel/turbo#251)
Instead of using stdout for communication between the Node.js process
and the Turbopack instance, this PR switches to a TCP connection.
Furthermore, stdout and stderr are now piped between the Node.js process
and Turbopack.
2022-10-25 05:31:08 +02:00
Alex Kirszenberg
880205ef37 Fix bad merge (vercel/turbo#281) 2022-10-24 19:42:55 -07:00
Tobias Koppers
150155b741 expose assets from fallback page (vercel/turbo#280) 2022-10-24 19:39:47 -07:00
Justin Ridgewell
c2bb12d0bf Fix tracing of node_modules files not emitted by pages (vercel/turbo#249)
Because the static SSR renderer doesn't emit files that exist in
`node_modules` (because we take advantage of node's native `require`
resolution), any paths that traced into `node_modules` would output the
full file system path. It's just verbose and annoying.

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2022-10-24 19:16:35 -07:00
Tobias Koppers
43d86a1bfa clippy (vercel/turbo#266) 2022-10-25 03:38:43 +02:00
Will Binns-Smith
dc74ca31c0 Create an app root layout if app/page.{js,tsx} exists but layout does not (vercel/turbo#264)
This makes turbopack automatically create `app/layout.js` if
`app/page.js` exists, or `app/layout.tsx` if `app/page.tsx` exists, and
neither layout file already exists.

**Note that I'd prefer this issue to have info severity, but even with a
higher log level of info, the issue is never shown**. Filed vercel/turbo#265 to
track this.

Test Plan:
In a new `create-next-app`, opt into appDirectory and create
`app/page.js`. Run turbopack and verify:
* [x] the index page renders correctly
* [x] An issue with Warning level is logged notifying the user an
`app/layout.js` was created
* [x] `app/layout.js` is actually created with basic root layout

In a new `create-next-app`, opt into appDirectory and create
`app/page.tsx`. Run turbopack and verify:
* [x] the index page renders correctly
* [x] An issue with Warning level is logged notifying the user an
`app/layout.tsx` was created
* [x] `app/layout.tsx` is actually created with basic root layout

In a new `create-next-app`, opt into appDirectory and create
`app/page.tsx`. Also create a basic `app/layout.js` (note js layout with
tsx page). Add a custom `<title>` to the layout. Run turbopack and
verify:
* [x] the index page renders correctly
* [x] No issue is logged
* [x] No files are modified
* [x] The custom `<title>` is reflected.
2022-10-24 17:30:04 -07:00
Alex Kirszenberg
c8067af03f Fix fallback page error overlay (vercel/turbo#268) 2022-10-24 17:05:21 -07:00
Tobias Koppers
dca015b121 move feature detection to next.js (vercel/turbo#263) 2022-10-24 16:19:14 -07:00
Tobias Koppers
233b69d203 App CSS and fixes (vercel/turbo#246)
fix app layout transition
add global css support
2022-10-25 00:27:17 +02:00
Tobias Koppers
36f7545c33 add HMR for RSC component changes (vercel/turbo#202) 2022-10-24 22:23:40 +02:00
Alex Kirszenberg
09273bdab1 Apply Next SSG transform (vercel/turbo#130)
This adds the Next SSG transform. This transform does a few things, but
the one we're most interested in right now is the removal of
`getStaticProps`/`getServerSideProps`/etc. from page modules. HMR will
be disabled if these exports are preserved.

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2022-10-24 22:23:00 +02:00