index.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  1. /******/ var __webpack_modules__ = ({
  2. /***/ "./node_modules/webpack/lib/logging/Logger.js":
  3. /*!****************************************************!*\
  4. !*** ./node_modules/webpack/lib/logging/Logger.js ***!
  5. \****************************************************/
  6. /***/ (function(module) {
  7. /*
  8. MIT License http://www.opensource.org/licenses/mit-license.php
  9. Author Tobias Koppers @sokra
  10. */
  11. function _typeof(o) {
  12. "@babel/helpers - typeof";
  13. return _typeof = "function" == typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && "symbol" == typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).iterator ? function (o) {
  14. return typeof o;
  15. } : function (o) {
  16. return o && "function" == typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && o.constructor === (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && o !== (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).prototype ? "symbol" : typeof o;
  17. }, _typeof(o);
  18. }
  19. function _toConsumableArray(r) {
  20. return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
  21. }
  22. function _nonIterableSpread() {
  23. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  24. }
  25. function _unsupportedIterableToArray(r, a) {
  26. if (r) {
  27. if ("string" == typeof r) return _arrayLikeToArray(r, a);
  28. var t = {}.toString.call(r).slice(8, -1);
  29. return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
  30. }
  31. }
  32. function _iterableToArray(r) {
  33. if ("undefined" != typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && null != r[(typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).iterator] || null != r["@@iterator"]) return Array.from(r);
  34. }
  35. function _arrayWithoutHoles(r) {
  36. if (Array.isArray(r)) return _arrayLikeToArray(r);
  37. }
  38. function _arrayLikeToArray(r, a) {
  39. (null == a || a > r.length) && (a = r.length);
  40. for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
  41. return n;
  42. }
  43. function _classCallCheck(a, n) {
  44. if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
  45. }
  46. function _defineProperties(e, r) {
  47. for (var t = 0; t < r.length; t++) {
  48. var o = r[t];
  49. o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
  50. }
  51. }
  52. function _createClass(e, r, t) {
  53. return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
  54. writable: !1
  55. }), e;
  56. }
  57. function _toPropertyKey(t) {
  58. var i = _toPrimitive(t, "string");
  59. return "symbol" == _typeof(i) ? i : i + "";
  60. }
  61. function _toPrimitive(t, r) {
  62. if ("object" != _typeof(t) || !t) return t;
  63. var e = t[(typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).toPrimitive];
  64. if (void 0 !== e) {
  65. var i = e.call(t, r || "default");
  66. if ("object" != _typeof(i)) return i;
  67. throw new TypeError("@@toPrimitive must return a primitive value.");
  68. }
  69. return ("string" === r ? String : Number)(t);
  70. }
  71. var LogType = Object.freeze({
  72. error: (/** @type {"error"} */"error"),
  73. // message, c style arguments
  74. warn: (/** @type {"warn"} */"warn"),
  75. // message, c style arguments
  76. info: (/** @type {"info"} */"info"),
  77. // message, c style arguments
  78. log: (/** @type {"log"} */"log"),
  79. // message, c style arguments
  80. debug: (/** @type {"debug"} */"debug"),
  81. // message, c style arguments
  82. trace: (/** @type {"trace"} */"trace"),
  83. // no arguments
  84. group: (/** @type {"group"} */"group"),
  85. // [label]
  86. groupCollapsed: (/** @type {"groupCollapsed"} */"groupCollapsed"),
  87. // [label]
  88. groupEnd: (/** @type {"groupEnd"} */"groupEnd"),
  89. // [label]
  90. profile: (/** @type {"profile"} */"profile"),
  91. // [profileName]
  92. profileEnd: (/** @type {"profileEnd"} */"profileEnd"),
  93. // [profileName]
  94. time: (/** @type {"time"} */"time"),
  95. // name, time as [seconds, nanoseconds]
  96. clear: (/** @type {"clear"} */"clear"),
  97. // no arguments
  98. status: (/** @type {"status"} */"status") // message, arguments
  99. });
  100. module.exports.LogType = LogType;
  101. /** @typedef {typeof LogType[keyof typeof LogType]} LogTypeEnum */
  102. /** @typedef {Map<string | undefined, [number, number]>} TimersMap */
  103. var LOG_SYMBOL = (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; })("webpack logger raw log method");
  104. var TIMERS_SYMBOL = (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; })("webpack logger times");
  105. var TIMERS_AGGREGATES_SYMBOL = (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; })("webpack logger aggregated times");
  106. /** @typedef {EXPECTED_ANY[]} Args */
  107. /** @typedef {(type: LogTypeEnum, args?: Args) => void} LogFn */
  108. /** @typedef {(name: string | (() => string)) => WebpackLogger} GetChildLogger */
  109. var WebpackLogger = /*#__PURE__*/function () {
  110. /**
  111. * Creates an instance of WebpackLogger.
  112. * @param {LogFn} log log function
  113. * @param {GetChildLogger} getChildLogger function to create child logger
  114. */
  115. function WebpackLogger(log, getChildLogger) {
  116. _classCallCheck(this, WebpackLogger);
  117. /** @type {LogFn} */
  118. this[LOG_SYMBOL] = log;
  119. /** @type {GetChildLogger} */
  120. this.getChildLogger = getChildLogger;
  121. }
  122. /**
  123. * Processes the provided arg.
  124. * @param {Args} args args
  125. */
  126. return _createClass(WebpackLogger, [{
  127. key: "error",
  128. value: function error() {
  129. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  130. args[_key] = arguments[_key];
  131. }
  132. this[LOG_SYMBOL](LogType.error, args);
  133. }
  134. /**
  135. * Processes the provided arg.
  136. * @param {Args} args args
  137. */
  138. }, {
  139. key: "warn",
  140. value: function warn() {
  141. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  142. args[_key2] = arguments[_key2];
  143. }
  144. this[LOG_SYMBOL](LogType.warn, args);
  145. }
  146. /**
  147. * Processes the provided arg.
  148. * @param {Args} args args
  149. */
  150. }, {
  151. key: "info",
  152. value: function info() {
  153. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  154. args[_key3] = arguments[_key3];
  155. }
  156. this[LOG_SYMBOL](LogType.info, args);
  157. }
  158. /**
  159. * Processes the provided arg.
  160. * @param {Args} args args
  161. */
  162. }, {
  163. key: "log",
  164. value: function log() {
  165. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  166. args[_key4] = arguments[_key4];
  167. }
  168. this[LOG_SYMBOL](LogType.log, args);
  169. }
  170. /**
  171. * Processes the provided arg.
  172. * @param {Args} args args
  173. */
  174. }, {
  175. key: "debug",
  176. value: function debug() {
  177. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  178. args[_key5] = arguments[_key5];
  179. }
  180. this[LOG_SYMBOL](LogType.debug, args);
  181. }
  182. /**
  183. * Processes the provided condition.
  184. * @param {boolean=} condition condition
  185. * @param {Args} args args
  186. */
  187. }, {
  188. key: "assert",
  189. value: function assert(condition) {
  190. if (!condition) {
  191. for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
  192. args[_key6 - 1] = arguments[_key6];
  193. }
  194. this[LOG_SYMBOL](LogType.error, args);
  195. }
  196. }
  197. }, {
  198. key: "trace",
  199. value: function trace() {
  200. this[LOG_SYMBOL](LogType.trace, ["Trace"]);
  201. }
  202. }, {
  203. key: "clear",
  204. value: function clear() {
  205. this[LOG_SYMBOL](LogType.clear);
  206. }
  207. /**
  208. * Processes the provided arg.
  209. * @param {Args} args args
  210. */
  211. }, {
  212. key: "status",
  213. value: function status() {
  214. for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  215. args[_key7] = arguments[_key7];
  216. }
  217. this[LOG_SYMBOL](LogType.status, args);
  218. }
  219. /**
  220. * Processes the provided arg.
  221. * @param {Args} args args
  222. */
  223. }, {
  224. key: "group",
  225. value: function group() {
  226. for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  227. args[_key8] = arguments[_key8];
  228. }
  229. this[LOG_SYMBOL](LogType.group, args);
  230. }
  231. /**
  232. * Processes the provided arg.
  233. * @param {Args} args args
  234. */
  235. }, {
  236. key: "groupCollapsed",
  237. value: function groupCollapsed() {
  238. for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
  239. args[_key9] = arguments[_key9];
  240. }
  241. this[LOG_SYMBOL](LogType.groupCollapsed, args);
  242. }
  243. }, {
  244. key: "groupEnd",
  245. value: function groupEnd() {
  246. this[LOG_SYMBOL](LogType.groupEnd);
  247. }
  248. /**
  249. * Processes the provided label.
  250. * @param {string=} label label
  251. */
  252. }, {
  253. key: "profile",
  254. value: function profile(label) {
  255. this[LOG_SYMBOL](LogType.profile, [label]);
  256. }
  257. /**
  258. * Processes the provided label.
  259. * @param {string=} label label
  260. */
  261. }, {
  262. key: "profileEnd",
  263. value: function profileEnd(label) {
  264. this[LOG_SYMBOL](LogType.profileEnd, [label]);
  265. }
  266. /**
  267. * Processes the provided label.
  268. * @param {string} label label
  269. */
  270. }, {
  271. key: "time",
  272. value: function time(label) {
  273. /** @type {TimersMap} */
  274. this[TIMERS_SYMBOL] = this[TIMERS_SYMBOL] || new Map();
  275. this[TIMERS_SYMBOL].set(label, process.hrtime());
  276. }
  277. /**
  278. * Processes the provided label.
  279. * @param {string=} label label
  280. */
  281. }, {
  282. key: "timeLog",
  283. value: function timeLog(label) {
  284. var prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label);
  285. if (!prev) {
  286. throw new Error("No such label '".concat(label, "' for WebpackLogger.timeLog()"));
  287. }
  288. var time = process.hrtime(prev);
  289. this[LOG_SYMBOL](LogType.time, [label].concat(_toConsumableArray(time)));
  290. }
  291. /**
  292. * Processes the provided label.
  293. * @param {string=} label label
  294. */
  295. }, {
  296. key: "timeEnd",
  297. value: function timeEnd(label) {
  298. var prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label);
  299. if (!prev) {
  300. throw new Error("No such label '".concat(label, "' for WebpackLogger.timeEnd()"));
  301. }
  302. var time = process.hrtime(prev);
  303. /** @type {TimersMap} */
  304. this[TIMERS_SYMBOL].delete(label);
  305. this[LOG_SYMBOL](LogType.time, [label].concat(_toConsumableArray(time)));
  306. }
  307. /**
  308. * Processes the provided label.
  309. * @param {string=} label label
  310. */
  311. }, {
  312. key: "timeAggregate",
  313. value: function timeAggregate(label) {
  314. var prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label);
  315. if (!prev) {
  316. throw new Error("No such label '".concat(label, "' for WebpackLogger.timeAggregate()"));
  317. }
  318. var time = process.hrtime(prev);
  319. /** @type {TimersMap} */
  320. this[TIMERS_SYMBOL].delete(label);
  321. /** @type {TimersMap} */
  322. this[TIMERS_AGGREGATES_SYMBOL] = this[TIMERS_AGGREGATES_SYMBOL] || new Map();
  323. var current = this[TIMERS_AGGREGATES_SYMBOL].get(label);
  324. if (current !== undefined) {
  325. if (time[1] + current[1] > 1e9) {
  326. time[0] += current[0] + 1;
  327. time[1] = time[1] - 1e9 + current[1];
  328. } else {
  329. time[0] += current[0];
  330. time[1] += current[1];
  331. }
  332. }
  333. this[TIMERS_AGGREGATES_SYMBOL].set(label, time);
  334. }
  335. /**
  336. * Time aggregate end.
  337. * @param {string=} label label
  338. */
  339. }, {
  340. key: "timeAggregateEnd",
  341. value: function timeAggregateEnd(label) {
  342. if (this[TIMERS_AGGREGATES_SYMBOL] === undefined) return;
  343. var time = this[TIMERS_AGGREGATES_SYMBOL].get(label);
  344. if (time === undefined) return;
  345. this[TIMERS_AGGREGATES_SYMBOL].delete(label);
  346. this[LOG_SYMBOL](LogType.time, [label].concat(_toConsumableArray(time)));
  347. }
  348. }]);
  349. }();
  350. module.exports.Logger = WebpackLogger;
  351. /***/ }),
  352. /***/ "./node_modules/webpack/lib/logging/createConsoleLogger.js":
  353. /*!*****************************************************************!*\
  354. !*** ./node_modules/webpack/lib/logging/createConsoleLogger.js ***!
  355. \*****************************************************************/
  356. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  357. /*
  358. MIT License http://www.opensource.org/licenses/mit-license.php
  359. Author Tobias Koppers @sokra
  360. */
  361. function _slicedToArray(r, e) {
  362. return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
  363. }
  364. function _nonIterableRest() {
  365. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  366. }
  367. function _iterableToArrayLimit(r, l) {
  368. var t = null == r ? null : "undefined" != typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && r[(typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).iterator] || r["@@iterator"];
  369. if (null != t) {
  370. var e,
  371. n,
  372. i,
  373. u,
  374. a = [],
  375. f = !0,
  376. o = !1;
  377. try {
  378. if (i = (t = t.call(r)).next, 0 === l) {
  379. if (Object(t) !== t) return;
  380. f = !1;
  381. } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
  382. } catch (r) {
  383. o = !0, n = r;
  384. } finally {
  385. try {
  386. if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
  387. } finally {
  388. if (o) throw n;
  389. }
  390. }
  391. return a;
  392. }
  393. }
  394. function _arrayWithHoles(r) {
  395. if (Array.isArray(r)) return r;
  396. }
  397. function _toConsumableArray(r) {
  398. return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
  399. }
  400. function _nonIterableSpread() {
  401. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  402. }
  403. function _unsupportedIterableToArray(r, a) {
  404. if (r) {
  405. if ("string" == typeof r) return _arrayLikeToArray(r, a);
  406. var t = {}.toString.call(r).slice(8, -1);
  407. return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
  408. }
  409. }
  410. function _iterableToArray(r) {
  411. if ("undefined" != typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && null != r[(typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).iterator] || null != r["@@iterator"]) return Array.from(r);
  412. }
  413. function _arrayWithoutHoles(r) {
  414. if (Array.isArray(r)) return _arrayLikeToArray(r);
  415. }
  416. function _arrayLikeToArray(r, a) {
  417. (null == a || a > r.length) && (a = r.length);
  418. for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
  419. return n;
  420. }
  421. function _typeof(o) {
  422. "@babel/helpers - typeof";
  423. return _typeof = "function" == typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && "symbol" == typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).iterator ? function (o) {
  424. return typeof o;
  425. } : function (o) {
  426. return o && "function" == typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && o.constructor === (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && o !== (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).prototype ? "symbol" : typeof o;
  427. }, _typeof(o);
  428. }
  429. var _require = __webpack_require__(/*! ./Logger */ "./node_modules/webpack/lib/logging/Logger.js"),
  430. LogType = _require.LogType;
  431. /** @typedef {import("../../declarations/WebpackOptions").FilterItemTypes} FilterItemTypes */
  432. /** @typedef {import("../../declarations/WebpackOptions").FilterTypes} FilterTypes */
  433. /** @typedef {import("./Logger").LogTypeEnum} LogTypeEnum */
  434. /** @typedef {import("./Logger").Args} Args */
  435. /** @typedef {(item: string) => boolean} FilterFunction */
  436. /** @typedef {(value: string, type: LogTypeEnum, args?: Args) => void} LoggingFunction */
  437. /**
  438. * Defines the logger console type used by this module.
  439. * @typedef {object} LoggerConsole
  440. * @property {() => void} clear
  441. * @property {() => void} trace
  442. * @property {(...args: Args) => void} info
  443. * @property {(...args: Args) => void} log
  444. * @property {(...args: Args) => void} warn
  445. * @property {(...args: Args) => void} error
  446. * @property {(...args: Args) => void=} debug
  447. * @property {(...args: Args) => void=} group
  448. * @property {(...args: Args) => void=} groupCollapsed
  449. * @property {(...args: Args) => void=} groupEnd
  450. * @property {(...args: Args) => void=} status
  451. * @property {(...args: Args) => void=} profile
  452. * @property {(...args: Args) => void=} profileEnd
  453. * @property {(...args: Args) => void=} logTime
  454. */
  455. /**
  456. * Defines the logger options type used by this module.
  457. * @typedef {object} LoggerOptions
  458. * @property {false | true | "none" | "error" | "warn" | "info" | "log" | "verbose"} level loglevel
  459. * @property {FilterTypes | boolean} debug filter for debug logging
  460. * @property {LoggerConsole} console the console to log to
  461. */
  462. /**
  463. * Filter to function.
  464. * @param {FilterItemTypes} item an input item
  465. * @returns {FilterFunction | undefined} filter function
  466. */
  467. var filterToFunction = function filterToFunction(item) {
  468. if (typeof item === "string") {
  469. var regExp = new RegExp("[\\\\/]".concat(item.replace(/[-[\]{}()*+?.\\^$|]/g, "\\$&"), "([\\\\/]|$|!|\\?)"));
  470. return function (ident) {
  471. return regExp.test(ident);
  472. };
  473. }
  474. if (item && _typeof(item) === "object" && typeof item.test === "function") {
  475. return function (ident) {
  476. return item.test(ident);
  477. };
  478. }
  479. if (typeof item === "function") {
  480. return item;
  481. }
  482. if (typeof item === "boolean") {
  483. return function () {
  484. return item;
  485. };
  486. }
  487. };
  488. /**
  489. * Enumerates the available values.
  490. * @enum {number}
  491. */
  492. var LogLevel = {
  493. none: 6,
  494. false: 6,
  495. error: 5,
  496. warn: 4,
  497. info: 3,
  498. log: 2,
  499. true: 2,
  500. verbose: 1
  501. };
  502. /**
  503. * Returns logging function.
  504. * @param {LoggerOptions} options options object
  505. * @returns {LoggingFunction} logging function
  506. */
  507. module.exports = function (_ref) {
  508. var _ref$level = _ref.level,
  509. level = _ref$level === void 0 ? "info" : _ref$level,
  510. _ref$debug = _ref.debug,
  511. debug = _ref$debug === void 0 ? false : _ref$debug,
  512. console = _ref.console;
  513. var debugFilters = /** @type {FilterFunction[]} */
  514. typeof debug === "boolean" ? [function () {
  515. return debug;
  516. }] : /** @type {FilterItemTypes[]} */_toConsumableArray(Array.isArray(debug) ? debug : [debug]).map(filterToFunction);
  517. var loglevel = LogLevel["".concat(level)] || 0;
  518. /**
  519. * Processes the provided name.
  520. * @param {string} name name of the logger
  521. * @param {LogTypeEnum} type type of the log entry
  522. * @param {Args=} args arguments of the log entry
  523. * @returns {void}
  524. */
  525. var logger = function logger(name, type, args) {
  526. /**
  527. * Returns labeled args.
  528. * @template T
  529. * @returns {[string?, ...T[]]} labeled args
  530. */
  531. var labeledArgs = function labeledArgs() {
  532. if (Array.isArray(args)) {
  533. if (args.length > 0 && typeof args[0] === "string") {
  534. return ["[".concat(name, "] ").concat(args[0])].concat(_toConsumableArray(args.slice(1)));
  535. }
  536. return ["[".concat(name, "]")].concat(_toConsumableArray(args));
  537. }
  538. return [];
  539. };
  540. var debug = debugFilters.some(function (f) {
  541. return f(name);
  542. });
  543. switch (type) {
  544. case LogType.debug:
  545. if (!debug) return;
  546. if (typeof console.debug === "function") {
  547. console.debug.apply(console, _toConsumableArray(labeledArgs()));
  548. } else {
  549. console.log.apply(console, _toConsumableArray(labeledArgs()));
  550. }
  551. break;
  552. case LogType.log:
  553. if (!debug && loglevel > LogLevel.log) return;
  554. console.log.apply(console, _toConsumableArray(labeledArgs()));
  555. break;
  556. case LogType.info:
  557. if (!debug && loglevel > LogLevel.info) return;
  558. console.info.apply(console, _toConsumableArray(labeledArgs()));
  559. break;
  560. case LogType.warn:
  561. if (!debug && loglevel > LogLevel.warn) return;
  562. console.warn.apply(console, _toConsumableArray(labeledArgs()));
  563. break;
  564. case LogType.error:
  565. if (!debug && loglevel > LogLevel.error) return;
  566. console.error.apply(console, _toConsumableArray(labeledArgs()));
  567. break;
  568. case LogType.trace:
  569. if (!debug) return;
  570. console.trace();
  571. break;
  572. case LogType.groupCollapsed:
  573. if (!debug && loglevel > LogLevel.log) return;
  574. if (!debug && loglevel > LogLevel.verbose) {
  575. if (typeof console.groupCollapsed === "function") {
  576. console.groupCollapsed.apply(console, _toConsumableArray(labeledArgs()));
  577. } else {
  578. console.log.apply(console, _toConsumableArray(labeledArgs()));
  579. }
  580. break;
  581. }
  582. // falls through
  583. case LogType.group:
  584. if (!debug && loglevel > LogLevel.log) return;
  585. if (typeof console.group === "function") {
  586. console.group.apply(console, _toConsumableArray(labeledArgs()));
  587. } else {
  588. console.log.apply(console, _toConsumableArray(labeledArgs()));
  589. }
  590. break;
  591. case LogType.groupEnd:
  592. if (!debug && loglevel > LogLevel.log) return;
  593. if (typeof console.groupEnd === "function") {
  594. console.groupEnd();
  595. }
  596. break;
  597. case LogType.time:
  598. {
  599. if (!debug && loglevel > LogLevel.log) return;
  600. var _args = _slicedToArray(/** @type {[string, number, number]} */
  601. args, 3),
  602. label = _args[0],
  603. start = _args[1],
  604. end = _args[2];
  605. var ms = start * 1000 + end / 1000000;
  606. var msg = "[".concat(name, "] ").concat(label, ": ").concat(ms, " ms");
  607. if (typeof console.logTime === "function") {
  608. console.logTime(msg);
  609. } else {
  610. console.log(msg);
  611. }
  612. break;
  613. }
  614. case LogType.profile:
  615. if (typeof console.profile === "function") {
  616. console.profile.apply(console, _toConsumableArray(labeledArgs()));
  617. }
  618. break;
  619. case LogType.profileEnd:
  620. if (typeof console.profileEnd === "function") {
  621. console.profileEnd.apply(console, _toConsumableArray(labeledArgs()));
  622. }
  623. break;
  624. case LogType.clear:
  625. if (!debug && loglevel > LogLevel.log) return;
  626. if (typeof console.clear === "function") {
  627. console.clear();
  628. }
  629. break;
  630. case LogType.status:
  631. if (!debug && loglevel > LogLevel.info) return;
  632. if (typeof console.status === "function") {
  633. if (!args || args.length === 0) {
  634. console.status();
  635. } else {
  636. console.status.apply(console, _toConsumableArray(labeledArgs()));
  637. }
  638. } else if (args && args.length !== 0) {
  639. console.info.apply(console, _toConsumableArray(labeledArgs()));
  640. }
  641. break;
  642. default:
  643. throw new Error("Unexpected LogType ".concat(type));
  644. }
  645. };
  646. return logger;
  647. };
  648. /***/ }),
  649. /***/ "./node_modules/webpack/lib/logging/runtime.js":
  650. /*!*****************************************************!*\
  651. !*** ./node_modules/webpack/lib/logging/runtime.js ***!
  652. \*****************************************************/
  653. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  654. /*
  655. MIT License http://www.opensource.org/licenses/mit-license.php
  656. Author Tobias Koppers @sokra
  657. */
  658. function _extends() {
  659. return _extends = Object.assign ? Object.assign.bind() : function (n) {
  660. for (var e = 1; e < arguments.length; e++) {
  661. var t = arguments[e];
  662. for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
  663. }
  664. return n;
  665. }, _extends.apply(null, arguments);
  666. }
  667. var _require = __webpack_require__(/*! tapable */ "./client-src/modules/logger/tapable.js"),
  668. SyncBailHook = _require.SyncBailHook;
  669. var _require2 = __webpack_require__(/*! ./Logger */ "./node_modules/webpack/lib/logging/Logger.js"),
  670. Logger = _require2.Logger;
  671. var createConsoleLogger = __webpack_require__(/*! ./createConsoleLogger */ "./node_modules/webpack/lib/logging/createConsoleLogger.js");
  672. /** @type {createConsoleLogger.LoggerOptions} */
  673. var currentDefaultLoggerOptions = {
  674. level: "info",
  675. debug: false,
  676. console: console
  677. };
  678. var currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions);
  679. /**
  680. * Processes the provided create console logger.logger option.
  681. * @param {createConsoleLogger.LoggerOptions} options new options, merge with old options
  682. * @returns {void}
  683. */
  684. module.exports.configureDefaultLogger = function (options) {
  685. _extends(currentDefaultLoggerOptions, options);
  686. currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions);
  687. };
  688. /**
  689. * Returns a logger.
  690. * @param {string} name name of the logger
  691. * @returns {Logger} a logger
  692. */
  693. module.exports.getLogger = function (name) {
  694. return new Logger(function (type, args) {
  695. if (module.exports.hooks.log.call(name, type, args) === undefined) {
  696. currentDefaultLogger(name, type, args);
  697. }
  698. }, function (childName) {
  699. return module.exports.getLogger("".concat(name, "/").concat(childName));
  700. });
  701. };
  702. module.exports.hooks = {
  703. log: new SyncBailHook(["origin", "type", "args"])
  704. };
  705. /***/ }),
  706. /***/ "./client-src/modules/logger/tapable.js":
  707. /*!**********************************************!*\
  708. !*** ./client-src/modules/logger/tapable.js ***!
  709. \**********************************************/
  710. /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
  711. __webpack_require__.r(__webpack_exports__);
  712. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  713. /* harmony export */ SyncBailHook: function() { return /* binding */ SyncBailHook; }
  714. /* harmony export */ });
  715. /**
  716. * @returns {SyncBailHook} mocked sync bail hook
  717. * @constructor
  718. */
  719. function SyncBailHook() {
  720. return {
  721. call: function call() {}
  722. };
  723. }
  724. /**
  725. * Client stub for tapable SyncBailHook
  726. */
  727. /***/ })
  728. /******/ });
  729. /************************************************************************/
  730. /******/ // The module cache
  731. /******/ var __webpack_module_cache__ = {};
  732. /******/
  733. /******/ // The require function
  734. /******/ function __webpack_require__(moduleId) {
  735. /******/ // Check if module is in cache
  736. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  737. /******/ if (cachedModule !== undefined) {
  738. /******/ return cachedModule.exports;
  739. /******/ }
  740. /******/ // Create a new module (and put it into the cache)
  741. /******/ var module = __webpack_module_cache__[moduleId] = {
  742. /******/ // no module.id needed
  743. /******/ // no module.loaded needed
  744. /******/ exports: {}
  745. /******/ };
  746. /******/
  747. /******/ // Execute the module function
  748. /******/ if (!(moduleId in __webpack_modules__)) {
  749. /******/ delete __webpack_module_cache__[moduleId];
  750. /******/ var e = new Error("Cannot find module '" + moduleId + "'");
  751. /******/ e.code = 'MODULE_NOT_FOUND';
  752. /******/ throw e;
  753. /******/ }
  754. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  755. /******/
  756. /******/ // Return the exports of the module
  757. /******/ return module.exports;
  758. /******/ }
  759. /******/
  760. /************************************************************************/
  761. /******/ /* webpack/runtime/define property getters */
  762. /******/ !function() {
  763. /******/ // define getter/value functions for harmony exports
  764. /******/ __webpack_require__.d = function(exports, definition) {
  765. /******/ if(Array.isArray(definition)) {
  766. /******/ var i = 0;
  767. /******/ while(i < definition.length) {
  768. /******/ var key = definition[i++];
  769. /******/ var binding = definition[i++];
  770. /******/ if(!__webpack_require__.o(exports, key)) {
  771. /******/ if(binding === 0) {
  772. /******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
  773. /******/ } else {
  774. /******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
  775. /******/ }
  776. /******/ } else if(binding === 0) { i++; }
  777. /******/ }
  778. /******/ } else {
  779. /******/ for(var key in definition) {
  780. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  781. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  782. /******/ }
  783. /******/ }
  784. /******/ }
  785. /******/ };
  786. /******/ }();
  787. /******/
  788. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  789. /******/ !function() {
  790. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  791. /******/ }();
  792. /******/
  793. /******/ /* webpack/runtime/make namespace object */
  794. /******/ !function() {
  795. /******/ // define __esModule on exports
  796. /******/ __webpack_require__.r = function(exports) {
  797. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  798. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  799. /******/ }
  800. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  801. /******/ };
  802. /******/ }();
  803. /******/
  804. /************************************************************************/
  805. var __webpack_exports__ = {};
  806. // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
  807. !function() {
  808. /*!********************************************!*\
  809. !*** ./client-src/modules/logger/index.js ***!
  810. \********************************************/
  811. __webpack_require__.r(__webpack_exports__);
  812. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  813. /* harmony export */ "default": function() { return /* reexport default export from named module */ webpack_lib_logging_runtime_js__WEBPACK_IMPORTED_MODULE_0__; }
  814. /* harmony export */ });
  815. /* harmony import */ var webpack_lib_logging_runtime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! webpack/lib/logging/runtime.js */ "./node_modules/webpack/lib/logging/runtime.js");
  816. // @ts-expect-error
  817. }();
  818. var __webpack_exports__default = __webpack_exports__["default"];
  819. export { __webpack_exports__default as default };