@wp-blocks/make-pot 1.0.2 → 1.3.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.
Files changed (128) hide show
  1. package/README.md +18 -1
  2. package/biome.json +12 -0
  3. package/lib/assets/block-i18n.js +1 -0
  4. package/lib/assets/package-i18n.js +1 -0
  5. package/lib/assets/theme-i18n.js +1 -0
  6. package/lib/assets/wp-plugin-i18n.js +1 -0
  7. package/lib/assets/wp-theme-i18n.js +1 -0
  8. package/lib/cli/getArgs.js +1 -0
  9. package/lib/cli/parseCli.js +1 -111
  10. package/lib/const.js +1 -93
  11. package/lib/extractors/css.js +1 -42
  12. package/lib/extractors/headers.js +1 -63
  13. package/lib/extractors/json.js +1 -82
  14. package/lib/extractors/php.js +2 -49
  15. package/lib/extractors/schema.js +1 -121
  16. package/lib/extractors/text.js +1 -19
  17. package/lib/extractors/utils.js +1 -54
  18. package/lib/fs/fs.js +1 -0
  19. package/lib/fs/glob.js +3 -95
  20. package/lib/index.js +1 -26
  21. package/lib/parser/exec.js +3 -71
  22. package/lib/parser/makePot.js +1 -35
  23. package/lib/parser/patterns.js +1 -34
  24. package/lib/parser/process.js +1 -70
  25. package/lib/parser/progress.js +1 -0
  26. package/lib/parser/taskRunner.js +1 -0
  27. package/lib/parser/tree.js +1 -87
  28. package/lib/run.js +1 -0
  29. package/lib/types.js +1 -3
  30. package/lib/utils/common.js +2 -0
  31. package/package.json +68 -62
  32. package/tsconfig.json +3 -19
  33. package/ .prettierignore +0 -3
  34. package/.editorconfig +0 -15
  35. package/.eslintrc.json +0 -12
  36. package/jest.config.json +0 -18
  37. package/lib/assets/block-i18n.json +0 -17
  38. package/lib/assets/package-i18n.json +0 -13
  39. package/lib/assets/theme-i18n.json +0 -86
  40. package/lib/assets/wp-plugin-i18n.json +0 -14
  41. package/lib/assets/wp-theme-i18n.json +0 -13
  42. package/lib/cli/index.d.ts +0 -1
  43. package/lib/cli/index.js +0 -114
  44. package/lib/cli/index.js.map +0 -1
  45. package/lib/cli/parseCli.d.ts +0 -3
  46. package/lib/cli/parseCli.js.map +0 -1
  47. package/lib/cliArgs.d.ts +0 -4
  48. package/lib/cliArgs.js +0 -216
  49. package/lib/cliArgs.js.map +0 -1
  50. package/lib/consolidate.d.ts +0 -2
  51. package/lib/consolidate.js +0 -37
  52. package/lib/consolidate.js.map +0 -1
  53. package/lib/const.d.ts +0 -140
  54. package/lib/const.js.map +0 -1
  55. package/lib/extractors/css.d.ts +0 -2
  56. package/lib/extractors/css.js.map +0 -1
  57. package/lib/extractors/headers.d.ts +0 -6
  58. package/lib/extractors/headers.js.map +0 -1
  59. package/lib/extractors/index.d.ts +0 -2
  60. package/lib/extractors/index.js +0 -60
  61. package/lib/extractors/index.js.map +0 -1
  62. package/lib/extractors/json.d.ts +0 -9
  63. package/lib/extractors/json.js.map +0 -1
  64. package/lib/extractors/php.d.ts +0 -3
  65. package/lib/extractors/php.js.map +0 -1
  66. package/lib/extractors/schema.d.ts +0 -13
  67. package/lib/extractors/schema.js.map +0 -1
  68. package/lib/extractors/text.d.ts +0 -1
  69. package/lib/extractors/text.js.map +0 -1
  70. package/lib/extractors/utils.d.ts +0 -5
  71. package/lib/extractors/utils.js.map +0 -1
  72. package/lib/fs/glob.d.ts +0 -13
  73. package/lib/fs/glob.js.map +0 -1
  74. package/lib/fs/index.d.ts +0 -2
  75. package/lib/fs/index.js +0 -69
  76. package/lib/fs/index.js.map +0 -1
  77. package/lib/fs.d.ts +0 -2
  78. package/lib/fs.js +0 -69
  79. package/lib/fs.js.map +0 -1
  80. package/lib/glob.d.ts +0 -13
  81. package/lib/glob.js +0 -95
  82. package/lib/glob.js.map +0 -1
  83. package/lib/index.d.ts +0 -2
  84. package/lib/index.js.map +0 -1
  85. package/lib/makePot.d.ts +0 -2
  86. package/lib/makePot.js +0 -83
  87. package/lib/makePot.js.map +0 -1
  88. package/lib/maps.d.ts +0 -122
  89. package/lib/maps.js +0 -73
  90. package/lib/maps.js.map +0 -1
  91. package/lib/parser/consolidate.d.ts +0 -2
  92. package/lib/parser/consolidate.js +0 -37
  93. package/lib/parser/consolidate.js.map +0 -1
  94. package/lib/parser/exec.d.ts +0 -3
  95. package/lib/parser/exec.js.map +0 -1
  96. package/lib/parser/index.d.ts +0 -2
  97. package/lib/parser/index.js +0 -24
  98. package/lib/parser/index.js.map +0 -1
  99. package/lib/parser/makePot.d.ts +0 -2
  100. package/lib/parser/makePot.js.map +0 -1
  101. package/lib/parser/patterns.d.ts +0 -2
  102. package/lib/parser/patterns.js.map +0 -1
  103. package/lib/parser/process.d.ts +0 -5
  104. package/lib/parser/process.js.map +0 -1
  105. package/lib/parser/tree.d.ts +0 -2
  106. package/lib/parser/tree.js.map +0 -1
  107. package/lib/parser.d.ts +0 -6
  108. package/lib/parser.js +0 -110
  109. package/lib/parser.js.map +0 -1
  110. package/lib/tree.d.ts +0 -2
  111. package/lib/tree.js +0 -78
  112. package/lib/tree.js.map +0 -1
  113. package/lib/types.d.ts +0 -50
  114. package/lib/types.js.map +0 -1
  115. package/lib/utils/index.d.ts +0 -8
  116. package/lib/utils/index.js +0 -78
  117. package/lib/utils/index.js.map +0 -1
  118. package/lib/utils.d.ts +0 -8
  119. package/lib/utils.js +0 -78
  120. package/lib/utils.js.map +0 -1
  121. package/tests/consolidate.test.ts +0 -77
  122. package/tests/extract.test.ts +0 -391
  123. package/tests/getFiles.test.ts +0 -114
  124. package/tests/getStrings.test.ts +0 -85
  125. package/tests/ignoreFunction.test.ts +0 -126
  126. package/tests/jsonParse.test.ts +0 -51
  127. package/tests/tree.test.ts +0 -152
  128. /package/{LICENSE.md → LICENSE} +0 -0
