juxscript 1.1.128 → 1.1.130

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "totalComponents": 69,
3
- "generatedAt": "2026-02-13T05:38:34.158Z",
3
+ "generatedAt": "2026-02-13T05:43:29.417Z",
4
4
  "components": [
5
5
  {
6
6
  "file": "alert.js",
@@ -478,57 +478,94 @@ document.addEventListener('click', (e) => {
478
478
  }
479
479
 
480
480
  async build() {
481
- console.log('šŸ”Ø Building JUX project...\n');
481
+ console.log('šŸš€ JUX Build\n');
482
482
 
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 });
483
+ const juxscriptPath = this.findJuxscriptPath();
484
+ if (!juxscriptPath) {
485
+ console.error('āŒ Could not locate juxscript package');
486
+ return { success: false, errors: [{ message: 'juxscript not found' }], warnings: [] };
487
+ }
488
+ console.log(`šŸ“¦ Using: ${juxscriptPath}`);
489
489
 
490
- // 2. Scan .jux files recursively
491
- const juxFiles = this.scanJuxFiles(this.config.srcDir);
492
- console.log(`šŸ“‚ Found ${juxFiles.length} .jux files\n`);
490
+ await this.loadJuxscriptExports();
493
491
 
494
- // 3. āœ… Bundle all .jux files → entry.js
495
- await this.bundleJuxFiles(juxFiles);
492
+ if (fs.existsSync(this.distDir)) {
493
+ fs.rmSync(this.distDir, { recursive: true, force: true });
494
+ }
495
+ fs.mkdirSync(this.distDir, { recursive: true });
496
496
 
497
- // 4. āœ… Bundle vendor libraries → bundle.js
498
- await this.bundleVendorFiles();
497
+ // āœ… Copy public folder if exists
498
+ this.copyPublicFolder();
499
499
 
500
- // 5. Copy public assets (CSS, images, etc.)
501
- await this.copyPublicAssets();
500
+ const { views, dataModules, sharedModules } = this.scanFiles();
501
+ console.log(`šŸ“ Found ${views.length} views, ${sharedModules.length} shared, ${dataModules.length} data`);
502
502
 
503
- // 6. Generate index.html (with entry.js + bundle.js)
504
- await this.generateIndexHtml();
503
+ // Copy data/shared modules to dist
504
+ const juxDistDir = path.join(this.distDir, 'jux');
505
+ fs.mkdirSync(juxDistDir, { recursive: true });
506
+ [...dataModules, ...sharedModules].forEach(m => {
507
+ fs.writeFileSync(path.join(juxDistDir, m.file), m.content);
508
+ });
505
509
 
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`);
510
+ const entryContent = this.generateEntryPoint(views, dataModules, sharedModules);
511
+ const entryPath = path.join(this.distDir, 'entry.js');
512
+ fs.writeFileSync(entryPath, entryContent);
512
513
 
513
- // āœ… Consistent return object
514
- return {
515
- success: true,
516
- errors: [],
517
- warnings: [],
518
- fileCount: juxFiles.length
519
- };
514
+ const snapshotPath = path.join(this.distDir, '__jux_sources.json');
515
+ fs.writeFileSync(snapshotPath, JSON.stringify(this._sourceSnapshot, null, 2));
516
+ console.log(`šŸ“ø Source snapshot written`);
520
517
 
521
- } catch (error) {
522
- console.error('\nāŒ Build failed:', error.message);
523
- console.error(error.stack);
518
+ const validation = this.reportValidationIssues();
519
+ if (!validation.isValid) {
520
+ console.log('šŸ›‘ BUILD FAILED\n');
521
+ return { success: false, errors: validation.errors, warnings: validation.warnings };
522
+ }
524
523
 
525
- // āœ… Return failure object
526
- return {
527
- success: false,
528
- errors: [error.message],
529
- warnings: []
530
- };
524
+ try {
525
+ await esbuild.build({
526
+ entryPoints: [entryPath],
527
+ bundle: true,
528
+ outfile: path.join(this.distDir, 'bundle.js'),
529
+ format: 'esm',
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: [] };
531
545
  }
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 };
532
569
  }
533
570
 
534
571
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juxscript",
3
- "version": "1.1.128",
3
+ "version": "1.1.130",
4
4
  "type": "module",
5
5
  "description": "A JavaScript UX authorship platform",
6
6
  "main": "index.js",