@vizejs/vite-plugin 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/README.md +46 -63
- package/dist/config-DE1fZbgD.mjs +234 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +3 -3
- package/dist/internal/config-bridge.d.mts +1 -1
- package/dist/internal/vite-plus-task.mjs +1 -1
- package/dist/{plugin-CsZ0RKny.mjs → plugin-DtrTTtew.mjs} +96 -2
- package/dist/plugin-VGQR_WGT.mjs +2 -0
- package/dist/{runner-Y2Iuaafy.mjs → runner-B_lRJlux.mjs} +4 -4
- package/dist/{types-B3cTltTi.d.mts → types-kbMQcMYf.d.mts} +9 -13
- package/dist/vite-plus.d.mts +25 -12
- package/dist/vite-plus.mjs +41 -94
- package/dist/vue-version-BUu5UzZ5.mjs +75 -0
- package/dist/vue-version-DGtIj1Bv.mjs +2 -0
- package/package.json +4 -4
- package/dist/config-DNse8RdN.mjs +0 -260
- package/dist/plugin-Cmv6xcTJ.mjs +0 -2
- package/dist/shared-config-DZHugBg2.mjs +0 -179
package/README.md
CHANGED
|
@@ -30,11 +30,14 @@ Install the `vite-plus` version your project uses, then configure the whole tool
|
|
|
30
30
|
// vite.config.ts
|
|
31
31
|
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
const vpConfig = {
|
|
34
|
+
server: { port: 3000 },
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default defineConfig(vpConfig).withVue({
|
|
34
38
|
compiler: { sourceMap: true },
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
fmt: { vize: { singleQuote: true } },
|
|
39
|
+
linter: { preset: "essential" },
|
|
40
|
+
formatter: { singleQuote: true },
|
|
38
41
|
});
|
|
39
42
|
```
|
|
40
43
|
|
|
@@ -42,9 +45,12 @@ Run `vp run check`, `lint`, `fmt`, `build`, or `pack` without registering anothe
|
|
|
42
45
|
plugin or writing CLI scripts. Native lint runs alongside Oxlint; overlapping
|
|
43
46
|
rules and Vue formatting ownership are configured automatically.
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
`
|
|
48
|
+
Keep shared native settings in `vue:` using `.withVue(vueConfig)`. Import ordinary
|
|
49
|
+
JavaScript objects to reuse settings; custom config `extends` is no longer supported.
|
|
50
|
+
Use `pack.vue` for native declarations, declaration maps, and compiler maps.
|
|
51
|
+
The standalone `withVue(vueConfig, vpConfig)` helper remains available; it is not
|
|
52
|
+
an alias of `defineConfig(vpConfig)`. `withVize` is a compatibility name for the
|
|
53
|
+
config-first helper. Prefer the fluent API for new configuration.
|
|
48
54
|
|
|
49
55
|
Vite+ remains a user-selected optional peer (0.2.3 or later); configuration types
|
|
50
56
|
come from that peer. Ordinary Vite users do not need to install it. Built-in
|
|
@@ -100,86 +106,63 @@ For Vite Plus projects, keep `vite-plus/client` and append `@vizejs/vite-plugin`
|
|
|
100
106
|
|
|
101
107
|
### Shared config
|
|
102
108
|
|
|
103
|
-
`
|
|
109
|
+
Put native Vue options in `vue:` in the existing Vite configuration. The CLI,
|
|
110
|
+
plugin and editor read the same project settings:
|
|
104
111
|
|
|
105
112
|
```ts
|
|
106
|
-
|
|
113
|
+
// vite.config.ts
|
|
114
|
+
import { defineConfig } from "vite";
|
|
115
|
+
import vize from "@vizejs/vite-plugin";
|
|
107
116
|
|
|
108
117
|
export default defineConfig({
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
118
|
+
plugins: [vize()],
|
|
119
|
+
vue: {
|
|
120
|
+
compiler: { sourceMap: true },
|
|
121
|
+
vite: { scanPatterns: ["src/**/*.vue"] },
|
|
122
|
+
linter: { preset: "essential" },
|
|
114
123
|
},
|
|
115
124
|
});
|
|
116
125
|
```
|
|
117
126
|
|
|
118
|
-
`
|
|
119
|
-
|
|
120
|
-
```pkl
|
|
121
|
-
amends "node_modules/vize/pkl/vize.pkl"
|
|
127
|
+
Keep TypeScript options in `tsconfig.json`, including `vueCompilerOptions`:
|
|
122
128
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
scanPatterns = new Listing {
|
|
129
|
-
"src/**/*.vue"
|
|
130
|
-
}
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"compilerOptions": { "strict": true, "noEmit": true },
|
|
132
|
+
"vueCompilerOptions": { "strictTemplates": true },
|
|
133
|
+
"include": ["src/**/*"]
|
|
131
134
|
}
|
|
132
135
|
```
|
|
133
136
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
### Nuxt
|
|
137
|
+
Standard TypeScript `extends` and `references` remain supported. The CLI and
|
|
138
|
+
language server use the selected project's Vite configuration and TypeScript
|
|
139
|
+
project, including nested packages in a workspace. Explicit plugin options and
|
|
140
|
+
editor feature switches retain their documented precedence.
|
|
140
141
|
|
|
141
|
-
|
|
142
|
+
Dedicated `vize.config.*` files and top-level `vize:` settings are retired. Move
|
|
143
|
+
native settings to `vue:` and TypeScript settings to `tsconfig.json`. A stale
|
|
144
|
+
dedicated file beside a Vite configuration is ignored; a dedicated-only project
|
|
145
|
+
receives a migration error. See the [configuration guide](../../../docs/content/guide/configuration.md).
|
|
142
146
|
|
|
143
|
-
|
|
144
|
-
// nuxt.config.ts
|
|
145
|
-
import vize from "@vizejs/vite-plugin";
|
|
147
|
+
### Nuxt
|
|
146
148
|
|
|
147
|
-
|
|
148
|
-
vite: {
|
|
149
|
-
plugins: [
|
|
150
|
-
vize({
|
|
151
|
-
// Exclude Nuxt's internal .vue files if needed
|
|
152
|
-
exclude: [/node_modules/, /#/, /\.nuxt/],
|
|
153
|
-
}),
|
|
154
|
-
],
|
|
155
|
-
},
|
|
149
|
+
Use the framework module so Nuxt keeps control of its own Vue configuration:
|
|
156
150
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
propsDestructure: false,
|
|
160
|
-
},
|
|
161
|
-
});
|
|
151
|
+
```bash
|
|
152
|
+
vp install -D @vizejs/nuxt
|
|
162
153
|
```
|
|
163
154
|
|
|
164
|
-
**Note**: When using with Nuxt, you may need to disable Nuxt's built-in Vue plugin to avoid conflicts:
|
|
165
|
-
|
|
166
155
|
```ts
|
|
167
156
|
// nuxt.config.ts
|
|
168
157
|
export default defineNuxtConfig({
|
|
169
|
-
|
|
170
|
-
"vite:extendConfig": (config) => {
|
|
171
|
-
// Remove @vitejs/plugin-vue from plugins
|
|
172
|
-
config.plugins = config.plugins?.filter(
|
|
173
|
-
(p) => p && (Array.isArray(p) ? p[0] : p).name !== "vite:vue",
|
|
174
|
-
);
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
vite: {
|
|
178
|
-
plugins: [vize()],
|
|
179
|
-
},
|
|
158
|
+
modules: ["@vizejs/nuxt"],
|
|
180
159
|
});
|
|
181
160
|
```
|
|
182
161
|
|
|
162
|
+
The module installs the compiler integration and handles the existing Nuxt Vue
|
|
163
|
+
plugin. See the [Nuxt integration guide](../../../docs/content/integrations/nuxt.md)
|
|
164
|
+
for module options and project setup.
|
|
165
|
+
|
|
183
166
|
## Options
|
|
184
167
|
|
|
185
168
|
```ts
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
//#region ../../../crates/vize_carton/src/config/loader/vite-runtime.mjs
|
|
4
|
+
const vueOptionSchema = JSON.parse("{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"compiler\":{\"$ref\":\"#/definitions/CompilerConfig\"},\"experimentals\":{\"type\":\"object\",\"additionalProperties\":{\"oneOf\":[{\"type\":\"boolean\"},{\"type\":\"object\",\"additionalProperties\":true},{\"type\":\"null\"}]}},\"dialect\":{\"type\":\"string\",\"enum\":[\"vue\",\"petite-vue\"]},\"vite\":{\"$ref\":\"#/definitions/VitePluginConfig\"},\"musea\":{\"$ref\":\"#/definitions/MuseaConfig\"},\"typeChecker\":{\"$ref\":\"#/definitions/TypeCheckerConfig\"},\"linter\":{\"$ref\":\"#/definitions/LinterConfig\"},\"formatter\":{\"$ref\":\"#/definitions/FormatterConfig\"},\"languageServer\":{\"$ref\":\"#/definitions/LanguageServerConfig\"},\"globalTypes\":{\"$ref\":\"#/definitions/GlobalTypesConfig\"},\"files\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"ignores\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"basePath\":{\"type\":\"string\"},\"lib\":{\"$ref\":\"#/definitions/LibConfig\"},\"version\":{\"$ref\":\"#/definitions/VueVersion\"},\"entries\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"basePath\":{\"type\":\"string\"},\"files\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"ignores\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"linter\":{\"$ref\":\"#/definitions/LinterConfig\"}},\"additionalProperties\":false}}},\"additionalProperties\":false,\"definitions\":{\"CompilerConfig\":{\"type\":\"object\",\"properties\":{\"mode\":{\"type\":\"string\",\"enum\":[\"module\",\"function\"]},\"vapor\":{\"type\":\"boolean\"},\"jsxMode\":{\"type\":\"string\",\"enum\":[\"vdom\",\"vapor\"]},\"jsxCompat\":{\"type\":\"string\",\"enum\":[\"native\",\"babel\"]},\"customRenderer\":{\"type\":\"boolean\"},\"customElements\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"ssr\":{\"type\":\"boolean\"},\"templateSyntax\":{\"type\":\"string\",\"enum\":[\"standard\",\"strict\",\"quirks\"]},\"whitespace\":{\"type\":\"string\",\"enum\":[\"condense\",\"preserve\",\"vue2-line-breaks\",\"vue2-preserve\"]},\"sourceMap\":{\"type\":\"boolean\"},\"prefixIdentifiers\":{\"type\":\"boolean\"},\"hoistStatic\":{\"type\":\"boolean\"},\"cacheHandlers\":{\"type\":\"boolean\"},\"isTs\":{\"type\":\"boolean\"},\"scriptExt\":{\"type\":\"string\",\"enum\":[\"ts\",\"js\"]},\"runtimeModuleName\":{\"type\":\"string\"},\"runtimeGlobalName\":{\"type\":\"string\"},\"compatibility\":{\"$ref\":\"#/definitions/CompilerCompatibilityConfig\"}},\"additionalProperties\":false},\"CompilerCompatibilityConfig\":{\"type\":\"object\",\"properties\":{\"vueVersion\":{\"$ref\":\"#/definitions/VueVersion\"},\"hostCompiler\":{\"type\":\"boolean\"},\"scriptSetupInStandalone\":{\"type\":\"boolean\"},\"optionsApiVapor\":{\"type\":\"boolean\"},\"nuxtVersion\":{\"type\":\"integer\",\"enum\":[2,3,4]},\"webpackVersion\":{\"type\":\"integer\",\"enum\":[4,5]}},\"additionalProperties\":false},\"VueVersion\":{\"type\":\"string\",\"enum\":[\"3\",\"2.7\",\"2\",\"1\",\"0.11\",\"0.10\"]},\"VitePluginConfig\":{\"type\":\"object\",\"properties\":{\"include\":{\"oneOf\":[{\"type\":\"string\"},{\"type\":\"array\",\"items\":{\"type\":\"string\"}}]},\"exclude\":{\"oneOf\":[{\"type\":\"string\"},{\"type\":\"array\",\"items\":{\"type\":\"string\"}}]},\"scanPatterns\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"ignorePatterns\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"additionalProperties\":false},\"MuseaConfig\":{\"type\":\"object\",\"properties\":{\"include\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"exclude\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"basePath\":{\"type\":\"string\"},\"storybookCompat\":{\"type\":\"boolean\"},\"inlineArt\":{\"type\":\"boolean\"},\"vrt\":{\"$ref\":\"#/definitions/MuseaVrtConfig\"},\"a11y\":{\"$ref\":\"#/definitions/MuseaA11yConfig\"},\"autogen\":{\"$ref\":\"#/definitions/MuseaAutogenConfig\"}},\"additionalProperties\":false},\"MuseaVrtConfig\":{\"type\":\"object\",\"properties\":{\"threshold\":{\"type\":\"number\"},\"outDir\":{\"type\":\"string\"},\"viewports\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/MuseaViewport\"}}},\"additionalProperties\":false},\"MuseaViewport\":{\"type\":\"object\",\"properties\":{\"width\":{\"type\":\"integer\"},\"height\":{\"type\":\"integer\"},\"name\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"width\",\"height\"]},\"MuseaA11yConfig\":{\"type\":\"object\",\"properties\":{\"enabled\":{\"type\":\"boolean\"},\"rules\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"boolean\"}}},\"additionalProperties\":false},\"MuseaAutogenConfig\":{\"type\":\"object\",\"properties\":{\"enabled\":{\"type\":\"boolean\"},\"maxVariants\":{\"type\":\"integer\"}},\"additionalProperties\":false},\"TypeCheckerConfig\":{\"type\":\"object\",\"properties\":{\"enabled\":{\"type\":\"boolean\"},\"strict\":{\"type\":\"boolean\"},\"checkProps\":{\"type\":\"boolean\"},\"checkEmits\":{\"type\":\"boolean\"},\"checkTemplateBindings\":{\"type\":\"boolean\"},\"checkReactivity\":{\"type\":\"boolean\"},\"checkSetupContext\":{\"type\":\"boolean\"},\"checkInvalidExports\":{\"type\":\"boolean\"},\"checkFallthroughAttrs\":{\"type\":\"boolean\"},\"optionsApi\":{\"type\":\"boolean\"},\"legacyVue2\":{\"type\":\"boolean\"},\"jsxTypecheck\":{\"type\":\"boolean\"},\"tsconfig\":{\"type\":\"string\"},\"corsaPath\":{\"type\":\"string\"},\"tsgoPath\":{\"type\":\"string\"},\"globalsFile\":{\"type\":\"string\"},\"servers\":{\"type\":\"integer\",\"minimum\":1,\"maximum\":32},\"lspRequestTimeoutMs\":{\"type\":\"integer\",\"minimum\":1}},\"additionalProperties\":false},\"LinterConfig\":{\"type\":\"object\",\"properties\":{\"enabled\":{\"type\":\"boolean\"},\"preset\":{\"type\":\"string\",\"enum\":[\"general-recommended\",\"general_recommended\",\"generalRecommended\",\"happy-path\",\"happy_path\",\"happy\",\"default\",\"recommended\",\"opinionated\",\"strict\",\"all\",\"essential\",\"incremental\",\"ecosystem\",\"nuxt\"]},\"typeAware\":{\"type\":\"boolean\"},\"crossFile\":{\"type\":\"boolean\"},\"crossFileTree\":{\"type\":\"boolean\"},\"crossFileComplexity\":{\"type\":\"boolean\"},\"strictReactivity\":{\"type\":\"boolean\"},\"maxWarnings\":{\"type\":\"integer\",\"minimum\":0},\"rules\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"string\",\"enum\":[\"off\",\"warn\",\"error\"]}},\"ruleOptions\":{\"$ref\":\"#/definitions/LintRuleOptions\"},\"categories\":{\"type\":\"object\",\"properties\":{\"correctness\":{\"type\":\"string\",\"enum\":[\"off\",\"warn\",\"error\"]},\"suspicious\":{\"type\":\"string\",\"enum\":[\"off\",\"warn\",\"error\"]},\"style\":{\"type\":\"string\",\"enum\":[\"off\",\"warn\",\"error\"]},\"perf\":{\"type\":\"string\",\"enum\":[\"off\",\"warn\",\"error\"]},\"a11y\":{\"type\":\"string\",\"enum\":[\"off\",\"warn\",\"error\"]},\"security\":{\"type\":\"string\",\"enum\":[\"off\",\"warn\",\"error\"]}},\"additionalProperties\":false}},\"additionalProperties\":false},\"LintRuleOptions\":{\"type\":\"object\",\"properties\":{\"script/define-props-destructuring\":{\"type\":\"object\",\"properties\":{\"destructure\":{\"type\":\"string\",\"enum\":[\"only-when-assigned\",\"always\",\"never\"]}},\"additionalProperties\":false},\"html/no-empty-palpable-content\":{\"type\":\"object\",\"properties\":{\"contentDirectives\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"additionalProperties\":false},\"type/strict-boolean-expressions\":{\"type\":\"object\",\"properties\":{\"allowString\":{\"type\":\"boolean\"},\"allowNumber\":{\"type\":\"boolean\"},\"allowNullableObject\":{\"type\":\"boolean\"},\"allowNullableBoolean\":{\"type\":\"boolean\"},\"allowNullableString\":{\"type\":\"boolean\"},\"allowNullableNumber\":{\"type\":\"boolean\"},\"allowNullableEnum\":{\"type\":\"boolean\"},\"allowAny\":{\"type\":\"boolean\"}},\"additionalProperties\":false},\"script/no-restricted-globals\":{\"$ref\":\"#/definitions/NoRestrictedGlobalsOptions\"},\"script/no-restricted-members\":{\"$ref\":\"#/definitions/NoRestrictedMembersOptions\"},\"vue/component-name-in-template-casing\":{\"type\":\"object\",\"properties\":{\"casing\":{\"type\":\"string\",\"enum\":[\"PascalCase\",\"kebab-case\"]},\"registeredComponentsOnly\":{\"type\":\"boolean\"},\"globals\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"additionalProperties\":false},\"script/custom-event-name-casing\":{\"type\":\"object\",\"properties\":{\"casing\":{\"type\":\"string\",\"enum\":[\"camelCase\",\"kebab-case\"]}},\"additionalProperties\":false},\"vue/no-mutating-props\":{\"type\":\"object\",\"properties\":{\"shallowOnly\":{\"type\":\"boolean\"}},\"additionalProperties\":false},\"vue/require-component-registration\":{\"type\":\"object\",\"properties\":{\"globals\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"additionalProperties\":false},\"vue/sfc-element-order\":{\"type\":\"object\",\"properties\":{\"order\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"type\":\"string\"},{\"type\":\"array\",\"items\":{\"type\":\"string\"}}]}}},\"additionalProperties\":false},\"vue/html-self-closing\":{\"type\":\"object\",\"properties\":{\"html\":{\"type\":\"object\",\"properties\":{\"void\":{\"type\":\"string\",\"enum\":[\"always\",\"never\",\"any\"]},\"normal\":{\"type\":\"string\",\"enum\":[\"always\",\"never\",\"any\"]},\"component\":{\"type\":\"string\",\"enum\":[\"always\",\"never\",\"any\"]}},\"additionalProperties\":false},\"svg\":{\"type\":\"string\",\"enum\":[\"always\",\"never\",\"any\"]},\"math\":{\"type\":\"string\",\"enum\":[\"always\",\"never\",\"any\"]}},\"additionalProperties\":false},\"vue/v-on-event-hyphenation\":{\"type\":\"string\",\"enum\":[\"always\",\"never\"]},\"vue/attribute-hyphenation\":{\"type\":\"string\",\"enum\":[\"always\",\"never\"]},\"vue/valid-v-on\":{\"type\":\"object\",\"properties\":{\"modifiers\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"additionalProperties\":false},\"vue/valid-v-slot\":{\"type\":\"object\",\"properties\":{\"allowModifiers\":{\"type\":\"boolean\"}},\"additionalProperties\":false},\"musea/prefer-design-tokens\":{\"$ref\":\"#/definitions/MuseaPreferDesignTokensOptions\"}},\"additionalProperties\":false},\"NoRestrictedGlobalsOptions\":{\"type\":\"object\",\"properties\":{\"globals\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/RestrictedGlobal\"}}},\"additionalProperties\":false},\"RestrictedGlobal\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"message\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"name\"]},\"NoRestrictedMembersOptions\":{\"type\":\"object\",\"properties\":{\"members\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/RestrictedMember\"}}},\"additionalProperties\":false},\"RestrictedMember\":{\"type\":\"object\",\"properties\":{\"object\":{\"type\":\"string\"},\"property\":{\"type\":\"string\"},\"message\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"object\",\"property\"]},\"MuseaPreferDesignTokensOptions\":{\"type\":\"object\",\"properties\":{\"tokens\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/MuseaDesignToken\"}}},\"additionalProperties\":false},\"MuseaDesignToken\":{\"type\":\"object\",\"properties\":{\"path\":{\"type\":\"string\"},\"value\":{\"type\":\"string\"},\"tier\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"path\",\"value\"]},\"FormatterConfig\":{\"type\":\"object\",\"properties\":{\"sortImports\":{\"oneOf\":[{\"type\":\"boolean\",\"enum\":[false]},{\"$ref\":\"#/definitions/SortImportsConfig\"}]},\"printWidth\":{\"type\":\"integer\"},\"tabWidth\":{\"type\":\"integer\"},\"useTabs\":{\"type\":\"boolean\"},\"semi\":{\"type\":\"boolean\"},\"singleQuote\":{\"type\":\"boolean\"},\"jsxSingleQuote\":{\"type\":\"boolean\"},\"trailingComma\":{\"type\":\"string\",\"enum\":[\"all\",\"none\",\"es5\"]},\"bracketSpacing\":{\"type\":\"boolean\"},\"bracketSameLine\":{\"type\":\"boolean\"},\"arrowParens\":{\"type\":\"string\",\"enum\":[\"always\",\"avoid\"]},\"endOfLine\":{\"type\":\"string\",\"enum\":[\"lf\",\"crlf\",\"cr\",\"auto\"]},\"quoteProps\":{\"type\":\"string\",\"enum\":[\"as-needed\",\"consistent\",\"preserve\"]},\"singleAttributePerLine\":{\"type\":\"boolean\"},\"vueIndentScriptAndStyle\":{\"type\":\"boolean\"},\"sortAttributes\":{\"type\":\"boolean\"},\"attributeSortOrder\":{\"type\":\"string\",\"enum\":[\"alphabetical\",\"as-written\"]},\"mergeBindAndNonBindAttrs\":{\"type\":\"boolean\"},\"maxAttributesPerLine\":{\"type\":\"integer\"},\"attributeGroups\":{\"type\":\"array\",\"items\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"normalizeDirectiveShorthands\":{\"type\":\"boolean\"},\"sortBlocks\":{\"type\":\"boolean\"}},\"additionalProperties\":false},\"SortImportsConfig\":{\"type\":\"object\",\"properties\":{\"partitionByNewline\":{\"type\":\"boolean\"},\"partitionByComment\":{\"type\":\"boolean\"},\"sortSideEffects\":{\"type\":\"boolean\"},\"order\":{\"type\":\"string\",\"enum\":[\"asc\",\"desc\"]},\"ignoreCase\":{\"type\":\"boolean\"},\"newlinesBetween\":{\"type\":\"boolean\"},\"internalPattern\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"groups\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"type\":\"string\"},{\"type\":\"array\",\"items\":{\"type\":\"string\"}},{\"type\":\"object\",\"properties\":{\"newlinesBetween\":{\"type\":\"boolean\"}},\"additionalProperties\":false,\"required\":[\"newlinesBetween\"]}]}},\"customGroups\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/ImportSortCustomGroup\"}}},\"additionalProperties\":false},\"ImportSortCustomGroup\":{\"type\":\"object\",\"properties\":{\"groupName\":{\"type\":\"string\"},\"elementNamePattern\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"selector\":{\"type\":\"string\"},\"modifiers\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"additionalProperties\":false,\"required\":[\"groupName\"]},\"LanguageServerConfig\":{\"type\":\"object\",\"properties\":{\"enabled\":{\"type\":\"boolean\"},\"lint\":{\"type\":\"boolean\"},\"diagnostics\":{\"type\":\"boolean\"},\"typecheck\":{\"type\":\"boolean\"},\"editor\":{\"type\":\"boolean\"},\"ecosystem\":{\"type\":\"boolean\"},\"crossFile\":{\"type\":\"boolean\"},\"legacyVue2\":{\"type\":\"boolean\"},\"completion\":{\"type\":\"boolean\"},\"signatureHelp\":{\"type\":\"boolean\"},\"hover\":{\"type\":\"boolean\"},\"definition\":{\"type\":\"boolean\"},\"references\":{\"type\":\"boolean\"},\"documentSymbols\":{\"type\":\"boolean\"},\"workspaceSymbols\":{\"type\":\"boolean\"},\"formatting\":{\"type\":\"boolean\"},\"codeActions\":{\"type\":\"boolean\"},\"rename\":{\"type\":\"boolean\"},\"codeLens\":{\"type\":\"boolean\"},\"semanticTokens\":{\"type\":\"boolean\"},\"documentLinks\":{\"type\":\"boolean\"},\"foldingRanges\":{\"type\":\"boolean\"},\"inlayHints\":{\"type\":\"boolean\"},\"fileRename\":{\"type\":\"boolean\"},\"corsa\":{\"type\":\"boolean\"},\"tsgo\":{\"type\":\"boolean\"}},\"additionalProperties\":false},\"GlobalTypesConfig\":{\"type\":\"object\",\"additionalProperties\":{\"oneOf\":[{\"type\":\"string\"},{\"$ref\":\"#/definitions/GlobalTypeDeclaration\"}]}},\"GlobalTypeDeclaration\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\"},\"defaultValue\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\"]},\"LibConfig\":{\"type\":\"object\",\"properties\":{\"dir\":{\"type\":\"string\"},\"uiDir\":{\"type\":\"string\"},\"composableDir\":{\"type\":\"string\"},\"lockfile\":{\"type\":\"string\"},\"registries\":{\"type\":\"object\",\"additionalProperties\":{\"oneOf\":[{\"type\":\"string\"},{\"type\":\"object\",\"properties\":{\"source\":{\"type\":\"string\"},\"dir\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"source\"]}]},\"propertyNames\":{\"pattern\":\"^@[a-z0-9][a-z0-9._-]*$\"}}},\"additionalProperties\":false}}}");
|
|
5
|
+
const sourceConfigKey = Symbol.for("@vizejs/vite-plugin/vite-plus/source");
|
|
6
|
+
function object(value) {
|
|
7
|
+
if (value === null || typeof value !== "object") return false;
|
|
8
|
+
const prototype = Object.getPrototypeOf(value);
|
|
9
|
+
return prototype === Object.prototype || prototype === null;
|
|
10
|
+
}
|
|
11
|
+
function merge(base, own) {
|
|
12
|
+
const result = { ...base };
|
|
13
|
+
for (const [key, value] of Object.entries(own)) result[key] = object(value) && object(result[key]) ? merge(result[key], value) : value;
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
async function resolveSource(value, env, parents = /* @__PURE__ */ new Set()) {
|
|
17
|
+
value = await value;
|
|
18
|
+
if (parents.has(value)) throw new Error("Circular Vue configuration source");
|
|
19
|
+
parents.add(value);
|
|
20
|
+
try {
|
|
21
|
+
if ((typeof value === "function" || object(value)) && sourceConfigKey in value) return await resolveSource(value[sourceConfigKey], env, parents);
|
|
22
|
+
const config = await (typeof value === "function" ? value(env) : value);
|
|
23
|
+
if (!object(config)) throw new Error("Vite config must export an object or a config function");
|
|
24
|
+
rejectLegacyConfig(config);
|
|
25
|
+
return config;
|
|
26
|
+
} finally {
|
|
27
|
+
parents.delete(value);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function rejectLegacyConfig(source) {
|
|
31
|
+
if (Object.hasOwn(source, "extends")) throw new Error("Custom config extends is no longer supported; use defineConfig(vpConfig).withVue(vueConfig)");
|
|
32
|
+
if (Object.hasOwn(source, "vize")) throw new Error("vize: configuration is no longer supported; move Vue settings to vue: in vite.config.*");
|
|
33
|
+
for (const key of [
|
|
34
|
+
"lint",
|
|
35
|
+
"fmt",
|
|
36
|
+
"pack"
|
|
37
|
+
]) if ((Array.isArray(source[key]) ? source[key] : [source[key]]).some((value) => object(value) && Object.hasOwn(value, "vize"))) throw new Error(`${key}.vize is no longer supported; use ${key}.vue or the shared vue: settings`);
|
|
38
|
+
}
|
|
39
|
+
const VITE_CONFIG_FILE_NAMES = [
|
|
40
|
+
"vite.config.ts",
|
|
41
|
+
"vite.config.js",
|
|
42
|
+
"vite.config.mjs",
|
|
43
|
+
"vite.config.cjs",
|
|
44
|
+
"vite.config.mts",
|
|
45
|
+
"vite.config.cts"
|
|
46
|
+
];
|
|
47
|
+
/** Project workflows support JSX without an extra feature flag. Legacy config stays unchanged. */
|
|
48
|
+
function projectConfigDefaults() {
|
|
49
|
+
return { typeChecker: { jsxTypecheck: true } };
|
|
50
|
+
}
|
|
51
|
+
/** Resolve just the native settings from an ordinary Vite or Vite+ export. */
|
|
52
|
+
async function resolveViteConfigExport$1(exported, env, configDir) {
|
|
53
|
+
env ??= {
|
|
54
|
+
mode: "development",
|
|
55
|
+
command: "serve"
|
|
56
|
+
};
|
|
57
|
+
if (env.command !== "build" && env.command !== "serve") env = {
|
|
58
|
+
...env,
|
|
59
|
+
command: "serve"
|
|
60
|
+
};
|
|
61
|
+
return projectViteConfigSource(await resolveSource(exported, env), env, configDir);
|
|
62
|
+
}
|
|
63
|
+
/** Project already evaluated settings; the owning adapter evaluates its Vite export once. */
|
|
64
|
+
async function projectViteConfigSource(source, env, configDir) {
|
|
65
|
+
if (!object(source)) throw new TypeError("Vite config source must be an object");
|
|
66
|
+
env ??= {
|
|
67
|
+
mode: "development",
|
|
68
|
+
command: "serve"
|
|
69
|
+
};
|
|
70
|
+
if (env.command !== "build" && env.command !== "serve") env = {
|
|
71
|
+
...env,
|
|
72
|
+
command: "serve"
|
|
73
|
+
};
|
|
74
|
+
rejectLegacyConfig(source);
|
|
75
|
+
const selected = vueConfigOptions(source);
|
|
76
|
+
const canonical = selected === void 0 ? {} : flatVueOptions(selected);
|
|
77
|
+
const overrides = {};
|
|
78
|
+
if (object(source.compiler)) {
|
|
79
|
+
const { vueVersion, ...compiler } = source.compiler;
|
|
80
|
+
const version = vueVersion ?? compiler.compatibility?.vueVersion;
|
|
81
|
+
overrides.compiler = merge(compiler, version === void 0 ? {} : { compatibility: { vueVersion: String(version === .1 ? "0.10" : version === "legacy" ? 2 : version) } });
|
|
82
|
+
}
|
|
83
|
+
if (typeof source.typecheck === "boolean") overrides.typeChecker = { enabled: source.typecheck };
|
|
84
|
+
else if (object(source.typecheck)) overrides.typeChecker = source.typecheck;
|
|
85
|
+
const lint = source.lint?.vue;
|
|
86
|
+
if (typeof lint === "boolean") overrides.linter = { enabled: lint };
|
|
87
|
+
else if (object(lint)) {
|
|
88
|
+
const { typecheck: _typecheck, locale: _locale, helpLevel: _helpLevel, ...native } = lint;
|
|
89
|
+
overrides.linter = native;
|
|
90
|
+
}
|
|
91
|
+
if (object(source.fmt)) {
|
|
92
|
+
const { vue, sortImports } = source.fmt;
|
|
93
|
+
overrides.formatter = merge(sortImports === void 0 ? {} : { sortImports }, object(vue) ? vue : {});
|
|
94
|
+
}
|
|
95
|
+
const root = typeof source.root === "string" ? resolve(configDir ?? ".", source.root) : configDir;
|
|
96
|
+
const config = overlayVueOptions(merge(projectConfigDefaults(), overrides), canonical);
|
|
97
|
+
return root ? {
|
|
98
|
+
...projectPaths(config, root, false),
|
|
99
|
+
__vizeProjectRoot: root
|
|
100
|
+
} : config;
|
|
101
|
+
}
|
|
102
|
+
/** Validate only canonical settings; selecting them never evaluates a legacy callback. */
|
|
103
|
+
function vueConfigOptions(source) {
|
|
104
|
+
const selected = source.vue;
|
|
105
|
+
if (selected !== void 0) validateVueOption(selected, vueOptionSchema, "vue");
|
|
106
|
+
return selected;
|
|
107
|
+
}
|
|
108
|
+
/** Share canonical composition with adapters while their other Vite fields keep Vite merging. */
|
|
109
|
+
function mergeVueConfigOptions(base, own) {
|
|
110
|
+
vueConfigOptions({ vue: base });
|
|
111
|
+
vueConfigOptions({ vue: own });
|
|
112
|
+
if (base === void 0) return own;
|
|
113
|
+
if (own === void 0) return base;
|
|
114
|
+
return overlayVueOptions(base, own);
|
|
115
|
+
}
|
|
116
|
+
function flatVueOptions(selected) {
|
|
117
|
+
const { version, entries, ...sections } = selected;
|
|
118
|
+
return {
|
|
119
|
+
...sections,
|
|
120
|
+
...version === void 0 ? {} : { vue: { version } },
|
|
121
|
+
...entries === void 0 ? {} : { entries: entries.map(flatVueOptions) }
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function overlayVueOptions(base, own) {
|
|
125
|
+
const result = { ...base };
|
|
126
|
+
for (const [key, value] of Object.entries(own)) {
|
|
127
|
+
if (value === void 0) continue;
|
|
128
|
+
const previous = Object.hasOwn(result, key) ? result[key] : void 0;
|
|
129
|
+
Object.defineProperty(result, key, {
|
|
130
|
+
value: object(value) && object(previous) ? overlayVueOptions(previous, value) : value,
|
|
131
|
+
enumerable: true,
|
|
132
|
+
configurable: true,
|
|
133
|
+
writable: true
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
function validateVueOption(value, schema, label) {
|
|
139
|
+
const refuse = (reason) => {
|
|
140
|
+
throw new TypeError(`${label}: ${reason}`);
|
|
141
|
+
};
|
|
142
|
+
if (schema.$ref) return validateVueOption(value, vueOptionSchema.definitions[schema.$ref.split("/").at(-1)], label);
|
|
143
|
+
if (schema.oneOf) {
|
|
144
|
+
if (schema.oneOf.filter((candidate) => {
|
|
145
|
+
try {
|
|
146
|
+
validateVueOption(value, candidate, label);
|
|
147
|
+
return true;
|
|
148
|
+
} catch (error) {
|
|
149
|
+
if (!(error instanceof TypeError)) throw error;
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
}).length !== 1) refuse("must match one documented native option type");
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (schema.enum && !schema.enum.includes(value)) refuse("unsupported native option value");
|
|
156
|
+
const valid = {
|
|
157
|
+
object: object(value),
|
|
158
|
+
array: Array.isArray(value),
|
|
159
|
+
string: typeof value === "string",
|
|
160
|
+
boolean: typeof value === "boolean",
|
|
161
|
+
integer: Number.isInteger(value),
|
|
162
|
+
number: typeof value === "number" && Number.isFinite(value),
|
|
163
|
+
null: value === null
|
|
164
|
+
};
|
|
165
|
+
if (schema.type && !valid[schema.type]) refuse(`must be ${schema.type}`);
|
|
166
|
+
if (schema.minimum !== void 0 && value < schema.minimum) refuse(`must be >= ${schema.minimum}`);
|
|
167
|
+
if (schema.maximum !== void 0 && value > schema.maximum) refuse(`must be <= ${schema.maximum}`);
|
|
168
|
+
if (Array.isArray(value) && schema.items) for (let index = 0; index < value.length; index++) validateVueOption(value[index], schema.items, `${label}[${index}]`);
|
|
169
|
+
if (object(value)) {
|
|
170
|
+
for (const required of schema.required ?? []) if (!Object.hasOwn(value, required) || value[required] === void 0) refuse(`missing ${required}`);
|
|
171
|
+
for (const [key, item] of Object.entries(value)) {
|
|
172
|
+
const documented = Object.hasOwn(schema.properties ?? {}, key);
|
|
173
|
+
if (!documented && schema.additionalProperties === false) refuse(`unknown option ${key}`);
|
|
174
|
+
if (schema.propertyNames?.pattern && !new RegExp(schema.propertyNames.pattern).test(key)) refuse(`invalid native option name ${key}`);
|
|
175
|
+
const rule = documented ? schema.properties[key] : schema.additionalProperties;
|
|
176
|
+
if (item !== void 0 && object(rule)) validateVueOption(item, rule, `${label}.${key}`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function projectPaths(config, root, entry) {
|
|
181
|
+
if (!root || !object(config)) return config;
|
|
182
|
+
const result = { ...config };
|
|
183
|
+
if (typeof config.basePath === "string" || config.files !== void 0 || entry && config.ignores !== void 0) result.basePath = resolve(root, config.basePath ?? ".");
|
|
184
|
+
if (Array.isArray(config.entries)) result.entries = config.entries.map((value) => projectPaths(value, root, true));
|
|
185
|
+
if (object(config.typeChecker)) {
|
|
186
|
+
result.typeChecker = { ...config.typeChecker };
|
|
187
|
+
for (const key of [
|
|
188
|
+
"tsconfig",
|
|
189
|
+
"corsaPath",
|
|
190
|
+
"tsgoPath",
|
|
191
|
+
"globalsFile"
|
|
192
|
+
]) if (typeof config.typeChecker[key] === "string") result.typeChecker[key] = resolve(root, config.typeChecker[key]);
|
|
193
|
+
}
|
|
194
|
+
return result;
|
|
195
|
+
}
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/config.ts
|
|
198
|
+
const require = createRequire(import.meta.url);
|
|
199
|
+
const CONFIG_FILE_NAMES = VITE_CONFIG_FILE_NAMES;
|
|
200
|
+
let vizeConfigModulePromise = null;
|
|
201
|
+
function loadVizeConfigModule() {
|
|
202
|
+
vizeConfigModulePromise ??= import("vize/config");
|
|
203
|
+
return vizeConfigModulePromise;
|
|
204
|
+
}
|
|
205
|
+
function defineConfig(config) {
|
|
206
|
+
return config;
|
|
207
|
+
}
|
|
208
|
+
async function loadConfig(root, options) {
|
|
209
|
+
return (await loadVizeConfigModule()).loadConfig(root, options);
|
|
210
|
+
}
|
|
211
|
+
async function resolveConfigExport(exported, env) {
|
|
212
|
+
return (await loadVizeConfigModule()).resolveConfigExport(exported, env);
|
|
213
|
+
}
|
|
214
|
+
/** Project shared settings from an already evaluated Vite config. */
|
|
215
|
+
async function resolveViteConfigExport(exported, env, configDir) {
|
|
216
|
+
const configModule = await loadVizeConfigModule();
|
|
217
|
+
if (typeof configModule.resolveViteConfigExport === "function") return configModule.resolveViteConfigExport(exported, env, configDir);
|
|
218
|
+
return configModule.resolveConfigExport(await resolveViteConfigExport$1(exported, env, configDir), env);
|
|
219
|
+
}
|
|
220
|
+
require.resolve("vize/schemas/vize.config.schema.json");
|
|
221
|
+
require.resolve("vize/pkl/vize.pkl");
|
|
222
|
+
[...CONFIG_FILE_NAMES];
|
|
223
|
+
const VIZE_CONFIG_FILE_ENV = "VIZE_CONFIG_FILE";
|
|
224
|
+
/**
|
|
225
|
+
* Shared config store for inter-plugin communication.
|
|
226
|
+
* Key = project root, Value = resolved VizeConfig.
|
|
227
|
+
*
|
|
228
|
+
* @deprecated Root identity cannot isolate parallel Vite client/SSR instances
|
|
229
|
+
* or servers. This export remains temporarily for compatibility; internal Vize
|
|
230
|
+
* integrations use an exact `ResolvedConfig`-scoped bridge instead.
|
|
231
|
+
*/
|
|
232
|
+
const vizeConfigStore = /* @__PURE__ */ new Map();
|
|
233
|
+
//#endregion
|
|
234
|
+
export { resolveViteConfigExport as a, projectViteConfigSource as c, resolveConfigExport as i, vueConfigOptions as l, defineConfig as n, vizeConfigStore as o, loadConfig as r, mergeVueConfigOptions as s, VIZE_CONFIG_FILE_ENV as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as VizeInspectorLintPlanProvider, c as VizeCompatibilityOptions, d as LoadConfigOptions, f as ResolvedVizeConfig,
|
|
1
|
+
import { a as VizeInspectorLintPlanProvider, b as VizeConfig, c as VizeCompatibilityOptions, d as LoadConfigOptions, f as ResolvedVizeConfig, h as VueOptionsEntry, i as VizeVueFeatures, l as VizeVueVersion, m as VueOptions, n as CompiledModule, o as VizeInspectorLintPlanRequest, p as UserConfigExport, r as MacroArtifact, s as VizeInspectorOptions, t as VizeOptions, u as ConfigEnv } from "./types-kbMQcMYf.mjs";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
|
|
4
4
|
//#region src/virtual.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as vize } from "./plugin-
|
|
2
|
-
import {
|
|
3
|
-
import { a as resolveViteConfigExport, i as resolveConfigExport, n as defineConfig, o as vizeConfigStore, r as loadConfig, t as VIZE_CONFIG_FILE_ENV } from "./config-
|
|
1
|
+
import { t as vize } from "./plugin-DtrTTtew.mjs";
|
|
2
|
+
import { l as rewriteStaticAssetUrls } from "./vue-version-BUu5UzZ5.mjs";
|
|
3
|
+
import { a as resolveViteConfigExport, i as resolveConfigExport, n as defineConfig, o as vizeConfigStore, r as loadConfig, t as VIZE_CONFIG_FILE_ENV } from "./config-DE1fZbgD.mjs";
|
|
4
4
|
//#region src/index.ts
|
|
5
5
|
const __internal = { rewriteStaticAssetUrls };
|
|
6
6
|
var src_default = vize;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { o as vizeConfigStore } from "./config-
|
|
1
|
+
import { a as applyDefineReplacements, c as rewriteImportMetaGlobBase, i as isLegacyVueVersion, l as rewriteStaticAssetUrls, o as createLogger, r as isLegacyVueCompatibilityMode, s as rewriteDynamicTemplateImports, t as createLegacyVueCompatibilityPlugin, u as shouldApplyDefineInVirtualModule } from "./vue-version-BUu5UzZ5.mjs";
|
|
2
|
+
import { a as resolveViteConfigExport, i as resolveConfigExport, o as vizeConfigStore, r as loadConfig } from "./config-DE1fZbgD.mjs";
|
|
3
3
|
import { n as registerResolvedVizeConfig, r as unregisterResolvedVizeConfig } from "./config-bridge-Dv6U7_RC.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import crypto, { createHash } from "node:crypto";
|
|
@@ -4072,6 +4072,100 @@ function createFileCompilerOptions(config, root, explicit, defaults = {}) {
|
|
|
4072
4072
|
}, defaults);
|
|
4073
4073
|
}
|
|
4074
4074
|
//#endregion
|
|
4075
|
+
//#region src/plugin/host-config-source.ts
|
|
4076
|
+
const hostVueFields = new Set([
|
|
4077
|
+
"isProduction",
|
|
4078
|
+
"template",
|
|
4079
|
+
"script",
|
|
4080
|
+
"features",
|
|
4081
|
+
"include",
|
|
4082
|
+
"exclude"
|
|
4083
|
+
]);
|
|
4084
|
+
function nativeProjectSource(source, hostContext) {
|
|
4085
|
+
if (hostContext !== "nuxt" || source === null || typeof source !== "object" || Array.isArray(source)) return source;
|
|
4086
|
+
const descriptor = Object.getOwnPropertyDescriptor(source, "vue");
|
|
4087
|
+
if (!descriptor) return source;
|
|
4088
|
+
const host = source.vue;
|
|
4089
|
+
let inspected = source;
|
|
4090
|
+
if (!("value" in descriptor)) {
|
|
4091
|
+
const captured = Object.getOwnPropertyDescriptors(source);
|
|
4092
|
+
captured.vue = {
|
|
4093
|
+
value: host,
|
|
4094
|
+
enumerable: descriptor.enumerable,
|
|
4095
|
+
configurable: descriptor.configurable,
|
|
4096
|
+
writable: false
|
|
4097
|
+
};
|
|
4098
|
+
inspected = Object.create(Object.getPrototypeOf(source), captured);
|
|
4099
|
+
}
|
|
4100
|
+
if (host === null || typeof host !== "object") return inspected;
|
|
4101
|
+
const prototype = Object.getPrototypeOf(host);
|
|
4102
|
+
if (prototype !== Object.prototype && prototype !== null) return inspected;
|
|
4103
|
+
const keys = Reflect.ownKeys(host);
|
|
4104
|
+
if (!keys.length || !keys.every((key) => typeof key === "string" && hostVueFields.has(key))) return inspected;
|
|
4105
|
+
const descriptors = Object.getOwnPropertyDescriptors(source);
|
|
4106
|
+
delete descriptors.vue;
|
|
4107
|
+
return Object.create(Object.getPrototypeOf(source), descriptors);
|
|
4108
|
+
}
|
|
4109
|
+
//#endregion
|
|
4110
|
+
//#region src/plugin/shared-config.ts
|
|
4111
|
+
function mergeSharedConfig(baseConfig, overrideConfig) {
|
|
4112
|
+
if (!baseConfig) return overrideConfig;
|
|
4113
|
+
if (!overrideConfig) return baseConfig;
|
|
4114
|
+
return {
|
|
4115
|
+
...baseConfig,
|
|
4116
|
+
...overrideConfig,
|
|
4117
|
+
compiler: {
|
|
4118
|
+
...baseConfig.compiler,
|
|
4119
|
+
...overrideConfig.compiler
|
|
4120
|
+
},
|
|
4121
|
+
vite: {
|
|
4122
|
+
...baseConfig.vite,
|
|
4123
|
+
...overrideConfig.vite
|
|
4124
|
+
},
|
|
4125
|
+
linter: {
|
|
4126
|
+
...baseConfig.linter,
|
|
4127
|
+
...overrideConfig.linter
|
|
4128
|
+
},
|
|
4129
|
+
typeChecker: {
|
|
4130
|
+
...baseConfig.typeChecker,
|
|
4131
|
+
...overrideConfig.typeChecker
|
|
4132
|
+
},
|
|
4133
|
+
formatter: {
|
|
4134
|
+
...baseConfig.formatter,
|
|
4135
|
+
...overrideConfig.formatter
|
|
4136
|
+
},
|
|
4137
|
+
languageServer: {
|
|
4138
|
+
...baseConfig.languageServer,
|
|
4139
|
+
...overrideConfig.languageServer
|
|
4140
|
+
},
|
|
4141
|
+
musea: {
|
|
4142
|
+
...baseConfig.musea,
|
|
4143
|
+
...overrideConfig.musea
|
|
4144
|
+
},
|
|
4145
|
+
globalTypes: {
|
|
4146
|
+
...baseConfig.globalTypes,
|
|
4147
|
+
...overrideConfig.globalTypes
|
|
4148
|
+
},
|
|
4149
|
+
entries: [...baseConfig.entries, ...overrideConfig.entries]
|
|
4150
|
+
};
|
|
4151
|
+
}
|
|
4152
|
+
async function resolveSharedConfig(options, root, env, logger, viteConfig, hostContext) {
|
|
4153
|
+
let fileConfig = null;
|
|
4154
|
+
if (options.configMode !== false) {
|
|
4155
|
+
const configFile = options.configFile ?? process.env["VIZE_CONFIG_FILE"];
|
|
4156
|
+
fileConfig = await loadConfig(root, {
|
|
4157
|
+
mode: options.configMode ?? "root",
|
|
4158
|
+
configFile,
|
|
4159
|
+
env,
|
|
4160
|
+
viteConfig: false
|
|
4161
|
+
});
|
|
4162
|
+
if (fileConfig) logger.log("Loaded explicitly selected native Vue settings");
|
|
4163
|
+
}
|
|
4164
|
+
const inlineConfig = options.config ? await resolveConfigExport(options.config, env) : null;
|
|
4165
|
+
if (inlineConfig) logger.log("Loaded inline Vue settings from plugin options");
|
|
4166
|
+
return mergeSharedConfig(mergeSharedConfig(viteConfig === void 0 || options.configMode === false ? null : await resolveViteConfigExport(nativeProjectSource(viteConfig, hostContext), env), fileConfig), inlineConfig);
|
|
4167
|
+
}
|
|
4168
|
+
//#endregion
|
|
4075
4169
|
//#region src/plugin/config-lifecycle.ts
|
|
4076
4170
|
const compatibilityOwners = /* @__PURE__ */ new Map();
|
|
4077
4171
|
const compatibilityRegistrations = /* @__PURE__ */ new WeakMap();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as resolveConfigExport, r as loadConfig } from "./config-
|
|
1
|
+
import { i as resolveConfigExport, r as loadConfig } from "./config-DE1fZbgD.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import path from "node:path";
|
|
@@ -129,7 +129,7 @@ async function runTools(task, args, metadata, vp, native, execute) {
|
|
|
129
129
|
const fmt = task === "check" || task === "fmt" || task === "fmt:check";
|
|
130
130
|
const fix = task === "lint:fix" || args.includes("--fix");
|
|
131
131
|
const formatCheck = task === "fmt:check" || task === "check" && !fix || args.includes("--check");
|
|
132
|
-
if ((task === "check" || lint) && args.some((arg) => arg.startsWith("-") && arg !== "--fix")) throw new Error(`Vize ${task} tasks accept paths and --fix. Put native tool options in ${task === "check" ? "the corresponding config section" : "lint.
|
|
132
|
+
if ((task === "check" || lint) && args.some((arg) => arg.startsWith("-") && arg !== "--fix")) throw new Error(`Vize ${task} tasks accept paths and --fix. Put native tool options in ${task === "check" ? "the corresponding config section" : "lint.vue"}.`);
|
|
133
133
|
let status = 0;
|
|
134
134
|
async function run(binary, argv) {
|
|
135
135
|
const code = await execute(process.execPath, [binary, ...argv]);
|
|
@@ -154,7 +154,7 @@ async function runTools(task, args, metadata, vp, native, execute) {
|
|
|
154
154
|
"-w",
|
|
155
155
|
"--fix"
|
|
156
156
|
].includes(arg));
|
|
157
|
-
if (patterns.some((arg) => arg.startsWith("-"))) throw new Error("Vize fmt tasks accept paths and --check/--write. Put native formatter options in defineConfig({ fmt: {
|
|
157
|
+
if (patterns.some((arg) => arg.startsWith("-"))) throw new Error("Vize fmt tasks accept paths and --check/--write. Put native formatter options in defineConfig({ fmt: { vue: ... } }).");
|
|
158
158
|
if (options.fmt !== false) {
|
|
159
159
|
const vue = (await glob(patterns.length ? patterns : ["**/*.vue"], {
|
|
160
160
|
expandDirectories: true,
|
|
@@ -264,4 +264,4 @@ async function runNative(command, argv, metadata, native = nativeBinary(), spawn
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
//#endregion
|
|
267
|
-
export {
|
|
267
|
+
export { taskConfigKey as a, sourceConfigKey as i, runTask as n, availableVueRules as r, runNative as t };
|