vize 0.471.0 → 0.475.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 +49 -32
- package/dist/cli.mjs +34 -11
- package/dist/cli.mjs.map +1 -1
- package/dist/config-BnQMtsWA.mjs +766 -0
- package/dist/config-BnQMtsWA.mjs.map +1 -0
- package/dist/{config-DIyA9raO.d.mts → config-DkTqtxYs.d.mts} +12 -16
- package/dist/config-DkTqtxYs.d.mts.map +1 -0
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +65 -65
- package/pkl/LanguageServerConfig.pkl +6 -0
- package/pkl/LinterConfig.pkl +1 -1
- package/pkl/VizeConfig.pkl +0 -8
- package/pkl/jsonschema/LinterSchemaDefinitions.pkl +2 -2
- package/pkl/jsonschema/generate.pkl +4 -9
- package/pkl/vize.pkl +3 -4
- package/schemas/vize.config.schema.json +22 -30
- package/src/config.ts +26 -9
- package/src/init/detect.ts +2 -0
- package/src/init/plan-project.ts +2 -2
- package/src/init/report.ts +6 -1
- package/src/init/select.ts +2 -5
- package/src/init.ts +2 -1
- package/src/setup/config.ts +14 -0
- package/src/setup/vite.ts +2 -0
- package/src/setup.ts +11 -0
- package/src/types/generated.ts +23 -18
- package/src/types/runtime.ts +6 -1
- package/dist/config-C5DKms5s.mjs +0 -517
- package/dist/config-C5DKms5s.mjs.map +0 -1
- package/dist/config-DIyA9raO.d.mts.map +0 -1
package/README.md
CHANGED
|
@@ -26,15 +26,18 @@ vp dlx vize setup
|
|
|
26
26
|
The command:
|
|
27
27
|
|
|
28
28
|
- installs `vize`, the Vite and Musea plugins, Oxlint, and `oxlint-plugin-vize`;
|
|
29
|
-
-
|
|
30
|
-
|
|
29
|
+
- keeps Vue settings in the existing `vite.config.*`, creates `tsconfig.json` when absent,
|
|
30
|
+
and creates `oxlint.config.ts` for plain Vite projects when needed;
|
|
31
31
|
- enables the Vize Oxlint preset in the `lint` block of a standard Vite+ config, so `vp lint`
|
|
32
32
|
checks Vue files;
|
|
33
33
|
- adds non-conflicting `vize:*` package scripts for build, format, lint, check, Musea, and `ready`;
|
|
34
34
|
- replaces a canonical zero-option `@vitejs/plugin-vue` import with `@vizejs/vite-plugin`, then
|
|
35
35
|
removes the old dependency.
|
|
36
36
|
|
|
37
|
-
Setup is idempotent. It preserves existing config files and package scripts
|
|
37
|
+
Setup is idempotent. It preserves existing config files and package scripts. Dedicated
|
|
38
|
+
`vize.config.*` files are retired: setup leaves them unchanged and reports the migration to
|
|
39
|
+
`vue:` in `vite.config.*` and `vueCompilerOptions` in `tsconfig.json`. A dedicated-only project
|
|
40
|
+
must migrate before setup can complete. Setup leaves custom
|
|
38
41
|
Vite plugin calls such as `vue({ ... })` unchanged because those options need a deliberate
|
|
39
42
|
migration. Use `vize setup --no-install` to generate the files and scripts without changing
|
|
40
43
|
dependencies.
|
|
@@ -95,22 +98,17 @@ For one-off local debugging, the installed binary is also available through npm
|
|
|
95
98
|
vp exec vize lint --preset essential src
|
|
96
99
|
```
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
- `vize.config.ts`
|
|
102
|
-
- `vize.config.js`
|
|
103
|
-
- `vize.config.mjs`
|
|
104
|
-
- `vize.config.json`
|
|
105
|
-
|
|
106
|
-
Pkl config files require either `@pkl-community/pkl` installed in the project or a `pkl` binary on
|
|
107
|
-
`PATH`. The Pkl runtime is optional so packages that only consume Vize through framework plugins do
|
|
108
|
-
not install it by default.
|
|
101
|
+
The npm commands read the selected project's `vite.config.ts`, `.mts`, `.cts`,
|
|
102
|
+
`.js`, `.mjs` or `.cjs`. Put native Vue settings in `vue:`. With Vite+, keep your
|
|
103
|
+
existing configuration and add native settings through the fluent helper:
|
|
109
104
|
|
|
110
105
|
```ts
|
|
111
|
-
|
|
106
|
+
// vite.config.ts
|
|
107
|
+
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
|
|
108
|
+
|
|
109
|
+
const vpConfig = { server: { port: 3000 } };
|
|
112
110
|
|
|
113
|
-
export default defineConfig({
|
|
111
|
+
export default defineConfig(vpConfig).withVue({
|
|
114
112
|
compiler: {
|
|
115
113
|
sourceMap: true,
|
|
116
114
|
vapor: false,
|
|
@@ -126,22 +124,38 @@ export default defineConfig({
|
|
|
126
124
|
strictSlotChildren: false,
|
|
127
125
|
serverScript: false,
|
|
128
126
|
},
|
|
129
|
-
vite: {
|
|
130
|
-
|
|
131
|
-
},
|
|
132
|
-
linter: {
|
|
133
|
-
preset: "opinionated",
|
|
134
|
-
},
|
|
127
|
+
vite: { scanPatterns: ["src/**/*.vue"] },
|
|
128
|
+
linter: { preset: "opinionated" },
|
|
135
129
|
typeChecker: {
|
|
136
130
|
enabled: true,
|
|
137
|
-
strict: true,
|
|
138
131
|
// Large cold LSP projects can raise the default 60-second Corsa request bound.
|
|
139
132
|
lspRequestTimeoutMs: 90000,
|
|
140
133
|
},
|
|
141
134
|
});
|
|
142
135
|
```
|
|
143
136
|
|
|
144
|
-
|
|
137
|
+
For ordinary Vite, use `defineConfig` from `vite`, keep `plugins: [vize()]`, and
|
|
138
|
+
place the same native settings in `vue: { ... }`.
|
|
139
|
+
|
|
140
|
+
Keep TypeScript strictness and Vue template options in `tsconfig.json`:
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"compilerOptions": { "strict": true, "noEmit": true },
|
|
145
|
+
"vueCompilerOptions": { "strictTemplates": true },
|
|
146
|
+
"include": ["src/**/*"]
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Standard TypeScript `extends` and project `references` remain supported. There is
|
|
151
|
+
no Vize-specific config `extends`; import ordinary JavaScript settings and pass
|
|
152
|
+
them to `defineConfig(vpConfig).withVue(vueConfig)` instead.
|
|
153
|
+
|
|
154
|
+
Dedicated `vize.config.*` files and top-level `vize:` are no longer supported.
|
|
155
|
+
A stale dedicated file beside a Vite config is ignored; a dedicated-only project
|
|
156
|
+
receives a migration error. Override Vite configuration selection with `--config`,
|
|
157
|
+
select a TypeScript project with `--tsconfig`, or disable shared Vue config with
|
|
158
|
+
`--no-config`. CLI, Vite integration and editor use the same project settings.
|
|
145
159
|
|
|
146
160
|
## Static Analysis
|
|
147
161
|
|
|
@@ -304,18 +318,21 @@ tool coverage, and upstream RFC links.
|
|
|
304
318
|
|
|
305
319
|
## Programmatic Config Helpers
|
|
306
320
|
|
|
307
|
-
|
|
308
|
-
|
|
321
|
+
Use the Vite+ helper shown above to define `vite.config.ts`. A separate script
|
|
322
|
+
can read its normalized native settings without defining another config file:
|
|
309
323
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
},
|
|
314
|
-
});
|
|
324
|
+
```ts
|
|
325
|
+
// scripts/read-vue-settings.ts
|
|
326
|
+
import { loadConfig } from "vize/config";
|
|
315
327
|
|
|
316
|
-
const config = await loadConfig(process.cwd());
|
|
328
|
+
const config = await loadConfig(process.cwd(), { mode: "auto" });
|
|
329
|
+
console.log(config?.linter.preset);
|
|
317
330
|
```
|
|
318
331
|
|
|
332
|
+
The `defineConfig` export from `vize` only types a native options payload for API
|
|
333
|
+
callers; it is distinct from the Vite+ composition helper. Do not use it to create
|
|
334
|
+
a dedicated configuration file.
|
|
335
|
+
|
|
319
336
|
## Related Packages
|
|
320
337
|
|
|
321
338
|
- `@vizejs/vite-plugin`
|
package/dist/cli.mjs
CHANGED
|
@@ -75,8 +75,11 @@ function readManifest(filename) {
|
|
|
75
75
|
const VIZE_CONFIG_FILES = [
|
|
76
76
|
"vize.config.pkl",
|
|
77
77
|
"vize.config.ts",
|
|
78
|
+
"vize.config.mts",
|
|
79
|
+
"vize.config.cts",
|
|
78
80
|
"vize.config.js",
|
|
79
81
|
"vize.config.mjs",
|
|
82
|
+
"vize.config.cjs",
|
|
80
83
|
"vize.config.json"
|
|
81
84
|
];
|
|
82
85
|
/** Config filenames Oxlint 1.64 auto-discovers. */
|
|
@@ -212,6 +215,11 @@ function isJsonObject(value) {
|
|
|
212
215
|
function isNodeError(value) {
|
|
213
216
|
return value instanceof Error;
|
|
214
217
|
}
|
|
218
|
+
/** Preserve removed config files, but do not present an unusable project as ready. */
|
|
219
|
+
function requireSharedConfig(root, viteConfigs) {
|
|
220
|
+
const dedicated = VIZE_CONFIG_FILES.find((name) => fs.existsSync(path.join(root, name)));
|
|
221
|
+
if (dedicated !== void 0 && viteConfigs.length === 0) throw new Error(`${dedicated} is no longer supported; move Vue settings to vue: in vite.config.* and TypeScript settings to tsconfig.json (vueCompilerOptions). The existing file was left unchanged.`);
|
|
222
|
+
}
|
|
215
223
|
//#endregion
|
|
216
224
|
//#region src/init/templates.ts
|
|
217
225
|
/**
|
|
@@ -756,7 +764,7 @@ function bundlerOffer(detection) {
|
|
|
756
764
|
};
|
|
757
765
|
}
|
|
758
766
|
function fmtOffer(detection) {
|
|
759
|
-
const configured =
|
|
767
|
+
const configured = "vize:fmt" in detection.scripts;
|
|
760
768
|
return {
|
|
761
769
|
id: "fmt",
|
|
762
770
|
label: "fmt (vize fmt)",
|
|
@@ -767,7 +775,7 @@ function fmtOffer(detection) {
|
|
|
767
775
|
};
|
|
768
776
|
}
|
|
769
777
|
function typecheckOffer(detection) {
|
|
770
|
-
const configured = detection.tsconfig !== null &&
|
|
778
|
+
const configured = detection.tsconfig !== null && "vize:check" in detection.scripts;
|
|
771
779
|
return {
|
|
772
780
|
id: "typecheck",
|
|
773
781
|
label: "typecheck (vize check)",
|
|
@@ -920,8 +928,10 @@ const NUXT_CONFIG_FILES = [
|
|
|
920
928
|
const VITE_CONFIG_FILES$1 = [
|
|
921
929
|
"vite.config.ts",
|
|
922
930
|
"vite.config.mts",
|
|
931
|
+
"vite.config.cts",
|
|
923
932
|
"vite.config.js",
|
|
924
|
-
"vite.config.mjs"
|
|
933
|
+
"vite.config.mjs",
|
|
934
|
+
"vite.config.cjs"
|
|
925
935
|
];
|
|
926
936
|
/**
|
|
927
937
|
* Package-manager detection.
|
|
@@ -1326,7 +1336,7 @@ const FEATURE_SCRIPTS = {
|
|
|
1326
1336
|
*
|
|
1327
1337
|
* CLI tools use project settings and sensible defaults without a dedicated
|
|
1328
1338
|
* config. Only typechecking needs a tsconfig scaffold; existing project and Vize
|
|
1329
|
-
* configs keep their exact contents.
|
|
1339
|
+
* configs keep their exact contents; removed dedicated files are never rewritten.
|
|
1330
1340
|
*/
|
|
1331
1341
|
function planToolSettings(detection, selection, draft) {
|
|
1332
1342
|
if (selection.typecheck && detection.tsconfig === null) {
|
|
@@ -1347,7 +1357,7 @@ function planToolSettings(detection, selection, draft) {
|
|
|
1347
1357
|
draft.features.push({
|
|
1348
1358
|
id,
|
|
1349
1359
|
outcome: scaffoldsTsconfig || addsScripts ? "configured" : "unchanged",
|
|
1350
|
-
detail: detection.vizeConfig === null ? detail : `${detail}; ${detection.vizeConfig}
|
|
1360
|
+
detail: detection.vizeConfig === null ? detail : `${detail}; ${detection.vizeConfig} is no longer read; move settings to vue: in vite.config.*`,
|
|
1351
1361
|
snippet: null
|
|
1352
1362
|
});
|
|
1353
1363
|
}
|
|
@@ -1616,15 +1626,17 @@ const PREFIX = "[vize init]";
|
|
|
1616
1626
|
* missing lockfile.
|
|
1617
1627
|
*/
|
|
1618
1628
|
function renderDetection(detection) {
|
|
1619
|
-
|
|
1629
|
+
const lines = [
|
|
1620
1630
|
`${PREFIX} detected in ${detection.root}:`,
|
|
1621
1631
|
` framework: ${describeFramework(detection)}`,
|
|
1622
1632
|
` package manager: ${detection.packageManager ?? "none detected (defaulting to npm)"}`,
|
|
1623
1633
|
` language: ${detection.typescript ? "TypeScript" : "JavaScript"}${detection.tsconfig === null ? " (no tsconfig.json)" : " (tsconfig.json)"}`,
|
|
1624
1634
|
` lint command: ${detection.usesVitePlus ? "vp lint" : "oxlint"}`,
|
|
1625
|
-
`
|
|
1635
|
+
` Vue settings: ${detection.viteConfigs.length > 0 ? "vue: in vite.config.*" : "defaults"}`,
|
|
1626
1636
|
` oxlint config: ${describeOxlintConfig(detection)}`
|
|
1627
|
-
]
|
|
1637
|
+
];
|
|
1638
|
+
if (detection.vizeConfig !== null) lines.push(` removed config: ${detection.vizeConfig} (not read; migrate to vue: in vite.config.*)`);
|
|
1639
|
+
return `${lines.join("\n")}\n`;
|
|
1628
1640
|
}
|
|
1629
1641
|
function describeFramework(detection) {
|
|
1630
1642
|
if (detection.framework === "nuxt") return `Nuxt (${detection.nuxtConfig ?? "nuxt dependency, no nuxt.config"})`;
|
|
@@ -1738,8 +1750,10 @@ async function resolveSelection(detection, args, deps) {
|
|
|
1738
1750
|
async function initProject(options) {
|
|
1739
1751
|
const args = parseInitArgs(options.args ?? []);
|
|
1740
1752
|
const output = options.output ?? ((chunk) => process.stdout.write(chunk));
|
|
1741
|
-
const
|
|
1753
|
+
const root = path.resolve(args.root ?? options.root);
|
|
1754
|
+
const detection = withFramework(detectProject(root), args.bundlerOverride);
|
|
1742
1755
|
output(renderDetection(detection));
|
|
1756
|
+
requireSharedConfig(root, detection.viteConfigs);
|
|
1743
1757
|
const selection = await resolveSelection(detection, args, {
|
|
1744
1758
|
output,
|
|
1745
1759
|
stdin: options.stdin ?? process.stdin,
|
|
@@ -1810,8 +1824,10 @@ function runInitCommand(command) {
|
|
|
1810
1824
|
const VITE_CONFIG_FILES = [
|
|
1811
1825
|
"vite.config.ts",
|
|
1812
1826
|
"vite.config.mts",
|
|
1827
|
+
"vite.config.cts",
|
|
1813
1828
|
"vite.config.js",
|
|
1814
|
-
"vite.config.mjs"
|
|
1829
|
+
"vite.config.mjs",
|
|
1830
|
+
"vite.config.cjs"
|
|
1815
1831
|
];
|
|
1816
1832
|
const VITE_PLUS_LINT_IMPORT = "import { createVizeLintConfig } from \"oxlint-plugin-vize\";\n";
|
|
1817
1833
|
const VITE_PLUS_LINT_BLOCK = ` lint: createVizeLintConfig({
|
|
@@ -1911,7 +1927,12 @@ function setupProject(options) {
|
|
|
1911
1927
|
const preservedFiles = [];
|
|
1912
1928
|
const plannedFiles = [];
|
|
1913
1929
|
const detection = detectProject(root);
|
|
1914
|
-
|
|
1930
|
+
requireSharedConfig(root, detection.viteConfigs);
|
|
1931
|
+
const migrationWarnings = [];
|
|
1932
|
+
for (const filename of VIZE_CONFIG_FILES) if (fs.existsSync(path.join(root, filename))) {
|
|
1933
|
+
preservedFiles.push(filename);
|
|
1934
|
+
migrationWarnings.push(`${filename} is no longer read; keep Vue settings in vue: in vite.config.*`);
|
|
1935
|
+
}
|
|
1915
1936
|
planGeneratedConfig(root, ["tsconfig.json"], "tsconfig.json", renderTypecheckTsconfig(detection.typescript, detection.framework === "nuxt" ? detection.nuxtMajor : void 0), plannedFiles, createdFiles, preservedFiles);
|
|
1916
1937
|
const existingOxlintConfig = DISCOVERED_OXLINT_CONFIG_FILES.find((candidate) => fs.existsSync(path.join(root, candidate)));
|
|
1917
1938
|
const viteMigration = planViteMigration(root, existingOxlintConfig === void 0);
|
|
@@ -1951,6 +1972,7 @@ function setupProject(options) {
|
|
|
1951
1972
|
}
|
|
1952
1973
|
return {
|
|
1953
1974
|
root,
|
|
1975
|
+
migrationWarnings,
|
|
1954
1976
|
createdFiles,
|
|
1955
1977
|
preservedFiles,
|
|
1956
1978
|
addedScripts,
|
|
@@ -1997,6 +2019,7 @@ Options:
|
|
|
1997
2019
|
}
|
|
1998
2020
|
function printSetupResult(result, install) {
|
|
1999
2021
|
let dependenciesMissing = false;
|
|
2022
|
+
for (const warning of result.migrationWarnings) process.stdout.write(`[vize setup] ${warning}\n`);
|
|
2000
2023
|
for (const filename of result.createdFiles) process.stdout.write(`[vize setup] created ${filename}\n`);
|
|
2001
2024
|
if (result.migratedViteConfig) process.stdout.write(`[vize setup] migrated ${result.migratedViteConfig} to @vizejs/vite-plugin\n`);
|
|
2002
2025
|
if (result.enabledVitePlusLint) process.stdout.write("[vize setup] enabled oxlint-plugin-vize for vp lint\n");
|