vize 0.49.0 → 0.52.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
@@ -1,46 +1,30 @@
1
1
  # Vize
2
2
 
3
- High-performance Vue.js toolchain in Rust.
3
+ The `vize` npm package provides:
4
4
 
5
- ## Installation
6
-
7
- ```bash
8
- # Install globally
9
- npm install -g vize
5
+ - shared config utilities (`defineConfig`, `loadConfig`)
6
+ - the native `vize lint` command
10
7
 
11
- # Or add it to a project
12
- npm install -D vize
8
+ For Vite integration, pair it with `@vizejs/vite-plugin`.
9
+ For the full Rust-native CLI (`build`, `fmt`, `check`, `lsp`, `ide`), install the Rust `vize`
10
+ binary with `cargo install vize`.
13
11
 
14
- # Or install from GitHub
15
- npm install -g github:ubugeeei/vize
16
- ```
17
-
18
- If you use `@vizejs/vite-plugin` and want one shared config for both the plugin and the `vize`
19
- CLI, install both packages in the project and put your config in `vize.config.*`.
20
-
21
- ## Usage
12
+ ## Installation
22
13
 
23
14
  ```bash
24
- vize [COMMAND] [OPTIONS]
15
+ pnpm add -D vize
25
16
  ```
26
17
 
27
- | Command | Description |
28
- | ------- | ------------------------------------- |
29
- | `build` | Compile Vue SFC files (default) |
30
- | `fmt` | Format Vue SFC files |
31
- | `lint` | Lint Vue SFC files |
32
- | `check` | Type check Vue SFC files |
33
- | `musea` | Start component gallery server |
34
- | `lsp` | Start Language Server Protocol server |
18
+ ## CLI
19
+
20
+ The npm CLI currently exposes `lint`:
35
21
 
36
22
  ```bash
37
- vize --help # Show help
38
- vize <command> --help # Show command-specific help
23
+ pnpm exec vize lint src
24
+ pnpm exec vize lint --preset opinionated --help-level short src
39
25
  ```
40
26
 
41
- ## Config
42
-
43
- `vize` looks for these files in the project root:
27
+ Shared config discovery is supported for the npm CLI:
44
28
 
45
29
  - `vize.config.ts`
46
30
  - `vize.config.js`
@@ -48,8 +32,6 @@ vize <command> --help # Show command-specific help
48
32
  - `vize.config.pkl`
49
33
  - `vize.config.json`
50
34
 
51
- TypeScript config:
52
-
53
35
  ```ts
54
36
  import { defineConfig } from "vize";
55
37
 
@@ -60,55 +42,29 @@ export default defineConfig({
60
42
  });
61
43
  ```
62
44
 
63
- PKL config:
64
-
65
- ```pkl
66
- amends "node_modules/vize/pkl/vize.pkl"
67
-
68
- linter {
69
- preset = "opinionated"
70
- }
71
- ```
45
+ Override config discovery with `--config`, or disable it with `--no-config`.
72
46
 
73
- JSON config with schema:
47
+ ## Programmatic Config Helpers
74
48
 
