vize 0.48.0 → 0.49.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 CHANGED
@@ -1,8 +1,10 @@
1
1
  import { loadConfig } from "./config.mjs";
2
- import { createRequire } from "module";
3
- import { readFileSync } from "fs";
2
+ import { createRequire } from "node:module";
3
+ import { readFileSync } from "node:fs";
4
+ import path from "node:path";
4
5
  //#region src/cli.ts
5
6
  const require = createRequire(import.meta.url);
7
+ const WORKSPACE_BINDING_PATH = "../../vize-native";
6
8
  function isMusl() {
7
9
  const report = process.report?.getReport();
8
10
  if (typeof report === "object" && report !== null && "header" in report) return !report.header.glibcVersionRuntime;
@@ -34,15 +36,37 @@ function getBindingPackageName() {
34
36
  }
35
37
  }
36
38
  function loadNative() {
37
- const pkg = getBindingPackageName();
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() {
38
57
  try {
39
- return require(pkg);
40
- } catch (e) {
41
- console.error(`Failed to load native binding: ${pkg}`);
42
- console.error("Try reinstalling: npm install vize");
43
- throw e;
58
+ return require.resolve(WORKSPACE_BINDING_PATH);
59
+ } catch {
60
+ return null;
44
61
  }
45
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
+ }
46
70
  function parseLintCommand(args) {
47
71
  const patterns = [];
48
72
  const options = {};
@@ -126,10 +150,24 @@ async function main() {
126
150
  process.exit(1);
127
151
  }
128
152
  }
129
- main().catch((error) => {
153
+ if (!import.meta.vitest) main().catch((error) => {
130
154
  console.error(error instanceof Error ? error.message : String(error));
131
155
  process.exit(1);
132
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
+ }
133
171
  //#endregion
134
172
  export {};
135
173
 
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["import { createRequire } from \"module\";\nimport { readFileSync } from \"fs\";\nimport { loadConfig } from \"./config.js\";\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 preset?: 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 preset?: string;\n}\n\ninterface LintResult {\n output: string;\n errorCount: number;\n warningCount: number;\n fileCount: number;\n timeMs: number;\n}\n\ninterface SharedConfigOptions {\n configFile?: string;\n configMode: \"root\" | \"none\";\n}\n\ninterface ParsedLintCommand {\n patterns: string[];\n options: LintOptions;\n sharedConfig: SharedConfigOptions;\n}\n\nfunction parseLintCommand(args: string[]): ParsedLintCommand {\n const patterns: string[] = [];\n const options: LintOptions = {};\n const sharedConfig: SharedConfigOptions = {\n configMode: \"root\",\n };\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 === \"--preset\") {\n options.preset = args[++i];\n } else if (arg === \"--config\" || arg === \"-c\") {\n const configFile = args[++i];\n if (!configFile) {\n throw new Error(\"Missing path after --config\");\n }\n sharedConfig.configFile = configFile;\n } else if (arg === \"--no-config\") {\n sharedConfig.configMode = \"none\";\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n return { patterns, options, sharedConfig };\n}\n\nasync function runLint(args: string[]): Promise<void> {\n const { patterns, options, sharedConfig } = parseLintCommand(args);\n const config = await loadConfig(process.cwd(), {\n mode: sharedConfig.configMode,\n configFile: sharedConfig.configFile,\n env: {\n mode: process.env.NODE_ENV ?? \"development\",\n command: \"lint\",\n },\n });\n\n if (sharedConfig.configFile && !config) {\n throw new Error(`Could not find config file: ${sharedConfig.configFile}`);\n }\n\n if (config?.linter?.enabled === false) {\n process.stderr.write(\"[vize] Skipping lint because linter.enabled is false in vize.config.\\n\");\n return;\n }\n\n options.preset ??= config?.linter?.preset;\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 preset: options.preset,\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\nasync function main(): Promise<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 await 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(1);\n }\n}\n\nvoid main().catch((error) => {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n});\n"],"mappings":";;;;AAIA,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAM9C,SAAS,SAAkB;CACzB,MAAM,SAAS,QAAQ,QAAQ,WAAW;AAC1C,KAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,YAAY,OAE/D,QAAO,CADS,OAAwD,OACzD;AAEjB,KAAI;AAEF,SAAO,aADS,QAAQ,gBAAgB,CAAC,SAAS,YAAY,CAAC,UAAU,CAAC,MAAM,EACnD,OAAO,CAAC,SAAS,OAAO;SAC/C;AACN,SAAO;;;AAIX,SAAS,wBAAgC;CACvC,MAAM,EAAE,UAAU,SAAS;AAE3B,SAAQ,UAAR;EACE,KAAK,SACH,SAAQ,MAAR;GACE,KAAK,MACH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;CACnC,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;CAClC,MAAM,UAAU,KAAK;AAErB,KAAI,CAAC,SAAS;AACZ,UAAQ,MAAM,kCAAkC;AAChD,UAAQ,MAAM,iBAAiB;AAC/B,UAAQ,KAAK,EAAE;;AAGjB,KAAI,cAAc,IAAI,QAAQ,EAAE;EAC9B,MAAM,cAAc,KAAK,MAAM,EAAE;AACjC,UAAQ,SAAR;GACE,KAAK;AACH,UAAM,QAAQ,YAAY;AAC1B;;QAEC;AACL,UAAQ,MAAM,oBAAoB,UAAU;AAC5C,UAAQ,MACN,mFACD;AACD,UAAQ,KAAK,EAAE;;;AAId,MAAM,CAAC,OAAO,UAAU;AAC3B,SAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;AACrE,SAAQ,KAAK,EAAE;EACf"}
1
+ {"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { createRequire } from \"node:module\";\nimport { loadConfig } from \"./config.js\";\n\nconst require = createRequire(import.meta.url);\nconst WORKSPACE_BINDING_PATH = \"../../vize-native\";\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 preset?: string;\n },\n ) => LintResult;\n}\n\nfunction loadNative(): NativeBinding {\n const attemptedPackages = getAttemptedPackages();\n let lastError: unknown = null;\n\n for (const packageName of attemptedPackages) {\n try {\n const binding = require(packageName) as Partial<NativeBinding>;\n if (typeof binding.lint !== \"function\") {\n throw new Error(`${packageName} does not expose the lint binding.`);\n }\n return binding as NativeBinding;\n } catch (error) {\n lastError = error;\n }\n }\n\n console.error(`Failed to load native binding. Tried: ${attemptedPackages.join(\", \")}`);\n console.error(\"Try reinstalling: npm install vize\");\n throw lastError instanceof Error ? lastError : new Error(\"Failed to load native binding\");\n}\n\nfunction getAttemptedPackages(): readonly string[] {\n const platformBindingPackage = getBindingPackageName();\n return shouldPreferWorkspaceBinding(resolveWorkspaceBindingPath())\n ? [WORKSPACE_BINDING_PATH, platformBindingPackage]\n : [platformBindingPackage, WORKSPACE_BINDING_PATH];\n}\n\nfunction resolveWorkspaceBindingPath(): string | null {\n try {\n return require.resolve(WORKSPACE_BINDING_PATH);\n } catch {\n return null;\n }\n}\n\nfunction shouldPreferWorkspaceBinding(resolvedPath: string | null): boolean {\n const override = process.env.VIZE_PREFER_WORKSPACE_BINDING;\n if (override === \"1\" || override === \"true\") {\n return true;\n }\n if (override === \"0\" || override === \"false\") {\n return false;\n }\n if (resolvedPath == null) {\n return false;\n }\n\n return resolvedPath.includes(`${path.sep}npm${path.sep}vize-native${path.sep}`);\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 preset?: string;\n}\n\ninterface LintResult {\n output: string;\n errorCount: number;\n warningCount: number;\n fileCount: number;\n timeMs: number;\n}\n\ninterface SharedConfigOptions {\n configFile?: string;\n configMode: \"root\" | \"none\";\n}\n\ninterface ParsedLintCommand {\n patterns: string[];\n options: LintOptions;\n sharedConfig: SharedConfigOptions;\n}\n\nfunction parseLintCommand(args: string[]): ParsedLintCommand {\n const patterns: string[] = [];\n const options: LintOptions = {};\n const sharedConfig: SharedConfigOptions = {\n configMode: \"root\",\n };\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 === \"--preset\") {\n options.preset = args[++i];\n } else if (arg === \"--config\" || arg === \"-c\") {\n const configFile = args[++i];\n if (!configFile) {\n throw new Error(\"Missing path after --config\");\n }\n sharedConfig.configFile = configFile;\n } else if (arg === \"--no-config\") {\n sharedConfig.configMode = \"none\";\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n return { patterns, options, sharedConfig };\n}\n\nasync function runLint(args: string[]): Promise<void> {\n const { patterns, options, sharedConfig } = parseLintCommand(args);\n const config = await loadConfig(process.cwd(), {\n mode: sharedConfig.configMode,\n configFile: sharedConfig.configFile,\n env: {\n mode: process.env.NODE_ENV ?? \"development\",\n command: \"lint\",\n },\n });\n\n if (sharedConfig.configFile && !config) {\n throw new Error(`Could not find config file: ${sharedConfig.configFile}`);\n }\n\n if (config?.linter?.enabled === false) {\n process.stderr.write(\"[vize] Skipping lint because linter.enabled is false in vize.config.\\n\");\n return;\n }\n\n options.preset ??= config?.linter?.preset;\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 preset: options.preset,\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\nasync function main(): Promise<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 await 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(1);\n }\n}\n\nif (!import.meta.vitest) {\n void main().catch((error) => {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n });\n}\n\nif (import.meta.vitest) {\n const { describe, expect, it } = import.meta.vitest;\n\n describe(\"shouldPreferWorkspaceBinding\", () => {\n it(\"detects the local workspace native package\", () => {\n expect(\n shouldPreferWorkspaceBinding(\n `${path.sep}Users${path.sep}example${path.sep}repo${path.sep}npm${path.sep}vize-native${path.sep}index.js`,\n ),\n ).toBe(true);\n });\n\n it(\"ignores published platform packages\", () => {\n expect(\n shouldPreferWorkspaceBinding(\n `${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`,\n ),\n ).toBe(false);\n });\n\n it(\"returns false when the fallback package cannot be resolved\", () => {\n expect(shouldPreferWorkspaceBinding(null)).toBe(false);\n });\n });\n}\n"],"mappings":";;;;;AAKA,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAC9C,MAAM,yBAAyB;AAM/B,SAAS,SAAkB;CACzB,MAAM,SAAS,QAAQ,QAAQ,WAAW;AAC1C,KAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,YAAY,OAE/D,QAAO,CADS,OAAwD,OACzD;AAEjB,KAAI;AAEF,SAAO,aADS,QAAQ,gBAAgB,CAAC,SAAS,YAAY,CAAC,UAAU,CAAC,MAAM,EACnD,OAAO,CAAC,SAAS,OAAO;SAC/C;AACN,SAAO;;;AAIX,SAAS,wBAAgC;CACvC,MAAM,EAAE,UAAU,SAAS;AAE3B,SAAQ,UAAR;EACE,KAAK,SACH,SAAQ,MAAR;GACE,KAAK,MACH,QAAO;GACT,KAAK,QACH,QAAO;GACT,QACE,OAAM,IAAI,MAAM,sCAAsC,OAAO;;EAEnE,KAAK,QACH,SAAQ,MAAR;GACE,KAAK,MACH,QAAO;GACT,KAAK,QACH,QAAO;GACT,QACE,OAAM,IAAI,MAAM,wCAAwC,OAAO;;EAErE,KAAK,QACH,SAAQ,MAAR;GACE,KAAK,MACH,QAAO,QAAQ,GAAG,kCAAkC;GACtD,KAAK,QACH,QAAO,QAAQ,GAAG,oCAAoC;GACxD,QACE,OAAM,IAAI,MAAM,sCAAsC,OAAO;;EAEnE,QACE,OAAM,IAAI,MAAM,mBAA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,IAAI,cAAc,KAAK,IAAI,OAAO,KAAK,IAAI,6BAA6B,KAAK,IAAI,cAAc,KAAK,IAAI,SAAS,KAAK,IAAI,qBAAqB,KAAK,IAAI,UAChL,CACF,CAAC,KAAK,MAAM;IACb;AAEF,KAAG,oEAAoE;AACrE,UAAO,6BAA6B,KAAK,CAAC,CAAC,KAAK,MAAM;IACtD;GACF"}
@@ -85,6 +85,11 @@ interface VitePluginConfig {
85
85
  ignorePatterns?: string[];
86
86
  }
87
87
  //#endregion
88
+ //#region src/types/rules.d.ts
89
+ declare const LINT_RULE_NAMES: readonly ["a11y/alt-text", "a11y/anchor-has-content", "a11y/anchor-is-valid", "a11y/aria-props", "a11y/aria-role", "a11y/aria-unsupported-elements", "a11y/click-events-have-key-events", "a11y/form-control-has-label", "a11y/heading-has-content", "a11y/heading-levels", "a11y/iframe-has-title", "a11y/img-alt", "a11y/interactive-supports-focus", "a11y/label-has-for", "a11y/landmark-roles", "a11y/media-has-caption", "a11y/mouse-events-have-key-events", "a11y/no-access-key", "a11y/no-aria-hidden-on-focusable", "a11y/no-autofocus", "a11y/no-distracting-elements", "a11y/no-i-for-icon", "a11y/no-redundant-roles", "a11y/no-refer-to-non-existent-id", "a11y/no-role-presentation-on-focusable", "a11y/no-static-element-interactions", "a11y/placeholder-label-option", "a11y/role-has-required-aria-props", "a11y/tabindex-no-positive", "a11y/use-list", "html/deprecated-attr", "html/deprecated-element", "html/id-duplication", "html/no-consecutive-br", "html/no-duplicate-dt", "html/no-empty-palpable-content", "html/require-datetime", "script/no-get-current-instance", "script/no-next-tick", "script/no-options-api", "ssr/no-browser-globals-in-ssr", "ssr/no-hydration-mismatch", "type/no-floating-promises", "type/no-unsafe-template-binding", "type/require-typed-emits", "type/require-typed-props", "vapor/no-inline-template", "vapor/no-suspense", "vapor/no-vue-lifecycle-events", "vapor/prefer-static-class", "vapor/require-vapor-attribute", "vue/attribute-hyphenation", "vue/attribute-order", "vue/component-definition-name-casing", "vue/component-name-in-template-casing", "vue/html-quotes", "vue/html-self-closing", "vue/multi-word-component-names", "vue/mustache-interpolation-spacing", "vue/no-boolean-attr-value", "vue/no-child-content", "vue/no-dupe-v-else-if", "vue/no-duplicate-attributes", "vue/no-inline-style", "vue/no-lone-template", "vue/no-multi-spaces", "vue/no-mutating-props", "vue/no-preprocessor-lang", "vue/no-reserved-component-names", "vue/no-script-non-standard-lang", "vue/no-src-attribute", "vue/no-template-key", "vue/no-template-lang", "vue/no-template-shadow", "vue/no-textarea-mustache", "vue/no-unsafe-url", "vue/no-unused-components", "vue/no-unused-properties", "vue/no-unused-vars", "vue/no-use-v-if-with-v-for", "vue/no-useless-template-attributes", "vue/no-v-html", "vue/no-v-text-v-html-on-component", "vue/permitted-contents", "vue/prefer-props-shorthand", "vue/prop-name-casing", "vue/require-component-is", "vue/require-component-registration", "vue/require-scoped-style", "vue/require-v-for-key", "vue/scoped-event-names", "vue/sfc-element-order", "vue/single-style-block", "vue/use-unique-element-ids", "vue/use-v-on-exact", "vue/v-bind-style", "vue/v-on-style", "vue/v-slot-style", "vue/valid-attribute-name", "vue/valid-v-bind", "vue/valid-v-else", "vue/valid-v-for", "vue/valid-v-if", "vue/valid-v-memo", "vue/valid-v-model", "vue/valid-v-on", "vue/valid-v-show", "vue/valid-v-slot", "vue/warn-custom-block", "vue/warn-custom-directive"];
90
+ type LintRuleName = (typeof LINT_RULE_NAMES)[number];
91
+ type LintRulesConfig = Partial<Record<LintRuleName, RuleSeverity>>;
92
+ //#endregion
88
93
  //#region src/types/tools.d.ts
89
94
  /**
90
95
  * Linter configuration
@@ -102,7 +107,7 @@ interface LinterConfig {
102
107
  /**
103
108
  * Rules to enable/disable
104
109
  */
105
- rules?: Record<string, RuleSeverity>;
110
+ rules?: LintRulesConfig;
106
111
  /**
107
112
  * Category-level severity overrides
108
113
  */
@@ -221,6 +226,11 @@ interface LspConfig {
221
226
  * @default true
222
227
  */
223
228
  codeActions?: boolean;
229
+ /**
230
+ * Enable type checking diagnostics and type-aware LSP features
231
+ * @default true
232
+ */
233
+ typecheck?: boolean;
224
234
  /**
225
235
  * Use Corsa for type checking in LSP
226
236
  * @default false
@@ -435,5 +445,5 @@ declare function loadConfig(root: string, options?: LoadConfigOptions): Promise<
435
445
  */
436
446
  declare function normalizeGlobalTypes(config: GlobalTypesConfig): Record<string, GlobalTypeDeclaration>;
437
447
  //#endregion
438
- export { LspConfig as C, VitePluginConfig as E, LinterConfig as S, CompilerConfig as T, MuseaA11yConfig as _, loadConfig as a, MuseaVrtConfig as b, LintPreset as c, RuleSeverity as d, UserConfigExport as f, LoadConfigOptions as g, GlobalTypesConfig as h, defineConfig as i, MaybePromise as l, GlobalTypeDeclaration as m, VIZE_CONFIG_JSON_SCHEMA_PATH as n, normalizeGlobalTypes as o, VizeConfig as p, VIZE_CONFIG_PKL_SCHEMA_PATH as r, ConfigEnv as s, CONFIG_FILE_NAMES as t, RuleCategory as u, MuseaAutogenConfig as v, TypeCheckerConfig as w, FormatterConfig as x, MuseaConfig as y };
439
- //# sourceMappingURL=config-tYKh_ZMu.d.mts.map
448
+ export { LspConfig as C, CompilerConfig as D, LintRulesConfig as E, VitePluginConfig as O, LinterConfig as S, LintRuleName as T, MuseaA11yConfig as _, loadConfig as a, MuseaVrtConfig as b, LintPreset as c, RuleSeverity as d, UserConfigExport as f, LoadConfigOptions as g, GlobalTypesConfig as h, defineConfig as i, MaybePromise as l, GlobalTypeDeclaration as m, VIZE_CONFIG_JSON_SCHEMA_PATH as n, normalizeGlobalTypes as o, VizeConfig as p, VIZE_CONFIG_PKL_SCHEMA_PATH as r, ConfigEnv as s, CONFIG_FILE_NAMES as t, RuleCategory as u, MuseaAutogenConfig as v, TypeCheckerConfig as w, FormatterConfig as x, MuseaConfig as y };
449
+ //# sourceMappingURL=config-BbNk5gIK.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-BbNk5gIK.d.mts","names":[],"sources":["../src/types/compiler.ts","../src/types/rules.ts","../src/types/tools.ts","../src/types/musea.ts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K,SAAA,KAAc,YAAA,CAAa,UAAA;AAAA,KAMlE,YAAA;AAAA,KAEA,YAAA;AAAA,KAEA,UAAA;;;;UASK,UAAA;EL6CgB;;;EKzC/B,OAAA;ELoDmB;;;EK/CnB,QAAA,GAAW,cAAA;ELyCX;;;EKpCA,IAAA,GAAO,gBAAA;EL0CY;;;EKrCnB,MAAA,GAAS,YAAA;ELiDK;;;EK5Cd,WAAA,GAAc,iBAAA;;AJxDhB;;EI6DE,SAAA,GAAY,eAAA;EJkDJ;;AAEV;EI/CE,GAAA,GAAM,SAAA;;;;EAKN,KAAA,GAAQ,WAAA;EJ4CiB;;;EIvCzB,WAAA,GAAc,iBAAA;AAAA;;;cCnEH,iBAAA;AAAA,cAeA,4BAAA;AAAA,cAMA,2BAAA;;;;;iBAMG,YAAA,CAAa,MAAA,EAAQ,gBAAA,GAAmB,gBAAA;;;;iBAOlC,UAAA,CACpB,IAAA,UACA,OAAA,GAAS,iBAAA,GACR,OAAA,CAAQ,UAAA;;;;iBA2LK,oBAAA,CACd,MAAA,EAAQ,iBAAA,GACP,MAAA,SAAe,qBAAA"}
package/dist/config.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as loadConfig, i as defineConfig, n as VIZE_CONFIG_JSON_SCHEMA_PATH, o as normalizeGlobalTypes, r as VIZE_CONFIG_PKL_SCHEMA_PATH, t as CONFIG_FILE_NAMES } from "./config-tYKh_ZMu.mjs";
1
+ import { a as loadConfig, i as defineConfig, n as VIZE_CONFIG_JSON_SCHEMA_PATH, o as normalizeGlobalTypes, r as VIZE_CONFIG_PKL_SCHEMA_PATH, t as CONFIG_FILE_NAMES } from "./config-BbNk5gIK.mjs";
2
2
  export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes };
package/dist/config.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as fs from "node:fs";
2
- import * as path from "node:path";
2
+ import * as path$1 from "node:path";
3
3
  import { execFileSync } from "node:child_process";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
5
5
  import { transform } from "oxc-transform";
@@ -15,9 +15,9 @@ const DEFAULT_CONFIG_ENV = {
15
15
  mode: "development",
16
16
  command: "serve"
17
17
  };
18
- const PACKAGE_ROOT = path.resolve(fileURLToPath(new URL(".", import.meta.url)), "..");
19
- const VIZE_CONFIG_JSON_SCHEMA_PATH = path.join(PACKAGE_ROOT, "schemas", "vize.config.schema.json");
20
- const VIZE_CONFIG_PKL_SCHEMA_PATH = path.join(PACKAGE_ROOT, "pkl", "vize.pkl");
18
+ const PACKAGE_ROOT = path$1.resolve(fileURLToPath(new URL(".", import.meta.url)), "..");
19
+ const VIZE_CONFIG_JSON_SCHEMA_PATH = path$1.join(PACKAGE_ROOT, "schemas", "vize.config.schema.json");
20
+ const VIZE_CONFIG_PKL_SCHEMA_PATH = path$1.join(PACKAGE_ROOT, "pkl", "vize.pkl");
21
21
  /**
22
22
  * Define a Vize configuration with type checking.
23
23
  * Accepts a plain object or a function that receives ConfigEnv.
@@ -32,7 +32,7 @@ async function loadConfig(root, options = {}) {
32
32
  const { mode = "root", configFile, env } = options;
33
33
  if (mode === "none") return null;
34
34
  if (configFile) {
35
- const absolutePath = path.isAbsolute(configFile) ? configFile : path.resolve(root, configFile);
35
+ const absolutePath = path$1.isAbsolute(configFile) ? configFile : path$1.resolve(root, configFile);
36
36
  if (fs.existsSync(absolutePath)) return loadConfigFile(absolutePath, env);
37
37
  return null;
38
38
  }
@@ -47,24 +47,24 @@ async function loadConfig(root, options = {}) {
47
47
  }
48
48
  function findConfigFileInDir(dir) {
49
49
  for (const name of CONFIG_FILE_NAMES) {
50
- const filePath = path.join(dir, name);
50
+ const filePath = path$1.join(dir, name);
51
51
  if (fs.existsSync(filePath)) return filePath;
52
52
  }
53
53
  return null;
54
54
  }
55
55
  function findConfigFileAuto(startDir) {
56
- let currentDir = path.resolve(startDir);
56
+ let currentDir = path$1.resolve(startDir);
57
57
  while (true) {
58
58
  const configPath = findConfigFileInDir(currentDir);
59
59
  if (configPath) return configPath;
60
- const parentDir = path.dirname(currentDir);
60
+ const parentDir = path$1.dirname(currentDir);
61
61
  if (parentDir === currentDir) return null;
62
62
  currentDir = parentDir;
63
63
  }
64
64
  }
65
65
  async function loadConfigFile(filePath, env) {
66
66
  if (!fs.existsSync(filePath)) return null;
67
- const ext = path.extname(filePath);
67
+ const ext = path$1.extname(filePath);
68
68
  if (ext === ".json") return parseJsonConfig(fs.readFileSync(filePath, "utf-8"), filePath);
69
69
  if (ext === ".pkl") return loadPklConfig(filePath);
70
70
  if (ext === ".ts") return loadTypeScriptConfig(filePath, env);
@@ -97,7 +97,7 @@ function loadPklConfig(filePath) {
97
97
  "json",
98
98
  filePath
99
99
  ], {
100
- cwd: path.dirname(filePath),
100
+ cwd: path$1.dirname(filePath),
101
101
  encoding: "utf-8",
102
102
  stdio: [
103
103
  "ignore",
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { execFileSync } from \"node:child_process\";\nimport { fileURLToPath, 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/index.js\";\n\nexport const CONFIG_FILE_NAMES = [\n \"vize.config.ts\",\n \"vize.config.js\",\n \"vize.config.mjs\",\n \"vize.config.pkl\",\n \"vize.config.json\",\n] as const;\n\nconst DEFAULT_CONFIG_ENV: ConfigEnv = {\n mode: \"development\",\n command: \"serve\",\n};\n\nconst PACKAGE_ROOT = path.resolve(fileURLToPath(new URL(\".\", import.meta.url)), \"..\");\n\nexport const VIZE_CONFIG_JSON_SCHEMA_PATH = path.join(\n PACKAGE_ROOT,\n \"schemas\",\n \"vize.config.schema.json\",\n);\n\nexport const VIZE_CONFIG_PKL_SCHEMA_PATH = path.join(PACKAGE_ROOT, \"pkl\", \"vize.pkl\");\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.*` 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 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 if (mode === \"auto\") {\n const configPath = findConfigFileAuto(root);\n if (!configPath) {\n return null;\n }\n return loadConfigFile(configPath, env);\n }\n\n const configPath = findConfigFileInDir(root);\n if (!configPath) {\n return null;\n }\n\n return loadConfigFile(configPath, env);\n}\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\nfunction findConfigFileAuto(startDir: string): string | null {\n let currentDir = path.resolve(startDir);\n\n while (true) {\n const configPath = findConfigFileInDir(currentDir);\n if (configPath) {\n return configPath;\n }\n\n const parentDir = path.dirname(currentDir);\n if (parentDir === currentDir) {\n return null;\n }\n\n currentDir = parentDir;\n }\n}\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 parseJsonConfig(content, filePath);\n }\n\n if (ext === \".pkl\") {\n return loadPklConfig(filePath);\n }\n\n if (ext === \".ts\") {\n return loadTypeScriptConfig(filePath, env);\n }\n\n return loadESMConfig(filePath, env);\n}\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\n return exported;\n}\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 tempFile = filePath.replace(/\\.ts$/, `.temp.${Date.now()}.mjs`);\n fs.writeFileSync(tempFile, result.code);\n\n try {\n const module = await importFresh(tempFile);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\n } finally {\n fs.rmSync(tempFile, { force: true });\n }\n}\n\nasync function loadESMConfig(filePath: string, env?: ConfigEnv): Promise<VizeConfig> {\n const module = await importFresh(filePath);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\n}\n\nfunction loadPklConfig(filePath: string): VizeConfig {\n try {\n const output = execFileSync(\"pkl\", [\"eval\", \"--format\", \"json\", filePath], {\n cwd: path.dirname(filePath),\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n return parseJsonConfig(output, filePath);\n } catch (error) {\n throw new Error(\n `Failed to evaluate PKL config at ${filePath}. Make sure the 'pkl' CLI is installed and on PATH. ${getErrorMessage(error)}`,\n );\n }\n}\n\nasync function importFresh(filePath: string): Promise<Record<string, unknown>> {\n const fileUrl = pathToFileURL(filePath);\n fileUrl.searchParams.set(\"t\", String(fs.statSync(filePath).mtimeMs));\n return import(fileUrl.href);\n}\n\nfunction parseJsonConfig(content: string, filePath: string): VizeConfig {\n try {\n return normalizeLoadedConfig(JSON.parse(content));\n } catch (error) {\n throw new Error(`Failed to parse vize config JSON at ${filePath}: ${getErrorMessage(error)}`);\n }\n}\n\nfunction normalizeLoadedConfig(config: unknown): VizeConfig {\n const normalized = stripNullish(config);\n return (normalized ?? {}) as VizeConfig;\n}\n\nfunction stripNullish(value: unknown): unknown {\n if (value === null) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n return value.map((entry) => stripNullish(entry)).filter((entry) => entry !== undefined);\n }\n\n if (typeof value === \"object\" && value !== null) {\n const result: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value)) {\n const normalizedEntry = stripNullish(entry);\n if (normalizedEntry !== undefined) {\n result[key] = normalizedEntry;\n }\n }\n return result;\n }\n\n return value;\n}\n\nfunction getErrorMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n\n return String(error);\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":";;;;;;AAcA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,qBAAgC;CACpC,MAAM;CACN,SAAS;CACV;AAED,MAAM,eAAe,KAAK,QAAQ,cAAc,IAAI,IAAI,KAAK,OAAO,KAAK,IAAI,CAAC,EAAE,KAAK;AAErF,MAAa,+BAA+B,KAAK,KAC/C,cACA,WACA,0BACD;AAED,MAAa,8BAA8B,KAAK,KAAK,cAAc,OAAO,WAAW;;;;;AAMrF,SAAgB,aAAa,QAA4C;AACvE,QAAO;;;;;AAMT,eAAsB,WACpB,MACA,UAA6B,EAAE,EACH;CAC5B,MAAM,EAAE,OAAO,QAAQ,YAAY,QAAQ;AAE3C,KAAI,SAAS,OACX,QAAO;AAGT,KAAI,YAAY;EACd,MAAM,eAAe,KAAK,WAAW,WAAW,GAAG,aAAa,KAAK,QAAQ,MAAM,WAAW;AAC9F,MAAI,GAAG,WAAW,aAAa,CAC7B,QAAO,eAAe,cAAc,IAAI;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C,EAAE;AAC1C,OAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,EAAE;GAChD,MAAM,kBAAkB,aAAa,MAAM;AAC3C,OAAI,oBAAoB,KAAA,EACtB,QAAO,OAAO;;AAGlB,SAAO;;AAGT,QAAO;;AAGT,SAAS,gBAAgB,OAAwB;AAC/C,KAAI,iBAAiB,MACnB,QAAO,MAAM;AAGf,QAAO,OAAO,MAAM;;;;;AAMtB,SAAgB,qBACd,QACuC;CACvC,MAAM,SAAgD,EAAE;AACxD,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,CAC/C,KAAI,OAAO,UAAU,SACnB,QAAO,OAAO,EAAE,MAAM,OAAO;KAE7B,QAAO,OAAO;AAGlB,QAAO"}
1
+ {"version":3,"file":"config.mjs","names":["path"],"sources":["../src/config.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { execFileSync } from \"node:child_process\";\nimport { fileURLToPath, 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/index.js\";\n\nexport const CONFIG_FILE_NAMES = [\n \"vize.config.ts\",\n \"vize.config.js\",\n \"vize.config.mjs\",\n \"vize.config.pkl\",\n \"vize.config.json\",\n] as const;\n\nconst DEFAULT_CONFIG_ENV: ConfigEnv = {\n mode: \"development\",\n command: \"serve\",\n};\n\nconst PACKAGE_ROOT = path.resolve(fileURLToPath(new URL(\".\", import.meta.url)), \"..\");\n\nexport const VIZE_CONFIG_JSON_SCHEMA_PATH = path.join(\n PACKAGE_ROOT,\n \"schemas\",\n \"vize.config.schema.json\",\n);\n\nexport const VIZE_CONFIG_PKL_SCHEMA_PATH = path.join(PACKAGE_ROOT, \"pkl\", \"vize.pkl\");\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.*` 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 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 if (mode === \"auto\") {\n const configPath = findConfigFileAuto(root);\n if (!configPath) {\n return null;\n }\n return loadConfigFile(configPath, env);\n }\n\n const configPath = findConfigFileInDir(root);\n if (!configPath) {\n return null;\n }\n\n return loadConfigFile(configPath, env);\n}\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\nfunction findConfigFileAuto(startDir: string): string | null {\n let currentDir = path.resolve(startDir);\n\n while (true) {\n const configPath = findConfigFileInDir(currentDir);\n if (configPath) {\n return configPath;\n }\n\n const parentDir = path.dirname(currentDir);\n if (parentDir === currentDir) {\n return null;\n }\n\n currentDir = parentDir;\n }\n}\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 parseJsonConfig(content, filePath);\n }\n\n if (ext === \".pkl\") {\n return loadPklConfig(filePath);\n }\n\n if (ext === \".ts\") {\n return loadTypeScriptConfig(filePath, env);\n }\n\n return loadESMConfig(filePath, env);\n}\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\n return exported;\n}\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 tempFile = filePath.replace(/\\.ts$/, `.temp.${Date.now()}.mjs`);\n fs.writeFileSync(tempFile, result.code);\n\n try {\n const module = await importFresh(tempFile);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\n } finally {\n fs.rmSync(tempFile, { force: true });\n }\n}\n\nasync function loadESMConfig(filePath: string, env?: ConfigEnv): Promise<VizeConfig> {\n const module = await importFresh(filePath);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\n}\n\nfunction loadPklConfig(filePath: string): VizeConfig {\n try {\n const output = execFileSync(\"pkl\", [\"eval\", \"--format\", \"json\", filePath], {\n cwd: path.dirname(filePath),\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n return parseJsonConfig(output, filePath);\n } catch (error) {\n throw new Error(\n `Failed to evaluate PKL config at ${filePath}. Make sure the 'pkl' CLI is installed and on PATH. ${getErrorMessage(error)}`,\n );\n }\n}\n\nasync function importFresh(filePath: string): Promise<Record<string, unknown>> {\n const fileUrl = pathToFileURL(filePath);\n fileUrl.searchParams.set(\"t\", String(fs.statSync(filePath).mtimeMs));\n return import(fileUrl.href);\n}\n\nfunction parseJsonConfig(content: string, filePath: string): VizeConfig {\n try {\n return normalizeLoadedConfig(JSON.parse(content));\n } catch (error) {\n throw new Error(`Failed to parse vize config JSON at ${filePath}: ${getErrorMessage(error)}`);\n }\n}\n\nfunction normalizeLoadedConfig(config: unknown): VizeConfig {\n const normalized = stripNullish(config);\n return (normalized ?? {}) as VizeConfig;\n}\n\nfunction stripNullish(value: unknown): unknown {\n if (value === null) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n return value.map((entry) => stripNullish(entry)).filter((entry) => entry !== undefined);\n }\n\n if (typeof value === \"object\" && value !== null) {\n const result: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value)) {\n const normalizedEntry = stripNullish(entry);\n if (normalizedEntry !== undefined) {\n result[key] = normalizedEntry;\n }\n }\n return result;\n }\n\n return value;\n}\n\nfunction getErrorMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n\n return String(error);\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":";;;;;;AAcA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,qBAAgC;CACpC,MAAM;CACN,SAAS;CACV;AAED,MAAM,eAAeA,OAAK,QAAQ,cAAc,IAAI,IAAI,KAAK,OAAO,KAAK,IAAI,CAAC,EAAE,KAAK;AAErF,MAAa,+BAA+BA,OAAK,KAC/C,cACA,WACA,0BACD;AAED,MAAa,8BAA8BA,OAAK,KAAK,cAAc,OAAO,WAAW;;;;;AAMrF,SAAgB,aAAa,QAA4C;AACvE,QAAO;;;;;AAMT,eAAsB,WACpB,MACA,UAA6B,EAAE,EACH;CAC5B,MAAM,EAAE,OAAO,QAAQ,YAAY,QAAQ;AAE3C,KAAI,SAAS,OACX,QAAO;AAGT,KAAI,YAAY;EACd,MAAM,eAAeA,OAAK,WAAW,WAAW,GAAG,aAAaA,OAAK,QAAQ,MAAM,WAAW;AAC9F,MAAI,GAAG,WAAW,aAAa,CAC7B,QAAO,eAAe,cAAc,IAAI;AAE1C,SAAO;;AAGT,KAAI,SAAS,QAAQ;EACnB,MAAM,aAAa,mBAAmB,KAAK;AAC3C,MAAI,CAAC,WACH,QAAO;AAET,SAAO,eAAe,YAAY,IA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oB,KAAA,EACtB,QAAO,OAAO;;AAGlB,SAAO;;AAGT,QAAO;;AAGT,SAAS,gBAAgB,OAAwB;AAC/C,KAAI,iBAAiB,MACnB,QAAO,MAAM;AAGf,QAAO,OAAO,MAAM;;;;;AAMtB,SAAgB,qBACd,QACuC;CACvC,MAAM,SAAgD,EAAE;AACxD,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,CAC/C,KAAI,OAAO,UAAU,SACnB,QAAO,OAAO,EAAE,MAAM,OAAO;KAE7B,QAAO,OAAO;AAGlB,QAAO"}
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { C as LspConfig, E as VitePluginConfig, S as LinterConfig, T as CompilerConfig, _ as MuseaA11yConfig, a as loadConfig, b as MuseaVrtConfig, c as LintPreset, d as RuleSeverity, f as UserConfigExport, g as LoadConfigOptions, h as GlobalTypesConfig, i as defineConfig, l as MaybePromise, m as GlobalTypeDeclaration, n as VIZE_CONFIG_JSON_SCHEMA_PATH, o as normalizeGlobalTypes, p as VizeConfig, r as VIZE_CONFIG_PKL_SCHEMA_PATH, s as ConfigEnv, t as CONFIG_FILE_NAMES, u as RuleCategory, v as MuseaAutogenConfig, w as TypeCheckerConfig, x as FormatterConfig, y as MuseaConfig } from "./config-tYKh_ZMu.mjs";
2
- export { CONFIG_FILE_NAMES, type CompilerConfig, type ConfigEnv, type FormatterConfig, type GlobalTypeDeclaration, type GlobalTypesConfig, type LintPreset, type LinterConfig, type LoadConfigOptions, type LspConfig, type MaybePromise, type MuseaA11yConfig, type MuseaAutogenConfig, type MuseaConfig, type MuseaVrtConfig, type RuleCategory, type RuleSeverity, type TypeCheckerConfig, type UserConfigExport, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, type VitePluginConfig, type VizeConfig, defineConfig, loadConfig, normalizeGlobalTypes };
1
+ import { C as LspConfig, D as CompilerConfig, E as LintRulesConfig, O as VitePluginConfig, S as LinterConfig, T as LintRuleName, _ as MuseaA11yConfig, a as loadConfig, b as MuseaVrtConfig, c as LintPreset, d as RuleSeverity, f as UserConfigExport, g as LoadConfigOptions, h as GlobalTypesConfig, i as defineConfig, l as MaybePromise, m as GlobalTypeDeclaration, n as VIZE_CONFIG_JSON_SCHEMA_PATH, o as normalizeGlobalTypes, p as VizeConfig, r as VIZE_CONFIG_PKL_SCHEMA_PATH, s as ConfigEnv, t as CONFIG_FILE_NAMES, u as RuleCategory, v as MuseaAutogenConfig, w as TypeCheckerConfig, x as FormatterConfig, y as MuseaConfig } from "./config-BbNk5gIK.mjs";
2
+ export { CONFIG_FILE_NAMES, type CompilerConfig, type ConfigEnv, type FormatterConfig, type GlobalTypeDeclaration, type GlobalTypesConfig, type LintPreset, type LintRuleName, type LintRulesConfig, type LinterConfig, type LoadConfigOptions, type LspConfig, type MaybePromise, type MuseaA11yConfig, type MuseaAutogenConfig, type MuseaConfig, type MuseaVrtConfig, type RuleCategory, type RuleSeverity, type TypeCheckerConfig, type UserConfigExport, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, type VitePluginConfig, type VizeConfig, defineConfig, loadConfig, normalizeGlobalTypes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vize",
3
- "version": "0.48.0",
3
+ "version": "0.49.0",
4
4
  "description": "Vize - High-performance Vue.js toolchain in Rust",
5
5
  "keywords": [
6
6
  "cli",
@@ -53,22 +53,23 @@
53
53
  "vite-plus": "latest"
54
54
  },
55
55
  "optionalDependencies": {
56
- "@vizejs/native-darwin-arm64": "0.48.0",
57
- "@vizejs/native-darwin-x64": "0.48.0",
58
- "@vizejs/native-linux-arm64-gnu": "0.48.0",
59
- "@vizejs/native-linux-arm64-musl": "0.48.0",
60
- "@vizejs/native-linux-x64-gnu": "0.48.0",
61
- "@vizejs/native-linux-x64-musl": "0.48.0",
62
- "@vizejs/native-win32-arm64-msvc": "0.48.0",
63
- "@vizejs/native-win32-x64-msvc": "0.48.0"
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"
64
64
  },
65
65
  "engines": {
66
66
  "node": ">=18"
67
67
  },
68
68
  "scripts": {
69
- "build": "vp pack",
69
+ "build": "vp run generate:rule-types && vp pack",
70
70
  "check": "vp check src vite.config.ts",
71
71
  "check:fix": "vp check --fix src vite.config.ts",
72
- "fmt": "vp fmt --write src vite.config.ts"
72
+ "fmt": "vp fmt --write src vite.config.ts",
73
+ "generate:rule-types": "node --experimental-strip-types ../../scripts/generate-vize-rule-types.ts"
73
74
  }
74
75
  }
package/src/cli.ts CHANGED
@@ -1,8 +1,10 @@
1
- import { createRequire } from "module";
2
- import { readFileSync } from "fs";
1
+ import { readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { createRequire } from "node:module";
3
4
  import { loadConfig } from "./config.js";
4
5
 
5
6
  const require = createRequire(import.meta.url);
7
+ const WORKSPACE_BINDING_PATH = "../../vize-native";
6
8
 
7
9
  // ============================================================================
8
10
  // Native binding loader (oxlint pattern)
@@ -73,14 +75,54 @@ interface NativeBinding {
73
75
  }
74
76
 
75
77
  function loadNative(): NativeBinding {
76
- const pkg = getBindingPackageName();
78
+ const attemptedPackages = getAttemptedPackages();
79
+ let lastError: unknown = null;
80
+
81
+ for (const packageName of attemptedPackages) {
82
+ try {
83
+ const binding = require(packageName) as Partial<NativeBinding>;
84
+ if (typeof binding.lint !== "function") {
85
+ throw new Error(`${packageName} does not expose the lint binding.`);
86
+ }
87
+ return binding as NativeBinding;
88
+ } catch (error) {
89
+ lastError = error;
90
+ }
91
+ }
92
+
93
+ console.error(`Failed to load native binding. Tried: ${attemptedPackages.join(", ")}`);
94
+ console.error("Try reinstalling: npm install vize");
95
+ throw lastError instanceof Error ? lastError : new Error("Failed to load native binding");
96
+ }
97
+
98
+ function getAttemptedPackages(): readonly string[] {
99
+ const platformBindingPackage = getBindingPackageName();
100
+ return shouldPreferWorkspaceBinding(resolveWorkspaceBindingPath())
101
+ ? [WORKSPACE_BINDING_PATH, platformBindingPackage]
102
+ : [platformBindingPackage, WORKSPACE_BINDING_PATH];
103
+ }
104
+
105
+ function resolveWorkspaceBindingPath(): string | null {
77
106
  try {
78
- return require(pkg);
79
- } catch (e) {
80
- console.error(`Failed to load native binding: ${pkg}`);
81
- console.error("Try reinstalling: npm install vize");
82
- throw e;
107
+ return require.resolve(WORKSPACE_BINDING_PATH);
108
+ } catch {
109
+ return null;
110
+ }
111
+ }
112
+
113
+ function shouldPreferWorkspaceBinding(resolvedPath: string | null): boolean {
114
+ const override = process.env.VIZE_PREFER_WORKSPACE_BINDING;
115
+ if (override === "1" || override === "true") {
116
+ return true;
117
+ }
118
+ if (override === "0" || override === "false") {
119
+ return false;
83
120
  }
121
+ if (resolvedPath == null) {
122
+ return false;
123
+ }
124
+
125
+ return resolvedPath.includes(`${path.sep}npm${path.sep}vize-native${path.sep}`);
84
126
  }
85
127
 
86
128
  // ============================================================================
@@ -243,7 +285,35 @@ async function main(): Promise<void> {
243
285
  }
244
286
  }
245
287
 
246
- void main().catch((error) => {
247
- console.error(error instanceof Error ? error.message : String(error));
248
- process.exit(1);
249
- });
288
+ if (!import.meta.vitest) {
289
+ void main().catch((error) => {
290
+ console.error(error instanceof Error ? error.message : String(error));
291
+ process.exit(1);
292
+ });
293
+ }
294
+
295
+ if (import.meta.vitest) {
296
+ const { describe, expect, it } = import.meta.vitest;
297
+
298
+ describe("shouldPreferWorkspaceBinding", () => {
299
+ it("detects the local workspace native package", () => {
300
+ expect(
301
+ shouldPreferWorkspaceBinding(
302
+ `${path.sep}Users${path.sep}example${path.sep}repo${path.sep}npm${path.sep}vize-native${path.sep}index.js`,
303
+ ),
304
+ ).toBe(true);
305
+ });
306
+
307
+ it("ignores published platform packages", () => {
308
+ expect(
309
+ shouldPreferWorkspaceBinding(
310
+ `${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`,
311
+ ),
312
+ ).toBe(false);
313
+ });
314
+
315
+ it("returns false when the fallback package cannot be resolved", () => {
316
+ expect(shouldPreferWorkspaceBinding(null)).toBe(false);
317
+ });
318
+ });
319
+ }
package/src/index.ts CHANGED
@@ -28,6 +28,8 @@ export type {
28
28
  LintPreset,
29
29
  RuleSeverity,
30
30
  RuleCategory,
31
+ LintRuleName,
32
+ LintRulesConfig,
31
33
  } from "./types/index.js";
32
34
 
33
35
  // Config utilities
@@ -8,6 +8,8 @@ export type {
8
8
  VizeConfig,
9
9
  } from "./core.js";
10
10
 
11
+ export type { LintRuleName, LintRulesConfig } from "./rules.js";
12
+
11
13
  export type { CompilerConfig, VitePluginConfig } from "./compiler.js";
12
14
 
13
15
  export type { LinterConfig, TypeCheckerConfig, FormatterConfig, LspConfig } from "./tools.js";
@@ -0,0 +1,121 @@
1
+ // This file is generated by scripts/generate-vize-rule-types.ts.
2
+ // Do not edit it by hand.
3
+
4
+ import type { RuleSeverity } from "./core.js";
5
+
6
+ export const LINT_RULE_NAMES = [
7
+ "a11y/alt-text",
8
+ "a11y/anchor-has-content",
9
+ "a11y/anchor-is-valid",
10
+ "a11y/aria-props",
11
+ "a11y/aria-role",
12
+ "a11y/aria-unsupported-elements",
13
+ "a11y/click-events-have-key-events",
14
+ "a11y/form-control-has-label",
15
+ "a11y/heading-has-content",
16
+ "a11y/heading-levels",
17
+ "a11y/iframe-has-title",
18
+ "a11y/img-alt",
19
+ "a11y/interactive-supports-focus",
20
+ "a11y/label-has-for",
21
+ "a11y/landmark-roles",
22
+ "a11y/media-has-caption",
23
+ "a11y/mouse-events-have-key-events",
24
+ "a11y/no-access-key",
25
+ "a11y/no-aria-hidden-on-focusable",
26
+ "a11y/no-autofocus",
27
+ "a11y/no-distracting-elements",
28
+ "a11y/no-i-for-icon",
29
+ "a11y/no-redundant-roles",
30
+ "a11y/no-refer-to-non-existent-id",
31
+ "a11y/no-role-presentation-on-focusable",
32
+ "a11y/no-static-element-interactions",
33
+ "a11y/placeholder-label-option",
34
+ "a11y/role-has-required-aria-props",
35
+ "a11y/tabindex-no-positive",
36
+ "a11y/use-list",
37
+ "html/deprecated-attr",
38
+ "html/deprecated-element",
39
+ "html/id-duplication",
40
+ "html/no-consecutive-br",
41
+ "html/no-duplicate-dt",
42
+ "html/no-empty-palpable-content",
43
+ "html/require-datetime",
44
+ "script/no-get-current-instance",
45
+ "script/no-next-tick",
46
+ "script/no-options-api",
47
+ "ssr/no-browser-globals-in-ssr",
48
+ "ssr/no-hydration-mismatch",
49
+ "type/no-floating-promises",
50
+ "type/no-unsafe-template-binding",
51
+ "type/require-typed-emits",
52
+ "type/require-typed-props",
53
+ "vapor/no-inline-template",
54
+ "vapor/no-suspense",
55
+ "vapor/no-vue-lifecycle-events",
56
+ "vapor/prefer-static-class",
57
+ "vapor/require-vapor-attribute",
58
+ "vue/attribute-hyphenation",
59
+ "vue/attribute-order",
60
+ "vue/component-definition-name-casing",
61
+ "vue/component-name-in-template-casing",
62
+ "vue/html-quotes",
63
+ "vue/html-self-closing",
64
+ "vue/multi-word-component-names",
65
+ "vue/mustache-interpolation-spacing",
66
+ "vue/no-boolean-attr-value",
67
+ "vue/no-child-content",
68
+ "vue/no-dupe-v-else-if",
69
+ "vue/no-duplicate-attributes",
70
+ "vue/no-inline-style",
71
+ "vue/no-lone-template",
72
+ "vue/no-multi-spaces",
73
+ "vue/no-mutating-props",
74
+ "vue/no-preprocessor-lang",
75
+ "vue/no-reserved-component-names",
76
+ "vue/no-script-non-standard-lang",
77
+ "vue/no-src-attribute",
78
+ "vue/no-template-key",
79
+ "vue/no-template-lang",
80
+ "vue/no-template-shadow",
81
+ "vue/no-textarea-mustache",
82
+ "vue/no-unsafe-url",
83
+ "vue/no-unused-components",
84
+ "vue/no-unused-properties",
85
+ "vue/no-unused-vars",
86
+ "vue/no-use-v-if-with-v-for",
87
+ "vue/no-useless-template-attributes",
88
+ "vue/no-v-html",
89
+ "vue/no-v-text-v-html-on-component",
90
+ "vue/permitted-contents",
91
+ "vue/prefer-props-shorthand",
92
+ "vue/prop-name-casing",
93
+ "vue/require-component-is",
94
+ "vue/require-component-registration",
95
+ "vue/require-scoped-style",
96
+ "vue/require-v-for-key",
97
+ "vue/scoped-event-names",
98
+ "vue/sfc-element-order",
99
+ "vue/single-style-block",
100
+ "vue/use-unique-element-ids",
101
+ "vue/use-v-on-exact",
102
+ "vue/v-bind-style",
103
+ "vue/v-on-style",
104
+ "vue/v-slot-style",
105
+ "vue/valid-attribute-name",
106
+ "vue/valid-v-bind",
107
+ "vue/valid-v-else",
108
+ "vue/valid-v-for",
109
+ "vue/valid-v-if",
110
+ "vue/valid-v-memo",
111
+ "vue/valid-v-model",
112
+ "vue/valid-v-on",
113
+ "vue/valid-v-show",
114
+ "vue/valid-v-slot",
115
+ "vue/warn-custom-block",
116
+ "vue/warn-custom-directive",
117
+ ] as const;
118
+
119
+ export type LintRuleName = (typeof LINT_RULE_NAMES)[number];
120
+
121
+ export type LintRulesConfig = Partial<Record<LintRuleName, RuleSeverity>>;
@@ -1,4 +1,5 @@
1
1
  import type { LintPreset, RuleSeverity, RuleCategory } from "./core.js";
2
+ import type { LintRulesConfig } from "./rules.js";
2
3
 
3
4
  // ============================================================================
4
5
  // LinterConfig
@@ -22,7 +23,7 @@ export interface LinterConfig {
22
23
  /**
23
24
  * Rules to enable/disable
24
25
  */
25
- rules?: Record<string, RuleSeverity>;
26
+ rules?: LintRulesConfig;
26
27
 
27
28
  /**
28
29
  * Category-level severity overrides
@@ -175,6 +176,12 @@ export interface LspConfig {
175
176
  */
176
177
  codeActions?: boolean;
177
178
 
179
+ /**
180
+ * Enable type checking diagnostics and type-aware LSP features
181
+ * @default true
182
+ */
183
+ typecheck?: boolean;
184
+
178
185
  /**
179
186
  * Use Corsa for type checking in LSP
180
187
  * @default false
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-tYKh_ZMu.d.mts","names":[],"sources":["../src/types/compiler.ts","../src/types/tools.ts","../src/types/musea.ts","../src/types/loader.ts","../src/types/core.ts","../src/config.ts"],"mappings":";;AAOA;;UAAiB,cAAA;EAAc;;;;EAK7B,IAAA;EAwBA;;;;EAlBA,KAAA;EAgDA;;;;EA1CA,GAAA;EA0D+B;;;;EApD/B,SAAA;EA+DsC;;;;EAzDtC,iBAAA;EAmDsC;;;;EA7CtC,WAAA;EA+DA;;;;EAzDA,aAAA;;ACvCF;;;ED6CE,IAAA;EC9BuB;;;;EDoCvB,SAAA;EC/Ba;;;;EDqCb,iBAAA;EC/CS;;;;EDqDT,iBAAA;AAAA;;;;UAUe,gBAAA;ECrDuC;AAUxD;;;EDgDE,OAAA,YAAmB,MAAA,aAAmB,MAAA;EC3CtC;;;;EDiDA,OAAA,YAAmB,MAAA,aAAmB,MAAA;ECnBtC;;;;EDyBA,YAAA;ECV8B;;;;EDgB9B,cAAA;AAAA;;;AAlGF;;;AAAA,UCEiB,YAAA;EDGf;;;ECCA,OAAA;EDuBA;;;;ECjBA,MAAA,GAAS,UAAA;ED+CT;;;EC1CA,KAAA,GAAQ,MAAA,SAAe,YAAA;ED0DR;;;ECrDf,UAAA,GAAa,OAAA,CAAQ,MAAA,CAAO,YAAA,EAAc,YAAA;AAAA;;;;UAU3B,iBAAA;EDgDf;;;;EC3CA,OAAA;EDiDsC;;;;EC3CtC,MAAA;;;;AAzCF;EA+CE,UAAA;;;;;EAMA,UAAA;EAjC0C;;;;EAuC1C,qBAAA;EAvDA;;;;EA6DA,QAAA;EAlDuB;;;EAuDvB,SAAA;AAAA;;;;UAUe,eAAA;EAlDiB;;;;EA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