@wp-blocks/make-pot 1.0.2 → 1.2.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/README.md +18 -1
- package/lib/cli/parseCli.js +11 -12
- package/lib/cli/parseCli.js.map +1 -1
- package/lib/const.js +1 -12
- package/lib/const.js.map +1 -1
- package/lib/extractors/headers.d.ts +2 -3
- package/lib/extractors/headers.js +23 -13
- package/lib/extractors/headers.js.map +1 -1
- package/lib/extractors/index.d.ts +2 -2
- package/lib/extractors/index.js +15 -25
- package/lib/extractors/index.js.map +1 -1
- package/lib/extractors/json.d.ts +3 -2
- package/lib/extractors/json.js +17 -30
- package/lib/extractors/json.js.map +1 -1
- package/lib/extractors/schema.d.ts +73 -2
- package/lib/extractors/schema.js +31 -52
- package/lib/extractors/schema.js.map +1 -1
- package/lib/extractors/text.js +3 -4
- package/lib/extractors/text.js.map +1 -1
- package/lib/extractors/utils.d.ts +4 -4
- package/lib/extractors/utils.js +17 -16
- package/lib/extractors/utils.js.map +1 -1
- package/lib/fs/glob.d.ts +2 -2
- package/lib/fs/glob.js +9 -21
- package/lib/fs/glob.js.map +1 -1
- package/lib/fs/index.js +2 -13
- package/lib/fs/index.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/parser/exec.d.ts +0 -1
- package/lib/parser/exec.js +38 -60
- package/lib/parser/exec.js.map +1 -1
- package/lib/parser/index.d.ts +2 -2
- package/lib/parser/index.js +25 -19
- package/lib/parser/index.js.map +1 -1
- package/lib/parser/patterns.js +6 -7
- package/lib/parser/patterns.js.map +1 -1
- package/lib/parser/process.d.ts +4 -5
- package/lib/parser/process.js +25 -57
- package/lib/parser/process.js.map +1 -1
- package/lib/parser/progress.d.ts +3 -0
- package/lib/parser/progress.js +21 -0
- package/lib/parser/progress.js.map +1 -0
- package/lib/parser/taskRunner.d.ts +4 -0
- package/lib/parser/taskRunner.js +33 -0
- package/lib/parser/taskRunner.js.map +1 -0
- package/lib/parser/tree.d.ts +2 -2
- package/lib/parser/tree.js +40 -23
- package/lib/parser/tree.js.map +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +7 -2
- package/lib/utils/index.js.map +1 -1
- package/package.json +16 -3
- package/tests/extract.test.ts +95 -104
- package/tests/getFiles.test.ts +114 -114
- package/tests/ignoreFunction.test.ts +102 -126
- package/tests/tree.test.ts +6 -7
- package/tsconfig.json +3 -3
- package/lib/cliArgs.d.ts +0 -4
- package/lib/cliArgs.js +0 -216
- package/lib/cliArgs.js.map +0 -1
- package/lib/consolidate.d.ts +0 -2
- package/lib/consolidate.js +0 -37
- package/lib/consolidate.js.map +0 -1
- package/lib/fs.d.ts +0 -2
- package/lib/fs.js +0 -69
- package/lib/fs.js.map +0 -1
- package/lib/glob.d.ts +0 -13
- package/lib/glob.js +0 -95
- package/lib/glob.js.map +0 -1
- package/lib/makePot.d.ts +0 -2
- package/lib/makePot.js +0 -83
- package/lib/makePot.js.map +0 -1
- package/lib/maps.d.ts +0 -122
- package/lib/maps.js +0 -73
- package/lib/maps.js.map +0 -1
- package/lib/parser/consolidate.d.ts +0 -2
- package/lib/parser/consolidate.js +0 -37
- package/lib/parser/consolidate.js.map +0 -1
- package/lib/parser/makePot.d.ts +0 -2
- package/lib/parser/makePot.js +0 -35
- package/lib/parser/makePot.js.map +0 -1
- package/lib/parser.d.ts +0 -6
- package/lib/parser.js +0 -110
- package/lib/parser.js.map +0 -1
- package/lib/tree.d.ts +0 -2
- package/lib/tree.js +0 -78
- package/lib/tree.js.map +0 -1
- package/lib/utils.d.ts +0 -8
- package/lib/utils.js +0 -78
- package/lib/utils.js.map +0 -1
- package/tests/consolidate.test.ts +0 -77
- package/tests/getStrings.test.ts +0 -85
- /package/{LICENSE.md → LICENSE} +0 -0
- /package/tests/{jsonParse.test.ts → jsonParse.ts} +0 -0
package/lib/cliArgs.js
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.parseCliArgs = exports.getArgs = void 0;
|
|
30
|
-
const yargs_1 = __importDefault(require("yargs"));
|
|
31
|
-
const helpers_1 = require("yargs/helpers");
|
|
32
|
-
const utils_1 = require("./utils");
|
|
33
|
-
const path = __importStar(require("path"));
|
|
34
|
-
const process = __importStar(require("process"));
|
|
35
|
-
const const_1 = require("./const");
|
|
36
|
-
const node_fs_1 = __importStar(require("node:fs"));
|
|
37
|
-
function isThemeOrPlugin(currentPath = '/', slug) {
|
|
38
|
-
const currentWorkingDirectory = currentPath;
|
|
39
|
-
try {
|
|
40
|
-
(0, node_fs_1.accessSync)(path.join(currentWorkingDirectory, slug + '.php'), node_fs_1.default.constants.R_OK);
|
|
41
|
-
return 'plugin';
|
|
42
|
-
}
|
|
43
|
-
catch (err) {
|
|
44
|
-
console.log('the current working directory ' +
|
|
45
|
-
currentWorkingDirectory +
|
|
46
|
-
' does not contain a ' +
|
|
47
|
-
slug +
|
|
48
|
-
'.php file');
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
(0, node_fs_1.accessSync)(path.join(currentWorkingDirectory, 'style.css'), node_fs_1.default.constants.R_OK);
|
|
52
|
-
return 'theme';
|
|
53
|
-
}
|
|
54
|
-
catch (err) {
|
|
55
|
-
console.log('the current working directory ' +
|
|
56
|
-
currentWorkingDirectory +
|
|
57
|
-
' does not contain a style.css file');
|
|
58
|
-
}
|
|
59
|
-
if (currentWorkingDirectory.includes('themes')) {
|
|
60
|
-
return 'theme';
|
|
61
|
-
}
|
|
62
|
-
else if (currentWorkingDirectory.includes('plugins')) {
|
|
63
|
-
return 'plugin';
|
|
64
|
-
}
|
|
65
|
-
return 'generic';
|
|
66
|
-
}
|
|
67
|
-
function getArgs() {
|
|
68
|
-
const args = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
69
|
-
.help('h')
|
|
70
|
-
.alias('help', 'help')
|
|
71
|
-
.usage('Usage: $0 <source> [destination] [options]')
|
|
72
|
-
.positional('sourceDirectory', {
|
|
73
|
-
describe: 'Source directory',
|
|
74
|
-
type: 'string',
|
|
75
|
-
})
|
|
76
|
-
.positional('destination', {
|
|
77
|
-
describe: 'Destination directory',
|
|
78
|
-
type: 'string',
|
|
79
|
-
})
|
|
80
|
-
.options({
|
|
81
|
-
slug: {
|
|
82
|
-
describe: 'Plugin or theme slug',
|
|
83
|
-
type: 'string',
|
|
84
|
-
},
|
|
85
|
-
domain: {
|
|
86
|
-
describe: 'Text domain to look for in the source code',
|
|
87
|
-
type: 'string',
|
|
88
|
-
},
|
|
89
|
-
'skip-js': {
|
|
90
|
-
describe: 'Skip JavaScript files',
|
|
91
|
-
type: 'boolean',
|
|
92
|
-
},
|
|
93
|
-
'skip-php': {
|
|
94
|
-
describe: 'Skip PHP files',
|
|
95
|
-
type: 'boolean',
|
|
96
|
-
},
|
|
97
|
-
'skip-blade': {
|
|
98
|
-
describe: 'Skip Blade files',
|
|
99
|
-
type: 'boolean',
|
|
100
|
-
},
|
|
101
|
-
'skip-block-json': {
|
|
102
|
-
describe: 'Skip block.json files',
|
|
103
|
-
type: 'boolean',
|
|
104
|
-
},
|
|
105
|
-
'skip-theme-json': {
|
|
106
|
-
describe: 'Skip theme.json files',
|
|
107
|
-
type: 'boolean',
|
|
108
|
-
},
|
|
109
|
-
'skip-audit': {
|
|
110
|
-
describe: 'Skip auditing of strings',
|
|
111
|
-
type: 'boolean',
|
|
112
|
-
},
|
|
113
|
-
headers: {
|
|
114
|
-
describe: 'Headers',
|
|
115
|
-
type: 'string',
|
|
116
|
-
},
|
|
117
|
-
'file-comment': {
|
|
118
|
-
describe: 'File comment',
|
|
119
|
-
type: 'string',
|
|
120
|
-
},
|
|
121
|
-
'package-name': {
|
|
122
|
-
describe: 'Package name',
|
|
123
|
-
type: 'string',
|
|
124
|
-
},
|
|
125
|
-
location: {
|
|
126
|
-
describe: 'Include location information',
|
|
127
|
-
type: 'boolean',
|
|
128
|
-
},
|
|
129
|
-
'ignore-domain': {
|
|
130
|
-
describe: 'Ignore text domain',
|
|
131
|
-
type: 'boolean',
|
|
132
|
-
},
|
|
133
|
-
mergePaths: {
|
|
134
|
-
describe: 'Merge with existing POT file(s)',
|
|
135
|
-
type: 'string',
|
|
136
|
-
},
|
|
137
|
-
subtractPaths: {
|
|
138
|
-
describe: 'Subtract strings from existing POT file(s)',
|
|
139
|
-
type: 'string',
|
|
140
|
-
},
|
|
141
|
-
subtractAndMerge: {
|
|
142
|
-
describe: 'Subtract and merge strings from existing POT file(s)',
|
|
143
|
-
type: 'boolean',
|
|
144
|
-
},
|
|
145
|
-
include: {
|
|
146
|
-
describe: 'Include specific files',
|
|
147
|
-
type: 'string',
|
|
148
|
-
},
|
|
149
|
-
exclude: {
|
|
150
|
-
describe: 'Exclude specific files',
|
|
151
|
-
type: 'string',
|
|
152
|
-
},
|
|
153
|
-
silent: {
|
|
154
|
-
describe: 'No output to stdout',
|
|
155
|
-
type: 'boolean',
|
|
156
|
-
},
|
|
157
|
-
json: {
|
|
158
|
-
describe: 'Output the json gettext data',
|
|
159
|
-
type: 'boolean',
|
|
160
|
-
},
|
|
161
|
-
output: {
|
|
162
|
-
describe: 'Output the gettext data',
|
|
163
|
-
type: 'boolean',
|
|
164
|
-
},
|
|
165
|
-
})
|
|
166
|
-
.parseSync();
|
|
167
|
-
return parseCliArgs(args);
|
|
168
|
-
}
|
|
169
|
-
exports.getArgs = getArgs;
|
|
170
|
-
function parseCliArgs(args) {
|
|
171
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
172
|
-
const inputPath = typeof args._[0] === 'string' ? args._[0] : '.';
|
|
173
|
-
const outputPath = typeof args._[1] === 'string' ? args._[1] : '.';
|
|
174
|
-
const currentWorkingDirectory = process.cwd();
|
|
175
|
-
const slug = args.slug && typeof args.slug === 'string'
|
|
176
|
-
? args.slug
|
|
177
|
-
: path.basename(path.resolve(currentWorkingDirectory, inputPath));
|
|
178
|
-
const cwd = path.relative(currentWorkingDirectory, inputPath);
|
|
179
|
-
const out = path.relative(currentWorkingDirectory, outputPath);
|
|
180
|
-
const domain = (_a = args === null || args === void 0 ? void 0 : args.domain) !== null && _a !== void 0 ? _a : isThemeOrPlugin(path.resolve(cwd), slug);
|
|
181
|
-
const parsedArgs = {
|
|
182
|
-
slug: slug,
|
|
183
|
-
domain: domain,
|
|
184
|
-
paths: { cwd: cwd, out: out },
|
|
185
|
-
options: {
|
|
186
|
-
ignoreDomain: !!(args === null || args === void 0 ? void 0 : args.ignoreDomain),
|
|
187
|
-
packageName: String((_b = args.packageName) !== null && _b !== void 0 ? _b : ''),
|
|
188
|
-
silent: !!args.silent,
|
|
189
|
-
json: !!args.json,
|
|
190
|
-
location: !!(args === null || args === void 0 ? void 0 : args.location),
|
|
191
|
-
output: !!(args === null || args === void 0 ? void 0 : args.output),
|
|
192
|
-
skip: {
|
|
193
|
-
js: !!args.skipJs,
|
|
194
|
-
php: !!args.skipPhp,
|
|
195
|
-
blade: !!args.skipBlade,
|
|
196
|
-
blockJson: !!args.skipBlockJson,
|
|
197
|
-
themeJson: !!args.skipThemeJson,
|
|
198
|
-
audit: !!args.skipAudit,
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
headers: {
|
|
202
|
-
fileComment: (_c = args.fileComment) !== null && _c !== void 0 ? _c : '',
|
|
203
|
-
},
|
|
204
|
-
patterns: {
|
|
205
|
-
mergePaths: (_d = (0, utils_1.stringstring)(args.mergePaths)) !== null && _d !== void 0 ? _d : [],
|
|
206
|
-
subtractPaths: (_e = (0, utils_1.stringstring)(args.subtractPaths)) !== null && _e !== void 0 ? _e : [],
|
|
207
|
-
subtractAndMerge: !!args.subtractAndMerge,
|
|
208
|
-
include: (_f = (0, utils_1.stringstring)(args.include)) !== null && _f !== void 0 ? _f : ['**'],
|
|
209
|
-
exclude: (_g = (0, utils_1.stringstring)(args.exclude)) !== null && _g !== void 0 ? _g : const_1.DEFAULT_EXCLUDED_PATH,
|
|
210
|
-
},
|
|
211
|
-
};
|
|
212
|
-
parsedArgs.paths.root = args.root ? String(args.root) : undefined;
|
|
213
|
-
return parsedArgs;
|
|
214
|
-
}
|
|
215
|
-
exports.parseCliArgs = parseCliArgs;
|
|
216
|
-
//# sourceMappingURL=cliArgs.js.map
|
package/lib/cliArgs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cliArgs.js","sourceRoot":"","sources":["../src/cliArgs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;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,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa;gBAC/B,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS;aACvB;SACD;QAED,OAAO,EAAE;YACR,WAAW,EAAE,MAAC,IAAI,CAAC,WAAsB,mCAAI,EAAE;SAC/C;QAED,QAAQ,EAAE;YACT,UAAU,EAAE,MAAA,IAAA,oBAAY,EAAC,IAAI,CAAC,UAAoB,CAAC,mCAAI,EAAE;YACzD,aAAa,EAAE,MAAA,IAAA,oBAAY,EAAC,IAAI,CAAC,aAAuB,CAAC,mCAAI,EAAE;YAC/D,gBAAgB,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB;YACzC,OAAO,EAAE,MAAA,IAAA,oBAAY,EAAC,IAAI,CAAC,OAAiB,CAAC,mCAAI,CAAC,IAAI,CAAC;YACvD,OAAO,EACN,MAAA,IAAA,oBAAY,EAAC,IAAI,CAAC,OAAiB,CAAC,mCAAI,6BAAqB;SAC9D;KACD,CAAA;IAED,UAAU,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAEjE,OAAO,UAAU,CAAA;AAClB,CAAC;AAzDD,oCAyDC"}
|
package/lib/consolidate.d.ts
DELETED
package/lib/consolidate.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.consolidate = void 0;
|
|
4
|
-
function consolidate(translationsArray) {
|
|
5
|
-
const mergedTranslations = {};
|
|
6
|
-
translationsArray.forEach((translations) => {
|
|
7
|
-
Object.entries(translations).forEach(([context, contextTranslations]) => {
|
|
8
|
-
if (!mergedTranslations[context]) {
|
|
9
|
-
mergedTranslations[context] = {};
|
|
10
|
-
}
|
|
11
|
-
Object.entries(contextTranslations).forEach(([msgid, translation]) => {
|
|
12
|
-
var _a, _b, _c;
|
|
13
|
-
if (!mergedTranslations[context][msgid]) {
|
|
14
|
-
mergedTranslations[context][msgid] = {
|
|
15
|
-
msgctxt: context !== '' ? context : undefined,
|
|
16
|
-
msgid: msgid !== null && msgid !== void 0 ? msgid : '',
|
|
17
|
-
msgid_plural: translation.msgid_plural,
|
|
18
|
-
msgstr: translation.msgstr,
|
|
19
|
-
comments: translation.comments,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
if (mergedTranslations[context][msgid].comments &&
|
|
24
|
-
((_a = mergedTranslations[context][msgid].comments) === null || _a === void 0 ? void 0 : _a.reference.length)) {
|
|
25
|
-
mergedTranslations[context][msgid].comments = Object.assign(Object.assign({}, translation.comments), { reference: ((_b = mergedTranslations[context][msgid]
|
|
26
|
-
.comments) === null || _b === void 0 ? void 0 : _b.reference) +
|
|
27
|
-
'\n' +
|
|
28
|
-
((_c = translation.comments) === null || _c === void 0 ? void 0 : _c.reference) });
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
return mergedTranslations;
|
|
35
|
-
}
|
|
36
|
-
exports.consolidate = consolidate;
|
|
37
|
-
//# sourceMappingURL=consolidate.js.map
|
package/lib/consolidate.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consolidate.js","sourceRoot":"","sources":["../src/consolidate.ts"],"names":[],"mappings":";;;AAWA,SAAgB,WAAW,CAC1B,iBAAuC;IAEvC,MAAM,kBAAkB,GAAuB,EAAE,CAAA;IAEjD,iBAAiB,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE;QAC1C,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,CACnC,CAAC,CAAC,OAAO,EAAE,mBAAmB,CAAC,EAAE,EAAE;YAClC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;gBAClC,kBAAkB,CAAC,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js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.readFileAsync = exports.writeFile = void 0;
|
|
39
|
-
const path = __importStar(require("path"));
|
|
40
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
41
|
-
function ensureFolderExists(folderPath) {
|
|
42
|
-
if (folderPath === undefined) {
|
|
43
|
-
return '.';
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
node_fs_1.default.accessSync(path.resolve(folderPath), node_fs_1.default.constants.R_OK | node_fs_1.default.constants.W_OK);
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
if (error.code === 'ENOENT') {
|
|
50
|
-
node_fs_1.default.mkdirSync(folderPath, { recursive: true });
|
|
51
|
-
console.log(`Folder created: ${folderPath}`);
|
|
52
|
-
return folderPath;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return folderPath;
|
|
56
|
-
}
|
|
57
|
-
function writeFile(fileContent, dest) {
|
|
58
|
-
if (ensureFolderExists(path.dirname(dest))) {
|
|
59
|
-
node_fs_1.default.writeFileSync(dest, fileContent);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.writeFile = writeFile;
|
|
63
|
-
function readFileAsync(path) {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
return node_fs_1.default.promises.readFile(path, 'utf-8');
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
exports.readFileAsync = readFileAsync;
|
|
69
|
-
//# sourceMappingURL=fs.js.map
|
package/lib/fs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4B;AAC5B,sDAAwB;AAQxB,SAAS,kBAAkB,CAAC,UAA8B;IACzD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,GAAG,CAAA;IACX,CAAC;IACD,IAAI,CAAC;QAEJ,iBAAE,CAAC,UAAU,CACZ,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EACxB,iBAAE,CAAC,SAAS,CAAC,IAAI,GAAG,iBAAE,CAAC,SAAS,CAAC,IAAI,CACrC,CAAA;IACF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAExD,iBAAE,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;YAC7C,OAAO,CAAC,GAAG,CAAC,mBAAmB,UAAU,EAAE,CAAC,CAAA;YAC5C,OAAO,UAAU,CAAA;QAClB,CAAC;IACF,CAAC;IACD,OAAO,UAAU,CAAA;AAClB,CAAC;AAQD,SAAgB,SAAS,CAAC,WAAmB,EAAE,IAAY;IAC1D,IAAI,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QAC5C,iBAAE,CAAC,aAAa,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;IACpC,CAAC;AACF,CAAC;AAJD,8BAIC;AAED,SAAsB,aAAa,CAAC,IAAY;;QAC/C,OAAO,iBAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC3C,CAAC;CAAA;AAFD,sCAEC"}
|
package/lib/glob.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import Parser from 'tree-sitter';
|
|
2
|
-
import type { Args, Patterns } from './types';
|
|
3
|
-
import { Glob, Path } from 'glob';
|
|
4
|
-
export declare function getParser(file: string): string | Parser;
|
|
5
|
-
export declare const ignoreFunc: (filePath: Path, excludedPatterns: string[]) => boolean;
|
|
6
|
-
export declare function getFiles(args: Args, pattern: Patterns): Promise<Glob<{
|
|
7
|
-
ignore: {
|
|
8
|
-
ignored: (p: Path) => boolean;
|
|
9
|
-
};
|
|
10
|
-
nodir: true;
|
|
11
|
-
cwd: string;
|
|
12
|
-
root: string | undefined;
|
|
13
|
-
}>>;
|
package/lib/glob.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.getFiles = exports.ignoreFunc = exports.getParser = void 0;
|
|
39
|
-
const path_1 = __importDefault(require("path"));
|
|
40
|
-
const glob_1 = require("glob");
|
|
41
|
-
const minimatch_1 = require("minimatch");
|
|
42
|
-
const Javascript = __importStar(require("tree-sitter-javascript"));
|
|
43
|
-
const Ts = __importStar(require("tree-sitter-typescript"));
|
|
44
|
-
const Php = __importStar(require("tree-sitter-php"));
|
|
45
|
-
const utils_1 = require("./utils");
|
|
46
|
-
function getParser(file) {
|
|
47
|
-
const ext = file.split('.').pop();
|
|
48
|
-
switch (ext) {
|
|
49
|
-
case 'ts':
|
|
50
|
-
return Ts.default.typescript;
|
|
51
|
-
case 'tsx':
|
|
52
|
-
return Ts.default.tsx;
|
|
53
|
-
case 'js':
|
|
54
|
-
case 'jsx':
|
|
55
|
-
case 'mjs':
|
|
56
|
-
case 'cjs':
|
|
57
|
-
return Javascript.default;
|
|
58
|
-
case 'php':
|
|
59
|
-
return Php.default;
|
|
60
|
-
default:
|
|
61
|
-
return ext;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.getParser = getParser;
|
|
65
|
-
const ignoreFunc = (filePath, excludedPatterns) => {
|
|
66
|
-
return excludedPatterns.some((exclude) => {
|
|
67
|
-
const type = (0, utils_1.detectPatternType)(exclude);
|
|
68
|
-
switch (type) {
|
|
69
|
-
case 'file':
|
|
70
|
-
return filePath.isNamed(exclude);
|
|
71
|
-
case 'directory':
|
|
72
|
-
return filePath.relative().includes(exclude);
|
|
73
|
-
default:
|
|
74
|
-
return (0, minimatch_1.minimatch)(filePath.relative(), exclude);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
exports.ignoreFunc = ignoreFunc;
|
|
79
|
-
function getFiles(args, pattern) {
|
|
80
|
-
var _a;
|
|
81
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
if (!((_a = args.options) === null || _a === void 0 ? void 0 : _a.silent))
|
|
83
|
-
console.log('Searching in :', path_1.default.resolve(args.paths.cwd), 'for ' + pattern.include.join(), '\nignoring patterns: ' + pattern.exclude.join());
|
|
84
|
-
return new glob_1.Glob(pattern.include, {
|
|
85
|
-
ignore: {
|
|
86
|
-
ignored: (p) => (0, exports.ignoreFunc)(p, pattern.exclude),
|
|
87
|
-
},
|
|
88
|
-
nodir: true,
|
|
89
|
-
cwd: args.paths.cwd,
|
|
90
|
-
root: args.paths.root ? path_1.default.resolve(args.paths.root) : undefined,
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
exports.getFiles = getFiles;
|
|
95
|
-
//# sourceMappingURL=glob.js.map
|
package/lib/glob.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../src/glob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gDAAuB;AAEvB,+BAAiC;AACjC,yCAAqC;AAGrC,mEAAoD;AAEpD,2DAA4C;AAE5C,qDAAsC;AACtC,mCAA2C;AAQ3C,SAAgB,SAAS,CAAC,IAAY;IACrC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAA;IACjC,QAAQ,GAAG,EAAE,CA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CAAC,OAAO,CAAC,IAAI,EAAE,CAChD,CAAA;QAGF,OAAO,IAAI,WAAI,CAAC,OAAO,CAAC,OAAO,EAAE;YAChC,MAAM,EAAE;gBACP,OAAO,EAAE,CAAC,CAAO,EAAE,EAAE,CAAC,IAAA,kBAAU,EAAC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC;aACpD;YACD,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;YACnB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;SACjE,CAAC,CAAA;;CACF;AAlBD,4BAkBC"}
|
package/lib/makePot.d.ts
DELETED
package/lib/makePot.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.makePot = void 0;
|
|
16
|
-
const headers_1 = require("./extractors/headers");
|
|
17
|
-
const fs_1 = require("./fs");
|
|
18
|
-
const parser_1 = require("./parser");
|
|
19
|
-
const node_os_1 = require("node:os");
|
|
20
|
-
const gettext_parser_1 = __importDefault(require("gettext-parser"));
|
|
21
|
-
const path_1 = __importDefault(require("path"));
|
|
22
|
-
const utils_1 = require("./utils");
|
|
23
|
-
const consolidate_1 = require("./consolidate");
|
|
24
|
-
const json_1 = require("./extractors/json");
|
|
25
|
-
function exec(args) {
|
|
26
|
-
var _a, _b, _c, _d, _e, _f;
|
|
27
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
if (!((_a = args.options) === null || _a === void 0 ? void 0 : _a.silent)) {
|
|
29
|
-
console.log('📝 Starting makePot for ', args === null || args === void 0 ? void 0 : args.slug);
|
|
30
|
-
console.log('🔍 Extracting strings from', args.paths);
|
|
31
|
-
console.log('💢 With options', args.options);
|
|
32
|
-
}
|
|
33
|
-
let stringsJson = yield (0, parser_1.runExtract)(args);
|
|
34
|
-
console.log('🎉 Done!', stringsJson);
|
|
35
|
-
stringsJson = stringsJson.filter((value) => value && Object.values(value).length);
|
|
36
|
-
const consolidatedStrings = (0, consolidate_1.consolidate)(stringsJson);
|
|
37
|
-
if (!((_b = args.options) === null || _b === void 0 ? void 0 : _b.silent)) {
|
|
38
|
-
console.log('Memory usage:', (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2), 'MB (Free:', ((0, node_os_1.totalmem)() / 1024 / 1024 / 1024).toFixed(2), 'GB)\n', 'Cpu User:', (process.cpuUsage().user / 1000000).toFixed(2), 'ms Cpu System:', (process.cpuUsage().system / 1000000).toFixed(2), 'ms of', (0, node_os_1.cpus)().length, 'cores');
|
|
39
|
-
}
|
|
40
|
-
if ((_c = args.options) === null || _c === void 0 ? void 0 : _c.skip.audit) {
|
|
41
|
-
console.log('Audit strings...');
|
|
42
|
-
console.log('✅ Done');
|
|
43
|
-
}
|
|
44
|
-
const potHeader = (0, headers_1.generateHeader)(args);
|
|
45
|
-
const copyrightComment = `# Copyright (C) ${new Date().getFullYear()} ${args.slug}\n` +
|
|
46
|
-
`# This file is distributed under the ${(_e = (_d = args.headers) === null || _d === void 0 ? void 0 : _d.license) !== null && _e !== void 0 ? _e : 'GPL v2 or later'} license.`;
|
|
47
|
-
const potDefinitions = (0, headers_1.translationsHeaders)(args);
|
|
48
|
-
const translationsUnion = (0, utils_1.advancedObjectMerge)({ '': potDefinitions }, consolidatedStrings);
|
|
49
|
-
if (!((_f = args.options) === null || _f === void 0 ? void 0 : _f.silent)) {
|
|
50
|
-
console.log('📝 Found', Object.values(translationsUnion).length, 'group of strings in', stringsJson.length, 'files.\n', 'In total ' +
|
|
51
|
-
Object.values(translationsUnion)
|
|
52
|
-
.map((v) => Object.keys(v).length)
|
|
53
|
-
.reduce((acc, val) => acc + val, 0) +
|
|
54
|
-
' strings were found');
|
|
55
|
-
}
|
|
56
|
-
const getTextTranslations = {
|
|
57
|
-
charset: 'iso-8859-1',
|
|
58
|
-
headers: potHeader,
|
|
59
|
-
translations: translationsUnion,
|
|
60
|
-
};
|
|
61
|
-
const pluginTranslations = gettext_parser_1.default.po
|
|
62
|
-
.compile(getTextTranslations)
|
|
63
|
-
.toString('utf-8');
|
|
64
|
-
return copyrightComment + '\n' + pluginTranslations;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
function makePot(args) {
|
|
68
|
-
var _a;
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const pkgData = (0, json_1.extractPackageJson)(args);
|
|
71
|
-
const metadata = (0, headers_1.extractMainFileData)(args);
|
|
72
|
-
args.headers = Object.assign(Object.assign(Object.assign({}, args.headers), pkgData), {
|
|
73
|
-
name: metadata.name,
|
|
74
|
-
description: metadata.description,
|
|
75
|
-
author: metadata.author,
|
|
76
|
-
});
|
|
77
|
-
const jsonTranslations = yield exec(args);
|
|
78
|
-
(0, fs_1.writeFile)(jsonTranslations, path_1.default.join(process.cwd(), args.paths.out, `${args === null || args === void 0 ? void 0 : args.slug}.${((_a = args.options) === null || _a === void 0 ? void 0 : _a.json) ? 'json' : 'pot'}`));
|
|
79
|
-
return jsonTranslations;
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
exports.makePot = makePot;
|
|
83
|
-
//# sourceMappingURL=makePot.js.map
|
package/lib/makePot.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"makePot.js","sourceRoot":"","sources":["../src/makePot.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAI6B;AAC7B,6BAAgC;AAChC,qCAAqC;AACrC,qCAAwC;AACxC,oEAGuB;AACvB,gDAAuB;AACvB,mCAA6C;AAC7C,+CAA2C;AAC3C,4CAAsD;AAOtD,SAAe,IAAI,CAAC,IAAU;;;QAC7B,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,CAAA,EAAE,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC,CAAA;YACnD,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;YACrD,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;QAC7C,CAAC;QAKD,IAAI,WAAW,GAAG,MAAM,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAA;QACxC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,CAAC,CAAA;QACpC,WAAW,GAAG,WAAW,CAAC,MAAM,CAC/B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAC/C,CAAA;QAKD,MAAM,mBAAmB,GAAG,IAAA,yBAAW,EAAC,WAAmC,CAAC,CAAA;QAE5E,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,CAAA,EAAE,CAAC;YAC3B,OAAO,CAAC,GAAG,CACV,e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