juxscript 1.0.75 → 1.0.77

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.
@@ -367,6 +367,7 @@ function transformJuxToViewFunction(juxContent, functionName, pageName, relative
367
367
  } catch (err) {
368
368
  throw new Error(`Invalid JavaScript syntax in ${relativePath}`);
369
369
  }
370
+
370
371
  result = result.replace(/\.renderTo\(container\)/g, '.render("#app")').replace(/\.render\(\s*\)/g, '.render("#app")');
371
372
  const cleanName = functionName.replace(/[-_]/g, ' ').split(' ').map(w => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join('');
372
373
 
@@ -390,6 +391,7 @@ function resolveImportPath(importPath, currentFilePath) {
390
391
  return importPath.substring(1).replace(/\\/g, '/');
391
392
  }
392
393
  const currentDir = path.dirname(currentFilePath);
394
+ // ✅ Ensure normalized separators
393
395
  return path.join(currentDir, importPath).replace(/\\/g, '/');
394
396
  }
395
397
 
@@ -407,9 +409,11 @@ function generateRouterBundle(views, routes, sharedModules = new Map(), allImpor
407
409
  }
408
410
  if (joinedPath.includes('lib/components')) return 'juxscript/components';
409
411
 
410
- // Fix: Ensure local relative paths start with ./ or /
412
+ // Fix: Ensure local relative paths ALWAYS start with ./
411
413
  let normalized = joinedPath.replace(/\\/g, '/');
412
- if (!normalized.startsWith('.') && !normalized.startsWith('/')) {
414
+ // If it's a bare filename like "file.js", prefix it to "./file.js"
415
+ // Also check for ":" to avoid messing up URLs like http:// or data:
416
+ if (!normalized.startsWith('.') && !normalized.startsWith('/') && !normalized.includes(':')) {
413
417
  normalized = './' + normalized;
414
418
  }
415
419
  return normalized;
@@ -16,7 +16,6 @@ export function verifyStaticBuild(distDir) {
16
16
  }
17
17
 
18
18
  // 1. Critical Files Existence
19
- // ✅ FIX: Removed lib/jux.js as it is no longer the primary artifact with v2 components
20
19
  const critical = ['index.html', 'main.js'];
21
20
  for (const f of critical) {
22
21
  if (!fs.existsSync(path.join(distDir, f))) {
@@ -41,8 +40,6 @@ export function verifyStaticBuild(distDir) {
41
40
  const fullPath = path.join(distDir, fsPath);
42
41
 
43
42
  if (!fs.existsSync(fullPath)) {
44
- // Downgrade missing imports to warnings if they look like vendored libs?
45
- // For now, keep as error to be safe.
46
43
  errors.push(`Broken Import Map: "${key}" -> ${url} (File not found)`);
47
44
  }
48
45
  }
@@ -68,6 +65,13 @@ export function verifyStaticBuild(distDir) {
68
65
  return;
69
66
  }
70
67
 
68
+ // ✅ FIX: Check if the file exists locally in dist (e.g. copied assets)
69
+ // If it exists on disk, it's not a ghost dependency from node_modules
70
+ // This handles cases where a file was copied but imported as a bare specifier (though compiler should fix that too)
71
+ if (fs.existsSync(path.join(distDir, source))) {
72
+ return;
73
+ }
74
+
71
75
  if (!importMap[source] && !importMap[source + '/']) {
72
76
  errors.push(`Ghost Dependency: '${source}' is imported in main.js but missing from Import Map.`);
73
77
  }
@@ -90,7 +94,6 @@ export function verifyStaticBuild(distDir) {
90
94
 
91
95
  export function verifyRuntime(port) {
92
96
  return new Promise((resolve) => {
93
- // console.log('🩺 Performing runtime diagnostics...');
94
97
  const errors = [];
95
98
 
96
99
  // Helper to check a single URL
@@ -118,15 +121,13 @@ export function verifyRuntime(port) {
118
121
  Promise.all([
119
122
  check('/', 'text/html'),
120
123
  check('/main.js', 'application/javascript'),
121
- // check('/lib/jux.js', 'application/javascript') // Removed check
122
124
  ]).then(() => {
123
125
  if (errors.length > 0) {
124
- console.error(`\n💥 RUNTIME VERIFICATION FAILED (` + errors.length + ` errors):`);
126
+ console.error(`\n💥 RUNTIME VERIFICATION FAILED (${errors.length} errors):`);
125
127
  errors.forEach(e => console.error(` - ${e}`));
126
128
  console.log('');
127
129
  resolve(false);
128
130
  } else {
129
- // console.log(' ✓ Runtime health healthy\n');
130
131
  resolve(true);
131
132
  }
132
133
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juxscript",
3
- "version": "1.0.75",
3
+ "version": "1.0.77",
4
4
  "type": "module",
5
5
  "description": "A JavaScript UX authorship platform",
6
6
  "main": "lib/jux.js",