@seayoo-web/finder 2.1.1 → 2.2.0
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.js +4 -4
- package/package.json +3 -2
- package/types/src/core.d.ts +2 -2
- package/types/src/plugin.d.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -109,7 +109,7 @@ async function request({
|
|
|
109
109
|
const response = await fetch(url, requestInit);
|
|
110
110
|
let responseData;
|
|
111
111
|
const contentType = response.headers.get("content-type");
|
|
112
|
-
if (contentType
|
|
112
|
+
if (contentType?.includes("application/json")) {
|
|
113
113
|
responseData = await response.json();
|
|
114
114
|
} else {
|
|
115
115
|
responseData = await response.text();
|
|
@@ -347,21 +347,21 @@ function viteDeployPlugin(option) {
|
|
|
347
347
|
}
|
|
348
348
|
},
|
|
349
349
|
async closeBundle() {
|
|
350
|
-
var _a, _b;
|
|
351
350
|
if (!distDir) {
|
|
352
351
|
console.error("没有找到部署资源,请尝试检查 build 是否生成了正确的资源".bgRed);
|
|
353
352
|
return;
|
|
354
353
|
}
|
|
354
|
+
await option.onBeforeDeploy?.(distDir);
|
|
355
355
|
const result = await finderDeploy({
|
|
356
356
|
preview: true,
|
|
357
357
|
...option,
|
|
358
358
|
dist: distDir
|
|
359
359
|
}).catch((e) => e instanceof Error ? e : typeof e === "string" ? new Error(e) : new Error(e + ""));
|
|
360
360
|
if (result instanceof Error) {
|
|
361
|
-
|
|
361
|
+
option.onError?.();
|
|
362
362
|
console.log("部署失败".bgRed, result.message);
|
|
363
363
|
} else {
|
|
364
|
-
|
|
364
|
+
option.onFinished?.();
|
|
365
365
|
console.log("部署成功".bgGreen, (result || "").green);
|
|
366
366
|
}
|
|
367
367
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seayoo-web/finder",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "agent for web finder",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "index.ts",
|
|
@@ -28,10 +28,11 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^22.13.1",
|
|
30
30
|
"vitest": "^3.0.5",
|
|
31
|
-
"@seayoo-web/tsconfig": "^1.0.
|
|
31
|
+
"@seayoo-web/tsconfig": "^1.0.5"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "vite build && tsc --emitDeclarationOnly",
|
|
35
|
+
"type-check": "tsc --noEmit",
|
|
35
36
|
"test": "vitest",
|
|
36
37
|
"prepublish": "pnpm build"
|
|
37
38
|
}
|
package/types/src/core.d.ts
CHANGED
|
@@ -28,9 +28,9 @@ export declare function finderDeploy(option: {
|
|
|
28
28
|
}): Promise<string>;
|
|
29
29
|
/** 上传一个文件到 finder */
|
|
30
30
|
export declare function finderUpload(option: {
|
|
31
|
-
/**
|
|
31
|
+
/** 需要上传的文件路径,与 fileContent 二选一,优先级高于 fileContent */
|
|
32
32
|
filePath?: string;
|
|
33
|
-
/**
|
|
33
|
+
/** 需要上传的文件内容,与 filePath 二选一 */
|
|
34
34
|
fileContent?: string | Buffer;
|
|
35
35
|
/** 部署目标全路径,需要包含文件名 */
|
|
36
36
|
deployTo: string;
|
package/types/src/plugin.d.ts
CHANGED