@umijs/bundler-esbuild 4.0.68 → 4.0.70
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.
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/plugins/watchRebuild.ts
|
|
20
|
+
var watchRebuild_exports = {};
|
|
21
|
+
__export(watchRebuild_exports, {
|
|
22
|
+
esbuildWatchRebuildPlugin: () => esbuildWatchRebuildPlugin
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(watchRebuild_exports);
|
|
25
|
+
function failureErrorWithLog(text, errors, warnings) {
|
|
26
|
+
let limit = 5;
|
|
27
|
+
let summary = errors.length < 1 ? "" : ` with ${errors.length} error${errors.length < 2 ? "" : "s"}:` + errors.slice(0, limit + 1).map((e, i) => {
|
|
28
|
+
if (i === limit)
|
|
29
|
+
return "\n...";
|
|
30
|
+
if (!e.location)
|
|
31
|
+
return `
|
|
32
|
+
error: ${e.text}`;
|
|
33
|
+
let { file, line, column } = e.location;
|
|
34
|
+
let pluginText = e.pluginName ? `[plugin: ${e.pluginName}] ` : "";
|
|
35
|
+
return `
|
|
36
|
+
${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`;
|
|
37
|
+
}).join("");
|
|
38
|
+
let error = new Error(`${text}${summary}`);
|
|
39
|
+
error.errors = errors;
|
|
40
|
+
error.warnings = warnings;
|
|
41
|
+
return error;
|
|
42
|
+
}
|
|
43
|
+
function esbuildWatchRebuildPlugin(options) {
|
|
44
|
+
return {
|
|
45
|
+
name: "watch-rebuild-plugin",
|
|
46
|
+
setup(build) {
|
|
47
|
+
let count = 0;
|
|
48
|
+
build.onEnd((result) => {
|
|
49
|
+
if (count++ === 0) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (result.errors.length > 0) {
|
|
53
|
+
options.onRebuild(
|
|
54
|
+
failureErrorWithLog("Build failed", result.errors, result.warnings),
|
|
55
|
+
null
|
|
56
|
+
);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
options.onRebuild(null, result);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
esbuildWatchRebuildPlugin
|
|
67
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-esbuild",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.70",
|
|
4
4
|
"description": "@umijs/bundler-esbuild",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-esbuild#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"postcss": "^8.4.21",
|
|
23
23
|
"postcss-flexbugs-fixes": "5.0.2",
|
|
24
24
|
"postcss-preset-env": "7.5.0",
|
|
25
|
-
"@umijs/bundler-utils": "4.0.
|
|
26
|
-
"@umijs/utils": "4.0.
|
|
25
|
+
"@umijs/bundler-utils": "4.0.70",
|
|
26
|
+
"@umijs/utils": "4.0.70"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@alitajs/postcss-plugin-px2rem": "^0.0.1"
|