create project

This commit is contained in:
ismailsosic
2022-12-27 12:05:56 +01:00
parent 2a33a2d3de
commit cd2143287c
16035 changed files with 2489703 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
"use strict";
var _async_to_generator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _fouc = require("./fouc");
var _onDemandEntriesClient = _interop_require_default(require("./on-demand-entries-client"));
var _websocket = require("./error-overlay/websocket");
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';
}
function tryApplyUpdates() {
return _tryApplyUpdates.apply(this, arguments);
}
function _tryApplyUpdates() {
_tryApplyUpdates = // This function reads code updates on the fly and hard
// reloads the page when it has changed.
_async_to_generator(function*() {
if (!isUpdateAvailable() || !canApplyUpdates()) {
return;
}
try {
const res = yield fetch(typeof __webpack_runtime_id__ !== 'undefined' ? `${hotUpdatePath}${curHash}.${__webpack_runtime_id__}.hot-update.json` : `${hotUpdatePath}${curHash}.hot-update.json`);
const jsonData = yield 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) {
document.location.reload(true);
} else {
curHash = mostRecentHash;
}
} catch (err) {
console.error('Error occurred checking for update', err);
document.location.reload(true);
}
});
return _tryApplyUpdates.apply(this, arguments);
}
(0, _websocket).addMessageListener((event)=>{
if (event.data === '\uD83D\uDC93') {
return;
}
try {
const message = JSON.parse(event.data);
if (message.action === 'sync' || message.action === 'built') {
if (!message.hash) {
return;
}
mostRecentHash = message.hash;
tryApplyUpdates();
} else if (message.action === 'reloadPage') {
document.location.reload(true);
}
} catch (ex) {
console.warn('Invalid HMR message: ' + event.data + '\n' + ex);
}
});
(0, _websocket).connectHMR({
assetPrefix,
path: '/_next/webpack-hmr'
});
(0, _fouc).displayContent();
(0, _onDemandEntriesClient).default(data.page);
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=amp-dev.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../client/dev/amp-dev.js"],"names":["data","JSON","parse","document","getElementById","textContent","window","__NEXT_DATA__","assetPrefix","page","mostRecentHash","curHash","__webpack_hash__","hotUpdatePath","endsWith","isUpdateAvailable","canApplyUpdates","module","hot","status","tryApplyUpdates","res","fetch","__webpack_runtime_id__","jsonData","json","curPage","pageUpdated","Array","isArray","c","Object","keys","some","mod","indexOf","startsWith","replace","location","reload","err","console","error","addMessageListener","event","message","action","hash","ex","warn","connectHMR","path","displayContent","initOnDemandEntries"],"mappings":"AACA;;;AAA+B,IAAA,KAAQ,WAAR,QAAQ,CAAA;AACP,IAAA,sBAA4B,oCAA5B,4BAA4B,EAAA;AACb,IAAA,UAA2B,WAA3B,2BAA2B,CAAA;AAE1E,MAAMA,IAAI,GAAGC,IAAI,CAACC,KAAK,CAACC,QAAQ,CAACC,cAAc,CAAC,eAAe,CAAC,CAACC,WAAW,CAAC;AAC7EC,MAAM,CAACC,aAAa,GAAGP,I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B,OAAM;aACP;YACDrC,cAAc,GAAGmC,OAAO,CAACE,IAAI;YAC7B3B,eAAe,EAAE;SAClB,MAAM,IAAIyB,OAAO,CAACC,MAAM,KAAK,YAAY,EAAE;YAC1C3C,QAAQ,CAACmC,QAAQ,CAACC,MAAM,CAAC,IAAI,CAAC;SAC/B;KACF,CAAC,OAAOS,EAAE,EAAE;QACXP,OAAO,CAACQ,IAAI,CAAC,uBAAuB,GAAGL,KAAK,CAAC5C,IAAI,GAAG,IAAI,GAAGgD,EAAE,CAAC;KAC/D;CACF,CAAC;AAEFE,CAAAA,GAAAA,UAAU,AAGR,CAAA,WAHQ,CAAC;IACT1C,WAAW;IACX2C,IAAI,EAAE,oBAAoB;CAC3B,CAAC;AACFC,CAAAA,GAAAA,KAAc,AAAE,CAAA,eAAF,EAAE;AAEhBC,CAAAA,GAAAA,sBAAmB,AAAW,CAAA,QAAX,CAACrD,IAAI,CAACS,IAAI,CAAC"}

View File

