@modern-js/core 1.9.2 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/compiled/ajv-keywords/index.d.ts +1 -0
  3. package/compiled/ajv-keywords/package.json +1 -1
  4. package/compiled/better-ajv-errors/index.d.ts +1 -0
  5. package/compiled/better-ajv-errors/package.json +1 -1
  6. package/compiled/v8-compile-cache/index.d.ts +1 -0
  7. package/compiled/v8-compile-cache/package.json +1 -1
  8. package/dist/config/index.d.ts +1 -1
  9. package/dist/config/index.js +19 -28
  10. package/dist/config/types/index.d.ts +36 -36
  11. package/dist/index.js +55 -60
  12. package/dist/initWatcher.js +3 -12
  13. package/package.json +7 -8
  14. package/tsconfig.json +1 -0
  15. package/compiled/ajv-keywords/ajv/dist/ajv.d.ts +0 -16
  16. package/compiled/ajv-keywords/ajv/dist/compile/codegen/code.d.ts +0 -40
  17. package/compiled/ajv-keywords/ajv/dist/compile/codegen/index.d.ts +0 -79
  18. package/compiled/ajv-keywords/ajv/dist/compile/codegen/scope.d.ts +0 -79
  19. package/compiled/ajv-keywords/ajv/dist/compile/errors.d.ts +0 -13
  20. package/compiled/ajv-keywords/ajv/dist/compile/index.d.ts +0 -80
  21. package/compiled/ajv-keywords/ajv/dist/compile/ref_error.d.ts +0 -6
  22. package/compiled/ajv-keywords/ajv/dist/compile/resolve.d.ts +0 -12
  23. package/compiled/ajv-keywords/ajv/dist/compile/rules.d.ts +0 -28
  24. package/compiled/ajv-keywords/ajv/dist/compile/util.d.ts +0 -40
  25. package/compiled/ajv-keywords/ajv/dist/compile/validate/index.d.ts +0 -42
  26. package/compiled/ajv-keywords/ajv/dist/compile/validate/subschema.d.ts +0 -47
  27. package/compiled/ajv-keywords/ajv/dist/core.d.ts +0 -173
  28. package/compiled/ajv-keywords/ajv/dist/runtime/validation_error.d.ts +0 -7
  29. package/compiled/ajv-keywords/ajv/dist/types/index.d.ts +0 -183
  30. package/compiled/ajv-keywords/ajv/dist/types/json-schema.d.ts +0 -124
  31. package/compiled/ajv-keywords/ajv/dist/types/jtd-schema.d.ts +0 -169
  32. package/compiled/ajv-keywords/dist/index.d.ts +0 -4
  33. package/compiled/ajv-keywords/uri-js/dist/es5/uri.all.d.ts +0 -59
  34. package/compiled/better-ajv-errors/ajv/dist/ajv.d.ts +0 -16
  35. package/compiled/better-ajv-errors/ajv/dist/compile/codegen/code.d.ts +0 -40
  36. package/compiled/better-ajv-errors/ajv/dist/compile/codegen/index.d.ts +0 -79
  37. package/compiled/better-ajv-errors/ajv/dist/compile/codegen/scope.d.ts +0 -79
  38. package/compiled/better-ajv-errors/ajv/dist/compile/errors.d.ts +0 -13
  39. package/compiled/better-ajv-errors/ajv/dist/compile/index.d.ts +0 -80
  40. package/compiled/better-ajv-errors/ajv/dist/compile/ref_error.d.ts +0 -6
  41. package/compiled/better-ajv-errors/ajv/dist/compile/resolve.d.ts +0 -12
  42. package/compiled/better-ajv-errors/ajv/dist/compile/rules.d.ts +0 -28
  43. package/compiled/better-ajv-errors/ajv/dist/compile/util.d.ts +0 -40
  44. package/compiled/better-ajv-errors/ajv/dist/compile/validate/index.d.ts +0 -42
  45. package/compiled/better-ajv-errors/ajv/dist/compile/validate/subschema.d.ts +0 -47
  46. package/compiled/better-ajv-errors/ajv/dist/core.d.ts +0 -173
  47. package/compiled/better-ajv-errors/ajv/dist/runtime/validation_error.d.ts +0 -7
  48. package/compiled/better-ajv-errors/ajv/dist/types/index.d.ts +0 -183
  49. package/compiled/better-ajv-errors/ajv/dist/types/json-schema.d.ts +0 -124
  50. package/compiled/better-ajv-errors/ajv/dist/types/jtd-schema.d.ts +0 -169
  51. package/compiled/better-ajv-errors/typings.d.ts +0 -24
  52. package/compiled/better-ajv-errors/uri-js/dist/es5/uri.all.d.ts +0 -59
  53. package/dist/js/modern/cli.js +0 -29
  54. package/dist/js/modern/config/defaults.js +0 -103
  55. package/dist/js/modern/config/index.js +0 -115
  56. package/dist/js/modern/config/mergeConfig.js +0 -22
  57. package/dist/js/modern/config/schema/deploy.js +0 -17
  58. package/dist/js/modern/config/schema/index.js +0 -107
  59. package/dist/js/modern/config/schema/output.js +0 -147
  60. package/dist/js/modern/config/schema/server.js +0 -170
  61. package/dist/js/modern/config/schema/source.js +0 -59
  62. package/dist/js/modern/config/schema/tools.js +0 -36
  63. package/dist/js/modern/config/types/electron.js +0 -1
  64. package/dist/js/modern/config/types/index.js +0 -1
  65. package/dist/js/modern/config/types/less.js +0 -0
  66. package/dist/js/modern/config/types/sass.js +0 -0
  67. package/dist/js/modern/config/types/ssg.js +0 -0
  68. package/dist/js/modern/config/types/test.js +0 -0
  69. package/dist/js/modern/config/types/unbundle.js +0 -0
  70. package/dist/js/modern/context.js +0 -63
  71. package/dist/js/modern/index.js +0 -169
  72. package/dist/js/modern/initWatcher.js +0 -62
  73. package/dist/js/modern/loadEnv.js +0 -14
  74. package/dist/js/modern/loadPlugins.js +0 -122
  75. package/dist/js/modern/manager.js +0 -28
  76. package/dist/js/modern/pluginAPI.js +0 -11
  77. package/dist/js/modern/utils/commander.js +0 -19
  78. package/dist/js/modern/utils/repeatKeyWarning.js +0 -18
  79. package/dist/js/node/cli.js +0 -35
  80. package/dist/js/node/config/defaults.js +0 -110
  81. package/dist/js/node/config/index.js +0 -182
  82. package/dist/js/node/config/mergeConfig.js +0 -32
  83. package/dist/js/node/config/schema/deploy.js +0 -26
  84. package/dist/js/node/config/schema/index.js +0 -127
  85. package/dist/js/node/config/schema/output.js +0 -156
  86. package/dist/js/node/config/schema/server.js +0 -179
  87. package/dist/js/node/config/schema/source.js +0 -68
  88. package/dist/js/node/config/schema/tools.js +0 -43
  89. package/dist/js/node/config/types/electron.js +0 -5
  90. package/dist/js/node/config/types/index.js +0 -5
  91. package/dist/js/node/config/types/less.js +0 -0
  92. package/dist/js/node/config/types/sass.js +0 -0
  93. package/dist/js/node/config/types/ssg.js +0 -0
  94. package/dist/js/node/config/types/test.js +0 -0
  95. package/dist/js/node/config/types/unbundle.js +0 -0
  96. package/dist/js/node/context.js +0 -93
  97. package/dist/js/node/index.js +0 -329
  98. package/dist/js/node/initWatcher.js +0 -82
  99. package/dist/js/node/loadEnv.js +0 -30
  100. package/dist/js/node/loadPlugins.js +0 -134
  101. package/dist/js/node/manager.js +0 -45
  102. package/dist/js/node/pluginAPI.js +0 -54
  103. package/dist/js/node/utils/commander.js +0 -32
  104. package/dist/js/node/utils/repeatKeyWarning.js +0 -31
  105. package/dist/types/cli.d.ts +0 -1
  106. package/dist/types/config/defaults.d.ts +0 -28
  107. package/dist/types/config/index.d.ts +0 -12
  108. package/dist/types/config/mergeConfig.d.ts +0 -31
  109. package/dist/types/config/schema/deploy.d.ts +0 -16
  110. package/dist/types/config/schema/index.d.ts +0 -466
  111. package/dist/types/config/schema/output.d.ts +0 -146
  112. package/dist/types/config/schema/server.d.ts +0 -182
  113. package/dist/types/config/schema/source.d.ts +0 -58
  114. package/dist/types/config/schema/tools.d.ts +0 -36
  115. package/dist/types/config/types/electron.d.ts +0 -13
  116. package/dist/types/config/types/index.d.ts +0 -252
  117. package/dist/types/config/types/less.d.ts +0 -10
  118. package/dist/types/config/types/sass.d.ts +0 -8
  119. package/dist/types/config/types/ssg.d.ts +0 -13
  120. package/dist/types/config/types/test.d.ts +0 -15
  121. package/dist/types/config/types/unbundle.d.ts +0 -28
  122. package/dist/types/context.d.ts +0 -47
  123. package/dist/types/index.d.ts +0 -64
  124. package/dist/types/initWatcher.d.ts +0 -3
  125. package/dist/types/loadEnv.d.ts +0 -1
  126. package/dist/types/loadPlugins.d.ts +0 -44
  127. package/dist/types/manager.d.ts +0 -75
  128. package/dist/types/pluginAPI.d.ts +0 -13
  129. package/dist/types/utils/commander.d.ts +0 -4
  130. package/dist/types/utils/repeatKeyWarning.d.ts +0 -3
