juxscript 1.1.121 → 1.1.122

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:09:43.298Z",
4
4
  "components": [
5
5
  {
6
6
  "file": "alert.js",
@@ -232,8 +232,10 @@ 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.replace(/[\/\\.\\-\s]/g, '_');
238
+ const capitalized = sanitizedName.charAt(0).toUpperCase() + sanitizedName.slice(1);
237
239
 
238
240
  sourceSnapshot[v.file] = {
239
241
  name: v.name,
@@ -245,6 +247,7 @@ export class JuxCompiler {
245
247
  let viewCode = this.removeImports(v.content).replace(/^\s*export\s+default\s+.*$/gm, '');
246
248
  const asyncPrefix = viewCode.includes('await ') ? 'async ' : '';
247
249
 
250
+ // ✅ Use sanitized name in function declaration
248
251
  entry += `\n${asyncPrefix}function render${capitalized}() {\n${viewCode}\n}\n`;
249
252
  });
250
253
 
@@ -603,4 +606,18 @@ navigate(location.pathname);
603
606
  };
604
607
  return icons[ext.toLowerCase()] || '📦';
605
608
  }
609
+
610
+ /**
611
+ * ✅ Generate name from folder structure
612
+ * Example: abc/aaa.jux -> abc_aaa
613
+ * Example: components/header.jux -> components_header
614
+ */
615
+ _generateNameFromPath(filepath) {
616
+ 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
622
+ }
606
623
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juxscript",
3
- "version": "1.1.121",
3
+ "version": "1.1.122",
4
4
  "type": "module",
5
5
  "description": "A JavaScript UX authorship platform",
6
6
  "main": "index.js",