@formatjs/cli-lib 8.0.8 → 8.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.
Files changed (40) hide show
  1. package/index.d.ts +7 -7
  2. package/index.js +2 -2
  3. package/main.d.ts +0 -1
  4. package/main.js +1 -1
  5. package/package.json +5 -5
  6. package/src/cli.js +99 -153
  7. package/src/compile.d.ts +45 -45
  8. package/src/compile.js +79 -80
  9. package/src/compile_folder.d.ts +1 -1
  10. package/src/compile_folder.js +6 -6
  11. package/src/console_utils.d.ts +3 -1
  12. package/src/console_utils.js +44 -46
  13. package/src/extract.d.ts +68 -68
  14. package/src/extract.js +165 -182
  15. package/src/formatters/crowdin.d.ts +3 -3
  16. package/src/formatters/crowdin.js +19 -20
  17. package/src/formatters/default.d.ts +1 -1
  18. package/src/formatters/default.js +8 -7
  19. package/src/formatters/index.d.ts +6 -6
  20. package/src/formatters/index.js +29 -34
  21. package/src/formatters/lokalise.d.ts +5 -5
  22. package/src/formatters/lokalise.js +16 -17
  23. package/src/formatters/simple.d.ts +1 -1
  24. package/src/formatters/simple.js +7 -6
  25. package/src/formatters/smartling.d.ts +13 -15
  26. package/src/formatters/smartling.js +35 -40
  27. package/src/formatters/transifex.d.ts +5 -5
  28. package/src/formatters/transifex.js +16 -17
  29. package/src/gts_extractor.js +11 -11
  30. package/src/hbs_extractor.js +34 -41
  31. package/src/parse_script.d.ts +5 -5
  32. package/src/parse_script.js +40 -43
  33. package/src/pseudo_locale.d.ts +15 -15
  34. package/src/pseudo_locale.js +210 -94
  35. package/src/verify/checkExtraKeys.js +28 -32
  36. package/src/verify/checkMissingKeys.js +29 -33
  37. package/src/verify/checkStructuralEquality.js +67 -71
  38. package/src/verify/index.d.ts +5 -5
  39. package/src/verify/index.js +24 -27
  40. package/src/vue_extractor.js +52 -62
package/src/extract.js CHANGED
@@ -1,194 +1,177 @@
1
- import { interpolateName, } from '@formatjs/ts-transformer';
2
- import { outputFile } from 'fs-extra/esm';
3
- import { debug, getStdinAsString, warn, writeStdout } from './console_utils.js';
4
- import * as stringifyNs from 'json-stable-stringify';
5
- import { parse } from '@formatjs/icu-messageformat-parser';
6
- import { hoistSelectors } from '@formatjs/icu-messageformat-parser/manipulator.js';
7
- import { printAST } from '@formatjs/icu-messageformat-parser/printer.js';
8
- import { resolveBuiltinFormatter } from './formatters/index.js';
9
- import { parseScript } from './parse_script.js';
10
- import { readFile } from 'fs/promises';
1
+ import { interpolateName } from "@formatjs/ts-transformer";
2
+ import { outputFile } from "fs-extra/esm";
3
+ import { debug, getStdinAsString, warn, writeStdout } from "./console_utils.js";
4
+ import * as stringifyNs from "json-stable-stringify";
5
+ import { resolveBuiltinFormatter } from "./formatters/index.js";
6
+ import { parseScript } from "./parse_script.js";
7
+ import { readFile } from "fs/promises";
11
8
  const stringify = stringifyNs.default || stringifyNs;
12
9
  function calculateLineColFromOffset(text, start) {
13
- if (!start) {
14
- return { line: 1, col: 1 };
15
- }
16
- const chunk = text.slice(0, start);
17
- const lines = chunk.split('\n');
18
- const lastLine = lines[lines.length - 1];
19
- return { line: lines.length, col: lastLine.length };
10
+ if (!start) {
11
+ return {
12
+ line: 1,
13
+ col: 1
14
+ };
15
+ }
16
+ const chunk = text.slice(0, start);
17
+ const lines = chunk.split("\n");
18
+ const lastLine = lines[lines.length - 1];
19
+ return {
20
+ line: lines.length,
21
+ col: lastLine.length
22
+ };
20
23
  }
