vize 0.605.0 → 0.607.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/README.md CHANGED
@@ -60,10 +60,25 @@ For manual installation:
60
60
  vp install -D vize
61
61
  ```
62
62
 
63
- The package declares TypeScript 7's native Corsa runtime as an optional dependency, so standard
64
- installs include the runtime needed by `vize check`. The `--corsa-path` CLI option remains available
65
- for custom native TypeScript builds. For project type checking, prefer TypeScript 7.1's content
66
- mapper, documented below. tsrs can run that same project.
63
+ The native TypeScript compiler is provided by your project, not bundled or downloaded by Vize.
64
+ For project type checking, install `typescript@7.1.0-beta` and use its content mapper as described
65
+ in the [Type Checking guide](https://vizejs.dev/guide/type-checking). `vize check`, the language
66
+ server, and type-aware linting use the same native runtime resolver. Explicit runtime settings
67
+ such as `--corsa-path`, `typeChecker.corsaPath`, and `CORSA_PATH` take priority over discovery in
68
+ the selected project's dependency graph. Global compiler installations require an explicit path;
69
+ Vize does not search `HOME`, global npm installations, or `PATH`. A missing runtime reports an actionable error;
70
+ formatting and other commands that do not need type information remain available.
71
+
72
+ To keep TypeScript 6 for other tools, install the native compiler under an npm alias:
73
+
74
+ ```bash
75
+ vp install -D typescript-native@npm:typescript@7.1.0-beta
76
+ ```
77
+
78
+ Vize does not declare a compiler peer dependency, because a canonical `typescript` package,
79
+ a project alias, and an explicitly configured external executable are all valid runtime sources.
80
+ The selected compiler must support the operation being requested; a TypeScript 6 JavaScript
81
+ compiler is not a native checker runtime.
67
82
 
68
83
  ## Package Scripts
69
84
 
@@ -189,8 +204,8 @@ Lint output supports `text`, `ansi`, `plain`, `json`, `stylish`, `markdown`, `ht
189
204
  The human and agent-friendly formats include local rule documentation paths such as
190
205
  `docs/content/rules/vue.md`.
191
206
 
192
- `vize check` in the npm package uses the packaged NAPI checker and TypeScript 7's native Corsa
193
- runtime, so it can run from `package.json` scripts after installing `vize`:
207
+ `vize check` in the npm package uses the packaged NAPI checker and the native TypeScript runtime
208
+ installed by your project, so it can run from `package.json` scripts after installing both:
194
209
 
195
210
  ```json
196
211
  {
package/dist/cli.mjs CHANGED
@@ -1,76 +1,8 @@
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";
5
4
  import { execFileSync } from "node:child_process";
6
5
  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 cliManifest = readManifest(cliManifestPath);
28
- const packageRequire = createRequire(cliManifestPath);
29
- const platformPackage = `@typescript/typescript-${platform}-${arch}`;
30
- const declaredBundledPlatformVersion = cliManifest.optionalDependencies?.[platformPackage];
31
- if (typeof declaredBundledPlatformVersion === "string") {
32
- const platformManifestPath = packageRequire.resolve(`${platformPackage}/package.json`);
33
- const platformManifest = readManifest(platformManifestPath);
34
- if (platformManifest.name !== platformPackage || !isTypeScriptSevenOrNewer(platformManifest.version) || !matchesDeclaredVersion(platformManifest.version, declaredBundledPlatformVersion)) return null;
35
- return resolvePlatformExecutable(platformManifestPath, platform);
36
- }
37
- const declaredMetaVersion = cliManifest.optionalDependencies?.typescript;
38
- if (typeof declaredMetaVersion !== "string") return null;
39
- const metaManifestPath = packageRequire.resolve("typescript/package.json");
40
- const metaManifest = readManifest(metaManifestPath);
41
- if (metaManifest.name !== "typescript" || !isTypeScriptSevenOrNewer(metaManifest.version) || !matchesDeclaredVersion(metaManifest.version, declaredMetaVersion)) return null;
42
- const declaredPlatformVersion = metaManifest.optionalDependencies?.[platformPackage];
43
- if (typeof declaredPlatformVersion !== "string") return null;
44
- const platformManifestPath = createRequire(metaManifestPath).resolve(`${platformPackage}/package.json`);
45
- const platformManifest = readManifest(platformManifestPath);
46
- if (platformManifest.name !== platformPackage || !matchesDeclaredVersion(platformManifest.version, declaredPlatformVersion)) return null;
47
- return resolvePlatformExecutable(platformManifestPath, platform);
48
- } catch {
49
- return null;
50
- }
51
- }
52
- function resolvePlatformExecutable(platformManifestPath, platform) {
53
- const executable = path.join(path.dirname(platformManifestPath), "lib", platform === "win32" ? "tsc.exe" : "tsc");
54
- return fs.existsSync(executable) ? executable : null;
55
- }
56
- function hasPublicRuntimeOverride(environment) {
57
- return publicCorsaEnvironmentVariables.some((name) => {
58
- const value = environment[name];
59
- return value != null && value !== "";
60
- });
61
- }
62
- function matchesDeclaredVersion(actual, declared) {
63
- return typeof actual === "string" && (declared.startsWith("catalog:") || actual === declared);
64
- }
65
- function isTypeScriptSevenOrNewer(version) {
66
- if (typeof version !== "string") return false;
67
- const major = Number.parseInt(version.split(".")[0] ?? "", 10);
68
- return Number.isFinite(major) && major >= 7;
69
- }
70
- function readManifest(filename) {
71
- return JSON.parse(fs.readFileSync(filename, "utf8"));
72
- }
73
- //#endregion
74
6
  //#region src/setup/config.ts
75
7
  const VIZE_CONFIG_FILES = [
76
8
  "vize.config.pkl",
@@ -2069,10 +2001,7 @@ try {
2069
2001
  const args = process.argv.slice(2);
2070
2002
  if (args[0] === "setup") runSetupCli(args.slice(1));
2071
2003
  else if (args[0] === "init") runInitCli(args.slice(1)).catch(fail);
2072
- else {
2073
- configureBundledCorsaRuntime();
2074
- require("@vizejs/native").runCli(args);
2075
- }
2004
+ else require("@vizejs/native").runCli(args);
2076
2005
  } catch (error) {
2077
2006
  fail(error);
2078
2007
  }