juxscript 1.1.94 → 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 +65 -5
- package/package.json +1 -1
package/dom-structure-map.json
CHANGED
package/machinery/compiler3.js
CHANGED
|
@@ -309,17 +309,26 @@ export class JuxCompiler {
|
|
|
309
309
|
return entry;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
+
reportValidationIssues() {
|
|
313
|
+
if (!this._validationIssues || this._validationIssues.length === 0) return;
|
|
314
|
+
|
|
315
|
+
console.log('\n⚠️ Validation Issues:\n');
|
|
316
|
+
this._validationIssues.forEach(issue => {
|
|
317
|
+
const icon = issue.type === 'error' ? '❌' : '⚠️';
|
|
318
|
+
console.log(` ${icon} ${issue.view}:${issue.line} - ${issue.message}`);
|
|
319
|
+
});
|
|
320
|
+
console.log('');
|
|
321
|
+
}
|
|
322
|
+
|
|
312
323
|
/**
|
|
313
|
-
* ✅ Generate routes based on folder structure
|
|
324
|
+
* ✅ Generate routes based on folder structure (SINGLE DEFINITION)
|
|
314
325
|
*/
|
|
315
326
|
_generateRouter(views) {
|
|
316
327
|
let routeMap = '';
|
|
317
328
|
|
|
318
329
|
views.forEach(v => {
|
|
319
|
-
// ✅ Generate route from folder structure
|
|
320
330
|
const routePath = this._generateRoutePath(v.file);
|
|
321
331
|
const functionName = this._generateFunctionName(v.name);
|
|
322
|
-
|
|
323
332
|
routeMap += ` '${routePath}': render${functionName},\n`;
|
|
324
333
|
});
|
|
325
334
|
|
|
@@ -481,7 +490,50 @@ navigate(location.pathname);
|
|
|
481
490
|
}
|
|
482
491
|
|
|
483
492
|
/**
|
|
484
|
-
* ✅
|
|
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
|
|
485
537
|
*/
|
|
486
538
|
async build() {
|
|
487
539
|
console.log('🔨 Building JUX application...\n');
|
|
@@ -502,6 +554,10 @@ navigate(location.pathname);
|
|
|
502
554
|
fs.mkdirSync(this.distDir, { recursive: true });
|
|
503
555
|
}
|
|
504
556
|
|
|
557
|
+
// ✅ Copy source files to dist/jux BEFORE generating entry point
|
|
558
|
+
console.log('📋 Copying source files to dist...');
|
|
559
|
+
this._copySourceToDist();
|
|
560
|
+
|
|
505
561
|
// Generate entry point
|
|
506
562
|
const entryCode = this.generateEntryPoint(views, dataModules, sharedModules);
|
|
507
563
|
const entryPath = path.join(this.distDir, 'entry.js');
|
|
@@ -517,7 +573,11 @@ navigate(location.pathname);
|
|
|
517
573
|
platform: 'browser',
|
|
518
574
|
target: 'es2020',
|
|
519
575
|
sourcemap: true,
|
|
520
|
-
external: []
|
|
576
|
+
external: [],
|
|
577
|
+
// ✅ Tell esbuild how to resolve .jux files
|
|
578
|
+
loader: {
|
|
579
|
+
'.jux': 'js' // Treat .jux files as JavaScript
|
|
580
|
+
}
|
|
521
581
|
});
|
|
522
582
|
|
|
523
583
|
// Generate index.html
|