xcstrings-cli 1.3.0 → 1.4.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/dist/index.js +124 -124
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13,20 +13,20 @@ async function U(t) {
|
|
|
13
13
|
return JSON.parse(o);
|
|
14
14
|
}
|
|
15
15
|
async function le(t, o) {
|
|
16
|
-
const n = JSON.stringify(o, null, 2),
|
|
17
|
-
await ae(t,
|
|
16
|
+
const n = JSON.stringify(o, null, 2), s = Le(n);
|
|
17
|
+
await ae(t, s + `
|
|
18
18
|
`, "utf-8");
|
|
19
19
|
}
|
|
20
20
|
function Le(t) {
|
|
21
|
-
let o = "", n = !1,
|
|
21
|
+
let o = "", n = !1, s = !1;
|
|
22
22
|
for (let a = 0; a < t.length; a++) {
|
|
23
23
|
const l = t[a];
|
|
24
|
-
if (n && l === "\\" && !
|
|
25
|
-
|
|
24
|
+
if (n && l === "\\" && !s) {
|
|
25
|
+
s = !0, o += l;
|
|
26
26
|
continue;
|
|
27
27
|
}
|
|
28
|
-
if (
|
|
29
|
-
|
|
28
|
+
if (s) {
|
|
29
|
+
s = !1, o += l;
|
|
30
30
|
continue;
|
|
31
31
|
}
|
|
32
32
|
if (l === '"') {
|
|
@@ -65,8 +65,8 @@ function _e(t) {
|
|
|
65
65
|
}
|
|
66
66
|
async function Pe(t) {
|
|
67
67
|
const o = await U(t), n = /* @__PURE__ */ new Set();
|
|
68
|
-
for (const
|
|
69
|
-
const a = o.strings[
|
|
68
|
+
for (const s of Object.keys(o.strings)) {
|
|
69
|
+
const a = o.strings[s];
|
|
70
70
|
if (a.localizations)
|
|
71
71
|
for (const l of Object.keys(a.localizations))
|
|
72
72
|
n.add(l);
|
|
@@ -76,23 +76,23 @@ async function Pe(t) {
|
|
|
76
76
|
async function fe(t, o) {
|
|
77
77
|
const n = await H(o);
|
|
78
78
|
if (n?.xcodeprojPaths && n.xcodeprojPaths.length > 0) {
|
|
79
|
-
const
|
|
79
|
+
const s = /* @__PURE__ */ new Set();
|
|
80
80
|
for (const a of n.xcodeprojPaths)
|
|
81
|
-
_e(a).forEach((b) =>
|
|
82
|
-
return Array.from(
|
|
81
|
+
_e(a).forEach((b) => s.add(b));
|
|
82
|
+
return Array.from(s).sort();
|
|
83
83
|
}
|
|
84
84
|
return await Pe(t);
|
|
85
85
|
}
|
|
86
|
-
async function Fe(t, o, n,
|
|
86
|
+
async function Fe(t, o, n, s, a) {
|
|
87
87
|
const l = await U(t);
|
|
88
88
|
l.strings || (l.strings = {});
|
|
89
89
|
const b = {
|
|
90
90
|
...l.strings[o],
|
|
91
91
|
extractionState: "manual"
|
|
92
92
|
};
|
|
93
|
-
if (n && (b.comment = n),
|
|
93
|
+
if (n && (b.comment = n), s) {
|
|
94
94
|
const z = (await H(a))?.missingLanguagePolicy || "skip", h = await fe(t, a), f = [];
|
|
95
|
-
for (const [y, w] of Object.entries(
|
|
95
|
+
for (const [y, w] of Object.entries(s))
|
|
96
96
|
(h.includes(y) || z === "include") && f.push([y, w]);
|
|
97
97
|
if (f.length > 0) {
|
|
98
98
|
b.localizations = b.localizations || {};
|
|
@@ -107,14 +107,14 @@ async function Fe(t, o, n, r, a) {
|
|
|
107
107
|
}
|
|
108
108
|
l.strings[o] = b, await le(t, l);
|
|
109
109
|
}
|
|
110
|
-
function Ce(t, o, n,
|
|
110
|
+
function Ce(t, o, n, s, a) {
|
|
111
111
|
if (t.localizations) {
|
|
112
112
|
for (const l of o)
|
|
113
|
-
t.localizations[l] && (a[
|
|
113
|
+
t.localizations[l] && (a[s] ??= [], a[s].push(l), n || delete t.localizations[l]);
|
|
114
114
|
!n && t.localizations && Object.keys(t.localizations).length === 0 && delete t.localizations;
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
async function Te(t, o, n,
|
|
117
|
+
async function Te(t, o, n, s = !1) {
|
|
118
118
|
const a = await U(t), l = {}, b = a.strings || {};
|
|
119
119
|
a.strings = b;
|
|
120
120
|
const S = o ? [o] : Object.keys(b);
|
|
@@ -125,23 +125,23 @@ async function Te(t, o, n, r = !1) {
|
|
|
125
125
|
continue;
|
|
126
126
|
if (!n || n.length === 0) {
|
|
127
127
|
const p = Object.keys(f.localizations ?? {});
|
|
128
|
-
l[h] = p,
|
|
128
|
+
l[h] = p, s || delete b[h], z = !0;
|
|
129
129
|
continue;
|
|
130
130
|
}
|
|
131
|
-
Ce(f, n,
|
|
131
|
+
Ce(f, n, s, h, l);
|
|
132
132
|
const y = l[h]?.length ?? 0;
|
|
133
|
-
!(f.localizations && Object.keys(f.localizations).length > 0) && y > 0 && (
|
|
133
|
+
!(f.localizations && Object.keys(f.localizations).length > 0) && y > 0 && (s || delete b[h]), y > 0 && (z = !0);
|
|
134
134
|
}
|
|
135
|
-
return !
|
|
135
|
+
return !s && z && await le(t, a), l;
|
|
136
136
|
}
|
|
137
137
|
const B = "xcstrings-cli.json5";
|
|
138
138
|
async function $e(t) {
|
|
139
139
|
const o = [];
|
|
140
|
-
async function n(
|
|
140
|
+
async function n(s) {
|
|
141
141
|
try {
|
|
142
|
-
const a = await ce(
|
|
142
|
+
const a = await ce(s, { withFileTypes: !0 });
|
|
143
143
|
for (const l of a) {
|
|
144
|
-
const b = q(
|
|
144
|
+
const b = q(s, l.name);
|
|
145
145
|
l.isDirectory() ? !l.name.startsWith(".") && l.name !== "node_modules" && await n(b) : l.name.endsWith(".xcstrings") && o.push(b);
|
|
146
146
|
}
|
|
147
147
|
} catch {
|
|
@@ -149,33 +149,33 @@ async function $e(t) {
|
|
|
149
149
|
}
|
|
150
150
|
return await n(t), o;
|
|
151
151
|
}
|
|
152
|
-
async function
|
|
152
|
+
async function Ne(t) {
|
|
153
153
|
const o = [];
|
|
154
154
|
let n = t;
|
|
155
155
|
try {
|
|
156
|
-
const
|
|
157
|
-
for (const a of
|
|
156
|
+
const s = await ce(n, { withFileTypes: !0 });
|
|
157
|
+
for (const a of s)
|
|
158
158
|
a.isDirectory() && a.name.endsWith(".xcodeproj") && o.push(q(n, a.name));
|
|
159
159
|
} catch {
|
|
160
160
|
}
|
|
161
161
|
return o;
|
|
162
162
|
}
|
|
163
|
-
async function
|
|
163
|
+
async function Ae() {
|
|
164
164
|
const t = process.cwd();
|
|
165
165
|
console.log(), console.log(u.bold.cyan("🚀 xcstrings-cli Configuration Setup")), console.log(u.dim("─".repeat(40))), console.log(), console.log(u.yellow("🔍 Searching for .xcstrings files..."));
|
|
166
166
|
const o = await $e(t);
|
|
167
167
|
console.log(u.yellow("🔍 Searching for .xcodeproj directories..."));
|
|
168
|
-
const n = await
|
|
168
|
+
const n = await Ne(t);
|
|
169
169
|
console.log();
|
|
170
|
-
let
|
|
170
|
+
let s = [];
|
|
171
171
|
if (o.length > 0) {
|
|
172
|
-
console.log(u.green(`✓ Found ${o.length} .xcstrings file(s)`));
|
|
172
|
+
console.log(u.green(`✓ Found ${o.length} .xcstrings file(s)`)), console.log();
|
|
173
173
|
const h = o.map((f) => ({
|
|
174
174
|
name: u.white(D(t, f)) + u.dim(` (${f})`),
|
|
175
175
|
value: D(t, f),
|
|
176
176
|
checked: !0
|
|
177
177
|
}));
|
|
178
|
-
|
|
178
|
+
s = await ne({
|
|
179
179
|
message: u.bold("Select .xcstrings files to manage:"),
|
|
180
180
|
choices: h
|
|
181
181
|
});
|
|
@@ -184,7 +184,7 @@ async function Ne() {
|
|
|
184
184
|
console.log();
|
|
185
185
|
let a = [];
|
|
186
186
|
if (n.length > 0) {
|
|
187
|
-
console.log(u.green(`✓ Found ${n.length} .xcodeproj director${n.length === 1 ? "y" : "ies"}`));
|
|
187
|
+
console.log(u.green(`✓ Found ${n.length} .xcodeproj director${n.length === 1 ? "y" : "ies"}`)), console.log();
|
|
188
188
|
const h = n.map((f) => ({
|
|
189
189
|
name: u.white(D(t, f) || f) + u.dim(` (${f})`),
|
|
190
190
|
value: D(t, f) || f,
|
|
@@ -196,21 +196,21 @@ async function Ne() {
|
|
|
196
196
|
});
|
|
197
197
|
} else
|
|
198
198
|
console.log(u.dim(" No .xcodeproj directories found"));
|
|
199
|
-
if (console.log(), console.log(u.dim("─".repeat(40))), console.log(), console.log(u.bold("📋 Configuration Summary:")), console.log(), console.log(u.cyan(" xcstringsPaths:")),
|
|
199
|
+
if (console.log(), console.log(u.dim("─".repeat(40))), console.log(), console.log(u.bold("📋 Configuration Summary:")), console.log(), console.log(u.cyan(" xcstringsPaths:")), s.length > 0 ? s.forEach((h) => console.log(u.white(` • ${h}`))) : console.log(u.dim(" (none)")), console.log(), console.log(u.cyan(" xcodeprojPaths:")), a.length > 0 ? a.forEach((h) => console.log(u.white(` • ${h}`))) : console.log(u.dim(" (none)")), console.log(), !await Se({
|
|
200
200
|
message: u.bold(`Create ${u.yellow(B)}?`),
|
|
201
201
|
default: !0
|
|
202
202
|
})) {
|
|
203
203
|
console.log(u.dim(" Configuration cancelled."));
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
206
|
-
const b =
|
|
206
|
+
const b = s.map((h) => ` "${h}"`).join(`,
|
|
207
207
|
`), S = a.map((h) => ` "${h}"`).join(`,
|
|
208
208
|
`), z = `{
|
|
209
|
-
//
|
|
209
|
+
// Paths to .xcstrings files to manage. Specify relative or absolute paths.
|
|
210
210
|
xcstringsPaths: [
|
|
211
211
|
${b}
|
|
212
212
|
],
|
|
213
|
-
//
|
|
213
|
+
// Paths to .xcodeproj directories. Used for discovering supported languages.
|
|
214
214
|
xcodeprojPaths: [
|
|
215
215
|
${S}
|
|
216
216
|
],
|
|
@@ -223,10 +223,10 @@ ${S}
|
|
|
223
223
|
function Ve(t) {
|
|
224
224
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
225
225
|
}
|
|
226
|
-
var T = { exports: {} }, I,
|
|
226
|
+
var T = { exports: {} }, I, se;
|
|
227
227
|
function Xe() {
|
|
228
|
-
if (
|
|
229
|
-
|
|
228
|
+
if (se) return I;
|
|
229
|
+
se = 1;
|
|
230
230
|
function t(n) {
|
|
231
231
|
try {
|
|
232
232
|
return JSON.stringify(n);
|
|
@@ -235,20 +235,20 @@ function Xe() {
|
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
I = o;
|
|
238
|
-
function o(n,
|
|
238
|
+
function o(n, s, a) {
|
|
239
239
|
var l = a && a.stringify || t, b = 1;
|
|
240
240
|
if (typeof n == "object" && n !== null) {
|
|
241
|
-
var S =
|
|
241
|
+
var S = s.length + b;
|
|
242
242
|
if (S === 1) return n;
|
|
243
243
|
var z = new Array(S);
|
|
244
244
|
z[0] = l(n);
|
|
245
245
|
for (var h = 1; h < S; h++)
|
|
246
|
-
z[h] = l(
|
|
246
|
+
z[h] = l(s[h]);
|
|
247
247
|
return z.join(" ");
|
|
248
248
|
}
|
|
249
249
|
if (typeof n != "string")
|
|
250
250
|
return n;
|
|
251
|
-
var f =
|
|
251
|
+
var f = s.length;
|
|
252
252
|
if (f === 0) return n;
|
|
253
253
|
for (var y = "", w = 1 - b, p = -1, E = n && n.length || 0, d = 0; d < E; ) {
|
|
254
254
|
if (n.charCodeAt(d) === 37 && d + 1 < E) {
|
|
@@ -256,35 +256,35 @@ function Xe() {
|
|
|
256
256
|
case 100:
|
|
257
257
|
// 'd'
|
|
258
258
|
case 102:
|
|
259
|
-
if (w >= f ||
|
|
260
|
-
p < d && (y += n.slice(p, d)), y += Number(
|
|
259
|
+
if (w >= f || s[w] == null) break;
|
|
260
|
+
p < d && (y += n.slice(p, d)), y += Number(s[w]), p = d + 2, d++;
|
|
261
261
|
break;
|
|
262
262
|
case 105:
|
|
263
|
-
if (w >= f ||
|
|
264
|
-
p < d && (y += n.slice(p, d)), y += Math.floor(Number(
|
|
263
|
+
if (w >= f || s[w] == null) break;
|
|
264
|
+
p < d && (y += n.slice(p, d)), y += Math.floor(Number(s[w])), p = d + 2, d++;
|
|
265
265
|
break;
|
|
266
266
|
case 79:
|
|
267
267
|
// 'O'
|
|
268
268
|
case 111:
|
|
269
269
|
// 'o'
|
|
270
270
|
case 106:
|
|
271
|
-
if (w >= f ||
|
|
271
|
+
if (w >= f || s[w] === void 0) break;
|
|
272
272
|
p < d && (y += n.slice(p, d));
|
|
273
|
-
var $ = typeof
|
|
273
|
+
var $ = typeof s[w];
|
|
274
274
|
if ($ === "string") {
|
|
275
|
-
y += "'" +
|
|
275
|
+
y += "'" + s[w] + "'", p = d + 2, d++;
|
|
276
276
|
break;
|
|
277
277
|
}
|
|
278
278
|
if ($ === "function") {
|
|
279
|
-
y +=
|
|
279
|
+
y += s[w].name || "<anonymous>", p = d + 2, d++;
|
|
280
280
|
break;
|
|
281
281
|
}
|
|
282
|
-
y += l(
|
|
282
|
+
y += l(s[w]), p = d + 2, d++;
|
|
283
283
|
break;
|
|
284
284
|
case 115:
|
|
285
285
|
if (w >= f)
|
|
286
286
|
break;
|
|
287
|
-
p < d && (y += n.slice(p, d)), y += String(
|
|
287
|
+
p < d && (y += n.slice(p, d)), y += String(s[w]), p = d + 2, d++;
|
|
288
288
|
break;
|
|
289
289
|
case 37:
|
|
290
290
|
p < d && (y += n.slice(p, d)), y += "%", p = d + 2, d++, w--;
|
|
@@ -298,25 +298,25 @@ function Xe() {
|
|
|
298
298
|
}
|
|
299
299
|
return I;
|
|
300
300
|
}
|
|
301
|
-
var
|
|
301
|
+
var re;
|
|
302
302
|
function De() {
|
|
303
|
-
if (
|
|
304
|
-
|
|
303
|
+
if (re) return T.exports;
|
|
304
|
+
re = 1;
|
|
305
305
|
const t = Xe();
|
|
306
306
|
T.exports = f;
|
|
307
307
|
const o = be().console || {}, n = {
|
|
308
|
-
mapHttpRequest:
|
|
309
|
-
mapHttpResponse:
|
|
308
|
+
mapHttpRequest: A,
|
|
309
|
+
mapHttpResponse: A,
|
|
310
310
|
wrapRequestSerializer: M,
|
|
311
311
|
wrapResponseSerializer: M,
|
|
312
312
|
wrapErrorSerializer: M,
|
|
313
|
-
req:
|
|
314
|
-
res:
|
|
313
|
+
req: A,
|
|
314
|
+
res: A,
|
|
315
315
|
err: G,
|
|
316
316
|
errWithCause: G
|
|
317
317
|
};
|
|
318
|
-
function
|
|
319
|
-
return e === "silent" ? 1 / 0 :
|
|
318
|
+
function s(e, r) {
|
|
319
|
+
return e === "silent" ? 1 / 0 : r.levels.values[e];
|
|
320
320
|
}
|
|
321
321
|
const a = Symbol("pino.logFuncs"), l = Symbol("pino.hierarchy"), b = {
|
|
322
322
|
error: "log",
|
|
@@ -326,28 +326,28 @@ function De() {
|
|
|
326
326
|
debug: "log",
|
|
327
327
|
trace: "log"
|
|
328
328
|
};
|
|
329
|
-
function S(e,
|
|
329
|
+
function S(e, r) {
|
|
330
330
|
const c = {
|
|
331
|
-
logger:
|
|
331
|
+
logger: r,
|
|
332
332
|
parent: e[l]
|
|
333
333
|
};
|
|
334
|
-
|
|
334
|
+
r[l] = c;
|
|
335
335
|
}
|
|
336
|
-
function z(e,
|
|
336
|
+
function z(e, r, c) {
|
|
337
337
|
const g = {};
|
|
338
|
-
|
|
338
|
+
r.forEach((m) => {
|
|
339
339
|
g[m] = c[m] ? c[m] : o[m] || o[b[m] || "log"] || C;
|
|
340
340
|
}), e[a] = g;
|
|
341
341
|
}
|
|
342
|
-
function h(e,
|
|
342
|
+
function h(e, r) {
|
|
343
343
|
return Array.isArray(e) ? e.filter(function(g) {
|
|
344
344
|
return g !== "!stdSerializers.err";
|
|
345
|
-
}) : e === !0 ? Object.keys(
|
|
345
|
+
}) : e === !0 ? Object.keys(r) : !1;
|
|
346
346
|
}
|
|
347
347
|
function f(e) {
|
|
348
348
|
e = e || {}, e.browser = e.browser || {};
|
|
349
|
-
const
|
|
350
|
-
if (
|
|
349
|
+
const r = e.browser.transmit;
|
|
350
|
+
if (r && typeof r.send != "function")
|
|
351
351
|
throw Error("pino: transmit option must have a send function");
|
|
352
352
|
const c = e.browser.write || o;
|
|
353
353
|
e.browser.write && (e.browser.asObject = !0);
|
|
@@ -366,16 +366,16 @@ function De() {
|
|
|
366
366
|
set: ye
|
|
367
367
|
});
|
|
368
368
|
const k = {
|
|
369
|
-
transmit:
|
|
369
|
+
transmit: r,
|
|
370
370
|
serialize: m,
|
|
371
371
|
asObject: e.browser.asObject,
|
|
372
372
|
formatters: e.browser.formatters,
|
|
373
373
|
levels: v,
|
|
374
374
|
timestamp: me(e)
|
|
375
375
|
};
|
|
376
|
-
i.levels = y(e), i.level = j, i.setMaxListeners = i.getMaxListeners = i.emit = i.addListener = i.on = i.prependListener = i.once = i.prependOnceListener = i.removeListener = i.removeAllListeners = i.listeners = i.listenerCount = i.eventNames = i.write = i.flush = C, i.serializers = g, i._serialize = m, i._stdErrSerialize = O, i.child = we,
|
|
376
|
+
i.levels = y(e), i.level = j, i.setMaxListeners = i.getMaxListeners = i.emit = i.addListener = i.on = i.prependListener = i.once = i.prependOnceListener = i.removeListener = i.removeAllListeners = i.listeners = i.listenerCount = i.eventNames = i.write = i.flush = C, i.serializers = g, i._serialize = m, i._stdErrSerialize = O, i.child = we, r && (i._logEvent = J());
|
|
377
377
|
function V() {
|
|
378
|
-
return
|
|
378
|
+
return s(this.level, this);
|
|
379
379
|
}
|
|
380
380
|
function _() {
|
|
381
381
|
return this._level;
|
|
@@ -394,10 +394,10 @@ function De() {
|
|
|
394
394
|
const Y = P.serializers;
|
|
395
395
|
if (m && Y) {
|
|
396
396
|
var X = Object.assign({}, g, Y), Z = e.browser.serialize === !0 ? Object.keys(X) : m;
|
|
397
|
-
delete x.serializers,
|
|
397
|
+
delete x.serializers, N([x], Z, X, this._stdErrSerialize);
|
|
398
398
|
}
|
|
399
399
|
function ee(te) {
|
|
400
|
-
this._childLevel = (te._childLevel | 0) + 1, this.bindings = x, X && (this.serializers = X, this._serialize = Z),
|
|
400
|
+
this._childLevel = (te._childLevel | 0) + 1, this.bindings = x, X && (this.serializers = X, this._serialize = Z), r && (this._logEvent = J(
|
|
401
401
|
[].concat(te._logEvent.bindings, x)
|
|
402
402
|
));
|
|
403
403
|
}
|
|
@@ -408,17 +408,17 @@ function De() {
|
|
|
408
408
|
return i;
|
|
409
409
|
}
|
|
410
410
|
function y(e) {
|
|
411
|
-
const
|
|
411
|
+
const r = e.customLevels || {}, c = Object.assign({}, f.levels.values, r), g = Object.assign({}, f.levels.labels, w(r));
|
|
412
412
|
return {
|
|
413
413
|
values: c,
|
|
414
414
|
labels: g
|
|
415
415
|
};
|
|
416
416
|
}
|
|
417
417
|
function w(e) {
|
|
418
|
-
const
|
|
418
|
+
const r = {};
|
|
419
419
|
return Object.keys(e).forEach(function(c) {
|
|
420
|
-
|
|
421
|
-
}),
|
|
420
|
+
r[e[c]] = c;
|
|
421
|
+
}), r;
|
|
422
422
|
}
|
|
423
423
|
f.levels = {
|
|
424
424
|
values: {
|
|
@@ -439,60 +439,60 @@ function De() {
|
|
|
439
439
|
}
|
|
440
440
|
}, f.stdSerializers = n, f.stdTimeFunctions = Object.assign({}, { nullTime: K, epochTime: Q, unixTime: he, isoTime: pe });
|
|
441
441
|
function p(e) {
|
|
442
|
-
const
|
|
443
|
-
e.bindings &&
|
|
442
|
+
const r = [];
|
|
443
|
+
e.bindings && r.push(e.bindings);
|
|
444
444
|
let c = e[l];
|
|
445
445
|
for (; c.parent; )
|
|
446
|
-
c = c.parent, c.logger.bindings &&
|
|
447
|
-
return
|
|
446
|
+
c = c.parent, c.logger.bindings && r.push(c.logger.bindings);
|
|
447
|
+
return r.reverse();
|
|
448
448
|
}
|
|
449
|
-
function E(e,
|
|
449
|
+
function E(e, r, c, g) {
|
|
450
450
|
if (Object.defineProperty(e, g, {
|
|
451
|
-
value:
|
|
451
|
+
value: s(e.level, c) > s(g, c) ? C : c[a][g],
|
|
452
452
|
writable: !0,
|
|
453
453
|
enumerable: !0,
|
|
454
454
|
configurable: !0
|
|
455
|
-
}), !
|
|
455
|
+
}), !r.transmit && e[g] === C)
|
|
456
456
|
return;
|
|
457
|
-
e[g] = $(e,
|
|
457
|
+
e[g] = $(e, r, c, g);
|
|
458
458
|
const m = p(e);
|
|
459
459
|
m.length !== 0 && (e[g] = d(m, e[g]));
|
|
460
460
|
}
|
|
461
|
-
function d(e,
|
|
461
|
+
function d(e, r) {
|
|
462
462
|
return function() {
|
|
463
|
-
return
|
|
463
|
+
return r.apply(this, [...e, ...arguments]);
|
|
464
464
|
};
|
|
465
465
|
}
|
|
466
|
-
function $(e,
|
|
466
|
+
function $(e, r, c, g) {
|
|
467
467
|
return /* @__PURE__ */ (function(m) {
|
|
468
468
|
return function() {
|
|
469
|
-
const L =
|
|
469
|
+
const L = r.timestamp(), v = new Array(arguments.length), j = Object.getPrototypeOf && Object.getPrototypeOf(this) === o ? o : this;
|
|
470
470
|
for (var i = 0; i < v.length; i++) v[i] = arguments[i];
|
|
471
|
-
if (
|
|
472
|
-
const k =
|
|
471
|
+
if (r.serialize && !r.asObject && N(v, this._serialize, this.serializers, this._stdErrSerialize), r.asObject || r.formatters ? m.call(j, de(this, g, v, L, r.formatters)) : m.apply(j, v), r.transmit) {
|
|
472
|
+
const k = r.transmit.level || e._level, V = c.levels.values[k], _ = c.levels.values[g];
|
|
473
473
|
if (_ < V) return;
|
|
474
474
|
ge(this, {
|
|
475
475
|
ts: L,
|
|
476
476
|
methodLevel: g,
|
|
477
477
|
methodValue: _,
|
|
478
|
-
transmitValue: c.levels.values[
|
|
479
|
-
send:
|
|
480
|
-
val:
|
|
478
|
+
transmitValue: c.levels.values[r.transmit.level || e._level],
|
|
479
|
+
send: r.transmit.send,
|
|
480
|
+
val: s(e._level, c)
|
|
481
481
|
}, v);
|
|
482
482
|
}
|
|
483
483
|
};
|
|
484
484
|
})(e[a][g]);
|
|
485
485
|
}
|
|
486
|
-
function de(e,
|
|
486
|
+
function de(e, r, c, g, m = {}) {
|
|
487
487
|
const {
|
|
488
|
-
level: O = () => e.levels.values[
|
|
488
|
+
level: O = () => e.levels.values[r],
|
|
489
489
|
log: L = (_) => _
|
|
490
490
|
} = m;
|
|
491
|
-
e._serialize &&
|
|
491
|
+
e._serialize && N(c, e._serialize, e.serializers, e._stdErrSerialize);
|
|
492
492
|
const v = c.slice();
|
|
493
493
|
let j = v[0];
|
|
494
494
|
const i = {};
|
|
495
|
-
g && (i.time = g), i.level = O(
|
|
495
|
+
g && (i.time = g), i.level = O(r, e.levels.values[r]);
|
|
496
496
|
let k = (e._childLevel | 0) + 1;
|
|
497
497
|
if (k < 1 && (k = 1), j !== null && typeof j == "object") {
|
|
498
498
|
for (; k-- && typeof v[0] == "object"; )
|
|
@@ -501,17 +501,17 @@ function De() {
|
|
|
501
501
|
} else typeof j == "string" && (j = t(v.shift(), v));
|
|
502
502
|
return j !== void 0 && (i.msg = j), L(i);
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function N(e, r, c, g) {
|
|
505
505
|
for (const m in e)
|
|
506
506
|
if (g && e[m] instanceof Error)
|
|
507
507
|
e[m] = f.stdSerializers.err(e[m]);
|
|
508
508
|
else if (typeof e[m] == "object" && !Array.isArray(e[m]))
|
|
509
509
|
for (const O in e[m])
|
|
510
|
-
|
|
510
|
+
r && r.indexOf(O) > -1 && O in c && (e[m][O] = c[O](e[m][O]));
|
|
511
511
|
}
|
|
512
|
-
function ge(e,
|
|
513
|
-
const g =
|
|
514
|
-
|
|
512
|
+
function ge(e, r, c) {
|
|
513
|
+
const g = r.send, m = r.ts, O = r.methodLevel, L = r.methodValue, v = r.val, j = e._logEvent.bindings;
|
|
514
|
+
N(
|
|
515
515
|
c,
|
|
516
516
|
e._serialize || Object.keys(e.serializers),
|
|
517
517
|
e.serializers,
|
|
@@ -529,19 +529,19 @@ function De() {
|
|
|
529
529
|
};
|
|
530
530
|
}
|
|
531
531
|
function G(e) {
|
|
532
|
-
const
|
|
532
|
+
const r = {
|
|
533
533
|
type: e.constructor.name,
|
|
534
534
|
msg: e.message,
|
|
535
535
|
stack: e.stack
|
|
536
536
|
};
|
|
537
537
|
for (const c in e)
|
|
538
|
-
|
|
539
|
-
return
|
|
538
|
+
r[c] === void 0 && (r[c] = e[c]);
|
|
539
|
+
return r;
|
|
540
540
|
}
|
|
541
541
|
function me(e) {
|
|
542
542
|
return typeof e.timestamp == "function" ? e.timestamp : e.timestamp === !1 ? K : Q;
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function A() {
|
|
545
545
|
return {};
|
|
546
546
|
}
|
|
547
547
|
function M(e) {
|
|
@@ -562,8 +562,8 @@ function De() {
|
|
|
562
562
|
return new Date(Date.now()).toISOString();
|
|
563
563
|
}
|
|
564
564
|
function be() {
|
|
565
|
-
function e(
|
|
566
|
-
return typeof
|
|
565
|
+
function e(r) {
|
|
566
|
+
return typeof r < "u" && r;
|
|
567
567
|
}
|
|
568
568
|
try {
|
|
569
569
|
return typeof globalThis < "u" || Object.defineProperty(Object.prototype, "globalThis", {
|
|
@@ -602,8 +602,8 @@ async function Me(t, o = ue) {
|
|
|
602
602
|
return JSON.parse(t);
|
|
603
603
|
if (Array.isArray(t)) {
|
|
604
604
|
const n = {};
|
|
605
|
-
for (const
|
|
606
|
-
typeof
|
|
605
|
+
for (const s of t)
|
|
606
|
+
typeof s == "string" && Object.assign(n, JSON.parse(s));
|
|
607
607
|
return n;
|
|
608
608
|
}
|
|
609
609
|
if (typeof t == "boolean" && t === !0) {
|
|
@@ -616,11 +616,11 @@ async function Re({
|
|
|
616
616
|
path: t,
|
|
617
617
|
key: o,
|
|
618
618
|
comment: n,
|
|
619
|
-
stringsArg:
|
|
619
|
+
stringsArg: s,
|
|
620
620
|
stdinReader: a = ue,
|
|
621
621
|
configPath: l
|
|
622
622
|
}) {
|
|
623
|
-
const b = await Me(
|
|
623
|
+
const b = await Me(s, a);
|
|
624
624
|
await Fe(t, o, n, b, l);
|
|
625
625
|
}
|
|
626
626
|
const ie = q(process.cwd(), "Localizable.xcstrings");
|
|
@@ -640,11 +640,11 @@ ve(je(process.argv)).scriptName("xcstrings").usage("$0 <cmd> [args]").option("co
|
|
|
640
640
|
const n = o.xcstringsPaths[0];
|
|
641
641
|
t.path = typeof n == "string" ? n : n.path;
|
|
642
642
|
} else {
|
|
643
|
-
const n = o.xcstringsPaths.map((a) => typeof a == "string" ? { name: a, value: a } : { name: `${a.alias} (${a.path})`, value: a.path }),
|
|
643
|
+
const n = o.xcstringsPaths.map((a) => typeof a == "string" ? { name: a, value: a } : { name: `${a.alias} (${a.path})`, value: a.path }), s = await Ee({
|
|
644
644
|
message: "Select xcstrings file:",
|
|
645
645
|
choices: n
|
|
646
646
|
});
|
|
647
|
-
t.path =
|
|
647
|
+
t.path = s;
|
|
648
648
|
}
|
|
649
649
|
}).command(
|
|
650
650
|
"add",
|
|
@@ -695,7 +695,7 @@ ve(je(process.argv)).scriptName("xcstrings").usage("$0 <cmd> [args]").option("co
|
|
|
695
695
|
t.key,
|
|
696
696
|
t.languages,
|
|
697
697
|
t.dryRun === !0
|
|
698
|
-
), n = Object.entries(o).map(([
|
|
698
|
+
), n = Object.entries(o).map(([s, a]) => `- [${a.join(" ")}] ${s}`).join(`
|
|
699
699
|
`);
|
|
700
700
|
if (t.dryRun) {
|
|
701
701
|
n.length === 0 ? F.info(u.yellow("No matching strings found.")) : F.info(u.blue(`Would remove:
|
|
@@ -710,7 +710,7 @@ ${n}`));
|
|
|
710
710
|
"Initialize configuration file",
|
|
711
711
|
(t) => t,
|
|
712
712
|
async () => {
|
|
713
|
-
await
|
|
713
|
+
await Ae();
|
|
714
714
|
}
|
|
715
715
|
).command(
|
|
716
716
|
"languages",
|
|
@@ -721,6 +721,6 @@ ${n}`));
|
|
|
721
721
|
F.info(o.join(" "));
|
|
722
722
|
}
|
|
723
723
|
).demandCommand(1, "").strictCommands().recommendCommands().showHelpOnFail(!0).fail((t, o, n) => {
|
|
724
|
-
const
|
|
725
|
-
|
|
724
|
+
const s = t || o?.message;
|
|
725
|
+
s && (console.error(u.red(s)), console.log(), n.showHelp(), process.exit(1)), o && (console.error(o), process.exit(1)), n.showHelp(), process.exit(1);
|
|
726
726
|
}).help().argv;
|