xcstrings-cli 2.6.0 → 2.7.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/README.md +112 -86
- package/dist/index.js +1328 -1002
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import { hideBin as
|
|
4
|
-
import { resolve as
|
|
5
|
-
import { cosmiconfig as
|
|
6
|
-
import
|
|
7
|
-
import { select as
|
|
8
|
-
import
|
|
9
|
-
import { readFile as
|
|
10
|
-
import { XcodeProject as
|
|
11
|
-
function
|
|
2
|
+
import Kr from "yargs";
|
|
3
|
+
import { hideBin as Wr } from "yargs/helpers";
|
|
4
|
+
import { resolve as Ne, relative as ke, dirname as yn, basename as qr, join as Ee, extname as Gr } from "node:path";
|
|
5
|
+
import { cosmiconfig as Vr } from "cosmiconfig";
|
|
6
|
+
import He from "json5";
|
|
7
|
+
import { select as Xr, editor as Jr, checkbox as vn, confirm as Qr } from "@inquirer/prompts";
|
|
8
|
+
import S from "chalk";
|
|
9
|
+
import { readFile as Ke, writeFile as Ze, readdir as en, rm as Yn, mkdir as xn, stat as Zr } from "node:fs/promises";
|
|
10
|
+
import { XcodeProject as ei } from "@bacons/xcode";
|
|
11
|
+
function Hn(e) {
|
|
12
12
|
return typeof e > "u" || e === null;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function ni(e) {
|
|
15
15
|
return typeof e == "object" && e !== null;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return Array.isArray(e) ? e :
|
|
17
|
+
function ri(e) {
|
|
18
|
+
return Array.isArray(e) ? e : Hn(e) ? [] : [e];
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function ii(e, n) {
|
|
21
21
|
var r, i, t, o;
|
|
22
22
|
if (n)
|
|
23
23
|
for (o = Object.keys(n), r = 0, i = o.length; r < i; r += 1)
|
|
24
24
|
t = o[r], e[t] = n[t];
|
|
25
25
|
return e;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function ti(e, n) {
|
|
28
28
|
var r = "", i;
|
|
29
29
|
for (i = 0; i < n; i += 1)
|
|
30
30
|
r += e;
|
|
31
31
|
return r;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function oi(e) {
|
|
34
34
|
return e === 0 && Number.NEGATIVE_INFINITY === 1 / e;
|
|
35
35
|
}
|
|
36
|
-
var
|
|
37
|
-
isNothing:
|
|
38
|
-
isObject:
|
|
39
|
-
toArray:
|
|
40
|
-
repeat:
|
|
41
|
-
isNegativeZero:
|
|
42
|
-
extend:
|
|
36
|
+
var li = Hn, ai = ni, si = ri, ci = ti, ui = oi, fi = ii, T = {
|
|
37
|
+
isNothing: li,
|
|
38
|
+
isObject: ai,
|
|
39
|
+
toArray: si,
|
|
40
|
+
repeat: ci,
|
|
41
|
+
isNegativeZero: ui,
|
|
42
|
+
extend: fi
|
|
43
43
|
};
|
|
44
|
-
function
|
|
44
|
+
function Kn(e, n) {
|
|
45
45
|
var r = "", i = e.reason || "(unknown reason)";
|
|
46
46
|
return e.mark ? (e.mark.name && (r += 'in "' + e.mark.name + '" '), r += "(" + (e.mark.line + 1) + ":" + (e.mark.column + 1) + ")", !n && e.mark.snippet && (r += `
|
|
47
47
|
|
|
48
48
|
` + e.mark.snippet), i + " " + r) : i;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
Error.call(this), this.name = "YAMLException", this.reason = e, this.mark = n, this.message =
|
|
50
|
+
function ge(e, n) {
|
|
51
|
+
Error.call(this), this.name = "YAMLException", this.reason = e, this.mark = n, this.message = Kn(this, !1), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack || "";
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return this.name + ": " +
|
|
53
|
+
ge.prototype = Object.create(Error.prototype);
|
|
54
|
+
ge.prototype.constructor = ge;
|
|
55
|
+
ge.prototype.toString = function(n) {
|
|
56
|
+
return this.name + ": " + Kn(this, n);
|
|
57
57
|
};
|
|
58
|
-
var M =
|
|
59
|
-
function
|
|
58
|
+
var M = ge;
|
|
59
|
+
function Me(e, n, r, i, t) {
|
|
60
60
|
var o = "", l = "", a = Math.floor(t / 2) - 1;
|
|
61
61
|
return i - n > a && (o = " ... ", n = i - a + o.length), r - i > a && (l = " ...", r = i + a - l.length), {
|
|
62
62
|
str: o + e.slice(n, r).replace(/\t/g, "→") + l,
|
|
@@ -64,39 +64,39 @@ function Re(e, n, r, i, t) {
|
|
|
64
64
|
// relative position
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function De(e, n) {
|
|
68
68
|
return T.repeat(" ", n - e.length) + e;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function pi(e, n) {
|
|
71
71
|
if (n = Object.create(n || null), !e.buffer) return null;
|
|
72
72
|
n.maxLength || (n.maxLength = 79), typeof n.indent != "number" && (n.indent = 1), typeof n.linesBefore != "number" && (n.linesBefore = 3), typeof n.linesAfter != "number" && (n.linesAfter = 2);
|
|
73
73
|
for (var r = /\r?\n|\r|\0/g, i = [0], t = [], o, l = -1; o = r.exec(e.buffer); )
|
|
74
74
|
t.push(o.index), i.push(o.index + o[0].length), e.position <= o.index && l < 0 && (l = i.length - 2);
|
|
75
75
|
l < 0 && (l = i.length - 1);
|
|
76
|
-
var a = "", s, c,
|
|
76
|
+
var a = "", s, c, f = Math.min(e.line + n.linesAfter, t.length).toString().length, u = n.maxLength - (n.indent + f + 3);
|
|
77
77
|
for (s = 1; s <= n.linesBefore && !(l - s < 0); s++)
|
|
78
|
-
c =
|
|
78
|
+
c = Me(
|
|
79
79
|
e.buffer,
|
|
80
80
|
i[l - s],
|
|
81
81
|
t[l - s],
|
|
82
82
|
e.position - (i[l] - i[l - s]),
|
|
83
|
-
|
|
84
|
-
), a = T.repeat(" ", n.indent) +
|
|
83
|
+
u
|
|
84
|
+
), a = T.repeat(" ", n.indent) + De((e.line - s + 1).toString(), f) + " | " + c.str + `
|
|
85
85
|
` + a;
|
|
86
|
-
for (c =
|
|
87
|
-
`, a += T.repeat("-", n.indent +
|
|
86
|
+
for (c = Me(e.buffer, i[l], t[l], e.position, u), a += T.repeat(" ", n.indent) + De((e.line + 1).toString(), f) + " | " + c.str + `
|
|
87
|
+
`, a += T.repeat("-", n.indent + f + 3 + c.pos) + `^
|
|
88
88
|
`, s = 1; s <= n.linesAfter && !(l + s >= t.length); s++)
|
|
89
|
-
c =
|
|
89
|
+
c = Me(
|
|
90
90
|
e.buffer,
|
|
91
91
|
i[l + s],
|
|
92
92
|
t[l + s],
|
|
93
93
|
e.position - (i[l] - i[l + s]),
|
|
94
|
-
|
|
95
|
-
), a += T.repeat(" ", n.indent) +
|
|
94
|
+
u
|
|
95
|
+
), a += T.repeat(" ", n.indent) + De((e.line + s + 1).toString(), f) + " | " + c.str + `
|
|
96
96
|
`;
|
|
97
97
|
return a.replace(/\n$/, "");
|
|
98
98
|
}
|
|
99
|
-
var
|
|
99
|
+
var di = pi, hi = [
|
|
100
100
|
"kind",
|
|
101
101
|
"multi",
|
|
102
102
|
"resolve",
|
|
@@ -107,12 +107,12 @@ var ri = ni, ii = [
|
|
|
107
107
|
"representName",
|
|
108
108
|
"defaultStyle",
|
|
109
109
|
"styleAliases"
|
|
110
|
-
],
|
|
110
|
+
], gi = [
|
|
111
111
|
"scalar",
|
|
112
112
|
"sequence",
|
|
113
113
|
"mapping"
|
|
114
114
|
];
|
|
115
|
-
function
|
|
115
|
+
function mi(e) {
|
|
116
116
|
var n = {};
|
|
117
117
|
return e !== null && Object.keys(e).forEach(function(r) {
|
|
118
118
|
e[r].forEach(function(i) {
|
|
@@ -120,19 +120,19 @@ function oi(e) {
|
|
|
120
120
|
});
|
|
121
121
|
}), n;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function yi(e, n) {
|
|
124
124
|
if (n = n || {}, Object.keys(n).forEach(function(r) {
|
|
125
|
-
if (
|
|
125
|
+
if (hi.indexOf(r) === -1)
|
|
126
126
|
throw new M('Unknown option "' + r + '" is met in definition of "' + e + '" YAML type.');
|
|
127
127
|
}), this.options = n, this.tag = e, this.kind = n.kind || null, this.resolve = n.resolve || function() {
|
|
128
128
|
return !0;
|
|
129
129
|
}, this.construct = n.construct || function(r) {
|
|
130
130
|
return r;
|
|
131
|
-
}, this.instanceOf = n.instanceOf || null, this.predicate = n.predicate || null, this.represent = n.represent || null, this.representName = n.representName || null, this.defaultStyle = n.defaultStyle || null, this.multi = n.multi || !1, this.styleAliases =
|
|
131
|
+
}, this.instanceOf = n.instanceOf || null, this.predicate = n.predicate || null, this.represent = n.represent || null, this.representName = n.representName || null, this.defaultStyle = n.defaultStyle || null, this.multi = n.multi || !1, this.styleAliases = mi(n.styleAliases || null), gi.indexOf(this.kind) === -1)
|
|
132
132
|
throw new M('Unknown kind "' + this.kind + '" is specified for "' + e + '" YAML type.');
|
|
133
133
|
}
|
|
134
|
-
var j =
|
|
135
|
-
function
|
|
134
|
+
var j = yi;
|
|
135
|
+
function wn(e, n) {
|
|
136
136
|
var r = [];
|
|
137
137
|
return e[n].forEach(function(i) {
|
|
138
138
|
var t = r.length;
|
|
@@ -141,7 +141,7 @@ function fn(e, n) {
|
|
|
141
141
|
}), r[t] = i;
|
|
142
142
|
}), r;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function vi() {
|
|
145
145
|
var e = {
|
|
146
146
|
scalar: {},
|
|
147
147
|
sequence: {},
|
|
@@ -161,10 +161,10 @@ function ai() {
|
|
|
161
161
|
arguments[n].forEach(i);
|
|
162
162
|
return e;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function We(e) {
|
|
165
165
|
return this.extend(e);
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
We.prototype.extend = function(n) {
|
|
168
168
|
var r = [], i = [];
|
|
169
169
|
if (n instanceof j)
|
|
170
170
|
i.push(n);
|
|
@@ -185,47 +185,47 @@ Ue.prototype.extend = function(n) {
|
|
|
185
185
|
if (!(o instanceof j))
|
|
186
186
|
throw new M("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
187
187
|
});
|
|
188
|
-
var t = Object.create(
|
|
189
|
-
return t.implicit = (this.implicit || []).concat(r), t.explicit = (this.explicit || []).concat(i), t.compiledImplicit =
|
|
188
|
+
var t = Object.create(We.prototype);
|
|
189
|
+
return t.implicit = (this.implicit || []).concat(r), t.explicit = (this.explicit || []).concat(i), t.compiledImplicit = wn(t, "implicit"), t.compiledExplicit = wn(t, "explicit"), t.compiledTypeMap = vi(t.compiledImplicit, t.compiledExplicit), t;
|
|
190
190
|
};
|
|
191
|
-
var
|
|
191
|
+
var Wn = We, qn = new j("tag:yaml.org,2002:str", {
|
|
192
192
|
kind: "scalar",
|
|
193
193
|
construct: function(e) {
|
|
194
194
|
return e !== null ? e : "";
|
|
195
195
|
}
|
|
196
|
-
}),
|
|
196
|
+
}), Gn = new j("tag:yaml.org,2002:seq", {
|
|
197
197
|
kind: "sequence",
|
|
198
198
|
construct: function(e) {
|
|
199
199
|
return e !== null ? e : [];
|
|
200
200
|
}
|
|
201
|
-
}),
|
|
201
|
+
}), Vn = new j("tag:yaml.org,2002:map", {
|
|
202
202
|
kind: "mapping",
|
|
203
203
|
construct: function(e) {
|
|
204
204
|
return e !== null ? e : {};
|
|
205
205
|
}
|
|
206
|
-
}),
|
|
206
|
+
}), Xn = new Wn({
|
|
207
207
|
explicit: [
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
qn,
|
|
209
|
+
Gn,
|
|
210
|
+
Vn
|
|
211
211
|
]
|
|
212
212
|
});
|
|
213
|
-
function
|
|
213
|
+
function xi(e) {
|
|
214
214
|
if (e === null) return !0;
|
|
215
215
|
var n = e.length;
|
|
216
216
|
return n === 1 && e === "~" || n === 4 && (e === "null" || e === "Null" || e === "NULL");
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function wi() {
|
|
219
219
|
return null;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function bi(e) {
|
|
222
222
|
return e === null;
|
|
223
223
|
}
|
|
224
|
-
var
|
|
224
|
+
var Jn = new j("tag:yaml.org,2002:null", {
|
|
225
225
|
kind: "scalar",
|
|
226
|
-
resolve:
|
|
227
|
-
construct:
|
|
228
|
-
predicate:
|
|
226
|
+
resolve: xi,
|
|
227
|
+
construct: wi,
|
|
228
|
+
predicate: bi,
|
|
229
229
|
represent: {
|
|
230
230
|
canonical: function() {
|
|
231
231
|
return "~";
|
|
@@ -245,22 +245,22 @@ var Hn = new j("tag:yaml.org,2002:null", {
|
|
|
245
245
|
},
|
|
246
246
|
defaultStyle: "lowercase"
|
|
247
247
|
});
|
|
248
|
-
function
|
|
248
|
+
function Ai(e) {
|
|
249
249
|
if (e === null) return !1;
|
|
250
250
|
var n = e.length;
|
|
251
251
|
return n === 4 && (e === "true" || e === "True" || e === "TRUE") || n === 5 && (e === "false" || e === "False" || e === "FALSE");
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function ki(e) {
|
|
254
254
|
return e === "true" || e === "True" || e === "TRUE";
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function Si(e) {
|
|
257
257
|
return Object.prototype.toString.call(e) === "[object Boolean]";
|
|
258
258
|
}
|
|
259
|
-
var
|
|
259
|
+
var Qn = new j("tag:yaml.org,2002:bool", {
|
|
260
260
|
kind: "scalar",
|
|
261
|
-
resolve:
|
|
262
|
-
construct:
|
|
263
|
-
predicate:
|
|
261
|
+
resolve: Ai,
|
|
262
|
+
construct: ki,
|
|
263
|
+
predicate: Si,
|
|
264
264
|
represent: {
|
|
265
265
|
lowercase: function(e) {
|
|
266
266
|
return e ? "true" : "false";
|
|
@@ -274,16 +274,16 @@ var Kn = new j("tag:yaml.org,2002:bool", {
|
|
|
274
274
|
},
|
|
275
275
|
defaultStyle: "lowercase"
|
|
276
276
|
});
|
|
277
|
-
function
|
|
277
|
+
function Ci(e) {
|
|
278
278
|
return 48 <= e && e <= 57 || 65 <= e && e <= 70 || 97 <= e && e <= 102;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function Ei(e) {
|
|
281
281
|
return 48 <= e && e <= 55;
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function Oi(e) {
|
|
284
284
|
return 48 <= e && e <= 57;
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function _i(e) {
|
|
287
287
|
if (e === null) return !1;
|
|
288
288
|
var n = e.length, r = 0, i = !1, t;
|
|
289
289
|
if (!n) return !1;
|
|
@@ -300,7 +300,7 @@ function yi(e) {
|
|
|
300
300
|
if (t === "x") {
|
|
301
301
|
for (r++; r < n; r++)
|
|
302
302
|
if (t = e[r], t !== "_") {
|
|
303
|
-
if (!
|
|
303
|
+
if (!Ci(e.charCodeAt(r))) return !1;
|
|
304
304
|
i = !0;
|
|
305
305
|
}
|
|
306
306
|
return i && t !== "_";
|
|
@@ -308,7 +308,7 @@ function yi(e) {
|
|
|
308
308
|
if (t === "o") {
|
|
309
309
|
for (r++; r < n; r++)
|
|
310
310
|
if (t = e[r], t !== "_") {
|
|
311
|
-
if (!
|
|
311
|
+
if (!Ei(e.charCodeAt(r))) return !1;
|
|
312
312
|
i = !0;
|
|
313
313
|
}
|
|
314
314
|
return i && t !== "_";
|
|
@@ -317,13 +317,13 @@ function yi(e) {
|
|
|
317
317
|
if (t === "_") return !1;
|
|
318
318
|
for (; r < n; r++)
|
|
319
319
|
if (t = e[r], t !== "_") {
|
|
320
|
-
if (!
|
|
320
|
+
if (!Oi(e.charCodeAt(r)))
|
|
321
321
|
return !1;
|
|
322
322
|
i = !0;
|
|
323
323
|
}
|
|
324
324
|
return !(!i || t === "_");
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function Fi(e) {
|
|
327
327
|
var n = e, r = 1, i;
|
|
328
328
|
if (n.indexOf("_") !== -1 && (n = n.replace(/_/g, "")), i = n[0], (i === "-" || i === "+") && (i === "-" && (r = -1), n = n.slice(1), i = n[0]), n === "0") return 0;
|
|
329
329
|
if (i === "0") {
|
|
@@ -333,14 +333,14 @@ function vi(e) {
|
|
|
333
333
|
}
|
|
334
334
|
return r * parseInt(n, 10);
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function Ti(e) {
|
|
337
337
|
return Object.prototype.toString.call(e) === "[object Number]" && e % 1 === 0 && !T.isNegativeZero(e);
|
|
338
338
|
}
|
|
339
|
-
var
|
|
339
|
+
var Zn = new j("tag:yaml.org,2002:int", {
|
|
340
340
|
kind: "scalar",
|
|
341
|
-
resolve:
|
|
342
|
-
construct:
|
|
343
|
-
predicate:
|
|
341
|
+
resolve: _i,
|
|
342
|
+
construct: Fi,
|
|
343
|
+
predicate: Ti,
|
|
344
344
|
represent: {
|
|
345
345
|
binary: function(e) {
|
|
346
346
|
return e >= 0 ? "0b" + e.toString(2) : "-0b" + e.toString(2).slice(1);
|
|
@@ -363,21 +363,21 @@ var Wn = new j("tag:yaml.org,2002:int", {
|
|
|
363
363
|
decimal: [10, "dec"],
|
|
364
364
|
hexadecimal: [16, "hex"]
|
|
365
365
|
}
|
|
366
|
-
}),
|
|
366
|
+
}), Li = new RegExp(
|
|
367
367
|
// 2.5e4, 2.5 and integers
|
|
368
368
|
"^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
369
369
|
);
|
|
370
|
-
function
|
|
371
|
-
return !(e === null || !
|
|
370
|
+
function ji(e) {
|
|
371
|
+
return !(e === null || !Li.test(e) || // Quick hack to not allow integers end with `_`
|
|
372
372
|
// Probably should update regexp & check speed
|
|
373
373
|
e[e.length - 1] === "_");
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function Ii(e) {
|
|
376
376
|
var n, r;
|
|
377
377
|
return n = e.replace(/_/g, "").toLowerCase(), r = n[0] === "-" ? -1 : 1, "+-".indexOf(n[0]) >= 0 && (n = n.slice(1)), n === ".inf" ? r === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY : n === ".nan" ? NaN : r * parseFloat(n, 10);
|
|
378
378
|
}
|
|
379
|
-
var
|
|
380
|
-
function
|
|
379
|
+
var Ni = /^[-+]?[0-9]+e/;
|
|
380
|
+
function Pi(e, n) {
|
|
381
381
|
var r;
|
|
382
382
|
if (isNaN(e))
|
|
383
383
|
switch (n) {
|
|
@@ -408,36 +408,36 @@ function Ci(e, n) {
|
|
|
408
408
|
}
|
|
409
409
|
else if (T.isNegativeZero(e))
|
|
410
410
|
return "-0.0";
|
|
411
|
-
return r = e.toString(10),
|
|
411
|
+
return r = e.toString(10), Ni.test(r) ? r.replace("e", ".e") : r;
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function Ri(e) {
|
|
414
414
|
return Object.prototype.toString.call(e) === "[object Number]" && (e % 1 !== 0 || T.isNegativeZero(e));
|
|
415
415
|
}
|
|
416
|
-
var
|
|
416
|
+
var er = new j("tag:yaml.org,2002:float", {
|
|
417
417
|
kind: "scalar",
|
|
418
|
-
resolve:
|
|
419
|
-
construct:
|
|
420
|
-
predicate:
|
|
421
|
-
represent:
|
|
418
|
+
resolve: ji,
|
|
419
|
+
construct: Ii,
|
|
420
|
+
predicate: Ri,
|
|
421
|
+
represent: Pi,
|
|
422
422
|
defaultStyle: "lowercase"
|
|
423
|
-
}),
|
|
423
|
+
}), nr = Xn.extend({
|
|
424
424
|
implicit: [
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
425
|
+
Jn,
|
|
426
|
+
Qn,
|
|
427
|
+
Zn,
|
|
428
|
+
er
|
|
429
429
|
]
|
|
430
|
-
}),
|
|
430
|
+
}), rr = nr, ir = new RegExp(
|
|
431
431
|
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
|
432
|
-
),
|
|
432
|
+
), tr = new RegExp(
|
|
433
433
|
"^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
|
|
434
434
|
);
|
|
435
|
-
function
|
|
436
|
-
return e === null ? !1 :
|
|
435
|
+
function Mi(e) {
|
|
436
|
+
return e === null ? !1 : ir.exec(e) !== null || tr.exec(e) !== null;
|
|
437
437
|
}
|
|
438
|
-
function
|
|
439
|
-
var n, r, i, t, o, l, a, s = 0, c = null,
|
|
440
|
-
if (n =
|
|
438
|
+
function Di(e) {
|
|
439
|
+
var n, r, i, t, o, l, a, s = 0, c = null, f, u, h;
|
|
440
|
+
if (n = ir.exec(e), n === null && (n = tr.exec(e)), n === null) throw new Error("Date resolve error");
|
|
441
441
|
if (r = +n[1], i = +n[2] - 1, t = +n[3], !n[4])
|
|
442
442
|
return new Date(Date.UTC(r, i, t));
|
|
443
443
|
if (o = +n[4], l = +n[5], a = +n[6], n[7]) {
|
|
@@ -445,29 +445,29 @@ function _i(e) {
|
|
|
445
445
|
s += "0";
|
|
446
446
|
s = +s;
|
|
447
447
|
}
|
|
448
|
-
return n[9] && (
|
|
448
|
+
return n[9] && (f = +n[10], u = +(n[11] || 0), c = (f * 60 + u) * 6e4, n[9] === "-" && (c = -c)), h = new Date(Date.UTC(r, i, t, o, l, a, s)), c && h.setTime(h.getTime() - c), h;
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function zi(e) {
|
|
451
451
|
return e.toISOString();
|
|
452
452
|
}
|
|
453
|
-
var
|
|
453
|
+
var or = new j("tag:yaml.org,2002:timestamp", {
|
|
454
454
|
kind: "scalar",
|
|
455
|
-
resolve:
|
|
456
|
-
construct:
|
|
455
|
+
resolve: Mi,
|
|
456
|
+
construct: Di,
|
|
457
457
|
instanceOf: Date,
|
|
458
|
-
represent:
|
|
458
|
+
represent: zi
|
|
459
459
|
});
|
|
460
|
-
function
|
|
460
|
+
function $i(e) {
|
|
461
461
|
return e === "<<" || e === null;
|
|
462
462
|
}
|
|
463
|
-
var
|
|
463
|
+
var lr = new j("tag:yaml.org,2002:merge", {
|
|
464
464
|
kind: "scalar",
|
|
465
|
-
resolve:
|
|
466
|
-
}),
|
|
465
|
+
resolve: $i
|
|
466
|
+
}), nn = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
467
467
|
\r`;
|
|
468
|
-
function
|
|
468
|
+
function Ui(e) {
|
|
469
469
|
if (e === null) return !1;
|
|
470
|
-
var n, r, i = 0, t = e.length, o =
|
|
470
|
+
var n, r, i = 0, t = e.length, o = nn;
|
|
471
471
|
for (r = 0; r < t; r++)
|
|
472
472
|
if (n = o.indexOf(e.charAt(r)), !(n > 64)) {
|
|
473
473
|
if (n < 0) return !1;
|
|
@@ -475,35 +475,35 @@ function Ti(e) {
|
|
|
475
475
|
}
|
|
476
476
|
return i % 8 === 0;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
479
|
-
var n, r, i = e.replace(/[\r\n=]/g, ""), t = i.length, o =
|
|
478
|
+
function Bi(e) {
|
|
479
|
+
var n, r, i = e.replace(/[\r\n=]/g, ""), t = i.length, o = nn, l = 0, a = [];
|
|
480
480
|
for (n = 0; n < t; n++)
|
|
481
481
|
n % 4 === 0 && n && (a.push(l >> 16 & 255), a.push(l >> 8 & 255), a.push(l & 255)), l = l << 6 | o.indexOf(i.charAt(n));
|
|
482
482
|
return r = t % 4 * 6, r === 0 ? (a.push(l >> 16 & 255), a.push(l >> 8 & 255), a.push(l & 255)) : r === 18 ? (a.push(l >> 10 & 255), a.push(l >> 2 & 255)) : r === 12 && a.push(l >> 4 & 255), new Uint8Array(a);
|
|
483
483
|
}
|
|
484
|
-
function
|
|
485
|
-
var n = "", r = 0, i, t, o = e.length, l =
|
|
484
|
+
function Yi(e) {
|
|
485
|
+
var n = "", r = 0, i, t, o = e.length, l = nn;
|
|
486
486
|
for (i = 0; i < o; i++)
|
|
487
487
|
i % 3 === 0 && i && (n += l[r >> 18 & 63], n += l[r >> 12 & 63], n += l[r >> 6 & 63], n += l[r & 63]), r = (r << 8) + e[i];
|
|
488
488
|
return t = o % 3, t === 0 ? (n += l[r >> 18 & 63], n += l[r >> 12 & 63], n += l[r >> 6 & 63], n += l[r & 63]) : t === 2 ? (n += l[r >> 10 & 63], n += l[r >> 4 & 63], n += l[r << 2 & 63], n += l[64]) : t === 1 && (n += l[r >> 2 & 63], n += l[r << 4 & 63], n += l[64], n += l[64]), n;
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function Hi(e) {
|
|
491
491
|
return Object.prototype.toString.call(e) === "[object Uint8Array]";
|
|
492
492
|
}
|
|
493
|
-
var
|
|
493
|
+
var ar = new j("tag:yaml.org,2002:binary", {
|
|
494
494
|
kind: "scalar",
|
|
495
|
-
resolve:
|
|
496
|
-
construct:
|
|
497
|
-
predicate:
|
|
498
|
-
represent:
|
|
499
|
-
}),
|
|
500
|
-
function
|
|
495
|
+
resolve: Ui,
|
|
496
|
+
construct: Bi,
|
|
497
|
+
predicate: Hi,
|
|
498
|
+
represent: Yi
|
|
499
|
+
}), Ki = Object.prototype.hasOwnProperty, Wi = Object.prototype.toString;
|
|
500
|
+
function qi(e) {
|
|
501
501
|
if (e === null) return !0;
|
|
502
502
|
var n = [], r, i, t, o, l, a = e;
|
|
503
503
|
for (r = 0, i = a.length; r < i; r += 1) {
|
|
504
|
-
if (t = a[r], l = !1,
|
|
504
|
+
if (t = a[r], l = !1, Wi.call(t) !== "[object Object]") return !1;
|
|
505
505
|
for (o in t)
|
|
506
|
-
if (
|
|
506
|
+
if (Ki.call(t, o))
|
|
507
507
|
if (!l) l = !0;
|
|
508
508
|
else return !1;
|
|
509
509
|
if (!l) return !1;
|
|
@@ -512,98 +512,98 @@ function Pi(e) {
|
|
|
512
512
|
}
|
|
513
513
|
return !0;
|
|
514
514
|
}
|
|
515
|
-
function
|
|
515
|
+
function Gi(e) {
|
|
516
516
|
return e !== null ? e : [];
|
|
517
517
|
}
|
|
518
|
-
var
|
|
518
|
+
var sr = new j("tag:yaml.org,2002:omap", {
|
|
519
519
|
kind: "sequence",
|
|
520
|
-
resolve:
|
|
521
|
-
construct:
|
|
522
|
-
}),
|
|
523
|
-
function
|
|
520
|
+
resolve: qi,
|
|
521
|
+
construct: Gi
|
|
522
|
+
}), Vi = Object.prototype.toString;
|
|
523
|
+
function Xi(e) {
|
|
524
524
|
if (e === null) return !0;
|
|
525
525
|
var n, r, i, t, o, l = e;
|
|
526
526
|
for (o = new Array(l.length), n = 0, r = l.length; n < r; n += 1) {
|
|
527
|
-
if (i = l[n],
|
|
527
|
+
if (i = l[n], Vi.call(i) !== "[object Object]" || (t = Object.keys(i), t.length !== 1)) return !1;
|
|
528
528
|
o[n] = [t[0], i[t[0]]];
|
|
529
529
|
}
|
|
530
530
|
return !0;
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function Ji(e) {
|
|
533
533
|
if (e === null) return [];
|
|
534
534
|
var n, r, i, t, o, l = e;
|
|
535
535
|
for (o = new Array(l.length), n = 0, r = l.length; n < r; n += 1)
|
|
536
536
|
i = l[n], t = Object.keys(i), o[n] = [t[0], i[t[0]]];
|
|
537
537
|
return o;
|
|
538
538
|
}
|
|
539
|
-
var
|
|
539
|
+
var cr = new j("tag:yaml.org,2002:pairs", {
|
|
540
540
|
kind: "sequence",
|
|
541
|
-
resolve:
|
|
542
|
-
construct:
|
|
543
|
-
}),
|
|
544
|
-
function
|
|
541
|
+
resolve: Xi,
|
|
542
|
+
construct: Ji
|
|
543
|
+
}), Qi = Object.prototype.hasOwnProperty;
|
|
544
|
+
function Zi(e) {
|
|
545
545
|
if (e === null) return !0;
|
|
546
546
|
var n, r = e;
|
|
547
547
|
for (n in r)
|
|
548
|
-
if (
|
|
548
|
+
if (Qi.call(r, n) && r[n] !== null)
|
|
549
549
|
return !1;
|
|
550
550
|
return !0;
|
|
551
551
|
}
|
|
552
|
-
function
|
|
552
|
+
function et(e) {
|
|
553
553
|
return e !== null ? e : {};
|
|
554
554
|
}
|
|
555
|
-
var
|
|
555
|
+
var ur = new j("tag:yaml.org,2002:set", {
|
|
556
556
|
kind: "mapping",
|
|
557
|
-
resolve:
|
|
558
|
-
construct:
|
|
559
|
-
}),
|
|
557
|
+
resolve: Zi,
|
|
558
|
+
construct: et
|
|
559
|
+
}), rn = rr.extend({
|
|
560
560
|
implicit: [
|
|
561
|
-
|
|
562
|
-
|
|
561
|
+
or,
|
|
562
|
+
lr
|
|
563
563
|
],
|
|
564
564
|
explicit: [
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
565
|
+
ar,
|
|
566
|
+
sr,
|
|
567
|
+
cr,
|
|
568
|
+
ur
|
|
569
569
|
]
|
|
570
|
-
}), G = Object.prototype.hasOwnProperty,
|
|
571
|
-
function
|
|
570
|
+
}), G = Object.prototype.hasOwnProperty, Oe = 1, fr = 2, pr = 3, _e = 4, ze = 1, nt = 2, bn = 3, rt = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, it = /[\x85\u2028\u2029]/, tt = /[,\[\]\{\}]/, dr = /^(?:!|!!|![a-z\-]+!)$/i, hr = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
571
|
+
function An(e) {
|
|
572
572
|
return Object.prototype.toString.call(e);
|
|
573
573
|
}
|
|
574
574
|
function H(e) {
|
|
575
575
|
return e === 10 || e === 13;
|
|
576
576
|
}
|
|
577
|
-
function
|
|
577
|
+
function J(e) {
|
|
578
578
|
return e === 9 || e === 32;
|
|
579
579
|
}
|
|
580
|
-
function
|
|
580
|
+
function B(e) {
|
|
581
581
|
return e === 9 || e === 32 || e === 10 || e === 13;
|
|
582
582
|
}
|
|
583
|
-
function
|
|
583
|
+
function te(e) {
|
|
584
584
|
return e === 44 || e === 91 || e === 93 || e === 123 || e === 125;
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function ot(e) {
|
|
587
587
|
var n;
|
|
588
588
|
return 48 <= e && e <= 57 ? e - 48 : (n = e | 32, 97 <= n && n <= 102 ? n - 97 + 10 : -1);
|
|
589
589
|
}
|
|
590
|
-
function
|
|
590
|
+
function lt(e) {
|
|
591
591
|
return e === 120 ? 2 : e === 117 ? 4 : e === 85 ? 8 : 0;
|
|
592
592
|
}
|
|
593
|
-
function
|
|
593
|
+
function at(e) {
|
|
594
594
|
return 48 <= e && e <= 57 ? e - 48 : -1;
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function kn(e) {
|
|
597
597
|
return e === 48 ? "\0" : e === 97 ? "\x07" : e === 98 ? "\b" : e === 116 || e === 9 ? " " : e === 110 ? `
|
|
598
598
|
` : e === 118 ? "\v" : e === 102 ? "\f" : e === 114 ? "\r" : e === 101 ? "\x1B" : e === 32 ? " " : e === 34 ? '"' : e === 47 ? "/" : e === 92 ? "\\" : e === 78 ? "
" : e === 95 ? " " : e === 76 ? "\u2028" : e === 80 ? "\u2029" : "";
|
|
599
599
|
}
|
|
600
|
-
function
|
|
600
|
+
function st(e) {
|
|
601
601
|
return e <= 65535 ? String.fromCharCode(e) : String.fromCharCode(
|
|
602
602
|
(e - 65536 >> 10) + 55296,
|
|
603
603
|
(e - 65536 & 1023) + 56320
|
|
604
604
|
);
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function gr(e, n, r) {
|
|
607
607
|
n === "__proto__" ? Object.defineProperty(e, n, {
|
|
608
608
|
configurable: !0,
|
|
609
609
|
enumerable: !0,
|
|
@@ -611,13 +611,13 @@ function sr(e, n, r) {
|
|
|
611
611
|
value: r
|
|
612
612
|
}) : e[n] = r;
|
|
613
613
|
}
|
|
614
|
-
var
|
|
615
|
-
for (var
|
|
616
|
-
|
|
617
|
-
function
|
|
618
|
-
this.input = e, this.filename = n.filename || null, this.schema = n.schema ||
|
|
614
|
+
var mr = new Array(256), yr = new Array(256);
|
|
615
|
+
for (var re = 0; re < 256; re++)
|
|
616
|
+
mr[re] = kn(re) ? 1 : 0, yr[re] = kn(re);
|
|
617
|
+
function ct(e, n) {
|
|
618
|
+
this.input = e, this.filename = n.filename || null, this.schema = n.schema || rn, this.onWarning = n.onWarning || null, this.legacy = n.legacy || !1, this.json = n.json || !1, this.listener = n.listener || null, this.implicitTypes = this.schema.compiledImplicit, this.typeMap = this.schema.compiledTypeMap, this.length = e.length, this.position = 0, this.line = 0, this.lineStart = 0, this.lineIndent = 0, this.firstTabInLine = -1, this.documents = [];
|
|
619
619
|
}
|
|
620
|
-
function
|
|
620
|
+
function vr(e, n) {
|
|
621
621
|
var r = {
|
|
622
622
|
name: e.filename,
|
|
623
623
|
buffer: e.input.slice(0, -1),
|
|
@@ -626,26 +626,26 @@ function fr(e, n) {
|
|
|
626
626
|
line: e.line,
|
|
627
627
|
column: e.position - e.lineStart
|
|
628
628
|
};
|
|
629
|
-
return r.snippet =
|
|
629
|
+
return r.snippet = di(r), new M(n, r);
|
|
630
630
|
}
|
|
631
|
-
function
|
|
632
|
-
throw
|
|
631
|
+
function x(e, n) {
|
|
632
|
+
throw vr(e, n);
|
|
633
633
|
}
|
|
634
|
-
function
|
|
635
|
-
e.onWarning && e.onWarning.call(null,
|
|
634
|
+
function Fe(e, n) {
|
|
635
|
+
e.onWarning && e.onWarning.call(null, vr(e, n));
|
|
636
636
|
}
|
|
637
|
-
var
|
|
637
|
+
var Sn = {
|
|
638
638
|
YAML: function(n, r, i) {
|
|
639
639
|
var t, o, l;
|
|
640
|
-
n.version !== null &&
|
|
640
|
+
n.version !== null && x(n, "duplication of %YAML directive"), i.length !== 1 && x(n, "YAML directive accepts exactly one argument"), t = /^([0-9]+)\.([0-9]+)$/.exec(i[0]), t === null && x(n, "ill-formed argument of the YAML directive"), o = parseInt(t[1], 10), l = parseInt(t[2], 10), o !== 1 && x(n, "unacceptable YAML version of the document"), n.version = i[0], n.checkLineBreaks = l < 2, l !== 1 && l !== 2 && Fe(n, "unsupported YAML version of the document");
|
|
641
641
|
},
|
|
642
642
|
TAG: function(n, r, i) {
|
|
643
643
|
var t, o;
|
|
644
|
-
i.length !== 2 &&
|
|
644
|
+
i.length !== 2 && x(n, "TAG directive accepts exactly two arguments"), t = i[0], o = i[1], dr.test(t) || x(n, "ill-formed tag handle (first argument) of the TAG directive"), G.call(n.tagMap, t) && x(n, 'there is a previously declared suffix for "' + t + '" tag handle'), hr.test(o) || x(n, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
645
645
|
try {
|
|
646
646
|
o = decodeURIComponent(o);
|
|
647
647
|
} catch {
|
|
648
|
-
|
|
648
|
+
x(n, "tag prefix is malformed: " + o);
|
|
649
649
|
}
|
|
650
650
|
n.tagMap[t] = o;
|
|
651
651
|
}
|
|
@@ -655,87 +655,87 @@ function q(e, n, r, i) {
|
|
|
655
655
|
if (n < r) {
|
|
656
656
|
if (a = e.input.slice(n, r), i)
|
|
657
657
|
for (t = 0, o = a.length; t < o; t += 1)
|
|
658
|
-
l = a.charCodeAt(t), l === 9 || 32 <= l && l <= 1114111 ||
|
|
659
|
-
else
|
|
658
|
+
l = a.charCodeAt(t), l === 9 || 32 <= l && l <= 1114111 || x(e, "expected valid JSON character");
|
|
659
|
+
else rt.test(a) && x(e, "the stream contains non-printable characters");
|
|
660
660
|
e.result += a;
|
|
661
661
|
}
|
|
662
662
|
}
|
|
663
|
-
function
|
|
663
|
+
function Cn(e, n, r, i) {
|
|
664
664
|
var t, o, l, a;
|
|
665
|
-
for (T.isObject(r) ||
|
|
666
|
-
o = t[l], G.call(n, o) || (
|
|
665
|
+
for (T.isObject(r) || x(e, "cannot merge mappings; the provided source object is unacceptable"), t = Object.keys(r), l = 0, a = t.length; l < a; l += 1)
|
|
666
|
+
o = t[l], G.call(n, o) || (gr(n, o, r[o]), i[o] = !0);
|
|
667
667
|
}
|
|
668
|
-
function
|
|
669
|
-
var c,
|
|
668
|
+
function oe(e, n, r, i, t, o, l, a, s) {
|
|
669
|
+
var c, f;
|
|
670
670
|
if (Array.isArray(t))
|
|
671
|
-
for (t = Array.prototype.slice.call(t), c = 0,
|
|
672
|
-
Array.isArray(t[c]) &&
|
|
673
|
-
if (typeof t == "object" &&
|
|
671
|
+
for (t = Array.prototype.slice.call(t), c = 0, f = t.length; c < f; c += 1)
|
|
672
|
+
Array.isArray(t[c]) && x(e, "nested arrays are not supported inside keys"), typeof t == "object" && An(t[c]) === "[object Object]" && (t[c] = "[object Object]");
|
|
673
|
+
if (typeof t == "object" && An(t) === "[object Object]" && (t = "[object Object]"), t = String(t), n === null && (n = {}), i === "tag:yaml.org,2002:merge")
|
|
674
674
|
if (Array.isArray(o))
|
|
675
|
-
for (c = 0,
|
|
676
|
-
|
|
675
|
+
for (c = 0, f = o.length; c < f; c += 1)
|
|
676
|
+
Cn(e, n, o[c], r);
|
|
677
677
|
else
|
|
678
|
-
|
|
678
|
+
Cn(e, n, o, r);
|
|
679
679
|
else
|
|
680
|
-
!e.json && !G.call(r, t) && G.call(n, t) && (e.line = l || e.line, e.lineStart = a || e.lineStart, e.position = s || e.position,
|
|
680
|
+
!e.json && !G.call(r, t) && G.call(n, t) && (e.line = l || e.line, e.lineStart = a || e.lineStart, e.position = s || e.position, x(e, "duplicated mapping key")), gr(n, t, o), delete r[t];
|
|
681
681
|
return n;
|
|
682
682
|
}
|
|
683
|
-
function
|
|
683
|
+
function tn(e) {
|
|
684
684
|
var n;
|
|
685
|
-
n = e.input.charCodeAt(e.position), n === 10 ? e.position++ : n === 13 ? (e.position++, e.input.charCodeAt(e.position) === 10 && e.position++) :
|
|
685
|
+
n = e.input.charCodeAt(e.position), n === 10 ? e.position++ : n === 13 ? (e.position++, e.input.charCodeAt(e.position) === 10 && e.position++) : x(e, "a line break is expected"), e.line += 1, e.lineStart = e.position, e.firstTabInLine = -1;
|
|
686
686
|
}
|
|
687
687
|
function F(e, n, r) {
|
|
688
688
|
for (var i = 0, t = e.input.charCodeAt(e.position); t !== 0; ) {
|
|
689
|
-
for (;
|
|
689
|
+
for (; J(t); )
|
|
690
690
|
t === 9 && e.firstTabInLine === -1 && (e.firstTabInLine = e.position), t = e.input.charCodeAt(++e.position);
|
|
691
691
|
if (n && t === 35)
|
|
692
692
|
do
|
|
693
693
|
t = e.input.charCodeAt(++e.position);
|
|
694
694
|
while (t !== 10 && t !== 13 && t !== 0);
|
|
695
695
|
if (H(t))
|
|
696
|
-
for (
|
|
696
|
+
for (tn(e), t = e.input.charCodeAt(e.position), i++, e.lineIndent = 0; t === 32; )
|
|
697
697
|
e.lineIndent++, t = e.input.charCodeAt(++e.position);
|
|
698
698
|
else
|
|
699
699
|
break;
|
|
700
700
|
}
|
|
701
|
-
return r !== -1 && i !== 0 && e.lineIndent < r &&
|
|
701
|
+
return r !== -1 && i !== 0 && e.lineIndent < r && Fe(e, "deficient indentation"), i;
|
|
702
702
|
}
|
|
703
|
-
function
|
|
703
|
+
function Pe(e) {
|
|
704
704
|
var n = e.position, r;
|
|
705
|
-
return r = e.input.charCodeAt(n), !!((r === 45 || r === 46) && r === e.input.charCodeAt(n + 1) && r === e.input.charCodeAt(n + 2) && (n += 3, r = e.input.charCodeAt(n), r === 0 ||
|
|
705
|
+
return r = e.input.charCodeAt(n), !!((r === 45 || r === 46) && r === e.input.charCodeAt(n + 1) && r === e.input.charCodeAt(n + 2) && (n += 3, r = e.input.charCodeAt(n), r === 0 || B(r)));
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function on(e, n) {
|
|
708
708
|
n === 1 ? e.result += " " : n > 1 && (e.result += T.repeat(`
|
|
709
709
|
`, n - 1));
|
|
710
710
|
}
|
|
711
|
-
function
|
|
712
|
-
var i, t, o, l, a, s, c,
|
|
713
|
-
if (g = e.input.charCodeAt(e.position),
|
|
711
|
+
function ut(e, n, r) {
|
|
712
|
+
var i, t, o, l, a, s, c, f, u = e.kind, h = e.result, g;
|
|
713
|
+
if (g = e.input.charCodeAt(e.position), B(g) || te(g) || g === 35 || g === 38 || g === 42 || g === 33 || g === 124 || g === 62 || g === 39 || g === 34 || g === 37 || g === 64 || g === 96 || (g === 63 || g === 45) && (t = e.input.charCodeAt(e.position + 1), B(t) || r && te(t)))
|
|
714
714
|
return !1;
|
|
715
715
|
for (e.kind = "scalar", e.result = "", o = l = e.position, a = !1; g !== 0; ) {
|
|
716
716
|
if (g === 58) {
|
|
717
|
-
if (t = e.input.charCodeAt(e.position + 1),
|
|
717
|
+
if (t = e.input.charCodeAt(e.position + 1), B(t) || r && te(t))
|
|
718
718
|
break;
|
|
719
719
|
} else if (g === 35) {
|
|
720
|
-
if (i = e.input.charCodeAt(e.position - 1),
|
|
720
|
+
if (i = e.input.charCodeAt(e.position - 1), B(i))
|
|
721
721
|
break;
|
|
722
722
|
} else {
|
|
723
|
-
if (e.position === e.lineStart &&
|
|
723
|
+
if (e.position === e.lineStart && Pe(e) || r && te(g))
|
|
724
724
|
break;
|
|
725
725
|
if (H(g))
|
|
726
|
-
if (s = e.line, c = e.lineStart,
|
|
726
|
+
if (s = e.line, c = e.lineStart, f = e.lineIndent, F(e, !1, -1), e.lineIndent >= n) {
|
|
727
727
|
a = !0, g = e.input.charCodeAt(e.position);
|
|
728
728
|
continue;
|
|
729
729
|
} else {
|
|
730
|
-
e.position = l, e.line = s, e.lineStart = c, e.lineIndent =
|
|
730
|
+
e.position = l, e.line = s, e.lineStart = c, e.lineIndent = f;
|
|
731
731
|
break;
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
|
-
a && (q(e, o, l, !1),
|
|
734
|
+
a && (q(e, o, l, !1), on(e, e.line - s), o = l = e.position, a = !1), J(g) || (l = e.position + 1), g = e.input.charCodeAt(++e.position);
|
|
735
735
|
}
|
|
736
|
-
return q(e, o, l, !1), e.result ? !0 : (e.kind =
|
|
736
|
+
return q(e, o, l, !1), e.result ? !0 : (e.kind = u, e.result = h, !1);
|
|
737
737
|
}
|
|
738
|
-
function
|
|
738
|
+
function ft(e, n) {
|
|
739
739
|
var r, i, t;
|
|
740
740
|
if (r = e.input.charCodeAt(e.position), r !== 39)
|
|
741
741
|
return !1;
|
|
@@ -745,10 +745,10 @@ function et(e, n) {
|
|
|
745
745
|
i = e.position, e.position++, t = e.position;
|
|
746
746
|
else
|
|
747
747
|
return !0;
|
|
748
|
-
else H(r) ? (q(e, i, t, !0),
|
|
749
|
-
|
|
748
|
+
else H(r) ? (q(e, i, t, !0), on(e, F(e, !1, n)), i = t = e.position) : e.position === e.lineStart && Pe(e) ? x(e, "unexpected end of the document within a single quoted scalar") : (e.position++, t = e.position);
|
|
749
|
+
x(e, "unexpected end of the stream within a single quoted scalar");
|
|
750
750
|
}
|
|
751
|
-
function
|
|
751
|
+
function pt(e, n) {
|
|
752
752
|
var r, i, t, o, l, a;
|
|
753
753
|
if (a = e.input.charCodeAt(e.position), a !== 34)
|
|
754
754
|
return !1;
|
|
@@ -758,194 +758,194 @@ function nt(e, n) {
|
|
|
758
758
|
if (a === 92) {
|
|
759
759
|
if (q(e, r, e.position, !0), a = e.input.charCodeAt(++e.position), H(a))
|
|
760
760
|
F(e, !1, n);
|
|
761
|
-
else if (a < 256 &&
|
|
762
|
-
e.result +=
|
|
763
|
-
else if ((l =
|
|
761
|
+
else if (a < 256 && mr[a])
|
|
762
|
+
e.result += yr[a], e.position++;
|
|
763
|
+
else if ((l = lt(a)) > 0) {
|
|
764
764
|
for (t = l, o = 0; t > 0; t--)
|
|
765
|
-
a = e.input.charCodeAt(++e.position), (l =
|
|
766
|
-
e.result +=
|
|
765
|
+
a = e.input.charCodeAt(++e.position), (l = ot(a)) >= 0 ? o = (o << 4) + l : x(e, "expected hexadecimal character");
|
|
766
|
+
e.result += st(o), e.position++;
|
|
767
767
|
} else
|
|
768
|
-
|
|
768
|
+
x(e, "unknown escape sequence");
|
|
769
769
|
r = i = e.position;
|
|
770
|
-
} else H(a) ? (q(e, r, i, !0),
|
|
770
|
+
} else H(a) ? (q(e, r, i, !0), on(e, F(e, !1, n)), r = i = e.position) : e.position === e.lineStart && Pe(e) ? x(e, "unexpected end of the document within a double quoted scalar") : (e.position++, i = e.position);
|
|
771
771
|
}
|
|
772
|
-
|
|
772
|
+
x(e, "unexpected end of the stream within a double quoted scalar");
|
|
773
773
|
}
|
|
774
|
-
function
|
|
775
|
-
var r = !0, i, t, o, l = e.tag, a, s = e.anchor, c,
|
|
776
|
-
if (
|
|
777
|
-
|
|
778
|
-
else if (
|
|
779
|
-
|
|
774
|
+
function dt(e, n) {
|
|
775
|
+
var r = !0, i, t, o, l = e.tag, a, s = e.anchor, c, f, u, h, g, m = /* @__PURE__ */ Object.create(null), d, w, k, v;
|
|
776
|
+
if (v = e.input.charCodeAt(e.position), v === 91)
|
|
777
|
+
f = 93, g = !1, a = [];
|
|
778
|
+
else if (v === 123)
|
|
779
|
+
f = 125, g = !0, a = {};
|
|
780
780
|
else
|
|
781
781
|
return !1;
|
|
782
|
-
for (e.anchor !== null && (e.anchorMap[e.anchor] = a),
|
|
783
|
-
if (F(e, !0, n),
|
|
782
|
+
for (e.anchor !== null && (e.anchorMap[e.anchor] = a), v = e.input.charCodeAt(++e.position); v !== 0; ) {
|
|
783
|
+
if (F(e, !0, n), v = e.input.charCodeAt(e.position), v === f)
|
|
784
784
|
return e.position++, e.tag = l, e.anchor = s, e.kind = g ? "mapping" : "sequence", e.result = a, !0;
|
|
785
|
-
r ?
|
|
785
|
+
r ? v === 44 && x(e, "expected the node content, but found ','") : x(e, "missed comma between flow collection entries"), w = d = k = null, u = h = !1, v === 63 && (c = e.input.charCodeAt(e.position + 1), B(c) && (u = h = !0, e.position++, F(e, !0, n))), i = e.line, t = e.lineStart, o = e.position, se(e, n, Oe, !1, !0), w = e.tag, d = e.result, F(e, !0, n), v = e.input.charCodeAt(e.position), (h || e.line === i) && v === 58 && (u = !0, v = e.input.charCodeAt(++e.position), F(e, !0, n), se(e, n, Oe, !1, !0), k = e.result), g ? oe(e, a, m, w, d, k, i, t, o) : u ? a.push(oe(e, null, m, w, d, k, i, t, o)) : a.push(d), F(e, !0, n), v = e.input.charCodeAt(e.position), v === 44 ? (r = !0, v = e.input.charCodeAt(++e.position)) : r = !1;
|
|
786
786
|
}
|
|
787
|
-
|
|
787
|
+
x(e, "unexpected end of the stream within a flow collection");
|
|
788
788
|
}
|
|
789
|
-
function
|
|
790
|
-
var r, i, t =
|
|
791
|
-
if (
|
|
789
|
+
function ht(e, n) {
|
|
790
|
+
var r, i, t = ze, o = !1, l = !1, a = n, s = 0, c = !1, f, u;
|
|
791
|
+
if (u = e.input.charCodeAt(e.position), u === 124)
|
|
792
792
|
i = !1;
|
|
793
|
-
else if (
|
|
793
|
+
else if (u === 62)
|
|
794
794
|
i = !0;
|
|
795
795
|
else
|
|
796
796
|
return !1;
|
|
797
|
-
for (e.kind = "scalar", e.result = "";
|
|
798
|
-
if (
|
|
799
|
-
|
|
800
|
-
else if ((
|
|
801
|
-
|
|
797
|
+
for (e.kind = "scalar", e.result = ""; u !== 0; )
|
|
798
|
+
if (u = e.input.charCodeAt(++e.position), u === 43 || u === 45)
|
|
799
|
+
ze === t ? t = u === 43 ? bn : nt : x(e, "repeat of a chomping mode identifier");
|
|
800
|
+
else if ((f = at(u)) >= 0)
|
|
801
|
+
f === 0 ? x(e, "bad explicit indentation width of a block scalar; it cannot be less than one") : l ? x(e, "repeat of an indentation width identifier") : (a = n + f - 1, l = !0);
|
|
802
802
|
else
|
|
803
803
|
break;
|
|
804
|
-
if (
|
|
804
|
+
if (J(u)) {
|
|
805
805
|
do
|
|
806
|
-
|
|
807
|
-
while (
|
|
808
|
-
if (
|
|
806
|
+
u = e.input.charCodeAt(++e.position);
|
|
807
|
+
while (J(u));
|
|
808
|
+
if (u === 35)
|
|
809
809
|
do
|
|
810
|
-
|
|
811
|
-
while (!H(
|
|
810
|
+
u = e.input.charCodeAt(++e.position);
|
|
811
|
+
while (!H(u) && u !== 0);
|
|
812
812
|
}
|
|
813
|
-
for (;
|
|
814
|
-
for (
|
|
815
|
-
e.lineIndent++,
|
|
816
|
-
if (!l && e.lineIndent > a && (a = e.lineIndent), H(
|
|
813
|
+
for (; u !== 0; ) {
|
|
814
|
+
for (tn(e), e.lineIndent = 0, u = e.input.charCodeAt(e.position); (!l || e.lineIndent < a) && u === 32; )
|
|
815
|
+
e.lineIndent++, u = e.input.charCodeAt(++e.position);
|
|
816
|
+
if (!l && e.lineIndent > a && (a = e.lineIndent), H(u)) {
|
|
817
817
|
s++;
|
|
818
818
|
continue;
|
|
819
819
|
}
|
|
820
820
|
if (e.lineIndent < a) {
|
|
821
|
-
t ===
|
|
822
|
-
`, o ? 1 + s : s) : t ===
|
|
821
|
+
t === bn ? e.result += T.repeat(`
|
|
822
|
+
`, o ? 1 + s : s) : t === ze && o && (e.result += `
|
|
823
823
|
`);
|
|
824
824
|
break;
|
|
825
825
|
}
|
|
826
|
-
for (i ?
|
|
826
|
+
for (i ? J(u) ? (c = !0, e.result += T.repeat(`
|
|
827
827
|
`, o ? 1 + s : s)) : c ? (c = !1, e.result += T.repeat(`
|
|
828
828
|
`, s + 1)) : s === 0 ? o && (e.result += " ") : e.result += T.repeat(`
|
|
829
829
|
`, s) : e.result += T.repeat(`
|
|
830
|
-
`, o ? 1 + s : s), o = !0, l = !0, s = 0, r = e.position; !H(
|
|
831
|
-
|
|
830
|
+
`, o ? 1 + s : s), o = !0, l = !0, s = 0, r = e.position; !H(u) && u !== 0; )
|
|
831
|
+
u = e.input.charCodeAt(++e.position);
|
|
832
832
|
q(e, r, e.position, !1);
|
|
833
833
|
}
|
|
834
834
|
return !0;
|
|
835
835
|
}
|
|
836
|
-
function
|
|
836
|
+
function En(e, n) {
|
|
837
837
|
var r, i = e.tag, t = e.anchor, o = [], l, a = !1, s;
|
|
838
838
|
if (e.firstTabInLine !== -1) return !1;
|
|
839
|
-
for (e.anchor !== null && (e.anchorMap[e.anchor] = o), s = e.input.charCodeAt(e.position); s !== 0 && (e.firstTabInLine !== -1 && (e.position = e.firstTabInLine,
|
|
839
|
+
for (e.anchor !== null && (e.anchorMap[e.anchor] = o), s = e.input.charCodeAt(e.position); s !== 0 && (e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, x(e, "tab characters must not be used in indentation")), !(s !== 45 || (l = e.input.charCodeAt(e.position + 1), !B(l)))); ) {
|
|
840
840
|
if (a = !0, e.position++, F(e, !0, -1) && e.lineIndent <= n) {
|
|
841
841
|
o.push(null), s = e.input.charCodeAt(e.position);
|
|
842
842
|
continue;
|
|
843
843
|
}
|
|
844
|
-
if (r = e.line,
|
|
845
|
-
|
|
844
|
+
if (r = e.line, se(e, n, pr, !1, !0), o.push(e.result), F(e, !0, -1), s = e.input.charCodeAt(e.position), (e.line === r || e.lineIndent > n) && s !== 0)
|
|
845
|
+
x(e, "bad indentation of a sequence entry");
|
|
846
846
|
else if (e.lineIndent < n)
|
|
847
847
|
break;
|
|
848
848
|
}
|
|
849
849
|
return a ? (e.tag = i, e.anchor = t, e.kind = "sequence", e.result = o, !0) : !1;
|
|
850
850
|
}
|
|
851
|
-
function
|
|
852
|
-
var i, t, o, l, a, s, c = e.tag,
|
|
851
|
+
function gt(e, n, r) {
|
|
852
|
+
var i, t, o, l, a, s, c = e.tag, f = e.anchor, u = {}, h = /* @__PURE__ */ Object.create(null), g = null, m = null, d = null, w = !1, k = !1, v;
|
|
853
853
|
if (e.firstTabInLine !== -1) return !1;
|
|
854
|
-
for (e.anchor !== null && (e.anchorMap[e.anchor] =
|
|
855
|
-
if (!
|
|
856
|
-
|
|
854
|
+
for (e.anchor !== null && (e.anchorMap[e.anchor] = u), v = e.input.charCodeAt(e.position); v !== 0; ) {
|
|
855
|
+
if (!w && e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, x(e, "tab characters must not be used in indentation")), i = e.input.charCodeAt(e.position + 1), o = e.line, (v === 63 || v === 58) && B(i))
|
|
856
|
+
v === 63 ? (w && (oe(e, u, h, g, m, null, l, a, s), g = m = d = null), k = !0, w = !0, t = !0) : w ? (w = !1, t = !0) : x(e, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"), e.position += 1, v = i;
|
|
857
857
|
else {
|
|
858
|
-
if (l = e.line, a = e.lineStart, s = e.position, !
|
|
858
|
+
if (l = e.line, a = e.lineStart, s = e.position, !se(e, r, fr, !1, !0))
|
|
859
859
|
break;
|
|
860
860
|
if (e.line === o) {
|
|
861
|
-
for (
|
|
862
|
-
|
|
863
|
-
if (
|
|
864
|
-
|
|
865
|
-
else if (
|
|
866
|
-
|
|
861
|
+
for (v = e.input.charCodeAt(e.position); J(v); )
|
|
862
|
+
v = e.input.charCodeAt(++e.position);
|
|
863
|
+
if (v === 58)
|
|
864
|
+
v = e.input.charCodeAt(++e.position), B(v) || x(e, "a whitespace character is expected after the key-value separator within a block mapping"), w && (oe(e, u, h, g, m, null, l, a, s), g = m = d = null), k = !0, w = !1, t = !1, g = e.tag, m = e.result;
|
|
865
|
+
else if (k)
|
|
866
|
+
x(e, "can not read an implicit mapping pair; a colon is missed");
|
|
867
867
|
else
|
|
868
|
-
return e.tag = c, e.anchor =
|
|
869
|
-
} else if (
|
|
870
|
-
|
|
868
|
+
return e.tag = c, e.anchor = f, !0;
|
|
869
|
+
} else if (k)
|
|
870
|
+
x(e, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
871
871
|
else
|
|
872
|
-
return e.tag = c, e.anchor =
|
|
872
|
+
return e.tag = c, e.anchor = f, !0;
|
|
873
873
|
}
|
|
874
|
-
if ((e.line === o || e.lineIndent > n) && (
|
|
875
|
-
|
|
874
|
+
if ((e.line === o || e.lineIndent > n) && (w && (l = e.line, a = e.lineStart, s = e.position), se(e, n, _e, !0, t) && (w ? m = e.result : d = e.result), w || (oe(e, u, h, g, m, d, l, a, s), g = m = d = null), F(e, !0, -1), v = e.input.charCodeAt(e.position)), (e.line === o || e.lineIndent > n) && v !== 0)
|
|
875
|
+
x(e, "bad indentation of a mapping entry");
|
|
876
876
|
else if (e.lineIndent < n)
|
|
877
877
|
break;
|
|
878
878
|
}
|
|
879
|
-
return
|
|
879
|
+
return w && oe(e, u, h, g, m, null, l, a, s), k && (e.tag = c, e.anchor = f, e.kind = "mapping", e.result = u), k;
|
|
880
880
|
}
|
|
881
|
-
function
|
|
881
|
+
function mt(e) {
|
|
882
882
|
var n, r = !1, i = !1, t, o, l;
|
|
883
883
|
if (l = e.input.charCodeAt(e.position), l !== 33) return !1;
|
|
884
|
-
if (e.tag !== null &&
|
|
884
|
+
if (e.tag !== null && x(e, "duplication of a tag property"), l = e.input.charCodeAt(++e.position), l === 60 ? (r = !0, l = e.input.charCodeAt(++e.position)) : l === 33 ? (i = !0, t = "!!", l = e.input.charCodeAt(++e.position)) : t = "!", n = e.position, r) {
|
|
885
885
|
do
|
|
886
886
|
l = e.input.charCodeAt(++e.position);
|
|
887
887
|
while (l !== 0 && l !== 62);
|
|
888
|
-
e.position < e.length ? (o = e.input.slice(n, e.position), l = e.input.charCodeAt(++e.position)) :
|
|
888
|
+
e.position < e.length ? (o = e.input.slice(n, e.position), l = e.input.charCodeAt(++e.position)) : x(e, "unexpected end of the stream within a verbatim tag");
|
|
889
889
|
} else {
|
|
890
|
-
for (; l !== 0 && !
|
|
891
|
-
l === 33 && (i ?
|
|
892
|
-
o = e.input.slice(n, e.position),
|
|
890
|
+
for (; l !== 0 && !B(l); )
|
|
891
|
+
l === 33 && (i ? x(e, "tag suffix cannot contain exclamation marks") : (t = e.input.slice(n - 1, e.position + 1), dr.test(t) || x(e, "named tag handle cannot contain such characters"), i = !0, n = e.position + 1)), l = e.input.charCodeAt(++e.position);
|
|
892
|
+
o = e.input.slice(n, e.position), tt.test(o) && x(e, "tag suffix cannot contain flow indicator characters");
|
|
893
893
|
}
|
|
894
|
-
o && !
|
|
894
|
+
o && !hr.test(o) && x(e, "tag name cannot contain such characters: " + o);
|
|
895
895
|
try {
|
|
896
896
|
o = decodeURIComponent(o);
|
|
897
897
|
} catch {
|
|
898
|
-
|
|
898
|
+
x(e, "tag name is malformed: " + o);
|
|
899
899
|
}
|
|
900
|
-
return r ? e.tag = o : G.call(e.tagMap, t) ? e.tag = e.tagMap[t] + o : t === "!" ? e.tag = "!" + o : t === "!!" ? e.tag = "tag:yaml.org,2002:" + o :
|
|
900
|
+
return r ? e.tag = o : G.call(e.tagMap, t) ? e.tag = e.tagMap[t] + o : t === "!" ? e.tag = "!" + o : t === "!!" ? e.tag = "tag:yaml.org,2002:" + o : x(e, 'undeclared tag handle "' + t + '"'), !0;
|
|
901
901
|
}
|
|
902
|
-
function
|
|
902
|
+
function yt(e) {
|
|
903
903
|
var n, r;
|
|
904
904
|
if (r = e.input.charCodeAt(e.position), r !== 38) return !1;
|
|
905
|
-
for (e.anchor !== null &&
|
|
905
|
+
for (e.anchor !== null && x(e, "duplication of an anchor property"), r = e.input.charCodeAt(++e.position), n = e.position; r !== 0 && !B(r) && !te(r); )
|
|
906
906
|
r = e.input.charCodeAt(++e.position);
|
|
907
|
-
return e.position === n &&
|
|
907
|
+
return e.position === n && x(e, "name of an anchor node must contain at least one character"), e.anchor = e.input.slice(n, e.position), !0;
|
|
908
908
|
}
|
|
909
|
-
function
|
|
909
|
+
function vt(e) {
|
|
910
910
|
var n, r, i;
|
|
911
911
|
if (i = e.input.charCodeAt(e.position), i !== 42) return !1;
|
|
912
|
-
for (i = e.input.charCodeAt(++e.position), n = e.position; i !== 0 && !
|
|
912
|
+
for (i = e.input.charCodeAt(++e.position), n = e.position; i !== 0 && !B(i) && !te(i); )
|
|
913
913
|
i = e.input.charCodeAt(++e.position);
|
|
914
|
-
return e.position === n &&
|
|
914
|
+
return e.position === n && x(e, "name of an alias node must contain at least one character"), r = e.input.slice(n, e.position), G.call(e.anchorMap, r) || x(e, 'unidentified alias "' + r + '"'), e.result = e.anchorMap[r], F(e, !0, -1), !0;
|
|
915
915
|
}
|
|
916
|
-
function
|
|
917
|
-
var o, l, a, s = 1, c = !1,
|
|
918
|
-
if (e.listener !== null && e.listener("open", e), e.tag = null, e.anchor = null, e.kind = null, e.result = null, o = l = a =
|
|
919
|
-
for (;
|
|
916
|
+
function se(e, n, r, i, t) {
|
|
917
|
+
var o, l, a, s = 1, c = !1, f = !1, u, h, g, m, d, w;
|
|
918
|
+
if (e.listener !== null && e.listener("open", e), e.tag = null, e.anchor = null, e.kind = null, e.result = null, o = l = a = _e === r || pr === r, i && F(e, !0, -1) && (c = !0, e.lineIndent > n ? s = 1 : e.lineIndent === n ? s = 0 : e.lineIndent < n && (s = -1)), s === 1)
|
|
919
|
+
for (; mt(e) || yt(e); )
|
|
920
920
|
F(e, !0, -1) ? (c = !0, a = o, e.lineIndent > n ? s = 1 : e.lineIndent === n ? s = 0 : e.lineIndent < n && (s = -1)) : a = !1;
|
|
921
|
-
if (a && (a = c || t), (s === 1 ||
|
|
921
|
+
if (a && (a = c || t), (s === 1 || _e === r) && (Oe === r || fr === r ? d = n : d = n + 1, w = e.position - e.lineStart, s === 1 ? a && (En(e, w) || gt(e, w, d)) || dt(e, d) ? f = !0 : (l && ht(e, d) || ft(e, d) || pt(e, d) ? f = !0 : vt(e) ? (f = !0, (e.tag !== null || e.anchor !== null) && x(e, "alias node should not have any properties")) : ut(e, d, Oe === r) && (f = !0, e.tag === null && (e.tag = "?")), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : s === 0 && (f = a && En(e, w))), e.tag === null)
|
|
922
922
|
e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
|
|
923
923
|
else if (e.tag === "?") {
|
|
924
|
-
for (e.result !== null && e.kind !== "scalar" &&
|
|
925
|
-
if (
|
|
926
|
-
e.result =
|
|
924
|
+
for (e.result !== null && e.kind !== "scalar" && x(e, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + e.kind + '"'), u = 0, h = e.implicitTypes.length; u < h; u += 1)
|
|
925
|
+
if (m = e.implicitTypes[u], m.resolve(e.result)) {
|
|
926
|
+
e.result = m.construct(e.result), e.tag = m.tag, e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
|
|
927
927
|
break;
|
|
928
928
|
}
|
|
929
929
|
} else if (e.tag !== "!") {
|
|
930
930
|
if (G.call(e.typeMap[e.kind || "fallback"], e.tag))
|
|
931
|
-
|
|
931
|
+
m = e.typeMap[e.kind || "fallback"][e.tag];
|
|
932
932
|
else
|
|
933
|
-
for (
|
|
934
|
-
if (e.tag.slice(0, g[
|
|
935
|
-
|
|
933
|
+
for (m = null, g = e.typeMap.multi[e.kind || "fallback"], u = 0, h = g.length; u < h; u += 1)
|
|
934
|
+
if (e.tag.slice(0, g[u].tag.length) === g[u].tag) {
|
|
935
|
+
m = g[u];
|
|
936
936
|
break;
|
|
937
937
|
}
|
|
938
|
-
|
|
938
|
+
m || x(e, "unknown tag !<" + e.tag + ">"), e.result !== null && m.kind !== e.kind && x(e, "unacceptable node kind for !<" + e.tag + '> tag; it should be "' + m.kind + '", not "' + e.kind + '"'), m.resolve(e.result, e.tag) ? (e.result = m.construct(e.result, e.tag), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : x(e, "cannot resolve a node with !<" + e.tag + "> explicit tag");
|
|
939
939
|
}
|
|
940
|
-
return e.listener !== null && e.listener("close", e), e.tag !== null || e.anchor !== null ||
|
|
940
|
+
return e.listener !== null && e.listener("close", e), e.tag !== null || e.anchor !== null || f;
|
|
941
941
|
}
|
|
942
|
-
function
|
|
942
|
+
function xt(e) {
|
|
943
943
|
var n = e.position, r, i, t, o = !1, l;
|
|
944
944
|
for (e.version = null, e.checkLineBreaks = e.legacy, e.tagMap = /* @__PURE__ */ Object.create(null), e.anchorMap = /* @__PURE__ */ Object.create(null); (l = e.input.charCodeAt(e.position)) !== 0 && (F(e, !0, -1), l = e.input.charCodeAt(e.position), !(e.lineIndent > 0 || l !== 37)); ) {
|
|
945
|
-
for (o = !0, l = e.input.charCodeAt(++e.position), r = e.position; l !== 0 && !
|
|
945
|
+
for (o = !0, l = e.input.charCodeAt(++e.position), r = e.position; l !== 0 && !B(l); )
|
|
946
946
|
l = e.input.charCodeAt(++e.position);
|
|
947
|
-
for (i = e.input.slice(r, e.position), t = [], i.length < 1 &&
|
|
948
|
-
for (;
|
|
947
|
+
for (i = e.input.slice(r, e.position), t = [], i.length < 1 && x(e, "directive name must not be less than one character in length"); l !== 0; ) {
|
|
948
|
+
for (; J(l); )
|
|
949
949
|
l = e.input.charCodeAt(++e.position);
|
|
950
950
|
if (l === 35) {
|
|
951
951
|
do
|
|
@@ -954,51 +954,51 @@ function st(e) {
|
|
|
954
954
|
break;
|
|
955
955
|
}
|
|
956
956
|
if (H(l)) break;
|
|
957
|
-
for (r = e.position; l !== 0 && !
|
|
957
|
+
for (r = e.position; l !== 0 && !B(l); )
|
|
958
958
|
l = e.input.charCodeAt(++e.position);
|
|
959
959
|
t.push(e.input.slice(r, e.position));
|
|
960
960
|
}
|
|
961
|
-
l !== 0 &&
|
|
961
|
+
l !== 0 && tn(e), G.call(Sn, i) ? Sn[i](e, i, t) : Fe(e, 'unknown document directive "' + i + '"');
|
|
962
962
|
}
|
|
963
|
-
if (F(e, !0, -1), e.lineIndent === 0 && e.input.charCodeAt(e.position) === 45 && e.input.charCodeAt(e.position + 1) === 45 && e.input.charCodeAt(e.position + 2) === 45 ? (e.position += 3, F(e, !0, -1)) : o &&
|
|
963
|
+
if (F(e, !0, -1), e.lineIndent === 0 && e.input.charCodeAt(e.position) === 45 && e.input.charCodeAt(e.position + 1) === 45 && e.input.charCodeAt(e.position + 2) === 45 ? (e.position += 3, F(e, !0, -1)) : o && x(e, "directives end mark is expected"), se(e, e.lineIndent - 1, _e, !1, !0), F(e, !0, -1), e.checkLineBreaks && it.test(e.input.slice(n, e.position)) && Fe(e, "non-ASCII line breaks are interpreted as content"), e.documents.push(e.result), e.position === e.lineStart && Pe(e)) {
|
|
964
964
|
e.input.charCodeAt(e.position) === 46 && (e.position += 3, F(e, !0, -1));
|
|
965
965
|
return;
|
|
966
966
|
}
|
|
967
967
|
if (e.position < e.length - 1)
|
|
968
|
-
|
|
968
|
+
x(e, "end of the stream or a document separator is expected");
|
|
969
969
|
else
|
|
970
970
|
return;
|
|
971
971
|
}
|
|
972
|
-
function
|
|
972
|
+
function xr(e, n) {
|
|
973
973
|
e = String(e), n = n || {}, e.length !== 0 && (e.charCodeAt(e.length - 1) !== 10 && e.charCodeAt(e.length - 1) !== 13 && (e += `
|
|
974
974
|
`), e.charCodeAt(0) === 65279 && (e = e.slice(1)));
|
|
975
|
-
var r = new
|
|
976
|
-
for (i !== -1 && (r.position = i,
|
|
975
|
+
var r = new ct(e, n), i = e.indexOf("\0");
|
|
976
|
+
for (i !== -1 && (r.position = i, x(r, "null byte is not allowed in input")), r.input += "\0"; r.input.charCodeAt(r.position) === 32; )
|
|
977
977
|
r.lineIndent += 1, r.position += 1;
|
|
978
978
|
for (; r.position < r.length - 1; )
|
|
979
|
-
|
|
979
|
+
xt(r);
|
|
980
980
|
return r.documents;
|
|
981
981
|
}
|
|
982
|
-
function
|
|
982
|
+
function wt(e, n, r) {
|
|
983
983
|
n !== null && typeof n == "object" && typeof r > "u" && (r = n, n = null);
|
|
984
|
-
var i =
|
|
984
|
+
var i = xr(e, r);
|
|
985
985
|
if (typeof n != "function")
|
|
986
986
|
return i;
|
|
987
987
|
for (var t = 0, o = i.length; t < o; t += 1)
|
|
988
988
|
n(i[t]);
|
|
989
989
|
}
|
|
990
|
-
function
|
|
991
|
-
var r =
|
|
990
|
+
function bt(e, n) {
|
|
991
|
+
var r = xr(e, n);
|
|
992
992
|
if (r.length !== 0) {
|
|
993
993
|
if (r.length === 1)
|
|
994
994
|
return r[0];
|
|
995
995
|
throw new M("expected a single document in the stream, but found more");
|
|
996
996
|
}
|
|
997
997
|
}
|
|
998
|
-
var
|
|
999
|
-
loadAll:
|
|
1000
|
-
load:
|
|
1001
|
-
},
|
|
998
|
+
var At = wt, kt = bt, wr = {
|
|
999
|
+
loadAll: At,
|
|
1000
|
+
load: kt
|
|
1001
|
+
}, br = Object.prototype.toString, Ar = Object.prototype.hasOwnProperty, ln = 65279, St = 9, me = 10, Ct = 13, Et = 32, Ot = 33, _t = 34, qe = 35, Ft = 37, Tt = 38, Lt = 39, jt = 42, kr = 44, It = 45, Te = 58, Nt = 61, Pt = 62, Rt = 63, Mt = 64, Sr = 91, Cr = 93, Dt = 96, Er = 123, zt = 124, Or = 125, N = {};
|
|
1002
1002
|
N[0] = "\\0";
|
|
1003
1003
|
N[7] = "\\a";
|
|
1004
1004
|
N[8] = "\\b";
|
|
@@ -1014,7 +1014,7 @@ N[133] = "\\N";
|
|
|
1014
1014
|
N[160] = "\\_";
|
|
1015
1015
|
N[8232] = "\\L";
|
|
1016
1016
|
N[8233] = "\\P";
|
|
1017
|
-
var
|
|
1017
|
+
var $t = [
|
|
1018
1018
|
"y",
|
|
1019
1019
|
"Y",
|
|
1020
1020
|
"yes",
|
|
@@ -1031,15 +1031,15 @@ var Ft = [
|
|
|
1031
1031
|
"off",
|
|
1032
1032
|
"Off",
|
|
1033
1033
|
"OFF"
|
|
1034
|
-
],
|
|
1035
|
-
function
|
|
1034
|
+
], Ut = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
1035
|
+
function Bt(e, n) {
|
|
1036
1036
|
var r, i, t, o, l, a, s;
|
|
1037
1037
|
if (n === null) return {};
|
|
1038
1038
|
for (r = {}, i = Object.keys(n), t = 0, o = i.length; t < o; t += 1)
|
|
1039
|
-
l = i[t], a = String(n[l]), l.slice(0, 2) === "!!" && (l = "tag:yaml.org,2002:" + l.slice(2)), s = e.compiledTypeMap.fallback[l], s &&
|
|
1039
|
+
l = i[t], a = String(n[l]), l.slice(0, 2) === "!!" && (l = "tag:yaml.org,2002:" + l.slice(2)), s = e.compiledTypeMap.fallback[l], s && Ar.call(s.styleAliases, a) && (a = s.styleAliases[a]), r[l] = a;
|
|
1040
1040
|
return r;
|
|
1041
1041
|
}
|
|
1042
|
-
function
|
|
1042
|
+
function Yt(e) {
|
|
1043
1043
|
var n, r, i;
|
|
1044
1044
|
if (n = e.toString(16).toUpperCase(), e <= 255)
|
|
1045
1045
|
r = "x", i = 2;
|
|
@@ -1051,94 +1051,94 @@ function jt(e) {
|
|
|
1051
1051
|
throw new M("code point within a string may not be greater than 0xFFFFFFFF");
|
|
1052
1052
|
return "\\" + r + T.repeat("0", i - n.length) + n;
|
|
1053
1053
|
}
|
|
1054
|
-
var
|
|
1055
|
-
function
|
|
1056
|
-
this.schema = e.schema ||
|
|
1054
|
+
var Ht = 1, ye = 2;
|
|
1055
|
+
function Kt(e) {
|
|
1056
|
+
this.schema = e.schema || rn, this.indent = Math.max(1, e.indent || 2), this.noArrayIndent = e.noArrayIndent || !1, this.skipInvalid = e.skipInvalid || !1, this.flowLevel = T.isNothing(e.flowLevel) ? -1 : e.flowLevel, this.styleMap = Bt(this.schema, e.styles || null), this.sortKeys = e.sortKeys || !1, this.lineWidth = e.lineWidth || 80, this.noRefs = e.noRefs || !1, this.noCompatMode = e.noCompatMode || !1, this.condenseFlow = e.condenseFlow || !1, this.quotingType = e.quotingType === '"' ? ye : Ht, this.forceQuotes = e.forceQuotes || !1, this.replacer = typeof e.replacer == "function" ? e.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function On(e, n) {
|
|
1059
1059
|
for (var r = T.repeat(" ", n), i = 0, t = -1, o = "", l, a = e.length; i < a; )
|
|
1060
1060
|
t = e.indexOf(`
|
|
1061
1061
|
`, i), t === -1 ? (l = e.slice(i), i = a) : (l = e.slice(i, t + 1), i = t + 1), l.length && l !== `
|
|
1062
1062
|
` && (o += r), o += l;
|
|
1063
1063
|
return o;
|
|
1064
1064
|
}
|
|
1065
|
-
function
|
|
1065
|
+
function Ge(e, n) {
|
|
1066
1066
|
return `
|
|
1067
1067
|
` + T.repeat(" ", e.indent * n);
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1069
|
+
function Wt(e, n) {
|
|
1070
1070
|
var r, i, t;
|
|
1071
1071
|
for (r = 0, i = e.implicitTypes.length; r < i; r += 1)
|
|
1072
1072
|
if (t = e.implicitTypes[r], t.resolve(n))
|
|
1073
1073
|
return !0;
|
|
1074
1074
|
return !1;
|
|
1075
1075
|
}
|
|
1076
|
-
function
|
|
1077
|
-
return e ===
|
|
1076
|
+
function Le(e) {
|
|
1077
|
+
return e === Et || e === St;
|
|
1078
1078
|
}
|
|
1079
|
-
function
|
|
1080
|
-
return 32 <= e && e <= 126 || 161 <= e && e <= 55295 && e !== 8232 && e !== 8233 || 57344 <= e && e <= 65533 && e !==
|
|
1079
|
+
function ve(e) {
|
|
1080
|
+
return 32 <= e && e <= 126 || 161 <= e && e <= 55295 && e !== 8232 && e !== 8233 || 57344 <= e && e <= 65533 && e !== ln || 65536 <= e && e <= 1114111;
|
|
1081
1081
|
}
|
|
1082
|
-
function
|
|
1083
|
-
return
|
|
1082
|
+
function _n(e) {
|
|
1083
|
+
return ve(e) && e !== ln && e !== Ct && e !== me;
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1086
|
-
var i =
|
|
1085
|
+
function Fn(e, n, r) {
|
|
1086
|
+
var i = _n(e), t = i && !Le(e);
|
|
1087
1087
|
return (
|
|
1088
1088
|
// ns-plain-safe
|
|
1089
1089
|
(r ? (
|
|
1090
1090
|
// c = flow-in
|
|
1091
1091
|
i
|
|
1092
|
-
) : i && e !==
|
|
1092
|
+
) : i && e !== kr && e !== Sr && e !== Cr && e !== Er && e !== Or) && e !== qe && !(n === Te && !t) || _n(n) && !Le(n) && e === qe || n === Te && t
|
|
1093
1093
|
);
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1096
|
-
return
|
|
1095
|
+
function qt(e) {
|
|
1096
|
+
return ve(e) && e !== ln && !Le(e) && e !== It && e !== Rt && e !== Te && e !== kr && e !== Sr && e !== Cr && e !== Er && e !== Or && e !== qe && e !== Tt && e !== jt && e !== Ot && e !== zt && e !== Nt && e !== Pt && e !== Lt && e !== _t && e !== Ft && e !== Mt && e !== Dt;
|
|
1097
1097
|
}
|
|
1098
|
-
function
|
|
1099
|
-
return !
|
|
1098
|
+
function Gt(e) {
|
|
1099
|
+
return !Le(e) && e !== Te;
|
|
1100
1100
|
}
|
|
1101
|
-
function
|
|
1101
|
+
function he(e, n) {
|
|
1102
1102
|
var r = e.charCodeAt(n), i;
|
|
1103
1103
|
return r >= 55296 && r <= 56319 && n + 1 < e.length && (i = e.charCodeAt(n + 1), i >= 56320 && i <= 57343) ? (r - 55296) * 1024 + i - 56320 + 65536 : r;
|
|
1104
1104
|
}
|
|
1105
|
-
function
|
|
1105
|
+
function _r(e) {
|
|
1106
1106
|
var n = /^\n* /;
|
|
1107
1107
|
return n.test(e);
|
|
1108
1108
|
}
|
|
1109
|
-
var
|
|
1110
|
-
function
|
|
1111
|
-
var s, c = 0,
|
|
1109
|
+
var Fr = 1, Ve = 2, Tr = 3, Lr = 4, ie = 5;
|
|
1110
|
+
function Vt(e, n, r, i, t, o, l, a) {
|
|
1111
|
+
var s, c = 0, f = null, u = !1, h = !1, g = i !== -1, m = -1, d = qt(he(e, 0)) && Gt(he(e, e.length - 1));
|
|
1112
1112
|
if (n || l)
|
|
1113
1113
|
for (s = 0; s < e.length; c >= 65536 ? s += 2 : s++) {
|
|
1114
|
-
if (c =
|
|
1115
|
-
return
|
|
1116
|
-
d = d &&
|
|
1114
|
+
if (c = he(e, s), !ve(c))
|
|
1115
|
+
return ie;
|
|
1116
|
+
d = d && Fn(c, f, a), f = c;
|
|
1117
1117
|
}
|
|
1118
1118
|
else {
|
|
1119
1119
|
for (s = 0; s < e.length; c >= 65536 ? s += 2 : s++) {
|
|
1120
|
-
if (c =
|
|
1121
|
-
|
|
1122
|
-
s -
|
|
1123
|
-
else if (!
|
|
1124
|
-
return
|
|
1125
|
-
d = d &&
|
|
1120
|
+
if (c = he(e, s), c === me)
|
|
1121
|
+
u = !0, g && (h = h || // Foldable line = too long, and not more-indented.
|
|
1122
|
+
s - m - 1 > i && e[m + 1] !== " ", m = s);
|
|
1123
|
+
else if (!ve(c))
|
|
1124
|
+
return ie;
|
|
1125
|
+
d = d && Fn(c, f, a), f = c;
|
|
1126
1126
|
}
|
|
1127
|
-
h = h || g && s -
|
|
1127
|
+
h = h || g && s - m - 1 > i && e[m + 1] !== " ";
|
|
1128
1128
|
}
|
|
1129
|
-
return !
|
|
1129
|
+
return !u && !h ? d && !l && !t(e) ? Fr : o === ye ? ie : Ve : r > 9 && _r(e) ? ie : l ? o === ye ? ie : Ve : h ? Lr : Tr;
|
|
1130
1130
|
}
|
|
1131
|
-
function
|
|
1131
|
+
function Xt(e, n, r, i, t) {
|
|
1132
1132
|
e.dump = (function() {
|
|
1133
1133
|
if (n.length === 0)
|
|
1134
|
-
return e.quotingType ===
|
|
1135
|
-
if (!e.noCompatMode && (
|
|
1136
|
-
return e.quotingType ===
|
|
1134
|
+
return e.quotingType === ye ? '""' : "''";
|
|
1135
|
+
if (!e.noCompatMode && ($t.indexOf(n) !== -1 || Ut.test(n)))
|
|
1136
|
+
return e.quotingType === ye ? '"' + n + '"' : "'" + n + "'";
|
|
1137
1137
|
var o = e.indent * Math.max(1, r), l = e.lineWidth === -1 ? -1 : Math.max(Math.min(e.lineWidth, 40), e.lineWidth - o), a = i || e.flowLevel > -1 && r >= e.flowLevel;
|
|
1138
1138
|
function s(c) {
|
|
1139
|
-
return
|
|
1139
|
+
return Wt(e, c);
|
|
1140
1140
|
}
|
|
1141
|
-
switch (
|
|
1141
|
+
switch (Vt(
|
|
1142
1142
|
n,
|
|
1143
1143
|
a,
|
|
1144
1144
|
e.indent,
|
|
@@ -1148,47 +1148,47 @@ function $t(e, n, r, i, t) {
|
|
|
1148
1148
|
e.forceQuotes && !i,
|
|
1149
1149
|
t
|
|
1150
1150
|
)) {
|
|
1151
|
-
case
|
|
1151
|
+
case Fr:
|
|
1152
1152
|
return n;
|
|
1153
|
-
case
|
|
1153
|
+
case Ve:
|
|
1154
1154
|
return "'" + n.replace(/'/g, "''") + "'";
|
|
1155
|
-
case
|
|
1156
|
-
return "|" +
|
|
1157
|
-
case
|
|
1158
|
-
return ">" +
|
|
1159
|
-
case
|
|
1160
|
-
return '"' +
|
|
1155
|
+
case Tr:
|
|
1156
|
+
return "|" + Tn(n, e.indent) + Ln(On(n, o));
|
|
1157
|
+
case Lr:
|
|
1158
|
+
return ">" + Tn(n, e.indent) + Ln(On(Jt(n, l), o));
|
|
1159
|
+
case ie:
|
|
1160
|
+
return '"' + Qt(n) + '"';
|
|
1161
1161
|
default:
|
|
1162
1162
|
throw new M("impossible error: invalid scalar style");
|
|
1163
1163
|
}
|
|
1164
1164
|
})();
|
|
1165
1165
|
}
|
|
1166
|
-
function
|
|
1167
|
-
var r =
|
|
1166
|
+
function Tn(e, n) {
|
|
1167
|
+
var r = _r(e) ? String(n) : "", i = e[e.length - 1] === `
|
|
1168
1168
|
`, t = i && (e[e.length - 2] === `
|
|
1169
1169
|
` || e === `
|
|
1170
1170
|
`), o = t ? "+" : i ? "" : "-";
|
|
1171
1171
|
return r + o + `
|
|
1172
1172
|
`;
|
|
1173
1173
|
}
|
|
1174
|
-
function
|
|
1174
|
+
function Ln(e) {
|
|
1175
1175
|
return e[e.length - 1] === `
|
|
1176
1176
|
` ? e.slice(0, -1) : e;
|
|
1177
1177
|
}
|
|
1178
|
-
function
|
|
1178
|
+
function Jt(e, n) {
|
|
1179
1179
|
for (var r = /(\n+)([^\n]*)/g, i = (function() {
|
|
1180
1180
|
var c = e.indexOf(`
|
|
1181
1181
|
`);
|
|
1182
|
-
return c = c !== -1 ? c : e.length, r.lastIndex = c,
|
|
1182
|
+
return c = c !== -1 ? c : e.length, r.lastIndex = c, jn(e.slice(0, c), n);
|
|
1183
1183
|
})(), t = e[0] === `
|
|
1184
1184
|
` || e[0] === " ", o, l; l = r.exec(e); ) {
|
|
1185
1185
|
var a = l[1], s = l[2];
|
|
1186
1186
|
o = s[0] === " ", i += a + (!t && !o && s !== "" ? `
|
|
1187
|
-
` : "") +
|
|
1187
|
+
` : "") + jn(s, n), t = o;
|
|
1188
1188
|
}
|
|
1189
1189
|
return i;
|
|
1190
1190
|
}
|
|
1191
|
-
function
|
|
1191
|
+
function jn(e, n) {
|
|
1192
1192
|
if (e === "" || e[0] === " ") return e;
|
|
1193
1193
|
for (var r = / [^ ]/g, i, t = 0, o, l = 0, a = 0, s = ""; i = r.exec(e); )
|
|
1194
1194
|
a = i.index, a - t > n && (o = l > t ? l : a, s += `
|
|
@@ -1197,31 +1197,31 @@ function kn(e, n) {
|
|
|
1197
1197
|
`, e.length - t > n && l > t ? s += e.slice(t, l) + `
|
|
1198
1198
|
` + e.slice(l + 1) : s += e.slice(t), s.slice(1);
|
|
1199
1199
|
}
|
|
1200
|
-
function
|
|
1200
|
+
function Qt(e) {
|
|
1201
1201
|
for (var n = "", r = 0, i, t = 0; t < e.length; r >= 65536 ? t += 2 : t++)
|
|
1202
|
-
r =
|
|
1202
|
+
r = he(e, t), i = N[r], !i && ve(r) ? (n += e[t], r >= 65536 && (n += e[t + 1])) : n += i || Yt(r);
|
|
1203
1203
|
return n;
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1205
|
+
function Zt(e, n, r) {
|
|
1206
1206
|
var i = "", t = e.tag, o, l, a;
|
|
1207
1207
|
for (o = 0, l = r.length; o < l; o += 1)
|
|
1208
1208
|
a = r[o], e.replacer && (a = e.replacer.call(r, String(o), a)), (W(e, n, a, !1, !1) || typeof a > "u" && W(e, n, null, !1, !1)) && (i !== "" && (i += "," + (e.condenseFlow ? "" : " ")), i += e.dump);
|
|
1209
1209
|
e.tag = t, e.dump = "[" + i + "]";
|
|
1210
1210
|
}
|
|
1211
|
-
function
|
|
1211
|
+
function In(e, n, r, i) {
|
|
1212
1212
|
var t = "", o = e.tag, l, a, s;
|
|
1213
1213
|
for (l = 0, a = r.length; l < a; l += 1)
|
|
1214
|
-
s = r[l], e.replacer && (s = e.replacer.call(r, String(l), s)), (W(e, n + 1, s, !0, !0, !1, !0) || typeof s > "u" && W(e, n + 1, null, !0, !0, !1, !0)) && ((!i || t !== "") && (t +=
|
|
1214
|
+
s = r[l], e.replacer && (s = e.replacer.call(r, String(l), s)), (W(e, n + 1, s, !0, !0, !1, !0) || typeof s > "u" && W(e, n + 1, null, !0, !0, !1, !0)) && ((!i || t !== "") && (t += Ge(e, n)), e.dump && me === e.dump.charCodeAt(0) ? t += "-" : t += "- ", t += e.dump);
|
|
1215
1215
|
e.tag = o, e.dump = t || "[]";
|
|
1216
1216
|
}
|
|
1217
|
-
function
|
|
1218
|
-
var i = "", t = e.tag, o = Object.keys(r), l, a, s, c,
|
|
1217
|
+
function eo(e, n, r) {
|
|
1218
|
+
var i = "", t = e.tag, o = Object.keys(r), l, a, s, c, f;
|
|
1219
1219
|
for (l = 0, a = o.length; l < a; l += 1)
|
|
1220
|
-
|
|
1220
|
+
f = "", i !== "" && (f += ", "), e.condenseFlow && (f += '"'), s = o[l], c = r[s], e.replacer && (c = e.replacer.call(r, s, c)), W(e, n, s, !1, !1) && (e.dump.length > 1024 && (f += "? "), f += e.dump + (e.condenseFlow ? '"' : "") + ":" + (e.condenseFlow ? "" : " "), W(e, n, c, !1, !1) && (f += e.dump, i += f));
|
|
1221
1221
|
e.tag = t, e.dump = "{" + i + "}";
|
|
1222
1222
|
}
|
|
1223
|
-
function
|
|
1224
|
-
var t = "", o = e.tag, l = Object.keys(r), a, s, c,
|
|
1223
|
+
function no(e, n, r, i) {
|
|
1224
|
+
var t = "", o = e.tag, l = Object.keys(r), a, s, c, f, u, h;
|
|
1225
1225
|
if (e.sortKeys === !0)
|
|
1226
1226
|
l.sort();
|
|
1227
1227
|
else if (typeof e.sortKeys == "function")
|
|
@@ -1229,17 +1229,17 @@ function Ht(e, n, r, i) {
|
|
|
1229
1229
|
else if (e.sortKeys)
|
|
1230
1230
|
throw new M("sortKeys must be a boolean or a function");
|
|
1231
1231
|
for (a = 0, s = l.length; a < s; a += 1)
|
|
1232
|
-
h = "", (!i || t !== "") && (h +=
|
|
1232
|
+
h = "", (!i || t !== "") && (h += Ge(e, n)), c = l[a], f = r[c], e.replacer && (f = e.replacer.call(r, c, f)), W(e, n + 1, c, !0, !0, !0) && (u = e.tag !== null && e.tag !== "?" || e.dump && e.dump.length > 1024, u && (e.dump && me === e.dump.charCodeAt(0) ? h += "?" : h += "? "), h += e.dump, u && (h += Ge(e, n)), W(e, n + 1, f, !0, u) && (e.dump && me === e.dump.charCodeAt(0) ? h += ":" : h += ": ", h += e.dump, t += h));
|
|
1233
1233
|
e.tag = o, e.dump = t || "{}";
|
|
1234
1234
|
}
|
|
1235
|
-
function
|
|
1235
|
+
function Nn(e, n, r) {
|
|
1236
1236
|
var i, t, o, l, a, s;
|
|
1237
1237
|
for (t = r ? e.explicitTypes : e.implicitTypes, o = 0, l = t.length; o < l; o += 1)
|
|
1238
1238
|
if (a = t[o], (a.instanceOf || a.predicate) && (!a.instanceOf || typeof n == "object" && n instanceof a.instanceOf) && (!a.predicate || a.predicate(n))) {
|
|
1239
1239
|
if (r ? a.multi && a.representName ? e.tag = a.representName(n) : e.tag = a.tag : e.tag = "?", a.represent) {
|
|
1240
|
-
if (s = e.styleMap[a.tag] || a.defaultStyle,
|
|
1240
|
+
if (s = e.styleMap[a.tag] || a.defaultStyle, br.call(a.represent) === "[object Function]")
|
|
1241
1241
|
i = a.represent(n, s);
|
|
1242
|
-
else if (
|
|
1242
|
+
else if (Ar.call(a.represent, s))
|
|
1243
1243
|
i = a.represent[s](n, s);
|
|
1244
1244
|
else
|
|
1245
1245
|
throw new M("!<" + a.tag + '> tag resolver accepts not "' + s + '" style');
|
|
@@ -1250,19 +1250,19 @@ function Sn(e, n, r) {
|
|
|
1250
1250
|
return !1;
|
|
1251
1251
|
}
|
|
1252
1252
|
function W(e, n, r, i, t, o, l) {
|
|
1253
|
-
e.tag = null, e.dump = r,
|
|
1254
|
-
var a =
|
|
1253
|
+
e.tag = null, e.dump = r, Nn(e, r, !1) || Nn(e, r, !0);
|
|
1254
|
+
var a = br.call(e.dump), s = i, c;
|
|
1255
1255
|
i && (i = e.flowLevel < 0 || e.flowLevel > n);
|
|
1256
|
-
var
|
|
1257
|
-
if (
|
|
1258
|
-
e.dump = "*ref_" +
|
|
1256
|
+
var f = a === "[object Object]" || a === "[object Array]", u, h;
|
|
1257
|
+
if (f && (u = e.duplicates.indexOf(r), h = u !== -1), (e.tag !== null && e.tag !== "?" || h || e.indent !== 2 && n > 0) && (t = !1), h && e.usedDuplicates[u])
|
|
1258
|
+
e.dump = "*ref_" + u;
|
|
1259
1259
|
else {
|
|
1260
|
-
if (
|
|
1261
|
-
i && Object.keys(e.dump).length !== 0 ? (
|
|
1260
|
+
if (f && h && !e.usedDuplicates[u] && (e.usedDuplicates[u] = !0), a === "[object Object]")
|
|
1261
|
+
i && Object.keys(e.dump).length !== 0 ? (no(e, n, e.dump, t), h && (e.dump = "&ref_" + u + e.dump)) : (eo(e, n, e.dump), h && (e.dump = "&ref_" + u + " " + e.dump));
|
|
1262
1262
|
else if (a === "[object Array]")
|
|
1263
|
-
i && e.dump.length !== 0 ? (e.noArrayIndent && !l && n > 0 ?
|
|
1263
|
+
i && e.dump.length !== 0 ? (e.noArrayIndent && !l && n > 0 ? In(e, n - 1, e.dump, t) : In(e, n, e.dump, t), h && (e.dump = "&ref_" + u + e.dump)) : (Zt(e, n, e.dump), h && (e.dump = "&ref_" + u + " " + e.dump));
|
|
1264
1264
|
else if (a === "[object String]")
|
|
1265
|
-
e.tag !== "?" &&
|
|
1265
|
+
e.tag !== "?" && Xt(e, e.dump, n, o, s);
|
|
1266
1266
|
else {
|
|
1267
1267
|
if (a === "[object Undefined]")
|
|
1268
1268
|
return !1;
|
|
@@ -1275,108 +1275,108 @@ function W(e, n, r, i, t, o, l) {
|
|
|
1275
1275
|
}
|
|
1276
1276
|
return !0;
|
|
1277
1277
|
}
|
|
1278
|
-
function
|
|
1278
|
+
function ro(e, n) {
|
|
1279
1279
|
var r = [], i = [], t, o;
|
|
1280
|
-
for (
|
|
1280
|
+
for (Xe(e, r, i), t = 0, o = i.length; t < o; t += 1)
|
|
1281
1281
|
n.duplicates.push(r[i[t]]);
|
|
1282
1282
|
n.usedDuplicates = new Array(o);
|
|
1283
1283
|
}
|
|
1284
|
-
function
|
|
1284
|
+
function Xe(e, n, r) {
|
|
1285
1285
|
var i, t, o;
|
|
1286
1286
|
if (e !== null && typeof e == "object")
|
|
1287
1287
|
if (t = n.indexOf(e), t !== -1)
|
|
1288
1288
|
r.indexOf(t) === -1 && r.push(t);
|
|
1289
1289
|
else if (n.push(e), Array.isArray(e))
|
|
1290
1290
|
for (t = 0, o = e.length; t < o; t += 1)
|
|
1291
|
-
|
|
1291
|
+
Xe(e[t], n, r);
|
|
1292
1292
|
else
|
|
1293
1293
|
for (i = Object.keys(e), t = 0, o = i.length; t < o; t += 1)
|
|
1294
|
-
|
|
1294
|
+
Xe(e[i[t]], n, r);
|
|
1295
1295
|
}
|
|
1296
|
-
function
|
|
1296
|
+
function io(e, n) {
|
|
1297
1297
|
n = n || {};
|
|
1298
|
-
var r = new
|
|
1299
|
-
r.noRefs ||
|
|
1298
|
+
var r = new Kt(n);
|
|
1299
|
+
r.noRefs || ro(e, r);
|
|
1300
1300
|
var i = e;
|
|
1301
1301
|
return r.replacer && (i = r.replacer.call({ "": i }, "", i)), W(r, 0, i, !0, !0) ? r.dump + `
|
|
1302
1302
|
` : "";
|
|
1303
1303
|
}
|
|
1304
|
-
var
|
|
1305
|
-
dump:
|
|
1304
|
+
var to = io, oo = {
|
|
1305
|
+
dump: to
|
|
1306
1306
|
};
|
|
1307
|
-
function
|
|
1307
|
+
function an(e, n) {
|
|
1308
1308
|
return function() {
|
|
1309
1309
|
throw new Error("Function yaml." + e + " is removed in js-yaml 4. Use yaml." + n + " instead, which is now safe by default.");
|
|
1310
1310
|
};
|
|
1311
1311
|
}
|
|
1312
|
-
var
|
|
1313
|
-
binary:
|
|
1314
|
-
float:
|
|
1315
|
-
map:
|
|
1316
|
-
null:
|
|
1317
|
-
pairs:
|
|
1318
|
-
set:
|
|
1319
|
-
timestamp:
|
|
1320
|
-
bool:
|
|
1321
|
-
int:
|
|
1322
|
-
merge:
|
|
1323
|
-
omap:
|
|
1324
|
-
seq:
|
|
1325
|
-
str:
|
|
1326
|
-
},
|
|
1327
|
-
Type:
|
|
1328
|
-
Schema:
|
|
1329
|
-
FAILSAFE_SCHEMA:
|
|
1330
|
-
JSON_SCHEMA:
|
|
1331
|
-
CORE_SCHEMA:
|
|
1332
|
-
DEFAULT_SCHEMA:
|
|
1333
|
-
load:
|
|
1334
|
-
loadAll:
|
|
1335
|
-
dump:
|
|
1336
|
-
YAMLException:
|
|
1337
|
-
types:
|
|
1338
|
-
safeLoad:
|
|
1339
|
-
safeLoadAll:
|
|
1340
|
-
safeDump:
|
|
1312
|
+
var lo = j, ao = Wn, so = Xn, co = nr, uo = rr, fo = rn, po = wr.load, ho = wr.loadAll, go = oo.dump, mo = M, yo = {
|
|
1313
|
+
binary: ar,
|
|
1314
|
+
float: er,
|
|
1315
|
+
map: Vn,
|
|
1316
|
+
null: Jn,
|
|
1317
|
+
pairs: cr,
|
|
1318
|
+
set: ur,
|
|
1319
|
+
timestamp: or,
|
|
1320
|
+
bool: Qn,
|
|
1321
|
+
int: Zn,
|
|
1322
|
+
merge: lr,
|
|
1323
|
+
omap: sr,
|
|
1324
|
+
seq: Gn,
|
|
1325
|
+
str: qn
|
|
1326
|
+
}, vo = an("safeLoad", "load"), xo = an("safeLoadAll", "loadAll"), wo = an("safeDump", "dump"), je = {
|
|
1327
|
+
Type: lo,
|
|
1328
|
+
Schema: ao,
|
|
1329
|
+
FAILSAFE_SCHEMA: so,
|
|
1330
|
+
JSON_SCHEMA: co,
|
|
1331
|
+
CORE_SCHEMA: uo,
|
|
1332
|
+
DEFAULT_SCHEMA: fo,
|
|
1333
|
+
load: po,
|
|
1334
|
+
loadAll: ho,
|
|
1335
|
+
dump: go,
|
|
1336
|
+
YAMLException: mo,
|
|
1337
|
+
types: yo,
|
|
1338
|
+
safeLoad: vo,
|
|
1339
|
+
safeLoadAll: xo,
|
|
1340
|
+
safeDump: wo
|
|
1341
1341
|
};
|
|
1342
|
-
const
|
|
1342
|
+
const pe = "xcstrings-cli", Pn = Vr(pe, {
|
|
1343
1343
|
searchPlaces: [
|
|
1344
|
-
`${
|
|
1345
|
-
`${
|
|
1346
|
-
`${
|
|
1347
|
-
`${
|
|
1344
|
+
`${pe}.json`,
|
|
1345
|
+
`${pe}.json5`,
|
|
1346
|
+
`${pe}.yaml`,
|
|
1347
|
+
`${pe}.yml`
|
|
1348
1348
|
],
|
|
1349
1349
|
loaders: {
|
|
1350
|
-
".json5": (e, n) =>
|
|
1351
|
-
".yaml": (e, n) =>
|
|
1352
|
-
".yml": (e, n) =>
|
|
1350
|
+
".json5": (e, n) => He.parse(n),
|
|
1351
|
+
".yaml": (e, n) => je.load(n),
|
|
1352
|
+
".yml": (e, n) => je.load(n)
|
|
1353
1353
|
},
|
|
1354
1354
|
cache: !1
|
|
1355
1355
|
});
|
|
1356
|
-
async function
|
|
1356
|
+
async function sn(e) {
|
|
1357
1357
|
if (e) {
|
|
1358
|
-
const r = await
|
|
1358
|
+
const r = await Pn.load(e);
|
|
1359
1359
|
return r ? r.config : null;
|
|
1360
1360
|
}
|
|
1361
|
-
const n = await
|
|
1361
|
+
const n = await Pn.search();
|
|
1362
1362
|
return n ? n.config : null;
|
|
1363
1363
|
}
|
|
1364
|
-
function
|
|
1364
|
+
function Rn(e, n) {
|
|
1365
1365
|
if (!e || e.length === 0) return null;
|
|
1366
1366
|
for (const r of e)
|
|
1367
1367
|
if (typeof r != "string" && r.alias === n)
|
|
1368
1368
|
return r.path;
|
|
1369
1369
|
return null;
|
|
1370
1370
|
}
|
|
1371
|
-
async function
|
|
1371
|
+
async function bo(e, n, r) {
|
|
1372
1372
|
const i = n?.xcstringsPaths, t = i?.some((s) => typeof s != "string") ?? !1, o = e.startsWith("alias:") ? e.slice(6) : null;
|
|
1373
1373
|
if (o) {
|
|
1374
|
-
const s =
|
|
1374
|
+
const s = Rn(i, o);
|
|
1375
1375
|
if (!s)
|
|
1376
1376
|
throw new Error(`Unknown alias: ${o}`);
|
|
1377
1377
|
return s;
|
|
1378
1378
|
}
|
|
1379
|
-
const l =
|
|
1379
|
+
const l = Rn(i, e);
|
|
1380
1380
|
if (l)
|
|
1381
1381
|
return l;
|
|
1382
1382
|
const a = !e.includes("/") && !e.endsWith(".xcstrings");
|
|
@@ -1384,28 +1384,36 @@ async function co(e, n, r) {
|
|
|
1384
1384
|
throw new Error(`Unknown alias: ${e}`);
|
|
1385
1385
|
if (e === r && i && i.length > 0) {
|
|
1386
1386
|
if (i.length === 1) {
|
|
1387
|
-
const
|
|
1388
|
-
return typeof
|
|
1387
|
+
const f = i[0];
|
|
1388
|
+
return typeof f == "string" ? f : f.path;
|
|
1389
1389
|
}
|
|
1390
|
-
const s = i.map((
|
|
1391
|
-
|
|
1390
|
+
const s = i.map((f) => typeof f == "string" ? { name: f, value: f } : {
|
|
1391
|
+
name: `${f.alias} (${f.path})`,
|
|
1392
|
+
value: f.path
|
|
1393
|
+
});
|
|
1394
|
+
return await Xr({
|
|
1392
1395
|
message: "Select xcstrings file:",
|
|
1393
1396
|
choices: s
|
|
1394
1397
|
});
|
|
1395
1398
|
}
|
|
1396
1399
|
return e;
|
|
1397
1400
|
}
|
|
1398
|
-
const
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
+
const Je = [
|
|
1402
|
+
"translated",
|
|
1403
|
+
"needs_review",
|
|
1404
|
+
"new",
|
|
1405
|
+
"stale"
|
|
1406
|
+
];
|
|
1407
|
+
async function Q(e) {
|
|
1408
|
+
const n = await Ke(e, "utf-8");
|
|
1401
1409
|
return JSON.parse(n);
|
|
1402
1410
|
}
|
|
1403
|
-
async function
|
|
1404
|
-
const r = JSON.stringify(n, null, 2), i =
|
|
1405
|
-
await
|
|
1411
|
+
async function cn(e, n) {
|
|
1412
|
+
const r = JSON.stringify(n, null, 2), i = Ao(r);
|
|
1413
|
+
await Ze(e, i + `
|
|
1406
1414
|
`, "utf-8");
|
|
1407
1415
|
}
|
|
1408
|
-
function
|
|
1416
|
+
function Ao(e) {
|
|
1409
1417
|
let n = "", r = !1, i = !1;
|
|
1410
1418
|
for (let t = 0; t < e.length; t++) {
|
|
1411
1419
|
const o = e[t];
|
|
@@ -1429,20 +1437,20 @@ function uo(e) {
|
|
|
1429
1437
|
}
|
|
1430
1438
|
return n;
|
|
1431
1439
|
}
|
|
1432
|
-
async function
|
|
1433
|
-
const e = await
|
|
1440
|
+
async function ko() {
|
|
1441
|
+
const e = await Jr({
|
|
1434
1442
|
message: "Enter strings payload (YAML or JSON). Save and close to submit.",
|
|
1435
1443
|
default: ""
|
|
1436
1444
|
});
|
|
1437
1445
|
return typeof e == "string" ? e : "";
|
|
1438
1446
|
}
|
|
1439
|
-
function
|
|
1447
|
+
function So(e) {
|
|
1440
1448
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
1441
1449
|
}
|
|
1442
|
-
var
|
|
1443
|
-
function
|
|
1444
|
-
if (
|
|
1445
|
-
|
|
1450
|
+
var de = { exports: {} }, $e, Mn;
|
|
1451
|
+
function Co() {
|
|
1452
|
+
if (Mn) return $e;
|
|
1453
|
+
Mn = 1;
|
|
1446
1454
|
function e(r) {
|
|
1447
1455
|
try {
|
|
1448
1456
|
return JSON.stringify(r);
|
|
@@ -1450,7 +1458,7 @@ function ho() {
|
|
|
1450
1458
|
return '"[Circular]"';
|
|
1451
1459
|
}
|
|
1452
1460
|
}
|
|
1453
|
-
|
|
1461
|
+
$e = n;
|
|
1454
1462
|
function n(r, i, t) {
|
|
1455
1463
|
var o = t && t.stringify || e, l = 1;
|
|
1456
1464
|
if (typeof r == "object" && r !== null) {
|
|
@@ -1464,63 +1472,63 @@ function ho() {
|
|
|
1464
1472
|
}
|
|
1465
1473
|
if (typeof r != "string")
|
|
1466
1474
|
return r;
|
|
1467
|
-
var
|
|
1468
|
-
if (
|
|
1469
|
-
for (var
|
|
1470
|
-
if (r.charCodeAt(d) === 37 && d + 1 <
|
|
1475
|
+
var f = i.length;
|
|
1476
|
+
if (f === 0) return r;
|
|
1477
|
+
for (var u = "", h = 1 - l, g = -1, m = r && r.length || 0, d = 0; d < m; ) {
|
|
1478
|
+
if (r.charCodeAt(d) === 37 && d + 1 < m) {
|
|
1471
1479
|
switch (g = g > -1 ? g : 0, r.charCodeAt(d + 1)) {
|
|
1472
1480
|
case 100:
|
|
1473
1481
|
// 'd'
|
|
1474
1482
|
case 102:
|
|
1475
|
-
if (h >=
|
|
1476
|
-
g < d && (
|
|
1483
|
+
if (h >= f || i[h] == null) break;
|
|
1484
|
+
g < d && (u += r.slice(g, d)), u += Number(i[h]), g = d + 2, d++;
|
|
1477
1485
|
break;
|
|
1478
1486
|
case 105:
|
|
1479
|
-
if (h >=
|
|
1480
|
-
g < d && (
|
|
1487
|
+
if (h >= f || i[h] == null) break;
|
|
1488
|
+
g < d && (u += r.slice(g, d)), u += Math.floor(Number(i[h])), g = d + 2, d++;
|
|
1481
1489
|
break;
|
|
1482
1490
|
case 79:
|
|
1483
1491
|
// 'O'
|
|
1484
1492
|
case 111:
|
|
1485
1493
|
// 'o'
|
|
1486
1494
|
case 106:
|
|
1487
|
-
if (h >=
|
|
1488
|
-
g < d && (
|
|
1489
|
-
var
|
|
1490
|
-
if (
|
|
1491
|
-
|
|
1495
|
+
if (h >= f || i[h] === void 0) break;
|
|
1496
|
+
g < d && (u += r.slice(g, d));
|
|
1497
|
+
var w = typeof i[h];
|
|
1498
|
+
if (w === "string") {
|
|
1499
|
+
u += "'" + i[h] + "'", g = d + 2, d++;
|
|
1492
1500
|
break;
|
|
1493
1501
|
}
|
|
1494
|
-
if (
|
|
1495
|
-
|
|
1502
|
+
if (w === "function") {
|
|
1503
|
+
u += i[h].name || "<anonymous>", g = d + 2, d++;
|
|
1496
1504
|
break;
|
|
1497
1505
|
}
|
|
1498
|
-
|
|
1506
|
+
u += o(i[h]), g = d + 2, d++;
|
|
1499
1507
|
break;
|
|
1500
1508
|
case 115:
|
|
1501
|
-
if (h >=
|
|
1509
|
+
if (h >= f)
|
|
1502
1510
|
break;
|
|
1503
|
-
g < d && (
|
|
1511
|
+
g < d && (u += r.slice(g, d)), u += String(i[h]), g = d + 2, d++;
|
|
1504
1512
|
break;
|
|
1505
1513
|
case 37:
|
|
1506
|
-
g < d && (
|
|
1514
|
+
g < d && (u += r.slice(g, d)), u += "%", g = d + 2, d++, h--;
|
|
1507
1515
|
break;
|
|
1508
1516
|
}
|
|
1509
1517
|
++h;
|
|
1510
1518
|
}
|
|
1511
1519
|
++d;
|
|
1512
1520
|
}
|
|
1513
|
-
return g === -1 ? r : (g <
|
|
1521
|
+
return g === -1 ? r : (g < m && (u += r.slice(g)), u);
|
|
1514
1522
|
}
|
|
1515
|
-
return
|
|
1523
|
+
return $e;
|
|
1516
1524
|
}
|
|
1517
|
-
var
|
|
1518
|
-
function
|
|
1519
|
-
if (
|
|
1520
|
-
|
|
1521
|
-
const e =
|
|
1522
|
-
|
|
1523
|
-
const n =
|
|
1525
|
+
var Dn;
|
|
1526
|
+
function Eo() {
|
|
1527
|
+
if (Dn) return de.exports;
|
|
1528
|
+
Dn = 1;
|
|
1529
|
+
const e = Co();
|
|
1530
|
+
de.exports = f;
|
|
1531
|
+
const n = Br().console || {}, r = {
|
|
1524
1532
|
mapHttpRequest: V,
|
|
1525
1533
|
mapHttpResponse: V,
|
|
1526
1534
|
wrapRequestSerializer: I,
|
|
@@ -1528,11 +1536,11 @@ function go() {
|
|
|
1528
1536
|
wrapErrorSerializer: I,
|
|
1529
1537
|
req: V,
|
|
1530
1538
|
res: V,
|
|
1531
|
-
err:
|
|
1532
|
-
errWithCause:
|
|
1539
|
+
err: P,
|
|
1540
|
+
errWithCause: P
|
|
1533
1541
|
};
|
|
1534
|
-
function i(p,
|
|
1535
|
-
return p === "silent" ? 1 / 0 :
|
|
1542
|
+
function i(p, y) {
|
|
1543
|
+
return p === "silent" ? 1 / 0 : y.levels.values[p];
|
|
1536
1544
|
}
|
|
1537
1545
|
const t = Symbol("pino.logFuncs"), o = Symbol("pino.hierarchy"), l = {
|
|
1538
1546
|
error: "log",
|
|
@@ -1542,101 +1550,101 @@ function go() {
|
|
|
1542
1550
|
debug: "log",
|
|
1543
1551
|
trace: "log"
|
|
1544
1552
|
};
|
|
1545
|
-
function a(p,
|
|
1553
|
+
function a(p, y) {
|
|
1546
1554
|
const A = {
|
|
1547
|
-
logger:
|
|
1555
|
+
logger: y,
|
|
1548
1556
|
parent: p[o]
|
|
1549
1557
|
};
|
|
1550
|
-
|
|
1558
|
+
y[o] = A;
|
|
1551
1559
|
}
|
|
1552
|
-
function s(p,
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
}), p[t] =
|
|
1560
|
+
function s(p, y, A) {
|
|
1561
|
+
const C = {};
|
|
1562
|
+
y.forEach((E) => {
|
|
1563
|
+
C[E] = A[E] ? A[E] : n[E] || n[l[E] || "log"] || fe;
|
|
1564
|
+
}), p[t] = C;
|
|
1557
1565
|
}
|
|
1558
|
-
function c(p,
|
|
1559
|
-
return Array.isArray(p) ? p.filter(function(
|
|
1560
|
-
return
|
|
1561
|
-
}) : p === !0 ? Object.keys(
|
|
1566
|
+
function c(p, y) {
|
|
1567
|
+
return Array.isArray(p) ? p.filter(function(C) {
|
|
1568
|
+
return C !== "!stdSerializers.err";
|
|
1569
|
+
}) : p === !0 ? Object.keys(y) : !1;
|
|
1562
1570
|
}
|
|
1563
|
-
function
|
|
1571
|
+
function f(p) {
|
|
1564
1572
|
p = p || {}, p.browser = p.browser || {};
|
|
1565
|
-
const
|
|
1566
|
-
if (
|
|
1573
|
+
const y = p.browser.transmit;
|
|
1574
|
+
if (y && typeof y.send != "function")
|
|
1567
1575
|
throw Error("pino: transmit option must have a send function");
|
|
1568
1576
|
const A = p.browser.write || n;
|
|
1569
1577
|
p.browser.write && (p.browser.asObject = !0);
|
|
1570
|
-
const
|
|
1571
|
-
let
|
|
1572
|
-
Array.isArray(p.browser.serialize) && p.browser.serialize.indexOf("!stdSerializers.err") > -1 && (
|
|
1573
|
-
const K = Object.keys(p.customLevels || {}),
|
|
1574
|
-
typeof A == "function" &&
|
|
1575
|
-
A[
|
|
1578
|
+
const C = p.serializers || {}, E = c(p.browser.serialize, C);
|
|
1579
|
+
let $ = p.browser.serialize;
|
|
1580
|
+
Array.isArray(p.browser.serialize) && p.browser.serialize.indexOf("!stdSerializers.err") > -1 && ($ = !1);
|
|
1581
|
+
const K = Object.keys(p.customLevels || {}), _ = ["error", "fatal", "warn", "info", "debug", "trace"].concat(K);
|
|
1582
|
+
typeof A == "function" && _.forEach(function(U) {
|
|
1583
|
+
A[U] = A;
|
|
1576
1584
|
}), (p.enabled === !1 || p.browser.disabled) && (p.level = "silent");
|
|
1577
|
-
const
|
|
1578
|
-
|
|
1579
|
-
get:
|
|
1580
|
-
}), Object.defineProperty(
|
|
1581
|
-
get:
|
|
1582
|
-
set:
|
|
1585
|
+
const R = p.level || "info", b = Object.create(A);
|
|
1586
|
+
b.log || (b.log = fe), s(b, _, A), a({}, b), Object.defineProperty(b, "levelVal", {
|
|
1587
|
+
get: be
|
|
1588
|
+
}), Object.defineProperty(b, "level", {
|
|
1589
|
+
get: ee,
|
|
1590
|
+
set: Yr
|
|
1583
1591
|
});
|
|
1584
1592
|
const Y = {
|
|
1585
|
-
transmit:
|
|
1593
|
+
transmit: y,
|
|
1586
1594
|
serialize: E,
|
|
1587
1595
|
asObject: p.browser.asObject,
|
|
1588
1596
|
formatters: p.browser.formatters,
|
|
1589
|
-
levels:
|
|
1590
|
-
timestamp:
|
|
1597
|
+
levels: _,
|
|
1598
|
+
timestamp: Z(p)
|
|
1591
1599
|
};
|
|
1592
|
-
|
|
1593
|
-
function
|
|
1600
|
+
b.levels = u(p), b.level = R, b.setMaxListeners = b.getMaxListeners = b.emit = b.addListener = b.on = b.prependListener = b.once = b.prependOnceListener = b.removeListener = b.removeAllListeners = b.listeners = b.listenerCount = b.eventNames = b.write = b.flush = fe, b.serializers = C, b._serialize = E, b._stdErrSerialize = $, b.child = Hr, y && (b._logEvent = L());
|
|
1601
|
+
function be() {
|
|
1594
1602
|
return i(this.level, this);
|
|
1595
1603
|
}
|
|
1596
|
-
function
|
|
1604
|
+
function ee() {
|
|
1597
1605
|
return this._level;
|
|
1598
1606
|
}
|
|
1599
|
-
function
|
|
1600
|
-
if (
|
|
1601
|
-
throw Error("unknown level " +
|
|
1602
|
-
this._level =
|
|
1603
|
-
|
|
1607
|
+
function Yr(U) {
|
|
1608
|
+
if (U !== "silent" && !this.levels.values[U])
|
|
1609
|
+
throw Error("unknown level " + U);
|
|
1610
|
+
this._level = U, m(this, Y, b, "error"), m(this, Y, b, "fatal"), m(this, Y, b, "warn"), m(this, Y, b, "info"), m(this, Y, b, "debug"), m(this, Y, b, "trace"), K.forEach((ne) => {
|
|
1611
|
+
m(this, Y, b, ne);
|
|
1604
1612
|
});
|
|
1605
1613
|
}
|
|
1606
|
-
function
|
|
1607
|
-
if (!
|
|
1614
|
+
function Hr(U, ne) {
|
|
1615
|
+
if (!U)
|
|
1608
1616
|
throw new Error("missing bindings for child Pino");
|
|
1609
|
-
|
|
1610
|
-
const
|
|
1611
|
-
if (E &&
|
|
1612
|
-
var
|
|
1613
|
-
delete
|
|
1617
|
+
ne = ne || {}, E && U.serializers && (ne.serializers = U.serializers);
|
|
1618
|
+
const dn = ne.serializers;
|
|
1619
|
+
if (E && dn) {
|
|
1620
|
+
var Ae = Object.assign({}, C, dn), hn = p.browser.serialize === !0 ? Object.keys(Ae) : E;
|
|
1621
|
+
delete U.serializers, v([U], hn, Ae, this._stdErrSerialize);
|
|
1614
1622
|
}
|
|
1615
|
-
function
|
|
1616
|
-
this._childLevel = (
|
|
1617
|
-
[].concat(
|
|
1623
|
+
function gn(mn) {
|
|
1624
|
+
this._childLevel = (mn._childLevel | 0) + 1, this.bindings = U, Ae && (this.serializers = Ae, this._serialize = hn), y && (this._logEvent = L(
|
|
1625
|
+
[].concat(mn._logEvent.bindings, U)
|
|
1618
1626
|
));
|
|
1619
1627
|
}
|
|
1620
|
-
|
|
1621
|
-
const
|
|
1622
|
-
return a(this,
|
|
1628
|
+
gn.prototype = this;
|
|
1629
|
+
const Re = new gn(this);
|
|
1630
|
+
return a(this, Re), Re.level = this.level, Re;
|
|
1623
1631
|
}
|
|
1624
|
-
return
|
|
1632
|
+
return b;
|
|
1625
1633
|
}
|
|
1626
|
-
function
|
|
1627
|
-
const
|
|
1634
|
+
function u(p) {
|
|
1635
|
+
const y = p.customLevels || {}, A = Object.assign({}, f.levels.values, y), C = Object.assign({}, f.levels.labels, h(y));
|
|
1628
1636
|
return {
|
|
1629
1637
|
values: A,
|
|
1630
|
-
labels:
|
|
1638
|
+
labels: C
|
|
1631
1639
|
};
|
|
1632
1640
|
}
|
|
1633
1641
|
function h(p) {
|
|
1634
|
-
const
|
|
1642
|
+
const y = {};
|
|
1635
1643
|
return Object.keys(p).forEach(function(A) {
|
|
1636
|
-
|
|
1637
|
-
}),
|
|
1644
|
+
y[p[A]] = A;
|
|
1645
|
+
}), y;
|
|
1638
1646
|
}
|
|
1639
|
-
|
|
1647
|
+
f.levels = {
|
|
1640
1648
|
values: {
|
|
1641
1649
|
fatal: 60,
|
|
1642
1650
|
error: 50,
|
|
@@ -1653,88 +1661,88 @@ function go() {
|
|
|
1653
1661
|
50: "error",
|
|
1654
1662
|
60: "fatal"
|
|
1655
1663
|
}
|
|
1656
|
-
},
|
|
1664
|
+
}, f.stdSerializers = r, f.stdTimeFunctions = Object.assign({}, { nullTime: fn, epochTime: pn, unixTime: $r, isoTime: Ur });
|
|
1657
1665
|
function g(p) {
|
|
1658
|
-
const
|
|
1659
|
-
p.bindings &&
|
|
1666
|
+
const y = [];
|
|
1667
|
+
p.bindings && y.push(p.bindings);
|
|
1660
1668
|
let A = p[o];
|
|
1661
1669
|
for (; A.parent; )
|
|
1662
|
-
A = A.parent, A.logger.bindings &&
|
|
1663
|
-
return
|
|
1670
|
+
A = A.parent, A.logger.bindings && y.push(A.logger.bindings);
|
|
1671
|
+
return y.reverse();
|
|
1664
1672
|
}
|
|
1665
|
-
function
|
|
1666
|
-
if (Object.defineProperty(p,
|
|
1667
|
-
value: i(p.level, A) > i(
|
|
1673
|
+
function m(p, y, A, C) {
|
|
1674
|
+
if (Object.defineProperty(p, C, {
|
|
1675
|
+
value: i(p.level, A) > i(C, A) ? fe : A[t][C],
|
|
1668
1676
|
writable: !0,
|
|
1669
1677
|
enumerable: !0,
|
|
1670
1678
|
configurable: !0
|
|
1671
|
-
}), !
|
|
1679
|
+
}), !y.transmit && p[C] === fe)
|
|
1672
1680
|
return;
|
|
1673
|
-
p[
|
|
1681
|
+
p[C] = w(p, y, A, C);
|
|
1674
1682
|
const E = g(p);
|
|
1675
|
-
E.length !== 0 && (p[
|
|
1683
|
+
E.length !== 0 && (p[C] = d(E, p[C]));
|
|
1676
1684
|
}
|
|
1677
|
-
function d(p,
|
|
1685
|
+
function d(p, y) {
|
|
1678
1686
|
return function() {
|
|
1679
|
-
return
|
|
1687
|
+
return y.apply(this, [...p, ...arguments]);
|
|
1680
1688
|
};
|
|
1681
1689
|
}
|
|
1682
|
-
function
|
|
1690
|
+
function w(p, y, A, C) {
|
|
1683
1691
|
return /* @__PURE__ */ (function(E) {
|
|
1684
1692
|
return function() {
|
|
1685
|
-
const K =
|
|
1686
|
-
for (var
|
|
1687
|
-
if (
|
|
1688
|
-
const Y =
|
|
1689
|
-
if (
|
|
1690
|
-
|
|
1693
|
+
const K = y.timestamp(), _ = new Array(arguments.length), R = Object.getPrototypeOf && Object.getPrototypeOf(this) === n ? n : this;
|
|
1694
|
+
for (var b = 0; b < _.length; b++) _[b] = arguments[b];
|
|
1695
|
+
if (y.serialize && !y.asObject && v(_, this._serialize, this.serializers, this._stdErrSerialize), y.asObject || y.formatters ? E.call(R, k(this, C, _, K, y.formatters)) : E.apply(R, _), y.transmit) {
|
|
1696
|
+
const Y = y.transmit.level || p._level, be = A.levels.values[Y], ee = A.levels.values[C];
|
|
1697
|
+
if (ee < be) return;
|
|
1698
|
+
O(this, {
|
|
1691
1699
|
ts: K,
|
|
1692
|
-
methodLevel:
|
|
1693
|
-
methodValue:
|
|
1694
|
-
transmitValue: A.levels.values[
|
|
1695
|
-
send:
|
|
1700
|
+
methodLevel: C,
|
|
1701
|
+
methodValue: ee,
|
|
1702
|
+
transmitValue: A.levels.values[y.transmit.level || p._level],
|
|
1703
|
+
send: y.transmit.send,
|
|
1696
1704
|
val: i(p._level, A)
|
|
1697
|
-
},
|
|
1705
|
+
}, _);
|
|
1698
1706
|
}
|
|
1699
1707
|
};
|
|
1700
|
-
})(p[t][
|
|
1708
|
+
})(p[t][C]);
|
|
1701
1709
|
}
|
|
1702
|
-
function
|
|
1710
|
+
function k(p, y, A, C, E = {}) {
|
|
1703
1711
|
const {
|
|
1704
|
-
level:
|
|
1705
|
-
log: K = (
|
|
1712
|
+
level: $ = () => p.levels.values[y],
|
|
1713
|
+
log: K = (ee) => ee
|
|
1706
1714
|
} = E;
|
|
1707
|
-
p._serialize &&
|
|
1708
|
-
const
|
|
1709
|
-
let
|
|
1710
|
-
const
|
|
1711
|
-
|
|
1715
|
+
p._serialize && v(A, p._serialize, p.serializers, p._stdErrSerialize);
|
|
1716
|
+
const _ = A.slice();
|
|
1717
|
+
let R = _[0];
|
|
1718
|
+
const b = {};
|
|
1719
|
+
C && (b.time = C), b.level = $(y, p.levels.values[y]);
|
|
1712
1720
|
let Y = (p._childLevel | 0) + 1;
|
|
1713
|
-
if (Y < 1 && (Y = 1),
|
|
1714
|
-
for (; Y-- && typeof
|
|
1715
|
-
Object.assign(
|
|
1716
|
-
|
|
1717
|
-
} else typeof
|
|
1718
|
-
return
|
|
1719
|
-
}
|
|
1720
|
-
function
|
|
1721
|
+
if (Y < 1 && (Y = 1), R !== null && typeof R == "object") {
|
|
1722
|
+
for (; Y-- && typeof _[0] == "object"; )
|
|
1723
|
+
Object.assign(b, _.shift());
|
|
1724
|
+
R = _.length ? e(_.shift(), _) : void 0;
|
|
1725
|
+
} else typeof R == "string" && (R = e(_.shift(), _));
|
|
1726
|
+
return R !== void 0 && (b.msg = R), K(b);
|
|
1727
|
+
}
|
|
1728
|
+
function v(p, y, A, C) {
|
|
1721
1729
|
for (const E in p)
|
|
1722
|
-
if (
|
|
1723
|
-
p[E] =
|
|
1730
|
+
if (C && p[E] instanceof Error)
|
|
1731
|
+
p[E] = f.stdSerializers.err(p[E]);
|
|
1724
1732
|
else if (typeof p[E] == "object" && !Array.isArray(p[E]))
|
|
1725
|
-
for (const
|
|
1726
|
-
|
|
1733
|
+
for (const $ in p[E])
|
|
1734
|
+
y && y.indexOf($) > -1 && $ in A && (p[E][$] = A[$](p[E][$]));
|
|
1727
1735
|
}
|
|
1728
|
-
function
|
|
1729
|
-
const
|
|
1730
|
-
|
|
1736
|
+
function O(p, y, A) {
|
|
1737
|
+
const C = y.send, E = y.ts, $ = y.methodLevel, K = y.methodValue, _ = y.val, R = p._logEvent.bindings;
|
|
1738
|
+
v(
|
|
1731
1739
|
A,
|
|
1732
1740
|
p._serialize || Object.keys(p.serializers),
|
|
1733
1741
|
p.serializers,
|
|
1734
1742
|
p._stdErrSerialize === void 0 ? !0 : p._stdErrSerialize
|
|
1735
|
-
), p._logEvent.ts = E, p._logEvent.messages = A.filter(function(
|
|
1736
|
-
return
|
|
1737
|
-
}), p._logEvent.level.label =
|
|
1743
|
+
), p._logEvent.ts = E, p._logEvent.messages = A.filter(function(b) {
|
|
1744
|
+
return R.indexOf(b) === -1;
|
|
1745
|
+
}), p._logEvent.level.label = $, p._logEvent.level.value = K, C($, p._logEvent, _), p._logEvent = L(R);
|
|
1738
1746
|
}
|
|
1739
1747
|
function L(p) {
|
|
1740
1748
|
return {
|
|
@@ -1744,18 +1752,18 @@ function go() {
|
|
|
1744
1752
|
level: { label: "", value: 0 }
|
|
1745
1753
|
};
|
|
1746
1754
|
}
|
|
1747
|
-
function
|
|
1748
|
-
const
|
|
1755
|
+
function P(p) {
|
|
1756
|
+
const y = {
|
|
1749
1757
|
type: p.constructor.name,
|
|
1750
1758
|
msg: p.message,
|
|
1751
1759
|
stack: p.stack
|
|
1752
1760
|
};
|
|
1753
1761
|
for (const A in p)
|
|
1754
|
-
|
|
1755
|
-
return
|
|
1762
|
+
y[A] === void 0 && (y[A] = p[A]);
|
|
1763
|
+
return y;
|
|
1756
1764
|
}
|
|
1757
|
-
function
|
|
1758
|
-
return typeof p.timestamp == "function" ? p.timestamp : p.timestamp === !1 ?
|
|
1765
|
+
function Z(p) {
|
|
1766
|
+
return typeof p.timestamp == "function" ? p.timestamp : p.timestamp === !1 ? fn : pn;
|
|
1759
1767
|
}
|
|
1760
1768
|
function V() {
|
|
1761
1769
|
return {};
|
|
@@ -1763,23 +1771,23 @@ function go() {
|
|
|
1763
1771
|
function I(p) {
|
|
1764
1772
|
return p;
|
|
1765
1773
|
}
|
|
1766
|
-
function
|
|
1774
|
+
function fe() {
|
|
1767
1775
|
}
|
|
1768
|
-
function
|
|
1776
|
+
function fn() {
|
|
1769
1777
|
return !1;
|
|
1770
1778
|
}
|
|
1771
|
-
function
|
|
1779
|
+
function pn() {
|
|
1772
1780
|
return Date.now();
|
|
1773
1781
|
}
|
|
1774
|
-
function
|
|
1782
|
+
function $r() {
|
|
1775
1783
|
return Math.round(Date.now() / 1e3);
|
|
1776
1784
|
}
|
|
1777
|
-
function
|
|
1785
|
+
function Ur() {
|
|
1778
1786
|
return new Date(Date.now()).toISOString();
|
|
1779
1787
|
}
|
|
1780
|
-
function
|
|
1781
|
-
function p(
|
|
1782
|
-
return typeof
|
|
1788
|
+
function Br() {
|
|
1789
|
+
function p(y) {
|
|
1790
|
+
return typeof y < "u" && y;
|
|
1783
1791
|
}
|
|
1784
1792
|
try {
|
|
1785
1793
|
return typeof globalThis < "u" || Object.defineProperty(Object.prototype, "globalThis", {
|
|
@@ -1792,28 +1800,31 @@ function go() {
|
|
|
1792
1800
|
return p(self) || p(window) || p(this) || {};
|
|
1793
1801
|
}
|
|
1794
1802
|
}
|
|
1795
|
-
return
|
|
1803
|
+
return de.exports.default = f, de.exports.pino = f, de.exports;
|
|
1796
1804
|
}
|
|
1797
|
-
var
|
|
1798
|
-
const
|
|
1805
|
+
var Oo = Eo();
|
|
1806
|
+
const _o = /* @__PURE__ */ So(Oo), X = _o({
|
|
1799
1807
|
level: process.env.LOG_LEVEL || "info"
|
|
1800
1808
|
});
|
|
1801
|
-
function
|
|
1809
|
+
function Fo() {
|
|
1802
1810
|
return {
|
|
1803
1811
|
command: "languages",
|
|
1804
1812
|
describe: "List supported languages from xcodeproj or xcstrings",
|
|
1805
1813
|
handler: async (e) => {
|
|
1806
|
-
const n = await
|
|
1814
|
+
const n = await jr(
|
|
1815
|
+
e.path,
|
|
1816
|
+
e.config
|
|
1817
|
+
);
|
|
1807
1818
|
X.info(n.join(" "));
|
|
1808
1819
|
}
|
|
1809
1820
|
};
|
|
1810
1821
|
}
|
|
1811
|
-
function
|
|
1812
|
-
const n =
|
|
1813
|
-
return (
|
|
1822
|
+
function To(e) {
|
|
1823
|
+
const n = Ne(e, "project.pbxproj");
|
|
1824
|
+
return (ei.open(n).rootObject.props.knownRegions ?? []).filter((o) => o !== "Base").sort();
|
|
1814
1825
|
}
|
|
1815
|
-
async function
|
|
1816
|
-
const n = await
|
|
1826
|
+
async function Lo(e) {
|
|
1827
|
+
const n = await Q(e), r = /* @__PURE__ */ new Set();
|
|
1817
1828
|
if (!n.sourceLanguage)
|
|
1818
1829
|
throw new Error('The xcstrings file is missing "sourceLanguage".');
|
|
1819
1830
|
r.add(n.sourceLanguage);
|
|
@@ -1825,60 +1836,66 @@ async function wo(e) {
|
|
|
1825
1836
|
}
|
|
1826
1837
|
return Array.from(r).sort();
|
|
1827
1838
|
}
|
|
1828
|
-
async function
|
|
1829
|
-
const { sourceLanguage: r } = await
|
|
1839
|
+
async function jr(e, n) {
|
|
1840
|
+
const { sourceLanguage: r } = await Q(e);
|
|
1830
1841
|
if (!r)
|
|
1831
1842
|
throw new Error('The xcstrings file is missing "sourceLanguage".');
|
|
1832
|
-
const i = await
|
|
1843
|
+
const i = await sn(n);
|
|
1833
1844
|
if (i?.xcodeprojPaths && i.xcodeprojPaths.length > 0) {
|
|
1834
1845
|
const l = /* @__PURE__ */ new Set();
|
|
1835
1846
|
l.add(r);
|
|
1836
1847
|
for (const a of i.xcodeprojPaths)
|
|
1837
|
-
|
|
1848
|
+
To(a).forEach((c) => l.add(c));
|
|
1838
1849
|
return Array.from(l).sort();
|
|
1839
1850
|
}
|
|
1840
|
-
const t = await
|
|
1851
|
+
const t = await Lo(e), o = new Set(t);
|
|
1841
1852
|
return o.add(r), Array.from(o).sort();
|
|
1842
1853
|
}
|
|
1843
|
-
class
|
|
1854
|
+
class ae extends Error {
|
|
1844
1855
|
constructor(n) {
|
|
1845
1856
|
super(n), this.name = "ArgumentError";
|
|
1846
1857
|
}
|
|
1847
1858
|
}
|
|
1848
|
-
const
|
|
1859
|
+
const Se = (e) => e instanceof Error ? e.message : String(e), Ce = (e, n) => {
|
|
1849
1860
|
if (e && typeof e == "object" && !Array.isArray(e))
|
|
1850
1861
|
return e;
|
|
1851
1862
|
throw new Error(`Parsed --strings as ${n}, but it was not an object.`);
|
|
1852
|
-
},
|
|
1863
|
+
}, jo = (e, n) => {
|
|
1853
1864
|
const r = e.trim();
|
|
1854
1865
|
if (!r)
|
|
1855
1866
|
return {};
|
|
1856
1867
|
if (n === "json")
|
|
1857
1868
|
try {
|
|
1858
|
-
return Ce(
|
|
1869
|
+
return Ce(He.parse(r), "json");
|
|
1859
1870
|
} catch (t) {
|
|
1860
|
-
throw new Error(
|
|
1871
|
+
throw new Error(
|
|
1872
|
+
`Failed to parse --strings as JSON. Hint: check --strings-format=json. ${Se(t)}`
|
|
1873
|
+
);
|
|
1861
1874
|
}
|
|
1862
1875
|
if (n === "yaml")
|
|
1863
1876
|
try {
|
|
1864
|
-
return Ce(
|
|
1877
|
+
return Ce(je.load(r), "yaml");
|
|
1865
1878
|
} catch (t) {
|
|
1866
|
-
throw new Error(
|
|
1879
|
+
throw new Error(
|
|
1880
|
+
`Failed to parse --strings as YAML. Hint: check --strings-format=yaml. ${Se(t)}`
|
|
1881
|
+
);
|
|
1867
1882
|
}
|
|
1868
1883
|
const i = [];
|
|
1869
1884
|
try {
|
|
1870
|
-
return Ce(
|
|
1885
|
+
return Ce(je.load(r), "yaml");
|
|
1871
1886
|
} catch (t) {
|
|
1872
|
-
i.push(`yaml error: ${
|
|
1887
|
+
i.push(`yaml error: ${Se(t)}`);
|
|
1873
1888
|
}
|
|
1874
1889
|
try {
|
|
1875
|
-
return Ce(
|
|
1890
|
+
return Ce(He.parse(r), "json");
|
|
1876
1891
|
} catch (t) {
|
|
1877
|
-
i.push(`json error: ${
|
|
1892
|
+
i.push(`json error: ${Se(t)}`);
|
|
1878
1893
|
}
|
|
1879
|
-
throw new Error(
|
|
1894
|
+
throw new Error(
|
|
1895
|
+
`Failed to parse --strings input. Provide valid YAML or JSON, or specify --strings-format. ${i.join(" | ")}`
|
|
1896
|
+
);
|
|
1880
1897
|
};
|
|
1881
|
-
async function
|
|
1898
|
+
async function Ir() {
|
|
1882
1899
|
return new Promise((e) => {
|
|
1883
1900
|
let n = "";
|
|
1884
1901
|
process.stdin.setEncoding("utf8"), process.stdin.on("data", (r) => {
|
|
@@ -1888,12 +1905,14 @@ async function _r() {
|
|
|
1888
1905
|
}), process.stdin.readableEnded && e("");
|
|
1889
1906
|
});
|
|
1890
1907
|
}
|
|
1891
|
-
const
|
|
1908
|
+
const Nr = (e) => {
|
|
1892
1909
|
if (e === void 0) return "translated";
|
|
1893
|
-
if (
|
|
1910
|
+
if (Je.includes(e))
|
|
1894
1911
|
return e;
|
|
1895
|
-
throw new Error(
|
|
1896
|
-
}
|
|
1912
|
+
throw new Error(
|
|
1913
|
+
`Invalid state "${e}". Allowed values: ${Je.join(", ")}.`
|
|
1914
|
+
);
|
|
1915
|
+
}, Pr = (e, n) => {
|
|
1897
1916
|
if (typeof e == "string")
|
|
1898
1917
|
return { value: e, state: void 0 };
|
|
1899
1918
|
if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
@@ -1901,18 +1920,23 @@ const Or = (e) => {
|
|
|
1901
1920
|
if (typeof r.value != "string")
|
|
1902
1921
|
throw new Error(`${n} must include a string "value".`);
|
|
1903
1922
|
let i;
|
|
1904
|
-
return r.state !== void 0 && (i =
|
|
1923
|
+
return r.state !== void 0 && (i = Nr(String(r.state))), { value: r.value, state: i };
|
|
1905
1924
|
}
|
|
1906
|
-
throw new Error(
|
|
1907
|
-
}
|
|
1925
|
+
throw new Error(
|
|
1926
|
+
`${n} must be a string or an object with "value" (and optional "state").`
|
|
1927
|
+
);
|
|
1928
|
+
}, Qe = (e, n) => {
|
|
1908
1929
|
if (e === void 0) return;
|
|
1909
1930
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
1910
1931
|
throw new Error(`${n} must be an object of language -> text.`);
|
|
1911
1932
|
const r = {};
|
|
1912
1933
|
for (const [i, t] of Object.entries(e))
|
|
1913
|
-
r[i] =
|
|
1934
|
+
r[i] = Pr(
|
|
1935
|
+
t,
|
|
1936
|
+
`${n} for "${i}"`
|
|
1937
|
+
);
|
|
1914
1938
|
return r;
|
|
1915
|
-
},
|
|
1939
|
+
}, Io = (e, n) => {
|
|
1916
1940
|
if (e == null)
|
|
1917
1941
|
return {};
|
|
1918
1942
|
if (typeof e == "string")
|
|
@@ -1921,33 +1945,43 @@ const Or = (e) => {
|
|
|
1921
1945
|
throw new Error(`Value for "${n}" must be an object.`);
|
|
1922
1946
|
const r = e, i = {};
|
|
1923
1947
|
typeof r.comment == "string" && (i.comment = r.comment);
|
|
1924
|
-
const t =
|
|
1948
|
+
const t = Qe(r.translations, `translations for "${n}"`) || {}, o = {};
|
|
1925
1949
|
for (const [a, s] of Object.entries(r))
|
|
1926
|
-
a === "comment" || a === "translations" || (o[a] =
|
|
1927
|
-
|
|
1950
|
+
a === "comment" || a === "translations" || (o[a] = Pr(
|
|
1951
|
+
s,
|
|
1952
|
+
`Translation for "${a}" in "${n}"`
|
|
1953
|
+
));
|
|
1954
|
+
const l = {
|
|
1955
|
+
...t,
|
|
1956
|
+
...o
|
|
1957
|
+
};
|
|
1928
1958
|
return Object.keys(l).length > 0 && (i.translations = l), i;
|
|
1929
|
-
},
|
|
1959
|
+
}, No = (e) => {
|
|
1930
1960
|
if (typeof e == "string") return !0;
|
|
1931
1961
|
if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
1932
1962
|
const n = e;
|
|
1933
1963
|
return typeof n.value == "string" && (n.state === void 0 || typeof n.state == "string");
|
|
1934
1964
|
}
|
|
1935
1965
|
return !1;
|
|
1936
|
-
},
|
|
1937
|
-
if (
|
|
1938
|
-
return { kind: "single", translations:
|
|
1939
|
-
if (Object.keys(e).every(
|
|
1940
|
-
|
|
1966
|
+
}, Po = (e) => Object.values(e).every((n) => No(n)), Ro = (e) => {
|
|
1967
|
+
if (Po(e))
|
|
1968
|
+
return { kind: "single", translations: Qe(e, "translations") || {} };
|
|
1969
|
+
if (Object.keys(e).every(
|
|
1970
|
+
(i) => i === "translations" || i === "comment"
|
|
1971
|
+
) && "translations" in e) {
|
|
1972
|
+
const i = Qe(e.translations, "translations") || {}, t = typeof e.comment == "string" ? e.comment : void 0;
|
|
1941
1973
|
return { kind: "single", translations: i, comment: t };
|
|
1942
1974
|
}
|
|
1943
1975
|
const r = {};
|
|
1944
1976
|
for (const [i, t] of Object.entries(e))
|
|
1945
|
-
r[i] =
|
|
1977
|
+
r[i] = Io(t, i);
|
|
1946
1978
|
return { kind: "multi", entries: r };
|
|
1947
|
-
},
|
|
1979
|
+
}, Mo = (e, n) => {
|
|
1948
1980
|
if (!e) return n;
|
|
1949
1981
|
if (e.kind !== n.kind)
|
|
1950
|
-
throw new Error(
|
|
1982
|
+
throw new Error(
|
|
1983
|
+
"Cannot merge single and multi --strings payloads. Provide one consistent shape."
|
|
1984
|
+
);
|
|
1951
1985
|
if (e.kind === "single" && n.kind === "single")
|
|
1952
1986
|
return {
|
|
1953
1987
|
kind: "single",
|
|
@@ -1960,19 +1994,22 @@ const Or = (e) => {
|
|
|
1960
1994
|
const o = r[i] || {};
|
|
1961
1995
|
r[i] = {
|
|
1962
1996
|
comment: t.comment ?? o.comment,
|
|
1963
|
-
translations: {
|
|
1997
|
+
translations: {
|
|
1998
|
+
...o.translations || {},
|
|
1999
|
+
...t.translations || {}
|
|
2000
|
+
}
|
|
1964
2001
|
};
|
|
1965
2002
|
}
|
|
1966
2003
|
return { kind: "multi", entries: r };
|
|
1967
2004
|
}
|
|
1968
2005
|
return e;
|
|
1969
2006
|
};
|
|
1970
|
-
async function
|
|
2007
|
+
async function Rr(e, n = Ir, r = "auto") {
|
|
1971
2008
|
if (e === void 0)
|
|
1972
2009
|
return;
|
|
1973
2010
|
const i = async (t) => {
|
|
1974
2011
|
if (t.trim())
|
|
1975
|
-
return
|
|
2012
|
+
return Ro(jo(t, r));
|
|
1976
2013
|
};
|
|
1977
2014
|
if (e === "") {
|
|
1978
2015
|
const t = await n();
|
|
@@ -1985,7 +2022,7 @@ async function Tr(e, n = _r, r = "auto") {
|
|
|
1985
2022
|
for (const o of e)
|
|
1986
2023
|
if (typeof o == "string") {
|
|
1987
2024
|
const l = await i(o);
|
|
1988
|
-
l && (t =
|
|
2025
|
+
l && (t = Mo(t, l));
|
|
1989
2026
|
}
|
|
1990
2027
|
return t;
|
|
1991
2028
|
}
|
|
@@ -1994,32 +2031,53 @@ async function Tr(e, n = _r, r = "auto") {
|
|
|
1994
2031
|
return i(t);
|
|
1995
2032
|
}
|
|
1996
2033
|
}
|
|
1997
|
-
async function
|
|
1998
|
-
const n = await
|
|
2034
|
+
async function Do(e) {
|
|
2035
|
+
const n = await ko();
|
|
1999
2036
|
if (!n.trim())
|
|
2000
|
-
throw new Error(
|
|
2037
|
+
throw new Error(
|
|
2038
|
+
"Interactive input was empty. Provide YAML or JSON payload."
|
|
2039
|
+
);
|
|
2001
2040
|
const r = (a) => a instanceof Error ? a.message : String(a);
|
|
2002
2041
|
let i;
|
|
2003
2042
|
try {
|
|
2004
|
-
i = await
|
|
2043
|
+
i = await Rr(
|
|
2044
|
+
n,
|
|
2045
|
+
async () => Promise.resolve(""),
|
|
2046
|
+
"auto"
|
|
2047
|
+
);
|
|
2005
2048
|
} catch (a) {
|
|
2006
2049
|
throw new Error(`Failed to parse interactive input. ${r(a)}`);
|
|
2007
2050
|
}
|
|
2008
2051
|
if (!i)
|
|
2009
|
-
throw new Error(
|
|
2052
|
+
throw new Error(
|
|
2053
|
+
"Interactive input was empty. Provide YAML or JSON payload."
|
|
2054
|
+
);
|
|
2010
2055
|
if (i.kind === "multi") {
|
|
2011
2056
|
if (e.key || e.comment || e.defaultString !== void 0 || e.language)
|
|
2012
|
-
throw new
|
|
2057
|
+
throw new ae(
|
|
2058
|
+
"When adding multiple strings via interactive payload, omit --key, --comment, --text, and --language."
|
|
2059
|
+
);
|
|
2013
2060
|
const a = [];
|
|
2014
2061
|
for (const [s, c] of Object.entries(i.entries))
|
|
2015
|
-
await
|
|
2062
|
+
await Ie(
|
|
2063
|
+
e.path,
|
|
2064
|
+
s,
|
|
2065
|
+
c.comment,
|
|
2066
|
+
c.translations,
|
|
2067
|
+
e.configPath,
|
|
2068
|
+
void 0,
|
|
2069
|
+
void 0,
|
|
2070
|
+
e.state
|
|
2071
|
+
), a.push(s);
|
|
2016
2072
|
return { kind: "multi", keys: a };
|
|
2017
2073
|
}
|
|
2018
2074
|
const t = e.key;
|
|
2019
2075
|
if (!t)
|
|
2020
|
-
throw new
|
|
2076
|
+
throw new ae(
|
|
2077
|
+
"--key is required unless the interactive payload contains multiple keys."
|
|
2078
|
+
);
|
|
2021
2079
|
const o = i.kind === "single" ? i.comment : void 0, l = i.kind === "single" ? i.translations : void 0;
|
|
2022
|
-
return await
|
|
2080
|
+
return await Ie(
|
|
2023
2081
|
e.path,
|
|
2024
2082
|
t,
|
|
2025
2083
|
e.comment ?? o,
|
|
@@ -2030,7 +2088,7 @@ async function _o(e) {
|
|
|
2030
2088
|
e.state
|
|
2031
2089
|
), { kind: "single", keys: [t] };
|
|
2032
2090
|
}
|
|
2033
|
-
async function
|
|
2091
|
+
async function zo({
|
|
2034
2092
|
path: e,
|
|
2035
2093
|
key: n,
|
|
2036
2094
|
comment: r,
|
|
@@ -2038,45 +2096,75 @@ async function Oo({
|
|
|
2038
2096
|
stringsFormat: t,
|
|
2039
2097
|
defaultString: o,
|
|
2040
2098
|
language: l,
|
|
2041
|
-
stdinReader: a =
|
|
2099
|
+
stdinReader: a = Ir,
|
|
2042
2100
|
configPath: s,
|
|
2043
2101
|
state: c,
|
|
2044
|
-
interactive:
|
|
2102
|
+
interactive: f
|
|
2045
2103
|
}) {
|
|
2046
|
-
const
|
|
2047
|
-
if (
|
|
2104
|
+
const u = Nr(c);
|
|
2105
|
+
if (f) {
|
|
2048
2106
|
if (i !== void 0)
|
|
2049
|
-
throw new
|
|
2050
|
-
|
|
2107
|
+
throw new ae(
|
|
2108
|
+
"--interactive cannot be combined with --strings input."
|
|
2109
|
+
);
|
|
2110
|
+
return Do({
|
|
2051
2111
|
path: e,
|
|
2052
2112
|
key: n,
|
|
2053
2113
|
comment: r,
|
|
2054
2114
|
defaultString: o,
|
|
2055
2115
|
language: l,
|
|
2056
2116
|
configPath: s,
|
|
2057
|
-
state:
|
|
2117
|
+
state: u
|
|
2058
2118
|
});
|
|
2059
2119
|
}
|
|
2060
|
-
const h = await
|
|
2120
|
+
const h = await Rr(
|
|
2121
|
+
i,
|
|
2122
|
+
a,
|
|
2123
|
+
t
|
|
2124
|
+
);
|
|
2061
2125
|
if (h?.kind === "multi") {
|
|
2062
2126
|
if (n || r || o !== void 0 || l)
|
|
2063
|
-
throw new
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2127
|
+
throw new ae(
|
|
2128
|
+
"When adding multiple strings via --strings payload, omit --key, --comment, --text, and --language."
|
|
2129
|
+
);
|
|
2130
|
+
const w = [];
|
|
2131
|
+
for (const [k, v] of Object.entries(h.entries))
|
|
2132
|
+
await Ie(
|
|
2133
|
+
e,
|
|
2134
|
+
k,
|
|
2135
|
+
v.comment,
|
|
2136
|
+
v.translations,
|
|
2137
|
+
s,
|
|
2138
|
+
void 0,
|
|
2139
|
+
void 0,
|
|
2140
|
+
u
|
|
2141
|
+
), w.push(k);
|
|
2142
|
+
return { kind: "multi", keys: w };
|
|
2068
2143
|
}
|
|
2069
2144
|
const g = n;
|
|
2070
2145
|
if (!g)
|
|
2071
|
-
throw new
|
|
2072
|
-
|
|
2073
|
-
|
|
2146
|
+
throw new ae(
|
|
2147
|
+
"--key is required unless the --strings payload contains multiple keys."
|
|
2148
|
+
);
|
|
2149
|
+
const m = h?.kind === "single" ? h.translations : void 0, d = h?.kind === "single" ? h.comment : void 0;
|
|
2150
|
+
return await Ie(
|
|
2151
|
+
e,
|
|
2152
|
+
g,
|
|
2153
|
+
r ?? d,
|
|
2154
|
+
m,
|
|
2155
|
+
s,
|
|
2156
|
+
o,
|
|
2157
|
+
l,
|
|
2158
|
+
u
|
|
2159
|
+
), { kind: "single", keys: [g] };
|
|
2074
2160
|
}
|
|
2075
|
-
const
|
|
2076
|
-
const n = Object.entries(e).sort(
|
|
2161
|
+
const $o = (e) => {
|
|
2162
|
+
const n = Object.entries(e).sort(
|
|
2163
|
+
([r], [i]) => r.localeCompare(i, "en", { sensitivity: "case" })
|
|
2164
|
+
);
|
|
2077
2165
|
return Object.fromEntries(n);
|
|
2078
2166
|
};
|
|
2079
|
-
function
|
|
2167
|
+
function Uo() {
|
|
2080
2168
|
return {
|
|
2081
2169
|
command: "add",
|
|
2082
2170
|
describe: "Add a string",
|
|
@@ -2093,7 +2181,7 @@ function To() {
|
|
|
2093
2181
|
describe: "The language of the string provided with --text"
|
|
2094
2182
|
}).option("state", {
|
|
2095
2183
|
type: "string",
|
|
2096
|
-
choices:
|
|
2184
|
+
choices: Je,
|
|
2097
2185
|
describe: "State to apply to added strings (translated | needs_review | new | stale)"
|
|
2098
2186
|
}).option("text", {
|
|
2099
2187
|
type: "string",
|
|
@@ -2112,7 +2200,7 @@ function To() {
|
|
|
2112
2200
|
describe: "Add strings in an interactive flow"
|
|
2113
2201
|
}),
|
|
2114
2202
|
handler: async (e) => {
|
|
2115
|
-
const n = await
|
|
2203
|
+
const n = await zo({
|
|
2116
2204
|
path: e.path,
|
|
2117
2205
|
key: e.key,
|
|
2118
2206
|
comment: e.comment,
|
|
@@ -2125,72 +2213,78 @@ function To() {
|
|
|
2125
2213
|
configPath: e.config,
|
|
2126
2214
|
interactive: e.interactive
|
|
2127
2215
|
});
|
|
2128
|
-
X.info(
|
|
2216
|
+
X.info(
|
|
2217
|
+
S.green(
|
|
2218
|
+
`✓ Added keys:
|
|
2129
2219
|
${n.keys.map((r) => `- ${r}`).join(`
|
|
2130
|
-
`)}`
|
|
2220
|
+
`)}`
|
|
2221
|
+
)
|
|
2222
|
+
);
|
|
2131
2223
|
}
|
|
2132
2224
|
};
|
|
2133
2225
|
}
|
|
2134
|
-
async function
|
|
2135
|
-
const s = await
|
|
2226
|
+
async function Ie(e, n, r, i, t, o, l, a) {
|
|
2227
|
+
const s = await Q(e);
|
|
2136
2228
|
if (!s.sourceLanguage)
|
|
2137
2229
|
throw new Error('The xcstrings file is missing "sourceLanguage".');
|
|
2138
2230
|
const c = s.sourceLanguage;
|
|
2139
2231
|
s.strings || (s.strings = {});
|
|
2140
|
-
const
|
|
2232
|
+
const u = (await sn(t))?.missingLanguagePolicy || "skip";
|
|
2141
2233
|
let h;
|
|
2142
|
-
const g = async (
|
|
2143
|
-
X.warn(
|
|
2234
|
+
const g = async (O) => u === "include" ? !0 : (h || (h = await jr(e, t)), h.includes(O)), m = (O) => {
|
|
2235
|
+
X.warn(
|
|
2236
|
+
`Language "${O}" is not supported. Skipped adding its translation (missingLanguagePolicy=skip).`
|
|
2237
|
+
);
|
|
2144
2238
|
}, d = {
|
|
2145
2239
|
...s.strings[n],
|
|
2146
2240
|
extractionState: "manual"
|
|
2147
2241
|
};
|
|
2148
2242
|
r && (d.comment = r);
|
|
2149
|
-
const
|
|
2150
|
-
if (
|
|
2151
|
-
return typeof
|
|
2243
|
+
const w = a ?? "translated", k = (O) => {
|
|
2244
|
+
if (O !== void 0)
|
|
2245
|
+
return typeof O == "string" ? { value: O } : O;
|
|
2152
2246
|
};
|
|
2153
2247
|
if (o !== void 0) {
|
|
2154
|
-
const
|
|
2155
|
-
if (!await g(
|
|
2156
|
-
|
|
2248
|
+
const O = l ?? c;
|
|
2249
|
+
if (!await g(O))
|
|
2250
|
+
m(O);
|
|
2157
2251
|
else {
|
|
2158
2252
|
d.localizations = d.localizations || {};
|
|
2159
|
-
const L =
|
|
2160
|
-
d.localizations[
|
|
2253
|
+
const L = k(i?.[O]);
|
|
2254
|
+
d.localizations[O] = {
|
|
2161
2255
|
stringUnit: {
|
|
2162
|
-
state: L?.state ??
|
|
2256
|
+
state: L?.state ?? w,
|
|
2163
2257
|
value: o
|
|
2164
2258
|
}
|
|
2165
2259
|
};
|
|
2166
2260
|
}
|
|
2167
2261
|
}
|
|
2168
|
-
const
|
|
2169
|
-
if (
|
|
2170
|
-
const
|
|
2171
|
-
for (const [L,
|
|
2262
|
+
const v = i ? { ...i } : void 0;
|
|
2263
|
+
if (v) {
|
|
2264
|
+
const O = [];
|
|
2265
|
+
for (const [L, P] of Object.entries(v)) {
|
|
2172
2266
|
if (o !== void 0 && L === (l ?? c))
|
|
2173
2267
|
continue;
|
|
2174
|
-
if (
|
|
2175
|
-
const I =
|
|
2176
|
-
I &&
|
|
2268
|
+
if (u === "include" ? !0 : L === c || await g(L)) {
|
|
2269
|
+
const I = k(P);
|
|
2270
|
+
I && O.push([L, I]);
|
|
2177
2271
|
} else
|
|
2178
|
-
|
|
2272
|
+
m(L);
|
|
2179
2273
|
}
|
|
2180
|
-
if (
|
|
2274
|
+
if (O.length > 0) {
|
|
2181
2275
|
d.localizations = d.localizations || {};
|
|
2182
|
-
for (const [L,
|
|
2276
|
+
for (const [L, P] of O)
|
|
2183
2277
|
d.localizations[L] = {
|
|
2184
2278
|
stringUnit: {
|
|
2185
|
-
state:
|
|
2186
|
-
value:
|
|
2279
|
+
state: P.state ?? w,
|
|
2280
|
+
value: P.value
|
|
2187
2281
|
}
|
|
2188
2282
|
};
|
|
2189
2283
|
}
|
|
2190
2284
|
}
|
|
2191
|
-
s.strings[n] = d, d.localizations && (d.localizations =
|
|
2285
|
+
s.strings[n] = d, d.localizations && (d.localizations = $o(d.localizations)), await cn(e, s);
|
|
2192
2286
|
}
|
|
2193
|
-
function
|
|
2287
|
+
function Bo() {
|
|
2194
2288
|
return {
|
|
2195
2289
|
command: "remove",
|
|
2196
2290
|
describe: "Remove a string",
|
|
@@ -2211,10 +2305,12 @@ function Lo() {
|
|
|
2211
2305
|
}).check((n) => {
|
|
2212
2306
|
if (n.key || n.languages && n.languages.length > 0)
|
|
2213
2307
|
return !0;
|
|
2214
|
-
throw new Error(
|
|
2308
|
+
throw new Error(
|
|
2309
|
+
"Either --key or --languages must be provided"
|
|
2310
|
+
);
|
|
2215
2311
|
}),
|
|
2216
2312
|
handler: async (e) => {
|
|
2217
|
-
const n = await
|
|
2313
|
+
const n = await Ho(
|
|
2218
2314
|
e.path,
|
|
2219
2315
|
e.key,
|
|
2220
2316
|
e.languages,
|
|
@@ -2222,59 +2318,59 @@ function Lo() {
|
|
|
2222
2318
|
), r = Object.entries(n).map(([i, t]) => `- [${t.join(" ")}] ${i}`).join(`
|
|
2223
2319
|
`);
|
|
2224
2320
|
if (e.dryRun) {
|
|
2225
|
-
r.length === 0 ? X.info(
|
|
2321
|
+
r.length === 0 ? X.info(S.yellow("No matching strings found.")) : X.info(S.blue(`Would remove:
|
|
2226
2322
|
${r}`));
|
|
2227
2323
|
return;
|
|
2228
2324
|
}
|
|
2229
|
-
r.length === 0 ? X.info(
|
|
2325
|
+
r.length === 0 ? X.info(S.yellow("No matching strings found.")) : X.info(S.green(`✓ Removed
|
|
2230
2326
|
${r}`));
|
|
2231
2327
|
}
|
|
2232
2328
|
};
|
|
2233
2329
|
}
|
|
2234
|
-
function
|
|
2330
|
+
function Yo(e, n, r, i, t) {
|
|
2235
2331
|
if (e.localizations) {
|
|
2236
2332
|
for (const o of n)
|
|
2237
2333
|
e.localizations[o] && (t[i] ??= [], t[i].push(o), r || delete e.localizations[o]);
|
|
2238
2334
|
!r && e.localizations && Object.keys(e.localizations).length === 0 && delete e.localizations;
|
|
2239
2335
|
}
|
|
2240
2336
|
}
|
|
2241
|
-
async function
|
|
2242
|
-
const t = await
|
|
2337
|
+
async function Ho(e, n, r, i = !1) {
|
|
2338
|
+
const t = await Q(e), o = {}, l = t.strings || {};
|
|
2243
2339
|
t.strings = l;
|
|
2244
2340
|
const a = n ? [n] : Object.keys(l);
|
|
2245
2341
|
let s = !1;
|
|
2246
2342
|
for (const c of a) {
|
|
2247
|
-
const
|
|
2248
|
-
if (!
|
|
2343
|
+
const f = l[c];
|
|
2344
|
+
if (!f)
|
|
2249
2345
|
continue;
|
|
2250
2346
|
if (!r || r.length === 0) {
|
|
2251
|
-
const g = Object.keys(
|
|
2347
|
+
const g = Object.keys(f.localizations ?? {});
|
|
2252
2348
|
o[c] = g, i || delete l[c], s = !0;
|
|
2253
2349
|
continue;
|
|
2254
2350
|
}
|
|
2255
|
-
|
|
2256
|
-
const
|
|
2257
|
-
!(
|
|
2351
|
+
Yo(f, r, i, c, o);
|
|
2352
|
+
const u = o[c]?.length ?? 0;
|
|
2353
|
+
!(f.localizations && Object.keys(f.localizations).length > 0) && u > 0 && (i || delete l[c]), u > 0 && (s = !0);
|
|
2258
2354
|
}
|
|
2259
|
-
return !i && s && await
|
|
2355
|
+
return !i && s && await cn(e, t), o;
|
|
2260
2356
|
}
|
|
2261
|
-
const
|
|
2262
|
-
function
|
|
2357
|
+
const Ue = "xcstrings-cli.yaml";
|
|
2358
|
+
function Ko() {
|
|
2263
2359
|
return {
|
|
2264
2360
|
command: "init",
|
|
2265
2361
|
describe: "Initialize configuration file",
|
|
2266
2362
|
handler: async () => {
|
|
2267
|
-
await
|
|
2363
|
+
await Go();
|
|
2268
2364
|
}
|
|
2269
2365
|
};
|
|
2270
2366
|
}
|
|
2271
|
-
async function
|
|
2367
|
+
async function Wo(e) {
|
|
2272
2368
|
const n = [];
|
|
2273
2369
|
async function r(i) {
|
|
2274
2370
|
try {
|
|
2275
|
-
const t = await
|
|
2371
|
+
const t = await en(i, { withFileTypes: !0 });
|
|
2276
2372
|
for (const o of t) {
|
|
2277
|
-
const l =
|
|
2373
|
+
const l = Ne(i, o.name);
|
|
2278
2374
|
o.isDirectory() ? !o.name.startsWith(".") && o.name !== "node_modules" && await r(l) : o.name.endsWith(".xcstrings") && n.push(l);
|
|
2279
2375
|
}
|
|
2280
2376
|
} catch {
|
|
@@ -2282,58 +2378,72 @@ async function Ro(e) {
|
|
|
2282
2378
|
}
|
|
2283
2379
|
return await r(e), n;
|
|
2284
2380
|
}
|
|
2285
|
-
async function
|
|
2381
|
+
async function qo(e) {
|
|
2286
2382
|
const n = [];
|
|
2287
2383
|
let r = e;
|
|
2288
2384
|
try {
|
|
2289
|
-
const i = await
|
|
2385
|
+
const i = await en(r, { withFileTypes: !0 });
|
|
2290
2386
|
for (const t of i)
|
|
2291
|
-
t.isDirectory() && t.name.endsWith(".xcodeproj") && n.push(
|
|
2387
|
+
t.isDirectory() && t.name.endsWith(".xcodeproj") && n.push(Ne(r, t.name));
|
|
2292
2388
|
} catch {
|
|
2293
2389
|
}
|
|
2294
2390
|
return n;
|
|
2295
2391
|
}
|
|
2296
|
-
async function
|
|
2392
|
+
async function Go() {
|
|
2297
2393
|
const e = process.cwd();
|
|
2298
|
-
console.log(), console.log(
|
|
2299
|
-
const n = await
|
|
2300
|
-
console.log(
|
|
2301
|
-
const r = await
|
|
2394
|
+
console.log(), console.log(S.bold.cyan("🚀 xcstrings-cli Configuration Setup")), console.log(S.dim("─".repeat(40))), console.log(), console.log(S.yellow("🔍 Searching for .xcstrings files..."));
|
|
2395
|
+
const n = await Wo(e);
|
|
2396
|
+
console.log(S.yellow("🔍 Searching for .xcodeproj directories..."));
|
|
2397
|
+
const r = await qo(e);
|
|
2302
2398
|
console.log();
|
|
2303
2399
|
let i = [];
|
|
2304
2400
|
if (n.length > 0) {
|
|
2305
|
-
console.log(
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2401
|
+
console.log(
|
|
2402
|
+
S.green(`✓ Found ${n.length} .xcstrings file(s)`)
|
|
2403
|
+
), console.log();
|
|
2404
|
+
const c = n.map((f) => ({
|
|
2405
|
+
name: S.white(ke(e, f)) + S.dim(` (${f})`),
|
|
2406
|
+
value: ke(e, f),
|
|
2309
2407
|
checked: !0
|
|
2310
2408
|
}));
|
|
2311
|
-
i = await
|
|
2312
|
-
message:
|
|
2409
|
+
i = await vn({
|
|
2410
|
+
message: S.bold("Select .xcstrings files to manage:"),
|
|
2313
2411
|
choices: c
|
|
2314
2412
|
});
|
|
2315
2413
|
} else
|
|
2316
|
-
console.log(
|
|
2414
|
+
console.log(
|
|
2415
|
+
S.dim(" No .xcstrings files found in current directory")
|
|
2416
|
+
);
|
|
2317
2417
|
console.log();
|
|
2318
2418
|
let t = [];
|
|
2319
2419
|
if (r.length > 0) {
|
|
2320
|
-
console.log(
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2420
|
+
console.log(
|
|
2421
|
+
S.green(
|
|
2422
|
+
`✓ Found ${r.length} .xcodeproj director${r.length === 1 ? "y" : "ies"}`
|
|
2423
|
+
)
|
|
2424
|
+
), console.log();
|
|
2425
|
+
const c = r.map((f) => ({
|
|
2426
|
+
name: S.white(ke(e, f) || f) + S.dim(` (${f})`),
|
|
2427
|
+
value: ke(e, f) || f,
|
|
2324
2428
|
checked: !0
|
|
2325
2429
|
}));
|
|
2326
|
-
t = await
|
|
2327
|
-
message:
|
|
2430
|
+
t = await vn({
|
|
2431
|
+
message: S.bold(
|
|
2432
|
+
"Select .xcodeproj directories for language detection:"
|
|
2433
|
+
),
|
|
2328
2434
|
choices: c
|
|
2329
2435
|
});
|
|
2330
2436
|
} else
|
|
2331
|
-
console.log(
|
|
2332
|
-
if (console.log(), console.log(
|
|
2333
|
-
|
|
2437
|
+
console.log(S.dim(" No .xcodeproj directories found"));
|
|
2438
|
+
if (console.log(), console.log(S.dim("─".repeat(40))), console.log(), console.log(S.bold("📋 Configuration Summary:")), console.log(), console.log(S.cyan(" xcstringsPaths:")), i.length > 0 ? i.forEach(
|
|
2439
|
+
(c) => console.log(S.white(` • ${c}`))
|
|
2440
|
+
) : console.log(S.dim(" (none)")), console.log(), console.log(S.cyan(" xcodeprojPaths:")), t.length > 0 ? t.forEach(
|
|
2441
|
+
(c) => console.log(S.white(` • ${c}`))
|
|
2442
|
+
) : console.log(S.dim(" (none)")), console.log(), !await Qr({
|
|
2443
|
+
message: S.bold(`Create ${S.yellow(Ue)}?`),
|
|
2334
2444
|
default: !0
|
|
2335
2445
|
})) {
|
|
2336
|
-
console.log(
|
|
2446
|
+
console.log(S.dim(" Configuration cancelled."));
|
|
2337
2447
|
return;
|
|
2338
2448
|
}
|
|
2339
2449
|
const l = i.length > 0 ? `
|
|
@@ -2349,35 +2459,39 @@ xcstringsPaths:${l}
|
|
|
2349
2459
|
# Paths to .xcodeproj directories. Used for discovering supported languages.
|
|
2350
2460
|
xcodeprojPaths:${a}
|
|
2351
2461
|
`;
|
|
2352
|
-
await
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2462
|
+
await Ze(Ue, s, "utf-8"), console.log(), console.log(S.bold.green(`✓ Created ${Ue}`)), console.log(
|
|
2463
|
+
S.dim(
|
|
2464
|
+
` Run ${S.cyan("xcstrings --help")} to see available commands.`
|
|
2465
|
+
)
|
|
2466
|
+
), console.log();
|
|
2467
|
+
}
|
|
2468
|
+
var Vo = Object.prototype.toString, ue = Array.isArray || function(n) {
|
|
2469
|
+
return Vo.call(n) === "[object Array]";
|
|
2356
2470
|
};
|
|
2357
|
-
function
|
|
2471
|
+
function un(e) {
|
|
2358
2472
|
return typeof e == "function";
|
|
2359
2473
|
}
|
|
2360
|
-
function
|
|
2361
|
-
return
|
|
2474
|
+
function Xo(e) {
|
|
2475
|
+
return ue(e) ? "array" : typeof e;
|
|
2362
2476
|
}
|
|
2363
|
-
function
|
|
2477
|
+
function Be(e) {
|
|
2364
2478
|
return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
2365
2479
|
}
|
|
2366
|
-
function
|
|
2480
|
+
function zn(e, n) {
|
|
2367
2481
|
return e != null && typeof e == "object" && n in e;
|
|
2368
2482
|
}
|
|
2369
|
-
function
|
|
2483
|
+
function Jo(e, n) {
|
|
2370
2484
|
return e != null && typeof e != "object" && e.hasOwnProperty && e.hasOwnProperty(n);
|
|
2371
2485
|
}
|
|
2372
|
-
var
|
|
2373
|
-
function
|
|
2374
|
-
return
|
|
2486
|
+
var Qo = RegExp.prototype.test;
|
|
2487
|
+
function Zo(e, n) {
|
|
2488
|
+
return Qo.call(e, n);
|
|
2375
2489
|
}
|
|
2376
|
-
var
|
|
2377
|
-
function
|
|
2378
|
-
return !
|
|
2490
|
+
var el = /\S/;
|
|
2491
|
+
function nl(e) {
|
|
2492
|
+
return !Zo(el, e);
|
|
2379
2493
|
}
|
|
2380
|
-
var
|
|
2494
|
+
var rl = {
|
|
2381
2495
|
"&": "&",
|
|
2382
2496
|
"<": "<",
|
|
2383
2497
|
">": ">",
|
|
@@ -2387,17 +2501,17 @@ var Ko = {
|
|
|
2387
2501
|
"`": "`",
|
|
2388
2502
|
"=": "="
|
|
2389
2503
|
};
|
|
2390
|
-
function
|
|
2504
|
+
function il(e) {
|
|
2391
2505
|
return String(e).replace(/[&<>"'`=\/]/g, function(r) {
|
|
2392
|
-
return
|
|
2506
|
+
return rl[r];
|
|
2393
2507
|
});
|
|
2394
2508
|
}
|
|
2395
|
-
var
|
|
2396
|
-
function
|
|
2509
|
+
var tl = /\s*/, ol = /\s+/, $n = /\s*=/, ll = /\s*\}/, al = /#|\^|\/|>|\{|&|=|!/;
|
|
2510
|
+
function sl(e, n) {
|
|
2397
2511
|
if (!e)
|
|
2398
2512
|
return [];
|
|
2399
2513
|
var r = !1, i = [], t = [], o = [], l = !1, a = !1, s = "", c = 0;
|
|
2400
|
-
function
|
|
2514
|
+
function f() {
|
|
2401
2515
|
if (l && !a)
|
|
2402
2516
|
for (; o.length; )
|
|
2403
2517
|
delete t[o.pop()];
|
|
@@ -2405,41 +2519,41 @@ function Qo(e, n) {
|
|
|
2405
2519
|
o = [];
|
|
2406
2520
|
l = !1, a = !1;
|
|
2407
2521
|
}
|
|
2408
|
-
var
|
|
2409
|
-
function
|
|
2410
|
-
if (typeof I == "string" && (I = I.split(
|
|
2522
|
+
var u, h, g;
|
|
2523
|
+
function m(I) {
|
|
2524
|
+
if (typeof I == "string" && (I = I.split(ol, 2)), !ue(I) || I.length !== 2)
|
|
2411
2525
|
throw new Error("Invalid tags: " + I);
|
|
2412
|
-
|
|
2413
|
-
}
|
|
2414
|
-
|
|
2415
|
-
for (var d = new
|
|
2416
|
-
if (
|
|
2417
|
-
for (var
|
|
2418
|
-
|
|
2419
|
-
` && (
|
|
2420
|
-
if (!d.scan(
|
|
2526
|
+
u = new RegExp(Be(I[0]) + "\\s*"), h = new RegExp("\\s*" + Be(I[1])), g = new RegExp("\\s*" + Be("}" + I[1]));
|
|
2527
|
+
}
|
|
2528
|
+
m(n || D.tags);
|
|
2529
|
+
for (var d = new we(e), w, k, v, O, L, P; !d.eos(); ) {
|
|
2530
|
+
if (w = d.pos, v = d.scanUntil(u), v)
|
|
2531
|
+
for (var Z = 0, V = v.length; Z < V; ++Z)
|
|
2532
|
+
O = v.charAt(Z), nl(O) ? (o.push(t.length), s += O) : (a = !0, r = !0, s += " "), t.push(["text", O, w, w + 1]), w += 1, O === `
|
|
2533
|
+
` && (f(), s = "", c = 0, r = !1);
|
|
2534
|
+
if (!d.scan(u))
|
|
2421
2535
|
break;
|
|
2422
|
-
if (l = !0,
|
|
2536
|
+
if (l = !0, k = d.scan(al) || "name", d.scan(tl), k === "=" ? (v = d.scanUntil($n), d.scan($n), d.scanUntil(h)) : k === "{" ? (v = d.scanUntil(g), d.scan(ll), d.scanUntil(h), k = "&") : v = d.scanUntil(h), !d.scan(h))
|
|
2423
2537
|
throw new Error("Unclosed tag at " + d.pos);
|
|
2424
|
-
if (
|
|
2538
|
+
if (k == ">" ? L = [k, v, w, d.pos, s, c, r] : L = [k, v, w, d.pos], c++, t.push(L), k === "#" || k === "^")
|
|
2425
2539
|
i.push(L);
|
|
2426
|
-
else if (
|
|
2427
|
-
if (
|
|
2428
|
-
throw new Error('Unopened section "' +
|
|
2429
|
-
if (
|
|
2430
|
-
throw new Error('Unclosed section "' +
|
|
2431
|
-
} else
|
|
2432
|
-
}
|
|
2433
|
-
if (
|
|
2434
|
-
throw new Error('Unclosed section "' +
|
|
2435
|
-
return
|
|
2436
|
-
}
|
|
2437
|
-
function
|
|
2540
|
+
else if (k === "/") {
|
|
2541
|
+
if (P = i.pop(), !P)
|
|
2542
|
+
throw new Error('Unopened section "' + v + '" at ' + w);
|
|
2543
|
+
if (P[1] !== v)
|
|
2544
|
+
throw new Error('Unclosed section "' + P[1] + '" at ' + w);
|
|
2545
|
+
} else k === "name" || k === "{" || k === "&" ? a = !0 : k === "=" && m(v);
|
|
2546
|
+
}
|
|
2547
|
+
if (f(), P = i.pop(), P)
|
|
2548
|
+
throw new Error('Unclosed section "' + P[1] + '" at ' + d.pos);
|
|
2549
|
+
return ul(cl(t));
|
|
2550
|
+
}
|
|
2551
|
+
function cl(e) {
|
|
2438
2552
|
for (var n = [], r, i, t = 0, o = e.length; t < o; ++t)
|
|
2439
2553
|
r = e[t], r && (r[0] === "text" && i && i[0] === "text" ? (i[1] += r[1], i[3] = r[3]) : (n.push(r), i = r));
|
|
2440
2554
|
return n;
|
|
2441
2555
|
}
|
|
2442
|
-
function
|
|
2556
|
+
function ul(e) {
|
|
2443
2557
|
for (var n = [], r = n, i = [], t, o, l = 0, a = e.length; l < a; ++l)
|
|
2444
2558
|
switch (t = e[l], t[0]) {
|
|
2445
2559
|
case "#":
|
|
@@ -2454,20 +2568,20 @@ function Zo(e) {
|
|
|
2454
2568
|
}
|
|
2455
2569
|
return n;
|
|
2456
2570
|
}
|
|
2457
|
-
function
|
|
2571
|
+
function we(e) {
|
|
2458
2572
|
this.string = e, this.tail = e, this.pos = 0;
|
|
2459
2573
|
}
|
|
2460
|
-
|
|
2574
|
+
we.prototype.eos = function() {
|
|
2461
2575
|
return this.tail === "";
|
|
2462
2576
|
};
|
|
2463
|
-
|
|
2577
|
+
we.prototype.scan = function(n) {
|
|
2464
2578
|
var r = this.tail.match(n);
|
|
2465
2579
|
if (!r || r.index !== 0)
|
|
2466
2580
|
return "";
|
|
2467
2581
|
var i = r[0];
|
|
2468
2582
|
return this.tail = this.tail.substring(i.length), this.pos += i.length, i;
|
|
2469
2583
|
};
|
|
2470
|
-
|
|
2584
|
+
we.prototype.scanUntil = function(n) {
|
|
2471
2585
|
var r = this.tail.search(n), i;
|
|
2472
2586
|
switch (r) {
|
|
2473
2587
|
case -1:
|
|
@@ -2481,13 +2595,13 @@ xe.prototype.scanUntil = function(n) {
|
|
|
2481
2595
|
}
|
|
2482
2596
|
return this.pos += i.length, i;
|
|
2483
2597
|
};
|
|
2484
|
-
function
|
|
2598
|
+
function ce(e, n) {
|
|
2485
2599
|
this.view = e, this.cache = { ".": this.view }, this.parent = n;
|
|
2486
2600
|
}
|
|
2487
|
-
|
|
2488
|
-
return new
|
|
2601
|
+
ce.prototype.push = function(n) {
|
|
2602
|
+
return new ce(n, this);
|
|
2489
2603
|
};
|
|
2490
|
-
|
|
2604
|
+
ce.prototype.lookup = function(n) {
|
|
2491
2605
|
var r = this.cache, i;
|
|
2492
2606
|
if (r.hasOwnProperty(n))
|
|
2493
2607
|
i = r[n];
|
|
@@ -2495,9 +2609,9 @@ ae.prototype.lookup = function(n) {
|
|
|
2495
2609
|
for (var t = this, o, l, a, s = !1; t; ) {
|
|
2496
2610
|
if (n.indexOf(".") > 0)
|
|
2497
2611
|
for (o = t.view, l = n.split("."), a = 0; o != null && a < l.length; )
|
|
2498
|
-
a === l.length - 1 && (s =
|
|
2612
|
+
a === l.length - 1 && (s = zn(o, l[a]) || Jo(o, l[a])), o = o[l[a++]];
|
|
2499
2613
|
else
|
|
2500
|
-
o = t.view[n], s =
|
|
2614
|
+
o = t.view[n], s = zn(t.view, n);
|
|
2501
2615
|
if (s) {
|
|
2502
2616
|
i = o;
|
|
2503
2617
|
break;
|
|
@@ -2506,9 +2620,9 @@ ae.prototype.lookup = function(n) {
|
|
|
2506
2620
|
}
|
|
2507
2621
|
r[n] = i;
|
|
2508
2622
|
}
|
|
2509
|
-
return
|
|
2623
|
+
return un(i) && (i = i.call(this.view)), i;
|
|
2510
2624
|
};
|
|
2511
|
-
function
|
|
2625
|
+
function z() {
|
|
2512
2626
|
this.templateCache = {
|
|
2513
2627
|
_cache: {},
|
|
2514
2628
|
set: function(n, r) {
|
|
@@ -2522,34 +2636,34 @@ function $() {
|
|
|
2522
2636
|
}
|
|
2523
2637
|
};
|
|
2524
2638
|
}
|
|
2525
|
-
|
|
2639
|
+
z.prototype.clearCache = function() {
|
|
2526
2640
|
typeof this.templateCache < "u" && this.templateCache.clear();
|
|
2527
2641
|
};
|
|
2528
|
-
|
|
2642
|
+
z.prototype.parse = function(n, r) {
|
|
2529
2643
|
var i = this.templateCache, t = n + ":" + (r || D.tags).join(":"), o = typeof i < "u", l = o ? i.get(t) : void 0;
|
|
2530
|
-
return l == null && (l =
|
|
2644
|
+
return l == null && (l = sl(n, r), o && i.set(t, l)), l;
|
|
2531
2645
|
};
|
|
2532
|
-
|
|
2533
|
-
var o = this.getConfigTags(t), l = this.parse(n, o), a = r instanceof
|
|
2646
|
+
z.prototype.render = function(n, r, i, t) {
|
|
2647
|
+
var o = this.getConfigTags(t), l = this.parse(n, o), a = r instanceof ce ? r : new ce(r, void 0);
|
|
2534
2648
|
return this.renderTokens(l, a, i, n, t);
|
|
2535
2649
|
};
|
|
2536
|
-
|
|
2537
|
-
for (var l = "", a, s, c,
|
|
2538
|
-
c = void 0, a = n[
|
|
2650
|
+
z.prototype.renderTokens = function(n, r, i, t, o) {
|
|
2651
|
+
for (var l = "", a, s, c, f = 0, u = n.length; f < u; ++f)
|
|
2652
|
+
c = void 0, a = n[f], s = a[0], s === "#" ? c = this.renderSection(a, r, i, t, o) : s === "^" ? c = this.renderInverted(a, r, i, t, o) : s === ">" ? c = this.renderPartial(a, r, i, o) : s === "&" ? c = this.unescapedValue(a, r) : s === "name" ? c = this.escapedValue(a, r, o) : s === "text" && (c = this.rawValue(a)), c !== void 0 && (l += c);
|
|
2539
2653
|
return l;
|
|
2540
2654
|
};
|
|
2541
|
-
|
|
2655
|
+
z.prototype.renderSection = function(n, r, i, t, o) {
|
|
2542
2656
|
var l = this, a = "", s = r.lookup(n[1]);
|
|
2543
2657
|
function c(h) {
|
|
2544
2658
|
return l.render(h, r, i, o);
|
|
2545
2659
|
}
|
|
2546
2660
|
if (s) {
|
|
2547
|
-
if (
|
|
2548
|
-
for (var
|
|
2549
|
-
a += this.renderTokens(n[4], r.push(s[
|
|
2661
|
+
if (ue(s))
|
|
2662
|
+
for (var f = 0, u = s.length; f < u; ++f)
|
|
2663
|
+
a += this.renderTokens(n[4], r.push(s[f]), i, t, o);
|
|
2550
2664
|
else if (typeof s == "object" || typeof s == "string" || typeof s == "number")
|
|
2551
2665
|
a += this.renderTokens(n[4], r.push(s), i, t, o);
|
|
2552
|
-
else if (
|
|
2666
|
+
else if (un(s)) {
|
|
2553
2667
|
if (typeof t != "string")
|
|
2554
2668
|
throw new Error("Cannot use higher-order sections without the original template");
|
|
2555
2669
|
s = s.call(r.view, t.slice(n[3], n[5]), c), s != null && (a += s);
|
|
@@ -2558,47 +2672,47 @@ $.prototype.renderSection = function(n, r, i, t, o) {
|
|
|
2558
2672
|
return a;
|
|
2559
2673
|
}
|
|
2560
2674
|
};
|
|
2561
|
-
|
|
2675
|
+
z.prototype.renderInverted = function(n, r, i, t, o) {
|
|
2562
2676
|
var l = r.lookup(n[1]);
|
|
2563
|
-
if (!l ||
|
|
2677
|
+
if (!l || ue(l) && l.length === 0)
|
|
2564
2678
|
return this.renderTokens(n[4], r, i, t, o);
|
|
2565
2679
|
};
|
|
2566
|
-
|
|
2680
|
+
z.prototype.indentPartial = function(n, r, i) {
|
|
2567
2681
|
for (var t = r.replace(/[^ \t]/g, ""), o = n.split(`
|
|
2568
2682
|
`), l = 0; l < o.length; l++)
|
|
2569
2683
|
o[l].length && (l > 0 || !i) && (o[l] = t + o[l]);
|
|
2570
2684
|
return o.join(`
|
|
2571
2685
|
`);
|
|
2572
2686
|
};
|
|
2573
|
-
|
|
2687
|
+
z.prototype.renderPartial = function(n, r, i, t) {
|
|
2574
2688
|
if (i) {
|
|
2575
|
-
var o = this.getConfigTags(t), l =
|
|
2689
|
+
var o = this.getConfigTags(t), l = un(i) ? i(n[1]) : i[n[1]];
|
|
2576
2690
|
if (l != null) {
|
|
2577
|
-
var a = n[6], s = n[5], c = n[4],
|
|
2578
|
-
s == 0 && c && (
|
|
2579
|
-
var
|
|
2580
|
-
return this.renderTokens(
|
|
2691
|
+
var a = n[6], s = n[5], c = n[4], f = l;
|
|
2692
|
+
s == 0 && c && (f = this.indentPartial(l, c, a));
|
|
2693
|
+
var u = this.parse(f, o);
|
|
2694
|
+
return this.renderTokens(u, r, i, f, t);
|
|
2581
2695
|
}
|
|
2582
2696
|
}
|
|
2583
2697
|
};
|
|
2584
|
-
|
|
2698
|
+
z.prototype.unescapedValue = function(n, r) {
|
|
2585
2699
|
var i = r.lookup(n[1]);
|
|
2586
2700
|
if (i != null)
|
|
2587
2701
|
return i;
|
|
2588
2702
|
};
|
|
2589
|
-
|
|
2703
|
+
z.prototype.escapedValue = function(n, r, i) {
|
|
2590
2704
|
var t = this.getConfigEscape(i) || D.escape, o = r.lookup(n[1]);
|
|
2591
2705
|
if (o != null)
|
|
2592
2706
|
return typeof o == "number" && t === D.escape ? String(o) : t(o);
|
|
2593
2707
|
};
|
|
2594
|
-
|
|
2708
|
+
z.prototype.rawValue = function(n) {
|
|
2595
2709
|
return n[1];
|
|
2596
2710
|
};
|
|
2597
|
-
|
|
2598
|
-
return
|
|
2711
|
+
z.prototype.getConfigTags = function(n) {
|
|
2712
|
+
return ue(n) ? n : n && typeof n == "object" ? n.tags : void 0;
|
|
2599
2713
|
};
|
|
2600
|
-
|
|
2601
|
-
if (n && typeof n == "object" && !
|
|
2714
|
+
z.prototype.getConfigEscape = function(n) {
|
|
2715
|
+
if (n && typeof n == "object" && !ue(n))
|
|
2602
2716
|
return n.escape;
|
|
2603
2717
|
};
|
|
2604
2718
|
var D = {
|
|
@@ -2618,31 +2732,31 @@ var D = {
|
|
|
2618
2732
|
* the cache by setting it to the literal `undefined`.
|
|
2619
2733
|
*/
|
|
2620
2734
|
set templateCache(e) {
|
|
2621
|
-
|
|
2735
|
+
xe.templateCache = e;
|
|
2622
2736
|
},
|
|
2623
2737
|
/**
|
|
2624
2738
|
* Gets the default or overridden caching object from the default writer.
|
|
2625
2739
|
*/
|
|
2626
2740
|
get templateCache() {
|
|
2627
|
-
return
|
|
2741
|
+
return xe.templateCache;
|
|
2628
2742
|
}
|
|
2629
|
-
},
|
|
2743
|
+
}, xe = new z();
|
|
2630
2744
|
D.clearCache = function() {
|
|
2631
|
-
return
|
|
2745
|
+
return xe.clearCache();
|
|
2632
2746
|
};
|
|
2633
2747
|
D.parse = function(n, r) {
|
|
2634
|
-
return
|
|
2748
|
+
return xe.parse(n, r);
|
|
2635
2749
|
};
|
|
2636
2750
|
D.render = function(n, r, i, t) {
|
|
2637
2751
|
if (typeof n != "string")
|
|
2638
|
-
throw new TypeError('Invalid template! Template should be a "string" but "' +
|
|
2639
|
-
return
|
|
2752
|
+
throw new TypeError('Invalid template! Template should be a "string" but "' + Xo(n) + '" was given as the first argument for mustache#render(template, view, partials)');
|
|
2753
|
+
return xe.render(n, r, i, t);
|
|
2640
2754
|
};
|
|
2641
|
-
D.escape =
|
|
2642
|
-
D.Scanner =
|
|
2643
|
-
D.Context =
|
|
2644
|
-
D.Writer =
|
|
2645
|
-
function
|
|
2755
|
+
D.escape = il;
|
|
2756
|
+
D.Scanner = we;
|
|
2757
|
+
D.Context = ce;
|
|
2758
|
+
D.Writer = z;
|
|
2759
|
+
function Un(e, {
|
|
2646
2760
|
glob: n,
|
|
2647
2761
|
regex: r,
|
|
2648
2762
|
substring: i
|
|
@@ -2650,39 +2764,94 @@ function jn(e, {
|
|
|
2650
2764
|
const t = [n, r, i].filter((o) => o !== void 0);
|
|
2651
2765
|
if (t.length !== 0) {
|
|
2652
2766
|
if (t.length > 1)
|
|
2653
|
-
throw new Error(
|
|
2767
|
+
throw new Error(
|
|
2768
|
+
`Specify only one of --${e}, --${e}-glob, --${e}-regex, --${e}-substring`
|
|
2769
|
+
);
|
|
2654
2770
|
return r !== void 0 ? { pattern: r, mode: "regex" } : i !== void 0 ? { pattern: i, mode: "substring" } : { pattern: n, mode: "glob" };
|
|
2655
2771
|
}
|
|
2656
2772
|
}
|
|
2657
|
-
function
|
|
2773
|
+
function fl(e) {
|
|
2774
|
+
const n = e.replace(/[.+^${}()|\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
|
|
2775
|
+
return new RegExp(`^${n}$`);
|
|
2776
|
+
}
|
|
2777
|
+
function le(e) {
|
|
2778
|
+
if (!e) return () => !0;
|
|
2779
|
+
if (e.mode === "regex") {
|
|
2780
|
+
const r = new RegExp(e.pattern);
|
|
2781
|
+
return (i) => r.test(i);
|
|
2782
|
+
}
|
|
2783
|
+
if (e.mode === "substring") {
|
|
2784
|
+
const r = e.pattern;
|
|
2785
|
+
return (i) => i.includes(r);
|
|
2786
|
+
}
|
|
2787
|
+
const n = fl(e.pattern);
|
|
2788
|
+
return (r) => n.test(r);
|
|
2789
|
+
}
|
|
2790
|
+
function Mr(e) {
|
|
2791
|
+
return e.option("key", {
|
|
2792
|
+
type: "string",
|
|
2793
|
+
describe: "Filter keys by glob (default)"
|
|
2794
|
+
}).option("key-glob", {
|
|
2795
|
+
type: "string",
|
|
2796
|
+
describe: "Filter keys by glob (explicit)"
|
|
2797
|
+
}).option("key-regex", {
|
|
2798
|
+
type: "string",
|
|
2799
|
+
describe: "Filter keys by regex"
|
|
2800
|
+
}).option("key-substring", {
|
|
2801
|
+
type: "string",
|
|
2802
|
+
describe: "Filter keys by substring match"
|
|
2803
|
+
}).option("text", {
|
|
2804
|
+
type: "string",
|
|
2805
|
+
describe: "Filter translations by glob (default)"
|
|
2806
|
+
}).option("text-glob", {
|
|
2807
|
+
type: "string",
|
|
2808
|
+
describe: "Filter translations by glob (explicit)"
|
|
2809
|
+
}).option("text-regex", {
|
|
2810
|
+
type: "string",
|
|
2811
|
+
describe: "Filter translations by regex"
|
|
2812
|
+
}).option("text-substring", {
|
|
2813
|
+
type: "string",
|
|
2814
|
+
describe: "Filter translations by substring match"
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
function Dr(e) {
|
|
2818
|
+
const n = [e.key, e["key-glob"]].filter(
|
|
2819
|
+
(a) => a !== void 0
|
|
2820
|
+
).length, r = e["key-regex"] ? 1 : 0, i = e["key-substring"] ? 1 : 0;
|
|
2821
|
+
if (n + r + i > 1)
|
|
2822
|
+
throw new Error(
|
|
2823
|
+
"Specify only one of --key/--key-glob, --key-regex, or --key-substring"
|
|
2824
|
+
);
|
|
2825
|
+
const t = [e.text, e["text-glob"]].filter(
|
|
2826
|
+
(a) => a !== void 0
|
|
2827
|
+
).length, o = e["text-regex"] ? 1 : 0, l = e["text-substring"] ? 1 : 0;
|
|
2828
|
+
if (t + o + l > 1)
|
|
2829
|
+
throw new Error(
|
|
2830
|
+
"Specify only one of --text/--text-glob, --text-regex, or --text-substring"
|
|
2831
|
+
);
|
|
2832
|
+
return !0;
|
|
2833
|
+
}
|
|
2834
|
+
function zr(e) {
|
|
2835
|
+
const n = [e.key, e["key-glob"]].filter(
|
|
2836
|
+
(o) => o !== void 0
|
|
2837
|
+
), r = [e.text, e["text-glob"]].filter(
|
|
2838
|
+
(o) => o !== void 0
|
|
2839
|
+
), i = Un("key", {
|
|
2840
|
+
glob: n[0],
|
|
2841
|
+
regex: e["key-regex"],
|
|
2842
|
+
substring: e["key-substring"]
|
|
2843
|
+
}), t = Un("text", {
|
|
2844
|
+
glob: r[0],
|
|
2845
|
+
regex: e["text-regex"],
|
|
2846
|
+
substring: e["text-substring"]
|
|
2847
|
+
});
|
|
2848
|
+
return { keyFilter: i, textFilter: t };
|
|
2849
|
+
}
|
|
2850
|
+
function pl() {
|
|
2658
2851
|
return {
|
|
2659
2852
|
command: "strings",
|
|
2660
2853
|
describe: "List strings in the xcstrings file",
|
|
2661
|
-
builder: (e) => e.option("
|
|
2662
|
-
type: "string",
|
|
2663
|
-
describe: "Filter keys by glob (default)"
|
|
2664
|
-
}).option("key-glob", {
|
|
2665
|
-
type: "string",
|
|
2666
|
-
describe: "Filter keys by glob (explicit)"
|
|
2667
|
-
}).option("key-regex", {
|
|
2668
|
-
type: "string",
|
|
2669
|
-
describe: "Filter keys by regex"
|
|
2670
|
-
}).option("key-substring", {
|
|
2671
|
-
type: "string",
|
|
2672
|
-
describe: "Filter keys by substring match"
|
|
2673
|
-
}).option("text", {
|
|
2674
|
-
type: "string",
|
|
2675
|
-
describe: "Filter translations by glob (default)"
|
|
2676
|
-
}).option("text-glob", {
|
|
2677
|
-
type: "string",
|
|
2678
|
-
describe: "Filter translations by glob (explicit)"
|
|
2679
|
-
}).option("text-regex", {
|
|
2680
|
-
type: "string",
|
|
2681
|
-
describe: "Filter translations by regex"
|
|
2682
|
-
}).option("text-substring", {
|
|
2683
|
-
type: "string",
|
|
2684
|
-
describe: "Filter translations by substring match"
|
|
2685
|
-
}).option("languages", {
|
|
2854
|
+
builder: (e) => Mr(e).option("languages", {
|
|
2686
2855
|
type: "string",
|
|
2687
2856
|
array: !0,
|
|
2688
2857
|
alias: "l",
|
|
@@ -2694,54 +2863,21 @@ function el() {
|
|
|
2694
2863
|
}).option("format", {
|
|
2695
2864
|
type: "string",
|
|
2696
2865
|
describe: "Mustache template. Available variables: {{language}}, {{key}}, {{text}}"
|
|
2697
|
-
}).check((n) =>
|
|
2698
|
-
const r = [n.key, n["key-glob"]].filter((s) => s !== void 0).length, i = n["key-regex"] ? 1 : 0, t = n["key-substring"] ? 1 : 0;
|
|
2699
|
-
if (r + i + t > 1)
|
|
2700
|
-
throw new Error("Specify only one of --key/--key-glob, --key-regex, or --key-substring");
|
|
2701
|
-
const o = [n.text, n["text-glob"]].filter((s) => s !== void 0).length, l = n["text-regex"] ? 1 : 0, a = n["text-substring"] ? 1 : 0;
|
|
2702
|
-
if (o + l + a > 1)
|
|
2703
|
-
throw new Error("Specify only one of --text/--text-glob, --text-regex, or --text-substring");
|
|
2704
|
-
return !0;
|
|
2705
|
-
}),
|
|
2866
|
+
}).check((n) => Dr(n)),
|
|
2706
2867
|
handler: async (e) => {
|
|
2707
|
-
const
|
|
2708
|
-
glob: n[0],
|
|
2709
|
-
regex: e["key-regex"],
|
|
2710
|
-
substring: e["key-substring"]
|
|
2711
|
-
}), t = jn("text", {
|
|
2712
|
-
glob: r[0],
|
|
2713
|
-
regex: e["text-regex"],
|
|
2714
|
-
substring: e["text-substring"]
|
|
2715
|
-
}), o = await il({
|
|
2868
|
+
const { keyFilter: n, textFilter: r } = zr(e), i = await hl({
|
|
2716
2869
|
path: e.path,
|
|
2717
2870
|
languages: e.languages,
|
|
2718
2871
|
missingLanguages: e["missing-languages"],
|
|
2719
|
-
keyFilter:
|
|
2720
|
-
textFilter:
|
|
2872
|
+
keyFilter: n,
|
|
2873
|
+
textFilter: r,
|
|
2721
2874
|
format: e.format
|
|
2722
2875
|
});
|
|
2723
|
-
|
|
2876
|
+
i && console.log(i);
|
|
2724
2877
|
}
|
|
2725
2878
|
};
|
|
2726
2879
|
}
|
|
2727
|
-
function
|
|
2728
|
-
const n = e.replace(/[.+^${}()|\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
|
|
2729
|
-
return new RegExp(`^${n}$`);
|
|
2730
|
-
}
|
|
2731
|
-
function In(e) {
|
|
2732
|
-
if (!e) return () => !0;
|
|
2733
|
-
if (e.mode === "regex") {
|
|
2734
|
-
const r = new RegExp(e.pattern);
|
|
2735
|
-
return (i) => r.test(i);
|
|
2736
|
-
}
|
|
2737
|
-
if (e.mode === "substring") {
|
|
2738
|
-
const r = e.pattern;
|
|
2739
|
-
return (i) => i.includes(r);
|
|
2740
|
-
}
|
|
2741
|
-
const n = nl(e.pattern);
|
|
2742
|
-
return (r) => n.test(r);
|
|
2743
|
-
}
|
|
2744
|
-
function rl(e, n) {
|
|
2880
|
+
function dl(e, n) {
|
|
2745
2881
|
const r = D.escape;
|
|
2746
2882
|
D.escape = (i) => i;
|
|
2747
2883
|
try {
|
|
@@ -2750,39 +2886,229 @@ function rl(e, n) {
|
|
|
2750
2886
|
D.escape = r;
|
|
2751
2887
|
}
|
|
2752
2888
|
}
|
|
2753
|
-
async function
|
|
2754
|
-
const r = (await
|
|
2889
|
+
async function hl(e) {
|
|
2890
|
+
const r = (await Q(e.path)).strings ?? {}, i = le(e.keyFilter), t = le(e.textFilter), o = e.languages ? new Set(e.languages) : null, l = e.missingLanguages ? new Set(e.missingLanguages) : null, a = !!e.format, s = [];
|
|
2755
2891
|
for (const c of Object.keys(r)) {
|
|
2756
2892
|
if (!i(c)) continue;
|
|
2757
|
-
const
|
|
2893
|
+
const u = r[c]?.localizations ?? {}, h = Object.keys(u), g = l ? Array.from(l).some(
|
|
2894
|
+
(d) => !(d in u)
|
|
2895
|
+
) : !0, m = [];
|
|
2758
2896
|
for (const d of h) {
|
|
2759
2897
|
if (o && !o.has(d)) continue;
|
|
2760
|
-
const
|
|
2761
|
-
t(
|
|
2898
|
+
const w = u[d]?.stringUnit?.value ?? "";
|
|
2899
|
+
t(w) && (a && e.format ? m.push(
|
|
2900
|
+
dl(e.format, {
|
|
2901
|
+
language: d,
|
|
2902
|
+
key: c,
|
|
2903
|
+
text: w
|
|
2904
|
+
})
|
|
2905
|
+
) : m.push(` ${d}: ${JSON.stringify(w)}`));
|
|
2762
2906
|
}
|
|
2763
|
-
|
|
2907
|
+
m.length !== 0 && g && (a ? s.push(...m) : s.push(`${c}:`, ...m));
|
|
2764
2908
|
}
|
|
2765
2909
|
return s.join(`
|
|
2766
2910
|
`);
|
|
2767
2911
|
}
|
|
2768
|
-
|
|
2769
|
-
|
|
2912
|
+
async function Ye(e) {
|
|
2913
|
+
try {
|
|
2914
|
+
return await Zr(e), !0;
|
|
2915
|
+
} catch {
|
|
2916
|
+
return !1;
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
function gl(e) {
|
|
2920
|
+
const n = Gr(e).toLowerCase();
|
|
2921
|
+
return n ? n === ".strings" ? e.slice(0, -n.length) + ".xcstrings" : e : `${e}.xcstrings`;
|
|
2922
|
+
}
|
|
2923
|
+
async function ml(e, n) {
|
|
2924
|
+
try {
|
|
2925
|
+
const r = await en(e, { withFileTypes: !0 });
|
|
2926
|
+
for (const i of r)
|
|
2927
|
+
!i.isDirectory() || !i.name.endsWith(".lproj") || await Yn(Ee(e, i.name, n), {
|
|
2928
|
+
recursive: !0,
|
|
2929
|
+
force: !0
|
|
2930
|
+
});
|
|
2931
|
+
} catch {
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
function yl() {
|
|
2935
|
+
return {
|
|
2936
|
+
command: "export <outpath>",
|
|
2937
|
+
describe: "Export xcstrings to a filtered xcstrings or traditional strings format",
|
|
2938
|
+
builder: (e) => Mr(e).positional("outpath", {
|
|
2939
|
+
type: "string",
|
|
2940
|
+
demandOption: !0,
|
|
2941
|
+
describe: "Output path for the exported strings"
|
|
2942
|
+
}).option("output", {
|
|
2943
|
+
alias: "o",
|
|
2944
|
+
type: "string",
|
|
2945
|
+
choices: ["auto", "xcstrings", "strings"],
|
|
2946
|
+
default: "auto",
|
|
2947
|
+
describe: "Output format. If auto, inferred from outpath extension if possible."
|
|
2948
|
+
}).option("merge-policy", {
|
|
2949
|
+
alias: "m",
|
|
2950
|
+
type: "string",
|
|
2951
|
+
choices: [
|
|
2952
|
+
"error",
|
|
2953
|
+
"force",
|
|
2954
|
+
"output-first",
|
|
2955
|
+
"existing-first"
|
|
2956
|
+
],
|
|
2957
|
+
default: "error",
|
|
2958
|
+
describe: "How to handle existing translation files"
|
|
2959
|
+
}).option("languages", {
|
|
2960
|
+
type: "string",
|
|
2961
|
+
array: !0,
|
|
2962
|
+
alias: "l",
|
|
2963
|
+
describe: "Include only these languages"
|
|
2964
|
+
}).check((n) => Dr(n)),
|
|
2965
|
+
handler: async (e) => {
|
|
2966
|
+
const n = e.outpath;
|
|
2967
|
+
let r = e.output;
|
|
2968
|
+
if (r === "auto")
|
|
2969
|
+
n.toLowerCase().endsWith(".xcstrings") ? r = "xcstrings" : n.toLowerCase().endsWith(".strings") ? r = "strings" : r = "xcstrings";
|
|
2970
|
+
else if (r === "strings" && n.toLowerCase().endsWith(".xcstrings"))
|
|
2971
|
+
throw new Error(
|
|
2972
|
+
"Output format mismatch: specified --output strings but the outpath has .xcstrings extension."
|
|
2973
|
+
);
|
|
2974
|
+
const { keyFilter: i, textFilter: t } = zr(e);
|
|
2975
|
+
await vl({
|
|
2976
|
+
sourcePath: e.path,
|
|
2977
|
+
outpath: n,
|
|
2978
|
+
outputFormat: r,
|
|
2979
|
+
mergePolicy: e.mergePolicy || e.m || "error",
|
|
2980
|
+
keyFilter: i,
|
|
2981
|
+
textFilter: t,
|
|
2982
|
+
languages: e.languages
|
|
2983
|
+
});
|
|
2984
|
+
}
|
|
2985
|
+
};
|
|
2986
|
+
}
|
|
2987
|
+
async function vl(e) {
|
|
2988
|
+
if (e.outputFormat === "xcstrings") {
|
|
2989
|
+
const n = await Q(e.sourcePath), r = le(e.keyFilter), i = le(e.textFilter), t = e.languages ? new Set(e.languages) : null, o = gl(e.outpath);
|
|
2990
|
+
let l = {
|
|
2991
|
+
sourceLanguage: n.sourceLanguage,
|
|
2992
|
+
version: n.version ?? "1.0",
|
|
2993
|
+
strings: {}
|
|
2994
|
+
};
|
|
2995
|
+
if (await Ye(o)) {
|
|
2996
|
+
if (e.mergePolicy === "error")
|
|
2997
|
+
throw new Error(
|
|
2998
|
+
`Output file already exists: ${o}. Use --merge-policy to override.`
|
|
2999
|
+
);
|
|
3000
|
+
if (e.mergePolicy === "force" && await Yn(o, { recursive: !0, force: !0 }), e.mergePolicy === "existing-first" || e.mergePolicy === "output-first")
|
|
3001
|
+
try {
|
|
3002
|
+
const s = await Ke(
|
|
3003
|
+
o,
|
|
3004
|
+
"utf8"
|
|
3005
|
+
);
|
|
3006
|
+
l = JSON.parse(s), l.strings = l.strings ?? {};
|
|
3007
|
+
} catch {
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
for (const [s, c] of Object.entries(n.strings ?? {})) {
|
|
3011
|
+
if (!r(s)) continue;
|
|
3012
|
+
const f = JSON.parse(JSON.stringify(c));
|
|
3013
|
+
if (f.localizations)
|
|
3014
|
+
for (const u of Object.keys(f.localizations)) {
|
|
3015
|
+
if (t && !t.has(u)) {
|
|
3016
|
+
delete f.localizations[u];
|
|
3017
|
+
continue;
|
|
3018
|
+
}
|
|
3019
|
+
const h = f.localizations[u]?.stringUnit?.value ?? "";
|
|
3020
|
+
i(h) || delete f.localizations[u];
|
|
3021
|
+
}
|
|
3022
|
+
if (!(f.localizations && Object.keys(f.localizations).length === 0))
|
|
3023
|
+
if (!l.strings[s])
|
|
3024
|
+
l.strings[s] = f;
|
|
3025
|
+
else {
|
|
3026
|
+
const u = l.strings[s];
|
|
3027
|
+
if (e.mergePolicy === "output-first") {
|
|
3028
|
+
u.comment = f.comment ?? u.comment, u.extractionState = f.extractionState ?? u.extractionState, u.localizations = u.localizations ?? {};
|
|
3029
|
+
const h = Object.entries(f.localizations ?? {});
|
|
3030
|
+
if (h.length > 0)
|
|
3031
|
+
for (const [g, m] of h)
|
|
3032
|
+
u.localizations[g] = m;
|
|
3033
|
+
} else if (e.mergePolicy === "existing-first") {
|
|
3034
|
+
u.localizations = u.localizations ?? {};
|
|
3035
|
+
const h = Object.entries(f.localizations ?? {});
|
|
3036
|
+
if (h.length > 0)
|
|
3037
|
+
for (const [g, m] of h)
|
|
3038
|
+
u.localizations[g] || (u.localizations[g] = m);
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
}
|
|
3042
|
+
await xn(yn(o), { recursive: !0 }), await cn(o, l);
|
|
3043
|
+
} else {
|
|
3044
|
+
const n = await Q(e.sourcePath), r = le(e.keyFilter), i = le(e.textFilter), t = e.languages ? new Set(e.languages) : null;
|
|
3045
|
+
let o = yn(e.outpath), l = qr(e.outpath);
|
|
3046
|
+
l.endsWith(".strings") || (l += ".strings"), e.mergePolicy === "force" && await ml(o, l);
|
|
3047
|
+
const a = /* @__PURE__ */ new Map();
|
|
3048
|
+
for (const [s, c] of Object.entries(n.strings ?? {})) {
|
|
3049
|
+
if (!r(s)) continue;
|
|
3050
|
+
const f = c.localizations ?? {};
|
|
3051
|
+
for (const [u, h] of Object.entries(f)) {
|
|
3052
|
+
if (t && !t.has(u)) continue;
|
|
3053
|
+
const g = h?.stringUnit?.value ?? "";
|
|
3054
|
+
i(g) && (a.has(u) || a.set(u, /* @__PURE__ */ new Map()), a.get(u).set(s, g));
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
if (e.mergePolicy === "error")
|
|
3058
|
+
for (const s of a.keys()) {
|
|
3059
|
+
const c = Ee(o, `${s}.lproj`, l);
|
|
3060
|
+
if (await Ye(c))
|
|
3061
|
+
throw new Error(
|
|
3062
|
+
`Output file already exists: ${c}. Use --merge-policy to override.`
|
|
3063
|
+
);
|
|
3064
|
+
}
|
|
3065
|
+
for (const [s, c] of a.entries()) {
|
|
3066
|
+
const f = Ee(o, `${s}.lproj`), u = Ee(f, l), h = await Ye(u), g = /* @__PURE__ */ new Map();
|
|
3067
|
+
if (h && (e.mergePolicy === "existing-first" || e.mergePolicy === "output-first"))
|
|
3068
|
+
try {
|
|
3069
|
+
const d = await Ke(u, "utf8"), w = /"((?:[^"\\]|\\.)*)"\s*=\s*"((?:[^"\\]|\\.)*)";/g;
|
|
3070
|
+
let k;
|
|
3071
|
+
for (; (k = w.exec(d)) !== null; ) {
|
|
3072
|
+
const v = k[1].replace(/\\"/g, '"'), O = k[2].replace(/\\"/g, '"');
|
|
3073
|
+
g.set(v, O);
|
|
3074
|
+
}
|
|
3075
|
+
} catch {
|
|
3076
|
+
}
|
|
3077
|
+
for (const [d, w] of c.entries())
|
|
3078
|
+
g.has(d) && e.mergePolicy === "existing-first" || g.set(d, w);
|
|
3079
|
+
let m = "";
|
|
3080
|
+
for (const [d, w] of g.entries()) {
|
|
3081
|
+
const k = d.replace(/"/g, '\\"').replace(/\n/g, "\\n"), v = w.replace(/"/g, '\\"').replace(/\n/g, "\\n");
|
|
3082
|
+
m += `"${k}" = "${v}";
|
|
3083
|
+
`;
|
|
3084
|
+
}
|
|
3085
|
+
m.length > 0 && (await xn(f, { recursive: !0 }), await Ze(u, m, "utf8"));
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
const Bn = Ne(process.cwd(), "Localizable.xcstrings");
|
|
3090
|
+
Kr(Wr(process.argv)).scriptName("xcstrings").usage("$0 <cmd> [args]").option("config", {
|
|
2770
3091
|
type: "string",
|
|
2771
3092
|
describe: "Path to config file"
|
|
2772
3093
|
}).option("path", {
|
|
2773
3094
|
type: "string",
|
|
2774
3095
|
describe: "Path or alias to xcstrings file",
|
|
2775
|
-
default:
|
|
3096
|
+
default: Bn
|
|
2776
3097
|
}).middleware(async (e) => {
|
|
2777
|
-
const n = await
|
|
2778
|
-
e.path = await
|
|
3098
|
+
const n = await sn(e.config);
|
|
3099
|
+
e.path = await bo(
|
|
3100
|
+
e.path,
|
|
3101
|
+
n,
|
|
3102
|
+
Bn
|
|
3103
|
+
);
|
|
2779
3104
|
}).command([
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
3105
|
+
Uo(),
|
|
3106
|
+
Bo(),
|
|
3107
|
+
Ko(),
|
|
3108
|
+
Fo(),
|
|
3109
|
+
pl(),
|
|
3110
|
+
yl()
|
|
2785
3111
|
]).demandCommand(1, "").strictCommands().recommendCommands().fail((e, n, r) => {
|
|
2786
|
-
const i = n instanceof
|
|
2787
|
-
(e || i) && (console.error(
|
|
3112
|
+
const i = n instanceof ae;
|
|
3113
|
+
(e || i) && (console.error(S.red(e || n?.message || n)), console.log(), r.showHelp(), process.exit(1)), n && (console.error(S.red(n.message || n)), process.exit(1)), process.exit(1);
|
|
2788
3114
|
}).help().argv;
|