vize 0.41.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,13 +5,19 @@ High-performance Vue.js toolchain in Rust.
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- # Install from npm
8
+ # Install globally
9
9
  npm install -g vize
10
10
 
11
+ # Or add it to a project
12
+ npm install -D vize
13
+
11
14
  # Or install from GitHub
12
15
  npm install -g github:ubugeeei/vize
13
16
  ```
14
17
 
18
+ If you use `@vizejs/vite-plugin` and want one shared config for both the plugin and the `vize`
19
+ CLI, install both packages in the project and put your config in `vize.config.*`.
20
+
15
21
  ## Usage
16
22
 
17
23
  ```bash
@@ -32,6 +38,52 @@ vize --help # Show help
32
38
  vize <command> --help # Show command-specific help
33
39
  ```
34
40
 
41
+ ## Config
42
+
43
+ `vize` looks for these files in the project root:
44
+
45
+ - `vize.config.ts`
46
+ - `vize.config.js`
47
+ - `vize.config.mjs`
48
+ - `vize.config.pkl`
49
+ - `vize.config.json`
50
+
51
+ TypeScript config:
52
+
53
+ ```ts
54
+ import { defineConfig } from "vize";
55
+
56
+ export default defineConfig({
57
+ linter: {
58
+ preset: "opinionated",
59
+ },
60
+ });
61
+ ```
62
+
63
+ PKL config:
64
+
65
+ ```pkl
66
+ amends "node_modules/vize/pkl/vize.pkl"
67
+
68
+ linter {
69
+ preset = "opinionated"
70
+ }
71
+ ```
72
+
73
+ JSON config with schema:
74
+
75
+ ```json
76
+ {
77
+ "$schema": "./node_modules/vize/schemas/vize.config.schema.json",
78
+ "linter": {
79
+ "preset": "opinionated"
80
+ }
81
+ }
82
+ ```
83
+
84
+ The npm CLI currently applies shared config to the `lint` command. You can override discovery with
85
+ `vize lint --config path/to/vize.config.ts` or skip config loading with `vize lint --no-config`.
86
+
35
87
  ## Examples
36
88
 
37
89
  ```bash
package/bin/vize CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import "../dist/cli.js";
2
+ import "../dist/cli.mjs";
package/dist/cli.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { loadConfig } from "./config.mjs";
1
2
  import { createRequire } from "module";
2
3
  import { readFileSync } from "fs";
3
4
  //#region src/cli.ts
@@ -42,9 +43,10 @@ function loadNative() {
42
43
  throw e;
43
44
  }
44
45
  }
