fill-pot-po
Advanced tools
Comparing version
@@ -1,4 +0,4 @@ | ||
import*as M from"fs";import G from"vinyl";import{Buffer as _e}from"buffer";import J from"gettext-parser";import v from"ansi-colors";import Re from"color-support";import*as Y from"util";import L from"ansi-colors";import ce from"color-support";var C={name:"fill-pot-po",version:"4.0.1",description:"Create pre-filled PO files from POT file, using previous PO files.",type:"module",main:"./dist/index.mjs",types:"./dist/index.d.ts",scripts:{dev:"npm run build -- --watch src",build:"tsup",lint:"eslint src/*.ts test/*.ts","lint:fix":"eslint --fix src/*.ts test/*.ts",test:"jest",coverage:"jest --coverage","build:test":"tsup && jest"},keywords:["pot","po","fill","merge","auto-fill","prefill","pre-fill","generate","create","i18n","l10n","gettext","translation"],repository:"https://github.com/vheemstra/fill-pot-po.git",homepage:"https://github.com/vheemstra/fill-pot-po",bugs:"https://github.com/vheemstra/fill-pot-po/issues",author:{name:"Philip van Heemstra",url:"https://github.com/vheemstra"},engines:{node:">=18"},files:["dist"],license:"MIT",dependencies:{"ansi-colors":"^4.1.3","color-support":"^1.1.3","gettext-parser":"^8.0.0",matched:"^5.0.1",vinyl:"^3.0.0"},devDependencies:{"@types/color-support":"^1.1.4","@types/gettext-parser":"^4.0.4","@types/jest":"^29.5.12","@types/vinyl":"^2.0.12","@typescript-eslint/eslint-plugin":"^7.16.0","@typescript-eslint/parser":"^7.16.0","babel-plugin-transform-import-meta":"^2.2.1",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-jest":"^28.6.0","eslint-plugin-prettier":"^5.1.3",jest:"^29.7.0","ts-jest":"^29.2.1","ts-node":"^10.9.2",tsup:"^8.1.0",typescript:"^5.5.3","utility-types":"^3.11.0"}};var X=ce();L.enabled=X&&X.hasBasic;var N=class{constructor(t,r=""){this.message=t,this.category=r.slice(0,1).toUpperCase()+r.slice(1).toLowerCase()}toString(){return`${L.cyan(C.name)} ${L.bold.red(`${this.category}Error`)} ${this.message}`}[Y.inspect.custom](){return this.toString()}},y=N;import{resolve as U,relative as te}from"path";import fe from"vinyl";import ue from"vinyl";var b=e=>Object.prototype.toString.call(e)==="[object Array]",K=e=>Object.prototype.toString.call(e)==="[object Object]",d=e=>Object.prototype.toString.call(e)==="[object String]",Q=e=>Object.prototype.toString.call(e)==="[object Boolean]",D=e=>b(e)?!!e.reduce((t,r)=>d(r)&&t,!0):!1,ee=e=>b(e)?!!e.reduce((t,r)=>ue.isVinyl(r)&&t,!0):!1,B=(e,t)=>{if(!d(e)||!d(t))throw new Error("pathLineSort: a or b not a string");let r,s;if([e,r]=e.split(":"),[t,s]=t.split(":"),e=e.replace(/(^\/|\/$)/g,""),t=t.replace(/(^\/|\/$)/g,""),e===t){if((!r||r==="")&&s&&s.length)return-1;if((!s||s==="")&&r&&r.length)return 1;if(r&&r.length&&s&&s.length)return parseInt(r)-parseInt(s)}let n=e.split("/"),o=t.split("/"),i=n.length,l=o.length,u=Math.max(i,l);for(let p=0;p<u;p++){if(p>=l||!o[p])return-1;if(p>=i||!n[p])return 1;let[f,m]=n[p].split(/\.(?=[^.]*$)/g),[g,h]=o[p].split(/\.(?=[^.]*$)/g),_=m&&m!=="",R=h&&h!=="";if(!_&&R)return-1;if(_&&!R||f.toUpperCase()>g.toUpperCase())return 1;if(f.toUpperCase()<g.toUpperCase())return-1;if(m&&h){if(m.toUpperCase()>h.toUpperCase())return 1;if(m.toUpperCase()<h.toUpperCase())return-1}}return 0};var O=class extends y{constructor(t){super(t,"options")}},me=e=>{if(K(e)){if("potSources"in e&&!d(e.potSources)&&!D(e.potSources)&&!fe.isVinyl(e.potSources)&&!ee(e.potSources))throw new O("Option potSources should be a string or Vinyl object, or an array of those.");if("poSources"in e&&e.poSources!==null&&!d(e.poSources)&&!D(e.poSources))throw new O("Option poSources should be a glob string or glob array.");if("wrapLength"in e&&(typeof e.wrapLength!="number"||0>=e.wrapLength))throw new O("If set, option wrapLength should be a number higher than 0.");let t=["srcDir","destDir","domain"];for(let s of t)if(s in e)if(d(e[s])){if(e[s].match(/\n/))throw new O(`Option ${s} can't contain newline characters.`)}else throw new O(`Option ${s} should be a string.`);let r=["writeFiles","returnPOT","domainFromPOTPath","domainInPOPath","defaultContextAsFallback","appendNonIncludedFromPO","includePORevisionDate","includeGenerator","logResults"];for(let s of r)if(s in e&&!Q(e[s]))throw new O(`Option ${s} should be a boolean.`)}else{if(d(e)||D(e))return{poSources:e};if(typeof e!="undefined")throw new O("Options should be an object of options, glob string or glob array.");return{}}return e},de=e=>{let t=U();return typeof e.potSources!="undefined"&&(b(e.potSources)||(e.potSources=[e.potSources]),e.potSources=e.potSources.map(r=>d(r)?r.trim():r).filter(r=>!d(r)||r.length>0)),typeof e.poSources!="undefined"&&e.poSources!==null&&(b(e.poSources)||(e.poSources=[e.poSources]),e.poSources=e.poSources.map(r=>r.trim()).filter(r=>r.length>0)),e.srcDir&&(e.srcDir=U(e.srcDir.trim()),e.srcDir=`${te(t,e.srcDir)}/`.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/(?<!\.)\.\//g,"").replace(/^\//g,"")),e.destDir&&(e.destDir=U(e.destDir.trim()),e.destDir=`${te(t,e.destDir)}/`.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/(?<!\.)\.\//g,"").replace(/^\//g,"")),e.wrapLength&&(e.wrapLength=Math.ceil(e.wrapLength)),e},T=(e,t=!0)=>{e=me(e),e=de(e);let s=Object.assign({},{potSources:["**/*.pot","!node_modules/**"],poSources:null,srcDir:"",domainInPOPath:!0,domainFromPOTPath:!0,domain:"",srcGlobOptions:{},wrapLength:77,defaultContextAsFallback:!1,appendNonIncludedFromPO:!1,includePORevisionDate:!1,includeGenerator:!0,returnPOT:!1,writeFiles:!!t,destDir:"",logResults:!1,_pot_input_files:[],_po_input_files:[]},e);if(s.domainFromPOTPath===!1&&s.domainInPOPath===!0&&0>=s.domain.length)throw new O("Option domain should be a non-empty string when domainFromPOTPath is false and domainInPOPath is true.");if(s.returnPOT&&!s.writeFiles)throw new O("If option returnPOT is true, option writeFiles must be true or no PO files will be generated.");return s};import{basename as z,dirname as se}from"path";import{Buffer as ge}from"buffer";import{sync as oe}from"matched";import{existsSync as he,mkdirSync as Oe,writeFileSync as Pe}from"fs";import ye from"gettext-parser";import Se from"vinyl";import P from"ansi-colors";import be from"color-support";var re=be();P.enabled=re&&re.hasBasic;var F=e=>{if(b(e.potSources)&&e.potSources.length&&d(e.potSources[0])&&(e.potSources=oe(e.potSources)),e._potFilenames=e.potSources.map(t=>d(t)?t:t.path),0>=e.potSources.length)throw new y("No POT files found to process.");if(1<e.potSources.length&&e.poSources)throw new y(`When processing multiple POT files, leave option poSources empty. | ||
import*as M from"fs";import G from"vinyl";import{Buffer as _e}from"buffer";import J from"gettext-parser";import v from"ansi-colors";import Re from"color-support";import*as Y from"util";import L from"ansi-colors";import ce from"color-support";var C={name:"fill-pot-po",version:"4.0.2",description:"Create pre-filled PO files from POT file, using previous PO files.",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",scripts:{dev:"npm run build -- --watch src",build:"tsup",lint:"eslint src/*.ts test/*.ts","lint:fix":"eslint --fix src/*.ts test/*.ts",test:"jest",coverage:"jest --coverage","build:test":"tsup && jest"},keywords:["pot","po","fill","merge","auto-fill","prefill","pre-fill","generate","create","i18n","l10n","gettext","translation"],repository:"https://github.com/vheemstra/fill-pot-po.git",homepage:"https://github.com/vheemstra/fill-pot-po",bugs:"https://github.com/vheemstra/fill-pot-po/issues",author:{name:"Philip van Heemstra",url:"https://github.com/vheemstra"},engines:{node:">=18"},files:["dist"],license:"MIT",dependencies:{"ansi-colors":"^4.1.3","color-support":"^1.1.3","gettext-parser":"^8.0.0",matched:"^5.0.1",vinyl:"^3.0.0"},devDependencies:{"@types/color-support":"^1.1.4","@types/gettext-parser":"^4.0.4","@types/jest":"^29.5.12","@types/vinyl":"^2.0.12","@typescript-eslint/eslint-plugin":"^7.16.0","@typescript-eslint/parser":"^7.16.0","babel-plugin-transform-import-meta":"^2.2.1",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-jest":"^28.6.0","eslint-plugin-prettier":"^5.1.3",jest:"^29.7.0","ts-jest":"^29.2.1","ts-node":"^10.9.2",tsup:"^8.1.0",typescript:"^5.5.3","utility-types":"^3.11.0"}};var X=ce();L.enabled=X&&X.hasBasic;var N=class{constructor(t,r=""){this.message=t,this.category=r.slice(0,1).toUpperCase()+r.slice(1).toLowerCase()}toString(){return`${L.cyan(C.name)} ${L.bold.red(`${this.category}Error`)} ${this.message}`}[Y.inspect.custom](){return this.toString()}},y=N;import{resolve as U,relative as te}from"path";import fe from"vinyl";import ue from"vinyl";var b=e=>Object.prototype.toString.call(e)==="[object Array]",K=e=>Object.prototype.toString.call(e)==="[object Object]",d=e=>Object.prototype.toString.call(e)==="[object String]",Q=e=>Object.prototype.toString.call(e)==="[object Boolean]",D=e=>b(e)?!!e.reduce((t,r)=>d(r)&&t,!0):!1,ee=e=>b(e)?!!e.reduce((t,r)=>ue.isVinyl(r)&&t,!0):!1,B=(e,t)=>{if(!d(e)||!d(t))throw new Error("pathLineSort: a or b not a string");let r,s;if([e,r]=e.split(":"),[t,s]=t.split(":"),e=e.replace(/(^\/|\/$)/g,""),t=t.replace(/(^\/|\/$)/g,""),e===t){if((!r||r==="")&&s&&s.length)return-1;if((!s||s==="")&&r&&r.length)return 1;if(r&&r.length&&s&&s.length)return parseInt(r)-parseInt(s)}let n=e.split("/"),o=t.split("/"),i=n.length,l=o.length,u=Math.max(i,l);for(let p=0;p<u;p++){if(p>=l||!o[p])return-1;if(p>=i||!n[p])return 1;let[f,m]=n[p].split(/\.(?=[^.]*$)/g),[g,h]=o[p].split(/\.(?=[^.]*$)/g),_=m&&m!=="",R=h&&h!=="";if(!_&&R)return-1;if(_&&!R||f.toUpperCase()>g.toUpperCase())return 1;if(f.toUpperCase()<g.toUpperCase())return-1;if(m&&h){if(m.toUpperCase()>h.toUpperCase())return 1;if(m.toUpperCase()<h.toUpperCase())return-1}}return 0};var O=class extends y{constructor(t){super(t,"options")}},me=e=>{if(K(e)){if("potSources"in e&&!d(e.potSources)&&!D(e.potSources)&&!fe.isVinyl(e.potSources)&&!ee(e.potSources))throw new O("Option potSources should be a string or Vinyl object, or an array of those.");if("poSources"in e&&e.poSources!==null&&!d(e.poSources)&&!D(e.poSources))throw new O("Option poSources should be a glob string or glob array.");if("wrapLength"in e&&(typeof e.wrapLength!="number"||0>=e.wrapLength))throw new O("If set, option wrapLength should be a number higher than 0.");let t=["srcDir","destDir","domain"];for(let s of t)if(s in e)if(d(e[s])){if(e[s].match(/\n/))throw new O(`Option ${s} can't contain newline characters.`)}else throw new O(`Option ${s} should be a string.`);let r=["writeFiles","returnPOT","domainFromPOTPath","domainInPOPath","defaultContextAsFallback","appendNonIncludedFromPO","includePORevisionDate","includeGenerator","logResults"];for(let s of r)if(s in e&&!Q(e[s]))throw new O(`Option ${s} should be a boolean.`)}else{if(d(e)||D(e))return{poSources:e};if(typeof e!="undefined")throw new O("Options should be an object of options, glob string or glob array.");return{}}return e},de=e=>{let t=U();return typeof e.potSources!="undefined"&&(b(e.potSources)||(e.potSources=[e.potSources]),e.potSources=e.potSources.map(r=>d(r)?r.trim():r).filter(r=>!d(r)||r.length>0)),typeof e.poSources!="undefined"&&e.poSources!==null&&(b(e.poSources)||(e.poSources=[e.poSources]),e.poSources=e.poSources.map(r=>r.trim()).filter(r=>r.length>0)),e.srcDir&&(e.srcDir=U(e.srcDir.trim()),e.srcDir=`${te(t,e.srcDir)}/`.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/(?<!\.)\.\//g,"").replace(/^\//g,"")),e.destDir&&(e.destDir=U(e.destDir.trim()),e.destDir=`${te(t,e.destDir)}/`.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/(?<!\.)\.\//g,"").replace(/^\//g,"")),e.wrapLength&&(e.wrapLength=Math.ceil(e.wrapLength)),e},T=(e,t=!0)=>{e=me(e),e=de(e);let s=Object.assign({},{potSources:["**/*.pot","!node_modules/**"],poSources:null,srcDir:"",domainInPOPath:!0,domainFromPOTPath:!0,domain:"",srcGlobOptions:{},wrapLength:77,defaultContextAsFallback:!1,appendNonIncludedFromPO:!1,includePORevisionDate:!1,includeGenerator:!0,returnPOT:!1,writeFiles:!!t,destDir:"",logResults:!1,_pot_input_files:[],_po_input_files:[]},e);if(s.domainFromPOTPath===!1&&s.domainInPOPath===!0&&0>=s.domain.length)throw new O("Option domain should be a non-empty string when domainFromPOTPath is false and domainInPOPath is true.");if(s.returnPOT&&!s.writeFiles)throw new O("If option returnPOT is true, option writeFiles must be true or no PO files will be generated.");return s};import{basename as z,dirname as se}from"path";import{Buffer as ge}from"buffer";import{sync as oe}from"matched";import{existsSync as he,mkdirSync as Oe,writeFileSync as Pe}from"fs";import ye from"gettext-parser";import Se from"vinyl";import P from"ansi-colors";import be from"color-support";var re=be();P.enabled=re&&re.hasBasic;var F=e=>{if(b(e.potSources)&&e.potSources.length&&d(e.potSources[0])&&(e.potSources=oe(e.potSources)),e._potFilenames=e.potSources.map(t=>d(t)?t:t.path),0>=e.potSources.length)throw new y("No POT files found to process.");if(1<e.potSources.length&&e.poSources)throw new y(`When processing multiple POT files, leave option poSources empty. | ||
Else, the same generated PO files will be overwritten for each POT file.`,"options");return e},j=(e,t)=>{let r=z(e,".pot"),s=t.domainFromPOTPath?r:t.domain,n=t.srcDir?t.srcDir:`${se(e)}/`,o=[];if(t.poSources)o.push(...t.poSources);else{let l="[a-z][a-z]?([a-z])?(_[A-Z][A-Z]?([A-Z]))?(_formal)",u=t.domainInPOPath?`${s}-`:"";o.push(`${n}${u}${l}.po`)}return oe(o,t.srcGlobOptions).sort(B)},V=(e,t,r,s)=>{let n=JSON.parse(JSON.stringify(e));n=we(n,t,s);let o=xe(n,s),i=z(r);return s.writeFiles&&ve(`${s.destDir}${i}`,o),new Se({contents:ge.from(o),path:i})},we=(e,t,r)=>{var s,n,o,i,l,u,p,f,m,g,h,_,R,H,W;for(let[a,$]of Object.entries(e.translations))for(let[c,S]of Object.entries($))t.translations[a]&&t.translations[a][c]&&t.translations[a][c].msgstr.length===S.msgstr.length?e.translations[a][c].msgstr=[...t.translations[a][c].msgstr]:r.defaultContextAsFallback&&t.translations[""]&&t.translations[""][c]&&t.translations[""][c].msgstr.length===S.msgstr.length&&(e.translations[a][c].msgstr=[...t.translations[""][c].msgstr],e.translations[a][c].comments={translator:"",reference:"",extracted:"",previous:"",...(n=(s=e.translations[a][c])==null?void 0:s.comments)!=null?n:{},flag:["fuzzy",(i=(o=e.translations[a][c])==null?void 0:o.comments)==null?void 0:i.flag].filter(I=>I).join(", ")},t.translations[""][c].comments={reference:"",extracted:"",flag:"",previous:"",...(u=(l=t.translations[""][c])==null?void 0:l.comments)!=null?u:{},translator:[`NOTE: re-used for same message, but with context '${a}'`,(f=(p=t.translations[""][c])==null?void 0:p.comments)==null?void 0:f.translator].filter(I=>I).join(` | ||
`)});if(r.appendNonIncludedFromPO)for(let[a,$]of Object.entries(t.translations)){e.translations[a]||(e.translations[a]={});for(let[c,S]of Object.entries($))e.translations[a][c]||(e.translations[a][c]=S,e.translations[a][c].comments={translator:"",reference:"",extracted:"",flag:"",previous:"",...(g=(m=e.translations[a][c])==null?void 0:m.comments)!=null?g:{},...(_=(h=e.translations[a][c])==null?void 0:h.comments)!=null&&_.translator&&((R=S==null?void 0:S.comments)!=null&&R.translator.match(/^DEPRECATED$/gm))?{}:{translator:d((W=(H=e.translations[a][c])==null?void 0:H.comments)==null?void 0:W.translator)?`DEPRECATED | ||
`+e.translations[a][c].comments.translator:"DEPRECATED"}})}if(r.includePORevisionDate){let a=new Date,$=[`${a.getUTCFullYear()}`,`-${String(a.getUTCMonth()+1).padStart(2,"0")}`,`-${String(a.getUTCDate()).padStart(2,"0")}`,` ${String(a.getUTCHours()).padStart(2,"0")}`,`:${String(a.getUTCMinutes()).padStart(2,"0")}`,"+0000"].join("");e.headers["po-revision-date"]=$}return r.includeGenerator&&(e.headers["X-Generator"]=`${C.name}/${C.version}`),e},xe=(e,t)=>ye.po.compile(e,{foldLength:t.wrapLength,sort:(r,s)=>{var i,l,u,p,f,m;let n=(l=(i=s.comments)==null?void 0:i.translator)==null?void 0:l.match(/^DEPRECATED$/gm),o=(p=(u=r.comments)==null?void 0:u.translator)==null?void 0:p.match(/^DEPRECATED$/gm);return!o&&n?-1:o&&!n?1:(f=s.comments)!=null&&f.reference?(m=r.comments)!=null&&m.reference?(r=r.comments.reference.trim().split(/\s+/)[0],s=s.comments.reference.trim().split(/\s+/)[0],B(r,s)):1:-1}}),ve=(e,t)=>{let r=se(e);he(r)||Oe(r,{recursive:!0}),Pe(e,t.toString())},A=(e,t,r,s)=>{e.forEach((n,o)=>{var f,m;let i=z(n),l=(f=t[o])==null?void 0:f.map(g=>g),u=(m=r[o])==null?void 0:m.map(g=>g.path),p=l.reduce((g,h)=>Math.max(h.length,g),0);console.log(""),u&&u.length?(console.log(` ${P.bold.green("\u25A0")} ${P.white(i)}`),u.forEach((g,h)=>{console.log([" ",`${P.cyan(l[h].padEnd(p," "))}`,` ${P.gray("\u2014\u25BA")} `,`${P.yellow(s)}${P.yellow(g)}`].join(""))})):(console.log(` ${P.gray("\u25A0")} ${P.white(i)}`),console.log(` ${P.gray("No PO files found.")}`))}),console.log("")};var ne=Re();v.enabled=ne&&ne.hasBasic;var $e=(e,t,r)=>{M.readFile(e,(s,n)=>{s&&r(s);let o=J.po.parse(n);t(o)})},Ce=(e,t,r,s)=>{let n=G.isVinyl(e),o=n?e.path:e,i=j(o,t);if(i.length)if(n){t.returnPOT&&t._pot_input_files.push(e);let l=J.po.parse(e.contents);r([l,i])}else M.readFile(o,(l,u)=>{l&&s(l),t.returnPOT&&t._pot_input_files.push(new G({contents:_e.from(u),path:o}));let p=J.po.parse(u);r([p,i])});else r(null)},ie=(e,t)=>{if(typeof e!="function")throw new y("fillPotPo() requires a callback function as first parameter");let r;try{r=F(T(t))}catch(s){e([!1,s.toString()]);return}r._pot_input_files=[],r._po_input_files=[],Promise.all(r.potSources.map(s=>{let n=G.isVinyl(s)?s.relative:s;return new Promise((o,i)=>{Ce(s,r,o,i)}).then(async o=>{if(!o)return r._po_input_files.push([]),[];let i=o[0],l=o[1];return r._po_input_files.push(l),await Promise.all(l.map(p=>new Promise((f,m)=>{$e(p,f,m)}).then(f=>V(i,f,p,r)).catch(f=>{throw new y(`${v.bold(f.message)} ${v.gray(`(PO ${v.white(p)})`)}`)})))}).catch(o=>{throw new y(`${o.message} ${v.gray(`(POT ${v.white(n)})`)}`)})})).then(s=>{if(r.logResults&&A(r._potFilenames,r._po_input_files,s,r.destDir),r.returnPOT){e([!0,r._pot_input_files]);return}e([!0,[].concat(...s)])}).catch(s=>{e([!1,s.toString()])}).finally(()=>{r._pot_input_files=[],r._po_input_files=[]})};import*as q from"fs";import ae from"vinyl";import le from"gettext-parser";var E=[],Z=[],k=[],Te=(e,t,r)=>{let s=[];for(let n of e){let o=q.readFileSync(n).toString(),i=le.po.parse(o);s.push(V(t,i,n,r))}k.push(s)},ke=(e,t)=>{let r=ae.isVinyl(e),s=r?e.path:e,n=j(s,t);if(Z.push(n),n.length){let o="";if(r)t.returnPOT&&E.push(e),o=e.contents.toString();else{let l=q.readFileSync(s);o=l.toString(),t.returnPOT&&E.push(new ae({contents:l,path:s}))}let i=le.po.parse(o);Te(n,i,t)}else k.push([])},De=e=>{E=[],Z=[],k=[];let t=F(T(e));return t.potSources.forEach(r=>{ke(r,t)}),t.logResults&&A(t._potFilenames,Z,k,t.destDir),t.returnPOT?E:[].concat(...k)};var jt={wrapLength:77,defaultContextAsFallback:!0,appendNonIncludedFromPO:!0,includePORevisionDate:!1,includeGenerator:!1},Vt=ie;export{Vt as default,T as prepareOptions,De as sync,jt as testOptions}; |
{ | ||
"name": "fill-pot-po", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "Create pre-filled PO files from POT file, using previous PO files.", | ||
"type": "module", | ||
"main": "./dist/index.mjs", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
@@ -8,0 +8,0 @@ "scripts": { |
@@ -12,3 +12,3 @@ # fill-pot-po [![GitHub release (latest SemVer)][release-image]][release-url] [![NPM version][npm-image]][npm-url] | ||
> | ||
> ✨ **_This package now supports both ESM and CommonJS_** 🎉 | ||
> ✨ **_This package now only supports ESM. For CommonJS use version 3._** 🎉 | ||
@@ -57,6 +57,6 @@ ## Use case | ||
#### Example (CommonJS) | ||
#### Example (ESM) | ||
```js | ||
const fillPotPo = require('fill-pot-po'); | ||
import fillPotPo from "fill-pot-po"; | ||
@@ -70,6 +70,6 @@ const cb = (results) => { | ||
#### Example (ESM) | ||
#### Example (CommonJS - only with versions <= 3) | ||
```js | ||
import fillPotPo from 'fill-pot-po'; | ||
const fillPotPo = require("fill-pot-po"); | ||
@@ -108,6 +108,6 @@ const cb = (results) => { | ||
#### Example (CommonJS) | ||
#### Example (ESM) | ||
```js | ||
const fillPotPoSync = require('fill-pot-po').sync; | ||
import { sync as fillPotPoSync } from "fill-pot-po"; | ||
@@ -123,6 +123,6 @@ try { | ||
#### Example (ESM) | ||
#### Example (CommonJS - only with versions <= 3) | ||
```js | ||
import { sync as fillPotPoSync } from 'fill-pot-po'; | ||
const fillPotPoSync = require("fill-pot-po").sync; | ||
@@ -129,0 +129,0 @@ try { |
31942
0.21%