@vizejs/vite-plugin 0.515.0 → 0.516.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/client.d.ts +36 -0
- package/dist/config-DmGDWCMT.mjs +325 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/internal/config-bridge.d.mts +1 -1
- package/dist/internal/vite-plus-task.mjs +1 -1
- package/dist/plugin-CjEbYGJ7.mjs +2 -0
- package/dist/{plugin-BFYuWqsI.mjs → plugin-DkbkkirH.mjs} +61 -23
- package/dist/{runner-DAk3-NIF.mjs → runner-DmWiQu3U.mjs} +3 -3
- package/dist/{types-mokrREyg.d.mts → types-CIVbtOza.d.mts} +26 -1
- package/dist/vite-plus.d.mts +1 -1
- package/dist/vite-plus.mjs +52 -13
- package/package.json +5 -4
- package/dist/config-D7Ah2hEd.mjs +0 -247
- package/dist/plugin-BmsOHaS3.mjs +0 -2
- package/dist/{editor-Dtf01qrY.mjs → editor-BUjSkAzE.mjs} +1 -1
package/client.d.ts
CHANGED
|
@@ -4,3 +4,39 @@ declare module "*.vue" {
|
|
|
4
4
|
const component: DefineComponent<{}, {}, any>;
|
|
5
5
|
export default component;
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
declare module "*.md" {
|
|
9
|
+
import type { DefineComponent } from "vue";
|
|
10
|
+
|
|
11
|
+
export interface OxContentTocEntry {
|
|
12
|
+
depth: number;
|
|
13
|
+
text: string;
|
|
14
|
+
slug: string;
|
|
15
|
+
children: OxContentTocEntry[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const html: string;
|
|
19
|
+
export const frontmatter: Record<string, unknown>;
|
|
20
|
+
export const toc: OxContentTocEntry[];
|
|
21
|
+
|
|
22
|
+
const component: DefineComponent<{}, {}, any>;
|
|
23
|
+
export default component;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare module "*.markdown" {
|
|
27
|
+
import type { DefineComponent } from "vue";
|
|
28
|
+
|
|
29
|
+
export interface OxContentTocEntry {
|
|
30
|
+
depth: number;
|
|
31
|
+
text: string;
|
|
32
|
+
slug: string;
|
|
33
|
+
children: OxContentTocEntry[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const html: string;
|
|
37
|
+
export const frontmatter: Record<string, unknown>;
|
|
38
|
+
export const toc: OxContentTocEntry[];
|
|
39
|
+
|
|
40
|
+
const component: DefineComponent<{}, {}, any>;
|
|
41
|
+
export default component;
|
|
42
|
+
}
|
|
@@ -0,0 +1,325 @@
|
|
|
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\"},\"compile\":{\"$ref\":\"#/definitions/CompilerConfig\"},\"typeCheck\":{\"$ref\":\"#/definitions/TypeCheckerConfig\"},\"fmt\":{\"$ref\":\"#/definitions/FormatterConfig\"},\"lint\":{\"type\":\"object\",\"required\":[\"jsPlugins\",\"plugins\",\"rules\",\"settings\"],\"properties\":{\"jsPlugins\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"plugins\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"rules\":{\"type\":\"object\",\"additionalProperties\":true},\"settings\":{\"type\":\"object\",\"additionalProperties\":true},\"ignorePatterns\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"overrides\":{\"type\":\"array\"}},\"additionalProperties\":true},\"version\":{\"$ref\":\"#/definitions/VueVersion\"},\"entries\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"basePath\":{\"type\":\"string\"},\"files\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"ignores\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"compiler\":{\"$ref\":\"#/definitions/CompilerConfig\"},\"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\"},\"tsrsPath\":{\"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-macros-order\":{\"type\":\"object\",\"properties\":{\"order\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"minLength\":1},\"uniqueItems\":true}},\"additionalProperties\":false},\"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/v-on-style\":{\"type\":\"string\",\"enum\":[\"shorthand\",\"longform\"]},\"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\":{\"preset\":{\"type\":\"string\",\"enum\":[\"vize\",\"prettier\"]},\"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\"},\"normalizeCssQuotes\":{\"type\":\"boolean\"},\"normalizeInlineStyles\":{\"type\":\"boolean\"},\"normalizeVForParens\":{\"type\":\"boolean\"},\"selfCloseVoidElements\":{\"type\":\"boolean\"},\"reindentPreprocessorStyles\":{\"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 resolveViteConfigSource(exported, env), env, configDir);
|
|
62
|
+
}
|
|
63
|
+
/** Resolve an authored Vite export without projecting away Vite-owned task settings. */
|
|
64
|
+
async function resolveViteConfigSource(exported, env) {
|
|
65
|
+
env ??= {
|
|
66
|
+
mode: "development",
|
|
67
|
+
command: "serve"
|
|
68
|
+
};
|
|
69
|
+
if (env.command !== "build" && env.command !== "serve") env = {
|
|
70
|
+
...env,
|
|
71
|
+
command: "serve"
|
|
72
|
+
};
|
|
73
|
+
return resolveSource(exported, env);
|
|
74
|
+
}
|
|
75
|
+
/** Project already evaluated settings; the owning adapter evaluates its Vite export once. */
|
|
76
|
+
async function projectViteConfigSource(source, env, configDir) {
|
|
77
|
+
if (!object(source)) throw new TypeError("Vite config source must be an object");
|
|
78
|
+
env ??= {
|
|
79
|
+
mode: "development",
|
|
80
|
+
command: "serve"
|
|
81
|
+
};
|
|
82
|
+
if (env.command !== "build" && env.command !== "serve") env = {
|
|
83
|
+
...env,
|
|
84
|
+
command: "serve"
|
|
85
|
+
};
|
|
86
|
+
rejectLegacyConfig(source);
|
|
87
|
+
const selected = normalizeVueConfigOptions(source);
|
|
88
|
+
const canonical = selected === void 0 ? {} : flatVueOptions(selected);
|
|
89
|
+
const overrides = {};
|
|
90
|
+
if (object(source.compiler)) {
|
|
91
|
+
const { vueVersion, ...compiler } = source.compiler;
|
|
92
|
+
const version = vueVersion ?? compiler.compatibility?.vueVersion;
|
|
93
|
+
overrides.compiler = merge(compiler, version === void 0 ? {} : { compatibility: { vueVersion: String(version === .1 ? "0.10" : version === "legacy" ? 2 : version) } });
|
|
94
|
+
}
|
|
95
|
+
if (typeof source.typecheck === "boolean") overrides.typeChecker = { enabled: source.typecheck };
|
|
96
|
+
else if (object(source.typecheck)) overrides.typeChecker = source.typecheck;
|
|
97
|
+
const lint = source.lint?.vue;
|
|
98
|
+
if (typeof lint === "boolean") overrides.linter = { enabled: lint };
|
|
99
|
+
else if (object(lint)) {
|
|
100
|
+
const { typecheck: _typecheck, locale: _locale, helpLevel: _helpLevel, ...native } = lint;
|
|
101
|
+
overrides.linter = native;
|
|
102
|
+
}
|
|
103
|
+
if (object(source.fmt)) {
|
|
104
|
+
const { vue, sortImports } = source.fmt;
|
|
105
|
+
overrides.formatter = merge(sortImports === void 0 ? {} : { sortImports }, object(vue) ? vue : {});
|
|
106
|
+
}
|
|
107
|
+
const root = typeof source.root === "string" ? resolve(configDir ?? ".", source.root) : configDir;
|
|
108
|
+
const config = overlayVueOptions(merge(projectConfigDefaults(), overrides), canonical);
|
|
109
|
+
return root ? {
|
|
110
|
+
...projectPaths(config, root, false),
|
|
111
|
+
__vizeProjectRoot: root
|
|
112
|
+
} : config;
|
|
113
|
+
}
|
|
114
|
+
/** Validate only canonical settings; selecting them never evaluates a legacy callback. */
|
|
115
|
+
function vueConfigOptions(source) {
|
|
116
|
+
const selected = source.vue;
|
|
117
|
+
if (selected !== void 0) {
|
|
118
|
+
validateVueOption(selected, vueOptionSchema, "vue");
|
|
119
|
+
assertVueActionAliases(selected, "vue");
|
|
120
|
+
}
|
|
121
|
+
return selected;
|
|
122
|
+
}
|
|
123
|
+
/** Resolve preferred action names to the native section names without mutating authored input. */
|
|
124
|
+
function normalizeVueConfigOptions(source) {
|
|
125
|
+
const selected = vueConfigOptions(source);
|
|
126
|
+
return selected === void 0 ? void 0 : normalizeVueActionAliases(selected, "vue");
|
|
127
|
+
}
|
|
128
|
+
/** Share canonical composition with adapters while their other Vite fields keep Vite merging. */
|
|
129
|
+
function mergeVueConfigOptions(base, own) {
|
|
130
|
+
vueConfigOptions({ vue: base });
|
|
131
|
+
vueConfigOptions({ vue: own });
|
|
132
|
+
if (base === void 0) return own;
|
|
133
|
+
if (own === void 0) return base;
|
|
134
|
+
const result = overlayVueOptions(base, own);
|
|
135
|
+
vueConfigOptions({ vue: result });
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
const vueActionAliases = [
|
|
139
|
+
["compile", "compiler"],
|
|
140
|
+
["typeCheck", "typeChecker"],
|
|
141
|
+
["fmt", "formatter"]
|
|
142
|
+
];
|
|
143
|
+
function assertVueActionAliases(value, label) {
|
|
144
|
+
for (const [action, compatibility] of vueActionAliases) if (value[action] !== void 0 && value[compatibility] !== void 0) throw new TypeError(`${label}.${action}: conflicts with compatibility alias ${label}.${compatibility}; remove ${label}.${compatibility} and use ${label}.${action}`);
|
|
145
|
+
if (value.lint !== void 0 && value.linter !== void 0) throw new TypeError(`${label}.lint: conflicts with compatibility alias ${label}.linter; remove ${label}.linter and use ${label}.lint, with native rules under settings.vize`);
|
|
146
|
+
for (let index = 0; index < (value.entries?.length ?? 0); index++) assertVueActionAliases(value.entries[index], `${label}.entries[${index}]`);
|
|
147
|
+
}
|
|
148
|
+
function normalizeVueActionAliases(value, label) {
|
|
149
|
+
assertVueActionAliases(value, label);
|
|
150
|
+
const result = { ...value };
|
|
151
|
+
for (const [action, compatibility] of vueActionAliases) {
|
|
152
|
+
if (result[action] === void 0) continue;
|
|
153
|
+
result[compatibility] = result[action];
|
|
154
|
+
delete result[action];
|
|
155
|
+
}
|
|
156
|
+
if (result.lint !== void 0) {
|
|
157
|
+
const lint = result.lint;
|
|
158
|
+
const linter = projectVitePlusLintConfig(lint);
|
|
159
|
+
validateVueOption(linter, { $ref: "#/definitions/LinterConfig" }, `${label}.lint`);
|
|
160
|
+
result.linter = linter;
|
|
161
|
+
delete result.lint;
|
|
162
|
+
const projectedEntries = projectVitePlusLintOverrides(lint, `${label}.lint`);
|
|
163
|
+
if (projectedEntries.length !== 0) result.entries = [...projectedEntries, ...result.entries ?? []];
|
|
164
|
+
}
|
|
165
|
+
if (Array.isArray(result.entries)) result.entries = result.entries.map((entry, index) => normalizeVueActionAliases(entry, `${label}.entries[${index}]`));
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
function projectVitePlusLintConfig(lint) {
|
|
169
|
+
const settings = object(lint.settings?.vize) ? lint.settings.vize : {};
|
|
170
|
+
const linter = {};
|
|
171
|
+
for (const key of ["preset", "typeAware"]) if (settings[key] !== void 0) linter[key] = settings[key];
|
|
172
|
+
const rules = {};
|
|
173
|
+
const ruleOptions = {};
|
|
174
|
+
for (const [id, entry] of Object.entries(object(lint.rules) ? lint.rules : {})) {
|
|
175
|
+
if (!id.startsWith("vize/")) continue;
|
|
176
|
+
const name = id.slice(5);
|
|
177
|
+
const rawSeverity = Array.isArray(entry) ? entry[0] : entry;
|
|
178
|
+
const severity = rawSeverity === 1 ? "warn" : rawSeverity === 2 ? "error" : rawSeverity;
|
|
179
|
+
if (severity === "off" || severity === "warn" || severity === "error") rules[name] = severity;
|
|
180
|
+
if (Array.isArray(entry) && entry[1] !== void 0) ruleOptions[name] = entry[1];
|
|
181
|
+
}
|
|
182
|
+
if (Object.keys(rules).length !== 0) linter.rules = rules;
|
|
183
|
+
if (Object.keys(ruleOptions).length !== 0) linter.ruleOptions = ruleOptions;
|
|
184
|
+
return linter;
|
|
185
|
+
}
|
|
186
|
+
function projectVitePlusLintOverrides(lint, label) {
|
|
187
|
+
if (!Array.isArray(lint.overrides)) return [];
|
|
188
|
+
return lint.overrides.flatMap((override, index) => {
|
|
189
|
+
if (!object(override)) return [];
|
|
190
|
+
const linter = projectVitePlusLintConfig(override);
|
|
191
|
+
if (linter.rules === void 0 && linter.ruleOptions === void 0) return [];
|
|
192
|
+
validateVueOption(linter, { $ref: "#/definitions/LinterConfig" }, `${label}.overrides[${index}]`);
|
|
193
|
+
const files = stringArray(override.files, `${label}.overrides[${index}].files`);
|
|
194
|
+
const ignores = override.excludeFiles === void 0 ? void 0 : stringArray(override.excludeFiles, `${label}.overrides[${index}].excludeFiles`);
|
|
195
|
+
return [{
|
|
196
|
+
files,
|
|
197
|
+
...ignores === void 0 ? {} : { ignores },
|
|
198
|
+
linter
|
|
199
|
+
}];
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function stringArray(value, label) {
|
|
203
|
+
if (!Array.isArray(value) || !value.every((entry) => typeof entry === "string")) throw new TypeError(`${label}: must be an array of strings to project vize/* rules`);
|
|
204
|
+
return [...value];
|
|
205
|
+
}
|
|
206
|
+
function flatVueOptions(selected) {
|
|
207
|
+
const { version, entries, ...sections } = selected;
|
|
208
|
+
return {
|
|
209
|
+
...sections,
|
|
210
|
+
...version === void 0 ? {} : { vue: { version } },
|
|
211
|
+
...entries === void 0 ? {} : { entries: entries.map(flatVueOptions) }
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function overlayVueOptions(base, own) {
|
|
215
|
+
const result = { ...base };
|
|
216
|
+
for (const [key, value] of Object.entries(own)) {
|
|
217
|
+
if (value === void 0) continue;
|
|
218
|
+
const previous = Object.hasOwn(result, key) ? result[key] : void 0;
|
|
219
|
+
Object.defineProperty(result, key, {
|
|
220
|
+
value: object(value) && object(previous) ? overlayVueOptions(previous, value) : value,
|
|
221
|
+
enumerable: true,
|
|
222
|
+
configurable: true,
|
|
223
|
+
writable: true
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
function validateVueOption(value, schema, label) {
|
|
229
|
+
const refuse = (reason) => {
|
|
230
|
+
throw new TypeError(`${label}: ${reason}`);
|
|
231
|
+
};
|
|
232
|
+
if (schema.$ref) return validateVueOption(value, vueOptionSchema.definitions[schema.$ref.split("/").at(-1)], label);
|
|
233
|
+
if (schema.oneOf) {
|
|
234
|
+
if (schema.oneOf.filter((candidate) => {
|
|
235
|
+
try {
|
|
236
|
+
validateVueOption(value, candidate, label);
|
|
237
|
+
return true;
|
|
238
|
+
} catch (error) {
|
|
239
|
+
if (!(error instanceof TypeError)) throw error;
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
}).length !== 1) refuse("must match one documented native option type");
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (schema.enum && !schema.enum.includes(value)) refuse("unsupported native option value");
|
|
246
|
+
const valid = {
|
|
247
|
+
object: object(value),
|
|
248
|
+
array: Array.isArray(value),
|
|
249
|
+
string: typeof value === "string",
|
|
250
|
+
boolean: typeof value === "boolean",
|
|
251
|
+
integer: Number.isInteger(value),
|
|
252
|
+
number: typeof value === "number" && Number.isFinite(value),
|
|
253
|
+
null: value === null
|
|
254
|
+
};
|
|
255
|
+
if (schema.type && !valid[schema.type]) refuse(`must be ${schema.type}`);
|
|
256
|
+
if (schema.minimum !== void 0 && value < schema.minimum) refuse(`must be >= ${schema.minimum}`);
|
|
257
|
+
if (schema.maximum !== void 0 && value > schema.maximum) refuse(`must be <= ${schema.maximum}`);
|
|
258
|
+
if (Array.isArray(value) && schema.items) for (let index = 0; index < value.length; index++) validateVueOption(value[index], schema.items, `${label}[${index}]`);
|
|
259
|
+
if (object(value)) {
|
|
260
|
+
for (const required of schema.required ?? []) if (!Object.hasOwn(value, required) || value[required] === void 0) refuse(`missing ${required}`);
|
|
261
|
+
for (const [key, item] of Object.entries(value)) {
|
|
262
|
+
const documented = Object.hasOwn(schema.properties ?? {}, key);
|
|
263
|
+
if (!documented && schema.additionalProperties === false) refuse(`unknown option "${key}"`);
|
|
264
|
+
if (schema.propertyNames?.pattern && !new RegExp(schema.propertyNames.pattern).test(key)) refuse(`invalid native option name ${key}`);
|
|
265
|
+
const rule = documented ? schema.properties[key] : schema.additionalProperties;
|
|
266
|
+
if (item !== void 0 && object(rule)) validateVueOption(item, rule, `${label}.${key}`);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
function projectPaths(config, root, entry) {
|
|
271
|
+
if (!root || !object(config)) return config;
|
|
272
|
+
const result = { ...config };
|
|
273
|
+
if (typeof config.basePath === "string" || config.files !== void 0 || entry && config.ignores !== void 0) result.basePath = resolve(root, config.basePath ?? ".");
|
|
274
|
+
if (Array.isArray(config.entries)) result.entries = config.entries.map((value) => projectPaths(value, root, true));
|
|
275
|
+
if (object(config.typeChecker)) {
|
|
276
|
+
result.typeChecker = { ...config.typeChecker };
|
|
277
|
+
for (const key of [
|
|
278
|
+
"tsconfig",
|
|
279
|
+
"corsaPath",
|
|
280
|
+
"tsgoPath",
|
|
281
|
+
"tsrsPath",
|
|
282
|
+
"globalsFile"
|
|
283
|
+
]) if (typeof config.typeChecker[key] === "string") result.typeChecker[key] = resolve(root, config.typeChecker[key]);
|
|
284
|
+
}
|
|
285
|
+
return result;
|
|
286
|
+
}
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region src/config.ts
|
|
289
|
+
const require = createRequire(import.meta.url);
|
|
290
|
+
const CONFIG_FILE_NAMES = VITE_CONFIG_FILE_NAMES;
|
|
291
|
+
let vizeConfigModulePromise = null;
|
|
292
|
+
function loadVizeConfigModule() {
|
|
293
|
+
vizeConfigModulePromise ??= import("vize/config");
|
|
294
|
+
return vizeConfigModulePromise;
|
|
295
|
+
}
|
|
296
|
+
function defineConfig(config) {
|
|
297
|
+
return config;
|
|
298
|
+
}
|
|
299
|
+
async function loadConfig(root, options) {
|
|
300
|
+
return (await loadVizeConfigModule()).loadConfig(root, options);
|
|
301
|
+
}
|
|
302
|
+
async function resolveConfigExport(exported, env) {
|
|
303
|
+
return (await loadVizeConfigModule()).resolveConfigExport(exported, env);
|
|
304
|
+
}
|
|
305
|
+
/** Project shared settings from an already evaluated Vite config. */
|
|
306
|
+
async function resolveViteConfigExport(exported, env, configDir) {
|
|
307
|
+
const configModule = await loadVizeConfigModule();
|
|
308
|
+
if (typeof configModule.resolveViteConfigExport === "function") return configModule.resolveViteConfigExport(exported, env, configDir);
|
|
309
|
+
return configModule.resolveConfigExport(await resolveViteConfigExport$1(exported, env, configDir), env);
|
|
310
|
+
}
|
|
311
|
+
require.resolve("vize/schemas/vize.config.schema.json");
|
|
312
|
+
require.resolve("vize/pkl/vize.pkl");
|
|
313
|
+
[...CONFIG_FILE_NAMES];
|
|
314
|
+
const VIZE_CONFIG_FILE_ENV = "VIZE_CONFIG_FILE";
|
|
315
|
+
/**
|
|
316
|
+
* Shared config store for inter-plugin communication.
|
|
317
|
+
* Key = project root, Value = resolved VizeConfig.
|
|
318
|
+
*
|
|
319
|
+
* @deprecated Root identity cannot isolate parallel Vite client/SSR instances
|
|
320
|
+
* or servers. This export remains temporarily for compatibility; internal Vize
|
|
321
|
+
* integrations use an exact `ResolvedConfig`-scoped bridge instead.
|
|
322
|
+
*/
|
|
323
|
+
const vizeConfigStore = /* @__PURE__ */ new Map();
|
|
324
|
+
//#endregion
|
|
325
|
+
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, 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-
|
|
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-CIVbtOza.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-
|
|
1
|
+
import { t as vize } from "./plugin-DkbkkirH.mjs";
|
|
2
2
|
import { u as rewriteStaticAssetUrls } from "./vue-version-BFh0eI6J.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-
|
|
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-DmGDWCMT.mjs";
|
|
4
4
|
//#region src/index.ts
|
|
5
5
|
const __internal = { rewriteStaticAssetUrls };
|
|
6
6
|
var src_default = vize;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { a as removeHostVueSfcCompilers, c as rewriteDynamicTemplateImports, d as shouldApplyDefineInVirtualModule, i as isLegacyVueVersion, l as rewriteImportMetaGlobBase, o as applyDefineReplacements, r as isLegacyVueCompatibilityMode, s as createLogger, t as createLegacyVueCompatibilityPlugin, u as rewriteStaticAssetUrls } from "./vue-version-BFh0eI6J.mjs";
|
|
2
|
-
import { a as resolveViteConfigExport, i as resolveConfigExport, o as vizeConfigStore, r as loadConfig } from "./config-
|
|
2
|
+
import { a as resolveViteConfigExport, i as resolveConfigExport, o as vizeConfigStore, r as loadConfig } from "./config-DmGDWCMT.mjs";
|
|
3
3
|
import { n as registerResolvedVizeConfig, r as unregisterResolvedVizeConfig } from "./config-bridge-Dv6U7_RC.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
|
-
import crypto, { createHash } from "node:crypto";
|
|
6
5
|
import * as native from "@vizejs/native";
|
|
7
|
-
import { buildInspectorGraph, chunkVitePrecompileFiles, classifyVitePluginRequest, createViteBareImportBases, createViteBareImportCandidates, createViteVirtualId, detectViteHmrUpdateType, diffVitePrecompileFiles, generateViteHmrCode, hasViteHmrChanges, isViteBareSpecifier, normalizeViteCssModuleFilename, normalizeViteDevMiddlewareUrl, normalizeVitePrecompileBatchSize, normalizeViteRequireBase, normalizeViteResolvedVuePath, resolveViteAliasRequest, resolveViteCssImports, resolveViteRelativeImport, resolveViteVuePath, scopeViteCssForPipeline, splitViteIdQuery, toViteBrowserImportPrefix, transformViteCssVarsForPipeline } from "@vizejs/native";
|
|
8
|
-
import { parseSync } from "oxc-parser";
|
|
6
|
+
import { buildInspectorGraph, chunkVitePrecompileFiles, classifyVitePluginRequest, createViteBareImportBases, createViteBareImportCandidates, createViteVirtualId, detectViteHmrUpdateType, diffVitePrecompileFiles, generateSfcScopeId, generateViteHmrCode, hasViteHmrChanges, isViteBareSpecifier, normalizeViteCssModuleFilename, normalizeViteDevMiddlewareUrl, normalizeVitePrecompileBatchSize, normalizeViteRequireBase, normalizeViteResolvedVuePath, resolveViteAliasRequest, resolveViteCssImports, resolveViteRelativeImport, resolveViteVuePath, scopeViteCssForPipeline, splitViteIdQuery, toViteBrowserImportPrefix, transformViteCssVarsForPipeline } from "@vizejs/native";
|
|
9
7
|
import path from "node:path";
|
|
8
|
+
import { parseSync } from "oxc-parser";
|
|
10
9
|
import fs from "node:fs";
|
|
11
10
|
import { glob } from "tinyglobby";
|
|
11
|
+
import crypto from "node:crypto";
|
|
12
12
|
import zlib from "node:zlib";
|
|
13
13
|
import { pathToFileURL } from "node:url";
|
|
14
14
|
import * as vite from "vite";
|
|
@@ -567,8 +567,16 @@ function isCssModule(block) {
|
|
|
567
567
|
function needsCssPipeline(block) {
|
|
568
568
|
return block.content.includes("@apply");
|
|
569
569
|
}
|
|
570
|
-
function createStyleImportUrl(filePath, params) {
|
|
571
|
-
|
|
570
|
+
function createStyleImportUrl(filePath, params, root, isProduction) {
|
|
571
|
+
let styleFilePath = filePath;
|
|
572
|
+
if (isProduction && root) {
|
|
573
|
+
const relativePath = path.relative(root, filePath);
|
|
574
|
+
if (relativePath && relativePath !== ".." && !relativePath.startsWith(`..${path.sep}`) && !path.isAbsolute(relativePath)) {
|
|
575
|
+
styleFilePath = `/${relativePath.split(path.sep).join("/")}`;
|
|
576
|
+
params.set("vize-root-relative", "");
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
return createStyleVirtualId(`${styleFilePath}?${params.toString()}`);
|
|
572
580
|
}
|
|
573
581
|
/**
|
|
574
582
|
* Check if any style blocks in the compiled module require delegation to
|
|
@@ -621,8 +629,8 @@ function insertAfterStaticImports(output, imports) {
|
|
|
621
629
|
if (insertAt === 0) return `${imports}\n${output}`;
|
|
622
630
|
return `${output.slice(0, insertAt)}${imports}\n${output.slice(insertAt)}`;
|
|
623
631
|
}
|
|
624
|
-
function generateScopeId(filename) {
|
|
625
|
-
return
|
|
632
|
+
function generateScopeId(filename, root, isProduction = false, source) {
|
|
633
|
+
return generateSfcScopeId(filename, root, isProduction, source);
|
|
626
634
|
}
|
|
627
635
|
/**
|
|
628
636
|
* Whether the SFC's `<style>` blocks are handed to Vite as virtual imports.
|
|
@@ -667,7 +675,7 @@ function generateOutput(compiled, options) {
|
|
|
667
675
|
* `null` when the compiler produced none.
|
|
668
676
|
*/
|
|
669
677
|
function generateOutputWithMap(compiled, options) {
|
|
670
|
-
const { customElement, isProduction, isDev, ssr, hmrUpdateType, extractCss, filePath } = options;
|
|
678
|
+
const { customElement, isProduction, isDev, ssr, hmrUpdateType, extractCss, filePath, root } = options;
|
|
671
679
|
const { emitted, hasExportDefault } = assembleComponentOutput(compiled);
|
|
672
680
|
if (usesStyleImports(compiled, options)) {
|
|
673
681
|
const styleImports = [];
|
|
@@ -685,16 +693,16 @@ function generateOutputWithMap(compiled, options) {
|
|
|
685
693
|
if (isCssModule(block)) throw new Error("<style module> is not supported in custom element mode");
|
|
686
694
|
params.set("inline", "");
|
|
687
695
|
const bindingName = `_style_${block.index}`;
|
|
688
|
-
const importUrl = createStyleImportUrl(filePath, params);
|
|
696
|
+
const importUrl = createStyleImportUrl(filePath, params, root, isProduction);
|
|
689
697
|
styleImports.push(`import ${bindingName} from ${JSON.stringify(importUrl)};`);
|
|
690
698
|
customElementStyleBindings.push(bindingName);
|
|
691
699
|
} else if (isCssModule(block)) {
|
|
692
700
|
const bindingName = typeof block.module === "string" ? block.module : "$style";
|
|
693
701
|
params.set("module", typeof block.module === "string" ? block.module : "");
|
|
694
|
-
const importUrl = createStyleImportUrl(filePath, params);
|
|
702
|
+
const importUrl = createStyleImportUrl(filePath, params, root, isProduction);
|
|
695
703
|
cssModuleImports.push(`import ${bindingName} from ${JSON.stringify(importUrl)};`);
|
|
696
704
|
} else {
|
|
697
|
-
const importUrl = createStyleImportUrl(filePath, params);
|
|
705
|
+
const importUrl = createStyleImportUrl(filePath, params, root, isProduction);
|
|
698
706
|
styleImports.push(`import ${JSON.stringify(importUrl)};`);
|
|
699
707
|
}
|
|
700
708
|
}
|
|
@@ -874,6 +882,7 @@ function getEnvironmentCache(state, ssr) {
|
|
|
874
882
|
function getCompileOptionsForRequest(state, ssr, file) {
|
|
875
883
|
const mergedOptions = file === void 0 ? state.mergedOptions : state.fileCompilerOptions?.(file) ?? state.mergedOptions;
|
|
876
884
|
const options = {
|
|
885
|
+
...state.root ? { root: state.root } : {},
|
|
877
886
|
sourceMap: mergedOptions?.sourceMap ?? (!state.isProduction || !!state.viteBuildSourcemap),
|
|
878
887
|
ssr,
|
|
879
888
|
vapor: !ssr && (mergedOptions?.vapor ?? false),
|
|
@@ -1019,7 +1028,7 @@ function ownersOfDependency(cache, resolvedDependency) {
|
|
|
1019
1028
|
}
|
|
1020
1029
|
//#endregion
|
|
1021
1030
|
//#region src/compile-options.ts
|
|
1022
|
-
function buildCompileFileOptions(filePath, options) {
|
|
1031
|
+
function buildCompileFileOptions(filePath, options, scopeId = generateScopeId(filePath, options.root, options.isProd ?? false)) {
|
|
1023
1032
|
return {
|
|
1024
1033
|
filename: filePath,
|
|
1025
1034
|
sourceMap: options.sourceMap,
|
|
@@ -1034,7 +1043,7 @@ function buildCompileFileOptions(filePath, options) {
|
|
|
1034
1043
|
experimentalSelfComponent: options.experimentalSelfComponent ?? false,
|
|
1035
1044
|
experimentalStrictSlotChildren: options.experimentalStrictSlotChildren ?? false,
|
|
1036
1045
|
experimentalServerScript: options.experimentalServerScript ?? false,
|
|
1037
|
-
scopeId: `data-v-${
|
|
1046
|
+
scopeId: `data-v-${scopeId}`,
|
|
1038
1047
|
styleTrim: options.styleTrim,
|
|
1039
1048
|
...options.templateCacheHandlers === void 0 ? {} : { templateCacheHandlers: options.templateCacheHandlers },
|
|
1040
1049
|
...options.templateComments === void 0 ? {} : { templateComments: options.templateComments },
|
|
@@ -1170,9 +1179,10 @@ function resolveSfcSrcImports(filePath, source) {
|
|
|
1170
1179
|
};
|
|
1171
1180
|
}
|
|
1172
1181
|
function compileFile(filePath, cache, options, source, diagnostics) {
|
|
1173
|
-
const
|
|
1174
|
-
const
|
|
1175
|
-
const
|
|
1182
|
+
const content = source ?? fs.readFileSync(filePath, "utf-8");
|
|
1183
|
+
const resolved = resolveSfcSrcImports(filePath, content);
|
|
1184
|
+
const scopeId = generateScopeId(filePath, options.root, options.isProd ?? false, content);
|
|
1185
|
+
const result = compileSfc(resolved.source, buildCompileFileOptions(filePath, options, scopeId));
|
|
1176
1186
|
if (result.errors.length > 0) throw new VizeSfcCompileError(filePath, result.errors);
|
|
1177
1187
|
if (result.warnings.length > 0 && (diagnostics?.logWarnings ?? true)) result.warnings.forEach((warning) => {
|
|
1178
1188
|
console.warn(`[vize] Warning in ${filePath}: ${warning}`);
|
|
@@ -1232,14 +1242,34 @@ function compileJsxModule(filePath, source, options = {}) {
|
|
|
1232
1242
|
*/
|
|
1233
1243
|
function compileBatch(files, cache, options) {
|
|
1234
1244
|
const dependenciesByPath = /* @__PURE__ */ new Map();
|
|
1235
|
-
const
|
|
1245
|
+
const resolvedFiles = files.map((file) => {
|
|
1236
1246
|
const resolved = resolveSfcSrcImports(file.path, file.source);
|
|
1237
1247
|
dependenciesByPath.set(file.path, resolved.dependencies);
|
|
1238
1248
|
return {
|
|
1239
1249
|
path: file.path,
|
|
1240
|
-
source: resolved.source
|
|
1250
|
+
source: resolved.source,
|
|
1251
|
+
scopeId: generateScopeId(file.path, options.root, options.isProd ?? false, file.source)
|
|
1241
1252
|
};
|
|
1242
|
-
})
|
|
1253
|
+
});
|
|
1254
|
+
const result = compileSfcBatchWithResults(resolvedFiles, buildCompileBatchOptions(options));
|
|
1255
|
+
const filesByPath = new Map(files.map((file) => [file.path, file]));
|
|
1256
|
+
const requestedScopes = new Map(resolvedFiles.map((file) => [file.path, file.scopeId]));
|
|
1257
|
+
for (const fileResult of result.results) {
|
|
1258
|
+
const requestedScope = requestedScopes.get(fileResult.path);
|
|
1259
|
+
const input = filesByPath.get(fileResult.path);
|
|
1260
|
+
if (fileResult.errors.length > 0 || requestedScope === void 0 || fileResult.scopeId === requestedScope || input === void 0) continue;
|
|
1261
|
+
const fallback = compileFile(fileResult.path, cache, options, input.source, { logWarnings: false });
|
|
1262
|
+
fileResult.code = fallback.code;
|
|
1263
|
+
delete fileResult.map;
|
|
1264
|
+
if (fallback.map !== void 0) fileResult.map = fallback.map;
|
|
1265
|
+
delete fileResult.css;
|
|
1266
|
+
if (fallback.css !== void 0) fileResult.css = fallback.css;
|
|
1267
|
+
fileResult.scopeId = fallback.scopeId;
|
|
1268
|
+
fileResult.hasScoped = fallback.hasScoped;
|
|
1269
|
+
delete fileResult.macroArtifacts;
|
|
1270
|
+
if (fallback.macroArtifacts !== void 0) fileResult.macroArtifacts = fallback.macroArtifacts;
|
|
1271
|
+
delete fileResult.moduleShape;
|
|
1272
|
+
}
|
|
1243
1273
|
for (const fileResult of result.results) {
|
|
1244
1274
|
if (fileResult.errors.length === 0) cache.set(fileResult.path, {
|
|
1245
1275
|
code: fileResult.code,
|
|
@@ -1761,7 +1791,8 @@ function openCacheForRun(state, batchOptions) {
|
|
|
1761
1791
|
root: state.root,
|
|
1762
1792
|
compileOptions: {
|
|
1763
1793
|
options: buildCompileBatchOptions(batchOptions),
|
|
1764
|
-
scopes: state.compilerScopeIdentity
|
|
1794
|
+
scopes: state.compilerScopeIdentity,
|
|
1795
|
+
scopeId: "project-relative-source-v1"
|
|
1765
1796
|
},
|
|
1766
1797
|
onDiagnostic: (message, error) => error === void 0 ? state.logger.warn(message) : state.logger.warn(message, error)
|
|
1767
1798
|
});
|
|
@@ -3049,7 +3080,8 @@ function loadCompiledSfcModule(state, realPath, isSsr, currentBase, needsGlobBas
|
|
|
3049
3080
|
hmrUpdateType: loadOptions?.ssr ? void 0 : state.pendingHmrUpdateTypes.get(realPath),
|
|
3050
3081
|
extractCss,
|
|
3051
3082
|
customElement,
|
|
3052
|
-
filePath: realPath
|
|
3083
|
+
filePath: realPath,
|
|
3084
|
+
root: state.root
|
|
3053
3085
|
};
|
|
3054
3086
|
if (compiled.css && !hasDelegated && embedsInlineCss(compiled, outputOptions)) compiled = {
|
|
3055
3087
|
...compiled,
|
|
@@ -3089,8 +3121,14 @@ function loadHook(state, id, loadOptions) {
|
|
|
3089
3121
|
}
|
|
3090
3122
|
const styleRequest = classifyVitePluginRequest(normalizeStyleVirtualId(id));
|
|
3091
3123
|
if (styleRequest.isVueStyleQuery) {
|
|
3124
|
+
const isRootRelative = !!styleRequest.querySuffix && new URLSearchParams(styleRequest.querySuffix.slice(1)).has("vize-root-relative");
|
|
3092
3125
|
const sourceRequest = classifyVitePluginRequest(styleRequest.path);
|
|
3093
|
-
|
|
3126
|
+
let realPath = sourceRequest.vizeVirtualPath ?? sourceRequest.normalizedFsId ?? sourceRequest.normalizedVuePath ?? styleRequest.path;
|
|
3127
|
+
if (realPath.startsWith("/") && (isRootRelative || !fs.existsSync(realPath))) {
|
|
3128
|
+
const projectPath = path.resolve(state.root, realPath.slice(1));
|
|
3129
|
+
const projectCache = getEnvironmentCache(state, !!loadOptions?.ssr);
|
|
3130
|
+
if (fs.existsSync(projectPath) || projectCache.has(projectPath) || state.cache.has(projectPath) || state.ssrCache.has(projectPath)) realPath = projectPath;
|
|
3131
|
+
}
|
|
3094
3132
|
const lang = styleRequest.styleLang ?? null;
|
|
3095
3133
|
const scoped = styleRequest.styleScoped ?? null;
|
|
3096
3134
|
const fallbackCompiled = getCompiledStyleSource(state, realPath, !!loadOptions?.ssr);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as resolveConfigExport, r as loadConfig } from "./config-
|
|
1
|
+
import { i as resolveConfigExport, r as loadConfig } from "./config-DmGDWCMT.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
4
3
|
import path from "node:path";
|
|
5
4
|
import { mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
6
5
|
import { glob } from "tinyglobby";
|
|
6
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
7
7
|
import { spawn, spawnSync } from "node:child_process";
|
|
8
8
|
import os from "node:os";
|
|
9
9
|
import { rm, writeFile } from "node:fs/promises";
|
|
@@ -180,7 +180,7 @@ async function runTask(argv) {
|
|
|
180
180
|
const [task, ...rest] = argv;
|
|
181
181
|
const args = rest[0] === "--" ? rest.slice(1) : rest;
|
|
182
182
|
if (task === "editor:setup") {
|
|
183
|
-
const { setupEditor } = await import("./editor-
|
|
183
|
+
const { setupEditor } = await import("./editor-BUjSkAzE.mjs");
|
|
184
184
|
await setupEditor();
|
|
185
185
|
return 0;
|
|
186
186
|
}
|
|
@@ -269,6 +269,7 @@ interface LintRuleOptions {
|
|
|
269
269
|
math?: "always" | "never" | "any";
|
|
270
270
|
};
|
|
271
271
|
"vue/v-on-event-hyphenation"?: "always" | "never";
|
|
272
|
+
"vue/v-on-style"?: "shorthand" | "longform";
|
|
272
273
|
"vue/attribute-hyphenation"?: "always" | "never";
|
|
273
274
|
"vue/valid-v-on"?: {
|
|
274
275
|
modifiers?: string[];
|
|
@@ -831,13 +832,37 @@ type VueConfig = {
|
|
|
831
832
|
};
|
|
832
833
|
/** Native Vue settings shared by Vite, Vite+, the CLI projection and the editor. */
|
|
833
834
|
type VueOptionKeys = "name" | "compiler" | "experimentals" | "dialect" | "vite" | "musea" | "typeChecker" | "linter" | "formatter" | "languageServer" | "globalTypes" | "files" | "ignores" | "basePath" | "lib";
|
|
835
|
+
/** Host Vite+ lint config produced by `oxlint-plugin-vize` flat-config helpers. */
|
|
836
|
+
interface VueHostLintConfig extends Record<string, unknown> {
|
|
837
|
+
jsPlugins: string[];
|
|
838
|
+
plugins: string[];
|
|
839
|
+
rules: Record<string, unknown>;
|
|
840
|
+
settings: Record<string, unknown> & {
|
|
841
|
+
vize?: {
|
|
842
|
+
locale?: unknown;
|
|
843
|
+
helpLevel?: unknown;
|
|
844
|
+
preset?: unknown;
|
|
845
|
+
typeAware?: unknown;
|
|
846
|
+
rules?: unknown;
|
|
847
|
+
};
|
|
848
|
+
};
|
|
849
|
+
ignorePatterns?: string[];
|
|
850
|
+
overrides?: unknown[];
|
|
851
|
+
}
|
|
852
|
+
/** Preferred action-oriented spellings for the Vue tools. */
|
|
853
|
+
type VueToolActions = {
|
|
854
|
+
compile?: VizeConfig["compiler"];
|
|
855
|
+
typeCheck?: VizeConfig["typeChecker"];
|
|
856
|
+
lint?: VueHostLintConfig;
|
|
857
|
+
fmt?: VizeConfig["formatter"];
|
|
858
|
+
};
|
|
834
859
|
/** Native scopes retain the same authored options inside the Vue namespace. */
|
|
835
860
|
type VueOptionsEntry = Pick<VizeConfigEntry, "name" | "basePath" | "files" | "ignores" | "compiler" | "linter">;
|
|
836
861
|
/** Section option values reuse the native types rather than a second schema. */
|
|
837
862
|
type VueOptions = Pick<VizeConfig, VueOptionKeys> & {
|
|
838
863
|
version?: VueVersion;
|
|
839
864
|
entries?: VueOptionsEntry[];
|
|
840
|
-
};
|
|
865
|
+
} & VueToolActions;
|
|
841
866
|
type UserConfigEntry = VizeConfigEntry & {
|
|
842
867
|
/**
|
|
843
868
|
* Shared Vue dialect section accepted by the Rust config model.
|
package/dist/vite-plus.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as FormatterConfig, g as CompilerConfig, h as VueOptionsEntry, m as VueOptions, p as UserConfigExport, t as VizeOptions, v as LinterConfig, y as TypeCheckerConfig } from "./types-
|
|
1
|
+
import { _ as FormatterConfig, g as CompilerConfig, h as VueOptionsEntry, m as VueOptions, p as UserConfigExport, t as VizeOptions, v as LinterConfig, y as TypeCheckerConfig } from "./types-CIVbtOza.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,8 +1,8 @@
|
|
|
1
|
-
import { c as projectViteConfigSource, i as resolveConfigExport, l as vueConfigOptions, s as mergeVueConfigOptions } from "./config-
|
|
2
|
-
import { a as taskConfigKey, i as sourceConfigKey, r as availableVueRules, t as runNative } from "./runner-
|
|
3
|
-
import { randomUUID } from "node:crypto";
|
|
1
|
+
import { c as projectViteConfigSource, i as resolveConfigExport, l as vueConfigOptions, s as mergeVueConfigOptions } from "./config-DmGDWCMT.mjs";
|
|
2
|
+
import { a as taskConfigKey, i as sourceConfigKey, r as availableVueRules, t as runNative } from "./runner-DmWiQu3U.mjs";
|
|
4
3
|
import path from "node:path";
|
|
5
4
|
import { readFileSync } from "node:fs";
|
|
5
|
+
import { randomUUID } from "node:crypto";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import os from "node:os";
|
|
8
8
|
import { readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
@@ -140,44 +140,83 @@ function normalizeConfig(source, integration) {
|
|
|
140
140
|
assertVueConfigSpelling(source);
|
|
141
141
|
const { compiler: compilerOption, typecheck, lint, fmt, vue: _vue, ...rest } = source;
|
|
142
142
|
const vue = vueConfigOptions(source);
|
|
143
|
+
const hostLint = vue?.lint;
|
|
143
144
|
const configDirectory = process.cwd();
|
|
144
145
|
const { vue: nativeLint, ...oxlint } = lint ?? {};
|
|
145
146
|
const { vue: nativeFmt, ...oxfmt } = fmt ?? {};
|
|
147
|
+
const resolvedHostLint = composeHostLint(lint ? oxlint : void 0, hostLint);
|
|
148
|
+
const hostVizeSettings = recordValue(resolvedHostLint?.settings?.vize);
|
|
146
149
|
const lintConfig = nativeLint;
|
|
147
150
|
const compiler = vueCompiler(compilerOption ?? integration.plugin ?? {}, vue);
|
|
148
151
|
const options = {
|
|
149
152
|
...integration,
|
|
150
|
-
check: vue?.typeChecker?.enabled !== void 0 ? vue
|
|
151
|
-
lint: vue?.linter?.enabled !== void 0 ? vue.linter.enabled : lintConfig === void 0 ? integration.lint : lintConfig !== false,
|
|
152
|
-
fmt: vue?.formatter !== void 0 ? true : nativeFmt === void 0 ? integration.fmt : nativeFmt !== false
|
|
153
|
+
check: (vue?.typeCheck ?? vue?.typeChecker)?.enabled !== void 0 ? (vue?.typeCheck ?? vue?.typeChecker)?.enabled : typecheck === false ? false : typeof typecheck === "object" ? typecheck.enabled !== false : typecheck ?? integration.check,
|
|
154
|
+
lint: hostLint !== void 0 ? false : vue?.linter?.enabled !== void 0 ? vue.linter.enabled : lintConfig === void 0 ? integration.lint : lintConfig !== false,
|
|
155
|
+
fmt: (vue?.fmt ?? vue?.formatter) !== void 0 ? true : nativeFmt === void 0 ? integration.fmt : nativeFmt !== false
|
|
153
156
|
};
|
|
154
157
|
const config = async (env) => await projectViteConfigSource(source, env, configDirectory);
|
|
155
158
|
const metadata = {
|
|
156
159
|
config,
|
|
157
160
|
options,
|
|
158
161
|
lintTypecheck: typeof lintConfig === "object" && lintConfig.typecheck === true,
|
|
159
|
-
lintLocale: typeof lintConfig === "object" ? lintConfig.locale : void 0,
|
|
160
|
-
lintHelpLevel: typeof lintConfig === "object" ? lintConfig.helpLevel : void 0,
|
|
162
|
+
lintLocale: hostVizeSettings?.locale === "en" || hostVizeSettings?.locale === "ja" || hostVizeSettings?.locale === "zh" ? hostVizeSettings.locale : typeof lintConfig === "object" ? lintConfig.locale : void 0,
|
|
163
|
+
lintHelpLevel: hostVizeSettings?.helpLevel === "full" || hostVizeSettings?.helpLevel === "short" || hostVizeSettings?.helpLevel === "none" ? hostVizeSettings.helpLevel : typeof lintConfig === "object" ? lintConfig.helpLevel : void 0,
|
|
161
164
|
fmtIgnorePatterns: oxfmt.ignorePatterns
|
|
162
165
|
};
|
|
163
166
|
return {
|
|
164
167
|
vp: {
|
|
165
168
|
...rest,
|
|
166
169
|
plugins: rest.plugins,
|
|
167
|
-
lint:
|
|
170
|
+
lint: resolvedHostLint,
|
|
168
171
|
fmt: fmt ? oxfmt : void 0
|
|
169
172
|
},
|
|
170
173
|
metadata,
|
|
171
174
|
compiler
|
|
172
175
|
};
|
|
173
176
|
}
|
|
177
|
+
/** Compose the plain Vite+ lint policy with the Vue flat-config layer. */
|
|
178
|
+
function composeHostLint(base, vue) {
|
|
179
|
+
if (base === void 0) return vue;
|
|
180
|
+
if (vue === void 0) return base;
|
|
181
|
+
const overrides = [...base.overrides ?? [], ...vue.overrides ?? []];
|
|
182
|
+
const baseVize = recordValue(base.settings?.vize);
|
|
183
|
+
const vueVize = recordValue(vue.settings?.vize);
|
|
184
|
+
const settings = {
|
|
185
|
+
...base.settings,
|
|
186
|
+
...vue.settings,
|
|
187
|
+
vize: {
|
|
188
|
+
...baseVize,
|
|
189
|
+
...vueVize
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
return {
|
|
193
|
+
...base,
|
|
194
|
+
...vue,
|
|
195
|
+
jsPlugins: mergeUnique(base.jsPlugins, vue.jsPlugins),
|
|
196
|
+
plugins: mergeUnique(base.plugins, vue.plugins),
|
|
197
|
+
ignorePatterns: mergeUnique(base.ignorePatterns, vue.ignorePatterns),
|
|
198
|
+
rules: {
|
|
199
|
+
...base.rules,
|
|
200
|
+
...vue.rules
|
|
201
|
+
},
|
|
202
|
+
settings,
|
|
203
|
+
...overrides.length === 0 ? {} : { overrides }
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function mergeUnique(base, vue) {
|
|
207
|
+
return [...new Set([...base ?? [], ...vue ?? []])];
|
|
208
|
+
}
|
|
209
|
+
function recordValue(value) {
|
|
210
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
|
|
211
|
+
}
|
|
174
212
|
/** Keep plugin-only fields while native canonical leaves choose their own values. */
|
|
175
213
|
function vueCompiler(legacy, vue) {
|
|
176
214
|
if (legacy === false) return false;
|
|
177
|
-
|
|
178
|
-
|
|
215
|
+
const compiler = vue?.compile ?? vue?.compiler;
|
|
216
|
+
if (compiler === void 0 && vue?.version === void 0) return legacy;
|
|
217
|
+
const { compatibility, ...native } = compiler ?? {};
|
|
179
218
|
const { vueVersion: _nativeVersion, ...nativeCompatibility } = compatibility ?? {};
|
|
180
|
-
const version = vue
|
|
219
|
+
const version = vue?.version ?? compatibility?.vueVersion;
|
|
181
220
|
const versions = {
|
|
182
221
|
"0.10": .1,
|
|
183
222
|
"0.11": .11,
|
|
@@ -309,7 +348,7 @@ function defineConfig(config = {}, integration = {}) {
|
|
|
309
348
|
const legacy = compiler !== false && (await import("./vue-version-DOjZaMiI.mjs")).isLegacyVueCompatibilityMode(compiler);
|
|
310
349
|
const plugins = compiler === false || legacy ? [...vp.plugins ?? []] : await withoutVueCompiler(vp.plugins ?? []);
|
|
311
350
|
if (compiler !== false) {
|
|
312
|
-
const { vize } = await import("./plugin-
|
|
351
|
+
const { vize } = await import("./plugin-CjEbYGJ7.mjs");
|
|
313
352
|
plugins.push(vize({
|
|
314
353
|
...compiler,
|
|
315
354
|
configMode: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.516.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.516.0",
|
|
55
|
+
"@vizejs/unplugin": "0.516.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.516.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/node": "25.9.2",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"fmt": "vp fmt --write src vite.config.ts",
|
|
93
93
|
"test": "node scripts/run-tests.mjs",
|
|
94
94
|
"test:prepared": "node scripts/run-tests.mjs --require-prepared && node src/test.ts && node --test src/vite-plus/*.test.ts",
|
|
95
|
+
"test:types:markdown": "vp exec tsc -p type-tests/markdown/tsconfig.json",
|
|
95
96
|
"test:types:real-vite": "vp exec node type-tests/plugin-vue/check.ts"
|
|
96
97
|
}
|
|
97
98
|
}
|
package/dist/config-D7Ah2hEd.mjs
DELETED
|
@@ -1,247 +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\":{\"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\":{\"name\":{\"type\":\"string\"},\"basePath\":{\"type\":\"string\"},\"files\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"ignores\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"compiler\":{\"$ref\":\"#/definitions/CompilerConfig\"},\"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\"},\"tsrsPath\":{\"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-macros-order\":{\"type\":\"object\",\"properties\":{\"order\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"minLength\":1},\"uniqueItems\":true}},\"additionalProperties\":false},\"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\":{\"preset\":{\"type\":\"string\",\"enum\":[\"vize\",\"prettier\"]},\"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\"},\"normalizeCssQuotes\":{\"type\":\"boolean\"},\"normalizeInlineStyles\":{\"type\":\"boolean\"},\"normalizeVForParens\":{\"type\":\"boolean\"},\"selfCloseVoidElements\":{\"type\":\"boolean\"},\"reindentPreprocessorStyles\":{\"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 resolveViteConfigSource(exported, env), env, configDir);
|
|
62
|
-
}
|
|
63
|
-
/** Resolve an authored Vite export without projecting away Vite-owned task settings. */
|
|
64
|
-
async function resolveViteConfigSource(exported, env) {
|
|
65
|
-
env ??= {
|
|
66
|
-
mode: "development",
|
|
67
|
-
command: "serve"
|
|
68
|
-
};
|
|
69
|
-
if (env.command !== "build" && env.command !== "serve") env = {
|
|
70
|
-
...env,
|
|
71
|
-
command: "serve"
|
|
72
|
-
};
|
|
73
|
-
return resolveSource(exported, env);
|
|
74
|
-
}
|
|
75
|
-
/** Project already evaluated settings; the owning adapter evaluates its Vite export once. */
|
|
76
|
-
async function projectViteConfigSource(source, env, configDir) {
|
|
77
|
-
if (!object(source)) throw new TypeError("Vite config source must be an object");
|
|
78
|
-
env ??= {
|
|
79
|
-
mode: "development",
|
|
80
|
-
command: "serve"
|
|
81
|
-
};
|
|
82
|
-
if (env.command !== "build" && env.command !== "serve") env = {
|
|
83
|
-
...env,
|
|
84
|
-
command: "serve"
|
|
85
|
-
};
|
|
86
|
-
rejectLegacyConfig(source);
|
|
87
|
-
const selected = vueConfigOptions(source);
|
|
88
|
-
const canonical = selected === void 0 ? {} : flatVueOptions(selected);
|
|
89
|
-
const overrides = {};
|
|
90
|
-
if (object(source.compiler)) {
|
|
91
|
-
const { vueVersion, ...compiler } = source.compiler;
|
|
92
|
-
const version = vueVersion ?? compiler.compatibility?.vueVersion;
|
|
93
|
-
overrides.compiler = merge(compiler, version === void 0 ? {} : { compatibility: { vueVersion: String(version === .1 ? "0.10" : version === "legacy" ? 2 : version) } });
|
|
94
|
-
}
|
|
95
|
-
if (typeof source.typecheck === "boolean") overrides.typeChecker = { enabled: source.typecheck };
|
|
96
|
-
else if (object(source.typecheck)) overrides.typeChecker = source.typecheck;
|
|
97
|
-
const lint = source.lint?.vue;
|
|
98
|
-
if (typeof lint === "boolean") overrides.linter = { enabled: lint };
|
|
99
|
-
else if (object(lint)) {
|
|
100
|
-
const { typecheck: _typecheck, locale: _locale, helpLevel: _helpLevel, ...native } = lint;
|
|
101
|
-
overrides.linter = native;
|
|
102
|
-
}
|
|
103
|
-
if (object(source.fmt)) {
|
|
104
|
-
const { vue, sortImports } = source.fmt;
|
|
105
|
-
overrides.formatter = merge(sortImports === void 0 ? {} : { sortImports }, object(vue) ? vue : {});
|
|
106
|
-
}
|
|
107
|
-
const root = typeof source.root === "string" ? resolve(configDir ?? ".", source.root) : configDir;
|
|
108
|
-
const config = overlayVueOptions(merge(projectConfigDefaults(), overrides), canonical);
|
|
109
|
-
return root ? {
|
|
110
|
-
...projectPaths(config, root, false),
|
|
111
|
-
__vizeProjectRoot: root
|
|
112
|
-
} : config;
|
|
113
|
-
}
|
|
114
|
-
/** Validate only canonical settings; selecting them never evaluates a legacy callback. */
|
|
115
|
-
function vueConfigOptions(source) {
|
|
116
|
-
const selected = source.vue;
|
|
117
|
-
if (selected !== void 0) validateVueOption(selected, vueOptionSchema, "vue");
|
|
118
|
-
return selected;
|
|
119
|
-
}
|
|
120
|
-
/** Share canonical composition with adapters while their other Vite fields keep Vite merging. */
|
|
121
|
-
function mergeVueConfigOptions(base, own) {
|
|
122
|
-
vueConfigOptions({ vue: base });
|
|
123
|
-
vueConfigOptions({ vue: own });
|
|
124
|
-
if (base === void 0) return own;
|
|
125
|
-
if (own === void 0) return base;
|
|
126
|
-
return overlayVueOptions(base, own);
|
|
127
|
-
}
|
|
128
|
-
function flatVueOptions(selected) {
|
|
129
|
-
const { version, entries, ...sections } = selected;
|
|
130
|
-
return {
|
|
131
|
-
...sections,
|
|
132
|
-
...version === void 0 ? {} : { vue: { version } },
|
|
133
|
-
...entries === void 0 ? {} : { entries: entries.map(flatVueOptions) }
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
function overlayVueOptions(base, own) {
|
|
137
|
-
const result = { ...base };
|
|
138
|
-
for (const [key, value] of Object.entries(own)) {
|
|
139
|
-
if (value === void 0) continue;
|
|
140
|
-
const previous = Object.hasOwn(result, key) ? result[key] : void 0;
|
|
141
|
-
Object.defineProperty(result, key, {
|
|
142
|
-
value: object(value) && object(previous) ? overlayVueOptions(previous, value) : value,
|
|
143
|
-
enumerable: true,
|
|
144
|
-
configurable: true,
|
|
145
|
-
writable: true
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
return result;
|
|
149
|
-
}
|
|
150
|
-
function validateVueOption(value, schema, label) {
|
|
151
|
-
const refuse = (reason) => {
|
|
152
|
-
throw new TypeError(`${label}: ${reason}`);
|
|
153
|
-
};
|
|
154
|
-
if (schema.$ref) return validateVueOption(value, vueOptionSchema.definitions[schema.$ref.split("/").at(-1)], label);
|
|
155
|
-
if (schema.oneOf) {
|
|
156
|
-
if (schema.oneOf.filter((candidate) => {
|
|
157
|
-
try {
|
|
158
|
-
validateVueOption(value, candidate, label);
|
|
159
|
-
return true;
|
|
160
|
-
} catch (error) {
|
|
161
|
-
if (!(error instanceof TypeError)) throw error;
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
}).length !== 1) refuse("must match one documented native option type");
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
if (schema.enum && !schema.enum.includes(value)) refuse("unsupported native option value");
|
|
168
|
-
const valid = {
|
|
169
|
-
object: object(value),
|
|
170
|
-
array: Array.isArray(value),
|
|
171
|
-
string: typeof value === "string",
|
|
172
|
-
boolean: typeof value === "boolean",
|
|
173
|
-
integer: Number.isInteger(value),
|
|
174
|
-
number: typeof value === "number" && Number.isFinite(value),
|
|
175
|
-
null: value === null
|
|
176
|
-
};
|
|
177
|
-
if (schema.type && !valid[schema.type]) refuse(`must be ${schema.type}`);
|
|
178
|
-
if (schema.minimum !== void 0 && value < schema.minimum) refuse(`must be >= ${schema.minimum}`);
|
|
179
|
-
if (schema.maximum !== void 0 && value > schema.maximum) refuse(`must be <= ${schema.maximum}`);
|
|
180
|
-
if (Array.isArray(value) && schema.items) for (let index = 0; index < value.length; index++) validateVueOption(value[index], schema.items, `${label}[${index}]`);
|
|
181
|
-
if (object(value)) {
|
|
182
|
-
for (const required of schema.required ?? []) if (!Object.hasOwn(value, required) || value[required] === void 0) refuse(`missing ${required}`);
|
|
183
|
-
for (const [key, item] of Object.entries(value)) {
|
|
184
|
-
const documented = Object.hasOwn(schema.properties ?? {}, key);
|
|
185
|
-
if (!documented && schema.additionalProperties === false) refuse(`unknown option "${key}"`);
|
|
186
|
-
if (schema.propertyNames?.pattern && !new RegExp(schema.propertyNames.pattern).test(key)) refuse(`invalid native option name ${key}`);
|
|
187
|
-
const rule = documented ? schema.properties[key] : schema.additionalProperties;
|
|
188
|
-
if (item !== void 0 && object(rule)) validateVueOption(item, rule, `${label}.${key}`);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
function projectPaths(config, root, entry) {
|
|
193
|
-
if (!root || !object(config)) return config;
|
|
194
|
-
const result = { ...config };
|
|
195
|
-
if (typeof config.basePath === "string" || config.files !== void 0 || entry && config.ignores !== void 0) result.basePath = resolve(root, config.basePath ?? ".");
|
|
196
|
-
if (Array.isArray(config.entries)) result.entries = config.entries.map((value) => projectPaths(value, root, true));
|
|
197
|
-
if (object(config.typeChecker)) {
|
|
198
|
-
result.typeChecker = { ...config.typeChecker };
|
|
199
|
-
for (const key of [
|
|
200
|
-
"tsconfig",
|
|
201
|
-
"corsaPath",
|
|
202
|
-
"tsgoPath",
|
|
203
|
-
"tsrsPath",
|
|
204
|
-
"globalsFile"
|
|
205
|
-
]) if (typeof config.typeChecker[key] === "string") result.typeChecker[key] = resolve(root, config.typeChecker[key]);
|
|
206
|
-
}
|
|
207
|
-
return result;
|
|
208
|
-
}
|
|
209
|
-
//#endregion
|
|
210
|
-
//#region src/config.ts
|
|
211
|
-
const require = createRequire(import.meta.url);
|
|
212
|
-
const CONFIG_FILE_NAMES = VITE_CONFIG_FILE_NAMES;
|
|
213
|
-
let vizeConfigModulePromise = null;
|
|
214
|
-
function loadVizeConfigModule() {
|
|
215
|
-
vizeConfigModulePromise ??= import("vize/config");
|
|
216
|
-
return vizeConfigModulePromise;
|
|
217
|
-
}
|
|
218
|
-
function defineConfig(config) {
|
|
219
|
-
return config;
|
|
220
|
-
}
|
|
221
|
-
async function loadConfig(root, options) {
|
|
222
|
-
return (await loadVizeConfigModule()).loadConfig(root, options);
|
|
223
|
-
}
|
|
224
|
-
async function resolveConfigExport(exported, env) {
|
|
225
|
-
return (await loadVizeConfigModule()).resolveConfigExport(exported, env);
|
|
226
|
-
}
|
|
227
|
-
/** Project shared settings from an already evaluated Vite config. */
|
|
228
|
-
async function resolveViteConfigExport(exported, env, configDir) {
|
|
229
|
-
const configModule = await loadVizeConfigModule();
|
|
230
|
-
if (typeof configModule.resolveViteConfigExport === "function") return configModule.resolveViteConfigExport(exported, env, configDir);
|
|
231
|
-
return configModule.resolveConfigExport(await resolveViteConfigExport$1(exported, env, configDir), env);
|
|
232
|
-
}
|
|
233
|
-
require.resolve("vize/schemas/vize.config.schema.json");
|
|
234
|
-
require.resolve("vize/pkl/vize.pkl");
|
|
235
|
-
[...CONFIG_FILE_NAMES];
|
|
236
|
-
const VIZE_CONFIG_FILE_ENV = "VIZE_CONFIG_FILE";
|
|
237
|
-
/**
|
|
238
|
-
* Shared config store for inter-plugin communication.
|
|
239
|
-
* Key = project root, Value = resolved VizeConfig.
|
|
240
|
-
*
|
|
241
|
-
* @deprecated Root identity cannot isolate parallel Vite client/SSR instances
|
|
242
|
-
* or servers. This export remains temporarily for compatibility; internal Vize
|
|
243
|
-
* integrations use an exact `ResolvedConfig`-scoped bridge instead.
|
|
244
|
-
*/
|
|
245
|
-
const vizeConfigStore = /* @__PURE__ */ new Map();
|
|
246
|
-
//#endregion
|
|
247
|
-
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-BmsOHaS3.mjs
DELETED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
1
|
import path from "node:path";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
4
4
|
import { applyEdits, modify, parse } from "jsonc-parser";
|
|
5
5
|
//#region src/vite-plus/editor.ts
|