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/README.md CHANGED
@@ -17,6 +17,42 @@ Need `vp` first? Install Vite+ once from the [Vite+ install guide](https://vitep
17
17
 
18
18
  ## Installation
19
19
 
20
+ For an existing Vite or Vite+ project, run the setup command from the project root:
21
+
22
+ ```bash
23
+ vp dlx vize setup
24
+ ```
25
+
26
+ The command:
27
+
28
+ - installs `vize`, the Vite and Musea plugins, Oxlint, and `oxlint-plugin-vize`;
29
+ - creates `vize.config.ts` and, for plain Vite projects, `oxlint.config.ts` when no supported config
30
+ already exists;
31
+ - enables the Vize Oxlint preset in the `lint` block of a standard Vite+ config, so `vp lint`
32
+ checks Vue files;
33
+ - adds non-conflicting `vize:*` package scripts for build, format, lint, check, Musea, and `ready`;
34
+ - replaces a canonical zero-option `@vitejs/plugin-vue` import with `@vizejs/vite-plugin`, then
35
+ removes the old dependency.
36
+
37
+ Setup is idempotent. It preserves existing config files and package scripts, and it leaves custom
38
+ Vite plugin calls such as `vue({ ... })` unchanged because those options need a deliberate
39
+ migration. Use `vize setup --no-install` to generate the files and scripts without changing
40
+ dependencies.
41
+
42
+ After installation, `vz` is a short alias for the same CLI:
43
+
44
+ ```bash
45
+ vz ready src
46
+ ```
47
+
48
+ The remaining work for the full
49
+ [Vize Plus proposal](https://github.com/ubugeeei-prod/vize/issues/3278) is safe merging into existing
50
+ Vize and Vite+ lint/Oxlint configs, option-aware migration of custom or multiple Vite configs, and
51
+ project-specific Musea plugin injection. Those cases are intentionally reported and preserved by
52
+ this first setup slice instead of being rewritten heuristically.
53
+
54
+ For manual installation:
55
+
20
56
  ```bash
21
57
  vp install -D vize
22
58
  ```
@@ -157,6 +193,38 @@ Use the Rust CLI when you need Corsa project diagnostics across Vue, TS, TSX, an
157
193
 
158
194
  `vize ready` runs `fmt --write`, `lint`, `check`, and `build` in that order.
159
195
 
196
+ ## Experimental TypeScript Content Mapper
197
+
198
+ Vize publishes the package metadata and protocol server proposed by
199
+ [microsoft/typescript-go#4712](https://github.com/microsoft/typescript-go/pull/4712). This lets a
200
+ compatible `tsgo` build ask Vize to transform `.vue` files directly instead of materializing a
201
+ parallel `.vue.ts` project.
202
+
203
+ ```json
204
+ {
205
+ "compilerOptions": {
206
+ "module": "preserve",
207
+ "strict": true
208
+ },
209
+ "contentMappers": [
210
+ {
211
+ "package": "vize",
212
+ "extensions": [".vue"]
213
+ }
214
+ ],
215
+ "include": ["src"]
216
+ }
217
+ ```
218
+
219
+ ```bash
220
+ tsgo --loadExternalPlugins --noEmit -p tsconfig.json
221
+ ```
222
+
223
+ The content-mapper API is not in a released TypeScript native preview yet. Use the exact PR build
224
+ while evaluating it, keep `--loadExternalPlugins` explicit, and keep `vize check` as the supported
225
+ typecheck path until TypeScript ships the protocol. Vize currently negotiates protocol v1 with
226
+ UTF-8 mappings and does not declare compiler-option dependencies.
227
+
160
228
  ## Compiler and Tool Options
161
229
 
162
230
  Important shared fields:
package/dist/cli.mjs CHANGED
@@ -1,6 +1,400 @@
1
1
  import { createRequire } from "node:module";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { execFileSync } from "node:child_process";
5
+ //#region src/setup/config.ts
6
+ const VIZE_CONFIG_FILES = [
7
+ "vize.config.pkl",
8
+ "vize.config.ts",
9
+ "vize.config.js",
10
+ "vize.config.mjs",
11
+ "vize.config.json"
12
+ ];
13
+ const OXLINT_CONFIG_FILES = [
14
+ ".oxlintrc.json",
15
+ ".oxlintrc.jsonc",
16
+ "oxlint.config.ts",
17
+ "oxlint.config.mts",
18
+ "oxlint.config.js",
19
+ "oxlint.config.mjs",
20
+ "oxlint.config.cjs",
21
+ "oxlint.config.cts"
22
+ ];
23
+ const REQUIRED_DEV_DEPENDENCIES = [
24
+ "vize",
25
+ "@vizejs/vite-plugin",
26
+ "@vizejs/vite-plugin-musea",
27
+ "oxlint",
28
+ "oxlint-plugin-vize"
29
+ ];
30
+ const DEFAULT_SCRIPTS = {
31
+ "vize:build": "vize build src",
32
+ "vize:fmt": "vize fmt --check src",
33
+ "vize:fmt:fix": "vize fmt --write src",
34
+ "vize:lint": "vize lint --preset happy-path --max-warnings 0 src",
35
+ "vize:check": "vize check src",
36
+ "vize:musea": "vize musea",
37
+ "vize:ready": "vize ready src"
38
+ };
39
+ const DEFAULT_VIZE_CONFIG = `import { defineConfig } from "vize";
40
+
41
+ export default defineConfig({
42
+ compiler: {
43
+ templateSyntax: "standard",
44
+ },
45
+ linter: {
46
+ preset: "happy-path",
47
+ },
48
+ typeChecker: {
49
+ enabled: true,
50
+ strict: true,
51
+ },
52
+ vite: {
53
+ scanPatterns: ["src/**/*.vue"],
54
+ },
55
+ });
56
+ `;
57
+ const DEFAULT_OXLINT_CONFIG = `import { defineConfig } from "oxlint";
58
+ import { configs } from "oxlint-plugin-vize";
59
+
60
+ export default defineConfig({
61
+ plugins: ["vue"],
62
+ jsPlugins: ["oxlint-plugin-vize"],
63
+ settings: {
64
+ vize: {
65
+ preset: "general-recommended",
66
+ helpLevel: "short",
67
+ },
68
+ },
69
+ rules: configs.recommended,
70
+ });
71
+ `;
72
+ function readRequiredFile(filename, message) {
73
+ try {
74
+ return fs.readFileSync(filename, "utf8");
75
+ } catch (error) {
76
+ if (isNodeError(error) && error.code === "ENOENT") throw new Error(`${message}: ${filename}`, { cause: error });
77
+ throw error;
78
+ }
79
+ }
80
+ function parsePackageJson(filename, source) {
81
+ try {
82
+ const parsed = JSON.parse(source);
83
+ if (!isJsonObject(parsed)) throw new Error("package.json must contain an object");
84
+ return parsed;
85
+ } catch (error) {
86
+ throw new Error(`Invalid package.json: ${filename}`, { cause: error });
87
+ }
88
+ }
89
+ function detectJsonIndent(source) {
90
+ return source.match(/^[\t ]+(?=")/mu)?.[0] ?? 2;
91
+ }
92
+ function dependencyNames(packageJson) {
93
+ const names = /* @__PURE__ */ new Set();
94
+ for (const field of [
95
+ "dependencies",
96
+ "devDependencies",
97
+ "optionalDependencies"
98
+ ]) {
99
+ const dependencies = packageJson[field];
100
+ if (!isJsonObject(dependencies)) continue;
101
+ for (const name of Object.keys(dependencies)) names.add(name);
102
+ }
103
+ return names;
104
+ }
105
+ function addDefaultScripts(packageJson) {
106
+ if (packageJson.scripts !== void 0 && !isJsonObject(packageJson.scripts)) throw new Error("package.json scripts must contain an object");
107
+ const scripts = packageJson.scripts ?? {};
108
+ const addedScripts = [];
109
+ const preservedScripts = [];
110
+ for (const [name, command] of Object.entries(DEFAULT_SCRIPTS)) {
111
+ if (name in scripts) {
112
+ preservedScripts.push(name);
113
+ continue;
114
+ }
115
+ scripts[name] = command;
116
+ addedScripts.push(name);
117
+ }
118
+ if (addedScripts.length > 0) packageJson.scripts = scripts;
119
+ return {
120
+ addedScripts,
121
+ preservedScripts
122
+ };
123
+ }
124
+ function planGeneratedConfig(root, candidates, generatedName, source, plannedFiles, createdFiles, preservedFiles) {
125
+ const existing = candidates.find((candidate) => fs.existsSync(path.join(root, candidate)));
126
+ if (existing) {
127
+ preservedFiles.push(existing);
128
+ return;
129
+ }
130
+ plannedFiles.push({
131
+ filename: path.join(root, generatedName),
132
+ source
133
+ });
134
+ createdFiles.push(generatedName);
135
+ }
136
+ function atomicWriteFile(filename, source) {
137
+ const temporary = path.join(path.dirname(filename), `.${path.basename(filename)}.${process.pid}.${Date.now()}.tmp`);
138
+ try {
139
+ fs.writeFileSync(temporary, source, {
140
+ encoding: "utf8",
141
+ flag: "wx"
142
+ });
143
+ fs.renameSync(temporary, filename);
144
+ } finally {
145
+ fs.rmSync(temporary, { force: true });
146
+ }
147
+ }
148
+ function isJsonObject(value) {
149
+ return typeof value === "object" && value !== null && !Array.isArray(value);
150
+ }
151
+ function isNodeError(value) {
152
+ return value instanceof Error;
153
+ }
154
+ //#endregion
155
+ //#region src/setup/vite.ts
156
+ const VITE_CONFIG_FILES = [
157
+ "vite.config.ts",
158
+ "vite.config.mts",
159
+ "vite.config.js",
160
+ "vite.config.mjs"
161
+ ];
162
+ const VITE_PLUS_LINT_IMPORT = "import { configs as vizePlusLintConfigs } from \"oxlint-plugin-vize\";\n";
163
+ const VITE_PLUS_LINT_BLOCK = ` lint: {
164
+ plugins: ["vue"],
165
+ jsPlugins: ["oxlint-plugin-vize"],
166
+ settings: {
167
+ vize: {
168
+ preset: "general-recommended",
169
+ helpLevel: "short",
170
+ },
171
+ },
172
+ rules: vizePlusLintConfigs.recommended,
173
+ },
174
+ `;
175
+ function planViteMigration(root, mayConfigureVitePlusLint) {
176
+ const existing = VITE_CONFIG_FILES.filter((candidate) => fs.existsSync(path.join(root, candidate)));
177
+ if (existing.length === 0) return {
178
+ file: null,
179
+ preserved: null,
180
+ removesOfficialPlugin: false,
181
+ enablesVitePlusLint: false,
182
+ hasVitePlusLint: false,
183
+ usesVitePlus: false
184
+ };
185
+ if (existing.length > 1) return {
186
+ file: null,
187
+ preserved: `Vite configs (${existing.join(", ")})`,
188
+ removesOfficialPlugin: false,
189
+ enablesVitePlusLint: false,
190
+ hasVitePlusLint: false,
191
+ usesVitePlus: false
192
+ };
193
+ const relativeFilename = existing[0];
194
+ const filename = path.join(root, relativeFilename);
195
+ const source = fs.readFileSync(filename, "utf8");
196
+ const usesVitePlus = /from\s+["']vite-plus["']/u.test(source);
197
+ let migratedSource = source;
198
+ let removesOfficialPlugin = false;
199
+ let preserved = null;
200
+ if (!source.includes("@vizejs/vite-plugin")) {
201
+ const importPattern = /^([^\S\r\n]*import[^\S\r\n]+)([$A-Z_a-z][$\w]*)([^\S\r\n]+from[^\S\r\n]+)(["'])@vitejs\/plugin-vue\4([^\S\r\n]*;?[^\S\r\n]*)$/gmu;
202
+ const imports = [...source.matchAll(importPattern)];
203
+ if (imports.length === 1) {
204
+ const localName = imports[0][2];
205
+ const zeroArgumentCallPattern = new RegExp(`\\b${escapeRegExp(localName)}\\s*\\(\\s*\\)`, "gu");
206
+ const calls = [...source.matchAll(zeroArgumentCallPattern)];
207
+ const importIndex = imports[0].index;
208
+ const importSource = imports[0][0];
209
+ const sourceWithoutExpectedUse = source.slice(0, importIndex) + source.slice(importIndex + importSource.length).replace(zeroArgumentCallPattern, "");
210
+ const hasOtherUses = new RegExp(`\\b${escapeRegExp(localName)}\\b`, "u").test(sourceWithoutExpectedUse);
211
+ if (calls.length === 1 && !hasOtherUses) {
212
+ migratedSource = source.replace(importPattern, `$1$2$3$4@vizejs/vite-plugin$4$5`);
213
+ removesOfficialPlugin = true;
214
+ } else preserved = relativeFilename;
215
+ } else if (source.includes("@vitejs/plugin-vue")) preserved = relativeFilename;
216
+ }
217
+ const hadVitePlusLint = usesVitePlus && source.includes("oxlint-plugin-vize");
218
+ let enablesVitePlusLint = false;
219
+ if (mayConfigureVitePlusLint && !hadVitePlusLint && canInjectVitePlusLint(migratedSource)) {
220
+ const injectedSource = injectVitePlusLint(migratedSource);
221
+ if (injectedSource !== null) {
222
+ migratedSource = injectedSource;
223
+ enablesVitePlusLint = true;
224
+ }
225
+ }
226
+ return {
227
+ file: migratedSource === source ? null : {
228
+ filename,
229
+ source: migratedSource
230
+ },
231
+ preserved: preserved ?? (migratedSource === source && source.includes("@vizejs/vite-plugin") ? relativeFilename : null),
232
+ removesOfficialPlugin,
233
+ enablesVitePlusLint,
234
+ hasVitePlusLint: hadVitePlusLint || enablesVitePlusLint,
235
+ usesVitePlus
236
+ };
237
+ }
238
+ function canInjectVitePlusLint(source) {
239
+ if (!/from\s+["']vite-plus["']/u.test(source) || /^\s*lint\s*:/mu.test(source) || /\bvizePlusLintConfigs\b/u.test(source)) return false;
240
+ return [...source.matchAll(/\bdefineConfig\s*\(\s*\{/gu)].length === 1;
241
+ }
242
+ function injectVitePlusLint(source) {
243
+ const lastImport = [...source.matchAll(/^import[^\r\n]*(?:from\s+["'][^"']+["']|["'][^"']+["'])\s*;?[^\S\r\n]*(?:\r?\n|$)/gmu)].at(-1);
244
+ if (!lastImport || lastImport.index === void 0) return null;
245
+ const importEnd = lastImport.index + lastImport[0].length;
246
+ return (source.slice(0, importEnd) + VITE_PLUS_LINT_IMPORT + source.slice(importEnd)).replace(/\bdefineConfig\s*\(\s*\{/u, (opening) => `${opening}\n${VITE_PLUS_LINT_BLOCK}`);
247
+ }
248
+ function escapeRegExp(value) {
249
+ return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
250
+ }
251
+ //#endregion
252
+ //#region src/setup.ts
253
+ function setupProject(options) {
254
+ const root = path.resolve(options.root);
255
+ const packagePath = path.join(root, "package.json");
256
+ const packageSource = readRequiredFile(packagePath, "No package.json found");
257
+ const packageJson = parsePackageJson(packagePath, packageSource);
258
+ const packageIndent = detectJsonIndent(packageSource);
259
+ const existingDependencies = dependencyNames(packageJson);
260
+ const missingDependencies = REQUIRED_DEV_DEPENDENCIES.filter((dependency) => !existingDependencies.has(dependency));
261
+ const createdFiles = [];
262
+ const preservedFiles = [];
263
+ const plannedFiles = [];
264
+ planGeneratedConfig(root, VIZE_CONFIG_FILES, "vize.config.ts", DEFAULT_VIZE_CONFIG, plannedFiles, createdFiles, preservedFiles);
265
+ const existingOxlintConfig = OXLINT_CONFIG_FILES.find((candidate) => fs.existsSync(path.join(root, candidate)));
266
+ const viteMigration = planViteMigration(root, existingOxlintConfig === void 0);
267
+ if (viteMigration.file) plannedFiles.push(viteMigration.file);
268
+ if (viteMigration.preserved) preservedFiles.push(viteMigration.preserved);
269
+ if (viteMigration.usesVitePlus && !viteMigration.hasVitePlusLint && existingOxlintConfig === void 0) preservedFiles.push("Vite+ lint configuration");
270
+ if (existingOxlintConfig) preservedFiles.push(existingOxlintConfig);
271
+ else if (!viteMigration.hasVitePlusLint && !viteMigration.usesVitePlus) planGeneratedConfig(root, OXLINT_CONFIG_FILES, "oxlint.config.ts", DEFAULT_OXLINT_CONFIG, plannedFiles, createdFiles, preservedFiles);
272
+ const { addedScripts, preservedScripts } = addDefaultScripts(packageJson);
273
+ if (addedScripts.length > 0) plannedFiles.push({
274
+ filename: packagePath,
275
+ source: `${JSON.stringify(packageJson, null, packageIndent)}\n`
276
+ });
277
+ writePlannedFiles(root, plannedFiles, options.writeFile ?? atomicWriteFile);
278
+ const runCommand = options.runCommand ?? runSetupCommand;
279
+ let installCommand = null;
280
+ if (options.install !== false && missingDependencies.length > 0) {
281
+ installCommand = {
282
+ command: "vp",
283
+ args: [
284
+ "add",
285
+ "-D",
286
+ ...missingDependencies
287
+ ],
288
+ cwd: root
289
+ };
290
+ runCommand(installCommand);
291
+ }
292
+ let removeCommand = null;
293
+ if (options.install !== false && viteMigration.removesOfficialPlugin && existingDependencies.has("@vitejs/plugin-vue")) {
294
+ removeCommand = {
295
+ command: "vp",
296
+ args: ["remove", "@vitejs/plugin-vue"],
297
+ cwd: root
298
+ };
299
+ runCommand(removeCommand);
300
+ }
301
+ return {
302
+ root,
303
+ createdFiles,
304
+ preservedFiles,
305
+ addedScripts,
306
+ preservedScripts,
307
+ migratedViteConfig: viteMigration.file && viteMigration.removesOfficialPlugin ? path.basename(viteMigration.file.filename) : null,
308
+ enabledVitePlusLint: viteMigration.enablesVitePlusLint,
309
+ installCommand,
310
+ removeCommand
311
+ };
312
+ }
313
+ function runSetupCli(args) {
314
+ if (args.includes("--help") || args.includes("-h")) {
315
+ process.stdout.write(setupHelp());
316
+ return;
317
+ }
318
+ let install = true;
319
+ let root;
320
+ for (const arg of args) {
321
+ if (arg === "--no-install") {
322
+ install = false;
323
+ continue;
324
+ }
325
+ if (arg.startsWith("-")) throw new Error(`Unknown setup option: ${arg}`);
326
+ if (root) throw new Error(`Unexpected setup argument: ${arg}`);
327
+ root = arg;
328
+ }
329
+ printSetupResult(setupProject({
330
+ root: root ?? process.cwd(),
331
+ install
332
+ }), install);
333
+ }
334
+ function setupHelp() {
335
+ return `Configure Vize in an existing Vite or Vite+ project
336
+
337
+ Usage: vize setup [ROOT] [OPTIONS]
338
+
339
+ Arguments:
340
+ [ROOT] Project root containing package.json (default: current directory)
341
+
342
+ Options:
343
+ --no-install Write project configuration without changing dependencies
344
+ -h, --help Print help
345
+ `;
346
+ }
347
+ function printSetupResult(result, install) {
348
+ let dependenciesMissing = false;
349
+ for (const filename of result.createdFiles) process.stdout.write(`[vize setup] created ${filename}\n`);
350
+ if (result.migratedViteConfig) process.stdout.write(`[vize setup] migrated ${result.migratedViteConfig} to @vizejs/vite-plugin\n`);
351
+ if (result.enabledVitePlusLint) process.stdout.write("[vize setup] enabled oxlint-plugin-vize for vp lint\n");
352
+ if (result.addedScripts.length > 0) process.stdout.write(`[vize setup] added scripts: ${result.addedScripts.join(", ")}\n`);
353
+ for (const filename of result.preservedFiles) process.stdout.write(`[vize setup] preserved existing ${filename}\n`);
354
+ if (result.preservedScripts.length > 0) process.stdout.write(`[vize setup] preserved scripts: ${result.preservedScripts.join(", ")}\n`);
355
+ if (!install) {
356
+ const packagePath = path.join(result.root, "package.json");
357
+ const packageJson = parsePackageJson(packagePath, fs.readFileSync(packagePath, "utf8"));
358
+ const missing = REQUIRED_DEV_DEPENDENCIES.filter((dependency) => !dependencyNames(packageJson).has(dependency));
359
+ if (missing.length > 0) {
360
+ dependenciesMissing = true;
361
+ process.stdout.write(`[vize setup] install dependencies with: vp add -D ${missing.join(" ")}\n`);
362
+ }
363
+ }
364
+ if (result.removeCommand) process.stdout.write("[vize setup] removed @vitejs/plugin-vue\n");
365
+ process.stdout.write(dependenciesMissing ? "[vize setup] configuration written; install dependencies before running Vize\n" : "[vize setup] ready; run vp run vize:ready\n");
366
+ }
367
+ function runSetupCommand(command) {
368
+ execFileSync(command.command, [...command.args], {
369
+ cwd: command.cwd,
370
+ stdio: "inherit"
371
+ });
372
+ }
373
+ function writePlannedFiles(root, plannedFiles, writeFile) {
374
+ const writtenFiles = [];
375
+ for (const file of plannedFiles) {
376
+ try {
377
+ writeFile(file.filename, file.source);
378
+ } catch (error) {
379
+ if (writtenFiles.length === 0) throw error;
380
+ const failedFile = path.relative(root, file.filename);
381
+ throw new Error(`Setup partially completed: wrote ${writtenFiles.join(", ")} before ${failedFile} failed. Run setup again to finish.`, { cause: error });
382
+ }
383
+ writtenFiles.push(path.relative(root, file.filename));
384
+ }
385
+ }
386
+ //#endregion
2
387
  //#region src/cli.ts
3
- createRequire(import.meta.url)("@vizejs/native").runCli(process.argv.slice(2));
388
+ const require = createRequire(import.meta.url);
389
+ try {
390
+ const args = process.argv.slice(2);
391
+ if (args[0] === "setup") runSetupCli(args.slice(1));
392
+ else require("@vizejs/native").runCli(args);
393
+ } catch (error) {
394
+ const message = error instanceof Error ? error.message : String(error);
395
+ process.stderr.write(`[vize] ${message}\n`);
396
+ process.exitCode = 1;
397
+ }
4
398
  //#endregion
5
399
  export {};
6
400
 
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\n\nconst require = createRequire(import.meta.url);\nconst native = require(\"@vizejs/native\") as typeof import(\"@vizejs/native\");\n\nnative.runCli(process.argv.slice(2));\n"],"mappings":";;AAEgB,cAAc,OAAO,KAAK,IACpB,CAAC,iBAEjB,CAAC,OAAO,QAAQ,KAAK,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"cli.mjs","names":[],"sources":["../src/setup/config.ts","../src/setup/vite.ts","../src/setup.ts","../src/cli.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nexport const VIZE_CONFIG_FILES = [\n \"vize.config.pkl\",\n \"vize.config.ts\",\n \"vize.config.js\",\n \"vize.config.mjs\",\n \"vize.config.json\",\n] as const;\n\nexport const OXLINT_CONFIG_FILES = [\n \".oxlintrc.json\",\n \".oxlintrc.jsonc\",\n \"oxlint.config.ts\",\n \"oxlint.config.mts\",\n \"oxlint.config.js\",\n \"oxlint.config.mjs\",\n \"oxlint.config.cjs\",\n \"oxlint.config.cts\",\n] as const;\n\nexport const REQUIRED_DEV_DEPENDENCIES = [\n \"vize\",\n \"@vizejs/vite-plugin\",\n \"@vizejs/vite-plugin-musea\",\n \"oxlint\",\n \"oxlint-plugin-vize\",\n] as const;\n\nexport const DEFAULT_SCRIPTS = {\n \"vize:build\": \"vize build src\",\n \"vize:fmt\": \"vize fmt --check src\",\n \"vize:fmt:fix\": \"vize fmt --write src\",\n \"vize:lint\": \"vize lint --preset happy-path --max-warnings 0 src\",\n \"vize:check\": \"vize check src\",\n \"vize:musea\": \"vize musea\",\n \"vize:ready\": \"vize ready src\",\n} as const;\n\nexport const DEFAULT_VIZE_CONFIG = `import { defineConfig } from \"vize\";\n\nexport default defineConfig({\n compiler: {\n templateSyntax: \"standard\",\n },\n linter: {\n preset: \"happy-path\",\n },\n typeChecker: {\n enabled: true,\n strict: true,\n },\n vite: {\n scanPatterns: [\"src/**/*.vue\"],\n },\n});\n`;\n\nexport const DEFAULT_OXLINT_CONFIG = `import { defineConfig } from \"oxlint\";\nimport { configs } from \"oxlint-plugin-vize\";\n\nexport default defineConfig({\n plugins: [\"vue\"],\n jsPlugins: [\"oxlint-plugin-vize\"],\n settings: {\n vize: {\n preset: \"general-recommended\",\n helpLevel: \"short\",\n },\n },\n rules: configs.recommended,\n});\n`;\n\ntype JsonObject = Record<string, unknown>;\n\nexport interface PlannedFile {\n readonly filename: string;\n readonly source: string;\n}\n\nexport function readRequiredFile(filename: string, message: string): string {\n try {\n return fs.readFileSync(filename, \"utf8\");\n } catch (error) {\n if (isNodeError(error) && error.code === \"ENOENT\") {\n throw new Error(`${message}: ${filename}`, { cause: error });\n }\n throw error;\n }\n}\n\nexport function parsePackageJson(filename: string, source: string): JsonObject {\n try {\n const parsed = JSON.parse(source) as unknown;\n if (!isJsonObject(parsed)) {\n throw new Error(\"package.json must contain an object\");\n }\n return parsed;\n } catch (error) {\n throw new Error(`Invalid package.json: ${filename}`, { cause: error });\n }\n}\n\nexport function detectJsonIndent(source: string): string | number {\n const match = source.match(/^[\\t ]+(?=\")/mu);\n return match?.[0] ?? 2;\n}\n\nexport function dependencyNames(packageJson: JsonObject): Set<string> {\n const names = new Set<string>();\n for (const field of [\"dependencies\", \"devDependencies\", \"optionalDependencies\"] as const) {\n const dependencies = packageJson[field];\n if (!isJsonObject(dependencies)) {\n continue;\n }\n for (const name of Object.keys(dependencies)) {\n names.add(name);\n }\n }\n return names;\n}\n\nexport function addDefaultScripts(packageJson: JsonObject): {\n readonly addedScripts: string[];\n readonly preservedScripts: string[];\n} {\n if (packageJson.scripts !== undefined && !isJsonObject(packageJson.scripts)) {\n throw new Error(\"package.json scripts must contain an object\");\n }\n\n const scripts = (packageJson.scripts ?? {}) as JsonObject;\n const addedScripts: string[] = [];\n const preservedScripts: string[] = [];\n for (const [name, command] of Object.entries(DEFAULT_SCRIPTS)) {\n if (name in scripts) {\n preservedScripts.push(name);\n continue;\n }\n scripts[name] = command;\n addedScripts.push(name);\n }\n if (addedScripts.length > 0) {\n packageJson.scripts = scripts;\n }\n return { addedScripts, preservedScripts };\n}\n\nexport function planGeneratedConfig(\n root: string,\n candidates: readonly string[],\n generatedName: string,\n source: string,\n plannedFiles: PlannedFile[],\n createdFiles: string[],\n preservedFiles: string[],\n): void {\n const existing = candidates.find((candidate) => fs.existsSync(path.join(root, candidate)));\n if (existing) {\n preservedFiles.push(existing);\n return;\n }\n plannedFiles.push({ filename: path.join(root, generatedName), source });\n createdFiles.push(generatedName);\n}\n\nexport function atomicWriteFile(filename: string, source: string): void {\n const temporary = path.join(\n path.dirname(filename),\n `.${path.basename(filename)}.${process.pid}.${Date.now()}.tmp`,\n );\n try {\n fs.writeFileSync(temporary, source, { encoding: \"utf8\", flag: \"wx\" });\n fs.renameSync(temporary, filename);\n } finally {\n fs.rmSync(temporary, { force: true });\n }\n}\n\nfunction isJsonObject(value: unknown): value is JsonObject {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isNodeError(value: unknown): value is NodeJS.ErrnoException {\n return value instanceof Error;\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type { PlannedFile } from \"./config.js\";\n\nconst VITE_CONFIG_FILES = [\n \"vite.config.ts\",\n \"vite.config.mts\",\n \"vite.config.js\",\n \"vite.config.mjs\",\n] as const;\n\nconst VITE_PLUS_LINT_IMPORT =\n 'import { configs as vizePlusLintConfigs } from \"oxlint-plugin-vize\";\\n';\n\nconst VITE_PLUS_LINT_BLOCK = ` lint: {\n plugins: [\"vue\"],\n jsPlugins: [\"oxlint-plugin-vize\"],\n settings: {\n vize: {\n preset: \"general-recommended\",\n helpLevel: \"short\",\n },\n },\n rules: vizePlusLintConfigs.recommended,\n },\n`;\n\nexport interface ViteMigrationPlan {\n readonly file: PlannedFile | null;\n readonly preserved: string | null;\n readonly removesOfficialPlugin: boolean;\n readonly enablesVitePlusLint: boolean;\n readonly hasVitePlusLint: boolean;\n readonly usesVitePlus: boolean;\n}\n\nexport function planViteMigration(\n root: string,\n mayConfigureVitePlusLint: boolean,\n): ViteMigrationPlan {\n const existing = VITE_CONFIG_FILES.filter((candidate) =>\n fs.existsSync(path.join(root, candidate)),\n );\n if (existing.length === 0) {\n return {\n file: null,\n preserved: null,\n removesOfficialPlugin: false,\n enablesVitePlusLint: false,\n hasVitePlusLint: false,\n usesVitePlus: false,\n };\n }\n if (existing.length > 1) {\n return {\n file: null,\n preserved: `Vite configs (${existing.join(\", \")})`,\n removesOfficialPlugin: false,\n enablesVitePlusLint: false,\n hasVitePlusLint: false,\n usesVitePlus: false,\n };\n }\n\n const relativeFilename = existing[0]!;\n const filename = path.join(root, relativeFilename);\n const source = fs.readFileSync(filename, \"utf8\");\n const usesVitePlus = /from\\s+[\"']vite-plus[\"']/u.test(source);\n let migratedSource = source;\n let removesOfficialPlugin = false;\n let preserved: string | null = null;\n\n if (!source.includes(\"@vizejs/vite-plugin\")) {\n const importPattern =\n /^([^\\S\\r\\n]*import[^\\S\\r\\n]+)([$A-Z_a-z][$\\w]*)([^\\S\\r\\n]+from[^\\S\\r\\n]+)([\"'])@vitejs\\/plugin-vue\\4([^\\S\\r\\n]*;?[^\\S\\r\\n]*)$/gmu;\n const imports = [...source.matchAll(importPattern)];\n if (imports.length === 1) {\n const localName = imports[0]![2]!;\n const zeroArgumentCallPattern = new RegExp(\n `\\\\b${escapeRegExp(localName)}\\\\s*\\\\(\\\\s*\\\\)`,\n \"gu\",\n );\n const calls = [...source.matchAll(zeroArgumentCallPattern)];\n const importIndex = imports[0]!.index!;\n const importSource = imports[0]![0];\n const sourceWithoutExpectedUse =\n source.slice(0, importIndex) +\n source.slice(importIndex + importSource.length).replace(zeroArgumentCallPattern, \"\");\n const hasOtherUses = new RegExp(`\\\\b${escapeRegExp(localName)}\\\\b`, \"u\").test(\n sourceWithoutExpectedUse,\n );\n if (calls.length === 1 && !hasOtherUses) {\n migratedSource = source.replace(importPattern, `$1$2$3$4@vizejs/vite-plugin$4$5`);\n removesOfficialPlugin = true;\n } else {\n preserved = relativeFilename;\n }\n } else if (source.includes(\"@vitejs/plugin-vue\")) {\n preserved = relativeFilename;\n }\n }\n\n const hadVitePlusLint = usesVitePlus && source.includes(\"oxlint-plugin-vize\");\n let enablesVitePlusLint = false;\n if (mayConfigureVitePlusLint && !hadVitePlusLint && canInjectVitePlusLint(migratedSource)) {\n const injectedSource = injectVitePlusLint(migratedSource);\n if (injectedSource !== null) {\n migratedSource = injectedSource;\n enablesVitePlusLint = true;\n }\n }\n\n return {\n file: migratedSource === source ? null : { filename, source: migratedSource },\n preserved:\n preserved ??\n (migratedSource === source && source.includes(\"@vizejs/vite-plugin\")\n ? relativeFilename\n : null),\n removesOfficialPlugin,\n enablesVitePlusLint,\n hasVitePlusLint: hadVitePlusLint || enablesVitePlusLint,\n usesVitePlus,\n };\n}\n\nfunction canInjectVitePlusLint(source: string): boolean {\n if (\n !/from\\s+[\"']vite-plus[\"']/u.test(source) ||\n /^\\s*lint\\s*:/mu.test(source) ||\n /\\bvizePlusLintConfigs\\b/u.test(source)\n ) {\n return false;\n }\n return [...source.matchAll(/\\bdefineConfig\\s*\\(\\s*\\{/gu)].length === 1;\n}\n\nfunction injectVitePlusLint(source: string): string | null {\n const importLines = [\n ...source.matchAll(\n /^import[^\\r\\n]*(?:from\\s+[\"'][^\"']+[\"']|[\"'][^\"']+[\"'])\\s*;?[^\\S\\r\\n]*(?:\\r?\\n|$)/gmu,\n ),\n ];\n const lastImport = importLines.at(-1);\n if (!lastImport || lastImport.index === undefined) {\n return null;\n }\n const importEnd = lastImport.index + lastImport[0].length;\n const withImport = source.slice(0, importEnd) + VITE_PLUS_LINT_IMPORT + source.slice(importEnd);\n return withImport.replace(\n /\\bdefineConfig\\s*\\(\\s*\\{/u,\n (opening) => `${opening}\\n${VITE_PLUS_LINT_BLOCK}`,\n );\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/gu, \"\\\\$&\");\n}\n","import { execFileSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport {\n addDefaultScripts,\n atomicWriteFile,\n DEFAULT_OXLINT_CONFIG,\n DEFAULT_VIZE_CONFIG,\n dependencyNames,\n detectJsonIndent,\n OXLINT_CONFIG_FILES,\n parsePackageJson,\n planGeneratedConfig,\n readRequiredFile,\n REQUIRED_DEV_DEPENDENCIES,\n VIZE_CONFIG_FILES,\n type PlannedFile,\n} from \"./setup/config.js\";\nimport { planViteMigration } from \"./setup/vite.js\";\n\nexport interface SetupCommand {\n readonly command: string;\n readonly args: readonly string[];\n readonly cwd: string;\n}\n\nexport interface SetupResult {\n readonly root: string;\n readonly createdFiles: readonly string[];\n readonly preservedFiles: readonly string[];\n readonly addedScripts: readonly string[];\n readonly preservedScripts: readonly string[];\n readonly migratedViteConfig: string | null;\n readonly enabledVitePlusLint: boolean;\n readonly installCommand: SetupCommand | null;\n readonly removeCommand: SetupCommand | null;\n}\n\nexport interface SetupOptions {\n readonly root: string;\n readonly install?: boolean;\n readonly runCommand?: (command: SetupCommand) => void;\n readonly writeFile?: (filename: string, source: string) => void;\n}\n\nexport function setupProject(options: SetupOptions): SetupResult {\n const root = path.resolve(options.root);\n const packagePath = path.join(root, \"package.json\");\n const packageSource = readRequiredFile(packagePath, \"No package.json found\");\n const packageJson = parsePackageJson(packagePath, packageSource);\n const packageIndent = detectJsonIndent(packageSource);\n const existingDependencies = dependencyNames(packageJson);\n const missingDependencies = REQUIRED_DEV_DEPENDENCIES.filter(\n (dependency) => !existingDependencies.has(dependency),\n );\n\n const createdFiles: string[] = [];\n const preservedFiles: string[] = [];\n const plannedFiles: PlannedFile[] = [];\n planGeneratedConfig(\n root,\n VIZE_CONFIG_FILES,\n \"vize.config.ts\",\n DEFAULT_VIZE_CONFIG,\n plannedFiles,\n createdFiles,\n preservedFiles,\n );\n\n const existingOxlintConfig = OXLINT_CONFIG_FILES.find((candidate) =>\n fs.existsSync(path.join(root, candidate)),\n );\n const viteMigration = planViteMigration(root, existingOxlintConfig === undefined);\n if (viteMigration.file) {\n plannedFiles.push(viteMigration.file);\n }\n if (viteMigration.preserved) {\n preservedFiles.push(viteMigration.preserved);\n }\n if (\n viteMigration.usesVitePlus &&\n !viteMigration.hasVitePlusLint &&\n existingOxlintConfig === undefined\n ) {\n preservedFiles.push(\"Vite+ lint configuration\");\n }\n if (existingOxlintConfig) {\n preservedFiles.push(existingOxlintConfig);\n } else if (!viteMigration.hasVitePlusLint && !viteMigration.usesVitePlus) {\n planGeneratedConfig(\n root,\n OXLINT_CONFIG_FILES,\n \"oxlint.config.ts\",\n DEFAULT_OXLINT_CONFIG,\n plannedFiles,\n createdFiles,\n preservedFiles,\n );\n }\n\n const { addedScripts, preservedScripts } = addDefaultScripts(packageJson);\n if (addedScripts.length > 0) {\n plannedFiles.push({\n filename: packagePath,\n source: `${JSON.stringify(packageJson, null, packageIndent)}\\n`,\n });\n }\n writePlannedFiles(root, plannedFiles, options.writeFile ?? atomicWriteFile);\n\n const runCommand = options.runCommand ?? runSetupCommand;\n let installCommand: SetupCommand | null = null;\n if (options.install !== false && missingDependencies.length > 0) {\n installCommand = {\n command: \"vp\",\n args: [\"add\", \"-D\", ...missingDependencies],\n cwd: root,\n };\n runCommand(installCommand);\n }\n\n let removeCommand: SetupCommand | null = null;\n if (\n options.install !== false &&\n viteMigration.removesOfficialPlugin &&\n existingDependencies.has(\"@vitejs/plugin-vue\")\n ) {\n removeCommand = {\n command: \"vp\",\n args: [\"remove\", \"@vitejs/plugin-vue\"],\n cwd: root,\n };\n runCommand(removeCommand);\n }\n\n return {\n root,\n createdFiles,\n preservedFiles,\n addedScripts,\n preservedScripts,\n migratedViteConfig:\n viteMigration.file && viteMigration.removesOfficialPlugin\n ? path.basename(viteMigration.file.filename)\n : null,\n enabledVitePlusLint: viteMigration.enablesVitePlusLint,\n installCommand,\n removeCommand,\n };\n}\n\nexport function runSetupCli(args: readonly string[]): void {\n if (args.includes(\"--help\") || args.includes(\"-h\")) {\n process.stdout.write(setupHelp());\n return;\n }\n\n let install = true;\n let root: string | undefined;\n for (const arg of args) {\n if (arg === \"--no-install\") {\n install = false;\n continue;\n }\n if (arg.startsWith(\"-\")) {\n throw new Error(`Unknown setup option: ${arg}`);\n }\n if (root) {\n throw new Error(`Unexpected setup argument: ${arg}`);\n }\n root = arg;\n }\n\n const result = setupProject({ root: root ?? process.cwd(), install });\n printSetupResult(result, install);\n}\n\nfunction setupHelp(): string {\n return `Configure Vize in an existing Vite or Vite+ project\n\nUsage: vize setup [ROOT] [OPTIONS]\n\nArguments:\n [ROOT] Project root containing package.json (default: current directory)\n\nOptions:\n --no-install Write project configuration without changing dependencies\n -h, --help Print help\n`;\n}\n\nfunction printSetupResult(result: SetupResult, install: boolean): void {\n let dependenciesMissing = false;\n for (const filename of result.createdFiles) {\n process.stdout.write(`[vize setup] created ${filename}\\n`);\n }\n if (result.migratedViteConfig) {\n process.stdout.write(\n `[vize setup] migrated ${result.migratedViteConfig} to @vizejs/vite-plugin\\n`,\n );\n }\n if (result.enabledVitePlusLint) {\n process.stdout.write(\"[vize setup] enabled oxlint-plugin-vize for vp lint\\n\");\n }\n if (result.addedScripts.length > 0) {\n process.stdout.write(`[vize setup] added scripts: ${result.addedScripts.join(\", \")}\\n`);\n }\n for (const filename of result.preservedFiles) {\n process.stdout.write(`[vize setup] preserved existing ${filename}\\n`);\n }\n if (result.preservedScripts.length > 0) {\n process.stdout.write(`[vize setup] preserved scripts: ${result.preservedScripts.join(\", \")}\\n`);\n }\n if (!install) {\n const packagePath = path.join(result.root, \"package.json\");\n const packageJson = parsePackageJson(packagePath, fs.readFileSync(packagePath, \"utf8\"));\n const missing = REQUIRED_DEV_DEPENDENCIES.filter(\n (dependency) => !dependencyNames(packageJson).has(dependency),\n );\n if (missing.length > 0) {\n dependenciesMissing = true;\n process.stdout.write(\n `[vize setup] install dependencies with: vp add -D ${missing.join(\" \")}\\n`,\n );\n }\n }\n if (result.removeCommand) {\n process.stdout.write(\"[vize setup] removed @vitejs/plugin-vue\\n\");\n }\n process.stdout.write(\n dependenciesMissing\n ? \"[vize setup] configuration written; install dependencies before running Vize\\n\"\n : \"[vize setup] ready; run vp run vize:ready\\n\",\n );\n}\n\nfunction runSetupCommand(command: SetupCommand): void {\n execFileSync(command.command, [...command.args], {\n cwd: command.cwd,\n stdio: \"inherit\",\n });\n}\n\nfunction writePlannedFiles(\n root: string,\n plannedFiles: readonly PlannedFile[],\n writeFile: (filename: string, source: string) => void,\n): void {\n const writtenFiles: string[] = [];\n for (const file of plannedFiles) {\n try {\n writeFile(file.filename, file.source);\n } catch (error) {\n if (writtenFiles.length === 0) {\n throw error;\n }\n const failedFile = path.relative(root, file.filename);\n throw new Error(\n `Setup partially completed: wrote ${writtenFiles.join(\", \")} before ${failedFile} failed. Run setup again to finish.`,\n { cause: error },\n );\n }\n writtenFiles.push(path.relative(root, file.filename));\n }\n}\n","import { createRequire } from \"node:module\";\n\nimport { runSetupCli } from \"./setup.js\";\n\nconst require = createRequire(import.meta.url);\n\ntry {\n const args = process.argv.slice(2);\n if (args[0] === \"setup\") {\n runSetupCli(args.slice(1));\n } else {\n const native = require(\"@vizejs/native\") as typeof import(\"@vizejs/native\");\n native.runCli(args);\n }\n} catch (error) {\n const message = error instanceof Error ? error.message : String(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