vize 0.96.0 → 0.100.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.d.mts CHANGED
@@ -1,7 +1,18 @@
1
1
  //#region src/cli.d.ts
2
2
  declare function shouldPreferWorkspaceBinding(resolvedPath: string | null): boolean;
3
+ declare function shouldRetainCheckSource(options: {
4
+ declaration?: boolean;
5
+ format?: string;
6
+ quiet?: boolean;
7
+ }): boolean;
3
8
  declare function sanitizeTerminalText(value: unknown): string;
4
9
  declare function displayPath(filePath: string): string;
10
+ interface BoundedFileBatchOptions {
11
+ maxFiles: number;
12
+ maxBytes: number;
13
+ sizeOf?: (file: string) => number;
14
+ }
15
+ declare function createBoundedFileBatches(files: readonly string[], options: BoundedFileBatchOptions): string[][];
5
16
  //#endregion
6
- export { displayPath, sanitizeTerminalText, shouldPreferWorkspaceBinding };
17
+ export { createBoundedFileBatches, displayPath, sanitizeTerminalText, shouldPreferWorkspaceBinding, shouldRetainCheckSource };
7
18
  //# sourceMappingURL=cli.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.mts","names":[],"sources":["../src/cli.ts"],"mappings":";iBA6IgB,4BAAA,CAA6B,YAAA;AAAA,iBAwxB7B,oBAAA,CAAqB,KAAA;AAAA,iBA+DrB,WAAA,CAAY,QAAA"}
1
+ {"version":3,"file":"cli.d.mts","names":[],"sources":["../src/cli.ts"],"mappings":";iBA8IgB,4BAAA,CAA6B,YAAA;AAAA,iBAixB7B,uBAAA,CAAwB,OAAA;EACtC,WAAA;EACA,MAAA;EACA,KAAA;AAAA;AAAA,iBAac,oBAAA,CAAqB,KAAA;AAAA,iBA+DrB,WAAA,CAAY,QAAA;AAAA,UA4IlB,uBAAA;EACR,QAAA;EACA,QAAA;EACA,MAAA,IAAU,IAAA;AAAA;AAAA,iBAWI,wBAAA,CACd,KAAA,qBACA,OAAA,EAAS,uBAAA"}
package/dist/cli.mjs CHANGED
@@ -8,6 +8,7 @@ import { pathToFileURL } from "node:url";
8
8
  const require = createRequire(import.meta.url);
9
9
  const WORKSPACE_BINDING_PATH = "../../vize-native";
10
10
  const BUILD_BATCH_SIZE = 128;
