@incajs/cli 0.0.1 → 0.0.2
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/README.md +49 -91
- package/dist/build.d.mts +3 -0
- package/dist/chunks/__vite-optional-peer-dep_dotenv_c12-CxKvRg9-.js +3 -0
- package/dist/chunks/__vite-optional-peer-dep_giget_c12-BYcrHYBM.js +5 -0
- package/dist/chunks/__vite-optional-peer-dep_jiti_c12-DZVJNj6v.js +5 -0
- package/dist/chunks/_format-BKs7bsc4.js +98 -0
- package/dist/chunks/defaults-EWjAFeZ3.js +1184 -0
- package/dist/chunks/dist-BVKUE9C4.js +114 -0
- package/dist/chunks/json5-feUuPtTt.js +756 -0
- package/dist/chunks/jsonc-BdzClvC8.js +46 -0
- package/dist/chunks/ohash-CHaRSTtv.js +231 -0
- package/dist/chunks/toml-BERh2MAo.js +417 -0
- package/dist/chunks/yaml-N2dF3WHm.js +2123 -0
- package/dist/cli.js +205 -183
- package/dist/config/defaults.d.mts +44 -0
- package/dist/config/index.d.mts +18 -0
- package/dist/config/loader.d.mts +37 -0
- package/dist/config/types.d.mts +35 -0
- package/dist/config.js +5 -0
- package/dist/index.d.mts +1 -0
- package/package.json +20 -14
- package/dist/metadata.d.mts +0 -30
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { n as e, t } from "./_format-BKs7bsc4.js";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var n = Object.defineProperty, r = (e, t) => {
|
|
4
|
+
let r = {};
|
|
5
|
+
for (var i in e) n(r, i, {
|
|
6
|
+
get: e[i],
|
|
7
|
+
enumerable: !0
|
|
8
|
+
});
|
|
9
|
+
return t || n(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
10
|
+
}, i = Symbol("singleComment"), a = Symbol("multiComment"), o = () => "", s = (e, t, n) => e.slice(t, n).replace(/[^ \t\r\n]/g, " "), c = (e, t) => {
|
|
11
|
+
let n = t - 1, r = 0;
|
|
12
|
+
for (; e[n] === "\\";) --n, r += 1;
|
|
13
|
+
return !!(r % 2);
|
|
14
|
+
};
|
|
15
|
+
function l(e, { whitespace: t = !0, trailingCommas: n = !1 } = {}) {
|
|
16
|
+
if (typeof e != "string") throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof e}\``);
|
|
17
|
+
let r = t ? s : o, l = !1, u = !1, d = 0, f = "", p = "", m = -1;
|
|
18
|
+
for (let t = 0; t < e.length; t++) {
|
|
19
|
+
let o = e[t], s = e[t + 1];
|
|
20
|
+
if (!u && o === "\"" && (c(e, t) || (l = !l)), !l) {
|
|
21
|
+
if (!u && o + s === "//") f += e.slice(d, t), d = t, u = i, t++;
|
|
22
|
+
else if (u === i && o + s === "\r\n") {
|
|
23
|
+
t++, u = !1, f += r(e, d, t), d = t;
|
|
24
|
+
continue;
|
|
25
|
+
} else if (u === i && o === "\n") u = !1, f += r(e, d, t), d = t;
|
|
26
|
+
else if (!u && o + s === "/*") {
|
|
27
|
+
f += e.slice(d, t), d = t, u = a, t++;
|
|
28
|
+
continue;
|
|
29
|
+
} else if (u === a && o + s === "*/") {
|
|
30
|
+
t++, u = !1, f += r(e, d, t + 1), d = t + 1;
|
|
31
|
+
continue;
|
|
32
|
+
} else n && !u && (m === -1 ? o === "," && (p += f + e.slice(d, t), f = "", d = t, m = t) : o === "}" || o === "]" ? (f += e.slice(d, t), p += r(f, 0, 1) + f.slice(1), f = "", d = t, m = -1) : o !== " " && o !== " " && o !== "\r" && o !== "\n" && (f += e.slice(d, t), d = t, m = -1));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
let h = u === i ? r(e, d) : e.slice(d);
|
|
36
|
+
return p + f + h;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region ../../node_modules/.pnpm/confbox@0.3.1/node_modules/confbox/dist/jsonc.mjs
|
|
40
|
+
var u = /* @__PURE__ */ r({ parseJSONC: () => d });
|
|
41
|
+
function d(n, r) {
|
|
42
|
+
let i = JSON.parse(l(t(n), { trailingCommas: r?.allowTrailingComma }));
|
|
43
|
+
return e(n, i, r), i;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { u as n, d as t };
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { createHash as e } from "node:crypto";
|
|
2
|
+
//#region ../../node_modules/.pnpm/c12@4.0.0-rc.1_magicast@0.5.4/node_modules/c12/dist/_chunks/libs/ohash.mjs
|
|
3
|
+
var t = Object.defineProperty, n = (e, n) => {
|
|
4
|
+
let r = {};
|
|
5
|
+
for (var i in e) t(r, i, {
|
|
6
|
+
get: e[i],
|
|
7
|
+
enumerable: !0
|
|
8
|
+
});
|
|
9
|
+
return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
10
|
+
};
|
|
11
|
+
function r(e) {
|
|
12
|
+
return typeof e == "string" ? `'${e}'` : new s().serialize(e);
|
|
13
|
+
}
|
|
14
|
+
var i = " _-,;:!?.'\"()[]{}@*/\\&#%`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz", a = /*@__PURE__*/ (function() {
|
|
15
|
+
let e = /* @__PURE__ */ new Uint8Array(128);
|
|
16
|
+
for (let t = 0; t < 69; t++) e[i.charCodeAt(t)] = t + 1;
|
|
17
|
+
for (let t = 65; t <= 90; t++) e[t] = e[t + 32];
|
|
18
|
+
return e;
|
|
19
|
+
})();
|
|
20
|
+
function o(e, t) {
|
|
21
|
+
if (e === t) return 0;
|
|
22
|
+
let n = Math.min(e.length, t.length), r = 0;
|
|
23
|
+
for (let i = 0; i < n; i++) {
|
|
24
|
+
let n = e.charCodeAt(i), o = t.charCodeAt(i);
|
|
25
|
+
if (n === o) continue;
|
|
26
|
+
let s = n < 128 && a[n] ? a[n] : n + 128, c = o < 128 && a[o] ? a[o] : o + 128;
|
|
27
|
+
if (s !== c) return s < c ? -1 : 1;
|
|
28
|
+
r === 0 && (r = n > o ? -1 : 1);
|
|
29
|
+
}
|
|
30
|
+
return e.length === t.length ? r : e.length < t.length ? -1 : 1;
|
|
31
|
+
}
|
|
32
|
+
var s = /*@__PURE__*/ (function() {
|
|
33
|
+
class e {
|
|
34
|
+
#e = /* @__PURE__ */ new Map();
|
|
35
|
+
compare(e, t) {
|
|
36
|
+
let n = typeof e, r = typeof t;
|
|
37
|
+
return n === "string" && r === "string" ? o(e, t) : n === "number" && r === "number" ? e - t : o(this.serialize(e, !0), this.serialize(t, !0));
|
|
38
|
+
}
|
|
39
|
+
serialize(e, t) {
|
|
40
|
+
if (e === null) return "null";
|
|
41
|
+
switch (typeof e) {
|
|
42
|
+
case "string": return t ? e : `'${e}'`;
|
|
43
|
+
case "bigint": return `${e}n`;
|
|
44
|
+
case "object": return this.$object(e);
|
|
45
|
+
case "function": return this.$function(e);
|
|
46
|
+
}
|
|
47
|
+
return String(e);
|
|
48
|
+
}
|
|
49
|
+
serializeObject(e) {
|
|
50
|
+
let t = Object.prototype.toString.call(e);
|
|
51
|
+
if (t !== "[object Object]") return this.serializeBuiltInType(t.length < 10 ? `unknown:${t}` : t.slice(8, -1), e);
|
|
52
|
+
let n = e.constructor, r = n === Object || n === void 0 ? "" : n.name;
|
|
53
|
+
if (r !== "" && globalThis[r] === n) return this.serializeBuiltInType(r, e);
|
|
54
|
+
if ("toJSON" in e && typeof e.toJSON == "function") {
|
|
55
|
+
let t = e.toJSON();
|
|
56
|
+
return r + (typeof t == "object" && t ? this.$object(t) : `(${this.serialize(t)})`);
|
|
57
|
+
}
|
|
58
|
+
let i = Object.keys(e).sort(o), a = `${r}{`;
|
|
59
|
+
for (let t = 0; t < i.length; t++) {
|
|
60
|
+
let n = i[t];
|
|
61
|
+
a += `${n}:${this.serialize(e[n])}`, t < i.length - 1 && (a += ",");
|
|
62
|
+
}
|
|
63
|
+
return a + "}";
|
|
64
|
+
}
|
|
65
|
+
serializeBuiltInType(e, t) {
|
|
66
|
+
let n = this["$" + e];
|
|
67
|
+
if (n) return n.call(this, t);
|
|
68
|
+
if (typeof t.entries == "function") return this.serializeObjectEntries(e, t.entries());
|
|
69
|
+
throw Error(`Cannot serialize ${e}`);
|
|
70
|
+
}
|
|
71
|
+
serializeObjectEntries(e, t) {
|
|
72
|
+
let n = Array.from(t).sort((e, t) => this.compare(e[0], t[0])), r = `${e}{`;
|
|
73
|
+
for (let e = 0; e < n.length; e++) {
|
|
74
|
+
let [t, i] = n[e];
|
|
75
|
+
r += `${this.serialize(t, !0)}:${this.serialize(i)}`, e < n.length - 1 && (r += ",");
|
|
76
|
+
}
|
|
77
|
+
return r + "}";
|
|
78
|
+
}
|
|
79
|
+
$object(e) {
|
|
80
|
+
let t = this.#e.get(e);
|
|
81
|
+
return t === void 0 && (this.#e.set(e, `#${this.#e.size}`), t = this.serializeObject(e), this.#e.set(e, t)), t;
|
|
82
|
+
}
|
|
83
|
+
$function(e) {
|
|
84
|
+
let t = Function.prototype.toString.call(e);
|
|
85
|
+
return t.slice(-15) === "[native code] }" ? `${e.name || ""}()[native]` : `${e.name}(${e.length})${t.replace(/\s*\n\s*/g, "")}`;
|
|
86
|
+
}
|
|
87
|
+
$Array(e) {
|
|
88
|
+
let t = "[";
|
|
89
|
+
for (let n = 0; n < e.length; n++) t += this.serialize(e[n]), n < e.length - 1 && (t += ",");
|
|
90
|
+
return t + "]";
|
|
91
|
+
}
|
|
92
|
+
$Date(e) {
|
|
93
|
+
try {
|
|
94
|
+
return `Date(${e.toISOString()})`;
|
|
95
|
+
} catch {
|
|
96
|
+
return "Date(null)";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
$ArrayBuffer(e) {
|
|
100
|
+
return `ArrayBuffer[${new Uint8Array(e).join(",")}]`;
|
|
101
|
+
}
|
|
102
|
+
$Set(e) {
|
|
103
|
+
return `Set${this.$Array(Array.from(e).sort((e, t) => this.compare(e, t)))}`;
|
|
104
|
+
}
|
|
105
|
+
$Map(e) {
|
|
106
|
+
return this.serializeObjectEntries("Map", e.entries());
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (let t of [
|
|
110
|
+
"Error",
|
|
111
|
+
"RegExp",
|
|
112
|
+
"URL"
|
|
113
|
+
]) e.prototype["$" + t] = function(e) {
|
|
114
|
+
return `${t}(${e})`;
|
|
115
|
+
};
|
|
116
|
+
for (let t of [
|
|
117
|
+
"Int8Array",
|
|
118
|
+
"Uint8Array",
|
|
119
|
+
"Uint8ClampedArray",
|
|
120
|
+
"Int16Array",
|
|
121
|
+
"Uint16Array",
|
|
122
|
+
"Int32Array",
|
|
123
|
+
"Uint32Array",
|
|
124
|
+
"Float32Array",
|
|
125
|
+
"Float64Array"
|
|
126
|
+
]) e.prototype["$" + t] = function(e) {
|
|
127
|
+
return `${t}[${e.join(",")}]`;
|
|
128
|
+
};
|
|
129
|
+
for (let t of ["BigInt64Array", "BigUint64Array"]) e.prototype["$" + t] = function(e) {
|
|
130
|
+
return `${t}[${e.join("n,")}${e.length > 0 ? "n" : ""}]`;
|
|
131
|
+
};
|
|
132
|
+
return e;
|
|
133
|
+
})(), c = globalThis.process?.getBuiltinModule?.("crypto")?.hash, l = "sha256", u = "base64url";
|
|
134
|
+
function d(t) {
|
|
135
|
+
if (c) return c(l, t, u);
|
|
136
|
+
let n = e(l).update(t);
|
|
137
|
+
return globalThis.process?.versions?.webcontainer ? n.digest().toString(u) : n.digest(u);
|
|
138
|
+
}
|
|
139
|
+
var f = /* @__PURE__ */ n({ digest: () => d }), p = /* @__PURE__ */ n({ diff: () => h }), m = "__proto__";
|
|
140
|
+
function h(e, t) {
|
|
141
|
+
let n = [];
|
|
142
|
+
return g(e, t, "", n), n;
|
|
143
|
+
}
|
|
144
|
+
function g(e, t, n, r) {
|
|
145
|
+
if (e === t) return;
|
|
146
|
+
let i = typeof e != "object" || !e, a = typeof t != "object" || !t;
|
|
147
|
+
if (!i && !a) {
|
|
148
|
+
let i = _(e), a = _(t);
|
|
149
|
+
for (let [e, t] of i) {
|
|
150
|
+
let i = n ? `${n}.${e}` : e;
|
|
151
|
+
a.has(e) ? g(t, a.get(e), i, r) : r.push(new S(i, "removed", void 0, b(t, i)));
|
|
152
|
+
}
|
|
153
|
+
for (let [e, t] of a) {
|
|
154
|
+
if (i.has(e)) continue;
|
|
155
|
+
let a = n ? `${n}.${e}` : e;
|
|
156
|
+
r.push(new S(a, "added", b(t, a)));
|
|
157
|
+
}
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (v(e, i) || v(t, a)) return;
|
|
161
|
+
let o = y(e, n, i), s = y(t, n, a);
|
|
162
|
+
o.hash !== s.hash && r.push(new S(n, "changed", s, o));
|
|
163
|
+
}
|
|
164
|
+
function _(e) {
|
|
165
|
+
let t = /* @__PURE__ */ new Map();
|
|
166
|
+
for (let n in e) n !== m && t.set(n, e[n]);
|
|
167
|
+
return t;
|
|
168
|
+
}
|
|
169
|
+
function v(e, t) {
|
|
170
|
+
if (t) return !1;
|
|
171
|
+
for (let t in e) if (t !== m) return !0;
|
|
172
|
+
return !1;
|
|
173
|
+
}
|
|
174
|
+
function y(e, t, n) {
|
|
175
|
+
return n ? new C(t, e, x(e)) : new C(t, e, "{}", Object.create(null));
|
|
176
|
+
}
|
|
177
|
+
function b(e, t = "") {
|
|
178
|
+
if (typeof e != "object" || !e) return new C(t, e, x(e));
|
|
179
|
+
let n = Object.create(null), r = [];
|
|
180
|
+
for (let i in e) {
|
|
181
|
+
if (i === m) continue;
|
|
182
|
+
let a = b(e[i], t ? `${t}.${i}` : i);
|
|
183
|
+
n[i] = a, r.push(a.hash);
|
|
184
|
+
}
|
|
185
|
+
return new C(t, e, `{${r.join(":")}}`, n);
|
|
186
|
+
}
|
|
187
|
+
function x(e) {
|
|
188
|
+
switch (typeof e) {
|
|
189
|
+
case "string": return `'${e}'`;
|
|
190
|
+
case "number":
|
|
191
|
+
case "boolean": return "" + e;
|
|
192
|
+
case "bigint": return `${e}n`;
|
|
193
|
+
default: return r(e);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
var S = class {
|
|
197
|
+
key;
|
|
198
|
+
type;
|
|
199
|
+
newValue;
|
|
200
|
+
oldValue;
|
|
201
|
+
constructor(e, t, n, r) {
|
|
202
|
+
this.key = e, this.type = t, this.newValue = n, this.oldValue = r;
|
|
203
|
+
}
|
|
204
|
+
toString() {
|
|
205
|
+
return this.toJSON();
|
|
206
|
+
}
|
|
207
|
+
toJSON() {
|
|
208
|
+
switch (this.type) {
|
|
209
|
+
case "added": return `Added \`${this.key}\``;
|
|
210
|
+
case "removed": return `Removed \`${this.key}\``;
|
|
211
|
+
case "changed": return `Changed \`${this.key}\` from \`${this.oldValue?.toString() || "-"}\` to \`${this.newValue?.toString()}\``;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}, C = class {
|
|
215
|
+
key;
|
|
216
|
+
value;
|
|
217
|
+
hash;
|
|
218
|
+
props;
|
|
219
|
+
constructor(e, t, n, r) {
|
|
220
|
+
this.key = e, this.value = t, this.hash = n, this.props = r;
|
|
221
|
+
}
|
|
222
|
+
toString() {
|
|
223
|
+
return this.props ? `{${Object.keys(this.props).join(",")}}` : JSON.stringify(this.value);
|
|
224
|
+
}
|
|
225
|
+
toJSON() {
|
|
226
|
+
let e = this.key || ".";
|
|
227
|
+
return this.props ? `${e}({${Object.keys(this.props).join(",")}})` : `${e}(${this.value})`;
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
//#endregion
|
|
231
|
+
export { f as dist_exports, p as utils_exports };
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { n as e, t } from "./_format-BKs7bsc4.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/confbox@0.3.1/node_modules/confbox/dist/_chunks/libs/smol-toml.mjs
|
|
3
|
+
var n = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i, r = class e extends Date {
|
|
4
|
+
#e = !1;
|
|
5
|
+
#t = !1;
|
|
6
|
+
#n = null;
|
|
7
|
+
constructor(e) {
|
|
8
|
+
let t = !0, r = !0, i = "Z";
|
|
9
|
+
if (typeof e == "string") {
|
|
10
|
+
let a = e.match(n);
|
|
11
|
+
a ? (a[1] || (t = !1, e = `0000-01-01T${e}`), r = !!a[2], r && e[10] === " " && (e = e.replace(" ", "T")), a[2] && +a[2] > 23 ? e = "" : (i = a[3] || null, e = e.toUpperCase(), !i && r && (e += "Z"))) : e = "";
|
|
12
|
+
}
|
|
13
|
+
super(e), isNaN(this.getTime()) || (this.#e = t, this.#t = r, this.#n = i);
|
|
14
|
+
}
|
|
15
|
+
isDateTime() {
|
|
16
|
+
return this.#e && this.#t;
|
|
17
|
+
}
|
|
18
|
+
isLocal() {
|
|
19
|
+
return !this.#e || !this.#t || !this.#n;
|
|
20
|
+
}
|
|
21
|
+
isDate() {
|
|
22
|
+
return this.#e && !this.#t;
|
|
23
|
+
}
|
|
24
|
+
isTime() {
|
|
25
|
+
return this.#t && !this.#e;
|
|
26
|
+
}
|
|
27
|
+
isValid() {
|
|
28
|
+
return this.#e || this.#t;
|
|
29
|
+
}
|
|
30
|
+
toISOString() {
|
|
31
|
+
let e = super.toISOString();
|
|
32
|
+
if (this.isDate()) return e.slice(0, 10);
|
|
33
|
+
if (this.isTime()) return e.slice(11, 23);
|
|
34
|
+
if (this.#n === null) return e.slice(0, -1);
|
|
35
|
+
if (this.#n === "Z") return e;
|
|
36
|
+
let t = this.#n.slice(1, 3) * 60 + +this.#n.slice(4, 6);
|
|
37
|
+
return t = this.#n[0] === "-" ? t : -t, (/* @__PURE__ */ new Date(this.getTime() - t * 6e4)).toISOString().slice(0, -1) + this.#n;
|
|
38
|
+
}
|
|
39
|
+
static wrapAsOffsetDateTime(t, n = "Z") {
|
|
40
|
+
let r = new e(t);
|
|
41
|
+
return r.#n = n, r;
|
|
42
|
+
}
|
|
43
|
+
static wrapAsLocalDateTime(t) {
|
|
44
|
+
let n = new e(t);
|
|
45
|
+
return n.#n = null, n;
|
|
46
|
+
}
|
|
47
|
+
static wrapAsLocalDate(t) {
|
|
48
|
+
let n = new e(t);
|
|
49
|
+
return n.#t = !1, n.#n = null, n;
|
|
50
|
+
}
|
|
51
|
+
static wrapAsLocalTime(t) {
|
|
52
|
+
let n = new e(t);
|
|
53
|
+
return n.#e = !1, n.#n = null, n;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
function i(e, t) {
|
|
57
|
+
let n = e.slice(0, t).split(/\r\n|\n|\r/g);
|
|
58
|
+
return [n.length, n.pop().length + 1];
|
|
59
|
+
}
|
|
60
|
+
function a(e, t, n) {
|
|
61
|
+
let r = e.split(/\r\n|\n|\r/g), i = "", a = (Math.log10(t + 1) | 0) + 1;
|
|
62
|
+
for (let e = t - 1; e <= t + 1; e++) {
|
|
63
|
+
let o = r[e - 1];
|
|
64
|
+
o && (i += e.toString().padEnd(a, " "), i += ": ", i += o, i += "\n", e === t && (i += " ".repeat(a + n + 2), i += "^\n"));
|
|
65
|
+
}
|
|
66
|
+
return i;
|
|
67
|
+
}
|
|
68
|
+
var o = class extends Error {
|
|
69
|
+
line;
|
|
70
|
+
column;
|
|
71
|
+
codeblock;
|
|
72
|
+
constructor(e, t) {
|
|
73
|
+
let [n, r] = i(t.toml, t.ptr), o = a(t.toml, n, r);
|
|
74
|
+
super(`Invalid TOML document: ${e}\n\n${o}`, t), this.line = n, this.column = r, this.codeblock = o;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
function s(e, t = 0) {
|
|
78
|
+
let n = e.indexOf("\n", t);
|
|
79
|
+
return e.charCodeAt(n - 1) === 13 && n--, n;
|
|
80
|
+
}
|
|
81
|
+
function c(e) {
|
|
82
|
+
for (; e.p < e.s.length; e.p++) {
|
|
83
|
+
let t = e.s.charCodeAt(e.p);
|
|
84
|
+
if (t === 10) break;
|
|
85
|
+
if (t === 13 && e.s.charCodeAt(e.p + 1) === 10) {
|
|
86
|
+
e.p++;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
if (t < 32 && t !== 9 || t === 127) throw new o("control characters are not allowed in comments", {
|
|
90
|
+
toml: e.s,
|
|
91
|
+
ptr: e.p
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function l(e, t, n) {
|
|
96
|
+
let r;
|
|
97
|
+
for (;;) {
|
|
98
|
+
for (; (r = e.s.charCodeAt(e.p)) === 32 || r === 9 || !t && (r === 10 || r === 13 && e.s.charCodeAt(e.p + 1) === 10);) e.p++;
|
|
99
|
+
if (n || r !== 35) break;
|
|
100
|
+
c(e);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function u(e, t, n) {
|
|
104
|
+
let r = e.p;
|
|
105
|
+
if (!n) {
|
|
106
|
+
r = s(e.s, r), e.p = r < 0 ? e.s.length : r;
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
for (; e.p < e.s.length; e.p++) {
|
|
110
|
+
let r = e.s.charCodeAt(e.p);
|
|
111
|
+
if (r === 35) c(e);
|
|
112
|
+
else if (r === n || r === t) return;
|
|
113
|
+
}
|
|
114
|
+
throw new o("cannot find end of structure", {
|
|
115
|
+
toml: e.s,
|
|
116
|
+
ptr: r
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
var d = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/, f = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/, p = /^[+-]?0[0-9_]/;
|
|
120
|
+
function m(e) {
|
|
121
|
+
let t = e.p, n = e.s.charCodeAt(e.p++), r = n, i = n === 39, a = n === e.s.charCodeAt(e.p) && n === e.s.charCodeAt(e.p + 1);
|
|
122
|
+
a && ((n = e.s.charCodeAt(e.p += 2)) === 10 ? e.p++ : n === 13 && e.s.charCodeAt(e.p + 1) === 10 && (e.p += 2));
|
|
123
|
+
let s = "", c = e.p, l = 0;
|
|
124
|
+
for (; e.p < e.s.length; e.p++) if (n = e.s.charCodeAt(e.p), a && (n === 10 || n === 13 && e.s.charCodeAt(e.p + 1) === 10)) l &&= 3;
|
|
125
|
+
else if (n < 32 && n !== 9 || n === 127) throw new o("control characters are not allowed in strings", {
|
|
126
|
+
toml: e.s,
|
|
127
|
+
ptr: e.p
|
|
128
|
+
});
|
|
129
|
+
else if ((!l || l === 3) && n === r && (!a || e.s.charCodeAt(e.p + 1) === r && e.s.charCodeAt(e.p + 2) === r)) return a && (e.s.charCodeAt(e.p + 3) === r && e.p++, e.s.charCodeAt(e.p + 3) === r && e.p++), l || (s += e.s.slice(c, e.p)), e.p += a ? 3 : 1, s;
|
|
130
|
+
else if (!l) !i && n === 92 && (s += e.s.slice(c, c = e.p), l = 1);
|
|
131
|
+
else if (l === 1) {
|
|
132
|
+
if (n === 120 || n === 117 || n === 85) {
|
|
133
|
+
let t = 0, r = n === 120 ? 2 : n === 117 ? 4 : 8;
|
|
134
|
+
for (let n = 0; n < r; n++, e.p++) {
|
|
135
|
+
let n = e.s.charCodeAt(e.p + 1), r = n >= 48 && n <= 57 ? n - 48 : n >= 65 && n <= 70 ? n - 65 + 10 : n >= 97 && n <= 102 ? n - 97 + 10 : -1;
|
|
136
|
+
if (r < 0) throw new o("invalid non-hex character in unicode escape", {
|
|
137
|
+
toml: e.s,
|
|
138
|
+
ptr: e.p + 1
|
|
139
|
+
});
|
|
140
|
+
t = t << 4 | r;
|
|
141
|
+
}
|
|
142
|
+
if (t < 0 || t > 1114111 || t >= 55296 && t <= 57343) throw new o("invalid unicode escape", {
|
|
143
|
+
toml: e.s,
|
|
144
|
+
ptr: e.p
|
|
145
|
+
});
|
|
146
|
+
s += String.fromCodePoint(t), c = e.p + 1, l = 0;
|
|
147
|
+
} else if (n === 32 || n === 9) l = 2;
|
|
148
|
+
else {
|
|
149
|
+
if (n === 98) s += "\b";
|
|
150
|
+
else if (n === 116) s += " ";
|
|
151
|
+
else if (n === 110) s += "\n";
|
|
152
|
+
else if (n === 102) s += "\f";
|
|
153
|
+
else if (n === 114) s += "\r";
|
|
154
|
+
else if (n === 101) s += "\x1B";
|
|
155
|
+
else if (n === 34) s += "\"";
|
|
156
|
+
else if (n === 92) s += "\\";
|
|
157
|
+
else throw new o("unrecognized escape sequence", {
|
|
158
|
+
toml: e.s,
|
|
159
|
+
ptr: e.p
|
|
160
|
+
});
|
|
161
|
+
c = e.p + 1, l = 0;
|
|
162
|
+
}
|
|
163
|
+
} else if (n !== 32 && n !== 9) {
|
|
164
|
+
if (l === 2) throw new o("invalid escape: only line-ending whitespace may be escaped", {
|
|
165
|
+
toml: e.s,
|
|
166
|
+
ptr: c
|
|
167
|
+
});
|
|
168
|
+
l = +(!i && n === 92), c = e.p;
|
|
169
|
+
}
|
|
170
|
+
throw new o("unfinished string", {
|
|
171
|
+
toml: e.s,
|
|
172
|
+
ptr: t
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function h(e, t, n) {
|
|
176
|
+
let r = e.s.slice(t, n), i = r.indexOf("#");
|
|
177
|
+
return i > 0 && (c({
|
|
178
|
+
s: r,
|
|
179
|
+
p: i,
|
|
180
|
+
d: 0
|
|
181
|
+
}), r = r.slice(0, i)), r.trimEnd();
|
|
182
|
+
}
|
|
183
|
+
function g(e, t, n) {
|
|
184
|
+
let i = e.p, a = {
|
|
185
|
+
toml: e.s,
|
|
186
|
+
ptr: i
|
|
187
|
+
};
|
|
188
|
+
u(e, 44, n);
|
|
189
|
+
let s = h(e, i, e.p);
|
|
190
|
+
if (!s) throw new o("incomplete declaration: value expected", a);
|
|
191
|
+
if (s === "-inf") return -1 / 0;
|
|
192
|
+
if (s === "inf" || s === "+inf") return 1 / 0;
|
|
193
|
+
if (s === "nan" || s === "+nan" || s === "-nan") return NaN;
|
|
194
|
+
if (s === "-0") return t ? 0n : 0;
|
|
195
|
+
let c = d.test(s);
|
|
196
|
+
if (c || f.test(s)) {
|
|
197
|
+
if (p.test(s)) throw new o("leading zeroes are not allowed", a);
|
|
198
|
+
s = s.replace(/_/g, "");
|
|
199
|
+
let e = +s;
|
|
200
|
+
if (isNaN(e)) throw new o("invalid number", a);
|
|
201
|
+
if (c) {
|
|
202
|
+
if ((c = !Number.isSafeInteger(e)) && !t) throw new o("integer value cannot be represented losslessly", a);
|
|
203
|
+
(c || t === !0) && (e = BigInt(s));
|
|
204
|
+
}
|
|
205
|
+
return e;
|
|
206
|
+
}
|
|
207
|
+
let l = new r(s);
|
|
208
|
+
if (!l.isValid()) throw new o("invalid value", a);
|
|
209
|
+
return l;
|
|
210
|
+
}
|
|
211
|
+
function _(e, t, n) {
|
|
212
|
+
let r = e.p, i = e.s.charCodeAt(r);
|
|
213
|
+
if (i === 91 || i === 123) {
|
|
214
|
+
if (!e.d--) throw new o("document contains excessively nested structures. aborting.", {
|
|
215
|
+
toml: e.s,
|
|
216
|
+
ptr: r
|
|
217
|
+
});
|
|
218
|
+
let t = i === 91 ? x(e, n) : b(e, n);
|
|
219
|
+
return e.d++, t;
|
|
220
|
+
}
|
|
221
|
+
if (i === 34 || i === 39) return m(e);
|
|
222
|
+
if (i === 116) {
|
|
223
|
+
if (e.s.charCodeAt(++e.p) !== 114 || e.s.charCodeAt(++e.p) !== 117 || e.s.charCodeAt(++e.p) !== 101) throw new o("invalid value", {
|
|
224
|
+
toml: e.s,
|
|
225
|
+
ptr: r
|
|
226
|
+
});
|
|
227
|
+
return e.p++, !0;
|
|
228
|
+
}
|
|
229
|
+
if (i === 102) {
|
|
230
|
+
if (e.s.charCodeAt(++e.p) !== 97 || e.s.charCodeAt(++e.p) !== 108 || e.s.charCodeAt(++e.p) !== 115 || e.s.charCodeAt(++e.p) !== 101) throw new o("invalid value", {
|
|
231
|
+
toml: e.s,
|
|
232
|
+
ptr: r
|
|
233
|
+
});
|
|
234
|
+
return e.p++, !1;
|
|
235
|
+
}
|
|
236
|
+
return g(e, n, t);
|
|
237
|
+
}
|
|
238
|
+
var v = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
239
|
+
function y(e, t = "=") {
|
|
240
|
+
let n = e.p, r = n - 1, i = [], a = e.s.indexOf(t, n);
|
|
241
|
+
if (a < 0) throw new o("incomplete key-value: cannot find end of key", {
|
|
242
|
+
toml: e.s,
|
|
243
|
+
ptr: n
|
|
244
|
+
});
|
|
245
|
+
do {
|
|
246
|
+
let c = e.s.charCodeAt(e.p = ++r);
|
|
247
|
+
if (c !== 32 && c !== 9) {
|
|
248
|
+
if (c === 34 || c === 39) {
|
|
249
|
+
if (c === e.s.charCodeAt(e.p + 1) && c === e.s.charCodeAt(e.p + 2)) throw new o("multiline strings are not allowed in keys", {
|
|
250
|
+
toml: e.s,
|
|
251
|
+
ptr: e.p
|
|
252
|
+
});
|
|
253
|
+
let l = m(e);
|
|
254
|
+
r = e.s.indexOf(".", e.p);
|
|
255
|
+
let u = e.s.slice(e.p, r < 0 || r > a ? a : r), d = s(u);
|
|
256
|
+
if (d > -1) throw new o("newlines are not allowed in keys", {
|
|
257
|
+
toml: e.s,
|
|
258
|
+
ptr: d
|
|
259
|
+
});
|
|
260
|
+
if (u.trimStart()) throw new o("found extra tokens after the string part", {
|
|
261
|
+
toml: e.s,
|
|
262
|
+
ptr: e.p
|
|
263
|
+
});
|
|
264
|
+
if (a < e.p && (a = e.s.indexOf(t, e.p), a < 0)) throw new o("incomplete key-value: cannot find end of key", {
|
|
265
|
+
toml: e.s,
|
|
266
|
+
ptr: n
|
|
267
|
+
});
|
|
268
|
+
i.push(l);
|
|
269
|
+
} else {
|
|
270
|
+
r = e.s.indexOf(".", e.p);
|
|
271
|
+
let t = e.s.slice(e.p, r < 0 || r > a ? a : r);
|
|
272
|
+
if (!v.test(t)) throw new o("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
273
|
+
toml: e.s,
|
|
274
|
+
ptr: e.p
|
|
275
|
+
});
|
|
276
|
+
i.push(t.trimEnd());
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
} while (r + 1 && r < a);
|
|
280
|
+
return e.p = a + 1, l(e, !0, !0), i;
|
|
281
|
+
}
|
|
282
|
+
function b(e, t) {
|
|
283
|
+
let n = {}, r = /* @__PURE__ */ new Set(), i;
|
|
284
|
+
for (e.p++; e.p < e.s.length;) {
|
|
285
|
+
if (l(e), (i = e.s.charCodeAt(e.p)) === 125) return e.p++, n;
|
|
286
|
+
let a, s = n, c = !1, u = e.p, d = y(e);
|
|
287
|
+
for (let t = 0; t < d.length; t++) {
|
|
288
|
+
if (t && (s = c ? s[a] : s[a] = {}), a = d[t], (c = Object.hasOwn(s, a)) && (typeof s[a] != "object" || r.has(s[a]))) throw new o("trying to redefine an already defined value", {
|
|
289
|
+
toml: e.s,
|
|
290
|
+
ptr: u
|
|
291
|
+
});
|
|
292
|
+
!c && a === "__proto__" && Object.defineProperty(s, a, {
|
|
293
|
+
enumerable: !0,
|
|
294
|
+
configurable: !0,
|
|
295
|
+
writable: !0
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
if (c) throw new o("trying to redefine an already defined value", {
|
|
299
|
+
toml: e.s,
|
|
300
|
+
ptr: e.p
|
|
301
|
+
});
|
|
302
|
+
let f = _(e, 125, t);
|
|
303
|
+
if (r.add(s[a] = f), l(e), (i = e.s.charCodeAt(e.p++)) === 125) return n;
|
|
304
|
+
if (i !== 44) throw new o("expected comma or end of structure", {
|
|
305
|
+
toml: e.s,
|
|
306
|
+
ptr: e.p - 1
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
throw new o("unfinished table encountered", {
|
|
310
|
+
toml: e.s,
|
|
311
|
+
ptr: e.p
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
function x(e, t) {
|
|
315
|
+
let n = [], r;
|
|
316
|
+
for (e.p++; e.p < e.s.length;) {
|
|
317
|
+
if (l(e), (r = e.s.charCodeAt(e.p)) === 93) return e.p++, n;
|
|
318
|
+
if (n.push(_(e, 93, t)), l(e), (r = e.s.charCodeAt(e.p++)) === 93) return n;
|
|
319
|
+
if (r !== 44) throw new o("expected comma or end of structure", {
|
|
320
|
+
toml: e.s,
|
|
321
|
+
ptr: e.p - 1
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
throw new o("unfinished array encountered", {
|
|
325
|
+
toml: e.s,
|
|
326
|
+
ptr: e.p
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
function S(e, t, n, r) {
|
|
330
|
+
let i = t, a = n, o, s = !1, c;
|
|
331
|
+
for (let t = 0; t < e.length; t++) {
|
|
332
|
+
if (t) {
|
|
333
|
+
if (i = s ? i[o] : i[o] = {}, a = (c = a[o]).c, r === 0 && (c.t === 1 || c.t === 2)) return null;
|
|
334
|
+
if (c.t === 2) {
|
|
335
|
+
let e = i.length - 1;
|
|
336
|
+
i = i[e], a = a[e].c;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
if (o = e[t], (s = Object.hasOwn(i, o)) && a[o]?.t === 0 && a[o]?.d) return null;
|
|
340
|
+
s || (o === "__proto__" && (Object.defineProperty(i, o, {
|
|
341
|
+
enumerable: !0,
|
|
342
|
+
configurable: !0,
|
|
343
|
+
writable: !0
|
|
344
|
+
}), Object.defineProperty(a, o, {
|
|
345
|
+
enumerable: !0,
|
|
346
|
+
configurable: !0,
|
|
347
|
+
writable: !0
|
|
348
|
+
})), a[o] = {
|
|
349
|
+
t: t < e.length - 1 && r === 2 ? 3 : r,
|
|
350
|
+
d: !1,
|
|
351
|
+
i: 0,
|
|
352
|
+
c: {}
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
if (c = a[o], c.t !== r && (r !== 1 || c.t !== 3) || (r === 2 && (c.d || (c.d = !0, i[o] = []), i[o].push(i = {}), c.c[c.i++] = c = {
|
|
356
|
+
t: 1,
|
|
357
|
+
d: !1,
|
|
358
|
+
i: 0,
|
|
359
|
+
c: {}
|
|
360
|
+
}), c.d)) return null;
|
|
361
|
+
if (c.d = !0, r === 1) i = s ? i[o] : i[o] = {};
|
|
362
|
+
else if (r === 0 && s) return null;
|
|
363
|
+
return [
|
|
364
|
+
o,
|
|
365
|
+
i,
|
|
366
|
+
c.c
|
|
367
|
+
];
|
|
368
|
+
}
|
|
369
|
+
function C(e, { maxDepth: t = 1e3, integersAsBigInt: n } = {}) {
|
|
370
|
+
let r = {
|
|
371
|
+
s: e,
|
|
372
|
+
p: 0,
|
|
373
|
+
d: t
|
|
374
|
+
}, i = {}, a = {}, s, c = i, u = a;
|
|
375
|
+
for (l(r); r.p < e.length;) {
|
|
376
|
+
if (e.charCodeAt(r.p) === 91) {
|
|
377
|
+
let t = e.charCodeAt(++r.p) === 91;
|
|
378
|
+
s = r.p += +t;
|
|
379
|
+
let n = y(r, "]");
|
|
380
|
+
if (t) {
|
|
381
|
+
if (e.charCodeAt(r.p - 1) !== 93) throw new o("expected end of table declaration", {
|
|
382
|
+
toml: e,
|
|
383
|
+
ptr: r.p - 1
|
|
384
|
+
});
|
|
385
|
+
r.p++;
|
|
386
|
+
}
|
|
387
|
+
let l = S(n, i, a, t ? 2 : 1);
|
|
388
|
+
if (!l) throw new o("trying to redefine an already defined table or value", {
|
|
389
|
+
toml: e,
|
|
390
|
+
ptr: s
|
|
391
|
+
});
|
|
392
|
+
u = l[2], c = l[1];
|
|
393
|
+
} else {
|
|
394
|
+
s = r.p;
|
|
395
|
+
let t = S(y(r), c, u, 0);
|
|
396
|
+
if (!t) throw new o("trying to redefine an already defined table or value", {
|
|
397
|
+
toml: e,
|
|
398
|
+
ptr: s
|
|
399
|
+
});
|
|
400
|
+
t[1][t[0]] = _(r, void 0, n);
|
|
401
|
+
}
|
|
402
|
+
if (l(r, !0), r.p < e.length && (s = e.charCodeAt(r.p)) !== 10 && s !== 13) throw new o("each key-value declaration must be followed by an end-of-line", {
|
|
403
|
+
toml: e,
|
|
404
|
+
ptr: r.p
|
|
405
|
+
});
|
|
406
|
+
l(r);
|
|
407
|
+
}
|
|
408
|
+
return i;
|
|
409
|
+
}
|
|
410
|
+
//#endregion
|
|
411
|
+
//#region ../../node_modules/.pnpm/confbox@0.3.1/node_modules/confbox/dist/toml.mjs
|
|
412
|
+
function w(n) {
|
|
413
|
+
let r = C(t(n));
|
|
414
|
+
return e(n, r, { preserveIndentation: !1 }), r;
|
|
415
|
+
}
|
|
416
|
+
//#endregion
|
|
417
|
+
export { w as parseTOML };
|