@pipelab/plugin-core 1.0.1-beta.3 → 1.0.1-beta.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/CHANGELOG.md +6 -0
- package/package.json +10 -10
- package/src/archive-utils.ts +5 -15
- package/src/utils.ts +30 -105
- package/tsdown.config.ts +7 -0
- package/dist/chunk-JTKJZQYV-CRyylFtW.mjs +0 -1153
- package/dist/chunk-JTKJZQYV-CRyylFtW.mjs.map +0 -1
- package/dist/chunk-JTKJZQYV-DwALyGe5.cjs +0 -1186
- package/dist/emscripten-module-BreoZ8PK.cjs +0 -548
- package/dist/emscripten-module-DVxR1x9z.mjs +0 -549
- package/dist/emscripten-module-DVxR1x9z.mjs.map +0 -1
- package/dist/emscripten-module-VHMWRAJ2-CZxK3CFi.cjs +0 -373
- package/dist/emscripten-module-VHMWRAJ2-Czcf6BHN.mjs +0 -374
- package/dist/emscripten-module-VHMWRAJ2-Czcf6BHN.mjs.map +0 -1
- package/dist/ffi-B2-9g6wM.cjs +0 -143
- package/dist/ffi-D46mojcp.cjs +0 -143
- package/dist/ffi-DjjqisTa.mjs +0 -144
- package/dist/ffi-DjjqisTa.mjs.map +0 -1
- package/dist/ffi-SCExi0U-.mjs +0 -144
- package/dist/ffi-SCExi0U-.mjs.map +0 -1
- package/dist/index.cjs +0 -64710
- package/dist/index.d.cts +0 -160
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts +0 -160
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -64571
- package/dist/index.mjs.map +0 -1
- package/dist/module-6F3E5H7Y-BVGmvvK_.cjs +0 -6
- package/dist/module-6F3E5H7Y-DHjYta_R.mjs +0 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipelab/plugin-core",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.4",
|
|
4
4
|
"description": "Core library for building Pipelab plugins",
|
|
5
5
|
"license": "FSL-1.1-MIT",
|
|
6
6
|
"author": "CynToolkit",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/CynToolkit/pipelab.git",
|
|
10
|
-
"directory": "
|
|
11
|
-
},
|
|
12
|
-
"publishConfig": {
|
|
13
|
-
"access": "public"
|
|
10
|
+
"directory": "plugins/plugin-core"
|
|
14
11
|
},
|
|
15
12
|
"type": "module",
|
|
16
13
|
"main": "./dist/index.cjs",
|
|
14
|
+
"module": "./dist/index.js",
|
|
17
15
|
"browser": "./src/index.ts",
|
|
18
16
|
"types": "./dist/index.d.ts",
|
|
19
17
|
"exports": {
|
|
@@ -24,6 +22,9 @@
|
|
|
24
22
|
"default": "./dist/index.js"
|
|
25
23
|
}
|
|
26
24
|
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
27
28
|
"dependencies": {
|
|
28
29
|
"@types/node": "^24.12.2",
|
|
29
30
|
"archiver": "7.0.1",
|
|
@@ -42,14 +43,13 @@
|
|
|
42
43
|
"@types/yauzl": "2.10.3",
|
|
43
44
|
"tsdown": "0.21.2",
|
|
44
45
|
"typescript": "5.9.3",
|
|
45
|
-
"@pipelab/constants": "1.0.1-beta.
|
|
46
|
-
"@pipelab/shared": "2.0.1-beta.
|
|
47
|
-
"@pipelab/tsconfig": "1.0.1-beta.
|
|
46
|
+
"@pipelab/constants": "1.0.1-beta.5",
|
|
47
|
+
"@pipelab/shared": "2.0.1-beta.6",
|
|
48
|
+
"@pipelab/tsconfig": "1.0.1-beta.5"
|
|
48
49
|
},
|
|
49
50
|
"scripts": {
|
|
50
51
|
"build": "tsdown",
|
|
51
52
|
"format": "oxfmt .",
|
|
52
53
|
"lint": "oxlint ."
|
|
53
|
-
}
|
|
54
|
-
"module": "./dist/index.js"
|
|
54
|
+
}
|
|
55
55
|
}
|
package/src/archive-utils.ts
CHANGED
|
@@ -18,22 +18,12 @@ export async function extractTarGz(archivePath: string, destinationDir: string):
|
|
|
18
18
|
// Ensure the destination directory exists
|
|
19
19
|
await mkdirP(destinationDir, { recursive: true });
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const extractStream = tar.extract({ cwd: destinationDir });
|
|
25
|
-
|
|
26
|
-
readStream.on("error", reject);
|
|
27
|
-
gunzipStream.on("error", reject);
|
|
28
|
-
extractStream.on("error", reject);
|
|
29
|
-
|
|
30
|
-
extractStream.on("close", () => {
|
|
31
|
-
console.log("Extraction finished.");
|
|
32
|
-
resolve();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
readStream.pipe(gunzipStream).pipe(extractStream);
|
|
21
|
+
await tar.x({
|
|
22
|
+
file: archivePath,
|
|
23
|
+
cwd: destinationDir,
|
|
36
24
|
});
|
|
25
|
+
|
|
26
|
+
console.log("Extraction finished.");
|
|
37
27
|
}
|
|
38
28
|
|
|
39
29
|
/**
|
package/src/utils.ts
CHANGED
|
@@ -16,70 +16,6 @@ export const fileExists = async (path: string): Promise<boolean> => {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export const runWithLiveLogs = async (
|
|
19
|
-
command: string,
|
|
20
|
-
args: string[],
|
|
21
|
-
execaOptions: Options,
|
|
22
|
-
log: typeof console.log,
|
|
23
|
-
hooks?: {
|
|
24
|
-
onStdout?: (data: string, subprocess: Subprocess) => void;
|
|
25
|
-
onStderr?: (data: string, subprocess: Subprocess) => void;
|
|
26
|
-
onExit?: (code: number) => void;
|
|
27
|
-
},
|
|
28
|
-
): Promise<void> => {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
console.log("command: ", command, args.join(" "));
|
|
31
|
-
|
|
32
|
-
const subprocess = execa(command, args, {
|
|
33
|
-
...execaOptions,
|
|
34
|
-
stdout: "pipe",
|
|
35
|
-
stderr: "pipe",
|
|
36
|
-
stdin: "pipe",
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
subprocess.stdout.on("data", (data: Buffer) => {
|
|
40
|
-
hooks?.onStdout?.(data.toString(), subprocess);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
subprocess.stderr?.on("data", (data: Buffer) => {
|
|
44
|
-
hooks?.onStderr?.(data.toString(), subprocess);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
subprocess.on("error", (error: Error) => {
|
|
48
|
-
console.log("error", error);
|
|
49
|
-
return reject(error);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
subprocess.on("close", (code: number) => {
|
|
53
|
-
console.log("close", code);
|
|
54
|
-
hooks?.onExit?.(code);
|
|
55
|
-
|
|
56
|
-
if (code === 0) {
|
|
57
|
-
return resolve();
|
|
58
|
-
} else {
|
|
59
|
-
return reject(new Error(`Command exited with non-zero code: ${code}`));
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
subprocess.on("disconnect", () => {
|
|
64
|
-
console.log("disconnect");
|
|
65
|
-
hooks?.onExit?.(0);
|
|
66
|
-
return resolve();
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
subprocess.on("exit", (code: number) => {
|
|
70
|
-
console.log("exit", code);
|
|
71
|
-
hooks?.onExit?.(code);
|
|
72
|
-
|
|
73
|
-
if (code === 0) {
|
|
74
|
-
return resolve();
|
|
75
|
-
} else {
|
|
76
|
-
return reject(new Error(`Command exited with non-zero code: ${code}`));
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const runWithLiveLogsPTY = async (
|
|
83
19
|
command: string,
|
|
84
20
|
args: string[],
|
|
85
21
|
execaOptions: Options,
|
|
@@ -92,51 +28,40 @@ export const runWithLiveLogsPTY = async (
|
|
|
92
28
|
},
|
|
93
29
|
abortSignal?: AbortSignal,
|
|
94
30
|
): Promise<void> => {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
env
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
hooks?.onCreated?.(subprocess);
|
|
113
|
-
|
|
114
|
-
subprocess.stdout?.on("data", (data: Buffer) => {
|
|
115
|
-
hooks?.onStdout?.(data.toString(), subprocess);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
subprocess.stderr?.on("data", (data: Buffer) => {
|
|
119
|
-
hooks?.onStderr?.(data.toString(), subprocess);
|
|
120
|
-
});
|
|
31
|
+
console.log("command: ", command, args.join(" "));
|
|
32
|
+
|
|
33
|
+
const subprocess = execa(command, args, {
|
|
34
|
+
...execaOptions,
|
|
35
|
+
stdout: "pipe",
|
|
36
|
+
stderr: "pipe",
|
|
37
|
+
stdin: "pipe",
|
|
38
|
+
env: {
|
|
39
|
+
...process.env,
|
|
40
|
+
...execaOptions.env,
|
|
41
|
+
TERM: "xterm-256color",
|
|
42
|
+
FORCE_STDERR_LOGGING: "1",
|
|
43
|
+
},
|
|
44
|
+
cancelSignal: abortSignal,
|
|
45
|
+
});
|
|
121
46
|
|
|
122
|
-
|
|
123
|
-
console.log("error", error);
|
|
124
|
-
return reject(error);
|
|
125
|
-
});
|
|
47
|
+
hooks?.onCreated?.(subprocess);
|
|
126
48
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
49
|
+
subprocess.stdout?.on("data", (data: Buffer) => {
|
|
50
|
+
hooks?.onStdout?.(data.toString(), subprocess);
|
|
51
|
+
});
|
|
130
52
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
} else {
|
|
134
|
-
return reject(
|
|
135
|
-
new ExternalCommandError(`Command exited with non-zero code: ${code}`, code || 1),
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
});
|
|
53
|
+
subprocess.stderr?.on("data", (data: Buffer) => {
|
|
54
|
+
hooks?.onStderr?.(data.toString(), subprocess);
|
|
139
55
|
});
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
const { exitCode } = await subprocess;
|
|
59
|
+
hooks?.onExit?.(exitCode ?? 0);
|
|
60
|
+
} catch (error: any) {
|
|
61
|
+
const code = error.exitCode ?? 1;
|
|
62
|
+
hooks?.onExit?.(code);
|
|
63
|
+
throw new ExternalCommandError(error.message, code);
|
|
64
|
+
}
|
|
140
65
|
};
|
|
141
66
|
|
|
142
67
|
export interface Hooks {
|