i18next-cli 1.58.0 → 1.58.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/dist/cjs/cli.js CHANGED
@@ -32,7 +32,7 @@ const program = new commander.Command();
32
32
  program
33
33
  .name('i18next-cli')
34
34
  .description('A unified, high-performance i18next CLI.')
35
- .version('1.58.0'); // This string is replaced with the actual version at build time by rollup
35
+ .version('1.58.1'); // This string is replaced with the actual version at build time by rollup
36
36
  // new: global config override option
37
37
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
38
38
  program
@@ -9,6 +9,8 @@ var promises = require('node:fs/promises');
9
9
  var node_path = require('node:path');
10
10
  var core = require('@swc/core');
11
11
  var fileUtils = require('./utils/file-utils.js');
12
+ var json5Parser = require('@croct/json5-parser');
13
+ var yaml = require('yaml');
12
14
  var vm = require('node:vm');
13
15
 
14
16
  async function loadFile(file) {
@@ -43,6 +45,12 @@ async function loadFile(file) {
43
45
  return exported;
44
46
  }
45
47
  const content = await promises.readFile(file, 'utf-8');
48
+ if (ext === '.yaml' || ext === '.yml') {
49
+ return yaml.parse(content);
50
+ }
51
+ if (ext === '.json5') {
52
+ return json5Parser.JsonParser.parse(content, json5Parser.JsonObjectNode).toJSON();
53
+ }
46
54
  return JSON.parse(content);
47
55
  }
48
56
  /**
package/dist/esm/cli.js CHANGED
@@ -30,7 +30,7 @@ const program = new Command();
30
30
  program
31
31
  .name('i18next-cli')
32
32
  .description('A unified, high-performance i18next CLI.')
33
- .version('1.58.0'); // This string is replaced with the actual version at build time by rollup
33
+ .version('1.58.1'); // This string is replaced with the actual version at build time by rollup
34
34
  // new: global config override option
35
35
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
36
36
  program
@@ -7,6 +7,8 @@ import { mkdir, writeFile, access, readFile } from 'node:fs/promises';
7
7
  import { join, dirname, basename, extname, resolve, relative } from 'node:path';
8
8
  import { transform } from '@swc/core';
9
9
  import { getOutputPath } from './utils/file-utils.js';
10
+ import { JsonParser, JsonObjectNode } from '@croct/json5-parser';
11
+ import yaml from 'yaml';
10
12
  import vm from 'node:vm';
11
13
 
12
14
  async function loadFile(file) {
@@ -41,6 +43,12 @@ async function loadFile(file) {
41
43
  return exported;
42
44
  }
43
45
  const content = await readFile(file, 'utf-8');
46
+ if (ext === '.yaml' || ext === '.yml') {
47
+ return yaml.parse(content);
48
+ }
49
+ if (ext === '.json5') {
50
+ return JsonParser.parse(content, JsonObjectNode).toJSON();
51
+ }
44
52
  return JSON.parse(content);
45
53
  }
46
54
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-cli",
3
- "version": "1.58.0",
3
+ "version": "1.58.1",
4
4
  "description": "A unified, high-performance i18next CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +1 @@
1
- {"version":3,"file":"types-generator.d.ts","sourceRoot":"","sources":["../src/types-generator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAqE9D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,iBA+GnD"}
1
+ {"version":3,"file":"types-generator.d.ts","sourceRoot":"","sources":["../src/types-generator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AA6E9D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,iBA+GnD"}