juxscript 1.1.95 → 1.1.97
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 +61 -2
- package/package.json +1 -1
package/dom-structure-map.json
CHANGED
package/machinery/compiler3.js
CHANGED
|
@@ -490,7 +490,57 @@ navigate(location.pathname);
|
|
|
490
490
|
}
|
|
491
491
|
|
|
492
492
|
/**
|
|
493
|
-
* ✅
|
|
493
|
+
* ✅ Copy source files to dist/jux for esbuild to resolve
|
|
494
|
+
*/
|
|
495
|
+
_copySourceToDist() {
|
|
496
|
+
const distJuxDir = path.join(this.distDir, 'jux');
|
|
497
|
+
|
|
498
|
+
// Ensure dist/jux directory exists
|
|
499
|
+
if (!fs.existsSync(distJuxDir)) {
|
|
500
|
+
fs.mkdirSync(distJuxDir, { recursive: true });
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// Copy all .jux and .js files from source to dist
|
|
504
|
+
this._copySourceFilesRecursive(this.srcDir, this.srcDir, distJuxDir);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Recursively copy .jux and .js files preserving folder structure
|
|
509
|
+
*/
|
|
510
|
+
_copySourceFilesRecursive(src, baseDir, distBase) {
|
|
511
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
512
|
+
|
|
513
|
+
entries.forEach(entry => {
|
|
514
|
+
if (entry.name.startsWith('.')) return; // Skip hidden
|
|
515
|
+
|
|
516
|
+
const srcPath = path.join(src, entry.name);
|
|
517
|
+
const relativePath = path.relative(baseDir, srcPath);
|
|
518
|
+
const destPath = path.join(distBase, relativePath);
|
|
519
|
+
|
|
520
|
+
if (entry.isDirectory()) {
|
|
521
|
+
// Create directory if it doesn't exist
|
|
522
|
+
if (!fs.existsSync(destPath)) {
|
|
523
|
+
fs.mkdirSync(destPath, { recursive: true });
|
|
524
|
+
}
|
|
525
|
+
// Recurse into subdirectory
|
|
526
|
+
this._copySourceFilesRecursive(srcPath, baseDir, distBase);
|
|
527
|
+
} else if (entry.name.endsWith('.jux') || entry.name.endsWith('.js')) {
|
|
528
|
+
// Copy .jux and .js files (skip assets)
|
|
529
|
+
if (!this.isAssetFile(entry.name)) {
|
|
530
|
+
// Ensure parent directory exists
|
|
531
|
+
const destDir = path.dirname(destPath);
|
|
532
|
+
if (!fs.existsSync(destDir)) {
|
|
533
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
534
|
+
}
|
|
535
|
+
fs.copyFileSync(srcPath, destPath);
|
|
536
|
+
console.log(` 📋 Copied: ${relativePath}`);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* ✅ Build method with source copy step
|
|
494
544
|
*/
|
|
495
545
|
async build() {
|
|
496
546
|
console.log('🔨 Building JUX application...\n');
|
|
@@ -511,6 +561,11 @@ navigate(location.pathname);
|
|
|
511
561
|
fs.mkdirSync(this.distDir, { recursive: true });
|
|
512
562
|
}
|
|
513
563
|
|
|
564
|
+
// ✅ Copy source files to dist/jux BEFORE generating entry point
|
|
565
|
+
console.log('📋 Copying source files to dist...');
|
|
566
|
+
this._copySourceToDist();
|
|
567
|
+
console.log('✅ Source files copied\n');
|
|
568
|
+
|
|
514
569
|
// Generate entry point
|
|
515
570
|
const entryCode = this.generateEntryPoint(views, dataModules, sharedModules);
|
|
516
571
|
const entryPath = path.join(this.distDir, 'entry.js');
|
|
@@ -526,7 +581,11 @@ navigate(location.pathname);
|
|
|
526
581
|
platform: 'browser',
|
|
527
582
|
target: 'es2020',
|
|
528
583
|
sourcemap: true,
|
|
529
|
-
external: []
|
|
584
|
+
external: [],
|
|
585
|
+
// ✅ Tell esbuild how to resolve .jux files
|
|
586
|
+
loader: {
|
|
587
|
+
'.jux': 'js' // Treat .jux files as JavaScript
|
|
588
|
+
}
|
|
530
589
|
});
|
|
531
590
|
|
|
532
591
|
// Generate index.html
|