Skip to content

Commit

Permalink
v12.1.6-canary.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Apr 26, 2022
1 parent 489e65e commit 994f182
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "12.1.6-canary.6"
"version": "12.1.6-canary.7"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "12.1.6-canary.6",
"version": "12.1.6-canary.7",
"keywords": [
"react",
"next",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-next",
"version": "12.1.6-canary.6",
"version": "12.1.6-canary.7",
"description": "ESLint configuration used by NextJS.",
"main": "index.js",
"license": "MIT",
Expand All @@ -9,7 +9,7 @@
"directory": "packages/eslint-config-next"
},
"dependencies": {
"@next/eslint-plugin-next": "12.1.6-canary.6",
"@next/eslint-plugin-next": "12.1.6-canary.7",
"@rushstack/eslint-patch": "1.0.8",
"@typescript-eslint/parser": "5.19.0",
"eslint-import-resolver-node": "0.3.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/eslint-plugin-next",
"version": "12.1.6-canary.6",
"version": "12.1.6-canary.7",
"description": "ESLint plugin for NextJS.",
"main": "lib/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "12.1.6-canary.6",
"version": "12.1.6-canary.7",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/codemod",
"version": "12.1.6-canary.6",
"version": "12.1.6-canary.7",
"license": "MIT",
"dependencies": {
"chalk": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-env/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/env",
"version": "12.1.6-canary.6",
"version": "12.1.6-canary.7",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "12.1.6-canary.6",
"version": "12.1.6-canary.7",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-storybook",
"version": "12.1.6-canary.6",
"version": "12.1.6-canary.7",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-storybook"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-module/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-module",
"version": "12.1.6-canary.6",
"version": "12.1.6-canary.7",
"description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)",
"main": "dist/polyfill-module.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "12.1.6-canary.6",
"version": "12.1.6-canary.7",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/swc",
"version": "12.1.6-canary.6",
"version": "12.1.6-canary.7",
"private": true,
"scripts": {
"build-native": "napi build --platform --cargo-name next_swc_napi native",
Expand Down
14 changes: 7 additions & 7 deletions packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "12.1.6-canary.6",
"version": "12.1.6-canary.7",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -69,7 +69,7 @@
]
},
"dependencies": {
"@next/env": "12.1.6-canary.6",
"@next/env": "12.1.6-canary.7",
"caniuse-lite": "^1.0.30001332",
"postcss": "8.4.5",
"styled-jsx": "5.0.1"
Expand Down Expand Up @@ -117,11 +117,11 @@
"@hapi/accept": "5.0.2",
"@napi-rs/cli": "2.4.4",
"@napi-rs/triples": "1.1.0",
"@next/polyfill-module": "12.1.6-canary.6",
"@next/polyfill-nomodule": "12.1.6-canary.6",
"@next/react-dev-overlay": "12.1.6-canary.6",
"@next/react-refresh-utils": "12.1.6-canary.6",
"@next/swc": "12.1.6-canary.6",
"@next/polyfill-module": "12.1.6-canary.7",
"@next/polyfill-nomodule": "12.1.6-canary.7",
"@next/react-dev-overlay": "12.1.6-canary.7",
"@next/react-refresh-utils": "12.1.6-canary.7",
"@next/swc": "12.1.6-canary.7",
"@peculiar/webcrypto": "1.3.1",
"@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-overlay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-dev-overlay",
"version": "12.1.6-canary.6",
"version": "12.1.6-canary.7",
"description": "A development-only overlay for developing React applications.",
"repository": {
"url": "vercel/next.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@next/react-refresh-utils",
"version": "12.1.6-canary.6",
"version": "12.1.6-canary.7",
"description": "An experimental package providing utilities for React Refresh.",
"repository": {
"url": "vercel/next.js",
Expand Down

1 comment on commit 994f182

@ijjk
Copy link
Member Author

@ijjk ijjk commented on 994f182 Apr 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stats from current release

Default Build (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary v12.1.5 vercel/next.js refs/heads/canary Change
buildDuration 15s 14.9s -98ms
buildDurationCached 6.1s 6.1s -53ms
nodeModulesSize 86.9 MB 87.4 MB ⚠️ +514 kB
Page Load Tests Overall increase ✓
vercel/next.js canary v12.1.5 vercel/next.js refs/heads/canary Change
/ failed reqs 0 0
/ total time (seconds) 3.274 3.259 -0.02
/ avg req/sec 763.52 767.07 +3.55
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.396 1.383 -0.01
/error-in-render avg req/sec 1790.7 1808.11 +17.41
Client Bundles (main, webpack) Overall increase ⚠️
vercel/next.js canary v12.1.5 vercel/next.js refs/heads/canary Change
925.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42 kB 42 kB
main-HASH.js gzip 28.3 kB 28.6 kB ⚠️ +315 B
webpack-HASH.js gzip 1.44 kB 1.44 kB
Overall change 72 kB 72.3 kB ⚠️ +315 B
Legacy Client Bundles (polyfills)
vercel/next.js canary v12.1.5 vercel/next.js refs/heads/canary Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall increase ⚠️
vercel/next.js canary v12.1.5 vercel/next.js refs/heads/canary Change
_app-HASH.js gzip 1.36 kB 1.36 kB
_error-HASH.js gzip 192 B 192 B
amp-HASH.js gzip 309 B 309 B
css-HASH.js gzip 327 B 327 B
dynamic-HASH.js gzip 3.05 kB 3.04 kB -10 B
head-HASH.js gzip 351 B 351 B
hooks-HASH.js gzip 920 B 920 B
image-HASH.js gzip 5.73 kB 5.73 kB ⚠️ +4 B
index-HASH.js gzip 263 B 263 B
link-HASH.js gzip 2.36 kB 2.63 kB ⚠️ +265 B
routerDirect..HASH.js gzip 320 B 320 B
script-HASH.js gzip 392 B 392 B
withRouter-HASH.js gzip 319 B 319 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 16 kB 16.3 kB ⚠️ +259 B
Client Build Manifests Overall increase ⚠️
vercel/next.js canary v12.1.5 vercel/next.js refs/heads/canary Change
_buildManifest.js gzip 460 B 461 B ⚠️ +1 B
Overall change 460 B 461 B ⚠️ +1 B
Rendered Page Sizes
vercel/next.js canary v12.1.5 vercel/next.js refs/heads/canary Change
index.html gzip 532 B 533 B ⚠️ +1 B
link.html gzip 546 B 546 B
withRouter.html gzip 527 B 526 B -1 B
Overall change 1.6 kB 1.6 kB

Diffs

Diff for _buildManifest.js
@@ -8,12 +8,12 @@ self.__BUILD_MANIFEST = {
     "static\u002Fchunks\u002Fpages\u002Fcss-f8d6ff68a6e8b080.js"
   ],
   "/dynamic": [
-    "static\u002Fchunks\u002Fpages\u002Fdynamic-f3793288d6fe105a.js"
+    "static\u002Fchunks\u002Fpages\u002Fdynamic-2fc05fc466ebee90.js"
   ],
   "/head": ["static\u002Fchunks\u002Fpages\u002Fhead-96a5d6ed07cf5a83.js"],
   "/hooks": ["static\u002Fchunks\u002Fpages\u002Fhooks-9dfe734f583d4926.js"],
-  "/image": ["static\u002Fchunks\u002Fpages\u002Fimage-5597cb692d5dcc6b.js"],
-  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-c605640c895e01ab.js"],
+  "/image": ["static\u002Fchunks\u002Fpages\u002Fimage-4ebd299a1253d245.js"],
+  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-5b526b867abc83fc.js"],
   "/routerDirect": [
     "static\u002Fchunks\u002Fpages\u002FrouterDirect-98eb70bf22fb21da.js"
   ],
Diff for dynamic-HASH.js
@@ -633,10 +633,10 @@
       __webpack_require__
     ) {
       var __dirname = "/";
-      (() => {
+      (function() {
         "use strict";
         var e = {
-          800: e => {
+          800: function(e) {
             /*
 object-assign
 (c) Sindre Sorhus
@@ -713,7 +713,7 @@ object-assign
                   return i;
                 };
           },
-          569: (e, r, t) => {
+          569: function(e, r, t) {
             /** @license React vundefined
              * use-subscription.development.js
              *
@@ -725,7 +725,7 @@ object-assign
             if (false) {
             }
           },
-          403: (e, r, t) => {
+          403: function(e, r, t) {
             /** @license React vundefined
              * use-subscription.production.min.js
              *
@@ -775,13 +775,13 @@ object-assign
               return a;
             };
           },
-          138: (e, r, t) => {
+          138: function(e, r, t) {
             if (true) {
               e.exports = t(403);
             } else {
             }
           },
-          522: e => {
+          522: function(e) {
             e.exports = __webpack_require__(7294);
           }
         };
Diff for image-HASH.js
@@ -149,7 +149,6 @@
           objectFit = _param.objectFit,
           objectPosition = _param.objectPosition,
           onLoadingComplete = _param.onLoadingComplete,
-          onError = _param.onError,
           _placeholder = _param.placeholder,
           placeholder = _placeholder === void 0 ? "empty" : _placeholder,
           blurDataURL = _param.blurDataURL,
@@ -169,7 +168,6 @@
             "objectFit",
             "objectPosition",
             "onLoadingComplete",
-            "onError",
             "placeholder",
             "blurDataURL"
           ]);
@@ -893,6 +891,7 @@
           onLoadingCompleteRef = _param.onLoadingCompleteRef,
           setBlurComplete = _param.setBlurComplete,
           setIntersection = _param.setIntersection,
+          onLoad = _param.onLoad,
           onError = _param.onError,
           isVisible = _param.isVisible,
           rest = _objectWithoutProperties(_param, [
@@ -914,6 +913,7 @@
             "onLoadingCompleteRef",
             "setBlurComplete",
             "setIntersection",
+            "onLoad",
             "onError",
             "isVisible"
           ]);
@@ -972,6 +972,9 @@
                     onLoadingCompleteRef,
                     setBlurComplete
                   );
+                  if (onLoad) {
+                    onLoad(event);
+                  }
                 },
                 onError: function(event) {
                   if (placeholder === "blur") {
Diff for link-HASH.js
@@ -105,6 +105,34 @@
               default: obj
             };
       }
+      function _objectWithoutProperties(source, excluded) {
+        if (source == null) return {};
+        var target = _objectWithoutPropertiesLoose(source, excluded);
+        var key, i;
+        if (Object.getOwnPropertySymbols) {
+          var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
+          for (i = 0; i < sourceSymbolKeys.length; i++) {
+            key = sourceSymbolKeys[i];
+            if (excluded.indexOf(key) >= 0) continue;
+            if (!Object.prototype.propertyIsEnumerable.call(source, key))
+              continue;
+            target[key] = source[key];
+          }
+        }
+        return target;
+      }
+      function _objectWithoutPropertiesLoose(source, excluded) {
+        if (source == null) return {};
+        var target = {};
+        var sourceKeys = Object.keys(source);
+        var key, i;
+        for (i = 0; i < sourceKeys.length; i++) {
+          key = sourceKeys[i];
+          if (excluded.indexOf(key) >= 0) continue;
+          target[key] = source[key];
+        }
+        return target;
+      }
       var prefetched = {};
       function prefetch(router, href, as, options) {
         if (false || !router) return;
@@ -164,6 +192,11 @@
         });
       }
       function Link(props) {
+        var _legacyBehavior = props.legacyBehavior,
+          legacyBehavior =
+            _legacyBehavior === void 0
+              ? Boolean(false) !== true
+              : _legacyBehavior;
         if (false) {
           var hasWarned,
             optionalProps,
@@ -172,48 +205,72 @@
             requiredPropsGuard,
             createPropError;
         }
-        var p = props.prefetch !== false;
+        var children;
+        var hrefProp = props.href,
+          asProp = props.as,
+          childrenProp = props.children,
+          prefetchProp = props.prefetch,
+          passHref = props.passHref,
+          replace = props.replace,
+          shallow = props.shallow,
+          scroll = props.scroll,
+          locale = props.locale,
+          onClick = props.onClick,
+          onMouseEnter = props.onMouseEnter,
+          restProps = _objectWithoutProperties(props, [
+            "href",
+            "as",
+            "children",
+            "prefetch",
+            "passHref",
+            "replace",
+            "shallow",
+            "scroll",
+            "locale",
+            "onClick",
+            "onMouseEnter"
+          ]);
+        children = childrenProp;
+        if (legacyBehavior && typeof children === "string") {
+          children = /*#__PURE__*/ _react.default.createElement(
+            "a",
+            null,
+            children
+          );
+        }
+        var p = prefetchProp !== false;
         var router = (0, _router1).useRouter();
         var ref2 = _react.default.useMemo(
             function() {
               var ref = _slicedToArray(
-                  (0, _router).resolveHref(router, props.href, true),
+                  (0, _router).resolveHref(router, hrefProp, true),
                   2
                 ),
                 resolvedHref = ref[0],
                 resolvedAs = ref[1];
               return {
                 href: resolvedHref,
-                as: props.as
-                  ? (0, _router).resolveHref(router, props.as)
+                as: asProp
+                  ? (0, _router).resolveHref(router, asProp)
                   : resolvedAs || resolvedHref
               };
             },
-            [router, props.href, props.as]
+            [router, hrefProp, asProp]
           ),
           href = ref2.href,
           as = ref2.as;
         var previousHref = _react.default.useRef(href);
         var previousAs = _react.default.useRef(as);
-        var children = props.children,
-          replace = props.replace,
-          shallow = props.shallow,
-          scroll = props.scroll,
-          locale = props.locale;
-        if (typeof children === "string") {
-          children = /*#__PURE__*/ _react.default.createElement(
-            "a",
-            null,
-            children
-          );
-        }
         // This will return the first child, if multiple are provided it will throw an error
         var child;
-        if (false) {
-        } else {
-          child = _react.default.Children.only(children);
+        if (legacyBehavior) {
+          if (false) {
+          } else {
+            child = _react.default.Children.only(children);
+          }
         }
-        var childRef = child && typeof child === "object" && child.ref;
+        var childRef =
+          legacyBehavior && child && typeof child === "object" && child.ref;
         var ref1 = _slicedToArray(
             (0, _useIntersection).useIntersection({
               rootMargin: "200px"
@@ -232,14 +289,14 @@
               previousHref.current = href;
             }
             setIntersectionRef(el);
-            if (childRef) {
+            if (legacyBehavior && childRef) {
               if (typeof childRef === "function") childRef(el);
               else if (typeof childRef === "object") {
                 childRef.current = el;
               }
             }
           },
-          [as, childRef, href, resetVisible, setIntersectionRef]
+          [as, childRef, href, resetVisible, setIntersectionRef, legacyBehavior]
         );
         _react.default.useEffect(
           function() {
@@ -262,7 +319,14 @@
           onClick: function(e) {
             if (false) {
             }
-            if (child.props && typeof child.props.onClick === "function") {
+            if (!legacyBehavior && typeof onClick === "function") {
+              onClick(e);
+            }
+            if (
+              legacyBehavior &&
+              child.props &&
+              typeof child.props.onClick === "function"
+            ) {
               child.props.onClick(e);
             }
             if (!e.defaultPrevented) {
@@ -277,22 +341,30 @@
                 locale
               );
             }
-          }
-        };
-        childProps.onMouseEnter = function(e) {
-          if (child.props && typeof child.props.onMouseEnter === "function") {
-            child.props.onMouseEnter(e);
-          }
-          if ((0, _router).isLocalURL(href)) {
-            prefetch(router, href, as, {
-              priority: true
-            });
+          },
+          onMouseEnter: function(e) {
+            if (!legacyBehavior && typeof onMouseEnter === "function") {
+              onMouseEnter(e);
+            }
+            if (
+              legacyBehavior &&
+              child.props &&
+              typeof child.props.onMouseEnter === "function"
+            ) {
+              child.props.onMouseEnter(e);
+            }
+            if ((0, _router).isLocalURL(href)) {
+              prefetch(router, href, as, {
+                priority: true
+              });
+            }
           }
         };
         // If child is an <a> tag and doesn't have a href attribute, or if the 'passHref' property is
         // defined, we specify the current 'href', so that repetition is not needed by the user
         if (
-          props.passHref ||
+          !legacyBehavior ||
+          passHref ||
           (child.type === "a" && !("href" in child.props))
         ) {
           var curLocale1 =
@@ -318,7 +390,13 @@
               )
             );
         }
-        return /*#__PURE__*/ _react.default.cloneElement(child, childProps);
+        return legacyBehavior
+          ? /*#__PURE__*/ _react.default.cloneElement(child, childProps)
+          : /*#__PURE__*/ _react.default.createElement(
+              "a",
+              Object.assign({}, restProps, childProps),
+              children
+            );
       }
       var _default = Link;
       exports["default"] = _default;
Diff for main-HASH.js
@@ -627,7 +627,7 @@
         }
         return target;
       }
-      var version = "12.1.5";
+      var version = "12.1.6-canary.7";
       exports.version = version;
       var router;
       exports.router = router;
@@ -2875,6 +2875,16 @@
       function _arrayWithHoles(arr) {
         if (Array.isArray(arr)) return arr;
       }
+      function _arrayWithoutHoles(arr) {
+        if (Array.isArray(arr)) return _arrayLikeToArray(arr);
+      }
+      function _iterableToArray(iter) {
+        if (
+          (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null) ||
+          iter["@@iterator"] != null
+        )
+          return Array.from(iter);
+      }
       function _iterableToArrayLimit(arr, i) {
         var _i =
           arr == null
@@ -2908,6 +2918,11 @@
           "Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
         );
       }
+      function _nonIterableSpread() {
+        throw new TypeError(
+          "Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
+        );
+      }
       function _slicedToArray(arr, i) {
         return (
           _arrayWithHoles(arr) ||
@@ -2916,6 +2931,14 @@
           _nonIterableRest()
         );
       }
+      function _toConsumableArray(arr) {
+        return (
+          _arrayWithoutHoles(arr) ||
+          _iterableToArray(arr) ||
+          _unsupportedIterableToArray(arr) ||
+          _nonIterableSpread()
+        );
+      }
       function _unsupportedIterableToArray(o, minLen) {
         if (!o) return;
         if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -2931,6 +2954,7 @@
       Object.defineProperty(exports, "__esModule", {
         value: true
       });
+      exports.handleClientScriptLoad = handleClientScriptLoad;
       exports.initScriptLoader = initScriptLoader;
       exports["default"] = void 0;
       var _react = _interopRequireWildcard(__webpack_require__(7294));
@@ -3129,14 +3153,14 @@
       function handleClientScriptLoad(props) {
         var _strategy = props.strategy,
           strategy = _strategy === void 0 ? "afterInteractive" : _strategy;
-        if (strategy === "afterInteractive") {
-          loadScript(props);
-        } else if (strategy === "lazyOnload") {
+        if (strategy === "lazyOnload") {
           window.addEventListener("load", function() {
             (0, _requestIdleCallback).requestIdleCallback(function() {
               return loadScript(props);
             });
           });
+        } else {
+          loadScript(props);
         }
       }
       function loadLazyScript(props) {
@@ -3152,8 +3176,22 @@
           });
         }
       }
+      function addBeforeInteractiveToCache() {
+        var scripts = _toConsumableArray(
+          document.querySelectorAll('[data-nscript="beforeInteractive"]')
+        ).concat(
+          _toConsumableArray(
+            document.querySelectorAll('[data-nscript="beforePageRender"]')
+          )
+        );
+        scripts.forEach(function(script) {
+          var cacheKey = script.id || script.getAttribute("src");
+          LoadCache.add(cacheKey);
+        });
+      }
       function initScriptLoader(scriptLoaderItems) {
         scriptLoaderItems.forEach(handleClientScriptLoad);
+        addBeforeInteractiveToCache();
       }
       function Script(props) {
         var _src = props.src,
@@ -3516,30 +3554,31 @@
                 {
                   style: styles.error
                 },
-                true &&
+                /*#__PURE__*/ _react.default.createElement(
+                  _head.default,
+                  null,
                   /*#__PURE__*/ _react.default.createElement(
-                    _head.default,
+                    "title",
                     null,
-                    /*#__PURE__*/ _react.default.createElement(
-                      "title",
-                      null,
-                      statusCode
-                        ? "".concat(statusCode, ": ").concat(title)
-                        : "Application error: a client-side exception has occurred"
-                    )
-                  ),
+                    statusCode
+                      ? "".concat(statusCode, ": ").concat(title)
+                      : "Application error: a client-side exception has occurred"
+                  )
+                ),
                 /*#__PURE__*/ _react.default.createElement(
                   "div",
                   null,
                   /*#__PURE__*/ _react.default.createElement("style", {
                     dangerouslySetInnerHTML: {
-                      __html: "body { margin: 0 }"
+                      __html:
+                        "\n                body { margin: 0; color: #000; background: #fff; }\n                .next-error-h1 {\n                  border-right: 1px solid rgba(0, 0, 0, .3);\n                }\n                @media (prefers-color-scheme: dark) {\n                  body { color: #fff; background: #000; }\n                  .next-error-h1 {\n                    border-right: 1px solid rgba(255, 255, 255, .3);\n                  }\n                }"
                     }
                   }),
                   statusCode
                     ? /*#__PURE__*/ _react.default.createElement(
                         "h1",
                         {
+                          className: "next-error-h1",
                           style: styles.h1
                         },
                         statusCode
@@ -3578,8 +3617,6 @@
       Error.origGetInitialProps = _getInitialProps;
       var styles = {
         error: {
-          color: "#000",
-          background: "#fff",
           fontFamily:
             '-apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", "Fira Sans", Avenir, "Helvetica Neue", "Lucida Grande", sans-serif',
           height: "100vh",
@@ -3598,7 +3635,6 @@
         },
         h1: {
           display: "inline-block",
-          borderRight: "1px solid rgba(0, 0, 0,.3)",
           margin: 0,
           marginRight: "20px",
           padding: "10px 23px 10px 0",
@@ -3694,8 +3730,15 @@
         value: true
       });
       exports.escapeStringRegexp = escapeStringRegexp;
+      // regexp is based on https://github.com/sindresorhus/escape-string-regexp
+      var reHasRegExp = /[|\\{}()[\]^$+*?.-]/;
+      var reReplaceRegExp = /[|\\{}()[\]^$+*?.-]/g;
       function escapeStringRegexp(str) {
-        return str.replace(/[|\\{}()[\]^$+*?.-]/g, "\\$&");
+        // see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23
+        if (reHasRegExp.test(str)) {
+          return str.replace(reReplaceRegExp, "\\$&");
+        }
+        return str;
       } //# sourceMappingURL=escape-regexp.js.map
 
       /***/
@@ -4397,6 +4440,7 @@
       exports["default"] = void 0;
       var _normalizeTrailingSlash = __webpack_require__(2700);
       var _routeLoader = __webpack_require__(2497);
+      var _script = __webpack_require__(3573);
       var _isError = _interopRequireWildcard(__webpack_require__(676));
       var _denormalizePagePath = __webpack_require__(4522);
       var _normalizeLocalePath = __webpack_require__(4769);
@@ -5066,6 +5110,8 @@
                     props,
                     __N_SSG,
                     __N_SSP,
+                    component,
+                    scripts,
                     destination,
                     parsedHref,
                     ref3,
@@ -5559,14 +5605,25 @@
                               (props = routeInfo.props),
                               (__N_SSG = routeInfo.__N_SSG),
                               (__N_SSP = routeInfo.__N_SSP);
+                            component = routeInfo.Component;
+                            if (component && component.unstable_scriptLoader) {
+                              scripts = [].concat(
+                                component.unstable_scriptLoader()
+                              );
+                              scripts.forEach(function(script) {
+                                (0, _script).handleClientScriptLoad(
+                                  script.props
+                                );
+                              });
+                            }
                             if (!((__N_SSG || __N_SSP) && props)) {
-                              _ctx.next = 144;
+                              _ctx.next = 146;
                               break;
                             }
                             if (
                               !(props.pageProps && props.pageProps.__N_REDIRECT)
                             ) {
-                              _ctx.next = 129;
+                              _ctx.next = 131;
                               break;
                             }
                             destination = props.pageProps.__N_REDIRECT;
@@ -5576,7 +5633,7 @@
                                 props.pageProps.__N_REDIRECT_BASE_PATH !== false
                               )
                             ) {
-                              _ctx.next = 127;
+                              _ctx.next = 129;
                               break;
                             }
                             parsedHref = (0,
@@ -5596,31 +5653,31 @@
                               "return",
                               _this.change(method, newUrl, newAs, options)
                             );
-                          case 127:
+                          case 129:
                             window.location.href = destination;
                             return _ctx.abrupt(
                               "return",
                               new Promise(function() {})
                             );
-                          case 129:
+                          case 131:
                             nextState.isPreview = !!props.__N_PREVIEW;
                             if (!(props.notFound === SSG_DATA_NOT_FOUND)) {
-                              _ctx.next = 144;
+                              _ctx.next = 146;
                               break;
                             }
-                            _ctx.prev = 132;
-                            _ctx.next = 135;
+                            _ctx.prev = 134;
+                            _ctx.next = 137;
                             return _this.fetchComponent("/404");
-                          case 135:
+                          case 137:
                             notFoundRoute = "/404";
-                            _ctx.next = 141;
+                            _ctx.next = 143;
                             break;
-                          case 138:
-                            _ctx.prev = 138;
-                            _ctx.t3 = _ctx["catch"](132);
+                          case 140:
+                            _ctx.prev = 140;
+                            _ctx.t3 = _ctx["catch"](134);
                             notFoundRoute = "/_error";
-                          case 141:
-                            _ctx.next = 143;
+                          case 143:
+                            _ctx.next = 145;
                             return _this.getRouteInfo(
                               notFoundRoute,
                               notFoundRoute,
@@ -5633,9 +5690,9 @@
                               nextState.locale,
                               nextState.isPreview
                             );
-                          case 143:
+                          case 145:
                             routeInfo = _ctx.sent;
-                          case 144:
+                          case 146:
                             Router.events.emit(
                               "beforeHistoryChange",
                               as,
@@ -5673,7 +5730,7 @@
                                   y: 0
                                 }
                               : null;
-                            _ctx.next = 153;
+                            _ctx.next = 155;
                             return _this
                               .set(
                                 _objectSpread({}, nextState, {
@@ -5692,9 +5749,9 @@
                                 if (e.cancelled) error = error || e;
                                 else throw e;
                               });
-                          case 153:
+                          case 155:
                             if (!error) {
-                              _ctx.next = 156;
+                              _ctx.next = 158;
                               break;
                             }
                             Router.events.emit(
@@ -5704,7 +5761,7 @@
                               routeProps
                             );
                             throw error;
-                          case 156:
+                          case 158:
                             if (false) {
                             }
                             Router.events.emit(
@@ -5713,8 +5770,8 @@
                               routeProps
                             );
                             return _ctx.abrupt("return", true);
-                          case 161:
-                            _ctx.prev = 161;
+                          case 163:
+                            _ctx.prev = 163;
                             _ctx.t4 = _ctx["catch"](113);
                             if (
                               !(
@@ -5722,13 +5779,13 @@
                                 _ctx.t4.cancelled
                               )
                             ) {
-                              _ctx.next = 165;
+                              _ctx.next = 167;
                               break;
                             }
                             return _ctx.abrupt("return", false);
-                          case 165:
+                          case 167:
                             throw _ctx.t4;
-                          case 166:
+                          case 168:
                           case "end":
                             return _ctx.stop();
                         }
@@ -5737,8 +5794,8 @@
                     null,
                     [
                       [39, 51],
-                      [113, 161],
-                      [132, 138]
+                      [113, 163],
+                      [134, 140]
                     ]
                   );
                 })
Diff for index.html
@@ -19,7 +19,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-d49dd75f151b9b34.js"
+      src="/_next/static/chunks/main-281ff28f99ec8d26.js"
       defer=""
     ></script>
     <script
Diff for link.html
@@ -19,7 +19,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-d49dd75f151b9b34.js"
+      src="/_next/static/chunks/main-281ff28f99ec8d26.js"
       defer=""
     ></script>
     <script
@@ -27,7 +27,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-c605640c895e01ab.js"
+      src="/_next/static/chunks/pages/link-5b526b867abc83fc.js"
       defer=""
     ></script>
     <script src="/_next/static/BUILD_ID/_buildManifest.js" defer=""></script>
Diff for withRouter.html
@@ -19,7 +19,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-d49dd75f151b9b34.js"
+      src="/_next/static/chunks/main-281ff28f99ec8d26.js"
       defer=""
     ></script>
     <script

Default Build with SWC (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary v12.1.5 vercel/next.js refs/heads/canary Change
buildDuration 12.2s 12.2s -50ms
buildDurationCached 6.2s 6.2s -30ms
nodeModulesSize 86.9 MB 87.4 MB ⚠️ +514 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary v12.1.5 vercel/next.js refs/heads/canary Change
/ failed reqs 0 0
/ total time (seconds) 3.237 3.257 ⚠️ +0.02
/ avg req/sec 772.24 767.57 ⚠️ -4.67
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.381 1.402 ⚠️ +0.02
/error-in-render avg req/sec 1810.53 1783.4 ⚠️ -27.13
Client Bundles (main, webpack) Overall increase ⚠️
vercel/next.js canary v12.1.5 vercel/next.js refs/heads/canary Change
925.HASH.js gzip 178 B 178 B
framework-HASH.js gzip 42.2 kB 42.2 kB
main-HASH.js gzip 28.7 kB 29.1 kB ⚠️ +358 B
webpack-HASH.js gzip 1.45 kB 1.45 kB
Overall change 72.6 kB 72.9 kB ⚠️ +358 B
Legacy Client Bundles (polyfills)
vercel/next.js canary v12.1.5 vercel/next.js refs/heads/canary Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages Overall increase ⚠️
vercel/next.js canary v12.1.5 vercel/next.js refs/heads/canary Change
_app-HASH.js gzip 1.35 kB 1.35 kB
_error-HASH.js gzip 179 B 179 B
amp-HASH.js gzip 313 B 313 B
css-HASH.js gzip 325 B 325 B
dynamic-HASH.js gzip 3.03 kB 3.02 kB -2 B
head-HASH.js gzip 351 B 351 B
hooks-HASH.js gzip 921 B 921 B
image-HASH.js gzip 5.78 kB 5.78 kB ⚠️ +3 B
index-HASH.js gzip 261 B 261 B
link-HASH.js gzip 2.44 kB 2.74 kB ⚠️ +305 B
routerDirect..HASH.js gzip 322 B 322 B
script-HASH.js gzip 393 B 393 B
withRouter-HASH.js gzip 317 B 317 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 16.1 kB 16.4 kB ⚠️ +306 B
Client Build Manifests Overall decrease ✓
vercel/next.js canary v12.1.5 vercel/next.js refs/heads/canary Change
_buildManifest.js gzip 459 B 457 B -2 B
Overall change 459 B 457 B -2 B
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary v12.1.5 vercel/next.js refs/heads/canary Change
index.html gzip 529 B 530 B ⚠️ +1 B
link.html gzip 542 B 542 B
withRouter.html gzip 524 B 525 B ⚠️ +1 B
Overall change 1.59 kB 1.6 kB ⚠️ +2 B

Diffs

Diff for _buildManifest.js
@@ -8,12 +8,12 @@ self.__BUILD_MANIFEST = {
     "static\u002Fchunks\u002Fpages\u002Fcss-f8d6ff68a6e8b080.js"
   ],
   "/dynamic": [
-    "static\u002Fchunks\u002Fpages\u002Fdynamic-f3793288d6fe105a.js"
+    "static\u002Fchunks\u002Fpages\u002Fdynamic-2fc05fc466ebee90.js"
   ],
   "/head": ["static\u002Fchunks\u002Fpages\u002Fhead-96a5d6ed07cf5a83.js"],
   "/hooks": ["static\u002Fchunks\u002Fpages\u002Fhooks-9dfe734f583d4926.js"],
-  "/image": ["static\u002Fchunks\u002Fpages\u002Fimage-5597cb692d5dcc6b.js"],
-  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-c605640c895e01ab.js"],
+  "/image": ["static\u002Fchunks\u002Fpages\u002Fimage-4ebd299a1253d245.js"],
+  "/link": ["static\u002Fchunks\u002Fpages\u002Flink-5b526b867abc83fc.js"],
   "/routerDirect": [
     "static\u002Fchunks\u002Fpages\u002FrouterDirect-98eb70bf22fb21da.js"
   ],
Diff for dynamic-HASH.js
@@ -633,10 +633,10 @@
       __webpack_require__
     ) {
       var __dirname = "/";
-      (() => {
+      (function() {
         "use strict";
         var e = {
-          800: e => {
+          800: function(e) {
             /*
 object-assign
 (c) Sindre Sorhus
@@ -713,7 +713,7 @@ object-assign
                   return i;
                 };
           },
-          569: (e, r, t) => {
+          569: function(e, r, t) {
             /** @license React vundefined
              * use-subscription.development.js
              *
@@ -725,7 +725,7 @@ object-assign
             if (false) {
             }
           },
-          403: (e, r, t) => {
+          403: function(e, r, t) {
             /** @license React vundefined
              * use-subscription.production.min.js
              *
@@ -775,13 +775,13 @@ object-assign
               return a;
             };
           },
-          138: (e, r, t) => {
+          138: function(e, r, t) {
             if (true) {
               e.exports = t(403);
             } else {
             }
           },
-          522: e => {
+          522: function(e) {
             e.exports = __webpack_require__(7294);
           }
         };
Diff for image-HASH.js
@@ -149,7 +149,6 @@
           objectFit = _param.objectFit,
           objectPosition = _param.objectPosition,
           onLoadingComplete = _param.onLoadingComplete,
-          onError = _param.onError,
           _placeholder = _param.placeholder,
           placeholder = _placeholder === void 0 ? "empty" : _placeholder,
           blurDataURL = _param.blurDataURL,
@@ -169,7 +168,6 @@
             "objectFit",
             "objectPosition",
             "onLoadingComplete",
-            "onError",
             "placeholder",
             "blurDataURL"
           ]);
@@ -893,6 +891,7 @@
           onLoadingCompleteRef = _param.onLoadingCompleteRef,
           setBlurComplete = _param.setBlurComplete,
           setIntersection = _param.setIntersection,
+          onLoad = _param.onLoad,
           onError = _param.onError,
           isVisible = _param.isVisible,
           rest = _objectWithoutProperties(_param, [
@@ -914,6 +913,7 @@
             "onLoadingCompleteRef",
             "setBlurComplete",
             "setIntersection",
+            "onLoad",
             "onError",
             "isVisible"
           ]);
@@ -972,6 +972,9 @@
                     onLoadingCompleteRef,
                     setBlurComplete
                   );
+                  if (onLoad) {
+                    onLoad(event);
+                  }
                 },
                 onError: function(event) {
                   if (placeholder === "blur") {
Diff for link-HASH.js
@@ -105,6 +105,34 @@
               default: obj
             };
       }
+      function _objectWithoutProperties(source, excluded) {
+        if (source == null) return {};
+        var target = _objectWithoutPropertiesLoose(source, excluded);
+        var key, i;
+        if (Object.getOwnPropertySymbols) {
+          var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
+          for (i = 0; i < sourceSymbolKeys.length; i++) {
+            key = sourceSymbolKeys[i];
+            if (excluded.indexOf(key) >= 0) continue;
+            if (!Object.prototype.propertyIsEnumerable.call(source, key))
+              continue;
+            target[key] = source[key];
+          }
+        }
+        return target;
+      }
+      function _objectWithoutPropertiesLoose(source, excluded) {
+        if (source == null) return {};
+        var target = {};
+        var sourceKeys = Object.keys(source);
+        var key, i;
+        for (i = 0; i < sourceKeys.length; i++) {
+          key = sourceKeys[i];
+          if (excluded.indexOf(key) >= 0) continue;
+          target[key] = source[key];
+        }
+        return target;
+      }
       var prefetched = {};
       function prefetch(router, href, as, options) {
         if (false || !router) return;
@@ -164,6 +192,11 @@
         });
       }
       function Link(props) {
+        var _legacyBehavior = props.legacyBehavior,
+          legacyBehavior =
+            _legacyBehavior === void 0
+              ? Boolean(false) !== true
+              : _legacyBehavior;
         if (false) {
           var hasWarned,
             optionalProps,
@@ -172,48 +205,72 @@
             requiredPropsGuard,
             createPropError;
         }
-        var p = props.prefetch !== false;
+        var children;
+        var hrefProp = props.href,
+          asProp = props.as,
+          childrenProp = props.children,
+          prefetchProp = props.prefetch,
+          passHref = props.passHref,
+          replace = props.replace,
+          shallow = props.shallow,
+          scroll = props.scroll,
+          locale = props.locale,
+          onClick = props.onClick,
+          onMouseEnter = props.onMouseEnter,
+          restProps = _objectWithoutProperties(props, [
+            "href",
+            "as",
+            "children",
+            "prefetch",
+            "passHref",
+            "replace",
+            "shallow",
+            "scroll",
+            "locale",
+            "onClick",
+            "onMouseEnter"
+          ]);
+        children = childrenProp;
+        if (legacyBehavior && typeof children === "string") {
+          children = /*#__PURE__*/ _react.default.createElement(
+            "a",
+            null,
+            children
+          );
+        }
+        var p = prefetchProp !== false;
         var router = (0, _router1).useRouter();
         var ref2 = _react.default.useMemo(
             function() {
               var ref = _slicedToArray(
-                  (0, _router).resolveHref(router, props.href, true),
+                  (0, _router).resolveHref(router, hrefProp, true),
                   2
                 ),
                 resolvedHref = ref[0],
                 resolvedAs = ref[1];
               return {
                 href: resolvedHref,
-                as: props.as
-                  ? (0, _router).resolveHref(router, props.as)
+                as: asProp
+                  ? (0, _router).resolveHref(router, asProp)
                   : resolvedAs || resolvedHref
               };
             },
-            [router, props.href, props.as]
+            [router, hrefProp, asProp]
           ),
           href = ref2.href,
           as = ref2.as;
         var previousHref = _react.default.useRef(href);
         var previousAs = _react.default.useRef(as);
-        var children = props.children,
-          replace = props.replace,
-          shallow = props.shallow,
-          scroll = props.scroll,
-          locale = props.locale;
-        if (typeof children === "string") {
-          children = /*#__PURE__*/ _react.default.createElement(
-            "a",
-            null,
-            children
-          );
-        }
         // This will return the first child, if multiple are provided it will throw an error
         var child;
-        if (false) {
-        } else {
-          child = _react.default.Children.only(children);
+        if (legacyBehavior) {
+          if (false) {
+          } else {
+            child = _react.default.Children.only(children);
+          }
         }
-        var childRef = child && typeof child === "object" && child.ref;
+        var childRef =
+          legacyBehavior && child && typeof child === "object" && child.ref;
         var ref1 = _slicedToArray(
             (0, _useIntersection).useIntersection({
               rootMargin: "200px"
@@ -232,14 +289,14 @@
               previousHref.current = href;
             }
             setIntersectionRef(el);
-            if (childRef) {
+            if (legacyBehavior && childRef) {
               if (typeof childRef === "function") childRef(el);
               else if (typeof childRef === "object") {
                 childRef.current = el;
               }
             }
           },
-          [as, childRef, href, resetVisible, setIntersectionRef]
+          [as, childRef, href, resetVisible, setIntersectionRef, legacyBehavior]
         );
         _react.default.useEffect(
           function() {
@@ -262,7 +319,14 @@
           onClick: function(e) {
             if (false) {
             }
-            if (child.props && typeof child.props.onClick === "function") {
+            if (!legacyBehavior && typeof onClick === "function") {
+              onClick(e);
+            }
+            if (
+              legacyBehavior &&
+              child.props &&
+              typeof child.props.onClick === "function"
+            ) {
               child.props.onClick(e);
             }
             if (!e.defaultPrevented) {
@@ -277,22 +341,30 @@
                 locale
               );
             }
-          }
-        };
-        childProps.onMouseEnter = function(e) {
-          if (child.props && typeof child.props.onMouseEnter === "function") {
-            child.props.onMouseEnter(e);
-          }
-          if ((0, _router).isLocalURL(href)) {
-            prefetch(router, href, as, {
-              priority: true
-            });
+          },
+          onMouseEnter: function(e) {
+            if (!legacyBehavior && typeof onMouseEnter === "function") {
+              onMouseEnter(e);
+            }
+            if (
+              legacyBehavior &&
+              child.props &&
+              typeof child.props.onMouseEnter === "function"
+            ) {
+              child.props.onMouseEnter(e);
+            }
+            if ((0, _router).isLocalURL(href)) {
+              prefetch(router, href, as, {
+                priority: true
+              });
+            }
           }
         };
         // If child is an <a> tag and doesn't have a href attribute, or if the 'passHref' property is
         // defined, we specify the current 'href', so that repetition is not needed by the user
         if (
-          props.passHref ||
+          !legacyBehavior ||
+          passHref ||
           (child.type === "a" && !("href" in child.props))
         ) {
           var curLocale1 =
@@ -318,7 +390,13 @@
               )
             );
         }
-        return /*#__PURE__*/ _react.default.cloneElement(child, childProps);
+        return legacyBehavior
+          ? /*#__PURE__*/ _react.default.cloneElement(child, childProps)
+          : /*#__PURE__*/ _react.default.createElement(
+              "a",
+              Object.assign({}, restProps, childProps),
+              children
+            );
       }
       var _default = Link;
       exports["default"] = _default;
Diff for main-HASH.js
@@ -627,7 +627,7 @@
         }
         return target;
       }
-      var version = "12.1.5";
+      var version = "12.1.6-canary.7";
       exports.version = version;
       var router;
       exports.router = router;
@@ -2875,6 +2875,16 @@
       function _arrayWithHoles(arr) {
         if (Array.isArray(arr)) return arr;
       }
+      function _arrayWithoutHoles(arr) {
+        if (Array.isArray(arr)) return _arrayLikeToArray(arr);
+      }
+      function _iterableToArray(iter) {
+        if (
+          (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null) ||
+          iter["@@iterator"] != null
+        )
+          return Array.from(iter);
+      }
       function _iterableToArrayLimit(arr, i) {
         var _i =
           arr == null
@@ -2908,6 +2918,11 @@
           "Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
         );
       }
+      function _nonIterableSpread() {
+        throw new TypeError(
+          "Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
+        );
+      }
       function _slicedToArray(arr, i) {
         return (
           _arrayWithHoles(arr) ||
@@ -2916,6 +2931,14 @@
           _nonIterableRest()
         );
       }
+      function _toConsumableArray(arr) {
+        return (
+          _arrayWithoutHoles(arr) ||
+          _iterableToArray(arr) ||
+          _unsupportedIterableToArray(arr) ||
+          _nonIterableSpread()
+        );
+      }
       function _unsupportedIterableToArray(o, minLen) {
         if (!o) return;
         if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -2931,6 +2954,7 @@
       Object.defineProperty(exports, "__esModule", {
         value: true
       });
+      exports.handleClientScriptLoad = handleClientScriptLoad;
       exports.initScriptLoader = initScriptLoader;
       exports["default"] = void 0;
       var _react = _interopRequireWildcard(__webpack_require__(7294));
@@ -3129,14 +3153,14 @@
       function handleClientScriptLoad(props) {
         var _strategy = props.strategy,
           strategy = _strategy === void 0 ? "afterInteractive" : _strategy;
-        if (strategy === "afterInteractive") {
-          loadScript(props);
-        } else if (strategy === "lazyOnload") {
+        if (strategy === "lazyOnload") {
           window.addEventListener("load", function() {
             (0, _requestIdleCallback).requestIdleCallback(function() {
               return loadScript(props);
             });
           });
+        } else {
+          loadScript(props);
         }
       }
       function loadLazyScript(props) {
@@ -3152,8 +3176,22 @@
           });
         }
       }
+      function addBeforeInteractiveToCache() {
+        var scripts = _toConsumableArray(
+          document.querySelectorAll('[data-nscript="beforeInteractive"]')
+        ).concat(
+          _toConsumableArray(
+            document.querySelectorAll('[data-nscript="beforePageRender"]')
+          )
+        );
+        scripts.forEach(function(script) {
+          var cacheKey = script.id || script.getAttribute("src");
+          LoadCache.add(cacheKey);
+        });
+      }
       function initScriptLoader(scriptLoaderItems) {
         scriptLoaderItems.forEach(handleClientScriptLoad);
+        addBeforeInteractiveToCache();
       }
       function Script(props) {
         var _src = props.src,
@@ -3516,30 +3554,31 @@
                 {
                   style: styles.error
                 },
-                true &&
+                /*#__PURE__*/ _react.default.createElement(
+                  _head.default,
+                  null,
                   /*#__PURE__*/ _react.default.createElement(
-                    _head.default,
+                    "title",
                     null,
-                    /*#__PURE__*/ _react.default.createElement(
-                      "title",
-                      null,
-                      statusCode
-                        ? "".concat(statusCode, ": ").concat(title)
-                        : "Application error: a client-side exception has occurred"
-                    )
-                  ),
+                    statusCode
+                      ? "".concat(statusCode, ": ").concat(title)
+                      : "Application error: a client-side exception has occurred"
+                  )
+                ),
                 /*#__PURE__*/ _react.default.createElement(
                   "div",
                   null,
                   /*#__PURE__*/ _react.default.createElement("style", {
                     dangerouslySetInnerHTML: {
-                      __html: "body { margin: 0 }"
+                      __html:
+                        "\n                body { margin: 0; color: #000; background: #fff; }\n                .next-error-h1 {\n                  border-right: 1px solid rgba(0, 0, 0, .3);\n                }\n                @media (prefers-color-scheme: dark) {\n                  body { color: #fff; background: #000; }\n                  .next-error-h1 {\n                    border-right: 1px solid rgba(255, 255, 255, .3);\n                  }\n                }"
                     }
                   }),
                   statusCode
                     ? /*#__PURE__*/ _react.default.createElement(
                         "h1",
                         {
+                          className: "next-error-h1",
                           style: styles.h1
                         },
                         statusCode
@@ -3578,8 +3617,6 @@
       Error.origGetInitialProps = _getInitialProps;
       var styles = {
         error: {
-          color: "#000",
-          background: "#fff",
           fontFamily:
             '-apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", "Fira Sans", Avenir, "Helvetica Neue", "Lucida Grande", sans-serif',
           height: "100vh",
@@ -3598,7 +3635,6 @@
         },
         h1: {
           display: "inline-block",
-          borderRight: "1px solid rgba(0, 0, 0,.3)",
           margin: 0,
           marginRight: "20px",
           padding: "10px 23px 10px 0",
@@ -3694,8 +3730,15 @@
         value: true
       });
       exports.escapeStringRegexp = escapeStringRegexp;
+      // regexp is based on https://github.com/sindresorhus/escape-string-regexp
+      var reHasRegExp = /[|\\{}()[\]^$+*?.-]/;
+      var reReplaceRegExp = /[|\\{}()[\]^$+*?.-]/g;
       function escapeStringRegexp(str) {
-        return str.replace(/[|\\{}()[\]^$+*?.-]/g, "\\$&");
+        // see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23
+        if (reHasRegExp.test(str)) {
+          return str.replace(reReplaceRegExp, "\\$&");
+        }
+        return str;
       } //# sourceMappingURL=escape-regexp.js.map
 
       /***/
@@ -4397,6 +4440,7 @@
       exports["default"] = void 0;
       var _normalizeTrailingSlash = __webpack_require__(2700);
       var _routeLoader = __webpack_require__(2497);
+      var _script = __webpack_require__(3573);
       var _isError = _interopRequireWildcard(__webpack_require__(676));
       var _denormalizePagePath = __webpack_require__(4522);
       var _normalizeLocalePath = __webpack_require__(4769);
@@ -5066,6 +5110,8 @@
                     props,
                     __N_SSG,
                     __N_SSP,
+                    component,
+                    scripts,
                     destination,
                     parsedHref,
                     ref3,
@@ -5559,14 +5605,25 @@
                               (props = routeInfo.props),
                               (__N_SSG = routeInfo.__N_SSG),
                               (__N_SSP = routeInfo.__N_SSP);
+                            component = routeInfo.Component;
+                            if (component && component.unstable_scriptLoader) {
+                              scripts = [].concat(
+                                component.unstable_scriptLoader()
+                              );
+                              scripts.forEach(function(script) {
+                                (0, _script).handleClientScriptLoad(
+                                  script.props
+                                );
+                              });
+                            }
                             if (!((__N_SSG || __N_SSP) && props)) {
-                              _ctx.next = 144;
+                              _ctx.next = 146;
                               break;
                             }
                             if (
                               !(props.pageProps && props.pageProps.__N_REDIRECT)
                             ) {
-                              _ctx.next = 129;
+                              _ctx.next = 131;
                               break;
                             }
                             destination = props.pageProps.__N_REDIRECT;
@@ -5576,7 +5633,7 @@
                                 props.pageProps.__N_REDIRECT_BASE_PATH !== false
                               )
                             ) {
-                              _ctx.next = 127;
+                              _ctx.next = 129;
                               break;
                             }
                             parsedHref = (0,
@@ -5596,31 +5653,31 @@
                               "return",
                               _this.change(method, newUrl, newAs, options)
                             );
-                          case 127:
+                          case 129:
                             window.location.href = destination;
                             return _ctx.abrupt(
                               "return",
                               new Promise(function() {})
                             );
-                          case 129:
+                          case 131:
                             nextState.isPreview = !!props.__N_PREVIEW;
                             if (!(props.notFound === SSG_DATA_NOT_FOUND)) {
-                              _ctx.next = 144;
+                              _ctx.next = 146;
                               break;
                             }
-                            _ctx.prev = 132;
-                            _ctx.next = 135;
+                            _ctx.prev = 134;
+                            _ctx.next = 137;
                             return _this.fetchComponent("/404");
-                          case 135:
+                          case 137:
                             notFoundRoute = "/404";
-                            _ctx.next = 141;
+                            _ctx.next = 143;
                             break;
-                          case 138:
-                            _ctx.prev = 138;
-                            _ctx.t3 = _ctx["catch"](132);
+                          case 140:
+                            _ctx.prev = 140;
+                            _ctx.t3 = _ctx["catch"](134);
                             notFoundRoute = "/_error";
-                          case 141:
-                            _ctx.next = 143;
+                          case 143:
+                            _ctx.next = 145;
                             return _this.getRouteInfo(
                               notFoundRoute,
                               notFoundRoute,
@@ -5633,9 +5690,9 @@
                               nextState.locale,
                               nextState.isPreview
                             );
-                          case 143:
+                          case 145:
                             routeInfo = _ctx.sent;
-                          case 144:
+                          case 146:
                             Router.events.emit(
                               "beforeHistoryChange",
                               as,
@@ -5673,7 +5730,7 @@
                                   y: 0
                                 }
                               : null;
-                            _ctx.next = 153;
+                            _ctx.next = 155;
                             return _this
                               .set(
                                 _objectSpread({}, nextState, {
@@ -5692,9 +5749,9 @@
                                 if (e.cancelled) error = error || e;
                                 else throw e;
                               });
-                          case 153:
+                          case 155:
                             if (!error) {
-                              _ctx.next = 156;
+                              _ctx.next = 158;
                               break;
                             }
                             Router.events.emit(
@@ -5704,7 +5761,7 @@
                               routeProps
                             );
                             throw error;
-                          case 156:
+                          case 158:
                             if (false) {
                             }
                             Router.events.emit(
@@ -5713,8 +5770,8 @@
                               routeProps
                             );
                             return _ctx.abrupt("return", true);
-                          case 161:
-                            _ctx.prev = 161;
+                          case 163:
+                            _ctx.prev = 163;
                             _ctx.t4 = _ctx["catch"](113);
                             if (
                               !(
@@ -5722,13 +5779,13 @@
                                 _ctx.t4.cancelled
                               )
                             ) {
-                              _ctx.next = 165;
+                              _ctx.next = 167;
                               break;
                             }
                             return _ctx.abrupt("return", false);
-                          case 165:
+                          case 167:
                             throw _ctx.t4;
-                          case 166:
+                          case 168:
                           case "end":
                             return _ctx.stop();
                         }
@@ -5737,8 +5794,8 @@
                     null,
                     [
                       [39, 51],
-                      [113, 161],
-                      [132, 138]
+                      [113, 163],
+                      [134, 140]
                     ]
                   );
                 })
Diff for index.html
@@ -19,7 +19,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-d49dd75f151b9b34.js"
+      src="/_next/static/chunks/main-281ff28f99ec8d26.js"
       defer=""
     ></script>
     <script
Diff for link.html
@@ -19,7 +19,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-d49dd75f151b9b34.js"
+      src="/_next/static/chunks/main-281ff28f99ec8d26.js"
       defer=""
     ></script>
     <script
@@ -27,7 +27,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/link-c605640c895e01ab.js"
+      src="/_next/static/chunks/pages/link-5b526b867abc83fc.js"
       defer=""
     ></script>
     <script src="/_next/static/BUILD_ID/_buildManifest.js" defer=""></script>
Diff for withRouter.html
@@ -19,7 +19,7 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-d49dd75f151b9b34.js"
+      src="/_next/static/chunks/main-281ff28f99ec8d26.js"
       defer=""
     ></script>
     <script

Please sign in to comment.