juxscript 1.1.133 → 1.1.135
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 +20 -1
- package/package.json +1 -1
package/dom-structure-map.json
CHANGED
package/machinery/compiler3.js
CHANGED
|
@@ -58,6 +58,7 @@ export class JuxCompiler {
|
|
|
58
58
|
*/
|
|
59
59
|
scanFiles() {
|
|
60
60
|
const views = [], dataModules = [], sharedModules = [];
|
|
61
|
+
const processedNames = new Set(); // Track processed file base names to avoid duplicates
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
64
|
* Recursive directory scanner
|
|
@@ -80,6 +81,13 @@ export class JuxCompiler {
|
|
|
80
81
|
const relativePath = path.relative(this.srcDir, fullPath);
|
|
81
82
|
const name = relativePath.replace(/\.[^/.]+$/, ''); // Remove extension
|
|
82
83
|
|
|
84
|
+
// ✅ Skip if we've already processed this base name (avoid .jux + .js duplicates)
|
|
85
|
+
if (processedNames.has(name)) {
|
|
86
|
+
console.warn(`⚠️ Skipping duplicate: ${relativePath} (already processed ${name})`);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
processedNames.add(name);
|
|
90
|
+
|
|
83
91
|
if (file.includes('data')) {
|
|
84
92
|
dataModules.push({ name, file: relativePath, content });
|
|
85
93
|
} else if (/export\s+(function|const|let|var|class)\s+/.test(content)) {
|
|
@@ -503,11 +511,22 @@ document.addEventListener('click', (e) => {
|
|
|
503
511
|
// Copy data/shared modules to dist
|
|
504
512
|
const juxDistDir = path.join(this.distDir, 'jux');
|
|
505
513
|
fs.mkdirSync(juxDistDir, { recursive: true });
|
|
514
|
+
|
|
515
|
+
// ✅ FIX: Create subdirectories and copy files
|
|
506
516
|
[...dataModules, ...sharedModules].forEach(m => {
|
|
507
|
-
|
|
517
|
+
const destPath = path.join(juxDistDir, m.file);
|
|
518
|
+
const destDir = path.dirname(destPath);
|
|
519
|
+
|
|
520
|
+
// Create subdirectory if it doesn't exist
|
|
521
|
+
if (!fs.existsSync(destDir)) {
|
|
522
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
fs.writeFileSync(destPath, m.content);
|
|
508
526
|
});
|
|
509
527
|
|
|
510
528
|
const entryContent = this.generateEntryPoint(views, dataModules, sharedModules);
|
|
529
|
+
|
|
511
530
|
const entryPath = path.join(this.distDir, 'entry.js');
|
|
512
531
|
fs.writeFileSync(entryPath, entryContent);
|
|
513
532
|
|