@rubytech/taskmaster 1.0.78 → 1.0.79
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/build-info.json +3 -3
- package/dist/plugins/bundled-dir.js +59 -11
- package/dist/plugins/discovery.js +2 -2
- package/package.json +1 -1
package/dist/build-info.json
CHANGED
|
@@ -4,6 +4,24 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
export function resolveBundledPluginsDir() {
|
|
5
5
|
return resolveBundledPluginsDirDetailed().dir;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Walk up from a starting directory looking for an `extensions/` child.
|
|
9
|
+
* Returns the extensions path if found, otherwise undefined.
|
|
10
|
+
*/
|
|
11
|
+
function walkUpForExtensions(startDir, triedPaths, maxLevels = 6) {
|
|
12
|
+
let cursor = startDir;
|
|
13
|
+
for (let i = 0; i < maxLevels; i += 1) {
|
|
14
|
+
const candidate = path.join(cursor, "extensions");
|
|
15
|
+
triedPaths.push(candidate);
|
|
16
|
+
if (fs.existsSync(candidate))
|
|
17
|
+
return candidate;
|
|
18
|
+
const parent = path.dirname(cursor);
|
|
19
|
+
if (parent === cursor)
|
|
20
|
+
break;
|
|
21
|
+
cursor = parent;
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
7
25
|
export function resolveBundledPluginsDirDetailed() {
|
|
8
26
|
const triedPaths = [];
|
|
9
27
|
const override = process.env.TASKMASTER_BUNDLED_PLUGINS_DIR?.trim();
|
|
@@ -20,22 +38,52 @@ export function resolveBundledPluginsDirDetailed() {
|
|
|
20
38
|
catch {
|
|
21
39
|
// ignore
|
|
22
40
|
}
|
|
23
|
-
//
|
|
41
|
+
// Strategy 1: walk up from this module's real path (handles symlinks).
|
|
24
42
|
try {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
const modulePath = fs.realpathSync(fileURLToPath(import.meta.url));
|
|
44
|
+
const found = walkUpForExtensions(path.dirname(modulePath), triedPaths);
|
|
45
|
+
if (found)
|
|
46
|
+
return { dir: found, source: "walk-up-realpath" };
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// ignore
|
|
50
|
+
}
|
|
51
|
+
// Strategy 2: walk up from this module's raw path (without realpath).
|
|
52
|
+
try {
|
|
53
|
+
const rawModulePath = fileURLToPath(import.meta.url);
|
|
54
|
+
const found = walkUpForExtensions(path.dirname(rawModulePath), triedPaths);
|
|
55
|
+
if (found)
|
|
56
|
+
return { dir: found, source: "walk-up-raw" };
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// ignore
|
|
60
|
+
}
|
|
61
|
+
// Strategy 3: walk up from the entry script (process.argv[1]).
|
|
62
|
+
// On npm global install, process.argv[1] resolves through bin symlinks
|
|
63
|
+
// to the actual entry.js in the package — a different starting point
|
|
64
|
+
// than import.meta.url which resolves from this specific module file.
|
|
65
|
+
try {
|
|
66
|
+
const entryScript = process.argv[1];
|
|
67
|
+
if (entryScript) {
|
|
68
|
+
const realEntry = fs.realpathSync(entryScript);
|
|
69
|
+
const found = walkUpForExtensions(path.dirname(realEntry), triedPaths);
|
|
70
|
+
if (found)
|
|
71
|
+
return { dir: found, source: "walk-up-argv1" };
|
|
35
72
|
}
|
|
36
73
|
}
|
|
37
74
|
catch {
|
|
38
75
|
// ignore
|
|
39
76
|
}
|
|
77
|
+
// Strategy 4: walk up from the package's main module.
|
|
78
|
+
// require.resolve finds the package entry regardless of how we were loaded.
|
|
79
|
+
try {
|
|
80
|
+
const pkgEntry = require.resolve("@rubytech/taskmaster");
|
|
81
|
+
const found = walkUpForExtensions(path.dirname(pkgEntry), triedPaths);
|
|
82
|
+
if (found)
|
|
83
|
+
return { dir: found, source: "walk-up-require-resolve" };
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
// ignore
|
|
87
|
+
}
|
|
40
88
|
return { dir: undefined, triedPaths };
|
|
41
89
|
}
|
|
@@ -274,8 +274,8 @@ export function discoverTaskmasterPlugins(params) {
|
|
|
274
274
|
}
|
|
275
275
|
else {
|
|
276
276
|
diagnostics.push({
|
|
277
|
-
level: "
|
|
278
|
-
message: `bundled extensions dir not resolved
|
|
277
|
+
level: "error",
|
|
278
|
+
message: `bundled extensions dir not resolved (tried: ${bundled.triedPaths?.join(", ") || "none"})`,
|
|
279
279
|
source: "bundled-dir",
|
|
280
280
|
});
|
|
281
281
|
}
|