1. 16 Dec, 2024 18 commits
    • vercel-release-bot's avatar
      v15.1.1-canary.7 · 033727a5
      vercel-release-bot authored
      033727a5
    • Sam Ko's avatar
      chore(github): fix wrong-issue-template body (#74003) · 5b28aaa3
      Sam Ko authored
      ## Why?
      
      The automated comment should be a paragraph, not a single line code-snippet.
      5b28aaa3
    • Hendrik Liebau's avatar
      Restore RSC fetch error handling after navigating back (#73985) · e08fe27a
      Hendrik Liebau authored
      As a follow-up to #73975, we're now restoring the error handling for
      failed RSC fetch calls when the user navigates back after a hard
      navigation. In this case the browser uses the bfcache to restore the
      previous JavaScript execution context, and thus the abort controller
      will still be in the aborted state. To take this into account, we're now
      creating a new `AbortController` instance on `'pageshow'` events.
      
      In addition, the abort controller's `signal` is now actually passed to
      the `fetch` call, and not only used for the error handling, so that the
      requests are aborted on `'pagehide'`. This was an oversight in the
      original PR. With that, it's even more important to create a fresh abort
      controller, otherwise RSC fetching would be disabled after back
      navigation.
      
      The added e2e test can only run in headed mode unfortunately, as the
      bfcache is not available in headless mode. (Using the same approach as
      in #54081.)
      e08fe27a
    • Jiwon Choi's avatar
      Add feature flag for new dev overlay (#73977) · e9415fc7
      Jiwon Choi authored
      This PR enabled feature flag for the new dev overlay, no behavioral
      change.
      
      - Added `experimental.newDevOverlay` Next.js option, which handles
      `__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY` env value.
      - Added `__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY` env to be resolved at
      build time so that it can be used to render the overlay conditionally
      e9415fc7
    • Benjamin Woodruff's avatar
      refactor(turbo-tasks-macros): Strip (already hidden) doc attributes from inline… · e3c1de4d
      Benjamin Woodruff authored
      refactor(turbo-tasks-macros): Strip (already hidden) doc attributes from inline function signatures (#73931)
      
      A minor optimization to the generated code. We were duplicating doc comments on the hidden `_turbo_tasks_function_inline` versions of functions.
      
      We only need the docs on the public function.
      
      This change should mean *slightly* less code for the macro to emit, and *slightly* less code for rustc to parse.
      
      ## Before
      
      ```
      // ===========================================
      // Recursive expansion of the value_impl macro
      // ===========================================
      
      impl Completion {
          #[doc = " This will always be the same and never invalidates the reading task."]
          pub fn immutable() -> Vc<Self> {
              let inputs = std::boxed::Box::new(());
              let persistence =
                  turbo_tasks::macro_helpers::get_non_local_persistence_from_inputs(&*inputs);
              <Vc<Self> as turbo_tasks::task::TaskOutput>::try_from_raw_vc(turbo_tasks::dynamic_call(
                  *COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID,
                  inputs as std::boxed::Box<dyn turbo_tasks::MagicAny>,
                  persistence,
              ))
          }
      }
      #[doc(hidden)]
      impl Completion {
          #[doc = " This will always be the same and never invalidates the reading task."]
          #[doc(hidden)]
          #[deprecated(
              note = "This function is only exposed for use in macros. Do not call it directly."
          )]
          pub(self) fn immutable_turbo_tasks_function_inline() -> Vc<Self> {
              Completion::cell(Completion)
          }
      }
      #[doc(hidden)]
      pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION: turbo_tasks::macro_helpers::Lazy<
          turbo_tasks::NativeFunction,
      > = turbo_tasks::macro_helpers::Lazy::new(|| {
          #[allow(deprecated)]
          turbo_tasks::NativeFunction::new_function(
              "Completion::immutable".to_owned(),
              turbo_tasks::FunctionMeta { local_cells: false },
              <Completion>::immutable_turbo_tasks_function_inline,
          )
      });
      #[doc(hidden)]
      pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID: turbo_tasks::macro_helpers::Lazy<
          turbo_tasks::FunctionId,
      > = turbo_tasks::macro_helpers::Lazy::new(|| {
          turbo_tasks::registry::get_function_id(&*COMPLETION_IMPL_IMMUTABLE_FUNCTION)
      });
      ```
      
      ## After
      
      ```
      // ===========================================
      // Recursive expansion of the value_impl macro
      // ===========================================
      
      impl Completion {
          #[doc = " This will always be the same and never invalidates the reading task."]
          pub fn immutable() -> Vc<Self> {
              let inputs = std::boxed::Box::new(());
              let persistence =
                  turbo_tasks::macro_helpers::get_non_local_persistence_from_inputs(&*inputs);
              <Vc<Self> as turbo_tasks::task::TaskOutput>::try_from_raw_vc(turbo_tasks::dynamic_call(
                  *COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID,
                  inputs as std::boxed::Box<dyn turbo_tasks::MagicAny>,
                  persistence,
              ))
          }
      }
      #[doc(hidden)]
      impl Completion {
          #[doc(hidden)]
          #[deprecated(
              note = "This function is only exposed for use in macros. Do not call it directly."
          )]
          pub(self) fn immutable_turbo_tasks_function_inline() -> Vc<Self> {
              Completion::cell(Completion)
          }
      }
      #[doc(hidden)]
      pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION: turbo_tasks::macro_helpers::Lazy<
          turbo_tasks::NativeFunction,
      > = turbo_tasks::macro_helpers::Lazy::new(|| {
          #[allow(deprecated)]
          turbo_tasks::NativeFunction::new_function(
              "Completion::immutable".to_owned(),
              turbo_tasks::FunctionMeta { local_cells: false },
              <Completion>::immutable_turbo_tasks_function_inline,
          )
      });
      #[doc(hidden)]
      pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID: turbo_tasks::macro_helpers::Lazy<
          turbo_tasks::FunctionId,
      > = turbo_tasks::macro_helpers::Lazy::new(|| {
          turbo_tasks::registry::get_function_id(&*COMPLETION_IMPL_IMMUTABLE_FUNCTION)
      });
      ```
      e3c1de4d
    • Benjamin Woodruff's avatar
      chore(turbo-tasks-macros): Remove use of associated items for NativeFunction construction (#73929) · 7ae9c790
      Benjamin Woodruff authored
      After the toolchain upgrade, causing a compilation error in a `#[turbo_tasks::value]` (or somewhere adjacent) can cause this additional non-fatal compilation warning/note:
      
      ```
      note: erroneous constant encountered
         --> crates/next-api/src/project.rs:580:1
          |
      580 | #[turbo_tasks::value_impl]
          | ^^^^^^^^^^^^^^^^^^^^^^^^^^ in this procedural macro expansion
          |
         ::: /home/bgw.linux/next.js/turbopack/crates/turbo-tasks-macros/src/lib.rs:119:1
          |
      119 | #[proc_macro_error]
          | ------------------- in this expansion of `#[turbo_tasks::value_impl]`
      ```
      
      The use of const expressions here was a little whacky. This removes the need for the const associated items by inlining their (one and only) use later when creating the `Lazy` static.
      
      This simplifies the macro implementation, reduces the total resulting code size, and makes the expanded output a little more legible.
      
      ## Before
      
      ```
      // ===========================================
      // Recursive expansion of the value_impl macro
      // ===========================================
      
      impl Completion {
          #[doc = " This will always be the same and never invalidates the reading task."]
          pub fn immutable() -> Vc<Self> {
              let inputs = std::boxed::Box::new(());
              let persistence =
                  turbo_tasks::macro_helpers::get_non_local_persistence_from_inputs(&*inputs);
              <Vc<Self> as turbo_tasks::task::TaskOutput>::try_from_raw_vc(turbo_tasks::dynamic_call(
                  *COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID,
                  inputs as std::boxed::Box<dyn turbo_tasks::MagicAny>,
                  persistence,
              ))
          }
      }
      #[doc(hidden)]
      impl Completion {
          #[allow(declare_interior_mutable_const)]
          #[doc(hidden)]
          const COMPLETION_IMPL_IMMUTABLE_FUNCTION: turbo_tasks::macro_helpers::Lazy<
              turbo_tasks::NativeFunction,
          > = turbo_tasks::macro_helpers::Lazy::new(|| {
              #[allow(deprecated)]
              turbo_tasks::NativeFunction::new_function(
                  "Completion::immutable".to_owned(),
                  turbo_tasks::FunctionMeta { local_cells: false },
                  <Completion>::immutable_turbo_tasks_function_inline,
              )
          });
          #[allow(declare_interior_mutable_const)]
          #[doc(hidden)]
          const COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID: turbo_tasks::macro_helpers::Lazy<
              turbo_tasks::FunctionId,
          > = turbo_tasks::macro_helpers::Lazy::new(|| {
              turbo_tasks::registry::get_function_id(&*COMPLETION_IMPL_IMMUTABLE_FUNCTION)
          });
          #[doc = " This will always be the same and never invalidates the reading task."]
          #[doc(hidden)]
          #[deprecated(
              note = "This function is only exposed for use in macros. Do not call it directly."
          )]
          pub(self) fn immutable_turbo_tasks_function_inline() -> Vc<Self> {
              Completion::cell(Completion)
          }
      }
      #[doc(hidden)]
      pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION: turbo_tasks::macro_helpers::Lazy<
          turbo_tasks::NativeFunction,
      > = <Completion>::COMPLETION_IMPL_IMMUTABLE_FUNCTION;
      #[doc(hidden)]
      pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID: turbo_tasks::macro_helpers::Lazy<
          turbo_tasks::FunctionId,
      > = <Completion>::COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID;
      ```
      
      ## After
      
      ```
      // ===========================================
      // Recursive expansion of the value_impl macro
      // ===========================================
      
      impl Completion {
          #[doc = " This will always be the same and never invalidates the reading task."]
          pub fn immutable() -> Vc<Self> {
              let inputs = std::boxed::Box::new(());
              let persistence =
                  turbo_tasks::macro_helpers::get_non_local_persistence_from_inputs(&*inputs);
              <Vc<Self> as turbo_tasks::task::TaskOutput>::try_from_raw_vc(turbo_tasks::dynamic_call(
                  *COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID,
                  inputs as std::boxed::Box<dyn turbo_tasks::MagicAny>,
                  persistence,
              ))
          }
      }
      #[doc(hidden)]
      impl Completion {
          #[doc = " This will always be the same and never invalidates the reading task."]
          #[doc(hidden)]
          #[deprecated(
              note = "This function is only exposed for use in macros. Do not call it directly."
          )]
          pub(self) fn immutable_turbo_tasks_function_inline() -> Vc<Self> {
              Completion::cell(Completion)
          }
      }
      #[doc(hidden)]
      pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION: turbo_tasks::macro_helpers::Lazy<
          turbo_tasks::NativeFunction,
      > = turbo_tasks::macro_helpers::Lazy::new(|| {
          #[allow(deprecated)]
          turbo_tasks::NativeFunction::new_function(
              "Completion::immutable".to_owned(),
              turbo_tasks::FunctionMeta { local_cells: false },
              <Completion>::immutable_turbo_tasks_function_inline,
          )
      });
      #[doc(hidden)]
      pub(crate) static COMPLETION_IMPL_IMMUTABLE_FUNCTION_ID: turbo_tasks::macro_helpers::Lazy<
          turbo_tasks::FunctionId,
      > = turbo_tasks::macro_helpers::Lazy::new(|| {
          turbo_tasks::registry::get_function_id(&*COMPLETION_IMPL_IMMUTABLE_FUNCTION)
      });
      ```
      7ae9c790
    • Jiachi Liu's avatar
      73cfb966
    • 김용민's avatar
      docs: add missing quotation marks (#73720) · 2a791d1b
      김용민 authored
      Co-authored-by: 's avatarLee Robinson <me@leerob.io>
      2a791d1b
    • YeonHee's avatar
      ec7025ed
    • YeonHee's avatar
      29bdca70
    • Benjamin Woodruff's avatar
      chore(next-custom-transforms): Mark fixture outputs as generated (#73918) · c94e8e3e
      Benjamin Woodruff authored
      This should let GitHub (and Graphite) collapse these files by default in code review.
      
      ```
      $ git check-attr --all crates/next-custom-transforms/tests/fixture/strip-page-exports/getInitialProps/class/*
      crates/next-custom-transforms/tests/fixture/strip-page-exports/getInitialProps/class/output-data.js: linguist-generated: true
      crates/next-custom-transforms/tests/fixture/strip-page-exports/getInitialProps/class/output-default.js: linguist-generated: true
      ```
      c94e8e3e
    • Jude Gao's avatar
      Fix error code check in windows (#73981) · 0f288c40
      Jude Gao authored
      0f288c40
    • Hendrik Liebau's avatar
      Ignore RSC fetch errors after hard navigation (#73975) · ac89400a
      Hendrik Liebau authored
      When the user reloads the page or navigates away while RSC fetch
      requests are still in flight – most notably background prefetches – we
      currently log the following error:
      
      ```
      Failed to fetch RSC payload for <URL>. Falling back to browser navigation.
      ```
      
      This unnecessarily clutters the DevTools console and creates noise in
      remote error reporting tools.
      
      When the browser cancels a `fetch` request due to navigation, it throws
      `TypeError: Failed to fetch`. We shouldn't universally suppress this
      error since it may also occur for other valid reasons where we do want
      to log it.
      
      To suppress the error only in genuine navigation scenarios, we introduce
      an `AbortController` and pass its signal to the `fetch` call. On
      `'pagehide'` events, we abort the controller. This approach ensures that
      error log suppression is limited solely to these navigation-related
      cases.
      
      [x-ref](https://vercel.slack.com/archives/C0676QZBWKS/p1734009715952909)
      fixes #60549
      ac89400a
    • Niklas Mischkulnig's avatar
      docs: Fix MDX syntax error (#73970) · a1f26330
      Niklas Mischkulnig authored
      Same problem as https://github.com/vercel/next.js/pull/72453, once
      again.
      a1f26330
    • Jam Balaya's avatar
    • Jam Balaya's avatar
      a10515e3
    • Attila Repka's avatar
      docs: fix vitest manual setup (#73754) · dc3bdd8f
      Attila Repka authored
      Co-authored-by: 's avatarLee Robinson <me@leerob.io>
      dc3bdd8f
    • David Hu's avatar
      docs: fix sitemap changelog table formatting (#73760) · e001900b
      David Hu authored
      Co-authored-by: 's avatarLee Robinson <me@leerob.io>
      e001900b
  2. 15 Dec, 2024 8 commits
  3. 14 Dec, 2024 5 commits
  4. 13 Dec, 2024 9 commits