-
Notifications
You must be signed in to change notification settings - Fork 29.5k
Allow absolute urls in router and Link #15792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Failing test suitesCommit: 29be91e test/integration/build-output/test/index.test.js
Expand output● Build Output › Basic Application Output › should not deviate from snapshot
|
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 12.2s | 12.3s | |
nodeModulesSize | 65.5 MB | 65.5 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.178 | 2.159 | -0.02 |
/ avg req/sec | 1147.91 | 1158.2 | +10.29 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.197 | 1.166 | -0.03 |
/error-in-render avg req/sec | 2089.29 | 2144.81 | +55.52 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..39a4.js gzip | 10.2 kB | 10.2 kB | |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-06588f2..f65e.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-488d..c0e7.js gzip | 751 B | 751 B | ✓ |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.13 kB | 6.17 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-62e1f09..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-4f62..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-05..1236.js gzip | 30.8 kB | 30.8 kB | ✓ |
Overall change | 30.8 kB | 30.8 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-8f5f611..1f7b.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-a98d9..5cb7.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-f7f3d0..7465.js gzip | 887 B | 887 B | ✓ |
index-08fb3f..c0e9.js gzip | 227 B | 227 B | ✓ |
link-6f8445b..99e1.js gzip | 1.3 kB | N/A | N/A |
routerDirect..8aa1.js gzip | 284 B | 284 B | ✓ |
withRouter-f..e777.js gzip | 284 B | 284 B | ✓ |
link-5f6f341..9ec5.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -6 B |
Client Pages Modern Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-669dbe5..dule.js gzip | 626 B | 626 B | ✓ |
_error-d5979..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-805c40..dule.js gzip | 387 B | 387 B | ✓ |
index-6ba5a4..dule.js gzip | 226 B | 226 B | ✓ |
link-91516ae..dule.js gzip | 1.25 kB | 1.25 kB | -6 B |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-d..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.36 kB | 5.36 kB | -6 B |
Client Build Manifests Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 274 B | 273 B | -1 B |
_buildManife..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 556 B | 555 B | -1 B |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
index.html gzip | 946 B | 943 B | -3 B |
link.html gzip | 952 B | 951 B | -1 B |
withRouter.html gzip | 939 B | 938 B | -1 B |
Overall change | 2.84 kB | 2.83 kB | -5 B |
Diffs
Diff for _buildManifest.js
@@ -6,7 +6,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-a9269e283072f7ef2b5f.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-7d0e600f2648e896fe8c.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
],
Diff for _buildManifest.module.js
@@ -9,7 +9,7 @@ self.__BUILD_MANIFEST = {
"static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
],
"/link": [
- "static\u002Fchunks\u002Fpages\u002Flink-9be23e1ed7374cb42e26.module.js"
+ "static\u002Fchunks\u002Fpages\u002Flink-d8bcdc69e32d96501e8f.module.js"
],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-9be23e1..26.module.js
@@ -77,15 +77,6 @@
var _router = __webpack_require__("nOHt");
var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
-
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
var cachedObserver;
var listeners = new Map();
@@ -146,7 +137,8 @@
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _utils.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -174,11 +166,6 @@
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -220,7 +207,13 @@
}, [pathname, props.href, props.as]);
_react.default.useEffect(() => {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _utils.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -268,6 +261,8 @@
if (p) {
childProps.onMouseEnter = e => {
+ if (!(0, _utils.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
Diff for link-a9269e2..2f7ef2b5f.js
@@ -81,15 +81,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var _router = __webpack_require__("nOHt");
var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
-
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
var cachedObserver;
var listeners = new Map();
@@ -150,7 +141,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _utils.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -180,11 +172,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -238,7 +225,13 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
_react["default"].useEffect(
function() {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _utils.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -291,6 +284,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
if (p) {
childProps.onMouseEnter = function(e) {
+ if (!(0, _utils.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
Diff for 677f882d2ed8..a9.module.js
@@ -907,6 +907,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
async change(method, url, as, options) {
+ if (!(0, _utils.isLocalURL)(url)) {
+ window.location.href = url;
+ return false;
+ }
+
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1378,6 +1383,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.execOnce = execOnce;
exports.getLocationOrigin = getLocationOrigin;
exports.getURL = getURL;
+ exports.isLocalURL = isLocalURL;
exports.getDisplayName = getDisplayName;
exports.isResSent = isResSent;
exports.loadGetInitialProps = loadGetInitialProps;
@@ -1415,6 +1421,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var origin = getLocationOrigin();
return href.substring(origin.length);
}
+ /**
+ * Detects whether a given url is from the same origin as the current page (browser only).
+ */
+
+ function isLocalURL(url) {
+ var locationOrigin = getLocationOrigin();
+ var resolved = new URL(url, locationOrigin);
+ return resolved.origin === locationOrigin;
+ }
function getDisplayName(Component) {
return typeof Component === "string"
Diff for 677f882d2ed8..7f15aafe7.js
@@ -1095,6 +1095,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
while (1) {
switch ((_context.prev = _context.next)) {
case 0:
+ if ((0, _utils.isLocalURL)(url)) {
+ _context.next = 3;
+ break;
+ }
+
+ window.location.href = url;
+ return _context.abrupt("return", false);
+
+ case 3:
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1125,7 +1134,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
!options._h && this.onlyAHashChange(cleanedAs)
)
) {
- _context.next = 13;
+ _context.next = 16;
break;
}
@@ -1136,17 +1145,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
Router.events.emit("hashChangeComplete", as);
return _context.abrupt("return", true);
- case 13:
+ case 16:
parsed = tryParseRelativeUrl(url);
if (parsed) {
- _context.next = 16;
+ _context.next = 19;
break;
}
return _context.abrupt("return", false);
- case 16:
+ case 19:
(pathname = parsed.pathname),
(searchParams = parsed.searchParams);
query = (0,
@@ -1182,7 +1191,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
: _options$shallow);
if (!(0, _isDynamic.isDynamicRoute)(route)) {
- _context.next = 34;
+ _context.next = 37;
break;
}
@@ -1198,7 +1207,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)(asPathname);
if (routeMatch) {
- _context.next = 33;
+ _context.next = 36;
break;
}
@@ -1209,7 +1218,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
});
if (!(missingParams.length > 0)) {
- _context.next = 31;
+ _context.next = 34;
break;
}
@@ -1226,18 +1235,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
"Read more: https://err.sh/vercel/next.js/incompatible-href-as"
);
- case 31:
- _context.next = 34;
+ case 34:
+ _context.next = 37;
break;
- case 33:
+ case 36:
// Merge params into `query`, overwriting any specified in search
Object.assign(query, routeMatch);
- case 34:
+ case 37:
Router.events.emit("routeChangeStart", as);
- _context.prev = 35;
- _context.next = 38;
+ _context.prev = 38;
+ _context.next = 41;
return this.getRouteInfo(
route,
pathname,
@@ -1246,7 +1255,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
shallow
);
- case 38:
+ case 41:
routeInfo = _context.sent;
error = routeInfo.error;
Router.events.emit("beforeHistoryChange", as);
@@ -1255,7 +1264,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (false) {
}
- _context.next = 45;
+ _context.next = 48;
return this.set(
route,
pathname,
@@ -1264,9 +1273,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
routeInfo
);
- case 45:
+ case 48:
if (!error) {
- _context.next = 48;
+ _context.next = 51;
break;
}
@@ -1277,28 +1286,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 48:
+ case 51:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 53:
- _context.prev = 53;
- _context.t0 = _context["catch"](35);
+ case 56:
+ _context.prev = 56;
+ _context.t0 = _context["catch"](38);
if (!_context.t0.cancelled) {
- _context.next = 57;
+ _context.next = 60;
break;
}
return _context.abrupt("return", false);
- case 57:
+ case 60:
throw _context.t0;
- case 58:
+ case 61:
case "end":
return _context.stop();
}
@@ -1306,7 +1315,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[35, 53]]
+ [[38, 56]]
);
})
);
@@ -2006,6 +2015,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.execOnce = execOnce;
exports.getLocationOrigin = getLocationOrigin;
exports.getURL = getURL;
+ exports.isLocalURL = isLocalURL;
exports.getDisplayName = getDisplayName;
exports.isResSent = isResSent;
exports.loadGetInitialProps = loadGetInitialProps;
@@ -2046,6 +2056,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var origin = getLocationOrigin();
return href.substring(origin.length);
}
+ /**
+ * Detects whether a given url is from the same origin as the current page (browser only).
+ */
+
+ function isLocalURL(url) {
+ var locationOrigin = getLocationOrigin();
+ var resolved = new URL(url, locationOrigin);
+ return resolved.origin === locationOrigin;
+ }
function getDisplayName(Component) {
return typeof Component === "string"
Diff for index.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2ff1b0f9c6fe451560a9.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c843d76beeb18c15105a.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f620cea45847f15aafe7.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.03269ff3999cb88c6195.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2ff1b0f9c6fe451560a9.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c843d76beeb18c15105a.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2ff1b0f9c6fe451560a9.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c843d76beeb18c15105a.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -36,7 +36,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-9be23e1ed7374cb42e26.module.js"
+ href="/_next/static/chunks/pages/link-d8bcdc69e32d96501e8f.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -122,13 +122,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f620cea45847f15aafe7.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.03269ff3999cb88c6195.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2ff1b0f9c6fe451560a9.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c843d76beeb18c15105a.module.js"
async=""
crossorigin="anonymous"
type="module"
@@ -146,13 +146,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/pages/link-a9269e283072f7ef2b5f.js"
+ src="/_next/static/chunks/pages/link-7d0e600f2648e896fe8c.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/pages/link-9be23e1ed7374cb42e26.module.js"
+ src="/_next/static/chunks/pages/link-d8bcdc69e32d96501e8f.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2ff1b0f9c6fe451560a9.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c843d76beeb18c15105a.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f620cea45847f15aafe7.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.03269ff3999cb88c6195.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.2ff1b0f9c6fe451560a9.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.c843d76beeb18c15105a.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 13.6s | 13.7s | |
nodeModulesSize | 65.5 MB | 65.5 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..39a4.js gzip | 10.2 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-06588f2..f65e.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-488d..c0e7.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..3ed3.js gzip | N/A | 10.2 kB | N/A |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.13 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-62e1f09..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-4f62..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.17 kB | N/A |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-05..1236.js gzip | 30.8 kB | 30.8 kB | ✓ |
Overall change | 30.8 kB | 30.8 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-8f5f611..1f7b.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-a98d9..5cb7.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-f7f3d0..7465.js gzip | 887 B | 887 B | ✓ |
index-08fb3f..c0e9.js gzip | 227 B | 227 B | ✓ |
link-6f8445b..99e1.js gzip | 1.3 kB | N/A | N/A |
routerDirect..8aa1.js gzip | 284 B | 284 B | ✓ |
withRouter-f..e777.js gzip | 284 B | 284 B | ✓ |
link-5f6f341..9ec5.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -6 B |
Client Pages Modern Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-669dbe5..dule.js gzip | 626 B | 626 B | ✓ |
_error-d5979..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-805c40..dule.js gzip | 387 B | 387 B | ✓ |
index-6ba5a4..dule.js gzip | 226 B | 226 B | ✓ |
link-91516ae..dule.js gzip | 1.25 kB | N/A | N/A |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-d..dule.js gzip | 282 B | 282 B | ✓ |
link-901719a..dule.js gzip | N/A | 1.25 kB | N/A |
Overall change | 5.36 kB | 5.36 kB | -6 B |
Client Build Manifests Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 274 B | 273 B | -1 B |
_buildManife..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 556 B | 555 B | -1 B |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_error.js | 1.02 MB | 1.02 MB | |
404.html | 4.18 kB | 4.18 kB | ✓ |
hooks.html | 3.82 kB | 3.82 kB | ✓ |
index.js | 1.02 MB | 1.02 MB | |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.05 MB | 1.05 MB | |
withRouter.js | 1.05 MB | 1.05 MB | |
Overall change | 5.2 MB | 5.2 MB |
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 14.8s | 13.7s | -1s |
nodeModulesSize | 65.5 MB | 65.5 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.742 | 2.504 | -0.24 |
/ avg req/sec | 911.77 | 998.53 | +86.76 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.593 | 1.517 | -0.08 |
/error-in-render avg req/sec | 1569.71 | 1648.41 | +78.7 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | 10.2 kB | |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-5932771..4350.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
Overall change | 56.8 kB | 56.8 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | 6.15 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-02cf3f6..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-4c..dbb6.js gzip | 30.8 kB | 30.8 kB | ✓ |
Overall change | 30.8 kB | 30.8 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-07d515d..3e2e.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -6 B |
Client Pages Modern Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | 1.25 kB | -6 B |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.36 kB | 5.36 kB | -6 B |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 273 B | |
_buildManife..dule.js gzip | 280 B | 280 B | ✓ |
Overall change | 552 B | 553 B |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
index.html gzip | 944 B | 947 B | |
link.html gzip | 953 B | 954 B | |
withRouter.html gzip | 939 B | 940 B | |
Overall change | 2.84 kB | 2.84 kB |
Diffs
Diff for _buildManifest.js
@@ -6,7 +6,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-8da4738c6116755ac009.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-edc3fc5157c87ef78114.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
],
Diff for _buildManifest.module.js
@@ -9,7 +9,7 @@ self.__BUILD_MANIFEST = {
"static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
],
"/link": [
- "static\u002Fchunks\u002Fpages\u002Flink-b09795acaca5a197a6f6.module.js"
+ "static\u002Fchunks\u002Fpages\u002Flink-c5cfe9475fcf113b1179.module.js"
],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-8da4738..6755ac009.js
@@ -81,15 +81,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var _router = __webpack_require__("nOHt");
var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
-
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
var cachedObserver;
var listeners = new Map();
@@ -150,7 +141,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _utils.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -180,11 +172,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -238,7 +225,13 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
_react["default"].useEffect(
function() {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _utils.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -291,6 +284,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
if (p) {
childProps.onMouseEnter = function(e) {
+ if (!(0, _utils.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
Diff for link-b09795a..f6.module.js
@@ -77,15 +77,6 @@
var _router = __webpack_require__("nOHt");
var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
-
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
var cachedObserver;
var listeners = new Map();
@@ -146,7 +137,8 @@
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _utils.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -174,11 +166,6 @@
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -220,7 +207,13 @@
}, [pathname, props.href, props.as]);
_react.default.useEffect(() => {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _utils.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -268,6 +261,8 @@
if (p) {
childProps.onMouseEnter = e => {
+ if (!(0, _utils.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
Diff for 677f882d2ed8..5d.module.js
@@ -899,6 +899,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
async change(method, url, as, options) {
+ if (!(0, _utils.isLocalURL)(url)) {
+ window.location.href = url;
+ return false;
+ }
+
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1365,6 +1370,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.execOnce = execOnce;
exports.getLocationOrigin = getLocationOrigin;
exports.getURL = getURL;
+ exports.isLocalURL = isLocalURL;
exports.getDisplayName = getDisplayName;
exports.isResSent = isResSent;
exports.loadGetInitialProps = loadGetInitialProps;
@@ -1402,6 +1408,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var origin = getLocationOrigin();
return href.substring(origin.length);
}
+ /**
+ * Detects whether a given url is from the same origin as the current page (browser only).
+ */
+
+ function isLocalURL(url) {
+ var locationOrigin = getLocationOrigin();
+ var resolved = new URL(url, locationOrigin);
+ return resolved.origin === locationOrigin;
+ }
function getDisplayName(Component) {
return typeof Component === "string"
Diff for 677f882d2ed8..edee4bd72.js
@@ -1092,6 +1092,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
while (1) {
switch ((_context.prev = _context.next)) {
case 0:
+ if ((0, _utils.isLocalURL)(url)) {
+ _context.next = 3;
+ break;
+ }
+
+ window.location.href = url;
+ return _context.abrupt("return", false);
+
+ case 3:
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1114,7 +1123,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (
!(!options._h && this.onlyAHashChange(cleanedAs))
) {
- _context.next = 12;
+ _context.next = 15;
break;
}
@@ -1125,17 +1134,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
Router.events.emit("hashChangeComplete", as);
return _context.abrupt("return", true);
- case 12:
+ case 15:
parsed = tryParseRelativeUrl(url);
if (parsed) {
- _context.next = 15;
+ _context.next = 18;
break;
}
return _context.abrupt("return", false);
- case 15:
+ case 18:
(pathname = parsed.pathname),
(searchParams = parsed.searchParams);
query = (0,
@@ -1171,7 +1180,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
: _options$shallow);
if (!(0, _isDynamic.isDynamicRoute)(route)) {
- _context.next = 33;
+ _context.next = 36;
break;
}
@@ -1185,7 +1194,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)(asPathname);
if (routeMatch) {
- _context.next = 32;
+ _context.next = 35;
break;
}
@@ -1196,7 +1205,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
});
if (!(missingParams.length > 0)) {
- _context.next = 30;
+ _context.next = 33;
break;
}
@@ -1213,18 +1222,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
"Read more: https://err.sh/vercel/next.js/incompatible-href-as"
);
- case 30:
- _context.next = 33;
+ case 33:
+ _context.next = 36;
break;
- case 32:
+ case 35:
// Merge params into `query`, overwriting any specified in search
Object.assign(query, routeMatch);
- case 33:
+ case 36:
Router.events.emit("routeChangeStart", as);
- _context.prev = 34;
- _context.next = 37;
+ _context.prev = 37;
+ _context.next = 40;
return this.getRouteInfo(
route,
pathname,
@@ -1233,7 +1242,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
shallow
);
- case 37:
+ case 40:
routeInfo = _context.sent;
error = routeInfo.error;
Router.events.emit("beforeHistoryChange", as);
@@ -1242,7 +1251,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (false) {
}
- _context.next = 44;
+ _context.next = 47;
return this.set(
route,
pathname,
@@ -1251,9 +1260,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
routeInfo
);
- case 44:
+ case 47:
if (!error) {
- _context.next = 47;
+ _context.next = 50;
break;
}
@@ -1264,28 +1273,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 47:
+ case 50:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 52:
- _context.prev = 52;
- _context.t0 = _context["catch"](34);
+ case 55:
+ _context.prev = 55;
+ _context.t0 = _context["catch"](37);
if (!_context.t0.cancelled) {
- _context.next = 56;
+ _context.next = 59;
break;
}
return _context.abrupt("return", false);
- case 56:
+ case 59:
throw _context.t0;
- case 57:
+ case 60:
case "end":
return _context.stop();
}
@@ -1293,7 +1302,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[34, 52]]
+ [[37, 55]]
);
})
);
@@ -1969,6 +1978,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.execOnce = execOnce;
exports.getLocationOrigin = getLocationOrigin;
exports.getURL = getURL;
+ exports.isLocalURL = isLocalURL;
exports.getDisplayName = getDisplayName;
exports.isResSent = isResSent;
exports.loadGetInitialProps = loadGetInitialProps;
@@ -2009,6 +2019,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var origin = getLocationOrigin();
return href.substring(origin.length);
}
+ /**
+ * Detects whether a given url is from the same origin as the current page (browser only).
+ */
+
+ function isLocalURL(url) {
+ var locationOrigin = getLocationOrigin();
+ var resolved = new URL(url, locationOrigin);
+ return resolved.origin === locationOrigin;
+ }
function getDisplayName(Component) {
return typeof Component === "string"
Diff for index.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f4d300c626661651cd2.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.92a841a57c83650bfd30.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f4d300c626661651cd2.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f4d300c626661651cd2.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -36,7 +36,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ href="/_next/static/chunks/pages/link-c5cfe9475fcf113b1179.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -122,13 +122,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.92a841a57c83650bfd30.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f4d300c626661651cd2.module.js"
async=""
crossorigin="anonymous"
type="module"
@@ -146,13 +146,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/pages/link-8da4738c6116755ac009.js"
+ src="/_next/static/chunks/pages/link-edc3fc5157c87ef78114.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ src="/_next/static/chunks/pages/link-c5cfe9475fcf113b1179.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f4d300c626661651cd2.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.92a841a57c83650bfd30.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.7f4d300c626661651cd2.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 15.6s | 15.4s | -195ms |
nodeModulesSize | 65.5 MB | 65.5 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-5932771..4350.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..69e7.js gzip | N/A | 10.2 kB | N/A |
Overall change | 56.8 kB | 56.8 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-02cf3f6..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.15 kB | N/A |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-4c..dbb6.js gzip | 30.8 kB | 30.8 kB | ✓ |
Overall change | 30.8 kB | 30.8 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-07d515d..3e2e.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -6 B |
Client Pages Modern Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | N/A | N/A |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
link-b5ec9b8..dule.js gzip | N/A | 1.25 kB | N/A |
Overall change | 5.36 kB | 5.36 kB | -6 B |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 273 B | |
_buildManife..dule.js gzip | 280 B | 280 B | ✓ |
Overall change | 552 B | 553 B |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_error.js | 1.02 MB | 1.02 MB | |
404.html | 4.18 kB | 4.18 kB | ✓ |
hooks.html | 3.82 kB | 3.82 kB | ✓ |
index.js | 1.02 MB | 1.02 MB | |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.05 MB | 1.05 MB | |
withRouter.js | 1.05 MB | 1.05 MB | |
Overall change | 5.2 MB | 5.2 MB |
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 10.4s | 10.7s | |
nodeModulesSize | 65.5 MB | 65.5 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 1.87 | 1.837 | -0.03 |
/ avg req/sec | 1336.75 | 1360.99 | +24.24 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 0.997 | 1.017 | |
/error-in-render avg req/sec | 2508.63 | 2459.26 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | 10.2 kB | |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-2ecb3b8..bd63.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | 6.17 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-dbff266..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-75..1629.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-07d515d..3e2e.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -6 B |
Client Pages Modern Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | 1.25 kB | -6 B |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.36 kB | 5.36 kB | -6 B |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 273 B | |
_buildManife..dule.js gzip | 280 B | 280 B | ✓ |
Overall change | 552 B | 553 B |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
index.html gzip | 944 B | 947 B | |
link.html gzip | 953 B | 952 B | -1 B |
withRouter.html gzip | 940 B | 940 B | ✓ |
Overall change | 2.84 kB | 2.84 kB |
Diffs
Diff for _buildManifest.js
@@ -6,7 +6,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-8da4738c6116755ac009.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-edc3fc5157c87ef78114.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
],
Diff for _buildManifest.module.js
@@ -9,7 +9,7 @@ self.__BUILD_MANIFEST = {
"static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
],
"/link": [
- "static\u002Fchunks\u002Fpages\u002Flink-b09795acaca5a197a6f6.module.js"
+ "static\u002Fchunks\u002Fpages\u002Flink-c5cfe9475fcf113b1179.module.js"
],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-8da4738..6755ac009.js
@@ -81,15 +81,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var _router = __webpack_require__("nOHt");
var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
-
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
var cachedObserver;
var listeners = new Map();
@@ -150,7 +141,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _utils.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -180,11 +172,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -238,7 +225,13 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
_react["default"].useEffect(
function() {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _utils.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -291,6 +284,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
if (p) {
childProps.onMouseEnter = function(e) {
+ if (!(0, _utils.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
Diff for link-b09795a..f6.module.js
@@ -77,15 +77,6 @@
var _router = __webpack_require__("nOHt");
var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
-
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
var cachedObserver;
var listeners = new Map();
@@ -146,7 +137,8 @@
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _utils.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -174,11 +166,6 @@
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -220,7 +207,13 @@
}, [pathname, props.href, props.as]);
_react.default.useEffect(() => {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _utils.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -268,6 +261,8 @@
if (p) {
childProps.onMouseEnter = e => {
+ if (!(0, _utils.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
Diff for 677f882d2ed8..5d.module.js
@@ -899,6 +899,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
async change(method, url, as, options) {
+ if (!(0, _utils.isLocalURL)(url)) {
+ window.location.href = url;
+ return false;
+ }
+
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1365,6 +1370,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.execOnce = execOnce;
exports.getLocationOrigin = getLocationOrigin;
exports.getURL = getURL;
+ exports.isLocalURL = isLocalURL;
exports.getDisplayName = getDisplayName;
exports.isResSent = isResSent;
exports.loadGetInitialProps = loadGetInitialProps;
@@ -1402,6 +1408,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var origin = getLocationOrigin();
return href.substring(origin.length);
}
+ /**
+ * Detects whether a given url is from the same origin as the current page (browser only).
+ */
+
+ function isLocalURL(url) {
+ var locationOrigin = getLocationOrigin();
+ var resolved = new URL(url, locationOrigin);
+ return resolved.origin === locationOrigin;
+ }
function getDisplayName(Component) {
return typeof Component === "string"
@@ -1538,21 +1553,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.__esModule = true;
exports.parseRelativeUrl = parseRelativeUrl;
- var DUMMY_BASE = new URL("http://n");
+
+ var _utils = __webpack_require__("g/15");
+
+ var DUMMY_BASE = new URL(
+ false ? undefined : (0, _utils.getLocationOrigin)()
+ );
/**
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
* (e.g. `./hello`) then at least base must be.
- * Absolute urls are rejected.
+ * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
+ * the current origin will be parsed as relative
*/
function parseRelativeUrl(url, base) {
var resolvedBase = base ? new URL(base, DUMMY_BASE) : DUMMY_BASE;
- var { pathname, searchParams, search, hash, href, origin } = new URL(
- url,
- resolvedBase
- );
+ var {
+ pathname,
+ searchParams,
+ search,
+ hash,
+ href,
+ origin,
+ protocol
+ } = new URL(url, resolvedBase);
- if (origin !== DUMMY_BASE.origin) {
+ if (
+ origin !== DUMMY_BASE.origin ||
+ (protocol !== "http:" && protocol !== "https:")
+ ) {
throw new Error("invariant: invalid relative URL");
}
Diff for 677f882d2ed8..edee4bd72.js
@@ -1092,6 +1092,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
while (1) {
switch ((_context.prev = _context.next)) {
case 0:
+ if ((0, _utils.isLocalURL)(url)) {
+ _context.next = 3;
+ break;
+ }
+
+ window.location.href = url;
+ return _context.abrupt("return", false);
+
+ case 3:
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1114,7 +1123,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (
!(!options._h && this.onlyAHashChange(cleanedAs))
) {
- _context.next = 12;
+ _context.next = 15;
break;
}
@@ -1125,17 +1134,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
Router.events.emit("hashChangeComplete", as);
return _context.abrupt("return", true);
- case 12:
+ case 15:
parsed = tryParseRelativeUrl(url);
if (parsed) {
- _context.next = 15;
+ _context.next = 18;
break;
}
return _context.abrupt("return", false);
- case 15:
+ case 18:
(pathname = parsed.pathname),
(searchParams = parsed.searchParams);
query = (0,
@@ -1171,7 +1180,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
: _options$shallow);
if (!(0, _isDynamic.isDynamicRoute)(route)) {
- _context.next = 33;
+ _context.next = 36;
break;
}
@@ -1185,7 +1194,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)(asPathname);
if (routeMatch) {
- _context.next = 32;
+ _context.next = 35;
break;
}
@@ -1196,7 +1205,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
});
if (!(missingParams.length > 0)) {
- _context.next = 30;
+ _context.next = 33;
break;
}
@@ -1213,18 +1222,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
"Read more: https://err.sh/vercel/next.js/incompatible-href-as"
);
- case 30:
- _context.next = 33;
+ case 33:
+ _context.next = 36;
break;
- case 32:
+ case 35:
// Merge params into `query`, overwriting any specified in search
Object.assign(query, routeMatch);
- case 33:
+ case 36:
Router.events.emit("routeChangeStart", as);
- _context.prev = 34;
- _context.next = 37;
+ _context.prev = 37;
+ _context.next = 40;
return this.getRouteInfo(
route,
pathname,
@@ -1233,7 +1242,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
shallow
);
- case 37:
+ case 40:
routeInfo = _context.sent;
error = routeInfo.error;
Router.events.emit("beforeHistoryChange", as);
@@ -1242,7 +1251,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (false) {
}
- _context.next = 44;
+ _context.next = 47;
return this.set(
route,
pathname,
@@ -1251,9 +1260,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
routeInfo
);
- case 44:
+ case 47:
if (!error) {
- _context.next = 47;
+ _context.next = 50;
break;
}
@@ -1264,28 +1273,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 47:
+ case 50:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 52:
- _context.prev = 52;
- _context.t0 = _context["catch"](34);
+ case 55:
+ _context.prev = 55;
+ _context.t0 = _context["catch"](37);
if (!_context.t0.cancelled) {
- _context.next = 56;
+ _context.next = 59;
break;
}
return _context.abrupt("return", false);
- case 56:
+ case 59:
throw _context.t0;
- case 57:
+ case 60:
case "end":
return _context.stop();
}
@@ -1293,7 +1302,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[34, 52]]
+ [[37, 55]]
);
})
);
@@ -1969,6 +1978,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.execOnce = execOnce;
exports.getLocationOrigin = getLocationOrigin;
exports.getURL = getURL;
+ exports.isLocalURL = isLocalURL;
exports.getDisplayName = getDisplayName;
exports.isResSent = isResSent;
exports.loadGetInitialProps = loadGetInitialProps;
@@ -2009,6 +2019,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var origin = getLocationOrigin();
return href.substring(origin.length);
}
+ /**
+ * Detects whether a given url is from the same origin as the current page (browser only).
+ */
+
+ function isLocalURL(url) {
+ var locationOrigin = getLocationOrigin();
+ var resolved = new URL(url, locationOrigin);
+ return resolved.origin === locationOrigin;
+ }
function getDisplayName(Component) {
return typeof Component === "string"
@@ -2212,11 +2231,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.__esModule = true;
exports.parseRelativeUrl = parseRelativeUrl;
- var DUMMY_BASE = new URL("http://n");
+
+ var _utils = __webpack_require__("g/15");
+
+ var DUMMY_BASE = new URL(
+ false ? undefined : (0, _utils.getLocationOrigin)()
+ );
/**
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
* (e.g. `./hello`) then at least base must be.
- * Absolute urls are rejected.
+ * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
+ * the current origin will be parsed as relative
*/
function parseRelativeUrl(url, base) {
@@ -2228,9 +2253,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
search = _URL.search,
hash = _URL.hash,
href = _URL.href,
- origin = _URL.origin;
+ origin = _URL.origin,
+ protocol = _URL.protocol;
- if (origin !== DUMMY_BASE.origin) {
+ if (
+ origin !== DUMMY_BASE.origin ||
+ (protocol !== "http:" && protocol !== "https:")
+ ) {
throw new Error("invariant: invalid relative URL");
}
Diff for index.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f00c7d81b12c531b0f1a.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -36,7 +36,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ href="/_next/static/chunks/pages/link-c5cfe9475fcf113b1179.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -122,13 +122,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f00c7d81b12c531b0f1a.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
async=""
crossorigin="anonymous"
type="module"
@@ -146,13 +146,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/pages/link-8da4738c6116755ac009.js"
+ src="/_next/static/chunks/pages/link-edc3fc5157c87ef78114.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ src="/_next/static/chunks/pages/link-c5cfe9475fcf113b1179.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f00c7d81b12c531b0f1a.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 12s | 11.2s | -789ms |
nodeModulesSize | 65.5 MB | 65.5 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-2ecb3b8..bd63.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..10a6.js gzip | N/A | 10.2 kB | N/A |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-dbff266..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.17 kB | N/A |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-75..1629.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-07d515d..3e2e.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -6 B |
Client Pages Modern Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | N/A | N/A |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
link-b5ec9b8..dule.js gzip | N/A | 1.25 kB | N/A |
Overall change | 5.36 kB | 5.36 kB | -6 B |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 273 B | |
_buildManife..dule.js gzip | 280 B | 280 B | ✓ |
Overall change | 552 B | 553 B |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_error.js | 1.02 MB | 1.02 MB | |
404.html | 4.18 kB | 4.18 kB | ✓ |
hooks.html | 3.82 kB | 3.82 kB | ✓ |
index.js | 1.02 MB | 1.02 MB | |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.05 MB | 1.05 MB | |
withRouter.js | 1.05 MB | 1.05 MB | |
Overall change | 5.2 MB | 5.2 MB |
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 13.7s | 13s | -721ms |
nodeModulesSize | 65.5 MB | 65.5 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.708 | 2.32 | -0.39 |
/ avg req/sec | 923.31 | 1077.51 | +154.2 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.714 | 1.461 | -0.25 |
/error-in-render avg req/sec | 1458.19 | 1711.56 | +253.37 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | 10.2 kB | |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-2ecb3b8..bd63.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | 6.17 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-dbff266..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-75..1629.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-07d515d..3e2e.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -6 B |
Client Pages Modern Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | 1.25 kB | -6 B |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.36 kB | 5.36 kB | -6 B |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 273 B | |
_buildManife..dule.js gzip | 280 B | 280 B | ✓ |
Overall change | 552 B | 553 B |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
index.html gzip | 944 B | 947 B | |
link.html gzip | 953 B | 952 B | -1 B |
withRouter.html gzip | 940 B | 940 B | ✓ |
Overall change | 2.84 kB | 2.84 kB |
Diffs
Diff for _buildManifest.js
@@ -6,7 +6,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-8da4738c6116755ac009.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-edc3fc5157c87ef78114.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
],
Diff for _buildManifest.module.js
@@ -9,7 +9,7 @@ self.__BUILD_MANIFEST = {
"static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
],
"/link": [
- "static\u002Fchunks\u002Fpages\u002Flink-b09795acaca5a197a6f6.module.js"
+ "static\u002Fchunks\u002Fpages\u002Flink-c5cfe9475fcf113b1179.module.js"
],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-8da4738..6755ac009.js
@@ -81,15 +81,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var _router = __webpack_require__("nOHt");
var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
-
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
var cachedObserver;
var listeners = new Map();
@@ -150,7 +141,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _utils.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -180,11 +172,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -238,7 +225,13 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
_react["default"].useEffect(
function() {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _utils.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -291,6 +284,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
if (p) {
childProps.onMouseEnter = function(e) {
+ if (!(0, _utils.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
Diff for link-b09795a..f6.module.js
@@ -77,15 +77,6 @@
var _router = __webpack_require__("nOHt");
var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
-
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
var cachedObserver;
var listeners = new Map();
@@ -146,7 +137,8 @@
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _utils.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -174,11 +166,6 @@
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -220,7 +207,13 @@
}, [pathname, props.href, props.as]);
_react.default.useEffect(() => {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _utils.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -268,6 +261,8 @@
if (p) {
childProps.onMouseEnter = e => {
+ if (!(0, _utils.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
Diff for 677f882d2ed8..5d.module.js
@@ -899,6 +899,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
async change(method, url, as, options) {
+ if (!(0, _utils.isLocalURL)(url)) {
+ window.location.href = url;
+ return false;
+ }
+
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1365,6 +1370,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.execOnce = execOnce;
exports.getLocationOrigin = getLocationOrigin;
exports.getURL = getURL;
+ exports.isLocalURL = isLocalURL;
exports.getDisplayName = getDisplayName;
exports.isResSent = isResSent;
exports.loadGetInitialProps = loadGetInitialProps;
@@ -1402,6 +1408,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var origin = getLocationOrigin();
return href.substring(origin.length);
}
+ /**
+ * Detects whether a given url is from the same origin as the current page (browser only).
+ */
+
+ function isLocalURL(url) {
+ var locationOrigin = getLocationOrigin();
+ var resolved = new URL(url, locationOrigin);
+ return resolved.origin === locationOrigin;
+ }
function getDisplayName(Component) {
return typeof Component === "string"
@@ -1538,21 +1553,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.__esModule = true;
exports.parseRelativeUrl = parseRelativeUrl;
- var DUMMY_BASE = new URL("http://n");
+
+ var _utils = __webpack_require__("g/15");
+
+ var DUMMY_BASE = new URL(
+ false ? undefined : (0, _utils.getLocationOrigin)()
+ );
/**
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
* (e.g. `./hello`) then at least base must be.
- * Absolute urls are rejected.
+ * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
+ * the current origin will be parsed as relative
*/
function parseRelativeUrl(url, base) {
var resolvedBase = base ? new URL(base, DUMMY_BASE) : DUMMY_BASE;
- var { pathname, searchParams, search, hash, href, origin } = new URL(
- url,
- resolvedBase
- );
+ var {
+ pathname,
+ searchParams,
+ search,
+ hash,
+ href,
+ origin,
+ protocol
+ } = new URL(url, resolvedBase);
- if (origin !== DUMMY_BASE.origin) {
+ if (
+ origin !== DUMMY_BASE.origin ||
+ (protocol !== "http:" && protocol !== "https:")
+ ) {
throw new Error("invariant: invalid relative URL");
}
Diff for 677f882d2ed8..edee4bd72.js
@@ -1092,6 +1092,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
while (1) {
switch ((_context.prev = _context.next)) {
case 0:
+ if ((0, _utils.isLocalURL)(url)) {
+ _context.next = 3;
+ break;
+ }
+
+ window.location.href = url;
+ return _context.abrupt("return", false);
+
+ case 3:
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1114,7 +1123,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (
!(!options._h && this.onlyAHashChange(cleanedAs))
) {
- _context.next = 12;
+ _context.next = 15;
break;
}
@@ -1125,17 +1134,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
Router.events.emit("hashChangeComplete", as);
return _context.abrupt("return", true);
- case 12:
+ case 15:
parsed = tryParseRelativeUrl(url);
if (parsed) {
- _context.next = 15;
+ _context.next = 18;
break;
}
return _context.abrupt("return", false);
- case 15:
+ case 18:
(pathname = parsed.pathname),
(searchParams = parsed.searchParams);
query = (0,
@@ -1171,7 +1180,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
: _options$shallow);
if (!(0, _isDynamic.isDynamicRoute)(route)) {
- _context.next = 33;
+ _context.next = 36;
break;
}
@@ -1185,7 +1194,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)(asPathname);
if (routeMatch) {
- _context.next = 32;
+ _context.next = 35;
break;
}
@@ -1196,7 +1205,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
});
if (!(missingParams.length > 0)) {
- _context.next = 30;
+ _context.next = 33;
break;
}
@@ -1213,18 +1222,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
"Read more: https://err.sh/vercel/next.js/incompatible-href-as"
);
- case 30:
- _context.next = 33;
+ case 33:
+ _context.next = 36;
break;
- case 32:
+ case 35:
// Merge params into `query`, overwriting any specified in search
Object.assign(query, routeMatch);
- case 33:
+ case 36:
Router.events.emit("routeChangeStart", as);
- _context.prev = 34;
- _context.next = 37;
+ _context.prev = 37;
+ _context.next = 40;
return this.getRouteInfo(
route,
pathname,
@@ -1233,7 +1242,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
shallow
);
- case 37:
+ case 40:
routeInfo = _context.sent;
error = routeInfo.error;
Router.events.emit("beforeHistoryChange", as);
@@ -1242,7 +1251,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (false) {
}
- _context.next = 44;
+ _context.next = 47;
return this.set(
route,
pathname,
@@ -1251,9 +1260,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
routeInfo
);
- case 44:
+ case 47:
if (!error) {
- _context.next = 47;
+ _context.next = 50;
break;
}
@@ -1264,28 +1273,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 47:
+ case 50:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 52:
- _context.prev = 52;
- _context.t0 = _context["catch"](34);
+ case 55:
+ _context.prev = 55;
+ _context.t0 = _context["catch"](37);
if (!_context.t0.cancelled) {
- _context.next = 56;
+ _context.next = 59;
break;
}
return _context.abrupt("return", false);
- case 56:
+ case 59:
throw _context.t0;
- case 57:
+ case 60:
case "end":
return _context.stop();
}
@@ -1293,7 +1302,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[34, 52]]
+ [[37, 55]]
);
})
);
@@ -1969,6 +1978,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.execOnce = execOnce;
exports.getLocationOrigin = getLocationOrigin;
exports.getURL = getURL;
+ exports.isLocalURL = isLocalURL;
exports.getDisplayName = getDisplayName;
exports.isResSent = isResSent;
exports.loadGetInitialProps = loadGetInitialProps;
@@ -2009,6 +2019,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var origin = getLocationOrigin();
return href.substring(origin.length);
}
+ /**
+ * Detects whether a given url is from the same origin as the current page (browser only).
+ */
+
+ function isLocalURL(url) {
+ var locationOrigin = getLocationOrigin();
+ var resolved = new URL(url, locationOrigin);
+ return resolved.origin === locationOrigin;
+ }
function getDisplayName(Component) {
return typeof Component === "string"
@@ -2212,11 +2231,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.__esModule = true;
exports.parseRelativeUrl = parseRelativeUrl;
- var DUMMY_BASE = new URL("http://n");
+
+ var _utils = __webpack_require__("g/15");
+
+ var DUMMY_BASE = new URL(
+ false ? undefined : (0, _utils.getLocationOrigin)()
+ );
/**
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
* (e.g. `./hello`) then at least base must be.
- * Absolute urls are rejected.
+ * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
+ * the current origin will be parsed as relative
*/
function parseRelativeUrl(url, base) {
@@ -2228,9 +2253,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
search = _URL.search,
hash = _URL.hash,
href = _URL.href,
- origin = _URL.origin;
+ origin = _URL.origin,
+ protocol = _URL.protocol;
- if (origin !== DUMMY_BASE.origin) {
+ if (
+ origin !== DUMMY_BASE.origin ||
+ (protocol !== "http:" && protocol !== "https:")
+ ) {
throw new Error("invariant: invalid relative URL");
}
Diff for index.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f00c7d81b12c531b0f1a.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -36,7 +36,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ href="/_next/static/chunks/pages/link-c5cfe9475fcf113b1179.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -122,13 +122,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f00c7d81b12c531b0f1a.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
async=""
crossorigin="anonymous"
type="module"
@@ -146,13 +146,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/pages/link-8da4738c6116755ac009.js"
+ src="/_next/static/chunks/pages/link-edc3fc5157c87ef78114.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ src="/_next/static/chunks/pages/link-c5cfe9475fcf113b1179.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f00c7d81b12c531b0f1a.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 14.2s | 13.6s | -617ms |
nodeModulesSize | 65.5 MB | 65.5 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-2ecb3b8..bd63.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..10a6.js gzip | N/A | 10.2 kB | N/A |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-dbff266..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.17 kB | N/A |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-75..1629.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-07d515d..3e2e.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -6 B |
Client Pages Modern Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | N/A | N/A |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
link-b5ec9b8..dule.js gzip | N/A | 1.25 kB | N/A |
Overall change | 5.36 kB | 5.36 kB | -6 B |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 273 B | |
_buildManife..dule.js gzip | 280 B | 280 B | ✓ |
Overall change | 552 B | 553 B |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_error.js | 1.02 MB | 1.02 MB | |
404.html | 4.18 kB | 4.18 kB | ✓ |
hooks.html | 3.82 kB | 3.82 kB | ✓ |
index.js | 1.02 MB | 1.02 MB | |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.05 MB | 1.05 MB | |
withRouter.js | 1.05 MB | 1.05 MB | |
Overall change | 5.2 MB | 5.2 MB |
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 12.5s | 12.4s | -90ms |
nodeModulesSize | 65.5 MB | 65.5 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.489 | 2.267 | -0.22 |
/ avg req/sec | 1004.58 | 1102.67 | +98.09 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.409 | 1.406 | 0 |
/error-in-render avg req/sec | 1774.29 | 1778.29 | +4 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | 10.2 kB | |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-2ecb3b8..bd63.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | 6.17 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-dbff266..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-75..1629.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-07d515d..3e2e.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -6 B |
Client Pages Modern Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | 1.25 kB | -6 B |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
Overall change | 5.36 kB | 5.36 kB | -6 B |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 273 B | |
_buildManife..dule.js gzip | 280 B | 280 B | ✓ |
Overall change | 552 B | 553 B |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
index.html gzip | 944 B | 947 B | |
link.html gzip | 953 B | 952 B | -1 B |
withRouter.html gzip | 940 B | 940 B | ✓ |
Overall change | 2.84 kB | 2.84 kB |
Diffs
Diff for _buildManifest.js
@@ -6,7 +6,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-8da4738c6116755ac009.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-edc3fc5157c87ef78114.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
],
Diff for _buildManifest.module.js
@@ -9,7 +9,7 @@ self.__BUILD_MANIFEST = {
"static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
],
"/link": [
- "static\u002Fchunks\u002Fpages\u002Flink-b09795acaca5a197a6f6.module.js"
+ "static\u002Fchunks\u002Fpages\u002Flink-c5cfe9475fcf113b1179.module.js"
],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-8da4738..6755ac009.js
@@ -81,15 +81,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var _router = __webpack_require__("nOHt");
var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
-
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
var cachedObserver;
var listeners = new Map();
@@ -150,7 +141,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _utils.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -180,11 +172,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -238,7 +225,13 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
_react["default"].useEffect(
function() {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _utils.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -291,6 +284,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
if (p) {
childProps.onMouseEnter = function(e) {
+ if (!(0, _utils.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
Diff for link-b09795a..f6.module.js
@@ -77,15 +77,6 @@
var _router = __webpack_require__("nOHt");
var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
-
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
var cachedObserver;
var listeners = new Map();
@@ -146,7 +137,8 @@
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _utils.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -174,11 +166,6 @@
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -220,7 +207,13 @@
}, [pathname, props.href, props.as]);
_react.default.useEffect(() => {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _utils.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -268,6 +261,8 @@
if (p) {
childProps.onMouseEnter = e => {
+ if (!(0, _utils.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
Diff for 677f882d2ed8..5d.module.js
@@ -899,6 +899,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
async change(method, url, as, options) {
+ if (!(0, _utils.isLocalURL)(url)) {
+ window.location.href = url;
+ return false;
+ }
+
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1365,6 +1370,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.execOnce = execOnce;
exports.getLocationOrigin = getLocationOrigin;
exports.getURL = getURL;
+ exports.isLocalURL = isLocalURL;
exports.getDisplayName = getDisplayName;
exports.isResSent = isResSent;
exports.loadGetInitialProps = loadGetInitialProps;
@@ -1402,6 +1408,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var origin = getLocationOrigin();
return href.substring(origin.length);
}
+ /**
+ * Detects whether a given url is from the same origin as the current page (browser only).
+ */
+
+ function isLocalURL(url) {
+ var locationOrigin = getLocationOrigin();
+ var resolved = new URL(url, locationOrigin);
+ return resolved.origin === locationOrigin;
+ }
function getDisplayName(Component) {
return typeof Component === "string"
@@ -1538,21 +1553,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.__esModule = true;
exports.parseRelativeUrl = parseRelativeUrl;
- var DUMMY_BASE = new URL("http://n");
+
+ var _utils = __webpack_require__("g/15");
+
+ var DUMMY_BASE = new URL(
+ false ? undefined : (0, _utils.getLocationOrigin)()
+ );
/**
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
* (e.g. `./hello`) then at least base must be.
- * Absolute urls are rejected.
+ * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
+ * the current origin will be parsed as relative
*/
function parseRelativeUrl(url, base) {
var resolvedBase = base ? new URL(base, DUMMY_BASE) : DUMMY_BASE;
- var { pathname, searchParams, search, hash, href, origin } = new URL(
- url,
- resolvedBase
- );
+ var {
+ pathname,
+ searchParams,
+ search,
+ hash,
+ href,
+ origin,
+ protocol
+ } = new URL(url, resolvedBase);
- if (origin !== DUMMY_BASE.origin) {
+ if (
+ origin !== DUMMY_BASE.origin ||
+ (protocol !== "http:" && protocol !== "https:")
+ ) {
throw new Error("invariant: invalid relative URL");
}
Diff for 677f882d2ed8..edee4bd72.js
@@ -1092,6 +1092,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
while (1) {
switch ((_context.prev = _context.next)) {
case 0:
+ if ((0, _utils.isLocalURL)(url)) {
+ _context.next = 3;
+ break;
+ }
+
+ window.location.href = url;
+ return _context.abrupt("return", false);
+
+ case 3:
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1114,7 +1123,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (
!(!options._h && this.onlyAHashChange(cleanedAs))
) {
- _context.next = 12;
+ _context.next = 15;
break;
}
@@ -1125,17 +1134,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
Router.events.emit("hashChangeComplete", as);
return _context.abrupt("return", true);
- case 12:
+ case 15:
parsed = tryParseRelativeUrl(url);
if (parsed) {
- _context.next = 15;
+ _context.next = 18;
break;
}
return _context.abrupt("return", false);
- case 15:
+ case 18:
(pathname = parsed.pathname),
(searchParams = parsed.searchParams);
query = (0,
@@ -1171,7 +1180,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
: _options$shallow);
if (!(0, _isDynamic.isDynamicRoute)(route)) {
- _context.next = 33;
+ _context.next = 36;
break;
}
@@ -1185,7 +1194,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)(asPathname);
if (routeMatch) {
- _context.next = 32;
+ _context.next = 35;
break;
}
@@ -1196,7 +1205,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
});
if (!(missingParams.length > 0)) {
- _context.next = 30;
+ _context.next = 33;
break;
}
@@ -1213,18 +1222,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
"Read more: https://err.sh/vercel/next.js/incompatible-href-as"
);
- case 30:
- _context.next = 33;
+ case 33:
+ _context.next = 36;
break;
- case 32:
+ case 35:
// Merge params into `query`, overwriting any specified in search
Object.assign(query, routeMatch);
- case 33:
+ case 36:
Router.events.emit("routeChangeStart", as);
- _context.prev = 34;
- _context.next = 37;
+ _context.prev = 37;
+ _context.next = 40;
return this.getRouteInfo(
route,
pathname,
@@ -1233,7 +1242,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
shallow
);
- case 37:
+ case 40:
routeInfo = _context.sent;
error = routeInfo.error;
Router.events.emit("beforeHistoryChange", as);
@@ -1242,7 +1251,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (false) {
}
- _context.next = 44;
+ _context.next = 47;
return this.set(
route,
pathname,
@@ -1251,9 +1260,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
routeInfo
);
- case 44:
+ case 47:
if (!error) {
- _context.next = 47;
+ _context.next = 50;
break;
}
@@ -1264,28 +1273,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 47:
+ case 50:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 52:
- _context.prev = 52;
- _context.t0 = _context["catch"](34);
+ case 55:
+ _context.prev = 55;
+ _context.t0 = _context["catch"](37);
if (!_context.t0.cancelled) {
- _context.next = 56;
+ _context.next = 59;
break;
}
return _context.abrupt("return", false);
- case 56:
+ case 59:
throw _context.t0;
- case 57:
+ case 60:
case "end":
return _context.stop();
}
@@ -1293,7 +1302,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[34, 52]]
+ [[37, 55]]
);
})
);
@@ -1969,6 +1978,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.execOnce = execOnce;
exports.getLocationOrigin = getLocationOrigin;
exports.getURL = getURL;
+ exports.isLocalURL = isLocalURL;
exports.getDisplayName = getDisplayName;
exports.isResSent = isResSent;
exports.loadGetInitialProps = loadGetInitialProps;
@@ -2009,6 +2019,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var origin = getLocationOrigin();
return href.substring(origin.length);
}
+ /**
+ * Detects whether a given url is from the same origin as the current page (browser only).
+ */
+
+ function isLocalURL(url) {
+ var locationOrigin = getLocationOrigin();
+ var resolved = new URL(url, locationOrigin);
+ return resolved.origin === locationOrigin;
+ }
function getDisplayName(Component) {
return typeof Component === "string"
@@ -2212,11 +2231,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.__esModule = true;
exports.parseRelativeUrl = parseRelativeUrl;
- var DUMMY_BASE = new URL("http://n");
+
+ var _utils = __webpack_require__("g/15");
+
+ var DUMMY_BASE = new URL(
+ false ? undefined : (0, _utils.getLocationOrigin)()
+ );
/**
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
* (e.g. `./hello`) then at least base must be.
- * Absolute urls are rejected.
+ * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
+ * the current origin will be parsed as relative
*/
function parseRelativeUrl(url, base) {
@@ -2228,9 +2253,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
search = _URL.search,
hash = _URL.hash,
href = _URL.href,
- origin = _URL.origin;
+ origin = _URL.origin,
+ protocol = _URL.protocol;
- if (origin !== DUMMY_BASE.origin) {
+ if (
+ origin !== DUMMY_BASE.origin ||
+ (protocol !== "http:" && protocol !== "https:")
+ ) {
throw new Error("invariant: invalid relative URL");
}
Diff for index.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f00c7d81b12c531b0f1a.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -36,7 +36,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ href="/_next/static/chunks/pages/link-c5cfe9475fcf113b1179.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -122,13 +122,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f00c7d81b12c531b0f1a.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
async=""
crossorigin="anonymous"
type="module"
@@ -146,13 +146,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/pages/link-8da4738c6116755ac009.js"
+ src="/_next/static/chunks/pages/link-edc3fc5157c87ef78114.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ src="/_next/static/chunks/pages/link-c5cfe9475fcf113b1179.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f00c7d81b12c531b0f1a.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.f0197a1bdecb121400f7.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 14.5s | 16.3s | |
nodeModulesSize | 65.5 MB | 65.5 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-2ecb3b8..bd63.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..10a6.js gzip | N/A | 10.2 kB | N/A |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-dbff266..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.17 kB | N/A |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-75..1629.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-07d515d..3e2e.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -6 B |
Client Pages Modern Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | N/A | N/A |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
link-b5ec9b8..dule.js gzip | N/A | 1.25 kB | N/A |
Overall change | 5.36 kB | 5.36 kB | -6 B |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 273 B | |
_buildManife..dule.js gzip | 280 B | 280 B | ✓ |
Overall change | 552 B | 553 B |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_error.js | 1.02 MB | 1.02 MB | |
404.html | 4.18 kB | 4.18 kB | ✓ |
hooks.html | 3.82 kB | 3.82 kB | ✓ |
index.js | 1.02 MB | 1.02 MB | |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.05 MB | 1.05 MB | |
withRouter.js | 1.05 MB | 1.05 MB | |
Overall change | 5.2 MB | 5.2 MB |
options: TransitionOptions | ||
): Promise<boolean> { | ||
if (!isLocalURL(url)) { | ||
window.location.href = url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work with mailto:
links and whatnot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, didn't manage to test mailto handlers in selenium, but it's just treated as an external link
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 12.1s | 12.1s | |
nodeModulesSize | 65.5 MB | 65.5 MB |
Page Load Tests Overall increase ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.262 | 2.251 | -0.01 |
/ avg req/sec | 1105.13 | 1110.69 | +5.56 |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.443 | 1.421 | -0.02 |
/error-in-render avg req/sec | 1733.06 | 1759.79 | +26.73 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | 10.2 kB | |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-2b429aa..0b7b.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | 6.19 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-3cc11c4..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-75..1629.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-6fc6437..e390.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -7 B |
Client Pages Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | N/A | N/A |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
link-fe64181..dule.js gzip | N/A | 1.26 kB | N/A |
Overall change | 5.36 kB | 5.37 kB |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 274 B | |
_buildManife..dule.js gzip | 280 B | 281 B | |
Overall change | 552 B | 555 B |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
index.html gzip | 947 B | 947 B | ✓ |
link.html gzip | 953 B | 954 B | |
withRouter.html gzip | 939 B | 940 B | |
Overall change | 2.84 kB | 2.84 kB |
Diffs
Diff for _buildManifest.js
@@ -6,7 +6,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-8da4738c6116755ac009.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-8a84b097b200144454dd.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
],
Diff for _buildManifest.module.js
@@ -9,7 +9,7 @@ self.__BUILD_MANIFEST = {
"static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
],
"/link": [
- "static\u002Fchunks\u002Fpages\u002Flink-b09795acaca5a197a6f6.module.js"
+ "static\u002Fchunks\u002Fpages\u002Flink-3d53e6bdb171f5ab232b.module.js"
],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-8da4738..6755ac009.js
@@ -81,15 +81,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var _router = __webpack_require__("nOHt");
var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
-
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
var cachedObserver;
var listeners = new Map();
@@ -150,7 +141,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _utils.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -163,28 +155,28 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
prefetched[href + "%" + as] = true;
}
+ function isNewTabRequest(event) {
+ var target = event.currentTarget.target;
+ return (
+ (target && target !== "_self") ||
+ event.metaKey ||
+ event.ctrlKey ||
+ event.shiftKey ||
+ (event.nativeEvent && event.nativeEvent.which === 2)
+ );
+ }
+
function linkClicked(e, router, href, as, replace, shallow, scroll) {
- var _e$currentTarget = e.currentTarget,
- nodeName = _e$currentTarget.nodeName,
- target = _e$currentTarget.target;
+ var nodeName = e.currentTarget.nodeName;
if (
nodeName === "A" &&
- ((target && target !== "_self") ||
- e.metaKey ||
- e.ctrlKey ||
- e.shiftKey ||
- (e.nativeEvent && e.nativeEvent.which === 2))
+ (isNewTabRequest(e) || !(0, _utils.isLocalURL)(href))
) {
// ignore click for new tab / new window behavior
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -238,7 +230,13 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
_react["default"].useEffect(
function() {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _utils.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -291,6 +289,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
if (p) {
childProps.onMouseEnter = function(e) {
+ if (!(0, _utils.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
Diff for link-b09795a..f6.module.js
@@ -77,15 +77,6 @@
var _router = __webpack_require__("nOHt");
var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
-
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
var cachedObserver;
var listeners = new Map();
@@ -146,7 +137,8 @@
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _utils.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -159,26 +151,28 @@
prefetched[href + "%" + as] = true;
}
+ function isNewTabRequest(event) {
+ var { target } = event.currentTarget;
+ return (
+ (target && target !== "_self") ||
+ event.metaKey ||
+ event.ctrlKey ||
+ event.shiftKey ||
+ (event.nativeEvent && event.nativeEvent.which === 2)
+ );
+ }
+
function linkClicked(e, router, href, as, replace, shallow, scroll) {
- var { nodeName, target } = e.currentTarget;
+ var { nodeName } = e.currentTarget;
if (
nodeName === "A" &&
- ((target && target !== "_self") ||
- e.metaKey ||
- e.ctrlKey ||
- e.shiftKey ||
- (e.nativeEvent && e.nativeEvent.which === 2))
+ (isNewTabRequest(e) || !(0, _utils.isLocalURL)(href))
) {
// ignore click for new tab / new window behavior
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -220,7 +214,13 @@
}, [pathname, props.href, props.as]);
_react.default.useEffect(() => {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _utils.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -268,6 +268,8 @@
if (p) {
childProps.onMouseEnter = e => {
+ if (!(0, _utils.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
Diff for 677f882d2ed8..5d.module.js
@@ -603,13 +603,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
typeof href === "string"
? href
: (0, _utils.formatWithValidation)(href);
- var finalUrl = new URL(urlAsString, base);
- finalUrl.pathname = (0,
- _normalizeTrailingSlash.normalizePathTrailingSlash)(finalUrl.pathname); // if the origin didn't change, it means we received a relative href
- return finalUrl.origin === base.origin
- ? finalUrl.href.slice(finalUrl.origin.length)
- : finalUrl.href;
+ try {
+ var finalUrl = new URL(urlAsString, base);
+ finalUrl.pathname = (0,
+ _normalizeTrailingSlash.normalizePathTrailingSlash)(
+ finalUrl.pathname
+ ); // if the origin didn't change, it means we received a relative href
+
+ return finalUrl.origin === base.origin
+ ? finalUrl.href.slice(finalUrl.origin.length)
+ : finalUrl.href;
+ } catch (_) {
+ return urlAsString;
+ }
}
function prepareUrlAs(router, url, as) {
@@ -899,6 +906,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
async change(method, url, as, options) {
+ if (!(0, _utils.isLocalURL)(url)) {
+ window.location.href = url;
+ return false;
+ }
+
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1365,6 +1377,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.execOnce = execOnce;
exports.getLocationOrigin = getLocationOrigin;
exports.getURL = getURL;
+ exports.isLocalURL = isLocalURL;
exports.getDisplayName = getDisplayName;
exports.isResSent = isResSent;
exports.loadGetInitialProps = loadGetInitialProps;
@@ -1402,6 +1415,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var origin = getLocationOrigin();
return href.substring(origin.length);
}
+ /**
+ * Detects whether a given url is from the same origin as the current page (browser only).
+ */
+
+ function isLocalURL(url) {
+ var locationOrigin = getLocationOrigin();
+
+ try {
+ var resolved = new URL(url, locationOrigin);
+ return resolved.origin === locationOrigin;
+ } catch (_) {
+ return false;
+ }
+ }
function getDisplayName(Component) {
return typeof Component === "string"
@@ -1538,21 +1565,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.__esModule = true;
exports.parseRelativeUrl = parseRelativeUrl;
- var DUMMY_BASE = new URL("http://n");
+
+ var _utils = __webpack_require__("g/15");
+
+ var DUMMY_BASE = new URL(
+ false ? undefined : (0, _utils.getLocationOrigin)()
+ );
/**
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
* (e.g. `./hello`) then at least base must be.
- * Absolute urls are rejected.
+ * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
+ * the current origin will be parsed as relative
*/
function parseRelativeUrl(url, base) {
var resolvedBase = base ? new URL(base, DUMMY_BASE) : DUMMY_BASE;
- var { pathname, searchParams, search, hash, href, origin } = new URL(
- url,
- resolvedBase
- );
+ var {
+ pathname,
+ searchParams,
+ search,
+ hash,
+ href,
+ origin,
+ protocol
+ } = new URL(url, resolvedBase);
- if (origin !== DUMMY_BASE.origin) {
+ if (
+ origin !== DUMMY_BASE.origin ||
+ (protocol !== "http:" && protocol !== "https:")
+ ) {
throw new Error("invariant: invalid relative URL");
}
Diff for 677f882d2ed8..edee4bd72.js
@@ -734,13 +734,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
typeof href === "string"
? href
: (0, _utils.formatWithValidation)(href);
- var finalUrl = new URL(urlAsString, base);
- finalUrl.pathname = (0,
- _normalizeTrailingSlash.normalizePathTrailingSlash)(finalUrl.pathname); // if the origin didn't change, it means we received a relative href
- return finalUrl.origin === base.origin
- ? finalUrl.href.slice(finalUrl.origin.length)
- : finalUrl.href;
+ try {
+ var finalUrl = new URL(urlAsString, base);
+ finalUrl.pathname = (0,
+ _normalizeTrailingSlash.normalizePathTrailingSlash)(
+ finalUrl.pathname
+ ); // if the origin didn't change, it means we received a relative href
+
+ return finalUrl.origin === base.origin
+ ? finalUrl.href.slice(finalUrl.origin.length)
+ : finalUrl.href;
+ } catch (_) {
+ return urlAsString;
+ }
}
function prepareUrlAs(router, url, as) {
@@ -1092,6 +1099,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
while (1) {
switch ((_context.prev = _context.next)) {
case 0:
+ if ((0, _utils.isLocalURL)(url)) {
+ _context.next = 3;
+ break;
+ }
+
+ window.location.href = url;
+ return _context.abrupt("return", false);
+
+ case 3:
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1114,7 +1130,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (
!(!options._h && this.onlyAHashChange(cleanedAs))
) {
- _context.next = 12;
+ _context.next = 15;
break;
}
@@ -1125,17 +1141,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
Router.events.emit("hashChangeComplete", as);
return _context.abrupt("return", true);
- case 12:
+ case 15:
parsed = tryParseRelativeUrl(url);
if (parsed) {
- _context.next = 15;
+ _context.next = 18;
break;
}
return _context.abrupt("return", false);
- case 15:
+ case 18:
(pathname = parsed.pathname),
(searchParams = parsed.searchParams);
query = (0,
@@ -1171,7 +1187,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
: _options$shallow);
if (!(0, _isDynamic.isDynamicRoute)(route)) {
- _context.next = 33;
+ _context.next = 36;
break;
}
@@ -1185,7 +1201,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)(asPathname);
if (routeMatch) {
- _context.next = 32;
+ _context.next = 35;
break;
}
@@ -1196,7 +1212,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
});
if (!(missingParams.length > 0)) {
- _context.next = 30;
+ _context.next = 33;
break;
}
@@ -1213,18 +1229,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
"Read more: https://err.sh/vercel/next.js/incompatible-href-as"
);
- case 30:
- _context.next = 33;
+ case 33:
+ _context.next = 36;
break;
- case 32:
+ case 35:
// Merge params into `query`, overwriting any specified in search
Object.assign(query, routeMatch);
- case 33:
+ case 36:
Router.events.emit("routeChangeStart", as);
- _context.prev = 34;
- _context.next = 37;
+ _context.prev = 37;
+ _context.next = 40;
return this.getRouteInfo(
route,
pathname,
@@ -1233,7 +1249,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
shallow
);
- case 37:
+ case 40:
routeInfo = _context.sent;
error = routeInfo.error;
Router.events.emit("beforeHistoryChange", as);
@@ -1242,7 +1258,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (false) {
}
- _context.next = 44;
+ _context.next = 47;
return this.set(
route,
pathname,
@@ -1251,9 +1267,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
routeInfo
);
- case 44:
+ case 47:
if (!error) {
- _context.next = 47;
+ _context.next = 50;
break;
}
@@ -1264,28 +1280,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 47:
+ case 50:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 52:
- _context.prev = 52;
- _context.t0 = _context["catch"](34);
+ case 55:
+ _context.prev = 55;
+ _context.t0 = _context["catch"](37);
if (!_context.t0.cancelled) {
- _context.next = 56;
+ _context.next = 59;
break;
}
return _context.abrupt("return", false);
- case 56:
+ case 59:
throw _context.t0;
- case 57:
+ case 60:
case "end":
return _context.stop();
}
@@ -1293,7 +1309,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[34, 52]]
+ [[37, 55]]
);
})
);
@@ -1969,6 +1985,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.execOnce = execOnce;
exports.getLocationOrigin = getLocationOrigin;
exports.getURL = getURL;
+ exports.isLocalURL = isLocalURL;
exports.getDisplayName = getDisplayName;
exports.isResSent = isResSent;
exports.loadGetInitialProps = loadGetInitialProps;
@@ -2009,6 +2026,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var origin = getLocationOrigin();
return href.substring(origin.length);
}
+ /**
+ * Detects whether a given url is from the same origin as the current page (browser only).
+ */
+
+ function isLocalURL(url) {
+ var locationOrigin = getLocationOrigin();
+
+ try {
+ var resolved = new URL(url, locationOrigin);
+ return resolved.origin === locationOrigin;
+ } catch (_) {
+ return false;
+ }
+ }
function getDisplayName(Component) {
return typeof Component === "string"
@@ -2212,11 +2243,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.__esModule = true;
exports.parseRelativeUrl = parseRelativeUrl;
- var DUMMY_BASE = new URL("http://n");
+
+ var _utils = __webpack_require__("g/15");
+
+ var DUMMY_BASE = new URL(
+ false ? undefined : (0, _utils.getLocationOrigin)()
+ );
/**
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
* (e.g. `./hello`) then at least base must be.
- * Absolute urls are rejected.
+ * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
+ * the current origin will be parsed as relative
*/
function parseRelativeUrl(url, base) {
@@ -2228,9 +2265,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
search = _URL.search,
hash = _URL.hash,
href = _URL.href,
- origin = _URL.origin;
+ origin = _URL.origin,
+ protocol = _URL.protocol;
- if (origin !== DUMMY_BASE.origin) {
+ if (
+ origin !== DUMMY_BASE.origin ||
+ (protocol !== "http:" && protocol !== "https:")
+ ) {
throw new Error("invariant: invalid relative URL");
}
Diff for index.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.9e7ecededb6e09eee062.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.122891db5801156d736f.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.9e7ecededb6e09eee062.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.9e7ecededb6e09eee062.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -36,7 +36,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ href="/_next/static/chunks/pages/link-3d53e6bdb171f5ab232b.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -122,13 +122,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.122891db5801156d736f.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.9e7ecededb6e09eee062.module.js"
async=""
crossorigin="anonymous"
type="module"
@@ -146,13 +146,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/pages/link-8da4738c6116755ac009.js"
+ src="/_next/static/chunks/pages/link-8a84b097b200144454dd.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ src="/_next/static/chunks/pages/link-3d53e6bdb171f5ab232b.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.9e7ecededb6e09eee062.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.122891db5801156d736f.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.9e7ecededb6e09eee062.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 13s | 13.2s | |
nodeModulesSize | 65.5 MB | 65.5 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-2b429aa..0b7b.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..8aba.js gzip | N/A | 10.2 kB | N/A |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-3cc11c4..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.19 kB | N/A |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-75..1629.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-6fc6437..e390.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -7 B |
Client Pages Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | N/A | N/A |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
link-fe64181..dule.js gzip | N/A | 1.26 kB | N/A |
Overall change | 5.36 kB | 5.37 kB |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 274 B | |
_buildManife..dule.js gzip | 280 B | 281 B | |
Overall change | 552 B | 555 B |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_error.js | 1.02 MB | 1.02 MB | |
404.html | 4.18 kB | 4.18 kB | ✓ |
hooks.html | 3.82 kB | 3.82 kB | ✓ |
index.js | 1.02 MB | 1.02 MB | |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.05 MB | 1.05 MB | |
withRouter.js | 1.05 MB | 1.05 MB | |
Overall change | 5.2 MB | 5.2 MB |
Failing test suitesCommit: aa93552 test/integration/size-limit/test/index.test.js
Expand output● Production response size › should not increase the overall response size of modern build
|
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 12.5s | 12.6s | |
nodeModulesSize | 65.5 MB | 65.5 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.197 | 2.266 | |
/ avg req/sec | 1138.03 | 1103.21 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.293 | 1.286 | -0.01 |
/error-in-render avg req/sec | 1933.21 | 1944.58 | +11.37 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | 10.2 kB | |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-2b429aa..0b7b.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | 6.19 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-3cc11c4..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-75..1629.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-6fc6437..e390.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -7 B |
Client Pages Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | N/A | N/A |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
link-fe64181..dule.js gzip | N/A | 1.26 kB | N/A |
Overall change | 5.36 kB | 5.37 kB |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 274 B | |
_buildManife..dule.js gzip | 280 B | 281 B | |
Overall change | 552 B | 555 B |
Rendered Page Sizes Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
index.html gzip | 947 B | 947 B | ✓ |
link.html gzip | 953 B | 954 B | |
withRouter.html gzip | 939 B | 940 B | |
Overall change | 2.84 kB | 2.84 kB |
Diffs
Diff for _buildManifest.js
@@ -6,7 +6,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-8da4738c6116755ac009.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-8a84b097b200144454dd.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
],
Diff for _buildManifest.module.js
@@ -9,7 +9,7 @@ self.__BUILD_MANIFEST = {
"static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
],
"/link": [
- "static\u002Fchunks\u002Fpages\u002Flink-b09795acaca5a197a6f6.module.js"
+ "static\u002Fchunks\u002Fpages\u002Flink-3d53e6bdb171f5ab232b.module.js"
],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-8da4738..6755ac009.js
@@ -81,15 +81,6 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var _router = __webpack_require__("nOHt");
var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
-
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
var cachedObserver;
var listeners = new Map();
@@ -150,7 +141,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _utils.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -163,28 +155,28 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
prefetched[href + "%" + as] = true;
}
+ function isNewTabRequest(event) {
+ var target = event.currentTarget.target;
+ return (
+ (target && target !== "_self") ||
+ event.metaKey ||
+ event.ctrlKey ||
+ event.shiftKey ||
+ (event.nativeEvent && event.nativeEvent.which === 2)
+ );
+ }
+
function linkClicked(e, router, href, as, replace, shallow, scroll) {
- var _e$currentTarget = e.currentTarget,
- nodeName = _e$currentTarget.nodeName,
- target = _e$currentTarget.target;
+ var nodeName = e.currentTarget.nodeName;
if (
nodeName === "A" &&
- ((target && target !== "_self") ||
- e.metaKey ||
- e.ctrlKey ||
- e.shiftKey ||
- (e.nativeEvent && e.nativeEvent.which === 2))
+ (isNewTabRequest(e) || !(0, _utils.isLocalURL)(href))
) {
// ignore click for new tab / new window behavior
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -238,7 +230,13 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
_react["default"].useEffect(
function() {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _utils.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -291,6 +289,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
if (p) {
childProps.onMouseEnter = function(e) {
+ if (!(0, _utils.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
Diff for link-b09795a..f6.module.js
@@ -77,15 +77,6 @@
var _router = __webpack_require__("nOHt");
var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
-
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
var cachedObserver;
var listeners = new Map();
@@ -146,7 +137,8 @@
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _utils.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -159,26 +151,28 @@
prefetched[href + "%" + as] = true;
}
+ function isNewTabRequest(event) {
+ var { target } = event.currentTarget;
+ return (
+ (target && target !== "_self") ||
+ event.metaKey ||
+ event.ctrlKey ||
+ event.shiftKey ||
+ (event.nativeEvent && event.nativeEvent.which === 2)
+ );
+ }
+
function linkClicked(e, router, href, as, replace, shallow, scroll) {
- var { nodeName, target } = e.currentTarget;
+ var { nodeName } = e.currentTarget;
if (
nodeName === "A" &&
- ((target && target !== "_self") ||
- e.metaKey ||
- e.ctrlKey ||
- e.shiftKey ||
- (e.nativeEvent && e.nativeEvent.which === 2))
+ (isNewTabRequest(e) || !(0, _utils.isLocalURL)(href))
) {
// ignore click for new tab / new window behavior
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -220,7 +214,13 @@
}, [pathname, props.href, props.as]);
_react.default.useEffect(() => {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _utils.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -268,6 +268,8 @@
if (p) {
childProps.onMouseEnter = e => {
+ if (!(0, _utils.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
Diff for 677f882d2ed8..5d.module.js
@@ -603,13 +603,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
typeof href === "string"
? href
: (0, _utils.formatWithValidation)(href);
- var finalUrl = new URL(urlAsString, base);
- finalUrl.pathname = (0,
- _normalizeTrailingSlash.normalizePathTrailingSlash)(finalUrl.pathname); // if the origin didn't change, it means we received a relative href
- return finalUrl.origin === base.origin
- ? finalUrl.href.slice(finalUrl.origin.length)
- : finalUrl.href;
+ try {
+ var finalUrl = new URL(urlAsString, base);
+ finalUrl.pathname = (0,
+ _normalizeTrailingSlash.normalizePathTrailingSlash)(
+ finalUrl.pathname
+ ); // if the origin didn't change, it means we received a relative href
+
+ return finalUrl.origin === base.origin
+ ? finalUrl.href.slice(finalUrl.origin.length)
+ : finalUrl.href;
+ } catch (_) {
+ return urlAsString;
+ }
}
function prepareUrlAs(router, url, as) {
@@ -899,6 +906,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
async change(method, url, as, options) {
+ if (!(0, _utils.isLocalURL)(url)) {
+ window.location.href = url;
+ return false;
+ }
+
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1365,6 +1377,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.execOnce = execOnce;
exports.getLocationOrigin = getLocationOrigin;
exports.getURL = getURL;
+ exports.isLocalURL = isLocalURL;
exports.getDisplayName = getDisplayName;
exports.isResSent = isResSent;
exports.loadGetInitialProps = loadGetInitialProps;
@@ -1402,6 +1415,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var origin = getLocationOrigin();
return href.substring(origin.length);
}
+ /**
+ * Detects whether a given url is from the same origin as the current page (browser only).
+ */
+
+ function isLocalURL(url) {
+ var locationOrigin = getLocationOrigin();
+
+ try {
+ var resolved = new URL(url, locationOrigin);
+ return resolved.origin === locationOrigin;
+ } catch (_) {
+ return false;
+ }
+ }
function getDisplayName(Component) {
return typeof Component === "string"
@@ -1538,21 +1565,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.__esModule = true;
exports.parseRelativeUrl = parseRelativeUrl;
- var DUMMY_BASE = new URL("http://n");
+
+ var _utils = __webpack_require__("g/15");
+
+ var DUMMY_BASE = new URL(
+ false ? undefined : (0, _utils.getLocationOrigin)()
+ );
/**
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
* (e.g. `./hello`) then at least base must be.
- * Absolute urls are rejected.
+ * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
+ * the current origin will be parsed as relative
*/
function parseRelativeUrl(url, base) {
var resolvedBase = base ? new URL(base, DUMMY_BASE) : DUMMY_BASE;
- var { pathname, searchParams, search, hash, href, origin } = new URL(
- url,
- resolvedBase
- );
+ var {
+ pathname,
+ searchParams,
+ search,
+ hash,
+ href,
+ origin,
+ protocol
+ } = new URL(url, resolvedBase);
- if (origin !== DUMMY_BASE.origin) {
+ if (
+ origin !== DUMMY_BASE.origin ||
+ (protocol !== "http:" && protocol !== "https:")
+ ) {
throw new Error("invariant: invalid relative URL");
}
Diff for 677f882d2ed8..edee4bd72.js
@@ -734,13 +734,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
typeof href === "string"
? href
: (0, _utils.formatWithValidation)(href);
- var finalUrl = new URL(urlAsString, base);
- finalUrl.pathname = (0,
- _normalizeTrailingSlash.normalizePathTrailingSlash)(finalUrl.pathname); // if the origin didn't change, it means we received a relative href
- return finalUrl.origin === base.origin
- ? finalUrl.href.slice(finalUrl.origin.length)
- : finalUrl.href;
+ try {
+ var finalUrl = new URL(urlAsString, base);
+ finalUrl.pathname = (0,
+ _normalizeTrailingSlash.normalizePathTrailingSlash)(
+ finalUrl.pathname
+ ); // if the origin didn't change, it means we received a relative href
+
+ return finalUrl.origin === base.origin
+ ? finalUrl.href.slice(finalUrl.origin.length)
+ : finalUrl.href;
+ } catch (_) {
+ return urlAsString;
+ }
}
function prepareUrlAs(router, url, as) {
@@ -1092,6 +1099,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
while (1) {
switch ((_context.prev = _context.next)) {
case 0:
+ if ((0, _utils.isLocalURL)(url)) {
+ _context.next = 3;
+ break;
+ }
+
+ window.location.href = url;
+ return _context.abrupt("return", false);
+
+ case 3:
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1114,7 +1130,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (
!(!options._h && this.onlyAHashChange(cleanedAs))
) {
- _context.next = 12;
+ _context.next = 15;
break;
}
@@ -1125,17 +1141,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
Router.events.emit("hashChangeComplete", as);
return _context.abrupt("return", true);
- case 12:
+ case 15:
parsed = tryParseRelativeUrl(url);
if (parsed) {
- _context.next = 15;
+ _context.next = 18;
break;
}
return _context.abrupt("return", false);
- case 15:
+ case 18:
(pathname = parsed.pathname),
(searchParams = parsed.searchParams);
query = (0,
@@ -1171,7 +1187,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
: _options$shallow);
if (!(0, _isDynamic.isDynamicRoute)(route)) {
- _context.next = 33;
+ _context.next = 36;
break;
}
@@ -1185,7 +1201,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)(asPathname);
if (routeMatch) {
- _context.next = 32;
+ _context.next = 35;
break;
}
@@ -1196,7 +1212,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
});
if (!(missingParams.length > 0)) {
- _context.next = 30;
+ _context.next = 33;
break;
}
@@ -1213,18 +1229,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
"Read more: https://err.sh/vercel/next.js/incompatible-href-as"
);
- case 30:
- _context.next = 33;
+ case 33:
+ _context.next = 36;
break;
- case 32:
+ case 35:
// Merge params into `query`, overwriting any specified in search
Object.assign(query, routeMatch);
- case 33:
+ case 36:
Router.events.emit("routeChangeStart", as);
- _context.prev = 34;
- _context.next = 37;
+ _context.prev = 37;
+ _context.next = 40;
return this.getRouteInfo(
route,
pathname,
@@ -1233,7 +1249,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
shallow
);
- case 37:
+ case 40:
routeInfo = _context.sent;
error = routeInfo.error;
Router.events.emit("beforeHistoryChange", as);
@@ -1242,7 +1258,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (false) {
}
- _context.next = 44;
+ _context.next = 47;
return this.set(
route,
pathname,
@@ -1251,9 +1267,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
routeInfo
);
- case 44:
+ case 47:
if (!error) {
- _context.next = 47;
+ _context.next = 50;
break;
}
@@ -1264,28 +1280,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 47:
+ case 50:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 52:
- _context.prev = 52;
- _context.t0 = _context["catch"](34);
+ case 55:
+ _context.prev = 55;
+ _context.t0 = _context["catch"](37);
if (!_context.t0.cancelled) {
- _context.next = 56;
+ _context.next = 59;
break;
}
return _context.abrupt("return", false);
- case 56:
+ case 59:
throw _context.t0;
- case 57:
+ case 60:
case "end":
return _context.stop();
}
@@ -1293,7 +1309,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[34, 52]]
+ [[37, 55]]
);
})
);
@@ -1969,6 +1985,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.execOnce = execOnce;
exports.getLocationOrigin = getLocationOrigin;
exports.getURL = getURL;
+ exports.isLocalURL = isLocalURL;
exports.getDisplayName = getDisplayName;
exports.isResSent = isResSent;
exports.loadGetInitialProps = loadGetInitialProps;
@@ -2009,6 +2026,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
var origin = getLocationOrigin();
return href.substring(origin.length);
}
+ /**
+ * Detects whether a given url is from the same origin as the current page (browser only).
+ */
+
+ function isLocalURL(url) {
+ var locationOrigin = getLocationOrigin();
+
+ try {
+ var resolved = new URL(url, locationOrigin);
+ return resolved.origin === locationOrigin;
+ } catch (_) {
+ return false;
+ }
+ }
function getDisplayName(Component) {
return typeof Component === "string"
@@ -2212,11 +2243,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.__esModule = true;
exports.parseRelativeUrl = parseRelativeUrl;
- var DUMMY_BASE = new URL("http://n");
+
+ var _utils = __webpack_require__("g/15");
+
+ var DUMMY_BASE = new URL(
+ false ? undefined : (0, _utils.getLocationOrigin)()
+ );
/**
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
* (e.g. `./hello`) then at least base must be.
- * Absolute urls are rejected.
+ * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
+ * the current origin will be parsed as relative
*/
function parseRelativeUrl(url, base) {
@@ -2228,9 +2265,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
search = _URL.search,
hash = _URL.hash,
href = _URL.href,
- origin = _URL.origin;
+ origin = _URL.origin,
+ protocol = _URL.protocol;
- if (origin !== DUMMY_BASE.origin) {
+ if (
+ origin !== DUMMY_BASE.origin ||
+ (protocol !== "http:" && protocol !== "https:")
+ ) {
throw new Error("invariant: invalid relative URL");
}
Diff for index.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.9e7ecededb6e09eee062.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.122891db5801156d736f.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.9e7ecededb6e09eee062.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.9e7ecededb6e09eee062.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -36,7 +36,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ href="/_next/static/chunks/pages/link-3d53e6bdb171f5ab232b.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -122,13 +122,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.122891db5801156d736f.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.9e7ecededb6e09eee062.module.js"
async=""
crossorigin="anonymous"
type="module"
@@ -146,13 +146,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/pages/link-8da4738c6116755ac009.js"
+ src="/_next/static/chunks/pages/link-8a84b097b200144454dd.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ src="/_next/static/chunks/pages/link-3d53e6bdb171f5ab232b.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.9e7ecededb6e09eee062.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.122891db5801156d736f.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.9e7ecededb6e09eee062.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 13.5s | 13.9s | |
nodeModulesSize | 65.5 MB | 65.5 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-2b429aa..0b7b.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..8aba.js gzip | N/A | 10.2 kB | N/A |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-3cc11c4..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.19 kB | N/A |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-75..1629.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-6fc6437..e390.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -7 B |
Client Pages Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | N/A | N/A |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
link-fe64181..dule.js gzip | N/A | 1.26 kB | N/A |
Overall change | 5.36 kB | 5.37 kB |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 274 B | |
_buildManife..dule.js gzip | 280 B | 281 B | |
Overall change | 552 B | 555 B |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_error.js | 1.02 MB | 1.02 MB | |
404.html | 4.18 kB | 4.18 kB | ✓ |
hooks.html | 3.82 kB | 3.82 kB | ✓ |
index.js | 1.02 MB | 1.02 MB | |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.05 MB | 1.05 MB | |
withRouter.js | 1.05 MB | 1.05 MB | |
Overall change | 5.2 MB | 5.2 MB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking due to bug
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 12.4s | 12.9s | |
nodeModulesSize | 66 MB | 66 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.247 | 2.306 | |
/ avg req/sec | 1112.45 | 1083.93 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.238 | 1.252 | |
/error-in-render avg req/sec | 2019.5 | 1997.02 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | 10.3 kB | |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-76d73eb..95d8.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | 6.21 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-0b6ca7d..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-75..1629.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-f4d2979..e57b.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -6 B |
Client Pages Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | N/A | N/A |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
link-653c74f..dule.js gzip | N/A | 1.26 kB | N/A |
Overall change | 5.36 kB | 5.37 kB |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 273 B | |
_buildManife..dule.js gzip | 280 B | 280 B | ✓ |
Overall change | 552 B | 553 B |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
index.html gzip | 945 B | 945 B | ✓ |
link.html gzip | 953 B | 952 B | -1 B |
withRouter.html gzip | 939 B | 939 B | ✓ |
Overall change | 2.84 kB | 2.84 kB | -1 B |
Diffs
Diff for _buildManifest.js
@@ -6,7 +6,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-8da4738c6116755ac009.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-39e004206883f7d406ca.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
],
Diff for _buildManifest.module.js
@@ -9,7 +9,7 @@ self.__BUILD_MANIFEST = {
"static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
],
"/link": [
- "static\u002Fchunks\u002Fpages\u002Flink-b09795acaca5a197a6f6.module.js"
+ "static\u002Fchunks\u002Fpages\u002Flink-e9ad83832d32f405f5bb.module.js"
],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-8da4738..6755ac009.js
@@ -76,20 +76,11 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var _react = _interopRequireWildcard(__webpack_require__("q1tI"));
- var _utils = __webpack_require__("g/15");
-
- var _router = __webpack_require__("nOHt");
+ var _router = __webpack_require__("elyg");
- var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
+ var _utils = __webpack_require__("g/15");
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
+ var _router2 = __webpack_require__("nOHt");
var cachedObserver;
var listeners = new Map();
@@ -150,7 +141,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _router.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -163,28 +155,28 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
prefetched[href + "%" + as] = true;
}
+ function isNewTabRequest(event) {
+ var target = event.currentTarget.target;
+ return (
+ (target && target !== "_self") ||
+ event.metaKey ||
+ event.ctrlKey ||
+ event.shiftKey ||
+ (event.nativeEvent && event.nativeEvent.which === 2)
+ );
+ }
+
function linkClicked(e, router, href, as, replace, shallow, scroll) {
- var _e$currentTarget = e.currentTarget,
- nodeName = _e$currentTarget.nodeName,
- target = _e$currentTarget.target;
+ var nodeName = e.currentTarget.nodeName;
if (
nodeName === "A" &&
- ((target && target !== "_self") ||
- e.metaKey ||
- e.ctrlKey ||
- e.shiftKey ||
- (e.nativeEvent && e.nativeEvent.which === 2))
+ (isNewTabRequest(e) || !(0, _router.isLocalURL)(href))
) {
// ignore click for new tab / new window behavior
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -215,19 +207,16 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
childElm = _react$default$useSta2[0],
setChildElm = _react$default$useSta2[1];
- var router = (0, _router.useRouter)();
+ var router = (0, _router2.useRouter)();
var pathname = (router && router.pathname) || "/";
var _react$default$useMem = _react["default"].useMemo(
function() {
- var resolvedHref = (0, _router2.resolveHref)(
- pathname,
- props.href
- );
+ var resolvedHref = (0, _router.resolveHref)(pathname, props.href);
return {
href: resolvedHref,
as: props.as
- ? (0, _router2.resolveHref)(pathname, props.as)
+ ? (0, _router.resolveHref)(pathname, props.as)
: resolvedHref
};
},
@@ -238,7 +227,13 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
_react["default"].useEffect(
function() {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _router.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -291,6 +286,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
if (p) {
childProps.onMouseEnter = function(e) {
+ if (!(0, _router.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
@@ -306,7 +303,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
props.passHref ||
(child.type === "a" && !("href" in child.props))
) {
- childProps.href = (0, _router2.addBasePath)(as);
+ childProps.href = (0, _router.addBasePath)(as);
}
return _react["default"].cloneElement(child, childProps);
Diff for link-b09795a..f6.module.js
@@ -72,20 +72,11 @@
var _react = _interopRequireWildcard(__webpack_require__("q1tI"));
- var _utils = __webpack_require__("g/15");
-
- var _router = __webpack_require__("nOHt");
+ var _router = __webpack_require__("elyg");
- var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
+ var _utils = __webpack_require__("g/15");
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
+ var _router2 = __webpack_require__("nOHt");
var cachedObserver;
var listeners = new Map();
@@ -146,7 +137,8 @@
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _router.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -159,26 +151,28 @@
prefetched[href + "%" + as] = true;
}
+ function isNewTabRequest(event) {
+ var { target } = event.currentTarget;
+ return (
+ (target && target !== "_self") ||
+ event.metaKey ||
+ event.ctrlKey ||
+ event.shiftKey ||
+ (event.nativeEvent && event.nativeEvent.which === 2)
+ );
+ }
+
function linkClicked(e, router, href, as, replace, shallow, scroll) {
- var { nodeName, target } = e.currentTarget;
+ var { nodeName } = e.currentTarget;
if (
nodeName === "A" &&
- ((target && target !== "_self") ||
- e.metaKey ||
- e.ctrlKey ||
- e.shiftKey ||
- (e.nativeEvent && e.nativeEvent.which === 2))
+ (isNewTabRequest(e) || !(0, _router.isLocalURL)(href))
) {
// ignore click for new tab / new window behavior
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -206,21 +200,27 @@
var [childElm, setChildElm] = _react.default.useState();
- var router = (0, _router.useRouter)();
+ var router = (0, _router2.useRouter)();
var pathname = (router && router.pathname) || "/";
var { href, as } = _react.default.useMemo(() => {
- var resolvedHref = (0, _router2.resolveHref)(pathname, props.href);
+ var resolvedHref = (0, _router.resolveHref)(pathname, props.href);
return {
href: resolvedHref,
as: props.as
- ? (0, _router2.resolveHref)(pathname, props.as)
+ ? (0, _router.resolveHref)(pathname, props.as)
: resolvedHref
};
}, [pathname, props.href, props.as]);
_react.default.useEffect(() => {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _router.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -268,6 +268,8 @@
if (p) {
childProps.onMouseEnter = e => {
+ if (!(0, _router.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
@@ -283,7 +285,7 @@
props.passHref ||
(child.type === "a" && !("href" in child.props))
) {
- childProps.href = (0, _router2.addBasePath)(as);
+ childProps.href = (0, _router.addBasePath)(as);
}
return _react.default.cloneElement(child, childProps);
Diff for 677f882d2ed8..5d.module.js
@@ -539,6 +539,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.hasBasePath = hasBasePath;
exports.addBasePath = addBasePath;
exports.delBasePath = delBasePath;
+ exports.isLocalURL = isLocalURL;
exports.resolveHref = resolveHref;
exports.default = void 0;
@@ -581,7 +582,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
function addBasePath(path) {
- return basePath
+ // we only add the basepath on relative urls
+ return basePath && path.startsWith("/")
? path === "/"
? (0, _normalizeTrailingSlash.normalizePathTrailingSlash)(basePath)
: basePath + path
@@ -591,6 +593,24 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
function delBasePath(path) {
return path.slice(basePath.length) || "/";
}
+ /**
+ * Detects whether a given url is routable by the Next.js router (browser only).
+ */
+
+ function isLocalURL(url) {
+ if (url.startsWith("/")) return true;
+
+ try {
+ // absolute urls can be local if they are on the same origin
+ var locationOrigin = (0, _utils.getLocationOrigin)();
+ var resolved = new URL(url, locationOrigin);
+ return (
+ resolved.origin === locationOrigin && hasBasePath(resolved.pathname)
+ );
+ } catch (_) {
+ return false;
+ }
+ }
/**
* Resolves a given hyperlink with a certain router state (basePath not included).
* Preserves absolute urls.
@@ -603,13 +623,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
typeof href === "string"
? href
: (0, _utils.formatWithValidation)(href);
- var finalUrl = new URL(urlAsString, base);
- finalUrl.pathname = (0,
- _normalizeTrailingSlash.normalizePathTrailingSlash)(finalUrl.pathname); // if the origin didn't change, it means we received a relative href
- return finalUrl.origin === base.origin
- ? finalUrl.href.slice(finalUrl.origin.length)
- : finalUrl.href;
+ try {
+ var finalUrl = new URL(urlAsString, base);
+ finalUrl.pathname = (0,
+ _normalizeTrailingSlash.normalizePathTrailingSlash)(
+ finalUrl.pathname
+ ); // if the origin didn't change, it means we received a relative href
+
+ return finalUrl.origin === base.origin
+ ? finalUrl.href.slice(finalUrl.origin.length)
+ : finalUrl.href;
+ } catch (_) {
+ return urlAsString;
+ }
}
function prepareUrlAs(router, url, as) {
@@ -899,6 +926,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
async change(method, url, as, options) {
+ if (!isLocalURL(url)) {
+ window.location.href = url;
+ return false;
+ }
+
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1538,21 +1570,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.__esModule = true;
exports.parseRelativeUrl = parseRelativeUrl;
- var DUMMY_BASE = new URL("http://n");
+
+ var _utils = __webpack_require__("g/15");
+
+ var DUMMY_BASE = new URL(
+ false ? undefined : (0, _utils.getLocationOrigin)()
+ );
/**
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
* (e.g. `./hello`) then at least base must be.
- * Absolute urls are rejected.
+ * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
+ * the current origin will be parsed as relative
*/
function parseRelativeUrl(url, base) {
var resolvedBase = base ? new URL(base, DUMMY_BASE) : DUMMY_BASE;
- var { pathname, searchParams, search, hash, href, origin } = new URL(
- url,
- resolvedBase
- );
+ var {
+ pathname,
+ searchParams,
+ search,
+ hash,
+ href,
+ origin,
+ protocol
+ } = new URL(url, resolvedBase);
- if (origin !== DUMMY_BASE.origin) {
+ if (
+ origin !== DUMMY_BASE.origin ||
+ (protocol !== "http:" && protocol !== "https:")
+ ) {
throw new Error("invariant: invalid relative URL");
}
Diff for 677f882d2ed8..edee4bd72.js
@@ -670,6 +670,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.hasBasePath = hasBasePath;
exports.addBasePath = addBasePath;
exports.delBasePath = delBasePath;
+ exports.isLocalURL = isLocalURL;
exports.resolveHref = resolveHref;
exports["default"] = void 0;
@@ -712,7 +713,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
function addBasePath(path) {
- return basePath
+ // we only add the basepath on relative urls
+ return basePath && path.startsWith("/")
? path === "/"
? (0, _normalizeTrailingSlash.normalizePathTrailingSlash)(basePath)
: basePath + path
@@ -722,6 +724,24 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
function delBasePath(path) {
return path.slice(basePath.length) || "/";
}
+ /**
+ * Detects whether a given url is routable by the Next.js router (browser only).
+ */
+
+ function isLocalURL(url) {
+ if (url.startsWith("/")) return true;
+
+ try {
+ // absolute urls can be local if they are on the same origin
+ var locationOrigin = (0, _utils.getLocationOrigin)();
+ var resolved = new URL(url, locationOrigin);
+ return (
+ resolved.origin === locationOrigin && hasBasePath(resolved.pathname)
+ );
+ } catch (_) {
+ return false;
+ }
+ }
/**
* Resolves a given hyperlink with a certain router state (basePath not included).
* Preserves absolute urls.
@@ -734,13 +754,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
typeof href === "string"
? href
: (0, _utils.formatWithValidation)(href);
- var finalUrl = new URL(urlAsString, base);
- finalUrl.pathname = (0,
- _normalizeTrailingSlash.normalizePathTrailingSlash)(finalUrl.pathname); // if the origin didn't change, it means we received a relative href
- return finalUrl.origin === base.origin
- ? finalUrl.href.slice(finalUrl.origin.length)
- : finalUrl.href;
+ try {
+ var finalUrl = new URL(urlAsString, base);
+ finalUrl.pathname = (0,
+ _normalizeTrailingSlash.normalizePathTrailingSlash)(
+ finalUrl.pathname
+ ); // if the origin didn't change, it means we received a relative href
+
+ return finalUrl.origin === base.origin
+ ? finalUrl.href.slice(finalUrl.origin.length)
+ : finalUrl.href;
+ } catch (_) {
+ return urlAsString;
+ }
}
function prepareUrlAs(router, url, as) {
@@ -1092,6 +1119,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
while (1) {
switch ((_context.prev = _context.next)) {
case 0:
+ if (isLocalURL(url)) {
+ _context.next = 3;
+ break;
+ }
+
+ window.location.href = url;
+ return _context.abrupt("return", false);
+
+ case 3:
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1114,7 +1150,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (
!(!options._h && this.onlyAHashChange(cleanedAs))
) {
- _context.next = 12;
+ _context.next = 15;
break;
}
@@ -1125,17 +1161,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
Router.events.emit("hashChangeComplete", as);
return _context.abrupt("return", true);
- case 12:
+ case 15:
parsed = tryParseRelativeUrl(url);
if (parsed) {
- _context.next = 15;
+ _context.next = 18;
break;
}
return _context.abrupt("return", false);
- case 15:
+ case 18:
(pathname = parsed.pathname),
(searchParams = parsed.searchParams);
query = (0,
@@ -1171,7 +1207,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
: _options$shallow);
if (!(0, _isDynamic.isDynamicRoute)(route)) {
- _context.next = 33;
+ _context.next = 36;
break;
}
@@ -1185,7 +1221,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)(asPathname);
if (routeMatch) {
- _context.next = 32;
+ _context.next = 35;
break;
}
@@ -1196,7 +1232,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
});
if (!(missingParams.length > 0)) {
- _context.next = 30;
+ _context.next = 33;
break;
}
@@ -1213,18 +1249,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
"Read more: https://err.sh/vercel/next.js/incompatible-href-as"
);
- case 30:
- _context.next = 33;
+ case 33:
+ _context.next = 36;
break;
- case 32:
+ case 35:
// Merge params into `query`, overwriting any specified in search
Object.assign(query, routeMatch);
- case 33:
+ case 36:
Router.events.emit("routeChangeStart", as);
- _context.prev = 34;
- _context.next = 37;
+ _context.prev = 37;
+ _context.next = 40;
return this.getRouteInfo(
route,
pathname,
@@ -1233,7 +1269,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
shallow
);
- case 37:
+ case 40:
routeInfo = _context.sent;
error = routeInfo.error;
Router.events.emit("beforeHistoryChange", as);
@@ -1242,7 +1278,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (false) {
}
- _context.next = 44;
+ _context.next = 47;
return this.set(
route,
pathname,
@@ -1251,9 +1287,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
routeInfo
);
- case 44:
+ case 47:
if (!error) {
- _context.next = 47;
+ _context.next = 50;
break;
}
@@ -1264,28 +1300,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 47:
+ case 50:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 52:
- _context.prev = 52;
- _context.t0 = _context["catch"](34);
+ case 55:
+ _context.prev = 55;
+ _context.t0 = _context["catch"](37);
if (!_context.t0.cancelled) {
- _context.next = 56;
+ _context.next = 59;
break;
}
return _context.abrupt("return", false);
- case 56:
+ case 59:
throw _context.t0;
- case 57:
+ case 60:
case "end":
return _context.stop();
}
@@ -1293,7 +1329,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[34, 52]]
+ [[37, 55]]
);
})
);
@@ -2212,11 +2248,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.__esModule = true;
exports.parseRelativeUrl = parseRelativeUrl;
- var DUMMY_BASE = new URL("http://n");
+
+ var _utils = __webpack_require__("g/15");
+
+ var DUMMY_BASE = new URL(
+ false ? undefined : (0, _utils.getLocationOrigin)()
+ );
/**
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
* (e.g. `./hello`) then at least base must be.
- * Absolute urls are rejected.
+ * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
+ * the current origin will be parsed as relative
*/
function parseRelativeUrl(url, base) {
@@ -2228,9 +2270,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
search = _URL.search,
hash = _URL.hash,
href = _URL.href,
- origin = _URL.origin;
+ origin = _URL.origin,
+ protocol = _URL.protocol;
- if (origin !== DUMMY_BASE.origin) {
+ if (
+ origin !== DUMMY_BASE.origin ||
+ (protocol !== "http:" && protocol !== "https:")
+ ) {
throw new Error("invariant: invalid relative URL");
}
Diff for index.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4411412e8e5469704f25.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5b321416a5cc54397d07.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4411412e8e5469704f25.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4411412e8e5469704f25.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -36,7 +36,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ href="/_next/static/chunks/pages/link-e9ad83832d32f405f5bb.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -122,13 +122,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5b321416a5cc54397d07.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4411412e8e5469704f25.module.js"
async=""
crossorigin="anonymous"
type="module"
@@ -146,13 +146,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/pages/link-8da4738c6116755ac009.js"
+ src="/_next/static/chunks/pages/link-39e004206883f7d406ca.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ src="/_next/static/chunks/pages/link-e9ad83832d32f405f5bb.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4411412e8e5469704f25.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5b321416a5cc54397d07.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4411412e8e5469704f25.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 14.1s | 14s | -89ms |
nodeModulesSize | 66 MB | 66 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-76d73eb..95d8.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..8895.js gzip | N/A | 10.3 kB | N/A |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-0b6ca7d..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.21 kB | N/A |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-75..1629.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-f4d2979..e57b.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -6 B |
Client Pages Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | N/A | N/A |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
link-653c74f..dule.js gzip | N/A | 1.26 kB | N/A |
Overall change | 5.36 kB | 5.37 kB |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 273 B | |
_buildManife..dule.js gzip | 280 B | 280 B | ✓ |
Overall change | 552 B | 553 B |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_error.js | 1.02 MB | 1.02 MB | ✓ |
404.html | 4.18 kB | 4.18 kB | ✓ |
hooks.html | 3.82 kB | 3.82 kB | ✓ |
index.js | 1.02 MB | 1.02 MB | ✓ |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.05 MB | 1.05 MB | |
withRouter.js | 1.05 MB | 1.05 MB | |
Overall change | 5.2 MB | 5.2 MB |
Stats from current PRDefault Server Mode (Increase detected
|
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 11.9s | 12.1s | |
nodeModulesSize | 66 MB | 66 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 2.142 | 2.211 | |
/ avg req/sec | 1167.14 | 1130.83 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.18 | 1.242 | |
/error-in-render avg req/sec | 2117.84 | 2013.27 |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | 10.3 kB | |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-76d73eb..95d8.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | 6.21 kB | |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-0b6ca7d..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-75..1629.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-f4d2979..e57b.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -6 B |
Client Pages Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | N/A | N/A |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
link-653c74f..dule.js gzip | N/A | 1.26 kB | N/A |
Overall change | 5.36 kB | 5.37 kB |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 273 B | |
_buildManife..dule.js gzip | 280 B | 280 B | ✓ |
Overall change | 552 B | 553 B |
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
index.html gzip | 945 B | 945 B | ✓ |
link.html gzip | 953 B | 952 B | -1 B |
withRouter.html gzip | 939 B | 939 B | ✓ |
Overall change | 2.84 kB | 2.84 kB | -1 B |
Diffs
Diff for _buildManifest.js
@@ -6,7 +6,7 @@ self.__BUILD_MANIFEST = {
"/hooks": [
"static\u002Fchunks\u002Fpages\u002Fhooks-8001dc76075832ee8949.js"
],
- "/link": ["static\u002Fchunks\u002Fpages\u002Flink-8da4738c6116755ac009.js"],
+ "/link": ["static\u002Fchunks\u002Fpages\u002Flink-39e004206883f7d406ca.js"],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-2e9bfd441bd88cd3382e.js"
],
Diff for _buildManifest.module.js
@@ -9,7 +9,7 @@ self.__BUILD_MANIFEST = {
"static\u002Fchunks\u002Fpages\u002Fhooks-56fa58a6f0993d7d36d7.module.js"
],
"/link": [
- "static\u002Fchunks\u002Fpages\u002Flink-b09795acaca5a197a6f6.module.js"
+ "static\u002Fchunks\u002Fpages\u002Flink-e9ad83832d32f405f5bb.module.js"
],
"/routerDirect": [
"static\u002Fchunks\u002Fpages\u002FrouterDirect-368af3dfef3c9cd99dc3.module.js"
Diff for link-8da4738..6755ac009.js
@@ -76,20 +76,11 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
var _react = _interopRequireWildcard(__webpack_require__("q1tI"));
- var _utils = __webpack_require__("g/15");
-
- var _router = __webpack_require__("nOHt");
+ var _router = __webpack_require__("elyg");
- var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
+ var _utils = __webpack_require__("g/15");
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
+ var _router2 = __webpack_require__("nOHt");
var cachedObserver;
var listeners = new Map();
@@ -150,7 +141,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _router.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -163,28 +155,28 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
prefetched[href + "%" + as] = true;
}
+ function isNewTabRequest(event) {
+ var target = event.currentTarget.target;
+ return (
+ (target && target !== "_self") ||
+ event.metaKey ||
+ event.ctrlKey ||
+ event.shiftKey ||
+ (event.nativeEvent && event.nativeEvent.which === 2)
+ );
+ }
+
function linkClicked(e, router, href, as, replace, shallow, scroll) {
- var _e$currentTarget = e.currentTarget,
- nodeName = _e$currentTarget.nodeName,
- target = _e$currentTarget.target;
+ var nodeName = e.currentTarget.nodeName;
if (
nodeName === "A" &&
- ((target && target !== "_self") ||
- e.metaKey ||
- e.ctrlKey ||
- e.shiftKey ||
- (e.nativeEvent && e.nativeEvent.which === 2))
+ (isNewTabRequest(e) || !(0, _router.isLocalURL)(href))
) {
// ignore click for new tab / new window behavior
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -215,19 +207,16 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
childElm = _react$default$useSta2[0],
setChildElm = _react$default$useSta2[1];
- var router = (0, _router.useRouter)();
+ var router = (0, _router2.useRouter)();
var pathname = (router && router.pathname) || "/";
var _react$default$useMem = _react["default"].useMemo(
function() {
- var resolvedHref = (0, _router2.resolveHref)(
- pathname,
- props.href
- );
+ var resolvedHref = (0, _router.resolveHref)(pathname, props.href);
return {
href: resolvedHref,
as: props.as
- ? (0, _router2.resolveHref)(pathname, props.as)
+ ? (0, _router.resolveHref)(pathname, props.as)
: resolvedHref
};
},
@@ -238,7 +227,13 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
_react["default"].useEffect(
function() {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _router.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -291,6 +286,8 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
if (p) {
childProps.onMouseEnter = function(e) {
+ if (!(0, _router.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
@@ -306,7 +303,7 @@ _N_E = (window["webpackJsonp_N_E"] = window["webpackJsonp_N_E"] || []).push([
props.passHref ||
(child.type === "a" && !("href" in child.props))
) {
- childProps.href = (0, _router2.addBasePath)(as);
+ childProps.href = (0, _router.addBasePath)(as);
}
return _react["default"].cloneElement(child, childProps);
Diff for link-b09795a..f6.module.js
@@ -72,20 +72,11 @@
var _react = _interopRequireWildcard(__webpack_require__("q1tI"));
- var _utils = __webpack_require__("g/15");
-
- var _router = __webpack_require__("nOHt");
+ var _router = __webpack_require__("elyg");
- var _router2 = __webpack_require__("elyg");
- /**
- * Detects whether a given url is from the same origin as the current page (browser only).
- */
+ var _utils = __webpack_require__("g/15");
- function isLocal(url) {
- var locationOrigin = (0, _utils.getLocationOrigin)();
- var resolved = new URL(url, locationOrigin);
- return resolved.origin === locationOrigin;
- }
+ var _router2 = __webpack_require__("nOHt");
var cachedObserver;
var listeners = new Map();
@@ -146,7 +137,8 @@
function prefetch(router, href, as, options) {
if (false) {
- } // Prefetch the JSON page if asked (only in the client)
+ }
+ if (!(0, _router.isLocalURL)(href)) return; // Prefetch the JSON page if asked (only in the client)
// We need to handle a prefetch error here since we may be
// loading with priority which can reject but we don't
// want to force navigation since this is only a prefetch
@@ -159,26 +151,28 @@
prefetched[href + "%" + as] = true;
}
+ function isNewTabRequest(event) {
+ var { target } = event.currentTarget;
+ return (
+ (target && target !== "_self") ||
+ event.metaKey ||
+ event.ctrlKey ||
+ event.shiftKey ||
+ (event.nativeEvent && event.nativeEvent.which === 2)
+ );
+ }
+
function linkClicked(e, router, href, as, replace, shallow, scroll) {
- var { nodeName, target } = e.currentTarget;
+ var { nodeName } = e.currentTarget;
if (
nodeName === "A" &&
- ((target && target !== "_self") ||
- e.metaKey ||
- e.ctrlKey ||
- e.shiftKey ||
- (e.nativeEvent && e.nativeEvent.which === 2))
+ (isNewTabRequest(e) || !(0, _router.isLocalURL)(href))
) {
// ignore click for new tab / new window behavior
return;
}
- if (!isLocal(href)) {
- // ignore click if it's outside our scope (e.g. https://google.com)
- return;
- }
-
e.preventDefault(); // avoid scroll for urls with anchor refs
if (scroll == null) {
@@ -206,21 +200,27 @@
var [childElm, setChildElm] = _react.default.useState();
- var router = (0, _router.useRouter)();
+ var router = (0, _router2.useRouter)();
var pathname = (router && router.pathname) || "/";
var { href, as } = _react.default.useMemo(() => {
- var resolvedHref = (0, _router2.resolveHref)(pathname, props.href);
+ var resolvedHref = (0, _router.resolveHref)(pathname, props.href);
return {
href: resolvedHref,
as: props.as
- ? (0, _router2.resolveHref)(pathname, props.as)
+ ? (0, _router.resolveHref)(pathname, props.as)
: resolvedHref
};
}, [pathname, props.href, props.as]);
_react.default.useEffect(() => {
- if (p && IntersectionObserver && childElm && childElm.tagName) {
+ if (
+ p &&
+ IntersectionObserver &&
+ childElm &&
+ childElm.tagName &&
+ (0, _router.isLocalURL)(href)
+ ) {
// Join on an invalid URI character
var isPrefetched = prefetched[href + "%" + as];
@@ -268,6 +268,8 @@
if (p) {
childProps.onMouseEnter = e => {
+ if (!(0, _router.isLocalURL)(href)) return;
+
if (child.props && typeof child.props.onMouseEnter === "function") {
child.props.onMouseEnter(e);
}
@@ -283,7 +285,7 @@
props.passHref ||
(child.type === "a" && !("href" in child.props))
) {
- childProps.href = (0, _router2.addBasePath)(as);
+ childProps.href = (0, _router.addBasePath)(as);
}
return _react.default.cloneElement(child, childProps);
Diff for 677f882d2ed8..5d.module.js
@@ -539,6 +539,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.hasBasePath = hasBasePath;
exports.addBasePath = addBasePath;
exports.delBasePath = delBasePath;
+ exports.isLocalURL = isLocalURL;
exports.resolveHref = resolveHref;
exports.default = void 0;
@@ -581,7 +582,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
function addBasePath(path) {
- return basePath
+ // we only add the basepath on relative urls
+ return basePath && path.startsWith("/")
? path === "/"
? (0, _normalizeTrailingSlash.normalizePathTrailingSlash)(basePath)
: basePath + path
@@ -591,6 +593,24 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
function delBasePath(path) {
return path.slice(basePath.length) || "/";
}
+ /**
+ * Detects whether a given url is routable by the Next.js router (browser only).
+ */
+
+ function isLocalURL(url) {
+ if (url.startsWith("/")) return true;
+
+ try {
+ // absolute urls can be local if they are on the same origin
+ var locationOrigin = (0, _utils.getLocationOrigin)();
+ var resolved = new URL(url, locationOrigin);
+ return (
+ resolved.origin === locationOrigin && hasBasePath(resolved.pathname)
+ );
+ } catch (_) {
+ return false;
+ }
+ }
/**
* Resolves a given hyperlink with a certain router state (basePath not included).
* Preserves absolute urls.
@@ -603,13 +623,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
typeof href === "string"
? href
: (0, _utils.formatWithValidation)(href);
- var finalUrl = new URL(urlAsString, base);
- finalUrl.pathname = (0,
- _normalizeTrailingSlash.normalizePathTrailingSlash)(finalUrl.pathname); // if the origin didn't change, it means we received a relative href
- return finalUrl.origin === base.origin
- ? finalUrl.href.slice(finalUrl.origin.length)
- : finalUrl.href;
+ try {
+ var finalUrl = new URL(urlAsString, base);
+ finalUrl.pathname = (0,
+ _normalizeTrailingSlash.normalizePathTrailingSlash)(
+ finalUrl.pathname
+ ); // if the origin didn't change, it means we received a relative href
+
+ return finalUrl.origin === base.origin
+ ? finalUrl.href.slice(finalUrl.origin.length)
+ : finalUrl.href;
+ } catch (_) {
+ return urlAsString;
+ }
}
function prepareUrlAs(router, url, as) {
@@ -899,6 +926,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
async change(method, url, as, options) {
+ if (!isLocalURL(url)) {
+ window.location.href = url;
+ return false;
+ }
+
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1538,21 +1570,35 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.__esModule = true;
exports.parseRelativeUrl = parseRelativeUrl;
- var DUMMY_BASE = new URL("http://n");
+
+ var _utils = __webpack_require__("g/15");
+
+ var DUMMY_BASE = new URL(
+ false ? undefined : (0, _utils.getLocationOrigin)()
+ );
/**
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
* (e.g. `./hello`) then at least base must be.
- * Absolute urls are rejected.
+ * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
+ * the current origin will be parsed as relative
*/
function parseRelativeUrl(url, base) {
var resolvedBase = base ? new URL(base, DUMMY_BASE) : DUMMY_BASE;
- var { pathname, searchParams, search, hash, href, origin } = new URL(
- url,
- resolvedBase
- );
+ var {
+ pathname,
+ searchParams,
+ search,
+ hash,
+ href,
+ origin,
+ protocol
+ } = new URL(url, resolvedBase);
- if (origin !== DUMMY_BASE.origin) {
+ if (
+ origin !== DUMMY_BASE.origin ||
+ (protocol !== "http:" && protocol !== "https:")
+ ) {
throw new Error("invariant: invalid relative URL");
}
Diff for 677f882d2ed8..edee4bd72.js
@@ -670,6 +670,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.hasBasePath = hasBasePath;
exports.addBasePath = addBasePath;
exports.delBasePath = delBasePath;
+ exports.isLocalURL = isLocalURL;
exports.resolveHref = resolveHref;
exports["default"] = void 0;
@@ -712,7 +713,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
}
function addBasePath(path) {
- return basePath
+ // we only add the basepath on relative urls
+ return basePath && path.startsWith("/")
? path === "/"
? (0, _normalizeTrailingSlash.normalizePathTrailingSlash)(basePath)
: basePath + path
@@ -722,6 +724,24 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
function delBasePath(path) {
return path.slice(basePath.length) || "/";
}
+ /**
+ * Detects whether a given url is routable by the Next.js router (browser only).
+ */
+
+ function isLocalURL(url) {
+ if (url.startsWith("/")) return true;
+
+ try {
+ // absolute urls can be local if they are on the same origin
+ var locationOrigin = (0, _utils.getLocationOrigin)();
+ var resolved = new URL(url, locationOrigin);
+ return (
+ resolved.origin === locationOrigin && hasBasePath(resolved.pathname)
+ );
+ } catch (_) {
+ return false;
+ }
+ }
/**
* Resolves a given hyperlink with a certain router state (basePath not included).
* Preserves absolute urls.
@@ -734,13 +754,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
typeof href === "string"
? href
: (0, _utils.formatWithValidation)(href);
- var finalUrl = new URL(urlAsString, base);
- finalUrl.pathname = (0,
- _normalizeTrailingSlash.normalizePathTrailingSlash)(finalUrl.pathname); // if the origin didn't change, it means we received a relative href
- return finalUrl.origin === base.origin
- ? finalUrl.href.slice(finalUrl.origin.length)
- : finalUrl.href;
+ try {
+ var finalUrl = new URL(urlAsString, base);
+ finalUrl.pathname = (0,
+ _normalizeTrailingSlash.normalizePathTrailingSlash)(
+ finalUrl.pathname
+ ); // if the origin didn't change, it means we received a relative href
+
+ return finalUrl.origin === base.origin
+ ? finalUrl.href.slice(finalUrl.origin.length)
+ : finalUrl.href;
+ } catch (_) {
+ return urlAsString;
+ }
}
function prepareUrlAs(router, url, as) {
@@ -1092,6 +1119,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
while (1) {
switch ((_context.prev = _context.next)) {
case 0:
+ if (isLocalURL(url)) {
+ _context.next = 3;
+ break;
+ }
+
+ window.location.href = url;
+ return _context.abrupt("return", false);
+
+ case 3:
if (!options._h) {
this.isSsr = false;
} // marking route changes as a navigation start entry
@@ -1114,7 +1150,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (
!(!options._h && this.onlyAHashChange(cleanedAs))
) {
- _context.next = 12;
+ _context.next = 15;
break;
}
@@ -1125,17 +1161,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
Router.events.emit("hashChangeComplete", as);
return _context.abrupt("return", true);
- case 12:
+ case 15:
parsed = tryParseRelativeUrl(url);
if (parsed) {
- _context.next = 15;
+ _context.next = 18;
break;
}
return _context.abrupt("return", false);
- case 15:
+ case 18:
(pathname = parsed.pathname),
(searchParams = parsed.searchParams);
query = (0,
@@ -1171,7 +1207,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
: _options$shallow);
if (!(0, _isDynamic.isDynamicRoute)(route)) {
- _context.next = 33;
+ _context.next = 36;
break;
}
@@ -1185,7 +1221,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
)(asPathname);
if (routeMatch) {
- _context.next = 32;
+ _context.next = 35;
break;
}
@@ -1196,7 +1232,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
});
if (!(missingParams.length > 0)) {
- _context.next = 30;
+ _context.next = 33;
break;
}
@@ -1213,18 +1249,18 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
"Read more: https://err.sh/vercel/next.js/incompatible-href-as"
);
- case 30:
- _context.next = 33;
+ case 33:
+ _context.next = 36;
break;
- case 32:
+ case 35:
// Merge params into `query`, overwriting any specified in search
Object.assign(query, routeMatch);
- case 33:
+ case 36:
Router.events.emit("routeChangeStart", as);
- _context.prev = 34;
- _context.next = 37;
+ _context.prev = 37;
+ _context.next = 40;
return this.getRouteInfo(
route,
pathname,
@@ -1233,7 +1269,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
shallow
);
- case 37:
+ case 40:
routeInfo = _context.sent;
error = routeInfo.error;
Router.events.emit("beforeHistoryChange", as);
@@ -1242,7 +1278,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
if (false) {
}
- _context.next = 44;
+ _context.next = 47;
return this.set(
route,
pathname,
@@ -1251,9 +1287,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
routeInfo
);
- case 44:
+ case 47:
if (!error) {
- _context.next = 47;
+ _context.next = 50;
break;
}
@@ -1264,28 +1300,28 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
);
throw error;
- case 47:
+ case 50:
if (false) {
}
Router.events.emit("routeChangeComplete", as);
return _context.abrupt("return", true);
- case 52:
- _context.prev = 52;
- _context.t0 = _context["catch"](34);
+ case 55:
+ _context.prev = 55;
+ _context.t0 = _context["catch"](37);
if (!_context.t0.cancelled) {
- _context.next = 56;
+ _context.next = 59;
break;
}
return _context.abrupt("return", false);
- case 56:
+ case 59:
throw _context.t0;
- case 57:
+ case 60:
case "end":
return _context.stop();
}
@@ -1293,7 +1329,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
},
_callee,
this,
- [[34, 52]]
+ [[37, 55]]
);
})
);
@@ -2212,11 +2248,17 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
exports.__esModule = true;
exports.parseRelativeUrl = parseRelativeUrl;
- var DUMMY_BASE = new URL("http://n");
+
+ var _utils = __webpack_require__("g/15");
+
+ var DUMMY_BASE = new URL(
+ false ? undefined : (0, _utils.getLocationOrigin)()
+ );
/**
* Parses path-relative urls (e.g. `/hello/world?foo=bar`). If url isn't path-relative
* (e.g. `./hello`) then at least base must be.
- * Absolute urls are rejected.
+ * Absolute urls are rejected with one exception, in the browser, absolute urls that are on
+ * the current origin will be parsed as relative
*/
function parseRelativeUrl(url, base) {
@@ -2228,9 +2270,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
search = _URL.search,
hash = _URL.hash,
href = _URL.href,
- origin = _URL.origin;
+ origin = _URL.origin,
+ protocol = _URL.protocol;
- if (origin !== DUMMY_BASE.origin) {
+ if (
+ origin !== DUMMY_BASE.origin ||
+ (protocol !== "http:" && protocol !== "https:")
+ ) {
throw new Error("invariant: invalid relative URL");
}
Diff for index.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4411412e8e5469704f25.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5b321416a5cc54397d07.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4411412e8e5469704f25.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for link.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4411412e8e5469704f25.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -36,7 +36,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ href="/_next/static/chunks/pages/link-e9ad83832d32f405f5bb.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -122,13 +122,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5b321416a5cc54397d07.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4411412e8e5469704f25.module.js"
async=""
crossorigin="anonymous"
type="module"
@@ -146,13 +146,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/pages/link-8da4738c6116755ac009.js"
+ src="/_next/static/chunks/pages/link-39e004206883f7d406ca.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/pages/link-b09795acaca5a197a6f6.module.js"
+ src="/_next/static/chunks/pages/link-e9ad83832d32f405f5bb.module.js"
async=""
crossorigin="anonymous"
type="module"
Diff for withRouter.html
@@ -24,7 +24,7 @@
/>
<link
rel="preload"
- href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ href="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4411412e8e5469704f25.module.js"
as="script"
crossorigin="anonymous"
/>
@@ -117,13 +117,13 @@
type="module"
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.a67cd39f9ededee4bd72.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.5b321416a5cc54397d07.js"
async=""
crossorigin="anonymous"
nomodule=""
></script>
<script
- src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.6bff464273db1759435d.module.js"
+ src="/_next/static/chunks/677f882d2ed86fa3467b8979053c1a4c3f8bc4df.4411412e8e5469704f25.module.js"
async=""
crossorigin="anonymous"
type="module"
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
buildDuration | 13.6s | 13.6s | |
nodeModulesSize | 66 MB | 66 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..afbf.js gzip | 10.2 kB | N/A | N/A |
framework.HASH.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-76d73eb..95d8.js gzip | 6.73 kB | 6.73 kB | ✓ |
webpack-ccf5..276a.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..8895.js gzip | N/A | 10.3 kB | N/A |
Overall change | 56.8 kB | 56.9 kB |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
677f882d2ed8..dule.js gzip | 6.11 kB | N/A | N/A |
framework.HA..dule.js gzip | 39.1 kB | 39.1 kB | ✓ |
main-0b6ca7d..dule.js gzip | 5.81 kB | 5.81 kB | ✓ |
webpack-10c7..dule.js gzip | 751 B | 751 B | ✓ |
677f882d2ed8..dule.js gzip | N/A | 6.21 kB | N/A |
Overall change | 51.8 kB | 51.9 kB |
Legacy Client Bundles (polyfills)
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
polyfills-75..1629.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages Overall decrease ✓
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-874bd8a..0103.js gzip | 1.28 kB | 1.28 kB | ✓ |
_error-fa39c..ec40.js gzip | 3.45 kB | 3.45 kB | ✓ |
hooks-585f07..95a3.js gzip | 887 B | 887 B | ✓ |
index-c7b63f..fc02.js gzip | 227 B | 227 B | ✓ |
link-e97733c..af21.js gzip | 1.3 kB | N/A | N/A |
routerDirect..ebc7.js gzip | 284 B | 284 B | ✓ |
withRouter-2..db68.js gzip | 284 B | 284 B | ✓ |
link-f4d2979..e57b.js gzip | N/A | 1.29 kB | N/A |
Overall change | 7.72 kB | 7.71 kB | -6 B |
Client Pages Modern Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_app-97e743e..dule.js gzip | 626 B | 626 B | ✓ |
_error-b4004..dule.js gzip | 2.3 kB | 2.3 kB | ✓ |
hooks-696209..dule.js gzip | 387 B | 387 B | ✓ |
index-a4dd74..dule.js gzip | 226 B | 226 B | ✓ |
link-fbb1d2e..dule.js gzip | 1.25 kB | N/A | N/A |
routerDirect..dule.js gzip | 284 B | 284 B | ✓ |
withRouter-1..dule.js gzip | 282 B | 282 B | ✓ |
link-653c74f..dule.js gzip | N/A | 1.26 kB | N/A |
Overall change | 5.36 kB | 5.37 kB |
Client Build Manifests Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_buildManifest.js gzip | 272 B | 273 B | |
_buildManife..dule.js gzip | 280 B | 280 B | ✓ |
Overall change | 552 B | 553 B |
Serverless bundles Overall increase ⚠️
vercel/next.js canary | Janpot/next.js abs-links | Change | |
---|---|---|---|
_error.js | 1.02 MB | 1.02 MB | ✓ |
404.html | 4.18 kB | 4.18 kB | ✓ |
hooks.html | 3.82 kB | 3.82 kB | ✓ |
index.js | 1.02 MB | 1.02 MB | ✓ |
link.js | 1.06 MB | 1.06 MB | |
routerDirect.js | 1.05 MB | 1.05 MB | |
withRouter.js | 1.05 MB | 1.05 MB | |
Overall change | 5.21 MB | 5.21 MB |
Fixes #15639
Fixes #15820
To Do:
basePath
yet