@@ -0,0 +1,202 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = initializeBuildWatcher;
var _websocket = require("./error-overlay/websocket");
function initializeBuildWatcher(toggleCallback, position = 'bottom-right') {
const shadowHost = document.createElement('div');
const [verticalProperty, horizontalProperty] = position.split('-');
shadowHost.id = '__next-build-watcher';
// Make sure container is fixed and on a high zIndex so it shows
shadowHost.style.position = 'fixed';
// Ensure container's position to be top or bottom (default)
shadowHost.style[verticalProperty] = '10px';
// Ensure container's position to be left or right (default)
shadowHost.style[horizontalProperty] = '20px';
shadowHost.style.width = 0;
shadowHost.style.height = 0;
shadowHost.style.zIndex = 99999;
document.body.appendChild(shadowHost);
let shadowRoot;
let prefix = '';
if (shadowHost.attachShadow) {
shadowRoot = shadowHost.attachShadow({
mode: 'open'
});
} else {
// If attachShadow is undefined then the browser does not support
// the Shadow DOM, we need to prefix all the names so there
// will be no conflicts
shadowRoot = shadowHost;
prefix = '__next-build-watcher-';
}
// Container
const container = createContainer(prefix);
shadowRoot.appendChild(container);
// CSS
const css = createCss(prefix, {
horizontalProperty,
verticalProperty
});
shadowRoot.appendChild(css);
// State
let isVisible = false;
let isBuilding = false;
let timeoutId = null;
// Handle events
(0, _websocket).addMessageListener((event)=>{
// This is the heartbeat event
if (event.data === '\uD83D\uDC93') {
return;
}
try {
handleMessage(event);
} catch (e) {}
});
function handleMessage(event) {
const obj = typeof event === 'string' ? {
action: event
} : JSON.parse(event.data);
// eslint-disable-next-line default-case
switch(obj.action){
case 'building':
timeoutId && clearTimeout(timeoutId);
isVisible = true;
isBuilding = true;
updateContainer();
break;
case 'built':
case 'sync':
isBuilding = false;
// Wait for the fade out transition to complete
timeoutId = setTimeout(()=>{
isVisible = false;
updateContainer();
}, 100);
updateContainer();
break;
}
}
toggleCallback(handleMessage);
function updateContainer() {
if (isBuilding) {
container.classList.add(`${prefix}building`);
} else {
container.classList.remove(`${prefix}building`);
}
if (isVisible) {
container.classList.add(`${prefix}visible`);
} else {
container.classList.remove(`${prefix}visible`);
}
}
}
function createContainer(prefix) {
const container = document.createElement('div');
container.id = `${prefix}container`;
container.innerHTML = `
<div id="${prefix}icon-wrapper">
<svg viewBox="0 0 226 200">
<defs>
<linearGradient
x1="114.720775%"
y1="181.283245%"
x2="39.5399306%"
y2="100%"
id="${prefix}linear-gradient"
>
<stop stop-color="#000000" offset="0%" />
<stop stop-color="#FFFFFF" offset="100%" />
</linearGradient>
</defs>
<g id="${prefix}icon-group" fill="none" stroke="url(#${prefix}linear-gradient)" stroke-width="18">
<path d="M113,5.08219117 L4.28393801,197.5 L221.716062,197.5 L113,5.08219117 Z" />
</g>
</svg>
</div>
`;
return container;
}
function createCss(prefix, { horizontalProperty , verticalProperty }) {
const css = document.createElement('style');
css.textContent = `
#${prefix}container {
position: absolute;
${verticalProperty}: 10px;
${horizontalProperty}: 30px;
border-radius: 3px;
background: #000;
color: #fff;
font: initial;
cursor: initial;
letter-spacing: initial;
text-shadow: initial;
text-transform: initial;
visibility: initial;
padding: 7px 10px 8px 10px;
align-items: center;
box-shadow: 0 11px 40px 0 rgba(0, 0, 0, 0.25), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
display: none;
opacity: 0;
transition: opacity 0.1s ease, ${verticalProperty} 0.1s ease;
animation: ${prefix}fade-in 0.1s ease-in-out;
}
#${prefix}container.${prefix}visible {
display: flex;
}
#${prefix}container.${prefix}building {
${verticalProperty}: 20px;
opacity: 1;
}
#${prefix}icon-wrapper {
width: 16px;
height: 16px;
}
#${prefix}icon-wrapper > svg {
width: 100%;
height: 100%;
}
#${prefix}icon-group {
animation: ${prefix}strokedash 1s ease-in-out both infinite;
}
@keyframes ${prefix}fade-in {
from {
${verticalProperty}: 10px;
opacity: 0;
}
to {
${verticalProperty}: 20px;
opacity: 1;
}
}
@keyframes ${prefix}strokedash {
0% {
stroke-dasharray: 0 226;
}
80%,
100% {
stroke-dasharray: 659 226;
}
}
`;
return css;
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=dev-build-watcher.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../client/dev/dev-build-watcher.js"],"names":["initializeBuildWatcher","toggleCallback","position","shadowHost","document","createElement","verticalProperty","horizontalProperty","split","id","style","width","height","zIndex","body","appendChild","shadowRoot","prefix","attachShadow","mode","container","createContainer","css","createCss","isVisible","isBuilding","timeoutId","addMessageListener","event","data","handleMessage","obj","action","JSON","parse","clearTimeout","updateContainer","setTimeout","classList","add","remove","innerHTML","textContent"],"mappings":"AAAA;;;;kBAEwBA,sBAAsB;AAFX,IAAA,UAA2B,WAA3B,2BAA2B,CAAA;AAE/C,SAASA,sBAAsB,CAC5CC,cAAc,EACdC,QAAQ,GAAG,cAAc,EACzB;IACA,MAAMC,UAAU,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;IAChD,MAAM,C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IAED,OAAOK,GAAG,CAAA;CACX"}

View File

@@ -0,0 +1 @@
export default function formatWebpackMessages(json: any, verbose?: boolean): any

View File

@@ -0,0 +1,119 @@
"use strict";
var _extends = require("@swc/helpers/lib/_extends.js").default;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _stripAnsi = _interop_require_default(require("next/dist/compiled/strip-ansi"));
// This file is based on https://github.com/facebook/create-react-app/blob/7b1a32be6ec9f99a6c9a3c66813f3ac09c4736b9/packages/react-dev-utils/formatWebpackMessages.js
// It's been edited to remove chalk and CRA-specific logic
const friendlySyntaxErrorLabel = 'Syntax error:';
const WEBPACK_BREAKING_CHANGE_POLYFILLS = '\n\nBREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.';
function isLikelyASyntaxError(message) {
return (0, _stripAnsi).default(message).indexOf(friendlySyntaxErrorLabel) !== -1;
}
let hadMissingSassError = false;
// Cleans up webpack error messages.
function formatMessage(message, verbose, importTraceNote) {
// TODO: Replace this once webpack 5 is stable
if (typeof message === 'object' && message.message) {
const filteredModuleTrace = message.moduleTrace && message.moduleTrace.filter((trace)=>!/next-(middleware|client-pages|edge-function)-loader\.js/.test(trace.originName));
let body = message.message;
const breakingChangeIndex = body.indexOf(WEBPACK_BREAKING_CHANGE_POLYFILLS);
if (breakingChangeIndex >= 0) {
body = body.slice(0, breakingChangeIndex);
}
message = (message.moduleName ? (0, _stripAnsi).default(message.moduleName) + '\n' : '') + (message.file ? (0, _stripAnsi).default(message.file) + '\n' : '') + body + (message.details && verbose ? '\n' + message.details : '') + (filteredModuleTrace && filteredModuleTrace.length && verbose ? (importTraceNote || '\n\nImport trace for requested module:') + filteredModuleTrace.map((trace)=>`\n${trace.moduleName}`).join('') : '') + (message.stack && verbose ? '\n' + message.stack : '');
}
let lines = message.split('\n');
// Strip Webpack-added headers off errors/warnings
// https://github.com/webpack/webpack/blob/master/lib/ModuleError.js
lines = lines.filter((line)=>!/Module [A-z ]+\(from/.test(line));
// Transform parsing error into syntax error
// TODO: move this to our ESLint formatter?
lines = lines.map((line)=>{
const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(line);
if (!parsingError) {
return line;
}
const [, errorLine, errorColumn, errorMessage] = parsingError;
return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
});
message = lines.join('\n');
// Smoosh syntax errors (commonly found in CSS)
message = message.replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, `${friendlySyntaxErrorLabel} $3 ($1:$2)\n`);
// Clean up export errors
message = message.replace(/^.*export '(.+?)' was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$2'.`);
message = message.replace(/^.*export 'default' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, `Attempted import error: '$2' does not contain a default export (imported as '$1').`);
message = message.replace(/^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, `Attempted import error: '$1' is not exported from '$3' (imported as '$2').`);
lines = message.split('\n');
// Remove leading newline
if (lines.length > 2 && lines[1].trim() === '') {
lines.splice(1, 1);
}
// Cleans up verbose "module not found" messages for files and packages.
if (lines[1] && lines[1].indexOf('Module not found: ') === 0) {
lines = [
lines[0],
lines[1].replace('Error: ', '').replace('Module not found: Cannot find file:', 'Cannot find file:'),
...lines.slice(2),
];
}
// Add helpful message for users trying to use Sass for the first time
if (lines[1] && lines[1].match(/Cannot find module.+sass/)) {
// ./file.module.scss (<<loader info>>) => ./file.module.scss
const firstLine = lines[0].split('!');
lines[0] = firstLine[firstLine.length - 1];
lines[1] = "To use Next.js' built-in Sass support, you first need to install `sass`.\n";
lines[1] += 'Run `npm i sass` or `yarn add sass` inside your workspace.\n';
lines[1] += '\nLearn more: https://nextjs.org/docs/messages/install-sass';
// dispose of unhelpful stack trace
lines = lines.slice(0, 2);
hadMissingSassError = true;
} else if (hadMissingSassError && message.match(/(sass-loader|resolve-url-loader: CSS error)/)) {
// dispose of unhelpful stack trace following missing sass module
lines = [];
}
if (!verbose) {
message = lines.join('\n');
// Internal stacks are generally useless so we strip them... with the
// exception of stacks containing `webpack:` because they're normally
// from user code generated by Webpack. For more information see
// https://github.com/facebook/create-react-app/pull/1050
message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, '') // at ... ...:x:y
;
message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, '') // at <anonymous>
;
lines = message.split('\n');
}
// Remove duplicated newlines
lines = lines.filter((line, index, arr)=>index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim());
// Reassemble the message
message = lines.join('\n');
return message.trim();
}
function formatWebpackMessages(json, verbose) {
const formattedErrors = json.errors.map(function(message) {
const isUnknownNextFontError = message.message.includes('An error occured in `@next/font`.');
return formatMessage(message, isUnknownNextFontError || verbose);
});
const formattedWarnings = json.warnings.map(function(message) {
return formatMessage(message, verbose);
});
const result = _extends({}, json, {
errors: formattedErrors,
warnings: formattedWarnings
});
if (!verbose && result.errors.some(isLikelyASyntaxError)) {
// If there are any syntax errors, show just them.
result.errors = result.errors.filter(isLikelyASyntaxError);
result.warnings = [];
}
return result;
}
module.exports = formatWebpackMessages;
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=format-webpack-messages.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,308 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = connect;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _client = require("next/dist/compiled/@next/react-dev-overlay/dist/client");
var _stripAnsi = _interop_require_default(require("next/dist/compiled/strip-ansi"));
var _websocket = require("./websocket");
var _formatWebpackMessages = _interop_require_default(require("./format-webpack-messages"));
function connect() {
(0, _client).register();
(0, _websocket).addMessageListener((event)=>{
if (event.data.indexOf('action') === -1) return;
try {
processMessage(event);
} catch (ex) {
console.warn('Invalid HMR message: ' + event.data + '\n', ex);
}
});
return {
subscribeToHmrEvent (handler) {
customHmrEventHandler = handler;
},
onUnrecoverableError () {
hadRuntimeError = true;
}
};
}
// This alternative WebpackDevServer combines the functionality of:
// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js
// https://github.com/webpack/webpack/blob/webpack-1/hot/dev-server.js
// It only supports their simplest configuration (hot updates on same server).
// It makes some opinionated choices on top, like adding a syntax error overlay
// that looks similar to our console output. The error overlay is inspired by:
// https://github.com/glenjamin/webpack-hot-middleware
window.__nextDevClientId = Math.round(Math.random() * 100 + Date.now());
let hadRuntimeError = false;
let customHmrEventHandler;
// Remember some state related to hot module replacement.
var isFirstCompilation = true;
var mostRecentCompilationHash = null;
var hasCompileErrors = false;
function clearOutdatedErrors() {
// Clean up outdated compile errors, if any.
if (typeof console !== 'undefined' && typeof console.clear === 'function') {
if (hasCompileErrors) {
console.clear();
}
}
}
// Successful compilation.
function handleSuccess() {
clearOutdatedErrors();
const isHotUpdate = !isFirstCompilation || window.__NEXT_DATA__.page !== '/_error' && isUpdateAvailable();
isFirstCompilation = false;
hasCompileErrors = false;
// Attempt to apply hot updates or reload.
if (isHotUpdate) {
tryApplyUpdates(onBeforeFastRefresh, onFastRefresh);
}
}
// Compilation with warnings (e.g. ESLint).
function handleWarnings(warnings) {
clearOutdatedErrors();
const isHotUpdate = !isFirstCompilation;
isFirstCompilation = false;
hasCompileErrors = false;
function printWarnings() {
// Print warnings to the console.
const formatted = (0, _formatWebpackMessages).default({
warnings: warnings,
errors: []
});
if (typeof console !== 'undefined' && typeof console.warn === 'function') {
var ref;
for(let i = 0; i < ((ref = formatted.warnings) == null ? void 0 : ref.length); i++){
if (i === 5) {
console.warn('There were more warnings in other files.\n' + 'You can find a complete log in the terminal.');
break;
}
console.warn((0, _stripAnsi).default(formatted.warnings[i]));
}
}
}
printWarnings();
// Attempt to apply hot updates or reload.
if (isHotUpdate) {
tryApplyUpdates(onBeforeFastRefresh, onFastRefresh);
}
}
// Compilation with errors (e.g. syntax error or missing modules).
function handleErrors(errors) {
clearOutdatedErrors();
isFirstCompilation = false;
hasCompileErrors = true;
// "Massage" webpack messages.
var formatted = (0, _formatWebpackMessages).default({
errors: errors,
warnings: []
});
// Only show the first error.
(0, _client).onBuildError(formatted.errors[0]);
// Also log them to the console.
if (typeof console !== 'undefined' && typeof console.error === 'function') {
for(var i = 0; i < formatted.errors.length; i++){
console.error((0, _stripAnsi).default(formatted.errors[i]));
}
}
// Do not attempt to reload now.
// We will reload on next success instead.
if (process.env.__NEXT_TEST_MODE) {
if (self.__NEXT_HMR_CB) {
self.__NEXT_HMR_CB(formatted.errors[0]);
self.__NEXT_HMR_CB = null;
}
}
}
let startLatency = undefined;
function onBeforeFastRefresh(hasUpdates) {
if (hasUpdates) {
// Only trigger a pending state if we have updates to apply
// (cf. onFastRefresh)
(0, _client).onBeforeRefresh();
}
}
function onFastRefresh(hasUpdates) {
(0, _client).onBuildOk();
if (hasUpdates) {
// Only complete a pending state if we applied updates
// (cf. onBeforeFastRefresh)
(0, _client).onRefresh();
}
if (startLatency) {
const endLatency = Date.now();
const latency = endLatency - startLatency;
console.log(`[Fast Refresh] done in ${latency}ms`);
(0, _websocket).sendMessage(JSON.stringify({
event: 'client-hmr-latency',
id: window.__nextDevClientId,
startTime: startLatency,
endTime: endLatency
}));
if (self.__NEXT_HMR_LATENCY_CB) {
self.__NEXT_HMR_LATENCY_CB(latency);
}
}
}
// There is a newer version of the code available.
function handleAvailableHash(hash) {
// Update last known compilation hash.
mostRecentCompilationHash = hash;
}
// Handle messages from the server.
function processMessage(e) {
const obj = JSON.parse(e.data);
switch(obj.action){
case 'building':
{
startLatency = Date.now();
console.log('[Fast Refresh] rebuilding');
break;
}
case 'built':
case 'sync':
{
if (obj.hash) {
handleAvailableHash(obj.hash);
}
const { errors , warnings } = obj;
const hasErrors = Boolean(errors && errors.length);
if (hasErrors) {
(0, _websocket).sendMessage(JSON.stringify({
event: 'client-error',
errorCount: errors.length,
clientId: window.__nextDevClientId
}));
return handleErrors(errors);
}
const hasWarnings = Boolean(warnings && warnings.length);
if (hasWarnings) {
(0, _websocket).sendMessage(JSON.stringify({
event: 'client-warning',
warningCount: warnings.length,
clientId: window.__nextDevClientId
}));
return handleWarnings(warnings);
}
(0, _websocket).sendMessage(JSON.stringify({
event: 'client-success',
clientId: window.__nextDevClientId
}));
return handleSuccess();
}
case 'serverComponentChanges':
{
// Server component changes don't apply to `pages`.
return;
}
default:
{
if (customHmrEventHandler) {
customHmrEventHandler(obj);
break;
}
break;
}
}
}
// Is there a newer version of this code available?
function isUpdateAvailable() {
/* globals __webpack_hash__ */ // __webpack_hash__ is the hash of the current compilation.
// It's a global variable injected by Webpack.
return mostRecentCompilationHash !== __webpack_hash__;
}
// Webpack disallows updates in other states.
function canApplyUpdates() {
return module.hot.status() === 'idle';
}
function afterApplyUpdates(fn) {
if (canApplyUpdates()) {
fn();
} else {
function handler(status) {
if (status === 'idle') {
module.hot.removeStatusHandler(handler);
fn();
}
}
module.hot.addStatusHandler(handler);
}
}
// Attempt to update code on the fly, fall back to a hard reload.
function tryApplyUpdates(onBeforeHotUpdate, onHotUpdateSuccess) {
if (!module.hot) {
// HotModuleReplacementPlugin is not in Webpack configuration.
console.error('HotModuleReplacementPlugin is not in Webpack configuration.');
// window.location.reload();
return;
}
if (!isUpdateAvailable() || !canApplyUpdates()) {
(0, _client).onBuildOk();
return;
}
function handleApplyUpdates(err, updatedModules) {
if (err || hadRuntimeError || !updatedModules) {
if (err) {
console.warn('[Fast Refresh] performing full reload\n\n' + "Fast Refresh will perform a full reload when you edit a file that's imported by modules outside of the React rendering tree.\n" + 'You might have a file which exports a React component but also exports a value that is imported by a non-React component file.\n' + 'Consider migrating the non-React component export to a separate file and importing it into both files.\n\n' + 'It is also possible the parent component of the component you edited is a class component, which disables Fast Refresh.\n' + 'Fast Refresh requires at least one parent function component in your React tree.');
} else if (hadRuntimeError) {
console.warn('[Fast Refresh] performing full reload because your application had an unrecoverable error');
}
performFullReload(err);
return;
}
const hasUpdates = Boolean(updatedModules.length);
if (typeof onHotUpdateSuccess === 'function') {
// Maybe we want to do something.
onHotUpdateSuccess(hasUpdates);
}
if (isUpdateAvailable()) {
// While we were updating, there was a new update! Do it again.
// However, this time, don't trigger a pending refresh state.
tryApplyUpdates(hasUpdates ? undefined : onBeforeHotUpdate, hasUpdates ? _client.onBuildOk : onHotUpdateSuccess);
} else {
(0, _client).onBuildOk();
if (process.env.__NEXT_TEST_MODE) {
afterApplyUpdates(()=>{
if (self.__NEXT_HMR_CB) {
self.__NEXT_HMR_CB();
self.__NEXT_HMR_CB = null;
}
});
}
}
}
// https://webpack.js.org/api/hot-module-replacement/#check
module.hot.check(/* autoApply */ false).then((updatedModules)=>{
if (!updatedModules) {
return null;
}
if (typeof onBeforeHotUpdate === 'function') {
const hasUpdates = Boolean(updatedModules.length);
onBeforeHotUpdate(hasUpdates);
}
return module.hot.apply();
}).then((updatedModules)=>{
handleApplyUpdates(null, updatedModules);
}, (err)=>{
handleApplyUpdates(err, null);
});
}
function performFullReload(err) {
const stackTrace = err && (err.stack && err.stack.split('\n').slice(0, 5).join('\n') || err.message || err + '');
(0, _websocket).sendMessage(JSON.stringify({
event: 'client-full-reload',
stackTrace,
hadRuntimeError: !!hadRuntimeError
}));
window.location.reload();
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=hot-dev-client.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
export declare function addMessageListener(cb: (event: any) => void): void;
export declare function sendMessage(data: any): void;
export declare function connectHMR(options: {
path: string;
assetPrefix: string;
timeout: number;
log?: boolean;
}): void;

View File

@@ -0,0 +1,74 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addMessageListener = addMessageListener;
exports.sendMessage = sendMessage;
exports.connectHMR = connectHMR;
let source;
const eventCallbacks = [];
let lastActivity = Date.now();
function getSocketProtocol(assetPrefix) {
let protocol = location.protocol;
try {
// assetPrefix is a url
protocol = new URL(assetPrefix).protocol;
} catch (_) {}
return protocol === 'http:' ? 'ws' : 'wss';
}
function addMessageListener(cb) {
eventCallbacks.push(cb);
}
function sendMessage(data) {
if (!source || source.readyState !== source.OPEN) return;
return source.send(data);
}
function connectHMR(options) {
if (!options.timeout) {
options.timeout = 5 * 1000;
}
function init() {
if (source) source.close();
function handleOnline() {
if (options.log) console.log('[HMR] connected');
lastActivity = Date.now();
}
function handleMessage(event) {
lastActivity = Date.now();
eventCallbacks.forEach((cb)=>{
cb(event);
});
}
let timer;
function handleDisconnect() {
clearInterval(timer);
source.close();
setTimeout(init, options.timeout);
}
timer = setInterval(function() {
if (Date.now() - lastActivity > options.timeout) {
handleDisconnect();
}
}, options.timeout / 2);
const { hostname , port } = location;
const protocol = getSocketProtocol(options.assetPrefix || '');
const assetPrefix = options.assetPrefix.replace(/^\/+/, '');
let url = `${protocol}://${hostname}:${port}${assetPrefix ? `/${assetPrefix}` : ''}`;
if (assetPrefix.startsWith('http')) {
url = `${protocol}://${assetPrefix.split('://')[1]}`;
}
source = new window.WebSocket(`${url}${options.path}`);
source.onopen = handleOnline;
source.onerror = handleDisconnect;
source.onmessage = handleMessage;
}
init();
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=websocket.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../client/dev/error-overlay/websocket.ts"],"names":["addMessageListener","sendMessage","connectHMR","source","eventCallbacks","lastActivity","Date","now","getSocketProtocol","assetPrefix","protocol","location","URL","_","cb","push","data","readyState","OPEN","send","options","timeout","init","close","handleOnline","log","console","handleMessage","event","forEach","timer","handleDisconnect","clearInterval","setTimeout","setInterval","hostname","port","replace","url","startsWith","split","window","WebSocket","path","onopen","onerror","onmessage"],"mappings":"AAAA;;;;QAegBA,kBAAkB,GAAlBA,kBAAkB;QAIlBC,WAAW,GAAXA,WAAW;QAKXC,UAAU,GAAVA,UAAU;AAxB1B,IAAIC,MAAM,AAAW;AACrB,MAAMC,cAAc,GAA6B,EAAE;AACnD,IAAIC,YAAY,GAAGC,IAAI,CAACC,GAAG,EAAE;AAE7B,SAASC,iBAAiB,CAACC,WAAmB,EAAU;IACtD,IAAIC,QAAQ,GAAGC,QAAQ,CAACD,QAAQ;IAEhC,IAAI;QACF,uBAAuB;QACvBA,QAAQ,GAAG,IAAIE,GAAG,CAACH,WAAW,CAAC,CAACC,QAAQ;KACzC,CAAC,OAAOG,CAAC,EAAE,EAAE;IAEd,OAAOH,QAAQ,KAAK,OAAO,GAAG,IAAI,GAAG,KAAK,CAAA;CAC3C;AAEM,SAASV,kBAAkB,CAACc,EAAwB,EAAE;IAC3DV,cAAc,CAACW,IAAI,CAACD,EAAE,CAAC;CACxB;AAEM,SAASb,WAAW,CAACe,IAAS,EAAE;IACrC,IAAI,CAACb,MAAM,IAAIA,MAAM,CAACc,UAAU,KAAKd,MAAM,CAACe,IAAI,EAAE,OAAM;IACxD,OAAOf,MAAM,CAACgB,IAAI,CAACH,IAAI,CAAC,CAAA;CACzB;AAEM,SAASd,UAAU,CAACkB,OAK1B,EAAE;IACD,IAAI,CAACA,OAAO,CAACC,OAAO,EAAE;QACpBD,OAAO,CAACC,OAAO,GAAG,CAAC,GAAG,IAAI;KAC3B;IAED,SAASC,IAAI,GAAG;QACd,IAAInB,MAAM,EAAEA,MAAM,CAACoB,KAAK,EAAE;QAE1B,SAASC,YAAY,GAAG;YACtB,IAAIJ,OAAO,CAACK,GAAG,EAAEC,OAAO,CAACD,GAAG,CAAC,iBAAiB,CAAC;YAC/CpB,YAAY,GAAGC,I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,MAAM,CAACC,SAAS,CAAC,CAAC,EAAEJ,GAAG,CAAC,EAAElB,OAAO,CAACuB,IAAI,CAAC,CAAC,CAAC;QACtDxC,MAAM,CAACyC,MAAM,GAAGpB,YAAY;QAC5BrB,MAAM,CAAC0C,OAAO,GAAGd,gBAAgB;QACjC5B,MAAM,CAAC2C,SAAS,GAAGnB,aAAa;KACjC;IAEDL,IAAI,EAAE;CACP"}

View File

@@ -0,0 +1 @@
export declare function displayContent(): Promise<void>;

37
kitabcitab/node_modules/next/dist/client/dev/fouc.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.displayContent = displayContent;
// 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);
}
};
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();
});
});
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=fouc.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../client/dev/fouc.ts"],"names":["displayContent","safeCallbackQueue","callback","window","requestAnimationFrame","self","top","setTimeout","Promise","resolve","x","document","querySelectorAll","i","length","parentNode","removeChild"],"mappings":"AAOA;;;;QAWgBA,cAAc,GAAdA,cAAc;AAlB9B,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,uBAAuB;AACvB,EAAE;AACF,+FAA+F;AAC/F,MAAMC,iBAAiB,GAAG,CAACC,QAAoB,GAAK;IAClD,IAAIC,MAAM,CAACC,qBAAqB,IAAID,MAAM,CAACE,IAAI,KAAKF,MAAM,CAACG,GAAG,EAAE;QAC9DH,MAAM,CAACC,qBAAqB,CAACF,QAAQ,CAAC;KACvC,MAAM;QACLC,MAAM,CAACI,UAAU,CAACL,QAAQ,CAAC;KAC5B;CACF;AAKM,SAASF,cAAc,GAAkB;IAC9C,OAAO,IAAIQ,OAAO,CAAC,CAACC,OAAO,GAAK;QAC9BR,iBAAiB,CAAC,WAAY;YAC5B,IACE,IAAIS,CAAC,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,uBAAuB,CAAC,EACxDC,CAAC,GAAGH,CAAC,CAACI,MAAM,EACdD,CAAC,EAAE,EAEH;gBACAH,CAAC,CAACG,CAAC,CAAC,CAACE,UAAU,CAAEC,WAAW,CAACN,CAAC,CAACG,CAAC,CAAC,CAAC;aACnC;YACDJ,OAAO,EAAE;SACV,CAAC;KACH,CAAC,CAAA;CACH"}

