vize 0.474.0 → 0.476.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/pkl/vize.pkl CHANGED
@@ -16,7 +16,7 @@ typealias JsxMode = "vdom" | "vapor"
16
16
  typealias JsxCompat = "native" | "babel"
17
17
  typealias ScriptExt = "ts" | "js"
18
18
  typealias RuleSeverity = "off" | "warn" | "error"
19
- typealias LintPreset = "happy-path" | "opinionated" | "essential" | "incremental" | "ecosystem" | "nuxt"
19
+ typealias LintPreset = "general-recommended" | "general_recommended" | "generalRecommended" | "happy-path" | "happy_path" | "happy" | "default" | "recommended" | "opinionated" | "strict" | "all" | "essential" | "incremental" | "ecosystem" | "nuxt"
20
20
  typealias TemplateComponentNameCasing = "PascalCase" | "kebab-case"
21
21
  typealias CustomEventNameCasing = "camelCase" | "kebab-case"
22
22
  typealias HtmlSelfClosingStyle = "always" | "never" | "any"
@@ -24,7 +24,6 @@ typealias HyphenationStyle = "always" | "never"
24
24
  typealias TrailingComma = "all" | "none" | "es5"
25
25
  typealias FilterPattern = String | Listing<String>
26
26
  typealias GlobalTypeValue = String | GlobalTypeDeclaration
27
- typealias ConfigExtends = String | Listing<String>
28
27
  class CompilerCompatibilityConfig {
29
28
  vueVersion: ("3" | "2.7" | "2" | "1" | "0.11" | "0.10")? = null
30
29
  hostCompiler: Boolean? = null
@@ -253,6 +252,8 @@ class LspConfig {
253
252
  typecheck: Boolean? = null
254
253
  editor: Boolean? = null
255
254
  ecosystem: Boolean? = null
255
+ /// Enable workspace-wide cross-file diagnostic groups (disabled by default).
256
+ crossFile: Boolean? = null
256
257
  legacyVue2: Boolean? = null
257
258
  completion: Boolean? = null
258
259
  signatureHelp: Boolean? = null
@@ -318,7 +319,6 @@ class ConfigEntry {
318
319
  basePath: String? = null
319
320
  files: Listing<String>? = null
320
321
  ignores: Listing<String>? = null
321
- `extends`: ConfigExtends? = null
322
322
  compiler: CompilerConfig?
323
323
  experimentals: ExperimentalsConfig?
324
324
  vite: VitePluginConfig?
@@ -336,7 +336,6 @@ name: String? = null
336
336
  basePath: String? = null
337
337
  files: Listing<String>? = null
338
338
  ignores: Listing<String>? = null
339
- `extends`: ConfigExtends? = null
340
339
  compiler: CompilerConfig?
341
340
  experimentals: ExperimentalsConfig?
342
341
  vite: VitePluginConfig?
@@ -200,10 +200,26 @@
200
200
  "type": "boolean"
201
201
  },
202
202
  "preset": {
203
- "description": "Built-in lint preset",
203
+ "description": "Built-in lint preset (happy-path is the recommended canonical name; native aliases are accepted)",
204
204
  "default": "happy-path",
205
205
  "type": "string",
206
- "enum": ["happy-path", "opinionated", "essential", "incremental", "ecosystem", "nuxt"]
206
+ "enum": [
207
+ "general-recommended",
208
+ "general_recommended",
209
+ "generalRecommended",
210
+ "happy-path",
211
+ "happy_path",
212
+ "happy",
213
+ "default",
214
+ "recommended",
215
+ "opinionated",
216
+ "strict",
217
+ "all",
218
+ "essential",
219
+ "incremental",
220
+ "ecosystem",
221
+ "nuxt"
222
+ ]
207
223
  },
208
224
  "typeAware": {
209
225
  "description": "Enable native type-aware lint rules from the active lint configuration",
@@ -922,6 +938,10 @@
922
938
  "description": "Enable Vue ecosystem lint and editor helpers",
923
939
  "type": "boolean"
924
940
  },
941
+ "crossFile": {
942
+ "description": "Enable workspace-wide cross-file diagnostic groups (disabled by default)",
943
+ "type": "boolean"
944
+ },
925
945
  "legacyVue2": {
926
946
  "description": "Enable Vue 2.7 / Nuxt 2 editor and type-checking compatibility",
927
947
  "type": "boolean"
@@ -1234,20 +1254,6 @@
1234
1254
  "type": "string"
1235
1255
  }
1236
1256
  },
1237
- "extends": {
1238
- "description": "Base config files or presets to compose",
1239
- "oneOf": [
1240
- {
1241
- "type": "string"
1242
- },
1243
- {
1244
- "type": "array",
1245
- "items": {
1246
- "type": "string"
1247
- }
1248
- }
1249
- ]
1250
- },
1251
1257
  "dialect": {
1252
1258
  "description": "Vue dialect profile for standalone HTML documents; when absent the dialect is detected structurally per document",
1253
1259
  "type": "string",
@@ -1331,20 +1337,6 @@
1331
1337
  "type": "string"
1332
1338
  }
1333
1339
  },
