@stryke/json 0.9.44 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/code-frames-BUtrssZ5.d.cts +17 -0
- package/dist/code-frames-BUtrssZ5.d.cts.map +1 -0
- package/dist/code-frames-BmUvlJ0w.cjs +82 -0
- package/dist/code-frames-CrTAYYSE.d.mts +17 -0
- package/dist/code-frames-CrTAYYSE.d.mts.map +1 -0
- package/dist/code-frames-DuBfTMu4.mjs +77 -0
- package/dist/code-frames-DuBfTMu4.mjs.map +1 -0
- package/dist/find-reference-B8xshNXL.d.mts +52 -0
- package/dist/find-reference-B8xshNXL.d.mts.map +1 -0
- package/dist/find-reference-C-YleCds.d.cts +52 -0
- package/dist/find-reference-C-YleCds.d.cts.map +1 -0
- package/dist/find-reference-DMSYEaaI.mjs +64 -0
- package/dist/find-reference-DMSYEaaI.mjs.map +1 -0
- package/dist/find-reference-De5vBQV2.cjs +86 -0
- package/dist/index-B_e8BwCm.d.cts +1 -0
- package/dist/index-CCt0lwyI.d.mts +1 -0
- package/dist/index-CDAfh8Ew.d.cts +1 -0
- package/dist/index-DvuJXuAN.d.mts +1 -0
- package/dist/index.cjs +37 -14
- package/dist/index.d.cts +11 -8
- package/dist/index.d.mts +12 -9
- package/dist/index.mjs +13 -8
- package/dist/is-number-BIwzZzyi.mjs +31 -0
- package/dist/is-number-BIwzZzyi.mjs.map +1 -0
- package/dist/is-number-c5xguIbS.cjs +42 -0
- package/dist/{type-checks/src/is-plain-object.mjs → is-object-BpfmzHWa.mjs} +19 -3
- package/dist/is-object-BpfmzHWa.mjs.map +1 -0
- package/dist/{type-checks/src/is-plain-object.cjs → is-object-umGh91v1.cjs} +24 -3
- package/dist/is-set-object-BmHip9em.cjs +108 -0
- package/dist/is-set-object-C1Qnj1Q8.mjs +98 -0
- package/dist/is-set-object-C1Qnj1Q8.mjs.map +1 -0
- package/dist/{type-checks/src/is-string.mjs → is-string-C2RK4Gjs.cjs} +7 -2
- package/dist/{type-checks/src/is-string.cjs → is-string-CLiBUSKV.mjs} +2 -2
- package/dist/is-string-CLiBUSKV.mjs.map +1 -0
- package/dist/{type-checks/src/is-undefined.cjs → is-undefined-CmyJWYGD.mjs} +2 -2
- package/dist/is-undefined-CmyJWYGD.mjs.map +1 -0
- package/dist/{type-checks/src/is-undefined.mjs → is-undefined-CnI0qe-z.cjs} +7 -2
- package/dist/parse-BGlhbY16.d.cts +9 -0
- package/dist/parse-BGlhbY16.d.cts.map +1 -0
- package/dist/parse-Bp6kkcQ4.cjs +127 -0
- package/dist/parse-ByDxRup5.cjs +62 -0
- package/dist/parse-Cj-YfhrI.d.mts +51 -0
- package/dist/parse-Cj-YfhrI.d.mts.map +1 -0
- package/dist/parse-DZfi3d96.d.cts +51 -0
- package/dist/parse-DZfi3d96.d.cts.map +1 -0
- package/dist/parse-Dn43ZK9y.mjs +52 -0
- package/dist/parse-Dn43ZK9y.mjs.map +1 -0
- package/dist/parse-error-7K8s4vWf.d.cts +15 -0
- package/dist/parse-error-7K8s4vWf.d.cts.map +1 -0
- package/dist/parse-error-Af4zHUQ_.mjs +34 -0
- package/dist/parse-error-Af4zHUQ_.mjs.map +1 -0
- package/dist/parse-error-DpEv3vo_.d.mts +15 -0
- package/dist/parse-error-DpEv3vo_.d.mts.map +1 -0
- package/dist/parse-error-N7UE-HMh.cjs +39 -0
- package/dist/parse-fXy5pbmE.d.mts +9 -0
- package/dist/parse-fXy5pbmE.d.mts.map +1 -0
- package/dist/parse-vw_qRD3F.mjs +81 -0
- package/dist/parse-vw_qRD3F.mjs.map +1 -0
- package/dist/pointer/find-reference.cjs +5 -65
- package/dist/pointer/find-reference.d.cts +2 -52
- package/dist/pointer/find-reference.d.mts +2 -52
- package/dist/pointer/find-reference.mjs +2 -63
- package/dist/pointer/index.cjs +15 -14
- package/dist/pointer/index.d.cts +2 -2
- package/dist/pointer/index.d.mts +2 -2
- package/dist/pointer/index.mjs +3 -2
- package/dist/pointer/parse.cjs +9 -86
- package/dist/pointer/parse.d.cts +2 -44
- package/dist/pointer/parse.d.mts +2 -44
- package/dist/pointer/parse.mjs +2 -80
- package/dist/pointer-B3W_Sme3.cjs +0 -0
- package/dist/pointer-Dn__XOdY.mjs +0 -0
- package/dist/schema-BO1HCrxv.d.cts +55 -0
- package/dist/schema-BO1HCrxv.d.cts.map +1 -0
- package/dist/schema-CmH1V_uI.d.mts +55 -0
- package/dist/schema-CmH1V_uI.d.mts.map +1 -0
- package/dist/schema-DGmzxHja.mjs +72 -0
- package/dist/schema-DGmzxHja.mjs.map +1 -0
- package/dist/schema-Dl018Aq4.cjs +106 -0
- package/dist/schema.cjs +8 -0
- package/dist/schema.d.cts +2 -0
- package/dist/schema.d.mts +3 -0
- package/dist/schema.mjs +3 -0
- package/dist/storm-json-8F9CKpXu.d.mts +70 -0
- package/dist/storm-json-8F9CKpXu.d.mts.map +1 -0
- package/dist/storm-json-BD6WFbrI.cjs +154 -0
- package/dist/storm-json-DvIEWMEH.d.cts +70 -0
- package/dist/storm-json-DvIEWMEH.d.cts.map +1 -0
- package/dist/storm-json-nkhJgTz4.mjs +116 -0
- package/dist/storm-json-nkhJgTz4.mjs.map +1 -0
- package/dist/storm-json.cjs +3 -116
- package/dist/storm-json.d.cts +2 -70
- package/dist/storm-json.d.mts +3 -70
- package/dist/storm-json.mjs +3 -115
- package/dist/stringify-Bc8OkhIr.d.cts +13 -0
- package/dist/stringify-Bc8OkhIr.d.cts.map +1 -0
- package/dist/stringify-BehjrfhS.cjs +78 -0
- package/dist/stringify-CFT1K1LE.d.mts +13 -0
- package/dist/stringify-CFT1K1LE.d.mts.map +1 -0
- package/dist/stringify-CYHjAvWm.mjs +68 -0
- package/dist/stringify-CYHjAvWm.mjs.map +1 -0
- package/dist/strip-comments-BA8MS_Fs.d.mts +11 -0
- package/dist/strip-comments-BA8MS_Fs.d.mts.map +1 -0
- package/dist/strip-comments-CmEG_smS.cjs +94 -0
- package/dist/strip-comments-Cz_Wc25t.d.cts +11 -0
- package/dist/strip-comments-Cz_Wc25t.d.cts.map +1 -0
- package/dist/strip-comments-Dq00N_Sg.mjs +89 -0
- package/dist/strip-comments-Dq00N_Sg.mjs.map +1 -0
- package/dist/types-Bn8rC098.d.cts +222 -0
- package/dist/types-Bn8rC098.d.cts.map +1 -0
- package/dist/types-CPQlxauZ.d.mts +222 -0
- package/dist/types-CPQlxauZ.d.mts.map +1 -0
- package/dist/types.d.cts +2 -69
- package/dist/types.d.mts +2 -69
- package/dist/types.mjs +0 -1
- package/dist/utils/code-frames.cjs +2 -76
- package/dist/utils/code-frames.d.cts +2 -17
- package/dist/utils/code-frames.d.mts +2 -17
- package/dist/utils/code-frames.mjs +2 -76
- package/dist/utils/index.cjs +13 -12
- package/dist/utils/index.d.cts +5 -5
- package/dist/utils/index.d.mts +6 -5
- package/dist/utils/index.mjs +6 -5
- package/dist/utils/parse-error.cjs +2 -33
- package/dist/utils/parse-error.d.cts +2 -15
- package/dist/utils/parse-error.d.mts +2 -15
- package/dist/utils/parse-error.mjs +2 -33
- package/dist/utils/parse.cjs +3 -51
- package/dist/utils/parse.d.cts +2 -9
- package/dist/utils/parse.d.mts +2 -9
- package/dist/utils/parse.mjs +2 -51
- package/dist/utils/stringify.cjs +3 -67
- package/dist/utils/stringify.d.cts +2 -13
- package/dist/utils/stringify.d.mts +2 -13
- package/dist/utils/stringify.mjs +2 -67
- package/dist/utils/strip-comments.cjs +2 -85
- package/dist/utils/strip-comments.d.cts +2 -11
- package/dist/utils/strip-comments.d.mts +2 -11
- package/dist/utils/strip-comments.mjs +2 -86
- package/dist/utils-jN2UkvqB.cjs +0 -0
- package/dist/utils-mEkKIcgl.mjs +0 -0
- package/package.json +12 -3
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/pointer/find-reference.d.cts.map +0 -1
- package/dist/pointer/find-reference.d.mts.map +0 -1
- package/dist/pointer/find-reference.mjs.map +0 -1
- package/dist/pointer/parse.d.cts.map +0 -1
- package/dist/pointer/parse.d.mts.map +0 -1
- package/dist/pointer/parse.mjs.map +0 -1
- package/dist/storm-json.d.cts.map +0 -1
- package/dist/storm-json.d.mts.map +0 -1
- package/dist/storm-json.mjs.map +0 -1
- package/dist/type-checks/src/get-object-tag.cjs +0 -15
- package/dist/type-checks/src/get-object-tag.mjs +0 -15
- package/dist/type-checks/src/get-object-tag.mjs.map +0 -1
- package/dist/type-checks/src/is-empty.cjs +0 -20
- package/dist/type-checks/src/is-empty.mjs +0 -21
- package/dist/type-checks/src/is-empty.mjs.map +0 -1
- package/dist/type-checks/src/is-non-null-object.cjs +0 -16
- package/dist/type-checks/src/is-non-null-object.mjs +0 -17
- package/dist/type-checks/src/is-non-null-object.mjs.map +0 -1
- package/dist/type-checks/src/is-null.cjs +0 -12
- package/dist/type-checks/src/is-null.mjs +0 -12
- package/dist/type-checks/src/is-null.mjs.map +0 -1
- package/dist/type-checks/src/is-number.cjs +0 -18
- package/dist/type-checks/src/is-number.mjs +0 -18
- package/dist/type-checks/src/is-number.mjs.map +0 -1
- package/dist/type-checks/src/is-object.cjs +0 -19
- package/dist/type-checks/src/is-object.mjs +0 -20
- package/dist/type-checks/src/is-object.mjs.map +0 -1
- package/dist/type-checks/src/is-plain-object.mjs.map +0 -1
- package/dist/type-checks/src/is-set-object.cjs +0 -19
- package/dist/type-checks/src/is-set-object.mjs +0 -20
- package/dist/type-checks/src/is-set-object.mjs.map +0 -1
- package/dist/type-checks/src/is-set.cjs +0 -19
- package/dist/type-checks/src/is-set.mjs +0 -20
- package/dist/type-checks/src/is-set.mjs.map +0 -1
- package/dist/type-checks/src/is-string.mjs.map +0 -1
- package/dist/type-checks/src/is-undefined.mjs.map +0 -1
- package/dist/types/src/base.cjs +0 -6
- package/dist/types/src/base.mjs +0 -6
- package/dist/types/src/base.mjs.map +0 -1
- package/dist/types/src/json.d.cts +0 -12
- package/dist/types/src/json.d.cts.map +0 -1
- package/dist/types/src/json.d.mts +0 -12
- package/dist/types/src/json.d.mts.map +0 -1
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.mts.map +0 -1
- package/dist/utils/code-frames.d.cts.map +0 -1
- package/dist/utils/code-frames.d.mts.map +0 -1
- package/dist/utils/code-frames.mjs.map +0 -1
- package/dist/utils/parse-error.d.cts.map +0 -1
- package/dist/utils/parse-error.d.mts.map +0 -1
- package/dist/utils/parse-error.mjs.map +0 -1
- package/dist/utils/parse.d.cts.map +0 -1
- package/dist/utils/parse.d.mts.map +0 -1
- package/dist/utils/parse.mjs.map +0 -1
- package/dist/utils/stringify.d.cts.map +0 -1
- package/dist/utils/stringify.d.mts.map +0 -1
- package/dist/utils/stringify.mjs.map +0 -1
- package/dist/utils/strip-comments.d.cts.map +0 -1
- package/dist/utils/strip-comments.d.mts.map +0 -1
- package/dist/utils/strip-comments.mjs.map +0 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { ParseOptions } from "jsonc-parser";
|
|
2
|
+
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
type PrimitiveJsonValue = string | number | boolean | undefined | null;
|
|
5
|
+
interface Class {
|
|
6
|
+
new (...args: any[]): any;
|
|
7
|
+
}
|
|
8
|
+
type JsonValue = PrimitiveJsonValue | JsonArray | JsonObject;
|
|
9
|
+
type JsonArray = Array<JsonValue>;
|
|
10
|
+
interface JsonObject {
|
|
11
|
+
[key: string]: JsonValue;
|
|
12
|
+
}
|
|
13
|
+
type ClassInstance = any;
|
|
14
|
+
type SerializableJsonValue = symbol | Set<JsonValue> | Map<JsonValue, JsonValue> | undefined | bigint | Date | ClassInstance | RegExp;
|
|
15
|
+
type Tree<T> = InnerNode<T> | Leaf<T>;
|
|
16
|
+
type Leaf<T> = [T];
|
|
17
|
+
type InnerNode<T> = [T, Record<string, Tree<T>>];
|
|
18
|
+
type PrimitiveTypeAnnotation = "number" | "undefined" | "bigint";
|
|
19
|
+
type LeafTypeAnnotation = PrimitiveTypeAnnotation | "regexp" | "Date" | "Error" | "URL";
|
|
20
|
+
type TypedArrayAnnotation = ["typed-array", string];
|
|
21
|
+
type ClassTypeAnnotation = ["class", string];
|
|
22
|
+
type SymbolTypeAnnotation = ["symbol", string];
|
|
23
|
+
type CustomTypeAnnotation = ["custom", string];
|
|
24
|
+
type SimpleTypeAnnotation = LeafTypeAnnotation | "map" | "set";
|
|
25
|
+
type CompositeTypeAnnotation = TypedArrayAnnotation | ClassTypeAnnotation | SymbolTypeAnnotation | CustomTypeAnnotation;
|
|
26
|
+
type TypeAnnotation = SimpleTypeAnnotation | CompositeTypeAnnotation;
|
|
27
|
+
interface JsonParseOptions extends ParseOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Expect JSON with javascript-style
|
|
30
|
+
*
|
|
31
|
+
* @defaultValue false
|
|
32
|
+
*/
|
|
33
|
+
expectComments?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Disallow javascript-style
|
|
36
|
+
*
|
|
37
|
+
* @defaultValue false
|
|
38
|
+
*/
|
|
39
|
+
disallowComments?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Allow trailing commas in the JSON content
|
|
42
|
+
*/
|
|
43
|
+
allowTrailingComma?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface JsonSerializeOptions {
|
|
46
|
+
/**
|
|
47
|
+
* the whitespaces to add as indentation to make the output more readable.
|
|
48
|
+
*
|
|
49
|
+
* @defaultValue 2
|
|
50
|
+
*/
|
|
51
|
+
spaces?: number;
|
|
52
|
+
}
|
|
53
|
+
interface JsonParserResult {
|
|
54
|
+
json: JsonValue;
|
|
55
|
+
meta?: {
|
|
56
|
+
values?: Tree<TypeAnnotation> | Record<string, Tree<TypeAnnotation>> | undefined;
|
|
57
|
+
referentialEqualities?: Record<string, string[]> | [string[]] | [string[], Record<string, string[]>];
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
interface JsonParserInterface {
|
|
61
|
+
parse: <TData = any>(strData: string) => TData;
|
|
62
|
+
stringify: <TData = any>(data: TData) => string;
|
|
63
|
+
serialize: (object: JsonValue) => JsonParserResult;
|
|
64
|
+
deserialize: <TData = any>(payload: JsonParserResult) => TData;
|
|
65
|
+
register: <TData = any, TJsonValue extends JsonValue = JsonValue>(name: string, serialize: (object: JsonValue) => TJsonValue, deserialize: (payload: TJsonValue) => TData, isApplicable: (data: any) => data is TData) => void;
|
|
66
|
+
}
|
|
67
|
+
interface JsonSchema7AnyType {
|
|
68
|
+
$ref?: string;
|
|
69
|
+
}
|
|
70
|
+
interface JsonSchema7ArrayType {
|
|
71
|
+
type: "array";
|
|
72
|
+
items?: JsonSchema7Type;
|
|
73
|
+
minItems?: number;
|
|
74
|
+
maxItems?: number;
|
|
75
|
+
}
|
|
76
|
+
interface JsonSchema7BigintType {
|
|
77
|
+
type: "integer";
|
|
78
|
+
format: "int64";
|
|
79
|
+
minimum?: bigint;
|
|
80
|
+
exclusiveMinimum?: bigint;
|
|
81
|
+
maximum?: bigint;
|
|
82
|
+
exclusiveMaximum?: bigint;
|
|
83
|
+
multipleOf?: bigint;
|
|
84
|
+
}
|
|
85
|
+
interface JsonSchema7BooleanType {
|
|
86
|
+
type: "boolean";
|
|
87
|
+
}
|
|
88
|
+
type JsonSchema7DateType = {
|
|
89
|
+
type: "integer" | "string";
|
|
90
|
+
format: "unix-time" | "date-time" | "date";
|
|
91
|
+
minimum?: number;
|
|
92
|
+
maximum?: number;
|
|
93
|
+
} | {
|
|
94
|
+
anyOf: JsonSchema7DateType[];
|
|
95
|
+
};
|
|
96
|
+
interface JsonSchema7EnumType {
|
|
97
|
+
type: "string";
|
|
98
|
+
enum: string[];
|
|
99
|
+
}
|
|
100
|
+
interface JsonSchema7AllOfType {
|
|
101
|
+
allOf: JsonSchema7Type[];
|
|
102
|
+
unevaluatedProperties?: boolean;
|
|
103
|
+
}
|
|
104
|
+
interface JsonSchema7PrimitiveLiteralType {
|
|
105
|
+
type: "string" | "number" | "integer" | "boolean";
|
|
106
|
+
const: string | number | boolean;
|
|
107
|
+
}
|
|
108
|
+
type JsonSchema7LiteralType = JsonSchema7PrimitiveLiteralType | {
|
|
109
|
+
type: "object" | "array";
|
|
110
|
+
};
|
|
111
|
+
interface JsonSchema7MapType {
|
|
112
|
+
type: "array";
|
|
113
|
+
maxItems: 125;
|
|
114
|
+
items: {
|
|
115
|
+
type: "array";
|
|
116
|
+
items: [JsonSchema7Type, JsonSchema7Type];
|
|
117
|
+
minItems: 2;
|
|
118
|
+
maxItems: 2;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
interface JsonSchema7NativeEnumType {
|
|
122
|
+
type: "string" | "number" | ["string", "number"];
|
|
123
|
+
enum: (string | number)[];
|
|
124
|
+
}
|
|
125
|
+
interface JsonSchema7NeverType {
|
|
126
|
+
not: JsonSchema7AnyType;
|
|
127
|
+
}
|
|
128
|
+
interface JsonSchema7NullType {
|
|
129
|
+
type: "null";
|
|
130
|
+
}
|
|
131
|
+
type JsonSchema7NullableType = {
|
|
132
|
+
anyOf: [JsonSchema7Type, JsonSchema7NullType];
|
|
133
|
+
} | {
|
|
134
|
+
type: [string, "null"];
|
|
135
|
+
};
|
|
136
|
+
interface JsonSchema7NumberType {
|
|
137
|
+
type: "number" | "integer";
|
|
138
|
+
minimum?: number;
|
|
139
|
+
exclusiveMinimum?: number;
|
|
140
|
+
maximum?: number;
|
|
141
|
+
exclusiveMaximum?: number;
|
|
142
|
+
multipleOf?: number;
|
|
143
|
+
}
|
|
144
|
+
interface JsonSchema7ObjectType {
|
|
145
|
+
type: "object";
|
|
146
|
+
properties: Record<string, JsonSchema7Type>;
|
|
147
|
+
additionalProperties?: boolean | JsonSchema7Type;
|
|
148
|
+
required?: string[];
|
|
149
|
+
}
|
|
150
|
+
interface JsonSchema7StringType {
|
|
151
|
+
type: "string";
|
|
152
|
+
minLength?: number;
|
|
153
|
+
maxLength?: number;
|
|
154
|
+
format?: "email" | "idn-email" | "uri" | "uuid" | "date-time" | "ipv4" | "ipv6" | "date" | "time" | "duration";
|
|
155
|
+
pattern?: string;
|
|
156
|
+
contentEncoding?: string;
|
|
157
|
+
}
|
|
158
|
+
interface JsonSchema7SetType {
|
|
159
|
+
type: "array";
|
|
160
|
+
uniqueItems: true;
|
|
161
|
+
items?: JsonSchema7Type;
|
|
162
|
+
minItems?: number;
|
|
163
|
+
maxItems?: number;
|
|
164
|
+
}
|
|
165
|
+
type JsonSchema7RecordPropertyNamesType = Omit<JsonSchema7StringType, "type"> | Omit<JsonSchema7EnumType, "type">;
|
|
166
|
+
interface JsonSchema7RecordType {
|
|
167
|
+
type: "object";
|
|
168
|
+
additionalProperties?: JsonSchema7Type | true;
|
|
169
|
+
propertyNames?: JsonSchema7RecordPropertyNamesType;
|
|
170
|
+
}
|
|
171
|
+
type JsonSchema7TupleType = {
|
|
172
|
+
type: "array";
|
|
173
|
+
minItems: number;
|
|
174
|
+
items: JsonSchema7Type[];
|
|
175
|
+
} & ({
|
|
176
|
+
maxItems: number;
|
|
177
|
+
} | {
|
|
178
|
+
additionalItems?: JsonSchema7Type;
|
|
179
|
+
});
|
|
180
|
+
interface JsonSchema7UndefinedType {
|
|
181
|
+
not: JsonSchema7AnyType;
|
|
182
|
+
}
|
|
183
|
+
type JsonSchema7Primitive = "string" | "number" | "integer" | "boolean" | "null";
|
|
184
|
+
type JsonSchema7UnionType = JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType;
|
|
185
|
+
type JsonSchema7PrimitiveUnionType = {
|
|
186
|
+
type: JsonSchema7Primitive | JsonSchema7Primitive[];
|
|
187
|
+
} | {
|
|
188
|
+
type: JsonSchema7Primitive | JsonSchema7Primitive[];
|
|
189
|
+
enum: (string | number | bigint | boolean | null)[];
|
|
190
|
+
};
|
|
191
|
+
type JsonSchema7UnknownType = JsonSchema7AnyType;
|
|
192
|
+
interface JsonSchema7AnyOfType {
|
|
193
|
+
anyOf: JsonSchema7Type[];
|
|
194
|
+
}
|
|
195
|
+
interface JsonSchema7RefType {
|
|
196
|
+
$ref: string;
|
|
197
|
+
}
|
|
198
|
+
interface JsonSchema7Meta {
|
|
199
|
+
$id?: string;
|
|
200
|
+
$ref?: string;
|
|
201
|
+
$schema?: string;
|
|
202
|
+
$comment?: string;
|
|
203
|
+
title?: string;
|
|
204
|
+
default?: any;
|
|
205
|
+
description?: string;
|
|
206
|
+
/**
|
|
207
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
208
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
209
|
+
*/
|
|
210
|
+
$defs?: {
|
|
211
|
+
[key: string]: JsonSchema7Type;
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
type JsonSchema7TypeUnion = JsonSchema7StringType | JsonSchema7ArrayType | JsonSchema7NumberType | JsonSchema7BigintType | JsonSchema7BooleanType | JsonSchema7DateType | JsonSchema7EnumType | JsonSchema7LiteralType | JsonSchema7NativeEnumType | JsonSchema7NullType | JsonSchema7NumberType | JsonSchema7ObjectType | JsonSchema7RecordType | JsonSchema7TupleType | JsonSchema7UnionType | JsonSchema7UndefinedType | JsonSchema7RefType | JsonSchema7NeverType | JsonSchema7MapType | JsonSchema7AnyType | JsonSchema7NullableType | JsonSchema7AllOfType | JsonSchema7UnknownType | JsonSchema7SetType;
|
|
215
|
+
/**
|
|
216
|
+
* JSON Schema v7
|
|
217
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
218
|
+
*/
|
|
219
|
+
type JsonSchema7Type = JsonSchema7TypeUnion & JsonSchema7Meta;
|
|
220
|
+
//#endregion
|
|
221
|
+
export { TypeAnnotation as $, JsonSchema7PrimitiveLiteralType as A, JsonSchema7UndefinedType as B, JsonSchema7NativeEnumType as C, JsonSchema7NumberType as D, JsonSchema7NullableType as E, JsonSchema7SetType as F, Leaf as G, JsonSchema7UnknownType as H, JsonSchema7StringType as I, PrimitiveTypeAnnotation as J, LeafTypeAnnotation as K, JsonSchema7TupleType as L, JsonSchema7RecordPropertyNamesType as M, JsonSchema7RecordType as N, JsonSchema7ObjectType as O, JsonSchema7RefType as P, Tree as Q, JsonSchema7Type as R, JsonSchema7Meta as S, JsonSchema7NullType as T, JsonSerializeOptions as U, JsonSchema7UnionType as V, JsonValue as W, SimpleTypeAnnotation as X, SerializableJsonValue as Y, SymbolTypeAnnotation as Z, JsonSchema7BooleanType as _, CustomTypeAnnotation as a, JsonSchema7LiteralType as b, JsonObject as c, JsonParserResult as d, TypedArrayAnnotation as et, JsonSchema7AllOfType as f, JsonSchema7BigintType as g, JsonSchema7ArrayType as h, CompositeTypeAnnotation as i, JsonSchema7PrimitiveUnionType as j, JsonSchema7Primitive as k, JsonParseOptions as l, JsonSchema7AnyType as m, ClassInstance as n, InnerNode as o, JsonSchema7AnyOfType as p, PrimitiveJsonValue as q, ClassTypeAnnotation as r, JsonArray as s, Class as t, JsonParserInterface as u, JsonSchema7DateType as v, JsonSchema7NeverType as w, JsonSchema7MapType as x, JsonSchema7EnumType as y, JsonSchema7TypeUnion as z };
|
|
222
|
+
//# sourceMappingURL=types-CPQlxauZ.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-CPQlxauZ.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAoBY,kBAAA;UAEK,KAAA;EAFL,KAAA,GAAA,IAAA,EAAA,GAAA,EAAA,CAAA,EAAkB,GAAA;AAE9B;AAIY,KAAA,SAAA,GAAY,kBAAH,GAAwB,SAAxB,GAAoC,UAApC;AAAG,KAEZ,SAAA,GAAY,KAFA,CAEM,SAFN,CAAA;AAAqB,UAI5B,UAAA,CAJ4B;EAAY,CAAA,GAAA,EAAA,MAAA,CAAA,EAKxC,SALwC;;AAE7C,KAMA,aAAA,GANkB,GAAA;AAEb,KAML,qBAAA,GALK,MAAS,GAOtB,GAPsB,CAOlB,SAPkB,CAAA,GAQtB,GARsB,CAQlB,SARkB,EAQP,SARO,CAAA,GAAA,SAAA,GAAA,MAAA,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;;;;KAMQ,eAAA,GAAkB,uBAAuB"}
|
package/dist/types.d.cts
CHANGED
|
@@ -1,69 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/types.d.ts
|
|
4
|
-
type PrimitiveJsonValue = string | number | boolean | undefined | null;
|
|
5
|
-
interface Class {
|
|
6
|
-
new (...args: any[]): any;
|
|
7
|
-
}
|
|
8
|
-
type JsonValue = PrimitiveJsonValue | JsonArray | JsonObject;
|
|
9
|
-
type JsonArray = Array<JsonValue>;
|
|
10
|
-
interface JsonObject {
|
|
11
|
-
[key: string]: JsonValue;
|
|
12
|
-
}
|
|
13
|
-
type ClassInstance = any;
|
|
14
|
-
type SerializableJsonValue = symbol | Set<JsonValue> | Map<JsonValue, JsonValue> | undefined | bigint | Date | ClassInstance | RegExp;
|
|
15
|
-
type Tree<T> = InnerNode<T> | Leaf<T>;
|
|
16
|
-
type Leaf<T> = [T];
|
|
17
|
-
type InnerNode<T> = [T, Record<string, Tree<T>>];
|
|
18
|
-
type PrimitiveTypeAnnotation = "number" | "undefined" | "bigint";
|
|
19
|
-
type LeafTypeAnnotation = PrimitiveTypeAnnotation | "regexp" | "Date" | "Error" | "URL";
|
|
20
|
-
type TypedArrayAnnotation = ["typed-array", string];
|
|
21
|
-
type ClassTypeAnnotation = ["class", string];
|
|
22
|
-
type SymbolTypeAnnotation = ["symbol", string];
|
|
23
|
-
type CustomTypeAnnotation = ["custom", string];
|
|
24
|
-
type SimpleTypeAnnotation = LeafTypeAnnotation | "map" | "set";
|
|
25
|
-
type CompositeTypeAnnotation = TypedArrayAnnotation | ClassTypeAnnotation | SymbolTypeAnnotation | CustomTypeAnnotation;
|
|
26
|
-
type TypeAnnotation = SimpleTypeAnnotation | CompositeTypeAnnotation;
|
|
27
|
-
interface JsonParseOptions extends ParseOptions {
|
|
28
|
-
/**
|
|
29
|
-
* Expect JSON with javascript-style
|
|
30
|
-
*
|
|
31
|
-
* @defaultValue false
|
|
32
|
-
*/
|
|
33
|
-
expectComments?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Disallow javascript-style
|
|
36
|
-
*
|
|
37
|
-
* @defaultValue false
|
|
38
|
-
*/
|
|
39
|
-
disallowComments?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Allow trailing commas in the JSON content
|
|
42
|
-
*/
|
|
43
|
-
allowTrailingComma?: boolean;
|
|
44
|
-
}
|
|
45
|
-
interface JsonSerializeOptions {
|
|
46
|
-
/**
|
|
47
|
-
* the whitespaces to add as indentation to make the output more readable.
|
|
48
|
-
*
|
|
49
|
-
* @defaultValue 2
|
|
50
|
-
*/
|
|
51
|
-
spaces?: number;
|
|
52
|
-
}
|
|
53
|
-
interface JsonParserResult {
|
|
54
|
-
json: JsonValue;
|
|
55
|
-
meta?: {
|
|
56
|
-
values?: Tree<TypeAnnotation> | Record<string, Tree<TypeAnnotation>> | undefined;
|
|
57
|
-
referentialEqualities?: Record<string, string[]> | [string[]] | [string[], Record<string, string[]>];
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
interface JsonParserInterface {
|
|
61
|
-
parse: <TData = any>(strData: string) => TData;
|
|
62
|
-
stringify: <TData = any>(data: TData) => string;
|
|
63
|
-
serialize: (object: JsonValue) => JsonParserResult;
|
|
64
|
-
deserialize: <TData = any>(payload: JsonParserResult) => TData;
|
|
65
|
-
register: <TData = any, TJsonValue extends JsonValue = JsonValue>(name: string, serialize: (object: JsonValue) => TJsonValue, deserialize: (payload: TJsonValue) => TData, isApplicable: (data: any) => data is TData) => void;
|
|
66
|
-
}
|
|
67
|
-
//#endregion
|
|
68
|
-
export { Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, PrimitiveJsonValue, PrimitiveTypeAnnotation, SerializableJsonValue, SimpleTypeAnnotation, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation };
|
|
69
|
-
//# sourceMappingURL=types.d.cts.map
|
|
1
|
+
import { $ as TypeAnnotation, A as JsonSchema7PrimitiveLiteralType, B as JsonSchema7UndefinedType, C as JsonSchema7NativeEnumType, D as JsonSchema7NumberType, E as JsonSchema7NullableType, F as JsonSchema7SetType, G as Leaf, H as JsonSchema7UnknownType, I as JsonSchema7StringType, J as PrimitiveTypeAnnotation, K as LeafTypeAnnotation, L as JsonSchema7TupleType, M as JsonSchema7RecordPropertyNamesType, N as JsonSchema7RecordType, O as JsonSchema7ObjectType, P as JsonSchema7RefType, Q as Tree, R as JsonSchema7Type, S as JsonSchema7Meta, T as JsonSchema7NullType, U as JsonSerializeOptions, V as JsonSchema7UnionType, W as JsonValue, X as SimpleTypeAnnotation, Y as SerializableJsonValue, Z as SymbolTypeAnnotation, _ as JsonSchema7BooleanType, a as CustomTypeAnnotation, b as JsonSchema7LiteralType, c as JsonObject, d as JsonParserResult, et as TypedArrayAnnotation, f as JsonSchema7AllOfType, g as JsonSchema7BigintType, h as JsonSchema7ArrayType, i as CompositeTypeAnnotation, j as JsonSchema7PrimitiveUnionType, k as JsonSchema7Primitive, l as JsonParseOptions, m as JsonSchema7AnyType, n as ClassInstance, o as InnerNode, p as JsonSchema7AnyOfType, q as PrimitiveJsonValue, r as ClassTypeAnnotation, s as JsonArray, t as Class, u as JsonParserInterface, v as JsonSchema7DateType, w as JsonSchema7NeverType, x as JsonSchema7MapType, y as JsonSchema7EnumType, z as JsonSchema7TypeUnion } from "./types-Bn8rC098.cjs";
|
|
2
|
+
export { Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSchema7AllOfType, JsonSchema7AnyOfType, JsonSchema7AnyType, JsonSchema7ArrayType, JsonSchema7BigintType, JsonSchema7BooleanType, JsonSchema7DateType, JsonSchema7EnumType, JsonSchema7LiteralType, JsonSchema7MapType, JsonSchema7Meta, JsonSchema7NativeEnumType, JsonSchema7NeverType, JsonSchema7NullType, JsonSchema7NullableType, JsonSchema7NumberType, JsonSchema7ObjectType, JsonSchema7Primitive, JsonSchema7PrimitiveLiteralType, JsonSchema7PrimitiveUnionType, JsonSchema7RecordPropertyNamesType, JsonSchema7RecordType, JsonSchema7RefType, JsonSchema7SetType, JsonSchema7StringType, JsonSchema7TupleType, JsonSchema7Type, JsonSchema7TypeUnion, JsonSchema7UndefinedType, JsonSchema7UnionType, JsonSchema7UnknownType, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, PrimitiveJsonValue, PrimitiveTypeAnnotation, SerializableJsonValue, SimpleTypeAnnotation, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,69 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/types.d.ts
|
|
4
|
-
type PrimitiveJsonValue = string | number | boolean | undefined | null;
|
|
5
|
-
interface Class {
|
|
6
|
-
new (...args: any[]): any;
|
|
7
|
-
}
|
|
8
|
-
type JsonValue = PrimitiveJsonValue | JsonArray | JsonObject;
|
|
9
|
-
type JsonArray = Array<JsonValue>;
|
|
10
|
-
interface JsonObject {
|
|
11
|
-
[key: string]: JsonValue;
|
|
12
|
-
}
|
|
13
|
-
type ClassInstance = any;
|
|
14
|
-
type SerializableJsonValue = symbol | Set<JsonValue> | Map<JsonValue, JsonValue> | undefined | bigint | Date | ClassInstance | RegExp;
|
|
15
|
-
type Tree<T> = InnerNode<T> | Leaf<T>;
|
|
16
|
-
type Leaf<T> = [T];
|
|
17
|
-
type InnerNode<T> = [T, Record<string, Tree<T>>];
|
|
18
|
-
type PrimitiveTypeAnnotation = "number" | "undefined" | "bigint";
|
|
19
|
-
type LeafTypeAnnotation = PrimitiveTypeAnnotation | "regexp" | "Date" | "Error" | "URL";
|
|
20
|
-
type TypedArrayAnnotation = ["typed-array", string];
|
|
21
|
-
type ClassTypeAnnotation = ["class", string];
|
|
22
|
-
type SymbolTypeAnnotation = ["symbol", string];
|
|
23
|
-
type CustomTypeAnnotation = ["custom", string];
|
|
24
|
-
type SimpleTypeAnnotation = LeafTypeAnnotation | "map" | "set";
|
|
25
|
-
type CompositeTypeAnnotation = TypedArrayAnnotation | ClassTypeAnnotation | SymbolTypeAnnotation | CustomTypeAnnotation;
|
|
26
|
-
type TypeAnnotation = SimpleTypeAnnotation | CompositeTypeAnnotation;
|
|
27
|
-
interface JsonParseOptions extends ParseOptions {
|
|
28
|
-
/**
|
|
29
|
-
* Expect JSON with javascript-style
|
|
30
|
-
*
|
|
31
|
-
* @defaultValue false
|
|
32
|
-
*/
|
|
33
|
-
expectComments?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Disallow javascript-style
|
|
36
|
-
*
|
|
37
|
-
* @defaultValue false
|
|
38
|
-
*/
|
|
39
|
-
disallowComments?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Allow trailing commas in the JSON content
|
|
42
|
-
*/
|
|
43
|
-
allowTrailingComma?: boolean;
|
|
44
|
-
}
|
|
45
|
-
interface JsonSerializeOptions {
|
|
46
|
-
/**
|
|
47
|
-
* the whitespaces to add as indentation to make the output more readable.
|
|
48
|
-
*
|
|
49
|
-
* @defaultValue 2
|
|
50
|
-
*/
|
|
51
|
-
spaces?: number;
|
|
52
|
-
}
|
|
53
|
-
interface JsonParserResult {
|
|
54
|
-
json: JsonValue;
|
|
55
|
-
meta?: {
|
|
56
|
-
values?: Tree<TypeAnnotation> | Record<string, Tree<TypeAnnotation>> | undefined;
|
|
57
|
-
referentialEqualities?: Record<string, string[]> | [string[]] | [string[], Record<string, string[]>];
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
interface JsonParserInterface {
|
|
61
|
-
parse: <TData = any>(strData: string) => TData;
|
|
62
|
-
stringify: <TData = any>(data: TData) => string;
|
|
63
|
-
serialize: (object: JsonValue) => JsonParserResult;
|
|
64
|
-
deserialize: <TData = any>(payload: JsonParserResult) => TData;
|
|
65
|
-
register: <TData = any, TJsonValue extends JsonValue = JsonValue>(name: string, serialize: (object: JsonValue) => TJsonValue, deserialize: (payload: TJsonValue) => TData, isApplicable: (data: any) => data is TData) => void;
|
|
66
|
-
}
|
|
67
|
-
//#endregion
|
|
68
|
-
export { Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, PrimitiveJsonValue, PrimitiveTypeAnnotation, SerializableJsonValue, SimpleTypeAnnotation, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation };
|
|
69
|
-
//# sourceMappingURL=types.d.mts.map
|
|
1
|
+
import { $ as TypeAnnotation, A as JsonSchema7PrimitiveLiteralType, B as JsonSchema7UndefinedType, C as JsonSchema7NativeEnumType, D as JsonSchema7NumberType, E as JsonSchema7NullableType, F as JsonSchema7SetType, G as Leaf, H as JsonSchema7UnknownType, I as JsonSchema7StringType, J as PrimitiveTypeAnnotation, K as LeafTypeAnnotation, L as JsonSchema7TupleType, M as JsonSchema7RecordPropertyNamesType, N as JsonSchema7RecordType, O as JsonSchema7ObjectType, P as JsonSchema7RefType, Q as Tree, R as JsonSchema7Type, S as JsonSchema7Meta, T as JsonSchema7NullType, U as JsonSerializeOptions, V as JsonSchema7UnionType, W as JsonValue, X as SimpleTypeAnnotation, Y as SerializableJsonValue, Z as SymbolTypeAnnotation, _ as JsonSchema7BooleanType, a as CustomTypeAnnotation, b as JsonSchema7LiteralType, c as JsonObject, d as JsonParserResult, et as TypedArrayAnnotation, f as JsonSchema7AllOfType, g as JsonSchema7BigintType, h as JsonSchema7ArrayType, i as CompositeTypeAnnotation, j as JsonSchema7PrimitiveUnionType, k as JsonSchema7Primitive, l as JsonParseOptions, m as JsonSchema7AnyType, n as ClassInstance, o as InnerNode, p as JsonSchema7AnyOfType, q as PrimitiveJsonValue, r as ClassTypeAnnotation, s as JsonArray, t as Class, u as JsonParserInterface, v as JsonSchema7DateType, w as JsonSchema7NeverType, x as JsonSchema7MapType, y as JsonSchema7EnumType, z as JsonSchema7TypeUnion } from "./types-CPQlxauZ.mjs";
|
|
2
|
+
export { Class, ClassInstance, ClassTypeAnnotation, CompositeTypeAnnotation, CustomTypeAnnotation, InnerNode, JsonArray, JsonObject, JsonParseOptions, JsonParserInterface, JsonParserResult, JsonSchema7AllOfType, JsonSchema7AnyOfType, JsonSchema7AnyType, JsonSchema7ArrayType, JsonSchema7BigintType, JsonSchema7BooleanType, JsonSchema7DateType, JsonSchema7EnumType, JsonSchema7LiteralType, JsonSchema7MapType, JsonSchema7Meta, JsonSchema7NativeEnumType, JsonSchema7NeverType, JsonSchema7NullType, JsonSchema7NullableType, JsonSchema7NumberType, JsonSchema7ObjectType, JsonSchema7Primitive, JsonSchema7PrimitiveLiteralType, JsonSchema7PrimitiveUnionType, JsonSchema7RecordPropertyNamesType, JsonSchema7RecordType, JsonSchema7RefType, JsonSchema7SetType, JsonSchema7StringType, JsonSchema7TupleType, JsonSchema7Type, JsonSchema7TypeUnion, JsonSchema7UndefinedType, JsonSchema7UnionType, JsonSchema7UnknownType, JsonSerializeOptions, JsonValue, Leaf, LeafTypeAnnotation, PrimitiveJsonValue, PrimitiveTypeAnnotation, SerializableJsonValue, SimpleTypeAnnotation, SymbolTypeAnnotation, Tree, TypeAnnotation, TypedArrayAnnotation };
|
package/dist/types.mjs
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,77 +1,3 @@
|
|
|
1
|
+
const require_code_frames = require('../code-frames-BmUvlJ0w.cjs');
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* RegExp to test for newlines in terminal.
|
|
5
|
-
*/
|
|
6
|
-
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
7
|
-
/**
|
|
8
|
-
* Extract what lines should be marked and highlighted.
|
|
9
|
-
*/
|
|
10
|
-
function getMarkerLines(loc, source, opts = {}) {
|
|
11
|
-
const startLoc = {
|
|
12
|
-
column: 0,
|
|
13
|
-
line: -1,
|
|
14
|
-
...loc.start
|
|
15
|
-
};
|
|
16
|
-
const endLoc = {
|
|
17
|
-
...startLoc,
|
|
18
|
-
...loc.end
|
|
19
|
-
};
|
|
20
|
-
const { linesAbove = 2, linesBelow = 3 } = opts || {};
|
|
21
|
-
const startLine = startLoc.line;
|
|
22
|
-
const startColumn = startLoc.column;
|
|
23
|
-
const endLine = endLoc.line;
|
|
24
|
-
const endColumn = endLoc.column;
|
|
25
|
-
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
26
|
-
let end = Math.min(source.length, endLine + linesBelow);
|
|
27
|
-
if (startLine === -1) start = 0;
|
|
28
|
-
if (endLine === -1) end = source.length;
|
|
29
|
-
const lineDiff = endLine - startLine;
|
|
30
|
-
const markerLines = {};
|
|
31
|
-
if (lineDiff) for (let i = 0; i <= lineDiff; i++) {
|
|
32
|
-
const lineNumber = i + startLine;
|
|
33
|
-
if (!startColumn) markerLines[lineNumber] = true;
|
|
34
|
-
else if (i === 0) markerLines[lineNumber] = [startColumn, (source[lineNumber - 1]?.length ?? 0) - startColumn + 1];
|
|
35
|
-
else if (i === lineDiff) markerLines[lineNumber] = [0, endColumn];
|
|
36
|
-
else markerLines[lineNumber] = [0, source[lineNumber - i]?.length ?? 0];
|
|
37
|
-
}
|
|
38
|
-
else if (startColumn === endColumn) markerLines[startLine] = startColumn ? [startColumn, 0] : true;
|
|
39
|
-
else markerLines[startLine] = [startColumn, endColumn - startColumn];
|
|
40
|
-
return {
|
|
41
|
-
start,
|
|
42
|
-
end,
|
|
43
|
-
markerLines
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
47
|
-
const { start, end, markerLines } = getMarkerLines(loc, rawLines.split(NEWLINE), opts);
|
|
48
|
-
const numberMaxWidth = String(end).length;
|
|
49
|
-
return (opts.highlight ? opts.highlight(rawLines) : rawLines).split(NEWLINE).slice(start, end).map((line, index) => {
|
|
50
|
-
const number = start + 1 + index;
|
|
51
|
-
const gutter = ` ${` ${number}`.slice(-numberMaxWidth)} | `;
|
|
52
|
-
const hasMarker = Boolean(markerLines[number] ?? false);
|
|
53
|
-
if (hasMarker) {
|
|
54
|
-
let markerLine = "";
|
|
55
|
-
if (Array.isArray(hasMarker)) {
|
|
56
|
-
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
|
57
|
-
const numberOfMarkers = hasMarker[1] || 1;
|
|
58
|
-
markerLine = [
|
|
59
|
-
"\n ",
|
|
60
|
-
gutter.replace(/\d/g, " "),
|
|
61
|
-
markerSpacing,
|
|
62
|
-
"^".repeat(numberOfMarkers)
|
|
63
|
-
].join("");
|
|
64
|
-
}
|
|
65
|
-
return [
|
|
66
|
-
">",
|
|
67
|
-
gutter,
|
|
68
|
-
line,
|
|
69
|
-
markerLine
|
|
70
|
-
].join("");
|
|
71
|
-
}
|
|
72
|
-
return ` ${gutter}${line}`;
|
|
73
|
-
}).join("\n");
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
//#endregion
|
|
77
|
-
exports.codeFrameColumns = codeFrameColumns;
|
|
3
|
+
exports.codeFrameColumns = require_code_frames.codeFrameColumns;
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
column: number;
|
|
4
|
-
line: number;
|
|
5
|
-
}
|
|
6
|
-
interface NodeLocation {
|
|
7
|
-
end?: Location;
|
|
8
|
-
start?: Location;
|
|
9
|
-
}
|
|
10
|
-
declare function codeFrameColumns(rawLines: string, loc: NodeLocation, opts?: {
|
|
11
|
-
linesAbove?: number;
|
|
12
|
-
linesBelow?: number;
|
|
13
|
-
highlight?: (rawLines: string) => string;
|
|
14
|
-
}): string;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { codeFrameColumns };
|
|
17
|
-
//# sourceMappingURL=code-frames.d.cts.map
|
|
1
|
+
import { t as codeFrameColumns } from "../code-frames-BUtrssZ5.cjs";
|
|
2
|
+
export { codeFrameColumns };
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
column: number;
|
|
4
|
-
line: number;
|
|
5
|
-
}
|
|
6
|
-
interface NodeLocation {
|
|
7
|
-
end?: Location;
|
|
8
|
-
start?: Location;
|
|
9
|
-
}
|
|
10
|
-
declare function codeFrameColumns(rawLines: string, loc: NodeLocation, opts?: {
|
|
11
|
-
linesAbove?: number;
|
|
12
|
-
linesBelow?: number;
|
|
13
|
-
highlight?: (rawLines: string) => string;
|
|
14
|
-
}): string;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { codeFrameColumns };
|
|
17
|
-
//# sourceMappingURL=code-frames.d.mts.map
|
|
1
|
+
import { t as codeFrameColumns } from "../code-frames-CrTAYYSE.mjs";
|
|
2
|
+
export { codeFrameColumns };
|
|
@@ -1,77 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* RegExp to test for newlines in terminal.
|
|
4
|
-
*/
|
|
5
|
-
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
6
|
-
/**
|
|
7
|
-
* Extract what lines should be marked and highlighted.
|
|
8
|
-
*/
|
|
9
|
-
function getMarkerLines(loc, source, opts = {}) {
|
|
10
|
-
const startLoc = {
|
|
11
|
-
column: 0,
|
|
12
|
-
line: -1,
|
|
13
|
-
...loc.start
|
|
14
|
-
};
|
|
15
|
-
const endLoc = {
|
|
16
|
-
...startLoc,
|
|
17
|
-
...loc.end
|
|
18
|
-
};
|
|
19
|
-
const { linesAbove = 2, linesBelow = 3 } = opts || {};
|
|
20
|
-
const startLine = startLoc.line;
|
|
21
|
-
const startColumn = startLoc.column;
|
|
22
|
-
const endLine = endLoc.line;
|
|
23
|
-
const endColumn = endLoc.column;
|
|
24
|
-
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
25
|
-
let end = Math.min(source.length, endLine + linesBelow);
|
|
26
|
-
if (startLine === -1) start = 0;
|
|
27
|
-
if (endLine === -1) end = source.length;
|
|
28
|
-
const lineDiff = endLine - startLine;
|
|
29
|
-
const markerLines = {};
|
|
30
|
-
if (lineDiff) for (let i = 0; i <= lineDiff; i++) {
|
|
31
|
-
const lineNumber = i + startLine;
|
|
32
|
-
if (!startColumn) markerLines[lineNumber] = true;
|
|
33
|
-
else if (i === 0) markerLines[lineNumber] = [startColumn, (source[lineNumber - 1]?.length ?? 0) - startColumn + 1];
|
|
34
|
-
else if (i === lineDiff) markerLines[lineNumber] = [0, endColumn];
|
|
35
|
-
else markerLines[lineNumber] = [0, source[lineNumber - i]?.length ?? 0];
|
|
36
|
-
}
|
|
37
|
-
else if (startColumn === endColumn) markerLines[startLine] = startColumn ? [startColumn, 0] : true;
|
|
38
|
-
else markerLines[startLine] = [startColumn, endColumn - startColumn];
|
|
39
|
-
return {
|
|
40
|
-
start,
|
|
41
|
-
end,
|
|
42
|
-
markerLines
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function codeFrameColumns(rawLines, loc, opts = {}) {
|
|
46
|
-
const { start, end, markerLines } = getMarkerLines(loc, rawLines.split(NEWLINE), opts);
|
|
47
|
-
const numberMaxWidth = String(end).length;
|
|
48
|
-
return (opts.highlight ? opts.highlight(rawLines) : rawLines).split(NEWLINE).slice(start, end).map((line, index) => {
|
|
49
|
-
const number = start + 1 + index;
|
|
50
|
-
const gutter = ` ${` ${number}`.slice(-numberMaxWidth)} | `;
|
|
51
|
-
const hasMarker = Boolean(markerLines[number] ?? false);
|
|
52
|
-
if (hasMarker) {
|
|
53
|
-
let markerLine = "";
|
|
54
|
-
if (Array.isArray(hasMarker)) {
|
|
55
|
-
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
|
56
|
-
const numberOfMarkers = hasMarker[1] || 1;
|
|
57
|
-
markerLine = [
|
|
58
|
-
"\n ",
|
|
59
|
-
gutter.replace(/\d/g, " "),
|
|
60
|
-
markerSpacing,
|
|
61
|
-
"^".repeat(numberOfMarkers)
|
|
62
|
-
].join("");
|
|
63
|
-
}
|
|
64
|
-
return [
|
|
65
|
-
">",
|
|
66
|
-
gutter,
|
|
67
|
-
line,
|
|
68
|
-
markerLine
|
|
69
|
-
].join("");
|
|
70
|
-
}
|
|
71
|
-
return ` ${gutter}${line}`;
|
|
72
|
-
}).join("\n");
|
|
73
|
-
}
|
|
1
|
+
import { t as codeFrameColumns } from "../code-frames-DuBfTMu4.mjs";
|
|
74
2
|
|
|
75
|
-
|
|
76
|
-
export { codeFrameColumns };
|
|
77
|
-
//# sourceMappingURL=code-frames.mjs.map
|
|
3
|
+
export { codeFrameColumns };
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
1
|
+
const require_strip_comments = require('../strip-comments-CmEG_smS.cjs');
|
|
2
|
+
const require_parse = require('../parse-ByDxRup5.cjs');
|
|
3
|
+
const require_code_frames = require('../code-frames-BmUvlJ0w.cjs');
|
|
4
|
+
const require_parse_error = require('../parse-error-N7UE-HMh.cjs');
|
|
5
|
+
const require_stringify = require('../stringify-BehjrfhS.cjs');
|
|
6
|
+
require('../utils-jN2UkvqB.cjs');
|
|
6
7
|
|
|
7
|
-
exports.codeFrameColumns =
|
|
8
|
-
exports.formatParseError =
|
|
9
|
-
exports.invalidKeyChars =
|
|
10
|
-
exports.parse =
|
|
11
|
-
exports.safeParse =
|
|
12
|
-
exports.stringify =
|
|
13
|
-
exports.stripComments =
|
|
8
|
+
exports.codeFrameColumns = require_code_frames.codeFrameColumns;
|
|
9
|
+
exports.formatParseError = require_parse_error.formatParseError;
|
|
10
|
+
exports.invalidKeyChars = require_stringify.invalidKeyChars;
|
|
11
|
+
exports.parse = require_parse.parse;
|
|
12
|
+
exports.safeParse = require_parse.safeParse;
|
|
13
|
+
exports.stringify = require_stringify.stringify;
|
|
14
|
+
exports.stripComments = require_strip_comments.stripComments;
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { codeFrameColumns } from "
|
|
2
|
-
import {
|
|
3
|
-
import { formatParseError } from "
|
|
4
|
-
import {
|
|
5
|
-
import { stripComments } from "
|
|
1
|
+
import { t as codeFrameColumns } from "../code-frames-BUtrssZ5.cjs";
|
|
2
|
+
import { n as parse, r as safeParse, t as Options } from "../parse-BGlhbY16.cjs";
|
|
3
|
+
import { t as formatParseError } from "../parse-error-7K8s4vWf.cjs";
|
|
4
|
+
import { n as stringify, t as invalidKeyChars } from "../stringify-Bc8OkhIr.cjs";
|
|
5
|
+
import { t as stripComments } from "../strip-comments-Cz_Wc25t.cjs";
|
|
6
6
|
export { Options, codeFrameColumns, formatParseError, invalidKeyChars, parse, safeParse, stringify, stripComments };
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { codeFrameColumns } from "
|
|
2
|
-
import {
|
|
3
|
-
import { formatParseError } from "
|
|
4
|
-
import {
|
|
5
|
-
import { stripComments } from "
|
|
1
|
+
import { t as codeFrameColumns } from "../code-frames-CrTAYYSE.mjs";
|
|
2
|
+
import { n as parse, r as safeParse, t as Options } from "../parse-fXy5pbmE.mjs";
|
|
3
|
+
import { t as formatParseError } from "../parse-error-DpEv3vo_.mjs";
|
|
4
|
+
import { n as stringify, t as invalidKeyChars } from "../stringify-CFT1K1LE.mjs";
|
|
5
|
+
import { t as stripComments } from "../strip-comments-BA8MS_Fs.mjs";
|
|
6
|
+
import "../index-CCt0lwyI.mjs";
|
|
6
7
|
export { Options, codeFrameColumns, formatParseError, invalidKeyChars, parse, safeParse, stringify, stripComments };
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { stripComments } from "
|
|
2
|
-
import {
|
|
3
|
-
import { codeFrameColumns } from "
|
|
4
|
-
import { formatParseError } from "
|
|
5
|
-
import {
|
|
1
|
+
import { t as stripComments } from "../strip-comments-Dq00N_Sg.mjs";
|
|
2
|
+
import { n as safeParse, t as parse } from "../parse-Dn43ZK9y.mjs";
|
|
3
|
+
import { t as codeFrameColumns } from "../code-frames-DuBfTMu4.mjs";
|
|
4
|
+
import { t as formatParseError } from "../parse-error-Af4zHUQ_.mjs";
|
|
5
|
+
import { n as stringify, t as invalidKeyChars } from "../stringify-CYHjAvWm.mjs";
|
|
6
|
+
import "../utils-mEkKIcgl.mjs";
|
|
6
7
|
|
|
7
8
|
export { codeFrameColumns, formatParseError, invalidKeyChars, parse, safeParse, stringify, stripComments };
|