juxscript 1.1.121 → 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:06:54.302Z",
3
+ "generatedAt": "2026-02-13T05:12:05.809Z",
4
4
  "components": [
5
5
  {
6
6
  "file": "alert.js",
@@ -232,8 +232,15 @@ export class JuxCompiler {
232
232
  entry += `\n// --- VIEW FUNCTIONS ---\n`;
233
233
 
234
234
  views.forEach(v => {
235
- const capitalized = v.name.charAt(0).toUpperCase() + v.name.slice(1);
236
- allIssues.push(...this.validateViewCode(v.name, v.content));
235
+ // Sanitize the name for use in function names
236
+ // Replace slashes, dots, and other invalid characters with underscores
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
+
243
+ const capitalized = sanitizedName.charAt(0).toUpperCase() + sanitizedName.slice(1);
237
244
 
238
245
  sourceSnapshot[v.file] = {
239
246
  name: v.name,
@@ -245,6 +252,7 @@ export class JuxCompiler {
245
252
  let viewCode = this.removeImports(v.content).replace(/^\s*export\s+default\s+.*$/gm, '');
246
253
  const asyncPrefix = viewCode.includes('await ') ? 'async ' : '';
247
254
 
255
+ // ✅ Use sanitized name in function declaration
248
256
  entry += `\n${asyncPrefix}function render${capitalized}() {\n${viewCode}\n}\n`;
249
257
  });
250
258
 
@@ -603,4 +611,19 @@ navigate(location.pathname);
603
611
  };
604
612
  return icons[ext.toLowerCase()] || '📦';
605
613
  }
614
+
615
+ /**
616
+ * ✅ Generate valid JavaScript identifier from file path
617
+ * Example: abc/aaa.jux -> abc_aaa
618
+ * Example: menus/main.jux -> menus_main
619
+ * Example: pages/blog/post.jux -> pages_blog_post
620
+ */
621
+ _generateNameFromPath(filepath) {
622
+ return filepath
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
628
+ }
606
629
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juxscript",
3
- "version": "1.1.121",
3
+ "version": "1.1.123",
4
4
  "type": "module",
5
5
  "description": "A JavaScript UX authorship platform",
6
6
  "main": "index.js",