@wordpress/babel-plugin-makepot 5.11.0 → 5.13.0
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.js +13 -3
- package/package.json +4 -3
package/index.js
CHANGED
|
@@ -32,8 +32,9 @@
|
|
|
32
32
|
* External dependencies
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
+
const deepmerge = require( 'deepmerge' );
|
|
36
|
+
const { isPlainObject } = require( 'is-plain-object' );
|
|
35
37
|
const { po } = require( 'gettext-parser' );
|
|
36
|
-
const { merge, isEmpty } = require( 'lodash' );
|
|
37
38
|
const { relative, sep } = require( 'path' );
|
|
38
39
|
const { writeFileSync } = require( 'fs' );
|
|
39
40
|
|
|
@@ -312,7 +313,10 @@ module.exports = () => {
|
|
|
312
313
|
},
|
|
313
314
|
exit( path, state ) {
|
|
314
315
|
const { filename } = this.file.opts;
|
|
315
|
-
if (
|
|
316
|
+
if (
|
|
317
|
+
! strings[ filename ] ||
|
|
318
|
+
! Object.values( strings[ filename ] ).length
|
|
319
|
+
) {
|
|
316
320
|
delete strings[ filename ];
|
|
317
321
|
return;
|
|
318
322
|
}
|
|
@@ -362,7 +366,13 @@ module.exports = () => {
|
|
|
362
366
|
}, {} );
|
|
363
367
|
|
|
364
368
|
// Merge translations from individual files into headers
|
|
365
|
-
const data =
|
|
369
|
+
const data = deepmerge(
|
|
370
|
+
baseData,
|
|
371
|
+
{ translations },
|
|
372
|
+
{
|
|
373
|
+
isMergeableObject: isPlainObject,
|
|
374
|
+
}
|
|
375
|
+
);
|
|
366
376
|
|
|
367
377
|
// Ideally we could wait until Babel has finished parsing
|
|
368
378
|
// all files or at least asynchronously write, but the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/babel-plugin-makepot",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.13.0",
|
|
4
4
|
"description": "WordPress Babel internationalization (i18n) plugin.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -28,8 +28,9 @@
|
|
|
28
28
|
],
|
|
29
29
|
"main": "index.js",
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"deepmerge": "^4.3.0",
|
|
31
32
|
"gettext-parser": "^1.3.1",
|
|
32
|
-
"
|
|
33
|
+
"is-plain-object": "^5.0.0"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
35
36
|
"@babel/core": "^7.12.9"
|
|
@@ -37,5 +38,5 @@
|
|
|
37
38
|
"publishConfig": {
|
|
38
39
|
"access": "public"
|
|
39
40
|
},
|
|
40
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "9534a7b3bbf07c1d40b94fdb7a3d091f297bfb06"
|
|
41
42
|
}
|