juxscript 1.1.95 → 1.1.96
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 +53 -2
- package/package.json +1 -1
package/dom-structure-map.json
CHANGED
package/machinery/compiler3.js
CHANGED
|
@@ -490,7 +490,50 @@ 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, distJuxDir, this.srcDir);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Recursively copy .jux and .js files preserving folder structure
|
|
509
|
+
*/
|
|
510
|
+
_copySourceFilesRecursive(src, dest, baseDir) {
|
|
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(dest, relativePath);
|
|
519
|
+
|
|
520
|
+
if (entry.isDirectory()) {
|
|
521
|
+
// Create directory and recurse
|
|
522
|
+
if (!fs.existsSync(destPath)) {
|
|
523
|
+
fs.mkdirSync(destPath, { recursive: true });
|
|
524
|
+
}
|
|
525
|
+
this._copySourceFilesRecursive(srcPath, dest, baseDir);
|
|
526
|
+
} else if (entry.name.endsWith('.jux') || entry.name.endsWith('.js')) {
|
|
527
|
+
// Copy .jux and .js files
|
|
528
|
+
if (!this.isAssetFile(entry.name)) {
|
|
529
|
+
fs.copyFileSync(srcPath, destPath);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* ✅ Build method with source copy step
|
|
494
537
|
*/
|
|
495
538
|
async build() {
|
|
496
539
|
console.log('🔨 Building JUX application...\n');
|
|
@@ -511,6 +554,10 @@ navigate(location.pathname);
|
|
|
511
554
|
fs.mkdirSync(this.distDir, { recursive: true });
|
|
512
555
|
}
|
|
513
556
|
|
|
557
|
+
// ✅ Copy source files to dist/jux BEFORE generating entry point
|
|
558
|
+
console.log('📋 Copying source files to dist...');
|
|
559
|
+
this._copySourceToDist();
|
|
560
|
+
|
|
514
561
|
// Generate entry point
|
|
515
562
|
const entryCode = this.generateEntryPoint(views, dataModules, sharedModules);
|
|
516
563
|
const entryPath = path.join(this.distDir, 'entry.js');
|
|
@@ -526,7 +573,11 @@ navigate(location.pathname);
|
|
|
526
573
|
platform: 'browser',
|
|
527
574
|
target: 'es2020',
|
|
528
575
|
sourcemap: true,
|
|
529
|
-
external: []
|
|
576
|
+
external: [],
|
|
577
|
+
// ✅ Tell esbuild how to resolve .jux files
|
|
578
|
+
loader: {
|
|
579
|
+
'.jux': 'js' // Treat .jux files as JavaScript
|
|
580
|
+
}
|
|
530
581
|
});
|
|
531
582
|
|
|
532
583
|
// Generate index.html
|