45
- function runLint(args) {
46
+ function parseLintCommand(args) {
46
47
  const patterns = [];
47
48
  const options = {};
49
+ const sharedConfig = { configMode: "root" };
48
50
  for (let i = 0; i < args.length; i++) {
49
51
  const arg = args[i];
50
52
  if (arg === "--format" || arg === "-f") options.format = args[++i];
@@ -53,8 +55,35 @@ function runLint(args) {
53
55
  else if (arg === "--fix") options.fix = true;
54
56
  else if (arg === "--help-level") options.helpLevel = args[++i];
55
57
  else if (arg === "--preset") options.preset = args[++i];
58
+ else if (arg === "--config" || arg === "-c") {
59
+ const configFile = args[++i];
60
+ if (!configFile) throw new Error("Missing path after --config");
61
+ sharedConfig.configFile = configFile;
62
+ } else if (arg === "--no-config") sharedConfig.configMode = "none";
56
63
  else if (!arg.startsWith("-")) patterns.push(arg);
57
64
  }
65
+ return {
66
+ patterns,
67
+ options,
68
+ sharedConfig
69
+ };
70
+ }
71
+ async function runLint(args) {
72
+ const { patterns, options, sharedConfig } = parseLintCommand(args);
73
+ const config = await loadConfig(process.cwd(), {
74
+ mode: sharedConfig.configMode,
75
+ configFile: sharedConfig.configFile,
76
+ env: {
77
+ mode: process.env.NODE_ENV ?? "development",
78
+ command: "lint"
79
+ }
80
+ });
81
+ if (sharedConfig.configFile && !config) throw new Error(`Could not find config file: ${sharedConfig.configFile}`);
82
+ if (config?.linter?.enabled === false) {
83
+ process.stderr.write("[vize] Skipping lint because linter.enabled is false in vize.config.\n");
84
+ return;
85
+ }
86
+ options.preset ??= config?.linter?.preset;
58
87
  if (patterns.length === 0) patterns.push(".");
59
88
  const result = loadNative().lint(patterns, {
60
89
  format: options.format,
@@ -76,7 +105,7 @@ function runLint(args) {
76
105
  }
77
106
  }
78
107
  const NAPI_COMMANDS = new Set(["lint"]);
79
- function main() {
108
+ async function main() {
80
109
  const args = process.argv.slice(2);
81
110
  const command = args[0];
82
111
  if (!command) {
@@ -88,7 +117,7 @@ function main() {
88
117
  const commandArgs = args.slice(1);
89
118
  switch (command) {
90
119
  case "lint":
91
- runLint(commandArgs);
120
+ await runLint(commandArgs);
92
121
  break;
93
122
  }
94
123
  } else {
@@ -97,7 +126,10 @@ function main() {
97
126
  process.exit(1);
98
127
  }
99
128
  }
100
- main();
129
+ main().catch((error) => {
130
+ console.error(error instanceof Error ? error.message : String(error));
131
+ process.exit(1);
132
+ });
101
133
  //#endregion
102
134
  export {};
103
135
 
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["import { createRequire } from \"module\";\nimport { readFileSync } from \"fs\";\n\nconst require = createRequire(import.meta.url);\n\n// ============================================================================\n// Native binding loader (oxlint pattern)\n// ============================================================================\n\nfunction isMusl(): boolean {\n const report = process.report?.getReport();\n if (typeof report === \"object\" && report !== null && \"header\" in report) {\n const header = (report as { header: { glibcVersionRuntime?: string } }).header;\n return !header.glibcVersionRuntime;\n }\n try {\n const lddPath = require(\"child_process\").execSync(\"which ldd\").toString().trim();\n return readFileSync(lddPath, \"utf8\").includes(\"musl\");\n } catch {\n return true;\n }\n}\n\nfunction getBindingPackageName(): string {\n const { platform, arch } = process;\n\n switch (platform) {\n case \"darwin\":\n switch (arch) {\n case \"x64\":\n return \"@vizejs/native-darwin-x64\";\n case \"arm64\":\n return \"@vizejs/native-darwin-arm64\";\n default:\n throw new Error(`Unsupported architecture on macOS: ${arch}`);\n }\n case \"win32\":\n switch (arch) {\n case \"x64\":\n return \"@vizejs/native-win32-x64-msvc\";\n case \"arm64\":\n return \"@vizejs/native-win32-arm64-msvc\";\n default:\n throw new Error(`Unsupported architecture on Windows: ${arch}`);\n }\n case \"linux\":\n switch (arch) {\n case \"x64\":\n return isMusl() ? \"@vizejs/native-linux-x64-musl\" : \"@vizejs/native-linux-x64-gnu\";\n case \"arm64\":\n return isMusl() ? \"@vizejs/native-linux-arm64-musl\" : \"@vizejs/native-linux-arm64-gnu\";\n default:\n throw new Error(`Unsupported architecture on Linux: ${arch}`);\n }\n default:\n throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);\n }\n}\n\ninterface NativeBinding {\n lint: (\n patterns: string[],\n options?: {\n format?: string;\n max_warnings?: number;\n quiet?: boolean;\n fix?: boolean;\n help_level?: string;\n preset?: string;\n },\n ) => LintResult;\n}\n\nfunction loadNative(): NativeBinding {\n const pkg = getBindingPackageName();\n try {\n return require(pkg);\n } catch (e) {\n console.error(`Failed to load native binding: ${pkg}`);\n console.error(\"Try reinstalling: npm install vize\");\n throw e;\n }\n}\n\n// ============================================================================\n// Lint command\n// ============================================================================\n\ninterface LintOptions {\n format?: string;\n maxWarnings?: number;\n quiet?: boolean;\n fix?: boolean;\n helpLevel?: string;\n preset?: string;\n}\n\ninterface LintResult {\n output: string;\n errorCount: number;\n warningCount: number;\n fileCount: number;\n timeMs: number;\n}\n\nfunction runLint(args: string[]): void {\n const patterns: string[] = [];\n const options: LintOptions = {};\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === \"--format\" || arg === \"-f\") {\n options.format = args[++i];\n } else if (arg === \"--max-warnings\") {\n options.maxWarnings = Number.parseInt(args[++i], 10);\n } else if (arg === \"--quiet\" || arg === \"-q\") {\n options.quiet = true;\n } else if (arg === \"--fix\") {\n options.fix = true;\n } else if (arg === \"--help-level\") {\n options.helpLevel = args[++i];\n } else if (arg === \"--preset\") {\n options.preset = args[++i];\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n if (patterns.length === 0) {\n patterns.push(\".\");\n }\n\n const native = loadNative();\n const result = native.lint(patterns, {\n format: options.format,\n max_warnings: options.maxWarnings,\n quiet: options.quiet,\n fix: options.fix,\n help_level: options.helpLevel,\n preset: options.preset,\n });\n\n if (result.output) {\n process.stdout.write(result.output);\n if (!result.output.endsWith(\"\\n\")) {\n process.stdout.write(\"\\n\");\n }\n }\n\n if (options.fix) {\n process.stderr.write(\"\\nNote: --fix is not yet implemented\\n\");\n }\n\n if (result.errorCount > 0) {\n process.exit(1);\n }\n\n if (options.maxWarnings !== undefined && result.warningCount > options.maxWarnings) {\n process.stderr.write(\n `\\nToo many warnings (${result.warningCount} > max ${options.maxWarnings})\\n`,\n );\n process.exit(1);\n }\n}\n\n// ============================================================================\n// Command router\n// ============================================================================\n\nconst NAPI_COMMANDS = new Set([\"lint\"]);\n\nfunction main(): void {\n const args = process.argv.slice(2);\n const command = args[0];\n\n if (!command) {\n console.error(\"Usage: vize <command> [options]\");\n console.error(\"Commands: lint\");\n process.exit(1);\n }\n\n if (NAPI_COMMANDS.has(command)) {\n const commandArgs = args.slice(1);\n switch (command) {\n case \"lint\":\n runLint(commandArgs);\n break;\n }\n } else {\n console.error(`Unknown command: ${command}`);\n console.error(\n \"For commands not yet available via NAPI, install from source: cargo install vize\",\n );\n process.exit(1);\n }\n}\n\nmain();\n"],"mappings":";;;AAGA,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAM9C,SAAS,SAAkB;CACzB,MAAM,SAAS,QAAQ,QAAQ,WAAW;AAC1C,KAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,YAAY,OAE/D,QAAO,CADS,OAAwD,OACzD;AAEjB,KAAI;AAEF,SAAO,aADS,QAAQ,gBAAgB,CAAC,SAAS,YAAY,CAAC,UAAU,CAAC,MAAM,EACnD,OAAO,CAAC,SAAS,OAAO;SAC/C;AACN,SAAO;;;AAIX,SAAS,wBAAgC;CACvC,MAAM,EAAE,UAAU,SAAS;AAE3B,SAAQ,UAAR;EACE,KAAK,SACH,SAAQ,MAAR;GACE,KAAK,MACH,QAAO;GACT,KAAK,QACH,QAAO;GACT,QACE,OAAM,IAAI,MAAM,sCAAsC,OAAO;;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EACjB,CAAC;AAEF,KAAI,OAAO,QAAQ;AACjB,UAAQ,OAAO,MAAM,OAAO,OAAO;AACnC,MAAI,CAAC,OAAO,OAAO,SAAS,KAAK,CAC/B,SAAQ,OAAO,MAAM,KAAK;;AAI9B,KAAI,QAAQ,IACV,SAAQ,OAAO,MAAM,yCAAyC;AAGhE,KAAI,OAAO,aAAa,EACtB,SAAQ,KAAK,EAAE;AAGjB,KAAI,QAAQ,gBAAgB,KAAA,KAAa,OAAO,eAAe,QAAQ,aAAa;AAClF,UAAQ,OAAO,MACb,wBAAwB,OAAO,aAAa,SAAS,QAAQ,YAAY,KAC1E;AACD,UAAQ,KAAK,EAAE;;;AAQnB,MAAM,gBAAgB,IAAI,IAAI,CAAC,OAAO,CAAC;AAEvC,SAAS,OAAa;CACpB,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;CAClC,MAAM,UAAU,KAAK;AAErB,KAAI,CAAC,SAAS;AACZ,UAAQ,MAAM,kCAAkC;AAChD,UAAQ,MAAM,iBAAiB;AAC/B,UAAQ,KAAK,EAAE;;AAGjB,KAAI,cAAc,IAAI,QAAQ,EAAE;EAC9B,MAAM,cAAc,KAAK,MAAM,EAAE;AACjC,UAAQ,SAAR;GACE,KAAK;AACH,YAAQ,YAAY;AACpB;;QAEC;AACL,UAAQ,MAAM,oBAAoB,UAAU;AAC5C,UAAQ,MACN,mFACD;AACD,UAAQ,KAAK,EAAE;;;AAInB,MAAM"}
1
+ {"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["import { createRequire } from \"module\";\nimport { readFileSync } from \"fs\";\nimport { loadConfig } from \"./config.js\";\n\nconst require = createRequire(import.meta.url);\n\n// ============================================================================\n// Native binding loader (oxlint pattern)\n// ============================================================================\n\nfunction isMusl(): boolean {\n const report = process.report?.getReport();\n if (typeof report === \"object\" && report !== null && \"header\" in report) {\n const header = (report as { header: { glibcVersionRuntime?: string } }).header;\n return !header.glibcVersionRuntime;\n }\n try {\n const lddPath = require(\"child_process\").execSync(\"which ldd\").toString().trim();\n return readFileSync(lddPath, \"utf8\").includes(\"musl\");\n } catch {\n return true;\n }\n}\n\nfunction getBindingPackageName(): string {\n const { platform, arch } = process;\n\n switch (platform) {\n case \"darwin\":\n switch (arch) {\n case \"x64\":\n return \"@vizejs/native-darwin-x64\";\n case \"arm64\":\n return \"@vizejs/native-darwin-arm64\";\n default:\n throw new Error(`Unsupported architecture on macOS: ${arch}`);\n }\n case \"win32\":\n switch (arch) {\n case \"x64\":\n return \"@vizejs/native-win32-x64-msvc\";\n case \"arm64\":\n return \"@vizejs/native-win32-arm64-msvc\";\n default:\n throw new Error(`Unsupported architecture on Windows: ${arch}`);\n }\n case \"linux\":\n switch (arch) {\n case \"x64\":\n return isMusl() ? \"@vizejs/native-linux-x64-musl\" : \"@vizejs/native-linux-x64-gnu\";\n case \"arm64\":\n return isMusl() ? \"@vizejs/native-linux-arm64-musl\" : \"@vizejs/native-linux-arm64-gnu\";\n default:\n throw new Error(`Unsupported architecture on Linux: ${arch}`);\n }\n default:\n throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);\n }\n}\n\ninterface NativeBinding {\n lint: (\n patterns: string[],\n options?: {\n format?: string;\n max_warnings?: number;\n quiet?: boolean;\n fix?: boolean;\n help_level?: string;\n preset?: string;\n },\n ) => LintResult;\n}\n\nfunction loadNative(): NativeBinding {\n const pkg = getBindingPackageName();\n try {\n return require(pkg);\n } catch (e) {\n console.error(`Failed to load native binding: ${pkg}`);\n console.error(\"Try reinstalling: npm install vize\");\n throw e;\n }\n}\n\n// ============================================================================\n// Lint command\n// ============================================================================\n\ninterface LintOptions {\n format?: string;\n maxWarnings?: number;\n quiet?: boolean;\n fix?: boolean;\n helpLevel?: string;\n preset?: string;\n}\n\ninterface LintResult {\n output: string;\n errorCount: number;\n warningCount: number;\n fileCount: number;\n timeMs: number;\n}\n\ninterface SharedConfigOptions {\n configFile?: string;\n configMode: \"root\" | \"none\";\n}\n\ninterface ParsedLintCommand {\n patterns: string[];\n options: LintOptions;\n sharedConfig: SharedConfigOptions;\n}\n\nfunction parseLintCommand(args: string[]): ParsedLintCommand {\n const patterns: string[] = [];\n const options: LintOptions = {};\n const sharedConfig: SharedConfigOptions = {\n configMode: \"root\",\n };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === \"--format\" || arg === \"-f\") {\n options.format = args[++i];\n } else if (arg === \"--max-warnings\") {\n options.maxWarnings = Number.parseInt(args[++i], 10);\n } else if (arg === \"--quiet\" || arg === \"-q\") {\n options.quiet = true;\n } else if (arg === \"--fix\") {\n options.fix = true;\n } else if (arg === \"--help-level\") {\n options.helpLevel = args[++i];\n } else if (arg === \"--preset\") {\n options.preset = args[++i];\n } else if (arg === \"--config\" || arg === \"-c\") {\n const configFile = args[++i];\n if (!configFile) {\n throw new Error(\"Missing path after --config\");\n }\n sharedConfig.configFile = configFile;\n } else if (arg === \"--no-config\") {\n sharedConfig.configMode = \"none\";\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n return { patterns, options, sharedConfig };\n}\n\nasync function runLint(args: string[]): Promise<void> {\n const { patterns, options, sharedConfig } = parseLintCommand(args);\n const config = await loadConfig(process.cwd(), {\n mode: sharedConfig.configMode,\n configFile: sharedConfig.configFile,\n env: {\n mode: process.env.NODE_ENV ?? \"development\",\n command: \"lint\",\n },\n });\n\n if (sharedConfig.configFile && !config) {\n throw new Error(`Could not find config file: ${sharedConfig.configFile}`);\n }\n\n if (config?.linter?.enabled === false) {\n process.stderr.write(\"[vize] Skipping lint because linter.enabled is false in vize.config.\\n\");\n return;\n }\n\n options.preset ??= config?.linter?.preset;\n\n if (patterns.length === 0) {\n patterns.push(\".\");\n }\n\n const native = loadNative();\n const result = native.lint(patterns, {\n format: options.format,\n max_warnings: options.maxWarnings,\n quiet: options.quiet,\n fix: options.fix,\n help_level: options.helpLevel,\n preset: options.preset,\n });\n\n if (result.output) {\n process.stdout.write(result.output);\n if (!result.output.endsWith(\"\\n\")) {\n process.stdout.write(\"\\n\");\n }\n }\n\n if (options.fix) {\n process.stderr.write(\"\\nNote: --fix is not yet implemented\\n\");\n }\n\n if (result.errorCount > 0) {\n process.exit(1);\n }\n\n if (options.maxWarnings !== undefined && result.warningCount > options.maxWarnings) {\n process.stderr.write(\n `\\nToo many warnings (${result.warningCount} > max ${options.maxWarnings})\\n`,\n );\n process.exit(1);\n }\n}\n\n// ============================================================================\n// Command router\n// ============================================================================\n\nconst NAPI_COMMANDS = new Set([\"lint\"]);\n\nasync function main(): Promise<void> {\n const args = process.argv.slice(2);\n const command = args[0];\n\n if (!command) {\n console.error(\"Usage: vize <command> [options]\");\n console.error(\"Commands: lint\");\n process.exit(1);\n }\n\n if (NAPI_COMMANDS.has(command)) {\n const commandArgs = args.slice(1);\n switch (command) {\n case \"lint\":\n await runLint(commandArgs);\n break;\n }\n } else {\n console.error(`Unknown command: ${command}`);\n console.error(\n \"For commands not yet available via NAPI, install from source: cargo install vize\",\n );\n process.exit(1);\n }\n}\n\nvoid main().catch((error) => {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n});\n"],"mappings":";;;;AAIA,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAM9C,SAAS,SAAkB;CACzB,MAAM,SAAS,QAAQ,QAAQ,WAAW;AAC1C,KAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,YAAY,OAE/D,QAAO,CADS,OAAwD,OACzD;AAEjB,KAAI;AAEF,SAAO,aADS,QAAQ,gBAAgB,CAAC,SAAS,YAAY,CAAC,UAAU,CAAC,MAAM,EACnD,OAAO,CAAC,SAAS,OAAO;SAC/C;AACN,SAAO;;;AAIX,SAAS,wBAAgC;CACvC,MAAM,EAAE,UAAU,SAAS;AAE3B,SAAQ,UAAR;EACE,KAAK,SACH,SAAQ,MAAR;GACE,KAAK,MACH,QAAO;GACT,KAAK,QACH,QAAO;GACT,QACE,OAAM,IAAI,MAAM,sCAAsC,OAAO;;EAEnE,KAAK,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,SAAS;AACZ,UAAQ,MAAM,kCAAkC;AAChD,UAAQ,MAAM,iBAAiB;AAC/B,UAAQ,KAAK,EAAE;;AAGjB,KAAI,cAAc,IAAI,QAAQ,EAAE;EAC9B,MAAM,cAAc,KAAK,MAAM,EAAE;AACjC,UAAQ,SAAR;GACE,KAAK;AACH,UAAM,QAAQ,YAAY;AAC1B;;QAEC;AACL,UAAQ,MAAM,oBAAoB,UAAU;AAC5C,UAAQ,MACN,mFACD;AACD,UAAQ,KAAK,EAAE;;;AAId,MAAM,CAAC,OAAO,UAAU;AAC3B,SAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;AACrE,SAAQ,KAAK,EAAE;EACf"}
@@ -379,6 +379,10 @@ type LintPreset = "happy-path" | "opinionated" | "essential" | "nuxt";
379
379
  * Vize configuration options
380
380
  */
381
381
  interface VizeConfig {
382
+ /**
383
+ * JSON Schema reference for editor autocompletion.
384
+ */
385
+ $schema?: string;
382
386
  /**
383
387
  * Vue compiler options
384
388
  */
@@ -414,13 +418,16 @@ interface VizeConfig {
414
418
  }
415
419
  //#endregion
416
420
  //#region src/config.d.ts
421
+ declare const CONFIG_FILE_NAMES: readonly ["vize.config.ts", "vize.config.js", "vize.config.mjs", "vize.config.pkl", "vize.config.json"];
422
+ declare const VIZE_CONFIG_JSON_SCHEMA_PATH: string;
423
+ declare const VIZE_CONFIG_PKL_SCHEMA_PATH: string;
417
424
  /**
418
425
  * Define a Vize configuration with type checking.
419
426
  * Accepts a plain object or a function that receives ConfigEnv.
420
427
  */
421
428
  declare function defineConfig(config: UserConfigExport): UserConfigExport;
422
429
  /**
423
- * Load vize.config file from the specified directory
430
+ * Load `vize.config.*` from the specified directory.
424
431
  */
425
432
  declare function loadConfig(root: string, options?: LoadConfigOptions): Promise<VizeConfig | null>;
426
433
  /**
@@ -428,5 +435,5 @@ declare function loadConfig(root: string, options?: LoadConfigOptions): Promise<
428
435
  */
429
436
  declare function normalizeGlobalTypes(config: GlobalTypesConfig): Record<string, GlobalTypeDeclaration>;
430
437
  //#endregion
431
- export { VitePluginConfig as C, CompilerConfig as S, MuseaVrtConfig as _, LintPreset as a, LspConfig as b, RuleSeverity as c, GlobalTypeDeclaration as d, GlobalTypesConfig as f, MuseaConfig as g, MuseaAutogenConfig as h, ConfigEnv as i, UserConfigExport as l, MuseaA11yConfig as m, loadConfig as n, MaybePromise as o, LoadConfigOptions as p, normalizeGlobalTypes as r, RuleCategory as s, defineConfig as t, VizeConfig as u, FormatterConfig as v, TypeCheckerConfig as x, LinterConfig as y };
432
- //# sourceMappingURL=config-DA4uu8ja.d.mts.map
438
+ export { LspConfig as C, VitePluginConfig as E, LinterConfig as S, CompilerConfig as T, MuseaA11yConfig as _, loadConfig as a, MuseaVrtConfig as b, LintPreset as c, RuleSeverity as d, UserConfigExport as f, LoadConfigOptions as g, GlobalTypesConfig as h, defineConfig as i, MaybePromise as l, GlobalTypeDeclaration as m, VIZE_CONFIG_JSON_SCHEMA_PATH as n, normalizeGlobalTypes as o, VizeConfig as p, VIZE_CONFIG_PKL_SCHEMA_PATH as r, ConfigEnv as s, CONFIG_FILE_NAMES as t, RuleCategory as u, MuseaAutogenConfig as v, TypeCheckerConfig as w, FormatterConfig as x, MuseaConfig as y };
439
+ //# sourceMappingURL=config-tYKh_ZMu.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-DA4uu8ja.d.mts","names":[],"sources":["../src/types/compiler.ts","../src/types/tools.ts","../src/types/musea.ts","../src/types/loader.ts","../src/types/core.ts","../src/config.ts"],"mappings":";;AAOA;;UAAiB,cAAA;EAAc;;;;EAK7B,IAAA;EAwBA;;;;EAlBA,KAAA;EAgDA;;;;EA1CA,GAAA;EA0D+B;;;;EApD/B,SAAA;EA+DsC;;;;EAzDtC,iBAAA;EAmDsC;;;;EA7CtC,WAAA;EA+DA;;;;EAzDA,aAAA;;ACvCF;;;ED6CE,IAAA;EC9BuB;;;;EDoCvB,SAAA;EC/Ba;;;;EDqC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BAAA,GAAmB,gBAAA;;;;iBAOlC,UAAA,CACpB,IAAA,UACA,OAAA,GAAS,iBAAA,GACR,OAAA,CAAQ,UAAA;;;;iBA4IK,oBAAA,CACd,MAAA,EAAQ,iBAAA,GACP,MAAA,SAAe,qBAAA"}
1
+ {"version":3,"file":"config-tYKh_ZMu.d.mts","names":[],"sources":["../src/types/compiler.ts","../src/types/tools.ts","../src/types/musea.ts","../src/types/loader.ts","../src/types/core.ts","../src/config.ts"],"mappings":";;AAOA;;UAAiB,cAAA;EAAc;;;;EAK7B,IAAA;EAwBA;;;;EAlBA,KAAA;EAgDA;;;;EA1CA,GAAA;EA0D+B;;;;EApD/B,SAAA;EA+DsC;;;;EAzDtC,iBAAA;EAmDsC;;;;EA7CtC,WAAA;EA+DA;;;;EAzDA,aAAA;;ACvCF;;;ED6CE,IAAA;EC9BuB;;;;EDoCvB,SAAA;EC/Ba;;;;EDqCb,iBAAA;EC/CS;;;;EDqDT,iBAAA;AAAA;;;;UAUe,gBAAA;ECrDuC;AAUxD;;;EDgDE,OAAA,YAAmB,MAAA,aAAmB,MAAA;EC3CtC;;;;EDiDA,OAAA,YAAmB,MAAA,aAAmB,MAAA;ECnBtC;;;;EDyBA,YAAA;ECV8B;;;;EDgB9B,cAAA;AAAA;;;AAlGF;;;AAAA,UCEiB,YAAA;EDGf;;;ECCA,OAAA;EDuBA;;;;ECjBA,MAAA,GAAS,UAAA;ED+CT;;;EC1CA,KAAA,GAAQ,MAAA,SAAe,YAAA;ED0DR;;;ECrDf,UAAA,GAAa,OAAA,CAAQ,MAAA,CAAO,YAAA,EAAc,YAAA;AAAA;;;;UAU3B,iBAAA;EDgDf;;;;EC3CA,OAAA;EDiDsC;;;;EC3CtC,MAAA;;;;AAzCF;EA+CE,UAAA;;;;;EAMA,UAAA;EAjC0C;;;;EAuC1C,qBAAA;EAvDA;;;;EA6DA,QAAA;EAlDuB;;;EAuDvB,SAAA;AAAA;;;;UAUe,eAAA;EAlDiB;;;;EAuDhC,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AAA,UAEzB,SAAA;EACf,IAAA;EACA,OAAA;EACA,UAAA;AAAA;AAAA,KAGU,gBAAA,GAAmB,UAAA,KAAe,GAAA,EAAK,SAAA,KAAc,YAAA,CAAa,UAAA;AAAA,KAMlE,YAAA;AAAA,KAEA,YAAA;AAAA,KAEA,UAAA;;;;UASK,UAAA;EJ6CgB;;;EIzC/B,OAAA;EJoDmB;;;EI/CnB,QAAA,GAAW,cAAA;EJyCX;;;EIpCA,IAAA,GAAO,gBAAA;EJ0CY;;;EIrCnB,MAAA,GAAS,YAAA;EJiDK;;;EI5Cd,WAAA,GAAc,iBAAA;;AHpDhB;;EGyDE,SAAA,GAAY,eAAA;EH/CH;;;EGoDT,GAAA,GAAM,SAAA;EH1CoC;;;EG+C1C,KAAA,GAAQ,WAAA;EH/CY;;;EGoDpB,WAAA,GAAc,iBAAA;AAAA;;;cCnEH,iBAAA;AAAA,cAeA,4BAAA;AAAA,cAMA,2BAAA;;;;;iBAMG,YAAA,CAAa,MAAA,EAAQ,gBAAA,GAAmB,gBAAA;;;;iBAOlC,UAAA,CACpB,IAAA,UACA,OAAA,GAAS,iBAAA,GACR,OAAA,CAAQ,UAAA;;;;iBA2LK,oBAAA,CACd,MAAA,EAAQ,iBAAA,GACP,MAAA,SAAe,qBAAA"}
package/dist/config.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as loadConfig, r as normalizeGlobalTypes, t as defineConfig } from "./config-DA4uu8ja.mjs";
2
- export { defineConfig, loadConfig, normalizeGlobalTypes };
1
+ import { a as loadConfig, i as defineConfig, n as VIZE_CONFIG_JSON_SCHEMA_PATH, o as normalizeGlobalTypes, r as VIZE_CONFIG_PKL_SCHEMA_PATH, t as CONFIG_FILE_NAMES } from "./config-tYKh_ZMu.mjs";
2
+ export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes };
package/dist/config.mjs CHANGED
@@ -1,18 +1,23 @@
1
1
  import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
- import { pathToFileURL } from "node:url";
3
+ import { execFileSync } from "node:child_process";
4
+ import { fileURLToPath, pathToFileURL } from "node:url";
4
5
  import { transform } from "oxc-transform";
5
6
  //#region src/config.ts
6
7
  const CONFIG_FILE_NAMES = [
7
8
  "vize.config.ts",
8
9
  "vize.config.js",
9
10
  "vize.config.mjs",
11
+ "vize.config.pkl",
10
12
  "vize.config.json"
11
13
  ];
12
14
  const DEFAULT_CONFIG_ENV = {
13
15
  mode: "development",
14
16
  command: "serve"
15
17
  };
18
+ const PACKAGE_ROOT = path.resolve(fileURLToPath(new URL(".", import.meta.url)), "..");
19
+ const VIZE_CONFIG_JSON_SCHEMA_PATH = path.join(PACKAGE_ROOT, "schemas", "vize.config.schema.json");
20
+ const VIZE_CONFIG_PKL_SCHEMA_PATH = path.join(PACKAGE_ROOT, "pkl", "vize.pkl");
16
21
  /**
17
22
  * Define a Vize configuration with type checking.
18
23
  * Accepts a plain object or a function that receives ConfigEnv.
@@ -21,7 +26,7 @@ function defineConfig(config) {
21
26
  return config;
22
27
  }
23
28
  /**
24
- * Load vize.config file from the specified directory
29
+ * Load `vize.config.*` from the specified directory.
25
30
  */
26
31
  async function loadConfig(root, options = {}) {
27
32
  const { mode = "root", configFile, env } = options;
@@ -40,9 +45,6 @@ async function loadConfig(root, options = {}) {
40
45
  if (!configPath) return null;
41
46
  return loadConfigFile(configPath, env);
42
47
  }
43
- /**
44
- * Find config file in a specific directory
45
- */
46
48
  function findConfigFileInDir(dir) {
47
49
  for (const name of CONFIG_FILE_NAMES) {
48
50
  const filePath = path.join(dir, name);
@@ -50,60 +52,95 @@ function findConfigFileInDir(dir) {
50
52
  }
51
53
  return null;
52
54
  }
53
- /**
54
- * Find config file by searching from cwd upward
55
- */
56
55
  function findConfigFileAuto(startDir) {
57
56
  let currentDir = path.resolve(startDir);
58
- const root = path.parse(currentDir).root;
59
- while (currentDir !== root) {
57
+ while (true) {
60
58
  const configPath = findConfigFileInDir(currentDir);
61
59
  if (configPath) return configPath;
62
- currentDir = path.dirname(currentDir);
60
+ const parentDir = path.dirname(currentDir);
61
+ if (parentDir === currentDir) return null;
62
+ currentDir = parentDir;
63
63
  }
64
- return null;
65
64
  }
66
- /**
67
- * Load and evaluate a config file
68
- */
69
65
  async function loadConfigFile(filePath, env) {
70
66
  if (!fs.existsSync(filePath)) return null;
71
67
  const ext = path.extname(filePath);
72
- if (ext === ".json") {
73
- const content = fs.readFileSync(filePath, "utf-8");
74
- return JSON.parse(content);
75
- }
68
+ if (ext === ".json") return parseJsonConfig(fs.readFileSync(filePath, "utf-8"), filePath);
69
+ if (ext === ".pkl") return loadPklConfig(filePath);
76
70
  if (ext === ".ts") return loadTypeScriptConfig(filePath, env);
77
71
  return loadESMConfig(filePath, env);
78
72
  }
79
- /**
80
- * Resolve a UserConfigExport to a VizeConfig
81
- */
82
73
  async function resolveConfigExport(exported, env) {
83
74
  if (typeof exported === "function") return exported(env ?? DEFAULT_CONFIG_ENV);
84
75
  return exported;
85
76
  }
86
- /**
87
- * Load TypeScript config file using oxc-transform
88
- */
89
77
  async function loadTypeScriptConfig(filePath, env) {
90
- const code = transform(filePath, fs.readFileSync(filePath, "utf-8"), { typescript: { onlyRemoveTypeImports: true } }).code;
78
+ const result = transform(filePath, fs.readFileSync(filePath, "utf-8"), { typescript: { onlyRemoveTypeImports: true } });
91
79
  const tempFile = filePath.replace(/\.ts$/, `.temp.${Date.now()}.mjs`);
92
- fs.writeFileSync(tempFile, code);
80
+ fs.writeFileSync(tempFile, result.code);
93
81
  try {
94
- const module = await import(pathToFileURL(tempFile).href);
82
+ const module = await importFresh(tempFile);
95
83
  return resolveConfigExport(module.default || module, env);
96
84
  } finally {
97
- fs.unlinkSync(tempFile);
85
+ fs.rmSync(tempFile, { force: true });
98
86
  }
99
87
  }
100
- /**
101
- * Load ESM config file
102
- */
103
88
  async function loadESMConfig(filePath, env) {
104
- const module = await import(pathToFileURL(filePath).href);
89
+ const module = await importFresh(filePath);
105
90
  return resolveConfigExport(module.default || module, env);
106
91
  }
92
+ function loadPklConfig(filePath) {
93
+ try {
94
+ return parseJsonConfig(execFileSync("pkl", [
95
+ "eval",
96
+ "--format",
97
+ "json",
98
+ filePath
99
+ ], {
100
+ cwd: path.dirname(filePath),
101
+ encoding: "utf-8",
102
+ stdio: [
103
+ "ignore",
104
+ "pipe",
105
+ "pipe"
106
+ ]
107
+ }), filePath);
108
+ } catch (error) {
109
+ throw new Error(`Failed to evaluate PKL config at ${filePath}. Make sure the 'pkl' CLI is installed and on PATH. ${getErrorMessage(error)}`);
110
+ }
111
+ }
112
+ async function importFresh(filePath) {
113
+ const fileUrl = pathToFileURL(filePath);
114
+ fileUrl.searchParams.set("t", String(fs.statSync(filePath).mtimeMs));
115
+ return import(fileUrl.href);
116
+ }
117
+ function parseJsonConfig(content, filePath) {
118
+ try {
119
+ return normalizeLoadedConfig(JSON.parse(content));
120
+ } catch (error) {
121
+ throw new Error(`Failed to parse vize config JSON at ${filePath}: ${getErrorMessage(error)}`);
122
+ }
123
+ }
124
+ function normalizeLoadedConfig(config) {
125
+ return stripNullish(config) ?? {};
126
+ }
127
+ function stripNullish(value) {
128
+ if (value === null) return;
129
+ if (Array.isArray(value)) return value.map((entry) => stripNullish(entry)).filter((entry) => entry !== void 0);
130
+ if (typeof value === "object" && value !== null) {
131
+ const result = {};
132
+ for (const [key, entry] of Object.entries(value)) {
133
+ const normalizedEntry = stripNullish(entry);
134
+ if (normalizedEntry !== void 0) result[key] = normalizedEntry;
135
+ }
136
+ return result;
137
+ }
138
+ return value;
139
+ }
140
+ function getErrorMessage(error) {
141
+ if (error instanceof Error) return error.message;
142
+ return String(error);
143
+ }
107
144
  /**
108
145
  * Normalize GlobalTypesConfig shorthand strings to GlobalTypeDeclaration objects
109
146
  */
@@ -114,6 +151,6 @@ function normalizeGlobalTypes(config) {
114
151
  return result;
115
152
  }
116
153
  //#endregion
117
- export { defineConfig, loadConfig, normalizeGlobalTypes };
154
+ export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes };
118
155
 
119
156
  //# sourceMappingURL=config.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { transform } from \"oxc-transform\";\nimport type {\n VizeConfig,\n LoadConfigOptions,\n UserConfigExport,\n ConfigEnv,\n GlobalTypesConfig,\n GlobalTypeDeclaration,\n} from \"./types/index.js\";\n\nconst CONFIG_FILE_NAMES = [\n \"vize.config.ts\",\n \"vize.config.js\",\n \"vize.config.mjs\",\n \"vize.config.json\",\n];\n\nconst DEFAULT_CONFIG_ENV: ConfigEnv = {\n mode: \"development\",\n command: \"serve\",\n};\n\n/**\n * Define a Vize configuration with type checking.\n * Accepts a plain object or a function that receives ConfigEnv.\n */\nexport function defineConfig(config: UserConfigExport): UserConfigExport {\n return config;\n}\n\n/**\n * Load vize.config file from the specified directory\n */\nexport async function loadConfig(\n root: string,\n options: LoadConfigOptions = {},\n): Promise<VizeConfig | null> {\n const { mode = \"root\", configFile, env } = options;\n\n if (mode === \"none\") {\n return null;\n }\n\n // Custom config file path\n if (configFile) {\n const absolutePath = path.isAbsolute(configFile) ? configFile : path.resolve(root, configFile);\n if (fs.existsSync(absolutePath)) {\n return loadConfigFile(absolutePath, env);\n }\n return null;\n }\n\n // Search for config file\n if (mode === \"auto\") {\n const configPath = findConfigFileAuto(root);\n if (!configPath) {\n return null;\n }\n return loadConfigFile(configPath, env);\n }\n\n // mode === \"root\"\n const configPath = findConfigFileInDir(root);\n if (!configPath) {\n return null;\n }\n return loadConfigFile(configPath, env);\n}\n\n/**\n * Find config file in a specific directory\n */\nfunction findConfigFileInDir(dir: string): string | null {\n for (const name of CONFIG_FILE_NAMES) {\n const filePath = path.join(dir, name);\n if (fs.existsSync(filePath)) {\n return filePath;\n }\n }\n return null;\n}\n\n/**\n * Find config file by searching from cwd upward\n */\nfunction findConfigFileAuto(startDir: string): string | null {\n let currentDir = path.resolve(startDir);\n const root = path.parse(currentDir).root;\n\n while (currentDir !== root) {\n const configPath = findConfigFileInDir(currentDir);\n if (configPath) {\n return configPath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return null;\n}\n\n/**\n * Load and evaluate a config file\n */\nasync function loadConfigFile(filePath: string, env?: ConfigEnv): Promise<VizeConfig | null> {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n\n const ext = path.extname(filePath);\n\n if (ext === \".json\") {\n const content = fs.readFileSync(filePath, \"utf-8\");\n return JSON.parse(content);\n }\n\n if (ext === \".ts\") {\n return loadTypeScriptConfig(filePath, env);\n }\n\n // .js, .mjs - ESM\n return loadESMConfig(filePath, env);\n}\n\n/**\n * Resolve a UserConfigExport to a VizeConfig\n */\nasync function resolveConfigExport(\n exported: UserConfigExport,\n env?: ConfigEnv,\n): Promise<VizeConfig> {\n if (typeof exported === \"function\") {\n return exported(env ?? DEFAULT_CONFIG_ENV);\n }\n return exported;\n}\n\n/**\n * Load TypeScript config file using oxc-transform\n */\nasync function loadTypeScriptConfig(filePath: string, env?: ConfigEnv): Promise<VizeConfig> {\n const source = fs.readFileSync(filePath, \"utf-8\");\n const result = transform(filePath, source, {\n typescript: {\n onlyRemoveTypeImports: true,\n },\n });\n\n const code = result.code;\n\n // Write to temp file and import (use Date.now() to avoid race conditions)\n const tempFile = filePath.replace(/\\.ts$/, `.temp.${Date.now()}.mjs`);\n fs.writeFileSync(tempFile, code);\n\n try {\n const fileUrl = pathToFileURL(tempFile).href;\n const module = await import(fileUrl);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\n } finally {\n fs.unlinkSync(tempFile);\n }\n}\n\n/**\n * Load ESM config file\n */\nasync function loadESMConfig(filePath: string, env?: ConfigEnv): Promise<VizeConfig> {\n const fileUrl = pathToFileURL(filePath).href;\n const module = await import(fileUrl);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\n}\n\n/**\n * Normalize GlobalTypesConfig shorthand strings to GlobalTypeDeclaration objects\n */\nexport function normalizeGlobalTypes(\n config: GlobalTypesConfig,\n): Record<string, GlobalTypeDeclaration> {\n const result: Record<string, GlobalTypeDeclaration> = {};\n for (const [key, value] of Object.entries(config)) {\n if (typeof value === \"string\") {\n result[key] = { type: value };\n } else {\n result[key] = value;\n }\n }\n return result;\n}\n"],"mappings":";;;;;AAaA,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CACD;AAED,MAAM,qBAAgC;CACpC,MAAM;CACN,SAAS;CACV;;;;;AAMD,SAAgB,aAAa,QAA4C;AACvE,QAAO;;;;;AAMT,eAAsB,WACpB,MACA,UAA6B,EAAE,EACH;CAC5B,MAAM,EAAE,OAAO,QAAQ,YAAY,QAAQ;AAE3C,KAAI,SAAS,OACX,QAAO;AAIT,KAAI,YAAY;EACd,MAAM,eAAe,KAAK,WAAW,WAAW,GAAG,aAAa,KAAK,QAAQ,MAAM,WAAW;AAC9F,MAAI,GAAG,WAAW,aAAa,CAC7B,QAAO,eAAe,cAAc,IAAI;AAE1C,SAAO;;AAIT,KAAI,SAAS,QAAQ;EACnB,MAAM,aAAa,mBAAmB,KAAK;AAC3C,MAAI,CAAC,WACH,QAAO;AAET,SAAO,eAAe,YAAY,IAAI;;CAIxC,MAAM,aAAa,oBAAoB,KAAK;AAC5C,KAAI,CAAC,WACH,QAAO;AAET,QAAO,eAAe,YAAY,IAAI;;;;;AAMxC,SAAS,oBAAoB,KAA4B;AACvD,MAAK,MAAM,QAAQ,mBAAmB;EACpC,MAAM,WAAW,KAAK,KAAK,KAAK,KAAK;AACrC,MAAI,GAAG,WAAW,SAAS,CACzB,QAAO;;AAGX,QAAO;;;;;AAMT,SAAS,mBAAmB,UAAiC;CAC3D,IAAI,aAAa,KAAK,QA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I,OAAO,UAAU,SACnB,QAAO,OAAO,EAAE,MAAM,OAAO;KAE7B,QAAO,OAAO;AAGlB,QAAO"}
1
+ {"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { execFileSync } from \"node:child_process\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { transform } from \"oxc-transform\";\nimport type {\n VizeConfig,\n LoadConfigOptions,\n UserConfigExport,\n ConfigEnv,\n GlobalTypesConfig,\n GlobalTypeDeclaration,\n} from \"./types/index.js\";\n\nexport const CONFIG_FILE_NAMES = [\n \"vize.config.ts\",\n \"vize.config.js\",\n \"vize.config.mjs\",\n \"vize.config.pkl\",\n \"vize.config.json\",\n] as const;\n\nconst DEFAULT_CONFIG_ENV: ConfigEnv = {\n mode: \"development\",\n command: \"serve\",\n};\n\nconst PACKAGE_ROOT = path.resolve(fileURLToPath(new URL(\".\", import.meta.url)), \"..\");\n\nexport const VIZE_CONFIG_JSON_SCHEMA_PATH = path.join(\n PACKAGE_ROOT,\n \"schemas\",\n \"vize.config.schema.json\",\n);\n\nexport const VIZE_CONFIG_PKL_SCHEMA_PATH = path.join(PACKAGE_ROOT, \"pkl\", \"vize.pkl\");\n\n/**\n * Define a Vize configuration with type checking.\n * Accepts a plain object or a function that receives ConfigEnv.\n */\nexport function defineConfig(config: UserConfigExport): UserConfigExport {\n return config;\n}\n\n/**\n * Load `vize.config.*` from the specified directory.\n */\nexport async function loadConfig(\n root: string,\n options: LoadConfigOptions = {},\n): Promise<VizeConfig | null> {\n const { mode = \"root\", configFile, env } = options;\n\n if (mode === \"none\") {\n return null;\n }\n\n if (configFile) {\n const absolutePath = path.isAbsolute(configFile) ? configFile : path.resolve(root, configFile);\n if (fs.existsSync(absolutePath)) {\n return loadConfigFile(absolutePath, env);\n }\n return null;\n }\n\n if (mode === \"auto\") {\n const configPath = findConfigFileAuto(root);\n if (!configPath) {\n return null;\n }\n return loadConfigFile(configPath, env);\n }\n\n const configPath = findConfigFileInDir(root);\n if (!configPath) {\n return null;\n }\n\n return loadConfigFile(configPath, env);\n}\n\nfunction findConfigFileInDir(dir: string): string | null {\n for (const name of CONFIG_FILE_NAMES) {\n const filePath = path.join(dir, name);\n if (fs.existsSync(filePath)) {\n return filePath;\n }\n }\n return null;\n}\n\nfunction findConfigFileAuto(startDir: string): string | null {\n let currentDir = path.resolve(startDir);\n\n while (true) {\n const configPath = findConfigFileInDir(currentDir);\n if (configPath) {\n return configPath;\n }\n\n const parentDir = path.dirname(currentDir);\n if (parentDir === currentDir) {\n return null;\n }\n\n currentDir = parentDir;\n }\n}\n\nasync function loadConfigFile(filePath: string, env?: ConfigEnv): Promise<VizeConfig | null> {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n\n const ext = path.extname(filePath);\n\n if (ext === \".json\") {\n const content = fs.readFileSync(filePath, \"utf-8\");\n return parseJsonConfig(content, filePath);\n }\n\n if (ext === \".pkl\") {\n return loadPklConfig(filePath);\n }\n\n if (ext === \".ts\") {\n return loadTypeScriptConfig(filePath, env);\n }\n\n return loadESMConfig(filePath, env);\n}\n\nasync function resolveConfigExport(\n exported: UserConfigExport,\n env?: ConfigEnv,\n): Promise<VizeConfig> {\n if (typeof exported === \"function\") {\n return exported(env ?? DEFAULT_CONFIG_ENV);\n }\n\n return exported;\n}\n\nasync function loadTypeScriptConfig(filePath: string, env?: ConfigEnv): Promise<VizeConfig> {\n const source = fs.readFileSync(filePath, \"utf-8\");\n const result = transform(filePath, source, {\n typescript: {\n onlyRemoveTypeImports: true,\n },\n });\n\n const tempFile = filePath.replace(/\\.ts$/, `.temp.${Date.now()}.mjs`);\n fs.writeFileSync(tempFile, result.code);\n\n try {\n const module = await importFresh(tempFile);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\n } finally {\n fs.rmSync(tempFile, { force: true });\n }\n}\n\nasync function loadESMConfig(filePath: string, env?: ConfigEnv): Promise<VizeConfig> {\n const module = await importFresh(filePath);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\n}\n\nfunction loadPklConfig(filePath: string): VizeConfig {\n try {\n const output = execFileSync(\"pkl\", [\"eval\", \"--format\", \"json\", filePath], {\n cwd: path.dirname(filePath),\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n return parseJsonConfig(output, filePath);\n } catch (error) {\n throw new Error(\n `Failed to evaluate PKL config at ${filePath}. Make sure the 'pkl' CLI is installed and on PATH. ${getErrorMessage(error)}`,\n );\n }\n}\n\nasync function importFresh(filePath: string): Promise<Record<string, unknown>> {\n const fileUrl = pathToFileURL(filePath);\n fileUrl.searchParams.set(\"t\", String(fs.statSync(filePath).mtimeMs));\n return import(fileUrl.href);\n}\n\nfunction parseJsonConfig(content: string, filePath: string): VizeConfig {\n try {\n return normalizeLoadedConfig(JSON.parse(content));\n } catch (error) {\n throw new Error(`Failed to parse vize config JSON at ${filePath}: ${getErrorMessage(error)}`);\n }\n}\n\nfunction normalizeLoadedConfig(config: unknown): VizeConfig {\n const normalized = stripNullish(config);\n return (normalized ?? {}) as VizeConfig;\n}\n\nfunction stripNullish(value: unknown): unknown {\n if (value === null) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n return value.map((entry) => stripNullish(entry)).filter((entry) => entry !== undefined);\n }\n\n if (typeof value === \"object\" && value !== null) {\n const result: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value)) {\n const normalizedEntry = stripNullish(entry);\n if (normalizedEntry !== undefined) {\n result[key] = normalizedEntry;\n }\n }\n return result;\n }\n\n return value;\n}\n\nfunction getErrorMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Normalize GlobalTypesConfig shorthand strings to GlobalTypeDeclaration objects\n */\nexport function normalizeGlobalTypes(\n config: GlobalTypesConfig,\n): Record<string, GlobalTypeDeclaration> {\n const result: Record<string, GlobalTypeDeclaration> = {};\n for (const [key, value] of Object.entries(config)) {\n if (typeof value === \"string\") {\n result[key] = { type: value };\n } else {\n result[key] = value;\n }\n }\n return result;\n}\n"],"mappings":";;;;;;AAcA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,qBAAgC;CACpC,MAAM;CACN,SAAS;CACV;AAED,MAAM,eAAe,KAAK,QAAQ,cAAc,IAAI,IAAI,KAAK,OAAO,KAAK,IAAI,CAAC,EAAE,KAAK;AAErF,MAAa,+BAA+B,KAAK,KAC/C,cACA,WACA,0BACD;AAED,MAAa,8BAA8B,KAAK,KAAK,cAAc,OAAO,WAAW;;;;;AAMrF,SAAgB,aAAa,QAA4C;AACvE,QAAO;;;;;AAMT,eAAsB,WACpB,MACA,UAA6B,EAAE,EACH;CAC5B,MAAM,EAAE,OAAO,QAAQ,YAAY,QAAQ;AAE3C,KAAI,SAAS,OACX,QAAO;AAGT,KAAI,YAAY;EACd,MAAM,eAAe,KAAK,WAAW,WAAW,GAAG,aAAa,KAAK,QAAQ,MAAM,WAAW;AAC9F,MAAI,GAAG,WAAW,aAAa,CAC7B,QAAO,eAAe,cAAc,IAAI;AAE1C,SAAO;;AAGT,KAAI,SAAS,QAAQ;EACnB,MAAM,aAAa,mBAAmB,KAAK;AAC3C,MAAI,CAAC,WACH,QAAO;AAET,SAAO,eAAe,YAAY,IAAI;;CAGxC,MAAM,aAAa,oBAAoB,KAAK;AAC5C,KAAI,CAAC,WACH,QAAO;AAGT,QAAO,eAAe,YAAY,IAAI;;AAGxC,SAAS,oBAAoB,KAA4B;AACvD,MAAK,MAAM,QAAQ,mBAAmB;EACpC,MAAM,WAAW,KAAK,KAAK,KAAK,KAAK;AACrC,MAAI,GAAG,WAAW,SAAS,CACzB,QAAO;;AAGX,QAAO;;AAGT,SAAS,mBAAmB,UAAiC;CAC3D,IAAI,aAAa,KAAK,QAAQ,SAAS;AAEvC,QAAO,MAAM;EACX,MAAM,aAAa,oBAAoB,WAAW;AAClD,MAAI,WACF,QAAO;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ePluginConfig, S as CompilerConfig, _ as MuseaVrtConfig, a as LintPreset, b as LspConfig, c as RuleSeverity, d as GlobalTypeDeclaration, f as GlobalTypesConfig, g as MuseaConfig, h as MuseaAutogenConfig, i as ConfigEnv, l as UserConfigExport, m as MuseaA11yConfig, n as loadConfig, o as MaybePromise, p as LoadConfigOptions, r as normalizeGlobalTypes, s as RuleCategory, t as defineConfig, u as VizeConfig, v as FormatterConfig, x as TypeCheckerConfig, y as LinterConfig } from "./config-DA4uu8ja.mjs";
2
- export { type CompilerConfig, type ConfigEnv, type FormatterConfig, type GlobalTypeDeclaration, type GlobalTypesConfig, type LintPreset, type LinterConfig, type LoadConfigOptions, type LspConfig, type MaybePromise, type MuseaA11yConfig, type MuseaAutogenConfig, type MuseaConfig, type MuseaVrtConfig, type RuleCategory, type RuleSeverity, type TypeCheckerConfig, type UserConfigExport, type VitePluginConfig, type VizeConfig, defineConfig, loadConfig, normalizeGlobalTypes };
1
+ import { C as LspConfig, E as VitePluginConfig, S as LinterConfig, T as CompilerConfig, _ as MuseaA11yConfig, a as loadConfig, b as MuseaVrtConfig, c as LintPreset, d as RuleSeverity, f as UserConfigExport, g as LoadConfigOptions, h as GlobalTypesConfig, i as defineConfig, l as MaybePromise, m as GlobalTypeDeclaration, n as VIZE_CONFIG_JSON_SCHEMA_PATH, o as normalizeGlobalTypes, p as VizeConfig, r as VIZE_CONFIG_PKL_SCHEMA_PATH, s as ConfigEnv, t as CONFIG_FILE_NAMES, u as RuleCategory, v as MuseaAutogenConfig, w as TypeCheckerConfig, x as FormatterConfig, y as MuseaConfig } from "./config-tYKh_ZMu.mjs";
2
+ export { CONFIG_FILE_NAMES, type CompilerConfig, type ConfigEnv, type FormatterConfig, type GlobalTypeDeclaration, type GlobalTypesConfig, type LintPreset, type LinterConfig, type LoadConfigOptions, type LspConfig, type MaybePromise, type MuseaA11yConfig, type MuseaAutogenConfig, type MuseaConfig, type MuseaVrtConfig, type RuleCategory, type RuleSeverity, type TypeCheckerConfig, type UserConfigExport, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, type VitePluginConfig, type VizeConfig, defineConfig, loadConfig, normalizeGlobalTypes };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { defineConfig, loadConfig, normalizeGlobalTypes } from "./config.mjs";
2
- export { defineConfig, loadConfig, normalizeGlobalTypes };
1
+ import { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes } from "./config.mjs";
2
+ export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vize",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "description": "Vize - High-performance Vue.js toolchain in Rust",
5
5
  "keywords": [
6
6
  "cli",
@@ -22,20 +22,24 @@
22
22
  "files": [
23
23
  "bin",
24
24
  "dist",
25
- "src"
25
+ "src",
26
+ "schemas",
27
+ "pkl"
26
28
  ],
27
29
  "type": "module",
28
- "main": "./dist/index.js",
29
- "types": "./dist/index.d.ts",
30
+ "main": "./dist/index.mjs",
31
+ "types": "./dist/index.d.mts",
30
32
  "exports": {
31
33
  ".": {
32
- "import": "./dist/index.js",
33
- "types": "./dist/index.d.ts"
34
+ "import": "./dist/index.mjs",
35
+ "types": "./dist/index.d.mts"
34
36
  },
35
37
  "./config": {
36
- "import": "./dist/config.js",
37
- "types": "./dist/config.d.ts"
38
- }
38
+ "import": "./dist/config.mjs",
39
+ "types": "./dist/config.d.mts"
40
+ },
41
+ "./schemas/vize.config.schema.json": "./schemas/vize.config.schema.json",
42
+ "./pkl/vize.pkl": "./pkl/vize.pkl"
39
43
  },
40
44
  "publishConfig": {
41
45
  "access": "public"
@@ -49,14 +53,14 @@
49
53
  "vite-plus": "latest"
50
54
  },
51
55
  "optionalDependencies": {
52
- "@vizejs/native-darwin-arm64": "0.41.0",
53
- "@vizejs/native-darwin-x64": "0.41.0",
54
- "@vizejs/native-linux-arm64-gnu": "0.41.0",
55
- "@vizejs/native-linux-arm64-musl": "0.41.0",
56
- "@vizejs/native-linux-x64-gnu": "0.41.0",
57
- "@vizejs/native-linux-x64-musl": "0.41.0",
58
- "@vizejs/native-win32-arm64-msvc": "0.41.0",
59
- "@vizejs/native-win32-x64-msvc": "0.41.0"
56
+ "@vizejs/native-darwin-arm64": "0.42.0",
57
+ "@vizejs/native-darwin-x64": "0.42.0",
58
+ "@vizejs/native-linux-arm64-gnu": "0.42.0",
59
+ "@vizejs/native-linux-arm64-musl": "0.42.0",
60
+ "@vizejs/native-linux-x64-gnu": "0.42.0",
61
+ "@vizejs/native-linux-x64-musl": "0.42.0",
62
+ "@vizejs/native-win32-arm64-msvc": "0.42.0",
63
+ "@vizejs/native-win32-x64-msvc": "0.42.0"
60
64
  },
61
65
  "engines": {
62
66
  "node": ">=18"