vize 0.291.0 → 0.303.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/src/setup.ts ADDED
@@ -0,0 +1,265 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+
5
+ import {
6
+ addDefaultScripts,
7
+ atomicWriteFile,
8
+ DEFAULT_OXLINT_CONFIG,
9
+ DEFAULT_VIZE_CONFIG,
10
+ dependencyNames,
11
+ detectJsonIndent,
12
+ OXLINT_CONFIG_FILES,
13
+ parsePackageJson,
14
+ planGeneratedConfig,
15
+ readRequiredFile,
16
+ REQUIRED_DEV_DEPENDENCIES,
17
+ VIZE_CONFIG_FILES,
18
+ type PlannedFile,
19
+ } from "./setup/config.js";
20
+ import { planViteMigration } from "./setup/vite.js";
21
+
22
+ export interface SetupCommand {
23
+ readonly command: string;
24
+ readonly args: readonly string[];
25
+ readonly cwd: string;
26
+ }
27
+
28
+ export interface SetupResult {
29
+ readonly root: string;
30
+ readonly createdFiles: readonly string[];
31
+ readonly preservedFiles: readonly string[];
32
+ readonly addedScripts: readonly string[];
33
+ readonly preservedScripts: readonly string[];
34
+ readonly migratedViteConfig: string | null;
35
+ readonly enabledVitePlusLint: boolean;
36
+ readonly installCommand: SetupCommand | null;
37
+ readonly removeCommand: SetupCommand | null;
38
+ }
39
+
40
+ export interface SetupOptions {
41
+ readonly root: string;
42
+ readonly install?: boolean;
43
+ readonly runCommand?: (command: SetupCommand) => void;
44
+ readonly writeFile?: (filename: string, source: string) => void;
45
+ }
46
+
47
+ export function setupProject(options: SetupOptions): SetupResult {
48
+ const root = path.resolve(options.root);
49
+ const packagePath = path.join(root, "package.json");
50
+ const packageSource = readRequiredFile(packagePath, "No package.json found");
51
+ const packageJson = parsePackageJson(packagePath, packageSource);
52
+ const packageIndent = detectJsonIndent(packageSource);
53
+ const existingDependencies = dependencyNames(packageJson);
54
+ const missingDependencies = REQUIRED_DEV_DEPENDENCIES.filter(
55
+ (dependency) => !existingDependencies.has(dependency),
56
+ );
57
+
58
+ const createdFiles: string[] = [];
59
+ const preservedFiles: string[] = [];
60
+ const plannedFiles: PlannedFile[] = [];
61
+ planGeneratedConfig(
62
+ root,
63
+ VIZE_CONFIG_FILES,
64
+ "vize.config.ts",
65
+ DEFAULT_VIZE_CONFIG,
66
+ plannedFiles,
67
+ createdFiles,
68
+ preservedFiles,
69
+ );
70
+
71
+ const existingOxlintConfig = OXLINT_CONFIG_FILES.find((candidate) =>
72
+ fs.existsSync(path.join(root, candidate)),
73
+ );
74
+ const viteMigration = planViteMigration(root, existingOxlintConfig === undefined);
75
+ if (viteMigration.file) {
76
+ plannedFiles.push(viteMigration.file);
77
+ }
78
+ if (viteMigration.preserved) {
79
+ preservedFiles.push(viteMigration.preserved);
80
+ }
81
+ if (
82
+ viteMigration.usesVitePlus &&
83
+ !viteMigration.hasVitePlusLint &&
84
+ existingOxlintConfig === undefined
85
+ ) {
86
+ preservedFiles.push("Vite+ lint configuration");
87
+ }
88
+ if (existingOxlintConfig) {
89
+ preservedFiles.push(existingOxlintConfig);
90
+ } else if (!viteMigration.hasVitePlusLint && !viteMigration.usesVitePlus) {
91
+ planGeneratedConfig(
92
+ root,
93
+ OXLINT_CONFIG_FILES,
94
+ "oxlint.config.ts",
95
+ DEFAULT_OXLINT_CONFIG,
96
+ plannedFiles,
97
+ createdFiles,
98
+ preservedFiles,
99
+ );
100
+ }
101
+
102
+ const { addedScripts, preservedScripts } = addDefaultScripts(packageJson);
103
+ if (addedScripts.length > 0) {
104
+ plannedFiles.push({
105
+ filename: packagePath,
106
+ source: `${JSON.stringify(packageJson, null, packageIndent)}\n`,
107
+ });
108
+ }
109
+ writePlannedFiles(root, plannedFiles, options.writeFile ?? atomicWriteFile);
110
+
111
+ const runCommand = options.runCommand ?? runSetupCommand;
112
+ let installCommand: SetupCommand | null = null;
113
+ if (options.install !== false && missingDependencies.length > 0) {
114
+ installCommand = {
115
+ command: "vp",
116
+ args: ["add", "-D", ...missingDependencies],
117
+ cwd: root,
118
+ };
119
+ runCommand(installCommand);
120
+ }
121
+
122
+ let removeCommand: SetupCommand | null = null;
123
+ if (
124
+ options.install !== false &&
125
+ viteMigration.removesOfficialPlugin &&
126
+ existingDependencies.has("@vitejs/plugin-vue")
127
+ ) {
128
+ removeCommand = {
129
+ command: "vp",
130
+ args: ["remove", "@vitejs/plugin-vue"],
131
+ cwd: root,
132
+ };
133
+ runCommand(removeCommand);
134
+ }
135
+
136
+ return {
137
+ root,
138
+ createdFiles,
139
+ preservedFiles,
140
+ addedScripts,
141
+ preservedScripts,
142
+ migratedViteConfig:
143
+ viteMigration.file && viteMigration.removesOfficialPlugin
144
+ ? path.basename(viteMigration.file.filename)
145
+ : null,
146
+ enabledVitePlusLint: viteMigration.enablesVitePlusLint,
147
+ installCommand,
148
+ removeCommand,
149
+ };
150
+ }
151
+
152
+ export function runSetupCli(args: readonly string[]): void {
153
+ if (args.includes("--help") || args.includes("-h")) {
154
+ process.stdout.write(setupHelp());
155
+ return;
156
+ }
157
+
158
+ let install = true;
159
+ let root: string | undefined;
160
+ for (const arg of args) {
161
+ if (arg === "--no-install") {
162
+ install = false;
163
+ continue;
164
+ }
165
+ if (arg.startsWith("-")) {
166
+ throw new Error(`Unknown setup option: ${arg}`);
167
+ }
168
+ if (root) {
169
+ throw new Error(`Unexpected setup argument: ${arg}`);
170
+ }
171
+ root = arg;
172
+ }
173
+
174
+ const result = setupProject({ root: root ?? process.cwd(), install });
175
+ printSetupResult(result, install);
176
+ }
177
+
178
+ function setupHelp(): string {
179
+ return `Configure Vize in an existing Vite or Vite+ project
180
+
181
+ Usage: vize setup [ROOT] [OPTIONS]
182
+
183
+ Arguments:
184
+ [ROOT] Project root containing package.json (default: current directory)
185
+
186
+ Options:
187
+ --no-install Write project configuration without changing dependencies
188
+ -h, --help Print help
189
+ `;
190
+ }
191
+
192
+ function printSetupResult(result: SetupResult, install: boolean): void {
193
+ let dependenciesMissing = false;
194
+ for (const filename of result.createdFiles) {
195
+ process.stdout.write(`[vize setup] created ${filename}\n`);
196
+ }
197
+ if (result.migratedViteConfig) {
198
+ process.stdout.write(
199
+ `[vize setup] migrated ${result.migratedViteConfig} to @vizejs/vite-plugin\n`,
200
+ );
201
+ }
202
+ if (result.enabledVitePlusLint) {
203
+ process.stdout.write("[vize setup] enabled oxlint-plugin-vize for vp lint\n");
204
+ }
205
+ if (result.addedScripts.length > 0) {
206
+ process.stdout.write(`[vize setup] added scripts: ${result.addedScripts.join(", ")}\n`);
207
+ }
208
+ for (const filename of result.preservedFiles) {
209
+ process.stdout.write(`[vize setup] preserved existing ${filename}\n`);
210
+ }
211
+ if (result.preservedScripts.length > 0) {
212
+ process.stdout.write(`[vize setup] preserved scripts: ${result.preservedScripts.join(", ")}\n`);
213
+ }
214
+ if (!install) {
215
+ const packagePath = path.join(result.root, "package.json");
216
+ const packageJson = parsePackageJson(packagePath, fs.readFileSync(packagePath, "utf8"));
217
+ const missing = REQUIRED_DEV_DEPENDENCIES.filter(
218
+ (dependency) => !dependencyNames(packageJson).has(dependency),
219
+ );
220
+ if (missing.length > 0) {
221
+ dependenciesMissing = true;
222
+ process.stdout.write(
223
+ `[vize setup] install dependencies with: vp add -D ${missing.join(" ")}\n`,
224
+ );
225
+ }
226
+ }
227
+ if (result.removeCommand) {
228
+ process.stdout.write("[vize setup] removed @vitejs/plugin-vue\n");
229
+ }
230
+ process.stdout.write(
231
+ dependenciesMissing
232
+ ? "[vize setup] configuration written; install dependencies before running Vize\n"
233
+ : "[vize setup] ready; run vp run vize:ready\n",
234
+ );
235
+ }
236
+
237
+ function runSetupCommand(command: SetupCommand): void {
238
+ execFileSync(command.command, [...command.args], {
239
+ cwd: command.cwd,
240
+ stdio: "inherit",
241
+ });
242
+ }
243
+
244
+ function writePlannedFiles(
245
+ root: string,
246
+ plannedFiles: readonly PlannedFile[],
247
+ writeFile: (filename: string, source: string) => void,
248
+ ): void {
249
+ const writtenFiles: string[] = [];
250
+ for (const file of plannedFiles) {
251
+ try {
252
+ writeFile(file.filename, file.source);
253
+ } catch (error) {
254
+ if (writtenFiles.length === 0) {
255
+ throw error;
256
+ }
257
+ const failedFile = path.relative(root, file.filename);
258
+ throw new Error(
259
+ `Setup partially completed: wrote ${writtenFiles.join(", ")} before ${failedFile} failed. Run setup again to finish.`,
260
+ { cause: error },
261
+ );
262
+ }
263
+ writtenFiles.push(path.relative(root, file.filename));
264
+ }
265
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-D1BwAgHh.mjs","names":["PACKAGE_ROOT","getErrorMessage"],"sources":["../src/config/pkl.js","../src/config.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { execFileSync } from \"node:child_process\";\nimport { randomUUID } from \"node:crypto\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\n\nconst PACKAGE_ROOT = path.resolve(fileURLToPath(new URL(\".\", import.meta.url)), \"../..\");\n\nconst DOCUMENTED_PKL_SCHEMA_IMPORT_RE =\n /^(\\s*(?:amends|import)\\s+)([\"'])node_modules\\/vize\\/pkl\\/(VizeConfig\\.pkl|vize\\.pkl)\\2/gm;\n\n/**\n * Evaluate a `vize.config.pkl` file and return its JSON representation.\n *\n * The npm-facing loader keeps PKL execution in Node because it needs package\n * resolution for `@pkl-community/pkl`, but all structural config normalization\n * happens in Rust after this function returns. A missing PKL runtime returns\n * `null` so config discovery can fall through to lower-priority formats; an\n * evaluation failure throws because a present PKL config should not silently be\n * ignored.\n */\nexport function loadPklConfigJson(filePath) {\n const pklBin = findPklBinary();\n if (!pklBin) {\n console.warn(\n \"[vize] pkl CLI not found. Install @pkl-community/pkl or add pkl to PATH. \" +\n \"Falling back to the next config format.\",\n );\n return null;\n }\n\n const patchedFilePath = createPklConfigWithBundledSchemaImports(filePath);\n const evalFilePath = patchedFilePath ?? filePath;\n try {\n return execFileSync(pklBin, [\"eval\", \"-f\", \"json\", evalFilePath], {\n cwd: path.dirname(filePath),\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n timeout: 30_000,\n });\n } catch (error) {\n throw new Error(`Failed to evaluate vize PKL config at ${filePath}: ${getErrorMessage(error)}`);\n } finally {\n if (patchedFilePath) {\n fs.rmSync(patchedFilePath, { force: true });\n }\n }\n}\n\nfunction findPklBinary() {\n try {\n const pklPkgPath = import.meta.resolve?.(\"@pkl-community/pkl\");\n if (pklPkgPath) {\n const pklLibDir = path.dirname(fileURLToPath(pklPkgPath));\n const pklPackageDir = path.dirname(pklLibDir);\n const candidates = [\n path.join(pklLibDir, \"main.js\"),\n path.join(pklPackageDir, \"pkl\"),\n path.join(pklPackageDir, \"pkl.exe\"),\n ];\n\n for (const candidate of candidates) {\n if (fs.existsSync(candidate)) {\n try {\n execFileSync(candidate, [\"--version\"], { stdio: \"ignore\" });\n return candidate;\n } catch {\n // Keep looking: the shim can exist when its runtime is unavailable.\n }\n }\n }\n }\n } catch {\n // Fall back to PATH below.\n }\n\n try {\n execFileSync(\"pkl\", [\"--version\"], { stdio: \"ignore\" });\n return \"pkl\";\n } catch {\n return null;\n }\n}\n\nfunction createPklConfigWithBundledSchemaImports(filePath) {\n const configDir = path.dirname(filePath);\n const source = fs.readFileSync(filePath, \"utf-8\");\n let patched = false;\n\n const content = source.replace(\n DOCUMENTED_PKL_SCHEMA_IMPORT_RE,\n (match, prefix, quote, schemaFile) => {\n const projectSchemaPath = path.join(configDir, \"node_modules\", \"vize\", \"pkl\", schemaFile);\n if (fs.existsSync(projectSchemaPath)) {\n return match;\n }\n\n const bundledSchemaPath = path.join(PACKAGE_ROOT, \"pkl\", schemaFile);\n if (!fs.existsSync(bundledSchemaPath)) {\n return match;\n }\n\n patched = true;\n return `${prefix}${quote}${pathToFileURL(bundledSchemaPath).href}${quote}`;\n },\n );\n\n if (!patched) {\n return null;\n }\n\n const tempFile = path.join(\n configDir,\n `.vize-config-${process.pid}-${Date.now()}-${randomUUID()}.pkl`,\n );\n fs.writeFileSync(tempFile, content, { flag: \"wx\", mode: 0o600 });\n return tempFile;\n}\n\nfunction getErrorMessage(error) {\n if (error instanceof Error) {\n return error.message;\n }\n\n return String(error);\n}\n","import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { randomUUID } from \"node:crypto\";\nimport { createRequire } from \"node:module\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { transform } from \"oxc-transform\";\nimport type {\n ResolvedVizeConfig,\n LoadConfigOptions,\n UserConfigExport,\n ConfigEnv,\n GlobalTypesConfig,\n GlobalTypeDeclaration,\n} from \"./types/index.js\";\nimport { loadPklConfigJson } from \"./config/pkl.js\";\n\ntype NativeConfigHelpers = {\n normalizeVizeConfig(value: unknown): unknown;\n};\n\nconst require = createRequire(import.meta.url);\nconst native = require(\"@vizejs/native\") as NativeConfigHelpers;\n\nexport const CONFIG_FILE_NAMES = [\n \"vize.config.pkl\",\n \"vize.config.ts\",\n \"vize.config.js\",\n \"vize.config.mjs\",\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<ResolvedVizeConfig | 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 return loadConfigFromDirAuto(root, env);\n }\n\n return loadConfigFromDir(root, env);\n}\n\nasync function loadConfigFromDir(dir: string, env?: ConfigEnv): Promise<ResolvedVizeConfig | null> {\n for (const name of CONFIG_FILE_NAMES) {\n const filePath = path.join(dir, name);\n if (!fs.existsSync(filePath)) {\n continue;\n }\n\n const config = await loadConfigFile(filePath, env);\n if (config !== null) {\n return config;\n }\n }\n return null;\n}\n\nasync function loadConfigFromDirAuto(\n startDir: string,\n env?: ConfigEnv,\n): Promise<ResolvedVizeConfig | null> {\n let currentDir = path.resolve(startDir);\n\n while (true) {\n const config = await loadConfigFromDir(currentDir, env);\n if (config !== null) {\n return config;\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(\n filePath: string,\n env?: ConfigEnv,\n): Promise<ResolvedVizeConfig | null> {\n const absolutePath = path.resolve(filePath);\n if (!fs.existsSync(absolutePath)) {\n return null;\n }\n\n const ext = path.extname(absolutePath);\n\n if (ext === \".pkl\") {\n return loadPklConfig(absolutePath);\n }\n\n if (ext === \".json\") {\n const content = fs.readFileSync(absolutePath, \"utf-8\");\n return parseJsonConfig(content, absolutePath);\n }\n\n if (ext === \".ts\") {\n return loadTypeScriptConfig(absolutePath, env);\n }\n\n return loadESMConfig(absolutePath, env);\n}\n\nfunction loadPklConfig(filePath: string): ResolvedVizeConfig | null {\n const output = loadPklConfigJson(filePath);\n return output === null ? null : parseJsonConfig(output, filePath);\n}\n\nexport async function resolveConfigExport(\n exported: UserConfigExport,\n env?: ConfigEnv,\n): Promise<ResolvedVizeConfig> {\n if (typeof exported === \"function\") {\n return normalizeLoadedConfig(await exported(env ?? DEFAULT_CONFIG_ENV));\n }\n\n return normalizeLoadedConfig(exported);\n}\n\nasync function loadTypeScriptConfig(\n filePath: string,\n env?: ConfigEnv,\n): Promise<ResolvedVizeConfig> {\n const source = fs.readFileSync(filePath, \"utf-8\");\n const result = await transform(filePath, source, {\n typescript: {\n onlyRemoveTypeImports: true,\n },\n });\n\n const tempFile = path.join(\n path.dirname(filePath),\n `.vize-config-${process.pid}-${Date.now()}-${randomUUID()}.mjs`,\n );\n fs.writeFileSync(tempFile, result.code, { flag: \"wx\", mode: 0o600 });\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<ResolvedVizeConfig> {\n const module = await importFresh(filePath);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\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): ResolvedVizeConfig {\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): ResolvedVizeConfig {\n return native.normalizeVizeConfig(config ?? null) as ResolvedVizeConfig;\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 resolvedConfig =\n \"types\" in config &&\n typeof config.types === \"object\" &&\n config.types !== null &&\n !Array.isArray(config.types)\n ? config.types\n : config;\n\n const result: Record<string, GlobalTypeDeclaration> = {};\n for (const [key, value] of Object.entries(resolvedConfig)) {\n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