View File

@@ -0,0 +1,74 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _async_to_generator = require("@swc/helpers/lib/_async_to_generator.js").default;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _router = _interop_require_default(require("next/router"));
var _websocket = require("./error-overlay/websocket");
var _default = _async_to_generator(function*(page) {
if (page) {
// in AMP the router isn't initialized on the client and
// client-transitions don't occur so ping initial page
setInterval(()=>{
(0, _websocket).sendMessage(JSON.stringify({
event: 'ping',
page
}));
}, 2500);
} else {
_router.default.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.default.pathname === '/404' || _router.default.pathname === '/_error') && notFoundSrcPage ? notFoundSrcPage : _router.default.pathname;
(0, _websocket).sendMessage(JSON.stringify({
event: 'ping',
page: pathname
}));
}, 2500);
});
}
(0, _websocket).addMessageListener((event)=>{
if (event.data.indexOf('{') === -1) return;
try {
const payload = JSON.parse(event.data);
// don't attempt fetching the page if we're already showing
// the dev overlay as this can cause the error to be triggered
// repeatedly
if (payload.event === 'pong' && payload.invalid && !self.__NEXT_DATA__.err) {
// Payload can be invalid even if the page does exist.
// So, we check if it can be created.
fetch(location.href, {
credentials: 'same-origin'
}).then((pageRes)=>{
if (pageRes.status === 200) {
// Page exists now, reload
location.reload();
} else {
// Page doesn't exist
if (self.__NEXT_DATA__.page === _router.default.pathname && _router.default.pathname !== '/_error') {
// We are still on the page,
// reload to show 404 error page
location.reload();
}
}
});
}
} catch (err) {
console.error('on-demand-entries failed to parse response', err);
}
});
});
exports.default = _default;
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=on-demand-entries-client.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../client/dev/on-demand-entries-client.js"],"names":["page","setInterval","sendMessage","JSON","stringify","event","Router","ready","notFoundSrcPage","self","__NEXT_DATA__","pathname","addMessageListener","data","indexOf","payload","parse","invalid","err","fetch","location","href","credentials","then","pageRes","status","reload","console","error"],"mappings":"AAAA;;;;;;;AAAmB,IAAA,OAAa,oCAAb,aAAa,EAAA;AACgB,IAAA,UAA2B,WAA3B,2BAA2B,CAAA;eAE5D,oBAAA,UAAOA,IAAI,EAAK;IAC7B,IAAIA,IAAI,EAAE;QACR,wDAAwD;QACxD,sDAAsD;QACtDC,WAAW,CAAC,IAAM;YAChBC,CAAAA,GAAAA,UAAW,AAAyC,CAAA,YAAzC,CAACC,IAAI,CAACC,SAAS,CAAC;gBAAEC,KAAK,EAAE,MAAM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AE;wBAC1B,0BAA0B;wBAC1BL,QAAQ,CAACM,MAAM,EAAE;qBAClB,MAAM;wBACL,qBAAqB;wBACrB,IACEjB,IAAI,CAACC,aAAa,CAACV,IAAI,KAAKM,OAAM,QAAA,CAACK,QAAQ,IAC3CL,OAAM,QAAA,CAACK,QAAQ,KAAK,SAAS,EAC7B;4BACA,4BAA4B;4BAC5B,gCAAgC;4BAChCS,QAAQ,CAACM,MAAM,EAAE;yBAClB;qBACF;iBACF,CAAC;aACH;SACF,CAAC,OAAOR,GAAG,EAAE;YACZS,OAAO,CAACC,KAAK,CAAC,4CAA4C,EAAEV,GAAG,CAAC;SACjE;KACF,CAAC;CACH,CAAA"}

