@discord/metro-intl-transformer 0.6.1 → 0.6.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/asset-plugin.js +8 -6
- package/index.js +1 -1
- package/package.json +2 -2
package/asset-plugin.js
CHANGED
|
@@ -48,7 +48,7 @@ async function fetchConfig() {
|
|
|
48
48
|
let metroConfig;
|
|
49
49
|
try {
|
|
50
50
|
metroConfig = require(metroConfigPath);
|
|
51
|
-
debug(`Successfully loaded config
|
|
51
|
+
debug(`Successfully loaded config metro config`);
|
|
52
52
|
} catch {
|
|
53
53
|
debug(`Failed to load Metro configuration. Using defaults instead.`);
|
|
54
54
|
return defaultConfig;
|
|
@@ -56,8 +56,10 @@ async function fetchConfig() {
|
|
|
56
56
|
|
|
57
57
|
const config = metroConfig.transformer?.intlAssetPlugin;
|
|
58
58
|
if (config == null) {
|
|
59
|
+
debug('asset-plugin configuration was empty. Using defaults: %O', defaultConfig);
|
|
59
60
|
return defaultConfig;
|
|
60
61
|
}
|
|
62
|
+
debug(`discovered asset-plugin configuration: %O`, config);
|
|
61
63
|
|
|
62
64
|
if (config.cacheDir != null && path.isAbsolute(config.cacheDir)) {
|
|
63
65
|
throw new Error(
|
|
@@ -79,11 +81,11 @@ async function transformAsset(assetData) {
|
|
|
79
81
|
const filename = assetData.files[0] ?? '';
|
|
80
82
|
// If this isn't a translations file or if it's already a compiled artifact, then we don't want
|
|
81
83
|
// to do any more processing on it.
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
if (filename === '' || !isMessageTranslationsFile(filename)) {
|
|
85
|
+
return assetData;
|
|
86
|
+
}
|
|
87
|
+
if (/\.compiled.messages\./.test(filename)) {
|
|
88
|
+
debug(`[${filename}] Compiled messages asset needs no further processing`);
|
|
87
89
|
return assetData;
|
|
88
90
|
}
|
|
89
91
|
|
package/index.js
CHANGED
|
@@ -37,11 +37,11 @@ function transformToString({
|
|
|
37
37
|
`.compiled.messages.${getTranslationAssetExtension()}`,
|
|
38
38
|
);
|
|
39
39
|
|
|
40
|
-
debug('Locale map created: %O', result.translationsLocaleMap);
|
|
41
40
|
debug(
|
|
42
41
|
`[${filename}] Resolving source file to compiled translations file ${compiledSourcePath}`,
|
|
43
42
|
);
|
|
44
43
|
result.translationsLocaleMap['en-US'] = compiledSourcePath;
|
|
44
|
+
debug('Locale map created: %O', result.translationsLocaleMap);
|
|
45
45
|
|
|
46
46
|
return new MessageDefinitionsTransformer({
|
|
47
47
|
messageKeys: result.messageKeys,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discord/metro-intl-transformer",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
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": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"debug": "^4.3.6",
|
|
14
|
-
"@discord/intl-loader-core": "0.6.
|
|
14
|
+
"@discord/intl-loader-core": "0.6.2"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@babel/types": "^7.24.9",
|