1334
- "extends": {
1335
- "description": "Base config files or presets to compose",
1336
- "oneOf": [
1337
- {
1338
- "type": "string"
1339
- },
1340
- {
1341
- "type": "array",
1342
- "items": {
1343
- "type": "string"
1344
- }
1345
- }
1346
- ]
1347
- },
1348
1340
  "dialect": {
1349
1341
  "description": "Vue dialect profile for standalone HTML documents; when absent the dialect is detected structurally per document",
1350
1342
  "type": "string",
package/src/config.ts CHANGED
@@ -27,13 +27,10 @@ type NativeConfigHelpers = {
27
27
 
28
28
  const require = createRequire(import.meta.url);
29
29
 
30
- export const CONFIG_FILE_NAMES = [
31
- "vize.config.pkl",
32
- "vize.config.ts",
33
- "vize.config.js",
34
- "vize.config.mjs",
35
- "vize.config.json",
36
- ] as const;
30
+ export const CONFIG_FILE_NAMES = VITE_CONFIG_FILE_NAMES;
31
+ const RETIRED_CONFIG = /^vize\.config\.(?:pkl|[cm]?[jt]s|json)$/;
32
+ const CONFIG_MIGRATION =
33
+ "vize.config.* is no longer supported; move Vue settings to vue: in vite.config.* and TypeScript settings to tsconfig.json";
37
34
 
38
35
  const DEFAULT_CONFIG_ENV: ConfigEnv = {
39
36
  mode: "development",
@@ -68,7 +65,7 @@ export async function resolveViteConfigExport(
68
65
  }
69
66
 
70
67
  /**
71
- * Load project settings from a compatible dedicated config or `vite.config.*`.
68
+ * Load project settings from `vite.config.*`; TypeScript settings stay in tsconfig.json.
72
69
  */
73
70
  export async function loadConfig(
74
71
  root: string,
@@ -100,7 +97,7 @@ async function loadConfigFromDir(
100
97
  env?: ConfigEnv,
101
98
  viteConfig = true,
102
99
  ): Promise<ResolvedVizeConfig | null> {
103
- for (const name of [...CONFIG_FILE_NAMES, ...(viteConfig ? VITE_CONFIG_FILE_NAMES : [])]) {
100
+ for (const name of viteConfig ? CONFIG_FILE_NAMES : []) {
104
101
  const filePath = path.join(dir, name);
105
102
  if (!fs.existsSync(filePath)) {
106
103
  continue;
@@ -111,6 +108,13 @@ async function loadConfigFromDir(
111
108
  return config;
112
109
  }
113
110
  }
111
+ if (
112
+ viteConfig &&
113
+ fs.existsSync(dir) &&
114
+ fs.readdirSync(dir).some((name) => RETIRED_CONFIG.test(name))
115
+ ) {
116
+ throw new Error(CONFIG_MIGRATION);
117
+ }
114
118
  return null;
115
119
  }
116
120
 
@@ -148,6 +152,7 @@ async function loadConfigFile(
148
152
  env?: ConfigEnv,
149
153
  ): Promise<ResolvedVizeConfig | null> {
150
154
  const absolutePath = path.resolve(filePath);
155
+ if (RETIRED_CONFIG.test(path.basename(absolutePath))) throw new Error(CONFIG_MIGRATION);
151
156
  if (!fs.existsSync(absolutePath)) {
152
157
  return null;
153
158
  }
@@ -276,6 +281,18 @@ function parseJsonConfig(content: string, filePath: string): ResolvedVizeConfig
276
281
  }
277
282
 
278
283
  function normalizeLoadedConfig(config: unknown): ResolvedVizeConfig {
284
+ const hasExtends = (value: unknown) =>
285
+ value !== null && typeof value === "object" && Object.hasOwn(value, "extends");
286
+ const entries = Array.isArray(config)
287
+ ? config
288
+ : config && typeof config === "object" && "entries" in config
289
+ ? (config as { entries?: unknown }).entries
290
+ : undefined;
291
+ if (hasExtends(config) || (Array.isArray(entries) && entries.some(hasExtends))) {
292
+ throw new Error(
293
+ "Custom config extends is no longer supported; use defineConfig(vpConfig).withVue(vueConfig); standard tsconfig extends remains supported",
294
+ );
295
+ }
279
296
  const native = require("@vizejs/native") as NativeConfigHelpers;
280
297
  return native.normalizeVizeConfig(config ?? null) as ResolvedVizeConfig;
281
298
  }
@@ -19,8 +19,10 @@ export const NUXT_CONFIG_FILES = [
19
19
  export const VITE_CONFIG_FILES = [
20
20
  "vite.config.ts",
21
21
  "vite.config.mts",
22
+ "vite.config.cts",
22
23
  "vite.config.js",
23
24
  "vite.config.mjs",
25
+ "vite.config.cjs",
24
26
  ] as const;
25
27
 
26
28
  export type PackageManager = "pnpm" | "npm" | "yarn" | "bun";
@@ -21,7 +21,7 @@ const FEATURE_SCRIPTS: Readonly<Record<FeatureId, readonly string[]>> = {
21
21
  *
22
22
  * CLI tools use project settings and sensible defaults without a dedicated
23
23
  * config. Only typechecking needs a tsconfig scaffold; existing project and Vize
24
- * configs keep their exact contents.
24
+ * configs keep their exact contents; removed dedicated files are never rewritten.
25
25
  */
26
26
  export function planToolSettings(
27
27
  detection: ProjectDetection,
@@ -57,7 +57,7 @@ export function planToolSettings(
57
57
  detail:
58
58
  detection.vizeConfig === null
59
59
  ? detail
60
- : `${detail}; ${detection.vizeConfig} already exists and was left unchanged`,
60
+ : `${detail}; ${detection.vizeConfig} is no longer read; move settings to vue: in vite.config.*`,
61
61
  snippet: null,
62
62
  });
63
63
  }
@@ -21,9 +21,14 @@ export function renderDetection(detection: ProjectDetection): string {
21
21
  detection.tsconfig === null ? " (no tsconfig.json)" : " (tsconfig.json)"
22
22
  }`,
23
23
  ` lint command: ${detection.usesVitePlus ? "vp lint" : "oxlint"}`,
24
- ` vize config: ${detection.vizeConfig ?? "none"}`,
24
+ ` Vue settings: ${detection.viteConfigs.length > 0 ? "vue: in vite.config.*" : "defaults"}`,
25
25
  ` oxlint config: ${describeOxlintConfig(detection)}`,
26
26
  ];
27
+ if (detection.vizeConfig !== null) {
28
+ lines.push(
29
+ ` removed config: ${detection.vizeConfig} (not read; migrate to vue: in vite.config.*)`,
30
+ );
31
+ }
27
32
  return `${lines.join("\n")}\n`;
28
33
  }
29
34
 
@@ -114,7 +114,7 @@ function bundlerOffer(detection: ProjectDetection): FeatureOffer {
114
114
  }
115
115
 
116
116
  function fmtOffer(detection: ProjectDetection): FeatureOffer {
117
- const configured = detection.vizeConfig !== null && "vize:fmt" in detection.scripts;
117
+ const configured = "vize:fmt" in detection.scripts;
118
118
  return {
119
119
  id: "fmt",
120
120
  label: "fmt (vize fmt)",
@@ -126,10 +126,7 @@ function fmtOffer(detection: ProjectDetection): FeatureOffer {
126
126
  }
127
127
 
128
128
  function typecheckOffer(detection: ProjectDetection): FeatureOffer {
129
- const configured =
130
- detection.tsconfig !== null &&
131
- detection.vizeConfig !== null &&
132
- "vize:check" in detection.scripts;
129
+ const configured = detection.tsconfig !== null && "vize:check" in detection.scripts;
133
130
  return {
134
131
  id: "typecheck",
135
132
  label: "typecheck (vize check)",
package/src/init.ts CHANGED
@@ -2,7 +2,7 @@ import { execFileSync } from "node:child_process";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
 
5
- import { atomicWriteFile } from "./setup/config.js";
5
+ import { atomicWriteFile, requireSharedConfig } from "./setup/config.js";
6
6
  import { initHelp, parseInitArgs, type InitArgs } from "./init/args.js";
7
7
  import { detectProject, withFramework, type ProjectDetection } from "./init/detect.js";
8
8
  import { planInit, type InitCommand, type InitPlan } from "./init/plan.js";
@@ -102,6 +102,7 @@ export async function initProject(options: InitOptions): Promise<InitPlan | null
102
102
  const root = path.resolve(args.root ?? options.root);
103
103
  const detection = withFramework(detectProject(root), args.bundlerOverride);
104
104
  output(renderDetection(detection));
105
+ requireSharedConfig(root, detection.viteConfigs);
105
106
 
106
107
  const selection = await resolveSelection(detection, args, {
107
108
  output,
@@ -4,8 +4,11 @@ import path from "node:path";
4
4
  export const VIZE_CONFIG_FILES = [
5
5
  "vize.config.pkl",
6
6
  "vize.config.ts",
7
+ "vize.config.mts",
8
+ "vize.config.cts",
7
9
  "vize.config.js",
8
10
  "vize.config.mjs",
11
+ "vize.config.cjs",
9
12
  "vize.config.json",
10
13
  ] as const;
11
14
 
@@ -179,3 +182,14 @@ function isJsonObject(value: unknown): value is JsonObject {
179
182
  function isNodeError(value: unknown): value is NodeJS.ErrnoException {
180
183
  return value instanceof Error;
181
184
  }
185
+
186
+ /** Preserve removed config files, but do not present an unusable project as ready. */
187
+ export function requireSharedConfig(root: string, viteConfigs: readonly string[]): void {
188
+ const dedicated = VIZE_CONFIG_FILES.find((name) => fs.existsSync(path.join(root, name)));
189
+ if (dedicated !== undefined && viteConfigs.length === 0) {
190
+ throw new Error(
191
+ `${dedicated} is no longer supported; move Vue settings to vue: in vite.config.* ` +
192
+ "and TypeScript settings to tsconfig.json (vueCompilerOptions). The existing file was left unchanged.",
193
+ );
194
+ }
195
+ }
package/src/setup/vite.ts CHANGED
@@ -6,8 +6,10 @@ import type { PlannedFile } from "./config.js";
6
6
  const VITE_CONFIG_FILES = [
7
7
  "vite.config.ts",
8
8
  "vite.config.mts",
9
+ "vite.config.cts",
9
10
  "vite.config.js",
10
11
  "vite.config.mjs",
12
+ "vite.config.cjs",
11
13
  ] as const;
12
14
 
13
15
  const VITE_PLUS_LINT_IMPORT = 'import { createVizeLintConfig } from "oxlint-plugin-vize";\n';
package/src/setup.ts CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  planGeneratedConfig,
16
16
  readRequiredFile,
17
17
  REQUIRED_DEV_DEPENDENCIES,
18
+ requireSharedConfig,
18
19
  VIZE_CONFIG_FILES,
19
20
  type PlannedFile,
20
21
  } from "./setup/config.js";
@@ -36,6 +37,7 @@ export interface SetupResult {
36
37
  readonly enabledVitePlusLint: boolean;
37
38
  readonly installCommand: SetupCommand | null;
38
39
  readonly removeCommand: SetupCommand | null;
40
+ readonly migrationWarnings: readonly string[];
39
41
  }
40
42
 
41
43
  export interface SetupOptions {
@@ -60,9 +62,14 @@ export function setupProject(options: SetupOptions): SetupResult {
60
62
  const preservedFiles: string[] = [];
61
63
  const plannedFiles: PlannedFile[] = [];
62
64
  const detection = detectProject(root);
65
+ requireSharedConfig(root, detection.viteConfigs);
66
+ const migrationWarnings: string[] = [];
63
67
  for (const filename of VIZE_CONFIG_FILES) {
64
68
  if (fs.existsSync(path.join(root, filename))) {
65
69
  preservedFiles.push(filename);
70
+ migrationWarnings.push(
71
+ `${filename} is no longer read; keep Vue settings in vue: in vite.config.*`,
72
+ );
66
73
  }
67
74
  }
68
75
  planGeneratedConfig(
@@ -145,6 +152,7 @@ export function setupProject(options: SetupOptions): SetupResult {
145
152
 
146
153
  return {
147
154
  root,
155
+ migrationWarnings,
148
156
  createdFiles,
149
157
  preservedFiles,
150
158
  addedScripts,
@@ -201,6 +209,9 @@ Options:
201
209
 
202
210
  function printSetupResult(result: SetupResult, install: boolean): void {
203
211
  let dependenciesMissing = false;
212
+ for (const warning of result.migrationWarnings) {
213
+ process.stdout.write(`[vize setup] ${warning}\n`);
214
+ }
204
215
  for (const filename of result.createdFiles) {
205
216
  process.stdout.write(`[vize setup] created ${filename}\n`);
206
217
  }
@@ -5,13 +5,7 @@
5
5
  * and run json-schema-to-typescript to regenerate this file.
6
6
  */
7
7
 
8
- export type LintPreset =
9
- | "happy-path"
10
- | "opinionated"
11
- | "essential"
12
- | "incremental"
13
- | "ecosystem"
14
- | "nuxt";
8
+ export type LintPreset = NonNullable<LinterConfig["preset"]>;
15
9
 
16
10
  export type RuleSeverity = "off" | "warn" | "error";
17
11
 
@@ -42,10 +36,6 @@ export interface VizeConfig {
42
36
  * Glob patterns this config excludes
43
37
  */
44
38
  ignores?: string[];
45
- /**
46
- * Base config files or presets to compose
47
- */
48
- extends?: string | string[];
49
39
  /**
50
40
  * Vue dialect profile for standalone HTML documents; when absent the dialect is detected structurally per document
51
41
  */
@@ -200,9 +190,24 @@ export interface LinterConfig {
200
190
  */
201
191
  enabled?: boolean;
202
192
  /**
203
- * Built-in lint preset
204
- */
205
- preset?: "happy-path" | "opinionated" | "essential" | "incremental" | "ecosystem" | "nuxt";
193
+ * Built-in lint preset (happy-path is the recommended canonical name; native aliases are accepted)
194
+ */
195
+ preset?:
196
+ | "general-recommended"
197
+ | "general_recommended"
198
+ | "generalRecommended"
199
+ | "happy-path"
200
+ | "happy_path"
201
+ | "happy"
202
+ | "default"
203
+ | "recommended"
204
+ | "opinionated"
205
+ | "strict"
206
+ | "all"
207
+ | "essential"
208
+ | "incremental"
209
+ | "ecosystem"
210
+ | "nuxt";
206
211
  /**
207
212
  * Enable native type-aware lint rules from the active lint configuration
208
213
  */
@@ -551,6 +556,10 @@ export interface LanguageServerConfig {
551
556
  * Enable Vue ecosystem lint and editor helpers
552
557
  */
553
558
  ecosystem?: boolean;
559
+ /**
560
+ * Enable workspace-wide cross-file diagnostic groups (disabled by default)
561
+ */
562
+ crossFile?: boolean;
554
563
  /**
555
564
  * Enable Vue 2.7 / Nuxt 2 editor and type-checking compatibility
556
565
  */
@@ -792,10 +801,6 @@ export interface VizeConfigEntry {
792
801
  * Glob patterns this entry excludes
793
802
  */
794
803
  ignores?: string[];
795
- /**
796
- * Base config files or presets to compose
797
- */
798
- extends?: string | string[];
799
804
  /**
800
805
  * Vue dialect profile for standalone HTML documents; when absent the dialect is detected structurally per document
801
806
  */
@@ -22,7 +22,12 @@ export type VueConfig = {
22
22
 
23
23
  /** Native Vue settings shared by Vite, Vite+, the CLI projection and the editor. */
24
24
  type VueOptionKeys =
25
+ | "name"
25
26
  | "compiler"
27
+ | "experimentals"
28
+ | "dialect"
29
+ | "vite"
30
+ | "musea"
26
31
  | "typeChecker"
27
32
  | "linter"
28
33
  | "formatter"
@@ -33,7 +38,7 @@ type VueOptionKeys =
33
38
  | "basePath"
34
39
  | "lib";
35
40
 
36
- /** Scoped policy currently supported by the native configuration model. */
41
+ /** Native scopes retain the same authored options inside the Vue namespace. */
37
42
  export type VueOptionsEntry = Pick<VizeConfigEntry, "basePath" | "files" | "ignores" | "linter">;
38
43
 
39
44
  /** Section option values reuse the native types rather than a second schema. */