vize 0.123.0 → 0.124.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{config-MA8nXz11.d.mts → config-CRvVIvqJ.d.mts} +71 -4
- package/dist/config-CRvVIvqJ.d.mts.map +1 -0
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +46 -2
- package/dist/config.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +2 -2
- package/pkl/VizeConfig.pkl +68 -0
- package/pkl/jsonschema/generate.pkl +74 -0
- package/pkl/vize.pkl +25 -0
- package/schemas/vize.config.schema.json +113 -0
- package/src/config.ts +101 -12
- package/src/index.ts +4 -0
- package/src/types/generated.ts +58 -0
- package/src/types/index.ts +9 -1
- package/src/types/runtime.ts +14 -2
- package/dist/config-MA8nXz11.d.mts.map +0 -1
package/README.md
CHANGED
|
@@ -52,10 +52,10 @@ Recommended scripts:
|
|
|
52
52
|
|
|
53
53
|
Shared config discovery is supported for the npm CLI:
|
|
54
54
|
|
|
55
|
+
- `vize.config.pkl`
|
|
55
56
|
- `vize.config.ts`
|
|
56
57
|
- `vize.config.js`
|
|
57
58
|
- `vize.config.mjs`
|
|
58
|
-
- `vize.config.pkl`
|
|
59
59
|
- `vize.config.json`
|
|
60
60
|
|
|
61
61
|
Pkl config files require either `@pkl-community/pkl` installed in the project or a `pkl` binary on
|
|
@@ -11,6 +11,26 @@ type RuleCategory = "correctness" | "suspicious" | "style" | "perf" | "a11y" | "
|
|
|
11
11
|
* Configuration file for vize - High-performance Vue.js toolchain
|
|
12
12
|
*/
|
|
13
13
|
interface VizeConfig {
|
|
14
|
+
/**
|
|
15
|
+
* Human-readable entry name for inspect output and diagnostics
|
|
16
|
+
*/
|
|
17
|
+
name?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Directory used as the base for scoped file patterns and relative paths
|
|
20
|
+
*/
|
|
21
|
+
basePath?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Glob patterns this config applies to
|
|
24
|
+
*/
|
|
25
|
+
files?: string[];
|
|
26
|
+
/**
|
|
27
|
+
* Glob patterns this config excludes
|
|
28
|
+
*/
|
|
29
|
+
ignores?: string[];
|
|
30
|
+
/**
|
|
31
|
+
* Base config files or presets to compose
|
|
32
|
+
*/
|
|
33
|
+
extends?: string | string[];
|
|
14
34
|
compiler?: CompilerConfig;
|
|
15
35
|
vite?: VitePluginConfig;
|
|
16
36
|
linter?: LinterConfig;
|
|
@@ -20,6 +40,10 @@ interface VizeConfig {
|
|
|
20
40
|
lsp?: LanguageServerConfig;
|
|
21
41
|
musea?: MuseaConfig;
|
|
22
42
|
globalTypes?: GlobalTypesConfig;
|
|
43
|
+
/**
|
|
44
|
+
* Scoped config entries for monorepos and workspaces
|
|
45
|
+
*/
|
|
46
|
+
entries?: VizeConfigEntry[];
|
|
23
47
|
}
|
|
24
48
|
/**
|
|
25
49
|
* Vue compiler options
|
|
@@ -478,6 +502,40 @@ interface GlobalTypeDeclaration {
|
|
|
478
502
|
*/
|
|
479
503
|
defaultValue?: string;
|
|
480
504
|
}
|
|
505
|
+
/**
|
|
506
|
+
* Scoped Vize config entry for monorepos and workspaces
|
|
507
|
+
*/
|
|
508
|
+
interface VizeConfigEntry {
|
|
509
|
+
/**
|
|
510
|
+
* Human-readable entry name for inspect output and diagnostics
|
|
511
|
+
*/
|
|
512
|
+
name?: string;
|
|
513
|
+
/**
|
|
514
|
+
* Directory used as the base for scoped file patterns and relative paths
|
|
515
|
+
*/
|
|
516
|
+
basePath?: string;
|
|
517
|
+
/**
|
|
518
|
+
* Glob patterns this entry applies to
|
|
519
|
+
*/
|
|
520
|
+
files?: string[];
|
|
521
|
+
/**
|
|
522
|
+
* Glob patterns this entry excludes
|
|
523
|
+
*/
|
|
524
|
+
ignores?: string[];
|
|
525
|
+
/**
|
|
526
|
+
* Base config files or presets to compose
|
|
527
|
+
*/
|
|
528
|
+
extends?: string | string[];
|
|
529
|
+
compiler?: CompilerConfig;
|
|
530
|
+
vite?: VitePluginConfig;
|
|
531
|
+
linter?: LinterConfig;
|
|
532
|
+
typeChecker?: TypeCheckerConfig;
|
|
533
|
+
formatter?: FormatterConfig;
|
|
534
|
+
languageServer?: LanguageServerConfig;
|
|
535
|
+
lsp?: LanguageServerConfig;
|
|
536
|
+
musea?: MuseaConfig;
|
|
537
|
+
globalTypes?: GlobalTypesConfig;
|
|
538
|
+
}
|
|
481
539
|
//#endregion
|
|
482
540
|
//#region src/types/rules.d.ts
|
|
483
541
|
declare const LINT_RULE_NAMES: readonly ["a11y/alt-text", "a11y/anchor-has-content", "a11y/anchor-is-valid", "a11y/aria-props", "a11y/aria-role", "a11y/aria-unsupported-elements", "a11y/click-events-have-key-events", "a11y/form-control-has-label", "a11y/heading-has-content", "a11y/heading-levels", "a11y/iframe-has-title", "a11y/img-alt", "a11y/interactive-supports-focus", "a11y/label-has-for", "a11y/landmark-roles", "a11y/media-has-caption", "a11y/mouse-events-have-key-events", "a11y/no-access-key", "a11y/no-aria-hidden-on-focusable", "a11y/no-autofocus", "a11y/no-distracting-elements", "a11y/no-i-for-icon", "a11y/no-redundant-roles", "a11y/no-refer-to-non-existent-id", "a11y/no-role-presentation-on-focusable", "a11y/no-static-element-interactions", "a11y/placeholder-label-option", "a11y/role-has-required-aria-props", "a11y/tabindex-no-positive", "a11y/use-list", "ecosystem/nuxt-prefer-nuxt-link", "ecosystem/pinia-prefer-store-to-refs", "ecosystem/router-link-require-to", "ecosystem/void-link-require-href", "ecosystem/void-link-valid-method", "ecosystem/vue-i18n-no-missing-key", "ecosystem/vue-router-prefer-named-link", "ecosystem/vue-router-prefer-named-push", "ecosystem/vue-test-utils-no-html-snapshot", "html/deprecated-attr", "html/deprecated-element", "html/id-duplication", "html/no-consecutive-br", "html/no-duplicate-dt", "html/no-empty-palpable-content", "html/require-datetime", "script/no-get-current-instance", "script/no-next-tick", "script/no-options-api", "ssr/no-browser-globals-in-ssr", "ssr/no-hydration-mismatch", "type/no-floating-promises", "type/no-reactivity-loss", "type/no-unsafe-template-binding", "type/require-typed-emits", "type/require-typed-props", "vapor/no-inline-template", "vapor/no-vue-lifecycle-events", "vapor/prefer-static-class", "vapor/require-vapor-attribute", "vue/attribute-hyphenation", "vue/attribute-order", "vue/component-definition-name-casing", "vue/component-name-in-template-casing", "vue/html-quotes", "vue/html-self-closing", "vue/multi-word-component-names", "vue/mustache-interpolation-spacing", "vue/no-boolean-attr-value", "vue/no-child-content", "vue/no-dupe-v-else-if", "vue/no-duplicate-attributes", "vue/no-inline-style", "vue/no-lone-template", "vue/no-multi-spaces", "vue/no-mutating-props", "vue/no-preprocessor-lang", "vue/no-reserved-component-names", "vue/no-script-non-standard-lang", "vue/no-src-attribute", "vue/no-template-key", "vue/no-template-lang", "vue/no-template-shadow", "vue/no-textarea-mustache", "vue/no-unsafe-url", "vue/no-unused-components", "vue/no-unused-properties", "vue/no-unused-vars", "vue/no-use-v-if-with-v-for", "vue/no-useless-template-attributes", "vue/no-v-html", "vue/no-v-text-v-html-on-component", "vue/permitted-contents", "vue/prefer-props-shorthand", "vue/prop-name-casing", "vue/require-component-is", "vue/require-component-registration", "vue/require-scoped-style", "vue/require-v-for-key", "vue/scoped-event-names", "vue/sfc-element-order", "vue/single-style-block", "vue/use-unique-element-ids", "vue/use-v-on-exact", "vue/v-bind-style", "vue/v-on-style", "vue/v-slot-style", "vue/valid-attribute-name", "vue/valid-v-bind", "vue/valid-v-else", "vue/valid-v-for", "vue/valid-v-if", "vue/valid-v-memo", "vue/valid-v-model", "vue/valid-v-on", "vue/valid-v-show", "vue/valid-v-slot", "vue/warn-custom-block", "vue/warn-custom-directive"];
|
|
@@ -498,7 +556,15 @@ type UserConfig = VizeConfig & {
|
|
|
498
556
|
*/
|
|
499
557
|
lsp?: LanguageServerConfig;
|
|
500
558
|
};
|
|
501
|
-
type
|
|
559
|
+
type UserConfigInput = UserConfig | VizeConfigEntry[];
|
|
560
|
+
type ResolvedVizeConfig = VizeConfig & {
|
|
561
|
+
/**
|
|
562
|
+
* Normalized flat entries. Plain object configs become one entry; array configs
|
|
563
|
+
* keep their order.
|
|
564
|
+
*/
|
|
565
|
+
entries: VizeConfigEntry[];
|
|
566
|
+
};
|
|
567
|
+
type UserConfigExport = UserConfigInput | ((env: ConfigEnv) => MaybePromise<UserConfigInput>);
|
|
502
568
|
interface LoadConfigOptions {
|
|
503
569
|
/**
|
|
504
570
|
* Config file search mode
|
|
@@ -536,11 +602,12 @@ declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
|
536
602
|
/**
|
|
537
603
|
* Load `vize.config.*` from the specified directory.
|
|
538
604
|
*/
|
|
539
|
-
declare function loadConfig(root: string, options?: LoadConfigOptions): Promise<
|
|
605
|
+
declare function loadConfig(root: string, options?: LoadConfigOptions): Promise<ResolvedVizeConfig | null>;
|
|
606
|
+
declare function resolveConfigExport(exported: UserConfigExport, env?: ConfigEnv): Promise<ResolvedVizeConfig>;
|
|
540
607
|
/**
|
|
541
608
|
* Normalize GlobalTypesConfig shorthand strings to GlobalTypeDeclaration objects
|
|
542
609
|
*/
|
|
543
610
|
declare function normalizeGlobalTypes(config: GlobalTypesConfig): Record<string, GlobalTypeDeclaration>;
|
|
544
611
|
//#endregion
|
|
545
|
-
export {
|
|
546
|
-
//# sourceMappingURL=config-
|
|
612
|
+
export { TypeCheckerConfig as A, LinterConfig as C, MuseaVrtConfig as D, MuseaConfig as E, VizeConfig as M, VizeConfigEntry as N, RuleCategory as O, LintPreset as S, MuseaAutogenConfig as T, CompilerConfig as _, loadConfig as a, GlobalTypesConfig as b, LspConfig as c, MaybePromise as d, ResolvedVizeConfig as f, LintRulesConfig as g, LintRuleName as h, defineConfig as i, VitePluginConfig as j, RuleSeverity as k, ConfigEnv as l, UserConfigInput as m, VIZE_CONFIG_JSON_SCHEMA_PATH as n, normalizeGlobalTypes as o, UserConfigExport as p, VIZE_CONFIG_PKL_SCHEMA_PATH as r, resolveConfigExport as s, CONFIG_FILE_NAMES as t, LoadConfigOptions as u, FormatterConfig as v, MuseaA11yConfig as w, LanguageServerConfig as x, GlobalTypeDeclaration as y };
|
|
613
|
+
//# sourceMappingURL=config-CRvVIvqJ.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-CRvVIvqJ.d.mts","names":[],"sources":["../src/types/generated.ts","../src/types/rules.ts","../src/types/runtime.ts","../src/types/index.ts","../src/config.ts"],"mappings":";;AAOA;;;;KAAY,UAAA;AAAA,KAQA,YAAA;AAAA,KAEA,YAAA;;;;UAKK,UAAA;EALO;;;EAStB,IAAA;EAJe;;;EAQf,QAAA;EAcO;;;EAVP,KAAA;EAciB;;;EAVjB,OAAA;EAiBU;;;EAbV,OAAA;EACA,QAAA,GAAW,cAAA;EACX,IAAA,GAAO,gBAAA;EACP,MAAA,GAAS,YAAA;EACT,WAAA,GAAc,iBAAA;EACd,SAAA,GAAY,eAAA;EACZ,cAAA,GAAiB,oBAAA;EACjB,GAAA,GAAM,oBAAA;EACN,KAAA,GAAQ,WAAA;EACR,WAAA,GAAc,iBAAA;EANL;;;EAUT,OAAA,GAAU,eAAA;AAAA;;;;UAKK,cAAA;EAVf;;;EAcA,IAAA;EATA;;;EAaA,KAAA;EARe;;;EAYf,GAAA;EARA;;;EAYA,eAAA;EAIA;;;EAAA,SAAA;EAgBA;;;EAZA,iBAAA;EAwBiB;;AAKnB;EAzBE,WAAA;;;;EAIA,aAAA;EA6BsC;;;EAzBtC,IAAA;EAqBmB;;;EAjBnB,SAAA;EAqBsC;;;EAjBtC,iBAAA;EAyBc;AAKhB;;EA1BE,iBAAA;AAAA;;;;UAKe,gBAAA;EAuCf;;;EAnCA,OAAA,YAAmB,MAAA,aAAmB,MAAA;EAuCpC;;;EAnCF,OAAA,YAAmB,MAAA,aAAmB,MAAA;EAqC5B;AAMZ;;EAvCE,YAAA;EAuCgC;;;EAnChC,cAAA;AAAA;;;;UAKe,YAAA;EAkEf;;;EA9DA,OAAA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
1
|
-
import { a as loadConfig, i as defineConfig, n as VIZE_CONFIG_JSON_SCHEMA_PATH, o as normalizeGlobalTypes, r as VIZE_CONFIG_PKL_SCHEMA_PATH, t as CONFIG_FILE_NAMES } from "./config-
|
|
2
|
-
export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes };
|
|
1
|
+
import { a as loadConfig, i as defineConfig, n as VIZE_CONFIG_JSON_SCHEMA_PATH, o as normalizeGlobalTypes, r as VIZE_CONFIG_PKL_SCHEMA_PATH, s as resolveConfigExport, t as CONFIG_FILE_NAMES } from "./config-CRvVIvqJ.mjs";
|
|
2
|
+
export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes, resolveConfigExport };
|
package/dist/config.mjs
CHANGED
|
@@ -180,7 +180,51 @@ function parseJsonConfig(content, filePath) {
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
function normalizeLoadedConfig(config) {
|
|
183
|
-
|
|
183
|
+
const normalized = stripNullish(config);
|
|
184
|
+
if (Array.isArray(normalized)) return normalizeConfigEntries(normalized);
|
|
185
|
+
return normalizeConfigObject(normalized ?? {});
|
|
186
|
+
}
|
|
187
|
+
function normalizeConfigObject(config) {
|
|
188
|
+
const { entries: rawEntries, ...rootConfig } = normalizeConfigAliases(config);
|
|
189
|
+
const rootEntry = rootConfig;
|
|
190
|
+
const entries = [...isEmptyConfigEntry(rootEntry) ? [] : [rootEntry], ...(rawEntries ?? []).map((entry) => normalizeConfigAliases(entry))];
|
|
191
|
+
return {
|
|
192
|
+
...rootEntry,
|
|
193
|
+
entries
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function normalizeConfigEntries(entries) {
|
|
197
|
+
const normalizedEntries = entries.map((entry) => normalizeConfigAliases(entry));
|
|
198
|
+
return {
|
|
199
|
+
...mergeConfigEntries(normalizedEntries.filter(isGlobalConfigEntry)),
|
|
200
|
+
entries: normalizedEntries
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function mergeConfigEntries(entries) {
|
|
204
|
+
const result = {};
|
|
205
|
+
for (const entry of entries) deepMerge(result, stripEntryMetadata(entry));
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
function stripEntryMetadata(entry) {
|
|
209
|
+
const { name, basePath, files, ignores, extends: extendsConfig, ...config } = entry;
|
|
210
|
+
return config;
|
|
211
|
+
}
|
|
212
|
+
function deepMerge(target, source) {
|
|
213
|
+
for (const [key, value] of Object.entries(source)) {
|
|
214
|
+
if (value === void 0) continue;
|
|
215
|
+
const current = target[key];
|
|
216
|
+
if (isPlainObject(current) && isPlainObject(value)) deepMerge(current, value);
|
|
217
|
+
else target[key] = value;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function isGlobalConfigEntry(entry) {
|
|
221
|
+
return entry.basePath === void 0 && entry.files === void 0 && entry.ignores === void 0;
|
|
222
|
+
}
|
|
223
|
+
function isEmptyConfigEntry(entry) {
|
|
224
|
+
return Object.keys(entry).length === 0;
|
|
225
|
+
}
|
|
226
|
+
function isPlainObject(value) {
|
|
227
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
184
228
|
}
|
|
185
229
|
function stripNullish(value) {
|
|
186
230
|
if (value === null) return;
|
|
@@ -219,6 +263,6 @@ function normalizeConfigAliases(config) {
|
|
|
219
263
|
};
|
|
220
264
|
}
|
|
221
265
|
//#endregion
|
|
222
|
-
export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes };
|
|
266
|
+
export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes, resolveConfigExport };
|
|
223
267
|
|
|
224
268
|
//# sourceMappingURL=config.mjs.map
|
package/dist/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { execFileSync } from \"node:child_process\";\nimport { randomUUID } from \"node:crypto\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { transform } from \"oxc-transform\";\nimport type {\n LanguageServerConfig,\n VizeConfig,\n LoadConfigOptions,\n UserConfigExport,\n ConfigEnv,\n GlobalTypesConfig,\n GlobalTypeDeclaration,\n} from \"./types/index.js\";\n\nexport const CONFIG_FILE_NAMES = [\n \"vize.config.pkl\",\n \"vize.config.ts\",\n \"vize.config.js\",\n \"vize.config.mjs\",\n \"vize.config.json\",\n] as const;\n\nconst DEFAULT_CONFIG_ENV: ConfigEnv = {\n mode: \"development\",\n command: \"serve\",\n};\n\nconst PACKAGE_ROOT = path.resolve(fileURLToPath(new URL(\".\", import.meta.url)), \"..\");\n\nexport const VIZE_CONFIG_JSON_SCHEMA_PATH = path.join(\n PACKAGE_ROOT,\n \"schemas\",\n \"vize.config.schema.json\",\n);\n\nexport const VIZE_CONFIG_PKL_SCHEMA_PATH = path.join(PACKAGE_ROOT, \"pkl\", \"vize.pkl\");\n\nconst DOCUMENTED_PKL_SCHEMA_IMPORT_RE =\n /^(\\s*(?:amends|import)\\s+)([\"'])node_modules\\/vize\\/pkl\\/(VizeConfig\\.pkl|vize\\.pkl)\\2/gm;\n\ntype CompatVizeConfig = VizeConfig & {\n lsp?: LanguageServerConfig;\n};\n\n/**\n * Define a Vize configuration with type checking.\n * Accepts a plain object or a function that receives ConfigEnv.\n */\nexport function defineConfig(config: UserConfigExport): UserConfigExport {\n return config;\n}\n\n/**\n * Load `vize.config.*` from the specified directory.\n */\nexport async function loadConfig(\n root: string,\n options: LoadConfigOptions = {},\n): Promise<VizeConfig | null> {\n const { mode = \"root\", configFile, env } = options;\n\n if (mode === \"none\") {\n return null;\n }\n\n if (configFile) {\n const absolutePath = path.isAbsolute(configFile) ? configFile : path.resolve(root, configFile);\n if (fs.existsSync(absolutePath)) {\n return loadConfigFile(absolutePath, env);\n }\n return null;\n }\n\n if (mode === \"auto\") {\n return loadConfigFromDirAuto(root, env);\n }\n\n return loadConfigFromDir(root, env);\n}\n\nasync function loadConfigFromDir(dir: string, env?: ConfigEnv): Promise<VizeConfig | null> {\n for (const name of CONFIG_FILE_NAMES) {\n const filePath = path.join(dir, name);\n if (!fs.existsSync(filePath)) {\n continue;\n }\n\n const config = await loadConfigFile(filePath, env);\n if (config !== null) {\n return config;\n }\n }\n return null;\n}\n\nasync function loadConfigFromDirAuto(\n startDir: string,\n env?: ConfigEnv,\n): Promise<VizeConfig | null> {\n let currentDir = path.resolve(startDir);\n\n while (true) {\n const config = await loadConfigFromDir(currentDir, env);\n if (config !== null) {\n return config;\n }\n\n const parentDir = path.dirname(currentDir);\n if (parentDir === currentDir) {\n return null;\n }\n\n currentDir = parentDir;\n }\n}\n\nasync function loadConfigFile(filePath: string, env?: ConfigEnv): Promise<VizeConfig | null> {\n const absolutePath = path.resolve(filePath);\n if (!fs.existsSync(absolutePath)) {\n return null;\n }\n\n const ext = path.extname(absolutePath);\n\n if (ext === \".pkl\") {\n return loadPklConfig(absolutePath);\n }\n\n if (ext === \".json\") {\n const content = fs.readFileSync(absolutePath, \"utf-8\");\n return parseJsonConfig(content, absolutePath);\n }\n\n if (ext === \".ts\") {\n return loadTypeScriptConfig(absolutePath, env);\n }\n\n return loadESMConfig(absolutePath, env);\n}\n\nfunction findPklBinary(): string | null {\n try {\n const pklPkgPath = import.meta.resolve?.(\"@pkl-community/pkl\");\n if (pklPkgPath) {\n const pklLibDir = path.dirname(fileURLToPath(pklPkgPath));\n const pklPackageDir = path.dirname(pklLibDir);\n const candidates = [\n path.join(pklLibDir, \"main.js\"),\n path.join(pklPackageDir, \"pkl\"),\n path.join(pklPackageDir, \"pkl.exe\"),\n ];\n\n for (const candidate of candidates) {\n if (fs.existsSync(candidate)) {\n try {\n execFileSync(candidate, [\"--version\"], { stdio: \"ignore\" });\n return candidate;\n } catch {\n // Keep looking: the bundled shim can exist even when its runtime is unavailable.\n }\n }\n }\n }\n } catch {\n // Fall back to PATH below.\n }\n\n try {\n execFileSync(\"pkl\", [\"--version\"], { stdio: \"ignore\" });\n return \"pkl\";\n } catch {\n return null;\n }\n}\n\nfunction loadPklConfig(filePath: string): VizeConfig | null {\n const pklBin = findPklBinary();\n if (!pklBin) {\n console.warn(\n \"[vize] pkl CLI not found. Install @pkl-community/pkl or add pkl to PATH. \" +\n \"Falling back to the next config format.\",\n );\n return null;\n }\n\n let output: string;\n const patchedFilePath = createPklConfigWithBundledSchemaImports(filePath);\n const evalFilePath = patchedFilePath ?? filePath;\n try {\n output = execFileSync(pklBin, [\"eval\", \"-f\", \"json\", evalFilePath], {\n cwd: path.dirname(filePath),\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n timeout: 30_000,\n });\n } catch (error) {\n throw new Error(`Failed to evaluate vize PKL config at ${filePath}: ${getErrorMessage(error)}`);\n } finally {\n if (patchedFilePath) {\n fs.rmSync(patchedFilePath, { force: true });\n }\n }\n return parseJsonConfig(output, filePath);\n}\n\nfunction createPklConfigWithBundledSchemaImports(filePath: string): string | null {\n const configDir = path.dirname(filePath);\n const source = fs.readFileSync(filePath, \"utf-8\");\n let patched = false;\n\n const content = source.replace(\n DOCUMENTED_PKL_SCHEMA_IMPORT_RE,\n (match, prefix, quote, schemaFile) => {\n const projectSchemaPath = path.join(configDir, \"node_modules\", \"vize\", \"pkl\", schemaFile);\n if (fs.existsSync(projectSchemaPath)) {\n return match;\n }\n\n const bundledSchemaPath = path.join(PACKAGE_ROOT, \"pkl\", schemaFile);\n if (!fs.existsSync(bundledSchemaPath)) {\n return match;\n }\n\n patched = true;\n return `${prefix}${quote}${pathToFileURL(bundledSchemaPath).href}${quote}`;\n },\n );\n\n if (!patched) {\n return null;\n }\n\n const tempFile = path.join(\n configDir,\n `.vize-config-${process.pid}-${Date.now()}-${randomUUID()}.pkl`,\n );\n fs.writeFileSync(tempFile, content, { flag: \"wx\", mode: 0o600 });\n return tempFile;\n}\n\nasync function resolveConfigExport(\n exported: UserConfigExport,\n env?: ConfigEnv,\n): Promise<VizeConfig> {\n if (typeof exported === \"function\") {\n return normalizeLoadedConfig(await exported(env ?? DEFAULT_CONFIG_ENV));\n }\n\n return normalizeLoadedConfig(exported);\n}\n\nasync function loadTypeScriptConfig(filePath: string, env?: ConfigEnv): Promise<VizeConfig> {\n const source = fs.readFileSync(filePath, \"utf-8\");\n const result = await transform(filePath, source, {\n typescript: {\n onlyRemoveTypeImports: true,\n },\n });\n\n const tempFile = path.join(\n path.dirname(filePath),\n `.vize-config-${process.pid}-${Date.now()}-${randomUUID()}.mjs`,\n );\n fs.writeFileSync(tempFile, result.code, { flag: \"wx\", mode: 0o600 });\n\n try {\n const module = await importFresh(tempFile);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\n } finally {\n fs.rmSync(tempFile, { force: true });\n }\n}\n\nasync function loadESMConfig(filePath: string, env?: ConfigEnv): Promise<VizeConfig> {\n const module = await importFresh(filePath);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\n}\n\nasync function importFresh(filePath: string): Promise<Record<string, unknown>> {\n const fileUrl = pathToFileURL(filePath);\n fileUrl.searchParams.set(\"t\", String(fs.statSync(filePath).mtimeMs));\n return import(fileUrl.href);\n}\n\nfunction parseJsonConfig(content: string, filePath: string): VizeConfig {\n try {\n return normalizeLoadedConfig(JSON.parse(content));\n } catch (error) {\n throw new Error(`Failed to parse vize config JSON at ${filePath}: ${getErrorMessage(error)}`);\n }\n}\n\nfunction normalizeLoadedConfig(config: unknown): VizeConfig {\n const normalized = stripNullish(config);\n return normalizeConfigAliases((normalized ?? {}) as CompatVizeConfig);\n}\n\nfunction stripNullish(value: unknown): unknown {\n if (value === null) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n return value.map((entry) => stripNullish(entry)).filter((entry) => entry !== undefined);\n }\n\n if (typeof value === \"object\" && value !== null) {\n const result: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value)) {\n const normalizedEntry = stripNullish(entry);\n if (normalizedEntry !== undefined) {\n result[key] = normalizedEntry;\n }\n }\n return result;\n }\n\n return value;\n}\n\nfunction getErrorMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Normalize GlobalTypesConfig shorthand strings to GlobalTypeDeclaration objects\n */\nexport function normalizeGlobalTypes(\n config: GlobalTypesConfig,\n): Record<string, GlobalTypeDeclaration> {\n const resolvedConfig =\n \"types\" in config &&\n typeof config.types === \"object\" &&\n config.types !== null &&\n !Array.isArray(config.types)\n ? config.types\n : config;\n\n const result: Record<string, GlobalTypeDeclaration> = {};\n for (const [key, value] of Object.entries(resolvedConfig)) {\n if (typeof value === \"string\") {\n result[key] = { type: value };\n } else {\n result[key] = value;\n }\n }\n return result;\n}\n\nfunction normalizeConfigAliases(config: CompatVizeConfig): VizeConfig {\n if (config.lsp === undefined) {\n return config;\n }\n\n const { lsp, ...rest } = config;\n if (config.languageServer !== undefined) {\n return rest;\n }\n\n return {\n ...rest,\n languageServer: lsp,\n };\n}\n"],"mappings":";;;;;;;AAgBA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,qBAAgC;CACpC,MAAM;CACN,SAAS;CACV;AAED,MAAM,eAAe,KAAK,QAAQ,cAAc,IAAI,IAAI,KAAK,OAAO,KAAK,IAAI,CAAC,EAAE,KAAK;AAErF,MAAa,+BAA+B,KAAK,KAC/C,cACA,WACA,0BACD;AAED,MAAa,8BAA8B,KAAK,KAAK,cAAc,OAAO,WAAW;AAErF,MAAM,kCACJ;;;;;AAUF,SAAgB,aAAa,QAA4C;CACvE,OAAO;;;;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AAE,MAAM,OAAO;MAE7B,OAAO,OAAO;CAGlB,OAAO;;AAGT,SAAS,uBAAuB,QAAsC;CACpE,IAAI,OAAO,QAAQ,KAAA,GACjB,OAAO;CAGT,MAAM,EAAE,KAAK,GAAG,SAAS;CACzB,IAAI,OAAO,mBAAmB,KAAA,GAC5B,OAAO;CAGT,OAAO;EACL,GAAG;EACH,gBAAgB;EACjB"}
|
|
1
|
+
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { execFileSync } from \"node:child_process\";\nimport { randomUUID } from \"node:crypto\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { transform } from \"oxc-transform\";\nimport type {\n LanguageServerConfig,\n VizeConfig,\n VizeConfigEntry,\n ResolvedVizeConfig,\n LoadConfigOptions,\n UserConfigExport,\n ConfigEnv,\n GlobalTypesConfig,\n GlobalTypeDeclaration,\n} from \"./types/index.js\";\n\nexport const CONFIG_FILE_NAMES = [\n \"vize.config.pkl\",\n \"vize.config.ts\",\n \"vize.config.js\",\n \"vize.config.mjs\",\n \"vize.config.json\",\n] as const;\n\nconst DEFAULT_CONFIG_ENV: ConfigEnv = {\n mode: \"development\",\n command: \"serve\",\n};\n\nconst PACKAGE_ROOT = path.resolve(fileURLToPath(new URL(\".\", import.meta.url)), \"..\");\n\nexport const VIZE_CONFIG_JSON_SCHEMA_PATH = path.join(\n PACKAGE_ROOT,\n \"schemas\",\n \"vize.config.schema.json\",\n);\n\nexport const VIZE_CONFIG_PKL_SCHEMA_PATH = path.join(PACKAGE_ROOT, \"pkl\", \"vize.pkl\");\n\nconst DOCUMENTED_PKL_SCHEMA_IMPORT_RE =\n /^(\\s*(?:amends|import)\\s+)([\"'])node_modules\\/vize\\/pkl\\/(VizeConfig\\.pkl|vize\\.pkl)\\2/gm;\n\ntype CompatVizeConfig = VizeConfig & {\n lsp?: LanguageServerConfig;\n};\n\ntype CompatVizeConfigEntry = VizeConfigEntry & {\n lsp?: LanguageServerConfig;\n};\n\n/**\n * Define a Vize configuration with type checking.\n * Accepts a plain object or a function that receives ConfigEnv.\n */\nexport function defineConfig(config: UserConfigExport): UserConfigExport {\n return config;\n}\n\n/**\n * Load `vize.config.*` from the specified directory.\n */\nexport async function loadConfig(\n root: string,\n options: LoadConfigOptions = {},\n): Promise<ResolvedVizeConfig | null> {\n const { mode = \"root\", configFile, env } = options;\n\n if (mode === \"none\") {\n return null;\n }\n\n if (configFile) {\n const absolutePath = path.isAbsolute(configFile) ? configFile : path.resolve(root, configFile);\n if (fs.existsSync(absolutePath)) {\n return loadConfigFile(absolutePath, env);\n }\n return null;\n }\n\n if (mode === \"auto\") {\n return loadConfigFromDirAuto(root, env);\n }\n\n return loadConfigFromDir(root, env);\n}\n\nasync function loadConfigFromDir(dir: string, env?: ConfigEnv): Promise<ResolvedVizeConfig | null> {\n for (const name of CONFIG_FILE_NAMES) {\n const filePath = path.join(dir, name);\n if (!fs.existsSync(filePath)) {\n continue;\n }\n\n const config = await loadConfigFile(filePath, env);\n if (config !== null) {\n return config;\n }\n }\n return null;\n}\n\nasync function loadConfigFromDirAuto(\n startDir: string,\n env?: ConfigEnv,\n): Promise<ResolvedVizeConfig | null> {\n let currentDir = path.resolve(startDir);\n\n while (true) {\n const config = await loadConfigFromDir(currentDir, env);\n if (config !== null) {\n return config;\n }\n\n const parentDir = path.dirname(currentDir);\n if (parentDir === currentDir) {\n return null;\n }\n\n currentDir = parentDir;\n }\n}\n\nasync function loadConfigFile(\n filePath: string,\n env?: ConfigEnv,\n): Promise<ResolvedVizeConfig | null> {\n const absolutePath = path.resolve(filePath);\n if (!fs.existsSync(absolutePath)) {\n return null;\n }\n\n const ext = path.extname(absolutePath);\n\n if (ext === \".pkl\") {\n return loadPklConfig(absolutePath);\n }\n\n if (ext === \".json\") {\n const content = fs.readFileSync(absolutePath, \"utf-8\");\n return parseJsonConfig(content, absolutePath);\n }\n\n if (ext === \".ts\") {\n return loadTypeScriptConfig(absolutePath, env);\n }\n\n return loadESMConfig(absolutePath, env);\n}\n\nfunction findPklBinary(): string | null {\n try {\n const pklPkgPath = import.meta.resolve?.(\"@pkl-community/pkl\");\n if (pklPkgPath) {\n const pklLibDir = path.dirname(fileURLToPath(pklPkgPath));\n const pklPackageDir = path.dirname(pklLibDir);\n const candidates = [\n path.join(pklLibDir, \"main.js\"),\n path.join(pklPackageDir, \"pkl\"),\n path.join(pklPackageDir, \"pkl.exe\"),\n ];\n\n for (const candidate of candidates) {\n if (fs.existsSync(candidate)) {\n try {\n execFileSync(candidate, [\"--version\"], { stdio: \"ignore\" });\n return candidate;\n } catch {\n // Keep looking: the bundled shim can exist even when its runtime is unavailable.\n }\n }\n }\n }\n } catch {\n // Fall back to PATH below.\n }\n\n try {\n execFileSync(\"pkl\", [\"--version\"], { stdio: \"ignore\" });\n return \"pkl\";\n } catch {\n return null;\n }\n}\n\nfunction loadPklConfig(filePath: string): ResolvedVizeConfig | null {\n const pklBin = findPklBinary();\n if (!pklBin) {\n console.warn(\n \"[vize] pkl CLI not found. Install @pkl-community/pkl or add pkl to PATH. \" +\n \"Falling back to the next config format.\",\n );\n return null;\n }\n\n let output: string;\n const patchedFilePath = createPklConfigWithBundledSchemaImports(filePath);\n const evalFilePath = patchedFilePath ?? filePath;\n try {\n output = execFileSync(pklBin, [\"eval\", \"-f\", \"json\", evalFilePath], {\n cwd: path.dirname(filePath),\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n timeout: 30_000,\n });\n } catch (error) {\n throw new Error(`Failed to evaluate vize PKL config at ${filePath}: ${getErrorMessage(error)}`);\n } finally {\n if (patchedFilePath) {\n fs.rmSync(patchedFilePath, { force: true });\n }\n }\n return parseJsonConfig(output, filePath);\n}\n\nfunction createPklConfigWithBundledSchemaImports(filePath: string): string | null {\n const configDir = path.dirname(filePath);\n const source = fs.readFileSync(filePath, \"utf-8\");\n let patched = false;\n\n const content = source.replace(\n DOCUMENTED_PKL_SCHEMA_IMPORT_RE,\n (match, prefix, quote, schemaFile) => {\n const projectSchemaPath = path.join(configDir, \"node_modules\", \"vize\", \"pkl\", schemaFile);\n if (fs.existsSync(projectSchemaPath)) {\n return match;\n }\n\n const bundledSchemaPath = path.join(PACKAGE_ROOT, \"pkl\", schemaFile);\n if (!fs.existsSync(bundledSchemaPath)) {\n return match;\n }\n\n patched = true;\n return `${prefix}${quote}${pathToFileURL(bundledSchemaPath).href}${quote}`;\n },\n );\n\n if (!patched) {\n return null;\n }\n\n const tempFile = path.join(\n configDir,\n `.vize-config-${process.pid}-${Date.now()}-${randomUUID()}.pkl`,\n );\n fs.writeFileSync(tempFile, content, { flag: \"wx\", mode: 0o600 });\n return tempFile;\n}\n\nexport async function resolveConfigExport(\n exported: UserConfigExport,\n env?: ConfigEnv,\n): Promise<ResolvedVizeConfig> {\n if (typeof exported === \"function\") {\n return normalizeLoadedConfig(await exported(env ?? DEFAULT_CONFIG_ENV));\n }\n\n return normalizeLoadedConfig(exported);\n}\n\nasync function loadTypeScriptConfig(\n filePath: string,\n env?: ConfigEnv,\n): Promise<ResolvedVizeConfig> {\n const source = fs.readFileSync(filePath, \"utf-8\");\n const result = await transform(filePath, source, {\n typescript: {\n onlyRemoveTypeImports: true,\n },\n });\n\n const tempFile = path.join(\n path.dirname(filePath),\n `.vize-config-${process.pid}-${Date.now()}-${randomUUID()}.mjs`,\n );\n fs.writeFileSync(tempFile, result.code, { flag: \"wx\", mode: 0o600 });\n\n try {\n const module = await importFresh(tempFile);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\n } finally {\n fs.rmSync(tempFile, { force: true });\n }\n}\n\nasync function loadESMConfig(filePath: string, env?: ConfigEnv): Promise<ResolvedVizeConfig> {\n const module = await importFresh(filePath);\n const exported: UserConfigExport = module.default || module;\n return resolveConfigExport(exported, env);\n}\n\nasync function importFresh(filePath: string): Promise<Record<string, unknown>> {\n const fileUrl = pathToFileURL(filePath);\n fileUrl.searchParams.set(\"t\", String(fs.statSync(filePath).mtimeMs));\n return import(fileUrl.href);\n}\n\nfunction parseJsonConfig(content: string, filePath: string): ResolvedVizeConfig {\n try {\n return normalizeLoadedConfig(JSON.parse(content));\n } catch (error) {\n throw new Error(`Failed to parse vize config JSON at ${filePath}: ${getErrorMessage(error)}`);\n }\n}\n\nfunction normalizeLoadedConfig(config: unknown): ResolvedVizeConfig {\n const normalized = stripNullish(config);\n if (Array.isArray(normalized)) {\n return normalizeConfigEntries(normalized as CompatVizeConfigEntry[]);\n }\n\n return normalizeConfigObject((normalized ?? {}) as CompatVizeConfig);\n}\n\nfunction normalizeConfigObject(config: CompatVizeConfig): ResolvedVizeConfig {\n const { entries: rawEntries, ...rootConfig } = normalizeConfigAliases(config) as VizeConfig & {\n entries?: CompatVizeConfigEntry[];\n };\n const rootEntry = rootConfig as VizeConfigEntry;\n const entries = [\n ...(isEmptyConfigEntry(rootEntry) ? [] : [rootEntry]),\n ...(rawEntries ?? []).map((entry) => normalizeConfigAliases(entry) as VizeConfigEntry),\n ];\n\n return {\n ...rootEntry,\n entries,\n };\n}\n\nfunction normalizeConfigEntries(entries: CompatVizeConfigEntry[]): ResolvedVizeConfig {\n const normalizedEntries = entries.map(\n (entry) => normalizeConfigAliases(entry) as VizeConfigEntry,\n );\n const globalConfig = mergeConfigEntries(normalizedEntries.filter(isGlobalConfigEntry));\n\n return {\n ...globalConfig,\n entries: normalizedEntries,\n };\n}\n\nfunction mergeConfigEntries(entries: VizeConfigEntry[]): VizeConfigEntry {\n const result: Record<string, unknown> = {};\n for (const entry of entries) {\n deepMerge(result, stripEntryMetadata(entry));\n }\n return result as VizeConfigEntry;\n}\n\nfunction stripEntryMetadata(entry: VizeConfigEntry): Partial<VizeConfigEntry> {\n const { name, basePath, files, ignores, extends: extendsConfig, ...config } = entry;\n void name;\n void basePath;\n void files;\n void ignores;\n void extendsConfig;\n return config;\n}\n\nfunction deepMerge(target: Record<string, unknown>, source: Record<string, unknown>): void {\n for (const [key, value] of Object.entries(source)) {\n if (value === undefined) {\n continue;\n }\n\n const current = target[key];\n if (isPlainObject(current) && isPlainObject(value)) {\n deepMerge(current, value);\n } else {\n target[key] = value;\n }\n }\n}\n\nfunction isGlobalConfigEntry(entry: VizeConfigEntry): boolean {\n return entry.basePath === undefined && entry.files === undefined && entry.ignores === undefined;\n}\n\nfunction isEmptyConfigEntry(entry: VizeConfigEntry): boolean {\n return Object.keys(entry).length === 0;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction stripNullish(value: unknown): unknown {\n if (value === null) {\n return undefined;\n }\n\n if (Array.isArray(value)) {\n return value.map((entry) => stripNullish(entry)).filter((entry) => entry !== undefined);\n }\n\n if (typeof value === \"object\" && value !== null) {\n const result: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value)) {\n const normalizedEntry = stripNullish(entry);\n if (normalizedEntry !== undefined) {\n result[key] = normalizedEntry;\n }\n }\n return result;\n }\n\n return value;\n}\n\nfunction getErrorMessage(error: unknown): string {\n if (error instanceof Error) {\n return error.message;\n }\n\n return String(error);\n}\n\n/**\n * Normalize GlobalTypesConfig shorthand strings to GlobalTypeDeclaration objects\n */\nexport function normalizeGlobalTypes(\n config: GlobalTypesConfig,\n): Record<string, GlobalTypeDeclaration> {\n const resolvedConfig =\n \"types\" in config &&\n typeof config.types === \"object\" &&\n config.types !== null &&\n !Array.isArray(config.types)\n ? config.types\n : config;\n\n const result: Record<string, GlobalTypeDeclaration> = {};\n for (const [key, value] of Object.entries(resolvedConfig)) {\n if (typeof value === \"string\") {\n result[key] = { type: value };\n } else {\n result[key] = value;\n }\n }\n return result;\n}\n\nfunction normalizeConfigAliases(config: CompatVizeConfig): VizeConfig {\n if (config.lsp === undefined) {\n return config;\n }\n\n const { lsp, ...rest } = config;\n if (config.languageServer !== undefined) {\n return rest;\n }\n\n return {\n ...rest,\n languageServer: lsp,\n };\n}\n"],"mappings":";;;;;;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AO,OAAO;;EAGlB,OAAO;;CAGT,OAAO;;AAGT,SAAS,gBAAgB,OAAwB;CAC/C,IAAI,iBAAiB,OACnB,OAAO,MAAM;CAGf,OAAO,OAAO,MAAM;;;;;AAMtB,SAAgB,qBACd,QACuC;CACvC,MAAM,iBACJ,WAAW,UACX,OAAO,OAAO,UAAU,YACxB,OAAO,UAAU,QACjB,CAAC,MAAM,QAAQ,OAAO,MAAM,GACxB,OAAO,QACP;CAEN,MAAM,SAAgD,EAAE;CACxD,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,eAAe,EACvD,IAAI,OAAO,UAAU,UACnB,OAAO,OAAO,EAAE,MAAM,OAAO;MAE7B,OAAO,OAAO;CAGlB,OAAO;;AAGT,SAAS,uBAAuB,QAAsC;CACpE,IAAI,OAAO,QAAQ,KAAA,GACjB,OAAO;CAGT,MAAM,EAAE,KAAK,GAAG,SAAS;CACzB,IAAI,OAAO,mBAAmB,KAAA,GAC5B,OAAO;CAGT,OAAO;EACL,GAAG;EACH,gBAAgB;EACjB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { CONFIG_FILE_NAMES, type CompilerConfig, type ConfigEnv, type FormatterConfig, type GlobalTypeDeclaration, type GlobalTypesConfig, type LanguageServerConfig, type LintPreset, type LintRuleName, type LintRulesConfig, type LinterConfig, type LoadConfigOptions, type LspConfig, type MaybePromise, type MuseaA11yConfig, type MuseaAutogenConfig, type MuseaConfig, type MuseaVrtConfig, type RuleCategory, type RuleSeverity, type TypeCheckerConfig, type UserConfigExport, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, type VitePluginConfig, type VizeConfig, defineConfig, loadConfig, normalizeGlobalTypes };
|
|
1
|
+
import { A as TypeCheckerConfig, C as LinterConfig, D as MuseaVrtConfig, E as MuseaConfig, M as VizeConfig, N as VizeConfigEntry, O as RuleCategory, S as LintPreset, T as MuseaAutogenConfig, _ as CompilerConfig, a as loadConfig, b as GlobalTypesConfig, c as LspConfig, d as MaybePromise, f as ResolvedVizeConfig, g as LintRulesConfig, h as LintRuleName, i as defineConfig, j as VitePluginConfig, k as RuleSeverity, l as ConfigEnv, m as UserConfigInput, n as VIZE_CONFIG_JSON_SCHEMA_PATH, o as normalizeGlobalTypes, p as UserConfigExport, r as VIZE_CONFIG_PKL_SCHEMA_PATH, s as resolveConfigExport, t as CONFIG_FILE_NAMES, u as LoadConfigOptions, v as FormatterConfig, w as MuseaA11yConfig, x as LanguageServerConfig, y as GlobalTypeDeclaration } from "./config-CRvVIvqJ.mjs";
|
|
2
|
+
export { CONFIG_FILE_NAMES, type CompilerConfig, type ConfigEnv, type FormatterConfig, type GlobalTypeDeclaration, type GlobalTypesConfig, type LanguageServerConfig, type LintPreset, type LintRuleName, type LintRulesConfig, type LinterConfig, type LoadConfigOptions, type LspConfig, type MaybePromise, type MuseaA11yConfig, type MuseaAutogenConfig, type MuseaConfig, type MuseaVrtConfig, type ResolvedVizeConfig, type RuleCategory, type RuleSeverity, type TypeCheckerConfig, type UserConfigExport, type UserConfigInput, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, type VitePluginConfig, type VizeConfig, type VizeConfigEntry, defineConfig, loadConfig, normalizeGlobalTypes, resolveConfigExport };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes } from "./config.mjs";
|
|
2
|
-
export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes };
|
|
1
|
+
import { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes, resolveConfigExport } from "./config.mjs";
|
|
2
|
+
export { CONFIG_FILE_NAMES, VIZE_CONFIG_JSON_SCHEMA_PATH, VIZE_CONFIG_PKL_SCHEMA_PATH, defineConfig, loadConfig, normalizeGlobalTypes, resolveConfigExport };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vize",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.124.0",
|
|
4
4
|
"description": "Vize - High-performance Vue.js toolchain in Rust",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@vizejs/native": "0.
|
|
52
|
+
"@vizejs/native": "0.124.0",
|
|
53
53
|
"oxc-transform": "0.130.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
package/pkl/VizeConfig.pkl
CHANGED
|
@@ -23,6 +23,71 @@ import "LanguageServerConfig.pkl"
|
|
|
23
23
|
import "MuseaConfig.pkl"
|
|
24
24
|
import "GlobalTypesConfig.pkl"
|
|
25
25
|
|
|
26
|
+
typealias ConfigExtends = String | Listing<String>
|
|
27
|
+
|
|
28
|
+
class ConfigEntry {
|
|
29
|
+
/// Human-readable entry name for inspect output and diagnostics.
|
|
30
|
+
name: String? = null
|
|
31
|
+
|
|
32
|
+
/// Directory used as the base for scoped file patterns and relative paths.
|
|
33
|
+
basePath: String? = null
|
|
34
|
+
|
|
35
|
+
/// Glob patterns this entry applies to.
|
|
36
|
+
files: Listing<String>? = null
|
|
37
|
+
|
|
38
|
+
/// Glob patterns this entry excludes.
|
|
39
|
+
ignores: Listing<String>? = null
|
|
40
|
+
|
|
41
|
+
/// Base config files or presets amended by this entry.
|
|
42
|
+
`extends`: ConfigExtends? = null
|
|
43
|
+
|
|
44
|
+
/// Vue compiler options.
|
|
45
|
+
compiler: CompilerConfig.CompilerConfig = new CompilerConfig.CompilerConfig {}
|
|
46
|
+
|
|
47
|
+
/// Vite plugin options.
|
|
48
|
+
vite: VitePluginConfig.VitePluginConfig = new VitePluginConfig.VitePluginConfig {}
|
|
49
|
+
|
|
50
|
+
/// Linter options.
|
|
51
|
+
linter: LinterConfig.LinterConfig = new LinterConfig.LinterConfig {}
|
|
52
|
+
|
|
53
|
+
/// Type checker options.
|
|
54
|
+
typeChecker: TypeCheckerConfig.TypeCheckerConfig = new TypeCheckerConfig.TypeCheckerConfig {}
|
|
55
|
+
|
|
56
|
+
/// Formatter options.
|
|
57
|
+
formatter: FormatterConfig.FormatterConfig = new FormatterConfig.FormatterConfig {}
|
|
58
|
+
|
|
59
|
+
/// Language server options.
|
|
60
|
+
languageServer: LanguageServerConfig.LanguageServerConfig = new LanguageServerConfig.LanguageServerConfig {}
|
|
61
|
+
|
|
62
|
+
/// Legacy alias for `languageServer`.
|
|
63
|
+
@Deprecated {
|
|
64
|
+
message = "Use languageServer instead."
|
|
65
|
+
replaceWith = "languageServer"
|
|
66
|
+
}
|
|
67
|
+
lsp: LanguageServerConfig.LanguageServerConfig = languageServer
|
|
68
|
+
|
|
69
|
+
/// Musea component gallery options.
|
|
70
|
+
musea: MuseaConfig.MuseaConfig = new MuseaConfig.MuseaConfig {}
|
|
71
|
+
|
|
72
|
+
/// Global type declarations.
|
|
73
|
+
globalTypes: GlobalTypesConfig.GlobalTypesConfig = new GlobalTypesConfig.GlobalTypesConfig {}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/// Human-readable entry name for inspect output and diagnostics.
|
|
77
|
+
name: String? = null
|
|
78
|
+
|
|
79
|
+
/// Directory used as the base for scoped file patterns and relative paths.
|
|
80
|
+
basePath: String? = null
|
|
81
|
+
|
|
82
|
+
/// Glob patterns this config applies to.
|
|
83
|
+
files: Listing<String>? = null
|
|
84
|
+
|
|
85
|
+
/// Glob patterns this config excludes.
|
|
86
|
+
ignores: Listing<String>? = null
|
|
87
|
+
|
|
88
|
+
/// Base config files or presets amended by this config.
|
|
89
|
+
`extends`: ConfigExtends? = null
|
|
90
|
+
|
|
26
91
|
/// Vue compiler options.
|
|
27
92
|
compiler: CompilerConfig.CompilerConfig = new CompilerConfig.CompilerConfig {}
|
|
28
93
|
|
|
@@ -53,3 +118,6 @@ musea: MuseaConfig.MuseaConfig = new MuseaConfig.MuseaConfig {}
|
|
|
53
118
|
|
|
54
119
|
/// Global type declarations.
|
|
55
120
|
globalTypes: GlobalTypesConfig.GlobalTypesConfig = new GlobalTypesConfig.GlobalTypesConfig {}
|
|
121
|
+
|
|
122
|
+
/// Scoped config entries for monorepos and workspaces.
|
|
123
|
+
entries: Listing<ConfigEntry>? = null
|
|
@@ -15,6 +15,19 @@ local lintPresetEnum: JsonSchema = new JsonSchema {
|
|
|
15
15
|
enum = new Listing { "happy-path"; "opinionated"; "essential"; "incremental"; "ecosystem"; "nuxt" }
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
local stringListDef: JsonSchema = new JsonSchema {
|
|
19
|
+
type = "array"
|
|
20
|
+
items = new JsonSchema { type = "string" }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
local configExtendsDef: JsonSchema = new JsonSchema {
|
|
24
|
+
description = "Base config files or presets to compose"
|
|
25
|
+
oneOf = new Listing {
|
|
26
|
+
new JsonSchema { type = "string" }
|
|
27
|
+
stringListDef
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
18
31
|
local compilerConfigDef: JsonSchema = new JsonSchema {
|
|
19
32
|
type = "object"
|
|
20
33
|
description = "Vue compiler options"
|
|
@@ -594,6 +607,42 @@ local globalTypesConfigDef: JsonSchema = new JsonSchema {
|
|
|
594
607
|
}
|
|
595
608
|
}
|
|
596
609
|
|
|
610
|
+
local configEntryDef: JsonSchema = new JsonSchema {
|
|
611
|
+
type = "object"
|
|
612
|
+
description = "Scoped Vize config entry for monorepos and workspaces"
|
|
613
|
+
properties {
|
|
614
|
+
["name"] = new JsonSchema {
|
|
615
|
+
type = "string"
|
|
616
|
+
description = "Human-readable entry name for inspect output and diagnostics"
|
|
617
|
+
}
|
|
618
|
+
["basePath"] = new JsonSchema {
|
|
619
|
+
type = "string"
|
|
620
|
+
description = "Directory used as the base for scoped file patterns and relative paths"
|
|
621
|
+
}
|
|
622
|
+
["files"] = new JsonSchema {
|
|
623
|
+
type = "array"
|
|
624
|
+
items = new JsonSchema { type = "string" }
|
|
625
|
+
description = "Glob patterns this entry applies to"
|
|
626
|
+
}
|
|
627
|
+
["ignores"] = new JsonSchema {
|
|
628
|
+
type = "array"
|
|
629
|
+
items = new JsonSchema { type = "string" }
|
|
630
|
+
description = "Glob patterns this entry excludes"
|
|
631
|
+
}
|
|
632
|
+
["extends"] = configExtendsDef
|
|
633
|
+
["compiler"] = new JsonSchema { `$ref` = "#/definitions/CompilerConfig" }
|
|
634
|
+
["vite"] = new JsonSchema { `$ref` = "#/definitions/VitePluginConfig" }
|
|
635
|
+
["linter"] = new JsonSchema { `$ref` = "#/definitions/LinterConfig" }
|
|
636
|
+
["typeChecker"] = new JsonSchema { `$ref` = "#/definitions/TypeCheckerConfig" }
|
|
637
|
+
["formatter"] = new JsonSchema { `$ref` = "#/definitions/FormatterConfig" }
|
|
638
|
+
["languageServer"] = new JsonSchema { `$ref` = "#/definitions/LanguageServerConfig" }
|
|
639
|
+
["lsp"] = new JsonSchema { `$ref` = "#/definitions/LanguageServerConfig" }
|
|
640
|
+
["musea"] = new JsonSchema { `$ref` = "#/definitions/MuseaConfig" }
|
|
641
|
+
["globalTypes"] = new JsonSchema { `$ref` = "#/definitions/GlobalTypesConfig" }
|
|
642
|
+
}
|
|
643
|
+
additionalProperties = false
|
|
644
|
+
}
|
|
645
|
+
|
|
597
646
|
output {
|
|
598
647
|
value = new JsonSchema {
|
|
599
648
|
`$schema` = "http://json-schema.org/draft-07/schema#"
|
|
@@ -614,12 +663,32 @@ output {
|
|
|
614
663
|
["MuseaConfig"] = museaConfigDef
|
|
615
664
|
["GlobalTypeDeclaration"] = globalTypeDeclarationDef
|
|
616
665
|
["GlobalTypesConfig"] = globalTypesConfigDef
|
|
666
|
+
["VizeConfigEntry"] = configEntryDef
|
|
617
667
|
}
|
|
618
668
|
properties {
|
|
619
669
|
["$schema"] = new JsonSchema {
|
|
620
670
|
type = "string"
|
|
621
671
|
description = "JSON Schema reference for editor autocompletion"
|
|
622
672
|
}
|
|
673
|
+
["name"] = new JsonSchema {
|
|
674
|
+
type = "string"
|
|
675
|
+
description = "Human-readable entry name for inspect output and diagnostics"
|
|
676
|
+
}
|
|
677
|
+
["basePath"] = new JsonSchema {
|
|
678
|
+
type = "string"
|
|
679
|
+
description = "Directory used as the base for scoped file patterns and relative paths"
|
|
680
|
+
}
|
|
681
|
+
["files"] = new JsonSchema {
|
|
682
|
+
type = "array"
|
|
683
|
+
items = new JsonSchema { type = "string" }
|
|
684
|
+
description = "Glob patterns this config applies to"
|
|
685
|
+
}
|
|
686
|
+
["ignores"] = new JsonSchema {
|
|
687
|
+
type = "array"
|
|
688
|
+
items = new JsonSchema { type = "string" }
|
|
689
|
+
description = "Glob patterns this config excludes"
|
|
690
|
+
}
|
|
691
|
+
["extends"] = configExtendsDef
|
|
623
692
|
["compiler"] = new JsonSchema { `$ref` = "#/definitions/CompilerConfig" }
|
|
624
693
|
["vite"] = new JsonSchema { `$ref` = "#/definitions/VitePluginConfig" }
|
|
625
694
|
["linter"] = new JsonSchema { `$ref` = "#/definitions/LinterConfig" }
|
|
@@ -629,6 +698,11 @@ output {
|
|
|
629
698
|
["lsp"] = new JsonSchema { `$ref` = "#/definitions/LanguageServerConfig" }
|
|
630
699
|
["musea"] = new JsonSchema { `$ref` = "#/definitions/MuseaConfig" }
|
|
631
700
|
["globalTypes"] = new JsonSchema { `$ref` = "#/definitions/GlobalTypesConfig" }
|
|
701
|
+
["entries"] = new JsonSchema {
|
|
702
|
+
type = "array"
|
|
703
|
+
items = new JsonSchema { `$ref` = "#/definitions/VizeConfigEntry" }
|
|
704
|
+
description = "Scoped config entries for monorepos and workspaces"
|
|
705
|
+
}
|
|
632
706
|
}
|
|
633
707
|
additionalProperties = false
|
|
634
708
|
}
|
package/pkl/vize.pkl
CHANGED
|
@@ -15,6 +15,7 @@ typealias LintPreset = "happy-path" | "opinionated" | "essential" | "incremental
|
|
|
15
15
|
typealias TrailingComma = "all" | "none" | "es5"
|
|
16
16
|
typealias FilterPattern = String | Listing<String>
|
|
17
17
|
typealias GlobalTypeValue = String | GlobalTypeDeclaration
|
|
18
|
+
typealias ConfigExtends = String | Listing<String>
|
|
18
19
|
|
|
19
20
|
class CompilerConfig {
|
|
20
21
|
mode: CompilerMode? = null
|
|
@@ -139,6 +140,29 @@ class GlobalTypeDeclaration {
|
|
|
139
140
|
defaultValue: String? = null
|
|
140
141
|
}
|
|
141
142
|
|
|
143
|
+
class ConfigEntry {
|
|
144
|
+
name: String? = null
|
|
145
|
+
basePath: String? = null
|
|
146
|
+
files: Listing<String>? = null
|
|
147
|
+
ignores: Listing<String>? = null
|
|
148
|
+
`extends`: ConfigExtends? = null
|
|
149
|
+
compiler: CompilerConfig?
|
|
150
|
+
vite: VitePluginConfig?
|
|
151
|
+
linter: LinterConfig?
|
|
152
|
+
typeChecker: TypeCheckerConfig?
|
|
153
|
+
formatter: FormatterConfig?
|
|
154
|
+
languageServer: LspConfig?
|
|
155
|
+
/// Deprecated: use `languageServer`.
|
|
156
|
+
lsp: LspConfig?
|
|
157
|
+
musea: MuseaConfig?
|
|
158
|
+
globalTypes: Mapping<String, GlobalTypeValue>? = null
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
name: String? = null
|
|
162
|
+
basePath: String? = null
|
|
163
|
+
files: Listing<String>? = null
|
|
164
|
+
ignores: Listing<String>? = null
|
|
165
|
+
`extends`: ConfigExtends? = null
|
|
142
166
|
compiler: CompilerConfig?
|
|
143
167
|
vite: VitePluginConfig?
|
|
144
168
|
linter: LinterConfig?
|
|
@@ -149,3 +173,4 @@ languageServer: LspConfig?
|
|
|
149
173
|
lsp: LspConfig?
|
|
150
174
|
musea: MuseaConfig?
|
|
151
175
|
globalTypes: Mapping<String, GlobalTypeValue>? = null
|
|
176
|
+
entries: Listing<ConfigEntry>? = null
|
|
@@ -619,6 +619,76 @@
|
|
|
619
619
|
}
|
|
620
620
|
]
|
|
621
621
|
}
|
|
622
|
+
},
|
|
623
|
+
"VizeConfigEntry": {
|
|
624
|
+
"description": "Scoped Vize config entry for monorepos and workspaces",
|
|
625
|
+
"type": "object",
|
|
626
|
+
"properties": {
|
|
627
|
+
"name": {
|
|
628
|
+
"description": "Human-readable entry name for inspect output and diagnostics",
|
|
629
|
+
"type": "string"
|
|
630
|
+
},
|
|
631
|
+
"basePath": {
|
|
632
|
+
"description": "Directory used as the base for scoped file patterns and relative paths",
|
|
633
|
+
"type": "string"
|
|
634
|
+
},
|
|
635
|
+
"files": {
|
|
636
|
+
"description": "Glob patterns this entry applies to",
|
|
637
|
+
"type": "array",
|
|
638
|
+
"items": {
|
|
639
|
+
"type": "string"
|
|
640
|
+
}
|
|
641
|
+
},
|
|
642
|
+
"ignores": {
|
|
643
|
+
"description": "Glob patterns this entry excludes",
|
|
644
|
+
"type": "array",
|
|
645
|
+
"items": {
|
|
646
|
+
"type": "string"
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
"extends": {
|
|
650
|
+
"description": "Base config files or presets to compose",
|
|
651
|
+
"oneOf": [
|
|
652
|
+
{
|
|
653
|
+
"type": "string"
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
"type": "array",
|
|
657
|
+
"items": {
|
|
658
|
+
"type": "string"
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
]
|
|
662
|
+
},
|
|
663
|
+
"compiler": {
|
|
664
|
+
"$ref": "#/definitions/CompilerConfig"
|
|
665
|
+
},
|
|
666
|
+
"vite": {
|
|
667
|
+
"$ref": "#/definitions/VitePluginConfig"
|
|
668
|
+
},
|
|
669
|
+
"linter": {
|
|
670
|
+
"$ref": "#/definitions/LinterConfig"
|
|
671
|
+
},
|
|
672
|
+
"typeChecker": {
|
|
673
|
+
"$ref": "#/definitions/TypeCheckerConfig"
|
|
674
|
+
},
|
|
675
|
+
"formatter": {
|
|
676
|
+
"$ref": "#/definitions/FormatterConfig"
|
|
677
|
+
},
|
|
678
|
+
"languageServer": {
|
|
679
|
+
"$ref": "#/definitions/LanguageServerConfig"
|
|
680
|
+
},
|
|
681
|
+
"lsp": {
|
|
682
|
+
"$ref": "#/definitions/LanguageServerConfig"
|
|
683
|
+
},
|
|
684
|
+
"musea": {
|
|
685
|
+
"$ref": "#/definitions/MuseaConfig"
|
|
686
|
+
},
|
|
687
|
+
"globalTypes": {
|
|
688
|
+
"$ref": "#/definitions/GlobalTypesConfig"
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
"additionalProperties": false
|
|
622
692
|
}
|
|
623
693
|
},
|
|
624
694
|
"title": "VizeConfig",
|
|
@@ -629,6 +699,42 @@
|
|
|
629
699
|
"description": "JSON Schema reference for editor autocompletion",
|
|
630
700
|
"type": "string"
|
|
631
701
|
},
|
|
702
|
+
"name": {
|
|
703
|
+
"description": "Human-readable entry name for inspect output and diagnostics",
|
|
704
|
+
"type": "string"
|
|
705
|
+
},
|
|
706
|
+
"basePath": {
|
|
707
|
+
"description": "Directory used as the base for scoped file patterns and relative paths",
|
|
708
|
+
"type": "string"
|
|
709
|
+
},
|
|
710
|
+
"files": {
|
|
711
|
+
"description": "Glob patterns this config applies to",
|
|
712
|
+
"type": "array",
|
|
713
|
+
"items": {
|
|
714
|
+
"type": "string"
|
|
715
|
+
}
|
|
716
|
+
},
|
|
717
|
+
"ignores": {
|
|
718
|
+
"description": "Glob patterns this config excludes",
|
|
719
|
+
"type": "array",
|
|
720
|
+
"items": {
|
|
721
|
+
"type": "string"
|
|
722
|
+
}
|
|
723
|
+
},
|
|
724
|
+
"extends": {
|
|
725
|
+
"description": "Base config files or presets to compose",
|
|
726
|
+
"oneOf": [
|
|
727
|
+
{
|
|
728
|
+
"type": "string"
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
"type": "array",
|
|
732
|
+
"items": {
|
|
733
|
+
"type": "string"
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
]
|
|
737
|
+
},
|
|
632
738
|
"compiler": {
|
|
633
739
|
"$ref": "#/definitions/CompilerConfig"
|
|
634
740
|
},
|
|
@@ -655,6 +761,13 @@
|
|
|
655
761
|
},
|
|
656
762
|
"globalTypes": {
|
|
657
763
|
"$ref": "#/definitions/GlobalTypesConfig"
|
|
764
|
+
},
|
|
765
|
+
"entries": {
|
|
766
|
+
"description": "Scoped config entries for monorepos and workspaces",
|
|
767
|
+
"type": "array",
|
|
768
|
+
"items": {
|
|
769
|
+
"$ref": "#/definitions/VizeConfigEntry"
|
|
770
|
+
}
|
|
658
771
|
}
|
|
659
772
|
},
|
|
660
773
|
"additionalProperties": false
|
package/src/config.ts
CHANGED
|
@@ -7,6 +7,8 @@ import { transform } from "oxc-transform";
|
|
|
7
7
|
import type {
|
|
8
8
|
LanguageServerConfig,
|
|
9
9
|
VizeConfig,
|
|
10
|
+
VizeConfigEntry,
|
|
11
|
+
ResolvedVizeConfig,
|
|
10
12
|
LoadConfigOptions,
|
|
11
13
|
UserConfigExport,
|
|
12
14
|
ConfigEnv,
|
|
@@ -44,6 +46,10 @@ type CompatVizeConfig = VizeConfig & {
|
|
|
44
46
|
lsp?: LanguageServerConfig;
|
|
45
47
|
};
|
|
46
48
|
|
|
49
|
+
type CompatVizeConfigEntry = VizeConfigEntry & {
|
|
50
|
+
lsp?: LanguageServerConfig;
|
|
51
|
+
};
|
|
52
|
+
|
|
47
53
|
/**
|
|
48
54
|
* Define a Vize configuration with type checking.
|
|
49
55
|
* Accepts a plain object or a function that receives ConfigEnv.
|
|
@@ -58,7 +64,7 @@ export function defineConfig(config: UserConfigExport): UserConfigExport {
|
|
|
58
64
|
export async function loadConfig(
|
|
59
65
|
root: string,
|
|
60
66
|
options: LoadConfigOptions = {},
|
|
61
|
-
): Promise<
|
|
67
|
+
): Promise<ResolvedVizeConfig | null> {
|
|
62
68
|
const { mode = "root", configFile, env } = options;
|
|
63
69
|
|
|
64
70
|
if (mode === "none") {
|
|
@@ -80,7 +86,7 @@ export async function loadConfig(
|
|
|
80
86
|
return loadConfigFromDir(root, env);
|
|
81
87
|
}
|
|
82
88
|
|
|
83
|
-
async function loadConfigFromDir(dir: string, env?: ConfigEnv): Promise<
|
|
89
|
+
async function loadConfigFromDir(dir: string, env?: ConfigEnv): Promise<ResolvedVizeConfig | null> {
|
|
84
90
|
for (const name of CONFIG_FILE_NAMES) {
|
|
85
91
|
const filePath = path.join(dir, name);
|
|
86
92
|
if (!fs.existsSync(filePath)) {
|
|
@@ -98,7 +104,7 @@ async function loadConfigFromDir(dir: string, env?: ConfigEnv): Promise<VizeConf
|
|
|
98
104
|
async function loadConfigFromDirAuto(
|
|
99
105
|
startDir: string,
|
|
100
106
|
env?: ConfigEnv,
|
|
101
|
-
): Promise<
|
|
107
|
+
): Promise<ResolvedVizeConfig | null> {
|
|
102
108
|
let currentDir = path.resolve(startDir);
|
|
103
109
|
|
|
104
110
|
while (true) {
|
|
@@ -116,7 +122,10 @@ async function loadConfigFromDirAuto(
|
|
|
116
122
|
}
|
|
117
123
|
}
|
|
118
124
|
|
|
119
|
-
async function loadConfigFile(
|
|
125
|
+
async function loadConfigFile(
|
|
126
|
+
filePath: string,
|
|
127
|
+
env?: ConfigEnv,
|
|
128
|
+
): Promise<ResolvedVizeConfig | null> {
|
|
120
129
|
const absolutePath = path.resolve(filePath);
|
|
121
130
|
if (!fs.existsSync(absolutePath)) {
|
|
122
131
|
return null;
|
|
@@ -175,7 +184,7 @@ function findPklBinary(): string | null {
|
|
|
175
184
|
}
|
|
176
185
|
}
|
|
177
186
|
|
|
178
|
-
function loadPklConfig(filePath: string):
|
|
187
|
+
function loadPklConfig(filePath: string): ResolvedVizeConfig | null {
|
|
179
188
|
const pklBin = findPklBinary();
|
|
180
189
|
if (!pklBin) {
|
|
181
190
|
console.warn(
|
|
@@ -240,10 +249,10 @@ function createPklConfigWithBundledSchemaImports(filePath: string): string | nul
|
|
|
240
249
|
return tempFile;
|
|
241
250
|
}
|
|
242
251
|
|
|
243
|
-
async function resolveConfigExport(
|
|
252
|
+
export async function resolveConfigExport(
|
|
244
253
|
exported: UserConfigExport,
|
|
245
254
|
env?: ConfigEnv,
|
|
246
|
-
): Promise<
|
|
255
|
+
): Promise<ResolvedVizeConfig> {
|
|
247
256
|
if (typeof exported === "function") {
|
|
248
257
|
return normalizeLoadedConfig(await exported(env ?? DEFAULT_CONFIG_ENV));
|
|
249
258
|
}
|
|
@@ -251,7 +260,10 @@ async function resolveConfigExport(
|
|
|
251
260
|
return normalizeLoadedConfig(exported);
|
|
252
261
|
}
|
|
253
262
|
|
|
254
|
-
async function loadTypeScriptConfig(
|
|
263
|
+
async function loadTypeScriptConfig(
|
|
264
|
+
filePath: string,
|
|
265
|
+
env?: ConfigEnv,
|
|
266
|
+
): Promise<ResolvedVizeConfig> {
|
|
255
267
|
const source = fs.readFileSync(filePath, "utf-8");
|
|
256
268
|
const result = await transform(filePath, source, {
|
|
257
269
|
typescript: {
|
|
@@ -274,7 +286,7 @@ async function loadTypeScriptConfig(filePath: string, env?: ConfigEnv): Promise<
|
|
|
274
286
|
}
|
|
275
287
|
}
|
|
276
288
|
|
|
277
|
-
async function loadESMConfig(filePath: string, env?: ConfigEnv): Promise<
|
|
289
|
+
async function loadESMConfig(filePath: string, env?: ConfigEnv): Promise<ResolvedVizeConfig> {
|
|
278
290
|
const module = await importFresh(filePath);
|
|
279
291
|
const exported: UserConfigExport = module.default || module;
|
|
280
292
|
return resolveConfigExport(exported, env);
|
|
@@ -286,7 +298,7 @@ async function importFresh(filePath: string): Promise<Record<string, unknown>> {
|
|
|
286
298
|
return import(fileUrl.href);
|
|
287
299
|
}
|
|
288
300
|
|
|
289
|
-
function parseJsonConfig(content: string, filePath: string):
|
|
301
|
+
function parseJsonConfig(content: string, filePath: string): ResolvedVizeConfig {
|
|
290
302
|
try {
|
|
291
303
|
return normalizeLoadedConfig(JSON.parse(content));
|
|
292
304
|
} catch (error) {
|
|
@@ -294,9 +306,86 @@ function parseJsonConfig(content: string, filePath: string): VizeConfig {
|
|
|
294
306
|
}
|
|
295
307
|
}
|
|
296
308
|
|
|
297
|
-
function normalizeLoadedConfig(config: unknown):
|
|
309
|
+
function normalizeLoadedConfig(config: unknown): ResolvedVizeConfig {
|
|
298
310
|
const normalized = stripNullish(config);
|
|
299
|
-
|
|
311
|
+
if (Array.isArray(normalized)) {
|
|
312
|
+
return normalizeConfigEntries(normalized as CompatVizeConfigEntry[]);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return normalizeConfigObject((normalized ?? {}) as CompatVizeConfig);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function normalizeConfigObject(config: CompatVizeConfig): ResolvedVizeConfig {
|
|
319
|
+
const { entries: rawEntries, ...rootConfig } = normalizeConfigAliases(config) as VizeConfig & {
|
|
320
|
+
entries?: CompatVizeConfigEntry[];
|
|
321
|
+
};
|
|
322
|
+
const rootEntry = rootConfig as VizeConfigEntry;
|
|
323
|
+
const entries = [
|
|
324
|
+
...(isEmptyConfigEntry(rootEntry) ? [] : [rootEntry]),
|
|
325
|
+
...(rawEntries ?? []).map((entry) => normalizeConfigAliases(entry) as VizeConfigEntry),
|
|
326
|
+
];
|
|
327
|
+
|
|
328
|
+
return {
|
|
329
|
+
...rootEntry,
|
|
330
|
+
entries,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function normalizeConfigEntries(entries: CompatVizeConfigEntry[]): ResolvedVizeConfig {
|
|
335
|
+
const normalizedEntries = entries.map(
|
|
336
|
+
(entry) => normalizeConfigAliases(entry) as VizeConfigEntry,
|
|
337
|
+
);
|
|
338
|
+
const globalConfig = mergeConfigEntries(normalizedEntries.filter(isGlobalConfigEntry));
|
|
339
|
+
|
|
340
|
+
return {
|
|
341
|
+
...globalConfig,
|
|
342
|
+
entries: normalizedEntries,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function mergeConfigEntries(entries: VizeConfigEntry[]): VizeConfigEntry {
|
|
347
|
+
const result: Record<string, unknown> = {};
|
|
348
|
+
for (const entry of entries) {
|
|
349
|
+
deepMerge(result, stripEntryMetadata(entry));
|
|
350
|
+
}
|
|
351
|
+
return result as VizeConfigEntry;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function stripEntryMetadata(entry: VizeConfigEntry): Partial<VizeConfigEntry> {
|
|
355
|
+
const { name, basePath, files, ignores, extends: extendsConfig, ...config } = entry;
|
|
356
|
+
void name;
|
|
357
|
+
void basePath;
|
|
358
|
+
void files;
|
|
359
|
+
void ignores;
|
|
360
|
+
void extendsConfig;
|
|
361
|
+
return config;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function deepMerge(target: Record<string, unknown>, source: Record<string, unknown>): void {
|
|
365
|
+
for (const [key, value] of Object.entries(source)) {
|
|
366
|
+
if (value === undefined) {
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const current = target[key];
|
|
371
|
+
if (isPlainObject(current) && isPlainObject(value)) {
|
|
372
|
+
deepMerge(current, value);
|
|
373
|
+
} else {
|
|
374
|
+
target[key] = value;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function isGlobalConfigEntry(entry: VizeConfigEntry): boolean {
|
|
380
|
+
return entry.basePath === undefined && entry.files === undefined && entry.ignores === undefined;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function isEmptyConfigEntry(entry: VizeConfigEntry): boolean {
|
|
384
|
+
return Object.keys(entry).length === 0;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
388
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
300
389
|
}
|
|
301
390
|
|
|
302
391
|
function stripNullish(value: unknown): unknown {
|
package/src/index.ts
CHANGED
|
@@ -29,8 +29,11 @@ export type {
|
|
|
29
29
|
LintPreset,
|
|
30
30
|
RuleSeverity,
|
|
31
31
|
RuleCategory,
|
|
32
|
+
VizeConfigEntry,
|
|
32
33
|
LintRuleName,
|
|
33
34
|
LintRulesConfig,
|
|
35
|
+
UserConfigInput,
|
|
36
|
+
ResolvedVizeConfig,
|
|
34
37
|
} from "./types/index.js";
|
|
35
38
|
|
|
36
39
|
// Config utilities
|
|
@@ -40,5 +43,6 @@ export {
|
|
|
40
43
|
VIZE_CONFIG_PKL_SCHEMA_PATH,
|
|
41
44
|
defineConfig,
|
|
42
45
|
loadConfig,
|
|
46
|
+
resolveConfigExport,
|
|
43
47
|
normalizeGlobalTypes,
|
|
44
48
|
} from "./config.js";
|
package/src/types/generated.ts
CHANGED
|
@@ -21,6 +21,26 @@ export type RuleCategory = "correctness" | "suspicious" | "style" | "perf" | "a1
|
|
|
21
21
|
* Configuration file for vize - High-performance Vue.js toolchain
|
|
22
22
|
*/
|
|
23
23
|
export interface VizeConfig {
|
|
24
|
+
/**
|
|
25
|
+
* Human-readable entry name for inspect output and diagnostics
|
|
26
|
+
*/
|
|
27
|
+
name?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Directory used as the base for scoped file patterns and relative paths
|
|
30
|
+
*/
|
|
31
|
+
basePath?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Glob patterns this config applies to
|
|
34
|
+
*/
|
|
35
|
+
files?: string[];
|
|
36
|
+
/**
|
|
37
|
+
* Glob patterns this config excludes
|
|
38
|
+
*/
|
|
39
|
+
ignores?: string[];
|
|
40
|
+
/**
|
|
41
|
+
* Base config files or presets to compose
|
|
42
|
+
*/
|
|
43
|
+
extends?: string | string[];
|
|
24
44
|
compiler?: CompilerConfig;
|
|
25
45
|
vite?: VitePluginConfig;
|
|
26
46
|
linter?: LinterConfig;
|
|
@@ -30,6 +50,10 @@ export interface VizeConfig {
|
|
|
30
50
|
lsp?: LanguageServerConfig;
|
|
31
51
|
musea?: MuseaConfig;
|
|
32
52
|
globalTypes?: GlobalTypesConfig;
|
|
53
|
+
/**
|
|
54
|
+
* Scoped config entries for monorepos and workspaces
|
|
55
|
+
*/
|
|
56
|
+
entries?: VizeConfigEntry[];
|
|
33
57
|
}
|
|
34
58
|
/**
|
|
35
59
|
* Vue compiler options
|
|
@@ -488,3 +512,37 @@ export interface GlobalTypeDeclaration {
|
|
|
488
512
|
*/
|
|
489
513
|
defaultValue?: string;
|
|
490
514
|
}
|
|
515
|
+
/**
|
|
516
|
+
* Scoped Vize config entry for monorepos and workspaces
|
|
517
|
+
*/
|
|
518
|
+
export interface VizeConfigEntry {
|
|
519
|
+
/**
|
|
520
|
+
* Human-readable entry name for inspect output and diagnostics
|
|
521
|
+
*/
|
|
522
|
+
name?: string;
|
|
523
|
+
/**
|
|
524
|
+
* Directory used as the base for scoped file patterns and relative paths
|
|
525
|
+
*/
|
|
526
|
+
basePath?: string;
|
|
527
|
+
/**
|
|
528
|
+
* Glob patterns this entry applies to
|
|
529
|
+
*/
|
|
530
|
+
files?: string[];
|
|
531
|
+
/**
|
|
532
|
+
* Glob patterns this entry excludes
|
|
533
|
+
*/
|
|
534
|
+
ignores?: string[];
|
|
535
|
+
/**
|
|
536
|
+
* Base config files or presets to compose
|
|
537
|
+
*/
|
|
538
|
+
extends?: string | string[];
|
|
539
|
+
compiler?: CompilerConfig;
|
|
540
|
+
vite?: VitePluginConfig;
|
|
541
|
+
linter?: LinterConfig;
|
|
542
|
+
typeChecker?: TypeCheckerConfig;
|
|
543
|
+
formatter?: FormatterConfig;
|
|
544
|
+
languageServer?: LanguageServerConfig;
|
|
545
|
+
lsp?: LanguageServerConfig;
|
|
546
|
+
musea?: MuseaConfig;
|
|
547
|
+
globalTypes?: GlobalTypesConfig;
|
|
548
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type {
|
|
|
3
3
|
RuleSeverity,
|
|
4
4
|
RuleCategory,
|
|
5
5
|
VizeConfig,
|
|
6
|
+
VizeConfigEntry,
|
|
6
7
|
CompilerConfig,
|
|
7
8
|
VitePluginConfig,
|
|
8
9
|
LinterConfig,
|
|
@@ -25,4 +26,11 @@ export type { LintRuleName, LintRulesConfig } from "./rules.js";
|
|
|
25
26
|
*/
|
|
26
27
|
export type LspConfig = import("./generated.js").LanguageServerConfig;
|
|
27
28
|
|
|
28
|
-
export type {
|
|
29
|
+
export type {
|
|
30
|
+
MaybePromise,
|
|
31
|
+
ConfigEnv,
|
|
32
|
+
UserConfigInput,
|
|
33
|
+
UserConfigExport,
|
|
34
|
+
ResolvedVizeConfig,
|
|
35
|
+
LoadConfigOptions,
|
|
36
|
+
} from "./runtime.js";
|
package/src/types/runtime.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LanguageServerConfig, VizeConfig } from "./generated.js";
|
|
1
|
+
import type { LanguageServerConfig, VizeConfig, VizeConfigEntry } from "./generated.js";
|
|
2
2
|
|
|
3
3
|
// ============================================================================
|
|
4
4
|
// TS-specific runtime types (cannot be expressed in Pkl)
|
|
@@ -20,7 +20,19 @@ export type UserConfig = VizeConfig & {
|
|
|
20
20
|
lsp?: LanguageServerConfig;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
export type
|
|
23
|
+
export type UserConfigInput = UserConfig | VizeConfigEntry[];
|
|
24
|
+
|
|
25
|
+
export type ResolvedVizeConfig = VizeConfig & {
|
|
26
|
+
/**
|
|
27
|
+
* Normalized flat entries. Plain object configs become one entry; array configs
|
|
28
|
+
* keep their order.
|
|
29
|
+
*/
|
|
30
|
+
entries: VizeConfigEntry[];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type UserConfigExport =
|
|
34
|
+
| UserConfigInput
|
|
35
|
+
| ((env: ConfigEnv) => MaybePromise<UserConfigInput>);
|
|
24
36
|
|
|
25
37
|
// ============================================================================
|
|
26
38
|
// LoadConfigOptions
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-MA8nXz11.d.mts","names":[],"sources":["../src/types/generated.ts","../src/types/rules.ts","../src/types/runtime.ts","../src/types/index.ts","../src/config.ts"],"mappings":";;AAOA;;;;KAAY,UAAA;AAAA,KAQA,YAAA;AAAA,KAEA,YAAA;;;;UAKK,UAAA;EACf,QAAA,GAAW,cAAA;EACX,IAAA,GAAO,gBAAA;EACP,MAAA,GAAS,YAAA;EACT,WAAA,GAAc,iBAAA;EACd,SAAA,GAAY,eAAA;EACZ,cAAA,GAAiB,oBAAA;EACjB,GAAA,GAAM,oBAAA;EACN,KAAA,GAAQ,WAAA;EACR,WAAA,GAAc,iBAAA;AAAA;;;;UAKC,cAAA;EANP;;;EAUR,IAAA;EAjBA;;;EAqBA,KAAA;EAnBA;;;EAuBA,GAAA;EArBA;;;EAyBA,eAAA;EAvBA;;;EA2BA,SAAA;EAzBA;;;EA6BA,iBAAA;EAxBe;;;EA4Bf,WAAA;EAxBA;;;EA4BA,aAAA;EAZA;;;EAgBA,IAAA;EAAA;;;EAIA,SAAA;EAQiB;;AAKnB;EATE,iBAAA;;;;EAIA,iBAAA;AAAA;;;;UAKe,gBAAA;EAIuB;;;EAAtC,OAAA,YAAmB,MAAA,aAAmB,MAAA;EAQtC;;;EAJA,OAAA,YAAmB,MAAA,aAAmB,MAAA;EAavB;;;EATf,YAAA;EAaA;;;EATA,cAAA;AAAA;;;;UAKe,YAAA;EAuBb;;;EAnBF,OAAA;EA0Be;;;EAtBf,MAAA;EA0BA;;;EAtBA,KAAA;IAAA,CACG,CAAA;EAAA;EA6CH;;;EAxCA,UAAA;IACE,WAAA;IACA,UAAA;IACA,KAAA;IACA,IAAA;IACA,IAAA;IACA,QAAA;EAAA;AAAA;;;;UAMa,iBAAA;EAyEf;;;EArEA,OAAA;EAqFA;;;EAjFA,MAAA;EAiGA;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