@formatjs/cli 4.4.0 → 4.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/cli",
3
- "version": "4.4.0",
3
+ "version": "4.6.1",
4
4
  "description": "A CLI for formatjs.",
5
5
  "keywords": [
6
6
  "intl",
@@ -31,14 +31,13 @@
31
31
  "url": "git+ssh://git@github.com/formatjs/formatjs.git"
32
32
  },
33
33
  "dependencies": {
34
- "@formatjs/icu-messageformat-parser": "2.0.14",
35
- "@formatjs/ts-transformer": "3.6.0",
34
+ "@formatjs/icu-messageformat-parser": "2.0.16",
35
+ "@formatjs/ts-transformer": "3.8.1",
36
36
  "@types/estree": "^0.0.50",
37
37
  "@types/fs-extra": "^9.0.1",
38
38
  "@types/json-stable-stringify": "^1.0.32",
39
39
  "@types/node": "14",
40
- "@vue/compiler-core": "^3.2.19",
41
- "@vue/compiler-sfc": "^3.2.19",
40
+ "@vue/compiler-core": "^3.2.23",
42
41
  "chalk": "^4.0.0",
43
42
  "commander": "8",
44
43
  "fast-glob": "^3.2.7",
@@ -46,7 +45,8 @@
46
45
  "json-stable-stringify": "^1.0.1",
47
46
  "loud-rejection": "^2.2.0",
48
47
  "tslib": "^2.1.0",
49
- "typescript": "^4.4"
48
+ "typescript": "^4.5",
49
+ "vue": "^3.2.23"
50
50
  },
