@saluzi/codegraph 0.1.0 → 0.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.
- package/LICENSE +21 -0
- package/README.md +885 -0
- package/package.json +42 -10
- package/scripts/add-lang/bench.sh +60 -0
- package/scripts/add-lang/check-grammar.mjs +75 -0
- package/scripts/add-lang/dump-ast.mjs +103 -0
- package/scripts/add-lang/verify-extraction.mjs +70 -0
- package/scripts/agent-eval/ab-adoption.sh +91 -0
- package/scripts/agent-eval/ab-hook.sh +86 -0
- package/scripts/agent-eval/ab-impl.sh +78 -0
- package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -0
- package/scripts/agent-eval/ab-sufficiency.sh +78 -0
- package/scripts/agent-eval/arms-F.sh +21 -0
- package/scripts/agent-eval/arms-matrix.sh +37 -0
- package/scripts/agent-eval/audit.sh +68 -0
- package/scripts/agent-eval/bench-readme.sh +28 -0
- package/scripts/agent-eval/bench-why-repo.sh +22 -0
- package/scripts/agent-eval/block-read-hook.sh +19 -0
- package/scripts/agent-eval/hook-settings.json +15 -0
- package/scripts/agent-eval/itrun.sh +120 -0
- package/scripts/agent-eval/offload-eval-3arm.sh +72 -0
- package/scripts/agent-eval/offload-eval-cost.mjs +133 -0
- package/scripts/agent-eval/offload-eval-effort.mjs +108 -0
- package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -0
- package/scripts/agent-eval/offload-eval-frontload.sh +47 -0
- package/scripts/agent-eval/offload-eval-ground-truth.json +18 -0
- package/scripts/agent-eval/offload-eval-hook.mjs +84 -0
- package/scripts/agent-eval/offload-eval-judge.mjs +103 -0
- package/scripts/agent-eval/offload-eval-matrix.sh +20 -0
- package/scripts/agent-eval/offload-eval-metrics.mjs +94 -0
- package/scripts/agent-eval/offload-eval-refs1.sh +50 -0
- package/scripts/agent-eval/offload-eval-setup.sh +24 -0
- package/scripts/agent-eval/offload-eval-styles.sh +72 -0
- package/scripts/agent-eval/offload-eval-summarize.mjs +68 -0
- package/scripts/agent-eval/offload-eval.md +76 -0
- package/scripts/agent-eval/parse-arms.mjs +116 -0
- package/scripts/agent-eval/parse-bench-readme.mjs +84 -0
- package/scripts/agent-eval/parse-run.mjs +45 -0
- package/scripts/agent-eval/parse-session.mjs +93 -0
- package/scripts/agent-eval/probe-context.mjs +21 -0
- package/scripts/agent-eval/probe-explore.mjs +40 -0
- package/scripts/agent-eval/probe-node.mjs +20 -0
- package/scripts/agent-eval/probe-sweep.mjs +119 -0
- package/scripts/agent-eval/probe-trace.mjs +20 -0
- package/scripts/agent-eval/redirect-read-hook.sh +38 -0
- package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -0
- package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
- package/scripts/agent-eval/run-agent.sh +34 -0
- package/scripts/agent-eval/run-all.sh +75 -0
- package/scripts/agent-eval/run-arms.sh +56 -0
- package/scripts/agent-eval/seq-matrix.mjs +137 -0
- package/scripts/build-bundle.sh +123 -0
- package/scripts/extract-release-notes.mjs +130 -0
- package/scripts/local-install.sh +41 -0
- package/scripts/npm-sdk.js +75 -0
- package/scripts/npm-shim.js +275 -0
- package/scripts/pack-npm.sh +119 -0
- package/scripts/prepare-release.mjs +270 -0
- package/dist/bin/codegraph.d.ts +0 -25
- package/dist/bin/node-version-check.d.ts +0 -37
- package/dist/bin/uninstall.d.ts +0 -14
- package/dist/context/formatter.d.ts +0 -33
- package/dist/context/formatter.js +0 -244
- package/dist/context/index.d.ts +0 -117
- package/dist/context/index.js +0 -1050
- package/dist/db/index.d.ts +0 -101
- package/dist/db/index.js +0 -250
- package/dist/db/migrations.d.ts +0 -47
- package/dist/db/migrations.js +0 -131
- package/dist/db/queries.d.ts +0 -291
- package/dist/db/queries.js +0 -1349
- package/dist/db/schema.sql +0 -151
- package/dist/db/sqlite-adapter.d.ts +0 -49
- package/dist/db/sqlite-adapter.js +0 -141
- package/dist/directory.d.ts +0 -62
- package/dist/directory.js +0 -264
- package/dist/errors.d.ts +0 -149
- package/dist/errors.js +0 -219
- package/dist/extraction/dfm-extractor.d.ts +0 -31
- package/dist/extraction/dfm-extractor.js +0 -151
- package/dist/extraction/grammars.d.ts +0 -94
- package/dist/extraction/grammars.js +0 -357
- package/dist/extraction/index.d.ts +0 -148
- package/dist/extraction/index.js +0 -1286
- package/dist/extraction/languages/c-cpp.d.ts +0 -4
- package/dist/extraction/languages/c-cpp.js +0 -126
- package/dist/extraction/languages/csharp.d.ts +0 -3
- package/dist/extraction/languages/csharp.js +0 -72
- package/dist/extraction/languages/dart.d.ts +0 -3
- package/dist/extraction/languages/dart.js +0 -192
- package/dist/extraction/languages/go.d.ts +0 -3
- package/dist/extraction/languages/go.js +0 -58
- package/dist/extraction/languages/index.d.ts +0 -10
- package/dist/extraction/languages/index.js +0 -49
- package/dist/extraction/languages/java.d.ts +0 -3
- package/dist/extraction/languages/java.js +0 -64
- package/dist/extraction/languages/javascript.d.ts +0 -3
- package/dist/extraction/languages/javascript.js +0 -90
- package/dist/extraction/languages/kotlin.d.ts +0 -3
- package/dist/extraction/languages/kotlin.js +0 -253
- package/dist/extraction/languages/lua.d.ts +0 -3
- package/dist/extraction/languages/lua.js +0 -150
- package/dist/extraction/languages/luau.d.ts +0 -3
- package/dist/extraction/languages/luau.js +0 -37
- package/dist/extraction/languages/pascal.d.ts +0 -3
- package/dist/extraction/languages/pascal.js +0 -66
- package/dist/extraction/languages/php.d.ts +0 -3
- package/dist/extraction/languages/php.js +0 -107
- package/dist/extraction/languages/python.d.ts +0 -3
- package/dist/extraction/languages/python.js +0 -56
- package/dist/extraction/languages/ruby.d.ts +0 -3
- package/dist/extraction/languages/ruby.js +0 -114
- package/dist/extraction/languages/rust.d.ts +0 -3
- package/dist/extraction/languages/rust.js +0 -109
- package/dist/extraction/languages/scala.d.ts +0 -3
- package/dist/extraction/languages/scala.js +0 -139
- package/dist/extraction/languages/swift.d.ts +0 -3
- package/dist/extraction/languages/swift.js +0 -91
- package/dist/extraction/languages/typescript.d.ts +0 -3
- package/dist/extraction/languages/typescript.js +0 -129
- package/dist/extraction/liquid-extractor.d.ts +0 -52
- package/dist/extraction/liquid-extractor.js +0 -313
- package/dist/extraction/parse-worker.d.ts +0 -8
- package/dist/extraction/parse-worker.js +0 -94
- package/dist/extraction/svelte-extractor.d.ts +0 -56
- package/dist/extraction/svelte-extractor.js +0 -272
- package/dist/extraction/tree-sitter-helpers.d.ts +0 -39
- package/dist/extraction/tree-sitter-helpers.js +0 -103
- package/dist/extraction/tree-sitter-types.d.ts +0 -191
- package/dist/extraction/tree-sitter-types.js +0 -10
- package/dist/extraction/tree-sitter.d.ts +0 -238
- package/dist/extraction/tree-sitter.js +0 -2430
- package/dist/extraction/vue-extractor.d.ts +0 -36
- package/dist/extraction/vue-extractor.js +0 -163
- package/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +0 -46
- package/dist/extraction/wasm-runtime-flags.js +0 -105
- package/dist/graph/index.d.ts +0 -8
- package/dist/graph/index.js +0 -13
- package/dist/graph/queries.d.ts +0 -109
- package/dist/graph/queries.js +0 -366
- package/dist/graph/traversal.d.ts +0 -137
- package/dist/graph/traversal.js +0 -528
- package/dist/index.d.ts +0 -509
- package/dist/index.js +0 -800
- package/dist/installer/claude-md-template.d.ts +0 -19
- package/dist/installer/config-writer.d.ts +0 -29
- package/dist/installer/index.d.ts +0 -140
- package/dist/installer/instructions-template.d.ts +0 -30
- package/dist/installer/targets/claude.d.ts +0 -55
- package/dist/installer/targets/codex.d.ts +0 -18
- package/dist/installer/targets/cursor.d.ts +0 -35
- package/dist/installer/targets/hermes.d.ts +0 -18
- package/dist/installer/targets/opencode.d.ts +0 -30
- package/dist/installer/targets/registry.d.ts +0 -38
- package/dist/installer/targets/shared.d.ts +0 -92
- package/dist/installer/targets/toml.d.ts +0 -64
- package/dist/installer/targets/types.d.ts +0 -122
- package/dist/mcp/index.d.ts +0 -98
- package/dist/mcp/server-instructions.d.ts +0 -20
- package/dist/mcp/tools.d.ts +0 -269
- package/dist/mcp/transport.d.ts +0 -117
- package/dist/resolution/frameworks/cargo-workspace.d.ts +0 -20
- package/dist/resolution/frameworks/cargo-workspace.js +0 -225
- package/dist/resolution/frameworks/csharp.d.ts +0 -8
- package/dist/resolution/frameworks/csharp.js +0 -213
- package/dist/resolution/frameworks/drupal.d.ts +0 -51
- package/dist/resolution/frameworks/drupal.js +0 -335
- package/dist/resolution/frameworks/express.d.ts +0 -8
- package/dist/resolution/frameworks/express.js +0 -225
- package/dist/resolution/frameworks/go.d.ts +0 -8
- package/dist/resolution/frameworks/go.js +0 -158
- package/dist/resolution/frameworks/index.d.ts +0 -52
- package/dist/resolution/frameworks/index.js +0 -137
- package/dist/resolution/frameworks/java.d.ts +0 -8
- package/dist/resolution/frameworks/java.js +0 -177
- package/dist/resolution/frameworks/laravel.d.ts +0 -13
- package/dist/resolution/frameworks/laravel.js +0 -248
- package/dist/resolution/frameworks/nestjs.d.ts +0 -26
- package/dist/resolution/frameworks/nestjs.js +0 -374
- package/dist/resolution/frameworks/python.d.ts +0 -10
- package/dist/resolution/frameworks/python.js +0 -278
- package/dist/resolution/frameworks/react.d.ts +0 -8
- package/dist/resolution/frameworks/react.js +0 -272
- package/dist/resolution/frameworks/ruby.d.ts +0 -8
- package/dist/resolution/frameworks/ruby.js +0 -198
- package/dist/resolution/frameworks/rust.d.ts +0 -8
- package/dist/resolution/frameworks/rust.js +0 -207
- package/dist/resolution/frameworks/svelte.d.ts +0 -9
- package/dist/resolution/frameworks/svelte.js +0 -249
- package/dist/resolution/frameworks/swift.d.ts +0 -10
- package/dist/resolution/frameworks/swift.js +0 -376
- package/dist/resolution/frameworks/vue.d.ts +0 -9
- package/dist/resolution/frameworks/vue.js +0 -306
- package/dist/resolution/import-resolver.d.ts +0 -61
- package/dist/resolution/import-resolver.js +0 -663
- package/dist/resolution/index.d.ts +0 -118
- package/dist/resolution/index.js +0 -744
- package/dist/resolution/lru-cache.d.ts +0 -24
- package/dist/resolution/lru-cache.js +0 -62
- package/dist/resolution/name-matcher.d.ts +0 -50
- package/dist/resolution/name-matcher.js +0 -384
- package/dist/resolution/path-aliases.d.ts +0 -72
- package/dist/resolution/path-aliases.js +0 -238
- package/dist/resolution/strip-comments.d.ts +0 -40
- package/dist/resolution/strip-comments.js +0 -441
- package/dist/resolution/types.d.ts +0 -181
- package/dist/resolution/types.js +0 -8
- package/dist/search/query-parser.d.ts +0 -61
- package/dist/search/query-parser.js +0 -177
- package/dist/search/query-utils.d.ts +0 -59
- package/dist/search/query-utils.js +0 -383
- package/dist/sync/git-hooks.d.ts +0 -54
- package/dist/sync/git-hooks.js +0 -223
- package/dist/sync/index.d.ts +0 -25
- package/dist/sync/index.js +0 -28
- package/dist/sync/watch-policy.d.ts +0 -51
- package/dist/sync/watch-policy.js +0 -124
- package/dist/sync/watcher.d.ts +0 -83
- package/dist/sync/watcher.js +0 -192
- package/dist/types.d.ts +0 -433
- package/dist/types.js +0 -75
- package/dist/ui/glyphs.d.ts +0 -42
- package/dist/ui/shimmer-progress.d.ts +0 -11
- package/dist/ui/shimmer-worker.d.ts +0 -2
- package/dist/ui/types.d.ts +0 -20
- package/dist/utils.d.ts +0 -231
- package/dist/utils.js +0 -549
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Swift Framework Resolver
|
|
4
|
-
*
|
|
5
|
-
* Handles SwiftUI, UIKit, and Vapor (server-side Swift) patterns.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.vaporResolver = exports.uikitResolver = exports.swiftUIResolver = void 0;
|
|
9
|
-
const strip_comments_1 = require("../strip-comments");
|
|
10
|
-
exports.swiftUIResolver = {
|
|
11
|
-
name: 'swiftui',
|
|
12
|
-
languages: ['swift'],
|
|
13
|
-
detect(context) {
|
|
14
|
-
// Check for SwiftUI imports in Swift files
|
|
15
|
-
const allFiles = context.getAllFiles();
|
|
16
|
-
for (const file of allFiles) {
|
|
17
|
-
if (file.endsWith('.swift')) {
|
|
18
|
-
const content = context.readFile(file);
|
|
19
|
-
if (content && content.includes('import SwiftUI')) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
// Check for Xcode project with SwiftUI
|
|
25
|
-
for (const file of allFiles) {
|
|
26
|
-
if (file.endsWith('.xcodeproj') || file.endsWith('.xcworkspace')) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return false;
|
|
31
|
-
},
|
|
32
|
-
resolve(ref, context) {
|
|
33
|
-
// Pattern 1: View references (SwiftUI views are PascalCase ending in View)
|
|
34
|
-
if (ref.referenceName.endsWith('View') && /^[A-Z]/.test(ref.referenceName)) {
|
|
35
|
-
const result = resolveByNameAndKind(ref.referenceName, VIEW_KINDS, VIEW_DIRS, context);
|
|
36
|
-
if (result) {
|
|
37
|
-
return {
|
|
38
|
-
original: ref,
|
|
39
|
-
targetNodeId: result,
|
|
40
|
-
confidence: 0.85,
|
|
41
|
-
resolvedBy: 'framework',
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
// Pattern 2: ViewModel/ObservableObject references
|
|
46
|
-
if (ref.referenceName.endsWith('ViewModel') || ref.referenceName.endsWith('Store') || ref.referenceName.endsWith('Manager')) {
|
|
47
|
-
const result = resolveByNameAndKind(ref.referenceName, CLASS_KINDS, VIEWMODEL_DIRS, context);
|
|
48
|
-
if (result) {
|
|
49
|
-
return {
|
|
50
|
-
original: ref,
|
|
51
|
-
targetNodeId: result,
|
|
52
|
-
confidence: 0.85,
|
|
53
|
-
resolvedBy: 'framework',
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
// Pattern 3: Model references
|
|
58
|
-
if (/^[A-Z][a-zA-Z]+$/.test(ref.referenceName)) {
|
|
59
|
-
const result = resolveByNameAndKind(ref.referenceName, MODEL_KINDS, MODEL_DIRS, context);
|
|
60
|
-
if (result) {
|
|
61
|
-
return {
|
|
62
|
-
original: ref,
|
|
63
|
-
targetNodeId: result,
|
|
64
|
-
confidence: 0.7,
|
|
65
|
-
resolvedBy: 'framework',
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return null;
|
|
70
|
-
},
|
|
71
|
-
extract(filePath, content) {
|
|
72
|
-
if (!filePath.endsWith('.swift'))
|
|
73
|
-
return { nodes: [], references: [] };
|
|
74
|
-
const nodes = [];
|
|
75
|
-
const now = Date.now();
|
|
76
|
-
const safe = (0, strip_comments_1.stripCommentsForRegex)(content, 'swift');
|
|
77
|
-
// Extract SwiftUI View structs
|
|
78
|
-
// struct ContentView: View { ... }
|
|
79
|
-
const viewPattern = /struct\s+(\w+)\s*:\s*(?:\w+\s*,\s*)*View/g;
|
|
80
|
-
let match;
|
|
81
|
-
while ((match = viewPattern.exec(safe)) !== null) {
|
|
82
|
-
const [, viewName] = match;
|
|
83
|
-
const line = safe.slice(0, match.index).split('\n').length;
|
|
84
|
-
nodes.push({
|
|
85
|
-
id: `view:${filePath}:${viewName}:${line}`,
|
|
86
|
-
kind: 'component',
|
|
87
|
-
name: viewName,
|
|
88
|
-
qualifiedName: `${filePath}::${viewName}`,
|
|
89
|
-
filePath,
|
|
90
|
-
startLine: line,
|
|
91
|
-
endLine: line,
|
|
92
|
-
startColumn: 0,
|
|
93
|
-
endColumn: match[0].length,
|
|
94
|
-
language: 'swift',
|
|
95
|
-
updatedAt: now,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
// Extract @main App entry point
|
|
99
|
-
const appPattern = /@main\s+struct\s+(\w+)\s*:\s*App/g;
|
|
100
|
-
while ((match = appPattern.exec(safe)) !== null) {
|
|
101
|
-
const [, appName] = match;
|
|
102
|
-
const line = safe.slice(0, match.index).split('\n').length;
|
|
103
|
-
nodes.push({
|
|
104
|
-
id: `app:${filePath}:${appName}:${line}`,
|
|
105
|
-
kind: 'class',
|
|
106
|
-
name: appName,
|
|
107
|
-
qualifiedName: `${filePath}::${appName}`,
|
|
108
|
-
filePath,
|
|
109
|
-
startLine: line,
|
|
110
|
-
endLine: line,
|
|
111
|
-
startColumn: 0,
|
|
112
|
-
endColumn: match[0].length,
|
|
113
|
-
language: 'swift',
|
|
114
|
-
updatedAt: now,
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
return { nodes, references: [] };
|
|
118
|
-
},
|
|
119
|
-
};
|
|
120
|
-
exports.uikitResolver = {
|
|
121
|
-
name: 'uikit',
|
|
122
|
-
languages: ['swift'],
|
|
123
|
-
detect(context) {
|
|
124
|
-
const allFiles = context.getAllFiles();
|
|
125
|
-
for (const file of allFiles) {
|
|
126
|
-
if (file.endsWith('.swift')) {
|
|
127
|
-
const content = context.readFile(file);
|
|
128
|
-
if (content && (content.includes('import UIKit') ||
|
|
129
|
-
content.includes('UIViewController') ||
|
|
130
|
-
content.includes('UIView'))) {
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return false;
|
|
136
|
-
},
|
|
137
|
-
resolve(ref, context) {
|
|
138
|
-
// Pattern 1: ViewController references
|
|
139
|
-
if (ref.referenceName.endsWith('ViewController')) {
|
|
140
|
-
const result = resolveByNameAndKind(ref.referenceName, CLASS_KINDS, VC_DIRS, context);
|
|
141
|
-
if (result) {
|
|
142
|
-
return {
|
|
143
|
-
original: ref,
|
|
144
|
-
targetNodeId: result,
|
|
145
|
-
confidence: 0.85,
|
|
146
|
-
resolvedBy: 'framework',
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
// Pattern 2: UIView subclass references
|
|
151
|
-
if (ref.referenceName.endsWith('View') && !ref.referenceName.endsWith('ViewController')) {
|
|
152
|
-
const result = resolveByNameAndKind(ref.referenceName, CLASS_KINDS, UIVIEW_DIRS, context);
|
|
153
|
-
if (result) {
|
|
154
|
-
return {
|
|
155
|
-
original: ref,
|
|
156
|
-
targetNodeId: result,
|
|
157
|
-
confidence: 0.8,
|
|
158
|
-
resolvedBy: 'framework',
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
// Pattern 3: Cell references
|
|
163
|
-
if (ref.referenceName.endsWith('Cell')) {
|
|
164
|
-
const result = resolveByNameAndKind(ref.referenceName, CLASS_KINDS, CELL_DIRS, context);
|
|
165
|
-
if (result) {
|
|
166
|
-
return {
|
|
167
|
-
original: ref,
|
|
168
|
-
targetNodeId: result,
|
|
169
|
-
confidence: 0.85,
|
|
170
|
-
resolvedBy: 'framework',
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
// Pattern 4: Delegate/DataSource references
|
|
175
|
-
if (ref.referenceName.endsWith('Delegate') || ref.referenceName.endsWith('DataSource')) {
|
|
176
|
-
const result = resolveByNameAndKind(ref.referenceName, PROTOCOL_KINDS, [], context);
|
|
177
|
-
if (result) {
|
|
178
|
-
return {
|
|
179
|
-
original: ref,
|
|
180
|
-
targetNodeId: result,
|
|
181
|
-
confidence: 0.8,
|
|
182
|
-
resolvedBy: 'framework',
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return null;
|
|
187
|
-
},
|
|
188
|
-
extract(filePath, content) {
|
|
189
|
-
if (!filePath.endsWith('.swift'))
|
|
190
|
-
return { nodes: [], references: [] };
|
|
191
|
-
const nodes = [];
|
|
192
|
-
const now = Date.now();
|
|
193
|
-
const safe = (0, strip_comments_1.stripCommentsForRegex)(content, 'swift');
|
|
194
|
-
// Extract UIViewController subclasses
|
|
195
|
-
const vcPattern = /class\s+(\w+)\s*:\s*(?:\w+\s*,\s*)*UIViewController/g;
|
|
196
|
-
let match;
|
|
197
|
-
while ((match = vcPattern.exec(safe)) !== null) {
|
|
198
|
-
const [, vcName] = match;
|
|
199
|
-
const line = safe.slice(0, match.index).split('\n').length;
|
|
200
|
-
nodes.push({
|
|
201
|
-
id: `viewcontroller:${filePath}:${vcName}:${line}`,
|
|
202
|
-
kind: 'class',
|
|
203
|
-
name: vcName,
|
|
204
|
-
qualifiedName: `${filePath}::${vcName}`,
|
|
205
|
-
filePath,
|
|
206
|
-
startLine: line,
|
|
207
|
-
endLine: line,
|
|
208
|
-
startColumn: 0,
|
|
209
|
-
endColumn: match[0].length,
|
|
210
|
-
language: 'swift',
|
|
211
|
-
updatedAt: now,
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
// Extract UIView subclasses
|
|
215
|
-
const viewPattern = /class\s+(\w+)\s*:\s*(?:\w+\s*,\s*)*UIView[^C]/g;
|
|
216
|
-
while ((match = viewPattern.exec(safe)) !== null) {
|
|
217
|
-
const [, viewName] = match;
|
|
218
|
-
const line = safe.slice(0, match.index).split('\n').length;
|
|
219
|
-
nodes.push({
|
|
220
|
-
id: `uiview:${filePath}:${viewName}:${line}`,
|
|
221
|
-
kind: 'class',
|
|
222
|
-
name: viewName,
|
|
223
|
-
qualifiedName: `${filePath}::${viewName}`,
|
|
224
|
-
filePath,
|
|
225
|
-
startLine: line,
|
|
226
|
-
endLine: line,
|
|
227
|
-
startColumn: 0,
|
|
228
|
-
endColumn: match[0].length,
|
|
229
|
-
language: 'swift',
|
|
230
|
-
updatedAt: now,
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
return { nodes, references: [] };
|
|
234
|
-
},
|
|
235
|
-
};
|
|
236
|
-
exports.vaporResolver = {
|
|
237
|
-
name: 'vapor',
|
|
238
|
-
languages: ['swift'],
|
|
239
|
-
detect(context) {
|
|
240
|
-
// Check for Package.swift with Vapor dependency
|
|
241
|
-
const packageSwift = context.readFile('Package.swift');
|
|
242
|
-
if (packageSwift && packageSwift.includes('vapor')) {
|
|
243
|
-
return true;
|
|
244
|
-
}
|
|
245
|
-
// Check for Vapor imports
|
|
246
|
-
const allFiles = context.getAllFiles();
|
|
247
|
-
for (const file of allFiles) {
|
|
248
|
-
if (file.endsWith('.swift')) {
|
|
249
|
-
const content = context.readFile(file);
|
|
250
|
-
if (content && content.includes('import Vapor')) {
|
|
251
|
-
return true;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
return false;
|
|
256
|
-
},
|
|
257
|
-
resolve(ref, context) {
|
|
258
|
-
// Pattern 1: Controller references
|
|
259
|
-
if (ref.referenceName.endsWith('Controller')) {
|
|
260
|
-
const result = resolveByNameAndKind(ref.referenceName, VAPOR_CONTROLLER_KINDS, VAPOR_CONTROLLER_DIRS, context);
|
|
261
|
-
if (result) {
|
|
262
|
-
return {
|
|
263
|
-
original: ref,
|
|
264
|
-
targetNodeId: result,
|
|
265
|
-
confidence: 0.85,
|
|
266
|
-
resolvedBy: 'framework',
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
// Pattern 2: Model references (Fluent)
|
|
271
|
-
if (/^[A-Z][a-zA-Z]+$/.test(ref.referenceName)) {
|
|
272
|
-
const result = resolveByNameAndKind(ref.referenceName, CLASS_KINDS, FLUENT_MODEL_DIRS, context);
|
|
273
|
-
if (result) {
|
|
274
|
-
return {
|
|
275
|
-
original: ref,
|
|
276
|
-
targetNodeId: result,
|
|
277
|
-
confidence: 0.75,
|
|
278
|
-
resolvedBy: 'framework',
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
// Pattern 3: Middleware references
|
|
283
|
-
if (ref.referenceName.endsWith('Middleware')) {
|
|
284
|
-
const result = resolveByNameAndKind(ref.referenceName, VAPOR_CONTROLLER_KINDS, VAPOR_MIDDLEWARE_DIRS, context);
|
|
285
|
-
if (result) {
|
|
286
|
-
return {
|
|
287
|
-
original: ref,
|
|
288
|
-
targetNodeId: result,
|
|
289
|
-
confidence: 0.8,
|
|
290
|
-
resolvedBy: 'framework',
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
return null;
|
|
295
|
-
},
|
|
296
|
-
extract(filePath, content) {
|
|
297
|
-
if (!filePath.endsWith('.swift'))
|
|
298
|
-
return { nodes: [], references: [] };
|
|
299
|
-
const nodes = [];
|
|
300
|
-
const references = [];
|
|
301
|
-
const now = Date.now();
|
|
302
|
-
const safe = (0, strip_comments_1.stripCommentsForRegex)(content, 'swift');
|
|
303
|
-
// Vapor: (app|router|routes).METHOD("path", use: handler)
|
|
304
|
-
const routeRegex = /\b(?:app|router|routes)\.(get|post|put|patch|delete)\s*\(\s*"([^"]+)"\s*,\s*use:\s*([A-Za-z_][A-Za-z0-9_.]*)/g;
|
|
305
|
-
let match;
|
|
306
|
-
while ((match = routeRegex.exec(safe)) !== null) {
|
|
307
|
-
const [, method, routePath, handlerExpr] = match;
|
|
308
|
-
const line = safe.slice(0, match.index).split('\n').length;
|
|
309
|
-
const upper = method.toUpperCase();
|
|
310
|
-
const routeNode = {
|
|
311
|
-
id: `route:${filePath}:${line}:${upper}:${routePath}`,
|
|
312
|
-
kind: 'route',
|
|
313
|
-
name: `${upper} ${routePath}`,
|
|
314
|
-
qualifiedName: `${filePath}::route:${routePath}`,
|
|
315
|
-
filePath,
|
|
316
|
-
startLine: line,
|
|
317
|
-
endLine: line,
|
|
318
|
-
startColumn: 0,
|
|
319
|
-
endColumn: match[0].length,
|
|
320
|
-
language: 'swift',
|
|
321
|
-
updatedAt: now,
|
|
322
|
-
};
|
|
323
|
-
nodes.push(routeNode);
|
|
324
|
-
// Last segment of dotted path (e.g. UserController.list -> list)
|
|
325
|
-
const parts = handlerExpr.split('.');
|
|
326
|
-
const handlerName = parts[parts.length - 1];
|
|
327
|
-
if (handlerName) {
|
|
328
|
-
references.push({
|
|
329
|
-
fromNodeId: routeNode.id,
|
|
330
|
-
referenceName: handlerName,
|
|
331
|
-
referenceKind: 'references',
|
|
332
|
-
line,
|
|
333
|
-
column: 0,
|
|
334
|
-
filePath,
|
|
335
|
-
language: 'swift',
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
return { nodes, references };
|
|
340
|
-
},
|
|
341
|
-
};
|
|
342
|
-
// Directory patterns
|
|
343
|
-
const VIEW_DIRS = ['/Views/', '/View/', '/Screens/', '/Components/', '/UI/'];
|
|
344
|
-
const VIEWMODEL_DIRS = ['/ViewModels/', '/ViewModel/', '/Stores/', '/Managers/', '/Services/'];
|
|
345
|
-
const MODEL_DIRS = ['/Models/', '/Model/', '/Entities/', '/Domain/'];
|
|
346
|
-
const VC_DIRS = ['/ViewControllers/', '/ViewController/', '/Controllers/', '/Screens/'];
|
|
347
|
-
const UIVIEW_DIRS = ['/Views/', '/View/', '/UI/', '/Components/'];
|
|
348
|
-
const CELL_DIRS = ['/Cells/', '/Cell/', '/Views/', '/TableViewCells/', '/CollectionViewCells/'];
|
|
349
|
-
const VAPOR_CONTROLLER_DIRS = ['/Controllers/', '/Controller/', '/Routes/'];
|
|
350
|
-
const FLUENT_MODEL_DIRS = ['/Models/', '/Model/', '/Entities/', '/Database/'];
|
|
351
|
-
const VAPOR_MIDDLEWARE_DIRS = ['/Middleware/', '/Middlewares/'];
|
|
352
|
-
const VIEW_KINDS = new Set(['struct', 'component']);
|
|
353
|
-
const CLASS_KINDS = new Set(['class']);
|
|
354
|
-
const MODEL_KINDS = new Set(['struct', 'class']);
|
|
355
|
-
const PROTOCOL_KINDS = new Set(['protocol']);
|
|
356
|
-
const VAPOR_CONTROLLER_KINDS = new Set(['class', 'struct']);
|
|
357
|
-
/**
|
|
358
|
-
* Resolve a symbol by name using indexed queries instead of scanning all files.
|
|
359
|
-
*/
|
|
360
|
-
function resolveByNameAndKind(name, kinds, preferredDirPatterns, context) {
|
|
361
|
-
const candidates = context.getNodesByName(name);
|
|
362
|
-
if (candidates.length === 0)
|
|
363
|
-
return null;
|
|
364
|
-
const kindFiltered = candidates.filter((n) => kinds.has(n.kind));
|
|
365
|
-
if (kindFiltered.length === 0)
|
|
366
|
-
return null;
|
|
367
|
-
// Prefer candidates in framework-conventional directories
|
|
368
|
-
if (preferredDirPatterns.length > 0) {
|
|
369
|
-
const preferred = kindFiltered.filter((n) => preferredDirPatterns.some((d) => n.filePath.includes(d)));
|
|
370
|
-
if (preferred.length > 0)
|
|
371
|
-
return preferred[0].id;
|
|
372
|
-
}
|
|
373
|
-
// Fall back to any match
|
|
374
|
-
return kindFiltered[0].id;
|
|
375
|
-
}
|
|
376
|
-
//# sourceMappingURL=swift.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vue / Nuxt Framework Resolver
|
|
3
|
-
*
|
|
4
|
-
* Handles Vue component references, compiler macros (defineProps, etc.),
|
|
5
|
-
* Nuxt auto-imports, and Nuxt file-based routing patterns.
|
|
6
|
-
*/
|
|
7
|
-
import { FrameworkResolver } from '../types'
|
|
8
|
-
export declare const vueResolver: FrameworkResolver
|
|
9
|
-
//# sourceMappingURL=vue.d.ts.map
|
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Vue / Nuxt Framework Resolver
|
|
4
|
-
*
|
|
5
|
-
* Handles Vue component references, compiler macros (defineProps, etc.),
|
|
6
|
-
* Nuxt auto-imports, and Nuxt file-based routing patterns.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.vueResolver = void 0;
|
|
10
|
-
/**
|
|
11
|
-
* Vue 3 compiler macros — compiler-provided, not user code
|
|
12
|
-
*/
|
|
13
|
-
const VUE_COMPILER_MACROS = new Set([
|
|
14
|
-
'defineProps',
|
|
15
|
-
'defineEmits',
|
|
16
|
-
'defineExpose',
|
|
17
|
-
'defineOptions',
|
|
18
|
-
'defineSlots',
|
|
19
|
-
'defineModel',
|
|
20
|
-
'withDefaults',
|
|
21
|
-
]);
|
|
22
|
-
/**
|
|
23
|
-
* Nuxt auto-imported composables and utilities
|
|
24
|
-
*/
|
|
25
|
-
const NUXT_AUTO_IMPORTS = new Set([
|
|
26
|
-
// Routing
|
|
27
|
-
'useRoute',
|
|
28
|
-
'useRouter',
|
|
29
|
-
'navigateTo',
|
|
30
|
-
'abortNavigation',
|
|
31
|
-
// Data fetching
|
|
32
|
-
'useFetch',
|
|
33
|
-
'useAsyncData',
|
|
34
|
-
'useLazyFetch',
|
|
35
|
-
'useLazyAsyncData',
|
|
36
|
-
'refreshNuxtData',
|
|
37
|
-
// State
|
|
38
|
-
'useState',
|
|
39
|
-
'clearNuxtState',
|
|
40
|
-
// Head
|
|
41
|
-
'useHead',
|
|
42
|
-
'useSeoMeta',
|
|
43
|
-
'useServerSeoMeta',
|
|
44
|
-
// Runtime
|
|
45
|
-
'useRuntimeConfig',
|
|
46
|
-
'useAppConfig',
|
|
47
|
-
'useNuxtApp',
|
|
48
|
-
// Cookies
|
|
49
|
-
'useCookie',
|
|
50
|
-
// Error
|
|
51
|
-
'useError',
|
|
52
|
-
'createError',
|
|
53
|
-
'showError',
|
|
54
|
-
'clearError',
|
|
55
|
-
// Page/layout
|
|
56
|
-
'definePageMeta',
|
|
57
|
-
'defineNuxtConfig',
|
|
58
|
-
'defineNuxtPlugin',
|
|
59
|
-
'defineNuxtRouteMiddleware',
|
|
60
|
-
// Request
|
|
61
|
-
'useRequestHeaders',
|
|
62
|
-
'useRequestEvent',
|
|
63
|
-
'useRequestFetch',
|
|
64
|
-
'useRequestURL',
|
|
65
|
-
]);
|
|
66
|
-
/**
|
|
67
|
-
* Nuxt virtual module prefixes (auto-import namespaces)
|
|
68
|
-
*/
|
|
69
|
-
const NUXT_VIRTUAL_MODULES = [
|
|
70
|
-
'#imports',
|
|
71
|
-
'#components',
|
|
72
|
-
'#app',
|
|
73
|
-
'#build',
|
|
74
|
-
'#head',
|
|
75
|
-
];
|
|
76
|
-
exports.vueResolver = {
|
|
77
|
-
name: 'vue',
|
|
78
|
-
detect(context) {
|
|
79
|
-
// Check for vue or nuxt in package.json
|
|
80
|
-
const packageJson = context.readFile('package.json');
|
|
81
|
-
if (packageJson) {
|
|
82
|
-
try {
|
|
83
|
-
const pkg = JSON.parse(packageJson);
|
|
84
|
-
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
85
|
-
if (deps.vue || deps.nuxt || deps['@nuxt/kit']) {
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
catch {
|
|
90
|
-
// Invalid JSON
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
// Check for .vue files in project
|
|
94
|
-
const allFiles = context.getAllFiles();
|
|
95
|
-
return allFiles.some((f) => f.endsWith('.vue'));
|
|
96
|
-
},
|
|
97
|
-
resolve(ref, context) {
|
|
98
|
-
// Pattern 1: Vue compiler macros (defineProps, defineEmits, etc.)
|
|
99
|
-
if (VUE_COMPILER_MACROS.has(ref.referenceName)) {
|
|
100
|
-
return {
|
|
101
|
-
original: ref,
|
|
102
|
-
targetNodeId: ref.fromNodeId,
|
|
103
|
-
confidence: 1.0,
|
|
104
|
-
resolvedBy: 'framework',
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
// Pattern 2: Nuxt auto-imported composables
|
|
108
|
-
if (NUXT_AUTO_IMPORTS.has(ref.referenceName)) {
|
|
109
|
-
return {
|
|
110
|
-
original: ref,
|
|
111
|
-
targetNodeId: ref.fromNodeId,
|
|
112
|
-
confidence: 1.0,
|
|
113
|
-
resolvedBy: 'framework',
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
// Pattern 3: Nuxt virtual module imports (#imports, #components, etc.)
|
|
117
|
-
if (ref.referenceKind === 'imports' && ref.referenceName.startsWith('#')) {
|
|
118
|
-
if (NUXT_VIRTUAL_MODULES.some((prefix) => ref.referenceName.startsWith(prefix))) {
|
|
119
|
-
return {
|
|
120
|
-
original: ref,
|
|
121
|
-
targetNodeId: ref.fromNodeId,
|
|
122
|
-
confidence: 1.0,
|
|
123
|
-
resolvedBy: 'framework',
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
// Pattern 4: @ alias imports (@/components/Foo -> src/components/Foo)
|
|
128
|
-
if (ref.referenceKind === 'imports' && ref.referenceName.startsWith('@/')) {
|
|
129
|
-
const aliasPath = ref.referenceName.replace('@/', 'src/');
|
|
130
|
-
for (const ext of ['', '.ts', '.js', '.vue', '/index.ts', '/index.js', '/index.vue']) {
|
|
131
|
-
const fullPath = aliasPath + ext;
|
|
132
|
-
if (context.fileExists(fullPath)) {
|
|
133
|
-
const nodes = context.getNodesInFile(fullPath);
|
|
134
|
-
if (nodes.length > 0) {
|
|
135
|
-
return {
|
|
136
|
-
original: ref,
|
|
137
|
-
targetNodeId: nodes[0].id,
|
|
138
|
-
confidence: 0.9,
|
|
139
|
-
resolvedBy: 'framework',
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
// Pattern 5: ~ alias imports (~/components/Foo -> src/components/Foo, Nuxt convention)
|
|
146
|
-
if (ref.referenceKind === 'imports' && ref.referenceName.startsWith('~/')) {
|
|
147
|
-
const aliasPath = ref.referenceName.replace('~/', 'src/');
|
|
148
|
-
for (const ext of ['', '.ts', '.js', '.vue', '/index.ts', '/index.js', '/index.vue']) {
|
|
149
|
-
const fullPath = aliasPath + ext;
|
|
150
|
-
if (context.fileExists(fullPath)) {
|
|
151
|
-
const nodes = context.getNodesInFile(fullPath);
|
|
152
|
-
if (nodes.length > 0) {
|
|
153
|
-
return {
|
|
154
|
-
original: ref,
|
|
155
|
-
targetNodeId: nodes[0].id,
|
|
156
|
-
confidence: 0.9,
|
|
157
|
-
resolvedBy: 'framework',
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
// Pattern 6: Component references (PascalCase) — resolve to .vue files
|
|
164
|
-
if (isPascalCase(ref.referenceName) && ref.referenceKind === 'calls') {
|
|
165
|
-
const result = resolveComponent(ref.referenceName, ref.filePath, context);
|
|
166
|
-
if (result) {
|
|
167
|
-
return {
|
|
168
|
-
original: ref,
|
|
169
|
-
targetNodeId: result,
|
|
170
|
-
confidence: 0.8,
|
|
171
|
-
resolvedBy: 'framework',
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
return null;
|
|
176
|
-
},
|
|
177
|
-
extract(filePath, _content) {
|
|
178
|
-
const nodes = [];
|
|
179
|
-
const now = Date.now();
|
|
180
|
-
// Normalize to forward slashes
|
|
181
|
-
const normalized = filePath.replace(/\\/g, '/');
|
|
182
|
-
// Detect Nuxt page routes (pages/ directory)
|
|
183
|
-
const pagesIndex = normalized.indexOf('/pages/');
|
|
184
|
-
if (pagesIndex !== -1 && normalized.endsWith('.vue')) {
|
|
185
|
-
const routePath = filePathToNuxtRoute(normalized, pagesIndex + '/pages/'.length);
|
|
186
|
-
if (routePath !== null) {
|
|
187
|
-
nodes.push({
|
|
188
|
-
id: `route:${filePath}:${routePath}:1`,
|
|
189
|
-
kind: 'route',
|
|
190
|
-
name: routePath,
|
|
191
|
-
qualifiedName: `${filePath}::route:${routePath}`,
|
|
192
|
-
filePath,
|
|
193
|
-
startLine: 1,
|
|
194
|
-
endLine: 1,
|
|
195
|
-
startColumn: 0,
|
|
196
|
-
endColumn: 0,
|
|
197
|
-
language: 'vue',
|
|
198
|
-
updatedAt: now,
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
// Detect Nuxt API routes (server/api/ directory)
|
|
203
|
-
const apiIndex = normalized.indexOf('/server/api/');
|
|
204
|
-
if (apiIndex !== -1) {
|
|
205
|
-
const afterApi = normalized.substring(apiIndex + '/server/api/'.length);
|
|
206
|
-
const routeName = afterApi
|
|
207
|
-
.replace(/\.[^/.]+$/, '') // Remove extension
|
|
208
|
-
.replace(/\/index$/, ''); // index -> parent path
|
|
209
|
-
const apiRoute = '/api/' + routeName;
|
|
210
|
-
nodes.push({
|
|
211
|
-
id: `route:${filePath}:${apiRoute}:1`,
|
|
212
|
-
kind: 'route',
|
|
213
|
-
name: apiRoute,
|
|
214
|
-
qualifiedName: `${filePath}::route:${apiRoute}`,
|
|
215
|
-
filePath,
|
|
216
|
-
startLine: 1,
|
|
217
|
-
endLine: 1,
|
|
218
|
-
startColumn: 0,
|
|
219
|
-
endColumn: 0,
|
|
220
|
-
language: normalized.endsWith('.vue') ? 'vue' : 'typescript',
|
|
221
|
-
updatedAt: now,
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
// Detect Nuxt middleware (middleware/ directory)
|
|
225
|
-
const middlewareIndex = normalized.indexOf('/middleware/');
|
|
226
|
-
if (middlewareIndex !== -1) {
|
|
227
|
-
const afterMiddleware = normalized.substring(middlewareIndex + '/middleware/'.length);
|
|
228
|
-
const middlewareName = afterMiddleware.replace(/\.[^/.]+$/, '');
|
|
229
|
-
nodes.push({
|
|
230
|
-
id: `middleware:${filePath}:${middlewareName}:1`,
|
|
231
|
-
kind: 'function',
|
|
232
|
-
name: middlewareName,
|
|
233
|
-
qualifiedName: `${filePath}::middleware:${middlewareName}`,
|
|
234
|
-
filePath,
|
|
235
|
-
startLine: 1,
|
|
236
|
-
endLine: 1,
|
|
237
|
-
startColumn: 0,
|
|
238
|
-
endColumn: 0,
|
|
239
|
-
language: normalized.endsWith('.vue') ? 'vue' : 'typescript',
|
|
240
|
-
updatedAt: now,
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
return { nodes, references: [] };
|
|
244
|
-
},
|
|
245
|
-
};
|
|
246
|
-
/**
|
|
247
|
-
* Check if string is PascalCase
|
|
248
|
-
*/
|
|
249
|
-
function isPascalCase(str) {
|
|
250
|
-
return /^[A-Z][a-zA-Z0-9]*$/.test(str);
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Resolve a Vue component reference to its .vue file
|
|
254
|
-
*/
|
|
255
|
-
function resolveComponent(name, fromFile, context) {
|
|
256
|
-
const allFiles = context.getAllFiles();
|
|
257
|
-
const vueFiles = allFiles.filter((f) => f.endsWith('.vue'));
|
|
258
|
-
// Check for exact name match (Button -> Button.vue)
|
|
259
|
-
for (const file of vueFiles) {
|
|
260
|
-
const fileName = file.split(/[/\\]/).pop() || '';
|
|
261
|
-
const componentName = fileName.replace(/\.vue$/, '');
|
|
262
|
-
if (componentName === name) {
|
|
263
|
-
const nodes = context.getNodesInFile(file);
|
|
264
|
-
const component = nodes.find((n) => n.kind === 'component' && n.name === name);
|
|
265
|
-
if (component) {
|
|
266
|
-
return component.id;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
// Check same directory first for better specificity
|
|
271
|
-
const fromDir = fromFile.substring(0, fromFile.lastIndexOf('/'));
|
|
272
|
-
for (const file of vueFiles) {
|
|
273
|
-
if (file.startsWith(fromDir)) {
|
|
274
|
-
const fileName = file.split(/[/\\]/).pop() || '';
|
|
275
|
-
const componentName = fileName.replace(/\.vue$/, '');
|
|
276
|
-
if (componentName === name) {
|
|
277
|
-
const nodes = context.getNodesInFile(file);
|
|
278
|
-
const component = nodes.find((n) => n.kind === 'component');
|
|
279
|
-
if (component) {
|
|
280
|
-
return component.id;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return null;
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Convert a file path to a Nuxt route path
|
|
289
|
-
*/
|
|
290
|
-
function filePathToNuxtRoute(normalized, afterPagesStart) {
|
|
291
|
-
const afterPages = normalized.substring(afterPagesStart);
|
|
292
|
-
// Remove the .vue extension
|
|
293
|
-
const withoutExt = afterPages.replace(/\.vue$/, '');
|
|
294
|
-
// Remove /index suffix (index.vue -> parent route)
|
|
295
|
-
const withoutIndex = withoutExt.replace(/\/index$/, '');
|
|
296
|
-
// Convert Nuxt param syntax [param] to :param
|
|
297
|
-
let route = '/' + withoutIndex
|
|
298
|
-
.replace(/\[\.\.\.([^\]]+)\]/g, '*$1') // [...slug] -> *slug (catch-all)
|
|
299
|
-
.replace(/\[{2}([^\]]+)\]{2}/g, ':$1?') // [[optional]] -> :optional?
|
|
300
|
-
.replace(/\[([^\]]+)\]/g, ':$1'); // [param] -> :param
|
|
301
|
-
if (route === '/')
|
|
302
|
-
return '/';
|
|
303
|
-
// Remove trailing slash
|
|
304
|
-
return route.replace(/\/$/, '');
|
|
305
|
-
}
|
|
306
|
-
//# sourceMappingURL=vue.js.map
|