1. 09 Jan, 2024 18 commits
    • vercel-release-bot's avatar
      v14.0.5-canary.46 · 8aced5bc
      vercel-release-bot authored
      8aced5bc
    • Jiachi Liu's avatar
      Display original failed fetch trace (#60274) · 08e24a8f
      Jiachi Liu authored
      ### What
      
      Show the original fetch error trace in the dev error overlay, which can
      show which line of the fetch call is failing.
      
      #### After
      
      ![image](https://github.com/vercel/next.js/assets/4800338/cebc8d03-58a7-4574-a1bb-896c7f396674)
      
      #### Before
      
      ![image](https://github.com/vercel/next.js/assets/4800338/5cc71ad9-c71e-44d0-aef2-5b0d5a00da36)
      
      ### Why
      
      This helps a lot for unclear fetch failures that you only see an error
      on your screen and you don't have idea where it's coming from
      
      ### How
      
      Fixed the async task error that swallowed by tracer, it should always
      throw in tracing after the metrics are traced.
      
      Closes NEXT-1362
      Fixes #59153
      Fixes #49896
      08e24a8f
    • Steven's avatar
      chore: fix postinstall when using tarball (#60443) · 1662362d
      Steven authored
      The postinstall script was failing In the case when you download [a
      zip](https://codeload.github.com/vercel/next.js/zip/refs/heads/canary)
      of the repo.
      
      This PR fixes it so that `git config` can fail silently in that case
      when the repo is not using git.
      
      - Related to https://github.com/nodejs/citgm/pull/1044
      
      Closes NEXT-2036
      1662362d
    • Alexander Savelyev's avatar
      Fix custom cache handler importing on windows (#60312) · 51bda321
      Alexander Savelyev authored
      ### Fixing a bug
      
      ### What?
      Custom cache handler doesn't work on Windows
      
      ### Why?
      
      It broke in a recent fix, when adding ESM support - #59863. The problem
      is not new - dynamic imports consider an absolute path in Windows as a
      protocol:
      
      `ERR! Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme
      in: file, data are supported by the default ESM loader. On Windows,
      absolute paths must be valid file:// URLs. Received protocol 'C:'`
      
      ### How?
      
      As a solution, it is necessary to explicitly indicate that it is indeed
      an absolute path, for example by adding a / at the beginning, but the
      most reliable way is to use pathToFileURL.
      
      Since the logic is repeated in 4 places - I created a common function.
      
      Fixes #58509
      
      ---------
      Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
      51bda321
    • OJ Kwon's avatar
      refactor(next/core): reorganize next.js custom transforms for next-swc/turbopack (#60400) · 46370d81
      OJ Kwon authored
      <!-- 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
      https://github.com/vercel/next.js/pull/60400/commits/2cedd06ea55f71478206d60f832acc3cd5763362
      :
      
      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: 's avatarhrmny <8845940+ForsakenHarmony@users.noreply.github.com>
      46370d81
    • Wyatt Johnson's avatar
      Missing Postpone Detection Fix (#59891) · 7018a65d
      Wyatt Johnson authored
      ### What?
      
      Previously, if an error such as the client side rendering bailout (not
      to be confused with the static rendering bailout which PPR supercedes)
      occurs during render, and the `postpone` function was invoked during the
      original render, then the `staticGenerationStore` would incorrectly
      report that the render did call `postpone`, because the value is not
      reset on the render for the error page.
      
      ### How?
      
      Returning no error when the standard render is used and returning the
      error when the error render was used ensures that we don't warn about
      missing postpone data when a client side rendering bailout occurs.
      
      ### Looking Ahead
      
      A refactor of the `AsyncLocalStorage` should be done such that the
      stores are:
      
      1. Returned by the calling function so we aren't reaching into store
      properties at different parts
      2. Reorganizing the stores so that they're tied to the invocation
      lifetime, not the entire request lifetime, so that operations (like
      postpone) should only be available during renders that support postpone,
      not all renders during a request.
      
      Closes NEXT-1927
      7018a65d
    • Steven's avatar
      chore(docs): fix 14 upgrade guide mentioning export (#60429) · 3aed59c2
      Steven authored
      This was actually deprecated in a previous version 13.x and removed in
      Next.js 14.0.0
      
      - See original PR: https://github.com/vercel/next.js/pull/57085
      3aed59c2
    • Alexander Savelyev's avatar
      add tests for incremental-cache (#60331) · 2ebc58cc
      Alexander Savelyev authored
      ### What?
      In the previous PR (#60249), it was found that the case when the
      response size is larger than 2MB is not sufficiently covered by tests
      [[comment](https://github.com/vercel/next.js/pull/60249#pullrequestreview-1807140518)]
      
      ### How?
      I added a few more checks.
      
      Just checking the number of API calls is not enough - I believe it is
      important to additionally verify what exactly the page received.
      
      If I'm honest, I couldn't find the exact reason why data is loaded after
      application start when using `customCacheHandler`, but without it -
      during build. It seems like something in the butcher. Therefore, in this
      part, I simply configured it for the current version.
      
      ---------
      Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
      2ebc58cc
    • Lee Robinson's avatar
      Add reproduction for HMR moving / renaming files. (#57230) · fb73c3a9
      Lee Robinson authored
      Pairing with @timneutkens. Passes with webpack, fails with Turbopack.
      
      ```
      TURBOPACK=1 pn testonly-dev test/development/app-dir/hmr-move-file
      ```
      
      ---------
      Co-authored-by: 's avatarLeah <8845940+ForsakenHarmony@users.noreply.github.com>
      Co-authored-by: 's avatarTobias Koppers <tobias.koppers@googlemail.com>
      fb73c3a9
    • Ahmed Abdelbaset's avatar
      ci: skip cron workflows on forks (#60422) · 967784b2
      Ahmed Abdelbaset authored
      This PR skips running cron workflows outside of `vercel/next.js`
      
      ---------
      Co-authored-by: 's avatarSteven <steven@ceriously.com>
      967784b2
    • Josh Story's avatar
      Refactor `unstable_cache` implementation (#60403) · 84aeded0
      Josh Story authored
      The original motivation of this PR is to get `unstable_cache` into a
      state where I can more easily change the implementation of postpone to
      be more akin to "dynamic rendering APIs". the existing approach made
      typing the staticGenerationStore in a way I wanted to for the planned
      changes would have been hard to implement with the current approach. At
      the same time this was an opportunity to make the implementation more
      efficient and easier to reason about.
      
      reorganizes unstable_cache to improve performance and potentially fix
      latent bugs related to nest cache calls
      
      In the original implementation there are repeated defined checks for the
      store and relatively complex logic around gathering the cache entry. In
      my refactor I fork the implementation based on whether we have a store
      or not. Loosely this translates to whether the cache call is for App
      Router vs Pages Router however due to a quirk in how we scope inner
      cache calls there is an existing and unchanged case where a Pages Router
      cached callback runs with a "fake" store that is used to scope some
      cache values to prevent inner caching when one cached function calls
      another. It should be noted that this fake store technique means that
      inner cache calls inside Pages Router will hit the App Router pathway in
      unstable cache. This is not great but it is the current behavior and
      while I have made some changes that might fix some bugs changing this
      felt like a much bigger lift to do in a primarily refactor PR.
      
      This "fake" store can be replaced by a different async store for Pages
      Router which we can use to scope the inner environment to not be cached
      eventually though it may make more sense to just generalize the
      staticGenerationStore into a kind of RenderStore and have it run for
      Pages Router too.
      
      I moved as much computation that can be done in the closure around the
      cached function out of the cached function and I narrowed the scope of
      the run call to make it clear that we really only need to scope the
      callback.
      
      I removed function allocations per invocation
      
      I probably fixed a bug in how the revalidate property was refined on the
      static generation store. Previously it would be possible to go from
      number to false and back again but this doesn't make sense as false is
      more like INFINITY in terms of refining to shorter values. This PR
      updates this logic to be apparently
      
      Closes NEXT-2028
      84aeded0
    • Jiachi Liu's avatar
      Fix missing source code display for some jsx errors (#60390) · 2e29c7b1
      Jiachi Liu authored
      There're some cases that error frames file is still conating
      "webpack-internal" for server component and also the webpack layer info
      such as `(rsc)` so that the source file is not properly recovered
      
      ### After
      
      
      ![image](https://github.com/vercel/next.js/assets/4800338/78ba137d-62f0-4c5b-b502-c3500b8b79db)
      
      
      ### Before
      
      ![image](https://github.com/vercel/next.js/assets/4800338/bd585c7c-2264-4f30-9deb-5fec004be19f)
      
      
      Closes NEXT-2020
      Closes NEXT-1996
      2e29c7b1
    • Zack Tanner's avatar
      Fix TypeError when using params in `RootLayout` with parallel routes (#60401) · 1481b264
      Zack Tanner authored
      ### What?
      When accessing `params` on a `RootLayout`, while also using parallel
      routes, two potential errors would occur:
      - A `Warning: React.createElement: type is invalid` error when
      attempting to render a `NotFound` component that doesn't exist
      - A `TypeError: Cannot read properties of undefined` error when
      attempting to access params in the root layout.
      
      ### Why?
      `createComponentTree` will render a duplicate `RootLayout` (to ensure
      the `notFound()` fallback in unmatched parallel slots have a
      `NotFoundBoundary` to catch them) but it currently doesn't ensure a
      `NotFound` component exists nor does it forward `params` to the layout.
      
      ### How?
      This forwards the params to the `RootLayout` and doesn't render a
      `NotFoundComponent` if one doesn't exist. This replaces a few `any`
      types with more sound types that would have helped catch these mistakes.
      There's still a lot more typing that needs to be done (left a comment
      below with some additional details) but I opted to make the minimal
      changes related to this issue.
      
      Longer term we should remove this duplicate `RootLayout` (see #60220)
      which will require special UI to show unmatched slots (similar to the
      error overlay, but less harsh)
      
      Closes NEXT-1909
      Fixes #59711
      1481b264
    • Leah's avatar
      chore: skip flaky turbopack navigation test (#60431) · a3f4ad98
      Leah authored
      Tracking issue for fixing the test:
      https://linear.app/vercel/issue/PACK-2203/fix-flaky-navigation-e2e-test
      
      Closes PACK-2204
      a3f4ad98
    • Jiachi Liu's avatar
      Change color of output bundle size (#60385) · 14b6ae2e
      Jiachi Liu authored
      When you have a gaint code base of next.js app, the output client side
      loaded js bundle size could be large since most of them are functional,
      it might not make sense to display yellow or red color to warn you that
      your bundle is too large since they conatin the basic functionality.
      
      We display the previous colored ones with opinionless bold white color
      to highlight them
      
      ![image](https://github.com/vercel/next.js/assets/4800338/34814f2f-ff83-48b4-bad8-989031eff49e)
      
      Closes NEXT-2017
      Closes NEXT-2015
      14b6ae2e
    • Tim Neutkens's avatar
      Update testing contributor guide (#60421) · 782619eb
      Tim Neutkens authored
      ## What?
      
      Adds instructions for how to run tests with Turbopack and how to run
      tests while recording using Replay.io.
      
      I've also updated the instructions to mention `test-dev` and
      `test-start` which are the commands we generally use.
      
      <!-- 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-2031
      782619eb
    • Vercel Release Bot's avatar
      Update Turbopack test manifest (#60413) · 74ad0e1e
      Vercel Release Bot authored
      This auto-generated PR updates the integration test manifest used when
      testing Turbopack.
      74ad0e1e
    • Will Binns-Smith's avatar
      HMR development stats: include `updatedModules` for App Router and Turbopack changes (#59785) · fe9d74d4
      Will Binns-Smith authored
      This includes the list of changed modules in the `client-hmr-latency`
      event for changes in app router pages as well as when using Turbopack.
      
      For Turbopack, this list is derived from the data structure included in
      the `turbopack-message` event. Each of these is originally a module id,
      which includes additional context information. For analytics purposes
      this is removed (and could maybe surfaced in the future once the webpack
      data is also normalized).
      
      
      Closes PACK-2167
      fe9d74d4
  2. 08 Jan, 2024 19 commits
  3. 07 Jan, 2024 3 commits