locize-cli 12.0.3 → 12.0.5

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/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
5
5
  Project versioning adheres to [Semantic Versioning](http://semver.org/).
6
6
  Change log format is based on [Keep a Changelog](http://keepachangelog.com/).
7
7
 
8
+ ## [12.0.5](https://github.com/locize/locize-cli/compare/v12.0.4...v12.0.5) - 2026-02-23
9
+
10
+ - improve download of namespaces with strange content-type
11
+
12
+ ## [12.0.4](https://github.com/locize/locize-cli/compare/v12.0.3...v12.0.4) - 2026-01-23
13
+
14
+ - update dependencies
15
+
8
16
  ## [12.0.3](https://github.com/locize/locize-cli/compare/v12.0.2...v12.0.3) - 2026-01-20
9
17
 
10
18
  - update dependencies
package/dist/cjs/cli.js CHANGED
@@ -50,7 +50,7 @@ const program = new commander.Command();
50
50
 
51
51
  program
52
52
  .description('The official locize CLI.')
53
- .version('12.0.3'); // This string is replaced with the actual version at build time by rollup
53
+ .version('12.0.5'); // This string is replaced with the actual version at build time by rollup
54
54
  // .option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
55
55
  // .option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`);
56
56
 
@@ -280,7 +280,7 @@ async function continueToDownload (opt) {
280
280
  console.log(colors.yellow(`downloading ${url} to ${opt.path}...`));
281
281
  await getRemoteLanguages(opt);
282
282
  if (!opt.unpublished) {
283
- const { res, obj, err } = await request(url, {
283
+ let { res, obj, err } = await request(url, {
284
284
  method: 'get',
285
285
  headers: opt.apiKey
286
286
  ? {
@@ -291,10 +291,12 @@ async function continueToDownload (opt) {
291
291
  let downloadsObj = obj;
292
292
  if (res && res.status === 401) {
293
293
  opt.apiKey = null;
294
- const { obj: obj2 } = await request(url, {
294
+ const { res: res2, obj: obj2, err: err2 } = await request(url, {
295
295
  method: 'get',
296
296
  });
297
297
  downloadsObj = obj2;
298
+ res = res2;
299
+ err = err2;
298
300
  }
299
301
  downloadsObj = filterDownloads(opt, downloadsObj || []);
300
302
  if (downloadsObj.length > 0) {
@@ -117,7 +117,7 @@ const getRemoteNamespace = async (opt, lng, ns) => {
117
117
  throw new Error(res.statusText + ' (' + res.status + ')')
118
118
  }
119
119
  return {
120
- result: sortFlatResources(flatten(obj)),
120
+ result: sortFlatResources(flatten(obj || {})),
121
121
  lastModified: res.headers.get('last-modified') ? new Date(res.headers.get('last-modified')) : undefined
122
122
  }
123
123
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "locize-cli",
3
- "version": "12.0.3",
3
+ "version": "12.0.5",
4
4
  "type": "commonjs"
5
5
  }
@@ -21,9 +21,10 @@ const isRetriableError = (err) => {
21
21
  };
22
22
 
23
23
  const isJSONResponse = (res) => res.headers.get('content-type') && res.headers.get('content-type').indexOf('json') > 0;
24
+ const isOctetStream = (res) => res.headers.get('content-type') && res.headers.get('content-type').indexOf('octet-stream') > 0;
24
25
 
25
26
  const handleResponse = (res) => {
26
- if (isJSONResponse(res)) {
27
+ if (isJSONResponse(res) || isOctetStream(res)) {
27
28
  return new Promise((resolve, reject) => res.json().then((obj) => resolve({ res, obj })).catch(reject))
28
29
  } else {
29
30
  return { res }
@@ -38,7 +39,7 @@ async function request (url, options) {
38
39
  }
39
40
 
40
41
  options.headers = options.headers || {};
41
- options.headers['User-Agent'] = `locize-cli/v12.0.3 (node/${process.version}; ${process.platform} ${process.arch})`; // This string is replaced with the actual version at build time by rollup
42
+ options.headers['User-Agent'] = `locize-cli/v12.0.5 (node/${process.version}; ${process.platform} ${process.arch})`; // This string is replaced with the actual version at build time by rollup
42
43
  options.headers['X-User-Agent'] = options.headers['User-Agent'];
43
44
  if (options.body || options.method !== 'get') options.headers['Content-Type'] = 'application/json';
44
45
  if (options.body) {
package/dist/esm/cli.js CHANGED
@@ -48,7 +48,7 @@ const program = new Command();
48
48
 
49
49
  program
50
50
  .description('The official locize CLI.')
51
- .version('12.0.3'); // This string is replaced with the actual version at build time by rollup
51
+ .version('12.0.5'); // This string is replaced with the actual version at build time by rollup
52
52
  // .option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
53
53
  // .option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`);
54
54
 
@@ -278,7 +278,7 @@ async function continueToDownload (opt) {
278
278
  console.log(colors.yellow(`downloading ${url} to ${opt.path}...`));
279
279
  await getRemoteLanguages(opt);
280
280
  if (!opt.unpublished) {
281
- const { res, obj, err } = await request(url, {
281
+ let { res, obj, err } = await request(url, {
282
282
  method: 'get',
283
283
  headers: opt.apiKey
284
284
  ? {
@@ -289,10 +289,12 @@ async function continueToDownload (opt) {
289
289
  let downloadsObj = obj;
290
290
  if (res && res.status === 401) {
291
291
  opt.apiKey = null;
292
- const { obj: obj2 } = await request(url, {
292
+ const { res: res2, obj: obj2, err: err2 } = await request(url, {
293
293
  method: 'get',
294
294
  });
295
295
  downloadsObj = obj2;
296
+ res = res2;
297
+ err = err2;
296
298
  }
297
299
  downloadsObj = filterDownloads(opt, downloadsObj || []);
298
300
  if (downloadsObj.length > 0) {
@@ -115,7 +115,7 @@ const getRemoteNamespace = async (opt, lng, ns) => {
115
115
  throw new Error(res.statusText + ' (' + res.status + ')')
116
116
  }
117
117
  return {
118
- result: sortFlatResources(flatten(obj)),
118
+ result: sortFlatResources(flatten(obj || {})),
119
119
  lastModified: res.headers.get('last-modified') ? new Date(res.headers.get('last-modified')) : undefined
120
120
  }
121
121
  };
@@ -19,9 +19,10 @@ const isRetriableError = (err) => {
19
19
  };
20
20
 
21
21
  const isJSONResponse = (res) => res.headers.get('content-type') && res.headers.get('content-type').indexOf('json') > 0;
22
+ const isOctetStream = (res) => res.headers.get('content-type') && res.headers.get('content-type').indexOf('octet-stream') > 0;
22
23
 
23
24
  const handleResponse = (res) => {
24
- if (isJSONResponse(res)) {
25
+ if (isJSONResponse(res) || isOctetStream(res)) {
25
26
  return new Promise((resolve, reject) => res.json().then((obj) => resolve({ res, obj })).catch(reject))
26
27
  } else {
27
28
  return { res }
@@ -36,7 +37,7 @@ async function request (url, options) {
36
37
  }
37
38
 
38
39
  options.headers = options.headers || {};
39
- options.headers['User-Agent'] = `locize-cli/v12.0.3 (node/${process.version}; ${process.platform} ${process.arch})`; // This string is replaced with the actual version at build time by rollup
40
+ options.headers['User-Agent'] = `locize-cli/v12.0.5 (node/${process.version}; ${process.platform} ${process.arch})`; // This string is replaced with the actual version at build time by rollup
40
41
  options.headers['X-User-Agent'] = options.headers['User-Agent'];
41
42
  if (options.body || options.method !== 'get') options.headers['Content-Type'] = 'application/json';
42
43
  if (options.body) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "locize-cli",
3
- "version": "12.0.3",
3
+ "version": "12.0.5",
4
4
  "description": "locize cli to import locales",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -35,7 +35,7 @@
35
35
  "fast-csv": "5.0.5",
36
36
  "flat": "5.0.2",
37
37
  "fluent_conv": "3.3.0",
38
- "gettext-converter": "1.3.0",
38
+ "gettext-converter": "1.3.1",
39
39
  "https-proxy-agent": "7.0.6",
40
40
  "ini": "6.0.0",
41
41
  "laravelphp": "2.0.4",
@@ -46,7 +46,7 @@
46
46
  "rimraf": "6.1.2",
47
47
  "strings-file": "0.0.5",
48
48
  "tmexchange": "2.0.6",
49
- "xliff": "6.2.2",
49
+ "xliff": "6.3.0",
50
50
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
51
51
  "yaml": "2.8.2"
52
52
  },
@@ -58,8 +58,8 @@
58
58
  "eslint-plugin-import": "2.32.0",
59
59
  "gh-release": "7.0.2",
60
60
  "neostandard": "0.12.2",
61
- "rollup": "4.55.2",
62
- "vitest": "4.0.17"
61
+ "rollup": "4.56.0",
62
+ "vitest": "4.0.18"
63
63
  },
64
64
  "scripts": {
65
65
  "lint": "eslint .",