1. 05 10月, 2020 1 次提交
  2. 26 9月, 2020 1 次提交
  3. 22 9月, 2020 1 次提交
  4. 07 9月, 2020 1 次提交
  5. 06 8月, 2020 1 次提交
    • A
      Add experimental image post-processing (#15875) · b6060fa4
      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.
      b6060fa4
  6. 04 8月, 2020 2 次提交
  7. 03 8月, 2020 1 次提交
  8. 28 7月, 2020 1 次提交
  9. 23 6月, 2020 1 次提交
  10. 18 6月, 2020 1 次提交
  11. 15 6月, 2020 1 次提交
  12. 10 6月, 2020 1 次提交
  13. 07 6月, 2020 1 次提交
  14. 05 6月, 2020 1 次提交
    • J
      Fix pages/index.js and pages/index/index.js behavior (#13699) · 1b36f0c0
      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
      1b36f0c0
  15. 02 6月, 2020 1 次提交
    • T
      Added no-shadow rule to eslint (#13645) · b124ed2e
      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.
      b124ed2e
  16. 28 5月, 2020 1 次提交
  17. 27 5月, 2020 2 次提交
    • J
      Make sure to not duplicate exports with exportTrailingSlash (#11011) · ce0a32c3
      JJ Kasper 提交于
      This makes sure we don't duplicate the `/` route or any others while exporting with `exportTrailingSlash` enabled. We do still output `404.html` with `exportTrailingSlash` enabled in case anyone was relying on this file being present.
      
      Fixes: https://github.com/zeit/next.js/issues/11008
      ce0a32c3
    • C
      Add failing paths to export error summary (#10026) · d94e8db5
      Christian Stuff 提交于
      Closes #9990 by collecting all paths with errors during `next export` and reporting them sorted in the error summary at the end.
      
      It will produce an output similar to:
      
      ```
          Error: Export encountered errors on following paths:
              /nested/page
              /page
              /page-1
              /page-10
              /page-11
              /page-12
              /page-13
              /page-2
              /page-3
              /page-4
              /page-5
              /page-6
              /page-7
              /page-8
              /page-9
              at _default (/app/next.js/packages/next/dist/export/index.js:19:788)
              at process._tickCallback (internal/process/next_tick.js:68:7)
      ```
      
      I tested the output with the `handle-export-errors` integration test suite, but I'm not sure how to gracefully test this added output.
      I thought of collecting all page source files with [recursiveReaddirSync](https://github.com/zeit/next.js/blob/2ba352da39ee00b6595aecdc9ffb2f103e803a85/packages/next/next-server/server/lib/recursive-readdir-sync.ts) but it seems I can't import it in js test files:
      
      ```
      SyntaxError: /app/next.js/packages/next/next-server/server/lib/recursive-readdir-sync.ts: Unexpected token, expected "," (11:5)
      
             9 |  */
            10 | export function recursiveReadDirSync(
          > 11 |   dir: string,
               |      ^
            12 |   arr: string[] = [],
            13 |   rootDir = dir
            14 | ): string[] {
      ```
      
      The test itself could look like:
      ```js
        it('Reports failing paths', async () => {
          const { stderr } = await nextBuild(appDir, [], {
            stdout: true,
            stderr: true,
          })
          const pages = []
          // collect pages to be ['/page', '/page-1', ... etc.]
          pages.forEach(page => {
            expect(stderr).toContain(page)
          })
        })
      ```
      d94e8db5
  18. 26 5月, 2020 2 次提交
    • J
      Convert export worker to typescript (#13381) · 67df4970
      Jan Potoms 提交于
      This is purely adding types except for the line:
      
      ```js
      params = getRouteMatcher(getRouteRegex(page))(path) || undefined
      ```
      
      Also added a couple of `@ts-ignore` as to avoid having to make any more functional changes
      67df4970
    • J
      Add a few extra types (#13363) · 2e1a322d
      Jan Potoms 提交于
      Added a few extra types here and there while I was digging through the code
      2e1a322d
  19. 25 5月, 2020 1 次提交
  20. 21 5月, 2020 1 次提交
  21. 19 5月, 2020 2 次提交
  22. 02 5月, 2020 1 次提交
  23. 14 4月, 2020 1 次提交
    • J
      Add basePath in link component and add/remove it consistently (#9988) · d3e308a7
      JJ Kasper 提交于
      * Add basePath in link component and add/remove it consistently
      
      * Update to not use regex for delBasePath
      
      * Expose addBasePath as router method
      
      * Revert "Expose addBasePath as router method"
      
      This reverts commit 40fed596195c6affabf837e42d472452768e13a3.
      
      * Expose basePath as router field
      
      * Apply suggestion
      
      * Expose basePath as router field
      
      * remove un-used vars
      
      * Update externals
      
      * Apply lint fix
      
      * Update size-limit test
      
      * Update prefetch
      d3e308a7
  24. 31 3月, 2020 3 次提交
  25. 26 3月, 2020 1 次提交
    • J
      Add initial support for new env handling (#10525) · d8155b22
      JJ Kasper 提交于
      * Add initial support for new env config file
      
      * Fix serverless processEnv call when no env is provided
      
      * Add missing await for test method
      
      * Update env config to .env.json and add dotenv loading
      
      * ncc dotenv package
      
      * Update type
      
      * Update with new discussed behavior removing .env.json
      
      * Update hot-reloader createEntrypoints
      
      * Make sure .env is loaded before next.config.js
      
      * Add tests for all separate .env files
      
      * Remove comments
      
      * Add override tests
      
      * Add test for overriding env vars based on local environment
      
      * Add support for .env.test
      
      * Apply suggestions from code review
      Co-Authored-By: NJoe Haddad <joe.haddad@zeit.co>
      
      * Use chalk for env loaded message
      
      * Remove constant as it’s not needed
      
      * Update test
      
      * Update errsh, taskr, and CNA template ignores
      
      * Make sure to only consider undefined missing
      
      * Remove old .env ignore
      
      * Update to not populate process.env with loaded env
      
      * Add experimental flag and add loading of global env values
      Co-authored-by: NTim Neutkens <timneutkens@me.com>
      Co-authored-by: NJoe Haddad <joe.haddad@zeit.co>
      d8155b22
  26. 25 3月, 2020 2 次提交
  27. 24 3月, 2020 1 次提交
  28. 22 3月, 2020 1 次提交
  29. 15 2月, 2020 1 次提交
  30. 06 2月, 2020 1 次提交
  31. 03 2月, 2020 1 次提交
  32. 16 1月, 2020 1 次提交
  33. 15 1月, 2020 1 次提交