juxscript 1.1.135 → 1.1.136
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/dom-structure-map.json +1 -1
- package/machinery/compiler3.js +30 -5
- package/package.json +1 -1
package/dom-structure-map.json
CHANGED
package/machinery/compiler3.js
CHANGED
|
@@ -81,12 +81,18 @@ export class JuxCompiler {
|
|
|
81
81
|
const relativePath = path.relative(this.srcDir, fullPath);
|
|
82
82
|
const name = relativePath.replace(/\.[^/.]+$/, ''); // Remove extension
|
|
83
83
|
|
|
84
|
-
// ✅
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
// ✅ Generate unique key that includes full path to avoid collisions
|
|
85
|
+
// This handles cases like:
|
|
86
|
+
// - apps/audits/audits.jux → apps_audits_audits
|
|
87
|
+
// - apps/audits.jux → apps_audits
|
|
88
|
+
const uniqueKey = name.replace(/[\/\\]/g, '_').replace(/[^a-zA-Z0-9_]/g, '_');
|
|
89
|
+
|
|
90
|
+
// ✅ Skip if we've already processed this exact path
|
|
91
|
+
if (processedNames.has(uniqueKey)) {
|
|
92
|
+
console.warn(`⚠️ Skipping duplicate: ${relativePath} (already processed as ${uniqueKey})`);
|
|
87
93
|
continue;
|
|
88
94
|
}
|
|
89
|
-
processedNames.add(
|
|
95
|
+
processedNames.add(uniqueKey);
|
|
90
96
|
|
|
91
97
|
if (file.includes('data')) {
|
|
92
98
|
dataModules.push({ name, file: relativePath, content });
|
|
@@ -250,6 +256,17 @@ export class JuxCompiler {
|
|
|
250
256
|
|
|
251
257
|
const capitalized = sanitizedName.charAt(0).toUpperCase() + sanitizedName.slice(1);
|
|
252
258
|
|
|
259
|
+
// ✅ Check for duplicate function names and warn
|
|
260
|
+
const functionName = `render${capitalized}`;
|
|
261
|
+
if (sourceSnapshot[functionName]) {
|
|
262
|
+
console.error(`❌ DUPLICATE FUNCTION NAME: ${functionName}`);
|
|
263
|
+
console.error(` Conflict between:`);
|
|
264
|
+
console.error(` 1. ${sourceSnapshot[functionName].file}`);
|
|
265
|
+
console.error(` 2. ${v.file}`);
|
|
266
|
+
console.error(` This will cause a build error. Rename one of these files.`);
|
|
267
|
+
throw new Error(`Duplicate function name: ${functionName}`);
|
|
268
|
+
}
|
|
269
|
+
|
|
253
270
|
sourceSnapshot[v.file] = {
|
|
254
271
|
name: v.name,
|
|
255
272
|
file: v.file,
|
|
@@ -257,11 +274,19 @@ export class JuxCompiler {
|
|
|
257
274
|
lines: v.content.split('\n')
|
|
258
275
|
};
|
|
259
276
|
|
|
277
|
+
// ✅ Also track by function name to catch duplicates
|
|
278
|
+
sourceSnapshot[functionName] = {
|
|
279
|
+
name: v.name,
|
|
280
|
+
file: v.file,
|
|
281
|
+
content: v.content,
|
|
282
|
+
lines: v.content.split('\n')
|
|
283
|
+
};
|
|
284
|
+
|
|
260
285
|
let viewCode = this.removeImports(v.content).replace(/^\s*export\s+default\s+.*$/gm, '');
|
|
261
286
|
const asyncPrefix = viewCode.includes('await ') ? 'async ' : '';
|
|
262
287
|
|
|
263
288
|
// ✅ Use sanitized name in function declaration
|
|
264
|
-
entry += `\n${asyncPrefix}function
|
|
289
|
+
entry += `\n${asyncPrefix}function ${functionName}() {\n${viewCode}\n}\n`;
|
|
265
290
|
});
|
|
266
291
|
|
|
267
292
|
dataModules.forEach(m => {
|