juxscript 1.1.138 → 1.1.139
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 +45 -4
- package/package.json +1 -1
package/dom-structure-map.json
CHANGED
package/machinery/compiler3.js
CHANGED
|
@@ -510,12 +510,11 @@ document.addEventListener('click', (e) => {
|
|
|
510
510
|
const juxDistDir = path.join(this.distDir, 'jux');
|
|
511
511
|
fs.mkdirSync(juxDistDir, { recursive: true });
|
|
512
512
|
|
|
513
|
-
// ✅
|
|
513
|
+
// ✅ Create subdirectories and copy files
|
|
514
514
|
[...dataModules, ...sharedModules].forEach(m => {
|
|
515
515
|
const destPath = path.join(juxDistDir, m.file);
|
|
516
516
|
const destDir = path.dirname(destPath);
|
|
517
517
|
|
|
518
|
-
// Create subdirectory if it doesn't exist
|
|
519
518
|
if (!fs.existsSync(destDir)) {
|
|
520
519
|
fs.mkdirSync(destDir, { recursive: true });
|
|
521
520
|
}
|
|
@@ -547,15 +546,57 @@ document.addEventListener('click', (e) => {
|
|
|
547
546
|
platform: 'browser',
|
|
548
547
|
target: 'esnext',
|
|
549
548
|
sourcemap: true,
|
|
550
|
-
|
|
549
|
+
|
|
550
|
+
// ✅ FIX: Remove external packages restriction - bundle EVERYTHING
|
|
551
|
+
// This allows axios, lodash, date-fns, etc. to be bundled
|
|
552
|
+
// Remove the packages: 'external' or external: [...] config
|
|
553
|
+
|
|
554
|
+
loader: {
|
|
555
|
+
'.jux': 'js',
|
|
556
|
+
'.css': 'empty'
|
|
557
|
+
},
|
|
558
|
+
|
|
551
559
|
plugins: [{
|
|
552
560
|
name: 'juxscript-resolver',
|
|
553
561
|
setup: (build) => {
|
|
554
|
-
|
|
562
|
+
// Only resolve juxscript - everything else gets bundled normally
|
|
563
|
+
build.onResolve({ filter: /^juxscript$/ }, () => ({
|
|
564
|
+
path: juxscriptPath
|
|
565
|
+
}));
|
|
555
566
|
}
|
|
556
567
|
}],
|
|
568
|
+
|
|
569
|
+
// ✅ NEW: Minify and tree-shake in production
|
|
570
|
+
minify: process.env.NODE_ENV === 'production',
|
|
571
|
+
treeShaking: true,
|
|
572
|
+
|
|
573
|
+
// ✅ NEW: Handle node built-ins (like 'http', 'fs') that axios might use
|
|
574
|
+
// These should NOT be bundled (they don't work in browser)
|
|
575
|
+
external: [
|
|
576
|
+
'fs',
|
|
577
|
+
'path',
|
|
578
|
+
'http',
|
|
579
|
+
'https',
|
|
580
|
+
'stream',
|
|
581
|
+
'zlib',
|
|
582
|
+
'crypto'
|
|
583
|
+
],
|
|
584
|
+
|
|
585
|
+
// ✅ NEW: Define globals for node built-ins
|
|
586
|
+
define: {
|
|
587
|
+
'process.env.NODE_ENV': '"production"',
|
|
588
|
+
'global': 'window'
|
|
589
|
+
}
|
|
557
590
|
});
|
|
591
|
+
|
|
558
592
|
console.log('✅ esbuild complete');
|
|
593
|
+
|
|
594
|
+
// ✅ Show bundle size
|
|
595
|
+
const bundlePath = path.join(this.distDir, 'bundle.js');
|
|
596
|
+
const bundleStats = fs.statSync(bundlePath);
|
|
597
|
+
const bundleSizeKB = (bundleStats.size / 1024).toFixed(2);
|
|
598
|
+
console.log(`📦 Bundle size: ${bundleSizeKB} KB`);
|
|
599
|
+
|
|
559
600
|
} catch (err) {
|
|
560
601
|
console.error('❌ esbuild failed:', err);
|
|
561
602
|
return { success: false, errors: [{ message: err.message }], warnings: [] };
|