prodex 1.0.8 โ†’ 1.2.0

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.
Files changed (54) hide show
  1. package/README.md +174 -86
  2. package/bin/prodex.js +1 -17
  3. package/dist/cli/cli-input.js +86 -0
  4. package/dist/cli/flags.js +42 -0
  5. package/dist/cli/init.js +21 -0
  6. package/dist/cli/picker.js +82 -0
  7. package/dist/cli/summary.js +14 -0
  8. package/dist/constants/config-loader.js +90 -0
  9. package/dist/constants/config.js +17 -0
  10. package/dist/constants/default-config.js +48 -0
  11. package/dist/constants/render-constants.js +23 -0
  12. package/dist/core/combine.js +74 -0
  13. package/dist/core/dependency.js +51 -0
  14. package/dist/core/file-utils.js +44 -0
  15. package/dist/core/helpers.js +81 -0
  16. package/dist/core/parsers/extract-imports.js +51 -0
  17. package/dist/core/renderers.js +42 -0
  18. package/dist/index.js +29 -0
  19. package/dist/lib/logger.js +14 -0
  20. package/dist/lib/polyfills.js +12 -0
  21. package/dist/lib/utils.js +15 -0
  22. package/dist/resolvers/js/alias-loader.js +52 -0
  23. package/dist/resolvers/js/js-resolver.js +153 -0
  24. package/dist/resolvers/php/bindings.js +32 -0
  25. package/dist/resolvers/php/patterns.js +17 -0
  26. package/dist/resolvers/php/php-resolver.js +88 -0
  27. package/dist/resolvers/php/psr4.js +26 -0
  28. package/dist/resolvers/shared/excludes.js +11 -0
  29. package/dist/resolvers/shared/file-cache.js +29 -0
  30. package/dist/resolvers/shared/stats.js +17 -0
  31. package/dist/types/cli.types.js +12 -0
  32. package/dist/types/config.types.js +2 -0
  33. package/dist/types/core.types.js +2 -0
  34. package/dist/types/index.js +21 -0
  35. package/dist/types/resolver.types.js +2 -0
  36. package/dist/types/utils.types.js +2 -0
  37. package/package.json +17 -11
  38. package/dist/LICENSE +0 -21
  39. package/dist/README.md +0 -140
  40. package/dist/bin/prodex.js +0 -18
  41. package/dist/package.json +0 -43
  42. package/dist/src/cli/init.js +0 -50
  43. package/dist/src/cli/picker.js +0 -64
  44. package/dist/src/cli/summary.js +0 -9
  45. package/dist/src/constants/config-loader.js +0 -64
  46. package/dist/src/constants/config.js +0 -90
  47. package/dist/src/core/alias-loader.js +0 -8
  48. package/dist/src/core/combine.js +0 -141
  49. package/dist/src/core/file-utils.js +0 -13
  50. package/dist/src/core/helpers.js +0 -127
  51. package/dist/src/index.js +0 -11
  52. package/dist/src/resolvers/js-resolver.js +0 -135
  53. package/dist/src/resolvers/php-bindings.js +0 -31
  54. package/dist/src/resolvers/php-resolver.js +0 -115
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.resolveJsImports = resolveJsImports;
8
+ const promises_1 = __importDefault(require("fs/promises"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const micromatch_1 = __importDefault(require("micromatch"));
11
+ const extract_imports_1 = require("../../core/parsers/extract-imports");
12
+ const alias_loader_1 = require("./alias-loader");
13
+ const config_1 = require("../../constants/config");
14
+ const utils_1 = require("../../lib/utils");
15
+ const logger_1 = require("../../lib/logger");
16
+ const IMPORTS_CACHE = new Map();
17
+ const STAT_CACHE = new Map();
18
+ async function resolveJsImports(filePath, cfg, visited = new Set(), depth = 0, maxDepth = cfg?.resolve?.depth ?? 8, ctx = {}) {
19
+ if (depth >= maxDepth)
20
+ return empty(visited);
21
+ const ROOT = cfg.root;
22
+ const resolveCfg = cfg.resolve ?? {};
23
+ // Single exclude list, applied to RAW SPECIFIERS only.
24
+ const exclude = resolveCfg.exclude ?? [];
25
+ const isExcluded = micromatch_1.default.matcher(exclude);
26
+ if (visited.has(filePath))
27
+ return empty(visited);
28
+ visited.add(filePath);
29
+ const ext = path_1.default.extname(filePath).toLowerCase();
30
+ const isDts = ext === config_1.DTS_EXT;
31
+ if (!config_1.BASE_EXTS.includes(ext) && !isDts)
32
+ return empty(visited);
33
+ let code;
34
+ try {
35
+ code = await promises_1.default.readFile(filePath, "utf8");
36
+ }
37
+ catch {
38
+ return empty(visited);
39
+ }
40
+ if (!ctx.aliases) {
41
+ ctx.aliases = { ...(0, alias_loader_1.loadProjectAliases)(ROOT), ...(resolveCfg.aliases || {}) };
42
+ }
43
+ const aliases = ctx.aliases;
44
+ const matches = await getImportsCached(filePath, code);
45
+ if (!matches.size)
46
+ return empty(visited);
47
+ const filesOut = [];
48
+ const expected = new Set();
49
+ const resolvedSet = new Set();
50
+ for (const imp of matches) {
51
+ // Only consider relative, absolute, or known-alias specifiers
52
+ if (!imp.startsWith(".") && !imp.startsWith("/") && !startsWithAnyAlias(imp, aliases)) {
53
+ continue;
54
+ }
55
+ // Apply single exclude matcher to the RAW specifier
56
+ if (isExcluded(imp))
57
+ continue;
58
+ // Always count valid, non-excluded specifiers as "expected"
59
+ expected.add(imp);
60
+ const basePath = resolveBasePath(filePath, imp, aliases);
61
+ if (!basePath)
62
+ continue;
63
+ const resolvedPath = await tryResolveImport(basePath, ROOT);
64
+ if (!resolvedPath)
65
+ continue;
66
+ filesOut.push(resolvedPath);
67
+ resolvedSet.add(imp);
68
+ // Never recurse into `.d.ts`
69
+ if (resolvedPath.toLowerCase().endsWith(config_1.DTS_EXT)) {
70
+ continue;
71
+ logger_1.logger.debug("HERE HERE");
72
+ }
73
+ const sub = await resolveJsImports(resolvedPath, cfg, visited, depth + 1, maxDepth, ctx);
74
+ if (sub.files.length)
75
+ filesOut.push(...sub.files);
76
+ for (const s of sub.stats.expected)
77
+ expected.add(s);
78
+ for (const r of sub.stats.resolved)
79
+ resolvedSet.add(r);
80
+ }
81
+ const uniqueFiles = [...new Set(filesOut)];
82
+ //Stat Log
83
+ const expCount = expected.size;
84
+ const resCount = resolvedSet.size;
85
+ const diff = (0, utils_1.setDiff)(expected, resolvedSet);
86
+ logger_1.logger.debug(`๐Ÿชถ [js-resolver] ${filePath} โ†’ expected: ${expCount}, resolved: ${resCount}`);
87
+ logger_1.logger.debug([...diff], "๐Ÿ”ดTHE diff");
88
+ return { files: uniqueFiles, visited, stats: { expected, resolved: resolvedSet } };
89
+ }
90
+ // ---------- helpers ----------
91
+ function startsWithAnyAlias(imp, aliases) {
92
+ return Object.keys(aliases).some((a) => imp === a || imp.startsWith(a + "/"));
93
+ }
94
+ function resolveBasePath(fromFile, specifier, aliases) {
95
+ if (specifier.startsWith("@")) {
96
+ const key = Object.keys(aliases)
97
+ .filter((a) => specifier === a || specifier.startsWith(a + "/"))
98
+ .sort((a, b) => b.length - a.length)[0];
99
+ if (!key)
100
+ return null;
101
+ const relPart = specifier.slice(key.length).replace(/^\/+/, "");
102
+ return path_1.default.resolve(aliases[key], relPart);
103
+ }
104
+ if (specifier.startsWith(".")) {
105
+ return path_1.default.resolve(path_1.default.dirname(fromFile), specifier);
106
+ }
107
+ if (specifier.startsWith("/")) {
108
+ return path_1.default.resolve(specifier);
109
+ }
110
+ return null;
111
+ }
112
+ async function tryResolveImport(basePath, ROOT) {
113
+ const candidates = [];
114
+ if (path_1.default.extname(basePath)) {
115
+ candidates.push(basePath);
116
+ }
117
+ else {
118
+ for (const ext of [...config_1.BASE_EXTS, config_1.DTS_EXT]) {
119
+ candidates.push(basePath + ext);
120
+ candidates.push(path_1.default.join(basePath, "index" + ext));
121
+ }
122
+ }
123
+ for (const c of candidates) {
124
+ const abs = path_1.default.resolve(c);
125
+ const st = await safeStat(abs);
126
+ if (st && st.isFile())
127
+ return abs;
128
+ }
129
+ return null;
130
+ }
131
+ async function safeStat(p) {
132
+ if (STAT_CACHE.has(p))
133
+ return STAT_CACHE.get(p);
134
+ try {
135
+ const st = await promises_1.default.stat(p);
136
+ STAT_CACHE.set(p, st);
137
+ return st;
138
+ }
139
+ catch {
140
+ STAT_CACHE.set(p, null);
141
+ return null;
142
+ }
143
+ }
144
+ async function getImportsCached(filePath, code) {
145
+ if (IMPORTS_CACHE.has(filePath))
146
+ return IMPORTS_CACHE.get(filePath);
147
+ const set = await (0, extract_imports_1.extractImports)(filePath, code);
148
+ IMPORTS_CACHE.set(filePath, set);
149
+ return set;
150
+ }
151
+ function empty(visited) {
152
+ return { files: [], visited, stats: { expected: new Set(), resolved: new Set() } };
153
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.loadLaravelBindings = loadLaravelBindings;
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const config_1 = require("../../constants/config");
11
+ function loadLaravelBindings() {
12
+ const providersDir = path_1.default.join(config_1.ROOT, "app", "Providers");
13
+ const bindings = {};
14
+ if (!fs_1.default.existsSync(providersDir))
15
+ return bindings;
16
+ const files = fs_1.default
17
+ .readdirSync(providersDir)
18
+ .filter(f => f.endsWith(".php"))
19
+ .map(f => path_1.default.join(providersDir, f));
20
+ // Match: $this->app->bind(Interface::class, Implementation::class)
21
+ const re = /$this->app->(?:bind|singleton)\s*\(\s*([A-Za-z0-9_:\\\\]+)::class\s*,\s*([A-Za-z0-9_:\\\\]+)::class/g;
22
+ for (const file of files) {
23
+ const code = fs_1.default.readFileSync(file, "utf8");
24
+ let m;
25
+ while ((m = re.exec(code))) {
26
+ const iface = m[1].replace(/\\\\/g, "\\");
27
+ const impl = m[2].replace(/\\\\/g, "\\");
28
+ bindings[iface] = impl;
29
+ }
30
+ }
31
+ return bindings;
32
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.extractPhpImports = extractPhpImports;
5
+ function extractPhpImports(code) {
6
+ const out = new Set();
7
+ const patterns = [
8
+ /\b(?:require|include|require_once|include_once)\s*\(?['"]([^'"]+)['"]\)?/g,
9
+ /\buse\s+([A-Z][\w\\]+(?:\s*{[^}]+})?)/g
10
+ ];
11
+ for (const r of patterns) {
12
+ let m;
13
+ while ((m = r.exec(code)))
14
+ out.add(m[1]);
15
+ }
16
+ return out;
17
+ }
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.resolvePhpImports = resolvePhpImports;
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const bindings_1 = require("./bindings");
10
+ const psr4_1 = require("./psr4");
11
+ const patterns_1 = require("./patterns");
12
+ const logger_1 = require("../../lib/logger");
13
+ const stats_1 = require("../shared/stats");
14
+ const file_cache_1 = require("../shared/file-cache");
15
+ const excludes_1 = require("../shared/excludes");
16
+ async function resolvePhpImports(filePath, cfg, visited = new Set(), depth = 0, maxDepth = cfg?.resolve?.depth ?? 10, ctx = {}) {
17
+ if (depth >= maxDepth)
18
+ return empty(visited);
19
+ const stats = (0, stats_1.newStats)();
20
+ const filesOut = [];
21
+ const ROOT = cfg.root || process.cwd();
22
+ if (!ctx.psr4)
23
+ ctx.psr4 = (0, psr4_1.resolvePsr4)(ROOT);
24
+ if (!ctx.nsKeys)
25
+ ctx.nsKeys = Object.keys(ctx.psr4).sort((a, b) => b.length - a.length);
26
+ if (!ctx.bindings)
27
+ ctx.bindings = (0, bindings_1.loadLaravelBindings)();
28
+ if (visited.has(filePath))
29
+ return empty(visited);
30
+ visited.add(filePath);
31
+ if (!fs_1.default.existsSync(filePath))
32
+ return empty(visited);
33
+ const code = fs_1.default.readFileSync(filePath, "utf8");
34
+ const exclude = cfg.imports?.exclude ?? [];
35
+ const raw = (0, patterns_1.extractPhpImports)(code);
36
+ const imports = expandGroupedUses(raw);
37
+ for (const imp0 of imports) {
38
+ let imp = imp0;
39
+ if (ctx.bindings[imp]) {
40
+ log("๐Ÿ”— Bound:", imp0, "โ†’", ctx.bindings[imp]);
41
+ imp = ctx.bindings[imp];
42
+ }
43
+ if (!startsWithAny(imp, ctx.nsKeys))
44
+ continue;
45
+ if ((0, excludes_1.isExcluded)(imp, exclude))
46
+ continue;
47
+ stats.expected.add(imp);
48
+ const resolvedPath = (0, file_cache_1.tryResolvePhpFile)(imp, filePath, ctx.psr4);
49
+ if (!resolvedPath)
50
+ continue;
51
+ stats.resolved.add(imp);
52
+ filesOut.push(resolvedPath);
53
+ const sub = await resolvePhpImports(resolvedPath, cfg, visited, depth + 1, maxDepth, ctx);
54
+ filesOut.push(...sub.files);
55
+ (0, stats_1.mergeStats)(stats, sub.stats);
56
+ }
57
+ log("โœ… PHP resolver:", filePath, "โ†’", filesOut.length);
58
+ return {
59
+ files: [...new Set(filesOut)],
60
+ visited,
61
+ stats
62
+ };
63
+ }
64
+ // ---------- Local helpers (resolver-scoped only) ----------
65
+ function startsWithAny(imp, nsKeys) {
66
+ return nsKeys.some(k => imp.startsWith(k));
67
+ }
68
+ function empty(visited) {
69
+ return { files: [], visited, stats: (0, stats_1.emptyStats)() };
70
+ }
71
+ const log = (...a) => logger_1.logger.debug("[php-resolver]", ...a);
72
+ function expandGroupedUses(raw) {
73
+ const out = new Set();
74
+ for (const imp of raw) {
75
+ const g = imp.match(/^(.+?)\s*{([^}]+)}/);
76
+ if (g) {
77
+ const base = g[1].trim().replace(/\\+$/, "");
78
+ g[2]
79
+ .split(",")
80
+ .map(x => x.trim())
81
+ .forEach(p => out.add(`${base}\\${p}`));
82
+ }
83
+ else {
84
+ out.add(imp.trim());
85
+ }
86
+ }
87
+ return out;
88
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.resolvePsr4 = resolvePsr4;
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
10
+ function resolvePsr4(ROOT) {
11
+ const composer = path_1.default.join(ROOT, "composer.json");
12
+ if (!fs_1.default.existsSync(composer))
13
+ return {};
14
+ try {
15
+ const data = JSON.parse(fs_1.default.readFileSync(composer, "utf8"));
16
+ const src = data.autoload?.["psr-4"] || {};
17
+ const map = {};
18
+ for (const ns in src) {
19
+ map[ns.replace(/\\+$/, "")] = path_1.default.resolve(ROOT, src[ns]);
20
+ }
21
+ return map;
22
+ }
23
+ catch {
24
+ return {};
25
+ }
26
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.isExcluded = isExcluded;
8
+ const micromatch_1 = __importDefault(require("micromatch"));
9
+ function isExcluded(imp, exclude = []) {
10
+ return micromatch_1.default.isMatch(imp.replaceAll("\\", "/"), exclude);
11
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.tryResolvePhpFile = tryResolvePhpFile;
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const CACHE = new Map();
11
+ function tryResolvePhpFile(imp, fromFile, psr4) {
12
+ const key = `php:${imp}:${fromFile}`;
13
+ if (CACHE.has(key))
14
+ return CACHE.get(key);
15
+ const nsKey = Object.keys(psr4).find(k => imp.startsWith(k));
16
+ if (!nsKey) {
17
+ CACHE.set(key, null);
18
+ return null;
19
+ }
20
+ const rel = imp.slice(nsKey.length).replace(/\\/g, "/");
21
+ const tries = [
22
+ path_1.default.join(psr4[nsKey], rel),
23
+ path_1.default.join(psr4[nsKey], rel + ".php"),
24
+ path_1.default.join(psr4[nsKey], rel, "index.php")
25
+ ];
26
+ const resolved = tries.find(p => fs_1.default.existsSync(p) && fs_1.default.statSync(p).isFile());
27
+ CACHE.set(key, resolved ? path_1.default.resolve(resolved) : null);
28
+ return CACHE.get(key);
29
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.newStats = newStats;
5
+ exports.mergeStats = mergeStats;
6
+ exports.emptyStats = emptyStats;
7
+ function newStats() {
8
+ return { expected: new Set(), resolved: new Set() };
9
+ }
10
+ function mergeStats(target, src) {
11
+ src.expected.forEach(i => target.expected.add(i));
12
+ src.resolved.forEach(i => target.resolved.add(i));
13
+ return target;
14
+ }
15
+ function emptyStats() {
16
+ return { expected: new Set(), resolved: new Set() };
17
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /**
3
+ * CLI flag schema for Prodex.
4
+ * Mirrors the current CLI synopsis:
5
+ *
6
+ * prodex [entries...] [-tcdv]
7
+ * [--txt] [--ci] [--debug] [--verbose]
8
+ * [--name=<string>|-n=<string>]
9
+ * [--limit=<int>|-l=<int>]
10
+ * [--inc=<globs>] [--exc=<globs>]
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./config.types"), exports);
18
+ __exportStar(require("./cli.types"), exports);
19
+ __exportStar(require("./core.types"), exports);
20
+ __exportStar(require("./resolver.types"), exports);
21
+ __exportStar(require("./utils.types"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,15 +1,13 @@
1
1
  {
2
2
  "name": "prodex",
3
- "version": "1.0.8",
3
+ "version": "1.2.0",
4
4
  "description": "Unified Project Indexer & Dependency Extractor for Laravel + React + Node stacks.",
5
- "type": "module",
5
+ "type": "commonjs",
6
6
  "bin": {
7
7
  "prodex": "./bin/prodex.js"
8
8
  },
9
- "main": "./dist/core/combine.js",
10
- "exports": {
11
- ".": "./dist/core/combine.js"
12
- },
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
13
11
  "files": [
14
12
  "dist/",
15
13
  "bin/",
@@ -27,17 +25,25 @@
27
25
  "indexer"
28
26
  ],
29
27
  "scripts": {
30
- "clean": "rm -rf dist",
31
- "build": "npm run clean && node -e \"require('fs').mkdirSync('dist',{recursive:true})\" && cp -r src bin package.json README.md LICENSE dist/",
28
+ "build": "tsc",
29
+ "dev": "tsc --watch",
32
30
  "prepare": "npm run build"
33
31
  },
32
+ "engines": {
33
+ "node": ">=16"
34
+ },
34
35
  "author": "emxhive",
35
36
  "license": "MIT",
36
37
  "devDependencies": {
37
- "tsup": "^8.5.0",
38
- "typescript": "^5.9.3"
38
+ "@types/node": "^24.9.2",
39
+ "typescript": "^5.9.3",
40
+ "vitest": "^4.0.4"
39
41
  },
40
42
  "dependencies": {
41
- "inquirer": "^12.10.0"
43
+ "es-module-lexer": "^1.7.0",
44
+ "fast-glob": "^3.3.3",
45
+ "inquirer": "^12.10.0",
46
+ "micromatch": "^4.0.8",
47
+ "sade": "^1.8.1"
42
48
  }
43
49
  }
package/dist/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Zeki
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/dist/README.md DELETED
@@ -1,140 +0,0 @@
1
- # ๐Ÿงฉ Prodex โ€” Unified Project Indexer & Dependency Extractor
2
-
3
- > **Prodex** *(short for โ€œProject Indexโ€)* โ€” a cross-language dependency combiner for modern full-stack applications.
4
- > Traverses **Laravel + React + TypeScript** projects to generate a single, organized view of your projectโ€™s true dependency scope.
5
-
6
- ---
7
-
8
- ## ๐Ÿง  Recent Fixes & Updates โ€” v1.0.8
9
- - โญ **Priority Files Support** โ€” priority files will now appear **first** on the entry selection list.
10
-
11
- - ๐ŸชŸ **Windows path resolution fixed** โ€” now uses proper `file://` URLs for full ESM compatibility.
12
- - ๐Ÿงพ **Improved output naming** โ€” automatic, context-aware filenames (e.g. `prodex-[entries]-combined.txt`).
13
- - โš™๏ธ **โ€œYes to allโ€ confirmation added** โ€” skip repetitive prompts during CLI runs.
14
-
15
- ---
16
-
17
- ---
18
-
19
- ## ๐Ÿ“ฆ Installation
20
-
21
- ### Global install (recommended)
22
- ```bash
23
- npm install -g prodex
24
- ```
25
-
26
-
27
- ## ๐Ÿš€ Features
28
-
29
- | Feature | Description |
30
- |----------|-------------|
31
- | โš™๏ธ **Cross-language resolver** | Parses JS/TS (`import`, `export`) and PHP (`use`, `require`, `include`) dependency trees. |
32
- | ๐Ÿงญ **Alias detection** | Reads `tsconfig.json` and `vite.config.*` for alias paths (`@/components/...`). |
33
- | ๐Ÿงฉ **Laravel-aware** | Maps PSR-4 namespaces and detects providers under `app/Providers`. |
34
- | ๐Ÿ”„ **Recursive chain following** | Resolves dependency graphs up to a configurable depth and file limit. |
35
- | ๐Ÿชถ **Clean unified output** | Merges all resolved files into a single `.txt` file with region markers for readability. |
36
- | ๐Ÿง  **Static & safe** | Fully static parsing โ€” no runtime execution or file modification. |
37
- | ๐Ÿ’ฌ **Interactive CLI** | Select files, confirm settings, or use โ€œYes to allโ€ for streamlined automation. |
38
-
39
- ---
40
-
41
- ## โš™๏ธ Configuration
42
-
43
- Optional `.prodex.json` (in project root):
44
-
45
- ```json
46
- {
47
- "$schema": "https://raw.githubusercontent.com/emxhive/prodex/main/schema/prodex.schema.json",
48
- "output": "prodex",
49
- "scanDepth": 2,
50
- "limit": 200,
51
- "baseDirs": ["app", "routes", "resources/js"],
52
- "aliasOverrides": {
53
- "@hooks": "resources/js/hooks",
54
- "@data": "resources/js/data"
55
- },
56
- "entryExcludes": [
57
- "resources/js/components/ui/",
58
- "app/DTOs/"
59
- ],
60
- "importExcludes": [
61
- "node_modules",
62
- "@shadcn/"
63
- ],
64
- "priorityFiles": [
65
- "routes/web.php",
66
- "routes/api.php",
67
- "index.",
68
- "main.",
69
- "app."
70
- ]
71
- }
72
- ```
73
-
74
- ```
75
-
76
-
77
-
78
- ```
79
-
80
-
81
-
82
- Files are matched using `.includes()` (case-insensitive), so `"index."` will match `src/index.js`, `app/index.tsx`, etc.
83
- Popular entries appear at the top of the picker.
84
-
85
-
86
-
87
-
88
-
89
- ---
90
-
91
- ## ๐Ÿงฑ Example: Laravel + React
92
-
93
- ```bash
94
- prodex
95
- ```
96
-
97
- ```
98
- ๐Ÿงฉ Following dependency chain...
99
- โœ… prodex-app-routes-combined.txt written (24 file(s)).
100
- ```
101
-
102
- Included files:
103
- ```
104
- resources/js/pages/accounts.tsx
105
- app/Http/Controllers/Shots/AccountsController.php
106
- app/Repositories/Shots/FireflyApiRepository.php
107
- app/Enums/Shots/Granularity.php
108
- app/Support/Shots/CacheKeys.php
109
- ...
110
- ```
111
-
112
- ---
113
-
114
- ## ๐Ÿง  Ideal Use Cases
115
-
116
- - ๐Ÿ“ฆ Generate single-file **project snapshots**
117
- - ๐Ÿค– Provide structured context for **AI assistants**
118
- - ๐Ÿงฉ Perform **dependency audits** or code reviews
119
- - ๐Ÿ“„ Simplify documentation and onboarding
120
-
121
- ---
122
-
123
- ## ๐Ÿ”ฎ Upcoming Features
124
-
125
- - ๐Ÿ“ **Markdown export** (`.md`) with automatic code fences
126
- - ๐Ÿ“ฆ **Configurable output formats** (txt / md)
127
- - โšก **Alias auto-discovery for Laravel Mix and Next.js**
128
-
129
- ---
130
-
131
- ## ๐Ÿงพ License
132
-
133
- **MIT ยฉ 2025 [emxhive](https://github.com/emxhive)**
134
- Issues and contributions welcome:
135
- ๐Ÿ‘‰ [github.com/emxhive/prodex/issues](https://github.com/emxhive/prodex/issues)
136
-
137
- ---
138
-
139
- **Prodex** โ€” *Codebase, decoded*
140
-
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env node
2
- import fs from "fs";
3
- import path from "path";
4
- import { pathToFileURL, fileURLToPath } from "url";
5
-
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
8
-
9
- const devPath = path.resolve(__dirname, "../src/index.js");
10
- const distPath = path.resolve(__dirname, "../dist/src/index.js");
11
-
12
- // prefer dist in published package
13
- const entry = fs.existsSync(distPath) ? distPath : devPath;
14
-
15
- // convert to file:// URL for cross-platform ESM loading
16
- const entryUrl = pathToFileURL(entry).href;
17
-
18
- import(entryUrl).then(({ default: startProdex }) => startProdex());