@pipelab/core-node 1.0.1-beta.29 → 1.0.1-beta.31
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 +4 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +54 -52
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/plugins-registry.ts +32 -30
- package/src/utils/remote.ts +4 -4
- package/src/utils.ts +6 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipelab/core-node",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.31",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Pipelab automation engine for Node.js",
|
|
6
6
|
"license": "FSL-1.1-MIT",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"type-fest": "4.39.0",
|
|
40
40
|
"ws": "8.18.3",
|
|
41
41
|
"yauzl": "2.10.0",
|
|
42
|
-
"@pipelab/constants": "1.0.1-beta.
|
|
43
|
-
"@pipelab/shared": "2.0.1-beta.
|
|
42
|
+
"@pipelab/constants": "1.0.1-beta.27",
|
|
43
|
+
"@pipelab/shared": "2.0.1-beta.28"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/adm-zip": "0.5.7",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@types/yauzl": "2.10.3",
|
|
54
54
|
"tsdown": "0.21.2",
|
|
55
55
|
"typescript": "^5.0.0",
|
|
56
|
-
"@pipelab/tsconfig": "1.0.1-beta.
|
|
56
|
+
"@pipelab/tsconfig": "1.0.1-beta.27"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "tsdown",
|
package/src/plugins-registry.ts
CHANGED
|
@@ -20,39 +20,41 @@ const DEFAULT_PLUGIN_IDS = [
|
|
|
20
20
|
"netlify",
|
|
21
21
|
];
|
|
22
22
|
|
|
23
|
-
export const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
export const loadPipelabPlugin = async (id: string, options: { context: PipelabContext }) => {
|
|
24
|
+
try {
|
|
25
|
+
const packageName = `@pipelab/plugin-${id}`;
|
|
26
|
+
const { packageDir, entryPoint } = await fetchPipelabPlugin(packageName, "latest", {
|
|
27
|
+
context: options.context,
|
|
28
|
+
installDeps: true,
|
|
29
|
+
});
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
const files = await readdir(packageDir, { recursive: true });
|
|
40
|
-
console.log(`[Plugins] [${id}] Directory contents:`, files);
|
|
41
|
-
} catch (e) {}
|
|
42
|
-
}
|
|
31
|
+
console.log(`[Plugins] [${id}] Attempting to import from: ${entryPoint}`);
|
|
32
|
+
if (!existsSync(entryPoint)) {
|
|
33
|
+
console.error(`[Plugins] [${id}] CRITICAL: Plugin entry point not found at ${entryPoint}`);
|
|
34
|
+
try {
|
|
35
|
+
const files = await readdir(packageDir, { recursive: true });
|
|
36
|
+
console.log(`[Plugins] [${id}] Directory contents:`, files);
|
|
37
|
+
} catch (e) { }
|
|
38
|
+
}
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
return null;
|
|
40
|
+
const pluginModule = await import(pathToFileURL(entryPoint).href);
|
|
41
|
+
console.log(`[Plugins] [${id}] Successfully loaded from: ${packageDir}`);
|
|
42
|
+
return pluginModule.default;
|
|
43
|
+
} catch (e: any) {
|
|
44
|
+
console.error(`[Plugins] [${id}] CRITICAL: Failed to load:`, e);
|
|
45
|
+
if (e.code === "ERR_MODULE_NOT_FOUND") {
|
|
46
|
+
console.error(
|
|
47
|
+
`[Plugins] [${id}] This usually means a dependency is missing in the plugin's node_modules.`,
|
|
48
|
+
);
|
|
55
49
|
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const builtInPlugins = async (options: { context: PipelabContext }) => {
|
|
55
|
+
console.log("[Plugins] Finalizing default plugins list...");
|
|
56
|
+
const promises = DEFAULT_PLUGIN_IDS.map(async (id) => {
|
|
57
|
+
return loadPipelabPlugin(id, options);
|
|
56
58
|
});
|
|
57
59
|
|
|
58
60
|
const plugins = await Promise.all(promises);
|
package/src/utils/remote.ts
CHANGED
|
@@ -190,18 +190,18 @@ export async function ensurePNPM(version = "10.12.0", options: { context: Pipela
|
|
|
190
190
|
async function installDependencies(packageDir: string, packageName: string, options: FetchOptions) {
|
|
191
191
|
const nodeModulesPath = join(packageDir, "node_modules");
|
|
192
192
|
|
|
193
|
-
// Check if node_modules already exists and has content
|
|
194
193
|
if (existsSync(nodeModulesPath)) {
|
|
195
194
|
try {
|
|
196
195
|
const files = await readdir(nodeModulesPath);
|
|
197
|
-
if (files.length
|
|
198
|
-
|
|
196
|
+
if (files.length === 0) {
|
|
197
|
+
console.warn(`[Fetcher] ${packageName}: node_modules exists but is empty. Re-installing...`);
|
|
198
|
+
}
|
|
199
199
|
} catch (e) {
|
|
200
200
|
// Continue to install if readdir fails
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
console.log(`[Fetcher] ${packageName}:
|
|
204
|
+
console.log(`[Fetcher] ${packageName}: Ensuring dependencies are installed...`);
|
|
205
205
|
try {
|
|
206
206
|
const { all } = await runPnpm(packageDir, {
|
|
207
207
|
signal: options.signal,
|
package/src/utils.ts
CHANGED
|
@@ -15,7 +15,8 @@ import type { BuildHistoryEntry } from "@pipelab/shared";
|
|
|
15
15
|
import type { Variable } from "@pipelab/shared";
|
|
16
16
|
|
|
17
17
|
import { ensure, generateTempFolder, extractTarGz, extractZip, zipFolder } from "./utils/fs-extras";
|
|
18
|
-
import { fetchPipelabAsset
|
|
18
|
+
import { fetchPipelabAsset } from "./utils/remote";
|
|
19
|
+
import { loadPipelabPlugin } from "./plugins-registry";
|
|
19
20
|
import { setupConfigFile } from "./config";
|
|
20
21
|
import { AppConfig } from "@pipelab/shared";
|
|
21
22
|
|
|
@@ -139,19 +140,13 @@ export const executeGraphWithHistory = async ({
|
|
|
139
140
|
const isRegistered = registeredPlugins.value.some((p) => p.id === pluginId);
|
|
140
141
|
if (!isRegistered) {
|
|
141
142
|
logger().info(`[Runner] Plugin "${pluginId}" not found, attempting to load...`);
|
|
142
|
-
|
|
143
|
-
const packageName = `@pipelab/plugin-${pluginId}`;
|
|
144
|
-
|
|
145
|
-
const { packageDir, entryPoint } = await fetchPipelabPlugin(packageName, "latest", {
|
|
146
|
-
context: ctx,
|
|
147
|
-
});
|
|
148
|
-
const pluginModule = await import(pathToFileURL(entryPoint).href);
|
|
149
|
-
const pluginDefinition = pluginModule.default;
|
|
143
|
+
const pluginDefinition = await loadPipelabPlugin(pluginId, { context: ctx });
|
|
150
144
|
|
|
145
|
+
if (pluginDefinition) {
|
|
151
146
|
registerPlugins([pluginDefinition]);
|
|
152
147
|
logger().info(`[Runner] Plugin "${pluginId}" loaded and registered successfully`);
|
|
153
|
-
}
|
|
154
|
-
logger().error(`[Runner] Failed to load or register plugin "${pluginId}"
|
|
148
|
+
} else {
|
|
149
|
+
logger().error(`[Runner] Failed to load or register plugin "${pluginId}"`);
|
|
155
150
|
}
|
|
156
151
|
}
|
|
157
152
|
}
|