@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.
Files changed (50) hide show
  1. package/README.md +2 -2
  2. package/lib/assets/block-i18n.js +41 -1
  3. package/lib/assets/package-i18n.js +38 -1
  4. package/lib/assets/theme-i18n.js +110 -1
  5. package/lib/assets/wp-plugin-i18n.js +39 -1
  6. package/lib/assets/wp-theme-i18n.js +37 -1
  7. package/lib/cli/getArgs.js +156 -1
  8. package/lib/cli/getArgs.js.map +2 -2
  9. package/lib/cli/getJsonArgs.js +82 -1
  10. package/lib/cli/parseCli.js +179 -1
  11. package/lib/cli.js +43 -1
  12. package/lib/const.js +111 -1
  13. package/lib/extractors/auditStrings.js +177 -6
  14. package/lib/extractors/auditStrings.js.map +2 -2
  15. package/lib/extractors/css.js +69 -1
  16. package/lib/extractors/headers.js +253 -15
  17. package/lib/extractors/headers.js.map +2 -2
  18. package/lib/extractors/json.js +70 -1
  19. package/lib/extractors/packageJson.js +55 -1
  20. package/lib/extractors/php.js +79 -2
  21. package/lib/extractors/php.js.map +2 -2
  22. package/lib/extractors/schema.js +217 -3
  23. package/lib/extractors/text.js +41 -1
  24. package/lib/fs/fs.js +114 -2
  25. package/lib/fs/glob.js +103 -1
  26. package/lib/index.js +64 -1
  27. package/lib/jsonCommand.js +51 -1
  28. package/lib/makeJson.js +28 -1
  29. package/lib/makePot.js +27 -1
  30. package/lib/parser/exec.js +94 -3
  31. package/lib/parser/exec.js.map +2 -2
  32. package/lib/parser/makeJson.js +393 -1
  33. package/lib/parser/makePot.js +48 -1
  34. package/lib/parser/patterns.js +54 -1
  35. package/lib/parser/process.js +85 -1
  36. package/lib/parser/progress.js +57 -1
  37. package/lib/parser/taskRunner.js +65 -2
  38. package/lib/parser/taskRunner.js.map +2 -2
  39. package/lib/parser/tree.js +228 -2
  40. package/lib/potCommand.js +36 -1
  41. package/lib/potCommand.js.map +2 -2
  42. package/lib/types.js +17 -1
  43. package/lib/types.js.map +1 -1
  44. package/lib/utils/common.js +161 -8
  45. package/lib/utils/common.js.map +2 -2
  46. package/lib/utils/extractors.js +69 -1
  47. package/lib/utils/output.js +59 -1
  48. package/lib/utils/output.js.map +3 -3
  49. package/package.json +1 -2
  50. package/tests/parse-php.test.js +47 -0
