vize 0.315.1 → 0.321.0
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/cli.mjs +55 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-BcMf3hSM.d.mts → config-DGT1b9h8.d.mts} +57 -9
- package/dist/config-DGT1b9h8.d.mts.map +1 -0
- package/dist/config.d.mts +1 -1
- package/dist/index.d.mts +1 -1
- package/package.json +3 -3
- package/pkl/CompilerConfig.pkl +4 -0
- package/pkl/jsonschema/ConfigArtifactDefinitions.pkl +205 -0
- package/pkl/jsonschema/generate.pkl +30 -79
- package/pkl/vize.pkl +13 -0
- package/schemas/vize.config.schema.json +152 -42
- package/src/cli.ts +2 -0
- package/src/corsa-runtime.ts +97 -0
- package/src/types/generated.ts +62 -8
- package/dist/config-BcMf3hSM.d.mts.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,59 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
4
5
|
import { execFileSync } from "node:child_process";
|
|
5
6
|
import readline from "node:readline";
|
|
7
|
+
//#region src/corsa-runtime.ts
|
|
8
|
+
const publicCorsaEnvironmentVariables = [
|
|
9
|
+
"CORSA_PATH",
|
|
10
|
+
"CORSA_EXECUTABLE",
|
|
11
|
+
"TSGO_PATH",
|
|
12
|
+
"TSGO_EXECUTABLE"
|
|
13
|
+
];
|
|
14
|
+
function configureBundledCorsaRuntime(environment = process.env, options = {}) {
|
|
15
|
+
if (hasPublicRuntimeOverride(environment)) return null;
|
|
16
|
+
const executable = resolveBundledCorsaRuntime(options);
|
|
17
|
+
if (executable == null) return null;
|
|
18
|
+
environment.CORSA_PATH = executable;
|
|
19
|
+
return executable;
|
|
20
|
+
}
|
|
21
|
+
function resolveBundledCorsaRuntime(options = {}) {
|
|
22
|
+
const packageRoot = options.packageRoot ?? path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
23
|
+
const platform = options.platform ?? process.platform;
|
|
24
|
+
const arch = options.arch ?? process.arch;
|
|
25
|
+
try {
|
|
26
|
+
const cliManifestPath = path.join(packageRoot, "package.json");
|
|
27
|
+
const declaredMetaVersion = readManifest(cliManifestPath).optionalDependencies?.["@typescript/native-preview"];
|
|
28
|
+
if (typeof declaredMetaVersion !== "string") return null;
|
|
29
|
+
const metaManifestPath = createRequire(cliManifestPath).resolve("@typescript/native-preview/package.json");
|
|
30
|
+
const metaManifest = readManifest(metaManifestPath);
|
|
31
|
+
if (metaManifest.name !== "@typescript/native-preview" || !matchesDeclaredVersion(metaManifest.version, declaredMetaVersion)) return null;
|
|
32
|
+
const platformPackage = `@typescript/native-preview-${platform}-${arch}`;
|
|
33
|
+
const declaredPlatformVersion = metaManifest.optionalDependencies?.[platformPackage];
|
|
34
|
+
if (typeof declaredPlatformVersion !== "string") return null;
|
|
35
|
+
const platformManifestPath = createRequire(metaManifestPath).resolve(`${platformPackage}/package.json`);
|
|
36
|
+
const platformManifest = readManifest(platformManifestPath);
|
|
37
|
+
if (platformManifest.name !== platformPackage || !matchesDeclaredVersion(platformManifest.version, declaredPlatformVersion)) return null;
|
|
38
|
+
const executable = path.join(path.dirname(platformManifestPath), "lib", platform === "win32" ? "tsgo.exe" : "tsgo");
|
|
39
|
+
return fs.existsSync(executable) ? executable : null;
|
|
40
|
+
} catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function hasPublicRuntimeOverride(environment) {
|
|
45
|
+
return publicCorsaEnvironmentVariables.some((name) => {
|
|
46
|
+
const value = environment[name];
|
|
47
|
+
return value != null && value !== "";
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function matchesDeclaredVersion(actual, declared) {
|
|
51
|
+
return typeof actual === "string" && (declared.startsWith("catalog:") || actual === declared);
|
|
52
|
+
}
|
|
53
|
+
function readManifest(filename) {
|
|
54
|
+
return JSON.parse(fs.readFileSync(filename, "utf8"));
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
6
57
|
//#region src/setup/config.ts
|
|
7
58
|
const VIZE_CONFIG_FILES = [
|
|
8
59
|
"vize.config.pkl",
|
|
@@ -1980,7 +2031,10 @@ try {
|
|
|
1980
2031
|
const args = process.argv.slice(2);
|
|
1981
2032
|
if (args[0] === "setup") runSetupCli(args.slice(1));
|
|
1982
2033
|
else if (args[0] === "init") runInitCli(args.slice(1)).catch(fail);
|
|
1983
|
-
else
|
|
2034
|
+
else {
|
|
2035
|
+
configureBundledCorsaRuntime();
|
|
2036
|
+
require("@vizejs/native").runCli(args);
|
|
2037
|
+
}
|
|
1984
2038
|
} catch (error) {
|
|
1985
2039
|
fail(error);
|
|
1986
2040
|
}
|