@pipelab/core-node 1.0.0-beta.15 → 1.0.0-beta.17
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 +18 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +26 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/plugins-registry.ts +24 -17
- package/src/utils/github.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipelab/core-node",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.17",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Pipelab automation engine for Node.js",
|
|
6
6
|
"license": "FSL-1.1-MIT",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"type-fest": "4.39.0",
|
|
41
41
|
"ws": "8.18.3",
|
|
42
42
|
"yauzl": "2.10.0",
|
|
43
|
-
"@pipelab/constants": "1.0.0-beta.
|
|
44
|
-
"@pipelab/shared": "1.0.0-beta.
|
|
43
|
+
"@pipelab/constants": "1.0.0-beta.15",
|
|
44
|
+
"@pipelab/shared": "1.0.0-beta.13"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/adm-zip": "0.5.7",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"tsdown": "0.21.2",
|
|
57
57
|
"typescript": "^5.0.0",
|
|
58
58
|
"vitest": "3.1.4",
|
|
59
|
-
"@pipelab/tsconfig": "1.0.0-beta.
|
|
59
|
+
"@pipelab/tsconfig": "1.0.0-beta.13"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "tsdown",
|
package/src/plugins-registry.ts
CHANGED
|
@@ -215,6 +215,10 @@ export const builtInPlugins = async (options: { context: PipelabContext }): Prom
|
|
|
215
215
|
const { usePlugins } = await import("@pipelab/shared");
|
|
216
216
|
const { registerPlugins } = usePlugins();
|
|
217
217
|
const { webSocketServer } = await import("./index");
|
|
218
|
+
|
|
219
|
+
// Broadcast ready signal immediately so the UI launches while plugins load in the background
|
|
220
|
+
webSocketServer.broadcast("startup:progress", { type: "ready" });
|
|
221
|
+
|
|
218
222
|
// Load plugins asynchronously in the background
|
|
219
223
|
(async () => {
|
|
220
224
|
const totalStart = Date.now();
|
|
@@ -294,28 +298,31 @@ export const builtInPlugins = async (options: { context: PipelabContext }): Prom
|
|
|
294
298
|
|
|
295
299
|
console.log(`[Plugins] Total plugins to load on startup:`, Array.from(pluginsToLoad.entries()));
|
|
296
300
|
|
|
297
|
-
// Now load all collected plugins
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
301
|
+
// Now load all collected plugins in parallel
|
|
302
|
+
const loadPromises = Array.from(pluginsToLoad.entries()).map(
|
|
303
|
+
async ([packageName, version]) => {
|
|
304
|
+
sendStartupProgress(`Loading plugin: ${packageName}`);
|
|
305
|
+
const pluginStart = Date.now();
|
|
306
|
+
try {
|
|
307
|
+
const plugin = await loadCustomPlugin(packageName, version, options);
|
|
308
|
+
if (plugin) {
|
|
309
|
+
registerPlugins([plugin]);
|
|
310
|
+
webSocketServer.broadcast("plugin:loaded", { plugin });
|
|
311
|
+
console.log(
|
|
312
|
+
`[Plugins] Loaded ${packageName}@${version} in ${Date.now() - pluginStart}ms`,
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
} catch (err) {
|
|
316
|
+
console.error(`[Plugins] Failed to load plugin ${packageName} at startup:`, err);
|
|
309
317
|
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
318
|
+
},
|
|
319
|
+
);
|
|
320
|
+
await Promise.all(loadPromises);
|
|
314
321
|
|
|
315
322
|
console.log(`[Plugins] All startup plugins loaded in ${Date.now() - totalStart}ms.`);
|
|
316
323
|
sendStartupProgress("All plugins loaded.");
|
|
317
324
|
setTimeout(() => {
|
|
318
|
-
webSocketServer.broadcast("startup:progress", { type: "
|
|
325
|
+
webSocketServer.broadcast("startup:progress", { type: "done" });
|
|
319
326
|
}, 2000);
|
|
320
327
|
})();
|
|
321
328
|
};
|
package/src/utils/github.ts
CHANGED
|
@@ -38,6 +38,7 @@ export async function fetchPackageReleases(
|
|
|
38
38
|
"User-Agent": "Pipelab-Desktop-Updater",
|
|
39
39
|
Accept: "application/vnd.github.v3+json",
|
|
40
40
|
},
|
|
41
|
+
signal: AbortSignal.timeout(10000),
|
|
41
42
|
},
|
|
42
43
|
);
|
|
43
44
|
if (response.ok) {
|
|
@@ -55,6 +56,7 @@ export async function fetchPackageReleases(
|
|
|
55
56
|
"User-Agent": "Pipelab-Desktop-Updater",
|
|
56
57
|
Accept: "application/vnd.github.v3+json",
|
|
57
58
|
},
|
|
59
|
+
signal: AbortSignal.timeout(10000),
|
|
58
60
|
});
|
|
59
61
|
|
|
60
62
|
if (!response.ok) {
|
|
@@ -104,6 +106,7 @@ export async function fetchPackageReleases(
|
|
|
104
106
|
"User-Agent": "Pipelab-Desktop-Updater",
|
|
105
107
|
Accept: "application/vnd.github.v3+json",
|
|
106
108
|
},
|
|
109
|
+
signal: AbortSignal.timeout(10000),
|
|
107
110
|
},
|
|
108
111
|
);
|
|
109
112
|
|