vize 0.0.1-alpha.114 → 0.0.1-alpha.120

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/bin/vize CHANGED
@@ -1,49 +1,2 @@
1
1
  #!/usr/bin/env node
2
-
3
- import { spawn } from "child_process";
4
- import { createRequire } from "module";
5
- import { dirname, join } from "path";
6
-
7
- const require = createRequire(import.meta.url);
8
-
9
- const PLATFORMS = {
10
- "darwin-x64": { pkg: "@vizejs/cli-darwin-x64", bin: "vize" },
11
- "darwin-arm64": { pkg: "@vizejs/cli-darwin-arm64", bin: "vize" },
12
- "linux-x64": { pkg: "@vizejs/cli-linux-x64", bin: "vize" },
13
- "linux-arm64": { pkg: "@vizejs/cli-linux-arm64", bin: "vize" },
14
- "win32-x64": { pkg: "@vizejs/cli-win32-x64", bin: "vize.exe" },
15
- "win32-arm64": { pkg: "@vizejs/cli-win32-arm64", bin: "vize.exe" },
16
- };
17
-
18
- const platform = `${process.platform}-${process.arch}`;
19
- const config = PLATFORMS[platform];
20
-
21
- if (!config) {
22
- console.error(`Unsupported platform: ${platform}`);
23
- console.error("You can install from source: cargo install vize");
24
- process.exit(1);
25
- }
26
-
27
- let binaryPath;
28
- try {
29
- const pkgDir = dirname(require.resolve(`${config.pkg}/package.json`));
30
- binaryPath = join(pkgDir, config.bin);
31
- } catch {
32
- console.error(`Vize binary package not found: ${config.pkg}`);
33
- console.error("Try reinstalling: npm install vize");
34
- process.exit(1);
35
- }
36
-
37
- const child = spawn(binaryPath, process.argv.slice(2), {
38
- stdio: "inherit",
39
- env: process.env,
40
- });
41
-
42
- child.on("error", (err) => {
43
- console.error(`Failed to start Vize: ${err.message}`);
44
- process.exit(1);
45
- });
46
-
47
- child.on("close", (code) => {
48
- process.exit(code ?? 0);
49
- });
2
+ import "../dist/cli.js";
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/cli.js ADDED
@@ -0,0 +1,107 @@
1
+ import { createRequire } from "module";
2
+ import { readFileSync } from "fs";
3
+
4
+ //#region src/cli.ts
5
+ const require = createRequire(import.meta.url);
6
+ function isMusl() {
7
+ const report = process.report?.getReport();
8
+ if (typeof report === "object" && report !== null && "header" in report) {
9
+ const header = report.header;
10
+ return !header.glibcVersionRuntime;
11
+ }
12
+ try {
13
+ const lddPath = require("child_process").execSync("which ldd").toString().trim();
14
+ return readFileSync(lddPath, "utf8").includes("musl");
15
+ } catch {
16
+ return true;
17
+ }
18
+ }
19
+ function getBindingPackageName() {
20
+ const { platform, arch } = process;
21
+ switch (platform) {
22
+ case "darwin": switch (arch) {
23
+ case "x64": return "@vizejs/native-darwin-x64";
24
+ case "arm64": return "@vizejs/native-darwin-arm64";
25
+ default: throw new Error(`Unsupported architecture on macOS: ${arch}`);
26
+ }
27
+ case "win32": switch (arch) {
28
+ case "x64": return "@vizejs/native-win32-x64-msvc";
29
+ case "arm64": return "@vizejs/native-win32-arm64-msvc";
30
+ default: throw new Error(`Unsupported architecture on Windows: ${arch}`);
31
+ }
32
+ case "linux": switch (arch) {
33
+ case "x64": return isMusl() ? "@vizejs/native-linux-x64-musl" : "@vizejs/native-linux-x64-gnu";
34
+ case "arm64": return isMusl() ? "@vizejs/native-linux-arm64-musl" : "@vizejs/native-linux-arm64-gnu";
35
+ default: throw new Error(`Unsupported architecture on Linux: ${arch}`);
36
+ }
37
+ default: throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
38
+ }
39
+ }
40
+ function loadNative() {
41
+ const pkg = getBindingPackageName();
42
+ try {
43
+ return require(pkg);
44
+ } catch (e) {
45
+ console.error(`Failed to load native binding: ${pkg}`);
46
+ console.error("Try reinstalling: npm install vize");
47
+ throw e;
48
+ }
49
+ }
50
+ function runLint(args) {
51
+ const patterns = [];
52
+ const options = {};
53
+ for (let i = 0; i < args.length; i++) {
54
+ const arg = args[i];
55
+ if (arg === "--format" || arg === "-f") options.format = args[++i];
56
+ else if (arg === "--max-warnings") options.maxWarnings = Number.parseInt(args[++i], 10);
57
+ else if (arg === "--quiet" || arg === "-q") options.quiet = true;
58
+ else if (arg === "--fix") options.fix = true;
59
+ else if (arg === "--help-level") options.helpLevel = args[++i];
60
+ else if (!arg.startsWith("-")) patterns.push(arg);
61
+ }
62
+ if (patterns.length === 0) patterns.push(".");
63
+ const native = loadNative();
64
+ const result = native.lint(patterns, {
65
+ format: options.format,
66
+ max_warnings: options.maxWarnings,
67
+ quiet: options.quiet,
68
+ fix: options.fix,
69
+ help_level: options.helpLevel
70
+ });
71
+ if (result.output) {
72
+ process.stdout.write(result.output);
73
+ if (!result.output.endsWith("\n")) process.stdout.write("\n");
74
+ }
75
+ if (options.fix) process.stderr.write("\nNote: --fix is not yet implemented\n");
76
+ if (result.errorCount > 0) process.exit(1);
77
+ if (options.maxWarnings !== void 0 && result.warningCount > options.maxWarnings) {
78
+ process.stderr.write(`\nToo many warnings (${result.warningCount} > max ${options.maxWarnings})\n`);
79
+ process.exit(1);
80
+ }
81
+ }
82
+ const NAPI_COMMANDS = new Set(["lint"]);
83
+ function main() {
84
+ const args = process.argv.slice(2);
85
+ const command = args[0];
86
+ if (!command) {
87
+ console.error("Usage: vize <command> [options]");
88
+ console.error("Commands: lint");
89
+ process.exit(1);
90
+ }
91
+ if (NAPI_COMMANDS.has(command)) {
92
+ const commandArgs = args.slice(1);
93
+ switch (command) {
94
+ case "lint":
95
+ runLint(commandArgs);
96
+ break;
97
+ }
98
+ } else {
99
+ console.error(`Unknown command: ${command}`);
100
+ console.error("For commands not yet available via NAPI, install from source: cargo install vize");
101
+ process.exit(1);
102
+ }
103
+ }
104
+ main();
105
+
106
+ //#endregion
107
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","names":["args: string[]","patterns: string[]","options: LintOptions"],"sources":["../src/cli.ts"],"sourcesContent":["import { createRequire } from \"module\";\nimport { readFileSync } from \"fs\";\n\nconst require = createRequire(import.meta.url);\n\n// ============================================================================\n// Native binding loader (oxlint pattern)\n// ============================================================================\n\nfunction isMusl(): boolean {\n const report = process.report?.getReport();\n if (typeof report === \"object\" && report !== null && \"header\" in report) {\n const header = (report as { header: { glibcVersionRuntime?: string } }).header;\n return !header.glibcVersionRuntime;\n }\n try {\n const lddPath = require(\"child_process\").execSync(\"which ldd\").toString().trim();\n return readFileSync(lddPath, \"utf8\").includes(\"musl\");\n } catch {\n return true;\n }\n}\n\nfunction getBindingPackageName(): string {\n const { platform, arch } = process;\n\n switch (platform) {\n case \"darwin\":\n switch (arch) {\n case \"x64\":\n return \"@vizejs/native-darwin-x64\";\n case \"arm64\":\n return \"@vizejs/native-darwin-arm64\";\n default:\n throw new Error(`Unsupported architecture on macOS: ${arch}`);\n }\n case \"win32\":\n switch (arch) {\n case \"x64\":\n return \"@vizejs/native-win32-x64-msvc\";\n case \"arm64\":\n return \"@vizejs/native-win32-arm64-msvc\";\n default:\n throw new Error(`Unsupported architecture on Windows: ${arch}`);\n }\n case \"linux\":\n switch (arch) {\n case \"x64\":\n return isMusl() ? \"@vizejs/native-linux-x64-musl\" : \"@vizejs/native-linux-x64-gnu\";\n case \"arm64\":\n return isMusl() ? \"@vizejs/native-linux-arm64-musl\" : \"@vizejs/native-linux-arm64-gnu\";\n default:\n throw new Error(`Unsupported architecture on Linux: ${arch}`);\n }\n default:\n throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);\n }\n}\n\ninterface NativeBinding {\n lint: (\n patterns: string[],\n options?: {\n format?: string;\n max_warnings?: number;\n quiet?: boolean;\n fix?: boolean;\n help_level?: string;\n },\n ) => LintResult;\n}\n\nfunction loadNative(): NativeBinding {\n const pkg = getBindingPackageName();\n try {\n return require(pkg);\n } catch (e) {\n console.error(`Failed to load native binding: ${pkg}`);\n console.error(\"Try reinstalling: npm install vize\");\n throw e;\n }\n}\n\n// ============================================================================\n// Lint command\n// ============================================================================\n\ninterface LintOptions {\n format?: string;\n maxWarnings?: number;\n quiet?: boolean;\n fix?: boolean;\n helpLevel?: string;\n}\n\ninterface LintResult {\n output: string;\n errorCount: number;\n warningCount: number;\n fileCount: number;\n timeMs: number;\n}\n\nfunction runLint(args: string[]): void {\n const patterns: string[] = [];\n const options: LintOptions = {};\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === \"--format\" || arg === \"-f\") {\n options.format = args[++i];\n } else if (arg === \"--max-warnings\") {\n options.maxWarnings = Number.parseInt(args[++i], 10);\n } else if (arg === \"--quiet\" || arg === \"-q\") {\n options.quiet = true;\n } else if (arg === \"--fix\") {\n options.fix = true;\n } else if (arg === \"--help-level\") {\n options.helpLevel = args[++i];\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n if (patterns.length === 0) {\n patterns.push(\".\");\n }\n\n const native = loadNative();\n const result = native.lint(patterns, {\n format: options.format,\n max_warnings: options.maxWarnings,\n quiet: options.quiet,\n fix: options.fix,\n help_level: options.helpLevel,\n });\n\n if (result.output) {\n process.stdout.write(result.output);\n if (!result.output.endsWith(\"\\n\")) {\n process.stdout.write(\"\\n\");\n }\n }\n\n if (options.fix) {\n process.stderr.write(\"\\nNote: --fix is not yet implemented\\n\");\n }\n\n if (result.errorCount > 0) {\n process.exit(1);\n }\n\n if (options.maxWarnings !== undefined && result.warningCount > options.maxWarnings) {\n process.stderr.write(\n `\\nToo many warnings (${result.warningCount} > max ${options.maxWarnings})\\n`,\n );\n process.exit(1);\n }\n}\n\n// ============================================================================\n// Command router\n// ============================================================================\n\nconst NAPI_COMMANDS = new Set([\"lint\"]);\n\nfunction main(): void {\n const args = process.argv.slice(2);\n const command = args[0];\n\n if (!command) {\n console.error(\"Usage: vize <command> [options]\");\n console.error(\"Commands: lint\");\n process.exit(1);\n }\n\n if (NAPI_COMMANDS.has(command)) {\n const commandArgs = args.slice(1);\n switch (command) {\n case \"lint\":\n runLint(commandArgs);\n break;\n }\n } else {\n console.error(`Unknown command: ${command}`);\n console.error(\n \"For commands not yet available via NAPI, install from source: cargo install vize\",\n );\n process.exit(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;CAChB;AAED,KAAI,cAAc,IAAI,QAAQ,EAAE;EAC9B,MAAM,cAAc,KAAK,MAAM,EAAE;AACjC,UAAQ,SAAR;GACE,KAAK;AACH,YAAQ,YAAY;AACpB;EACH;CACF,OAAM;AACL,UAAQ,OAAO,mBAAmB,QAAQ,EAAE;AAC5C,UAAQ,MACN,mFACD;AACD,UAAQ,KAAK,EAAE;CAChB;AACF;AAED,MAAM"}
@@ -0,0 +1,126 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import { pathToFileURL } from "node:url";
4
+ import { transform } from "oxc-transform";
5
+
6
+ //#region src/config.ts
7
+ const CONFIG_FILE_NAMES = [
8
+ "vize.config.ts",
9
+ "vize.config.js",
10
+ "vize.config.mjs",
11
+ "vize.config.json"
12
+ ];
13
+ const DEFAULT_CONFIG_ENV = {
14
+ mode: "development",
15
+ command: "serve"
16
+ };
17
+ /**
18
+ * Define a Vize configuration with type checking.
19
+ * Accepts a plain object or a function that receives ConfigEnv.
20
+ */
21
+ function defineConfig(config) {
22
+ return config;
23
+ }
24
+ /**
25
+ * Load vize.config file from the specified directory
26
+ */
27
+ async function loadConfig(root, options = {}) {
28
+ const { mode = "root", configFile, env } = options;
29
+ if (mode === "none") return null;
30
+ if (configFile) {
31
+ const absolutePath = path.isAbsolute(configFile) ? configFile : path.resolve(root, configFile);
32
+ if (fs.existsSync(absolutePath)) return loadConfigFile(absolutePath, env);
33
+ return null;
34
+ }
35
+ if (mode === "auto") {
36
+ const configPath$1 = findConfigFileAuto(root);
37
+ if (!configPath$1) return null;
38
+ return loadConfigFile(configPath$1, env);
39
+ }
40
+ const configPath = findConfigFileInDir(root);
41
+ if (!configPath) return null;
42
+ return loadConfigFile(configPath, env);
43
+ }
44
+ /**
45
+ * Find config file in a specific directory
46
+ */
47
+ function findConfigFileInDir(dir) {
48
+ for (const name of CONFIG_FILE_NAMES) {
49
+ const filePath = path.join(dir, name);
50
+ if (fs.existsSync(filePath)) return filePath;
51
+ }
52
+ return null;
53
+ }
54
+ /**
55
+ * Find config file by searching from cwd upward
56
+ */
57
+ function findConfigFileAuto(startDir) {
58
+ let currentDir = path.resolve(startDir);
59
+ const root = path.parse(currentDir).root;
60
+ while (currentDir !== root) {
61
+ const configPath = findConfigFileInDir(currentDir);
62
+ if (configPath) return configPath;
63
+ currentDir = path.dirname(currentDir);
64
+ }
65
+ return null;
66
+ }
67
+ /**
68
+ * Load and evaluate a config file
69
+ */
70
+ async function loadConfigFile(filePath, env) {
71
+ if (!fs.existsSync(filePath)) return null;
72
+ const ext = path.extname(filePath);
73
+ if (ext === ".json") {
74
+ const content = fs.readFileSync(filePath, "utf-8");
75
+ return JSON.parse(content);
76
+ }
77
+ if (ext === ".ts") return loadTypeScriptConfig(filePath, env);
78
+ return loadESMConfig(filePath, env);
79
+ }
80
+ /**
81
+ * Resolve a UserConfigExport to a VizeConfig
82
+ */
83
+ async function resolveConfigExport(exported, env) {
84
+ if (typeof exported === "function") return exported(env ?? DEFAULT_CONFIG_ENV);
85
+ return exported;
86
+ }
87
+ /**
88
+ * Load TypeScript config file using oxc-transform
89
+ */
90
+ async function loadTypeScriptConfig(filePath, env) {
91
+ const source = fs.readFileSync(filePath, "utf-8");
92
+ const result = transform(filePath, source, { typescript: { onlyRemoveTypeImports: true } });
93
+ const code = result.code;
94
+ const tempFile = filePath.replace(/\.ts$/, `.temp.${Date.now()}.mjs`);
95
+ fs.writeFileSync(tempFile, code);
96
+ try {
97
+ const fileUrl = pathToFileURL(tempFile).href;
98
+ const module = await import(fileUrl);
99
+ const exported = module.default || module;
100
+ return resolveConfigExport(exported, env);
101
+ } finally {
102
+ fs.unlinkSync(tempFile);
103
+ }
104
+ }
105
+ /**
106
+ * Load ESM config file
107
+ */
108
+ async function loadESMConfig(filePath, env) {
109
+ const fileUrl = pathToFileURL(filePath).href;
110
+ const module = await import(fileUrl);
111
+ const exported = module.default || module;
112
+ return resolveConfigExport(exported, env);
113
+ }
114
+ /**
115
+ * Normalize GlobalTypesConfig shorthand strings to GlobalTypeDeclaration objects
116
+ */
117
+ function normalizeGlobalTypes(config) {
118
+ const result = {};
119
+ for (const [key, value] of Object.entries(config)) if (typeof value === "string") result[key] = { type: value };
120
+ else result[key] = value;
121
+ return result;
122
+ }
123
+
124
+ //#endregion
125
+ export { defineConfig, loadConfig, normalizeGlobalTypes };
126
+ //# sourceMappingURL=config-CVmInrFP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-CVmInrFP.js","names":["DEFAULT_CONFIG_ENV: ConfigEnv","config: UserConfigExport","root: string","options: LoadConfigOptions","configPath","dir: string","startDir: string","filePath: string","env?: ConfigEnv","exported: UserConfigExport","config: GlobalTypesConfig","result: Record<string, GlobalTypeDeclaration>"],"sources":["../src/config.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { transform } from \"oxc-transform\";\nimport type {\n VizeConfig,\n LoadConfigOptions,\n UserConfigExport,\n ConfigEnv,\n GlobalTypesConfig,\n GlobalTypeDeclaration,\n} from \"./types.js\";\n\nconst CONFIG_FILE_NAMES = [\n \"vize.config.ts\",\n \"vize.config.js\",\n \"vize.config.mjs\",\n \"vize.config.json\",\n];\n\nconst DEFAULT_CONFIG_ENV: ConfigEnv = {\n mode: \"development\",\n command: \"serve\",\n};\n\n/**\n * Define a Vize configuration with type checking.\n * Accepts a plain object or a function that receives ConfigEnv.\n */\nexport function defineConfig(config: UserConfigExport): UserConfigExport {\n return config;\n}\n\n/**\n * Load vize.config file from the specified directory\n */\nexport async function loadConfig(\n root: string,\n options: LoadConfigOptions = {},\n): Promise<VizeConfig | null> {\n const { mode = \"root\", configFile, env } = options;\n\n if (mode === \"none\") {\n return null;\n }\n\n // Custom config file path\n if (configFile) {\n const absolutePath = path.isAbsolute(configFile) ? configFile : path.resolve(root, configFile);\n if (fs.existsSync(absolutePath)) {\n return loadConfigFile(absolutePath, env);\n }\n return null;\n }\n\n // Search for config file\n if (mode === \"auto\") {\n const configPath = findConfigFileAuto(root);\n if (!configPath) {\n return null;\n }\n return loadConfigFile(configPath, env);\n }\n\n // mode === \"root\"\n const configPath = findConfigFileInDir(root);\n if (!configPath) {\n return null;\n }\n return loadConfigFile(configPath, env);\n}\n\n/**\n * Find config file in a specific directory\n */\nfunction findConfigFileInDir(dir: string): string | null {\n for (const name of CONFIG_FILE_NAMES) {\n const filePath = path.join(dir, name);\n if (fs.existsSync(filePath)) {\n return filePath;\n }\n }\n return null;\n}\n\n/**\n * Find config file by searching from cwd upward\n */\nfunction findConfigFileAuto(startDir: string): string | null {\n let currentDir = path.resolve(startDir);\n const root = path.parse(currentDir).root;\n\n while (currentDir !== root) {\n const configPath = findConfigFileInDir(currentDir);\n if (configPath) {\n return configPath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return null;\n}\n\n/**\n * Load and evaluate a config file\n */\nasync function loadConfigFile(filePath: string, env?: ConfigEnv): Promise<VizeConfig | null> {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n\n const ext = path.extname(filePath);\n\n if (ext === \".json\") {\n const content = fs.readFileSync(filePath, \"utf-8\");\n return JSON.parse(content);\n }\n\n if (ext === \".ts\") {\n return loadTypeScriptConfig(filePath, env);\n }\n\n // .js, .mjs - ESM\n return loadESMConfig(filePath, env);\n}\n\n/**\n * Resolve a UserConfigExport to a VizeConfig\n */\nasync function resolveConfigExport(\n exported: UserConfigExport,\n env?: ConfigEnv,\n): Promise<VizeConfig> {\n if (typeof exported === \"function\") {\n return exported(env ?? DEFAULT_CONFIG_ENV);\n }\n return exported;\n}\n\n/**\n * Load TypeScript config file using oxc-transform\n */\nasync function loadTypeScriptConfig(filePath: string, env?: ConfigEnv): Promise<VizeConfig> {\n const source = fs.readFileSync(filePath, \"utf-8\");\n const result = transform(filePath, source, {\n typescript: {\n onlyRemoveTypeImports: true,\n },\n });\n\n const code = result.code;\n\n // Write to temp file and import (use Date.now() to avoid race conditions)\n const tempFile = filePath.replace(/\\.ts$/, `.temp.${Date.now()}.mjs`);\n fs.writeFileSync(tempFile, code);\n\n try {\n const fileUrl = pathToFileURL(tempFile).href;\n const module = await import(fileUrl);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\n } finally {\n fs.unlinkSync(tempFile);\n }\n}\n\n/**\n * Load ESM config file\n */\nasync function loadESMConfig(filePath: string, env?: ConfigEnv): Promise<VizeConfig> {\n const fileUrl = pathToFileURL(filePath).href;\n const module = await import(fileUrl);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\n}\n\n/**\n * Normalize GlobalTypesConfig shorthand strings to GlobalTypeDeclaration objects\n */\nexport function normalizeGlobalTypes(\n config: GlobalTypesConfig,\n): Record<string, GlobalTypeDeclaration> {\n const result: Record<string, GlobalTypeDeclaration> = {};\n for (const [key, value] of Object.entries(config)) {\n if (typeof value === \"string\") {\n result[key] = { type: value };\n } else {\n result[key] = value;\n }\n }\n return result;\n}\n"],"mappings":";;;;;;AAaA,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;AACD;AAED,MAAMA,qBAAgC;CACpC,MAAM;CACN,SAAS;AACV;;;;;AAMD,SAAgB,aAAaC,QAA4C;AACvE,QAAO;AACR;;;;AAKD,eAAsB,WACpBC,MACAC,UAA6B,CAAE,GACH;CAC5B,MAAM,EAAE,OAAO,QAAQ,YAAY,KAAK,GAAG;AAE3C,KAAI,SAAS,OACX,QAAO;AAIT,KAAI,YAAY;EACd,MAAM,eAAe,KAAK,WAAW,WAAW,GAAG,aAAa,KAAK,QAAQ,MAAM,WAAW;AAC9F,MAAI,GAAG,WAAW,aAAa,CAC7B,QAAO,eAAe,cAAc,IAAI;AAE1C,SAAO;CACR;AAGD,KAAI,SAAS,QAAQ;EACnB,MAAMC,eAAa,mBAAmB,KAAK;AAC3C,OAAKA,aACH,QAAO;AAET,SAAO,eAAeA,cAAY,IAAI;CACvC;CAGD,MAAM,aAAa,oBAAoB,KAAK;AAC5C,MAAK,WACH,QAAO;AAET,QAA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C5B,MAAMC,WAA6B,OAAO,WAAW;AACrD,SAAO,oBAAoB,UAAU,IAAI;CAC1C,UAAS;AACR,KAAG,WAAW,SAAS;CACxB;AACF;;;;AAKD,eAAe,cAAcF,UAAkBC,KAAsC;CACnF,MAAM,UAAU,cAAc,SAAS,CAAC;CACxC,MAAM,SAAS,MAAM,OAAO;CAC5B,MAAMC,WAA6B,OAAO,WAAW;AACrD,QAAO,oBAAoB,UAAU,IAAI;AAC1C;;;;AAKD,SAAgB,qBACdC,QACuC;CACvC,MAAMC,SAAgD,CAAE;AACxD,MAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,OAAO,CAC/C,YAAW,UAAU,SACnB,QAAO,OAAO,EAAE,MAAM,MAAO;KAE7B,QAAO,OAAO;AAGlB,QAAO;AACR"}
@@ -0,0 +1,422 @@
1
+ //#region src/types.d.ts
2
+ type MaybePromise<T> = T | Promise<T>;
3
+ interface ConfigEnv {
4
+ mode: string;
5
+ command: "serve" | "build" | "check" | "lint" | "fmt";
6
+ isSsrBuild?: boolean;
7
+ }
8
+ type UserConfigExport = VizeConfig | ((env: ConfigEnv) => MaybePromise<VizeConfig>);
9
+ type RuleSeverity = "off" | "warn" | "error";
10
+ type RuleCategory = "correctness" | "suspicious" | "style" | "perf" | "a11y" | "security";
11
+ /**
12
+ * Vize configuration options
13
+ */
14
+ interface VizeConfig {
15
+ /**
16
+ * Vue compiler options
17
+ */
18
+ compiler?: CompilerConfig;
19
+ /**
20
+ * Vite plugin options
21
+ */
22
+ vite?: VitePluginConfig;
23
+ /**
24
+ * Linter options
25
+ */
26
+ linter?: LinterConfig;
27
+ /**
28
+ * Type checker options
29
+ */
30
+ typeChecker?: TypeCheckerConfig;
31
+ /**
32
+ * Formatter options
33
+ */
34
+ formatter?: FormatterConfig;
35
+ /**
36
+ * LSP options
37
+ */
38
+ lsp?: LspConfig;
39
+ /**
40
+ * Musea component gallery options
41
+ */
42
+ musea?: MuseaConfig;
43
+ /**
44
+ * Global type declarations
45
+ */
46
+ globalTypes?: GlobalTypesConfig;
47
+ }
48
+ /**
49
+ * Compiler configuration
50
+ */
51
+ interface CompilerConfig {
52
+ /**
53
+ * Compilation mode
54
+ * @default 'module'
55
+ */
56
+ mode?: "module" | "function";
57
+ /**
58
+ * Enable Vapor mode compilation
59
+ * @default false
60
+ */
61
+ vapor?: boolean;
62
+ /**
63
+ * Enable SSR mode
64
+ * @default false
65
+ */
66
+ ssr?: boolean;
67
+ /**
68
+ * Enable source map generation
69
+ * @default true in development, false in production
70
+ */
71
+ sourceMap?: boolean;
72
+ /**
73
+ * Prefix template identifiers with _ctx
74
+ * @default false
75
+ */
76
+ prefixIdentifiers?: boolean;
77
+ /**
78
+ * Hoist static nodes
79
+ * @default true
80
+ */
81
+ hoistStatic?: boolean;
82
+ /**
83
+ * Cache v-on handlers
84
+ * @default true
85
+ */
86
+ cacheHandlers?: boolean;
87
+ /**
88
+ * Enable TypeScript parsing in <script> blocks
89
+ * @default true
90
+ */
91
+ isTs?: boolean;
92
+ /**
93
+ * Script file extension for generated output
94
+ * @default 'ts'
95
+ */
96
+ scriptExt?: "ts" | "js";
97
+ /**
98
+ * Module name for runtime imports
99
+ * @default 'vue'
100
+ */
101
+ runtimeModuleName?: string;
102
+ /**
103
+ * Global variable name for runtime (IIFE builds)
104
+ * @default 'Vue'
105
+ */
106
+ runtimeGlobalName?: string;
107
+ }
108
+ /**
109
+ * Vite plugin configuration
110
+ */
111
+ interface VitePluginConfig {
112
+ /**
113
+ * Files to include in compilation
114
+ * @default /\.vue$/
115
+ */
116
+ include?: string | RegExp | (string | RegExp)[];
117
+ /**
118
+ * Files to exclude from compilation
119
+ * @default /node_modules/
120
+ */
121
+ exclude?: string | RegExp | (string | RegExp)[];
122
+ /**
123
+ * Glob patterns to scan for .vue files during pre-compilation
124
+ * @default ['**\/*.vue']
125
+ */
126
+ scanPatterns?: string[];
127
+ /**
128
+ * Glob patterns to ignore during pre-compilation
129
+ * @default ['node_modules/**', 'dist/**', '.git/**']
130
+ */
131
+ ignorePatterns?: string[];
132
+ }
133
+ /**
134
+ * Linter configuration
135
+ */
136
+ interface LinterConfig {
137
+ /**
138
+ * Enable linting
139
+ */
140
+ enabled?: boolean;
141
+ /**
142
+ * Rules to enable/disable
143
+ */
144
+ rules?: Record<string, RuleSeverity>;
145
+ /**
146
+ * Category-level severity overrides
147
+ */
148
+ categories?: Partial<Record<RuleCategory, RuleSeverity>>;
149
+ }
150
+ /**
151
+ * Type checker configuration
152
+ */
153
+ interface TypeCheckerConfig {
154
+ /**
155
+ * Enable type checking
156
+ * @default false
157
+ */
158
+ enabled?: boolean;
159
+ /**
160
+ * Enable strict mode
161
+ * @default false
162
+ */
163
+ strict?: boolean;
164
+ /**
165
+ * Check component props
166
+ * @default true
167
+ */
168
+ checkProps?: boolean;
169
+ /**
170
+ * Check component emits
171
+ * @default true
172
+ */
173
+ checkEmits?: boolean;
174
+ /**
175
+ * Check template bindings
176
+ * @default true
177
+ */
178
+ checkTemplateBindings?: boolean;
179
+ /**
180
+ * Path to tsconfig.json
181
+ * @default auto-detected
182
+ */
183
+ tsconfig?: string;
184
+ /**
185
+ * Path to tsgo binary
186
+ */
187
+ tsgoPath?: string;
188
+ }
189
+ /**
190
+ * Formatter configuration
191
+ */
192
+ interface FormatterConfig {
193
+ /**
194
+ * Max line width
195
+ * @default 80
196
+ */
197
+ printWidth?: number;
198
+ /**
199
+ * Indentation width
200
+ * @default 2
201
+ */
202
+ tabWidth?: number;
203
+ /**
204
+ * Use tabs for indentation
205
+ * @default false
206
+ */
207
+ useTabs?: boolean;
208
+ /**
209
+ * Print semicolons
210
+ * @default true
211
+ */
212
+ semi?: boolean;
213
+ /**
214
+ * Use single quotes
215
+ * @default false
216
+ */
217
+ singleQuote?: boolean;
218
+ /**
219
+ * Trailing commas
220
+ * @default 'all'
221
+ */
222
+ trailingComma?: "all" | "none" | "es5";
223
+ }
224
+ /**
225
+ * LSP configuration
226
+ */
227
+ interface LspConfig {
228
+ /**
229
+ * Enable LSP
230
+ * @default true
231
+ */
232
+ enabled?: boolean;
233
+ /**
234
+ * Enable diagnostics
235
+ * @default true
236
+ */
237
+ diagnostics?: boolean;
238
+ /**
239
+ * Enable completions
240
+ * @default true
241
+ */
242
+ completion?: boolean;
243
+ /**
244
+ * Enable hover information
245
+ * @default true
246
+ */
247
+ hover?: boolean;
248
+ /**
249
+ * Enable go-to-definition
250
+ * @default true
251
+ */
252
+ definition?: boolean;
253
+ /**
254
+ * Enable formatting via LSP
255
+ * @default true
256
+ */
257
+ formatting?: boolean;
258
+ /**
259
+ * Enable code actions
260
+ * @default true
261
+ */
262
+ codeActions?: boolean;
263
+ /**
264
+ * Use tsgo for type checking in LSP
265
+ * @default false
266
+ */
267
+ tsgo?: boolean;
268
+ }
269
+ /**
270
+ * VRT (Visual Regression Testing) configuration for Musea
271
+ */
272
+ interface MuseaVrtConfig {
273
+ /**
274
+ * Threshold for pixel comparison (0-1)
275
+ * @default 0.1
276
+ */
277
+ threshold?: number;
278
+ /**
279
+ * Output directory for screenshots
280
+ * @default '__musea_snapshots__'
281
+ */
282
+ outDir?: string;
283
+ /**
284
+ * Viewport sizes
285
+ */
286
+ viewports?: Array<{
287
+ width: number;
288
+ height: number;
289
+ name?: string;
290
+ }>;
291
+ }
292
+ /**
293
+ * A11y configuration for Musea
294
+ */
295
+ interface MuseaA11yConfig {
296
+ /**
297
+ * Enable a11y checking
298
+ * @default false
299
+ */
300
+ enabled?: boolean;
301
+ /**
302
+ * Axe-core rules to enable/disable
303
+ */
304
+ rules?: Record<string, boolean>;
305
+ }
306
+ /**
307
+ * Autogen configuration for Musea
308
+ */
309
+ interface MuseaAutogenConfig {
310
+ /**
311
+ * Enable auto-generation of variants
312
+ * @default false
313
+ */
314
+ enabled?: boolean;
315
+ /**
316
+ * Max variants to generate per component
317
+ * @default 10
318
+ */
319
+ maxVariants?: number;
320
+ }
321
+ /**
322
+ * Musea component gallery configuration
323
+ */
324
+ interface MuseaConfig {
325
+ /**
326
+ * Glob patterns for art files
327
+ * @default ['**\/*.art.vue']
328
+ */
329
+ include?: string[];
330
+ /**
331
+ * Glob patterns to exclude
332
+ * @default ['node_modules/**', 'dist/**']
333
+ */
334
+ exclude?: string[];
335
+ /**
336
+ * Base path for gallery
337
+ * @default '/__musea__'
338
+ */
339
+ basePath?: string;
340
+ /**
341
+ * Enable Storybook compatibility
342
+ * @default false
343
+ */
344
+ storybookCompat?: boolean;
345
+ /**
346
+ * Enable inline art detection in .vue files
347
+ * @default false
348
+ */
349
+ inlineArt?: boolean;
350
+ /**
351
+ * VRT configuration
352
+ */
353
+ vrt?: MuseaVrtConfig;
354
+ /**
355
+ * A11y configuration
356
+ */
357
+ a11y?: MuseaA11yConfig;
358
+ /**
359
+ * Autogen configuration
360
+ */
361
+ autogen?: MuseaAutogenConfig;
362
+ }
363
+ /**
364
+ * Global type declaration
365
+ */
366
+ interface GlobalTypeDeclaration {
367
+ /**
368
+ * TypeScript type string
369
+ */
370
+ type: string;
371
+ /**
372
+ * Default value
373
+ */
374
+ defaultValue?: string;
375
+ }
376
+ /**
377
+ * Global types configuration
378
+ */
379
+ type GlobalTypesConfig = Record<string, GlobalTypeDeclaration | string>;
380
+ /**
381
+ * Options for loading vize.config file
382
+ */
383
+ interface LoadConfigOptions {
384
+ /**
385
+ * Config file search mode
386
+ * - 'root': Search only in the specified root directory
387
+ * - 'auto': Search from cwd upward until finding a config file
388
+ * - 'none': Don't load config file
389
+ * @default 'root'
390
+ */
391
+ mode?: "root" | "auto" | "none";
392
+ /**
393
+ * Custom config file path (overrides automatic search)
394
+ */
395
+ configFile?: string;
396
+ /**
397
+ * Config environment for dynamic config resolution
398
+ */
399
+ env?: ConfigEnv;
400
+ } //#endregion
401
+ //#region src/config.d.ts
402
+
403
+ //# sourceMappingURL=types.d.ts.map
404
+ /**
405
+ * Define a Vize configuration with type checking.
406
+ * Accepts a plain object or a function that receives ConfigEnv.
407
+ */
408
+ declare function defineConfig(config: UserConfigExport): UserConfigExport;
409
+ /**
410
+ * Load vize.config file from the specified directory
411
+ */
412
+ declare function loadConfig(root: string, options?: LoadConfigOptions): Promise<VizeConfig | null>;
413
+ /**
414
+ * Normalize GlobalTypesConfig shorthand strings to GlobalTypeDeclaration objects
415
+ */
416
+ declare function normalizeGlobalTypes(config: GlobalTypesConfig): Record<string, GlobalTypeDeclaration>;
417
+
418
+ //#endregion
419
+ //# sourceMappingURL=config.d.ts.map
420
+
421
+ export { CompilerConfig, ConfigEnv, FormatterConfig, GlobalTypeDeclaration, GlobalTypesConfig, LinterConfig, LoadConfigOptions, LspConfig, MaybePromise, MuseaA11yConfig, MuseaAutogenConfig, MuseaConfig, MuseaVrtConfig, RuleCategory, RuleSeverity, TypeCheckerConfig, UserConfigExport, VitePluginConfig, VizeConfig, defineConfig as defineConfig$1, loadConfig as loadConfig$1, normalizeGlobalTypes as normalizeGlobalTypes$1 };
422
+ //# sourceMappingURL=config-Cu4Hn1JG.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-Cu4Hn1JG.d.ts","names":[],"sources":["../src/types.ts","../src/config.ts"],"sourcesContent":null,"mappings":";KAIY,kBAAkB,IAAI,QAAQ;AAA9B,UAEK,SAAA,CAFO;EAAA,IAAA,EAAA,MAAA;EAAA,OAAM,EAAA,OAAA,GAAA,OAAA,GAAA,OAAA,GAAA,MAAA,GAAA,KAAA;EAAC,UAAW,CAAA,EAAA,OAAA;;AAAD,KAQ7B,gBAAA,GAAmB,UARU,GAAA,CAAA,CAAA,GAAA,EAQU,SARV,EAAA,GAQwB,YARxB,CAQqC,UARrC,CAAA,CAAA;AAExB,KAYL,YAAA,GAZc,KAAA,GAAA,MAAA,GAAA,OAAA;AAMd,KAQA,YAAA,GARgB,aAAA,GAAA,YAAA,GAAA,OAAA,GAAA,MAAA,GAAA,MAAA,GAAA,UAAA;;;;AAAkD,UAiB7D,UAAA,CAjB6D;EAAU;AAAX;AAM7E;EAEY,QAAA,CAAA,EAaC,cAbW;;;;EASP,IAA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;;;SAKC;;;;YAKG;;;;;UAUK,qBAAA;;;;;;;;;;;;;KAeL,iBAAA,GAAoB,eAAe;;;;UAS9B,iBAAA;;;;;;;;;;;;;;;;QAkBT;;;;;AA7fR;;;;AAAkC,iBCyBlB,YAAA,CDzBkB,MAAA,ECyBG,gBDzBH,CAAA,ECyBsB,gBDzBtB;AAAO;AAEzC;AAMA;AAA4B,iBCwBN,UAAA,CDxBM,IAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EC0BjB,iBD1BiB,CAAA,EC2BzB,OD3ByB,CC2BjB,UD3BiB,GAAA,IAAA,CAAA;;;;AAAqC,iBCuKjD,oBAAA,CDvKiD,MAAA,ECwKvD,iBDxKuD,CAAA,ECyK9D,MDzK8D,CAAA,MAAA,ECyK/C,qBDzK+C,CAAA;;;AAAY"}
@@ -0,0 +1,2 @@
1
+ import { defineConfig$1 as defineConfig, loadConfig$1 as loadConfig, normalizeGlobalTypes$1 as normalizeGlobalTypes } from "./config-Cu4Hn1JG.js";
2
+ export { defineConfig, loadConfig, normalizeGlobalTypes };
package/dist/config.js ADDED
@@ -0,0 +1,3 @@
1
+ import { defineConfig, loadConfig, normalizeGlobalTypes } from "./config-CVmInrFP.js";
2
+
3
+ export { defineConfig, loadConfig, normalizeGlobalTypes };
@@ -0,0 +1,2 @@
1
+ import { CompilerConfig, ConfigEnv, FormatterConfig, GlobalTypeDeclaration, GlobalTypesConfig, LinterConfig, LoadConfigOptions, LspConfig, MaybePromise, MuseaA11yConfig, MuseaAutogenConfig, MuseaConfig, MuseaVrtConfig, RuleCategory, RuleSeverity, TypeCheckerConfig, UserConfigExport, VitePluginConfig, VizeConfig, defineConfig$1 as defineConfig, loadConfig$1 as loadConfig, normalizeGlobalTypes$1 as normalizeGlobalTypes } from "./config-Cu4Hn1JG.js";
2
+ export { CompilerConfig, ConfigEnv, FormatterConfig, GlobalTypeDeclaration, GlobalTypesConfig, LinterConfig, LoadConfigOptions, LspConfig, MaybePromise, MuseaA11yConfig, MuseaAutogenConfig, MuseaConfig, MuseaVrtConfig, RuleCategory, RuleSeverity, TypeCheckerConfig, UserConfigExport, VitePluginConfig, VizeConfig, defineConfig, loadConfig, normalizeGlobalTypes };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { defineConfig, loadConfig, normalizeGlobalTypes } from "./config-CVmInrFP.js";
2
+
3
+ export { defineConfig, loadConfig, normalizeGlobalTypes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vize",
3
- "version": "0.0.1-alpha.114",
3
+ "version": "0.0.1-alpha.120",
4
4
  "description": "Vize - High-performance Vue.js toolchain in Rust",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -44,12 +44,14 @@
44
44
  "node": ">=18"
45
45
  },
