@codependix/file-imports 0.0.8 → 0.0.9
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 +4 -0
- package/README.md +5 -5
- package/dist/src/index.js +57 -57
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 0.0.9 (2026-10-08)
|
|
2
|
+
|
|
3
|
+
This was a version bump only for codependix-file-imports to align it with other projects, there were no code changes.
|
|
4
|
+
|
|
1
5
|
## 0.0.8 (2026-10-08)
|
|
2
6
|
|
|
3
7
|
This was a version bump only for codependix-file-imports to align it with other projects, there were no code changes.
|
package/README.md
CHANGED
|
@@ -260,13 +260,13 @@ None.
|
|
|
260
260
|
### Project
|
|
261
261
|
|
|
262
262
|

|
|
263
|
-

|
|
264
264
|

|
|
265
265
|

|
|
266
266
|
|
|
267
267
|
### Measured Targets
|
|
268
268
|
|
|
269
|
-

|
|
270
270
|
|
|
271
271
|
### TypeScript
|
|
272
272
|
|
|
@@ -448,14 +448,14 @@ None.
|
|
|
448
448
|
### Markdown
|
|
449
449
|
|
|
450
450
|

|
|
451
|
-

|
|
452
452
|

|
|
453
|
-

|
|
454
454
|

|
|
455
455
|

|
|
456
456
|

|
|
457
457
|

|
|
458
|
-

|
|
459
459
|

|
|
460
460
|

|
|
461
461
|

