vize 0.33.0 → 0.37.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 +8 -8
- package/dist/{cli.js → cli.mjs} +9 -12
- package/dist/cli.mjs.map +1 -0
- package/dist/{config-CLHLyp2k.d.ts → config-DBaKDK6P.d.mts} +14 -18
- package/dist/config-DBaKDK6P.d.mts.map +1 -0
- package/dist/config.d.mts +2 -0
- package/dist/{config-CVmInrFP.js → config.mjs} +10 -17
- package/dist/config.mjs.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +2 -0
- package/package.json +43 -44
- package/src/cli.ts +5 -0
- package/src/index.ts +1 -0
- package/src/types/core.ts +2 -0
- package/src/types/index.ts +1 -0
- package/src/types/tools.ts +7 -1
- package/dist/cli.js.map +0 -1
- package/dist/config-CLHLyp2k.d.ts.map +0 -1
- package/dist/config-CVmInrFP.js.map +0 -1
- package/dist/config.d.ts +0 -2
- package/dist/config.js +0 -3
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -3
- /package/dist/{cli.d.ts → cli.d.mts} +0 -0
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
|
package/dist/{cli.js → cli.mjs}
RENAMED
|
@@ -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
|
-
|
|
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
|
}
|
|
@@ -57,16 +52,17 @@ function runLint(args) {
|
|
|
57
52
|
else if (arg === "--quiet" || arg === "-q") options.quiet = true;
|
|
58
53
|
else if (arg === "--fix") options.fix = true;
|
|
59
54
|
else if (arg === "--help-level") options.helpLevel = args[++i];
|
|
55
|
+
else if (arg === "--preset") options.preset = args[++i];
|
|
60
56
|
else if (!arg.startsWith("-")) patterns.push(arg);
|
|
61
57
|
}
|
|
62
58
|
if (patterns.length === 0) patterns.push(".");
|
|
63
|
-
const
|
|
64
|
-
const result = native.lint(patterns, {
|
|
59
|
+
const result = loadNative().lint(patterns, {
|
|
65
60
|
format: options.format,
|
|
66
61
|
max_warnings: options.maxWarnings,
|
|
67
62
|
quiet: options.quiet,
|
|
68
63
|
fix: options.fix,
|
|
69
|
-
help_level: options.helpLevel
|
|
64
|
+
help_level: options.helpLevel,
|
|
65
|
+
preset: options.preset
|
|
70
66
|
});
|
|
71
67
|
if (result.output) {
|
|
72
68
|
process.stdout.write(result.output);
|
|
@@ -102,6 +98,7 @@ function main() {
|
|
|
102
98
|
}
|
|
103
99
|
}
|
|
104
100
|
main();
|
|
105
|
-
|
|
106
101
|
//#endregion
|
|
107
|
-
|
|
102
|
+
export {};
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=cli.mjs.map
|
package/dist/cli.mjs.map
ADDED
|
@@ -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 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;;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,KA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B,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"}
|
|
@@ -83,10 +83,9 @@ interface VitePluginConfig {
|
|
|
83
83
|
* @default ['node_modules/**', 'dist/**', '.git/**']
|
|
84
84
|
*/
|
|
85
85
|
ignorePatterns?: string[];
|
|
86
|
-
}
|
|
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
|
*/
|
|
@@ -95,6 +94,11 @@ interface LinterConfig {
|
|
|
95
94
|
* Enable linting
|
|
96
95
|
*/
|
|
97
96
|
enabled?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Built-in lint preset
|
|
99
|
+
* @default 'happy-path'
|
|
100
|
+
*/
|
|
101
|
+
preset?: LintPreset;
|
|
98
102
|
/**
|
|
99
103
|
* Rules to enable/disable
|
|
100
104
|
*/
|
|
@@ -222,10 +226,9 @@ interface LspConfig {
|
|
|
222
226
|
* @default false
|
|
223
227
|
*/
|
|
224
228
|
tsgo?: boolean;
|
|
225
|
-
}
|
|
229
|
+
}
|
|
230
|
+
//#endregion
|
|
226
231
|
//#region src/types/musea.d.ts
|
|
227
|
-
|
|
228
|
-
//# sourceMappingURL=tools.d.ts.map
|
|
229
232
|
/**
|
|
230
233
|
* VRT (Visual Regression Testing) configuration for Musea
|
|
231
234
|
*/
|
|
@@ -319,10 +322,9 @@ interface MuseaConfig {
|
|
|
319
322
|
* Autogen configuration
|
|
320
323
|
*/
|
|
321
324
|
autogen?: MuseaAutogenConfig;
|
|
322
|
-
}
|
|
325
|
+
}
|
|
326
|
+
//#endregion
|
|
323
327
|
//#region src/types/loader.d.ts
|
|
324
|
-
|
|
325
|
-
//# sourceMappingURL=musea.d.ts.map
|
|
326
328
|
/**
|
|
327
329
|
* Global type declaration
|
|
328
330
|
*/
|
|
@@ -361,10 +363,8 @@ interface LoadConfigOptions {
|
|
|
361
363
|
*/
|
|
362
364
|
env?: ConfigEnv;
|
|
363
365
|
}
|
|
364
|
-
|
|
365
366
|
//#endregion
|
|
366
367
|
//#region src/types/core.d.ts
|
|
367
|
-
//# sourceMappingURL=loader.d.ts.map
|
|
368
368
|
type MaybePromise<T> = T | Promise<T>;
|
|
369
369
|
interface ConfigEnv {
|
|
370
370
|
mode: string;
|
|
@@ -374,6 +374,7 @@ interface ConfigEnv {
|
|
|
374
374
|
type UserConfigExport = VizeConfig | ((env: ConfigEnv) => MaybePromise<VizeConfig>);
|
|
375
375
|
type RuleSeverity = "off" | "warn" | "error";
|
|
376
376
|
type RuleCategory = "correctness" | "suspicious" | "style" | "perf" | "a11y" | "security";
|
|
377
|
+
type LintPreset = "happy-path" | "opinionated" | "essential" | "nuxt";
|
|
377
378
|
/**
|
|
378
379
|
* Vize configuration options
|
|
379
380
|
*/
|
|
@@ -411,10 +412,8 @@ interface VizeConfig {
|
|
|
411
412
|
*/
|
|
412
413
|
globalTypes?: GlobalTypesConfig;
|
|
413
414
|
}
|
|
414
|
-
|
|
415
415
|
//#endregion
|
|
416
416
|
//#region src/config.d.ts
|
|
417
|
-
//# sourceMappingURL=core.d.ts.map
|
|
418
417
|
/**
|
|
419
418
|
* Define a Vize configuration with type checking.
|
|
420
419
|
* Accepts a plain object or a function that receives ConfigEnv.
|
|
@@ -428,9 +427,6 @@ declare function loadConfig(root: string, options?: LoadConfigOptions): Promise<
|
|
|
428
427
|
* Normalize GlobalTypesConfig shorthand strings to GlobalTypeDeclaration objects
|
|
429
428
|
*/
|
|
430
429
|
declare function normalizeGlobalTypes(config: GlobalTypesConfig): Record<string, GlobalTypeDeclaration>;
|
|
431
|
-
|
|
432
430
|
//#endregion
|
|
433
|
-
|
|
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
|
|
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-DBaKDK6P.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-DBaKDK6P.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,QAAA;AAAA;;;;UAUe,eAAA;EAlDiB;;;;EAuDhC,UAAA;EAtCA;;;;EA4CA,QAAA;EArBQ;;AAUV;;EAiBE,OAAA;EAjB8B;;;;EAuB9B,IAAA;EAMA;;;;EAAA,WAAA;E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,SAAA,KAAc,YAAA,CAAa,UAAA;AAAA,KAMlE,YAAA;AAAA,KAEA,YAAA;AAAA,KAEA,UAAA;;;;UASK,UAAA;EJ6CgB;;;EIzC/B,QAAA,GAAW,cAAA;EJoDQ;;;EI/CnB,IAAA,GAAO,gBAAA;EJyCP;;;EIpCA,MAAA,GAAS,YAAA;EJ0CU;;;EIrCnB,WAAA,GAAc,iBAAA;EJiDA;;;EI5Cd,SAAA,GAAY,eAAA;;AHpDd;;EGyDE,GAAA,GAAM,SAAA;EH/CG;;;EGoDT,KAAA,GAAQ,WAAA;EH1CkC;;;EG+C1C,WAAA,GAAc,iBAAA;AAAA;;;AJrEhB;;;;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"}
|
|
@@ -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
|
|
37
|
-
if (!configPath
|
|
38
|
-
return loadConfigFile(configPath
|
|
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
|
|
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
|
|
98
|
-
|
|
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
|
|
110
|
-
|
|
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
|
-
|
|
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,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,QAAQ,SAAS;CACvC,MAAM,OAAO,KAAK,MAAM,WAAW,CAAC;AAEpC,QAAO,eAAe,MAAM;EAC1B,MAAM,aAAa,oBAAoB,WAAW;AAClD,MAAI,WACF,QAAO;AAET,eAAa,KAAK,QAAQ,WAAW;;AAGvC,QAAO;;;;;AAMT,eAAe,eAAe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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-DBaKDK6P.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 };
|
package/dist/index.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vize",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Vize - High-performance Vue.js toolchain in Rust",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
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
|
-
"
|
|
22
|
-
"
|
|
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
|
-
"
|
|
62
|
-
"
|
|
48
|
+
"typescript": "~5.6.0",
|
|
49
|
+
"vite-plus": "latest"
|
|
50
|
+
},
|
|
51
|
+
"optionalDependencies": {
|
|
52
|
+
"@vizejs/native-darwin-arm64": "0.37.0",
|
|
53
|
+
"@vizejs/native-darwin-x64": "0.37.0",
|
|
54
|
+
"@vizejs/native-linux-arm64-gnu": "0.37.0",
|
|
55
|
+
"@vizejs/native-linux-arm64-musl": "0.37.0",
|
|
56
|
+
"@vizejs/native-linux-x64-gnu": "0.37.0",
|
|
57
|
+
"@vizejs/native-linux-x64-musl": "0.37.0",
|
|
58
|
+
"@vizejs/native-win32-arm64-msvc": "0.37.0",
|
|
59
|
+
"@vizejs/native-win32-x64-msvc": "0.37.0"
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=18"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
|
-
"build": "
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"fmt": "
|
|
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/src/cli.ts
CHANGED
|
@@ -66,6 +66,7 @@ interface NativeBinding {
|
|
|
66
66
|
quiet?: boolean;
|
|
67
67
|
fix?: boolean;
|
|
68
68
|
help_level?: string;
|
|
69
|
+
preset?: string;
|
|
69
70
|
},
|
|
70
71
|
) => LintResult;
|
|
71
72
|
}
|
|
@@ -91,6 +92,7 @@ interface LintOptions {
|
|
|
91
92
|
quiet?: boolean;
|
|
92
93
|
fix?: boolean;
|
|
93
94
|
helpLevel?: string;
|
|
95
|
+
preset?: string;
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
interface LintResult {
|
|
@@ -117,6 +119,8 @@ function runLint(args: string[]): void {
|
|
|
117
119
|
options.fix = true;
|
|
118
120
|
} else if (arg === "--help-level") {
|
|
119
121
|
options.helpLevel = args[++i];
|
|
122
|
+
} else if (arg === "--preset") {
|
|
123
|
+
options.preset = args[++i];
|
|
120
124
|
} else if (!arg.startsWith("-")) {
|
|
121
125
|
patterns.push(arg);
|
|
122
126
|
}
|
|
@@ -133,6 +137,7 @@ function runLint(args: string[]): void {
|
|
|
133
137
|
quiet: options.quiet,
|
|
134
138
|
fix: options.fix,
|
|
135
139
|
help_level: options.helpLevel,
|
|
140
|
+
preset: options.preset,
|
|
136
141
|
});
|
|
137
142
|
|
|
138
143
|
if (result.output) {
|
package/src/index.ts
CHANGED
package/src/types/core.ts
CHANGED
|
@@ -26,6 +26,8 @@ export type RuleSeverity = "off" | "warn" | "error";
|
|
|
26
26
|
|
|
27
27
|
export type RuleCategory = "correctness" | "suspicious" | "style" | "perf" | "a11y" | "security";
|
|
28
28
|
|
|
29
|
+
export type LintPreset = "happy-path" | "opinionated" | "essential" | "nuxt";
|
|
30
|
+
|
|
29
31
|
// ============================================================================
|
|
30
32
|
// VizeConfig
|
|
31
33
|
// ============================================================================
|
package/src/types/index.ts
CHANGED
package/src/types/tools.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RuleSeverity, RuleCategory } from "./core.js";
|
|
1
|
+
import type { LintPreset, RuleSeverity, RuleCategory } from "./core.js";
|
|
2
2
|
|
|
3
3
|
// ============================================================================
|
|
4
4
|
// LinterConfig
|
|
@@ -13,6 +13,12 @@ export interface LinterConfig {
|
|
|
13
13
|
*/
|
|
14
14
|
enabled?: boolean;
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Built-in lint preset
|
|
18
|
+
* @default 'happy-path'
|
|
19
|
+
*/
|
|
20
|
+
preset?: LintPreset;
|
|
21
|
+
|
|
16
22
|
/**
|
|
17
23
|
* Rules to enable/disable
|
|
18
24
|
*/
|
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,qCA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AM,UAAU,KAAK;AAErB,MAAK,SAAS;AACZ,UAAQ,MAAM,kCAAkC;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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A,EAAA,OAAA,CAAA,EK5CtB,iBL4CsB,CAAA,EK3C9B,OL2C8B,CK3CtB,UL2CsB,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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AMC,WAA6B,OAAO,WAAW;AACrD,SAAO,oBAAoB,UAAU,IAAI;CAC1C,UAAS;AACR,KAAG,WAAW,SAAS;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
package/dist/config.js
DELETED
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
|
File without changes
|