46
46
  "optionalDependencies": {
47
- "@vizejs/cli-darwin-x64": "0.0.1-alpha.114",
48
- "@vizejs/cli-darwin-arm64": "0.0.1-alpha.114",
49
- "@vizejs/cli-linux-x64": "0.0.1-alpha.114",
50
- "@vizejs/cli-linux-arm64": "0.0.1-alpha.114",
51
- "@vizejs/cli-win32-x64": "0.0.1-alpha.114",
52
- "@vizejs/cli-win32-arm64": "0.0.1-alpha.114"
47
+ "@vizejs/native-darwin-x64": "0.0.1-alpha.120",
48
+ "@vizejs/native-darwin-arm64": "0.0.1-alpha.120",
49
+ "@vizejs/native-win32-x64-msvc": "0.0.1-alpha.120",
50
+ "@vizejs/native-win32-arm64-msvc": "0.0.1-alpha.120",
51
+ "@vizejs/native-linux-x64-gnu": "0.0.1-alpha.120",
52
+ "@vizejs/native-linux-x64-musl": "0.0.1-alpha.120",
53
+ "@vizejs/native-linux-arm64-gnu": "0.0.1-alpha.120",
54
+ "@vizejs/native-linux-arm64-musl": "0.0.1-alpha.120"
53
55
  },