21
24
  async function processFile(source, fn, { idInterpolationPattern, ...opts }) {
22
- let messages = [];
23
- let meta;
24
- const onMsgExtracted = opts.onMsgExtracted;
25
- const onMetaExtracted = opts.onMetaExtracted;
26
- opts = {
27
- ...opts,
28
- additionalComponentNames: [
29
- '$formatMessage',
30
- ...(opts.additionalComponentNames || []),
31
- ],
32
- onMsgExtracted(filePath, msgs) {
33
- if (opts.extractSourceLocation) {
34
- msgs = msgs.map(msg => ({
35
- ...msg,
36
- ...calculateLineColFromOffset(source, msg.start),
37
- }));
38
- }
39
- messages = messages.concat(msgs);
40
- if (onMsgExtracted) {
41
- onMsgExtracted(filePath, msgs);
42
- }
43
- },
44
- onMetaExtracted(filePath, m) {
45
- meta = m;
46
- if (onMetaExtracted) {
47
- onMetaExtracted(filePath, m);
48
- }
49
- },
50
- };
51
- if (!opts.overrideIdFn && idInterpolationPattern) {
52
- opts = {
53
- ...opts,
54
- overrideIdFn: (id, defaultMessage, description, fileName) => id ||
55
- interpolateName({
56
- resourcePath: fileName,
57
- }, idInterpolationPattern, {
58
- content: description
59
- ? `${defaultMessage}#${typeof description === 'string'
60
- ? description
61
- : stringify(description)}`
62
- : defaultMessage,
63
- }),
64
- };
65
- }
66
- debug('Processing opts for %s: %s', fn, opts);
67
- const scriptParseFn = parseScript(opts, fn);
68
- if (fn.endsWith('.vue')) {
69
- debug('Processing %s using vue extractor', fn);
70
- const { parseFile } = await import('./vue_extractor.js');
71
- parseFile(source, fn, scriptParseFn);
72
- }
73
- else if (fn.endsWith('.hbs')) {
74
- debug('Processing %s using hbs extractor', fn);
75
- const { parseFile } = await import('./hbs_extractor.js');
76
- parseFile(source, fn, opts);
77
- }
78
- else if (fn.endsWith('.gts') || fn.endsWith('.gjs')) {
79
- debug('Processing %s as gts/gjs file', fn);
80
- const { parseFile } = await import('./gts_extractor.js');
81
- parseFile(source, fn, opts);
82
- }
83
- else {
84
- debug('Processing %s using typescript extractor', fn);
85
- scriptParseFn(source);
86
- }
87
- debug('Done extracting %s messages: %s', fn, messages);
88
- if (meta) {
89
- debug('Extracted meta:', meta);
90
- messages.forEach(m => (m.meta = meta));
91
- }
92
- return { messages, meta };
25
+ let messages = [];
26
+ let meta;
27
+ const onMsgExtracted = opts.onMsgExtracted;
28
+ const onMetaExtracted = opts.onMetaExtracted;
29
+ opts = {
30
+ ...opts,
31
+ additionalComponentNames: ["$formatMessage", ...opts.additionalComponentNames || []],
32
+ onMsgExtracted(filePath, msgs) {
33
+ if (opts.extractSourceLocation) {
34
+ msgs = msgs.map((msg) => ({
35
+ ...msg,
36
+ ...calculateLineColFromOffset(source, msg.start)
37
+ }));
38
+ }
39
+ messages = messages.concat(msgs);
40
+ if (onMsgExtracted) {
41
+ onMsgExtracted(filePath, msgs);
42
+ }
43
+ },
44
+ onMetaExtracted(filePath, m) {
45
+ meta = m;
46
+ if (onMetaExtracted) {
47
+ onMetaExtracted(filePath, m);
48
+ }
49
+ }
50
+ };
51
+ if (!opts.overrideIdFn && idInterpolationPattern) {
52
+ opts = {
53
+ ...opts,
54
+ overrideIdFn: (id, defaultMessage, description, fileName) => id || interpolateName({ resourcePath: fileName }, idInterpolationPattern, { content: description ? `${defaultMessage}#${typeof description === "string" ? description : stringify(description)}` : defaultMessage })
55
+ };
56
+ }
57
+ debug("Processing opts for %s: %s", fn, opts);
58
+ const scriptParseFn = parseScript(opts, fn);
59
+ if (fn.endsWith(".vue")) {
60
+ debug("Processing %s using vue extractor", fn);
61
+ const { parseFile } = await import("./vue_extractor.js");
62
+ parseFile(source, fn, scriptParseFn);
63
+ } else if (fn.endsWith(".hbs")) {
64
+ debug("Processing %s using hbs extractor", fn);
65
+ const { parseFile } = await import("./hbs_extractor.js");
66
+ parseFile(source, fn, opts);
67
+ } else if (fn.endsWith(".gts") || fn.endsWith(".gjs")) {
68
+ debug("Processing %s as gts/gjs file", fn);
69
+ const { parseFile } = await import("./gts_extractor.js");
70
+ parseFile(source, fn, opts);
71
+ } else {
72
+ debug("Processing %s using typescript extractor", fn);
73
+ scriptParseFn(source);
74
+ }
75
+ debug("Done extracting %s messages: %s", fn, messages);
76
+ if (meta) {
77
+ debug("Extracted meta:", meta);
78
+ messages.forEach((m) => m.meta = meta);
79
+ }
80
+ return {
81
+ messages,
82
+ meta
83
+ };
93
84
  }
