juxscript 1.1.120 → 1.1.121
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/dom-structure-map.json +1 -1
- package/machinery/compiler3.js +37 -14
- package/package.json +1 -1
package/dom-structure-map.json
CHANGED
package/machinery/compiler3.js
CHANGED
|
@@ -53,24 +53,47 @@ export class JuxCompiler {
|
|
|
53
53
|
return null;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* ✅ Recursively scan for .jux and .js files in srcDir and subdirectories
|
|
58
|
+
*/
|
|
56
59
|
scanFiles() {
|
|
57
|
-
const files = fs.readdirSync(this.srcDir)
|
|
58
|
-
.filter(f => (f.endsWith('.jux') || f.endsWith('.js')) && !this.isAssetFile(f));
|
|
59
|
-
|
|
60
60
|
const views = [], dataModules = [], sharedModules = [];
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Recursive directory scanner
|
|
64
|
+
*/
|
|
65
|
+
const scanDirectory = (currentDir) => {
|
|
66
|
+
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
67
|
+
|
|
68
|
+
for (const entry of entries) {
|
|
69
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
70
|
+
|
|
71
|
+
if (entry.isDirectory()) {
|
|
72
|
+
// ✅ Recurse into subdirectories
|
|
73
|
+
scanDirectory(fullPath);
|
|
74
|
+
} else if (entry.isFile()) {
|
|
75
|
+
const file = entry.name;
|
|
76
|
+
|
|
77
|
+
// ✅ Only process .jux and .js files (skip assets)
|
|
78
|
+
if ((file.endsWith('.jux') || file.endsWith('.js')) && !this.isAssetFile(file)) {
|
|
79
|
+
const content = fs.readFileSync(fullPath, 'utf8');
|
|
80
|
+
const relativePath = path.relative(this.srcDir, fullPath);
|
|
81
|
+
const name = relativePath.replace(/\.[^/.]+$/, ''); // Remove extension
|
|
82
|
+
|
|
83
|
+
if (file.includes('data')) {
|
|
84
|
+
dataModules.push({ name, file: relativePath, content });
|
|
85
|
+
} else if (/export\s+(function|const|let|var|class)\s+/.test(content)) {
|
|
86
|
+
sharedModules.push({ name, file: relativePath, content });
|
|
87
|
+
} else {
|
|
88
|
+
views.push({ name, file: relativePath, content });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
72
92
|
}
|
|
73
|
-
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// ✅ Start recursive scan from srcDir
|
|
96
|
+
scanDirectory(this.srcDir);
|
|
74
97
|
|
|
75
98
|
return { views, dataModules, sharedModules };
|
|
76
99
|
}
|