vize 0.69.0 → 0.70.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -59,8 +59,9 @@ export default defineConfig({
59
59
  Override config discovery with `--config`, or disable it with `--no-config`.
60
60
 
61
61
  `vize check` in the npm package uses the packaged NAPI checker so it can run from `package.json`
62
- scripts after installing `vize`. Use the Rust CLI when you need Corsa project diagnostics across
63
- Vue, TS, TSX, and `.d.ts` inputs.
62
+ scripts after installing `vize`. Add `--declaration --declaration-dir dist/types` to emit Vue
63
+ component `.d.ts` files. Use the Rust CLI when you need Corsa project diagnostics across Vue, TS,
64
+ TSX, and `.d.ts` inputs.
64
65
 
65
66
  `vize ready` runs `fmt --write`, `lint`, `check`, and `build` in that order.
66
67
 
package/dist/cli.mjs CHANGED
@@ -107,6 +107,8 @@ function printCheckUsage() {
107
107
  console.error(" -q, --quiet Show summary only");
108
108
  console.error(" --strict Enable strict checks");
109
109
  console.error(" --show-virtual-ts Print generated Virtual TS");
110
+ console.error(" --declaration Emit Vue component .d.ts files");
111
+ console.error(" --declaration-dir <dir> Output directory for declarations");
110
112
  console.error(" --max-warnings <number> Fail when warnings exceed the limit");
111
113
  console.error(" -c, --config <path> Use a specific vize config file");
112
114
  console.error(" --no-config Disable config discovery");
@@ -409,15 +411,20 @@ function parseCheckCommand(args) {
409
411
  else if (arg === "--no-check-setup-context") options.checkSetupContext = false;
410
412
  else if (arg === "--no-check-invalid-exports") options.checkInvalidExports = false;
411
413
  else if (arg === "--no-check-fallthrough-attrs") options.checkFallthroughAttrs = false;
412
- else if (arg === "--config" || arg === "-c") {
414
+ else if (arg === "--declaration") options.declaration = true;
415
+ else if (arg === "--declaration-dir") {
416
+ const declarationDir = args[++i];
417
+ if (!declarationDir) throw new Error("Missing path after --declaration-dir");
418
+ options.declarationDir = declarationDir;
419
+ } else if (arg === "--config" || arg === "-c") {
413
420
  const configFile = args[++i];
414
421
  if (!configFile) throw new Error("Missing path after --config");
415
422
  sharedConfig.configFile = configFile;
416
423
  } else if (arg === "--no-config") sharedConfig.configMode = "none";
417
424
  else if (arg === "--help" || arg === "-h") options.help = true;
418
425
  else if (arg === "--tsconfig" || arg === "--corsa-path" || arg === "--servers") i++;
419
- else if (arg === "--socket" || arg === "-s" || arg === "--declaration-dir") i++;
420
- else if (arg === "--profile" || arg === "--declaration") {} else if (!arg.startsWith("-")) patterns.push(arg);
426
+ else if (arg === "--socket" || arg === "-s") i++;
427
+ else if (arg === "--profile") {} else if (!arg.startsWith("-")) patterns.push(arg);
421
428
  }
422
429
  return {
423
430
  patterns,
@@ -512,6 +519,36 @@ function collectVueFiles(patterns) {
512
519
  }
513
520
  return Array.from(files).sort();
514
521
  }
522
+ function commonSourceDirectory(results) {
523
+ let common = path.dirname(results[0]?.file ?? process.cwd());
524
+ for (let i = 1; i < results.length; i++) {
525
+ const directory = path.dirname(results[i].file);
526
+ while (common !== path.dirname(common)) {
527
+ const relative = path.relative(common, directory);
528
+ if (relative !== ".." && !relative.startsWith(`..${path.sep}`)) break;
529
+ common = path.dirname(common);
530
+ }
531
+ }
532
+ return common;
533
+ }
534
+ function emitCheckDeclarations(results, native, options) {
535
+ if (!options.declaration) return [];
536
+ if (typeof native.generateDeclaration !== "function") throw new Error("The loaded native binding does not support declaration generation.");
537
+ const outDir = path.resolve(process.cwd(), options.declarationDir ?? "dist/types");
538
+ const sourceRoot = commonSourceDirectory(results);
539
+ const declarations = [];
540
+ for (const { file, source } of results) {
541
+ const relative = normalizePath(path.relative(sourceRoot, file));
542
+ const outputPath = path.join(outDir, `${relative}.d.ts`);
543
+ mkdirSync(path.dirname(outputPath), { recursive: true });
544
+ writeFileSync(outputPath, native.generateDeclaration(source, { filename: file }).code);
545
+ declarations.push({
546
+ file: displayPath(outputPath),
547
+ path: outputPath
548
+ });
549
+ }
550
+ return declarations;
551
+ }
515
552
  function lineStarts(source) {
516
553
  const starts = [0];
517
554
  for (let i = 0; i < source.length; i++) if (source.charCodeAt(i) === 10) starts.push(i + 1);
@@ -553,7 +590,7 @@ function toNativeTypeCheckOptions(file, options) {
553
590
  check_fallthrough_attrs: options.checkFallthroughAttrs
554
591
  };
555
592
  }
556
- function renderCheckText(results, options, timeMs) {
593
+ function renderCheckText(results, options, timeMs, declarations = []) {
557
594
  let totalErrors = 0;
558
595
  let totalWarnings = 0;
559
596
  for (const { file, source, result } of results) {
@@ -576,6 +613,7 @@ function renderCheckText(results, options, timeMs) {
576
613
  if (totalErrors > 0) process.stdout.write(` \x1b[31m${totalErrors} error(s)\x1b[0m\n`);
577
614
  else process.stdout.write(" \x1B[32mNo type errors found!\x1B[0m\n");
578
615
  if (totalWarnings > 0) process.stdout.write(` \x1b[33m${totalWarnings} warning(s)\x1b[0m\n`);
616
+ if (declarations.length > 0) process.stdout.write(` \x1b[32mEmitted ${declarations.length} declaration file(s)\x1b[0m\n`);
579
617
  }
580
618
  async function runCheck(args) {
581
619
  const { patterns, options, sharedConfig } = parseCheckCommand(args);
@@ -616,6 +654,7 @@ async function runCheck(args) {
616
654
  };
617
655
  });
618
656
  const timeMs = performance.now() - start;
657
+ const declarations = emitCheckDeclarations(results, native, options);
619
658
  const totalErrors = results.reduce((sum, { result }) => sum + result.errorCount, 0);
620
659
  const totalWarnings = results.reduce((sum, { result }) => sum + result.warningCount, 0);
621
660
  if (options.format === "json") process.stdout.write(`${JSON.stringify({
@@ -626,9 +665,10 @@ async function runCheck(args) {
626
665
  })),
627
666
  errorCount: totalErrors,
628
667
  warningCount: totalWarnings,
629
- fileCount: results.length
668
+ fileCount: results.length,
669
+ declarations: declarations.map(({ file }) => file)
630
670
  }, null, 2)}\n`);
631
- else renderCheckText(results, options, timeMs);
671
+ else renderCheckText(results, options, timeMs, declarations);
632
672
  if (totalErrors > 0) process.exit(1);
633
673
  if (options.maxWarnings !== void 0 && totalWarnings > options.maxWarnings) {
634
674
  process.stderr.write(`\nToo many warnings (${totalWarnings} > max ${options.maxWarnings})\n`);
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from \"node:fs\";\nimport { spawnSync } from \"node:child_process\";\nimport * as path from \"node:path\";\nimport { createRequire } from \"node:module\";\nimport { pathToFileURL } from \"node:url\";\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 compileSfcBatchWithResults: (\n files: BatchFileInput[],\n options?: NativeBuildOptions,\n ) => BatchCompileResult;\n formatSfc: (source: string, options?: NativeFormatOptions) => FormatResult;\n typeCheck: (source: string, options?: NativeTypeCheckOptions) => TypeCheckResult;\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\ntype NativeCommand = \"build\" | \"check\" | \"fmt\" | \"lint\";\n\nconst REQUIRED_BINDINGS: Record<NativeCommand, keyof NativeBinding> = {\n build: \"compileSfcBatchWithResults\",\n check: \"typeCheck\",\n fmt: \"formatSfc\",\n lint: \"lint\",\n};\n\nfunction loadNative(command: NativeCommand): NativeBinding {\n const attemptedPackages = getAttemptedPackages();\n let lastError: unknown = null;\n const requiredBinding = REQUIRED_BINDINGS[command];\n\n for (const packageName of attemptedPackages) {\n try {\n const binding = require(packageName) as Partial<NativeBinding>;\n if (typeof binding[requiredBinding] !== \"function\") {\n throw new Error(`${packageName} does not expose the ${command} 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 printUsage(): void {\n console.error(\"Usage: vize <command> [options]\");\n console.error(\"Commands: build, fmt, check, lint, upgrade, ready, musea\");\n}\n\nfunction printBuildUsage(): void {\n console.error(\"Usage: vize build [options] [files-or-directories]\");\n console.error(\"Options:\");\n console.error(\" -o, --output <dir> Output directory\");\n console.error(\" -f, --format <js|json|stats> Output format\");\n console.error(\" --ssr Enable SSR compilation\");\n console.error(\" --script-ext <mode> preserve or downcompile\");\n console.error(\" -j, --threads <number> Worker thread count\");\n}\n\nfunction printFmtUsage(): void {\n console.error(\"Usage: vize fmt [options] [files-or-directories]\");\n console.error(\"Options:\");\n console.error(\" --check Exit with an error if files need formatting\");\n console.error(\" -w, --write Write formatted output\");\n console.error(\" --single-quote Use single quotes\");\n console.error(\" --print-width <number> Maximum line width\");\n console.error(\" --tab-width <number> Indentation width\");\n console.error(\" --use-tabs Indent with tabs\");\n console.error(\" --no-semi Omit semicolons\");\n}\n\nfunction printCheckUsage(): void {\n console.error(\"Usage: vize check [options] [files-or-directories]\");\n console.error(\"Options:\");\n console.error(\" -f, --format <text|json> Output format\");\n console.error(\" -q, --quiet Show summary only\");\n console.error(\" --strict Enable strict checks\");\n console.error(\" --show-virtual-ts Print generated Virtual TS\");\n console.error(\" --max-warnings <number> Fail when warnings exceed the limit\");\n console.error(\" -c, --config <path> Use a specific vize config file\");\n console.error(\" --no-config Disable config discovery\");\n console.error(\"\");\n console.error(\n \"Note: npm `vize check` uses the packaged NAPI checker. Install the Rust CLI for project-backed Corsa diagnostics.\",\n );\n}\n\nfunction printUpgradeUsage(): void {\n console.error(\"Usage: vize upgrade [options]\");\n console.error(\"Options:\");\n console.error(\" --package-manager <name> npm, pnpm, yarn, bun, or vp\");\n console.error(\" -g, --global Upgrade the global installation\");\n console.error(\" --dry-run Print the command without running it\");\n}\n\nfunction printReadyUsage(): void {\n console.error(\"Usage: vize ready [options] [files-or-directories]\");\n console.error(\"Runs: fmt --write -> lint -> check -> build\");\n console.error(\"Options:\");\n console.error(\" -o, --output <dir> Output directory for build\");\n console.error(\" --ssr Enable SSR compilation for build\");\n console.error(\" --script-ext <mode> preserve or downcompile\");\n}\n\nfunction resolvePackageBinaryFromCwd(packageName: string, binName: string = packageName): string {\n const cwdRequire = createRequire(pathToFileURL(path.join(process.cwd(), \"package.json\")).href);\n const packageJsonPath = cwdRequire.resolve(`${packageName}/package.json`);\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as {\n bin?: string | Record<string, string>;\n };\n\n const bin = typeof packageJson.bin === \"string\" ? packageJson.bin : packageJson.bin?.[binName];\n\n if (!bin) {\n throw new Error(`Could not resolve binary '${binName}' from package '${packageName}'`);\n }\n\n return path.resolve(path.dirname(packageJsonPath), bin);\n}\n\nfunction runMusea(args: string[]): void {\n const isHelp = args.includes(\"--help\") || args.includes(\"-h\");\n if (isHelp) {\n console.error(\"Usage: vize musea [--build] [...vite options]\");\n console.error(\" --build Run `vite build` instead of `vite dev`\");\n return;\n }\n\n const isBuild = args.includes(\"--build\");\n const viteArgs = args.filter((arg) => arg !== \"--build\");\n const viteCommand = isBuild ? \"build\" : \"dev\";\n const viteBin = resolvePackageBinaryFromCwd(\"vite\");\n const result = spawnSync(process.execPath, [viteBin, viteCommand, ...viteArgs], {\n stdio: \"inherit\",\n cwd: process.cwd(),\n env: process.env,\n });\n\n if (result.error) {\n throw result.error;\n }\n\n process.exit(result.status ?? 1);\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\n// ============================================================================\n// Build command\n// ============================================================================\n\ninterface NativeBuildOptions {\n ssr?: boolean;\n vapor?: boolean;\n customRenderer?: boolean;\n custom_renderer?: boolean;\n isTs?: boolean;\n is_ts?: boolean;\n threads?: number;\n}\n\ninterface BatchFileInput {\n path: string;\n source: string;\n}\n\ninterface BatchFileResult {\n path: string;\n code: string;\n css?: string;\n errors: string[];\n warnings: string[];\n scopeId?: string;\n scope_id?: string;\n hasScoped?: boolean;\n has_scoped?: boolean;\n}\n\ninterface BatchCompileResult {\n results: BatchFileResult[];\n successCount?: number;\n success_count?: number;\n failedCount?: number;\n failed_count?: number;\n timeMs?: number;\n time_ms?: number;\n}\n\ninterface BuildOptions {\n output: string;\n format: \"js\" | \"json\" | \"stats\";\n ssr?: boolean;\n vapor?: boolean;\n customRenderer?: boolean;\n scriptExt: \"preserve\" | \"downcompile\";\n threads?: number;\n help?: boolean;\n}\n\ninterface ParsedBuildCommand {\n patterns: string[];\n options: BuildOptions;\n sharedConfig: SharedConfigOptions;\n}\n\nfunction parseBuildCommand(args: string[]): ParsedBuildCommand {\n const patterns: string[] = [];\n const options: BuildOptions = {\n output: \"./dist\",\n format: \"js\",\n scriptExt: \"downcompile\",\n };\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 === \"--output\" || arg === \"-o\") {\n options.output = args[++i] ?? options.output;\n } else if (arg === \"--format\" || arg === \"-f\") {\n const format = args[++i];\n if (format === \"js\" || format === \"json\" || format === \"stats\") {\n options.format = format;\n }\n } else if (arg === \"--ssr\") {\n options.ssr = true;\n } else if (arg === \"--vapor\") {\n options.vapor = true;\n } else if (arg === \"--custom-renderer\") {\n options.customRenderer = true;\n } else if (arg === \"--script-ext\") {\n const scriptExt = args[++i];\n if (scriptExt === \"preserve\" || scriptExt === \"downcompile\") {\n options.scriptExt = scriptExt;\n }\n } else if (arg === \"--threads\" || arg === \"-j\") {\n options.threads = Number.parseInt(args[++i], 10);\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 === \"--profile\" || arg === \"--continue-on-error\") {\n // Accepted for command compatibility. The npm build path prints a compact summary.\n } else if (arg === \"--help\" || arg === \"-h\") {\n options.help = true;\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n return { patterns, options, sharedConfig };\n}\n\nfunction getScriptLang(source: string): string {\n const match = source.match(/<script\\b[^>]*\\blang=[\"']([^\"']+)[\"']/i);\n return match?.[1] ?? \"js\";\n}\n\nfunction getOutputExtension(source: string, scriptExt: BuildOptions[\"scriptExt\"]): string {\n if (scriptExt === \"downcompile\") {\n return \"js\";\n }\n const lang = getScriptLang(source);\n return lang === \"ts\" || lang === \"tsx\" || lang === \"jsx\" ? lang : \"js\";\n}\n\nfunction outputFileName(file: string, extension: string): string {\n return path.basename(file).replace(/\\.vue$/i, `.${extension}`);\n}\n\nfunction toNativeBuildOptions(options: BuildOptions): NativeBuildOptions {\n const isTs = options.scriptExt === \"preserve\";\n return {\n ssr: options.ssr,\n vapor: options.vapor,\n customRenderer: options.customRenderer,\n custom_renderer: options.customRenderer,\n isTs,\n is_ts: isTs,\n threads: options.threads,\n };\n}\n\nasync function runBuild(args: string[]): Promise<void> {\n const { patterns, options, sharedConfig } = parseBuildCommand(args);\n if (options.help) {\n printBuildUsage();\n return;\n }\n\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: \"build\",\n },\n });\n\n if (sharedConfig.configFile && !config) {\n throw new Error(`Could not find config file: ${sharedConfig.configFile}`);\n }\n\n options.ssr ??= config?.compiler?.ssr;\n options.vapor ??= config?.compiler?.vapor;\n options.customRenderer ??= config?.compiler?.customRenderer;\n if (config?.compiler?.scriptExt === \"ts\") {\n options.scriptExt = \"preserve\";\n } else if (config?.compiler?.scriptExt === \"js\") {\n options.scriptExt = \"downcompile\";\n }\n\n const files = collectVueFiles(patterns);\n if (files.length === 0) {\n process.stderr.write(`No Vue files found matching inputs: ${JSON.stringify(patterns)}\\n`);\n process.exit(1);\n }\n\n const inputs = files.map((file) => ({\n path: file,\n source: readFileSync(file, \"utf8\"),\n }));\n const native = loadNative(\"build\");\n const startedAt = performance.now();\n const result = native.compileSfcBatchWithResults(inputs, toNativeBuildOptions(options));\n const timeMs = result.timeMs ?? result.time_ms ?? performance.now() - startedAt;\n const results = [...result.results].sort((left, right) => left.path.localeCompare(right.path));\n\n if (options.format !== \"stats\") {\n mkdirSync(options.output, { recursive: true });\n }\n\n for (const fileResult of results) {\n const source = inputs.find((input) => input.path === fileResult.path)?.source ?? \"\";\n for (const warning of fileResult.warnings) {\n process.stderr.write(`warning: ${displayPath(fileResult.path)} ${warning}\\n`);\n }\n for (const error of fileResult.errors) {\n process.stderr.write(`error: ${displayPath(fileResult.path)} ${error}\\n`);\n }\n\n if (fileResult.errors.length > 0 || options.format === \"stats\") {\n continue;\n }\n\n const extension =\n options.format === \"json\" ? \"json\" : getOutputExtension(source, options.scriptExt);\n const outputPath = path.join(options.output, outputFileName(fileResult.path, extension));\n const content =\n options.format === \"json\" ? JSON.stringify(fileResult, null, 2) : fileResult.code;\n writeFileSync(outputPath, content);\n }\n\n const failed =\n result.failedCount ?? result.failed_count ?? results.filter((r) => r.errors.length).length;\n const success = result.successCount ?? result.success_count ?? results.length - failed;\n process.stderr.write(\n `\\x1b[32mOK\\x1b[0m Built ${success} Vue file(s) in ${timeMs.toFixed(2)}ms\\n`,\n );\n\n if (failed > 0) {\n process.stderr.write(`\\x1b[31mERR\\x1b[0m ${failed} file(s) failed\\n`);\n process.exit(1);\n }\n}\n\n// ============================================================================\n// Format command\n// ============================================================================\n\ninterface NativeFormatOptions {\n printWidth?: number;\n print_width?: number;\n tabWidth?: number;\n tab_width?: number;\n useTabs?: boolean;\n use_tabs?: boolean;\n semi?: boolean;\n singleQuote?: boolean;\n single_quote?: boolean;\n sortAttributes?: boolean;\n sort_attributes?: boolean;\n singleAttributePerLine?: boolean;\n single_attribute_per_line?: boolean;\n maxAttributesPerLine?: number;\n max_attributes_per_line?: number;\n normalizeDirectiveShorthands?: boolean;\n normalize_directive_shorthands?: boolean;\n}\n\ninterface FormatResult {\n code: string;\n changed: boolean;\n}\n\ninterface FmtOptions extends NativeFormatOptions {\n check?: boolean;\n write?: boolean;\n help?: boolean;\n}\n\ninterface ParsedFmtCommand {\n patterns: string[];\n options: FmtOptions;\n sharedConfig: SharedConfigOptions;\n}\n\nfunction parseFmtCommand(args: string[]): ParsedFmtCommand {\n const patterns: string[] = [];\n const options: FmtOptions = {};\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 === \"--check\") {\n options.check = true;\n } else if (arg === \"--write\" || arg === \"-w\") {\n options.write = true;\n } else if (arg === \"--single-quote\") {\n options.singleQuote = true;\n } else if (arg === \"--print-width\") {\n options.printWidth = Number.parseInt(args[++i], 10);\n } else if (arg === \"--tab-width\") {\n options.tabWidth = Number.parseInt(args[++i], 10);\n } else if (arg === \"--use-tabs\") {\n options.useTabs = true;\n } else if (arg === \"--no-semi\") {\n options.semi = false;\n } else if (arg === \"--sort-attributes\") {\n options.sortAttributes = true;\n } else if (arg === \"--single-attribute-per-line\") {\n options.singleAttributePerLine = true;\n } else if (arg === \"--max-attributes-per-line\") {\n options.maxAttributesPerLine = Number.parseInt(args[++i], 10);\n } else if (arg === \"--normalize-directive-shorthands\") {\n options.normalizeDirectiveShorthands = true;\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 === \"--profile\") {\n // Accepted for command compatibility. The npm fmt path prints a compact summary.\n } else if (arg === \"--help\" || arg === \"-h\") {\n options.help = true;\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n return { patterns, options, sharedConfig };\n}\n\nfunction toNativeFormatOptions(options: FmtOptions): NativeFormatOptions {\n return {\n printWidth: options.printWidth,\n print_width: options.printWidth,\n tabWidth: options.tabWidth,\n tab_width: options.tabWidth,\n useTabs: options.useTabs,\n use_tabs: options.useTabs,\n semi: options.semi,\n singleQuote: options.singleQuote,\n single_quote: options.singleQuote,\n sortAttributes: options.sortAttributes,\n sort_attributes: options.sortAttributes,\n singleAttributePerLine: options.singleAttributePerLine,\n single_attribute_per_line: options.singleAttributePerLine,\n maxAttributesPerLine: options.maxAttributesPerLine,\n max_attributes_per_line: options.maxAttributesPerLine,\n normalizeDirectiveShorthands: options.normalizeDirectiveShorthands,\n normalize_directive_shorthands: options.normalizeDirectiveShorthands,\n };\n}\n\nasync function runFmt(args: string[]): Promise<void> {\n const { patterns, options, sharedConfig } = parseFmtCommand(args);\n if (options.help) {\n printFmtUsage();\n return;\n }\n\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: \"fmt\",\n },\n });\n\n if (sharedConfig.configFile && !config) {\n throw new Error(`Could not find config file: ${sharedConfig.configFile}`);\n }\n\n options.printWidth ??= config?.formatter?.printWidth;\n options.tabWidth ??= config?.formatter?.tabWidth;\n options.useTabs ??= config?.formatter?.useTabs;\n options.semi ??= config?.formatter?.semi;\n options.singleQuote ??= config?.formatter?.singleQuote;\n\n const files = collectVueFiles(patterns);\n if (files.length === 0) {\n process.stderr.write(`No Vue files found matching inputs: ${JSON.stringify(patterns)}\\n`);\n return;\n }\n\n const native = loadNative(\"fmt\");\n let changed = 0;\n let errored = 0;\n\n for (const file of files) {\n const source = readFileSync(file, \"utf8\");\n try {\n const result = native.formatSfc(source, toNativeFormatOptions(options));\n if (!result.changed) {\n continue;\n }\n changed++;\n if (options.check) {\n process.stderr.write(`Would reformat: ${displayPath(file)}\\n`);\n } else if (options.write) {\n writeFileSync(file, result.code);\n process.stderr.write(`Reformatted: ${displayPath(file)}\\n`);\n } else {\n process.stderr.write(`Would reformat: ${displayPath(file)}\\n`);\n }\n } catch (error) {\n errored++;\n process.stderr.write(\n `Error formatting ${displayPath(file)}: ${error instanceof Error ? error.message : String(error)}\\n`,\n );\n }\n }\n\n process.stderr.write(\n `\\x1b[32mOK\\x1b[0m Formatted ${files.length} Vue file(s), ${changed} changed\\n`,\n );\n\n if (errored > 0 || (options.check && changed > 0)) {\n process.exit(1);\n }\n}\n\n// ============================================================================\n// Check command\n// ============================================================================\n\ninterface NativeTypeCheckOptions {\n filename?: string;\n strict?: boolean;\n includeVirtualTs?: boolean;\n include_virtual_ts?: boolean;\n checkProps?: boolean;\n check_props?: boolean;\n checkEmits?: boolean;\n check_emits?: boolean;\n checkTemplateBindings?: boolean;\n check_template_bindings?: boolean;\n checkReactivity?: boolean;\n check_reactivity?: boolean;\n checkSetupContext?: boolean;\n check_setup_context?: boolean;\n checkInvalidExports?: boolean;\n check_invalid_exports?: boolean;\n checkFallthroughAttrs?: boolean;\n check_fallthrough_attrs?: boolean;\n}\n\ninterface TypeDiagnostic {\n severity: string;\n message: string;\n start: number;\n end: number;\n code?: string;\n help?: string;\n related?: Array<{\n message: string;\n start: number;\n end: number;\n filename?: string;\n }>;\n}\n\ninterface TypeCheckResult {\n diagnostics: TypeDiagnostic[];\n virtualTs?: string;\n errorCount: number;\n warningCount: number;\n analysisTimeMs?: number;\n}\n\ninterface CheckOptions {\n format?: string;\n quiet?: boolean;\n strict?: boolean;\n includeVirtualTs?: boolean;\n maxWarnings?: number;\n checkProps?: boolean;\n checkEmits?: boolean;\n checkTemplateBindings?: boolean;\n checkReactivity?: boolean;\n checkSetupContext?: boolean;\n checkInvalidExports?: boolean;\n checkFallthroughAttrs?: boolean;\n help?: boolean;\n}\n\ninterface ParsedCheckCommand {\n patterns: string[];\n options: CheckOptions;\n sharedConfig: SharedConfigOptions;\n}\n\ninterface CheckedFileResult {\n file: string;\n source: string;\n result: TypeCheckResult;\n}\n\nfunction parseCheckCommand(args: string[]): ParsedCheckCommand {\n const patterns: string[] = [];\n const options: CheckOptions = {};\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 === \"--quiet\" || arg === \"-q\") {\n options.quiet = true;\n } else if (arg === \"--strict\") {\n options.strict = true;\n } else if (arg === \"--no-strict\") {\n options.strict = false;\n } else if (arg === \"--show-virtual-ts\" || arg === \"--include-virtual-ts\") {\n options.includeVirtualTs = true;\n } else if (arg === \"--max-warnings\") {\n options.maxWarnings = Number.parseInt(args[++i], 10);\n } else if (arg === \"--no-check-props\") {\n options.checkProps = false;\n } else if (arg === \"--no-check-emits\") {\n options.checkEmits = false;\n } else if (arg === \"--no-check-template-bindings\") {\n options.checkTemplateBindings = false;\n } else if (arg === \"--no-check-reactivity\") {\n options.checkReactivity = false;\n } else if (arg === \"--no-check-setup-context\") {\n options.checkSetupContext = false;\n } else if (arg === \"--no-check-invalid-exports\") {\n options.checkInvalidExports = false;\n } else if (arg === \"--no-check-fallthrough-attrs\") {\n options.checkFallthroughAttrs = false;\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 === \"--help\" || arg === \"-h\") {\n options.help = true;\n } else if (arg === \"--tsconfig\" || arg === \"--corsa-path\" || arg === \"--servers\") {\n i++;\n } else if (arg === \"--socket\" || arg === \"-s\" || arg === \"--declaration-dir\") {\n i++;\n } else if (arg === \"--profile\" || arg === \"--declaration\") {\n // Accepted for package-script compatibility with the Rust CLI. The npm\n // checker does not currently emit project profiles or declarations.\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n return { patterns, options, sharedConfig };\n}\n\nfunction hasGlobSyntax(pattern: string): boolean {\n return pattern.includes(\"*\") || pattern.includes(\"?\") || pattern.includes(\"[\");\n}\n\nfunction normalizePath(filePath: string): string {\n return filePath.split(path.sep).join(\"/\");\n}\n\nfunction displayPath(filePath: string): string {\n const relative = path.relative(process.cwd(), filePath);\n if (relative && !relative.startsWith(\"..\") && !path.isAbsolute(relative)) {\n return normalizePath(relative);\n }\n return normalizePath(filePath);\n}\n\nfunction isVueFile(filePath: string): boolean {\n return path.extname(filePath) === \".vue\";\n}\n\nfunction collectVueFilesFromDirectory(directory: string, recursive: boolean): string[] {\n const files: string[] = [];\n const entries = readdirSync(directory, { withFileTypes: true });\n\n for (const entry of entries) {\n const entryPath = path.join(directory, entry.name);\n if (entry.isDirectory()) {\n if (entry.name === \"node_modules\" || entry.name === \".git\") {\n continue;\n }\n if (recursive) {\n files.push(...collectVueFilesFromDirectory(entryPath, true));\n }\n } else if (entry.isFile() && isVueFile(entryPath)) {\n files.push(entryPath);\n }\n }\n\n return files;\n}\n\nfunction globBase(pattern: string): string {\n const normalized = normalizePath(pattern);\n const globIndex = normalized.search(/[*?[]/);\n if (globIndex === -1) {\n return normalized;\n }\n\n const beforeGlob = normalized.slice(0, globIndex);\n const slashIndex = beforeGlob.lastIndexOf(\"/\");\n if (slashIndex === -1) {\n return \".\";\n }\n return beforeGlob.slice(0, slashIndex) || \"/\";\n}\n\nfunction globToRegExp(pattern: string): RegExp {\n const normalized = normalizePath(pattern);\n let source = \"\";\n\n for (let i = 0; i < normalized.length; i++) {\n const char = normalized[i];\n const next = normalized[i + 1];\n const afterNext = normalized[i + 2];\n\n if (char === \"*\" && next === \"*\" && afterNext === \"/\") {\n source += \"(?:.*/)?\";\n i += 2;\n } else if (char === \"*\" && next === \"*\") {\n source += \".*\";\n i++;\n } else if (char === \"*\") {\n source += \"[^/]*\";\n } else if (char === \"?\") {\n source += \"[^/]\";\n } else if (\"\\\\^$+?.()|{}[]\".includes(char)) {\n source += `\\\\${char}`;\n } else {\n source += char;\n }\n }\n\n return new RegExp(`^${source}$`);\n}\n\nfunction shouldRecurseGlob(pattern: string, base: string): boolean {\n const normalizedPattern = normalizePath(pattern);\n const normalizedBase = normalizePath(base);\n const rest =\n normalizedBase === \".\"\n ? normalizedPattern\n : normalizedPattern.slice(normalizedBase.length).replace(/^\\/+/, \"\");\n return rest.includes(\"/\");\n}\n\nfunction collectVueFilesFromGlob(pattern: string): string[] {\n const basePattern = globBase(pattern);\n const base = path.resolve(process.cwd(), basePattern);\n if (!existsSync(base)) {\n return [];\n }\n\n const isAbsolutePattern = path.isAbsolute(pattern);\n const normalizedPattern = normalizePath(isAbsolutePattern ? path.resolve(pattern) : pattern);\n const regex = globToRegExp(normalizedPattern);\n const candidates = collectVueFilesFromDirectory(base, shouldRecurseGlob(pattern, basePattern));\n\n return candidates.filter((file) => {\n const comparable = isAbsolutePattern\n ? normalizePath(file)\n : normalizePath(path.relative(process.cwd(), file));\n return regex.test(comparable);\n });\n}\n\nfunction collectVueFiles(patterns: string[]): string[] {\n const files = new Set<string>();\n const inputs = patterns.length === 0 ? [\".\"] : patterns;\n\n for (const input of inputs) {\n if (hasGlobSyntax(input)) {\n for (const file of collectVueFilesFromGlob(input)) {\n files.add(path.resolve(file));\n }\n continue;\n }\n\n const resolved = path.resolve(process.cwd(), input);\n if (!existsSync(resolved)) {\n continue;\n }\n\n const stats = statSync(resolved);\n if (stats.isDirectory()) {\n for (const file of collectVueFilesFromDirectory(resolved, true)) {\n files.add(path.resolve(file));\n }\n } else if (stats.isFile() && isVueFile(resolved)) {\n files.add(resolved);\n }\n }\n\n return Array.from(files).sort();\n}\n\nfunction lineStarts(source: string): number[] {\n const starts = [0];\n for (let i = 0; i < source.length; i++) {\n if (source.charCodeAt(i) === 10) {\n starts.push(i + 1);\n }\n }\n return starts;\n}\n\nfunction offsetToLineColumn(starts: number[], offset: number): { line: number; column: number } {\n let low = 0;\n let high = starts.length - 1;\n while (low <= high) {\n const mid = Math.floor((low + high) / 2);\n if (starts[mid] <= offset) {\n low = mid + 1;\n } else {\n high = mid - 1;\n }\n }\n\n const lineIndex = Math.max(0, high);\n return {\n line: lineIndex + 1,\n column: offset - starts[lineIndex] + 1,\n };\n}\n\nfunction toNativeTypeCheckOptions(file: string, options: CheckOptions): NativeTypeCheckOptions {\n return {\n filename: file,\n strict: options.strict,\n includeVirtualTs: options.includeVirtualTs,\n include_virtual_ts: options.includeVirtualTs,\n checkProps: options.checkProps,\n check_props: options.checkProps,\n checkEmits: options.checkEmits,\n check_emits: options.checkEmits,\n checkTemplateBindings: options.checkTemplateBindings,\n check_template_bindings: options.checkTemplateBindings,\n checkReactivity: options.checkReactivity,\n check_reactivity: options.checkReactivity,\n checkSetupContext: options.checkSetupContext,\n check_setup_context: options.checkSetupContext,\n checkInvalidExports: options.checkInvalidExports,\n check_invalid_exports: options.checkInvalidExports,\n checkFallthroughAttrs: options.checkFallthroughAttrs,\n check_fallthrough_attrs: options.checkFallthroughAttrs,\n };\n}\n\nfunction renderCheckText(\n results: CheckedFileResult[],\n options: CheckOptions,\n timeMs: number,\n): void {\n let totalErrors = 0;\n let totalWarnings = 0;\n\n for (const { file, source, result } of results) {\n totalErrors += result.errorCount;\n totalWarnings += result.warningCount;\n\n if (options.includeVirtualTs && result.virtualTs) {\n process.stderr.write(`\\n=== ${displayPath(file)} ===\\n${result.virtualTs}\\n`);\n }\n\n if (options.quiet || result.diagnostics.length === 0) {\n continue;\n }\n\n const starts = lineStarts(source);\n process.stdout.write(`\\n\\x1b[4m${displayPath(file)}\\x1b[0m\\n`);\n for (const diagnostic of result.diagnostics) {\n const color = diagnostic.severity === \"error\" ? \"\\x1b[31m\" : \"\\x1b[33m\";\n const location = offsetToLineColumn(starts, diagnostic.start);\n const code = diagnostic.code ? ` [${diagnostic.code}]` : \"\";\n process.stdout.write(\n ` ${color}${diagnostic.severity}:${location.line}:${location.column}\\x1b[0m${code} ${diagnostic.message}\\n`,\n );\n if (diagnostic.help) {\n process.stdout.write(` help: ${diagnostic.help}\\n`);\n }\n }\n }\n\n const status = totalErrors > 0 ? \"\\x1b[31mERR\\x1b[0m\" : \"\\x1b[32mOK\\x1b[0m\";\n process.stdout.write(\n `\\n${status} Type checked ${results.length} Vue files in ${timeMs.toFixed(2)}ms\\n`,\n );\n if (totalErrors > 0) {\n process.stdout.write(` \\x1b[31m${totalErrors} error(s)\\x1b[0m\\n`);\n } else {\n process.stdout.write(\" \\x1b[32mNo type errors found!\\x1b[0m\\n\");\n }\n if (totalWarnings > 0) {\n process.stdout.write(` \\x1b[33m${totalWarnings} warning(s)\\x1b[0m\\n`);\n }\n}\n\nasync function runCheck(args: string[]): Promise<void> {\n const { patterns, options, sharedConfig } = parseCheckCommand(args);\n if (options.help) {\n printCheckUsage();\n return;\n }\n\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: \"check\",\n },\n });\n\n if (sharedConfig.configFile && !config) {\n throw new Error(`Could not find config file: ${sharedConfig.configFile}`);\n }\n\n if (config?.typeChecker?.enabled === false) {\n process.stderr.write(\n \"[vize] Skipping check because typeChecker.enabled is false in vize.config.\\n\",\n );\n return;\n }\n\n options.strict ??= config?.typeChecker?.strict;\n options.checkProps ??= config?.typeChecker?.checkProps;\n options.checkEmits ??= config?.typeChecker?.checkEmits;\n options.checkTemplateBindings ??= config?.typeChecker?.checkTemplateBindings;\n\n const files = collectVueFiles(patterns);\n if (files.length === 0) {\n process.stderr.write(`No Vue files found matching inputs: ${JSON.stringify(patterns)}\\n`);\n return;\n }\n\n const native = loadNative(\"check\");\n const start = performance.now();\n const results = files.map((file) => {\n const source = readFileSync(file, \"utf8\");\n return {\n file,\n source,\n result: native.typeCheck(source, toNativeTypeCheckOptions(file, options)),\n };\n });\n const timeMs = performance.now() - start;\n const totalErrors = results.reduce((sum, { result }) => sum + result.errorCount, 0);\n const totalWarnings = results.reduce((sum, { result }) => sum + result.warningCount, 0);\n\n if (options.format === \"json\") {\n process.stdout.write(\n `${JSON.stringify(\n {\n files: results.map(({ file, result }) => ({\n file: displayPath(file),\n diagnostics: result.diagnostics,\n virtualTs: result.virtualTs,\n })),\n errorCount: totalErrors,\n warningCount: totalWarnings,\n fileCount: results.length,\n },\n null,\n 2,\n )}\\n`,\n );\n } else {\n renderCheckText(results, options, timeMs);\n }\n\n if (totalErrors > 0) {\n process.exit(1);\n }\n\n if (options.maxWarnings !== undefined && totalWarnings > options.maxWarnings) {\n process.stderr.write(`\\nToo many warnings (${totalWarnings} > max ${options.maxWarnings})\\n`);\n process.exit(1);\n }\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(\"lint\");\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// Upgrade command\n// ============================================================================\n\ntype PackageManager = \"bun\" | \"npm\" | \"pnpm\" | \"vp\" | \"yarn\";\n\ninterface UpgradeOptions {\n packageManager?: PackageManager;\n global?: boolean;\n dryRun?: boolean;\n help?: boolean;\n}\n\nfunction parseUpgradeCommand(args: string[]): UpgradeOptions {\n const options: UpgradeOptions = {};\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === \"--package-manager\") {\n const packageManager = args[++i];\n if (\n packageManager === \"bun\" ||\n packageManager === \"npm\" ||\n packageManager === \"pnpm\" ||\n packageManager === \"vp\" ||\n packageManager === \"yarn\"\n ) {\n options.packageManager = packageManager;\n }\n } else if (arg === \"--global\" || arg === \"-g\") {\n options.global = true;\n } else if (arg === \"--dry-run\") {\n options.dryRun = true;\n } else if (arg === \"--help\" || arg === \"-h\") {\n options.help = true;\n }\n }\n\n return options;\n}\n\nfunction readCwdPackageJson(): {\n packageManager?: string;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n} | null {\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n if (!existsSync(packageJsonPath)) {\n return null;\n }\n return JSON.parse(readFileSync(packageJsonPath, \"utf8\"));\n}\n\nfunction detectPackageManager(explicit?: PackageManager): PackageManager {\n if (explicit) {\n return explicit;\n }\n\n const userAgent = process.env.npm_config_user_agent ?? \"\";\n if (userAgent.startsWith(\"pnpm\")) {\n return \"pnpm\";\n }\n if (userAgent.startsWith(\"yarn\")) {\n return \"yarn\";\n }\n if (userAgent.startsWith(\"bun\")) {\n return \"bun\";\n }\n if (userAgent.startsWith(\"npm\")) {\n return \"npm\";\n }\n\n const packageManager = readCwdPackageJson()?.packageManager;\n if (packageManager?.startsWith(\"pnpm\")) {\n return \"pnpm\";\n }\n if (packageManager?.startsWith(\"yarn\")) {\n return \"yarn\";\n }\n if (packageManager?.startsWith(\"bun\")) {\n return \"bun\";\n }\n return \"npm\";\n}\n\nfunction buildUpgradeCommand(\n packageManager: PackageManager,\n options: UpgradeOptions,\n): { command: string; args: string[] } {\n const packageJson = readCwdPackageJson();\n const saveDev = !packageJson?.dependencies?.vize;\n const packageSpec = \"vize@latest\";\n\n if (packageManager === \"vp\") {\n return {\n command: \"vp\",\n args: [\"install\", ...(options.global ? [\"-g\"] : saveDev ? [\"-D\"] : []), packageSpec],\n };\n }\n if (packageManager === \"pnpm\") {\n return {\n command: \"pnpm\",\n args: [\"add\", ...(options.global ? [\"-g\"] : saveDev ? [\"-D\"] : []), packageSpec],\n };\n }\n if (packageManager === \"yarn\") {\n return {\n command: \"yarn\",\n args: options.global\n ? [\"global\", \"add\", packageSpec]\n : [\"add\", ...(saveDev ? [\"-D\"] : []), packageSpec],\n };\n }\n if (packageManager === \"bun\") {\n return {\n command: \"bun\",\n args: [\"add\", ...(options.global ? [\"-g\"] : saveDev ? [\"-d\"] : []), packageSpec],\n };\n }\n return {\n command: \"npm\",\n args: [\"install\", ...(options.global ? [\"-g\"] : saveDev ? [\"-D\"] : []), packageSpec],\n };\n}\n\nfunction runUpgrade(args: string[]): void {\n const options = parseUpgradeCommand(args);\n if (options.help) {\n printUpgradeUsage();\n return;\n }\n\n const packageManager = detectPackageManager(options.packageManager);\n const command = buildUpgradeCommand(packageManager, options);\n\n if (options.dryRun) {\n process.stdout.write(`${command.command} ${command.args.join(\" \")}\\n`);\n return;\n }\n\n const result = spawnSync(command.command, command.args, {\n stdio: \"inherit\",\n cwd: process.cwd(),\n env: process.env,\n });\n\n if (result.error) {\n throw result.error;\n }\n\n process.exit(result.status ?? 1);\n}\n\n// ============================================================================\n// Ready command\n// ============================================================================\n\ninterface ReadyOptions {\n output: string;\n ssr?: boolean;\n scriptExt: \"preserve\" | \"downcompile\";\n help?: boolean;\n}\n\ninterface ParsedReadyCommand {\n patterns: string[];\n options: ReadyOptions;\n}\n\nfunction parseReadyCommand(args: string[]): ParsedReadyCommand {\n const patterns: string[] = [];\n const options: ReadyOptions = {\n output: \"./dist\",\n scriptExt: \"downcompile\",\n };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === \"--output\" || arg === \"-o\") {\n options.output = args[++i] ?? options.output;\n } else if (arg === \"--ssr\") {\n options.ssr = true;\n } else if (arg === \"--script-ext\") {\n const scriptExt = args[++i];\n if (scriptExt === \"preserve\" || scriptExt === \"downcompile\") {\n options.scriptExt = scriptExt;\n }\n } else if (arg === \"--help\" || arg === \"-h\") {\n options.help = true;\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n return { patterns, options };\n}\n\nasync function runReady(args: string[]): Promise<void> {\n const { patterns, options } = parseReadyCommand(args);\n if (options.help) {\n printReadyUsage();\n return;\n }\n\n process.stderr.write(\"vize ready: fmt\\n\");\n await runFmt([\"--write\", ...patterns]);\n\n process.stderr.write(\"vize ready: lint\\n\");\n await runLint(patterns);\n\n process.stderr.write(\"vize ready: check\\n\");\n await runCheck(patterns);\n\n process.stderr.write(\"vize ready: build\\n\");\n await runBuild([\n \"--output\",\n options.output,\n \"--script-ext\",\n options.scriptExt,\n ...(options.ssr ? [\"--ssr\"] : []),\n ...patterns,\n ]);\n}\n\n// ============================================================================\n// Command router\n// ============================================================================\n\nconst NAPI_COMMANDS = new Set([\"build\", \"check\", \"fmt\", \"lint\"]);\nconst JS_COMMANDS = new Set([\"musea\", \"ready\", \"upgrade\"]);\n\nasync function main(): Promise<void> {\n const args = process.argv.slice(2);\n const command = args[0];\n\n if (!command || command === \"--help\" || command === \"-h\") {\n printUsage();\n process.exit(1);\n }\n\n if (NAPI_COMMANDS.has(command)) {\n const commandArgs = args.slice(1);\n switch (command) {\n case \"build\":\n await runBuild(commandArgs);\n break;\n case \"check\":\n await runCheck(commandArgs);\n break;\n case \"fmt\":\n await runFmt(commandArgs);\n break;\n case \"lint\":\n await runLint(commandArgs);\n break;\n }\n } else if (JS_COMMANDS.has(command)) {\n const commandArgs = args.slice(1);\n switch (command) {\n case \"musea\":\n runMusea(commandArgs);\n break;\n case \"ready\":\n await runReady(commandArgs);\n break;\n case \"upgrade\":\n runUpgrade(commandArgs);\n break;\n }\n } else {\n printUsage();\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":";;;;;;;AAOA,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,mBAAmB,SAAS,kBAAkB,OAAO;;;AA0B3E,MAAM,oBAAgE;CACpE,OAAO;CACP,OAAO;CACP,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mFACD;AACD,UAAQ,KAAK,EAAE;;;AAInB,IAAI,CAAC,OAAO,KAAK,OACV,OAAM,CAAC,OAAO,UAAU;AAC3B,SAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;AACrE,SAAQ,KAAK,EAAE;EACf;AAGJ,IAAI,OAAO,KAAK,QAAQ;CACtB,MAAM,EAAE,UAAU,QAAQ,OAAO,OAAO,KAAK;AAE7C,UAAS,sCAAsC;AAC7C,KAAG,oDAAoD;AACrD,UACE,6BACE,GAAG,KAAK,IAAI,OAAO,KAAK,IAAI,SAAS,KAAK,IAAI,MAAM,KAAK,IAAI,KAAK,KAAK,IAAI,aAAa,KAAK,IAAI,UAClG,CACF,CAAC,KAAK,KAAK;IACZ;AAEF,KAAG,6CAA6C;AAC9C,UACE,6BACE,GAAG,KAAK,IAAI,MAAM,KAAK,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"}
1
+ {"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from \"node:fs\";\nimport { spawnSync } from \"node:child_process\";\nimport * as path from \"node:path\";\nimport { createRequire } from \"node:module\";\nimport { pathToFileURL } from \"node:url\";\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 compileSfcBatchWithResults: (\n files: BatchFileInput[],\n options?: NativeBuildOptions,\n ) => BatchCompileResult;\n formatSfc: (source: string, options?: NativeFormatOptions) => FormatResult;\n typeCheck: (source: string, options?: NativeTypeCheckOptions) => TypeCheckResult;\n generateDeclaration?: (source: string, options?: NativeDeclarationOptions) => DeclarationResult;\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\ntype NativeCommand = \"build\" | \"check\" | \"fmt\" | \"lint\";\n\nconst REQUIRED_BINDINGS: Record<NativeCommand, keyof NativeBinding> = {\n build: \"compileSfcBatchWithResults\",\n check: \"typeCheck\",\n fmt: \"formatSfc\",\n lint: \"lint\",\n};\n\nfunction loadNative(command: NativeCommand): NativeBinding {\n const attemptedPackages = getAttemptedPackages();\n let lastError: unknown = null;\n const requiredBinding = REQUIRED_BINDINGS[command];\n\n for (const packageName of attemptedPackages) {\n try {\n const binding = require(packageName) as Partial<NativeBinding>;\n if (typeof binding[requiredBinding] !== \"function\") {\n throw new Error(`${packageName} does not expose the ${command} 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 printUsage(): void {\n console.error(\"Usage: vize <command> [options]\");\n console.error(\"Commands: build, fmt, check, lint, upgrade, ready, musea\");\n}\n\nfunction printBuildUsage(): void {\n console.error(\"Usage: vize build [options] [files-or-directories]\");\n console.error(\"Options:\");\n console.error(\" -o, --output <dir> Output directory\");\n console.error(\" -f, --format <js|json|stats> Output format\");\n console.error(\" --ssr Enable SSR compilation\");\n console.error(\" --script-ext <mode> preserve or downcompile\");\n console.error(\" -j, --threads <number> Worker thread count\");\n}\n\nfunction printFmtUsage(): void {\n console.error(\"Usage: vize fmt [options] [files-or-directories]\");\n console.error(\"Options:\");\n console.error(\" --check Exit with an error if files need formatting\");\n console.error(\" -w, --write Write formatted output\");\n console.error(\" --single-quote Use single quotes\");\n console.error(\" --print-width <number> Maximum line width\");\n console.error(\" --tab-width <number> Indentation width\");\n console.error(\" --use-tabs Indent with tabs\");\n console.error(\" --no-semi Omit semicolons\");\n}\n\nfunction printCheckUsage(): void {\n console.error(\"Usage: vize check [options] [files-or-directories]\");\n console.error(\"Options:\");\n console.error(\" -f, --format <text|json> Output format\");\n console.error(\" -q, --quiet Show summary only\");\n console.error(\" --strict Enable strict checks\");\n console.error(\" --show-virtual-ts Print generated Virtual TS\");\n console.error(\" --declaration Emit Vue component .d.ts files\");\n console.error(\" --declaration-dir <dir> Output directory for declarations\");\n console.error(\" --max-warnings <number> Fail when warnings exceed the limit\");\n console.error(\" -c, --config <path> Use a specific vize config file\");\n console.error(\" --no-config Disable config discovery\");\n console.error(\"\");\n console.error(\n \"Note: npm `vize check` uses the packaged NAPI checker. Install the Rust CLI for project-backed Corsa diagnostics.\",\n );\n}\n\nfunction printUpgradeUsage(): void {\n console.error(\"Usage: vize upgrade [options]\");\n console.error(\"Options:\");\n console.error(\" --package-manager <name> npm, pnpm, yarn, bun, or vp\");\n console.error(\" -g, --global Upgrade the global installation\");\n console.error(\" --dry-run Print the command without running it\");\n}\n\nfunction printReadyUsage(): void {\n console.error(\"Usage: vize ready [options] [files-or-directories]\");\n console.error(\"Runs: fmt --write -> lint -> check -> build\");\n console.error(\"Options:\");\n console.error(\" -o, --output <dir> Output directory for build\");\n console.error(\" --ssr Enable SSR compilation for build\");\n console.error(\" --script-ext <mode> preserve or downcompile\");\n}\n\nfunction resolvePackageBinaryFromCwd(packageName: string, binName: string = packageName): string {\n const cwdRequire = createRequire(pathToFileURL(path.join(process.cwd(), \"package.json\")).href);\n const packageJsonPath = cwdRequire.resolve(`${packageName}/package.json`);\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as {\n bin?: string | Record<string, string>;\n };\n\n const bin = typeof packageJson.bin === \"string\" ? packageJson.bin : packageJson.bin?.[binName];\n\n if (!bin) {\n throw new Error(`Could not resolve binary '${binName}' from package '${packageName}'`);\n }\n\n return path.resolve(path.dirname(packageJsonPath), bin);\n}\n\nfunction runMusea(args: string[]): void {\n const isHelp = args.includes(\"--help\") || args.includes(\"-h\");\n if (isHelp) {\n console.error(\"Usage: vize musea [--build] [...vite options]\");\n console.error(\" --build Run `vite build` instead of `vite dev`\");\n return;\n }\n\n const isBuild = args.includes(\"--build\");\n const viteArgs = args.filter((arg) => arg !== \"--build\");\n const viteCommand = isBuild ? \"build\" : \"dev\";\n const viteBin = resolvePackageBinaryFromCwd(\"vite\");\n const result = spawnSync(process.execPath, [viteBin, viteCommand, ...viteArgs], {\n stdio: \"inherit\",\n cwd: process.cwd(),\n env: process.env,\n });\n\n if (result.error) {\n throw result.error;\n }\n\n process.exit(result.status ?? 1);\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\n// ============================================================================\n// Build command\n// ============================================================================\n\ninterface NativeBuildOptions {\n ssr?: boolean;\n vapor?: boolean;\n customRenderer?: boolean;\n custom_renderer?: boolean;\n isTs?: boolean;\n is_ts?: boolean;\n threads?: number;\n}\n\ninterface BatchFileInput {\n path: string;\n source: string;\n}\n\ninterface BatchFileResult {\n path: string;\n code: string;\n css?: string;\n errors: string[];\n warnings: string[];\n scopeId?: string;\n scope_id?: string;\n hasScoped?: boolean;\n has_scoped?: boolean;\n}\n\ninterface BatchCompileResult {\n results: BatchFileResult[];\n successCount?: number;\n success_count?: number;\n failedCount?: number;\n failed_count?: number;\n timeMs?: number;\n time_ms?: number;\n}\n\ninterface BuildOptions {\n output: string;\n format: \"js\" | \"json\" | \"stats\";\n ssr?: boolean;\n vapor?: boolean;\n customRenderer?: boolean;\n scriptExt: \"preserve\" | \"downcompile\";\n threads?: number;\n help?: boolean;\n}\n\ninterface ParsedBuildCommand {\n patterns: string[];\n options: BuildOptions;\n sharedConfig: SharedConfigOptions;\n}\n\nfunction parseBuildCommand(args: string[]): ParsedBuildCommand {\n const patterns: string[] = [];\n const options: BuildOptions = {\n output: \"./dist\",\n format: \"js\",\n scriptExt: \"downcompile\",\n };\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 === \"--output\" || arg === \"-o\") {\n options.output = args[++i] ?? options.output;\n } else if (arg === \"--format\" || arg === \"-f\") {\n const format = args[++i];\n if (format === \"js\" || format === \"json\" || format === \"stats\") {\n options.format = format;\n }\n } else if (arg === \"--ssr\") {\n options.ssr = true;\n } else if (arg === \"--vapor\") {\n options.vapor = true;\n } else if (arg === \"--custom-renderer\") {\n options.customRenderer = true;\n } else if (arg === \"--script-ext\") {\n const scriptExt = args[++i];\n if (scriptExt === \"preserve\" || scriptExt === \"downcompile\") {\n options.scriptExt = scriptExt;\n }\n } else if (arg === \"--threads\" || arg === \"-j\") {\n options.threads = Number.parseInt(args[++i], 10);\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 === \"--profile\" || arg === \"--continue-on-error\") {\n // Accepted for command compatibility. The npm build path prints a compact summary.\n } else if (arg === \"--help\" || arg === \"-h\") {\n options.help = true;\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n return { patterns, options, sharedConfig };\n}\n\nfunction getScriptLang(source: string): string {\n const match = source.match(/<script\\b[^>]*\\blang=[\"']([^\"']+)[\"']/i);\n return match?.[1] ?? \"js\";\n}\n\nfunction getOutputExtension(source: string, scriptExt: BuildOptions[\"scriptExt\"]): string {\n if (scriptExt === \"downcompile\") {\n return \"js\";\n }\n const lang = getScriptLang(source);\n return lang === \"ts\" || lang === \"tsx\" || lang === \"jsx\" ? lang : \"js\";\n}\n\nfunction outputFileName(file: string, extension: string): string {\n return path.basename(file).replace(/\\.vue$/i, `.${extension}`);\n}\n\nfunction toNativeBuildOptions(options: BuildOptions): NativeBuildOptions {\n const isTs = options.scriptExt === \"preserve\";\n return {\n ssr: options.ssr,\n vapor: options.vapor,\n customRenderer: options.customRenderer,\n custom_renderer: options.customRenderer,\n isTs,\n is_ts: isTs,\n threads: options.threads,\n };\n}\n\nasync function runBuild(args: string[]): Promise<void> {\n const { patterns, options, sharedConfig } = parseBuildCommand(args);\n if (options.help) {\n printBuildUsage();\n return;\n }\n\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: \"build\",\n },\n });\n\n if (sharedConfig.configFile && !config) {\n throw new Error(`Could not find config file: ${sharedConfig.configFile}`);\n }\n\n options.ssr ??= config?.compiler?.ssr;\n options.vapor ??= config?.compiler?.vapor;\n options.customRenderer ??= config?.compiler?.customRenderer;\n if (config?.compiler?.scriptExt === \"ts\") {\n options.scriptExt = \"preserve\";\n } else if (config?.compiler?.scriptExt === \"js\") {\n options.scriptExt = \"downcompile\";\n }\n\n const files = collectVueFiles(patterns);\n if (files.length === 0) {\n process.stderr.write(`No Vue files found matching inputs: ${JSON.stringify(patterns)}\\n`);\n process.exit(1);\n }\n\n const inputs = files.map((file) => ({\n path: file,\n source: readFileSync(file, \"utf8\"),\n }));\n const native = loadNative(\"build\");\n const startedAt = performance.now();\n const result = native.compileSfcBatchWithResults(inputs, toNativeBuildOptions(options));\n const timeMs = result.timeMs ?? result.time_ms ?? performance.now() - startedAt;\n const results = [...result.results].sort((left, right) => left.path.localeCompare(right.path));\n\n if (options.format !== \"stats\") {\n mkdirSync(options.output, { recursive: true });\n }\n\n for (const fileResult of results) {\n const source = inputs.find((input) => input.path === fileResult.path)?.source ?? \"\";\n for (const warning of fileResult.warnings) {\n process.stderr.write(`warning: ${displayPath(fileResult.path)} ${warning}\\n`);\n }\n for (const error of fileResult.errors) {\n process.stderr.write(`error: ${displayPath(fileResult.path)} ${error}\\n`);\n }\n\n if (fileResult.errors.length > 0 || options.format === \"stats\") {\n continue;\n }\n\n const extension =\n options.format === \"json\" ? \"json\" : getOutputExtension(source, options.scriptExt);\n const outputPath = path.join(options.output, outputFileName(fileResult.path, extension));\n const content =\n options.format === \"json\" ? JSON.stringify(fileResult, null, 2) : fileResult.code;\n writeFileSync(outputPath, content);\n }\n\n const failed =\n result.failedCount ?? result.failed_count ?? results.filter((r) => r.errors.length).length;\n const success = result.successCount ?? result.success_count ?? results.length - failed;\n process.stderr.write(\n `\\x1b[32mOK\\x1b[0m Built ${success} Vue file(s) in ${timeMs.toFixed(2)}ms\\n`,\n );\n\n if (failed > 0) {\n process.stderr.write(`\\x1b[31mERR\\x1b[0m ${failed} file(s) failed\\n`);\n process.exit(1);\n }\n}\n\n// ============================================================================\n// Format command\n// ============================================================================\n\ninterface NativeFormatOptions {\n printWidth?: number;\n print_width?: number;\n tabWidth?: number;\n tab_width?: number;\n useTabs?: boolean;\n use_tabs?: boolean;\n semi?: boolean;\n singleQuote?: boolean;\n single_quote?: boolean;\n sortAttributes?: boolean;\n sort_attributes?: boolean;\n singleAttributePerLine?: boolean;\n single_attribute_per_line?: boolean;\n maxAttributesPerLine?: number;\n max_attributes_per_line?: number;\n normalizeDirectiveShorthands?: boolean;\n normalize_directive_shorthands?: boolean;\n}\n\ninterface FormatResult {\n code: string;\n changed: boolean;\n}\n\ninterface FmtOptions extends NativeFormatOptions {\n check?: boolean;\n write?: boolean;\n help?: boolean;\n}\n\ninterface ParsedFmtCommand {\n patterns: string[];\n options: FmtOptions;\n sharedConfig: SharedConfigOptions;\n}\n\nfunction parseFmtCommand(args: string[]): ParsedFmtCommand {\n const patterns: string[] = [];\n const options: FmtOptions = {};\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 === \"--check\") {\n options.check = true;\n } else if (arg === \"--write\" || arg === \"-w\") {\n options.write = true;\n } else if (arg === \"--single-quote\") {\n options.singleQuote = true;\n } else if (arg === \"--print-width\") {\n options.printWidth = Number.parseInt(args[++i], 10);\n } else if (arg === \"--tab-width\") {\n options.tabWidth = Number.parseInt(args[++i], 10);\n } else if (arg === \"--use-tabs\") {\n options.useTabs = true;\n } else if (arg === \"--no-semi\") {\n options.semi = false;\n } else if (arg === \"--sort-attributes\") {\n options.sortAttributes = true;\n } else if (arg === \"--single-attribute-per-line\") {\n options.singleAttributePerLine = true;\n } else if (arg === \"--max-attributes-per-line\") {\n options.maxAttributesPerLine = Number.parseInt(args[++i], 10);\n } else if (arg === \"--normalize-directive-shorthands\") {\n options.normalizeDirectiveShorthands = true;\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 === \"--profile\") {\n // Accepted for command compatibility. The npm fmt path prints a compact summary.\n } else if (arg === \"--help\" || arg === \"-h\") {\n options.help = true;\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n return { patterns, options, sharedConfig };\n}\n\nfunction toNativeFormatOptions(options: FmtOptions): NativeFormatOptions {\n return {\n printWidth: options.printWidth,\n print_width: options.printWidth,\n tabWidth: options.tabWidth,\n tab_width: options.tabWidth,\n useTabs: options.useTabs,\n use_tabs: options.useTabs,\n semi: options.semi,\n singleQuote: options.singleQuote,\n single_quote: options.singleQuote,\n sortAttributes: options.sortAttributes,\n sort_attributes: options.sortAttributes,\n singleAttributePerLine: options.singleAttributePerLine,\n single_attribute_per_line: options.singleAttributePerLine,\n maxAttributesPerLine: options.maxAttributesPerLine,\n max_attributes_per_line: options.maxAttributesPerLine,\n normalizeDirectiveShorthands: options.normalizeDirectiveShorthands,\n normalize_directive_shorthands: options.normalizeDirectiveShorthands,\n };\n}\n\nasync function runFmt(args: string[]): Promise<void> {\n const { patterns, options, sharedConfig } = parseFmtCommand(args);\n if (options.help) {\n printFmtUsage();\n return;\n }\n\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: \"fmt\",\n },\n });\n\n if (sharedConfig.configFile && !config) {\n throw new Error(`Could not find config file: ${sharedConfig.configFile}`);\n }\n\n options.printWidth ??= config?.formatter?.printWidth;\n options.tabWidth ??= config?.formatter?.tabWidth;\n options.useTabs ??= config?.formatter?.useTabs;\n options.semi ??= config?.formatter?.semi;\n options.singleQuote ??= config?.formatter?.singleQuote;\n\n const files = collectVueFiles(patterns);\n if (files.length === 0) {\n process.stderr.write(`No Vue files found matching inputs: ${JSON.stringify(patterns)}\\n`);\n return;\n }\n\n const native = loadNative(\"fmt\");\n let changed = 0;\n let errored = 0;\n\n for (const file of files) {\n const source = readFileSync(file, \"utf8\");\n try {\n const result = native.formatSfc(source, toNativeFormatOptions(options));\n if (!result.changed) {\n continue;\n }\n changed++;\n if (options.check) {\n process.stderr.write(`Would reformat: ${displayPath(file)}\\n`);\n } else if (options.write) {\n writeFileSync(file, result.code);\n process.stderr.write(`Reformatted: ${displayPath(file)}\\n`);\n } else {\n process.stderr.write(`Would reformat: ${displayPath(file)}\\n`);\n }\n } catch (error) {\n errored++;\n process.stderr.write(\n `Error formatting ${displayPath(file)}: ${error instanceof Error ? error.message : String(error)}\\n`,\n );\n }\n }\n\n process.stderr.write(\n `\\x1b[32mOK\\x1b[0m Formatted ${files.length} Vue file(s), ${changed} changed\\n`,\n );\n\n if (errored > 0 || (options.check && changed > 0)) {\n process.exit(1);\n }\n}\n\n// ============================================================================\n// Check command\n// ============================================================================\n\ninterface NativeTypeCheckOptions {\n filename?: string;\n strict?: boolean;\n includeVirtualTs?: boolean;\n include_virtual_ts?: boolean;\n checkProps?: boolean;\n check_props?: boolean;\n checkEmits?: boolean;\n check_emits?: boolean;\n checkTemplateBindings?: boolean;\n check_template_bindings?: boolean;\n checkReactivity?: boolean;\n check_reactivity?: boolean;\n checkSetupContext?: boolean;\n check_setup_context?: boolean;\n checkInvalidExports?: boolean;\n check_invalid_exports?: boolean;\n checkFallthroughAttrs?: boolean;\n check_fallthrough_attrs?: boolean;\n}\n\ninterface NativeDeclarationOptions {\n filename?: string;\n}\n\ninterface DeclarationResult {\n code: string;\n}\n\ninterface TypeDiagnostic {\n severity: string;\n message: string;\n start: number;\n end: number;\n code?: string;\n help?: string;\n related?: Array<{\n message: string;\n start: number;\n end: number;\n filename?: string;\n }>;\n}\n\ninterface TypeCheckResult {\n diagnostics: TypeDiagnostic[];\n virtualTs?: string;\n errorCount: number;\n warningCount: number;\n analysisTimeMs?: number;\n}\n\ninterface CheckOptions {\n format?: string;\n quiet?: boolean;\n strict?: boolean;\n includeVirtualTs?: boolean;\n maxWarnings?: number;\n checkProps?: boolean;\n checkEmits?: boolean;\n checkTemplateBindings?: boolean;\n checkReactivity?: boolean;\n checkSetupContext?: boolean;\n checkInvalidExports?: boolean;\n checkFallthroughAttrs?: boolean;\n declaration?: boolean;\n declarationDir?: string;\n help?: boolean;\n}\n\ninterface ParsedCheckCommand {\n patterns: string[];\n options: CheckOptions;\n sharedConfig: SharedConfigOptions;\n}\n\ninterface CheckedFileResult {\n file: string;\n source: string;\n result: TypeCheckResult;\n}\n\ninterface EmittedDeclaration {\n file: string;\n path: string;\n}\n\nfunction parseCheckCommand(args: string[]): ParsedCheckCommand {\n const patterns: string[] = [];\n const options: CheckOptions = {};\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 === \"--quiet\" || arg === \"-q\") {\n options.quiet = true;\n } else if (arg === \"--strict\") {\n options.strict = true;\n } else if (arg === \"--no-strict\") {\n options.strict = false;\n } else if (arg === \"--show-virtual-ts\" || arg === \"--include-virtual-ts\") {\n options.includeVirtualTs = true;\n } else if (arg === \"--max-warnings\") {\n options.maxWarnings = Number.parseInt(args[++i], 10);\n } else if (arg === \"--no-check-props\") {\n options.checkProps = false;\n } else if (arg === \"--no-check-emits\") {\n options.checkEmits = false;\n } else if (arg === \"--no-check-template-bindings\") {\n options.checkTemplateBindings = false;\n } else if (arg === \"--no-check-reactivity\") {\n options.checkReactivity = false;\n } else if (arg === \"--no-check-setup-context\") {\n options.checkSetupContext = false;\n } else if (arg === \"--no-check-invalid-exports\") {\n options.checkInvalidExports = false;\n } else if (arg === \"--no-check-fallthrough-attrs\") {\n options.checkFallthroughAttrs = false;\n } else if (arg === \"--declaration\") {\n options.declaration = true;\n } else if (arg === \"--declaration-dir\") {\n const declarationDir = args[++i];\n if (!declarationDir) {\n throw new Error(\"Missing path after --declaration-dir\");\n }\n options.declarationDir = declarationDir;\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 === \"--help\" || arg === \"-h\") {\n options.help = true;\n } else if (arg === \"--tsconfig\" || arg === \"--corsa-path\" || arg === \"--servers\") {\n i++;\n } else if (arg === \"--socket\" || arg === \"-s\") {\n i++;\n } else if (arg === \"--profile\") {\n // Accepted for package-script compatibility with the Rust CLI.\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n return { patterns, options, sharedConfig };\n}\n\nfunction hasGlobSyntax(pattern: string): boolean {\n return pattern.includes(\"*\") || pattern.includes(\"?\") || pattern.includes(\"[\");\n}\n\nfunction normalizePath(filePath: string): string {\n return filePath.split(path.sep).join(\"/\");\n}\n\nfunction displayPath(filePath: string): string {\n const relative = path.relative(process.cwd(), filePath);\n if (relative && !relative.startsWith(\"..\") && !path.isAbsolute(relative)) {\n return normalizePath(relative);\n }\n return normalizePath(filePath);\n}\n\nfunction isVueFile(filePath: string): boolean {\n return path.extname(filePath) === \".vue\";\n}\n\nfunction collectVueFilesFromDirectory(directory: string, recursive: boolean): string[] {\n const files: string[] = [];\n const entries = readdirSync(directory, { withFileTypes: true });\n\n for (const entry of entries) {\n const entryPath = path.join(directory, entry.name);\n if (entry.isDirectory()) {\n if (entry.name === \"node_modules\" || entry.name === \".git\") {\n continue;\n }\n if (recursive) {\n files.push(...collectVueFilesFromDirectory(entryPath, true));\n }\n } else if (entry.isFile() && isVueFile(entryPath)) {\n files.push(entryPath);\n }\n }\n\n return files;\n}\n\nfunction globBase(pattern: string): string {\n const normalized = normalizePath(pattern);\n const globIndex = normalized.search(/[*?[]/);\n if (globIndex === -1) {\n return normalized;\n }\n\n const beforeGlob = normalized.slice(0, globIndex);\n const slashIndex = beforeGlob.lastIndexOf(\"/\");\n if (slashIndex === -1) {\n return \".\";\n }\n return beforeGlob.slice(0, slashIndex) || \"/\";\n}\n\nfunction globToRegExp(pattern: string): RegExp {\n const normalized = normalizePath(pattern);\n let source = \"\";\n\n for (let i = 0; i < normalized.length; i++) {\n const char = normalized[i];\n const next = normalized[i + 1];\n const afterNext = normalized[i + 2];\n\n if (char === \"*\" && next === \"*\" && afterNext === \"/\") {\n source += \"(?:.*/)?\";\n i += 2;\n } else if (char === \"*\" && next === \"*\") {\n source += \".*\";\n i++;\n } else if (char === \"*\") {\n source += \"[^/]*\";\n } else if (char === \"?\") {\n source += \"[^/]\";\n } else if (\"\\\\^$+?.()|{}[]\".includes(char)) {\n source += `\\\\${char}`;\n } else {\n source += char;\n }\n }\n\n return new RegExp(`^${source}$`);\n}\n\nfunction shouldRecurseGlob(pattern: string, base: string): boolean {\n const normalizedPattern = normalizePath(pattern);\n const normalizedBase = normalizePath(base);\n const rest =\n normalizedBase === \".\"\n ? normalizedPattern\n : normalizedPattern.slice(normalizedBase.length).replace(/^\\/+/, \"\");\n return rest.includes(\"/\");\n}\n\nfunction collectVueFilesFromGlob(pattern: string): string[] {\n const basePattern = globBase(pattern);\n const base = path.resolve(process.cwd(), basePattern);\n if (!existsSync(base)) {\n return [];\n }\n\n const isAbsolutePattern = path.isAbsolute(pattern);\n const normalizedPattern = normalizePath(isAbsolutePattern ? path.resolve(pattern) : pattern);\n const regex = globToRegExp(normalizedPattern);\n const candidates = collectVueFilesFromDirectory(base, shouldRecurseGlob(pattern, basePattern));\n\n return candidates.filter((file) => {\n const comparable = isAbsolutePattern\n ? normalizePath(file)\n : normalizePath(path.relative(process.cwd(), file));\n return regex.test(comparable);\n });\n}\n\nfunction collectVueFiles(patterns: string[]): string[] {\n const files = new Set<string>();\n const inputs = patterns.length === 0 ? [\".\"] : patterns;\n\n for (const input of inputs) {\n if (hasGlobSyntax(input)) {\n for (const file of collectVueFilesFromGlob(input)) {\n files.add(path.resolve(file));\n }\n continue;\n }\n\n const resolved = path.resolve(process.cwd(), input);\n if (!existsSync(resolved)) {\n continue;\n }\n\n const stats = statSync(resolved);\n if (stats.isDirectory()) {\n for (const file of collectVueFilesFromDirectory(resolved, true)) {\n files.add(path.resolve(file));\n }\n } else if (stats.isFile() && isVueFile(resolved)) {\n files.add(resolved);\n }\n }\n\n return Array.from(files).sort();\n}\n\nfunction commonSourceDirectory(results: CheckedFileResult[]): string {\n let common = path.dirname(results[0]?.file ?? process.cwd());\n\n for (let i = 1; i < results.length; i++) {\n const directory = path.dirname(results[i].file);\n while (common !== path.dirname(common)) {\n const relative = path.relative(common, directory);\n if (relative !== \"..\" && !relative.startsWith(`..${path.sep}`)) {\n break;\n }\n common = path.dirname(common);\n }\n }\n\n return common;\n}\n\nfunction emitCheckDeclarations(\n results: CheckedFileResult[],\n native: NativeBinding,\n options: CheckOptions,\n): EmittedDeclaration[] {\n if (!options.declaration) {\n return [];\n }\n\n if (typeof native.generateDeclaration !== \"function\") {\n throw new Error(\"The loaded native binding does not support declaration generation.\");\n }\n\n const outDir = path.resolve(process.cwd(), options.declarationDir ?? \"dist/types\");\n const sourceRoot = commonSourceDirectory(results);\n const declarations: EmittedDeclaration[] = [];\n\n for (const { file, source } of results) {\n const relative = normalizePath(path.relative(sourceRoot, file));\n const outputPath = path.join(outDir, `${relative}.d.ts`);\n mkdirSync(path.dirname(outputPath), { recursive: true });\n\n const declaration = native.generateDeclaration(source, { filename: file });\n writeFileSync(outputPath, declaration.code);\n declarations.push({\n file: displayPath(outputPath),\n path: outputPath,\n });\n }\n\n return declarations;\n}\n\nfunction lineStarts(source: string): number[] {\n const starts = [0];\n for (let i = 0; i < source.length; i++) {\n if (source.charCodeAt(i) === 10) {\n starts.push(i + 1);\n }\n }\n return starts;\n}\n\nfunction offsetToLineColumn(starts: number[], offset: number): { line: number; column: number } {\n let low = 0;\n let high = starts.length - 1;\n while (low <= high) {\n const mid = Math.floor((low + high) / 2);\n if (starts[mid] <= offset) {\n low = mid + 1;\n } else {\n high = mid - 1;\n }\n }\n\n const lineIndex = Math.max(0, high);\n return {\n line: lineIndex + 1,\n column: offset - starts[lineIndex] + 1,\n };\n}\n\nfunction toNativeTypeCheckOptions(file: string, options: CheckOptions): NativeTypeCheckOptions {\n return {\n filename: file,\n strict: options.strict,\n includeVirtualTs: options.includeVirtualTs,\n include_virtual_ts: options.includeVirtualTs,\n checkProps: options.checkProps,\n check_props: options.checkProps,\n checkEmits: options.checkEmits,\n check_emits: options.checkEmits,\n checkTemplateBindings: options.checkTemplateBindings,\n check_template_bindings: options.checkTemplateBindings,\n checkReactivity: options.checkReactivity,\n check_reactivity: options.checkReactivity,\n checkSetupContext: options.checkSetupContext,\n check_setup_context: options.checkSetupContext,\n checkInvalidExports: options.checkInvalidExports,\n check_invalid_exports: options.checkInvalidExports,\n checkFallthroughAttrs: options.checkFallthroughAttrs,\n check_fallthrough_attrs: options.checkFallthroughAttrs,\n };\n}\n\nfunction renderCheckText(\n results: CheckedFileResult[],\n options: CheckOptions,\n timeMs: number,\n declarations: EmittedDeclaration[] = [],\n): void {\n let totalErrors = 0;\n let totalWarnings = 0;\n\n for (const { file, source, result } of results) {\n totalErrors += result.errorCount;\n totalWarnings += result.warningCount;\n\n if (options.includeVirtualTs && result.virtualTs) {\n process.stderr.write(`\\n=== ${displayPath(file)} ===\\n${result.virtualTs}\\n`);\n }\n\n if (options.quiet || result.diagnostics.length === 0) {\n continue;\n }\n\n const starts = lineStarts(source);\n process.stdout.write(`\\n\\x1b[4m${displayPath(file)}\\x1b[0m\\n`);\n for (const diagnostic of result.diagnostics) {\n const color = diagnostic.severity === \"error\" ? \"\\x1b[31m\" : \"\\x1b[33m\";\n const location = offsetToLineColumn(starts, diagnostic.start);\n const code = diagnostic.code ? ` [${diagnostic.code}]` : \"\";\n process.stdout.write(\n ` ${color}${diagnostic.severity}:${location.line}:${location.column}\\x1b[0m${code} ${diagnostic.message}\\n`,\n );\n if (diagnostic.help) {\n process.stdout.write(` help: ${diagnostic.help}\\n`);\n }\n }\n }\n\n const status = totalErrors > 0 ? \"\\x1b[31mERR\\x1b[0m\" : \"\\x1b[32mOK\\x1b[0m\";\n process.stdout.write(\n `\\n${status} Type checked ${results.length} Vue files in ${timeMs.toFixed(2)}ms\\n`,\n );\n if (totalErrors > 0) {\n process.stdout.write(` \\x1b[31m${totalErrors} error(s)\\x1b[0m\\n`);\n } else {\n process.stdout.write(\" \\x1b[32mNo type errors found!\\x1b[0m\\n\");\n }\n if (totalWarnings > 0) {\n process.stdout.write(` \\x1b[33m${totalWarnings} warning(s)\\x1b[0m\\n`);\n }\n if (declarations.length > 0) {\n process.stdout.write(` \\x1b[32mEmitted ${declarations.length} declaration file(s)\\x1b[0m\\n`);\n }\n}\n\nasync function runCheck(args: string[]): Promise<void> {\n const { patterns, options, sharedConfig } = parseCheckCommand(args);\n if (options.help) {\n printCheckUsage();\n return;\n }\n\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: \"check\",\n },\n });\n\n if (sharedConfig.configFile && !config) {\n throw new Error(`Could not find config file: ${sharedConfig.configFile}`);\n }\n\n if (config?.typeChecker?.enabled === false) {\n process.stderr.write(\n \"[vize] Skipping check because typeChecker.enabled is false in vize.config.\\n\",\n );\n return;\n }\n\n options.strict ??= config?.typeChecker?.strict;\n options.checkProps ??= config?.typeChecker?.checkProps;\n options.checkEmits ??= config?.typeChecker?.checkEmits;\n options.checkTemplateBindings ??= config?.typeChecker?.checkTemplateBindings;\n\n const files = collectVueFiles(patterns);\n if (files.length === 0) {\n process.stderr.write(`No Vue files found matching inputs: ${JSON.stringify(patterns)}\\n`);\n return;\n }\n\n const native = loadNative(\"check\");\n const start = performance.now();\n const results = files.map((file) => {\n const source = readFileSync(file, \"utf8\");\n return {\n file,\n source,\n result: native.typeCheck(source, toNativeTypeCheckOptions(file, options)),\n };\n });\n const timeMs = performance.now() - start;\n const declarations = emitCheckDeclarations(results, native, options);\n const totalErrors = results.reduce((sum, { result }) => sum + result.errorCount, 0);\n const totalWarnings = results.reduce((sum, { result }) => sum + result.warningCount, 0);\n\n if (options.format === \"json\") {\n process.stdout.write(\n `${JSON.stringify(\n {\n files: results.map(({ file, result }) => ({\n file: displayPath(file),\n diagnostics: result.diagnostics,\n virtualTs: result.virtualTs,\n })),\n errorCount: totalErrors,\n warningCount: totalWarnings,\n fileCount: results.length,\n declarations: declarations.map(({ file }) => file),\n },\n null,\n 2,\n )}\\n`,\n );\n } else {\n renderCheckText(results, options, timeMs, declarations);\n }\n\n if (totalErrors > 0) {\n process.exit(1);\n }\n\n if (options.maxWarnings !== undefined && totalWarnings > options.maxWarnings) {\n process.stderr.write(`\\nToo many warnings (${totalWarnings} > max ${options.maxWarnings})\\n`);\n process.exit(1);\n }\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(\"lint\");\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// Upgrade command\n// ============================================================================\n\ntype PackageManager = \"bun\" | \"npm\" | \"pnpm\" | \"vp\" | \"yarn\";\n\ninterface UpgradeOptions {\n packageManager?: PackageManager;\n global?: boolean;\n dryRun?: boolean;\n help?: boolean;\n}\n\nfunction parseUpgradeCommand(args: string[]): UpgradeOptions {\n const options: UpgradeOptions = {};\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === \"--package-manager\") {\n const packageManager = args[++i];\n if (\n packageManager === \"bun\" ||\n packageManager === \"npm\" ||\n packageManager === \"pnpm\" ||\n packageManager === \"vp\" ||\n packageManager === \"yarn\"\n ) {\n options.packageManager = packageManager;\n }\n } else if (arg === \"--global\" || arg === \"-g\") {\n options.global = true;\n } else if (arg === \"--dry-run\") {\n options.dryRun = true;\n } else if (arg === \"--help\" || arg === \"-h\") {\n options.help = true;\n }\n }\n\n return options;\n}\n\nfunction readCwdPackageJson(): {\n packageManager?: string;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n} | null {\n const packageJsonPath = path.join(process.cwd(), \"package.json\");\n if (!existsSync(packageJsonPath)) {\n return null;\n }\n return JSON.parse(readFileSync(packageJsonPath, \"utf8\"));\n}\n\nfunction detectPackageManager(explicit?: PackageManager): PackageManager {\n if (explicit) {\n return explicit;\n }\n\n const userAgent = process.env.npm_config_user_agent ?? \"\";\n if (userAgent.startsWith(\"pnpm\")) {\n return \"pnpm\";\n }\n if (userAgent.startsWith(\"yarn\")) {\n return \"yarn\";\n }\n if (userAgent.startsWith(\"bun\")) {\n return \"bun\";\n }\n if (userAgent.startsWith(\"npm\")) {\n return \"npm\";\n }\n\n const packageManager = readCwdPackageJson()?.packageManager;\n if (packageManager?.startsWith(\"pnpm\")) {\n return \"pnpm\";\n }\n if (packageManager?.startsWith(\"yarn\")) {\n return \"yarn\";\n }\n if (packageManager?.startsWith(\"bun\")) {\n return \"bun\";\n }\n return \"npm\";\n}\n\nfunction buildUpgradeCommand(\n packageManager: PackageManager,\n options: UpgradeOptions,\n): { command: string; args: string[] } {\n const packageJson = readCwdPackageJson();\n const saveDev = !packageJson?.dependencies?.vize;\n const packageSpec = \"vize@latest\";\n\n if (packageManager === \"vp\") {\n return {\n command: \"vp\",\n args: [\"install\", ...(options.global ? [\"-g\"] : saveDev ? [\"-D\"] : []), packageSpec],\n };\n }\n if (packageManager === \"pnpm\") {\n return {\n command: \"pnpm\",\n args: [\"add\", ...(options.global ? [\"-g\"] : saveDev ? [\"-D\"] : []), packageSpec],\n };\n }\n if (packageManager === \"yarn\") {\n return {\n command: \"yarn\",\n args: options.global\n ? [\"global\", \"add\", packageSpec]\n : [\"add\", ...(saveDev ? [\"-D\"] : []), packageSpec],\n };\n }\n if (packageManager === \"bun\") {\n return {\n command: \"bun\",\n args: [\"add\", ...(options.global ? [\"-g\"] : saveDev ? [\"-d\"] : []), packageSpec],\n };\n }\n return {\n command: \"npm\",\n args: [\"install\", ...(options.global ? [\"-g\"] : saveDev ? [\"-D\"] : []), packageSpec],\n };\n}\n\nfunction runUpgrade(args: string[]): void {\n const options = parseUpgradeCommand(args);\n if (options.help) {\n printUpgradeUsage();\n return;\n }\n\n const packageManager = detectPackageManager(options.packageManager);\n const command = buildUpgradeCommand(packageManager, options);\n\n if (options.dryRun) {\n process.stdout.write(`${command.command} ${command.args.join(\" \")}\\n`);\n return;\n }\n\n const result = spawnSync(command.command, command.args, {\n stdio: \"inherit\",\n cwd: process.cwd(),\n env: process.env,\n });\n\n if (result.error) {\n throw result.error;\n }\n\n process.exit(result.status ?? 1);\n}\n\n// ============================================================================\n// Ready command\n// ============================================================================\n\ninterface ReadyOptions {\n output: string;\n ssr?: boolean;\n scriptExt: \"preserve\" | \"downcompile\";\n help?: boolean;\n}\n\ninterface ParsedReadyCommand {\n patterns: string[];\n options: ReadyOptions;\n}\n\nfunction parseReadyCommand(args: string[]): ParsedReadyCommand {\n const patterns: string[] = [];\n const options: ReadyOptions = {\n output: \"./dist\",\n scriptExt: \"downcompile\",\n };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === \"--output\" || arg === \"-o\") {\n options.output = args[++i] ?? options.output;\n } else if (arg === \"--ssr\") {\n options.ssr = true;\n } else if (arg === \"--script-ext\") {\n const scriptExt = args[++i];\n if (scriptExt === \"preserve\" || scriptExt === \"downcompile\") {\n options.scriptExt = scriptExt;\n }\n } else if (arg === \"--help\" || arg === \"-h\") {\n options.help = true;\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n return { patterns, options };\n}\n\nasync function runReady(args: string[]): Promise<void> {\n const { patterns, options } = parseReadyCommand(args);\n if (options.help) {\n printReadyUsage();\n return;\n }\n\n process.stderr.write(\"vize ready: fmt\\n\");\n await runFmt([\"--write\", ...patterns]);\n\n process.stderr.write(\"vize ready: lint\\n\");\n await runLint(patterns);\n\n process.stderr.write(\"vize ready: check\\n\");\n await runCheck(patterns);\n\n process.stderr.write(\"vize ready: build\\n\");\n await runBuild([\n \"--output\",\n options.output,\n \"--script-ext\",\n options.scriptExt,\n ...(options.ssr ? [\"--ssr\"] : []),\n ...patterns,\n ]);\n}\n\n// ============================================================================\n// Command router\n// ============================================================================\n\nconst NAPI_COMMANDS = new Set([\"build\", \"check\", \"fmt\", \"lint\"]);\nconst JS_COMMANDS = new Set([\"musea\", \"ready\", \"upgrade\"]);\n\nasync function main(): Promise<void> {\n const args = process.argv.slice(2);\n const command = args[0];\n\n if (!command || command === \"--help\" || command === \"-h\") {\n printUsage();\n process.exit(1);\n }\n\n if (NAPI_COMMANDS.has(command)) {\n const commandArgs = args.slice(1);\n switch (command) {\n case \"build\":\n await runBuild(commandArgs);\n break;\n case \"check\":\n await runCheck(commandArgs);\n break;\n case \"fmt\":\n await runFmt(commandArgs);\n break;\n case \"lint\":\n await runLint(commandArgs);\n break;\n }\n } else if (JS_COMMANDS.has(command)) {\n const commandArgs = args.slice(1);\n switch (command) {\n case \"musea\":\n runMusea(commandArgs);\n break;\n case \"ready\":\n await runReady(commandArgs);\n break;\n case \"upgrade\":\n runUpgrade(commandArgs);\n break;\n }\n } else {\n printUsage();\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":";;;;;;;AAOA,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,QAA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AAE7C,UAAS,sCAAsC;AAC7C,KAAG,oDAAoD;AACrD,UACE,6BACE,GAAG,KAAK,IAAI,OAAO,KAAK,IAAI,SAAS,KAAK,IAAI,MAAM,KAAK,IAAI,KAAK,KAAK,IAAI,aAAa,KAAK,IAAI,UAClG,CACF,CAAC,KAAK,KAAK;IACZ;AAEF,KAAG,6CAA6C;AAC9C,UACE,6BACE,GAAG,KAAK,IAAI,MAAM,KAAK,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vize",
3
- "version": "0.69.0",
3
+ "version": "0.70.0",
4
4
  "description": "Vize - High-performance Vue.js toolchain in Rust",
5
5
  "keywords": [
6
6
  "cli",
@@ -56,14 +56,14 @@
56
56
  "vite-plus": "0.1.19"
57
57
  },
58
58
  "optionalDependencies": {
59
- "@vizejs/native-darwin-arm64": "0.69.0",
60
- "@vizejs/native-darwin-x64": "0.69.0",
61
- "@vizejs/native-linux-arm64-gnu": "0.69.0",
62
- "@vizejs/native-linux-arm64-musl": "0.69.0",
63
- "@vizejs/native-linux-x64-gnu": "0.69.0",
64
- "@vizejs/native-linux-x64-musl": "0.69.0",
65
- "@vizejs/native-win32-arm64-msvc": "0.69.0",
66
- "@vizejs/native-win32-x64-msvc": "0.69.0"
59
+ "@vizejs/native-darwin-arm64": "0.70.0",
60
+ "@vizejs/native-darwin-x64": "0.70.0",
61
+ "@vizejs/native-linux-arm64-gnu": "0.70.0",
62
+ "@vizejs/native-linux-arm64-musl": "0.70.0",
63
+ "@vizejs/native-linux-x64-gnu": "0.70.0",
64
+ "@vizejs/native-linux-x64-musl": "0.70.0",
65
+ "@vizejs/native-win32-arm64-msvc": "0.70.0",
66
+ "@vizejs/native-win32-x64-msvc": "0.70.0"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=18"
package/src/cli.ts CHANGED
@@ -69,6 +69,7 @@ interface NativeBinding {
69
69
  ) => BatchCompileResult;
70
70
  formatSfc: (source: string, options?: NativeFormatOptions) => FormatResult;
71
71
  typeCheck: (source: string, options?: NativeTypeCheckOptions) => TypeCheckResult;
72
+ generateDeclaration?: (source: string, options?: NativeDeclarationOptions) => DeclarationResult;
72
73
  lint: (
73
74
  patterns: string[],
74
75
  options?: {
@@ -209,6 +210,8 @@ function printCheckUsage(): void {
209
210
  console.error(" -q, --quiet Show summary only");
210
211
  console.error(" --strict Enable strict checks");
211
212
  console.error(" --show-virtual-ts Print generated Virtual TS");
213
+ console.error(" --declaration Emit Vue component .d.ts files");
214
+ console.error(" --declaration-dir <dir> Output directory for declarations");
212
215
  console.error(" --max-warnings <number> Fail when warnings exceed the limit");
213
216
  console.error(" -c, --config <path> Use a specific vize config file");
214
217
  console.error(" --no-config Disable config discovery");
@@ -745,6 +748,14 @@ interface NativeTypeCheckOptions {
745
748
  check_fallthrough_attrs?: boolean;
746
749
  }
747
750
 
751
+ interface NativeDeclarationOptions {
752
+ filename?: string;
753
+ }
754
+
755
+ interface DeclarationResult {
756
+ code: string;
757
+ }
758
+
748
759
  interface TypeDiagnostic {
749
760
  severity: string;
750
761
  message: string;
@@ -781,6 +792,8 @@ interface CheckOptions {
781
792
  checkSetupContext?: boolean;
782
793
  checkInvalidExports?: boolean;
783
794
  checkFallthroughAttrs?: boolean;
795
+ declaration?: boolean;
796
+ declarationDir?: string;
784
797
  help?: boolean;
785
798
  }
786
799
 
@@ -796,6 +809,11 @@ interface CheckedFileResult {
796
809
  result: TypeCheckResult;
797
810
  }
798
811
 
812
+ interface EmittedDeclaration {
813
+ file: string;
814
+ path: string;
815
+ }
816
+
799
817
  function parseCheckCommand(args: string[]): ParsedCheckCommand {
800
818
  const patterns: string[] = [];
801
819
  const options: CheckOptions = {};
@@ -831,6 +849,14 @@ function parseCheckCommand(args: string[]): ParsedCheckCommand {
831
849
  options.checkInvalidExports = false;
832
850
  } else if (arg === "--no-check-fallthrough-attrs") {
833
851
  options.checkFallthroughAttrs = false;
852
+ } else if (arg === "--declaration") {
853
+ options.declaration = true;
854
+ } else if (arg === "--declaration-dir") {
855
+ const declarationDir = args[++i];
856
+ if (!declarationDir) {
857
+ throw new Error("Missing path after --declaration-dir");
858
+ }
859
+ options.declarationDir = declarationDir;
834
860
  } else if (arg === "--config" || arg === "-c") {
835
861
  const configFile = args[++i];
836
862
  if (!configFile) {
@@ -843,11 +869,10 @@ function parseCheckCommand(args: string[]): ParsedCheckCommand {
843
869
  options.help = true;
844
870
  } else if (arg === "--tsconfig" || arg === "--corsa-path" || arg === "--servers") {
845
871
  i++;
846
- } else if (arg === "--socket" || arg === "-s" || arg === "--declaration-dir") {
872
+ } else if (arg === "--socket" || arg === "-s") {
847
873
  i++;
848
- } else if (arg === "--profile" || arg === "--declaration") {
849
- // Accepted for package-script compatibility with the Rust CLI. The npm
850
- // checker does not currently emit project profiles or declarations.
874
+ } else if (arg === "--profile") {
875
+ // Accepted for package-script compatibility with the Rust CLI.
851
876
  } else if (!arg.startsWith("-")) {
852
877
  patterns.push(arg);
853
878
  }
@@ -1001,6 +1026,56 @@ function collectVueFiles(patterns: string[]): string[] {
1001
1026
  return Array.from(files).sort();
1002
1027
  }
1003
1028
 
1029
+ function commonSourceDirectory(results: CheckedFileResult[]): string {
1030
+ let common = path.dirname(results[0]?.file ?? process.cwd());
1031
+
1032
+ for (let i = 1; i < results.length; i++) {
1033
+ const directory = path.dirname(results[i].file);
1034
+ while (common !== path.dirname(common)) {
1035
+ const relative = path.relative(common, directory);
1036
+ if (relative !== ".." && !relative.startsWith(`..${path.sep}`)) {
1037
+ break;
1038
+ }
1039
+ common = path.dirname(common);
1040
+ }
1041
+ }
1042
+
1043
+ return common;
1044
+ }
1045
+
1046
+ function emitCheckDeclarations(
1047
+ results: CheckedFileResult[],
1048
+ native: NativeBinding,
1049
+ options: CheckOptions,
1050
+ ): EmittedDeclaration[] {
1051
+ if (!options.declaration) {
1052
+ return [];
1053
+ }
1054
+
1055
+ if (typeof native.generateDeclaration !== "function") {
1056
+ throw new Error("The loaded native binding does not support declaration generation.");
1057
+ }
1058
+
1059
+ const outDir = path.resolve(process.cwd(), options.declarationDir ?? "dist/types");
1060
+ const sourceRoot = commonSourceDirectory(results);
1061
+ const declarations: EmittedDeclaration[] = [];
1062
+
1063
+ for (const { file, source } of results) {
1064
+ const relative = normalizePath(path.relative(sourceRoot, file));
1065
+ const outputPath = path.join(outDir, `${relative}.d.ts`);
1066
+ mkdirSync(path.dirname(outputPath), { recursive: true });
1067
+
1068
+ const declaration = native.generateDeclaration(source, { filename: file });
1069
+ writeFileSync(outputPath, declaration.code);
1070
+ declarations.push({
1071
+ file: displayPath(outputPath),
1072
+ path: outputPath,
1073
+ });
1074
+ }
1075
+
1076
+ return declarations;
1077
+ }
1078
+
1004
1079
  function lineStarts(source: string): number[] {
1005
1080
  const starts = [0];
1006
1081
  for (let i = 0; i < source.length; i++) {
@@ -1057,6 +1132,7 @@ function renderCheckText(
1057
1132
  results: CheckedFileResult[],
1058
1133
  options: CheckOptions,
1059
1134
  timeMs: number,
1135
+ declarations: EmittedDeclaration[] = [],
1060
1136
  ): void {
1061
1137
  let totalErrors = 0;
1062
1138
  let totalWarnings = 0;
@@ -1100,6 +1176,9 @@ function renderCheckText(
1100
1176
  if (totalWarnings > 0) {
1101
1177
  process.stdout.write(` \x1b[33m${totalWarnings} warning(s)\x1b[0m\n`);
1102
1178
  }
1179
+ if (declarations.length > 0) {
1180
+ process.stdout.write(` \x1b[32mEmitted ${declarations.length} declaration file(s)\x1b[0m\n`);
1181
+ }
1103
1182
  }
1104
1183
 
1105
1184
  async function runCheck(args: string[]): Promise<void> {
@@ -1151,6 +1230,7 @@ async function runCheck(args: string[]): Promise<void> {
1151
1230
  };
1152
1231
  });
1153
1232
  const timeMs = performance.now() - start;
1233
+ const declarations = emitCheckDeclarations(results, native, options);
1154
1234
  const totalErrors = results.reduce((sum, { result }) => sum + result.errorCount, 0);
1155
1235
  const totalWarnings = results.reduce((sum, { result }) => sum + result.warningCount, 0);
1156
1236
 
@@ -1166,13 +1246,14 @@ async function runCheck(args: string[]): Promise<void> {
1166
1246
  errorCount: totalErrors,
1167
1247
  warningCount: totalWarnings,
1168
1248
  fileCount: results.length,
1249
+ declarations: declarations.map(({ file }) => file),
1169
1250
  },
1170
1251
  null,
1171
1252
  2,
1172
1253
  )}\n`,
1173
1254
  );
1174
1255
  } else {
1175
- renderCheckText(results, options, timeMs);
1256
+ renderCheckText(results, options, timeMs, declarations);
1176
1257
  }
1177
1258
 
1178
1259
  if (totalErrors > 0) {