51
51
  "bugs": {
52
52
  "url": "https://github.com/formatjs/formatjs/issues"
package/src/cli.js CHANGED
@@ -100,7 +100,7 @@ function main(argv) {
100
100
  (0, console_utils_1.debug)('Options:', opts);
101
101
  files = (0, fast_glob_1.sync)(filePattern);
102
102
  if (!files.length) {
103
- throw new Error("No input file found with pattern " + filePattern);
103
+ throw new Error("No input file found with pattern ".concat(filePattern));
104
104
  }
105
105
  (0, console_utils_1.debug)('Files to compile:', files);
106
106
  return [4 /*yield*/, (0, compile_1.default)(files, opts)];
@@ -122,9 +122,9 @@ function main(argv) {
122
122
  case 0:
123
123
  (0, console_utils_1.debug)('Folder:', folder);
124
124
  (0, console_utils_1.debug)('Options:', opts);
125
- files = (0, fast_glob_1.sync)(folder + "/*.json");
125
+ files = (0, fast_glob_1.sync)("".concat(folder, "/*.json"));
126
126
  if (!files.length) {
127
- throw new Error("No JSON file found in " + folder);
127
+ throw new Error("No JSON file found in ".concat(folder));
128
128
  }
129
129
  (0, console_utils_1.debug)('Files to compile:', files);
130
130
  return [4 /*yield*/, (0, compile_folder_1.default)(files, outFolder, opts)];
package/src/compile.js CHANGED
@@ -42,7 +42,7 @@ function compile(inputFiles, opts) {
42
42
  compiled = compiledFiles[i];
43
43
  for (id in compiled) {
44
44
  if (messages[id] && messages[id] !== compiled[id]) {
45
- throw new Error("Conflicting ID \"" + id + "\" with different translation found in these 2 files:\nID: " + id + "\nMessage from " + idsWithFileName[id] + ": " + messages[id] + "\nMessage from " + compiled[id] + ": " + inputFile + "\n");
45
+ throw new Error("Conflicting ID \"".concat(id, "\" with different translation found in these 2 files:\nID: ").concat(id, "\nMessage from ").concat(idsWithFileName[id], ": ").concat(messages[id], "\nMessage from ").concat(compiled[id], ": ").concat(inputFile, "\n"));
46
46
  }
47
47
  try {
48
48
  msgAst = (0, icu_messageformat_parser_1.parse)(compiled[id]);
@@ -20,7 +20,7 @@ function clearLine(terminal) {
20
20
  if (!!chalk_1.supportsColor) return [3 /*break*/, 5];
21
21
  if (!terminal.isTTY) return [3 /*break*/, 4];
22
22
  if (!(terminal.columns > 0)) return [3 /*break*/, 2];
23
- return [4 /*yield*/, (0, exports.writeStderr)("\r" + ' '.repeat(terminal.columns - 1))];
23
+ return [4 /*yield*/, (0, exports.writeStderr)("\r".concat(' '.repeat(terminal.columns - 1)))];
24
24
  case 1:
25
25
  _a.sent();
26
26
  _a.label = 2;
@@ -48,7 +48,7 @@ var LEVEL_COLORS = {
48
48
  error: chalk_1.red,
49
49
  };
50
50
  function label(level, message) {
51
- return "[@formatjs/cli] [" + LEVEL_COLORS[level](level.toUpperCase()) + "] " + message;
51
+ return "[@formatjs/cli] [".concat(LEVEL_COLORS[level](level.toUpperCase()), "] ").concat(message);
52
52
  }
53
53
  function debug(message) {
54
54
  var args = [];
package/src/extract.js CHANGED
@@ -42,7 +42,7 @@ function processFile(source, fn, _a) {
42
42
  resourcePath: fileName,
43
43
  }, idInterpolationPattern, {
44
44
  content: description
45
- ? defaultMessage + "#" + description
45
+ ? "".concat(defaultMessage, "#").concat(description)
46
46
  : defaultMessage,
47
47
  });
48
48
  } });
@@ -130,7 +130,7 @@ function extract(files, extractOpts) {
130
130
  message = messages_1[_a];
131
131
  id = message.id, description = message.description, defaultMessage = message.defaultMessage;
132
132
  if (!id) {
133
- error = new Error("[FormatJS CLI] Missing message id for message: \n" + JSON.stringify(message, undefined, 2));
133
+ error = new Error("[FormatJS CLI] Missing message id for message: \n".concat(JSON.stringify(message, undefined, 2)));
134
134
  if (throws) {
135
135
  throw error;
136
136
  }
@@ -143,7 +143,7 @@ function extract(files, extractOpts) {
143
143
  existing = extractedMessages.get(id);
144
144
  if (description !== existing.description ||
145
145
  defaultMessage !== existing.defaultMessage) {
146
- error = new Error("[FormatJS CLI] Duplicate message id: \"" + id + "\", " +
146
+ error = new Error("[FormatJS CLI] Duplicate message id: \"".concat(id, "\", ") +
147
147
  'but the `description` and/or `defaultMessage` are different.');
148
148
  if (throws) {
149
149
  throw error;
@@ -35,7 +35,7 @@ function resolveBuiltinFormatter(format) {
35
35
  return [2 /*return*/, Promise.resolve().then(function () { return (0, tslib_1.__importStar)(require((0, path_1.resolve)(process.cwd(), format))); })];
36
36
  }
37
37
  catch (e) {
38
- console.error("Cannot resolve formatter " + format);
38
+ console.error("Cannot resolve formatter ".concat(format));
39
39
  throw e;
40
40
  }
41
41
  return [2 /*return*/];
@@ -31,7 +31,7 @@ function parseScript(opts, fn) {
31
31
  }
32
32
  catch (e) {
33
33
  if (e instanceof Error) {
34
- e.message = "Error processing file " + fn + " \n" + (e.message || '');
34
+ e.message = "Error processing file ".concat(fn, " \n").concat(e.message || '');
35
35
  }
36
36
  throw e;
37
37
  }
@@ -87,7 +87,7 @@ function generateENXB(msg) {
87
87
  return canPad ? ACCENTED_ASCII[i].repeat(3) : ACCENTED_ASCII[i];
88
88
  })
89
89
  .join('');
90
- el.value = "[!! " + pseudoString + " !!]";
90
+ el.value = "[!! ".concat(pseudoString, " !!]");
91
91
  }
92
92
  else if ((0, icu_messageformat_parser_1.isPluralElement)(el) || (0, icu_messageformat_parser_1.isSelectElement)(el)) {
93
93
  for (var _i = 0, _a = Object.values(el.options); _i < _a.length; _i++) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseFile = void 0;
4
- var compiler_sfc_1 = require("@vue/compiler-sfc");
4
+ var compiler_sfc_1 = require("vue/compiler-sfc");
5
5
  function walk(node, visitor) {
6
6
  if (typeof node !== 'object') {
7
7
  return;
@@ -38,7 +38,7 @@ function templateSimpleExpressionNodeVisitor(parseScriptFn) {
38
38
  // Wrap this in () since a vue comp node attribute can just be
39
39
  // an object literal which, by itself is invalid TS
40
40
  // but with () it becomes an ExpressionStatement
41
- parseScriptFn("(" + content + ")");
41
+ parseScriptFn("(".concat(content, ")"));
42
42
  };
43
43
  }
44
44
  function parseFile(source, filename, parseScriptFn) {