@rayburst/cli 0.3.1 → 0.3.2
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.
|
@@ -494,31 +494,38 @@ function traceConfigToComponentPaths(configObject, propertyName, projectPath, pr
|
|
|
494
494
|
if (propertyNode.getKind() === SyntaxKind.ShorthandPropertyAssignment) {
|
|
495
495
|
console.log(`[DEBUG traceConfigToComponentPaths] Shorthand property found, tracing identifier`);
|
|
496
496
|
const identifier = propertyNode.getChildrenOfKind(SyntaxKind.Identifier)[0];
|
|
497
|
+
console.log(`[DEBUG traceConfigToComponentPaths] Identifier: ${identifier ? identifier.getText() : "NULL"}`);
|
|
497
498
|
if (identifier) {
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
console.log(`[DEBUG traceConfigToComponentPaths] Found
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
499
|
+
const sourceFile = identifier.getSourceFile();
|
|
500
|
+
const identifierName = identifier.getText();
|
|
501
|
+
console.log(`[DEBUG traceConfigToComponentPaths] Looking for import of: ${identifierName}`);
|
|
502
|
+
const importDecls = sourceFile.getImportDeclarations();
|
|
503
|
+
for (const importDecl of importDecls) {
|
|
504
|
+
const namedImports = importDecl.getNamedImports();
|
|
505
|
+
for (const namedImport of namedImports) {
|
|
506
|
+
if (namedImport.getName() === identifierName) {
|
|
507
|
+
console.log(`[DEBUG traceConfigToComponentPaths] Found import for ${identifierName}!`);
|
|
508
|
+
const importedSourceFile = getImportSourceFile(importDecl);
|
|
509
|
+
if (importedSourceFile) {
|
|
510
|
+
const filePath = importedSourceFile.getFilePath();
|
|
511
|
+
const relativePath = filePath.replace(projectPath + "/", "");
|
|
512
|
+
console.log(`[DEBUG traceConfigToComponentPaths] Found routeTree file: ${relativePath}`);
|
|
513
|
+
const routeFilePaths = extractComponentPathsFromImports(importedSourceFile, projectPath);
|
|
514
|
+
console.log(`[DEBUG traceConfigToComponentPaths] Found ${routeFilePaths.length} route files`);
|
|
515
|
+
const allComponentPaths = [];
|
|
516
|
+
for (const routePath of routeFilePaths) {
|
|
517
|
+
const routeSourceFile = project.getSourceFile(projectPath + "/" + routePath);
|
|
518
|
+
if (!routeSourceFile) {
|
|
519
|
+
console.log(`[DEBUG traceConfigToComponentPaths] Could not load route file: ${routePath}`);
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
console.log(`[DEBUG traceConfigToComponentPaths] Extracting components from route: ${routePath}`);
|
|
523
|
+
const componentPaths = extractComponentsFromRouteFile(routeSourceFile, projectPath);
|
|
524
|
+
console.log(`[DEBUG traceConfigToComponentPaths] Found ${componentPaths.length} components in ${routePath}`);
|
|
525
|
+
allComponentPaths.push(...componentPaths);
|
|
515
526
|
}
|
|
516
|
-
|
|
517
|
-
const componentPaths = extractComponentsFromRouteFile(routeSourceFile, projectPath);
|
|
518
|
-
console.log(`[DEBUG traceConfigToComponentPaths] Found ${componentPaths.length} components in ${routePath}`);
|
|
519
|
-
allComponentPaths.push(...componentPaths);
|
|
527
|
+
return [...routeFilePaths, ...allComponentPaths];
|
|
520
528
|
}
|
|
521
|
-
return [...routeFilePaths, ...allComponentPaths];
|
|
522
529
|
}
|
|
523
530
|
}
|
|
524
531
|
}
|
package/dist/index.js
CHANGED
package/dist/vite-plugin.js
CHANGED