@seayoo-web/finder 2.0.6 → 2.0.8
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/dist/index.cjs +6 -10
- package/dist/index.js +6 -10
- package/package.json +1 -1
- package/types/src/plugin.d.ts +0 -1
package/dist/index.cjs
CHANGED
|
@@ -73,7 +73,7 @@ async function request({
|
|
|
73
73
|
reqHeaders.set(key, value);
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
const requestInit = { method };
|
|
76
|
+
const requestInit = { method, headers: reqHeaders };
|
|
77
77
|
try {
|
|
78
78
|
if (data) {
|
|
79
79
|
if (hasFileUpload) {
|
|
@@ -90,12 +90,7 @@ async function request({
|
|
|
90
90
|
requestInit.headers = reqHeaders;
|
|
91
91
|
requestInit.body = formData;
|
|
92
92
|
} else {
|
|
93
|
-
|
|
94
|
-
reqHeaders.set("Content-Type", "application/json");
|
|
95
|
-
Object.entries(headers).forEach(([key, value]) => {
|
|
96
|
-
reqHeaders.set(key, value);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
93
|
+
reqHeaders.set("content-type", reqHeaders.get("content-type") || "application/json");
|
|
99
94
|
requestInit.headers = reqHeaders;
|
|
100
95
|
requestInit.body = JSON.stringify(data);
|
|
101
96
|
}
|
|
@@ -245,7 +240,7 @@ async function getServerSupportedProjects(serverDomain, ignoreCache = false, deb
|
|
|
245
240
|
const { status, message, data } = await request({
|
|
246
241
|
url: inspectURL,
|
|
247
242
|
method: "GET",
|
|
248
|
-
headers: {
|
|
243
|
+
headers: { "user-agent": `web finder agent v2` }
|
|
249
244
|
});
|
|
250
245
|
if (status !== 200) {
|
|
251
246
|
if (debug) {
|
|
@@ -344,9 +339,10 @@ function viteDeployPlugin(option) {
|
|
|
344
339
|
preview: true,
|
|
345
340
|
...option,
|
|
346
341
|
dist: distDir
|
|
347
|
-
}).catch(() =>
|
|
348
|
-
if (result
|
|
342
|
+
}).catch((e) => e instanceof Error ? e : typeof e === "string" ? new Error(e) : new Error(e + ""));
|
|
343
|
+
if (result instanceof Error) {
|
|
349
344
|
(_a = option.onError) == null ? void 0 : _a.call(option);
|
|
345
|
+
console.log("部署失败".bgRed, result.message);
|
|
350
346
|
} else {
|
|
351
347
|
(_b = option.onFinished) == null ? void 0 : _b.call(option);
|
|
352
348
|
console.log("部署成功".bgGreen, (result || "").green);
|
package/dist/index.js
CHANGED
|
@@ -71,7 +71,7 @@ async function request({
|
|
|
71
71
|
reqHeaders.set(key, value);
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
const requestInit = { method };
|
|
74
|
+
const requestInit = { method, headers: reqHeaders };
|
|
75
75
|
try {
|
|
76
76
|
if (data) {
|
|
77
77
|
if (hasFileUpload) {
|
|
@@ -88,12 +88,7 @@ async function request({
|
|
|
88
88
|
requestInit.headers = reqHeaders;
|
|
89
89
|
requestInit.body = formData;
|
|
90
90
|
} else {
|
|
91
|
-
|
|
92
|
-
reqHeaders.set("Content-Type", "application/json");
|
|
93
|
-
Object.entries(headers).forEach(([key, value]) => {
|
|
94
|
-
reqHeaders.set(key, value);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
91
|
+
reqHeaders.set("content-type", reqHeaders.get("content-type") || "application/json");
|
|
97
92
|
requestInit.headers = reqHeaders;
|
|
98
93
|
requestInit.body = JSON.stringify(data);
|
|
99
94
|
}
|
|
@@ -243,7 +238,7 @@ async function getServerSupportedProjects(serverDomain, ignoreCache = false, deb
|
|
|
243
238
|
const { status, message, data } = await request({
|
|
244
239
|
url: inspectURL,
|
|
245
240
|
method: "GET",
|
|
246
|
-
headers: {
|
|
241
|
+
headers: { "user-agent": `web finder agent v2` }
|
|
247
242
|
});
|
|
248
243
|
if (status !== 200) {
|
|
249
244
|
if (debug) {
|
|
@@ -342,9 +337,10 @@ function viteDeployPlugin(option) {
|
|
|
342
337
|
preview: true,
|
|
343
338
|
...option,
|
|
344
339
|
dist: distDir
|
|
345
|
-
}).catch(() =>
|
|
346
|
-
if (result
|
|
340
|
+
}).catch((e) => e instanceof Error ? e : typeof e === "string" ? new Error(e) : new Error(e + ""));
|
|
341
|
+
if (result instanceof Error) {
|
|
347
342
|
(_a = option.onError) == null ? void 0 : _a.call(option);
|
|
343
|
+
console.log("部署失败".bgRed, result.message);
|
|
348
344
|
} else {
|
|
349
345
|
(_b = option.onFinished) == null ? void 0 : _b.call(option);
|
|
350
346
|
console.log("部署成功".bgGreen, (result || "").green);
|
package/package.json
CHANGED