@seayoo-web/finder 2.0.2 → 2.0.4
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 +1 -1
- package/dist/index.js +1 -1
- package/package.json +14 -9
- package/types/src/compress.d.ts +4 -0
- package/types/src/core.d.ts +31 -0
- package/types/src/plugin.d.ts +14 -0
- package/types/src/service.d.ts +21 -0
- package/types/src/utils.d.ts +18 -0
package/dist/index.cjs
CHANGED
|
@@ -78,7 +78,7 @@ async function request({
|
|
|
78
78
|
Object.entries(data).forEach(([key, value]) => {
|
|
79
79
|
if (typeof value === "object" && "buffer" in value) {
|
|
80
80
|
const { buffer, filename, contentType: contentType2 } = value;
|
|
81
|
-
const blob = new Blob([buffer], { type: contentType2 });
|
|
81
|
+
const blob = new Blob([new Uint8Array(buffer)], { type: contentType2 });
|
|
82
82
|
formData.append(key, blob, filename);
|
|
83
83
|
} else {
|
|
84
84
|
formData.append(key, String(value));
|
package/dist/index.js
CHANGED
|
@@ -76,7 +76,7 @@ async function request({
|
|
|
76
76
|
Object.entries(data).forEach(([key, value]) => {
|
|
77
77
|
if (typeof value === "object" && "buffer" in value) {
|
|
78
78
|
const { buffer, filename, contentType: contentType2 } = value;
|
|
79
|
-
const blob = new Blob([buffer], { type: contentType2 });
|
|
79
|
+
const blob = new Blob([new Uint8Array(buffer)], { type: contentType2 });
|
|
80
80
|
formData.append(key, blob, filename);
|
|
81
81
|
} else {
|
|
82
82
|
formData.append(key, String(value));
|
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seayoo-web/finder",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "agent for web finder",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "index.ts",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"module": "./dist/index.js",
|
|
9
9
|
"types": "./types/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"types",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
10
15
|
"exports": {
|
|
11
16
|
".": {
|
|
12
17
|
"types": "./types/index.d.ts",
|
|
@@ -15,11 +20,6 @@
|
|
|
15
20
|
"default": "./dist/index.js"
|
|
16
21
|
}
|
|
17
22
|
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "vite build && tsc --emitDeclarationOnly",
|
|
20
|
-
"test": "vitest",
|
|
21
|
-
"pub": "pnpm build && npm publish"
|
|
22
|
-
},
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">= 18"
|
|
25
25
|
},
|
|
@@ -34,8 +34,13 @@
|
|
|
34
34
|
"open": "^10.1.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@seayoo-web/tsconfig": "workspace:^",
|
|
38
37
|
"@types/node": "^22.13.1",
|
|
39
|
-
"vitest": "^3.0.5"
|
|
38
|
+
"vitest": "^3.0.5",
|
|
39
|
+
"@seayoo-web/tsconfig": "^1.0.2"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "vite build && tsc --emitDeclarationOnly",
|
|
43
|
+
"test": "vitest",
|
|
44
|
+
"prepublish": "pnpm build"
|
|
40
45
|
}
|
|
41
|
-
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** 代码压缩 */
|
|
2
|
+
export declare function compressToBuffer(sourceDir: string, ignoreFiles?: string[], debug?: boolean): Promise<Buffer>;
|
|
3
|
+
export declare function getAllFiles(dir: string, ignores?: string[]): string[];
|
|
4
|
+
export declare function isIgnoreFile(filePath: string, ignores: string[]): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import "colors";
|
|
2
|
+
/** 部署一个目录 */
|
|
3
|
+
export declare function finderDeploy(option: {
|
|
4
|
+
/** 需要推送的代码目录 */
|
|
5
|
+
dist: string;
|
|
6
|
+
/** 忽略部署的文件,如果是目录则需要以 / 结尾。暂不支持模糊匹配 */
|
|
7
|
+
ignoreFiles?: string[];
|
|
8
|
+
/** 部署的目标地址 */
|
|
9
|
+
deployTo: string | string[];
|
|
10
|
+
/** 部署 user */
|
|
11
|
+
user: string;
|
|
12
|
+
/** 部署 key */
|
|
13
|
+
key: string;
|
|
14
|
+
/** 是否输出更多调试信息 */
|
|
15
|
+
debug?: boolean;
|
|
16
|
+
/** 是否部署完毕后打开目标文件(index.html) */
|
|
17
|
+
preview?: boolean;
|
|
18
|
+
/** 代码的 commit log 信息,换行用 \n */
|
|
19
|
+
commitLogs?: string;
|
|
20
|
+
}): Promise<string>;
|
|
21
|
+
/** 上传一个文件到 finder */
|
|
22
|
+
export declare function finderUpload(option: {
|
|
23
|
+
/** 需要上传的文件全局路 */
|
|
24
|
+
filePath: string;
|
|
25
|
+
/** 部署目标全路径,需要包含文件名 */
|
|
26
|
+
deployTo: string;
|
|
27
|
+
user: string;
|
|
28
|
+
key: string;
|
|
29
|
+
debug?: boolean;
|
|
30
|
+
preview?: boolean;
|
|
31
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { finderDeploy } from "./core";
|
|
2
|
+
import "colors";
|
|
3
|
+
type FinderDeployVitePluginOption = Omit<Parameters<typeof finderDeploy>[0], "dist"> & {
|
|
4
|
+
onFinished?: () => unknown;
|
|
5
|
+
onError?: () => unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare function viteDeployPlugin(option: FinderDeployVitePluginOption): {
|
|
8
|
+
name: string;
|
|
9
|
+
generateBundle({ dir }: {
|
|
10
|
+
dir: string;
|
|
11
|
+
}): void;
|
|
12
|
+
closeBundle(): Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** 将指定的 zip buffer 部署到指定目录 */
|
|
2
|
+
export declare function deploy(option: {
|
|
3
|
+
debug?: boolean;
|
|
4
|
+
target: string;
|
|
5
|
+
buffer: Buffer;
|
|
6
|
+
user: string;
|
|
7
|
+
key: string;
|
|
8
|
+
payload?: Record<string, string>;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
previewUrl?: string;
|
|
11
|
+
}>;
|
|
12
|
+
/** 将文件上传到指定位置 */
|
|
13
|
+
export declare function upload(option: {
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
target: string;
|
|
16
|
+
buffer: Buffer;
|
|
17
|
+
user: string;
|
|
18
|
+
key: string;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
previewUrl?: string;
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare function pure(url: string): string;
|
|
2
|
+
export declare function getSystemTempDir(): string;
|
|
3
|
+
type RequestData = Record<string, string | number | {
|
|
4
|
+
buffer: Buffer;
|
|
5
|
+
contentType: string;
|
|
6
|
+
filename: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function request({ url, method, headers, data, }: {
|
|
9
|
+
url: string;
|
|
10
|
+
method: "GET" | "POST";
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
data?: RequestData;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
status: number;
|
|
15
|
+
message?: string;
|
|
16
|
+
data: unknown;
|
|
17
|
+
}>;
|
|
18
|
+
export {};
|