vize 0.33.0 → 0.35.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
@@ -18,14 +18,14 @@ npm install -g github:ubugeeei/vize
18
18
  vize [COMMAND] [OPTIONS]
19
19
  ```
20
20
 
21
- | Command | Description |
22
- | ------- | -------------------------------------- |
23
- | `build` | Compile Vue SFC files (default) |
24
- | `fmt` | Format Vue SFC files |
25
- | `lint` | Lint Vue SFC files |
26
- | `check` | Type check Vue SFC files |
27
- | `musea` | Start component gallery server |
28
- | `lsp` | Start Language Server Protocol server |
21
+ | Command | Description |
22
+ | ------- | ------------------------------------- |
23
+ | `build` | Compile Vue SFC files (default) |
24
+ | `fmt` | Format Vue SFC files |
25
+ | `lint` | Lint Vue SFC files |
26
+ | `check` | Type check Vue SFC files |
27
+ | `musea` | Start component gallery server |
28
+ | `lsp` | Start Language Server Protocol server |
29
29
 
30
30
  ```bash
31
31
  vize --help # Show help
@@ -1,17 +1,12 @@
1
1
  import { createRequire } from "module";
2
2
  import { readFileSync } from "fs";
3
-
4
3
  //#region src/cli.ts
5
4
  const require = createRequire(import.meta.url);
6
5
  function isMusl() {
7
6
  const report = process.report?.getReport();
8
- if (typeof report === "object" && report !== null && "header" in report) {
9
- const header = report.header;
10
- return !header.glibcVersionRuntime;
11
- }
7
+ if (typeof report === "object" && report !== null && "header" in report) return !report.header.glibcVersionRuntime;
12
8
  try {
13
- const lddPath = require("child_process").execSync("which ldd").toString().trim();
14
- return readFileSync(lddPath, "utf8").includes("musl");
9
+ return readFileSync(require("child_process").execSync("which ldd").toString().trim(), "utf8").includes("musl");
15
10
  } catch {
16
11
  return true;
17
12
  }
@@ -60,8 +55,7 @@ function runLint(args) {
60
55
  else if (!arg.startsWith("-")) patterns.push(arg);
61
56
  }
62
57
  if (patterns.length === 0) patterns.push(".");
63
- const native = loadNative();
64
- const result = native.lint(patterns, {
58
+ const result = loadNative().lint(patterns, {
65
59
  format: options.format,
66
60
  max_warnings: options.maxWarnings,
67
61
  quiet: options.quiet,
@@ -102,6 +96,7 @@ function main() {
102
96
  }
103
97
  }
104
98
  main();
105
-
106
99
  //#endregion
107
- //# sourceMappingURL=cli.js.map
100
+ export {};
101
+
102
+ //# sourceMappingURL=cli.mjs.map
@@ -0,0 +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 },\n ) => LintResult;\n}\n\nfunction loadNative(): NativeBinding {\n const pkg = getBindingPackageName();\n try {\n return require(pkg);\n } catch (e) {\n console.error(`Failed to load native binding: ${pkg}`);\n console.error(\"Try reinstalling: npm install vize\");\n throw e;\n }\n}\n\n// ============================================================================\n// Lint command\n// ============================================================================\n\ninterface LintOptions {\n format?: string;\n maxWarnings?: number;\n quiet?: boolean;\n fix?: boolean;\n helpLevel?: string;\n}\n\ninterface LintResult {\n output: string;\n errorCount: number;\n warningCount: number;\n fileCount: number;\n timeMs: number;\n}\n\nfunction runLint(args: string[]): void {\n const patterns: string[] = [];\n const options: LintOptions = {};\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === \"--format\" || arg === \"-f\") {\n options.format = args[++i];\n } else if (arg === \"--max-warnings\") {\n options.maxWarnings = Number.parseInt(args[++i], 10);\n } else if (arg === \"--quiet\" || arg === \"-q\") {\n options.quiet = true;\n } else if (arg === \"--fix\") {\n options.fix = true;\n } else if (arg === \"--help-level\") {\n options.helpLevel = args[++i];\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n if (patterns.length === 0) {\n patterns.push(\".\");\n }\n\n const native = loadNative();\n const result = native.lint(patterns, {\n format: options.format,\n max_warnings: options.maxWarnings,\n quiet: options.quiet,\n fix: options.fix,\n help_level: options.helpLevel,\n });\n\n if (result.output) {\n process.stdout.write(result.output);\n if (!result.output.endsWith(\"\\n\")) {\n process.stdout.write(\"\\n\");\n }\n }\n\n if (options.fix) {\n process.stderr.write(\"\\nNote: --fix is not yet implemented\\n\");\n }\n\n if (result.errorCount > 0) {\n process.exit(1);\n }\n\n if (options.maxWarnings !== undefined && result.warningCount > options.maxWarnings) {\n process.stderr.write(\n `\\nToo many warnings (${result.warningCount} > max ${options.maxWarnings})\\n`,\n );\n process.exit(1);\n }\n}\n\n// ============================================================================\n// Command router\n// ============================================================================\n\nconst NAPI_COMMANDS = new Set([\"lint\"]);\n\nfunction main(): void {\n const args = process.argv.slice(2);\n const command = args[0];\n\n if (!command) {\n console.error(\"Usage: vize <command> [options]\");\n console.error(\"Commands: lint\");\n process.exit(1);\n }\n\n if (NAPI_COMMANDS.has(command)) {\n const commandArgs = args.slice(1);\n switch (command) {\n case \"lint\":\n runLint(commandArgs);\n break;\n }\n } else {\n console.error(`Unknown command: ${command}`);\n console.error(\n \"For commands not yet available via NAPI, install from source: cargo install vize\",\n );\n process.exit(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;;EAEnE,KAAK,QACH,SAAQ,MAAR;GACE,KAAK,MACH,QAAO;GACT,KAAK,QACH,QAAO;GACT,QACE,OAAM,IAAI,MAAM,wCAAwC,OAAO;;EAErE,KAAK,QACH,SAAQ,MAAR;GACE,KAAK,MACH,QAAO,QAAQ,GAAG,kCAAkC;GACtD,KAAK,QACH,QAAO,QAAQ,GAAG,oCAAoC;GACxD,QACE,OAAM,IAAI,MAAM,sCAAsC,OAAO;;EAEnE,QACE,OAAM,IAAI,MAAM,mBAAmB,SAAS,kBAAkB,O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AQ,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"}
@@ -83,10 +83,9 @@ interface VitePluginConfig {
83
83
  * @default ['node_modules/**', 'dist/**', '.git/**']
84
84
  */
85
85
  ignorePatterns?: string[];
86
- } //#endregion
86
+ }
87
+ //#endregion
87
88
  //#region src/types/tools.d.ts
88
-
89
- //# sourceMappingURL=compiler.d.ts.map
90
89
  /**
91
90
  * Linter configuration
92
91
  */
@@ -222,10 +221,9 @@ interface LspConfig {
222
221
  * @default false
223
222
  */
224
223
  tsgo?: boolean;
225
- } //#endregion
224
+ }
225
+ //#endregion
226
226
  //#region src/types/musea.d.ts
227
-
228
- //# sourceMappingURL=tools.d.ts.map
229
227
  /**
230
228
  * VRT (Visual Regression Testing) configuration for Musea
231
229
  */
@@ -319,10 +317,9 @@ interface MuseaConfig {
319
317
  * Autogen configuration
320
318
  */
321
319
  autogen?: MuseaAutogenConfig;
322
- } //#endregion
320
+ }
321
+ //#endregion
323
322
  //#region src/types/loader.d.ts
