limina 0.0.6 → 0.1.1
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-C5gcXDHp.js} +546 -1322
- package/chunks/dep-CuMHuWBQ.js +87 -0
- package/cli.js +32051 -6059
- package/flow-renderer-process.js +109 -0
- package/index.d.ts +680 -163
- package/index.js +2 -3
- package/package.json +11 -12
- package/schemas/tsconfig-schema.json +31 -0
- package/chunks/dep-COZNKoxO.js +0 -15582
- package/config.d.ts +0 -683
- package/config.js +0 -3
|
@@ -3,6 +3,29 @@ import { existsSync, 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) {
|
|
@@ -466,16 +507,82 @@ function toRelativePath(rootDir, absolutePath) {
|
|
|
466
507
|
function normalizeSlashes(value) {
|
|
467
508
|
return value.replaceAll("\\", "/");
|
|
468
509
|
}
|
|
469
|
-
function normalizeAbsolutePathIdentity(value) {
|
|
470
|
-
const normalizedPath = normalize(value);
|
|
471
|
-
return normalizedPath.length > 1 && !/^[A-Za-z]:\/$/u.test(normalizedPath) ? normalizedPath.replace(/\/+$/u, "") : normalizedPath;
|
|
472
|
-
}
|
|
473
510
|
function isPathInsideDirectory(filePath, directoryPath) {
|
|
474
511
|
const normalizedFilePath = normalizeAbsolutePath(filePath);
|
|
475
512
|
const normalizedDirectoryPath = normalizeAbsolutePath(directoryPath);
|
|
476
513
|
return normalizedFilePath === normalizedDirectoryPath || normalizedFilePath.startsWith(`${normalizedDirectoryPath}/`);
|
|
477
514
|
}
|
|
478
515
|
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/utils/module-resolution.ts
|
|
518
|
+
function pathHasExtension(value) {
|
|
519
|
+
return posix.extname(value).length > 0;
|
|
520
|
+
}
|
|
521
|
+
function candidatePathsForBasePath(basePath, extensions) {
|
|
522
|
+
if (pathHasExtension(basePath)) return [basePath];
|
|
523
|
+
return extensions.flatMap((extension) => [`${basePath}${extension}`, posix.join(basePath, `index${extension}`)]);
|
|
524
|
+
}
|
|
525
|
+
function resolveExistingFilePath(candidatePath) {
|
|
526
|
+
if (!existsSync(candidatePath)) return null;
|
|
527
|
+
if (!statSync(candidatePath).isFile()) return null;
|
|
528
|
+
return normalizeAbsolutePath(candidatePath);
|
|
529
|
+
}
|
|
530
|
+
function matchPathPattern(pattern, specifier) {
|
|
531
|
+
const wildcardIndex = pattern.indexOf("*");
|
|
532
|
+
if (wildcardIndex === -1) return pattern === specifier ? "" : null;
|
|
533
|
+
const prefix = pattern.slice(0, wildcardIndex);
|
|
534
|
+
const suffix = pattern.slice(wildcardIndex + 1);
|
|
535
|
+
if (!specifier.startsWith(prefix) || !specifier.endsWith(suffix)) return null;
|
|
536
|
+
return specifier.slice(prefix.length, specifier.length - suffix.length);
|
|
537
|
+
}
|
|
538
|
+
function resolveRelativeModuleCandidate(options) {
|
|
539
|
+
if (!isRelativeSpecifier(options.specifier)) return null;
|
|
540
|
+
const resolvedSpecifierPath = posix.resolve(posix.dirname(options.containingFile), options.specifier);
|
|
541
|
+
for (const candidatePath of candidatePathsForBasePath(resolvedSpecifierPath, options.extensions)) {
|
|
542
|
+
const resolvedPath = resolveExistingFilePath(candidatePath);
|
|
543
|
+
if (resolvedPath) return resolvedPath;
|
|
544
|
+
}
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
547
|
+
function resolvePathMappedModuleCandidate(options) {
|
|
548
|
+
const paths = options.compilerOptions.paths;
|
|
549
|
+
const pathsBasePath = getPathsBasePath(options.compilerOptions);
|
|
550
|
+
if (!paths || !pathsBasePath) return null;
|
|
551
|
+
const pathEntries = Object.entries(paths).sort(([left], [right]) => {
|
|
552
|
+
const leftPrefixLength = left.split("*")[0]?.length ?? left.length;
|
|
553
|
+
return (right.split("*")[0]?.length ?? right.length) - leftPrefixLength;
|
|
554
|
+
});
|
|
555
|
+
for (const [alias, targets] of pathEntries) {
|
|
556
|
+
const matchedText = matchPathPattern(alias, options.specifier);
|
|
557
|
+
if (matchedText === null) continue;
|
|
558
|
+
for (const target of targets) {
|
|
559
|
+
const resolvedTargetPath = posix.resolve(pathsBasePath, applyPathPattern(target, matchedText));
|
|
560
|
+
for (const candidatePath of candidatePathsForBasePath(resolvedTargetPath, options.extensions)) {
|
|
561
|
+
const resolvedPath = resolveExistingFilePath(candidatePath);
|
|
562
|
+
if (resolvedPath) return resolvedPath;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
return null;
|
|
567
|
+
}
|
|
568
|
+
function resolveBaseUrlModuleCandidate(options) {
|
|
569
|
+
if (isRelativeSpecifier(options.specifier) || !options.compilerOptions.baseUrl) return null;
|
|
570
|
+
const baseUrlPath = posix.resolve(options.compilerOptions.baseUrl, options.specifier);
|
|
571
|
+
for (const candidatePath of candidatePathsForBasePath(baseUrlPath, options.extensions)) {
|
|
572
|
+
const resolvedPath = resolveExistingFilePath(candidatePath);
|
|
573
|
+
if (resolvedPath) return resolvedPath;
|
|
574
|
+
}
|
|
575
|
+
return null;
|
|
576
|
+
}
|
|
577
|
+
function applyPathPattern(pattern, matchedText) {
|
|
578
|
+
return pattern.includes("*") ? pattern.replace("*", matchedText) : pattern;
|
|
579
|
+
}
|
|
580
|
+
function getPathsBasePath(compilerOptions) {
|
|
581
|
+
const pathsBasePath = compilerOptions.pathsBasePath;
|
|
582
|
+
if (typeof pathsBasePath === "string") return pathsBasePath;
|
|
583
|
+
return compilerOptions.baseUrl ?? null;
|
|
584
|
+
}
|
|
585
|
+
|
|
479
586
|
//#endregion
|
|
480
587
|
//#region src/checkers.ts
|
|
481
588
|
function getTypeScriptExtensionApi() {
|
|
@@ -499,6 +606,12 @@ function getNativeTypeScriptProjectExtensions() {
|
|
|
499
606
|
};
|
|
500
607
|
return normalizeExtensions(flattenTypeScriptExtensionGroups(api.getSupportedExtensionsWithJsonIfResolveJsonModule(options, api.getSupportedExtensions(options))));
|
|
501
608
|
}
|
|
609
|
+
function getBuildCheckerSupportedExtensions(preset) {
|
|
610
|
+
const adapter = getCheckerAdapter(preset);
|
|
611
|
+
if (!adapter || adapter.execution !== "build") return [];
|
|
612
|
+
const nativeExtensions = getNativeTypeScriptProjectExtensions();
|
|
613
|
+
return preset === "vue-tsc" ? normalizeExtensions([...nativeExtensions, ".vue"]) : nativeExtensions;
|
|
614
|
+
}
|
|
502
615
|
function getSvelteCheckerExtensions() {
|
|
503
616
|
return normalizeExtensions([...getTypeScriptCheckerExtensions(), ".svelte"]);
|
|
504
617
|
}
|
|
@@ -539,7 +652,7 @@ function cloneParsedCheckerProjectConfig(parsedConfig) {
|
|
|
539
652
|
};
|
|
540
653
|
}
|
|
541
654
|
function resolveContextCheckerPresets(context) {
|
|
542
|
-
return context.checkerPresets.length > 0 ?
|
|
655
|
+
return context.checkerPresets.length > 0 ? uniqueSortedStrings(context.checkerPresets) : ["tsc"];
|
|
543
656
|
}
|
|
544
657
|
function createParsedProjectConfigCacheKey(options) {
|
|
545
658
|
const configStat = statSync(options.configPath);
|
|
@@ -552,6 +665,9 @@ function createParsedProjectConfigCacheKey(options) {
|
|
|
552
665
|
projectRootDir: normalizeAbsolutePath(options.projectRootDir)
|
|
553
666
|
});
|
|
554
667
|
}
|
|
668
|
+
function clearCheckerProjectConfigCache() {
|
|
669
|
+
parsedProjectConfigCache.clear();
|
|
670
|
+
}
|
|
555
671
|
function createExtraFileExtensions(extensions) {
|
|
556
672
|
const nativeExtensions = new Set(getNativeTypeScriptProjectExtensions());
|
|
557
673
|
return extensions.filter((extension) => !nativeExtensions.has(extension)).map((extension) => ({
|
|
@@ -681,67 +797,6 @@ function resolveExtensionsForChecker(options, extensions) {
|
|
|
681
797
|
function resolveVueProjectExtensionsForChecker(options, packageName) {
|
|
682
798
|
return normalizeExtensions([...options.extensions ?? [], ...resolveVueProjectExtensions(options, packageName)]);
|
|
683
799
|
}
|
|
684
|
-
function isRelativeSpecifier(specifier) {
|
|
685
|
-
return specifier === "." || specifier === ".." || specifier.startsWith("./") || specifier.startsWith("../");
|
|
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);
|
|
698
|
-
}
|
|
699
|
-
function resolveRelativeModuleCandidate(options) {
|
|
700
|
-
if (!isRelativeSpecifier(options.specifier)) return null;
|
|
701
|
-
const resolvedSpecifierPath = posix.resolve(posix.dirname(options.containingFile), options.specifier);
|
|
702
|
-
for (const candidatePath of candidatePathsForBasePath(resolvedSpecifierPath, options.extensions)) {
|
|
703
|
-
const resolvedPath = resolveCandidatePath(candidatePath);
|
|
704
|
-
if (resolvedPath) return resolvedPath;
|
|
705
|
-
}
|
|
706
|
-
return null;
|
|
707
|
-
}
|
|
708
|
-
function matchPathPattern(pattern, specifier) {
|
|
709
|
-
const wildcardIndex = pattern.indexOf("*");
|
|
710
|
-
if (wildcardIndex === -1) return pattern === specifier ? "" : null;
|
|
711
|
-
const prefix = pattern.slice(0, wildcardIndex);
|
|
712
|
-
const suffix = pattern.slice(wildcardIndex + 1);
|
|
713
|
-
if (!specifier.startsWith(prefix) || !specifier.endsWith(suffix)) return null;
|
|
714
|
-
return specifier.slice(prefix.length, specifier.length - suffix.length);
|
|
715
|
-
}
|
|
716
|
-
function applyPathPattern(pattern, matchedText) {
|
|
717
|
-
return pattern.includes("*") ? pattern.replace("*", matchedText) : pattern;
|
|
718
|
-
}
|
|
719
|
-
function getPathsBasePath(compilerOptions) {
|
|
720
|
-
const pathsBasePath = compilerOptions.pathsBasePath;
|
|
721
|
-
if (typeof pathsBasePath === "string") return pathsBasePath;
|
|
722
|
-
return compilerOptions.baseUrl ?? null;
|
|
723
|
-
}
|
|
724
|
-
function resolvePathMappedModuleCandidate(options) {
|
|
725
|
-
const paths = options.compilerOptions.paths;
|
|
726
|
-
const pathsBasePath = getPathsBasePath(options.compilerOptions);
|
|
727
|
-
if (!paths || !pathsBasePath) return null;
|
|
728
|
-
const pathEntries = Object.entries(paths).sort(([left], [right]) => {
|
|
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;
|
|
744
|
-
}
|
|
745
800
|
function resolveTypeScriptModuleName(options) {
|
|
746
801
|
const resolved = ts.resolveModuleName(options.specifier, options.containingFile, options.compilerOptions, ts.sys).resolvedModule;
|
|
747
802
|
if (resolved?.resolvedFileName) return normalizeAbsolutePath(resolved.resolvedFileName);
|
|
@@ -752,7 +807,7 @@ function mergeParsedProjectConfigs(parsedConfigs, extensions) {
|
|
|
752
807
|
if (!firstConfig) throw new Error("Unable to parse checker project config: no parser ran.");
|
|
753
808
|
return {
|
|
754
809
|
extensions: normalizeExtensions([...extensions, ...parsedConfigs.flatMap((parsedConfig) => parsedConfig.extensions)]),
|
|
755
|
-
fileNames:
|
|
810
|
+
fileNames: uniqueSortedStrings(parsedConfigs.flatMap((parsedConfig) => parsedConfig.fileNames)),
|
|
756
811
|
options: firstConfig.options
|
|
757
812
|
};
|
|
758
813
|
}
|
|
@@ -808,10 +863,11 @@ function createTscCommandTarget(options) {
|
|
|
808
863
|
"-b",
|
|
809
864
|
relativeConfigPath,
|
|
810
865
|
"--pretty",
|
|
811
|
-
"false"
|
|
866
|
+
"false",
|
|
867
|
+
...options.watch ? ["--watch", "--preserveWatchOutput"] : []
|
|
812
868
|
],
|
|
813
869
|
command: options.commandOverride ?? "tsc",
|
|
814
|
-
label: `tsc -b ${relativeConfigPath}`
|
|
870
|
+
label: `tsc -b ${relativeConfigPath}${options.watch ? " --watch" : ""}`
|
|
815
871
|
};
|
|
816
872
|
}
|
|
817
873
|
function createTsgoCommandTarget(options) {
|
|
@@ -821,10 +877,11 @@ function createTsgoCommandTarget(options) {
|
|
|
821
877
|
"-b",
|
|
822
878
|
relativeConfigPath,
|
|
823
879
|
"--pretty",
|
|
824
|
-
"false"
|
|
880
|
+
"false",
|
|
881
|
+
...options.watch ? ["--watch", "--preserveWatchOutput"] : []
|
|
825
882
|
],
|
|
826
883
|
command: "tsgo",
|
|
827
|
-
label: `tsgo -b ${relativeConfigPath}`
|
|
884
|
+
label: `tsgo -b ${relativeConfigPath}${options.watch ? " --watch" : ""}`
|
|
828
885
|
};
|
|
829
886
|
}
|
|
830
887
|
function createVueTscCommandTarget(options) {
|
|
@@ -834,10 +891,11 @@ function createVueTscCommandTarget(options) {
|
|
|
834
891
|
"-b",
|
|
835
892
|
relativeConfigPath,
|
|
836
893
|
"--pretty",
|
|
837
|
-
"false"
|
|
894
|
+
"false",
|
|
895
|
+
...options.watch ? ["--watch", "--preserveWatchOutput"] : []
|
|
838
896
|
],
|
|
839
897
|
command: "vue-tsc",
|
|
840
|
-
label: `${options.checker.name}: vue-tsc -b ${relativeConfigPath}`
|
|
898
|
+
label: `${options.checker.name}: vue-tsc -b ${relativeConfigPath}${options.watch ? " --watch" : ""}`
|
|
841
899
|
};
|
|
842
900
|
}
|
|
843
901
|
function createVueTsgoCommandTarget(options) {
|
|
@@ -900,7 +958,7 @@ const builtinCheckerAdapters = {
|
|
|
900
958
|
createCommandTarget: createVueTscCommandTarget,
|
|
901
959
|
extensions: (options) => resolveVueProjectExtensionsForChecker(options, "vue-tsc"),
|
|
902
960
|
execution: "build",
|
|
903
|
-
packageNames: ["vue-tsc"
|
|
961
|
+
packageNames: ["vue-tsc"],
|
|
904
962
|
parseProjectConfig: (options) => parseVueProjectConfig(options, "vue-tsc"),
|
|
905
963
|
preset: "vue-tsc",
|
|
906
964
|
resolveModuleName: resolveTypeScriptModuleName,
|
|
@@ -962,7 +1020,8 @@ function formatMissingCheckerPeerDependencies(missingDependencies) {
|
|
|
962
1020
|
"Missing checker peer dependencies:",
|
|
963
1021
|
...missingDependencies.map((dependency) => {
|
|
964
1022
|
const checkerList = dependency.checkerNames.map((checkerName) => `"${checkerName}"`).join(", ");
|
|
965
|
-
|
|
1023
|
+
const reason = dependency.reason ? `; ${dependency.reason}` : "";
|
|
1024
|
+
return ` - ${dependency.packageName} (used by checker ${checkerList}${reason})`;
|
|
966
1025
|
}),
|
|
967
1026
|
`Fix: pnpm add -D ${packageNames.join(" ")}`
|
|
968
1027
|
].join("\n");
|
|
@@ -970,19 +1029,9 @@ function formatMissingCheckerPeerDependencies(missingDependencies) {
|
|
|
970
1029
|
function getCheckerExtensions(checker, options = {}) {
|
|
971
1030
|
const adapter = getCheckerAdapter(checker.preset);
|
|
972
1031
|
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
|
-
}
|
|
1032
|
+
if (isVueCheckerPreset(checker.preset)) return normalizeExtensions([...getTypeScriptCheckerExtensions(), ".vue"]);
|
|
984
1033
|
return adapter.extensions({
|
|
985
|
-
configPath: normalizeAbsolutePath(posix.resolve(options.projectRootDir ?? "",
|
|
1034
|
+
configPath: normalizeAbsolutePath(posix.resolve(options.projectRootDir ?? "", "tsconfig.json")),
|
|
986
1035
|
projectRootDir: options.projectRootDir ?? ""
|
|
987
1036
|
});
|
|
988
1037
|
}
|
|
@@ -990,21 +1039,40 @@ function getCheckerExtensions(checker, options = {}) {
|
|
|
990
1039
|
}
|
|
991
1040
|
function getResolvedCheckers(config) {
|
|
992
1041
|
const checkers = config.config?.checkers;
|
|
993
|
-
if (!checkers) return [];
|
|
994
|
-
|
|
995
|
-
|
|
1042
|
+
if (!checkers || checkers.mode === "auto") return [];
|
|
1043
|
+
const checkerMap = checkers;
|
|
1044
|
+
return Object.entries(checkerMap).map(([name, checker]) => ({
|
|
1045
|
+
exclude: (checker.exclude ?? []).map((value) => value.trim()),
|
|
996
1046
|
extensions: getCheckerExtensions(checker, { projectRootDir: config.rootDir }),
|
|
1047
|
+
include: checker.include.map((value) => value.trim()),
|
|
997
1048
|
name,
|
|
998
1049
|
preset: checker.preset
|
|
999
1050
|
})).sort((left, right) => left.name.localeCompare(right.name));
|
|
1000
1051
|
}
|
|
1001
1052
|
function normalizeExtensions(extensions) {
|
|
1002
|
-
return
|
|
1053
|
+
return uniqueValues(extensions).sort((left, right) => {
|
|
1003
1054
|
const lengthDelta = right.length - left.length;
|
|
1004
1055
|
return lengthDelta === 0 ? left.localeCompare(right) : lengthDelta;
|
|
1005
1056
|
});
|
|
1006
1057
|
}
|
|
1007
1058
|
|
|
1059
|
+
//#endregion
|
|
1060
|
+
//#region src/utils/values.ts
|
|
1061
|
+
function isPlainRecord(value) {
|
|
1062
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1063
|
+
}
|
|
1064
|
+
function isNonEmptyString(value) {
|
|
1065
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
1066
|
+
}
|
|
1067
|
+
function formatUnknownValue(value) {
|
|
1068
|
+
if (value === void 0) return "undefined";
|
|
1069
|
+
try {
|
|
1070
|
+
return JSON.stringify(value) ?? String(value);
|
|
1071
|
+
} catch {
|
|
1072
|
+
return String(value);
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1008
1076
|
//#endregion
|
|
1009
1077
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js
|
|
1010
1078
|
/** A special constant with type `never` */
|
|
@@ -1130,9 +1198,6 @@ function mergeDefs(...defs) {
|
|
|
1130
1198
|
function esc(str) {
|
|
1131
1199
|
return JSON.stringify(str);
|
|
1132
1200
|
}
|
|
1133
|
-
function slugify(input) {
|
|
1134
|
-
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1135
|
-
}
|
|
1136
1201
|
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
1137
1202
|
function isObject(data) {
|
|
1138
1203
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
@@ -1530,64 +1595,6 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
1530
1595
|
};
|
|
1531
1596
|
const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
1532
1597
|
|
|
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
1598
|
//#endregion
|
|
1592
1599
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js
|
|
1593
1600
|
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
@@ -1684,123 +1691,6 @@ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEqual
|
|
|
1684
1691
|
});
|
|
1685
1692
|
};
|
|
1686
1693
|
});
|
|
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
1694
|
const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
1805
1695
|
$ZodCheck.init(inst, def);
|
|
1806
1696
|
inst._zod.check = (payload) => {
|
|
@@ -1938,16 +1828,15 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1938
1828
|
version: 1
|
|
1939
1829
|
}));
|
|
1940
1830
|
});
|
|
1941
|
-
const $
|
|
1831
|
+
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
1942
1832
|
$ZodType.init(inst, def);
|
|
1943
|
-
inst._zod.
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
if (typeof payload.value === "string") return payload;
|
|
1833
|
+
inst._zod.parse = (payload) => payload;
|
|
1834
|
+
});
|
|
1835
|
+
const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
1836
|
+
$ZodType.init(inst, def);
|
|
1837
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1949
1838
|
payload.issues.push({
|
|
1950
|
-
expected: "
|
|
1839
|
+
expected: "never",
|
|
1951
1840
|
code: "invalid_type",
|
|
1952
1841
|
input: payload.value,
|
|
1953
1842
|
inst
|
|
@@ -1955,301 +1844,22 @@ const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
|
1955
1844
|
return payload;
|
|
1956
1845
|
};
|
|
1957
1846
|
});
|
|
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 (_) {
|
|
1847
|
+
function handleArrayResult(result, final, index) {
|
|
1848
|
+
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
1849
|
+
final.value[index] = result.value;
|
|
1850
|
+
}
|
|
1851
|
+
const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
1852
|
+
$ZodType.init(inst, def);
|
|
1853
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1854
|
+
const input = payload.value;
|
|
1855
|
+
if (!Array.isArray(input)) {
|
|
2021
1856
|
payload.issues.push({
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
input
|
|
2025
|
-
inst
|
|
2026
|
-
continue: !def.abort
|
|
1857
|
+
expected: "array",
|
|
1858
|
+
code: "invalid_type",
|
|
1859
|
+
input,
|
|
1860
|
+
inst
|
|
2027
1861
|
});
|
|
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)) {
|
|
2246
|
-
payload.issues.push({
|
|
2247
|
-
expected: "array",
|
|
2248
|
-
code: "invalid_type",
|
|
2249
|
-
input,
|
|
2250
|
-
inst
|
|
2251
|
-
});
|
|
2252
|
-
return payload;
|
|
1862
|
+
return payload;
|
|
2253
1863
|
}
|
|
2254
1864
|
payload.value = Array(input.length);
|
|
2255
1865
|
const proms = [];
|
|
@@ -2622,97 +2232,6 @@ function handleIntersectionResults(result, left, right) {
|
|
|
2622
2232
|
result.value = merged.data;
|
|
2623
2233
|
return result;
|
|
2624
2234
|
}
|
|
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
2235
|
const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
2717
2236
|
$ZodType.init(inst, def);
|
|
2718
2237
|
const values = getEnumValues(def.entries);
|
|
@@ -2992,294 +2511,17 @@ var $ZodRegistry = class {
|
|
|
2992
2511
|
return this._map.get(schema);
|
|
2993
2512
|
}
|
|
2994
2513
|
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
|
-
});
|
|
2514
|
+
return this._map.has(schema);
|
|
2515
|
+
}
|
|
2516
|
+
};
|
|
2517
|
+
function registry() {
|
|
2518
|
+
return new $ZodRegistry();
|
|
3282
2519
|
}
|
|
2520
|
+
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
2521
|
+
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2522
|
+
|
|
2523
|
+
//#endregion
|
|
2524
|
+
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
|
|
3283
2525
|
/* @__NO_SIDE_EFFECTS__ */
|
|
3284
2526
|
function _unknown(Class) {
|
|
3285
2527
|
return new Class({ type: "unknown" });
|
|
@@ -3316,58 +2558,6 @@ function _length(length, params) {
|
|
|
3316
2558
|
});
|
|
3317
2559
|
}
|
|
3318
2560
|
/* @__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
2561
|
function _overwrite(tx) {
|
|
3372
2562
|
return new $ZodCheckOverwrite({
|
|
3373
2563
|
check: "overwrite",
|
|
@@ -3375,26 +2565,6 @@ function _overwrite(tx) {
|
|
|
3375
2565
|
});
|
|
3376
2566
|
}
|
|
3377
2567
|
/* @__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
2568
|
function _array(Class, element, params) {
|
|
3399
2569
|
return new Class({
|
|
3400
2570
|
type: "array",
|
|
@@ -3754,37 +2924,6 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
3754
2924
|
|
|
3755
2925
|
//#endregion
|
|
3756
2926
|
//#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
2927
|
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
3789
2928
|
json.not = {};
|
|
3790
2929
|
};
|
|
@@ -3878,39 +3017,6 @@ const intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
3878
3017
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
3879
3018
|
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
3880
3019
|
};
|
|
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
3020
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
3915
3021
|
const def = schema._zod.def;
|
|
3916
3022
|
const inner = process$1(def.innerType, ctx, params);
|
|
@@ -3974,37 +3080,6 @@ const optionalProcessor = (schema, ctx, _json, params) => {
|
|
|
3974
3080
|
seen.ref = def.innerType;
|
|
3975
3081
|
};
|
|
3976
3082
|
|
|
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
3083
|
//#endregion
|
|
4009
3084
|
//#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js
|
|
4010
3085
|
const initializer = (inst, issues) => {
|
|
@@ -4122,153 +3197,6 @@ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
4122
3197
|
inst.apply = (fn) => fn(inst);
|
|
4123
3198
|
return inst;
|
|
4124
3199
|
});
|
|
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
3200
|
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
4273
3201
|
$ZodUnknown.init(inst, def);
|
|
4274
3202
|
ZodType.init(inst, def);
|
|
@@ -4372,21 +3300,6 @@ function intersection(left, right) {
|
|
|
4372
3300
|
right
|
|
4373
3301
|
});
|
|
4374
3302
|
}
|
|
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
3303
|
const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
4391
3304
|
$ZodEnum.init(inst, def);
|
|
4392
3305
|
ZodType.init(inst, def);
|
|
@@ -4591,16 +3504,26 @@ const describe = describe$1;
|
|
|
4591
3504
|
const meta = meta$1;
|
|
4592
3505
|
|
|
4593
3506
|
//#endregion
|
|
4594
|
-
//#region src/config.ts
|
|
4595
|
-
function defineConfig(config) {
|
|
4596
|
-
return config;
|
|
4597
|
-
}
|
|
3507
|
+
//#region src/config/schema.ts
|
|
4598
3508
|
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
|
|
3509
|
+
const checkerRoutesConfigReason = "checker routes are not supported; configure checker.include with source tsconfig selectors.";
|
|
3510
|
+
const unsupportedCheckerPresetReason = "configured checkers require a built-in checker adapter.";
|
|
3511
|
+
const checkerEntryConfigReason = "checker.entry has been removed; configure checker.include with source tsconfig selectors.";
|
|
3512
|
+
const checkerConfigReason = "config.checkers must be an object auto config or an object keyed by checker name.";
|
|
3513
|
+
const checkerAutoStringConfigReason = "checkers: \"auto\" has been removed; omit config.checkers or use { mode: \"auto\" }.";
|
|
3514
|
+
const autoCheckerMixedConfigReason = "auto checker config must not be mixed with named checker entries.";
|
|
3515
|
+
const autoCheckerModeConfigReason = "auto checker config requires mode: \"auto\".";
|
|
3516
|
+
const importAnalysisConfigReason = "config.imports must be an object when configured.";
|
|
3517
|
+
const vueImportParserConfigReason = "config.imports.vue must be \"heuristic\" or \"compiler-sfc\".";
|
|
4601
3518
|
const checkerConfigShapeSchema = looseObject({}).superRefine((checker, ctx) => {
|
|
4602
3519
|
const preset = checker.preset;
|
|
4603
|
-
const
|
|
3520
|
+
const include = checker.include;
|
|
3521
|
+
const exclude = checker.exclude;
|
|
3522
|
+
if (Object.hasOwn(checker, "entry")) ctx.addIssue({
|
|
3523
|
+
code: "custom",
|
|
3524
|
+
message: checkerEntryConfigReason,
|
|
3525
|
+
path: ["entry"]
|
|
3526
|
+
});
|
|
4604
3527
|
if (Object.hasOwn(checker, "extensions")) ctx.addIssue({
|
|
4605
3528
|
code: "custom",
|
|
4606
3529
|
message: checkerExtensionsConfigReason,
|
|
@@ -4621,25 +3544,120 @@ const checkerConfigShapeSchema = looseObject({}).superRefine((checker, ctx) => {
|
|
|
4621
3544
|
message: unsupportedCheckerPresetReason,
|
|
4622
3545
|
path: ["preset"]
|
|
4623
3546
|
});
|
|
4624
|
-
if (
|
|
3547
|
+
if (!Array.isArray(include) || include.length === 0) ctx.addIssue({
|
|
4625
3548
|
code: "custom",
|
|
4626
|
-
message: "checker
|
|
4627
|
-
path: ["
|
|
3549
|
+
message: "checker include must be a non-empty string array.",
|
|
3550
|
+
path: ["include"]
|
|
3551
|
+
});
|
|
3552
|
+
else for (const [index, value] of include.entries()) if (typeof value !== "string" || value.trim().length === 0) ctx.addIssue({
|
|
3553
|
+
code: "custom",
|
|
3554
|
+
message: "checker include entries must be non-empty string paths.",
|
|
3555
|
+
path: ["include", index]
|
|
3556
|
+
});
|
|
3557
|
+
if (exclude === void 0) return;
|
|
3558
|
+
if (!Array.isArray(exclude)) {
|
|
3559
|
+
ctx.addIssue({
|
|
3560
|
+
code: "custom",
|
|
3561
|
+
message: "checker exclude must be a string array when configured.",
|
|
3562
|
+
path: ["exclude"]
|
|
3563
|
+
});
|
|
3564
|
+
return;
|
|
3565
|
+
}
|
|
3566
|
+
for (const [index, value] of exclude.entries()) if (typeof value !== "string" || value.trim().length === 0) ctx.addIssue({
|
|
3567
|
+
code: "custom",
|
|
3568
|
+
message: "checker exclude entries must be non-empty string paths.",
|
|
3569
|
+
path: ["exclude", index]
|
|
4628
3570
|
});
|
|
4629
3571
|
});
|
|
4630
|
-
|
|
3572
|
+
function isPlainConfigRecord(value) {
|
|
3573
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
3574
|
+
}
|
|
3575
|
+
const sharedLiminaConfigShapeSchema = looseObject({}).superRefine((sharedConfig, ctx) => {
|
|
3576
|
+
const checkers = sharedConfig.checkers;
|
|
3577
|
+
const imports = sharedConfig.imports;
|
|
4631
3578
|
const source = sharedConfig.source;
|
|
4632
|
-
if (
|
|
4633
|
-
const sourceRecord = source;
|
|
4634
|
-
if (Object.hasOwn(sourceRecord, "tsconfigOwnership")) ctx.addIssue({
|
|
3579
|
+
if (checkers !== void 0) if (checkers === "auto") ctx.addIssue({
|
|
4635
3580
|
code: "custom",
|
|
4636
|
-
message:
|
|
4637
|
-
path: [
|
|
4638
|
-
"source",
|
|
4639
|
-
"tsconfigOwnership",
|
|
4640
|
-
"ignore"
|
|
4641
|
-
]
|
|
3581
|
+
message: checkerAutoStringConfigReason,
|
|
3582
|
+
path: ["checkers"]
|
|
4642
3583
|
});
|
|
3584
|
+
else if (!isPlainConfigRecord(checkers)) ctx.addIssue({
|
|
3585
|
+
code: "custom",
|
|
3586
|
+
message: checkerConfigReason,
|
|
3587
|
+
path: ["checkers"]
|
|
3588
|
+
});
|
|
3589
|
+
else if (Object.hasOwn(checkers, "mode")) {
|
|
3590
|
+
if (checkers.mode !== "auto") ctx.addIssue({
|
|
3591
|
+
code: "custom",
|
|
3592
|
+
message: autoCheckerModeConfigReason,
|
|
3593
|
+
path: ["checkers", "mode"]
|
|
3594
|
+
});
|
|
3595
|
+
const exclude = checkers.exclude;
|
|
3596
|
+
if (exclude !== void 0 && !Array.isArray(exclude)) ctx.addIssue({
|
|
3597
|
+
code: "custom",
|
|
3598
|
+
message: "auto checker exclude must be a string array when configured.",
|
|
3599
|
+
path: ["checkers", "exclude"]
|
|
3600
|
+
});
|
|
3601
|
+
else if (Array.isArray(exclude)) {
|
|
3602
|
+
for (const [index, value] of exclude.entries()) if (typeof value !== "string" || value.trim().length === 0) ctx.addIssue({
|
|
3603
|
+
code: "custom",
|
|
3604
|
+
message: "auto checker exclude entries must be non-empty string paths.",
|
|
3605
|
+
path: [
|
|
3606
|
+
"checkers",
|
|
3607
|
+
"exclude",
|
|
3608
|
+
index
|
|
3609
|
+
]
|
|
3610
|
+
});
|
|
3611
|
+
}
|
|
3612
|
+
for (const key of Object.keys(checkers)) {
|
|
3613
|
+
if (key === "mode" || key === "exclude") continue;
|
|
3614
|
+
ctx.addIssue({
|
|
3615
|
+
code: "custom",
|
|
3616
|
+
message: autoCheckerMixedConfigReason,
|
|
3617
|
+
path: ["checkers", key]
|
|
3618
|
+
});
|
|
3619
|
+
}
|
|
3620
|
+
} else for (const [checkerName, checker] of Object.entries(checkers)) {
|
|
3621
|
+
const result = checkerConfigShapeSchema.safeParse(checker);
|
|
3622
|
+
if (result.success) continue;
|
|
3623
|
+
for (const issue of result.error.issues) ctx.addIssue({
|
|
3624
|
+
...issue,
|
|
3625
|
+
path: [
|
|
3626
|
+
"checkers",
|
|
3627
|
+
checkerName,
|
|
3628
|
+
...issue.path
|
|
3629
|
+
]
|
|
3630
|
+
});
|
|
3631
|
+
}
|
|
3632
|
+
if (imports !== void 0) {
|
|
3633
|
+
if (!isPlainConfigRecord(imports)) ctx.addIssue({
|
|
3634
|
+
code: "custom",
|
|
3635
|
+
message: importAnalysisConfigReason,
|
|
3636
|
+
path: ["imports"]
|
|
3637
|
+
});
|
|
3638
|
+
else if (imports.vue !== void 0 && imports.vue !== "heuristic" && imports.vue !== "compiler-sfc") ctx.addIssue({
|
|
3639
|
+
code: "custom",
|
|
3640
|
+
message: vueImportParserConfigReason,
|
|
3641
|
+
path: ["imports", "vue"]
|
|
3642
|
+
});
|
|
3643
|
+
}
|
|
3644
|
+
if (source === void 0) return;
|
|
3645
|
+
if (!isPlainConfigRecord(source)) {
|
|
3646
|
+
ctx.addIssue({
|
|
3647
|
+
code: "custom",
|
|
3648
|
+
message: "source boundary config must be an object.",
|
|
3649
|
+
path: ["source"]
|
|
3650
|
+
});
|
|
3651
|
+
return;
|
|
3652
|
+
}
|
|
3653
|
+
for (const key of Object.keys(source)) {
|
|
3654
|
+
if (key === "include" || key === "exclude") continue;
|
|
3655
|
+
ctx.addIssue({
|
|
3656
|
+
code: "custom",
|
|
3657
|
+
message: "unknown source boundary config field.",
|
|
3658
|
+
path: ["source", key]
|
|
3659
|
+
});
|
|
3660
|
+
}
|
|
4643
3661
|
});
|
|
4644
3662
|
const releaseContentHashShapeSchema = looseObject({}).superRefine((contentHash, ctx) => {
|
|
4645
3663
|
const baselineTag = contentHash.baselineTag;
|
|
@@ -4674,22 +3692,174 @@ const releaseContentHashShapeSchema = looseObject({}).superRefine((contentHash,
|
|
|
4674
3692
|
}
|
|
4675
3693
|
});
|
|
4676
3694
|
const releaseConfigShapeSchema = looseObject({ contentHash: releaseContentHashShapeSchema.optional() });
|
|
3695
|
+
const executionConcurrencyFields = [
|
|
3696
|
+
"tasks",
|
|
3697
|
+
"checkerBuild",
|
|
3698
|
+
"checkerTypecheck",
|
|
3699
|
+
"packageEntries",
|
|
3700
|
+
"releaseEntries"
|
|
3701
|
+
];
|
|
3702
|
+
function isValidExecutionConcurrencyValue(value) {
|
|
3703
|
+
return value === "auto" || typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
3704
|
+
}
|
|
3705
|
+
const executionConfigShapeSchema = looseObject({}).superRefine((execution, ctx) => {
|
|
3706
|
+
for (const key of Object.keys(execution)) {
|
|
3707
|
+
if (key === "failFast" || executionConcurrencyFields.includes(key)) continue;
|
|
3708
|
+
ctx.addIssue({
|
|
3709
|
+
code: "custom",
|
|
3710
|
+
message: "unknown execution config field.",
|
|
3711
|
+
path: [key]
|
|
3712
|
+
});
|
|
3713
|
+
}
|
|
3714
|
+
for (const key of executionConcurrencyFields) {
|
|
3715
|
+
const value = execution[key];
|
|
3716
|
+
if (value === void 0 || isValidExecutionConcurrencyValue(value)) continue;
|
|
3717
|
+
ctx.addIssue({
|
|
3718
|
+
code: "custom",
|
|
3719
|
+
message: "execution concurrency must be a positive integer or \"auto\".",
|
|
3720
|
+
path: [key]
|
|
3721
|
+
});
|
|
3722
|
+
}
|
|
3723
|
+
if (execution.failFast !== void 0 && typeof execution.failFast !== "boolean") ctx.addIssue({
|
|
3724
|
+
code: "custom",
|
|
3725
|
+
message: "execution failFast must be a boolean.",
|
|
3726
|
+
path: ["failFast"]
|
|
3727
|
+
});
|
|
3728
|
+
});
|
|
3729
|
+
function validateStringArrayField(options) {
|
|
3730
|
+
if (options.value === void 0) {
|
|
3731
|
+
if (options.required) options.ctx.addIssue({
|
|
3732
|
+
code: "custom",
|
|
3733
|
+
message: `${options.valueName} must be a non-empty string array.`,
|
|
3734
|
+
path: options.path
|
|
3735
|
+
});
|
|
3736
|
+
return false;
|
|
3737
|
+
}
|
|
3738
|
+
if (!Array.isArray(options.value) || options.value.length === 0) {
|
|
3739
|
+
options.ctx.addIssue({
|
|
3740
|
+
code: "custom",
|
|
3741
|
+
message: `${options.valueName} must be a non-empty string array.`,
|
|
3742
|
+
path: options.path
|
|
3743
|
+
});
|
|
3744
|
+
return false;
|
|
3745
|
+
}
|
|
3746
|
+
for (const [index, item] of options.value.entries()) {
|
|
3747
|
+
if (typeof item === "string" && item.trim().length > 0) continue;
|
|
3748
|
+
options.ctx.addIssue({
|
|
3749
|
+
code: "custom",
|
|
3750
|
+
message: `${options.valueName} entries must be non-empty strings.`,
|
|
3751
|
+
path: [...options.path, index]
|
|
3752
|
+
});
|
|
3753
|
+
}
|
|
3754
|
+
return true;
|
|
3755
|
+
}
|
|
3756
|
+
function validateSourceImportAuthorityConfig(value, ctx) {
|
|
3757
|
+
if (value === void 0) return;
|
|
3758
|
+
if (!isPlainConfigRecord(value)) {
|
|
3759
|
+
ctx.addIssue({
|
|
3760
|
+
code: "custom",
|
|
3761
|
+
message: "importAuthority must be an object.",
|
|
3762
|
+
path: ["source", "importAuthority"]
|
|
3763
|
+
});
|
|
3764
|
+
return;
|
|
3765
|
+
}
|
|
3766
|
+
const allow = value.allow;
|
|
3767
|
+
if (allow === void 0) return;
|
|
3768
|
+
if (!Array.isArray(allow)) {
|
|
3769
|
+
ctx.addIssue({
|
|
3770
|
+
code: "custom",
|
|
3771
|
+
message: "importAuthority.allow must be an array.",
|
|
3772
|
+
path: [
|
|
3773
|
+
"source",
|
|
3774
|
+
"importAuthority",
|
|
3775
|
+
"allow"
|
|
3776
|
+
]
|
|
3777
|
+
});
|
|
3778
|
+
return;
|
|
3779
|
+
}
|
|
3780
|
+
for (const [index, entry] of allow.entries()) {
|
|
3781
|
+
const path = [
|
|
3782
|
+
"source",
|
|
3783
|
+
"importAuthority",
|
|
3784
|
+
"allow",
|
|
3785
|
+
index
|
|
3786
|
+
];
|
|
3787
|
+
if (!isPlainConfigRecord(entry)) {
|
|
3788
|
+
ctx.addIssue({
|
|
3789
|
+
code: "custom",
|
|
3790
|
+
message: "importAuthority allow entries must be objects with files, packages or specifiers, and reason fields.",
|
|
3791
|
+
path
|
|
3792
|
+
});
|
|
3793
|
+
continue;
|
|
3794
|
+
}
|
|
3795
|
+
validateStringArrayField({
|
|
3796
|
+
ctx,
|
|
3797
|
+
path: [...path, "files"],
|
|
3798
|
+
required: true,
|
|
3799
|
+
value: entry.files,
|
|
3800
|
+
valueName: "files"
|
|
3801
|
+
});
|
|
3802
|
+
const hasPackages = validateStringArrayField({
|
|
3803
|
+
ctx,
|
|
3804
|
+
path: [...path, "packages"],
|
|
3805
|
+
value: entry.packages,
|
|
3806
|
+
valueName: "packages"
|
|
3807
|
+
});
|
|
3808
|
+
const hasSpecifiers = validateStringArrayField({
|
|
3809
|
+
ctx,
|
|
3810
|
+
path: [...path, "specifiers"],
|
|
3811
|
+
value: entry.specifiers,
|
|
3812
|
+
valueName: "specifiers"
|
|
3813
|
+
});
|
|
3814
|
+
if (!hasPackages && !hasSpecifiers) ctx.addIssue({
|
|
3815
|
+
code: "custom",
|
|
3816
|
+
message: "importAuthority allow entries must declare packages or specifiers.",
|
|
3817
|
+
path
|
|
3818
|
+
});
|
|
3819
|
+
if (entry.owner !== void 0) {
|
|
3820
|
+
if (typeof entry.owner !== "string" || entry.owner.trim().length === 0) ctx.addIssue({
|
|
3821
|
+
code: "custom",
|
|
3822
|
+
message: "owner must be a non-empty string when configured.",
|
|
3823
|
+
path: [...path, "owner"]
|
|
3824
|
+
});
|
|
3825
|
+
}
|
|
3826
|
+
if (typeof entry.reason !== "string" || entry.reason.trim().length === 0) ctx.addIssue({
|
|
3827
|
+
code: "custom",
|
|
3828
|
+
message: "reason must be a non-empty string.",
|
|
3829
|
+
path: [...path, "reason"]
|
|
3830
|
+
});
|
|
3831
|
+
}
|
|
3832
|
+
}
|
|
4677
3833
|
const liminaConfigShapeSchema = looseObject({
|
|
4678
|
-
strict: boolean().optional(),
|
|
4679
3834
|
config: sharedLiminaConfigShapeSchema.optional(),
|
|
3835
|
+
execution: executionConfigShapeSchema.optional(),
|
|
4680
3836
|
release: releaseConfigShapeSchema.optional()
|
|
4681
3837
|
}).superRefine((config, ctx) => {
|
|
4682
|
-
if (
|
|
4683
|
-
ctx.addIssue({
|
|
3838
|
+
if (Object.hasOwn(config, "paths")) ctx.addIssue({
|
|
4684
3839
|
code: "custom",
|
|
4685
3840
|
message: "paths config has been removed; use graph/proof/source checks instead.",
|
|
4686
3841
|
path: ["paths"]
|
|
4687
3842
|
});
|
|
3843
|
+
const source = config.source;
|
|
3844
|
+
if (source === void 0) return;
|
|
3845
|
+
if (!isPlainConfigRecord(source)) {
|
|
3846
|
+
ctx.addIssue({
|
|
3847
|
+
code: "custom",
|
|
3848
|
+
message: "source config must be an object.",
|
|
3849
|
+
path: ["source"]
|
|
3850
|
+
});
|
|
3851
|
+
return;
|
|
3852
|
+
}
|
|
3853
|
+
for (const key of Object.keys(source)) {
|
|
3854
|
+
if (key === "knip" || key === "importAuthority") continue;
|
|
3855
|
+
ctx.addIssue({
|
|
3856
|
+
code: "custom",
|
|
3857
|
+
message: "unknown source config field.",
|
|
3858
|
+
path: ["source", key]
|
|
3859
|
+
});
|
|
3860
|
+
}
|
|
3861
|
+
validateSourceImportAuthorityConfig(source.importAuthority, ctx);
|
|
4688
3862
|
});
|
|
4689
|
-
function formatUnknownValue(value) {
|
|
4690
|
-
if (value === void 0) return "undefined";
|
|
4691
|
-
return JSON.stringify(value);
|
|
4692
|
-
}
|
|
4693
3863
|
function formatZodPath(pathSegments) {
|
|
4694
3864
|
return pathSegments.map((segment) => typeof segment === "number" ? `[${segment}]` : `.${String(segment)}`).join("").replace(/^\./u, "");
|
|
4695
3865
|
}
|
|
@@ -4711,27 +3881,63 @@ function formatLiminaConfigShapeIssue(value, issue) {
|
|
|
4711
3881
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4712
3882
|
" reason: config must be an object."
|
|
4713
3883
|
].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
3884
|
if (field === "paths") return [
|
|
4721
3885
|
"Invalid Limina paths config:",
|
|
4722
3886
|
" field: paths",
|
|
4723
3887
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4724
3888
|
` reason: ${issue.message}`
|
|
4725
3889
|
].join("\n");
|
|
3890
|
+
if (field === "execution") return [
|
|
3891
|
+
"Invalid Limina execution config:",
|
|
3892
|
+
" field: execution",
|
|
3893
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
3894
|
+
" reason: execution must be an object."
|
|
3895
|
+
].join("\n");
|
|
3896
|
+
if (field === "execution.failFast") return [
|
|
3897
|
+
"Invalid Limina execution config:",
|
|
3898
|
+
" field: execution.failFast",
|
|
3899
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
3900
|
+
" reason: execution failFast must be a boolean."
|
|
3901
|
+
].join("\n");
|
|
3902
|
+
if (field.startsWith("execution.")) return [
|
|
3903
|
+
"Invalid Limina execution config:",
|
|
3904
|
+
` field: ${field}`,
|
|
3905
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
3906
|
+
` reason: ${issue.message}`
|
|
3907
|
+
].join("\n");
|
|
4726
3908
|
if (field === "config.checkers") return [
|
|
4727
3909
|
"Invalid Limina checker config:",
|
|
4728
3910
|
" field: config.checkers",
|
|
4729
3911
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4730
|
-
|
|
3912
|
+
` reason: ${issue.message}`
|
|
3913
|
+
].join("\n");
|
|
3914
|
+
if (field === "config.checkers.mode") return [
|
|
3915
|
+
"Invalid Limina checker config:",
|
|
3916
|
+
" field: config.checkers.mode",
|
|
3917
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
3918
|
+
` reason: ${issue.message}`
|
|
3919
|
+
].join("\n");
|
|
3920
|
+
if (field.startsWith("config.checkers.exclude")) return [
|
|
3921
|
+
"Invalid Limina checker config:",
|
|
3922
|
+
` field: ${field}`,
|
|
3923
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
3924
|
+
` reason: ${issue.message}`
|
|
3925
|
+
].join("\n");
|
|
3926
|
+
if (field === "config.imports" || field.startsWith("config.imports.")) return [
|
|
3927
|
+
"Invalid Limina import analysis config:",
|
|
3928
|
+
` field: ${field}`,
|
|
3929
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
3930
|
+
` reason: ${issue.message}`
|
|
3931
|
+
].join("\n");
|
|
3932
|
+
if (field === "config.source" || field.startsWith("config.source.")) return [
|
|
3933
|
+
"Invalid Limina source boundary config:",
|
|
3934
|
+
` field: ${field}`,
|
|
3935
|
+
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
3936
|
+
` reason: ${issue.message}`
|
|
4731
3937
|
].join("\n");
|
|
4732
|
-
if (field === "
|
|
3938
|
+
if (field === "source" || field.startsWith("source.")) return [
|
|
4733
3939
|
"Invalid Limina source config:",
|
|
4734
|
-
|
|
3940
|
+
` field: ${field}`,
|
|
4735
3941
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4736
3942
|
` reason: ${issue.message}`
|
|
4737
3943
|
].join("\n");
|
|
@@ -4742,7 +3948,7 @@ function formatLiminaConfigShapeIssue(value, issue) {
|
|
|
4742
3948
|
"Invalid Limina checker config:",
|
|
4743
3949
|
` field: ${checkerField}`,
|
|
4744
3950
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4745
|
-
|
|
3951
|
+
` reason: ${issue.message === autoCheckerMixedConfigReason ? issue.message : "checker entries must be objects."}`
|
|
4746
3952
|
].join("\n");
|
|
4747
3953
|
if (pathSegments[3] === "preset") {
|
|
4748
3954
|
if (issue.message === unsupportedCheckerPresetReason) return [
|
|
@@ -4762,7 +3968,7 @@ function formatLiminaConfigShapeIssue(value, issue) {
|
|
|
4762
3968
|
"Invalid Limina checker entry config:",
|
|
4763
3969
|
` field: ${checkerField}.entry`,
|
|
4764
3970
|
` value: ${formatUnknownValue(getValueAtPath(value, pathSegments))}`,
|
|
4765
|
-
|
|
3971
|
+
` reason: ${issue.message}`
|
|
4766
3972
|
].join("\n");
|
|
4767
3973
|
if (pathSegments[3] === "extensions") return [
|
|
4768
3974
|
"Invalid Limina checker config:",
|
|
@@ -4829,16 +4035,19 @@ function validateLiminaConfig(config) {
|
|
|
4829
4035
|
const problems = collectLiminaConfigShapeProblems(config);
|
|
4830
4036
|
if (problems.length > 0) throw new Error(problems.join("\n\n"));
|
|
4831
4037
|
}
|
|
4832
|
-
|
|
4833
|
-
|
|
4038
|
+
|
|
4039
|
+
//#endregion
|
|
4040
|
+
//#region src/config/runner.ts
|
|
4041
|
+
function isAutoCheckerConfigMode(checkers) {
|
|
4042
|
+
return Boolean(checkers && checkers.mode === "auto");
|
|
4043
|
+
}
|
|
4044
|
+
function defineConfig(config) {
|
|
4045
|
+
return config;
|
|
4834
4046
|
}
|
|
4835
4047
|
function getActiveCheckers(config) {
|
|
4836
4048
|
validateLiminaConfig(config);
|
|
4837
4049
|
return getResolvedCheckers(config);
|
|
4838
4050
|
}
|
|
4839
|
-
function getActiveCheckerExtensions(config) {
|
|
4840
|
-
return normalizeExtensions(getActiveCheckers(config).flatMap((checker) => checker.extensions));
|
|
4841
|
-
}
|
|
4842
4051
|
function normalizeConfig(value) {
|
|
4843
4052
|
const config = value;
|
|
4844
4053
|
validateLiminaConfig(config);
|
|
@@ -4884,18 +4093,33 @@ function validateConfigPathInsideWorkspace(configPath, rootDir) {
|
|
|
4884
4093
|
async function resolveConfigExport(configExport, configEnv) {
|
|
4885
4094
|
return normalizeConfig(typeof configExport === "function" ? await configExport(configEnv) : await configExport);
|
|
4886
4095
|
}
|
|
4096
|
+
function hasSourceImportAuthorityPackageRules(config) {
|
|
4097
|
+
return Boolean(config.source?.importAuthority?.allow?.some((rule) => rule.packages?.some((packageName) => packageName.trim().length > 0)));
|
|
4098
|
+
}
|
|
4099
|
+
function validateRootPackageImportAuthorityConfig(config, rootDir) {
|
|
4100
|
+
if (!hasSourceImportAuthorityPackageRules(config)) return;
|
|
4101
|
+
if (existsSync(posix.join(rootDir, "package.json"))) return;
|
|
4102
|
+
throw new Error([
|
|
4103
|
+
"Invalid Limina source config:",
|
|
4104
|
+
" field: source.importAuthority.allow[].packages",
|
|
4105
|
+
` value: ${JSON.stringify(config.source?.importAuthority?.allow)}`,
|
|
4106
|
+
" reason: package allow rules enable workspace root package.json as a dependency authority manifest, but no package.json exists at the workspace root."
|
|
4107
|
+
].join("\n"));
|
|
4108
|
+
}
|
|
4887
4109
|
async function loadConfig(options = {}) {
|
|
4888
4110
|
const cwd = options.cwd ? posix.resolve(options.cwd) : process.cwd();
|
|
4889
4111
|
const rootDir = inferWorkspaceRoot(cwd);
|
|
4890
4112
|
const configPath = options.configPath ? posix.resolve(cwd, options.configPath) : findLiminaConfigPath(cwd, rootDir);
|
|
4891
4113
|
if (configPath) validateConfigPathInsideWorkspace(configPath, rootDir);
|
|
4892
4114
|
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}.`);
|
|
4115
|
+
const config = await resolveConfigExport((await import(`${pathToFileURL(configPath).href}?t=${Date.now()}`)).default, createConfigEnv(options));
|
|
4116
|
+
validateRootPackageImportAuthorityConfig(config, rootDir);
|
|
4893
4117
|
return {
|
|
4894
|
-
...
|
|
4118
|
+
...config,
|
|
4895
4119
|
configPath,
|
|
4896
4120
|
rootDir
|
|
4897
4121
|
};
|
|
4898
4122
|
}
|
|
4899
4123
|
|
|
4900
4124
|
//#endregion
|
|
4901
|
-
export { normalizeSlashes as _,
|
|
4125
|
+
export { isRelativeSpecifier as A, isPathInsideDirectory as C, toRelativePath as D, toPosixPath as E, uniqueSortedStrings as F, uniqueTrimmedNonEmptySortedStrings as I, uniqueValues as L, isVirtualModuleSpecifier as M, posix as N, isBarePackageSpecifier as O, uniqueBy as P, resolveRelativeModuleCandidate as S, normalizeSlashes as T, resolveModuleNameWithCheckers as _, formatUnknownValue as a, resolveExistingFilePath as b, clearCheckerProjectConfigCache as c, getBuildCheckerSupportedExtensions as d, getCheckerAdapter as f, resolveCheckerProjectExtensions as g, parseCheckerProjectConfigForContext as h, loadConfig as i, isUrlOrDataOrFileSpecifier as j, isPackageImportSpecifier 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, candidatePathsForBasePath as v, normalizeAbsolutePath as w, resolvePathMappedModuleCandidate as x, resolveBaseUrlModuleCandidate as y };
|