|
package/dist/src/index.js
CHANGED
|
@@ -2,16 +2,16 @@ import { Injectable as e, Module as t } from "@nestjs/common";
|
|
|
2
2
|
import { existsSync as n, readFileSync as r, readdirSync as i } from "node:fs";
|
|
3
3
|
import a from "node:path";
|
|
4
4
|
import o from "typescript";
|
|
5
|
-
//#region
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
6
6
|
var s = "_This workspace has no internal file imports, in any project._", c = "graph LR";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorateMetadata.js
|
|
9
|
-
function
|
|
9
|
+
function __decorateMetadata(e, t) {
|
|
10
10
|
if (typeof Reflect == "object" && typeof Reflect.metadata == "function") return Reflect.metadata(e, t);
|
|
11
11
|
}
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/decorate.js
|
|
14
|
-
function
|
|
14
|
+
function __decorate(e, t, n, r) {
|
|
15
15
|
var i = arguments.length, a = i < 3 ? t : r === null ? r = Object.getOwnPropertyDescriptor(t, n) : r, o;
|
|
16
16
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") a = Reflect.decorate(e, t, n, r);
|
|
17
17
|
else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
|
|
@@ -19,7 +19,7 @@ function u(e, t, n, r) {
|
|
|
19
19
|
}
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region packages/ic-suite/codependix/codependix-file-imports/src/modules/file-imports-workspace-graph/file-imports-workspace-graph.service.ts
|
|
22
|
-
var
|
|
22
|
+
var l = class FileImportsWorkspaceGraphService {
|
|
23
23
|
constructor() {}
|
|
24
24
|
compareEdges(e, t) {
|
|
25
25
|
return e.source.localeCompare(t.source) || e.target.localeCompare(t.target);
|
|
@@ -56,19 +56,19 @@ var d = class {
|
|
|
56
56
|
].join("\n");
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
|
|
59
|
+
l = __decorate([e(), __decorateMetadata("design:paramtypes", [])], l);
|
|
60
60
|
//#endregion
|
|
61
61
|
//#region packages/ic-suite/codependix/codependix-file-imports/src/modules/file-imports-workspace-graph/file-imports-workspace-graph.module.ts
|
|
62
|
-
var
|
|
63
|
-
|
|
62
|
+
var u = class FileImportsWorkspaceGraphModule {};
|
|
63
|
+
u = __decorate([t({
|
|
64
64
|
controllers: [],
|
|
65
|
-
exports: [
|
|
65
|
+
exports: [l],
|
|
66
66
|
imports: [],
|
|
67
|
-
providers: [
|
|
68
|
-
})],
|
|
67
|
+
providers: [l]
|
|
68
|
+
})], u);
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region packages/ic-suite/codependix/codependix-file-imports/src/modules/python/python-import-parser.constants.ts
|
|
71
|
-
var
|
|
71
|
+
var d = /^from\s+(?<dots>\.*)(?<modulePath>[\w.]*)\s+import\s+.+$/u, f = /^import\s+(?<specifiers>.+)$/u, p = /^(?<modulePath>[\w.]+)/u, m = /^(?:from|import)\b/u, h = class PythonImportParserService {
|
|
72
72
|
constructor() {}
|
|
73
73
|
collectStatement(e, t) {
|
|
74
74
|
let n = 0, r = [], i = t;
|
|
@@ -89,13 +89,13 @@ var p = /^from\s+(?<dots>\.*)(?<modulePath>[\w.]*)\s+import\s+.+$/u, m = /^impor
|
|
|
89
89
|
return e.split(t).length - 1;
|
|
90
90
|
}
|
|
91
91
|
isTopLevelImportStart(e) {
|
|
92
|
-
return this.measureIndent(e) === 0 &&
|
|
92
|
+
return this.measureIndent(e) === 0 && m.test(this.stripComment(e).trim());
|
|
93
93
|
}
|
|
94
94
|
measureIndent(e) {
|
|
95
95
|
return e.length - e.trimStart().length;
|
|
96
96
|
}
|
|
97
97
|
parseFromStatement(e) {
|
|
98
|
-
let t =
|
|
98
|
+
let t = d.exec(e);
|
|
99
99
|
if (t?.groups === void 0) return [];
|
|
100
100
|
/* v8 ignore next 2 -- both named groups always participate in a
|
|
101
101
|
successful match, even as an empty string, so they are never undefined */
|
|
@@ -106,8 +106,8 @@ var p = /^from\s+(?<dots>\.*)(?<modulePath>[\w.]*)\s+import\s+.+$/u, m = /^impor
|
|
|
106
106
|
}];
|
|
107
107
|
}
|
|
108
108
|
parseImportStatement(e) {
|
|
109
|
-
let t =
|
|
110
|
-
return t?.groups === void 0 ? [] : (t.groups.specifiers ?? "").split(",").map((e) =>
|
|
109
|
+
let t = f.exec(e);
|
|
110
|
+
return t?.groups === void 0 ? [] : (t.groups.specifiers ?? "").split(",").map((e) => p.exec(e.trim())?.groups?.modulePath).filter((e) => e !== void 0).map((e) => ({
|
|
111
111
|
level: 0,
|
|
112
112
|
modulePath: e
|
|
113
113
|
}));
|
|
@@ -146,10 +146,10 @@ var p = /^from\s+(?<dots>\.*)(?<modulePath>[\w.]*)\s+import\s+.+$/u, m = /^impor
|
|
|
146
146
|
return n;
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
|
-
|
|
149
|
+
h = __decorate([e(), __decorateMetadata("design:paramtypes", [])], h);
|
|
150
150
|
//#endregion
|
|
151
151
|
//#region packages/ic-suite/codependix/codependix-file-imports/src/modules/python/python.constants.ts
|
|
152
|
-
var
|
|
152
|
+
var g = "__init__.py", _ = "graph LR", v = "_This project has no internal file imports._", y = /* @__PURE__ */ new Set([
|
|
153
153
|
".git",
|
|
154
154
|
".mypy_cache",
|
|
155
155
|
".pytest_cache",
|
|
@@ -157,14 +157,14 @@ var v = "__init__.py", y = "graph LR", b = "_This project has no internal file i
|
|
|
157
157
|
".venv",
|
|
158
158
|
"__pycache__",
|
|
159
159
|
"node_modules"
|
|
160
|
-
]),
|
|
160
|
+
]), b = "language:python", x = class PythonProjectService {
|
|
161
161
|
constructor() {}
|
|
162
162
|
listSourceFilesInDirectory(e) {
|
|
163
163
|
let t = [];
|
|
164
164
|
for (let n of i(e, { withFileTypes: !0 })) {
|
|
165
165
|
let r = a.join(e, n.name);
|
|
166
166
|
if (n.isDirectory()) {
|
|
167
|
-
if (
|
|
167
|
+
if (y.has(n.name)) continue;
|
|
168
168
|
t.push(...this.listSourceFilesInDirectory(r));
|
|
169
169
|
} else n.name.endsWith(".py") && t.push(r);
|
|
170
170
|
}
|
|
@@ -180,16 +180,16 @@ var v = "__init__.py", y = "graph LR", b = "_This project has no internal file i
|
|
|
180
180
|
return e.filter((e) => this.isPythonProject(e)).map((e) => this.describeProject(e.absoluteRoot, e.name));
|
|
181
181
|
}
|
|
182
182
|
isPythonProject(e) {
|
|
183
|
-
return e.tags.includes(
|
|
183
|
+
return e.tags.includes(b);
|
|
184
184
|
}
|
|
185
185
|
listSourceFileNames(e) {
|
|
186
186
|
return this.listSourceFilesInDirectory(e.absoluteRoot).toSorted((e, t) => e.localeCompare(t));
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
|
-
|
|
189
|
+
x = __decorate([e(), __decorateMetadata("design:paramtypes", [])], x);
|
|
190
190
|
//#endregion
|
|
191
191
|
//#region packages/ic-suite/codependix/codependix-file-imports/src/modules/python/python-import-graph.service.ts
|
|
192
|
-
var
|
|
192
|
+
var S = class PythonImportGraphService {
|
|
193
193
|
pythonImportParserService;
|
|
194
194
|
pythonProjectService;
|
|
195
195
|
constructor(e, t) {
|
|
@@ -232,7 +232,7 @@ var w = class {
|
|
|
232
232
|
let e = `${c}.py`;
|
|
233
233
|
if (n(e)) return e;
|
|
234
234
|
}
|
|
235
|
-
let l = a.join(c,
|
|
235
|
+
let l = a.join(c, g);
|
|
236
236
|
return n(l) ? l : void 0;
|
|
237
237
|
}
|
|
238
238
|
toNodeIdentifier(e) {
|
|
@@ -255,19 +255,19 @@ var w = class {
|
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
257
|
renderMermaid(e) {
|
|
258
|
-
return e.edges.length === 0 ?
|
|
258
|
+
return e.edges.length === 0 ? v : [
|
|
259
259
|
"```mermaid",
|
|
260
|
-
|
|
260
|
+
_,
|
|
261
261
|
...e.fileNames.map((e) => this.renderNode(e)),
|
|
262
262
|
...e.edges.map((e) => ` ${this.toNodeIdentifier(e.source)} --> ${this.toNodeIdentifier(e.target)}`),
|
|
263
263
|
"```"
|
|
264
264
|
].join("\n");
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
|
-
|
|
267
|
+
S = __decorate([e(), __decorateMetadata("design:paramtypes", [h === void 0 ? Object : h, x === void 0 ? Object : x])], S);
|
|
268
268
|
//#endregion
|
|
269
269
|
//#region packages/ic-suite/codependix/codependix-file-imports/src/modules/python/python.service.ts
|
|
270
|
-
var
|
|
270
|
+
var C = class PythonService {
|
|
271
271
|
pythonImportGraphService;
|
|
272
272
|
pythonProjectService;
|
|
273
273
|
constructor(e, t) {
|
|
@@ -283,32 +283,32 @@ var T = class {
|
|
|
283
283
|
return this.pythonImportGraphService.renderMermaid(e);
|
|
284
284
|
}
|
|
285
285
|
};
|
|
286
|
-
|
|
286
|
+
C = __decorate([e(), __decorateMetadata("design:paramtypes", [S === void 0 ? Object : S, x === void 0 ? Object : x])], C);
|
|
287
287
|
//#endregion
|
|
288
288
|
//#region packages/ic-suite/codependix/codependix-file-imports/src/modules/python/python.module.ts
|
|
289
|
-
var
|
|
290
|
-
|
|
289
|
+
var w = class PythonModule {};
|
|
290
|
+
w = __decorate([t({
|
|
291
291
|
controllers: [],
|
|
292
|
-
exports: [
|
|
292
|
+
exports: [C],
|
|
293
293
|
imports: [],
|
|
294
294
|
providers: [
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
295
|
+
S,
|
|
296
|
+
h,
|
|
297
|
+
x,
|
|
298
|
+
C
|
|
299
299
|
]
|
|
300
|
-
})],
|
|
300
|
+
})], w);
|
|
301
301
|
//#endregion
|
|
302
302
|
//#region packages/ic-suite/codependix/codependix-file-imports/src/modules/typescript/typescript.constants.ts
|
|
303
|
-
var
|
|
303
|
+
var T = ".d.ts", E = "graph LR", D = "_This project has no internal file imports._", O = "tsconfig.json", TypescriptProjectConfigurationError = class extends Error {
|
|
304
304
|
constructor(e) {
|
|
305
305
|
super(`Could not read ${e.configurationPath}: ${e.messages.join("; ")}`), this.name = "TypescriptProjectConfigurationError";
|
|
306
306
|
}
|
|
307
|
-
},
|
|
307
|
+
}, k = class TypescriptProjectService {
|
|
308
308
|
constructor() {}
|
|
309
309
|
parseConfiguration(e) {
|
|
310
310
|
let t = o.readJsonConfigFile(e.tsconfigPath, (e) => o.sys.readFile(e)), n = o.parseJsonSourceFileConfigFileContent(t, o.sys, a.dirname(e.tsconfigPath), void 0, e.tsconfigPath);
|
|
311
|
-
if (n.errors.length > 0) throw new
|
|
311
|
+
if (n.errors.length > 0) throw new TypescriptProjectConfigurationError({
|
|
312
312
|
configurationPath: e.tsconfigPath,
|
|
313
313
|
messages: n.errors.map((e) => o.flattenDiagnosticMessageText(e.messageText, " "))
|
|
314
314
|
});
|
|
@@ -331,20 +331,20 @@ var D = ".d.ts", O = "graph LR", k = "_This project has no internal file imports
|
|
|
331
331
|
return {
|
|
332
332
|
absoluteRoot: e,
|
|
333
333
|
name: t,
|
|
334
|
-
tsconfigPath: a.join(e,
|
|
334
|
+
tsconfigPath: a.join(e, O)
|
|
335
335
|
};
|
|
336
336
|
}
|
|
337
337
|
discoverProjects(e) {
|
|
338
|
-
return e.filter((e) => n(a.join(e.absoluteRoot,
|
|
338
|
+
return e.filter((e) => n(a.join(e.absoluteRoot, O))).map((e) => this.describeProject(e.absoluteRoot, e.name));
|
|
339
339
|
}
|
|
340
340
|
toRealPath(e) {
|
|
341
341
|
return o.sys.realpath === void 0 ? e : o.sys.realpath(e);
|
|
342
342
|
}
|
|
343
343
|
};
|
|
344
|
-
|
|
344
|
+
k = __decorate([e(), __decorateMetadata("design:paramtypes", [])], k);
|
|
345
345
|
//#endregion
|
|
346
346
|
//#region packages/ic-suite/codependix/codependix-file-imports/src/modules/typescript/typescript-import-graph.service.ts
|
|
347
|
-
var
|
|
347
|
+
var A = class TypescriptImportGraphService {
|
|
348
348
|
typescriptProjectService;
|
|
349
349
|
constructor(e) {
|
|
350
350
|
this.typescriptProjectService = e;
|
|
@@ -380,7 +380,7 @@ var N = class {
|
|
|
380
380
|
return [...t.values()].toSorted((e, t) => this.compareEdges(e, t));
|
|
381
381
|
}
|
|
382
382
|
listOwnedSourceFileNames(e) {
|
|
383
|
-
return [...this.resolveOwnedFileNames(e)].filter((e) => !e.endsWith(
|
|
383
|
+
return [...this.resolveOwnedFileNames(e)].filter((e) => !e.endsWith(T)).toSorted((e, t) => e.localeCompare(t));
|
|
384
384
|
}
|
|
385
385
|
renderNode(e) {
|
|
386
386
|
return ` ${this.toNodeIdentifier(e)}["${e}"]`;
|
|
@@ -412,19 +412,19 @@ var N = class {
|
|
|
412
412
|
};
|
|
413
413
|
}
|
|
414
414
|
renderMermaid(e) {
|
|
415
|
-
return e.edges.length === 0 ?
|
|
415
|
+
return e.edges.length === 0 ? D : [
|
|
416
416
|
"```mermaid",
|
|
417
|
-
|
|
417
|
+
E,
|
|
418
418
|
...e.fileNames.map((e) => this.renderNode(e)),
|
|
419
419
|
...e.edges.map((e) => ` ${this.toNodeIdentifier(e.source)} --> ${this.toNodeIdentifier(e.target)}`),
|
|
420
420
|
"```"
|
|
421
421
|
].join("\n");
|
|
422
422
|
}
|
|
423
423
|
};
|
|
424
|
-
|
|
424
|
+
A = __decorate([e(), __decorateMetadata("design:paramtypes", [k === void 0 ? Object : k])], A);
|
|
425
425
|
//#endregion
|
|
426
426
|
//#region packages/ic-suite/codependix/codependix-file-imports/src/modules/typescript/typescript.service.ts
|
|
427
|
-
var
|
|
427
|
+
var j = class TypescriptService {
|
|
428
428
|
typescriptImportGraphService;
|
|
429
429
|
typescriptProjectService;
|
|
430
430
|
constructor(e, t) {
|
|
@@ -443,19 +443,19 @@ var P = class {
|
|
|
443
443
|
return this.typescriptImportGraphService.renderMermaid(e);
|
|
444
444
|
}
|
|
445
445
|
};
|
|
446
|
-
|
|
446
|
+
j = __decorate([e(), __decorateMetadata("design:paramtypes", [A === void 0 ? Object : A, k === void 0 ? Object : k])], j);
|
|
447
447
|
//#endregion
|
|
448
448
|
//#region packages/ic-suite/codependix/codependix-file-imports/src/modules/typescript/typescript.module.ts
|
|
449
|
-
var
|
|
450
|
-
|
|
449
|
+
var M = class TypescriptModule {};
|
|
450
|
+
M = __decorate([t({
|
|
451
451
|
controllers: [],
|
|
452
|
-
exports: [
|
|
452
|
+
exports: [j],
|
|
453
453
|
imports: [],
|
|
454
454
|
providers: [
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
455
|
+
A,
|
|
456
|
+
k,
|
|
457
|
+
j
|
|
458
458
|
]
|
|
459
|
-
})],
|
|
459
|
+
})], M);
|
|
460
460
|
//#endregion
|
|
461
|
-
export { c as FILE_IMPORTS_WORKSPACE_GRAPH_MERMAID_HEADER, s as FILE_IMPORTS_WORKSPACE_GRAPH_UNCONNECTED,
|
|
461
|
+
export { c as FILE_IMPORTS_WORKSPACE_GRAPH_MERMAID_HEADER, s as FILE_IMPORTS_WORKSPACE_GRAPH_UNCONNECTED, u as FileImportsWorkspaceGraphModule, l as FileImportsWorkspaceGraphService, S as PythonImportGraphService, h as PythonImportParserService, w as PythonModule, x as PythonProjectService, C as PythonService, A as TypescriptImportGraphService, M as TypescriptModule, k as TypescriptProjectService, j as TypescriptService };
|
package/package.json
CHANGED