lingo.dev 0.92.2 → 0.92.3
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/build/cli.cjs +94 -23
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +93 -22
- package/build/cli.mjs.map +1 -1
- package/package.json +1 -1
package/build/cli.mjs
CHANGED
|
@@ -3132,13 +3132,33 @@ function parseVueFile(input2) {
|
|
|
3132
3132
|
return { before, after, i18n };
|
|
3133
3133
|
}
|
|
3134
3134
|
|
|
3135
|
-
// src/cli/loaders/typescript.ts
|
|
3135
|
+
// src/cli/loaders/typescript/index.ts
|
|
3136
3136
|
import { parse as parse2 } from "@babel/parser";
|
|
3137
|
-
import
|
|
3137
|
+
import babelTraverseModule from "@babel/traverse";
|
|
3138
3138
|
import * as t from "@babel/types";
|
|
3139
|
-
import
|
|
3139
|
+
import babelGenerateModule from "@babel/generator";
|
|
3140
3140
|
import { flatten as flatten2, unflatten as unflatten2 } from "flat";
|
|
3141
3141
|
import _18 from "lodash";
|
|
3142
|
+
|
|
3143
|
+
// src/cli/loaders/typescript/cjs-interop.ts
|
|
3144
|
+
function resolveCjsExport(mod, name = "module") {
|
|
3145
|
+
if (typeof mod === "function" || typeof mod !== "object" || mod === null) {
|
|
3146
|
+
return mod;
|
|
3147
|
+
}
|
|
3148
|
+
if (typeof mod.default !== "undefined") {
|
|
3149
|
+
return mod.default;
|
|
3150
|
+
}
|
|
3151
|
+
console.error(
|
|
3152
|
+
`[resolveCjsExport] Unable to determine default export for ${name}.`,
|
|
3153
|
+
"Received value:",
|
|
3154
|
+
mod
|
|
3155
|
+
);
|
|
3156
|
+
throw new Error(`Failed to resolve default export for ${name}.`);
|
|
3157
|
+
}
|
|
3158
|
+
|
|
3159
|
+
// src/cli/loaders/typescript/index.ts
|
|
3160
|
+
var traverse = resolveCjsExport(babelTraverseModule, "@babel/traverse");
|
|
3161
|
+
var generate = resolveCjsExport(babelGenerateModule, "@babel/generator");
|
|
3142
3162
|
function createTypescriptLoader() {
|
|
3143
3163
|
return createLoader({
|
|
3144
3164
|
pull: async (locale, input2) => {
|
|
@@ -3183,12 +3203,15 @@ function parseTypeScript(input2) {
|
|
|
3183
3203
|
}
|
|
3184
3204
|
function flattenExtractedStrings(obj) {
|
|
3185
3205
|
const flattened = flatten2(obj, { delimiter: "/" });
|
|
3186
|
-
return Object.entries(flattened).reduce(
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3206
|
+
return Object.entries(flattened).reduce(
|
|
3207
|
+
(acc, [key, value]) => {
|
|
3208
|
+
if (typeof value === "string") {
|
|
3209
|
+
acc[key] = value;
|
|
3210
|
+
}
|
|
3211
|
+
return acc;
|
|
3212
|
+
},
|
|
3213
|
+
{}
|
|
3214
|
+
);
|
|
3192
3215
|
}
|
|
3193
3216
|
function unflattenStringData(data) {
|
|
3194
3217
|
return unflatten2(data, { delimiter: "/" });
|
|
@@ -3240,9 +3263,17 @@ function extractStringsFromExportedIdentifier(path17, result, basePath) {
|
|
|
3240
3263
|
const bindingPath = binding.path;
|
|
3241
3264
|
if (t.isVariableDeclarator(bindingPath.node) && bindingPath.node.init) {
|
|
3242
3265
|
if (t.isObjectExpression(bindingPath.node.init)) {
|
|
3243
|
-
extractStringsFromObjectExpression(
|
|
3266
|
+
extractStringsFromObjectExpression(
|
|
3267
|
+
bindingPath.node.init,
|
|
3268
|
+
result,
|
|
3269
|
+
basePath
|
|
3270
|
+
);
|
|
3244
3271
|
} else if (t.isArrayExpression(bindingPath.node.init)) {
|
|
3245
|
-
extractStringsFromArrayExpression(
|
|
3272
|
+
extractStringsFromArrayExpression(
|
|
3273
|
+
bindingPath.node.init,
|
|
3274
|
+
result,
|
|
3275
|
+
basePath
|
|
3276
|
+
);
|
|
3246
3277
|
}
|
|
3247
3278
|
}
|
|
3248
3279
|
}
|
|
@@ -3276,18 +3307,34 @@ function updateStringsInObjectExpression(objectExpression, data, path17) {
|
|
|
3276
3307
|
}
|
|
3277
3308
|
} else if (t.isObjectExpression(prop.value)) {
|
|
3278
3309
|
if (data[key] && typeof data[key] === "object") {
|
|
3279
|
-
const subModified = updateStringsInObjectExpression(
|
|
3310
|
+
const subModified = updateStringsInObjectExpression(
|
|
3311
|
+
prop.value,
|
|
3312
|
+
data[key],
|
|
3313
|
+
""
|
|
3314
|
+
);
|
|
3280
3315
|
modified = subModified || modified;
|
|
3281
3316
|
} else {
|
|
3282
|
-
const subModified = updateStringsInObjectExpression(
|
|
3317
|
+
const subModified = updateStringsInObjectExpression(
|
|
3318
|
+
prop.value,
|
|
3319
|
+
data,
|
|
3320
|
+
currentPath
|
|
3321
|
+
);
|
|
3283
3322
|
modified = subModified || modified;
|
|
3284
3323
|
}
|
|
3285
3324
|
} else if (t.isArrayExpression(prop.value)) {
|
|
3286
3325
|
if (data[key] && Array.isArray(data[key])) {
|
|
3287
|
-
const subModified = updateStringsInArrayExpression(
|
|
3326
|
+
const subModified = updateStringsInArrayExpression(
|
|
3327
|
+
prop.value,
|
|
3328
|
+
data[key],
|
|
3329
|
+
""
|
|
3330
|
+
);
|
|
3288
3331
|
modified = subModified || modified;
|
|
3289
3332
|
} else {
|
|
3290
|
-
const subModified = updateStringsInArrayExpression(
|
|
3333
|
+
const subModified = updateStringsInArrayExpression(
|
|
3334
|
+
prop.value,
|
|
3335
|
+
data,
|
|
3336
|
+
currentPath
|
|
3337
|
+
);
|
|
3291
3338
|
modified = subModified || modified;
|
|
3292
3339
|
}
|
|
3293
3340
|
}
|
|
@@ -3309,18 +3356,34 @@ function updateStringsInArrayExpression(arrayExpression, data, path17) {
|
|
|
3309
3356
|
}
|
|
3310
3357
|
} else if (t.isObjectExpression(element)) {
|
|
3311
3358
|
if (Array.isArray(data) && data[index] && typeof data[index] === "object") {
|
|
3312
|
-
const subModified = updateStringsInObjectExpression(
|
|
3359
|
+
const subModified = updateStringsInObjectExpression(
|
|
3360
|
+
element,
|
|
3361
|
+
data[index],
|
|
3362
|
+
""
|
|
3363
|
+
);
|
|
3313
3364
|
modified = subModified || modified;
|
|
3314
3365
|
} else {
|
|
3315
|
-
const subModified = updateStringsInObjectExpression(
|
|
3366
|
+
const subModified = updateStringsInObjectExpression(
|
|
3367
|
+
element,
|
|
3368
|
+
data,
|
|
3369
|
+
currentPath
|
|
3370
|
+
);
|
|
3316
3371
|
modified = subModified || modified;
|
|
3317
3372
|
}
|
|
3318
3373
|
} else if (t.isArrayExpression(element)) {
|
|
3319
3374
|
if (Array.isArray(data) && data[index] && Array.isArray(data[index])) {
|
|
3320
|
-
const subModified = updateStringsInArrayExpression(
|
|
3375
|
+
const subModified = updateStringsInArrayExpression(
|
|
3376
|
+
element,
|
|
3377
|
+
data[index],
|
|
3378
|
+
""
|
|
3379
|
+
);
|
|
3321
3380
|
modified = subModified || modified;
|
|
3322
3381
|
} else {
|
|
3323
|
-
const subModified = updateStringsInArrayExpression(
|
|
3382
|
+
const subModified = updateStringsInArrayExpression(
|
|
3383
|
+
element,
|
|
3384
|
+
data,
|
|
3385
|
+
currentPath
|
|
3386
|
+
);
|
|
3324
3387
|
modified = subModified || modified;
|
|
3325
3388
|
}
|
|
3326
3389
|
}
|
|
@@ -3335,9 +3398,17 @@ function updateStringsInExportedIdentifier(path17, data, basePath) {
|
|
|
3335
3398
|
const bindingPath = binding.path;
|
|
3336
3399
|
if (t.isVariableDeclarator(bindingPath.node) && bindingPath.node.init) {
|
|
3337
3400
|
if (t.isObjectExpression(bindingPath.node.init)) {
|
|
3338
|
-
modified = updateStringsInObjectExpression(
|
|
3401
|
+
modified = updateStringsInObjectExpression(
|
|
3402
|
+
bindingPath.node.init,
|
|
3403
|
+
data,
|
|
3404
|
+
basePath
|
|
3405
|
+
) || modified;
|
|
3339
3406
|
} else if (t.isArrayExpression(bindingPath.node.init)) {
|
|
3340
|
-
modified = updateStringsInArrayExpression(
|
|
3407
|
+
modified = updateStringsInArrayExpression(
|
|
3408
|
+
bindingPath.node.init,
|
|
3409
|
+
data,
|
|
3410
|
+
basePath
|
|
3411
|
+
) || modified;
|
|
3341
3412
|
}
|
|
3342
3413
|
}
|
|
3343
3414
|
}
|
|
@@ -6284,7 +6355,7 @@ async function renderHero() {
|
|
|
6284
6355
|
// package.json
|
|
6285
6356
|
var package_default = {
|
|
6286
6357
|
name: "lingo.dev",
|
|
6287
|
-
version: "0.92.
|
|
6358
|
+
version: "0.92.3",
|
|
6288
6359
|
description: "Lingo.dev CLI",
|
|
6289
6360
|
private: false,
|
|
6290
6361
|
publishConfig: {
|