- 19 8月, 2020 2 次提交
-
-
由 Joe Haddad 提交于
Prior to this PR, `loadPage` would call `loadScript` which would then report if the script failed to load. This was problematic because `loadScript` notified a failure to load via `pageRegisterEvents`, which would not set the `pageCache` value for future requests. This means a one-off promise rejection would happen, [in lieu of being] typically consumed within the client-side router, causing a server-side reload. However, when `loadPage` was used independently (i.e. to preload pages), this promise rejection would be ignored as a preload failure. When the real routing request comes in, the `loadPage` function skips its attempt to load the `<script>` because it was already in the DOM, and the router would stop functioning. --- To fix this behavior, I've removed erroneous emits on `pageRegisterEvents` to only happen during the page registration lifecycle (its intended use). The new behavior is that `loadScript` returns a `Promise` that `loadPage` can track, and if any of the page(s) scripts fail to load, we mark the entire page as errored in `pageCache`. This ensures future requests to `loadPage` will always immediately reject with a `PAGE_LOAD_ERROR`, which causes the server-side redirect at the appropriate point. --- Fixes #16333
-
由 Joe Haddad 提交于
1. `as` should be set before `rel` in case of `preload` or `prefetch` 2. `href` should be after `onload` and `onerror`
-
- 18 8月, 2020 2 次提交
-
-
由 Joe Haddad 提交于
Fixes #16260
-
由 Joe Haddad 提交于
This pull request adds a test case for the reproduction provided in #12445. This bug is specifically caused when loading the next page before navigation has actually occurred. --- Fixes #12445
-
- 13 8月, 2020 4 次提交
-
-
由 JJ Kasper 提交于
Co-authored-by: NTim Neutkens <timneutkens@me.com>
-
由 Joe Haddad 提交于
This PR dedupes the `ComponentRes` type to now align with the `loadPage` return type.
-
由 Joe Haddad 提交于
-
由 Joe Haddad 提交于
Fixes #16131
-
- 11 8月, 2020 1 次提交
-
-
由 Joe Haddad 提交于
-
- 07 8月, 2020 1 次提交
-
-
由 Jan Potoms 提交于
-
- 30 7月, 2020 1 次提交
-
-
由 Jan Potoms 提交于
Strictly use `basePath` and not `assetPrefix` on `getStaticProps` and `getServerSideProps` Fixes https://github.com/vercel/next.js/issues/15563
-
- 28 7月, 2020 1 次提交
-
-
由 Arsalan Khattak 提交于
-
- 17 7月, 2020 1 次提交
-
-
由 Tim Neutkens 提交于
-
- 15 7月, 2020 1 次提交
-
-
由 Joe Haddad 提交于
This PR corrects the data fetching behavior for optional root routes. --- Fixes #14923
-
- 14 7月, 2020 1 次提交
-
-
由 Jan Potoms 提交于
Replace `url.parse` and `url.resolve` logic with whatwg `URL`, Bring in a customized `format` function to handle the node url objects that can be passed to router methods. This eliminates the need for `url` (and thus `native-url`) in core. Looks like it shaves off about 2.5Kb, according to the `size-limits` integration tests.
-
- 13 7月, 2020 1 次提交
-
-
由 Jan Potoms 提交于
It should be enough to encode the characters that `path-to-regexp` uses as path delimiters (`/#?`). Fixes https://github.com/vercel/next.js/issues/14691
-
- 29 6月, 2020 1 次提交
-
-
由 JJ Kasper 提交于
This updates `fetchNextData` to re-use the `getDataHref` function from `page-loader` which has more verbose handling to ensure the correct `/_next/data` URL is built. Re-using this logic ensures the `/_next/data` URL can still be built even when a mismatching `href` and `as` value is provided to `next/link`. This also fixes a case in `getDataHref` where optional values that weren't provided would fail to build the data href since the check requiring the param be present while interpolating the route values hasn't been updated to allow missing params for optional values. An additional test case has been added to the prerender suite to ensure the `/_next/data` URL is built correctly when mismatching `href` and `as` values are provided x-ref: https://github.com/vercel/next.js/discussions/14536 x-ref: https://github.com/vercel/next.js/discussions/9081#discussioncomment-31160 Closes: https://github.com/vercel/next.js/issues/14668
-
- 23 6月, 2020 1 次提交
-
-
由 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
-
- 22 6月, 2020 1 次提交
-
-
由 Jan Potoms 提交于
Fix https://github.com/vercel/next.js/issues/14290 and a couple other issues around optional catch-all that popped up after writing these tests Closes https://github.com/vercel/next.js/pull/14344
-
- 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
-
- 09 6月, 2020 1 次提交
-
-
由 Tim Neutkens 提交于
Initial work to use chunkhashes instead of buildid for the page files in production. This does not change the calculation of the filename itself initially.
-
- 08 6月, 2020 1 次提交
-
-
由 JJ Kasper 提交于
As discussed, this streamlines the handling for `basePath` to not automatically strip and add the `basePath` when provided to `next/link` or `router.push/replace` and only automatically adds the `basePath` and when it is manually provided it will cause a 404 which ensures `href` still matches to the pages directory 1-to-1. This also adds additional test cases that we discussed to ensure this behavior is working as intended --- Fixes #13902
-
- 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
-
- 05 6月, 2020 1 次提交
-
-
由 Jan Potoms 提交于
Disambiguate between pages/index.js and pages/index/index.js so that they resolve differently. It all started with a bug in pagesmanifest that propagated throughout the codebase. After fixing pagesmanifest I was able to remove a few hacks here and there and more logic is shared now. especially the logic that resolves an entrypoint back into a route path. To sum up what happened: - `getRouteFromEntrypoint` is the inverse operation of `getPageFile` that's under `pages/_document.tsx` - `denormalizePagePath` is the inverse operation of `normalizePagePath`. Everything is refactored in terms of these operations, that makes their behavior uniform and easier to update/patch in a central place. Before there were subtle differences between those that made `index/index.js` hard to handle. Some potential follow up on this PR: - [`hot-reloader`](https://github.com/vercel/next.js/pull/13699/files#diff-6161346d2c5f4b7abc87059d8768c44bR207) still has one place that does very similar behavior to `getRouteFromEntrypoint`. It can probably be rewritten in terms of `getRouteFromEntrypoint`. - There are a few places where `denormalizePagePath(normalizePagePath(...))` is happening. This is a sign that `normalizePagePath` is doing some validation that is independent of its rewriting logic. That should probably be factored out in its own function. after that I should probably investigate whether `normalizePagePath` is even still needed at all. - a lot of code is doing `.replace(/\\/g, '')`. If wanted, that could be replaced with `normalizePathSep`. - It looks to me like some logic that's spread across the project can be centralized in 4 functions - `getRouteFromEntrypoint` (part of this PR) - its inverse `getEntrypointFromRoute` (already exists in `_document.tsx` as `getPageFile`) - `getRouteFromPageFile` - its inverse `getPageFileFromRoute` (already exists as `findPageFile ` in `server/lib/find-page-file.ts`) It could be beneficial to structure the code to keep these fuctionalities close together and name them similarly. - revise `index.amp` handling in pagesmanifest. I left it alone in this PR to keep it scoped, but it may be broken wrt nested index files as well. It might even make sense to reshape the pagesmanifest altogether to handle html/json/amp/... better
-
- 02 6月, 2020 2 次提交
-
-
由 Joe Haddad 提交于
This removes remaining references to `granularChunks` in configs, error messages, and comments. Also removed the `process.env.__NEXT_GRANULAR_CHUNKS` value. --- Follow up to: https://github.com/vercel/next.js/pull/13663
-
由 Tim Neutkens 提交于
Was going through _document and noticed some variable shadowing going on. Added a rule for it to our eslint configuration and went through all warnings with @Timer.
-
- 28 5月, 2020 1 次提交
-
-
由 Joe Haddad 提交于
-
- 19 5月, 2020 1 次提交
-
-
由 Joe Haddad 提交于
-
- 26 4月, 2020 1 次提交
-
-
由 JJ Kasper 提交于
-
- 06 3月, 2020 1 次提交
-
-
由 JJ Kasper 提交于
* Update to use separate export instead of attaching to Component to identify GS(S)P pages * Handle initialProps being undefined
-
- 03 3月, 2020 1 次提交
-
-
由 Joe Haddad 提交于
* Prefetch SSG Data * Update packages/next/client/page-loader.js Co-Authored-By: NJJ Kasper <jj@jjsweb.site> * Revert router.ts * Revert link.tsx * undo change * mimmic existing * simplify * Prefetch href and asPath * fix load * dedupe prefetchAs * Inject script tag on hover * comment prefetchAs * minify code * introduce lazy files * Add some breathing room * correct default type * Prefetch non-dynamic data * Prefetch dynamic route data * Fix size test * Humanize code * add tests * Disable code * Only generate modern version in modern mode * Extract function helper * add comments * Filter out dynamic route to simplify manifest size * add test Co-authored-by: NJJ Kasper <jj@jjsweb.site>
-
- 08 1月, 2020 1 次提交
-
-
由 Joe Haddad 提交于
* Simplify `<Link>` Prefetch Deduping * Fix test * Update test/integration/preload-viewport/test/index.test.js Co-Authored-By: NJJ Kasper <jj@jjsweb.site> Co-authored-by: NJJ Kasper <jj@jjsweb.site>
-
- 06 1月, 2020 1 次提交
-
-
由 Brian Mathews 提交于
* Add assetPrefix when fetching script and style dependencies for granularChunks * Lint * Fix assetPrefix usage with granularChunks * Add tests for granularChunks with assetPrefix * Cleanup
-
- 05 1月, 2020 1 次提交
-
-
由 Tim Neutkens 提交于
* Remove async from void functions in page-loader * Fix void return * Update page-loader.js * Update index.test.js
-
- 01 1月, 2020 1 次提交
-
-
由 Joe Haddad 提交于
-
- 25 12月, 2019 1 次提交
-
-
由 Joe Haddad 提交于
-
- 24 12月, 2019 1 次提交
-
-
由 Joe Haddad 提交于
* Optimize Prefetching * fix css client nav test * fix preload viewport test * fix production test * patch tests more * Make page loader wait on prefetch * no unhandled rejection * Save some bytes
-
- 21 12月, 2019 1 次提交
-
-
由 JJ Kasper 提交于
* Prevent re-observing for an already prefetched page * Update size-limit test * Move prefetched setting * Remove extra prefetched setting
-
- 14 12月, 2019 1 次提交
-
-
由 Tim Neutkens 提交于
-
- 11 12月, 2019 1 次提交
-
-
由 Joe Haddad 提交于
* CSS Module Support * Fix Server-Side Render of CSS Modules * Fix Jest Snapshots https://github.com/facebook/jest/pull/8492 * Fix snapshots * Add test for CSS module edit without remounting * Add tests for dev and production style being applied * Add missing TODOs * Include/exclude should only be applied to issuer, not the CSS file itself * Add CSS modules + node_modules tests * Test that content is correct * Create Multi Module Suite * Add client-side navigation support for CSS * Add tests for client-side nav * Add some delays * Try another fix * Increase timeout to 3 minutes * Fix test * Give all unique directories
-