juxscript 1.1.122 → 1.1.124
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 +23 -15
- package/package.json +1 -1
package/dom-structure-map.json
CHANGED
package/machinery/compiler3.js
CHANGED
|
@@ -234,7 +234,12 @@ export class JuxCompiler {
|
|
|
234
234
|
views.forEach(v => {
|
|
235
235
|
// ✅ Sanitize the name for use in function names
|
|
236
236
|
// Replace slashes, dots, and other invalid characters with underscores
|
|
237
|
-
const sanitizedName = v.name
|
|
237
|
+
const sanitizedName = v.name
|
|
238
|
+
.replace(/[\/\\.\\-\s]/g, '_') // Replace /, \, ., -, spaces with _
|
|
239
|
+
.replace(/[^a-zA-Z0-9_]/g, '_') // Replace any other invalid chars with _
|
|
240
|
+
.replace(/_+/g, '_') // Collapse multiple consecutive underscores
|
|
241
|
+
.replace(/^_|_$/g, ''); // Remove leading/trailing underscores
|
|
242
|
+
|
|
238
243
|
const capitalized = sanitizedName.charAt(0).toUpperCase() + sanitizedName.slice(1);
|
|
239
244
|
|
|
240
245
|
sourceSnapshot[v.file] = {
|
|
@@ -512,20 +517,22 @@ navigate(location.pathname);
|
|
|
512
517
|
<head>
|
|
513
518
|
<meta charset="UTF-8">
|
|
514
519
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
515
|
-
<title>JUX
|
|
516
|
-
<script type="module" src="./bundle.js"></script>
|
|
520
|
+
<title>JUX Application</title>
|
|
517
521
|
</head>
|
|
518
522
|
<body>
|
|
519
523
|
<div id="app"></div>
|
|
524
|
+
<script src="/bundle.js"></script>
|
|
525
|
+
<script src="/entry.js"></script>
|
|
520
526
|
</body>
|
|
521
527
|
</html>`;
|
|
522
|
-
fs.writeFileSync(path.join(this.distDir, 'index.html'), html);
|
|
523
528
|
|
|
524
|
-
fs.
|
|
525
|
-
|
|
529
|
+
fs.writeFileSync(
|
|
530
|
+
path.join(this.config.distDir, 'index.html'),
|
|
531
|
+
html,
|
|
532
|
+
'utf8'
|
|
533
|
+
);
|
|
526
534
|
|
|
527
|
-
console.log(
|
|
528
|
-
return { success: true, errors: [], warnings: validation.warnings };
|
|
535
|
+
console.log(' ✅ Generated index.html');
|
|
529
536
|
}
|
|
530
537
|
|
|
531
538
|
/**
|
|
@@ -608,16 +615,17 @@ navigate(location.pathname);
|
|
|
608
615
|
}
|
|
609
616
|
|
|
610
617
|
/**
|
|
611
|
-
* ✅ Generate
|
|
618
|
+
* ✅ Generate valid JavaScript identifier from file path
|
|
612
619
|
* Example: abc/aaa.jux -> abc_aaa
|
|
613
|
-
* Example:
|
|
620
|
+
* Example: menus/main.jux -> menus_main
|
|
621
|
+
* Example: pages/blog/post.jux -> pages_blog_post
|
|
614
622
|
*/
|
|
615
623
|
_generateNameFromPath(filepath) {
|
|
616
624
|
return filepath
|
|
617
|
-
.replace(/\.jux$/, '')
|
|
618
|
-
.replace(/[\/\\]/g, '_')
|
|
619
|
-
.replace(/[^a-zA-Z0-9_]/g, '_')
|
|
620
|
-
.replace(/_+/g, '_')
|
|
621
|
-
.replace(/^_|_$/g, '');
|
|
625
|
+
.replace(/\.jux$/, '') // Remove .jux extension
|
|
626
|
+
.replace(/[\/\\]/g, '_') // Replace / and \ with _
|
|
627
|
+
.replace(/[^a-zA-Z0-9_]/g, '_') // Replace any other invalid chars with _
|
|
628
|
+
.replace(/_+/g, '_') // Collapse multiple consecutive underscores
|
|
629
|
+
.replace(/^_|_$/g, ''); // Remove leading/trailing underscores
|
|
622
630
|
}
|
|
623
631
|
}
|