@golemui/schemas 1.5.1 → 1.6.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli.js CHANGED
@@ -1,69 +1,217 @@
1
1
  #!/usr/bin/env node
2
- import { existsSync as u, mkdirSync as w, writeFileSync as v } from "node:fs";
3
- import { resolve as y, join as h, relative as x, dirname as j } from "node:path";
4
- import { createInterface as S } from "node:readline/promises";
5
- import { pathToFileURL as P } from "node:url";
6
- import { g as T } from "./generate-implementation-schemas-DxCUi0Jr.js";
7
- const E = "../src/lib/form.editor.schema.json", _ = [{ kind: "layout", type: "flex", uid: "#root", props: { direction: "column", gap: 16 }, children: [{ kind: "input", type: "__IMPLEMENTATION__-input", uid: "email", path: "email", label: "Email address", validator: { type: "string", required: !0, format: "email" }, props: { placeholder: "you@example.com" } }] }], I = {
8
- $schema: E,
9
- form: _
10
- }, q = "https://json-schema.org/draft/2020-12/schema", z = "__ID_BASE__components/example-input.schema.json", A = "STARTER TEMPLATE, owned by you. One component schema per widget type. Copy this file for each widget, then list it in schemas.config.mjs. The pattern to keep: allOf the baseWidget, `kind` and `type` consts, one `$defs` entry per prop, a `.state` suffixed pattern for every suffixable key, `additionalProperties: false` inside `props`, and `unevaluatedProperties: false` at the root.", M = "__IMPLEMENTATION__ example input widget", O = "object", k = { labelDef: { $ref: "../core/common.schema.json#/$defs/localizable" }, disabledDef: { $ref: "../core/common.schema.json#/$defs/boolOrWhen" }, readonlyDef: { $ref: "../core/common.schema.json#/$defs/boolOrWhen" }, hintProp: { type: "string" }, placeholderProp: { type: "string" }, maxlengthProp: { type: "number" } }, L = [{ $ref: "../core/common.schema.json#/$defs/baseWidget" }], N = { kind: { const: "input" }, type: { const: "__IMPLEMENTATION__-input" }, path: { $ref: "../core/common.schema.json#/$defs/dotPath" }, label: { $ref: "#/$defs/labelDef" }, disabled: { $ref: "#/$defs/disabledDef" }, readonly: { $ref: "#/$defs/readonlyDef" }, on: { $ref: "../core/common.schema.json#/$defs/on" }, validator: { $ref: "../validators.schema.json#/$defs/validator" }, defaultValue: { type: "string" }, props: { type: "object", properties: { hint: { $ref: "#/$defs/hintProp" }, placeholder: { $ref: "#/$defs/placeholderProp" }, maxlength: { $ref: "#/$defs/maxlengthProp" } }, patternProperties: { "^hint\\.[^.]+$": { $ref: "#/$defs/hintProp" }, "^placeholder\\.[^.]+$": { $ref: "#/$defs/placeholderProp" }, "^maxlength\\.[^.]+$": { $ref: "#/$defs/maxlengthProp" } }, additionalProperties: !1 } }, R = { "^label\\.[^.]+$": { $ref: "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { $ref: "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { $ref: "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { $ref: "../validators.schema.json#/$defs/validator" } }, C = ["kind", "type", "path"], V = !1, U = {
11
- $schema: q,
12
- $id: z,
13
- $comment: A,
14
- title: M,
15
- type: O,
16
- $defs: k,
17
- allOf: L,
18
- properties: N,
19
- patternProperties: R,
20
- required: C,
21
- unevaluatedProperties: V
22
- }, W = "https://json-schema.org/draft/2020-12/schema", D = "__ID_BASE__components/flex.schema.json", F = "STARTER TEMPLATE, owned by you. `flex` is a reserved widget type: keep the name and the `children` array, change the props to match your layout widget.", B = "__IMPLEMENTATION__ flex widget", J = "object", Y = { directionProp: { enum: ["row", "row-reverse", "column", "column-reverse"] }, justifyProp: { enum: ["start", "center", "end", "stretch", "space-between", "space-around"] }, alignProp: { enum: ["start", "center", "end", "stretch", "baseline"] }, wrapProp: { type: "boolean" }, gapProp: { type: "number" }, paddingProp: { type: "number" } }, G = [{ $ref: "../core/common.schema.json#/$defs/baseWidget" }], H = { kind: { const: "layout" }, type: { const: "flex" }, children: { type: "array", minItems: 1, items: { $ref: "../widgets.schema.json#/$defs/formWidget" } }, props: { type: "object", properties: { direction: { $ref: "#/$defs/directionProp" }, justify: { $ref: "#/$defs/justifyProp" }, align: { $ref: "#/$defs/alignProp" }, wrap: { $ref: "#/$defs/wrapProp" }, gap: { $ref: "#/$defs/gapProp" }, padding: { $ref: "#/$defs/paddingProp" } }, patternProperties: { "^direction\\.[^.]+$": { $ref: "#/$defs/directionProp" }, "^justify\\.[^.]+$": { $ref: "#/$defs/justifyProp" }, "^align\\.[^.]+$": { $ref: "#/$defs/alignProp" }, "^wrap\\.[^.]+$": { $ref: "#/$defs/wrapProp" }, "^gap\\.[^.]+$": { $ref: "#/$defs/gapProp" }, "^padding\\.[^.]+$": { $ref: "#/$defs/paddingProp" } }, additionalProperties: !1 } }, K = ["kind", "type", "children"], Z = !1, Q = {
23
- $schema: W,
24
- $id: D,
25
- $comment: F,
26
- title: B,
27
- type: J,
28
- $defs: Y,
29
- allOf: G,
30
- properties: H,
31
- required: K,
32
- unevaluatedProperties: Z
33
- }, X = "https://json-schema.org/draft/2020-12/schema", ee = "__ID_BASE__validators.schema.json", te = "STARTER TEMPLATE, owned by you. Edit it freely. The only contract is that it exposes #/$defs/validator, which every component schema references. Copied from the golemui gui validators when the tree was scaffolded, it does not track them afterwards.", ae = "__IMPLEMENTATION__ validator definitions", ie = { localizable: { $ref: "./core/common.schema.json#/$defs/localizable" }, stringValidator: { type: "object", properties: { type: { const: "string" }, required: { type: "boolean", description: "Makes the field mandatory - validation fails if the value is empty or absent" }, minLength: { type: "number", description: "Minimum number of characters the string must contain" }, maxLength: { type: "number", description: "Maximum number of characters the string may contain" }, pattern: { type: "string", description: "A regular expression pattern the value must match" }, format: { type: "string", description: "A named format the string must conform to (e.g. `email`, `url`, `date`, `uuid`)", enum: ["email", "hostname", "ipv4", "ipv6", "url", "uuid", "date", "time", "date-time", "duration"] }, const: { description: "The string must equal exactly this value" }, enum: { type: "array", description: "The string must be one of these allowed values" }, messages: { type: "object", description: "Custom error messages that override the default text for each constraint violation", properties: { invalid: { $ref: "#/$defs/localizable", description: "Shown when the value fails general type validation" }, required: { $ref: "#/$defs/localizable", description: "Shown when a required field is empty" }, minLength: { $ref: "#/$defs/localizable", description: "Shown when the value is shorter than `minLength`" }, maxLength: { $ref: "#/$defs/localizable", description: "Shown when the value is longer than `maxLength`" }, pattern: { $ref: "#/$defs/localizable", description: "Shown when the value does not match the `pattern` regex" }, format: { $ref: "#/$defs/localizable", description: "Shown when the value does not conform to the specified `format`" }, enum: { $ref: "#/$defs/localizable", description: "Shown when the value is not in the `enum` list" }, const: { $ref: "#/$defs/localizable", description: "Shown when the value does not equal `const`" } }, additionalProperties: !1 } }, required: ["type"], additionalProperties: !1 }, numberValidator: { type: "object", properties: { type: { type: "string", enum: ["number", "integer"] }, required: { type: "boolean", description: "Makes the field mandatory - validation fails if the value is absent" }, minimum: { type: "number", description: "The value must be greater than or equal to this number (inclusive)" }, maximum: { type: "number", description: "The value must be less than or equal to this number (inclusive)" }, exclusiveMinimum: { type: "number", description: "The value must be strictly greater than this number (exclusive)" }, exclusiveMaximum: { type: "number", description: "The value must be strictly less than this number (exclusive)" }, multipleOf: { type: "number", description: "The value must be a multiple of this number" }, const: { description: "The value must equal exactly this number" }, enum: { type: "array", description: "The value must be one of these allowed numbers" }, messages: { type: "object", description: "Custom error messages that override the default text for each constraint violation", properties: { invalid: { $ref: "#/$defs/localizable", description: "Shown when the value fails general type validation" }, minimum: { $ref: "#/$defs/localizable", description: "Shown when the value is below `minimum`" }, maximum: { $ref: "#/$defs/localizable", description: "Shown when the value exceeds `maximum`" }, exclusiveMinimum: { $ref: "#/$defs/localizable", description: "Shown when the value is not strictly above `exclusiveMinimum`" }, exclusiveMaximum: { $ref: "#/$defs/localizable", description: "Shown when the value is not strictly below `exclusiveMaximum`" }, multipleOf: { $ref: "#/$defs/localizable", description: "Shown when the value is not a multiple of `multipleOf`" }, enum: { $ref: "#/$defs/localizable", description: "Shown when the value is not in the `enum` list" }, const: { $ref: "#/$defs/localizable", description: "Shown when the value does not equal `const`" } }, additionalProperties: !1 } }, required: ["type"], additionalProperties: !1 }, booleanValidator: { type: "object", properties: { type: { const: "boolean" }, required: { type: "boolean", description: "Makes the field mandatory - validation fails if the value is absent or false (e.g. an unchecked required checkbox)" }, const: { description: "The value must equal exactly this boolean (e.g. `true` to require acceptance)" }, messages: { type: "object", description: "Custom error messages that override the default text for each constraint violation", properties: { invalid: { $ref: "#/$defs/localizable", description: "Shown when the value fails general type validation" }, const: { $ref: "#/$defs/localizable", description: "Shown when the value does not equal `const`" } }, additionalProperties: !1 } }, required: ["type"], additionalProperties: !1 }, arrayValidator: { type: "object", properties: { type: { const: "array" }, required: { type: "boolean", description: "Makes the field mandatory - validation fails if the array is empty or absent" }, minItems: { type: "number", description: "The array must contain at least this many items" }, maxItems: { type: "number", description: "The array must contain no more than this many items" }, uniqueItems: { type: "boolean", description: "When true, all items in the array must be distinct values" }, messages: { type: "object", description: "Custom error messages that override the default text for each constraint violation", properties: { invalid: { $ref: "#/$defs/localizable", description: "Shown when the value fails general type validation" }, required: { $ref: "#/$defs/localizable", description: "Shown when a required array is empty or absent" }, minItems: { $ref: "#/$defs/localizable", description: "Shown when the array has fewer items than `minItems`" }, maxItems: { $ref: "#/$defs/localizable", description: "Shown when the array has more items than `maxItems`" } }, additionalProperties: !1 } }, required: ["type"], additionalProperties: !1 }, fileValidator: { type: "object", description: "Validates the file envelope stored by the `fileUpload` widget (`{ id, name, size, type, status, error?, data? }` or `null`).", properties: { type: { const: "file" }, required: { type: "boolean", description: "Makes the field mandatory - validation fails if no file is set" }, blockPendingUploads: { type: "boolean", description: "When true (the default), validation fails while the file's status is `uploading` or `error`, so an unfinished upload cannot be submitted" }, messages: { type: "object", description: "Custom error messages that override the default text for each constraint violation", properties: { invalid: { $ref: "#/$defs/localizable", description: "Shown when the value is not a file envelope" }, required: { $ref: "#/$defs/localizable", description: "Shown when a required field has no file" }, pendingUploads: { $ref: "#/$defs/localizable", description: "Shown while the file is still uploading or failed to upload" } }, additionalProperties: !1 } }, required: ["type"], additionalProperties: !1 }, filesValidator: { type: "object", description: "Validates the array of file envelopes stored by the `multiFileUpload` widget.", properties: { type: { const: "files" }, required: { type: "boolean", description: "Makes the field mandatory - validation fails if the array is empty or absent" }, minItems: { type: "number", description: "The array must contain at least this many files" }, maxItems: { type: "number", description: "The array must contain no more than this many files" }, blockPendingUploads: { type: "boolean", description: "When true (the default), validation fails while any file's status is `uploading` or `error`, so an unfinished upload cannot be submitted" }, messages: { type: "object", description: "Custom error messages that override the default text for each constraint violation", properties: { invalid: { $ref: "#/$defs/localizable", description: "Shown when the value is not an array of file envelopes" }, required: { $ref: "#/$defs/localizable", description: "Shown when a required array is empty or absent" }, minItems: { $ref: "#/$defs/localizable", description: "Shown when the array has fewer files than `minItems`" }, maxItems: { $ref: "#/$defs/localizable", description: "Shown when the array has more files than `maxItems`" }, pendingUploads: { $ref: "#/$defs/localizable", description: "Shown while any file is still uploading or failed to upload" } }, additionalProperties: !1 } }, required: ["type"], additionalProperties: !1 }, customValidator: { type: "object", description: "A custom validator that delegates validation to application code. The registered validator function receives these constraint keys and must return a Standard Schema V1-compliant schema object (https://standardschema.dev). Add arbitrary constraint keys alongside `type` - they are passed as-is to the registered validator function.", properties: { type: { const: "custom" }, required: { type: "boolean", description: "Makes the field mandatory - evaluation is still delegated to the custom validator" } }, required: ["type"], additionalProperties: !0 }, validator: { description: "Validation rules for this field. The `type` discriminant selects the validator: `string`, `number`, `integer`, `boolean`, `array`, `file`, `files`, or `custom`.", oneOf: [{ $ref: "#/$defs/stringValidator" }, { $ref: "#/$defs/numberValidator" }, { $ref: "#/$defs/booleanValidator" }, { $ref: "#/$defs/arrayValidator" }, { $ref: "#/$defs/fileValidator" }, { $ref: "#/$defs/filesValidator" }, { $ref: "#/$defs/customValidator" }] } }, re = {
34
- $schema: X,
35
- $id: ee,
36
- $comment: te,
37
- title: ae,
38
- $defs: ie
2
+ import { existsSync as p, mkdirSync as O, writeFileSync as A, readFileSync as R } from "node:fs";
3
+ import { resolve as d, relative as g, dirname as b, join as u } from "node:path";
4
+ import { createInterface as C } from "node:readline/promises";
5
+ import { pathToFileURL as x } from "node:url";
6
+ import { g as L } from "./generate-implementation-schemas-DxCUi0Jr.js";
7
+ import { createRequire as D } from "node:module";
8
+ import { f as F, r as V } from "./json-schema-Bdnmzg_d.js";
9
+ const U = ["json-schema.config.mjs", "json-schema.config.json"];
10
+ async function W(e, t) {
11
+ const r = process.cwd(), { config: o, baseDir: i } = await B(h(e, "config"), r), n = K(h(e, "fail-on")), a = t[0] ? d(r, t[0]) : o.input !== void 0 ? d(i, o.input) : void 0;
12
+ if (a === void 0)
13
+ throw new Error(
14
+ "Missing the JSON Schema file. Pass it as `convert <schema.json>`, or set `input` in the config."
15
+ );
16
+ const l = h(e, "out"), s = l ? d(r, l) : o.output !== void 0 ? d(i, o.output) : void 0;
17
+ if (s !== void 0 && p(s) && e.get("force") !== !0)
18
+ throw new Error(
19
+ `${g(r, s)} exists. A generated form is often edited by hand, so it is only replaced with --force.`
20
+ );
21
+ const f = q(a), j = h(e, "pointer") ?? o.pointer, S = h(e, "preset"), z = await G(
22
+ S ?? o.preset,
23
+ o.presetOptions,
24
+ S !== void 0 ? r : i
25
+ ), { formDefinition: k, diagnostics: E } = F(
26
+ j === void 0 ? f : Y(f, j),
27
+ {
28
+ preset: z,
29
+ rules: o.rules,
30
+ overrides: o.overrides,
31
+ // A pointer selects the root, and `$ref`s still resolve against the whole document.
32
+ refRoot: f,
33
+ vendorKeyword: o.vendorKeyword,
34
+ maxRefDepth: o.maxRefDepth,
35
+ maxNodes: o.maxNodes,
36
+ transform: o.transform
37
+ }
38
+ ), P = `${JSON.stringify(k, null, 2)}
39
+ `;
40
+ s === void 0 ? process.stdout.write(P) : (O(b(s), { recursive: !0 }), A(s, P, "utf-8"), console.log(`Wrote ${g(r, s)}`));
41
+ for (const w of E)
42
+ console.error(H(w));
43
+ return E.some((w) => n.includes(w.severity)) ? 1 : 0;
44
+ }
45
+ async function B(e, t) {
46
+ const r = e !== void 0 ? d(t, e) : U.map((i) => u(t, i)).find((i) => p(i));
47
+ if (r === void 0)
48
+ return { config: {}, baseDir: t };
49
+ if (!p(r))
50
+ throw new Error(`Config file ${e} not found.`);
51
+ const o = r.endsWith(".json") ? q(r) : (await import(
52
+ /* @vite-ignore */
53
+ x(r).href
54
+ )).default;
55
+ return { config: J(o, g(t, r)), baseDir: b(r) };
56
+ }
57
+ const T = {
58
+ input: (e) => typeof e == "string",
59
+ output: (e) => typeof e == "string",
60
+ pointer: (e) => typeof e == "string",
61
+ preset: (e) => typeof e == "string" || Z(e),
62
+ presetOptions: c,
63
+ rules: (e) => Array.isArray(e) && e.every(c),
64
+ overrides: (e) => c(e) && Object.values(e).every(c),
65
+ vendorKeyword: (e) => typeof e == "string" || e === !1,
66
+ maxRefDepth: I,
67
+ maxNodes: I,
68
+ transform: (e) => typeof e == "function"
39
69
  };
40
- function $(e) {
70
+ function J(e, t) {
71
+ if (!c(e))
72
+ throw new Error(
73
+ `${t} must hold a configuration object (the default export of a .mjs).`
74
+ );
75
+ for (const [r, o] of Object.entries(e)) {
76
+ const i = T[r];
77
+ if (i === void 0)
78
+ throw new Error(
79
+ `${t}: unknown field \`${r}\`. The fields are ${Object.keys(T).join(", ")}.`
80
+ );
81
+ if (o !== void 0 && !i(o))
82
+ throw new Error(`${t}: \`${r}\` has the wrong type.`);
83
+ }
84
+ return e;
85
+ }
86
+ async function G(e, t, r) {
87
+ if (e === void 0)
88
+ throw new Error(
89
+ "No preset. Pass --preset with the preset module of a widget set, e.g. --preset @golemui/gui-schemas/json-schema, or set `preset` in the config."
90
+ );
91
+ if (typeof e != "string")
92
+ return e;
93
+ let o;
94
+ try {
95
+ o = D(u(r, "noop.js")).resolve(e);
96
+ } catch {
97
+ throw new Error(`Cannot find the preset module "${e}" from ${r}. Is it installed?`);
98
+ }
99
+ const i = await import(
100
+ /* @vite-ignore */
101
+ x(o).href
102
+ ), n = i.preset ?? i.default?.preset;
103
+ if (typeof n != "function")
104
+ throw new Error(
105
+ `"${e}" has no \`preset\` export. A preset module exports \`preset(options)\`, which returns the preset.`
106
+ );
107
+ return n(t ?? {});
108
+ }
109
+ function Y(e, t) {
110
+ const r = V(`#${t.replace(/^#/, "")}`, e);
111
+ if ("error" in r)
112
+ throw new Error(`--pointer ${t}: ${r.error}`);
113
+ if (!c(r.target))
114
+ throw new Error(`--pointer ${t} does not point to a schema object.`);
115
+ return r.target;
116
+ }
117
+ function q(e) {
118
+ if (!p(e))
119
+ throw new Error(`${e} not found.`);
120
+ try {
121
+ return JSON.parse(R(e, "utf-8"));
122
+ } catch (t) {
123
+ throw new Error(`${e} is not valid JSON: ${t instanceof Error ? t.message : t}`);
124
+ }
125
+ }
126
+ function K(e) {
127
+ switch (e) {
128
+ case void 0:
129
+ return [];
130
+ case "error":
131
+ return ["error"];
132
+ case "warning":
133
+ return ["error", "warning"];
134
+ default:
135
+ throw new Error(`Invalid --fail-on "${e}". Use error or warning.`);
136
+ }
137
+ }
138
+ function H(e) {
139
+ const t = `${e.path === "" ? "(root)" : e.path} (${e.pointer || "/"})`;
140
+ return `${e.severity} ${e.code} at ${t}: ${e.message}`;
141
+ }
142
+ function h(e, t) {
143
+ const r = e.get(t);
144
+ return typeof r == "string" ? r : void 0;
145
+ }
146
+ function Z(e) {
147
+ return c(e) && Array.isArray(e.rules) && typeof e.root == "function";
148
+ }
149
+ function I(e) {
150
+ return typeof e == "number" && Number.isInteger(e) && e > 0;
151
+ }
152
+ function c(e) {
153
+ return e !== null && typeof e == "object" && !Array.isArray(e);
154
+ }
155
+ const Q = "../src/lib/form.editor.schema.json", X = [{ kind: "layout", type: "flex", uid: "#root", props: { direction: "column", gap: 16 }, children: [{ kind: "input", type: "__IMPLEMENTATION__-input", uid: "email", path: "email", label: "Email address", validator: { type: "string", required: !0, format: "email" }, props: { placeholder: "you@example.com" } }] }], ee = {
156
+ $schema: Q,
157
+ form: X
158
+ }, te = "https://json-schema.org/draft/2020-12/schema", re = "__ID_BASE__components/example-input.schema.json", oe = "STARTER TEMPLATE, owned by you. One component schema per widget type. Copy this file for each widget, then list it in schemas.config.mjs. The pattern to keep: allOf the baseWidget, `kind` and `type` consts, one `$defs` entry per prop, a `.state` suffixed pattern for every suffixable key, `additionalProperties: false` inside `props`, and `unevaluatedProperties: false` at the root.", ie = "__IMPLEMENTATION__ example input widget", se = "object", ne = { labelDef: { $ref: "../core/common.schema.json#/$defs/localizable" }, disabledDef: { $ref: "../core/common.schema.json#/$defs/boolOrWhen" }, readonlyDef: { $ref: "../core/common.schema.json#/$defs/boolOrWhen" }, hintProp: { type: "string" }, placeholderProp: { type: "string" }, maxlengthProp: { type: "number" } }, ae = [{ $ref: "../core/common.schema.json#/$defs/baseWidget" }], le = { kind: { const: "input" }, type: { const: "__IMPLEMENTATION__-input" }, path: { $ref: "../core/common.schema.json#/$defs/dotPath" }, label: { $ref: "#/$defs/labelDef" }, disabled: { $ref: "#/$defs/disabledDef" }, readonly: { $ref: "#/$defs/readonlyDef" }, on: { $ref: "../core/common.schema.json#/$defs/on" }, validator: { $ref: "../validators.schema.json#/$defs/validator" }, defaultValue: { type: "string" }, props: { type: "object", properties: { hint: { $ref: "#/$defs/hintProp" }, placeholder: { $ref: "#/$defs/placeholderProp" }, maxlength: { $ref: "#/$defs/maxlengthProp" } }, patternProperties: { "^hint\\.[^.]+$": { $ref: "#/$defs/hintProp" }, "^placeholder\\.[^.]+$": { $ref: "#/$defs/placeholderProp" }, "^maxlength\\.[^.]+$": { $ref: "#/$defs/maxlengthProp" } }, additionalProperties: !1 } }, de = { "^label\\.[^.]+$": { $ref: "#/$defs/labelDef" }, "^disabled\\.[^.]+$": { $ref: "#/$defs/disabledDef" }, "^readonly\\.[^.]+$": { $ref: "#/$defs/readonlyDef" }, "^validator\\.[^.]+$": { $ref: "../validators.schema.json#/$defs/validator" } }, ce = ["kind", "type", "path"], me = !1, pe = {
159
+ $schema: te,
160
+ $id: re,
161
+ $comment: oe,
162
+ title: ie,
163
+ type: se,
164
+ $defs: ne,
165
+ allOf: ae,
166
+ properties: le,
167
+ patternProperties: de,
168
+ required: ce,
169
+ unevaluatedProperties: me
170
+ }, fe = "https://json-schema.org/draft/2020-12/schema", he = "__ID_BASE__components/flex.schema.json", ue = "STARTER TEMPLATE, owned by you. `flex` is a reserved widget type: keep the name and the `children` array, change the props to match your layout widget.", ye = "__IMPLEMENTATION__ flex widget", $e = "object", ge = { directionProp: { enum: ["row", "row-reverse", "column", "column-reverse"] }, justifyProp: { enum: ["start", "center", "end", "stretch", "space-between", "space-around"] }, alignProp: { enum: ["start", "center", "end", "stretch", "baseline"] }, wrapProp: { type: "boolean" }, gapProp: { type: "number" }, paddingProp: { type: "number" } }, we = [{ $ref: "../core/common.schema.json#/$defs/baseWidget" }], ve = { kind: { const: "layout" }, type: { const: "flex" }, children: { type: "array", minItems: 1, items: { $ref: "../widgets.schema.json#/$defs/formWidget" } }, props: { type: "object", properties: { direction: { $ref: "#/$defs/directionProp" }, justify: { $ref: "#/$defs/justifyProp" }, align: { $ref: "#/$defs/alignProp" }, wrap: { $ref: "#/$defs/wrapProp" }, gap: { $ref: "#/$defs/gapProp" }, padding: { $ref: "#/$defs/paddingProp" } }, patternProperties: { "^direction\\.[^.]+$": { $ref: "#/$defs/directionProp" }, "^justify\\.[^.]+$": { $ref: "#/$defs/justifyProp" }, "^align\\.[^.]+$": { $ref: "#/$defs/alignProp" }, "^wrap\\.[^.]+$": { $ref: "#/$defs/wrapProp" }, "^gap\\.[^.]+$": { $ref: "#/$defs/gapProp" }, "^padding\\.[^.]+$": { $ref: "#/$defs/paddingProp" } }, additionalProperties: !1 } }, be = ["kind", "type", "children"], xe = !1, je = {
171
+ $schema: fe,
172
+ $id: he,
173
+ $comment: ue,
174
+ title: ye,
175
+ type: $e,
176
+ $defs: ge,
177
+ allOf: we,
178
+ properties: ve,
179
+ required: be,
180
+ unevaluatedProperties: xe
181
+ }, Se = "https://json-schema.org/draft/2020-12/schema", Ee = "__ID_BASE__validators.schema.json", Pe = "STARTER TEMPLATE, owned by you. Edit it freely. The only contract is that it exposes #/$defs/validator, which every component schema references. Copied from the golemui gui validators when the tree was scaffolded, it does not track them afterwards.", Te = "__IMPLEMENTATION__ validator definitions", Ie = { localizable: { $ref: "./core/common.schema.json#/$defs/localizable" }, stringValidator: { type: "object", properties: { type: { const: "string" }, required: { type: "boolean", description: "Makes the field mandatory - validation fails if the value is empty or absent" }, minLength: { type: "number", description: "Minimum number of characters the string must contain" }, maxLength: { type: "number", description: "Maximum number of characters the string may contain" }, pattern: { type: "string", description: "A regular expression pattern the value must match" }, format: { type: "string", description: "A named format the string must conform to (e.g. `email`, `url`, `date`, `uuid`)", enum: ["email", "hostname", "ipv4", "ipv6", "url", "uuid", "date", "time", "date-time", "duration"] }, const: { description: "The string must equal exactly this value" }, enum: { type: "array", description: "The string must be one of these allowed values" }, messages: { type: "object", description: "Custom error messages that override the default text for each constraint violation", properties: { invalid: { $ref: "#/$defs/localizable", description: "Shown when the value fails general type validation" }, required: { $ref: "#/$defs/localizable", description: "Shown when a required field is empty" }, minLength: { $ref: "#/$defs/localizable", description: "Shown when the value is shorter than `minLength`" }, maxLength: { $ref: "#/$defs/localizable", description: "Shown when the value is longer than `maxLength`" }, pattern: { $ref: "#/$defs/localizable", description: "Shown when the value does not match the `pattern` regex" }, format: { $ref: "#/$defs/localizable", description: "Shown when the value does not conform to the specified `format`" }, enum: { $ref: "#/$defs/localizable", description: "Shown when the value is not in the `enum` list" }, const: { $ref: "#/$defs/localizable", description: "Shown when the value does not equal `const`" } }, additionalProperties: !1 } }, required: ["type"], additionalProperties: !1 }, numberValidator: { type: "object", properties: { type: { type: "string", enum: ["number", "integer"] }, required: { type: "boolean", description: "Makes the field mandatory - validation fails if the value is absent" }, minimum: { type: "number", description: "The value must be greater than or equal to this number (inclusive)" }, maximum: { type: "number", description: "The value must be less than or equal to this number (inclusive)" }, exclusiveMinimum: { type: "number", description: "The value must be strictly greater than this number (exclusive)" }, exclusiveMaximum: { type: "number", description: "The value must be strictly less than this number (exclusive)" }, multipleOf: { type: "number", description: "The value must be a multiple of this number" }, const: { description: "The value must equal exactly this number" }, enum: { type: "array", description: "The value must be one of these allowed numbers" }, messages: { type: "object", description: "Custom error messages that override the default text for each constraint violation", properties: { invalid: { $ref: "#/$defs/localizable", description: "Shown when the value fails general type validation" }, minimum: { $ref: "#/$defs/localizable", description: "Shown when the value is below `minimum`" }, maximum: { $ref: "#/$defs/localizable", description: "Shown when the value exceeds `maximum`" }, exclusiveMinimum: { $ref: "#/$defs/localizable", description: "Shown when the value is not strictly above `exclusiveMinimum`" }, exclusiveMaximum: { $ref: "#/$defs/localizable", description: "Shown when the value is not strictly below `exclusiveMaximum`" }, multipleOf: { $ref: "#/$defs/localizable", description: "Shown when the value is not a multiple of `multipleOf`" }, enum: { $ref: "#/$defs/localizable", description: "Shown when the value is not in the `enum` list" }, const: { $ref: "#/$defs/localizable", description: "Shown when the value does not equal `const`" } }, additionalProperties: !1 } }, required: ["type"], additionalProperties: !1 }, booleanValidator: { type: "object", properties: { type: { const: "boolean" }, required: { type: "boolean", description: "Makes the field mandatory - validation fails if the value is absent or false (e.g. an unchecked required checkbox)" }, const: { description: "The value must equal exactly this boolean (e.g. `true` to require acceptance)" }, messages: { type: "object", description: "Custom error messages that override the default text for each constraint violation", properties: { invalid: { $ref: "#/$defs/localizable", description: "Shown when the value fails general type validation" }, const: { $ref: "#/$defs/localizable", description: "Shown when the value does not equal `const`" } }, additionalProperties: !1 } }, required: ["type"], additionalProperties: !1 }, arrayValidator: { type: "object", properties: { type: { const: "array" }, required: { type: "boolean", description: "Makes the field mandatory - validation fails if the array is empty or absent" }, minItems: { type: "number", description: "The array must contain at least this many items" }, maxItems: { type: "number", description: "The array must contain no more than this many items" }, uniqueItems: { type: "boolean", description: "When true, all items in the array must be distinct values" }, messages: { type: "object", description: "Custom error messages that override the default text for each constraint violation", properties: { invalid: { $ref: "#/$defs/localizable", description: "Shown when the value fails general type validation" }, required: { $ref: "#/$defs/localizable", description: "Shown when a required array is empty or absent" }, minItems: { $ref: "#/$defs/localizable", description: "Shown when the array has fewer items than `minItems`" }, maxItems: { $ref: "#/$defs/localizable", description: "Shown when the array has more items than `maxItems`" } }, additionalProperties: !1 } }, required: ["type"], additionalProperties: !1 }, fileValidator: { type: "object", description: "Validates the file envelope stored by the `fileUpload` widget (`{ id, name, size, type, status, error?, data? }` or `null`).", properties: { type: { const: "file" }, required: { type: "boolean", description: "Makes the field mandatory - validation fails if no file is set" }, blockPendingUploads: { type: "boolean", description: "When true (the default), validation fails while the file's status is `uploading` or `error`, so an unfinished upload cannot be submitted" }, messages: { type: "object", description: "Custom error messages that override the default text for each constraint violation", properties: { invalid: { $ref: "#/$defs/localizable", description: "Shown when the value is not a file envelope" }, required: { $ref: "#/$defs/localizable", description: "Shown when a required field has no file" }, pendingUploads: { $ref: "#/$defs/localizable", description: "Shown while the file is still uploading or failed to upload" } }, additionalProperties: !1 } }, required: ["type"], additionalProperties: !1 }, filesValidator: { type: "object", description: "Validates the array of file envelopes stored by the `multiFileUpload` widget.", properties: { type: { const: "files" }, required: { type: "boolean", description: "Makes the field mandatory - validation fails if the array is empty or absent" }, minItems: { type: "number", description: "The array must contain at least this many files" }, maxItems: { type: "number", description: "The array must contain no more than this many files" }, blockPendingUploads: { type: "boolean", description: "When true (the default), validation fails while any file's status is `uploading` or `error`, so an unfinished upload cannot be submitted" }, messages: { type: "object", description: "Custom error messages that override the default text for each constraint violation", properties: { invalid: { $ref: "#/$defs/localizable", description: "Shown when the value is not an array of file envelopes" }, required: { $ref: "#/$defs/localizable", description: "Shown when a required array is empty or absent" }, minItems: { $ref: "#/$defs/localizable", description: "Shown when the array has fewer files than `minItems`" }, maxItems: { $ref: "#/$defs/localizable", description: "Shown when the array has more files than `maxItems`" }, pendingUploads: { $ref: "#/$defs/localizable", description: "Shown while any file is still uploading or failed to upload" } }, additionalProperties: !1 } }, required: ["type"], additionalProperties: !1 }, customValidator: { type: "object", description: "A custom validator that delegates validation to application code. The registered validator function receives these constraint keys and must return a Standard Schema V1-compliant schema object (https://standardschema.dev). Add arbitrary constraint keys alongside `type` - they are passed as-is to the registered validator function.", properties: { type: { const: "custom" }, required: { type: "boolean", description: "Makes the field mandatory - evaluation is still delegated to the custom validator" } }, required: ["type"], additionalProperties: !0 }, validator: { description: "Validation rules for this field. The `type` discriminant selects the validator: `string`, `number`, `integer`, `boolean`, `array`, `file`, `files`, or `custom`.", oneOf: [{ $ref: "#/$defs/stringValidator" }, { $ref: "#/$defs/numberValidator" }, { $ref: "#/$defs/booleanValidator" }, { $ref: "#/$defs/arrayValidator" }, { $ref: "#/$defs/fileValidator" }, { $ref: "#/$defs/filesValidator" }, { $ref: "#/$defs/customValidator" }] } }, _e = {
182
+ $schema: Se,
183
+ $id: Ee,
184
+ $comment: Pe,
185
+ title: Te,
186
+ $defs: Ie
187
+ };
188
+ function N(e) {
41
189
  return `${e}-input`;
42
190
  }
43
- function oe(e, t) {
44
- const a = e.replace(/__IMPLEMENTATION__/g, t.implementation).replace(/__ID_BASE__/g, t.idBase), i = a.match(/__[A-Z_]+__/);
45
- if (i !== null)
46
- throw new Error(`Unsubstituted placeholder ${i[0]} in a starter template.`);
47
- return a;
191
+ function Oe(e, t) {
192
+ const r = e.replace(/__IMPLEMENTATION__/g, t.implementation).replace(/__ID_BASE__/g, t.idBase), o = r.match(/__[A-Z_]+__/);
193
+ if (o !== null)
194
+ throw new Error(`Unsubstituted placeholder ${o[0]} in a starter template.`);
195
+ return r;
48
196
  }
49
- function d(e, t) {
50
- return oe(JSON.stringify(e, null, 2), t) + `
197
+ function y(e, t) {
198
+ return Oe(JSON.stringify(e, null, 2), t) + `
51
199
  `;
52
200
  }
53
- function se(e) {
201
+ function Ae(e) {
54
202
  return {
55
- "schemas.config.mjs": ne(e),
56
- "src/lib/validators.schema.json": d(re, e),
57
- "src/lib/components/flex.schema.json": d(Q, e),
58
- "src/lib/components/example-input.schema.json": d(
59
- U,
203
+ "schemas.config.mjs": qe(e),
204
+ "src/lib/validators.schema.json": y(_e, e),
205
+ "src/lib/components/flex.schema.json": y(je, e),
206
+ "src/lib/components/example-input.schema.json": y(
207
+ pe,
60
208
  e
61
209
  ),
62
- "examples/example.form.json": d(I, e),
63
- "test/schemas.spec.ts": le(e)
210
+ "examples/example.form.json": y(ee, e),
211
+ "test/schemas.spec.ts": Ne(e)
64
212
  };
65
213
  }
66
- function ne(e) {
214
+ function qe(e) {
67
215
  return `// The manifest and configuration for this implementation's JSON schema tree.
68
216
  // You own this file. Every file marked GENERATED is rebuilt from it by
69
217
  // \`npx @golemui/schemas generate\`, so add a widget by writing its component schema
@@ -88,7 +236,7 @@ export default {
88
236
  manifest: [
89
237
  { type: 'flex', schemaFile: 'flex.schema.json', kind: 'layout' },
90
238
  {
91
- type: '${$(e.implementation)}',
239
+ type: '${N(e.implementation)}',
92
240
  schemaFile: 'example-input.schema.json',
93
241
  kind: 'input',
94
242
  },
@@ -101,7 +249,7 @@ export default {
101
249
  };
102
250
  `;
103
251
  }
104
- function le(e) {
252
+ function Ne(e) {
105
253
  return `// Registers the whole schema tree into one Ajv 2020 instance and validates the
106
254
  // example form against it. Run it after every \`npx @golemui/schemas generate\`.
107
255
  //
@@ -172,11 +320,13 @@ describe('${e.implementation} schema tree', () => {
172
320
  });
173
321
  `;
174
322
  }
175
- const n = "schemas.config.mjs", f = `golemui-schemas - JSON schema trees for GolemUI implementations
323
+ const m = "schemas.config.mjs", _ = `golemui-schemas - JSON schema trees for GolemUI implementations
176
324
 
177
325
  Usage:
178
326
  npx @golemui/schemas init [options] scaffold a schema tree
179
327
  npx @golemui/schemas generate [options] rebuild the generated files
328
+ npx @golemui/schemas convert <schema.json> [options]
329
+ convert a JSON Schema into a form definition
180
330
 
181
331
  Options for init:
182
332
  --name <name> implementation name, lowercase, e.g. kendo
@@ -185,50 +335,60 @@ Options for init:
185
335
  --force overwrite existing starter files
186
336
 
187
337
  Options for generate:
188
- --dir <path> directory holding ${n} (default: the current directory)
338
+ --dir <path> directory holding ${m} (default: the current directory)
339
+
340
+ Options for convert:
341
+ --preset <module> preset module of the widget set, e.g. @golemui/gui-schemas/json-schema
342
+ --out <file> file to write the form definition to (default: standard output)
343
+ --force replace an existing --out file
344
+ --config <file> json-schema.config.mjs or .json (default: the one in the current directory)
345
+ --pointer <pointer> convert the subschema at this JSON pointer, e.g. /components/schemas/User
346
+ --fail-on <level> exit with 1 on an error diagnostic, or with warning on either
347
+ Diagnostics are written to standard error. The config holds the same settings plus
348
+ rules, overrides and presetOptions, see the @golemui/schemas README.
189
349
 
190
- Both commands accept --help.`;
191
- function de(e) {
192
- const t = /* @__PURE__ */ new Map();
193
- let a;
350
+ Every command accepts --help.`;
351
+ function Me(e) {
352
+ const t = /* @__PURE__ */ new Map(), r = [];
353
+ let o;
194
354
  for (let i = 0; i < e.length; i += 1) {
195
- const r = e[i];
196
- if (!r.startsWith("--")) {
197
- a ??= r;
355
+ const n = e[i];
356
+ if (!n.startsWith("--")) {
357
+ o === void 0 ? o = n : r.push(n);
198
358
  continue;
199
359
  }
200
- const o = r.slice(2), s = o.indexOf("=");
201
- if (s !== -1) {
202
- t.set(o.slice(0, s), o.slice(s + 1));
360
+ const a = n.slice(2), l = a.indexOf("=");
361
+ if (l !== -1) {
362
+ t.set(a.slice(0, l), a.slice(l + 1));
203
363
  continue;
204
364
  }
205
- const l = e[i + 1];
206
- l === void 0 || l.startsWith("--") ? t.set(o, !0) : (t.set(o, l), i += 1);
365
+ const s = e[i + 1];
366
+ s === void 0 || s.startsWith("--") ? t.set(a, !0) : (t.set(a, s), i += 1);
207
367
  }
208
- return { command: a, flags: t };
368
+ return { command: o, positionals: r, flags: t };
209
369
  }
210
- function c(e, t) {
211
- const a = e.get(t);
212
- return typeof a == "string" ? a : void 0;
370
+ function $(e, t) {
371
+ const r = e.get(t);
372
+ return typeof r == "string" ? r : void 0;
213
373
  }
214
- async function p(e, t, a) {
374
+ async function v(e, t, r) {
215
375
  if (process.stdin.isTTY !== !0)
216
376
  throw new Error(`Missing --${t}. There is no terminal to ask on.`);
217
- const i = S({ input: process.stdin, output: process.stdout });
377
+ const o = C({ input: process.stdin, output: process.stdout });
218
378
  try {
219
- const r = (await i.question(`${e} [${a}] `)).trim();
220
- return r === "" ? a : r;
379
+ const i = (await o.question(`${e} [${r}] `)).trim();
380
+ return i === "" ? r : i;
221
381
  } finally {
222
- i.close();
382
+ o.close();
223
383
  }
224
384
  }
225
- function ce(e) {
385
+ function ze(e) {
226
386
  if (!/^[a-z][a-z0-9-]*$/.test(e))
227
387
  throw new Error(
228
388
  `Invalid implementation name "${e}". Use lowercase letters, digits and hyphens, starting with a letter.`
229
389
  );
230
390
  }
231
- function me(e) {
391
+ function ke(e) {
232
392
  let t;
233
393
  try {
234
394
  t = new URL(e);
@@ -239,86 +399,88 @@ function me(e) {
239
399
  throw new Error(`Invalid --id-base "${e}". It must be an http or https URL.`);
240
400
  return e.endsWith("/") ? e : `${e}/`;
241
401
  }
242
- function pe(e, t, a) {
243
- const i = h(e, t);
244
- w(j(i), { recursive: !0 }), v(i, a, "utf-8"), console.log(`Wrote ${t}`);
402
+ function Re(e, t, r) {
403
+ const o = u(e, t);
404
+ O(b(o), { recursive: !0 }), A(o, r, "utf-8"), console.log(`Wrote ${t}`);
245
405
  }
246
- async function he(e) {
247
- const t = c(e, "name") ?? await p("Implementation name?", "name", "my-widgets");
248
- ce(t);
249
- const a = me(
250
- c(e, "id-base") ?? await p(
406
+ async function Ce(e) {
407
+ const t = $(e, "name") ?? await v("Implementation name?", "name", "my-widgets");
408
+ ze(t);
409
+ const r = ke(
410
+ $(e, "id-base") ?? await v(
251
411
  "Base URL of the published tree?",
252
412
  "id-base",
253
413
  `https://example.com/schemas/${t}/`
254
414
  )
255
- ), i = c(e, "dir") ?? await p("Directory?", "dir", "schemas"), r = y(process.cwd(), i), o = se({ implementation: t, idBase: a }), s = Object.keys(o).filter((m) => u(h(r, m)));
256
- if (s.length > 0 && e.get("force") !== !0)
415
+ ), o = $(e, "dir") ?? await v("Directory?", "dir", "schemas"), i = d(process.cwd(), o), n = Ae({ implementation: t, idBase: r }), a = Object.keys(n).filter((s) => p(u(i, s)));
416
+ if (a.length > 0 && e.get("force") !== !0)
257
417
  throw new Error(
258
- `Refusing to overwrite starter files you may have edited: ${s.join(", ")}. Pass --force to replace them.`
418
+ `Refusing to overwrite starter files you may have edited: ${a.join(", ")}. Pass --force to replace them.`
259
419
  );
260
- for (const [m, b] of Object.entries(o))
261
- pe(r, m, b);
262
- await g(r);
263
- const l = x(process.cwd(), r) || ".";
420
+ for (const [s, f] of Object.entries(n))
421
+ Re(i, s, f);
422
+ await M(i);
423
+ const l = g(process.cwd(), i) || ".";
264
424
  console.log(`
265
425
  Scaffolded the ${t} schema tree in ${l}.
266
426
 
267
427
  Next:
268
428
  1. Add @golemui/schemas to the project's dependencies.
269
429
  2. Write one component schema per widget under src/lib/components/, and list each one
270
- in ${n}. src/lib/components/example-input.schema.json is the pattern to copy.
271
- examples/example.form.json uses the starter type ${$(t)}, so
430
+ in ${m}. src/lib/components/example-input.schema.json is the pattern to copy.
431
+ examples/example.form.json uses the starter type ${N(t)}, so
272
432
  replace it together with the manifest or test/schemas.spec.ts fails.
273
433
  3. Rerun \`npx @golemui/schemas generate\` after every edit to a component schema, to
274
- ${n} or to validators.schema.json. A CI step that regenerates and then runs
434
+ ${m} or to validators.schema.json. A CI step that regenerates and then runs
275
435
  \`git diff --exit-code\` catches a forgotten rerun.
276
436
  4. Point a form file's "$schema" at src/lib/form.editor.schema.json, as
277
437
  examples/example.form.json does. Editors need that bundle, Ajv uses the per-file tree.`);
278
438
  }
279
- function fe(e, t) {
439
+ function Le(e, t) {
280
440
  if (e === null || typeof e != "object")
281
441
  throw new Error(`${t} must export a configuration object as its default export.`);
282
- const a = e, r = ["implementation", "idBase", "generatorPath", "formTitle"].filter((o) => typeof a[o] != "string");
283
- if (r.length > 0)
284
- throw new Error(`${t} is missing required string fields: ${r.join(", ")}.`);
285
- if (!Array.isArray(a.manifest) || a.manifest.length === 0)
442
+ const r = e, i = ["implementation", "idBase", "generatorPath", "formTitle"].filter((n) => typeof r[n] != "string");
443
+ if (i.length > 0)
444
+ throw new Error(`${t} is missing required string fields: ${i.join(", ")}.`);
445
+ if (!Array.isArray(r.manifest) || r.manifest.length === 0)
286
446
  throw new Error(`${t} must declare a non-empty \`manifest\` array.`);
287
- if (!a.idBase.endsWith("/"))
447
+ if (!r.idBase.endsWith("/"))
288
448
  throw new Error(`${t}: \`idBase\` must end with a slash.`);
289
449
  return e;
290
450
  }
291
- async function g(e) {
292
- const t = h(e, n);
293
- if (!u(t))
451
+ async function M(e) {
452
+ const t = u(e, m);
453
+ if (!p(t))
294
454
  throw new Error(
295
- `No ${n} in ${e}. Run this from the directory holding it, pass --dir, or scaffold a new tree with \`npx @golemui/schemas init\`.`
455
+ `No ${m} in ${e}. Run this from the directory holding it, pass --dir, or scaffold a new tree with \`npx @golemui/schemas init\`.`
296
456
  );
297
- const a = await import(
457
+ const r = await import(
298
458
  /* @vite-ignore */
299
- P(t).href
300
- ), i = fe(a.default, n);
301
- await T(i, e);
459
+ x(t).href
460
+ ), o = Le(r.default, m);
461
+ await L(o, e);
302
462
  }
303
- async function ue(e) {
304
- const { command: t, flags: a } = de(e);
305
- if (a.get("help") === !0 || t === "help" || t === void 0)
306
- return console.log(f), t === void 0 && a.get("help") !== !0 ? 1 : 0;
463
+ async function De(e) {
464
+ const { command: t, positionals: r, flags: o } = Me(e);
465
+ if (o.get("help") === !0 || t === "help" || t === void 0)
466
+ return console.log(_), t === void 0 && o.get("help") !== !0 ? 1 : 0;
307
467
  try {
308
468
  switch (t) {
309
469
  case "init":
310
- return await he(a), 0;
470
+ return await Ce(o), 0;
311
471
  case "generate":
312
- return await g(y(process.cwd(), c(a, "dir") ?? ".")), 0;
472
+ return await M(d(process.cwd(), $(o, "dir") ?? ".")), 0;
473
+ case "convert":
474
+ return await W(o, r);
313
475
  default:
314
476
  return console.error(`Unknown command "${t}".
315
477
 
316
- ${f}`), 1;
478
+ ${_}`), 1;
317
479
  }
318
480
  } catch (i) {
319
481
  return console.error(i instanceof Error ? i.message : i), 1;
320
482
  }
321
483
  }
322
- ue(process.argv.slice(2)).then((e) => {
484
+ De(process.argv.slice(2)).then((e) => {
323
485
  process.exitCode = e;
324
486
  });