limina 0.0.6 → 0.1.2
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 +105 -30
- package/README.md +18 -11
- package/README.zh-CN.md +17 -10
- package/bin/limina.js +2 -1
- package/chunks/{dep-Ce6cDHmw.js → dep-DJz9JBTi.js} +649 -1316
- package/chunks/dep-mnWOqiGN.js +244 -0
- package/cli.js +34575 -7481
- package/flow-renderer-process.js +101 -0
- package/index.d.ts +680 -163
- package/index.js +2 -3
- package/package.json +11 -12
- package/schemas/tsconfig-schema.json +54 -0
- package/chunks/dep-COZNKoxO.js +0 -15582
- package/config.d.ts +0 -683
- package/config.js +0 -3
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import { existsSync, statSync } from "node:fs";
|
|
2
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
3
|
import ts from "typescript";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
|
|
6
|
+
//#region src/utils/collections.ts
|
|
7
|
+
function uniqueValues(values) {
|
|
8
|
+
return [...new Set(values)];
|
|
9
|
+
}
|
|
10
|
+
function uniqueBy(values, getKey) {
|
|
11
|
+
const seen = /* @__PURE__ */ new Set();
|
|
12
|
+
const result = [];
|
|
13
|
+
for (const value of values) {
|
|
14
|
+
const key = getKey(value);
|
|
15
|
+
if (seen.has(key)) continue;
|
|
16
|
+
seen.add(key);
|
|
17
|
+
result.push(value);
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
function uniqueSortedStrings(values) {
|
|
22
|
+
return uniqueValues(values).sort((left, right) => left.localeCompare(right));
|
|
23
|
+
}
|
|
24
|
+
function uniqueTrimmedNonEmptySortedStrings(values) {
|
|
25
|
+
return uniqueSortedStrings([...values].map((value) => value?.trim()).filter((value) => Boolean(value)));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
6
29
|
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
7
30
|
let _lazyMatch = () => {
|
|
8
31
|
var __lib__ = (() => {
|
|
@@ -451,6 +474,24 @@ const mix = (del = delimiter) => {
|
|
|
451
474
|
const posix = /* @__PURE__ */ mix(":");
|
|
452
475
|
const win32 = /* @__PURE__ */ mix(";");
|
|
453
476
|
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/utils/module-specifier.ts
|
|
479
|
+
function isRelativeSpecifier(specifier) {
|
|
480
|
+
return specifier === "." || specifier === ".." || specifier.startsWith("./") || specifier.startsWith("../");
|
|
481
|
+
}
|
|
482
|
+
function isUrlOrDataOrFileSpecifier(specifier) {
|
|
483
|
+
return specifier.startsWith("data:") || specifier.startsWith("file:") || specifier.startsWith("http:") || specifier.startsWith("https:");
|
|
484
|
+
}
|
|
485
|
+
function isVirtualModuleSpecifier(specifier) {
|
|
486
|
+
return specifier.startsWith("virtual:");
|
|
487
|
+
}
|
|
488
|
+
function isPackageImportSpecifier(specifier) {
|
|
489
|
+
return specifier.startsWith("#");
|
|
490
|
+
}
|
|
491
|
+
function isBarePackageSpecifier(specifier) {
|
|
492
|
+
return !isRelativeSpecifier(specifier) && !isPackageImportSpecifier(specifier) && !isUrlOrDataOrFileSpecifier(specifier) && !isVirtualModuleSpecifier(specifier) && !posix.isAbsolute(specifier);
|
|
493
|
+
}
|
|
494
|
+
|
|
454
495
|
//#endregion
|
|
455
496
|
//#region src/utils/path.ts
|
|
456
497
|
function toPosixPath(value) {
|
|
@@ -471,9 +512,82 @@ function normalizeAbsolutePathIdentity(value) {
|
|
|
471
512
|
return normalizedPath.length > 1 && !/^[A-Za-z]:\/$/u.test(normalizedPath) ? normalizedPath.replace(/\/+$/u, "") : normalizedPath;
|
|
472
513
|
}
|
|
473
514
|
function isPathInsideDirectory(filePath, directoryPath) {
|
|
474
|
-
const normalizedFilePath =
|
|
475
|
-
const
|
|
476
|
-
return
|
|
515
|
+
const normalizedFilePath = normalizeComparableAbsolutePath(filePath);
|
|
516
|
+
const relativePath = relative(normalizeComparableAbsolutePath(directoryPath), normalizedFilePath);
|
|
517
|
+
return relativePath.length === 0 || relativePath !== ".." && !relativePath.startsWith("../") && !isAbsolute(relativePath);
|
|
518
|
+
}
|
|
519
|
+
function normalizeComparableAbsolutePath(value) {
|
|
520
|
+
return normalizeAbsolutePathIdentity(isAbsolute(value) ? value : resolve(value));
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
//#endregion
|
|
524
|
+
//#region src/utils/module-resolution.ts
|
|
525
|
+
function pathHasExtension(value) {
|
|
526
|
+
return posix.extname(value).length > 0;
|
|
527
|
+
}
|
|
528
|
+
function candidatePathsForBasePath(basePath, extensions) {
|
|
529
|
+
if (pathHasExtension(basePath)) return [basePath];
|
|
530
|
+
return extensions.flatMap((extension) => [`${basePath}${extension}`, posix.join(basePath, `index${extension}`)]);
|
|
531
|
+
}
|
|
532
|
+
function resolveExistingFilePath(candidatePath) {
|
|
533
|
+
if (!existsSync(candidatePath)) return null;
|
|
534
|
+
if (!statSync(candidatePath).isFile()) return null;
|
|
535
|
+
return normalizeAbsolutePath(candidatePath);
|
|
536
|
+
}
|
|
537
|
+
function matchPathPattern(pattern, specifier) {
|
|
538
|
+
const wildcardIndex = pattern.indexOf("*");
|
|
539
|
+
if (wildcardIndex === -1) return pattern === specifier ? "" : null;
|
|
540
|
+
const prefix = pattern.slice(0, wildcardIndex);
|
|
541
|
+
const suffix = pattern.slice(wildcardIndex + 1);
|
|
542
|
+
if (!specifier.startsWith(prefix) || !specifier.endsWith(suffix)) return null;
|
|
543
|
+
return specifier.slice(prefix.length, specifier.length - suffix.length);
|
|
544
|
+
}
|
|
545
|
+
function resolveRelativeModuleCandidate(options) {
|
|
546
|
+
if (!isRelativeSpecifier(options.specifier)) return null;
|
|
547
|
+
const resolvedSpecifierPath = posix.resolve(posix.dirname(options.containingFile), options.specifier);
|
|
548
|
+
for (const candidatePath of candidatePathsForBasePath(resolvedSpecifierPath, options.extensions)) {
|
|
549
|
+
const resolvedPath = resolveExistingFilePath(candidatePath);
|
|
550
|
+
if (resolvedPath) return resolvedPath;
|
|
551
|
+
}
|
|
552
|
+
return null;
|
|
553
|
+
}
|
|
554
|
+
function resolvePathMappedModuleCandidate(options) {
|
|
555
|
+
const paths = options.compilerOptions.paths;
|
|
556
|
+
const pathsBasePath = getPathsBasePath(options.compilerOptions);
|
|
557
|
+
if (!paths || !pathsBasePath) return null;
|
|
558
|
+
const pathEntries = Object.entries(paths).sort(([left], [right]) => {
|
|
559
|
+
const leftPrefixLength = left.split("*")[0]?.length ?? left.length;
|
|
560
|
+
return (right.split("*")[0]?.length ?? right.length) - leftPrefixLength;
|
|
561
|
+
});
|
|
562
|
+
for (const [alias, targets] of pathEntries) {
|
|
563
|
+
const matchedText = matchPathPattern(alias, options.specifier);
|
|
564
|
+
if (matchedText === null) continue;
|
|
565
|
+
for (const target of targets) {
|
|
566
|
+
const resolvedTargetPath = posix.resolve(pathsBasePath, applyPathPattern(target, matchedText));
|
|
567
|
+
for (const candidatePath of candidatePathsForBasePath(resolvedTargetPath, options.extensions)) {
|
|
568
|
+
const resolvedPath = resolveExistingFilePath(candidatePath);
|
|
569
|
+
if (resolvedPath) return resolvedPath;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
return null;
|
|
574
|
+
}
|
|
575
|
+
function resolveBaseUrlModuleCandidate(options) {
|
|
576
|
+
if (isRelativeSpecifier(options.specifier) || !options.compilerOptions.baseUrl) return null;
|
|
577
|
+
const baseUrlPath = posix.resolve(options.compilerOptions.baseUrl, options.specifier);
|
|
578
|
+
for (const candidatePath of candidatePathsForBasePath(baseUrlPath, options.extensions)) {
|
|
579
|
+
const resolvedPath = resolveExistingFilePath(candidatePath);
|
|
580
|
+
if (resolvedPath) return resolvedPath;
|
|
581
|
+
}
|
|
582
|
+
return null;
|
|
583
|
+
}
|
|
584
|
+
function applyPathPattern(pattern, matchedText) {
|
|
585
|
+
return pattern.includes("*") ? pattern.replace("*", matchedText) : pattern;
|
|
586
|
+
}
|
|
587
|
+
function getPathsBasePath(compilerOptions) {
|
|
588
|
+
const pathsBasePath = compilerOptions.pathsBasePath;
|
|
589
|
+
if (typeof pathsBasePath === "string") return pathsBasePath;
|
|
590
|
+
return compilerOptions.baseUrl ?? null;
|
|
477
591
|
}
|
|
478
592
|
|
|
479
593
|
//#endregion
|
|
@@ -499,6 +613,12 @@ function getNativeTypeScriptProjectExtensions() {
|
|
|
499
613
|
};
|
|
500
614
|
return normalizeExtensions(flattenTypeScriptExtensionGroups(api.getSupportedExtensionsWithJsonIfResolveJsonModule(options, api.getSupportedExtensions(options))));
|
|
501
615
|
}
|
|
616
|
+
function getBuildCheckerSupportedExtensions(preset) {
|
|
617
|
+
const adapter = getCheckerAdapter(preset);
|
|
618
|
+
if (!adapter || adapter.execution !== "build") return [];
|
|
619
|
+
const nativeExtensions = getNativeTypeScriptProjectExtensions();
|
|
620
|
+
return preset === "vue-tsc" ? normalizeExtensions([...nativeExtensions, ".vue"]) : nativeExtensions;
|
|
621
|
+
}
|
|
502
622
|
function getSvelteCheckerExtensions() {
|
|
503
623
|
return normalizeExtensions([...getTypeScriptCheckerExtensions(), ".svelte"]);
|
|
504
624
|
}
|
|
@@ -539,7 +659,7 @@ function cloneParsedCheckerProjectConfig(parsedConfig) {
|
|
|
539
659
|
};
|
|
540
660
|
}
|
|
541
661
|
function resolveContextCheckerPresets(context) {
|
|
542
|
-
return context.checkerPresets.length > 0 ?
|
|
662
|
+
return context.checkerPresets.length > 0 ? uniqueSortedStrings(context.checkerPresets) : ["tsc"];
|
|
543
663
|
}
|
|
544
664
|
function createParsedProjectConfigCacheKey(options) {
|
|
545
665
|
const configStat = statSync(options.configPath);
|
|
@@ -552,6 +672,9 @@ function createParsedProjectConfigCacheKey(options) {
|
|
|
552
672
|
projectRootDir: normalizeAbsolutePath(options.projectRootDir)
|
|
553
673
|
});
|
|
554
674
|
}
|
|
675
|
+
function clearCheckerProjectConfigCache() {
|
|
676
|
+
parsedProjectConfigCache.clear();
|
|
677
|
+
}
|
|
555
678
|
function createExtraFileExtensions(extensions) {
|
|
556
679
|
const nativeExtensions = new Set(getNativeTypeScriptProjectExtensions());
|
|
557
680
|
return extensions.filter((extension) => !nativeExtensions.has(extension)).map((extension) => ({
|
|
@@ -681,78 +804,117 @@ function resolveExtensionsForChecker(options, extensions) {
|
|
|
681
804
|
function resolveVueProjectExtensionsForChecker(options, packageName) {
|
|
682
805
|
return normalizeExtensions([...options.extensions ?? [], ...resolveVueProjectExtensions(options, packageName)]);
|
|
683
806
|
}
|
|
684
|
-
function
|
|
685
|
-
return
|
|
686
|
-
}
|
|
687
|
-
function pathHasExtension(value) {
|
|
688
|
-
return posix.extname(value).length > 0;
|
|
689
|
-
}
|
|
690
|
-
function candidatePathsForBasePath(basePath, extensions) {
|
|
691
|
-
if (pathHasExtension(basePath)) return [basePath];
|
|
692
|
-
return extensions.flatMap((extension) => [`${basePath}${extension}`, posix.join(basePath, `index${extension}`)]);
|
|
693
|
-
}
|
|
694
|
-
function resolveCandidatePath(candidatePath) {
|
|
695
|
-
if (!existsSync(candidatePath)) return null;
|
|
696
|
-
if (!statSync(candidatePath).isFile()) return null;
|
|
697
|
-
return normalizeAbsolutePath(candidatePath);
|
|
807
|
+
function resolveTypeScriptModuleName(options) {
|
|
808
|
+
return resolveTypeScriptModuleNameDetailed(options)?.resolvedFileName ?? null;
|
|
698
809
|
}
|
|
699
|
-
function
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
810
|
+
function resolveTypeScriptModuleNameDetailed(options) {
|
|
811
|
+
const resolved = ts.resolveModuleName(options.specifier, options.containingFile, options.compilerOptions, ts.sys).resolvedModule;
|
|
812
|
+
if (resolved?.resolvedFileName) return {
|
|
813
|
+
isExternalLibraryImport: resolved.isExternalLibraryImport === true,
|
|
814
|
+
resolvedBy: "typescript",
|
|
815
|
+
resolvedFileName: normalizeAbsolutePath(resolved.resolvedFileName)
|
|
816
|
+
};
|
|
817
|
+
return resolveCheckerExtensionModuleName(options);
|
|
818
|
+
}
|
|
819
|
+
function resolveCheckerExtensionModuleName(options) {
|
|
820
|
+
const typeScriptExtensions = new Set(getTypeScriptCheckerExtensions());
|
|
821
|
+
const checkerOnlyExtensions = options.extensions.filter((extension) => !typeScriptExtensions.has(extension));
|
|
822
|
+
if (checkerOnlyExtensions.length === 0) return null;
|
|
823
|
+
const resolvedFileName = resolveRelativeModuleCandidate({
|
|
824
|
+
containingFile: options.containingFile,
|
|
825
|
+
extensions: checkerOnlyExtensions,
|
|
826
|
+
specifier: options.specifier
|
|
827
|
+
}) ?? resolvePathMappedModuleCandidate({
|
|
828
|
+
compilerOptions: options.compilerOptions,
|
|
829
|
+
extensions: checkerOnlyExtensions,
|
|
830
|
+
specifier: options.specifier
|
|
831
|
+
}) ?? resolvePackageExportModuleCandidate({
|
|
832
|
+
containingFile: options.containingFile,
|
|
833
|
+
extensions: checkerOnlyExtensions,
|
|
834
|
+
specifier: options.specifier
|
|
835
|
+
});
|
|
836
|
+
return resolvedFileName ? {
|
|
837
|
+
isExternalLibraryImport: false,
|
|
838
|
+
resolvedBy: "checker-extension",
|
|
839
|
+
resolvedFileName
|
|
840
|
+
} : null;
|
|
841
|
+
}
|
|
842
|
+
function resolvePackageExportModuleCandidate(options) {
|
|
843
|
+
const specifierParts = parsePackageSpecifier(options.specifier);
|
|
844
|
+
if (!specifierParts) return null;
|
|
845
|
+
const packageDirectory = findPackageDirectoryForImport({
|
|
846
|
+
containingFile: options.containingFile,
|
|
847
|
+
packageName: specifierParts.packageName
|
|
848
|
+
});
|
|
849
|
+
if (!packageDirectory) return null;
|
|
850
|
+
const targets = collectExportTargetsForSubpath(readPackageManifest(packageDirectory)?.exports, specifierParts.subpath);
|
|
851
|
+
for (const target of targets) {
|
|
852
|
+
if (!target.startsWith("./")) continue;
|
|
853
|
+
const targetPath = posix.resolve(packageDirectory, target.slice(2));
|
|
854
|
+
for (const candidatePath of candidatePathsForBasePath(targetPath, options.extensions)) {
|
|
855
|
+
const resolvedPath = resolveExistingFilePath(candidatePath);
|
|
856
|
+
if (resolvedPath) return resolvedPath;
|
|
857
|
+
}
|
|
705
858
|
}
|
|
706
859
|
return null;
|
|
707
860
|
}
|
|
708
|
-
function
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
861
|
+
function parsePackageSpecifier(specifier) {
|
|
862
|
+
if (specifier.length === 0 || specifier.startsWith(".") || specifier.startsWith("/")) return null;
|
|
863
|
+
const parts = specifier.split("/");
|
|
864
|
+
if (specifier.startsWith("@")) {
|
|
865
|
+
const scope = parts[0];
|
|
866
|
+
const name = parts[1];
|
|
867
|
+
if (!scope || !name) return null;
|
|
868
|
+
return {
|
|
869
|
+
packageName: `${scope}/${name}`,
|
|
870
|
+
subpath: parts.length > 2 ? `./${parts.slice(2).join("/")}` : "."
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
const packageName = parts[0];
|
|
874
|
+
return packageName ? {
|
|
875
|
+
packageName,
|
|
876
|
+
subpath: parts.length > 1 ? `./${parts.slice(1).join("/")}` : "."
|
|
877
|
+
} : null;
|
|
878
|
+
}
|
|
879
|
+
function findPackageDirectoryForImport(options) {
|
|
880
|
+
let currentDir = posix.dirname(options.containingFile);
|
|
881
|
+
for (;;) {
|
|
882
|
+
const packageDirectory = posix.join(currentDir, "node_modules", options.packageName);
|
|
883
|
+
if (existsSync(posix.join(packageDirectory, "package.json"))) return packageDirectory;
|
|
884
|
+
const parentDir = posix.dirname(currentDir);
|
|
885
|
+
if (parentDir === currentDir) return null;
|
|
886
|
+
currentDir = parentDir;
|
|
887
|
+
}
|
|
715
888
|
}
|
|
716
|
-
function
|
|
717
|
-
|
|
889
|
+
function readPackageManifest(packageDirectory) {
|
|
890
|
+
try {
|
|
891
|
+
return JSON.parse(readFileSync(posix.join(packageDirectory, "package.json"), "utf8"));
|
|
892
|
+
} catch {
|
|
893
|
+
return null;
|
|
894
|
+
}
|
|
718
895
|
}
|
|
719
|
-
function
|
|
720
|
-
|
|
721
|
-
if (typeof pathsBasePath === "string") return pathsBasePath;
|
|
722
|
-
return compilerOptions.baseUrl ?? null;
|
|
896
|
+
function isRecord(value) {
|
|
897
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
723
898
|
}
|
|
724
|
-
function
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
if (
|
|
728
|
-
|
|
729
|
-
const leftPrefixLength = left.split("*")[0]?.length ?? left.length;
|
|
730
|
-
return (right.split("*")[0]?.length ?? right.length) - leftPrefixLength;
|
|
731
|
-
});
|
|
732
|
-
for (const [alias, targets] of pathEntries) {
|
|
733
|
-
const matchedText = matchPathPattern(alias, options.specifier);
|
|
734
|
-
if (matchedText === null) continue;
|
|
735
|
-
for (const target of targets) {
|
|
736
|
-
const resolvedTargetPath = posix.resolve(pathsBasePath, applyPathPattern(target, matchedText));
|
|
737
|
-
for (const candidatePath of candidatePathsForBasePath(resolvedTargetPath, options.extensions)) {
|
|
738
|
-
const resolvedPath = resolveCandidatePath(candidatePath);
|
|
739
|
-
if (resolvedPath) return resolvedPath;
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
return null;
|
|
899
|
+
function collectStringTargets(value) {
|
|
900
|
+
if (typeof value === "string") return [value];
|
|
901
|
+
if (Array.isArray(value)) return value.flatMap(collectStringTargets);
|
|
902
|
+
if (isRecord(value)) return Object.values(value).flatMap(collectStringTargets);
|
|
903
|
+
return [];
|
|
744
904
|
}
|
|
745
|
-
function
|
|
746
|
-
|
|
747
|
-
if (
|
|
748
|
-
|
|
905
|
+
function collectExportTargetsForSubpath(exportsField, subpath) {
|
|
906
|
+
if (exportsField === void 0) return subpath === "." ? ["./index"] : [subpath];
|
|
907
|
+
if (typeof exportsField === "string" || Array.isArray(exportsField)) return subpath === "." ? collectStringTargets(exportsField) : [];
|
|
908
|
+
if (!isRecord(exportsField)) return [];
|
|
909
|
+
if (!Object.keys(exportsField).some((key) => key === "." || key.startsWith("./"))) return subpath === "." ? collectStringTargets(exportsField) : [];
|
|
910
|
+
return collectStringTargets(exportsField[subpath]);
|
|
749
911
|
}
|
|
750
912
|
function mergeParsedProjectConfigs(parsedConfigs, extensions) {
|
|
751
913
|
const firstConfig = parsedConfigs[0];
|
|
752
914
|
if (!firstConfig) throw new Error("Unable to parse checker project config: no parser ran.");
|
|
753
915
|
return {
|
|
754
916
|
extensions: normalizeExtensions([...extensions, ...parsedConfigs.flatMap((parsedConfig) => parsedConfig.extensions)]),
|
|
755
|
-
fileNames:
|
|
917
|
+
fileNames: uniqueSortedStrings(parsedConfigs.flatMap((parsedConfig) => parsedConfig.fileNames)),
|
|
756
918
|
options: firstConfig.options
|
|
757
919
|
};
|
|
758
920
|
}
|
|
@@ -779,11 +941,13 @@ function parseCheckerProjectConfigForContext(options) {
|
|
|
779
941
|
return cloneParsedCheckerProjectConfig(parsedConfig);
|
|
780
942
|
}
|
|
781
943
|
function resolveModuleNameWithCheckers(options) {
|
|
944
|
+
return resolveModuleNameWithCheckersDetailed(options)?.resolvedFileName ?? null;
|
|
945
|
+
}
|
|
946
|
+
function resolveModuleNameWithCheckersDetailed(options) {
|
|
782
947
|
const checkerPresets = options.context.checkerPresets.length > 0 ? options.context.checkerPresets : ["tsc"];
|
|
783
948
|
for (const preset of checkerPresets) {
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
const resolved = adapter.resolveModuleName({
|
|
949
|
+
if (!getCheckerAdapter(preset)) continue;
|
|
950
|
+
const resolved = resolveTypeScriptModuleNameDetailed({
|
|
787
951
|
compilerOptions: options.compilerOptions,
|
|
788
952
|
containingFile: options.containingFile,
|
|
789
953
|
extensions: options.context.extensions,
|
|
@@ -808,10 +972,11 @@ function createTscCommandTarget(options) {
|
|
|
808
972
|
"-b",
|
|
809
973
|
relativeConfigPath,
|
|
810
974
|
"--pretty",
|
|
811
|
-
"false"
|
|
975
|
+
"false",
|
|
976
|
+
...options.watch ? ["--watch", "--preserveWatchOutput"] : []
|
|
812
977
|
],
|
|
813
978
|
command: options.commandOverride ?? "tsc",
|
|
814
|
-
label: `tsc -b ${relativeConfigPath}`
|
|
979
|
+
label: `tsc -b ${relativeConfigPath}${options.watch ? " --watch" : ""}`
|
|
815
980
|
};
|
|
816
981
|
}
|
|
817
982
|
function createTsgoCommandTarget(options) {
|
|
@@ -821,10 +986,11 @@ function createTsgoCommandTarget(options) {
|
|
|
821
986
|
"-b",
|
|
822
987
|
relativeConfigPath,
|
|
823
988
|
"--pretty",
|
|
824
|
-
"false"
|
|
989
|
+
"false",
|
|
990
|
+
...options.watch ? ["--watch", "--preserveWatchOutput"] : []
|
|
825
991
|
],
|
|
826
992
|
command: "tsgo",
|
|
827
|
-
label: `tsgo -b ${relativeConfigPath}`
|
|
993
|
+
label: `tsgo -b ${relativeConfigPath}${options.watch ? " --watch" : ""}`
|
|
828
994
|
};
|
|
829
995
|
}
|
|
830
996
|
function createVueTscCommandTarget(options) {
|
|
@@ -834,10 +1000,11 @@ function createVueTscCommandTarget(options) {
|
|
|
834
1000
|
"-b",
|
|
835
1001
|
relativeConfigPath,
|
|
836
1002
|
"--pretty",
|
|
837
|
-
"false"
|
|
1003
|
+
"false",
|
|
1004
|
+
...options.watch ? ["--watch", "--preserveWatchOutput"] : []
|
|
838
1005
|
],
|
|
839
1006
|
command: "vue-tsc",
|
|
840
|
-
label: `${options.checker.name}: vue-tsc -b ${relativeConfigPath}`
|
|
1007
|
+
label: `${options.checker.name}: vue-tsc -b ${relativeConfigPath}${options.watch ? " --watch" : ""}`
|
|
841
1008
|
};
|
|
842
1009
|
}
|
|
843
1010
|
function createVueTsgoCommandTarget(options) {
|
|
@@ -900,7 +1067,7 @@ const builtinCheckerAdapters = {
|
|
|
900
1067
|
createCommandTarget: createVueTscCommandTarget,
|
|
901
1068
|
extensions: (options) => resolveVueProjectExtensionsForChecker(options, "vue-tsc"),
|
|
902
1069
|
execution: "build",
|
|
903
|
-
packageNames: ["vue-tsc"
|
|
1070
|
+
packageNames: ["vue-tsc"],
|
|
904
1071
|
parseProjectConfig: (options) => parseVueProjectConfig(options, "vue-tsc"),
|
|
905
1072
|
preset: "vue-tsc",
|
|
906
1073
|
resolveModuleName: resolveTypeScriptModuleName,
|
|
@@ -962,7 +1129,8 @@ function formatMissingCheckerPeerDependencies(missingDependencies) {
|
|
|
962
1129
|
"Missing checker peer dependencies:",
|
|
963
1130
|
...missingDependencies.map((dependency) => {
|
|
964
1131
|
const checkerList = dependency.checkerNames.map((checkerName) => `"${checkerName}"`).join(", ");
|
|
965
|
-
|
|
1132
|
+
const reason = dependency.reason ? `; ${dependency.reason}` : "";
|
|
1133
|
+
return ` - ${dependency.packageName} (used by checker ${checkerList}${reason})`;
|
|
966
1134
|
}),
|
|
967
1135
|
`Fix: pnpm add -D ${packageNames.join(" ")}`
|
|
968
1136
|
].join("\n");
|
|
@@ -970,19 +1138,9 @@ function formatMissingCheckerPeerDependencies(missingDependencies) {
|
|
|
970
1138
|
function getCheckerExtensions(checker, options = {}) {
|
|
971
1139
|
const adapter = getCheckerAdapter(checker.preset);
|
|
972
1140
|
if (adapter) {
|
|
973
|
-
if (isVueCheckerPreset(checker.preset))
|
|
974
|
-
if (!options.projectRootDir) throw new Error([
|
|
975
|
-
"Unable to resolve Vue checker extensions:",
|
|
976
|
-
` preset: ${checker.preset}`,
|
|
977
|
-
" reason: Vue checker extensions must be read from the checker API and require a resolved project root."
|
|
978
|
-
].join("\n"));
|
|
979
|
-
return adapter.extensions({
|
|
980
|
-
configPath: normalizeAbsolutePath(posix.resolve(options.projectRootDir, checker.entry)),
|
|
981
|
-
projectRootDir: options.projectRootDir
|
|
982
|
-
});
|
|
983
|
-
}
|
|
1141
|
+
if (isVueCheckerPreset(checker.preset)) return normalizeExtensions([...getTypeScriptCheckerExtensions(), ".vue"]);
|
|
984
1142
|
return adapter.extensions({
|
|
985
|
-
configPath: normalizeAbsolutePath(posix.resolve(options.projectRootDir ?? "",
|
|
1143
|
+
configPath: normalizeAbsolutePath(posix.resolve(options.projectRootDir ?? "", "tsconfig.json")),
|
|
986
1144
|
projectRootDir: options.projectRootDir ?? ""
|
|
987
1145
|
});
|
|
988
1146
|
}
|
|
@@ -990,21 +1148,40 @@ function getCheckerExtensions(checker, options = {}) {
|
|
|
990
1148
|
}
|
|
991
1149
|
function getResolvedCheckers(config) {
|
|
992
1150
|
const checkers = config.config?.checkers;
|
|
993
|
-
if (!checkers) return [];
|
|
994
|
-
|
|
995
|
-
|
|
1151
|
+
if (!checkers || checkers.mode === "auto") return [];
|
|
1152
|
+
const checkerMap = checkers;
|
|
1153
|
+
return Object.entries(checkerMap).map(([name, checker]) => ({
|
|
1154
|
+
exclude: (checker.exclude ?? []).map((value) => value.trim()),
|
|
996
1155
|
extensions: getCheckerExtensions(checker, { projectRootDir: config.rootDir }),
|
|
1156
|
+
include: checker.include.map((value) => value.trim()),
|
|
997
1157
|
name,
|
|
998
1158
|
preset: checker.preset
|
|
999
1159
|
})).sort((left, right) => left.name.localeCompare(right.name));
|
|
1000
1160
|
}
|
|
1001
1161
|
function normalizeExtensions(extensions) {
|
|
1002
|
-
return
|
|
1162
|
+
return uniqueValues(extensions).sort((left, right) => {
|
|
1003
1163
|
const lengthDelta = right.length - left.length;
|
|
1004
1164
|
return lengthDelta === 0 ? left.localeCompare(right) : lengthDelta;
|
|
1005
1165
|
});
|
|
1006
1166
|
}
|
|
1007
1167
|
|
|
1168
|
+
//#endregion
|
|
1169
|
+
//#region src/utils/values.ts
|
|
1170
|
+
function isPlainRecord(value) {
|
|
1171
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1172
|
+
}
|
|
1173
|
+
function isNonEmptyString(value) {
|
|
1174
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
1175
|
+
}
|
|
1176
|
+
function formatUnknownValue(value) {
|
|
1177
|
+
if (value === void 0) return "undefined";
|
|
1178
|
+
try {
|
|
1179
|
+
return JSON.stringify(value) ?? String(value);
|
|
1180
|
+
} catch {
|
|
1181
|
+
return String(value);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1008
1185
|
//#endregion
|
|
1009
1186
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js
|
|
1010
1187
|
/** A special constant with type `never` */
|
|
@@ -1130,9 +1307,6 @@ function mergeDefs(...defs) {
|
|
|
1130
1307
|
function esc(str) {
|
|
1131
1308
|
return JSON.stringify(str);
|
|
1132
1309
|
}
|
|
1133
|
-
function slugify(input) {
|
|
1134
|
-
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1135
|
-
}
|
|
1136
1310
|
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
1137
1311
|
function isObject(data) {
|
|
1138
1312
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
@@ -1530,64 +1704,6 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
1530
1704
|
};
|
|
1531
1705
|
const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
1532
1706
|
|
|
1533
|
-
//#endregion
|
|
1534
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js
|
|
1535
|
-
const cuid = /^[cC][^\s-]{8,}$/;
|
|
1536
|
-
const cuid2 = /^[0-9a-z]+$/;
|
|
1537
|
-
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
1538
|
-
const xid = /^[0-9a-vA-V]{20}$/;
|
|
1539
|
-
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
1540
|
-
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
1541
|
-
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
1542
|
-
const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
1543
|
-
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
1544
|
-
const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
1545
|
-
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
1546
|
-
*
|
|
1547
|
-
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
1548
|
-
const uuid = (version) => {
|
|
1549
|
-
if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
1550
|
-
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
1551
|
-
};
|
|
1552
|
-
/** Practical email validation */
|
|
1553
|
-
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
1554
|
-
const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
1555
|
-
function emoji() {
|
|
1556
|
-
return new RegExp(_emoji$1, "u");
|
|
1557
|
-
}
|
|
1558
|
-
const ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
1559
|
-
const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
1560
|
-
const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
1561
|
-
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
1562
|
-
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
1563
|
-
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
1564
|
-
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
1565
|
-
const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
1566
|
-
const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
1567
|
-
function timeSource(args) {
|
|
1568
|
-
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
1569
|
-
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
1570
|
-
}
|
|
1571
|
-
function time$1(args) {
|
|
1572
|
-
return new RegExp(`^${timeSource(args)}$`);
|
|
1573
|
-
}
|
|
1574
|
-
function datetime$1(args) {
|
|
1575
|
-
const time = timeSource({ precision: args.precision });
|
|
1576
|
-
const opts = ["Z"];
|
|
1577
|
-
if (args.local) opts.push("");
|
|
1578
|
-
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
1579
|
-
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
1580
|
-
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
1581
|
-
}
|
|
1582
|
-
const string$1 = (params) => {
|
|
1583
|
-
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
1584
|
-
return new RegExp(`^${regex}$`);
|
|
1585
|
-
};
|
|
1586
|
-
const number = /^-?\d+(?:\.\d+)?$/;
|
|
1587
|
-
const boolean$1 = /^(?:true|false)$/i;
|
|
1588
|
-
const lowercase = /^[^A-Z]*$/;
|
|
1589
|
-
const uppercase = /^[^a-z]*$/;
|
|
1590
|
-
|
|
1591
1707
|
//#endregion
|
|
1592
1708
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
|
|
1593
1709
|
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
@@ -1684,123 +1800,6 @@ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEqual
|
|
|
1684
1800
|
});
|
|
1685
1801
|
};
|
|
1686
1802
|
});
|
|
1687
|
-
const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
1688
|
-
var _a, _b;
|
|
1689
|
-
$ZodCheck.init(inst, def);
|
|
1690
|
-
inst._zod.onattach.push((inst) => {
|
|
1691
|
-
const bag = inst._zod.bag;
|
|
1692
|
-
bag.format = def.format;
|
|
1693
|
-
if (def.pattern) {
|
|
1694
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1695
|
-
bag.patterns.add(def.pattern);
|
|
1696
|
-
}
|
|
1697
|
-
});
|
|
1698
|
-
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
1699
|
-
def.pattern.lastIndex = 0;
|
|
1700
|
-
if (def.pattern.test(payload.value)) return;
|
|
1701
|
-
payload.issues.push({
|
|
1702
|
-
origin: "string",
|
|
1703
|
-
code: "invalid_format",
|
|
1704
|
-
format: def.format,
|
|
1705
|
-
input: payload.value,
|
|
1706
|
-
...def.pattern ? { pattern: def.pattern.toString() } : {},
|
|
1707
|
-
inst,
|
|
1708
|
-
continue: !def.abort
|
|
1709
|
-
});
|
|
1710
|
-
});
|
|
1711
|
-
else (_b = inst._zod).check ?? (_b.check = () => {});
|
|
1712
|
-
});
|
|
1713
|
-
const $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
1714
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
1715
|
-
inst._zod.check = (payload) => {
|
|
1716
|
-
def.pattern.lastIndex = 0;
|
|
1717
|
-
if (def.pattern.test(payload.value)) return;
|
|
1718
|
-
payload.issues.push({
|
|
1719
|
-
origin: "string",
|
|
1720
|
-
code: "invalid_format",
|
|
1721
|
-
format: "regex",
|
|
1722
|
-
input: payload.value,
|
|
1723
|
-
pattern: def.pattern.toString(),
|
|
1724
|
-
inst,
|
|
1725
|
-
continue: !def.abort
|
|
1726
|
-
});
|
|
1727
|
-
};
|
|
1728
|
-
});
|
|
1729
|
-
const $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
1730
|
-
def.pattern ?? (def.pattern = lowercase);
|
|
1731
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
1732
|
-
});
|
|
1733
|
-
const $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
1734
|
-
def.pattern ?? (def.pattern = uppercase);
|
|
1735
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
1736
|
-
});
|
|
1737
|
-
const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
1738
|
-
$ZodCheck.init(inst, def);
|
|
1739
|
-
const escapedRegex = escapeRegex(def.includes);
|
|
1740
|
-
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
1741
|
-
def.pattern = pattern;
|
|
1742
|
-
inst._zod.onattach.push((inst) => {
|
|
1743
|
-
const bag = inst._zod.bag;
|
|
1744
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1745
|
-
bag.patterns.add(pattern);
|
|
1746
|
-
});
|
|
1747
|
-
inst._zod.check = (payload) => {
|
|
1748
|
-
if (payload.value.includes(def.includes, def.position)) return;
|
|
1749
|
-
payload.issues.push({
|
|
1750
|
-
origin: "string",
|
|
1751
|
-
code: "invalid_format",
|
|
1752
|
-
format: "includes",
|
|
1753
|
-
includes: def.includes,
|
|
1754
|
-
input: payload.value,
|
|
1755
|
-
inst,
|
|
1756
|
-
continue: !def.abort
|
|
1757
|
-
});
|
|
1758
|
-
};
|
|
1759
|
-
});
|
|
1760
|
-
const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
1761
|
-
$ZodCheck.init(inst, def);
|
|
1762
|
-
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
1763
|
-
def.pattern ?? (def.pattern = pattern);
|
|
1764
|
-
inst._zod.onattach.push((inst) => {
|
|
1765
|
-
const bag = inst._zod.bag;
|
|
1766
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1767
|
-
bag.patterns.add(pattern);
|
|
1768
|
-
});
|
|
1769
|
-
inst._zod.check = (payload) => {
|
|
1770
|
-
if (payload.value.startsWith(def.prefix)) return;
|
|
1771
|
-
payload.issues.push({
|
|
1772
|
-
origin: "string",
|
|
1773
|
-
code: "invalid_format",
|
|
1774
|
-
format: "starts_with",
|
|
1775
|
-
prefix: def.prefix,
|
|
1776
|
-
input: payload.value,
|
|
1777
|
-
inst,
|
|
1778
|
-
continue: !def.abort
|
|
1779
|
-
});
|
|
1780
|
-
};
|
|
1781
|
-
});
|
|
1782
|
-
const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
1783
|
-
$ZodCheck.init(inst, def);
|
|
1784
|
-
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
1785
|
-
def.pattern ?? (def.pattern = pattern);
|
|
1786
|
-
inst._zod.onattach.push((inst) => {
|
|
1787
|
-
const bag = inst._zod.bag;
|
|
1788
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1789
|
-
bag.patterns.add(pattern);
|
|
1790
|
-
});
|
|
1791
|
-
inst._zod.check = (payload) => {
|
|
1792
|
-
if (payload.value.endsWith(def.suffix)) return;
|
|
1793
|
-
payload.issues.push({
|
|
1794
|
-
origin: "string",
|
|
1795
|
-
code: "invalid_format",
|
|
1796
|
-
format: "ends_with",
|
|
1797
|
-
suffix: def.suffix,
|
|
1798
|
-
input: payload.value,
|
|
1799
|
-
inst,
|
|
1800
|
-
continue: !def.abort
|
|
1801
|
-
});
|
|
1802
|
-
};
|
|
1803
|
-
});
|
|
1804
1803
|
const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
1805
1804
|
$ZodCheck.init(inst, def);
|
|
1806
1805
|
inst._zod.check = (payload) => {
|
|
@@ -1938,16 +1937,15 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1938
1937
|
version: 1
|
|
1939
1938
|
}));
|
|
1940
1939
|
});
|
|
1941
|
-
const $
|
|
1940
|
+
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
1942
1941
|
$ZodType.init(inst, def);
|
|
1943
|
-
inst._zod.
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
if (typeof payload.value === "string") return payload;
|
|
1942
|
+
inst._zod.parse = (payload) => payload;
|
|
1943
|
+
});
|
|
1944
|
+
const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
1945
|
+
$ZodType.init(inst, def);
|
|
1946
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1949
1947
|
payload.issues.push({
|
|
1950
|
-
expected: "
|
|
1948
|
+
expected: "never",
|
|
1951
1949
|
code: "invalid_type",
|
|
1952
1950
|
input: payload.value,
|
|
1953
1951
|
inst
|
|
@@ -1955,294 +1953,15 @@ const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
|
1955
1953
|
return payload;
|
|
1956
1954
|
};
|
|
1957
1955
|
});
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
}
|
|
1962
|
-
const $
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
if (def.version) {
|
|
1968
|
-
const v = {
|
|
1969
|
-
v1: 1,
|
|
1970
|
-
v2: 2,
|
|
1971
|
-
v3: 3,
|
|
1972
|
-
v4: 4,
|
|
1973
|
-
v5: 5,
|
|
1974
|
-
v6: 6,
|
|
1975
|
-
v7: 7,
|
|
1976
|
-
v8: 8
|
|
1977
|
-
}[def.version];
|
|
1978
|
-
if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
1979
|
-
def.pattern ?? (def.pattern = uuid(v));
|
|
1980
|
-
} else def.pattern ?? (def.pattern = uuid());
|
|
1981
|
-
$ZodStringFormat.init(inst, def);
|
|
1982
|
-
});
|
|
1983
|
-
const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
1984
|
-
def.pattern ?? (def.pattern = email);
|
|
1985
|
-
$ZodStringFormat.init(inst, def);
|
|
1986
|
-
});
|
|
1987
|
-
const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
1988
|
-
$ZodStringFormat.init(inst, def);
|
|
1989
|
-
inst._zod.check = (payload) => {
|
|
1990
|
-
try {
|
|
1991
|
-
const trimmed = payload.value.trim();
|
|
1992
|
-
const url = new URL(trimmed);
|
|
1993
|
-
if (def.hostname) {
|
|
1994
|
-
def.hostname.lastIndex = 0;
|
|
1995
|
-
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
1996
|
-
code: "invalid_format",
|
|
1997
|
-
format: "url",
|
|
1998
|
-
note: "Invalid hostname",
|
|
1999
|
-
pattern: def.hostname.source,
|
|
2000
|
-
input: payload.value,
|
|
2001
|
-
inst,
|
|
2002
|
-
continue: !def.abort
|
|
2003
|
-
});
|
|
2004
|
-
}
|
|
2005
|
-
if (def.protocol) {
|
|
2006
|
-
def.protocol.lastIndex = 0;
|
|
2007
|
-
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
2008
|
-
code: "invalid_format",
|
|
2009
|
-
format: "url",
|
|
2010
|
-
note: "Invalid protocol",
|
|
2011
|
-
pattern: def.protocol.source,
|
|
2012
|
-
input: payload.value,
|
|
2013
|
-
inst,
|
|
2014
|
-
continue: !def.abort
|
|
2015
|
-
});
|
|
2016
|
-
}
|
|
2017
|
-
if (def.normalize) payload.value = url.href;
|
|
2018
|
-
else payload.value = trimmed;
|
|
2019
|
-
return;
|
|
2020
|
-
} catch (_) {
|
|
2021
|
-
payload.issues.push({
|
|
2022
|
-
code: "invalid_format",
|
|
2023
|
-
format: "url",
|
|
2024
|
-
input: payload.value,
|
|
2025
|
-
inst,
|
|
2026
|
-
continue: !def.abort
|
|
2027
|
-
});
|
|
2028
|
-
}
|
|
2029
|
-
};
|
|
2030
|
-
});
|
|
2031
|
-
const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
|
|
2032
|
-
def.pattern ?? (def.pattern = emoji());
|
|
2033
|
-
$ZodStringFormat.init(inst, def);
|
|
2034
|
-
});
|
|
2035
|
-
const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
|
|
2036
|
-
def.pattern ?? (def.pattern = nanoid);
|
|
2037
|
-
$ZodStringFormat.init(inst, def);
|
|
2038
|
-
});
|
|
2039
|
-
const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
|
|
2040
|
-
def.pattern ?? (def.pattern = cuid);
|
|
2041
|
-
$ZodStringFormat.init(inst, def);
|
|
2042
|
-
});
|
|
2043
|
-
const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
|
|
2044
|
-
def.pattern ?? (def.pattern = cuid2);
|
|
2045
|
-
$ZodStringFormat.init(inst, def);
|
|
2046
|
-
});
|
|
2047
|
-
const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
|
|
2048
|
-
def.pattern ?? (def.pattern = ulid);
|
|
2049
|
-
$ZodStringFormat.init(inst, def);
|
|
2050
|
-
});
|
|
2051
|
-
const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
|
|
2052
|
-
def.pattern ?? (def.pattern = xid);
|
|
2053
|
-
$ZodStringFormat.init(inst, def);
|
|
2054
|
-
});
|
|
2055
|
-
const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
|
|
2056
|
-
def.pattern ?? (def.pattern = ksuid);
|
|
2057
|
-
$ZodStringFormat.init(inst, def);
|
|
2058
|
-
});
|
|
2059
|
-
const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
|
|
2060
|
-
def.pattern ?? (def.pattern = datetime$1(def));
|
|
2061
|
-
$ZodStringFormat.init(inst, def);
|
|
2062
|
-
});
|
|
2063
|
-
const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
|
|
2064
|
-
def.pattern ?? (def.pattern = date$1);
|
|
2065
|
-
$ZodStringFormat.init(inst, def);
|
|
2066
|
-
});
|
|
2067
|
-
const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
|
|
2068
|
-
def.pattern ?? (def.pattern = time$1(def));
|
|
2069
|
-
$ZodStringFormat.init(inst, def);
|
|
2070
|
-
});
|
|
2071
|
-
const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
|
|
2072
|
-
def.pattern ?? (def.pattern = duration$1);
|
|
2073
|
-
$ZodStringFormat.init(inst, def);
|
|
2074
|
-
});
|
|
2075
|
-
const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
2076
|
-
def.pattern ?? (def.pattern = ipv4);
|
|
2077
|
-
$ZodStringFormat.init(inst, def);
|
|
2078
|
-
inst._zod.bag.format = `ipv4`;
|
|
2079
|
-
});
|
|
2080
|
-
const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
2081
|
-
def.pattern ?? (def.pattern = ipv6);
|
|
2082
|
-
$ZodStringFormat.init(inst, def);
|
|
2083
|
-
inst._zod.bag.format = `ipv6`;
|
|
2084
|
-
inst._zod.check = (payload) => {
|
|
2085
|
-
try {
|
|
2086
|
-
new URL(`http://[${payload.value}]`);
|
|
2087
|
-
} catch {
|
|
2088
|
-
payload.issues.push({
|
|
2089
|
-
code: "invalid_format",
|
|
2090
|
-
format: "ipv6",
|
|
2091
|
-
input: payload.value,
|
|
2092
|
-
inst,
|
|
2093
|
-
continue: !def.abort
|
|
2094
|
-
});
|
|
2095
|
-
}
|
|
2096
|
-
};
|
|
2097
|
-
});
|
|
2098
|
-
const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
2099
|
-
def.pattern ?? (def.pattern = cidrv4);
|
|
2100
|
-
$ZodStringFormat.init(inst, def);
|
|
2101
|
-
});
|
|
2102
|
-
const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
2103
|
-
def.pattern ?? (def.pattern = cidrv6);
|
|
2104
|
-
$ZodStringFormat.init(inst, def);
|
|
2105
|
-
inst._zod.check = (payload) => {
|
|
2106
|
-
const parts = payload.value.split("/");
|
|
2107
|
-
try {
|
|
2108
|
-
if (parts.length !== 2) throw new Error();
|
|
2109
|
-
const [address, prefix] = parts;
|
|
2110
|
-
if (!prefix) throw new Error();
|
|
2111
|
-
const prefixNum = Number(prefix);
|
|
2112
|
-
if (`${prefixNum}` !== prefix) throw new Error();
|
|
2113
|
-
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
2114
|
-
new URL(`http://[${address}]`);
|
|
2115
|
-
} catch {
|
|
2116
|
-
payload.issues.push({
|
|
2117
|
-
code: "invalid_format",
|
|
2118
|
-
format: "cidrv6",
|
|
2119
|
-
input: payload.value,
|
|
2120
|
-
inst,
|
|
2121
|
-
continue: !def.abort
|
|
2122
|
-
});
|
|
2123
|
-
}
|
|
2124
|
-
};
|
|
2125
|
-
});
|
|
2126
|
-
function isValidBase64(data) {
|
|
2127
|
-
if (data === "") return true;
|
|
2128
|
-
if (data.length % 4 !== 0) return false;
|
|
2129
|
-
try {
|
|
2130
|
-
atob(data);
|
|
2131
|
-
return true;
|
|
2132
|
-
} catch {
|
|
2133
|
-
return false;
|
|
2134
|
-
}
|
|
2135
|
-
}
|
|
2136
|
-
const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
2137
|
-
def.pattern ?? (def.pattern = base64);
|
|
2138
|
-
$ZodStringFormat.init(inst, def);
|
|
2139
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
2140
|
-
inst._zod.check = (payload) => {
|
|
2141
|
-
if (isValidBase64(payload.value)) return;
|
|
2142
|
-
payload.issues.push({
|
|
2143
|
-
code: "invalid_format",
|
|
2144
|
-
format: "base64",
|
|
2145
|
-
input: payload.value,
|
|
2146
|
-
inst,
|
|
2147
|
-
continue: !def.abort
|
|
2148
|
-
});
|
|
2149
|
-
};
|
|
2150
|
-
});
|
|
2151
|
-
function isValidBase64URL(data) {
|
|
2152
|
-
if (!base64url.test(data)) return false;
|
|
2153
|
-
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
2154
|
-
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
2155
|
-
}
|
|
2156
|
-
const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
2157
|
-
def.pattern ?? (def.pattern = base64url);
|
|
2158
|
-
$ZodStringFormat.init(inst, def);
|
|
2159
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
2160
|
-
inst._zod.check = (payload) => {
|
|
2161
|
-
if (isValidBase64URL(payload.value)) return;
|
|
2162
|
-
payload.issues.push({
|
|
2163
|
-
code: "invalid_format",
|
|
2164
|
-
format: "base64url",
|
|
2165
|
-
input: payload.value,
|
|
2166
|
-
inst,
|
|
2167
|
-
continue: !def.abort
|
|
2168
|
-
});
|
|
2169
|
-
};
|
|
2170
|
-
});
|
|
2171
|
-
const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
|
|
2172
|
-
def.pattern ?? (def.pattern = e164);
|
|
2173
|
-
$ZodStringFormat.init(inst, def);
|
|
2174
|
-
});
|
|
2175
|
-
function isValidJWT(token, algorithm = null) {
|
|
2176
|
-
try {
|
|
2177
|
-
const tokensParts = token.split(".");
|
|
2178
|
-
if (tokensParts.length !== 3) return false;
|
|
2179
|
-
const [header] = tokensParts;
|
|
2180
|
-
if (!header) return false;
|
|
2181
|
-
const parsedHeader = JSON.parse(atob(header));
|
|
2182
|
-
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
|
|
2183
|
-
if (!parsedHeader.alg) return false;
|
|
2184
|
-
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
|
|
2185
|
-
return true;
|
|
2186
|
-
} catch {
|
|
2187
|
-
return false;
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
2191
|
-
$ZodStringFormat.init(inst, def);
|
|
2192
|
-
inst._zod.check = (payload) => {
|
|
2193
|
-
if (isValidJWT(payload.value, def.alg)) return;
|
|
2194
|
-
payload.issues.push({
|
|
2195
|
-
code: "invalid_format",
|
|
2196
|
-
format: "jwt",
|
|
2197
|
-
input: payload.value,
|
|
2198
|
-
inst,
|
|
2199
|
-
continue: !def.abort
|
|
2200
|
-
});
|
|
2201
|
-
};
|
|
2202
|
-
});
|
|
2203
|
-
const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
2204
|
-
$ZodType.init(inst, def);
|
|
2205
|
-
inst._zod.pattern = boolean$1;
|
|
2206
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
2207
|
-
if (def.coerce) try {
|
|
2208
|
-
payload.value = Boolean(payload.value);
|
|
2209
|
-
} catch (_) {}
|
|
2210
|
-
const input = payload.value;
|
|
2211
|
-
if (typeof input === "boolean") return payload;
|
|
2212
|
-
payload.issues.push({
|
|
2213
|
-
expected: "boolean",
|
|
2214
|
-
code: "invalid_type",
|
|
2215
|
-
input,
|
|
2216
|
-
inst
|
|
2217
|
-
});
|
|
2218
|
-
return payload;
|
|
2219
|
-
};
|
|
2220
|
-
});
|
|
2221
|
-
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
2222
|
-
$ZodType.init(inst, def);
|
|
2223
|
-
inst._zod.parse = (payload) => payload;
|
|
2224
|
-
});
|
|
2225
|
-
const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
2226
|
-
$ZodType.init(inst, def);
|
|
2227
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
2228
|
-
payload.issues.push({
|
|
2229
|
-
expected: "never",
|
|
2230
|
-
code: "invalid_type",
|
|
2231
|
-
input: payload.value,
|
|
2232
|
-
inst
|
|
2233
|
-
});
|
|
2234
|
-
return payload;
|
|
2235
|
-
};
|
|
2236
|
-
});
|
|
2237
|
-
function handleArrayResult(result, final, index) {
|
|
2238
|
-
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
2239
|
-
final.value[index] = result.value;
|
|
2240
|
-
}
|
|
2241
|
-
const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
2242
|
-
$ZodType.init(inst, def);
|
|
2243
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2244
|
-
const input = payload.value;
|
|
2245
|
-
if (!Array.isArray(input)) {
|
|
1956
|
+
function handleArrayResult(result, final, index) {
|
|
1957
|
+
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
1958
|
+
final.value[index] = result.value;
|
|
1959
|
+
}
|
|
1960
|
+
const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
1961
|
+
$ZodType.init(inst, def);
|
|
1962
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1963
|
+
const input = payload.value;
|
|
1964
|
+
if (!Array.isArray(input)) {
|
|
2246
1965
|
payload.issues.push({
|
|
2247
1966
|
expected: "array",
|
|
2248
1967
|
code: "invalid_type",
|
|
@@ -2622,97 +2341,6 @@ function handleIntersectionResults(result, left, right) {
|
|
|
2622
2341
|
result.value = merged.data;
|
|
2623
2342
|
return result;
|
|
2624
2343
|
}
|
|
2625
|
-
const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
2626
|
-
$ZodType.init(inst, def);
|
|
2627
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2628
|
-
const input = payload.value;
|
|
2629
|
-
if (!isPlainObject(input)) {
|
|
2630
|
-
payload.issues.push({
|
|
2631
|
-
expected: "record",
|
|
2632
|
-
code: "invalid_type",
|
|
2633
|
-
input,
|
|
2634
|
-
inst
|
|
2635
|
-
});
|
|
2636
|
-
return payload;
|
|
2637
|
-
}
|
|
2638
|
-
const proms = [];
|
|
2639
|
-
const values = def.keyType._zod.values;
|
|
2640
|
-
if (values) {
|
|
2641
|
-
payload.value = {};
|
|
2642
|
-
const recordKeys = /* @__PURE__ */ new Set();
|
|
2643
|
-
for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
2644
|
-
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
2645
|
-
const result = def.valueType._zod.run({
|
|
2646
|
-
value: input[key],
|
|
2647
|
-
issues: []
|
|
2648
|
-
}, ctx);
|
|
2649
|
-
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
2650
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
2651
|
-
payload.value[key] = result.value;
|
|
2652
|
-
}));
|
|
2653
|
-
else {
|
|
2654
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
2655
|
-
payload.value[key] = result.value;
|
|
2656
|
-
}
|
|
2657
|
-
}
|
|
2658
|
-
let unrecognized;
|
|
2659
|
-
for (const key in input) if (!recordKeys.has(key)) {
|
|
2660
|
-
unrecognized = unrecognized ?? [];
|
|
2661
|
-
unrecognized.push(key);
|
|
2662
|
-
}
|
|
2663
|
-
if (unrecognized && unrecognized.length > 0) payload.issues.push({
|
|
2664
|
-
code: "unrecognized_keys",
|
|
2665
|
-
input,
|
|
2666
|
-
inst,
|
|
2667
|
-
keys: unrecognized
|
|
2668
|
-
});
|
|
2669
|
-
} else {
|
|
2670
|
-
payload.value = {};
|
|
2671
|
-
for (const key of Reflect.ownKeys(input)) {
|
|
2672
|
-
if (key === "__proto__") continue;
|
|
2673
|
-
let keyResult = def.keyType._zod.run({
|
|
2674
|
-
value: key,
|
|
2675
|
-
issues: []
|
|
2676
|
-
}, ctx);
|
|
2677
|
-
if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
2678
|
-
if (typeof key === "string" && number.test(key) && keyResult.issues.length) {
|
|
2679
|
-
const retryResult = def.keyType._zod.run({
|
|
2680
|
-
value: Number(key),
|
|
2681
|
-
issues: []
|
|
2682
|
-
}, ctx);
|
|
2683
|
-
if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
2684
|
-
if (retryResult.issues.length === 0) keyResult = retryResult;
|
|
2685
|
-
}
|
|
2686
|
-
if (keyResult.issues.length) {
|
|
2687
|
-
if (def.mode === "loose") payload.value[key] = input[key];
|
|
2688
|
-
else payload.issues.push({
|
|
2689
|
-
code: "invalid_key",
|
|
2690
|
-
origin: "record",
|
|
2691
|
-
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
2692
|
-
input: key,
|
|
2693
|
-
path: [key],
|
|
2694
|
-
inst
|
|
2695
|
-
});
|
|
2696
|
-
continue;
|
|
2697
|
-
}
|
|
2698
|
-
const result = def.valueType._zod.run({
|
|
2699
|
-
value: input[key],
|
|
2700
|
-
issues: []
|
|
2701
|
-
}, ctx);
|
|
2702
|
-
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
2703
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
2704
|
-
payload.value[keyResult.value] = result.value;
|
|
2705
|
-
}));
|
|
2706
|
-
else {
|
|
2707
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
2708
|
-
payload.value[keyResult.value] = result.value;
|
|
2709
|
-
}
|
|
2710
|
-
}
|
|
2711
|
-
}
|
|
2712
|
-
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
2713
|
-
return payload;
|
|
2714
|
-
};
|
|
2715
|
-
});
|
|
2716
2344
|
const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
2717
2345
|
$ZodType.init(inst, def);
|
|
2718
2346
|
const values = getEnumValues(def.entries);
|
|
@@ -2992,294 +2620,17 @@ var $ZodRegistry = class {
|
|
|
2992
2620
|
return this._map.get(schema);
|
|
2993
2621
|
}
|
|
2994
2622
|
has(schema) {
|
|
2995
|
-
return this._map.has(schema);
|
|
2996
|
-
}
|
|
2997
|
-
};
|
|
2998
|
-
function registry() {
|
|
2999
|
-
return new $ZodRegistry();
|
|
3000
|
-
}
|
|
3001
|
-
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
3002
|
-
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
3003
|
-
|
|
3004
|
-
//#endregion
|
|
3005
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
|
|
3006
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3007
|
-
function _string(Class, params) {
|
|
3008
|
-
return new Class({
|
|
3009
|
-
type: "string",
|
|
3010
|
-
...normalizeParams(params)
|
|
3011
|
-
});
|
|
3012
|
-
}
|
|
3013
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3014
|
-
function _email(Class, params) {
|
|
3015
|
-
return new Class({
|
|
3016
|
-
type: "string",
|
|
3017
|
-
format: "email",
|
|
3018
|
-
check: "string_format",
|
|
3019
|
-
abort: false,
|
|
3020
|
-
...normalizeParams(params)
|
|
3021
|
-
});
|
|
3022
|
-
}
|
|
3023
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3024
|
-
function _guid(Class, params) {
|
|
3025
|
-
return new Class({
|
|
3026
|
-
type: "string",
|
|
3027
|
-
format: "guid",
|
|
3028
|
-
check: "string_format",
|
|
3029
|
-
abort: false,
|
|
3030
|
-
...normalizeParams(params)
|
|
3031
|
-
});
|
|
3032
|
-
}
|
|
3033
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3034
|
-
function _uuid(Class, params) {
|
|
3035
|
-
return new Class({
|
|
3036
|
-
type: "string",
|
|
3037
|
-
format: "uuid",
|
|
3038
|
-
check: "string_format",
|
|
3039
|
-
abort: false,
|
|
3040
|
-
...normalizeParams(params)
|
|
3041
|
-
});
|
|
3042
|
-
}
|
|
3043
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3044
|
-
function _uuidv4(Class, params) {
|
|
3045
|
-
return new Class({
|
|
3046
|
-
type: "string",
|
|
3047
|
-
format: "uuid",
|
|
3048
|
-
check: "string_format",
|
|
3049
|
-
abort: false,
|
|
3050
|
-
version: "v4",
|
|
3051
|
-
...normalizeParams(params)
|
|
3052
|
-
});
|
|
3053
|
-
}
|
|
3054
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3055
|
-
function _uuidv6(Class, params) {
|
|
3056
|
-
return new Class({
|
|
3057
|
-
type: "string",
|
|
3058
|
-
format: "uuid",
|
|
3059
|
-
check: "string_format",
|
|
3060
|
-
abort: false,
|
|
3061
|
-
version: "v6",
|
|
3062
|
-
...normalizeParams(params)
|
|
3063
|
-
});
|
|
3064
|
-
}
|
|
3065
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3066
|
-
function _uuidv7(Class, params) {
|
|
3067
|
-
return new Class({
|
|
3068
|
-
type: "string",
|
|
3069
|
-
format: "uuid",
|
|
3070
|
-
check: "string_format",
|
|
3071
|
-
abort: false,
|
|
3072
|
-
version: "v7",
|
|
3073
|
-
...normalizeParams(params)
|
|
3074
|
-
});
|
|
3075
|
-
}
|
|
3076
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3077
|
-
function _url(Class, params) {
|
|
3078
|
-
return new Class({
|
|
3079
|
-
type: "string",
|
|
3080
|
-
format: "url",
|
|
3081
|
-
check: "string_format",
|
|
3082
|
-
abort: false,
|
|
3083
|
-
...normalizeParams(params)
|
|
3084
|
-
});
|
|
3085
|
-
}
|
|
3086
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3087
|
-
function _emoji(Class, params) {
|
|
3088
|
-
return new Class({
|
|
3089
|
-
type: "string",
|
|
3090
|
-
format: "emoji",
|
|
3091
|
-
check: "string_format",
|
|
3092
|
-
abort: false,
|
|
3093
|
-
...normalizeParams(params)
|
|
3094
|
-
});
|
|
3095
|
-
}
|
|
3096
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3097
|
-
function _nanoid(Class, params) {
|
|
3098
|
-
return new Class({
|
|
3099
|
-
type: "string",
|
|
3100
|
-
format: "nanoid",
|
|
3101
|
-
check: "string_format",
|
|
3102
|
-
abort: false,
|
|
3103
|
-
...normalizeParams(params)
|
|
3104
|
-
});
|
|
3105
|
-
}
|
|
3106
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3107
|
-
function _cuid(Class, params) {
|
|
3108
|
-
return new Class({
|
|
3109
|
-
type: "string",
|
|
3110
|
-
format: "cuid",
|
|
3111
|
-
check: "string_format",
|
|
3112
|
-
abort: false,
|
|
3113
|
-
...normalizeParams(params)
|
|
3114
|
-
});
|
|
3115
|
-
}
|
|
3116
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3117
|
-
function _cuid2(Class, params) {
|
|
3118
|
-
return new Class({
|
|
3119
|
-
type: "string",
|
|
3120
|
-
format: "cuid2",
|
|
3121
|
-
check: "string_format",
|
|
3122
|
-
abort: false,
|
|
3123
|
-
...normalizeParams(params)
|
|
3124
|
-
});
|
|
3125
|
-
}
|
|
3126
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3127
|
-
function _ulid(Class, params) {
|
|
3128
|
-
return new Class({
|
|
3129
|
-
type: "string",
|
|
3130
|
-
format: "ulid",
|
|
3131
|
-
check: "string_format",
|
|
3132
|
-
abort: false,
|
|
3133
|
-
...normalizeParams(params)
|
|
3134
|
-
});
|
|
3135
|
-
}
|
|
3136
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3137
|
-
function _xid(Class, params) {
|
|
3138
|
-
return new Class({
|
|
3139
|
-
type: "string",
|
|
3140
|
-
format: "xid",
|
|
3141
|
-
check: "string_format",
|
|
3142
|
-
abort: false,
|
|
3143
|
-
...normalizeParams(params)
|
|
3144
|
-
});
|
|
3145
|
-
}
|
|
3146
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3147
|
-
function _ksuid(Class, params) {
|
|
3148
|
-
return new Class({
|
|
3149
|
-
type: "string",
|
|
3150
|
-
format: "ksuid",
|
|
3151
|
-
check: "string_format",
|
|
3152
|
-
abort: false,
|
|
3153
|
-
...normalizeParams(params)
|
|
3154
|
-
});
|
|
3155
|
-
}
|
|
3156
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3157
|
-
function _ipv4(Class, params) {
|
|
3158
|
-
return new Class({
|
|
3159
|
-
type: "string",
|
|
3160
|
-
format: "ipv4",
|
|
3161
|
-
check: "string_format",
|
|
3162
|
-
abort: false,
|
|
3163
|
-
...normalizeParams(params)
|
|
3164
|
-
});
|
|
3165
|
-
}
|
|
3166
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3167
|
-
function _ipv6(Class, params) {
|
|
3168
|
-
return new Class({
|
|
3169
|
-
type: "string",
|
|
3170
|
-
format: "ipv6",
|
|
3171
|
-
check: "string_format",
|
|
3172
|
-
abort: false,
|
|
3173
|
-
...normalizeParams(params)
|
|
3174
|
-
});
|
|
3175
|
-
}
|
|
3176
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3177
|
-
function _cidrv4(Class, params) {
|
|
3178
|
-
return new Class({
|
|
3179
|
-
type: "string",
|
|
3180
|
-
format: "cidrv4",
|
|
3181
|
-
check: "string_format",
|
|
3182
|
-
abort: false,
|
|
3183
|
-
...normalizeParams(params)
|
|
3184
|
-
});
|
|
3185
|
-
}
|
|
3186
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3187
|
-
function _cidrv6(Class, params) {
|
|
3188
|
-
return new Class({
|
|
3189
|
-
type: "string",
|
|
3190
|
-
format: "cidrv6",
|
|
3191
|
-
check: "string_format",
|
|
3192
|
-
abort: false,
|
|
3193
|
-
...normalizeParams(params)
|
|
3194
|
-
});
|
|
3195
|
-
}
|
|
3196
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3197
|
-
function _base64(Class, params) {
|
|
3198
|
-
return new Class({
|
|
3199
|
-
type: "string",
|
|
3200
|
-
format: "base64",
|
|
3201
|
-
check: "string_format",
|
|
3202
|
-
abort: false,
|
|
3203
|
-
...normalizeParams(params)
|
|
3204
|
-
});
|
|
3205
|
-
}
|
|
3206
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3207
|
-
function _base64url(Class, params) {
|
|
3208
|
-
return new Class({
|
|
3209
|
-
type: "string",
|
|
3210
|
-
format: "base64url",
|
|
3211
|
-
check: "string_format",
|
|
3212
|
-
abort: false,
|
|
3213
|
-
...normalizeParams(params)
|
|
3214
|
-
});
|
|
3215
|
-
}
|
|
3216
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3217
|
-
function _e164(Class, params) {
|
|
3218
|
-
return new Class({
|
|
3219
|
-
type: "string",
|
|
3220
|
-
format: "e164",
|
|
3221
|
-
check: "string_format",
|
|
3222
|
-
abort: false,
|
|
3223
|
-
...normalizeParams(params)
|
|
3224
|
-
});
|
|
3225
|
-
}
|
|
3226
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3227
|
-
function _jwt(Class, params) {
|
|
3228
|
-
return new Class({
|
|
3229
|
-
type: "string",
|
|
3230
|
-
format: "jwt",
|
|
3231
|
-
check: "string_format",
|
|
3232
|
-
abort: false,
|
|
3233
|
-
...normalizeParams(params)
|
|
3234
|
-
});
|
|
3235
|
-
}
|
|
3236
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3237
|
-
function _isoDateTime(Class, params) {
|
|
3238
|
-
return new Class({
|
|
3239
|
-
type: "string",
|
|
3240
|
-
format: "datetime",
|
|
3241
|
-
check: "string_format",
|
|
3242
|
-
offset: false,
|
|
3243
|
-
local: false,
|
|
3244
|
-
precision: null,
|
|
3245
|
-
...normalizeParams(params)
|
|
3246
|
-
});
|
|
3247
|
-
}
|
|
3248
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3249
|
-
function _isoDate(Class, params) {
|
|
3250
|
-
return new Class({
|
|
3251
|
-
type: "string",
|
|
3252
|
-
format: "date",
|
|
3253
|
-
check: "string_format",
|
|
3254
|
-
...normalizeParams(params)
|
|
3255
|
-
});
|
|
3256
|
-
}
|
|
3257
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3258
|
-
function _isoTime(Class, params) {
|
|
3259
|
-
return new Class({
|
|
3260
|
-
type: "string",
|
|
3261
|
-
format: "time",
|
|
3262
|
-
check: "string_format",
|
|
3263
|
-
precision: null,
|
|
3264
|
-
...normalizeParams(params)
|
|
3265
|
-
});
|
|
3266
|
-
}
|
|
3267
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3268
|
-
function _isoDuration(Class, params) {
|
|
3269
|
-
return new Class({
|
|
3270
|
-
type: "string",
|
|
3271
|
-
format: "duration",
|
|
3272
|
-
check: "string_format",
|
|
3273
|
-
...normalizeParams(params)
|
|
3274
|
-
});
|
|
3275
|
-
}
|
|
3276
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3277
|
-
function _boolean(Class, params) {
|
|
3278
|
-
return new Class({
|
|
3279
|
-
type: "boolean",
|
|
3280
|
-
...normalizeParams(params)
|
|
3281
|
-
});
|
|
2623
|
+
return this._map.has(schema);
|
|
2624
|
+
}
|
|
2625
|
+
};
|
|
2626
|
+
function registry() {
|
|
2627
|
+
return new $ZodRegistry();
|
|
3282
2628
|
}
|
|
2629
|
+
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
2630
|
+
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2631
|
+
|
|
2632
|
+
//#endregion
|
|
2633
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
|
|
3283
2634
|
/* @__NO_SIDE_EFFECTS__ */
|
|
3284
2635
|
function _unknown(Class) {
|
|
3285
2636
|
return new Class({ type: "unknown" });
|
|
@@ -3316,58 +2667,6 @@ function _length(length, params) {
|
|
|
3316
2667
|
});
|
|
3317
2668
|
}
|
|
3318
2669
|
/* @__NO_SIDE_EFFECTS__ */
|
|
3319
|
-
function _regex(pattern, params) {
|
|
3320
|
-
return new $ZodCheckRegex({
|
|
3321
|
-
check: "string_format",
|
|
3322
|
-
format: "regex",
|
|
3323
|
-
...normalizeParams(params),
|
|
3324
|
-
pattern
|
|
3325
|
-
});
|
|
3326
|
-
}
|
|
3327
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3328
|
-
function _lowercase(params) {
|
|
3329
|
-
return new $ZodCheckLowerCase({
|
|
3330
|
-
check: "string_format",
|
|
3331
|
-
format: "lowercase",
|
|
3332
|
-
...normalizeParams(params)
|
|
3333
|
-
});
|
|
3334
|
-
}
|
|
3335
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3336
|
-
function _uppercase(params) {
|
|
3337
|
-
return new $ZodCheckUpperCase({
|
|
3338
|
-
check: "string_format",
|
|
3339
|
-
format: "uppercase",
|
|
3340
|
-
...normalizeParams(params)
|
|
3341
|
-
});
|
|
3342
|
-
}
|
|
3343
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3344
|
-
function _includes(includes, params) {
|
|
3345
|
-
return new $ZodCheckIncludes({
|
|
3346
|
-
check: "string_format",
|
|
3347
|
-
format: "includes",
|
|
3348
|
-
...normalizeParams(params),
|
|
3349
|
-
includes
|
|
3350
|
-
});
|
|
3351
|
-
}
|
|
3352
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3353
|
-
function _startsWith(prefix, params) {
|
|
3354
|
-
return new $ZodCheckStartsWith({
|
|
3355
|
-
check: "string_format",
|
|
3356
|
-
format: "starts_with",
|
|
3357
|
-
...normalizeParams(params),
|
|
3358
|
-
prefix
|
|
3359
|
-
});
|
|
3360
|
-
}
|
|
3361
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3362
|
-
function _endsWith(suffix, params) {
|
|
3363
|
-
return new $ZodCheckEndsWith({
|
|
3364
|
-
check: "string_format",
|
|
3365
|
-
format: "ends_with",
|
|
3366
|
-
...normalizeParams(params),
|
|
3367
|
-
suffix
|
|
3368
|
-
});
|
|
3369
|
-
}
|
|
3370
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3371
2670
|
function _overwrite(tx) {
|
|
3372
2671
|
return new $ZodCheckOverwrite({
|
|
3373
2672
|
check: "overwrite",
|
|
@@ -3375,26 +2674,6 @@ function _overwrite(tx) {
|
|
|
3375
2674
|
});
|
|
3376
2675
|
}
|
|
3377
2676
|
/* @__NO_SIDE_EFFECTS__ */
|
|
3378
|
-
function _normalize(form) {
|
|
3379
|
-
return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
|
|
3380
|
-
}
|
|
3381
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3382
|
-
function _trim() {
|
|
3383
|
-
return /* @__PURE__ */ _overwrite((input) => input.trim());
|
|
3384
|
-
}
|
|
3385
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3386
|
-
function _toLowerCase() {
|
|
3387
|
-
return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
|
|
3388
|
-
}
|
|
3389
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3390
|
-
function _toUpperCase() {
|
|
3391
|
-
return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
|
|
3392
|
-
}
|
|
3393
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3394
|
-
function _slugify() {
|
|
3395
|
-
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
3396
|
-
}
|
|
3397
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3398
2677
|
function _array(Class, element, params) {
|
|
3399
2678
|
return new Class({
|
|
3400
2679
|
type: "array",
|
|
@@ -3754,37 +3033,6 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
3754
3033
|
|
|
3755
3034
|
//#endregion
|
|
3756
3035
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js
|
|
3757
|
-
const formatMap = {
|
|
3758
|
-
guid: "uuid",
|
|
3759
|
-
url: "uri",
|
|
3760
|
-
datetime: "date-time",
|
|
3761
|
-
json_string: "json-string",
|
|
3762
|
-
regex: ""
|
|
3763
|
-
};
|
|
3764
|
-
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
3765
|
-
const json = _json;
|
|
3766
|
-
json.type = "string";
|
|
3767
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
3768
|
-
if (typeof minimum === "number") json.minLength = minimum;
|
|
3769
|
-
if (typeof maximum === "number") json.maxLength = maximum;
|
|
3770
|
-
if (format) {
|
|
3771
|
-
json.format = formatMap[format] ?? format;
|
|
3772
|
-
if (json.format === "") delete json.format;
|
|
3773
|
-
if (format === "time") delete json.format;
|
|
3774
|
-
}
|
|
3775
|
-
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
3776
|
-
if (patterns && patterns.size > 0) {
|
|
3777
|
-
const regexes = [...patterns];
|
|
3778
|
-
if (regexes.length === 1) json.pattern = regexes[0].source;
|
|
3779
|
-
else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
|
|
3780
|
-
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3781
|
-
pattern: regex.source
|
|
3782
|
-
}))];
|
|
3783
|
-
}
|
|
3784
|
-
};
|
|
3785
|
-
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
3786
|
-
json.type = "boolean";
|
|
3787
|
-
};
|
|
3788
3036
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
3789
3037
|
json.not = {};
|
|
3790
3038
|
};
|
|
@@ -3878,39 +3126,6 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
3878
3126
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
3879
3127
|
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
3880
3128
|
};
|
|
3881
|
-
const recordProcessor = (schema, ctx, _json, params) => {
|
|
3882
|
-
const json = _json;
|
|
3883
|
-
const def = schema._zod.def;
|
|
3884
|
-
json.type = "object";
|
|
3885
|
-
const keyType = def.keyType;
|
|
3886
|
-
const patterns = keyType._zod.bag?.patterns;
|
|
3887
|
-
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
3888
|
-
const valueSchema = process$1(def.valueType, ctx, {
|
|
3889
|
-
...params,
|
|
3890
|
-
path: [
|
|
3891
|
-
...params.path,
|
|
3892
|
-
"patternProperties",
|
|
3893
|
-
"*"
|
|
3894
|
-
]
|
|
3895
|
-
});
|
|
3896
|
-
json.patternProperties = {};
|
|
3897
|
-
for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
|
|
3898
|
-
} else {
|
|
3899
|
-
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process$1(def.keyType, ctx, {
|
|
3900
|
-
...params,
|
|
3901
|
-
path: [...params.path, "propertyNames"]
|
|
3902
|
-
});
|
|
3903
|
-
json.additionalProperties = process$1(def.valueType, ctx, {
|
|
3904
|
-
...params,
|
|
3905
|
-
path: [...params.path, "additionalProperties"]
|
|
3906
|
-
});
|
|
3907
|
-
}
|
|
3908
|
-
const keyValues = keyType._zod.values;
|
|
3909
|
-
if (keyValues) {
|
|
3910
|
-
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
3911
|
-
if (validKeyValues.length > 0) json.required = validKeyValues;
|
|
3912
|
-
}
|
|
3913
|
-
};
|
|
3914
3129
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
3915
3130
|
const def = schema._zod.def;
|
|
3916
3131
|
const inner = process$1(def.innerType, ctx, params);
|
|
@@ -3974,37 +3189,6 @@ const optionalProcessor = (schema, ctx, _json, params) => {
|
|
|
3974
3189
|
seen.ref = def.innerType;
|
|
3975
3190
|
};
|
|
3976
3191
|
|
|
3977
|
-
//#endregion
|
|
3978
|
-
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/iso.js
|
|
3979
|
-
const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
3980
|
-
$ZodISODateTime.init(inst, def);
|
|
3981
|
-
ZodStringFormat.init(inst, def);
|
|
3982
|
-
});
|
|
3983
|
-
function datetime(params) {
|
|
3984
|
-
return _isoDateTime(ZodISODateTime, params);
|
|
3985
|
-
}
|
|
3986
|
-
const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
|
|
3987
|
-
$ZodISODate.init(inst, def);
|
|
3988
|
-
ZodStringFormat.init(inst, def);
|
|
3989
|
-
});
|
|
3990
|
-
function date(params) {
|
|
3991
|
-
return _isoDate(ZodISODate, params);
|
|
3992
|
-
}
|
|
3993
|
-
const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
|
|
3994
|
-
$ZodISOTime.init(inst, def);
|
|
3995
|
-
ZodStringFormat.init(inst, def);
|
|
3996
|
-
});
|
|
3997
|
-
function time(params) {
|
|
3998
|
-
return _isoTime(ZodISOTime, params);
|
|
3999
|
-
}
|
|
4000
|
-
const ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
|
|
4001
|
-
$ZodISODuration.init(inst, def);
|
|
4002
|
-
ZodStringFormat.init(inst, def);
|
|
4003
|
-
});
|
|
4004
|
-
function duration(params) {
|
|
4005
|
-
return _isoDuration(ZodISODuration, params);
|
|
4006
|
-
}
|
|
4007
|
-
|
|
4008
3192
|
//#endregion
|
|
4009
3193
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
|
|
4010
3194
|
const initializer = (inst, issues) => {
|
|
@@ -4122,153 +3306,6 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
4122
3306
|
inst.apply = (fn) => fn(inst);
|
|
4123
3307
|
return inst;
|
|
4124
3308
|
});
|
|
4125
|
-
/** @internal */
|
|
4126
|
-
const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
4127
|
-
$ZodString.init(inst, def);
|
|
4128
|
-
ZodType.init(inst, def);
|
|
4129
|
-
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
4130
|
-
const bag = inst._zod.bag;
|
|
4131
|
-
inst.format = bag.format ?? null;
|
|
4132
|
-
inst.minLength = bag.minimum ?? null;
|
|
4133
|
-
inst.maxLength = bag.maximum ?? null;
|
|
4134
|
-
inst.regex = (...args) => inst.check(_regex(...args));
|
|
4135
|
-
inst.includes = (...args) => inst.check(_includes(...args));
|
|
4136
|
-
inst.startsWith = (...args) => inst.check(_startsWith(...args));
|
|
4137
|
-
inst.endsWith = (...args) => inst.check(_endsWith(...args));
|
|
4138
|
-
inst.min = (...args) => inst.check(_minLength(...args));
|
|
4139
|
-
inst.max = (...args) => inst.check(_maxLength(...args));
|
|
4140
|
-
inst.length = (...args) => inst.check(_length(...args));
|
|
4141
|
-
inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
|
|
4142
|
-
inst.lowercase = (params) => inst.check(_lowercase(params));
|
|
4143
|
-
inst.uppercase = (params) => inst.check(_uppercase(params));
|
|
4144
|
-
inst.trim = () => inst.check(_trim());
|
|
4145
|
-
inst.normalize = (...args) => inst.check(_normalize(...args));
|
|
4146
|
-
inst.toLowerCase = () => inst.check(_toLowerCase());
|
|
4147
|
-
inst.toUpperCase = () => inst.check(_toUpperCase());
|
|
4148
|
-
inst.slugify = () => inst.check(_slugify());
|
|
4149
|
-
});
|
|
4150
|
-
const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
4151
|
-
$ZodString.init(inst, def);
|
|
4152
|
-
_ZodString.init(inst, def);
|
|
4153
|
-
inst.email = (params) => inst.check(_email(ZodEmail, params));
|
|
4154
|
-
inst.url = (params) => inst.check(_url(ZodURL, params));
|
|
4155
|
-
inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
|
|
4156
|
-
inst.emoji = (params) => inst.check(_emoji(ZodEmoji, params));
|
|
4157
|
-
inst.guid = (params) => inst.check(_guid(ZodGUID, params));
|
|
4158
|
-
inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
|
|
4159
|
-
inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
|
|
4160
|
-
inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
|
|
4161
|
-
inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
|
|
4162
|
-
inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
|
|
4163
|
-
inst.guid = (params) => inst.check(_guid(ZodGUID, params));
|
|
4164
|
-
inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
|
|
4165
|
-
inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
|
|
4166
|
-
inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
|
|
4167
|
-
inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
|
|
4168
|
-
inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
|
|
4169
|
-
inst.xid = (params) => inst.check(_xid(ZodXID, params));
|
|
4170
|
-
inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
|
|
4171
|
-
inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
|
|
4172
|
-
inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
|
|
4173
|
-
inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
|
|
4174
|
-
inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
|
|
4175
|
-
inst.e164 = (params) => inst.check(_e164(ZodE164, params));
|
|
4176
|
-
inst.datetime = (params) => inst.check(datetime(params));
|
|
4177
|
-
inst.date = (params) => inst.check(date(params));
|
|
4178
|
-
inst.time = (params) => inst.check(time(params));
|
|
4179
|
-
inst.duration = (params) => inst.check(duration(params));
|
|
4180
|
-
});
|
|
4181
|
-
function string(params) {
|
|
4182
|
-
return _string(ZodString, params);
|
|
4183
|
-
}
|
|
4184
|
-
const ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
|
|
4185
|
-
$ZodStringFormat.init(inst, def);
|
|
4186
|
-
_ZodString.init(inst, def);
|
|
4187
|
-
});
|
|
4188
|
-
const ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
|
|
4189
|
-
$ZodEmail.init(inst, def);
|
|
4190
|
-
ZodStringFormat.init(inst, def);
|
|
4191
|
-
});
|
|
4192
|
-
const ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
|
|
4193
|
-
$ZodGUID.init(inst, def);
|
|
4194
|
-
ZodStringFormat.init(inst, def);
|
|
4195
|
-
});
|
|
4196
|
-
const ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
|
|
4197
|
-
$ZodUUID.init(inst, def);
|
|
4198
|
-
ZodStringFormat.init(inst, def);
|
|
4199
|
-
});
|
|
4200
|
-
const ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
|
|
4201
|
-
$ZodURL.init(inst, def);
|
|
4202
|
-
ZodStringFormat.init(inst, def);
|
|
4203
|
-
});
|
|
4204
|
-
const ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
|
|
4205
|
-
$ZodEmoji.init(inst, def);
|
|
4206
|
-
ZodStringFormat.init(inst, def);
|
|
4207
|
-
});
|
|
4208
|
-
const ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
|
|
4209
|
-
$ZodNanoID.init(inst, def);
|
|
4210
|
-
ZodStringFormat.init(inst, def);
|
|
4211
|
-
});
|
|
4212
|
-
const ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
|
|
4213
|
-
$ZodCUID.init(inst, def);
|
|
4214
|
-
ZodStringFormat.init(inst, def);
|
|
4215
|
-
});
|
|
4216
|
-
const ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
|
|
4217
|
-
$ZodCUID2.init(inst, def);
|
|
4218
|
-
ZodStringFormat.init(inst, def);
|
|
4219
|
-
});
|
|
4220
|
-
const ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
|
|
4221
|
-
$ZodULID.init(inst, def);
|
|
4222
|
-
ZodStringFormat.init(inst, def);
|
|
4223
|
-
});
|
|
4224
|
-
const ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
|
|
4225
|
-
$ZodXID.init(inst, def);
|
|
4226
|
-
ZodStringFormat.init(inst, def);
|
|
4227
|
-
});
|
|
4228
|
-
const ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
|
|
4229
|
-
$ZodKSUID.init(inst, def);
|
|
4230
|
-
ZodStringFormat.init(inst, def);
|
|
4231
|
-
});
|
|
4232
|
-
const ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
|
|
4233
|
-
$ZodIPv4.init(inst, def);
|
|
4234
|
-
ZodStringFormat.init(inst, def);
|
|
4235
|
-
});
|
|
4236
|
-
const ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
|
|
4237
|
-
$ZodIPv6.init(inst, def);
|
|
4238
|
-
ZodStringFormat.init(inst, def);
|
|
4239
|
-
});
|
|
4240
|
-
const ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
|
|
4241
|
-
$ZodCIDRv4.init(inst, def);
|
|
4242
|
-
ZodStringFormat.init(inst, def);
|
|
4243
|
-
});
|
|
4244
|
-
const ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
|
|
4245
|
-
$ZodCIDRv6.init(inst, def);
|
|
4246
|
-
ZodStringFormat.init(inst, def);
|
|
4247
|
-
});
|
|
4248
|
-
const ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
|
|
4249
|
-
$ZodBase64.init(inst, def);
|
|
4250
|
-
ZodStringFormat.init(inst, def);
|
|
4251
|
-
});
|
|
4252
|
-
const ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
|
|
4253
|
-
$ZodBase64URL.init(inst, def);
|
|
4254
|
-
ZodStringFormat.init(inst, def);
|
|
4255
|
-
});
|
|
4256
|
-
const ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
|
|
4257
|
-
$ZodE164.init(inst, def);
|
|
4258
|
-
ZodStringFormat.init(inst, def);
|
|
4259
|
-
});
|
|
4260
|
-
const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
4261
|
-
$ZodJWT.init(inst, def);
|
|
4262
|
-
ZodStringFormat.init(inst, def);
|
|
4263
|
-
});
|
|
4264
|
-
const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
4265
|
-
$ZodBoolean.init(inst, def);
|
|
4266
|
-
ZodType.init(inst, def);
|
|
4267
|
-
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
4268
|
-
});
|
|
4269
|
-
function boolean(params) {
|
|
4270
|
-
return _boolean(ZodBoolean, params);
|
|
4271
|
-
}
|
|
4272
3309
|
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
4273
3310
|
$ZodUnknown.init(inst, def);
|
|
4274
3311
|
ZodType.init(inst, def);
|
|
@@ -4372,21 +3409,6 @@ function intersection(left, right) {
|
|
|
4372
3409
|
right
|
|
4373
3410
|
});
|
|
4374
3411
|
}
|
|
4375
|
-
const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
4376
|
-
$ZodRecord.init(inst, def);
|
|
4377
|
-
ZodType.init(inst, def);
|
|
4378
|
-
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
4379
|
-
inst.keyType = def.keyType;
|
|
4380
|
-
inst.valueType = def.valueType;
|
|
4381
|
-
});
|
|
4382
|
-
function record(keyType, valueType, params) {
|
|
4383
|
-
return new ZodRecord({
|
|
4384
|
-
type: "record",
|
|
4385
|
-
keyType,
|
|
4386
|
-
valueType,
|
|
4387
|
-
...normalizeParams(params)
|
|
4388
|
-
});
|
|
4389
|
-
}
|
|
4390
3412
|
const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
4391
3413
|
$ZodEnum.init(inst, def);
|
|
4392
3414
|
ZodType.init(inst, def);
|
|
@@ -4591,16 +3613,26 @@ const describe = describe$1;
|
|
|
4591
3613
|
const meta = meta$1;
|
|
4592
3614
|
|
|
4593
3615
|
//#endregion
|
|
4594
|
-
//#region src/config.ts
|
|
4595
|
-
function defineConfig(config) {
|
|
4596
|
-
return config;
|
|
4597
|
-
}
|
|
3616
|
+
//#region src/config/schema.ts
|
|
4598
3617
|
const checkerExtensionsConfigReason = "checker extensions are fixed by built-in presets and cannot be configured.";
|
|
4599
|
-
const checkerRoutesConfigReason = "checker routes are not supported;
|
|
4600
|
-
const unsupportedCheckerPresetReason = "configured
|
|
3618
|
+
const checkerRoutesConfigReason = "checker routes are not supported; configure checker.include with source tsconfig selectors.";
|
|
3619
|
+
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
|
+
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
|
+
const autoCheckerMixedConfigReason = "auto checker config must not be mixed with named checker entries.";
|
|
3624
|
+
const autoCheckerModeConfigReason = "auto checker config requires mode: \"auto\".";
|
|
3625
|
+
const importAnalysisConfigReason = "config.imports must be an object when configured.";
|
|
3626
|
+
const vueImportParserConfigReason = "config.imports.vue must be \"heuristic\" or \"compiler-sfc\".";
|
|
4601
3627
|
const checkerConfigShapeSchema = looseObject({}).superRefine((checker, ctx) => {
|
|
4602
3628
|
const preset = checker.preset;
|
|
4603
|
-
const
|
|
3629
|
+
const include = checker.include;
|
|
3630
|
+
const exclude = checker.exclude;
|
|
3631
|
+
if (Object.hasOwn(checker, "entry")) ctx.addIssue({
|
|
3632
|
+
code: "custom",
|
|
3633
|
+
message: checkerEntryConfigReason,
|
|
3634
|
+
path: ["entry"]
|
|
3635
|
+
});
|
|
4604
3636
|
if (Object.hasOwn(checker, "extensions")) ctx.addIssue({
|
|
4605
3637
|
code: "custom",
|
|
4606
3638
|
message: checkerExtensionsConfigReason,
|
|
@@ -4621,25 +3653,120 @@ const checkerConfigShapeSchema = looseObject({}).superRefine((checker, ctx) => {
|
|
|
4621
3653
|
message: unsupportedCheckerPresetReason,
|
|
4622
3654
|
path: ["preset"]
|
|
4623
3655
|
});
|
|
4624
|
-
if (
|
|
3656
|
+
if (!Array.isArray(include) || include.length === 0) ctx.addIssue({
|
|
4625
3657
|
code: "custom",
|
|
4626
|
-
message: "checker
|
|
4627
|
-
path: ["
|
|
3658
|
+
message: "checker include must be a non-empty string array.",
|
|
3659
|
+
path: ["include"]
|
|
3660
|
+
});
|
|
3661
|
+
else for (const [index, value] of include.entries()) if (typeof value !== "string" || value.trim().length === 0) ctx.addIssue({
|
|
3662
|
+
code: "custom",
|
|
3663
|
+
message: "checker include entries must be non-empty string paths.",
|
|
3664
|
+
path: ["include", index]
|
|
3665
|
+
});
|
|
3666
|
+
if (exclude === void 0) return;
|
|
3667
|
+
if (!Array.isArray(exclude)) {
|
|
3668
|
+
ctx.addIssue({
|
|
3669
|
+
code: "custom",
|
|
3670
|
+
message: "checker exclude must be a string array when configured.",
|
|
3671
|
+
path: ["exclude"]
|
|
3672
|
+
});
|
|
3673
|
+
return;
|
|
3674
|
+
}
|
|
3675
|
+
for (const [index, value] of exclude.entries()) if (typeof value !== "string" || value.trim().length === 0) ctx.addIssue({
|
|
3676
|
+
code: "custom",
|
|
3677
|
+
message: "checker exclude entries must be non-empty string paths.",
|
|
3678
|
+
path: ["exclude", index]
|
|
4628
3679
|
});
|
|
4629
3680
|
});
|
|
4630
|
-
|
|
3681
|
+
function isPlainConfigRecord(value) {
|
|
3682
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
3683
|
+
}
|
|
3684
|
+
const sharedLiminaConfigShapeSchema = looseObject({}).superRefine((sharedConfig, ctx) => {
|
|
3685
|
+
const checkers = sharedConfig.checkers;
|
|
3686
|
+
const imports = sharedConfig.imports;
|
|
4631
3687
|
const source = sharedConfig.source;
|
|
4632
|
-
if (
|
|
4633
|
-
const sourceRecord = source;
|
|
4634
|
-
if (Object.hasOwn(sourceRecord, "tsconfigOwnership")) ctx.addIssue({
|
|
3688
|
+
if (checkers !== void 0) if (checkers === "auto") ctx.addIssue({
|
|
4635
3689
|
code: "custom",
|
|
4636
|
-
message:
|
|
4637
|
-
path: [
|
|
4638
|
-
"source",
|
|
4639
|
-
"tsconfigOwnership",
|
|
4640
|
-
"ignore"
|
|
4641
|
-
]
|
|
3690
|
+
message: checkerAutoStringConfigReason,
|
|
3691
|
+
path: ["checkers"]
|
|
4642
3692
|
});
|
|
3693
|
+
else if (!isPlainConfigRecord(checkers)) ctx.addIssue({
|
|
3694
|
+
code: "custom",
|
|
3695
|
+
message: checkerConfigReason,
|
|
3696
|
+
path: ["checkers"]
|
|
3697
|
+
});
|
|
3698
|
+
else if (Object.hasOwn(checkers, "mode")) {
|
|
3699
|
+
if (checkers.mode !== "auto") ctx.addIssue({
|
|
3700
|
+
code: "custom",
|
|
3701
|
+
message: autoCheckerModeConfigReason,
|
|
3702
|
+
path: ["checkers", "mode"]
|
|
3703
|
+
});
|
|
3704
|
+
const exclude = checkers.exclude;
|
|
3705
|
+
if (exclude !== void 0 && !Array.isArray(exclude)) ctx.addIssue({
|
|
3706
|
+
code: "custom",
|
|
3707
|
+
message: "auto checker exclude must be a string array when configured.",
|
|
3708
|
+
path: ["checkers", "exclude"]
|
|
3709
|
+
});
|
|
3710
|
+
else if (Array.isArray(exclude)) {
|
|
3711
|
+
for (const [index, value] of exclude.entries()) if (typeof value !== "string" || value.trim().length === 0) ctx.addIssue({
|
|
3712
|
+
code: "custom",
|
|
3713
|
+
message: "auto checker exclude entries must be non-empty string paths.",
|
|
3714
|
+
path: [
|
|
3715
|
+
"checkers",
|
|
3716
|
+
"exclude",
|
|
3717
|
+
index
|
|
3718
|
+
]
|
|
3719
|
+
});
|
|
3720
|
+
}
|
|
3721
|
+
for (const key of Object.keys(checkers)) {
|
|
3722
|
+
if (key === "mode" || key === "exclude") continue;
|
|
3723
|
+
ctx.addIssue({
|
|
3724
|
+
code: "custom",
|
|
3725
|
+
message: autoCheckerMixedConfigReason,
|
|
3726
|
+
path: ["checkers", key]
|
|
3727
|
+
});
|
|
3728
|
+
}
|
|
3729
|
+
} else for (const [checkerName, checker] of Object.entries(checkers)) {
|
|
3730
|
+
const result = checkerConfigShapeSchema.safeParse(checker);
|
|
3731
|
+
if (result.success) continue;
|
|
3732
|
+
for (const issue of result.error.issues) ctx.addIssue({
|
|
3733
|
+
...issue,
|
|
3734
|
+
path: [
|
|
3735
|
+
"checkers",
|
|
3736
|
+
checkerName,
|
|
3737
|
+
...issue.path
|
|
3738
|
+
]
|
|
3739
|
+
});
|
|
3740
|
+
}
|
|
3741
|
+
if (imports !== void 0) {
|
|
3742
|
+
if (!isPlainConfigRecord(imports)) ctx.addIssue({
|
|
3743
|
+
code: "custom",
|
|
3744
|
+
message: importAnalysisConfigReason,
|
|
3745
|
+
path: ["imports"]
|
|
3746
|
+
});
|
|
3747
|
+
else if (imports.vue !== void 0 && imports.vue !== "heuristic" && imports.vue !== "compiler-sfc") ctx.addIssue({
|
|
3748
|
+
code: "custom",
|
|
3749
|
+
message: vueImportParserConfigReason,
|
|
3750
|
+
path: ["imports", "vue"]
|
|
3751
|
+
});
|
|
3752
|
+
}
|
|
3753
|
+
if (source === void 0) return;
|
|
3754
|
+
if (!isPlainConfigRecord(source)) {
|
|
3755
|
+
ctx.addIssue({
|
|
3756
|
+
code: "custom",
|
|
3757
|
+
message: "source boundary config must be an object.",
|
|
3758
|
+
path: ["source"]
|
|
3759
|
+
});
|
|
3760
|
+
return;
|
|
3761
|
+
}
|
|
3762
|
+
for (const key of Object.keys(source)) {
|
|
3763
|
+
if (key === "include" || key === "exclude") continue;
|
|
3764
|
+
ctx.addIssue({
|
|
3765
|
+
code: "custom",
|
|
3766
|
+
message: "unknown source boundary config field.",
|
|
3767
|
+
path: ["source", key]
|
|
3768
|
+
});
|
|
3769
|
+
}
|
|
4643
3770
|
});
|
|
4644
3771
|
const releaseContentHashShapeSchema = looseObject({}).superRefine((contentHash, ctx) => {
|
|
4645
3772
|
const baselineTag = contentHash.baselineTag;
|
|
@@ -4674,22 +3801,174 @@ const releaseContentHashShapeSchema = looseObject({}).superRefine((contentHash,
|
|
|
4674
3801
|
}
|
|
4675
3802
|
});
|
|
4676
3803
|
const releaseConfigShapeSchema = looseObject({ contentHash: releaseContentHashShapeSchema.optional() });
|
|
3804
|
+
const executionConcurrencyFields = [
|
|
3805
|
+
"tasks",
|
|
3806
|
+
"checkerBuild",
|
|
3807
|
+
"checkerTypecheck",
|
|
3808
|
+
"packageEntries",
|
|
3809
|
+
"releaseEntries"
|
|
3810
|
+
];
|
|
3811
|
+
function isValidExecutionConcurrencyValue(value) {
|
|
3812
|
+
return value === "auto" || typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
3813
|
+
}
|
|
3814
|
+
const executionConfigShapeSchema = looseObject({}).superRefine((execution, ctx) => {
|
|
3815
|
+
for (const key of Object.keys(execution)) {
|
|
3816
|
+
if (key === "failFast" || executionConcurrencyFields.includes(key)) continue;
|
|
3817
|
+
ctx.addIssue({
|
|
3818
|
+
code: "custom",
|
|
3819
|
+
message: "unknown execution config field.",
|
|
3820
|
+
path: [key]
|
|
3821
|
+
});
|
|
3822
|
+
}
|
|
3823
|
+
for (const key of executionConcurrencyFields) {
|
|
3824
|
+
const value = execution[key];
|
|
3825
|
+
if (value === void 0 || isValidExecutionConcurrencyValue(value)) continue;
|
|
3826
|
+
ctx.addIssue({
|
|
3827
|
+
code: "custom",
|
|
3828
|
+
message: "execution concurrency must be a positive integer or \"auto\".",
|
|
3829
|
+
path: [key]
|
|
3830
|
+
});
|
|
3831
|
+
}
|
|
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
|
+
});
|
|
3838
|
+
function validateStringArrayField(options) {
|
|
3839
|
+
if (options.value === void 0) {
|
|
3840
|
+
if (options.required) options.ctx.addIssue({
|
|
3841
|
+
code: "custom",
|
|
3842
|
+
message: `${options.valueName} must be a non-empty string array.`,
|
|
3843
|
+
path: options.path
|
|
3844
|
+
});
|
|
3845
|
+
return false;
|
|
3846
|
+
}
|
|
3847
|
+
if (!Array.isArray(options.value) || options.value.length === 0) {
|
|
3848
|
+
options.ctx.addIssue({
|
|
3849
|
+
code: "custom",
|
|
3850
|
+
message: `${options.valueName} must be a non-empty string array.`,
|
|
3851
|
+
path: options.path
|
|
3852
|
+
});
|
|
3853
|
+
return false;
|
|
3854
|
+
}
|
|
3855
|
+
for (const [index, item] of options.value.entries()) {
|
|
3856
|
+
if (typeof item === "string" && item.trim().length > 0) continue;
|
|
3857
|
+
options.ctx.addIssue({
|
|
3858
|
+
code: "custom",
|
|
3859
|
+
message: `${options.valueName} entries must be non-empty strings.`,
|
|
3860
|
+
path: [...options.path, index]
|
|
3861
|
+
});
|
|
3862
|
+
}
|
|
3863
|
+
return true;
|
|
3864
|
+
}
|
|
3865
|
+
function validateSourceImportAuthorityConfig(value, ctx) {
|
|
3866
|
+
if (value === void 0) return;
|
|
3867
|
+
if (!isPlainConfigRecord(value)) {
|
|
3868
|
+
ctx.addIssue({
|
|
3869
|
+
code: "custom",
|
|
3870
|
+
message: "importAuthority must be an object.",
|
|
3871
|
+
path: ["source", "importAuthority"]
|
|
3872
|
+
});
|
|
3873
|
+
return;
|
|
3874
|
+
}
|
|
3875
|
+
const allow = value.allow;
|
|
3876
|
+
if (allow === void 0) return;
|
|
3877
|
+
if (!Array.isArray(allow)) {
|
|
3878
|
+
ctx.addIssue({
|
|
3879
|
+
code: "custom",
|
|
3880
|
+
message: "importAuthority.allow must be an array.",
|
|
3881
|
+
path: [
|
|
3882
|
+
"source",
|
|
3883
|
+
"importAuthority",
|
|
3884
|
+
"allow"
|
|
3885
|
+
]
|
|
3886
|
+
});
|
|
3887
|
+
return;
|
|
3888
|
+
}
|
|
3889
|
+
for (const [index, entry] of allow.entries()) {
|
|
3890
|
+
const path = [
|
|
3891
|
+
"source",
|
|
3892
|
+
"importAuthority",
|
|
3893
|
+
"allow",
|
|
3894
|
+
index
|
|
3895
|
+
];
|
|
3896
|
+
if (!isPlainConfigRecord(entry)) {
|
|
3897
|
+
ctx.addIssue({
|
|
3898
|
+
code: "custom",
|
|
3899
|
+
message: "importAuthority allow entries must be objects with files, packages or specifiers, and reason fields.",
|
|
3900
|
+
path
|
|
3901
|
+
});
|
|
3902
|
+
continue;
|
|
3903
|
+
}
|
|
3904
|
+
validateStringArrayField({
|
|
3905
|
+
ctx,
|
|
3906
|
+
path: [...path, "files"],
|
|
3907
|
+
required: true,
|
|
3908
|
+
value: entry.files,
|
|
3909
|
+
valueName: "files"
|
|
3910
|
+
});
|
|
3911
|
+
const hasPackages = validateStringArrayField({
|
|
3912
|
+
ctx,
|
|
3913
|
+
path: [...path, "packages"],
|
|
3914
|
+
value: entry.packages,
|
|
3915
|
+
valueName: "packages"
|
|
3916
|
+
});
|
|
3917
|
+
const hasSpecifiers = validateStringArrayField({
|
|
3918
|
+
ctx,
|
|
3919
|
+
path: [...path, "specifiers"],
|
|
3920
|
+
value: entry.specifiers,
|
|
3921
|
+
valueName: "specifiers"
|
|
3922
|
+
});
|
|
3923
|
+
if (!hasPackages && !hasSpecifiers) ctx.addIssue({
|
|
3924
|
+
code: "custom",
|
|
3925
|
+
message: "importAuthority allow entries must declare packages or specifiers.",
|
|
3926
|
+
path
|
|
3927
|
+
});
|
|
3928
|
+
if (entry.owner !== void 0) {
|
|
3929
|
+
if (typeof entry.owner !== "string" || entry.owner.trim().length === 0) ctx.addIssue({
|
|
3930
|
+
code: "custom",
|
|
3931
|
+
message: "owner must be a non-empty string when configured.",
|
|
3932
|
+
path: [...path, "owner"]
|
|
3933
|
+
});
|
|
3934
|
+
}
|
|
3935
|
+
if (typeof entry.reason !== "string" || entry.reason.trim().length === 0) ctx.addIssue({
|
|
3936
|
+
code: "custom",
|
|
3937
|
+
message: "reason must be a non-empty string.",
|
|
3938
|
+
path: [...path, "reason"]
|
|
3939
|
+
});
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
4677
3942
|
const liminaConfigShapeSchema = looseObject({
|
|
4678
|
-
strict: boolean().optional(),
|
|
4679
3943
|
config: sharedLiminaConfigShapeSchema.optional(),
|
|
3944
|
+
execution: executionConfigShapeSchema.optional(),
|
|
4680
3945
|
release: releaseConfigShapeSchema.optional()
|
|
4681
3946
|
}).superRefine((config, ctx) => {
|
|
4682
|
-
if (
|
|
4683
|
-
ctx.addIssue({
|
|
3947
|
+
if (Object.hasOwn(config, "paths")) ctx.addIssue({
|
|
4684
3948
|
code: "custom",
|
|
4685
3949
|
message: "paths config has been removed; use graph/proof/source checks instead.",
|
|
4686
3950
|
path: ["paths"]
|
|
4687
3951
|
});
|
|
3952
|
+
const source = config.source;
|
|
3953
|
+
if (source === void 0) return;
|
|
3954
|
+
if (!isPlainConfigRecord(source)) {
|
|
3955
|
+
ctx.addIssue({
|
|
3956
|
+
code: "custom",
|
|
3957
|
+
message: "source config must be an object.",
|
|
3958
|
+
path: ["source"]
|
|
3959
|
+
});
|
|
3960
|
+
return;
|
|
3961
|
+
}
|
|
3962
|
+
for (const key of Object.keys(source)) {
|
|
3963
|
+
if (key === "knip" || key === "importAuthority") continue;
|
|
3964
|
+
ctx.addIssue({
|
|
3965
|
+
code: "custom",
|
|
3966
|
+
message: "unknown source config field.",
|
|
3967
|
+
path: ["source", key]
|
|
3968
|
+
});
|
|
3969
|
+
}
|
|
3970
|
+
validateSourceImportAuthorityConfig(source.importAuthority, ctx);
|
|
4688
3971
|
});
|
|
4689
|
-
function formatUnknownValue(value) {
|
|
4690
|
-
if (value === void 0) return "undefined";
|
|
4691
|
-
return JSON.stringify(value);
|
|
4692
|
-
}
|
|
4693
3972
|
function formatZodPath(pathSegments) {
|
|
4694
3973
|
return pathSegments.map((segment) => typeof segment === "number" ? `[${segment}]` : `.${String(segment)}`).join("").replace(/^\./u, "");
|
|
4695
3974
|
}
|
|
@@ -4711,27 +3990,63 @@ function formatLiminaConfigShapeIssue(value, issue) {
|
|
|
4711
3990
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4712
3991
|
" reason: config must be an object."
|
|
4713
3992
|
].join("\n");
|
|
4714
|
-
if (field === "strict") return [
|
|
4715
|
-
"Invalid Limina config:",
|
|
4716
|
-
" field: strict",
|
|
4717
|
-
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4718
|
-
" reason: strict must be a boolean."
|
|
4719
|
-
].join("\n");
|
|
4720
3993
|
if (field === "paths") return [
|
|
4721
3994
|
"Invalid Limina paths config:",
|
|
4722
3995
|
" field: paths",
|
|
4723
3996
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4724
3997
|
` reason: ${issue.message}`
|
|
4725
3998
|
].join("\n");
|
|
3999
|
+
if (field === "execution") return [
|
|
4000
|
+
"Invalid Limina execution config:",
|
|
4001
|
+
" field: execution",
|
|
4002
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4003
|
+
" reason: execution must be an object."
|
|
4004
|
+
].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
|
+
if (field.startsWith("execution.")) return [
|
|
4012
|
+
"Invalid Limina execution config:",
|
|
4013
|
+
` field: ${field}`,
|
|
4014
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4015
|
+
` reason: ${issue.message}`
|
|
4016
|
+
].join("\n");
|
|
4726
4017
|
if (field === "config.checkers") return [
|
|
4727
4018
|
"Invalid Limina checker config:",
|
|
4728
4019
|
" field: config.checkers",
|
|
4729
4020
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4730
|
-
|
|
4021
|
+
` reason: ${issue.message}`
|
|
4022
|
+
].join("\n");
|
|
4023
|
+
if (field === "config.checkers.mode") return [
|
|
4024
|
+
"Invalid Limina checker config:",
|
|
4025
|
+
" field: config.checkers.mode",
|
|
4026
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4027
|
+
` reason: ${issue.message}`
|
|
4028
|
+
].join("\n");
|
|
4029
|
+
if (field.startsWith("config.checkers.exclude")) return [
|
|
4030
|
+
"Invalid Limina checker config:",
|
|
4031
|
+
` field: ${field}`,
|
|
4032
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4033
|
+
` reason: ${issue.message}`
|
|
4034
|
+
].join("\n");
|
|
4035
|
+
if (field === "config.imports" || field.startsWith("config.imports.")) return [
|
|
4036
|
+
"Invalid Limina import analysis config:",
|
|
4037
|
+
` field: ${field}`,
|
|
4038
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4039
|
+
` reason: ${issue.message}`
|
|
4040
|
+
].join("\n");
|
|
4041
|
+
if (field === "config.source" || field.startsWith("config.source.")) return [
|
|
4042
|
+
"Invalid Limina source boundary config:",
|
|
4043
|
+
` field: ${field}`,
|
|
4044
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4045
|
+
` reason: ${issue.message}`
|
|
4731
4046
|
].join("\n");
|
|
4732
|
-
if (field === "
|
|
4047
|
+
if (field === "source" || field.startsWith("source.")) return [
|
|
4733
4048
|
"Invalid Limina source config:",
|
|
4734
|
-
|
|
4049
|
+
` field: ${field}`,
|
|
4735
4050
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4736
4051
|
` reason: ${issue.message}`
|
|
4737
4052
|
].join("\n");
|
|
@@ -4742,7 +4057,7 @@ function formatLiminaConfigShapeIssue(value, issue) {
|
|
|
4742
4057
|
"Invalid Limina checker config:",
|
|
4743
4058
|
` field: ${checkerField}`,
|
|
4744
4059
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4745
|
-
|
|
4060
|
+
` reason: ${issue.message === autoCheckerMixedConfigReason ? issue.message : "checker entries must be objects."}`
|
|
4746
4061
|
].join("\n");
|
|
4747
4062
|
if (pathSegments[3] === "preset") {
|
|
4748
4063
|
if (issue.message === unsupportedCheckerPresetReason) return [
|
|
@@ -4762,7 +4077,7 @@ function formatLiminaConfigShapeIssue(value, issue) {
|
|
|
4762
4077
|
"Invalid Limina checker entry config:",
|
|
4763
4078
|
` field: ${checkerField}.entry`,
|
|
4764
4079
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4765
|
-
|
|
4080
|
+
` reason: ${issue.message}`
|
|
4766
4081
|
].join("\n");
|
|
4767
4082
|
if (pathSegments[3] === "extensions") return [
|
|
4768
4083
|
"Invalid Limina checker config:",
|
|
@@ -4829,16 +4144,19 @@ function validateLiminaConfig(config) {
|
|
|
4829
4144
|
const problems = collectLiminaConfigShapeProblems(config);
|
|
4830
4145
|
if (problems.length > 0) throw new Error(problems.join("\n\n"));
|
|
4831
4146
|
}
|
|
4832
|
-
|
|
4833
|
-
|
|
4147
|
+
|
|
4148
|
+
//#endregion
|
|
4149
|
+
//#region src/config/runner.ts
|
|
4150
|
+
function isAutoCheckerConfigMode(checkers) {
|
|
4151
|
+
return Boolean(checkers && checkers.mode === "auto");
|
|
4152
|
+
}
|
|
4153
|
+
function defineConfig(config) {
|
|
4154
|
+
return config;
|
|
4834
4155
|
}
|
|
4835
4156
|
function getActiveCheckers(config) {
|
|
4836
4157
|
validateLiminaConfig(config);
|
|
4837
4158
|
return getResolvedCheckers(config);
|
|
4838
4159
|
}
|
|
4839
|
-
function getActiveCheckerExtensions(config) {
|
|
4840
|
-
return normalizeExtensions(getActiveCheckers(config).flatMap((checker) => checker.extensions));
|
|
4841
|
-
}
|
|
4842
4160
|
function normalizeConfig(value) {
|
|
4843
4161
|
const config = value;
|
|
4844
4162
|
validateLiminaConfig(config);
|
|
@@ -4884,18 +4202,33 @@ function validateConfigPathInsideWorkspace(configPath, rootDir) {
|
|
|
4884
4202
|
async function resolveConfigExport(configExport, configEnv) {
|
|
4885
4203
|
return normalizeConfig(typeof configExport === "function" ? await configExport(configEnv) : await configExport);
|
|
4886
4204
|
}
|
|
4205
|
+
function hasSourceImportAuthorityPackageRules(config) {
|
|
4206
|
+
return Boolean(config.source?.importAuthority?.allow?.some((rule) => rule.packages?.some((packageName) => packageName.trim().length > 0)));
|
|
4207
|
+
}
|
|
4208
|
+
function validateRootPackageImportAuthorityConfig(config, rootDir) {
|
|
4209
|
+
if (!hasSourceImportAuthorityPackageRules(config)) return;
|
|
4210
|
+
if (existsSync(posix.join(rootDir, "package.json"))) return;
|
|
4211
|
+
throw new Error([
|
|
4212
|
+
"Invalid Limina source config:",
|
|
4213
|
+
" field: source.importAuthority.allow[].packages",
|
|
4214
|
+
` value: ${JSON.stringify(config.source?.importAuthority?.allow)}`,
|
|
4215
|
+
" reason: package allow rules enable workspace root package.json as a dependency authority manifest, but no package.json exists at the workspace root."
|
|
4216
|
+
].join("\n"));
|
|
4217
|
+
}
|
|
4887
4218
|
async function loadConfig(options = {}) {
|
|
4888
4219
|
const cwd = options.cwd ? posix.resolve(options.cwd) : process.cwd();
|
|
4889
4220
|
const rootDir = inferWorkspaceRoot(cwd);
|
|
4890
4221
|
const configPath = options.configPath ? posix.resolve(cwd, options.configPath) : findLiminaConfigPath(cwd, rootDir);
|
|
4891
4222
|
if (configPath) validateConfigPathInsideWorkspace(configPath, rootDir);
|
|
4892
4223
|
if (!configPath || !existsSync(configPath)) throw new Error(options.configPath ? `Unable to find limina config at ${configPath}` : `Unable to find limina config. Searched for limina.config.mjs from ${cwd} up to the pnpm workspace root at ${rootDir}.`);
|
|
4224
|
+
const config = await resolveConfigExport((await import(`${pathToFileURL(configPath).href}?t=${Date.now()}`)).default, createConfigEnv(options));
|
|
4225
|
+
validateRootPackageImportAuthorityConfig(config, rootDir);
|
|
4893
4226
|
return {
|
|
4894
|
-
...
|
|
4227
|
+
...config,
|
|
4895
4228
|
configPath,
|
|
4896
4229
|
rootDir
|
|
4897
4230
|
};
|
|
4898
4231
|
}
|
|
4899
4232
|
|
|
4900
4233
|
//#endregion
|
|
4901
|
-
export { normalizeSlashes as _,
|
|
4234
|
+
export { isPackageImportSpecifier as A, resolveRelativeModuleCandidate as C, toPosixPath as D, normalizeSlashes as E, uniqueBy as F, uniqueSortedStrings as I, uniqueTrimmedNonEmptySortedStrings as L, isUrlOrDataOrFileSpecifier as M, isVirtualModuleSpecifier as N, toRelativePath as O, posix as P, uniqueValues as R, resolvePathMappedModuleCandidate as S, normalizeAbsolutePath as T, resolveModuleNameWithCheckers as _, formatUnknownValue as a, resolveBaseUrlModuleCandidate as b, clearCheckerProjectConfigCache as c, getBuildCheckerSupportedExtensions as d, getCheckerAdapter as f, resolveCheckerProjectExtensions as g, parseCheckerProjectConfigForContext as h, loadConfig as i, isRelativeSpecifier as j, isBarePackageSpecifier as k, collectMissingCheckerPeerDependencies as l, normalizeExtensions as m, getActiveCheckers as n, isNonEmptyString as o, getCheckerExtensions as p, isAutoCheckerConfigMode as r, isPlainRecord as s, defineConfig as t, formatMissingCheckerPeerDependencies as u, resolveModuleNameWithCheckersDetailed as v, isPathInsideDirectory as w, resolveExistingFilePath as x, candidatePathsForBasePath as y };
|