- 15 10月, 2020 2 次提交
-
-
由 JJ Kasper 提交于
This adds the `locale` prop for `next/link` to allow transitioning between locales client-side and also allows passing the locale to `router.push/replace` via the transition options similar to `shallow` e.g. `router.push('/another', '/another, { locale: 'nl' })` x-ref: https://github.com/vercel/next.js/pull/17370
-
由 JJ Kasper 提交于
This updates to set the `NEXT_LOCALE` cookie to the default locale when the user prefers a different locale from the default in their `accept-language` header but visits the default locale path e.g. `/en-US` with a `accept-language` preferred header of `nl` will set the `NEXT_LOCALE=en-US` header and then redirect to `/` x-ref: https://github.com/vercel/next.js/pull/17370
-
- 14 10月, 2020 3 次提交
-
-
由 Alex Castle 提交于
Co-authored-by: NTim Neutkens <timneutkens@me.com> Co-authored-by: NTim Neutkens <tim@timneutkens.nl>
-
由 JJ Kasper 提交于
Co-authored-by: Nkodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
-
由 Jan Potoms 提交于
Co-authored-by: NJJ Kasper <jj@jjsweb.site> Co-authored-by: Nkodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
-
- 12 10月, 2020 2 次提交
-
-
由 JJ Kasper 提交于
While working on https://github.com/vercel/next.js/pull/17755 noticed a couple of cases that needed fixing and broke them out to this PR to make that one easier to review. One fix is for `ssgCacheKey` where it wasn't having the `locale` prefix stripped correctly due to the locales no longer being populated under the server instances `renderOpts` and the second fix is for the `asPath` not being set to `/` when the `locale` is the only part in the URL e.g. `/en` became an empty string `""` x-ref: https://github.com/vercel/next.js/pull/17370
-
由 JJ Kasper 提交于
Follow-up to https://github.com/vercel/next.js/pull/17370 this makes sure the locale detection is case-insensitive.
-
- 10 10月, 2020 1 次提交
-
-
由 JJ Kasper 提交于
Follow-up to https://github.com/vercel/next.js/pull/17370 this adds mapping of locales to domains and handles default locales for specific domains also allowing specifying which locales can be visited for each domain. This PR also updates to output all statically generated pages under the locale prefix to make it easier to locate/lookup and to not redirect to the default locale prefixed path when no `accept-language` header is provided.
-
- 09 10月, 2020 1 次提交
-
-
由 JJ Kasper 提交于
Follow-up PR to #17370 this adds generating auto-export, non-dynamic SSG, and fallback pages with all locales. Dynamic SSG pages still control which locales the pages are generated with using `getStaticPaths`. To further control which locales non-dynamic SSG pages will be prerendered with a follow-up PR adding handling for 404 behavior from `getStaticProps` will be needed. x-ref: https://github.com/vercel/next.js/issues/17110
-
- 08 10月, 2020 2 次提交
-
-
由 JJ Kasper 提交于
Follow-up PR to https://github.com/vercel/next.js/pull/17370 when the path is not prefixed with a locale and the default locale is the detected locale it doesn't redirect to locale prefixed variant. If the default locale path is visited and the default locale is visited this also redirects to the root removing the un-necessary locale in the URL. This also exposes the `defaultLocale` on the router since the RFC mentions `Setting a defaultLocale is required in every i18n library so it'd be useful for Next.js to provide it to the application.` although doesn't explicitly spec where we want to expose it. If we want to expose it differently this can be updated.
-
由 JJ Kasper 提交于
This adds the initial changes outlined in the [i18n routing RFC](https://github.com/vercel/next.js/discussions/17078). This currently treats the locale prefix on routes similar to how the basePath is treated in that the config doesn't require any changes to your pages directory and is automatically stripped/added based on the detected locale that should be used. Currently redirecting occurs on the `/` route if a locale is detected regardless of if an optional catch-all route would match the `/` route or not we may want to investigate whether we want to disable this redirection automatically if an `/index.js` file isn't present at root of the pages directory. TODO: - [x] ensure locale detection/populating works in serverless mode correctly - [x] add tests for locale handling in different modes, fallback/getStaticProps/getServerSideProps To be continued in fall-up PRs - [ ] add tests for revalidate, auto-export, basePath + i18n - [ ] add mapping of domains with locales - [ ] investigate detecting locale against non-index routes and populating the locale in a cookie x-ref: https://github.com/vercel/next.js/issues/17110
-
- 26 9月, 2020 1 次提交
-
-
由 JJ Kasper 提交于
* Expose dotenv loading under separate package * Update pre-compiled * Rename package to @next/env * Update lint ignores * Update package.json Co-authored-by: NJoe Haddad <joe.haddad@zeit.co>
-
- 24 9月, 2020 1 次提交
-
-
由 Joe Haddad 提交于
Prior to this pull request, Next.js would immediately decode all URLs sent to its server (via `path-match`). This was rarely needed, and Next.js would typically re-encode the incoming request right away (see all the `encodeURIComponent`s removed in PR diff). This adds unnecessary performance overhead. Long term, this will also help prevent weird encoding edge-cases like #10004, #10022, #11371, et al. --- No new tests are necessary for this change because we've extensively tested these edge cases with existing tests. One test was updated to reflect that we skip decoding in a 404 scenario. Let's see if all the existing tests pass!
-
- 16 9月, 2020 1 次提交
-
-
由 JJ Kasper 提交于
This makes sure we have the correct `asPath` value to prevent breaking hydration for `getServerSideProps` pages and doesn't re-use the `resolvedUrl` value for the `asPath` and instead creates a separate `resolvedAsPath` value that only removes the `_next/data` prefix from the path. Additional tests have been added in the `getServerSideProps` suite to ensure correct `asPath` with rewrites. Fixes: https://github.com/vercel/next.js/issues/17113
-
- 15 9月, 2020 2 次提交
-
-
由 JJ Kasper 提交于
This continues off of https://github.com/vercel/next.js/pull/17081 and provides this normalized `asPath` value in the context provided to `getServerSideProps` to provide the consistent value since the request URL can vary between direct visit and client transition and the alternative requires building the URL each time manually. Kept this change separate from https://github.com/vercel/next.js/pull/17081 since this is addressing a separate issue and allows discussion separately. Closes: https://github.com/vercel/next.js/issues/16407
-
由 JJ Kasper 提交于
This normalizes the `asPath` for `getServerSideProps` and `getStaticProps` pages to ensure it matches the value that would show on the client instead of a) the output pathname when revalidating or generating a fallback or b) the `_next/data` URL on client transition. Fixes: https://github.com/vercel/next.js/issues/16542
-
- 22 8月, 2020 1 次提交
-
-
由 JJ Kasper 提交于
This fixes a client-side file not being transpiled correctly when rewrites are used. The cross browser tests have been updated to make sure there are rewrites so the related code is included and not dead-code eliminated' Closes: https://github.com/vercel/next.js/issues/16440
-
- 21 8月, 2020 1 次提交
-
-
由 Joe Haddad 提交于
We were accidentally allowing data requests to be rendered unconditionally. Instead, we should also check them against the staticPaths result and 404 when appropriate. --- Fixes #15383
-
- 20 8月, 2020 1 次提交
-
-
由 JJ Kasper 提交于
This corrects the basePath being required check for filesystem routes to not consider the public folder catch-all route since it always matches even if the public file isn't present and instead moves the basePath check inside of the public-folder catch-all. Tests already exist that catch this by adding a public folder to the existing `basepath` test suite Fixes: https://github.com/vercel/next.js/issues/16332 Closes: https://github.com/vercel/next.js/pull/16350
-
- 13 8月, 2020 1 次提交
-
-
由 JJ Kasper 提交于
Co-authored-by: NTim Neutkens <timneutkens@me.com>
-
- 12 8月, 2020 1 次提交
-
-
由 Tim Neutkens 提交于
We no longer use tslint so these comments don't do anything.
-
- 11 8月, 2020 1 次提交
-
-
由 Prateek Bhatnagar 提交于
Co-authored-by: NTim Neutkens <tim@timneutkens.nl> Co-authored-by: NJoe Haddad <joe.haddad@zeit.co>
-
- 06 8月, 2020 1 次提交
-
-
由 Alex Castle 提交于
This PR adds a second experimental post-processing step for the framework introduced by @prateekbh in #14746. The image post-processing step scans the rendered document for the first few images and uses a simple heuristic to determine if the images should be automatically preloaded. Analysis of quite a few production Next apps has shown that a lot of sites are taking a substantial hit to their [LCP](https://web.dev/lcp/) score because an image that's part of the "hero" element on the page is not preloaded and is getting downloaded with lower priority than the JavaScript bundles. This post-processor should automatically fix that for a lot of sites, without causing any real performance effects in cases where it fails to identify the hero image. This feature is behind an experimental flag, and will be subject to quite a bit of experimentation and tweaking before it's ready to be made a default setting.
-
- 04 8月, 2020 1 次提交
-
-
由 Joe Haddad 提交于
By popular request, this pull request adds support for returning `fallback: 'blocking'` from `getStaticPaths`. This new mode will cause unknown paths to be rendered on-demand ("SSR") without the static (placeholder) fallback. This feature is **currently experimental and should not be used in production yet**. It's currently flagged behind `unstable_`: ``` fallback: 'unstable_blocking' ``` TODO: - [x] Next.js tests - [ ] Add Vercel support - [ ] Vercel tests --- Fixes #15637
-
- 29 7月, 2020 1 次提交
-
-
由 JJ Kasper 提交于
Instead of trying to parse header values as URLs and then replace path segments in them this switches to escaping characters that can break `path-to-regexp` compiling Fixes: https://github.com/vercel/next.js/issues/15580 x-ref: https://github.com/vercel/vercel/pull/4942
-
- 28 7月, 2020 2 次提交
-
-
由 Prateek Bhatnagar 提交于
Co-authored-by: Natcastle <atcastle@gmail.com>
-
由 Gerald Monaco 提交于
-
- 13 7月, 2020 1 次提交
-
-
由 JJ Kasper 提交于
This adds handling for custom-routes with `basePath` to automatically add the `basePath` for custom-routes `source` and `destination` unless `basePath: false` is set for the route. Closes: https://github.com/vercel/next.js/issues/14782
-
- 01 7月, 2020 1 次提交
-
-
由 Tim Neutkens 提交于
Fixes #11711 Also cleaned up some extra code. This was already supported on the Vercel edge network.
-
- 30 6月, 2020 1 次提交
-
-
由 Jan Potoms 提交于
* avoid pulling code in the bundle for `trailingSlash` logic when it's not enabled * avoid cloning the url an extra time if normalizing the path doesn't change it
-
- 29 6月, 2020 1 次提交
-
-
由 Tim Neutkens 提交于
We've been meaning to change this code for a while
👍 - Changed the name from spr to incremental - Changed the code to be a class instead of using module scope variables
-
- 23 6月, 2020 3 次提交
-
-
由 Jan Potoms 提交于
Co-authored-by: NJoe Haddad <joe.haddad@zeit.co> Co-authored-by: NTim Neutkens <timneutkens@me.com>
-
由 Jan Potoms 提交于
Noticed this while reviewing https://github.com/vercel/next.js/pull/14376. After having done https://github.com/vercel/next.js/pull/13699, this code didn't feel right to me: ```js function prepareRoute(path: string) { path = delBasePath(path || '') // this /index rewrite is problematic, it makes pages/index.js // and pages/index/index.js point to the same thing: return toRoute(!path || path === '/' ? '/index' : path) } ``` Added a nested index page to the prerender tests and found it was rendering the `/` route on navigation. This uncovered 2 more places around the dataroute where the index path was not translated correctly. **edit:** Just to note that there was nothing wrong with https://github.com/vercel/next.js/pull/14376, the issue was already there, I just noticed it while reading that PR
-
由 Tim Neutkens 提交于
Gets rid of the custom function for naming files by removing buildId from the file paths.
-
- 21 6月, 2020 1 次提交
-
-
由 Tim Neutkens 提交于
Updates the way filenames are generated for browser compilation. Notably: - All entry bundles now have hashes in production, this includes pages (previously pages used a buildId in the path) - The AmpFiles no longer depends on hardcoded bundle names, it uses the buildManifest instead (internals) - All cases where we match the page name from the chunk/entrypoint name now use the same function `getRouteFromEntrypoint` (internals) - In development we no longer include the "faked" `buildId` set to `development` for page files, instead we just use the `/_next/static/pages` path (was `/_next/static/development/pages`). This was changed as it caused unneeded complexity and makes generating the bundles easier (internals) - Updated tons of tests to be more resilient to these changes by relying on the buildManifest instead of hardcoded paths (internals) Follow up of these PRs: https://github.com/vercel/next.js/pull/13759 https://github.com/vercel/next.js/pull/13870 https://github.com/vercel/next.js/pull/13937 https://github.com/vercel/next.js/pull/14130 https://github.com/vercel/next.js/pull/14176 https://github.com/vercel/next.js/pull/14268 Fixes #6303 Fixes #12087 Fixes #1948 Fixes #4368 Fixes #4255 Fixes #2548
-
- 18 6月, 2020 1 次提交
-
-
由 JJ Kasper 提交于
This moves the experimental `basePath` config out of the `experimental` section to prepare it for being stable
-
- 15 6月, 2020 1 次提交
-
-
由 Tim Neutkens 提交于
-
- 11 6月, 2020 1 次提交
-
-
由 Tim Neutkens 提交于
Co-authored-by: NJJ Kasper <jj@jjsweb.site> Co-authored-by: Nkodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
-
- 10 6月, 2020 1 次提交
-
-
由 Jan Potoms 提交于
Extracted from https://github.com/vercel/next.js/pull/13333, the same exact code lives in that PR as well, but we can merge this separately if it makes reviewing https://github.com/vercel/next.js/pull/13333 easier This PR does 3 things - deduplicate code from build and next-dev-server that loads custom routes from next.config.js (`loadCustomRoutes`) - in `loadCustomRoutes`, load these rewrites, headers and redirects configs concurrently instead of sequentially. - in next-server, make `this.customRoutes` always defined, this allows us to remove the big `if` around its initialization code in `generateRoutes`, which in turn makes it possible to reuse this code for other routing than user defined routes, which is how https://github.com/vercel/next.js/pull/13333 adds its redirects.
-
- 07 6月, 2020 1 次提交
-
-
由 Tim Neutkens 提交于
Went through and removed a bunch of internal options which are just pass-through values of buildManifest Closes #13851
-