arcvision 0.1.2 → 0.1.3
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/dist/index.js +26 -1
- package/package.json +1 -1
- package/src/core/parser.js +15 -0
- package/src/core/path-resolver.js +12 -0
- package/src/core/tsconfig-utils.js +6 -1
package/dist/index.js
CHANGED
|
@@ -56287,6 +56287,12 @@ var require_parser = __commonJS({
|
|
|
56287
56287
|
});
|
|
56288
56288
|
},
|
|
56289
56289
|
ExportNamedDeclaration({ node }) {
|
|
56290
|
+
if (node.source) {
|
|
56291
|
+
metadata.imports.push({
|
|
56292
|
+
source: node.source.value,
|
|
56293
|
+
specifiers: node.specifiers ? node.specifiers.map((s) => s.exported.name || s.exported.value) : []
|
|
56294
|
+
});
|
|
56295
|
+
}
|
|
56290
56296
|
if (node.declaration) {
|
|
56291
56297
|
if (node.declaration.type === "FunctionDeclaration") {
|
|
56292
56298
|
metadata.exports.push(node.declaration.id.name);
|
|
@@ -56297,6 +56303,12 @@ var require_parser = __commonJS({
|
|
|
56297
56303
|
}
|
|
56298
56304
|
}
|
|
56299
56305
|
},
|
|
56306
|
+
ExportAllDeclaration({ node }) {
|
|
56307
|
+
metadata.imports.push({
|
|
56308
|
+
source: node.source.value,
|
|
56309
|
+
specifiers: ["*"]
|
|
56310
|
+
});
|
|
56311
|
+
},
|
|
56300
56312
|
ExportDefaultDeclaration({ node }) {
|
|
56301
56313
|
metadata.exports.push("default");
|
|
56302
56314
|
},
|
|
@@ -56401,7 +56413,11 @@ var require_tsconfig_utils = __commonJS({
|
|
|
56401
56413
|
for (const tsconfigPath of tsconfigPaths) {
|
|
56402
56414
|
if (fs2.existsSync(tsconfigPath)) {
|
|
56403
56415
|
try {
|
|
56404
|
-
|
|
56416
|
+
let content = fs2.readFileSync(tsconfigPath, "utf-8");
|
|
56417
|
+
if (content.charCodeAt(0) === 65279) {
|
|
56418
|
+
content = content.slice(1);
|
|
56419
|
+
}
|
|
56420
|
+
const raw = JSON.parse(content);
|
|
56405
56421
|
return raw.compilerOptions || {};
|
|
56406
56422
|
} catch (error) {
|
|
56407
56423
|
console.warn(`Warning: Could not parse ${tsconfigPath}:`, error.message);
|
|
@@ -56463,6 +56479,15 @@ var require_path_resolver = __commonJS({
|
|
|
56463
56479
|
const resolved = resolveFile(realPath);
|
|
56464
56480
|
if (resolved)
|
|
56465
56481
|
return resolved;
|
|
56482
|
+
const wildcardPath = importPath + "/*";
|
|
56483
|
+
if (tsconfig.paths && tsconfig.paths[wildcardPath]) {
|
|
56484
|
+
const pathMappings = tsconfig.paths[wildcardPath];
|
|
56485
|
+
if (Array.isArray(pathMappings) && pathMappings.length > 0) {
|
|
56486
|
+
const mappedPath = pathMappings[0].replace("*", "");
|
|
56487
|
+
const realPath2 = path2.resolve(projectRoot, tsconfig.baseUrl || ".", mappedPath);
|
|
56488
|
+
return resolveFile(realPath2);
|
|
56489
|
+
}
|
|
56490
|
+
}
|
|
56466
56491
|
}
|
|
56467
56492
|
if (importPath.startsWith(".")) {
|
|
56468
56493
|
const realPath = path2.resolve(path2.dirname(fromFile), importPath);
|
package/package.json
CHANGED
package/src/core/parser.js
CHANGED
|
@@ -26,6 +26,14 @@ function parseFile(filePath) {
|
|
|
26
26
|
});
|
|
27
27
|
},
|
|
28
28
|
ExportNamedDeclaration({ node }) {
|
|
29
|
+
// Handle export { X, Y, Z } from './file' statements
|
|
30
|
+
if (node.source) {
|
|
31
|
+
metadata.imports.push({
|
|
32
|
+
source: node.source.value,
|
|
33
|
+
specifiers: node.specifiers ? node.specifiers.map(s => s.exported.name || s.exported.value) : []
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
// Handle export declarations without source (local exports)
|
|
29
37
|
if (node.declaration) {
|
|
30
38
|
if (node.declaration.type === 'FunctionDeclaration') {
|
|
31
39
|
metadata.exports.push(node.declaration.id.name);
|
|
@@ -36,6 +44,13 @@ function parseFile(filePath) {
|
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
46
|
},
|
|
47
|
+
ExportAllDeclaration({ node }) {
|
|
48
|
+
// Handle export * from './file' statements
|
|
49
|
+
metadata.imports.push({
|
|
50
|
+
source: node.source.value,
|
|
51
|
+
specifiers: ['*']
|
|
52
|
+
});
|
|
53
|
+
},
|
|
39
54
|
ExportDefaultDeclaration({ node }) {
|
|
40
55
|
metadata.exports.push('default');
|
|
41
56
|
},
|
|
@@ -63,6 +63,18 @@ function resolveImport(importPath, fromFile, projectRoot, tsconfig) {
|
|
|
63
63
|
const realPath = path.resolve(projectRoot, tsconfig.baseUrl, relativePath);
|
|
64
64
|
const resolved = resolveFile(realPath);
|
|
65
65
|
if (resolved) return resolved;
|
|
66
|
+
|
|
67
|
+
// Also try adding '/*' to see if it matches a path mapping pattern
|
|
68
|
+
// e.g., '@/utils' might match '@/utils/*' -> './src/utils/*'
|
|
69
|
+
const wildcardPath = importPath + '/*';
|
|
70
|
+
if (tsconfig.paths && tsconfig.paths[wildcardPath]) {
|
|
71
|
+
const pathMappings = tsconfig.paths[wildcardPath];
|
|
72
|
+
if (Array.isArray(pathMappings) && pathMappings.length > 0) {
|
|
73
|
+
const mappedPath = pathMappings[0].replace('*', '');
|
|
74
|
+
const realPath = path.resolve(projectRoot, tsconfig.baseUrl || '.', mappedPath);
|
|
75
|
+
return resolveFile(realPath);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
66
78
|
}
|
|
67
79
|
|
|
68
80
|
// Handle relative paths (e.g., './utils', '../components')
|
|
@@ -15,7 +15,12 @@ function loadTSConfig(projectRoot) {
|
|
|
15
15
|
for (const tsconfigPath of tsconfigPaths) {
|
|
16
16
|
if (fs.existsSync(tsconfigPath)) {
|
|
17
17
|
try {
|
|
18
|
-
|
|
18
|
+
let content = fs.readFileSync(tsconfigPath, 'utf-8');
|
|
19
|
+
// Remove BOM if present (0xFEFF)
|
|
20
|
+
if (content.charCodeAt(0) === 0xFEFF) {
|
|
21
|
+
content = content.slice(1);
|
|
22
|
+
}
|
|
23
|
+
const raw = JSON.parse(content);
|
|
19
24
|
return raw.compilerOptions || {};
|
|
20
25
|
} catch (error) {
|
|
21
26
|
console.warn(`Warning: Could not parse ${tsconfigPath}:`, error.message);
|