11
+ const BUILD_BATCH_MAX_BYTES = 32 * 1024 * 1024;
11
12
  const SKIPPED_VUE_FILE_DIRECTORIES = new Set([
12
13
  "node_modules",
13
14
  "dist",
@@ -279,26 +280,35 @@ async function runBuild(args) {
279
280
  }
280
281
  const native = loadNative("build");
281
282
  const startedAt = performance.now();
283
+ const batches = createBoundedFileBatches(files, {
284
+ maxFiles: BUILD_BATCH_SIZE,
285
+ maxBytes: BUILD_BATCH_MAX_BYTES
286
+ });
282
287
  if (options.format !== "stats") mkdirSync(options.output, { recursive: true });
283
288
  let nativeTimeMs = 0;
284
289
  let failed = 0;
285
290
  let success = 0;
286
- for (let start = 0; start < files.length; start += BUILD_BATCH_SIZE) {
287
- const inputs = files.slice(start, start + BUILD_BATCH_SIZE).map((file) => ({
288
- path: file,
289
- source: readFileSync(file, "utf8")
290
- }));
291
- const sourceByPath = new Map(inputs.map((input) => [input.path, input.source]));
291
+ for (const batch of batches) {
292
+ const inputs = [];
293
+ const extensionByPath = /* @__PURE__ */ new Map();
294
+ for (const file of batch) {
295
+ const source = readFileSync(file, "utf8");
296
+ extensionByPath.set(file, getOutputExtension(source, options.scriptExt));
297
+ inputs.push({
298
+ path: file,
299
+ source
300
+ });
301
+ }
292
302
  const chunkStartedAt = performance.now();
293
303
  const result = native.compileSfcBatchWithResults(inputs, toNativeBuildOptions(options));
304
+ inputs.length = 0;
294
305
  nativeTimeMs += result.timeMs ?? result.time_ms ?? performance.now() - chunkStartedAt;
295
- const results = [...result.results].sort((left, right) => left.path.localeCompare(right.path));
306
+ const results = result.results.sort((left, right) => left.path.localeCompare(right.path));
296
307
  for (const fileResult of results) {
297
- const source = sourceByPath.get(fileResult.path) ?? "";
298
308
  for (const warning of fileResult.warnings) process.stderr.write(`warning: ${displayPath(fileResult.path)} ${sanitizeTerminalText(warning)}\n`);
299
309
  for (const error of fileResult.errors) process.stderr.write(`error: ${displayPath(fileResult.path)} ${sanitizeTerminalText(error)}\n`);
300
310
  if (fileResult.errors.length > 0 || options.format === "stats") continue;
301
- const extension = options.format === "json" ? "json" : getOutputExtension(source, options.scriptExt);
311
+ const extension = options.format === "json" ? "json" : extensionByPath.get(fileResult.path) ?? "js";
302
312
  writeFileSync(path.join(options.output, outputFileName(fileResult.path, extension)), options.format === "json" ? JSON.stringify(fileResult, null, 2) : fileResult.code);
303
313
  }
304
314
  const chunkFailed = result.failedCount ?? result.failed_count ?? results.filter((r) => r.errors.length).length;
@@ -451,6 +461,9 @@ function parseCheckCommand(args) {
451
461
  sharedConfig
452
462
  };
453
463
  }
464
+ function shouldRetainCheckSource(options) {
465
+ return Boolean(options.declaration || options.format !== "json" && !options.quiet);
466
+ }
454
467
  function hasGlobSyntax(pattern) {
455
468
  return pattern.includes("*") || pattern.includes("?") || pattern.includes("[");
456
469
  }
@@ -505,14 +518,13 @@ function displayPath(filePath) {
505
518
  function isVueFile(filePath) {
506
519
  return path.extname(filePath) === ".vue";
507
520
  }
508
- function collectVueFilesFromDirectory(directory, recursive) {
509
- const files = [];
521
+ function collectVueFilesFromDirectory(directory, recursive, files = []) {
510
522
  const entries = readdirSync(directory, { withFileTypes: true });
511
523
  for (const entry of entries) {
512
524
  const entryPath = path.join(directory, entry.name);
513
525
  if (entry.isDirectory()) {
514
526
  if (SKIPPED_VUE_FILE_DIRECTORIES.has(entry.name)) continue;
515
- if (recursive) files.push(...collectVueFilesFromDirectory(entryPath, true));
527
+ if (recursive) collectVueFilesFromDirectory(entryPath, true, files);
516
528
  } else if (entry.isFile() && isVueFile(entryPath)) files.push(entryPath);
517
529
  }
518
530
  return files;
@@ -578,10 +590,37 @@ function collectVueFiles(patterns) {
578
590
  }
579
591
  return Array.from(files).sort();
580
592
  }
581
- function commonSourceDirectory(results) {
582
- let common = path.dirname(results[0]?.file ?? process.cwd());
583
- for (let i = 1; i < results.length; i++) {
584
- const directory = path.dirname(results[i].file);
593
+ function statFileSize(file) {
594
+ try {
595
+ return statSync(file).size;
596
+ } catch {
597
+ return 0;
598
+ }
599
+ }
600
+ function createBoundedFileBatches(files, options) {
601
+ const maxFiles = Math.max(1, Math.floor(options.maxFiles));
602
+ const maxBytes = Math.max(1, Math.floor(options.maxBytes));
603
+ const sizeOf = options.sizeOf ?? statFileSize;
604
+ const batches = [];
605
+ let current = [];
606
+ let currentBytes = 0;
607
+ for (const file of files) {
608
+ const fileBytes = Math.max(0, sizeOf(file));
609
+ if (current.length > 0 && (current.length >= maxFiles || currentBytes + fileBytes > maxBytes)) {
610
+ batches.push(current);
611
+ current = [];
612
+ currentBytes = 0;
613
+ }
614
+ current.push(file);
615
+ currentBytes += fileBytes;
616
+ }
617
+ if (current.length > 0) batches.push(current);
618
+ return batches;
619
+ }
620
+ function commonSourceDirectory(files) {
621
+ let common = path.dirname(files[0] ?? process.cwd());
622
+ for (let i = 1; i < files.length; i++) {
623
+ const directory = path.dirname(files[i]);
585
624
  while (common !== path.dirname(common)) {
586
625
  const relative = path.relative(common, directory);
587
626
  if (relative !== ".." && !relative.startsWith(`..${path.sep}`)) break;
@@ -590,23 +629,16 @@ function commonSourceDirectory(results) {
590
629
  }
591
630
  return common;
592
631
  }
593
- function emitCheckDeclarations(results, native, options) {
594
- if (!options.declaration) return [];
595
- if (typeof native.generateDeclaration !== "function") throw new Error("The loaded native binding does not support declaration generation.");
632
+ function emitCheckDeclaration(file, source, sourceRoot, native, options) {
596
633
  const outDir = path.resolve(process.cwd(), options.declarationDir ?? "dist/types");
597
- const sourceRoot = commonSourceDirectory(results);
598
- const declarations = [];
599
- for (const { file, source } of results) {
600
- const relative = normalizePath(path.relative(sourceRoot, file));
601
- const outputPath = path.join(outDir, `${relative}.d.ts`);
602
- mkdirSync(path.dirname(outputPath), { recursive: true });
603
- writeFileSync(outputPath, native.generateDeclaration(source, { filename: file }).code);
604
- declarations.push({
605
- file: displayPath(outputPath),
606
- path: outputPath
607
- });
608
- }
609
- return declarations;
634
+ const relative = normalizePath(path.relative(sourceRoot, file));
635
+ const outputPath = path.join(outDir, `${relative}.d.ts`);
636
+ mkdirSync(path.dirname(outputPath), { recursive: true });
637
+ writeFileSync(outputPath, native.generateDeclaration(source, { filename: file }).code);
638
+ return {
639
+ file: displayPath(outputPath),
640
+ path: outputPath
641
+ };
610
642
  }
611
643
  function lineStarts(source) {
612
644
  const starts = [0];
@@ -649,31 +681,47 @@ function toNativeTypeCheckOptions(file, options) {
649
681
  check_fallthrough_attrs: options.checkFallthroughAttrs
650
682
  };
651
683
  }
652
- function renderCheckText(results, options, timeMs, declarations = []) {
653
- let totalErrors = 0;
654
- let totalWarnings = 0;
655
- for (const { file, source, result } of results) {
656
- totalErrors += result.errorCount;
657
- totalWarnings += result.warningCount;
658
- if (options.includeVirtualTs && result.virtualTs) process.stderr.write(`\n=== ${displayPath(file)} ===\n${sanitizeTerminalText(result.virtualTs)}\n`);
659
- if (options.quiet || result.diagnostics.length === 0) continue;
660
- const starts = lineStarts(source);
661
- process.stdout.write(`\n\x1b[4m${displayPath(file)}\x1b[0m\n`);
662
- for (const diagnostic of result.diagnostics) {
663
- const color = diagnostic.severity === "error" ? "\x1B[31m" : "\x1B[33m";
664
- const location = offsetToLineColumn(starts, diagnostic.start);
665
- const code = diagnostic.code ? ` [${sanitizeTerminalText(diagnostic.code)}]` : "";
666
- process.stdout.write(` ${color}${diagnostic.severity}:${location.line}:${location.column}\x1b[0m${code} ${sanitizeTerminalText(diagnostic.message)}\n`);
667
- if (diagnostic.help) process.stdout.write(` help: ${sanitizeTerminalText(diagnostic.help)}\n`);
668
- }
684
+ function renderCheckFileText(file, source, result, options) {
685
+ if (options.includeVirtualTs && result.virtualTs) process.stderr.write(`\n=== ${displayPath(file)} ===\n${sanitizeTerminalText(result.virtualTs)}\n`);
686
+ if (options.quiet || result.diagnostics.length === 0) return;
687
+ const starts = lineStarts(source);
688
+ process.stdout.write(`\n\x1b[4m${displayPath(file)}\x1b[0m\n`);
689
+ for (const diagnostic of result.diagnostics) {
690
+ const color = diagnostic.severity === "error" ? "\x1B[31m" : "\x1B[33m";
691
+ const location = offsetToLineColumn(starts, diagnostic.start);
692
+ const code = diagnostic.code ? ` [${sanitizeTerminalText(diagnostic.code)}]` : "";
693
+ process.stdout.write(` ${color}${diagnostic.severity}:${location.line}:${location.column}\x1b[0m${code} ${sanitizeTerminalText(diagnostic.message)}\n`);
694
+ if (diagnostic.help) process.stdout.write(` help: ${sanitizeTerminalText(diagnostic.help)}\n`);
669
695
  }
696
+ }
697
+ function renderCheckSummary(totalErrors, totalWarnings, fileCount, timeMs, declarations) {
670
698
  const status = totalErrors > 0 ? "\x1B[31mERR\x1B[0m" : "\x1B[32mOK\x1B[0m";
671
- process.stdout.write(`\n${status} Type checked ${results.length} Vue files in ${timeMs.toFixed(2)}ms\n`);
699
+ process.stdout.write(`\n${status} Type checked ${fileCount} Vue files in ${timeMs.toFixed(2)}ms\n`);
672
700
  if (totalErrors > 0) process.stdout.write(` \x1b[31m${totalErrors} error(s)\x1b[0m\n`);
673
701
  else process.stdout.write(" \x1B[32mNo type errors found!\x1B[0m\n");
674
702
  if (totalWarnings > 0) process.stdout.write(` \x1b[33m${totalWarnings} warning(s)\x1b[0m\n`);
675
703
  if (declarations.length > 0) process.stdout.write(` \x1b[32mEmitted ${declarations.length} declaration file(s)\x1b[0m\n`);
676
704
  }
705
+ function indentJson(value, spaces) {
706
+ const padding = " ".repeat(spaces);
707
+ return JSON.stringify(value, null, 2).split("\n").map((line) => `${padding}${line}`).join("\n");
708
+ }
709
+ function writeCheckJsonFile(index, file, result) {
710
+ if (index > 0) process.stdout.write(",\n");
711
+ process.stdout.write(indentJson({
712
+ file: displayPath(file),
713
+ diagnostics: result.diagnostics,
714
+ virtualTs: result.virtualTs
715
+ }, 4));
716
+ }
717
+ function writeCheckJsonEnd(totalErrors, totalWarnings, fileCount, declarations) {
718
+ process.stdout.write("\n ],\n");
719
+ process.stdout.write(` "errorCount": ${totalErrors},\n`);
720
+ process.stdout.write(` "warningCount": ${totalWarnings},\n`);
721
+ process.stdout.write(` "fileCount": ${fileCount},\n`);
722
+ process.stdout.write(` "declarations": ${indentJson(declarations.map(({ file }) => file), 2).trimStart()}\n`);
723
+ process.stdout.write("}\n");
724
+ }
677
725
  async function runCheck(args) {
678
726
  const { patterns, options, sharedConfig } = parseCheckCommand(args);
679
727
  if (options.help) {
@@ -703,31 +751,28 @@ async function runCheck(args) {
703
751
  return;
704
752
  }
705
753
  const native = loadNative("check");
706
- const start = performance.now();
707
- const results = files.map((file) => {
754
+ if (options.declaration && typeof native.generateDeclaration !== "function") throw new Error("The loaded native binding does not support declaration generation.");
755
+ const sourceRoot = options.declaration ? commonSourceDirectory(files) : "";
756
+ const checkStartedAt = performance.now();
757
+ const retainSource = shouldRetainCheckSource(options);
758
+ const declarations = [];
759
+ let totalErrors = 0;
760
+ let totalWarnings = 0;
761
+ let checkedCount = 0;
762
+ if (options.format === "json") process.stdout.write("{\n \"files\": [\n");
763
+ for (const file of files) {
708
764
  const source = readFileSync(file, "utf8");
709
- return {
710
- file,
711
- source,
712
- result: native.typeCheck(source, toNativeTypeCheckOptions(file, options))
713
- };
714
- });
715
- const timeMs = performance.now() - start;
716
- const declarations = emitCheckDeclarations(results, native, options);
717
- const totalErrors = results.reduce((sum, { result }) => sum + result.errorCount, 0);
718
- const totalWarnings = results.reduce((sum, { result }) => sum + result.warningCount, 0);
719
- if (options.format === "json") process.stdout.write(`${JSON.stringify({
720
- files: results.map(({ file, result }) => ({
721
- file: displayPath(file),
722
- diagnostics: result.diagnostics,
723
- virtualTs: result.virtualTs
724
- })),
725
- errorCount: totalErrors,
726
- warningCount: totalWarnings,
727
- fileCount: results.length,
728
- declarations: declarations.map(({ file }) => file)
729
- }, null, 2)}\n`);
730
- else renderCheckText(results, options, timeMs, declarations);
765
+ const result = native.typeCheck(source, toNativeTypeCheckOptions(file, options));
766
+ totalErrors += result.errorCount;
767
+ totalWarnings += result.warningCount;
768
+ checkedCount++;
769
+ if (options.declaration) declarations.push(emitCheckDeclaration(file, source, sourceRoot, native, options));
770
+ if (options.format === "json") writeCheckJsonFile(checkedCount - 1, file, result);
771
+ else renderCheckFileText(file, retainSource ? source : "", result, options);
772
+ }
773
+ const timeMs = performance.now() - checkStartedAt;
774
+ if (options.format === "json") writeCheckJsonEnd(totalErrors, totalWarnings, checkedCount, declarations);
775
+ else renderCheckSummary(totalErrors, totalWarnings, checkedCount, timeMs, declarations);
731
776
  if (totalErrors > 0) process.exit(1);
732
777
  if (options.maxWarnings !== void 0 && totalWarnings > options.maxWarnings) {
733
778
  process.stderr.write(`\nToo many warnings (${totalWarnings} > max ${options.maxWarnings})\n`);
@@ -970,6 +1015,6 @@ if (!(Boolean(import.meta.vitest) || process.env.VITEST === "true" || process.en
970
1015
  process.exit(1);
971
1016
  });
972
1017
  //#endregion
973
- export { displayPath, sanitizeTerminalText, shouldPreferWorkspaceBinding };
1018
+ export { createBoundedFileBatches, displayPath, sanitizeTerminalText, shouldPreferWorkspaceBinding, shouldRetainCheckSource };
974
1019
 
975
1020
  //# sourceMappingURL=cli.mjs.map
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\";\nconst BUILD_BATCH_SIZE = 128;\nconst SKIPPED_VUE_FILE_DIRECTORIES = new Set([\n \"node_modules\",\n \"dist\",\n \".git\",\n \".nuxt\",\n \".output\",\n \".nitro\",\n \"coverage\",\n]);\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\nexport function 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 MacroArtifact {\n kind: string;\n name: string;\n source: string;\n content: string;\n moduleCode?: string;\n start: number;\n end: number;\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 macroArtifacts?: MacroArtifact[];\n macro_artifacts?: MacroArtifact[];\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(\n `No Vue files found matching inputs: ${sanitizeTerminalText(JSON.stringify(patterns))}\\n`,\n );\n process.exit(1);\n }\n\n const native = loadNative(\"build\");\n const startedAt = performance.now();\n\n if (options.format !== \"stats\") {\n mkdirSync(options.output, { recursive: true });\n }\n\n let nativeTimeMs = 0;\n let failed = 0;\n let success = 0;\n\n for (let start = 0; start < files.length; start += BUILD_BATCH_SIZE) {\n const inputs = files.slice(start, start + BUILD_BATCH_SIZE).map((file) => ({\n path: file,\n source: readFileSync(file, \"utf8\"),\n }));\n const sourceByPath = new Map(inputs.map((input) => [input.path, input.source]));\n const chunkStartedAt = performance.now();\n const result = native.compileSfcBatchWithResults(inputs, toNativeBuildOptions(options));\n nativeTimeMs += result.timeMs ?? result.time_ms ?? performance.now() - chunkStartedAt;\n const results = [...result.results].sort((left, right) => left.path.localeCompare(right.path));\n\n for (const fileResult of results) {\n const source = sourceByPath.get(fileResult.path) ?? \"\";\n for (const warning of fileResult.warnings) {\n process.stderr.write(\n `warning: ${displayPath(fileResult.path)} ${sanitizeTerminalText(warning)}\\n`,\n );\n }\n for (const error of fileResult.errors) {\n process.stderr.write(\n `error: ${displayPath(fileResult.path)} ${sanitizeTerminalText(error)}\\n`,\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 chunkFailed =\n result.failedCount ?? result.failed_count ?? results.filter((r) => r.errors.length).length;\n failed += chunkFailed;\n success += result.successCount ?? result.success_count ?? results.length - chunkFailed;\n }\n\n const timeMs = nativeTimeMs || performance.now() - startedAt;\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(\n `No Vue files found matching inputs: ${sanitizeTerminalText(JSON.stringify(patterns))}\\n`,\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)}: ${sanitizeTerminalText(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\nexport function sanitizeTerminalText(value: unknown): string {\n const text = String(value);\n let sanitized = \"\";\n\n for (let i = 0; i < text.length; i++) {\n const code = text.charCodeAt(i);\n if (code === 0x1b) {\n i = skipTerminalEscapeSequence(text, i);\n continue;\n }\n if (isUnsafeTerminalControl(code)) {\n continue;\n }\n sanitized += text[i];\n }\n\n return sanitized;\n}\n\nfunction skipTerminalEscapeSequence(text: string, escapeIndex: number): number {\n const introducer = text.charCodeAt(escapeIndex + 1);\n if (introducer === 0x5b) {\n return skipUntilAnsiFinalByte(text, escapeIndex + 2);\n }\n if (introducer === 0x5d || introducer === 0x50 || introducer === 0x5e || introducer === 0x5f) {\n return skipUntilStringTerminator(text, escapeIndex + 2);\n }\n if (Number.isNaN(introducer)) {\n return escapeIndex;\n }\n return escapeIndex + 1;\n}\n\nfunction skipUntilAnsiFinalByte(text: string, index: number): number {\n for (let i = index; i < text.length; i++) {\n const code = text.charCodeAt(i);\n if (code >= 0x40 && code <= 0x7e) {\n return i;\n }\n }\n return text.length - 1;\n}\n\nfunction skipUntilStringTerminator(text: string, index: number): number {\n for (let i = index; i < text.length; i++) {\n const code = text.charCodeAt(i);\n if (code === 0x07) {\n return i;\n }\n if (code === 0x1b && text.charCodeAt(i + 1) === 0x5c) {\n return i + 1;\n }\n }\n return text.length - 1;\n}\n\nfunction isUnsafeTerminalControl(code: number): boolean {\n if (code === 0x09 || code === 0x0a || code === 0x0d) {\n return false;\n }\n return (code >= 0x00 && code <= 0x1f) || (code >= 0x7f && code <= 0x9f);\n}\n\nexport function displayPath(filePath: string): string {\n const relative = path.relative(process.cwd(), filePath);\n if (relative && !relative.startsWith(\"..\") && !path.isAbsolute(relative)) {\n return sanitizeTerminalText(normalizePath(relative));\n }\n return sanitizeTerminalText(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 (SKIPPED_VUE_FILE_DIRECTORIES.has(entry.name)) {\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 `\\n=== ${displayPath(file)} ===\\n${sanitizeTerminalText(result.virtualTs)}\\n`,\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 ? ` [${sanitizeTerminalText(diagnostic.code)}]` : \"\";\n process.stdout.write(\n ` ${color}${diagnostic.severity}:${location.line}:${location.column}\\x1b[0m${code} ${sanitizeTerminalText(diagnostic.message)}\\n`,\n );\n if (diagnostic.help) {\n process.stdout.write(` help: ${sanitizeTerminalText(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(\n `No Vue files found matching inputs: ${sanitizeTerminalText(JSON.stringify(patterns))}\\n`,\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(sanitizeTerminalText(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: ${sanitizeTerminalText(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\nconst isTestRuntime =\n Boolean(import.meta.vitest) || process.env.VITEST === \"true\" || process.env.NODE_ENV === \"test\";\n\nif (!isTestRuntime) {\n void main().catch((error) => {\n console.error(sanitizeTerminalText(error instanceof Error ? error.message : String(error)));\n process.exit(1);\n });\n}\n"],"mappings":";;;;;;;AAOA,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAC9C,MAAM,yBAAyB;AAC/B,MAAM,mBAAmB;AACzB,MAAM,+BAA+B,IAAI,IAAI;CAC3C;CACA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AI,IAAI;CAAC;CAAS;CAAS;CAAU,CAAC;AAE1D,eAAe,OAAsB;CACnC,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;CAClC,MAAM,UAAU,KAAK;CAErB,IAAI,CAAC,WAAW,YAAY,YAAY,YAAY,MAAM;EACxD,YAAY;EACZ,QAAQ,KAAK,EAAE;;CAGjB,IAAI,cAAc,IAAI,QAAQ,EAAE;EAC9B,MAAM,cAAc,KAAK,MAAM,EAAE;EACjC,QAAQ,SAAR;GACE,KAAK;IACH,MAAM,SAAS,YAAY;IAC3B;GACF,KAAK;IACH,MAAM,SAAS,YAAY;IAC3B;GACF,KAAK;IACH,MAAM,OAAO,YAAY;IACzB;GACF,KAAK;IACH,MAAM,QAAQ,YAAY;IAC1B;;QAEC,IAAI,YAAY,IAAI,QAAQ,EAAE;EACnC,MAAM,cAAc,KAAK,MAAM,EAAE;EACjC,QAAQ,SAAR;GACE,KAAK;IACH,SAAS,YAAY;IACrB;GACF,KAAK;IACH,MAAM,SAAS,YAAY;IAC3B;GACF,KAAK;IACH,WAAW,YAAY;IACvB;;QAEC;EACL,YAAY;EACZ,QAAQ,MAAM,oBAAoB,qBAAqB,QAAQ,GAAG;EAClE,QAAQ,MACN,mFACD;EACD,QAAQ,KAAK,EAAE;;;AAOnB,IAAI,EAFF,QAAQ,OAAO,KAAK,OAAO,IAAI,QAAQ,IAAI,WAAW,UAAU,QAAQ,IAAI,aAAa,SAGzF,MAAW,CAAC,OAAO,UAAU;CAC3B,QAAQ,MAAM,qBAAqB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC,CAAC;CAC3F,QAAQ,KAAK,EAAE;EACf"}
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\";\nconst BUILD_BATCH_SIZE = 128;\nconst BUILD_BATCH_MAX_BYTES = 32 * 1024 * 1024;\nconst SKIPPED_VUE_FILE_DIRECTORIES = new Set([\n \"node_modules\",\n \"dist\",\n \".git\",\n \".nuxt\",\n \".output\",\n \".nitro\",\n \"coverage\",\n]);\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\nexport function 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 MacroArtifact {\n kind: string;\n name: string;\n source: string;\n content: string;\n moduleCode?: string;\n start: number;\n end: number;\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 macroArtifacts?: MacroArtifact[];\n macro_artifacts?: MacroArtifact[];\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(\n `No Vue files found matching inputs: ${sanitizeTerminalText(JSON.stringify(patterns))}\\n`,\n );\n process.exit(1);\n }\n\n const native = loadNative(\"build\");\n const startedAt = performance.now();\n const batches = createBoundedFileBatches(files, {\n maxFiles: BUILD_BATCH_SIZE,\n maxBytes: BUILD_BATCH_MAX_BYTES,\n });\n\n if (options.format !== \"stats\") {\n mkdirSync(options.output, { recursive: true });\n }\n\n let nativeTimeMs = 0;\n let failed = 0;\n let success = 0;\n\n for (const batch of batches) {\n const inputs: { path: string; source: string }[] = [];\n const extensionByPath = new Map<string, string>();\n for (const file of batch) {\n const source = readFileSync(file, \"utf8\");\n extensionByPath.set(file, getOutputExtension(source, options.scriptExt));\n inputs.push({ path: file, source });\n }\n\n const chunkStartedAt = performance.now();\n const result = native.compileSfcBatchWithResults(inputs, toNativeBuildOptions(options));\n inputs.length = 0;\n nativeTimeMs += result.timeMs ?? result.time_ms ?? performance.now() - chunkStartedAt;\n const results = result.results.sort((left, right) => left.path.localeCompare(right.path));\n\n for (const fileResult of results) {\n for (const warning of fileResult.warnings) {\n process.stderr.write(\n `warning: ${displayPath(fileResult.path)} ${sanitizeTerminalText(warning)}\\n`,\n );\n }\n for (const error of fileResult.errors) {\n process.stderr.write(\n `error: ${displayPath(fileResult.path)} ${sanitizeTerminalText(error)}\\n`,\n );\n }\n\n if (fileResult.errors.length > 0 || options.format === \"stats\") {\n continue;\n }\n\n const extension =\n options.format === \"json\" ? \"json\" : (extensionByPath.get(fileResult.path) ?? \"js\");\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 chunkFailed =\n result.failedCount ?? result.failed_count ?? results.filter((r) => r.errors.length).length;\n failed += chunkFailed;\n success += result.successCount ?? result.success_count ?? results.length - chunkFailed;\n }\n\n const timeMs = nativeTimeMs || performance.now() - startedAt;\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(\n `No Vue files found matching inputs: ${sanitizeTerminalText(JSON.stringify(patterns))}\\n`,\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)}: ${sanitizeTerminalText(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 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\nexport function shouldRetainCheckSource(options: {\n declaration?: boolean;\n format?: string;\n quiet?: boolean;\n}): boolean {\n return Boolean(options.declaration || (options.format !== \"json\" && !options.quiet));\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\nexport function sanitizeTerminalText(value: unknown): string {\n const text = String(value);\n let sanitized = \"\";\n\n for (let i = 0; i < text.length; i++) {\n const code = text.charCodeAt(i);\n if (code === 0x1b) {\n i = skipTerminalEscapeSequence(text, i);\n continue;\n }\n if (isUnsafeTerminalControl(code)) {\n continue;\n }\n sanitized += text[i];\n }\n\n return sanitized;\n}\n\nfunction skipTerminalEscapeSequence(text: string, escapeIndex: number): number {\n const introducer = text.charCodeAt(escapeIndex + 1);\n if (introducer === 0x5b) {\n return skipUntilAnsiFinalByte(text, escapeIndex + 2);\n }\n if (introducer === 0x5d || introducer === 0x50 || introducer === 0x5e || introducer === 0x5f) {\n return skipUntilStringTerminator(text, escapeIndex + 2);\n }\n if (Number.isNaN(introducer)) {\n return escapeIndex;\n }\n return escapeIndex + 1;\n}\n\nfunction skipUntilAnsiFinalByte(text: string, index: number): number {\n for (let i = index; i < text.length; i++) {\n const code = text.charCodeAt(i);\n if (code >= 0x40 && code <= 0x7e) {\n return i;\n }\n }\n return text.length - 1;\n}\n\nfunction skipUntilStringTerminator(text: string, index: number): number {\n for (let i = index; i < text.length; i++) {\n const code = text.charCodeAt(i);\n if (code === 0x07) {\n return i;\n }\n if (code === 0x1b && text.charCodeAt(i + 1) === 0x5c) {\n return i + 1;\n }\n }\n return text.length - 1;\n}\n\nfunction isUnsafeTerminalControl(code: number): boolean {\n if (code === 0x09 || code === 0x0a || code === 0x0d) {\n return false;\n }\n return (code >= 0x00 && code <= 0x1f) || (code >= 0x7f && code <= 0x9f);\n}\n\nexport function displayPath(filePath: string): string {\n const relative = path.relative(process.cwd(), filePath);\n if (relative && !relative.startsWith(\"..\") && !path.isAbsolute(relative)) {\n return sanitizeTerminalText(normalizePath(relative));\n }\n return sanitizeTerminalText(normalizePath(filePath));\n}\n\nfunction isVueFile(filePath: string): boolean {\n return path.extname(filePath) === \".vue\";\n}\n\nfunction collectVueFilesFromDirectory(\n directory: string,\n recursive: boolean,\n files: string[] = [],\n): 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 (SKIPPED_VUE_FILE_DIRECTORIES.has(entry.name)) {\n continue;\n }\n if (recursive) {\n collectVueFilesFromDirectory(entryPath, true, files);\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\ninterface BoundedFileBatchOptions {\n maxFiles: number;\n maxBytes: number;\n sizeOf?: (file: string) => number;\n}\n\nfunction statFileSize(file: string): number {\n try {\n return statSync(file).size;\n } catch {\n return 0;\n }\n}\n\nexport function createBoundedFileBatches(\n files: readonly string[],\n options: BoundedFileBatchOptions,\n): string[][] {\n const maxFiles = Math.max(1, Math.floor(options.maxFiles));\n const maxBytes = Math.max(1, Math.floor(options.maxBytes));\n const sizeOf = options.sizeOf ?? statFileSize;\n const batches: string[][] = [];\n let current: string[] = [];\n let currentBytes = 0;\n\n for (const file of files) {\n const fileBytes = Math.max(0, sizeOf(file));\n if (current.length > 0 && (current.length >= maxFiles || currentBytes + fileBytes > maxBytes)) {\n batches.push(current);\n current = [];\n currentBytes = 0;\n }\n\n current.push(file);\n currentBytes += fileBytes;\n }\n\n if (current.length > 0) {\n batches.push(current);\n }\n\n return batches;\n}\n\nfunction commonSourceDirectory(files: readonly string[]): string {\n let common = path.dirname(files[0] ?? process.cwd());\n\n for (let i = 1; i < files.length; i++) {\n const directory = path.dirname(files[i]!);\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 emitCheckDeclaration(\n file: string,\n source: string,\n sourceRoot: string,\n native: NativeBinding,\n options: CheckOptions,\n): EmittedDeclaration {\n const outDir = path.resolve(process.cwd(), options.declarationDir ?? \"dist/types\");\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\n return {\n file: displayPath(outputPath),\n path: outputPath,\n };\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 renderCheckFileText(\n file: string,\n source: string,\n result: TypeCheckResult,\n options: CheckOptions,\n): void {\n if (options.includeVirtualTs && result.virtualTs) {\n process.stderr.write(\n `\\n=== ${displayPath(file)} ===\\n${sanitizeTerminalText(result.virtualTs)}\\n`,\n );\n }\n\n if (options.quiet || result.diagnostics.length === 0) {\n return;\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 ? ` [${sanitizeTerminalText(diagnostic.code)}]` : \"\";\n process.stdout.write(\n ` ${color}${diagnostic.severity}:${location.line}:${location.column}\\x1b[0m${code} ${sanitizeTerminalText(diagnostic.message)}\\n`,\n );\n if (diagnostic.help) {\n process.stdout.write(` help: ${sanitizeTerminalText(diagnostic.help)}\\n`);\n }\n }\n}\n\nfunction renderCheckSummary(\n totalErrors: number,\n totalWarnings: number,\n fileCount: number,\n timeMs: number,\n declarations: readonly EmittedDeclaration[],\n): void {\n const status = totalErrors > 0 ? \"\\x1b[31mERR\\x1b[0m\" : \"\\x1b[32mOK\\x1b[0m\";\n process.stdout.write(\n `\\n${status} Type checked ${fileCount} 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\nfunction indentJson(value: unknown, spaces: number): string {\n const padding = \" \".repeat(spaces);\n return JSON.stringify(value, null, 2)\n .split(\"\\n\")\n .map((line) => `${padding}${line}`)\n .join(\"\\n\");\n}\n\nfunction writeCheckJsonFile(index: number, file: string, result: TypeCheckResult): void {\n if (index > 0) {\n process.stdout.write(\",\\n\");\n }\n process.stdout.write(\n indentJson(\n {\n file: displayPath(file),\n diagnostics: result.diagnostics,\n virtualTs: result.virtualTs,\n },\n 4,\n ),\n );\n}\n\nfunction writeCheckJsonEnd(\n totalErrors: number,\n totalWarnings: number,\n fileCount: number,\n declarations: readonly EmittedDeclaration[],\n): void {\n process.stdout.write(\"\\n ],\\n\");\n process.stdout.write(` \"errorCount\": ${totalErrors},\\n`);\n process.stdout.write(` \"warningCount\": ${totalWarnings},\\n`);\n process.stdout.write(` \"fileCount\": ${fileCount},\\n`);\n process.stdout.write(\n ` \"declarations\": ${indentJson(\n declarations.map(({ file }) => file),\n 2,\n ).trimStart()}\\n`,\n );\n process.stdout.write(\"}\\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(\n `No Vue files found matching inputs: ${sanitizeTerminalText(JSON.stringify(patterns))}\\n`,\n );\n return;\n }\n\n const native = loadNative(\"check\");\n if (options.declaration && typeof native.generateDeclaration !== \"function\") {\n throw new Error(\"The loaded native binding does not support declaration generation.\");\n }\n\n const sourceRoot = options.declaration ? commonSourceDirectory(files) : \"\";\n const checkStartedAt = performance.now();\n const retainSource = shouldRetainCheckSource(options);\n const declarations: EmittedDeclaration[] = [];\n let totalErrors = 0;\n let totalWarnings = 0;\n let checkedCount = 0;\n\n if (options.format === \"json\") {\n process.stdout.write('{\\n \"files\": [\\n');\n }\n\n for (const file of files) {\n const source = readFileSync(file, \"utf8\");\n const result = native.typeCheck(source, toNativeTypeCheckOptions(file, options));\n totalErrors += result.errorCount;\n totalWarnings += result.warningCount;\n checkedCount++;\n\n if (options.declaration) {\n declarations.push(emitCheckDeclaration(file, source, sourceRoot, native, options));\n }\n\n if (options.format === \"json\") {\n writeCheckJsonFile(checkedCount - 1, file, result);\n } else {\n renderCheckFileText(file, retainSource ? source : \"\", result, options);\n }\n }\n\n const timeMs = performance.now() - checkStartedAt;\n\n if (options.format === \"json\") {\n writeCheckJsonEnd(totalErrors, totalWarnings, checkedCount, declarations);\n } else {\n renderCheckSummary(totalErrors, totalWarnings, checkedCount, 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(sanitizeTerminalText(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: ${sanitizeTerminalText(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\nconst isTestRuntime =\n Boolean(import.meta.vitest) || process.env.VITEST === \"true\" || process.env.NODE_ENV === \"test\";\n\nif (!isTestRuntime) {\n void main().catch((error) => {\n console.error(sanitizeTerminalText(error instanceof Error ? error.message : String(error)));\n process.exit(1);\n });\n}\n"],"mappings":";;;;;;;AAOA,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAC9C,MAAM,yBAAyB;AAC/B,MAAM,mBAAmB;AACzB,MAAM,wBAAwB,KAAK,OAAO;AAC1C,MAAM,+BAA+B,IAAI,IAAI;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAMF,SAAS,SAAkB;CACzB,MAAM,SAAS,QAAQ,QAAQ,WAAW;CAC1C,IAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,YAAY,QAE/D,OAAO,CADS,OAAwD,OACzD;CAEjB,IAAI;EAEF,OAAO,aADS,QAAQ,gBAAgB,CAAC,SAAS,YAAY,CAAC,UAAU,CAAC,MAC/C,EAAE,OAAO,CAAC,SAAS,OAAO;SAC/C;EACN,OAAO;;;AAIX,SAAS,wBAAgC;CACvC,MAAM,EAAE,UAAU,SAAS;CAE3B,QAAQ,UAAR;EACE,KAAK,UACH,QAAQ,MAAR;GACE,KAAK,OACH,OAAO;GACT,KAAK,SACH,OAAO;GACT,SACE,MAAM,IAAI,MAAM,sCAAsC,OAAO;;EAEnE,KAAK,SACH,QAAQ,MAAR;GACE,KAAK,OACH,OAAO;GACT,KAAK,SACH,OAAO;GACT,SACE,MAAM,IAAI,MAAM,wCAAwC,OAAO;;EAErE,KAAK,SACH,QAAQ,MAAR;GACE,KAAK,OACH,OAAO,QAAQ,GAAG,kCAAkC;GACtD,KAAK,SACH,OAAO,QAAQ,GAAG,oCAAoC;GACxD,SACE,MAAM,IAAI,MAAM,sCAAsC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AAQ,KAAK,EAAE;;;AAOnB,IAAI,EAFF,QAAQ,OAAO,KAAK,OAAO,IAAI,QAAQ,IAAI,WAAW,UAAU,QAAQ,IAAI,aAAa,SAGzF,MAAW,CAAC,OAAO,UAAU;CAC3B,QAAQ,MAAM,qBAAqB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC,CAAC;CAC3F,QAAQ,KAAK,EAAE;EACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vize",
3
- "version": "0.96.0",
3
+ "version": "0.100.0",
4
4
  "description": "Vize - High-performance Vue.js toolchain in Rust",
5
5
  "keywords": [
6
6
  "cli",
@@ -57,14 +57,14 @@
57
57
  },
58
58
  "optionalDependencies": {
59
59
  "@pkl-community/pkl": "0.27.2",
60
- "@vizejs/native-darwin-arm64": "0.96.0",
61
- "@vizejs/native-darwin-x64": "0.96.0",
62
- "@vizejs/native-linux-arm64-gnu": "0.96.0",
63
- "@vizejs/native-linux-arm64-musl": "0.96.0",
64
- "@vizejs/native-linux-x64-gnu": "0.96.0",
65
- "@vizejs/native-linux-x64-musl": "0.96.0",
66
- "@vizejs/native-win32-arm64-msvc": "0.96.0",
67
- "@vizejs/native-win32-x64-msvc": "0.96.0"
60
+ "@vizejs/native-darwin-arm64": "0.100.0",
61
+ "@vizejs/native-darwin-x64": "0.100.0",
62
+ "@vizejs/native-linux-arm64-gnu": "0.100.0",
63
+ "@vizejs/native-linux-arm64-musl": "0.100.0",
64
+ "@vizejs/native-linux-x64-gnu": "0.100.0",
65
+ "@vizejs/native-linux-x64-musl": "0.100.0",
66
+ "@vizejs/native-win32-arm64-msvc": "0.100.0",
67
+ "@vizejs/native-win32-x64-msvc": "0.100.0"
68
68
  },
69
69
  "engines": {
70
70
  "node": ">=22"
package/src/cli.test.ts CHANGED
@@ -1,6 +1,12 @@
1
1
  import { describe, expect, it } from "vitest";
2
2
  import * as path from "node:path";
3
- import { displayPath, sanitizeTerminalText, shouldPreferWorkspaceBinding } from "./cli";
3
+ import {
4
+ createBoundedFileBatches,
5
+ displayPath,
6
+ sanitizeTerminalText,
7
+ shouldPreferWorkspaceBinding,
8
+ shouldRetainCheckSource,
9
+ } from "./cli";
4
10
 
5
11
  describe("shouldPreferWorkspaceBinding", () => {
6
12
  it("detects the local workspace native package", () => {
@@ -43,3 +49,41 @@ describe("sanitizeTerminalText", () => {
43
49
  expect(displayPath(unsafePath)).toBe("bad.vue");
44
50
  });
45
51
  });
52
+
53
+ describe("createBoundedFileBatches", () => {
54
+ it("splits batches by file count and total source bytes", () => {
55
+ const batches = createBoundedFileBatches(["a.vue", "b.vue", "c.vue", "d.vue"], {
56
+ maxFiles: 3,
57
+ maxBytes: 10,
58
+ sizeOf(file) {
59
+ return file === "c.vue" ? 9 : 4;
60
+ },
61
+ });
62
+
63
+ expect(batches).toEqual([["a.vue", "b.vue"], ["c.vue"], ["d.vue"]]);
64
+ });
65
+
66
+ it("keeps a single oversized file processable", () => {
67
+ const batches = createBoundedFileBatches(["huge.vue", "small.vue"], {
68
+ maxFiles: 4,
69
+ maxBytes: 10,
70
+ sizeOf(file) {
71
+ return file === "huge.vue" ? 100 : 1;
72
+ },
73
+ });
74
+
75
+ expect(batches).toEqual([["huge.vue"], ["small.vue"]]);
76
+ });
77
+ });
78
+
79
+ describe("shouldRetainCheckSource", () => {
80
+ it("drops source retention for JSON and quiet check output", () => {
81
+ expect(shouldRetainCheckSource({ format: "json" })).toBe(false);
82
+ expect(shouldRetainCheckSource({ quiet: true })).toBe(false);
83
+ });
84
+
85
+ it("keeps source retention when diagnostics or declarations need it", () => {
86
+ expect(shouldRetainCheckSource({})).toBe(true);
87
+ expect(shouldRetainCheckSource({ format: "json", declaration: true })).toBe(true);
88
+ });
89
+ });
package/src/cli.ts CHANGED
@@ -8,6 +8,7 @@ import { loadConfig } from "./config.js";
8
8
  const require = createRequire(import.meta.url);
9
9
  const WORKSPACE_BINDING_PATH = "../../vize-native";
10
10
  const BUILD_BATCH_SIZE = 128;
11
+ const BUILD_BATCH_MAX_BYTES = 32 * 1024 * 1024;
11
12
  const SKIPPED_VUE_FILE_DIRECTORIES = new Set([
12
13
  "node_modules",
13
14
  "dist",
@@ -518,6 +519,10 @@ async function runBuild(args: string[]): Promise<void> {
518
519
 
519
520
  const native = loadNative("build");
520
521
  const startedAt = performance.now();
522
+ const batches = createBoundedFileBatches(files, {
523
+ maxFiles: BUILD_BATCH_SIZE,
524
+ maxBytes: BUILD_BATCH_MAX_BYTES,
525
+ });
521
526
 
522
527
  if (options.format !== "stats") {
523
528
  mkdirSync(options.output, { recursive: true });
@@ -527,19 +532,22 @@ async function runBuild(args: string[]): Promise<void> {
527
532
  let failed = 0;
528
533
  let success = 0;
529
534
 
530
- for (let start = 0; start < files.length; start += BUILD_BATCH_SIZE) {
531
- const inputs = files.slice(start, start + BUILD_BATCH_SIZE).map((file) => ({
532
- path: file,
533
- source: readFileSync(file, "utf8"),
534
- }));
535
- const sourceByPath = new Map(inputs.map((input) => [input.path, input.source]));
535
+ for (const batch of batches) {
536
+ const inputs: { path: string; source: string }[] = [];
537
+ const extensionByPath = new Map<string, string>();
538
+ for (const file of batch) {
539
+ const source = readFileSync(file, "utf8");
540
+ extensionByPath.set(file, getOutputExtension(source, options.scriptExt));
541
+ inputs.push({ path: file, source });
542
+ }
543
+
536
544
  const chunkStartedAt = performance.now();
537
545
  const result = native.compileSfcBatchWithResults(inputs, toNativeBuildOptions(options));
546
+ inputs.length = 0;
538
547
  nativeTimeMs += result.timeMs ?? result.time_ms ?? performance.now() - chunkStartedAt;
539
- const results = [...result.results].sort((left, right) => left.path.localeCompare(right.path));
548
+ const results = result.results.sort((left, right) => left.path.localeCompare(right.path));
540
549
 
541
550
  for (const fileResult of results) {
542
- const source = sourceByPath.get(fileResult.path) ?? "";
543
551
  for (const warning of fileResult.warnings) {
544
552
  process.stderr.write(
545
553
  `warning: ${displayPath(fileResult.path)} ${sanitizeTerminalText(warning)}\n`,
@@ -556,7 +564,7 @@ async function runBuild(args: string[]): Promise<void> {
556
564
  }
557
565
 
558
566
  const extension =
559
- options.format === "json" ? "json" : getOutputExtension(source, options.scriptExt);
567
+ options.format === "json" ? "json" : (extensionByPath.get(fileResult.path) ?? "js");
560
568
  const outputPath = path.join(options.output, outputFileName(fileResult.path, extension));
561
569
  const content =
562
570
  options.format === "json" ? JSON.stringify(fileResult, null, 2) : fileResult.code;
@@ -845,12 +853,6 @@ interface ParsedCheckCommand {
845
853
  sharedConfig: SharedConfigOptions;
846
854
  }
847
855
 
848
- interface CheckedFileResult {
849
- file: string;
850
- source: string;
851
- result: TypeCheckResult;
852
- }
853
-
854
856
  interface EmittedDeclaration {
855
857
  file: string;
856
858
  path: string;
@@ -923,6 +925,14 @@ function parseCheckCommand(args: string[]): ParsedCheckCommand {
923
925
  return { patterns, options, sharedConfig };
924
926
  }
925
927
 
928
+ export function shouldRetainCheckSource(options: {
929
+ declaration?: boolean;
930
+ format?: string;
931
+ quiet?: boolean;
932
+ }): boolean {
933
+ return Boolean(options.declaration || (options.format !== "json" && !options.quiet));
934
+ }
935
+
926
936
  function hasGlobSyntax(pattern: string): boolean {
927
937
  return pattern.includes("*") || pattern.includes("?") || pattern.includes("[");
928
938
  }
@@ -1006,8 +1016,11 @@ function isVueFile(filePath: string): boolean {
1006
1016
  return path.extname(filePath) === ".vue";
1007
1017
  }
1008
1018
 
1009
- function collectVueFilesFromDirectory(directory: string, recursive: boolean): string[] {
1010
- const files: string[] = [];
1019
+ function collectVueFilesFromDirectory(
1020
+ directory: string,
1021
+ recursive: boolean,
1022
+ files: string[] = [],
1023
+ ): string[] {
1011
1024
  const entries = readdirSync(directory, { withFileTypes: true });
1012
1025
 
1013
1026
  for (const entry of entries) {
@@ -1017,7 +1030,7 @@ function collectVueFilesFromDirectory(directory: string, recursive: boolean): st
1017
1030
  continue;
1018
1031
  }
1019
1032
  if (recursive) {
1020
- files.push(...collectVueFilesFromDirectory(entryPath, true));
1033
+ collectVueFilesFromDirectory(entryPath, true, files);
1021
1034
  }
1022
1035
  } else if (entry.isFile() && isVueFile(entryPath)) {
1023
1036
  files.push(entryPath);
@@ -1131,11 +1144,55 @@ function collectVueFiles(patterns: string[]): string[] {
1131
1144
  return Array.from(files).sort();
1132
1145
  }
1133
1146
 
1134
- function commonSourceDirectory(results: CheckedFileResult[]): string {
1135
- let common = path.dirname(results[0]?.file ?? process.cwd());
1147
+ interface BoundedFileBatchOptions {
1148
+ maxFiles: number;
1149
+ maxBytes: number;
1150
+ sizeOf?: (file: string) => number;
1151
+ }
1152
+
1153
+ function statFileSize(file: string): number {
1154
+ try {
1155
+ return statSync(file).size;
1156
+ } catch {
1157
+ return 0;
1158
+ }
1159
+ }
1160
+
1161
+ export function createBoundedFileBatches(
1162
+ files: readonly string[],
1163
+ options: BoundedFileBatchOptions,
1164
+ ): string[][] {
1165
+ const maxFiles = Math.max(1, Math.floor(options.maxFiles));
1166
+ const maxBytes = Math.max(1, Math.floor(options.maxBytes));
1167
+ const sizeOf = options.sizeOf ?? statFileSize;
1168
+ const batches: string[][] = [];
1169
+ let current: string[] = [];
1170
+ let currentBytes = 0;
1171
+
1172
+ for (const file of files) {
1173
+ const fileBytes = Math.max(0, sizeOf(file));
1174
+ if (current.length > 0 && (current.length >= maxFiles || currentBytes + fileBytes > maxBytes)) {
1175
+ batches.push(current);
1176
+ current = [];
1177
+ currentBytes = 0;
1178
+ }
1179
+
1180
+ current.push(file);
1181
+ currentBytes += fileBytes;
1182
+ }
1183
+
1184
+ if (current.length > 0) {
1185
+ batches.push(current);
1186
+ }
1136
1187
 
1137
- for (let i = 1; i < results.length; i++) {
1138
- const directory = path.dirname(results[i].file);
1188
+ return batches;
1189
+ }
1190
+
1191
+ function commonSourceDirectory(files: readonly string[]): string {
1192
+ let common = path.dirname(files[0] ?? process.cwd());
1193
+
1194
+ for (let i = 1; i < files.length; i++) {
1195
+ const directory = path.dirname(files[i]!);
1139
1196
  while (common !== path.dirname(common)) {
1140
1197
  const relative = path.relative(common, directory);
1141
1198
  if (relative !== ".." && !relative.startsWith(`..${path.sep}`)) {
@@ -1148,37 +1205,25 @@ function commonSourceDirectory(results: CheckedFileResult[]): string {
1148
1205
  return common;
1149
1206
  }
1150
1207
 
1151
- function emitCheckDeclarations(
1152
- results: CheckedFileResult[],
1208
+ function emitCheckDeclaration(
1209
+ file: string,
1210
+ source: string,
1211
+ sourceRoot: string,
1153
1212
  native: NativeBinding,
1154
1213
  options: CheckOptions,
1155
- ): EmittedDeclaration[] {
1156
- if (!options.declaration) {
1157
- return [];
1158
- }
1159
-
1160
- if (typeof native.generateDeclaration !== "function") {
1161
- throw new Error("The loaded native binding does not support declaration generation.");
1162
- }
1163
-
1214
+ ): EmittedDeclaration {
1164
1215
  const outDir = path.resolve(process.cwd(), options.declarationDir ?? "dist/types");
1165
- const sourceRoot = commonSourceDirectory(results);
1166
- const declarations: EmittedDeclaration[] = [];
1216
+ const relative = normalizePath(path.relative(sourceRoot, file));
1217
+ const outputPath = path.join(outDir, `${relative}.d.ts`);
1218
+ mkdirSync(path.dirname(outputPath), { recursive: true });
1167
1219
 
1168
- for (const { file, source } of results) {
1169
- const relative = normalizePath(path.relative(sourceRoot, file));
1170
- const outputPath = path.join(outDir, `${relative}.d.ts`);
1171
- mkdirSync(path.dirname(outputPath), { recursive: true });
1220
+ const declaration = native.generateDeclaration!(source, { filename: file });
1221
+ writeFileSync(outputPath, declaration.code);
1172
1222
 
1173
- const declaration = native.generateDeclaration(source, { filename: file });
1174
- writeFileSync(outputPath, declaration.code);
1175
- declarations.push({
1176
- file: displayPath(outputPath),
1177
- path: outputPath,
1178
- });
1179
- }
1180
-
1181
- return declarations;
1223
+ return {
1224
+ file: displayPath(outputPath),
1225
+ path: outputPath,
1226
+ };
1182
1227
  }
1183
1228
 
1184
1229
  function lineStarts(source: string): number[] {
@@ -1233,47 +1278,47 @@ function toNativeTypeCheckOptions(file: string, options: CheckOptions): NativeTy
1233
1278
  };
1234
1279
  }
1235
1280
 
1236
- function renderCheckText(
1237
- results: CheckedFileResult[],
1281
+ function renderCheckFileText(
1282
+ file: string,
1283
+ source: string,
1284
+ result: TypeCheckResult,
1238
1285
  options: CheckOptions,
1239
- timeMs: number,
1240
- declarations: EmittedDeclaration[] = [],
1241
1286
  ): void {
1242
- let totalErrors = 0;
1243
- let totalWarnings = 0;
1244
-
1245
- for (const { file, source, result } of results) {
1246
- totalErrors += result.errorCount;
1247
- totalWarnings += result.warningCount;
1248
-
1249
- if (options.includeVirtualTs && result.virtualTs) {
1250
- process.stderr.write(
1251
- `\n=== ${displayPath(file)} ===\n${sanitizeTerminalText(result.virtualTs)}\n`,
1252
- );
1253
- }
1287
+ if (options.includeVirtualTs && result.virtualTs) {
1288
+ process.stderr.write(
1289
+ `\n=== ${displayPath(file)} ===\n${sanitizeTerminalText(result.virtualTs)}\n`,
1290
+ );
1291
+ }
1254
1292
 
1255
- if (options.quiet || result.diagnostics.length === 0) {
1256
- continue;
1257
- }
1293
+ if (options.quiet || result.diagnostics.length === 0) {
1294
+ return;
1295
+ }
1258
1296
 
1259
- const starts = lineStarts(source);
1260
- process.stdout.write(`\n\x1b[4m${displayPath(file)}\x1b[0m\n`);
1261
- for (const diagnostic of result.diagnostics) {
1262
- const color = diagnostic.severity === "error" ? "\x1b[31m" : "\x1b[33m";
1263
- const location = offsetToLineColumn(starts, diagnostic.start);
1264
- const code = diagnostic.code ? ` [${sanitizeTerminalText(diagnostic.code)}]` : "";
1265
- process.stdout.write(
1266
- ` ${color}${diagnostic.severity}:${location.line}:${location.column}\x1b[0m${code} ${sanitizeTerminalText(diagnostic.message)}\n`,
1267
- );
1268
- if (diagnostic.help) {
1269
- process.stdout.write(` help: ${sanitizeTerminalText(diagnostic.help)}\n`);
1270
- }
1297
+ const starts = lineStarts(source);
1298
+ process.stdout.write(`\n\x1b[4m${displayPath(file)}\x1b[0m\n`);
1299
+ for (const diagnostic of result.diagnostics) {
1300
+ const color = diagnostic.severity === "error" ? "\x1b[31m" : "\x1b[33m";
1301
+ const location = offsetToLineColumn(starts, diagnostic.start);
1302
+ const code = diagnostic.code ? ` [${sanitizeTerminalText(diagnostic.code)}]` : "";
1303
+ process.stdout.write(
1304
+ ` ${color}${diagnostic.severity}:${location.line}:${location.column}\x1b[0m${code} ${sanitizeTerminalText(diagnostic.message)}\n`,
1305
+ );
1306
+ if (diagnostic.help) {
1307
+ process.stdout.write(` help: ${sanitizeTerminalText(diagnostic.help)}\n`);
1271
1308
  }
1272
1309
  }
1310
+ }
1273
1311
 
1312
+ function renderCheckSummary(
1313
+ totalErrors: number,
1314
+ totalWarnings: number,
1315
+ fileCount: number,
1316
+ timeMs: number,
1317
+ declarations: readonly EmittedDeclaration[],
1318
+ ): void {
1274
1319
  const status = totalErrors > 0 ? "\x1b[31mERR\x1b[0m" : "\x1b[32mOK\x1b[0m";
1275
1320
  process.stdout.write(
1276
- `\n${status} Type checked ${results.length} Vue files in ${timeMs.toFixed(2)}ms\n`,
1321
+ `\n${status} Type checked ${fileCount} Vue files in ${timeMs.toFixed(2)}ms\n`,
1277
1322
  );
1278
1323
  if (totalErrors > 0) {
1279
1324
  process.stdout.write(` \x1b[31m${totalErrors} error(s)\x1b[0m\n`);
@@ -1288,6 +1333,49 @@ function renderCheckText(
1288
1333
  }
1289
1334
  }
1290
1335
 
1336
+ function indentJson(value: unknown, spaces: number): string {
1337
+ const padding = " ".repeat(spaces);
1338
+ return JSON.stringify(value, null, 2)
1339
+ .split("\n")
1340
+ .map((line) => `${padding}${line}`)
1341
+ .join("\n");
1342
+ }
1343
+
1344
+ function writeCheckJsonFile(index: number, file: string, result: TypeCheckResult): void {
1345
+ if (index > 0) {
1346
+ process.stdout.write(",\n");
1347
+ }
1348
+ process.stdout.write(
1349
+ indentJson(
1350
+ {
1351
+ file: displayPath(file),
1352
+ diagnostics: result.diagnostics,
1353
+ virtualTs: result.virtualTs,
1354
+ },
1355
+ 4,
1356
+ ),
1357
+ );
1358
+ }
1359
+
1360
+ function writeCheckJsonEnd(
1361
+ totalErrors: number,
1362
+ totalWarnings: number,
1363
+ fileCount: number,
1364
+ declarations: readonly EmittedDeclaration[],
1365
+ ): void {
1366
+ process.stdout.write("\n ],\n");
1367
+ process.stdout.write(` "errorCount": ${totalErrors},\n`);
1368
+ process.stdout.write(` "warningCount": ${totalWarnings},\n`);
1369
+ process.stdout.write(` "fileCount": ${fileCount},\n`);
1370
+ process.stdout.write(
1371
+ ` "declarations": ${indentJson(
1372
+ declarations.map(({ file }) => file),
1373
+ 2,
1374
+ ).trimStart()}\n`,
1375
+ );
1376
+ process.stdout.write("}\n");
1377
+ }
1378
+
1291
1379
  async function runCheck(args: string[]): Promise<void> {
1292
1380
  const { patterns, options, sharedConfig } = parseCheckCommand(args);
1293
1381
  if (options.help) {
@@ -1329,40 +1417,46 @@ async function runCheck(args: string[]): Promise<void> {
1329
1417
  }
1330
1418
 
1331
1419
  const native = loadNative("check");
1332
- const start = performance.now();
1333
- const results = files.map((file) => {
1420
+ if (options.declaration && typeof native.generateDeclaration !== "function") {
1421
+ throw new Error("The loaded native binding does not support declaration generation.");
1422
+ }
1423
+
1424
+ const sourceRoot = options.declaration ? commonSourceDirectory(files) : "";
1425
+ const checkStartedAt = performance.now();
1426
+ const retainSource = shouldRetainCheckSource(options);
1427
+ const declarations: EmittedDeclaration[] = [];
1428
+ let totalErrors = 0;
1429
+ let totalWarnings = 0;
1430
+ let checkedCount = 0;
1431
+
1432
+ if (options.format === "json") {
1433
+ process.stdout.write('{\n "files": [\n');
1434
+ }
1435
+
1436
+ for (const file of files) {
1334
1437
  const source = readFileSync(file, "utf8");
1335
- return {
1336
- file,
1337
- source,
1338
- result: native.typeCheck(source, toNativeTypeCheckOptions(file, options)),
1339
- };
1340
- });
1341
- const timeMs = performance.now() - start;
1342
- const declarations = emitCheckDeclarations(results, native, options);
1343
- const totalErrors = results.reduce((sum, { result }) => sum + result.errorCount, 0);
1344
- const totalWarnings = results.reduce((sum, { result }) => sum + result.warningCount, 0);
1438
+ const result = native.typeCheck(source, toNativeTypeCheckOptions(file, options));
1439
+ totalErrors += result.errorCount;
1440
+ totalWarnings += result.warningCount;
1441
+ checkedCount++;
1442
+
1443
+ if (options.declaration) {
1444
+ declarations.push(emitCheckDeclaration(file, source, sourceRoot, native, options));
1445
+ }
1446
+
1447
+ if (options.format === "json") {
1448
+ writeCheckJsonFile(checkedCount - 1, file, result);
1449
+ } else {
1450
+ renderCheckFileText(file, retainSource ? source : "", result, options);
1451
+ }
1452
+ }
1453
+
1454
+ const timeMs = performance.now() - checkStartedAt;
1345
1455
 
1346
1456
  if (options.format === "json") {
1347
- process.stdout.write(
1348
- `${JSON.stringify(
1349
- {
1350
- files: results.map(({ file, result }) => ({
1351
- file: displayPath(file),
1352
- diagnostics: result.diagnostics,
1353
- virtualTs: result.virtualTs,
1354
- })),
1355
- errorCount: totalErrors,
1356
- warningCount: totalWarnings,
1357
- fileCount: results.length,
1358
- declarations: declarations.map(({ file }) => file),
1359
- },
1360
- null,
1361
- 2,
1362
- )}\n`,
1363
- );
1457
+ writeCheckJsonEnd(totalErrors, totalWarnings, checkedCount, declarations);
1364
1458
  } else {
1365
- renderCheckText(results, options, timeMs, declarations);
1459
+ renderCheckSummary(totalErrors, totalWarnings, checkedCount, timeMs, declarations);
1366
1460
  }
1367
1461
 
1368
1462
  if (totalErrors > 0) {