golar 0.1.4 → 0.1.6
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/dist/builtin-rules.d.ts +2 -3
- package/dist/builtin-rules.generated.d.ts +3 -3
- package/dist/codegen-plugin.js +0 -1
- package/dist/config.js +32 -15
- package/dist/internal/linter/rule-creator.d.ts +3 -2
- package/dist/internal/linter/rule-creator.js +10 -10
- package/dist/internal/linter/rules/explicit-anys/config.js +3 -3
- package/dist/node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.d.ts +1430 -0
- package/dist/node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.js +658 -0
- package/dist/packages/golar/package.js +3 -2
- package/dist/workspace.js +2 -2
- package/package.json +10 -9
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.d.ts +0 -22
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/errors.js +0 -29
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/iso.js +0 -37
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.d.ts +0 -16
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/parse.js +0 -19
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.d.ts +0 -208
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/schemas.js +0 -578
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.d.ts +0 -32
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js +0 -470
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.d.ts +0 -64
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/checks.js +0 -225
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.d.ts +0 -47
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js +0 -61
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js +0 -33
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.d.ts +0 -127
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js +0 -62
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema-processors.js +0 -214
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/json-schema.d.ts +0 -69
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js +0 -109
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/regexes.js +0 -58
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.d.ts +0 -31
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/registries.js +0 -49
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.d.ts +0 -805
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/schemas.js +0 -1096
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/standard-schema.d.ts +0 -120
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.d.ts +0 -96
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/to-json-schema.js +0 -289
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.d.ts +0 -41
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js +0 -304
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.d.ts +0 -8
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/versions.js +0 -9
package/dist/node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.js
ADDED
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.mjs
|
|
2
|
+
let store$4;
|
|
3
|
+
/**
|
|
4
|
+
* Returns the global configuration.
|
|
5
|
+
*
|
|
6
|
+
* @param config The config to merge.
|
|
7
|
+
*
|
|
8
|
+
* @returns The configuration.
|
|
9
|
+
*/
|
|
10
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
11
|
+
function getGlobalConfig(config$1) {
|
|
12
|
+
return {
|
|
13
|
+
lang: config$1?.lang ?? store$4?.lang,
|
|
14
|
+
message: config$1?.message,
|
|
15
|
+
abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
|
|
16
|
+
abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
let store$3;
|
|
20
|
+
/**
|
|
21
|
+
* Returns a global error message.
|
|
22
|
+
*
|
|
23
|
+
* @param lang The language of the message.
|
|
24
|
+
*
|
|
25
|
+
* @returns The error message.
|
|
26
|
+
*/
|
|
27
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
28
|
+
function getGlobalMessage(lang) {
|
|
29
|
+
return store$3?.get(lang);
|
|
30
|
+
}
|
|
31
|
+
let store$2;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a schema error message.
|
|
34
|
+
*
|
|
35
|
+
* @param lang The language of the message.
|
|
36
|
+
*
|
|
37
|
+
* @returns The error message.
|
|
38
|
+
*/
|
|
39
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
40
|
+
function getSchemaMessage(lang) {
|
|
41
|
+
return store$2?.get(lang);
|
|
42
|
+
}
|
|
43
|
+
let store$1;
|
|
44
|
+
/**
|
|
45
|
+
* Returns a specific error message.
|
|
46
|
+
*
|
|
47
|
+
* @param reference The identifier reference.
|
|
48
|
+
* @param lang The language of the message.
|
|
49
|
+
*
|
|
50
|
+
* @returns The error message.
|
|
51
|
+
*/
|
|
52
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
53
|
+
function getSpecificMessage(reference, lang) {
|
|
54
|
+
return store$1?.get(reference)?.get(lang);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Stringifies an unknown input to a literal or type string.
|
|
58
|
+
*
|
|
59
|
+
* @param input The unknown input.
|
|
60
|
+
*
|
|
61
|
+
* @returns A literal or type string.
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
66
|
+
function _stringify(input) {
|
|
67
|
+
const type = typeof input;
|
|
68
|
+
if (type === "string") return `"${input}"`;
|
|
69
|
+
if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
|
|
70
|
+
if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
71
|
+
return type;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Adds an issue to the dataset.
|
|
75
|
+
*
|
|
76
|
+
* @param context The issue context.
|
|
77
|
+
* @param label The issue label.
|
|
78
|
+
* @param dataset The input dataset.
|
|
79
|
+
* @param config The configuration.
|
|
80
|
+
* @param other The optional props.
|
|
81
|
+
*
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
function _addIssue(context, label, dataset, config$1, other) {
|
|
85
|
+
const input = other && "input" in other ? other.input : dataset.value;
|
|
86
|
+
const expected = other?.expected ?? context.expects ?? null;
|
|
87
|
+
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
88
|
+
const issue = {
|
|
89
|
+
kind: context.kind,
|
|
90
|
+
type: context.type,
|
|
91
|
+
input,
|
|
92
|
+
expected,
|
|
93
|
+
received,
|
|
94
|
+
message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
|
|
95
|
+
requirement: context.requirement,
|
|
96
|
+
path: other?.path,
|
|
97
|
+
issues: other?.issues,
|
|
98
|
+
lang: config$1.lang,
|
|
99
|
+
abortEarly: config$1.abortEarly,
|
|
100
|
+
abortPipeEarly: config$1.abortPipeEarly
|
|
101
|
+
};
|
|
102
|
+
const isSchema = context.kind === "schema";
|
|
103
|
+
const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
|
|
104
|
+
if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
|
|
105
|
+
if (isSchema) dataset.typed = false;
|
|
106
|
+
if (dataset.issues) dataset.issues.push(issue);
|
|
107
|
+
else dataset.issues = [issue];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Returns the Standard Schema properties.
|
|
111
|
+
*
|
|
112
|
+
* @param context The schema context.
|
|
113
|
+
*
|
|
114
|
+
* @returns The Standard Schema properties.
|
|
115
|
+
*/
|
|
116
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
117
|
+
function _getStandardProps(context) {
|
|
118
|
+
return {
|
|
119
|
+
version: 1,
|
|
120
|
+
vendor: "valibot",
|
|
121
|
+
validate(value$1) {
|
|
122
|
+
return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Joins multiple `expects` values with the given separator.
|
|
128
|
+
*
|
|
129
|
+
* @param values The `expects` values.
|
|
130
|
+
* @param separator The separator.
|
|
131
|
+
*
|
|
132
|
+
* @returns The joined `expects` property.
|
|
133
|
+
*
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
137
|
+
function _joinExpects(values$1, separator) {
|
|
138
|
+
const list = [...new Set(values$1)];
|
|
139
|
+
if (list.length > 1) return `(${list.join(` ${separator} `)})`;
|
|
140
|
+
return list[0] ?? "never";
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* A Valibot error with useful information.
|
|
144
|
+
*/
|
|
145
|
+
var ValiError = class extends Error {
|
|
146
|
+
/**
|
|
147
|
+
* Creates a Valibot error with useful information.
|
|
148
|
+
*
|
|
149
|
+
* @param issues The error issues.
|
|
150
|
+
*/
|
|
151
|
+
constructor(issues) {
|
|
152
|
+
super(issues[0].message);
|
|
153
|
+
this.name = "ValiError";
|
|
154
|
+
this.issues = issues;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Creates a description metadata action.
|
|
159
|
+
*
|
|
160
|
+
* @param description_ The description text.
|
|
161
|
+
*
|
|
162
|
+
* @returns A description action.
|
|
163
|
+
*/
|
|
164
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
165
|
+
function description(description_) {
|
|
166
|
+
return {
|
|
167
|
+
kind: "metadata",
|
|
168
|
+
type: "description",
|
|
169
|
+
reference: description,
|
|
170
|
+
description: description_
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Creates a custom transformation action.
|
|
175
|
+
*
|
|
176
|
+
* @param operation The transformation operation.
|
|
177
|
+
*
|
|
178
|
+
* @returns A transform action.
|
|
179
|
+
*/
|
|
180
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
181
|
+
function transform(operation) {
|
|
182
|
+
return {
|
|
183
|
+
kind: "transformation",
|
|
184
|
+
type: "transform",
|
|
185
|
+
reference: transform,
|
|
186
|
+
async: false,
|
|
187
|
+
operation,
|
|
188
|
+
"~run"(dataset) {
|
|
189
|
+
dataset.value = this.operation(dataset.value);
|
|
190
|
+
return dataset;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Returns the fallback value of the schema.
|
|
196
|
+
*
|
|
197
|
+
* @param schema The schema to get it from.
|
|
198
|
+
* @param dataset The output dataset if available.
|
|
199
|
+
* @param config The config if available.
|
|
200
|
+
*
|
|
201
|
+
* @returns The fallback value.
|
|
202
|
+
*/
|
|
203
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
204
|
+
function getFallback(schema, dataset, config$1) {
|
|
205
|
+
return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Returns the default value of the schema.
|
|
209
|
+
*
|
|
210
|
+
* @param schema The schema to get it from.
|
|
211
|
+
* @param dataset The input dataset if available.
|
|
212
|
+
* @param config The config if available.
|
|
213
|
+
*
|
|
214
|
+
* @returns The default value.
|
|
215
|
+
*/
|
|
216
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
217
|
+
function getDefault(schema, dataset, config$1) {
|
|
218
|
+
return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
|
|
219
|
+
}
|
|
220
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
221
|
+
function array(item, message$1) {
|
|
222
|
+
return {
|
|
223
|
+
kind: "schema",
|
|
224
|
+
type: "array",
|
|
225
|
+
reference: array,
|
|
226
|
+
expects: "Array",
|
|
227
|
+
async: false,
|
|
228
|
+
item,
|
|
229
|
+
message: message$1,
|
|
230
|
+
get "~standard"() {
|
|
231
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
232
|
+
},
|
|
233
|
+
"~run"(dataset, config$1) {
|
|
234
|
+
const input = dataset.value;
|
|
235
|
+
if (Array.isArray(input)) {
|
|
236
|
+
dataset.typed = true;
|
|
237
|
+
dataset.value = [];
|
|
238
|
+
for (let key = 0; key < input.length; key++) {
|
|
239
|
+
const value$1 = input[key];
|
|
240
|
+
const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
|
|
241
|
+
if (itemDataset.issues) {
|
|
242
|
+
const pathItem = {
|
|
243
|
+
type: "array",
|
|
244
|
+
origin: "value",
|
|
245
|
+
input,
|
|
246
|
+
key,
|
|
247
|
+
value: value$1
|
|
248
|
+
};
|
|
249
|
+
for (const issue of itemDataset.issues) {
|
|
250
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
251
|
+
else issue.path = [pathItem];
|
|
252
|
+
dataset.issues?.push(issue);
|
|
253
|
+
}
|
|
254
|
+
if (!dataset.issues) dataset.issues = itemDataset.issues;
|
|
255
|
+
if (config$1.abortEarly) {
|
|
256
|
+
dataset.typed = false;
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (!itemDataset.typed) dataset.typed = false;
|
|
261
|
+
dataset.value.push(itemDataset.value);
|
|
262
|
+
}
|
|
263
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
264
|
+
return dataset;
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
269
|
+
function boolean(message$1) {
|
|
270
|
+
return {
|
|
271
|
+
kind: "schema",
|
|
272
|
+
type: "boolean",
|
|
273
|
+
reference: boolean,
|
|
274
|
+
expects: "boolean",
|
|
275
|
+
async: false,
|
|
276
|
+
message: message$1,
|
|
277
|
+
get "~standard"() {
|
|
278
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
279
|
+
},
|
|
280
|
+
"~run"(dataset, config$1) {
|
|
281
|
+
if (typeof dataset.value === "boolean") dataset.typed = true;
|
|
282
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
283
|
+
return dataset;
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
288
|
+
function literal(literal_, message$1) {
|
|
289
|
+
return {
|
|
290
|
+
kind: "schema",
|
|
291
|
+
type: "literal",
|
|
292
|
+
reference: literal,
|
|
293
|
+
expects: /* @__PURE__ */ _stringify(literal_),
|
|
294
|
+
async: false,
|
|
295
|
+
literal: literal_,
|
|
296
|
+
message: message$1,
|
|
297
|
+
get "~standard"() {
|
|
298
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
299
|
+
},
|
|
300
|
+
"~run"(dataset, config$1) {
|
|
301
|
+
if (dataset.value === this.literal) dataset.typed = true;
|
|
302
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
303
|
+
return dataset;
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
308
|
+
function object(entries$1, message$1) {
|
|
309
|
+
return {
|
|
310
|
+
kind: "schema",
|
|
311
|
+
type: "object",
|
|
312
|
+
reference: object,
|
|
313
|
+
expects: "Object",
|
|
314
|
+
async: false,
|
|
315
|
+
entries: entries$1,
|
|
316
|
+
message: message$1,
|
|
317
|
+
get "~standard"() {
|
|
318
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
319
|
+
},
|
|
320
|
+
"~run"(dataset, config$1) {
|
|
321
|
+
const input = dataset.value;
|
|
322
|
+
if (input && typeof input === "object") {
|
|
323
|
+
dataset.typed = true;
|
|
324
|
+
dataset.value = {};
|
|
325
|
+
for (const key in this.entries) {
|
|
326
|
+
const valueSchema = this.entries[key];
|
|
327
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
328
|
+
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
329
|
+
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
330
|
+
if (valueDataset.issues) {
|
|
331
|
+
const pathItem = {
|
|
332
|
+
type: "object",
|
|
333
|
+
origin: "value",
|
|
334
|
+
input,
|
|
335
|
+
key,
|
|
336
|
+
value: value$1
|
|
337
|
+
};
|
|
338
|
+
for (const issue of valueDataset.issues) {
|
|
339
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
340
|
+
else issue.path = [pathItem];
|
|
341
|
+
dataset.issues?.push(issue);
|
|
342
|
+
}
|
|
343
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
344
|
+
if (config$1.abortEarly) {
|
|
345
|
+
dataset.typed = false;
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (!valueDataset.typed) dataset.typed = false;
|
|
350
|
+
dataset.value[key] = valueDataset.value;
|
|
351
|
+
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
352
|
+
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
353
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
354
|
+
input: void 0,
|
|
355
|
+
expected: `"${key}"`,
|
|
356
|
+
path: [{
|
|
357
|
+
type: "object",
|
|
358
|
+
origin: "key",
|
|
359
|
+
input,
|
|
360
|
+
key,
|
|
361
|
+
value: input[key]
|
|
362
|
+
}]
|
|
363
|
+
});
|
|
364
|
+
if (config$1.abortEarly) break;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
368
|
+
return dataset;
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
373
|
+
function optional(wrapped, default_) {
|
|
374
|
+
return {
|
|
375
|
+
kind: "schema",
|
|
376
|
+
type: "optional",
|
|
377
|
+
reference: optional,
|
|
378
|
+
expects: `(${wrapped.expects} | undefined)`,
|
|
379
|
+
async: false,
|
|
380
|
+
wrapped,
|
|
381
|
+
default: default_,
|
|
382
|
+
get "~standard"() {
|
|
383
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
384
|
+
},
|
|
385
|
+
"~run"(dataset, config$1) {
|
|
386
|
+
if (dataset.value === void 0) {
|
|
387
|
+
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
388
|
+
if (dataset.value === void 0) {
|
|
389
|
+
dataset.typed = true;
|
|
390
|
+
return dataset;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return this.wrapped["~run"](dataset, config$1);
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
398
|
+
function strictObject(entries$1, message$1) {
|
|
399
|
+
return {
|
|
400
|
+
kind: "schema",
|
|
401
|
+
type: "strict_object",
|
|
402
|
+
reference: strictObject,
|
|
403
|
+
expects: "Object",
|
|
404
|
+
async: false,
|
|
405
|
+
entries: entries$1,
|
|
406
|
+
message: message$1,
|
|
407
|
+
get "~standard"() {
|
|
408
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
409
|
+
},
|
|
410
|
+
"~run"(dataset, config$1) {
|
|
411
|
+
const input = dataset.value;
|
|
412
|
+
if (input && typeof input === "object") {
|
|
413
|
+
dataset.typed = true;
|
|
414
|
+
dataset.value = {};
|
|
415
|
+
for (const key in this.entries) {
|
|
416
|
+
const valueSchema = this.entries[key];
|
|
417
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
418
|
+
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
419
|
+
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
420
|
+
if (valueDataset.issues) {
|
|
421
|
+
const pathItem = {
|
|
422
|
+
type: "object",
|
|
423
|
+
origin: "value",
|
|
424
|
+
input,
|
|
425
|
+
key,
|
|
426
|
+
value: value$1
|
|
427
|
+
};
|
|
428
|
+
for (const issue of valueDataset.issues) {
|
|
429
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
430
|
+
else issue.path = [pathItem];
|
|
431
|
+
dataset.issues?.push(issue);
|
|
432
|
+
}
|
|
433
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
434
|
+
if (config$1.abortEarly) {
|
|
435
|
+
dataset.typed = false;
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
if (!valueDataset.typed) dataset.typed = false;
|
|
440
|
+
dataset.value[key] = valueDataset.value;
|
|
441
|
+
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
442
|
+
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
443
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
444
|
+
input: void 0,
|
|
445
|
+
expected: `"${key}"`,
|
|
446
|
+
path: [{
|
|
447
|
+
type: "object",
|
|
448
|
+
origin: "key",
|
|
449
|
+
input,
|
|
450
|
+
key,
|
|
451
|
+
value: input[key]
|
|
452
|
+
}]
|
|
453
|
+
});
|
|
454
|
+
if (config$1.abortEarly) break;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
if (!dataset.issues || !config$1.abortEarly) {
|
|
458
|
+
for (const key in input) if (!(key in this.entries)) {
|
|
459
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
460
|
+
input: key,
|
|
461
|
+
expected: "never",
|
|
462
|
+
path: [{
|
|
463
|
+
type: "object",
|
|
464
|
+
origin: "key",
|
|
465
|
+
input,
|
|
466
|
+
key,
|
|
467
|
+
value: input[key]
|
|
468
|
+
}]
|
|
469
|
+
});
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
474
|
+
return dataset;
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
479
|
+
function string(message$1) {
|
|
480
|
+
return {
|
|
481
|
+
kind: "schema",
|
|
482
|
+
type: "string",
|
|
483
|
+
reference: string,
|
|
484
|
+
expects: "string",
|
|
485
|
+
async: false,
|
|
486
|
+
message: message$1,
|
|
487
|
+
get "~standard"() {
|
|
488
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
489
|
+
},
|
|
490
|
+
"~run"(dataset, config$1) {
|
|
491
|
+
if (typeof dataset.value === "string") dataset.typed = true;
|
|
492
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
493
|
+
return dataset;
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Returns the sub issues of the provided datasets for the union issue.
|
|
499
|
+
*
|
|
500
|
+
* @param datasets The datasets.
|
|
501
|
+
*
|
|
502
|
+
* @returns The sub issues.
|
|
503
|
+
*
|
|
504
|
+
* @internal
|
|
505
|
+
*/
|
|
506
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
507
|
+
function _subIssues(datasets) {
|
|
508
|
+
let issues;
|
|
509
|
+
if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
|
|
510
|
+
else issues = dataset.issues;
|
|
511
|
+
return issues;
|
|
512
|
+
}
|
|
513
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
514
|
+
function union(options, message$1) {
|
|
515
|
+
return {
|
|
516
|
+
kind: "schema",
|
|
517
|
+
type: "union",
|
|
518
|
+
reference: union,
|
|
519
|
+
expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
|
|
520
|
+
async: false,
|
|
521
|
+
options,
|
|
522
|
+
message: message$1,
|
|
523
|
+
get "~standard"() {
|
|
524
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
525
|
+
},
|
|
526
|
+
"~run"(dataset, config$1) {
|
|
527
|
+
let validDataset;
|
|
528
|
+
let typedDatasets;
|
|
529
|
+
let untypedDatasets;
|
|
530
|
+
for (const schema of this.options) {
|
|
531
|
+
const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
|
|
532
|
+
if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
|
|
533
|
+
else typedDatasets = [optionDataset];
|
|
534
|
+
else {
|
|
535
|
+
validDataset = optionDataset;
|
|
536
|
+
break;
|
|
537
|
+
}
|
|
538
|
+
else if (untypedDatasets) untypedDatasets.push(optionDataset);
|
|
539
|
+
else untypedDatasets = [optionDataset];
|
|
540
|
+
}
|
|
541
|
+
if (validDataset) return validDataset;
|
|
542
|
+
if (typedDatasets) {
|
|
543
|
+
if (typedDatasets.length === 1) return typedDatasets[0];
|
|
544
|
+
_addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
|
|
545
|
+
dataset.typed = true;
|
|
546
|
+
} else if (untypedDatasets?.length === 1) return untypedDatasets[0];
|
|
547
|
+
else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
|
|
548
|
+
return dataset;
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
553
|
+
function variant(key, options, message$1) {
|
|
554
|
+
return {
|
|
555
|
+
kind: "schema",
|
|
556
|
+
type: "variant",
|
|
557
|
+
reference: variant,
|
|
558
|
+
expects: "Object",
|
|
559
|
+
async: false,
|
|
560
|
+
key,
|
|
561
|
+
options,
|
|
562
|
+
message: message$1,
|
|
563
|
+
get "~standard"() {
|
|
564
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
565
|
+
},
|
|
566
|
+
"~run"(dataset, config$1) {
|
|
567
|
+
const input = dataset.value;
|
|
568
|
+
if (input && typeof input === "object") {
|
|
569
|
+
let outputDataset;
|
|
570
|
+
let maxDiscriminatorPriority = 0;
|
|
571
|
+
let invalidDiscriminatorKey = this.key;
|
|
572
|
+
let expectedDiscriminators = [];
|
|
573
|
+
const parseOptions = (variant$1, allKeys) => {
|
|
574
|
+
for (const schema of variant$1.options) {
|
|
575
|
+
if (schema.type === "variant") parseOptions(schema, new Set(allKeys).add(schema.key));
|
|
576
|
+
else {
|
|
577
|
+
let keysAreValid = true;
|
|
578
|
+
let currentPriority = 0;
|
|
579
|
+
for (const currentKey of allKeys) {
|
|
580
|
+
const discriminatorSchema = schema.entries[currentKey];
|
|
581
|
+
if (currentKey in input ? discriminatorSchema["~run"]({
|
|
582
|
+
typed: false,
|
|
583
|
+
value: input[currentKey]
|
|
584
|
+
}, { abortEarly: true }).issues : discriminatorSchema.type !== "exact_optional" && discriminatorSchema.type !== "optional" && discriminatorSchema.type !== "nullish") {
|
|
585
|
+
keysAreValid = false;
|
|
586
|
+
if (invalidDiscriminatorKey !== currentKey && (maxDiscriminatorPriority < currentPriority || maxDiscriminatorPriority === currentPriority && currentKey in input && !(invalidDiscriminatorKey in input))) {
|
|
587
|
+
maxDiscriminatorPriority = currentPriority;
|
|
588
|
+
invalidDiscriminatorKey = currentKey;
|
|
589
|
+
expectedDiscriminators = [];
|
|
590
|
+
}
|
|
591
|
+
if (invalidDiscriminatorKey === currentKey) expectedDiscriminators.push(schema.entries[currentKey].expects);
|
|
592
|
+
break;
|
|
593
|
+
}
|
|
594
|
+
currentPriority++;
|
|
595
|
+
}
|
|
596
|
+
if (keysAreValid) {
|
|
597
|
+
const optionDataset = schema["~run"]({ value: input }, config$1);
|
|
598
|
+
if (!outputDataset || !outputDataset.typed && optionDataset.typed) outputDataset = optionDataset;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
if (outputDataset && !outputDataset.issues) break;
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
parseOptions(this, new Set([this.key]));
|
|
605
|
+
if (outputDataset) return outputDataset;
|
|
606
|
+
_addIssue(this, "type", dataset, config$1, {
|
|
607
|
+
input: input[invalidDiscriminatorKey],
|
|
608
|
+
expected: /* @__PURE__ */ _joinExpects(expectedDiscriminators, "|"),
|
|
609
|
+
path: [{
|
|
610
|
+
type: "object",
|
|
611
|
+
origin: "value",
|
|
612
|
+
input,
|
|
613
|
+
key: invalidDiscriminatorKey,
|
|
614
|
+
value: input[invalidDiscriminatorKey]
|
|
615
|
+
}]
|
|
616
|
+
});
|
|
617
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
618
|
+
return dataset;
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Parses an unknown input based on a schema.
|
|
624
|
+
*
|
|
625
|
+
* @param schema The schema to be used.
|
|
626
|
+
* @param input The input to be parsed.
|
|
627
|
+
* @param config The parse configuration.
|
|
628
|
+
*
|
|
629
|
+
* @returns The parsed input.
|
|
630
|
+
*/
|
|
631
|
+
function parse(schema, input, config$1) {
|
|
632
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
633
|
+
if (dataset.issues) throw new ValiError(dataset.issues);
|
|
634
|
+
return dataset.value;
|
|
635
|
+
}
|
|
636
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
637
|
+
function pipe(...pipe$1) {
|
|
638
|
+
return {
|
|
639
|
+
...pipe$1[0],
|
|
640
|
+
pipe: pipe$1,
|
|
641
|
+
get "~standard"() {
|
|
642
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
643
|
+
},
|
|
644
|
+
"~run"(dataset, config$1) {
|
|
645
|
+
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
646
|
+
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
647
|
+
dataset.typed = false;
|
|
648
|
+
break;
|
|
649
|
+
}
|
|
650
|
+
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
|
|
651
|
+
}
|
|
652
|
+
return dataset;
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
//#endregion
|
|
658
|
+
export { array, boolean, description, literal, object, optional, parse, pipe, strictObject, string, transform, union, variant };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "golar",
|
|
4
|
-
version: "0.1.
|
|
4
|
+
version: "0.1.6",
|
|
5
5
|
type: "module",
|
|
6
6
|
engines: { "node": ">=22.12.0" },
|
|
7
7
|
bin: "./src/bin.ts",
|
|
@@ -30,7 +30,8 @@ var package_default = {
|
|
|
30
30
|
},
|
|
31
31
|
dependencies: {
|
|
32
32
|
"@golar/util": "workspace:*",
|
|
33
|
-
"detect-libc": "^2.1.2"
|
|
33
|
+
"detect-libc": "^2.1.2",
|
|
34
|
+
"tinyglobby": "^0.2.15"
|
|
34
35
|
},
|
|
35
36
|
optionalDependencies: {
|
|
36
37
|
"@golar/darwin-arm64": "workspace:*",
|
package/dist/workspace.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { addon, golarAddonPath, syncBuf, syncView } from "./addon.js";
|
|
2
2
|
import { RemoteSourceFile } from "./thirdparty/typescript-go/_packages/api/dist/node/node.js";
|
|
3
3
|
import { Registry } from "./type-decoder.js";
|
|
4
|
-
import { object } from "./node_modules/.pnpm/
|
|
4
|
+
import { object, parse } from "./node_modules/.pnpm/valibot@1.3.1_typescript@5.9.3/node_modules/valibot/dist/index.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import os from "node:os";
|
|
@@ -178,7 +178,7 @@ var Workspace = class Workspace {
|
|
|
178
178
|
denseRuleIndexes.set(rule, idx = ruleIdxCounter++);
|
|
179
179
|
denseRules.push({
|
|
180
180
|
name: rule.rule.name,
|
|
181
|
-
options: object(rule.rule.options)
|
|
181
|
+
options: parse(object(rule.rule.options), rule.options ?? {})
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
184
|
indexes.push(idx);
|