juxscript 1.1.127 ā 1.1.128
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 +40 -77
- package/package.json +1 -1
package/dom-structure-map.json
CHANGED
package/machinery/compiler3.js
CHANGED
|
@@ -478,94 +478,57 @@ document.addEventListener('click', (e) => {
|
|
|
478
478
|
}
|
|
479
479
|
|
|
480
480
|
async build() {
|
|
481
|
-
console.log('
|
|
481
|
+
console.log('šØ Building JUX project...\n');
|
|
482
482
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
483
|
+
try {
|
|
484
|
+
// 1. Clean dist
|
|
485
|
+
if (fs.existsSync(this.config.distDir)) {
|
|
486
|
+
fs.rmSync(this.config.distDir, { recursive: true, force: true });
|
|
487
|
+
}
|
|
488
|
+
fs.mkdirSync(this.config.distDir, { recursive: true });
|
|
489
489
|
|
|
490
|
-
|
|
490
|
+
// 2. Scan .jux files recursively
|
|
491
|
+
const juxFiles = this.scanJuxFiles(this.config.srcDir);
|
|
492
|
+
console.log(`š Found ${juxFiles.length} .jux files\n`);
|
|
491
493
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
}
|
|
495
|
-
fs.mkdirSync(this.distDir, { recursive: true });
|
|
494
|
+
// 3. ā
Bundle all .jux files ā entry.js
|
|
495
|
+
await this.bundleJuxFiles(juxFiles);
|
|
496
496
|
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
// 4. ā
Bundle vendor libraries ā bundle.js
|
|
498
|
+
await this.bundleVendorFiles();
|
|
499
499
|
|
|
500
|
-
|
|
501
|
-
|
|
500
|
+
// 5. Copy public assets (CSS, images, etc.)
|
|
501
|
+
await this.copyPublicAssets();
|
|
502
502
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
fs.mkdirSync(juxDistDir, { recursive: true });
|
|
506
|
-
[...dataModules, ...sharedModules].forEach(m => {
|
|
507
|
-
fs.writeFileSync(path.join(juxDistDir, m.file), m.content);
|
|
508
|
-
});
|
|
503
|
+
// 6. Generate index.html (with entry.js + bundle.js)
|
|
504
|
+
await this.generateIndexHtml();
|
|
509
505
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
506
|
+
console.log('\nā
Build completed successfully!\n');
|
|
507
|
+
console.log(`š Output: ${this.config.distDir}`);
|
|
508
|
+
console.log(` ā entry.js (${juxFiles.length} .jux files bundled)`);
|
|
509
|
+
console.log(` ā bundle.js (vendor libraries)`);
|
|
510
|
+
console.log(` ā index.html`);
|
|
511
|
+
console.log(` ā Public assets copied\n`);
|
|
513
512
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
513
|
+
// ā
Consistent return object
|
|
514
|
+
return {
|
|
515
|
+
success: true,
|
|
516
|
+
errors: [],
|
|
517
|
+
warnings: [],
|
|
518
|
+
fileCount: juxFiles.length
|
|
519
|
+
};
|
|
517
520
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
console.
|
|
521
|
-
return { success: false, errors: validation.errors, warnings: validation.warnings };
|
|
522
|
-
}
|
|
521
|
+
} catch (error) {
|
|
522
|
+
console.error('\nā Build failed:', error.message);
|
|
523
|
+
console.error(error.stack);
|
|
523
524
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
platform: 'browser',
|
|
531
|
-
target: 'esnext',
|
|
532
|
-
sourcemap: true,
|
|
533
|
-
loader: { '.jux': 'js', '.css': 'empty' },
|
|
534
|
-
plugins: [{
|
|
535
|
-
name: 'juxscript-resolver',
|
|
536
|
-
setup: (build) => {
|
|
537
|
-
build.onResolve({ filter: /^juxscript$/ }, () => ({ path: juxscriptPath }));
|
|
538
|
-
}
|
|
539
|
-
}],
|
|
540
|
-
});
|
|
541
|
-
console.log('ā
esbuild complete');
|
|
542
|
-
} catch (err) {
|
|
543
|
-
console.error('ā esbuild failed:', err);
|
|
544
|
-
return { success: false, errors: [{ message: err.message }], warnings: [] };
|
|
525
|
+
// ā
Return failure object
|
|
526
|
+
return {
|
|
527
|
+
success: false,
|
|
528
|
+
errors: [error.message],
|
|
529
|
+
warnings: []
|
|
530
|
+
};
|
|
545
531
|
}
|
|
546
|
-
|
|
547
|
-
const html = `<!DOCTYPE html>
|
|
548
|
-
<html lang="en">
|
|
549
|
-
<head>
|
|
550
|
-
<meta charset="UTF-8">
|
|
551
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
552
|
-
<title>JUX Application</title>
|
|
553
|
-
<script type="module" src="./bundle.js"></script>
|
|
554
|
-
<script src="./entry.js"></script>
|
|
555
|
-
</head>
|
|
556
|
-
<body>
|
|
557
|
-
<div id="app"></div>
|
|
558
|
-
</body>
|
|
559
|
-
</html>`;
|
|
560
|
-
|
|
561
|
-
fs.writeFileSync(
|
|
562
|
-
path.join(this.config.distDir, 'index.html'),
|
|
563
|
-
html,
|
|
564
|
-
'utf8'
|
|
565
|
-
);
|
|
566
|
-
|
|
567
|
-
console.log(' ā
Generated index.html');
|
|
568
|
-
return { success: true, errors: [], warnings: validation.warnings };
|
|
569
532
|
}
|
|
570
533
|
|
|
571
534
|
/**
|