@rolldown/browser 1.0.0-beta.51 → 1.0.0-beta.53
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/cli.mjs +8 -10
- package/dist/config.d.mts +1 -3
- package/dist/config.mjs +6 -9
- package/dist/{constructors-DoUEJY6G.js → constructors-YnYYKXAq.js} +5 -8
- package/dist/experimental-index.browser.mjs +23 -11
- package/dist/experimental-index.d.mts +31 -9
- package/dist/experimental-index.mjs +25 -16
- package/dist/filter-index.d.mts +1 -3
- package/dist/index.browser.mjs +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +6 -9
- package/dist/{normalize-string-or-regex-BXFT9GiS.js → normalize-string-or-regex-BVvsez4S.js} +41 -4
- package/dist/parallel-plugin-worker.mjs +3 -6
- package/dist/parallel-plugin.d.mts +2 -3
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -2
- package/dist/plugins-index.browser.mjs +2 -2
- package/dist/plugins-index.d.mts +3 -3
- package/dist/plugins-index.mjs +2 -4
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/{rolldown-build-C0UB1WZy.js → rolldown-build-DdLgyfGg.js} +353 -191
- package/dist/shared/{binding-lSvYApx7.d.mts → binding-CY7Z709f.d.mts} +59 -12
- package/dist/shared/{bindingify-input-options-CSdAtTcQ.mjs → bindingify-input-options-DcGFRvkp.mjs} +7 -5
- package/dist/shared/{constructors-DF6M1PTb.mjs → constructors-Bi2whoYR.mjs} +5 -8
- package/dist/shared/{constructors-DgFF472b.d.mts → constructors-S9gqtBdT.d.mts} +4 -5
- package/dist/shared/{define-config-BKu-xa_0.d.mts → define-config-CPSppdHs.d.mts} +23 -10
- package/dist/shared/{load-config-Beo_LOwd.mjs → load-config-B09j7Dnd.mjs} +1 -1
- package/dist/shared/{normalize-string-or-regex-DvECZN2V.mjs → normalize-string-or-regex-Bsz_9HAl.mjs} +41 -4
- package/dist/shared/{parse-ast-index-C_M-Y4oC.mjs → parse-ast-index-BOAjpcDq.mjs} +19 -5
- package/dist/shared/{rolldown-build-DYR94CyF.mjs → rolldown-build-CyazSAHY.mjs} +334 -188
- package/dist/shared/{rolldown-BhV7L6Kg.mjs → rolldown-vJGs7rCs.mjs} +1 -1
- package/dist/shared/{utils-BJWI2OzT.d.mts → utils-m9n-gTFq.d.mts} +1 -1
- package/dist/shared/{watch-Cjxo-3u4.mjs → watch-Abdexkk9.mjs} +3 -3
- package/package.json +5 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as logInputHookInOutputPlugin, n as error } from "./logs-CPsamAuj.mjs";
|
|
2
2
|
import { i as unimplemented } from "./misc-5GYLGQ20.mjs";
|
|
3
|
-
import { C as
|
|
4
|
-
import { c as normalizeHook, i as transformModuleInfo, s as unwrapBindingResult, t as bindingifyInputOptions } from "./bindingify-input-options-
|
|
3
|
+
import { C as LOG_LEVEL_DEBUG, D as logLevelPriority, E as LOG_LEVEL_WARN, S as normalizeLog, T as LOG_LEVEL_INFO, _ as PlainObjectLike, f as transformRenderedChunk, g as lazyProp, h as transformAssetSource, n as BuiltinPlugin, p as __decorate, u as transformToRollupOutput, v as MinimalPluginContextImpl, w as LOG_LEVEL_ERROR, y as VERSION } from "./normalize-string-or-regex-Bsz_9HAl.mjs";
|
|
4
|
+
import { c as normalizeHook, i as transformModuleInfo, s as unwrapBindingResult, t as bindingifyInputOptions } from "./bindingify-input-options-DcGFRvkp.mjs";
|
|
5
5
|
import { Worker } from "node:worker_threads";
|
|
6
6
|
import { BindingBundler, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
7
7
|
import path from "node:path";
|
|
@@ -248,32 +248,70 @@ function getSortedPlugins(hookName, plugins) {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
//#endregion
|
|
251
|
-
//#region ../../node_modules/.pnpm/valibot@1.
|
|
252
|
-
|
|
251
|
+
//#region ../../node_modules/.pnpm/valibot@1.2.0_typescript@5.9.3/node_modules/valibot/dist/index.mjs
|
|
252
|
+
let store$4;
|
|
253
|
+
/**
|
|
254
|
+
* Returns the global configuration.
|
|
255
|
+
*
|
|
256
|
+
* @param config The config to merge.
|
|
257
|
+
*
|
|
258
|
+
* @returns The configuration.
|
|
259
|
+
*/
|
|
253
260
|
/* @__NO_SIDE_EFFECTS__ */
|
|
254
|
-
function getGlobalConfig(
|
|
261
|
+
function getGlobalConfig(config$1) {
|
|
255
262
|
return {
|
|
256
|
-
lang:
|
|
257
|
-
message:
|
|
258
|
-
abortEarly:
|
|
259
|
-
abortPipeEarly:
|
|
263
|
+
lang: config$1?.lang ?? store$4?.lang,
|
|
264
|
+
message: config$1?.message,
|
|
265
|
+
abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
|
|
266
|
+
abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
|
|
260
267
|
};
|
|
261
268
|
}
|
|
262
|
-
|
|
269
|
+
let store$3;
|
|
270
|
+
/**
|
|
271
|
+
* Returns a global error message.
|
|
272
|
+
*
|
|
273
|
+
* @param lang The language of the message.
|
|
274
|
+
*
|
|
275
|
+
* @returns The error message.
|
|
276
|
+
*/
|
|
263
277
|
/* @__NO_SIDE_EFFECTS__ */
|
|
264
278
|
function getGlobalMessage(lang) {
|
|
265
|
-
return
|
|
279
|
+
return store$3?.get(lang);
|
|
266
280
|
}
|
|
267
|
-
|
|
281
|
+
let store$2;
|
|
282
|
+
/**
|
|
283
|
+
* Returns a schema error message.
|
|
284
|
+
*
|
|
285
|
+
* @param lang The language of the message.
|
|
286
|
+
*
|
|
287
|
+
* @returns The error message.
|
|
288
|
+
*/
|
|
268
289
|
/* @__NO_SIDE_EFFECTS__ */
|
|
269
290
|
function getSchemaMessage(lang) {
|
|
270
|
-
return
|
|
291
|
+
return store$2?.get(lang);
|
|
271
292
|
}
|
|
272
|
-
|
|
293
|
+
let store$1;
|
|
294
|
+
/**
|
|
295
|
+
* Returns a specific error message.
|
|
296
|
+
*
|
|
297
|
+
* @param reference The identifier reference.
|
|
298
|
+
* @param lang The language of the message.
|
|
299
|
+
*
|
|
300
|
+
* @returns The error message.
|
|
301
|
+
*/
|
|
273
302
|
/* @__NO_SIDE_EFFECTS__ */
|
|
274
303
|
function getSpecificMessage(reference, lang) {
|
|
275
|
-
return
|
|
304
|
+
return store$1?.get(reference)?.get(lang);
|
|
276
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* Stringifies an unknown input to a literal or type string.
|
|
308
|
+
*
|
|
309
|
+
* @param input The unknown input.
|
|
310
|
+
*
|
|
311
|
+
* @returns A literal or type string.
|
|
312
|
+
*
|
|
313
|
+
* @internal
|
|
314
|
+
*/
|
|
277
315
|
/* @__NO_SIDE_EFFECTS__ */
|
|
278
316
|
function _stringify(input) {
|
|
279
317
|
const type = typeof input;
|
|
@@ -282,7 +320,18 @@ function _stringify(input) {
|
|
|
282
320
|
if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
283
321
|
return type;
|
|
284
322
|
}
|
|
285
|
-
|
|
323
|
+
/**
|
|
324
|
+
* Adds an issue to the dataset.
|
|
325
|
+
*
|
|
326
|
+
* @param context The issue context.
|
|
327
|
+
* @param label The issue label.
|
|
328
|
+
* @param dataset The input dataset.
|
|
329
|
+
* @param config The configuration.
|
|
330
|
+
* @param other The optional props.
|
|
331
|
+
*
|
|
332
|
+
* @internal
|
|
333
|
+
*/
|
|
334
|
+
function _addIssue(context, label, dataset, config$1, other) {
|
|
286
335
|
const input = other && "input" in other ? other.input : dataset.value;
|
|
287
336
|
const expected = other?.expected ?? context.expects ?? null;
|
|
288
337
|
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
@@ -296,37 +345,68 @@ function _addIssue(context, label, dataset, config2, other) {
|
|
|
296
345
|
requirement: context.requirement,
|
|
297
346
|
path: other?.path,
|
|
298
347
|
issues: other?.issues,
|
|
299
|
-
lang:
|
|
300
|
-
abortEarly:
|
|
301
|
-
abortPipeEarly:
|
|
348
|
+
lang: config$1.lang,
|
|
349
|
+
abortEarly: config$1.abortEarly,
|
|
350
|
+
abortPipeEarly: config$1.abortPipeEarly
|
|
302
351
|
};
|
|
303
352
|
const isSchema = context.kind === "schema";
|
|
304
|
-
const
|
|
305
|
-
if (
|
|
353
|
+
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);
|
|
354
|
+
if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
|
|
306
355
|
if (isSchema) dataset.typed = false;
|
|
307
356
|
if (dataset.issues) dataset.issues.push(issue);
|
|
308
357
|
else dataset.issues = [issue];
|
|
309
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
* Returns the Standard Schema properties.
|
|
361
|
+
*
|
|
362
|
+
* @param context The schema context.
|
|
363
|
+
*
|
|
364
|
+
* @returns The Standard Schema properties.
|
|
365
|
+
*/
|
|
310
366
|
/* @__NO_SIDE_EFFECTS__ */
|
|
311
367
|
function _getStandardProps(context) {
|
|
312
368
|
return {
|
|
313
369
|
version: 1,
|
|
314
370
|
vendor: "valibot",
|
|
315
|
-
validate(
|
|
316
|
-
return context["~run"]({ value:
|
|
371
|
+
validate(value$1) {
|
|
372
|
+
return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
|
|
317
373
|
}
|
|
318
374
|
};
|
|
319
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* Disallows inherited object properties and prevents object prototype
|
|
378
|
+
* pollution by disallowing certain keys.
|
|
379
|
+
*
|
|
380
|
+
* @param object The object to check.
|
|
381
|
+
* @param key The key to check.
|
|
382
|
+
*
|
|
383
|
+
* @returns Whether the key is allowed.
|
|
384
|
+
*
|
|
385
|
+
* @internal
|
|
386
|
+
*/
|
|
320
387
|
/* @__NO_SIDE_EFFECTS__ */
|
|
321
|
-
function _isValidObjectKey(
|
|
322
|
-
return Object.hasOwn(
|
|
388
|
+
function _isValidObjectKey(object$1, key) {
|
|
389
|
+
return Object.hasOwn(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
|
|
323
390
|
}
|
|
391
|
+
/**
|
|
392
|
+
* Joins multiple `expects` values with the given separator.
|
|
393
|
+
*
|
|
394
|
+
* @param values The `expects` values.
|
|
395
|
+
* @param separator The separator.
|
|
396
|
+
*
|
|
397
|
+
* @returns The joined `expects` property.
|
|
398
|
+
*
|
|
399
|
+
* @internal
|
|
400
|
+
*/
|
|
324
401
|
/* @__NO_SIDE_EFFECTS__ */
|
|
325
|
-
function _joinExpects(
|
|
326
|
-
const list = [...new Set(
|
|
402
|
+
function _joinExpects(values$1, separator) {
|
|
403
|
+
const list = [...new Set(values$1)];
|
|
327
404
|
if (list.length > 1) return `(${list.join(` ${separator} `)})`;
|
|
328
405
|
return list[0] ?? "never";
|
|
329
406
|
}
|
|
407
|
+
/**
|
|
408
|
+
* A Valibot error with useful information.
|
|
409
|
+
*/
|
|
330
410
|
var ValiError = class extends Error {
|
|
331
411
|
/**
|
|
332
412
|
* Creates a Valibot error with useful information.
|
|
@@ -347,10 +427,10 @@ function args(schema) {
|
|
|
347
427
|
reference: args,
|
|
348
428
|
async: false,
|
|
349
429
|
schema,
|
|
350
|
-
"~run"(dataset,
|
|
430
|
+
"~run"(dataset, config$1) {
|
|
351
431
|
const func = dataset.value;
|
|
352
432
|
dataset.value = (...args_) => {
|
|
353
|
-
const argsDataset = this.schema["~run"]({ value: args_ },
|
|
433
|
+
const argsDataset = this.schema["~run"]({ value: args_ }, config$1);
|
|
354
434
|
if (argsDataset.issues) throw new ValiError(argsDataset.issues);
|
|
355
435
|
return func(...argsDataset.value);
|
|
356
436
|
};
|
|
@@ -358,6 +438,11 @@ function args(schema) {
|
|
|
358
438
|
}
|
|
359
439
|
};
|
|
360
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* Creates an await transformation action.
|
|
443
|
+
*
|
|
444
|
+
* @returns An await action.
|
|
445
|
+
*/
|
|
361
446
|
/* @__NO_SIDE_EFFECTS__ */
|
|
362
447
|
function awaitAsync() {
|
|
363
448
|
return {
|
|
@@ -371,6 +456,13 @@ function awaitAsync() {
|
|
|
371
456
|
}
|
|
372
457
|
};
|
|
373
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* Creates a description metadata action.
|
|
461
|
+
*
|
|
462
|
+
* @param description_ The description text.
|
|
463
|
+
*
|
|
464
|
+
* @returns A description action.
|
|
465
|
+
*/
|
|
374
466
|
/* @__NO_SIDE_EFFECTS__ */
|
|
375
467
|
function description(description_) {
|
|
376
468
|
return {
|
|
@@ -388,10 +480,10 @@ function returns(schema) {
|
|
|
388
480
|
reference: returns,
|
|
389
481
|
async: false,
|
|
390
482
|
schema,
|
|
391
|
-
"~run"(dataset,
|
|
483
|
+
"~run"(dataset, config$1) {
|
|
392
484
|
const func = dataset.value;
|
|
393
485
|
dataset.value = (...args_) => {
|
|
394
|
-
const returnsDataset = this.schema["~run"]({ value: func(...args_) },
|
|
486
|
+
const returnsDataset = this.schema["~run"]({ value: func(...args_) }, config$1);
|
|
395
487
|
if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
|
|
396
488
|
return returnsDataset.value;
|
|
397
489
|
};
|
|
@@ -407,10 +499,10 @@ function returnsAsync(schema) {
|
|
|
407
499
|
reference: returnsAsync,
|
|
408
500
|
async: false,
|
|
409
501
|
schema,
|
|
410
|
-
"~run"(dataset,
|
|
502
|
+
"~run"(dataset, config$1) {
|
|
411
503
|
const func = dataset.value;
|
|
412
504
|
dataset.value = async (...args_) => {
|
|
413
|
-
const returnsDataset = await this.schema["~run"]({ value: await func(...args_) },
|
|
505
|
+
const returnsDataset = await this.schema["~run"]({ value: await func(...args_) }, config$1);
|
|
414
506
|
if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
|
|
415
507
|
return returnsDataset.value;
|
|
416
508
|
};
|
|
@@ -418,14 +510,41 @@ function returnsAsync(schema) {
|
|
|
418
510
|
}
|
|
419
511
|
};
|
|
420
512
|
}
|
|
513
|
+
/**
|
|
514
|
+
* Returns the fallback value of the schema.
|
|
515
|
+
*
|
|
516
|
+
* @param schema The schema to get it from.
|
|
517
|
+
* @param dataset The output dataset if available.
|
|
518
|
+
* @param config The config if available.
|
|
519
|
+
*
|
|
520
|
+
* @returns The fallback value.
|
|
521
|
+
*/
|
|
421
522
|
/* @__NO_SIDE_EFFECTS__ */
|
|
422
|
-
function getFallback(schema, dataset,
|
|
423
|
-
return typeof schema.fallback === "function" ? schema.fallback(dataset,
|
|
523
|
+
function getFallback(schema, dataset, config$1) {
|
|
524
|
+
return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
|
|
424
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
* Returns the default value of the schema.
|
|
528
|
+
*
|
|
529
|
+
* @param schema The schema to get it from.
|
|
530
|
+
* @param dataset The input dataset if available.
|
|
531
|
+
* @param config The config if available.
|
|
532
|
+
*
|
|
533
|
+
* @returns The default value.
|
|
534
|
+
*/
|
|
425
535
|
/* @__NO_SIDE_EFFECTS__ */
|
|
426
|
-
function getDefault(schema, dataset,
|
|
427
|
-
return typeof schema.default === "function" ? schema.default(dataset,
|
|
536
|
+
function getDefault(schema, dataset, config$1) {
|
|
537
|
+
return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
|
|
428
538
|
}
|
|
539
|
+
/**
|
|
540
|
+
* Creates an any schema.
|
|
541
|
+
*
|
|
542
|
+
* Hint: This schema function exists only for completeness and is not
|
|
543
|
+
* recommended in practice. Instead, `unknown` should be used to accept
|
|
544
|
+
* unknown data.
|
|
545
|
+
*
|
|
546
|
+
* @returns An any schema.
|
|
547
|
+
*/
|
|
429
548
|
/* @__NO_SIDE_EFFECTS__ */
|
|
430
549
|
function any() {
|
|
431
550
|
return {
|
|
@@ -444,7 +563,7 @@ function any() {
|
|
|
444
563
|
};
|
|
445
564
|
}
|
|
446
565
|
/* @__NO_SIDE_EFFECTS__ */
|
|
447
|
-
function array(item,
|
|
566
|
+
function array(item, message$1) {
|
|
448
567
|
return {
|
|
449
568
|
kind: "schema",
|
|
450
569
|
type: "array",
|
|
@@ -452,25 +571,25 @@ function array(item, message2) {
|
|
|
452
571
|
expects: "Array",
|
|
453
572
|
async: false,
|
|
454
573
|
item,
|
|
455
|
-
message:
|
|
574
|
+
message: message$1,
|
|
456
575
|
get "~standard"() {
|
|
457
576
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
458
577
|
},
|
|
459
|
-
"~run"(dataset,
|
|
578
|
+
"~run"(dataset, config$1) {
|
|
460
579
|
const input = dataset.value;
|
|
461
580
|
if (Array.isArray(input)) {
|
|
462
581
|
dataset.typed = true;
|
|
463
582
|
dataset.value = [];
|
|
464
583
|
for (let key = 0; key < input.length; key++) {
|
|
465
|
-
const
|
|
466
|
-
const itemDataset = this.item["~run"]({ value:
|
|
584
|
+
const value$1 = input[key];
|
|
585
|
+
const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
|
|
467
586
|
if (itemDataset.issues) {
|
|
468
587
|
const pathItem = {
|
|
469
588
|
type: "array",
|
|
470
589
|
origin: "value",
|
|
471
590
|
input,
|
|
472
591
|
key,
|
|
473
|
-
value:
|
|
592
|
+
value: value$1
|
|
474
593
|
};
|
|
475
594
|
for (const issue of itemDataset.issues) {
|
|
476
595
|
if (issue.path) issue.path.unshift(pathItem);
|
|
@@ -478,7 +597,7 @@ function array(item, message2) {
|
|
|
478
597
|
dataset.issues?.push(issue);
|
|
479
598
|
}
|
|
480
599
|
if (!dataset.issues) dataset.issues = itemDataset.issues;
|
|
481
|
-
if (
|
|
600
|
+
if (config$1.abortEarly) {
|
|
482
601
|
dataset.typed = false;
|
|
483
602
|
break;
|
|
484
603
|
}
|
|
@@ -486,71 +605,71 @@ function array(item, message2) {
|
|
|
486
605
|
if (!itemDataset.typed) dataset.typed = false;
|
|
487
606
|
dataset.value.push(itemDataset.value);
|
|
488
607
|
}
|
|
489
|
-
} else _addIssue(this, "type", dataset,
|
|
608
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
490
609
|
return dataset;
|
|
491
610
|
}
|
|
492
611
|
};
|
|
493
612
|
}
|
|
494
613
|
/* @__NO_SIDE_EFFECTS__ */
|
|
495
|
-
function boolean(
|
|
614
|
+
function boolean(message$1) {
|
|
496
615
|
return {
|
|
497
616
|
kind: "schema",
|
|
498
617
|
type: "boolean",
|
|
499
618
|
reference: boolean,
|
|
500
619
|
expects: "boolean",
|
|
501
620
|
async: false,
|
|
502
|
-
message:
|
|
621
|
+
message: message$1,
|
|
503
622
|
get "~standard"() {
|
|
504
623
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
505
624
|
},
|
|
506
|
-
"~run"(dataset,
|
|
625
|
+
"~run"(dataset, config$1) {
|
|
507
626
|
if (typeof dataset.value === "boolean") dataset.typed = true;
|
|
508
|
-
else _addIssue(this, "type", dataset,
|
|
627
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
509
628
|
return dataset;
|
|
510
629
|
}
|
|
511
630
|
};
|
|
512
631
|
}
|
|
513
632
|
/* @__NO_SIDE_EFFECTS__ */
|
|
514
|
-
function custom(
|
|
633
|
+
function custom(check$1, message$1) {
|
|
515
634
|
return {
|
|
516
635
|
kind: "schema",
|
|
517
636
|
type: "custom",
|
|
518
637
|
reference: custom,
|
|
519
638
|
expects: "unknown",
|
|
520
639
|
async: false,
|
|
521
|
-
check:
|
|
522
|
-
message:
|
|
640
|
+
check: check$1,
|
|
641
|
+
message: message$1,
|
|
523
642
|
get "~standard"() {
|
|
524
643
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
525
644
|
},
|
|
526
|
-
"~run"(dataset,
|
|
645
|
+
"~run"(dataset, config$1) {
|
|
527
646
|
if (this.check(dataset.value)) dataset.typed = true;
|
|
528
|
-
else _addIssue(this, "type", dataset,
|
|
647
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
529
648
|
return dataset;
|
|
530
649
|
}
|
|
531
650
|
};
|
|
532
651
|
}
|
|
533
652
|
/* @__NO_SIDE_EFFECTS__ */
|
|
534
|
-
function function_(
|
|
653
|
+
function function_(message$1) {
|
|
535
654
|
return {
|
|
536
655
|
kind: "schema",
|
|
537
656
|
type: "function",
|
|
538
657
|
reference: function_,
|
|
539
658
|
expects: "Function",
|
|
540
659
|
async: false,
|
|
541
|
-
message:
|
|
660
|
+
message: message$1,
|
|
542
661
|
get "~standard"() {
|
|
543
662
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
544
663
|
},
|
|
545
|
-
"~run"(dataset,
|
|
664
|
+
"~run"(dataset, config$1) {
|
|
546
665
|
if (typeof dataset.value === "function") dataset.typed = true;
|
|
547
|
-
else _addIssue(this, "type", dataset,
|
|
666
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
548
667
|
return dataset;
|
|
549
668
|
}
|
|
550
669
|
};
|
|
551
670
|
}
|
|
552
671
|
/* @__NO_SIDE_EFFECTS__ */
|
|
553
|
-
function instance(class_,
|
|
672
|
+
function instance(class_, message$1) {
|
|
554
673
|
return {
|
|
555
674
|
kind: "schema",
|
|
556
675
|
type: "instance",
|
|
@@ -558,19 +677,19 @@ function instance(class_, message2) {
|
|
|
558
677
|
expects: class_.name,
|
|
559
678
|
async: false,
|
|
560
679
|
class: class_,
|
|
561
|
-
message:
|
|
680
|
+
message: message$1,
|
|
562
681
|
get "~standard"() {
|
|
563
682
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
564
683
|
},
|
|
565
|
-
"~run"(dataset,
|
|
684
|
+
"~run"(dataset, config$1) {
|
|
566
685
|
if (dataset.value instanceof this.class) dataset.typed = true;
|
|
567
|
-
else _addIssue(this, "type", dataset,
|
|
686
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
568
687
|
return dataset;
|
|
569
688
|
}
|
|
570
689
|
};
|
|
571
690
|
}
|
|
572
691
|
/* @__NO_SIDE_EFFECTS__ */
|
|
573
|
-
function literal(literal_,
|
|
692
|
+
function literal(literal_, message$1) {
|
|
574
693
|
return {
|
|
575
694
|
kind: "schema",
|
|
576
695
|
type: "literal",
|
|
@@ -578,31 +697,31 @@ function literal(literal_, message2) {
|
|
|
578
697
|
expects: /* @__PURE__ */ _stringify(literal_),
|
|
579
698
|
async: false,
|
|
580
699
|
literal: literal_,
|
|
581
|
-
message:
|
|
700
|
+
message: message$1,
|
|
582
701
|
get "~standard"() {
|
|
583
702
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
584
703
|
},
|
|
585
|
-
"~run"(dataset,
|
|
704
|
+
"~run"(dataset, config$1) {
|
|
586
705
|
if (dataset.value === this.literal) dataset.typed = true;
|
|
587
|
-
else _addIssue(this, "type", dataset,
|
|
706
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
588
707
|
return dataset;
|
|
589
708
|
}
|
|
590
709
|
};
|
|
591
710
|
}
|
|
592
711
|
/* @__NO_SIDE_EFFECTS__ */
|
|
593
|
-
function looseObject(
|
|
712
|
+
function looseObject(entries$1, message$1) {
|
|
594
713
|
return {
|
|
595
714
|
kind: "schema",
|
|
596
715
|
type: "loose_object",
|
|
597
716
|
reference: looseObject,
|
|
598
717
|
expects: "Object",
|
|
599
718
|
async: false,
|
|
600
|
-
entries:
|
|
601
|
-
message:
|
|
719
|
+
entries: entries$1,
|
|
720
|
+
message: message$1,
|
|
602
721
|
get "~standard"() {
|
|
603
722
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
604
723
|
},
|
|
605
|
-
"~run"(dataset,
|
|
724
|
+
"~run"(dataset, config$1) {
|
|
606
725
|
const input = dataset.value;
|
|
607
726
|
if (input && typeof input === "object") {
|
|
608
727
|
dataset.typed = true;
|
|
@@ -610,15 +729,15 @@ function looseObject(entries2, message2) {
|
|
|
610
729
|
for (const key in this.entries) {
|
|
611
730
|
const valueSchema = this.entries[key];
|
|
612
731
|
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
613
|
-
const
|
|
614
|
-
const valueDataset = valueSchema["~run"]({ value:
|
|
732
|
+
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
733
|
+
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
615
734
|
if (valueDataset.issues) {
|
|
616
735
|
const pathItem = {
|
|
617
736
|
type: "object",
|
|
618
737
|
origin: "value",
|
|
619
738
|
input,
|
|
620
739
|
key,
|
|
621
|
-
value:
|
|
740
|
+
value: value$1
|
|
622
741
|
};
|
|
623
742
|
for (const issue of valueDataset.issues) {
|
|
624
743
|
if (issue.path) issue.path.unshift(pathItem);
|
|
@@ -626,7 +745,7 @@ function looseObject(entries2, message2) {
|
|
|
626
745
|
dataset.issues?.push(issue);
|
|
627
746
|
}
|
|
628
747
|
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
629
|
-
if (
|
|
748
|
+
if (config$1.abortEarly) {
|
|
630
749
|
dataset.typed = false;
|
|
631
750
|
break;
|
|
632
751
|
}
|
|
@@ -635,7 +754,7 @@ function looseObject(entries2, message2) {
|
|
|
635
754
|
dataset.value[key] = valueDataset.value;
|
|
636
755
|
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
637
756
|
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
638
|
-
_addIssue(this, "key", dataset,
|
|
757
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
639
758
|
input: void 0,
|
|
640
759
|
expected: `"${key}"`,
|
|
641
760
|
path: [{
|
|
@@ -646,31 +765,31 @@ function looseObject(entries2, message2) {
|
|
|
646
765
|
value: input[key]
|
|
647
766
|
}]
|
|
648
767
|
});
|
|
649
|
-
if (
|
|
768
|
+
if (config$1.abortEarly) break;
|
|
650
769
|
}
|
|
651
770
|
}
|
|
652
|
-
if (!dataset.issues || !
|
|
771
|
+
if (!dataset.issues || !config$1.abortEarly) {
|
|
653
772
|
for (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
|
|
654
773
|
}
|
|
655
|
-
} else _addIssue(this, "type", dataset,
|
|
774
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
656
775
|
return dataset;
|
|
657
776
|
}
|
|
658
777
|
};
|
|
659
778
|
}
|
|
660
779
|
/* @__NO_SIDE_EFFECTS__ */
|
|
661
|
-
function never(
|
|
780
|
+
function never(message$1) {
|
|
662
781
|
return {
|
|
663
782
|
kind: "schema",
|
|
664
783
|
type: "never",
|
|
665
784
|
reference: never,
|
|
666
785
|
expects: "never",
|
|
667
786
|
async: false,
|
|
668
|
-
message:
|
|
787
|
+
message: message$1,
|
|
669
788
|
get "~standard"() {
|
|
670
789
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
671
790
|
},
|
|
672
|
-
"~run"(dataset,
|
|
673
|
-
_addIssue(this, "type", dataset,
|
|
791
|
+
"~run"(dataset, config$1) {
|
|
792
|
+
_addIssue(this, "type", dataset, config$1);
|
|
674
793
|
return dataset;
|
|
675
794
|
}
|
|
676
795
|
};
|
|
@@ -688,51 +807,51 @@ function nullish(wrapped, default_) {
|
|
|
688
807
|
get "~standard"() {
|
|
689
808
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
690
809
|
},
|
|
691
|
-
"~run"(dataset,
|
|
810
|
+
"~run"(dataset, config$1) {
|
|
692
811
|
if (dataset.value === null || dataset.value === void 0) {
|
|
693
|
-
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset,
|
|
812
|
+
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
694
813
|
if (dataset.value === null || dataset.value === void 0) {
|
|
695
814
|
dataset.typed = true;
|
|
696
815
|
return dataset;
|
|
697
816
|
}
|
|
698
817
|
}
|
|
699
|
-
return this.wrapped["~run"](dataset,
|
|
818
|
+
return this.wrapped["~run"](dataset, config$1);
|
|
700
819
|
}
|
|
701
820
|
};
|
|
702
821
|
}
|
|
703
822
|
/* @__NO_SIDE_EFFECTS__ */
|
|
704
|
-
function number(
|
|
823
|
+
function number(message$1) {
|
|
705
824
|
return {
|
|
706
825
|
kind: "schema",
|
|
707
826
|
type: "number",
|
|
708
827
|
reference: number,
|
|
709
828
|
expects: "number",
|
|
710
829
|
async: false,
|
|
711
|
-
message:
|
|
830
|
+
message: message$1,
|
|
712
831
|
get "~standard"() {
|
|
713
832
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
714
833
|
},
|
|
715
|
-
"~run"(dataset,
|
|
834
|
+
"~run"(dataset, config$1) {
|
|
716
835
|
if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
|
|
717
|
-
else _addIssue(this, "type", dataset,
|
|
836
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
718
837
|
return dataset;
|
|
719
838
|
}
|
|
720
839
|
};
|
|
721
840
|
}
|
|
722
841
|
/* @__NO_SIDE_EFFECTS__ */
|
|
723
|
-
function object(
|
|
842
|
+
function object(entries$1, message$1) {
|
|
724
843
|
return {
|
|
725
844
|
kind: "schema",
|
|
726
845
|
type: "object",
|
|
727
846
|
reference: object,
|
|
728
847
|
expects: "Object",
|
|
729
848
|
async: false,
|
|
730
|
-
entries:
|
|
731
|
-
message:
|
|
849
|
+
entries: entries$1,
|
|
850
|
+
message: message$1,
|
|
732
851
|
get "~standard"() {
|
|
733
852
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
734
853
|
},
|
|
735
|
-
"~run"(dataset,
|
|
854
|
+
"~run"(dataset, config$1) {
|
|
736
855
|
const input = dataset.value;
|
|
737
856
|
if (input && typeof input === "object") {
|
|
738
857
|
dataset.typed = true;
|
|
@@ -740,15 +859,15 @@ function object(entries2, message2) {
|
|
|
740
859
|
for (const key in this.entries) {
|
|
741
860
|
const valueSchema = this.entries[key];
|
|
742
861
|
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
743
|
-
const
|
|
744
|
-
const valueDataset = valueSchema["~run"]({ value:
|
|
862
|
+
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
863
|
+
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
745
864
|
if (valueDataset.issues) {
|
|
746
865
|
const pathItem = {
|
|
747
866
|
type: "object",
|
|
748
867
|
origin: "value",
|
|
749
868
|
input,
|
|
750
869
|
key,
|
|
751
|
-
value:
|
|
870
|
+
value: value$1
|
|
752
871
|
};
|
|
753
872
|
for (const issue of valueDataset.issues) {
|
|
754
873
|
if (issue.path) issue.path.unshift(pathItem);
|
|
@@ -756,7 +875,7 @@ function object(entries2, message2) {
|
|
|
756
875
|
dataset.issues?.push(issue);
|
|
757
876
|
}
|
|
758
877
|
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
759
|
-
if (
|
|
878
|
+
if (config$1.abortEarly) {
|
|
760
879
|
dataset.typed = false;
|
|
761
880
|
break;
|
|
762
881
|
}
|
|
@@ -765,7 +884,7 @@ function object(entries2, message2) {
|
|
|
765
884
|
dataset.value[key] = valueDataset.value;
|
|
766
885
|
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
767
886
|
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
768
|
-
_addIssue(this, "key", dataset,
|
|
887
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
769
888
|
input: void 0,
|
|
770
889
|
expected: `"${key}"`,
|
|
771
890
|
path: [{
|
|
@@ -776,10 +895,10 @@ function object(entries2, message2) {
|
|
|
776
895
|
value: input[key]
|
|
777
896
|
}]
|
|
778
897
|
});
|
|
779
|
-
if (
|
|
898
|
+
if (config$1.abortEarly) break;
|
|
780
899
|
}
|
|
781
900
|
}
|
|
782
|
-
} else _addIssue(this, "type", dataset,
|
|
901
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
783
902
|
return dataset;
|
|
784
903
|
}
|
|
785
904
|
};
|
|
@@ -797,20 +916,20 @@ function optional(wrapped, default_) {
|
|
|
797
916
|
get "~standard"() {
|
|
798
917
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
799
918
|
},
|
|
800
|
-
"~run"(dataset,
|
|
919
|
+
"~run"(dataset, config$1) {
|
|
801
920
|
if (dataset.value === void 0) {
|
|
802
|
-
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset,
|
|
921
|
+
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
803
922
|
if (dataset.value === void 0) {
|
|
804
923
|
dataset.typed = true;
|
|
805
924
|
return dataset;
|
|
806
925
|
}
|
|
807
926
|
}
|
|
808
|
-
return this.wrapped["~run"](dataset,
|
|
927
|
+
return this.wrapped["~run"](dataset, config$1);
|
|
809
928
|
}
|
|
810
929
|
};
|
|
811
930
|
}
|
|
812
931
|
/* @__NO_SIDE_EFFECTS__ */
|
|
813
|
-
function picklist(options,
|
|
932
|
+
function picklist(options, message$1) {
|
|
814
933
|
return {
|
|
815
934
|
kind: "schema",
|
|
816
935
|
type: "picklist",
|
|
@@ -818,38 +937,38 @@ function picklist(options, message2) {
|
|
|
818
937
|
expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
|
|
819
938
|
async: false,
|
|
820
939
|
options,
|
|
821
|
-
message:
|
|
940
|
+
message: message$1,
|
|
822
941
|
get "~standard"() {
|
|
823
942
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
824
943
|
},
|
|
825
|
-
"~run"(dataset,
|
|
944
|
+
"~run"(dataset, config$1) {
|
|
826
945
|
if (this.options.includes(dataset.value)) dataset.typed = true;
|
|
827
|
-
else _addIssue(this, "type", dataset,
|
|
946
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
828
947
|
return dataset;
|
|
829
948
|
}
|
|
830
949
|
};
|
|
831
950
|
}
|
|
832
951
|
/* @__NO_SIDE_EFFECTS__ */
|
|
833
|
-
function promise(
|
|
952
|
+
function promise(message$1) {
|
|
834
953
|
return {
|
|
835
954
|
kind: "schema",
|
|
836
955
|
type: "promise",
|
|
837
956
|
reference: promise,
|
|
838
957
|
expects: "Promise",
|
|
839
958
|
async: false,
|
|
840
|
-
message:
|
|
959
|
+
message: message$1,
|
|
841
960
|
get "~standard"() {
|
|
842
961
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
843
962
|
},
|
|
844
|
-
"~run"(dataset,
|
|
963
|
+
"~run"(dataset, config$1) {
|
|
845
964
|
if (dataset.value instanceof Promise) dataset.typed = true;
|
|
846
|
-
else _addIssue(this, "type", dataset,
|
|
965
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
847
966
|
return dataset;
|
|
848
967
|
}
|
|
849
968
|
};
|
|
850
969
|
}
|
|
851
970
|
/* @__NO_SIDE_EFFECTS__ */
|
|
852
|
-
function record(key,
|
|
971
|
+
function record(key, value$1, message$1) {
|
|
853
972
|
return {
|
|
854
973
|
kind: "schema",
|
|
855
974
|
type: "record",
|
|
@@ -857,19 +976,19 @@ function record(key, value2, message2) {
|
|
|
857
976
|
expects: "Object",
|
|
858
977
|
async: false,
|
|
859
978
|
key,
|
|
860
|
-
value:
|
|
861
|
-
message:
|
|
979
|
+
value: value$1,
|
|
980
|
+
message: message$1,
|
|
862
981
|
get "~standard"() {
|
|
863
982
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
864
983
|
},
|
|
865
|
-
"~run"(dataset,
|
|
984
|
+
"~run"(dataset, config$1) {
|
|
866
985
|
const input = dataset.value;
|
|
867
986
|
if (input && typeof input === "object") {
|
|
868
987
|
dataset.typed = true;
|
|
869
988
|
dataset.value = {};
|
|
870
989
|
for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
|
|
871
990
|
const entryValue = input[entryKey];
|
|
872
|
-
const keyDataset = this.key["~run"]({ value: entryKey },
|
|
991
|
+
const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
|
|
873
992
|
if (keyDataset.issues) {
|
|
874
993
|
const pathItem = {
|
|
875
994
|
type: "object",
|
|
@@ -883,12 +1002,12 @@ function record(key, value2, message2) {
|
|
|
883
1002
|
dataset.issues?.push(issue);
|
|
884
1003
|
}
|
|
885
1004
|
if (!dataset.issues) dataset.issues = keyDataset.issues;
|
|
886
|
-
if (
|
|
1005
|
+
if (config$1.abortEarly) {
|
|
887
1006
|
dataset.typed = false;
|
|
888
1007
|
break;
|
|
889
1008
|
}
|
|
890
1009
|
}
|
|
891
|
-
const valueDataset = this.value["~run"]({ value: entryValue },
|
|
1010
|
+
const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
|
|
892
1011
|
if (valueDataset.issues) {
|
|
893
1012
|
const pathItem = {
|
|
894
1013
|
type: "object",
|
|
@@ -903,7 +1022,7 @@ function record(key, value2, message2) {
|
|
|
903
1022
|
dataset.issues?.push(issue);
|
|
904
1023
|
}
|
|
905
1024
|
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
906
|
-
if (
|
|
1025
|
+
if (config$1.abortEarly) {
|
|
907
1026
|
dataset.typed = false;
|
|
908
1027
|
break;
|
|
909
1028
|
}
|
|
@@ -911,25 +1030,25 @@ function record(key, value2, message2) {
|
|
|
911
1030
|
if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
|
|
912
1031
|
if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
|
|
913
1032
|
}
|
|
914
|
-
} else _addIssue(this, "type", dataset,
|
|
1033
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
915
1034
|
return dataset;
|
|
916
1035
|
}
|
|
917
1036
|
};
|
|
918
1037
|
}
|
|
919
1038
|
/* @__NO_SIDE_EFFECTS__ */
|
|
920
|
-
function strictObject(
|
|
1039
|
+
function strictObject(entries$1, message$1) {
|
|
921
1040
|
return {
|
|
922
1041
|
kind: "schema",
|
|
923
1042
|
type: "strict_object",
|
|
924
1043
|
reference: strictObject,
|
|
925
1044
|
expects: "Object",
|
|
926
1045
|
async: false,
|
|
927
|
-
entries:
|
|
928
|
-
message:
|
|
1046
|
+
entries: entries$1,
|
|
1047
|
+
message: message$1,
|
|
929
1048
|
get "~standard"() {
|
|
930
1049
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
931
1050
|
},
|
|
932
|
-
"~run"(dataset,
|
|
1051
|
+
"~run"(dataset, config$1) {
|
|
933
1052
|
const input = dataset.value;
|
|
934
1053
|
if (input && typeof input === "object") {
|
|
935
1054
|
dataset.typed = true;
|
|
@@ -937,15 +1056,15 @@ function strictObject(entries2, message2) {
|
|
|
937
1056
|
for (const key in this.entries) {
|
|
938
1057
|
const valueSchema = this.entries[key];
|
|
939
1058
|
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
940
|
-
const
|
|
941
|
-
const valueDataset = valueSchema["~run"]({ value:
|
|
1059
|
+
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
1060
|
+
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
942
1061
|
if (valueDataset.issues) {
|
|
943
1062
|
const pathItem = {
|
|
944
1063
|
type: "object",
|
|
945
1064
|
origin: "value",
|
|
946
1065
|
input,
|
|
947
1066
|
key,
|
|
948
|
-
value:
|
|
1067
|
+
value: value$1
|
|
949
1068
|
};
|
|
950
1069
|
for (const issue of valueDataset.issues) {
|
|
951
1070
|
if (issue.path) issue.path.unshift(pathItem);
|
|
@@ -953,7 +1072,7 @@ function strictObject(entries2, message2) {
|
|
|
953
1072
|
dataset.issues?.push(issue);
|
|
954
1073
|
}
|
|
955
1074
|
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
956
|
-
if (
|
|
1075
|
+
if (config$1.abortEarly) {
|
|
957
1076
|
dataset.typed = false;
|
|
958
1077
|
break;
|
|
959
1078
|
}
|
|
@@ -962,7 +1081,7 @@ function strictObject(entries2, message2) {
|
|
|
962
1081
|
dataset.value[key] = valueDataset.value;
|
|
963
1082
|
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
964
1083
|
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
965
|
-
_addIssue(this, "key", dataset,
|
|
1084
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
966
1085
|
input: void 0,
|
|
967
1086
|
expected: `"${key}"`,
|
|
968
1087
|
path: [{
|
|
@@ -973,12 +1092,12 @@ function strictObject(entries2, message2) {
|
|
|
973
1092
|
value: input[key]
|
|
974
1093
|
}]
|
|
975
1094
|
});
|
|
976
|
-
if (
|
|
1095
|
+
if (config$1.abortEarly) break;
|
|
977
1096
|
}
|
|
978
1097
|
}
|
|
979
|
-
if (!dataset.issues || !
|
|
1098
|
+
if (!dataset.issues || !config$1.abortEarly) {
|
|
980
1099
|
for (const key in input) if (!(key in this.entries)) {
|
|
981
|
-
_addIssue(this, "key", dataset,
|
|
1100
|
+
_addIssue(this, "key", dataset, config$1, {
|
|
982
1101
|
input: key,
|
|
983
1102
|
expected: "never",
|
|
984
1103
|
path: [{
|
|
@@ -992,32 +1111,32 @@ function strictObject(entries2, message2) {
|
|
|
992
1111
|
break;
|
|
993
1112
|
}
|
|
994
1113
|
}
|
|
995
|
-
} else _addIssue(this, "type", dataset,
|
|
1114
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
996
1115
|
return dataset;
|
|
997
1116
|
}
|
|
998
1117
|
};
|
|
999
1118
|
}
|
|
1000
1119
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1001
|
-
function string(
|
|
1120
|
+
function string(message$1) {
|
|
1002
1121
|
return {
|
|
1003
1122
|
kind: "schema",
|
|
1004
1123
|
type: "string",
|
|
1005
1124
|
reference: string,
|
|
1006
1125
|
expects: "string",
|
|
1007
1126
|
async: false,
|
|
1008
|
-
message:
|
|
1127
|
+
message: message$1,
|
|
1009
1128
|
get "~standard"() {
|
|
1010
1129
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1011
1130
|
},
|
|
1012
|
-
"~run"(dataset,
|
|
1131
|
+
"~run"(dataset, config$1) {
|
|
1013
1132
|
if (typeof dataset.value === "string") dataset.typed = true;
|
|
1014
|
-
else _addIssue(this, "type", dataset,
|
|
1133
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
1015
1134
|
return dataset;
|
|
1016
1135
|
}
|
|
1017
1136
|
};
|
|
1018
1137
|
}
|
|
1019
1138
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1020
|
-
function tuple(items,
|
|
1139
|
+
function tuple(items, message$1) {
|
|
1021
1140
|
return {
|
|
1022
1141
|
kind: "schema",
|
|
1023
1142
|
type: "tuple",
|
|
@@ -1025,25 +1144,25 @@ function tuple(items, message2) {
|
|
|
1025
1144
|
expects: "Array",
|
|
1026
1145
|
async: false,
|
|
1027
1146
|
items,
|
|
1028
|
-
message:
|
|
1147
|
+
message: message$1,
|
|
1029
1148
|
get "~standard"() {
|
|
1030
1149
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1031
1150
|
},
|
|
1032
|
-
"~run"(dataset,
|
|
1151
|
+
"~run"(dataset, config$1) {
|
|
1033
1152
|
const input = dataset.value;
|
|
1034
1153
|
if (Array.isArray(input)) {
|
|
1035
1154
|
dataset.typed = true;
|
|
1036
1155
|
dataset.value = [];
|
|
1037
1156
|
for (let key = 0; key < this.items.length; key++) {
|
|
1038
|
-
const
|
|
1039
|
-
const itemDataset = this.items[key]["~run"]({ value:
|
|
1157
|
+
const value$1 = input[key];
|
|
1158
|
+
const itemDataset = this.items[key]["~run"]({ value: value$1 }, config$1);
|
|
1040
1159
|
if (itemDataset.issues) {
|
|
1041
1160
|
const pathItem = {
|
|
1042
1161
|
type: "array",
|
|
1043
1162
|
origin: "value",
|
|
1044
1163
|
input,
|
|
1045
1164
|
key,
|
|
1046
|
-
value:
|
|
1165
|
+
value: value$1
|
|
1047
1166
|
};
|
|
1048
1167
|
for (const issue of itemDataset.issues) {
|
|
1049
1168
|
if (issue.path) issue.path.unshift(pathItem);
|
|
@@ -1051,7 +1170,7 @@ function tuple(items, message2) {
|
|
|
1051
1170
|
dataset.issues?.push(issue);
|
|
1052
1171
|
}
|
|
1053
1172
|
if (!dataset.issues) dataset.issues = itemDataset.issues;
|
|
1054
|
-
if (
|
|
1173
|
+
if (config$1.abortEarly) {
|
|
1055
1174
|
dataset.typed = false;
|
|
1056
1175
|
break;
|
|
1057
1176
|
}
|
|
@@ -1059,30 +1178,39 @@ function tuple(items, message2) {
|
|
|
1059
1178
|
if (!itemDataset.typed) dataset.typed = false;
|
|
1060
1179
|
dataset.value.push(itemDataset.value);
|
|
1061
1180
|
}
|
|
1062
|
-
} else _addIssue(this, "type", dataset,
|
|
1181
|
+
} else _addIssue(this, "type", dataset, config$1);
|
|
1063
1182
|
return dataset;
|
|
1064
1183
|
}
|
|
1065
1184
|
};
|
|
1066
1185
|
}
|
|
1067
1186
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1068
|
-
function undefined_(
|
|
1187
|
+
function undefined_(message$1) {
|
|
1069
1188
|
return {
|
|
1070
1189
|
kind: "schema",
|
|
1071
1190
|
type: "undefined",
|
|
1072
1191
|
reference: undefined_,
|
|
1073
1192
|
expects: "undefined",
|
|
1074
1193
|
async: false,
|
|
1075
|
-
message:
|
|
1194
|
+
message: message$1,
|
|
1076
1195
|
get "~standard"() {
|
|
1077
1196
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1078
1197
|
},
|
|
1079
|
-
"~run"(dataset,
|
|
1198
|
+
"~run"(dataset, config$1) {
|
|
1080
1199
|
if (dataset.value === void 0) dataset.typed = true;
|
|
1081
|
-
else _addIssue(this, "type", dataset,
|
|
1200
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
1082
1201
|
return dataset;
|
|
1083
1202
|
}
|
|
1084
1203
|
};
|
|
1085
1204
|
}
|
|
1205
|
+
/**
|
|
1206
|
+
* Returns the sub issues of the provided datasets for the union issue.
|
|
1207
|
+
*
|
|
1208
|
+
* @param datasets The datasets.
|
|
1209
|
+
*
|
|
1210
|
+
* @returns The sub issues.
|
|
1211
|
+
*
|
|
1212
|
+
* @internal
|
|
1213
|
+
*/
|
|
1086
1214
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1087
1215
|
function _subIssues(datasets) {
|
|
1088
1216
|
let issues;
|
|
@@ -1091,7 +1219,7 @@ function _subIssues(datasets) {
|
|
|
1091
1219
|
return issues;
|
|
1092
1220
|
}
|
|
1093
1221
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1094
|
-
function union(options,
|
|
1222
|
+
function union(options, message$1) {
|
|
1095
1223
|
return {
|
|
1096
1224
|
kind: "schema",
|
|
1097
1225
|
type: "union",
|
|
@@ -1099,16 +1227,16 @@ function union(options, message2) {
|
|
|
1099
1227
|
expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
|
|
1100
1228
|
async: false,
|
|
1101
1229
|
options,
|
|
1102
|
-
message:
|
|
1230
|
+
message: message$1,
|
|
1103
1231
|
get "~standard"() {
|
|
1104
1232
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1105
1233
|
},
|
|
1106
|
-
"~run"(dataset,
|
|
1234
|
+
"~run"(dataset, config$1) {
|
|
1107
1235
|
let validDataset;
|
|
1108
1236
|
let typedDatasets;
|
|
1109
1237
|
let untypedDatasets;
|
|
1110
1238
|
for (const schema of this.options) {
|
|
1111
|
-
const optionDataset = schema["~run"]({ value: dataset.value },
|
|
1239
|
+
const optionDataset = schema["~run"]({ value: dataset.value }, config$1);
|
|
1112
1240
|
if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
|
|
1113
1241
|
else typedDatasets = [optionDataset];
|
|
1114
1242
|
else {
|
|
@@ -1121,16 +1249,16 @@ function union(options, message2) {
|
|
|
1121
1249
|
if (validDataset) return validDataset;
|
|
1122
1250
|
if (typedDatasets) {
|
|
1123
1251
|
if (typedDatasets.length === 1) return typedDatasets[0];
|
|
1124
|
-
_addIssue(this, "type", dataset,
|
|
1252
|
+
_addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
|
|
1125
1253
|
dataset.typed = true;
|
|
1126
1254
|
} else if (untypedDatasets?.length === 1) return untypedDatasets[0];
|
|
1127
|
-
else _addIssue(this, "type", dataset,
|
|
1255
|
+
else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
|
|
1128
1256
|
return dataset;
|
|
1129
1257
|
}
|
|
1130
1258
|
};
|
|
1131
1259
|
}
|
|
1132
1260
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1133
|
-
function unionAsync(options,
|
|
1261
|
+
function unionAsync(options, message$1) {
|
|
1134
1262
|
return {
|
|
1135
1263
|
kind: "schema",
|
|
1136
1264
|
type: "union",
|
|
@@ -1138,16 +1266,16 @@ function unionAsync(options, message2) {
|
|
|
1138
1266
|
expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
|
|
1139
1267
|
async: true,
|
|
1140
1268
|
options,
|
|
1141
|
-
message:
|
|
1269
|
+
message: message$1,
|
|
1142
1270
|
get "~standard"() {
|
|
1143
1271
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1144
1272
|
},
|
|
1145
|
-
async "~run"(dataset,
|
|
1273
|
+
async "~run"(dataset, config$1) {
|
|
1146
1274
|
let validDataset;
|
|
1147
1275
|
let typedDatasets;
|
|
1148
1276
|
let untypedDatasets;
|
|
1149
1277
|
for (const schema of this.options) {
|
|
1150
|
-
const optionDataset = await schema["~run"]({ value: dataset.value },
|
|
1278
|
+
const optionDataset = await schema["~run"]({ value: dataset.value }, config$1);
|
|
1151
1279
|
if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
|
|
1152
1280
|
else typedDatasets = [optionDataset];
|
|
1153
1281
|
else {
|
|
@@ -1160,44 +1288,53 @@ function unionAsync(options, message2) {
|
|
|
1160
1288
|
if (validDataset) return validDataset;
|
|
1161
1289
|
if (typedDatasets) {
|
|
1162
1290
|
if (typedDatasets.length === 1) return typedDatasets[0];
|
|
1163
|
-
_addIssue(this, "type", dataset,
|
|
1291
|
+
_addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
|
|
1164
1292
|
dataset.typed = true;
|
|
1165
1293
|
} else if (untypedDatasets?.length === 1) return untypedDatasets[0];
|
|
1166
|
-
else _addIssue(this, "type", dataset,
|
|
1294
|
+
else _addIssue(this, "type", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
|
|
1167
1295
|
return dataset;
|
|
1168
1296
|
}
|
|
1169
1297
|
};
|
|
1170
1298
|
}
|
|
1171
1299
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1172
|
-
function void_(
|
|
1300
|
+
function void_(message$1) {
|
|
1173
1301
|
return {
|
|
1174
1302
|
kind: "schema",
|
|
1175
1303
|
type: "void",
|
|
1176
1304
|
reference: void_,
|
|
1177
1305
|
expects: "void",
|
|
1178
1306
|
async: false,
|
|
1179
|
-
message:
|
|
1307
|
+
message: message$1,
|
|
1180
1308
|
get "~standard"() {
|
|
1181
1309
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1182
1310
|
},
|
|
1183
|
-
"~run"(dataset,
|
|
1311
|
+
"~run"(dataset, config$1) {
|
|
1184
1312
|
if (dataset.value === void 0) dataset.typed = true;
|
|
1185
|
-
else _addIssue(this, "type", dataset,
|
|
1313
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
1186
1314
|
return dataset;
|
|
1187
1315
|
}
|
|
1188
1316
|
};
|
|
1189
1317
|
}
|
|
1190
1318
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1191
|
-
function keyof(schema,
|
|
1192
|
-
return /* @__PURE__ */ picklist(Object.keys(schema.entries),
|
|
1319
|
+
function keyof(schema, message$1) {
|
|
1320
|
+
return /* @__PURE__ */ picklist(Object.keys(schema.entries), message$1);
|
|
1193
1321
|
}
|
|
1322
|
+
/**
|
|
1323
|
+
* Creates a modified copy of an object schema that does not contain the
|
|
1324
|
+
* selected entries.
|
|
1325
|
+
*
|
|
1326
|
+
* @param schema The schema to omit from.
|
|
1327
|
+
* @param keys The selected entries.
|
|
1328
|
+
*
|
|
1329
|
+
* @returns An object schema.
|
|
1330
|
+
*/
|
|
1194
1331
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1195
1332
|
function omit(schema, keys) {
|
|
1196
|
-
const
|
|
1197
|
-
for (const key of keys) delete
|
|
1333
|
+
const entries$1 = { ...schema.entries };
|
|
1334
|
+
for (const key of keys) delete entries$1[key];
|
|
1198
1335
|
return {
|
|
1199
1336
|
...schema,
|
|
1200
|
-
entries:
|
|
1337
|
+
entries: entries$1,
|
|
1201
1338
|
get "~standard"() {
|
|
1202
1339
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1203
1340
|
}
|
|
@@ -1205,60 +1342,69 @@ function omit(schema, keys) {
|
|
|
1205
1342
|
}
|
|
1206
1343
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1207
1344
|
function partial(schema, keys) {
|
|
1208
|
-
const
|
|
1209
|
-
for (const key in schema.entries)
|
|
1345
|
+
const entries$1 = {};
|
|
1346
|
+
for (const key in schema.entries) entries$1[key] = !keys || keys.includes(key) ? /* @__PURE__ */ optional(schema.entries[key]) : schema.entries[key];
|
|
1210
1347
|
return {
|
|
1211
1348
|
...schema,
|
|
1212
|
-
entries:
|
|
1349
|
+
entries: entries$1,
|
|
1213
1350
|
get "~standard"() {
|
|
1214
1351
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1215
1352
|
}
|
|
1216
1353
|
};
|
|
1217
1354
|
}
|
|
1218
1355
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1219
|
-
function pipe(...
|
|
1356
|
+
function pipe(...pipe$1) {
|
|
1220
1357
|
return {
|
|
1221
|
-
...
|
|
1222
|
-
pipe:
|
|
1358
|
+
...pipe$1[0],
|
|
1359
|
+
pipe: pipe$1,
|
|
1223
1360
|
get "~standard"() {
|
|
1224
1361
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1225
1362
|
},
|
|
1226
|
-
"~run"(dataset,
|
|
1227
|
-
for (const item of
|
|
1363
|
+
"~run"(dataset, config$1) {
|
|
1364
|
+
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
1228
1365
|
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
1229
1366
|
dataset.typed = false;
|
|
1230
1367
|
break;
|
|
1231
1368
|
}
|
|
1232
|
-
if (!dataset.issues || !
|
|
1369
|
+
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
|
|
1233
1370
|
}
|
|
1234
1371
|
return dataset;
|
|
1235
1372
|
}
|
|
1236
1373
|
};
|
|
1237
1374
|
}
|
|
1238
1375
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1239
|
-
function pipeAsync(...
|
|
1376
|
+
function pipeAsync(...pipe$1) {
|
|
1240
1377
|
return {
|
|
1241
|
-
...
|
|
1242
|
-
pipe:
|
|
1378
|
+
...pipe$1[0],
|
|
1379
|
+
pipe: pipe$1,
|
|
1243
1380
|
async: true,
|
|
1244
1381
|
get "~standard"() {
|
|
1245
1382
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
1246
1383
|
},
|
|
1247
|
-
async "~run"(dataset,
|
|
1248
|
-
for (const item of
|
|
1384
|
+
async "~run"(dataset, config$1) {
|
|
1385
|
+
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
1249
1386
|
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
1250
1387
|
dataset.typed = false;
|
|
1251
1388
|
break;
|
|
1252
1389
|
}
|
|
1253
|
-
if (!dataset.issues || !
|
|
1390
|
+
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = await item["~run"](dataset, config$1);
|
|
1254
1391
|
}
|
|
1255
1392
|
return dataset;
|
|
1256
1393
|
}
|
|
1257
1394
|
};
|
|
1258
1395
|
}
|
|
1396
|
+
/**
|
|
1397
|
+
* Parses an unknown input based on a schema.
|
|
1398
|
+
*
|
|
1399
|
+
* @param schema The schema to be used.
|
|
1400
|
+
* @param input The input to be parsed.
|
|
1401
|
+
* @param config The parse configuration.
|
|
1402
|
+
*
|
|
1403
|
+
* @returns The parse result.
|
|
1404
|
+
*/
|
|
1259
1405
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1260
|
-
function safeParse(schema, input,
|
|
1261
|
-
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(
|
|
1406
|
+
function safeParse(schema, input, config$1) {
|
|
1407
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
1262
1408
|
return {
|
|
1263
1409
|
typed: dataset.typed,
|
|
1264
1410
|
success: !dataset.issues,
|
|
@@ -1605,7 +1751,7 @@ const InputOptionsSchema = strictObject({
|
|
|
1605
1751
|
literal("exports-only"),
|
|
1606
1752
|
literal(false)
|
|
1607
1753
|
]))),
|
|
1608
|
-
tsconfig: pipe(optional(string()), description("Path to the tsconfig.json file."))
|
|
1754
|
+
tsconfig: pipe(optional(union([literal(true), string()])), description("Path to the tsconfig.json file."))
|
|
1609
1755
|
});
|
|
1610
1756
|
const InputCliOverrideSchema = strictObject({
|
|
1611
1757
|
input: pipe(optional(array(string())), description("Entry file")),
|