@vizejs/vite-plugin 0.457.0 → 0.463.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/dist/config-DNse8RdN.mjs +260 -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-CILRyPD1.mjs +2 -0
- package/dist/{plugin-CHZJDKpS.mjs → plugin-DMzAJRIw.mjs} +5 -4
- package/dist/{runner-Eg2DQhNT.mjs → runner-Y2Iuaafy.mjs} +1 -1
- package/dist/{shared-config-BGZnoNvi.mjs → shared-config-BU0TeQKs.mjs} +1 -1
- package/dist/{types-Di46SPcH.d.mts → types-B3cTltTi.d.mts} +4 -1
- package/dist/vite-plus.d.mts +1 -1
- package/dist/vite-plus.mjs +4 -4
- package/package.json +4 -4
- package/dist/config-CniehWXB.mjs +0 -259
- package/dist/plugin-VmflBZfL.mjs +0 -2
|
@@ -0,0 +1,260 @@
|
|
|
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\":{\"compiler\":{\"$ref\":\"#/definitions/CompilerConfig\"},\"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\"]},\"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\":[\"happy-path\",\"opinionated\",\"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\"},\"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 extends in Vize's Vite config");
|
|
19
|
+
parents.add(value);
|
|
20
|
+
try {
|
|
21
|
+
if (typeof value === "function" && 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
|
+
const { extends: bases, ...own } = config;
|
|
25
|
+
let inherited = {};
|
|
26
|
+
for (const base of Array.isArray(bases) ? bases : bases ? [bases] : []) inherited = mergeViteSource(inherited, await resolveSource(base, env, parents));
|
|
27
|
+
return mergeViteSource(inherited, own);
|
|
28
|
+
} finally {
|
|
29
|
+
parents.delete(value);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** Project workflows support JSX without an extra feature flag. Legacy config stays unchanged. */
|
|
33
|
+
function projectConfigDefaults() {
|
|
34
|
+
return { typeChecker: { jsxTypecheck: true } };
|
|
35
|
+
}
|
|
36
|
+
/** Resolve just the native settings from an ordinary Vite or Vite+ export. */
|
|
37
|
+
async function resolveViteConfigExport$1(exported, env, configDir) {
|
|
38
|
+
env ??= {
|
|
39
|
+
mode: "development",
|
|
40
|
+
command: "serve"
|
|
41
|
+
};
|
|
42
|
+
if (env.command !== "build" && env.command !== "serve") env = {
|
|
43
|
+
...env,
|
|
44
|
+
command: "serve"
|
|
45
|
+
};
|
|
46
|
+
return projectViteConfigSource(await resolveSource(exported, env), env, configDir);
|
|
47
|
+
}
|
|
48
|
+
/** Project already evaluated settings; the owning adapter evaluates its Vite export once. */
|
|
49
|
+
async function projectViteConfigSource(source, env, configDir) {
|
|
50
|
+
if (!object(source)) throw new TypeError("Vite config source must be an object");
|
|
51
|
+
env ??= {
|
|
52
|
+
mode: "development",
|
|
53
|
+
command: "serve"
|
|
54
|
+
};
|
|
55
|
+
if (env.command !== "build" && env.command !== "serve") env = {
|
|
56
|
+
...env,
|
|
57
|
+
command: "serve"
|
|
58
|
+
};
|
|
59
|
+
const selected = vueConfigOptions(source);
|
|
60
|
+
const canonical = selected === void 0 ? {} : flatVueOptions(selected);
|
|
61
|
+
let shared = await (typeof source.vize === "function" ? source.vize(env) : source.vize);
|
|
62
|
+
const alias = object(shared) ? shared.lint : void 0;
|
|
63
|
+
if (object(shared)) {
|
|
64
|
+
const { lint: _lint, ...native } = shared;
|
|
65
|
+
shared = native;
|
|
66
|
+
}
|
|
67
|
+
const overrides = {};
|
|
68
|
+
if (object(source.compiler)) {
|
|
69
|
+
const { vueVersion, ...compiler } = source.compiler;
|
|
70
|
+
const version = vueVersion ?? compiler.compatibility?.vueVersion;
|
|
71
|
+
overrides.compiler = merge(compiler, version === void 0 ? {} : { compatibility: { vueVersion: String(version === .1 ? "0.10" : version === "legacy" ? 2 : version) } });
|
|
72
|
+
}
|
|
73
|
+
if (typeof source.typecheck === "boolean") overrides.typeChecker = { enabled: source.typecheck };
|
|
74
|
+
else if (object(source.typecheck)) overrides.typeChecker = source.typecheck;
|
|
75
|
+
const lint = source.lint?.vize === void 0 ? alias : source.lint.vize;
|
|
76
|
+
if (typeof lint === "boolean") overrides.linter = { enabled: lint };
|
|
77
|
+
else if (object(lint)) {
|
|
78
|
+
const { typecheck: _typecheck, locale: _locale, helpLevel: _helpLevel, ...native } = merge(object(alias) ? alias : {}, lint);
|
|
79
|
+
overrides.linter = native;
|
|
80
|
+
}
|
|
81
|
+
if (object(source.fmt)) {
|
|
82
|
+
const { vize, sortImports } = source.fmt;
|
|
83
|
+
overrides.formatter = merge(sortImports === void 0 ? {} : { sortImports }, object(vize) ? vize : {});
|
|
84
|
+
}
|
|
85
|
+
const root = typeof source.root === "string" ? resolve(configDir ?? ".", source.root) : configDir;
|
|
86
|
+
if (Array.isArray(shared)) {
|
|
87
|
+
const entries = canonical.entries;
|
|
88
|
+
const { entries: _entries, ...own } = canonical;
|
|
89
|
+
const retained = entries === void 0 ? shared : shared.filter(isUnscopedEntry);
|
|
90
|
+
return [
|
|
91
|
+
{
|
|
92
|
+
...projectConfigDefaults(),
|
|
93
|
+
...root ? { __vizeProjectRoot: root } : {}
|
|
94
|
+
},
|
|
95
|
+
...retained.map((entry) => projectPaths(entry, root, true)),
|
|
96
|
+
projectPaths({
|
|
97
|
+
...overlayVueOptions(overrides, own),
|
|
98
|
+
...root ? { __vizeProjectRoot: root } : {}
|
|
99
|
+
}, root, false),
|
|
100
|
+
...(entries ?? []).map((entry) => projectPaths(entry, root, true))
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
const config = overlayVueOptions(merge(merge(projectConfigDefaults(), shared ?? {}), overrides), canonical);
|
|
104
|
+
return root ? {
|
|
105
|
+
...projectPaths(config, root, false),
|
|
106
|
+
__vizeProjectRoot: root
|
|
107
|
+
} : config;
|
|
108
|
+
}
|
|
109
|
+
/** Validate only canonical settings; selecting them never evaluates a legacy callback. */
|
|
110
|
+
function vueConfigOptions(source) {
|
|
111
|
+
const selected = source.vue;
|
|
112
|
+
if (selected !== void 0) validateVueOption(selected, vueOptionSchema, "vue");
|
|
113
|
+
return selected;
|
|
114
|
+
}
|
|
115
|
+
/** Share canonical composition with adapters while their other Vite fields keep Vite merging. */
|
|
116
|
+
function mergeVueConfigOptions(base, own) {
|
|
117
|
+
vueConfigOptions({ vue: base });
|
|
118
|
+
vueConfigOptions({ vue: own });
|
|
119
|
+
if (base === void 0) return own;
|
|
120
|
+
if (own === void 0) return base;
|
|
121
|
+
return overlayVueOptions(base, own);
|
|
122
|
+
}
|
|
123
|
+
function mergeViteSource(base, own) {
|
|
124
|
+
const result = merge(base, own);
|
|
125
|
+
const selected = mergeVueConfigOptions(base.vue, own.vue);
|
|
126
|
+
if (selected !== void 0) result.vue = selected;
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
function flatVueOptions(selected) {
|
|
130
|
+
const { version, entries, ...sections } = selected;
|
|
131
|
+
return {
|
|
132
|
+
...sections,
|
|
133
|
+
...version === void 0 ? {} : { vue: { version } },
|
|
134
|
+
...entries === void 0 ? {} : { entries: entries.map(flatVueOptions) }
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function isUnscopedEntry(entry) {
|
|
138
|
+
return !object(entry) || [
|
|
139
|
+
"basePath",
|
|
140
|
+
"files",
|
|
141
|
+
"ignores"
|
|
142
|
+
].every((key) => entry[key] == null);
|
|
143
|
+
}
|
|
144
|
+
function overlayVueOptions(base, own) {
|
|
145
|
+
const result = { ...base };
|
|
146
|
+
for (const [key, value] of Object.entries(own)) {
|
|
147
|
+
if (value === void 0) continue;
|
|
148
|
+
const previous = Object.hasOwn(result, key) ? result[key] : void 0;
|
|
149
|
+
Object.defineProperty(result, key, {
|
|
150
|
+
value: object(value) && object(previous) ? overlayVueOptions(previous, value) : value,
|
|
151
|
+
enumerable: true,
|
|
152
|
+
configurable: true,
|
|
153
|
+
writable: true
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
function validateVueOption(value, schema, label) {
|
|
159
|
+
const refuse = (reason) => {
|
|
160
|
+
throw new TypeError(`${label}: ${reason}`);
|
|
161
|
+
};
|
|
162
|
+
if (schema.$ref) return validateVueOption(value, vueOptionSchema.definitions[schema.$ref.split("/").at(-1)], label);
|
|
163
|
+
if (schema.oneOf) {
|
|
164
|
+
if (schema.oneOf.filter((candidate) => {
|
|
165
|
+
try {
|
|
166
|
+
validateVueOption(value, candidate, label);
|
|
167
|
+
return true;
|
|
168
|
+
} catch (error) {
|
|
169
|
+
if (!(error instanceof TypeError)) throw error;
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
}).length !== 1) refuse("must match one documented native option type");
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (schema.enum && !schema.enum.includes(value)) refuse("unsupported native option value");
|
|
176
|
+
const valid = {
|
|
177
|
+
object: object(value),
|
|
178
|
+
array: Array.isArray(value),
|
|
179
|
+
string: typeof value === "string",
|
|
180
|
+
boolean: typeof value === "boolean",
|
|
181
|
+
integer: Number.isInteger(value),
|
|
182
|
+
number: typeof value === "number" && Number.isFinite(value),
|
|
183
|
+
null: value === null
|
|
184
|
+
};
|
|
185
|
+
if (schema.type && !valid[schema.type]) refuse(`must be ${schema.type}`);
|
|
186
|
+
if (schema.minimum !== void 0 && value < schema.minimum) refuse(`must be >= ${schema.minimum}`);
|
|
187
|
+
if (schema.maximum !== void 0 && value > schema.maximum) refuse(`must be <= ${schema.maximum}`);
|
|
188
|
+
if (Array.isArray(value) && schema.items) for (let index = 0; index < value.length; index++) validateVueOption(value[index], schema.items, `${label}[${index}]`);
|
|
189
|
+
if (object(value)) {
|
|
190
|
+
for (const required of schema.required ?? []) if (!Object.hasOwn(value, required) || value[required] === void 0) refuse(`missing ${required}`);
|
|
191
|
+
for (const [key, item] of Object.entries(value)) {
|
|
192
|
+
const documented = Object.hasOwn(schema.properties ?? {}, key);
|
|
193
|
+
if (!documented && schema.additionalProperties === false) refuse(`unknown option ${key}`);
|
|
194
|
+
if (schema.propertyNames?.pattern && !new RegExp(schema.propertyNames.pattern).test(key)) refuse(`invalid native option name ${key}`);
|
|
195
|
+
const rule = documented ? schema.properties[key] : schema.additionalProperties;
|
|
196
|
+
if (item !== void 0 && object(rule)) validateVueOption(item, rule, `${label}.${key}`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function projectPaths(config, root, entry) {
|
|
201
|
+
if (!root || !object(config)) return config;
|
|
202
|
+
const result = { ...config };
|
|
203
|
+
if (typeof config.basePath === "string" || config.files !== void 0 || entry && config.ignores !== void 0) result.basePath = resolve(root, config.basePath ?? ".");
|
|
204
|
+
if (Array.isArray(config.entries)) result.entries = config.entries.map((value) => projectPaths(value, root, true));
|
|
205
|
+
if (object(config.typeChecker)) {
|
|
206
|
+
result.typeChecker = { ...config.typeChecker };
|
|
207
|
+
for (const key of [
|
|
208
|
+
"tsconfig",
|
|
209
|
+
"corsaPath",
|
|
210
|
+
"tsgoPath",
|
|
211
|
+
"globalsFile"
|
|
212
|
+
]) if (typeof config.typeChecker[key] === "string") result.typeChecker[key] = resolve(root, config.typeChecker[key]);
|
|
213
|
+
}
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region src/config.ts
|
|
218
|
+
const require = createRequire(import.meta.url);
|
|
219
|
+
const CONFIG_FILE_NAMES = [
|
|
220
|
+
"vize.config.pkl",
|
|
221
|
+
"vize.config.ts",
|
|
222
|
+
"vize.config.js",
|
|
223
|
+
"vize.config.mjs",
|
|
224
|
+
"vize.config.json"
|
|
225
|
+
];
|
|
226
|
+
let vizeConfigModulePromise = null;
|
|
227
|
+
function loadVizeConfigModule() {
|
|
228
|
+
vizeConfigModulePromise ??= import("vize/config");
|
|
229
|
+
return vizeConfigModulePromise;
|
|
230
|
+
}
|
|
231
|
+
function defineConfig(config) {
|
|
232
|
+
return config;
|
|
233
|
+
}
|
|
234
|
+
async function loadConfig(root, options) {
|
|
235
|
+
return (await loadVizeConfigModule()).loadConfig(root, options);
|
|
236
|
+
}
|
|
237
|
+
async function resolveConfigExport(exported, env) {
|
|
238
|
+
return (await loadVizeConfigModule()).resolveConfigExport(exported, env);
|
|
239
|
+
}
|
|
240
|
+
/** Project shared settings from an already evaluated Vite config. */
|
|
241
|
+
async function resolveViteConfigExport(exported, env, configDir) {
|
|
242
|
+
const configModule = await loadVizeConfigModule();
|
|
243
|
+
if (typeof configModule.resolveViteConfigExport === "function") return configModule.resolveViteConfigExport(exported, env, configDir);
|
|
244
|
+
return configModule.resolveConfigExport(await resolveViteConfigExport$1(exported, env, configDir), env);
|
|
245
|
+
}
|
|
246
|
+
require.resolve("vize/schemas/vize.config.schema.json");
|
|
247
|
+
require.resolve("vize/pkl/vize.pkl");
|
|
248
|
+
[...CONFIG_FILE_NAMES];
|
|
249
|
+
const VIZE_CONFIG_FILE_ENV = "VIZE_CONFIG_FILE";
|
|
250
|
+
/**
|
|
251
|
+
* Shared config store for inter-plugin communication.
|
|
252
|
+
* Key = project root, Value = resolved VizeConfig.
|
|
253
|
+
*
|
|
254
|
+
* @deprecated Root identity cannot isolate parallel Vite client/SSR instances
|
|
255
|
+
* or servers. This export remains temporarily for compatibility; internal Vize
|
|
256
|
+
* integrations use an exact `ResolvedConfig`-scoped bridge instead.
|
|
257
|
+
*/
|
|
258
|
+
const vizeConfigStore = /* @__PURE__ */ new Map();
|
|
259
|
+
//#endregion
|
|
260
|
+
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, g as VueOptionsEntry, h as VueOptions, i as VizeVueFeatures, l as VizeVueVersion, m as UserConfigExport, n as CompiledModule, o as VizeInspectorLintPlanRequest, r as MacroArtifact, s as VizeInspectorOptions, t as VizeOptions, u as ConfigEnv, x as VizeConfig } from "./types-
|
|
1
|
+
import { a as VizeInspectorLintPlanProvider, c as VizeCompatibilityOptions, d as LoadConfigOptions, f as ResolvedVizeConfig, g as VueOptionsEntry, h as VueOptions, i as VizeVueFeatures, l as VizeVueVersion, m as UserConfigExport, n as CompiledModule, o as VizeInspectorLintPlanRequest, r as MacroArtifact, s as VizeInspectorOptions, t as VizeOptions, u as ConfigEnv, x as VizeConfig } from "./types-B3cTltTi.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 { u as rewriteStaticAssetUrls } from "./shared-config-
|
|
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-DMzAJRIw.mjs";
|
|
2
|
+
import { u as rewriteStaticAssetUrls } from "./shared-config-BU0TeQKs.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-DNse8RdN.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 isLegacyVueVersion, c as rewriteDynamicTemplateImports, d as shouldApplyDefineInVirtualModule, i as isLegacyVueCompatibilityMode, l as rewriteImportMetaGlobBase, n as resolveSharedConfig, o as applyDefineReplacements, r as createLegacyVueCompatibilityPlugin, s as createLogger, u as rewriteStaticAssetUrls } from "./shared-config-
|
|
2
|
-
import { o as vizeConfigStore } from "./config-
|
|
1
|
+
import { a as isLegacyVueVersion, c as rewriteDynamicTemplateImports, d as shouldApplyDefineInVirtualModule, i as isLegacyVueCompatibilityMode, l as rewriteImportMetaGlobBase, n as resolveSharedConfig, o as applyDefineReplacements, r as createLegacyVueCompatibilityPlugin, s as createLogger, u as rewriteStaticAssetUrls } from "./shared-config-BU0TeQKs.mjs";
|
|
2
|
+
import { o as vizeConfigStore } from "./config-DNse8RdN.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";
|
|
@@ -2473,8 +2473,9 @@ async function resolveIdHook(ctx, state, id, importer, options) {
|
|
|
2473
2473
|
const projectVueRuntime = await resolveProjectVueRuntime(ctx, state, id, importer, isSsrRequest);
|
|
2474
2474
|
if (projectVueRuntime) return projectVueRuntime;
|
|
2475
2475
|
if (pluginVisibleVirtualPath) {
|
|
2476
|
-
|
|
2477
|
-
|
|
2476
|
+
const resolvedPath = resolveVuePath(state, pluginVisibleVirtualPath, importer);
|
|
2477
|
+
if (isDependencyScan) return resolvedPath;
|
|
2478
|
+
return isSsrRequest ? toPluginVisibleVirtualId(resolvedPath, true, request.querySuffix) : `${resolvedPath}${request.querySuffix}`;
|
|
2478
2479
|
}
|
|
2479
2480
|
if (id.startsWith("\0")) {
|
|
2480
2481
|
if (request.isVizeVirtual) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as resolveConfigExport, r as loadConfig } from "./config-
|
|
1
|
+
import { i as resolveConfigExport, r as loadConfig } from "./config-DNse8RdN.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import path from "node:path";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as resolveViteConfigExport, i as resolveConfigExport, r as loadConfig } from "./config-
|
|
1
|
+
import { a as resolveViteConfigExport, i as resolveConfigExport, r as loadConfig } from "./config-DNse8RdN.mjs";
|
|
2
2
|
import { applyViteDefineReplacements, rewriteViteDynamicTemplateImports, rewriteViteImportMetaGlobBase, rewriteViteStaticAssetUrls, shouldApplyViteDefineInVirtualModule } from "@vizejs/native";
|
|
3
3
|
//#region src/transform.ts
|
|
4
4
|
/**
|
|
@@ -271,6 +271,9 @@ interface LintRuleOptions {
|
|
|
271
271
|
};
|
|
272
272
|
"vue/v-on-event-hyphenation"?: "always" | "never";
|
|
273
273
|
"vue/attribute-hyphenation"?: "always" | "never";
|
|
274
|
+
"vue/valid-v-on"?: {
|
|
275
|
+
modifiers?: string[];
|
|
276
|
+
};
|
|
274
277
|
"vue/valid-v-slot"?: {
|
|
275
278
|
allowModifiers?: boolean;
|
|
276
279
|
};
|
|
@@ -374,7 +377,7 @@ interface TypeCheckerConfig {
|
|
|
374
377
|
*/
|
|
375
378
|
globalsFile?: string;
|
|
376
379
|
/**
|
|
377
|
-
*
|
|
380
|
+
* Parallel Corsa CLI server count (1-32). Omit to auto-tune; 1 disables sharding.
|
|
378
381
|
*/
|
|
379
382
|
servers?: number;
|
|
380
383
|
/**
|
package/dist/vite-plus.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as CompilerConfig, b as TypeCheckerConfig, g as VueOptionsEntry, h as VueOptions, m as UserConfigExport, p as UserConfig$1, t as VizeOptions, v as FormatterConfig, y as LinterConfig } from "./types-
|
|
1
|
+
import { _ as CompilerConfig, b as TypeCheckerConfig, g as VueOptionsEntry, h as VueOptions, m as UserConfigExport, p as UserConfig$1, t as VizeOptions, v as FormatterConfig, y as LinterConfig } from "./types-B3cTltTi.mjs";
|
|
2
2
|
import { ConfigEnv, UserConfig, defineConfig as defineConfig$1 } from "vite-plus";
|
|
3
3
|
|
|
4
4
|
//#region src/vite-plus/types.d.ts
|
package/dist/vite-plus.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as isLegacyVueCompatibilityMode, t as mergeSharedConfig } from "./shared-config-
|
|
2
|
-
import { c as projectViteConfigSource, i as resolveConfigExport, l as vueConfigOptions, r as loadConfig, s as mergeVueConfigOptions } from "./config-
|
|
3
|
-
import { a as sourceConfigKey, i as resolveVitePlus, o as taskConfigKey, r as availableVueRules, t as runNative } from "./runner-
|
|
1
|
+
import { i as isLegacyVueCompatibilityMode, t as mergeSharedConfig } from "./shared-config-BU0TeQKs.mjs";
|
|
2
|
+
import { c as projectViteConfigSource, i as resolveConfigExport, l as vueConfigOptions, r as loadConfig, s as mergeVueConfigOptions } from "./config-DNse8RdN.mjs";
|
|
3
|
+
import { a as sourceConfigKey, i as resolveVitePlus, o as taskConfigKey, r as availableVueRules, t as runNative } from "./runner-Y2Iuaafy.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
@@ -368,7 +368,7 @@ function defineConfig(config = {}, integration = {}) {
|
|
|
368
368
|
const { options } = metadata;
|
|
369
369
|
const plugins = compiler === false || isLegacyVueCompatibilityMode(compiler) ? [...vp.plugins ?? []] : await withoutVueCompiler(vp.plugins ?? []);
|
|
370
370
|
if (compiler !== false) {
|
|
371
|
-
const { vize } = await import("./plugin-
|
|
371
|
+
const { vize } = await import("./plugin-CILRyPD1.mjs");
|
|
372
372
|
plugins.push(vize({
|
|
373
373
|
...compiler,
|
|
374
374
|
configMode: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.463.0",
|
|
4
4
|
"description": "High-performance native Vite plugin for Vue SFC compilation powered by Vize",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@vizejs/native": "0.
|
|
55
|
-
"@vizejs/unplugin": "0.
|
|
54
|
+
"@vizejs/native": "0.463.0",
|
|
55
|
+
"@vizejs/unplugin": "0.463.0",
|
|
56
56
|
"jsonc-parser": "^3.3.1",
|
|
57
57
|
"oxc-parser": "0.144.0",
|
|
58
58
|
"picomatch": "4.0.5",
|
|
59
59
|
"tinyglobby": "0.2.17",
|
|
60
|
-
"vize": "0.
|
|
60
|
+
"vize": "0.463.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/node": "25.9.2",
|
package/dist/config-CniehWXB.mjs
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
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\":{\"compiler\":{\"$ref\":\"#/definitions/CompilerConfig\"},\"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\":{\"VueVersion\":{\"type\":\"string\",\"enum\":[\"3\",\"2.7\",\"2\",\"1\",\"0.11\",\"0.10\"]},\"GlobalTypesConfig\":{\"type\":\"object\",\"additionalProperties\":{\"oneOf\":[{\"type\":\"string\"},{\"$ref\":\"#/definitions/GlobalTypeDeclaration\"}]}},\"GlobalTypeDeclaration\":{\"type\":\"object\",\"properties\":{\"type\":{\"type\":\"string\"},\"defaultValue\":{\"type\":\"string\"}},\"additionalProperties\":false,\"required\":[\"type\"]},\"LanguageServerConfig\":{\"type\":\"object\",\"properties\":{\"enabled\":{\"type\":\"boolean\"},\"lint\":{\"type\":\"boolean\"},\"diagnostics\":{\"type\":\"boolean\"},\"typecheck\":{\"type\":\"boolean\"},\"editor\":{\"type\":\"boolean\"},\"ecosystem\":{\"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},\"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\"]},\"LinterConfig\":{\"type\":\"object\",\"properties\":{\"enabled\":{\"type\":\"boolean\"},\"preset\":{\"type\":\"string\",\"enum\":[\"happy-path\",\"opinionated\",\"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-slot\":{\"type\":\"object\",\"properties\":{\"allowModifiers\":{\"type\":\"boolean\"}},\"additionalProperties\":false},\"musea/prefer-design-tokens\":{\"$ref\":\"#/definitions/MuseaPreferDesignTokensOptions\"}},\"additionalProperties\":false},\"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\"]},\"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\"]},\"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\"]},\"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\"},\"lspRequestTimeoutMs\":{\"type\":\"integer\",\"minimum\":1}},\"additionalProperties\":false},\"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},\"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 extends in Vize's Vite config");
|
|
19
|
-
parents.add(value);
|
|
20
|
-
try {
|
|
21
|
-
if (typeof value === "function" && 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
|
-
const { extends: bases, ...own } = config;
|
|
25
|
-
let inherited = {};
|
|
26
|
-
for (const base of Array.isArray(bases) ? bases : bases ? [bases] : []) inherited = mergeViteSource(inherited, await resolveSource(base, env, parents));
|
|
27
|
-
return mergeViteSource(inherited, own);
|
|
28
|
-
} finally {
|
|
29
|
-
parents.delete(value);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/** Project workflows support JSX without an extra feature flag. Legacy config stays unchanged. */
|
|
33
|
-
function projectConfigDefaults() {
|
|
34
|
-
return { typeChecker: { jsxTypecheck: true } };
|
|
35
|
-
}
|
|
36
|
-
/** Resolve just the native settings from an ordinary Vite or Vite+ export. */
|
|
37
|
-
async function resolveViteConfigExport$1(exported, env, configDir) {
|
|
38
|
-
env ??= {
|
|
39
|
-
mode: "development",
|
|
40
|
-
command: "serve"
|
|
41
|
-
};
|
|
42
|
-
if (env.command !== "build" && env.command !== "serve") env = {
|
|
43
|
-
...env,
|
|
44
|
-
command: "serve"
|
|
45
|
-
};
|
|
46
|
-
return projectViteConfigSource(await resolveSource(exported, env), env, configDir);
|
|
47
|
-
}
|
|
48
|
-
/** Project already evaluated settings; the owning adapter evaluates its Vite export once. */
|
|
49
|
-
async function projectViteConfigSource(source, env, configDir) {
|
|
50
|
-
if (!object(source)) throw new TypeError("Vite config source must be an object");
|
|
51
|
-
env ??= {
|
|
52
|
-
mode: "development",
|
|
53
|
-
command: "serve"
|
|
54
|
-
};
|
|
55
|
-
if (env.command !== "build" && env.command !== "serve") env = {
|
|
56
|
-
...env,
|
|
57
|
-
command: "serve"
|
|
58
|
-
};
|
|
59
|
-
const selected = vueConfigOptions(source);
|
|
60
|
-
const canonical = selected === void 0 ? {} : flatVueOptions(selected);
|
|
61
|
-
let shared = await (typeof source.vize === "function" ? source.vize(env) : source.vize);
|
|
62
|
-
const alias = object(shared) ? shared.lint : void 0;
|
|
63
|
-
if (object(shared)) {
|
|
64
|
-
const { lint: _lint, ...native } = shared;
|
|
65
|
-
shared = native;
|
|
66
|
-
}
|
|
67
|
-
const overrides = {};
|
|
68
|
-
if (object(source.compiler)) {
|
|
69
|
-
const { vueVersion, ...compiler } = source.compiler;
|
|
70
|
-
const version = vueVersion ?? compiler.compatibility?.vueVersion;
|
|
71
|
-
overrides.compiler = merge(compiler, version === void 0 ? {} : { compatibility: { vueVersion: String(version === .1 ? "0.10" : version === "legacy" ? 2 : version) } });
|
|
72
|
-
}
|
|
73
|
-
if (typeof source.typecheck === "boolean") overrides.typeChecker = { enabled: source.typecheck };
|
|
74
|
-
else if (object(source.typecheck)) overrides.typeChecker = source.typecheck;
|
|
75
|
-
const lint = source.lint?.vize === void 0 ? alias : source.lint.vize;
|
|
76
|
-
if (typeof lint === "boolean") overrides.linter = { enabled: lint };
|
|
77
|
-
else if (object(lint)) {
|
|
78
|
-
const { typecheck: _typecheck, locale: _locale, helpLevel: _helpLevel, ...native } = merge(object(alias) ? alias : {}, lint);
|
|
79
|
-
overrides.linter = native;
|
|
80
|
-
}
|
|
81
|
-
if (object(source.fmt)) {
|
|
82
|
-
const { vize, sortImports } = source.fmt;
|
|
83
|
-
overrides.formatter = merge(sortImports === void 0 ? {} : { sortImports }, object(vize) ? vize : {});
|
|
84
|
-
}
|
|
85
|
-
const root = typeof source.root === "string" ? resolve(configDir ?? ".", source.root) : configDir;
|
|
86
|
-
if (Array.isArray(shared)) {
|
|
87
|
-
const entries = canonical.entries;
|
|
88
|
-
const { entries: _entries, ...own } = canonical;
|
|
89
|
-
const retained = entries === void 0 ? shared : shared.filter(isUnscopedEntry);
|
|
90
|
-
return [
|
|
91
|
-
{
|
|
92
|
-
...projectConfigDefaults(),
|
|
93
|
-
...root ? { __vizeProjectRoot: root } : {}
|
|
94
|
-
},
|
|
95
|
-
...retained.map((entry) => projectPaths(entry, root, true)),
|
|
96
|
-
projectPaths({
|
|
97
|
-
...overlayVueOptions(overrides, own),
|
|
98
|
-
...root ? { __vizeProjectRoot: root } : {}
|
|
99
|
-
}, root, false),
|
|
100
|
-
...(entries ?? []).map((entry) => projectPaths(entry, root, true))
|
|
101
|
-
];
|
|
102
|
-
}
|
|
103
|
-
const config = overlayVueOptions(merge(merge(projectConfigDefaults(), shared ?? {}), overrides), canonical);
|
|
104
|
-
return root ? {
|
|
105
|
-
...projectPaths(config, root, false),
|
|
106
|
-
__vizeProjectRoot: root
|
|
107
|
-
} : config;
|
|
108
|
-
}
|
|
109
|
-
/** Validate only canonical settings; selecting them never evaluates a legacy callback. */
|
|
110
|
-
function vueConfigOptions(source) {
|
|
111
|
-
const selected = source.vue;
|
|
112
|
-
if (selected !== void 0) validateVueOption(selected, vueOptionSchema, "vue");
|
|
113
|
-
return selected;
|
|
114
|
-
}
|
|
115
|
-
/** Share canonical composition with adapters while their other Vite fields keep Vite merging. */
|
|
116
|
-
function mergeVueConfigOptions(base, own) {
|
|
117
|
-
vueConfigOptions({ vue: base });
|
|
118
|
-
vueConfigOptions({ vue: own });
|
|
119
|
-
if (base === void 0) return own;
|
|
120
|
-
if (own === void 0) return base;
|
|
121
|
-
return overlayVueOptions(base, own);
|
|
122
|
-
}
|
|
123
|
-
function mergeViteSource(base, own) {
|
|
124
|
-
const result = merge(base, own);
|
|
125
|
-
const selected = mergeVueConfigOptions(base.vue, own.vue);
|
|
126
|
-
if (selected !== void 0) result.vue = selected;
|
|
127
|
-
return result;
|
|
128
|
-
}
|
|
129
|
-
function flatVueOptions(selected) {
|
|
130
|
-
const { version, entries, ...sections } = selected;
|
|
131
|
-
return {
|
|
132
|
-
...sections,
|
|
133
|
-
...version === void 0 ? {} : { vue: { version } },
|
|
134
|
-
...entries === void 0 ? {} : { entries: entries.map(flatVueOptions) }
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function isUnscopedEntry(entry) {
|
|
138
|
-
return !object(entry) || [
|
|
139
|
-
"basePath",
|
|
140
|
-
"files",
|
|
141
|
-
"ignores"
|
|
142
|
-
].every((key) => entry[key] == null);
|
|
143
|
-
}
|
|
144
|
-
function overlayVueOptions(base, own) {
|
|
145
|
-
const result = { ...base };
|
|
146
|
-
for (const [key, value] of Object.entries(own)) {
|
|
147
|
-
if (value === void 0) continue;
|
|
148
|
-
const previous = Object.hasOwn(result, key) ? result[key] : void 0;
|
|
149
|
-
Object.defineProperty(result, key, {
|
|
150
|
-
value: object(value) && object(previous) ? overlayVueOptions(previous, value) : value,
|
|
151
|
-
enumerable: true,
|
|
152
|
-
configurable: true,
|
|
153
|
-
writable: true
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
return result;
|
|
157
|
-
}
|
|
158
|
-
function validateVueOption(value, schema, label) {
|
|
159
|
-
const refuse = (reason) => {
|
|
160
|
-
throw new TypeError(`${label}: ${reason}`);
|
|
161
|
-
};
|
|
162
|
-
if (schema.$ref) return validateVueOption(value, vueOptionSchema.definitions[schema.$ref.split("/").at(-1)], label);
|
|
163
|
-
if (schema.oneOf) {
|
|
164
|
-
if (schema.oneOf.filter((candidate) => {
|
|
165
|
-
try {
|
|
166
|
-
validateVueOption(value, candidate, label);
|
|
167
|
-
return true;
|
|
168
|
-
} catch (error) {
|
|
169
|
-
if (!(error instanceof TypeError)) throw error;
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
}).length !== 1) refuse("must match one documented native option type");
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
if (schema.enum && !schema.enum.includes(value)) refuse("unsupported native option value");
|
|
176
|
-
const valid = {
|
|
177
|
-
object: object(value),
|
|
178
|
-
array: Array.isArray(value),
|
|
179
|
-
string: typeof value === "string",
|
|
180
|
-
boolean: typeof value === "boolean",
|
|
181
|
-
integer: Number.isInteger(value),
|
|
182
|
-
number: typeof value === "number" && Number.isFinite(value),
|
|
183
|
-
null: value === null
|
|
184
|
-
};
|
|
185
|
-
if (schema.type && !valid[schema.type]) refuse(`must be ${schema.type}`);
|
|
186
|
-
if (schema.minimum !== void 0 && value < schema.minimum) refuse(`must be >= ${schema.minimum}`);
|
|
187
|
-
if (Array.isArray(value) && schema.items) for (let index = 0; index < value.length; index++) validateVueOption(value[index], schema.items, `${label}[${index}]`);
|
|
188
|
-
if (object(value)) {
|
|
189
|
-
for (const required of schema.required ?? []) if (!Object.hasOwn(value, required) || value[required] === void 0) refuse(`missing ${required}`);
|
|
190
|
-
for (const [key, item] of Object.entries(value)) {
|
|
191
|
-
const documented = Object.hasOwn(schema.properties ?? {}, key);
|
|
192
|
-
if (!documented && schema.additionalProperties === false) refuse(`unknown option ${key}`);
|
|
193
|
-
if (schema.propertyNames?.pattern && !new RegExp(schema.propertyNames.pattern).test(key)) refuse(`invalid native option name ${key}`);
|
|
194
|
-
const rule = documented ? schema.properties[key] : schema.additionalProperties;
|
|
195
|
-
if (item !== void 0 && object(rule)) validateVueOption(item, rule, `${label}.${key}`);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
function projectPaths(config, root, entry) {
|
|
200
|
-
if (!root || !object(config)) return config;
|
|
201
|
-
const result = { ...config };
|
|
202
|
-
if (typeof config.basePath === "string" || config.files !== void 0 || entry && config.ignores !== void 0) result.basePath = resolve(root, config.basePath ?? ".");
|
|
203
|
-
if (Array.isArray(config.entries)) result.entries = config.entries.map((value) => projectPaths(value, root, true));
|
|
204
|
-
if (object(config.typeChecker)) {
|
|
205
|
-
result.typeChecker = { ...config.typeChecker };
|
|
206
|
-
for (const key of [
|
|
207
|
-
"tsconfig",
|
|
208
|
-
"corsaPath",
|
|
209
|
-
"tsgoPath",
|
|
210
|
-
"globalsFile"
|
|
211
|
-
]) if (typeof config.typeChecker[key] === "string") result.typeChecker[key] = resolve(root, config.typeChecker[key]);
|
|
212
|
-
}
|
|
213
|
-
return result;
|
|
214
|
-
}
|
|
215
|
-
//#endregion
|
|
216
|
-
//#region src/config.ts
|
|
217
|
-
const require = createRequire(import.meta.url);
|
|
218
|
-
const CONFIG_FILE_NAMES = [
|
|
219
|
-
"vize.config.pkl",
|
|
220
|
-
"vize.config.ts",
|
|
221
|
-
"vize.config.js",
|
|
222
|
-
"vize.config.mjs",
|
|
223
|
-
"vize.config.json"
|
|
224
|
-
];
|
|
225
|
-
let vizeConfigModulePromise = null;
|
|
226
|
-
function loadVizeConfigModule() {
|
|
227
|
-
vizeConfigModulePromise ??= import("vize/config");
|
|
228
|
-
return vizeConfigModulePromise;
|
|
229
|
-
}
|
|
230
|
-
function defineConfig(config) {
|
|
231
|
-
return config;
|
|
232
|
-
}
|
|
233
|
-
async function loadConfig(root, options) {
|
|
234
|
-
return (await loadVizeConfigModule()).loadConfig(root, options);
|
|
235
|
-
}
|
|
236
|
-
async function resolveConfigExport(exported, env) {
|
|
237
|
-
return (await loadVizeConfigModule()).resolveConfigExport(exported, env);
|
|
238
|
-
}
|
|
239
|
-
/** Project shared settings from an already evaluated Vite config. */
|
|
240
|
-
async function resolveViteConfigExport(exported, env, configDir) {
|
|
241
|
-
const configModule = await loadVizeConfigModule();
|
|
242
|
-
if (typeof configModule.resolveViteConfigExport === "function") return configModule.resolveViteConfigExport(exported, env, configDir);
|
|
243
|
-
return configModule.resolveConfigExport(await resolveViteConfigExport$1(exported, env, configDir), env);
|
|
244
|
-
}
|
|
245
|
-
require.resolve("vize/schemas/vize.config.schema.json");
|
|
246
|
-
require.resolve("vize/pkl/vize.pkl");
|
|
247
|
-
[...CONFIG_FILE_NAMES];
|
|
248
|
-
const VIZE_CONFIG_FILE_ENV = "VIZE_CONFIG_FILE";
|
|
249
|
-
/**
|
|
250
|
-
* Shared config store for inter-plugin communication.
|
|
251
|
-
* Key = project root, Value = resolved VizeConfig.
|
|
252
|
-
*
|
|
253
|
-
* @deprecated Root identity cannot isolate parallel Vite client/SSR instances
|
|
254
|
-
* or servers. This export remains temporarily for compatibility; internal Vize
|
|
255
|
-
* integrations use an exact `ResolvedConfig`-scoped bridge instead.
|
|
256
|
-
*/
|
|
257
|
-
const vizeConfigStore = /* @__PURE__ */ new Map();
|
|
258
|
-
//#endregion
|
|
259
|
-
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/plugin-VmflBZfL.mjs
DELETED