vize 0.347.7 → 0.351.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
@@ -193,12 +193,15 @@ Use the Rust CLI when you need Corsa project diagnostics across Vue, TS, TSX, an
193
193
 
194
194
  `vize ready` runs `fmt --write`, `lint`, `check`, and `build` in that order.
195
195
 
196
- ## Experimental TypeScript Content Mapper
196
+ ## TypeScript Content Mapper
197
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.
198
+ The TypeScript 7.1
199
+ [API roadmap](https://github.com/microsoft/typescript-go/issues/4830) identifies Content Mappers as
200
+ the TS Server plugin replacement needed by Vue. Vize publishes the package metadata and protocol
201
+ server merged upstream in
202
+ [microsoft/typescript-go#4712](https://github.com/microsoft/typescript-go/pull/4712),
203
+ letting a `tsgo` build with content-mapper support transform `.vue` files directly instead of
204
+ materializing a parallel `.vue.ts` project.
202
205
 
203
206
  ```json
204
207
  {
@@ -217,13 +220,19 @@ parallel `.vue.ts` project.
217
220
  ```
218
221
 
219
222
  ```bash
220
- tsgo --loadExternalPlugins --noEmit -p tsconfig.json
223
+ tsgo --runExternalCode --noEmit -p tsconfig.json
221
224
  ```
222
225
 
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.
226
+ Content Mappers are merged on the `typescript-go` main branch but are not in a released TypeScript
227
+ native preview yet. Use a `tsgo` built from main while evaluating them, keep `--runExternalCode`
228
+ explicit, and keep `vize check` as the supported typecheck path until a native preview release
229
+ ships the protocol. Vize negotiates protocol v1 with UTF-8 mappings, resolves its mapper options
230
+ and its declared `noUnusedLocals` compiler-option dependency per project through the
231
+ `openProject`/`closeProject` lifecycle (invalid options surface as `optionDiagnostics` in the
232
+ tsconfig), maps `<!-- @vue-expect-error -->` and `<!-- @vue-ignore -->` template comments onto
233
+ the protocol's diagnostic directives, and tags every transform response with the `.tsx` virtual
234
+ extension so both TypeScript and embedded JSX parse correctly. See the
235
+ [Content Mapper guide](https://vizejs.dev/guide/content-mapper) for setup and directive semantics.
227
236
 
228
237
  ## Compiler and Tool Options
229
238
 
package/dist/cli.mjs CHANGED
@@ -1175,7 +1175,7 @@ function planNuxtModule(detection, draft) {
1175
1175
  }
1176
1176
  //#endregion
1177
1177
  //#region src/init/plan-editor.ts
1178
- const EXTENSIONS_FILE = path.join(".vscode", "extensions.json");
1178
+ const EXTENSIONS_FILE = ".vscode/extensions.json";
1179
1179
  /**
1180
1180
  * Plans the editor recommendation.
1181
1181
  *
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":["VITE_CONFIG_FILES","writePlannedFiles"],"sources":["../src/corsa-runtime.ts","../src/setup/config.ts","../src/init/templates.ts","../src/init/top-level.ts","../src/init/edit-config.ts","../src/init/lint-target.ts","../src/init/select.ts","../src/init/args.ts","../src/init/detect.ts","../src/init/plan-types.ts","../src/init/plan-bundler.ts","../src/init/plan-editor.ts","../src/init/plan-lint.ts","../src/init/plan-project.ts","../src/init/plan.ts","../src/init/prompt.ts","../src/init/report.ts","../src/init.ts","../src/setup/vite.ts","../src/setup.ts","../src/cli.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nexport const publicCorsaEnvironmentVariables = [\n \"CORSA_PATH\",\n \"CORSA_EXECUTABLE\",\n \"TSGO_PATH\",\n \"TSGO_EXECUTABLE\",\n] as const;\n\ntype RuntimeResolutionOptions = {\n arch?: string;\n packageRoot?: string;\n platform?: NodeJS.Platform;\n};\n\nexport function configureBundledCorsaRuntime(\n environment: NodeJS.ProcessEnv = process.env,\n options: RuntimeResolutionOptions = {},\n): string | null {\n if (hasPublicRuntimeOverride(environment)) return null;\n\n const executable = resolveBundledCorsaRuntime(options);\n if (executable == null) return null;\n\n environment.CORSA_PATH = executable;\n return executable;\n}\n\nexport function resolveBundledCorsaRuntime(options: RuntimeResolutionOptions = {}): string | null {\n const packageRoot =\n options.packageRoot ?? path.resolve(path.dirname(fileURLToPath(import.meta.url)), \"..\");\n const platform = options.platform ?? process.platform;\n const arch = options.arch ?? process.arch;\n\n try {\n const cliManifestPath = path.join(packageRoot, \"package.json\");\n const cliManifest = readManifest(cliManifestPath);\n const declaredMetaVersion = cliManifest.optionalDependencies?.[\"@typescript/native-preview\"];\n if (typeof declaredMetaVersion !== \"string\") return null;\n\n const packageRequire = createRequire(cliManifestPath);\n const metaManifestPath = packageRequire.resolve(\"@typescript/native-preview/package.json\");\n const metaManifest = readManifest(metaManifestPath);\n if (\n metaManifest.name !== \"@typescript/native-preview\" ||\n !matchesDeclaredVersion(metaManifest.version, declaredMetaVersion)\n ) {\n return null;\n }\n\n const platformPackage = `@typescript/native-preview-${platform}-${arch}`;\n const declaredPlatformVersion = metaManifest.optionalDependencies?.[platformPackage];\n if (typeof declaredPlatformVersion !== \"string\") return null;\n\n const metaRequire = createRequire(metaManifestPath);\n const platformManifestPath = metaRequire.resolve(`${platformPackage}/package.json`);\n const platformManifest = readManifest(platformManifestPath);\n if (\n platformManifest.name !== platformPackage ||\n !matchesDeclaredVersion(platformManifest.version, declaredPlatformVersion)\n ) {\n return null;\n }\n\n const executable = path.join(\n path.dirname(platformManifestPath),\n \"lib\",\n platform === \"win32\" ? \"tsgo.exe\" : \"tsgo\",\n );\n return fs.existsSync(executable) ? executable : null;\n } catch {\n // The runtime is optional. Existing Rust-side discovery remains the fallback.\n return null;\n }\n}\n\nfunction hasPublicRuntimeOverride(environment: NodeJS.ProcessEnv): boolean {\n return publicCorsaEnvironmentVariables.some((name) => {\n const value = environment[name];\n return value != null && value !== \"\";\n });\n}\n\nfunction matchesDeclaredVersion(actual: unknown, declared: string): boolean {\n return typeof actual === \"string\" && (declared.startsWith(\"catalog:\") || actual === declared);\n}\n\nfunction readManifest(filename: string): {\n name?: string;\n optionalDependencies?: Record<string, string>;\n version?: string;\n} {\n return JSON.parse(fs.readFileSync(filename, \"utf8\"));\n}\n","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\n/** Config filenames Oxlint 1.64 auto-discovers. */\nexport const DISCOVERED_OXLINT_CONFIG_FILES = [\n \".oxlintrc.json\",\n \".oxlintrc.jsonc\",\n \"oxlint.config.ts\",\n] as const;\n\n/**\n * All plausible Oxlint config filenames, including names the binary ignores.\n *\n * Project detection keeps the ignored names so `vize init` can explain why it\n * will not preserve them. Setup must use `DISCOVERED_OXLINT_CONFIG_FILES`.\n */\nexport const OXLINT_CONFIG_FILES = [\n ...DISCOVERED_OXLINT_CONFIG_FILES,\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 // No positional input: the default command must check the complete tsconfig\n // project graph, including root files and referenced projects outside src.\n \"vize:check\": \"vize check\",\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 jsxTypecheck: 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","/**\n * Config sources `vize init` writes.\n *\n * Every Oxlint-facing template here is derived from one settings object so the\n * `vp lint` block and the `oxlint` config can never describe different presets.\n * See `lint-target.ts` for why writing the wrong one of the two is silent.\n */\n\n/** Preset both Oxlint entry points run with. The bridge's own default. */\nexport const INIT_LINT_PRESET = \"general-recommended\";\n\n/** `settings.vize.helpLevel` both Oxlint entry points run with. */\nexport const INIT_LINT_HELP_LEVEL = \"short\";\n\n/** VS Code extension id published from `editors/vscode`. */\nexport const VSCODE_EXTENSION_ID = \"ubugeeei.vize\";\n\nexport interface VizeConfigFeatures {\n readonly lint: boolean;\n readonly fmt: boolean;\n readonly typecheck: boolean;\n readonly vite: boolean;\n}\n\n/**\n * Builds `vize.config.ts` from the selected features.\n *\n * Only selected features contribute a block, so a project that asked for the\n * formatter alone does not silently get a type checker it never opted into.\n */\nexport function renderVizeConfig(features: VizeConfigFeatures): string {\n const blocks: string[] = [\n ` compiler: {\n templateSyntax: \"standard\",\n },`,\n ];\n if (features.lint) {\n blocks.push(` linter: {\n enabled: true,\n preset: \"${INIT_LINT_PRESET}\",\n },`);\n }\n if (features.fmt) {\n blocks.push(` formatter: {\n singleAttributePerLine: false,\n sortBlocks: true,\n },`);\n }\n if (features.typecheck) {\n blocks.push(` typeChecker: {\n enabled: true,\n strict: true,\n jsxTypecheck: true,\n },`);\n }\n if (features.vite) {\n blocks.push(` vite: {\n scanPatterns: [\"src/**/*.vue\"],\n },`);\n }\n return `import { defineConfig } from \"vize\";\n\nexport default defineConfig({\n${blocks.join(\"\\n\")}\n});\n`;\n}\n\n/** Minimum project config written only when typechecking is selected and no config exists. */\nexport function renderTypecheckTsconfig(typescript: boolean): string {\n const compilerOptions: Record<string, boolean | string> = {\n strict: true,\n target: \"ES2022\",\n module: \"ESNext\",\n moduleResolution: \"Bundler\",\n jsx: \"preserve\",\n };\n if (!typescript) {\n compilerOptions.allowJs = true;\n compilerOptions.checkJs = true;\n }\n compilerOptions.noEmit = true;\n compilerOptions.skipLibCheck = true;\n return `${JSON.stringify({ compilerOptions, include: [\"src/**/*\"] }, null, 2)}\\n`;\n}\n\n/**\n * Config for the `oxlint` binary.\n *\n * `.oxlintrc.json` cannot import `configs.recommended`, and the bridge only runs\n * `vize/*` rules that appear in `rules`, so a JSON config would need every rule\n * id inlined and would rot on the next rule addition. `oxlint.config.ts` is\n * Oxlint's TypeScript config format and is auto-discovered (verified against\n * oxlint 1.64; `oxlint.config.mjs`, `.js`, `.cjs`, `.mts` and `.cts` are not --\n * see #3474), so it is the only form that stays correct over time.\n */\nexport const INIT_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: \"${INIT_LINT_PRESET}\",\n helpLevel: \"${INIT_LINT_HELP_LEVEL}\",\n },\n },\n rules: configs.recommended,\n});\n`;\n\n/** Import line the Vite+ `lint` block needs. */\nexport const VITE_LINT_IMPORT =\n 'import { createVizeLintConfig } from \"oxlint-plugin-vize\";\\n' as const;\n\n/**\n * The Vite+ `lint` block, the only Oxlint configuration `vp lint` and `vp check`\n * read.\n *\n * `createVizeLintConfig()` returns the whole block rather than fragments, which\n * is what makes the `jsPlugins` entry impossible to omit. Hand-assembling the\n * block is how a config ends up looking wired while reporting nothing.\n */\nexport const VITE_LINT_BLOCK = ` lint: createVizeLintConfig({\n preset: \"${INIT_LINT_PRESET}\",\n settings: {\n helpLevel: \"${INIT_LINT_HELP_LEVEL}\",\n },\n }),\n`;\n\n/** Snippet printed when a Vite config has no `lint` block and cannot be edited safely. */\nexport const VITE_LINT_SNIPPET = `import { createVizeLintConfig } from \"oxlint-plugin-vize\";\n\nexport default defineConfig({\n${VITE_LINT_BLOCK}});\n`;\n\n/**\n * Snippet printed when the Vite config already has a `lint` block.\n *\n * Spreading is the documented way to keep an existing block's other keys while\n * still taking the whole Vize block, `jsPlugins` included.\n */\nexport const VITE_LINT_MERGE_SNIPPET = `import { createVizeLintConfig } from \"oxlint-plugin-vize\";\n\nexport default defineConfig({\n lint: {\n ...createVizeLintConfig({\n preset: \"${INIT_LINT_PRESET}\",\n settings: {\n helpLevel: \"${INIT_LINT_HELP_LEVEL}\",\n },\n }),\n // keep your existing lint keys here\n },\n});\n`;\n\nexport const VITE_PLUGIN_IMPORT = 'import vize from \"@vizejs/vite-plugin\";\\n' as const;\n\nexport const VITE_PLUGIN_SNIPPET = `import vize from \"@vizejs/vite-plugin\";\n\nexport default defineConfig({\n plugins: [vize()],\n});\n`;\n\nexport const NUXT_MODULE_SNIPPET = `export default defineNuxtConfig({\n modules: [\"@vizejs/nuxt\"],\n});\n`;\n\n/**\n * `.vscode/extensions.json` written when no file exists yet.\n *\n * Recommendations are chosen over `code --install-extension` because they are\n * checked in, apply to the whole team, and change nothing on the machine that\n * runs `init`.\n */\nexport function renderVscodeExtensions(indent: string | number): string {\n return `${JSON.stringify({ recommendations: [VSCODE_EXTENSION_ID] }, null, indent)}\\n`;\n}\n\n/** Editor integrations shipped from this repo, reported alongside the VS Code one. */\nexport const EDITOR_INTEGRATIONS = [\n \"VS Code: ubugeeei.vize (recommended in .vscode/extensions.json)\",\n \"Zed: tools/zed-vize\",\n \"Neovim: tools/nvim-vize\",\n \"Vim: tools/vim-vize\",\n \"Helix: tools/helix-vize\",\n \"Emacs: tools/emacs-vize\",\n] as const;\n","/**\n * Depth-aware lookup of a top-level key in a `defineConfig({ ... })` call.\n *\n * A plain regex cannot tell the config's own `plugins` key from the `plugins`\n * key inside a `lint: { ... }` block, and picking the wrong one rewrites a part\n * of the user's config they never asked to change. This scanner tracks bracket\n * depth and skips strings, template literals and comments, so a key only matches\n * at depth 0 of the config object.\n *\n * It is not a JavaScript parser and does not try to be: template-literal\n * substitutions and regex literals are treated as ordinary text. Both make the\n * scan give up or miss, which turns into a refusal to edit -- the safe direction.\n */\n\nconst IDENTIFIER = /^[$A-Z_a-z][$\\w]*/u;\nconst KEY_SEPARATOR = /^\\s*:/u;\n\nexport interface TopLevelKey {\n /** Index of the first character of the key. */\n readonly keyStart: number;\n /** Index of the first character after the `:`. */\n readonly valueStart: number;\n}\n\n/** Finds `key` at the top level of `callee({ ... })`, or `null`. */\nexport function findTopLevelKey(source: string, callee: string, key: string): TopLevelKey | null {\n const opening = new RegExp(`\\\\b${callee}\\\\s*\\\\(\\\\s*\\\\{`, \"u\").exec(source);\n if (opening === null) {\n return null;\n }\n let index = opening.index + opening[0].length;\n let depth = 0;\n while (index < source.length) {\n const char = source[index]!;\n const skipped = skipNonCode(source, index);\n if (skipped !== index) {\n index = skipped;\n continue;\n }\n if (char === \"{\" || char === \"[\" || char === \"(\") {\n depth += 1;\n index += 1;\n continue;\n }\n if (char === \"}\" || char === \"]\" || char === \")\") {\n if (depth === 0) {\n // Closing brace of the config object itself: the key is not here.\n return null;\n }\n depth -= 1;\n index += 1;\n continue;\n }\n const identifier = IDENTIFIER.exec(source.slice(index));\n if (identifier === null) {\n index += 1;\n continue;\n }\n const separator = KEY_SEPARATOR.exec(source.slice(index + identifier[0].length));\n if (depth === 0 && identifier[0] === key && separator !== null) {\n return {\n keyStart: index,\n valueStart: index + identifier[0].length + separator[0].length,\n };\n }\n index += identifier[0].length;\n }\n return null;\n}\n\n/** Number of `callee({` openings in the source. */\nexport function countConfigCalls(source: string, callee: string): number {\n return [...source.matchAll(new RegExp(`\\\\b${callee}\\\\s*\\\\(\\\\s*\\\\{`, \"gu\"))].length;\n}\n\nexport interface ArrayValue {\n /** Index just after the opening `[`. */\n readonly contentStart: number;\n /** True when the array holds nothing but whitespace. */\n readonly empty: boolean;\n}\n\n/**\n * Reads the array literal a top-level key is assigned to.\n *\n * Returns `null` when the value is not an array literal -- a spread from a\n * variable, or a helper call -- because inserting into those would change what\n * the config evaluates to.\n */\nexport function readTopLevelArray(source: string, callee: string, key: string): ArrayValue | null {\n const found = findTopLevelKey(source, callee, key);\n if (found === null) {\n return null;\n }\n const rest = source.slice(found.valueStart);\n const leading = /^\\s*/u.exec(rest)![0];\n if (rest[leading.length] !== \"[\") {\n return null;\n }\n const contentStart = found.valueStart + leading.length + 1;\n return { contentStart, empty: /^\\s*\\]/u.test(source.slice(contentStart)) };\n}\n\n/**\n * Advances past a string, template literal or comment starting at `index`.\n *\n * Returns `index` unchanged when nothing at that position needs skipping.\n */\nfunction skipNonCode(source: string, index: number): number {\n const char = source[index]!;\n if (char === '\"' || char === \"'\" || char === \"`\") {\n return skipQuoted(source, index, char);\n }\n if (char !== \"/\") {\n return index;\n }\n const next = source[index + 1];\n if (next === \"/\") {\n const end = source.indexOf(\"\\n\", index);\n return end === -1 ? source.length : end;\n }\n if (next === \"*\") {\n const end = source.indexOf(\"*/\", index + 2);\n return end === -1 ? source.length : end + 2;\n }\n return index;\n}\n\nfunction skipQuoted(source: string, index: number, quote: string): number {\n let cursor = index + 1;\n while (cursor < source.length) {\n const char = source[cursor]!;\n if (char === \"\\\\\") {\n cursor += 2;\n continue;\n }\n if (char === quote) {\n return cursor + 1;\n }\n cursor += 1;\n }\n return source.length;\n}\n","import { VITE_LINT_BLOCK, VITE_LINT_IMPORT, VITE_PLUGIN_IMPORT } from \"./templates.js\";\nimport { countConfigCalls, findTopLevelKey, readTopLevelArray } from \"./top-level.js\";\n\n/**\n * Conservative source edits for user-owned `vite.config.*` and `nuxt.config.*`.\n *\n * Every function here returns `null` rather than guessing. A wrong edit to a\n * build config breaks the project; a `null` costs the user one paste of a\n * snippet `init` prints for them.\n */\n\nconst VITE_CALLEE = \"defineConfig\";\nconst NUXT_CALLEE = \"defineNuxtConfig\";\n\n/**\n * `defineConfig({` plus the newline that usually follows it.\n *\n * The trailing newline is consumed and re-emitted by the injectors so an\n * inserted key does not leave a stray blank line behind in the user's file.\n */\nconst VITE_OPENING = /\\bdefineConfig\\s*\\(\\s*\\{[^\\S\\r\\n]*(?:\\r?\\n)?/u;\nconst NUXT_OPENING = /\\bdefineNuxtConfig\\s*\\(\\s*\\{[^\\S\\r\\n]*(?:\\r?\\n)?/u;\n\n/**\n * Whether a Vite config is a single plain `defineConfig({ ... })` call that a\n * new top-level key can be inserted into.\n *\n * Anything else -- several `defineConfig` calls, a config built from a variable,\n * or a config that already declares the key -- is left alone.\n */\nexport function canInjectViteKey(source: string, key: string): boolean {\n if (hasTopLevelKey(source, key)) {\n return false;\n }\n return countConfigCalls(source, VITE_CALLEE) === 1;\n}\n\n/** Whether the Vite config declares `key` at the top level of its `defineConfig` call. */\nexport function hasTopLevelKey(source: string, key: string): boolean {\n return findTopLevelKey(source, VITE_CALLEE, key) !== null;\n}\n\n/** Whether the Vite+ `lint` block can be injected into this source. */\nexport function canInjectViteLint(source: string): boolean {\n if (source.includes(\"oxlint-plugin-vize\")) {\n return false;\n }\n return canInjectViteKey(source, \"lint\");\n}\n\n/**\n * Inserts the `lint` block, and its import, into a Vite config.\n *\n * Returns `null` when the source does not have the shape `canInjectViteLint`\n * accepts, so callers cannot inject blindly.\n */\nexport function injectViteLint(source: string): string | null {\n if (!canInjectViteLint(source)) {\n return null;\n }\n const withImport = insertImport(source, VITE_LINT_IMPORT);\n if (withImport === null) {\n return null;\n }\n return withImport.replace(VITE_OPENING, () => `defineConfig({\\n${VITE_LINT_BLOCK}`);\n}\n\n/**\n * Adds `vize()` to a Vite config's top-level `plugins` array, importing the\n * plugin.\n *\n * The array is located by depth-aware scan rather than by regex: a Vite+ config\n * can carry a second `plugins` key inside its `lint` block, and appending Vize's\n * Vite plugin to Oxlint's plugin list would corrupt both.\n */\nexport function injectVitePlugin(source: string): string | null {\n if (source.includes(\"@vizejs/vite-plugin\")) {\n return null;\n }\n const withImport = insertImport(source, VITE_PLUGIN_IMPORT);\n if (withImport === null) {\n return null;\n }\n const plugins = readTopLevelArray(withImport, VITE_CALLEE, \"plugins\");\n if (plugins !== null) {\n return insertArrayEntry(withImport, plugins.contentStart, \"vize()\", plugins.empty);\n }\n if (findTopLevelKey(withImport, VITE_CALLEE, \"plugins\") !== null) {\n // `plugins` exists but is not an array literal; inserting would change what\n // the config evaluates to.\n return null;\n }\n if (!canInjectViteKey(withImport, \"plugins\")) {\n return null;\n }\n return withImport.replace(VITE_OPENING, () => `defineConfig({\\n plugins: [vize()],\\n`);\n}\n\n/**\n * Adds `\"@vizejs/nuxt\"` to a Nuxt config's top-level `modules` array.\n *\n * Nuxt owns its own Vite instance, so the module is the supported integration\n * point; adding `@vizejs/vite-plugin` to a Nuxt-managed Vite config would fight\n * it.\n */\nexport function injectNuxtModule(source: string): string | null {\n if (source.includes(\"@vizejs/nuxt\")) {\n return null;\n }\n if (countConfigCalls(source, NUXT_CALLEE) !== 1) {\n return null;\n }\n const modules = readTopLevelArray(source, NUXT_CALLEE, \"modules\");\n if (modules !== null) {\n return insertArrayEntry(source, modules.contentStart, '\"@vizejs/nuxt\"', modules.empty);\n }\n if (findTopLevelKey(source, NUXT_CALLEE, \"modules\") !== null) {\n return null;\n }\n return source.replace(NUXT_OPENING, () => `defineNuxtConfig({\\n modules: [\"@vizejs/nuxt\"],\\n`);\n}\n\n/**\n * Inserts `entry` as the first element of an array literal.\n *\n * Prepending keeps the user's existing entries in their original order and\n * leaves their formatting alone.\n */\nfunction insertArrayEntry(\n source: string,\n contentStart: number,\n entry: string,\n empty: boolean,\n): string {\n const suffix = empty ? \"\" : \", \";\n const tail = empty ? source.slice(contentStart).replace(/^\\s*/u, \"\") : source.slice(contentStart);\n return `${source.slice(0, contentStart)}${entry}${suffix}${tail}`;\n}\n\n/**\n * Inserts an import after the last existing top-level import.\n *\n * A config with no imports at all returns `null`: the safe insertion point is\n * not obvious, and the file is unusual enough to be worth a human look.\n */\nfunction insertImport(source: string, importLine: string): string | null {\n if (source.includes(importLine.trimEnd())) {\n return source;\n }\n const imports = [\n ...source.matchAll(\n /^import[^\\r\\n]*(?:from\\s+[\"'][^\"']+[\"']|[\"'][^\"']+[\"'])\\s*;?[^\\S\\r\\n]*(?:\\r?\\n|$)/gmu,\n ),\n ];\n const lastImport = imports.at(-1);\n if (lastImport === undefined || lastImport.index === undefined) {\n return null;\n }\n const end = lastImport.index + lastImport[0].length;\n return source.slice(0, end) + importLine + source.slice(end);\n}\n","import type { ProjectDetection } from \"./detect.js\";\nimport { DISCOVERED_OXLINT_CONFIG_FILES } from \"../setup/config.js\";\nimport { canInjectViteLint, hasTopLevelKey } from \"./edit-config.js\";\nimport { VITE_LINT_MERGE_SNIPPET, VITE_LINT_SNIPPET } from \"./templates.js\";\n\nexport { DISCOVERED_OXLINT_CONFIG_FILES } from \"../setup/config.js\";\n\n/**\n * Oxlint config filenames the `oxlint` binary actually auto-discovers.\n *\n * Verified against oxlint 1.64: `.oxlintrc.json`, `.oxlintrc.jsonc` and\n * `oxlint.config.ts` are read; `oxlint.config.mts`, `.js`, `.mjs`, `.cjs` and\n * `.cts` produce a run byte-identical to having no config at all.\n */\n/** Filename `init` writes when the `oxlint` binary is the lint entry point. */\nexport const INIT_OXLINT_CONFIG_FILE = \"oxlint.config.ts\";\n\n/**\n * Where a project's Oxlint configuration has to live to be read.\n *\n * `vp lint` and `vp check` read the `lint` block of `vite.config.ts` and never\n * read `.oxlintrc.json`; the `oxlint` and `oxlint-vize` binaries read\n * `.oxlintrc.json` and never read `vite.config.ts`. Writing the wrong one leaves\n * a project that looks configured, reports zero `vize/*` diagnostics and exits\n * `0` -- the defect #3389 recorded and #3407 fixed. Every branch below therefore\n * follows the command the project will actually run, not the file that is\n * easiest to write.\n */\nexport type LintTargetKind =\n /** Vite+ project: the `lint` block in the Vite config is the only readable place. */\n | \"vite-plus\"\n /** No Vite+: the `oxlint` binary reads its own config file. */\n | \"oxlint\"\n /** Both entry points are in use; both files get written from one settings object. */\n | \"both\"\n /** Vite+ project whose Vite config cannot be edited safely. Nothing is written. */\n | \"manual\";\n\nexport interface LintTarget {\n readonly kind: LintTargetKind;\n /** Vite config to receive the `lint` block, when one can be edited. */\n readonly viteConfig: string | null;\n /** Oxlint config file to write, when the `oxlint` binary is an entry point. */\n readonly oxlintConfig: string | null;\n /** Existing Oxlint config left untouched, if any. */\n readonly preservedOxlintConfig: string | null;\n /** Why this target was chosen. Always shown to the user. */\n readonly reason: string;\n /**\n * Set when the project needs a Vite+ `lint` block that `init` will not write.\n * The caller must print the snippet and must not claim lint is configured.\n */\n readonly blockedReason: string | null;\n /** Snippet to paste when `blockedReason` is set. */\n readonly blockedSnippet: string | null;\n}\n\nexport interface LintTargetInput {\n readonly detection: ProjectDetection;\n /** Source of the single Vite config, or `null` when there is not exactly one. */\n readonly viteSource: string | null;\n}\n\n/**\n * Chooses which Oxlint configuration file(s) the project needs.\n *\n * The `oxlint` binary is treated as an entry point whenever the project already\n * carries a discovered Oxlint config or runs `oxlint` from a script. A Vite+\n * project that also does either gets both files, generated from the same preset\n * and help level, because keeping one of them silently stale is the same class\n * of bug as writing the wrong one.\n */\nexport function resolveLintTarget(input: LintTargetInput): LintTarget {\n const { detection } = input;\n const existing = discoveredOxlintConfig(detection);\n const runsOxlintBinary = existing !== null || hasOxlintScript(detection);\n\n if (!detection.usesVitePlus) {\n return {\n kind: \"oxlint\",\n viteConfig: null,\n oxlintConfig: existing === null ? INIT_OXLINT_CONFIG_FILE : null,\n preservedOxlintConfig: existing,\n reason:\n \"no Vite+ detected, so `oxlint` is the lint entry point and reads \" +\n `${existing ?? INIT_OXLINT_CONFIG_FILE}`,\n blockedReason: null,\n blockedSnippet: null,\n };\n }\n\n const viteConfig = detection.viteConfigs.length === 1 ? detection.viteConfigs[0]! : null;\n const injectable = input.viteSource !== null && canInjectViteLint(input.viteSource);\n if (!detection.hasVitePlusLintBlock && !injectable) {\n const blocked = describeBlocked(detection, input.viteSource);\n return {\n kind: \"manual\",\n viteConfig: null,\n oxlintConfig: null,\n preservedOxlintConfig: existing,\n reason: \"Vite+ detected, so `vp lint` reads the `lint` block in the Vite config\",\n blockedReason: blocked.reason,\n blockedSnippet: blocked.snippet,\n };\n }\n\n if (!runsOxlintBinary) {\n return {\n kind: \"vite-plus\",\n viteConfig,\n oxlintConfig: null,\n preservedOxlintConfig: null,\n reason:\n \"Vite+ detected, so `vp lint` reads the `lint` block in \" +\n `${viteConfig ?? \"the Vite config\"} and never reads .oxlintrc.json`,\n blockedReason: null,\n blockedSnippet: null,\n };\n }\n\n return {\n kind: \"both\",\n viteConfig,\n oxlintConfig: existing === null ? INIT_OXLINT_CONFIG_FILE : null,\n preservedOxlintConfig: existing,\n reason:\n \"Vite+ and the `oxlint` binary are both in use, so the `lint` block in \" +\n `${viteConfig ?? \"the Vite config\"} and ${existing ?? INIT_OXLINT_CONFIG_FILE} ` +\n \"are written from the same preset\",\n blockedReason: null,\n blockedSnippet: null,\n };\n}\n\n/**\n * The existing Oxlint config, restricted to names Oxlint actually reads.\n *\n * A project holding only `oxlint.config.mjs` is deliberately treated as having\n * no Oxlint config, because that is how Oxlint treats it.\n */\nexport function discoveredOxlintConfig(detection: ProjectDetection): string | null {\n const existing = detection.oxlintConfig;\n if (existing === null) {\n return null;\n }\n return (DISCOVERED_OXLINT_CONFIG_FILES as readonly string[]).includes(existing) ? existing : null;\n}\n\n/** An Oxlint config file that is present but which Oxlint will never read. */\nexport function unreadOxlintConfig(detection: ProjectDetection): string | null {\n const existing = detection.oxlintConfig;\n if (existing === null || discoveredOxlintConfig(detection) !== null) {\n return null;\n }\n return existing;\n}\n\nfunction hasOxlintScript(detection: ProjectDetection): boolean {\n return Object.values(detection.scripts).some((command) =>\n /(?:^|[\\s&|;])oxlint(?:-vize)?(?:\\s|$)/u.test(command),\n );\n}\n\n/**\n * Why the `lint` block will not be written.\n *\n * The message is the whole value of a blocked result, so it names the specific\n * obstacle instead of a generic \"could not edit\". An existing `lint` block in\n * particular is a merge the user has to make, not a failure of the file.\n */\nfunction describeBlocked(\n detection: ProjectDetection,\n viteSource: string | null,\n): { readonly reason: string; readonly snippet: string } {\n if (detection.viteConfigs.length === 0) {\n return { reason: \"no vite.config file to hold the `lint` block\", snippet: VITE_LINT_SNIPPET };\n }\n if (detection.viteConfigs.length > 1) {\n return {\n reason: `several Vite configs (${detection.viteConfigs.join(\", \")}), so the target is ambiguous`,\n snippet: VITE_LINT_SNIPPET,\n };\n }\n const filename = detection.viteConfigs[0]!;\n if (viteSource !== null && hasTopLevelKey(viteSource, \"lint\")) {\n return {\n reason:\n `${filename} already has a \\`lint\\` block and merging into it would risk dropping ` +\n \"settings, so spread createVizeLintConfig() into it by hand\",\n snippet: VITE_LINT_MERGE_SNIPPET,\n };\n }\n return {\n reason: `${filename} is not a single plain defineConfig({ ... }) call`,\n snippet: VITE_LINT_SNIPPET,\n };\n}\n","import type { ProjectDetection } from \"./detect.js\";\nimport { discoveredOxlintConfig, unreadOxlintConfig } from \"./lint-target.js\";\n\nexport const FEATURE_IDS = [\"lint\", \"bundler\", \"fmt\", \"typecheck\", \"editor\"] as const;\n\nexport type FeatureId = (typeof FEATURE_IDS)[number];\n\nexport type FeatureSelection = Readonly<Record<FeatureId, boolean>>;\n\nexport interface FeatureOffer {\n readonly id: FeatureId;\n /** Label shown in the prompt and in the plan. Reflects what detection found. */\n readonly label: string;\n /** False when the project cannot support the feature at all. */\n readonly available: boolean;\n /** True when the project already has this feature wired up. */\n readonly configured: boolean;\n /** Why the feature is unavailable or already configured. Empty when neither. */\n readonly note: string;\n readonly defaultSelected: boolean;\n}\n\n/**\n * Turns detection into the five offers `init` presents.\n *\n * Already-configured features stay selected by default so a re-run is a no-op\n * the user can confirm rather than a set of boxes they have to re-tick.\n */\nexport function offerFeatures(detection: ProjectDetection): readonly FeatureOffer[] {\n return [\n lintOffer(detection),\n bundlerOffer(detection),\n fmtOffer(detection),\n typecheckOffer(detection),\n editorOffer(detection),\n ];\n}\n\n/** Selection implied by detection alone, used by `--yes` and as the prompt default. */\nexport function defaultSelection(offers: readonly FeatureOffer[]): FeatureSelection {\n const selection: Record<FeatureId, boolean> = {\n lint: false,\n bundler: false,\n fmt: false,\n typecheck: false,\n editor: false,\n };\n for (const offer of offers) {\n selection[offer.id] = offer.defaultSelected;\n }\n return selection;\n}\n\nfunction lintOffer(detection: ProjectDetection): FeatureOffer {\n const configured = detection.usesVitePlus\n ? detection.hasVitePlusLintBlock\n : discoveredOxlintConfig(detection) !== null;\n const unread = unreadOxlintConfig(detection);\n const label = detection.usesVitePlus\n ? \"oxlint plugin (vp lint reads the `lint` block in the Vite config)\"\n : \"oxlint plugin (the oxlint binary reads oxlint.config.ts)\";\n return {\n id: \"lint\",\n label,\n available: true,\n configured,\n note: configured\n ? \"already configured\"\n : unread === null\n ? \"\"\n : `${unread} exists but oxlint never reads it (#3474)`,\n defaultSelected: true,\n };\n}\n\nfunction bundlerOffer(detection: ProjectDetection): FeatureOffer {\n if (detection.framework === \"nuxt\") {\n return {\n id: \"bundler\",\n label: \"nuxt module (@vizejs/nuxt)\",\n available: detection.nuxtConfig !== null,\n configured: detection.hasVizeNuxtModule,\n note: detection.hasVizeNuxtModule\n ? \"already configured\"\n : detection.nuxtConfig === null\n ? \"no nuxt.config file to add @vizejs/nuxt to\"\n : \"\",\n defaultSelected: detection.nuxtConfig !== null,\n };\n }\n if (detection.framework === \"vite\") {\n const single = detection.viteConfigs.length === 1;\n return {\n id: \"bundler\",\n label: \"vite plugin (@vizejs/vite-plugin)\",\n available: single,\n configured: detection.hasVizeVitePlugin,\n note: detection.hasVizeVitePlugin\n ? \"already configured\"\n : single\n ? \"\"\n : `several Vite configs (${detection.viteConfigs.join(\", \")})`,\n defaultSelected: single,\n };\n }\n return {\n id: \"bundler\",\n label: \"vite plugin or nuxt module\",\n available: false,\n configured: false,\n note: \"no vite.config or nuxt.config found; the other features work without one\",\n defaultSelected: false,\n };\n}\n\nfunction fmtOffer(detection: ProjectDetection): FeatureOffer {\n const configured = detection.vizeConfig !== null && \"vize:fmt\" in detection.scripts;\n return {\n id: \"fmt\",\n label: \"fmt (vize fmt)\",\n available: true,\n configured,\n note: configured ? \"already configured\" : \"\",\n defaultSelected: true,\n };\n}\n\nfunction typecheckOffer(detection: ProjectDetection): FeatureOffer {\n const configured =\n detection.tsconfig !== null &&\n detection.vizeConfig !== null &&\n \"vize:check\" in detection.scripts;\n return {\n id: \"typecheck\",\n label: \"typecheck (vize check)\",\n available: true,\n configured,\n note: configured\n ? \"already configured\"\n : detection.tsconfig === null\n ? \"creates tsconfig.json\"\n : \"\",\n defaultSelected: true,\n };\n}\n\nfunction editorOffer(detection: ProjectDetection): FeatureOffer {\n return {\n id: \"editor\",\n label: \"editor extension (.vscode/extensions.json recommendation)\",\n available: true,\n configured: detection.vscodeRecommendsVize,\n note: detection.vscodeRecommendsVize ? \"already recommended\" : \"\",\n defaultSelected: true,\n };\n}\n","import { FEATURE_IDS, type FeatureId } from \"./select.js\";\n\nexport type BundlerOverride = \"vite\" | \"nuxt\" | null;\n\nexport interface InitArgs {\n readonly root: string | null;\n /** Explicit per-feature choices. Absent entries fall back to detection. */\n readonly overrides: Readonly<Partial<Record<FeatureId, boolean>>>;\n readonly bundlerOverride: BundlerOverride;\n readonly yes: boolean;\n readonly dryRun: boolean;\n readonly install: boolean;\n readonly packageManager: string | null;\n readonly help: boolean;\n}\n\nconst PACKAGE_MANAGERS = [\"pnpm\", \"npm\", \"yarn\", \"bun\", \"vp\"] as const;\n\n/**\n * Parses `vize init` arguments.\n *\n * `--yes` is the only switch that disables prompting. Per-feature flags without\n * it still prompt, using the flags as the pre-ticked defaults, which keeps a\n * half-typed command from silently writing files.\n */\nexport function parseInitArgs(args: readonly string[]): InitArgs {\n const overrides: Partial<Record<FeatureId, boolean>> = {};\n let root: string | null = null;\n let bundlerOverride: BundlerOverride = null;\n let yes = false;\n let dryRun = false;\n let install = true;\n let packageManager: string | null = null;\n let help = false;\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index]!;\n if (arg === \"-h\" || arg === \"--help\") {\n help = true;\n continue;\n }\n if (arg === \"-y\" || arg === \"--yes\") {\n yes = true;\n continue;\n }\n if (arg === \"--dry-run\") {\n dryRun = true;\n continue;\n }\n if (arg === \"--no-install\") {\n install = false;\n continue;\n }\n if (arg === \"--package-manager\") {\n packageManager = requirePackageManager(args[index + 1]);\n index += 1;\n continue;\n }\n if (arg.startsWith(\"--package-manager=\")) {\n packageManager = requirePackageManager(arg.slice(\"--package-manager=\".length));\n continue;\n }\n if (arg === \"--vite\" || arg === \"--nuxt\") {\n bundlerOverride = arg === \"--vite\" ? \"vite\" : \"nuxt\";\n overrides.bundler = true;\n continue;\n }\n const feature = matchFeatureFlag(arg);\n if (feature !== null) {\n overrides[feature.id] = feature.enabled;\n continue;\n }\n if (arg.startsWith(\"-\")) {\n throw new Error(`Unknown init option: ${arg}`);\n }\n if (root !== null) {\n throw new Error(`Unexpected init argument: ${arg}`);\n }\n root = arg;\n }\n\n return { root, overrides, bundlerOverride, yes, dryRun, install, packageManager, help };\n}\n\nfunction matchFeatureFlag(arg: string): { id: FeatureId; enabled: boolean } | null {\n for (const id of FEATURE_IDS) {\n if (arg === `--${id}`) {\n return { id, enabled: true };\n }\n if (arg === `--no-${id}`) {\n return { id, enabled: false };\n }\n }\n return null;\n}\n\nfunction requirePackageManager(value: string | undefined): string {\n if (value === undefined || value.startsWith(\"-\")) {\n throw new Error(\"--package-manager requires a value\");\n }\n if (!(PACKAGE_MANAGERS as readonly string[]).includes(value)) {\n throw new Error(\n `Unknown package manager: ${value}. Expected one of ${PACKAGE_MANAGERS.join(\", \")}`,\n );\n }\n return value;\n}\n\nexport function initHelp(): string {\n return `Select, install, and configure Vize in an existing project\n\nUsage: vize init [ROOT] [OPTIONS]\n\nArguments:\n [ROOT] Project root containing package.json (default: current directory)\n\nOptions:\n -y, --yes Accept the detected selection without prompting\n --lint / --no-lint oxlint plugin\n --vite vite plugin (forces the Vite target)\n --nuxt nuxt module (forces the Nuxt target)\n --bundler/--no-bundler vite plugin or nuxt module, auto-detected\n --fmt / --no-fmt vize fmt\n --typecheck vize check (creates tsconfig.json when missing)\n --no-typecheck\n --editor / --no-editor .vscode/extensions.json recommendation\n --dry-run Print the plan without writing anything\n --no-install Write configuration without installing dependencies\n --package-manager <PM> One of ${PACKAGE_MANAGERS.join(\", \")} (default: detected)\n -h, --help Print help\n\nWithout --yes, init prompts. A non-TTY stdin is detected and refused rather than\nhung, so CI must pass --yes together with the per-feature flags it wants.\n`;\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport {\n dependencyNames,\n OXLINT_CONFIG_FILES,\n parsePackageJson,\n readRequiredFile,\n VIZE_CONFIG_FILES,\n} from \"../setup/config.js\";\n\nexport const NUXT_CONFIG_FILES = [\n \"nuxt.config.ts\",\n \"nuxt.config.mts\",\n \"nuxt.config.js\",\n \"nuxt.config.mjs\",\n] as const;\n\nexport const VITE_CONFIG_FILES = [\n \"vite.config.ts\",\n \"vite.config.mts\",\n \"vite.config.js\",\n \"vite.config.mjs\",\n] as const;\n\nexport type PackageManager = \"pnpm\" | \"npm\" | \"yarn\" | \"bun\";\n\n/**\n * Bundler integration `init` can wire up.\n *\n * Nuxt outranks Vite because a Nuxt project owns its own Vite instance: adding\n * `@vizejs/vite-plugin` to a Nuxt-managed Vite config would fight the module.\n */\nexport type Framework = \"nuxt\" | \"vite\" | \"none\";\n\nexport interface ProjectDetection {\n readonly root: string;\n readonly packageManager: PackageManager | null;\n readonly framework: Framework;\n readonly nuxtConfig: string | null;\n readonly viteConfigs: readonly string[];\n readonly usesVitePlus: boolean;\n readonly typescript: boolean;\n readonly tsconfig: string | null;\n readonly vizeConfig: string | null;\n readonly oxlintConfig: string | null;\n readonly hasVitePlusLintBlock: boolean;\n readonly hasVizeVitePlugin: boolean;\n readonly hasVizeNuxtModule: boolean;\n readonly dependencies: ReadonlySet<string>;\n readonly scripts: Readonly<Record<string, string>>;\n readonly vscodeRecommendsVize: boolean;\n}\n\n/**\n * Package-manager detection.\n *\n * Deliberately mirrors `detect_package_manager` in\n * `crates/vize_canon/src/batch/error.rs`, including the lockfile priority order\n * and the `packageManager` prefix fallback. The Rust side suggests an install\n * command in its corsa-not-found message; if the two ever disagreed, a user\n * would be told to run `pnpm add` by one half of the toolchain and `npm install`\n * by the other.\n */\nexport function detectPackageManager(root: string): PackageManager | null {\n const exists = (name: string): boolean => fs.existsSync(path.join(root, name));\n if (exists(\"pnpm-lock.yaml\")) {\n return \"pnpm\";\n }\n if (exists(\"bun.lockb\") || exists(\"bun.lock\")) {\n return \"bun\";\n }\n if (exists(\"yarn.lock\")) {\n return \"yarn\";\n }\n if (exists(\"package-lock.json\")) {\n return \"npm\";\n }\n return detectPackageManagerField(root);\n}\n\nfunction detectPackageManagerField(root: string): PackageManager | null {\n let source: string;\n try {\n source = fs.readFileSync(path.join(root, \"package.json\"), \"utf8\");\n } catch {\n return null;\n }\n let field: unknown;\n try {\n field = (JSON.parse(source) as { packageManager?: unknown }).packageManager;\n } catch {\n return null;\n }\n if (typeof field !== \"string\") {\n return null;\n }\n for (const candidate of [\"pnpm\", \"yarn\", \"bun\", \"npm\"] as const) {\n if (field.startsWith(candidate)) {\n return candidate;\n }\n }\n return null;\n}\n\n/**\n * Applies an explicit `--vite` / `--nuxt` choice over what detection concluded.\n *\n * Overriding the framework rather than branching later keeps one code path: the\n * planner, the prompt and the printed detection summary all see the same answer,\n * so the summary cannot claim Vite while the plan configures Nuxt.\n */\nexport function withFramework(\n detection: ProjectDetection,\n framework: Framework | null,\n): ProjectDetection {\n return framework === null || framework === detection.framework\n ? detection\n : { ...detection, framework };\n}\n\nexport function detectProject(root: string): ProjectDetection {\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 dependencies = dependencyNames(packageJson);\n const scripts = readScripts(packageJson);\n\n const nuxtConfig = findExisting(root, NUXT_CONFIG_FILES);\n const viteConfigs = VITE_CONFIG_FILES.filter((candidate) =>\n fs.existsSync(path.join(root, candidate)),\n );\n const viteSource = viteConfigs.length === 1 ? readFile(root, viteConfigs[0]!) : null;\n const nuxtSource = nuxtConfig === null ? null : readFile(root, nuxtConfig);\n\n return {\n root,\n packageManager: detectPackageManager(root),\n framework: detectFramework(nuxtConfig, viteConfigs, dependencies),\n nuxtConfig,\n viteConfigs,\n usesVitePlus: detectVitePlus(dependencies, viteSource, scripts),\n typescript: dependencies.has(\"typescript\") || fs.existsSync(path.join(root, \"tsconfig.json\")),\n tsconfig: fs.existsSync(path.join(root, \"tsconfig.json\")) ? \"tsconfig.json\" : null,\n vizeConfig: findExisting(root, VIZE_CONFIG_FILES),\n oxlintConfig: findExisting(root, OXLINT_CONFIG_FILES),\n hasVitePlusLintBlock: viteSource !== null && viteSource.includes(\"oxlint-plugin-vize\"),\n hasVizeVitePlugin: viteSource !== null && viteSource.includes(\"@vizejs/vite-plugin\"),\n hasVizeNuxtModule: nuxtSource !== null && nuxtSource.includes(\"@vizejs/nuxt\"),\n dependencies,\n scripts,\n vscodeRecommendsVize: detectVscodeRecommendation(root),\n };\n}\n\nfunction detectFramework(\n nuxtConfig: string | null,\n viteConfigs: readonly string[],\n dependencies: ReadonlySet<string>,\n): Framework {\n if (nuxtConfig !== null || dependencies.has(\"nuxt\")) {\n return \"nuxt\";\n }\n return viteConfigs.length > 0 ? \"vite\" : \"none\";\n}\n\n/**\n * Whether the project's lint command is `vp lint` rather than the `oxlint` binary.\n *\n * This single boolean decides which file `init` must write the Oxlint\n * configuration into, so it is deliberately generous: a project is treated as a\n * Vite+ project if the dependency is declared, if its Vite config imports from\n * `vite-plus`, or if any script invokes `vp`. Guessing \"plain Oxlint\" for a\n * Vite+ project is the failure that #3389 documented — `vp lint` would ignore\n * `.oxlintrc.json` and report zero Vize diagnostics while exiting 0.\n */\nfunction detectVitePlus(\n dependencies: ReadonlySet<string>,\n viteSource: string | null,\n scripts: Readonly<Record<string, string>>,\n): boolean {\n if (dependencies.has(\"vite-plus\")) {\n return true;\n }\n if (viteSource !== null && /from\\s+[\"']vite-plus[\"']/u.test(viteSource)) {\n return true;\n }\n return Object.values(scripts).some((command) => /(?:^|[\\s&|;])vpx?(?:\\s|$)/u.test(command));\n}\n\nfunction detectVscodeRecommendation(root: string): boolean {\n let source: string;\n try {\n source = fs.readFileSync(path.join(root, \".vscode\", \"extensions.json\"), \"utf8\");\n } catch {\n return false;\n }\n return source.includes(\"ubugeeei.vize\");\n}\n\nfunction readScripts(packageJson: Record<string, unknown>): Record<string, string> {\n const scripts = packageJson.scripts;\n if (typeof scripts !== \"object\" || scripts === null || Array.isArray(scripts)) {\n return {};\n }\n const entries: Record<string, string> = {};\n for (const [name, command] of Object.entries(scripts)) {\n if (typeof command === \"string\") {\n entries[name] = command;\n }\n }\n return entries;\n}\n\nfunction findExisting(root: string, candidates: readonly string[]): string | null {\n return candidates.find((candidate) => fs.existsSync(path.join(root, candidate))) ?? null;\n}\n\nfunction readFile(root: string, relative: string): string {\n return fs.readFileSync(path.join(root, relative), \"utf8\");\n}\n","import type { PlannedFile } from \"../setup/config.js\";\nimport type { ProjectDetection } from \"./detect.js\";\nimport type { LintTarget } from \"./lint-target.js\";\nimport type { FeatureId, FeatureSelection } from \"./select.js\";\n\n/**\n * Shared plan vocabulary.\n *\n * Lives apart from `plan.ts` so the per-feature planners can name these types\n * without importing the orchestrator that calls them.\n */\n\nexport type FeatureOutcome =\n /** The feature was selected and something was written for it. */\n | \"configured\"\n /** The feature was selected and is already wired up. A re-run lands here. */\n | \"unchanged\"\n /** The feature was not selected, or the project cannot support it. */\n | \"skipped\"\n /** Selected, but a user-owned file has to be edited by hand. Nothing written. */\n | \"blocked\";\n\nexport interface FeatureResult {\n readonly id: FeatureId;\n readonly outcome: FeatureOutcome;\n readonly detail: string;\n /** Snippet the user must paste when `outcome` is `blocked`. */\n readonly snippet: string | null;\n}\n\nexport interface InitCommand {\n readonly command: string;\n readonly args: readonly string[];\n readonly cwd: string;\n}\n\nexport interface InitPlan {\n readonly root: string;\n readonly detection: ProjectDetection;\n readonly lintTarget: LintTarget;\n readonly features: readonly FeatureResult[];\n readonly files: readonly PlannedFile[];\n readonly createdFiles: readonly string[];\n readonly updatedFiles: readonly string[];\n readonly addedScripts: readonly string[];\n readonly commands: readonly InitCommand[];\n}\n\nexport interface PlanInitOptions {\n readonly detection: ProjectDetection;\n readonly selection: FeatureSelection;\n readonly install: boolean;\n readonly packageManager?: string;\n}\n\n/** Mutable accumulators the per-feature planners append to. */\nexport interface PlanDraft {\n readonly files: PlannedFile[];\n readonly createdFiles: string[];\n readonly updatedFiles: string[];\n readonly features: FeatureResult[];\n readonly dependencies: Set<string>;\n}\n\nexport function createPlanDraft(): PlanDraft {\n return {\n files: [],\n createdFiles: [],\n updatedFiles: [],\n features: [],\n dependencies: new Set<string>(),\n };\n}\n\nexport function skipped(id: FeatureId, detail = \"not selected\"): FeatureResult {\n return { id, outcome: \"skipped\", detail, snippet: null };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type { ProjectDetection } from \"./detect.js\";\nimport { injectNuxtModule, injectVitePlugin } from \"./edit-config.js\";\nimport { skipped, type PlanDraft } from \"./plan-types.js\";\n\n/**\n * Plans the bundler integration: the Vite plugin, or the Nuxt module.\n *\n * Nuxt outranks Vite because a Nuxt project owns its own Vite instance --\n * adding `@vizejs/vite-plugin` to a Nuxt-managed Vite config would fight the\n * module rather than complement it.\n *\n * @returns the possibly-edited Vite config source, or the input unchanged.\n */\nexport function planBundler(\n detection: ProjectDetection,\n viteDraft: string | null,\n draft: PlanDraft,\n): string | null {\n if (detection.framework === \"nuxt\") {\n planNuxtModule(detection, draft);\n return viteDraft;\n }\n if (detection.framework !== \"vite\" || detection.viteConfigs.length !== 1) {\n draft.features.push(skipped(\"bundler\", \"no single vite.config or nuxt.config to configure\"));\n return viteDraft;\n }\n draft.dependencies.add(\"@vizejs/vite-plugin\");\n const filename = detection.viteConfigs[0]!;\n if (detection.hasVizeVitePlugin) {\n draft.features.push({\n id: \"bundler\",\n outcome: \"unchanged\",\n detail: `${filename} already uses @vizejs/vite-plugin`,\n snippet: null,\n });\n return viteDraft;\n }\n const injected = viteDraft === null ? null : injectVitePlugin(viteDraft);\n if (injected === null) {\n draft.features.push({\n id: \"bundler\",\n outcome: \"blocked\",\n detail: `${filename} has no plugins array this tool can extend safely`,\n snippet: \"plugins: [vize()]\",\n });\n return viteDraft;\n }\n draft.features.push({\n id: \"bundler\",\n outcome: \"configured\",\n detail: `adds vize() to ${filename}`,\n snippet: null,\n });\n return injected;\n}\n\nfunction planNuxtModule(detection: ProjectDetection, draft: PlanDraft): void {\n draft.dependencies.add(\"@vizejs/nuxt\");\n if (detection.nuxtConfig === null) {\n draft.features.push(skipped(\"bundler\", \"no nuxt.config file to add @vizejs/nuxt to\"));\n return;\n }\n if (detection.hasVizeNuxtModule) {\n draft.features.push({\n id: \"bundler\",\n outcome: \"unchanged\",\n detail: `${detection.nuxtConfig} already lists @vizejs/nuxt`,\n snippet: null,\n });\n return;\n }\n const source = fs.readFileSync(path.join(detection.root, detection.nuxtConfig), \"utf8\");\n const injected = injectNuxtModule(source);\n if (injected === null) {\n draft.features.push({\n id: \"bundler\",\n outcome: \"blocked\",\n detail: `${detection.nuxtConfig} is not a single plain defineNuxtConfig({ ... }) call`,\n snippet: 'modules: [\"@vizejs/nuxt\"]',\n });\n return;\n }\n draft.files.push({\n filename: path.join(detection.root, detection.nuxtConfig),\n source: injected,\n });\n draft.updatedFiles.push(detection.nuxtConfig);\n draft.features.push({\n id: \"bundler\",\n outcome: \"configured\",\n detail: `adds @vizejs/nuxt to ${detection.nuxtConfig}`,\n snippet: null,\n });\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { detectJsonIndent, type PlannedFile } from \"../setup/config.js\";\nimport type { ProjectDetection } from \"./detect.js\";\nimport type { FeatureResult } from \"./plan-types.js\";\nimport { renderVscodeExtensions, VSCODE_EXTENSION_ID } from \"./templates.js\";\n\nconst EXTENSIONS_FILE = path.join(\".vscode\", \"extensions.json\");\n\n/**\n * Plans the editor recommendation.\n *\n * `.vscode/extensions.json` is preferred over `code --install-extension` because\n * it is checked in, applies to everyone on the project, and changes nothing on\n * the machine running `init`. An existing file is merged, never replaced: it\n * usually carries the team's other recommendations.\n */\nexport function planEditorFile(\n detection: ProjectDetection,\n files: PlannedFile[],\n createdFiles: string[],\n updatedFiles: string[],\n): FeatureResult {\n const filename = path.join(detection.root, \".vscode\", \"extensions.json\");\n let source: string;\n try {\n source = fs.readFileSync(filename, \"utf8\");\n } catch {\n files.push({ filename, source: renderVscodeExtensions(2) });\n createdFiles.push(EXTENSIONS_FILE);\n return {\n id: \"editor\",\n outcome: \"configured\",\n detail: `writes ${EXTENSIONS_FILE} recommending ${VSCODE_EXTENSION_ID}`,\n snippet: null,\n };\n }\n\n const merged = mergeRecommendation(source);\n if (merged === null) {\n return {\n id: \"editor\",\n outcome: \"blocked\",\n detail: `${EXTENSIONS_FILE} is not a plain JSON object this tool can extend safely`,\n snippet: `\"recommendations\": [\"${VSCODE_EXTENSION_ID}\"]`,\n };\n }\n if (merged === source) {\n return {\n id: \"editor\",\n outcome: \"unchanged\",\n detail: `${EXTENSIONS_FILE} already recommends ${VSCODE_EXTENSION_ID}`,\n snippet: null,\n };\n }\n files.push({ filename, source: merged });\n updatedFiles.push(EXTENSIONS_FILE);\n return {\n id: \"editor\",\n outcome: \"configured\",\n detail: `adds ${VSCODE_EXTENSION_ID} to ${EXTENSIONS_FILE}`,\n snippet: null,\n };\n}\n\n/**\n * Adds the recommendation to an existing file, preserving its other keys and its\n * indentation. Returns the input unchanged when the id is already listed, and\n * `null` when the file is not a JSON object with an array of string\n * recommendations.\n */\nfunction mergeRecommendation(source: string): string | null {\n let parsed: unknown;\n try {\n parsed = JSON.parse(source);\n } catch {\n return null;\n }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n return null;\n }\n const document = parsed as Record<string, unknown>;\n const existing = document.recommendations;\n if (existing !== undefined && !isStringArray(existing)) {\n return null;\n }\n const recommendations = existing ?? [];\n if (recommendations.includes(VSCODE_EXTENSION_ID)) {\n return source;\n }\n document.recommendations = [...recommendations, VSCODE_EXTENSION_ID];\n return `${JSON.stringify(document, null, detectJsonIndent(source))}\\n`;\n}\n\nfunction isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every((entry) => typeof entry === \"string\");\n}\n","import path from \"node:path\";\n\nimport type { ProjectDetection } from \"./detect.js\";\nimport { injectViteLint } from \"./edit-config.js\";\nimport { INIT_OXLINT_CONFIG_FILE, type LintTarget } from \"./lint-target.js\";\nimport type { PlanDraft } from \"./plan-types.js\";\nimport { INIT_OXLINT_CONFIG } from \"./templates.js\";\n\n/**\n * Plans the Oxlint wiring into whichever file the project's lint command reads.\n *\n * The single rule this function exists to enforce: never write an Oxlint config\n * the project's own lint command ignores. `vp lint` and `vp check` read only the\n * `lint` block of the Vite config; `oxlint` and `oxlint-vize` read only their own\n * config file. Writing the wrong one produces a project that looks configured,\n * reports zero `vize/*` diagnostics and exits `0` -- #3389, fixed in #3407.\n *\n * When the required file cannot be edited safely this returns a `blocked`\n * result and writes nothing at all. Falling back to the *other* file would be\n * the bug: the user would see a success message and get silence from the linter.\n *\n * @returns the possibly-edited Vite config source, or the input unchanged.\n */\nexport function planLint(\n detection: ProjectDetection,\n lintTarget: LintTarget,\n viteDraft: string | null,\n draft: PlanDraft,\n): string | null {\n if (lintTarget.blockedReason !== null) {\n draft.features.push({\n id: \"lint\",\n outcome: \"blocked\",\n detail:\n `vp lint reads the \\`lint\\` block in the Vite config, but ${lintTarget.blockedReason}. ` +\n \"Nothing was written: an unconfigured project fails loudly, while an Oxlint config vp \" +\n \"lint never reads reports zero Vize diagnostics and exits 0\",\n snippet: lintTarget.blockedSnippet,\n });\n return viteDraft;\n }\n\n let source = viteDraft;\n const wrote: string[] = [];\n if (lintTarget.viteConfig !== null && !detection.hasVitePlusLintBlock && source !== null) {\n const injected = injectViteLint(source);\n if (injected !== null) {\n source = injected;\n wrote.push(lintTarget.viteConfig);\n }\n }\n if (lintTarget.oxlintConfig !== null) {\n draft.files.push({\n filename: path.join(detection.root, INIT_OXLINT_CONFIG_FILE),\n source: INIT_OXLINT_CONFIG,\n });\n draft.createdFiles.push(INIT_OXLINT_CONFIG_FILE);\n wrote.push(INIT_OXLINT_CONFIG_FILE);\n }\n draft.features.push({\n id: \"lint\",\n outcome: wrote.length > 0 ? \"configured\" : \"unchanged\",\n detail:\n wrote.length > 0 ? `${lintTarget.reason}; writes ${wrote.join(\" and \")}` : lintTarget.reason,\n snippet: null,\n });\n return source;\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { DEFAULT_SCRIPTS, detectJsonIndent, parsePackageJson } from \"../setup/config.js\";\nimport type { ProjectDetection } from \"./detect.js\";\nimport { skipped, type PlanDraft } from \"./plan-types.js\";\nimport type { FeatureId, FeatureSelection } from \"./select.js\";\nimport { renderTypecheckTsconfig, renderVizeConfig } from \"./templates.js\";\n\n/** Scripts each feature contributes, reusing the command strings `setup` ships. */\nconst FEATURE_SCRIPTS: Readonly<Record<FeatureId, readonly string[]>> = {\n lint: [\"vize:lint\"],\n bundler: [],\n fmt: [\"vize:fmt\", \"vize:fmt:fix\"],\n typecheck: [\"vize:check\"],\n editor: [],\n};\n\n/**\n * Plans `vize.config.ts` and the fmt/typecheck feature results.\n *\n * Only selected features contribute a block, so asking for the formatter alone\n * does not hand the project a type checker it never opted into. An existing Vize\n * config is never rewritten: merging into a user's config is exactly the kind of\n * guess that loses their settings.\n */\nexport function planVizeConfig(\n detection: ProjectDetection,\n selection: FeatureSelection,\n draft: PlanDraft,\n): void {\n if (selection.typecheck && detection.tsconfig === null) {\n draft.files.push({\n filename: path.join(detection.root, \"tsconfig.json\"),\n source: renderTypecheckTsconfig(detection.typescript),\n });\n draft.createdFiles.push(\"tsconfig.json\");\n }\n\n for (const id of [\"fmt\", \"typecheck\"] as const) {\n if (!selection[id]) {\n draft.features.push(skipped(id));\n continue;\n }\n const scaffoldsTsconfig = id === \"typecheck\" && detection.tsconfig === null;\n draft.features.push({\n id,\n outcome: scaffoldsTsconfig || detection.vizeConfig === null ? \"configured\" : \"unchanged\",\n detail: scaffoldsTsconfig\n ? detection.vizeConfig === null\n ? \"writes tsconfig.json and vize.config.ts\"\n : `writes tsconfig.json; ${detection.vizeConfig} already exists and was left unchanged`\n : detection.vizeConfig === null\n ? \"writes vize.config.ts\"\n : `${detection.vizeConfig} already exists and was left unchanged`,\n snippet: null,\n });\n }\n\n const needsConfig = selection.lint || selection.fmt || selection.typecheck;\n if (!needsConfig || detection.vizeConfig !== null) {\n return;\n }\n draft.files.push({\n filename: path.join(detection.root, \"vize.config.ts\"),\n source: renderVizeConfig({\n lint: selection.lint,\n fmt: selection.fmt,\n typecheck: selection.typecheck,\n vite: detection.framework === \"vite\",\n }),\n });\n draft.createdFiles.push(\"vize.config.ts\");\n}\n\n/**\n * Adds the scripts the selected features need.\n *\n * A script the project already defines is left alone, whatever its value: the\n * user's version of `vize:lint` outranks the default, and rewriting it would\n * make a second `init` run destructive.\n */\nexport function planScripts(\n detection: ProjectDetection,\n selection: FeatureSelection,\n draft: PlanDraft,\n): readonly string[] {\n const wanted: string[] = [];\n for (const id of [\"lint\", \"fmt\", \"typecheck\"] as const) {\n if (!selection[id]) {\n continue;\n }\n wanted.push(...FEATURE_SCRIPTS[id]);\n }\n const missing = wanted.filter((name) => !(name in detection.scripts));\n if (missing.length === 0) {\n return [];\n }\n const packagePath = path.join(detection.root, \"package.json\");\n const source = fs.readFileSync(packagePath, \"utf8\");\n const packageJson = parsePackageJson(packagePath, source);\n const scripts = { ...detection.scripts } as Record<string, string>;\n for (const name of missing) {\n scripts[name] = DEFAULT_SCRIPTS[name as keyof typeof DEFAULT_SCRIPTS];\n }\n packageJson.scripts = scripts;\n draft.files.push({\n filename: packagePath,\n source: `${JSON.stringify(packageJson, null, detectJsonIndent(source))}\\n`,\n });\n draft.updatedFiles.push(\"package.json\");\n return missing;\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type { ProjectDetection } from \"./detect.js\";\nimport { resolveLintTarget } from \"./lint-target.js\";\nimport { planBundler } from \"./plan-bundler.js\";\nimport { planEditorFile } from \"./plan-editor.js\";\nimport { planLint } from \"./plan-lint.js\";\nimport { planScripts, planVizeConfig } from \"./plan-project.js\";\nimport {\n createPlanDraft,\n skipped,\n type FeatureResult,\n type InitCommand,\n type InitPlan,\n type PlanInitOptions,\n} from \"./plan-types.js\";\nimport type { FeatureId } from \"./select.js\";\n\nexport type {\n FeatureOutcome,\n FeatureResult,\n InitCommand,\n InitPlan,\n PlanInitOptions,\n} from \"./plan-types.js\";\n\n/** Dev dependencies each feature needs. */\nconst FEATURE_DEPENDENCIES: Readonly<Record<FeatureId, readonly string[]>> = {\n lint: [\"oxlint\", \"oxlint-plugin-vize\"],\n bundler: [],\n fmt: [\"vize\"],\n typecheck: [\"vize\"],\n editor: [],\n};\n\nconst INSTALL_ARGS: Readonly<Record<string, readonly string[]>> = {\n pnpm: [\"add\", \"-D\"],\n yarn: [\"add\", \"-D\"],\n bun: [\"add\", \"-D\"],\n npm: [\"install\", \"-D\"],\n vp: [\"add\", \"-D\"],\n};\n\nconst FEATURE_ORDER: readonly FeatureId[] = [\"lint\", \"bundler\", \"fmt\", \"typecheck\", \"editor\"];\n\n/**\n * Builds the full plan without touching the filesystem.\n *\n * Planning is separated from execution so `--dry-run`, the interactive\n * confirmation and the tests all inspect the same object the writer consumes;\n * a plan that is correct in `--dry-run` and wrong on disk is not possible.\n */\nexport function planInit(options: PlanInitOptions): InitPlan {\n const { detection, selection } = options;\n const draft = createPlanDraft();\n\n const viteSource = readSingleViteConfig(detection);\n const lintTarget = resolveLintTarget({ detection, viteSource });\n\n let viteDraft = viteSource;\n if (selection.lint) {\n viteDraft = planLint(detection, lintTarget, viteDraft, draft);\n addAll(draft.dependencies, FEATURE_DEPENDENCIES.lint);\n } else {\n draft.features.push(skipped(\"lint\"));\n }\n\n if (selection.bundler) {\n viteDraft = planBundler(detection, viteDraft, draft);\n } else {\n draft.features.push(skipped(\"bundler\"));\n }\n\n // One write for the Vite config, however many features touched it, so the\n // plugin edit and the lint edit cannot overwrite one another.\n if (viteSource !== null && viteDraft !== null && viteDraft !== viteSource) {\n const filename = detection.viteConfigs[0]!;\n draft.files.push({ filename: path.join(detection.root, filename), source: viteDraft });\n draft.updatedFiles.push(filename);\n }\n\n planVizeConfig(detection, selection, draft);\n for (const id of [\"fmt\", \"typecheck\"] as const) {\n if (selection[id]) {\n addAll(draft.dependencies, FEATURE_DEPENDENCIES[id]);\n }\n }\n\n draft.features.push(\n selection.editor\n ? planEditorFile(detection, draft.files, draft.createdFiles, draft.updatedFiles)\n : skipped(\"editor\"),\n );\n\n const addedScripts = planScripts(detection, selection, draft);\n return {\n root: detection.root,\n detection,\n lintTarget,\n features: sortFeatures(draft.features),\n files: draft.files,\n createdFiles: draft.createdFiles,\n updatedFiles: draft.updatedFiles,\n addedScripts,\n commands: planCommands(detection, draft.dependencies, options),\n };\n}\n\n/**\n * The install commands, as a list so callers can assert on them.\n *\n * Exactly one command is emitted, or none when every dependency is already\n * declared -- which is what makes a second `init` run a no-op.\n */\nfunction planCommands(\n detection: ProjectDetection,\n dependencies: ReadonlySet<string>,\n options: PlanInitOptions,\n): readonly InitCommand[] {\n if (!options.install) {\n return [];\n }\n const missing = [...dependencies].filter((name) => !detection.dependencies.has(name)).sort();\n if (missing.length === 0) {\n return [];\n }\n const command = resolveInstaller(detection, options.packageManager);\n return [{ command, args: [...INSTALL_ARGS[command]!, ...missing], cwd: detection.root }];\n}\n\n/**\n * Installer used for the one install command.\n *\n * A Vite+ project gets `vp add`, matching `setup` and the project's own\n * workflow. Otherwise the package manager comes from the same lockfile rules\n * `detect_package_manager` uses on the Rust side, defaulting to npm when\n * nothing identifies one.\n */\nexport function resolveInstaller(detection: ProjectDetection, override?: string): string {\n if (override !== undefined) {\n return override;\n }\n if (detection.usesVitePlus) {\n return \"vp\";\n }\n return detection.packageManager ?? \"npm\";\n}\n\nfunction readSingleViteConfig(detection: ProjectDetection): string | null {\n if (detection.viteConfigs.length !== 1) {\n return null;\n }\n return fs.readFileSync(path.join(detection.root, detection.viteConfigs[0]!), \"utf8\");\n}\n\nfunction addAll(target: Set<string>, values: readonly string[]): void {\n for (const value of values) {\n target.add(value);\n }\n}\n\nfunction sortFeatures(features: readonly FeatureResult[]): readonly FeatureResult[] {\n return [...features].sort(\n (left, right) => FEATURE_ORDER.indexOf(left.id) - FEATURE_ORDER.indexOf(right.id),\n );\n}\n","import readline from \"node:readline\";\n\nimport type { FeatureId, FeatureOffer, FeatureSelection } from \"./select.js\";\n\n/**\n * Interactive multi-select for the five features.\n *\n * Implemented on `node:readline` rather than a prompt package: `vize` is a\n * published CLI whose install cost every user pays, and a numbered toggle list\n * needs no raw-mode handling, no terminal restore path, and no dependency in the\n * runtime path. It is a real multi-select -- numbers toggle, Enter accepts.\n */\n\nexport interface PromptIo {\n readonly input: NodeJS.ReadableStream;\n readonly output: NodeJS.WritableStream;\n}\n\nexport interface PromptDeps extends PromptIo {\n /** Resolves to `null` when the input ended before an answer arrived. */\n readonly question: (query: string) => Promise<string | null>;\n /**\n * Releases the terminal. Required for readline-backed deps: an open interface\n * keeps stdin referenced and the process never exits.\n */\n readonly close?: () => void;\n}\n\n/** True when stdin cannot answer a prompt, so `init` must not ask one. */\nexport function isNonInteractive(stream: NodeJS.ReadableStream): boolean {\n return (stream as NodeJS.ReadStream).isTTY !== true;\n}\n\n/**\n * Wraps `node:readline` so a closed input resolves instead of hanging.\n *\n * `rl.question` never invokes its callback when stdin reaches EOF first. Left\n * alone that leaves `init`'s promise permanently pending, and the process exits\n * `0` having written nothing -- a silent no-op that looks like success. Resolving\n * to `null` on close turns that into an explicit cancellation.\n */\nexport function createPromptDeps(io: PromptIo): PromptDeps {\n const rl = readline.createInterface({ input: io.input, output: io.output });\n let closed = false;\n rl.on(\"close\", () => {\n closed = true;\n });\n return {\n ...io,\n question: (query) =>\n new Promise<string | null>((resolve) => {\n if (closed) {\n resolve(null);\n return;\n }\n let settled = false;\n const onClose = (): void => {\n if (!settled) {\n settled = true;\n resolve(null);\n }\n };\n rl.once(\"close\", onClose);\n rl.question(query, (answer) => {\n if (settled) {\n return;\n }\n settled = true;\n rl.removeListener(\"close\", onClose);\n resolve(answer);\n });\n }),\n close: () => {\n rl.close();\n },\n };\n}\n\n/** Runs the checklist. Returns `null` when the input ended before confirmation. */\nexport async function selectFeatures(\n offers: readonly FeatureOffer[],\n initial: FeatureSelection,\n deps: PromptDeps,\n): Promise<FeatureSelection | null> {\n const selection: Record<FeatureId, boolean> = { ...initial };\n const toggleable = offers.filter((offer) => offer.available);\n for (;;) {\n deps.output.write(renderChecklist(offers, selection));\n const raw = await deps.question(\"> \");\n if (raw === null) {\n return null;\n }\n const answer = raw.trim();\n if (answer === \"\") {\n return selection;\n }\n const indexes = parseIndexes(answer, toggleable.length);\n if (indexes === null) {\n deps.output.write(\n `Enter numbers between 1 and ${toggleable.length}, or press Enter to accept.\\n`,\n );\n continue;\n }\n for (const index of indexes) {\n const offer = toggleable[index]!;\n selection[offer.id] = !selection[offer.id];\n }\n }\n}\n\n/** Yes/no confirmation. A closed input counts as \"no\", never as \"yes\". */\nexport async function confirm(query: string, deps: PromptDeps): Promise<boolean> {\n const raw = await deps.question(`${query} [Y/n] `);\n if (raw === null) {\n return false;\n }\n const answer = raw.trim().toLowerCase();\n return answer === \"\" || answer === \"y\" || answer === \"yes\";\n}\n\nfunction renderChecklist(\n offers: readonly FeatureOffer[],\n selection: Readonly<Record<FeatureId, boolean>>,\n): string {\n const lines = [\n \"\",\n \"Select the features to configure.\",\n \"Type the numbers to toggle (space or comma separated), then press Enter.\",\n \"\",\n ];\n let position = 0;\n for (const offer of offers) {\n if (!offer.available) {\n lines.push(` - ${offer.label}${offer.note === \"\" ? \"\" : ` (${offer.note})`}`);\n continue;\n }\n position += 1;\n const mark = selection[offer.id] ? \"x\" : \" \";\n const note = offer.note === \"\" ? \"\" : ` (${offer.note})`;\n lines.push(` ${position}. [${mark}] ${offer.label}${note}`);\n }\n lines.push(\"\");\n return `${lines.join(\"\\n\")}\\n`;\n}\n\n/** Parses a toggle answer into zero-based indexes, or `null` when any entry is out of range. */\nfunction parseIndexes(answer: string, count: number): readonly number[] | null {\n const tokens = answer.split(/[\\s,]+/u).filter((token) => token !== \"\");\n const indexes: number[] = [];\n for (const token of tokens) {\n if (!/^\\d+$/u.test(token)) {\n return null;\n }\n const value = Number.parseInt(token, 10);\n if (value < 1 || value > count) {\n return null;\n }\n indexes.push(value - 1);\n }\n return indexes.length === 0 ? null : indexes;\n}\n","import type { ProjectDetection } from \"./detect.js\";\nimport { unreadOxlintConfig } from \"./lint-target.js\";\nimport type { InitPlan } from \"./plan.js\";\nimport { EDITOR_INTEGRATIONS } from \"./templates.js\";\n\nconst PREFIX = \"[vize init]\";\n\n/**\n * Detection summary, printed before any prompt.\n *\n * Users need to see what `init` concluded before they are asked to act on it;\n * an unexpected line here is the cheapest place to catch a wrong root or a\n * missing lockfile.\n */\nexport function renderDetection(detection: ProjectDetection): string {\n const lines = [\n `${PREFIX} detected in ${detection.root}:`,\n ` framework: ${describeFramework(detection)}`,\n ` package manager: ${detection.packageManager ?? \"none detected (defaulting to npm)\"}`,\n ` language: ${detection.typescript ? \"TypeScript\" : \"JavaScript\"}${\n detection.tsconfig === null ? \" (no tsconfig.json)\" : \" (tsconfig.json)\"\n }`,\n ` lint command: ${detection.usesVitePlus ? \"vp lint\" : \"oxlint\"}`,\n ` vize config: ${detection.vizeConfig ?? \"none\"}`,\n ` oxlint config: ${describeOxlintConfig(detection)}`,\n ];\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nfunction describeFramework(detection: ProjectDetection): string {\n if (detection.framework === \"nuxt\") {\n return `Nuxt (${detection.nuxtConfig ?? \"nuxt dependency, no nuxt.config\"})`;\n }\n if (detection.framework === \"vite\") {\n const configs = detection.viteConfigs.join(\", \");\n return detection.usesVitePlus ? `Vite+ (${configs})` : `Vite (${configs})`;\n }\n return \"none (no vite.config or nuxt.config)\";\n}\n\nfunction describeOxlintConfig(detection: ProjectDetection): string {\n const unread = unreadOxlintConfig(detection);\n if (unread !== null) {\n return `${unread} — present but oxlint does not read this name (#3474)`;\n }\n return detection.oxlintConfig ?? \"none\";\n}\n\n/**\n * The full plan.\n *\n * Printed before anything is written in both modes, so the wording is what the\n * run is about to do, not what it has done. `--dry-run` differs only in stopping\n * afterwards.\n */\nexport function renderPlan(plan: InitPlan, dryRun: boolean): string {\n const verb = dryRun ? \"would\" : \"will\";\n const lines: string[] = [`${PREFIX} plan:`];\n for (const feature of plan.features) {\n lines.push(` ${feature.id.padEnd(9)} ${feature.outcome.padEnd(10)} ${feature.detail}`);\n }\n for (const filename of plan.createdFiles) {\n lines.push(`${PREFIX} ${verb} create ${filename}`);\n }\n for (const filename of plan.updatedFiles) {\n lines.push(`${PREFIX} ${verb} update ${filename}`);\n }\n if (plan.addedScripts.length > 0) {\n lines.push(`${PREFIX} ${verb} add scripts: ${plan.addedScripts.join(\", \")}`);\n }\n for (const command of plan.commands) {\n lines.push(`${PREFIX} ${verb} run: ${command.command} ${command.args.join(\" \")}`);\n }\n if (plan.createdFiles.length + plan.updatedFiles.length + plan.commands.length === 0) {\n lines.push(`${PREFIX} nothing to do; the project is already configured`);\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\n/**\n * Snippets for anything `init` refused to edit.\n *\n * A blocked feature is deliberately loud. The alternative for the lint feature\n * would be writing an Oxlint config the project's lint command never reads,\n * which reports zero Vize diagnostics and exits 0 (#3389).\n */\nexport function renderBlocked(plan: InitPlan): string {\n const blocked = plan.features.filter((feature) => feature.outcome === \"blocked\");\n if (blocked.length === 0) {\n return \"\";\n }\n const lines: string[] = [];\n for (const feature of blocked) {\n lines.push(`${PREFIX} ${feature.id}: NOT configured — ${feature.detail}`);\n if (feature.snippet !== null) {\n lines.push(\"\", indent(feature.snippet), \"\");\n }\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nexport function renderEditors(): string {\n const lines = [`${PREFIX} editor integrations shipped with Vize:`];\n for (const integration of EDITOR_INTEGRATIONS) {\n lines.push(` ${integration}`);\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\n/**\n * Printed when the prompt ends without a confirmation.\n *\n * Covers both a declined confirmation and an input stream that closed\n * mid-prompt. Saying so is what keeps a closed stdin from looking like a\n * successful run that happened to change nothing.\n */\nexport function renderCancelled(): string {\n return `${PREFIX} cancelled; nothing was written.\\n`;\n}\n\nexport function renderNonInteractiveRefusal(): string {\n return (\n `${PREFIX} stdin is not a TTY, so init will not prompt.\\n` +\n `${PREFIX} pass --yes with the features you want, for example:\\n` +\n `${PREFIX} vize init --yes --lint --vite --fmt --typecheck --editor\\n` +\n `${PREFIX} or run with --dry-run to print the plan without writing.\\n`\n );\n}\n\nfunction indent(source: string): string {\n return source\n .split(\"\\n\")\n .map((line) => (line === \"\" ? line : ` ${line}`))\n .join(\"\\n\")\n .trimEnd();\n}\n","import { execFileSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { atomicWriteFile } from \"./setup/config.js\";\nimport { initHelp, parseInitArgs, type InitArgs } from \"./init/args.js\";\nimport { detectProject, withFramework, type ProjectDetection } from \"./init/detect.js\";\nimport { planInit, type InitCommand, type InitPlan } from \"./init/plan.js\";\nimport {\n confirm,\n createPromptDeps,\n isNonInteractive,\n selectFeatures,\n type PromptDeps,\n} from \"./init/prompt.js\";\nimport {\n renderBlocked,\n renderCancelled,\n renderDetection,\n renderEditors,\n renderNonInteractiveRefusal,\n renderPlan,\n} from \"./init/report.js\";\nimport { defaultSelection, offerFeatures, type FeatureSelection } from \"./init/select.js\";\n\nexport type { InitCommand, InitPlan } from \"./init/plan.js\";\nexport type { ProjectDetection } from \"./init/detect.js\";\n\nexport interface InitOptions {\n readonly root: string;\n readonly args?: readonly string[];\n readonly runCommand?: (command: InitCommand) => void;\n readonly writeFile?: (filename: string, source: string) => void;\n readonly output?: (chunk: string) => void;\n readonly promptDeps?: PromptDeps;\n readonly stdin?: NodeJS.ReadableStream;\n}\n\n/**\n * Resolves the feature selection from detection, flags, and -- when the terminal\n * allows it -- the user.\n *\n * A non-TTY stdin without `--yes` returns `null`: refusing is the only correct\n * answer, because prompting would hang a CI job forever.\n */\nexport async function resolveSelection(\n detection: ProjectDetection,\n args: InitArgs,\n deps: {\n readonly output: (chunk: string) => void;\n readonly stdin: NodeJS.ReadableStream;\n readonly promptDeps?: PromptDeps;\n },\n): Promise<FeatureSelection | null> {\n const offers = offerFeatures(detection);\n const base = defaultSelection(offers);\n // An explicit flag survives even when detection says the feature is\n // unavailable: the planner then reports it as blocked, with the reason. That\n // is more useful than dropping the flag the user typed.\n const withOverrides: Record<string, boolean> = { ...base };\n for (const [id, enabled] of Object.entries(args.overrides)) {\n withOverrides[id] = enabled;\n }\n const selection = withOverrides as FeatureSelection;\n\n if (args.yes) {\n return selection;\n }\n if (deps.promptDeps === undefined && isNonInteractive(deps.stdin)) {\n deps.output(renderNonInteractiveRefusal());\n return null;\n }\n // Only a prompt this function created may be closed here; an injected one\n // belongs to the caller.\n const owned =\n deps.promptDeps === undefined\n ? createPromptDeps({ input: deps.stdin, output: process.stdout as NodeJS.WritableStream })\n : null;\n const promptDeps = deps.promptDeps ?? owned!;\n try {\n const chosen = await selectFeatures(offers, selection, promptDeps);\n if (chosen !== null && (await confirm(\"Apply this selection?\", promptDeps))) {\n return chosen;\n }\n deps.output(renderCancelled());\n return null;\n } finally {\n owned?.close?.();\n }\n}\n\n/**\n * Runs `init` end to end.\n *\n * Detection is reported before anything is decided, the plan is reported before\n * anything is written, and a blocked feature is reported as NOT configured\n * rather than quietly downgraded.\n */\nexport async function initProject(options: InitOptions): Promise<InitPlan | null> {\n const args = parseInitArgs(options.args ?? []);\n const output = options.output ?? ((chunk: string) => process.stdout.write(chunk));\n const root = path.resolve(args.root ?? options.root);\n const detection = withFramework(detectProject(root), args.bundlerOverride);\n output(renderDetection(detection));\n\n const selection = await resolveSelection(detection, args, {\n output,\n stdin: options.stdin ?? process.stdin,\n promptDeps: options.promptDeps,\n });\n if (selection === null) {\n return null;\n }\n\n const plan = planInit({\n detection,\n selection,\n install: args.install,\n packageManager: args.packageManager ?? undefined,\n });\n output(renderPlan(plan, args.dryRun));\n output(renderBlocked(plan));\n if (args.dryRun) {\n return plan;\n }\n\n writePlannedFiles(plan, options.writeFile ?? writeProjectFile);\n const runCommand = options.runCommand ?? runInitCommand;\n for (const command of plan.commands) {\n runCommand(command);\n }\n if (selection.editor) {\n output(renderEditors());\n }\n return plan;\n}\n\nexport async function runInitCli(args: readonly string[]): Promise<void> {\n if (parseInitArgs(args).help) {\n process.stdout.write(initHelp());\n return;\n }\n const plan = await initProject({ root: process.cwd(), args });\n if (plan === null) {\n process.exitCode = 1;\n return;\n }\n if (plan.features.some((feature) => feature.outcome === \"blocked\")) {\n process.exitCode = 1;\n }\n}\n\n/**\n * Default writer.\n *\n * Creates the parent directory first so `.vscode/extensions.json` works in a\n * project that has never had a `.vscode` folder, then reuses `setup`'s atomic\n * write so a crash mid-run cannot leave a half-written config behind.\n */\nfunction writeProjectFile(filename: string, source: string): void {\n fs.mkdirSync(path.dirname(filename), { recursive: true });\n atomicWriteFile(filename, source);\n}\n\nfunction writePlannedFiles(\n plan: InitPlan,\n writeFile: (filename: string, source: string) => void,\n): void {\n const written: string[] = [];\n for (const file of plan.files) {\n try {\n writeFile(file.filename, file.source);\n } catch (error) {\n if (written.length === 0) {\n throw error;\n }\n throw new Error(\n `init partially completed: wrote ${written.join(\", \")} before ` +\n `${path.relative(plan.root, file.filename)} failed. Run init again to finish.`,\n { cause: error },\n );\n }\n written.push(path.relative(plan.root, file.filename));\n }\n}\n\nfunction runInitCommand(command: InitCommand): void {\n execFileSync(command.command, [...command.args], { cwd: command.cwd, stdio: \"inherit\" });\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 DISCOVERED_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 = DISCOVERED_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 DISCOVERED_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 { configureBundledCorsaRuntime } from \"./corsa-runtime.js\";\nimport { runInitCli } from \"./init.js\";\nimport { runSetupCli } from \"./setup.js\";\n\nconst require = createRequire(import.meta.url);\n\nfunction fail(error: unknown): void {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[vize] ${message}\\n`);\n process.exitCode = 1;\n}\n\ntry {\n const args = process.argv.slice(2);\n if (args[0] === \"setup\") {\n runSetupCli(args.slice(1));\n } else if (args[0] === \"init\") {\n // `init` prompts, so it is the one command that has to be async. Failures\n // land in the same reporter as the synchronous commands.\n runInitCli(args.slice(1)).catch(fail);\n } else {\n configureBundledCorsaRuntime();\n const native = require(\"@vizejs/native\") as typeof import(\"@vizejs/native\");\n native.runCli(args);\n }\n} catch (error) {\n fail(error);\n}\n"],"mappings":";;;;;;;AAKA,MAAa,kCAAkC;CAC7C;CACA;CACA;CACA;CACD;AAQD,SAAgB,6BACd,cAAiC,QAAQ,KACzC,UAAoC,EAAE,EACvB;CACf,IAAI,yBAAyB,YAAY,EAAE,OAAO;CAElD,MAAM,aAAa,2BAA2B,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AAW,sCACjF,EAAE,OAAO,OAAO,CACjB;;EAEH,aAAa,KAAK,KAAK,SAAS,MAAM,KAAK,SAAS,CAAC;;;;;AChQzD,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAE9C,SAAS,KAAK,OAAsB;CAClC,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;CACtE,QAAQ,OAAO,MAAM,UAAU,QAAQ,IAAI;CAC3C,QAAQ,WAAW;;AAGrB,IAAI;CACF,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;CAClC,IAAI,KAAK,OAAO,SACd,YAAY,KAAK,MAAM,EAAE,CAAC;MACrB,IAAI,KAAK,OAAO,QAGrB,WAAW,KAAK,MAAM,EAAE,CAAC,CAAC,MAAM,KAAK;MAChC;EACL,8BAA8B;EAE9B,QADuB,iBACjB,CAAC,OAAO,KAAK;;SAEd,OAAO;CACd,KAAK,MAAM"}
1
+ {"version":3,"file":"cli.mjs","names":["VITE_CONFIG_FILES","writePlannedFiles"],"sources":["../src/corsa-runtime.ts","../src/setup/config.ts","../src/init/templates.ts","../src/init/top-level.ts","../src/init/edit-config.ts","../src/init/lint-target.ts","../src/init/select.ts","../src/init/args.ts","../src/init/detect.ts","../src/init/plan-types.ts","../src/init/plan-bundler.ts","../src/init/plan-editor.ts","../src/init/plan-lint.ts","../src/init/plan-project.ts","../src/init/plan.ts","../src/init/prompt.ts","../src/init/report.ts","../src/init.ts","../src/setup/vite.ts","../src/setup.ts","../src/cli.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nexport const publicCorsaEnvironmentVariables = [\n \"CORSA_PATH\",\n \"CORSA_EXECUTABLE\",\n \"TSGO_PATH\",\n \"TSGO_EXECUTABLE\",\n] as const;\n\ntype RuntimeResolutionOptions = {\n arch?: string;\n packageRoot?: string;\n platform?: NodeJS.Platform;\n};\n\nexport function configureBundledCorsaRuntime(\n environment: NodeJS.ProcessEnv = process.env,\n options: RuntimeResolutionOptions = {},\n): string | null {\n if (hasPublicRuntimeOverride(environment)) return null;\n\n const executable = resolveBundledCorsaRuntime(options);\n if (executable == null) return null;\n\n environment.CORSA_PATH = executable;\n return executable;\n}\n\nexport function resolveBundledCorsaRuntime(options: RuntimeResolutionOptions = {}): string | null {\n const packageRoot =\n options.packageRoot ?? path.resolve(path.dirname(fileURLToPath(import.meta.url)), \"..\");\n const platform = options.platform ?? process.platform;\n const arch = options.arch ?? process.arch;\n\n try {\n const cliManifestPath = path.join(packageRoot, \"package.json\");\n const cliManifest = readManifest(cliManifestPath);\n const declaredMetaVersion = cliManifest.optionalDependencies?.[\"@typescript/native-preview\"];\n if (typeof declaredMetaVersion !== \"string\") return null;\n\n const packageRequire = createRequire(cliManifestPath);\n const metaManifestPath = packageRequire.resolve(\"@typescript/native-preview/package.json\");\n const metaManifest = readManifest(metaManifestPath);\n if (\n metaManifest.name !== \"@typescript/native-preview\" ||\n !matchesDeclaredVersion(metaManifest.version, declaredMetaVersion)\n ) {\n return null;\n }\n\n const platformPackage = `@typescript/native-preview-${platform}-${arch}`;\n const declaredPlatformVersion = metaManifest.optionalDependencies?.[platformPackage];\n if (typeof declaredPlatformVersion !== \"string\") return null;\n\n const metaRequire = createRequire(metaManifestPath);\n const platformManifestPath = metaRequire.resolve(`${platformPackage}/package.json`);\n const platformManifest = readManifest(platformManifestPath);\n if (\n platformManifest.name !== platformPackage ||\n !matchesDeclaredVersion(platformManifest.version, declaredPlatformVersion)\n ) {\n return null;\n }\n\n const executable = path.join(\n path.dirname(platformManifestPath),\n \"lib\",\n platform === \"win32\" ? \"tsgo.exe\" : \"tsgo\",\n );\n return fs.existsSync(executable) ? executable : null;\n } catch {\n // The runtime is optional. Existing Rust-side discovery remains the fallback.\n return null;\n }\n}\n\nfunction hasPublicRuntimeOverride(environment: NodeJS.ProcessEnv): boolean {\n return publicCorsaEnvironmentVariables.some((name) => {\n const value = environment[name];\n return value != null && value !== \"\";\n });\n}\n\nfunction matchesDeclaredVersion(actual: unknown, declared: string): boolean {\n return typeof actual === \"string\" && (declared.startsWith(\"catalog:\") || actual === declared);\n}\n\nfunction readManifest(filename: string): {\n name?: string;\n optionalDependencies?: Record<string, string>;\n version?: string;\n} {\n return JSON.parse(fs.readFileSync(filename, \"utf8\"));\n}\n","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\n/** Config filenames Oxlint 1.64 auto-discovers. */\nexport const DISCOVERED_OXLINT_CONFIG_FILES = [\n \".oxlintrc.json\",\n \".oxlintrc.jsonc\",\n \"oxlint.config.ts\",\n] as const;\n\n/**\n * All plausible Oxlint config filenames, including names the binary ignores.\n *\n * Project detection keeps the ignored names so `vize init` can explain why it\n * will not preserve them. Setup must use `DISCOVERED_OXLINT_CONFIG_FILES`.\n */\nexport const OXLINT_CONFIG_FILES = [\n ...DISCOVERED_OXLINT_CONFIG_FILES,\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 // No positional input: the default command must check the complete tsconfig\n // project graph, including root files and referenced projects outside src.\n \"vize:check\": \"vize check\",\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 jsxTypecheck: 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","/**\n * Config sources `vize init` writes.\n *\n * Every Oxlint-facing template here is derived from one settings object so the\n * `vp lint` block and the `oxlint` config can never describe different presets.\n * See `lint-target.ts` for why writing the wrong one of the two is silent.\n */\n\n/** Preset both Oxlint entry points run with. The bridge's own default. */\nexport const INIT_LINT_PRESET = \"general-recommended\";\n\n/** `settings.vize.helpLevel` both Oxlint entry points run with. */\nexport const INIT_LINT_HELP_LEVEL = \"short\";\n\n/** VS Code extension id published from `editors/vscode`. */\nexport const VSCODE_EXTENSION_ID = \"ubugeeei.vize\";\n\nexport interface VizeConfigFeatures {\n readonly lint: boolean;\n readonly fmt: boolean;\n readonly typecheck: boolean;\n readonly vite: boolean;\n}\n\n/**\n * Builds `vize.config.ts` from the selected features.\n *\n * Only selected features contribute a block, so a project that asked for the\n * formatter alone does not silently get a type checker it never opted into.\n */\nexport function renderVizeConfig(features: VizeConfigFeatures): string {\n const blocks: string[] = [\n ` compiler: {\n templateSyntax: \"standard\",\n },`,\n ];\n if (features.lint) {\n blocks.push(` linter: {\n enabled: true,\n preset: \"${INIT_LINT_PRESET}\",\n },`);\n }\n if (features.fmt) {\n blocks.push(` formatter: {\n singleAttributePerLine: false,\n sortBlocks: true,\n },`);\n }\n if (features.typecheck) {\n blocks.push(` typeChecker: {\n enabled: true,\n strict: true,\n jsxTypecheck: true,\n },`);\n }\n if (features.vite) {\n blocks.push(` vite: {\n scanPatterns: [\"src/**/*.vue\"],\n },`);\n }\n return `import { defineConfig } from \"vize\";\n\nexport default defineConfig({\n${blocks.join(\"\\n\")}\n});\n`;\n}\n\n/** Minimum project config written only when typechecking is selected and no config exists. */\nexport function renderTypecheckTsconfig(typescript: boolean): string {\n const compilerOptions: Record<string, boolean | string> = {\n strict: true,\n target: \"ES2022\",\n module: \"ESNext\",\n moduleResolution: \"Bundler\",\n jsx: \"preserve\",\n };\n if (!typescript) {\n compilerOptions.allowJs = true;\n compilerOptions.checkJs = true;\n }\n compilerOptions.noEmit = true;\n compilerOptions.skipLibCheck = true;\n return `${JSON.stringify({ compilerOptions, include: [\"src/**/*\"] }, null, 2)}\\n`;\n}\n\n/**\n * Config for the `oxlint` binary.\n *\n * `.oxlintrc.json` cannot import `configs.recommended`, and the bridge only runs\n * `vize/*` rules that appear in `rules`, so a JSON config would need every rule\n * id inlined and would rot on the next rule addition. `oxlint.config.ts` is\n * Oxlint's TypeScript config format and is auto-discovered (verified against\n * oxlint 1.64; `oxlint.config.mjs`, `.js`, `.cjs`, `.mts` and `.cts` are not --\n * see #3474), so it is the only form that stays correct over time.\n */\nexport const INIT_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: \"${INIT_LINT_PRESET}\",\n helpLevel: \"${INIT_LINT_HELP_LEVEL}\",\n },\n },\n rules: configs.recommended,\n});\n`;\n\n/** Import line the Vite+ `lint` block needs. */\nexport const VITE_LINT_IMPORT =\n 'import { createVizeLintConfig } from \"oxlint-plugin-vize\";\\n' as const;\n\n/**\n * The Vite+ `lint` block, the only Oxlint configuration `vp lint` and `vp check`\n * read.\n *\n * `createVizeLintConfig()` returns the whole block rather than fragments, which\n * is what makes the `jsPlugins` entry impossible to omit. Hand-assembling the\n * block is how a config ends up looking wired while reporting nothing.\n */\nexport const VITE_LINT_BLOCK = ` lint: createVizeLintConfig({\n preset: \"${INIT_LINT_PRESET}\",\n settings: {\n helpLevel: \"${INIT_LINT_HELP_LEVEL}\",\n },\n }),\n`;\n\n/** Snippet printed when a Vite config has no `lint` block and cannot be edited safely. */\nexport const VITE_LINT_SNIPPET = `import { createVizeLintConfig } from \"oxlint-plugin-vize\";\n\nexport default defineConfig({\n${VITE_LINT_BLOCK}});\n`;\n\n/**\n * Snippet printed when the Vite config already has a `lint` block.\n *\n * Spreading is the documented way to keep an existing block's other keys while\n * still taking the whole Vize block, `jsPlugins` included.\n */\nexport const VITE_LINT_MERGE_SNIPPET = `import { createVizeLintConfig } from \"oxlint-plugin-vize\";\n\nexport default defineConfig({\n lint: {\n ...createVizeLintConfig({\n preset: \"${INIT_LINT_PRESET}\",\n settings: {\n helpLevel: \"${INIT_LINT_HELP_LEVEL}\",\n },\n }),\n // keep your existing lint keys here\n },\n});\n`;\n\nexport const VITE_PLUGIN_IMPORT = 'import vize from \"@vizejs/vite-plugin\";\\n' as const;\n\nexport const VITE_PLUGIN_SNIPPET = `import vize from \"@vizejs/vite-plugin\";\n\nexport default defineConfig({\n plugins: [vize()],\n});\n`;\n\nexport const NUXT_MODULE_SNIPPET = `export default defineNuxtConfig({\n modules: [\"@vizejs/nuxt\"],\n});\n`;\n\n/**\n * `.vscode/extensions.json` written when no file exists yet.\n *\n * Recommendations are chosen over `code --install-extension` because they are\n * checked in, apply to the whole team, and change nothing on the machine that\n * runs `init`.\n */\nexport function renderVscodeExtensions(indent: string | number): string {\n return `${JSON.stringify({ recommendations: [VSCODE_EXTENSION_ID] }, null, indent)}\\n`;\n}\n\n/** Editor integrations shipped from this repo, reported alongside the VS Code one. */\nexport const EDITOR_INTEGRATIONS = [\n \"VS Code: ubugeeei.vize (recommended in .vscode/extensions.json)\",\n \"Zed: tools/zed-vize\",\n \"Neovim: tools/nvim-vize\",\n \"Vim: tools/vim-vize\",\n \"Helix: tools/helix-vize\",\n \"Emacs: tools/emacs-vize\",\n] as const;\n","/**\n * Depth-aware lookup of a top-level key in a `defineConfig({ ... })` call.\n *\n * A plain regex cannot tell the config's own `plugins` key from the `plugins`\n * key inside a `lint: { ... }` block, and picking the wrong one rewrites a part\n * of the user's config they never asked to change. This scanner tracks bracket\n * depth and skips strings, template literals and comments, so a key only matches\n * at depth 0 of the config object.\n *\n * It is not a JavaScript parser and does not try to be: template-literal\n * substitutions and regex literals are treated as ordinary text. Both make the\n * scan give up or miss, which turns into a refusal to edit -- the safe direction.\n */\n\nconst IDENTIFIER = /^[$A-Z_a-z][$\\w]*/u;\nconst KEY_SEPARATOR = /^\\s*:/u;\n\nexport interface TopLevelKey {\n /** Index of the first character of the key. */\n readonly keyStart: number;\n /** Index of the first character after the `:`. */\n readonly valueStart: number;\n}\n\n/** Finds `key` at the top level of `callee({ ... })`, or `null`. */\nexport function findTopLevelKey(source: string, callee: string, key: string): TopLevelKey | null {\n const opening = new RegExp(`\\\\b${callee}\\\\s*\\\\(\\\\s*\\\\{`, \"u\").exec(source);\n if (opening === null) {\n return null;\n }\n let index = opening.index + opening[0].length;\n let depth = 0;\n while (index < source.length) {\n const char = source[index]!;\n const skipped = skipNonCode(source, index);\n if (skipped !== index) {\n index = skipped;\n continue;\n }\n if (char === \"{\" || char === \"[\" || char === \"(\") {\n depth += 1;\n index += 1;\n continue;\n }\n if (char === \"}\" || char === \"]\" || char === \")\") {\n if (depth === 0) {\n // Closing brace of the config object itself: the key is not here.\n return null;\n }\n depth -= 1;\n index += 1;\n continue;\n }\n const identifier = IDENTIFIER.exec(source.slice(index));\n if (identifier === null) {\n index += 1;\n continue;\n }\n const separator = KEY_SEPARATOR.exec(source.slice(index + identifier[0].length));\n if (depth === 0 && identifier[0] === key && separator !== null) {\n return {\n keyStart: index,\n valueStart: index + identifier[0].length + separator[0].length,\n };\n }\n index += identifier[0].length;\n }\n return null;\n}\n\n/** Number of `callee({` openings in the source. */\nexport function countConfigCalls(source: string, callee: string): number {\n return [...source.matchAll(new RegExp(`\\\\b${callee}\\\\s*\\\\(\\\\s*\\\\{`, \"gu\"))].length;\n}\n\nexport interface ArrayValue {\n /** Index just after the opening `[`. */\n readonly contentStart: number;\n /** True when the array holds nothing but whitespace. */\n readonly empty: boolean;\n}\n\n/**\n * Reads the array literal a top-level key is assigned to.\n *\n * Returns `null` when the value is not an array literal -- a spread from a\n * variable, or a helper call -- because inserting into those would change what\n * the config evaluates to.\n */\nexport function readTopLevelArray(source: string, callee: string, key: string): ArrayValue | null {\n const found = findTopLevelKey(source, callee, key);\n if (found === null) {\n return null;\n }\n const rest = source.slice(found.valueStart);\n const leading = /^\\s*/u.exec(rest)![0];\n if (rest[leading.length] !== \"[\") {\n return null;\n }\n const contentStart = found.valueStart + leading.length + 1;\n return { contentStart, empty: /^\\s*\\]/u.test(source.slice(contentStart)) };\n}\n\n/**\n * Advances past a string, template literal or comment starting at `index`.\n *\n * Returns `index` unchanged when nothing at that position needs skipping.\n */\nfunction skipNonCode(source: string, index: number): number {\n const char = source[index]!;\n if (char === '\"' || char === \"'\" || char === \"`\") {\n return skipQuoted(source, index, char);\n }\n if (char !== \"/\") {\n return index;\n }\n const next = source[index + 1];\n if (next === \"/\") {\n const end = source.indexOf(\"\\n\", index);\n return end === -1 ? source.length : end;\n }\n if (next === \"*\") {\n const end = source.indexOf(\"*/\", index + 2);\n return end === -1 ? source.length : end + 2;\n }\n return index;\n}\n\nfunction skipQuoted(source: string, index: number, quote: string): number {\n let cursor = index + 1;\n while (cursor < source.length) {\n const char = source[cursor]!;\n if (char === \"\\\\\") {\n cursor += 2;\n continue;\n }\n if (char === quote) {\n return cursor + 1;\n }\n cursor += 1;\n }\n return source.length;\n}\n","import { VITE_LINT_BLOCK, VITE_LINT_IMPORT, VITE_PLUGIN_IMPORT } from \"./templates.js\";\nimport { countConfigCalls, findTopLevelKey, readTopLevelArray } from \"./top-level.js\";\n\n/**\n * Conservative source edits for user-owned `vite.config.*` and `nuxt.config.*`.\n *\n * Every function here returns `null` rather than guessing. A wrong edit to a\n * build config breaks the project; a `null` costs the user one paste of a\n * snippet `init` prints for them.\n */\n\nconst VITE_CALLEE = \"defineConfig\";\nconst NUXT_CALLEE = \"defineNuxtConfig\";\n\n/**\n * `defineConfig({` plus the newline that usually follows it.\n *\n * The trailing newline is consumed and re-emitted by the injectors so an\n * inserted key does not leave a stray blank line behind in the user's file.\n */\nconst VITE_OPENING = /\\bdefineConfig\\s*\\(\\s*\\{[^\\S\\r\\n]*(?:\\r?\\n)?/u;\nconst NUXT_OPENING = /\\bdefineNuxtConfig\\s*\\(\\s*\\{[^\\S\\r\\n]*(?:\\r?\\n)?/u;\n\n/**\n * Whether a Vite config is a single plain `defineConfig({ ... })` call that a\n * new top-level key can be inserted into.\n *\n * Anything else -- several `defineConfig` calls, a config built from a variable,\n * or a config that already declares the key -- is left alone.\n */\nexport function canInjectViteKey(source: string, key: string): boolean {\n if (hasTopLevelKey(source, key)) {\n return false;\n }\n return countConfigCalls(source, VITE_CALLEE) === 1;\n}\n\n/** Whether the Vite config declares `key` at the top level of its `defineConfig` call. */\nexport function hasTopLevelKey(source: string, key: string): boolean {\n return findTopLevelKey(source, VITE_CALLEE, key) !== null;\n}\n\n/** Whether the Vite+ `lint` block can be injected into this source. */\nexport function canInjectViteLint(source: string): boolean {\n if (source.includes(\"oxlint-plugin-vize\")) {\n return false;\n }\n return canInjectViteKey(source, \"lint\");\n}\n\n/**\n * Inserts the `lint` block, and its import, into a Vite config.\n *\n * Returns `null` when the source does not have the shape `canInjectViteLint`\n * accepts, so callers cannot inject blindly.\n */\nexport function injectViteLint(source: string): string | null {\n if (!canInjectViteLint(source)) {\n return null;\n }\n const withImport = insertImport(source, VITE_LINT_IMPORT);\n if (withImport === null) {\n return null;\n }\n return withImport.replace(VITE_OPENING, () => `defineConfig({\\n${VITE_LINT_BLOCK}`);\n}\n\n/**\n * Adds `vize()` to a Vite config's top-level `plugins` array, importing the\n * plugin.\n *\n * The array is located by depth-aware scan rather than by regex: a Vite+ config\n * can carry a second `plugins` key inside its `lint` block, and appending Vize's\n * Vite plugin to Oxlint's plugin list would corrupt both.\n */\nexport function injectVitePlugin(source: string): string | null {\n if (source.includes(\"@vizejs/vite-plugin\")) {\n return null;\n }\n const withImport = insertImport(source, VITE_PLUGIN_IMPORT);\n if (withImport === null) {\n return null;\n }\n const plugins = readTopLevelArray(withImport, VITE_CALLEE, \"plugins\");\n if (plugins !== null) {\n return insertArrayEntry(withImport, plugins.contentStart, \"vize()\", plugins.empty);\n }\n if (findTopLevelKey(withImport, VITE_CALLEE, \"plugins\") !== null) {\n // `plugins` exists but is not an array literal; inserting would change what\n // the config evaluates to.\n return null;\n }\n if (!canInjectViteKey(withImport, \"plugins\")) {\n return null;\n }\n return withImport.replace(VITE_OPENING, () => `defineConfig({\\n plugins: [vize()],\\n`);\n}\n\n/**\n * Adds `\"@vizejs/nuxt\"` to a Nuxt config's top-level `modules` array.\n *\n * Nuxt owns its own Vite instance, so the module is the supported integration\n * point; adding `@vizejs/vite-plugin` to a Nuxt-managed Vite config would fight\n * it.\n */\nexport function injectNuxtModule(source: string): string | null {\n if (source.includes(\"@vizejs/nuxt\")) {\n return null;\n }\n if (countConfigCalls(source, NUXT_CALLEE) !== 1) {\n return null;\n }\n const modules = readTopLevelArray(source, NUXT_CALLEE, \"modules\");\n if (modules !== null) {\n return insertArrayEntry(source, modules.contentStart, '\"@vizejs/nuxt\"', modules.empty);\n }\n if (findTopLevelKey(source, NUXT_CALLEE, \"modules\") !== null) {\n return null;\n }\n return source.replace(NUXT_OPENING, () => `defineNuxtConfig({\\n modules: [\"@vizejs/nuxt\"],\\n`);\n}\n\n/**\n * Inserts `entry` as the first element of an array literal.\n *\n * Prepending keeps the user's existing entries in their original order and\n * leaves their formatting alone.\n */\nfunction insertArrayEntry(\n source: string,\n contentStart: number,\n entry: string,\n empty: boolean,\n): string {\n const suffix = empty ? \"\" : \", \";\n const tail = empty ? source.slice(contentStart).replace(/^\\s*/u, \"\") : source.slice(contentStart);\n return `${source.slice(0, contentStart)}${entry}${suffix}${tail}`;\n}\n\n/**\n * Inserts an import after the last existing top-level import.\n *\n * A config with no imports at all returns `null`: the safe insertion point is\n * not obvious, and the file is unusual enough to be worth a human look.\n */\nfunction insertImport(source: string, importLine: string): string | null {\n if (source.includes(importLine.trimEnd())) {\n return source;\n }\n const imports = [\n ...source.matchAll(\n /^import[^\\r\\n]*(?:from\\s+[\"'][^\"']+[\"']|[\"'][^\"']+[\"'])\\s*;?[^\\S\\r\\n]*(?:\\r?\\n|$)/gmu,\n ),\n ];\n const lastImport = imports.at(-1);\n if (lastImport === undefined || lastImport.index === undefined) {\n return null;\n }\n const end = lastImport.index + lastImport[0].length;\n return source.slice(0, end) + importLine + source.slice(end);\n}\n","import type { ProjectDetection } from \"./detect.js\";\nimport { DISCOVERED_OXLINT_CONFIG_FILES } from \"../setup/config.js\";\nimport { canInjectViteLint, hasTopLevelKey } from \"./edit-config.js\";\nimport { VITE_LINT_MERGE_SNIPPET, VITE_LINT_SNIPPET } from \"./templates.js\";\n\nexport { DISCOVERED_OXLINT_CONFIG_FILES } from \"../setup/config.js\";\n\n/**\n * Oxlint config filenames the `oxlint` binary actually auto-discovers.\n *\n * Verified against oxlint 1.64: `.oxlintrc.json`, `.oxlintrc.jsonc` and\n * `oxlint.config.ts` are read; `oxlint.config.mts`, `.js`, `.mjs`, `.cjs` and\n * `.cts` produce a run byte-identical to having no config at all.\n */\n/** Filename `init` writes when the `oxlint` binary is the lint entry point. */\nexport const INIT_OXLINT_CONFIG_FILE = \"oxlint.config.ts\";\n\n/**\n * Where a project's Oxlint configuration has to live to be read.\n *\n * `vp lint` and `vp check` read the `lint` block of `vite.config.ts` and never\n * read `.oxlintrc.json`; the `oxlint` and `oxlint-vize` binaries read\n * `.oxlintrc.json` and never read `vite.config.ts`. Writing the wrong one leaves\n * a project that looks configured, reports zero `vize/*` diagnostics and exits\n * `0` -- the defect #3389 recorded and #3407 fixed. Every branch below therefore\n * follows the command the project will actually run, not the file that is\n * easiest to write.\n */\nexport type LintTargetKind =\n /** Vite+ project: the `lint` block in the Vite config is the only readable place. */\n | \"vite-plus\"\n /** No Vite+: the `oxlint` binary reads its own config file. */\n | \"oxlint\"\n /** Both entry points are in use; both files get written from one settings object. */\n | \"both\"\n /** Vite+ project whose Vite config cannot be edited safely. Nothing is written. */\n | \"manual\";\n\nexport interface LintTarget {\n readonly kind: LintTargetKind;\n /** Vite config to receive the `lint` block, when one can be edited. */\n readonly viteConfig: string | null;\n /** Oxlint config file to write, when the `oxlint` binary is an entry point. */\n readonly oxlintConfig: string | null;\n /** Existing Oxlint config left untouched, if any. */\n readonly preservedOxlintConfig: string | null;\n /** Why this target was chosen. Always shown to the user. */\n readonly reason: string;\n /**\n * Set when the project needs a Vite+ `lint` block that `init` will not write.\n * The caller must print the snippet and must not claim lint is configured.\n */\n readonly blockedReason: string | null;\n /** Snippet to paste when `blockedReason` is set. */\n readonly blockedSnippet: string | null;\n}\n\nexport interface LintTargetInput {\n readonly detection: ProjectDetection;\n /** Source of the single Vite config, or `null` when there is not exactly one. */\n readonly viteSource: string | null;\n}\n\n/**\n * Chooses which Oxlint configuration file(s) the project needs.\n *\n * The `oxlint` binary is treated as an entry point whenever the project already\n * carries a discovered Oxlint config or runs `oxlint` from a script. A Vite+\n * project that also does either gets both files, generated from the same preset\n * and help level, because keeping one of them silently stale is the same class\n * of bug as writing the wrong one.\n */\nexport function resolveLintTarget(input: LintTargetInput): LintTarget {\n const { detection } = input;\n const existing = discoveredOxlintConfig(detection);\n const runsOxlintBinary = existing !== null || hasOxlintScript(detection);\n\n if (!detection.usesVitePlus) {\n return {\n kind: \"oxlint\",\n viteConfig: null,\n oxlintConfig: existing === null ? INIT_OXLINT_CONFIG_FILE : null,\n preservedOxlintConfig: existing,\n reason:\n \"no Vite+ detected, so `oxlint` is the lint entry point and reads \" +\n `${existing ?? INIT_OXLINT_CONFIG_FILE}`,\n blockedReason: null,\n blockedSnippet: null,\n };\n }\n\n const viteConfig = detection.viteConfigs.length === 1 ? detection.viteConfigs[0]! : null;\n const injectable = input.viteSource !== null && canInjectViteLint(input.viteSource);\n if (!detection.hasVitePlusLintBlock && !injectable) {\n const blocked = describeBlocked(detection, input.viteSource);\n return {\n kind: \"manual\",\n viteConfig: null,\n oxlintConfig: null,\n preservedOxlintConfig: existing,\n reason: \"Vite+ detected, so `vp lint` reads the `lint` block in the Vite config\",\n blockedReason: blocked.reason,\n blockedSnippet: blocked.snippet,\n };\n }\n\n if (!runsOxlintBinary) {\n return {\n kind: \"vite-plus\",\n viteConfig,\n oxlintConfig: null,\n preservedOxlintConfig: null,\n reason:\n \"Vite+ detected, so `vp lint` reads the `lint` block in \" +\n `${viteConfig ?? \"the Vite config\"} and never reads .oxlintrc.json`,\n blockedReason: null,\n blockedSnippet: null,\n };\n }\n\n return {\n kind: \"both\",\n viteConfig,\n oxlintConfig: existing === null ? INIT_OXLINT_CONFIG_FILE : null,\n preservedOxlintConfig: existing,\n reason:\n \"Vite+ and the `oxlint` binary are both in use, so the `lint` block in \" +\n `${viteConfig ?? \"the Vite config\"} and ${existing ?? INIT_OXLINT_CONFIG_FILE} ` +\n \"are written from the same preset\",\n blockedReason: null,\n blockedSnippet: null,\n };\n}\n\n/**\n * The existing Oxlint config, restricted to names Oxlint actually reads.\n *\n * A project holding only `oxlint.config.mjs` is deliberately treated as having\n * no Oxlint config, because that is how Oxlint treats it.\n */\nexport function discoveredOxlintConfig(detection: ProjectDetection): string | null {\n const existing = detection.oxlintConfig;\n if (existing === null) {\n return null;\n }\n return (DISCOVERED_OXLINT_CONFIG_FILES as readonly string[]).includes(existing) ? existing : null;\n}\n\n/** An Oxlint config file that is present but which Oxlint will never read. */\nexport function unreadOxlintConfig(detection: ProjectDetection): string | null {\n const existing = detection.oxlintConfig;\n if (existing === null || discoveredOxlintConfig(detection) !== null) {\n return null;\n }\n return existing;\n}\n\nfunction hasOxlintScript(detection: ProjectDetection): boolean {\n return Object.values(detection.scripts).some((command) =>\n /(?:^|[\\s&|;])oxlint(?:-vize)?(?:\\s|$)/u.test(command),\n );\n}\n\n/**\n * Why the `lint` block will not be written.\n *\n * The message is the whole value of a blocked result, so it names the specific\n * obstacle instead of a generic \"could not edit\". An existing `lint` block in\n * particular is a merge the user has to make, not a failure of the file.\n */\nfunction describeBlocked(\n detection: ProjectDetection,\n viteSource: string | null,\n): { readonly reason: string; readonly snippet: string } {\n if (detection.viteConfigs.length === 0) {\n return { reason: \"no vite.config file to hold the `lint` block\", snippet: VITE_LINT_SNIPPET };\n }\n if (detection.viteConfigs.length > 1) {\n return {\n reason: `several Vite configs (${detection.viteConfigs.join(\", \")}), so the target is ambiguous`,\n snippet: VITE_LINT_SNIPPET,\n };\n }\n const filename = detection.viteConfigs[0]!;\n if (viteSource !== null && hasTopLevelKey(viteSource, \"lint\")) {\n return {\n reason:\n `${filename} already has a \\`lint\\` block and merging into it would risk dropping ` +\n \"settings, so spread createVizeLintConfig() into it by hand\",\n snippet: VITE_LINT_MERGE_SNIPPET,\n };\n }\n return {\n reason: `${filename} is not a single plain defineConfig({ ... }) call`,\n snippet: VITE_LINT_SNIPPET,\n };\n}\n","import type { ProjectDetection } from \"./detect.js\";\nimport { discoveredOxlintConfig, unreadOxlintConfig } from \"./lint-target.js\";\n\nexport const FEATURE_IDS = [\"lint\", \"bundler\", \"fmt\", \"typecheck\", \"editor\"] as const;\n\nexport type FeatureId = (typeof FEATURE_IDS)[number];\n\nexport type FeatureSelection = Readonly<Record<FeatureId, boolean>>;\n\nexport interface FeatureOffer {\n readonly id: FeatureId;\n /** Label shown in the prompt and in the plan. Reflects what detection found. */\n readonly label: string;\n /** False when the project cannot support the feature at all. */\n readonly available: boolean;\n /** True when the project already has this feature wired up. */\n readonly configured: boolean;\n /** Why the feature is unavailable or already configured. Empty when neither. */\n readonly note: string;\n readonly defaultSelected: boolean;\n}\n\n/**\n * Turns detection into the five offers `init` presents.\n *\n * Already-configured features stay selected by default so a re-run is a no-op\n * the user can confirm rather than a set of boxes they have to re-tick.\n */\nexport function offerFeatures(detection: ProjectDetection): readonly FeatureOffer[] {\n return [\n lintOffer(detection),\n bundlerOffer(detection),\n fmtOffer(detection),\n typecheckOffer(detection),\n editorOffer(detection),\n ];\n}\n\n/** Selection implied by detection alone, used by `--yes` and as the prompt default. */\nexport function defaultSelection(offers: readonly FeatureOffer[]): FeatureSelection {\n const selection: Record<FeatureId, boolean> = {\n lint: false,\n bundler: false,\n fmt: false,\n typecheck: false,\n editor: false,\n };\n for (const offer of offers) {\n selection[offer.id] = offer.defaultSelected;\n }\n return selection;\n}\n\nfunction lintOffer(detection: ProjectDetection): FeatureOffer {\n const configured = detection.usesVitePlus\n ? detection.hasVitePlusLintBlock\n : discoveredOxlintConfig(detection) !== null;\n const unread = unreadOxlintConfig(detection);\n const label = detection.usesVitePlus\n ? \"oxlint plugin (vp lint reads the `lint` block in the Vite config)\"\n : \"oxlint plugin (the oxlint binary reads oxlint.config.ts)\";\n return {\n id: \"lint\",\n label,\n available: true,\n configured,\n note: configured\n ? \"already configured\"\n : unread === null\n ? \"\"\n : `${unread} exists but oxlint never reads it (#3474)`,\n defaultSelected: true,\n };\n}\n\nfunction bundlerOffer(detection: ProjectDetection): FeatureOffer {\n if (detection.framework === \"nuxt\") {\n return {\n id: \"bundler\",\n label: \"nuxt module (@vizejs/nuxt)\",\n available: detection.nuxtConfig !== null,\n configured: detection.hasVizeNuxtModule,\n note: detection.hasVizeNuxtModule\n ? \"already configured\"\n : detection.nuxtConfig === null\n ? \"no nuxt.config file to add @vizejs/nuxt to\"\n : \"\",\n defaultSelected: detection.nuxtConfig !== null,\n };\n }\n if (detection.framework === \"vite\") {\n const single = detection.viteConfigs.length === 1;\n return {\n id: \"bundler\",\n label: \"vite plugin (@vizejs/vite-plugin)\",\n available: single,\n configured: detection.hasVizeVitePlugin,\n note: detection.hasVizeVitePlugin\n ? \"already configured\"\n : single\n ? \"\"\n : `several Vite configs (${detection.viteConfigs.join(\", \")})`,\n defaultSelected: single,\n };\n }\n return {\n id: \"bundler\",\n label: \"vite plugin or nuxt module\",\n available: false,\n configured: false,\n note: \"no vite.config or nuxt.config found; the other features work without one\",\n defaultSelected: false,\n };\n}\n\nfunction fmtOffer(detection: ProjectDetection): FeatureOffer {\n const configured = detection.vizeConfig !== null && \"vize:fmt\" in detection.scripts;\n return {\n id: \"fmt\",\n label: \"fmt (vize fmt)\",\n available: true,\n configured,\n note: configured ? \"already configured\" : \"\",\n defaultSelected: true,\n };\n}\n\nfunction typecheckOffer(detection: ProjectDetection): FeatureOffer {\n const configured =\n detection.tsconfig !== null &&\n detection.vizeConfig !== null &&\n \"vize:check\" in detection.scripts;\n return {\n id: \"typecheck\",\n label: \"typecheck (vize check)\",\n available: true,\n configured,\n note: configured\n ? \"already configured\"\n : detection.tsconfig === null\n ? \"creates tsconfig.json\"\n : \"\",\n defaultSelected: true,\n };\n}\n\nfunction editorOffer(detection: ProjectDetection): FeatureOffer {\n return {\n id: \"editor\",\n label: \"editor extension (.vscode/extensions.json recommendation)\",\n available: true,\n configured: detection.vscodeRecommendsVize,\n note: detection.vscodeRecommendsVize ? \"already recommended\" : \"\",\n defaultSelected: true,\n };\n}\n","import { FEATURE_IDS, type FeatureId } from \"./select.js\";\n\nexport type BundlerOverride = \"vite\" | \"nuxt\" | null;\n\nexport interface InitArgs {\n readonly root: string | null;\n /** Explicit per-feature choices. Absent entries fall back to detection. */\n readonly overrides: Readonly<Partial<Record<FeatureId, boolean>>>;\n readonly bundlerOverride: BundlerOverride;\n readonly yes: boolean;\n readonly dryRun: boolean;\n readonly install: boolean;\n readonly packageManager: string | null;\n readonly help: boolean;\n}\n\nconst PACKAGE_MANAGERS = [\"pnpm\", \"npm\", \"yarn\", \"bun\", \"vp\"] as const;\n\n/**\n * Parses `vize init` arguments.\n *\n * `--yes` is the only switch that disables prompting. Per-feature flags without\n * it still prompt, using the flags as the pre-ticked defaults, which keeps a\n * half-typed command from silently writing files.\n */\nexport function parseInitArgs(args: readonly string[]): InitArgs {\n const overrides: Partial<Record<FeatureId, boolean>> = {};\n let root: string | null = null;\n let bundlerOverride: BundlerOverride = null;\n let yes = false;\n let dryRun = false;\n let install = true;\n let packageManager: string | null = null;\n let help = false;\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index]!;\n if (arg === \"-h\" || arg === \"--help\") {\n help = true;\n continue;\n }\n if (arg === \"-y\" || arg === \"--yes\") {\n yes = true;\n continue;\n }\n if (arg === \"--dry-run\") {\n dryRun = true;\n continue;\n }\n if (arg === \"--no-install\") {\n install = false;\n continue;\n }\n if (arg === \"--package-manager\") {\n packageManager = requirePackageManager(args[index + 1]);\n index += 1;\n continue;\n }\n if (arg.startsWith(\"--package-manager=\")) {\n packageManager = requirePackageManager(arg.slice(\"--package-manager=\".length));\n continue;\n }\n if (arg === \"--vite\" || arg === \"--nuxt\") {\n bundlerOverride = arg === \"--vite\" ? \"vite\" : \"nuxt\";\n overrides.bundler = true;\n continue;\n }\n const feature = matchFeatureFlag(arg);\n if (feature !== null) {\n overrides[feature.id] = feature.enabled;\n continue;\n }\n if (arg.startsWith(\"-\")) {\n throw new Error(`Unknown init option: ${arg}`);\n }\n if (root !== null) {\n throw new Error(`Unexpected init argument: ${arg}`);\n }\n root = arg;\n }\n\n return { root, overrides, bundlerOverride, yes, dryRun, install, packageManager, help };\n}\n\nfunction matchFeatureFlag(arg: string): { id: FeatureId; enabled: boolean } | null {\n for (const id of FEATURE_IDS) {\n if (arg === `--${id}`) {\n return { id, enabled: true };\n }\n if (arg === `--no-${id}`) {\n return { id, enabled: false };\n }\n }\n return null;\n}\n\nfunction requirePackageManager(value: string | undefined): string {\n if (value === undefined || value.startsWith(\"-\")) {\n throw new Error(\"--package-manager requires a value\");\n }\n if (!(PACKAGE_MANAGERS as readonly string[]).includes(value)) {\n throw new Error(\n `Unknown package manager: ${value}. Expected one of ${PACKAGE_MANAGERS.join(\", \")}`,\n );\n }\n return value;\n}\n\nexport function initHelp(): string {\n return `Select, install, and configure Vize in an existing project\n\nUsage: vize init [ROOT] [OPTIONS]\n\nArguments:\n [ROOT] Project root containing package.json (default: current directory)\n\nOptions:\n -y, --yes Accept the detected selection without prompting\n --lint / --no-lint oxlint plugin\n --vite vite plugin (forces the Vite target)\n --nuxt nuxt module (forces the Nuxt target)\n --bundler/--no-bundler vite plugin or nuxt module, auto-detected\n --fmt / --no-fmt vize fmt\n --typecheck vize check (creates tsconfig.json when missing)\n --no-typecheck\n --editor / --no-editor .vscode/extensions.json recommendation\n --dry-run Print the plan without writing anything\n --no-install Write configuration without installing dependencies\n --package-manager <PM> One of ${PACKAGE_MANAGERS.join(\", \")} (default: detected)\n -h, --help Print help\n\nWithout --yes, init prompts. A non-TTY stdin is detected and refused rather than\nhung, so CI must pass --yes together with the per-feature flags it wants.\n`;\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport {\n dependencyNames,\n OXLINT_CONFIG_FILES,\n parsePackageJson,\n readRequiredFile,\n VIZE_CONFIG_FILES,\n} from \"../setup/config.js\";\n\nexport const NUXT_CONFIG_FILES = [\n \"nuxt.config.ts\",\n \"nuxt.config.mts\",\n \"nuxt.config.js\",\n \"nuxt.config.mjs\",\n] as const;\n\nexport const VITE_CONFIG_FILES = [\n \"vite.config.ts\",\n \"vite.config.mts\",\n \"vite.config.js\",\n \"vite.config.mjs\",\n] as const;\n\nexport type PackageManager = \"pnpm\" | \"npm\" | \"yarn\" | \"bun\";\n\n/**\n * Bundler integration `init` can wire up.\n *\n * Nuxt outranks Vite because a Nuxt project owns its own Vite instance: adding\n * `@vizejs/vite-plugin` to a Nuxt-managed Vite config would fight the module.\n */\nexport type Framework = \"nuxt\" | \"vite\" | \"none\";\n\nexport interface ProjectDetection {\n readonly root: string;\n readonly packageManager: PackageManager | null;\n readonly framework: Framework;\n readonly nuxtConfig: string | null;\n readonly viteConfigs: readonly string[];\n readonly usesVitePlus: boolean;\n readonly typescript: boolean;\n readonly tsconfig: string | null;\n readonly vizeConfig: string | null;\n readonly oxlintConfig: string | null;\n readonly hasVitePlusLintBlock: boolean;\n readonly hasVizeVitePlugin: boolean;\n readonly hasVizeNuxtModule: boolean;\n readonly dependencies: ReadonlySet<string>;\n readonly scripts: Readonly<Record<string, string>>;\n readonly vscodeRecommendsVize: boolean;\n}\n\n/**\n * Package-manager detection.\n *\n * Deliberately mirrors `detect_package_manager` in\n * `crates/vize_canon/src/batch/error.rs`, including the lockfile priority order\n * and the `packageManager` prefix fallback. The Rust side suggests an install\n * command in its corsa-not-found message; if the two ever disagreed, a user\n * would be told to run `pnpm add` by one half of the toolchain and `npm install`\n * by the other.\n */\nexport function detectPackageManager(root: string): PackageManager | null {\n const exists = (name: string): boolean => fs.existsSync(path.join(root, name));\n if (exists(\"pnpm-lock.yaml\")) {\n return \"pnpm\";\n }\n if (exists(\"bun.lockb\") || exists(\"bun.lock\")) {\n return \"bun\";\n }\n if (exists(\"yarn.lock\")) {\n return \"yarn\";\n }\n if (exists(\"package-lock.json\")) {\n return \"npm\";\n }\n return detectPackageManagerField(root);\n}\n\nfunction detectPackageManagerField(root: string): PackageManager | null {\n let source: string;\n try {\n source = fs.readFileSync(path.join(root, \"package.json\"), \"utf8\");\n } catch {\n return null;\n }\n let field: unknown;\n try {\n field = (JSON.parse(source) as { packageManager?: unknown }).packageManager;\n } catch {\n return null;\n }\n if (typeof field !== \"string\") {\n return null;\n }\n for (const candidate of [\"pnpm\", \"yarn\", \"bun\", \"npm\"] as const) {\n if (field.startsWith(candidate)) {\n return candidate;\n }\n }\n return null;\n}\n\n/**\n * Applies an explicit `--vite` / `--nuxt` choice over what detection concluded.\n *\n * Overriding the framework rather than branching later keeps one code path: the\n * planner, the prompt and the printed detection summary all see the same answer,\n * so the summary cannot claim Vite while the plan configures Nuxt.\n */\nexport function withFramework(\n detection: ProjectDetection,\n framework: Framework | null,\n): ProjectDetection {\n return framework === null || framework === detection.framework\n ? detection\n : { ...detection, framework };\n}\n\nexport function detectProject(root: string): ProjectDetection {\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 dependencies = dependencyNames(packageJson);\n const scripts = readScripts(packageJson);\n\n const nuxtConfig = findExisting(root, NUXT_CONFIG_FILES);\n const viteConfigs = VITE_CONFIG_FILES.filter((candidate) =>\n fs.existsSync(path.join(root, candidate)),\n );\n const viteSource = viteConfigs.length === 1 ? readFile(root, viteConfigs[0]!) : null;\n const nuxtSource = nuxtConfig === null ? null : readFile(root, nuxtConfig);\n\n return {\n root,\n packageManager: detectPackageManager(root),\n framework: detectFramework(nuxtConfig, viteConfigs, dependencies),\n nuxtConfig,\n viteConfigs,\n usesVitePlus: detectVitePlus(dependencies, viteSource, scripts),\n typescript: dependencies.has(\"typescript\") || fs.existsSync(path.join(root, \"tsconfig.json\")),\n tsconfig: fs.existsSync(path.join(root, \"tsconfig.json\")) ? \"tsconfig.json\" : null,\n vizeConfig: findExisting(root, VIZE_CONFIG_FILES),\n oxlintConfig: findExisting(root, OXLINT_CONFIG_FILES),\n hasVitePlusLintBlock: viteSource !== null && viteSource.includes(\"oxlint-plugin-vize\"),\n hasVizeVitePlugin: viteSource !== null && viteSource.includes(\"@vizejs/vite-plugin\"),\n hasVizeNuxtModule: nuxtSource !== null && nuxtSource.includes(\"@vizejs/nuxt\"),\n dependencies,\n scripts,\n vscodeRecommendsVize: detectVscodeRecommendation(root),\n };\n}\n\nfunction detectFramework(\n nuxtConfig: string | null,\n viteConfigs: readonly string[],\n dependencies: ReadonlySet<string>,\n): Framework {\n if (nuxtConfig !== null || dependencies.has(\"nuxt\")) {\n return \"nuxt\";\n }\n return viteConfigs.length > 0 ? \"vite\" : \"none\";\n}\n\n/**\n * Whether the project's lint command is `vp lint` rather than the `oxlint` binary.\n *\n * This single boolean decides which file `init` must write the Oxlint\n * configuration into, so it is deliberately generous: a project is treated as a\n * Vite+ project if the dependency is declared, if its Vite config imports from\n * `vite-plus`, or if any script invokes `vp`. Guessing \"plain Oxlint\" for a\n * Vite+ project is the failure that #3389 documented — `vp lint` would ignore\n * `.oxlintrc.json` and report zero Vize diagnostics while exiting 0.\n */\nfunction detectVitePlus(\n dependencies: ReadonlySet<string>,\n viteSource: string | null,\n scripts: Readonly<Record<string, string>>,\n): boolean {\n if (dependencies.has(\"vite-plus\")) {\n return true;\n }\n if (viteSource !== null && /from\\s+[\"']vite-plus[\"']/u.test(viteSource)) {\n return true;\n }\n return Object.values(scripts).some((command) => /(?:^|[\\s&|;])vpx?(?:\\s|$)/u.test(command));\n}\n\nfunction detectVscodeRecommendation(root: string): boolean {\n let source: string;\n try {\n source = fs.readFileSync(path.join(root, \".vscode\", \"extensions.json\"), \"utf8\");\n } catch {\n return false;\n }\n return source.includes(\"ubugeeei.vize\");\n}\n\nfunction readScripts(packageJson: Record<string, unknown>): Record<string, string> {\n const scripts = packageJson.scripts;\n if (typeof scripts !== \"object\" || scripts === null || Array.isArray(scripts)) {\n return {};\n }\n const entries: Record<string, string> = {};\n for (const [name, command] of Object.entries(scripts)) {\n if (typeof command === \"string\") {\n entries[name] = command;\n }\n }\n return entries;\n}\n\nfunction findExisting(root: string, candidates: readonly string[]): string | null {\n return candidates.find((candidate) => fs.existsSync(path.join(root, candidate))) ?? null;\n}\n\nfunction readFile(root: string, relative: string): string {\n return fs.readFileSync(path.join(root, relative), \"utf8\");\n}\n","import type { PlannedFile } from \"../setup/config.js\";\nimport type { ProjectDetection } from \"./detect.js\";\nimport type { LintTarget } from \"./lint-target.js\";\nimport type { FeatureId, FeatureSelection } from \"./select.js\";\n\n/**\n * Shared plan vocabulary.\n *\n * Lives apart from `plan.ts` so the per-feature planners can name these types\n * without importing the orchestrator that calls them.\n */\n\nexport type FeatureOutcome =\n /** The feature was selected and something was written for it. */\n | \"configured\"\n /** The feature was selected and is already wired up. A re-run lands here. */\n | \"unchanged\"\n /** The feature was not selected, or the project cannot support it. */\n | \"skipped\"\n /** Selected, but a user-owned file has to be edited by hand. Nothing written. */\n | \"blocked\";\n\nexport interface FeatureResult {\n readonly id: FeatureId;\n readonly outcome: FeatureOutcome;\n readonly detail: string;\n /** Snippet the user must paste when `outcome` is `blocked`. */\n readonly snippet: string | null;\n}\n\nexport interface InitCommand {\n readonly command: string;\n readonly args: readonly string[];\n readonly cwd: string;\n}\n\nexport interface InitPlan {\n readonly root: string;\n readonly detection: ProjectDetection;\n readonly lintTarget: LintTarget;\n readonly features: readonly FeatureResult[];\n readonly files: readonly PlannedFile[];\n readonly createdFiles: readonly string[];\n readonly updatedFiles: readonly string[];\n readonly addedScripts: readonly string[];\n readonly commands: readonly InitCommand[];\n}\n\nexport interface PlanInitOptions {\n readonly detection: ProjectDetection;\n readonly selection: FeatureSelection;\n readonly install: boolean;\n readonly packageManager?: string;\n}\n\n/** Mutable accumulators the per-feature planners append to. */\nexport interface PlanDraft {\n readonly files: PlannedFile[];\n readonly createdFiles: string[];\n readonly updatedFiles: string[];\n readonly features: FeatureResult[];\n readonly dependencies: Set<string>;\n}\n\nexport function createPlanDraft(): PlanDraft {\n return {\n files: [],\n createdFiles: [],\n updatedFiles: [],\n features: [],\n dependencies: new Set<string>(),\n };\n}\n\nexport function skipped(id: FeatureId, detail = \"not selected\"): FeatureResult {\n return { id, outcome: \"skipped\", detail, snippet: null };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type { ProjectDetection } from \"./detect.js\";\nimport { injectNuxtModule, injectVitePlugin } from \"./edit-config.js\";\nimport { skipped, type PlanDraft } from \"./plan-types.js\";\n\n/**\n * Plans the bundler integration: the Vite plugin, or the Nuxt module.\n *\n * Nuxt outranks Vite because a Nuxt project owns its own Vite instance --\n * adding `@vizejs/vite-plugin` to a Nuxt-managed Vite config would fight the\n * module rather than complement it.\n *\n * @returns the possibly-edited Vite config source, or the input unchanged.\n */\nexport function planBundler(\n detection: ProjectDetection,\n viteDraft: string | null,\n draft: PlanDraft,\n): string | null {\n if (detection.framework === \"nuxt\") {\n planNuxtModule(detection, draft);\n return viteDraft;\n }\n if (detection.framework !== \"vite\" || detection.viteConfigs.length !== 1) {\n draft.features.push(skipped(\"bundler\", \"no single vite.config or nuxt.config to configure\"));\n return viteDraft;\n }\n draft.dependencies.add(\"@vizejs/vite-plugin\");\n const filename = detection.viteConfigs[0]!;\n if (detection.hasVizeVitePlugin) {\n draft.features.push({\n id: \"bundler\",\n outcome: \"unchanged\",\n detail: `${filename} already uses @vizejs/vite-plugin`,\n snippet: null,\n });\n return viteDraft;\n }\n const injected = viteDraft === null ? null : injectVitePlugin(viteDraft);\n if (injected === null) {\n draft.features.push({\n id: \"bundler\",\n outcome: \"blocked\",\n detail: `${filename} has no plugins array this tool can extend safely`,\n snippet: \"plugins: [vize()]\",\n });\n return viteDraft;\n }\n draft.features.push({\n id: \"bundler\",\n outcome: \"configured\",\n detail: `adds vize() to ${filename}`,\n snippet: null,\n });\n return injected;\n}\n\nfunction planNuxtModule(detection: ProjectDetection, draft: PlanDraft): void {\n draft.dependencies.add(\"@vizejs/nuxt\");\n if (detection.nuxtConfig === null) {\n draft.features.push(skipped(\"bundler\", \"no nuxt.config file to add @vizejs/nuxt to\"));\n return;\n }\n if (detection.hasVizeNuxtModule) {\n draft.features.push({\n id: \"bundler\",\n outcome: \"unchanged\",\n detail: `${detection.nuxtConfig} already lists @vizejs/nuxt`,\n snippet: null,\n });\n return;\n }\n const source = fs.readFileSync(path.join(detection.root, detection.nuxtConfig), \"utf8\");\n const injected = injectNuxtModule(source);\n if (injected === null) {\n draft.features.push({\n id: \"bundler\",\n outcome: \"blocked\",\n detail: `${detection.nuxtConfig} is not a single plain defineNuxtConfig({ ... }) call`,\n snippet: 'modules: [\"@vizejs/nuxt\"]',\n });\n return;\n }\n draft.files.push({\n filename: path.join(detection.root, detection.nuxtConfig),\n source: injected,\n });\n draft.updatedFiles.push(detection.nuxtConfig);\n draft.features.push({\n id: \"bundler\",\n outcome: \"configured\",\n detail: `adds @vizejs/nuxt to ${detection.nuxtConfig}`,\n snippet: null,\n });\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { detectJsonIndent, type PlannedFile } from \"../setup/config.js\";\nimport type { ProjectDetection } from \"./detect.js\";\nimport type { FeatureResult } from \"./plan-types.js\";\nimport { renderVscodeExtensions, VSCODE_EXTENSION_ID } from \"./templates.js\";\n\nconst EXTENSIONS_FILE = \".vscode/extensions.json\";\n\n/**\n * Plans the editor recommendation.\n *\n * `.vscode/extensions.json` is preferred over `code --install-extension` because\n * it is checked in, applies to everyone on the project, and changes nothing on\n * the machine running `init`. An existing file is merged, never replaced: it\n * usually carries the team's other recommendations.\n */\nexport function planEditorFile(\n detection: ProjectDetection,\n files: PlannedFile[],\n createdFiles: string[],\n updatedFiles: string[],\n): FeatureResult {\n const filename = path.join(detection.root, \".vscode\", \"extensions.json\");\n let source: string;\n try {\n source = fs.readFileSync(filename, \"utf8\");\n } catch {\n files.push({ filename, source: renderVscodeExtensions(2) });\n createdFiles.push(EXTENSIONS_FILE);\n return {\n id: \"editor\",\n outcome: \"configured\",\n detail: `writes ${EXTENSIONS_FILE} recommending ${VSCODE_EXTENSION_ID}`,\n snippet: null,\n };\n }\n\n const merged = mergeRecommendation(source);\n if (merged === null) {\n return {\n id: \"editor\",\n outcome: \"blocked\",\n detail: `${EXTENSIONS_FILE} is not a plain JSON object this tool can extend safely`,\n snippet: `\"recommendations\": [\"${VSCODE_EXTENSION_ID}\"]`,\n };\n }\n if (merged === source) {\n return {\n id: \"editor\",\n outcome: \"unchanged\",\n detail: `${EXTENSIONS_FILE} already recommends ${VSCODE_EXTENSION_ID}`,\n snippet: null,\n };\n }\n files.push({ filename, source: merged });\n updatedFiles.push(EXTENSIONS_FILE);\n return {\n id: \"editor\",\n outcome: \"configured\",\n detail: `adds ${VSCODE_EXTENSION_ID} to ${EXTENSIONS_FILE}`,\n snippet: null,\n };\n}\n\n/**\n * Adds the recommendation to an existing file, preserving its other keys and its\n * indentation. Returns the input unchanged when the id is already listed, and\n * `null` when the file is not a JSON object with an array of string\n * recommendations.\n */\nfunction mergeRecommendation(source: string): string | null {\n let parsed: unknown;\n try {\n parsed = JSON.parse(source);\n } catch {\n return null;\n }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n return null;\n }\n const document = parsed as Record<string, unknown>;\n const existing = document.recommendations;\n if (existing !== undefined && !isStringArray(existing)) {\n return null;\n }\n const recommendations = existing ?? [];\n if (recommendations.includes(VSCODE_EXTENSION_ID)) {\n return source;\n }\n document.recommendations = [...recommendations, VSCODE_EXTENSION_ID];\n return `${JSON.stringify(document, null, detectJsonIndent(source))}\\n`;\n}\n\nfunction isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every((entry) => typeof entry === \"string\");\n}\n","import path from \"node:path\";\n\nimport type { ProjectDetection } from \"./detect.js\";\nimport { injectViteLint } from \"./edit-config.js\";\nimport { INIT_OXLINT_CONFIG_FILE, type LintTarget } from \"./lint-target.js\";\nimport type { PlanDraft } from \"./plan-types.js\";\nimport { INIT_OXLINT_CONFIG } from \"./templates.js\";\n\n/**\n * Plans the Oxlint wiring into whichever file the project's lint command reads.\n *\n * The single rule this function exists to enforce: never write an Oxlint config\n * the project's own lint command ignores. `vp lint` and `vp check` read only the\n * `lint` block of the Vite config; `oxlint` and `oxlint-vize` read only their own\n * config file. Writing the wrong one produces a project that looks configured,\n * reports zero `vize/*` diagnostics and exits `0` -- #3389, fixed in #3407.\n *\n * When the required file cannot be edited safely this returns a `blocked`\n * result and writes nothing at all. Falling back to the *other* file would be\n * the bug: the user would see a success message and get silence from the linter.\n *\n * @returns the possibly-edited Vite config source, or the input unchanged.\n */\nexport function planLint(\n detection: ProjectDetection,\n lintTarget: LintTarget,\n viteDraft: string | null,\n draft: PlanDraft,\n): string | null {\n if (lintTarget.blockedReason !== null) {\n draft.features.push({\n id: \"lint\",\n outcome: \"blocked\",\n detail:\n `vp lint reads the \\`lint\\` block in the Vite config, but ${lintTarget.blockedReason}. ` +\n \"Nothing was written: an unconfigured project fails loudly, while an Oxlint config vp \" +\n \"lint never reads reports zero Vize diagnostics and exits 0\",\n snippet: lintTarget.blockedSnippet,\n });\n return viteDraft;\n }\n\n let source = viteDraft;\n const wrote: string[] = [];\n if (lintTarget.viteConfig !== null && !detection.hasVitePlusLintBlock && source !== null) {\n const injected = injectViteLint(source);\n if (injected !== null) {\n source = injected;\n wrote.push(lintTarget.viteConfig);\n }\n }\n if (lintTarget.oxlintConfig !== null) {\n draft.files.push({\n filename: path.join(detection.root, INIT_OXLINT_CONFIG_FILE),\n source: INIT_OXLINT_CONFIG,\n });\n draft.createdFiles.push(INIT_OXLINT_CONFIG_FILE);\n wrote.push(INIT_OXLINT_CONFIG_FILE);\n }\n draft.features.push({\n id: \"lint\",\n outcome: wrote.length > 0 ? \"configured\" : \"unchanged\",\n detail:\n wrote.length > 0 ? `${lintTarget.reason}; writes ${wrote.join(\" and \")}` : lintTarget.reason,\n snippet: null,\n });\n return source;\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { DEFAULT_SCRIPTS, detectJsonIndent, parsePackageJson } from \"../setup/config.js\";\nimport type { ProjectDetection } from \"./detect.js\";\nimport { skipped, type PlanDraft } from \"./plan-types.js\";\nimport type { FeatureId, FeatureSelection } from \"./select.js\";\nimport { renderTypecheckTsconfig, renderVizeConfig } from \"./templates.js\";\n\n/** Scripts each feature contributes, reusing the command strings `setup` ships. */\nconst FEATURE_SCRIPTS: Readonly<Record<FeatureId, readonly string[]>> = {\n lint: [\"vize:lint\"],\n bundler: [],\n fmt: [\"vize:fmt\", \"vize:fmt:fix\"],\n typecheck: [\"vize:check\"],\n editor: [],\n};\n\n/**\n * Plans `vize.config.ts` and the fmt/typecheck feature results.\n *\n * Only selected features contribute a block, so asking for the formatter alone\n * does not hand the project a type checker it never opted into. An existing Vize\n * config is never rewritten: merging into a user's config is exactly the kind of\n * guess that loses their settings.\n */\nexport function planVizeConfig(\n detection: ProjectDetection,\n selection: FeatureSelection,\n draft: PlanDraft,\n): void {\n if (selection.typecheck && detection.tsconfig === null) {\n draft.files.push({\n filename: path.join(detection.root, \"tsconfig.json\"),\n source: renderTypecheckTsconfig(detection.typescript),\n });\n draft.createdFiles.push(\"tsconfig.json\");\n }\n\n for (const id of [\"fmt\", \"typecheck\"] as const) {\n if (!selection[id]) {\n draft.features.push(skipped(id));\n continue;\n }\n const scaffoldsTsconfig = id === \"typecheck\" && detection.tsconfig === null;\n draft.features.push({\n id,\n outcome: scaffoldsTsconfig || detection.vizeConfig === null ? \"configured\" : \"unchanged\",\n detail: scaffoldsTsconfig\n ? detection.vizeConfig === null\n ? \"writes tsconfig.json and vize.config.ts\"\n : `writes tsconfig.json; ${detection.vizeConfig} already exists and was left unchanged`\n : detection.vizeConfig === null\n ? \"writes vize.config.ts\"\n : `${detection.vizeConfig} already exists and was left unchanged`,\n snippet: null,\n });\n }\n\n const needsConfig = selection.lint || selection.fmt || selection.typecheck;\n if (!needsConfig || detection.vizeConfig !== null) {\n return;\n }\n draft.files.push({\n filename: path.join(detection.root, \"vize.config.ts\"),\n source: renderVizeConfig({\n lint: selection.lint,\n fmt: selection.fmt,\n typecheck: selection.typecheck,\n vite: detection.framework === \"vite\",\n }),\n });\n draft.createdFiles.push(\"vize.config.ts\");\n}\n\n/**\n * Adds the scripts the selected features need.\n *\n * A script the project already defines is left alone, whatever its value: the\n * user's version of `vize:lint` outranks the default, and rewriting it would\n * make a second `init` run destructive.\n */\nexport function planScripts(\n detection: ProjectDetection,\n selection: FeatureSelection,\n draft: PlanDraft,\n): readonly string[] {\n const wanted: string[] = [];\n for (const id of [\"lint\", \"fmt\", \"typecheck\"] as const) {\n if (!selection[id]) {\n continue;\n }\n wanted.push(...FEATURE_SCRIPTS[id]);\n }\n const missing = wanted.filter((name) => !(name in detection.scripts));\n if (missing.length === 0) {\n return [];\n }\n const packagePath = path.join(detection.root, \"package.json\");\n const source = fs.readFileSync(packagePath, \"utf8\");\n const packageJson = parsePackageJson(packagePath, source);\n const scripts = { ...detection.scripts } as Record<string, string>;\n for (const name of missing) {\n scripts[name] = DEFAULT_SCRIPTS[name as keyof typeof DEFAULT_SCRIPTS];\n }\n packageJson.scripts = scripts;\n draft.files.push({\n filename: packagePath,\n source: `${JSON.stringify(packageJson, null, detectJsonIndent(source))}\\n`,\n });\n draft.updatedFiles.push(\"package.json\");\n return missing;\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport type { ProjectDetection } from \"./detect.js\";\nimport { resolveLintTarget } from \"./lint-target.js\";\nimport { planBundler } from \"./plan-bundler.js\";\nimport { planEditorFile } from \"./plan-editor.js\";\nimport { planLint } from \"./plan-lint.js\";\nimport { planScripts, planVizeConfig } from \"./plan-project.js\";\nimport {\n createPlanDraft,\n skipped,\n type FeatureResult,\n type InitCommand,\n type InitPlan,\n type PlanInitOptions,\n} from \"./plan-types.js\";\nimport type { FeatureId } from \"./select.js\";\n\nexport type {\n FeatureOutcome,\n FeatureResult,\n InitCommand,\n InitPlan,\n PlanInitOptions,\n} from \"./plan-types.js\";\n\n/** Dev dependencies each feature needs. */\nconst FEATURE_DEPENDENCIES: Readonly<Record<FeatureId, readonly string[]>> = {\n lint: [\"oxlint\", \"oxlint-plugin-vize\"],\n bundler: [],\n fmt: [\"vize\"],\n typecheck: [\"vize\"],\n editor: [],\n};\n\nconst INSTALL_ARGS: Readonly<Record<string, readonly string[]>> = {\n pnpm: [\"add\", \"-D\"],\n yarn: [\"add\", \"-D\"],\n bun: [\"add\", \"-D\"],\n npm: [\"install\", \"-D\"],\n vp: [\"add\", \"-D\"],\n};\n\nconst FEATURE_ORDER: readonly FeatureId[] = [\"lint\", \"bundler\", \"fmt\", \"typecheck\", \"editor\"];\n\n/**\n * Builds the full plan without touching the filesystem.\n *\n * Planning is separated from execution so `--dry-run`, the interactive\n * confirmation and the tests all inspect the same object the writer consumes;\n * a plan that is correct in `--dry-run` and wrong on disk is not possible.\n */\nexport function planInit(options: PlanInitOptions): InitPlan {\n const { detection, selection } = options;\n const draft = createPlanDraft();\n\n const viteSource = readSingleViteConfig(detection);\n const lintTarget = resolveLintTarget({ detection, viteSource });\n\n let viteDraft = viteSource;\n if (selection.lint) {\n viteDraft = planLint(detection, lintTarget, viteDraft, draft);\n addAll(draft.dependencies, FEATURE_DEPENDENCIES.lint);\n } else {\n draft.features.push(skipped(\"lint\"));\n }\n\n if (selection.bundler) {\n viteDraft = planBundler(detection, viteDraft, draft);\n } else {\n draft.features.push(skipped(\"bundler\"));\n }\n\n // One write for the Vite config, however many features touched it, so the\n // plugin edit and the lint edit cannot overwrite one another.\n if (viteSource !== null && viteDraft !== null && viteDraft !== viteSource) {\n const filename = detection.viteConfigs[0]!;\n draft.files.push({ filename: path.join(detection.root, filename), source: viteDraft });\n draft.updatedFiles.push(filename);\n }\n\n planVizeConfig(detection, selection, draft);\n for (const id of [\"fmt\", \"typecheck\"] as const) {\n if (selection[id]) {\n addAll(draft.dependencies, FEATURE_DEPENDENCIES[id]);\n }\n }\n\n draft.features.push(\n selection.editor\n ? planEditorFile(detection, draft.files, draft.createdFiles, draft.updatedFiles)\n : skipped(\"editor\"),\n );\n\n const addedScripts = planScripts(detection, selection, draft);\n return {\n root: detection.root,\n detection,\n lintTarget,\n features: sortFeatures(draft.features),\n files: draft.files,\n createdFiles: draft.createdFiles,\n updatedFiles: draft.updatedFiles,\n addedScripts,\n commands: planCommands(detection, draft.dependencies, options),\n };\n}\n\n/**\n * The install commands, as a list so callers can assert on them.\n *\n * Exactly one command is emitted, or none when every dependency is already\n * declared -- which is what makes a second `init` run a no-op.\n */\nfunction planCommands(\n detection: ProjectDetection,\n dependencies: ReadonlySet<string>,\n options: PlanInitOptions,\n): readonly InitCommand[] {\n if (!options.install) {\n return [];\n }\n const missing = [...dependencies].filter((name) => !detection.dependencies.has(name)).sort();\n if (missing.length === 0) {\n return [];\n }\n const command = resolveInstaller(detection, options.packageManager);\n return [{ command, args: [...INSTALL_ARGS[command]!, ...missing], cwd: detection.root }];\n}\n\n/**\n * Installer used for the one install command.\n *\n * A Vite+ project gets `vp add`, matching `setup` and the project's own\n * workflow. Otherwise the package manager comes from the same lockfile rules\n * `detect_package_manager` uses on the Rust side, defaulting to npm when\n * nothing identifies one.\n */\nexport function resolveInstaller(detection: ProjectDetection, override?: string): string {\n if (override !== undefined) {\n return override;\n }\n if (detection.usesVitePlus) {\n return \"vp\";\n }\n return detection.packageManager ?? \"npm\";\n}\n\nfunction readSingleViteConfig(detection: ProjectDetection): string | null {\n if (detection.viteConfigs.length !== 1) {\n return null;\n }\n return fs.readFileSync(path.join(detection.root, detection.viteConfigs[0]!), \"utf8\");\n}\n\nfunction addAll(target: Set<string>, values: readonly string[]): void {\n for (const value of values) {\n target.add(value);\n }\n}\n\nfunction sortFeatures(features: readonly FeatureResult[]): readonly FeatureResult[] {\n return [...features].sort(\n (left, right) => FEATURE_ORDER.indexOf(left.id) - FEATURE_ORDER.indexOf(right.id),\n );\n}\n","import readline from \"node:readline\";\n\nimport type { FeatureId, FeatureOffer, FeatureSelection } from \"./select.js\";\n\n/**\n * Interactive multi-select for the five features.\n *\n * Implemented on `node:readline` rather than a prompt package: `vize` is a\n * published CLI whose install cost every user pays, and a numbered toggle list\n * needs no raw-mode handling, no terminal restore path, and no dependency in the\n * runtime path. It is a real multi-select -- numbers toggle, Enter accepts.\n */\n\nexport interface PromptIo {\n readonly input: NodeJS.ReadableStream;\n readonly output: NodeJS.WritableStream;\n}\n\nexport interface PromptDeps extends PromptIo {\n /** Resolves to `null` when the input ended before an answer arrived. */\n readonly question: (query: string) => Promise<string | null>;\n /**\n * Releases the terminal. Required for readline-backed deps: an open interface\n * keeps stdin referenced and the process never exits.\n */\n readonly close?: () => void;\n}\n\n/** True when stdin cannot answer a prompt, so `init` must not ask one. */\nexport function isNonInteractive(stream: NodeJS.ReadableStream): boolean {\n return (stream as NodeJS.ReadStream).isTTY !== true;\n}\n\n/**\n * Wraps `node:readline` so a closed input resolves instead of hanging.\n *\n * `rl.question` never invokes its callback when stdin reaches EOF first. Left\n * alone that leaves `init`'s promise permanently pending, and the process exits\n * `0` having written nothing -- a silent no-op that looks like success. Resolving\n * to `null` on close turns that into an explicit cancellation.\n */\nexport function createPromptDeps(io: PromptIo): PromptDeps {\n const rl = readline.createInterface({ input: io.input, output: io.output });\n let closed = false;\n rl.on(\"close\", () => {\n closed = true;\n });\n return {\n ...io,\n question: (query) =>\n new Promise<string | null>((resolve) => {\n if (closed) {\n resolve(null);\n return;\n }\n let settled = false;\n const onClose = (): void => {\n if (!settled) {\n settled = true;\n resolve(null);\n }\n };\n rl.once(\"close\", onClose);\n rl.question(query, (answer) => {\n if (settled) {\n return;\n }\n settled = true;\n rl.removeListener(\"close\", onClose);\n resolve(answer);\n });\n }),\n close: () => {\n rl.close();\n },\n };\n}\n\n/** Runs the checklist. Returns `null` when the input ended before confirmation. */\nexport async function selectFeatures(\n offers: readonly FeatureOffer[],\n initial: FeatureSelection,\n deps: PromptDeps,\n): Promise<FeatureSelection | null> {\n const selection: Record<FeatureId, boolean> = { ...initial };\n const toggleable = offers.filter((offer) => offer.available);\n for (;;) {\n deps.output.write(renderChecklist(offers, selection));\n const raw = await deps.question(\"> \");\n if (raw === null) {\n return null;\n }\n const answer = raw.trim();\n if (answer === \"\") {\n return selection;\n }\n const indexes = parseIndexes(answer, toggleable.length);\n if (indexes === null) {\n deps.output.write(\n `Enter numbers between 1 and ${toggleable.length}, or press Enter to accept.\\n`,\n );\n continue;\n }\n for (const index of indexes) {\n const offer = toggleable[index]!;\n selection[offer.id] = !selection[offer.id];\n }\n }\n}\n\n/** Yes/no confirmation. A closed input counts as \"no\", never as \"yes\". */\nexport async function confirm(query: string, deps: PromptDeps): Promise<boolean> {\n const raw = await deps.question(`${query} [Y/n] `);\n if (raw === null) {\n return false;\n }\n const answer = raw.trim().toLowerCase();\n return answer === \"\" || answer === \"y\" || answer === \"yes\";\n}\n\nfunction renderChecklist(\n offers: readonly FeatureOffer[],\n selection: Readonly<Record<FeatureId, boolean>>,\n): string {\n const lines = [\n \"\",\n \"Select the features to configure.\",\n \"Type the numbers to toggle (space or comma separated), then press Enter.\",\n \"\",\n ];\n let position = 0;\n for (const offer of offers) {\n if (!offer.available) {\n lines.push(` - ${offer.label}${offer.note === \"\" ? \"\" : ` (${offer.note})`}`);\n continue;\n }\n position += 1;\n const mark = selection[offer.id] ? \"x\" : \" \";\n const note = offer.note === \"\" ? \"\" : ` (${offer.note})`;\n lines.push(` ${position}. [${mark}] ${offer.label}${note}`);\n }\n lines.push(\"\");\n return `${lines.join(\"\\n\")}\\n`;\n}\n\n/** Parses a toggle answer into zero-based indexes, or `null` when any entry is out of range. */\nfunction parseIndexes(answer: string, count: number): readonly number[] | null {\n const tokens = answer.split(/[\\s,]+/u).filter((token) => token !== \"\");\n const indexes: number[] = [];\n for (const token of tokens) {\n if (!/^\\d+$/u.test(token)) {\n return null;\n }\n const value = Number.parseInt(token, 10);\n if (value < 1 || value > count) {\n return null;\n }\n indexes.push(value - 1);\n }\n return indexes.length === 0 ? null : indexes;\n}\n","import type { ProjectDetection } from \"./detect.js\";\nimport { unreadOxlintConfig } from \"./lint-target.js\";\nimport type { InitPlan } from \"./plan.js\";\nimport { EDITOR_INTEGRATIONS } from \"./templates.js\";\n\nconst PREFIX = \"[vize init]\";\n\n/**\n * Detection summary, printed before any prompt.\n *\n * Users need to see what `init` concluded before they are asked to act on it;\n * an unexpected line here is the cheapest place to catch a wrong root or a\n * missing lockfile.\n */\nexport function renderDetection(detection: ProjectDetection): string {\n const lines = [\n `${PREFIX} detected in ${detection.root}:`,\n ` framework: ${describeFramework(detection)}`,\n ` package manager: ${detection.packageManager ?? \"none detected (defaulting to npm)\"}`,\n ` language: ${detection.typescript ? \"TypeScript\" : \"JavaScript\"}${\n detection.tsconfig === null ? \" (no tsconfig.json)\" : \" (tsconfig.json)\"\n }`,\n ` lint command: ${detection.usesVitePlus ? \"vp lint\" : \"oxlint\"}`,\n ` vize config: ${detection.vizeConfig ?? \"none\"}`,\n ` oxlint config: ${describeOxlintConfig(detection)}`,\n ];\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nfunction describeFramework(detection: ProjectDetection): string {\n if (detection.framework === \"nuxt\") {\n return `Nuxt (${detection.nuxtConfig ?? \"nuxt dependency, no nuxt.config\"})`;\n }\n if (detection.framework === \"vite\") {\n const configs = detection.viteConfigs.join(\", \");\n return detection.usesVitePlus ? `Vite+ (${configs})` : `Vite (${configs})`;\n }\n return \"none (no vite.config or nuxt.config)\";\n}\n\nfunction describeOxlintConfig(detection: ProjectDetection): string {\n const unread = unreadOxlintConfig(detection);\n if (unread !== null) {\n return `${unread} — present but oxlint does not read this name (#3474)`;\n }\n return detection.oxlintConfig ?? \"none\";\n}\n\n/**\n * The full plan.\n *\n * Printed before anything is written in both modes, so the wording is what the\n * run is about to do, not what it has done. `--dry-run` differs only in stopping\n * afterwards.\n */\nexport function renderPlan(plan: InitPlan, dryRun: boolean): string {\n const verb = dryRun ? \"would\" : \"will\";\n const lines: string[] = [`${PREFIX} plan:`];\n for (const feature of plan.features) {\n lines.push(` ${feature.id.padEnd(9)} ${feature.outcome.padEnd(10)} ${feature.detail}`);\n }\n for (const filename of plan.createdFiles) {\n lines.push(`${PREFIX} ${verb} create ${filename}`);\n }\n for (const filename of plan.updatedFiles) {\n lines.push(`${PREFIX} ${verb} update ${filename}`);\n }\n if (plan.addedScripts.length > 0) {\n lines.push(`${PREFIX} ${verb} add scripts: ${plan.addedScripts.join(\", \")}`);\n }\n for (const command of plan.commands) {\n lines.push(`${PREFIX} ${verb} run: ${command.command} ${command.args.join(\" \")}`);\n }\n if (plan.createdFiles.length + plan.updatedFiles.length + plan.commands.length === 0) {\n lines.push(`${PREFIX} nothing to do; the project is already configured`);\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\n/**\n * Snippets for anything `init` refused to edit.\n *\n * A blocked feature is deliberately loud. The alternative for the lint feature\n * would be writing an Oxlint config the project's lint command never reads,\n * which reports zero Vize diagnostics and exits 0 (#3389).\n */\nexport function renderBlocked(plan: InitPlan): string {\n const blocked = plan.features.filter((feature) => feature.outcome === \"blocked\");\n if (blocked.length === 0) {\n return \"\";\n }\n const lines: string[] = [];\n for (const feature of blocked) {\n lines.push(`${PREFIX} ${feature.id}: NOT configured — ${feature.detail}`);\n if (feature.snippet !== null) {\n lines.push(\"\", indent(feature.snippet), \"\");\n }\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nexport function renderEditors(): string {\n const lines = [`${PREFIX} editor integrations shipped with Vize:`];\n for (const integration of EDITOR_INTEGRATIONS) {\n lines.push(` ${integration}`);\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\n/**\n * Printed when the prompt ends without a confirmation.\n *\n * Covers both a declined confirmation and an input stream that closed\n * mid-prompt. Saying so is what keeps a closed stdin from looking like a\n * successful run that happened to change nothing.\n */\nexport function renderCancelled(): string {\n return `${PREFIX} cancelled; nothing was written.\\n`;\n}\n\nexport function renderNonInteractiveRefusal(): string {\n return (\n `${PREFIX} stdin is not a TTY, so init will not prompt.\\n` +\n `${PREFIX} pass --yes with the features you want, for example:\\n` +\n `${PREFIX} vize init --yes --lint --vite --fmt --typecheck --editor\\n` +\n `${PREFIX} or run with --dry-run to print the plan without writing.\\n`\n );\n}\n\nfunction indent(source: string): string {\n return source\n .split(\"\\n\")\n .map((line) => (line === \"\" ? line : ` ${line}`))\n .join(\"\\n\")\n .trimEnd();\n}\n","import { execFileSync } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { atomicWriteFile } from \"./setup/config.js\";\nimport { initHelp, parseInitArgs, type InitArgs } from \"./init/args.js\";\nimport { detectProject, withFramework, type ProjectDetection } from \"./init/detect.js\";\nimport { planInit, type InitCommand, type InitPlan } from \"./init/plan.js\";\nimport {\n confirm,\n createPromptDeps,\n isNonInteractive,\n selectFeatures,\n type PromptDeps,\n} from \"./init/prompt.js\";\nimport {\n renderBlocked,\n renderCancelled,\n renderDetection,\n renderEditors,\n renderNonInteractiveRefusal,\n renderPlan,\n} from \"./init/report.js\";\nimport { defaultSelection, offerFeatures, type FeatureSelection } from \"./init/select.js\";\n\nexport type { InitCommand, InitPlan } from \"./init/plan.js\";\nexport type { ProjectDetection } from \"./init/detect.js\";\n\nexport interface InitOptions {\n readonly root: string;\n readonly args?: readonly string[];\n readonly runCommand?: (command: InitCommand) => void;\n readonly writeFile?: (filename: string, source: string) => void;\n readonly output?: (chunk: string) => void;\n readonly promptDeps?: PromptDeps;\n readonly stdin?: NodeJS.ReadableStream;\n}\n\n/**\n * Resolves the feature selection from detection, flags, and -- when the terminal\n * allows it -- the user.\n *\n * A non-TTY stdin without `--yes` returns `null`: refusing is the only correct\n * answer, because prompting would hang a CI job forever.\n */\nexport async function resolveSelection(\n detection: ProjectDetection,\n args: InitArgs,\n deps: {\n readonly output: (chunk: string) => void;\n readonly stdin: NodeJS.ReadableStream;\n readonly promptDeps?: PromptDeps;\n },\n): Promise<FeatureSelection | null> {\n const offers = offerFeatures(detection);\n const base = defaultSelection(offers);\n // An explicit flag survives even when detection says the feature is\n // unavailable: the planner then reports it as blocked, with the reason. That\n // is more useful than dropping the flag the user typed.\n const withOverrides: Record<string, boolean> = { ...base };\n for (const [id, enabled] of Object.entries(args.overrides)) {\n withOverrides[id] = enabled;\n }\n const selection = withOverrides as FeatureSelection;\n\n if (args.yes) {\n return selection;\n }\n if (deps.promptDeps === undefined && isNonInteractive(deps.stdin)) {\n deps.output(renderNonInteractiveRefusal());\n return null;\n }\n // Only a prompt this function created may be closed here; an injected one\n // belongs to the caller.\n const owned =\n deps.promptDeps === undefined\n ? createPromptDeps({ input: deps.stdin, output: process.stdout as NodeJS.WritableStream })\n : null;\n const promptDeps = deps.promptDeps ?? owned!;\n try {\n const chosen = await selectFeatures(offers, selection, promptDeps);\n if (chosen !== null && (await confirm(\"Apply this selection?\", promptDeps))) {\n return chosen;\n }\n deps.output(renderCancelled());\n return null;\n } finally {\n owned?.close?.();\n }\n}\n\n/**\n * Runs `init` end to end.\n *\n * Detection is reported before anything is decided, the plan is reported before\n * anything is written, and a blocked feature is reported as NOT configured\n * rather than quietly downgraded.\n */\nexport async function initProject(options: InitOptions): Promise<InitPlan | null> {\n const args = parseInitArgs(options.args ?? []);\n const output = options.output ?? ((chunk: string) => process.stdout.write(chunk));\n const root = path.resolve(args.root ?? options.root);\n const detection = withFramework(detectProject(root), args.bundlerOverride);\n output(renderDetection(detection));\n\n const selection = await resolveSelection(detection, args, {\n output,\n stdin: options.stdin ?? process.stdin,\n promptDeps: options.promptDeps,\n });\n if (selection === null) {\n return null;\n }\n\n const plan = planInit({\n detection,\n selection,\n install: args.install,\n packageManager: args.packageManager ?? undefined,\n });\n output(renderPlan(plan, args.dryRun));\n output(renderBlocked(plan));\n if (args.dryRun) {\n return plan;\n }\n\n writePlannedFiles(plan, options.writeFile ?? writeProjectFile);\n const runCommand = options.runCommand ?? runInitCommand;\n for (const command of plan.commands) {\n runCommand(command);\n }\n if (selection.editor) {\n output(renderEditors());\n }\n return plan;\n}\n\nexport async function runInitCli(args: readonly string[]): Promise<void> {\n if (parseInitArgs(args).help) {\n process.stdout.write(initHelp());\n return;\n }\n const plan = await initProject({ root: process.cwd(), args });\n if (plan === null) {\n process.exitCode = 1;\n return;\n }\n if (plan.features.some((feature) => feature.outcome === \"blocked\")) {\n process.exitCode = 1;\n }\n}\n\n/**\n * Default writer.\n *\n * Creates the parent directory first so `.vscode/extensions.json` works in a\n * project that has never had a `.vscode` folder, then reuses `setup`'s atomic\n * write so a crash mid-run cannot leave a half-written config behind.\n */\nfunction writeProjectFile(filename: string, source: string): void {\n fs.mkdirSync(path.dirname(filename), { recursive: true });\n atomicWriteFile(filename, source);\n}\n\nfunction writePlannedFiles(\n plan: InitPlan,\n writeFile: (filename: string, source: string) => void,\n): void {\n const written: string[] = [];\n for (const file of plan.files) {\n try {\n writeFile(file.filename, file.source);\n } catch (error) {\n if (written.length === 0) {\n throw error;\n }\n throw new Error(\n `init partially completed: wrote ${written.join(\", \")} before ` +\n `${path.relative(plan.root, file.filename)} failed. Run init again to finish.`,\n { cause: error },\n );\n }\n written.push(path.relative(plan.root, file.filename));\n }\n}\n\nfunction runInitCommand(command: InitCommand): void {\n execFileSync(command.command, [...command.args], { cwd: command.cwd, stdio: \"inherit\" });\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 DISCOVERED_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 = DISCOVERED_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 DISCOVERED_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 { configureBundledCorsaRuntime } from \"./corsa-runtime.js\";\nimport { runInitCli } from \"./init.js\";\nimport { runSetupCli } from \"./setup.js\";\n\nconst require = createRequire(import.meta.url);\n\nfunction fail(error: unknown): void {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[vize] ${message}\\n`);\n process.exitCode = 1;\n}\n\ntry {\n const args = process.argv.slice(2);\n if (args[0] === \"setup\") {\n runSetupCli(args.slice(1));\n } else if (args[0] === \"init\") {\n // `init` prompts, so it is the one command that has to be async. Failures\n // land in the same reporter as the synchronous commands.\n runInitCli(args.slice(1)).catch(fail);\n } else {\n configureBundledCorsaRuntime();\n const native = require(\"@vizejs/native\") as typeof import(\"@vizejs/native\");\n native.runCli(args);\n }\n} catch (error) {\n fail(error);\n}\n"],"mappings":";;;;;;;AAKA,MAAa,kCAAkC;CAC7C;CACA;CACA;CACA;AACF;AAQA,SAAgB,6BACd,cAAiC,QAAQ,KACzC,UAAoC,CAAC,GACtB;CACf,IAAI,yBAAyB,WAAW,GAAG,OAAO;CAElD,MAAM,aAAa,2BAA2B,OAAO;CACrD,IAAI,cAAc,MAAM,OAA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,IAAI;CACpB;AACF,SAAS,OAAO;CACd,KAAK,KAAK;AACZ"}
@@ -220,4 +220,4 @@ function normalizeGlobalTypes(config) {
220
220
  //#endregion
221
221
  export { loadConfig as a, defineConfig as i, VIZE_CONFIG_JSON_SCHEMA_PATH as n, normalizeGlobalTypes as o, VIZE_CONFIG_PKL_SCHEMA_PATH as r, resolveConfigExport as s, CONFIG_FILE_NAMES as t };
222
222
 
223
- //# sourceMappingURL=config-CqEev07u.mjs.map
223
+ //# sourceMappingURL=config-CuGxe7fm.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-CqEev07u.mjs","names":["PACKAGE_ROOT","path","getErrorMessage","fs","path","fs"],"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 if (typeof value === \"string\") {\n result[key] = { type: value };\n } else {\n result[key] = value;\n }\n }\n return result;\n}\n"],"mappings":";;;;;;;;AAMA,MAAMA,iBAAeC,OAAK,QAAQ,cAAc,IAAI,IAAI,KAAK,OAAO,KAAK,IAAI,CAAC,EAAE,QAAQ;AAExF,MAAM,kCACJ;;;;;;;;;;;AAYF,SAAgB,kBAAkB,UAAU;CAC1C,MAAM,SAAS,eAAe;CAC9B,IAAI,CAAC,QAAQ;EACX,QAAQ,KACN,mHAED;EACD,OAAO;;CAGT,MAAM,kBAAkB,wCAAwC,SAAS;CACzE,MAAM,eAAe,mBAAmB;CACxC,IAAI;EACF,OAAO,aAAa,QAAQ;GAAC;GAAQ;GAAM;GAAQ;GAAa,EAAE;GAChE,KAAKA,OAAK,QAAQ,SAAS;GAC3B,UAAU;GACV,OAAO;IAAC;IAAU;IAAQ;IAAO;GACjC,SAAS;GACV,CAAC;UACK,OAAO;EACd,MAAM,IAAI,MAAM,yCAAyC,SAAS,IAAIC,kBAAgB,MAAM,GAAG;WACvF;EACR,IAAI,iBACF,KAAG,OAAO,iBAAiB,EAAE,OAAO,MAAM,CAAC;;;AAKjD,SAAS,gBAAgB;CACvB,IAAI;EACF,MAAM,aAAa,OAAO,KAAK,UAAU,qBAAqB;EAC9D,IAAI,YAAY;GACd,MAAM,YAAYD,OAAK,QAAQ,cAAc,WAAW,CAAC;GACzD,MAAM,gBAAgBA,OAAK,QAAQ,UAAU;GAC7C,MAAM,aAAa;IACjBA,OAAK,KAAK,WAAW,UAAU;IAC/BA,OAAK,KAAK,eAAe,MAAM;IAC/BA,OAAK,KAAK,eAAe,UAAU;IACpC;GAED,KAAK,MAAM,aAAa,YACtB,IAAIE,KAAG,WAAW,UAAU,EAC1B,IAAI;IACF,aAAa,WAAW,CAAC,YAAY,EAAE,EAAE,OAAO,UAAU,CAAC;IAC3D,OAAO;WACD;;SAMR;CAIR,IA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,SAAS,sBAAsB,QAAqC;CAClE,OAAO,OAAO,oBAAoB,UAAU,KAAK;;AAGnD,SAAS,gBAAgB,OAAwB;CAC/C,IAAI,iBAAiB,OACnB,OAAO,MAAM;CAGf,OAAO,OAAO,MAAM;;;;;AAMtB,SAAgB,qBACd,QACuC;CACvC,MAAM,iBACJ,WAAW,UACX,OAAO,OAAO,UAAU,YACxB,OAAO,UAAU,QACjB,CAAC,MAAM,QAAQ,OAAO,MAAM,GACxB,OAAO,QACP;CAEN,MAAM,SAAgD,EAAE;CACxD,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,eAAe,EACvD,IAAI,OAAO,UAAU,UACnB,OAAO,OAAO,EAAE,MAAM,OAAO;MAE7B,OAAO,OAAO;CAGlB,OAAO"}
1
+ {"version":3,"file":"config-CuGxe7fm.mjs","names":["PACKAGE_ROOT","path","getErrorMessage","fs","path","fs"],"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 if (typeof value === \"string\") {\n result[key] = { type: value };\n } else {\n result[key] = value;\n }\n }\n return result;\n}\n"],"mappings":";;;;;;;;AAMA,MAAMA,iBAAeC,OAAK,QAAQ,cAAc,IAAI,IAAI,KAAK,OAAO,KAAK,GAAG,CAAC,GAAG,OAAO;AAEvF,MAAM,kCACJ;;;;;;;;;;;AAYF,SAAgB,kBAAkB,UAAU;CAC1C,MAAM,SAAS,cAAc;CAC7B,IAAI,CAAC,QAAQ;EACX,QAAQ,KACN,kHAEF;EACA,OAAO;CACT;CAEA,MAAM,kBAAkB,wCAAwC,QAAQ;CACxE,MAAM,eAAe,mBAAmB;CACxC,IAAI;EACF,OAAO,aAAa,QAAQ;GAAC;GAAQ;GAAM;GAAQ;EAAY,GAAG;GAChE,KAAKA,OAAK,QAAQ,QAAQ;GAC1B,UAAU;GACV,OAAO;IAAC;IAAU;IAAQ;GAAM;GAChC,SAAS;EACX,CAAC;CACH,SAAS,OAAO;EACd,MAAM,IAAI,MAAM,yCAAyC,SAAS,IAAIC,kBAAgB,KAAK,GAAG;CAChG,UAAU;EACR,IAAI,iBACF,KAAG,OAAO,iBAAiB,EAAE,OAAO,KAAK,CAAC;CAE9C;AACF;AAEA,SAAS,gBAAgB;CACvB,IAAI;EACF,MAAM,aAAa,OAAO,KAAK,UAAU,oBAAoB;EAC7D,IAAI,YAAY;GACd,MAAM,YAAYD,OAAK,QAAQ,cAAc,UAAU,CAAC;GACxD,MAAM,gBAAgBA,OAAK,QAAQ,SAAS;GAC5C,MAAM,aAAa;IACjBA,OAAK,KAAK,WAAW,SAAS;IAC9BA,OAAK,KAAK,eAAe,KAAK;IAC9BA,OAAK,KAAK,eAAe,SAAS;GAC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Q;CACtC,QAAQ,aAAa,IAAI,KAAK,OAAOC,KAAG,SAAS,QAAQ,EAAE,OAAO,CAAC;CACnE,OAAO,OAAO,QAAQ;AACxB;AAEA,SAAS,gBAAgB,SAAiB,UAAsC;CAC9E,IAAI;EACF,OAAO,sBAAsB,KAAK,MAAM,OAAO,CAAC;CAClD,SAAS,OAAO;EACd,MAAM,IAAI,MAAM,uCAAuC,SAAS,IAAI,gBAAgB,KAAK,GAAG;CAC9F;AACF;AAEA,SAAS,sBAAsB,QAAqC;CAClE,OAAO,OAAO,oBAAoB,UAAU,IAAI;AAClD;AAEA,SAAS,gBAAgB,OAAwB;CAC/C,IAAI,iBAAiB,OACnB,OAAO,MAAM;CAGf,OAAO,OAAO,KAAK;AACrB;;;;AAKA,SAAgB,qBACd,QACuC;CACvC,MAAM,iBACJ,WAAW,UACX,OAAO,OAAO,UAAU,YACxB,OAAO,UAAU,QACjB,CAAC,MAAM,QAAQ,OAAO,KAAK,IACvB,OAAO,QACP;CAEN,MAAM,SAAgD,CAAC;CACvD,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,cAAc,GACtD,IAAI,OAAO,UAAU,UACnB,OAAO,OAAO,EAAE,MAAM,MAAM;MAE5B,OAAO,OAAO;CAGlB,OAAO;AACT"}
@@ -82,6 +82,10 @@ interface CompilerConfig {
82
82
  * Treat lowercase non-HTML tags as custom renderer elements
83
83
  */
84
84
  customRenderer?: boolean;
85
+ /**
86
+ * Tag patterns that compile as custom elements instead of Vue components
87
+ */
88
+ customElements?: string[];
85
89
  /**
86
90
  * Enable SSR mode
87
91
  */
@@ -729,4 +733,4 @@ declare function resolveConfigExport(exported: UserConfigExport, env?: ConfigEnv
729
733
  declare function normalizeGlobalTypes(config: GlobalTypesConfig): Record<string, GlobalTypeDeclaration>;
730
734
  //#endregion
731
735
  export { MuseaConfig as A, GlobalTypeDeclaration as C, LinterConfig as D, LintPreset as E, VitePluginConfig as F, VizeConfig as I, VizeConfigEntry as L, RuleCategory as M, RuleSeverity as N, MuseaA11yConfig as O, TypeCheckerConfig as P, VueVersion as R, FormatterConfig as S, LanguageServerConfig as T, VueConfig as _, loadConfig as a, CompilerCompatibilityConfig as b, LspConfig as c, MaybePromise as d, ResolvedVizeConfig as f, UserConfigInput as g, UserConfigExport as h, defineConfig as i, MuseaVrtConfig as j, MuseaAutogenConfig as k, ConfigEnv as l, UserConfigEntry as m, VIZE_CONFIG_JSON_SCHEMA_PATH as n, normalizeGlobalTypes as o, UserConfig as p, VIZE_CONFIG_PKL_SCHEMA_PATH as r, resolveConfigExport as s, CONFIG_FILE_NAMES as t, LoadConfigOptions as u, LintRuleName as v, GlobalTypesConfig as w, CompilerConfig as x, LintRulesConfig as y };
732
- //# sourceMappingURL=config-B0NHKCD3.d.mts.map
736
+ //# sourceMappingURL=config-ihW9XDVK.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-ihW9XDVK.d.mts","names":[],"sources":["../src/types/generated.ts","../src/types/rules.ts","../src/types/runtime.ts","../src/types/index.ts","../src/config.ts"],"mappings":";;AAOA;;;;KAAY,UAAA;AAAA,KAQA,YAAA;AAAA,KAEA,YAAA;;;AAFY;KAOZ,UAAA;;;;UAKK,UAAA;EALL;;;EASV,IAAA;EAToB;AAKtB;;EAQE,QAAA;EAiBW;;;EAbX,KAAA;EAyBY;;;EArBZ,OAAA;EAyBc;;;EArBd,OAAA;EAhBA;;;EAoBA,OAAA;EACA,QAAA,GAAW,cAAA;EACX,aAAA;IAAA,CACG,CAAA;MAAA,CAGM,CAAA;IAAA;EAAA;EAIT,IAAA,GAAO,gBAAA;EACP,MAAA,GAAS,YAAA;EACT,WAAA,GAAc,iBAAA;EACd,SAAA,GAAY,eAAA;EACZ,cAAA,GAAiB,oBAAA;EACjB,GAAA,GAAM,oBAAA;EACN,KAAA,GAAQ,WAAA;EACR,WAAA,GAAc,iBAAA;EAJF;;;EAQZ,OAAA,GAAU,eAAA;AAAA;;;;UAKK,cAAA;EALf;;;EASA,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,iBAAA;AAAA,cAeA,4BAAA;AAAA,cAMA,2BAAA;;AJrCS;AAQtB;;iBImCgB,YAAA,CAAa,MAAA,EAAQ,gBAAA,GAAmB,gBAAgB;;AJnChD;AAExB;iBIwCsB,UAAA,CACpB,IAAA,UACA,OAAA,GAAS,iBAAA,GACR,OAAA,CAAQ,kBAAA;AAAA,iBA0FW,mBAAA,CACpB,QAAA,EAAU,gBAAA,EACV,GAAA,GAAM,SAAA,GACL,OAAA,CAAQ,kBAAA;;AJxIa;AAKxB;iBIwMgB,oBAAA,CACd,MAAA,EAAQ,iBAAA,GACP,MAAA,SAAe,qBAAA"}
package/dist/config.d.mts CHANGED
@@ -1,2 +1,2 @@
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, s as resolveConfigExport, t as CONFIG_FILE_NAMES } from "./config-B0NHKCD3.mjs";
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, s as resolveConfigExport, t as CONFIG_FILE_NAMES } from "./config-ihW9XDVK.mjs";
2
2
  export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes, resolveConfigExport };
package/dist/config.mjs CHANGED
@@ -1,2 +1,2 @@
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, s as resolveConfigExport, t as CONFIG_FILE_NAMES } from "./config-CqEev07u.mjs";
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, s as resolveConfigExport, t as CONFIG_FILE_NAMES } from "./config-CuGxe7fm.mjs";
2
2
  export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes, resolveConfigExport };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as MuseaConfig, C as GlobalTypeDeclaration, D as LinterConfig, E as LintPreset, F as VitePluginConfig, I as VizeConfig, L as VizeConfigEntry, M as RuleCategory, N as RuleSeverity, O as MuseaA11yConfig, P as TypeCheckerConfig, R as VueVersion, S as FormatterConfig, T as LanguageServerConfig, _ as VueConfig, a as loadConfig, b as CompilerCompatibilityConfig, c as LspConfig, d as MaybePromise, f as ResolvedVizeConfig, g as UserConfigInput, h as UserConfigExport, i as defineConfig, j as MuseaVrtConfig, k as MuseaAutogenConfig, l as ConfigEnv, m as UserConfigEntry, n as VIZE_CONFIG_JSON_SCHEMA_PATH, o as normalizeGlobalTypes, p as UserConfig, r as VIZE_CONFIG_PKL_SCHEMA_PATH, s as resolveConfigExport, t as CONFIG_FILE_NAMES, u as LoadConfigOptions, v as LintRuleName, w as GlobalTypesConfig, x as CompilerConfig, y as LintRulesConfig } from "./config-B0NHKCD3.mjs";
