@umijs/utils 4.0.0-canary.20230227.1 → 4.0.0-canary.20230309.3

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.
Files changed (58) hide show
  1. package/compiled/@ampproject/remapping/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts +70 -0
  2. package/compiled/@ampproject/remapping/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts +12 -0
  3. package/compiled/@ampproject/remapping/@jridgewell/gen-mapping/dist/types/types.d.ts +35 -0
  4. package/compiled/@ampproject/remapping/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +16 -0
  5. package/compiled/@ampproject/remapping/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +74 -0
  6. package/compiled/@ampproject/remapping/@jridgewell/trace-mapping/dist/types/types.d.ts +92 -0
  7. package/compiled/@ampproject/remapping/LICENSE +202 -0
  8. package/compiled/@ampproject/remapping/dist/types/remapping.d.ts +19 -0
  9. package/compiled/@ampproject/remapping/dist/types/source-map.d.ts +17 -0
  10. package/compiled/@ampproject/remapping/dist/types/types.d.ts +14 -0
  11. package/compiled/@ampproject/remapping/index.js +1 -0
  12. package/compiled/@ampproject/remapping/package.json +1 -0
  13. package/compiled/tsconfig-paths/LICENSE +21 -0
  14. package/compiled/tsconfig-paths/index.js +1 -0
  15. package/compiled/tsconfig-paths/lib/index.d.ts +5 -0
  16. package/compiled/tsconfig-paths/package.json +1 -0
  17. package/compiled/zod/LICENSE +21 -0
  18. package/compiled/zod/index.d.ts +2 -0
  19. package/compiled/zod/index.js +1 -0
  20. package/compiled/zod/lib/ZodError.d.ts +159 -0
  21. package/compiled/zod/lib/__tests__/Mocker.d.ts +17 -0
  22. package/compiled/zod/lib/benchmarks/discriminatedUnion.d.ts +5 -0
  23. package/compiled/zod/lib/benchmarks/index.d.ts +1 -0
  24. package/compiled/zod/lib/benchmarks/object.d.ts +5 -0
  25. package/compiled/zod/lib/benchmarks/primitives.d.ts +5 -0
  26. package/compiled/zod/lib/benchmarks/realworld.d.ts +5 -0
  27. package/compiled/zod/lib/benchmarks/string.d.ts +5 -0
  28. package/compiled/zod/lib/benchmarks/union.d.ts +5 -0
  29. package/compiled/zod/lib/errors.d.ts +5 -0
  30. package/compiled/zod/lib/external.d.ts +6 -0
  31. package/compiled/zod/lib/helpers/enumUtil.d.ts +8 -0
  32. package/compiled/zod/lib/helpers/errorUtil.d.ts +9 -0
  33. package/compiled/zod/lib/helpers/parseUtil.d.ts +78 -0
  34. package/compiled/zod/lib/helpers/partialUtil.d.ts +8 -0
  35. package/compiled/zod/lib/helpers/typeAliases.d.ts +2 -0
  36. package/compiled/zod/lib/helpers/util.d.ts +47 -0
  37. package/compiled/zod/lib/index.d.ts +4 -0
  38. package/compiled/zod/lib/locales/en.d.ts +3 -0
  39. package/compiled/zod/lib/types.d.ts +975 -0
  40. package/compiled/zod/package.json +1 -0
  41. package/dist/BaseGenerator/generateFile.js +1 -4
  42. package/dist/getDevBanner.js +11 -22
  43. package/dist/getGitInfo.js +1 -4
  44. package/dist/importLazy.js +2 -7
  45. package/dist/index.d.ts +7 -1
  46. package/dist/index.js +14 -2
  47. package/dist/installDeps.js +10 -16
  48. package/dist/logger.js +8 -3
  49. package/dist/printHelp.js +2 -7
  50. package/dist/randomColor/randomColor.js +1 -4
  51. package/dist/readDirFiles.d.ts +9 -0
  52. package/dist/readDirFiles.js +62 -0
  53. package/dist/updatePackageJSON.js +7 -4
  54. package/dist/zod/isZodSchema.d.ts +2 -0
  55. package/dist/zod/isZodSchema.js +31 -0
  56. package/dist/zod/zod2string.d.ts +2 -0
  57. package/dist/zod/zod2string.js +49 -0
  58. package/package.json +11 -4