324
-
325
- //# sourceMappingURL=musea.d.ts.map
326
323
  /**
327
324
  * Global type declaration
328
325
  */
@@ -361,10 +358,8 @@ interface LoadConfigOptions {
361
358
  */
362
359
  env?: ConfigEnv;
363
360
  }
364
-
365
361
  //#endregion
366
362
  //#region src/types/core.d.ts
367
- //# sourceMappingURL=loader.d.ts.map
368
363
  type MaybePromise<T> = T | Promise<T>;
369
364
  interface ConfigEnv {
370
365
  mode: string;
@@ -411,10 +406,8 @@ interface VizeConfig {
411
406
  */
412
407
  globalTypes?: GlobalTypesConfig;
413
408
  }
414
-
415
409
  //#endregion
416
410
  //#region src/config.d.ts
417
- //# sourceMappingURL=core.d.ts.map
418
411
  /**
419
412
  * Define a Vize configuration with type checking.
420
413
  * Accepts a plain object or a function that receives ConfigEnv.
@@ -428,9 +421,6 @@ declare function loadConfig(root: string, options?: LoadConfigOptions): Promise<
428
421
  * Normalize GlobalTypesConfig shorthand strings to GlobalTypeDeclaration objects
429
422
  */
430
423
  declare function normalizeGlobalTypes(config: GlobalTypesConfig): Record<string, GlobalTypeDeclaration>;
431
-
432
424
  //#endregion
433
- //# sourceMappingURL=config.d.ts.map
434
-
435
- export { CompilerConfig, ConfigEnv, FormatterConfig, GlobalTypeDeclaration, GlobalTypesConfig, LinterConfig, LoadConfigOptions, LspConfig, MaybePromise, MuseaA11yConfig, MuseaAutogenConfig, MuseaConfig, MuseaVrtConfig, RuleCategory, RuleSeverity, TypeCheckerConfig, UserConfigExport, VitePluginConfig, VizeConfig, defineConfig as defineConfig$1, loadConfig as loadConfig$1, normalizeGlobalTypes as normalizeGlobalTypes$1 };
436
- //# sourceMappingURL=config-CLHLyp2k.d.ts.map
425
+ export { VitePluginConfig as S, FormatterConfig as _, MaybePromise as a, TypeCheckerConfig as b, UserConfigExport as c, GlobalTypesConfig as d, LoadConfigOptions as f, MuseaVrtConfig as g, MuseaConfig as h, ConfigEnv as i, VizeConfig as l, MuseaAutogenConfig as m, loadConfig as n, RuleCategory as o, MuseaA11yConfig as p, normalizeGlobalTypes as r, RuleSeverity as s, defineConfig as t, GlobalTypeDeclaration as u, LinterConfig as v, CompilerConfig as x, LspConfig as y };
426
+ //# sourceMappingURL=config-COn027qH.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-COn027qH.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;ECpCQ;;;;ED0CR,SAAA;ECrCoB;;;;ED2CpB,iBAAA;EChDuB;;;;EDsDvB,iBAAA;AAAA;;;ACvCF;UDiDiB,gBAAA;;;;;EAKf,OAAA,YAAmB,MAAA,aAAmB,MAAA;EC/BtC;;;;EDqCA,OAAA,YAAmB,MAAA,aAAmB,MAAA;ECpB9B;AAUV;;;EDgBE,YAAA;ECXA;;;;EDiBA,cAAA;AAAA;;;AAlGF;;;AAAA,UCEiB,YAAA;EDGf;;;ECCA,OAAA;EDuBA;;;EClBA,KAAA,GAAQ,MAAA,SAAe,YAAA;ED0CvB;;;ECrCA,UAAA,GAAa,OAAA,CAAQ,MAAA,CAAO,YAAA,EAAc,YAAA;AAAA;AD2D5C;;;AAAA,UCjDiB,iBAAA;EDsDuB;;;;ECjDtC,OAAA;EDiDA;;;;EC3CA,MAAA;EDiDsC;;;;EC3CtC,UAAA;;;;AAzCF;EA+CE,UAAA;;;;;EAMA,qBAAA;EAvCqB;;;;EA6CrB,QAAA;EAlDA;;;EAuDA,QAAA;AAAA;;;;UAUe,eAAA;EA5DuC;AAUxD;;;EAuDE,UAAA;EAlDA;;;;EAwDA,QAAA;EA1BA;;;;EAgCA,OAAA;EAjB8B;;;;EAuB9B,IAAA;EANA;;;;EAYA,WAAA;EAMa;AAUf;;;EAVE,aAAA;AAAA;;;;UAUe,SAAA;EAmCf;;;;EA9BA,OAAA;;;;AC9HF;EDoIE,WAAA;;;;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QAAA,GAAW,cAAA;EJgD2B;;;EI3CtC,IAAA,GAAO,gBAAA;EJiDqC;;;EI5C5C,MAAA,GAAS,YAAA;EJ4CT;;;EIvCA,WAAA,GAAc,iBAAA;EJmDd;;;EI9CA,SAAA,GAAY,eAAA;;;AHlDd;EGuDE,GAAA,GAAM,SAAA;;;;EAKN,KAAA,GAAQ,WAAA;EH9CkC;;;EGmD1C,WAAA,GAAc,iBAAA;AAAA;;;AJnEhB;;;;AAAA,iBKsBgB,YAAA,CAAa,MAAA,EAAQ,gBAAA,GAAmB,gBAAA;;;;iBAOlC,UAAA,CACpB,IAAA,UACA,OAAA,GAAS,iBAAA,GACR,OAAA,CAAQ,UAAA;;;;iBA4IK,oBAAA,CACd,MAAA,EAAQ,iBAAA,GACP,MAAA,SAAe,qBAAA"}
@@ -0,0 +1,2 @@
1
+ import { n as loadConfig, r as normalizeGlobalTypes, t as defineConfig } from "./config-COn027qH.mjs";
2
+ export { defineConfig, loadConfig, normalizeGlobalTypes };
@@ -2,7 +2,6 @@ import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
3
  import { pathToFileURL } from "node:url";
4
4
  import { transform } from "oxc-transform";
5
-
6
5
  //#region src/config.ts
7
6
  const CONFIG_FILE_NAMES = [
8
7
  "vize.config.ts",
@@ -33,9 +32,9 @@ async function loadConfig(root, options = {}) {
33
32
  return null;
34
33
  }
35
34
  if (mode === "auto") {
36
- const configPath$1 = findConfigFileAuto(root);
37
- if (!configPath$1) return null;
38
- return loadConfigFile(configPath$1, env);
35
+ const configPath = findConfigFileAuto(root);
36
+ if (!configPath) return null;
37
+ return loadConfigFile(configPath, env);
39
38
  }
40
39
  const configPath = findConfigFileInDir(root);
41
40
  if (!configPath) return null;
@@ -88,16 +87,12 @@ async function resolveConfigExport(exported, env) {
88
87
  * Load TypeScript config file using oxc-transform
89
88
  */
90
89
  async function loadTypeScriptConfig(filePath, env) {
91
- const source = fs.readFileSync(filePath, "utf-8");
92
- const result = transform(filePath, source, { typescript: { onlyRemoveTypeImports: true } });
93
- const code = result.code;
90
+ const code = transform(filePath, fs.readFileSync(filePath, "utf-8"), { typescript: { onlyRemoveTypeImports: true } }).code;
94
91
  const tempFile = filePath.replace(/\.ts$/, `.temp.${Date.now()}.mjs`);
95
92
  fs.writeFileSync(tempFile, code);
96
93
  try {
97
- const fileUrl = pathToFileURL(tempFile).href;
98
- const module = await import(fileUrl);
99
- const exported = module.default || module;
100
- return resolveConfigExport(exported, env);
94
+ const module = await import(pathToFileURL(tempFile).href);
95
+ return resolveConfigExport(module.default || module, env);
101
96
  } finally {
102
97
  fs.unlinkSync(tempFile);
103
98
  }
@@ -106,10 +101,8 @@ async function loadTypeScriptConfig(filePath, env) {
106
101
  * Load ESM config file
107
102
  */
108
103
  async function loadESMConfig(filePath, env) {
109
- const fileUrl = pathToFileURL(filePath).href;
110
- const module = await import(fileUrl);
111
- const exported = module.default || module;
112
- return resolveConfigExport(exported, env);
104
+ const module = await import(pathToFileURL(filePath).href);
105
+ return resolveConfigExport(module.default || module, env);
113
106
  }
114
107
  /**
115
108
  * Normalize GlobalTypesConfig shorthand strings to GlobalTypeDeclaration objects
@@ -120,7 +113,7 @@ function normalizeGlobalTypes(config) {
120
113
  else result[key] = value;
121
114
  return result;
122
115
  }
123
-
124
116
  //#endregion
125
117
  export { defineConfig, loadConfig, normalizeGlobalTypes };
126
- //# sourceMappingURL=config-CVmInrFP.js.map
118
+
119
+ //# sourceMappingURL=config.mjs.map
@@ -0,0 +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,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eAAe,oBACb,UACA,KACqB;AACrB,KAAI,OAAO,aAAa,WACtB,QAAO,SAAS,OAAO,mBAAmB;AAE5C,QAAO;;;;;AAMT,eAAe,qBAAqB,UAAkB,KAAsC;CAQ1F,MAAM,OANS,UAAU,UADV,GAAG,aAAa,UAAU,QAAQ,EACN,EACzC,YAAY,EACV,uBAAuB,MACxB,EACF,CAAC,CAEkB;CAGpB,MAAM,WAAW,SAAS,QAAQ,SAAS,SAAS,KAAK,KAAK,CAAC,MAAM;AACrE,IAAG,cAAc,UAAU,KAAK;AAEhC,KAAI;EAEF,MAAM,SAAS,MAAM,OADL,cAAc,SAAS,CAAC;AAGxC,SAAO,oBAD4B,OAAO,WAAW,QAChB,IAAI;WACjC;AACR,KAAG,WAAW,SAAS;;;;;;AAO3B,eAAe,cAAc,UAAkB,KAAsC;CAEnF,MAAM,SAAS,MAAM,OADL,cAAc,SAAS,CAAC;AAGxC,QAAO,oBAD4B,OAAO,WAAW,QAChB,IAAI;;;;;AAM3C,SAAgB,qBACd,QACuC;CACvC,MAAM,SAAgD,EAAE;AACxD,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,CAC/C,KAAI,OAAO,UAAU,SACnB,QAAO,OAAO,EAAE,MAAM,OAAO;KAE7B,QAAO,OAAO;AAGlB,QAAO"}
@@ -0,0 +1,2 @@
1
+ import { S as VitePluginConfig, _ as FormatterConfig, a as MaybePromise, b as TypeCheckerConfig, c as UserConfigExport, d as GlobalTypesConfig, f as LoadConfigOptions, g as MuseaVrtConfig, h as MuseaConfig, i as ConfigEnv, l as VizeConfig, m as MuseaAutogenConfig, n as loadConfig, o as RuleCategory, p as MuseaA11yConfig, r as normalizeGlobalTypes, s as RuleSeverity, t as defineConfig, u as GlobalTypeDeclaration, v as LinterConfig, x as CompilerConfig, y as LspConfig } from "./config-COn027qH.mjs";
2
+ export { type CompilerConfig, type ConfigEnv, type FormatterConfig, type GlobalTypeDeclaration, type GlobalTypesConfig, 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 };
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { defineConfig, loadConfig, normalizeGlobalTypes } from "./config.mjs";
2
+ export { defineConfig, loadConfig, normalizeGlobalTypes };
package/package.json CHANGED
@@ -1,10 +1,29 @@
1
1
  {
2
2
  "name": "vize",
3
- "version": "0.33.0",
3
+ "version": "0.35.0",
4
4
  "description": "Vize - High-performance Vue.js toolchain in Rust",
5
- "publishConfig": {
6
- "access": "public"
5
+ "keywords": [
6
+ "cli",
7
+ "compiler",
8
+ "formatter",
9
+ "linter",
10
+ "rust",
11
+ "vize",
12
+ "vue"
13
+ ],
14
+ "license": "MIT",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/ubugeeei/vize"
7
18
  },
19
+ "bin": {
20
+ "vize": "bin/vize"
21
+ },
22
+ "files": [
23
+ "bin",
24
+ "dist",
25
+ "src"
26
+ ],
8
27
  "type": "module",
9
28
  "main": "./dist/index.js",
10
29
  "types": "./dist/index.d.ts",
@@ -18,54 +37,34 @@
18
37
  "types": "./dist/config.d.ts"
19
38
  }
20
39
  },
21
- "bin": {
22
- "vize": "bin/vize"
23
- },
24
- "files": [
25
- "bin",
26
- "dist",
27
- "src"
28
- ],
29
- "repository": {
30
- "type": "git",
31
- "url": "https://github.com/ubugeeei/vize"
32
- },
33
- "keywords": [
34
- "vue",
35
- "compiler",
36
- "rust",
37
- "cli",
38
- "vize",
39
- "formatter",
40
- "linter"
41
- ],
42
- "license": "MIT",
43
- "engines": {
44
- "node": ">=18"
45
- },
46
- "optionalDependencies": {
47
- "@vizejs/native-darwin-x64": "0.33.0",
48
- "@vizejs/native-darwin-arm64": "0.33.0",
49
- "@vizejs/native-win32-x64-msvc": "0.33.0",
50
- "@vizejs/native-win32-arm64-msvc": "0.33.0",
51
- "@vizejs/native-linux-x64-gnu": "0.33.0",
52
- "@vizejs/native-linux-x64-musl": "0.33.0",
53
- "@vizejs/native-linux-arm64-gnu": "0.33.0",
54
- "@vizejs/native-linux-arm64-musl": "0.33.0"
40
+ "publishConfig": {
41
+ "access": "public"
55
42
  },
56
43
  "dependencies": {
57
44
  "oxc-transform": "^0.56.0"
58
45
  },
59
46
  "devDependencies": {
60
47
  "@types/node": "^22.0.0",
61
- "tsdown": "^0.9.0",
62
- "typescript": "~5.6.0"
48
+ "typescript": "~5.6.0",
49
+ "vite-plus": "latest"
50
+ },
51
+ "optionalDependencies": {
52
+ "@vizejs/native-darwin-arm64": "0.35.0",
53
+ "@vizejs/native-darwin-x64": "0.35.0",
54
+ "@vizejs/native-linux-arm64-gnu": "0.35.0",
55
+ "@vizejs/native-linux-arm64-musl": "0.35.0",
56
+ "@vizejs/native-linux-x64-gnu": "0.35.0",
57
+ "@vizejs/native-linux-x64-musl": "0.35.0",
58
+ "@vizejs/native-win32-arm64-msvc": "0.35.0",
59
+ "@vizejs/native-win32-x64-msvc": "0.35.0"
60
+ },
61
+ "engines": {
62
+ "node": ">=18"
63
63
  },
64
64
  "scripts": {
65
- "build": "tsdown",
66
- "lint": "oxlint --deny-warnings --type-aware --tsconfig tsconfig.json",
67
- "lint:fix": "oxlint --type-aware --tsconfig tsconfig.json --fix",
68
- "fmt": "oxfmt --write src tsdown.config.ts",
69
- "fmt:check": "oxfmt src tsdown.config.ts"
65
+ "build": "vp pack",
66
+ "check": "vp check src vite.config.ts",
67
+ "check:fix": "vp check --fix src vite.config.ts",
68
+ "fmt": "vp fmt --write src vite.config.ts"
70
69
  }
71
70
  }
package/dist/cli.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","names":["args: string[]","patterns: string[]","options: LintOptions"],"sources":["../src/cli.ts"],"sourcesContent":["import { createRequire } from \"module\";\nimport { readFileSync } from \"fs\";\n\nconst require = createRequire(import.meta.url);\n\n// ============================================================================\n// Native binding loader (oxlint pattern)\n// ============================================================================\n\nfunction isMusl(): boolean {\n const report = process.report?.getReport();\n if (typeof report === \"object\" && report !== null && \"header\" in report) {\n const header = (report as { header: { glibcVersionRuntime?: string } }).header;\n return !header.glibcVersionRuntime;\n }\n try {\n const lddPath = require(\"child_process\").execSync(\"which ldd\").toString().trim();\n return readFileSync(lddPath, \"utf8\").includes(\"musl\");\n } catch {\n return true;\n }\n}\n\nfunction getBindingPackageName(): string {\n const { platform, arch } = process;\n\n switch (platform) {\n case \"darwin\":\n switch (arch) {\n case \"x64\":\n return \"@vizejs/native-darwin-x64\";\n case \"arm64\":\n return \"@vizejs/native-darwin-arm64\";\n default:\n throw new Error(`Unsupported architecture on macOS: ${arch}`);\n }\n case \"win32\":\n switch (arch) {\n case \"x64\":\n return \"@vizejs/native-win32-x64-msvc\";\n case \"arm64\":\n return \"@vizejs/native-win32-arm64-msvc\";\n default:\n throw new Error(`Unsupported architecture on Windows: ${arch}`);\n }\n case \"linux\":\n switch (arch) {\n case \"x64\":\n return isMusl() ? \"@vizejs/native-linux-x64-musl\" : \"@vizejs/native-linux-x64-gnu\";\n case \"arm64\":\n return isMusl() ? \"@vizejs/native-linux-arm64-musl\" : \"@vizejs/native-linux-arm64-gnu\";\n default:\n throw new Error(`Unsupported architecture on Linux: ${arch}`);\n }\n default:\n throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);\n }\n}\n\ninterface NativeBinding {\n lint: (\n patterns: string[],\n options?: {\n format?: string;\n max_warnings?: number;\n quiet?: boolean;\n fix?: boolean;\n help_level?: string;\n },\n ) => LintResult;\n}\n\nfunction loadNative(): NativeBinding {\n const pkg = getBindingPackageName();\n try {\n return require(pkg);\n } catch (e) {\n console.error(`Failed to load native binding: ${pkg}`);\n console.error(\"Try reinstalling: npm install vize\");\n throw e;\n }\n}\n\n// ============================================================================\n// Lint command\n// ============================================================================\n\ninterface LintOptions {\n format?: string;\n maxWarnings?: number;\n quiet?: boolean;\n fix?: boolean;\n helpLevel?: string;\n}\n\ninterface LintResult {\n output: string;\n errorCount: number;\n warningCount: number;\n fileCount: number;\n timeMs: number;\n}\n\nfunction runLint(args: string[]): void {\n const patterns: string[] = [];\n const options: LintOptions = {};\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === \"--format\" || arg === \"-f\") {\n options.format = args[++i];\n } else if (arg === \"--max-warnings\") {\n options.maxWarnings = Number.parseInt(args[++i], 10);\n } else if (arg === \"--quiet\" || arg === \"-q\") {\n options.quiet = true;\n } else if (arg === \"--fix\") {\n options.fix = true;\n } else if (arg === \"--help-level\") {\n options.helpLevel = args[++i];\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n if (patterns.length === 0) {\n patterns.push(\".\");\n }\n\n const native = loadNative();\n const result = native.lint(patterns, {\n format: options.format,\n max_warnings: options.maxWarnings,\n quiet: options.quiet,\n fix: options.fix,\n help_level: options.helpLevel,\n });\n\n if (result.output) {\n process.stdout.write(result.output);\n if (!result.output.endsWith(\"\\n\")) {\n process.stdout.write(\"\\n\");\n }\n }\n\n if (options.fix) {\n process.stderr.write(\"\\nNote: --fix is not yet implemented\\n\");\n }\n\n if (result.errorCount > 0) {\n process.exit(1);\n }\n\n if (options.maxWarnings !== undefined && result.warningCount > options.maxWarnings) {\n process.stderr.write(\n `\\nToo many warnings (${result.warningCount} > max ${options.maxWarnings})\\n`,\n );\n process.exit(1);\n }\n}\n\n// ============================================================================\n// Command router\n// ============================================================================\n\nconst NAPI_COMMANDS = new Set([\"lint\"]);\n\nfunction main(): void {\n const args = process.argv.slice(2);\n const command = args[0];\n\n if (!command) {\n console.error(\"Usage: vize <command> [options]\");\n console.error(\"Commands: lint\");\n process.exit(1);\n }\n\n if (NAPI_COMMANDS.has(command)) {\n const commandArgs = args.slice(1);\n switch (command) {\n case \"lint\":\n runLint(commandArgs);\n break;\n }\n } else {\n console.error(`Unknown command: ${command}`);\n console.error(\n \"For commands not yet available via NAPI, install from source: cargo install vize\",\n );\n process.exit(1);\n }\n}\n\nmain();\n"],"mappings":";;;;AAGA,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAM9C,SAAS,SAAkB;CACzB,MAAM,SAAS,QAAQ,QAAQ,WAAW;AAC1C,YAAW,WAAW,YAAY,WAAW,QAAQ,YAAY,QAAQ;EACvE,MAAM,SAAU,OAAwD;AACxE,UAAQ,OAAO;CAChB;AACD,KAAI;EACF,MAAM,UAAU,QAAQ,gBAAgB,CAAC,SAAS,YAAY,CAAC,UAAU,CAAC,MAAM;AAChF,SAAO,aAAa,SAAS,OAAO,CAAC,SAAS,OAAO;CACtD,QAAO;AACN,SAAO;CACR;AACF;AAED,SAAS,wBAAgC;CACvC,MAAM,EAAE,UAAU,MAAM,GAAG;AAE3B,SAAQ,UAAR;EACE,KAAK,SACH,SAAQ,MAAR;GACE,KAAK,MACH,QAAO;GACT,KAAK,QACH,QAAO;GACT,QACE,OAAM,IAAI,OAAO,qCAAqC,KAAK;EAC9D;EACH,KAAK,QACH,SAAQ,MAAR;GACE,KAAK,MACH,QAAO;GACT,KAAK,QACH,QAAO;GACT,QACE,OAAM,IAAI,OAAO,uCAAuC,KAAK;EAChE;EACH,KAAK,QACH,SAAQ,MAAR;GACE,KAAK,MACH,QAAO,QAAQ,GAAG,kCAAkC;GACtD,KAAK,QACH,QAAO,QAAQ,GAAG,oCAAoC;GACxD,QACE,OAAM,IAAI,OAAO,qCAAqC,KAAK;EAC9D;EACH,QACE,OAAM,IAAI,OAAO,kBAAkB,SAAS,kBAAkB,KAAK;CACtE;AACF;AAeD,SAAS,aAA4B;CACnC,MAAM,MAAM,uBAAuB;AACnC,KAAI;AACF,SAAO,QAAQ,IAAI;CACpB,SAAQ,GAAG;AACV,UAAQ,OAAO,iCAAiC,IAAI,EAAE;AACtD,UAAQ,MAAM,qCAAqC;AACnD,QAAM;CACP;AACF;AAsBD,SAAS,QAAQA,MAAsB;CAC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AkC;AAChD,UAAQ,MAAM,iBAAiB;AAC/B,UAAQ,KAAK,EAAE;CAChB;AAED,KAAI,cAAc,IAAI,QAAQ,EAAE;EAC9B,MAAM,cAAc,KAAK,MAAM,EAAE;AACjC,UAAQ,SAAR;GACE,KAAK;AACH,YAAQ,YAAY;AACpB;EACH;CACF,OAAM;AACL,UAAQ,OAAO,mBAAmB,QAAQ,EAAE;AAC5C,UAAQ,MACN,mFACD;AACD,UAAQ,KAAK,EAAE;CAChB;AACF;AAED,MAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-CLHLyp2k.d.ts","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"],"sourcesContent":null,"mappings":";;;;UAOiB,cAAA;EAAA;;;;EA2EA,IAAA,CAAA,EAAA,QAAA,GAAA,UAAgB;EAAA;;;;EAWN,KAAa,CAAA,EAAA,OAAA;EAAM;;;;;;;ACpF9C;;EAA6B,SASJ,CAAA,EAAA,OAAA;EAAY;;;;EAKR,iBAAd,CAAA,EAAA,OAAA;EAAO;;;;EAUL,WAAA,CAAA,EAAA,OAAiB;;;;AAkDlC;;;;AA6CA;;;;;;;ECzHiB,SAAA,CAAA,EAAA,IAAA,GAAc,IAAA;;;;AAsB/B;;;;AAgBA;;;;AAiBA;;;AAuCS,UFnBQ,gBAAA,CEmBR;EAAe;AAKM;;;qBFnBT,mBAAmB;;;;AG9ExC;qBHoFqB,mBAAmB;;;AGrExC;;EAA6B,YAAkB,CAAA,EAAA,MAAA,EAAA;EAAqB;AAA9B;;;;AAStC,CAAA;;;;;;;AH1BiB,UCEA,YAAA,CDFc;;;;EA2Ed,OAAA,CAAA,EAAA,OAAA;EAAgB;;;EAKa,KAMzB,CAAA,EC3EX,MD2EW,CAAA,MAAA,EC3EI,YD2EJ,CAAA;EAAM;AAAmB;;eCtE/B,QAAQ,OAAO,cAAc;;;;;AAd3B,UAwBA,iBAAA,CAxBY;E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2CsB,GAAA,IAAA,CAAA;;;;AAWO,iBKsFxB,oBAAA,CLtFwB,MAAA,EKuF9B,iBLvF8B,CAAA,EKwFrC,MLxFqC,CAAA,MAAA,EKwFtB,qBLxFsB,CAAA;;;AAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-CVmInrFP.js","names":["DEFAULT_CONFIG_ENV: ConfigEnv","config: UserConfigExport","root: string","options: LoadConfigOptions","configPath","dir: string","startDir: string","filePath: string","env?: ConfigEnv","exported: UserConfigExport","config: GlobalTypesConfig","result: Record<string, GlobalTypeDeclaration>"],"sources":["../src/config.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { transform } from \"oxc-transform\";\nimport type {\n VizeConfig,\n LoadConfigOptions,\n UserConfigExport,\n ConfigEnv,\n GlobalTypesConfig,\n GlobalTypeDeclaration,\n} from \"./types/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;AACD;AAED,MAAMA,qBAAgC;CACpC,MAAM;CACN,SAAS;AACV;;;;;AAMD,SAAgB,aAAaC,QAA4C;AACvE,QAAO;AACR;;;;AAKD,eAAsB,WACpBC,MACAC,UAA6B,CAAE,GACH;CAC5B,MAAM,EAAE,OAAO,QAAQ,YAAY,KAAK,GAAG;AAE3C,KAAI,SAAS,OACX,QAAO;AAIT,KAAI,YAAY;EACd,MAAM,eAAe,KAAK,WAAW,WAAW,GAAG,aAAa,KAAK,QAAQ,MAAM,WAAW;AAC9F,MAAI,GAAG,WAAW,aAAa,CAC7B,QAAO,eAAe,cAAc,IAAI;AAE1C,SAAO;CACR;AAGD,KAAI,SAAS,QAAQ;EACnB,MAAMC,eAAa,mBAAmB,KAAK;AAC3C,OAAKA,aACH,QAAO;AAET,SAAO,eAAeA,cAAY,IAAI;CACvC;CAGD,MAAM,aAAa,oBAAoB,KAAK;AAC5C,MAAK,WACH,QAAO;AAET,QAAO,eAAe,YAAY,IAAI;AACvC;;;;AAKD,SAAS,oBAAoBC,KAA4B;AACvD,MAAK,MAAM,QAAQ,mBAAmB;EAC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AAS;CACxB;AACF;;;;AAKD,eAAe,cAAcF,UAAkBC,KAAsC;CACnF,MAAM,UAAU,cAAc,SAAS,CAAC;CACxC,MAAM,SAAS,MAAM,OAAO;CAC5B,MAAMC,WAA6B,OAAO,WAAW;AACrD,QAAO,oBAAoB,UAAU,IAAI;AAC1C;;;;AAKD,SAAgB,qBACdC,QACuC;CACvC,MAAMC,SAAgD,CAAE;AACxD,MAAK,MAAM,CAAC,KAAK,MAAM,IAAI,OAAO,QAAQ,OAAO,CAC/C,YAAW,UAAU,SACnB,QAAO,OAAO,EAAE,MAAM,MAAO;KAE7B,QAAO,OAAO;AAGlB,QAAO;AACR"}
package/dist/config.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { defineConfig$1 as defineConfig, loadConfig$1 as loadConfig, normalizeGlobalTypes$1 as normalizeGlobalTypes } from "./config-CLHLyp2k.js";
2
- export { defineConfig, loadConfig, normalizeGlobalTypes };
package/dist/config.js DELETED
@@ -1,3 +0,0 @@
1
- import { defineConfig, loadConfig, normalizeGlobalTypes } from "./config-CVmInrFP.js";
2
-
3
- export { defineConfig, loadConfig, normalizeGlobalTypes };
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { CompilerConfig, ConfigEnv, FormatterConfig, GlobalTypeDeclaration, GlobalTypesConfig, LinterConfig, LoadConfigOptions, LspConfig, MaybePromise, MuseaA11yConfig, MuseaAutogenConfig, MuseaConfig, MuseaVrtConfig, RuleCategory, RuleSeverity, TypeCheckerConfig, UserConfigExport, VitePluginConfig, VizeConfig, defineConfig$1 as defineConfig, loadConfig$1 as loadConfig, normalizeGlobalTypes$1 as normalizeGlobalTypes } from "./config-CLHLyp2k.js";
2
- export { CompilerConfig, ConfigEnv, FormatterConfig, GlobalTypeDeclaration, GlobalTypesConfig, LinterConfig, LoadConfigOptions, LspConfig, MaybePromise, MuseaA11yConfig, MuseaAutogenConfig, MuseaConfig, MuseaVrtConfig, RuleCategory, RuleSeverity, TypeCheckerConfig, UserConfigExport, VitePluginConfig, VizeConfig, defineConfig, loadConfig, normalizeGlobalTypes };
package/dist/index.js DELETED
@@ -1,3 +0,0 @@
1
- import { defineConfig, loadConfig, normalizeGlobalTypes } from "./config-CVmInrFP.js";
2
-
3
- export { defineConfig, loadConfig, normalizeGlobalTypes };
File without changes