xcstrings-cli 2.4.0 → 2.5.1
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 +47 -0
- package/dist/index.js +360 -351
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import Nr from "yargs";
|
|
3
3
|
import { hideBin as Rr } from "yargs/helpers";
|
|
4
4
|
import { resolve as Oe, relative as we } from "node:path";
|
|
5
|
-
import { cosmiconfig as
|
|
5
|
+
import { cosmiconfig as Mr } from "cosmiconfig";
|
|
6
6
|
import De from "json5";
|
|
7
|
-
import { select as
|
|
8
|
-
import
|
|
7
|
+
import { select as Pr, checkbox as an, confirm as Dr } from "@inquirer/prompts";
|
|
8
|
+
import S from "chalk";
|
|
9
9
|
import { readFile as $r, writeFile as Nn, readdir as Rn } from "node:fs/promises";
|
|
10
|
-
import { XcodeProject as
|
|
11
|
-
const Le = "xcstrings-cli", sn =
|
|
10
|
+
import { XcodeProject as zr } from "@bacons/xcode";
|
|
11
|
+
const Le = "xcstrings-cli", sn = Mr(Le, {
|
|
12
12
|
searchPlaces: [
|
|
13
13
|
`${Le}.json`,
|
|
14
14
|
`${Le}.json5`
|
|
@@ -33,7 +33,7 @@ function cn(e, n) {
|
|
|
33
33
|
return r.path;
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
|
-
async function
|
|
36
|
+
async function Br(e, n, r) {
|
|
37
37
|
const i = n?.xcstringsPaths, t = i?.some((s) => typeof s != "string") ?? !1, o = e.startsWith("alias:") ? e.slice(6) : null;
|
|
38
38
|
if (o) {
|
|
39
39
|
const s = cn(i, o);
|
|
@@ -53,7 +53,7 @@ async function zr(e, n, r) {
|
|
|
53
53
|
return typeof u == "string" ? u : u.path;
|
|
54
54
|
}
|
|
55
55
|
const s = i.map((u) => typeof u == "string" ? { name: u, value: u } : { name: `${u.alias} (${u.path})`, value: u.path });
|
|
56
|
-
return await
|
|
56
|
+
return await Pr({
|
|
57
57
|
message: "Select xcstrings file:",
|
|
58
58
|
choices: s
|
|
59
59
|
});
|
|
@@ -65,7 +65,7 @@ async function me(e) {
|
|
|
65
65
|
const n = await $r(e, "utf-8");
|
|
66
66
|
return JSON.parse(n);
|
|
67
67
|
}
|
|
68
|
-
async function
|
|
68
|
+
async function Mn(e, n) {
|
|
69
69
|
const r = JSON.stringify(n, null, 2), i = Ur(r);
|
|
70
70
|
await Nn(e, i + `
|
|
71
71
|
`, "utf-8");
|
|
@@ -124,51 +124,51 @@ function Hr() {
|
|
|
124
124
|
return r;
|
|
125
125
|
var u = i.length;
|
|
126
126
|
if (u === 0) return r;
|
|
127
|
-
for (var f = "",
|
|
128
|
-
if (r.charCodeAt(
|
|
129
|
-
switch (g = g > -1 ? g : 0, r.charCodeAt(
|
|
127
|
+
for (var f = "", h = 1 - l, g = -1, y = r && r.length || 0, d = 0; d < y; ) {
|
|
128
|
+
if (r.charCodeAt(d) === 37 && d + 1 < y) {
|
|
129
|
+
switch (g = g > -1 ? g : 0, r.charCodeAt(d + 1)) {
|
|
130
130
|
case 100:
|
|
131
131
|
// 'd'
|
|
132
132
|
case 102:
|
|
133
|
-
if (
|
|
134
|
-
g <
|
|
133
|
+
if (h >= u || i[h] == null) break;
|
|
134
|
+
g < d && (f += r.slice(g, d)), f += Number(i[h]), g = d + 2, d++;
|
|
135
135
|
break;
|
|
136
136
|
case 105:
|
|
137
|
-
if (
|
|
138
|
-
g <
|
|
137
|
+
if (h >= u || i[h] == null) break;
|
|
138
|
+
g < d && (f += r.slice(g, d)), f += Math.floor(Number(i[h])), g = d + 2, d++;
|
|
139
139
|
break;
|
|
140
140
|
case 79:
|
|
141
141
|
// 'O'
|
|
142
142
|
case 111:
|
|
143
143
|
// 'o'
|
|
144
144
|
case 106:
|
|
145
|
-
if (
|
|
146
|
-
g <
|
|
147
|
-
var
|
|
148
|
-
if (
|
|
149
|
-
f += "'" + i[
|
|
145
|
+
if (h >= u || i[h] === void 0) break;
|
|
146
|
+
g < d && (f += r.slice(g, d));
|
|
147
|
+
var b = typeof i[h];
|
|
148
|
+
if (b === "string") {
|
|
149
|
+
f += "'" + i[h] + "'", g = d + 2, d++;
|
|
150
150
|
break;
|
|
151
151
|
}
|
|
152
|
-
if (
|
|
153
|
-
f += i[
|
|
152
|
+
if (b === "function") {
|
|
153
|
+
f += i[h].name || "<anonymous>", g = d + 2, d++;
|
|
154
154
|
break;
|
|
155
155
|
}
|
|
156
|
-
f += o(i[
|
|
156
|
+
f += o(i[h]), g = d + 2, d++;
|
|
157
157
|
break;
|
|
158
158
|
case 115:
|
|
159
|
-
if (
|
|
159
|
+
if (h >= u)
|
|
160
160
|
break;
|
|
161
|
-
g <
|
|
161
|
+
g < d && (f += r.slice(g, d)), f += String(i[h]), g = d + 2, d++;
|
|
162
162
|
break;
|
|
163
163
|
case 37:
|
|
164
|
-
g <
|
|
164
|
+
g < d && (f += r.slice(g, d)), f += "%", g = d + 2, d++, h--;
|
|
165
165
|
break;
|
|
166
166
|
}
|
|
167
|
-
++
|
|
167
|
+
++h;
|
|
168
168
|
}
|
|
169
|
-
++
|
|
169
|
+
++d;
|
|
170
170
|
}
|
|
171
|
-
return g === -1 ? r : (g <
|
|
171
|
+
return g === -1 ? r : (g < y && (f += r.slice(g)), f);
|
|
172
172
|
}
|
|
173
173
|
return je;
|
|
174
174
|
}
|
|
@@ -201,21 +201,21 @@ function Kr() {
|
|
|
201
201
|
trace: "log"
|
|
202
202
|
};
|
|
203
203
|
function a(p, m) {
|
|
204
|
-
const
|
|
204
|
+
const A = {
|
|
205
205
|
logger: m,
|
|
206
206
|
parent: p[o]
|
|
207
207
|
};
|
|
208
|
-
m[o] =
|
|
208
|
+
m[o] = A;
|
|
209
209
|
}
|
|
210
|
-
function s(p, m,
|
|
211
|
-
const
|
|
210
|
+
function s(p, m, A) {
|
|
211
|
+
const k = {};
|
|
212
212
|
m.forEach((E) => {
|
|
213
|
-
|
|
214
|
-
}), p[t] =
|
|
213
|
+
k[E] = A[E] ? A[E] : n[E] || n[l[E] || "log"] || se;
|
|
214
|
+
}), p[t] = k;
|
|
215
215
|
}
|
|
216
216
|
function c(p, m) {
|
|
217
|
-
return Array.isArray(p) ? p.filter(function(
|
|
218
|
-
return
|
|
217
|
+
return Array.isArray(p) ? p.filter(function(k) {
|
|
218
|
+
return k !== "!stdSerializers.err";
|
|
219
219
|
}) : p === !0 ? Object.keys(m) : !1;
|
|
220
220
|
}
|
|
221
221
|
function u(p) {
|
|
@@ -223,17 +223,17 @@ function Kr() {
|
|
|
223
223
|
const m = p.browser.transmit;
|
|
224
224
|
if (m && typeof m.send != "function")
|
|
225
225
|
throw Error("pino: transmit option must have a send function");
|
|
226
|
-
const
|
|
226
|
+
const A = p.browser.write || n;
|
|
227
227
|
p.browser.write && (p.browser.asObject = !0);
|
|
228
|
-
const
|
|
229
|
-
let
|
|
230
|
-
Array.isArray(p.browser.serialize) && p.browser.serialize.indexOf("!stdSerializers.err") > -1 && (
|
|
228
|
+
const k = p.serializers || {}, E = c(p.browser.serialize, k);
|
|
229
|
+
let z = p.browser.serialize;
|
|
230
|
+
Array.isArray(p.browser.serialize) && p.browser.serialize.indexOf("!stdSerializers.err") > -1 && (z = !1);
|
|
231
231
|
const K = Object.keys(p.customLevels || {}), O = ["error", "fatal", "warn", "info", "debug", "trace"].concat(K);
|
|
232
|
-
typeof
|
|
233
|
-
|
|
232
|
+
typeof A == "function" && O.forEach(function(B) {
|
|
233
|
+
A[B] = A;
|
|
234
234
|
}), (p.enabled === !1 || p.browser.disabled) && (p.level = "silent");
|
|
235
|
-
const
|
|
236
|
-
w.log || (w.log = se), s(w, O,
|
|
235
|
+
const M = p.level || "info", w = Object.create(A);
|
|
236
|
+
w.log || (w.log = se), s(w, O, A), a({}, w), Object.defineProperty(w, "levelVal", {
|
|
237
237
|
get: ve
|
|
238
238
|
}), Object.defineProperty(w, "level", {
|
|
239
239
|
get: Z,
|
|
@@ -247,32 +247,32 @@ function Kr() {
|
|
|
247
247
|
levels: O,
|
|
248
248
|
timestamp: J(p)
|
|
249
249
|
};
|
|
250
|
-
w.levels = f(p), w.level =
|
|
250
|
+
w.levels = f(p), w.level = M, w.setMaxListeners = w.getMaxListeners = w.emit = w.addListener = w.on = w.prependListener = w.once = w.prependOnceListener = w.removeListener = w.removeAllListeners = w.listeners = w.listenerCount = w.eventNames = w.write = w.flush = se, w.serializers = k, w._serialize = E, w._stdErrSerialize = z, w.child = Ir, m && (w._logEvent = L());
|
|
251
251
|
function ve() {
|
|
252
252
|
return i(this.level, this);
|
|
253
253
|
}
|
|
254
254
|
function Z() {
|
|
255
255
|
return this._level;
|
|
256
256
|
}
|
|
257
|
-
function jr(
|
|
258
|
-
if (
|
|
259
|
-
throw Error("unknown level " +
|
|
260
|
-
this._level =
|
|
261
|
-
|
|
257
|
+
function jr(B) {
|
|
258
|
+
if (B !== "silent" && !this.levels.values[B])
|
|
259
|
+
throw Error("unknown level " + B);
|
|
260
|
+
this._level = B, y(this, Y, w, "error"), y(this, Y, w, "fatal"), y(this, Y, w, "warn"), y(this, Y, w, "info"), y(this, Y, w, "debug"), y(this, Y, w, "trace"), K.forEach((ee) => {
|
|
261
|
+
y(this, Y, w, ee);
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
|
-
function Ir(
|
|
265
|
-
if (!
|
|
264
|
+
function Ir(B, ee) {
|
|
265
|
+
if (!B)
|
|
266
266
|
throw new Error("missing bindings for child Pino");
|
|
267
|
-
ee = ee || {}, E &&
|
|
267
|
+
ee = ee || {}, E && B.serializers && (ee.serializers = B.serializers);
|
|
268
268
|
const rn = ee.serializers;
|
|
269
269
|
if (E && rn) {
|
|
270
|
-
var xe = Object.assign({},
|
|
271
|
-
delete
|
|
270
|
+
var xe = Object.assign({}, k, rn), tn = p.browser.serialize === !0 ? Object.keys(xe) : E;
|
|
271
|
+
delete B.serializers, x([B], tn, xe, this._stdErrSerialize);
|
|
272
272
|
}
|
|
273
273
|
function on(ln) {
|
|
274
|
-
this._childLevel = (ln._childLevel | 0) + 1, this.bindings =
|
|
275
|
-
[].concat(ln._logEvent.bindings,
|
|
274
|
+
this._childLevel = (ln._childLevel | 0) + 1, this.bindings = B, xe && (this.serializers = xe, this._serialize = tn), m && (this._logEvent = L(
|
|
275
|
+
[].concat(ln._logEvent.bindings, B)
|
|
276
276
|
));
|
|
277
277
|
}
|
|
278
278
|
on.prototype = this;
|
|
@@ -282,16 +282,16 @@ function Kr() {
|
|
|
282
282
|
return w;
|
|
283
283
|
}
|
|
284
284
|
function f(p) {
|
|
285
|
-
const m = p.customLevels || {},
|
|
285
|
+
const m = p.customLevels || {}, A = Object.assign({}, u.levels.values, m), k = Object.assign({}, u.levels.labels, h(m));
|
|
286
286
|
return {
|
|
287
|
-
values:
|
|
288
|
-
labels:
|
|
287
|
+
values: A,
|
|
288
|
+
labels: k
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function h(p) {
|
|
292
292
|
const m = {};
|
|
293
|
-
return Object.keys(p).forEach(function(
|
|
294
|
-
m[p[
|
|
293
|
+
return Object.keys(p).forEach(function(A) {
|
|
294
|
+
m[p[A]] = A;
|
|
295
295
|
}), m;
|
|
296
296
|
}
|
|
297
297
|
u.levels = {
|
|
@@ -315,84 +315,84 @@ function Kr() {
|
|
|
315
315
|
function g(p) {
|
|
316
316
|
const m = [];
|
|
317
317
|
p.bindings && m.push(p.bindings);
|
|
318
|
-
let
|
|
319
|
-
for (;
|
|
320
|
-
|
|
318
|
+
let A = p[o];
|
|
319
|
+
for (; A.parent; )
|
|
320
|
+
A = A.parent, A.logger.bindings && m.push(A.logger.bindings);
|
|
321
321
|
return m.reverse();
|
|
322
322
|
}
|
|
323
|
-
function
|
|
324
|
-
if (Object.defineProperty(p,
|
|
325
|
-
value: i(p.level,
|
|
323
|
+
function y(p, m, A, k) {
|
|
324
|
+
if (Object.defineProperty(p, k, {
|
|
325
|
+
value: i(p.level, A) > i(k, A) ? se : A[t][k],
|
|
326
326
|
writable: !0,
|
|
327
327
|
enumerable: !0,
|
|
328
328
|
configurable: !0
|
|
329
|
-
}), !m.transmit && p[
|
|
329
|
+
}), !m.transmit && p[k] === se)
|
|
330
330
|
return;
|
|
331
|
-
p[
|
|
331
|
+
p[k] = b(p, m, A, k);
|
|
332
332
|
const E = g(p);
|
|
333
|
-
E.length !== 0 && (p[
|
|
333
|
+
E.length !== 0 && (p[k] = d(E, p[k]));
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function d(p, m) {
|
|
336
336
|
return function() {
|
|
337
337
|
return m.apply(this, [...p, ...arguments]);
|
|
338
338
|
};
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function b(p, m, A, k) {
|
|
341
341
|
return /* @__PURE__ */ (function(E) {
|
|
342
342
|
return function() {
|
|
343
|
-
const K = m.timestamp(), O = new Array(arguments.length),
|
|
343
|
+
const K = m.timestamp(), O = new Array(arguments.length), M = Object.getPrototypeOf && Object.getPrototypeOf(this) === n ? n : this;
|
|
344
344
|
for (var w = 0; w < O.length; w++) O[w] = arguments[w];
|
|
345
|
-
if (m.serialize && !m.asObject && x(O, this._serialize, this.serializers, this._stdErrSerialize), m.asObject || m.formatters ? E.call(
|
|
346
|
-
const Y = m.transmit.level || p._level, ve =
|
|
345
|
+
if (m.serialize && !m.asObject && x(O, this._serialize, this.serializers, this._stdErrSerialize), m.asObject || m.formatters ? E.call(M, C(this, k, O, K, m.formatters)) : E.apply(M, O), m.transmit) {
|
|
346
|
+
const Y = m.transmit.level || p._level, ve = A.levels.values[Y], Z = A.levels.values[k];
|
|
347
347
|
if (Z < ve) return;
|
|
348
348
|
_(this, {
|
|
349
349
|
ts: K,
|
|
350
|
-
methodLevel:
|
|
350
|
+
methodLevel: k,
|
|
351
351
|
methodValue: Z,
|
|
352
|
-
transmitValue:
|
|
352
|
+
transmitValue: A.levels.values[m.transmit.level || p._level],
|
|
353
353
|
send: m.transmit.send,
|
|
354
|
-
val: i(p._level,
|
|
354
|
+
val: i(p._level, A)
|
|
355
355
|
}, O);
|
|
356
356
|
}
|
|
357
357
|
};
|
|
358
|
-
})(p[t][
|
|
358
|
+
})(p[t][k]);
|
|
359
359
|
}
|
|
360
|
-
function C(p, m,
|
|
360
|
+
function C(p, m, A, k, E = {}) {
|
|
361
361
|
const {
|
|
362
|
-
level:
|
|
362
|
+
level: z = () => p.levels.values[m],
|
|
363
363
|
log: K = (Z) => Z
|
|
364
364
|
} = E;
|
|
365
|
-
p._serialize && x(
|
|
366
|
-
const O =
|
|
367
|
-
let
|
|
365
|
+
p._serialize && x(A, p._serialize, p.serializers, p._stdErrSerialize);
|
|
366
|
+
const O = A.slice();
|
|
367
|
+
let M = O[0];
|
|
368
368
|
const w = {};
|
|
369
|
-
|
|
369
|
+
k && (w.time = k), w.level = z(m, p.levels.values[m]);
|
|
370
370
|
let Y = (p._childLevel | 0) + 1;
|
|
371
|
-
if (Y < 1 && (Y = 1),
|
|
371
|
+
if (Y < 1 && (Y = 1), M !== null && typeof M == "object") {
|
|
372
372
|
for (; Y-- && typeof O[0] == "object"; )
|
|
373
373
|
Object.assign(w, O.shift());
|
|
374
|
-
|
|
375
|
-
} else typeof
|
|
376
|
-
return
|
|
374
|
+
M = O.length ? e(O.shift(), O) : void 0;
|
|
375
|
+
} else typeof M == "string" && (M = e(O.shift(), O));
|
|
376
|
+
return M !== void 0 && (w.msg = M), K(w);
|
|
377
377
|
}
|
|
378
|
-
function x(p, m,
|
|
378
|
+
function x(p, m, A, k) {
|
|
379
379
|
for (const E in p)
|
|
380
|
-
if (
|
|
380
|
+
if (k && p[E] instanceof Error)
|
|
381
381
|
p[E] = u.stdSerializers.err(p[E]);
|
|
382
382
|
else if (typeof p[E] == "object" && !Array.isArray(p[E]))
|
|
383
|
-
for (const
|
|
384
|
-
m && m.indexOf(
|
|
383
|
+
for (const z in p[E])
|
|
384
|
+
m && m.indexOf(z) > -1 && z in A && (p[E][z] = A[z](p[E][z]));
|
|
385
385
|
}
|
|
386
|
-
function _(p, m,
|
|
387
|
-
const
|
|
386
|
+
function _(p, m, A) {
|
|
387
|
+
const k = m.send, E = m.ts, z = m.methodLevel, K = m.methodValue, O = m.val, M = p._logEvent.bindings;
|
|
388
388
|
x(
|
|
389
|
-
|
|
389
|
+
A,
|
|
390
390
|
p._serialize || Object.keys(p.serializers),
|
|
391
391
|
p.serializers,
|
|
392
392
|
p._stdErrSerialize === void 0 ? !0 : p._stdErrSerialize
|
|
393
|
-
), p._logEvent.ts = E, p._logEvent.messages =
|
|
394
|
-
return
|
|
395
|
-
}), p._logEvent.level.label =
|
|
393
|
+
), p._logEvent.ts = E, p._logEvent.messages = A.filter(function(w) {
|
|
394
|
+
return M.indexOf(w) === -1;
|
|
395
|
+
}), p._logEvent.level.label = z, p._logEvent.level.value = K, k(z, p._logEvent, O), p._logEvent = L(M);
|
|
396
396
|
}
|
|
397
397
|
function L(p) {
|
|
398
398
|
return {
|
|
@@ -408,8 +408,8 @@ function Kr() {
|
|
|
408
408
|
msg: p.message,
|
|
409
409
|
stack: p.stack
|
|
410
410
|
};
|
|
411
|
-
for (const
|
|
412
|
-
m[
|
|
411
|
+
for (const A in p)
|
|
412
|
+
m[A] === void 0 && (m[A] = p[A]);
|
|
413
413
|
return m;
|
|
414
414
|
}
|
|
415
415
|
function J(p) {
|
|
@@ -461,14 +461,14 @@ function Gr() {
|
|
|
461
461
|
command: "languages",
|
|
462
462
|
describe: "List supported languages from xcodeproj or xcstrings",
|
|
463
463
|
handler: async (e) => {
|
|
464
|
-
const n = await
|
|
464
|
+
const n = await Pn(e.path, e.config);
|
|
465
465
|
X.info(n.join(" "));
|
|
466
466
|
}
|
|
467
467
|
};
|
|
468
468
|
}
|
|
469
469
|
function Vr(e) {
|
|
470
470
|
const n = Oe(e, "project.pbxproj");
|
|
471
|
-
return (
|
|
471
|
+
return (zr.open(n).rootObject.props.knownRegions ?? []).filter((o) => o !== "Base").sort();
|
|
472
472
|
}
|
|
473
473
|
async function Xr(e) {
|
|
474
474
|
const n = await me(e), r = /* @__PURE__ */ new Set();
|
|
@@ -483,7 +483,7 @@ async function Xr(e) {
|
|
|
483
483
|
}
|
|
484
484
|
return Array.from(r).sort();
|
|
485
485
|
}
|
|
486
|
-
async function
|
|
486
|
+
async function Pn(e, n) {
|
|
487
487
|
const { sourceLanguage: r } = await me(e);
|
|
488
488
|
if (!r)
|
|
489
489
|
throw new Error('The xcstrings file is missing "sourceLanguage".');
|
|
@@ -545,7 +545,7 @@ fe.prototype.constructor = fe;
|
|
|
545
545
|
fe.prototype.toString = function(n) {
|
|
546
546
|
return this.name + ": " + $n(this, n);
|
|
547
547
|
};
|
|
548
|
-
var
|
|
548
|
+
var P = fe;
|
|
549
549
|
function Ie(e, n, r, i, t) {
|
|
550
550
|
var o = "", l = "", a = Math.floor(t / 2) - 1;
|
|
551
551
|
return i - n > a && (o = " ... ", n = i - a + o.length), r - i > a && (l = " ...", r = i + a - l.length), {
|
|
@@ -613,13 +613,13 @@ function pi(e) {
|
|
|
613
613
|
function di(e, n) {
|
|
614
614
|
if (n = n || {}, Object.keys(n).forEach(function(r) {
|
|
615
615
|
if (ui.indexOf(r) === -1)
|
|
616
|
-
throw new
|
|
616
|
+
throw new P('Unknown option "' + r + '" is met in definition of "' + e + '" YAML type.');
|
|
617
617
|
}), this.options = n, this.tag = e, this.kind = n.kind || null, this.resolve = n.resolve || function() {
|
|
618
618
|
return !0;
|
|
619
619
|
}, this.construct = n.construct || function(r) {
|
|
620
620
|
return r;
|
|
621
621
|
}, 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 = pi(n.styleAliases || null), fi.indexOf(this.kind) === -1)
|
|
622
|
-
throw new
|
|
622
|
+
throw new P('Unknown kind "' + this.kind + '" is specified for "' + e + '" YAML type.');
|
|
623
623
|
}
|
|
624
624
|
var j = di;
|
|
625
625
|
function pn(e, n) {
|
|
@@ -651,10 +651,10 @@ function hi() {
|
|
|
651
651
|
arguments[n].forEach(i);
|
|
652
652
|
return e;
|
|
653
653
|
}
|
|
654
|
-
function
|
|
654
|
+
function ze(e) {
|
|
655
655
|
return this.extend(e);
|
|
656
656
|
}
|
|
657
|
-
|
|
657
|
+
ze.prototype.extend = function(n) {
|
|
658
658
|
var r = [], i = [];
|
|
659
659
|
if (n instanceof j)
|
|
660
660
|
i.push(n);
|
|
@@ -663,22 +663,22 @@ Be.prototype.extend = function(n) {
|
|
|
663
663
|
else if (n && (Array.isArray(n.implicit) || Array.isArray(n.explicit)))
|
|
664
664
|
n.implicit && (r = r.concat(n.implicit)), n.explicit && (i = i.concat(n.explicit));
|
|
665
665
|
else
|
|
666
|
-
throw new
|
|
666
|
+
throw new P("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
667
667
|
r.forEach(function(o) {
|
|
668
668
|
if (!(o instanceof j))
|
|
669
|
-
throw new
|
|
669
|
+
throw new P("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
670
670
|
if (o.loadKind && o.loadKind !== "scalar")
|
|
671
|
-
throw new
|
|
671
|
+
throw new P("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
672
672
|
if (o.multi)
|
|
673
|
-
throw new
|
|
673
|
+
throw new P("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
674
674
|
}), i.forEach(function(o) {
|
|
675
675
|
if (!(o instanceof j))
|
|
676
|
-
throw new
|
|
676
|
+
throw new P("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
677
677
|
});
|
|
678
|
-
var t = Object.create(
|
|
678
|
+
var t = Object.create(ze.prototype);
|
|
679
679
|
return t.implicit = (this.implicit || []).concat(r), t.explicit = (this.explicit || []).concat(i), t.compiledImplicit = pn(t, "implicit"), t.compiledExplicit = pn(t, "explicit"), t.compiledTypeMap = hi(t.compiledImplicit, t.compiledExplicit), t;
|
|
680
680
|
};
|
|
681
|
-
var
|
|
681
|
+
var zn = ze, Bn = new j("tag:yaml.org,2002:str", {
|
|
682
682
|
kind: "scalar",
|
|
683
683
|
construct: function(e) {
|
|
684
684
|
return e !== null ? e : "";
|
|
@@ -693,9 +693,9 @@ var Bn = Be, zn = new j("tag:yaml.org,2002:str", {
|
|
|
693
693
|
construct: function(e) {
|
|
694
694
|
return e !== null ? e : {};
|
|
695
695
|
}
|
|
696
|
-
}), Hn = new
|
|
696
|
+
}), Hn = new zn({
|
|
697
697
|
explicit: [
|
|
698
|
-
|
|
698
|
+
Bn,
|
|
699
699
|
Un,
|
|
700
700
|
Yn
|
|
701
701
|
]
|
|
@@ -773,7 +773,7 @@ function Ai(e) {
|
|
|
773
773
|
function Ci(e) {
|
|
774
774
|
return 48 <= e && e <= 57;
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function Si(e) {
|
|
777
777
|
if (e === null) return !1;
|
|
778
778
|
var n = e.length, r = 0, i = !1, t;
|
|
779
779
|
if (!n) return !1;
|
|
@@ -813,7 +813,7 @@ function ki(e) {
|
|
|
813
813
|
}
|
|
814
814
|
return !(!i || t === "_");
|
|
815
815
|
}
|
|
816
|
-
function
|
|
816
|
+
function ki(e) {
|
|
817
817
|
var n = e, r = 1, i;
|
|
818
818
|
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;
|
|
819
819
|
if (i === "0") {
|
|
@@ -828,8 +828,8 @@ function Ei(e) {
|
|
|
828
828
|
}
|
|
829
829
|
var qn = new j("tag:yaml.org,2002:int", {
|
|
830
830
|
kind: "scalar",
|
|
831
|
-
resolve:
|
|
832
|
-
construct:
|
|
831
|
+
resolve: Si,
|
|
832
|
+
construct: ki,
|
|
833
833
|
predicate: Ei,
|
|
834
834
|
represent: {
|
|
835
835
|
binary: function(e) {
|
|
@@ -926,7 +926,7 @@ function Ii(e) {
|
|
|
926
926
|
return e === null ? !1 : Qn.exec(e) !== null || Jn.exec(e) !== null;
|
|
927
927
|
}
|
|
928
928
|
function Ni(e) {
|
|
929
|
-
var n, r, i, t, o, l, a, s = 0, c = null, u, f,
|
|
929
|
+
var n, r, i, t, o, l, a, s = 0, c = null, u, f, h;
|
|
930
930
|
if (n = Qn.exec(e), n === null && (n = Jn.exec(e)), n === null) throw new Error("Date resolve error");
|
|
931
931
|
if (r = +n[1], i = +n[2] - 1, t = +n[3], !n[4])
|
|
932
932
|
return new Date(Date.UTC(r, i, t));
|
|
@@ -935,7 +935,7 @@ function Ni(e) {
|
|
|
935
935
|
s += "0";
|
|
936
936
|
s = +s;
|
|
937
937
|
}
|
|
938
|
-
return n[9] && (u = +n[10], f = +(n[11] || 0), c = (u * 60 + f) * 6e4, n[9] === "-" && (c = -c)),
|
|
938
|
+
return n[9] && (u = +n[10], f = +(n[11] || 0), c = (u * 60 + f) * 6e4, n[9] === "-" && (c = -c)), h = new Date(Date.UTC(r, i, t, o, l, a, s)), c && h.setTime(h.getTime() - c), h;
|
|
939
939
|
}
|
|
940
940
|
function Ri(e) {
|
|
941
941
|
return e.toISOString();
|
|
@@ -947,15 +947,15 @@ var Zn = new j("tag:yaml.org,2002:timestamp", {
|
|
|
947
947
|
instanceOf: Date,
|
|
948
948
|
represent: Ri
|
|
949
949
|
});
|
|
950
|
-
function
|
|
950
|
+
function Mi(e) {
|
|
951
951
|
return e === "<<" || e === null;
|
|
952
952
|
}
|
|
953
953
|
var er = new j("tag:yaml.org,2002:merge", {
|
|
954
954
|
kind: "scalar",
|
|
955
|
-
resolve:
|
|
955
|
+
resolve: Mi
|
|
956
956
|
}), qe = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
957
957
|
\r`;
|
|
958
|
-
function
|
|
958
|
+
function Pi(e) {
|
|
959
959
|
if (e === null) return !1;
|
|
960
960
|
var n, r, i = 0, t = e.length, o = qe;
|
|
961
961
|
for (r = 0; r < t; r++)
|
|
@@ -977,23 +977,23 @@ function $i(e) {
|
|
|
977
977
|
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];
|
|
978
978
|
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;
|
|
979
979
|
}
|
|
980
|
-
function
|
|
980
|
+
function zi(e) {
|
|
981
981
|
return Object.prototype.toString.call(e) === "[object Uint8Array]";
|
|
982
982
|
}
|
|
983
983
|
var nr = new j("tag:yaml.org,2002:binary", {
|
|
984
984
|
kind: "scalar",
|
|
985
|
-
resolve:
|
|
985
|
+
resolve: Pi,
|
|
986
986
|
construct: Di,
|
|
987
|
-
predicate:
|
|
987
|
+
predicate: zi,
|
|
988
988
|
represent: $i
|
|
989
|
-
}),
|
|
989
|
+
}), Bi = Object.prototype.hasOwnProperty, Ui = Object.prototype.toString;
|
|
990
990
|
function Yi(e) {
|
|
991
991
|
if (e === null) return !0;
|
|
992
992
|
var n = [], r, i, t, o, l, a = e;
|
|
993
993
|
for (r = 0, i = a.length; r < i; r += 1) {
|
|
994
994
|
if (t = a[r], l = !1, Ui.call(t) !== "[object Object]") return !1;
|
|
995
995
|
for (o in t)
|
|
996
|
-
if (
|
|
996
|
+
if (Bi.call(t, o))
|
|
997
997
|
if (!l) l = !0;
|
|
998
998
|
else return !1;
|
|
999
999
|
if (!l) return !1;
|
|
@@ -1057,7 +1057,7 @@ var tr = new j("tag:yaml.org,2002:set", {
|
|
|
1057
1057
|
ir,
|
|
1058
1058
|
tr
|
|
1059
1059
|
]
|
|
1060
|
-
}), G = Object.prototype.hasOwnProperty, Ce = 1, or = 2, lr = 3,
|
|
1060
|
+
}), G = Object.prototype.hasOwnProperty, Ce = 1, or = 2, lr = 3, Se = 4, Re = 1, Qi = 2, dn = 3, Ji = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, Zi = /[\x85\u2028\u2029]/, et = /[,\[\]\{\}]/, ar = /^(?:!|!!|![a-z\-]+!)$/i, sr = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
1061
1061
|
function hn(e) {
|
|
1062
1062
|
return Object.prototype.toString.call(e);
|
|
1063
1063
|
}
|
|
@@ -1116,26 +1116,26 @@ function pr(e, n) {
|
|
|
1116
1116
|
line: e.line,
|
|
1117
1117
|
column: e.position - e.lineStart
|
|
1118
1118
|
};
|
|
1119
|
-
return r.snippet = ci(r), new
|
|
1119
|
+
return r.snippet = ci(r), new P(n, r);
|
|
1120
1120
|
}
|
|
1121
|
-
function
|
|
1121
|
+
function v(e, n) {
|
|
1122
1122
|
throw pr(e, n);
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1124
|
+
function ke(e, n) {
|
|
1125
1125
|
e.onWarning && e.onWarning.call(null, pr(e, n));
|
|
1126
1126
|
}
|
|
1127
1127
|
var mn = {
|
|
1128
1128
|
YAML: function(n, r, i) {
|
|
1129
1129
|
var t, o, l;
|
|
1130
|
-
n.version !== null &&
|
|
1130
|
+
n.version !== null && v(n, "duplication of %YAML directive"), i.length !== 1 && v(n, "YAML directive accepts exactly one argument"), t = /^([0-9]+)\.([0-9]+)$/.exec(i[0]), t === null && v(n, "ill-formed argument of the YAML directive"), o = parseInt(t[1], 10), l = parseInt(t[2], 10), o !== 1 && v(n, "unacceptable YAML version of the document"), n.version = i[0], n.checkLineBreaks = l < 2, l !== 1 && l !== 2 && ke(n, "unsupported YAML version of the document");
|
|
1131
1131
|
},
|
|
1132
1132
|
TAG: function(n, r, i) {
|
|
1133
1133
|
var t, o;
|
|
1134
|
-
i.length !== 2 &&
|
|
1134
|
+
i.length !== 2 && v(n, "TAG directive accepts exactly two arguments"), t = i[0], o = i[1], ar.test(t) || v(n, "ill-formed tag handle (first argument) of the TAG directive"), G.call(n.tagMap, t) && v(n, 'there is a previously declared suffix for "' + t + '" tag handle'), sr.test(o) || v(n, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
1135
1135
|
try {
|
|
1136
1136
|
o = decodeURIComponent(o);
|
|
1137
1137
|
} catch {
|
|
1138
|
-
|
|
1138
|
+
v(n, "tag prefix is malformed: " + o);
|
|
1139
1139
|
}
|
|
1140
1140
|
n.tagMap[t] = o;
|
|
1141
1141
|
}
|
|
@@ -1145,21 +1145,21 @@ function q(e, n, r, i) {
|
|
|
1145
1145
|
if (n < r) {
|
|
1146
1146
|
if (a = e.input.slice(n, r), i)
|
|
1147
1147
|
for (t = 0, o = a.length; t < o; t += 1)
|
|
1148
|
-
l = a.charCodeAt(t), l === 9 || 32 <= l && l <= 1114111 ||
|
|
1149
|
-
else Ji.test(a) &&
|
|
1148
|
+
l = a.charCodeAt(t), l === 9 || 32 <= l && l <= 1114111 || v(e, "expected valid JSON character");
|
|
1149
|
+
else Ji.test(a) && v(e, "the stream contains non-printable characters");
|
|
1150
1150
|
e.result += a;
|
|
1151
1151
|
}
|
|
1152
1152
|
}
|
|
1153
1153
|
function yn(e, n, r, i) {
|
|
1154
1154
|
var t, o, l, a;
|
|
1155
|
-
for (T.isObject(r) ||
|
|
1155
|
+
for (T.isObject(r) || v(e, "cannot merge mappings; the provided source object is unacceptable"), t = Object.keys(r), l = 0, a = t.length; l < a; l += 1)
|
|
1156
1156
|
o = t[l], G.call(n, o) || (cr(n, o, r[o]), i[o] = !0);
|
|
1157
1157
|
}
|
|
1158
1158
|
function te(e, n, r, i, t, o, l, a, s) {
|
|
1159
1159
|
var c, u;
|
|
1160
1160
|
if (Array.isArray(t))
|
|
1161
1161
|
for (t = Array.prototype.slice.call(t), c = 0, u = t.length; c < u; c += 1)
|
|
1162
|
-
Array.isArray(t[c]) &&
|
|
1162
|
+
Array.isArray(t[c]) && v(e, "nested arrays are not supported inside keys"), typeof t == "object" && hn(t[c]) === "[object Object]" && (t[c] = "[object Object]");
|
|
1163
1163
|
if (typeof t == "object" && hn(t) === "[object Object]" && (t = "[object Object]"), t = String(t), n === null && (n = {}), i === "tag:yaml.org,2002:merge")
|
|
1164
1164
|
if (Array.isArray(o))
|
|
1165
1165
|
for (c = 0, u = o.length; c < u; c += 1)
|
|
@@ -1167,12 +1167,12 @@ function te(e, n, r, i, t, o, l, a, s) {
|
|
|
1167
1167
|
else
|
|
1168
1168
|
yn(e, n, o, r);
|
|
1169
1169
|
else
|
|
1170
|
-
!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,
|
|
1170
|
+
!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, v(e, "duplicated mapping key")), cr(n, t, o), delete r[t];
|
|
1171
1171
|
return n;
|
|
1172
1172
|
}
|
|
1173
1173
|
function Ve(e) {
|
|
1174
1174
|
var n;
|
|
1175
|
-
n = e.input.charCodeAt(e.position), n === 10 ? e.position++ : n === 13 ? (e.position++, e.input.charCodeAt(e.position) === 10 && e.position++) :
|
|
1175
|
+
n = e.input.charCodeAt(e.position), n === 10 ? e.position++ : n === 13 ? (e.position++, e.input.charCodeAt(e.position) === 10 && e.position++) : v(e, "a line break is expected"), e.line += 1, e.lineStart = e.position, e.firstTabInLine = -1;
|
|
1176
1176
|
}
|
|
1177
1177
|
function F(e, n, r) {
|
|
1178
1178
|
for (var i = 0, t = e.input.charCodeAt(e.position); t !== 0; ) {
|
|
@@ -1188,7 +1188,7 @@ function F(e, n, r) {
|
|
|
1188
1188
|
else
|
|
1189
1189
|
break;
|
|
1190
1190
|
}
|
|
1191
|
-
return r !== -1 && i !== 0 && e.lineIndent < r &&
|
|
1191
|
+
return r !== -1 && i !== 0 && e.lineIndent < r && ke(e, "deficient indentation"), i;
|
|
1192
1192
|
}
|
|
1193
1193
|
function Fe(e) {
|
|
1194
1194
|
var n = e.position, r;
|
|
@@ -1199,7 +1199,7 @@ function Xe(e, n) {
|
|
|
1199
1199
|
`, n - 1));
|
|
1200
1200
|
}
|
|
1201
1201
|
function lt(e, n, r) {
|
|
1202
|
-
var i, t, o, l, a, s, c, u, f = e.kind,
|
|
1202
|
+
var i, t, o, l, a, s, c, u, f = e.kind, h = e.result, g;
|
|
1203
1203
|
if (g = e.input.charCodeAt(e.position), U(g) || ie(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), U(t) || r && ie(t)))
|
|
1204
1204
|
return !1;
|
|
1205
1205
|
for (e.kind = "scalar", e.result = "", o = l = e.position, a = !1; g !== 0; ) {
|
|
@@ -1223,7 +1223,7 @@ function lt(e, n, r) {
|
|
|
1223
1223
|
}
|
|
1224
1224
|
a && (q(e, o, l, !1), Xe(e, e.line - s), o = l = e.position, a = !1), Q(g) || (l = e.position + 1), g = e.input.charCodeAt(++e.position);
|
|
1225
1225
|
}
|
|
1226
|
-
return q(e, o, l, !1), e.result ? !0 : (e.kind = f, e.result =
|
|
1226
|
+
return q(e, o, l, !1), e.result ? !0 : (e.kind = f, e.result = h, !1);
|
|
1227
1227
|
}
|
|
1228
1228
|
function at(e, n) {
|
|
1229
1229
|
var r, i, t;
|
|
@@ -1235,8 +1235,8 @@ function at(e, n) {
|
|
|
1235
1235
|
i = e.position, e.position++, t = e.position;
|
|
1236
1236
|
else
|
|
1237
1237
|
return !0;
|
|
1238
|
-
else H(r) ? (q(e, i, t, !0), Xe(e, F(e, !1, n)), i = t = e.position) : e.position === e.lineStart && Fe(e) ?
|
|
1239
|
-
|
|
1238
|
+
else H(r) ? (q(e, i, t, !0), Xe(e, F(e, !1, n)), i = t = e.position) : e.position === e.lineStart && Fe(e) ? v(e, "unexpected end of the document within a single quoted scalar") : (e.position++, t = e.position);
|
|
1239
|
+
v(e, "unexpected end of the stream within a single quoted scalar");
|
|
1240
1240
|
}
|
|
1241
1241
|
function st(e, n) {
|
|
1242
1242
|
var r, i, t, o, l, a;
|
|
@@ -1252,17 +1252,17 @@ function st(e, n) {
|
|
|
1252
1252
|
e.result += fr[a], e.position++;
|
|
1253
1253
|
else if ((l = rt(a)) > 0) {
|
|
1254
1254
|
for (t = l, o = 0; t > 0; t--)
|
|
1255
|
-
a = e.input.charCodeAt(++e.position), (l = nt(a)) >= 0 ? o = (o << 4) + l :
|
|
1255
|
+
a = e.input.charCodeAt(++e.position), (l = nt(a)) >= 0 ? o = (o << 4) + l : v(e, "expected hexadecimal character");
|
|
1256
1256
|
e.result += tt(o), e.position++;
|
|
1257
1257
|
} else
|
|
1258
|
-
|
|
1258
|
+
v(e, "unknown escape sequence");
|
|
1259
1259
|
r = i = e.position;
|
|
1260
|
-
} else H(a) ? (q(e, r, i, !0), Xe(e, F(e, !1, n)), r = i = e.position) : e.position === e.lineStart && Fe(e) ?
|
|
1260
|
+
} else H(a) ? (q(e, r, i, !0), Xe(e, F(e, !1, n)), r = i = e.position) : e.position === e.lineStart && Fe(e) ? v(e, "unexpected end of the document within a double quoted scalar") : (e.position++, i = e.position);
|
|
1261
1261
|
}
|
|
1262
|
-
|
|
1262
|
+
v(e, "unexpected end of the stream within a double quoted scalar");
|
|
1263
1263
|
}
|
|
1264
1264
|
function ct(e, n) {
|
|
1265
|
-
var r = !0, i, t, o, l = e.tag, a, s = e.anchor, c, u, f,
|
|
1265
|
+
var r = !0, i, t, o, l = e.tag, a, s = e.anchor, c, u, f, h, g, y = /* @__PURE__ */ Object.create(null), d, b, C, x;
|
|
1266
1266
|
if (x = e.input.charCodeAt(e.position), x === 91)
|
|
1267
1267
|
u = 93, g = !1, a = [];
|
|
1268
1268
|
else if (x === 123)
|
|
@@ -1272,9 +1272,9 @@ function ct(e, n) {
|
|
|
1272
1272
|
for (e.anchor !== null && (e.anchorMap[e.anchor] = a), x = e.input.charCodeAt(++e.position); x !== 0; ) {
|
|
1273
1273
|
if (F(e, !0, n), x = e.input.charCodeAt(e.position), x === u)
|
|
1274
1274
|
return e.position++, e.tag = l, e.anchor = s, e.kind = g ? "mapping" : "sequence", e.result = a, !0;
|
|
1275
|
-
r ? x === 44 &&
|
|
1275
|
+
r ? x === 44 && v(e, "expected the node content, but found ','") : v(e, "missed comma between flow collection entries"), b = d = C = null, f = h = !1, x === 63 && (c = e.input.charCodeAt(e.position + 1), U(c) && (f = h = !0, e.position++, F(e, !0, n))), i = e.line, t = e.lineStart, o = e.position, oe(e, n, Ce, !1, !0), b = e.tag, d = e.result, F(e, !0, n), x = e.input.charCodeAt(e.position), (h || e.line === i) && x === 58 && (f = !0, x = e.input.charCodeAt(++e.position), F(e, !0, n), oe(e, n, Ce, !1, !0), C = e.result), g ? te(e, a, y, b, d, C, i, t, o) : f ? a.push(te(e, null, y, b, d, C, i, t, o)) : a.push(d), F(e, !0, n), x = e.input.charCodeAt(e.position), x === 44 ? (r = !0, x = e.input.charCodeAt(++e.position)) : r = !1;
|
|
1276
1276
|
}
|
|
1277
|
-
|
|
1277
|
+
v(e, "unexpected end of the stream within a flow collection");
|
|
1278
1278
|
}
|
|
1279
1279
|
function ut(e, n) {
|
|
1280
1280
|
var r, i, t = Re, o = !1, l = !1, a = n, s = 0, c = !1, u, f;
|
|
@@ -1286,9 +1286,9 @@ function ut(e, n) {
|
|
|
1286
1286
|
return !1;
|
|
1287
1287
|
for (e.kind = "scalar", e.result = ""; f !== 0; )
|
|
1288
1288
|
if (f = e.input.charCodeAt(++e.position), f === 43 || f === 45)
|
|
1289
|
-
Re === t ? t = f === 43 ? dn : Qi :
|
|
1289
|
+
Re === t ? t = f === 43 ? dn : Qi : v(e, "repeat of a chomping mode identifier");
|
|
1290
1290
|
else if ((u = it(f)) >= 0)
|
|
1291
|
-
u === 0 ?
|
|
1291
|
+
u === 0 ? v(e, "bad explicit indentation width of a block scalar; it cannot be less than one") : l ? v(e, "repeat of an indentation width identifier") : (a = n + u - 1, l = !0);
|
|
1292
1292
|
else
|
|
1293
1293
|
break;
|
|
1294
1294
|
if (Q(f)) {
|
|
@@ -1326,24 +1326,24 @@ function ut(e, n) {
|
|
|
1326
1326
|
function vn(e, n) {
|
|
1327
1327
|
var r, i = e.tag, t = e.anchor, o = [], l, a = !1, s;
|
|
1328
1328
|
if (e.firstTabInLine !== -1) return !1;
|
|
1329
|
-
for (e.anchor !== null && (e.anchorMap[e.anchor] = o), s = e.input.charCodeAt(e.position); s !== 0 && (e.firstTabInLine !== -1 && (e.position = e.firstTabInLine,
|
|
1329
|
+
for (e.anchor !== null && (e.anchorMap[e.anchor] = o), s = e.input.charCodeAt(e.position); s !== 0 && (e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, v(e, "tab characters must not be used in indentation")), !(s !== 45 || (l = e.input.charCodeAt(e.position + 1), !U(l)))); ) {
|
|
1330
1330
|
if (a = !0, e.position++, F(e, !0, -1) && e.lineIndent <= n) {
|
|
1331
1331
|
o.push(null), s = e.input.charCodeAt(e.position);
|
|
1332
1332
|
continue;
|
|
1333
1333
|
}
|
|
1334
1334
|
if (r = e.line, oe(e, n, lr, !1, !0), o.push(e.result), F(e, !0, -1), s = e.input.charCodeAt(e.position), (e.line === r || e.lineIndent > n) && s !== 0)
|
|
1335
|
-
|
|
1335
|
+
v(e, "bad indentation of a sequence entry");
|
|
1336
1336
|
else if (e.lineIndent < n)
|
|
1337
1337
|
break;
|
|
1338
1338
|
}
|
|
1339
1339
|
return a ? (e.tag = i, e.anchor = t, e.kind = "sequence", e.result = o, !0) : !1;
|
|
1340
1340
|
}
|
|
1341
1341
|
function ft(e, n, r) {
|
|
1342
|
-
var i, t, o, l, a, s, c = e.tag, u = e.anchor, f = {},
|
|
1342
|
+
var i, t, o, l, a, s, c = e.tag, u = e.anchor, f = {}, h = /* @__PURE__ */ Object.create(null), g = null, y = null, d = null, b = !1, C = !1, x;
|
|
1343
1343
|
if (e.firstTabInLine !== -1) return !1;
|
|
1344
1344
|
for (e.anchor !== null && (e.anchorMap[e.anchor] = f), x = e.input.charCodeAt(e.position); x !== 0; ) {
|
|
1345
|
-
if (!
|
|
1346
|
-
x === 63 ? (
|
|
1345
|
+
if (!b && e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, v(e, "tab characters must not be used in indentation")), i = e.input.charCodeAt(e.position + 1), o = e.line, (x === 63 || x === 58) && U(i))
|
|
1346
|
+
x === 63 ? (b && (te(e, f, h, g, y, null, l, a, s), g = y = d = null), C = !0, b = !0, t = !0) : b ? (b = !1, t = !0) : v(e, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"), e.position += 1, x = i;
|
|
1347
1347
|
else {
|
|
1348
1348
|
if (l = e.line, a = e.lineStart, s = e.position, !oe(e, r, or, !1, !0))
|
|
1349
1349
|
break;
|
|
@@ -1351,81 +1351,81 @@ function ft(e, n, r) {
|
|
|
1351
1351
|
for (x = e.input.charCodeAt(e.position); Q(x); )
|
|
1352
1352
|
x = e.input.charCodeAt(++e.position);
|
|
1353
1353
|
if (x === 58)
|
|
1354
|
-
x = e.input.charCodeAt(++e.position), U(x) ||
|
|
1354
|
+
x = e.input.charCodeAt(++e.position), U(x) || v(e, "a whitespace character is expected after the key-value separator within a block mapping"), b && (te(e, f, h, g, y, null, l, a, s), g = y = d = null), C = !0, b = !1, t = !1, g = e.tag, y = e.result;
|
|
1355
1355
|
else if (C)
|
|
1356
|
-
|
|
1356
|
+
v(e, "can not read an implicit mapping pair; a colon is missed");
|
|
1357
1357
|
else
|
|
1358
1358
|
return e.tag = c, e.anchor = u, !0;
|
|
1359
1359
|
} else if (C)
|
|
1360
|
-
|
|
1360
|
+
v(e, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
1361
1361
|
else
|
|
1362
1362
|
return e.tag = c, e.anchor = u, !0;
|
|
1363
1363
|
}
|
|
1364
|
-
if ((e.line === o || e.lineIndent > n) && (
|
|
1365
|
-
|
|
1364
|
+
if ((e.line === o || e.lineIndent > n) && (b && (l = e.line, a = e.lineStart, s = e.position), oe(e, n, Se, !0, t) && (b ? y = e.result : d = e.result), b || (te(e, f, h, g, y, d, l, a, s), g = y = d = null), F(e, !0, -1), x = e.input.charCodeAt(e.position)), (e.line === o || e.lineIndent > n) && x !== 0)
|
|
1365
|
+
v(e, "bad indentation of a mapping entry");
|
|
1366
1366
|
else if (e.lineIndent < n)
|
|
1367
1367
|
break;
|
|
1368
1368
|
}
|
|
1369
|
-
return
|
|
1369
|
+
return b && te(e, f, h, g, y, null, l, a, s), C && (e.tag = c, e.anchor = u, e.kind = "mapping", e.result = f), C;
|
|
1370
1370
|
}
|
|
1371
1371
|
function pt(e) {
|
|
1372
1372
|
var n, r = !1, i = !1, t, o, l;
|
|
1373
1373
|
if (l = e.input.charCodeAt(e.position), l !== 33) return !1;
|
|
1374
|
-
if (e.tag !== null &&
|
|
1374
|
+
if (e.tag !== null && v(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) {
|
|
1375
1375
|
do
|
|
1376
1376
|
l = e.input.charCodeAt(++e.position);
|
|
1377
1377
|
while (l !== 0 && l !== 62);
|
|
1378
|
-
e.position < e.length ? (o = e.input.slice(n, e.position), l = e.input.charCodeAt(++e.position)) :
|
|
1378
|
+
e.position < e.length ? (o = e.input.slice(n, e.position), l = e.input.charCodeAt(++e.position)) : v(e, "unexpected end of the stream within a verbatim tag");
|
|
1379
1379
|
} else {
|
|
1380
1380
|
for (; l !== 0 && !U(l); )
|
|
1381
|
-
l === 33 && (i ?
|
|
1382
|
-
o = e.input.slice(n, e.position), et.test(o) &&
|
|
1381
|
+
l === 33 && (i ? v(e, "tag suffix cannot contain exclamation marks") : (t = e.input.slice(n - 1, e.position + 1), ar.test(t) || v(e, "named tag handle cannot contain such characters"), i = !0, n = e.position + 1)), l = e.input.charCodeAt(++e.position);
|
|
1382
|
+
o = e.input.slice(n, e.position), et.test(o) && v(e, "tag suffix cannot contain flow indicator characters");
|
|
1383
1383
|
}
|
|
1384
|
-
o && !sr.test(o) &&
|
|
1384
|
+
o && !sr.test(o) && v(e, "tag name cannot contain such characters: " + o);
|
|
1385
1385
|
try {
|
|
1386
1386
|
o = decodeURIComponent(o);
|
|
1387
1387
|
} catch {
|
|
1388
|
-
|
|
1388
|
+
v(e, "tag name is malformed: " + o);
|
|
1389
1389
|
}
|
|
1390
|
-
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 :
|
|
1390
|
+
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 : v(e, 'undeclared tag handle "' + t + '"'), !0;
|
|
1391
1391
|
}
|
|
1392
1392
|
function dt(e) {
|
|
1393
1393
|
var n, r;
|
|
1394
1394
|
if (r = e.input.charCodeAt(e.position), r !== 38) return !1;
|
|
1395
|
-
for (e.anchor !== null &&
|
|
1395
|
+
for (e.anchor !== null && v(e, "duplication of an anchor property"), r = e.input.charCodeAt(++e.position), n = e.position; r !== 0 && !U(r) && !ie(r); )
|
|
1396
1396
|
r = e.input.charCodeAt(++e.position);
|
|
1397
|
-
return e.position === n &&
|
|
1397
|
+
return e.position === n && v(e, "name of an anchor node must contain at least one character"), e.anchor = e.input.slice(n, e.position), !0;
|
|
1398
1398
|
}
|
|
1399
1399
|
function ht(e) {
|
|
1400
1400
|
var n, r, i;
|
|
1401
1401
|
if (i = e.input.charCodeAt(e.position), i !== 42) return !1;
|
|
1402
1402
|
for (i = e.input.charCodeAt(++e.position), n = e.position; i !== 0 && !U(i) && !ie(i); )
|
|
1403
1403
|
i = e.input.charCodeAt(++e.position);
|
|
1404
|
-
return e.position === n &&
|
|
1404
|
+
return e.position === n && v(e, "name of an alias node must contain at least one character"), r = e.input.slice(n, e.position), G.call(e.anchorMap, r) || v(e, 'unidentified alias "' + r + '"'), e.result = e.anchorMap[r], F(e, !0, -1), !0;
|
|
1405
1405
|
}
|
|
1406
1406
|
function oe(e, n, r, i, t) {
|
|
1407
|
-
var o, l, a, s = 1, c = !1, u = !1, f,
|
|
1408
|
-
if (e.listener !== null && e.listener("open", e), e.tag = null, e.anchor = null, e.kind = null, e.result = null, o = l = a =
|
|
1407
|
+
var o, l, a, s = 1, c = !1, u = !1, f, h, g, y, d, b;
|
|
1408
|
+
if (e.listener !== null && e.listener("open", e), e.tag = null, e.anchor = null, e.kind = null, e.result = null, o = l = a = Se === r || lr === 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)
|
|
1409
1409
|
for (; pt(e) || dt(e); )
|
|
1410
1410
|
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;
|
|
1411
|
-
if (a && (a = c || t), (s === 1 ||
|
|
1411
|
+
if (a && (a = c || t), (s === 1 || Se === r) && (Ce === r || or === r ? d = n : d = n + 1, b = e.position - e.lineStart, s === 1 ? a && (vn(e, b) || ft(e, b, d)) || ct(e, d) ? u = !0 : (l && ut(e, d) || at(e, d) || st(e, d) ? u = !0 : ht(e) ? (u = !0, (e.tag !== null || e.anchor !== null) && v(e, "alias node should not have any properties")) : lt(e, d, Ce === r) && (u = !0, e.tag === null && (e.tag = "?")), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : s === 0 && (u = a && vn(e, b))), e.tag === null)
|
|
1412
1412
|
e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
|
|
1413
1413
|
else if (e.tag === "?") {
|
|
1414
|
-
for (e.result !== null && e.kind !== "scalar" &&
|
|
1415
|
-
if (
|
|
1416
|
-
e.result =
|
|
1414
|
+
for (e.result !== null && e.kind !== "scalar" && v(e, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + e.kind + '"'), f = 0, h = e.implicitTypes.length; f < h; f += 1)
|
|
1415
|
+
if (y = e.implicitTypes[f], y.resolve(e.result)) {
|
|
1416
|
+
e.result = y.construct(e.result), e.tag = y.tag, e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
|
|
1417
1417
|
break;
|
|
1418
1418
|
}
|
|
1419
1419
|
} else if (e.tag !== "!") {
|
|
1420
1420
|
if (G.call(e.typeMap[e.kind || "fallback"], e.tag))
|
|
1421
|
-
|
|
1421
|
+
y = e.typeMap[e.kind || "fallback"][e.tag];
|
|
1422
1422
|
else
|
|
1423
|
-
for (
|
|
1423
|
+
for (y = null, g = e.typeMap.multi[e.kind || "fallback"], f = 0, h = g.length; f < h; f += 1)
|
|
1424
1424
|
if (e.tag.slice(0, g[f].tag.length) === g[f].tag) {
|
|
1425
|
-
|
|
1425
|
+
y = g[f];
|
|
1426
1426
|
break;
|
|
1427
1427
|
}
|
|
1428
|
-
|
|
1428
|
+
y || v(e, "unknown tag !<" + e.tag + ">"), e.result !== null && y.kind !== e.kind && v(e, "unacceptable node kind for !<" + e.tag + '> tag; it should be "' + y.kind + '", not "' + e.kind + '"'), y.resolve(e.result, e.tag) ? (e.result = y.construct(e.result, e.tag), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : v(e, "cannot resolve a node with !<" + e.tag + "> explicit tag");
|
|
1429
1429
|
}
|
|
1430
1430
|
return e.listener !== null && e.listener("close", e), e.tag !== null || e.anchor !== null || u;
|
|
1431
1431
|
}
|
|
@@ -1434,7 +1434,7 @@ function gt(e) {
|
|
|
1434
1434
|
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)); ) {
|
|
1435
1435
|
for (o = !0, l = e.input.charCodeAt(++e.position), r = e.position; l !== 0 && !U(l); )
|
|
1436
1436
|
l = e.input.charCodeAt(++e.position);
|
|
1437
|
-
for (i = e.input.slice(r, e.position), t = [], i.length < 1 &&
|
|
1437
|
+
for (i = e.input.slice(r, e.position), t = [], i.length < 1 && v(e, "directive name must not be less than one character in length"); l !== 0; ) {
|
|
1438
1438
|
for (; Q(l); )
|
|
1439
1439
|
l = e.input.charCodeAt(++e.position);
|
|
1440
1440
|
if (l === 35) {
|
|
@@ -1448,14 +1448,14 @@ function gt(e) {
|
|
|
1448
1448
|
l = e.input.charCodeAt(++e.position);
|
|
1449
1449
|
t.push(e.input.slice(r, e.position));
|
|
1450
1450
|
}
|
|
1451
|
-
l !== 0 && Ve(e), G.call(mn, i) ? mn[i](e, i, t) :
|
|
1451
|
+
l !== 0 && Ve(e), G.call(mn, i) ? mn[i](e, i, t) : ke(e, 'unknown document directive "' + i + '"');
|
|
1452
1452
|
}
|
|
1453
|
-
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 &&
|
|
1453
|
+
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 && v(e, "directives end mark is expected"), oe(e, e.lineIndent - 1, Se, !1, !0), F(e, !0, -1), e.checkLineBreaks && Zi.test(e.input.slice(n, e.position)) && ke(e, "non-ASCII line breaks are interpreted as content"), e.documents.push(e.result), e.position === e.lineStart && Fe(e)) {
|
|
1454
1454
|
e.input.charCodeAt(e.position) === 46 && (e.position += 3, F(e, !0, -1));
|
|
1455
1455
|
return;
|
|
1456
1456
|
}
|
|
1457
1457
|
if (e.position < e.length - 1)
|
|
1458
|
-
|
|
1458
|
+
v(e, "end of the stream or a document separator is expected");
|
|
1459
1459
|
else
|
|
1460
1460
|
return;
|
|
1461
1461
|
}
|
|
@@ -1463,7 +1463,7 @@ function dr(e, n) {
|
|
|
1463
1463
|
e = String(e), n = n || {}, e.length !== 0 && (e.charCodeAt(e.length - 1) !== 10 && e.charCodeAt(e.length - 1) !== 13 && (e += `
|
|
1464
1464
|
`), e.charCodeAt(0) === 65279 && (e = e.slice(1)));
|
|
1465
1465
|
var r = new ot(e, n), i = e.indexOf("\0");
|
|
1466
|
-
for (i !== -1 && (r.position = i,
|
|
1466
|
+
for (i !== -1 && (r.position = i, v(r, "null byte is not allowed in input")), r.input += "\0"; r.input.charCodeAt(r.position) === 32; )
|
|
1467
1467
|
r.lineIndent += 1, r.position += 1;
|
|
1468
1468
|
for (; r.position < r.length - 1; )
|
|
1469
1469
|
gt(r);
|
|
@@ -1482,13 +1482,13 @@ function yt(e, n) {
|
|
|
1482
1482
|
if (r.length !== 0) {
|
|
1483
1483
|
if (r.length === 1)
|
|
1484
1484
|
return r[0];
|
|
1485
|
-
throw new
|
|
1485
|
+
throw new P("expected a single document in the stream, but found more");
|
|
1486
1486
|
}
|
|
1487
1487
|
}
|
|
1488
1488
|
var vt = mt, xt = yt, hr = {
|
|
1489
1489
|
loadAll: vt,
|
|
1490
1490
|
load: xt
|
|
1491
|
-
}, gr = Object.prototype.toString, mr = Object.prototype.hasOwnProperty, Qe = 65279, wt = 9, pe = 10, bt = 13, At = 32, Ct = 33,
|
|
1491
|
+
}, gr = Object.prototype.toString, mr = Object.prototype.hasOwnProperty, Qe = 65279, wt = 9, pe = 10, bt = 13, At = 32, Ct = 33, St = 34, Be = 35, kt = 37, Et = 38, _t = 39, Ot = 42, yr = 44, Ft = 45, Ee = 58, Tt = 61, Lt = 62, jt = 63, It = 64, vr = 91, xr = 93, Nt = 96, wr = 123, Rt = 124, br = 125, N = {};
|
|
1492
1492
|
N[0] = "\\0";
|
|
1493
1493
|
N[7] = "\\a";
|
|
1494
1494
|
N[8] = "\\b";
|
|
@@ -1504,7 +1504,7 @@ N[133] = "\\N";
|
|
|
1504
1504
|
N[160] = "\\_";
|
|
1505
1505
|
N[8232] = "\\L";
|
|
1506
1506
|
N[8233] = "\\P";
|
|
1507
|
-
var
|
|
1507
|
+
var Mt = [
|
|
1508
1508
|
"y",
|
|
1509
1509
|
"Y",
|
|
1510
1510
|
"yes",
|
|
@@ -1521,7 +1521,7 @@ var Pt = [
|
|
|
1521
1521
|
"off",
|
|
1522
1522
|
"Off",
|
|
1523
1523
|
"OFF"
|
|
1524
|
-
],
|
|
1524
|
+
], Pt = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
1525
1525
|
function Dt(e, n) {
|
|
1526
1526
|
var r, i, t, o, l, a, s;
|
|
1527
1527
|
if (n === null) return {};
|
|
@@ -1538,12 +1538,12 @@ function $t(e) {
|
|
|
1538
1538
|
else if (e <= 4294967295)
|
|
1539
1539
|
r = "U", i = 8;
|
|
1540
1540
|
else
|
|
1541
|
-
throw new
|
|
1541
|
+
throw new P("code point within a string may not be greater than 0xFFFFFFFF");
|
|
1542
1542
|
return "\\" + r + T.repeat("0", i - n.length) + n;
|
|
1543
1543
|
}
|
|
1544
|
-
var
|
|
1545
|
-
function
|
|
1546
|
-
this.schema = e.schema || Ge, 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 = Dt(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 === '"' ? de :
|
|
1544
|
+
var zt = 1, de = 2;
|
|
1545
|
+
function Bt(e) {
|
|
1546
|
+
this.schema = e.schema || Ge, 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 = Dt(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 === '"' ? de : zt, 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;
|
|
1547
1547
|
}
|
|
1548
1548
|
function xn(e, n) {
|
|
1549
1549
|
for (var r = T.repeat(" ", n), i = 0, t = -1, o = "", l, a = e.length; i < a; )
|
|
@@ -1579,11 +1579,11 @@ function bn(e, n, r) {
|
|
|
1579
1579
|
(r ? (
|
|
1580
1580
|
// c = flow-in
|
|
1581
1581
|
i
|
|
1582
|
-
) : i && e !== yr && e !== vr && e !== xr && e !== wr && e !== br) && e !==
|
|
1582
|
+
) : i && e !== yr && e !== vr && e !== xr && e !== wr && e !== br) && e !== Be && !(n === Ee && !t) || wn(n) && !_e(n) && e === Be || n === Ee && t
|
|
1583
1583
|
);
|
|
1584
1584
|
}
|
|
1585
1585
|
function Yt(e) {
|
|
1586
|
-
return he(e) && e !== Qe && !_e(e) && e !== Ft && e !== jt && e !== Ee && e !== yr && e !== vr && e !== xr && e !== wr && e !== br && e !==
|
|
1586
|
+
return he(e) && e !== Qe && !_e(e) && e !== Ft && e !== jt && e !== Ee && e !== yr && e !== vr && e !== xr && e !== wr && e !== br && e !== Be && e !== Et && e !== Ot && e !== Ct && e !== Rt && e !== Tt && e !== Lt && e !== _t && e !== St && e !== kt && e !== It && e !== Nt;
|
|
1587
1587
|
}
|
|
1588
1588
|
function Ht(e) {
|
|
1589
1589
|
return !_e(e) && e !== Ee;
|
|
@@ -1596,33 +1596,33 @@ function Ar(e) {
|
|
|
1596
1596
|
var n = /^\n* /;
|
|
1597
1597
|
return n.test(e);
|
|
1598
1598
|
}
|
|
1599
|
-
var Cr = 1, Ye = 2,
|
|
1599
|
+
var Cr = 1, Ye = 2, Sr = 3, kr = 4, re = 5;
|
|
1600
1600
|
function Kt(e, n, r, i, t, o, l, a) {
|
|
1601
|
-
var s, c = 0, u = null, f = !1,
|
|
1601
|
+
var s, c = 0, u = null, f = !1, h = !1, g = i !== -1, y = -1, d = Yt(ue(e, 0)) && Ht(ue(e, e.length - 1));
|
|
1602
1602
|
if (n || l)
|
|
1603
1603
|
for (s = 0; s < e.length; c >= 65536 ? s += 2 : s++) {
|
|
1604
1604
|
if (c = ue(e, s), !he(c))
|
|
1605
1605
|
return re;
|
|
1606
|
-
|
|
1606
|
+
d = d && bn(c, u, a), u = c;
|
|
1607
1607
|
}
|
|
1608
1608
|
else {
|
|
1609
1609
|
for (s = 0; s < e.length; c >= 65536 ? s += 2 : s++) {
|
|
1610
1610
|
if (c = ue(e, s), c === pe)
|
|
1611
|
-
f = !0, g && (
|
|
1612
|
-
s -
|
|
1611
|
+
f = !0, g && (h = h || // Foldable line = too long, and not more-indented.
|
|
1612
|
+
s - y - 1 > i && e[y + 1] !== " ", y = s);
|
|
1613
1613
|
else if (!he(c))
|
|
1614
1614
|
return re;
|
|
1615
|
-
|
|
1615
|
+
d = d && bn(c, u, a), u = c;
|
|
1616
1616
|
}
|
|
1617
|
-
|
|
1617
|
+
h = h || g && s - y - 1 > i && e[y + 1] !== " ";
|
|
1618
1618
|
}
|
|
1619
|
-
return !f && !
|
|
1619
|
+
return !f && !h ? d && !l && !t(e) ? Cr : o === de ? re : Ye : r > 9 && Ar(e) ? re : l ? o === de ? re : Ye : h ? kr : Sr;
|
|
1620
1620
|
}
|
|
1621
1621
|
function Wt(e, n, r, i, t) {
|
|
1622
1622
|
e.dump = (function() {
|
|
1623
1623
|
if (n.length === 0)
|
|
1624
1624
|
return e.quotingType === de ? '""' : "''";
|
|
1625
|
-
if (!e.noCompatMode && (
|
|
1625
|
+
if (!e.noCompatMode && (Mt.indexOf(n) !== -1 || Pt.test(n)))
|
|
1626
1626
|
return e.quotingType === de ? '"' + n + '"' : "'" + n + "'";
|
|
1627
1627
|
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;
|
|
1628
1628
|
function s(c) {
|
|
@@ -1642,14 +1642,14 @@ function Wt(e, n, r, i, t) {
|
|
|
1642
1642
|
return n;
|
|
1643
1643
|
case Ye:
|
|
1644
1644
|
return "'" + n.replace(/'/g, "''") + "'";
|
|
1645
|
-
case kr:
|
|
1646
|
-
return "|" + An(n, e.indent) + Cn(xn(n, o));
|
|
1647
1645
|
case Sr:
|
|
1646
|
+
return "|" + An(n, e.indent) + Cn(xn(n, o));
|
|
1647
|
+
case kr:
|
|
1648
1648
|
return ">" + An(n, e.indent) + Cn(xn(qt(n, l), o));
|
|
1649
1649
|
case re:
|
|
1650
1650
|
return '"' + Gt(n) + '"';
|
|
1651
1651
|
default:
|
|
1652
|
-
throw new
|
|
1652
|
+
throw new P("impossible error: invalid scalar style");
|
|
1653
1653
|
}
|
|
1654
1654
|
})();
|
|
1655
1655
|
}
|
|
@@ -1669,16 +1669,16 @@ function qt(e, n) {
|
|
|
1669
1669
|
for (var r = /(\n+)([^\n]*)/g, i = (function() {
|
|
1670
1670
|
var c = e.indexOf(`
|
|
1671
1671
|
`);
|
|
1672
|
-
return c = c !== -1 ? c : e.length, r.lastIndex = c,
|
|
1672
|
+
return c = c !== -1 ? c : e.length, r.lastIndex = c, Sn(e.slice(0, c), n);
|
|
1673
1673
|
})(), t = e[0] === `
|
|
1674
1674
|
` || e[0] === " ", o, l; l = r.exec(e); ) {
|
|
1675
1675
|
var a = l[1], s = l[2];
|
|
1676
1676
|
o = s[0] === " ", i += a + (!t && !o && s !== "" ? `
|
|
1677
|
-
` : "") +
|
|
1677
|
+
` : "") + Sn(s, n), t = o;
|
|
1678
1678
|
}
|
|
1679
1679
|
return i;
|
|
1680
1680
|
}
|
|
1681
|
-
function
|
|
1681
|
+
function Sn(e, n) {
|
|
1682
1682
|
if (e === "" || e[0] === " ") return e;
|
|
1683
1683
|
for (var r = / [^ ]/g, i, t = 0, o, l = 0, a = 0, s = ""; i = r.exec(e); )
|
|
1684
1684
|
a = i.index, a - t > n && (o = l > t ? l : a, s += `
|
|
@@ -1698,7 +1698,7 @@ function Vt(e, n, r) {
|
|
|
1698
1698
|
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);
|
|
1699
1699
|
e.tag = t, e.dump = "[" + i + "]";
|
|
1700
1700
|
}
|
|
1701
|
-
function
|
|
1701
|
+
function kn(e, n, r, i) {
|
|
1702
1702
|
var t = "", o = e.tag, l, a, s;
|
|
1703
1703
|
for (l = 0, a = r.length; l < a; l += 1)
|
|
1704
1704
|
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 += Ue(e, n)), e.dump && pe === e.dump.charCodeAt(0) ? t += "-" : t += "- ", t += e.dump);
|
|
@@ -1711,15 +1711,15 @@ function Xt(e, n, r) {
|
|
|
1711
1711
|
e.tag = t, e.dump = "{" + i + "}";
|
|
1712
1712
|
}
|
|
1713
1713
|
function Qt(e, n, r, i) {
|
|
1714
|
-
var t = "", o = e.tag, l = Object.keys(r), a, s, c, u, f,
|
|
1714
|
+
var t = "", o = e.tag, l = Object.keys(r), a, s, c, u, f, h;
|
|
1715
1715
|
if (e.sortKeys === !0)
|
|
1716
1716
|
l.sort();
|
|
1717
1717
|
else if (typeof e.sortKeys == "function")
|
|
1718
1718
|
l.sort(e.sortKeys);
|
|
1719
1719
|
else if (e.sortKeys)
|
|
1720
|
-
throw new
|
|
1720
|
+
throw new P("sortKeys must be a boolean or a function");
|
|
1721
1721
|
for (a = 0, s = l.length; a < s; a += 1)
|
|
1722
|
-
|
|
1722
|
+
h = "", (!i || t !== "") && (h += Ue(e, n)), c = l[a], u = r[c], e.replacer && (u = e.replacer.call(r, c, u)), W(e, n + 1, c, !0, !0, !0) && (f = e.tag !== null && e.tag !== "?" || e.dump && e.dump.length > 1024, f && (e.dump && pe === e.dump.charCodeAt(0) ? h += "?" : h += "? "), h += e.dump, f && (h += Ue(e, n)), W(e, n + 1, u, !0, f) && (e.dump && pe === e.dump.charCodeAt(0) ? h += ":" : h += ": ", h += e.dump, t += h));
|
|
1723
1723
|
e.tag = o, e.dump = t || "{}";
|
|
1724
1724
|
}
|
|
1725
1725
|
function En(e, n, r) {
|
|
@@ -1732,7 +1732,7 @@ function En(e, n, r) {
|
|
|
1732
1732
|
else if (mr.call(a.represent, s))
|
|
1733
1733
|
i = a.represent[s](n, s);
|
|
1734
1734
|
else
|
|
1735
|
-
throw new
|
|
1735
|
+
throw new P("!<" + a.tag + '> tag resolver accepts not "' + s + '" style');
|
|
1736
1736
|
e.dump = i;
|
|
1737
1737
|
}
|
|
1738
1738
|
return !0;
|
|
@@ -1743,21 +1743,21 @@ function W(e, n, r, i, t, o, l) {
|
|
|
1743
1743
|
e.tag = null, e.dump = r, En(e, r, !1) || En(e, r, !0);
|
|
1744
1744
|
var a = gr.call(e.dump), s = i, c;
|
|
1745
1745
|
i && (i = e.flowLevel < 0 || e.flowLevel > n);
|
|
1746
|
-
var u = a === "[object Object]" || a === "[object Array]", f,
|
|
1747
|
-
if (u && (f = e.duplicates.indexOf(r),
|
|
1746
|
+
var u = a === "[object Object]" || a === "[object Array]", f, h;
|
|
1747
|
+
if (u && (f = e.duplicates.indexOf(r), h = f !== -1), (e.tag !== null && e.tag !== "?" || h || e.indent !== 2 && n > 0) && (t = !1), h && e.usedDuplicates[f])
|
|
1748
1748
|
e.dump = "*ref_" + f;
|
|
1749
1749
|
else {
|
|
1750
|
-
if (u &&
|
|
1751
|
-
i && Object.keys(e.dump).length !== 0 ? (Qt(e, n, e.dump, t),
|
|
1750
|
+
if (u && h && !e.usedDuplicates[f] && (e.usedDuplicates[f] = !0), a === "[object Object]")
|
|
1751
|
+
i && Object.keys(e.dump).length !== 0 ? (Qt(e, n, e.dump, t), h && (e.dump = "&ref_" + f + e.dump)) : (Xt(e, n, e.dump), h && (e.dump = "&ref_" + f + " " + e.dump));
|
|
1752
1752
|
else if (a === "[object Array]")
|
|
1753
|
-
i && e.dump.length !== 0 ? (e.noArrayIndent && !l && n > 0 ?
|
|
1753
|
+
i && e.dump.length !== 0 ? (e.noArrayIndent && !l && n > 0 ? kn(e, n - 1, e.dump, t) : kn(e, n, e.dump, t), h && (e.dump = "&ref_" + f + e.dump)) : (Vt(e, n, e.dump), h && (e.dump = "&ref_" + f + " " + e.dump));
|
|
1754
1754
|
else if (a === "[object String]")
|
|
1755
1755
|
e.tag !== "?" && Wt(e, e.dump, n, o, s);
|
|
1756
1756
|
else {
|
|
1757
1757
|
if (a === "[object Undefined]")
|
|
1758
1758
|
return !1;
|
|
1759
1759
|
if (e.skipInvalid) return !1;
|
|
1760
|
-
throw new
|
|
1760
|
+
throw new P("unacceptable kind of an object to dump " + a);
|
|
1761
1761
|
}
|
|
1762
1762
|
e.tag !== null && e.tag !== "?" && (c = encodeURI(
|
|
1763
1763
|
e.tag[0] === "!" ? e.tag.slice(1) : e.tag
|
|
@@ -1785,7 +1785,7 @@ function He(e, n, r) {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
function Zt(e, n) {
|
|
1787
1787
|
n = n || {};
|
|
1788
|
-
var r = new
|
|
1788
|
+
var r = new Bt(n);
|
|
1789
1789
|
r.noRefs || Jt(e, r);
|
|
1790
1790
|
var i = e;
|
|
1791
1791
|
return r.replacer && (i = r.replacer.call({ "": i }, "", i)), W(r, 0, i, !0, !0) ? r.dump + `
|
|
@@ -1799,7 +1799,7 @@ function Je(e, n) {
|
|
|
1799
1799
|
throw new Error("Function yaml." + e + " is removed in js-yaml 4. Use yaml." + n + " instead, which is now safe by default.");
|
|
1800
1800
|
};
|
|
1801
1801
|
}
|
|
1802
|
-
var ro = j, io =
|
|
1802
|
+
var ro = j, io = zn, to = Hn, oo = Vn, lo = Xn, ao = Ge, so = hr.load, co = hr.loadAll, uo = no.dump, fo = P, po = {
|
|
1803
1803
|
binary: nr,
|
|
1804
1804
|
float: Gn,
|
|
1805
1805
|
map: Yn,
|
|
@@ -1812,7 +1812,7 @@ var ro = j, io = Bn, to = Hn, oo = Vn, lo = Xn, ao = Ge, so = hr.load, co = hr.l
|
|
|
1812
1812
|
merge: er,
|
|
1813
1813
|
omap: rr,
|
|
1814
1814
|
seq: Un,
|
|
1815
|
-
str:
|
|
1815
|
+
str: Bn
|
|
1816
1816
|
}, ho = Je("safeLoad", "load"), go = Je("safeLoadAll", "loadAll"), mo = Je("safeDump", "dump"), _n = {
|
|
1817
1817
|
Type: ro,
|
|
1818
1818
|
Schema: io,
|
|
@@ -1978,7 +1978,7 @@ async function Co(e, n = Er, r = "auto") {
|
|
|
1978
1978
|
return i(t);
|
|
1979
1979
|
}
|
|
1980
1980
|
}
|
|
1981
|
-
async function
|
|
1981
|
+
async function So({
|
|
1982
1982
|
path: e,
|
|
1983
1983
|
key: n,
|
|
1984
1984
|
comment: r,
|
|
@@ -1994,18 +1994,22 @@ async function ko({
|
|
|
1994
1994
|
if (u?.kind === "multi") {
|
|
1995
1995
|
if (n || r || o !== void 0 || l)
|
|
1996
1996
|
throw new Error("When adding multiple strings via --strings payload, omit --key, --comment, --text, and --language.");
|
|
1997
|
-
const
|
|
1998
|
-
for (const [
|
|
1999
|
-
await On(e,
|
|
2000
|
-
return { kind: "multi", keys:
|
|
1997
|
+
const d = [];
|
|
1998
|
+
for (const [b, C] of Object.entries(u.entries))
|
|
1999
|
+
await On(e, b, C.comment, C.translations, s, void 0, void 0, f), d.push(b);
|
|
2000
|
+
return { kind: "multi", keys: d };
|
|
2001
2001
|
}
|
|
2002
|
-
const
|
|
2003
|
-
if (!
|
|
2002
|
+
const h = n;
|
|
2003
|
+
if (!h)
|
|
2004
2004
|
throw new Error("--key is required unless the --strings payload contains multiple keys.");
|
|
2005
|
-
const g = u?.kind === "single" ? u.translations : void 0,
|
|
2006
|
-
return await On(e,
|
|
2005
|
+
const g = u?.kind === "single" ? u.translations : void 0, y = u?.kind === "single" ? u.comment : void 0;
|
|
2006
|
+
return await On(e, h, r ?? y, g, s, o, l, f), { kind: "single", keys: [h] };
|
|
2007
2007
|
}
|
|
2008
|
-
|
|
2008
|
+
const ko = (e) => {
|
|
2009
|
+
const n = Object.entries(e).sort(([r], [i]) => r.localeCompare(i, "en", { sensitivity: "case" }));
|
|
2010
|
+
return Object.fromEntries(n);
|
|
2011
|
+
};
|
|
2012
|
+
function Eo() {
|
|
2009
2013
|
return {
|
|
2010
2014
|
command: "add",
|
|
2011
2015
|
describe: "Add a string",
|
|
@@ -2037,7 +2041,7 @@ function So() {
|
|
|
2037
2041
|
describe: "Format for the data provided with --strings"
|
|
2038
2042
|
}),
|
|
2039
2043
|
handler: async (e) => {
|
|
2040
|
-
const n = await
|
|
2044
|
+
const n = await So({
|
|
2041
2045
|
path: e.path,
|
|
2042
2046
|
key: e.key,
|
|
2043
2047
|
comment: e.comment,
|
|
@@ -2049,7 +2053,7 @@ function So() {
|
|
|
2049
2053
|
stdinReader: void 0,
|
|
2050
2054
|
configPath: e.config
|
|
2051
2055
|
});
|
|
2052
|
-
X.info(
|
|
2056
|
+
X.info(S.green(`✓ Added keys:
|
|
2053
2057
|
${n.keys.map((r) => `- ${r}`).join(`
|
|
2054
2058
|
`)}`));
|
|
2055
2059
|
}
|
|
@@ -2062,28 +2066,28 @@ async function On(e, n, r, i, t, o, l, a) {
|
|
|
2062
2066
|
const c = s.sourceLanguage;
|
|
2063
2067
|
s.strings || (s.strings = {});
|
|
2064
2068
|
const f = (await We(t))?.missingLanguagePolicy || "skip";
|
|
2065
|
-
let
|
|
2066
|
-
const g = async (_) => f === "include" ? !0 : (
|
|
2069
|
+
let h;
|
|
2070
|
+
const g = async (_) => f === "include" ? !0 : (h || (h = await Pn(e, t)), h.includes(_)), y = (_) => {
|
|
2067
2071
|
X.warn(`Language "${_}" is not supported. Skipped adding its translation (missingLanguagePolicy=skip).`);
|
|
2068
|
-
},
|
|
2072
|
+
}, d = {
|
|
2069
2073
|
...s.strings[n],
|
|
2070
2074
|
extractionState: "manual"
|
|
2071
2075
|
};
|
|
2072
|
-
r && (
|
|
2073
|
-
const
|
|
2076
|
+
r && (d.comment = r);
|
|
2077
|
+
const b = a ?? "translated", C = (_) => {
|
|
2074
2078
|
if (_ !== void 0)
|
|
2075
2079
|
return typeof _ == "string" ? { value: _ } : _;
|
|
2076
2080
|
};
|
|
2077
2081
|
if (o !== void 0) {
|
|
2078
2082
|
const _ = l ?? c;
|
|
2079
2083
|
if (!await g(_))
|
|
2080
|
-
|
|
2084
|
+
y(_);
|
|
2081
2085
|
else {
|
|
2082
|
-
|
|
2086
|
+
d.localizations = d.localizations || {};
|
|
2083
2087
|
const L = C(i?.[_]);
|
|
2084
|
-
|
|
2088
|
+
d.localizations[_] = {
|
|
2085
2089
|
stringUnit: {
|
|
2086
|
-
state: L?.state ??
|
|
2090
|
+
state: L?.state ?? b,
|
|
2087
2091
|
value: o
|
|
2088
2092
|
}
|
|
2089
2093
|
};
|
|
@@ -2099,22 +2103,22 @@ async function On(e, n, r, i, t, o, l, a) {
|
|
|
2099
2103
|
const I = C(R);
|
|
2100
2104
|
I && _.push([L, I]);
|
|
2101
2105
|
} else
|
|
2102
|
-
|
|
2106
|
+
y(L);
|
|
2103
2107
|
}
|
|
2104
2108
|
if (_.length > 0) {
|
|
2105
|
-
|
|
2109
|
+
d.localizations = d.localizations || {};
|
|
2106
2110
|
for (const [L, R] of _)
|
|
2107
|
-
|
|
2111
|
+
d.localizations[L] = {
|
|
2108
2112
|
stringUnit: {
|
|
2109
|
-
state: R.state ??
|
|
2113
|
+
state: R.state ?? b,
|
|
2110
2114
|
value: R.value
|
|
2111
2115
|
}
|
|
2112
2116
|
};
|
|
2113
2117
|
}
|
|
2114
2118
|
}
|
|
2115
|
-
s.strings[n] =
|
|
2119
|
+
s.strings[n] = d, d.localizations && (d.localizations = ko(d.localizations)), await Mn(e, s);
|
|
2116
2120
|
}
|
|
2117
|
-
function
|
|
2121
|
+
function _o() {
|
|
2118
2122
|
return {
|
|
2119
2123
|
command: "remove",
|
|
2120
2124
|
describe: "Remove a string",
|
|
@@ -2138,7 +2142,7 @@ function Eo() {
|
|
|
2138
2142
|
throw new Error("Either --key or --languages must be provided");
|
|
2139
2143
|
}),
|
|
2140
2144
|
handler: async (e) => {
|
|
2141
|
-
const n = await
|
|
2145
|
+
const n = await Fo(
|
|
2142
2146
|
e.path,
|
|
2143
2147
|
e.key,
|
|
2144
2148
|
e.languages,
|
|
@@ -2146,23 +2150,23 @@ function Eo() {
|
|
|
2146
2150
|
), r = Object.entries(n).map(([i, t]) => `- [${t.join(" ")}] ${i}`).join(`
|
|
2147
2151
|
`);
|
|
2148
2152
|
if (e.dryRun) {
|
|
2149
|
-
r.length === 0 ? X.info(
|
|
2153
|
+
r.length === 0 ? X.info(S.yellow("No matching strings found.")) : X.info(S.blue(`Would remove:
|
|
2150
2154
|
${r}`));
|
|
2151
2155
|
return;
|
|
2152
2156
|
}
|
|
2153
|
-
r.length === 0 ? X.info(
|
|
2157
|
+
r.length === 0 ? X.info(S.yellow("No matching strings found.")) : X.info(S.green(`✓ Removed
|
|
2154
2158
|
${r}`));
|
|
2155
2159
|
}
|
|
2156
2160
|
};
|
|
2157
2161
|
}
|
|
2158
|
-
function
|
|
2162
|
+
function Oo(e, n, r, i, t) {
|
|
2159
2163
|
if (e.localizations) {
|
|
2160
2164
|
for (const o of n)
|
|
2161
2165
|
e.localizations[o] && (t[i] ??= [], t[i].push(o), r || delete e.localizations[o]);
|
|
2162
2166
|
!r && e.localizations && Object.keys(e.localizations).length === 0 && delete e.localizations;
|
|
2163
2167
|
}
|
|
2164
2168
|
}
|
|
2165
|
-
async function
|
|
2169
|
+
async function Fo(e, n, r, i = !1) {
|
|
2166
2170
|
const t = await me(e), o = {}, l = t.strings || {};
|
|
2167
2171
|
t.strings = l;
|
|
2168
2172
|
const a = n ? [n] : Object.keys(l);
|
|
@@ -2176,23 +2180,23 @@ async function Oo(e, n, r, i = !1) {
|
|
|
2176
2180
|
o[c] = g, i || delete l[c], s = !0;
|
|
2177
2181
|
continue;
|
|
2178
2182
|
}
|
|
2179
|
-
|
|
2183
|
+
Oo(u, r, i, c, o);
|
|
2180
2184
|
const f = o[c]?.length ?? 0;
|
|
2181
2185
|
!(u.localizations && Object.keys(u.localizations).length > 0) && f > 0 && (i || delete l[c]), f > 0 && (s = !0);
|
|
2182
2186
|
}
|
|
2183
|
-
return !i && s && await
|
|
2187
|
+
return !i && s && await Mn(e, t), o;
|
|
2184
2188
|
}
|
|
2185
|
-
const
|
|
2186
|
-
function
|
|
2189
|
+
const Me = "xcstrings-cli.json5";
|
|
2190
|
+
function To() {
|
|
2187
2191
|
return {
|
|
2188
2192
|
command: "init",
|
|
2189
2193
|
describe: "Initialize configuration file",
|
|
2190
2194
|
handler: async () => {
|
|
2191
|
-
await
|
|
2195
|
+
await Io();
|
|
2192
2196
|
}
|
|
2193
2197
|
};
|
|
2194
2198
|
}
|
|
2195
|
-
async function
|
|
2199
|
+
async function Lo(e) {
|
|
2196
2200
|
const n = [];
|
|
2197
2201
|
async function r(i) {
|
|
2198
2202
|
try {
|
|
@@ -2206,7 +2210,7 @@ async function To(e) {
|
|
|
2206
2210
|
}
|
|
2207
2211
|
return await r(e), n;
|
|
2208
2212
|
}
|
|
2209
|
-
async function
|
|
2213
|
+
async function jo(e) {
|
|
2210
2214
|
const n = [];
|
|
2211
2215
|
let r = e;
|
|
2212
2216
|
try {
|
|
@@ -2217,47 +2221,47 @@ async function Lo(e) {
|
|
|
2217
2221
|
}
|
|
2218
2222
|
return n;
|
|
2219
2223
|
}
|
|
2220
|
-
async function
|
|
2224
|
+
async function Io() {
|
|
2221
2225
|
const e = process.cwd();
|
|
2222
|
-
console.log(), console.log(
|
|
2223
|
-
const n = await
|
|
2224
|
-
console.log(
|
|
2225
|
-
const r = await
|
|
2226
|
+
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..."));
|
|
2227
|
+
const n = await Lo(e);
|
|
2228
|
+
console.log(S.yellow("🔍 Searching for .xcodeproj directories..."));
|
|
2229
|
+
const r = await jo(e);
|
|
2226
2230
|
console.log();
|
|
2227
2231
|
let i = [];
|
|
2228
2232
|
if (n.length > 0) {
|
|
2229
|
-
console.log(
|
|
2233
|
+
console.log(S.green(`✓ Found ${n.length} .xcstrings file(s)`)), console.log();
|
|
2230
2234
|
const c = n.map((u) => ({
|
|
2231
|
-
name:
|
|
2235
|
+
name: S.white(we(e, u)) + S.dim(` (${u})`),
|
|
2232
2236
|
value: we(e, u),
|
|
2233
2237
|
checked: !0
|
|
2234
2238
|
}));
|
|
2235
2239
|
i = await an({
|
|
2236
|
-
message:
|
|
2240
|
+
message: S.bold("Select .xcstrings files to manage:"),
|
|
2237
2241
|
choices: c
|
|
2238
2242
|
});
|
|
2239
2243
|
} else
|
|
2240
|
-
console.log(
|
|
2244
|
+
console.log(S.dim(" No .xcstrings files found in current directory"));
|
|
2241
2245
|
console.log();
|
|
2242
2246
|
let t = [];
|
|
2243
2247
|
if (r.length > 0) {
|
|
2244
|
-
console.log(
|
|
2248
|
+
console.log(S.green(`✓ Found ${r.length} .xcodeproj director${r.length === 1 ? "y" : "ies"}`)), console.log();
|
|
2245
2249
|
const c = r.map((u) => ({
|
|
2246
|
-
name:
|
|
2250
|
+
name: S.white(we(e, u) || u) + S.dim(` (${u})`),
|
|
2247
2251
|
value: we(e, u) || u,
|
|
2248
2252
|
checked: !0
|
|
2249
2253
|
}));
|
|
2250
2254
|
t = await an({
|
|
2251
|
-
message:
|
|
2255
|
+
message: S.bold("Select .xcodeproj directories for language detection:"),
|
|
2252
2256
|
choices: c
|
|
2253
2257
|
});
|
|
2254
2258
|
} else
|
|
2255
|
-
console.log(
|
|
2256
|
-
if (console.log(), console.log(
|
|
2257
|
-
message:
|
|
2259
|
+
console.log(S.dim(" No .xcodeproj directories found"));
|
|
2260
|
+
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((c) => console.log(S.white(` • ${c}`))) : console.log(S.dim(" (none)")), console.log(), console.log(S.cyan(" xcodeprojPaths:")), t.length > 0 ? t.forEach((c) => console.log(S.white(` • ${c}`))) : console.log(S.dim(" (none)")), console.log(), !await Dr({
|
|
2261
|
+
message: S.bold(`Create ${S.yellow(Me)}?`),
|
|
2258
2262
|
default: !0
|
|
2259
2263
|
})) {
|
|
2260
|
-
console.log(
|
|
2264
|
+
console.log(S.dim(" Configuration cancelled."));
|
|
2261
2265
|
return;
|
|
2262
2266
|
}
|
|
2263
2267
|
const l = i.map((c) => ` "${c}"`).join(`,
|
|
@@ -2275,33 +2279,33 @@ ${a}
|
|
|
2275
2279
|
missingLanguagePolicy: "skip",
|
|
2276
2280
|
}
|
|
2277
2281
|
`;
|
|
2278
|
-
await Nn(
|
|
2282
|
+
await Nn(Me, s, "utf-8"), console.log(), console.log(S.bold.green(`✓ Created ${Me}`)), console.log(S.dim(` Run ${S.cyan("xcstrings --help")} to see available commands.`)), console.log();
|
|
2279
2283
|
}
|
|
2280
|
-
var
|
|
2281
|
-
return
|
|
2284
|
+
var No = Object.prototype.toString, ae = Array.isArray || function(n) {
|
|
2285
|
+
return No.call(n) === "[object Array]";
|
|
2282
2286
|
};
|
|
2283
2287
|
function Ze(e) {
|
|
2284
2288
|
return typeof e == "function";
|
|
2285
2289
|
}
|
|
2286
|
-
function
|
|
2290
|
+
function Ro(e) {
|
|
2287
2291
|
return ae(e) ? "array" : typeof e;
|
|
2288
2292
|
}
|
|
2289
|
-
function
|
|
2293
|
+
function Pe(e) {
|
|
2290
2294
|
return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
2291
2295
|
}
|
|
2292
2296
|
function Fn(e, n) {
|
|
2293
2297
|
return e != null && typeof e == "object" && n in e;
|
|
2294
2298
|
}
|
|
2295
|
-
function
|
|
2299
|
+
function Mo(e, n) {
|
|
2296
2300
|
return e != null && typeof e != "object" && e.hasOwnProperty && e.hasOwnProperty(n);
|
|
2297
2301
|
}
|
|
2298
2302
|
var Po = RegExp.prototype.test;
|
|
2299
|
-
function
|
|
2303
|
+
function Do(e, n) {
|
|
2300
2304
|
return Po.call(e, n);
|
|
2301
2305
|
}
|
|
2302
|
-
var
|
|
2303
|
-
function
|
|
2304
|
-
return !
|
|
2306
|
+
var $o = /\S/;
|
|
2307
|
+
function zo(e) {
|
|
2308
|
+
return !Do($o, e);
|
|
2305
2309
|
}
|
|
2306
2310
|
var Bo = {
|
|
2307
2311
|
"&": "&",
|
|
@@ -2313,13 +2317,13 @@ var Bo = {
|
|
|
2313
2317
|
"`": "`",
|
|
2314
2318
|
"=": "="
|
|
2315
2319
|
};
|
|
2316
|
-
function
|
|
2320
|
+
function Uo(e) {
|
|
2317
2321
|
return String(e).replace(/[&<>"'`=\/]/g, function(r) {
|
|
2318
2322
|
return Bo[r];
|
|
2319
2323
|
});
|
|
2320
2324
|
}
|
|
2321
|
-
var
|
|
2322
|
-
function
|
|
2325
|
+
var Yo = /\s*/, Ho = /\s+/, Tn = /\s*=/, Ko = /\s*\}/, Wo = /#|\^|\/|>|\{|&|=|!/;
|
|
2326
|
+
function qo(e, n) {
|
|
2323
2327
|
if (!e)
|
|
2324
2328
|
return [];
|
|
2325
2329
|
var r = !1, i = [], t = [], o = [], l = !1, a = !1, s = "", c = 0;
|
|
@@ -2331,41 +2335,41 @@ function Wo(e, n) {
|
|
|
2331
2335
|
o = [];
|
|
2332
2336
|
l = !1, a = !1;
|
|
2333
2337
|
}
|
|
2334
|
-
var f,
|
|
2335
|
-
function
|
|
2336
|
-
if (typeof I == "string" && (I = I.split(
|
|
2338
|
+
var f, h, g;
|
|
2339
|
+
function y(I) {
|
|
2340
|
+
if (typeof I == "string" && (I = I.split(Ho, 2)), !ae(I) || I.length !== 2)
|
|
2337
2341
|
throw new Error("Invalid tags: " + I);
|
|
2338
|
-
f = new RegExp(
|
|
2342
|
+
f = new RegExp(Pe(I[0]) + "\\s*"), h = new RegExp("\\s*" + Pe(I[1])), g = new RegExp("\\s*" + Pe("}" + I[1]));
|
|
2339
2343
|
}
|
|
2340
|
-
|
|
2341
|
-
for (var
|
|
2342
|
-
if (
|
|
2344
|
+
y(n || D.tags);
|
|
2345
|
+
for (var d = new ye(e), b, C, x, _, L, R; !d.eos(); ) {
|
|
2346
|
+
if (b = d.pos, x = d.scanUntil(f), x)
|
|
2343
2347
|
for (var J = 0, V = x.length; J < V; ++J)
|
|
2344
|
-
_ = x.charAt(J),
|
|
2348
|
+
_ = x.charAt(J), zo(_) ? (o.push(t.length), s += _) : (a = !0, r = !0, s += " "), t.push(["text", _, b, b + 1]), b += 1, _ === `
|
|
2345
2349
|
` && (u(), s = "", c = 0, r = !1);
|
|
2346
|
-
if (!
|
|
2350
|
+
if (!d.scan(f))
|
|
2347
2351
|
break;
|
|
2348
|
-
if (l = !0, C =
|
|
2349
|
-
throw new Error("Unclosed tag at " +
|
|
2350
|
-
if (C == ">" ? L = [C, x,
|
|
2352
|
+
if (l = !0, C = d.scan(Wo) || "name", d.scan(Yo), C === "=" ? (x = d.scanUntil(Tn), d.scan(Tn), d.scanUntil(h)) : C === "{" ? (x = d.scanUntil(g), d.scan(Ko), d.scanUntil(h), C = "&") : x = d.scanUntil(h), !d.scan(h))
|
|
2353
|
+
throw new Error("Unclosed tag at " + d.pos);
|
|
2354
|
+
if (C == ">" ? L = [C, x, b, d.pos, s, c, r] : L = [C, x, b, d.pos], c++, t.push(L), C === "#" || C === "^")
|
|
2351
2355
|
i.push(L);
|
|
2352
2356
|
else if (C === "/") {
|
|
2353
2357
|
if (R = i.pop(), !R)
|
|
2354
|
-
throw new Error('Unopened section "' + x + '" at ' +
|
|
2358
|
+
throw new Error('Unopened section "' + x + '" at ' + b);
|
|
2355
2359
|
if (R[1] !== x)
|
|
2356
|
-
throw new Error('Unclosed section "' + R[1] + '" at ' +
|
|
2357
|
-
} else C === "name" || C === "{" || C === "&" ? a = !0 : C === "=" &&
|
|
2360
|
+
throw new Error('Unclosed section "' + R[1] + '" at ' + b);
|
|
2361
|
+
} else C === "name" || C === "{" || C === "&" ? a = !0 : C === "=" && y(x);
|
|
2358
2362
|
}
|
|
2359
2363
|
if (u(), R = i.pop(), R)
|
|
2360
|
-
throw new Error('Unclosed section "' + R[1] + '" at ' +
|
|
2361
|
-
return Go(
|
|
2364
|
+
throw new Error('Unclosed section "' + R[1] + '" at ' + d.pos);
|
|
2365
|
+
return Vo(Go(t));
|
|
2362
2366
|
}
|
|
2363
|
-
function
|
|
2367
|
+
function Go(e) {
|
|
2364
2368
|
for (var n = [], r, i, t = 0, o = e.length; t < o; ++t)
|
|
2365
2369
|
r = e[t], r && (r[0] === "text" && i && i[0] === "text" ? (i[1] += r[1], i[3] = r[3]) : (n.push(r), i = r));
|
|
2366
2370
|
return n;
|
|
2367
2371
|
}
|
|
2368
|
-
function
|
|
2372
|
+
function Vo(e) {
|
|
2369
2373
|
for (var n = [], r = n, i = [], t, o, l = 0, a = e.length; l < a; ++l)
|
|
2370
2374
|
switch (t = e[l], t[0]) {
|
|
2371
2375
|
case "#":
|
|
@@ -2421,7 +2425,7 @@ le.prototype.lookup = function(n) {
|
|
|
2421
2425
|
for (var t = this, o, l, a, s = !1; t; ) {
|
|
2422
2426
|
if (n.indexOf(".") > 0)
|
|
2423
2427
|
for (o = t.view, l = n.split("."), a = 0; o != null && a < l.length; )
|
|
2424
|
-
a === l.length - 1 && (s = Fn(o, l[a]) ||
|
|
2428
|
+
a === l.length - 1 && (s = Fn(o, l[a]) || Mo(o, l[a])), o = o[l[a++]];
|
|
2425
2429
|
else
|
|
2426
2430
|
o = t.view[n], s = Fn(t.view, n);
|
|
2427
2431
|
if (s) {
|
|
@@ -2453,7 +2457,7 @@ $.prototype.clearCache = function() {
|
|
|
2453
2457
|
};
|
|
2454
2458
|
$.prototype.parse = function(n, r) {
|
|
2455
2459
|
var i = this.templateCache, t = n + ":" + (r || D.tags).join(":"), o = typeof i < "u", l = o ? i.get(t) : void 0;
|
|
2456
|
-
return l == null && (l =
|
|
2460
|
+
return l == null && (l = qo(n, r), o && i.set(t, l)), l;
|
|
2457
2461
|
};
|
|
2458
2462
|
$.prototype.render = function(n, r, i, t) {
|
|
2459
2463
|
var o = this.getConfigTags(t), l = this.parse(n, o), a = r instanceof le ? r : new le(r, void 0);
|
|
@@ -2466,8 +2470,8 @@ $.prototype.renderTokens = function(n, r, i, t, o) {
|
|
|
2466
2470
|
};
|
|
2467
2471
|
$.prototype.renderSection = function(n, r, i, t, o) {
|
|
2468
2472
|
var l = this, a = "", s = r.lookup(n[1]);
|
|
2469
|
-
function c(
|
|
2470
|
-
return l.render(
|
|
2473
|
+
function c(h) {
|
|
2474
|
+
return l.render(h, r, i, o);
|
|
2471
2475
|
}
|
|
2472
2476
|
if (s) {
|
|
2473
2477
|
if (ae(s))
|
|
@@ -2561,10 +2565,10 @@ D.parse = function(n, r) {
|
|
|
2561
2565
|
};
|
|
2562
2566
|
D.render = function(n, r, i, t) {
|
|
2563
2567
|
if (typeof n != "string")
|
|
2564
|
-
throw new TypeError('Invalid template! Template should be a "string" but "' +
|
|
2568
|
+
throw new TypeError('Invalid template! Template should be a "string" but "' + Ro(n) + '" was given as the first argument for mustache#render(template, view, partials)');
|
|
2565
2569
|
return ge.render(n, r, i, t);
|
|
2566
2570
|
};
|
|
2567
|
-
D.escape =
|
|
2571
|
+
D.escape = Uo;
|
|
2568
2572
|
D.Scanner = ye;
|
|
2569
2573
|
D.Context = le;
|
|
2570
2574
|
D.Writer = $;
|
|
@@ -2580,7 +2584,7 @@ function Ln(e, {
|
|
|
2580
2584
|
return r !== void 0 ? { pattern: r, mode: "regex" } : i !== void 0 ? { pattern: i, mode: "substring" } : { pattern: n, mode: "glob" };
|
|
2581
2585
|
}
|
|
2582
2586
|
}
|
|
2583
|
-
function
|
|
2587
|
+
function Xo() {
|
|
2584
2588
|
return {
|
|
2585
2589
|
command: "strings",
|
|
2586
2590
|
describe: "List strings in the xcstrings file",
|
|
@@ -2613,6 +2617,10 @@ function Vo() {
|
|
|
2613
2617
|
array: !0,
|
|
2614
2618
|
alias: "l",
|
|
2615
2619
|
describe: "Include only these languages"
|
|
2620
|
+
}).option("missing-languages", {
|
|
2621
|
+
type: "string",
|
|
2622
|
+
array: !0,
|
|
2623
|
+
describe: "Include only keys missing any of these languages"
|
|
2616
2624
|
}).option("format", {
|
|
2617
2625
|
type: "string",
|
|
2618
2626
|
describe: "Mustache template. Available variables: {{language}}, {{key}}, {{text}}"
|
|
@@ -2634,9 +2642,10 @@ function Vo() {
|
|
|
2634
2642
|
glob: r[0],
|
|
2635
2643
|
regex: e["text-regex"],
|
|
2636
2644
|
substring: e["text-substring"]
|
|
2637
|
-
}), o = await
|
|
2645
|
+
}), o = await Zo({
|
|
2638
2646
|
path: e.path,
|
|
2639
2647
|
languages: e.languages,
|
|
2648
|
+
missingLanguages: e["missing-languages"],
|
|
2640
2649
|
keyFilter: i,
|
|
2641
2650
|
textFilter: t,
|
|
2642
2651
|
format: e.format
|
|
@@ -2645,7 +2654,7 @@ function Vo() {
|
|
|
2645
2654
|
}
|
|
2646
2655
|
};
|
|
2647
2656
|
}
|
|
2648
|
-
function
|
|
2657
|
+
function Qo(e) {
|
|
2649
2658
|
const n = e.replace(/[.+^${}()|\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
|
|
2650
2659
|
return new RegExp(`^${n}$`);
|
|
2651
2660
|
}
|
|
@@ -2659,10 +2668,10 @@ function jn(e) {
|
|
|
2659
2668
|
const r = e.pattern;
|
|
2660
2669
|
return (i) => i.includes(r);
|
|
2661
2670
|
}
|
|
2662
|
-
const n =
|
|
2671
|
+
const n = Qo(e.pattern);
|
|
2663
2672
|
return (r) => n.test(r);
|
|
2664
2673
|
}
|
|
2665
|
-
function
|
|
2674
|
+
function Jo(e, n) {
|
|
2666
2675
|
const r = D.escape;
|
|
2667
2676
|
D.escape = (i) => i;
|
|
2668
2677
|
try {
|
|
@@ -2671,19 +2680,19 @@ function Qo(e, n) {
|
|
|
2671
2680
|
D.escape = r;
|
|
2672
2681
|
}
|
|
2673
2682
|
}
|
|
2674
|
-
async function
|
|
2675
|
-
const r = (await me(e.path)).strings ?? {}, i = jn(e.keyFilter), t = jn(e.textFilter), o = e.languages ? new Set(e.languages) : null, l = !!e.format,
|
|
2676
|
-
for (const
|
|
2677
|
-
if (!i(
|
|
2678
|
-
const
|
|
2679
|
-
for (const
|
|
2680
|
-
if (o && !o.has(
|
|
2681
|
-
const
|
|
2682
|
-
t(
|
|
2683
|
+
async function Zo(e) {
|
|
2684
|
+
const r = (await me(e.path)).strings ?? {}, i = jn(e.keyFilter), t = jn(e.textFilter), o = e.languages ? new Set(e.languages) : null, l = e.missingLanguages ? new Set(e.missingLanguages) : null, a = !!e.format, s = [];
|
|
2685
|
+
for (const c of Object.keys(r)) {
|
|
2686
|
+
if (!i(c)) continue;
|
|
2687
|
+
const f = r[c]?.localizations ?? {}, h = Object.keys(f), g = l ? Array.from(l).some((d) => !(d in f)) : !0, y = [];
|
|
2688
|
+
for (const d of h) {
|
|
2689
|
+
if (o && !o.has(d)) continue;
|
|
2690
|
+
const b = f[d]?.stringUnit?.value ?? "";
|
|
2691
|
+
t(b) && (a && e.format ? y.push(Jo(e.format, { language: d, key: c, text: b })) : y.push(` ${d}: ${JSON.stringify(b)}`));
|
|
2683
2692
|
}
|
|
2684
|
-
|
|
2693
|
+
y.length !== 0 && g && (a ? s.push(...y) : s.push(`${c}:`, ...y));
|
|
2685
2694
|
}
|
|
2686
|
-
return
|
|
2695
|
+
return s.join(`
|
|
2687
2696
|
`);
|
|
2688
2697
|
}
|
|
2689
2698
|
const In = Oe(process.cwd(), "Localizable.xcstrings");
|
|
@@ -2696,14 +2705,14 @@ Nr(Rr(process.argv)).scriptName("xcstrings").usage("$0 <cmd> [args]").option("co
|
|
|
2696
2705
|
default: In
|
|
2697
2706
|
}).middleware(async (e) => {
|
|
2698
2707
|
const n = await We(e.config);
|
|
2699
|
-
e.path = await
|
|
2708
|
+
e.path = await Br(e.path, n, In);
|
|
2700
2709
|
}).command([
|
|
2701
|
-
So(),
|
|
2702
2710
|
Eo(),
|
|
2703
|
-
|
|
2711
|
+
_o(),
|
|
2712
|
+
To(),
|
|
2704
2713
|
Gr(),
|
|
2705
|
-
|
|
2714
|
+
Xo()
|
|
2706
2715
|
]).demandCommand(1, "").strictCommands().recommendCommands().showHelpOnFail(!0).fail((e, n, r) => {
|
|
2707
2716
|
const i = e || n?.message;
|
|
2708
|
-
i && (console.error(
|
|
2717
|
+
i && (console.error(S.red(i)), console.log(), r.showHelp(), process.exit(1)), n && (console.error(n), process.exit(1)), r.showHelp(), process.exit(1);
|
|
2709
2718
|
}).help().argv;
|