@@ -1,2 +1,79 @@
1
- "use strict";var h=Object.create;var s=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var k=(t,n)=>{for(var e in n)s(t,e,{get:n[e],enumerable:!0})},f=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of y(n))!R.call(t,o)&&o!==e&&s(t,o,{get:()=>n[o],enumerable:!(i=P(n,o))||i.enumerable});return t};var g=(t,n,e)=>(e=t!=null?h(x(t)):{},f(n||!t||!t.__esModule?s(e,"default",{value:t,enumerable:!0}):e,t)),B=t=>f(s({},"__esModule",{value:!0}),t);var S={};k(S,{extractPhpPluginData:()=>F,parsePHPFile:()=>a});module.exports=B(S);var c=g(require("node:fs")),m=g(require("node:path")),u=require("../const.js"),p=require("../utils/extractors.js");function F(t){let n={};const e=m.default.join(t.paths.cwd,`${t.slug}.php`);if(c.default.existsSync(e)){const i=c.default.readFileSync(e,"utf8");return n=a(i),console.log(`\u{1F535} Plugin file detected. (${e})`),t.domain="plugin",n}return console.log("Plugin file not found."),console.log(`Missing Plugin filename: ${e}`),{}}function a(t){const n=t.match(/\/\*\*([\s\S]*?)\*\//);if(n?.[1]&&n){const i=n[1].split(`
2
- `),o={};for(const d of i){const r=d.match(/^\s*\*\s*([^:]+):\s*(.*)/);if(r&&r?.[1]&&r[2]){const l=(0,p.getKeyByValue)(u.pluginHeaders,r[1].trim());if(l===void 0)continue;o[l]=r[2].trim()}}return o}return{}}0&&(module.exports={extractPhpPluginData,parsePHPFile});
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 php_exports = {};
30
+ __export(php_exports, {
31
+ extractPhpPluginData: () => extractPhpPluginData,
32
+ parsePHPFile: () => parsePHPFile
33
+ });
34
+ module.exports = __toCommonJS(php_exports);
35
+ var import_node_fs = __toESM(require("node:fs"));
36
+ var import_node_path = __toESM(require("node:path"));
37
+ var import_const = require("../const.js");
38
+ var import_extractors = require("../utils/extractors.js");
39
+ function extractPhpPluginData(args) {
40
+ let fileData = {};
41
+ const folderPhpFile = import_node_path.default.join(args.paths.cwd, `${args.slug}.php`);
42
+ if (import_node_fs.default.existsSync(folderPhpFile)) {
43
+ const fileContent = import_node_fs.default.readFileSync(folderPhpFile, "utf8");
44
+ fileData = parsePHPFile(fileContent);
45
+ console.log(`\u{1F535} Plugin file detected. (${folderPhpFile})`);
46
+ args.domain = "plugin";
47
+ return fileData;
48
+ }
49
+ console.log("Plugin file not found.");
50
+ console.log(`Missing Plugin filename: ${folderPhpFile}`);
51
+ return {};
52
+ }
53
+ function parsePHPFile(phpContent) {
54
+ const match = phpContent.match(/\/\*\*?([\s\S]*?)\*\//);
55
+ if (match?.[1] && match) {
56
+ const commentBlock = match[1];
57
+ const lines = commentBlock.split("\n");
58
+ const pluginInfo = {};
59
+ for (const line of lines) {
60
+ const keyValueMatch = line.match(/^\s*(?:\*\s*)?([^:]+):\s*(.*)/);
61
+ if (!keyValueMatch) {
62
+ continue;
63
+ }
64
+ if (keyValueMatch?.[1] && keyValueMatch[2]) {
65
+ const header = (0, import_extractors.getKeyByValue)(import_const.pluginHeaders, keyValueMatch[1].trim());
66
+ if (header === void 0) continue;
67
+ pluginInfo[header] = keyValueMatch[2].trim();
68
+ }
69
+ }
70
+ return pluginInfo;
71
+ }
72
+ return {};
73
+ }
74
+ // Annotate the CommonJS export names for ESM import in node:
75
+ 0 && (module.exports = {
76
+ extractPhpPluginData,
77
+ parsePHPFile
78
+ });
79
+ //# sourceMappingURL=php.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/extractors/php.ts"],
4
- "sourcesContent": ["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { pluginHeaders } from \"../const.js\";\nimport type { Args } from \"../types.js\";\nimport { getKeyByValue } from \"../utils/extractors.js\";\n\nexport function extractPhpPluginData(args: Args): Record<string, string> {\n\tlet fileData: Record<string, string> = {};\n\tconst folderPhpFile = path.join(args.paths.cwd, `${args.slug}.php`);\n\n\tif (fs.existsSync(folderPhpFile)) {\n\t\tconst fileContent = fs.readFileSync(folderPhpFile, \"utf8\");\n\t\tfileData = parsePHPFile(fileContent);\n\n\t\tconsole.log(`\uD83D\uDD35 Plugin file detected. (${folderPhpFile})`);\n\n\t\t// Set the domain\n\t\targs.domain = \"plugin\";\n\n\t\treturn fileData;\n\t}\n\n\tconsole.log(\"Plugin file not found.\");\n\tconsole.log(`Missing Plugin filename: ${folderPhpFile}`);\n\n\treturn {};\n}\n\n/**\n * Parses a PHP file and extracts the plugin information from the comment block.\n *\n * @param {string} phpContent - The content of the PHP file.\n * @return {Record<string, string>} - A record containing the plugin information.\n */\nexport function parsePHPFile(phpContent: string): Record<string, string> {\n\tconst match = phpContent.match(/\\/\\*\\*([\\s\\S]*?)\\*\\//);\n\n\tif (match?.[1] && match) {\n\t\tconst commentBlock = match[1];\n\t\tconst lines = commentBlock.split(\"\\n\");\n\n\t\tconst pluginInfo: Record<string, string> = {};\n\n\t\tfor (const line of lines) {\n\t\t\tconst keyValueMatch = line.match(/^\\s*\\*\\s*([^:]+):\\s*(.*)/);\n\n\t\t\tif (!keyValueMatch) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Check if the line matches the expected format\n\t\t\tif (keyValueMatch?.[1] && keyValueMatch[2]) {\n\t\t\t\t// filter the retrieved headers\n\t\t\t\tconst header = getKeyByValue(pluginHeaders, keyValueMatch[1].trim());\n\t\t\t\tif (header === undefined) continue;\n\t\t\t\tpluginInfo[header] = keyValueMatch[2].trim();\n\t\t\t}\n\t\t}\n\n\t\treturn pluginInfo;\n\t}\n\treturn {};\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAe;AACf,uBAAiB;AACjB,mBAA8B;AAE9B,wBAA8B;AAEvB,SAAS,qBAAqB,MAAoC;AACxE,MAAI,WAAmC,CAAC;AACxC,QAAM,gBAAgB,iBAAAA,QAAK,KAAK,KAAK,MAAM,KAAK,GAAG,KAAK,IAAI,MAAM;AAElE,MAAI,eAAAC,QAAG,WAAW,aAAa,GAAG;AACjC,UAAM,cAAc,eAAAA,QAAG,aAAa,eAAe,MAAM;AACzD,eAAW,aAAa,WAAW;AAEnC,YAAQ,IAAI,oCAA6B,aAAa,GAAG;AAGzD,SAAK,SAAS;AAEd,WAAO;AAAA,EACR;AAEA,UAAQ,IAAI,wBAAwB;AACpC,UAAQ,IAAI,4BAA4B,aAAa,EAAE;AAEvD,SAAO,CAAC;AACT;AAQO,SAAS,aAAa,YAA4C;AACxE,QAAM,QAAQ,WAAW,MAAM,sBAAsB;AAErD,MAAI,QAAQ,CAAC,KAAK,OAAO;AACxB,UAAM,eAAe,MAAM,CAAC;AAC5B,UAAM,QAAQ,aAAa,MAAM,IAAI;AAErC,UAAM,aAAqC,CAAC;AAE5C,eAAW,QAAQ,OAAO;AACzB,YAAM,gBAAgB,KAAK,MAAM,0BAA0B;AAE3D,UAAI,CAAC,eAAe;AACnB;AAAA,MACD;AAGA,UAAI,gBAAgB,CAAC,KAAK,cAAc,CAAC,GAAG;AAE3C,cAAM,aAAS,iCAAc,4BAAe,cAAc,CAAC,EAAE,KAAK,CAAC;AACnE,YAAI,WAAW,OAAW;AAC1B,mBAAW,MAAM,IAAI,cAAc,CAAC,EAAE,KAAK;AAAA,MAC5C;AAAA,IACD;AAEA,WAAO;AAAA,EACR;AACA,SAAO,CAAC;AACT;",
4
+ "sourcesContent": ["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { pluginHeaders } from \"../const.js\";\nimport type { Args } from \"../types.js\";\nimport { getKeyByValue } from \"../utils/extractors.js\";\n\nexport function extractPhpPluginData(args: Args): Record<string, string> {\n\tlet fileData: Record<string, string> = {};\n\tconst folderPhpFile = path.join(args.paths.cwd, `${args.slug}.php`);\n\n\tif (fs.existsSync(folderPhpFile)) {\n\t\tconst fileContent = fs.readFileSync(folderPhpFile, \"utf8\");\n\t\tfileData = parsePHPFile(fileContent);\n\n\t\tconsole.log(`\uD83D\uDD35 Plugin file detected. (${folderPhpFile})`);\n\n\t\t// Set the domain\n\t\targs.domain = \"plugin\";\n\n\t\treturn fileData;\n\t}\n\n\tconsole.log(\"Plugin file not found.\");\n\tconsole.log(`Missing Plugin filename: ${folderPhpFile}`);\n\n\treturn {};\n}\n\n/**\n * Parses a PHP file and extracts the plugin information from the comment block.\n *\n * @param {string} phpContent - The content of the PHP file.\n * @return {Record<string, string>} - A record containing the plugin information.\n */\nexport function parsePHPFile(phpContent: string): Record<string, string> {\n\tconst match = phpContent.match(/\\/\\*\\*?([\\s\\S]*?)\\*\\//);\n\n\tif (match?.[1] && match) {\n\t\tconst commentBlock = match[1];\n\t\tconst lines = commentBlock.split(\"\\n\");\n\n\t\tconst pluginInfo: Record<string, string> = {};\n\n\t\tfor (const line of lines) {\n\t\t\tconst keyValueMatch = line.match(/^\\s*(?:\\*\\s*)?([^:]+):\\s*(.*)/);\n\n\t\t\tif (!keyValueMatch) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Check if the line matches the expected format\n\t\t\tif (keyValueMatch?.[1] && keyValueMatch[2]) {\n\t\t\t\t// filter the retrieved headers\n\t\t\t\tconst header = getKeyByValue(pluginHeaders, keyValueMatch[1].trim());\n\t\t\t\tif (header === undefined) continue;\n\t\t\t\tpluginInfo[header] = keyValueMatch[2].trim();\n\t\t\t}\n\t\t}\n\n\t\treturn pluginInfo;\n\t}\n\treturn {};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAe;AACf,uBAAiB;AACjB,mBAA8B;AAE9B,wBAA8B;AAEvB,SAAS,qBAAqB,MAAoC;AACxE,MAAI,WAAmC,CAAC;AACxC,QAAM,gBAAgB,iBAAAA,QAAK,KAAK,KAAK,MAAM,KAAK,GAAG,KAAK,IAAI,MAAM;AAElE,MAAI,eAAAC,QAAG,WAAW,aAAa,GAAG;AACjC,UAAM,cAAc,eAAAA,QAAG,aAAa,eAAe,MAAM;AACzD,eAAW,aAAa,WAAW;AAEnC,YAAQ,IAAI,oCAA6B,aAAa,GAAG;AAGzD,SAAK,SAAS;AAEd,WAAO;AAAA,EACR;AAEA,UAAQ,IAAI,wBAAwB;AACpC,UAAQ,IAAI,4BAA4B,aAAa,EAAE;AAEvD,SAAO,CAAC;AACT;AAQO,SAAS,aAAa,YAA4C;AACxE,QAAM,QAAQ,WAAW,MAAM,uBAAuB;AAEtD,MAAI,QAAQ,CAAC,KAAK,OAAO;AACxB,UAAM,eAAe,MAAM,CAAC;AAC5B,UAAM,QAAQ,aAAa,MAAM,IAAI;AAErC,UAAM,aAAqC,CAAC;AAE5C,eAAW,QAAQ,OAAO;AACzB,YAAM,gBAAgB,KAAK,MAAM,+BAA+B;AAEhE,UAAI,CAAC,eAAe;AACnB;AAAA,MACD;AAGA,UAAI,gBAAgB,CAAC,KAAK,cAAc,CAAC,GAAG;AAE3C,cAAM,aAAS,iCAAc,4BAAe,cAAc,CAAC,EAAE,KAAK,CAAC;AACnE,YAAI,WAAW,OAAW;AAC1B,mBAAW,MAAM,IAAI,cAAc,CAAC,EAAE,KAAK;AAAA,MAC5C;AAAA,IACD;AAEA,WAAO;AAAA,EACR;AACA,SAAO,CAAC;AACT;",
6
6
  "names": ["path", "fs"]
7
7
  }
@@ -1,3 +1,217 @@
1
- "use strict";var A=Object.create;var g=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var F=(r,e)=>{for(var o in e)g(r,o,{get:e[o],enumerable:!0})},j=(r,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of v(e))!S.call(r,t)&&t!==o&&g(r,t,{get:()=>e[t],enumerable:!(i=R(e,t))||i.enumerable});return r};var w=(r,e,o)=>(o=r!=null?A(C(r)):{},j(e||!r||!r.__esModule?g(o,"default",{value:r,enumerable:!0}):o,r)),O=r=>j(g({},"__esModule",{value:!0}),r);var N={};F(N,{JsonSchemaExtractor:()=>c});module.exports=O(N);var B=w(require("../assets/block-i18n.js")),$=w(require("../assets/theme-i18n.js"));class c{static schemaCache={};static themeJsonSource="http://develop.svn.wordpress.org/trunk/src/wp-includes/theme-i18n.json";static themeJsonFallback=$;static blockJsonSource="http://develop.svn.wordpress.org/trunk/src/wp-includes/block-i18n.json";static blockJsonFallback=B;static async loadSchema(e,o){if(c.schemaCache[e])return c.schemaCache[e];try{const i=await fetch(e,{headers:{"Access-Control-Allow-Origin":"*"}}).then(t=>t.json()).catch(t=>{throw new Error(`
2
- Failed to load schema from ${e}. Error: ${t.message}`)});return i?(c.schemaCache[e]=i,i):o}catch(i){return console.error(`
3
- Failed to load schema from ${e}. Using fallback. Error: ${i.message}`),c.schemaCache[e]=o,o}}static async parse(e,o,i){const t=await c.loadSchema(o.url,o.fallback);try{const l=JSON.parse(e);if(!l){console.error("Could not parse JSON.");return}return c.extractFromJsonSchema(l,t,i)}catch(l){console.error(`Error parsing JSON: ${l.message}`);return}}static extractFromJsonSchema(e,o,i={filename:void 0,addReferences:!1}){const{filename:t="block.json",addReferences:l=!1}=i,k=[];function h(n,a,d=[]){if(!(!n||!a)&&typeof n=="object"&&!Array.isArray(n)&&typeof a=="object"&&!Array.isArray(a))for(const s of Object.keys(a))s in n&&(typeof n[s]=="string"?y(n[s],a[s],t,l):Array.isArray(n[s])&&Array.isArray(a[s])?u(n[s],a[s],[...d,s],t,l):typeof n[s]=="object"&&n[s]!==null&&typeof a[s]=="object"&&h(n[s],a[s],[...d,s]))}function u(n,a,d,s,m){if(a.length>0){const p=a[0];for(const f of n)if(typeof f=="string")y(f,p,s,m);else if(typeof f=="object"&&f!==null)if(typeof p=="object")h(f,p,d);else for(const I of Object.keys(f)){const b=f[I];typeof b=="string"&&y(b,p,s,m)}}}function y(n,a,d,s){if(!n)return;const m={msgid:a,msgctxt:n};s&&(m.comments={reference:[d]}),k.push(m)}return h(e,o),k}}0&&(module.exports={JsonSchemaExtractor});
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 schema_exports = {};
30
+ __export(schema_exports, {
31
+ JsonSchemaExtractor: () => JsonSchemaExtractor
32
+ });
33
+ module.exports = __toCommonJS(schema_exports);
34
+ var blocki18n = __toESM(require("../assets/block-i18n.js"));
35
+ var themei18n = __toESM(require("../assets/theme-i18n.js"));
36
+ class JsonSchemaExtractor {
37
+ static schemaCache = {};
38
+ /** Theme */
39
+ static themeJsonSource = "http://develop.svn.wordpress.org/trunk/src/wp-includes/theme-i18n.json";
40
+ static themeJsonFallback = themei18n;
41
+ /** Block */
42
+ static blockJsonSource = "http://develop.svn.wordpress.org/trunk/src/wp-includes/block-i18n.json";
43
+ static blockJsonFallback = blocki18n;
44
+ /**
45
+ * Load the schema from the specified URL, with a fallback URL if needed.
46
+ *
47
+ * @param {string} url - The URL to load the schema from.
48
+ * @param {I18nSchema} fallback - The fallback schema to use if the main URL fails.
49
+ * @return {Promise<I18nSchema>} The loaded schema.
50
+ */
51
+ static async loadSchema(url, fallback) {
52
+ if (JsonSchemaExtractor.schemaCache[url]) {
53
+ return JsonSchemaExtractor.schemaCache[url];
54
+ }
55
+ try {
56
+ const response = await fetch(url, {
57
+ headers: {
58
+ "Access-Control-Allow-Origin": "*"
59
+ }
60
+ }).then((response2) => response2.json()).catch((error) => {
61
+ throw new Error(
62
+ `
63
+ Failed to load schema from ${url}. Error: ${error.message}`
64
+ );
65
+ });
66
+ if (!response) {
67
+ return fallback;
68
+ }
69
+ JsonSchemaExtractor.schemaCache[url] = response;
70
+ return response;
71
+ } catch (error) {
72
+ console.error(
73
+ `
74
+ Failed to load schema from ${url}. Using fallback. Error: ${error.message}`
75
+ );
76
+ JsonSchemaExtractor.schemaCache[url] = fallback;
77
+ return fallback;
78
+ }
79
+ }
80
+ /**
81
+ * Parses a string and extracts translations using the specified schema.
82
+ *
83
+ * @param {string} text - the input string to be parsed
84
+ * @param {object} schema - the schema to use for parsing the input string
85
+ * @param {string} schema.url - the URL of the schema to use for parsing the input string
86
+ * @param {object} schema.schemaFallback - the fallback schema to use if the main schema fails
87
+ * @param {object} options - the options for parsing the input string
88
+ * @param {string} options.file - the name of the file being parsed
89
+ * @param {boolean} options.addReferences - whether to add references to the extracted strings
90
+ *
91
+ * @return {Promise<I18nSchema | undefined>} a promise that resolves with the extracted schema
92
+ */
93
+ static async parse(text, schema, options) {
94
+ const parsedSchema = await JsonSchemaExtractor.loadSchema(
95
+ schema.url,
96
+ schema.fallback
97
+ );
98
+ try {
99
+ const json = JSON.parse(text);
100
+ if (!json) {
101
+ console.error("Could not parse JSON.");
102
+ return;
103
+ }
104
+ return JsonSchemaExtractor.extractFromJsonSchema(
105
+ json,
106
+ parsedSchema,
107
+ options
108
+ );
109
+ } catch (error) {
110
+ console.error(`Error parsing JSON: ${error.message}`);
111
+ return;
112
+ }
113
+ }
114
+ /**
115
+ * Extracts translatable strings from a JSON file by comparing it with a schema
116
+ *
117
+ * @param {Object} json - The JSON object to extract strings from
118
+ * @param {Object} schema - The schema that defines which fields contain translatable strings
119
+ * @param {Object} options - Options for extraction
120
+ * @param {string} options.filename - The name of the file being extracted (for references)
121
+ * @param {boolean} options.addReferences - Whether to add file references in comments
122
+ * @return {Array} - An array of objects with translatable strings in gettext format
123
+ */
124
+ static extractFromJsonSchema(json, schema, options = {
125
+ filename: void 0,
126
+ addReferences: false
127
+ }) {
128
+ const { filename = "block.json", addReferences = false } = options;
129
+ const translations = [];
130
+ function extract(currentJson, currentSchema, path = []) {
131
+ if (!currentJson || !currentSchema) return;
132
+ if (typeof currentJson === "object" && !Array.isArray(currentJson) && typeof currentSchema === "object" && !Array.isArray(currentSchema)) {
133
+ for (const key of Object.keys(currentSchema)) {
134
+ if (key in currentJson) {
135
+ if (typeof currentJson[key] === "string") {
136
+ addTranslation(
137
+ currentJson[key],
138
+ currentSchema[key],
139
+ filename,
140
+ addReferences
141
+ );
142
+ } else if (Array.isArray(currentJson[key]) && Array.isArray(currentSchema[key])) {
143
+ handleArrays(
144
+ currentJson[key],
145
+ currentSchema[key],
146
+ [...path, key],
147
+ filename,
148
+ addReferences
149
+ );
150
+ } else if (typeof currentJson[key] === "object" && currentJson[key] !== null && typeof currentSchema[key] === "object") {
151
+ extract(
152
+ currentJson[key],
153
+ currentSchema[key],
154
+ [...path, key]
155
+ );
156
+ }
157
+ }
158
+ }
159
+ }
160
+ }
161
+ function handleArrays(jsonArray, schemaArray, path, filename2, addReferences2) {
162
+ if (schemaArray.length > 0) {
163
+ const schemaTemplate = schemaArray[0];
164
+ for (const jsonItem of jsonArray) {
165
+ if (typeof jsonItem === "string") {
166
+ addTranslation(
167
+ jsonItem,
168
+ schemaTemplate,
169
+ filename2,
170
+ addReferences2
171
+ );
172
+ } else if (typeof jsonItem === "object" && jsonItem !== null) {
173
+ if (typeof schemaTemplate === "object") {
174
+ extract(
175
+ jsonItem,
176
+ schemaTemplate,
177
+ path
178
+ );
179
+ } else {
180
+ for (const key of Object.keys(jsonItem)) {
181
+ const value = jsonItem[key];
182
+ if (typeof value === "string") {
183
+ addTranslation(
184
+ value,
185
+ schemaTemplate,
186
+ filename2,
187
+ addReferences2
188
+ );
189
+ }
190
+ }
191
+ }
192
+ }
193
+ }
194
+ }
195
+ }
196
+ function addTranslation(msgctxt, msgid, filename2, addReferences2) {
197
+ if (!msgctxt) return;
198
+ const translation = {
199
+ msgid,
200
+ msgctxt
201
+ };
202
+ if (addReferences2) {
203
+ translation.comments = {
204
+ reference: [filename2]
205
+ };
206
+ }
207
+ translations.push(translation);
208
+ }
209
+ extract(json, schema);
210
+ return translations;
211
+ }
212
+ }
213
+ // Annotate the CommonJS export names for ESM import in node:
214
+ 0 && (module.exports = {
215
+ JsonSchemaExtractor
216
+ });
217
+ //# sourceMappingURL=schema.js.map
@@ -1 +1,41 @@
1
- "use strict";var s=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var l=(r,t)=>{for(var n in t)s(r,n,{get:t[n],enumerable:!0})},f=(r,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of g(t))!m.call(r,e)&&e!==n&&s(r,e,{get:()=>t[e],enumerable:!(o=a(t,e))||o.enumerable});return r};var p=r=>f(s({},"__esModule",{value:!0}),r);var d={};l(d,{extractFileData:()=>u});module.exports=p(d);var c=require("../utils/common.js");function u(r,t=":"){const n={},o=(0,c.removeCommentMarkup)(r)??[];for(const e of o){const i=e.split(t);i.length!==2&&Object.values(n).length>0&&i[1]||(n[i[0]?.trim()]=i[1].trim())}return n}0&&(module.exports={extractFileData});
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 text_exports = {};
20
+ __export(text_exports, {
21
+ extractFileData: () => extractFileData
22
+ });
23
+ module.exports = __toCommonJS(text_exports);
24
+ var import_common = require("../utils/common.js");
25
+ function extractFileData(fileContent, separator = ":") {
26
+ const data = {};
27
+ const text = (0, import_common.removeCommentMarkup)(fileContent) ?? [];
28
+ for (const line of text) {
29
+ const parts = line.split(separator);
30
+ if (parts.length !== 2 && Object.values(data).length > 0 && parts[1]) {
31
+ continue;
32
+ }
33
+ data[parts[0]?.trim()] = parts[1].trim();
34
+ }
35
+ return data;
36
+ }
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ extractFileData
40
+ });
41
+ //# sourceMappingURL=text.js.map
package/lib/fs/fs.js CHANGED
@@ -1,2 +1,114 @@
1
- "use strict";var p=Object.create;var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var n in e)i(t,n,{get:e[n],enumerable:!0})},f=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of F(e))!y.call(t,r)&&r!==n&&i(t,r,{get:()=>e[r],enumerable:!(o=m(e,r))||o.enumerable});return t};var a=(t,e,n)=>(n=t!=null?p(x(t)):{},f(e||!t||!t.__esModule?i(n,"default",{value:t,enumerable:!0}):n,t)),E=t=>f(i({},"__esModule",{value:!0}),t);var A={};w(A,{getCharset:()=>g,getEncodingCharset:()=>h,readFileAsync:()=>j,writeFile:()=>S});module.exports=E(A);var s=a(require("node:fs")),d=require("node:fs/promises"),c=a(require("node:path"));function $(t){if(t===void 0)return".";try{s.default.accessSync(c.default.resolve(t),s.default.constants.R_OK|s.default.constants.W_OK)}catch(e){if(e.code==="ENOENT")return s.default.mkdirSync(t,{recursive:!0}),console.log(`Folder created: ${t}`),t}return t}function g(t){if(!t)return"latin1";switch(t.toLowerCase()){case"utf-8":case"utf8":return"utf-8";default:return"latin1"}}function h(t){if(!t)return"iso-8859-1";switch(t.toLowerCase()){case"utf-8":case"utf8":return"utf-8";default:return"iso-8859-1"}}function C(t){const{paths:e,headers:n,options:o}=t;let u=e.out??n?.domainPath??"languages";u=u.replace(/^\/+|\/+$/g,"");const l=o?.json?"json":"pot";return c.default.join(process.cwd(),u,`${t.slug}.${l}`)}function S(t,e){const n=C(e);if($(c.default.dirname(n))){const o=g(e.options?.charset);console.log(`
2
- Pot File created at ${n}`);const r=Buffer.from(t);(0,s.writeFileSync)(n,r.toString(o),{encoding:o})}else console.log(`Folder ${n} does not exist and cannot be created`)}async function j(t){return(0,d.readFile)(t,"utf-8")}0&&(module.exports={getCharset,getEncodingCharset,readFileAsync,writeFile});
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 fs_exports = {};
30
+ __export(fs_exports, {
31
+ getCharset: () => getCharset,
32
+ getEncodingCharset: () => getEncodingCharset,
33
+ readFileAsync: () => readFileAsync,
34
+ writeFile: () => writeFile
35
+ });
36
+ module.exports = __toCommonJS(fs_exports);
37
+ var import_node_fs = __toESM(require("node:fs"));
38
+ var import_promises = require("node:fs/promises");
39
+ var import_node_path = __toESM(require("node:path"));
40
+ function ensureFolderExists(folderPath) {
41
+ if (folderPath === void 0) {
42
+ return ".";
43
+ }
44
+ try {
45
+ import_node_fs.default.accessSync(
46
+ import_node_path.default.resolve(folderPath),
47
+ import_node_fs.default.constants.R_OK | import_node_fs.default.constants.W_OK
48
+ );
49
+ } catch (error) {
50
+ if (error.code === "ENOENT") {
51
+ import_node_fs.default.mkdirSync(folderPath, { recursive: true });
52
+ console.log(`Folder created: ${folderPath}`);
53
+ return folderPath;
54
+ }
55
+ }
56
+ return folderPath;
57
+ }
58
+ function getCharset(charset) {
59
+ if (!charset) {
60
+ return "latin1";
61
+ }
62
+ switch (charset.toLowerCase()) {
63
+ case "utf-8":
64
+ case "utf8":
65
+ return "utf-8";
66
+ default:
67
+ return "latin1";
68
+ }
69
+ }
70
+ function getEncodingCharset(charset) {
71
+ if (!charset) {
72
+ return "iso-8859-1";
73
+ }
74
+ switch (charset.toLowerCase()) {
75
+ case "utf-8":
76
+ case "utf8":
77
+ return "utf-8";
78
+ default:
79
+ return "iso-8859-1";
80
+ }
81
+ }
82
+ function getOutputFilePath(args) {
83
+ const { paths, headers, options } = args;
84
+ const out = paths.out;
85
+ let i18nFolder = out ?? headers?.domainPath ?? "languages";
86
+ i18nFolder = i18nFolder.replace(/^\/+|\/+$/g, "");
87
+ const extension = options?.json ? "json" : "pot";
88
+ return import_node_path.default.join(process.cwd(), i18nFolder, `${args.slug}.${extension}`);
89
+ }
90
+ function writeFile(fileContent, args) {
91
+ const dest = getOutputFilePath(args);
92
+ if (ensureFolderExists(import_node_path.default.dirname(dest))) {
93
+ const encodingCharset = getCharset(args.options?.charset);
94
+ console.log(`
95
+ Pot File created at ${dest}`);
96
+ const potBuffer = Buffer.from(fileContent);
97
+ (0, import_node_fs.writeFileSync)(dest, potBuffer.toString(encodingCharset), {
98
+ encoding: encodingCharset
99
+ });
100
+ } else {
101
+ console.log(`Folder ${dest} does not exist and cannot be created`);
102
+ }
103
+ }
104
+ async function readFileAsync(path2) {
105
+ return (0, import_promises.readFile)(path2, "utf-8");
106
+ }
107
+ // Annotate the CommonJS export names for ESM import in node:
108
+ 0 && (module.exports = {
109
+ getCharset,
110
+ getEncodingCharset,
111
+ readFileAsync,
112
+ writeFile
113
+ });
114
+ //# sourceMappingURL=fs.js.map
package/lib/fs/glob.js CHANGED
@@ -1 +1,103 @@
1
- "use strict";var y=Object.create;var c=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var v=(t,e)=>{for(var r in e)c(t,r,{get:e[r],enumerable:!0})},u=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of P(e))!w.call(t,n)&&n!==r&&c(t,n,{get:()=>e[n],enumerable:!(s=x(e,n))||s.enumerable});return t};var p=(t,e,r)=>(r=t!=null?y(j(t)):{},u(e||!t||!t.__esModule?c(r,"default",{value:t,enumerable:!0}):r,t)),b=t=>u(c({},"__esModule",{value:!0}),t);var F={};v(F,{classifyExcludes:()=>h,getFiles:()=>E,getParser:()=>A});module.exports=b(F);var d=p(require("node:path")),f=require("glob"),g=require("minimatch"),k=p(require("tree-sitter-javascript")),m=p(require("tree-sitter-php")),l=p(require("tree-sitter-typescript")),i=require("../utils/common.js");function A(t){switch((0,i.getFileExtension)(t)){case"ts":return l.typescript;case"tsx":return l.tsx;case"js":case"jsx":case"mjs":case"cjs":return k;case"php":return m.php;case"blade.php":return m.php_only;default:return null}}function h(t){const e=[],r=[];for(const s of t)(0,i.detectPatternType)(s)==="directory"?e.push(s):r.push(s);return{dirs:e,filePatterns:r}}async function E(t,e){const{dirs:r,filePatterns:s}=h(e.exclude);return new f.Glob(e.include,{ignore:{childrenIgnored:a=>r.some(o=>a.isNamed(o)),ignored:a=>s.some(o=>(0,i.detectPatternType)(o)==="file"?a.isNamed(o):(0,g.minimatch)(a.relative(),o))},nodir:!0,cwd:t.paths.cwd,root:t.paths.root?d.default.resolve(t.paths.root):void 0}).walk()}0&&(module.exports={classifyExcludes,getFiles,getParser});
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 glob_exports = {};
30
+ __export(glob_exports, {
31
+ classifyExcludes: () => classifyExcludes,
32
+ getFiles: () => getFiles,
33
+ getParser: () => getParser
34
+ });
35
+ module.exports = __toCommonJS(glob_exports);
36
+ var import_node_path = __toESM(require("node:path"));
37
+ var import_glob = require("glob");
38
+ var import_minimatch = require("minimatch");
39
+ var javascript = __toESM(require("tree-sitter-javascript"));
40
+ var php = __toESM(require("tree-sitter-php"));
41
+ var ts = __toESM(require("tree-sitter-typescript"));
42
+ var import_common = require("../utils/common.js");
43
+ function getParser(file) {
44
+ const ext = (0, import_common.getFileExtension)(file);
45
+ switch (ext) {
46
+ case "ts":
47
+ return ts.typescript;
48
+ case "tsx":
49
+ return ts.tsx;
50
+ case "js":
51
+ case "jsx":
52
+ case "mjs":
53
+ case "cjs":
54
+ return javascript;
55
+ case "php":
56
+ return php.php;
57
+ case "blade.php":
58
+ return php.php_only;
59
+ default:
60
+ return null;
61
+ }
62
+ }
63
+ function classifyExcludes(excludedPatterns) {
64
+ const dirs = [];
65
+ const filePatterns = [];
66
+ for (const exclude of excludedPatterns) {
67
+ const type = (0, import_common.detectPatternType)(exclude);
68
+ if (type === "directory") {
69
+ dirs.push(exclude);
70
+ } else {
71
+ filePatterns.push(exclude);
72
+ }
73
+ }
74
+ return { dirs, filePatterns };
75
+ }
76
+ async function getFiles(args, pattern) {
77
+ const { dirs, filePatterns } = classifyExcludes(pattern.exclude);
78
+ const g = new import_glob.Glob(pattern.include, {
79
+ ignore: {
80
+ // Prune entire directory subtrees — glob won't enter these dirs at all
81
+ childrenIgnored: (p) => dirs.some((d) => p.isNamed(d)),
82
+ // Filter individual files by name or glob pattern
83
+ ignored: (p) => filePatterns.some((fp) => {
84
+ const type = (0, import_common.detectPatternType)(fp);
85
+ if (type === "file") {
86
+ return p.isNamed(fp);
87
+ }
88
+ return (0, import_minimatch.minimatch)(p.relative(), fp);
89
+ })
90
+ },
91
+ nodir: true,
92
+ cwd: args.paths.cwd,
93
+ root: args.paths.root ? import_node_path.default.resolve(args.paths.root) : void 0
94
+ });
95
+ return g.walk();
96
+ }
97
+ // Annotate the CommonJS export names for ESM import in node:
98
+ 0 && (module.exports = {
99
+ classifyExcludes,
100
+ getFiles,
101
+ getParser
102
+ });
103
+ //# sourceMappingURL=glob.js.map
package/lib/index.js CHANGED
@@ -1 +1,64 @@
1
- "use strict";var F=Object.create;var a=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var A=(o,r)=>{for(var e in r)a(o,e,{get:r[e],enumerable:!0})},k=(o,r,e,x)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of c(r))!u.call(o,t)&&t!==e&&a(o,t,{get:()=>r[t],enumerable:!(x=J(r,t))||x.enumerable});return o};var p=(o,r,e)=>(e=o!=null?F(l(o)):{},k(r||!o||!o.__esModule?a(e,"default",{value:o,enumerable:!0}):e,o)),C=o=>k(a({},"__esModule",{value:!0}),o);var M={};A(M,{MakeJsonCommand:()=>d.MakeJsonCommand,StringAuditor:()=>f.default,doTree:()=>g.doTree,extractMainFileData:()=>m.extractMainFileData,generateHeader:()=>m.generateHeader,getAuthorFromPackage:()=>m.getAuthorFromPackage,makeJson:()=>i.default,makePot:()=>n.default,makePotCommand:()=>s.makePot,parseJsonFile:()=>P.parseJsonFile});module.exports=C(M);var f=p(require("./extractors/auditStrings.js")),i=p(require("./jsonCommand.js")),n=p(require("./potCommand.js")),d=require("./parser/makeJson"),s=require("./parser/makePot.js"),g=require("./parser/tree.js"),P=require("./extractors/json.js"),m=require("./extractors/headers.js");0&&(module.exports={MakeJsonCommand,StringAuditor,doTree,extractMainFileData,generateHeader,getAuthorFromPackage,makeJson,makePot,makePotCommand,parseJsonFile});
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 index_exports = {};
30
+ __export(index_exports, {
31
+ MakeJsonCommand: () => import_makeJson.MakeJsonCommand,
32
+ StringAuditor: () => import_auditStrings.default,
33
+ doTree: () => import_tree.doTree,
34
+ extractMainFileData: () => import_headers.extractMainFileData,
35
+ generateHeader: () => import_headers.generateHeader,
36
+ getAuthorFromPackage: () => import_headers.getAuthorFromPackage,
37
+ makeJson: () => import_jsonCommand.default,
38
+ makePot: () => import_potCommand.default,
39
+ makePotCommand: () => import_makePot.makePot,
40
+ parseJsonFile: () => import_json.parseJsonFile
41
+ });
42
+ module.exports = __toCommonJS(index_exports);
43
+ var import_auditStrings = __toESM(require("./extractors/auditStrings.js"));
44
+ var import_jsonCommand = __toESM(require("./jsonCommand.js"));
45
+ var import_potCommand = __toESM(require("./potCommand.js"));
46
+ var import_makeJson = require("./parser/makeJson");
47
+ var import_makePot = require("./parser/makePot.js");
48
+ var import_tree = require("./parser/tree.js");
49
+ var import_json = require("./extractors/json.js");
50
+ var import_headers = require("./extractors/headers.js");
51
+ // Annotate the CommonJS export names for ESM import in node:
52
+ 0 && (module.exports = {
53
+ MakeJsonCommand,
54
+ StringAuditor,
55
+ doTree,
56
+ extractMainFileData,
57
+ generateHeader,
58
+ getAuthorFromPackage,
59
+ makeJson,
60
+ makePot,
61
+ makePotCommand,
62
+ parseJsonFile
63
+ });
64
+ //# sourceMappingURL=index.js.map