lingo.dev 0.78.15 → 0.78.17

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 CHANGED
@@ -178,7 +178,7 @@ function createAuthenticator(params) {
178
178
  }
179
179
 
180
180
  // src/cli/cmd/auth.ts
181
- var auth_default = new (0, _interactivecommander.Command)().command("auth").description("Authenticate with Lingo.dev API").helpOption("-h, --help", "Show help").option("--logout", "Delete existing authentication").option("--login", "Authenticate with Lingo.dev API").action(async (options) => {
181
+ var auth_default = new (0, _interactivecommander.Command)().command("auth").description("Authenticate with Lingo.dev API").helpOption("-h, --help", "Show help").option("--logout", "Delete existing authentication and clear your saved API key").option("--login", "Authenticate with Lingo.dev API").action(async (options) => {
182
182
  try {
183
183
  let settings = await getSettings(void 0);
184
184
  if (options.logout) {
@@ -464,15 +464,16 @@ function updateGitignore() {
464
464
  return;
465
465
  }
466
466
  const gitignorePath = _path2.default.join(projectRoot, ".gitignore");
467
+ if (!_fs2.default.existsSync(gitignorePath)) {
468
+ return;
469
+ }
467
470
  const gitignore = _fs2.default.readFileSync(gitignorePath, "utf8").split("\n");
468
471
  const cacheIsIgnored = gitignore.includes(cacheFile);
469
472
  if (!cacheIsIgnored) {
470
473
  let content = "";
471
- if (_fs2.default.existsSync(gitignorePath)) {
472
- content = _fs2.default.readFileSync(gitignorePath, "utf8");
473
- if (content !== "" && !content.endsWith("\n")) {
474
- content += "\n";
475
- }
474
+ content = _fs2.default.readFileSync(gitignorePath, "utf8");
475
+ if (content !== "" && !content.endsWith("\n")) {
476
+ content += "\n";
476
477
  }
477
478
  content += `${cacheFile}
478
479
  `;
@@ -862,7 +863,7 @@ function getBuckets(i18nConfig) {
862
863
  }
863
864
  function extractPathPatterns(sourceLocale, include, exclude) {
864
865
  const includedPatterns = include.flatMap(
865
- (pattern) => expandPlaceholderedGlob(pattern.path, __spec.resolveOverridenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
866
+ (pattern) => expandPlaceholderedGlob(pattern.path, __spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
866
867
  (pathPattern) => ({
867
868
  pathPattern,
868
869
  delimiter: pattern.delimiter
@@ -870,7 +871,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
870
871
  )
871
872
  );
872
873
  const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _35 => _35.flatMap, 'call', _36 => _36(
873
- (pattern) => expandPlaceholderedGlob(pattern.path, __spec.resolveOverridenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
874
+ (pattern) => expandPlaceholderedGlob(pattern.path, __spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
874
875
  (pathPattern) => ({
875
876
  pathPattern,
876
877
  delimiter: pattern.delimiter
@@ -933,7 +934,7 @@ function resolveBucketItem(bucketItem) {
933
934
 
934
935
  // src/cli/cmd/show/files.ts
935
936
 
936
- var files_default = new (0, _interactivecommander.Command)().command("files").description("Print out the list of files managed by Lingo.dev").option("--source", "Only show source files").option("--target", "Only show target files").helpOption("-h, --help", "Show help").action(async (type) => {
937
+ var files_default = new (0, _interactivecommander.Command)().command("files").description("Print out the list of files managed by Lingo.dev").option("--source", "Only show source files, files containing the original translations").option("--target", "Only show target files, files containing translated content").helpOption("-h, --help", "Show help").action(async (type) => {
937
938
  const ora = _ora2.default.call(void 0, );
938
939
  try {
939
940
  try {
@@ -947,10 +948,10 @@ var files_default = new (0, _interactivecommander.Command)().command("files").de
947
948
  const buckets = getBuckets(i18nConfig);
948
949
  for (const bucket of buckets) {
949
950
  for (const bucketConfig of bucket.config) {
950
- const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
951
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
951
952
  const sourcePath = bucketConfig.pathPattern.replace(/\[locale\]/g, sourceLocale);
952
953
  const targetPaths = i18nConfig.locale.targets.map((_targetLocale) => {
953
- const targetLocale = __spec.resolveOverridenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
954
+ const targetLocale = __spec.resolveOverriddenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
954
955
  return bucketConfig.pathPattern.replace(/\[locale\]/g, targetLocale);
955
956
  });
956
957
  const result = [];
@@ -3304,7 +3305,7 @@ function _tryParseJSON(line) {
3304
3305
  }
3305
3306
 
3306
3307
  // src/cli/cmd/i18n.ts
3307
- var i18n_default = new (0, _interactivecommander.Command)().command("i18n").description("Run Localization engine").helpOption("-h, --help", "Show help").option("--locale <locale>", "Locale to process", (val, prev) => prev ? [...prev, val] : [val]).option("--bucket <bucket>", "Bucket to process", (val, prev) => prev ? [...prev, val] : [val]).option("--key <key>", "Key to process").option("--frozen", `Don't update the translations and fail if an update is needed`).option("--force", "Ignore lockfile and process all keys").option("--verbose", "Show verbose output").option("--interactive", "Interactive mode").option("--api-key <api-key>", "Explicitly set the API key to use").option("--debug", "Debug mode").option("--strict", "Stop on first error").action(async function(options) {
3308
+ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").description("Run Localization engine").helpOption("-h, --help", "Show help").option("--locale <locale>", "Locale to process", (val, prev) => prev ? [...prev, val] : [val]).option("--bucket <bucket>", "Bucket to process", (val, prev) => prev ? [...prev, val] : [val]).option("--key <key>", "Key to process. Process only a specific translation key, useful for debugging or updating a single entry").option("--frozen", `Run in read-only mode - fails if any translations need updating, useful for CI/CD pipelines to detect missing translations`).option("--force", "Ignore lockfile and process all keys, useful for full re-translation").option("--verbose", "Show detailed output including intermediate processing data and API communication details").option("--interactive", "Enable interactive mode for reviewing and editing translations before they are applied").option("--api-key <api-key>", "Explicitly set the API key to use, override the default API key from settings").option("--debug", "Pause execution at start for debugging purposes, waits for user confirmation before proceeding").option("--strict", "Stop processing on first error instead of continuing with other locales/buckets").action(async function(options) {
3308
3309
  updateGitignore();
3309
3310
  const ora = _ora2.default.call(void 0, );
3310
3311
  const flags = parseFlags(options);
@@ -3341,7 +3342,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3341
3342
  ora.start("Creating i18n.lock...");
3342
3343
  for (const bucket of buckets) {
3343
3344
  for (const bucketConfig of bucket.config) {
3344
- const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3345
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3345
3346
  const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3346
3347
  isCacheRestore: false,
3347
3348
  defaultLocale: sourceLocale
@@ -3366,7 +3367,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3366
3367
  for (const bucketConfig of bucket.config) {
3367
3368
  const bucketOra = _ora2.default.call(void 0, { indent: 4 });
3368
3369
  bucketOra.info(`Processing path: ${bucketConfig.pathPattern}`);
3369
- const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3370
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3370
3371
  const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3371
3372
  isCacheRestore: true,
3372
3373
  defaultLocale: sourceLocale
@@ -3404,7 +3405,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3404
3405
  let requiresUpdate = null;
3405
3406
  bucketLoop: for (const bucket of buckets) {
3406
3407
  for (const bucketConfig of bucket.config) {
3407
- const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3408
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3408
3409
  const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3409
3410
  isCacheRestore: false,
3410
3411
  defaultLocale: sourceLocale,
@@ -3421,7 +3422,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3421
3422
  break bucketLoop;
3422
3423
  }
3423
3424
  for (const _targetLocale of targetLocales) {
3424
- const targetLocale = __spec.resolveOverridenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
3425
+ const targetLocale = __spec.resolveOverriddenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
3425
3426
  const { unlocalizable: targetUnlocalizable, ...targetData } = await bucketLoader.pull(targetLocale);
3426
3427
  const missingKeys = _lodash2.default.difference(Object.keys(sourceData), Object.keys(targetData));
3427
3428
  const extraKeys = _lodash2.default.difference(Object.keys(targetData), Object.keys(sourceData));
@@ -3461,7 +3462,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3461
3462
  ora.info(`Processing bucket: ${bucket.type}`);
3462
3463
  for (const bucketConfig of bucket.config) {
3463
3464
  const bucketOra = _ora2.default.call(void 0, { indent: 2 }).info(`Processing path: ${bucketConfig.pathPattern}`);
3464
- const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3465
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3465
3466
  const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3466
3467
  isCacheRestore: false,
3467
3468
  defaultLocale: sourceLocale
@@ -3470,7 +3471,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
3470
3471
  await bucketLoader.init();
3471
3472
  let sourceData = await bucketLoader.pull(sourceLocale);
3472
3473
  for (const _targetLocale of targetLocales) {
3473
- const targetLocale = __spec.resolveOverridenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
3474
+ const targetLocale = __spec.resolveOverriddenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
3474
3475
  try {
3475
3476
  bucketOra.start(`[${sourceLocale} -> ${targetLocale}] (0%) Localization in progress...`);
3476
3477
  sourceData = await bucketLoader.pull(sourceLocale);
@@ -3788,8 +3789,11 @@ var lockfile_default = new (0, _interactivecommander.Command)().command("lockfil
3788
3789
  const buckets = getBuckets(i18nConfig);
3789
3790
  for (const bucket of buckets) {
3790
3791
  for (const bucketConfig of bucket.config) {
3791
- const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3792
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, { isCacheRestore: false, defaultLocale: sourceLocale });
3792
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3793
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3794
+ isCacheRestore: false,
3795
+ defaultLocale: sourceLocale
3796
+ });
3793
3797
  bucketLoader.setDefaultLocale(sourceLocale);
3794
3798
  const sourceData = await bucketLoader.pull(sourceLocale);
3795
3799
  lockfileHelper.registerSourceData(bucketConfig.pathPattern, sourceData);
@@ -3807,7 +3811,7 @@ var flagsSchema = _zod2.default.object({
3807
3811
 
3808
3812
 
3809
3813
 
3810
- var cleanup_default = new (0, _interactivecommander.Command)().command("cleanup").description("Remove keys from target files that do not exist in the source file").helpOption("-h, --help", "Show help").option("--locale <locale>", "Specific locale to cleanup").option("--bucket <bucket>", "Specific bucket to cleanup").option("--dry-run", "Show what would be removed without making changes").option("--verbose", "Show verbose output").action(async function(options) {
3814
+ var cleanup_default = new (0, _interactivecommander.Command)().command("cleanup").description("Remove keys from target files that do not exist in the source file").helpOption("-h, --help", "Show help").option("--locale <locale>", "Specific locale to cleanup").option("--bucket <bucket>", "Specific bucket to cleanup").option("--dry-run", "Show what would be removed without making changes").option("--verbose", "Show detailed output including:\n - List of keys that would be removed.\n - Processing steps.").action(async function(options) {
3811
3815
  const ora = _ora2.default.call(void 0, );
3812
3816
  const results = [];
3813
3817
  try {
@@ -3824,14 +3828,17 @@ var cleanup_default = new (0, _interactivecommander.Command)().command("cleanup"
3824
3828
  console.log();
3825
3829
  ora.info(`Processing bucket: ${bucket.type}`);
3826
3830
  for (const bucketConfig of bucket.config) {
3827
- const sourceLocale = __spec.resolveOverridenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3831
+ const sourceLocale = __spec.resolveOverriddenLocale.call(void 0, i18nConfig.locale.source, bucketConfig.delimiter);
3828
3832
  const bucketOra = _ora2.default.call(void 0, { indent: 2 }).info(`Processing path: ${bucketConfig.pathPattern}`);
3829
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, { isCacheRestore: false, defaultLocale: sourceLocale });
3833
+ const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3834
+ isCacheRestore: false,
3835
+ defaultLocale: sourceLocale
3836
+ });
3830
3837
  bucketLoader.setDefaultLocale(sourceLocale);
3831
3838
  const sourceData = await bucketLoader.pull(sourceLocale);
3832
3839
  const sourceKeys = Object.keys(sourceData);
3833
3840
  for (const _targetLocale of targetLocales) {
3834
- const targetLocale = __spec.resolveOverridenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
3841
+ const targetLocale = __spec.resolveOverriddenLocale.call(void 0, _targetLocale, bucketConfig.delimiter);
3835
3842
  try {
3836
3843
  const targetData = await bucketLoader.pull(targetLocale);
3837
3844
  const targetKeys = Object.keys(targetData);
@@ -3949,7 +3956,7 @@ var mcp_default = new (0, _interactivecommander.Command)().command("mcp").descri
3949
3956
  // package.json
3950
3957
  var package_default = {
3951
3958
  name: "lingo.dev",
3952
- version: "0.78.15",
3959
+ version: "0.78.17",
3953
3960
  description: "Lingo.dev CLI",
3954
3961
  private: false,
3955
3962
  publishConfig: {