@@ -0,0 +1,78 @@
1
+ import type { IssueData, ZodErrorMap, ZodIssue } from "../ZodError";
2
+ import type { ZodParsedType } from "./util";
3
+ export declare const makeIssue: (params: {
4
+ data: any;
5
+ path: (string | number)[];
6
+ errorMaps: ZodErrorMap[];
7
+ issueData: IssueData;
8
+ }) => ZodIssue;
9
+ export declare type ParseParams = {
10
+ path: (string | number)[];
11
+ errorMap: ZodErrorMap;
12
+ async: boolean;
13
+ };
14
+ export declare type ParsePathComponent = string | number;
15
+ export declare type ParsePath = ParsePathComponent[];
16
+ export declare const EMPTY_PATH: ParsePath;
17
+ export interface ParseContext {
18
+ readonly common: {
19
+ readonly issues: ZodIssue[];
20
+ readonly contextualErrorMap?: ZodErrorMap;
21
+ readonly async: boolean;
22
+ };
23
+ readonly path: ParsePath;
24
+ readonly schemaErrorMap?: ZodErrorMap;
25
+ readonly parent: ParseContext | null;
26
+ readonly data: any;
27
+ readonly parsedType: ZodParsedType;
28
+ }
29
+ export declare type ParseInput = {
30
+ data: any;
31
+ path: (string | number)[];
32
+ parent: ParseContext;
33
+ };
34
+ export declare function addIssueToContext(ctx: ParseContext, issueData: IssueData): void;
35
+ export declare type ObjectPair = {
36
+ key: SyncParseReturnType<any>;
37
+ value: SyncParseReturnType<any>;
38
+ };
39
+ export declare class ParseStatus {
40
+ value: "aborted" | "dirty" | "valid";
41
+ dirty(): void;
42
+ abort(): void;
43
+ static mergeArray(status: ParseStatus, results: SyncParseReturnType<any>[]): SyncParseReturnType;
44
+ static mergeObjectAsync(status: ParseStatus, pairs: {
45
+ key: ParseReturnType<any>;
46
+ value: ParseReturnType<any>;
47
+ }[]): Promise<SyncParseReturnType<any>>;
48
+ static mergeObjectSync(status: ParseStatus, pairs: {
49
+ key: SyncParseReturnType<any>;
50
+ value: SyncParseReturnType<any>;
51
+ alwaysSet?: boolean;
52
+ }[]): SyncParseReturnType;
53
+ }
54
+ export interface ParseResult {
55
+ status: "aborted" | "dirty" | "valid";
56
+ data: any;
57
+ }
58
+ export declare type INVALID = {
59
+ status: "aborted";
60
+ };
61
+ export declare const INVALID: INVALID;
62
+ export declare type DIRTY<T> = {
63
+ status: "dirty";
64
+ value: T;
65
+ };
66
+ export declare const DIRTY: <T>(value: T) => DIRTY<T>;
67
+ export declare type OK<T> = {
68
+ status: "valid";
69
+ value: T;
70
+ };
71
+ export declare const OK: <T>(value: T) => OK<T>;
72
+ export declare type SyncParseReturnType<T = any> = OK<T> | DIRTY<T> | INVALID;
73
+ export declare type AsyncParseReturnType<T> = Promise<SyncParseReturnType<T>>;
74
+ export declare type ParseReturnType<T> = SyncParseReturnType<T> | AsyncParseReturnType<T>;
75
+ export declare const isAborted: (x: ParseReturnType<any>) => x is INVALID;
76
+ export declare const isDirty: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
77
+ export declare const isValid: <T>(x: ParseReturnType<T>) => x is OK<T> | DIRTY<T>;
78
+ export declare const isAsync: <T>(x: ParseReturnType<T>) => x is AsyncParseReturnType<T>;
@@ -0,0 +1,8 @@
1
+ import type { ZodArray, ZodNullable, ZodObject, ZodOptional, ZodTuple, ZodTupleItems, ZodTypeAny } from "../index";
2
+ export declare namespace partialUtil {
3
+ type DeepPartial<T extends ZodTypeAny> = T extends ZodObject<infer Shape, infer Params, infer Catchall> ? ZodObject<{
4
+ [k in keyof Shape]: ZodOptional<DeepPartial<Shape[k]>>;
5
+ }, Params, Catchall> : T extends ZodArray<infer Type, infer Card> ? ZodArray<DeepPartial<Type>, Card> : T extends ZodOptional<infer Type> ? ZodOptional<DeepPartial<Type>> : T extends ZodNullable<infer Type> ? ZodNullable<DeepPartial<Type>> : T extends ZodTuple<infer Items> ? {
6
+ [k in keyof Items]: Items[k] extends ZodTypeAny ? DeepPartial<Items[k]> : never;
7
+ } extends infer PI ? PI extends ZodTupleItems ? ZodTuple<PI> : never : never : T;
8
+ }
@@ -0,0 +1,2 @@
1
+ export declare type Primitive = string | number | symbol | bigint | boolean | null | undefined;
2
+ export declare type Scalars = Primitive | Primitive[];
@@ -0,0 +1,47 @@
1
+ export declare namespace util {
2
+ type AssertEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? true : false;
3
+ export const assertEqual: <A, B>(val: AssertEqual<A, B>) => AssertEqual<A, B>;
4
+ export function assertIs<T>(_arg: T): void;
5
+ export function assertNever(_x: never): never;
6
+ export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
7
+ export type OmitKeys<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
8
+ export type MakePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
9
+ export const arrayToEnum: <T extends string, U extends [T, ...T[]]>(items: U) => { [k in U[number]]: k; };
10
+ export const getValidEnumValues: (obj: any) => any[];
11
+ export const objectValues: (obj: any) => any[];
12
+ export const objectKeys: ObjectConstructor["keys"];
13
+ export const find: <T>(arr: T[], checker: (arg: T) => any) => T | undefined;
14
+ export type identity<T> = T;
15
+ export type flatten<T> = identity<{
16
+ [k in keyof T]: T[k];
17
+ }>;
18
+ export type noUndefined<T> = T extends undefined ? never : T;
19
+ export const isInteger: NumberConstructor["isInteger"];
20
+ export function joinValues<T extends any[]>(array: T, separator?: string): string;
21
+ export const jsonStringifyReplacer: (_: string, value: any) => any;
22
+ export {};
23
+ }
24
+ export declare const ZodParsedType: {
25
+ function: "function";
26
+ number: "number";
27
+ string: "string";
28
+ nan: "nan";
29
+ integer: "integer";
30
+ float: "float";
31
+ boolean: "boolean";
32
+ date: "date";
33
+ bigint: "bigint";
34
+ symbol: "symbol";
35
+ undefined: "undefined";
36
+ null: "null";
37
+ array: "array";
38
+ object: "object";
39
+ unknown: "unknown";
40
+ promise: "promise";
41
+ void: "void";
42
+ never: "never";
43
+ map: "map";
44
+ set: "set";
45
+ };
46
+ export declare type ZodParsedType = keyof typeof ZodParsedType;
47
+ export declare const getParsedType: (data: any) => ZodParsedType;
@@ -0,0 +1,4 @@
1
+ import * as mod from "./external";
2
+ export * from "./external";
3
+ export { mod as z };
4
+ export default mod;
@@ -0,0 +1,3 @@
1
+ import { ZodErrorMap } from "../ZodError";
2
+ declare const errorMap: ZodErrorMap;
3
+ export default errorMap;