limina 0.1.2 → 0.2.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/LICENSE.md +535 -794
- package/bin/limina.js +5 -9
- package/checker-host-process.js +49 -0
- package/chunks/dep-BOg2f5FD.js +42 -0
- package/chunks/{dep-DJz9JBTi.js → dep-D63Sc9OL.js} +1074 -329
- package/chunks/dep-gI8bWpox.js +1092 -0
- package/cli.js +40572 -40696
- package/flow-renderer-process.js +4 -6
- package/index.d.ts +209 -50
- package/index.js +2 -3
- package/package.json +20 -15
- package/schemas/tsconfig-schema.json +9 -5
- package/chunks/dep-BPK-6PAr.js +0 -114
- package/chunks/dep-esXeyN9I.js +0 -194
- package/chunks/dep-mnWOqiGN.js +0 -244
|
@@ -2,21 +2,18 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
3
|
import ts from "typescript";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
-
|
|
6
5
|
//#region src/utils/collections.ts
|
|
7
6
|
function uniqueValues(values) {
|
|
8
7
|
return [...new Set(values)];
|
|
9
8
|
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
const result = [];
|
|
9
|
+
function countDefinedBy(values, getKey) {
|
|
10
|
+
const counts = /* @__PURE__ */ new Map();
|
|
13
11
|
for (const value of values) {
|
|
14
12
|
const key = getKey(value);
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
result.push(value);
|
|
13
|
+
if (!key) continue;
|
|
14
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
18
15
|
}
|
|
19
|
-
return
|
|
16
|
+
return counts;
|
|
20
17
|
}
|
|
21
18
|
function uniqueSortedStrings(values) {
|
|
22
19
|
return uniqueValues(values).sort((left, right) => left.localeCompare(right));
|
|
@@ -24,7 +21,6 @@ function uniqueSortedStrings(values) {
|
|
|
24
21
|
function uniqueTrimmedNonEmptySortedStrings(values) {
|
|
25
22
|
return uniqueSortedStrings([...values].map((value) => value?.trim()).filter((value) => Boolean(value)));
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
//#endregion
|
|
29
25
|
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
30
26
|
let _lazyMatch = () => {
|
|
@@ -273,7 +269,6 @@ const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
|
273
269
|
const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
274
270
|
const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
|
|
275
271
|
const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
|
|
276
|
-
const sep = "/";
|
|
277
272
|
const normalize = function(path) {
|
|
278
273
|
if (path.length === 0) return ".";
|
|
279
274
|
path = normalizeWindowsPath(path);
|
|
@@ -423,7 +418,7 @@ const basename = function(p, extension) {
|
|
|
423
418
|
}
|
|
424
419
|
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
425
420
|
};
|
|
426
|
-
const parse$
|
|
421
|
+
const parse$1 = function(p) {
|
|
427
422
|
const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
|
|
428
423
|
const base = basename(p);
|
|
429
424
|
const extension = extname(base);
|
|
@@ -449,16 +444,15 @@ const _path = {
|
|
|
449
444
|
matchesGlob,
|
|
450
445
|
normalize,
|
|
451
446
|
normalizeString,
|
|
452
|
-
parse: parse$
|
|
447
|
+
parse: parse$1,
|
|
453
448
|
relative,
|
|
454
449
|
resolve,
|
|
455
|
-
sep,
|
|
450
|
+
sep: "/",
|
|
456
451
|
toNamespacedPath
|
|
457
452
|
};
|
|
458
|
-
|
|
459
453
|
//#endregion
|
|
460
454
|
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.mjs
|
|
461
|
-
const delimiter = globalThis.process?.platform === "win32" ? ";" : ":";
|
|
455
|
+
const delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")();
|
|
462
456
|
const _platforms = {
|
|
463
457
|
posix: void 0,
|
|
464
458
|
win32: void 0
|
|
@@ -473,7 +467,6 @@ const mix = (del = delimiter) => {
|
|
|
473
467
|
};
|
|
474
468
|
const posix = /* @__PURE__ */ mix(":");
|
|
475
469
|
const win32 = /* @__PURE__ */ mix(";");
|
|
476
|
-
|
|
477
470
|
//#endregion
|
|
478
471
|
//#region src/utils/module-specifier.ts
|
|
479
472
|
function isRelativeSpecifier(specifier) {
|
|
@@ -491,7 +484,6 @@ function isPackageImportSpecifier(specifier) {
|
|
|
491
484
|
function isBarePackageSpecifier(specifier) {
|
|
492
485
|
return !isRelativeSpecifier(specifier) && !isPackageImportSpecifier(specifier) && !isUrlOrDataOrFileSpecifier(specifier) && !isVirtualModuleSpecifier(specifier) && !posix.isAbsolute(specifier);
|
|
493
486
|
}
|
|
494
|
-
|
|
495
487
|
//#endregion
|
|
496
488
|
//#region src/utils/path.ts
|
|
497
489
|
function toPosixPath(value) {
|
|
@@ -519,7 +511,6 @@ function isPathInsideDirectory(filePath, directoryPath) {
|
|
|
519
511
|
function normalizeComparableAbsolutePath(value) {
|
|
520
512
|
return normalizeAbsolutePathIdentity(isAbsolute(value) ? value : resolve(value));
|
|
521
513
|
}
|
|
522
|
-
|
|
523
514
|
//#endregion
|
|
524
515
|
//#region src/utils/module-resolution.ts
|
|
525
516
|
function pathHasExtension(value) {
|
|
@@ -589,7 +580,6 @@ function getPathsBasePath(compilerOptions) {
|
|
|
589
580
|
if (typeof pathsBasePath === "string") return pathsBasePath;
|
|
590
581
|
return compilerOptions.baseUrl ?? null;
|
|
591
582
|
}
|
|
592
|
-
|
|
593
583
|
//#endregion
|
|
594
584
|
//#region src/checkers.ts
|
|
595
585
|
function getTypeScriptExtensionApi() {
|
|
@@ -613,6 +603,11 @@ function getNativeTypeScriptProjectExtensions() {
|
|
|
613
603
|
};
|
|
614
604
|
return normalizeExtensions(flattenTypeScriptExtensionGroups(api.getSupportedExtensionsWithJsonIfResolveJsonModule(options, api.getSupportedExtensions(options))));
|
|
615
605
|
}
|
|
606
|
+
/** Uses the active compiler's supported-extension metadata, not a hard-coded list. */
|
|
607
|
+
function isNativeTypeScriptProjectInput(fileName) {
|
|
608
|
+
const normalizedFileName = fileName.toLowerCase();
|
|
609
|
+
return getNativeTypeScriptProjectExtensions().some((extension) => normalizedFileName.endsWith(extension.toLowerCase()));
|
|
610
|
+
}
|
|
616
611
|
function getBuildCheckerSupportedExtensions(preset) {
|
|
617
612
|
const adapter = getCheckerAdapter(preset);
|
|
618
613
|
if (!adapter || adapter.execution !== "build") return [];
|
|
@@ -623,6 +618,18 @@ function getSvelteCheckerExtensions() {
|
|
|
623
618
|
return normalizeExtensions([...getTypeScriptCheckerExtensions(), ".svelte"]);
|
|
624
619
|
}
|
|
625
620
|
const parsedProjectConfigCache = /* @__PURE__ */ new Map();
|
|
621
|
+
function createProjectParseHost(virtualFiles) {
|
|
622
|
+
if (!virtualFiles) return ts.sys;
|
|
623
|
+
return {
|
|
624
|
+
...ts.sys,
|
|
625
|
+
fileExists(fileName) {
|
|
626
|
+
return virtualFiles.has(normalizeAbsolutePath(fileName)) || ts.sys.fileExists(fileName);
|
|
627
|
+
},
|
|
628
|
+
readFile(fileName, encoding) {
|
|
629
|
+
return virtualFiles.get(normalizeAbsolutePath(fileName)) ?? ts.sys.readFile(fileName, encoding);
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
}
|
|
626
633
|
function createFormatHost(rootDir) {
|
|
627
634
|
return {
|
|
628
635
|
getCanonicalFileName: (fileName) => fileName,
|
|
@@ -632,8 +639,9 @@ function createFormatHost(rootDir) {
|
|
|
632
639
|
}
|
|
633
640
|
function readTypeScriptProjectConfig(options) {
|
|
634
641
|
const diagnostics = [];
|
|
642
|
+
const host = createProjectParseHost(options.virtualFiles);
|
|
635
643
|
const parsed = ts.getParsedCommandLineOfConfigFile(options.configPath, {}, {
|
|
636
|
-
...
|
|
644
|
+
...host,
|
|
637
645
|
onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
|
|
638
646
|
diagnostics.push(diagnostic);
|
|
639
647
|
}
|
|
@@ -662,19 +670,18 @@ function resolveContextCheckerPresets(context) {
|
|
|
662
670
|
return context.checkerPresets.length > 0 ? uniqueSortedStrings(context.checkerPresets) : ["tsc"];
|
|
663
671
|
}
|
|
664
672
|
function createParsedProjectConfigCacheKey(options) {
|
|
665
|
-
const
|
|
673
|
+
const normalizedConfigPath = normalizeAbsolutePath(options.configPath);
|
|
674
|
+
const virtualContent = options.virtualFiles?.get(normalizedConfigPath);
|
|
675
|
+
const configStat = virtualContent === void 0 ? statSync(options.configPath) : null;
|
|
666
676
|
return JSON.stringify({
|
|
667
677
|
checkerPresets: options.checkerPresets,
|
|
668
|
-
configPath:
|
|
669
|
-
configSize: configStat
|
|
670
|
-
configTime: configStat
|
|
678
|
+
configPath: normalizedConfigPath,
|
|
679
|
+
configSize: virtualContent?.length ?? configStat?.size,
|
|
680
|
+
configTime: virtualContent ?? configStat?.mtimeMs,
|
|
671
681
|
extensions: normalizeExtensions(options.extensions),
|
|
672
682
|
projectRootDir: normalizeAbsolutePath(options.projectRootDir)
|
|
673
683
|
});
|
|
674
684
|
}
|
|
675
|
-
function clearCheckerProjectConfigCache() {
|
|
676
|
-
parsedProjectConfigCache.clear();
|
|
677
|
-
}
|
|
678
685
|
function createExtraFileExtensions(extensions) {
|
|
679
686
|
const nativeExtensions = new Set(getNativeTypeScriptProjectExtensions());
|
|
680
687
|
return extensions.filter((extension) => !nativeExtensions.has(extension)).map((extension) => ({
|
|
@@ -685,8 +692,9 @@ function createExtraFileExtensions(extensions) {
|
|
|
685
692
|
}
|
|
686
693
|
function parseProjectConfigWithExtraFileExtensions(options, extensions) {
|
|
687
694
|
const diagnostics = [];
|
|
695
|
+
const host = createProjectParseHost(options.virtualFiles);
|
|
688
696
|
const parsed = ts.getParsedCommandLineOfConfigFile(options.configPath, {}, {
|
|
689
|
-
...
|
|
697
|
+
...host,
|
|
690
698
|
onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
|
|
691
699
|
diagnostics.push(diagnostic);
|
|
692
700
|
}
|
|
@@ -751,7 +759,7 @@ function createVueParsedCommandLine(options) {
|
|
|
751
759
|
});
|
|
752
760
|
const configPath = normalizeAbsolutePath(options.configPath);
|
|
753
761
|
return {
|
|
754
|
-
commandLine: vueLanguageCore.createParsedCommandLine(ts,
|
|
762
|
+
commandLine: vueLanguageCore.createParsedCommandLine(ts, createProjectParseHost(options.virtualFiles), configPath),
|
|
755
763
|
configPath,
|
|
756
764
|
vueLanguageCore
|
|
757
765
|
};
|
|
@@ -760,7 +768,8 @@ function resolveVueProjectExtensions(options, packageName) {
|
|
|
760
768
|
const { commandLine, vueLanguageCore } = createVueParsedCommandLine({
|
|
761
769
|
configPath: options.configPath,
|
|
762
770
|
packageName,
|
|
763
|
-
projectRootDir: options.projectRootDir
|
|
771
|
+
projectRootDir: options.projectRootDir,
|
|
772
|
+
virtualFiles: options.virtualFiles
|
|
764
773
|
});
|
|
765
774
|
try {
|
|
766
775
|
return normalizeExtensions([...getTypeScriptCheckerExtensions(), ...vueLanguageCore.getAllExtensions(commandLine.vueOptions)]);
|
|
@@ -781,15 +790,17 @@ function parseVueProjectConfig(options, packageName) {
|
|
|
781
790
|
const { commandLine, configPath, vueLanguageCore } = createVueParsedCommandLine({
|
|
782
791
|
configPath: options.configPath,
|
|
783
792
|
packageName,
|
|
784
|
-
projectRootDir: options.projectRootDir
|
|
793
|
+
projectRootDir: options.projectRootDir,
|
|
794
|
+
virtualFiles: options.virtualFiles
|
|
785
795
|
});
|
|
786
796
|
const extensions = normalizeExtensions([
|
|
787
797
|
...options.extensions ?? [],
|
|
788
798
|
...getTypeScriptCheckerExtensions(),
|
|
789
799
|
...vueLanguageCore.getAllExtensions(commandLine.vueOptions)
|
|
790
800
|
]);
|
|
791
|
-
const
|
|
792
|
-
const
|
|
801
|
+
const host = createProjectParseHost(options.virtualFiles);
|
|
802
|
+
const configFile = ts.readJsonConfigFile(configPath, host.readFile);
|
|
803
|
+
const parsed = ts.parseJsonSourceFileConfigFileContent(configFile, host, posix.dirname(configPath), {}, configPath, void 0, createExtraFileExtensions(extensions));
|
|
793
804
|
const errors = parsed.errors;
|
|
794
805
|
if (errors.length > 0) throw new Error(ts.formatDiagnosticsWithColorAndContext(errors, createFormatHost(options.projectRootDir)));
|
|
795
806
|
return createParsedCheckerProjectConfig({
|
|
@@ -808,15 +819,26 @@ function resolveTypeScriptModuleName(options) {
|
|
|
808
819
|
return resolveTypeScriptModuleNameDetailed(options)?.resolvedFileName ?? null;
|
|
809
820
|
}
|
|
810
821
|
function resolveTypeScriptModuleNameDetailed(options) {
|
|
811
|
-
|
|
822
|
+
options.metrics?.record({
|
|
823
|
+
kind: "request",
|
|
824
|
+
name: "typescript-resolution",
|
|
825
|
+
provider: "module-resolution"
|
|
826
|
+
});
|
|
827
|
+
const nativeCacheHit = Boolean(options.moduleResolutionCache && ts.resolveModuleNameFromCache(options.specifier, options.containingFile, options.moduleResolutionCache) !== void 0);
|
|
828
|
+
options.metrics?.record({
|
|
829
|
+
kind: "module-resolution",
|
|
830
|
+
name: nativeCacheHit ? "typescript-module-resolution-cache-hit" : "typescript-module-resolution-cache-miss",
|
|
831
|
+
provider: "typescript"
|
|
832
|
+
});
|
|
833
|
+
const resolved = ts.resolveModuleName(options.specifier, options.containingFile, options.compilerOptions, ts.sys, options.moduleResolutionCache).resolvedModule;
|
|
812
834
|
if (resolved?.resolvedFileName) return {
|
|
813
835
|
isExternalLibraryImport: resolved.isExternalLibraryImport === true,
|
|
814
836
|
resolvedBy: "typescript",
|
|
815
837
|
resolvedFileName: normalizeAbsolutePath(resolved.resolvedFileName)
|
|
816
838
|
};
|
|
817
|
-
return
|
|
839
|
+
return resolveCheckerSourceModuleName(options);
|
|
818
840
|
}
|
|
819
|
-
function
|
|
841
|
+
function resolveCheckerSourceModuleName(options) {
|
|
820
842
|
const typeScriptExtensions = new Set(getTypeScriptCheckerExtensions());
|
|
821
843
|
const checkerOnlyExtensions = options.extensions.filter((extension) => !typeScriptExtensions.has(extension));
|
|
822
844
|
if (checkerOnlyExtensions.length === 0) return null;
|
|
@@ -833,9 +855,11 @@ function resolveCheckerExtensionModuleName(options) {
|
|
|
833
855
|
extensions: checkerOnlyExtensions,
|
|
834
856
|
specifier: options.specifier
|
|
835
857
|
});
|
|
836
|
-
|
|
858
|
+
const normalizedResolvedFileName = resolvedFileName?.toLowerCase();
|
|
859
|
+
const isDeclaredCheckerSource = checkerOnlyExtensions.some((extension) => normalizedResolvedFileName?.endsWith(extension.toLowerCase()));
|
|
860
|
+
return resolvedFileName && isDeclaredCheckerSource ? {
|
|
837
861
|
isExternalLibraryImport: false,
|
|
838
|
-
resolvedBy: "checker-
|
|
862
|
+
resolvedBy: "checker-source",
|
|
839
863
|
resolvedFileName
|
|
840
864
|
} : null;
|
|
841
865
|
}
|
|
@@ -924,7 +948,8 @@ function parseCheckerProjectConfigForContext(options) {
|
|
|
924
948
|
checkerPresets,
|
|
925
949
|
configPath: options.configPath,
|
|
926
950
|
extensions: options.context.extensions,
|
|
927
|
-
projectRootDir: options.projectRootDir
|
|
951
|
+
projectRootDir: options.projectRootDir,
|
|
952
|
+
virtualFiles: options.virtualFiles
|
|
928
953
|
});
|
|
929
954
|
const cached = parsedProjectConfigCache.get(cacheKey);
|
|
930
955
|
if (cached) return cloneParsedCheckerProjectConfig(cached);
|
|
@@ -934,35 +959,31 @@ function parseCheckerProjectConfigForContext(options) {
|
|
|
934
959
|
return adapter.parseProjectConfig({
|
|
935
960
|
configPath: options.configPath,
|
|
936
961
|
extensions: options.context.extensions,
|
|
937
|
-
projectRootDir: options.projectRootDir
|
|
962
|
+
projectRootDir: options.projectRootDir,
|
|
963
|
+
virtualFiles: options.virtualFiles
|
|
938
964
|
});
|
|
939
965
|
}), options.context.extensions);
|
|
940
966
|
parsedProjectConfigCache.set(cacheKey, cloneParsedCheckerProjectConfig(parsedConfig));
|
|
941
967
|
return cloneParsedCheckerProjectConfig(parsedConfig);
|
|
942
968
|
}
|
|
943
|
-
function resolveModuleNameWithCheckers(options) {
|
|
944
|
-
return resolveModuleNameWithCheckersDetailed(options)?.resolvedFileName ?? null;
|
|
945
|
-
}
|
|
946
969
|
function resolveModuleNameWithCheckersDetailed(options) {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
if (resolved) return resolved;
|
|
957
|
-
}
|
|
958
|
-
return null;
|
|
970
|
+
if (!(options.context.checkerPresets.length > 0 ? options.context.checkerPresets : ["tsc"]).some((preset) => Boolean(getCheckerAdapter(preset)))) return null;
|
|
971
|
+
return resolveTypeScriptModuleNameDetailed({
|
|
972
|
+
compilerOptions: options.compilerOptions,
|
|
973
|
+
containingFile: options.containingFile,
|
|
974
|
+
extensions: options.context.extensions,
|
|
975
|
+
metrics: options.metrics,
|
|
976
|
+
moduleResolutionCache: options.moduleResolutionCache,
|
|
977
|
+
specifier: options.specifier
|
|
978
|
+
});
|
|
959
979
|
}
|
|
960
980
|
function resolveCheckerProjectExtensions(options) {
|
|
961
981
|
const adapter = getCheckerAdapter(options.preset);
|
|
962
982
|
if (!adapter) throw new Error(`Checker preset "${options.preset}" is not supported.`);
|
|
963
983
|
return adapter.extensions({
|
|
964
984
|
configPath: options.configPath,
|
|
965
|
-
projectRootDir: options.projectRootDir
|
|
985
|
+
projectRootDir: options.projectRootDir,
|
|
986
|
+
virtualFiles: options.virtualFiles
|
|
966
987
|
});
|
|
967
988
|
}
|
|
968
989
|
function createTscCommandTarget(options) {
|
|
@@ -1037,6 +1058,7 @@ const builtinCheckerAdapters = {
|
|
|
1037
1058
|
createCommandTarget: createSvelteCheckCommandTarget,
|
|
1038
1059
|
extensions: (options) => resolveExtensionsForChecker(options, getSvelteCheckerExtensions()),
|
|
1039
1060
|
execution: "typecheck",
|
|
1061
|
+
emitProjection: "typescript",
|
|
1040
1062
|
packageNames: ["svelte-check"],
|
|
1041
1063
|
parseProjectConfig: (options) => parseProjectConfigWithExtensions(options, getSvelteCheckerExtensions()),
|
|
1042
1064
|
preset: "svelte-check",
|
|
@@ -1047,6 +1069,7 @@ const builtinCheckerAdapters = {
|
|
|
1047
1069
|
createCommandTarget: createTscCommandTarget,
|
|
1048
1070
|
extensions: (options) => resolveExtensionsForChecker(options, getTypeScriptCheckerExtensions()),
|
|
1049
1071
|
execution: "build",
|
|
1072
|
+
emitProjection: "typescript",
|
|
1050
1073
|
packageNames: ["typescript"],
|
|
1051
1074
|
parseProjectConfig: (options) => parseProjectConfigWithExtensions(options, getTypeScriptCheckerExtensions()),
|
|
1052
1075
|
preset: "tsc",
|
|
@@ -1057,6 +1080,7 @@ const builtinCheckerAdapters = {
|
|
|
1057
1080
|
createCommandTarget: createTsgoCommandTarget,
|
|
1058
1081
|
extensions: (options) => resolveExtensionsForChecker(options, getTypeScriptCheckerExtensions()),
|
|
1059
1082
|
execution: "build",
|
|
1083
|
+
emitProjection: "typescript",
|
|
1060
1084
|
packageNames: ["@typescript/native-preview"],
|
|
1061
1085
|
parseProjectConfig: (options) => parseProjectConfigWithExtensions(options, getTypeScriptCheckerExtensions()),
|
|
1062
1086
|
preset: "tsgo",
|
|
@@ -1067,6 +1091,7 @@ const builtinCheckerAdapters = {
|
|
|
1067
1091
|
createCommandTarget: createVueTscCommandTarget,
|
|
1068
1092
|
extensions: (options) => resolveVueProjectExtensionsForChecker(options, "vue-tsc"),
|
|
1069
1093
|
execution: "build",
|
|
1094
|
+
emitProjection: "vue-bounded",
|
|
1070
1095
|
packageNames: ["vue-tsc"],
|
|
1071
1096
|
parseProjectConfig: (options) => parseVueProjectConfig(options, "vue-tsc"),
|
|
1072
1097
|
preset: "vue-tsc",
|
|
@@ -1077,6 +1102,7 @@ const builtinCheckerAdapters = {
|
|
|
1077
1102
|
createCommandTarget: createVueTsgoCommandTarget,
|
|
1078
1103
|
extensions: (options) => resolveVueProjectExtensionsForChecker(options, "vue-tsgo"),
|
|
1079
1104
|
execution: "typecheck",
|
|
1105
|
+
emitProjection: "vue-bounded",
|
|
1080
1106
|
packageNames: ["vue-tsgo", "@typescript/native-preview"],
|
|
1081
1107
|
parseProjectConfig: (options) => parseVueProjectConfig(options, "vue-tsgo"),
|
|
1082
1108
|
preset: "vue-tsgo",
|
|
@@ -1090,6 +1116,19 @@ function isBuiltinCheckerPreset(value) {
|
|
|
1090
1116
|
function getCheckerAdapter(preset) {
|
|
1091
1117
|
return isBuiltinCheckerPreset(preset) ? builtinCheckerAdapters[preset] : null;
|
|
1092
1118
|
}
|
|
1119
|
+
const checkerBuildEngines = {
|
|
1120
|
+
"svelte-check": "typecheck-only",
|
|
1121
|
+
tsc: "tsc",
|
|
1122
|
+
tsgo: "tsgo",
|
|
1123
|
+
"vue-tsc": "vue-tsc",
|
|
1124
|
+
"vue-tsgo": "typecheck-only"
|
|
1125
|
+
};
|
|
1126
|
+
function getCheckerBuildEngine(preset) {
|
|
1127
|
+
return checkerBuildEngines[preset] ?? "unknown";
|
|
1128
|
+
}
|
|
1129
|
+
function isBuildCapablePreset(preset) {
|
|
1130
|
+
return getCheckerAdapter(preset)?.execution === "build";
|
|
1131
|
+
}
|
|
1093
1132
|
function isVueCheckerPreset(preset) {
|
|
1094
1133
|
return preset === "vue-tsc" || preset === "vue-tsgo";
|
|
1095
1134
|
}
|
|
@@ -1149,8 +1188,7 @@ function getCheckerExtensions(checker, options = {}) {
|
|
|
1149
1188
|
function getResolvedCheckers(config) {
|
|
1150
1189
|
const checkers = config.config?.checkers;
|
|
1151
1190
|
if (!checkers || checkers.mode === "auto") return [];
|
|
1152
|
-
|
|
1153
|
-
return Object.entries(checkerMap).map(([name, checker]) => ({
|
|
1191
|
+
return Object.entries(checkers).map(([name, checker]) => ({
|
|
1154
1192
|
exclude: (checker.exclude ?? []).map((value) => value.trim()),
|
|
1155
1193
|
extensions: getCheckerExtensions(checker, { projectRootDir: config.rootDir }),
|
|
1156
1194
|
include: checker.include.map((value) => value.trim()),
|
|
@@ -1164,7 +1202,6 @@ function normalizeExtensions(extensions) {
|
|
|
1164
1202
|
return lengthDelta === 0 ? left.localeCompare(right) : lengthDelta;
|
|
1165
1203
|
});
|
|
1166
1204
|
}
|
|
1167
|
-
|
|
1168
1205
|
//#endregion
|
|
1169
1206
|
//#region src/utils/values.ts
|
|
1170
1207
|
function isPlainRecord(value) {
|
|
@@ -1181,11 +1218,7 @@ function formatUnknownValue(value) {
|
|
|
1181
1218
|
return String(value);
|
|
1182
1219
|
}
|
|
1183
1220
|
}
|
|
1184
|
-
|
|
1185
|
-
//#endregion
|
|
1186
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js
|
|
1187
|
-
/** A special constant with type `never` */
|
|
1188
|
-
const NEVER = Object.freeze({ status: "aborted" });
|
|
1221
|
+
Object.freeze({ status: "aborted" });
|
|
1189
1222
|
function $constructor(name, initializer, params) {
|
|
1190
1223
|
function init(inst, def) {
|
|
1191
1224
|
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
@@ -1241,7 +1274,6 @@ function config(newConfig) {
|
|
|
1241
1274
|
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
1242
1275
|
return globalConfig;
|
|
1243
1276
|
}
|
|
1244
|
-
|
|
1245
1277
|
//#endregion
|
|
1246
1278
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js
|
|
1247
1279
|
function getEnumValues(entries) {
|
|
@@ -1270,6 +1302,17 @@ function cleanRegex(source) {
|
|
|
1270
1302
|
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
1271
1303
|
return source.slice(start, end);
|
|
1272
1304
|
}
|
|
1305
|
+
function floatSafeRemainder(val, step) {
|
|
1306
|
+
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
1307
|
+
const stepString = step.toString();
|
|
1308
|
+
let stepDecCount = (stepString.split(".")[1] || "").length;
|
|
1309
|
+
if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
|
|
1310
|
+
const match = stepString.match(/\d?e-(\d?)/);
|
|
1311
|
+
if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
|
|
1312
|
+
}
|
|
1313
|
+
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
1314
|
+
return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
|
|
1315
|
+
}
|
|
1273
1316
|
const EVALUATING = Symbol("evaluating");
|
|
1274
1317
|
function defineLazy(object, key, getter) {
|
|
1275
1318
|
let value = void 0;
|
|
@@ -1335,7 +1378,7 @@ function shallowClone(o) {
|
|
|
1335
1378
|
if (Array.isArray(o)) return [...o];
|
|
1336
1379
|
return o;
|
|
1337
1380
|
}
|
|
1338
|
-
const propertyKeyTypes = new Set([
|
|
1381
|
+
const propertyKeyTypes = /* @__PURE__ */ new Set([
|
|
1339
1382
|
"string",
|
|
1340
1383
|
"number",
|
|
1341
1384
|
"symbol"
|
|
@@ -1541,7 +1584,6 @@ function issue(...args) {
|
|
|
1541
1584
|
};
|
|
1542
1585
|
return { ...iss };
|
|
1543
1586
|
}
|
|
1544
|
-
|
|
1545
1587
|
//#endregion
|
|
1546
1588
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js
|
|
1547
1589
|
const initializer$1 = (inst, def) => {
|
|
@@ -1599,7 +1641,6 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
1599
1641
|
processError(error);
|
|
1600
1642
|
return fieldErrors;
|
|
1601
1643
|
}
|
|
1602
|
-
|
|
1603
1644
|
//#endregion
|
|
1604
1645
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js
|
|
1605
1646
|
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
@@ -1610,13 +1651,12 @@ const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
1610
1651
|
}, ctx);
|
|
1611
1652
|
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
1612
1653
|
if (result.issues.length) {
|
|
1613
|
-
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
1654
|
+
const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
1614
1655
|
captureStackTrace(e, _params?.callee);
|
|
1615
1656
|
throw e;
|
|
1616
1657
|
}
|
|
1617
1658
|
return result.value;
|
|
1618
1659
|
};
|
|
1619
|
-
const parse$1 = /* @__PURE__ */ _parse($ZodRealError);
|
|
1620
1660
|
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
1621
1661
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
1622
1662
|
let result = schema._zod.run({
|
|
@@ -1625,13 +1665,12 @@ const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
|
1625
1665
|
}, ctx);
|
|
1626
1666
|
if (result instanceof Promise) result = await result;
|
|
1627
1667
|
if (result.issues.length) {
|
|
1628
|
-
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
1668
|
+
const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
1629
1669
|
captureStackTrace(e, params?.callee);
|
|
1630
1670
|
throw e;
|
|
1631
1671
|
}
|
|
1632
1672
|
return result.value;
|
|
1633
1673
|
};
|
|
1634
|
-
const parseAsync$1 = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
1635
1674
|
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
1636
1675
|
const ctx = _ctx ? {
|
|
1637
1676
|
..._ctx,
|
|
@@ -1650,7 +1689,7 @@ const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
1650
1689
|
data: result.value
|
|
1651
1690
|
};
|
|
1652
1691
|
};
|
|
1653
|
-
const safeParse$1 = /* @__PURE__
|
|
1692
|
+
const safeParse$1 = /* @__PURE__*/ _safeParse($ZodRealError);
|
|
1654
1693
|
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
1655
1694
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
1656
1695
|
let result = schema._zod.run({
|
|
@@ -1666,53 +1705,185 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
1666
1705
|
data: result.value
|
|
1667
1706
|
};
|
|
1668
1707
|
};
|
|
1669
|
-
const safeParseAsync$1 = /* @__PURE__
|
|
1708
|
+
const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
1670
1709
|
const _encode = (_Err) => (schema, value, _ctx) => {
|
|
1671
1710
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
1672
1711
|
return _parse(_Err)(schema, value, ctx);
|
|
1673
1712
|
};
|
|
1674
|
-
const encode$1 = /* @__PURE__ */ _encode($ZodRealError);
|
|
1675
1713
|
const _decode = (_Err) => (schema, value, _ctx) => {
|
|
1676
1714
|
return _parse(_Err)(schema, value, _ctx);
|
|
1677
1715
|
};
|
|
1678
|
-
const decode$1 = /* @__PURE__ */ _decode($ZodRealError);
|
|
1679
1716
|
const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
1680
1717
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
1681
1718
|
return _parseAsync(_Err)(schema, value, ctx);
|
|
1682
1719
|
};
|
|
1683
|
-
const encodeAsync$1 = /* @__PURE__ */ _encodeAsync($ZodRealError);
|
|
1684
1720
|
const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
1685
1721
|
return _parseAsync(_Err)(schema, value, _ctx);
|
|
1686
1722
|
};
|
|
1687
|
-
const decodeAsync$1 = /* @__PURE__ */ _decodeAsync($ZodRealError);
|
|
1688
1723
|
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
1689
1724
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
1690
1725
|
return _safeParse(_Err)(schema, value, ctx);
|
|
1691
1726
|
};
|
|
1692
|
-
const safeEncode$1 = /* @__PURE__ */ _safeEncode($ZodRealError);
|
|
1693
1727
|
const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
1694
1728
|
return _safeParse(_Err)(schema, value, _ctx);
|
|
1695
1729
|
};
|
|
1696
|
-
const safeDecode$1 = /* @__PURE__ */ _safeDecode($ZodRealError);
|
|
1697
1730
|
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
1698
1731
|
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
|
|
1699
1732
|
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
1700
1733
|
};
|
|
1701
|
-
const safeEncodeAsync$1 = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
|
|
1702
1734
|
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
1703
1735
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
1704
1736
|
};
|
|
1705
|
-
const
|
|
1706
|
-
|
|
1737
|
+
const integer = /^-?\d+$/;
|
|
1738
|
+
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
1707
1739
|
//#endregion
|
|
1708
1740
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
|
|
1709
|
-
const $ZodCheck =
|
|
1741
|
+
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
1710
1742
|
var _a;
|
|
1711
1743
|
inst._zod ?? (inst._zod = {});
|
|
1712
1744
|
inst._zod.def = def;
|
|
1713
1745
|
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
1714
1746
|
});
|
|
1715
|
-
const
|
|
1747
|
+
const numericOriginMap = {
|
|
1748
|
+
number: "number",
|
|
1749
|
+
bigint: "bigint",
|
|
1750
|
+
object: "date"
|
|
1751
|
+
};
|
|
1752
|
+
const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
1753
|
+
$ZodCheck.init(inst, def);
|
|
1754
|
+
const origin = numericOriginMap[typeof def.value];
|
|
1755
|
+
inst._zod.onattach.push((inst) => {
|
|
1756
|
+
const bag = inst._zod.bag;
|
|
1757
|
+
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
1758
|
+
if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
|
|
1759
|
+
else bag.exclusiveMaximum = def.value;
|
|
1760
|
+
});
|
|
1761
|
+
inst._zod.check = (payload) => {
|
|
1762
|
+
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
1763
|
+
payload.issues.push({
|
|
1764
|
+
origin,
|
|
1765
|
+
code: "too_big",
|
|
1766
|
+
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
1767
|
+
input: payload.value,
|
|
1768
|
+
inclusive: def.inclusive,
|
|
1769
|
+
inst,
|
|
1770
|
+
continue: !def.abort
|
|
1771
|
+
});
|
|
1772
|
+
};
|
|
1773
|
+
});
|
|
1774
|
+
const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
1775
|
+
$ZodCheck.init(inst, def);
|
|
1776
|
+
const origin = numericOriginMap[typeof def.value];
|
|
1777
|
+
inst._zod.onattach.push((inst) => {
|
|
1778
|
+
const bag = inst._zod.bag;
|
|
1779
|
+
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
1780
|
+
if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
|
|
1781
|
+
else bag.exclusiveMinimum = def.value;
|
|
1782
|
+
});
|
|
1783
|
+
inst._zod.check = (payload) => {
|
|
1784
|
+
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
1785
|
+
payload.issues.push({
|
|
1786
|
+
origin,
|
|
1787
|
+
code: "too_small",
|
|
1788
|
+
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
1789
|
+
input: payload.value,
|
|
1790
|
+
inclusive: def.inclusive,
|
|
1791
|
+
inst,
|
|
1792
|
+
continue: !def.abort
|
|
1793
|
+
});
|
|
1794
|
+
};
|
|
1795
|
+
});
|
|
1796
|
+
const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
1797
|
+
$ZodCheck.init(inst, def);
|
|
1798
|
+
inst._zod.onattach.push((inst) => {
|
|
1799
|
+
var _a;
|
|
1800
|
+
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
1801
|
+
});
|
|
1802
|
+
inst._zod.check = (payload) => {
|
|
1803
|
+
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
1804
|
+
if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
1805
|
+
payload.issues.push({
|
|
1806
|
+
origin: typeof payload.value,
|
|
1807
|
+
code: "not_multiple_of",
|
|
1808
|
+
divisor: def.value,
|
|
1809
|
+
input: payload.value,
|
|
1810
|
+
inst,
|
|
1811
|
+
continue: !def.abort
|
|
1812
|
+
});
|
|
1813
|
+
};
|
|
1814
|
+
});
|
|
1815
|
+
const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat", (inst, def) => {
|
|
1816
|
+
$ZodCheck.init(inst, def);
|
|
1817
|
+
def.format = def.format || "float64";
|
|
1818
|
+
const isInt = def.format?.includes("int");
|
|
1819
|
+
const origin = isInt ? "int" : "number";
|
|
1820
|
+
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
1821
|
+
inst._zod.onattach.push((inst) => {
|
|
1822
|
+
const bag = inst._zod.bag;
|
|
1823
|
+
bag.format = def.format;
|
|
1824
|
+
bag.minimum = minimum;
|
|
1825
|
+
bag.maximum = maximum;
|
|
1826
|
+
if (isInt) bag.pattern = integer;
|
|
1827
|
+
});
|
|
1828
|
+
inst._zod.check = (payload) => {
|
|
1829
|
+
const input = payload.value;
|
|
1830
|
+
if (isInt) {
|
|
1831
|
+
if (!Number.isInteger(input)) {
|
|
1832
|
+
payload.issues.push({
|
|
1833
|
+
expected: origin,
|
|
1834
|
+
format: def.format,
|
|
1835
|
+
code: "invalid_type",
|
|
1836
|
+
continue: false,
|
|
1837
|
+
input,
|
|
1838
|
+
inst
|
|
1839
|
+
});
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1842
|
+
if (!Number.isSafeInteger(input)) {
|
|
1843
|
+
if (input > 0) payload.issues.push({
|
|
1844
|
+
input,
|
|
1845
|
+
code: "too_big",
|
|
1846
|
+
maximum: Number.MAX_SAFE_INTEGER,
|
|
1847
|
+
note: "Integers must be within the safe integer range.",
|
|
1848
|
+
inst,
|
|
1849
|
+
origin,
|
|
1850
|
+
inclusive: true,
|
|
1851
|
+
continue: !def.abort
|
|
1852
|
+
});
|
|
1853
|
+
else payload.issues.push({
|
|
1854
|
+
input,
|
|
1855
|
+
code: "too_small",
|
|
1856
|
+
minimum: Number.MIN_SAFE_INTEGER,
|
|
1857
|
+
note: "Integers must be within the safe integer range.",
|
|
1858
|
+
inst,
|
|
1859
|
+
origin,
|
|
1860
|
+
inclusive: true,
|
|
1861
|
+
continue: !def.abort
|
|
1862
|
+
});
|
|
1863
|
+
return;
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
if (input < minimum) payload.issues.push({
|
|
1867
|
+
origin: "number",
|
|
1868
|
+
input,
|
|
1869
|
+
code: "too_small",
|
|
1870
|
+
minimum,
|
|
1871
|
+
inclusive: true,
|
|
1872
|
+
inst,
|
|
1873
|
+
continue: !def.abort
|
|
1874
|
+
});
|
|
1875
|
+
if (input > maximum) payload.issues.push({
|
|
1876
|
+
origin: "number",
|
|
1877
|
+
input,
|
|
1878
|
+
code: "too_big",
|
|
1879
|
+
maximum,
|
|
1880
|
+
inclusive: true,
|
|
1881
|
+
inst,
|
|
1882
|
+
continue: !def.abort
|
|
1883
|
+
});
|
|
1884
|
+
};
|
|
1885
|
+
});
|
|
1886
|
+
const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
1716
1887
|
var _a;
|
|
1717
1888
|
$ZodCheck.init(inst, def);
|
|
1718
1889
|
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
@@ -1738,7 +1909,7 @@ const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (i
|
|
|
1738
1909
|
});
|
|
1739
1910
|
};
|
|
1740
1911
|
});
|
|
1741
|
-
const $ZodCheckMinLength =
|
|
1912
|
+
const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
1742
1913
|
var _a;
|
|
1743
1914
|
$ZodCheck.init(inst, def);
|
|
1744
1915
|
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
@@ -1764,7 +1935,7 @@ const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (i
|
|
|
1764
1935
|
});
|
|
1765
1936
|
};
|
|
1766
1937
|
});
|
|
1767
|
-
const $ZodCheckLengthEquals =
|
|
1938
|
+
const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
1768
1939
|
var _a;
|
|
1769
1940
|
$ZodCheck.init(inst, def);
|
|
1770
1941
|
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
@@ -1800,13 +1971,12 @@ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEqual
|
|
|
1800
1971
|
});
|
|
1801
1972
|
};
|
|
1802
1973
|
});
|
|
1803
|
-
const $ZodCheckOverwrite =
|
|
1974
|
+
const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
1804
1975
|
$ZodCheck.init(inst, def);
|
|
1805
1976
|
inst._zod.check = (payload) => {
|
|
1806
1977
|
payload.value = def.tx(payload.value);
|
|
1807
1978
|
};
|
|
1808
1979
|
});
|
|
1809
|
-
|
|
1810
1980
|
//#endregion
|
|
1811
1981
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js
|
|
1812
1982
|
var Doc = class {
|
|
@@ -1838,7 +2008,6 @@ var Doc = class {
|
|
|
1838
2008
|
return new F(...args, lines.join("\n"));
|
|
1839
2009
|
}
|
|
1840
2010
|
};
|
|
1841
|
-
|
|
1842
2011
|
//#endregion
|
|
1843
2012
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js
|
|
1844
2013
|
const version = {
|
|
@@ -1846,10 +2015,9 @@ const version = {
|
|
|
1846
2015
|
minor: 3,
|
|
1847
2016
|
patch: 6
|
|
1848
2017
|
};
|
|
1849
|
-
|
|
1850
2018
|
//#endregion
|
|
1851
2019
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js
|
|
1852
|
-
const $ZodType =
|
|
2020
|
+
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
1853
2021
|
var _a;
|
|
1854
2022
|
inst ?? (inst = {});
|
|
1855
2023
|
inst._zod.def = def;
|
|
@@ -1937,11 +2105,35 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1937
2105
|
version: 1
|
|
1938
2106
|
}));
|
|
1939
2107
|
});
|
|
1940
|
-
const $
|
|
2108
|
+
const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
|
|
2109
|
+
$ZodType.init(inst, def);
|
|
2110
|
+
inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
|
|
2111
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
2112
|
+
if (def.coerce) try {
|
|
2113
|
+
payload.value = Number(payload.value);
|
|
2114
|
+
} catch (_) {}
|
|
2115
|
+
const input = payload.value;
|
|
2116
|
+
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
|
|
2117
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
|
|
2118
|
+
payload.issues.push({
|
|
2119
|
+
expected: "number",
|
|
2120
|
+
code: "invalid_type",
|
|
2121
|
+
input,
|
|
2122
|
+
inst,
|
|
2123
|
+
...received ? { received } : {}
|
|
2124
|
+
});
|
|
2125
|
+
return payload;
|
|
2126
|
+
};
|
|
2127
|
+
});
|
|
2128
|
+
const $ZodNumberFormat = /*@__PURE__*/ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
2129
|
+
$ZodCheckNumberFormat.init(inst, def);
|
|
2130
|
+
$ZodNumber.init(inst, def);
|
|
2131
|
+
});
|
|
2132
|
+
const $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def) => {
|
|
1941
2133
|
$ZodType.init(inst, def);
|
|
1942
2134
|
inst._zod.parse = (payload) => payload;
|
|
1943
2135
|
});
|
|
1944
|
-
const $ZodNever =
|
|
2136
|
+
const $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => {
|
|
1945
2137
|
$ZodType.init(inst, def);
|
|
1946
2138
|
inst._zod.parse = (payload, _ctx) => {
|
|
1947
2139
|
payload.issues.push({
|
|
@@ -1957,7 +2149,7 @@ function handleArrayResult(result, final, index) {
|
|
|
1957
2149
|
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
1958
2150
|
final.value[index] = result.value;
|
|
1959
2151
|
}
|
|
1960
|
-
const $ZodArray =
|
|
2152
|
+
const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
1961
2153
|
$ZodType.init(inst, def);
|
|
1962
2154
|
inst._zod.parse = (payload, ctx) => {
|
|
1963
2155
|
const input = payload.value;
|
|
@@ -2036,7 +2228,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
2036
2228
|
return payload;
|
|
2037
2229
|
});
|
|
2038
2230
|
}
|
|
2039
|
-
const $ZodObject =
|
|
2231
|
+
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
2040
2232
|
$ZodType.init(inst, def);
|
|
2041
2233
|
if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
|
|
2042
2234
|
const sh = def.shape;
|
|
@@ -2059,13 +2251,13 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
2059
2251
|
}
|
|
2060
2252
|
return propValues;
|
|
2061
2253
|
});
|
|
2062
|
-
const isObject$
|
|
2254
|
+
const isObject$1 = isObject;
|
|
2063
2255
|
const catchall = def.catchall;
|
|
2064
2256
|
let value;
|
|
2065
2257
|
inst._zod.parse = (payload, ctx) => {
|
|
2066
2258
|
value ?? (value = _normalized.value);
|
|
2067
2259
|
const input = payload.value;
|
|
2068
|
-
if (!isObject$
|
|
2260
|
+
if (!isObject$1(input)) {
|
|
2069
2261
|
payload.issues.push({
|
|
2070
2262
|
expected: "object",
|
|
2071
2263
|
code: "invalid_type",
|
|
@@ -2091,7 +2283,7 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
2091
2283
|
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
2092
2284
|
};
|
|
2093
2285
|
});
|
|
2094
|
-
const $ZodObjectJIT =
|
|
2286
|
+
const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
2095
2287
|
$ZodObject.init(inst, def);
|
|
2096
2288
|
const superParse = inst._zod.parse;
|
|
2097
2289
|
const _normalized = cached(() => normalizeDef(def));
|
|
@@ -2159,16 +2351,15 @@ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def)
|
|
|
2159
2351
|
return (payload, ctx) => fn(shape, payload, ctx);
|
|
2160
2352
|
};
|
|
2161
2353
|
let fastpass;
|
|
2162
|
-
const isObject$
|
|
2354
|
+
const isObject$2 = isObject;
|
|
2163
2355
|
const jit = !globalConfig.jitless;
|
|
2164
|
-
const
|
|
2165
|
-
const fastEnabled = jit && allowsEval$1.value;
|
|
2356
|
+
const fastEnabled = jit && allowsEval.value;
|
|
2166
2357
|
const catchall = def.catchall;
|
|
2167
2358
|
let value;
|
|
2168
2359
|
inst._zod.parse = (payload, ctx) => {
|
|
2169
2360
|
value ?? (value = _normalized.value);
|
|
2170
2361
|
const input = payload.value;
|
|
2171
|
-
if (!isObject$
|
|
2362
|
+
if (!isObject$2(input)) {
|
|
2172
2363
|
payload.issues.push({
|
|
2173
2364
|
expected: "object",
|
|
2174
2365
|
code: "invalid_type",
|
|
@@ -2204,7 +2395,7 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
2204
2395
|
});
|
|
2205
2396
|
return final;
|
|
2206
2397
|
}
|
|
2207
|
-
const $ZodUnion =
|
|
2398
|
+
const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
2208
2399
|
$ZodType.init(inst, def);
|
|
2209
2400
|
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
2210
2401
|
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
@@ -2242,7 +2433,7 @@ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
2242
2433
|
});
|
|
2243
2434
|
};
|
|
2244
2435
|
});
|
|
2245
|
-
const $ZodIntersection =
|
|
2436
|
+
const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
|
|
2246
2437
|
$ZodType.init(inst, def);
|
|
2247
2438
|
inst._zod.parse = (payload, ctx) => {
|
|
2248
2439
|
const input = payload.value;
|
|
@@ -2341,7 +2532,7 @@ function handleIntersectionResults(result, left, right) {
|
|
|
2341
2532
|
result.value = merged.data;
|
|
2342
2533
|
return result;
|
|
2343
2534
|
}
|
|
2344
|
-
const $ZodEnum =
|
|
2535
|
+
const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
2345
2536
|
$ZodType.init(inst, def);
|
|
2346
2537
|
const values = getEnumValues(def.entries);
|
|
2347
2538
|
const valuesSet = new Set(values);
|
|
@@ -2359,7 +2550,25 @@ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
2359
2550
|
return payload;
|
|
2360
2551
|
};
|
|
2361
2552
|
});
|
|
2362
|
-
const $
|
|
2553
|
+
const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
|
|
2554
|
+
$ZodType.init(inst, def);
|
|
2555
|
+
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
2556
|
+
const values = new Set(def.values);
|
|
2557
|
+
inst._zod.values = values;
|
|
2558
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
2559
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
2560
|
+
const input = payload.value;
|
|
2561
|
+
if (values.has(input)) return payload;
|
|
2562
|
+
payload.issues.push({
|
|
2563
|
+
code: "invalid_value",
|
|
2564
|
+
values: def.values,
|
|
2565
|
+
input,
|
|
2566
|
+
inst
|
|
2567
|
+
});
|
|
2568
|
+
return payload;
|
|
2569
|
+
};
|
|
2570
|
+
});
|
|
2571
|
+
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
2363
2572
|
$ZodType.init(inst, def);
|
|
2364
2573
|
inst._zod.parse = (payload, ctx) => {
|
|
2365
2574
|
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
@@ -2380,12 +2589,12 @@ function handleOptionalResult(result, input) {
|
|
|
2380
2589
|
};
|
|
2381
2590
|
return result;
|
|
2382
2591
|
}
|
|
2383
|
-
const $ZodOptional =
|
|
2592
|
+
const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
2384
2593
|
$ZodType.init(inst, def);
|
|
2385
2594
|
inst._zod.optin = "optional";
|
|
2386
2595
|
inst._zod.optout = "optional";
|
|
2387
2596
|
defineLazy(inst._zod, "values", () => {
|
|
2388
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
2597
|
+
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
2389
2598
|
});
|
|
2390
2599
|
defineLazy(inst._zod, "pattern", () => {
|
|
2391
2600
|
const pattern = def.innerType._zod.pattern;
|
|
@@ -2401,7 +2610,7 @@ const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) =>
|
|
|
2401
2610
|
return def.innerType._zod.run(payload, ctx);
|
|
2402
2611
|
};
|
|
2403
2612
|
});
|
|
2404
|
-
const $ZodExactOptional =
|
|
2613
|
+
const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
|
|
2405
2614
|
$ZodOptional.init(inst, def);
|
|
2406
2615
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2407
2616
|
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
@@ -2409,7 +2618,7 @@ const $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (ins
|
|
|
2409
2618
|
return def.innerType._zod.run(payload, ctx);
|
|
2410
2619
|
};
|
|
2411
2620
|
});
|
|
2412
|
-
const $ZodNullable =
|
|
2621
|
+
const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
2413
2622
|
$ZodType.init(inst, def);
|
|
2414
2623
|
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
2415
2624
|
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
@@ -2418,14 +2627,14 @@ const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) =>
|
|
|
2418
2627
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
2419
2628
|
});
|
|
2420
2629
|
defineLazy(inst._zod, "values", () => {
|
|
2421
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
|
|
2630
|
+
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
2422
2631
|
});
|
|
2423
2632
|
inst._zod.parse = (payload, ctx) => {
|
|
2424
2633
|
if (payload.value === null) return payload;
|
|
2425
2634
|
return def.innerType._zod.run(payload, ctx);
|
|
2426
2635
|
};
|
|
2427
2636
|
});
|
|
2428
|
-
const $ZodDefault =
|
|
2637
|
+
const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
|
|
2429
2638
|
$ZodType.init(inst, def);
|
|
2430
2639
|
inst._zod.optin = "optional";
|
|
2431
2640
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
@@ -2447,7 +2656,7 @@ function handleDefaultResult(payload, def) {
|
|
|
2447
2656
|
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
2448
2657
|
return payload;
|
|
2449
2658
|
}
|
|
2450
|
-
const $ZodPrefault =
|
|
2659
|
+
const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
2451
2660
|
$ZodType.init(inst, def);
|
|
2452
2661
|
inst._zod.optin = "optional";
|
|
2453
2662
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
@@ -2457,7 +2666,7 @@ const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) =>
|
|
|
2457
2666
|
return def.innerType._zod.run(payload, ctx);
|
|
2458
2667
|
};
|
|
2459
2668
|
});
|
|
2460
|
-
const $ZodNonOptional =
|
|
2669
|
+
const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
|
|
2461
2670
|
$ZodType.init(inst, def);
|
|
2462
2671
|
defineLazy(inst._zod, "values", () => {
|
|
2463
2672
|
const v = def.innerType._zod.values;
|
|
@@ -2478,7 +2687,7 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
2478
2687
|
});
|
|
2479
2688
|
return payload;
|
|
2480
2689
|
}
|
|
2481
|
-
const $ZodCatch =
|
|
2690
|
+
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
2482
2691
|
$ZodType.init(inst, def);
|
|
2483
2692
|
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
2484
2693
|
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
@@ -2510,7 +2719,7 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
2510
2719
|
return payload;
|
|
2511
2720
|
};
|
|
2512
2721
|
});
|
|
2513
|
-
const $ZodPipe =
|
|
2722
|
+
const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
2514
2723
|
$ZodType.init(inst, def);
|
|
2515
2724
|
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
2516
2725
|
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
@@ -2537,7 +2746,7 @@ function handlePipeResult(left, next, ctx) {
|
|
|
2537
2746
|
issues: left.issues
|
|
2538
2747
|
}, ctx);
|
|
2539
2748
|
}
|
|
2540
|
-
const $ZodReadonly =
|
|
2749
|
+
const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
2541
2750
|
$ZodType.init(inst, def);
|
|
2542
2751
|
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
2543
2752
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
@@ -2554,7 +2763,7 @@ function handleReadonlyResult(payload) {
|
|
|
2554
2763
|
payload.value = Object.freeze(payload.value);
|
|
2555
2764
|
return payload;
|
|
2556
2765
|
}
|
|
2557
|
-
const $ZodCustom =
|
|
2766
|
+
const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
|
|
2558
2767
|
$ZodCheck.init(inst, def);
|
|
2559
2768
|
$ZodType.init(inst, def);
|
|
2560
2769
|
inst._zod.parse = (payload, _) => {
|
|
@@ -2580,7 +2789,6 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2580
2789
|
payload.issues.push(issue(_iss));
|
|
2581
2790
|
}
|
|
2582
2791
|
}
|
|
2583
|
-
|
|
2584
2792
|
//#endregion
|
|
2585
2793
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.js
|
|
2586
2794
|
var _a;
|
|
@@ -2628,21 +2836,82 @@ function registry() {
|
|
|
2628
2836
|
}
|
|
2629
2837
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
2630
2838
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2631
|
-
|
|
2632
2839
|
//#endregion
|
|
2633
2840
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
|
|
2634
|
-
|
|
2841
|
+
// @__NO_SIDE_EFFECTS__
|
|
2842
|
+
function _number(Class, params) {
|
|
2843
|
+
return new Class({
|
|
2844
|
+
type: "number",
|
|
2845
|
+
checks: [],
|
|
2846
|
+
...normalizeParams(params)
|
|
2847
|
+
});
|
|
2848
|
+
}
|
|
2849
|
+
// @__NO_SIDE_EFFECTS__
|
|
2850
|
+
function _int(Class, params) {
|
|
2851
|
+
return new Class({
|
|
2852
|
+
type: "number",
|
|
2853
|
+
check: "number_format",
|
|
2854
|
+
abort: false,
|
|
2855
|
+
format: "safeint",
|
|
2856
|
+
...normalizeParams(params)
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2859
|
+
// @__NO_SIDE_EFFECTS__
|
|
2635
2860
|
function _unknown(Class) {
|
|
2636
2861
|
return new Class({ type: "unknown" });
|
|
2637
2862
|
}
|
|
2638
|
-
|
|
2863
|
+
// @__NO_SIDE_EFFECTS__
|
|
2639
2864
|
function _never(Class, params) {
|
|
2640
2865
|
return new Class({
|
|
2641
2866
|
type: "never",
|
|
2642
2867
|
...normalizeParams(params)
|
|
2643
2868
|
});
|
|
2644
2869
|
}
|
|
2645
|
-
|
|
2870
|
+
// @__NO_SIDE_EFFECTS__
|
|
2871
|
+
function _lt(value, params) {
|
|
2872
|
+
return new $ZodCheckLessThan({
|
|
2873
|
+
check: "less_than",
|
|
2874
|
+
...normalizeParams(params),
|
|
2875
|
+
value,
|
|
2876
|
+
inclusive: false
|
|
2877
|
+
});
|
|
2878
|
+
}
|
|
2879
|
+
// @__NO_SIDE_EFFECTS__
|
|
2880
|
+
function _lte(value, params) {
|
|
2881
|
+
return new $ZodCheckLessThan({
|
|
2882
|
+
check: "less_than",
|
|
2883
|
+
...normalizeParams(params),
|
|
2884
|
+
value,
|
|
2885
|
+
inclusive: true
|
|
2886
|
+
});
|
|
2887
|
+
}
|
|
2888
|
+
// @__NO_SIDE_EFFECTS__
|
|
2889
|
+
function _gt(value, params) {
|
|
2890
|
+
return new $ZodCheckGreaterThan({
|
|
2891
|
+
check: "greater_than",
|
|
2892
|
+
...normalizeParams(params),
|
|
2893
|
+
value,
|
|
2894
|
+
inclusive: false
|
|
2895
|
+
});
|
|
2896
|
+
}
|
|
2897
|
+
// @__NO_SIDE_EFFECTS__
|
|
2898
|
+
function _gte(value, params) {
|
|
2899
|
+
return new $ZodCheckGreaterThan({
|
|
2900
|
+
check: "greater_than",
|
|
2901
|
+
...normalizeParams(params),
|
|
2902
|
+
value,
|
|
2903
|
+
inclusive: true
|
|
2904
|
+
});
|
|
2905
|
+
}
|
|
2906
|
+
// @__NO_SIDE_EFFECTS__
|
|
2907
|
+
function _multipleOf(value, params) {
|
|
2908
|
+
return new $ZodCheckMultipleOf({
|
|
2909
|
+
check: "multiple_of",
|
|
2910
|
+
...normalizeParams(params),
|
|
2911
|
+
value
|
|
2912
|
+
});
|
|
2913
|
+
}
|
|
2914
|
+
// @__NO_SIDE_EFFECTS__
|
|
2646
2915
|
function _maxLength(maximum, params) {
|
|
2647
2916
|
return new $ZodCheckMaxLength({
|
|
2648
2917
|
check: "max_length",
|
|
@@ -2650,7 +2919,7 @@ function _maxLength(maximum, params) {
|
|
|
2650
2919
|
maximum
|
|
2651
2920
|
});
|
|
2652
2921
|
}
|
|
2653
|
-
|
|
2922
|
+
// @__NO_SIDE_EFFECTS__
|
|
2654
2923
|
function _minLength(minimum, params) {
|
|
2655
2924
|
return new $ZodCheckMinLength({
|
|
2656
2925
|
check: "min_length",
|
|
@@ -2658,7 +2927,7 @@ function _minLength(minimum, params) {
|
|
|
2658
2927
|
minimum
|
|
2659
2928
|
});
|
|
2660
2929
|
}
|
|
2661
|
-
|
|
2930
|
+
// @__NO_SIDE_EFFECTS__
|
|
2662
2931
|
function _length(length, params) {
|
|
2663
2932
|
return new $ZodCheckLengthEquals({
|
|
2664
2933
|
check: "length_equals",
|
|
@@ -2666,14 +2935,14 @@ function _length(length, params) {
|
|
|
2666
2935
|
length
|
|
2667
2936
|
});
|
|
2668
2937
|
}
|
|
2669
|
-
|
|
2938
|
+
// @__NO_SIDE_EFFECTS__
|
|
2670
2939
|
function _overwrite(tx) {
|
|
2671
2940
|
return new $ZodCheckOverwrite({
|
|
2672
2941
|
check: "overwrite",
|
|
2673
2942
|
tx
|
|
2674
2943
|
});
|
|
2675
2944
|
}
|
|
2676
|
-
|
|
2945
|
+
// @__NO_SIDE_EFFECTS__
|
|
2677
2946
|
function _array(Class, element, params) {
|
|
2678
2947
|
return new Class({
|
|
2679
2948
|
type: "array",
|
|
@@ -2681,7 +2950,7 @@ function _array(Class, element, params) {
|
|
|
2681
2950
|
...normalizeParams(params)
|
|
2682
2951
|
});
|
|
2683
2952
|
}
|
|
2684
|
-
|
|
2953
|
+
// @__NO_SIDE_EFFECTS__
|
|
2685
2954
|
function _refine(Class, fn, _params) {
|
|
2686
2955
|
return new Class({
|
|
2687
2956
|
type: "custom",
|
|
@@ -2690,7 +2959,7 @@ function _refine(Class, fn, _params) {
|
|
|
2690
2959
|
...normalizeParams(_params)
|
|
2691
2960
|
});
|
|
2692
2961
|
}
|
|
2693
|
-
|
|
2962
|
+
// @__NO_SIDE_EFFECTS__
|
|
2694
2963
|
function _superRefine(fn) {
|
|
2695
2964
|
const ch = /* @__PURE__ */ _check((payload) => {
|
|
2696
2965
|
payload.addIssue = (issue$2) => {
|
|
@@ -2709,7 +2978,7 @@ function _superRefine(fn) {
|
|
|
2709
2978
|
});
|
|
2710
2979
|
return ch;
|
|
2711
2980
|
}
|
|
2712
|
-
|
|
2981
|
+
// @__NO_SIDE_EFFECTS__
|
|
2713
2982
|
function _check(fn, params) {
|
|
2714
2983
|
const ch = new $ZodCheck({
|
|
2715
2984
|
check: "custom",
|
|
@@ -2718,33 +2987,6 @@ function _check(fn, params) {
|
|
|
2718
2987
|
ch._zod.check = fn;
|
|
2719
2988
|
return ch;
|
|
2720
2989
|
}
|
|
2721
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2722
|
-
function describe$1(description) {
|
|
2723
|
-
const ch = new $ZodCheck({ check: "describe" });
|
|
2724
|
-
ch._zod.onattach = [(inst) => {
|
|
2725
|
-
const existing = globalRegistry.get(inst) ?? {};
|
|
2726
|
-
globalRegistry.add(inst, {
|
|
2727
|
-
...existing,
|
|
2728
|
-
description
|
|
2729
|
-
});
|
|
2730
|
-
}];
|
|
2731
|
-
ch._zod.check = () => {};
|
|
2732
|
-
return ch;
|
|
2733
|
-
}
|
|
2734
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
2735
|
-
function meta$1(metadata) {
|
|
2736
|
-
const ch = new $ZodCheck({ check: "meta" });
|
|
2737
|
-
ch._zod.onattach = [(inst) => {
|
|
2738
|
-
const existing = globalRegistry.get(inst) ?? {};
|
|
2739
|
-
globalRegistry.add(inst, {
|
|
2740
|
-
...existing,
|
|
2741
|
-
...metadata
|
|
2742
|
-
});
|
|
2743
|
-
}];
|
|
2744
|
-
ch._zod.check = () => {};
|
|
2745
|
-
return ch;
|
|
2746
|
-
}
|
|
2747
|
-
|
|
2748
2990
|
//#endregion
|
|
2749
2991
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js
|
|
2750
2992
|
function initializeContext(params) {
|
|
@@ -3030,13 +3272,36 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
3030
3272
|
extractDefs(ctx, schema);
|
|
3031
3273
|
return finalize(ctx, schema);
|
|
3032
3274
|
};
|
|
3033
|
-
|
|
3034
3275
|
//#endregion
|
|
3035
3276
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js
|
|
3277
|
+
const numberProcessor = (schema, ctx, _json, _params) => {
|
|
3278
|
+
const json = _json;
|
|
3279
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
3280
|
+
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
|
3281
|
+
else json.type = "number";
|
|
3282
|
+
if (typeof exclusiveMinimum === "number") if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
3283
|
+
json.minimum = exclusiveMinimum;
|
|
3284
|
+
json.exclusiveMinimum = true;
|
|
3285
|
+
} else json.exclusiveMinimum = exclusiveMinimum;
|
|
3286
|
+
if (typeof minimum === "number") {
|
|
3287
|
+
json.minimum = minimum;
|
|
3288
|
+
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") if (exclusiveMinimum >= minimum) delete json.minimum;
|
|
3289
|
+
else delete json.exclusiveMinimum;
|
|
3290
|
+
}
|
|
3291
|
+
if (typeof exclusiveMaximum === "number") if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
3292
|
+
json.maximum = exclusiveMaximum;
|
|
3293
|
+
json.exclusiveMaximum = true;
|
|
3294
|
+
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
3295
|
+
if (typeof maximum === "number") {
|
|
3296
|
+
json.maximum = maximum;
|
|
3297
|
+
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") if (exclusiveMaximum <= maximum) delete json.maximum;
|
|
3298
|
+
else delete json.exclusiveMaximum;
|
|
3299
|
+
}
|
|
3300
|
+
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
3301
|
+
};
|
|
3036
3302
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
3037
3303
|
json.not = {};
|
|
3038
3304
|
};
|
|
3039
|
-
const unknownProcessor = (_schema, _ctx, _json, _params) => {};
|
|
3040
3305
|
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
3041
3306
|
const def = schema._zod.def;
|
|
3042
3307
|
const values = getEnumValues(def.entries);
|
|
@@ -3044,6 +3309,27 @@ const enumProcessor = (schema, _ctx, json, _params) => {
|
|
|
3044
3309
|
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
3045
3310
|
json.enum = values;
|
|
3046
3311
|
};
|
|
3312
|
+
const literalProcessor = (schema, ctx, json, _params) => {
|
|
3313
|
+
const def = schema._zod.def;
|
|
3314
|
+
const vals = [];
|
|
3315
|
+
for (const val of def.values) if (val === void 0) {
|
|
3316
|
+
if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
3317
|
+
} else if (typeof val === "bigint") if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
3318
|
+
else vals.push(Number(val));
|
|
3319
|
+
else vals.push(val);
|
|
3320
|
+
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
3321
|
+
const val = vals[0];
|
|
3322
|
+
json.type = val === null ? "null" : typeof val;
|
|
3323
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
|
|
3324
|
+
else json.const = val;
|
|
3325
|
+
} else {
|
|
3326
|
+
if (vals.every((v) => typeof v === "number")) json.type = "number";
|
|
3327
|
+
if (vals.every((v) => typeof v === "string")) json.type = "string";
|
|
3328
|
+
if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
|
|
3329
|
+
if (vals.every((v) => v === null)) json.type = "null";
|
|
3330
|
+
json.enum = vals;
|
|
3331
|
+
}
|
|
3332
|
+
};
|
|
3047
3333
|
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
3048
3334
|
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
3049
3335
|
};
|
|
@@ -3188,7 +3474,6 @@ const optionalProcessor = (schema, ctx, _json, params) => {
|
|
|
3188
3474
|
const seen = ctx.seen.get(schema);
|
|
3189
3475
|
seen.ref = def.innerType;
|
|
3190
3476
|
};
|
|
3191
|
-
|
|
3192
3477
|
//#endregion
|
|
3193
3478
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
|
|
3194
3479
|
const initializer = (inst, issues) => {
|
|
@@ -3210,9 +3495,8 @@ const initializer = (inst, issues) => {
|
|
|
3210
3495
|
} }
|
|
3211
3496
|
});
|
|
3212
3497
|
};
|
|
3213
|
-
|
|
3498
|
+
$constructor("ZodError", initializer);
|
|
3214
3499
|
const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
|
|
3215
|
-
|
|
3216
3500
|
//#endregion
|
|
3217
3501
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.js
|
|
3218
3502
|
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
@@ -3227,10 +3511,9 @@ const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
|
3227
3511
|
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
3228
3512
|
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
3229
3513
|
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
3230
|
-
|
|
3231
3514
|
//#endregion
|
|
3232
3515
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js
|
|
3233
|
-
const ZodType =
|
|
3516
|
+
const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
3234
3517
|
$ZodType.init(inst, def);
|
|
3235
3518
|
Object.assign(inst["~standard"], { jsonSchema: {
|
|
3236
3519
|
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
@@ -3269,7 +3552,7 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
3269
3552
|
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
3270
3553
|
inst.refine = (check, params) => inst.check(refine(check, params));
|
|
3271
3554
|
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
|
|
3272
|
-
inst.overwrite = (fn) => inst.check(_overwrite(fn));
|
|
3555
|
+
inst.overwrite = (fn) => inst.check(/* @__PURE__ */ _overwrite(fn));
|
|
3273
3556
|
inst.optional = () => optional(inst);
|
|
3274
3557
|
inst.exactOptional = () => exactOptional(inst);
|
|
3275
3558
|
inst.nullable = () => nullable(inst);
|
|
@@ -3306,37 +3589,73 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
3306
3589
|
inst.apply = (fn) => fn(inst);
|
|
3307
3590
|
return inst;
|
|
3308
3591
|
});
|
|
3309
|
-
const
|
|
3592
|
+
const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
|
|
3593
|
+
$ZodNumber.init(inst, def);
|
|
3594
|
+
ZodType.init(inst, def);
|
|
3595
|
+
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
3596
|
+
inst.gt = (value, params) => inst.check(/* @__PURE__ */ _gt(value, params));
|
|
3597
|
+
inst.gte = (value, params) => inst.check(/* @__PURE__ */ _gte(value, params));
|
|
3598
|
+
inst.min = (value, params) => inst.check(/* @__PURE__ */ _gte(value, params));
|
|
3599
|
+
inst.lt = (value, params) => inst.check(/* @__PURE__ */ _lt(value, params));
|
|
3600
|
+
inst.lte = (value, params) => inst.check(/* @__PURE__ */ _lte(value, params));
|
|
3601
|
+
inst.max = (value, params) => inst.check(/* @__PURE__ */ _lte(value, params));
|
|
3602
|
+
inst.int = (params) => inst.check(int(params));
|
|
3603
|
+
inst.safe = (params) => inst.check(int(params));
|
|
3604
|
+
inst.positive = (params) => inst.check(/* @__PURE__ */ _gt(0, params));
|
|
3605
|
+
inst.nonnegative = (params) => inst.check(/* @__PURE__ */ _gte(0, params));
|
|
3606
|
+
inst.negative = (params) => inst.check(/* @__PURE__ */ _lt(0, params));
|
|
3607
|
+
inst.nonpositive = (params) => inst.check(/* @__PURE__ */ _lte(0, params));
|
|
3608
|
+
inst.multipleOf = (value, params) => inst.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3609
|
+
inst.step = (value, params) => inst.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
3610
|
+
inst.finite = () => inst;
|
|
3611
|
+
const bag = inst._zod.bag;
|
|
3612
|
+
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
3613
|
+
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
3614
|
+
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
|
|
3615
|
+
inst.isFinite = true;
|
|
3616
|
+
inst.format = bag.format ?? null;
|
|
3617
|
+
});
|
|
3618
|
+
function number(params) {
|
|
3619
|
+
return /* @__PURE__ */ _number(ZodNumber, params);
|
|
3620
|
+
}
|
|
3621
|
+
const ZodNumberFormat = /*@__PURE__*/ $constructor("ZodNumberFormat", (inst, def) => {
|
|
3622
|
+
$ZodNumberFormat.init(inst, def);
|
|
3623
|
+
ZodNumber.init(inst, def);
|
|
3624
|
+
});
|
|
3625
|
+
function int(params) {
|
|
3626
|
+
return /* @__PURE__ */ _int(ZodNumberFormat, params);
|
|
3627
|
+
}
|
|
3628
|
+
const ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => {
|
|
3310
3629
|
$ZodUnknown.init(inst, def);
|
|
3311
3630
|
ZodType.init(inst, def);
|
|
3312
|
-
inst._zod.processJSONSchema = (ctx, json, params) =>
|
|
3631
|
+
inst._zod.processJSONSchema = (ctx, json, params) => void 0;
|
|
3313
3632
|
});
|
|
3314
3633
|
function unknown() {
|
|
3315
|
-
return _unknown(ZodUnknown);
|
|
3634
|
+
return /* @__PURE__ */ _unknown(ZodUnknown);
|
|
3316
3635
|
}
|
|
3317
|
-
const ZodNever =
|
|
3636
|
+
const ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => {
|
|
3318
3637
|
$ZodNever.init(inst, def);
|
|
3319
3638
|
ZodType.init(inst, def);
|
|
3320
3639
|
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
3321
3640
|
});
|
|
3322
3641
|
function never(params) {
|
|
3323
|
-
return _never(ZodNever, params);
|
|
3642
|
+
return /* @__PURE__ */ _never(ZodNever, params);
|
|
3324
3643
|
}
|
|
3325
|
-
const ZodArray =
|
|
3644
|
+
const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
|
|
3326
3645
|
$ZodArray.init(inst, def);
|
|
3327
3646
|
ZodType.init(inst, def);
|
|
3328
3647
|
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
3329
3648
|
inst.element = def.element;
|
|
3330
|
-
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
|
|
3331
|
-
inst.nonempty = (params) => inst.check(_minLength(1, params));
|
|
3332
|
-
inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
|
|
3333
|
-
inst.length = (len, params) => inst.check(_length(len, params));
|
|
3649
|
+
inst.min = (minLength, params) => inst.check(/* @__PURE__ */ _minLength(minLength, params));
|
|
3650
|
+
inst.nonempty = (params) => inst.check(/* @__PURE__ */ _minLength(1, params));
|
|
3651
|
+
inst.max = (maxLength, params) => inst.check(/* @__PURE__ */ _maxLength(maxLength, params));
|
|
3652
|
+
inst.length = (len, params) => inst.check(/* @__PURE__ */ _length(len, params));
|
|
3334
3653
|
inst.unwrap = () => inst.element;
|
|
3335
3654
|
});
|
|
3336
3655
|
function array(element, params) {
|
|
3337
|
-
return _array(ZodArray, element, params);
|
|
3656
|
+
return /* @__PURE__ */ _array(ZodArray, element, params);
|
|
3338
3657
|
}
|
|
3339
|
-
const ZodObject =
|
|
3658
|
+
const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
3340
3659
|
$ZodObjectJIT.init(inst, def);
|
|
3341
3660
|
ZodType.init(inst, def);
|
|
3342
3661
|
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
@@ -3384,7 +3703,7 @@ function looseObject(shape, params) {
|
|
|
3384
3703
|
...normalizeParams(params)
|
|
3385
3704
|
});
|
|
3386
3705
|
}
|
|
3387
|
-
const ZodUnion =
|
|
3706
|
+
const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
|
|
3388
3707
|
$ZodUnion.init(inst, def);
|
|
3389
3708
|
ZodType.init(inst, def);
|
|
3390
3709
|
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
@@ -3397,7 +3716,7 @@ function union(options, params) {
|
|
|
3397
3716
|
...normalizeParams(params)
|
|
3398
3717
|
});
|
|
3399
3718
|
}
|
|
3400
|
-
const ZodIntersection =
|
|
3719
|
+
const ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => {
|
|
3401
3720
|
$ZodIntersection.init(inst, def);
|
|
3402
3721
|
ZodType.init(inst, def);
|
|
3403
3722
|
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
@@ -3409,7 +3728,7 @@ function intersection(left, right) {
|
|
|
3409
3728
|
right
|
|
3410
3729
|
});
|
|
3411
3730
|
}
|
|
3412
|
-
const ZodEnum =
|
|
3731
|
+
const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
|
|
3413
3732
|
$ZodEnum.init(inst, def);
|
|
3414
3733
|
ZodType.init(inst, def);
|
|
3415
3734
|
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
@@ -3440,13 +3759,31 @@ const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
3440
3759
|
};
|
|
3441
3760
|
});
|
|
3442
3761
|
function _enum(values, params) {
|
|
3762
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
3443
3763
|
return new ZodEnum({
|
|
3444
3764
|
type: "enum",
|
|
3445
|
-
entries
|
|
3765
|
+
entries,
|
|
3766
|
+
...normalizeParams(params)
|
|
3767
|
+
});
|
|
3768
|
+
}
|
|
3769
|
+
const ZodLiteral = /*@__PURE__*/ $constructor("ZodLiteral", (inst, def) => {
|
|
3770
|
+
$ZodLiteral.init(inst, def);
|
|
3771
|
+
ZodType.init(inst, def);
|
|
3772
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
3773
|
+
inst.values = new Set(def.values);
|
|
3774
|
+
Object.defineProperty(inst, "value", { get() {
|
|
3775
|
+
if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
3776
|
+
return def.values[0];
|
|
3777
|
+
} });
|
|
3778
|
+
});
|
|
3779
|
+
function literal(value, params) {
|
|
3780
|
+
return new ZodLiteral({
|
|
3781
|
+
type: "literal",
|
|
3782
|
+
values: Array.isArray(value) ? value : [value],
|
|
3446
3783
|
...normalizeParams(params)
|
|
3447
3784
|
});
|
|
3448
3785
|
}
|
|
3449
|
-
const ZodTransform =
|
|
3786
|
+
const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
3450
3787
|
$ZodTransform.init(inst, def);
|
|
3451
3788
|
ZodType.init(inst, def);
|
|
3452
3789
|
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
@@ -3478,7 +3815,7 @@ function transform(fn) {
|
|
|
3478
3815
|
transform: fn
|
|
3479
3816
|
});
|
|
3480
3817
|
}
|
|
3481
|
-
const ZodOptional =
|
|
3818
|
+
const ZodOptional = /*@__PURE__*/ $constructor("ZodOptional", (inst, def) => {
|
|
3482
3819
|
$ZodOptional.init(inst, def);
|
|
3483
3820
|
ZodType.init(inst, def);
|
|
3484
3821
|
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
@@ -3490,7 +3827,7 @@ function optional(innerType) {
|
|
|
3490
3827
|
innerType
|
|
3491
3828
|
});
|
|
3492
3829
|
}
|
|
3493
|
-
const ZodExactOptional =
|
|
3830
|
+
const ZodExactOptional = /*@__PURE__*/ $constructor("ZodExactOptional", (inst, def) => {
|
|
3494
3831
|
$ZodExactOptional.init(inst, def);
|
|
3495
3832
|
ZodType.init(inst, def);
|
|
3496
3833
|
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
@@ -3502,7 +3839,7 @@ function exactOptional(innerType) {
|
|
|
3502
3839
|
innerType
|
|
3503
3840
|
});
|
|
3504
3841
|
}
|
|
3505
|
-
const ZodNullable =
|
|
3842
|
+
const ZodNullable = /*@__PURE__*/ $constructor("ZodNullable", (inst, def) => {
|
|
3506
3843
|
$ZodNullable.init(inst, def);
|
|
3507
3844
|
ZodType.init(inst, def);
|
|
3508
3845
|
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
@@ -3514,7 +3851,7 @@ function nullable(innerType) {
|
|
|
3514
3851
|
innerType
|
|
3515
3852
|
});
|
|
3516
3853
|
}
|
|
3517
|
-
const ZodDefault =
|
|
3854
|
+
const ZodDefault = /*@__PURE__*/ $constructor("ZodDefault", (inst, def) => {
|
|
3518
3855
|
$ZodDefault.init(inst, def);
|
|
3519
3856
|
ZodType.init(inst, def);
|
|
3520
3857
|
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
@@ -3530,7 +3867,7 @@ function _default(innerType, defaultValue) {
|
|
|
3530
3867
|
}
|
|
3531
3868
|
});
|
|
3532
3869
|
}
|
|
3533
|
-
const ZodPrefault =
|
|
3870
|
+
const ZodPrefault = /*@__PURE__*/ $constructor("ZodPrefault", (inst, def) => {
|
|
3534
3871
|
$ZodPrefault.init(inst, def);
|
|
3535
3872
|
ZodType.init(inst, def);
|
|
3536
3873
|
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
@@ -3545,7 +3882,7 @@ function prefault(innerType, defaultValue) {
|
|
|
3545
3882
|
}
|
|
3546
3883
|
});
|
|
3547
3884
|
}
|
|
3548
|
-
const ZodNonOptional =
|
|
3885
|
+
const ZodNonOptional = /*@__PURE__*/ $constructor("ZodNonOptional", (inst, def) => {
|
|
3549
3886
|
$ZodNonOptional.init(inst, def);
|
|
3550
3887
|
ZodType.init(inst, def);
|
|
3551
3888
|
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
@@ -3558,7 +3895,7 @@ function nonoptional(innerType, params) {
|
|
|
3558
3895
|
...normalizeParams(params)
|
|
3559
3896
|
});
|
|
3560
3897
|
}
|
|
3561
|
-
const ZodCatch =
|
|
3898
|
+
const ZodCatch = /*@__PURE__*/ $constructor("ZodCatch", (inst, def) => {
|
|
3562
3899
|
$ZodCatch.init(inst, def);
|
|
3563
3900
|
ZodType.init(inst, def);
|
|
3564
3901
|
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
@@ -3572,7 +3909,7 @@ function _catch(innerType, catchValue) {
|
|
|
3572
3909
|
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
3573
3910
|
});
|
|
3574
3911
|
}
|
|
3575
|
-
const ZodPipe =
|
|
3912
|
+
const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
|
|
3576
3913
|
$ZodPipe.init(inst, def);
|
|
3577
3914
|
ZodType.init(inst, def);
|
|
3578
3915
|
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
@@ -3586,7 +3923,7 @@ function pipe(in_, out) {
|
|
|
3586
3923
|
out
|
|
3587
3924
|
});
|
|
3588
3925
|
}
|
|
3589
|
-
const ZodReadonly =
|
|
3926
|
+
const ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
|
|
3590
3927
|
$ZodReadonly.init(inst, def);
|
|
3591
3928
|
ZodType.init(inst, def);
|
|
3592
3929
|
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
@@ -3598,51 +3935,88 @@ function readonly(innerType) {
|
|
|
3598
3935
|
innerType
|
|
3599
3936
|
});
|
|
3600
3937
|
}
|
|
3601
|
-
const ZodCustom =
|
|
3938
|
+
const ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => {
|
|
3602
3939
|
$ZodCustom.init(inst, def);
|
|
3603
3940
|
ZodType.init(inst, def);
|
|
3604
3941
|
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
3605
3942
|
});
|
|
3606
3943
|
function refine(fn, _params = {}) {
|
|
3607
|
-
return _refine(ZodCustom, fn, _params);
|
|
3944
|
+
return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
|
|
3608
3945
|
}
|
|
3609
3946
|
function superRefine(fn) {
|
|
3610
|
-
return _superRefine(fn);
|
|
3947
|
+
return /* @__PURE__ */ _superRefine(fn);
|
|
3611
3948
|
}
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3949
|
+
//#endregion
|
|
3950
|
+
//#region src/domain/validation/errors.ts
|
|
3951
|
+
var ConfigurationError = class extends Error {
|
|
3952
|
+
name = "ConfigurationError";
|
|
3953
|
+
problems;
|
|
3954
|
+
constructor(message, problems = []) {
|
|
3955
|
+
super(message);
|
|
3956
|
+
this.problems = problems;
|
|
3957
|
+
}
|
|
3958
|
+
};
|
|
3959
|
+
var ExecutionFailure = class extends Error {
|
|
3960
|
+
name = "ExecutionFailure";
|
|
3961
|
+
cause;
|
|
3962
|
+
stage;
|
|
3963
|
+
constructor(message, options) {
|
|
3964
|
+
super(message);
|
|
3965
|
+
this.cause = options.cause;
|
|
3966
|
+
this.stage = options.stage;
|
|
3967
|
+
}
|
|
3968
|
+
};
|
|
3969
|
+
var CancelledFailure = class extends Error {
|
|
3970
|
+
name = "CancelledFailure";
|
|
3971
|
+
constructor(message = "Analysis was cancelled.") {
|
|
3972
|
+
super(message);
|
|
3973
|
+
}
|
|
3974
|
+
};
|
|
3615
3975
|
//#endregion
|
|
3616
3976
|
//#region src/config/schema.ts
|
|
3617
|
-
const checkerExtensionsConfigReason = "checker extensions are fixed by built-in presets and cannot be configured.";
|
|
3618
|
-
const checkerRoutesConfigReason = "checker routes are not supported; configure checker.include with source tsconfig selectors.";
|
|
3619
3977
|
const unsupportedCheckerPresetReason = "configured checkers require a built-in checker adapter.";
|
|
3620
|
-
const checkerEntryConfigReason = "checker.entry has been removed; configure checker.include with source tsconfig selectors.";
|
|
3621
3978
|
const checkerConfigReason = "config.checkers must be an object auto config or an object keyed by checker name.";
|
|
3622
|
-
const checkerAutoStringConfigReason = "checkers: \"auto\" has been removed; omit config.checkers or use { mode: \"auto\" }.";
|
|
3623
3979
|
const autoCheckerMixedConfigReason = "auto checker config must not be mixed with named checker entries.";
|
|
3624
3980
|
const autoCheckerModeConfigReason = "auto checker config requires mode: \"auto\".";
|
|
3625
3981
|
const importAnalysisConfigReason = "config.imports must be an object when configured.";
|
|
3626
3982
|
const vueImportParserConfigReason = "config.imports.vue must be \"heuristic\" or \"compiler-sfc\".";
|
|
3983
|
+
const checkerConfigKeys = /* @__PURE__ */ new Set([
|
|
3984
|
+
"exclude",
|
|
3985
|
+
"include",
|
|
3986
|
+
"preset"
|
|
3987
|
+
]);
|
|
3988
|
+
const importAuthorityGrantKeys = /* @__PURE__ */ new Set([
|
|
3989
|
+
"include",
|
|
3990
|
+
"reason",
|
|
3991
|
+
"workspaceRootDependencies"
|
|
3992
|
+
]);
|
|
3993
|
+
const liminaConfigKeys = /* @__PURE__ */ new Set([
|
|
3994
|
+
"config",
|
|
3995
|
+
"execution",
|
|
3996
|
+
"graph",
|
|
3997
|
+
"package",
|
|
3998
|
+
"pipelines",
|
|
3999
|
+
"proof",
|
|
4000
|
+
"release",
|
|
4001
|
+
"regions",
|
|
4002
|
+
"source"
|
|
4003
|
+
]);
|
|
4004
|
+
function isAbsolutePublicSelector(value) {
|
|
4005
|
+
const selector = value.trim().replace(/^!+/u, "");
|
|
4006
|
+
return posix.isAbsolute(selector) || /^[A-Za-z]:[\\/]/u.test(selector);
|
|
4007
|
+
}
|
|
3627
4008
|
const checkerConfigShapeSchema = looseObject({}).superRefine((checker, ctx) => {
|
|
3628
4009
|
const preset = checker.preset;
|
|
3629
4010
|
const include = checker.include;
|
|
3630
4011
|
const exclude = checker.exclude;
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
path: ["extensions"]
|
|
3640
|
-
});
|
|
3641
|
-
if (Object.hasOwn(checker, "routes")) ctx.addIssue({
|
|
3642
|
-
code: "custom",
|
|
3643
|
-
message: checkerRoutesConfigReason,
|
|
3644
|
-
path: ["routes"]
|
|
3645
|
-
});
|
|
4012
|
+
for (const key of Object.keys(checker)) {
|
|
4013
|
+
if (checkerConfigKeys.has(key)) continue;
|
|
4014
|
+
ctx.addIssue({
|
|
4015
|
+
code: "custom",
|
|
4016
|
+
message: "unknown checker config field.",
|
|
4017
|
+
path: [key]
|
|
4018
|
+
});
|
|
4019
|
+
}
|
|
3646
4020
|
if (typeof preset !== "string" || preset.trim().length === 0) ctx.addIssue({
|
|
3647
4021
|
code: "custom",
|
|
3648
4022
|
message: "checker preset must be a non-empty string.",
|
|
@@ -3663,6 +4037,11 @@ const checkerConfigShapeSchema = looseObject({}).superRefine((checker, ctx) => {
|
|
|
3663
4037
|
message: "checker include entries must be non-empty string paths.",
|
|
3664
4038
|
path: ["include", index]
|
|
3665
4039
|
});
|
|
4040
|
+
else if (isAbsolutePublicSelector(value)) ctx.addIssue({
|
|
4041
|
+
code: "custom",
|
|
4042
|
+
message: "checker include entries must be config.rootDir-relative paths; ../ is allowed.",
|
|
4043
|
+
path: ["include", index]
|
|
4044
|
+
});
|
|
3666
4045
|
if (exclude === void 0) return;
|
|
3667
4046
|
if (!Array.isArray(exclude)) {
|
|
3668
4047
|
ctx.addIssue({
|
|
@@ -3677,20 +4056,65 @@ const checkerConfigShapeSchema = looseObject({}).superRefine((checker, ctx) => {
|
|
|
3677
4056
|
message: "checker exclude entries must be non-empty string paths.",
|
|
3678
4057
|
path: ["exclude", index]
|
|
3679
4058
|
});
|
|
4059
|
+
else if (isAbsolutePublicSelector(value)) ctx.addIssue({
|
|
4060
|
+
code: "custom",
|
|
4061
|
+
message: "checker exclude entries must be config.rootDir-relative paths; ../ is allowed.",
|
|
4062
|
+
path: ["exclude", index]
|
|
4063
|
+
});
|
|
3680
4064
|
});
|
|
3681
4065
|
function isPlainConfigRecord(value) {
|
|
3682
4066
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
3683
4067
|
}
|
|
4068
|
+
function validateSourcePatternConfig(options) {
|
|
4069
|
+
const patterns = options.source[options.field];
|
|
4070
|
+
if (patterns === void 0) return;
|
|
4071
|
+
if (!Array.isArray(patterns) || patterns.length === 0) {
|
|
4072
|
+
options.ctx.addIssue({
|
|
4073
|
+
code: "custom",
|
|
4074
|
+
message: `config.source.${options.field} must be a non-empty string array.`,
|
|
4075
|
+
path: ["source", options.field]
|
|
4076
|
+
});
|
|
4077
|
+
return;
|
|
4078
|
+
}
|
|
4079
|
+
let defaultTokenCount = 0;
|
|
4080
|
+
for (const [index, value] of patterns.entries()) {
|
|
4081
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
4082
|
+
options.ctx.addIssue({
|
|
4083
|
+
code: "custom",
|
|
4084
|
+
message: `config.source.${options.field} entries must be non-empty strings.`,
|
|
4085
|
+
path: [
|
|
4086
|
+
"source",
|
|
4087
|
+
options.field,
|
|
4088
|
+
index
|
|
4089
|
+
]
|
|
4090
|
+
});
|
|
4091
|
+
continue;
|
|
4092
|
+
}
|
|
4093
|
+
if (value !== "..." && isAbsolutePublicSelector(value)) {
|
|
4094
|
+
options.ctx.addIssue({
|
|
4095
|
+
code: "custom",
|
|
4096
|
+
message: `config.source.${options.field} entries must be config.rootDir-relative paths; ../ is allowed.`,
|
|
4097
|
+
path: [
|
|
4098
|
+
"source",
|
|
4099
|
+
options.field,
|
|
4100
|
+
index
|
|
4101
|
+
]
|
|
4102
|
+
});
|
|
4103
|
+
continue;
|
|
4104
|
+
}
|
|
4105
|
+
if (value === "...") defaultTokenCount += 1;
|
|
4106
|
+
}
|
|
4107
|
+
if (defaultTokenCount > 1) options.ctx.addIssue({
|
|
4108
|
+
code: "custom",
|
|
4109
|
+
message: `config.source.${options.field} may contain "..." at most once.`,
|
|
4110
|
+
path: ["source", options.field]
|
|
4111
|
+
});
|
|
4112
|
+
}
|
|
3684
4113
|
const sharedLiminaConfigShapeSchema = looseObject({}).superRefine((sharedConfig, ctx) => {
|
|
3685
4114
|
const checkers = sharedConfig.checkers;
|
|
3686
4115
|
const imports = sharedConfig.imports;
|
|
3687
4116
|
const source = sharedConfig.source;
|
|
3688
|
-
if (checkers !== void 0) if (checkers
|
|
3689
|
-
code: "custom",
|
|
3690
|
-
message: checkerAutoStringConfigReason,
|
|
3691
|
-
path: ["checkers"]
|
|
3692
|
-
});
|
|
3693
|
-
else if (!isPlainConfigRecord(checkers)) ctx.addIssue({
|
|
4117
|
+
if (checkers !== void 0) if (!isPlainConfigRecord(checkers)) ctx.addIssue({
|
|
3694
4118
|
code: "custom",
|
|
3695
4119
|
message: checkerConfigReason,
|
|
3696
4120
|
path: ["checkers"]
|
|
@@ -3717,6 +4141,15 @@ const sharedLiminaConfigShapeSchema = looseObject({}).superRefine((sharedConfig,
|
|
|
3717
4141
|
index
|
|
3718
4142
|
]
|
|
3719
4143
|
});
|
|
4144
|
+
else if (isAbsolutePublicSelector(value)) ctx.addIssue({
|
|
4145
|
+
code: "custom",
|
|
4146
|
+
message: "auto checker exclude entries must be config.rootDir-relative paths; ../ is allowed.",
|
|
4147
|
+
path: [
|
|
4148
|
+
"checkers",
|
|
4149
|
+
"exclude",
|
|
4150
|
+
index
|
|
4151
|
+
]
|
|
4152
|
+
});
|
|
3720
4153
|
}
|
|
3721
4154
|
for (const key of Object.keys(checkers)) {
|
|
3722
4155
|
if (key === "mode" || key === "exclude") continue;
|
|
@@ -3727,6 +4160,14 @@ const sharedLiminaConfigShapeSchema = looseObject({}).superRefine((sharedConfig,
|
|
|
3727
4160
|
});
|
|
3728
4161
|
}
|
|
3729
4162
|
} else for (const [checkerName, checker] of Object.entries(checkers)) {
|
|
4163
|
+
if (checkerName.length === 0 || checkerName === "." || checkerName === ".." || checkerName.includes("/") || checkerName.includes("\\")) {
|
|
4164
|
+
ctx.addIssue({
|
|
4165
|
+
code: "custom",
|
|
4166
|
+
message: "checker names must be non-empty path-safe identifiers without slash segments.",
|
|
4167
|
+
path: ["checkers", checkerName]
|
|
4168
|
+
});
|
|
4169
|
+
continue;
|
|
4170
|
+
}
|
|
3730
4171
|
const result = checkerConfigShapeSchema.safeParse(checker);
|
|
3731
4172
|
if (result.success) continue;
|
|
3732
4173
|
for (const issue of result.error.issues) ctx.addIssue({
|
|
@@ -3767,6 +4208,16 @@ const sharedLiminaConfigShapeSchema = looseObject({}).superRefine((sharedConfig,
|
|
|
3767
4208
|
path: ["source", key]
|
|
3768
4209
|
});
|
|
3769
4210
|
}
|
|
4211
|
+
validateSourcePatternConfig({
|
|
4212
|
+
ctx,
|
|
4213
|
+
field: "include",
|
|
4214
|
+
source
|
|
4215
|
+
});
|
|
4216
|
+
validateSourcePatternConfig({
|
|
4217
|
+
ctx,
|
|
4218
|
+
field: "exclude",
|
|
4219
|
+
source
|
|
4220
|
+
});
|
|
3770
4221
|
});
|
|
3771
4222
|
const releaseContentHashShapeSchema = looseObject({}).superRefine((contentHash, ctx) => {
|
|
3772
4223
|
const baselineTag = contentHash.baselineTag;
|
|
@@ -3800,40 +4251,83 @@ const releaseContentHashShapeSchema = looseObject({}).superRefine((contentHash,
|
|
|
3800
4251
|
});
|
|
3801
4252
|
}
|
|
3802
4253
|
});
|
|
3803
|
-
const
|
|
3804
|
-
|
|
3805
|
-
"
|
|
3806
|
-
"
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
"
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
return
|
|
3813
|
-
}
|
|
3814
|
-
const
|
|
3815
|
-
|
|
3816
|
-
|
|
4254
|
+
const releaseNpmPackageJsonLintSeverities = /* @__PURE__ */ new Set([
|
|
4255
|
+
"error",
|
|
4256
|
+
"off",
|
|
4257
|
+
"warning"
|
|
4258
|
+
]);
|
|
4259
|
+
function isReleaseNpmPackageJsonLintRuleConfig(value) {
|
|
4260
|
+
if (typeof value === "string" && releaseNpmPackageJsonLintSeverities.has(value)) return true;
|
|
4261
|
+
if (!Array.isArray(value) || value.length !== 2) return false;
|
|
4262
|
+
const [severity, ruleOptions] = value;
|
|
4263
|
+
return typeof severity === "string" && releaseNpmPackageJsonLintSeverities.has(severity) && (Array.isArray(ruleOptions) || isPlainConfigRecord(ruleOptions));
|
|
4264
|
+
}
|
|
4265
|
+
const releaseNpmPackageJsonLintShapeSchema = unknown().superRefine((npmPackageJsonLint, ctx) => {
|
|
4266
|
+
if (typeof npmPackageJsonLint === "boolean") return;
|
|
4267
|
+
if (!isPlainConfigRecord(npmPackageJsonLint)) {
|
|
3817
4268
|
ctx.addIssue({
|
|
3818
4269
|
code: "custom",
|
|
3819
|
-
message: "
|
|
4270
|
+
message: "npmPackageJsonLint must be a boolean or object."
|
|
4271
|
+
});
|
|
4272
|
+
return;
|
|
4273
|
+
}
|
|
4274
|
+
for (const key of Object.keys(npmPackageJsonLint)) {
|
|
4275
|
+
if (key === "rules") continue;
|
|
4276
|
+
ctx.addIssue({
|
|
4277
|
+
code: "custom",
|
|
4278
|
+
message: "unknown npmPackageJsonLint config field.",
|
|
3820
4279
|
path: [key]
|
|
3821
4280
|
});
|
|
3822
4281
|
}
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
4282
|
+
const rules = npmPackageJsonLint.rules;
|
|
4283
|
+
if (rules === void 0) return;
|
|
4284
|
+
if (!isPlainConfigRecord(rules)) {
|
|
4285
|
+
ctx.addIssue({
|
|
4286
|
+
code: "custom",
|
|
4287
|
+
message: "npmPackageJsonLint.rules must be an object.",
|
|
4288
|
+
path: ["rules"]
|
|
4289
|
+
});
|
|
4290
|
+
return;
|
|
4291
|
+
}
|
|
4292
|
+
for (const [ruleName, ruleConfig] of Object.entries(rules)) {
|
|
4293
|
+
if (ruleName.trim().length === 0) {
|
|
4294
|
+
ctx.addIssue({
|
|
4295
|
+
code: "custom",
|
|
4296
|
+
message: "npmPackageJsonLint rule names must be non-empty strings.",
|
|
4297
|
+
path: ["rules"]
|
|
4298
|
+
});
|
|
4299
|
+
continue;
|
|
4300
|
+
}
|
|
4301
|
+
if (isReleaseNpmPackageJsonLintRuleConfig(ruleConfig)) continue;
|
|
4302
|
+
ctx.addIssue({
|
|
4303
|
+
code: "custom",
|
|
4304
|
+
message: "rule config must be \"off\", \"warning\", \"error\", or a [severity, options] tuple.",
|
|
4305
|
+
path: ["rules", ruleName]
|
|
4306
|
+
});
|
|
4307
|
+
}
|
|
4308
|
+
});
|
|
4309
|
+
const releaseConfigShapeSchema = looseObject({
|
|
4310
|
+
contentHash: releaseContentHashShapeSchema.optional(),
|
|
4311
|
+
npmPackageJsonLint: releaseNpmPackageJsonLintShapeSchema.optional()
|
|
4312
|
+
});
|
|
4313
|
+
const executionConcurrencyError = "execution concurrency must be a positive integer or \"auto\".";
|
|
4314
|
+
const executionConcurrencySchema = union([literal("auto", { error: executionConcurrencyError }), number({ error: executionConcurrencyError }).int({ error: executionConcurrencyError }).positive({ error: executionConcurrencyError })], { error: executionConcurrencyError });
|
|
4315
|
+
const executionConfigShape = {
|
|
4316
|
+
checkerBuild: executionConcurrencySchema.optional(),
|
|
4317
|
+
checkerTypecheck: executionConcurrencySchema.optional(),
|
|
4318
|
+
packageEntries: executionConcurrencySchema.optional(),
|
|
4319
|
+
releaseEntries: executionConcurrencySchema.optional(),
|
|
4320
|
+
tasks: executionConcurrencySchema.optional()
|
|
4321
|
+
};
|
|
4322
|
+
const executionConfigShapeSchema = looseObject(executionConfigShape).superRefine((execution, ctx) => {
|
|
4323
|
+
for (const key of Object.keys(execution)) {
|
|
4324
|
+
if (Object.hasOwn(executionConfigShape, key)) continue;
|
|
3826
4325
|
ctx.addIssue({
|
|
3827
4326
|
code: "custom",
|
|
3828
|
-
message: "execution
|
|
4327
|
+
message: "unknown execution config field.",
|
|
3829
4328
|
path: [key]
|
|
3830
4329
|
});
|
|
3831
4330
|
}
|
|
3832
|
-
if (execution.failFast !== void 0 && typeof execution.failFast !== "boolean") ctx.addIssue({
|
|
3833
|
-
code: "custom",
|
|
3834
|
-
message: "execution failFast must be a boolean.",
|
|
3835
|
-
path: ["failFast"]
|
|
3836
|
-
});
|
|
3837
4331
|
});
|
|
3838
4332
|
function validateStringArrayField(options) {
|
|
3839
4333
|
if (options.value === void 0) {
|
|
@@ -3874,10 +4368,10 @@ function validateSourceImportAuthorityConfig(value, ctx) {
|
|
|
3874
4368
|
}
|
|
3875
4369
|
const allow = value.allow;
|
|
3876
4370
|
if (allow === void 0) return;
|
|
3877
|
-
if (
|
|
4371
|
+
if (Array.isArray(allow) || !isPlainConfigRecord(allow)) {
|
|
3878
4372
|
ctx.addIssue({
|
|
3879
4373
|
code: "custom",
|
|
3880
|
-
message: "
|
|
4374
|
+
message: "allow must be an object keyed by source owner identity.\n fix: use allow: { \"@scope/package\": [{ include: [\"test/**/*.ts\"], workspaceRootDependencies: [\"@example/fixture\"], reason: \"...\" }] }.",
|
|
3881
4375
|
path: [
|
|
3882
4376
|
"source",
|
|
3883
4377
|
"importAuthority",
|
|
@@ -3886,69 +4380,258 @@ function validateSourceImportAuthorityConfig(value, ctx) {
|
|
|
3886
4380
|
});
|
|
3887
4381
|
return;
|
|
3888
4382
|
}
|
|
3889
|
-
for (const [
|
|
3890
|
-
const
|
|
4383
|
+
for (const [ownerIdentity, grants] of Object.entries(allow)) {
|
|
4384
|
+
const ownerPath = [
|
|
3891
4385
|
"source",
|
|
3892
4386
|
"importAuthority",
|
|
3893
4387
|
"allow",
|
|
3894
|
-
|
|
4388
|
+
ownerIdentity
|
|
3895
4389
|
];
|
|
3896
|
-
if (
|
|
4390
|
+
if (ownerIdentity.trim().length === 0) ctx.addIssue({
|
|
4391
|
+
code: "custom",
|
|
4392
|
+
message: "allow keys must be non-empty source owner identities.",
|
|
4393
|
+
path: ownerPath
|
|
4394
|
+
});
|
|
4395
|
+
if (!Array.isArray(grants)) {
|
|
3897
4396
|
ctx.addIssue({
|
|
3898
4397
|
code: "custom",
|
|
3899
|
-
message: "
|
|
3900
|
-
path
|
|
4398
|
+
message: "allow owner entries must be arrays of grants.",
|
|
4399
|
+
path: ownerPath
|
|
3901
4400
|
});
|
|
3902
4401
|
continue;
|
|
3903
4402
|
}
|
|
4403
|
+
for (const [index, grant] of grants.entries()) {
|
|
4404
|
+
const grantPath = [...ownerPath, index];
|
|
4405
|
+
if (!isPlainConfigRecord(grant)) {
|
|
4406
|
+
ctx.addIssue({
|
|
4407
|
+
code: "custom",
|
|
4408
|
+
message: "importAuthority allow grants must be objects with workspaceRootDependencies and reason fields.",
|
|
4409
|
+
path: grantPath
|
|
4410
|
+
});
|
|
4411
|
+
continue;
|
|
4412
|
+
}
|
|
4413
|
+
for (const key of Object.keys(grant)) {
|
|
4414
|
+
if (importAuthorityGrantKeys.has(key)) continue;
|
|
4415
|
+
ctx.addIssue({
|
|
4416
|
+
code: "custom",
|
|
4417
|
+
message: "unknown source import authority grant field.",
|
|
4418
|
+
path: [...grantPath, key]
|
|
4419
|
+
});
|
|
4420
|
+
}
|
|
4421
|
+
validateStringArrayField({
|
|
4422
|
+
ctx,
|
|
4423
|
+
path: [...grantPath, "workspaceRootDependencies"],
|
|
4424
|
+
required: true,
|
|
4425
|
+
value: grant.workspaceRootDependencies,
|
|
4426
|
+
valueName: "workspaceRootDependencies"
|
|
4427
|
+
});
|
|
4428
|
+
validateStringArrayField({
|
|
4429
|
+
ctx,
|
|
4430
|
+
path: [...grantPath, "include"],
|
|
4431
|
+
value: grant.include,
|
|
4432
|
+
valueName: "include"
|
|
4433
|
+
});
|
|
4434
|
+
if (Array.isArray(grant.include)) {
|
|
4435
|
+
for (const [includeIndex, include] of grant.include.entries()) if (typeof include === "string" && include.trim().length > 0 && isAbsolutePublicSelector(include)) ctx.addIssue({
|
|
4436
|
+
code: "custom",
|
|
4437
|
+
message: "source.importAuthority allow include entries must be config.rootDir-relative paths; ../ is allowed.",
|
|
4438
|
+
path: [
|
|
4439
|
+
...grantPath,
|
|
4440
|
+
"include",
|
|
4441
|
+
includeIndex
|
|
4442
|
+
]
|
|
4443
|
+
});
|
|
4444
|
+
}
|
|
4445
|
+
if (typeof grant.reason !== "string" || grant.reason.trim().length === 0) ctx.addIssue({
|
|
4446
|
+
code: "custom",
|
|
4447
|
+
message: "reason must be a non-empty string.",
|
|
4448
|
+
path: [...grantPath, "reason"]
|
|
4449
|
+
});
|
|
4450
|
+
}
|
|
4451
|
+
}
|
|
4452
|
+
}
|
|
4453
|
+
function validateSourceDeclarationsConfig(value, ctx) {
|
|
4454
|
+
if (value === void 0) return;
|
|
4455
|
+
const declarationsPath = ["source", "declarations"];
|
|
4456
|
+
if (!isPlainConfigRecord(value)) {
|
|
4457
|
+
ctx.addIssue({
|
|
4458
|
+
code: "custom",
|
|
4459
|
+
message: "declarations must be an object.",
|
|
4460
|
+
path: declarationsPath
|
|
4461
|
+
});
|
|
4462
|
+
return;
|
|
4463
|
+
}
|
|
4464
|
+
for (const key of Object.keys(value)) if (key !== "ambient") ctx.addIssue({
|
|
4465
|
+
code: "custom",
|
|
4466
|
+
message: "unknown source declarations config field.",
|
|
4467
|
+
path: [...declarationsPath, key]
|
|
4468
|
+
});
|
|
4469
|
+
if (value.ambient === void 0) return;
|
|
4470
|
+
const ambientPath = [...declarationsPath, "ambient"];
|
|
4471
|
+
if (!Array.isArray(value.ambient)) {
|
|
4472
|
+
ctx.addIssue({
|
|
4473
|
+
code: "custom",
|
|
4474
|
+
message: "ambient must be an array.",
|
|
4475
|
+
path: ambientPath
|
|
4476
|
+
});
|
|
4477
|
+
return;
|
|
4478
|
+
}
|
|
4479
|
+
for (const [index, rule] of value.ambient.entries()) {
|
|
4480
|
+
const rulePath = [...ambientPath, index];
|
|
4481
|
+
if (!isPlainConfigRecord(rule)) {
|
|
4482
|
+
ctx.addIssue({
|
|
4483
|
+
code: "custom",
|
|
4484
|
+
message: "ambient declaration rules must be objects.",
|
|
4485
|
+
path: rulePath
|
|
4486
|
+
});
|
|
4487
|
+
continue;
|
|
4488
|
+
}
|
|
4489
|
+
for (const key of Object.keys(rule)) if (![
|
|
4490
|
+
"include",
|
|
4491
|
+
"allowSharedAcrossOwners",
|
|
4492
|
+
"allowTripleSlashReferences",
|
|
4493
|
+
"reason"
|
|
4494
|
+
].includes(key)) ctx.addIssue({
|
|
4495
|
+
code: "custom",
|
|
4496
|
+
message: "unknown ambient declaration rule field.",
|
|
4497
|
+
path: [...rulePath, key]
|
|
4498
|
+
});
|
|
3904
4499
|
validateStringArrayField({
|
|
3905
4500
|
ctx,
|
|
3906
|
-
path: [...
|
|
4501
|
+
path: [...rulePath, "include"],
|
|
3907
4502
|
required: true,
|
|
3908
|
-
value:
|
|
3909
|
-
valueName: "
|
|
4503
|
+
value: rule.include,
|
|
4504
|
+
valueName: "ambient declaration include"
|
|
3910
4505
|
});
|
|
3911
|
-
|
|
3912
|
-
ctx
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
4506
|
+
if (Array.isArray(rule.include)) {
|
|
4507
|
+
for (const [includeIndex, include] of rule.include.entries()) if (typeof include === "string" && include.trim().length > 0 && isAbsolutePublicSelector(include)) ctx.addIssue({
|
|
4508
|
+
code: "custom",
|
|
4509
|
+
message: "ambient declaration include entries must be config.rootDir-relative paths; ../ is allowed.",
|
|
4510
|
+
path: [
|
|
4511
|
+
...rulePath,
|
|
4512
|
+
"include",
|
|
4513
|
+
includeIndex
|
|
4514
|
+
]
|
|
4515
|
+
});
|
|
4516
|
+
}
|
|
4517
|
+
if (typeof rule.reason !== "string" || rule.reason.trim().length === 0) ctx.addIssue({
|
|
4518
|
+
code: "custom",
|
|
4519
|
+
message: "ambient declaration reason must be a non-empty string.",
|
|
4520
|
+
path: [...rulePath, "reason"]
|
|
3916
4521
|
});
|
|
3917
|
-
const
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
4522
|
+
for (const key of ["allowSharedAcrossOwners", "allowTripleSlashReferences"]) if (rule[key] !== void 0 && typeof rule[key] !== "boolean") ctx.addIssue({
|
|
4523
|
+
code: "custom",
|
|
4524
|
+
message: `${key} must be a boolean.`,
|
|
4525
|
+
path: [...rulePath, key]
|
|
4526
|
+
});
|
|
4527
|
+
}
|
|
4528
|
+
}
|
|
4529
|
+
const regionExcludeKinds = ["workspace-package", "package-scope"];
|
|
4530
|
+
function validateRegionsConfig(value, ctx) {
|
|
4531
|
+
if (value === void 0) return;
|
|
4532
|
+
if (!isPlainConfigRecord(value)) {
|
|
4533
|
+
ctx.addIssue({
|
|
4534
|
+
code: "custom",
|
|
4535
|
+
message: "regions config must be an object.",
|
|
4536
|
+
path: ["regions"]
|
|
4537
|
+
});
|
|
4538
|
+
return;
|
|
4539
|
+
}
|
|
4540
|
+
for (const key of Object.keys(value)) {
|
|
4541
|
+
if (key === "exclude" || key === "extendNestedPackageScopes") continue;
|
|
4542
|
+
ctx.addIssue({
|
|
4543
|
+
code: "custom",
|
|
4544
|
+
message: "unknown regions config field.",
|
|
4545
|
+
path: ["regions", key]
|
|
3922
4546
|
});
|
|
3923
|
-
|
|
4547
|
+
}
|
|
4548
|
+
if (value.extendNestedPackageScopes !== void 0 && typeof value.extendNestedPackageScopes !== "boolean") ctx.addIssue({
|
|
4549
|
+
code: "custom",
|
|
4550
|
+
message: "regions.extendNestedPackageScopes must be a boolean.",
|
|
4551
|
+
path: ["regions", "extendNestedPackageScopes"]
|
|
4552
|
+
});
|
|
4553
|
+
const exclude = value.exclude;
|
|
4554
|
+
if (exclude === void 0) return;
|
|
4555
|
+
if (!Array.isArray(exclude)) {
|
|
4556
|
+
ctx.addIssue({
|
|
4557
|
+
code: "custom",
|
|
4558
|
+
message: "regions.exclude must be an array.",
|
|
4559
|
+
path: ["regions", "exclude"]
|
|
4560
|
+
});
|
|
4561
|
+
return;
|
|
4562
|
+
}
|
|
4563
|
+
for (const [index, entry] of exclude.entries()) {
|
|
4564
|
+
const entryPath = [
|
|
4565
|
+
"regions",
|
|
4566
|
+
"exclude",
|
|
4567
|
+
index
|
|
4568
|
+
];
|
|
4569
|
+
if (!isPlainConfigRecord(entry)) {
|
|
4570
|
+
ctx.addIssue({
|
|
4571
|
+
code: "custom",
|
|
4572
|
+
message: "regions.exclude entries must be objects with kind, include, and reason fields.",
|
|
4573
|
+
path: entryPath
|
|
4574
|
+
});
|
|
4575
|
+
continue;
|
|
4576
|
+
}
|
|
4577
|
+
for (const key of Object.keys(entry)) {
|
|
4578
|
+
if (key === "include" || key === "kind" || key === "reason") continue;
|
|
4579
|
+
ctx.addIssue({
|
|
4580
|
+
code: "custom",
|
|
4581
|
+
message: "unknown regions.exclude entry field.",
|
|
4582
|
+
path: [...entryPath, key]
|
|
4583
|
+
});
|
|
4584
|
+
}
|
|
4585
|
+
if (!Object.hasOwn(entry, "kind")) ctx.addIssue({
|
|
4586
|
+
code: "custom",
|
|
4587
|
+
message: `regions.exclude[${index}].kind is required.`,
|
|
4588
|
+
path: [...entryPath, "kind"]
|
|
4589
|
+
});
|
|
4590
|
+
else if (typeof entry.kind !== "string" || !regionExcludeKinds.includes(entry.kind)) ctx.addIssue({
|
|
3924
4591
|
code: "custom",
|
|
3925
|
-
message:
|
|
3926
|
-
path
|
|
4592
|
+
message: [`regions.exclude[${index}].kind must be one of:`, ...regionExcludeKinds.map((kind) => ` ${kind}`)].join("\n"),
|
|
4593
|
+
path: [...entryPath, "kind"]
|
|
4594
|
+
});
|
|
4595
|
+
validateStringArrayField({
|
|
4596
|
+
ctx,
|
|
4597
|
+
path: [...entryPath, "include"],
|
|
4598
|
+
required: true,
|
|
4599
|
+
value: entry.include,
|
|
4600
|
+
valueName: "regions.exclude.include"
|
|
3927
4601
|
});
|
|
3928
|
-
if (entry.
|
|
3929
|
-
|
|
4602
|
+
if (Array.isArray(entry.include)) {
|
|
4603
|
+
for (const [includeIndex, include] of entry.include.entries()) if (typeof include === "string" && include.trim().length > 0 && isAbsolutePublicSelector(include)) ctx.addIssue({
|
|
3930
4604
|
code: "custom",
|
|
3931
|
-
message: "
|
|
3932
|
-
path: [
|
|
4605
|
+
message: "regions.exclude.include entries must be config.rootDir-relative paths; ../ is allowed.",
|
|
4606
|
+
path: [
|
|
4607
|
+
...entryPath,
|
|
4608
|
+
"include",
|
|
4609
|
+
includeIndex
|
|
4610
|
+
]
|
|
3933
4611
|
});
|
|
3934
4612
|
}
|
|
3935
4613
|
if (typeof entry.reason !== "string" || entry.reason.trim().length === 0) ctx.addIssue({
|
|
3936
4614
|
code: "custom",
|
|
3937
4615
|
message: "reason must be a non-empty string.",
|
|
3938
|
-
path: [...
|
|
4616
|
+
path: [...entryPath, "reason"]
|
|
3939
4617
|
});
|
|
3940
4618
|
}
|
|
3941
4619
|
}
|
|
3942
4620
|
const liminaConfigShapeSchema = looseObject({
|
|
3943
4621
|
config: sharedLiminaConfigShapeSchema.optional(),
|
|
3944
4622
|
execution: executionConfigShapeSchema.optional(),
|
|
4623
|
+
regions: unknown().optional(),
|
|
3945
4624
|
release: releaseConfigShapeSchema.optional()
|
|
3946
4625
|
}).superRefine((config, ctx) => {
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
4626
|
+
for (const key of Object.keys(config)) {
|
|
4627
|
+
if (liminaConfigKeys.has(key)) continue;
|
|
4628
|
+
ctx.addIssue({
|
|
4629
|
+
code: "custom",
|
|
4630
|
+
message: "unknown Limina config field.",
|
|
4631
|
+
path: [key]
|
|
4632
|
+
});
|
|
4633
|
+
}
|
|
4634
|
+
validateRegionsConfig(config.regions, ctx);
|
|
3952
4635
|
const source = config.source;
|
|
3953
4636
|
if (source === void 0) return;
|
|
3954
4637
|
if (!isPlainConfigRecord(source)) {
|
|
@@ -3960,7 +4643,7 @@ const liminaConfigShapeSchema = looseObject({
|
|
|
3960
4643
|
return;
|
|
3961
4644
|
}
|
|
3962
4645
|
for (const key of Object.keys(source)) {
|
|
3963
|
-
if (key === "knip" || key === "importAuthority") continue;
|
|
4646
|
+
if (key === "knip" || key === "importAuthority" || key === "declarations") continue;
|
|
3964
4647
|
ctx.addIssue({
|
|
3965
4648
|
code: "custom",
|
|
3966
4649
|
message: "unknown source config field.",
|
|
@@ -3968,9 +4651,10 @@ const liminaConfigShapeSchema = looseObject({
|
|
|
3968
4651
|
});
|
|
3969
4652
|
}
|
|
3970
4653
|
validateSourceImportAuthorityConfig(source.importAuthority, ctx);
|
|
4654
|
+
validateSourceDeclarationsConfig(source.declarations, ctx);
|
|
3971
4655
|
});
|
|
3972
4656
|
function formatZodPath(pathSegments) {
|
|
3973
|
-
return pathSegments.map((segment) => typeof segment === "number" ? `[${segment}]` : `.${String(segment)}`).join("").replace(/^\./u, "");
|
|
4657
|
+
return pathSegments.map((segment) => typeof segment === "number" ? `[${segment}]` : /^[A-Za-z_$][\w$]*$/u.test(String(segment)) ? `.${String(segment)}` : `[${JSON.stringify(String(segment))}]`).join("").replace(/^\./u, "");
|
|
3974
4658
|
}
|
|
3975
4659
|
function getValueAtPath(value, pathSegments) {
|
|
3976
4660
|
let current = value;
|
|
@@ -3990,24 +4674,12 @@ function formatLiminaConfigShapeIssue(value, issue) {
|
|
|
3990
4674
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
3991
4675
|
" reason: config must be an object."
|
|
3992
4676
|
].join("\n");
|
|
3993
|
-
if (field === "paths") return [
|
|
3994
|
-
"Invalid Limina paths config:",
|
|
3995
|
-
" field: paths",
|
|
3996
|
-
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
3997
|
-
` reason: ${issue.message}`
|
|
3998
|
-
].join("\n");
|
|
3999
4677
|
if (field === "execution") return [
|
|
4000
4678
|
"Invalid Limina execution config:",
|
|
4001
4679
|
" field: execution",
|
|
4002
4680
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4003
4681
|
" reason: execution must be an object."
|
|
4004
4682
|
].join("\n");
|
|
4005
|
-
if (field === "execution.failFast") return [
|
|
4006
|
-
"Invalid Limina execution config:",
|
|
4007
|
-
" field: execution.failFast",
|
|
4008
|
-
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4009
|
-
" reason: execution failFast must be a boolean."
|
|
4010
|
-
].join("\n");
|
|
4011
4683
|
if (field.startsWith("execution.")) return [
|
|
4012
4684
|
"Invalid Limina execution config:",
|
|
4013
4685
|
` field: ${field}`,
|
|
@@ -4044,6 +4716,12 @@ function formatLiminaConfigShapeIssue(value, issue) {
|
|
|
4044
4716
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4045
4717
|
` reason: ${issue.message}`
|
|
4046
4718
|
].join("\n");
|
|
4719
|
+
if (field === "source.importAuthority" || field.startsWith("source.importAuthority.")) return [
|
|
4720
|
+
"Invalid source import authority config:",
|
|
4721
|
+
` field: ${field}`,
|
|
4722
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4723
|
+
` reason: ${issue.message}`
|
|
4724
|
+
].join("\n");
|
|
4047
4725
|
if (field === "source" || field.startsWith("source.")) return [
|
|
4048
4726
|
"Invalid Limina source config:",
|
|
4049
4727
|
` field: ${field}`,
|
|
@@ -4073,21 +4751,9 @@ function formatLiminaConfigShapeIssue(value, issue) {
|
|
|
4073
4751
|
" reason: checker preset must be a non-empty string."
|
|
4074
4752
|
].join("\n");
|
|
4075
4753
|
}
|
|
4076
|
-
|
|
4077
|
-
"Invalid Limina checker entry config:",
|
|
4078
|
-
` field: ${checkerField}.entry`,
|
|
4079
|
-
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4080
|
-
` reason: ${issue.message}`
|
|
4081
|
-
].join("\n");
|
|
4082
|
-
if (pathSegments[3] === "extensions") return [
|
|
4754
|
+
return [
|
|
4083
4755
|
"Invalid Limina checker config:",
|
|
4084
|
-
` field: ${
|
|
4085
|
-
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4086
|
-
` reason: ${issue.message}`
|
|
4087
|
-
].join("\n");
|
|
4088
|
-
if (pathSegments[3] === "routes") return [
|
|
4089
|
-
"Invalid Limina checker config:",
|
|
4090
|
-
` field: ${checkerField}.routes`,
|
|
4756
|
+
` field: ${field}`,
|
|
4091
4757
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4092
4758
|
` reason: ${issue.message}`
|
|
4093
4759
|
].join("\n");
|
|
@@ -4104,6 +4770,12 @@ function formatLiminaConfigShapeIssue(value, issue) {
|
|
|
4104
4770
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4105
4771
|
" reason: release.contentHash must be an object."
|
|
4106
4772
|
].join("\n");
|
|
4773
|
+
if (field === "release.npmPackageJsonLint" || field.startsWith("release.npmPackageJsonLint.")) return [
|
|
4774
|
+
"Invalid Limina release config:",
|
|
4775
|
+
` field: ${field}`,
|
|
4776
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4777
|
+
` reason: ${issue.message}`
|
|
4778
|
+
].join("\n");
|
|
4107
4779
|
if (field === "release.contentHash.baselineTag") return [
|
|
4108
4780
|
"Invalid Limina release config:",
|
|
4109
4781
|
" field: release.contentHash.baselineTag",
|
|
@@ -4142,19 +4814,32 @@ function collectLiminaConfigShapeProblems(value) {
|
|
|
4142
4814
|
}
|
|
4143
4815
|
function validateLiminaConfig(config) {
|
|
4144
4816
|
const problems = collectLiminaConfigShapeProblems(config);
|
|
4145
|
-
if (problems.length > 0) throw new
|
|
4817
|
+
if (problems.length > 0) throw new ConfigurationError(problems.join("\n\n"), problems.map((message) => ({
|
|
4818
|
+
message,
|
|
4819
|
+
path: []
|
|
4820
|
+
})));
|
|
4146
4821
|
}
|
|
4147
|
-
|
|
4148
4822
|
//#endregion
|
|
4149
4823
|
//#region src/config/runner.ts
|
|
4150
4824
|
function isAutoCheckerConfigMode(checkers) {
|
|
4151
4825
|
return Boolean(checkers && checkers.mode === "auto");
|
|
4152
4826
|
}
|
|
4827
|
+
const DEFAULT_LIMINA_CONFIG_FILES = [
|
|
4828
|
+
"limina.config.mts",
|
|
4829
|
+
"limina.config.mjs",
|
|
4830
|
+
"limina.config.ts",
|
|
4831
|
+
"limina.config.js"
|
|
4832
|
+
];
|
|
4153
4833
|
function defineConfig(config) {
|
|
4154
4834
|
return config;
|
|
4155
4835
|
}
|
|
4156
4836
|
function getActiveCheckers(config) {
|
|
4157
|
-
|
|
4837
|
+
if ("configPath" in config && "rootDir" in config) {
|
|
4838
|
+
const userConfig = { ...config };
|
|
4839
|
+
delete userConfig.configPath;
|
|
4840
|
+
delete userConfig.rootDir;
|
|
4841
|
+
validateLiminaConfig(userConfig);
|
|
4842
|
+
} else validateLiminaConfig(config);
|
|
4158
4843
|
return getResolvedCheckers(config);
|
|
4159
4844
|
}
|
|
4160
4845
|
function normalizeConfig(value) {
|
|
@@ -4181,8 +4866,10 @@ function findLiminaConfigPath(startDir, rootDir) {
|
|
|
4181
4866
|
let currentDir = posix.resolve(startDir);
|
|
4182
4867
|
const workspaceRootDir = posix.resolve(rootDir);
|
|
4183
4868
|
while (isPathInsideDirectory(currentDir, workspaceRootDir)) {
|
|
4184
|
-
const
|
|
4185
|
-
|
|
4869
|
+
for (const fileName of DEFAULT_LIMINA_CONFIG_FILES) {
|
|
4870
|
+
const candidatePath = posix.join(currentDir, fileName);
|
|
4871
|
+
if (existsSync(candidatePath)) return candidatePath;
|
|
4872
|
+
}
|
|
4186
4873
|
if (currentDir === workspaceRootDir) return null;
|
|
4187
4874
|
const parentDir = posix.dirname(currentDir);
|
|
4188
4875
|
if (parentDir === currentDir) return null;
|
|
@@ -4202,33 +4889,91 @@ function validateConfigPathInsideWorkspace(configPath, rootDir) {
|
|
|
4202
4889
|
async function resolveConfigExport(configExport, configEnv) {
|
|
4203
4890
|
return normalizeConfig(typeof configExport === "function" ? await configExport(configEnv) : await configExport);
|
|
4204
4891
|
}
|
|
4205
|
-
function
|
|
4206
|
-
|
|
4892
|
+
function hasSourceImportAuthorityWorkspaceRootGrants(config) {
|
|
4893
|
+
const allow = config.source?.importAuthority?.allow;
|
|
4894
|
+
if (!allow) return false;
|
|
4895
|
+
return Boolean(Object.values(allow).some((grants) => grants.some((grant) => grant.workspaceRootDependencies.some((packageName) => packageName.trim().length > 0))));
|
|
4207
4896
|
}
|
|
4208
4897
|
function validateRootPackageImportAuthorityConfig(config, rootDir) {
|
|
4209
|
-
if (!
|
|
4898
|
+
if (!hasSourceImportAuthorityWorkspaceRootGrants(config)) return;
|
|
4210
4899
|
if (existsSync(posix.join(rootDir, "package.json"))) return;
|
|
4211
4900
|
throw new Error([
|
|
4212
|
-
"Invalid
|
|
4213
|
-
" field: source.importAuthority.allow
|
|
4214
|
-
|
|
4215
|
-
"
|
|
4901
|
+
"Invalid source import authority config:",
|
|
4902
|
+
" field: source.importAuthority.allow",
|
|
4903
|
+
" reason: workspaceRootDependencies grants require a workspace root package.json.",
|
|
4904
|
+
" fix: create a workspace root package.json, or remove workspaceRootDependencies grants."
|
|
4216
4905
|
].join("\n"));
|
|
4217
4906
|
}
|
|
4907
|
+
function resolveConfigLoader(configLoader) {
|
|
4908
|
+
if (configLoader === void 0 || configLoader === "native") return "native";
|
|
4909
|
+
if (configLoader === "tsx") return "tsx";
|
|
4910
|
+
throw new Error(`Unsupported Limina config loader "${String(configLoader)}". Expected one of: native, tsx.`);
|
|
4911
|
+
}
|
|
4912
|
+
function getErrorMessage(error) {
|
|
4913
|
+
return error instanceof Error ? error.message : String(error);
|
|
4914
|
+
}
|
|
4915
|
+
function getErrorCode(error) {
|
|
4916
|
+
return typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
|
|
4917
|
+
}
|
|
4918
|
+
function shouldSuggestTsxLoader(error) {
|
|
4919
|
+
const code = getErrorCode(error);
|
|
4920
|
+
const message = getErrorMessage(error);
|
|
4921
|
+
const stack = error instanceof Error ? error.stack : void 0;
|
|
4922
|
+
return code === "ERR_UNKNOWN_FILE_EXTENSION" || code === "ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX" || message.includes("Unknown file extension \".ts\"") || message.includes("Unknown file extension \".mts\"") || message.includes("Cannot find module") || typeof stack === "string" && stack.includes("node:internal/modules/esm/translators");
|
|
4923
|
+
}
|
|
4924
|
+
function unwrapModuleDefault(module) {
|
|
4925
|
+
if (typeof module === "object" && module !== null && "default" in module && Object.prototype.toString.call(module) === "[object Module]") return module.default;
|
|
4926
|
+
return module;
|
|
4927
|
+
}
|
|
4928
|
+
function unwrapTsxConfigExport(module) {
|
|
4929
|
+
const value = unwrapModuleDefault(module);
|
|
4930
|
+
if (typeof value === "object" && value !== null && "default" in value && Object.prototype.toString.call(value) === "[object Object]" && Object.keys(value).length === 1) return value.default;
|
|
4931
|
+
return value;
|
|
4932
|
+
}
|
|
4933
|
+
async function nativeImportConfig(configPath) {
|
|
4934
|
+
const url = pathToFileURL(configPath);
|
|
4935
|
+
url.searchParams.set("t", String(Date.now()));
|
|
4936
|
+
try {
|
|
4937
|
+
return unwrapModuleDefault(await import(url.href));
|
|
4938
|
+
} catch (error) {
|
|
4939
|
+
if (shouldSuggestTsxLoader(error)) throw new Error([
|
|
4940
|
+
"Failed to load the Limina config file with the native loader.",
|
|
4941
|
+
"Try setting the --config-loader CLI flag to `tsx`.",
|
|
4942
|
+
"",
|
|
4943
|
+
getErrorMessage(error)
|
|
4944
|
+
].join("\n"), { cause: error });
|
|
4945
|
+
throw error;
|
|
4946
|
+
}
|
|
4947
|
+
}
|
|
4948
|
+
async function tsxImportConfig(configPath) {
|
|
4949
|
+
let tsxApi;
|
|
4950
|
+
try {
|
|
4951
|
+
tsxApi = await import("tsx/esm/api");
|
|
4952
|
+
} catch (error) {
|
|
4953
|
+
throw new Error(["Failed to load the Limina config file with the tsx loader.", "Please install `tsx` in the current workspace before using --config-loader tsx."].join("\n"), { cause: error });
|
|
4954
|
+
}
|
|
4955
|
+
return unwrapTsxConfigExport(await tsxApi.tsImport(pathToFileURL(configPath).href, import.meta.url));
|
|
4956
|
+
}
|
|
4957
|
+
async function loadConfigModule(configPath, configLoader) {
|
|
4958
|
+
return resolveConfigLoader(configLoader) === "native" ? nativeImportConfig(configPath) : tsxImportConfig(configPath);
|
|
4959
|
+
}
|
|
4960
|
+
function formatDefaultConfigFileList() {
|
|
4961
|
+
return DEFAULT_LIMINA_CONFIG_FILES.map((fileName) => `"${fileName}"`).join(", ");
|
|
4962
|
+
}
|
|
4218
4963
|
async function loadConfig(options = {}) {
|
|
4219
4964
|
const cwd = options.cwd ? posix.resolve(options.cwd) : process.cwd();
|
|
4220
|
-
const
|
|
4221
|
-
const
|
|
4222
|
-
|
|
4223
|
-
if (
|
|
4224
|
-
|
|
4965
|
+
const configPath = options.configPath ? posix.resolve(cwd, options.configPath) : void 0;
|
|
4966
|
+
const rootDir = configPath ? inferWorkspaceRoot(posix.dirname(configPath)) : inferWorkspaceRoot(cwd);
|
|
4967
|
+
const resolvedConfigPath = configPath ?? findLiminaConfigPath(cwd, rootDir);
|
|
4968
|
+
if (resolvedConfigPath) validateConfigPathInsideWorkspace(resolvedConfigPath, rootDir);
|
|
4969
|
+
if (!resolvedConfigPath || !existsSync(resolvedConfigPath)) throw new Error(options.configPath ? `Unable to find limina config at ${resolvedConfigPath}` : `Unable to find limina config. Searched for ${formatDefaultConfigFileList()} from ${cwd} up to the pnpm workspace root at ${rootDir}.`);
|
|
4970
|
+
const config = await resolveConfigExport(await loadConfigModule(resolvedConfigPath, options.configLoader), createConfigEnv(options));
|
|
4225
4971
|
validateRootPackageImportAuthorityConfig(config, rootDir);
|
|
4226
4972
|
return {
|
|
4227
4973
|
...config,
|
|
4228
|
-
configPath,
|
|
4974
|
+
configPath: resolvedConfigPath,
|
|
4229
4975
|
rootDir
|
|
4230
4976
|
};
|
|
4231
4977
|
}
|
|
4232
|
-
|
|
4233
4978
|
//#endregion
|
|
4234
|
-
export {
|
|
4979
|
+
export { normalizeAbsolutePathIdentity as A, countDefinedBy as B, candidatePathsForBasePath as C, resolveRelativeModuleCandidate as D, resolvePathMappedModuleCandidate as E, isPackageImportSpecifier as F, uniqueTrimmedNonEmptySortedStrings as H, isRelativeSpecifier as I, isUrlOrDataOrFileSpecifier as L, toPosixPath as M, toRelativePath as N, isPathInsideDirectory as O, isBarePackageSpecifier as P, isVirtualModuleSpecifier as R, resolveModuleNameWithCheckersDetailed as S, resolveExistingFilePath as T, uniqueValues as U, uniqueSortedStrings as V, isBuildCapablePreset as _, CancelledFailure as a, parseCheckerProjectConfigForContext as b, formatUnknownValue as c, collectMissingCheckerPeerDependencies as d, formatMissingCheckerPeerDependencies as f, getCheckerExtensions as g, getCheckerBuildEngine as h, loadConfig as i, normalizeSlashes as j, normalizeAbsolutePath as k, isNonEmptyString as l, getCheckerAdapter as m, getActiveCheckers as n, ConfigurationError as o, getBuildCheckerSupportedExtensions as p, isAutoCheckerConfigMode as r, ExecutionFailure as s, defineConfig as t, isPlainRecord as u, isNativeTypeScriptProjectInput as v, resolveBaseUrlModuleCandidate as w, resolveCheckerProjectExtensions as x, normalizeExtensions as y, posix as z };
|