1. 11 Oct, 2022 2 commits
  2. 10 Oct, 2022 6 commits
  3. 09 Oct, 2022 2 commits
    • Shu Ding's avatar
      Load `beforeInteractive` scripts properly without blocking hydration (#41164) · e933e1d2
      Shu Ding authored
      This PR ensures that for the app directory, `beforeInteractive`, `afterInteractive` and `lazyOnload` scripts via `next/script` are properly supported.
      
      For both `beforeInteractive` and `afterInteractive` scripts, a preload link tag needs to be injected by Float. For `beforeInteractive` scripts and Next.js' polyfills, they need to be manually executed in order before starting the Next.js' runtime, without blocking the downloading of HTML and other scripts.
      
      This PR doesn't include the `worker` type of scripts yet.
      
      Note: in this PR I changed the inlined flight data `__next_s` to `__next_f`, and use `__next_s` for scripts data, because I can't find a better name for `next/script` that is also short at the same time.
      
      ## 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`
      - [x] 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)
      e933e1d2
    • Tim Neutkens's avatar
  4. 08 Oct, 2022 2 commits
    • Tim Neutkens's avatar
      Handle `as` on next/link with new router (#41285) · f7a7c3fa
      Tim Neutkens authored
      Kudos @dferber90 who found this issue. Added a test and handled it gracefully for now. Keep in mind the behavior can't be 1-1 so it takes the `as` as the `href` value given that masking of parameters in this way is no longer supported, that will be superseded by parallel routes / route interception.
      
      
      
      ## 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)
      f7a7c3fa
    • Tim Neutkens's avatar
      v12.3.2-canary.23 · 52a69e61
      Tim Neutkens authored
      52a69e61
  5. 07 Oct, 2022 8 commits
    • Hannes Bornö's avatar
      Recover from font loader error in dev (#41251) · be7b10de
      Hannes Bornö authored
      Check that the module has assets. This might not always be the case in
      app dev if there was an error. Test added to make sure it recovers
      correctly.
      
      ## 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)
      Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
      be7b10de
    • Balázs Orbán's avatar
      fix(ts): relax `AppProps` to not require generic (#41264) · 6eefc9de
      Balázs Orbán authored
      It seems that #38867 made `AppProps` always require the `pageProps`
      object shape to be passed as a generic since the default `{}` will throw
      a TS error if you try accessing any property:
      
      Before:
      
      ![image](https://user-images.githubusercontent.com/18369201/194639573-aa8a97f8-2c6a-413c-96f2-5e99e4a17c66.png)
      
      After:
      
      ![image](https://user-images.githubusercontent.com/18369201/194639630-03d1a669-722f-4822-b0db-3b8dd88b2959.png)
      
      
      Technically, it would be more correct since accessing `pageProps`
      properties would otherwise be unsafe, but this seems to break the
      current behavior.
      
      ## 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)
      6eefc9de
    • Jackromo34's avatar
      chore(examples): upgrade `date-fns` in `cms-tina` (#41240) · 6b27fbb4
      Jackromo34 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 that you're making:
      -->
      
      ## 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)
      Co-authored-by: 's avatarsnyk-bot <snyk-bot@snyk.io>
      Co-authored-by: 's avatarBalázs Orbán <info@balazsorban.com>
      6b27fbb4
    • Tim Neutkens's avatar
      eb629c15
    • Damien Simonin Feugas's avatar
      fix(middleware): 'instanceof Function' is dynamic code false-positive (#41249) · bef709bc
      Damien Simonin Feugas authored
      
      
      ## 🐛 What's in there?
      
      `foo instanceof Function` is wrongly considered as Dynamic code evaluation by our static analyzer.
      This PR fixes it.
      
      - [ ] Related issues linked using `fixes #number`
      - [x] Integration tests added
      - [x] Errors have a helpful link attached, see `contributing.md`
      
      ## 🧪 How to reproduce?
      
      1. Create a simple repro in `examples` folder:
         ```js
         // examples/instance-of-function/pages/index.js
         export default function Home() {
           return <h1>home</h1>
         }
         
         // examples/instance-of-function/middleware.js
         import { NextResponse } from 'next/server'
         
         export default async function handler() {
           console.log('is arrow a function?', (() => {}) instanceof Function)
           return NextResponse.next()
         }
         ```
      1. build with next `pnpm next build examples/instance-of-function`
         > the build fails
      1. rebuild next to include PR's fix `pnpm build`
      1. build with new next `pnpm next build examples/instance-of-function`
         > the build works
      
      ## 📔 Notes to reviewers
      
      `hooks.expression.for(`${prefix}Function`).tap(NAME, handleExpression)` is actually legacy code from the original implementation. It's used when finding `Function` regardless of how it is used. We only want to find `new Function()` or `Function()`, which `hooks.calls` and `hooks.new` are covering.
      
      `eval instanceof Function` is perfectly legit code on the edge, despite its uselessness :lol-think: 
      
      Because we got multiple people asking "how do I relax this error when my code contains unreachable dynamic code evaluation", I've copy-pasted details about `config.unstable_allowDynamic` into the error page. Because users do not always click links :blob_shrug: 
      bef709bc
    • Jiachi Liu's avatar
      refactor dev overlay into hot reloader (#41231) · a415f34a
      Jiachi Liu authored
      Move react-dev-overlay into hot reloader client components, and let it imported by app router. So then we don't need to have hot reloader and react tree as adjacent sibilings but the overlay with error boundary is wrapping the react tree
      Co-authored-by: 's avatarTim Neutkens <6324199+timneutkens@users.noreply.github.com>
      a415f34a
    • Tim Neutkens's avatar
      Enable passing tests (#41241) · ce820e2a
      Tim Neutkens authored
      ce820e2a
    • Hannes Bornö's avatar
      Font loaders next config shape (#41219) · b5590022
      Hannes Bornö authored
      Changes how font loaders are configured in next config, makes more sense since options can be optional. Also adds error for when font loaders are used from within node_modules.
      
      ## 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)
      b5590022
  6. 06 Oct, 2022 17 commits
    • Jiachi Liu's avatar
      Enabel appDir when flag and dir existed at the same time (#41233) · f83cc0cb
      Jiachi Liu authored
      If there's an existing folder named `app/` but `appDir` flag is not
      enabled, do not enabled server components
      f83cc0cb
    • Alex's avatar
      Update introduction.md (#41226) · 87026c89
      Alex authored
      Fixed link to phases lines in the documentation
      
      
      
      ## 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)
      Co-authored-by: 's avatarJJ Kasper <22380829+ijjk@users.noreply.github.com>
      87026c89
    • Tim Neutkens's avatar
      v12.3.2-canary.22 · 5e25bd21
      Tim Neutkens authored
      5e25bd21
    • JJ Kasper's avatar
    • Hannes Bornö's avatar
      App font file preload (#41158) · dd3e005c
      Hannes Bornö authored
      Finds the font files connected to font loader modules and adds them to
      the font loader manifest. They're then collected and rendered similarly
      to CSS links in app-render.
      dd3e005c
    • Meno Abels's avatar
      Add response stream errorhandling in edge-function-runtime (#41102) · 27fe5c8c
      Meno Abels authored
      The behaviour of edge-function-runtime in the case of an error was not
      identical to the edge-runtime.
      If a type other than "Uint8Array" is written to the Response stream a
      unhandledreject is raised and logged.
      The current implementations(nodejs) accepts also Buffers and Strings
      which causes that a Application
      Developer things our stream implementation is broken if it is executed
      as worker.
      We introduced a helper function to consume the response stream and write
      the "Uint8Array" stream chunks
      to the server implementation. Due to the complication that the error
      side effect is emitted via the unhandledrejection
      handler it is almost impossible to test --- jest does not allow testing
      of the unhandlerejections.
      We tested extendsiveliy the helper in the edge-runtime so that this PR
      integrates just the consuming function.
      
      ## 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)
      Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
      27fe5c8c
    • Shu Ding's avatar
      Do not bundle `react-dom` in the SSR build (#41227) · 24b60030
      Shu Ding authored
      Currently `react-dom` isn't handled as an external dependency in SSR,
      unlike `react`. This means that the ReactDOM imported by client
      components isn't the same instance as the ReactDOM that does SSR.
      
      This PR also upgrades React experimental to the latest version.
      
      ## 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)
      24b60030
    • Steven's avatar
      Fix docs for next/image unconfigured hosts (#41223) · 5e6b008b
      Steven authored
      
      Fix docs for next/image unconfigured hosts to mention `remotePatterns`.
      5e6b008b
    • Shu Ding's avatar
      Upgrade React experimental (#41222) · c6dc62ef
      Shu Ding 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 that you're making:
      -->
      
      ## 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)
      c6dc62ef
    • Jiachi Liu's avatar
      Alias next/dynamic to lazy impl for appDir (#41216) · 6352257d
      Jiachi Liu authored
      Since `next/dynamic` has client hooks that not compatible with server
      components, and app renderer doesn't provide context (such as
      `LoadableContext`) for it to use. Previously we provided a simple
      replacement using `React.lazy` for `next/dynamic` if you want to use it
      in appDir.
      
      This PR always alias it to the `React.lazy ` implementation for appDir
      so that user won't need to worry about the dynamic options. They can
      only use `dynamic()` without 2nd options arg
      
      ```js
      import dynamic from 'next/dynamic'
      
      const Dynamic = dynamic(() => import('./dynamic-component'))
      ```
      6352257d
    • Meno Abels's avatar
      Update edge runtime to 1.1.0-beta.37 (#41211) · 374ab4bf
      Meno Abels authored
      update of the edge-runtime to 1.1.0-beta.37.
      Co-authored-by: 's avatarKiko Beats <2096101+Kikobeats@users.noreply.github.com>
      374ab4bf
    • Donny/강동윤's avatar
    • Silvio Clécio's avatar
      Fix error 500 (#41205) · 21605a5f
      Silvio Clécio authored
      Fix the following problem:
      
      ```
        page: '/api/todos'
      }
        10 | 
        11 |   if (method === 'GET') {
      > 12 |     const { value: items } = await base.fetch([]).next()
           |                                                  ^
        13 |     respBody = items
        14 |     res.statusCode = 200
        15 |   } else if (method === 'POST') {
      warn  - Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/basic-features/fast-refresh#how-it-works
      ```
      
      Working app -> https://with-deta-base-ashy.vercel.app
      Temp repo -> https://github.com/silvioprog/with-deta-base
      21605a5f
    • Justin Ridgewell's avatar
      Remove hook_optimizer transform (#41203) · 22ef969b
      Justin Ridgewell authored
      Fixes an issue where `const […foo] = useState(0)` is improperly transformed into `const { 0: …foo } = useState(0)`.
      
      The hook optimizer was useful when hooks first came out, primarily because browsers had never optimized array destructuring. But current browsers have, and the optimization doesn't help anymore.
      
      
      
      ## Bug
      
      - [ ] Related issues linked using `fixes #number`
      - [x] 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
      
      - [x] 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)
      22ef969b
    • JJ Kasper's avatar
      v12.3.2-canary.21 · e8c760f7
      JJ Kasper authored
      e8c760f7
    • Hannes Bornö's avatar
      Font loader with babel error (#41151) · e5be49ee
      Hannes Bornö authored
      Adds build error when using font loaders with babel. Otherwise you'll
      get other unrelated errors.
      
      ## 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)
      Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
      e5be49ee
    • JJ Kasper's avatar
      Fix errors entry in codeowners · 188acd24
      JJ Kasper authored
      188acd24
  7. 05 Oct, 2022 3 commits