75
- ```json
76
- {
77
- "$schema": "./node_modules/vize/schemas/vize.config.schema.json",
78
- "linter": {
79
- "preset": "opinionated"
80
- }
81
- }
82
- ```
83
-
84
- The npm CLI currently applies shared config to the `lint` command. You can override discovery with
85
- `vize lint --config path/to/vize.config.ts` or skip config loading with `vize lint --no-config`.
49
+ ```ts
50
+ import { defineConfig, loadConfig } from "vize";
86
51
 
87
- ## Examples
52
+ export default defineConfig({
53
+ linter: {
54
+ preset: "happy-path",
55
+ },
56
+ });
88
57
 
89
- ```bash
90
- vize # Compile ./**/*.vue to ./dist
91
- vize build src/**/*.vue -o out # Custom input/output
92
- vize build --ssr # SSR mode
93
- vize build --profile # Parse, transform, codegen, and I/O profile
94
- vize fmt --check # Check formatting
95
- vize fmt --check --profile # Formatter timing profile
96
- vize lint --fix # Auto-fix lint issues
97
- vize lint --profile # Rule hook, Croquis, and type-aware timing profile
98
- vize check --strict # Strict type checking
99
- vize check --profile src # Virtual TS, Croquis, and Corsa timing profile
58
+ const config = await loadConfig(process.cwd());
100
59
  ```
101
60
 
102
- Profile output includes hot files and internal operation timings, so compiler, linter, typecheck,
103
- Croquis, and Corsa costs are visible in the same report style.
104
-
105
- ## Alternative Installation
61
+ ## Related Packages
106
62
 
107
- If npm installation fails, you can install via Cargo:
108
-
109
- ```bash
110
- cargo install vize
111
- ```
63
+ - `@vizejs/vite-plugin`
64
+ - `@vizejs/native`
65
+ - `@vizejs/wasm`
66
+ - `@vizejs/nuxt`
67
+ - `@vizejs/vite-plugin-musea`
112
68
 
113
69
  ## License
114
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vize",
3
- "version": "0.49.0",
3
+ "version": "0.52.0",
4
4
  "description": "Vize - High-performance Vue.js toolchain in Rust",
5
5
  "keywords": [
6
6
  "cli",
@@ -53,14 +53,14 @@
53
53
  "vite-plus": "latest"
54
54
  },
55
55
  "optionalDependencies": {
56
- "@vizejs/native-darwin-arm64": "0.49.0",
57
- "@vizejs/native-darwin-x64": "0.49.0",
58
- "@vizejs/native-linux-arm64-gnu": "0.49.0",
59
- "@vizejs/native-linux-arm64-musl": "0.49.0",
60
- "@vizejs/native-linux-x64-gnu": "0.49.0",
61
- "@vizejs/native-linux-x64-musl": "0.49.0",
62
- "@vizejs/native-win32-arm64-msvc": "0.49.0",
63
- "@vizejs/native-win32-x64-msvc": "0.49.0"
56
+ "@vizejs/native-darwin-arm64": "0.52.0",
57
+ "@vizejs/native-darwin-x64": "0.52.0",
58
+ "@vizejs/native-linux-arm64-gnu": "0.52.0",
59
+ "@vizejs/native-linux-arm64-musl": "0.52.0",
60
+ "@vizejs/native-linux-x64-gnu": "0.52.0",
61
+ "@vizejs/native-linux-x64-musl": "0.52.0",
62
+ "@vizejs/native-win32-arm64-msvc": "0.52.0",
63
+ "@vizejs/native-win32-x64-msvc": "0.52.0"
64
64
  },
65
65
  "engines": {
66
66
  "node": ">=18"
package/pkl/vize.pkl CHANGED
@@ -65,12 +65,26 @@ class FormatterConfig {
65
65
 
66
66
  class LspConfig {
67
67
  enabled: Boolean? = null
68
+ lint: Boolean? = null
69
+ /// Deprecated: use `lint`.
68
70
  diagnostics: Boolean? = null
71
+ typecheck: Boolean? = null
72
+ editor: Boolean? = null
69
73
  completion: Boolean? = null
70
74
  hover: Boolean? = null
71
75
  definition: Boolean? = null
76
+ references: Boolean? = null
77
+ documentSymbols: Boolean? = null
78
+ workspaceSymbols: Boolean? = null
72
79
  formatting: Boolean? = null
73
80
  codeActions: Boolean? = null
81
+ rename: Boolean? = null
82
+ codeLens: Boolean? = null
83
+ semanticTokens: Boolean? = null
84
+ documentLinks: Boolean? = null
85
+ foldingRanges: Boolean? = null
86
+ inlayHints: Boolean? = null
87
+ fileRename: Boolean? = null
74
88
  corsa: Boolean? = null
75
89
  }
76
90
 
@@ -210,8 +210,21 @@
210
210
  "enabled": {
211
211
  "type": "boolean"
212
212
  },
213
+ "lint": {
214
+ "type": "boolean",
215
+ "description": "Enable Vize linter diagnostics in the LSP. Defaults to false."
216
+ },
213
217
  "diagnostics": {
214
- "type": "boolean"
218
+ "type": "boolean",
219
+ "description": "Deprecated alias for lint. Defaults to false."
220
+ },
221
+ "typecheck": {
222
+ "type": "boolean",
223
+ "description": "Enable type checking diagnostics and type-aware LSP integration. Defaults to false."
224
+ },
225
+ "editor": {
226
+ "type": "boolean",
227
+ "description": "Enable the editor assistance bundle: completion, hover, navigation, symbols, rename, code lens, semantic tokens, links, folding, inlay hints, and file rename handling. Formatting remains separately opt-in."
215
228
  },
216
229
  "completion": {
217
230
  "type": "boolean"
@@ -222,12 +235,42 @@
222
235
  "definition": {
223
236
  "type": "boolean"
224
237
  },
238
+ "references": {
239
+ "type": "boolean"
240
+ },
241
+ "documentSymbols": {
242
+ "type": "boolean"
243
+ },
244
+ "workspaceSymbols": {
245
+ "type": "boolean"
246
+ },
225
247
  "formatting": {
226
248
  "type": "boolean"
227
249
  },
228
250
  "codeActions": {
229
251
  "type": "boolean"
230
252
  },
253
+ "rename": {
254
+ "type": "boolean"
255
+ },
256
+ "codeLens": {
257
+ "type": "boolean"
258
+ },
259
+ "semanticTokens": {
260
+ "type": "boolean"
261
+ },
262
+ "documentLinks": {
263
+ "type": "boolean"
264
+ },
265
+ "foldingRanges": {
266
+ "type": "boolean"
267
+ },
268
+ "inlayHints": {
269
+ "type": "boolean"
270
+ },
271
+ "fileRename": {
272
+ "type": "boolean"
273
+ },
231
274
  "corsa": {
232
275
  "type": "boolean"
233
276
  }
@@ -342,10 +385,7 @@
342
385
  "globalTypesConfig": {
343
386
  "type": "object",
344
387
  "additionalProperties": {
345
- "oneOf": [
346
- { "type": "string" },
347
- { "$ref": "#/$defs/globalTypeDeclaration" }
348
- ]
388
+ "oneOf": [{ "type": "string" }, { "$ref": "#/$defs/globalTypeDeclaration" }]
349
389
  }
350
390
  }
351
391
  }
package/src/cli.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { readFileSync } from "node:fs";
2
- import path from "node:path";
2
+ import { spawnSync } from "node:child_process";
3
+ import * as path from "node:path";
3
4
  import { createRequire } from "node:module";
5
+ import { pathToFileURL } from "node:url";
4
6
  import { loadConfig } from "./config.js";
5
7
 
6
8
  const require = createRequire(import.meta.url);
@@ -157,6 +159,52 @@ interface ParsedLintCommand {
157
159
  sharedConfig: SharedConfigOptions;
158
160
  }
159
161
 
162
+ function printUsage(): void {
163
+ console.error("Usage: vize <command> [options]");
164
+ console.error("Commands: lint, musea");
165
+ }
166
+
167
+ function resolvePackageBinaryFromCwd(packageName: string, binName: string = packageName): string {
168
+ const cwdRequire = createRequire(pathToFileURL(path.join(process.cwd(), "package.json")).href);
169
+ const packageJsonPath = cwdRequire.resolve(`${packageName}/package.json`);
170
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")) as {
171
+ bin?: string | Record<string, string>;
172
+ };
173
+
174
+ const bin = typeof packageJson.bin === "string" ? packageJson.bin : packageJson.bin?.[binName];
175
+
176
+ if (!bin) {
177
+ throw new Error(`Could not resolve binary '${binName}' from package '${packageName}'`);
178
+ }
179
+
180
+ return path.resolve(path.dirname(packageJsonPath), bin);
181
+ }
182
+
183
+ function runMusea(args: string[]): void {
184
+ const isHelp = args.includes("--help") || args.includes("-h");
185
+ if (isHelp) {
186
+ console.error("Usage: vize musea [--build] [...vite options]");
187
+ console.error(" --build Run `vite build` instead of `vite dev`");
188
+ return;
189
+ }
190
+
191
+ const isBuild = args.includes("--build");
192
+ const viteArgs = args.filter((arg) => arg !== "--build");
193
+ const viteCommand = isBuild ? "build" : "dev";
194
+ const viteBin = resolvePackageBinaryFromCwd("vite");
195
+ const result = spawnSync(process.execPath, [viteBin, viteCommand, ...viteArgs], {
196
+ stdio: "inherit",
197
+ cwd: process.cwd(),
198
+ env: process.env,
199
+ });
200
+
201
+ if (result.error) {
202
+ throw result.error;
203
+ }
204
+
205
+ process.exit(result.status ?? 1);
206
+ }
207
+
160
208
  function parseLintCommand(args: string[]): ParsedLintCommand {
161
209
  const patterns: string[] = [];
162
210
  const options: LintOptions = {};
@@ -258,14 +306,14 @@ async function runLint(args: string[]): Promise<void> {
258
306
  // ============================================================================
259
307
 
260
308
  const NAPI_COMMANDS = new Set(["lint"]);
309
+ const JS_COMMANDS = new Set(["musea"]);
261
310
 
262
311
  async function main(): Promise<void> {
263
312
  const args = process.argv.slice(2);
264
313
  const command = args[0];
265
314
 
266
- if (!command) {
267
- console.error("Usage: vize <command> [options]");
268
- console.error("Commands: lint");
315
+ if (!command || command === "--help" || command === "-h") {
316
+ printUsage();
269
317
  process.exit(1);
270
318
  }
271
319
 
@@ -276,7 +324,15 @@ async function main(): Promise<void> {
276
324
  await runLint(commandArgs);
277
325
  break;
278
326
  }
327
+ } else if (JS_COMMANDS.has(command)) {
328
+ const commandArgs = args.slice(1);
329
+ switch (command) {
330
+ case "musea":
331
+ runMusea(commandArgs);
332
+ break;
333
+ }
279
334
  } else {
335
+ printUsage();
280
336
  console.error(`Unknown command: ${command}`);
281
337
  console.error(
282
338
  "For commands not yet available via NAPI, install from source: cargo install vize",
@@ -136,51 +136,127 @@ export interface FormatterConfig {
136
136
  export interface LspConfig {
137
137
  /**
138
138
  * Enable LSP
139
- * @default true
139
+ * @default false
140
140
  */
141
141
  enabled?: boolean;
142
142
 
143
143
  /**
144
- * Enable diagnostics
145
- * @default true
144
+ * Enable linter diagnostics.
145
+ * Prefer this over `diagnostics` for new configs.
146
+ * @default false
147
+ */
148
+ lint?: boolean;
149
+
150
+ /**
151
+ * Enable linter diagnostics.
152
+ * @deprecated Use `lint` instead.
153
+ * @default false
146
154
  */
147
155
  diagnostics?: boolean;
148
156
 
149
157
  /**
150
- * Enable completions
151
- * @default true
158
+ * Enable type checking diagnostics and type-aware LSP features.
159
+ * @default false
160
+ */
161
+ typecheck?: boolean;
162
+
163
+ /**
164
+ * Enable the editor assistance bundle: completion, hover, navigation,
165
+ * symbols, rename, code lens, semantic tokens, links, folding, inlay hints,
166
+ * and file rename handling. Formatting stays separately opt-in.
167
+ * @default false
168
+ */
169
+ editor?: boolean;
170
+
171
+ /**
172
+ * Enable completions.
173
+ * @default false
152
174
  */
153
175
  completion?: boolean;
154
176
 
155
177
  /**
156
178
  * Enable hover information
157
- * @default true
179
+ * @default false
158
180
  */
159
181
  hover?: boolean;
160
182
 
161
183
  /**
162
184
  * Enable go-to-definition
163
- * @default true
185
+ * @default false
164
186
  */
165
187
  definition?: boolean;
166
188
 
189
+ /**
190
+ * Enable find references
191
+ * @default false
192
+ */
193
+ references?: boolean;
194
+
195
+ /**
196
+ * Enable document symbols
197
+ * @default false
198
+ */
199
+ documentSymbols?: boolean;
200
+
201
+ /**
202
+ * Enable workspace symbols
203
+ * @default false
204
+ */
205
+ workspaceSymbols?: boolean;
206
+
167
207
  /**
168
208
  * Enable formatting via LSP
169
- * @default true
209
+ * @default false
170
210
  */
171
211
  formatting?: boolean;
172
212
 
173
213
  /**
174
214
  * Enable code actions
175
- * @default true
215
+ * @default false
176
216
  */
177
217
  codeActions?: boolean;
178
218
 
179
219
  /**
180
- * Enable type checking diagnostics and type-aware LSP features
181
- * @default true
220
+ * Enable rename
221
+ * @default false
182
222
  */
183
- typecheck?: boolean;
223
+ rename?: boolean;
224
+
225
+ /**
226
+ * Enable code lens
227
+ * @default false
228
+ */
229
+ codeLens?: boolean;
230
+
231
+ /**
232
+ * Enable semantic tokens
233
+ * @default false
234
+ */
235
+ semanticTokens?: boolean;
236
+
237
+ /**
238
+ * Enable document links
239
+ * @default false
240
+ */
241
+ documentLinks?: boolean;
242
+
243
+ /**
244
+ * Enable folding ranges
245
+ * @default false
246
+ */
247
+ foldingRanges?: boolean;
248
+
249
+ /**
250
+ * Enable inlay hints
251
+ * @default false
252
+ */
253
+ inlayHints?: boolean;
254
+
255
+ /**
256
+ * Enable file rename edits
257
+ * @default false
258
+ */
259
+ fileRename?: boolean;
184
260
 
185
261
  /**
186
262
  * Use Corsa for type checking in LSP
package/dist/cli.d.mts DELETED
@@ -1 +0,0 @@
1
- export { };
package/dist/cli.mjs DELETED
@@ -1,174 +0,0 @@
1
- import { loadConfig } from "./config.mjs";
2
- import { createRequire } from "node:module";
3
- import { readFileSync } from "node:fs";
4
- import path from "node:path";
5
- //#region src/cli.ts
6
- const require = createRequire(import.meta.url);
7
- const WORKSPACE_BINDING_PATH = "../../vize-native";
8
- function isMusl() {
9
- const report = process.report?.getReport();
10
- if (typeof report === "object" && report !== null && "header" in report) return !report.header.glibcVersionRuntime;
11
- try {
12
- return readFileSync(require("child_process").execSync("which ldd").toString().trim(), "utf8").includes("musl");
13
- } catch {
14
- return true;
15
- }
16
- }
17
- function getBindingPackageName() {
18
- const { platform, arch } = process;
19
- switch (platform) {
20
- case "darwin": switch (arch) {
21
- case "x64": return "@vizejs/native-darwin-x64";
22
- case "arm64": return "@vizejs/native-darwin-arm64";
23
- default: throw new Error(`Unsupported architecture on macOS: ${arch}`);
24
- }
25
- case "win32": switch (arch) {
26
- case "x64": return "@vizejs/native-win32-x64-msvc";
27
- case "arm64": return "@vizejs/native-win32-arm64-msvc";
28
- default: throw new Error(`Unsupported architecture on Windows: ${arch}`);
29
- }
30
- case "linux": switch (arch) {
31
- case "x64": return isMusl() ? "@vizejs/native-linux-x64-musl" : "@vizejs/native-linux-x64-gnu";
32
- case "arm64": return isMusl() ? "@vizejs/native-linux-arm64-musl" : "@vizejs/native-linux-arm64-gnu";
33
- default: throw new Error(`Unsupported architecture on Linux: ${arch}`);
34
- }
35
- default: throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
36
- }
37
- }
38
- function loadNative() {
39
- const attemptedPackages = getAttemptedPackages();
40
- let lastError = null;
41
- for (const packageName of attemptedPackages) try {
42
- const binding = require(packageName);
43
- if (typeof binding.lint !== "function") throw new Error(`${packageName} does not expose the lint binding.`);
44
- return binding;
45
- } catch (error) {
46
- lastError = error;
47
- }
48
- console.error(`Failed to load native binding. Tried: ${attemptedPackages.join(", ")}`);
49
- console.error("Try reinstalling: npm install vize");
50
- throw lastError instanceof Error ? lastError : /* @__PURE__ */ new Error("Failed to load native binding");
51
- }
52
- function getAttemptedPackages() {
53
- const platformBindingPackage = getBindingPackageName();
54
- return shouldPreferWorkspaceBinding(resolveWorkspaceBindingPath()) ? [WORKSPACE_BINDING_PATH, platformBindingPackage] : [platformBindingPackage, WORKSPACE_BINDING_PATH];
55
- }
56
- function resolveWorkspaceBindingPath() {
57
- try {
58
- return require.resolve(WORKSPACE_BINDING_PATH);
59
- } catch {
60
- return null;
61
- }
62
- }
63
- function shouldPreferWorkspaceBinding(resolvedPath) {
64
- const override = process.env.VIZE_PREFER_WORKSPACE_BINDING;
65
- if (override === "1" || override === "true") return true;
66
- if (override === "0" || override === "false") return false;
67
- if (resolvedPath == null) return false;
68
- return resolvedPath.includes(`${path.sep}npm${path.sep}vize-native${path.sep}`);
69
- }
70
- function parseLintCommand(args) {
71
- const patterns = [];
72
- const options = {};
73
- const sharedConfig = { configMode: "root" };
74
- for (let i = 0; i < args.length; i++) {
75
- const arg = args[i];
76
- if (arg === "--format" || arg === "-f") options.format = args[++i];
77
- else if (arg === "--max-warnings") options.maxWarnings = Number.parseInt(args[++i], 10);
78
- else if (arg === "--quiet" || arg === "-q") options.quiet = true;
79
- else if (arg === "--fix") options.fix = true;
80
- else if (arg === "--help-level") options.helpLevel = args[++i];
81
- else if (arg === "--preset") options.preset = args[++i];
82
- else if (arg === "--config" || arg === "-c") {
83
- const configFile = args[++i];
84
- if (!configFile) throw new Error("Missing path after --config");
85
- sharedConfig.configFile = configFile;
86
- } else if (arg === "--no-config") sharedConfig.configMode = "none";
87
- else if (!arg.startsWith("-")) patterns.push(arg);
88
- }
89
- return {
90
- patterns,
91
- options,
92
- sharedConfig
93
- };
94
- }
95
- async function runLint(args) {
96
- const { patterns, options, sharedConfig } = parseLintCommand(args);
97
- const config = await loadConfig(process.cwd(), {
98
- mode: sharedConfig.configMode,
99
- configFile: sharedConfig.configFile,
100
- env: {
101
- mode: process.env.NODE_ENV ?? "development",
102
- command: "lint"
103
- }
104
- });
105
- if (sharedConfig.configFile && !config) throw new Error(`Could not find config file: ${sharedConfig.configFile}`);
106
- if (config?.linter?.enabled === false) {
107
- process.stderr.write("[vize] Skipping lint because linter.enabled is false in vize.config.\n");
108
- return;
109
- }
110
- options.preset ??= config?.linter?.preset;
111
- if (patterns.length === 0) patterns.push(".");
112
- const result = loadNative().lint(patterns, {
113
- format: options.format,
114
- max_warnings: options.maxWarnings,
115
- quiet: options.quiet,
116
- fix: options.fix,
117
- help_level: options.helpLevel,
118
- preset: options.preset
119
- });
120
- if (result.output) {
121
- process.stdout.write(result.output);
122
- if (!result.output.endsWith("\n")) process.stdout.write("\n");
123
- }
124
- if (options.fix) process.stderr.write("\nNote: --fix is not yet implemented\n");
125
- if (result.errorCount > 0) process.exit(1);
126
- if (options.maxWarnings !== void 0 && result.warningCount > options.maxWarnings) {
127
- process.stderr.write(`\nToo many warnings (${result.warningCount} > max ${options.maxWarnings})\n`);
128
- process.exit(1);
129
- }
130
- }
131
- const NAPI_COMMANDS = new Set(["lint"]);
132
- async function main() {
133
- const args = process.argv.slice(2);
134
- const command = args[0];
135
- if (!command) {
136
- console.error("Usage: vize <command> [options]");
137
- console.error("Commands: lint");
138
- process.exit(1);
139
- }
140
- if (NAPI_COMMANDS.has(command)) {
141
- const commandArgs = args.slice(1);
142
- switch (command) {
143
- case "lint":
144
- await runLint(commandArgs);
145
- break;
146
- }
147
- } else {
148
- console.error(`Unknown command: ${command}`);
149
- console.error("For commands not yet available via NAPI, install from source: cargo install vize");
150
- process.exit(1);
151
- }
152
- }
153
- if (!import.meta.vitest) main().catch((error) => {
154
- console.error(error instanceof Error ? error.message : String(error));
155
- process.exit(1);
156
- });
157
- if (import.meta.vitest) {
158
- const { describe, expect, it } = import.meta.vitest;
159
- describe("shouldPreferWorkspaceBinding", () => {
160
- it("detects the local workspace native package", () => {
161
- expect(shouldPreferWorkspaceBinding(`${path.sep}Users${path.sep}example${path.sep}repo${path.sep}npm${path.sep}vize-native${path.sep}index.js`)).toBe(true);
162
- });
163
- it("ignores published platform packages", () => {
164
- expect(shouldPreferWorkspaceBinding(`${path.sep}repo${path.sep}node_modules${path.sep}.pnpm${path.sep}@vizejs+native-darwin-arm64${path.sep}node_modules${path.sep}@vizejs${path.sep}native-darwin-arm64${path.sep}index.js`)).toBe(false);
165
- });
166
- it("returns false when the fallback package cannot be resolved", () => {
167
- expect(shouldPreferWorkspaceBinding(null)).toBe(false);
168
- });
169
- });
170
- }
171
- //#endregion
172
- export {};
173
-
174
- //# sourceMappingURL=cli.mjs.map