juxscript 1.1.122 → 1.1.123

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:09:43.298Z",
3
+ "generatedAt": "2026-02-13T05:12:05.809Z",
4
4
  "components": [
5
5
  {
6
6
  "file": "alert.js",
@@ -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.replace(/[\/\\.\\-\s]/g, '_');
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] = {
@@ -608,16 +613,17 @@ navigate(location.pathname);
608
613
  }
609
614
 
610
615
  /**
611
- * ✅ Generate name from folder structure
616
+ * ✅ Generate valid JavaScript identifier from file path
612
617
  * Example: abc/aaa.jux -> abc_aaa
613
- * Example: components/header.jux -> components_header
618
+ * Example: menus/main.jux -> menus_main
619
+ * Example: pages/blog/post.jux -> pages_blog_post
614
620
  */
615
621
  _generateNameFromPath(filepath) {
616
622
  return filepath
617
- .replace(/\.jux$/, '') // Remove .jux extension
618
- .replace(/[\/\\]/g, '_') // Replace slashes with underscores
619
- .replace(/[^a-zA-Z0-9_]/g, '_') // Replace any other invalid chars
620
- .replace(/_+/g, '_') // Collapse multiple underscores
621
- .replace(/^_|_$/g, ''); // Remove leading/trailing underscores
623
+ .replace(/\.jux$/, '') // Remove .jux extension
624
+ .replace(/[\/\\]/g, '_') // Replace / and \ with _
625
+ .replace(/[^a-zA-Z0-9_]/g, '_') // Replace any other invalid chars with _
626
+ .replace(/_+/g, '_') // Collapse multiple consecutive underscores
627
+ .replace(/^_|_$/g, ''); // Remove leading/trailing underscores
622
628
  }
623
629
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juxscript",
3
- "version": "1.1.122",
3
+ "version": "1.1.123",
4
4
  "type": "module",
5
5
  "description": "A JavaScript UX authorship platform",
6
6
  "main": "index.js",