1
+ import { A as MuseaConfig, C as GlobalTypeDeclaration, D as LinterConfig, E as LintPreset, F as VitePluginConfig, I as VizeConfig, L as VizeConfigEntry, M as RuleCategory, N as RuleSeverity, O as MuseaA11yConfig, P as TypeCheckerConfig, R as VueVersion, S as FormatterConfig, T as LanguageServerConfig, _ as VueConfig, a as loadConfig, b as CompilerCompatibilityConfig, c as LspConfig, d as MaybePromise, f as ResolvedVizeConfig, g as UserConfigInput, h as UserConfigExport, i as defineConfig, j as MuseaVrtConfig, k as MuseaAutogenConfig, l as ConfigEnv, m as UserConfigEntry, n as VIZE_CONFIG_JSON_SCHEMA_PATH, o as normalizeGlobalTypes, p as UserConfig, r as VIZE_CONFIG_PKL_SCHEMA_PATH, s as resolveConfigExport, t as CONFIG_FILE_NAMES, u as LoadConfigOptions, v as LintRuleName, w as GlobalTypesConfig, x as CompilerConfig, y as LintRulesConfig } from "./config-ihW9XDVK.mjs";
2
2
  export { CONFIG_FILE_NAMES, type CompilerCompatibilityConfig, type CompilerConfig, type ConfigEnv, type FormatterConfig, type GlobalTypeDeclaration, type GlobalTypesConfig, type LanguageServerConfig, type LintPreset, type LintRuleName, type LintRulesConfig, type LinterConfig, type LoadConfigOptions, type LspConfig, type MaybePromise, type MuseaA11yConfig, type MuseaAutogenConfig, type MuseaConfig, type MuseaVrtConfig, type ResolvedVizeConfig, type RuleCategory, type RuleSeverity, type TypeCheckerConfig, type UserConfig, type UserConfigEntry, type UserConfigExport, type UserConfigInput, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, type VitePluginConfig, type VizeConfig, type VizeConfigEntry, type VueConfig, type VueVersion, defineConfig, loadConfig, normalizeGlobalTypes, resolveConfigExport };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
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, s as resolveConfigExport, t as CONFIG_FILE_NAMES } from "./config-CqEev07u.mjs";
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, s as resolveConfigExport, t as CONFIG_FILE_NAMES } from "./config-CuGxe7fm.mjs";
2
2
  export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes, resolveConfigExport };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vize",
