vize 0.58.0 → 0.60.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 +5 -3
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +217 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/config-DkggCaE5.d.mts +519 -0
- package/dist/config-DkggCaE5.d.mts.map +1 -0
- package/dist/config.d.mts +2 -0
- package/dist/config.mjs +156 -0
- package/dist/config.mjs.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +2 -0
- package/package.json +9 -9
- package/pkl/vize.pkl +1 -0
- package/schemas/vize.config.schema.json +3 -0
- package/src/types/compiler.ts +7 -0
package/README.md
CHANGED
|
@@ -9,10 +9,12 @@ For Vite integration, pair it with `@vizejs/vite-plugin`.
|
|
|
9
9
|
For the full Rust-native CLI (`build`, `fmt`, `check`, `lsp`, `ide`), install the Rust `vize`
|
|
10
10
|
binary with `cargo install vize`.
|
|
11
11
|
|
|
12
|
+
Need `vp` first? Install Vite+ once from the [Vite+ install guide](https://viteplus.dev/guide/install).
|
|
13
|
+
|
|
12
14
|
## Installation
|
|
13
15
|
|
|
14
16
|
```bash
|
|
15
|
-
|
|
17
|
+
vp install -D vize
|
|
16
18
|
```
|
|
17
19
|
|
|
18
20
|
## CLI
|
|
@@ -20,8 +22,8 @@ pnpm add -D vize
|
|
|
20
22
|
The npm CLI currently exposes `lint`:
|
|
21
23
|
|
|
22
24
|
```bash
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
vp exec vize lint src
|
|
26
|
+
vp exec vize lint --preset opinionated --help-level short src
|
|
25
27
|
```
|
|
26
28
|
|
|
27
29
|
Shared config discovery is supported for the npm CLI:
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { loadConfig } from "./config.mjs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import { spawnSync } from "node:child_process";
|
|
6
|
+
import { pathToFileURL } from "node:url";
|
|
7
|
+
//#region src/cli.ts
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
const WORKSPACE_BINDING_PATH = "../../vize-native";
|
|
10
|
+
function isMusl() {
|
|
11
|
+
const report = process.report?.getReport();
|
|
12
|
+
if (typeof report === "object" && report !== null && "header" in report) return !report.header.glibcVersionRuntime;
|
|
13
|
+
try {
|
|
14
|
+
return readFileSync(require("child_process").execSync("which ldd").toString().trim(), "utf8").includes("musl");
|
|
15
|
+
} catch {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function getBindingPackageName() {
|
|
20
|
+
const { platform, arch } = process;
|
|
21
|
+
switch (platform) {
|
|
22
|
+
case "darwin": switch (arch) {
|
|
23
|
+
case "x64": return "@vizejs/native-darwin-x64";
|
|
24
|
+
case "arm64": return "@vizejs/native-darwin-arm64";
|
|
25
|
+
default: throw new Error(`Unsupported architecture on macOS: ${arch}`);
|
|
26
|
+
}
|
|
27
|
+
case "win32": switch (arch) {
|
|
28
|
+
case "x64": return "@vizejs/native-win32-x64-msvc";
|
|
29
|
+
case "arm64": return "@vizejs/native-win32-arm64-msvc";
|
|
30
|
+
default: throw new Error(`Unsupported architecture on Windows: ${arch}`);
|
|
31
|
+
}
|
|
32
|
+
case "linux": switch (arch) {
|
|
33
|
+
case "x64": return isMusl() ? "@vizejs/native-linux-x64-musl" : "@vizejs/native-linux-x64-gnu";
|
|
34
|
+
case "arm64": return isMusl() ? "@vizejs/native-linux-arm64-musl" : "@vizejs/native-linux-arm64-gnu";
|
|
35
|
+
default: throw new Error(`Unsupported architecture on Linux: ${arch}`);
|
|
36
|
+
}
|
|
37
|
+
default: throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function loadNative() {
|
|
41
|
+
const attemptedPackages = getAttemptedPackages();
|
|
42
|
+
let lastError = null;
|
|
43
|
+
for (const packageName of attemptedPackages) try {
|
|
44
|
+
const binding = require(packageName);
|
|
45
|
+
if (typeof binding.lint !== "function") throw new Error(`${packageName} does not expose the lint binding.`);
|
|
46
|
+
return binding;
|
|
47
|
+
} catch (error) {
|
|
48
|
+
lastError = error;
|
|
49
|
+
}
|
|
50
|
+
console.error(`Failed to load native binding. Tried: ${attemptedPackages.join(", ")}`);
|
|
51
|
+
console.error("Try reinstalling: npm install vize");
|
|
52
|
+
throw lastError instanceof Error ? lastError : /* @__PURE__ */ new Error("Failed to load native binding");
|
|
53
|
+
}
|
|
54
|
+
function getAttemptedPackages() {
|
|
55
|
+
const platformBindingPackage = getBindingPackageName();
|
|
56
|
+
return shouldPreferWorkspaceBinding(resolveWorkspaceBindingPath()) ? [WORKSPACE_BINDING_PATH, platformBindingPackage] : [platformBindingPackage, WORKSPACE_BINDING_PATH];
|
|
57
|
+
}
|
|
58
|
+
function resolveWorkspaceBindingPath() {
|
|
59
|
+
try {
|
|
60
|
+
return require.resolve(WORKSPACE_BINDING_PATH);
|
|
61
|
+
} catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function shouldPreferWorkspaceBinding(resolvedPath) {
|
|
66
|
+
const override = process.env.VIZE_PREFER_WORKSPACE_BINDING;
|
|
67
|
+
if (override === "1" || override === "true") return true;
|
|
68
|
+
if (override === "0" || override === "false") return false;
|
|
69
|
+
if (resolvedPath == null) return false;
|
|
70
|
+
return resolvedPath.includes(`${path.sep}npm${path.sep}vize-native${path.sep}`);
|
|
71
|
+
}
|
|
72
|
+
function printUsage() {
|
|
73
|
+
console.error("Usage: vize <command> [options]");
|
|
74
|
+
console.error("Commands: lint, musea");
|
|
75
|
+
}
|
|
76
|
+
function resolvePackageBinaryFromCwd(packageName, binName = packageName) {
|
|
77
|
+
const packageJsonPath = createRequire(pathToFileURL(path.join(process.cwd(), "package.json")).href).resolve(`${packageName}/package.json`);
|
|
78
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
79
|
+
const bin = typeof packageJson.bin === "string" ? packageJson.bin : packageJson.bin?.[binName];
|
|
80
|
+
if (!bin) throw new Error(`Could not resolve binary '${binName}' from package '${packageName}'`);
|
|
81
|
+
return path.resolve(path.dirname(packageJsonPath), bin);
|
|
82
|
+
}
|
|
83
|
+
function runMusea(args) {
|
|
84
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
85
|
+
console.error("Usage: vize musea [--build] [...vite options]");
|
|
86
|
+
console.error(" --build Run `vite build` instead of `vite dev`");
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const isBuild = args.includes("--build");
|
|
90
|
+
const viteArgs = args.filter((arg) => arg !== "--build");
|
|
91
|
+
const viteCommand = isBuild ? "build" : "dev";
|
|
92
|
+
const viteBin = resolvePackageBinaryFromCwd("vite");
|
|
93
|
+
const result = spawnSync(process.execPath, [
|
|
94
|
+
viteBin,
|
|
95
|
+
viteCommand,
|
|
96
|
+
...viteArgs
|
|
97
|
+
], {
|
|
98
|
+
stdio: "inherit",
|
|
99
|
+
cwd: process.cwd(),
|
|
100
|
+
env: process.env
|
|
101
|
+
});
|
|
102
|
+
if (result.error) throw result.error;
|
|
103
|
+
process.exit(result.status ?? 1);
|
|
104
|
+
}
|
|
105
|
+
function parseLintCommand(args) {
|
|
106
|
+
const patterns = [];
|
|
107
|
+
const options = {};
|
|
108
|
+
const sharedConfig = { configMode: "root" };
|
|
109
|
+
for (let i = 0; i < args.length; i++) {
|
|
110
|
+
const arg = args[i];
|
|
111
|
+
if (arg === "--format" || arg === "-f") options.format = args[++i];
|
|
112
|
+
else if (arg === "--max-warnings") options.maxWarnings = Number.parseInt(args[++i], 10);
|
|
113
|
+
else if (arg === "--quiet" || arg === "-q") options.quiet = true;
|
|
114
|
+
else if (arg === "--fix") options.fix = true;
|
|
115
|
+
else if (arg === "--help-level") options.helpLevel = args[++i];
|
|
116
|
+
else if (arg === "--preset") options.preset = args[++i];
|
|
117
|
+
else if (arg === "--config" || arg === "-c") {
|
|
118
|
+
const configFile = args[++i];
|
|
119
|
+
if (!configFile) throw new Error("Missing path after --config");
|
|
120
|
+
sharedConfig.configFile = configFile;
|
|
121
|
+
} else if (arg === "--no-config") sharedConfig.configMode = "none";
|
|
122
|
+
else if (!arg.startsWith("-")) patterns.push(arg);
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
patterns,
|
|
126
|
+
options,
|
|
127
|
+
sharedConfig
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
async function runLint(args) {
|
|
131
|
+
const { patterns, options, sharedConfig } = parseLintCommand(args);
|
|
132
|
+
const config = await loadConfig(process.cwd(), {
|
|
133
|
+
mode: sharedConfig.configMode,
|
|
134
|
+
configFile: sharedConfig.configFile,
|
|
135
|
+
env: {
|
|
136
|
+
mode: process.env.NODE_ENV ?? "development",
|
|
137
|
+
command: "lint"
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
if (sharedConfig.configFile && !config) throw new Error(`Could not find config file: ${sharedConfig.configFile}`);
|
|
141
|
+
if (config?.linter?.enabled === false) {
|
|
142
|
+
process.stderr.write("[vize] Skipping lint because linter.enabled is false in vize.config.\n");
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
options.preset ??= config?.linter?.preset;
|
|
146
|
+
if (patterns.length === 0) patterns.push(".");
|
|
147
|
+
const result = loadNative().lint(patterns, {
|
|
148
|
+
format: options.format,
|
|
149
|
+
max_warnings: options.maxWarnings,
|
|
150
|
+
quiet: options.quiet,
|
|
151
|
+
fix: options.fix,
|
|
152
|
+
help_level: options.helpLevel,
|
|
153
|
+
preset: options.preset
|
|
154
|
+
});
|
|
155
|
+
if (result.output) {
|
|
156
|
+
process.stdout.write(result.output);
|
|
157
|
+
if (!result.output.endsWith("\n")) process.stdout.write("\n");
|
|
158
|
+
}
|
|
159
|
+
if (options.fix) process.stderr.write("\nNote: --fix is not yet implemented\n");
|
|
160
|
+
if (result.errorCount > 0) process.exit(1);
|
|
161
|
+
if (options.maxWarnings !== void 0 && result.warningCount > options.maxWarnings) {
|
|
162
|
+
process.stderr.write(`\nToo many warnings (${result.warningCount} > max ${options.maxWarnings})\n`);
|
|
163
|
+
process.exit(1);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const NAPI_COMMANDS = new Set(["lint"]);
|
|
167
|
+
const JS_COMMANDS = new Set(["musea"]);
|
|
168
|
+
async function main() {
|
|
169
|
+
const args = process.argv.slice(2);
|
|
170
|
+
const command = args[0];
|
|
171
|
+
if (!command || command === "--help" || command === "-h") {
|
|
172
|
+
printUsage();
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
if (NAPI_COMMANDS.has(command)) {
|
|
176
|
+
const commandArgs = args.slice(1);
|
|
177
|
+
switch (command) {
|
|
178
|
+
case "lint":
|
|
179
|
+
await runLint(commandArgs);
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
} else if (JS_COMMANDS.has(command)) {
|
|
183
|
+
const commandArgs = args.slice(1);
|
|
184
|
+
switch (command) {
|
|
185
|
+
case "musea":
|
|
186
|
+
runMusea(commandArgs);
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
} else {
|
|
190
|
+
printUsage();
|
|
191
|
+
console.error(`Unknown command: ${command}`);
|
|
192
|
+
console.error("For commands not yet available via NAPI, install from source: cargo install vize");
|
|
193
|
+
process.exit(1);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (!import.meta.vitest) main().catch((error) => {
|
|
197
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
198
|
+
process.exit(1);
|
|
199
|
+
});
|
|
200
|
+
if (import.meta.vitest) {
|
|
201
|
+
const { describe, expect, it } = import.meta.vitest;
|
|
202
|
+
describe("shouldPreferWorkspaceBinding", () => {
|
|
203
|
+
it("detects the local workspace native package", () => {
|
|
204
|
+
expect(shouldPreferWorkspaceBinding(`${path.sep}Users${path.sep}example${path.sep}repo${path.sep}npm${path.sep}vize-native${path.sep}index.js`)).toBe(true);
|
|
205
|
+
});
|
|
206
|
+
it("ignores published platform packages", () => {
|
|
207
|
+
expect(shouldPreferWorkspaceBinding(`${path.sep}repo${path.sep}node_modules${path.sep}.pnpm${path.sep}@vizejs+native-darwin-arm64${path.sep}node_modules${path.sep}@vizejs${path.sep}native-darwin-arm64${path.sep}index.js`)).toBe(false);
|
|
208
|
+
});
|
|
209
|
+
it("returns false when the fallback package cannot be resolved", () => {
|
|
210
|
+
expect(shouldPreferWorkspaceBinding(null)).toBe(false);
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
215
|
+
export {};
|
|
216
|
+
|
|
217
|
+
//# 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 { readFileSync } from \"node:fs\";\nimport { spawnSync } from \"node:child_process\";\nimport * as path from \"node:path\";\nimport { createRequire } from \"node:module\";\nimport { pathToFileURL } from \"node:url\";\nimport { loadConfig } from \"./config.js\";\n\nconst require = createRequire(import.meta.url);\nconst WORKSPACE_BINDING_PATH = \"../../vize-native\";\n\n// ============================================================================\n// Native binding loader (oxlint pattern)\n// ============================================================================\n\nfunction isMusl(): boolean {\n const report = process.report?.getReport();\n if (typeof report === \"object\" && report !== null && \"header\" in report) {\n const header = (report as { header: { glibcVersionRuntime?: string } }).header;\n return !header.glibcVersionRuntime;\n }\n try {\n const lddPath = require(\"child_process\").execSync(\"which ldd\").toString().trim();\n return readFileSync(lddPath, \"utf8\").includes(\"musl\");\n } catch {\n return true;\n }\n}\n\nfunction getBindingPackageName(): string {\n const { platform, arch } = process;\n\n switch (platform) {\n case \"darwin\":\n switch (arch) {\n case \"x64\":\n return \"@vizejs/native-darwin-x64\";\n case \"arm64\":\n return \"@vizejs/native-darwin-arm64\";\n default:\n throw new Error(`Unsupported architecture on macOS: ${arch}`);\n }\n case \"win32\":\n switch (arch) {\n case \"x64\":\n return \"@vizejs/native-win32-x64-msvc\";\n case \"arm64\":\n return \"@vizejs/native-win32-arm64-msvc\";\n default:\n throw new Error(`Unsupported architecture on Windows: ${arch}`);\n }\n case \"linux\":\n switch (arch) {\n case \"x64\":\n return isMusl() ? \"@vizejs/native-linux-x64-musl\" : \"@vizejs/native-linux-x64-gnu\";\n case \"arm64\":\n return isMusl() ? \"@vizejs/native-linux-arm64-musl\" : \"@vizejs/native-linux-arm64-gnu\";\n default:\n throw new Error(`Unsupported architecture on Linux: ${arch}`);\n }\n default:\n throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);\n }\n}\n\ninterface NativeBinding {\n 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 attemptedPackages = getAttemptedPackages();\n let lastError: unknown = null;\n\n for (const packageName of attemptedPackages) {\n try {\n const binding = require(packageName) as Partial<NativeBinding>;\n if (typeof binding.lint !== \"function\") {\n throw new Error(`${packageName} does not expose the lint binding.`);\n }\n return binding as NativeBinding;\n } catch (error) {\n lastError = error;\n }\n }\n\n console.error(`Failed to load native binding. Tried: ${attemptedPackages.join(\", \")}`);\n console.error(\"Try reinstalling: npm install vize\");\n throw lastError instanceof Error ? lastError : new Error(\"Failed to load native binding\");\n}\n\nfunction getAttemptedPackages(): readonly string[] {\n const platformBindingPackage = getBindingPackageName();\n return shouldPreferWorkspaceBinding(resolveWorkspaceBindingPath())\n ? [WORKSPACE_BINDING_PATH, platformBindingPackage]\n : [platformBindingPackage, WORKSPACE_BINDING_PATH];\n}\n\nfunction resolveWorkspaceBindingPath(): string | null {\n try {\n return require.resolve(WORKSPACE_BINDING_PATH);\n } catch {\n return null;\n }\n}\n\nfunction shouldPreferWorkspaceBinding(resolvedPath: string | null): boolean {\n const override = process.env.VIZE_PREFER_WORKSPACE_BINDING;\n if (override === \"1\" || override === \"true\") {\n return true;\n }\n if (override === \"0\" || override === \"false\") {\n return false;\n }\n if (resolvedPath == null) {\n return false;\n }\n\n return resolvedPath.includes(`${path.sep}npm${path.sep}vize-native${path.sep}`);\n}\n\n// ============================================================================\n// Lint command\n// ============================================================================\n\ninterface LintOptions {\n format?: string;\n maxWarnings?: number;\n quiet?: boolean;\n fix?: boolean;\n helpLevel?: string;\n preset?: string;\n}\n\ninterface LintResult {\n output: string;\n errorCount: number;\n warningCount: number;\n fileCount: number;\n timeMs: number;\n}\n\ninterface SharedConfigOptions {\n configFile?: string;\n configMode: \"root\" | \"none\";\n}\n\ninterface ParsedLintCommand {\n patterns: string[];\n options: LintOptions;\n sharedConfig: SharedConfigOptions;\n}\n\nfunction printUsage(): void {\n console.error(\"Usage: vize <command> [options]\");\n console.error(\"Commands: lint, musea\");\n}\n\nfunction resolvePackageBinaryFromCwd(packageName: string, binName: string = packageName): string {\n const cwdRequire = createRequire(pathToFileURL(path.join(process.cwd(), \"package.json\")).href);\n const packageJsonPath = cwdRequire.resolve(`${packageName}/package.json`);\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as {\n bin?: string | Record<string, string>;\n };\n\n const bin = typeof packageJson.bin === \"string\" ? packageJson.bin : packageJson.bin?.[binName];\n\n if (!bin) {\n throw new Error(`Could not resolve binary '${binName}' from package '${packageName}'`);\n }\n\n return path.resolve(path.dirname(packageJsonPath), bin);\n}\n\nfunction runMusea(args: string[]): void {\n const isHelp = args.includes(\"--help\") || args.includes(\"-h\");\n if (isHelp) {\n console.error(\"Usage: vize musea [--build] [...vite options]\");\n console.error(\" --build Run `vite build` instead of `vite dev`\");\n return;\n }\n\n const isBuild = args.includes(\"--build\");\n const viteArgs = args.filter((arg) => arg !== \"--build\");\n const viteCommand = isBuild ? \"build\" : \"dev\";\n const viteBin = resolvePackageBinaryFromCwd(\"vite\");\n const result = spawnSync(process.execPath, [viteBin, viteCommand, ...viteArgs], {\n stdio: \"inherit\",\n cwd: process.cwd(),\n env: process.env,\n });\n\n if (result.error) {\n throw result.error;\n }\n\n process.exit(result.status ?? 1);\n}\n\nfunction parseLintCommand(args: string[]): ParsedLintCommand {\n const patterns: string[] = [];\n const options: LintOptions = {};\n const sharedConfig: SharedConfigOptions = {\n configMode: \"root\",\n };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === \"--format\" || arg === \"-f\") {\n options.format = args[++i];\n } else if (arg === \"--max-warnings\") {\n options.maxWarnings = Number.parseInt(args[++i], 10);\n } else if (arg === \"--quiet\" || arg === \"-q\") {\n options.quiet = true;\n } else if (arg === \"--fix\") {\n options.fix = true;\n } else if (arg === \"--help-level\") {\n options.helpLevel = args[++i];\n } else if (arg === \"--preset\") {\n options.preset = args[++i];\n } else if (arg === \"--config\" || arg === \"-c\") {\n const configFile = args[++i];\n if (!configFile) {\n throw new Error(\"Missing path after --config\");\n }\n sharedConfig.configFile = configFile;\n } else if (arg === \"--no-config\") {\n sharedConfig.configMode = \"none\";\n } else if (!arg.startsWith(\"-\")) {\n patterns.push(arg);\n }\n }\n\n return { patterns, options, sharedConfig };\n}\n\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\"]);\nconst JS_COMMANDS = new Set([\"musea\"]);\n\nasync function main(): Promise<void> {\n const args = process.argv.slice(2);\n const command = args[0];\n\n if (!command || command === \"--help\" || command === \"-h\") {\n printUsage();\n process.exit(1);\n }\n\n if (NAPI_COMMANDS.has(command)) {\n const commandArgs = args.slice(1);\n switch (command) {\n case \"lint\":\n await runLint(commandArgs);\n break;\n }\n } else if (JS_COMMANDS.has(command)) {\n const commandArgs = args.slice(1);\n switch (command) {\n case \"musea\":\n runMusea(commandArgs);\n break;\n }\n } else {\n printUsage();\n console.error(`Unknown command: ${command}`);\n console.error(\n \"For commands not yet available via NAPI, install from source: cargo install vize\",\n );\n process.exit(1);\n }\n}\n\nif (!import.meta.vitest) {\n void main().catch((error) => {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n });\n}\n\nif (import.meta.vitest) {\n const { describe, expect, it } = import.meta.vitest;\n\n describe(\"shouldPreferWorkspaceBinding\", () => {\n it(\"detects the local workspace native package\", () => {\n expect(\n shouldPreferWorkspaceBinding(\n `${path.sep}Users${path.sep}example${path.sep}repo${path.sep}npm${path.sep}vize-native${path.sep}index.js`,\n ),\n ).toBe(true);\n });\n\n it(\"ignores published platform packages\", () => {\n expect(\n shouldPreferWorkspaceBinding(\n `${path.sep}repo${path.sep}node_modules${path.sep}.pnpm${path.sep}@vizejs+native-darwin-arm64${path.sep}node_modules${path.sep}@vizejs${path.sep}native-darwin-arm64${path.sep}index.js`,\n ),\n ).toBe(false);\n });\n\n it(\"returns false when the fallback package cannot be resolved\", () => {\n expect(shouldPreferWorkspaceBinding(null)).toBe(false);\n });\n });\n}\n"],"mappings":";;;;;;;AAOA,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAC9C,MAAM,yBAAyB;AAM/B,SAAS,SAAkB;CACzB,MAAM,SAAS,QAAQ,QAAQ,WAAW;AAC1C,KAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,YAAY,OAE/D,QAAO,CADS,OAAwD,OACzD;AAEjB,KAAI;AAEF,SAAO,aADS,QAAQ,gBAAgB,CAAC,SAAS,YAAY,CAAC,UAAU,CAAC,MAAM,EACnD,OAAO,CAAC,SAAS,OAAO;SAC/C;AACN,SAAO;;;AAIX,SAAS,wBAAgC;CACvC,MAAM,EAAE,UAAU,SAAS;AAE3B,SAAQ,UAAR;EACE,KAAK,SACH,SAAQ,MAAR;GACE,KAAK,MACH,QAAO;GACT,KAAK,QACH,QAAO;GACT,QACE,OAAM,IAAI,MAAM,sCAAsC,OAAO;;EAEnE,KAAK,QACH,SAAQ,MAAR;GACE,KAAK,MACH,QAAO;GACT,KAAK,QACH,QAAO;GACT,QACE,OAAM,IAAI,MAAM,wCAAwC,OAAO;;EAErE,KAAK,QACH,SAAQ,MAAR;GACE,KAAK,MACH,QAAO,QAAQ,GAAG,kCAAkC;GACtD,KAAK,QACH,QAAO,QAAQ,GAAG,oCAAoC;GACxD,QACE,OAAM,IAAI,MAAM,sCAAsC,OAAO;;EAEnE,QACE,OAAM,IAAI,MAAM,mBAAmB,SAAS,kBAAkB,OAAO;;;AAkB3E,SAAS,aAA4B;CACnC,MAAM,oBAAoB,sBAAsB;CAChD,IAAI,YAAqB;AAEzB,MAAK,MAAM,eA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AAoE;AACrE,UAAO,6BAA6B,KAAK,CAAC,CAAC,KAAK,MAAM;IACtD;GACF"}
|
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
//#region src/types/compiler.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Compiler configuration
|
|
4
|
+
*/
|
|
5
|
+
interface CompilerConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Compilation mode
|
|
8
|
+
* @default 'module'
|
|
9
|
+
*/
|
|
10
|
+
mode?: "module" | "function";
|
|
11
|
+
/**
|
|
12
|
+
* Enable Vapor mode compilation
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
vapor?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Treat lowercase non-HTML tags as custom renderer elements instead of Vue components.
|
|
18
|
+
* Useful for TresJS and other custom renderers.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
customRenderer?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Enable SSR mode
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
ssr?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Enable source map generation
|
|
29
|
+
* @default true in development, false in production
|
|
30
|
+
*/
|
|
31
|
+
sourceMap?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Prefix template identifiers with _ctx
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
prefixIdentifiers?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Hoist static nodes
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
hoistStatic?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Cache v-on handlers
|
|
44
|
+
* @default true
|
|
45
|
+
*/
|
|
46
|
+
cacheHandlers?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Enable TypeScript parsing in <script> blocks
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
isTs?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Script file extension for generated output
|
|
54
|
+
* @default 'ts'
|
|
55
|
+
*/
|
|
56
|
+
scriptExt?: "ts" | "js";
|
|
57
|
+
/**
|
|
58
|
+
* Module name for runtime imports
|
|
59
|
+
* @default 'vue'
|
|
60
|
+
*/
|
|
61
|
+
runtimeModuleName?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Global variable name for runtime (IIFE builds)
|
|
64
|
+
* @default 'Vue'
|
|
65
|
+
*/
|
|
66
|
+
runtimeGlobalName?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Vite plugin configuration
|
|
70
|
+
*/
|
|
71
|
+
interface VitePluginConfig {
|
|
72
|
+
/**
|
|
73
|
+
* Files to include in compilation
|
|
74
|
+
* @default /\.vue$/
|
|
75
|
+
*/
|
|
76
|
+
include?: string | RegExp | (string | RegExp)[];
|
|
77
|
+
/**
|
|
78
|
+
* Files to exclude from compilation
|
|
79
|
+
* @default /node_modules/
|
|
80
|
+
*/
|
|
81
|
+
exclude?: string | RegExp | (string | RegExp)[];
|
|
82
|
+
/**
|
|
83
|
+
* Glob patterns to scan for .vue files during pre-compilation
|
|
84
|
+
* @default ['**\/*.vue']
|
|
85
|
+
*/
|
|
86
|
+
scanPatterns?: string[];
|
|
87
|
+
/**
|
|
88
|
+
* Glob patterns to ignore during pre-compilation
|
|
89
|
+
* @default ['node_modules/**', 'dist/**', '.git/**']
|
|
90
|
+
*/
|
|
91
|
+
ignorePatterns?: string[];
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/types/rules.d.ts
|
|
95
|
+
declare const LINT_RULE_NAMES: readonly ["a11y/alt-text", "a11y/anchor-has-content", "a11y/anchor-is-valid", "a11y/aria-props", "a11y/aria-role", "a11y/aria-unsupported-elements", "a11y/click-events-have-key-events", "a11y/form-control-has-label", "a11y/heading-has-content", "a11y/heading-levels", "a11y/iframe-has-title", "a11y/img-alt", "a11y/interactive-supports-focus", "a11y/label-has-for", "a11y/landmark-roles", "a11y/media-has-caption", "a11y/mouse-events-have-key-events", "a11y/no-access-key", "a11y/no-aria-hidden-on-focusable", "a11y/no-autofocus", "a11y/no-distracting-elements", "a11y/no-i-for-icon", "a11y/no-redundant-roles", "a11y/no-refer-to-non-existent-id", "a11y/no-role-presentation-on-focusable", "a11y/no-static-element-interactions", "a11y/placeholder-label-option", "a11y/role-has-required-aria-props", "a11y/tabindex-no-positive", "a11y/use-list", "html/deprecated-attr", "html/deprecated-element", "html/id-duplication", "html/no-consecutive-br", "html/no-duplicate-dt", "html/no-empty-palpable-content", "html/require-datetime", "script/no-get-current-instance", "script/no-next-tick", "script/no-options-api", "ssr/no-browser-globals-in-ssr", "ssr/no-hydration-mismatch", "type/no-floating-promises", "type/no-unsafe-template-binding", "type/require-typed-emits", "type/require-typed-props", "vapor/no-inline-template", "vapor/no-suspense", "vapor/no-vue-lifecycle-events", "vapor/prefer-static-class", "vapor/require-vapor-attribute", "vue/attribute-hyphenation", "vue/attribute-order", "vue/component-definition-name-casing", "vue/component-name-in-template-casing", "vue/html-quotes", "vue/html-self-closing", "vue/multi-word-component-names", "vue/mustache-interpolation-spacing", "vue/no-boolean-attr-value", "vue/no-child-content", "vue/no-dupe-v-else-if", "vue/no-duplicate-attributes", "vue/no-inline-style", "vue/no-lone-template", "vue/no-multi-spaces", "vue/no-mutating-props", "vue/no-preprocessor-lang", "vue/no-reserved-component-names", "vue/no-script-non-standard-lang", "vue/no-src-attribute", "vue/no-template-key", "vue/no-template-lang", "vue/no-template-shadow", "vue/no-textarea-mustache", "vue/no-unsafe-url", "vue/no-unused-components", "vue/no-unused-properties", "vue/no-unused-vars", "vue/no-use-v-if-with-v-for", "vue/no-useless-template-attributes", "vue/no-v-html", "vue/no-v-text-v-html-on-component", "vue/permitted-contents", "vue/prefer-props-shorthand", "vue/prop-name-casing", "vue/require-component-is", "vue/require-component-registration", "vue/require-scoped-style", "vue/require-v-for-key", "vue/scoped-event-names", "vue/sfc-element-order", "vue/single-style-block", "vue/use-unique-element-ids", "vue/use-v-on-exact", "vue/v-bind-style", "vue/v-on-style", "vue/v-slot-style", "vue/valid-attribute-name", "vue/valid-v-bind", "vue/valid-v-else", "vue/valid-v-for", "vue/valid-v-if", "vue/valid-v-memo", "vue/valid-v-model", "vue/valid-v-on", "vue/valid-v-show", "vue/valid-v-slot", "vue/warn-custom-block", "vue/warn-custom-directive"];
|
|
96
|
+
type LintRuleName = (typeof LINT_RULE_NAMES)[number];
|
|
97
|
+
type LintRulesConfig = Partial<Record<LintRuleName, RuleSeverity>>;
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/types/tools.d.ts
|
|
100
|
+
/**
|
|
101
|
+
* Linter configuration
|
|
102
|
+
*/
|
|
103
|
+
interface LinterConfig {
|
|
104
|
+
/**
|
|
105
|
+
* Enable linting
|
|
106
|
+
*/
|
|
107
|
+
enabled?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Built-in lint preset
|
|
110
|
+
* @default 'happy-path'
|
|
111
|
+
*/
|
|
112
|
+
preset?: LintPreset;
|
|
113
|
+
/**
|
|
114
|
+
* Rules to enable/disable
|
|
115
|
+
*/
|
|
116
|
+
rules?: LintRulesConfig;
|
|
117
|
+
/**
|
|
118
|
+
* Category-level severity overrides
|
|
119
|
+
*/
|
|
120
|
+
categories?: Partial<Record<RuleCategory, RuleSeverity>>;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Type checker configuration
|
|
124
|
+
*/
|
|
125
|
+
interface TypeCheckerConfig {
|
|
126
|
+
/**
|
|
127
|
+
* Enable type checking
|
|
128
|
+
* @default false
|
|
129
|
+
*/
|
|
130
|
+
enabled?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Enable strict mode
|
|
133
|
+
* @default false
|
|
134
|
+
*/
|
|
135
|
+
strict?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Check component props
|
|
138
|
+
* @default true
|
|
139
|
+
*/
|
|
140
|
+
checkProps?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Check component emits
|
|
143
|
+
* @default true
|
|
144
|
+
*/
|
|
145
|
+
checkEmits?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Check template bindings
|
|
148
|
+
* @default true
|
|
149
|
+
*/
|
|
150
|
+
checkTemplateBindings?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Path to tsconfig.json
|
|
153
|
+
* @default auto-detected
|
|
154
|
+
*/
|
|
155
|
+
tsconfig?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Path to the Corsa binary
|
|
158
|
+
*/
|
|
159
|
+
corsaPath?: string;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Formatter configuration
|
|
163
|
+
*/
|
|
164
|
+
interface FormatterConfig {
|
|
165
|
+
/**
|
|
166
|
+
* Max line width
|
|
167
|
+
* @default 80
|
|
168
|
+
*/
|
|
169
|
+
printWidth?: number;
|
|
170
|
+
/**
|
|
171
|
+
* Indentation width
|
|
172
|
+
* @default 2
|
|
173
|
+
*/
|
|
174
|
+
tabWidth?: number;
|
|
175
|
+
/**
|
|
176
|
+
* Use tabs for indentation
|
|
177
|
+
* @default false
|
|
178
|
+
*/
|
|
179
|
+
useTabs?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Print semicolons
|
|
182
|
+
* @default true
|
|
183
|
+
*/
|
|
184
|
+
semi?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Use single quotes
|
|
187
|
+
* @default false
|
|
188
|
+
*/
|
|
189
|
+
singleQuote?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Trailing commas
|
|
192
|
+
* @default 'all'
|
|
193
|
+
*/
|
|
194
|
+
trailingComma?: "all" | "none" | "es5";
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* LSP configuration
|
|
198
|
+
*/
|
|
199
|
+
interface LspConfig {
|
|
200
|
+
/**
|
|
201
|
+
* Enable LSP
|
|
202
|
+
* @default false
|
|
203
|
+
*/
|
|
204
|
+
enabled?: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Enable linter diagnostics.
|
|
207
|
+
* Prefer this over `diagnostics` for new configs.
|
|
208
|
+
* @default false
|
|
209
|
+
*/
|
|
210
|
+
lint?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Enable linter diagnostics.
|
|
213
|
+
* @deprecated Use `lint` instead.
|
|
214
|
+
* @default false
|
|
215
|
+
*/
|
|
216
|
+
diagnostics?: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* Enable type checking diagnostics and type-aware LSP features.
|
|
219
|
+
* @default false
|
|
220
|
+
*/
|
|
221
|
+
typecheck?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Enable the editor assistance bundle: completion, hover, navigation,
|
|
224
|
+
* symbols, rename, code lens, semantic tokens, links, folding, inlay hints,
|
|
225
|
+
* and file rename handling. Formatting stays separately opt-in.
|
|
226
|
+
* @default false
|
|
227
|
+
*/
|
|
228
|
+
editor?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Enable completions.
|
|
231
|
+
* @default false
|
|
232
|
+
*/
|
|
233
|
+
completion?: boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Enable hover information
|
|
236
|
+
* @default false
|
|
237
|
+
*/
|
|
238
|
+
hover?: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Enable go-to-definition
|
|
241
|
+
* @default false
|
|
242
|
+
*/
|
|
243
|
+
definition?: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Enable find references
|
|
246
|
+
* @default false
|
|
247
|
+
*/
|
|
248
|
+
references?: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Enable document symbols
|
|
251
|
+
* @default false
|
|
252
|
+
*/
|
|
253
|
+
documentSymbols?: boolean;
|
|
254
|
+
/**
|
|
255
|
+
* Enable workspace symbols
|
|
256
|
+
* @default false
|
|
257
|
+
*/
|
|
258
|
+
workspaceSymbols?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Enable formatting via LSP
|
|
261
|
+
* @default false
|
|
262
|
+
*/
|
|
263
|
+
formatting?: boolean;
|
|
264
|
+
/**
|
|
265
|
+
* Enable code actions
|
|
266
|
+
* @default false
|
|
267
|
+
*/
|
|
268
|
+
codeActions?: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Enable rename
|
|
271
|
+
* @default false
|
|
272
|
+
*/
|
|
273
|
+
rename?: boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Enable code lens
|
|
276
|
+
* @default false
|
|
277
|
+
*/
|
|
278
|
+
codeLens?: boolean;
|
|
279
|
+
/**
|
|
280
|
+
* Enable semantic tokens
|
|
281
|
+
* @default false
|
|
282
|
+
*/
|
|
283
|
+
semanticTokens?: boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Enable document links
|
|
286
|
+
* @default false
|
|
287
|
+
*/
|
|
288
|
+
documentLinks?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Enable folding ranges
|
|
291
|
+
* @default false
|
|
292
|
+
*/
|
|
293
|
+
foldingRanges?: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Enable inlay hints
|
|
296
|
+
* @default false
|
|
297
|
+
*/
|
|
298
|
+
inlayHints?: boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Enable file rename edits
|
|
301
|
+
* @default false
|
|
302
|
+
*/
|
|
303
|
+
fileRename?: boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Use Corsa for type checking in LSP
|
|
306
|
+
* @default false
|
|
307
|
+
*/
|
|
308
|
+
corsa?: boolean;
|
|
309
|
+
}
|
|
310
|
+
//#endregion
|
|
311
|
+
//#region src/types/musea.d.ts
|
|
312
|
+
/**
|
|
313
|
+
* VRT (Visual Regression Testing) configuration for Musea
|
|
314
|
+
*/
|
|
315
|
+
interface MuseaVrtConfig {
|
|
316
|
+
/**
|
|
317
|
+
* Threshold for pixel comparison (0-1)
|
|
318
|
+
* @default 0.1
|
|
319
|
+
*/
|
|
320
|
+
threshold?: number;
|
|
321
|
+
/**
|
|
322
|
+
* Output directory for screenshots
|
|
323
|
+
* @default '__musea_snapshots__'
|
|
324
|
+
*/
|
|
325
|
+
outDir?: string;
|
|
326
|
+
/**
|
|
327
|
+
* Viewport sizes
|
|
328
|
+
*/
|
|
329
|
+
viewports?: Array<{
|
|
330
|
+
width: number;
|
|
331
|
+
height: number;
|
|
332
|
+
name?: string;
|
|
333
|
+
}>;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* A11y configuration for Musea
|
|
337
|
+
*/
|
|
338
|
+
interface MuseaA11yConfig {
|
|
339
|
+
/**
|
|
340
|
+
* Enable a11y checking
|
|
341
|
+
* @default false
|
|
342
|
+
*/
|
|
343
|
+
enabled?: boolean;
|
|
344
|
+
/**
|
|
345
|
+
* Axe-core rules to enable/disable
|
|
346
|
+
*/
|
|
347
|
+
rules?: Record<string, boolean>;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Autogen configuration for Musea
|
|
351
|
+
*/
|
|
352
|
+
interface MuseaAutogenConfig {
|
|
353
|
+
/**
|
|
354
|
+
* Enable auto-generation of variants
|
|
355
|
+
* @default false
|
|
356
|
+
*/
|
|
357
|
+
enabled?: boolean;
|
|
358
|
+
/**
|
|
359
|
+
* Max variants to generate per component
|
|
360
|
+
* @default 10
|
|
361
|
+
*/
|
|
362
|
+
maxVariants?: number;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Musea component gallery configuration
|
|
366
|
+
*/
|
|
367
|
+
interface MuseaConfig {
|
|
368
|
+
/**
|
|
369
|
+
* Glob patterns for art files
|
|
370
|
+
* @default ['**\/*.art.vue']
|
|
371
|
+
*/
|
|
372
|
+
include?: string[];
|
|
373
|
+
/**
|
|
374
|
+
* Glob patterns to exclude
|
|
375
|
+
* @default ['node_modules/**', 'dist/**']
|
|
376
|
+
*/
|
|
377
|
+
exclude?: string[];
|
|
378
|
+
/**
|
|
379
|
+
* Base path for gallery
|
|
380
|
+
* @default '/__musea__'
|
|
381
|
+
*/
|
|
382
|
+
basePath?: string;
|
|
383
|
+
/**
|
|
384
|
+
* Enable Storybook compatibility
|
|
385
|
+
* @default false
|
|
386
|
+
*/
|
|
387
|
+
storybookCompat?: boolean;
|
|
388
|
+
/**
|
|
389
|
+
* Enable inline art detection in .vue files
|
|
390
|
+
* @default false
|
|
391
|
+
*/
|
|
392
|
+
inlineArt?: boolean;
|
|
393
|
+
/**
|
|
394
|
+
* VRT configuration
|
|
395
|
+
*/
|
|
396
|
+
vrt?: MuseaVrtConfig;
|
|
397
|
+
/**
|
|
398
|
+
* A11y configuration
|
|
399
|
+
*/
|
|
400
|
+
a11y?: MuseaA11yConfig;
|
|
401
|
+
/**
|
|
402
|
+
* Autogen configuration
|
|
403
|
+
*/
|
|
404
|
+
autogen?: MuseaAutogenConfig;
|
|
405
|
+
}
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/types/loader.d.ts
|
|
408
|
+
/**
|
|
409
|
+
* Global type declaration
|
|
410
|
+
*/
|
|
411
|
+
interface GlobalTypeDeclaration {
|
|
412
|
+
/**
|
|
413
|
+
* TypeScript type string
|
|
414
|
+
*/
|
|
415
|
+
type: string;
|
|
416
|
+
/**
|
|
417
|
+
* Default value
|
|
418
|
+
*/
|
|
419
|
+
defaultValue?: string;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Global types configuration
|
|
423
|
+
*/
|
|
424
|
+
type GlobalTypesConfig = Record<string, GlobalTypeDeclaration | string>;
|
|
425
|
+
/**
|
|
426
|
+
* Options for loading vize.config file
|
|
427
|
+
*/
|
|
428
|
+
interface LoadConfigOptions {
|
|
429
|
+
/**
|
|
430
|
+
* Config file search mode
|
|
431
|
+
* - 'root': Search only in the specified root directory
|
|
432
|
+
* - 'auto': Search from cwd upward until finding a config file
|
|
433
|
+
* - 'none': Don't load config file
|
|
434
|
+
* @default 'root'
|
|
435
|
+
*/
|
|
436
|
+
mode?: "root" | "auto" | "none";
|
|
437
|
+
/**
|
|
438
|
+
* Custom config file path (overrides automatic search)
|
|
439
|
+
*/
|
|
440
|
+
configFile?: string;
|
|
441
|
+
/**
|
|
442
|
+
* Config environment for dynamic config resolution
|
|
443
|
+
*/
|
|
444
|
+
env?: ConfigEnv;
|
|
445
|
+
}
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region src/types/core.d.ts
|
|
448
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
449
|
+
interface ConfigEnv {
|
|
450
|
+
mode: string;
|
|
451
|
+
command: "serve" | "build" | "check" | "lint" | "fmt";
|
|
452
|
+
isSsrBuild?: boolean;
|
|
453
|
+
}
|
|
454
|
+
type UserConfigExport = VizeConfig | ((env: ConfigEnv) => MaybePromise<VizeConfig>);
|
|
455
|
+
type RuleSeverity = "off" | "warn" | "error";
|
|
456
|
+
type RuleCategory = "correctness" | "suspicious" | "style" | "perf" | "a11y" | "security";
|
|
457
|
+
type LintPreset = "happy-path" | "opinionated" | "essential" | "nuxt";
|
|
458
|
+
/**
|
|
459
|
+
* Vize configuration options
|
|
460
|
+
*/
|
|
461
|
+
interface VizeConfig {
|
|
462
|
+
/**
|
|
463
|
+
* JSON Schema reference for editor autocompletion.
|
|
464
|
+
*/
|
|
465
|
+
$schema?: string;
|
|
466
|
+
/**
|
|
467
|
+
* Vue compiler options
|
|
468
|
+
*/
|
|
469
|
+
compiler?: CompilerConfig;
|
|
470
|
+
/**
|
|
471
|
+
* Vite plugin options
|
|
472
|
+
*/
|
|
473
|
+
vite?: VitePluginConfig;
|
|
474
|
+
/**
|
|
475
|
+
* Linter options
|
|
476
|
+
*/
|
|
477
|
+
linter?: LinterConfig;
|
|
478
|
+
/**
|
|
479
|
+
* Type checker options
|
|
480
|
+
*/
|
|
481
|
+
typeChecker?: TypeCheckerConfig;
|
|
482
|
+
/**
|
|
483
|
+
* Formatter options
|
|
484
|
+
*/
|
|
485
|
+
formatter?: FormatterConfig;
|
|
486
|
+
/**
|
|
487
|
+
* LSP options
|
|
488
|
+
*/
|
|
489
|
+
lsp?: LspConfig;
|
|
490
|
+
/**
|
|
491
|
+
* Musea component gallery options
|
|
492
|
+
*/
|
|
493
|
+
musea?: MuseaConfig;
|
|
494
|
+
/**
|
|
495
|
+
* Global type declarations
|
|
496
|
+
*/
|
|
497
|
+
globalTypes?: GlobalTypesConfig;
|
|
498
|
+
}
|
|
499
|
+
//#endregion
|
|
500
|
+
//#region src/config.d.ts
|
|
501
|
+
declare const CONFIG_FILE_NAMES: readonly ["vize.config.ts", "vize.config.js", "vize.config.mjs", "vize.config.pkl", "vize.config.json"];
|
|
502
|
+
declare const VIZE_CONFIG_JSON_SCHEMA_PATH: any;
|
|
503
|
+
declare const VIZE_CONFIG_PKL_SCHEMA_PATH: any;
|
|
504
|
+
/**
|
|
505
|
+
* Define a Vize configuration with type checking.
|
|
506
|
+
* Accepts a plain object or a function that receives ConfigEnv.
|
|
507
|
+
*/
|
|
508
|
+
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
509
|
+
/**
|
|
510
|
+
* Load `vize.config.*` from the specified directory.
|
|
511
|
+
*/
|
|
512
|
+
declare function loadConfig(root: string, options?: LoadConfigOptions): Promise<VizeConfig | null>;
|
|
513
|
+
/**
|
|
514
|
+
* Normalize GlobalTypesConfig shorthand strings to GlobalTypeDeclaration objects
|
|
515
|
+
*/
|
|
516
|
+
declare function normalizeGlobalTypes(config: GlobalTypesConfig): Record<string, GlobalTypeDeclaration>;
|
|
517
|
+
//#endregion
|
|
518
|
+
export { LspConfig as C, CompilerConfig as D, LintRulesConfig as E, VitePluginConfig as O, LinterConfig as S, LintRuleName 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 };
|
|
519
|
+
//# sourceMappingURL=config-DkggCaE5.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-DkggCaE5.d.mts","names":[],"sources":["../src/types/compiler.ts","../src/types/rules.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;EAyBA;;;;EAnBA,KAAA;EAiDA;;;;;EA1CA,cAAA;EAgE+B;;;;EA1D/B,GAAA;EAqEsC;;;;EA/DtC,SAAA;EAyDsC;;;;EAnDtC,iBAAA;EAqEA;;;;EA/DA,WAAA;;AC5CF;;;EDkDE,aAAA;EC6DQ;AAEV;;;EDzDE,IAAA;ECyDgD;AAElD;;;EDrDE,SAAA;ECqDyD;;;;ED/CzD,iBAAA;EC+C4B;;;;EDzC5B,iBAAA;AAAA;;;;UAUe,gBAAA;EE/EY;;;;EFoF3B,OAAA,YAAmB,MAAA,aAAmB,MAAA;EEhEI;;;;EFsE1C,OAAA,YAAmB,MAAA,aAAmB,MAAA;EEtFtC;;;;EF4FA,YAAA;EE5EA;;;;EFkFA,cAAA;AAAA;;;cC3GW,eAAA;AAAA,KAiHD,YAAA,WAAuB,eAAA;AAAA,KAEvB,eAAA,GAAkB,OAAA,CAAQ,MAAA,CAAO,YAAA,EAAc,YAAA;;;;;;UC9G1C,YAAA;EFQf;;;EEJA,OAAA;EF6BA;;;;EEvBA,MAAA,GAAS,UAAA;EFqDT;;;EEhDA,KAAA,GAAQ,eAAA;EFgEO;;;EE3Df,UAAA,GAAa,OAAA,CAAQ,MAAA,CAAO,YAAA,EAAc,YAAA;AAAA;;;;UAU3B,iBAAA;EFsDf;;;;EEjDA,OAAA;EFuDsC;;;;EEjDtC,MAAA;;;;AD9CF;ECoDE,UAAA;;;;AD6DF;ECvDE,UAAA;;;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 @@
|
|
|
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-DkggCaE5.mjs";
|
|
2
|
+
export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes };
|
package/dist/config.mjs
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { execFileSync } from "node:child_process";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
+
import { transform } from "oxc-transform";
|
|
6
|
+
//#region src/config.ts
|
|
7
|
+
const CONFIG_FILE_NAMES = [
|
|
8
|
+
"vize.config.ts",
|
|
9
|
+
"vize.config.js",
|
|
10
|
+
"vize.config.mjs",
|
|
11
|
+
"vize.config.pkl",
|
|
12
|
+
"vize.config.json"
|
|
13
|
+
];
|
|
14
|
+
const DEFAULT_CONFIG_ENV = {
|
|
15
|
+
mode: "development",
|
|
16
|
+
command: "serve"
|
|
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");
|
|
21
|
+
/**
|
|
22
|
+
* Define a Vize configuration with type checking.
|
|
23
|
+
* Accepts a plain object or a function that receives ConfigEnv.
|
|
24
|
+
*/
|
|
25
|
+
function defineConfig(config) {
|
|
26
|
+
return config;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Load `vize.config.*` from the specified directory.
|
|
30
|
+
*/
|
|
31
|
+
async function loadConfig(root, options = {}) {
|
|
32
|
+
const { mode = "root", configFile, env } = options;
|
|
33
|
+
if (mode === "none") return null;
|
|
34
|
+
if (configFile) {
|
|
35
|
+
const absolutePath = path.isAbsolute(configFile) ? configFile : path.resolve(root, configFile);
|
|
36
|
+
if (fs.existsSync(absolutePath)) return loadConfigFile(absolutePath, env);
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
if (mode === "auto") {
|
|
40
|
+
const configPath = findConfigFileAuto(root);
|
|
41
|
+
if (!configPath) return null;
|
|
42
|
+
return loadConfigFile(configPath, env);
|
|
43
|
+
}
|
|
44
|
+
const configPath = findConfigFileInDir(root);
|
|
45
|
+
if (!configPath) return null;
|
|
46
|
+
return loadConfigFile(configPath, env);
|
|
47
|
+
}
|
|
48
|
+
function findConfigFileInDir(dir) {
|
|
49
|
+
for (const name of CONFIG_FILE_NAMES) {
|
|
50
|
+
const filePath = path.join(dir, name);
|
|
51
|
+
if (fs.existsSync(filePath)) return filePath;
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
function findConfigFileAuto(startDir) {
|
|
56
|
+
let currentDir = path.resolve(startDir);
|
|
57
|
+
while (true) {
|
|
58
|
+
const configPath = findConfigFileInDir(currentDir);
|
|
59
|
+
if (configPath) return configPath;
|
|
60
|
+
const parentDir = path.dirname(currentDir);
|
|
61
|
+
if (parentDir === currentDir) return null;
|
|
62
|
+
currentDir = parentDir;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function loadConfigFile(filePath, env) {
|
|
66
|
+
if (!fs.existsSync(filePath)) return null;
|
|
67
|
+
const ext = path.extname(filePath);
|
|
68
|
+
if (ext === ".json") return parseJsonConfig(fs.readFileSync(filePath, "utf-8"), filePath);
|
|
69
|
+
if (ext === ".pkl") return loadPklConfig(filePath);
|
|
70
|
+
if (ext === ".ts") return loadTypeScriptConfig(filePath, env);
|
|
71
|
+
return loadESMConfig(filePath, env);
|
|
72
|
+
}
|
|
73
|
+
async function resolveConfigExport(exported, env) {
|
|
74
|
+
if (typeof exported === "function") return exported(env ?? DEFAULT_CONFIG_ENV);
|
|
75
|
+
return exported;
|
|
76
|
+
}
|
|
77
|
+
async function loadTypeScriptConfig(filePath, env) {
|
|
78
|
+
const result = transform(filePath, fs.readFileSync(filePath, "utf-8"), { typescript: { onlyRemoveTypeImports: true } });
|
|
79
|
+
const tempFile = filePath.replace(/\.ts$/, `.temp.${Date.now()}.mjs`);
|
|
80
|
+
fs.writeFileSync(tempFile, result.code);
|
|
81
|
+
try {
|
|
82
|
+
const module = await importFresh(tempFile);
|
|
83
|
+
return resolveConfigExport(module.default || module, env);
|
|
84
|
+
} finally {
|
|
85
|
+
fs.rmSync(tempFile, { force: true });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async function loadESMConfig(filePath, env) {
|
|
89
|
+
const module = await importFresh(filePath);
|
|
90
|
+
return resolveConfigExport(module.default || module, env);
|
|
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
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Normalize GlobalTypesConfig shorthand strings to GlobalTypeDeclaration objects
|
|
146
|
+
*/
|
|
147
|
+
function normalizeGlobalTypes(config) {
|
|
148
|
+
const result = {};
|
|
149
|
+
for (const [key, value] of Object.entries(config)) if (typeof value === "string") result[key] = { type: value };
|
|
150
|
+
else result[key] = value;
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes };
|
|
155
|
+
|
|
156
|
+
//# 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 { 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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intRuleName, _ 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-DkggCaE5.mjs";
|
|
2
|
+
export { CONFIG_FILE_NAMES, type CompilerConfig, type ConfigEnv, type FormatterConfig, type GlobalTypeDeclaration, type GlobalTypesConfig, type LintPreset, type LintRuleName, type LintRulesConfig, 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
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
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.
|
|
3
|
+
"version": "0.60.0",
|
|
4
4
|
"description": "Vize - High-performance Vue.js toolchain in Rust",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"vite-plus": "0.1.19"
|
|
57
57
|
},
|
|
58
58
|
"optionalDependencies": {
|
|
59
|
-
"@vizejs/native-darwin-arm64": "0.
|
|
60
|
-
"@vizejs/native-darwin-x64": "0.
|
|
61
|
-
"@vizejs/native-linux-arm64-gnu": "0.
|
|
62
|
-
"@vizejs/native-linux-arm64-musl": "0.
|
|
63
|
-
"@vizejs/native-linux-x64-gnu": "0.
|
|
64
|
-
"@vizejs/native-linux-x64-musl": "0.
|
|
65
|
-
"@vizejs/native-win32-arm64-msvc": "0.
|
|
66
|
-
"@vizejs/native-win32-x64-msvc": "0.
|
|
59
|
+
"@vizejs/native-darwin-arm64": "0.60.0",
|
|
60
|
+
"@vizejs/native-darwin-x64": "0.60.0",
|
|
61
|
+
"@vizejs/native-linux-arm64-gnu": "0.60.0",
|
|
62
|
+
"@vizejs/native-linux-arm64-musl": "0.60.0",
|
|
63
|
+
"@vizejs/native-linux-x64-gnu": "0.60.0",
|
|
64
|
+
"@vizejs/native-linux-x64-musl": "0.60.0",
|
|
65
|
+
"@vizejs/native-win32-arm64-msvc": "0.60.0",
|
|
66
|
+
"@vizejs/native-win32-x64-msvc": "0.60.0"
|
|
67
67
|
},
|
|
68
68
|
"engines": {
|
|
69
69
|
"node": ">=18"
|
package/pkl/vize.pkl
CHANGED
|
@@ -19,6 +19,7 @@ typealias GlobalTypeValue = String | GlobalTypeDeclaration
|
|
|
19
19
|
class CompilerConfig {
|
|
20
20
|
mode: CompilerMode? = null
|
|
21
21
|
vapor: Boolean? = null
|
|
22
|
+
customRenderer: Boolean? = null
|
|
22
23
|
ssr: Boolean? = null
|
|
23
24
|
sourceMap: Boolean? = null
|
|
24
25
|
prefixIdentifiers: Boolean? = null
|
package/src/types/compiler.ts
CHANGED
|
@@ -18,6 +18,13 @@ export interface CompilerConfig {
|
|
|
18
18
|
*/
|
|
19
19
|
vapor?: boolean;
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Treat lowercase non-HTML tags as custom renderer elements instead of Vue components.
|
|
23
|
+
* Useful for TresJS and other custom renderers.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
customRenderer?: boolean;
|
|
27
|
+
|
|
21
28
|
/**
|
|
22
29
|
* Enable SSR mode
|
|
23
30
|
* @default false
|