@synergenius/flow-weaver 0.21.19 → 0.21.20

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.
@@ -9671,7 +9671,7 @@ var VERSION;
9671
9671
  var init_generated_version = __esm({
9672
9672
  "src/generated-version.ts"() {
9673
9673
  "use strict";
9674
- VERSION = "0.21.19";
9674
+ VERSION = "0.21.20";
9675
9675
  }
9676
9676
  });
9677
9677
 
@@ -93270,7 +93270,7 @@ function displayInstalledPackage(pkg) {
93270
93270
  // src/cli/index.ts
93271
93271
  init_logger();
93272
93272
  init_error_utils();
93273
- var version2 = true ? "0.21.19" : "0.0.0-dev";
93273
+ var version2 = true ? "0.21.20" : "0.0.0-dev";
93274
93274
  var program2 = new Command();
93275
93275
  program2.name("fw").description("Flow Weaver Annotations - Compile and validate workflow files").option("-v, --version", "Output the current version").option("--no-color", "Disable colors").option("--color", "Force colors").on("option:version", () => {
93276
93276
  logger.banner(version2);
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.21.19";
1
+ export declare const VERSION = "0.21.20";
2
2
  //# sourceMappingURL=generated-version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by scripts/generate-version.ts — do not edit manually
2
- export const VERSION = '0.21.19';
2
+ export const VERSION = '0.21.20';
3
3
  //# sourceMappingURL=generated-version.js.map
@@ -31,8 +31,8 @@ export type TNpmNodeType = {
31
31
  description: string;
32
32
  };
33
33
  /**
34
- * Get list of packages that have TypeScript declarations (.d.ts files).
35
- * Only includes direct dependencies from package.json (not transitive or dev).
34
+ * Get list of all packages that have TypeScript declarations (.d.ts files).
35
+ * Any package with types can be used as a node type in workflows.
36
36
  * Excludes @types/* packages as they are type augmentations.
37
37
  *
38
38
  * @param workdir - Directory to start searching from
@@ -11,34 +11,63 @@ import { extractFunctionLikes } from './function-like.js';
11
11
  import { inferDataTypeFromTS } from './type-mappings.js';
12
12
  import { getSharedProject } from './shared-project.js';
13
13
  /**
14
- * Read direct dependency names from the closest package.json.
15
- * Only includes `dependencies` (not devDependencies, peerDependencies, etc.)
16
- * since those are the packages available at runtime in workflows.
14
+ * Find all node_modules directories starting from fromDir and walking up.
17
15
  */
18
- function readDirectDependencies(workdir) {
19
- let current = path.resolve(workdir);
16
+ function findNodeModulesDirs(fromDir) {
17
+ const dirs = [];
18
+ let current = path.resolve(fromDir);
20
19
  const root = path.parse(current).root;
21
20
  while (current !== root) {
22
- const pkgJsonPath = path.join(current, 'package.json');
23
- if (fs.existsSync(pkgJsonPath)) {
24
- try {
25
- const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
26
- return Object.keys(pkgJson.dependencies ?? {});
27
- }
28
- catch {
29
- // malformed package.json, keep walking
30
- }
21
+ const candidate = path.join(current, 'node_modules');
22
+ if (fs.existsSync(candidate) && fs.statSync(candidate).isDirectory()) {
23
+ dirs.push(candidate);
31
24
  }
32
25
  const parent = path.dirname(current);
33
26
  if (parent === current)
34
27
  break;
35
28
  current = parent;
36
29
  }
37
- return [];
30
+ return dirs;
31
+ }
32
+ /**
33
+ * List all packages in a node_modules directory (including scoped packages).
34
+ */
35
+ function listPackagesInNodeModules(nmDir) {
36
+ const packages = [];
37
+ if (!fs.existsSync(nmDir))
38
+ return packages;
39
+ try {
40
+ const entries = fs.readdirSync(nmDir, { withFileTypes: true });
41
+ for (const entry of entries) {
42
+ if (!entry.isDirectory())
43
+ continue;
44
+ if (entry.name.startsWith('@')) {
45
+ const scopeDir = path.join(nmDir, entry.name);
46
+ try {
47
+ const scopedEntries = fs.readdirSync(scopeDir, { withFileTypes: true });
48
+ for (const scopedEntry of scopedEntries) {
49
+ if (scopedEntry.isDirectory()) {
50
+ packages.push(`${entry.name}/${scopedEntry.name}`);
51
+ }
52
+ }
53
+ }
54
+ catch {
55
+ // Ignore permission errors
56
+ }
57
+ }
58
+ else {
59
+ packages.push(entry.name);
60
+ }
61
+ }
62
+ }
63
+ catch {
64
+ // Ignore permission errors
65
+ }
66
+ return packages;
38
67
  }
39
68
  /**
40
- * Get list of packages that have TypeScript declarations (.d.ts files).
41
- * Only includes direct dependencies from package.json (not transitive or dev).
69
+ * Get list of all packages that have TypeScript declarations (.d.ts files).
70
+ * Any package with types can be used as a node type in workflows.
42
71
  * Excludes @types/* packages as they are type augmentations.
43
72
  *
44
73
  * @param workdir - Directory to start searching from
@@ -46,14 +75,23 @@ function readDirectDependencies(workdir) {
46
75
  * @returns Object with packages array, each containing name and typesPath
47
76
  */
48
77
  export function getTypedPackages(workdir, nodeModulesOverride) {
49
- const directDeps = readDirectDependencies(workdir);
78
+ const nodeModulesDirs = nodeModulesOverride
79
+ ? [nodeModulesOverride]
80
+ : findNodeModulesDirs(workdir);
50
81
  const typed = [];
51
- for (const pkg of directDeps) {
52
- if (pkg.startsWith('@types/'))
53
- continue;
54
- const typesPath = resolvePackageTypesPath(pkg, workdir, nodeModulesOverride);
55
- if (typesPath) {
56
- typed.push({ name: pkg, typesPath });
82
+ const seenPackages = new Set();
83
+ for (const nmDir of nodeModulesDirs) {
84
+ const packages = listPackagesInNodeModules(nmDir);
85
+ for (const pkg of packages) {
86
+ if (pkg.startsWith('@types/'))
87
+ continue;
88
+ if (seenPackages.has(pkg))
89
+ continue;
90
+ seenPackages.add(pkg);
91
+ const typesPath = resolvePackageTypesPath(pkg, workdir, nodeModulesOverride);
92
+ if (typesPath) {
93
+ typed.push({ name: pkg, typesPath });
94
+ }
57
95
  }
58
96
  }
59
97
  return { packages: typed };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synergenius/flow-weaver",
3
- "version": "0.21.19",
3
+ "version": "0.21.20",
4
4
  "description": "Deterministic workflow compiler for AI agents. Compiles to standalone TypeScript, no runtime dependencies.",
5
5
  "private": false,
6
6
  "type": "module",