rolldown 1.0.0-beta.8-commit.852c603 → 1.0.0-beta.8-commit.a720367
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.cjs +6 -6
- package/dist/cli.mjs +2 -2
- package/dist/experimental-index.cjs +2 -2
- package/dist/experimental-index.d.cts +2 -2
- package/dist/experimental-index.d.mts +2 -2
- package/dist/experimental-index.mjs +2 -2
- package/dist/filter-index.cjs +12 -0
- package/dist/{filter-expression-index.d.cts → filter-index.d.cts} +3 -3
- package/dist/{filter-expression-index.d.mts → filter-index.d.mts} +3 -3
- package/dist/filter-index.mjs +4 -0
- package/dist/index.cjs +3 -4
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/parallel-plugin-worker.cjs +2 -2
- package/dist/parallel-plugin-worker.mjs +2 -2
- package/dist/parallel-plugin.d.cts +2 -2
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.cts +1 -1
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/shared/{binding.d-BaNmLM9c.d.mts → binding.d-BqY7GV3f.d.cts} +3 -0
- package/dist/shared/{binding.d-y7dWnUxd.d.cts → binding.d-DE0X2d5U.d.mts} +3 -0
- package/dist/shared/filter-index-DblXSw9s.cjs +255 -0
- package/dist/shared/filter-index-hnEzlqRW.mjs +174 -0
- package/dist/shared/{input-options.d-CN-JV5dt.d.mts → input-options.d-B9XQg_yc.d.mts} +23 -25
- package/dist/shared/{input-options.d-BHwth6VM.d.cts → input-options.d-BP-ZTUFR.d.cts} +23 -25
- package/dist/shared/{src-CaxK4-gB.mjs → src-B7fgzJrI.mjs} +1753 -510
- package/dist/shared/{src-B4f_CmD8.cjs → src-N-rxJtKK.cjs} +1754 -517
- package/package.json +21 -21
- package/dist/filter-expression-index.cjs +0 -11
- package/dist/filter-expression-index.mjs +0 -4
- package/dist/shared/filter-expression-index-BKmgnKlV.mjs +0 -69
- package/dist/shared/filter-expression-index-CRtoeipP.cjs +0 -119
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import { __esm } from "./chunk-DUYDk_2O.mjs";
|
|
2
2
|
import { augmentCodeLocation, error, import_binding, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-D0SmlXT6.mjs";
|
|
3
|
-
import { and, code, exclude, id, include,
|
|
3
|
+
import { and, arraify, code, exclude, id, include, init_filter_index, init_misc, isNullish, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./filter-index-hnEzlqRW.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import { toJsonSchema } from "@valibot/to-json-schema";
|
|
6
5
|
import colors from "ansis";
|
|
7
|
-
import * as v from "valibot";
|
|
8
6
|
import { availableParallelism } from "node:os";
|
|
9
7
|
import { Worker } from "node:worker_threads";
|
|
10
8
|
|
|
11
9
|
//#region package.json
|
|
12
|
-
var version = "1.0.0-beta.8-commit.
|
|
13
|
-
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
10
|
+
var version = "1.0.0-beta.8-commit.a720367";
|
|
11
|
+
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
14
12
|
|
|
15
13
|
//#endregion
|
|
16
14
|
//#region src/builtin-plugin/utils.ts
|
|
17
15
|
function makeBuiltinPluginCallable(plugin) {
|
|
18
16
|
let callablePlugin = new import_binding.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
19
17
|
const wrappedPlugin = plugin;
|
|
20
|
-
for (const key in callablePlugin) wrappedPlugin[key] = function(...args) {
|
|
21
|
-
return callablePlugin[key](...args);
|
|
18
|
+
for (const key in callablePlugin) wrappedPlugin[key] = function(...args$1) {
|
|
19
|
+
return callablePlugin[key](...args$1);
|
|
22
20
|
};
|
|
23
21
|
return wrappedPlugin;
|
|
24
22
|
}
|
|
@@ -101,31 +99,6 @@ var init_constructors = __esm({ "src/builtin-plugin/constructors.ts"() {
|
|
|
101
99
|
};
|
|
102
100
|
} });
|
|
103
101
|
|
|
104
|
-
//#endregion
|
|
105
|
-
//#region src/utils/misc.ts
|
|
106
|
-
function arraify(value) {
|
|
107
|
-
return Array.isArray(value) ? value : [value];
|
|
108
|
-
}
|
|
109
|
-
function isNullish(value) {
|
|
110
|
-
return value === null || value === void 0;
|
|
111
|
-
}
|
|
112
|
-
function isPromiseLike(value) {
|
|
113
|
-
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
114
|
-
}
|
|
115
|
-
function unimplemented(info) {
|
|
116
|
-
if (info) throw new Error(`unimplemented: ${info}`);
|
|
117
|
-
throw new Error("unimplemented");
|
|
118
|
-
}
|
|
119
|
-
function unreachable(info) {
|
|
120
|
-
if (info) throw new Error(`unreachable: ${info}`);
|
|
121
|
-
throw new Error("unreachable");
|
|
122
|
-
}
|
|
123
|
-
function unsupported(info) {
|
|
124
|
-
throw new Error(`UNSUPPORTED: ${info}`);
|
|
125
|
-
}
|
|
126
|
-
function noop(..._args) {}
|
|
127
|
-
var init_misc = __esm({ "src/utils/misc.ts"() {} });
|
|
128
|
-
|
|
129
102
|
//#endregion
|
|
130
103
|
//#region src/log/logging.ts
|
|
131
104
|
var LOG_LEVEL_SILENT, LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, logLevelPriority;
|
|
@@ -273,7 +246,7 @@ var init_normalize_hook = __esm({ "src/utils/normalize-hook.ts"() {
|
|
|
273
246
|
//#endregion
|
|
274
247
|
//#region src/constants/plugin.ts
|
|
275
248
|
var ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES, ENUMERATED_PLUGIN_HOOK_NAMES, DEFINED_HOOK_NAMES;
|
|
276
|
-
var init_plugin$
|
|
249
|
+
var init_plugin$1 = __esm({ "src/constants/plugin.ts"() {
|
|
277
250
|
ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
|
|
278
251
|
"options",
|
|
279
252
|
"buildStart",
|
|
@@ -334,11 +307,11 @@ var init_plugin$2 = __esm({ "src/constants/plugin.ts"() {
|
|
|
334
307
|
|
|
335
308
|
//#endregion
|
|
336
309
|
//#region src/utils/async-flatten.ts
|
|
337
|
-
async function asyncFlatten(array) {
|
|
310
|
+
async function asyncFlatten(array$1) {
|
|
338
311
|
do
|
|
339
|
-
array = (await Promise.all(array)).flat(Infinity);
|
|
340
|
-
while (array.some((v
|
|
341
|
-
return array;
|
|
312
|
+
array$1 = (await Promise.all(array$1)).flat(Infinity);
|
|
313
|
+
while (array$1.some((v) => v?.then));
|
|
314
|
+
return array$1;
|
|
342
315
|
}
|
|
343
316
|
var init_async_flatten = __esm({ "src/utils/async-flatten.ts"() {} });
|
|
344
317
|
|
|
@@ -362,7 +335,7 @@ function normalizePlugins(plugins, anonymousPrefix) {
|
|
|
362
335
|
var normalizePluginOption, ANONYMOUS_PLUGIN_PREFIX, ANONYMOUS_OUTPUT_PLUGIN_PREFIX;
|
|
363
336
|
var init_normalize_plugin_option = __esm({ "src/utils/normalize-plugin-option.ts"() {
|
|
364
337
|
init_constructors();
|
|
365
|
-
init_plugin$
|
|
338
|
+
init_plugin$1();
|
|
366
339
|
init_logging();
|
|
367
340
|
init_logs();
|
|
368
341
|
init_async_flatten();
|
|
@@ -478,10 +451,1321 @@ var init_plugin_driver = __esm({ "src/plugin/plugin-driver.ts"() {
|
|
|
478
451
|
};
|
|
479
452
|
} });
|
|
480
453
|
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region ../../node_modules/.pnpm/valibot@1.0.0_typescript@5.8.3/node_modules/valibot/dist/index.js
|
|
456
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
457
|
+
function getGlobalConfig(config2) {
|
|
458
|
+
return {
|
|
459
|
+
lang: config2?.lang ?? store?.lang,
|
|
460
|
+
message: config2?.message,
|
|
461
|
+
abortEarly: config2?.abortEarly ?? store?.abortEarly,
|
|
462
|
+
abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
466
|
+
function getGlobalMessage(lang) {
|
|
467
|
+
return store2?.get(lang);
|
|
468
|
+
}
|
|
469
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
470
|
+
function getSchemaMessage(lang) {
|
|
471
|
+
return store3?.get(lang);
|
|
472
|
+
}
|
|
473
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
474
|
+
function getSpecificMessage(reference, lang) {
|
|
475
|
+
return store4?.get(reference)?.get(lang);
|
|
476
|
+
}
|
|
477
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
478
|
+
function _stringify(input) {
|
|
479
|
+
const type = typeof input;
|
|
480
|
+
if (type === "string") return `"${input}"`;
|
|
481
|
+
if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
|
|
482
|
+
if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
483
|
+
return type;
|
|
484
|
+
}
|
|
485
|
+
function _addIssue(context, label, dataset, config2, other) {
|
|
486
|
+
const input = other && "input" in other ? other.input : dataset.value;
|
|
487
|
+
const expected = other?.expected ?? context.expects ?? null;
|
|
488
|
+
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
489
|
+
const issue = {
|
|
490
|
+
kind: context.kind,
|
|
491
|
+
type: context.type,
|
|
492
|
+
input,
|
|
493
|
+
expected,
|
|
494
|
+
received,
|
|
495
|
+
message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
|
|
496
|
+
requirement: context.requirement,
|
|
497
|
+
path: other?.path,
|
|
498
|
+
issues: other?.issues,
|
|
499
|
+
lang: config2.lang,
|
|
500
|
+
abortEarly: config2.abortEarly,
|
|
501
|
+
abortPipeEarly: config2.abortPipeEarly
|
|
502
|
+
};
|
|
503
|
+
const isSchema = context.kind === "schema";
|
|
504
|
+
const message = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
|
|
505
|
+
if (message !== void 0) issue.message = typeof message === "function" ? message(issue) : message;
|
|
506
|
+
if (isSchema) dataset.typed = false;
|
|
507
|
+
if (dataset.issues) dataset.issues.push(issue);
|
|
508
|
+
else dataset.issues = [issue];
|
|
509
|
+
}
|
|
510
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
511
|
+
function _getStandardProps(context) {
|
|
512
|
+
return {
|
|
513
|
+
version: 1,
|
|
514
|
+
vendor: "valibot",
|
|
515
|
+
validate(value2) {
|
|
516
|
+
return context["~run"]({ value: value2 }, /* @__PURE__ */ getGlobalConfig());
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
521
|
+
function _isValidObjectKey(object2, key) {
|
|
522
|
+
return Object.hasOwn(object2, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
|
|
523
|
+
}
|
|
524
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
525
|
+
function _joinExpects(values2, separator) {
|
|
526
|
+
const list = [...new Set(values2)];
|
|
527
|
+
if (list.length > 1) return `(${list.join(` ${separator} `)})`;
|
|
528
|
+
return list[0] ?? "never";
|
|
529
|
+
}
|
|
530
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
531
|
+
function args(schema) {
|
|
532
|
+
return {
|
|
533
|
+
kind: "transformation",
|
|
534
|
+
type: "args",
|
|
535
|
+
reference: args,
|
|
536
|
+
async: false,
|
|
537
|
+
schema,
|
|
538
|
+
"~run"(dataset, config2) {
|
|
539
|
+
const func = dataset.value;
|
|
540
|
+
dataset.value = (...args_) => {
|
|
541
|
+
const argsDataset = this.schema["~run"]({ value: args_ }, config2);
|
|
542
|
+
if (argsDataset.issues) throw new ValiError(argsDataset.issues);
|
|
543
|
+
return func(...argsDataset.value);
|
|
544
|
+
};
|
|
545
|
+
return dataset;
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
550
|
+
function awaitAsync() {
|
|
551
|
+
return {
|
|
552
|
+
kind: "transformation",
|
|
553
|
+
type: "await",
|
|
554
|
+
reference: awaitAsync,
|
|
555
|
+
async: true,
|
|
556
|
+
async "~run"(dataset) {
|
|
557
|
+
dataset.value = await dataset.value;
|
|
558
|
+
return dataset;
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
563
|
+
function description(description_) {
|
|
564
|
+
return {
|
|
565
|
+
kind: "metadata",
|
|
566
|
+
type: "description",
|
|
567
|
+
reference: description,
|
|
568
|
+
description: description_
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
572
|
+
function returns(schema) {
|
|
573
|
+
return {
|
|
574
|
+
kind: "transformation",
|
|
575
|
+
type: "returns",
|
|
576
|
+
reference: returns,
|
|
577
|
+
async: false,
|
|
578
|
+
schema,
|
|
579
|
+
"~run"(dataset, config2) {
|
|
580
|
+
const func = dataset.value;
|
|
581
|
+
dataset.value = (...args_) => {
|
|
582
|
+
const returnsDataset = this.schema["~run"]({ value: func(...args_) }, config2);
|
|
583
|
+
if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
|
|
584
|
+
return returnsDataset.value;
|
|
585
|
+
};
|
|
586
|
+
return dataset;
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
591
|
+
function returnsAsync(schema) {
|
|
592
|
+
return {
|
|
593
|
+
kind: "transformation",
|
|
594
|
+
type: "returns",
|
|
595
|
+
reference: returnsAsync,
|
|
596
|
+
async: false,
|
|
597
|
+
schema,
|
|
598
|
+
"~run"(dataset, config2) {
|
|
599
|
+
const func = dataset.value;
|
|
600
|
+
dataset.value = async (...args_) => {
|
|
601
|
+
const returnsDataset = await this.schema["~run"]({ value: await func(...args_) }, config2);
|
|
602
|
+
if (returnsDataset.issues) throw new ValiError(returnsDataset.issues);
|
|
603
|
+
return returnsDataset.value;
|
|
604
|
+
};
|
|
605
|
+
return dataset;
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
610
|
+
function getFallback(schema, dataset, config2) {
|
|
611
|
+
return typeof schema.fallback === "function" ? schema.fallback(dataset, config2) : schema.fallback;
|
|
612
|
+
}
|
|
613
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
614
|
+
function getDefault(schema, dataset, config2) {
|
|
615
|
+
return typeof schema.default === "function" ? schema.default(dataset, config2) : schema.default;
|
|
616
|
+
}
|
|
617
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
618
|
+
function any() {
|
|
619
|
+
return {
|
|
620
|
+
kind: "schema",
|
|
621
|
+
type: "any",
|
|
622
|
+
reference: any,
|
|
623
|
+
expects: "any",
|
|
624
|
+
async: false,
|
|
625
|
+
get "~standard"() {
|
|
626
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
627
|
+
},
|
|
628
|
+
"~run"(dataset) {
|
|
629
|
+
dataset.typed = true;
|
|
630
|
+
return dataset;
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
635
|
+
function array(item, message) {
|
|
636
|
+
return {
|
|
637
|
+
kind: "schema",
|
|
638
|
+
type: "array",
|
|
639
|
+
reference: array,
|
|
640
|
+
expects: "Array",
|
|
641
|
+
async: false,
|
|
642
|
+
item,
|
|
643
|
+
message,
|
|
644
|
+
get "~standard"() {
|
|
645
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
646
|
+
},
|
|
647
|
+
"~run"(dataset, config2) {
|
|
648
|
+
const input = dataset.value;
|
|
649
|
+
if (Array.isArray(input)) {
|
|
650
|
+
dataset.typed = true;
|
|
651
|
+
dataset.value = [];
|
|
652
|
+
for (let key = 0; key < input.length; key++) {
|
|
653
|
+
const value2 = input[key];
|
|
654
|
+
const itemDataset = this.item["~run"]({ value: value2 }, config2);
|
|
655
|
+
if (itemDataset.issues) {
|
|
656
|
+
const pathItem = {
|
|
657
|
+
type: "array",
|
|
658
|
+
origin: "value",
|
|
659
|
+
input,
|
|
660
|
+
key,
|
|
661
|
+
value: value2
|
|
662
|
+
};
|
|
663
|
+
for (const issue of itemDataset.issues) {
|
|
664
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
665
|
+
else issue.path = [pathItem];
|
|
666
|
+
dataset.issues?.push(issue);
|
|
667
|
+
}
|
|
668
|
+
if (!dataset.issues) dataset.issues = itemDataset.issues;
|
|
669
|
+
if (config2.abortEarly) {
|
|
670
|
+
dataset.typed = false;
|
|
671
|
+
break;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
if (!itemDataset.typed) dataset.typed = false;
|
|
675
|
+
dataset.value.push(itemDataset.value);
|
|
676
|
+
}
|
|
677
|
+
} else _addIssue(this, "type", dataset, config2);
|
|
678
|
+
return dataset;
|
|
679
|
+
}
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
683
|
+
function boolean(message) {
|
|
684
|
+
return {
|
|
685
|
+
kind: "schema",
|
|
686
|
+
type: "boolean",
|
|
687
|
+
reference: boolean,
|
|
688
|
+
expects: "boolean",
|
|
689
|
+
async: false,
|
|
690
|
+
message,
|
|
691
|
+
get "~standard"() {
|
|
692
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
693
|
+
},
|
|
694
|
+
"~run"(dataset, config2) {
|
|
695
|
+
if (typeof dataset.value === "boolean") dataset.typed = true;
|
|
696
|
+
else _addIssue(this, "type", dataset, config2);
|
|
697
|
+
return dataset;
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
702
|
+
function custom(check2, message) {
|
|
703
|
+
return {
|
|
704
|
+
kind: "schema",
|
|
705
|
+
type: "custom",
|
|
706
|
+
reference: custom,
|
|
707
|
+
expects: "unknown",
|
|
708
|
+
async: false,
|
|
709
|
+
check: check2,
|
|
710
|
+
message,
|
|
711
|
+
get "~standard"() {
|
|
712
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
713
|
+
},
|
|
714
|
+
"~run"(dataset, config2) {
|
|
715
|
+
if (this.check(dataset.value)) dataset.typed = true;
|
|
716
|
+
else _addIssue(this, "type", dataset, config2);
|
|
717
|
+
return dataset;
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
722
|
+
function enum_(enum__, message) {
|
|
723
|
+
const options = [];
|
|
724
|
+
for (const key in enum__) if (`${+key}` !== key || typeof enum__[key] !== "string" || !Object.is(enum__[enum__[key]], +key)) options.push(enum__[key]);
|
|
725
|
+
return {
|
|
726
|
+
kind: "schema",
|
|
727
|
+
type: "enum",
|
|
728
|
+
reference: enum_,
|
|
729
|
+
expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
|
|
730
|
+
async: false,
|
|
731
|
+
enum: enum__,
|
|
732
|
+
options,
|
|
733
|
+
message,
|
|
734
|
+
get "~standard"() {
|
|
735
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
736
|
+
},
|
|
737
|
+
"~run"(dataset, config2) {
|
|
738
|
+
if (this.options.includes(dataset.value)) dataset.typed = true;
|
|
739
|
+
else _addIssue(this, "type", dataset, config2);
|
|
740
|
+
return dataset;
|
|
741
|
+
}
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
745
|
+
function function_(message) {
|
|
746
|
+
return {
|
|
747
|
+
kind: "schema",
|
|
748
|
+
type: "function",
|
|
749
|
+
reference: function_,
|
|
750
|
+
expects: "Function",
|
|
751
|
+
async: false,
|
|
752
|
+
message,
|
|
753
|
+
get "~standard"() {
|
|
754
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
755
|
+
},
|
|
756
|
+
"~run"(dataset, config2) {
|
|
757
|
+
if (typeof dataset.value === "function") dataset.typed = true;
|
|
758
|
+
else _addIssue(this, "type", dataset, config2);
|
|
759
|
+
return dataset;
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
764
|
+
function instance(class_, message) {
|
|
765
|
+
return {
|
|
766
|
+
kind: "schema",
|
|
767
|
+
type: "instance",
|
|
768
|
+
reference: instance,
|
|
769
|
+
expects: class_.name,
|
|
770
|
+
async: false,
|
|
771
|
+
class: class_,
|
|
772
|
+
message,
|
|
773
|
+
get "~standard"() {
|
|
774
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
775
|
+
},
|
|
776
|
+
"~run"(dataset, config2) {
|
|
777
|
+
if (dataset.value instanceof this.class) dataset.typed = true;
|
|
778
|
+
else _addIssue(this, "type", dataset, config2);
|
|
779
|
+
return dataset;
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
784
|
+
function literal(literal_, message) {
|
|
785
|
+
return {
|
|
786
|
+
kind: "schema",
|
|
787
|
+
type: "literal",
|
|
788
|
+
reference: literal,
|
|
789
|
+
expects: /* @__PURE__ */ _stringify(literal_),
|
|
790
|
+
async: false,
|
|
791
|
+
literal: literal_,
|
|
792
|
+
message,
|
|
793
|
+
get "~standard"() {
|
|
794
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
795
|
+
},
|
|
796
|
+
"~run"(dataset, config2) {
|
|
797
|
+
if (dataset.value === this.literal) dataset.typed = true;
|
|
798
|
+
else _addIssue(this, "type", dataset, config2);
|
|
799
|
+
return dataset;
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
804
|
+
function looseObject(entries, message) {
|
|
805
|
+
return {
|
|
806
|
+
kind: "schema",
|
|
807
|
+
type: "loose_object",
|
|
808
|
+
reference: looseObject,
|
|
809
|
+
expects: "Object",
|
|
810
|
+
async: false,
|
|
811
|
+
entries,
|
|
812
|
+
message,
|
|
813
|
+
get "~standard"() {
|
|
814
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
815
|
+
},
|
|
816
|
+
"~run"(dataset, config2) {
|
|
817
|
+
const input = dataset.value;
|
|
818
|
+
if (input && typeof input === "object") {
|
|
819
|
+
dataset.typed = true;
|
|
820
|
+
dataset.value = {};
|
|
821
|
+
for (const key in this.entries) {
|
|
822
|
+
const valueSchema = this.entries[key];
|
|
823
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
824
|
+
const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
825
|
+
const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
|
|
826
|
+
if (valueDataset.issues) {
|
|
827
|
+
const pathItem = {
|
|
828
|
+
type: "object",
|
|
829
|
+
origin: "value",
|
|
830
|
+
input,
|
|
831
|
+
key,
|
|
832
|
+
value: value2
|
|
833
|
+
};
|
|
834
|
+
for (const issue of valueDataset.issues) {
|
|
835
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
836
|
+
else issue.path = [pathItem];
|
|
837
|
+
dataset.issues?.push(issue);
|
|
838
|
+
}
|
|
839
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
840
|
+
if (config2.abortEarly) {
|
|
841
|
+
dataset.typed = false;
|
|
842
|
+
break;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
if (!valueDataset.typed) dataset.typed = false;
|
|
846
|
+
dataset.value[key] = valueDataset.value;
|
|
847
|
+
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
848
|
+
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
849
|
+
_addIssue(this, "key", dataset, config2, {
|
|
850
|
+
input: void 0,
|
|
851
|
+
expected: `"${key}"`,
|
|
852
|
+
path: [{
|
|
853
|
+
type: "object",
|
|
854
|
+
origin: "key",
|
|
855
|
+
input,
|
|
856
|
+
key,
|
|
857
|
+
value: input[key]
|
|
858
|
+
}]
|
|
859
|
+
});
|
|
860
|
+
if (config2.abortEarly) break;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
if (!dataset.issues || !config2.abortEarly) {
|
|
864
|
+
for (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
|
|
865
|
+
}
|
|
866
|
+
} else _addIssue(this, "type", dataset, config2);
|
|
867
|
+
return dataset;
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
872
|
+
function never(message) {
|
|
873
|
+
return {
|
|
874
|
+
kind: "schema",
|
|
875
|
+
type: "never",
|
|
876
|
+
reference: never,
|
|
877
|
+
expects: "never",
|
|
878
|
+
async: false,
|
|
879
|
+
message,
|
|
880
|
+
get "~standard"() {
|
|
881
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
882
|
+
},
|
|
883
|
+
"~run"(dataset, config2) {
|
|
884
|
+
_addIssue(this, "type", dataset, config2);
|
|
885
|
+
return dataset;
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
890
|
+
function nullish(wrapped, default_) {
|
|
891
|
+
return {
|
|
892
|
+
kind: "schema",
|
|
893
|
+
type: "nullish",
|
|
894
|
+
reference: nullish,
|
|
895
|
+
expects: `(${wrapped.expects} | null | undefined)`,
|
|
896
|
+
async: false,
|
|
897
|
+
wrapped,
|
|
898
|
+
default: default_,
|
|
899
|
+
get "~standard"() {
|
|
900
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
901
|
+
},
|
|
902
|
+
"~run"(dataset, config2) {
|
|
903
|
+
if (dataset.value === null || dataset.value === void 0) {
|
|
904
|
+
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
|
|
905
|
+
if (dataset.value === null || dataset.value === void 0) {
|
|
906
|
+
dataset.typed = true;
|
|
907
|
+
return dataset;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
return this.wrapped["~run"](dataset, config2);
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
915
|
+
function number(message) {
|
|
916
|
+
return {
|
|
917
|
+
kind: "schema",
|
|
918
|
+
type: "number",
|
|
919
|
+
reference: number,
|
|
920
|
+
expects: "number",
|
|
921
|
+
async: false,
|
|
922
|
+
message,
|
|
923
|
+
get "~standard"() {
|
|
924
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
925
|
+
},
|
|
926
|
+
"~run"(dataset, config2) {
|
|
927
|
+
if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
|
|
928
|
+
else _addIssue(this, "type", dataset, config2);
|
|
929
|
+
return dataset;
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
934
|
+
function object(entries, message) {
|
|
935
|
+
return {
|
|
936
|
+
kind: "schema",
|
|
937
|
+
type: "object",
|
|
938
|
+
reference: object,
|
|
939
|
+
expects: "Object",
|
|
940
|
+
async: false,
|
|
941
|
+
entries,
|
|
942
|
+
message,
|
|
943
|
+
get "~standard"() {
|
|
944
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
945
|
+
},
|
|
946
|
+
"~run"(dataset, config2) {
|
|
947
|
+
const input = dataset.value;
|
|
948
|
+
if (input && typeof input === "object") {
|
|
949
|
+
dataset.typed = true;
|
|
950
|
+
dataset.value = {};
|
|
951
|
+
for (const key in this.entries) {
|
|
952
|
+
const valueSchema = this.entries[key];
|
|
953
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
954
|
+
const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
955
|
+
const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
|
|
956
|
+
if (valueDataset.issues) {
|
|
957
|
+
const pathItem = {
|
|
958
|
+
type: "object",
|
|
959
|
+
origin: "value",
|
|
960
|
+
input,
|
|
961
|
+
key,
|
|
962
|
+
value: value2
|
|
963
|
+
};
|
|
964
|
+
for (const issue of valueDataset.issues) {
|
|
965
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
966
|
+
else issue.path = [pathItem];
|
|
967
|
+
dataset.issues?.push(issue);
|
|
968
|
+
}
|
|
969
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
970
|
+
if (config2.abortEarly) {
|
|
971
|
+
dataset.typed = false;
|
|
972
|
+
break;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
if (!valueDataset.typed) dataset.typed = false;
|
|
976
|
+
dataset.value[key] = valueDataset.value;
|
|
977
|
+
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
978
|
+
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
979
|
+
_addIssue(this, "key", dataset, config2, {
|
|
980
|
+
input: void 0,
|
|
981
|
+
expected: `"${key}"`,
|
|
982
|
+
path: [{
|
|
983
|
+
type: "object",
|
|
984
|
+
origin: "key",
|
|
985
|
+
input,
|
|
986
|
+
key,
|
|
987
|
+
value: input[key]
|
|
988
|
+
}]
|
|
989
|
+
});
|
|
990
|
+
if (config2.abortEarly) break;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
} else _addIssue(this, "type", dataset, config2);
|
|
994
|
+
return dataset;
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
999
|
+
function optional(wrapped, default_) {
|
|
1000
|
+
return {
|
|
1001
|
+
kind: "schema",
|
|
1002
|
+
type: "optional",
|
|
1003
|
+
reference: optional,
|
|
1004
|
+
expects: `(${wrapped.expects} | undefined)`,
|
|
1005
|
+
async: false,
|
|
1006
|
+
wrapped,
|
|
1007
|
+
default: default_,
|
|
1008
|
+
get "~standard"() {
|
|
1009
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1010
|
+
},
|
|
1011
|
+
"~run"(dataset, config2) {
|
|
1012
|
+
if (dataset.value === void 0) {
|
|
1013
|
+
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
|
|
1014
|
+
if (dataset.value === void 0) {
|
|
1015
|
+
dataset.typed = true;
|
|
1016
|
+
return dataset;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
return this.wrapped["~run"](dataset, config2);
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1024
|
+
function picklist(options, message) {
|
|
1025
|
+
return {
|
|
1026
|
+
kind: "schema",
|
|
1027
|
+
type: "picklist",
|
|
1028
|
+
reference: picklist,
|
|
1029
|
+
expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
|
|
1030
|
+
async: false,
|
|
1031
|
+
options,
|
|
1032
|
+
message,
|
|
1033
|
+
get "~standard"() {
|
|
1034
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1035
|
+
},
|
|
1036
|
+
"~run"(dataset, config2) {
|
|
1037
|
+
if (this.options.includes(dataset.value)) dataset.typed = true;
|
|
1038
|
+
else _addIssue(this, "type", dataset, config2);
|
|
1039
|
+
return dataset;
|
|
1040
|
+
}
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1044
|
+
function promise(message) {
|
|
1045
|
+
return {
|
|
1046
|
+
kind: "schema",
|
|
1047
|
+
type: "promise",
|
|
1048
|
+
reference: promise,
|
|
1049
|
+
expects: "Promise",
|
|
1050
|
+
async: false,
|
|
1051
|
+
message,
|
|
1052
|
+
get "~standard"() {
|
|
1053
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1054
|
+
},
|
|
1055
|
+
"~run"(dataset, config2) {
|
|
1056
|
+
if (dataset.value instanceof Promise) dataset.typed = true;
|
|
1057
|
+
else _addIssue(this, "type", dataset, config2);
|
|
1058
|
+
return dataset;
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
}
|
|
1062
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1063
|
+
function record(key, value2, message) {
|
|
1064
|
+
return {
|
|
1065
|
+
kind: "schema",
|
|
1066
|
+
type: "record",
|
|
1067
|
+
reference: record,
|
|
1068
|
+
expects: "Object",
|
|
1069
|
+
async: false,
|
|
1070
|
+
key,
|
|
1071
|
+
value: value2,
|
|
1072
|
+
message,
|
|
1073
|
+
get "~standard"() {
|
|
1074
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1075
|
+
},
|
|
1076
|
+
"~run"(dataset, config2) {
|
|
1077
|
+
const input = dataset.value;
|
|
1078
|
+
if (input && typeof input === "object") {
|
|
1079
|
+
dataset.typed = true;
|
|
1080
|
+
dataset.value = {};
|
|
1081
|
+
for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
|
|
1082
|
+
const entryValue = input[entryKey];
|
|
1083
|
+
const keyDataset = this.key["~run"]({ value: entryKey }, config2);
|
|
1084
|
+
if (keyDataset.issues) {
|
|
1085
|
+
const pathItem = {
|
|
1086
|
+
type: "object",
|
|
1087
|
+
origin: "key",
|
|
1088
|
+
input,
|
|
1089
|
+
key: entryKey,
|
|
1090
|
+
value: entryValue
|
|
1091
|
+
};
|
|
1092
|
+
for (const issue of keyDataset.issues) {
|
|
1093
|
+
issue.path = [pathItem];
|
|
1094
|
+
dataset.issues?.push(issue);
|
|
1095
|
+
}
|
|
1096
|
+
if (!dataset.issues) dataset.issues = keyDataset.issues;
|
|
1097
|
+
if (config2.abortEarly) {
|
|
1098
|
+
dataset.typed = false;
|
|
1099
|
+
break;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
const valueDataset = this.value["~run"]({ value: entryValue }, config2);
|
|
1103
|
+
if (valueDataset.issues) {
|
|
1104
|
+
const pathItem = {
|
|
1105
|
+
type: "object",
|
|
1106
|
+
origin: "value",
|
|
1107
|
+
input,
|
|
1108
|
+
key: entryKey,
|
|
1109
|
+
value: entryValue
|
|
1110
|
+
};
|
|
1111
|
+
for (const issue of valueDataset.issues) {
|
|
1112
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
1113
|
+
else issue.path = [pathItem];
|
|
1114
|
+
dataset.issues?.push(issue);
|
|
1115
|
+
}
|
|
1116
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
1117
|
+
if (config2.abortEarly) {
|
|
1118
|
+
dataset.typed = false;
|
|
1119
|
+
break;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
|
|
1123
|
+
if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
|
|
1124
|
+
}
|
|
1125
|
+
} else _addIssue(this, "type", dataset, config2);
|
|
1126
|
+
return dataset;
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1131
|
+
function strictObject(entries, message) {
|
|
1132
|
+
return {
|
|
1133
|
+
kind: "schema",
|
|
1134
|
+
type: "strict_object",
|
|
1135
|
+
reference: strictObject,
|
|
1136
|
+
expects: "Object",
|
|
1137
|
+
async: false,
|
|
1138
|
+
entries,
|
|
1139
|
+
message,
|
|
1140
|
+
get "~standard"() {
|
|
1141
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1142
|
+
},
|
|
1143
|
+
"~run"(dataset, config2) {
|
|
1144
|
+
const input = dataset.value;
|
|
1145
|
+
if (input && typeof input === "object") {
|
|
1146
|
+
dataset.typed = true;
|
|
1147
|
+
dataset.value = {};
|
|
1148
|
+
for (const key in this.entries) {
|
|
1149
|
+
const valueSchema = this.entries[key];
|
|
1150
|
+
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
1151
|
+
const value2 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
1152
|
+
const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
|
|
1153
|
+
if (valueDataset.issues) {
|
|
1154
|
+
const pathItem = {
|
|
1155
|
+
type: "object",
|
|
1156
|
+
origin: "value",
|
|
1157
|
+
input,
|
|
1158
|
+
key,
|
|
1159
|
+
value: value2
|
|
1160
|
+
};
|
|
1161
|
+
for (const issue of valueDataset.issues) {
|
|
1162
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
1163
|
+
else issue.path = [pathItem];
|
|
1164
|
+
dataset.issues?.push(issue);
|
|
1165
|
+
}
|
|
1166
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
1167
|
+
if (config2.abortEarly) {
|
|
1168
|
+
dataset.typed = false;
|
|
1169
|
+
break;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
if (!valueDataset.typed) dataset.typed = false;
|
|
1173
|
+
dataset.value[key] = valueDataset.value;
|
|
1174
|
+
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
1175
|
+
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
1176
|
+
_addIssue(this, "key", dataset, config2, {
|
|
1177
|
+
input: void 0,
|
|
1178
|
+
expected: `"${key}"`,
|
|
1179
|
+
path: [{
|
|
1180
|
+
type: "object",
|
|
1181
|
+
origin: "key",
|
|
1182
|
+
input,
|
|
1183
|
+
key,
|
|
1184
|
+
value: input[key]
|
|
1185
|
+
}]
|
|
1186
|
+
});
|
|
1187
|
+
if (config2.abortEarly) break;
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
if (!dataset.issues || !config2.abortEarly) {
|
|
1191
|
+
for (const key in input) if (!(key in this.entries)) {
|
|
1192
|
+
_addIssue(this, "key", dataset, config2, {
|
|
1193
|
+
input: key,
|
|
1194
|
+
expected: "never",
|
|
1195
|
+
path: [{
|
|
1196
|
+
type: "object",
|
|
1197
|
+
origin: "key",
|
|
1198
|
+
input,
|
|
1199
|
+
key,
|
|
1200
|
+
value: input[key]
|
|
1201
|
+
}]
|
|
1202
|
+
});
|
|
1203
|
+
break;
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
} else _addIssue(this, "type", dataset, config2);
|
|
1207
|
+
return dataset;
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1211
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1212
|
+
function string(message) {
|
|
1213
|
+
return {
|
|
1214
|
+
kind: "schema",
|
|
1215
|
+
type: "string",
|
|
1216
|
+
reference: string,
|
|
1217
|
+
expects: "string",
|
|
1218
|
+
async: false,
|
|
1219
|
+
message,
|
|
1220
|
+
get "~standard"() {
|
|
1221
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1222
|
+
},
|
|
1223
|
+
"~run"(dataset, config2) {
|
|
1224
|
+
if (typeof dataset.value === "string") dataset.typed = true;
|
|
1225
|
+
else _addIssue(this, "type", dataset, config2);
|
|
1226
|
+
return dataset;
|
|
1227
|
+
}
|
|
1228
|
+
};
|
|
1229
|
+
}
|
|
1230
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1231
|
+
function tuple(items, message) {
|
|
1232
|
+
return {
|
|
1233
|
+
kind: "schema",
|
|
1234
|
+
type: "tuple",
|
|
1235
|
+
reference: tuple,
|
|
1236
|
+
expects: "Array",
|
|
1237
|
+
async: false,
|
|
1238
|
+
items,
|
|
1239
|
+
message,
|
|
1240
|
+
get "~standard"() {
|
|
1241
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1242
|
+
},
|
|
1243
|
+
"~run"(dataset, config2) {
|
|
1244
|
+
const input = dataset.value;
|
|
1245
|
+
if (Array.isArray(input)) {
|
|
1246
|
+
dataset.typed = true;
|
|
1247
|
+
dataset.value = [];
|
|
1248
|
+
for (let key = 0; key < this.items.length; key++) {
|
|
1249
|
+
const value2 = input[key];
|
|
1250
|
+
const itemDataset = this.items[key]["~run"]({ value: value2 }, config2);
|
|
1251
|
+
if (itemDataset.issues) {
|
|
1252
|
+
const pathItem = {
|
|
1253
|
+
type: "array",
|
|
1254
|
+
origin: "value",
|
|
1255
|
+
input,
|
|
1256
|
+
key,
|
|
1257
|
+
value: value2
|
|
1258
|
+
};
|
|
1259
|
+
for (const issue of itemDataset.issues) {
|
|
1260
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
1261
|
+
else issue.path = [pathItem];
|
|
1262
|
+
dataset.issues?.push(issue);
|
|
1263
|
+
}
|
|
1264
|
+
if (!dataset.issues) dataset.issues = itemDataset.issues;
|
|
1265
|
+
if (config2.abortEarly) {
|
|
1266
|
+
dataset.typed = false;
|
|
1267
|
+
break;
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
if (!itemDataset.typed) dataset.typed = false;
|
|
1271
|
+
dataset.value.push(itemDataset.value);
|
|
1272
|
+
}
|
|
1273
|
+
} else _addIssue(this, "type", dataset, config2);
|
|
1274
|
+
return dataset;
|
|
1275
|
+
}
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1279
|
+
function _subIssues(datasets) {
|
|
1280
|
+
let issues;
|
|
1281
|
+
if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
|
|
1282
|
+
else issues = dataset.issues;
|
|
1283
|
+
return issues;
|
|
1284
|
+
}
|
|
1285
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1286
|
+
function union(options, message) {
|
|
1287
|
+
return {
|
|
1288
|
+
kind: "schema",
|
|
1289
|
+
type: "union",
|
|
1290
|
+
reference: union,
|
|
1291
|
+
expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
|
|
1292
|
+
async: false,
|
|
1293
|
+
options,
|
|
1294
|
+
message,
|
|
1295
|
+
get "~standard"() {
|
|
1296
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1297
|
+
},
|
|
1298
|
+
"~run"(dataset, config2) {
|
|
1299
|
+
let validDataset;
|
|
1300
|
+
let typedDatasets;
|
|
1301
|
+
let untypedDatasets;
|
|
1302
|
+
for (const schema of this.options) {
|
|
1303
|
+
const optionDataset = schema["~run"]({ value: dataset.value }, config2);
|
|
1304
|
+
if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
|
|
1305
|
+
else typedDatasets = [optionDataset];
|
|
1306
|
+
else {
|
|
1307
|
+
validDataset = optionDataset;
|
|
1308
|
+
break;
|
|
1309
|
+
}
|
|
1310
|
+
else if (untypedDatasets) untypedDatasets.push(optionDataset);
|
|
1311
|
+
else untypedDatasets = [optionDataset];
|
|
1312
|
+
}
|
|
1313
|
+
if (validDataset) return validDataset;
|
|
1314
|
+
if (typedDatasets) {
|
|
1315
|
+
if (typedDatasets.length === 1) return typedDatasets[0];
|
|
1316
|
+
_addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
|
|
1317
|
+
dataset.typed = true;
|
|
1318
|
+
} else if (untypedDatasets?.length === 1) return untypedDatasets[0];
|
|
1319
|
+
else _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
|
|
1320
|
+
return dataset;
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1325
|
+
function unionAsync(options, message) {
|
|
1326
|
+
return {
|
|
1327
|
+
kind: "schema",
|
|
1328
|
+
type: "union",
|
|
1329
|
+
reference: unionAsync,
|
|
1330
|
+
expects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), "|"),
|
|
1331
|
+
async: true,
|
|
1332
|
+
options,
|
|
1333
|
+
message,
|
|
1334
|
+
get "~standard"() {
|
|
1335
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1336
|
+
},
|
|
1337
|
+
async "~run"(dataset, config2) {
|
|
1338
|
+
let validDataset;
|
|
1339
|
+
let typedDatasets;
|
|
1340
|
+
let untypedDatasets;
|
|
1341
|
+
for (const schema of this.options) {
|
|
1342
|
+
const optionDataset = await schema["~run"]({ value: dataset.value }, config2);
|
|
1343
|
+
if (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);
|
|
1344
|
+
else typedDatasets = [optionDataset];
|
|
1345
|
+
else {
|
|
1346
|
+
validDataset = optionDataset;
|
|
1347
|
+
break;
|
|
1348
|
+
}
|
|
1349
|
+
else if (untypedDatasets) untypedDatasets.push(optionDataset);
|
|
1350
|
+
else untypedDatasets = [optionDataset];
|
|
1351
|
+
}
|
|
1352
|
+
if (validDataset) return validDataset;
|
|
1353
|
+
if (typedDatasets) {
|
|
1354
|
+
if (typedDatasets.length === 1) return typedDatasets[0];
|
|
1355
|
+
_addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });
|
|
1356
|
+
dataset.typed = true;
|
|
1357
|
+
} else if (untypedDatasets?.length === 1) return untypedDatasets[0];
|
|
1358
|
+
else _addIssue(this, "type", dataset, config2, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });
|
|
1359
|
+
return dataset;
|
|
1360
|
+
}
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1364
|
+
function keyof(schema, message) {
|
|
1365
|
+
return /* @__PURE__ */ picklist(Object.keys(schema.entries), message);
|
|
1366
|
+
}
|
|
1367
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1368
|
+
function omit(schema, keys) {
|
|
1369
|
+
const entries = { ...schema.entries };
|
|
1370
|
+
for (const key of keys) delete entries[key];
|
|
1371
|
+
return {
|
|
1372
|
+
...schema,
|
|
1373
|
+
entries,
|
|
1374
|
+
get "~standard"() {
|
|
1375
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1376
|
+
}
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1380
|
+
function pipe(...pipe2) {
|
|
1381
|
+
return {
|
|
1382
|
+
...pipe2[0],
|
|
1383
|
+
pipe: pipe2,
|
|
1384
|
+
get "~standard"() {
|
|
1385
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1386
|
+
},
|
|
1387
|
+
"~run"(dataset, config2) {
|
|
1388
|
+
for (const item of pipe2) if (item.kind !== "metadata") {
|
|
1389
|
+
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
1390
|
+
dataset.typed = false;
|
|
1391
|
+
break;
|
|
1392
|
+
}
|
|
1393
|
+
if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) dataset = item["~run"](dataset, config2);
|
|
1394
|
+
}
|
|
1395
|
+
return dataset;
|
|
1396
|
+
}
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1400
|
+
function pipeAsync(...pipe2) {
|
|
1401
|
+
return {
|
|
1402
|
+
...pipe2[0],
|
|
1403
|
+
pipe: pipe2,
|
|
1404
|
+
async: true,
|
|
1405
|
+
get "~standard"() {
|
|
1406
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1407
|
+
},
|
|
1408
|
+
async "~run"(dataset, config2) {
|
|
1409
|
+
for (const item of pipe2) if (item.kind !== "metadata") {
|
|
1410
|
+
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
1411
|
+
dataset.typed = false;
|
|
1412
|
+
break;
|
|
1413
|
+
}
|
|
1414
|
+
if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) dataset = await item["~run"](dataset, config2);
|
|
1415
|
+
}
|
|
1416
|
+
return dataset;
|
|
1417
|
+
}
|
|
1418
|
+
};
|
|
1419
|
+
}
|
|
1420
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1421
|
+
function safeParse(schema, input, config2) {
|
|
1422
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config2));
|
|
1423
|
+
return {
|
|
1424
|
+
typed: dataset.typed,
|
|
1425
|
+
success: !dataset.issues,
|
|
1426
|
+
output: dataset.value,
|
|
1427
|
+
issues: dataset.issues
|
|
1428
|
+
};
|
|
1429
|
+
}
|
|
1430
|
+
var store, store2, store3, store4, ValiError;
|
|
1431
|
+
var init_dist$2 = __esm({ "../../node_modules/.pnpm/valibot@1.0.0_typescript@5.8.3/node_modules/valibot/dist/index.js"() {
|
|
1432
|
+
ValiError = class extends Error {
|
|
1433
|
+
/**
|
|
1434
|
+
* Creates a Valibot error with useful information.
|
|
1435
|
+
*
|
|
1436
|
+
* @param issues The error issues.
|
|
1437
|
+
*/
|
|
1438
|
+
constructor(issues) {
|
|
1439
|
+
super(issues[0].message);
|
|
1440
|
+
this.name = "ValiError";
|
|
1441
|
+
this.issues = issues;
|
|
1442
|
+
}
|
|
1443
|
+
};
|
|
1444
|
+
} });
|
|
1445
|
+
|
|
1446
|
+
//#endregion
|
|
1447
|
+
//#region ../../node_modules/.pnpm/@valibot+to-json-schema@1.0.0_valibot@1.0.0_typescript@5.8.3_/node_modules/@valibot/to-json-schema/dist/index.js
|
|
1448
|
+
function handleError(message, config) {
|
|
1449
|
+
switch (config?.errorMode) {
|
|
1450
|
+
case "ignore": break;
|
|
1451
|
+
case "warn": {
|
|
1452
|
+
console.warn(message);
|
|
1453
|
+
break;
|
|
1454
|
+
}
|
|
1455
|
+
default: throw new Error(message);
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
function convertAction(jsonSchema, valibotAction, config) {
|
|
1459
|
+
switch (valibotAction.type) {
|
|
1460
|
+
case "base64": {
|
|
1461
|
+
jsonSchema.contentEncoding = "base64";
|
|
1462
|
+
break;
|
|
1463
|
+
}
|
|
1464
|
+
case "bic":
|
|
1465
|
+
case "cuid2":
|
|
1466
|
+
case "decimal":
|
|
1467
|
+
case "digits":
|
|
1468
|
+
case "emoji":
|
|
1469
|
+
case "hexadecimal":
|
|
1470
|
+
case "hex_color":
|
|
1471
|
+
case "nanoid":
|
|
1472
|
+
case "octal":
|
|
1473
|
+
case "ulid": {
|
|
1474
|
+
jsonSchema.pattern = valibotAction.requirement.source;
|
|
1475
|
+
break;
|
|
1476
|
+
}
|
|
1477
|
+
case "description": {
|
|
1478
|
+
jsonSchema.description = valibotAction.description;
|
|
1479
|
+
break;
|
|
1480
|
+
}
|
|
1481
|
+
case "email": {
|
|
1482
|
+
jsonSchema.format = "email";
|
|
1483
|
+
break;
|
|
1484
|
+
}
|
|
1485
|
+
case "empty": {
|
|
1486
|
+
if (jsonSchema.type === "array") jsonSchema.maxItems = 0;
|
|
1487
|
+
else {
|
|
1488
|
+
if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
|
|
1489
|
+
jsonSchema.maxLength = 0;
|
|
1490
|
+
}
|
|
1491
|
+
break;
|
|
1492
|
+
}
|
|
1493
|
+
case "integer": {
|
|
1494
|
+
jsonSchema.type = "integer";
|
|
1495
|
+
break;
|
|
1496
|
+
}
|
|
1497
|
+
case "ipv4": {
|
|
1498
|
+
jsonSchema.format = "ipv4";
|
|
1499
|
+
break;
|
|
1500
|
+
}
|
|
1501
|
+
case "ipv6": {
|
|
1502
|
+
jsonSchema.format = "ipv6";
|
|
1503
|
+
break;
|
|
1504
|
+
}
|
|
1505
|
+
case "iso_date": {
|
|
1506
|
+
jsonSchema.format = "date";
|
|
1507
|
+
break;
|
|
1508
|
+
}
|
|
1509
|
+
case "iso_date_time":
|
|
1510
|
+
case "iso_timestamp": {
|
|
1511
|
+
jsonSchema.format = "date-time";
|
|
1512
|
+
break;
|
|
1513
|
+
}
|
|
1514
|
+
case "iso_time": {
|
|
1515
|
+
jsonSchema.format = "time";
|
|
1516
|
+
break;
|
|
1517
|
+
}
|
|
1518
|
+
case "length": {
|
|
1519
|
+
if (jsonSchema.type === "array") {
|
|
1520
|
+
jsonSchema.minItems = valibotAction.requirement;
|
|
1521
|
+
jsonSchema.maxItems = valibotAction.requirement;
|
|
1522
|
+
} else {
|
|
1523
|
+
if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
|
|
1524
|
+
jsonSchema.minLength = valibotAction.requirement;
|
|
1525
|
+
jsonSchema.maxLength = valibotAction.requirement;
|
|
1526
|
+
}
|
|
1527
|
+
break;
|
|
1528
|
+
}
|
|
1529
|
+
case "max_length": {
|
|
1530
|
+
if (jsonSchema.type === "array") jsonSchema.maxItems = valibotAction.requirement;
|
|
1531
|
+
else {
|
|
1532
|
+
if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
|
|
1533
|
+
jsonSchema.maxLength = valibotAction.requirement;
|
|
1534
|
+
}
|
|
1535
|
+
break;
|
|
1536
|
+
}
|
|
1537
|
+
case "max_value": {
|
|
1538
|
+
if (jsonSchema.type !== "number") handleError(`The "max_value" action is not supported on type "${jsonSchema.type}".`, config);
|
|
1539
|
+
jsonSchema.maximum = valibotAction.requirement;
|
|
1540
|
+
break;
|
|
1541
|
+
}
|
|
1542
|
+
case "min_length": {
|
|
1543
|
+
if (jsonSchema.type === "array") jsonSchema.minItems = valibotAction.requirement;
|
|
1544
|
+
else {
|
|
1545
|
+
if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
|
|
1546
|
+
jsonSchema.minLength = valibotAction.requirement;
|
|
1547
|
+
}
|
|
1548
|
+
break;
|
|
1549
|
+
}
|
|
1550
|
+
case "min_value": {
|
|
1551
|
+
if (jsonSchema.type !== "number") handleError(`The "min_value" action is not supported on type "${jsonSchema.type}".`, config);
|
|
1552
|
+
jsonSchema.minimum = valibotAction.requirement;
|
|
1553
|
+
break;
|
|
1554
|
+
}
|
|
1555
|
+
case "multiple_of": {
|
|
1556
|
+
jsonSchema.multipleOf = valibotAction.requirement;
|
|
1557
|
+
break;
|
|
1558
|
+
}
|
|
1559
|
+
case "non_empty": {
|
|
1560
|
+
if (jsonSchema.type === "array") jsonSchema.minItems = 1;
|
|
1561
|
+
else {
|
|
1562
|
+
if (jsonSchema.type !== "string") handleError(`The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`, config);
|
|
1563
|
+
jsonSchema.minLength = 1;
|
|
1564
|
+
}
|
|
1565
|
+
break;
|
|
1566
|
+
}
|
|
1567
|
+
case "regex": {
|
|
1568
|
+
if (valibotAction.requirement.flags) handleError("RegExp flags are not supported by JSON Schema.", config);
|
|
1569
|
+
jsonSchema.pattern = valibotAction.requirement.source;
|
|
1570
|
+
break;
|
|
1571
|
+
}
|
|
1572
|
+
case "title": {
|
|
1573
|
+
jsonSchema.title = valibotAction.title;
|
|
1574
|
+
break;
|
|
1575
|
+
}
|
|
1576
|
+
case "url": {
|
|
1577
|
+
jsonSchema.format = "uri";
|
|
1578
|
+
break;
|
|
1579
|
+
}
|
|
1580
|
+
case "uuid": {
|
|
1581
|
+
jsonSchema.format = "uuid";
|
|
1582
|
+
break;
|
|
1583
|
+
}
|
|
1584
|
+
case "value": {
|
|
1585
|
+
jsonSchema.const = valibotAction.requirement;
|
|
1586
|
+
break;
|
|
1587
|
+
}
|
|
1588
|
+
default: handleError(
|
|
1589
|
+
// @ts-expect-error
|
|
1590
|
+
`The "${valibotAction.type}" action cannot be converted to JSON Schema.`,
|
|
1591
|
+
config
|
|
1592
|
+
);
|
|
1593
|
+
}
|
|
1594
|
+
return jsonSchema;
|
|
1595
|
+
}
|
|
1596
|
+
function convertSchema(jsonSchema, valibotSchema, config, context) {
|
|
1597
|
+
const referenceId = context.referenceMap.get(valibotSchema);
|
|
1598
|
+
if (referenceId && referenceId in context.definitions) {
|
|
1599
|
+
jsonSchema.$ref = `#/$defs/${referenceId}`;
|
|
1600
|
+
return jsonSchema;
|
|
1601
|
+
}
|
|
1602
|
+
if ("pipe" in valibotSchema) {
|
|
1603
|
+
for (let index = 0; index < valibotSchema.pipe.length; index++) {
|
|
1604
|
+
const valibotPipeItem = valibotSchema.pipe[index];
|
|
1605
|
+
if (valibotPipeItem.kind === "schema") {
|
|
1606
|
+
if (index > 0) handleError("A \"pipe\" with multiple schemas cannot be converted to JSON Schema.", config);
|
|
1607
|
+
const tempJsonSchema = convertSchema({}, valibotPipeItem, config, context);
|
|
1608
|
+
if (tempJsonSchema.$ref) {
|
|
1609
|
+
const referenceId2 = tempJsonSchema.$ref.split("/")[2];
|
|
1610
|
+
Object.assign(jsonSchema, context.definitions[referenceId2]);
|
|
1611
|
+
} else Object.assign(jsonSchema, tempJsonSchema);
|
|
1612
|
+
} else jsonSchema = convertAction(jsonSchema, valibotPipeItem, config);
|
|
1613
|
+
}
|
|
1614
|
+
return jsonSchema;
|
|
1615
|
+
}
|
|
1616
|
+
switch (valibotSchema.type) {
|
|
1617
|
+
case "boolean": {
|
|
1618
|
+
jsonSchema.type = "boolean";
|
|
1619
|
+
break;
|
|
1620
|
+
}
|
|
1621
|
+
case "null": {
|
|
1622
|
+
jsonSchema.type = "null";
|
|
1623
|
+
break;
|
|
1624
|
+
}
|
|
1625
|
+
case "number": {
|
|
1626
|
+
jsonSchema.type = "number";
|
|
1627
|
+
break;
|
|
1628
|
+
}
|
|
1629
|
+
case "string": {
|
|
1630
|
+
jsonSchema.type = "string";
|
|
1631
|
+
break;
|
|
1632
|
+
}
|
|
1633
|
+
case "array": {
|
|
1634
|
+
jsonSchema.type = "array";
|
|
1635
|
+
jsonSchema.items = convertSchema({}, valibotSchema.item, config, context);
|
|
1636
|
+
break;
|
|
1637
|
+
}
|
|
1638
|
+
case "tuple":
|
|
1639
|
+
case "tuple_with_rest":
|
|
1640
|
+
case "loose_tuple":
|
|
1641
|
+
case "strict_tuple": {
|
|
1642
|
+
jsonSchema.type = "array";
|
|
1643
|
+
jsonSchema.items = [];
|
|
1644
|
+
for (const item of valibotSchema.items) jsonSchema.items.push(convertSchema({}, item, config, context));
|
|
1645
|
+
if (valibotSchema.type === "tuple_with_rest") jsonSchema.additionalItems = convertSchema({}, valibotSchema.rest, config, context);
|
|
1646
|
+
else jsonSchema.additionalItems = valibotSchema.type === "loose_tuple";
|
|
1647
|
+
break;
|
|
1648
|
+
}
|
|
1649
|
+
case "object":
|
|
1650
|
+
case "object_with_rest":
|
|
1651
|
+
case "loose_object":
|
|
1652
|
+
case "strict_object": {
|
|
1653
|
+
jsonSchema.type = "object";
|
|
1654
|
+
jsonSchema.properties = {};
|
|
1655
|
+
jsonSchema.required = [];
|
|
1656
|
+
for (const key in valibotSchema.entries) {
|
|
1657
|
+
const entry = valibotSchema.entries[key];
|
|
1658
|
+
jsonSchema.properties[key] = convertSchema({}, entry, config, context);
|
|
1659
|
+
if (entry.type !== "nullish" && entry.type !== "optional") jsonSchema.required.push(key);
|
|
1660
|
+
}
|
|
1661
|
+
if (valibotSchema.type === "object_with_rest") jsonSchema.additionalProperties = convertSchema({}, valibotSchema.rest, config, context);
|
|
1662
|
+
else if (valibotSchema.type === "strict_object") jsonSchema.additionalProperties = false;
|
|
1663
|
+
break;
|
|
1664
|
+
}
|
|
1665
|
+
case "record": {
|
|
1666
|
+
if ("pipe" in valibotSchema.key) handleError("The \"record\" schema with a schema for the key that contains a \"pipe\" cannot be converted to JSON Schema.", config);
|
|
1667
|
+
if (valibotSchema.key.type !== "string") handleError(`The "record" schema with the "${valibotSchema.key.type}" schema for the key cannot be converted to JSON Schema.`, config);
|
|
1668
|
+
jsonSchema.type = "object";
|
|
1669
|
+
jsonSchema.additionalProperties = convertSchema({}, valibotSchema.value, config, context);
|
|
1670
|
+
break;
|
|
1671
|
+
}
|
|
1672
|
+
case "any":
|
|
1673
|
+
case "unknown": break;
|
|
1674
|
+
case "nullable":
|
|
1675
|
+
case "nullish": {
|
|
1676
|
+
jsonSchema.anyOf = [convertSchema({}, valibotSchema.wrapped, config, context), { type: "null" }];
|
|
1677
|
+
if (valibotSchema.default !== void 0) jsonSchema.default = getDefault(valibotSchema);
|
|
1678
|
+
break;
|
|
1679
|
+
}
|
|
1680
|
+
case "exact_optional":
|
|
1681
|
+
case "optional":
|
|
1682
|
+
case "undefinedable": {
|
|
1683
|
+
jsonSchema = convertSchema(jsonSchema, valibotSchema.wrapped, config, context);
|
|
1684
|
+
if (valibotSchema.default !== void 0) jsonSchema.default = getDefault(valibotSchema);
|
|
1685
|
+
break;
|
|
1686
|
+
}
|
|
1687
|
+
case "literal": {
|
|
1688
|
+
if (typeof valibotSchema.literal !== "boolean" && typeof valibotSchema.literal !== "number" && typeof valibotSchema.literal !== "string") handleError("The value of the \"literal\" schema is not JSON compatible.", config);
|
|
1689
|
+
jsonSchema.const = valibotSchema.literal;
|
|
1690
|
+
break;
|
|
1691
|
+
}
|
|
1692
|
+
case "enum": {
|
|
1693
|
+
jsonSchema.enum = valibotSchema.options;
|
|
1694
|
+
break;
|
|
1695
|
+
}
|
|
1696
|
+
case "picklist": {
|
|
1697
|
+
if (valibotSchema.options.some((option) => typeof option !== "number" && typeof option !== "string")) handleError("An option of the \"picklist\" schema is not JSON compatible.", config);
|
|
1698
|
+
jsonSchema.enum = valibotSchema.options;
|
|
1699
|
+
break;
|
|
1700
|
+
}
|
|
1701
|
+
case "union":
|
|
1702
|
+
case "variant": {
|
|
1703
|
+
jsonSchema.anyOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
|
|
1704
|
+
break;
|
|
1705
|
+
}
|
|
1706
|
+
case "intersect": {
|
|
1707
|
+
jsonSchema.allOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
|
|
1708
|
+
break;
|
|
1709
|
+
}
|
|
1710
|
+
case "lazy": {
|
|
1711
|
+
let wrappedValibotSchema = context.getterMap.get(valibotSchema.getter);
|
|
1712
|
+
if (!wrappedValibotSchema) {
|
|
1713
|
+
wrappedValibotSchema = valibotSchema.getter(void 0);
|
|
1714
|
+
context.getterMap.set(valibotSchema.getter, wrappedValibotSchema);
|
|
1715
|
+
}
|
|
1716
|
+
let referenceId2 = context.referenceMap.get(wrappedValibotSchema);
|
|
1717
|
+
if (!referenceId2) {
|
|
1718
|
+
referenceId2 = `${refCount++}`;
|
|
1719
|
+
context.referenceMap.set(wrappedValibotSchema, referenceId2);
|
|
1720
|
+
context.definitions[referenceId2] = convertSchema({}, wrappedValibotSchema, config, context);
|
|
1721
|
+
}
|
|
1722
|
+
jsonSchema.$ref = `#/$defs/${referenceId2}`;
|
|
1723
|
+
break;
|
|
1724
|
+
}
|
|
1725
|
+
default: handleError(
|
|
1726
|
+
// @ts-expect-error
|
|
1727
|
+
`The "${valibotSchema.type}" schema cannot be converted to JSON Schema.`,
|
|
1728
|
+
config
|
|
1729
|
+
);
|
|
1730
|
+
}
|
|
1731
|
+
return jsonSchema;
|
|
1732
|
+
}
|
|
1733
|
+
function toJsonSchema(schema, config) {
|
|
1734
|
+
const context = {
|
|
1735
|
+
definitions: {},
|
|
1736
|
+
referenceMap: /* @__PURE__ */ new Map(),
|
|
1737
|
+
getterMap: /* @__PURE__ */ new Map()
|
|
1738
|
+
};
|
|
1739
|
+
if (config?.definitions) {
|
|
1740
|
+
for (const key in config.definitions) context.referenceMap.set(config.definitions[key], key);
|
|
1741
|
+
for (const key in config.definitions) context.definitions[key] = convertSchema(
|
|
1742
|
+
{},
|
|
1743
|
+
// @ts-expect-error
|
|
1744
|
+
config.definitions[key],
|
|
1745
|
+
config,
|
|
1746
|
+
context
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1749
|
+
const jsonSchema = convertSchema(
|
|
1750
|
+
{ $schema: "http://json-schema.org/draft-07/schema#" },
|
|
1751
|
+
// @ts-expect-error
|
|
1752
|
+
schema,
|
|
1753
|
+
config,
|
|
1754
|
+
context
|
|
1755
|
+
);
|
|
1756
|
+
if (context.referenceMap.size) jsonSchema.$defs = context.definitions;
|
|
1757
|
+
return jsonSchema;
|
|
1758
|
+
}
|
|
1759
|
+
var refCount;
|
|
1760
|
+
var init_dist$1 = __esm({ "../../node_modules/.pnpm/@valibot+to-json-schema@1.0.0_valibot@1.0.0_typescript@5.8.3_/node_modules/@valibot/to-json-schema/dist/index.js"() {
|
|
1761
|
+
init_dist$2();
|
|
1762
|
+
refCount = 0;
|
|
1763
|
+
} });
|
|
1764
|
+
|
|
481
1765
|
//#endregion
|
|
482
1766
|
//#region src/utils/validator.ts
|
|
483
1767
|
function validateCliOptions(options) {
|
|
484
|
-
let parsed =
|
|
1768
|
+
let parsed = safeParse(CliOptionsSchema, options);
|
|
485
1769
|
return [parsed.output, parsed.issues?.map((issue) => {
|
|
486
1770
|
const option = issue.path?.map((pathItem) => pathItem.key).join(" ");
|
|
487
1771
|
return `Invalid value for option ${option}: ${issue.message}`;
|
|
@@ -489,7 +1773,7 @@ function validateCliOptions(options) {
|
|
|
489
1773
|
}
|
|
490
1774
|
function validateOption(key, options) {
|
|
491
1775
|
if (globalThis.process?.env?.ROLLDOWN_OPTIONS_VALIDATION === "loose") return;
|
|
492
|
-
let parsed =
|
|
1776
|
+
let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
493
1777
|
if (!parsed.success) {
|
|
494
1778
|
const errors = parsed.issues.map((issue) => {
|
|
495
1779
|
const issuePaths = issue.path.map((path$1) => path$1.key);
|
|
@@ -510,209 +1794,211 @@ function validateOption(key, options) {
|
|
|
510
1794
|
}
|
|
511
1795
|
}
|
|
512
1796
|
function getInputCliKeys() {
|
|
513
|
-
return
|
|
1797
|
+
return keyof(InputCliOptionsSchema).options;
|
|
514
1798
|
}
|
|
515
1799
|
function getOutputCliKeys() {
|
|
516
|
-
return
|
|
1800
|
+
return keyof(OutputCliOptionsSchema).options;
|
|
517
1801
|
}
|
|
518
1802
|
function getJsonSchema() {
|
|
519
1803
|
return toJsonSchema(CliOptionsSchema);
|
|
520
1804
|
}
|
|
521
1805
|
var StringOrRegExpSchema, LogLevelSchema, LogLevelOptionSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, InputOptionSchema, ExternalSchema, ModuleTypesSchema, JsxOptionsSchema, HelperModeSchema, DecoratorOptionSchema, HelpersSchema, RewriteImportExtensionsSchema, TypescriptSchema, AssumptionsSchema, TransformOptionsSchema, WatchOptionsSchema, ChecksOptionsSchema, MinifyOptionsSchema, ResolveOptionsSchema, TreeshakingOptionsSchema, OnLogSchema, OnwarnSchema, HmrSchema, InputOptionsSchema, InputCliOverrideSchema, InputCliOptionsSchema, ESTarget, ModuleFormatSchema, AddonFunctionSchema, ChunkFileNamesSchema, AssetFileNamesSchema, SanitizeFileNameSchema, GlobalsFunctionSchema, AdvancedChunksSchema, OutputOptionsSchema, getAddonDescription, OutputCliOverrideSchema, OutputCliOptionsSchema, CliOptionsSchema, inputHelperMsgRecord, outputHelperMsgRecord;
|
|
522
1806
|
var init_validator = __esm({ "src/utils/validator.ts"() {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
1807
|
+
init_dist$1();
|
|
1808
|
+
init_dist$2();
|
|
1809
|
+
StringOrRegExpSchema = union([string(), instance(RegExp)]);
|
|
1810
|
+
LogLevelSchema = union([
|
|
1811
|
+
literal("debug"),
|
|
1812
|
+
literal("info"),
|
|
1813
|
+
literal("warn")
|
|
528
1814
|
]);
|
|
529
|
-
LogLevelOptionSchema =
|
|
530
|
-
LogLevelWithErrorSchema =
|
|
531
|
-
RollupLogSchema =
|
|
532
|
-
RollupLogWithStringSchema =
|
|
533
|
-
InputOptionSchema =
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
1815
|
+
LogLevelOptionSchema = union([LogLevelSchema, literal("silent")]);
|
|
1816
|
+
LogLevelWithErrorSchema = union([LogLevelSchema, literal("error")]);
|
|
1817
|
+
RollupLogSchema = any();
|
|
1818
|
+
RollupLogWithStringSchema = union([RollupLogSchema, string()]);
|
|
1819
|
+
InputOptionSchema = union([
|
|
1820
|
+
string(),
|
|
1821
|
+
array(string()),
|
|
1822
|
+
record(string(), string())
|
|
537
1823
|
]);
|
|
538
|
-
ExternalSchema =
|
|
1824
|
+
ExternalSchema = union([
|
|
539
1825
|
StringOrRegExpSchema,
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
])),
|
|
1826
|
+
array(StringOrRegExpSchema),
|
|
1827
|
+
pipe(function_(), args(tuple([
|
|
1828
|
+
string(),
|
|
1829
|
+
optional(string()),
|
|
1830
|
+
boolean()
|
|
1831
|
+
])), returns(nullish(boolean())))
|
|
546
1832
|
]);
|
|
547
|
-
ModuleTypesSchema =
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
1833
|
+
ModuleTypesSchema = record(string(), union([
|
|
1834
|
+
literal("base64"),
|
|
1835
|
+
literal("binary"),
|
|
1836
|
+
literal("css"),
|
|
1837
|
+
literal("dataurl"),
|
|
1838
|
+
literal("empty"),
|
|
1839
|
+
literal("js"),
|
|
1840
|
+
literal("json"),
|
|
1841
|
+
literal("jsx"),
|
|
1842
|
+
literal("text"),
|
|
1843
|
+
literal("ts"),
|
|
1844
|
+
literal("tsx")
|
|
559
1845
|
]));
|
|
560
|
-
JsxOptionsSchema =
|
|
561
|
-
development:
|
|
562
|
-
factory:
|
|
563
|
-
fragment:
|
|
564
|
-
importSource:
|
|
565
|
-
jsxImportSource:
|
|
566
|
-
mode:
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
])),
|
|
571
|
-
refresh:
|
|
1846
|
+
JsxOptionsSchema = strictObject({
|
|
1847
|
+
development: pipe(optional(boolean()), description("Development specific information")),
|
|
1848
|
+
factory: pipe(optional(string()), description("Jsx element transformation")),
|
|
1849
|
+
fragment: pipe(optional(string()), description("Jsx fragment transformation")),
|
|
1850
|
+
importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
|
|
1851
|
+
jsxImportSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is automatic")),
|
|
1852
|
+
mode: pipe(optional(union([
|
|
1853
|
+
literal("classic"),
|
|
1854
|
+
literal("automatic"),
|
|
1855
|
+
literal("preserve")
|
|
1856
|
+
])), description("Jsx transformation mode")),
|
|
1857
|
+
refresh: pipe(optional(boolean()), description("React refresh transformation"))
|
|
572
1858
|
});
|
|
573
|
-
HelperModeSchema =
|
|
574
|
-
DecoratorOptionSchema =
|
|
575
|
-
legacy:
|
|
576
|
-
emitDecoratorMetadata:
|
|
1859
|
+
HelperModeSchema = union([literal("Runtime"), literal("External")]);
|
|
1860
|
+
DecoratorOptionSchema = object({
|
|
1861
|
+
legacy: optional(boolean()),
|
|
1862
|
+
emitDecoratorMetadata: optional(boolean())
|
|
577
1863
|
});
|
|
578
|
-
HelpersSchema =
|
|
579
|
-
RewriteImportExtensionsSchema =
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
1864
|
+
HelpersSchema = object({ mode: optional(HelperModeSchema) });
|
|
1865
|
+
RewriteImportExtensionsSchema = union([
|
|
1866
|
+
literal("rewrite"),
|
|
1867
|
+
literal("remove"),
|
|
1868
|
+
boolean()
|
|
583
1869
|
]);
|
|
584
|
-
TypescriptSchema =
|
|
585
|
-
jsxPragma:
|
|
586
|
-
jsxPragmaFrag:
|
|
587
|
-
onlyRemoveTypeImports:
|
|
588
|
-
allowNamespaces:
|
|
589
|
-
allowDeclareFields:
|
|
590
|
-
declaration:
|
|
591
|
-
stripInternal:
|
|
592
|
-
sourcemap:
|
|
1870
|
+
TypescriptSchema = object({
|
|
1871
|
+
jsxPragma: optional(string()),
|
|
1872
|
+
jsxPragmaFrag: optional(string()),
|
|
1873
|
+
onlyRemoveTypeImports: optional(boolean()),
|
|
1874
|
+
allowNamespaces: optional(boolean()),
|
|
1875
|
+
allowDeclareFields: optional(boolean()),
|
|
1876
|
+
declaration: optional(object({
|
|
1877
|
+
stripInternal: optional(boolean()),
|
|
1878
|
+
sourcemap: optional(boolean())
|
|
593
1879
|
})),
|
|
594
|
-
rewriteImportExtensions:
|
|
1880
|
+
rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
|
|
595
1881
|
});
|
|
596
|
-
AssumptionsSchema =
|
|
597
|
-
ignoreFunctionLength:
|
|
598
|
-
noDocumentAll:
|
|
599
|
-
objectRestNoSymbols:
|
|
600
|
-
pureGetters:
|
|
601
|
-
setPublicClassFields:
|
|
1882
|
+
AssumptionsSchema = object({
|
|
1883
|
+
ignoreFunctionLength: optional(boolean()),
|
|
1884
|
+
noDocumentAll: optional(boolean()),
|
|
1885
|
+
objectRestNoSymbols: optional(boolean()),
|
|
1886
|
+
pureGetters: optional(boolean()),
|
|
1887
|
+
setPublicClassFields: optional(boolean())
|
|
602
1888
|
});
|
|
603
|
-
TransformOptionsSchema =
|
|
604
|
-
assumptions:
|
|
605
|
-
typescript:
|
|
606
|
-
helpers:
|
|
607
|
-
decorators:
|
|
1889
|
+
TransformOptionsSchema = object({
|
|
1890
|
+
assumptions: optional(AssumptionsSchema),
|
|
1891
|
+
typescript: optional(TypescriptSchema),
|
|
1892
|
+
helpers: optional(HelpersSchema),
|
|
1893
|
+
decorators: optional(DecoratorOptionSchema)
|
|
608
1894
|
});
|
|
609
|
-
WatchOptionsSchema =
|
|
610
|
-
chokidar:
|
|
611
|
-
exclude:
|
|
612
|
-
include:
|
|
613
|
-
notify:
|
|
614
|
-
compareContents:
|
|
615
|
-
pollInterval:
|
|
616
|
-
})),
|
|
617
|
-
skipWrite:
|
|
618
|
-
buildDelay:
|
|
1895
|
+
WatchOptionsSchema = strictObject({
|
|
1896
|
+
chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
|
|
1897
|
+
exclude: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
|
|
1898
|
+
include: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
|
|
1899
|
+
notify: pipe(optional(strictObject({
|
|
1900
|
+
compareContents: optional(boolean()),
|
|
1901
|
+
pollInterval: optional(number())
|
|
1902
|
+
})), description("Notify options")),
|
|
1903
|
+
skipWrite: pipe(optional(boolean()), description("Skip the bundle.write() step")),
|
|
1904
|
+
buildDelay: pipe(optional(number()), description("Throttle watch rebuilds"))
|
|
619
1905
|
});
|
|
620
|
-
ChecksOptionsSchema =
|
|
621
|
-
circularDependency:
|
|
622
|
-
eval:
|
|
623
|
-
missingGlobalName:
|
|
624
|
-
missingNameOptionForIifeExport:
|
|
625
|
-
mixedExport:
|
|
626
|
-
unresolvedEntry:
|
|
627
|
-
unresolvedImport:
|
|
628
|
-
filenameConflict:
|
|
629
|
-
commonJsVariableInEsm:
|
|
630
|
-
importIsUndefined:
|
|
631
|
-
configurationFieldConflict:
|
|
1906
|
+
ChecksOptionsSchema = strictObject({
|
|
1907
|
+
circularDependency: pipe(optional(boolean()), description("Whether to emit warning when detecting circular dependency")),
|
|
1908
|
+
eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
|
|
1909
|
+
missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
|
|
1910
|
+
missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
|
|
1911
|
+
mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
|
|
1912
|
+
unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
|
|
1913
|
+
unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
|
|
1914
|
+
filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
|
|
1915
|
+
commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
|
|
1916
|
+
importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
|
|
1917
|
+
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
|
|
632
1918
|
});
|
|
633
|
-
MinifyOptionsSchema =
|
|
634
|
-
mangle:
|
|
635
|
-
compress:
|
|
636
|
-
removeWhitespace:
|
|
1919
|
+
MinifyOptionsSchema = strictObject({
|
|
1920
|
+
mangle: optional(boolean()),
|
|
1921
|
+
compress: optional(boolean()),
|
|
1922
|
+
removeWhitespace: optional(boolean())
|
|
637
1923
|
});
|
|
638
|
-
ResolveOptionsSchema =
|
|
639
|
-
alias:
|
|
640
|
-
aliasFields:
|
|
641
|
-
conditionNames:
|
|
642
|
-
extensionAlias:
|
|
643
|
-
exportsFields:
|
|
644
|
-
extensions:
|
|
645
|
-
mainFields:
|
|
646
|
-
mainFiles:
|
|
647
|
-
modules:
|
|
648
|
-
symlinks:
|
|
649
|
-
tsconfigFilename:
|
|
1924
|
+
ResolveOptionsSchema = strictObject({
|
|
1925
|
+
alias: optional(record(string(), union([string(), array(string())]))),
|
|
1926
|
+
aliasFields: optional(array(array(string()))),
|
|
1927
|
+
conditionNames: optional(array(string())),
|
|
1928
|
+
extensionAlias: optional(record(string(), array(string()))),
|
|
1929
|
+
exportsFields: optional(array(array(string()))),
|
|
1930
|
+
extensions: optional(array(string())),
|
|
1931
|
+
mainFields: optional(array(string())),
|
|
1932
|
+
mainFiles: optional(array(string())),
|
|
1933
|
+
modules: optional(array(string())),
|
|
1934
|
+
symlinks: optional(boolean()),
|
|
1935
|
+
tsconfigFilename: optional(string())
|
|
650
1936
|
});
|
|
651
|
-
TreeshakingOptionsSchema =
|
|
652
|
-
annotations:
|
|
653
|
-
manualPureFunctions:
|
|
654
|
-
unknownGlobalSideEffects:
|
|
1937
|
+
TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
1938
|
+
annotations: optional(boolean()),
|
|
1939
|
+
manualPureFunctions: optional(array(string())),
|
|
1940
|
+
unknownGlobalSideEffects: optional(boolean())
|
|
655
1941
|
})]);
|
|
656
|
-
OnLogSchema =
|
|
1942
|
+
OnLogSchema = pipe(function_(), args(tuple([
|
|
657
1943
|
LogLevelSchema,
|
|
658
1944
|
RollupLogSchema,
|
|
659
|
-
|
|
1945
|
+
pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
|
|
660
1946
|
])));
|
|
661
|
-
OnwarnSchema =
|
|
662
|
-
HmrSchema =
|
|
663
|
-
port:
|
|
664
|
-
host:
|
|
665
|
-
implement:
|
|
1947
|
+
OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
1948
|
+
HmrSchema = union([boolean(), strictObject({
|
|
1949
|
+
port: optional(number()),
|
|
1950
|
+
host: optional(string()),
|
|
1951
|
+
implement: optional(string())
|
|
666
1952
|
})]);
|
|
667
|
-
InputOptionsSchema =
|
|
668
|
-
input:
|
|
669
|
-
plugins:
|
|
670
|
-
external:
|
|
671
|
-
resolve:
|
|
672
|
-
cwd:
|
|
673
|
-
platform:
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
])),
|
|
678
|
-
shimMissingExports:
|
|
679
|
-
treeshake:
|
|
680
|
-
logLevel:
|
|
681
|
-
onLog:
|
|
682
|
-
onwarn:
|
|
683
|
-
moduleTypes:
|
|
684
|
-
experimental:
|
|
685
|
-
disableLiveBindings:
|
|
686
|
-
enableComposingJsPlugins:
|
|
687
|
-
resolveNewUrlToAsset:
|
|
688
|
-
strictExecutionOrder:
|
|
689
|
-
hmr:
|
|
1953
|
+
InputOptionsSchema = strictObject({
|
|
1954
|
+
input: optional(InputOptionSchema),
|
|
1955
|
+
plugins: optional(custom(() => true)),
|
|
1956
|
+
external: optional(ExternalSchema),
|
|
1957
|
+
resolve: optional(ResolveOptionsSchema),
|
|
1958
|
+
cwd: pipe(optional(string()), description("Current working directory")),
|
|
1959
|
+
platform: pipe(optional(union([
|
|
1960
|
+
literal("browser"),
|
|
1961
|
+
literal("neutral"),
|
|
1962
|
+
literal("node")
|
|
1963
|
+
])), description(`Platform for which the code should be generated (node, ${colors.underline("browser")}, neutral)`)),
|
|
1964
|
+
shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
|
|
1965
|
+
treeshake: optional(TreeshakingOptionsSchema),
|
|
1966
|
+
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${colors.dim("silent")}, ${colors.underline(colors.gray("info"))}, debug, ${colors.yellow("warn")})`)),
|
|
1967
|
+
onLog: optional(OnLogSchema),
|
|
1968
|
+
onwarn: optional(OnwarnSchema),
|
|
1969
|
+
moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
|
|
1970
|
+
experimental: optional(strictObject({
|
|
1971
|
+
disableLiveBindings: optional(boolean()),
|
|
1972
|
+
enableComposingJsPlugins: optional(boolean()),
|
|
1973
|
+
resolveNewUrlToAsset: optional(boolean()),
|
|
1974
|
+
strictExecutionOrder: optional(boolean()),
|
|
1975
|
+
hmr: optional(HmrSchema)
|
|
690
1976
|
})),
|
|
691
|
-
define:
|
|
692
|
-
inject:
|
|
693
|
-
profilerNames:
|
|
694
|
-
jsx:
|
|
695
|
-
|
|
1977
|
+
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
1978
|
+
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
1979
|
+
profilerNames: optional(boolean()),
|
|
1980
|
+
jsx: optional(union([
|
|
1981
|
+
boolean(),
|
|
696
1982
|
JsxOptionsSchema,
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
1983
|
+
string("react"),
|
|
1984
|
+
string("react-jsx"),
|
|
1985
|
+
string("preserve")
|
|
700
1986
|
])),
|
|
701
|
-
transform:
|
|
702
|
-
watch:
|
|
703
|
-
dropLabels:
|
|
704
|
-
checks:
|
|
705
|
-
keepNames:
|
|
706
|
-
debug:
|
|
1987
|
+
transform: optional(TransformOptionsSchema),
|
|
1988
|
+
watch: optional(union([WatchOptionsSchema, literal(false)])),
|
|
1989
|
+
dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
|
|
1990
|
+
checks: optional(ChecksOptionsSchema),
|
|
1991
|
+
keepNames: pipe(optional(boolean()), description("Keep function/class name")),
|
|
1992
|
+
debug: pipe(optional(object({ sessionId: pipe(optional(string()), description("Used to name the build.")) })), description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly."))
|
|
707
1993
|
});
|
|
708
|
-
InputCliOverrideSchema =
|
|
709
|
-
input:
|
|
710
|
-
external:
|
|
711
|
-
inject:
|
|
712
|
-
treeshake:
|
|
713
|
-
jsx:
|
|
1994
|
+
InputCliOverrideSchema = strictObject({
|
|
1995
|
+
input: pipe(optional(array(string())), description("Entry file")),
|
|
1996
|
+
external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
1997
|
+
inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
|
|
1998
|
+
treeshake: pipe(optional(boolean()), description("enable treeshaking")),
|
|
1999
|
+
jsx: pipe(optional(JsxOptionsSchema), description("enable jsx"))
|
|
714
2000
|
});
|
|
715
|
-
InputCliOptionsSchema =
|
|
2001
|
+
InputCliOptionsSchema = omit(strictObject({
|
|
716
2002
|
...InputOptionsSchema.entries,
|
|
717
2003
|
...InputCliOverrideSchema.entries
|
|
718
2004
|
}), [
|
|
@@ -739,87 +2025,87 @@ var init_validator = __esm({ "src/utils/validator.ts"() {
|
|
|
739
2025
|
ESTarget$1["ESNext"] = "esnext";
|
|
740
2026
|
return ESTarget$1;
|
|
741
2027
|
}(ESTarget || {});
|
|
742
|
-
ModuleFormatSchema =
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
2028
|
+
ModuleFormatSchema = union([
|
|
2029
|
+
literal("es"),
|
|
2030
|
+
literal("cjs"),
|
|
2031
|
+
literal("esm"),
|
|
2032
|
+
literal("module"),
|
|
2033
|
+
literal("commonjs"),
|
|
2034
|
+
literal("iife"),
|
|
2035
|
+
literal("umd")
|
|
750
2036
|
]);
|
|
751
|
-
AddonFunctionSchema =
|
|
752
|
-
ChunkFileNamesSchema =
|
|
753
|
-
AssetFileNamesSchema =
|
|
754
|
-
SanitizeFileNameSchema =
|
|
755
|
-
GlobalsFunctionSchema =
|
|
756
|
-
AdvancedChunksSchema =
|
|
757
|
-
minSize:
|
|
758
|
-
maxSize:
|
|
759
|
-
minModuleSize:
|
|
760
|
-
maxModuleSize:
|
|
761
|
-
minShareCount:
|
|
762
|
-
groups:
|
|
763
|
-
name:
|
|
764
|
-
test:
|
|
765
|
-
priority:
|
|
766
|
-
minSize:
|
|
767
|
-
minShareCount:
|
|
768
|
-
maxSize:
|
|
769
|
-
minModuleSize:
|
|
770
|
-
maxModuleSize:
|
|
2037
|
+
AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
|
|
2038
|
+
ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2039
|
+
AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2040
|
+
SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
|
|
2041
|
+
GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2042
|
+
AdvancedChunksSchema = strictObject({
|
|
2043
|
+
minSize: optional(number()),
|
|
2044
|
+
maxSize: optional(number()),
|
|
2045
|
+
minModuleSize: optional(number()),
|
|
2046
|
+
maxModuleSize: optional(number()),
|
|
2047
|
+
minShareCount: optional(number()),
|
|
2048
|
+
groups: optional(array(strictObject({
|
|
2049
|
+
name: string(),
|
|
2050
|
+
test: optional(union([string(), instance(RegExp)])),
|
|
2051
|
+
priority: optional(number()),
|
|
2052
|
+
minSize: optional(number()),
|
|
2053
|
+
minShareCount: optional(number()),
|
|
2054
|
+
maxSize: optional(number()),
|
|
2055
|
+
minModuleSize: optional(number()),
|
|
2056
|
+
maxModuleSize: optional(number())
|
|
771
2057
|
})))
|
|
772
2058
|
});
|
|
773
|
-
OutputOptionsSchema =
|
|
774
|
-
dir:
|
|
775
|
-
file:
|
|
776
|
-
exports:
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
])),
|
|
782
|
-
hashCharacters:
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
])),
|
|
787
|
-
format:
|
|
788
|
-
sourcemap:
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
])),
|
|
793
|
-
sourcemapDebugIds:
|
|
794
|
-
sourcemapIgnoreList:
|
|
795
|
-
sourcemapPathTransform:
|
|
796
|
-
banner:
|
|
797
|
-
footer:
|
|
798
|
-
intro:
|
|
799
|
-
outro:
|
|
800
|
-
extend:
|
|
801
|
-
esModule:
|
|
802
|
-
assetFileNames:
|
|
803
|
-
entryFileNames:
|
|
804
|
-
chunkFileNames:
|
|
805
|
-
cssEntryFileNames:
|
|
806
|
-
cssChunkFileNames:
|
|
807
|
-
sanitizeFileName:
|
|
808
|
-
minify:
|
|
809
|
-
|
|
810
|
-
|
|
2059
|
+
OutputOptionsSchema = strictObject({
|
|
2060
|
+
dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
|
|
2061
|
+
file: pipe(optional(string()), description("Single output file")),
|
|
2062
|
+
exports: pipe(optional(union([
|
|
2063
|
+
literal("auto"),
|
|
2064
|
+
literal("named"),
|
|
2065
|
+
literal("default"),
|
|
2066
|
+
literal("none")
|
|
2067
|
+
])), description(`Specify a export mode (${colors.underline("auto")}, named, default, none)`)),
|
|
2068
|
+
hashCharacters: pipe(optional(union([
|
|
2069
|
+
literal("base64"),
|
|
2070
|
+
literal("base36"),
|
|
2071
|
+
literal("hex")
|
|
2072
|
+
])), description("Use the specified character set for file hashes")),
|
|
2073
|
+
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${colors.underline("esm")}, cjs, and iife)`)),
|
|
2074
|
+
sourcemap: pipe(optional(union([
|
|
2075
|
+
boolean(),
|
|
2076
|
+
literal("inline"),
|
|
2077
|
+
literal("hidden")
|
|
2078
|
+
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${colors.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2079
|
+
sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
|
|
2080
|
+
sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
|
|
2081
|
+
sourcemapPathTransform: optional(custom(() => true)),
|
|
2082
|
+
banner: optional(union([string(), AddonFunctionSchema])),
|
|
2083
|
+
footer: optional(union([string(), AddonFunctionSchema])),
|
|
2084
|
+
intro: optional(union([string(), AddonFunctionSchema])),
|
|
2085
|
+
outro: optional(union([string(), AddonFunctionSchema])),
|
|
2086
|
+
extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
|
|
2087
|
+
esModule: optional(union([boolean(), literal("if-default-prop")])),
|
|
2088
|
+
assetFileNames: optional(AssetFileNamesSchema),
|
|
2089
|
+
entryFileNames: optional(ChunkFileNamesSchema),
|
|
2090
|
+
chunkFileNames: optional(ChunkFileNamesSchema),
|
|
2091
|
+
cssEntryFileNames: optional(ChunkFileNamesSchema),
|
|
2092
|
+
cssChunkFileNames: optional(ChunkFileNamesSchema),
|
|
2093
|
+
sanitizeFileName: optional(SanitizeFileNameSchema),
|
|
2094
|
+
minify: pipe(optional(union([
|
|
2095
|
+
boolean(),
|
|
2096
|
+
string("dce-only"),
|
|
811
2097
|
MinifyOptionsSchema
|
|
812
|
-
])),
|
|
813
|
-
name:
|
|
814
|
-
globals:
|
|
815
|
-
externalLiveBindings:
|
|
816
|
-
inlineDynamicImports:
|
|
817
|
-
advancedChunks:
|
|
818
|
-
comments:
|
|
819
|
-
plugins:
|
|
820
|
-
polyfillRequire:
|
|
821
|
-
target:
|
|
822
|
-
hoistTransitiveImports:
|
|
2098
|
+
])), description("Minify the bundled file")),
|
|
2099
|
+
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
2100
|
+
globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2101
|
+
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2102
|
+
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
2103
|
+
advancedChunks: optional(AdvancedChunksSchema),
|
|
2104
|
+
comments: pipe(optional(union([literal("none"), literal("preserve-legal")])), description("Control comments in the output")),
|
|
2105
|
+
plugins: optional(custom(() => true)),
|
|
2106
|
+
polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
|
|
2107
|
+
target: pipe(optional(enum_(ESTarget)), description("The JavaScript target environment")),
|
|
2108
|
+
hoistTransitiveImports: optional(custom((input) => {
|
|
823
2109
|
if (input) return false;
|
|
824
2110
|
return true;
|
|
825
2111
|
}, () => `The 'true' value is not supported`))
|
|
@@ -827,26 +2113,26 @@ var init_validator = __esm({ "src/utils/validator.ts"() {
|
|
|
827
2113
|
getAddonDescription = (placement, wrapper) => {
|
|
828
2114
|
return `Code to insert the ${colors.bold(placement)} of the bundled file (${colors.bold(wrapper)} the wrapper function)`;
|
|
829
2115
|
};
|
|
830
|
-
OutputCliOverrideSchema =
|
|
831
|
-
assetFileNames:
|
|
832
|
-
entryFileNames:
|
|
833
|
-
chunkFileNames:
|
|
834
|
-
cssEntryFileNames:
|
|
835
|
-
cssChunkFileNames:
|
|
836
|
-
sanitizeFileName:
|
|
837
|
-
banner:
|
|
838
|
-
footer:
|
|
839
|
-
intro:
|
|
840
|
-
outro:
|
|
841
|
-
esModule:
|
|
842
|
-
globals:
|
|
843
|
-
advancedChunks:
|
|
844
|
-
minSize:
|
|
845
|
-
minShareCount:
|
|
846
|
-
})),
|
|
847
|
-
minify:
|
|
2116
|
+
OutputCliOverrideSchema = strictObject({
|
|
2117
|
+
assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
|
|
2118
|
+
entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
|
|
2119
|
+
chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
|
|
2120
|
+
cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
|
|
2121
|
+
cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
|
|
2122
|
+
sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
|
|
2123
|
+
banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
|
|
2124
|
+
footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
|
|
2125
|
+
intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
|
|
2126
|
+
outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
|
|
2127
|
+
esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
|
|
2128
|
+
globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2129
|
+
advancedChunks: pipe(optional(strictObject({
|
|
2130
|
+
minSize: pipe(optional(number()), description("Minimum size of the chunk")),
|
|
2131
|
+
minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
|
|
2132
|
+
})), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2133
|
+
minify: pipe(optional(boolean()), description("Minify the bundled file"))
|
|
848
2134
|
});
|
|
849
|
-
OutputCliOptionsSchema =
|
|
2135
|
+
OutputCliOptionsSchema = omit(strictObject({
|
|
850
2136
|
...OutputOptionsSchema.entries,
|
|
851
2137
|
...OutputCliOverrideSchema.entries
|
|
852
2138
|
}), [
|
|
@@ -855,11 +2141,11 @@ var init_validator = __esm({ "src/utils/validator.ts"() {
|
|
|
855
2141
|
"plugins",
|
|
856
2142
|
"hoistTransitiveImports"
|
|
857
2143
|
]);
|
|
858
|
-
CliOptionsSchema =
|
|
859
|
-
config:
|
|
860
|
-
help:
|
|
861
|
-
version:
|
|
862
|
-
watch:
|
|
2144
|
+
CliOptionsSchema = strictObject({
|
|
2145
|
+
config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
|
|
2146
|
+
help: pipe(optional(boolean()), description("Show help")),
|
|
2147
|
+
version: pipe(optional(boolean()), description("Show version number")),
|
|
2148
|
+
watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
|
|
863
2149
|
...InputCliOptionsSchema.entries,
|
|
864
2150
|
...OutputCliOptionsSchema.entries
|
|
865
2151
|
});
|
|
@@ -1007,9 +2293,9 @@ var init_transform_side_effects = __esm({ "src/utils/transform-side-effects.ts"(
|
|
|
1007
2293
|
|
|
1008
2294
|
//#endregion
|
|
1009
2295
|
//#region src/utils/transform-sourcemap.ts
|
|
1010
|
-
function isEmptySourcemapFiled(array) {
|
|
1011
|
-
if (!array) return true;
|
|
1012
|
-
if (array.length === 0 || !array[0]) return true;
|
|
2296
|
+
function isEmptySourcemapFiled(array$1) {
|
|
2297
|
+
if (!array$1) return true;
|
|
2298
|
+
if (array$1.length === 0 || !array$1[0]) return true;
|
|
1013
2299
|
return false;
|
|
1014
2300
|
}
|
|
1015
2301
|
function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
|
|
@@ -2234,19 +3520,20 @@ var init_dist = __esm({ "../../node_modules/.pnpm/remeda@2.21.2/node_modules/rem
|
|
|
2234
3520
|
//#endregion
|
|
2235
3521
|
//#region src/plugin/bindingify-hook-filter.ts
|
|
2236
3522
|
function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
|
|
2237
|
-
if (typeof matcher === "string" || matcher instanceof RegExp) return [include(
|
|
2238
|
-
if (Array.isArray(matcher)) return matcher.map((m$10) => include(
|
|
2239
|
-
if (matcher.custom) return matcher.custom;
|
|
3523
|
+
if (typeof matcher === "string" || matcher instanceof RegExp) return [include(generateAtomMatcher(stringKind, matcher))];
|
|
3524
|
+
if (Array.isArray(matcher)) return matcher.map((m$10) => include(generateAtomMatcher(stringKind, m$10)));
|
|
2240
3525
|
let ret = [];
|
|
2241
|
-
|
|
2242
|
-
if (matcher.
|
|
2243
|
-
if (matcher.include) ret.push(...arraify(matcher.include).map((m$10) => include(isCode ? code(m$10) : id(m$10))));
|
|
3526
|
+
if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m$10) => exclude(generateAtomMatcher(stringKind, m$10))));
|
|
3527
|
+
if (matcher.include) ret.push(...arraify(matcher.include).map((m$10) => include(generateAtomMatcher(stringKind, m$10))));
|
|
2244
3528
|
return ret;
|
|
2245
3529
|
}
|
|
3530
|
+
function generateAtomMatcher(kind, matcher) {
|
|
3531
|
+
return kind === "code" ? code(matcher) : id(matcher);
|
|
3532
|
+
}
|
|
2246
3533
|
function transformFilterMatcherToFilterExprs(filterOption) {
|
|
2247
3534
|
if (!filterOption) return void 0;
|
|
2248
|
-
|
|
2249
|
-
|
|
3535
|
+
if (Array.isArray(filterOption)) return filterOption;
|
|
3536
|
+
const { id: id$1, code: code$1, moduleType: moduleType$1 } = filterOption;
|
|
2250
3537
|
let ret = [];
|
|
2251
3538
|
let idIncludes = [];
|
|
2252
3539
|
let idExcludes = [];
|
|
@@ -2256,33 +3543,21 @@ function transformFilterMatcherToFilterExprs(filterOption) {
|
|
|
2256
3543
|
if (code$1) [codeIncludes, codeExcludes] = d$3(generalHookFilterMatcherToFilterExprs(code$1, "code") ?? [], (m$10) => m$10.kind === "include");
|
|
2257
3544
|
ret.push(...idExcludes);
|
|
2258
3545
|
ret.push(...codeExcludes);
|
|
2259
|
-
let
|
|
3546
|
+
let andExprList = [];
|
|
2260
3547
|
if (moduleType$1) {
|
|
2261
3548
|
let moduleTypes = Array.isArray(moduleType$1) ? moduleType$1 : moduleType$1.include ?? [];
|
|
2262
|
-
|
|
2263
|
-
}
|
|
2264
|
-
if (idIncludes.length) {
|
|
2265
|
-
let joinedOrExpr = joinFilterExprsWithOr(idIncludes.map((item) => item.expr));
|
|
2266
|
-
if (!cursor) cursor = joinedOrExpr;
|
|
2267
|
-
else cursor = and(cursor, joinedOrExpr);
|
|
2268
|
-
}
|
|
2269
|
-
if (codeIncludes.length) {
|
|
2270
|
-
let joinedOrExpr = joinFilterExprsWithOr(codeIncludes.map((item) => item.expr));
|
|
2271
|
-
if (!cursor) cursor = joinedOrExpr;
|
|
2272
|
-
else cursor = and(cursor, joinedOrExpr);
|
|
3549
|
+
andExprList.push(or(...moduleTypes.map((m$10) => moduleType(m$10))));
|
|
2273
3550
|
}
|
|
2274
|
-
if (
|
|
3551
|
+
if (idIncludes.length) andExprList.push(or(...idIncludes.map((item) => item.expr)));
|
|
3552
|
+
if (codeIncludes.length) andExprList.push(or(...codeIncludes.map((item) => item.expr)));
|
|
3553
|
+
if (andExprList.length) ret.push(include(and(...andExprList)));
|
|
2275
3554
|
return ret;
|
|
2276
3555
|
}
|
|
2277
|
-
function
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
let filterExprs = generalHookFilterMatcherToFilterExprs(matcher, stringKind);
|
|
2283
|
-
let custom = [];
|
|
2284
|
-
if (filterExprs) custom = filterExprs.map(bindingifyFilterExpr);
|
|
2285
|
-
return { custom: custom.length > 0 ? custom : void 0 };
|
|
3556
|
+
function bindingifyGeneralHookFilter(stringKind, pattern) {
|
|
3557
|
+
let filterExprs = generalHookFilterMatcherToFilterExprs(pattern, stringKind);
|
|
3558
|
+
let ret = [];
|
|
3559
|
+
if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
|
|
3560
|
+
return ret.length > 0 ? { value: ret } : void 0;
|
|
2286
3561
|
}
|
|
2287
3562
|
function bindingifyFilterExpr(expr) {
|
|
2288
3563
|
let list = [];
|
|
@@ -2292,9 +3567,21 @@ function bindingifyFilterExpr(expr) {
|
|
|
2292
3567
|
function bindingifyFilterExprImpl(expr, list) {
|
|
2293
3568
|
switch (expr.kind) {
|
|
2294
3569
|
case "and": {
|
|
2295
|
-
|
|
2296
|
-
bindingifyFilterExprImpl(
|
|
2297
|
-
list.push({
|
|
3570
|
+
let args$1 = expr.args;
|
|
3571
|
+
for (let i$22 = args$1.length - 1; i$22 >= 0; i$22--) bindingifyFilterExprImpl(args$1[i$22], list);
|
|
3572
|
+
list.push({
|
|
3573
|
+
kind: "And",
|
|
3574
|
+
payload: args$1.length
|
|
3575
|
+
});
|
|
3576
|
+
break;
|
|
3577
|
+
}
|
|
3578
|
+
case "or": {
|
|
3579
|
+
let args$1 = expr.args;
|
|
3580
|
+
for (let i$22 = args$1.length - 1; i$22 >= 0; i$22--) bindingifyFilterExprImpl(args$1[i$22], list);
|
|
3581
|
+
list.push({
|
|
3582
|
+
kind: "Or",
|
|
3583
|
+
payload: args$1.length
|
|
3584
|
+
});
|
|
2298
3585
|
break;
|
|
2299
3586
|
}
|
|
2300
3587
|
case "not": {
|
|
@@ -2305,21 +3592,21 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2305
3592
|
case "id": {
|
|
2306
3593
|
list.push({
|
|
2307
3594
|
kind: "Id",
|
|
2308
|
-
|
|
3595
|
+
payload: expr.pattern
|
|
2309
3596
|
});
|
|
2310
3597
|
break;
|
|
2311
3598
|
}
|
|
2312
3599
|
case "moduleType": {
|
|
2313
3600
|
list.push({
|
|
2314
3601
|
kind: "ModuleType",
|
|
2315
|
-
|
|
3602
|
+
payload: expr.pattern
|
|
2316
3603
|
});
|
|
2317
3604
|
break;
|
|
2318
3605
|
}
|
|
2319
3606
|
case "code": {
|
|
2320
3607
|
list.push({
|
|
2321
3608
|
kind: "Code",
|
|
2322
|
-
|
|
3609
|
+
payload: expr.pattern
|
|
2323
3610
|
});
|
|
2324
3611
|
break;
|
|
2325
3612
|
}
|
|
@@ -2333,31 +3620,34 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2333
3620
|
list.push({ kind: "Exclude" });
|
|
2334
3621
|
break;
|
|
2335
3622
|
}
|
|
2336
|
-
default: throw new Error(`Unknown filter expression
|
|
3623
|
+
default: throw new Error(`Unknown filter expression: ${expr}`);
|
|
2337
3624
|
}
|
|
2338
3625
|
}
|
|
2339
3626
|
function bindingifyResolveIdFilter(filterOption) {
|
|
2340
|
-
|
|
3627
|
+
if (!filterOption) return void 0;
|
|
3628
|
+
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
3629
|
+
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
|
2341
3630
|
}
|
|
2342
3631
|
function bindingifyLoadFilter(filterOption) {
|
|
2343
|
-
|
|
3632
|
+
if (!filterOption) return void 0;
|
|
3633
|
+
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
3634
|
+
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
|
2344
3635
|
}
|
|
2345
3636
|
function bindingifyTransformFilter(filterOption) {
|
|
2346
3637
|
if (!filterOption) return void 0;
|
|
2347
|
-
let
|
|
3638
|
+
let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
|
|
2348
3639
|
let ret = [];
|
|
2349
|
-
if (
|
|
2350
|
-
return {
|
|
3640
|
+
if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
|
|
3641
|
+
return { value: ret.length > 0 ? ret : void 0 };
|
|
2351
3642
|
}
|
|
2352
3643
|
function bindingifyRenderChunkFilter(filterOption) {
|
|
2353
|
-
if (filterOption)
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
}
|
|
3644
|
+
if (!filterOption) return void 0;
|
|
3645
|
+
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
3646
|
+
return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
|
|
2357
3647
|
}
|
|
2358
3648
|
var init_bindingify_hook_filter = __esm({ "src/plugin/bindingify-hook-filter.ts"() {
|
|
2359
3649
|
init_dist();
|
|
2360
|
-
|
|
3650
|
+
init_filter_index();
|
|
2361
3651
|
init_misc();
|
|
2362
3652
|
} });
|
|
2363
3653
|
|
|
@@ -2423,10 +3713,10 @@ var init_plugin_context = __esm({ "src/plugin/plugin-context.ts"() {
|
|
|
2423
3713
|
async function createLoadModulePromise(context, data) {
|
|
2424
3714
|
const loadPromise = data.loadModulePromiseMap.get(id$1);
|
|
2425
3715
|
if (loadPromise) return loadPromise;
|
|
2426
|
-
const promise = new Promise((resolve, _) => {
|
|
3716
|
+
const promise$1 = new Promise((resolve, _) => {
|
|
2427
3717
|
data.loadModulePromiseResolveFnMap.set(id$1, resolve);
|
|
2428
3718
|
});
|
|
2429
|
-
data.loadModulePromiseMap.set(id$1, promise);
|
|
3719
|
+
data.loadModulePromiseMap.set(id$1, promise$1);
|
|
2430
3720
|
try {
|
|
2431
3721
|
await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
|
|
2432
3722
|
} catch (e$5) {
|
|
@@ -2434,7 +3724,7 @@ var init_plugin_context = __esm({ "src/plugin/plugin-context.ts"() {
|
|
|
2434
3724
|
data.loadModulePromiseResolveFnMap.delete(id$1);
|
|
2435
3725
|
throw e$5;
|
|
2436
3726
|
}
|
|
2437
|
-
return promise;
|
|
3727
|
+
return promise$1;
|
|
2438
3728
|
}
|
|
2439
3729
|
await createLoadModulePromise(this.context, this.data);
|
|
2440
3730
|
return this.data.getModuleInfo(id$1, this.context);
|
|
@@ -2528,41 +3818,41 @@ var init_transform_plugin_context = __esm({ "src/plugin/transform-plugin-context
|
|
|
2528
3818
|
|
|
2529
3819
|
//#endregion
|
|
2530
3820
|
//#region src/plugin/bindingify-build-hooks.ts
|
|
2531
|
-
function bindingifyBuildStart(args) {
|
|
2532
|
-
const hook = args.plugin.buildStart;
|
|
3821
|
+
function bindingifyBuildStart(args$1) {
|
|
3822
|
+
const hook = args$1.plugin.buildStart;
|
|
2533
3823
|
if (!hook) return {};
|
|
2534
3824
|
const { handler, meta } = normalizeHook(hook);
|
|
2535
3825
|
return {
|
|
2536
3826
|
plugin: async (ctx, opts) => {
|
|
2537
|
-
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedInputOptionsImpl(opts, args.onLog));
|
|
3827
|
+
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), new NormalizedInputOptionsImpl(opts, args$1.onLog));
|
|
2538
3828
|
},
|
|
2539
3829
|
meta: bindingifyPluginHookMeta(meta)
|
|
2540
3830
|
};
|
|
2541
3831
|
}
|
|
2542
|
-
function bindingifyBuildEnd(args) {
|
|
2543
|
-
const hook = args.plugin.buildEnd;
|
|
3832
|
+
function bindingifyBuildEnd(args$1) {
|
|
3833
|
+
const hook = args$1.plugin.buildEnd;
|
|
2544
3834
|
if (!hook) return {};
|
|
2545
3835
|
const { handler, meta } = normalizeHook(hook);
|
|
2546
3836
|
return {
|
|
2547
3837
|
plugin: async (ctx, err) => {
|
|
2548
|
-
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), err ? normalizeErrors(err) : void 0);
|
|
3838
|
+
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), err ? normalizeErrors(err) : void 0);
|
|
2549
3839
|
},
|
|
2550
3840
|
meta: bindingifyPluginHookMeta(meta)
|
|
2551
3841
|
};
|
|
2552
3842
|
}
|
|
2553
|
-
function bindingifyResolveId(args) {
|
|
2554
|
-
const hook = args.plugin.resolveId;
|
|
3843
|
+
function bindingifyResolveId(args$1) {
|
|
3844
|
+
const hook = args$1.plugin.resolveId;
|
|
2555
3845
|
if (!hook) return {};
|
|
2556
3846
|
const { handler, meta, options } = normalizeHook(hook);
|
|
2557
3847
|
return {
|
|
2558
3848
|
plugin: async (ctx, specifier, importer, extraOptions) => {
|
|
2559
|
-
const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
|
|
3849
|
+
const contextResolveOptions = extraOptions.custom != null ? args$1.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
|
|
2560
3850
|
const newExtraOptions = {
|
|
2561
3851
|
...extraOptions,
|
|
2562
3852
|
custom: contextResolveOptions?.custom,
|
|
2563
3853
|
[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
|
|
2564
3854
|
};
|
|
2565
|
-
const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0, newExtraOptions);
|
|
3855
|
+
const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), specifier, importer ?? void 0, newExtraOptions);
|
|
2566
3856
|
if (ret == null) return;
|
|
2567
3857
|
if (ret === false) return {
|
|
2568
3858
|
id: specifier,
|
|
@@ -2573,7 +3863,7 @@ function bindingifyResolveId(args) {
|
|
|
2573
3863
|
id: ret,
|
|
2574
3864
|
normalizeExternalId: true
|
|
2575
3865
|
};
|
|
2576
|
-
let exist = args.pluginContextData.updateModuleOption(ret.id, {
|
|
3866
|
+
let exist = args$1.pluginContextData.updateModuleOption(ret.id, {
|
|
2577
3867
|
meta: ret.meta || {},
|
|
2578
3868
|
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
2579
3869
|
invalidate: false
|
|
@@ -2589,13 +3879,13 @@ function bindingifyResolveId(args) {
|
|
|
2589
3879
|
filter: bindingifyResolveIdFilter(options.filter)
|
|
2590
3880
|
};
|
|
2591
3881
|
}
|
|
2592
|
-
function bindingifyResolveDynamicImport(args) {
|
|
2593
|
-
const hook = args.plugin.resolveDynamicImport;
|
|
3882
|
+
function bindingifyResolveDynamicImport(args$1) {
|
|
3883
|
+
const hook = args$1.plugin.resolveDynamicImport;
|
|
2594
3884
|
if (!hook) return {};
|
|
2595
3885
|
const { handler, meta } = normalizeHook(hook);
|
|
2596
3886
|
return {
|
|
2597
3887
|
plugin: async (ctx, specifier, importer) => {
|
|
2598
|
-
const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), specifier, importer ?? void 0);
|
|
3888
|
+
const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), specifier, importer ?? void 0);
|
|
2599
3889
|
if (ret == null) return;
|
|
2600
3890
|
if (ret === false) return {
|
|
2601
3891
|
id: specifier,
|
|
@@ -2607,7 +3897,7 @@ function bindingifyResolveDynamicImport(args) {
|
|
|
2607
3897
|
external: ret.external
|
|
2608
3898
|
};
|
|
2609
3899
|
if (ret.moduleSideEffects !== null) result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
|
|
2610
|
-
args.pluginContextData.updateModuleOption(ret.id, {
|
|
3900
|
+
args$1.pluginContextData.updateModuleOption(ret.id, {
|
|
2611
3901
|
meta: ret.meta || {},
|
|
2612
3902
|
moduleSideEffects: ret.moduleSideEffects || null,
|
|
2613
3903
|
invalidate: false
|
|
@@ -2617,16 +3907,16 @@ function bindingifyResolveDynamicImport(args) {
|
|
|
2617
3907
|
meta: bindingifyPluginHookMeta(meta)
|
|
2618
3908
|
};
|
|
2619
3909
|
}
|
|
2620
|
-
function bindingifyTransform(args) {
|
|
2621
|
-
const hook = args.plugin.transform;
|
|
3910
|
+
function bindingifyTransform(args$1) {
|
|
3911
|
+
const hook = args$1.plugin.transform;
|
|
2622
3912
|
if (!hook) return {};
|
|
2623
3913
|
const { handler, meta, options } = normalizeHook(hook);
|
|
2624
3914
|
return {
|
|
2625
3915
|
plugin: async (ctx, code$1, id$1, meta$1) => {
|
|
2626
|
-
const ret = await handler.call(new TransformPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id$1, code$1, args.onLog, args.logLevel, args.watchMode), code$1, id$1, meta$1);
|
|
3916
|
+
const ret = await handler.call(new TransformPluginContextImpl(args$1.outputOptions, ctx.inner(), args$1.plugin, args$1.pluginContextData, ctx, id$1, code$1, args$1.onLog, args$1.logLevel, args$1.watchMode), code$1, id$1, meta$1);
|
|
2627
3917
|
if (ret == null) return void 0;
|
|
2628
3918
|
if (typeof ret === "string") return { code: ret };
|
|
2629
|
-
let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
|
|
3919
|
+
let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
|
|
2630
3920
|
meta: ret.meta ?? {},
|
|
2631
3921
|
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
2632
3922
|
invalidate: false
|
|
@@ -2642,16 +3932,16 @@ function bindingifyTransform(args) {
|
|
|
2642
3932
|
filter: bindingifyTransformFilter(options.filter)
|
|
2643
3933
|
};
|
|
2644
3934
|
}
|
|
2645
|
-
function bindingifyLoad(args) {
|
|
2646
|
-
const hook = args.plugin.load;
|
|
3935
|
+
function bindingifyLoad(args$1) {
|
|
3936
|
+
const hook = args$1.plugin.load;
|
|
2647
3937
|
if (!hook) return {};
|
|
2648
3938
|
const { handler, meta, options } = normalizeHook(hook);
|
|
2649
3939
|
return {
|
|
2650
3940
|
plugin: async (ctx, id$1) => {
|
|
2651
|
-
const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode, id$1), id$1);
|
|
3941
|
+
const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode, id$1), id$1);
|
|
2652
3942
|
if (ret == null) return;
|
|
2653
3943
|
if (typeof ret === "string") return { code: ret };
|
|
2654
|
-
let moduleOption = args.pluginContextData.updateModuleOption(id$1, {
|
|
3944
|
+
let moduleOption = args$1.pluginContextData.updateModuleOption(id$1, {
|
|
2655
3945
|
meta: ret.meta || {},
|
|
2656
3946
|
moduleSideEffects: ret.moduleSideEffects ?? null,
|
|
2657
3947
|
invalidate: false
|
|
@@ -2678,13 +3968,13 @@ function preProcessSourceMap(ret, id$1) {
|
|
|
2678
3968
|
}
|
|
2679
3969
|
return map;
|
|
2680
3970
|
}
|
|
2681
|
-
function bindingifyModuleParsed(args) {
|
|
2682
|
-
const hook = args.plugin.moduleParsed;
|
|
3971
|
+
function bindingifyModuleParsed(args$1) {
|
|
3972
|
+
const hook = args$1.plugin.moduleParsed;
|
|
2683
3973
|
if (!hook) return {};
|
|
2684
3974
|
const { handler, meta } = normalizeHook(hook);
|
|
2685
3975
|
return {
|
|
2686
3976
|
plugin: async (ctx, moduleInfo) => {
|
|
2687
|
-
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
|
|
3977
|
+
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformModuleInfo(moduleInfo, args$1.pluginContextData.getModuleOption(moduleInfo.id)));
|
|
2688
3978
|
},
|
|
2689
3979
|
meta: bindingifyPluginHookMeta(meta)
|
|
2690
3980
|
};
|
|
@@ -3115,25 +4405,25 @@ var init_transform_to_rollup_output = __esm({ "src/utils/transform-to-rollup-out
|
|
|
3115
4405
|
|
|
3116
4406
|
//#endregion
|
|
3117
4407
|
//#region src/plugin/bindingify-output-hooks.ts
|
|
3118
|
-
function bindingifyRenderStart(args) {
|
|
3119
|
-
const hook = args.plugin.renderStart;
|
|
4408
|
+
function bindingifyRenderStart(args$1) {
|
|
4409
|
+
const hook = args$1.plugin.renderStart;
|
|
3120
4410
|
if (!hook) return {};
|
|
3121
4411
|
const { handler, meta } = normalizeHook(hook);
|
|
3122
4412
|
return {
|
|
3123
4413
|
plugin: async (ctx, opts) => {
|
|
3124
|
-
handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), new NormalizedInputOptionsImpl(opts, args.onLog));
|
|
4414
|
+
handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), new NormalizedOutputOptionsImpl(opts, args$1.outputOptions, args$1.normalizedOutputPlugins), new NormalizedInputOptionsImpl(opts, args$1.onLog));
|
|
3125
4415
|
},
|
|
3126
4416
|
meta: bindingifyPluginHookMeta(meta)
|
|
3127
4417
|
};
|
|
3128
4418
|
}
|
|
3129
|
-
function bindingifyRenderChunk(args) {
|
|
3130
|
-
const hook = args.plugin.renderChunk;
|
|
4419
|
+
function bindingifyRenderChunk(args$1) {
|
|
4420
|
+
const hook = args$1.plugin.renderChunk;
|
|
3131
4421
|
if (!hook) return {};
|
|
3132
4422
|
const { handler, meta, options } = normalizeHook(hook);
|
|
3133
4423
|
return {
|
|
3134
4424
|
plugin: async (ctx, code$1, chunk, opts, meta$1) => {
|
|
3135
|
-
if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
|
|
3136
|
-
const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), code$1, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), args.pluginContextData.getRenderChunkMeta());
|
|
4425
|
+
if (args$1.pluginContextData.getRenderChunkMeta() == null) args$1.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta$1.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
|
|
4426
|
+
const ret = await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), code$1, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args$1.outputOptions, args$1.normalizedOutputPlugins), args$1.pluginContextData.getRenderChunkMeta());
|
|
3137
4427
|
if (ret == null) return;
|
|
3138
4428
|
if (typeof ret === "string") return { code: ret };
|
|
3139
4429
|
if (!ret.map) return { code: ret.code };
|
|
@@ -3146,30 +4436,30 @@ function bindingifyRenderChunk(args) {
|
|
|
3146
4436
|
filter: bindingifyRenderChunkFilter(options.filter)
|
|
3147
4437
|
};
|
|
3148
4438
|
}
|
|
3149
|
-
function bindingifyAugmentChunkHash(args) {
|
|
3150
|
-
const hook = args.plugin.augmentChunkHash;
|
|
4439
|
+
function bindingifyAugmentChunkHash(args$1) {
|
|
4440
|
+
const hook = args$1.plugin.augmentChunkHash;
|
|
3151
4441
|
if (!hook) return {};
|
|
3152
4442
|
const { handler, meta } = normalizeHook(hook);
|
|
3153
4443
|
return {
|
|
3154
4444
|
plugin: async (ctx, chunk) => {
|
|
3155
|
-
return await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
|
|
4445
|
+
return await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
|
|
3156
4446
|
},
|
|
3157
4447
|
meta: bindingifyPluginHookMeta(meta)
|
|
3158
4448
|
};
|
|
3159
4449
|
}
|
|
3160
|
-
function bindingifyRenderError(args) {
|
|
3161
|
-
const hook = args.plugin.renderError;
|
|
4450
|
+
function bindingifyRenderError(args$1) {
|
|
4451
|
+
const hook = args$1.plugin.renderError;
|
|
3162
4452
|
if (!hook) return {};
|
|
3163
4453
|
const { handler, meta } = normalizeHook(hook);
|
|
3164
4454
|
return {
|
|
3165
4455
|
plugin: async (ctx, err) => {
|
|
3166
|
-
handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), normalizeErrors(err));
|
|
4456
|
+
handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), normalizeErrors(err));
|
|
3167
4457
|
},
|
|
3168
4458
|
meta: bindingifyPluginHookMeta(meta)
|
|
3169
4459
|
};
|
|
3170
4460
|
}
|
|
3171
|
-
function bindingifyGenerateBundle(args) {
|
|
3172
|
-
const hook = args.plugin.generateBundle;
|
|
4461
|
+
function bindingifyGenerateBundle(args$1) {
|
|
4462
|
+
const hook = args$1.plugin.generateBundle;
|
|
3173
4463
|
if (!hook) return {};
|
|
3174
4464
|
const { handler, meta } = normalizeHook(hook);
|
|
3175
4465
|
return {
|
|
@@ -3179,14 +4469,14 @@ function bindingifyGenerateBundle(args) {
|
|
|
3179
4469
|
deleted: new Set()
|
|
3180
4470
|
};
|
|
3181
4471
|
const output = transformToOutputBundle(bundle, changed);
|
|
3182
|
-
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output, isWrite);
|
|
4472
|
+
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), new NormalizedOutputOptionsImpl(opts, args$1.outputOptions, args$1.normalizedOutputPlugins), output, isWrite);
|
|
3183
4473
|
return collectChangedBundle(changed, output);
|
|
3184
4474
|
},
|
|
3185
4475
|
meta: bindingifyPluginHookMeta(meta)
|
|
3186
4476
|
};
|
|
3187
4477
|
}
|
|
3188
|
-
function bindingifyWriteBundle(args) {
|
|
3189
|
-
const hook = args.plugin.writeBundle;
|
|
4478
|
+
function bindingifyWriteBundle(args$1) {
|
|
4479
|
+
const hook = args$1.plugin.writeBundle;
|
|
3190
4480
|
if (!hook) return {};
|
|
3191
4481
|
const { handler, meta } = normalizeHook(hook);
|
|
3192
4482
|
return {
|
|
@@ -3196,67 +4486,67 @@ function bindingifyWriteBundle(args) {
|
|
|
3196
4486
|
deleted: new Set()
|
|
3197
4487
|
};
|
|
3198
4488
|
const output = transformToOutputBundle(bundle, changed);
|
|
3199
|
-
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output);
|
|
4489
|
+
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), new NormalizedOutputOptionsImpl(opts, args$1.outputOptions, args$1.normalizedOutputPlugins), output);
|
|
3200
4490
|
return collectChangedBundle(changed, output);
|
|
3201
4491
|
},
|
|
3202
4492
|
meta: bindingifyPluginHookMeta(meta)
|
|
3203
4493
|
};
|
|
3204
4494
|
}
|
|
3205
|
-
function bindingifyCloseBundle(args) {
|
|
3206
|
-
const hook = args.plugin.closeBundle;
|
|
4495
|
+
function bindingifyCloseBundle(args$1) {
|
|
4496
|
+
const hook = args$1.plugin.closeBundle;
|
|
3207
4497
|
if (!hook) return {};
|
|
3208
4498
|
const { handler, meta } = normalizeHook(hook);
|
|
3209
4499
|
return {
|
|
3210
4500
|
plugin: async (ctx) => {
|
|
3211
|
-
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
|
|
4501
|
+
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode));
|
|
3212
4502
|
},
|
|
3213
4503
|
meta: bindingifyPluginHookMeta(meta)
|
|
3214
4504
|
};
|
|
3215
4505
|
}
|
|
3216
|
-
function bindingifyBanner(args) {
|
|
3217
|
-
const hook = args.plugin.banner;
|
|
4506
|
+
function bindingifyBanner(args$1) {
|
|
4507
|
+
const hook = args$1.plugin.banner;
|
|
3218
4508
|
if (!hook) return {};
|
|
3219
4509
|
const { handler, meta } = normalizeHook(hook);
|
|
3220
4510
|
return {
|
|
3221
4511
|
plugin: async (ctx, chunk) => {
|
|
3222
4512
|
if (typeof handler === "string") return handler;
|
|
3223
|
-
return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
|
|
4513
|
+
return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
|
|
3224
4514
|
},
|
|
3225
4515
|
meta: bindingifyPluginHookMeta(meta)
|
|
3226
4516
|
};
|
|
3227
4517
|
}
|
|
3228
|
-
function bindingifyFooter(args) {
|
|
3229
|
-
const hook = args.plugin.footer;
|
|
4518
|
+
function bindingifyFooter(args$1) {
|
|
4519
|
+
const hook = args$1.plugin.footer;
|
|
3230
4520
|
if (!hook) return {};
|
|
3231
4521
|
const { handler, meta } = normalizeHook(hook);
|
|
3232
4522
|
return {
|
|
3233
4523
|
plugin: async (ctx, chunk) => {
|
|
3234
4524
|
if (typeof handler === "string") return handler;
|
|
3235
|
-
return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
|
|
4525
|
+
return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
|
|
3236
4526
|
},
|
|
3237
4527
|
meta: bindingifyPluginHookMeta(meta)
|
|
3238
4528
|
};
|
|
3239
4529
|
}
|
|
3240
|
-
function bindingifyIntro(args) {
|
|
3241
|
-
const hook = args.plugin.intro;
|
|
4530
|
+
function bindingifyIntro(args$1) {
|
|
4531
|
+
const hook = args$1.plugin.intro;
|
|
3242
4532
|
if (!hook) return {};
|
|
3243
4533
|
const { handler, meta } = normalizeHook(hook);
|
|
3244
4534
|
return {
|
|
3245
4535
|
plugin: async (ctx, chunk) => {
|
|
3246
4536
|
if (typeof handler === "string") return handler;
|
|
3247
|
-
return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
|
|
4537
|
+
return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
|
|
3248
4538
|
},
|
|
3249
4539
|
meta: bindingifyPluginHookMeta(meta)
|
|
3250
4540
|
};
|
|
3251
4541
|
}
|
|
3252
|
-
function bindingifyOutro(args) {
|
|
3253
|
-
const hook = args.plugin.outro;
|
|
4542
|
+
function bindingifyOutro(args$1) {
|
|
4543
|
+
const hook = args$1.plugin.outro;
|
|
3254
4544
|
if (!hook) return {};
|
|
3255
4545
|
const { handler, meta } = normalizeHook(hook);
|
|
3256
4546
|
return {
|
|
3257
4547
|
plugin: async (ctx, chunk) => {
|
|
3258
4548
|
if (typeof handler === "string") return handler;
|
|
3259
|
-
return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
|
|
4549
|
+
return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
|
|
3260
4550
|
},
|
|
3261
4551
|
meta: bindingifyPluginHookMeta(meta)
|
|
3262
4552
|
};
|
|
@@ -3276,24 +4566,24 @@ var init_bindingify_output_hooks = __esm({ "src/plugin/bindingify-output-hooks.t
|
|
|
3276
4566
|
|
|
3277
4567
|
//#endregion
|
|
3278
4568
|
//#region src/plugin/bindingify-watch-hooks.ts
|
|
3279
|
-
function bindingifyWatchChange(args) {
|
|
3280
|
-
const hook = args.plugin.watchChange;
|
|
4569
|
+
function bindingifyWatchChange(args$1) {
|
|
4570
|
+
const hook = args$1.plugin.watchChange;
|
|
3281
4571
|
if (!hook) return {};
|
|
3282
4572
|
const { handler, meta } = normalizeHook(hook);
|
|
3283
4573
|
return {
|
|
3284
4574
|
plugin: async (ctx, id$1, event) => {
|
|
3285
|
-
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id$1, { event });
|
|
4575
|
+
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), id$1, { event });
|
|
3286
4576
|
},
|
|
3287
4577
|
meta: bindingifyPluginHookMeta(meta)
|
|
3288
4578
|
};
|
|
3289
4579
|
}
|
|
3290
|
-
function bindingifyCloseWatcher(args) {
|
|
3291
|
-
const hook = args.plugin.closeWatcher;
|
|
4580
|
+
function bindingifyCloseWatcher(args$1) {
|
|
4581
|
+
const hook = args$1.plugin.closeWatcher;
|
|
3292
4582
|
if (!hook) return {};
|
|
3293
4583
|
const { handler, meta } = normalizeHook(hook);
|
|
3294
4584
|
return {
|
|
3295
4585
|
plugin: async (ctx) => {
|
|
3296
|
-
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
|
|
4586
|
+
await handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode));
|
|
3297
4587
|
},
|
|
3298
4588
|
meta: bindingifyPluginHookMeta(meta)
|
|
3299
4589
|
};
|
|
@@ -3371,7 +4661,7 @@ var init_hook_usage = __esm({ "src/plugin/generated/hook-usage.ts"() {
|
|
|
3371
4661
|
//#endregion
|
|
3372
4662
|
//#region src/plugin/bindingify-plugin.ts
|
|
3373
4663
|
function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
3374
|
-
const args = {
|
|
4664
|
+
const args$1 = {
|
|
3375
4665
|
plugin,
|
|
3376
4666
|
options,
|
|
3377
4667
|
outputOptions,
|
|
@@ -3381,26 +4671,26 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
3381
4671
|
watchMode,
|
|
3382
4672
|
normalizedOutputPlugins
|
|
3383
4673
|
};
|
|
3384
|
-
const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
|
|
3385
|
-
const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
|
|
3386
|
-
const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args);
|
|
3387
|
-
const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args);
|
|
3388
|
-
const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
|
|
3389
|
-
const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
|
|
3390
|
-
const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
|
|
3391
|
-
const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
|
|
3392
|
-
const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
|
|
3393
|
-
const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
|
|
3394
|
-
const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
|
|
3395
|
-
const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
|
|
3396
|
-
const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
|
|
3397
|
-
const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
|
|
3398
|
-
const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args);
|
|
3399
|
-
const { plugin: footer, meta: footerMeta } = bindingifyFooter(args);
|
|
3400
|
-
const { plugin: intro, meta: introMeta } = bindingifyIntro(args);
|
|
3401
|
-
const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
|
|
3402
|
-
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
|
|
3403
|
-
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
|
|
4674
|
+
const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args$1);
|
|
4675
|
+
const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args$1);
|
|
4676
|
+
const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args$1);
|
|
4677
|
+
const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args$1);
|
|
4678
|
+
const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args$1);
|
|
4679
|
+
const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args$1);
|
|
4680
|
+
const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args$1);
|
|
4681
|
+
const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args$1);
|
|
4682
|
+
const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args$1);
|
|
4683
|
+
const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args$1);
|
|
4684
|
+
const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args$1);
|
|
4685
|
+
const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args$1);
|
|
4686
|
+
const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args$1);
|
|
4687
|
+
const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args$1);
|
|
4688
|
+
const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args$1);
|
|
4689
|
+
const { plugin: footer, meta: footerMeta } = bindingifyFooter(args$1);
|
|
4690
|
+
const { plugin: intro, meta: introMeta } = bindingifyIntro(args$1);
|
|
4691
|
+
const { plugin: outro, meta: outroMeta } = bindingifyOutro(args$1);
|
|
4692
|
+
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args$1);
|
|
4693
|
+
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args$1);
|
|
3404
4694
|
let hookUsage = extractHookUsage(plugin).inner();
|
|
3405
4695
|
const result = {
|
|
3406
4696
|
name: plugin.name,
|
|
@@ -3476,13 +4766,13 @@ function wrapHandlers(plugin) {
|
|
|
3476
4766
|
"closeWatcher"
|
|
3477
4767
|
]) {
|
|
3478
4768
|
const handler = plugin[hookName];
|
|
3479
|
-
if (handler) plugin[hookName] = async (...args) => {
|
|
4769
|
+
if (handler) plugin[hookName] = async (...args$1) => {
|
|
3480
4770
|
try {
|
|
3481
|
-
return await handler(...args);
|
|
4771
|
+
return await handler(...args$1);
|
|
3482
4772
|
} catch (e$5) {
|
|
3483
4773
|
return error(logPluginError(e$5, plugin.name, {
|
|
3484
4774
|
hook: hookName,
|
|
3485
|
-
id: hookName === "transform" ? args[2] : void 0
|
|
4775
|
+
id: hookName === "transform" ? args$1[2] : void 0
|
|
3486
4776
|
}));
|
|
3487
4777
|
}
|
|
3488
4778
|
};
|
|
@@ -3546,13 +4836,13 @@ var init_plugin_context_data = __esm({ "src/plugin/plugin-context-data.ts"() {
|
|
|
3546
4836
|
get() {
|
|
3547
4837
|
return moduleSideEffects;
|
|
3548
4838
|
},
|
|
3549
|
-
set: (v
|
|
4839
|
+
set: (v) => {
|
|
3550
4840
|
this.updateModuleOption(id$1, {
|
|
3551
|
-
moduleSideEffects: v
|
|
4841
|
+
moduleSideEffects: v,
|
|
3552
4842
|
meta: info.meta,
|
|
3553
4843
|
invalidate: true
|
|
3554
4844
|
});
|
|
3555
|
-
moduleSideEffects = v
|
|
4845
|
+
moduleSideEffects = v;
|
|
3556
4846
|
}
|
|
3557
4847
|
});
|
|
3558
4848
|
return info;
|
|
@@ -3804,8 +5094,8 @@ var init_bindingify_input_options = __esm({ "src/utils/bindingify-input-options.
|
|
|
3804
5094
|
//#endregion
|
|
3805
5095
|
//#region src/utils/plugin/index.ts
|
|
3806
5096
|
var isPluginHookName;
|
|
3807
|
-
var init_plugin
|
|
3808
|
-
init_plugin$
|
|
5097
|
+
var init_plugin = __esm({ "src/utils/plugin/index.ts"() {
|
|
5098
|
+
init_plugin$1();
|
|
3809
5099
|
isPluginHookName = function() {
|
|
3810
5100
|
const PLUGIN_HOOK_NAMES_SET = new Set(ENUMERATED_PLUGIN_HOOK_NAMES);
|
|
3811
5101
|
return function isPluginHookName$1(hookName) {
|
|
@@ -4115,7 +5405,7 @@ var init_compose_js_plugins = __esm({ "src/utils/compose-js-plugins.ts"() {
|
|
|
4115
5405
|
init_plugin_context$1();
|
|
4116
5406
|
init_misc();
|
|
4117
5407
|
init_normalize_hook();
|
|
4118
|
-
init_plugin
|
|
5408
|
+
init_plugin();
|
|
4119
5409
|
unsupportedHookName = [
|
|
4120
5410
|
"augmentChunkHash",
|
|
4121
5411
|
"generateBundle",
|
|
@@ -4295,6 +5585,9 @@ var init_rolldown_build = __esm({ "src/api/rolldown/rolldown-build.ts"() {
|
|
|
4295
5585
|
async generateHmrPatch(changedFiles) {
|
|
4296
5586
|
return this.#bundler?.bundler.generateHmrPatch(changedFiles);
|
|
4297
5587
|
}
|
|
5588
|
+
async hmrInvalidate(file, firstInvalidatedBy) {
|
|
5589
|
+
return this.#bundler?.bundler.hmrInvalidate(file, firstInvalidatedBy);
|
|
5590
|
+
}
|
|
4298
5591
|
get watchFiles() {
|
|
4299
5592
|
return this.#bundler?.bundler.watchFiles ?? [];
|
|
4300
5593
|
}
|
|
@@ -4474,55 +5767,6 @@ var init_watch = __esm({ "src/api/watch/index.ts"() {
|
|
|
4474
5767
|
};
|
|
4475
5768
|
} });
|
|
4476
5769
|
|
|
4477
|
-
//#endregion
|
|
4478
|
-
//#region src/plugin/with-filter.ts
|
|
4479
|
-
function withFilterImpl(pluginOption, filterObjectList) {
|
|
4480
|
-
if (isPromiseLike(pluginOption)) return pluginOption.then((p$3) => withFilter(p$3, filterObjectList));
|
|
4481
|
-
if (pluginOption == false || pluginOption == null) return pluginOption;
|
|
4482
|
-
if (Array.isArray(pluginOption)) return pluginOption.map((p$3) => withFilter(p$3, filterObjectList));
|
|
4483
|
-
let plugin = pluginOption;
|
|
4484
|
-
let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
|
|
4485
|
-
if (filterObjectIndex === -1) return plugin;
|
|
4486
|
-
let filterObject = filterObjectList[filterObjectIndex];
|
|
4487
|
-
Object.keys(plugin).forEach((key) => {
|
|
4488
|
-
switch (key) {
|
|
4489
|
-
case "transform":
|
|
4490
|
-
case "resolveId":
|
|
4491
|
-
case "load":
|
|
4492
|
-
if (!plugin[key]) return;
|
|
4493
|
-
if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
|
|
4494
|
-
else plugin[key] = {
|
|
4495
|
-
handler: plugin[key],
|
|
4496
|
-
filter: filterObject[key]
|
|
4497
|
-
};
|
|
4498
|
-
break;
|
|
4499
|
-
default: break;
|
|
4500
|
-
}
|
|
4501
|
-
});
|
|
4502
|
-
return plugin;
|
|
4503
|
-
}
|
|
4504
|
-
function withFilter(pluginOption, filterObject) {
|
|
4505
|
-
return withFilterImpl(pluginOption, arraify(filterObject));
|
|
4506
|
-
}
|
|
4507
|
-
function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
|
|
4508
|
-
if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
|
|
4509
|
-
for (let i$22 = 0; i$22 < overrideFilterObjectList.length; i$22++) for (let j$1 = 0; j$1 < (overrideFilterObjectList[i$22].pluginNamePattern ?? []).length; j$1++) {
|
|
4510
|
-
let pattern = overrideFilterObjectList[i$22].pluginNamePattern[j$1];
|
|
4511
|
-
if (typeof pattern === "string" && pattern === pluginName) return i$22;
|
|
4512
|
-
else if (pattern instanceof RegExp && pattern.test(pluginName)) return i$22;
|
|
4513
|
-
}
|
|
4514
|
-
return -1;
|
|
4515
|
-
}
|
|
4516
|
-
var init_with_filter = __esm({ "src/plugin/with-filter.ts"() {
|
|
4517
|
-
init_misc();
|
|
4518
|
-
} });
|
|
4519
|
-
|
|
4520
|
-
//#endregion
|
|
4521
|
-
//#region src/plugin/index.ts
|
|
4522
|
-
var init_plugin = __esm({ "src/plugin/index.ts"() {
|
|
4523
|
-
init_with_filter();
|
|
4524
|
-
} });
|
|
4525
|
-
|
|
4526
5770
|
//#endregion
|
|
4527
5771
|
//#region src/utils/define-config.ts
|
|
4528
5772
|
function defineConfig(config) {
|
|
@@ -4537,10 +5781,9 @@ var init_src = __esm({ "src/index.ts"() {
|
|
|
4537
5781
|
init_build();
|
|
4538
5782
|
init_rolldown();
|
|
4539
5783
|
init_watch();
|
|
4540
|
-
init_plugin();
|
|
4541
5784
|
init_define_config();
|
|
4542
5785
|
VERSION = version;
|
|
4543
5786
|
} });
|
|
4544
5787
|
|
|
4545
5788
|
//#endregion
|
|
4546
|
-
export { BuiltinPlugin, PluginContextData, VERSION,
|
|
5789
|
+
export { BuiltinPlugin, PluginContextData, VERSION, bindingifyPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundler, defineConfig, description$1 as description, dynamicImportVarsPlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, init_bindingify_plugin, init_compose_js_plugins, init_constructors, init_create_bundler, init_normalize_string_or_regex, init_plugin_context_data, init_rolldown, init_src, init_transform_to_rollup_output, init_validator, init_watch, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reportPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch };
|