View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _interop_require_default = require("@swc/helpers/lib/_interop_require_default.js").default;
var _hotDevClient = _interop_require_default(require("./error-overlay/hot-dev-client"));
var _websocket = require("./error-overlay/websocket");
var _default = ()=>{
const devClient = (0, _hotDevClient).default();
devClient.subscribeToHmrEvent((obj)=>{
if (obj.action === 'reloadPage') {
(0, _websocket).sendMessage(JSON.stringify({
event: 'client-reload-page',
clientId: window.__nextDevClientId
}));
return window.location.reload();
}
if (obj.action === 'removedPage') {
const [page] = obj.data;
if (page === window.next.router.pathname) {
(0, _websocket).sendMessage(JSON.stringify({
event: 'client-removed-page',
clientId: window.__nextDevClientId,
page
}));
return window.location.reload();
}
return;
}
if (obj.action === 'addedPage') {
const [page] = obj.data;
if (page === window.next.router.pathname && typeof window.next.router.components[page] === 'undefined') {
(0, _websocket).sendMessage(JSON.stringify({
event: 'client-added-page',
clientId: window.__nextDevClientId,
page
}));
return window.location.reload();
}
return;
}
throw new Error('Unexpected action ' + obj.action);
});
return devClient;
};
exports.default = _default;
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=webpack-hot-middleware-client.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../client/dev/webpack-hot-middleware-client.js"],"names":["devClient","connect","subscribeToHmrEvent","obj","action","sendMessage","JSON","stringify","event","clientId","window","__nextDevClientId","location","reload","page","data","next","router","pathname","components","Error"],"mappings":"AAAA;;;;;;AAAoB,IAAA,aAAgC,oCAAhC,gCAAgC,EAAA;AACxB,IAAA,UAA2B,WAA3B,2BAA2B,CAAA;eAExC,IAAM;IACnB,MAAMA,SAAS,GAAGC,CAAAA,GAAAA,aAAO,AAAE,CAAA,QAAF,EAAE;IAE3BD,SAAS,CAACE,mBAAmB,CAAC,CAACC,GAAG,GAAK;QACrC,IAAIA,GAAG,CAACC,MAAM,KAAK,YAAY,EAAE;YAC/BC,CAAAA,GAAAA,UAAW,AAKV,CAAA,YALU,CACTC,IAAI,CAACC,SAAS,CAAC;gBACbC,KAAK,EAAE,oBAAoB;gBAC3BC,QAAQ,EAAEC,MAAM,CAACC,iBAAiB;aACnC,CAAC,CACH;YACD,OAAOD,MAAM,CAACE,QAAQ,CAACC,MAAM,EAAE,CAAA;SAChC;QACD,IAAIV,GAAG,CAACC,MAAM,KAAK,aAAa,EAAE;YAChC,MAAM,CAACU,IAAI,CAAC,GAAGX,GAAG,CAACY,IAAI;YACvB,IAAID,IAAI,KAAKJ,MAAM,CAACM,IAAI,CAACC,MAAM,CAACC,QAAQ,EAAE;gBACxCb,CAAAA,GAAAA,UAAW,AAMV,CAAA,YANU,CACTC,IAAI,CAACC,SAAS,CAAC;oBACbC,KAAK,EAAE,qBAAqB;oBAC5BC,QAAQ,EAAEC,MAAM,CAACC,iBAAiB;oBAClCG,IAAI;iBACL,CAAC,CACH;gBACD,OAAOJ,MAAM,CAACE,QAAQ,CAACC,MAAM,EAAE,CAAA;aAChC;YACD,OAAM;SACP;QACD,IAAIV,GAAG,CAACC,MAAM,KAAK,WAAW,EAAE;YAC9B,MAAM,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