1. 20 8月, 2020 2 次提交
  2. 19 8月, 2020 1 次提交
  3. 18 8月, 2020 3 次提交
  4. 17 8月, 2020 1 次提交
  5. 15 8月, 2020 1 次提交
  6. 14 8月, 2020 4 次提交
  7. 13 8月, 2020 4 次提交
    • J
      Reduce router code (#16159) · 5b815316
      Joe Haddad 提交于
      This reduces the code as suggested: https://github.com/vercel/next.js/pull/15231#discussion_r469691649.
      
      Removes these bloated Babel helpers:
      
      ```diff
      @@ -678,80 +678,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
       
             var _createClass = __webpack_require__("W8MJ");
       
      -      function _createForOfIteratorHelper(o, allowArrayLike) {
      -        var it;
      -        if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
      -          if (
      -            Array.isArray(o) ||
      -            (it = _unsupportedIterableToArray(o)) ||
      -            (allowArrayLike && o && typeof o.length === "number")
      -          ) {
      -            if (it) o = it;
      -            var i = 0;
      -            var F = function F() {};
      -            return {
      -              s: F,
      -              n: function n() {
      -                if (i >= o.length) return { done: true };
      -                return { done: false, value: o[i++] };
      -              },
      -              e: function e(_e) {
      -                throw _e;
      -              },
      -              f: F
      -            };
      -          }
      -          throw new TypeError(
      -            "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
      -          );
      -        }
      -        var normalCompletion = true,
      -          didErr = false,
      -          err;
      -        return {
      -          s: function s() {
      -            it = o[Symbol.iterator]();
      -          },
      -          n: function n() {
      -            var step = it.next();
      -            normalCompletion = step.done;
      -            return step;
      -          },
      -          e: function e(_e2) {
      -            didErr = true;
      -            err = _e2;
      -          },
      -          f: function f() {
      -            try {
      -              if (!normalCompletion && it["return"] != null) it["return"]();
      -            } finally {
      -              if (didErr) throw err;
      -            }
      -          }
      -        };
      -      }
      -
      -      function _unsupportedIterableToArray(o, minLen) {
      -        if (!o) return;
      -        if (typeof o === "string") return _arrayLikeToArray(o, minLen);
      -        var n = Object.prototype.toString.call(o).slice(8, -1);
      -        if (n === "Object" && o.constructor) n = o.constructor.name;
      -        if (n === "Map" || n === "Set") return Array.from(o);
      -        if (
      -          n === "Arguments" ||
      -          /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)
      -        )
      -          return _arrayLikeToArray(o, minLen);
      -      }
      -
      -      function _arrayLikeToArray(arr, len) {
      -        if (len == null || len > arr.length) len = arr.length;
      -        for (var i = 0, arr2 = new Array(len); i < len; i++) {
      -          arr2[i] = arr[i];
      -        }
      -        return arr2;
      -      }
      -
             exports.__esModule = true;
             exports.hasBasePath = hasBasePath;
             exports.addBasePath = addBasePath;
      @@ -1864,28 +1790,16 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                     } // handle resolving href for dynamic routes
       
                     if (!pages.includes(cleanPathname)) {
      -                var _iterator = _createForOfIteratorHelper(pages),
      -                  _step;
      -
      -                try {
      -                  for (_iterator.s(); !(_step = _iterator.n()).done; ) {
      -                    var page = _step.value;
      -
      -                    if (
      -                      (0, _isDynamic.isDynamicRoute)(page) &&
      -                      (0, _routeRegex.getRouteRegex)(page).re.test(
      -                        cleanPathname
      -                      )
      -                    ) {
      -                      parsedHref.pathname = addBasePath(page);
      -                      break;
      -                    }
      +                // eslint-disable-next-line array-callback-return
      +                pages.some(function(page) {
      +                  if (
      +                    (0, _isDynamic.isDynamicRoute)(page) &&
      +                    (0, _routeRegex.getRouteRegex)(page).re.test(cleanPathname)
      +                  ) {
      +                    parsedHref.pathname = addBasePath(page);
      +                    return true;
                         }
      -                } catch (err) {
      -                  _iterator.e(err);
      -                } finally {
      -                  _iterator.f();
      -                }
      +                });
                     }
       
                     return parsedHref;
      @@ -2069,10 +1983,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
                       }
       
                       if (cancelled) {
      -                  var _err = new Error("Loading initial props cancelled");
      -
      -                  _err.cancelled = true;
      -                  throw _err;
      +                  var err = new Error("Loading initial props cancelled");
      +                  err.cancelled = true;
      +                  throw err;
                       }
       
                       return data;
      ```
      5b815316
    • J
    • J
      Remove unused router method (#16149) · ff0571ae
      Joe Haddad 提交于
      This PR removes a legacy router method that was used for old-style HMR, now replaced by Fast Refresh.
      
      This method was not public:
      ```tsx
      export type NextRouter = BaseRouter &
        Pick<
          Router,
          | 'push'
          | 'replace'
          | 'reload'
          | 'back'
          | 'prefetch'
          | 'beforePopState'
          | 'events'
          | 'isFallback'
        >
      ```
      
      Even if someone found this method, it's highly unlikely they could use it successfully—it required the full module object.
      ff0571ae
    • J
      Dedupe ComponentRes type (#16148) · c7acd118
      Joe Haddad 提交于
      This PR dedupes the `ComponentRes` type to now align with the `loadPage` return type.
      c7acd118
  8. 12 8月, 2020 1 次提交
  9. 11 8月, 2020 2 次提交
  10. 10 8月, 2020 1 次提交
  11. 08 8月, 2020 2 次提交
  12. 07 8月, 2020 3 次提交
  13. 06 8月, 2020 2 次提交
    • J
      Allow absolute urls in router and Link (#15792) · 5dbe0d02
      Jan Potoms 提交于
      Fixes https://github.com/vercel/next.js/issues/15639
      Fixes https://github.com/vercel/next.js/issues/15820
      
      To Do:
      - [x] Doesn't work with `basePath` yet
      5dbe0d02
    • 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
  14. 04 8月, 2020 2 次提交
  15. 03 8月, 2020 2 次提交
  16. 02 8月, 2020 1 次提交
  17. 01 8月, 2020 2 次提交
  18. 29 7月, 2020 3 次提交
  19. 28 7月, 2020 3 次提交