94
85
  /**
95
- * Extract strings from source files
96
- * @param files list of files
97
- * @param extractOpts extract options
98
- * @returns messages serialized as JSON string since key order
99
- * matters for some `format`
100
- */
86
+ * Extract strings from source files
87
+ * @param files list of files
88
+ * @param extractOpts extract options
89
+ * @returns messages serialized as JSON string since key order
90
+ * matters for some `format`
91
+ */
101
92
  export async function extract(files, extractOpts) {
102
- const { throws, readFromStdin, flatten, ...opts } = extractOpts;
103
- let rawResults = [];
104
- try {
105
- if (readFromStdin) {
106
- debug(`Reading input from stdin`);
107
- // Read from stdin
108
- if (process.stdin.isTTY) {
109
- warn('Reading source file from TTY.');
110
- }
111
- const stdinSource = await getStdinAsString();
112
- rawResults = [await processFile(stdinSource, 'dummy', opts)];
113
- }
114
- else {
115
- rawResults = await Promise.all(files.map(async (fn) => {
116
- debug('Extracting file:', fn);
117
- const source = await readFile(fn, 'utf8');
118
- return processFile(source, fn, opts);
119
- }));
120
- }
121
- }
122
- catch (e) {
123
- if (throws) {
124
- throw e;
125
- }
126
- else {
127
- warn(String(e));
128
- }
129
- }
130
- const formatter = await resolveBuiltinFormatter(opts.format);
131
- const extractionResults = rawResults.filter((r) => !!r);
132
- const extractedMessages = new Map();
133
- for (const { messages } of extractionResults) {
134
- for (const message of messages) {
135
- const { id, description, defaultMessage } = message;
136
- if (!id) {
137
- const error = new Error(`[FormatJS CLI] Missing message id for message:
93
+ const { throws, readFromStdin, ...opts } = extractOpts;
94
+ let rawResults = [];
95
+ try {
96
+ if (readFromStdin) {
97
+ debug(`Reading input from stdin`);
98
+ // Read from stdin
99
+ if (process.stdin.isTTY) {
100
+ warn("Reading source file from TTY.");
101
+ }
102
+ const stdinSource = await getStdinAsString();
103
+ rawResults = [await processFile(stdinSource, "dummy", opts)];
104
+ } else {
105
+ rawResults = await Promise.all(files.map(async (fn) => {
106
+ debug("Extracting file:", fn);
107
+ const source = await readFile(fn, "utf8");
108
+ return processFile(source, fn, opts);
109
+ }));
110
+ }
111
+ } catch (e) {
112
+ if (throws) {
113
+ throw e;
114
+ } else {
115
+ warn(String(e));
116
+ }
117
+ }
118
+ const formatter = await resolveBuiltinFormatter(opts.format);
119
+ const extractionResults = rawResults.filter((r) => !!r);
120
+ const extractedMessages = new Map();
121
+ for (const { messages } of extractionResults) {
122
+ for (const message of messages) {
123
+ const { id, description, defaultMessage } = message;
124
+ if (!id) {
125
+ const error = new Error(`[FormatJS CLI] Missing message id for message:
138
126
  ${JSON.stringify(message, undefined, 2)}`);
139
- if (throws) {
140
- throw error;
141
- }
142
- else {
143
- warn(error.message);
144
- }
145
- continue;
146
- }
147
- if (extractedMessages.has(id)) {
148
- const existing = extractedMessages.get(id);
149
- if (stringify(description) !== stringify(existing.description) ||
150
- defaultMessage !== existing.defaultMessage) {
151
- const error = new Error(`[FormatJS CLI] Duplicate message id: "${id}", ` +
152
- 'but the `description` and/or `defaultMessage` are different.');
153
- if (throws) {
154
- throw error;
155
- }
156
- else {
157
- warn(error.message);
158
- }
159
- }
160
- }
161
- extractedMessages.set(id, message);
162
- }
163
- }
164
- const results = {};
165
- const messages = Array.from(extractedMessages.values());
166
- for (const { id, ...msg } of messages) {
167
- if (flatten && msg.defaultMessage) {
168
- msg.defaultMessage = printAST(hoistSelectors(parse(msg.defaultMessage)));
169
- }
170
- results[id] = msg;
171
- }
172
- if (typeof formatter.serialize === 'function') {
173
- return formatter.serialize(formatter.format(results));
174
- }
175
- return (stringify(formatter.format(results), {
176
- space: 2,
177
- cmp: formatter.compareMessages || undefined,
178
- }) ?? '');
127
+ if (throws) {
128
+ throw error;
129
+ } else {
130
+ warn(error.message);
131
+ }
132
+ continue;
133
+ }
134
+ if (extractedMessages.has(id)) {
135
+ const existing = extractedMessages.get(id);
136
+ if (stringify(description) !== stringify(existing.description) || defaultMessage !== existing.defaultMessage) {
137
+ const error = new Error(`[FormatJS CLI] Duplicate message id: "${id}", ` + "but the `description` and/or `defaultMessage` are different.");
138
+ if (throws) {
139
+ throw error;
140
+ } else {
141
+ warn(error.message);
142
+ }
143
+ }
144
+ }
145
+ extractedMessages.set(id, message);
146
+ }
147
+ }
148
+ const results = {};
149
+ const messages = Array.from(extractedMessages.values());
150
+ for (const { id, ...msg } of messages) {
151
+ // GH #3537: flatten is now applied during extraction in the babel plugin,
152
+ // so we don't need to apply it again here. The messages are already flattened.
153
+ results[id] = msg;
154
+ }
155
+ if (typeof formatter.serialize === "function") {
156
+ return formatter.serialize(formatter.format(results));
157
+ }
158
+ return stringify(formatter.format(results), {
159
+ space: 2,
160
+ cmp: formatter.compareMessages || undefined
161
+ }) ?? "";
179
162
  }
180
163
  /**
181
- * Extract strings from source files, also writes to a file.
182
- * @param files list of files
183
- * @param extractOpts extract options
184
- * @returns A Promise that resolves if output file was written successfully
185
- */
164
+ * Extract strings from source files, also writes to a file.
165
+ * @param files list of files
166
+ * @param extractOpts extract options
167
+ * @returns A Promise that resolves if output file was written successfully
168
+ */
186
169
  export default async function extractAndWrite(files, extractOpts) {
187
- const { outFile, ...opts } = extractOpts;
188
- const serializedResult = (await extract(files, opts)) + '\n';
189
- if (outFile) {
190
- debug('Writing output file:', outFile);
191
- return outputFile(outFile, serializedResult);
192
- }
193
- await writeStdout(serializedResult);
170
+ const { outFile, ...opts } = extractOpts;
171
+ const serializedResult = await extract(files, opts) + "\n";
172
+ if (outFile) {
173
+ debug("Writing output file:", outFile);
174
+ return outputFile(outFile, serializedResult);
175
+ }
176
+ await writeStdout(serializedResult);
194
177
  }
@@ -1,7 +1,7 @@
1
- import { CompileFn, FormatFn } from './default.js';
1
+ import { type CompileFn, type FormatFn } from "./default.js";
2
2
  export type CrowdinJson = Record<string, {
3
- message: string;
4
- description?: string;
3
+ message: string;
4
+ description?: string;
5
5
  }>;
6
6
  export declare const format: FormatFn<CrowdinJson>;
7
7
  export declare const compile: CompileFn<CrowdinJson>;
@@ -1,22 +1,21 @@
1
- export const format = msgs => {
2
- const results = {};
3
- for (const [id, msg] of Object.entries(msgs)) {
4
- results[id] = {
5
- message: msg.defaultMessage,
6
- description: typeof msg.description === 'string'
7
- ? msg.description
8
- : JSON.stringify(msg.description),
9
- };
10
- }
11
- return results;
1
+ import "./default.js";
2
+ export const format = (msgs) => {
3
+ const results = {};
4
+ for (const [id, msg] of Object.entries(msgs)) {
5
+ results[id] = {
6
+ message: msg.defaultMessage,
7
+ description: typeof msg.description === "string" ? msg.description : JSON.stringify(msg.description)
8
+ };
9
+ }
10
+ return results;
12
11
  };
13
- export const compile = msgs => {
14
- const results = {};
15
- for (const [id, msg] of Object.entries(msgs)) {
16
- if (id === 'smartling') {
17
- continue;
18
- }
19
- results[id] = msg.message;
20
- }
21
- return results;
12
+ export const compile = (msgs) => {
13
+ const results = {};
14
+ for (const [id, msg] of Object.entries(msgs)) {
15
+ if (id === "smartling") {
16
+ continue;
17
+ }
18
+ results[id] = msg.message;
19
+ }
20
+ return results;
22
21
  };
@@ -1,4 +1,4 @@
1
- import { MessageDescriptor } from '@formatjs/ts-transformer';
1
+ import { type MessageDescriptor } from "@formatjs/ts-transformer";
2
2
  export type FormatFn<T = Record<string, MessageDescriptor>> = (msgs: Record<string, MessageDescriptor>) => T;
3
3
  export type CompileFn<T = Record<string, MessageDescriptor>> = (msgs: T) => Record<string, string>;
4
4
  export type SerializeFn<T = Record<string, MessageDescriptor>> = (msgs: T) => string;
@@ -1,8 +1,9 @@
1
- export const format = msgs => msgs;
2
- export const compile = msgs => {
3
- const results = {};
4
- for (const k in msgs) {
5
- results[k] = msgs[k].defaultMessage;
6
- }
7
- return results;
1
+ import "@formatjs/ts-transformer";
2
+ export const format = (msgs) => msgs;
3
+ export const compile = (msgs) => {
4
+ const results = {};
5
+ for (const k in msgs) {
6
+ results[k] = msgs[k].defaultMessage;
7
+ }
8
+ return results;
8
9
  };
@@ -1,9 +1,9 @@
1
- import type { Comparator } from 'json-stable-stringify';
2
- import { CompileFn, FormatFn, SerializeFn } from './default.js';
1
+ import type { Comparator } from "json-stable-stringify";
2
+ import { type CompileFn, type FormatFn, type SerializeFn } from "./default.js";
3
3
  export interface Formatter<T> {
4
- serialize?: SerializeFn<T>;
5
- format: FormatFn<T>;
6
- compile: CompileFn<T>;
7
- compareMessages?: Comparator;
4
+ serialize?: SerializeFn<T>;
5
+ format: FormatFn<T>;
6
+ compile: CompileFn<T>;
7
+ compareMessages?: Comparator;
8
8
  }
9
9
  export declare function resolveBuiltinFormatter(format?: string | Formatter<unknown>): Promise<any>;
@@ -1,36 +1,31 @@
1
- import { resolve } from 'path';
2
- import { pathToFileURL } from 'url';
3
- import * as crowdin from './crowdin.js';
4
- import * as defaultFormatter from './default.js';
5
- import * as lokalise from './lokalise.js';
6
- import * as simple from './simple.js';
7
- import * as smartling from './smartling.js';
8
- import * as transifex from './transifex.js';
1
+ import { resolve } from "path";
2
+ import { pathToFileURL } from "url";
3
+ import * as crowdin from "./crowdin.js";
4
+ import * as defaultFormatter from "./default.js";
5
+ import "./default.js";
6
+ import * as lokalise from "./lokalise.js";
7
+ import * as simple from "./simple.js";
8
+ import * as smartling from "./smartling.js";
9
+ import * as transifex from "./transifex.js";
9
10
  export async function resolveBuiltinFormatter(format) {
10
- if (!format) {
11
- return defaultFormatter;
12
- }
13
- if (typeof format !== 'string') {
14
- return format;
15
- }
16
- switch (format) {
17
- case 'transifex':
18
- return transifex;
19
- case 'smartling':
20
- return smartling;
21
- case 'simple':
22
- return simple;
23
- case 'lokalise':
24
- return lokalise;
25
- case 'crowdin':
26
- return crowdin;
27
- }
28
- try {
29
- // eslint-disable-next-line import/dynamic-import-chunkname
30
- return import(pathToFileURL(resolve(process.cwd(), format)).href);
31
- }
32
- catch (e) {
33
- console.error(`Cannot resolve formatter ${format}`);
34
- throw e;
35
- }
11
+ if (!format) {
12
+ return defaultFormatter;
13
+ }
14
+ if (typeof format !== "string") {
15
+ return format;
16
+ }
17
+ switch (format) {
18
+ case "transifex": return transifex;
19
+ case "smartling": return smartling;
20
+ case "simple": return simple;
21
+ case "lokalise": return lokalise;
22
+ case "crowdin": return crowdin;
23
+ }
24
+ try {
25
+ // eslint-disable-next-line import/dynamic-import-chunkname
26
+ return import(pathToFileURL(resolve(process.cwd(), format)).href);
27
+ } catch (e) {
28
+ console.error(`Cannot resolve formatter ${format}`);
29
+ throw e;
30
+ }
36
31
  }
@@ -1,9 +1,9 @@
1
- import { CompileFn, FormatFn } from './default.js';
1
+ import { type CompileFn, type FormatFn } from "./default.js";
2
2
  export type StructuredJson = Record<string, {
3
- translation: string;
4
- notes?: string;
5
- context?: string;
6
- limit?: string;
3
+ translation: string;
4
+ notes?: string;
5
+ context?: string;
6
+ limit?: string;
7
7
  }>;
8
8
  export declare const format: FormatFn<StructuredJson>;
9
9
  export declare const compile: CompileFn<StructuredJson>;
@@ -1,19 +1,18 @@
1
- export const format = msgs => {
2
- const results = {};
3
- for (const [id, msg] of Object.entries(msgs)) {
4
- results[id] = {
5
- translation: msg.defaultMessage,
6
- notes: typeof msg.description === 'string'
7
- ? msg.description
8
- : JSON.stringify(msg.description),
9
- };
10
- }
11
- return results;
1
+ import "./default.js";
2
+ export const format = (msgs) => {
3
+ const results = {};
4
+ for (const [id, msg] of Object.entries(msgs)) {
5
+ results[id] = {
6
+ translation: msg.defaultMessage,
7
+ notes: typeof msg.description === "string" ? msg.description : JSON.stringify(msg.description)
8
+ };
9
+ }
10
+ return results;
12
11
  };
13
- export const compile = msgs => {
14
- const results = {};
15
- for (const [id, msg] of Object.entries(msgs)) {
16
- results[id] = msg.translation;
17
- }
18
- return results;
12
+ export const compile = (msgs) => {
13
+ const results = {};
14
+ for (const [id, msg] of Object.entries(msgs)) {
15
+ results[id] = msg.translation;
16
+ }
17
+ return results;
19
18
  };
@@ -1,4 +1,4 @@
1
- import { CompileFn, FormatFn } from './default.js';
1
+ import { type CompileFn, type FormatFn } from "./default.js";
2
2
  export type PhraseJson = Record<string, string>;
3
3
  export declare const format: FormatFn<PhraseJson>;
4
4
  export declare const compile: CompileFn<PhraseJson>;
@@ -1,7 +1,8 @@
1
- export const format = msgs => {
2
- return Object.keys(msgs).reduce((all, k) => {
3
- all[k] = msgs[k].defaultMessage;
4
- return all;
5
- }, {});
1
+ import "./default.js";
2
+ export const format = (msgs) => {
3
+ return Object.keys(msgs).reduce((all, k) => {
4
+ all[k] = msgs[k].defaultMessage;
5
+ return all;
6
+ }, {});
6
7
  };
7
- export const compile = msgs => msgs;
8
+ export const compile = (msgs) => msgs;
@@ -1,22 +1,20 @@
1
- import type { Comparator } from 'json-stable-stringify';
2
- import { CompileFn, FormatFn } from './default.js';
1
+ import type { Comparator } from "json-stable-stringify";
2
+ import { type CompileFn, type FormatFn } from "./default.js";
3
3
  export interface SmartlingDirectives {
4
- translate_paths: [
5
- {
6
- path: string;
7
- key: string;
8
- instruction: string;
9
- }
10
- ];
11
- variants_enabled: boolean;
12
- string_format: string;
13
- [k: string]: any;
4
+ translate_paths: [{
5
+ path: string;
6
+ key: string;
7
+ instruction: string;
8
+ }];
9
+ variants_enabled: boolean;
10
+ string_format: string;
11
+ [k: string]: any;
14
12
  }
15
13
  export type SmartlingJson = {
16
- smartling: SmartlingDirectives;
14
+ smartling: SmartlingDirectives;
17
15
  } & Record<string, {
18
- message: string;
19
- description?: string;
16
+ message: string;
17
+ description?: string;
20
18
  }>;
21
19
  export declare const format: FormatFn<SmartlingJson>;
22
20
  export declare const compareMessages: Comparator;