@zenithbuild/cli 0.6.9 → 0.6.11
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/build.js +2 -2
- package/dist/toolchain-paths.js +52 -14
- package/dist/toolchain-runner.js +7 -3
- package/package.json +2 -2
package/dist/build.js
CHANGED
|
@@ -19,7 +19,7 @@ import { generateManifest } from './manifest.js';
|
|
|
19
19
|
import { buildComponentRegistry, expandComponents, extractTemplate, isDocumentMode } from './resolve-components.js';
|
|
20
20
|
import { collectExpandedComponentOccurrences } from './component-occurrences.js';
|
|
21
21
|
import { applyOccurrenceRewritePlans, cloneComponentIrForInstance } from './component-instance-ir.js';
|
|
22
|
-
import { resolveBundlerBin
|
|
22
|
+
import { resolveBundlerBin } from './toolchain-paths.js';
|
|
23
23
|
import { createBundlerToolchain, createCompilerToolchain, ensureToolchainCompatibility, getActiveToolchainCandidate, runToolchainSync } from './toolchain-runner.js';
|
|
24
24
|
import { maybeWarnAboutZenithVersionMismatch } from './version-check.js';
|
|
25
25
|
const require = createRequire(import.meta.url);
|
|
@@ -106,7 +106,7 @@ function runCompiler(filePath, stdinSource, compilerOpts = {}, compilerRunOption
|
|
|
106
106
|
: null);
|
|
107
107
|
const compilerBin = !compilerToolchain && typeof compilerRunOptions.compilerBin === 'string'
|
|
108
108
|
? compilerRunOptions.compilerBin
|
|
109
|
-
:
|
|
109
|
+
: null;
|
|
110
110
|
const args = stdinSource !== undefined
|
|
111
111
|
? ['--stdin', filePath]
|
|
112
112
|
: [filePath];
|
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 COMPILER_PLATFORM_PACKAGES = {
|
|
12
|
+
'darwin-arm64': {
|
|
13
|
+
packageName: '@zenithbuild/compiler-darwin-arm64',
|
|
14
|
+
binaryName: 'zenith-compiler'
|
|
15
|
+
},
|
|
16
|
+
'darwin-x64': {
|
|
17
|
+
packageName: '@zenithbuild/compiler-darwin-x64',
|
|
18
|
+
binaryName: 'zenith-compiler'
|
|
19
|
+
},
|
|
20
|
+
'linux-x64': {
|
|
21
|
+
packageName: '@zenithbuild/compiler-linux-x64',
|
|
22
|
+
binaryName: 'zenith-compiler'
|
|
23
|
+
},
|
|
24
|
+
'win32-x64': {
|
|
25
|
+
packageName: '@zenithbuild/compiler-win32-x64',
|
|
26
|
+
binaryName: 'zenith-compiler.exe'
|
|
27
|
+
}
|
|
28
|
+
};
|
|
11
29
|
const BUNDLER_PLATFORM_PACKAGES = {
|
|
12
30
|
'darwin-arm64': {
|
|
13
31
|
packageName: '@zenithbuild/bundler-darwin-arm64',
|
|
@@ -86,8 +104,8 @@ function createCompilerBridgeCandidate(modulePath) {
|
|
|
86
104
|
argsPrefix: [COMPILER_BRIDGE_RUNNER, '--bridge-module', modulePath]
|
|
87
105
|
};
|
|
88
106
|
}
|
|
89
|
-
function
|
|
90
|
-
return
|
|
107
|
+
function currentPlatformPackage(packages) {
|
|
108
|
+
return packages[`${process.platform}-${process.arch}`] || null;
|
|
91
109
|
}
|
|
92
110
|
export function resolveBinary(candidates) {
|
|
93
111
|
for (const candidate of candidates) {
|
|
@@ -133,6 +151,24 @@ export function readCliPackageVersion() {
|
|
|
133
151
|
return '0.0.0';
|
|
134
152
|
}
|
|
135
153
|
}
|
|
154
|
+
function createInstalledPlatformPackageCandidate(tool, packages, projectRoot) {
|
|
155
|
+
const platformPackage = currentPlatformPackage(packages);
|
|
156
|
+
if (!platformPackage) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
const platformPackageRoot = resolvePackageRoot(platformPackage.packageName, projectRoot);
|
|
160
|
+
if (!platformPackageRoot) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
return createBinaryCandidate(tool, 'installed platform package binary', resolve(platformPackageRoot, 'bin', platformPackage.binaryName));
|
|
164
|
+
}
|
|
165
|
+
function createLegacyInstalledPackageCandidate(tool, packageName, binaryName, projectRoot) {
|
|
166
|
+
const installedRoot = resolvePackageRoot(packageName, projectRoot);
|
|
167
|
+
if (!installedRoot) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
return createBinaryCandidate(tool, 'legacy installed package binary', resolve(installedRoot, 'target', 'release', binaryName));
|
|
171
|
+
}
|
|
136
172
|
function compilerWorkspaceBinaryCandidates() {
|
|
137
173
|
return [
|
|
138
174
|
createBinaryCandidate('compiler', 'workspace binary', resolve(CLI_ROOT, '../compiler/target/release/zenith-compiler')),
|
|
@@ -154,11 +190,16 @@ export function compilerCommandCandidates(projectRoot = null, env = process.env)
|
|
|
154
190
|
explicit: true
|
|
155
191
|
});
|
|
156
192
|
}
|
|
157
|
-
const
|
|
158
|
-
if (
|
|
159
|
-
candidates.push(
|
|
193
|
+
const platformCandidate = createInstalledPlatformPackageCandidate('compiler', COMPILER_PLATFORM_PACKAGES, projectRoot);
|
|
194
|
+
if (platformCandidate) {
|
|
195
|
+
candidates.push(platformCandidate);
|
|
196
|
+
}
|
|
197
|
+
const legacyCandidate = createLegacyInstalledPackageCandidate('compiler', '@zenithbuild/compiler', IS_WINDOWS ? 'zenith-compiler.exe' : 'zenith-compiler', projectRoot);
|
|
198
|
+
if (legacyCandidate) {
|
|
199
|
+
candidates.push(legacyCandidate);
|
|
160
200
|
}
|
|
161
201
|
candidates.push(...compilerWorkspaceBinaryCandidates());
|
|
202
|
+
const installedRoot = resolvePackageRoot('@zenithbuild/compiler', projectRoot);
|
|
162
203
|
if (installedRoot) {
|
|
163
204
|
const bridgeCandidate = createCompilerBridgeCandidate(resolve(installedRoot, 'dist/index.js'));
|
|
164
205
|
if (bridgeCandidate) {
|
|
@@ -184,16 +225,13 @@ export function bundlerCommandCandidates(projectRoot = null, env = process.env)
|
|
|
184
225
|
explicit: true
|
|
185
226
|
});
|
|
186
227
|
}
|
|
187
|
-
const
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
if (platformPackageRoot) {
|
|
191
|
-
candidates.push(createBinaryCandidate('bundler', 'installed platform package binary', resolve(platformPackageRoot, 'bin', platformPackage.binaryName)));
|
|
192
|
-
}
|
|
228
|
+
const platformCandidate = createInstalledPlatformPackageCandidate('bundler', BUNDLER_PLATFORM_PACKAGES, projectRoot);
|
|
229
|
+
if (platformCandidate) {
|
|
230
|
+
candidates.push(platformCandidate);
|
|
193
231
|
}
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
196
|
-
candidates.push(
|
|
232
|
+
const legacyCandidate = createLegacyInstalledPackageCandidate('bundler', '@zenithbuild/bundler', IS_WINDOWS ? 'zenith-bundler.exe' : 'zenith-bundler', projectRoot);
|
|
233
|
+
if (legacyCandidate) {
|
|
234
|
+
candidates.push(legacyCandidate);
|
|
197
235
|
}
|
|
198
236
|
candidates.push(...bundlerWorkspaceBinaryCandidates());
|
|
199
237
|
return candidates;
|
package/dist/toolchain-runner.js
CHANGED
|
@@ -9,6 +9,7 @@ const INCOMPATIBLE_STDERR_PATTERNS = [
|
|
|
9
9
|
/cannot execute binary file/i,
|
|
10
10
|
/not a valid win32 application/i
|
|
11
11
|
];
|
|
12
|
+
const INSTALL_COMPATIBILITY_DOC = 'https://github.com/zenithbuild/framework/blob/master/docs/documentation/install-compatibility.md';
|
|
12
13
|
function currentPlatformLabel() {
|
|
13
14
|
return `${process.platform}-${process.arch}`;
|
|
14
15
|
}
|
|
@@ -56,14 +57,17 @@ function emitFallbackWarning(toolchain, nextCandidate) {
|
|
|
56
57
|
function missingToolchainError(toolchain) {
|
|
57
58
|
if (toolchain.tool === 'bundler') {
|
|
58
59
|
return new Error(`[zenith] Bundler binary not installed for ${process.platform}/${process.arch}. ` +
|
|
59
|
-
|
|
60
|
+
`Reinstall @zenithbuild/bundler and ensure the matching platform package is installed. ` +
|
|
61
|
+
`See ${INSTALL_COMPATIBILITY_DOC}.`);
|
|
60
62
|
}
|
|
61
63
|
return new Error(`[zenith] ${toolchain.tool} binary not installed for ${currentPlatformLabel()}; ` +
|
|
62
|
-
`reinstall or set ${toolEnvVar(toolchain.tool)}
|
|
64
|
+
`reinstall, ensure the matching platform package is installed, or set ${toolEnvVar(toolchain.tool)}=... ` +
|
|
65
|
+
`See ${INSTALL_COMPATIBILITY_DOC}.`);
|
|
63
66
|
}
|
|
64
67
|
function incompatibleBinaryError(toolchain) {
|
|
65
68
|
return new Error(`[zenith] ${toolchain.tool} binary is incompatible for ${currentPlatformLabel()}; ` +
|
|
66
|
-
`reinstall or set ${toolEnvVar(toolchain.tool)}
|
|
69
|
+
`reinstall, clear the wrong-platform package, or set ${toolEnvVar(toolchain.tool)}=... ` +
|
|
70
|
+
`See ${INSTALL_COMPATIBILITY_DOC}.`);
|
|
67
71
|
}
|
|
68
72
|
function toolchainProbeError(toolchain, result) {
|
|
69
73
|
const detail = result?.error?.message
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenithbuild/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.11",
|
|
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.11",
|
|
38
38
|
"picocolors": "^1.1.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|