@navigate-ai/vite 0.1.23 → 0.1.24
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/ClippyVitePlugin.js +26 -1
- package/package.json +2 -2
package/dist/ClippyVitePlugin.js
CHANGED
|
@@ -13,8 +13,33 @@ function generatePolicyFromFiles(files) {
|
|
|
13
13
|
for (const file of files) {
|
|
14
14
|
graph.addFile(file);
|
|
15
15
|
}
|
|
16
|
-
// Resolve imports
|
|
16
|
+
// Resolve imports and link routes to component files
|
|
17
17
|
linkCrossReferences(graph);
|
|
18
|
+
// Free memory: drop components/jsxTree from files that are not
|
|
19
|
+
// route-defining files or route component targets — we only need
|
|
20
|
+
// those for element extraction in PolicyGenerator.
|
|
21
|
+
const routeFiles = new Set();
|
|
22
|
+
for (const sf of graph.getAllFiles()) {
|
|
23
|
+
if (sf.routes.length > 0)
|
|
24
|
+
routeFiles.add(sf.filePath);
|
|
25
|
+
for (const route of sf.routes) {
|
|
26
|
+
if (route.resolvedComponent) {
|
|
27
|
+
routeFiles.add(route.resolvedComponent.filePath);
|
|
28
|
+
// Also keep files imported by the component (one-level expansion targets)
|
|
29
|
+
for (const candidates of (route.resolvedComponent.imports?.values() ?? [])) {
|
|
30
|
+
for (const candidate of candidates) {
|
|
31
|
+
if (candidate.components.length > 0)
|
|
32
|
+
routeFiles.add(candidate.filePath);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
for (const sf of graph.getAllFiles()) {
|
|
39
|
+
if (!routeFiles.has(sf.filePath)) {
|
|
40
|
+
sf.components = [];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
18
43
|
return new PolicyGenerator(graph).generate();
|
|
19
44
|
}
|
|
20
45
|
export function clippyVitePlugin(options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navigate-ai/vite",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@navigate_ai/plugin-shared": "
|
|
21
|
+
"@navigate_ai/plugin-shared": "^0.1.23"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@babel/parser": "^7.0.0",
|