@@ -1,87 +1 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.doTree = void 0;
7
- const tree_sitter_1 = __importDefault(require("tree-sitter"));
8
- const const_1 = require("../const");
9
- const glob_1 = require("../fs/glob");
10
- const utils_1 = require("../utils");
11
- function collectComments(node) {
12
- var _a, _b;
13
- let currentNode = node;
14
- let depth = 0;
15
- while (currentNode && depth < 6) {
16
- if (((_a = currentNode === null || currentNode === void 0 ? void 0 : currentNode.previousSibling) === null || _a === void 0 ? void 0 : _a.type) === 'comment' &&
17
- ((_b = currentNode === null || currentNode === void 0 ? void 0 : currentNode.previousSibling) === null || _b === void 0 ? void 0 : _b.text.toLowerCase().includes('translators'))) {
18
- return (0, utils_1.stripTranslationMarkup)(currentNode === null || currentNode === void 0 ? void 0 : currentNode.previousSibling.text);
19
- }
20
- depth++;
21
- currentNode = currentNode.parent;
22
- }
23
- }
24
- function doTree(sourceCode, filepath) {
25
- var _a;
26
- const parser = new tree_sitter_1.default();
27
- parser.setLanguage((0, glob_1.getParser)(filepath));
28
- const tree = parser.parse(sourceCode);
29
- const gettextTranslations = {};
30
- const typeToMatch = ((_a = filepath.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== 'php'
31
- ? 'call_expression'
32
- : 'function_call_expression';
33
- function traverse(node) {
34
- var _a, _b, _c, _d, _e, _f, _g, _h;
35
- if (node === null || node === void 0 ? void 0 : node.children.length)
36
- for (const child of node.children) {
37
- traverse(child);
38
- }
39
- if ((node === null || node === void 0 ? void 0 : node.type) === typeToMatch) {
40
- const functionName = (_b = (_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : null;
41
- if (functionName === null ||
42
- !Object.keys(const_1.i18nFunctions).includes(functionName)) {
43
- return;
44
- }
45
- const argsNode = node.lastChild;
46
- if (argsNode === null ||
47
- argsNode.childCount === 0 ||
48
- argsNode.type !== 'arguments') {
49
- return;
50
- }
51
- const [_fn, raw] = node.children;
52
- const translation = {};
53
- const translationKeys = const_1.i18nFunctions[functionName];
54
- const children = raw.children.slice(1, -1);
55
- let translationKeyIndex = 0;
56
- for (const child of children) {
57
- let node = child;
58
- if (child.type === "argument") {
59
- if (child.children.length === 0)
60
- continue;
61
- node = child.children[0];
62
- }
63
- if (node.type !== "string")
64
- continue;
65
- const currentKey = translationKeys[translationKeyIndex];
66
- translation[currentKey] =
67
- child.text.slice(1, -1);
68
- translationKeyIndex += 1;
69
- }
70
- const gettext = {
71
- msgctxt: (_c = translation.msgctxt) !== null && _c !== void 0 ? _c : '',
72
- msgid: (_d = translation.msgid) !== null && _d !== void 0 ? _d : '',
73
- msgid_plural: (_e = translation.msgid_plural) !== null && _e !== void 0 ? _e : '',
74
- msgstr: translation.msgid_plural ? ['', ''] : [''],
75
- comments: {
76
- translator: (_f = collectComments(node)) !== null && _f !== void 0 ? _f : '',
77
- reference: `${filepath}:${node.startPosition.row + 1}`,
78
- },
79
- };
80
- gettextTranslations[(_g = gettext.msgctxt) !== null && _g !== void 0 ? _g : ''] = Object.assign(Object.assign({}, (gettextTranslations[(_h = gettext.msgctxt) !== null && _h !== void 0 ? _h : ''] || {})), { [gettext.msgid]: gettext });
81
- }
82
- }
83
- traverse(tree.rootNode);
84
- return gettextTranslations;
85
- }
86
- exports.doTree = doTree;
87
- //# sourceMappingURL=tree.js.map
1
+ "use strict";var T=Object.create;var g=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var K=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var F=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},k=(e,t,n,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of P(t))!L.call(e,s)&&s!==n&&g(e,s,{get:()=>t[s],enumerable:!(c=O(t,s))||c.enumerable});return e};var M=(e,t,n)=>(n=e!=null?T(K(e)):{},k(t||!e||!e.__esModule?g(n,"default",{value:e,enumerable:!0}):n,e)),j=e=>k(g({},"__esModule",{value:!0}),e);var V={};F(V,{doTree:()=>U});module.exports=j(V);var _=M(require("tree-sitter")),y=require("../const.js"),p=require("gettext-merger"),w=require("../fs/glob.js"),m=require("../utils/common.js");function I(e){let t=e,n=0;for(;t&&n<6;){if(t?.previousSibling?.type==="comment"&&t?.previousSibling?.text.toLowerCase().includes("translators"))return(0,m.stripTranslationMarkup)(t?.previousSibling.text);n++,t=t.parent}}function U(e,t){const n=new _.default;n.setLanguage((0,w.getParser)(t));const c=n.parse(e),s=new p.SetOfBlocks([],t),N=t.split(".").pop()?.toLowerCase()!=="php"?"call_expression":"function_call_expression",v=["string","encapsed_string","string_value"];function x(r){if(r?.children.length)for(const o of r.children)x(o);if(r?.type===N){const o=r.firstChild?.text??null;if(o===null||!Object.keys(y.i18nFunctions).includes(o))return;const a=r.lastChild;if(a===null||a.childCount===0||a.type!=="arguments")return;const[q,C]=r.children,i={},h=y.i18nFunctions[o],$=C.children.slice(1,-1);let f=0;for(const d of $){let l=d,u=l.text;if(d.type==="argument"){if(d.children.length===0)continue;l=d.children[0]}if(l?.type===",")continue;if(v.includes(l?.type))u=u.slice(1,-1);else{console.warn(`Unexpected node type: ${l?.type} is ${h[f]} for ${u} in ${t}`);continue}const B=h[f];i[B]=u,f+=1}const S=I(a),b=new p.Block({msgctxt:i.msgctxt,msgid:i.msgid??"",msgid_plural:i.msgid_plural,msgstr:i.msgid_plural?["",""]:[""],comments:{translator:S?[S]:void 0,reference:[`${(0,m.reverseSlashes)(t)}:${r.startPosition.row+1}`]}});s.add(b)}}return x(c.rootNode),s}0&&(module.exports={doTree});
package/lib/run.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var f=(t,e)=>{for(var n in e)i(t,n,{get:e[n],enumerable:!0})},p=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of l(e))!g.call(t,o)&&o!==n&&i(t,o,{get:()=>e[o],enumerable:!(r=c(e,o))||r.enumerable});return t};var d=t=>p(i({},"__esModule",{value:!0}),t);var k={};f(k,{default:()=>a});module.exports=d(k);var m=require("./parser/makePot.js"),s=require("./utils/common");function a(t){if(Object.keys(t).length>0){const{version:e,name:n}=(0,s.getPkgJsonData)("name","version");console.log(`${n} version: ${e}`);const r=new Date;(0,m.makePot)(t).then(()=>{console.log(`\u{1F680} Translation Pot file created in ${new Date().getTime()-r.getTime()}ms`)}).catch(o=>{console.error("Error in makePot: "+o)})}}
package/lib/types.js CHANGED
@@ -1,3 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
1
+ "use strict";var r=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var g=(t,e,a,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of i(e))!p.call(t,n)&&n!==a&&r(t,n,{get:()=>e[n],enumerable:!(o=s(e,n))||o.enumerable});return t};var l=t=>g(r({},"__esModule",{value:!0}),t);var m={};module.exports=l(m);
@@ -0,0 +1,2 @@
1
+ "use strict";var l=Object.create;var s=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var d=(n,t)=>{for(var r in t)s(n,r,{get:t[r],enumerable:!0})},c=(n,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of f(t))!m.call(n,e)&&e!==r&&s(n,e,{get:()=>t[e],enumerable:!(o=a(t,e))||o.enumerable});return n};var u=(n,t,r)=>(r=n!=null?l(p(n)):{},c(t||!n||!n.__esModule?s(r,"default",{value:n,enumerable:!0}):r,n)),k=n=>c(s({},"__esModule",{value:!0}),n);var w={};d(w,{detectPatternType:()=>P,getCommentBlock:()=>h,getCopyright:()=>S,getPkgJsonData:()=>v,removeCommentMarkup:()=>x,reverseSlashes:()=>b,stringstring:()=>C,stripTranslationMarkup:()=>y});module.exports=k(w);var g=u(require("node:fs")),i=u(require("node:path"));function h(n){const t=n.match(/\/\*\*?[\s\S]*?\*\//);return t!==null?t[0]:n}function x(n){return n.match(/[a-zA-Z].*/gm)}function y(n){const t=/\/\*\*?\s*(?:translators:)\s*([\s\S]*?)\s*\*\/|\/\/\s*(?:translators:)\s*(.*)$/i,r=n.match(t);return r?r[1]:n}function C(n){return typeof n=="string"?n.includes(",")?n.split(","):[n]:null}function P(n){const t=n.includes("."),r=n.includes(i.default.sep);return n.includes("*")?"glob":!t&&!r?"directory":t&&!r?"file":"glob"}function S(n,t="GPL v2 or later"){return`# Copyright (C) ${new Date().getFullYear()} ${n}
2
+ # This file is distributed under the ${t} license.`}function b(n){return n.replace(/\//g,"\\")}function v(...n){const t={},r=i.default.join(__dirname,"..","..","package.json"),o=g.default.existsSync(r)?require(r):{name:"makepot",version:""};for(const e of n)o[e]&&(t[e]=o[e]);return t}0&&(module.exports={detectPatternType,getCommentBlock,getCopyright,getPkgJsonData,removeCommentMarkup,reverseSlashes,stringstring,stripTranslationMarkup});
package/package.json CHANGED
@@ -1,62 +1,68 @@
1
- {
2
- "name": "@wp-blocks/make-pot",
3
- "version": "1.0.2",
4
- "description": "A Node.js script for generating a POT file from source code",
5
- "author": "Erik Golinelli <https://github.com/erikyo>",
6
- "main": "lib/index.js",
7
- "scripts": {
8
- "postinstall": "npm rebuild tree-sitter tree-sitter-typescript tree-sitter-php tree-sitter-javascript --force",
9
- "build": "tsc --build",
10
- "watch": "tsc --watch",
11
- "clean": "tsc --build --clean",
12
- "lint": "eslint ./src ./tests --fix",
13
- "test": "jest --coverage",
14
- "update-snapshots": "jest -- -u",
15
- "run": "node ./lib/index.js tests/fixtures/vinyl/"
16
- },
17
- "bin": {
18
- "make-pot": "lib/index.js"
19
- },
20
- "repository": {
21
- "type": "git",
22
- "url": "https://github.com/wp-blocks/makePot.git"
23
- },
24
- "bugs": {
25
- "url": "https://github.com/wp-blocks/makePot/issues"
26
- },
27
- "dependencies": {
28
- "axios": "^1.6.8",
29
- "cli-progress": "^3.12.0",
30
- "gettext-merger": "^0.1.0",
31
- "gettext-parser": "^7.0.1",
32
- "glob": "^10.3.10",
33
- "tree-sitter": "^0.20.6",
34
- "tree-sitter-javascript": "^0.20.4",
35
- "tree-sitter-php": "^0.20.0",
36
- "tree-sitter-typescript": "^0.20.5",
37
- "yargs": "^17.7.2"
38
- },
39
- "devDependencies": {
40
- "@jest/globals": "^29.7.0",
41
- "@types/cli-progress": "^3.11.5",
42
- "@types/gettext-parser": "^4.0.4",
43
- "@types/jest": "^29.5.12",
44
- "@types/node": "^20.11.28",
45
- "@types/strip-comments": "^2.0.4",
46
- "@types/yargs": "^17.0.32",
47
- "@typescript-eslint/eslint-plugin": "^6.18.1",
48
- "@typescript-eslint/parser": "^6.14.0",
49
- "eslint": "^8.57.0",
50
- "eslint-config-standard": "^17.1.0",
51
- "eslint-config-standard-with-typescript": "^43.0.0",
52
- "eslint-plugin-import": "^2.29.1",
53
- "eslint-plugin-n": "^16.6.1",
54
- "eslint-plugin-promise": "^6.1.1",
55
- "husky": "^9.0.11",
56
- "jest": "^29.7.0",
57
- "lint-staged": "^15.2.2",
58
- "prettier": "3.2.5",
59
- "ts-jest": "^29.1.2",
60
- "typescript": "^5.4.2"
61
- }
62
- }
1
+ {
2
+ "name": "@wp-blocks/make-pot",
3
+ "version": "1.3.0",
4
+ "license": "GPL-3.0-or-later",
5
+ "homepage": "https://wp-blocks.github.io/make-pot/",
6
+ "description": "A Node.js script for generating a POT file from source code",
7
+ "authors": [
8
+ "Erik Golinelli <erik@codekraft.it> (https://codekraft.it/)",
9
+ "John Hooks <bitmachina@outlook.com> (https://johnhooks.io/)"
10
+ ],
11
+ "main": "lib/run.js",
12
+ "bin": {
13
+ "make-pot": "lib/index.js"
14
+ },
15
+ "type": "commonjs",
16
+ "engines": {
17
+ "node": ">=16.0.0"
18
+ },
19
+ "files": ["lib", "*.md", "*.json", "LICENSE"],
20
+ "keywords": [
21
+ "gettext",
22
+ "i18n",
23
+ "pot",
24
+ "WordPress",
25
+ "translation",
26
+ "internalization"
27
+ ],
28
+ "scripts": {
29
+ "postinstall": "npm rebuild tree-sitter tree-sitter-typescript tree-sitter-php tree-sitter-javascript --force",
30
+ "build": "npx esbuild ./src/**/* --format=cjs --minify --outdir=lib --platform=node",
31
+ "watch": "tsc --watch",
32
+ "lint": "npx @biomejs/biome check --apply src",
33
+ "test": "node --test",
34
+ "ci:bundle": "npx esbuild ./src/index.ts --format=cjs --outdir=lib --bundle --external:tree-sitter --external:tree-sitter-typescript --external:tree-sitter-php --external:tree-sitter-javascript --platform=node",
35
+ "test:ci": "npm run ci:bundle && node --test",
36
+ "test:watch": "node --test --watch",
37
+ "test:coverage": "node --test --experimental-test-coverage",
38
+ "run": "node ./lib/index.js tests/fixtures/vinyl/"
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/wp-blocks/makePot.git"
43
+ },
44
+ "bugs": {
45
+ "url": "https://github.com/wp-blocks/makePot/issues"
46
+ },
47
+ "dependencies": {
48
+ "axios": "^1.6.8",
49
+ "cli-progress": "^3.12.0",
50
+ "gettext-merger": "^1.2.1",
51
+ "gettext-parser": "^4.0.4",
52
+ "glob": "^10.3.10",
53
+ "tree-sitter": "^0.20.6",
54
+ "tree-sitter-javascript": "^0.20.4",
55
+ "tree-sitter-php": "^0.20.0",
56
+ "tree-sitter-typescript": "^0.20.5",
57
+ "yargs": "^17.7.1"
58
+ },
59
+ "devDependencies": {
60
+ "@biomejs/biome": "1.7.3",
61
+ "@types/cli-progress": "^3.11.5",
62
+ "@types/gettext-parser": "^4.0.4",
63
+ "@types/node": "^20.11.28",
64
+ "@types/yargs": "^17.0.32",
65
+ "esbuild": "0.21.1",
66
+ "typescript": "^5.4.5"
67
+ }
68
+ }
package/tsconfig.json CHANGED
@@ -1,32 +1,16 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "module": "commonjs",
4
- "target": "ES2015",
5
- "lib": [ "Es6" ],
4
+ "moduleResolution": "Node16",
6
5
  "noImplicitAny": true,
7
- "removeComments": true,
8
6
  "preserveConstEnums": true,
9
7
  "sourceMap": true,
10
8
  "strict": true,
11
- "declaration": true,
12
9
  "downlevelIteration": true,
13
10
  "esModuleInterop": true,
14
11
  "resolveJsonModule": true,
15
- "allowSyntheticDefaultImports": true,
16
- "experimentalDecorators": true,
17
- // Import non-ES modules as default imports.
18
12
  "outDir": "lib",
19
- "rootDir": "src",
20
- // Minify
21
- "pretty": false,
22
- // types
23
- "typeRoots": [
24
- "src/types.d.ts",
25
- "node_modules/@types",
26
- "@types"
27
- ]
13
+ "rootDir": "src"
28
14
  },
29
- "include": [
30
- "./src/**/*"
31
- ]
15
+ "include": ["./src/**/*", "./tsconfig.json"]
32
16
  }
