Initial commit

This commit is contained in:
bilulib
2025-04-13 00:18:57 +02:00
parent cff009bb7c
commit d894249e61
18301 changed files with 2905442 additions and 3845 deletions

View File

@@ -0,0 +1,77 @@
/* globals __webpack_hash__ */ import { displayContent } from './fouc';
import initOnDemandEntries from './on-demand-entries-client';
import { addMessageListener, connectHMR } from '../components/react-dev-overlay/pages/websocket';
import { HMR_ACTIONS_SENT_TO_BROWSER } from '../../server/dev/hot-reloader-types';
import { reportInvalidHmrMessage } from '../components/react-dev-overlay/shared';
/// <reference types="webpack/module.d.ts" />
const data = JSON.parse(document.getElementById('__NEXT_DATA__').textContent);
window.__NEXT_DATA__ = data;
let { assetPrefix, page } = data;
assetPrefix = assetPrefix || '';
let mostRecentHash = null;
/* eslint-disable-next-line */ let curHash = __webpack_hash__;
const hotUpdatePath = assetPrefix + (assetPrefix.endsWith('/') ? '' : '/') + '_next/static/webpack/';
// Is there a newer version of this code available?
function isUpdateAvailable() {
// __webpack_hash__ is the hash of the current compilation.
// It's a global variable injected by Webpack.
/* eslint-disable-next-line */ return mostRecentHash !== __webpack_hash__;
}
// Webpack disallows updates in other states.
function canApplyUpdates() {
return module.hot.status() === 'idle';
}
// This function reads code updates on the fly and hard
// reloads the page when it has changed.
async function tryApplyUpdates() {
if (!isUpdateAvailable() || !canApplyUpdates()) {
return;
}
try {
const res = await fetch(typeof __webpack_runtime_id__ !== 'undefined' ? "" + hotUpdatePath + curHash + "." + __webpack_runtime_id__ + ".hot-update.json" : "" + hotUpdatePath + curHash + ".hot-update.json");
const jsonData = await res.json();
const curPage = page === '/' ? 'index' : page;
// webpack 5 uses an array instead
const pageUpdated = (Array.isArray(jsonData.c) ? jsonData.c : Object.keys(jsonData.c)).some((mod)=>{
return mod.indexOf("pages" + (curPage.startsWith('/') ? curPage : "/" + curPage)) !== -1 || mod.indexOf(("pages" + (curPage.startsWith('/') ? curPage : "/" + curPage)).replace(/\//g, '\\')) !== -1;
});
if (pageUpdated) {
window.location.reload();
} else {
curHash = mostRecentHash;
}
} catch (err) {
console.error('Error occurred checking for update', err);
window.location.reload();
}
}
addMessageListener((message)=>{
if (!('action' in message)) {
return;
}
try {
// actions which are not related to amp-dev
if (message.action === HMR_ACTIONS_SENT_TO_BROWSER.SERVER_ERROR || message.action === HMR_ACTIONS_SENT_TO_BROWSER.DEV_PAGES_MANIFEST_UPDATE) {
return;
}
if (message.action === HMR_ACTIONS_SENT_TO_BROWSER.SYNC || message.action === HMR_ACTIONS_SENT_TO_BROWSER.BUILT) {
if (!message.hash) {
return;
}
mostRecentHash = message.hash;
tryApplyUpdates();
} else if (message.action === HMR_ACTIONS_SENT_TO_BROWSER.RELOAD_PAGE) {
window.location.reload();
}
} catch (err) {
reportInvalidHmrMessage(message, err);
}
});
connectHMR({
assetPrefix,
path: '/_next/webpack-hmr'
});
displayContent();
initOnDemandEntries(data.page);
//# sourceMappingURL=amp-dev.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
import { devBuildIndicator } from './internal/dev-build-indicator';
/** Integrates the generic dev build indicator with the App Router. */ export const initializeDevBuildIndicatorForAppRouter = ()=>{
if (!process.env.__NEXT_DEV_INDICATOR) {
return;
}
devBuildIndicator.initialize();
};
//# sourceMappingURL=initialize-for-app-router.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/client/dev/dev-build-indicator/initialize-for-app-router.ts"],"sourcesContent":["import { devBuildIndicator } from './internal/dev-build-indicator'\n\n/** Integrates the generic dev build indicator with the App Router. */\nexport const initializeDevBuildIndicatorForAppRouter = () => {\n if (!process.env.__NEXT_DEV_INDICATOR) {\n return\n }\n\n devBuildIndicator.initialize()\n}\n"],"names":["devBuildIndicator","initializeDevBuildIndicatorForAppRouter","process","env","__NEXT_DEV_INDICATOR","initialize"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,iCAAgC;AAElE,oEAAoE,GACpE,OAAO,MAAMC,0CAA0C;IACrD,IAAI,CAACC,QAAQC,GAAG,CAACC,oBAAoB,EAAE;QACrC;IACF;IAEAJ,kBAAkBK,UAAU;AAC9B,EAAC"}

View File

@@ -0,0 +1,14 @@
import { addMessageListener } from '../../components/react-dev-overlay/pages/websocket';
import { devBuildIndicator } from './internal/dev-build-indicator';
import { handleDevBuildIndicatorHmrEvents } from './internal/handle-dev-build-indicator-hmr-events';
/** Integrates the generic dev build indicator with the Pages Router. */ export const initializeDevBuildIndicatorForPageRouter = ()=>{
if (!process.env.__NEXT_DEV_INDICATOR) {
return;
}
devBuildIndicator.initialize();
// Add message listener specifically for Pages Router to handle lifecycle events
// related to dev builds (building, built, sync)
addMessageListener(handleDevBuildIndicatorHmrEvents);
};
//# sourceMappingURL=initialize-for-page-router.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/client/dev/dev-build-indicator/initialize-for-page-router.ts"],"sourcesContent":["import { addMessageListener } from '../../components/react-dev-overlay/pages/websocket'\nimport { devBuildIndicator } from './internal/dev-build-indicator'\nimport { handleDevBuildIndicatorHmrEvents } from './internal/handle-dev-build-indicator-hmr-events'\n\n/** Integrates the generic dev build indicator with the Pages Router. */\nexport const initializeDevBuildIndicatorForPageRouter = () => {\n if (!process.env.__NEXT_DEV_INDICATOR) {\n return\n }\n\n devBuildIndicator.initialize()\n\n // Add message listener specifically for Pages Router to handle lifecycle events\n // related to dev builds (building, built, sync)\n addMessageListener(handleDevBuildIndicatorHmrEvents)\n}\n"],"names":["addMessageListener","devBuildIndicator","handleDevBuildIndicatorHmrEvents","initializeDevBuildIndicatorForPageRouter","process","env","__NEXT_DEV_INDICATOR","initialize"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,qDAAoD;AACvF,SAASC,iBAAiB,QAAQ,iCAAgC;AAClE,SAASC,gCAAgC,QAAQ,mDAAkD;AAEnG,sEAAsE,GACtE,OAAO,MAAMC,2CAA2C;IACtD,IAAI,CAACC,QAAQC,GAAG,CAACC,oBAAoB,EAAE;QACrC;IACF;IAEAL,kBAAkBM,UAAU;IAE5B,gFAAgF;IAChF,gDAAgD;IAChDP,mBAAmBE;AACrB,EAAC"}

View File

@@ -0,0 +1,9 @@
import { initialize } from './initialize';
const NOOP = ()=>{};
export const devBuildIndicator = {
/** Shows build indicator when Next.js is compiling. Requires initialize() first. */ show: NOOP,
/** Hides build indicator when Next.js finishes compiling. Requires initialize() first. */ hide: NOOP,
/** Sets up the build indicator UI component. Call this before using show/hide. */ initialize
};
//# sourceMappingURL=dev-build-indicator.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/client/dev/dev-build-indicator/internal/dev-build-indicator.ts"],"sourcesContent":["import { initialize } from './initialize'\n\nconst NOOP = () => {}\n\nexport const devBuildIndicator = {\n /** Shows build indicator when Next.js is compiling. Requires initialize() first. */\n show: NOOP,\n /** Hides build indicator when Next.js finishes compiling. Requires initialize() first. */\n hide: NOOP,\n /** Sets up the build indicator UI component. Call this before using show/hide. */\n initialize,\n}\n"],"names":["initialize","NOOP","devBuildIndicator","show","hide"],"mappings":"AAAA,SAASA,UAAU,QAAQ,eAAc;AAEzC,MAAMC,OAAO,KAAO;AAEpB,OAAO,MAAMC,oBAAoB;IAC/B,kFAAkF,GAClFC,MAAMF;IACN,wFAAwF,GACxFG,MAAMH;IACN,gFAAgF,GAChFD;AACF,EAAC"}

View File

@@ -0,0 +1,24 @@
import { HMR_ACTIONS_SENT_TO_BROWSER } from '../../../../server/dev/hot-reloader-types';
import { devBuildIndicator } from './dev-build-indicator';
/**
* Handles HMR events to control the dev build indicator visibility.
* Shows indicator when building and hides it when build completes or syncs.
*/ export const handleDevBuildIndicatorHmrEvents = (obj)=>{
try {
if (!('action' in obj)) {
return;
}
// eslint-disable-next-line default-case
switch(obj.action){
case HMR_ACTIONS_SENT_TO_BROWSER.BUILDING:
devBuildIndicator.show();
break;
case HMR_ACTIONS_SENT_TO_BROWSER.BUILT:
case HMR_ACTIONS_SENT_TO_BROWSER.SYNC:
devBuildIndicator.hide();
break;
}
} catch (e) {}
};
//# sourceMappingURL=handle-dev-build-indicator-hmr-events.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/client/dev/dev-build-indicator/internal/handle-dev-build-indicator-hmr-events.ts"],"sourcesContent":["import {\n HMR_ACTIONS_SENT_TO_BROWSER,\n type HMR_ACTION_TYPES,\n} from '../../../../server/dev/hot-reloader-types'\nimport { devBuildIndicator } from './dev-build-indicator'\n\n/**\n * Handles HMR events to control the dev build indicator visibility.\n * Shows indicator when building and hides it when build completes or syncs.\n */\nexport const handleDevBuildIndicatorHmrEvents = (obj: HMR_ACTION_TYPES) => {\n try {\n if (!('action' in obj)) {\n return\n }\n\n // eslint-disable-next-line default-case\n switch (obj.action) {\n case HMR_ACTIONS_SENT_TO_BROWSER.BUILDING:\n devBuildIndicator.show()\n break\n case HMR_ACTIONS_SENT_TO_BROWSER.BUILT:\n case HMR_ACTIONS_SENT_TO_BROWSER.SYNC:\n devBuildIndicator.hide()\n break\n }\n } catch {}\n}\n"],"names":["HMR_ACTIONS_SENT_TO_BROWSER","devBuildIndicator","handleDevBuildIndicatorHmrEvents","obj","action","BUILDING","show","BUILT","SYNC","hide"],"mappings":"AAAA,SACEA,2BAA2B,QAEtB,4CAA2C;AAClD,SAASC,iBAAiB,QAAQ,wBAAuB;AAEzD;;;CAGC,GACD,OAAO,MAAMC,mCAAmC,CAACC;IAC/C,IAAI;QACF,IAAI,CAAE,CAAA,YAAYA,GAAE,GAAI;YACtB;QACF;QAEA,wCAAwC;QACxC,OAAQA,IAAIC,MAAM;YAChB,KAAKJ,4BAA4BK,QAAQ;gBACvCJ,kBAAkBK,IAAI;gBACtB;YACF,KAAKN,4BAA4BO,KAAK;YACtC,KAAKP,4BAA4BQ,IAAI;gBACnCP,kBAAkBQ,IAAI;gBACtB;QACJ;IACF,EAAE,UAAM,CAAC;AACX,EAAC"}

View File

@@ -0,0 +1,29 @@
/*
* Singleton store to track whether the app is currently being built
* Used by the dev tools indicator of the new overlay to show build status
*/ import { devBuildIndicator } from './dev-build-indicator';
import { useSyncExternalStore } from 'react';
let isVisible = false;
let listeners = [];
const subscribe = (listener)=>{
listeners.push(listener);
return ()=>{
listeners = listeners.filter((l)=>l !== listener);
};
};
const getSnapshot = ()=>isVisible;
export function useIsDevBuilding() {
return useSyncExternalStore(subscribe, getSnapshot);
}
export function initialize() {
devBuildIndicator.show = ()=>{
isVisible = true;
listeners.forEach((listener)=>listener());
};
devBuildIndicator.hide = ()=>{
isVisible = false;
listeners.forEach((listener)=>listener());
};
}
//# sourceMappingURL=initialize.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/client/dev/dev-build-indicator/internal/initialize.ts"],"sourcesContent":["/*\n * Singleton store to track whether the app is currently being built\n * Used by the dev tools indicator of the new overlay to show build status\n */\n\nimport { devBuildIndicator } from './dev-build-indicator'\nimport { useSyncExternalStore } from 'react'\n\nlet isVisible = false\nlet listeners: Array<() => void> = []\n\nconst subscribe = (listener: () => void) => {\n listeners.push(listener)\n return () => {\n listeners = listeners.filter((l) => l !== listener)\n }\n}\n\nconst getSnapshot = () => isVisible\n\nexport function useIsDevBuilding() {\n return useSyncExternalStore(subscribe, getSnapshot)\n}\n\nexport function initialize() {\n devBuildIndicator.show = () => {\n isVisible = true\n listeners.forEach((listener) => listener())\n }\n\n devBuildIndicator.hide = () => {\n isVisible = false\n listeners.forEach((listener) => listener())\n }\n}\n"],"names":["devBuildIndicator","useSyncExternalStore","isVisible","listeners","subscribe","listener","push","filter","l","getSnapshot","useIsDevBuilding","initialize","show","forEach","hide"],"mappings":"AAAA;;;CAGC,GAED,SAASA,iBAAiB,QAAQ,wBAAuB;AACzD,SAASC,oBAAoB,QAAQ,QAAO;AAE5C,IAAIC,YAAY;AAChB,IAAIC,YAA+B,EAAE;AAErC,MAAMC,YAAY,CAACC;IACjBF,UAAUG,IAAI,CAACD;IACf,OAAO;QACLF,YAAYA,UAAUI,MAAM,CAAC,CAACC,IAAMA,MAAMH;IAC5C;AACF;AAEA,MAAMI,cAAc,IAAMP;AAE1B,OAAO,SAASQ;IACd,OAAOT,qBAAqBG,WAAWK;AACzC;AAEA,OAAO,SAASE;IACdX,kBAAkBY,IAAI,GAAG;QACvBV,YAAY;QACZC,UAAUU,OAAO,CAAC,CAACR,WAAaA;IAClC;IAEAL,kBAAkBc,IAAI,GAAG;QACvBZ,YAAY;QACZC,UAAUU,OAAO,CAAC,CAACR,WAAaA;IAClC;AACF"}

View File

@@ -0,0 +1,6 @@
// next-contentlayer is relying on this internal path
// https://github.com/contentlayerdev/contentlayer/blob/2f491c540e1d3667577f57fa368b150bff427aaf/packages/next-contentlayer/src/hooks/useLiveReload.ts#L1
// Drop this file if https://github.com/contentlayerdev/contentlayer/pull/649 is merged/released
export { addMessageListener } from '../../components/react-dev-overlay/pages/websocket';
//# sourceMappingURL=websocket.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/client/dev/error-overlay/websocket.ts"],"sourcesContent":["// next-contentlayer is relying on this internal path\n// https://github.com/contentlayerdev/contentlayer/blob/2f491c540e1d3667577f57fa368b150bff427aaf/packages/next-contentlayer/src/hooks/useLiveReload.ts#L1\n// Drop this file if https://github.com/contentlayerdev/contentlayer/pull/649 is merged/released\nexport { addMessageListener } from '../../components/react-dev-overlay/pages/websocket'\n"],"names":["addMessageListener"],"mappings":"AAAA,qDAAqD;AACrD,yJAAyJ;AACzJ,gGAAgG;AAChG,SAASA,kBAAkB,QAAQ,qDAAoD"}

View File

@@ -0,0 +1,29 @@
// This wrapper function is used to safely select the best available function
// to schedule removal of the no-FOUC styles workaround. requestAnimationFrame
// is the ideal choice, but when used in iframes, there are no guarantees that
// the callback will actually be called, which could stall the promise returned
// from displayContent.
//
// See: https://www.vector-logic.com/blog/posts/on-request-animation-frame-and-embedded-iframes
const safeCallbackQueue = (callback)=>{
if (window.requestAnimationFrame && window.self === window.top) {
window.requestAnimationFrame(callback);
} else {
window.setTimeout(callback);
}
};
// This function is used to remove Next.js' no-FOUC styles workaround for using
// `style-loader` in development. It must be called before hydration, or else
// rendering won't have the correct computed values in effects.
export function displayContent() {
return new Promise((resolve)=>{
safeCallbackQueue(function() {
for(var x = document.querySelectorAll('[data-next-hide-fouc]'), i = x.length; i--;){
x[i].parentNode.removeChild(x[i]);
}
resolve();
});
});
}
//# sourceMappingURL=fouc.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/dev/fouc.ts"],"sourcesContent":["// This wrapper function is used to safely select the best available function\n// to schedule removal of the no-FOUC styles workaround. requestAnimationFrame\n// is the ideal choice, but when used in iframes, there are no guarantees that\n// the callback will actually be called, which could stall the promise returned\n// from displayContent.\n//\n// See: https://www.vector-logic.com/blog/posts/on-request-animation-frame-and-embedded-iframes\nconst safeCallbackQueue = (callback: () => void) => {\n if (window.requestAnimationFrame && window.self === window.top) {\n window.requestAnimationFrame(callback)\n } else {\n window.setTimeout(callback)\n }\n}\n\n// This function is used to remove Next.js' no-FOUC styles workaround for using\n// `style-loader` in development. It must be called before hydration, or else\n// rendering won't have the correct computed values in effects.\nexport function displayContent(): Promise<void> {\n return new Promise((resolve) => {\n safeCallbackQueue(function () {\n for (\n var x = document.querySelectorAll('[data-next-hide-fouc]'),\n i = x.length;\n i--;\n\n ) {\n x[i].parentNode!.removeChild(x[i])\n }\n resolve()\n })\n })\n}\n"],"names":["safeCallbackQueue","callback","window","requestAnimationFrame","self","top","setTimeout","displayContent","Promise","resolve","x","document","querySelectorAll","i","length","parentNode","removeChild"],"mappings":"AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,uBAAuB;AACvB,EAAE;AACF,+FAA+F;AAC/F,MAAMA,oBAAoB,CAACC;IACzB,IAAIC,OAAOC,qBAAqB,IAAID,OAAOE,IAAI,KAAKF,OAAOG,GAAG,EAAE;QAC9DH,OAAOC,qBAAqB,CAACF;IAC/B,OAAO;QACLC,OAAOI,UAAU,CAACL;IACpB;AACF;AAEA,+EAA+E;AAC/E,6EAA6E;AAC7E,+DAA+D;AAC/D,OAAO,SAASM;IACd,OAAO,IAAIC,QAAQ,CAACC;QAClBT,kBAAkB;YAChB,IACE,IAAIU,IAAIC,SAASC,gBAAgB,CAAC,0BAChCC,IAAIH,EAAEI,MAAM,EACdD,KAEA;gBACAH,CAAC,CAACG,EAAE,CAACE,UAAU,CAAEC,WAAW,CAACN,CAAC,CAACG,EAAE;YACnC;YACAJ;QACF;IACF;AACF"}

View File

@@ -0,0 +1,81 @@
import connect from '../components/react-dev-overlay/pages/hot-reloader-client';
import { sendMessage } from '../components/react-dev-overlay/pages/websocket';
let reloading = false;
export default (()=>{
const devClient = connect();
devClient.subscribeToHmrEvent((obj)=>{
var _window_next;
if (reloading) return;
// Retrieve the router if it's available
const router = (_window_next = window.next) == null ? void 0 : _window_next.router;
// Determine if we're on an error page or the router is not initialized
const isOnErrorPage = !router || router.pathname === '/404' || router.pathname === '/_error';
switch(obj.action){
case 'reloadPage':
{
sendMessage(JSON.stringify({
event: 'client-reload-page',
clientId: window.__nextDevClientId
}));
reloading = true;
return window.location.reload();
}
case 'removedPage':
{
const [page] = obj.data;
// Check if the removed page is the current page
const isCurrentPage = page === (router == null ? void 0 : router.pathname);
// We enter here if the removed page is currently being viewed
// or if we happen to be on an error page.
if (isCurrentPage || isOnErrorPage) {
sendMessage(JSON.stringify({
event: 'client-removed-page',
clientId: window.__nextDevClientId,
page
}));
return window.location.reload();
}
return;
}
case 'addedPage':
{
var _router_components;
const [page] = obj.data;
// Check if the added page is the current page
const isCurrentPage = page === (router == null ? void 0 : router.pathname);
// Check if the page component is not yet loaded
const isPageNotLoaded = typeof (router == null ? void 0 : (_router_components = router.components) == null ? void 0 : _router_components[page]) === 'undefined';
// We enter this block if the newly added page is the one currently being viewed
// but hasn't been loaded yet, or if we're on an error page.
if (isCurrentPage && isPageNotLoaded || isOnErrorPage) {
sendMessage(JSON.stringify({
event: 'client-added-page',
clientId: window.__nextDevClientId,
page
}));
return window.location.reload();
}
return;
}
case 'serverError':
case 'devPagesManifestUpdate':
case 'isrManifest':
case 'building':
case 'finishBuilding':
{
return;
}
default:
{
throw Object.defineProperty(new Error('Unexpected action ' + obj.action), "__NEXT_ERROR_CODE", {
value: "E59",
enumerable: false,
configurable: true
});
}
}
});
return devClient;
});
//# sourceMappingURL=hot-middleware-client.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/dev/hot-middleware-client.ts"],"sourcesContent":["import type {\n NextRouter,\n PrivateRouteInfo,\n} from '../../shared/lib/router/router'\nimport connect from '../components/react-dev-overlay/pages/hot-reloader-client'\nimport { sendMessage } from '../components/react-dev-overlay/pages/websocket'\n\n// Define a local type for the window.next object\ninterface NextWindow {\n next?: {\n router?: NextRouter & {\n components: { [pathname: string]: PrivateRouteInfo }\n }\n }\n __nextDevClientId?: string\n location: Location\n}\n\ndeclare const window: NextWindow\n\nlet reloading = false\n\nexport default () => {\n const devClient = connect()\n\n devClient.subscribeToHmrEvent((obj: any) => {\n if (reloading) return\n\n // Retrieve the router if it's available\n const router = window.next?.router\n\n // Determine if we're on an error page or the router is not initialized\n const isOnErrorPage =\n !router || router.pathname === '/404' || router.pathname === '/_error'\n\n switch (obj.action) {\n case 'reloadPage': {\n sendMessage(\n JSON.stringify({\n event: 'client-reload-page',\n clientId: window.__nextDevClientId,\n })\n )\n reloading = true\n return window.location.reload()\n }\n case 'removedPage': {\n const [page] = obj.data\n\n // Check if the removed page is the current page\n const isCurrentPage = page === router?.pathname\n\n // We enter here if the removed page is currently being viewed\n // or if we happen to be on an error page.\n if (isCurrentPage || isOnErrorPage) {\n sendMessage(\n JSON.stringify({\n event: 'client-removed-page',\n clientId: window.__nextDevClientId,\n page,\n })\n )\n return window.location.reload()\n }\n return\n }\n case 'addedPage': {\n const [page] = obj.data\n\n // Check if the added page is the current page\n const isCurrentPage = page === router?.pathname\n\n // Check if the page component is not yet loaded\n const isPageNotLoaded =\n typeof router?.components?.[page] === 'undefined'\n\n // We enter this block if the newly added page is the one currently being viewed\n // but hasn't been loaded yet, or if we're on an error page.\n if ((isCurrentPage && isPageNotLoaded) || isOnErrorPage) {\n sendMessage(\n JSON.stringify({\n event: 'client-added-page',\n clientId: window.__nextDevClientId,\n page,\n })\n )\n return window.location.reload()\n }\n return\n }\n case 'serverError':\n case 'devPagesManifestUpdate':\n case 'isrManifest':\n case 'building':\n case 'finishBuilding': {\n return\n }\n default: {\n throw new Error('Unexpected action ' + obj.action)\n }\n }\n })\n\n return devClient\n}\n"],"names":["connect","sendMessage","reloading","devClient","subscribeToHmrEvent","obj","window","router","next","isOnErrorPage","pathname","action","JSON","stringify","event","clientId","__nextDevClientId","location","reload","page","data","isCurrentPage","isPageNotLoaded","components","Error"],"mappings":"AAIA,OAAOA,aAAa,4DAA2D;AAC/E,SAASC,WAAW,QAAQ,kDAAiD;AAe7E,IAAIC,YAAY;AAEhB,eAAe,CAAA;IACb,MAAMC,YAAYH;IAElBG,UAAUC,mBAAmB,CAAC,CAACC;YAIdC;QAHf,IAAIJ,WAAW;QAEf,wCAAwC;QACxC,MAAMK,UAASD,eAAAA,OAAOE,IAAI,qBAAXF,aAAaC,MAAM;QAElC,uEAAuE;QACvE,MAAME,gBACJ,CAACF,UAAUA,OAAOG,QAAQ,KAAK,UAAUH,OAAOG,QAAQ,KAAK;QAE/D,OAAQL,IAAIM,MAAM;YAChB,KAAK;gBAAc;oBACjBV,YACEW,KAAKC,SAAS,CAAC;wBACbC,OAAO;wBACPC,UAAUT,OAAOU,iBAAiB;oBACpC;oBAEFd,YAAY;oBACZ,OAAOI,OAAOW,QAAQ,CAACC,MAAM;gBAC/B;YACA,KAAK;gBAAe;oBAClB,MAAM,CAACC,KAAK,GAAGd,IAAIe,IAAI;oBAEvB,gDAAgD;oBAChD,MAAMC,gBAAgBF,UAASZ,0BAAAA,OAAQG,QAAQ;oBAE/C,8DAA8D;oBAC9D,0CAA0C;oBAC1C,IAAIW,iBAAiBZ,eAAe;wBAClCR,YACEW,KAAKC,SAAS,CAAC;4BACbC,OAAO;4BACPC,UAAUT,OAAOU,iBAAiB;4BAClCG;wBACF;wBAEF,OAAOb,OAAOW,QAAQ,CAACC,MAAM;oBAC/B;oBACA;gBACF;YACA,KAAK;gBAAa;wBAQPX;oBAPT,MAAM,CAACY,KAAK,GAAGd,IAAIe,IAAI;oBAEvB,8CAA8C;oBAC9C,MAAMC,gBAAgBF,UAASZ,0BAAAA,OAAQG,QAAQ;oBAE/C,gDAAgD;oBAChD,MAAMY,kBACJ,QAAOf,2BAAAA,qBAAAA,OAAQgB,UAAU,qBAAlBhB,kBAAoB,CAACY,KAAK,MAAK;oBAExC,gFAAgF;oBAChF,4DAA4D;oBAC5D,IAAI,AAACE,iBAAiBC,mBAAoBb,eAAe;wBACvDR,YACEW,KAAKC,SAAS,CAAC;4BACbC,OAAO;4BACPC,UAAUT,OAAOU,iBAAiB;4BAClCG;wBACF;wBAEF,OAAOb,OAAOW,QAAQ,CAACC,MAAM;oBAC/B;oBACA;gBACF;YACA,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;YACL,KAAK;gBAAkB;oBACrB;gBACF;YACA;gBAAS;oBACP,MAAM,qBAA4C,CAA5C,IAAIM,MAAM,uBAAuBnB,IAAIM,MAAM,GAA3C,qBAAA;+BAAA;oCAAA;sCAAA;oBAA2C;gBACnD;QACF;IACF;IAEA,OAAOR;AACT,CAAA,EAAC"}

View File

@@ -0,0 +1,5 @@
// The Turbopack HMR client can't be properly omitted at the moment (WEB-1589),
// so instead we remap its import to this file in webpack builds.
export function connect() {}
//# sourceMappingURL=noop-turbopack-hmr.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/dev/noop-turbopack-hmr.ts"],"sourcesContent":["// The Turbopack HMR client can't be properly omitted at the moment (WEB-1589),\n// so instead we remap its import to this file in webpack builds.\nexport function connect() {}\n"],"names":["connect"],"mappings":"AAAA,+EAA+E;AAC/E,iEAAiE;AACjE,OAAO,SAASA,WAAW"}

View File

@@ -0,0 +1,35 @@
import Router from '../router';
import { sendMessage } from '../components/react-dev-overlay/pages/websocket';
export default (async (page)=>{
// Never send pings when using Turbopack as it's not used.
// Pings were originally used to keep track of active routes in on-demand-entries with webpack.
if (process.env.TURBOPACK) {
return;
}
if (page) {
// in AMP the router isn't initialized on the client and
// client-transitions don't occur so ping initial page
setInterval(()=>{
sendMessage(JSON.stringify({
event: 'ping',
page
}));
}, 2500);
} else {
Router.ready(()=>{
setInterval(()=>{
// when notFound: true is returned we should use the notFoundPage
// as the Router.pathname will point to the 404 page but we want
// to ping the source page that returned notFound: true instead
const notFoundSrcPage = self.__NEXT_DATA__.notFoundSrcPage;
const pathname = (Router.pathname === '/404' || Router.pathname === '/_error') && notFoundSrcPage ? notFoundSrcPage : Router.pathname;
sendMessage(JSON.stringify({
event: 'ping',
page: pathname
}));
}, 2500);
});
}
});
//# sourceMappingURL=on-demand-entries-client.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/client/dev/on-demand-entries-client.ts"],"sourcesContent":["import Router from '../router'\nimport { sendMessage } from '../components/react-dev-overlay/pages/websocket'\n\nexport default async (page?: string) => {\n // Never send pings when using Turbopack as it's not used.\n // Pings were originally used to keep track of active routes in on-demand-entries with webpack.\n if (process.env.TURBOPACK) {\n return\n }\n if (page) {\n // in AMP the router isn't initialized on the client and\n // client-transitions don't occur so ping initial page\n setInterval(() => {\n sendMessage(JSON.stringify({ event: 'ping', page }))\n }, 2500)\n } else {\n Router.ready(() => {\n setInterval(() => {\n // when notFound: true is returned we should use the notFoundPage\n // as the Router.pathname will point to the 404 page but we want\n // to ping the source page that returned notFound: true instead\n const notFoundSrcPage = self.__NEXT_DATA__.notFoundSrcPage\n const pathname =\n (Router.pathname === '/404' || Router.pathname === '/_error') &&\n notFoundSrcPage\n ? notFoundSrcPage\n : Router.pathname\n\n sendMessage(JSON.stringify({ event: 'ping', page: pathname }))\n }, 2500)\n })\n }\n}\n"],"names":["Router","sendMessage","page","process","env","TURBOPACK","setInterval","JSON","stringify","event","ready","notFoundSrcPage","self","__NEXT_DATA__","pathname"],"mappings":"AAAA,OAAOA,YAAY,YAAW;AAC9B,SAASC,WAAW,QAAQ,kDAAiD;AAE7E,eAAe,CAAA,OAAOC;IACpB,0DAA0D;IAC1D,+FAA+F;IAC/F,IAAIC,QAAQC,GAAG,CAACC,SAAS,EAAE;QACzB;IACF;IACA,IAAIH,MAAM;QACR,wDAAwD;QACxD,sDAAsD;QACtDI,YAAY;YACVL,YAAYM,KAAKC,SAAS,CAAC;gBAAEC,OAAO;gBAAQP;YAAK;QACnD,GAAG;IACL,OAAO;QACLF,OAAOU,KAAK,CAAC;YACXJ,YAAY;gBACV,iEAAiE;gBACjE,gEAAgE;gBAChE,+DAA+D;gBAC/D,MAAMK,kBAAkBC,KAAKC,aAAa,CAACF,eAAe;gBAC1D,MAAMG,WACJ,AAACd,CAAAA,OAAOc,QAAQ,KAAK,UAAUd,OAAOc,QAAQ,KAAK,SAAQ,KAC3DH,kBACIA,kBACAX,OAAOc,QAAQ;gBAErBb,YAAYM,KAAKC,SAAS,CAAC;oBAAEC,OAAO;oBAAQP,MAAMY;gBAAS;YAC7D,GAAG;QACL;IACF;AACF,CAAA,EAAC"}