juxscript 1.0.75 → 1.0.76
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/machinery/compiler.js +4 -1
- package/machinery/verifier.js +6 -6
- package/package.json +1 -1
package/machinery/compiler.js
CHANGED
|
@@ -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,8 +409,9 @@ 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 ./
|
|
412
|
+
// ✅ Fix: Ensure local relative paths ALWAYS start with ./
|
|
411
413
|
let normalized = joinedPath.replace(/\\/g, '/');
|
|
414
|
+
// If it's a bare filename like "file.js", prefix it to "./file.js"
|
|
412
415
|
if (!normalized.startsWith('.') && !normalized.startsWith('/')) {
|
|
413
416
|
normalized = './' + normalized;
|
|
414
417
|
}
|
package/machinery/verifier.js
CHANGED
|
@@ -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,12 @@ 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
|
+
if (fs.existsSync(path.join(distDir, source))) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
71
74
|
if (!importMap[source] && !importMap[source + '/']) {
|
|
72
75
|
errors.push(`Ghost Dependency: '${source}' is imported in main.js but missing from Import Map.`);
|
|
73
76
|
}
|
|
@@ -90,7 +93,6 @@ export function verifyStaticBuild(distDir) {
|
|
|
90
93
|
|
|
91
94
|
export function verifyRuntime(port) {
|
|
92
95
|
return new Promise((resolve) => {
|
|
93
|
-
// console.log('🩺 Performing runtime diagnostics...');
|
|
94
96
|
const errors = [];
|
|
95
97
|
|
|
96
98
|
// Helper to check a single URL
|
|
@@ -118,7 +120,6 @@ export function verifyRuntime(port) {
|
|
|
118
120
|
Promise.all([
|
|
119
121
|
check('/', 'text/html'),
|
|
120
122
|
check('/main.js', 'application/javascript'),
|
|
121
|
-
// check('/lib/jux.js', 'application/javascript') // Removed check
|
|
122
123
|
]).then(() => {
|
|
123
124
|
if (errors.length > 0) {
|
|
124
125
|
console.error(`\n💥 RUNTIME VERIFICATION FAILED (` + errors.length + ` errors):`);
|
|
@@ -126,7 +127,6 @@ export function verifyRuntime(port) {
|
|
|
126
127
|
console.log('');
|
|
127
128
|
resolve(false);
|
|
128
129
|
} else {
|
|
129
|
-
// console.log(' ✓ Runtime health healthy\n');
|
|
130
130
|
resolve(true);
|
|
131
131
|
}
|
|
132
132
|
});
|