3
- "version": "0.347.7",
3
+ "version": "0.351.0",
4
4
  "description": "Vize - High-performance Vue.js toolchain in Rust",
5
5
  "keywords": [
6
6
  "cli",
@@ -53,17 +53,17 @@
53
53
  "access": "public"
54
54
  },
55
55
  "dependencies": {
56
- "@vizejs/native": "0.347.7",
57
- "oxc-transform": "0.130.0"
56
+ "@vizejs/native": "0.351.0",
57
+ "oxc-transform": "0.144.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@pkl-community/pkl": "0.30.2",
61
- "@tsdown/css": "0.22.0",
61
+ "@tsdown/css": "0.22.14",
62
62
  "@types/node": "25.9.2",
63
- "tsdown": "0.22.0",
63
+ "tsdown": "0.22.14",
64
64
  "typescript": "6.0.3",
65
- "vite": "npm:@voidzero-dev/vite-plus-core@0.1.21",
66
- "vite-plus": "0.1.21",
65
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.1.24",
66
+ "vite-plus": "0.1.24",
67
67
  "vue": "3.5.35"
68
68
  },
69
69
  "peerDependencies": {
@@ -81,19 +81,21 @@
81
81
  "optionalDependencies": {
82
82
  "@typescript/native-preview": "7.0.0-dev.20260603.1"
83
83
  },
84
+ "typescript": {
85
+ "contentMapper": {
86
+ "compilerOptions": [
87
+ "noUnusedLocals"
88
+ ],
89
+ "exec": [
90
+ "node",
91
+ "./bin/vize",
92
+ "content-mapper"
93
+ ]
94
+ }
95
+ },
84
96
  "engines": {
85
97
  "node": ">=22"
86
98
  },
87
- "tsContentMapper": {
88
- "exec": [
89
- "node",
90
- "./bin/vize",
91
- "content-mapper"
92
- ],
93
- "compilerOptions": [
94
- "noUnusedLocals"
95
- ]
96
- },
97
99
  "scripts": {
98
100
  "build": "vp run --workspace-root generate:rule-types && vp pack",
99
101
  "check": "vp check src tests vite.config.ts",
@@ -42,6 +42,9 @@ class CompilerConfig {
42
42
  /// Treat lowercase non-HTML tags as custom renderer elements.
43
43
  customRenderer: Boolean = false
44
44
 
45
+ /// Tag patterns that compile as custom elements instead of Vue components.
46
+ customElements: Listing<String> = new Listing {}
47
+
45
48
  /// Enable SSR mode.
46
49
  ssr: Boolean = false
47
50
 
@@ -90,6 +90,14 @@ compilerConfigDef: JsonSchema = new JsonSchema {
90
90
  description = "Treat lowercase non-HTML tags as custom renderer elements"
91
91
  default = false
92
92
  }
93
+ ["customElements"] = new JsonSchema {
94
+ type = "array"
95
+ items = new JsonSchema {
96
+ type = "string"
97
+ }
98
+ description = "Tag patterns that compile as custom elements instead of Vue components"
99
+ default = new Listing {}
100
+ }
93
101
  ["ssr"] = new JsonSchema {
94
102
  type = "boolean"
95
103
  description = "Enable SSR mode"
package/pkl/vize.pkl CHANGED
@@ -35,6 +35,7 @@ class CompilerConfig {
35
35
  jsxMode: JsxMode? = null
36
36
  jsxCompat: JsxCompat? = null
37
37
  customRenderer: Boolean? = null
38
+ customElements: Listing<String>? = null
38
39
  ssr: Boolean? = null
39
40
  templateSyntax: TemplateSyntax? = null
40
41
  sourceMap: Boolean? = null
@@ -72,6 +72,14 @@
72
72
  "default": false,
73
73
  "type": "boolean"
74
74
  },
75
+ "customElements": {
76
+ "description": "Tag patterns that compile as custom elements instead of Vue components",
77
+ "default": [],
78
+ "type": "array",
79
+ "items": {
80
+ "type": "string"
81
+ }
82
+ },
75
83
  "ssr": {
76
84
  "description": "Enable SSR mode",
77
85
  "default": false,
@@ -6,7 +6,7 @@ import type { ProjectDetection } from "./detect.js";
6
6
  import type { FeatureResult } from "./plan-types.js";
7
7
  import { renderVscodeExtensions, VSCODE_EXTENSION_ID } from "./templates.js";
8
8
 
9
- const EXTENSIONS_FILE = path.join(".vscode", "extensions.json");
9
+ const EXTENSIONS_FILE = ".vscode/extensions.json";
10
10
 
11
11
  /**
12
12
  * Plans the editor recommendation.
@@ -96,6 +96,10 @@ export interface CompilerConfig {
96
96
  * Treat lowercase non-HTML tags as custom renderer elements
97
97
  */
98
98
  customRenderer?: boolean;
99
+ /**
100
+ * Tag patterns that compile as custom elements instead of Vue components
101
+ */
102
+ customElements?: string[];
99
103
  /**
100
104
  * Enable SSR mode
101
105
  */
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-B0NHKCD3.d.mts","names":[],"sources":["../src/types/generated.ts","../src/types/rules.ts","../src/types/runtime.ts","../src/types/index.ts","../src/config.ts"],"mappings":";;AAOA;;;;KAAY,UAAA;AAAA,KAQA,YAAA;AAAA,KAEA,YAAA;;;;KAKA,UAAA;;;;UAKK,UAAA;EALL;;;EASV,IAAA;EAToB;AAKtB;;EAQE,QAAA;EAiBW;;;EAbX,KAAA;EAyBY;;;EArBZ,OAAA;EAyBc;;;EArBd,OAAA;EAhBA;;;EAoBA,OAAA;EACA,QAAA,GAAW,cAAA;EACX,aAAA;IAAA,CACG,CAAA;MAAA,CAGM,CAAA;IAAA;EAAA;EAIT,IAAA,GAAO,gBAAA;EACP,MAAA,GAAS,YAAA;EACT,WAAA,GAAc,iBAAA;EACd,SAAA,GAAY,eAAA;EACZ,cAAA,GAAiB,oBAAA;EACjB,GAAA,GAAM,oBAAA;EACN,KAAA,GAAQ,WAAA;EACR,WAAA,GAAc,iBAAA;EAJF;;;EAQZ,OAAA,GAAU,eAAA;AAAA;;;;UAKK,cAAA;EALf;;;EASA,IAAA;EAJe;;;EAQf,KAAA;EAJA;;;EAQA,OAAA;EAQA;;;EAJA,SAAA;EAoBA;;;EAhBA,cAAA;EAgCA;;;EA5BA,GAAA;EAqCgB;;;EAjChB,cAAA;EAsC0C;;;EAlC1C,SAAA;EAmCa;;;EA/Bb,iBAAA;EA+CA;;;EA3CA,WAAA;EAiDe;;;EA7Cf,aAAA;EAiDsC;;;EA7CtC,IAAA;EAiD4C;;;EA7C5C,SAAA;EA6CA;;;EAzCA,iBAAA;EAiDA;;;EA7CA,iBAAA;EACA,aAAA,GAAgB,2BAAA;AAAA;;;;UAKD,2BAAA;EACf,UAAA,GAAa,UAAA;EA4DV;;;EAxDH,YAAA;EA+DE;;;EA3DF,uBAAA;EA+DE;;;EA3DF,eAAA;EA+De;;;EA3Df,WAAA;EA4DA;;;EAxDA,cAAA;AAAA;AAAA,UAEe,gBAAA;EAyDA;;;EArDf,OAAA,YA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