@tolgee/cli 2.1.0 → 2.1.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.
@@ -19,6 +19,8 @@ export const generalMapper = (token) => {
|
|
19
19
|
case 'string.quoted.single.ts':
|
20
20
|
case 'string.quoted.double.ts':
|
21
21
|
return 'string.body';
|
22
|
+
case 'constant.character.escape.ts':
|
23
|
+
return 'escaped.character';
|
22
24
|
// template strings
|
23
25
|
case 'punctuation.definition.string.template.begin.ts':
|
24
26
|
return 'string.teplate.begin';
|
@@ -14,7 +14,7 @@ function keyInfoFromComment(context, line) {
|
|
14
14
|
context.unusedComments.delete(commentAtLine);
|
15
15
|
return {
|
16
16
|
keyName: commentAtLine.keyName,
|
17
|
-
namespace: commentAtLine.namespace,
|
17
|
+
namespace: commentAtLine.namespace ?? context.options.defaultNamespace,
|
18
18
|
defaultValue: commentAtLine.defaultValue,
|
19
19
|
line: commentAtLine.line,
|
20
20
|
};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import unescape from 'unescape-js';
|
1
2
|
export const stringMerger = {
|
2
3
|
initial: 0 /* S.Idle */,
|
3
4
|
step: (state, token, end) => {
|
@@ -8,43 +9,47 @@ export const stringMerger = {
|
|
8
9
|
return 1 /* S.RegularString */;
|
9
10
|
}
|
10
11
|
else if (type === 'string.teplate.begin') {
|
11
|
-
return
|
12
|
+
return 2 /* S.TemplateString */;
|
12
13
|
}
|
13
14
|
break;
|
14
15
|
case 1 /* S.RegularString */:
|
15
16
|
if (type === 'string.body') {
|
16
|
-
return
|
17
|
+
return 1 /* S.RegularString */;
|
17
18
|
}
|
18
|
-
else if (type === '
|
19
|
-
return
|
19
|
+
else if (type === 'escaped.character') {
|
20
|
+
return 1 /* S.RegularString */;
|
20
21
|
}
|
21
|
-
|
22
|
-
case 2 /* S.RegularStringEnd */:
|
23
|
-
if (type === 'string.end') {
|
22
|
+
else if (type === 'string.end') {
|
24
23
|
return end.MERGE_ALL;
|
25
24
|
}
|
26
25
|
break;
|
27
|
-
case
|
26
|
+
case 2 /* S.TemplateString */:
|
28
27
|
if (type === 'string.template.body') {
|
29
|
-
return
|
28
|
+
return 2 /* S.TemplateString */;
|
29
|
+
}
|
30
|
+
else if (type === 'escaped.character') {
|
31
|
+
return 2 /* S.TemplateString */;
|
30
32
|
}
|
31
33
|
else if (type === 'string.template.end') {
|
32
34
|
return end.MERGE_ALL;
|
33
35
|
}
|
34
36
|
break;
|
35
|
-
case 4 /* S.TemplateStringEnd */:
|
36
|
-
if (type === 'string.template.end') {
|
37
|
-
return end.MERGE_ALL;
|
38
|
-
}
|
39
37
|
}
|
40
38
|
},
|
41
39
|
customType: 'string',
|
42
40
|
resultToken: (matched) => {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
41
|
+
const escaped = matched
|
42
|
+
.map((t) => {
|
43
|
+
switch (t.customType) {
|
44
|
+
case 'string.template.body':
|
45
|
+
case 'string.body':
|
46
|
+
case 'escaped.character':
|
47
|
+
return t.token;
|
48
|
+
default:
|
49
|
+
return '';
|
50
|
+
}
|
51
|
+
})
|
52
|
+
.join('');
|
53
|
+
return unescape(escaped);
|
49
54
|
},
|
50
55
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tolgee/cli",
|
3
|
-
"version": "2.1.
|
3
|
+
"version": "2.1.1",
|
4
4
|
"type": "module",
|
5
5
|
"description": "A tool to interact with the Tolgee Platform through CLI",
|
6
6
|
"repository": {
|
@@ -37,6 +37,7 @@
|
|
37
37
|
"json5": "^2.2.3",
|
38
38
|
"jsonschema": "^1.4.1",
|
39
39
|
"openapi-fetch": "^0.9.7",
|
40
|
+
"unescape-js": "^1.1.4",
|
40
41
|
"vscode-oniguruma": "^1.7.0",
|
41
42
|
"vscode-textmate": "^9.0.0",
|
42
43
|
"yauzl": "^2.10.0"
|