@wp-blocks/make-pot 1.6.5 → 1.6.6
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/README.md +2 -2
- package/lib/assets/block-i18n.js +41 -1
- package/lib/assets/package-i18n.js +38 -1
- package/lib/assets/theme-i18n.js +110 -1
- package/lib/assets/wp-plugin-i18n.js +39 -1
- package/lib/assets/wp-theme-i18n.js +37 -1
- package/lib/cli/getArgs.js +156 -1
- package/lib/cli/getArgs.js.map +2 -2
- package/lib/cli/getJsonArgs.js +82 -1
- package/lib/cli/parseCli.js +179 -1
- package/lib/cli.js +43 -1
- package/lib/const.js +111 -1
- package/lib/extractors/auditStrings.js +177 -6
- package/lib/extractors/auditStrings.js.map +2 -2
- package/lib/extractors/css.js +69 -1
- package/lib/extractors/headers.js +253 -15
- package/lib/extractors/headers.js.map +2 -2
- package/lib/extractors/json.js +70 -1
- package/lib/extractors/packageJson.js +55 -1
- package/lib/extractors/php.js +79 -2
- package/lib/extractors/php.js.map +2 -2
- package/lib/extractors/schema.js +217 -3
- package/lib/extractors/text.js +41 -1
- package/lib/fs/fs.js +114 -2
- package/lib/fs/glob.js +103 -1
- package/lib/index.js +64 -1
- package/lib/jsonCommand.js +51 -1
- package/lib/makeJson.js +28 -1
- package/lib/makePot.js +27 -1
- package/lib/parser/exec.js +94 -3
- package/lib/parser/exec.js.map +2 -2
- package/lib/parser/makeJson.js +393 -1
- package/lib/parser/makePot.js +48 -1
- package/lib/parser/patterns.js +54 -1
- package/lib/parser/process.js +85 -1
- package/lib/parser/progress.js +57 -1
- package/lib/parser/taskRunner.js +65 -2
- package/lib/parser/taskRunner.js.map +2 -2
- package/lib/parser/tree.js +228 -2
- package/lib/potCommand.js +36 -1
- package/lib/potCommand.js.map +2 -2
- package/lib/types.js +17 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/common.js +161 -8
- package/lib/utils/common.js.map +2 -2
- package/lib/utils/extractors.js +69 -1
- package/lib/utils/output.js +59 -1
- package/lib/utils/output.js.map +3 -3
- package/package.json +1 -2
- package/tests/parse-php.test.js +47 -0
package/README.md
CHANGED
|
@@ -70,15 +70,15 @@ npx @wp-blocks/make-pot src languages --charset='utf-8' --include="src/**/*.{ts,
|
|
|
70
70
|
- `--package-name <name>`: Specifies the package name.
|
|
71
71
|
- `--location`: Includes location information in the `.pot` file.
|
|
72
72
|
- `--ignore-domain`: Ignores text domain in the processing.
|
|
73
|
+
- `--translation-domains`: Restrict to specific translation domains.
|
|
73
74
|
- `--mergePaths <paths>`: Merges with existing POT file(s).
|
|
74
75
|
- `--subtractPaths <paths>`: Subtracts strings from existing POT file(s).
|
|
75
76
|
- `--subtractAndMerge`: Subtracts and merges strings from existing POT file(s).
|
|
76
77
|
- `--include <files>`: Includes specific files for processing.
|
|
77
78
|
- `--exclude <files>`: Excludes specific files from processing.
|
|
78
|
-
- `--silent`: Suppresses output to stdout.
|
|
79
|
+
- `--silent`: Suppresses verbose output to stdout.
|
|
79
80
|
- `--json`: Outputs the JSON gettext data.
|
|
80
81
|
- `--charset`: Defines the encoding charset of the pot file, you can choose "iso-8859-1" and "uft-8" (defaults to iso-8859-1)
|
|
81
|
-
- `--translation-domains`: Restrict to specific translation domains.
|
|
82
82
|
- `--output`: Outputs the gettext data.
|
|
83
83
|
|
|
84
84
|
### Example usage
|
package/lib/assets/block-i18n.js
CHANGED
|
@@ -1 +1,41 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var block_i18n_exports = {};
|
|
20
|
+
__export(block_i18n_exports, {
|
|
21
|
+
default: () => block_i18n_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(block_i18n_exports);
|
|
24
|
+
var block_i18n_default = {
|
|
25
|
+
title: "block title",
|
|
26
|
+
description: "block description",
|
|
27
|
+
keywords: ["block keyword"],
|
|
28
|
+
styles: [
|
|
29
|
+
{
|
|
30
|
+
label: "block style label"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
variations: [
|
|
34
|
+
{
|
|
35
|
+
title: "block variation title",
|
|
36
|
+
description: "block variation description",
|
|
37
|
+
keywords: ["block variation keyword"]
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=block-i18n.js.map
|
|
@@ -1 +1,38 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var package_i18n_exports = {};
|
|
20
|
+
__export(package_i18n_exports, {
|
|
21
|
+
default: () => package_i18n_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(package_i18n_exports);
|
|
24
|
+
var package_i18n_default = {
|
|
25
|
+
name: "name",
|
|
26
|
+
url: "url",
|
|
27
|
+
description: "description",
|
|
28
|
+
author: "author",
|
|
29
|
+
authors: "authors",
|
|
30
|
+
authorEmail: "authorEmail",
|
|
31
|
+
version: "version",
|
|
32
|
+
bugs: "bugs",
|
|
33
|
+
"bugs.url": "bugsUrl",
|
|
34
|
+
"bugs.email": "bugsEmail",
|
|
35
|
+
license: "license",
|
|
36
|
+
repository: "repository"
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=package-i18n.js.map
|
package/lib/assets/theme-i18n.js
CHANGED
|
@@ -1 +1,110 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var theme_i18n_exports = {};
|
|
20
|
+
__export(theme_i18n_exports, {
|
|
21
|
+
default: () => theme_i18n_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(theme_i18n_exports);
|
|
24
|
+
var theme_i18n_default = {
|
|
25
|
+
title: "Style variation name",
|
|
26
|
+
settings: {
|
|
27
|
+
typography: {
|
|
28
|
+
fontSizes: [
|
|
29
|
+
{
|
|
30
|
+
name: "Font size name"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
fontFamilies: [
|
|
34
|
+
{
|
|
35
|
+
name: "Font family name"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
color: {
|
|
40
|
+
palette: [
|
|
41
|
+
{
|
|
42
|
+
name: "Color name"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
gradients: [
|
|
46
|
+
{
|
|
47
|
+
name: "Gradient name"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
duotone: [
|
|
51
|
+
{
|
|
52
|
+
name: "Duotone name"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
spacing: {
|
|
57
|
+
spacingSizes: [
|
|
58
|
+
{
|
|
59
|
+
name: "Space size name"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
blocks: {
|
|
64
|
+
"*": {
|
|
65
|
+
typography: {
|
|
66
|
+
fontSizes: [
|
|
67
|
+
{
|
|
68
|
+
name: "Font size name"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
fontFamilies: [
|
|
72
|
+
{
|
|
73
|
+
name: "Font family name"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
color: {
|
|
78
|
+
palette: [
|
|
79
|
+
{
|
|
80
|
+
name: "Color name"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
gradients: [
|
|
84
|
+
{
|
|
85
|
+
name: "Gradient name"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
spacing: {
|
|
90
|
+
spacingSizes: [
|
|
91
|
+
{
|
|
92
|
+
name: "Space size name"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
customTemplates: [
|
|
100
|
+
{
|
|
101
|
+
title: "Custom template name"
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
templateParts: [
|
|
105
|
+
{
|
|
106
|
+
title: "Template part name"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=theme-i18n.js.map
|
|
@@ -1 +1,39 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var wp_plugin_i18n_exports = {};
|
|
20
|
+
__export(wp_plugin_i18n_exports, {
|
|
21
|
+
default: () => wp_plugin_i18n_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(wp_plugin_i18n_exports);
|
|
24
|
+
var wp_plugin_i18n_default = {
|
|
25
|
+
name: "Plugin Name",
|
|
26
|
+
slug: "Plugin Slug",
|
|
27
|
+
url: "Plugin URI",
|
|
28
|
+
description: "Description",
|
|
29
|
+
version: "Version",
|
|
30
|
+
author: "Author",
|
|
31
|
+
authorUri: "Author URI",
|
|
32
|
+
tags: "Tags",
|
|
33
|
+
license: "License",
|
|
34
|
+
licenseUri: "License URI",
|
|
35
|
+
updateUri: "Update URI",
|
|
36
|
+
domainPath: "Domain Path",
|
|
37
|
+
textDomain: "Text Domain"
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=wp-plugin-i18n.js.map
|
|
@@ -1 +1,37 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var wp_theme_i18n_exports = {};
|
|
20
|
+
__export(wp_theme_i18n_exports, {
|
|
21
|
+
default: () => wp_theme_i18n_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(wp_theme_i18n_exports);
|
|
24
|
+
var wp_theme_i18n_default = {
|
|
25
|
+
name: "Theme Name",
|
|
26
|
+
author: "Author",
|
|
27
|
+
authorUri: "Author URI",
|
|
28
|
+
description: "Description",
|
|
29
|
+
url: "Theme URI",
|
|
30
|
+
tags: "Tags",
|
|
31
|
+
version: "Version",
|
|
32
|
+
license: "License",
|
|
33
|
+
licenseUri: "License URI",
|
|
34
|
+
domainPath: "Domain Path",
|
|
35
|
+
textDomain: "Text Domain"
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=wp-theme-i18n.js.map
|
package/lib/cli/getArgs.js
CHANGED
|
@@ -1 +1,156 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var getArgs_exports = {};
|
|
30
|
+
__export(getArgs_exports, {
|
|
31
|
+
getArgs: () => getArgs
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(getArgs_exports);
|
|
34
|
+
var import_node_process = __toESM(require("node:process"));
|
|
35
|
+
var yargs = __toESM(require("yargs"));
|
|
36
|
+
var import_helpers = require("yargs/helpers");
|
|
37
|
+
var import_parseCli = require("./parseCli.js");
|
|
38
|
+
function getArgs(userArgs = {}) {
|
|
39
|
+
const args = yargs.default((0, import_helpers.hideBin)(import_node_process.default.argv)).help("help").alias("h", "help").usage("Usage: $0 <source> [destination] [options]").positional("sourceDirectory", {
|
|
40
|
+
describe: "Source directory",
|
|
41
|
+
type: "string"
|
|
42
|
+
}).positional("destination", {
|
|
43
|
+
describe: "Destination directory",
|
|
44
|
+
type: "string"
|
|
45
|
+
}).options({
|
|
46
|
+
slug: {
|
|
47
|
+
describe: "Plugin or theme slug",
|
|
48
|
+
type: "string"
|
|
49
|
+
},
|
|
50
|
+
domain: {
|
|
51
|
+
describe: "Text domain to look for in the source code. Valid domains are: plugin, theme, block, theme-block, generic.",
|
|
52
|
+
choices: ["plugin", "theme", "block", "theme-block", "generic"],
|
|
53
|
+
type: "string"
|
|
54
|
+
},
|
|
55
|
+
"skip-js": {
|
|
56
|
+
describe: "Skip JavaScript files",
|
|
57
|
+
type: "boolean"
|
|
58
|
+
},
|
|
59
|
+
"skip-php": {
|
|
60
|
+
describe: "Skip PHP files",
|
|
61
|
+
type: "boolean"
|
|
62
|
+
},
|
|
63
|
+
"skip-blade": {
|
|
64
|
+
describe: "Skip Blade files",
|
|
65
|
+
type: "boolean"
|
|
66
|
+
},
|
|
67
|
+
"skip-block-json": {
|
|
68
|
+
describe: "Skip block.json files",
|
|
69
|
+
type: "boolean"
|
|
70
|
+
},
|
|
71
|
+
"skip-theme-json": {
|
|
72
|
+
describe: "Skip theme.json files",
|
|
73
|
+
type: "boolean"
|
|
74
|
+
},
|
|
75
|
+
"skip-audit": {
|
|
76
|
+
describe: "Skip auditing of strings",
|
|
77
|
+
type: "boolean",
|
|
78
|
+
default: false
|
|
79
|
+
},
|
|
80
|
+
headers: {
|
|
81
|
+
describe: "Additional Headers",
|
|
82
|
+
type: "array",
|
|
83
|
+
default: []
|
|
84
|
+
},
|
|
85
|
+
"file-comment": {
|
|
86
|
+
describe: "File comment",
|
|
87
|
+
type: "string"
|
|
88
|
+
},
|
|
89
|
+
"package-name": {
|
|
90
|
+
describe: "Package name",
|
|
91
|
+
type: "string"
|
|
92
|
+
},
|
|
93
|
+
location: {
|
|
94
|
+
describe: "Include location information",
|
|
95
|
+
type: "boolean"
|
|
96
|
+
},
|
|
97
|
+
"ignore-domain": {
|
|
98
|
+
describe: "Ignore text domain",
|
|
99
|
+
type: "boolean"
|
|
100
|
+
},
|
|
101
|
+
mergePaths: {
|
|
102
|
+
describe: "Merge with existing POT file(s)",
|
|
103
|
+
type: "string"
|
|
104
|
+
},
|
|
105
|
+
subtractPaths: {
|
|
106
|
+
describe: "Subtract strings from existing POT file(s)",
|
|
107
|
+
type: "string"
|
|
108
|
+
},
|
|
109
|
+
subtractAndMerge: {
|
|
110
|
+
describe: "Subtract and merge strings from existing POT file(s)",
|
|
111
|
+
type: "boolean"
|
|
112
|
+
},
|
|
113
|
+
include: {
|
|
114
|
+
describe: "Include specific files",
|
|
115
|
+
type: "string",
|
|
116
|
+
default: "**"
|
|
117
|
+
},
|
|
118
|
+
exclude: {
|
|
119
|
+
describe: "Exclude specific files",
|
|
120
|
+
type: "string"
|
|
121
|
+
},
|
|
122
|
+
silent: {
|
|
123
|
+
describe: "No output to stdout",
|
|
124
|
+
type: "boolean",
|
|
125
|
+
default: false
|
|
126
|
+
},
|
|
127
|
+
json: {
|
|
128
|
+
describe: "Output the json gettext data",
|
|
129
|
+
type: "boolean"
|
|
130
|
+
},
|
|
131
|
+
output: {
|
|
132
|
+
describe: "Output the gettext data",
|
|
133
|
+
type: "boolean"
|
|
134
|
+
},
|
|
135
|
+
charset: {
|
|
136
|
+
describe: "Charset",
|
|
137
|
+
type: "string",
|
|
138
|
+
default: "latin1"
|
|
139
|
+
},
|
|
140
|
+
"translation-domains": {
|
|
141
|
+
describe: "Restrict to specific translation domains",
|
|
142
|
+
type: "array"
|
|
143
|
+
},
|
|
144
|
+
debug: {
|
|
145
|
+
describe: "Debug mode",
|
|
146
|
+
type: "boolean",
|
|
147
|
+
default: false
|
|
148
|
+
}
|
|
149
|
+
}).parseSync();
|
|
150
|
+
return (0, import_parseCli.parseCliArgs)({ ...userArgs, ...args });
|
|
151
|
+
}
|
|
152
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
153
|
+
0 && (module.exports = {
|
|
154
|
+
getArgs
|
|
155
|
+
});
|
|
156
|
+
//# sourceMappingURL=getArgs.js.map
|
package/lib/cli/getArgs.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/cli/getArgs.ts"],
|
|
4
|
-
"sourcesContent": ["import process from \"node:process\";\r\nimport * as yargs from \"yargs\";\r\nimport { hideBin } from \"yargs/helpers\";\r\nimport type { Args, MakeJsonArgs } from \"../types.js\";\r\nimport { parseCliArgs } from \"./parseCli.js\";\r\n\r\n/**\r\n * Retrieves and returns the command line arguments and options.\r\n *\r\n * @return The parsed command line arguments and options.\r\n */\r\nexport function getArgs(userArgs = {}): Args | MakeJsonArgs {\r\n\tconst args = yargs\r\n\t\t.default(hideBin(process.argv))\r\n\t\t.help(\"
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAoB;AACpB,YAAuB;AACvB,qBAAwB;AAExB,sBAA6B;AAOtB,SAAS,QAAQ,WAAW,CAAC,GAAwB;AAC3D,QAAM,OAAO,MACX,YAAQ,wBAAQ,oBAAAA,QAAQ,IAAI,CAAC,EAC7B,KAAK,
|
|
4
|
+
"sourcesContent": ["import process from \"node:process\";\r\nimport * as yargs from \"yargs\";\r\nimport { hideBin } from \"yargs/helpers\";\r\nimport type { Args, MakeJsonArgs } from \"../types.js\";\r\nimport { parseCliArgs } from \"./parseCli.js\";\r\n\r\n/**\r\n * Retrieves and returns the command line arguments and options.\r\n *\r\n * @return The parsed command line arguments and options.\r\n */\r\nexport function getArgs(userArgs = {}): Args | MakeJsonArgs {\r\n\tconst args = yargs\r\n\t\t.default(hideBin(process.argv))\r\n\t\t.help(\"help\")\r\n\t\t.alias(\"h\", \"help\")\r\n\t\t.usage(\"Usage: $0 <source> [destination] [options]\")\r\n\t\t.positional(\"sourceDirectory\", {\r\n\t\t\tdescribe: \"Source directory\",\r\n\t\t\ttype: \"string\",\r\n\t\t})\r\n\t\t.positional(\"destination\", {\r\n\t\t\tdescribe: \"Destination directory\",\r\n\t\t\ttype: \"string\",\r\n\t\t})\r\n\t\t.options({\r\n\t\t\tslug: {\r\n\t\t\t\tdescribe: \"Plugin or theme slug\",\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t},\r\n\t\t\tdomain: {\r\n\t\t\t\tdescribe: \"Text domain to look for in the source code. Valid domains are: plugin, theme, block, theme-block, generic.\",\r\n\t\t\t\tchoices: [\"plugin\", \"theme\", \"block\", \"theme-block\", \"generic\"],\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t},\r\n\t\t\t\"skip-js\": {\r\n\t\t\t\tdescribe: \"Skip JavaScript files\",\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t},\r\n\t\t\t\"skip-php\": {\r\n\t\t\t\tdescribe: \"Skip PHP files\",\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t},\r\n\t\t\t\"skip-blade\": {\r\n\t\t\t\tdescribe: \"Skip Blade files\",\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t},\r\n\t\t\t\"skip-block-json\": {\r\n\t\t\t\tdescribe: \"Skip block.json files\",\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t},\r\n\t\t\t\"skip-theme-json\": {\r\n\t\t\t\tdescribe: \"Skip theme.json files\",\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t},\r\n\t\t\t\"skip-audit\": {\r\n\t\t\t\tdescribe: \"Skip auditing of strings\",\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t\tdefault: false,\r\n\t\t\t},\r\n\t\t\theaders: {\r\n\t\t\t\tdescribe: \"Additional Headers\",\r\n\t\t\t\ttype: \"array\",\r\n\t\t\t\tdefault: [],\r\n\t\t\t},\r\n\t\t\t\"file-comment\": {\r\n\t\t\t\tdescribe: \"File comment\",\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t},\r\n\t\t\t\"package-name\": {\r\n\t\t\t\tdescribe: \"Package name\",\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t},\r\n\t\t\tlocation: {\r\n\t\t\t\tdescribe: \"Include location information\",\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t},\r\n\t\t\t\"ignore-domain\": {\r\n\t\t\t\tdescribe: \"Ignore text domain\",\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t},\r\n\t\t\tmergePaths: {\r\n\t\t\t\tdescribe: \"Merge with existing POT file(s)\",\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t},\r\n\t\t\tsubtractPaths: {\r\n\t\t\t\tdescribe: \"Subtract strings from existing POT file(s)\",\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t},\r\n\t\t\tsubtractAndMerge: {\r\n\t\t\t\tdescribe: \"Subtract and merge strings from existing POT file(s)\",\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t},\r\n\t\t\tinclude: {\r\n\t\t\t\tdescribe: \"Include specific files\",\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t\tdefault: \"**\",\r\n\t\t\t},\r\n\t\t\texclude: {\r\n\t\t\t\tdescribe: \"Exclude specific files\",\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t},\r\n\t\t\tsilent: {\r\n\t\t\t\tdescribe: \"No output to stdout\",\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t\tdefault: false,\r\n\t\t\t},\r\n\t\t\tjson: {\r\n\t\t\t\tdescribe: \"Output the json gettext data\",\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t},\r\n\t\t\toutput: {\r\n\t\t\t\tdescribe: \"Output the gettext data\",\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t},\r\n\t\t\tcharset: {\r\n\t\t\t\tdescribe: \"Charset\",\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t\tdefault: \"latin1\",\r\n\t\t\t},\r\n\t\t\t\"translation-domains\": {\r\n\t\t\t\tdescribe: \"Restrict to specific translation domains\",\r\n\t\t\t\ttype: \"array\",\r\n\t\t\t},\r\n\t\t\tdebug: {\r\n\t\t\t\tdescribe: \"Debug mode\",\r\n\t\t\t\ttype: \"boolean\",\r\n\t\t\t\tdefault: false,\r\n\t\t\t},\r\n\t\t})\r\n\t\t.parseSync();\r\n\treturn parseCliArgs({ ...userArgs, ...args });\r\n}\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAoB;AACpB,YAAuB;AACvB,qBAAwB;AAExB,sBAA6B;AAOtB,SAAS,QAAQ,WAAW,CAAC,GAAwB;AAC3D,QAAM,OAAO,MACX,YAAQ,wBAAQ,oBAAAA,QAAQ,IAAI,CAAC,EAC7B,KAAK,MAAM,EACX,MAAM,KAAK,MAAM,EACjB,MAAM,4CAA4C,EAClD,WAAW,mBAAmB;AAAA,IAC9B,UAAU;AAAA,IACV,MAAM;AAAA,EACP,CAAC,EACA,WAAW,eAAe;AAAA,IAC1B,UAAU;AAAA,IACV,MAAM;AAAA,EACP,CAAC,EACA,QAAQ;AAAA,IACR,MAAM;AAAA,MACL,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,MACP,UAAU;AAAA,MACV,SAAS,CAAC,UAAU,SAAS,SAAS,eAAe,SAAS;AAAA,MAC9D,MAAM;AAAA,IACP;AAAA,IACA,WAAW;AAAA,MACV,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,YAAY;AAAA,MACX,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,cAAc;AAAA,MACb,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,mBAAmB;AAAA,MAClB,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,mBAAmB;AAAA,MAClB,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,cAAc;AAAA,MACb,UAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,SAAS;AAAA,MACR,UAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAS,CAAC;AAAA,IACX;AAAA,IACA,gBAAgB;AAAA,MACf,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,gBAAgB;AAAA,MACf,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,UAAU;AAAA,MACT,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,iBAAiB;AAAA,MAChB,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,YAAY;AAAA,MACX,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,eAAe;AAAA,MACd,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,kBAAkB;AAAA,MACjB,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,SAAS;AAAA,MACR,UAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,SAAS;AAAA,MACR,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,MACP,UAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,MAAM;AAAA,MACL,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,MACP,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,SAAS;AAAA,MACR,UAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,uBAAuB;AAAA,MACtB,UAAU;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,OAAO;AAAA,MACN,UAAU;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,EACD,CAAC,EACA,UAAU;AACZ,aAAO,8BAAa,EAAE,GAAG,UAAU,GAAG,KAAK,CAAC;AAC7C;",
|
|
6
6
|
"names": ["process"]
|
|
7
7
|
}
|
package/lib/cli/getJsonArgs.js
CHANGED
|
@@ -1 +1,82 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var getJsonArgs_exports = {};
|
|
30
|
+
__export(getJsonArgs_exports, {
|
|
31
|
+
getJsonArgs: () => getJsonArgs
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(getJsonArgs_exports);
|
|
34
|
+
var import_node_process = __toESM(require("node:process"));
|
|
35
|
+
var yargs = __toESM(require("yargs"));
|
|
36
|
+
var import_helpers = require("yargs/helpers");
|
|
37
|
+
var import_parseCli = require("./parseCli.js");
|
|
38
|
+
function getJsonArgs(additionalArgs = {}) {
|
|
39
|
+
const args = yargs.default((0, import_helpers.hideBin)(import_node_process.default.argv)).help("h").alias("help", "help").usage("Usage: $0 <source> [destination] [options]").positional("source", {
|
|
40
|
+
describe: "Source directory",
|
|
41
|
+
type: "string"
|
|
42
|
+
}).positional("destination", {
|
|
43
|
+
describe: "Destination directory",
|
|
44
|
+
type: "string"
|
|
45
|
+
}).options({
|
|
46
|
+
scriptName: {
|
|
47
|
+
describe: "The name of the script to be translated",
|
|
48
|
+
type: "string"
|
|
49
|
+
},
|
|
50
|
+
allowedFormats: {
|
|
51
|
+
describe: "which extensions to use for translation",
|
|
52
|
+
type: "array",
|
|
53
|
+
default: ["js"]
|
|
54
|
+
},
|
|
55
|
+
purge: {
|
|
56
|
+
describe: "Remove old JSON files",
|
|
57
|
+
type: "boolean",
|
|
58
|
+
default: true
|
|
59
|
+
},
|
|
60
|
+
prettyPrint: {
|
|
61
|
+
describe: "Pretty print JSON",
|
|
62
|
+
type: "boolean",
|
|
63
|
+
default: false
|
|
64
|
+
},
|
|
65
|
+
debug: {
|
|
66
|
+
describe: "Debug mode",
|
|
67
|
+
type: "boolean",
|
|
68
|
+
default: false
|
|
69
|
+
},
|
|
70
|
+
stripUnused: {
|
|
71
|
+
describe: "Strip unused translations in js files",
|
|
72
|
+
type: "boolean",
|
|
73
|
+
default: true
|
|
74
|
+
}
|
|
75
|
+
}).parseSync();
|
|
76
|
+
return (0, import_parseCli.parseJsonArgs)({ ...additionalArgs, ...args });
|
|
77
|
+
}
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
80
|
+
getJsonArgs
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=getJsonArgs.js.map
|