@@ -1,183 +0,0 @@
1
- import * as URI from '../../../uri-js';
2
- import type { CodeGen, Code, Name, ScopeValueSets, ValueScopeName } from '../compile/codegen';
3
- import type { SchemaEnv, SchemaCxt, SchemaObjCxt } from '../compile';
4
- import type { JSONType } from '../compile/rules';
5
- import type { KeywordCxt } from '../compile/validate';
6
- import type Ajv from '../core';
7
- interface _SchemaObject {
8
- id?: string;
9
- $id?: string;
10
- $schema?: string;
11
- [x: string]: any;
12
- }
13
- export interface SchemaObject extends _SchemaObject {
14
- id?: string;
15
- $id?: string;
16
- $schema?: string;
17
- $async?: false;
18
- [x: string]: any;
19
- }
20
- export interface AsyncSchema extends _SchemaObject {
21
- $async: true;
22
- }
23
- export declare type AnySchemaObject = SchemaObject | AsyncSchema;
24
- export declare type Schema = SchemaObject | boolean;
25
- export declare type AnySchema = Schema | AsyncSchema;
26
- export declare type SchemaMap = {
27
- [Key in string]?: AnySchema;
28
- };
29
- export interface SourceCode {
30
- validateName: ValueScopeName;
31
- validateCode: string;
32
- scopeValues: ScopeValueSets;
33
- evaluated?: Code;
34
- }
35
- export interface DataValidationCxt<T extends string | number = string | number> {
36
- instancePath: string;
37
- parentData: {
38
- [K in T]: any;
39
- };
40
- parentDataProperty: T;
41
- rootData: Record<string, any> | any[];
42
- dynamicAnchors: {
43
- [Ref in string]?: ValidateFunction;
44
- };
45
- }
46
- export interface ValidateFunction<T = unknown> {
47
- (this: Ajv | any, data: any, dataCxt?: DataValidationCxt): data is T;
48
- errors?: null | ErrorObject[];
49
- evaluated?: Evaluated;
50
- schema: AnySchema;
51
- schemaEnv: SchemaEnv;
52
- source?: SourceCode;
53
- }
54
- export interface JTDParser<T = unknown> {
55
- (json: string): T | undefined;
56
- message?: string;
57
- position?: number;
58
- }
59
- export declare type EvaluatedProperties = {
60
- [K in string]?: true;
61
- } | true;
62
- export declare type EvaluatedItems = number | true;
63
- export interface Evaluated {
64
- props?: EvaluatedProperties;
65
- items?: EvaluatedItems;
66
- dynamicProps: boolean;
67
- dynamicItems: boolean;
68
- }
69
- export interface AsyncValidateFunction<T = unknown> extends ValidateFunction<T> {
70
- (...args: Parameters<ValidateFunction<T>>): Promise<T>;
71
- $async: true;
72
- }
73
- export declare type AnyValidateFunction<T = any> = ValidateFunction<T> | AsyncValidateFunction<T>;
74
- export interface ErrorObject<K extends string = string, P = Record<string, any>, S = unknown> {
75
- keyword: K;
76
- instancePath: string;
77
- schemaPath: string;
78
- params: P;
79
- propertyName?: string;
80
- message?: string;
81
- schema?: S;
82
- parentSchema?: AnySchemaObject;
83
- data?: unknown;
84
- }
85
- export declare type ErrorNoParams<K extends string, S = unknown> = ErrorObject<K, Record<string, never>, S>;
86
- interface _KeywordDef {
87
- keyword: string | string[];
88
- type?: JSONType | JSONType[];
89
- schemaType?: JSONType | JSONType[];
90
- allowUndefined?: boolean;
91
- $data?: boolean;
92
- implements?: string[];
93
- before?: string;
94
- post?: boolean;
95
- metaSchema?: AnySchemaObject;
96
- validateSchema?: AnyValidateFunction;
97
- dependencies?: string[];
98
- error?: KeywordErrorDefinition;
99
- $dataError?: KeywordErrorDefinition;
100
- }
101
- export interface CodeKeywordDefinition extends _KeywordDef {
102
- code: (cxt: KeywordCxt, ruleType?: string) => void;
103
- trackErrors?: boolean;
104
- }
105
- export declare type MacroKeywordFunc = (schema: any, parentSchema: AnySchemaObject, it: SchemaCxt) => AnySchema;
106
- export declare type CompileKeywordFunc = (schema: any, parentSchema: AnySchemaObject, it: SchemaObjCxt) => DataValidateFunction;
107
- export interface DataValidateFunction {
108
- (...args: Parameters<ValidateFunction>): boolean | Promise<any>;
109
- errors?: Partial<ErrorObject>[];
110
- }
111
- export interface SchemaValidateFunction {
112
- (schema: any, data: any, parentSchema?: AnySchemaObject, dataCxt?: DataValidationCxt): boolean | Promise<any>;
113
- errors?: Partial<ErrorObject>[];
114
- }
115
- export interface FuncKeywordDefinition extends _KeywordDef {
116
- validate?: SchemaValidateFunction | DataValidateFunction;
117
- compile?: CompileKeywordFunc;
118
- schema?: boolean;
119
- modifying?: boolean;
120
- async?: boolean;
121
- valid?: boolean;
122
- errors?: boolean | "full";
123
- }
124
- export interface MacroKeywordDefinition extends FuncKeywordDefinition {
125
- macro: MacroKeywordFunc;
126
- }
127
- export declare type KeywordDefinition = CodeKeywordDefinition | FuncKeywordDefinition | MacroKeywordDefinition;
128
- export declare type AddedKeywordDefinition = KeywordDefinition & {
129
- type: JSONType[];
130
- schemaType: JSONType[];
131
- };
132
- export interface KeywordErrorDefinition {
133
- message: string | Code | ((cxt: KeywordErrorCxt) => string | Code);
134
- params?: Code | ((cxt: KeywordErrorCxt) => Code);
135
- }
136
- export declare type Vocabulary = (KeywordDefinition | string)[];
137
- export interface KeywordErrorCxt {
138
- gen: CodeGen;
139
- keyword: string;
140
- data: Name;
141
- $data?: string | false;
142
- schema: any;
143
- parentSchema?: AnySchemaObject;
144
- schemaCode: Code | number | boolean;
145
- schemaValue: Code | number | boolean;
146
- schemaType?: JSONType[];
147
- errsCount?: Name;
148
- params: KeywordCxtParams;
149
- it: SchemaCxt;
150
- }
151
- export declare type KeywordCxtParams = {
152
- [P in string]?: Code | string | number;
153
- };
154
- export declare type FormatValidator<T extends string | number> = (data: T) => boolean;
155
- export declare type FormatCompare<T extends string | number> = (data1: T, data2: T) => number | undefined;
156
- export declare type AsyncFormatValidator<T extends string | number> = (data: T) => Promise<boolean>;
157
- export interface FormatDefinition<T extends string | number> {
158
- type?: T extends string ? "string" | undefined : "number";
159
- validate: FormatValidator<T> | (T extends string ? string | RegExp : never);
160
- async?: false | undefined;
161
- compare?: FormatCompare<T>;
162
- }
163
- export interface AsyncFormatDefinition<T extends string | number> {
164
- type?: T extends string ? "string" | undefined : "number";
165
- validate: AsyncFormatValidator<T>;
166
- async: true;
167
- compare?: FormatCompare<T>;
168
- }
169
- export declare type AddedFormat = true | RegExp | FormatValidator<string> | FormatDefinition<string> | FormatDefinition<number> | AsyncFormatDefinition<string> | AsyncFormatDefinition<number>;
170
- export declare type Format = AddedFormat | string;
171
- export interface RegExpEngine {
172
- (pattern: string, u: string): RegExpLike;
173
- code: string;
174
- }
175
- export interface RegExpLike {
176
- test: (s: string) => boolean;
177
- }
178
- export interface UriResolver {
179
- parse(uri: string): URI.URIComponents;
180
- resolve(base: string, path: string): string;
181
- serialize(component: URI.URIComponents): string;
182
- }
183
- export {};
@@ -1,124 +0,0 @@
1
- declare type StrictNullChecksWrapper<Name extends string, Type> = undefined extends null ? `strictNullChecks must be true in tsconfig to use ${Name}` : Type;
2
- declare type UnionToIntersection<U> = (U extends any ? (_: U) => void : never) extends (_: infer I) => void ? I : never;
3
- export declare type SomeJSONSchema = UncheckedJSONSchemaType<Known, true>;
4
- declare type UncheckedPartialSchema<T> = Partial<UncheckedJSONSchemaType<T, true>>;
5
- export declare type PartialSchema<T> = StrictNullChecksWrapper<"PartialSchema", UncheckedPartialSchema<T>>;
6
- declare type JSONType<T extends string, IsPartial extends boolean> = IsPartial extends true ? T | undefined : T;
7
- interface NumberKeywords {
8
- minimum?: number;
9
- maximum?: number;
10
- exclusiveMinimum?: number;
11
- exclusiveMaximum?: number;
12
- multipleOf?: number;
13
- format?: string;
14
- }
15
- interface StringKeywords {
16
- minLength?: number;
17
- maxLength?: number;
18
- pattern?: string;
19
- format?: string;
20
- }
21
- declare type UncheckedJSONSchemaType<T, IsPartial extends boolean> = (// these two unions allow arbitrary unions of types
22
- {
23
- anyOf: readonly UncheckedJSONSchemaType<T, IsPartial>[];
24
- } | {
25
- oneOf: readonly UncheckedJSONSchemaType<T, IsPartial>[];
26
- } | ({
27
- type: readonly (T extends number ? JSONType<"number" | "integer", IsPartial> : T extends string ? JSONType<"string", IsPartial> : T extends boolean ? JSONType<"boolean", IsPartial> : never)[];
28
- } & UnionToIntersection<T extends number ? NumberKeywords : T extends string ? StringKeywords : T extends boolean ? {} : never>) | ((T extends number ? {
29
- type: JSONType<"number" | "integer", IsPartial>;
30
- } & NumberKeywords : T extends string ? {
31
- type: JSONType<"string", IsPartial>;
32
- } & StringKeywords : T extends boolean ? {
33
- type: JSONType<"boolean", IsPartial>;
34
- } : T extends readonly [any, ...any[]] ? {
35
- type: JSONType<"array", IsPartial>;
36
- items: {
37
- readonly [K in keyof T]-?: UncheckedJSONSchemaType<T[K], false> & Nullable<T[K]>;
38
- } & {
39
- length: T["length"];
40
- };
41
- minItems: T["length"];
42
- } & ({
43
- maxItems: T["length"];
44
- } | {
45
- additionalItems: false;
46
- }) : T extends readonly any[] ? {
47
- type: JSONType<"array", IsPartial>;
48
- items: UncheckedJSONSchemaType<T[0], false>;
49
- contains?: UncheckedPartialSchema<T[0]>;
50
- minItems?: number;
51
- maxItems?: number;
52
- minContains?: number;
53
- maxContains?: number;
54
- uniqueItems?: true;
55
- additionalItems?: never;
56
- } : T extends Record<string, any> ? {
57
- type: JSONType<"object", IsPartial>;
58
- additionalProperties?: boolean | UncheckedJSONSchemaType<T[string], false>;
59
- unevaluatedProperties?: boolean | UncheckedJSONSchemaType<T[string], false>;
60
- properties?: IsPartial extends true ? Partial<UncheckedPropertiesSchema<T>> : UncheckedPropertiesSchema<T>;
61
- patternProperties?: Record<string, UncheckedJSONSchemaType<T[string], false>>;
62
- propertyNames?: Omit<UncheckedJSONSchemaType<string, false>, "type"> & {
63
- type?: "string";
64
- };
65
- dependencies?: {
66
- [K in keyof T]?: Readonly<(keyof T)[]> | UncheckedPartialSchema<T>;
67
- };
68
- dependentRequired?: {
69
- [K in keyof T]?: Readonly<(keyof T)[]>;
70
- };
71
- dependentSchemas?: {
72
- [K in keyof T]?: UncheckedPartialSchema<T>;
73
- };
74
- minProperties?: number;
75
- maxProperties?: number;
76
- } & (IsPartial extends true ? {
77
- required: Readonly<(keyof T)[]>;
78
- } : [UncheckedRequiredMembers<T>] extends [never] ? {
79
- required?: Readonly<UncheckedRequiredMembers<T>[]>;
80
- } : {
81
- required: Readonly<UncheckedRequiredMembers<T>[]>;
82
- }) : T extends null ? {
83
- type: JSONType<"null", IsPartial>;
84
- nullable: true;
85
- } : never) & {
86
- allOf?: Readonly<UncheckedPartialSchema<T>[]>;
87
- anyOf?: Readonly<UncheckedPartialSchema<T>[]>;
88
- oneOf?: Readonly<UncheckedPartialSchema<T>[]>;
89
- if?: UncheckedPartialSchema<T>;
90
- then?: UncheckedPartialSchema<T>;
91
- else?: UncheckedPartialSchema<T>;
92
- not?: UncheckedPartialSchema<T>;
93
- })) & {
94
- [keyword: string]: any;
95
- $id?: string;
96
- $ref?: string;
97
- $defs?: Record<string, UncheckedJSONSchemaType<Known, true>>;
98
- definitions?: Record<string, UncheckedJSONSchemaType<Known, true>>;
99
- };
100
- export declare type JSONSchemaType<T> = StrictNullChecksWrapper<"JSONSchemaType", UncheckedJSONSchemaType<T, false>>;
101
- declare type Known = {
102
- [key: string]: Known;
103
- } | [Known, ...Known[]] | Known[] | number | string | boolean | null;
104
- declare type UncheckedPropertiesSchema<T> = {
105
- [K in keyof T]-?: (UncheckedJSONSchemaType<T[K], false> & Nullable<T[K]>) | {
106
- $ref: string;
107
- };
108
- };
109
- export declare type PropertiesSchema<T> = StrictNullChecksWrapper<"PropertiesSchema", UncheckedPropertiesSchema<T>>;
110
- declare type UncheckedRequiredMembers<T> = {
111
- [K in keyof T]-?: undefined extends T[K] ? never : K;
112
- }[keyof T];
113
- export declare type RequiredMembers<T> = StrictNullChecksWrapper<"RequiredMembers", UncheckedRequiredMembers<T>>;
114
- declare type Nullable<T> = undefined extends T ? {
115
- nullable: true;
116
- const?: null;
117
- enum?: Readonly<(T | null)[]>;
118
- default?: T | null;
119
- } : {
120
- const?: T;
121
- enum?: Readonly<T[]>;
122
- default?: T;
123
- };
124
- export {};
@@ -1,169 +0,0 @@
1
- /** numeric strings */
2
- declare type NumberType = "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32";
3
- /** string strings */
4
- declare type StringType = "string" | "timestamp";
5
- /** Generic JTD Schema without inference of the represented type */
6
- export declare type SomeJTDSchemaType = (// ref
7
- {
8
- ref: string;
9
- } | {
10
- type: NumberType | StringType | "boolean";
11
- } | {
12
- enum: string[];
13
- } | {
14
- elements: SomeJTDSchemaType;
15
- } | {
16
- values: SomeJTDSchemaType;
17
- } | {
18
- properties: Record<string, SomeJTDSchemaType>;
19
- optionalProperties?: Record<string, SomeJTDSchemaType>;
20
- additionalProperties?: boolean;
21
- } | {
22
- properties?: Record<string, SomeJTDSchemaType>;
23
- optionalProperties: Record<string, SomeJTDSchemaType>;
24
- additionalProperties?: boolean;
25
- } | {
26
- discriminator: string;
27
- mapping: Record<string, SomeJTDSchemaType>;
28
- } | {}) & {
29
- nullable?: boolean;
30
- metadata?: Record<string, unknown>;
31
- definitions?: Record<string, SomeJTDSchemaType>;
32
- };
33
- /** required keys of an object, not undefined */
34
- declare type RequiredKeys<T> = {
35
- [K in keyof T]-?: undefined extends T[K] ? never : K;
36
- }[keyof T];
37
- /** optional or undifined-able keys of an object */
38
- declare type OptionalKeys<T> = {
39
- [K in keyof T]-?: undefined extends T[K] ? K : never;
40
- }[keyof T];
41
- /** type is true if T is a union type */
42
- declare type IsUnion_<T, U extends T = T> = false extends (T extends unknown ? ([U] extends [T] ? false : true) : never) ? false : true;
43
- declare type IsUnion<T> = IsUnion_<T>;
44
- /** type is true if T is identically E */
45
- declare type TypeEquality<T, E> = [T] extends [E] ? ([E] extends [T] ? true : false) : false;
46
- /** type is true if T or null is identically E or null*/
47
- declare type NullTypeEquality<T, E> = TypeEquality<T | null, E | null>;
48
- /** gets only the string literals of a type or null if a type isn't a string literal */
49
- declare type EnumString<T> = [T] extends [never] ? null : T extends string ? string extends T ? null : T : null;
50
- /** true if type is a union of string literals */
51
- declare type IsEnum<T> = null extends EnumString<Exclude<T, null>> ? false : true;
52
- /** true only if all types are array types (not tuples) */
53
- declare type IsElements<T> = false extends IsUnion<T> ? [T] extends [readonly unknown[]] ? undefined extends T[0.5] ? false : true : false : false;
54
- /** true if the the type is a values type */
55
- declare type IsValues<T> = false extends IsUnion<Exclude<T, null>> ? TypeEquality<keyof Exclude<T, null>, string> : false;
56
- /** true if type is a proeprties type and Union is false, or type is a discriminator type and Union is true */
57
- declare type IsRecord<T, Union extends boolean> = Union extends IsUnion<Exclude<T, null>> ? null extends EnumString<keyof Exclude<T, null>> ? false : true : false;
58
- /** actual schema */
59
- export declare type JTDSchemaType<T, D extends Record<string, unknown> = Record<string, never>> = (// refs - where null wasn't specified, must match exactly
60
- (null extends EnumString<keyof D> ? never : ({
61
- [K in keyof D]: [T] extends [D[K]] ? {
62
- ref: K;
63
- } : never;
64
- }[keyof D] & {
65
- nullable?: false;
66
- }) | (null extends T ? {
67
- [K in keyof D]: [Exclude<T, null>] extends [Exclude<D[K], null>] ? {
68
- ref: K;
69
- } : never;
70
- }[keyof D] & {
71
- nullable: true;
72
- } : never)) | (unknown extends T ? {
73
- nullable?: boolean;
74
- } : never) | ((true extends NullTypeEquality<T, number> ? {
75
- type: NumberType;
76
- } : true extends NullTypeEquality<T, boolean> ? {
77
- type: "boolean";
78
- } : true extends NullTypeEquality<T, string> ? {
79
- type: StringType;
80
- } : true extends NullTypeEquality<T, Date> ? {
81
- type: "timestamp";
82
- } : true extends IsEnum<T> ? {
83
- enum: EnumString<Exclude<T, null>>[];
84
- } : true extends IsElements<Exclude<T, null>> ? T extends readonly (infer E)[] ? {
85
- elements: JTDSchemaType<E, D>;
86
- } : never : true extends IsValues<T> ? T extends Record<string, infer V> ? {
87
- values: JTDSchemaType<V, D>;
88
- } : never : true extends IsRecord<T, false> ? ([RequiredKeys<Exclude<T, null>>] extends [never] ? {
89
- properties?: Record<string, never>;
90
- } : {
91
- properties: {
92
- [K in RequiredKeys<T>]: JTDSchemaType<T[K], D>;
93
- };
94
- }) & ([OptionalKeys<Exclude<T, null>>] extends [never] ? {
95
- optionalProperties?: Record<string, never>;
96
- } : {
97
- optionalProperties: {
98
- [K in OptionalKeys<T>]: JTDSchemaType<Exclude<T[K], undefined>, D>;
99
- };
100
- }) & {
101
- additionalProperties?: boolean;
102
- } : true extends IsRecord<T, true> ? {
103
- [K in keyof Exclude<T, null>]-?: Exclude<T, null>[K] extends string ? {
104
- discriminator: K;
105
- mapping: {
106
- [M in Exclude<T, null>[K]]: JTDSchemaType<Omit<T extends {
107
- [C in K]: M;
108
- } ? T : never, K>, D>;
109
- };
110
- } : never;
111
- }[keyof Exclude<T, null>] : never) & (null extends T ? {
112
- nullable: true;
113
- } : {
114
- nullable?: false;
115
- }))) & {
116
- metadata?: Record<string, unknown>;
117
- definitions?: {
118
- [K in keyof D]: JTDSchemaType<D[K], D>;
119
- };
120
- };
121
- declare type JTDDataDef<S, D extends Record<string, unknown>> = // ref
122
- (S extends {
123
- ref: string;
124
- } ? D extends {
125
- [K in S["ref"]]: infer V;
126
- } ? JTDDataDef<V, D> : never : S extends {
127
- type: NumberType;
128
- } ? number : S extends {
129
- type: "boolean";
130
- } ? boolean : S extends {
131
- type: "string";
132
- } ? string : S extends {
133
- type: "timestamp";
134
- } ? string | Date : S extends {
135
- enum: readonly (infer E)[];
136
- } ? string extends E ? never : [E] extends [string] ? E : never : S extends {
137
- elements: infer E;
138
- } ? JTDDataDef<E, D>[] : S extends {
139
- properties: Record<string, unknown>;
140
- optionalProperties?: Record<string, unknown>;
141
- additionalProperties?: boolean;
142
- } ? {
143
- -readonly [K in keyof S["properties"]]-?: JTDDataDef<S["properties"][K], D>;
144
- } & {
145
- -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef<S["optionalProperties"][K], D>;
146
- } & ([S["additionalProperties"]] extends [true] ? Record<string, unknown> : unknown) : S extends {
147
- properties?: Record<string, unknown>;
148
- optionalProperties: Record<string, unknown>;
149
- additionalProperties?: boolean;
150
- } ? {
151
- -readonly [K in keyof S["properties"]]-?: JTDDataDef<S["properties"][K], D>;
152
- } & {
153
- -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef<S["optionalProperties"][K], D>;
154
- } & ([S["additionalProperties"]] extends [true] ? Record<string, unknown> : unknown) : S extends {
155
- values: infer V;
156
- } ? Record<string, JTDDataDef<V, D>> : S extends {
157
- discriminator: infer M;
158
- mapping: Record<string, unknown>;
159
- } ? [M] extends [string] ? {
160
- [K in keyof S["mapping"]]: JTDDataDef<S["mapping"][K], D> & {
161
- [KM in M]: K;
162
- };
163
- }[keyof S["mapping"]] : never : unknown) | (S extends {
164
- nullable: true;
165
- } ? null : never);
166
- export declare type JTDDataType<S> = S extends {
167
- definitions: Record<string, unknown>;
168
- } ? JTDDataDef<S, S["definitions"]> : JTDDataDef<S, Record<string, never>>;
169
- export {};
@@ -1,4 +0,0 @@
1
- import type { Plugin } from '../ajv';
2
- export { AjvKeywordsError } from "./definitions";
3
- declare const ajvKeywords: Plugin<string | string[]>;
4
- export default ajvKeywords;
@@ -1,59 +0,0 @@
1
- export interface URIComponents {
2
- scheme?: string;
3
- userinfo?: string;
4
- host?: string;
5
- port?: number | string;
6
- path?: string;
7
- query?: string;
8
- fragment?: string;
9
- reference?: string;
10
- error?: string;
11
- }
12
- export interface URIOptions {
13
- scheme?: string;
14
- reference?: string;
15
- tolerant?: boolean;
16
- absolutePath?: boolean;
17
- iri?: boolean;
18
- unicodeSupport?: boolean;
19
- domainHost?: boolean;
20
- }
21
- export interface URISchemeHandler<Components extends URIComponents = URIComponents, Options extends URIOptions = URIOptions, ParentComponents extends URIComponents = URIComponents> {
22
- scheme: string;
23
- parse(components: ParentComponents, options: Options): Components;
24
- serialize(components: Components, options: Options): ParentComponents;
25
- unicodeSupport?: boolean;
26
- domainHost?: boolean;
27
- absolutePath?: boolean;
28
- }
29
- export interface URIRegExps {
30
- NOT_SCHEME: RegExp;
31
- NOT_USERINFO: RegExp;
32
- NOT_HOST: RegExp;
33
- NOT_PATH: RegExp;
34
- NOT_PATH_NOSCHEME: RegExp;
35
- NOT_QUERY: RegExp;
36
- NOT_FRAGMENT: RegExp;
37
- ESCAPE: RegExp;
38
- UNRESERVED: RegExp;
39
- OTHER_CHARS: RegExp;
40
- PCT_ENCODED: RegExp;
41
- IPV4ADDRESS: RegExp;
42
- IPV6ADDRESS: RegExp;
43
- }
44
- export declare const SCHEMES: {
45
- [scheme: string]: URISchemeHandler;
46
- };
47
- export declare function pctEncChar(chr: string): string;
48
- export declare function pctDecChars(str: string): string;
49
- export declare function parse(uriString: string, options?: URIOptions): URIComponents;
50
- export declare function removeDotSegments(input: string): string;
51
- export declare function serialize(components: URIComponents, options?: URIOptions): string;
52
- export declare function resolveComponents(base: URIComponents, relative: URIComponents, options?: URIOptions, skipNormalization?: boolean): URIComponents;
53
- export declare function resolve(baseURI: string, relativeURI: string, options?: URIOptions): string;
54
- export declare function normalize(uri: string, options?: URIOptions): string;
55
- export declare function normalize(uri: URIComponents, options?: URIOptions): URIComponents;
56
- export declare function equal(uriA: string, uriB: string, options?: URIOptions): boolean;
57
- export declare function equal(uriA: URIComponents, uriB: URIComponents, options?: URIOptions): boolean;
58
- export declare function escapeComponent(str: string, options?: URIOptions): string;
59
- export declare function unescapeComponent(str: string, options?: URIOptions): string;
@@ -1,16 +0,0 @@
1
- import type { AnySchemaObject } from './types';
2
- import AjvCore from './core';
3
- declare class Ajv extends AjvCore {
4
- _addVocabularies(): void;
5
- _addDefaultMetaSchema(): void;
6
- defaultMeta(): string | AnySchemaObject | undefined;
7
- }
8
- export default Ajv;
9
- export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, SchemaValidateFunction, ErrorObject, ErrorNoParams, } from "./types";
10
- export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core";
11
- export { SchemaCxt, SchemaObjCxt } from "./compile";
12
- export { KeywordCxt } from "./compile/validate";
13
- export { DefinedError } from "./vocabularies/errors";
14
- export { JSONType } from "./compile/rules";
15
- export { JSONSchemaType } from "./types/json-schema";
16
- export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen";
@@ -1,40 +0,0 @@
1
- export declare abstract class _CodeOrName {
2
- abstract readonly str: string;
3
- abstract readonly names: UsedNames;
4
- abstract toString(): string;
5
- abstract emptyStr(): boolean;
6
- }
7
- export declare const IDENTIFIER: RegExp;
8
- export declare class Name extends _CodeOrName {
9
- readonly str: string;
10
- constructor(s: string);
11
- toString(): string;
12
- emptyStr(): boolean;
13
- get names(): UsedNames;
14
- }
15
- export declare class _Code extends _CodeOrName {
16
- readonly _items: readonly CodeItem[];
17
- private _str?;
18
- private _names?;
19
- constructor(code: string | readonly CodeItem[]);
20
- toString(): string;
21
- emptyStr(): boolean;
22
- get str(): string;
23
- get names(): UsedNames;
24
- }
25
- export declare type CodeItem = Name | string | number | boolean | null;
26
- export declare type UsedNames = Record<string, number | undefined>;
27
- export declare type Code = _Code | Name;
28
- export declare type SafeExpr = Code | number | boolean | null;
29
- export declare const nil: _Code;
30
- declare type CodeArg = SafeExpr | string | undefined;
31
- export declare function _(strs: TemplateStringsArray, ...args: CodeArg[]): _Code;
32
- export declare function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code;
33
- export declare function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void;
34
- export declare function strConcat(c1: Code, c2: Code): Code;
35
- export declare function stringify(x: unknown): Code;
36
- export declare function safeStringify(x: unknown): string;
37
- export declare function getProperty(key: Code | string | number): Code;
38
- export declare function getEsmExportName(key: Code | string | number): Code;
39
- export declare function regexpCode(rx: RegExp): Code;
40
- export {};
@@ -1,79 +0,0 @@
1
- import type { ScopeValueSets, NameValue, ValueScope, ValueScopeName } from './scope';
2
- import { _Code, Code, Name } from './code';
3
- import { Scope } from './scope';
4
- export { _, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code } from "./code";
5
- export { Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds } from "./scope";
6
- export declare type SafeExpr = Code | number | boolean | null;
7
- export declare type Block = Code | (() => void);
8
- export declare const operators: {
9
- GT: _Code;
10
- GTE: _Code;
11
- LT: _Code;
12
- LTE: _Code;
13
- EQ: _Code;
14
- NEQ: _Code;
15
- NOT: _Code;
16
- OR: _Code;
17
- AND: _Code;
18
- ADD: _Code;
19
- };
20
- export interface CodeGenOptions {
21
- es5?: boolean;
22
- lines?: boolean;
23
- ownProperties?: boolean;
24
- }
25
- export declare class CodeGen {
26
- readonly _scope: Scope;
27
- readonly _extScope: ValueScope;
28
- readonly _values: ScopeValueSets;
29
- private readonly _nodes;
30
- private readonly _blockStarts;
31
- private readonly _constants;
32
- private readonly opts;
33
- constructor(extScope: ValueScope, opts?: CodeGenOptions);
34
- toString(): string;
35
- name(prefix: string): Name;
36
- scopeName(prefix: string): ValueScopeName;
37
- scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name;
38
- getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined;
39
- scopeRefs(scopeName: Name): Code;
40
- scopeCode(): Code;
41
- private _def;
42
- const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name;
43
- let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name;
44
- var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name;
45
- assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen;
46
- add(lhs: Code, rhs: SafeExpr): CodeGen;
47
- code(c: Block | SafeExpr): CodeGen;
48
- object(...keyValues: [Name | string, SafeExpr | string][]): _Code;
49
- if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen;
50
- elseIf(condition: Code | boolean): CodeGen;
51
- else(): CodeGen;
52
- endIf(): CodeGen;
53
- private _for;
54
- for(iteration: Code, forBody?: Block): CodeGen;
55
- forRange(nameOrPrefix: Name | string, from: SafeExpr, to: SafeExpr, forBody: (index: Name) => void, varKind?: Code): CodeGen;
56
- forOf(nameOrPrefix: Name | string, iterable: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen;
57
- forIn(nameOrPrefix: Name | string, obj: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen;
58
- endFor(): CodeGen;
59
- label(label: Name): CodeGen;
60
- break(label?: Code): CodeGen;
61
- return(value: Block | SafeExpr): CodeGen;
62
- try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen;
63
- throw(error: Code): CodeGen;
64
- block(body?: Block, nodeCount?: number): CodeGen;
65
- endBlock(nodeCount?: number): CodeGen;
66
- func(name: Name, args?: Code, async?: boolean, funcBody?: Block): CodeGen;
67
- endFunc(): CodeGen;
68
- optimize(n?: number): void;
69
- private _leafNode;
70
- private _blockNode;
71
- private _endBlockNode;
72
- private _elseNode;
73
- private get _root();
74
- private get _currNode();
75
- private set _currNode(value);
76
- }
77
- export declare function not<T extends Code | SafeExpr>(x: T): T;
78
- export declare function and(...args: Code[]): Code;
79
- export declare function or(...args: Code[]): Code;