@formatjs/cli-lib 6.1.1 → 6.1.2
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/index.d.ts +0 -1
- package/main.d.ts +0 -1
- package/package.json +3 -3
- package/src/cli.d.ts +0 -1
- package/src/compile.d.ts +0 -1
- package/src/compile_folder.d.ts +0 -1
- package/src/console_utils.d.ts +0 -1
- package/src/extract.d.ts +0 -1
- package/src/formatters/crowdin.d.ts +0 -1
- package/src/formatters/default.d.ts +0 -1
- package/src/formatters/index.d.ts +0 -1
- package/src/formatters/lokalise.d.ts +0 -1
- package/src/formatters/simple.d.ts +0 -1
- package/src/formatters/smartling.d.ts +0 -1
- package/src/formatters/transifex.d.ts +0 -1
- package/src/parse_script.d.ts +0 -1
- package/src/pseudo_locale.d.ts +0 -1
- package/src/vue_extractor.d.ts +0 -1
- package/src/vue_extractor.js +14 -7
package/index.d.ts
CHANGED
|
@@ -5,4 +5,3 @@ export type { FormatFn, CompileFn } from './src/formatters/default';
|
|
|
5
5
|
export type { Element, Comparator } from 'json-stable-stringify';
|
|
6
6
|
export { default as compileAndWrite, compile } from './src/compile';
|
|
7
7
|
export type { CompileCLIOpts, Opts as CompileOpts } from './src/compile';
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
package/main.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/cli-lib",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.2",
|
|
4
4
|
"description": "Lib for CLI for formatjs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intl",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"url": "https://github.com/formatjs/formatjs/issues"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@formatjs/icu-messageformat-parser": "2.
|
|
35
|
-
"@formatjs/ts-transformer": "3.13.
|
|
34
|
+
"@formatjs/icu-messageformat-parser": "2.5.0",
|
|
35
|
+
"@formatjs/ts-transformer": "3.13.2",
|
|
36
36
|
"@types/estree": "^0.0.50",
|
|
37
37
|
"@types/fs-extra": "^9.0.1",
|
|
38
38
|
"@types/json-stable-stringify": "^1.0.32",
|
package/src/cli.d.ts
CHANGED
package/src/compile.d.ts
CHANGED
|
@@ -45,4 +45,3 @@ export declare function compile(inputFiles: string[], opts?: Opts): Promise<stri
|
|
|
45
45
|
* @returns A `Promise` that resolves if file was written successfully
|
|
46
46
|
*/
|
|
47
47
|
export default function compileAndWrite(inputFiles: string[], compileOpts?: CompileCLIOpts): Promise<void>;
|
|
48
|
-
//# sourceMappingURL=compile.d.ts.map
|
package/src/compile_folder.d.ts
CHANGED
package/src/console_utils.d.ts
CHANGED
|
@@ -7,4 +7,3 @@ export declare function debug(message: string, ...args: any[]): Promise<void>;
|
|
|
7
7
|
export declare function warn(message: string, ...args: any[]): Promise<void>;
|
|
8
8
|
export declare function error(message: string, ...args: any[]): Promise<void>;
|
|
9
9
|
export declare function getStdinAsString(): Promise<string>;
|
|
10
|
-
//# sourceMappingURL=console_utils.d.ts.map
|
package/src/extract.d.ts
CHANGED
|
@@ -72,4 +72,3 @@ export declare function extract(files: readonly string[], extractOpts: ExtractOp
|
|
|
72
72
|
* @returns A Promise that resolves if output file was written successfully
|
|
73
73
|
*/
|
|
74
74
|
export default function extractAndWrite(files: readonly string[], extractOpts: ExtractCLIOptions): Promise<void>;
|
|
75
|
-
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -3,4 +3,3 @@ export type FormatFn<T = Record<string, MessageDescriptor>> = (msgs: Record<stri
|
|
|
3
3
|
export type CompileFn<T = Record<string, MessageDescriptor>> = (msgs: T) => Record<string, string>;
|
|
4
4
|
export declare const format: FormatFn;
|
|
5
5
|
export declare const compile: CompileFn;
|
|
6
|
-
//# sourceMappingURL=default.d.ts.map
|
package/src/parse_script.d.ts
CHANGED
package/src/pseudo_locale.d.ts
CHANGED
|
@@ -20,4 +20,3 @@ export declare function generateENXA(msg: string | MessageFormatElement[]): Mess
|
|
|
20
20
|
* directionality will also be set to right-to-left.
|
|
21
21
|
*/
|
|
22
22
|
export declare function generateENXB(msg: string | MessageFormatElement[]): MessageFormatElement[];
|
|
23
|
-
//# sourceMappingURL=pseudo_locale.d.ts.map
|
package/src/vue_extractor.d.ts
CHANGED
package/src/vue_extractor.js
CHANGED
|
@@ -2,23 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseFile = void 0;
|
|
4
4
|
const compiler_sfc_1 = require("@vue/compiler-sfc");
|
|
5
|
+
// Duplicate `NodeTypes` here because they are defined as
|
|
6
|
+
// const enum, which does not work with swc transpilation: https://github.com/vuejs/core/issues/1228
|
|
7
|
+
const ELEMENT = 1;
|
|
8
|
+
const SIMPLE_EXPRESSION = 4;
|
|
9
|
+
const INTERPOLATION = 5;
|
|
10
|
+
const DIRECTIVE = 7;
|
|
11
|
+
const COMPOUND_EXPRESSION = 8;
|
|
5
12
|
function walk(node, visitor) {
|
|
6
13
|
if (typeof node !== 'object') {
|
|
7
14
|
return;
|
|
8
15
|
}
|
|
9
|
-
if (node.type !==
|
|
10
|
-
node.type !==
|
|
11
|
-
node.type !==
|
|
16
|
+
if (node.type !== ELEMENT &&
|
|
17
|
+
node.type !== COMPOUND_EXPRESSION &&
|
|
18
|
+
node.type !== INTERPOLATION) {
|
|
12
19
|
return;
|
|
13
20
|
}
|
|
14
21
|
visitor(node);
|
|
15
|
-
if (node.type ===
|
|
22
|
+
if (node.type === INTERPOLATION) {
|
|
16
23
|
visitor(node.content);
|
|
17
24
|
}
|
|
18
|
-
else if (node.type ===
|
|
25
|
+
else if (node.type === ELEMENT) {
|
|
19
26
|
node.children.forEach(n => walk(n, visitor));
|
|
20
27
|
node.props
|
|
21
|
-
.filter((prop) => prop.type ===
|
|
28
|
+
.filter((prop) => prop.type === DIRECTIVE)
|
|
22
29
|
.filter(prop => !!prop.exp)
|
|
23
30
|
.forEach(prop => visitor(prop.exp));
|
|
24
31
|
}
|
|
@@ -31,7 +38,7 @@ function templateSimpleExpressionNodeVisitor(parseScriptFn) {
|
|
|
31
38
|
if (typeof n !== 'object') {
|
|
32
39
|
return;
|
|
33
40
|
}
|
|
34
|
-
if (n.type !==
|
|
41
|
+
if (n.type !== SIMPLE_EXPRESSION) {
|
|
35
42
|
return;
|
|
36
43
|
}
|
|
37
44
|
const { content } = n;
|