@@ -1,3 +0,0 @@
1
- # Ignore artifacts:
2
- build
3
- coverage
package/.editorconfig DELETED
@@ -1,15 +0,0 @@
1
- # This file is for unifying the coding style for different editors and IDEs
2
- # editorconfig.org
3
-
4
- # WordPress Coding Standards
5
- # https://make.wordpress.org/core/handbook/coding-standards/
6
-
7
- root = true
8
-
9
- [*]
10
- charset = utf-8
11
- end_of_line = lf
12
- insert_final_newline = true
13
- trim_trailing_whitespace = true
14
- indent_size = 4
15
- indent_style = tab
package/.eslintrc.json DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "node": true,
5
- "commonjs": true,
6
- "es2021": true
7
- },
8
- "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
9
- "parser": "@typescript-eslint/parser",
10
- "plugins": ["@typescript-eslint"],
11
- "root": true
12
- }
package/jest.config.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "preset": "ts-jest",
3
- "testEnvironment": "node",
4
- "testRegex": "(/tests/.*(test|spec))\\.tsx?$",
5
- "transformIgnorePatterns": ["/node_modules/"],
6
- "coverageThreshold": {
7
- "global": {
8
- "branches": 10,
9
- "functions": 10,
10
- "lines": 10,
11
- "statements": 10
12
- }
13
- },
14
- "collectCoverageFrom": ["./src/**/*.{js,jsx,ts,tsx}", "!**/tests/**"],
15
- "coverageReporters": [ "json", "lcov", "text", "clover" ],
16
- "collectCoverage": true,
17
- "coverageDirectory": "docs/coverage"
18
- }
@@ -1,17 +0,0 @@
1
- {
2
- "title": "block title",
3
- "description": "block description",
4
- "keywords": ["block keyword"],
5
- "styles": [
6
- {
7
- "label": "block style label"
8
- }
9
- ],
10
- "variations": [
11
- {
12
- "title": "block variation title",
13
- "description": "block variation description",
14
- "keywords": ["block variation keyword"]
15
- }
16
- ]
17
- }
@@ -1,13 +0,0 @@
1
- {
2
- "name": "name",
3
- "url": "url",
4
- "description": "description",
5
- "author": "author",
6
- "authorEmail": "authorEmail",
7
- "version": "version",
8
- "bugs": "bugs",
9
- "bugs.url": "bugsUrl",
10
- "bugs.email": "bugsEmail",
11
- "license": "license",
12
- "repository": "repository"
13
- }
@@ -1,86 +0,0 @@
1
- {
2
- "title": "Style variation name",
3
- "settings": {
4
- "typography": {
5
- "fontSizes": [
6
- {
7
- "name": "Font size name"
8
- }
9
- ],
10
- "fontFamilies": [
11
- {
12
- "name": "Font family name"
13
- }
14
- ]
15
- },
16
- "color": {
17
- "palette": [
18
- {
19
- "name": "Color name"
20
- }
21
- ],
22
- "gradients": [
23
- {
24
- "name": "Gradient name"
25
- }
26
- ],
27
- "duotone": [
28
- {
29
- "name": "Duotone name"
30
- }
31
- ]
32
- },
33
- "spacing": {
34
- "spacingSizes": [
35
- {
36
- "name": "Space size name"
37
- }
38
- ]
39
- },
40
- "blocks": {
41
- "*": {
42
- "typography": {
43
- "fontSizes": [
44
- {
45
- "name": "Font size name"
46
- }
47
- ],
48
- "fontFamilies": [
49
- {
50
- "name": "Font family name"
51
- }
52
- ]
53
- },
54
- "color": {
55
- "palette": [
56
- {
57
- "name": "Color name"
58
- }
59
- ],
60
- "gradients": [
61
- {
62
- "name": "Gradient name"
63
- }
64
- ]
65
- },
66
- "spacing": {
67
- "spacingSizes": [
68
- {
69
- "name": "Space size name"
70
- }
71
- ]
72
- }
73
- }
74
- }
75
- },
76
- "customTemplates": [
77
- {
78
- "title": "Custom template name"
79
- }
80
- ],
81
- "templateParts": [
82
- {
83
- "title": "Template part name"
84
- }
85
- ]
86
- }
@@ -1,14 +0,0 @@
1
- {
2
- "name": "Plugin Name",
3
- "url": "Plugin URI",
4
- "description": "Description",
5
- "version": "Version",
6
- "author": "Author",
7
- "authorUri": "Author URI",
8
- "tags": "Tags",
9
- "license": "License",
10
- "licenseUri": "License URI",
11
- "updateUri": "Update URI",
12
- "domainPath": "Domain Path",
13
- "textDomain": "Text Domain"
14
- }
@@ -1,13 +0,0 @@
1
- {
2
- "name": "Theme Name",
3
- "author": "Author",
4
- "authorUri": "Author URI",
5
- "description": "Description",
6
- "url": "Theme URI",
7
- "tags": "Tags",
8
- "version": "Version",
9
- "license": "License",
10
- "licenseUri": "License URI",
11
- "domainPath": "Domain Path",
12
- "textDomain": "Text Domain"
13
- }
@@ -1 +0,0 @@
1
- export declare function getArgs(): import("../types").Args;
package/lib/cli/index.js DELETED
@@ -1,114 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getArgs = void 0;
7
- const yargs_1 = __importDefault(require("yargs"));
8
- const helpers_1 = require("yargs/helpers");
9
- const process_1 = __importDefault(require("process"));
10
- const parseCli_1 = require("./parseCli");
11
- function getArgs() {
12
- const args = (0, yargs_1.default)((0, helpers_1.hideBin)(process_1.default.argv))
13
- .help('h')
14
- .alias('help', 'help')
15
- .usage('Usage: $0 <source> [destination] [options]')
16
- .positional('sourceDirectory', {
17
- describe: 'Source directory',
18
- type: 'string',
19
- })
20
- .positional('destination', {
21
- describe: 'Destination directory',
22
- type: 'string',
23
- })
24
- .options({
25
- slug: {
26
- describe: 'Plugin or theme slug',
27
- type: 'string',
28
- },
29
- domain: {
30
- describe: 'Text domain to look for in the source code',
31
- type: 'string',
32
- },
33
- 'skip-js': {
34
- describe: 'Skip JavaScript files',
35
- type: 'boolean',
36
- },
37
- 'skip-php': {
38
- describe: 'Skip PHP files',
39
- type: 'boolean',
40
- },
41
- 'skip-blade': {
42
- describe: 'Skip Blade files',
43
- type: 'boolean',
44
- },
45
- 'skip-block-json': {
46
- describe: 'Skip block.json files',
47
- type: 'boolean',
48
- },
49
- 'skip-theme-json': {
50
- describe: 'Skip theme.json files',
51
- type: 'boolean',
52
- },
53
- 'skip-audit': {
54
- describe: 'Skip auditing of strings',
55
- type: 'boolean',
56
- },
57
- headers: {
58
- describe: 'Headers',
59
- type: 'string',
60
- },
61
- 'file-comment': {
62
- describe: 'File comment',
63
- type: 'string',
64
- },
65
- 'package-name': {
66
- describe: 'Package name',
67
- type: 'string',
68
- },
69
- location: {
70
- describe: 'Include location information',
71
- type: 'boolean',
72
- },
73
- 'ignore-domain': {
74
- describe: 'Ignore text domain',
75
- type: 'boolean',
76
- },
77
- mergePaths: {
78
- describe: 'Merge with existing POT file(s)',
79
- type: 'string',
80
- },
81
- subtractPaths: {
82
- describe: 'Subtract strings from existing POT file(s)',
83
- type: 'string',
84
- },
85
- subtractAndMerge: {
86
- describe: 'Subtract and merge strings from existing POT file(s)',
87
- type: 'boolean',
88
- },
89
- include: {
90
- describe: 'Include specific files',
91
- type: 'string',
92
- },
93
- exclude: {
94
- describe: 'Exclude specific files',
95
- type: 'string',
96
- },
97
- silent: {
98
- describe: 'No output to stdout',
99
- type: 'boolean',
100
- },
101
- json: {
102
- describe: 'Output the json gettext data',
103
- type: 'boolean',
104
- },
105
- output: {
106
- describe: 'Output the gettext data',
107
- type: 'boolean',
108
- },
109
- })
110
- .parseSync();
111
- return (0, parseCli_1.parseCliArgs)(args);
112
- }
113
- exports.getArgs = getArgs;
114
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,2CAAuC;AACvC,sDAA6B;AAE7B,yCAAyC;AAOzC,SAAg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E;YACT,QAAQ,EAAE,8BAA8B;YACxC,IAAI,EAAE,SAAS;SACf;QACD,eAAe,EAAE;YAChB,QAAQ,EAAE,oBAAoB;YAC9B,IAAI,EAAE,SAAS;SACf;QACD,UAAU,EAAE;YACX,QAAQ,EAAE,iCAAiC;YAC3C,IAAI,EAAE,QAAQ;SACd;QACD,aAAa,EAAE;YACd,QAAQ,EAAE,4CAA4C;YACtD,IAAI,EAAE,QAAQ;SACd;QACD,gBAAgB,EAAE;YACjB,QAAQ,EACP,sDAAsD;YACvD,IAAI,EAAE,SAAS;SACf;QACD,OAAO,EAAE;YACR,QAAQ,EAAE,wBAAwB;YAClC,IAAI,EAAE,QAAQ;SACd;QACD,OAAO,EAAE;YACR,QAAQ,EAAE,wBAAwB;YAClC,IAAI,EAAE,QAAQ;SACd;QACD,MAAM,EAAE;YACP,QAAQ,EAAE,qBAAqB;YAC/B,IAAI,EAAE,SAAS;SACf;QACD,IAAI,EAAE;YACL,QAAQ,EAAE,8BAA8B;YACxC,IAAI,EAAE,SAAS;SACf;QACD,MAAM,EAAE;YACP,QAAQ,EAAE,yBAAyB;YACnC,IAAI,EAAE,SAAS;SACf;KACD,CAAC;SACD,SAAS,EAAE,CAAA;IACb,OAAO,IAAA,uBAAY,EAAC,IAAI,CAAC,CAAA;AAC1B,CAAC;AAtGD,0BAsGC"}
@@ -1,3 +0,0 @@
1
- import yargs from 'yargs';
2
- import { Args } from '../types';
3
- export declare function parseCliArgs(args: yargs.PositionalOptions & yargs.Options & yargs.Arguments): Args;
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseCli.js","sourceRoot":"","sources":["../../src/cli/parseCli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oCAAuC;AACvC,2CAA4B;AAC5B,iDAAkC;AAClC,oCAAgD;AAEhD,mDAAwC;AAExC,SAAS,eAAe,CAAC,cAAsB,GAAG,EAAE,IAAY;IAC/D,MAAM,uBAAuB,GAAG,WAAW,CAAA;IAE3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,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC;gBAC1B,CAAC,CAAC,SAAS;YACZ,IAAI,EAAE;gBACL,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM;gBACjB,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO;gBACnB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS;gBACvB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa;gBAC/B,SAAS,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;AA3DD,oCA2DC"}
package/lib/cliArgs.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import yargs from 'yargs';
2
- import { Args } from './types';
3
- export declare function getArgs(): Args;
4
- export declare function parseCliArgs(args: yargs.PositionalOptions & yargs.Options & yargs.Arguments): Args;