juxscript 1.0.74 → 1.0.75
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 +7 -1
- package/package.json +1 -1
package/machinery/compiler.js
CHANGED
|
@@ -206,7 +206,8 @@ export async function bundleJuxFilesToRouter(projectRoot, distDir, options = {})
|
|
|
206
206
|
|
|
207
207
|
// ✅ CHECK: Is this import pointing to a file we are bundling?
|
|
208
208
|
let isBundledLocal = false;
|
|
209
|
-
|
|
209
|
+
// Support relative (./, ../) OR project-root relative (/) imports
|
|
210
|
+
if (moduleName.startsWith('.') || moduleName.startsWith('/')) {
|
|
210
211
|
const resolved = resolveImportPath(moduleName, relativePath);
|
|
211
212
|
if (bundledPaths.has(resolved)) {
|
|
212
213
|
isBundledLocal = true;
|
|
@@ -338,6 +339,7 @@ function transformJuxToViewFunction(juxContent, functionName, pageName, relative
|
|
|
338
339
|
const resolvedPath = resolveImportPath(importPath, relativePath);
|
|
339
340
|
|
|
340
341
|
// ✅ Check if this import is pointing to a bundled file
|
|
342
|
+
// Handle BOTH relative and absolute-relative imports (starting with /)
|
|
341
343
|
const isBundled = (bundledPaths && bundledPaths.has(resolvedPath)) || importPath.endsWith('.jux');
|
|
342
344
|
|
|
343
345
|
if (isBundled) {
|
|
@@ -383,6 +385,10 @@ JuxError.register('${cleanName}', '${relativePath}');
|
|
|
383
385
|
}
|
|
384
386
|
|
|
385
387
|
function resolveImportPath(importPath, currentFilePath) {
|
|
388
|
+
// ✅ FIX: Handle root-relative imports (start with /)
|
|
389
|
+
if (importPath.startsWith('/')) {
|
|
390
|
+
return importPath.substring(1).replace(/\\/g, '/');
|
|
391
|
+
}
|
|
386
392
|
const currentDir = path.dirname(currentFilePath);
|
|
387
393
|
return path.join(currentDir, importPath).replace(/\\/g, '/');
|
|
388
394
|
}
|