tina4-nodejs 3.10.65 → 3.10.66

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tina4-nodejs",
3
- "version": "3.10.65",
3
+ "version": "3.10.66",
4
4
  "type": "module",
5
5
  "description": "Tina4 for Node.js/TypeScript — 54 built-in features, zero dependencies",
6
6
  "keywords": ["tina4", "framework", "web", "api", "orm", "graphql", "websocket", "typescript"],
@@ -54,6 +54,9 @@ function relativePath(filePath: string, root: string = "."): string {
54
54
  return path.relative(root, filePath);
55
55
  }
56
56
 
57
+ // Stores the resolved scan root so fileDetail() can locate framework files.
58
+ let _lastScanRoot = "";
59
+
57
60
  // ── Test file detection ─────────────────────────────────────
58
61
 
59
62
  function hasMatchingTest(relPath: string): boolean {
@@ -591,10 +594,13 @@ function detectViolations(
591
594
  function resolveRoot(root: string = "src"): string {
592
595
  const rootPath = path.resolve(root);
593
596
  if (fs.existsSync(rootPath) && walkFiles(rootPath, [".ts", ".js"]).length > 0) {
597
+ _lastScanRoot = rootPath;
594
598
  return root;
595
599
  }
596
600
  // Fallback: scan the framework package itself
597
- return path.resolve(path.dirname(new URL(import.meta.url).pathname));
601
+ const fwDir = path.resolve(path.dirname(new URL(import.meta.url).pathname));
602
+ _lastScanRoot = fwDir;
603
+ return fwDir;
598
604
  }
599
605
 
600
606
  // ── Quick Metrics ────────────────────────────────────────────
@@ -854,7 +860,15 @@ export function fullAnalysis(root: string = "src"): Record<string, any> {
854
860
  // ── File Detail ──────────────────────────────────────────────
855
861
 
856
862
  export function fileDetail(filePath: string): Record<string, any> {
857
- const resolved = path.resolve(filePath);
863
+ let resolved = path.resolve(filePath);
864
+ if (!fs.existsSync(resolved) && _lastScanRoot) {
865
+ // Try resolving relative to the last scan root (framework mode)
866
+ const candidate = path.resolve(_lastScanRoot, filePath);
867
+ if (fs.existsSync(candidate)) {
868
+ resolved = candidate;
869
+ filePath = candidate;
870
+ }
871
+ }
858
872
  if (!fs.existsSync(resolved)) {
859
873
  return { error: `File not found: ${filePath}` };
860
874
  }