@zenithbuild/cli 0.6.7 → 0.6.9
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/dist/toolchain-paths.js +28 -0
- package/dist/toolchain-runner.js +26 -2
- package/dist/ui/format.js +1 -1
- package/package.json +2 -2
package/dist/toolchain-paths.js
CHANGED
|
@@ -8,6 +8,24 @@ const CLI_ROOT = resolve(__dirname, '..');
|
|
|
8
8
|
const localRequire = createRequire(import.meta.url);
|
|
9
9
|
const IS_WINDOWS = process.platform === 'win32';
|
|
10
10
|
const COMPILER_BRIDGE_RUNNER = resolve(__dirname, 'compiler-bridge-runner.js');
|
|
11
|
+
const BUNDLER_PLATFORM_PACKAGES = {
|
|
12
|
+
'darwin-arm64': {
|
|
13
|
+
packageName: '@zenithbuild/bundler-darwin-arm64',
|
|
14
|
+
binaryName: 'zenith-bundler'
|
|
15
|
+
},
|
|
16
|
+
'darwin-x64': {
|
|
17
|
+
packageName: '@zenithbuild/bundler-darwin-x64',
|
|
18
|
+
binaryName: 'zenith-bundler'
|
|
19
|
+
},
|
|
20
|
+
'linux-x64': {
|
|
21
|
+
packageName: '@zenithbuild/bundler-linux-x64',
|
|
22
|
+
binaryName: 'zenith-bundler'
|
|
23
|
+
},
|
|
24
|
+
'win32-x64': {
|
|
25
|
+
packageName: '@zenithbuild/bundler-win32-x64',
|
|
26
|
+
binaryName: 'zenith-bundler.exe'
|
|
27
|
+
}
|
|
28
|
+
};
|
|
11
29
|
function safeCreateRequire(projectRoot) {
|
|
12
30
|
if (!projectRoot) {
|
|
13
31
|
return localRequire;
|
|
@@ -68,6 +86,9 @@ function createCompilerBridgeCandidate(modulePath) {
|
|
|
68
86
|
argsPrefix: [COMPILER_BRIDGE_RUNNER, '--bridge-module', modulePath]
|
|
69
87
|
};
|
|
70
88
|
}
|
|
89
|
+
function currentBundlerPlatformPackage() {
|
|
90
|
+
return BUNDLER_PLATFORM_PACKAGES[`${process.platform}-${process.arch}`] || null;
|
|
91
|
+
}
|
|
71
92
|
export function resolveBinary(candidates) {
|
|
72
93
|
for (const candidate of candidates) {
|
|
73
94
|
const path = typeof candidate === 'string' ? candidate : candidate.path;
|
|
@@ -163,6 +184,13 @@ export function bundlerCommandCandidates(projectRoot = null, env = process.env)
|
|
|
163
184
|
explicit: true
|
|
164
185
|
});
|
|
165
186
|
}
|
|
187
|
+
const platformPackage = currentBundlerPlatformPackage();
|
|
188
|
+
if (platformPackage) {
|
|
189
|
+
const platformPackageRoot = resolvePackageRoot(platformPackage.packageName, projectRoot);
|
|
190
|
+
if (platformPackageRoot) {
|
|
191
|
+
candidates.push(createBinaryCandidate('bundler', 'installed platform package binary', resolve(platformPackageRoot, 'bin', platformPackage.binaryName)));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
166
194
|
const installedRoot = resolvePackageRoot('@zenithbuild/bundler', projectRoot);
|
|
167
195
|
if (installedRoot) {
|
|
168
196
|
candidates.push(createBinaryCandidate('bundler', 'installed package binary', resolve(installedRoot, 'target/release/zenith-bundler')));
|
package/dist/toolchain-runner.js
CHANGED
|
@@ -53,6 +53,14 @@ function emitFallbackWarning(toolchain, nextCandidate) {
|
|
|
53
53
|
FALLBACK_LOG_KEYS.add(onceKey);
|
|
54
54
|
console.warn(message);
|
|
55
55
|
}
|
|
56
|
+
function missingToolchainError(toolchain) {
|
|
57
|
+
if (toolchain.tool === 'bundler') {
|
|
58
|
+
return new Error(`[zenith] Bundler binary not installed for ${process.platform}/${process.arch}. ` +
|
|
59
|
+
'Reinstall @zenithbuild/bundler or ensure optional dependency installed.');
|
|
60
|
+
}
|
|
61
|
+
return new Error(`[zenith] ${toolchain.tool} binary not installed for ${currentPlatformLabel()}; ` +
|
|
62
|
+
`reinstall or set ${toolEnvVar(toolchain.tool)}=...`);
|
|
63
|
+
}
|
|
56
64
|
function incompatibleBinaryError(toolchain) {
|
|
57
65
|
return new Error(`[zenith] ${toolchain.tool} binary is incompatible for ${currentPlatformLabel()}; ` +
|
|
58
66
|
`reinstall or set ${toolEnvVar(toolchain.tool)}=...`);
|
|
@@ -115,6 +123,14 @@ export function ensureToolchainCompatibility(toolchain, probeArgs = ['--version'
|
|
|
115
123
|
if (!candidate) {
|
|
116
124
|
break;
|
|
117
125
|
}
|
|
126
|
+
if (!candidateExists(candidate)) {
|
|
127
|
+
const nextIndex = findNextFallbackIndex(toolchain, probeArgs);
|
|
128
|
+
if (nextIndex === -1) {
|
|
129
|
+
throw missingToolchainError(toolchain);
|
|
130
|
+
}
|
|
131
|
+
toolchain.activeIndex = nextIndex;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
118
134
|
if (!candidateSupportsArgs(candidate, probeArgs)) {
|
|
119
135
|
const nextIndex = findNextFallbackIndex(toolchain, probeArgs);
|
|
120
136
|
if (nextIndex === -1) {
|
|
@@ -138,7 +154,7 @@ export function ensureToolchainCompatibility(toolchain, probeArgs = ['--version'
|
|
|
138
154
|
toolchain.activeIndex = nextIndex;
|
|
139
155
|
emitFallbackWarning(toolchain, toolchain.candidates[nextIndex]);
|
|
140
156
|
}
|
|
141
|
-
throw
|
|
157
|
+
throw missingToolchainError(toolchain);
|
|
142
158
|
}
|
|
143
159
|
export function runToolchainSync(toolchain, args, spawnOptions = { encoding: 'utf8' }) {
|
|
144
160
|
while (toolchain.activeIndex < toolchain.candidates.length) {
|
|
@@ -146,6 +162,14 @@ export function runToolchainSync(toolchain, args, spawnOptions = { encoding: 'ut
|
|
|
146
162
|
if (!candidate) {
|
|
147
163
|
break;
|
|
148
164
|
}
|
|
165
|
+
if (!candidateExists(candidate)) {
|
|
166
|
+
const nextIndex = findNextFallbackIndex(toolchain, args);
|
|
167
|
+
if (nextIndex === -1) {
|
|
168
|
+
throw missingToolchainError(toolchain);
|
|
169
|
+
}
|
|
170
|
+
toolchain.activeIndex = nextIndex;
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
149
173
|
if (!candidateSupportsArgs(candidate, args)) {
|
|
150
174
|
const nextIndex = findNextFallbackIndex(toolchain, args);
|
|
151
175
|
if (nextIndex === -1) {
|
|
@@ -166,5 +190,5 @@ export function runToolchainSync(toolchain, args, spawnOptions = { encoding: 'ut
|
|
|
166
190
|
toolchain.activeIndex = nextIndex;
|
|
167
191
|
emitFallbackWarning(toolchain, toolchain.candidates[nextIndex]);
|
|
168
192
|
}
|
|
169
|
-
throw
|
|
193
|
+
throw missingToolchainError(toolchain);
|
|
170
194
|
}
|
package/dist/ui/format.js
CHANGED
|
@@ -2,7 +2,7 @@ import pc from 'picocolors';
|
|
|
2
2
|
import { relative, sep } from 'node:path';
|
|
3
3
|
const DEFAULT_PHASE = 'cli';
|
|
4
4
|
const DEFAULT_FILE = '.';
|
|
5
|
-
const DEFAULT_HINT_BASE = 'https://github.com/zenithbuild/
|
|
5
|
+
const DEFAULT_HINT_BASE = 'https://github.com/zenithbuild/framework/blob/master/packages/cli/CLI_CONTRACT.md';
|
|
6
6
|
const PREFIX = '[zenith]';
|
|
7
7
|
const TAG_WIDTH = 6;
|
|
8
8
|
const TAG_COLORS = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenithbuild/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"description": "Deterministic project orchestrator for Zenith framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"prepublishOnly": "npm run build"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@zenithbuild/compiler": "0.6.
|
|
37
|
+
"@zenithbuild/compiler": "0.6.9",
|
|
38
38
|
"picocolors": "^1.1.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|