lingo.dev 0.90.1 → 0.90.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/README.md CHANGED
@@ -174,4 +174,4 @@ Want to contribute? Create a pull request!
174
174
  - [Hindi](/readme/hi.md)
175
175
  - [Bengali](/readme/bn.md)
176
176
 
177
- Don't see your language? Just add a new language code to the [`i18n.json`](./i18n.json) file and open a PR.
177
+ Don't see your language? Just add a new language code to the [`i18n.json`](./i18n.json) file and open a PR!
package/build/cli.cjs CHANGED
@@ -1357,12 +1357,7 @@ function createAndroidLoader() {
1357
1357
  }
1358
1358
  const cdataRegex = /<!\[CDATA\[([\s\S]*?)\]\]>/g;
1359
1359
  value = value.replace(cdataRegex, (match, content) => content);
1360
- value = value.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&apos;/g, "'");
1361
- if (value.startsWith('"') && value.endsWith('"') && value.length >= 2) {
1362
- value = value.substring(1, value.length - 1);
1363
- } else {
1364
- value = value === "" || /^\s+$/.test(value) ? value : value.trim();
1365
- }
1360
+ value = value.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/\\'/g, "'");
1366
1361
  result[name] = value;
1367
1362
  }
1368
1363
  const parsed = await _xml2js.parseStringPromise.call(void 0, input2, {
@@ -1394,7 +1389,9 @@ function createAndroidLoader() {
1394
1389
  } else if (item._ === "") {
1395
1390
  itemValue = "";
1396
1391
  }
1397
- items.push(itemValue === "" || /^\s+$/.test(itemValue) ? itemValue : itemValue.trim());
1392
+ items.push(
1393
+ itemValue === "" || /^\s+$/.test(itemValue) ? itemValue : itemValue.trim()
1394
+ );
1398
1395
  });
1399
1396
  }
1400
1397
  result[name] = items;
@@ -1463,9 +1460,8 @@ function createAndroidLoader() {
1463
1460
  };