54
56
  "dependencies": {
55
57
  "oxc-transform": "^0.56.0"
package/src/cli.ts ADDED
@@ -0,0 +1,193 @@
1
+ import { createRequire } from "module";
2
+ import { readFileSync } from "fs";
3
+
4
+ const require = createRequire(import.meta.url);
5
+
6
+ // ============================================================================
7
+ // Native binding loader (oxlint pattern)
8
+ // ============================================================================
9
+
10
+ function isMusl(): boolean {
11
+ const report = process.report?.getReport();
12
+ if (typeof report === "object" && report !== null && "header" in report) {
13
+ const header = (report as { header: { glibcVersionRuntime?: string } }).header;
14
+ return !header.glibcVersionRuntime;
15
+ }
16
+ try {
17
+ const lddPath = require("child_process").execSync("which ldd").toString().trim();
18
+ return readFileSync(lddPath, "utf8").includes("musl");
19
+ } catch {
20
+ return true;
21
+ }
22
+ }
23
+
24
+ function getBindingPackageName(): string {
25
+ const { platform, arch } = process;
26
+
27
+ switch (platform) {
28
+ case "darwin":
29
+ switch (arch) {
30
+ case "x64":
31
+ return "@vizejs/native-darwin-x64";
32
+ case "arm64":
33
+ return "@vizejs/native-darwin-arm64";
34
+ default:
35
+ throw new Error(`Unsupported architecture on macOS: ${arch}`);
36
+ }
37
+ case "win32":
38
+ switch (arch) {
39
+ case "x64":
40
+ return "@vizejs/native-win32-x64-msvc";
41
+ case "arm64":
42
+ return "@vizejs/native-win32-arm64-msvc";
43
+ default:
44
+ throw new Error(`Unsupported architecture on Windows: ${arch}`);
45
+ }
46
+ case "linux":
47
+ switch (arch) {
48
+ case "x64":
49
+ return isMusl() ? "@vizejs/native-linux-x64-musl" : "@vizejs/native-linux-x64-gnu";
50
+ case "arm64":
51
+ return isMusl() ? "@vizejs/native-linux-arm64-musl" : "@vizejs/native-linux-arm64-gnu";
52
+ default:
53
+ throw new Error(`Unsupported architecture on Linux: ${arch}`);
54
+ }
55
+ default:
56
+ throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
57
+ }
58
+ }
59
+
60
+ interface NativeBinding {
61
+ lint: (
62
+ patterns: string[],
63
+ options?: {
64
+ format?: string;
65
+ max_warnings?: number;
66
+ quiet?: boolean;
67
+ fix?: boolean;
68
+ help_level?: string;
69
+ },
70
+ ) => LintResult;
71
+ }
72
+
73
+ function loadNative(): NativeBinding {
74
+ const pkg = getBindingPackageName();
75
+ try {
76
+ return require(pkg);
77
+ } catch (e) {
78
+ console.error(`Failed to load native binding: ${pkg}`);
79
+ console.error("Try reinstalling: npm install vize");
80
+ throw e;
81
+ }
82
+ }
83
+
84
+ // ============================================================================
85
+ // Lint command
86
+ // ============================================================================
87
+
88
+ interface LintOptions {
89
+ format?: string;
90
+ maxWarnings?: number;
91
+ quiet?: boolean;
92
+ fix?: boolean;
93
+ helpLevel?: string;
94
+ }
95
+
96
+ interface LintResult {
97
+ output: string;
98
+ errorCount: number;
99
+ warningCount: number;
100
+ fileCount: number;
101
+ timeMs: number;
102
+ }
103
+
104
+ function runLint(args: string[]): void {
105
+ const patterns: string[] = [];
106
+ const options: LintOptions = {};
107
+
108
+ for (let i = 0; i < args.length; i++) {
109
+ const arg = args[i];
110
+ if (arg === "--format" || arg === "-f") {
111
+ options.format = args[++i];
112
+ } else if (arg === "--max-warnings") {
113
+ options.maxWarnings = Number.parseInt(args[++i], 10);
114
+ } else if (arg === "--quiet" || arg === "-q") {
115
+ options.quiet = true;
116
+ } else if (arg === "--fix") {
117
+ options.fix = true;
118
+ } else if (arg === "--help-level") {
119
+ options.helpLevel = args[++i];
120
+ } else if (!arg.startsWith("-")) {
121
+ patterns.push(arg);
122
+ }
123
+ }
124
+
125
+ if (patterns.length === 0) {
126
+ patterns.push(".");
127
+ }
128
+
129
+ const native = loadNative();
130
+ const result = native.lint(patterns, {
131
+ format: options.format,
132
+ max_warnings: options.maxWarnings,
133
+ quiet: options.quiet,
134
+ fix: options.fix,
135
+ help_level: options.helpLevel,
136
+ });
137
+
138
+ if (result.output) {
139
+ process.stdout.write(result.output);
140
+ if (!result.output.endsWith("\n")) {
141
+ process.stdout.write("\n");
142
+ }
143
+ }
144
+
145
+ if (options.fix) {
146
+ process.stderr.write("\nNote: --fix is not yet implemented\n");
147
+ }
148
+
149
+ if (result.errorCount > 0) {
150
+ process.exit(1);
151
+ }
152
+
153
+ if (options.maxWarnings !== undefined && result.warningCount > options.maxWarnings) {
154
+ process.stderr.write(
155
+ `\nToo many warnings (${result.warningCount} > max ${options.maxWarnings})\n`,
156
+ );
157
+ process.exit(1);
158
+ }
159
+ }
160
+
161
+ // ============================================================================
162
+ // Command router
163
+ // ============================================================================
164
+
165
+ const NAPI_COMMANDS = new Set(["lint"]);
166
+
167
+ function main(): void {
168
+ const args = process.argv.slice(2);
169
+ const command = args[0];
170
+
171
+ if (!command) {
172
+ console.error("Usage: vize <command> [options]");
173
+ console.error("Commands: lint");
174
+ process.exit(1);
175
+ }
176
+
177
+ if (NAPI_COMMANDS.has(command)) {
178
+ const commandArgs = args.slice(1);
179
+ switch (command) {
180
+ case "lint":
181
+ runLint(commandArgs);
182
+ break;
183
+ }
184
+ } else {
185
+ console.error(`Unknown command: ${command}`);
186
+ console.error(
187
+ "For commands not yet available via NAPI, install from source: cargo install vize",
188
+ );
189
+ process.exit(1);
190
+ }
191
+ }
192
+
193
+ main();