juxscript 1.1.349 ā 1.1.350
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/compiler4.js +61 -2
- package/package.json +1 -1
package/machinery/compiler4.js
CHANGED
|
@@ -26,29 +26,88 @@ export class JuxCompiler {
|
|
|
26
26
|
findJuxscriptPath() {
|
|
27
27
|
if (this._juxscriptPath) return this._juxscriptPath;
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
29
|
const projectRoot = process.cwd();
|
|
32
30
|
|
|
31
|
+
// 1. User's project node_modules (standard npm install)
|
|
33
32
|
const userPath = path.resolve(projectRoot, 'node_modules/juxscript/dist/lib/index.js');
|
|
34
33
|
if (fs.existsSync(userPath)) {
|
|
34
|
+
console.log(`š¦ Using: ${userPath}`);
|
|
35
35
|
this._juxscriptPath = userPath;
|
|
36
36
|
return userPath;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
// 2. User's project node_modules ā flat dist
|
|
40
|
+
const userPathFlat = path.resolve(projectRoot, 'node_modules/juxscript/dist/index.js');
|
|
41
|
+
if (fs.existsSync(userPathFlat)) {
|
|
42
|
+
console.log(`š¦ Using: ${userPathFlat}`);
|
|
43
|
+
this._juxscriptPath = userPathFlat;
|
|
44
|
+
return userPathFlat;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 3. Dev mode ā built from parent package
|
|
39
48
|
const packageRoot = path.resolve(__dirname, '..');
|
|
40
49
|
const devPath = path.resolve(packageRoot, 'dist', 'lib', 'index.js');
|
|
41
50
|
if (fs.existsSync(devPath)) {
|
|
51
|
+
console.log(`š¦ Using (dev): ${devPath}`);
|
|
42
52
|
this._juxscriptPath = devPath;
|
|
43
53
|
return devPath;
|
|
44
54
|
}
|
|
45
55
|
|
|
56
|
+
// 4. Dev mode ā flat dist
|
|
57
|
+
const devPathFlat = path.resolve(packageRoot, 'dist', 'index.js');
|
|
58
|
+
if (fs.existsSync(devPathFlat)) {
|
|
59
|
+
console.log(`š¦ Using (dev flat): ${devPathFlat}`);
|
|
60
|
+
this._juxscriptPath = devPathFlat;
|
|
61
|
+
return devPathFlat;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 5. Monorepo sibling
|
|
46
65
|
const monoPath = path.resolve(projectRoot, '../jux/dist/lib/index.js');
|
|
47
66
|
if (fs.existsSync(monoPath)) {
|
|
67
|
+
console.log(`š¦ Using (mono): ${monoPath}`);
|
|
48
68
|
this._juxscriptPath = monoPath;
|
|
49
69
|
return monoPath;
|
|
50
70
|
}
|
|
51
71
|
|
|
72
|
+
// 6. Try require.resolve as last resort
|
|
73
|
+
try {
|
|
74
|
+
const resolved = require.resolve('juxscript');
|
|
75
|
+
if (fs.existsSync(resolved)) {
|
|
76
|
+
console.log(`š¦ Using (resolved): ${resolved}`);
|
|
77
|
+
this._juxscriptPath = resolved;
|
|
78
|
+
return resolved;
|
|
79
|
+
}
|
|
80
|
+
} catch (_) { }
|
|
81
|
+
|
|
82
|
+
// Debug: show what was checked
|
|
83
|
+
console.error('ā Searched for juxscript at:');
|
|
84
|
+
console.error(` ${userPath}`);
|
|
85
|
+
console.error(` ${userPathFlat}`);
|
|
86
|
+
console.error(` ${devPath}`);
|
|
87
|
+
console.error(` ${devPathFlat}`);
|
|
88
|
+
console.error(` ${monoPath}`);
|
|
89
|
+
|
|
90
|
+
// Check if node_modules/juxscript exists at all
|
|
91
|
+
const juxscriptDir = path.resolve(projectRoot, 'node_modules/juxscript');
|
|
92
|
+
if (fs.existsSync(juxscriptDir)) {
|
|
93
|
+
console.error(`\nš node_modules/juxscript exists. Contents:`);
|
|
94
|
+
try {
|
|
95
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(juxscriptDir, 'package.json'), 'utf8'));
|
|
96
|
+
console.error(` main: ${pkg.main}`);
|
|
97
|
+
console.error(` types: ${pkg.types}`);
|
|
98
|
+
if (pkg.exports) console.error(` exports: ${JSON.stringify(pkg.exports)}`);
|
|
99
|
+
} catch (_) { }
|
|
100
|
+
const distDir = path.join(juxscriptDir, 'dist');
|
|
101
|
+
if (fs.existsSync(distDir)) {
|
|
102
|
+
const files = fs.readdirSync(distDir, { recursive: true });
|
|
103
|
+
console.error(` dist/ files: ${files.slice(0, 20).join(', ')}${files.length > 20 ? '...' : ''}`);
|
|
104
|
+
} else {
|
|
105
|
+
console.error(` ā ļø dist/ directory missing ā lib may not be built`);
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
console.error(`\nā ļø node_modules/juxscript does not exist ā run: npm install juxscript`);
|
|
109
|
+
}
|
|
110
|
+
|
|
52
111
|
return null;
|
|
53
112
|
}
|
|
54
113
|
|