@pipelab/plugin-core 1.0.1-beta.2 → 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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @pipelab/plugin-core
2
2
 
3
+ ## 1.0.1-beta.4
4
+
5
+ ### Patch Changes
6
+
7
+ - test
8
+
9
+ ## 1.0.1-beta.3
10
+
11
+ ### Patch Changes
12
+
13
+ - sd
14
+
3
15
  ## 1.0.1-beta.2
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,19 +1,17 @@
1
1
  {
2
2
  "name": "@pipelab/plugin-core",
3
- "version": "1.0.1-beta.2",
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": "packages/plugin-core"
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.3",
46
- "@pipelab/shared": "2.0.1-beta.4",
47
- "@pipelab/tsconfig": "1.0.1-beta.3"
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
  }
@@ -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
- return new Promise((resolve, reject) => {
22
- const readStream = createReadStream(archivePath);
23
- const gunzipStream = zlib.createGunzip();
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
- return new Promise((resolve, reject) => {
96
- console.log("command (execa-pty-fallback): ", command, args.join(" "));
97
-
98
- const subprocess = execa(command, args, {
99
- ...execaOptions,
100
- stdout: "pipe",
101
- stderr: "pipe",
102
- stdin: "pipe",
103
- env: {
104
- ...process.env,
105
- ...execaOptions.env,
106
- TERM: "xterm-256color",
107
- FORCE_STDERR_LOGGING: "1",
108
- },
109
- cancelSignal: abortSignal,
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
- subprocess.on("error", (error: Error) => {
123
- console.log("error", error);
124
- return reject(error);
125
- });
47
+ hooks?.onCreated?.(subprocess);
126
48
 
127
- subprocess.on("exit", (code: number) => {
128
- console.log("exit", code);
129
- hooks?.onExit?.(code || 0);
49
+ subprocess.stdout?.on("data", (data: Buffer) => {
50
+ hooks?.onStdout?.(data.toString(), subprocess);
51
+ });
130
52
 
131
- if (code === 0) {
132
- return resolve();
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 {
package/tsdown.config.ts CHANGED
@@ -5,4 +5,11 @@ export default defineConfig({
5
5
  format: ["esm", "cjs"],
6
6
  dts: true,
7
7
  clean: true,
8
+ loader: {
9
+ ".webp": "dataurl",
10
+ ".png": "dataurl",
11
+ ".jpg": "dataurl",
12
+ ".jpeg": "dataurl",
13
+ ".svg": "dataurl",
14
+ },
8
15
  });