1464
1461
  const processHtmlContent = (str) => {
1465
1462
  if (typeof str !== "string") return { _: String(str) };
1466
- const containsHtml = /<[a-z][\s\S]*>/i.test(str);
1467
- const containsSpecialChars = /[<>&]/.test(str);
1468
- return { _: str };
1463
+ const processedStr = str.replace(/'/g, "\\'");
1464
+ return { _: processedStr };
1469
1465
  };
1470
1466
  for (const [key, value] of Object.entries(payload)) {
1471
1467
  if (typeof value === "string") {
@@ -4854,7 +4850,7 @@ var mcp_default = new (0, _interactivecommander.Command)().command("mcp").descri
4854
4850
 
4855
4851
 
4856
4852
  // src/cli/cmd/ci/flows/pull-request.ts
4857
- var _child_process = require('child_process');
4853
+ var _child_process = require('child_process'); var cp = _interopRequireWildcard(_child_process);
4858
4854
 
4859
4855
  // src/cli/cmd/ci/flows/in-branch.ts
4860
4856
 
@@ -4966,22 +4962,6 @@ var InBranchFlow = class extends IntegrationFlow {
4966
4962
  }
4967
4963
  return true;
4968
4964
  }
4969
- async returnToOriginalBranch() {
4970
- const originalBranch = this.platformKit.platformConfig.baseBranchName;
4971
- if (originalBranch) {
4972
- this.ora.start(`Returning to original branch: ${originalBranch}`);
4973
- try {
4974
- _child_process.execSync.call(void 0, `git checkout ${originalBranch}`, {
4975
- stdio: "inherit",
4976
- encoding: "utf8"
4977
- });
4978
- this.ora.succeed(`Returned to original branch: ${originalBranch}`);
4979
- } catch (error) {
4980
- const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
4981
- this.ora.fail(`Failed to return to original branch: ${errorMessage}`);
4982
- }
4983
- }
4984
- }
4985
4965
  };
4986
4966
 
4987
4967
  // src/cli/cmd/ci/flows/pull-request.ts
@@ -5529,7 +5509,24 @@ var getPlatformKit = () => {
5529
5509
  };
5530
5510
 
5531
5511
  // src/cli/cmd/ci/index.ts
5532
- var ci_default = new (0, _interactivecommander.Command)().command("ci").description("Run Lingo.dev CI/CD action").helpOption("-h, --help", "Show help").option("--api-key <key>", "API key").option("--pull-request", "Create a pull request with the changes", false).option("--commit-message <message>", "Commit message").option("--pull-request-title <title>", "Pull request title").option("--working-directory <dir>", "Working directory").option("--process-own-commits", "Process commits made by this action", false).action(async (options) => {
5512
+
5513
+ var ci_default = new (0, _interactivecommander.Command)().command("ci").description("Run Lingo.dev CI/CD action").helpOption("-h, --help", "Show help").option("--api-key <key>", "API key").option("--pull-request [boolean]", "Create a pull request with the changes").option("--commit-message <message>", "Commit message").option("--pull-request-title <title>", "Pull request title").option("--working-directory <dir>", "Working directory").option(
5514
+ "--process-own-commits [boolean]",
5515
+ "Process commits made by this action"
5516
+ ).option(
5517
+ "--debug",
5518
+ "Debug mode. Wait for user input before continuing.",
5519
+ false
5520
+ ).action(async (options) => {
5521
+ if (options.debug) {
5522
+ const { debug } = await _inquirer2.default.prompt([
5523
+ {
5524
+ type: "confirm",
5525
+ name: "debug",
5526
+ message: "Debug mode. Wait for user input before continuing."
5527
+ }
5528
+ ]);
5529
+ }
5533
5530
  const settings = getSettings(options.apiKey);
5534
5531
  if (!settings.auth.apiKey) {
5535
5532
  console.error("No API key provided");
@@ -5566,19 +5563,15 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
5566
5563
  const { isPullRequestMode } = platformKit.config;
5567
5564
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
5568
5565
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
5569
- try {
5570
- const canRun = await _optionalChain([flow, 'access', _181 => _181.preRun, 'optionalCall', _182 => _182()]);
5571
- if (canRun === false) {
5572
- return;
5573
- }
5574
- const hasChanges = await flow.run();
5575
- if (!hasChanges) {
5576
- return;
5577
- }
5578
- await _optionalChain([flow, 'access', _183 => _183.postRun, 'optionalCall', _184 => _184()]);
5579
- } finally {
5580
- await _optionalChain([flow, 'access', _185 => _185.returnToOriginalBranch, 'optionalCall', _186 => _186()]);
5566
+ const canRun = await _optionalChain([flow, 'access', _181 => _181.preRun, 'optionalCall', _182 => _182()]);
5567
+ if (canRun === false) {
5568
+ return;
5569
+ }
5570
+ const hasChanges = await flow.run();
5571
+ if (!hasChanges) {
5572
+ return;
5581
5573
  }
5574
+ await _optionalChain([flow, 'access', _183 => _183.postRun, 'optionalCall', _184 => _184()]);
5582
5575
  });
5583
5576
 
5584
5577
  // src/cli/cmd/status.ts
@@ -5622,13 +5615,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
5622
5615
  flags
5623
5616
  });
5624
5617
  let buckets = getBuckets(i18nConfig);
5625
- if (_optionalChain([flags, 'access', _187 => _187.bucket, 'optionalAccess', _188 => _188.length])) {
5618
+ if (_optionalChain([flags, 'access', _185 => _185.bucket, 'optionalAccess', _186 => _186.length])) {
5626
5619
  buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
5627
5620
  }
5628
5621
  ora.succeed("Buckets retrieved");
5629
- if (_optionalChain([flags, 'access', _189 => _189.file, 'optionalAccess', _190 => _190.length])) {
5622
+ if (_optionalChain([flags, 'access', _187 => _187.file, 'optionalAccess', _188 => _188.length])) {
5630
5623
  buckets = buckets.map((bucket) => {
5631
- const paths = bucket.paths.filter((path17) => flags.file.find((file) => _optionalChain([path17, 'access', _191 => _191.pathPattern, 'optionalAccess', _192 => _192.match, 'call', _193 => _193(file)])));
5624
+ const paths = bucket.paths.filter((path17) => flags.file.find((file) => _optionalChain([path17, 'access', _189 => _189.pathPattern, 'optionalAccess', _190 => _190.match, 'call', _191 => _191(file)])));
5632
5625
  return { ...bucket, paths };
5633
5626
  }).filter((bucket) => bucket.paths.length > 0);
5634
5627
  if (buckets.length === 0) {
@@ -5644,7 +5637,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
5644
5637
  });
5645
5638
  }
5646
5639
  }
5647
- const targetLocales = _optionalChain([flags, 'access', _194 => _194.locale, 'optionalAccess', _195 => _195.length]) ? flags.locale : i18nConfig.locale.targets;
5640
+ const targetLocales = _optionalChain([flags, 'access', _192 => _192.locale, 'optionalAccess', _193 => _193.length]) ? flags.locale : i18nConfig.locale.targets;
5648
5641
  let totalSourceKeyCount = 0;
5649
5642
  let uniqueKeysToTranslate = 0;
5650
5643
  let totalExistingTranslations = 0;
@@ -5985,12 +5978,12 @@ function validateParams2(i18nConfig, flags) {
5985
5978
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
5986
5979
  docUrl: "bucketNotFound"
5987
5980
  });
5988
- } else if (_optionalChain([flags, 'access', _196 => _196.locale, 'optionalAccess', _197 => _197.some, 'call', _198 => _198((locale) => !i18nConfig.locale.targets.includes(locale))])) {
5981
+ } else if (_optionalChain([flags, 'access', _194 => _194.locale, 'optionalAccess', _195 => _195.some, 'call', _196 => _196((locale) => !i18nConfig.locale.targets.includes(locale))])) {
5989
5982
  throw new CLIError({
5990
5983
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
5991
5984
  docUrl: "localeTargetNotFound"
5992
5985
  });
5993
- } else if (_optionalChain([flags, 'access', _199 => _199.bucket, 'optionalAccess', _200 => _200.some, 'call', _201 => _201((bucket) => !i18nConfig.buckets[bucket])])) {
5986
+ } else if (_optionalChain([flags, 'access', _197 => _197.bucket, 'optionalAccess', _198 => _198.some, 'call', _199 => _199((bucket) => !i18nConfig.buckets[bucket])])) {
5994
5987
  throw new CLIError({
5995
5988
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
5996
5989
  docUrl: "bucketNotFound"
@@ -5998,10 +5991,82 @@ function validateParams2(i18nConfig, flags) {
5998
5991
  }
5999
5992
  }
6000
5993
 
5994
+ // src/cli/cmd/may-the-fourth.ts
5995
+
5996
+
5997
+
5998
+
5999
+
6000
+ var colors = {
6001
+ orange: "#ff6600",
6002
+ green: "#6ae300",
6003
+ blue: "#0090ff",
6004
+ yellow: "#ffcc00",
6005
+ grey: "#808080",
6006
+ red: "#ff0000"
6007
+ };
6008
+ var may_the_fourth_default = new (0, _interactivecommander.Command)().command("may-the-fourth").description("May the Fourth be with you").helpOption("-h, --help", "Show help").action(async () => {
6009
+ await renderClear();
6010
+ await renderBanner();
6011
+ await renderSpacer();
6012
+ console.log(_chalk2.default.hex(colors.yellow)("Loading the Star Wars movie..."));
6013
+ await renderSpacer();
6014
+ await new Promise((resolve, reject) => {
6015
+ const ssh = cp.spawn("ssh", ["starwarstel.net"], {
6016
+ stdio: "inherit"
6017
+ });
6018
+ ssh.on("close", (code) => {
6019
+ if (code !== 0) {
6020
+ console.error(`SSH process exited with code ${code}`);
6021
+ }
6022
+ resolve();
6023
+ });
6024
+ ssh.on("error", (err) => {
6025
+ console.error("Failed to start SSH process:", err);
6026
+ reject(err);
6027
+ });
6028
+ });
6029
+ await renderSpacer();
6030
+ console.log(
6031
+ `${_chalk2.default.hex(colors.green)("We hope you enjoyed it! :)")} ${_chalk2.default.hex(colors.blue)("May the Fourth be with you! \u{1F680}")}`
6032
+ );
6033
+ await renderSpacer();
6034
+ console.log(_chalk2.default.dim(`---`));
6035
+ await renderSpacer();
6036
+ await renderHero();
6037
+ });
6038
+ async function renderClear() {
6039
+ console.log("\x1Bc");
6040
+ }
6041
+ async function renderSpacer() {
6042
+ console.log(" ");
6043
+ }
6044
+ async function renderBanner() {
6045
+ console.log(
6046
+ _gradientstring.vice.call(void 0,
6047
+ _figlet2.default.textSync("LINGO.DEV", {
6048
+ font: "ANSI Shadow",
6049
+ horizontalLayout: "default",
6050
+ verticalLayout: "default"
6051
+ })
6052
+ )
6053
+ );
6054
+ }
6055
+ async function renderHero() {
6056
+ console.log(
6057
+ `\u26A1\uFE0F ${_chalk2.default.hex(colors.green)("Lingo.dev")} - open-source, AI-powered i18n CLI for web & mobile localization.`
6058
+ );
6059
+ console.log(" ");
6060
+ console.log(
6061
+ _chalk2.default.hex(colors.blue)("\u2B50 GitHub Repo: https://lingo.dev/go/gh")
6062
+ );
6063
+ console.log(_chalk2.default.hex(colors.blue)("\u{1F4AC} 24/7 Support: hi@lingo.dev"));
6064
+ }
6065
+
6001
6066
  // package.json
6002
6067
  var package_default = {
6003
6068
  name: "lingo.dev",
6004
- version: "0.90.1",
6069
+ version: "0.90.3",
6005
6070
  description: "Lingo.dev CLI",
6006
6071
  private: false,
6007
6072
  publishConfig: {
@@ -6170,7 +6235,7 @@ ${_gradientstring.vice.call(void 0,
6170
6235
 
6171
6236
  Star the the repo :) https://github.com/LingoDotDev/lingo.dev
6172
6237
  `
6173
- ).version(`v${package_default.version}`, "-v, --version", "Show version").addCommand(init_default).interactive("-y, --no-interactive", "Disable interactive mode").addCommand(i18n_default).addCommand(auth_default).addCommand(show_default).addCommand(lockfile_default).addCommand(cleanup_default).addCommand(mcp_default).addCommand(ci_default).addCommand(status_default).exitOverride((err) => {
6238
+ ).version(`v${package_default.version}`, "-v, --version", "Show version").addCommand(init_default).interactive("-y, --no-interactive", "Disable interactive mode").addCommand(i18n_default).addCommand(auth_default).addCommand(show_default).addCommand(lockfile_default).addCommand(cleanup_default).addCommand(mcp_default).addCommand(ci_default).addCommand(status_default).addCommand(may_the_fourth_default, { hidden: true }).exitOverride((err) => {
6174
6239
  if (err.code === "commander.helpDisplayed" || err.code === "commander.version" || err.code === "commander.help") {
6175
6240
  process.exit(0);
6176
6241
  }