Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vercel/next.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v12.0.10
Choose a base ref
...
head repository: vercel/next.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v12.1.0
Choose a head ref

Commits on Feb 1, 2022

  1. Building web forms with Next.js and Vercel (#32525)

    * First commit
    
    * Test Commit
    
    * First draft
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update intro.
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Improve docs in part 5
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Fix Form function in JSX
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update guide contents
    
    * Add different cloud computing companies
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Add details about JavaScript validation
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Improve code for validation without JS
    
    * Improve regex docs
    
    * Add regular expression example
    
    * Explain regex example
    
    * Add regex image
    
    * Add demo videos
    
    * Improve small fixes
    
    * Fix images
    
    * Fix images
    
    * Improve scripts
    
    * Improve scripts
    
    * Add links to example repo
    
    * Test cloudinary images
    
    * Test cloudinary images
    
    * Add resized images
    
    * Test videos
    
    * Remove images folder
    
    * test video
    
    * Fix link
    
    * New video component
    
    * Add images in readme
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Add mdx frontmatter details
    
    * Remove videos from guide
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Update docs/guides/building-forms.md
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    
    * Fix typo for Name
    
    * Fix code changes
    
    * Improve docs
    
    * Improve conclusion
    
    * Improve code syntax
    
    * Add lint tests
    
    * Fix yarn language test
    
    Co-authored-by: Rich Haines <hello@richardhaines.dev>
    MaedahBatool and molebox authored Feb 1, 2022
    Copy the full SHA
    791c356 View commit details
  2. Add Clarity About Downloading and Self-Hosting a Font File (#33760)

    Details about downloading and self-hosting font files were missing from our[ Font Optimization docs](https://nextjs.org/docs/basic-features/font-optimization). This PR addresses these changes.
    
    ## Bug
    
    - [x] Related issues linked using #33054
    
    ## Documentation / Examples
    
    - [x] Make sure the linting passes by running `yarn lint`
    MaedahBatool authored Feb 1, 2022
    Copy the full SHA
    af0d082 View commit details
  3. Relay Support in Rust Compiler (#33702)

    Reverts #33699
    
    This re-opens the support for relay in swc, although we need to narrow in the causes for the build failures in https://github.com/vercel/next.js/runs/4950448889?check_suite_focus=true
    
    Co-authored-by: Andrey Lunyov <102968+alunyov@users.noreply.github.com>
    ijjk and alunyov authored Feb 1, 2022
    Copy the full SHA
    3e60c23 View commit details
  4. Copy the full SHA
    a7793c7 View commit details
  5. Copy the full SHA
    3ba3bb8 View commit details
  6. v12.0.11-canary.0

    ijjk committed Feb 1, 2022
    Copy the full SHA
    dd48660 View commit details
  7. Flush buffered vitals metrics on page mount (#33867)

    ## Bug
    
    fixes #32631
    
    - [x] Related issues linked using `fixes #number`
    - [x] Integration tests added
    - [x] Errors have helpful link attached, see `contributing.md`
    huozhi authored Feb 1, 2022
    Copy the full SHA
    4786557 View commit details
  8. fix problem with HMR when middleware and page reference the same node…

    …_module (#33873)
    
    fixes #31827
    
    
    
    ## Bug
    
    - [x] Related issues linked using `fixes #number`
    - [x] Integration tests added
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    ## Feature
    
    - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
    - [ ] Related issues linked using `fixes #number`
    - [ ] Integration tests added
    - [ ] Documentation added
    - [ ] Telemetry added. In case of a feature if it's used or not.
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    ## Documentation / Examples
    
    - [ ] Make sure the linting passes by running `yarn lint`
    sokra authored Feb 1, 2022
    Copy the full SHA
    a803638 View commit details
  9. Correct pluralization in newly added Relay documentation (#33880)

    * Correct pluralization
    
    * Apply suggestions from code review
    
    Co-authored-by: JJ Kasper <jj@jjsweb.site>
    hanford and ijjk authored Feb 1, 2022
    Copy the full SHA
    d432032 View commit details
  10. Refactor page component getter in web server (#33759)

    Cleans up the code of the middleware SSR loader and the web server. Currently the page components and render options are provided to the server via `globalThis` which is not ideal.
    
    Instead we can inject `extendRenderOpts` and `loadComponent` to the web server. Since this is the the minimal mode and we'll need to handle `?flight` requests, we update the server render opts upon `updateRenderOpts` (In the future this should be changed to be passed to `requestHandler` to avoid race conditions).
    
    Currently, we can't fully get rid of the `__server_context` global as we call `getBuildId` in the base server constructor.
    
    ## Bug
    
    - [ ] Related issues linked using `fixes #number`
    - [ ] Integration tests added
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    ## Feature
    
    - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
    - [ ] Related issues linked using `fixes #number`
    - [ ] Integration tests added
    - [ ] Documentation added
    - [ ] Telemetry added. In case of a feature if it's used or not.
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    ## Documentation / Examples
    
    - [ ] Make sure the linting passes by running `yarn lint`
    shuding authored Feb 1, 2022
    Copy the full SHA
    51f0359 View commit details
  11. update NextResponse default redirect status to 307 to match docs (#33505

    )
    
    * fix: update default redirect status to 307 to match docs
    
    * fix: update default redirect status to 307 to match docs
    
    Co-authored-by: JJ Kasper <jj@jjsweb.site>
    sean6bucks and ijjk authored Feb 1, 2022
    Copy the full SHA
    5d9310e View commit details
  12. Copy the full SHA
    d005631 View commit details
  13. v12.0.11-canary.1

    ijjk committed Feb 1, 2022
    1
    Copy the full SHA
    39d3210 View commit details

Commits on Feb 2, 2022

  1. Bug fix: dynamic page should not be interpreted as predefined page (#…

    …33808)
    
    Fixes: #17096
    Fixes: #23824
    Closes: #33765
    
    ## Bug
    
    - [x] Related issues linked using `fixes #number`
    - [x] Integration tests added in #33765
    - [x] Errors have helpful link attached (N/A)
    
    Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
    Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
    3 people authored Feb 2, 2022
    1
    Copy the full SHA
    965d26e View commit details
  2. Group streaming experimental apis (#33878)

    Move undocumented `next/rsc` and `next/vitals` to `next/streaming`. In the future `next/streaming` can contain streaming SSR related (including react server components) APIs together.
    huozhi authored Feb 2, 2022
    Copy the full SHA
    5365f41 View commit details
  3. Encapsulate routing and initial hydration (#33875)

    * Encapsulate initial rendering
    
    * Run dev code before rendering
    
    * Fix call
    
    * Try reverting last change, fixing call
    devknoll authored Feb 2, 2022
    Copy the full SHA
    0fa95da View commit details
  4. Update MDX document (#33916)

    This PR added about `providerImportSource` option, which we need to specify in `next.config.js` to use `MDXProvider`. 
    
    
    Related mdx documents: https://mdxjs.com/docs/using-mdx/#mdx-provider
    
    > To solve this, a context can be used in React, Preact, and Vue. Context provides a way to pass data through the component tree without having to pass props down manually at every level. Set it up like so:
    > 1.  Install either @mdx-js/react, @mdx-js/preact, or @mdx-js/vue, depending on what framework you’re using
    > 1. Configure your MDX integration with options.providerImportSource set to that package, so either '@mdx-js/react', '@mdx-js/preact', or '@mdx-js/vue'
    > 1. Import MDXProvider from that package. Use it to wrap your top-most MDX content component and pass it your components instead:
    
    Because my English skills are not high, feel free to improve my sentences.
    
    ## Bug
    - [ ] Related issues linked using `fixes #number`
    - [ ] Integration tests added
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    ## Feature
    
    - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
    - [ ] Related issues linked using `fixes #number`
    - [ ] Integration tests added
    - [x] Documentation added
    - [ ] Telemetry added. In case of a feature if it's used or not.
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    ## Documentation / Examples
    
    - [ ] Make sure the linting passes by running `yarn lint`
    
    
    Co-authored-by: Lee Robinson <9113740+leerob@users.noreply.github.com>
    yuta-ike and leerob authored Feb 2, 2022
    Copy the full SHA
    04ca8db View commit details
  5. Optimize offline condition judgment (#33238)

    * perf: optimize offline condition judgment
    
    * lint-fix
    
    Co-authored-by: JJ Kasper <jj@jjsweb.site>
    zh-lx and ijjk authored Feb 2, 2022
    Copy the full SHA
    6dfe02d View commit details
  6. Update info on how to process webhooks by disabling bodyParser (#33909)

    Explicitly mention disabling `bodyParser` when processing a webhook request. Uses the "webhook" keyword that becomes searchable in the docs for anyone running a search from the sidebar.
    
    It addresses the issue [here](https://github.com/vercel/documentation/issues/71) and [this discussion](vercel/community#93).
    
    ## Documentation / Examples
    
    - [x] Make sure the linting passes by running `yarn lint`
    amandeepmittal authored Feb 2, 2022
    Copy the full SHA
    ee2725f View commit details
  7. Ensure external beforeFiles rewrites are handled with next/link (#33888)

    This ensures we properly handle external `beforeFiles` rewrites client-side so that a different result doesn't occur client-side versus on a direct visit. 
    
    ## Bug
    
    - [x] Related issues linked using `fixes #number`
    - [x] Integration tests added
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    Fixes: #32348
    ijjk authored Feb 2, 2022
    Copy the full SHA
    7b1bace View commit details
  8. Fix parsing params for i18n optional route in minimal mode (#33896)

    This fixes our parsing of params with i18n for optional catch-all routes and ensures a regression test catches this case.
    
    ## Bug
    
    - [x] Related issues linked using `fixes #number`
    - [x] Integration tests added
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    Fixes: #30631
    ijjk authored Feb 2, 2022
    Copy the full SHA
    f841307 View commit details
  9. Ensure browserslist extends works properly (#33890)

    * Ensure browserslist extends works properly
    
    * add comment
    ijjk authored Feb 2, 2022
    Copy the full SHA
    cdc4ee3 View commit details
  10. v12.0.11-canary.2

    ijjk committed Feb 2, 2022
    1
    Copy the full SHA
    aae0370 View commit details
  11. Fix image cache race condition (#33883)

    - Fixes #33860
    styfle authored Feb 2, 2022
    Copy the full SHA
    e3e62aa View commit details
  12. Add support for Relay projects without artifactDirectory (#33918)

    * update plugin
    
    * Update the test
    
    * remove dbg
    
    * Use pages_dir in Relay
    
    * copy edits
    
    * cargo test
    
    Co-authored-by: JJ Kasper <jj@jjsweb.site>
    alunyov and ijjk authored Feb 2, 2022
    Copy the full SHA
    831d45d View commit details
  13. v12.0.11-canary.3

    styfle committed Feb 2, 2022
    Copy the full SHA
    abae663 View commit details
  14. fix: handle jsxspreadattribute in inline-script-id eslint rule (#32421)

    fixes #32178
    
    the `inline-script-id` eslint rule crashed when encountering a `JSXSpreadAttribute`. this pr fixes that, and also handles `id` being passed via the spreaded object.
    
    ## Bug
    
    - [x] Related issues linked using `fixes #number`
    - [x] ~~Integration~~ Unit tests added
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    ## Feature
    
    - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
    - [ ] Related issues linked using `fixes #number`
    - [ ] Integration tests added
    - [ ] Documentation added
    - [ ] Telemetry added. In case of a feature if it's used or not.
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    ## Documentation / Examples
    
    - [ ] Make sure the linting passes by running `yarn lint`
    stefanprobst authored Feb 2, 2022
    1
    Copy the full SHA
    49afcd4 View commit details

Commits on Feb 3, 2022

  1. Update deployment docs to fix oversized image. (#33934)

    We made the images expand to fit the full width of the container, but the deploy button image shouldn't be that large. Also made some slight refactors here to improve on my past documentation changes.
    leerob authored Feb 3, 2022
    Copy the full SHA
    bc223d7 View commit details
  2. docs: recommend .end instead of .send when no body is being sent (#…

    …33611)
    
    Fixes #33536
    
    I was thinking to make `body` optional here instead:
    
    https://github.com/vercel/next.js/blob/2c6bd1ed1b3821debda74dc8f407b8f11779a4f0/packages/next/shared/lib/utils.ts#L262
    
    But that might result in more errors when not setting the status code correctly. So it's the easiest for us to just recommend `.end()` which `.send()` uses when there is no argument.
    
    https://github.com/vercel/next.js/blob/c71465d87a7eeb050e5cc7e94817f19e69e9d1e4/packages/next/server/api-utils.ts#L269
    
    ## Bug
    
    - [ ] Related issues linked using `fixes #number`
    - [ ] Integration tests added
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    ## Feature
    
    - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
    - [ ] Related issues linked using `fixes #number`
    - [ ] Integration tests added
    - [ ] Documentation added
    - [ ] Telemetry added. In case of a feature if it's used or not.
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    ## Documentation / Examples
    
    - [ ] Make sure the linting passes by running `yarn lint`
    balazsorban44 authored Feb 3, 2022
    Copy the full SHA
    b772513 View commit details
  3. feat(next-swc): Update swc (#33724)

    This PR applies
    
     - swc-project/swc#3350
    
    which fixes lots of minifier issues.
    
     - swc-project/swc#3391
    
    This fixes the regression of evaluatior.
    
     - swc-project/swc#3436
    
    This fixes codegen bugs.
    
     - swc-project/swc#3425
    
    This improves compression.
    
     - swc-project/swc#3400
    
    This fixes some transform bugs.
    
     - swc-project/swc#3392
     
    This implements more terser options.
    kdy1 authored Feb 3, 2022
    Copy the full SHA
    4bd76ff View commit details
  4. Update custom document docs to prepare for React 18. (#33814)

    To help prepare for React 18, I've found myself sharing the updated code snippet of `_document` linked in the [React 18 docs](https://nextjs.org/docs/advanced-features/react-18#react-server-components), which uses a function instead of a class.
    
    This PR updates the Custom Document docs to help prepare for this change, by encourage readers to use the new version, and listing more tangible examples of why you would override `_document` (`lang` on `html`, className on `body`). It also reorganizes some of the caveats and warnings related to `getInitialProps` usage to only be in the single section that applies to it.
    
    These overrides and ejections (`getInitialProps` and `renderPage`) only apply to a subset of the people looking to change document. 
    
    Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
    leerob and ijjk authored Feb 3, 2022
    Copy the full SHA
    5abd92f View commit details
  5. v12.0.11-canary.4

    ijjk committed Feb 3, 2022
    1
    Copy the full SHA
    740f908 View commit details
  6. Copy the full SHA
    ce9c6b7 View commit details
  7. Update Contentful example to add validations to solve graphql complex…

    …ity errors. (#33958)
    
    Hi! Dev Rel from Contentful here. We noticed that the Contentful example was giving a graphQL complexity error so adding in some validations to the content model that is imported to prevent the error from showing up. 
    
    ## Bug
    
    - [ ] Related issues linked using `fixes #number`
    - [ ] Integration tests added
    - [ ] Errors have helpful link attached, see `contributing.md`
    brittanyrw authored Feb 3, 2022
    Copy the full SHA
    4749014 View commit details
  8. Fix typo in new experimental Relay support docs (#33963)

    ## Documentation / Examples
    
    - [x] Make sure the linting passes by running `yarn lint`
    jord1e authored Feb 3, 2022
    Copy the full SHA
    834546a View commit details

Commits on Feb 4, 2022

  1. Update all CMS examples dependencies. (#33580)

    Updates all CMS updates to use:
    
    - Tailwind 3 (and the corresponding `tailwind.config.js` and PostCSS changes)
    - `remark@14` and `remark-html@15` (and the corresponding ESM breaking changes)
    - `date-fns` minor bump
    
    Ensured all CMS examples were:
    
    - Using `next/image`
    - Not using `as` for `next/link` (no longer needed)
    leerob authored Feb 4, 2022
    Copy the full SHA
    01e174e View commit details
  2. Update to latest version of amphtml-validator (#33967)

    * Update to latest version of amphtml-validator
    
    * update compiled
    
    * bump compiled
    ijjk authored Feb 4, 2022
    Copy the full SHA
    06b2630 View commit details
  3. Warn in dev mode when script tags are added with next/head (#33968)

    This commit adds a development mode warning in the console
    if you try to include <script> tags in next/head, e.g.
    
    ```
    <Head>
      <script async src="..." />
    </Head>
    ```
    
    The warning message explains that this pattern will not
    work well with Suspense/streaming and recommends using the
    next/script component instead.
    
    TODO in follow-up PR: add same warning for stylesheets, etc
    
    ## Feature
    
    - [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
    - [x] Integration tests added
    - [x] Documentation added
    - [x] Errors have helpful link attached, see `contributing.md`
    kara authored Feb 4, 2022
    Copy the full SHA
    61ea8ef View commit details
  4. docs(isr): add missing key prop in jsx loop (#33984)

    Copy pasting this example with a default create-next-app leads to an eslint warning. So I thought let's fix this.
    
    ## Documentation / Examples
    
    - [x] Make sure the linting passes by running `yarn lint`
    vvo authored Feb 4, 2022
    Copy the full SHA
    632c986 View commit details
  5. Copy the full SHA
    4812e22 View commit details
  6. Updated going-to-production with loading performance (#33179)

    ## Documentation Update
    Based on this issue: #29319
    
    ## Documentation / Examples
    
    - [x] Make sure the linting passes by running `yarn lint`
    
    
    Co-authored-by: Steven <229881+styfle@users.noreply.github.com>
    Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
    3 people authored Feb 4, 2022
    Copy the full SHA
    25d93de View commit details
  7. Ensure optional chaining in swc matches babel (#33995)

    This ensures we always transpile optional chaining and nullish coalescing with swc the same as we do [with babel](https://github.com/vercel/next.js/blob/4812e229928dc01ae21ee0533685f6813694c136/packages/next/build/babel/preset.ts#L97-L98) since it can cause issues with webpack even when the node target supports these features. 
    
    The specific case this seems to cause issues with webpack is when a value is imported and optional chaining is used on the import value webpack is stripping the optional chaining cc @sokra 
    
    ## Bug
    
    - [x] Related issues linked using `fixes #number`
    - [x] Integration tests added
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    Fixes: #33915
    ijjk authored Feb 4, 2022
    Copy the full SHA
    a65e361 View commit details
  8. v12.0.11-canary.5

    ijjk committed Feb 4, 2022
    Copy the full SHA
    502a869 View commit details
  9. Use react-dom/server.browser in Node.js (#33950)

    Instead of branching rendering based on Node.js and browser/web runtimes, we should just use the web version for now, which can run as-is on versions >=16.5.0 of Node.js, polyfilling `ReadableStream` on older versions when necessary.
    
    There are a few potential downsides to this, as React is less able to optimize flushing and execution. We can revisit that in the future though if desired.
    devknoll authored Feb 4, 2022
    1
    Copy the full SHA
    0b1d5e1 View commit details
  10. Copy the full SHA
    103d3ab View commit details
  11. Update azure config (#33999)

    * Update azure config
    
    * speed up checkout
    
    * update config
    
    * remove checkout path
    
    * undo checkout change
    ijjk authored Feb 4, 2022
    Copy the full SHA
    1821bde View commit details
  12. Update Terser to v5.10.0, fix minification issues (#33045)

    Bumping Terser from v5.7.1 to v5.10.0 fixes some minification issues:
    - I specifically encountered this bug, where a boolean condition was flipped when a nullish coalescing operator was involved: terser/terser#1045
    - See [Terser's changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md) for more fixes
    
    ## Bug
    
    - [ ] Related issues linked using `fixes #number`
    - [ ] Integration tests added
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    ## Feature
    
    - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
    - [ ] Related issues linked using `fixes #number`
    - [ ] Integration tests added
    - [ ] Documentation added
    - [ ] Telemetry added. In case of a feature if it's used or not.
    - [ ] Errors have helpful link attached, see `contributing.md`
    
    ## Documentation / Examples
    
    - [x] Make sure the linting passes by running `yarn lint`
    dlindenkreuz authored Feb 4, 2022
    Copy the full SHA
    f275fcf View commit details
  13. Warn in dev mode when stylesheets are added using next/head (#34004)

    This commit adds a development mode warning in the console
    if you try to include <link rel="stylesheet"> tags in
    next/head, e.g.
    
    ```
    <Head>
      <link ref="stylesheet" href="..." />
    </Head>
    ```
    
    The warning message explains that this pattern will not
    work well with Suspense/streaming and recommends using a
    custom Document component instead.
    
    ## Feature
    
    - [x] 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
    - [x] Documentation added
    - [ ] Telemetry added. In case of a feature if it's used or not.
    - [x] Errors have helpful link attached, see `contributing.md`
    
    
    Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
    kara and ijjk authored Feb 4, 2022
    Copy the full SHA
    24fe279 View commit details
  14. v12.0.11-canary.6

    ijjk committed Feb 4, 2022
    1
    Copy the full SHA
    f322d62 View commit details

Commits on Feb 5, 2022

  1. Use ReadableStream in RenderResult (#34005)

    Since we're always using `ReadableStream`, we should just get rid of `ResultPiper`.
    
    This also lets us replace things like `bufferedReadFromReadableStream` with a `TransformStream` that does the same thing, so that it's `TransformStream`s all the way down.
    
    Finally, we can get rid of the one-off call to `renderToReadableStream` and just use `renderToStream` whenever we're rendering a concurrent tree.
    devknoll authored Feb 5, 2022
    1
    Copy the full SHA
    7e0b8aa View commit details
Showing 527 changed files with 12,749 additions and 5,738 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ packages/next-env/**/*.d.ts
packages/create-next-app/templates/**
test/integration/eslint/**
test/development/basic/legacy-decorators/**/*
test/production/emit-decorator-metadata/**/*.js
test-timings.json
packages/next-swc/crates/**
bench/nested-deps/pages/**
45 changes: 12 additions & 33 deletions .github/ISSUE_TEMPLATE/1.bug_report.yml
Original file line number Diff line number Diff line change
@@ -7,49 +7,28 @@ body:
value: Thanks for taking the time to file a bug report! Please fill out this form as completely as possible.
- type: markdown
attributes:
value: If you leave out sections there is a high likelihood it will be moved to the GitHub Discussions "Help" section.
- type: markdown
attributes:
value: 'Please first verify if your issue exists in the Next.js canary release line: `npm install next@canary`.'
- type: markdown
attributes:
value: 'next@canary is the beta version of Next.js. It includes all features and fixes that are pending to land on the stable release line.'
value: If you leave out sections there is a high likelihood it will be moved to the GitHub Discussions ["Help" section](https://github.com/vercel/next.js/discussions/categories/help).
- type: checkboxes
attributes:
label: Verify canary release
description: '`next@canary` is the canary version of Next.js that ships daily. It includes all features and fixes that have not been released to the stable version yet. Think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces before opening a new issue.'
options:
- label: I verified that the issue exists in Next.js canary release
required: true
- type: textarea
attributes:
label: Run `next info` (available from version 12.0.8 and up)
label: Provide environment information
description: Please run `next info` in the root directory of your project and paste the results. You might need to use `npx --no-install next info` if next is not in the current PATH.
validations:
required: false
- type: input
attributes:
label: What version of Next.js are you using?
description: 'For example: 10.0.1'
validations:
required: true
- type: input
attributes:
label: What version of Node.js are you using?
description: 'For example: 12.0.0'
validations:
required: true
label: What browser are you using? (if relevant)
description: 'Please specify the exact version. For example: Chrome 100.0.4878.0'
- type: input
attributes:
label: What browser are you using?
description: 'For example: Chrome, Safari'
validations:
required: true
- type: input
attributes:
label: What operating system are you using?
description: 'For example: macOS, Windows'
validations:
required: true
- type: input
attributes:
label: How are you deploying your application?
label: How are you deploying your application? (if relevant)
description: 'For example: next start, next export, Vercel, Other platform'
validations:
required: true
- type: textarea
attributes:
label: Describe the Bug
43 changes: 17 additions & 26 deletions .github/ISSUE_TEMPLATE/2.example_bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,40 @@
name: Example Bug Report
description: Create a bug report for the examples
description: Create a bug report for one of the Next.js examples
labels: 'type: example,template: bug'
body:
- type: markdown
attributes:
value: Thanks for taking the time to file a examples bug report! Please fill out this form as completely as possible.
value: Thanks for taking the time to file a bug report for [one of the examples](https://github.com/vercel/next.js/tree/canary/examples)! Please fill out this form as completely as possible.
- type: markdown
attributes:
value: If you leave out sections there is a high likelihood it will be moved to the GitHub Discussions "Help" section.
- type: input
value: If you leave out sections there is a high likelihood it will be moved to the GitHub Discussions ["Help" section](https://github.com/vercel/next.js/discussions/categories/help).
- type: checkboxes
attributes:
label: What example does this report relate to?
description: 'For example: with-styled-components'
validations:
required: true
- type: input
attributes:
label: What version of Next.js are you using?
description: 'For example: 10.0.1'
validations:
required: true
- type: input
label: Verify canary release
description: '`next@canary` is the canary version of Next.js that ships daily. It includes all features and fixes that have not been released to the stable version yet. Think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces before opening a new issue.'
options:
- label: I verified that the issue exists in Next.js canary release
required: true
- type: textarea
attributes:
label: What version of Node.js are you using?
description: 'For example: 12.0.0'
label: Provide environment information
description: Please run `next info` in the root directory of your project and paste the results. You might need to use `npx --no-install next info` if next is not in the current PATH.
validations:
required: true
- type: input
attributes:
label: What browser are you using?
description: 'For example: Chrome, Safari'
label: Which example does this report relate to?
description: "See a complete list in the [examples folder](https://github.com/vercel/next.js/tree/canary/examples). For example: with-styled-components. Note: Examples not in the examples folder might be maintained by the example's library author. Check out their projects before opening the issue on Next.js"
validations:
required: true
- type: input
attributes:
label: What operating system are you using?
description: 'For example: macOS, Windows'
validations:
required: true
label: What browser are you using? (if relevant)
description: 'Please specify the exact version. For example: Chrome 100.0.4878.0'
- type: input
attributes:
label: How are you deploying your application?
label: How are you deploying your application? (if relevant)
description: 'For example: next start, next export, Vercel, Other platform'
validations:
required: true
- type: textarea
attributes:
label: Describe the Bug
6 changes: 4 additions & 2 deletions .github/workflows/lock.yml
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@ name: 'Lock Threads'

on:
schedule:
# This runs every hour: https://crontab.guru/every-1-hour
- cron: '0 * * * *'
# This runs twice a day: https://crontab.guru/#0_0,12_*_*_*
- cron: '0 0,12 * * *'
workflow_dispatch:

permissions:
@@ -16,10 +16,12 @@ concurrency:
jobs:
action:
runs-on: ubuntu-latest
if: github.repository_owner == 'vercel'
steps:
- uses: dessant/lock-threads@v3
with:
github-token: ${{ secrets.LOCK_TOKEN }}
issue-inactive-days: 30
issue-comment: 'This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.'
pr-inactive-days: 30
log-output: true
3 changes: 2 additions & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ on:
jobs:
stale:
runs-on: ubuntu-latest
if: github.repository_owner == 'vercel'
steps:
- uses: actions/stale@v4
id: stale
@@ -21,4 +22,4 @@ jobs:
days-before-pr-close: -1
days-before-pr-stale: -1
exempt-issue-labels: 'blocked,must,should,keep'
operation-per-run: 300 # 1 operation per 100 issues, the rest is to label/comment/close
operations-per-run: 300 # 1 operation per 100 issues, the rest is to label/comment/close
69 changes: 24 additions & 45 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -2,73 +2,52 @@

### Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

### Our Standards

Examples of behavior that contributes to creating a positive environment
include:
Examples of behavior that contributes to a positive environment for our community include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior by participants include:
Examples of unacceptable behavior include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
- Publishing others’ private information, such as a physical or email address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

### Our Responsibilities
### Enforcement Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

### Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

### Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [coc@vercel.com](mailto:coc@vercel.com). All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project team responsible for enforcement at [coc@vercel.com](mailto:coc@vercel.com). All complaints will be reviewed and investigated promptly and fairly.

All project maintainers are obligated to respect the privacy and security of the reporter of any incident.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

### Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1,
available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct/][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[version]: https://www.contributor-covenant.org/version/2/1
7 changes: 2 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -69,11 +69,9 @@ stages:
- stage: Test
dependsOn: Build
jobs:
- job: test_ie11
- job: test_integration
pool:
vmImage: 'windows-2019'
variables:
BROWSER_NAME: internet explorer
steps:
- checkout: none
- task: NodeTool@0
@@ -89,8 +87,7 @@ stages:
displayName: Cache Build

- script: |
npm i -g selenium-standalone@6.18.0
displayName: 'Install selenium node'
npx playwright install chromium
- script: |
node run-tests.js -c 1 test/integration/production/test/index.test.js test/integration/css-client-nav/test/index.test.js test/integration/rewrites-has-condition/test/index.test.js
10 changes: 7 additions & 3 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Contributing to Next.js

Read about our [Commitment to Open Source](https://vercel.com/oss). To
contribute to [our examples](examples), please see **[Adding
examples](#adding-examples)** below.
[Watch the 40-minute walkthrough video on how to contribute to Next.js.](https://www.youtube.com/watch?v=cuoNzXFLitc)

---

- Read about our [Commitment to Open Source](https://vercel.com/oss).
- To contribute to [our examples](examples), please see [Adding examples](#adding-examples) below.
- Before jumping into a PR be sure to search [existing PRs](https://github.com/vercel/next.js/pulls) or [issues](https://github.com/vercel/next.js/issues) for an open or closed item that relates to your submission.

## Developing

8 changes: 8 additions & 0 deletions docs/advanced-features/automatic-static-optimization.md
Original file line number Diff line number Diff line change
@@ -20,6 +20,14 @@ If the above is not the case, Next.js will **statically optimize** your page aut

During prerendering, the router's `query` object will be empty since we do not have `query` information to provide during this phase. After hydration, Next.js will trigger an update to your application to provide the route parameters in the `query` object.

The cases where the query will be updated after hydration triggering another render are:

- The page is a [dynamic-route](/docs/routing/dynamic-routes.md).
- The page has query values in the URL.
- [Rewrites](/docs/api-reference/next.config.js/rewrites.md) are configured in your `next.config.js` since these can have parameters that may need to be parsed and provided in the `query`.

To be able to distinguish if the query is fully updated and ready for use, you can leverage the `isReady` field on [`next/router`](/docs/api-reference/next/router.md#router-object).

> **Note:** Parameters added with [dynamic routes](/docs/routing/dynamic-routes.md) to a page that's using [`getStaticProps`](/docs/basic-features/data-fetching/get-static-props.md) will always be available inside the `query` object.
`next build` will emit `.html` files for statically optimized pages. For example, the result for the page `pages/about.js` would be:
Loading