Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
60
node_modules/webpack-dev-server/client/clients/SockJSClient.js
generated
vendored
Normal file
60
node_modules/webpack-dev-server/client/clients/SockJSClient.js
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
import SockJS from "../modules/sockjs-client/index.js";
|
||||
import { log } from "../utils/log.js";
|
||||
var SockJSClient = /*#__PURE__*/function () {
|
||||
/**
|
||||
* @param {string} url
|
||||
*/
|
||||
function SockJSClient(url) {
|
||||
_classCallCheck(this, SockJSClient);
|
||||
// SockJS requires `http` and `https` protocols
|
||||
this.sock = new SockJS(url.replace(/^ws:/i, "http:").replace(/^wss:/i, "https:"));
|
||||
this.sock.onerror =
|
||||
/**
|
||||
* @param {Error} error
|
||||
*/
|
||||
function (error) {
|
||||
log.error(error);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {(...args: any[]) => void} f
|
||||
*/
|
||||
return _createClass(SockJSClient, [{
|
||||
key: "onOpen",
|
||||
value: function onOpen(f) {
|
||||
this.sock.onopen = f;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {(...args: any[]) => void} f
|
||||
*/
|
||||
}, {
|
||||
key: "onClose",
|
||||
value: function onClose(f) {
|
||||
this.sock.onclose = f;
|
||||
}
|
||||
|
||||
// call f with the message string as the first argument
|
||||
/**
|
||||
* @param {(...args: any[]) => void} f
|
||||
*/
|
||||
}, {
|
||||
key: "onMessage",
|
||||
value: function onMessage(f) {
|
||||
this.sock.onmessage =
|
||||
/**
|
||||
* @param {Error & { data: string }} e
|
||||
*/
|
||||
function (e) {
|
||||
f(e.data);
|
||||
};
|
||||
}
|
||||
}]);
|
||||
}();
|
||||
export { SockJSClient as default };
|
311
node_modules/webpack-dev-server/client/index.js
generated
vendored
Normal file
311
node_modules/webpack-dev-server/client/index.js
generated
vendored
Normal file
|
@ -0,0 +1,311 @@
|
|||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
/* global __resourceQuery, __webpack_hash__ */
|
||||
/// <reference types="webpack/module" />
|
||||
import webpackHotLog from "webpack/hot/log.js";
|
||||
import stripAnsi from "./utils/stripAnsi.js";
|
||||
import parseURL from "./utils/parseURL.js";
|
||||
import socket from "./socket.js";
|
||||
import { formatProblem, createOverlay } from "./overlay.js";
|
||||
import { log, logEnabledFeatures, setLogLevel } from "./utils/log.js";
|
||||
import sendMessage from "./utils/sendMessage.js";
|
||||
import reloadApp from "./utils/reloadApp.js";
|
||||
import createSocketURL from "./utils/createSocketURL.js";
|
||||
|
||||
/**
|
||||
* @typedef {Object} OverlayOptions
|
||||
* @property {boolean | (error: Error) => boolean} [warnings]
|
||||
* @property {boolean | (error: Error) => boolean} [errors]
|
||||
* @property {boolean | (error: Error) => boolean} [runtimeErrors]
|
||||
* @property {string} [trustedTypesPolicyName]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {boolean} hot
|
||||
* @property {boolean} liveReload
|
||||
* @property {boolean} progress
|
||||
* @property {boolean | OverlayOptions} overlay
|
||||
* @property {string} [logging]
|
||||
* @property {number} [reconnect]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} Status
|
||||
* @property {boolean} isUnloading
|
||||
* @property {string} currentHash
|
||||
* @property {string} [previousHash]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {boolean | { warnings?: boolean | string; errors?: boolean | string; runtimeErrors?: boolean | string; }} overlayOptions
|
||||
*/
|
||||
var decodeOverlayOptions = function decodeOverlayOptions(overlayOptions) {
|
||||
if (typeof overlayOptions === "object") {
|
||||
["warnings", "errors", "runtimeErrors"].forEach(function (property) {
|
||||
if (typeof overlayOptions[property] === "string") {
|
||||
var overlayFilterFunctionString = decodeURIComponent(overlayOptions[property]);
|
||||
|
||||
// eslint-disable-next-line no-new-func
|
||||
var overlayFilterFunction = new Function("message", "var callback = ".concat(overlayFilterFunctionString, "\n return callback(message)"));
|
||||
overlayOptions[property] = overlayFilterFunction;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @type {Status}
|
||||
*/
|
||||
var status = {
|
||||
isUnloading: false,
|
||||
// eslint-disable-next-line camelcase
|
||||
currentHash: __webpack_hash__
|
||||
};
|
||||
|
||||
/** @type {Options} */
|
||||
var options = {
|
||||
hot: false,
|
||||
liveReload: false,
|
||||
progress: false,
|
||||
overlay: false
|
||||
};
|
||||
var parsedResourceQuery = parseURL(__resourceQuery);
|
||||
var enabledFeatures = {
|
||||
"Hot Module Replacement": false,
|
||||
"Live Reloading": false,
|
||||
Progress: false,
|
||||
Overlay: false
|
||||
};
|
||||
if (parsedResourceQuery.hot === "true") {
|
||||
options.hot = true;
|
||||
enabledFeatures["Hot Module Replacement"] = true;
|
||||
}
|
||||
if (parsedResourceQuery["live-reload"] === "true") {
|
||||
options.liveReload = true;
|
||||
enabledFeatures["Live Reloading"] = true;
|
||||
}
|
||||
if (parsedResourceQuery.progress === "true") {
|
||||
options.progress = true;
|
||||
enabledFeatures.Progress = true;
|
||||
}
|
||||
if (parsedResourceQuery.overlay) {
|
||||
try {
|
||||
options.overlay = JSON.parse(parsedResourceQuery.overlay);
|
||||
} catch (e) {
|
||||
log.error("Error parsing overlay options from resource query:", e);
|
||||
}
|
||||
|
||||
// Fill in default "true" params for partially-specified objects.
|
||||
if (typeof options.overlay === "object") {
|
||||
options.overlay = _objectSpread({
|
||||
errors: true,
|
||||
warnings: true,
|
||||
runtimeErrors: true
|
||||
}, options.overlay);
|
||||
decodeOverlayOptions(options.overlay);
|
||||
}
|
||||
enabledFeatures.Overlay = true;
|
||||
}
|
||||
if (parsedResourceQuery.logging) {
|
||||
options.logging = parsedResourceQuery.logging;
|
||||
}
|
||||
if (typeof parsedResourceQuery.reconnect !== "undefined") {
|
||||
options.reconnect = Number(parsedResourceQuery.reconnect);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} level
|
||||
*/
|
||||
function setAllLogLevel(level) {
|
||||
// This is needed because the HMR logger operate separately from dev server logger
|
||||
webpackHotLog.setLogLevel(level === "verbose" || level === "log" ? "info" : level);
|
||||
setLogLevel(level);
|
||||
}
|
||||
if (options.logging) {
|
||||
setAllLogLevel(options.logging);
|
||||
}
|
||||
logEnabledFeatures(enabledFeatures);
|
||||
self.addEventListener("beforeunload", function () {
|
||||
status.isUnloading = true;
|
||||
});
|
||||
var overlay = typeof window !== "undefined" ? createOverlay(typeof options.overlay === "object" ? {
|
||||
trustedTypesPolicyName: options.overlay.trustedTypesPolicyName,
|
||||
catchRuntimeError: options.overlay.runtimeErrors
|
||||
} : {
|
||||
trustedTypesPolicyName: false,
|
||||
catchRuntimeError: options.overlay
|
||||
}) : {
|
||||
send: function send() {}
|
||||
};
|
||||
var onSocketMessage = {
|
||||
hot: function hot() {
|
||||
if (parsedResourceQuery.hot === "false") {
|
||||
return;
|
||||
}
|
||||
options.hot = true;
|
||||
},
|
||||
liveReload: function liveReload() {
|
||||
if (parsedResourceQuery["live-reload"] === "false") {
|
||||
return;
|
||||
}
|
||||
options.liveReload = true;
|
||||
},
|
||||
invalid: function invalid() {
|
||||
log.info("App updated. Recompiling...");
|
||||
|
||||
// Fixes #1042. overlay doesn't clear if errors are fixed but warnings remain.
|
||||
if (options.overlay) {
|
||||
overlay.send({
|
||||
type: "DISMISS"
|
||||
});
|
||||
}
|
||||
sendMessage("Invalid");
|
||||
},
|
||||
/**
|
||||
* @param {string} hash
|
||||
*/
|
||||
hash: function hash(_hash) {
|
||||
status.previousHash = status.currentHash;
|
||||
status.currentHash = _hash;
|
||||
},
|
||||
logging: setAllLogLevel,
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
overlay: function overlay(value) {
|
||||
if (typeof document === "undefined") {
|
||||
return;
|
||||
}
|
||||
options.overlay = value;
|
||||
decodeOverlayOptions(options.overlay);
|
||||
},
|
||||
/**
|
||||
* @param {number} value
|
||||
*/
|
||||
reconnect: function reconnect(value) {
|
||||
if (parsedResourceQuery.reconnect === "false") {
|
||||
return;
|
||||
}
|
||||
options.reconnect = value;
|
||||
},
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
progress: function progress(value) {
|
||||
options.progress = value;
|
||||
},
|
||||
/**
|
||||
* @param {{ pluginName?: string, percent: number, msg: string }} data
|
||||
*/
|
||||
"progress-update": function progressUpdate(data) {
|
||||
if (options.progress) {
|
||||
log.info("".concat(data.pluginName ? "[".concat(data.pluginName, "] ") : "").concat(data.percent, "% - ").concat(data.msg, "."));
|
||||
}
|
||||
sendMessage("Progress", data);
|
||||
},
|
||||
"still-ok": function stillOk() {
|
||||
log.info("Nothing changed.");
|
||||
if (options.overlay) {
|
||||
overlay.send({
|
||||
type: "DISMISS"
|
||||
});
|
||||
}
|
||||
sendMessage("StillOk");
|
||||
},
|
||||
ok: function ok() {
|
||||
sendMessage("Ok");
|
||||
if (options.overlay) {
|
||||
overlay.send({
|
||||
type: "DISMISS"
|
||||
});
|
||||
}
|
||||
reloadApp(options, status);
|
||||
},
|
||||
/**
|
||||
* @param {string} file
|
||||
*/
|
||||
"static-changed": function staticChanged(file) {
|
||||
log.info("".concat(file ? "\"".concat(file, "\"") : "Content", " from static directory was changed. Reloading..."));
|
||||
self.location.reload();
|
||||
},
|
||||
/**
|
||||
* @param {Error[]} warnings
|
||||
* @param {any} params
|
||||
*/
|
||||
warnings: function warnings(_warnings, params) {
|
||||
log.warn("Warnings while compiling.");
|
||||
var printableWarnings = _warnings.map(function (error) {
|
||||
var _formatProblem = formatProblem("warning", error),
|
||||
header = _formatProblem.header,
|
||||
body = _formatProblem.body;
|
||||
return "".concat(header, "\n").concat(stripAnsi(body));
|
||||
});
|
||||
sendMessage("Warnings", printableWarnings);
|
||||
for (var i = 0; i < printableWarnings.length; i++) {
|
||||
log.warn(printableWarnings[i]);
|
||||
}
|
||||
var overlayWarningsSetting = typeof options.overlay === "boolean" ? options.overlay : options.overlay && options.overlay.warnings;
|
||||
if (overlayWarningsSetting) {
|
||||
var warningsToDisplay = typeof overlayWarningsSetting === "function" ? _warnings.filter(overlayWarningsSetting) : _warnings;
|
||||
if (warningsToDisplay.length) {
|
||||
overlay.send({
|
||||
type: "BUILD_ERROR",
|
||||
level: "warning",
|
||||
messages: _warnings
|
||||
});
|
||||
}
|
||||
}
|
||||
if (params && params.preventReloading) {
|
||||
return;
|
||||
}
|
||||
reloadApp(options, status);
|
||||
},
|
||||
/**
|
||||
* @param {Error[]} errors
|
||||
*/
|
||||
errors: function errors(_errors) {
|
||||
log.error("Errors while compiling. Reload prevented.");
|
||||
var printableErrors = _errors.map(function (error) {
|
||||
var _formatProblem2 = formatProblem("error", error),
|
||||
header = _formatProblem2.header,
|
||||
body = _formatProblem2.body;
|
||||
return "".concat(header, "\n").concat(stripAnsi(body));
|
||||
});
|
||||
sendMessage("Errors", printableErrors);
|
||||
for (var i = 0; i < printableErrors.length; i++) {
|
||||
log.error(printableErrors[i]);
|
||||
}
|
||||
var overlayErrorsSettings = typeof options.overlay === "boolean" ? options.overlay : options.overlay && options.overlay.errors;
|
||||
if (overlayErrorsSettings) {
|
||||
var errorsToDisplay = typeof overlayErrorsSettings === "function" ? _errors.filter(overlayErrorsSettings) : _errors;
|
||||
if (errorsToDisplay.length) {
|
||||
overlay.send({
|
||||
type: "BUILD_ERROR",
|
||||
level: "error",
|
||||
messages: _errors
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @param {Error} error
|
||||
*/
|
||||
error: function error(_error) {
|
||||
log.error(_error);
|
||||
},
|
||||
close: function close() {
|
||||
log.info("Disconnected!");
|
||||
if (options.overlay) {
|
||||
overlay.send({
|
||||
type: "DISMISS"
|
||||
});
|
||||
}
|
||||
sendMessage("Close");
|
||||
}
|
||||
};
|
||||
var socketURL = createSocketURL(parsedResourceQuery);
|
||||
socket(socketURL, onSocketMessage, options.reconnect);
|
268
node_modules/webpack-dev-server/client/overlay.js
generated
vendored
Normal file
268
node_modules/webpack-dev-server/client/overlay.js
generated
vendored
Normal file
|
@ -0,0 +1,268 @@
|
|||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
// The error overlay is inspired (and mostly copied) from Create React App (https://github.com/facebookincubator/create-react-app)
|
||||
// They, in turn, got inspired by webpack-hot-middleware (https://github.com/glenjamin/webpack-hot-middleware).
|
||||
|
||||
import ansiHTML from "ansi-html-community";
|
||||
import { encode } from "html-entities";
|
||||
import { listenToRuntimeError, listenToUnhandledRejection, parseErrorToStacks } from "./overlay/runtime-error.js";
|
||||
import createOverlayMachine from "./overlay/state-machine.js";
|
||||
import { containerStyle, dismissButtonStyle, headerStyle, iframeStyle, msgStyles, msgTextStyle, msgTypeStyle } from "./overlay/styles.js";
|
||||
var colors = {
|
||||
reset: ["transparent", "transparent"],
|
||||
black: "181818",
|
||||
red: "E36049",
|
||||
green: "B3CB74",
|
||||
yellow: "FFD080",
|
||||
blue: "7CAFC2",
|
||||
magenta: "7FACCA",
|
||||
cyan: "C3C2EF",
|
||||
lightgrey: "EBE7E3",
|
||||
darkgrey: "6D7891"
|
||||
};
|
||||
ansiHTML.setColors(colors);
|
||||
|
||||
/**
|
||||
* @param {string} type
|
||||
* @param {string | { file?: string, moduleName?: string, loc?: string, message?: string; stack?: string[] }} item
|
||||
* @returns {{ header: string, body: string }}
|
||||
*/
|
||||
function formatProblem(type, item) {
|
||||
var header = type === "warning" ? "WARNING" : "ERROR";
|
||||
var body = "";
|
||||
if (typeof item === "string") {
|
||||
body += item;
|
||||
} else {
|
||||
var file = item.file || "";
|
||||
// eslint-disable-next-line no-nested-ternary
|
||||
var moduleName = item.moduleName ? item.moduleName.indexOf("!") !== -1 ? "".concat(item.moduleName.replace(/^(\s|\S)*!/, ""), " (").concat(item.moduleName, ")") : "".concat(item.moduleName) : "";
|
||||
var loc = item.loc;
|
||||
header += "".concat(moduleName || file ? " in ".concat(moduleName ? "".concat(moduleName).concat(file ? " (".concat(file, ")") : "") : file).concat(loc ? " ".concat(loc) : "") : "");
|
||||
body += item.message || "";
|
||||
}
|
||||
if (Array.isArray(item.stack)) {
|
||||
item.stack.forEach(function (stack) {
|
||||
if (typeof stack === "string") {
|
||||
body += "\r\n".concat(stack);
|
||||
}
|
||||
});
|
||||
}
|
||||
return {
|
||||
header: header,
|
||||
body: body
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} CreateOverlayOptions
|
||||
* @property {string | null} trustedTypesPolicyName
|
||||
* @property {boolean | (error: Error) => void} [catchRuntimeError]
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {CreateOverlayOptions} options
|
||||
*/
|
||||
var createOverlay = function createOverlay(options) {
|
||||
/** @type {HTMLIFrameElement | null | undefined} */
|
||||
var iframeContainerElement;
|
||||
/** @type {HTMLDivElement | null | undefined} */
|
||||
var containerElement;
|
||||
/** @type {HTMLDivElement | null | undefined} */
|
||||
var headerElement;
|
||||
/** @type {Array<(element: HTMLDivElement) => void>} */
|
||||
var onLoadQueue = [];
|
||||
/** @type {TrustedTypePolicy | undefined} */
|
||||
var overlayTrustedTypesPolicy;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @param {CSSStyleDeclaration} style
|
||||
*/
|
||||
function applyStyle(element, style) {
|
||||
Object.keys(style).forEach(function (prop) {
|
||||
element.style[prop] = style[prop];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string | null} trustedTypesPolicyName
|
||||
*/
|
||||
function createContainer(trustedTypesPolicyName) {
|
||||
// Enable Trusted Types if they are available in the current browser.
|
||||
if (window.trustedTypes) {
|
||||
overlayTrustedTypesPolicy = window.trustedTypes.createPolicy(trustedTypesPolicyName || "webpack-dev-server#overlay", {
|
||||
createHTML: function createHTML(value) {
|
||||
return value;
|
||||
}
|
||||
});
|
||||
}
|
||||
iframeContainerElement = document.createElement("iframe");
|
||||
iframeContainerElement.id = "webpack-dev-server-client-overlay";
|
||||
iframeContainerElement.src = "about:blank";
|
||||
applyStyle(iframeContainerElement, iframeStyle);
|
||||
iframeContainerElement.onload = function () {
|
||||
var contentElement = /** @type {Document} */
|
||||
( /** @type {HTMLIFrameElement} */
|
||||
iframeContainerElement.contentDocument).createElement("div");
|
||||
containerElement = /** @type {Document} */
|
||||
( /** @type {HTMLIFrameElement} */
|
||||
iframeContainerElement.contentDocument).createElement("div");
|
||||
contentElement.id = "webpack-dev-server-client-overlay-div";
|
||||
applyStyle(contentElement, containerStyle);
|
||||
headerElement = document.createElement("div");
|
||||
headerElement.innerText = "Compiled with problems:";
|
||||
applyStyle(headerElement, headerStyle);
|
||||
var closeButtonElement = document.createElement("button");
|
||||
applyStyle(closeButtonElement, dismissButtonStyle);
|
||||
closeButtonElement.innerText = "×";
|
||||
closeButtonElement.ariaLabel = "Dismiss";
|
||||
closeButtonElement.addEventListener("click", function () {
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
overlayService.send({
|
||||
type: "DISMISS"
|
||||
});
|
||||
});
|
||||
contentElement.appendChild(headerElement);
|
||||
contentElement.appendChild(closeButtonElement);
|
||||
contentElement.appendChild(containerElement);
|
||||
|
||||
/** @type {Document} */
|
||||
( /** @type {HTMLIFrameElement} */
|
||||
iframeContainerElement.contentDocument).body.appendChild(contentElement);
|
||||
onLoadQueue.forEach(function (onLoad) {
|
||||
onLoad( /** @type {HTMLDivElement} */contentElement);
|
||||
});
|
||||
onLoadQueue = [];
|
||||
|
||||
/** @type {HTMLIFrameElement} */
|
||||
iframeContainerElement.onload = null;
|
||||
};
|
||||
document.body.appendChild(iframeContainerElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {(element: HTMLDivElement) => void} callback
|
||||
* @param {string | null} trustedTypesPolicyName
|
||||
*/
|
||||
function ensureOverlayExists(callback, trustedTypesPolicyName) {
|
||||
if (containerElement) {
|
||||
containerElement.innerHTML = overlayTrustedTypesPolicy ? overlayTrustedTypesPolicy.createHTML("") : "";
|
||||
// Everything is ready, call the callback right away.
|
||||
callback(containerElement);
|
||||
return;
|
||||
}
|
||||
onLoadQueue.push(callback);
|
||||
if (iframeContainerElement) {
|
||||
return;
|
||||
}
|
||||
createContainer(trustedTypesPolicyName);
|
||||
}
|
||||
|
||||
// Successful compilation.
|
||||
function hide() {
|
||||
if (!iframeContainerElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clean up and reset internal state.
|
||||
document.body.removeChild(iframeContainerElement);
|
||||
iframeContainerElement = null;
|
||||
containerElement = null;
|
||||
}
|
||||
|
||||
// Compilation with errors (e.g. syntax error or missing modules).
|
||||
/**
|
||||
* @param {string} type
|
||||
* @param {Array<string | { moduleIdentifier?: string, moduleName?: string, loc?: string, message?: string }>} messages
|
||||
* @param {string | null} trustedTypesPolicyName
|
||||
* @param {'build' | 'runtime'} messageSource
|
||||
*/
|
||||
function show(type, messages, trustedTypesPolicyName, messageSource) {
|
||||
ensureOverlayExists(function () {
|
||||
headerElement.innerText = messageSource === "runtime" ? "Uncaught runtime errors:" : "Compiled with problems:";
|
||||
messages.forEach(function (message) {
|
||||
var entryElement = document.createElement("div");
|
||||
var msgStyle = type === "warning" ? msgStyles.warning : msgStyles.error;
|
||||
applyStyle(entryElement, _objectSpread(_objectSpread({}, msgStyle), {}, {
|
||||
padding: "1rem 1rem 1.5rem 1rem"
|
||||
}));
|
||||
var typeElement = document.createElement("div");
|
||||
var _formatProblem = formatProblem(type, message),
|
||||
header = _formatProblem.header,
|
||||
body = _formatProblem.body;
|
||||
typeElement.innerText = header;
|
||||
applyStyle(typeElement, msgTypeStyle);
|
||||
if (message.moduleIdentifier) {
|
||||
applyStyle(typeElement, {
|
||||
cursor: "pointer"
|
||||
});
|
||||
// element.dataset not supported in IE
|
||||
typeElement.setAttribute("data-can-open", true);
|
||||
typeElement.addEventListener("click", function () {
|
||||
fetch("/webpack-dev-server/open-editor?fileName=".concat(message.moduleIdentifier));
|
||||
});
|
||||
}
|
||||
|
||||
// Make it look similar to our terminal.
|
||||
var text = ansiHTML(encode(body));
|
||||
var messageTextNode = document.createElement("div");
|
||||
applyStyle(messageTextNode, msgTextStyle);
|
||||
messageTextNode.innerHTML = overlayTrustedTypesPolicy ? overlayTrustedTypesPolicy.createHTML(text) : text;
|
||||
entryElement.appendChild(typeElement);
|
||||
entryElement.appendChild(messageTextNode);
|
||||
|
||||
/** @type {HTMLDivElement} */
|
||||
containerElement.appendChild(entryElement);
|
||||
});
|
||||
}, trustedTypesPolicyName);
|
||||
}
|
||||
var overlayService = createOverlayMachine({
|
||||
showOverlay: function showOverlay(_ref) {
|
||||
var _ref$level = _ref.level,
|
||||
level = _ref$level === void 0 ? "error" : _ref$level,
|
||||
messages = _ref.messages,
|
||||
messageSource = _ref.messageSource;
|
||||
return show(level, messages, options.trustedTypesPolicyName, messageSource);
|
||||
},
|
||||
hideOverlay: hide
|
||||
});
|
||||
if (options.catchRuntimeError) {
|
||||
/**
|
||||
* @param {Error | undefined} error
|
||||
* @param {string} fallbackMessage
|
||||
*/
|
||||
var handleError = function handleError(error, fallbackMessage) {
|
||||
var errorObject = error instanceof Error ? error : new Error(error || fallbackMessage);
|
||||
var shouldDisplay = typeof options.catchRuntimeError === "function" ? options.catchRuntimeError(errorObject) : true;
|
||||
if (shouldDisplay) {
|
||||
overlayService.send({
|
||||
type: "RUNTIME_ERROR",
|
||||
messages: [{
|
||||
message: errorObject.message,
|
||||
stack: parseErrorToStacks(errorObject)
|
||||
}]
|
||||
});
|
||||
}
|
||||
};
|
||||
listenToRuntimeError(function (errorEvent) {
|
||||
// error property may be empty in older browser like IE
|
||||
var error = errorEvent.error,
|
||||
message = errorEvent.message;
|
||||
if (!error && !message) {
|
||||
return;
|
||||
}
|
||||
handleError(error, message);
|
||||
});
|
||||
listenToUnhandledRejection(function (promiseRejectionEvent) {
|
||||
var reason = promiseRejectionEvent.reason;
|
||||
handleError(reason, "Unknown promise rejection reason");
|
||||
});
|
||||
}
|
||||
return overlayService;
|
||||
};
|
||||
export { formatProblem, createOverlay };
|
66
node_modules/webpack-dev-server/client/socket.js
generated
vendored
Normal file
66
node_modules/webpack-dev-server/client/socket.js
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
/* global __webpack_dev_server_client__ */
|
||||
|
||||
import WebSocketClient from "./clients/WebSocketClient.js";
|
||||
import { log } from "./utils/log.js";
|
||||
|
||||
// this WebsocketClient is here as a default fallback, in case the client is not injected
|
||||
/* eslint-disable camelcase */
|
||||
var Client =
|
||||
// eslint-disable-next-line no-nested-ternary
|
||||
typeof __webpack_dev_server_client__ !== "undefined" ? typeof __webpack_dev_server_client__.default !== "undefined" ? __webpack_dev_server_client__.default : __webpack_dev_server_client__ : WebSocketClient;
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
var retries = 0;
|
||||
var maxRetries = 10;
|
||||
|
||||
// Initialized client is exported so external consumers can utilize the same instance
|
||||
// It is mutable to enforce singleton
|
||||
// eslint-disable-next-line import/no-mutable-exports
|
||||
export var client = null;
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
* @param {{ [handler: string]: (data?: any, params?: any) => any }} handlers
|
||||
* @param {number} [reconnect]
|
||||
*/
|
||||
var socket = function initSocket(url, handlers, reconnect) {
|
||||
client = new Client(url);
|
||||
client.onOpen(function () {
|
||||
retries = 0;
|
||||
if (typeof reconnect !== "undefined") {
|
||||
maxRetries = reconnect;
|
||||
}
|
||||
});
|
||||
client.onClose(function () {
|
||||
if (retries === 0) {
|
||||
handlers.close();
|
||||
}
|
||||
|
||||
// Try to reconnect.
|
||||
client = null;
|
||||
|
||||
// After 10 retries stop trying, to prevent logspam.
|
||||
if (retries < maxRetries) {
|
||||
// Exponentially increase timeout to reconnect.
|
||||
// Respectfully copied from the package `got`.
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
var retryInMs = 1000 * Math.pow(2, retries) + Math.random() * 100;
|
||||
retries += 1;
|
||||
log.info("Trying to reconnect...");
|
||||
setTimeout(function () {
|
||||
socket(url, handlers, reconnect);
|
||||
}, retryInMs);
|
||||
}
|
||||
});
|
||||
client.onMessage(
|
||||
/**
|
||||
* @param {any} data
|
||||
*/
|
||||
function (data) {
|
||||
var message = JSON.parse(data);
|
||||
if (handlers[message.type]) {
|
||||
handlers[message.type](message.data, message.params);
|
||||
}
|
||||
});
|
||||
};
|
||||
export default socket;
|
24
node_modules/webpack-dev-server/client/utils/getCurrentScriptSource.js
generated
vendored
Normal file
24
node_modules/webpack-dev-server/client/utils/getCurrentScriptSource.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
function getCurrentScriptSource() {
|
||||
// `document.currentScript` is the most accurate way to find the current script,
|
||||
// but is not supported in all browsers.
|
||||
if (document.currentScript) {
|
||||
return document.currentScript.getAttribute("src");
|
||||
}
|
||||
|
||||
// Fallback to getting all scripts running in the document.
|
||||
var scriptElements = document.scripts || [];
|
||||
var scriptElementsWithSrc = Array.prototype.filter.call(scriptElements, function (element) {
|
||||
return element.getAttribute("src");
|
||||
});
|
||||
if (scriptElementsWithSrc.length > 0) {
|
||||
var currentScript = scriptElementsWithSrc[scriptElementsWithSrc.length - 1];
|
||||
return currentScript.getAttribute("src");
|
||||
}
|
||||
|
||||
// Fail as there was no script to use.
|
||||
throw new Error("[webpack-dev-server] Failed to get current script source.");
|
||||
}
|
||||
export default getCurrentScriptSource;
|
35
node_modules/webpack-dev-server/client/utils/log.js
generated
vendored
Normal file
35
node_modules/webpack-dev-server/client/utils/log.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
import logger from "../modules/logger/index.js";
|
||||
var name = "webpack-dev-server";
|
||||
// default level is set on the client side, so it does not need
|
||||
// to be set by the CLI or API
|
||||
var defaultLevel = "info";
|
||||
|
||||
// options new options, merge with old options
|
||||
/**
|
||||
* @param {false | true | "none" | "error" | "warn" | "info" | "log" | "verbose"} level
|
||||
* @returns {void}
|
||||
*/
|
||||
function setLogLevel(level) {
|
||||
logger.configureDefaultLogger({
|
||||
level: level
|
||||
});
|
||||
}
|
||||
setLogLevel(defaultLevel);
|
||||
var log = logger.getLogger(name);
|
||||
var logEnabledFeatures = function logEnabledFeatures(features) {
|
||||
var enabledFeatures = Object.keys(features);
|
||||
if (!features || enabledFeatures.length === 0) {
|
||||
return;
|
||||
}
|
||||
var logString = "Server started:";
|
||||
|
||||
// Server started: Hot Module Replacement enabled, Live Reloading enabled, Overlay disabled.
|
||||
for (var i = 0; i < enabledFeatures.length; i++) {
|
||||
var key = enabledFeatures[i];
|
||||
logString += " ".concat(key, " ").concat(features[key] ? "enabled" : "disabled", ",");
|
||||
}
|
||||
// replace last comma with a period
|
||||
logString = logString.slice(0, -1).concat(".");
|
||||
log.info(logString);
|
||||
};
|
||||
export { log, logEnabledFeatures, setLogLevel };
|
63
node_modules/webpack-dev-server/client/utils/reloadApp.js
generated
vendored
Normal file
63
node_modules/webpack-dev-server/client/utils/reloadApp.js
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
import hotEmitter from "webpack/hot/emitter.js";
|
||||
import { log } from "./log.js";
|
||||
|
||||
/** @typedef {import("../index").Options} Options
|
||||
/** @typedef {import("../index").Status} Status
|
||||
|
||||
/**
|
||||
* @param {Options} options
|
||||
* @param {Status} status
|
||||
*/
|
||||
function reloadApp(_ref, status) {
|
||||
var hot = _ref.hot,
|
||||
liveReload = _ref.liveReload;
|
||||
if (status.isUnloading) {
|
||||
return;
|
||||
}
|
||||
var currentHash = status.currentHash,
|
||||
previousHash = status.previousHash;
|
||||
var isInitial = currentHash.indexOf( /** @type {string} */previousHash) >= 0;
|
||||
if (isInitial) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Window} rootWindow
|
||||
* @param {number} intervalId
|
||||
*/
|
||||
function applyReload(rootWindow, intervalId) {
|
||||
clearInterval(intervalId);
|
||||
log.info("App updated. Reloading...");
|
||||
rootWindow.location.reload();
|
||||
}
|
||||
var search = self.location.search.toLowerCase();
|
||||
var allowToHot = search.indexOf("webpack-dev-server-hot=false") === -1;
|
||||
var allowToLiveReload = search.indexOf("webpack-dev-server-live-reload=false") === -1;
|
||||
if (hot && allowToHot) {
|
||||
log.info("App hot update...");
|
||||
hotEmitter.emit("webpackHotUpdate", status.currentHash);
|
||||
if (typeof self !== "undefined" && self.window) {
|
||||
// broadcast update to window
|
||||
self.postMessage("webpackHotUpdate".concat(status.currentHash), "*");
|
||||
}
|
||||
}
|
||||
// allow refreshing the page only if liveReload isn't disabled
|
||||
else if (liveReload && allowToLiveReload) {
|
||||
var rootWindow = self;
|
||||
|
||||
// use parent window for reload (in case we're in an iframe with no valid src)
|
||||
var intervalId = self.setInterval(function () {
|
||||
if (rootWindow.location.protocol !== "about:") {
|
||||
// reload immediately if protocol is valid
|
||||
applyReload(rootWindow, intervalId);
|
||||
} else {
|
||||
rootWindow = rootWindow.parent;
|
||||
if (rootWindow.parent === rootWindow) {
|
||||
// if parent equals current window we've reached the root which would continue forever, so trigger a reload anyways
|
||||
applyReload(rootWindow, intervalId);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
export default reloadApp;
|
16
node_modules/webpack-dev-server/client/utils/sendMessage.js
generated
vendored
Normal file
16
node_modules/webpack-dev-server/client/utils/sendMessage.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* global __resourceQuery WorkerGlobalScope */
|
||||
|
||||
// Send messages to the outside, so plugins can consume it.
|
||||
/**
|
||||
* @param {string} type
|
||||
* @param {any} [data]
|
||||
*/
|
||||
function sendMsg(type, data) {
|
||||
if (typeof self !== "undefined" && (typeof WorkerGlobalScope === "undefined" || !(self instanceof WorkerGlobalScope))) {
|
||||
self.postMessage({
|
||||
type: "webpack".concat(type),
|
||||
data: data
|
||||
}, "*");
|
||||
}
|
||||
}
|
||||
export default sendMsg;
|
Loading…
Add table
Add a link
Reference in a new issue