@veraxhq/verax 0.2.0 → 0.3.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/README.md +14 -18
- package/bin/verax.js +7 -0
- package/package.json +15 -5
- package/src/cli/commands/baseline.js +104 -0
- package/src/cli/commands/default.js +323 -111
- package/src/cli/commands/doctor.js +36 -4
- package/src/cli/commands/ga.js +243 -0
- package/src/cli/commands/gates.js +95 -0
- package/src/cli/commands/inspect.js +131 -2
- package/src/cli/commands/release-check.js +213 -0
- package/src/cli/commands/run.js +498 -103
- package/src/cli/commands/security-check.js +211 -0
- package/src/cli/commands/truth.js +114 -0
- package/src/cli/entry.js +305 -68
- package/src/cli/util/angular-component-extractor.js +179 -0
- package/src/cli/util/angular-navigation-detector.js +141 -0
- package/src/cli/util/angular-network-detector.js +161 -0
- package/src/cli/util/angular-state-detector.js +162 -0
- package/src/cli/util/ast-interactive-detector.js +546 -0
- package/src/cli/util/ast-network-detector.js +603 -0
- package/src/cli/util/ast-usestate-detector.js +602 -0
- package/src/cli/util/bootstrap-guard.js +86 -0
- package/src/cli/util/detection-engine.js +4 -3
- package/src/cli/util/determinism-runner.js +123 -0
- package/src/cli/util/determinism-writer.js +129 -0
- package/src/cli/util/env-url.js +4 -0
- package/src/cli/util/events.js +76 -0
- package/src/cli/util/expectation-extractor.js +380 -74
- package/src/cli/util/findings-writer.js +126 -15
- package/src/cli/util/learn-writer.js +3 -1
- package/src/cli/util/observation-engine.js +69 -23
- package/src/cli/util/observe-writer.js +3 -1
- package/src/cli/util/paths.js +6 -14
- package/src/cli/util/project-discovery.js +23 -0
- package/src/cli/util/project-writer.js +3 -1
- package/src/cli/util/redact.js +2 -2
- package/src/cli/util/run-resolver.js +64 -0
- package/src/cli/util/runtime-budget.js +147 -0
- package/src/cli/util/source-requirement.js +55 -0
- package/src/cli/util/summary-writer.js +13 -1
- package/src/cli/util/svelte-navigation-detector.js +163 -0
- package/src/cli/util/svelte-network-detector.js +80 -0
- package/src/cli/util/svelte-sfc-extractor.js +147 -0
- package/src/cli/util/svelte-state-detector.js +243 -0
- package/src/cli/util/vue-navigation-detector.js +177 -0
- package/src/cli/util/vue-sfc-extractor.js +162 -0
- package/src/cli/util/vue-state-detector.js +215 -0
- package/src/types/global.d.ts +28 -0
- package/src/types/ts-ast.d.ts +24 -0
- package/src/verax/cli/doctor.js +2 -2
- package/src/verax/cli/finding-explainer.js +56 -3
- package/src/verax/cli/init.js +1 -1
- package/src/verax/cli/url-safety.js +12 -2
- package/src/verax/cli/wizard.js +13 -2
- package/src/verax/core/artifacts/registry.js +154 -0
- package/src/verax/core/artifacts/verifier.js +980 -0
- package/src/verax/core/baseline/baseline.enforcer.js +137 -0
- package/src/verax/core/baseline/baseline.snapshot.js +231 -0
- package/src/verax/core/budget-engine.js +1 -1
- package/src/verax/core/capabilities/gates.js +499 -0
- package/src/verax/core/capabilities/registry.js +475 -0
- package/src/verax/core/confidence/confidence-compute.js +137 -0
- package/src/verax/core/confidence/confidence-invariants.js +234 -0
- package/src/verax/core/confidence/confidence-report-writer.js +112 -0
- package/src/verax/core/confidence/confidence-weights.js +44 -0
- package/src/verax/core/confidence/confidence.defaults.js +65 -0
- package/src/verax/core/confidence/confidence.loader.js +79 -0
- package/src/verax/core/confidence/confidence.schema.js +94 -0
- package/src/verax/core/confidence-engine-refactor.js +484 -0
- package/src/verax/core/confidence-engine.js +486 -0
- package/src/verax/core/confidence-engine.js.backup +471 -0
- package/src/verax/core/contracts/index.js +29 -0
- package/src/verax/core/contracts/types.js +185 -0
- package/src/verax/core/contracts/validators.js +381 -0
- package/src/verax/core/decision-snapshot.js +31 -4
- package/src/verax/core/decisions/decision.trace.js +276 -0
- package/src/verax/core/determinism/contract-writer.js +89 -0
- package/src/verax/core/determinism/contract.js +139 -0
- package/src/verax/core/determinism/diff.js +364 -0
- package/src/verax/core/determinism/engine.js +221 -0
- package/src/verax/core/determinism/finding-identity.js +148 -0
- package/src/verax/core/determinism/normalize.js +438 -0
- package/src/verax/core/determinism/report-writer.js +92 -0
- package/src/verax/core/determinism/run-fingerprint.js +118 -0
- package/src/verax/core/determinism-model.js +35 -6
- package/src/verax/core/dynamic-route-intelligence.js +528 -0
- package/src/verax/core/evidence/evidence-capture-service.js +307 -0
- package/src/verax/core/evidence/evidence-intent-ledger.js +165 -0
- package/src/verax/core/evidence-builder.js +487 -0
- package/src/verax/core/execution-mode-context.js +77 -0
- package/src/verax/core/execution-mode-detector.js +190 -0
- package/src/verax/core/failures/exit-codes.js +86 -0
- package/src/verax/core/failures/failure-summary.js +76 -0
- package/src/verax/core/failures/failure.factory.js +225 -0
- package/src/verax/core/failures/failure.ledger.js +132 -0
- package/src/verax/core/failures/failure.types.js +196 -0
- package/src/verax/core/failures/index.js +10 -0
- package/src/verax/core/ga/ga-report-writer.js +43 -0
- package/src/verax/core/ga/ga.artifact.js +49 -0
- package/src/verax/core/ga/ga.contract.js +434 -0
- package/src/verax/core/ga/ga.enforcer.js +86 -0
- package/src/verax/core/guardrails/guardrails-report-writer.js +109 -0
- package/src/verax/core/guardrails/policy.defaults.js +210 -0
- package/src/verax/core/guardrails/policy.loader.js +83 -0
- package/src/verax/core/guardrails/policy.schema.js +110 -0
- package/src/verax/core/guardrails/truth-reconciliation.js +136 -0
- package/src/verax/core/guardrails-engine.js +505 -0
- package/src/verax/core/incremental-store.js +15 -7
- package/src/verax/core/observe/run-timeline.js +316 -0
- package/src/verax/core/perf/perf.contract.js +186 -0
- package/src/verax/core/perf/perf.display.js +65 -0
- package/src/verax/core/perf/perf.enforcer.js +91 -0
- package/src/verax/core/perf/perf.monitor.js +209 -0
- package/src/verax/core/perf/perf.report.js +198 -0
- package/src/verax/core/pipeline-tracker.js +238 -0
- package/src/verax/core/product-definition.js +127 -0
- package/src/verax/core/release/provenance.builder.js +271 -0
- package/src/verax/core/release/release-report-writer.js +40 -0
- package/src/verax/core/release/release.enforcer.js +159 -0
- package/src/verax/core/release/reproducibility.check.js +221 -0
- package/src/verax/core/release/sbom.builder.js +283 -0
- package/src/verax/core/replay-validator.js +4 -4
- package/src/verax/core/replay.js +1 -1
- package/src/verax/core/report/cross-index.js +192 -0
- package/src/verax/core/report/human-summary.js +222 -0
- package/src/verax/core/route-intelligence.js +419 -0
- package/src/verax/core/security/secrets.scan.js +326 -0
- package/src/verax/core/security/security-report.js +50 -0
- package/src/verax/core/security/security.enforcer.js +124 -0
- package/src/verax/core/security/supplychain.defaults.json +38 -0
- package/src/verax/core/security/supplychain.policy.js +326 -0
- package/src/verax/core/security/vuln.scan.js +265 -0
- package/src/verax/core/silence-impact.js +1 -1
- package/src/verax/core/silence-model.js +9 -7
- package/src/verax/core/truth/truth.certificate.js +250 -0
- package/src/verax/core/ui-feedback-intelligence.js +515 -0
- package/src/verax/detect/comparison.js +8 -3
- package/src/verax/detect/confidence-engine.js +645 -57
- package/src/verax/detect/confidence-helper.js +33 -0
- package/src/verax/detect/detection-engine.js +19 -2
- package/src/verax/detect/dynamic-route-findings.js +335 -0
- package/src/verax/detect/evidence-index.js +15 -65
- package/src/verax/detect/expectation-chain-detector.js +417 -0
- package/src/verax/detect/expectation-model.js +56 -3
- package/src/verax/detect/explanation-helpers.js +1 -1
- package/src/verax/detect/finding-detector.js +2 -2
- package/src/verax/detect/findings-writer.js +149 -20
- package/src/verax/detect/flow-detector.js +4 -4
- package/src/verax/detect/index.js +265 -15
- package/src/verax/detect/interactive-findings.js +3 -4
- package/src/verax/detect/journey-stall-detector.js +558 -0
- package/src/verax/detect/route-findings.js +218 -0
- package/src/verax/detect/signal-mapper.js +2 -2
- package/src/verax/detect/skip-classifier.js +4 -4
- package/src/verax/detect/ui-feedback-findings.js +207 -0
- package/src/verax/detect/verdict-engine.js +61 -9
- package/src/verax/detect/view-switch-correlator.js +242 -0
- package/src/verax/flow/flow-engine.js +3 -2
- package/src/verax/flow/flow-spec.js +1 -2
- package/src/verax/index.js +413 -33
- package/src/verax/intel/effect-detector.js +1 -1
- package/src/verax/intel/index.js +2 -2
- package/src/verax/intel/route-extractor.js +3 -3
- package/src/verax/intel/vue-navigation-extractor.js +81 -18
- package/src/verax/intel/vue-router-extractor.js +4 -2
- package/src/verax/learn/action-contract-extractor.js +684 -66
- package/src/verax/learn/ast-contract-extractor.js +53 -1
- package/src/verax/learn/index.js +36 -2
- package/src/verax/learn/manifest-writer.js +28 -14
- package/src/verax/learn/route-extractor.js +1 -1
- package/src/verax/learn/route-validator.js +12 -8
- package/src/verax/learn/state-extractor.js +1 -1
- package/src/verax/learn/static-extractor-navigation.js +1 -1
- package/src/verax/learn/static-extractor-validation.js +2 -2
- package/src/verax/learn/static-extractor.js +8 -7
- package/src/verax/learn/ts-contract-resolver.js +14 -12
- package/src/verax/observe/browser.js +22 -3
- package/src/verax/observe/console-sensor.js +2 -2
- package/src/verax/observe/expectation-executor.js +2 -1
- package/src/verax/observe/focus-sensor.js +1 -1
- package/src/verax/observe/human-driver.js +29 -10
- package/src/verax/observe/index.js +92 -844
- package/src/verax/observe/interaction-discovery.js +27 -15
- package/src/verax/observe/interaction-runner.js +31 -14
- package/src/verax/observe/loading-sensor.js +6 -0
- package/src/verax/observe/navigation-sensor.js +1 -1
- package/src/verax/observe/observe-context.js +205 -0
- package/src/verax/observe/observe-helpers.js +191 -0
- package/src/verax/observe/observe-runner.js +226 -0
- package/src/verax/observe/observers/budget-observer.js +185 -0
- package/src/verax/observe/observers/console-observer.js +102 -0
- package/src/verax/observe/observers/coverage-observer.js +107 -0
- package/src/verax/observe/observers/interaction-observer.js +471 -0
- package/src/verax/observe/observers/navigation-observer.js +132 -0
- package/src/verax/observe/observers/network-observer.js +87 -0
- package/src/verax/observe/observers/safety-observer.js +82 -0
- package/src/verax/observe/observers/ui-feedback-observer.js +99 -0
- package/src/verax/observe/settle.js +1 -0
- package/src/verax/observe/state-sensor.js +8 -4
- package/src/verax/observe/state-ui-sensor.js +7 -1
- package/src/verax/observe/traces-writer.js +27 -16
- package/src/verax/observe/ui-feedback-detector.js +742 -0
- package/src/verax/observe/ui-signal-sensor.js +155 -2
- package/src/verax/scan-summary-writer.js +46 -9
- package/src/verax/shared/artifact-manager.js +9 -6
- package/src/verax/shared/budget-profiles.js +2 -2
- package/src/verax/shared/caching.js +1 -1
- package/src/verax/shared/config-loader.js +1 -2
- package/src/verax/shared/css-spinner-rules.js +204 -0
- package/src/verax/shared/dynamic-route-utils.js +12 -6
- package/src/verax/shared/retry-policy.js +1 -6
- package/src/verax/shared/root-artifacts.js +1 -1
- package/src/verax/shared/view-switch-rules.js +208 -0
- package/src/verax/shared/zip-artifacts.js +1 -0
- package/src/verax/validate/context-validator.js +1 -1
- package/src/verax/observe/index.js.backup +0 -1
- package/src/verax/validate/context-validator.js.bak +0 -0
|
@@ -11,24 +11,29 @@
|
|
|
11
11
|
import ts from 'typescript';
|
|
12
12
|
import { parseFile, findNodes, getStringLiteral, getNodeLocation } from './ts-program.js';
|
|
13
13
|
import { readFileSync, existsSync } from 'fs';
|
|
14
|
-
import { resolve, extname } from 'path';
|
|
14
|
+
import { resolve, extname, relative } from 'path';
|
|
15
|
+
import { globSync } from 'glob';
|
|
15
16
|
import { normalizeDynamicRoute, normalizeTemplateLiteral } from '../shared/dynamic-route-utils.js';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Extract navigation promises from Vue components.
|
|
19
20
|
*
|
|
20
|
-
* @param {Object}
|
|
21
|
-
* @param {string}
|
|
22
|
-
* @returns {
|
|
21
|
+
* @param {Object|string} programOrProjectRoot - TypeScript program object or project root path
|
|
22
|
+
* @param {string|Object} [maybeProjectRoot] - Project root string or program object (supports both call signatures)
|
|
23
|
+
* @returns {Array} - Array of navigation expectation objects
|
|
23
24
|
*/
|
|
24
|
-
export
|
|
25
|
-
|
|
25
|
+
export function extractVueNavigationPromises(programOrProjectRoot, maybeProjectRoot) {
|
|
26
|
+
// Accept both (program, projectRoot) and (projectRoot, program) call signatures
|
|
27
|
+
const program = programOrProjectRoot && programOrProjectRoot.program ? programOrProjectRoot : maybeProjectRoot;
|
|
28
|
+
const projectRoot = programOrProjectRoot && programOrProjectRoot.program ? (maybeProjectRoot || process.cwd()) : programOrProjectRoot;
|
|
26
29
|
|
|
27
|
-
if (!program || !program.program) return
|
|
30
|
+
if (!program || !program.program || !projectRoot) return [];
|
|
31
|
+
const expectations = [];
|
|
28
32
|
|
|
29
33
|
// Find Vue component files (.vue, .ts, .js, .tsx, .jsx)
|
|
30
34
|
const vueFiles = [];
|
|
31
|
-
const
|
|
35
|
+
const tsProgram = program.program || program;
|
|
36
|
+
const sourceFiles = tsProgram.getSourceFiles ? tsProgram.getSourceFiles() : (program.sourceFiles || []);
|
|
32
37
|
|
|
33
38
|
for (const sourceFile of sourceFiles) {
|
|
34
39
|
// sourceFiles can be either file paths (strings) or SourceFile objects
|
|
@@ -42,11 +47,9 @@ export async function extractVueNavigationPromises(program, projectRoot) {
|
|
|
42
47
|
|
|
43
48
|
// Also explicitly glob for .vue files since TypeScript might not include them
|
|
44
49
|
try {
|
|
45
|
-
const {
|
|
46
|
-
const vueGlobPattern = resolve(projectRoot, '**/*.vue');
|
|
47
|
-
const vueFilesFromGlob = await glob(vueGlobPattern, { cwd: projectRoot });
|
|
50
|
+
const vueFilesFromGlob = globSync('**/*.vue', { cwd: projectRoot, absolute: true, nodir: true });
|
|
48
51
|
for (const filePath of vueFilesFromGlob) {
|
|
49
|
-
const absPath = resolve(
|
|
52
|
+
const absPath = resolve(filePath);
|
|
50
53
|
if (!vueFiles.includes(absPath) && !vueFiles.find(f => f.endsWith(filePath))) {
|
|
51
54
|
vueFiles.push(absPath);
|
|
52
55
|
}
|
|
@@ -68,16 +71,54 @@ export async function extractVueNavigationPromises(program, projectRoot) {
|
|
|
68
71
|
*
|
|
69
72
|
* @param {string} filePath - File path
|
|
70
73
|
* @param {string} projectRoot - Project root
|
|
71
|
-
* @param {Object} program - TypeScript program
|
|
72
74
|
* @returns {Array} - Navigation expectations
|
|
73
75
|
*/
|
|
74
|
-
function extractFromFile(filePath, projectRoot,
|
|
76
|
+
function extractFromFile(filePath, projectRoot, _program) {
|
|
75
77
|
const expectations = [];
|
|
76
78
|
|
|
77
79
|
// Check if it's a .vue file (SFC)
|
|
78
80
|
if (extname(filePath) === '.vue') {
|
|
79
81
|
const sfcExpectations = extractFromVueSFC(filePath, projectRoot);
|
|
80
82
|
expectations.push(...sfcExpectations);
|
|
83
|
+
|
|
84
|
+
// For .vue files, also parse the script section as AST
|
|
85
|
+
// to handle template literals and complex navigation calls
|
|
86
|
+
try {
|
|
87
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
88
|
+
const scriptMatch = content.match(/<script[^>]*>([\s\S]*?)<\/script>/);
|
|
89
|
+
if (scriptMatch) {
|
|
90
|
+
const scriptContent = scriptMatch[1];
|
|
91
|
+
// Parse script content as TypeScript/JavaScript
|
|
92
|
+
const ast = ts.createSourceFile(
|
|
93
|
+
filePath,
|
|
94
|
+
scriptContent,
|
|
95
|
+
ts.ScriptTarget.Latest,
|
|
96
|
+
true,
|
|
97
|
+
ts.ScriptKind.TS
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
// Extract router.push/replace calls
|
|
101
|
+
const routerCalls = findRouterCalls(ast);
|
|
102
|
+
for (const call of routerCalls) {
|
|
103
|
+
const expectation = extractFromRouterCall(call, ast, projectRoot, filePath);
|
|
104
|
+
if (expectation) {
|
|
105
|
+
// Check for duplicates (might already be extracted by regex)
|
|
106
|
+
const isDupe = expectations.some(e =>
|
|
107
|
+
e.targetPath === expectation.targetPath &&
|
|
108
|
+
e.navigationMethod === expectation.navigationMethod &&
|
|
109
|
+
e.sourceRef === expectation.sourceRef
|
|
110
|
+
);
|
|
111
|
+
if (!isDupe) {
|
|
112
|
+
expectations.push(expectation);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} catch (err) {
|
|
118
|
+
// If script parsing fails, fall back to regex-based extraction (already done)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return expectations;
|
|
81
122
|
}
|
|
82
123
|
|
|
83
124
|
// Extract from script section (TypeScript/JavaScript)
|
|
@@ -114,7 +155,6 @@ function extractFromFile(filePath, projectRoot, program) {
|
|
|
114
155
|
*/
|
|
115
156
|
function extractFromVueSFC(filePath, projectRoot) {
|
|
116
157
|
const expectations = [];
|
|
117
|
-
const { relative } = require('path');
|
|
118
158
|
|
|
119
159
|
if (!existsSync(filePath)) return expectations;
|
|
120
160
|
|
|
@@ -141,8 +181,10 @@ function extractFromVueSFC(filePath, projectRoot) {
|
|
|
141
181
|
type: 'spa_navigation',
|
|
142
182
|
targetPath: normalized.examplePath,
|
|
143
183
|
originalPattern: normalized.originalPattern,
|
|
184
|
+
originalTarget: normalized.originalPattern,
|
|
144
185
|
isDynamic: true,
|
|
145
186
|
exampleExecution: true,
|
|
187
|
+
parameters: normalized.parameters || [],
|
|
146
188
|
matchAttribute: 'to',
|
|
147
189
|
proof: 'PROVEN_EXPECTATION',
|
|
148
190
|
sourceRef: `${relative(projectRoot, filePath).replace(/\\/g, '/')}:${line}`,
|
|
@@ -186,8 +228,10 @@ function extractFromVueSFC(filePath, projectRoot) {
|
|
|
186
228
|
type: 'spa_navigation',
|
|
187
229
|
targetPath: normalized.examplePath,
|
|
188
230
|
originalPattern: normalized.originalPattern,
|
|
231
|
+
originalTarget: normalized.originalPattern,
|
|
189
232
|
isDynamic: true,
|
|
190
233
|
exampleExecution: true,
|
|
234
|
+
parameters: normalized.parameters || [],
|
|
191
235
|
matchAttribute: 'to',
|
|
192
236
|
proof: 'PROVEN_EXPECTATION',
|
|
193
237
|
sourceRef: `${relative(projectRoot, filePath).replace(/\\/g, '/')}:${line}`,
|
|
@@ -223,6 +267,7 @@ function extractFromVueSFC(filePath, projectRoot) {
|
|
|
223
267
|
if (scriptMatch) {
|
|
224
268
|
const scriptContent = scriptMatch[1];
|
|
225
269
|
const routerPushRegex = /router\.(push|replace)\s*\(\s*["']([^"']+)["']\s*\)/g;
|
|
270
|
+
let match;
|
|
226
271
|
while ((match = routerPushRegex.exec(scriptContent)) !== null) {
|
|
227
272
|
const method = match[1];
|
|
228
273
|
const path = match[2];
|
|
@@ -236,8 +281,10 @@ function extractFromVueSFC(filePath, projectRoot) {
|
|
|
236
281
|
type: 'spa_navigation',
|
|
237
282
|
targetPath: normalized.examplePath,
|
|
238
283
|
originalPattern: normalized.originalPattern,
|
|
284
|
+
originalTarget: normalized.originalPattern,
|
|
239
285
|
isDynamic: true,
|
|
240
286
|
exampleExecution: true,
|
|
287
|
+
parameters: normalized.parameters || [],
|
|
241
288
|
navigationMethod: method,
|
|
242
289
|
proof: 'PROVEN_EXPECTATION',
|
|
243
290
|
sourceRef: `${relative(projectRoot, filePath).replace(/\\/g, '/')}:${line}`,
|
|
@@ -283,7 +330,7 @@ function extractFromVueSFC(filePath, projectRoot) {
|
|
|
283
330
|
* @returns {Array} - Call expression nodes
|
|
284
331
|
*/
|
|
285
332
|
function findRouterCalls(ast) {
|
|
286
|
-
const
|
|
333
|
+
const _calls = [];
|
|
287
334
|
|
|
288
335
|
const callExpressions = findNodes(ast, node => {
|
|
289
336
|
if (!ts.isCallExpression(node)) return false;
|
|
@@ -307,9 +354,10 @@ function findRouterCalls(ast) {
|
|
|
307
354
|
* @param {ts.CallExpression} call - Call expression
|
|
308
355
|
* @param {ts.SourceFile} ast - Source file
|
|
309
356
|
* @param {string} projectRoot - Project root
|
|
357
|
+
* @param {string} [filePathOverride] - Optional file path override for .vue files
|
|
310
358
|
* @returns {Object|null} - Expectation or null
|
|
311
359
|
*/
|
|
312
|
-
function extractFromRouterCall(call, ast, projectRoot) {
|
|
360
|
+
function extractFromRouterCall(call, ast, projectRoot, filePathOverride = null) {
|
|
313
361
|
const expr = call.expression;
|
|
314
362
|
if (!ts.isPropertyAccessExpression(expr)) return null;
|
|
315
363
|
|
|
@@ -321,6 +369,13 @@ function extractFromRouterCall(call, ast, projectRoot) {
|
|
|
321
369
|
const arg = call.arguments[0];
|
|
322
370
|
const location = getNodeLocation(ast, call, projectRoot);
|
|
323
371
|
|
|
372
|
+
// Override file path if provided (for .vue files)
|
|
373
|
+
if (filePathOverride) {
|
|
374
|
+
const relativePath = relative(projectRoot, filePathOverride);
|
|
375
|
+
location.file = relativePath.replace(/\\/g, '/');
|
|
376
|
+
location.sourceRef = `${relativePath.replace(/\\/g, '/')}:${location.line}`;
|
|
377
|
+
}
|
|
378
|
+
|
|
324
379
|
// String literal: router.push('/path')
|
|
325
380
|
const path = getStringLiteral(arg);
|
|
326
381
|
if (path && path.startsWith('/')) {
|
|
@@ -331,8 +386,10 @@ function extractFromRouterCall(call, ast, projectRoot) {
|
|
|
331
386
|
type: 'spa_navigation',
|
|
332
387
|
targetPath: normalized.examplePath,
|
|
333
388
|
originalPattern: normalized.originalPattern,
|
|
389
|
+
originalTarget: normalized.originalPattern,
|
|
334
390
|
isDynamic: true,
|
|
335
391
|
exampleExecution: true,
|
|
392
|
+
parameters: normalized.parameters || [],
|
|
336
393
|
navigationMethod: method,
|
|
337
394
|
proof: 'PROVEN_EXPECTATION',
|
|
338
395
|
sourceRef: location.sourceRef,
|
|
@@ -391,8 +448,10 @@ function extractFromRouterCall(call, ast, projectRoot) {
|
|
|
391
448
|
type: 'spa_navigation',
|
|
392
449
|
targetPath: normalized.examplePath,
|
|
393
450
|
originalPattern: normalized.originalPattern,
|
|
451
|
+
originalTarget: normalized.originalPattern,
|
|
394
452
|
isDynamic: true,
|
|
395
453
|
exampleExecution: true,
|
|
454
|
+
parameters: normalized.parameters || [],
|
|
396
455
|
navigationMethod: method,
|
|
397
456
|
proof: 'PROVEN_EXPECTATION',
|
|
398
457
|
sourceRef: location.sourceRef,
|
|
@@ -425,8 +484,10 @@ function extractFromRouterCall(call, ast, projectRoot) {
|
|
|
425
484
|
type: 'spa_navigation',
|
|
426
485
|
targetPath: normalized.examplePath,
|
|
427
486
|
originalPattern: normalized.originalPattern,
|
|
487
|
+
originalTarget: normalized.originalPattern,
|
|
428
488
|
isDynamic: true,
|
|
429
489
|
exampleExecution: true,
|
|
490
|
+
parameters: normalized.parameters || [],
|
|
430
491
|
navigationMethod: method,
|
|
431
492
|
proof: 'PROVEN_EXPECTATION',
|
|
432
493
|
sourceRef: location.sourceRef,
|
|
@@ -468,7 +529,7 @@ function extractFromRouterCall(call, ast, projectRoot) {
|
|
|
468
529
|
* @returns {Array} - JSX element nodes
|
|
469
530
|
*/
|
|
470
531
|
function findRouterLinkElements(ast) {
|
|
471
|
-
const
|
|
532
|
+
const _elements = [];
|
|
472
533
|
|
|
473
534
|
const jsxElements = findNodes(ast, node => {
|
|
474
535
|
if (!ts.isJsxOpeningElement(node) && !ts.isJsxSelfClosingElement(node)) return false;
|
|
@@ -545,8 +606,10 @@ function extractFromRouterLink(element, ast, projectRoot) {
|
|
|
545
606
|
type: 'spa_navigation',
|
|
546
607
|
targetPath: normalized.examplePath,
|
|
547
608
|
originalPattern: normalized.originalPattern,
|
|
609
|
+
originalTarget: normalized.originalPattern,
|
|
548
610
|
isDynamic: true,
|
|
549
611
|
exampleExecution: true,
|
|
612
|
+
parameters: normalized.parameters || [],
|
|
550
613
|
matchAttribute: 'to',
|
|
551
614
|
proof: 'PROVEN_EXPECTATION',
|
|
552
615
|
sourceRef: location.sourceRef,
|
|
@@ -298,7 +298,8 @@ function extractRouteFromObject(objNode, ast, projectRoot, parentPath) {
|
|
|
298
298
|
file: location.file,
|
|
299
299
|
line: location.line,
|
|
300
300
|
framework: 'vue-router',
|
|
301
|
-
public: !isInternalRoute(normalized.examplePath)
|
|
301
|
+
public: !isInternalRoute(normalized.examplePath),
|
|
302
|
+
children: null // Will be set below if children exist
|
|
302
303
|
};
|
|
303
304
|
} else {
|
|
304
305
|
// Static route
|
|
@@ -308,7 +309,8 @@ function extractRouteFromObject(objNode, ast, projectRoot, parentPath) {
|
|
|
308
309
|
file: location.file,
|
|
309
310
|
line: location.line,
|
|
310
311
|
framework: 'vue-router',
|
|
311
|
-
public: !isInternalRoute(fullPath)
|
|
312
|
+
public: !isInternalRoute(fullPath),
|
|
313
|
+
children: null // Will be set below if children exist
|
|
312
314
|
};
|
|
313
315
|
}
|
|
314
316
|
|