@umijs/bundler-webpack 4.0.51 → 4.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/client/client.js +33 -71
- package/dist/build.d.ts +1 -0
- package/dist/build.js +22 -5
- package/dist/cli.js +4 -0
- package/dist/config/bundleAnalyzerPlugin.js +1 -0
- package/dist/config/compressPlugin.js +5 -0
- package/dist/config/config.js +10 -2
- package/dist/config/copyPlugin.js +2 -0
- package/dist/config/cssRules.js +7 -0
- package/dist/config/detectDeadCode.js +4 -0
- package/dist/config/detectDeadCodePlugin.js +4 -0
- package/dist/config/fastRefreshPlugin.js +4 -0
- package/dist/config/forkTSCheckerPlugin.js +4 -0
- package/dist/config/javaScriptRules.js +18 -0
- package/dist/config/miniCSSExtractPlugin.js +8 -1
- package/dist/config/progressPlugin.js +4 -0
- package/dist/config/speedMeasureWebpackPlugin.js +4 -0
- package/dist/config/svgRules.js +4 -0
- package/dist/dev.d.ts +6 -0
- package/dist/dev.js +31 -18
- package/dist/loader/svgr.js +4 -0
- package/dist/loader/swc.js +7 -0
- package/dist/parcelCSS.js +4 -0
- package/dist/requireHook.js +4 -0
- package/dist/schema.js +1 -0
- package/dist/server/server.js +6 -0
- package/dist/server/ws.d.ts +1 -1
- package/dist/server/ws.js +4 -0
- package/dist/swcPlugins/autoCSSModules.js +9 -0
- package/dist/swcPlugins/lockCoreJS.js +4 -0
- package/dist/utils/depMatch.js +2 -1
- package/dist/utils/formatWebpackMessages.js +4 -0
- package/package.json +5 -5
package/client/client/client.js
CHANGED
|
@@ -1,38 +1,29 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
|
|
3
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
4
|
-
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
5
3
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
6
|
-
|
|
7
4
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import stripAnsi from '@umijs/utils/compiled/strip-ansi';
|
|
6
|
+
// @ts-ignore
|
|
11
7
|
import * as ErrorOverlay from 'react-error-overlay';
|
|
12
8
|
import { MESSAGE_TYPE } from "../constants";
|
|
13
9
|
import { formatWebpackMessages } from "../utils/formatWebpackMessages";
|
|
14
10
|
console.log('[webpack] connecting...');
|
|
15
|
-
|
|
16
11
|
function getHost() {
|
|
17
12
|
if (process.env.SOCKET_SERVER) {
|
|
18
13
|
return new URL(process.env.SOCKET_SERVER);
|
|
19
14
|
}
|
|
20
|
-
|
|
21
15
|
return location;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function getSocketUrl() {
|
|
25
18
|
var h = getHost();
|
|
26
19
|
var host = h.host;
|
|
27
20
|
var isHttps = h.protocol === 'https:';
|
|
28
21
|
return "".concat(isHttps ? 'wss' : 'ws', "://").concat(host);
|
|
29
22
|
}
|
|
30
|
-
|
|
31
23
|
function getPingUrl() {
|
|
32
24
|
var h = getHost();
|
|
33
25
|
return "".concat(h.protocol, "//").concat(h.host, "/__umi_ping");
|
|
34
26
|
}
|
|
35
|
-
|
|
36
27
|
var pingTimer = null;
|
|
37
28
|
var isFirstCompilation = true;
|
|
38
29
|
var mostRecentCompilationHash = null;
|
|
@@ -49,18 +40,16 @@ socket.addEventListener('message', /*#__PURE__*/function () {
|
|
|
49
40
|
case 0:
|
|
50
41
|
data = _ref.data;
|
|
51
42
|
data = JSON.parse(data);
|
|
52
|
-
|
|
53
43
|
if (data.type === 'connected') {
|
|
54
|
-
console.log("[webpack] connected.");
|
|
44
|
+
console.log("[webpack] connected.");
|
|
45
|
+
// proxy(nginx, docker) hmr ws maybe caused timeout,
|
|
55
46
|
// so send ping package let ws keep alive.
|
|
56
|
-
|
|
57
47
|
pingTimer = window.setInterval(function () {
|
|
58
48
|
return socket.send('ping');
|
|
59
49
|
}, 30000);
|
|
60
50
|
} else {
|
|
61
51
|
handleMessage(data).catch(console.error);
|
|
62
52
|
}
|
|
63
|
-
|
|
64
53
|
case 3:
|
|
65
54
|
case "end":
|
|
66
55
|
return _context.stop();
|
|
@@ -68,39 +57,32 @@ socket.addEventListener('message', /*#__PURE__*/function () {
|
|
|
68
57
|
}
|
|
69
58
|
}, _callee);
|
|
70
59
|
}));
|
|
71
|
-
|
|
72
60
|
return function (_x) {
|
|
73
61
|
return _ref2.apply(this, arguments);
|
|
74
62
|
};
|
|
75
63
|
}());
|
|
76
|
-
|
|
77
64
|
function waitForSuccessfulPing() {
|
|
78
65
|
return _waitForSuccessfulPing.apply(this, arguments);
|
|
79
66
|
}
|
|
80
|
-
|
|
81
67
|
function _waitForSuccessfulPing() {
|
|
82
68
|
_waitForSuccessfulPing = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
83
69
|
var ms,
|
|
84
|
-
|
|
70
|
+
_args3 = arguments;
|
|
85
71
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
86
72
|
while (1) {
|
|
87
73
|
switch (_context3.prev = _context3.next) {
|
|
88
74
|
case 0:
|
|
89
75
|
ms = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : 1000;
|
|
90
|
-
|
|
91
76
|
case 1:
|
|
92
77
|
if (!true) {
|
|
93
78
|
_context3.next = 14;
|
|
94
79
|
break;
|
|
95
80
|
}
|
|
96
|
-
|
|
97
81
|
_context3.prev = 2;
|
|
98
82
|
_context3.next = 5;
|
|
99
83
|
return fetch(pingUrl);
|
|
100
|
-
|
|
101
84
|
case 5:
|
|
102
85
|
return _context3.abrupt("break", 14);
|
|
103
|
-
|
|
104
86
|
case 8:
|
|
105
87
|
_context3.prev = 8;
|
|
106
88
|
_context3.t0 = _context3["catch"](2);
|
|
@@ -108,11 +90,9 @@ function _waitForSuccessfulPing() {
|
|
|
108
90
|
return new Promise(function (resolve) {
|
|
109
91
|
return setTimeout(resolve, ms);
|
|
110
92
|
});
|
|
111
|
-
|
|
112
93
|
case 12:
|
|
113
94
|
_context3.next = 1;
|
|
114
95
|
break;
|
|
115
|
-
|
|
116
96
|
case 14:
|
|
117
97
|
case "end":
|
|
118
98
|
return _context3.stop();
|
|
@@ -122,7 +102,6 @@ function _waitForSuccessfulPing() {
|
|
|
122
102
|
}));
|
|
123
103
|
return _waitForSuccessfulPing.apply(this, arguments);
|
|
124
104
|
}
|
|
125
|
-
|
|
126
105
|
socket.addEventListener('close', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
127
106
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
128
107
|
while (1) {
|
|
@@ -132,10 +111,8 @@ socket.addEventListener('close', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_r
|
|
|
132
111
|
console.info('[webpack] Dev server disconnected. Polling for restart...');
|
|
133
112
|
_context2.next = 4;
|
|
134
113
|
return waitForSuccessfulPing();
|
|
135
|
-
|
|
136
114
|
case 4:
|
|
137
115
|
location.reload();
|
|
138
|
-
|
|
139
116
|
case 5:
|
|
140
117
|
case "end":
|
|
141
118
|
return _context2.stop();
|
|
@@ -148,27 +125,28 @@ ErrorOverlay.startReportingRuntimeErrors({
|
|
|
148
125
|
hadRuntimeError = true;
|
|
149
126
|
},
|
|
150
127
|
filename: '/static/js/bundle.js'
|
|
151
|
-
});
|
|
128
|
+
});
|
|
152
129
|
|
|
130
|
+
// @ts-ignore
|
|
153
131
|
if (module.hot && typeof module.hot.dispose === 'function') {
|
|
154
132
|
// @ts-ignore
|
|
155
133
|
module.hot.dispose(function () {
|
|
156
134
|
// TODO: why do we need this?
|
|
157
135
|
ErrorOverlay.stopReportingRuntimeErrors();
|
|
158
136
|
});
|
|
159
|
-
}
|
|
160
|
-
|
|
137
|
+
}
|
|
161
138
|
|
|
139
|
+
// There is a newer version of the code available.
|
|
162
140
|
function handleAvailableHash(hash) {
|
|
163
141
|
// Update last known compilation hash.
|
|
164
142
|
mostRecentCompilationHash = hash;
|
|
165
143
|
}
|
|
166
|
-
|
|
167
144
|
function handleSuccess() {
|
|
168
145
|
var isHotUpdate = !isFirstCompilation;
|
|
169
146
|
isFirstCompilation = false;
|
|
170
|
-
hasCompileErrors = false;
|
|
147
|
+
hasCompileErrors = false;
|
|
171
148
|
|
|
149
|
+
// Attempt to apply hot updates or reload.
|
|
172
150
|
if (isHotUpdate) {
|
|
173
151
|
tryApplyUpdates(function onHotUpdateSuccess() {
|
|
174
152
|
// Only dismiss it when we're sure it's a hot update.
|
|
@@ -177,7 +155,6 @@ function handleSuccess() {
|
|
|
177
155
|
});
|
|
178
156
|
}
|
|
179
157
|
}
|
|
180
|
-
|
|
181
158
|
function handleWarnings(warnings) {
|
|
182
159
|
var isHotUpdate = !isFirstCompilation;
|
|
183
160
|
isFirstCompilation = false;
|
|
@@ -185,20 +162,20 @@ function handleWarnings(warnings) {
|
|
|
185
162
|
var formatted = formatWebpackMessages({
|
|
186
163
|
warnings: warnings,
|
|
187
164
|
errors: []
|
|
188
|
-
});
|
|
165
|
+
});
|
|
189
166
|
|
|
167
|
+
// print warnings
|
|
190
168
|
if (typeof console !== 'undefined' && typeof console.warn === 'function') {
|
|
191
169
|
for (var i = 0; i < formatted.warnings.length; i++) {
|
|
192
170
|
if (i === 5) {
|
|
193
171
|
console.warn('There were more warnings in other files.\n' + 'You can find a complete log in the terminal.');
|
|
194
172
|
break;
|
|
195
173
|
}
|
|
196
|
-
|
|
197
174
|
console.warn(stripAnsi(formatted.warnings[i]));
|
|
198
175
|
}
|
|
199
|
-
}
|
|
200
|
-
|
|
176
|
+
}
|
|
201
177
|
|
|
178
|
+
// Attempt to apply hot updates or reload.
|
|
202
179
|
if (isHotUpdate) {
|
|
203
180
|
tryApplyUpdates(function onSuccessfulHotUpdate() {
|
|
204
181
|
// Only dismiss it when we're sure it's a hot update.
|
|
@@ -207,97 +184,87 @@ function handleWarnings(warnings) {
|
|
|
207
184
|
});
|
|
208
185
|
}
|
|
209
186
|
}
|
|
210
|
-
|
|
211
187
|
function handleErrors(errors) {
|
|
212
188
|
isFirstCompilation = false;
|
|
213
189
|
hasCompileErrors = true;
|
|
214
190
|
var formatted = formatWebpackMessages({
|
|
215
191
|
warnings: [],
|
|
216
192
|
errors: errors
|
|
217
|
-
});
|
|
193
|
+
});
|
|
218
194
|
|
|
219
|
-
|
|
195
|
+
// Only show the first error.
|
|
196
|
+
ErrorOverlay.reportBuildError(formatted.errors[0]);
|
|
220
197
|
|
|
198
|
+
// Also log them to the console.
|
|
221
199
|
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
|
222
200
|
for (var i = 0; i < formatted.errors.length; i++) {
|
|
223
201
|
console.error(stripAnsi(formatted.errors[i]));
|
|
224
202
|
}
|
|
225
203
|
}
|
|
226
204
|
}
|
|
227
|
-
|
|
228
205
|
function tryDismissErrorOverlay() {
|
|
229
206
|
if (!hasCompileErrors) {
|
|
230
207
|
ErrorOverlay.dismissBuildError();
|
|
231
208
|
}
|
|
232
|
-
}
|
|
233
|
-
|
|
209
|
+
}
|
|
234
210
|
|
|
211
|
+
// Is there a newer version of this code available?
|
|
235
212
|
function isUpdateAvailable() {
|
|
236
213
|
// @ts-ignore
|
|
237
214
|
return mostRecentCompilationHash !== __webpack_hash__;
|
|
238
215
|
}
|
|
239
|
-
|
|
240
216
|
function canApplyUpdates() {
|
|
241
217
|
// @ts-ignore
|
|
242
218
|
return module.hot.status() === 'idle';
|
|
243
219
|
}
|
|
244
|
-
|
|
245
220
|
function canAcceptErrors() {
|
|
246
221
|
// NOTE: This var is injected by Webpack's DefinePlugin, and is a boolean instead of string.
|
|
247
|
-
var hasReactRefresh = process.env.FAST_REFRESH;
|
|
222
|
+
var hasReactRefresh = process.env.FAST_REFRESH;
|
|
248
223
|
|
|
249
|
-
|
|
224
|
+
// @ts-ignore
|
|
225
|
+
var status = module.hot.status();
|
|
226
|
+
// React refresh can handle hot-reloading over errors.
|
|
250
227
|
// However, when hot-reload status is abort or fail,
|
|
251
228
|
// it indicates the current update cannot be applied safely,
|
|
252
229
|
// and thus we should bail out to a forced reload for consistency.
|
|
253
|
-
|
|
254
230
|
return hasReactRefresh && ['abort', 'fail'].indexOf(status) === -1;
|
|
255
231
|
}
|
|
256
|
-
|
|
257
232
|
function tryApplyUpdates(onHotUpdateSuccess) {
|
|
258
233
|
// @ts-ignore
|
|
259
234
|
if (!module.hot) {
|
|
260
235
|
window.location.reload();
|
|
261
236
|
return;
|
|
262
237
|
}
|
|
263
|
-
|
|
264
238
|
if (!isUpdateAvailable() || !canApplyUpdates()) {
|
|
265
239
|
return;
|
|
266
240
|
}
|
|
267
|
-
|
|
268
241
|
function handleApplyUpdates(err, updatedModules) {
|
|
269
|
-
var haveErrors = err || hadRuntimeError;
|
|
242
|
+
var haveErrors = err || hadRuntimeError;
|
|
243
|
+
// When there is no error but updatedModules is unavailable,
|
|
270
244
|
// it indicates a critical failure in hot-reloading,
|
|
271
245
|
// e.g. server is not ready to serve new bundle,
|
|
272
246
|
// and hence we need to do a forced reload.
|
|
273
|
-
|
|
274
247
|
var needsForcedReload = !err && !updatedModules;
|
|
275
|
-
|
|
276
248
|
if (haveErrors && !canAcceptErrors() || needsForcedReload) {
|
|
277
249
|
window.location.reload();
|
|
278
250
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
251
|
+
if (onHotUpdateSuccess) onHotUpdateSuccess();
|
|
252
|
+
// While we were updating, there was a new update! Do it again.
|
|
282
253
|
if (isUpdateAvailable()) {
|
|
283
254
|
tryApplyUpdates();
|
|
284
255
|
}
|
|
285
|
-
}
|
|
286
|
-
|
|
256
|
+
}
|
|
287
257
|
|
|
288
|
-
|
|
289
|
-
/* autoApply */
|
|
290
|
-
true).then(function (updatedModules) {
|
|
258
|
+
// @ts-ignore
|
|
259
|
+
module.hot.check( /* autoApply */true).then(function (updatedModules) {
|
|
291
260
|
handleApplyUpdates(null, updatedModules);
|
|
292
261
|
}).catch(function (err) {
|
|
293
262
|
handleApplyUpdates(err, null);
|
|
294
263
|
});
|
|
295
264
|
}
|
|
296
|
-
|
|
297
265
|
function handleMessage(_x2) {
|
|
298
266
|
return _handleMessage.apply(this, arguments);
|
|
299
267
|
}
|
|
300
|
-
|
|
301
268
|
function _handleMessage() {
|
|
302
269
|
_handleMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(payload) {
|
|
303
270
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
@@ -307,23 +274,18 @@ function _handleMessage() {
|
|
|
307
274
|
_context4.t0 = payload.type;
|
|
308
275
|
_context4.next = _context4.t0 === MESSAGE_TYPE.hash ? 3 : _context4.t0 === MESSAGE_TYPE.stillOk ? 5 : _context4.t0 === MESSAGE_TYPE.ok ? 5 : _context4.t0 === MESSAGE_TYPE.errors ? 7 : _context4.t0 === MESSAGE_TYPE.warnings ? 9 : 11;
|
|
309
276
|
break;
|
|
310
|
-
|
|
311
277
|
case 3:
|
|
312
278
|
handleAvailableHash(payload.data);
|
|
313
279
|
return _context4.abrupt("break", 11);
|
|
314
|
-
|
|
315
280
|
case 5:
|
|
316
281
|
handleSuccess();
|
|
317
282
|
return _context4.abrupt("break", 11);
|
|
318
|
-
|
|
319
283
|
case 7:
|
|
320
284
|
handleErrors(payload.data);
|
|
321
285
|
return _context4.abrupt("break", 11);
|
|
322
|
-
|
|
323
286
|
case 9:
|
|
324
287
|
handleWarnings(payload.data);
|
|
325
288
|
return _context4.abrupt("break", 11);
|
|
326
|
-
|
|
327
289
|
case 11:
|
|
328
290
|
case "end":
|
|
329
291
|
return _context4.stop();
|
package/dist/build.d.ts
CHANGED
package/dist/build.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -69,13 +73,16 @@ async function build(opts) {
|
|
|
69
73
|
import_utils.rimraf.sync(webpackConfig.output.path);
|
|
70
74
|
}
|
|
71
75
|
const compiler = (0, import_webpack.default)(webpackConfig);
|
|
72
|
-
|
|
76
|
+
let closeWatching;
|
|
77
|
+
const handler = (err, stats) => {
|
|
73
78
|
var _a;
|
|
74
79
|
(_a = opts.onBuildComplete) == null ? void 0 : _a.call(opts, {
|
|
75
80
|
err,
|
|
76
81
|
stats,
|
|
77
82
|
isFirstCompile,
|
|
78
|
-
time: stats ? stats.endTime - stats.startTime : null
|
|
83
|
+
time: stats ? stats.endTime - stats.startTime : null,
|
|
84
|
+
// pass close function to close watching
|
|
85
|
+
...opts.watch ? { close: closeWatching } : {}
|
|
79
86
|
});
|
|
80
87
|
isFirstCompile = false;
|
|
81
88
|
if (err || (stats == null ? void 0 : stats.hasErrors())) {
|
|
@@ -89,9 +96,19 @@ async function build(opts) {
|
|
|
89
96
|
} else {
|
|
90
97
|
resolve2(stats);
|
|
91
98
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
if (!opts.watch)
|
|
100
|
+
compiler.close(() => {
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
if (opts.watch) {
|
|
104
|
+
const watching = compiler.watch(
|
|
105
|
+
webpackConfig.watchOptions || {},
|
|
106
|
+
handler
|
|
107
|
+
);
|
|
108
|
+
closeWatching = watching.close.bind(watching);
|
|
109
|
+
} else {
|
|
110
|
+
compiler.run(handler);
|
|
111
|
+
}
|
|
95
112
|
});
|
|
96
113
|
}
|
|
97
114
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/cli.js
CHANGED
|
@@ -13,6 +13,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
13
|
return to;
|
|
14
14
|
};
|
|
15
15
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
16
20
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
17
21
|
mod
|
|
18
22
|
));
|
|
@@ -26,6 +26,7 @@ var import_webpack_bundle_analyzer = require("@umijs/bundler-webpack/compiled/we
|
|
|
26
26
|
async function addBundleAnalyzerPlugin(opts) {
|
|
27
27
|
const { config } = opts;
|
|
28
28
|
config.plugin("webpack-bundle-analyzer").use(import_webpack_bundle_analyzer.BundleAnalyzerPlugin, [
|
|
29
|
+
// https://github.com/webpack-contrib/webpack-bundle-analyzer
|
|
29
30
|
{
|
|
30
31
|
analyzerMode: "server",
|
|
31
32
|
analyzerPort: process.env.ANALYZE_PORT || 8888,
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -54,6 +58,7 @@ async function addCompressPlugin(opts) {
|
|
|
54
58
|
minify = import_terser_webpack_plugin.default.esbuildMinify;
|
|
55
59
|
terserOptions = {
|
|
56
60
|
target: esbuildTarget,
|
|
61
|
+
// remove all comments
|
|
57
62
|
legalComments: "none"
|
|
58
63
|
};
|
|
59
64
|
} else if (jsMinifier === import_types.JSMinifier.terser) {
|
package/dist/config/config.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -153,14 +157,18 @@ async function getConfig(opts) {
|
|
|
153
157
|
buildDependencies: {
|
|
154
158
|
config: opts.cache.buildDependencies || []
|
|
155
159
|
},
|
|
156
|
-
cacheDirectory: opts.cache.cacheDirectory ||
|
|
160
|
+
cacheDirectory: opts.cache.cacheDirectory || // 使用 rootDir 是在有 APP_ROOT 时,把 cache 目录放在根目录下
|
|
161
|
+
(0, import_path.join)(
|
|
157
162
|
opts.rootDir || opts.cwd,
|
|
158
163
|
"node_modules",
|
|
159
164
|
".cache",
|
|
160
165
|
"bundler-webpack"
|
|
161
166
|
)
|
|
162
167
|
});
|
|
163
|
-
if (
|
|
168
|
+
if (
|
|
169
|
+
/*isTnpm*/
|
|
170
|
+
require("@umijs/utils/package").__npminstall_done
|
|
171
|
+
) {
|
|
164
172
|
const nodeModulesPath = opts.cache.absNodeModulesPath || (0, import_path.join)(opts.rootDir || opts.cwd, "node_modules");
|
|
165
173
|
const localLinkedNodeModules = Object.keys(
|
|
166
174
|
Object.assign(
|
|
@@ -31,6 +31,8 @@ async function addCopyPlugin(opts) {
|
|
|
31
31
|
const copyPatterns = [
|
|
32
32
|
(0, import_fs.existsSync)(publicDir) && (0, import_fs.readdirSync)(publicDir).length && {
|
|
33
33
|
from: publicDir,
|
|
34
|
+
// ref: https://github.com/webpack-contrib/copy-webpack-plugin#info
|
|
35
|
+
// Set minimized so terser will not do minimize
|
|
34
36
|
info: { minimized: true }
|
|
35
37
|
},
|
|
36
38
|
...userConfig.copy ? (_a = userConfig.copy) == null ? void 0 : _a.map((pattern) => {
|
package/dist/config/cssRules.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -94,6 +98,9 @@ async function addCSSRules(opts) {
|
|
|
94
98
|
modules: {
|
|
95
99
|
localIdentName: "[local]___[hash:base64:5]",
|
|
96
100
|
...userConfig.cssLoaderModules,
|
|
101
|
+
// If SSR is enabled, we need to handling the css modules name hashing
|
|
102
|
+
// and save the class names mapping into opts.cssModulesMapping
|
|
103
|
+
// so the esbuild can use it to generate the correct name for the server side
|
|
97
104
|
getLocalIdent: userConfig.ssr && ((context, localIdentName, localName, opt) => {
|
|
98
105
|
const classIdent = ((0, import_utils.winPath)(context.resourcePath).replace(
|
|
99
106
|
(0, import_utils.winPath)(ensureLastSlash(opt.context)),
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -44,10 +48,13 @@ async function addJavaScriptRules(opts) {
|
|
|
44
48
|
const srcRules = [
|
|
45
49
|
config.module.rule("src").test(/\.(js|mjs|cjs)$/).include.add([
|
|
46
50
|
cwd,
|
|
51
|
+
// import module out of cwd using APP_ROOT
|
|
52
|
+
// issue: https://github.com/umijs/umi/issues/5594
|
|
47
53
|
...process.env.APP_ROOT ? [process.cwd()] : []
|
|
48
54
|
]).end().exclude.add(/node_modules/).end(),
|
|
49
55
|
config.module.rule("jsx-ts-tsx").test(/\.(jsx|ts|tsx)$/),
|
|
50
56
|
config.module.rule("extra-src").test(/\.(js|mjs|cjs)$/).include.add([
|
|
57
|
+
// support extraBabelIncludes
|
|
51
58
|
...opts.extraBabelIncludes.map((p) => {
|
|
52
59
|
if (import_utils.lodash.isRegExp(p)) {
|
|
53
60
|
return p;
|
|
@@ -62,6 +69,8 @@ async function addJavaScriptRules(opts) {
|
|
|
62
69
|
return (0, import_path.dirname)(
|
|
63
70
|
import_utils.resolve.sync(`${p}/package.json`, {
|
|
64
71
|
basedir: cwd,
|
|
72
|
+
// same behavior as webpack, to ensure `include` paths matched
|
|
73
|
+
// ref: https://webpack.js.org/configuration/resolve/#resolvesymlinks
|
|
65
74
|
preserveSymlinks: false
|
|
66
75
|
})
|
|
67
76
|
);
|
|
@@ -74,6 +83,7 @@ async function addJavaScriptRules(opts) {
|
|
|
74
83
|
throw e;
|
|
75
84
|
}
|
|
76
85
|
}),
|
|
86
|
+
// support es5ImcompatibleVersions
|
|
77
87
|
(path) => {
|
|
78
88
|
try {
|
|
79
89
|
if (path.includes("client/client/client"))
|
|
@@ -105,11 +115,18 @@ async function addJavaScriptRules(opts) {
|
|
|
105
115
|
var _a2, _b2;
|
|
106
116
|
if (srcTranspiler === import_types.Transpiler.babel) {
|
|
107
117
|
rule.use("babel-loader").loader(require.resolve("../../compiled/babel-loader")).options({
|
|
118
|
+
// Tell babel to guess the type, instead assuming all files are modules
|
|
119
|
+
// https://github.com/webpack/webpack/issues/4039#issuecomment-419284940
|
|
108
120
|
sourceType: "unambiguous",
|
|
109
121
|
babelrc: false,
|
|
122
|
+
configFile: false,
|
|
110
123
|
cacheDirectory: false,
|
|
111
124
|
browserslistConfigFile: false,
|
|
125
|
+
// process.env.BABEL_CACHE !== 'none'
|
|
126
|
+
// ? join(cwd, `.umi/.cache/babel-loader`)
|
|
127
|
+
// : false,
|
|
112
128
|
targets: userConfig.targets,
|
|
129
|
+
// 解决 vue MFSU 解析 需要
|
|
113
130
|
customize: userConfig.babelLoaderCustomize,
|
|
114
131
|
presets: [
|
|
115
132
|
opts.babelPreset || [
|
|
@@ -136,6 +153,7 @@ async function addJavaScriptRules(opts) {
|
|
|
136
153
|
} else if (srcTranspiler === import_types.Transpiler.swc) {
|
|
137
154
|
rule.use("swc-loader").loader(require.resolve("../loader/swc")).options({
|
|
138
155
|
excludeFiles: [
|
|
156
|
+
// exclude MFSU virtual entry files, because swc not support top level await
|
|
139
157
|
new RegExp(`/${import_mfsu.VIRTUAL_ENTRY_DIR}/[^\\/]+\\.js$`)
|
|
140
158
|
],
|
|
141
159
|
enableAutoCssModulesPlugin: userConfig.autoCSSModules,
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -36,7 +40,10 @@ async function addMiniCSSExtractPlugin(opts) {
|
|
|
36
40
|
config.plugin("mini-css-extract-plugin").use(import_mini_css_extract_plugin.default, [
|
|
37
41
|
{
|
|
38
42
|
filename: `[name]${hash}.css`,
|
|
39
|
-
chunkFilename: opts.userConfig.ssr ?
|
|
43
|
+
chunkFilename: opts.userConfig.ssr ? (
|
|
44
|
+
// TODO: FIXME
|
|
45
|
+
`umi${hash}.css`
|
|
46
|
+
) : `[name]${hash}.chunk.css`,
|
|
40
47
|
ignoreOrder: true
|
|
41
48
|
}
|
|
42
49
|
]);
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
package/dist/config/svgRules.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { MFSU } from '@umijs/mfsu';
|
|
2
3
|
import type { Worker } from 'worker_threads';
|
|
4
|
+
import webpack from '../compiled/webpack';
|
|
3
5
|
import { IOpts as IConfigOpts } from './config/config';
|
|
4
6
|
import { IConfig } from './types';
|
|
5
7
|
declare type IOpts = {
|
|
@@ -30,4 +32,8 @@ declare type IOpts = {
|
|
|
30
32
|
} & Pick<IConfigOpts, 'cache' | 'pkg'>;
|
|
31
33
|
export declare function ensureSerializableValue(obj: any): any;
|
|
32
34
|
export declare function dev(opts: IOpts): Promise<void>;
|
|
35
|
+
export declare function setup(opts: IOpts): Promise<{
|
|
36
|
+
mfsu: MFSU | null;
|
|
37
|
+
webpackConfig: webpack.Configuration;
|
|
38
|
+
}>;
|
|
33
39
|
export {};
|
package/dist/dev.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -26,7 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
26
30
|
var dev_exports = {};
|
|
27
31
|
__export(dev_exports, {
|
|
28
32
|
dev: () => dev,
|
|
29
|
-
ensureSerializableValue: () => ensureSerializableValue
|
|
33
|
+
ensureSerializableValue: () => ensureSerializableValue,
|
|
34
|
+
setup: () => setup
|
|
30
35
|
});
|
|
31
36
|
module.exports = __toCommonJS(dev_exports);
|
|
32
37
|
var import_mfsu = require("@umijs/mfsu");
|
|
@@ -53,6 +58,25 @@ function ensureSerializableValue(obj) {
|
|
|
53
58
|
);
|
|
54
59
|
}
|
|
55
60
|
async function dev(opts) {
|
|
61
|
+
const { mfsu, webpackConfig } = await setup(opts);
|
|
62
|
+
await (0, import_server.createServer)({
|
|
63
|
+
webpackConfig,
|
|
64
|
+
userConfig: opts.config,
|
|
65
|
+
cwd: opts.cwd,
|
|
66
|
+
beforeMiddlewares: [
|
|
67
|
+
...(mfsu == null ? void 0 : mfsu.getMiddlewares()) || [],
|
|
68
|
+
...opts.beforeMiddlewares || []
|
|
69
|
+
],
|
|
70
|
+
port: opts.port,
|
|
71
|
+
host: opts.host,
|
|
72
|
+
ip: opts.ip,
|
|
73
|
+
afterMiddlewares: [...opts.afterMiddlewares || []],
|
|
74
|
+
onDevCompileDone: opts.onDevCompileDone,
|
|
75
|
+
onProgress: opts.onProgress,
|
|
76
|
+
onBeforeMiddleware: opts.onBeforeMiddleware
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
async function setup(opts) {
|
|
56
80
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
57
81
|
const cacheDirectoryPath = (0, import_path.resolve)(
|
|
58
82
|
opts.rootDir || opts.cwd,
|
|
@@ -164,25 +188,14 @@ async function dev(opts) {
|
|
|
164
188
|
import_utils.rimraf.sync(webpackConfig.cache.cacheDirectory);
|
|
165
189
|
}
|
|
166
190
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
beforeMiddlewares: [
|
|
172
|
-
...(mfsu == null ? void 0 : mfsu.getMiddlewares()) || [],
|
|
173
|
-
...opts.beforeMiddlewares || []
|
|
174
|
-
],
|
|
175
|
-
port: opts.port,
|
|
176
|
-
host: opts.host,
|
|
177
|
-
ip: opts.ip,
|
|
178
|
-
afterMiddlewares: [...opts.afterMiddlewares || []],
|
|
179
|
-
onDevCompileDone: opts.onDevCompileDone,
|
|
180
|
-
onProgress: opts.onProgress,
|
|
181
|
-
onBeforeMiddleware: opts.onBeforeMiddleware
|
|
182
|
-
});
|
|
191
|
+
return {
|
|
192
|
+
mfsu,
|
|
193
|
+
webpackConfig
|
|
194
|
+
};
|
|
183
195
|
}
|
|
184
196
|
// Annotate the CommonJS export names for ESM import in node:
|
|
185
197
|
0 && (module.exports = {
|
|
186
198
|
dev,
|
|
187
|
-
ensureSerializableValue
|
|
199
|
+
ensureSerializableValue,
|
|
200
|
+
setup
|
|
188
201
|
});
|
package/dist/loader/svgr.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
package/dist/loader/swc.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -37,6 +41,7 @@ function getBaseOpts({ filename }) {
|
|
|
37
41
|
const isDev = process.env.NODE_ENV === import_types.Env.development;
|
|
38
42
|
const swcOpts = {
|
|
39
43
|
module: {
|
|
44
|
+
// @ts-ignore
|
|
40
45
|
type: "es6",
|
|
41
46
|
ignoreDynamic: true
|
|
42
47
|
},
|
|
@@ -93,8 +98,10 @@ function swcLoader(contents, inputSourceMap) {
|
|
|
93
98
|
...getBaseOpts({
|
|
94
99
|
filename
|
|
95
100
|
}),
|
|
101
|
+
// filename
|
|
96
102
|
filename,
|
|
97
103
|
sourceFileName: filename,
|
|
104
|
+
// source map
|
|
98
105
|
sourceMaps: this.sourceMap,
|
|
99
106
|
...inputSourceMap ? {
|
|
100
107
|
inputSourceMap
|
package/dist/parcelCSS.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
package/dist/requireHook.js
CHANGED
|
@@ -13,6 +13,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
13
|
return to;
|
|
14
14
|
};
|
|
15
15
|
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
16
20
|
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
17
21
|
mod2
|
|
18
22
|
));
|
package/dist/schema.js
CHANGED
package/dist/server/server.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -95,6 +99,7 @@ async function createServer(opts) {
|
|
|
95
99
|
publicPath: userConfig.publicPath || "/",
|
|
96
100
|
writeToDisk: userConfig.writeToDisk,
|
|
97
101
|
stats: "none"
|
|
102
|
+
// watchOptions: { ignored }
|
|
98
103
|
});
|
|
99
104
|
app.use(compilerMiddleware);
|
|
100
105
|
let stats;
|
|
@@ -178,6 +183,7 @@ async function createServer(opts) {
|
|
|
178
183
|
httpsOpts.hosts = import_utils.lodash.uniq(
|
|
179
184
|
[
|
|
180
185
|
...httpsOpts.hosts || [],
|
|
186
|
+
// always add localhost, 127.0.0.1, ip and host
|
|
181
187
|
"127.0.0.1",
|
|
182
188
|
"localhost",
|
|
183
189
|
opts.ip,
|
package/dist/server/ws.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ import { Server as HttpsServer } from 'https';
|
|
|
8
8
|
import WebSocket from '../../compiled/ws';
|
|
9
9
|
export declare function createWebSocketServer(server: HttpServer | HttpsServer | Http2Server | Server): {
|
|
10
10
|
send(message: string): void;
|
|
11
|
-
wss: WebSocket.Server
|
|
11
|
+
wss: WebSocket.Server;
|
|
12
12
|
close(): void;
|
|
13
13
|
};
|
package/dist/server/ws.js
CHANGED
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
|
@@ -35,6 +39,11 @@ var AutoCSSModule = class extends import_Visitor.default {
|
|
|
35
39
|
visitTsType(expression) {
|
|
36
40
|
return expression;
|
|
37
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* call path:
|
|
44
|
+
* visitProgram -> visitModule -> visitModuleItems -> visitModuleItem -> visitImportDeclaration
|
|
45
|
+
* @see https://github.com/swc-project/swc/blob/main/node-swc/src/Visitor.ts#L189
|
|
46
|
+
*/
|
|
38
47
|
visitModuleItem(n) {
|
|
39
48
|
if (n.type === "ImportDeclaration") {
|
|
40
49
|
return this.visitImportDeclaration(n);
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
package/dist/utils/depMatch.js
CHANGED
|
@@ -58,7 +58,8 @@ function es5ImcompatibleVersionsToPkg() {
|
|
|
58
58
|
config: { "es5-imcompatible-versions": config }
|
|
59
59
|
} = require("es5-imcompatible-versions/package.json");
|
|
60
60
|
return Object.keys(config).reduce((memo, key) => {
|
|
61
|
-
memo[key] =
|
|
61
|
+
memo[key] = /* versions */
|
|
62
|
+
Object.keys(config[key]);
|
|
62
63
|
return memo;
|
|
63
64
|
}, {});
|
|
64
65
|
}
|
|
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
24
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
25
|
mod
|
|
22
26
|
));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-webpack",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.52",
|
|
4
4
|
"description": "@umijs/bundler-webpack",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-webpack#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"@svgr/plugin-jsx": "^6.2.1",
|
|
34
34
|
"@svgr/plugin-svgo": "^6.2.0",
|
|
35
35
|
"@types/hapi__joi": "17.1.9",
|
|
36
|
-
"@umijs/babel-preset-umi": "4.0.
|
|
37
|
-
"@umijs/bundler-utils": "4.0.
|
|
36
|
+
"@umijs/babel-preset-umi": "4.0.52",
|
|
37
|
+
"@umijs/bundler-utils": "4.0.52",
|
|
38
38
|
"@umijs/case-sensitive-paths-webpack-plugin": "^1.0.1",
|
|
39
|
-
"@umijs/mfsu": "4.0.
|
|
40
|
-
"@umijs/utils": "4.0.
|
|
39
|
+
"@umijs/mfsu": "4.0.52",
|
|
40
|
+
"@umijs/utils": "4.0.52",
|
|
41
41
|
"cors": "^2.8.5",
|
|
42
42
|
"css-loader": "6.7.1",
|
|
43
43
|
"es5-imcompatible-versions": "^0.1.73",
|