@discord/metro-intl-transformer 0.9.0-rc.2 → 0.9.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/asset-plugin.js +2 -1
- package/index.js +4 -2
- package/package.json +3 -3
package/asset-plugin.js
CHANGED
|
@@ -26,7 +26,7 @@ const {
|
|
|
26
26
|
* secret messages have their values replaced with obfuscated text to prevent leaking information.
|
|
27
27
|
*
|
|
28
28
|
* @property {IntlCompiledMessageFormat=} format
|
|
29
|
-
* The format to which messages
|
|
29
|
+
* The format to which messages should be compiled during bundling. `Json` will cause the messages
|
|
30
30
|
* to be compiled to a FormatJS-like compatible format, while `KeylessJson` will use a much more
|
|
31
31
|
* compressed, `@discord/intl`-specific format. `KeylessJson` is the default.
|
|
32
32
|
*/
|
|
@@ -39,6 +39,7 @@ const {
|
|
|
39
39
|
const defaultConfig = {
|
|
40
40
|
cacheDir: path.join('.cache', 'intl'),
|
|
41
41
|
assetExtension: 'json',
|
|
42
|
+
format: IntlCompiledMessageFormat.KeylessJson,
|
|
42
43
|
bundleSecrets: false,
|
|
43
44
|
};
|
|
44
45
|
|
package/index.js
CHANGED
|
@@ -16,6 +16,7 @@ const debug = require('debug')('intl:metro-intl-transformer');
|
|
|
16
16
|
* getPrelude: () => string
|
|
17
17
|
* getTranslationAssetExtension: () => string,
|
|
18
18
|
* getTranslationImport: (importPath: string) => string,
|
|
19
|
+
* format: IntlCompiledMessageFormat,
|
|
19
20
|
* bundleSecrets?: boolean,
|
|
20
21
|
* }} options
|
|
21
22
|
* @returns {string | Buffer}
|
|
@@ -26,6 +27,7 @@ function transformToString({
|
|
|
26
27
|
getPrelude,
|
|
27
28
|
getTranslationAssetExtension,
|
|
28
29
|
getTranslationImport,
|
|
30
|
+
format = IntlCompiledMessageFormat.KeylessJson,
|
|
29
31
|
bundleSecrets = false,
|
|
30
32
|
}) {
|
|
31
33
|
if (isMessageDefinitionsFile(filename)) {
|
|
@@ -58,8 +60,8 @@ function transformToString({
|
|
|
58
60
|
const result = processTranslationsFile(filename, src);
|
|
59
61
|
// @ts-expect-error Without the `outputFile` option, this always returns a Buffer, but the
|
|
60
62
|
// option allows the function to return void instead.
|
|
61
|
-
return precompileFileForLocale(filename, result.locale, {
|
|
62
|
-
format
|
|
63
|
+
return precompileFileForLocale(filename, result.locale, undefined, {
|
|
64
|
+
format,
|
|
63
65
|
bundleSecrets,
|
|
64
66
|
});
|
|
65
67
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discord/metro-intl-transformer",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Metro/Babel transformer plugin for compiling, bundling, and minifying intl message definitions and usages using intl-message-database.",
|
|
6
6
|
"exports": {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"debug": "^4.3.6",
|
|
12
|
-
"@discord/babel-plugin-transform-discord-intl": "0.9.
|
|
13
|
-
"@discord/intl-loader-core": "0.9.
|
|
12
|
+
"@discord/babel-plugin-transform-discord-intl": "0.9.1",
|
|
13
|
+
"@discord/intl-loader-core": "0.9.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/debug": "^4.1.12"
|