jiek 0.4.7-alpha.4 → 0.4.7-alpha.6
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/jiek.js +2 -2
- package/dist/cli.cjs +4111 -4
- package/dist/cli.js +4111 -4
- package/dist/cli.min.cjs +19 -1
- package/dist/cli.min.js +19 -1
- package/dist/rollup/index.cjs +4113 -4
- package/dist/rollup/index.js +4113 -4
- package/dist/rollup/index.min.cjs +19 -1
- package/dist/rollup/index.min.js +19 -1
- package/package.json +5 -4
- package/src/rollup/index.ts +2 -2
package/dist/cli.min.cjs
CHANGED
@@ -1 +1,19 @@
|
|
1
|
-
"use strict";var e=require("node:fs"),t=require("node:path"),r=require("@pnpm/filter-workspace-packages"),n=require("commander"),o=require("js-yaml"),i=require("@jiek/utils/getWorkspaceDir"),s=require("cli-progress"),a=require("execa"),c=require("detect-indent"),p=require("inquirer"),l=require("jsonc-parser"),u=require("micromatch"),f=require("node:child_process"),d=require("@jiek/utils/bumper"),m=require("@jiek/pkger/entrypoints");function g(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var y=g(f);let w,h;function b(){if(w)return w;const e=n.program.getOptionValue("root");return w=e?t.isAbsolute(e)?e:t.resolve(process.cwd(),e):void 0,w}let k=!1;function j(){if(h)return{wd:h,notWorkspace:k};const e=b();if(void 0!==e){const t=i.isWorkspaceDir(e,S);return k=!t,h=e,{wd:h,notWorkspace:k}}try{h=i.getWorkspaceDir(S)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;h=e,k=!0}return{wd:h,notWorkspace:k}}let S="";try{require.resolve("@pnpm/filter-workspace-packages"),S="pnpm"}catch{}async function v(){let i=n.program.getOptionValue("filter");const s=b(),{wd:a,notWorkspace:c}=j();if(!c&&"pnpm"===S){const n=t.resolve(a,"pnpm-workspace.yaml"),c=e.readFileSync(n,"utf-8"),p=o.load(c);if(s===a&&!i)throw new Error("root path is workspace root, please provide a filter");if(s!==a&&!i){if(!e.existsSync(t.resolve(s,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const r=JSON.parse(e.readFileSync(t.resolve(s,"package.json"),"utf-8"));if(!r.name)throw new Error("root path is not workspace root, please provide a filter");i=r.name}const{selectedProjectsGraph:l}=await r.filterPackagesFromDir(a,[{filter:i??"",followProdDepsOnly:!0}],{prefix:s,workspaceDir:a,patterns:p.packages});return{wd:a,root:s,value:Object.entries(l).reduce(((e,[t,r])=>(e[t]=r.package.manifest,e)),{})}}return{wd:a,root:s,value:{[a]:JSON.parse(e.readFileSync(t.resolve(a,"package.json"),"utf-8"))}}}""!==S&&n.program.option("-f, --filter <filter>","filter packages");var $=require("../package.json");let E,O;function q(){E()}function x(){new Promise((e=>E=e))}function F(e){try{return require.resolve(e),!0}catch(e){return!1}}n.program.version($.version).description($.description).option("--root <root>","root path").option("-c, --config-path <configPath>","config path");const _=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of _)if(F(e)){O=e;break}let J="jiek.config";function M(r){const{wd:i}=j();let s=n.program.getOptionValue("configPath");if(s){if(!e.existsSync(s))throw new Error(`config file not found: ${s}`);t.isAbsolute(s)||(s=t.resolve(i,s))}else s=function(r,n){const o=!!O;function i(o){const i=[t.resolve(process.cwd(),`${J}.${o}`),t.resolve(process.cwd(),`.${J}.${o}`),t.resolve(r,`${J}.${o}`),t.resolve(r,`.${J}.${o}`)];n&&i.unshift(t.resolve(n,`${J}.${o}`),t.resolve(n,`.${J}.${o}`));for(const t of i)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return J=i("js")??J,J=i("json")??J,J=i("yaml")??J,o&&(J=i("ts")??J),t.resolve(r,J)}(i,r);const a=t.extname(s);let c;switch(a){case".js":c=require(s);break;case".json":return require(s);case".yaml":return o.load(e.readFileSync(s,"utf-8"));case".ts":if(O){require(O),c=require(s);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":c={};break;default:throw new Error(`unsupported config file type: ${a}`)}if(!c)throw new Error("config file is empty");return c.default??c}n.program.command("build").option("-s, --silent","Don't display logs.").option("-e, --entries <ENTRIES>","Specify the entries of the package.json's 'exports' field.(support glob)").action((async({silent:r,entries:n})=>{x();const{build:o}=M();r=r??o?.silent??!1;const{wd:i,value:c={}}=await v()??{};if(0===Object.keys(c).length)throw new Error("no package found");const p=t.resolve(i,"node_modules");e.existsSync(p)||e.mkdirSync(p);const l=(...e)=>t.resolve(p,".jiek",...e);e.existsSync(l())||e.mkdirSync(l());const u=require.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup"),f=new s.MultiBar({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {status} | {input} | {message}"},s.Presets.shades_classic);let d=0;await Promise.all(Object.entries(c).map((async([t,o])=>{const s=o.name?.replace(/^@/g,"").replace(/\//g,"+"),c=l(`${s??"anonymous-"+d++}.rollup.config.js`);e.writeFileSync(c,(e=>`\nconst manifest = ${JSON.stringify(e,null,2)}\nmodule.exports = require('jiek/rollup').template(manifest)\n`.trimStart())(o));let p="";O&&(p=`node -r ${O} `);const m=`${p}${u} --silent -c ${c}`,g=a.execaCommand(m,{ipc:!0,cwd:t,env:{...process.env,JIEK_ROOT:i,JIEK_ENTRIES:n}}),y={};let w=10;g.on("message",(e=>{"debug"===e.type&&console.log(...Array.isArray(e.data)?e.data:[e.data])})),!r&&g.on("message",(e=>{if("init"===e.type){const{leafMap:t,targetsLength:r}=e.data,n=Array.from(t.entries()).flatMap((([e,t])=>t.map((([t,...r])=>({input:e,path:t,conditions:r})))));console.log(`Package '${o.name}' has ${r} targets to build`),n.forEach((({input:e})=>{w=Math.max(w,e.length)})),n.forEach((({input:e,path:t})=>{const r=`${e}:${t}`;y[r]||(y[r]=f.create(50,0,{input:e.padEnd(w),status:"waiting".padEnd(10)},{barsize:20,linewrap:!0}))}))}if("progress"===e.type){const{path:t,tags:r,input:n,event:o,message:i}=e.data,s=y[`${n}:${t}`];if(!s)return;s.update({start:0,resolve:20,end:50}[o??"start"]??0,{input:n.padEnd(w),status:o?.padEnd(10),message:`${r?.join(", ")}: ${i}`})}})),await new Promise(((e,t)=>{let r="";g.stderr?.on("data",(e=>{r+=e})),g.once("exit",(n=>0===n?e():t(new Error(`rollup build failed:\n${r}`))))}))}))).finally((()=>{f.stop()})),q()}));const N='{\n "name": "",\n "version": "0.0.1",\n "description": "",\n "license": "",\n "author": "",\n "files": ["dist"],\n "exports": {\n ".": "./src/index.ts"\n },\n "scripts": {\n },\n "homepage": "",\n "repository": "",\n "bugs": ""\n}'.trimStart(),P="# $name\n\n## Installation\n\n```bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n```\n\n## Usage\n\n\n## License\n\n$license\n".trimStart();const D=new Map;function I(r,n){if(D.has(r))return D.get(r)[n];const o=t.resolve(r,"package.json"),i=JSON.parse(e.readFileSync(o,"utf-8"));return D.set(r,i),i[n]}n.program.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,r]=n.program.args,o=process.cwd(),{init:i={}}=M()??{},{wd:s}=j(),a=t.basename(s),{named:f,template:d,bug:m={},readme:g=P,readmeTemplate:y}=i,w={template:"bug_report.yml",labels:["bug"],...m};let h=g;if(y){const r=t.resolve(s,y);h=e.readFileSync(r,"utf-8")}const b=function(r,n){let o=n??N,i=!1;try{n&&JSON.parse(n)}catch(e){i=!0}if(i){const i=t.resolve(r,n);o=e.readFileSync(i,"utf-8")}return o}(s,d),{indent:k=" "}=c(b),S={tabSize:k.length,insertSpaces:!0},v=["license","author"];let $=b;for(const e of v)$=l.applyEdits($,l.modify($,[e],I(s,e),{formattingOptions:S}));let[E,O]=await async function(e,r,{wd:n,cwd:o,workspaceName:i}){const s=o.replace(`${n}/`,"");let a=t.basename(o);if("function"==typeof e)return e(r,{full:n,relative:o});let c,l,f=!1;if("object"==typeof e)if(o===n){const{rule:t}=await p.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(c=t,l=e[t])}else for(const[t,r]of Object.entries(e)){if(u.isMatch(s,t)){c=t,l=r;break}if(u.isMatch(`${s}/jiek_ignore_dont_use_same_file_name`,t)){f=!0,c=t,l=r;break}}if(l||(c="packages/*",l=`@${i}/$basename`),!l)throw new Error("no matched rule");if(!r&&f&&(a=await p.prompt({type:"input",name:"name",message:`the matched rule is \`${String(l)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof l)return l(r,{full:n,relative:o,basename:a});if("string"==typeof l){const e=r??a;return[l.replace(/\$basename/g,e),c?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(f,r,{wd:s,cwd:o,workspaceName:a});if(!O){const{dir:e}=await p.prompt({type:"input",name:"dir",message:"package directory",default:r});O=e}if(!E){const{name:e}=await p.prompt({type:"input",name:"name",message:"package name",default:r});E=e}$=l.applyEdits($,l.modify($,["name"],E,{formattingOptions:S}));let q=I(s,"repository");"string"==typeof q&&(q={type:"git",url:q,directory:O}),$=l.applyEdits($,l.modify($,["repository"],q,{formattingOptions:S}));const x=`${q?.url}/blob/master/${O}/README.md`;$=l.applyEdits($,l.modify($,["homepage"],x,{formattingOptions:S}));let F=w.labels;"function"==typeof F&&(F=F({name:E,dir:O})),F.push(`scope:${E}`);const _=`${q?.url}/issues/new?template=${w.template}&labels=${F.join(",")}`;function J(e){if(!O)throw new Error("pkgDir is not defined");return t.resolve(O,e)}$=l.applyEdits($,l.modify($,["bugs"],_,{formattingOptions:S})),e.existsSync(O)||e.mkdirSync(O);const D=J("package.json");if(e.existsSync(D))throw new Error("package.json already exists");e.writeFileSync(D,$),console.log($,"written to",D);const A=I(s,"license"),R=J("README.md");"function"==typeof h&&(h=h({dir:O,packageJson:JSON.parse($)}));const T=h.replace(/\$name/g,E).replace(/\$license/g,A);e.writeFileSync(R,T)}));const A=(e,t)=>new Set([...e].filter((e=>t.has(e))));function R({entrypoints:e,pkgIsModule:r,entries:n,config:o,dir:i,noFilter:s,withSource:a,withSuffix:c}){const{build:p={}}=o??{},{crossModuleConvertor:l=!0}=p,f=`./${d=((...e)=>t.resolve(i??process.cwd(),...e))(("object"==typeof p?.output?.dir?p.output.dir.js:p?.output?.dir)??"dist"),t.relative(i??process.cwd(),d)}`;var d;const[,g]=m.resolveEntrypoints(e);n&&Object.entries(g).forEach((([e])=>{n.some((t=>u.isMatch(e,t,{matchBase:!0})))||delete g[e]}));const y=s?g:m.filterLeafs(g,{skipValue:[/(^|\/)\.jk-noentry/,...m.DEFAULT_SKIP_VALUES]}),w=l?{import:e=>!r&&0===A(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!r||0!==A(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{};return[y,m.entrypoints2Exports(y,{outdir:f,withSource:a,withSuffix:c,withConditional:{...w}})]}n.program.command("publish").aliases(["pub","p"]).option("-b, --bumper <bumper>","bump version","patch").option("-p, --preview","preview publish").action((async({preview:r,bumper:n,...o})=>{x();const{value:i={}}=await v()??{},s=Object.entries(i);if(0===s.length)throw new Error("no packages selected");const a=s.map((([e,t])=>{const{type:r,exports:n={}}=t,o="module"===r,i={...t},[s,a]=R({entrypoints:n,pkgIsModule:o,config:M(e),dir:e,noFilter:!0,withSource:!0,withSuffix:!0});return i.exports={...s,...a},[e,i]})),p=Object.entries(o).reduce(((e,[t,r])=>(r&&e.push(`--${t}`,r),e)),[]);for(const[o,i]of a){const s=e.readFileSync(t.join(o,"package.json"),"utf-8"),a=JSON.parse(s)??"0.0.0",u=d.bump(a.version,n),{indent:f=" "}=c(s),m={tabSize:f.length,insertSpaces:!0};let g=s;g=l.applyEdits(g,l.modify(g,["version"],u,{formattingOptions:m}));for(const[e,t]of Object.entries(i))if(JSON.stringify(t)!==JSON.stringify(a[e]))if("exports"!==e)g=l.applyEdits(g,l.modify(g,["publishConfig",e],t,{formattingOptions:m}));else{const e=t;for(const[t,r]of Object.entries(e))g=l.applyEdits(g,l.modify(g,["publishConfig","exports",t],r,{formattingOptions:m}));const r=e?.["."],n={};if(r){switch(typeof r){case"string":n["module"===i?.type?"module":"main"]=r;break;case"object":{const e=r;n.main=e.require??e.default,n.module=e.import??e.module??e.default;break}}for(const[e,t]of Object.entries(n))void 0!==t&&(g=l.applyEdits(g,l.modify(g,["publishConfig",e],t,{formattingOptions:m})))}}try{if(e.renameSync(t.join(o,"package.json"),t.join(o,"package.json.bak")),e.writeFileSync(t.join(o,"package.json"),g),console.log(g),r){console.warn("preview mode");continue}y.execSync(["pnpm","publish","--access","public","--no-git-checks",...p].join(" "),{cwd:o,stdio:"inherit"});const n=l.applyEdits(s,l.modify(s,["version"],u,{}));e.writeFileSync(t.join(o,"package.json.bak"),n)}finally{e.unlinkSync(t.join(o,"package.json")),e.renameSync(t.join(o,"package.json.bak"),t.join(o,"package.json"))}}q()})),n.program.parse(process.argv);
|
1
|
+
"use strict";var e=require("node:fs"),t=require("node:path"),n=require("@pnpm/filter-workspace-packages"),r=require("commander"),o=require("js-yaml"),s=require("@jiek/utils/getWorkspaceDir"),a=require("cli-progress"),i=require("execa"),u=require("detect-indent"),p=require("inquirer"),l=require("jsonc-parser"),c=require("util"),f=require("path"),g=require("node:child_process"),d=require("@jiek/utils/bumper"),h=require("@jiek/pkger/entrypoints");function y(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var A=y(g);let R,E;function m(){if(R)return R;const e=r.program.getOptionValue("root");return R=e?t.isAbsolute(e)?e:t.resolve(process.cwd(),e):void 0,R}let _=!1;function b(){if(E)return{wd:E,notWorkspace:_};const e=m();if(void 0!==e){const t=s.isWorkspaceDir(e,S);return _=!t,E=e,{wd:E,notWorkspace:_}}try{E=s.getWorkspaceDir(S)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;E=e,_=!0}return{wd:E,notWorkspace:_}}let S="";try{require.resolve("@pnpm/filter-workspace-packages"),S="pnpm"}catch{}async function C(){let s=r.program.getOptionValue("filter");const a=m(),{wd:i,notWorkspace:u}=b();if(!u&&"pnpm"===S){const r=t.resolve(i,"pnpm-workspace.yaml"),u=e.readFileSync(r,"utf-8"),p=o.load(u);if(a===i&&!s)throw new Error("root path is workspace root, please provide a filter");if(a!==i&&!s){if(!e.existsSync(t.resolve(a,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const n=JSON.parse(e.readFileSync(t.resolve(a,"package.json"),"utf-8"));if(!n.name)throw new Error("root path is not workspace root, please provide a filter");s=n.name}const{selectedProjectsGraph:l}=await n.filterPackagesFromDir(i,[{filter:s??"",followProdDepsOnly:!0}],{prefix:a,workspaceDir:i,patterns:p.packages});return{wd:i,root:a,value:Object.entries(l).reduce(((e,[t,n])=>(e[t]=n.package.manifest,e)),{})}}return{wd:i,root:a,value:{[i]:JSON.parse(e.readFileSync(t.resolve(i,"package.json"),"utf-8"))}}}""!==S&&r.program.option("-f, --filter <filter>","filter packages");var v=require("../package.json");let $,x;function w(){$()}function H(){new Promise((e=>$=e))}function k(e){try{return require.resolve(e),!0}catch(e){return!1}}r.program.version(v.version).description(v.description).option("--root <root>","root path").option("-c, --config-path <configPath>","config path");const O=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of O)if(k(e)){x=e;break}let T="jiek.config";function L(n){const{wd:s}=b();let a=r.program.getOptionValue("configPath");if(a){if(!e.existsSync(a))throw new Error(`config file not found: ${a}`);t.isAbsolute(a)||(a=t.resolve(s,a))}else a=function(n,r){const o=!!x;function s(o){const s=[t.resolve(process.cwd(),`${T}.${o}`),t.resolve(process.cwd(),`.${T}.${o}`),t.resolve(n,`${T}.${o}`),t.resolve(n,`.${T}.${o}`)];r&&s.unshift(t.resolve(r,`${T}.${o}`),t.resolve(r,`.${T}.${o}`));for(const t of s)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return T=s("js")??T,T=s("json")??T,T=s("yaml")??T,o&&(T=s("ts")??T),t.resolve(n,T)}(s,n);const i=t.extname(a);let u;switch(i){case".js":u=require(a);break;case".json":return require(a);case".yaml":return o.load(e.readFileSync(a,"utf-8"));case".ts":if(x){require(x),u=require(a);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":u={};break;default:throw new Error(`unsupported config file type: ${i}`)}if(!u)throw new Error("config file is empty");return u.default??u}r.program.command("build").option("-s, --silent","Don't display logs.").option("-e, --entries <ENTRIES>","Specify the entries of the package.json's 'exports' field.(support glob)").action((async({silent:n,entries:r})=>{H();const{build:o}=L();n=n??o?.silent??!1;const{wd:s,value:u={}}=await C()??{};if(0===Object.keys(u).length)throw new Error("no package found");const p=t.resolve(s,"node_modules");e.existsSync(p)||e.mkdirSync(p);const l=(...e)=>t.resolve(p,".jiek",...e);e.existsSync(l())||e.mkdirSync(l());const c=require.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup"),f=new a.MultiBar({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {status} | {input} | {message}"},a.Presets.shades_classic);let g=0;await Promise.all(Object.entries(u).map((async([t,o])=>{const a=o.name?.replace(/^@/g,"").replace(/\//g,"+"),u=l(`${a??"anonymous-"+g++}.rollup.config.js`);e.writeFileSync(u,(e=>`\nconst manifest = ${JSON.stringify(e,null,2)}\nmodule.exports = require('jiek/rollup').template(manifest)\n`.trimStart())(o));let p="";x&&(p=`node -r ${x} `);const d=`${p}${c} --silent -c ${u}`,h=i.execaCommand(d,{ipc:!0,cwd:t,env:{...process.env,JIEK_ROOT:s,JIEK_ENTRIES:r}}),y={};let A=10;h.on("message",(e=>{"debug"===e.type&&console.log(...Array.isArray(e.data)?e.data:[e.data])})),!n&&h.on("message",(e=>{if("init"===e.type){const{leafMap:t,targetsLength:n}=e.data,r=Array.from(t.entries()).flatMap((([e,t])=>t.map((([t,...n])=>({input:e,path:t,conditions:n})))));console.log(`Package '${o.name}' has ${n} targets to build`),r.forEach((({input:e})=>{A=Math.max(A,e.length)})),r.forEach((({input:e,path:t})=>{const n=`${e}:${t}`;y[n]||(y[n]=f.create(50,0,{input:e.padEnd(A),status:"waiting".padEnd(10)},{barsize:20,linewrap:!0}))}))}if("progress"===e.type){const{path:t,tags:n,input:r,event:o,message:s}=e.data,a=y[`${r}:${t}`];if(!a)return;a.update({start:0,resolve:20,end:50}[o??"start"]??0,{input:r.padEnd(A),status:o?.padEnd(10),message:`${n?.join(", ")}: ${s}`})}})),await new Promise(((e,t)=>{let n="";h.stderr?.on("data",(e=>{n+=e})),h.once("exit",(r=>0===r?e():t(new Error(`rollup build failed:\n${n}`))))}))}))).finally((()=>{f.stop()})),w()}));var N,I,M,j,B,P,D,G,K,U,F,q,Q,W,X,Z,J,z,V,Y={};function ee(){return N||(N=1,(e=Y).isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),e.find=(e,t)=>e.nodes.find((e=>e.type===t)),e.exceedsLimit=(t,n,r=1,o)=>!1!==o&&!(!e.isInteger(t)||!e.isInteger(n))&&(Number(n)-Number(t))/Number(r)>=o,e.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},e.encloseBrace=e=>!("brace"!==e.type||e.commas>>0+e.ranges||(e.invalid=!0,0)),e.isInvalidBrace=e=>!("brace"!==e.type||!0!==e.invalid&&!e.dollar&&(e.commas>>0+e.ranges&&!0===e.open&&!0===e.close||(e.invalid=!0,0))),e.isOpenOrClose=e=>"open"===e.type||"close"===e.type||!0===e.open||!0===e.close,e.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),e.flatten=(...e)=>{const t=[],n=e=>{for(let r=0;r<e.length;r++){let o=e[r];Array.isArray(o)?n(o):void 0!==o&&t.push(o)}return t};return n(e),t}),Y;var e}function te(){if(M)return I;M=1;const e=ee();return I=(t,n={})=>{let r=(t,o={})=>{let s=n.escapeInvalid&&e.isInvalidBrace(o),a=!0===t.invalid&&!0===n.escapeInvalid,i="";if(t.value)return(s||a)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)i+=r(e);return i};return r(t)}}
|
2
|
+
/*!
|
3
|
+
* is-number <https://github.com/jonschlinkert/is-number>
|
4
|
+
*
|
5
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
6
|
+
* Released under the MIT License.
|
7
|
+
*/function ne(){return B?j:(B=1,j=function(e){return"number"==typeof e?e-e==0:"string"==typeof e&&""!==e.trim()&&(Number.isFinite?Number.isFinite(+e):isFinite(+e))})}
|
8
|
+
/*!
|
9
|
+
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
10
|
+
*
|
11
|
+
* Copyright (c) 2015-present, Jon Schlinkert.
|
12
|
+
* Released under the MIT License.
|
13
|
+
*/function re(){if(D)return P;D=1;const e=ne(),t=(n,s,a)=>{if(!1===e(n))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===s||n===s)return String(n);if(!1===e(s))throw new TypeError("toRegexRange: expected the second argument to be a number.");let i={relaxZeros:!0,...a};"boolean"==typeof i.strictZeros&&(i.relaxZeros=!1===i.strictZeros);let u=n+":"+s+"="+String(i.relaxZeros)+String(i.shorthand)+String(i.capture)+String(i.wrap);if(t.cache.hasOwnProperty(u))return t.cache[u].result;let p=Math.min(n,s),l=Math.max(n,s);if(1===Math.abs(p-l)){let e=n+"|"+s;return i.capture?`(${e})`:!1===i.wrap?e:`(?:${e})`}let f=c(n)||c(s),g={min:n,max:s,a:p,b:l},d=[],h=[];if(f&&(g.isPadded=f,g.maxLen=String(g.max).length),p<0){h=r(l<0?Math.abs(l):1,Math.abs(p),g,i),p=g.a=0}return l>=0&&(d=r(p,l,g,i)),g.negatives=h,g.positives=d,g.result=function(e,t,n){let r=o(e,t,"-",!1)||[],s=o(t,e,"",!1)||[],a=o(e,t,"-?",!0)||[];return r.concat(a).concat(s).join("|")}(h,d),!0===i.capture?g.result=`(${g.result})`:!1!==i.wrap&&d.length+h.length>1&&(g.result=`(?:${g.result})`),t.cache[u]=g,g.result};function n(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=function(e,t){let n=[];for(let r=0;r<e.length;r++)n.push([e[r],t[r]]);return n}(e,t),o=r.length,s="",a=0;for(let e=0;e<o;e++){let[t,n]=r[e];t===n?s+=t:"0"!==t||"9"!==n?s+=l(t,n):a++}return a&&(s+=!0===n.shorthand?"\\d":"[0-9]"),{pattern:s,count:[a],digits:o}}function r(e,t,r,o){let a,l=function(e,t){let n=1,r=1,o=i(e,n),a=new Set([t]);for(;e<=o&&o<=t;)a.add(o),n+=1,o=i(e,n);for(o=u(t+1,r)-1;e<o&&o<=t;)a.add(o),r+=1,o=u(t+1,r)-1;return a=[...a],a.sort(s),a}(e,t),c=[],g=e;for(let e=0;e<l.length;e++){let t=l[e],s=n(String(g),String(t),o),i="";r.isPadded||!a||a.pattern!==s.pattern?(r.isPadded&&(i=f(t,r,o)),s.string=i+s.pattern+p(s.count),c.push(s),g=t+1,a=s):(a.count.length>1&&a.count.pop(),a.count.push(s.count[0]),a.string=a.pattern+p(a.count),g=t+1)}return c}function o(e,t,n,r,o){let s=[];for(let o of e){let{string:e}=o;r||a(t,"string",e)||s.push(n+e),r&&a(t,"string",e)&&s.push(n+e)}return s}function s(e,t){return e>t?1:t>e?-1:0}function a(e,t,n){return e.some((e=>e[t]===n))}function i(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function u(e,t){return e-e%Math.pow(10,t)}function p(e){let[t=0,n=""]=e;return n||t>1?`{${t+(n?","+n:"")}}`:""}function l(e,t,n){return`[${e}${t-e==1?"":"-"}${t}]`}function c(e){return/^-?(0+)\d/.test(e)}function f(e,t,n){if(!t.isPadded)return e;let r=Math.abs(t.maxLen-String(e).length),o=!1!==n.relaxZeros;switch(r){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${r}}`:`0{${r}}`}}return t.cache={},t.clearCache=()=>t.cache={},P=t}
|
14
|
+
/*!
|
15
|
+
* fill-range <https://github.com/jonschlinkert/fill-range>
|
16
|
+
*
|
17
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
18
|
+
* Licensed under the MIT License.
|
19
|
+
*/function oe(){if(K)return G;K=1;const e=c,t=re(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),s=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},a=(e,t,n)=>{if(t>0){let n="-"===e[0]?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return!1===n?String(e):e},i=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},u=(e,n,r,o)=>{if(r)return t(e,n,{wrap:!1,...o});let s=String.fromCharCode(e);return e===n?s:`[${s}-${String.fromCharCode(n)}]`},p=(e,n,r)=>{if(Array.isArray(e)){let t=!0===r.wrap,n=r.capture?"":"?:";return t?`(${n}${e.join("|")})`:e.join("|")}return t(e,n,r)},l=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),f=(e,t,n)=>{if(!0===n.strictRanges)throw l([e,t]);return[]},g=(e,t,n=1,r={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===r.strictRanges)throw l([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,g=String(e),d=String(t),h=String(n);n=Math.max(Math.abs(n),1);let y=s(g)||s(d)||s(h),A=y?Math.max(g.length,d.length,h.length):0,R=!1===y&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),E=r.transform||(e=>t=>!0===e?Number(t):String(t))(R);if(r.toRegex&&1===n)return u(i(e,A),i(t,A),!0,r);let m={negatives:[],positives:[]},_=[],b=0;for(;f?o>=c:o<=c;)!0===r.toRegex&&n>1?m[(S=o)<0?"negatives":"positives"].push(Math.abs(S)):_.push(a(E(o,b),A,R)),o=f?o-n:o+n,b++;var S;return!0===r.toRegex?n>1?((e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let n,r=t.capture?"":"?:",o="",s="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.join("|")})`),n=o&&s?`${o}|${s}`:o||s,t.wrap?`(${r}${n})`:n})(m,r):p(_,null,{wrap:!1,...r}):_},d=(e,t,s,a={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return f(e,t,a);if("function"==typeof s)return d(e,t,1,{transform:s});if(n(s))return d(e,t,0,s);let i={...a};return!0===i.capture&&(i.wrap=!0),s=s||i.step||1,o(s)?o(e)&&o(t)?g(e,t,s,i):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return f(e,t,r);let s=r.transform||(e=>String.fromCharCode(e)),a=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),l=a>i,c=Math.min(a,i),g=Math.max(a,i);if(r.toRegex&&1===n)return u(c,g,!1,r);let d=[],h=0;for(;l?a>=i:a<=i;)d.push(s(a,h)),a=l?a-n:a+n,h++;return!0===r.toRegex?p(d,null,{wrap:!1,options:r}):d})(e,t,Math.max(Math.abs(s),1),i):null==s||n(s)?d(e,t,1,s):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(s,i)};return G=d}function se(){if(J)return Z;J=1;const e=te(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:a,CHAR_RIGHT_PARENTHESES:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:g,CHAR_NO_BREAK_SPACE:d,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h}=X?W:(X=1,W={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return Z=(y,A={})=>{if("string"!=typeof y)throw new TypeError("Expected a string");let R=A||{},E="number"==typeof R.maxLength?Math.min(t,R.maxLength):t;if(y.length>E)throw new SyntaxError(`Input length (${y.length}), exceeds max characters (${E})`);let m,_={type:"root",input:y,nodes:[]},b=[_],S=_,C=_,v=0,$=y.length,x=0,w=0;const H=()=>y[x++],k=e=>{if("text"===e.type&&"dot"===C.type&&(C.type="text"),!C||"text"!==C.type||"text"!==e.type)return S.nodes.push(e),e.parent=S,e.prev=C,C=e,e;C.value+=e.value};for(k({type:"bos"});x<$;)if(S=b[b.length-1],m=H(),m!==h&&m!==d)if(m!==n)if(m!==c)if(m!==l)if(m!==a)if(m!==i)if(m!==f&&m!==g&&m!==r)if(m!==u)if(m!==p)if(m===o&&w>0){if(S.ranges>0){S.ranges=0;let t=S.nodes.shift();S.nodes=[t,{type:"text",value:e(S)}]}k({type:"comma",value:m}),S.commas++}else if(m===s&&w>0&&0===S.commas){let e=S.nodes;if(0===w||0===e.length){k({type:"text",value:m});continue}if("dot"===C.type){if(S.range=[],C.value+=m,C.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,C.type="text";continue}S.ranges++,S.args=[];continue}if("range"===C.type){e.pop();let t=e[e.length-1];t.value+=C.value+m,C=t,S.ranges--;continue}k({type:"dot",value:m})}else k({type:"text",value:m});else{if("brace"!==S.type){k({type:"text",value:m});continue}let e="close";S=b.pop(),S.close=!0,k({type:e,value:m}),w--,S=b[b.length-1]}else{w++;let e=C.value&&"$"===C.value.slice(-1)||!0===S.dollar;S=k({type:"brace",open:!0,close:!1,dollar:e,depth:w,commas:0,ranges:0,nodes:[]}),b.push(S),k({type:"open",value:m})}else{let e,t=m;for(!0!==A.keepQuotes&&(m="");x<$&&(e=H());)if(e!==n){if(e===t){!0===A.keepQuotes&&(m+=e);break}m+=e}else m+=e+H();k({type:"text",value:m})}else{if("paren"!==S.type){k({type:"text",value:m});continue}S=b.pop(),k({type:"text",value:m}),S=b[b.length-1]}else S=k({type:"paren",nodes:[]}),b.push(S),k({type:"text",value:m});else{let e;for(v++;x<$&&(e=H());)if(m+=e,e!==l)if(e!==n){if(e===c&&(v--,0===v))break}else m+=H();else v++;k({type:"text",value:m})}else k({type:"text",value:"\\"+m});else k({type:"text",value:(A.keepEscaping?m:"")+H()});do{if(S=b.pop(),"root"!==S.type){S.nodes.forEach((e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));let e=b[b.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}}while(b.length>0);return k({type:"eos"}),_},Z}function ae(){if(V)return z;V=1;const e=te(),t=function(){if(F)return U;F=1;const e=oe(),t=ee();return U=(n,r={})=>{let o=(n,s={})=>{let a=t.isInvalidBrace(s),i=!0===n.invalid&&!0===r.escapeInvalid,u=!0===a||!0===i,p=!0===r.escapeInvalid?"\\":"",l="";if(!0===n.isOpen)return p+n.value;if(!0===n.isClose)return p+n.value;if("open"===n.type)return u?p+n.value:"(";if("close"===n.type)return u?p+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":u?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let o=t.reduce(n.nodes),s=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(n.nodes)for(let e of n.nodes)l+=o(e,n);return l};return o(n)}}(),n=function(){if(Q)return q;Q=1;const e=oe(),t=te(),n=ee(),r=(e="",t="",o=!1)=>{let s=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return o?n.flatten(t).map((e=>`{${e}}`)):t;for(let n of e)if(Array.isArray(n))for(let e of n)s.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),s.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(s)};return q=(o,s={})=>{let a=void 0===s.rangeLimit?1e3:s.rangeLimit,i=(o,u={})=>{o.queue=[];let p=u,l=u.queue;for(;"brace"!==p.type&&"root"!==p.type&&p.parent;)p=p.parent,l=p.queue;if(o.invalid||o.dollar)return void l.push(r(l.pop(),t(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void l.push(r(l.pop(),["{}"]));if(o.nodes&&o.ranges>0){let i=n.reduce(o.nodes);if(n.exceedsLimit(...i,s.step,a))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=e(...i,s);return 0===u.length&&(u=t(o,s)),l.push(r(l.pop(),u)),void(o.nodes=[])}let c=n.encloseBrace(o),f=o.queue,g=o;for(;"brace"!==g.type&&"root"!==g.type&&g.parent;)g=g.parent,f=g.queue;for(let e=0;e<o.nodes.length;e++){let t=o.nodes[e];"comma"!==t.type||"brace"!==o.type?"close"!==t.type?t.value&&"open"!==t.type?f.push(r(f.pop(),t.value)):t.nodes&&i(t,o):l.push(r(l.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(i(o))}}(),r=se(),o=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let e=o.create(r,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(o.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};return o.parse=(e,t={})=>r(e,t),o.stringify=(t,n={})=>e("string"==typeof t?o.parse(t,n):t,n),o.compile=(e,n={})=>("string"==typeof e&&(e=o.parse(e,n)),t(e,n)),o.expand=(e,t={})=>{"string"==typeof e&&(e=o.parse(e,t));let r=n(e,t);return!0===t.noempty&&(r=r.filter(Boolean)),!0===t.nodupes&&(r=[...new Set(r)]),r},o.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?o.compile(e,t):o.expand(e,t),z=o}var ie,ue,pe,le,ce,fe,ge,de,he,ye,Ae,Re,Ee,me={};function _e(){if(ue)return ie;ue=1;const e=f,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",s="[^/]",a=`(?:${o}|$)`,i=`(?:^|${o})`,u=`${r}{1,2}${a}`,p={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:s,END_ANCHOR:a,DOTS_SLASH:u,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${i}${u})`,NO_DOT_SLASH:`(?!${r}{0,1}${a})`,NO_DOTS_SLASH:`(?!${u})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${s}*?`,START_ANCHOR:i},l={...p,SLASH_LITERAL:`[${t}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${r}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${r})`,NO_DOTS:`(?!(?:^|[${t}])${r}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${r}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${r}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`};return ie={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:e.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?l:p}}function be(){return pe||(pe=1,function(e){const t=f,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:a}=_e();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>s.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(a,"\\$1"),e.toPosixSlashes=e=>e.replace(r,"/"),e.removeBackslashes=e=>e.replace(o,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===n||"\\"===t.sep,e.escapeLast=(t,n,r)=>{const o=t.lastIndexOf(n,r);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,n,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?"":"^"}(?:${e})${n.contains?"":"$"}`;return!0===t.negated&&(r=`(?:^(?!${r}).*$)`),r}}(me)),me}function Se(){if(he)return de;he=1;const e=f,t=function(){if(ce)return le;ce=1;const e=be(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:d,CHAR_RIGHT_SQUARE_BRACKET:h}=_e(),y=e=>e===i||e===r,A=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return le=(R,E)=>{const m=E||{},_=R.length-1,b=!0===m.parts||!0===m.scanToEnd,S=[],C=[],v=[];let $,x,w=R,H=-1,k=0,O=0,T=!1,L=!1,N=!1,I=!1,M=!1,j=!1,B=!1,P=!1,D=!1,G=!1,K=0,U={value:"",depth:0,isGlob:!1};const F=()=>H>=_,q=()=>($=x,w.charCodeAt(++H));for(;H<_;){let e;if(x=q(),x!==r){if(!0===j||x===u){for(K++;!0!==F()&&(x=q());)if(x!==r)if(x!==u){if(!0!==j&&x===s&&(x=q())===s){if(T=U.isBrace=!0,N=U.isGlob=!0,G=!0,!0===b)continue;break}if(!0!==j&&x===o){if(T=U.isBrace=!0,N=U.isGlob=!0,G=!0,!0===b)continue;break}if(x===g&&(K--,0===K)){j=!1,T=U.isBrace=!0,G=!0;break}}else K++;else B=U.backslashes=!0,q();if(!0===b)continue;break}if(x!==i){if(!0!==m.noext&&!0==(x===c||x===n||x===t||x===f||x===a)&&w.charCodeAt(H+1)===p){if(N=U.isGlob=!0,I=U.isExtglob=!0,G=!0,x===a&&H===k&&(D=!0),!0===b){for(;!0!==F()&&(x=q());)if(x!==r){if(x===d){N=U.isGlob=!0,G=!0;break}}else B=U.backslashes=!0,x=q();continue}break}if(x===t){if($===t&&(M=U.isGlobstar=!0),N=U.isGlob=!0,G=!0,!0===b)continue;break}if(x===f){if(N=U.isGlob=!0,G=!0,!0===b)continue;break}if(x===l){for(;!0!==F()&&(e=q());)if(e!==r){if(e===h){L=U.isBracket=!0,N=U.isGlob=!0,G=!0;break}}else B=U.backslashes=!0,q();if(!0===b)continue;break}if(!0===m.nonegate||x!==a||H!==k){if(!0!==m.noparen&&x===p){if(N=U.isGlob=!0,!0===b){for(;!0!==F()&&(x=q());)if(x!==p){if(x===d){G=!0;break}}else B=U.backslashes=!0,x=q();continue}break}if(!0===N){if(G=!0,!0===b)continue;break}}else P=U.negated=!0,k++}else{if(S.push(H),C.push(U),U={value:"",depth:0,isGlob:!1},!0===G)continue;if($===s&&H===k+1){k+=2;continue}O=H+1}}else B=U.backslashes=!0,x=q(),x===u&&(j=!0)}!0===m.noext&&(I=!1,N=!1);let Q=w,W="",X="";k>0&&(W=w.slice(0,k),w=w.slice(k),O-=k),Q&&!0===N&&O>0?(Q=w.slice(0,O),X=w.slice(O)):!0===N?(Q="",X=w):Q=w,Q&&""!==Q&&"/"!==Q&&Q!==w&&y(Q.charCodeAt(Q.length-1))&&(Q=Q.slice(0,-1)),!0===m.unescape&&(X&&(X=e.removeBackslashes(X)),Q&&!0===B&&(Q=e.removeBackslashes(Q)));const Z={prefix:W,input:R,start:k,base:Q,glob:X,isBrace:T,isBracket:L,isGlob:N,isExtglob:I,isGlobstar:M,negated:P,negatedExtglob:D};if(!0===m.tokens&&(Z.maxDepth=0,y(x)||C.push(U),Z.tokens=C),!0===m.parts||!0===m.tokens){let e;for(let t=0;t<S.length;t++){const n=e?e+1:k,r=S[t],o=R.slice(n,r);m.tokens&&(0===t&&0!==k?(C[t].isPrefix=!0,C[t].value=W):C[t].value=o,A(C[t]),Z.maxDepth+=C[t].depth),0===t&&""===o||v.push(o),e=r}if(e&&e+1<R.length){const t=R.slice(e+1);v.push(t),m.tokens&&(C[C.length-1].value=t,A(C[C.length-1]),Z.maxDepth+=C[C.length-1].depth)}Z.slashes=S,Z.parts=v}return Z}}(),n=function(){if(ge)return fe;ge=1;const e=_e(),t=be(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:a}=e,i=(e,n)=>{if("function"==typeof n.expandRange)return n.expandRange(...e,n);e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch(n){return e.map((e=>t.escapeRegex(e))).join("..")}return r},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,p=(l,c)=>{if("string"!=typeof l)throw new TypeError("Expected a string");l=a[l]||l;const f={...c},g="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;let d=l.length;if(d>g)throw new SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${g}`);const h={type:"bos",value:"",output:f.prepend||""},y=[h],A=f.capture?"":"?:",R=t.isWindows(c),E=e.globChars(R),m=e.extglobChars(E),{DOT_LITERAL:_,PLUS_LITERAL:b,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:v,NO_DOT:$,NO_DOT_SLASH:x,NO_DOTS_SLASH:w,QMARK:H,QMARK_NO_DOT:k,STAR:O,START_ANCHOR:T}=E,L=e=>`(${A}(?:(?!${T}${e.dot?v:_}).)*?)`,N=f.dot?"":$,I=f.dot?H:k;let M=!0===f.bash?L(f):O;f.capture&&(M=`(${M})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const j={input:l,index:-1,start:0,dot:!0===f.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};l=t.removePrefix(l,j),d=l.length;const B=[],P=[],D=[];let G,K=h;const U=()=>j.index===d-1,F=j.peek=(e=1)=>l[j.index+e],q=j.advance=()=>l[++j.index]||"",Q=()=>l.slice(j.index+1),W=(e="",t=0)=>{j.consumed+=e,j.index+=t},X=e=>{j.output+=null!=e.output?e.output:e.value,W(e.value)},Z=()=>{let e=1;for(;"!"===F()&&("("!==F(2)||"?"===F(3));)q(),j.start++,e++;return e%2!=0&&(j.negated=!0,j.start++,!0)},J=e=>{j[e]++,D.push(e)},z=e=>{j[e]--,D.pop()},V=e=>{if("globstar"===K.type){const t=j.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||B.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(j.output=j.output.slice(0,-K.output.length),K.type="star",K.value="*",K.output=M,j.output+=K.output)}if(B.length&&"paren"!==e.type&&(B[B.length-1].inner+=e.value),(e.value||e.output)&&X(e),K&&"text"===K.type&&"text"===e.type)return K.value+=e.value,void(K.output=(K.output||"")+e.value);e.prev=K,y.push(e),K=e},Y=(e,t)=>{const n={...m[t],conditions:1,inner:""};n.prev=K,n.parens=j.parens,n.output=j.output;const r=(f.capture?"(":"")+n.open;J("parens"),V({type:e,value:t,output:j.output?"":C}),V({type:"paren",extglob:!0,value:q(),output:r}),B.push(n)},ee=e=>{let t,n=e.close+(f.capture?")":"");if("negate"===e.type){let r=M;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(r=L(f)),(r!==M||U()||/^\)+$/.test(Q()))&&(n=e.close=`)$))${r}`),e.inner.includes("*")&&(t=Q())&&/^\.[^\\/.]+$/.test(t)){const o=p(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(j.negatedExtglob=!0)}V({type:"paren",extglob:!0,value:G,output:n}),z("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(l)){let e=!1,n=l.replace(s,((t,n,r,o,s,a)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(s?H.repeat(s.length):""):0===a?I+(s?H.repeat(s.length):""):H.repeat(r.length):"."===o?_.repeat(r.length):"*"===o?n?n+o+(s?M:""):M:n?t:`\\${t}`));return!0===e&&(n=!0===f.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),n===l&&!0===f.contains?(j.output=l,j):(j.output=t.wrapOutput(n,j,c),j)}for(;!U();){if(G=q(),"\0"===G)continue;if("\\"===G){const e=F();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){G+="\\",V({type:"text",value:G});continue}const t=/^\\+/.exec(Q());let n=0;if(t&&t[0].length>2&&(n=t[0].length,j.index+=n,n%2!=0&&(G+="\\")),!0===f.unescape?G=q():G+=q(),0===j.brackets){V({type:"text",value:G});continue}}if(j.brackets>0&&("]"!==G||"["===K.value||"[^"===K.value)){if(!1!==f.posix&&":"===G){const e=K.value.slice(1);if(e.includes("[")&&(K.posix=!0,e.includes(":"))){const e=K.value.lastIndexOf("["),t=K.value.slice(0,e),n=K.value.slice(e+2),o=r[n];if(o){K.value=t+o,j.backtrack=!0,q(),h.output||1!==y.indexOf(K)||(h.output=C);continue}}}("["===G&&":"!==F()||"-"===G&&"]"===F())&&(G=`\\${G}`),"]"!==G||"["!==K.value&&"[^"!==K.value||(G=`\\${G}`),!0===f.posix&&"!"===G&&"["===K.value&&(G="^"),K.value+=G,X({value:G});continue}if(1===j.quotes&&'"'!==G){G=t.escapeRegex(G),K.value+=G,X({value:G});continue}if('"'===G){j.quotes=1===j.quotes?0:1,!0===f.keepQuotes&&V({type:"text",value:G});continue}if("("===G){J("parens"),V({type:"paren",value:G});continue}if(")"===G){if(0===j.parens&&!0===f.strictBrackets)throw new SyntaxError(u("opening","("));const e=B[B.length-1];if(e&&j.parens===e.parens+1){ee(B.pop());continue}V({type:"paren",value:G,output:j.parens?")":"\\)"}),z("parens");continue}if("["===G){if(!0!==f.nobracket&&Q().includes("]"))J("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));G=`\\${G}`}V({type:"bracket",value:G});continue}if("]"===G){if(!0===f.nobracket||K&&"bracket"===K.type&&1===K.value.length){V({type:"text",value:G,output:`\\${G}`});continue}if(0===j.brackets){if(!0===f.strictBrackets)throw new SyntaxError(u("opening","["));V({type:"text",value:G,output:`\\${G}`});continue}z("brackets");const e=K.value.slice(1);if(!0===K.posix||"^"!==e[0]||e.includes("/")||(G=`/${G}`),K.value+=G,X({value:G}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(K.value);if(j.output=j.output.slice(0,-K.value.length),!0===f.literalBrackets){j.output+=n,K.value=n;continue}K.value=`(${A}${n}|${K.value})`,j.output+=K.value;continue}if("{"===G&&!0!==f.nobrace){J("braces");const e={type:"brace",value:G,output:"(",outputIndex:j.output.length,tokensIndex:j.tokens.length};P.push(e),V(e);continue}if("}"===G){const e=P[P.length-1];if(!0===f.nobrace||!e){V({type:"text",value:G,output:G});continue}let t=")";if(!0===e.dots){const e=y.slice(),n=[];for(let t=e.length-1;t>=0&&(y.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=i(n,f),j.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=j.output.slice(0,e.outputIndex),r=j.tokens.slice(e.tokensIndex);e.value=e.output="\\{",G=t="\\}",j.output=n;for(const e of r)j.output+=e.output||e.value}V({type:"brace",value:G,output:t}),z("braces"),P.pop();continue}if("|"===G){B.length>0&&B[B.length-1].conditions++,V({type:"text",value:G});continue}if(","===G){let e=G;const t=P[P.length-1];t&&"braces"===D[D.length-1]&&(t.comma=!0,e="|"),V({type:"comma",value:G,output:e});continue}if("/"===G){if("dot"===K.type&&j.index===j.start+1){j.start=j.index+1,j.consumed="",j.output="",y.pop(),K=h;continue}V({type:"slash",value:G,output:S});continue}if("."===G){if(j.braces>0&&"dot"===K.type){"."===K.value&&(K.output=_);const e=P[P.length-1];K.type="dots",K.output+=G,K.value+=G,e.dots=!0;continue}if(j.braces+j.parens===0&&"bos"!==K.type&&"slash"!==K.type){V({type:"text",value:G,output:_});continue}V({type:"dot",value:G,output:_});continue}if("?"===G){if((!K||"("!==K.value)&&!0!==f.noextglob&&"("===F()&&"?"!==F(2)){Y("qmark",G);continue}if(K&&"paren"===K.type){const e=F();let n=G;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===K.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(Q()))&&(n=`\\${G}`),V({type:"text",value:G,output:n});continue}if(!0!==f.dot&&("slash"===K.type||"bos"===K.type)){V({type:"qmark",value:G,output:k});continue}V({type:"qmark",value:G,output:H});continue}if("!"===G){if(!0!==f.noextglob&&"("===F()&&("?"!==F(2)||!/[!=<:]/.test(F(3)))){Y("negate",G);continue}if(!0!==f.nonegate&&0===j.index){Z();continue}}if("+"===G){if(!0!==f.noextglob&&"("===F()&&"?"!==F(2)){Y("plus",G);continue}if(K&&"("===K.value||!1===f.regex){V({type:"plus",value:G,output:b});continue}if(K&&("bracket"===K.type||"paren"===K.type||"brace"===K.type)||j.parens>0){V({type:"plus",value:G});continue}V({type:"plus",value:b});continue}if("@"===G){if(!0!==f.noextglob&&"("===F()&&"?"!==F(2)){V({type:"at",extglob:!0,value:G,output:""});continue}V({type:"text",value:G});continue}if("*"!==G){"$"!==G&&"^"!==G||(G=`\\${G}`);const e=o.exec(Q());e&&(G+=e[0],j.index+=e[0].length),V({type:"text",value:G});continue}if(K&&("globstar"===K.type||!0===K.star)){K.type="star",K.star=!0,K.value+=G,K.output=M,j.backtrack=!0,j.globstar=!0,W(G);continue}let e=Q();if(!0!==f.noextglob&&/^\([^?]/.test(e)){Y("star",G);continue}if("star"===K.type){if(!0===f.noglobstar){W(G);continue}const t=K.prev,n=t.prev,r="slash"===t.type||"bos"===t.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===f.bash&&(!r||e[0]&&"/"!==e[0])){V({type:"star",value:G,output:""});continue}const s=j.braces>0&&("comma"===t.type||"brace"===t.type),a=B.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!s&&!a){V({type:"star",value:G,output:""});continue}for(;"/**"===e.slice(0,3);){const t=l[j.index+4];if(t&&"/"!==t)break;e=e.slice(3),W("/**",3)}if("bos"===t.type&&U()){K.type="globstar",K.value+=G,K.output=L(f),j.output=K.output,j.globstar=!0,W(G);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&U()){j.output=j.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=L(f)+(f.strictSlashes?")":"|$)"),K.value+=G,j.globstar=!0,j.output+=t.output+K.output,W(G);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const n=void 0!==e[1]?"|$":"";j.output=j.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=`${L(f)}${S}|${S}${n})`,K.value+=G,j.output+=t.output+K.output,j.globstar=!0,W(G+q()),V({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){K.type="globstar",K.value+=G,K.output=`(?:^|${S}|${L(f)}${S})`,j.output=K.output,j.globstar=!0,W(G+q()),V({type:"slash",value:"/",output:""});continue}j.output=j.output.slice(0,-K.output.length),K.type="globstar",K.output=L(f),K.value+=G,j.output+=K.output,j.globstar=!0,W(G);continue}const n={type:"star",value:G,output:M};!0!==f.bash?!K||"bracket"!==K.type&&"paren"!==K.type||!0!==f.regex?(j.index!==j.start&&"slash"!==K.type&&"dot"!==K.type||("dot"===K.type?(j.output+=x,K.output+=x):!0===f.dot?(j.output+=w,K.output+=w):(j.output+=N,K.output+=N),"*"!==F()&&(j.output+=C,K.output+=C)),V(n)):(n.output=G,V(n)):(n.output=".*?","bos"!==K.type&&"slash"!==K.type||(n.output=N+n.output),V(n))}for(;j.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));j.output=t.escapeLast(j.output,"["),z("brackets")}for(;j.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing",")"));j.output=t.escapeLast(j.output,"("),z("parens")}for(;j.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","}"));j.output=t.escapeLast(j.output,"{"),z("braces")}if(!0===f.strictSlashes||"star"!==K.type&&"bracket"!==K.type||V({type:"maybe_slash",value:"",output:`${S}?`}),!0===j.backtrack){j.output="";for(const e of j.tokens)j.output+=null!=e.output?e.output:e.value,e.suffix&&(j.output+=e.suffix)}return j};return p.fastpaths=(r,o)=>{const s={...o},i="number"==typeof s.maxLength?Math.min(n,s.maxLength):n,u=r.length;if(u>i)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${i}`);r=a[r]||r;const p=t.isWindows(o),{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:g,NO_DOT:d,NO_DOTS:h,NO_DOTS_SLASH:y,STAR:A,START_ANCHOR:R}=e.globChars(p),E=s.dot?h:d,m=s.dot?y:d,_=s.capture?"":"?:";let b=!0===s.bash?".*?":A;s.capture&&(b=`(${b})`);const S=e=>!0===e.noglobstar?b:`(${_}(?:(?!${R}${e.dot?g:l}).)*?)`,C=e=>{switch(e){case"*":return`${E}${f}${b}`;case".*":return`${l}${f}${b}`;case"*.*":return`${E}${b}${l}${f}${b}`;case"*/*":return`${E}${b}${c}${f}${m}${b}`;case"**":return E+S(s);case"**/*":return`(?:${E}${S(s)}${c})?${m}${f}${b}`;case"**/*.*":return`(?:${E}${S(s)}${c})?${m}${b}${l}${f}${b}`;case"**/.*":return`(?:${E}${S(s)}${c})?${l}${f}${b}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=C(t[1]);if(!n)return;return n+l+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let $=C(v);return $&&!0!==s.strictSlashes&&($+=`${c}?`),$},fe=p}(),r=be(),o=_e(),s=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>s(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(a=e)&&"object"==typeof a&&!Array.isArray(a)&&e.tokens&&e.input;var a;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},u=r.isWindows(t),p=o?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=p.state;delete p.state;let c=()=>!1;if(i.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=s(i.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:a,output:f}=s.test(n,p,t,{glob:e,posix:u}),g={glob:e,state:l,regex:p,posix:u,input:n,output:f,match:a,isMatch:o};return"function"==typeof i.onResult&&i.onResult(g),!1===o?(g.isMatch=!1,!!r&&g):c(n)?("function"==typeof i.onIgnore&&i.onIgnore(g),g.isMatch=!1,!!r&&g):("function"==typeof i.onMatch&&i.onMatch(g),!r||g)};return n&&(f.state=l),f};return s.test=(e,t,n,{glob:o,posix:a}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const i=n||{},u=i.format||(a?r.toPosixSlashes:null);let p=e===o,l=p&&u?u(e):e;return!1===p&&(l=u?u(e):e,p=l===o),!1!==p&&!0!==i.capture||(p=!0===i.matchBase||!0===i.basename?s.matchBase(e,t,n,a):t.exec(l)),{isMatch:Boolean(p),match:p,output:l}},s.matchBase=(t,n,o,a=r.isWindows(o))=>(n instanceof RegExp?n:s.makeRe(n,o)).test(e.basename(t)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map((e=>s.parse(e,t))):n(e,{...t,fastpaths:!1}),s.scan=(e,n)=>t(e,n),s.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},a=o.contains?"":"^",i=o.contains?"":"$";let u=`${a}(?:${e.output})${i}`;e&&!0===e.negated&&(u=`^(?!${u}).*$`);const p=s.toRegex(u,t);return!0===r&&(p.state=e),p},s.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(a.output=n.fastpaths(e,t)),a.output||(a=n(e,t)),s.compileRe(a,t,r,o)},s.toRegex=(e,t)=>{try{const n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},s.constants=o,de=s}function Ce(){return Ae?ye:(Ae=1,ye=Se())}var ve=function(){if(Ee)return Re;Ee=1;const e=c,t=ae(),n=Ce(),r=be(),o=e=>""===e||"./"===e,s=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,s=new Set,a=new Set,i=0,u=e=>{a.add(e.output),r&&r.onResult&&r.onResult(e)};for(let a=0;a<t.length;a++){let p=n(String(t[a]),{...r,onResult:u},!0),l=p.state.negated||p.state.negatedExtglob;l&&i++;for(let t of e){let e=p(t,!0);(l?!e.isMatch:e.isMatch)&&(l?o.add(e.output):(o.delete(e.output),s.add(e.output)))}}let p=(i===t.length?[...a]:[...s]).filter((e=>!o.has(e)));if(r&&0===p.length){if(!0===r.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?t.map((e=>e.replace(/\\/g,""))):t}return p};return s.match=s,s.matcher=(e,t)=>n(e,t),s.any=s.isMatch=(e,t,r)=>n(t,r)(e),s.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],a=new Set(s(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)a.has(e)||r.add(e);return[...r]},s.contains=(t,n,r)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(n))return n.some((e=>s.contains(t,e,r)));if("string"==typeof n){if(o(t)||o(n))return!1;if(t.includes(n)||t.startsWith("./")&&t.slice(2).includes(n))return!0}return s.isMatch(t,n,{...r,contains:!0})},s.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=s(Object.keys(e),t,n),a={};for(let t of o)a[t]=e[t];return a},s.some=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(o.some((e=>t(e))))return!0}return!1},s.every=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(!o.every((e=>t(e))))return!1}return!0},s.all=(t,r,o)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);return[].concat(r).every((e=>n(e,o)(t)))},s.capture=(e,t,o)=>{let s=r.isWindows(o),a=n.makeRe(String(e),{...o,capture:!0}).exec(s?r.toPosixSlashes(t):t);if(a)return a.slice(1).map((e=>void 0===e?"":e))},s.makeRe=(...e)=>n.makeRe(...e),s.scan=(...e)=>n.scan(...e),s.parse=(e,r)=>{let o=[];for(let s of[].concat(e||[]))for(let e of t(String(s),r))o.push(n.parse(e,r));return o},s.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},s.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return s.braces(e,{...t,expand:!0})},Re=s}();const $e='{\n "name": "",\n "version": "0.0.1",\n "description": "",\n "license": "",\n "author": "",\n "files": ["dist"],\n "exports": {\n ".": "./src/index.ts"\n },\n "scripts": {\n },\n "homepage": "",\n "repository": "",\n "bugs": ""\n}'.trimStart(),xe="# $name\n\n## Installation\n\n```bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n```\n\n## Usage\n\n\n## License\n\n$license\n".trimStart();const we=new Map;function He(n,r){if(we.has(n))return we.get(n)[r];const o=t.resolve(n,"package.json"),s=JSON.parse(e.readFileSync(o,"utf-8"));return we.set(n,s),s[r]}r.program.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,n]=r.program.args,o=process.cwd(),{init:s={}}=L()??{},{wd:a}=b(),i=t.basename(a),{named:c,template:f,bug:g={},readme:d=xe,readmeTemplate:h}=s,y={template:"bug_report.yml",labels:["bug"],...g};let A=d;if(h){const n=t.resolve(a,h);A=e.readFileSync(n,"utf-8")}const R=function(n,r){let o=r??$e,s=!1;try{r&&JSON.parse(r)}catch(e){s=!0}if(s){const s=t.resolve(n,r);o=e.readFileSync(s,"utf-8")}return o}(a,f),{indent:E=" "}=u(R),m={tabSize:E.length,insertSpaces:!0},_=["license","author"];let S=R;for(const e of _)S=l.applyEdits(S,l.modify(S,[e],He(a,e),{formattingOptions:m}));let[C,v]=await async function(e,n,{wd:r,cwd:o,workspaceName:s}){const a=o.replace(`${r}/`,"");let i=t.basename(o);if("function"==typeof e)return e(n,{full:r,relative:o});let u,l,c=!1;if("object"==typeof e)if(o===r){const{rule:t}=await p.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(u=t,l=e[t])}else for(const[t,n]of Object.entries(e)){if(ve.isMatch(a,t)){u=t,l=n;break}if(ve.isMatch(`${a}/jiek_ignore_dont_use_same_file_name`,t)){c=!0,u=t,l=n;break}}if(l||(u="packages/*",l=`@${s}/$basename`),!l)throw new Error("no matched rule");if(!n&&c&&(i=await p.prompt({type:"input",name:"name",message:`the matched rule is \`${String(l)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof l)return l(n,{full:r,relative:o,basename:i});if("string"==typeof l){const e=n??i;return[l.replace(/\$basename/g,e),u?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(c,n,{wd:a,cwd:o,workspaceName:i});if(!v){const{dir:e}=await p.prompt({type:"input",name:"dir",message:"package directory",default:n});v=e}if(!C){const{name:e}=await p.prompt({type:"input",name:"name",message:"package name",default:n});C=e}S=l.applyEdits(S,l.modify(S,["name"],C,{formattingOptions:m}));let $=He(a,"repository");"string"==typeof $&&($={type:"git",url:$,directory:v}),S=l.applyEdits(S,l.modify(S,["repository"],$,{formattingOptions:m}));const x=`${$?.url}/blob/master/${v}/README.md`;S=l.applyEdits(S,l.modify(S,["homepage"],x,{formattingOptions:m}));let w=y.labels;"function"==typeof w&&(w=w({name:C,dir:v})),w.push(`scope:${C}`);const H=`${$?.url}/issues/new?template=${y.template}&labels=${w.join(",")}`;function k(e){if(!v)throw new Error("pkgDir is not defined");return t.resolve(v,e)}S=l.applyEdits(S,l.modify(S,["bugs"],H,{formattingOptions:m})),e.existsSync(v)||e.mkdirSync(v);const O=k("package.json");if(e.existsSync(O))throw new Error("package.json already exists");e.writeFileSync(O,S),console.log(S,"written to",O);const T=He(a,"license"),N=k("README.md");"function"==typeof A&&(A=A({dir:v,packageJson:JSON.parse(S)}));const I=A.replace(/\$name/g,C).replace(/\$license/g,T);e.writeFileSync(N,I)}));const ke=(e,t)=>new Set([...e].filter((e=>t.has(e))));function Oe({entrypoints:e,pkgIsModule:n,entries:r,config:o,dir:s,noFilter:a,withSource:i,withSuffix:u}){const{build:p={}}=o??{},{crossModuleConvertor:l=!0}=p,c=`./${f=((...e)=>t.resolve(s??process.cwd(),...e))(("object"==typeof p?.output?.dir?p.output.dir.js:p?.output?.dir)??"dist"),t.relative(s??process.cwd(),f)}`;var f;const[,g]=h.resolveEntrypoints(e);r&&Object.entries(g).forEach((([e])=>{r.some((t=>ve.isMatch(e,t,{matchBase:!0})))||delete g[e]}));const d=a?g:h.filterLeafs(g,{skipValue:[/(^|\/)\.jk-noentry/,...h.DEFAULT_SKIP_VALUES]}),y=l?{import:e=>!n&&0===ke(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!n||0!==ke(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{};return[d,h.entrypoints2Exports(d,{outdir:c,withSource:i,withSuffix:u,withConditional:{...y}})]}r.program.command("publish").aliases(["pub","p"]).option("-b, --bumper <bumper>","bump version","patch").option("-p, --preview","preview publish").action((async({preview:n,bumper:r,...o})=>{H();const{value:s={}}=await C()??{},a=Object.entries(s);if(0===a.length)throw new Error("no packages selected");const i=a.map((([e,t])=>{const{type:n,exports:r={}}=t,o="module"===n,s={...t},[a,i]=Oe({entrypoints:r,pkgIsModule:o,config:L(e),dir:e,noFilter:!0,withSource:!0,withSuffix:!0});return s.exports={...a,...i},[e,s]})),p=Object.entries(o).reduce(((e,[t,n])=>(n&&e.push(`--${t}`,n),e)),[]);for(const[o,s]of i){const a=e.readFileSync(t.join(o,"package.json"),"utf-8"),i=JSON.parse(a)??"0.0.0",c=d.bump(i.version,r),{indent:f=" "}=u(a),g={tabSize:f.length,insertSpaces:!0};let h=a;h=l.applyEdits(h,l.modify(h,["version"],c,{formattingOptions:g}));for(const[e,t]of Object.entries(s))if(JSON.stringify(t)!==JSON.stringify(i[e]))if("exports"!==e)h=l.applyEdits(h,l.modify(h,["publishConfig",e],t,{formattingOptions:g}));else{const e=t;for(const[t,n]of Object.entries(e))h=l.applyEdits(h,l.modify(h,["publishConfig","exports",t],n,{formattingOptions:g}));const n=e?.["."],r={};if(n){switch(typeof n){case"string":r["module"===s?.type?"module":"main"]=n;break;case"object":{const e=n;r.main=e.require??e.default,r.module=e.import??e.module??e.default;break}}for(const[e,t]of Object.entries(r))void 0!==t&&(h=l.applyEdits(h,l.modify(h,["publishConfig",e],t,{formattingOptions:g})))}}try{if(e.renameSync(t.join(o,"package.json"),t.join(o,"package.json.bak")),e.writeFileSync(t.join(o,"package.json"),h),console.log(h),n){console.warn("preview mode");continue}A.execSync(["pnpm","publish","--access","public","--no-git-checks",...p].join(" "),{cwd:o,stdio:"inherit"});const r=l.applyEdits(a,l.modify(a,["version"],c,{}));e.writeFileSync(t.join(o,"package.json.bak"),r)}finally{e.unlinkSync(t.join(o,"package.json")),e.renameSync(t.join(o,"package.json.bak"),t.join(o,"package.json"))}}w()})),r.program.parse(process.argv);
|
package/dist/cli.min.js
CHANGED
@@ -1 +1,19 @@
|
|
1
|
-
import e from"node:fs";import t,{resolve as n,relative as o}from"node:path";import{filterPackagesFromDir as r}from"@pnpm/filter-workspace-packages";import{program as s}from"commander";import{load as i}from"js-yaml";import{isWorkspaceDir as a,getWorkspaceDir as c}from"@jiek/utils/getWorkspaceDir";import{MultiBar as p,Presets as l}from"cli-progress";import{execaCommand as f}from"execa";import u from"detect-indent";import m from"inquirer";import{applyEdits as d,modify as g}from"jsonc-parser";import{isMatch as w}from"micromatch";import*as y from"node:child_process";import{bump as h}from"@jiek/utils/bumper";import{resolveEntrypoints as k,filterLeafs as b,DEFAULT_SKIP_VALUES as j,entrypoints2Exports as S}from"@jiek/pkger/entrypoints";let v,$;function E(){if(v)return v;const e=s.getOptionValue("root");return v=e?t.isAbsolute(e)?e:t.resolve(process.cwd(),e):void 0,v}let O=!1;function x(){if($)return{wd:$,notWorkspace:O};const e=E();if(void 0!==e){const t=a(e,F);return O=!t,$=e,{wd:$,notWorkspace:O}}try{$=c(F)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;$=e,O=!0}return{wd:$,notWorkspace:O}}let F="";try{require.resolve("@pnpm/filter-workspace-packages"),F="pnpm"}catch{}async function _(){let n=s.getOptionValue("filter");const o=E(),{wd:a,notWorkspace:c}=x();if(!c&&"pnpm"===F){const s=t.resolve(a,"pnpm-workspace.yaml"),c=e.readFileSync(s,"utf-8"),p=i(c);if(o===a&&!n)throw new Error("root path is workspace root, please provide a filter");if(o!==a&&!n){if(!e.existsSync(t.resolve(o,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const r=JSON.parse(e.readFileSync(t.resolve(o,"package.json"),"utf-8"));if(!r.name)throw new Error("root path is not workspace root, please provide a filter");n=r.name}const{selectedProjectsGraph:l}=await r(a,[{filter:n??"",followProdDepsOnly:!0}],{prefix:o,workspaceDir:a,patterns:p.packages});return{wd:a,root:o,value:Object.entries(l).reduce(((e,[t,n])=>(e[t]=n.package.manifest,e)),{})}}return{wd:a,root:o,value:{[a]:JSON.parse(e.readFileSync(t.resolve(a,"package.json"),"utf-8"))}}}""!==F&&s.option("-f, --filter <filter>","filter packages");var J=require("../package.json");let q,N;function I(){q()}function M(){new Promise((e=>q=e))}function R(e){try{return require.resolve(e),!0}catch(e){return!1}}s.version(J.version).description(J.description).option("--root <root>","root path").option("-c, --config-path <configPath>","config path");const P=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of P)if(R(e)){N=e;break}let T="jiek.config";function A(n){const{wd:o}=x();let r=s.getOptionValue("configPath");if(r){if(!e.existsSync(r))throw new Error(`config file not found: ${r}`);t.isAbsolute(r)||(r=t.resolve(o,r))}else r=function(n,o){const r=!!N;function s(r){const s=[t.resolve(process.cwd(),`${T}.${r}`),t.resolve(process.cwd(),`.${T}.${r}`),t.resolve(n,`${T}.${r}`),t.resolve(n,`.${T}.${r}`)];o&&s.unshift(t.resolve(o,`${T}.${r}`),t.resolve(o,`.${T}.${r}`));for(const t of s)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return T=s("js")??T,T=s("json")??T,T=s("yaml")??T,r&&(T=s("ts")??T),t.resolve(n,T)}(o,n);const a=t.extname(r);let c;switch(a){case".js":c=require(r);break;case".json":return require(r);case".yaml":return i(e.readFileSync(r,"utf-8"));case".ts":if(N){require(N),c=require(r);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":c={};break;default:throw new Error(`unsupported config file type: ${a}`)}if(!c)throw new Error("config file is empty");return c.default??c}s.command("build").option("-s, --silent","Don't display logs.").option("-e, --entries <ENTRIES>","Specify the entries of the package.json's 'exports' field.(support glob)").action((async({silent:n,entries:o})=>{M();const{build:r}=A();n=n??r?.silent??!1;const{wd:s,value:i={}}=await _()??{};if(0===Object.keys(i).length)throw new Error("no package found");const a=t.resolve(s,"node_modules");e.existsSync(a)||e.mkdirSync(a);const c=(...e)=>t.resolve(a,".jiek",...e);e.existsSync(c())||e.mkdirSync(c());const u=require.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup"),m=new p({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {status} | {input} | {message}"},l.shades_classic);let d=0;await Promise.all(Object.entries(i).map((async([t,r])=>{const i=r.name?.replace(/^@/g,"").replace(/\//g,"+"),a=c(`${i??"anonymous-"+d++}.rollup.config.js`);e.writeFileSync(a,(e=>`\nconst manifest = ${JSON.stringify(e,null,2)}\nmodule.exports = require('jiek/rollup').template(manifest)\n`.trimStart())(r));let p="";N&&(p=`node -r ${N} `);const l=f(`${p}${u} --silent -c ${a}`,{ipc:!0,cwd:t,env:{...process.env,JIEK_ROOT:s,JIEK_ENTRIES:o}}),g={};let w=10;l.on("message",(e=>{"debug"===e.type&&console.log(...Array.isArray(e.data)?e.data:[e.data])})),!n&&l.on("message",(e=>{if("init"===e.type){const{leafMap:t,targetsLength:n}=e.data,o=Array.from(t.entries()).flatMap((([e,t])=>t.map((([t,...n])=>({input:e,path:t,conditions:n})))));console.log(`Package '${r.name}' has ${n} targets to build`),o.forEach((({input:e})=>{w=Math.max(w,e.length)})),o.forEach((({input:e,path:t})=>{const n=`${e}:${t}`;g[n]||(g[n]=m.create(50,0,{input:e.padEnd(w),status:"waiting".padEnd(10)},{barsize:20,linewrap:!0}))}))}if("progress"===e.type){const{path:t,tags:n,input:o,event:r,message:s}=e.data,i=g[`${o}:${t}`];if(!i)return;i.update({start:0,resolve:20,end:50}[r??"start"]??0,{input:o.padEnd(w),status:r?.padEnd(10),message:`${n?.join(", ")}: ${s}`})}})),await new Promise(((e,t)=>{let n="";l.stderr?.on("data",(e=>{n+=e})),l.once("exit",(o=>0===o?e():t(new Error(`rollup build failed:\n${n}`))))}))}))).finally((()=>{m.stop()})),I()}));const C='{\n "name": "",\n "version": "0.0.1",\n "description": "",\n "license": "",\n "author": "",\n "files": ["dist"],\n "exports": {\n ".": "./src/index.ts"\n },\n "scripts": {\n },\n "homepage": "",\n "repository": "",\n "bugs": ""\n}'.trimStart(),D="# $name\n\n## Installation\n\n```bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n```\n\n## Usage\n\n\n## License\n\n$license\n".trimStart();const z=new Map;function W(n,o){if(z.has(n))return z.get(n)[o];const r=t.resolve(n,"package.json"),s=JSON.parse(e.readFileSync(r,"utf-8"));return z.set(n,s),s[o]}s.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,n]=s.args,o=process.cwd(),{init:r={}}=A()??{},{wd:i}=x(),a=t.basename(i),{named:c,template:p,bug:l={},readme:f=D,readmeTemplate:y}=r,h={template:"bug_report.yml",labels:["bug"],...l};let k=f;if(y){const n=t.resolve(i,y);k=e.readFileSync(n,"utf-8")}const b=function(n,o){let r=o??C,s=!1;try{o&&JSON.parse(o)}catch(e){s=!0}if(s){const s=t.resolve(n,o);r=e.readFileSync(s,"utf-8")}return r}(i,p),{indent:j=" "}=u(b),S={tabSize:j.length,insertSpaces:!0},v=["license","author"];let $=b;for(const e of v)$=d($,g($,[e],W(i,e),{formattingOptions:S}));let[E,O]=await async function(e,n,{wd:o,cwd:r,workspaceName:s}){const i=r.replace(`${o}/`,"");let a=t.basename(r);if("function"==typeof e)return e(n,{full:o,relative:r});let c,p,l=!1;if("object"==typeof e)if(r===o){const{rule:t}=await m.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(c=t,p=e[t])}else for(const[t,n]of Object.entries(e)){if(w(i,t)){c=t,p=n;break}if(w(`${i}/jiek_ignore_dont_use_same_file_name`,t)){l=!0,c=t,p=n;break}}if(p||(c="packages/*",p=`@${s}/$basename`),!p)throw new Error("no matched rule");if(!n&&l&&(a=await m.prompt({type:"input",name:"name",message:`the matched rule is \`${String(p)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof p)return p(n,{full:o,relative:r,basename:a});if("string"==typeof p){const e=n??a;return[p.replace(/\$basename/g,e),c?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(c,n,{wd:i,cwd:o,workspaceName:a});if(!O){const{dir:e}=await m.prompt({type:"input",name:"dir",message:"package directory",default:n});O=e}if(!E){const{name:e}=await m.prompt({type:"input",name:"name",message:"package name",default:n});E=e}$=d($,g($,["name"],E,{formattingOptions:S}));let F=W(i,"repository");"string"==typeof F&&(F={type:"git",url:F,directory:O}),$=d($,g($,["repository"],F,{formattingOptions:S}));$=d($,g($,["homepage"],`${F?.url}/blob/master/${O}/README.md`,{formattingOptions:S}));let _=h.labels;"function"==typeof _&&(_=_({name:E,dir:O})),_.push(`scope:${E}`);const J=`${F?.url}/issues/new?template=${h.template}&labels=${_.join(",")}`;function q(e){if(!O)throw new Error("pkgDir is not defined");return t.resolve(O,e)}$=d($,g($,["bugs"],J,{formattingOptions:S})),e.existsSync(O)||e.mkdirSync(O);const N=q("package.json");if(e.existsSync(N))throw new Error("package.json already exists");e.writeFileSync(N,$),console.log($,"written to",N);const I=W(i,"license"),M=q("README.md");"function"==typeof k&&(k=k({dir:O,packageJson:JSON.parse($)}));const R=k.replace(/\$name/g,E).replace(/\$license/g,I);e.writeFileSync(M,R)}));const K=(e,t)=>new Set([...e].filter((e=>t.has(e))));s.command("publish").aliases(["pub","p"]).option("-b, --bumper <bumper>","bump version","patch").option("-p, --preview","preview publish").action((async({preview:r,bumper:s,...i})=>{M();const{value:a={}}=await _()??{},c=Object.entries(a);if(0===c.length)throw new Error("no packages selected");const p=c.map((([e,t])=>{const{type:r,exports:s={}}=t,i="module"===r,a={...t},[c,p]=function({entrypoints:e,pkgIsModule:t,entries:r,config:s,dir:i,noFilter:a,withSource:c,withSuffix:p}){const{build:l={}}=s??{},{crossModuleConvertor:f=!0}=l,u=`./${(e=>o(i??process.cwd(),e))(((...e)=>n(i??process.cwd(),...e))(("object"==typeof l?.output?.dir?l.output.dir.js:l?.output?.dir)??"dist"))}`,[,m]=k(e);r&&Object.entries(m).forEach((([e])=>{r.some((t=>w(e,t,{matchBase:!0})))||delete m[e]}));const d=a?m:b(m,{skipValue:[/(^|\/)\.jk-noentry/,...j]});return[d,S(d,{outdir:u,withSource:c,withSuffix:p,withConditional:{...f?{import:e=>!t&&0===K(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==K(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{}}})]}({entrypoints:s,pkgIsModule:i,config:A(e),dir:e,noFilter:!0,withSource:!0,withSuffix:!0});return a.exports={...c,...p},[e,a]})),l=Object.entries(i).reduce(((e,[t,n])=>(n&&e.push(`--${t}`,n),e)),[]);for(const[n,o]of p){const i=e.readFileSync(t.join(n,"package.json"),"utf-8"),a=JSON.parse(i)??"0.0.0",c=h(a.version,s),{indent:p=" "}=u(i),f={tabSize:p.length,insertSpaces:!0};let m=i;m=d(m,g(m,["version"],c,{formattingOptions:f}));for(const[e,t]of Object.entries(o))if(JSON.stringify(t)!==JSON.stringify(a[e]))if("exports"!==e)m=d(m,g(m,["publishConfig",e],t,{formattingOptions:f}));else{const e=t;for(const[t,n]of Object.entries(e))m=d(m,g(m,["publishConfig","exports",t],n,{formattingOptions:f}));const n=e?.["."],r={};if(n){switch(typeof n){case"string":r["module"===o?.type?"module":"main"]=n;break;case"object":{const e=n;r.main=e.require??e.default,r.module=e.import??e.module??e.default;break}}for(const[e,t]of Object.entries(r))void 0!==t&&(m=d(m,g(m,["publishConfig",e],t,{formattingOptions:f})))}}try{if(e.renameSync(t.join(n,"package.json"),t.join(n,"package.json.bak")),e.writeFileSync(t.join(n,"package.json"),m),console.log(m),r){console.warn("preview mode");continue}y.execSync(["pnpm","publish","--access","public","--no-git-checks",...l].join(" "),{cwd:n,stdio:"inherit"});const o=d(i,g(i,["version"],c,{}));e.writeFileSync(t.join(n,"package.json.bak"),o)}finally{e.unlinkSync(t.join(n,"package.json")),e.renameSync(t.join(n,"package.json.bak"),t.join(n,"package.json"))}}I()})),s.parse(process.argv);
|
1
|
+
import e from"node:fs";import t,{resolve as n,relative as r}from"node:path";import{filterPackagesFromDir as o}from"@pnpm/filter-workspace-packages";import{program as s}from"commander";import{load as a}from"js-yaml";import{isWorkspaceDir as i,getWorkspaceDir as u}from"@jiek/utils/getWorkspaceDir";import{MultiBar as p,Presets as l}from"cli-progress";import{execaCommand as c}from"execa";import f from"detect-indent";import g from"inquirer";import{applyEdits as d,modify as h}from"jsonc-parser";import A from"util";import R from"path";import*as y from"node:child_process";import{bump as m}from"@jiek/utils/bumper";import{resolveEntrypoints as _,filterLeafs as E,DEFAULT_SKIP_VALUES as b,entrypoints2Exports as S}from"@jiek/pkger/entrypoints";let C,v;function $(){if(C)return C;const e=s.getOptionValue("root");return C=e?t.isAbsolute(e)?e:t.resolve(process.cwd(),e):void 0,C}let x=!1;function w(){if(v)return{wd:v,notWorkspace:x};const e=$();if(void 0!==e){const t=i(e,H);return x=!t,v=e,{wd:v,notWorkspace:x}}try{v=u(H)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;v=e,x=!0}return{wd:v,notWorkspace:x}}let H="";try{require.resolve("@pnpm/filter-workspace-packages"),H="pnpm"}catch{}async function k(){let n=s.getOptionValue("filter");const r=$(),{wd:i,notWorkspace:u}=w();if(!u&&"pnpm"===H){const s=t.resolve(i,"pnpm-workspace.yaml"),u=e.readFileSync(s,"utf-8"),p=a(u);if(r===i&&!n)throw new Error("root path is workspace root, please provide a filter");if(r!==i&&!n){if(!e.existsSync(t.resolve(r,"package.json")))throw new Error("root path is not workspace root, please provide a filter");const o=JSON.parse(e.readFileSync(t.resolve(r,"package.json"),"utf-8"));if(!o.name)throw new Error("root path is not workspace root, please provide a filter");n=o.name}const{selectedProjectsGraph:l}=await o(i,[{filter:n??"",followProdDepsOnly:!0}],{prefix:r,workspaceDir:i,patterns:p.packages});return{wd:i,root:r,value:Object.entries(l).reduce(((e,[t,n])=>(e[t]=n.package.manifest,e)),{})}}return{wd:i,root:r,value:{[i]:JSON.parse(e.readFileSync(t.resolve(i,"package.json"),"utf-8"))}}}""!==H&&s.option("-f, --filter <filter>","filter packages");var O=require("../package.json");let T,L;function N(){T()}function I(){new Promise((e=>T=e))}function M(e){try{return require.resolve(e),!0}catch(e){return!1}}s.version(O.version).description(O.description).option("--root <root>","root path").option("-c, --config-path <configPath>","config path");const j=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of j)if(M(e)){L=e;break}let B="jiek.config";function P(n){const{wd:r}=w();let o=s.getOptionValue("configPath");if(o){if(!e.existsSync(o))throw new Error(`config file not found: ${o}`);t.isAbsolute(o)||(o=t.resolve(r,o))}else o=function(n,r){const o=!!L;function s(o){const s=[t.resolve(process.cwd(),`${B}.${o}`),t.resolve(process.cwd(),`.${B}.${o}`),t.resolve(n,`${B}.${o}`),t.resolve(n,`.${B}.${o}`)];r&&s.unshift(t.resolve(r,`${B}.${o}`),t.resolve(r,`.${B}.${o}`));for(const t of s)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return B=s("js")??B,B=s("json")??B,B=s("yaml")??B,o&&(B=s("ts")??B),t.resolve(n,B)}(r,n);const i=t.extname(o);let u;switch(i){case".js":u=require(o);break;case".json":return require(o);case".yaml":return a(e.readFileSync(o,"utf-8"));case".ts":if(L){require(L),u=require(o);break}throw new Error("ts config file is not supported without ts register, please install esbuild-register or set JIEK_TS_REGISTER env for custom ts register");case".config":u={};break;default:throw new Error(`unsupported config file type: ${i}`)}if(!u)throw new Error("config file is empty");return u.default??u}s.command("build").option("-s, --silent","Don't display logs.").option("-e, --entries <ENTRIES>","Specify the entries of the package.json's 'exports' field.(support glob)").action((async({silent:n,entries:r})=>{I();const{build:o}=P();n=n??o?.silent??!1;const{wd:s,value:a={}}=await k()??{};if(0===Object.keys(a).length)throw new Error("no package found");const i=t.resolve(s,"node_modules");e.existsSync(i)||e.mkdirSync(i);const u=(...e)=>t.resolve(i,".jiek",...e);e.existsSync(u())||e.mkdirSync(u());const f=require.resolve("rollup").replace(/dist\/rollup.js$/,"dist/bin/rollup"),g=new p({clearOnComplete:!1,hideCursor:!0,format:"- {bar} | {status} | {input} | {message}"},l.shades_classic);let d=0;await Promise.all(Object.entries(a).map((async([t,o])=>{const a=o.name?.replace(/^@/g,"").replace(/\//g,"+"),i=u(`${a??"anonymous-"+d++}.rollup.config.js`);e.writeFileSync(i,(e=>`\nconst manifest = ${JSON.stringify(e,null,2)}\nmodule.exports = require('jiek/rollup').template(manifest)\n`.trimStart())(o));let p="";L&&(p=`node -r ${L} `);const l=c(`${p}${f} --silent -c ${i}`,{ipc:!0,cwd:t,env:{...process.env,JIEK_ROOT:s,JIEK_ENTRIES:r}}),h={};let A=10;l.on("message",(e=>{"debug"===e.type&&console.log(...Array.isArray(e.data)?e.data:[e.data])})),!n&&l.on("message",(e=>{if("init"===e.type){const{leafMap:t,targetsLength:n}=e.data,r=Array.from(t.entries()).flatMap((([e,t])=>t.map((([t,...n])=>({input:e,path:t,conditions:n})))));console.log(`Package '${o.name}' has ${n} targets to build`),r.forEach((({input:e})=>{A=Math.max(A,e.length)})),r.forEach((({input:e,path:t})=>{const n=`${e}:${t}`;h[n]||(h[n]=g.create(50,0,{input:e.padEnd(A),status:"waiting".padEnd(10)},{barsize:20,linewrap:!0}))}))}if("progress"===e.type){const{path:t,tags:n,input:r,event:o,message:s}=e.data,a=h[`${r}:${t}`];if(!a)return;a.update({start:0,resolve:20,end:50}[o??"start"]??0,{input:r.padEnd(A),status:o?.padEnd(10),message:`${n?.join(", ")}: ${s}`})}})),await new Promise(((e,t)=>{let n="";l.stderr?.on("data",(e=>{n+=e})),l.once("exit",(r=>0===r?e():t(new Error(`rollup build failed:\n${n}`))))}))}))).finally((()=>{g.stop()})),N()}));var G,D,K,U,F,Q,q,W,X,Z,J,z,Y,V,ee,te,ne,re,oe,se={};function ae(){return G||(G=1,(e=se).isInteger=e=>"number"==typeof e?Number.isInteger(e):"string"==typeof e&&""!==e.trim()&&Number.isInteger(Number(e)),e.find=(e,t)=>e.nodes.find((e=>e.type===t)),e.exceedsLimit=(t,n,r=1,o)=>!1!==o&&!(!e.isInteger(t)||!e.isInteger(n))&&(Number(n)-Number(t))/Number(r)>=o,e.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||"open"===r.type||"close"===r.type)&&!0!==r.escaped&&(r.value="\\"+r.value,r.escaped=!0)},e.encloseBrace=e=>!("brace"!==e.type||e.commas>>0+e.ranges||(e.invalid=!0,0)),e.isInvalidBrace=e=>!("brace"!==e.type||!0!==e.invalid&&!e.dollar&&(e.commas>>0+e.ranges&&!0===e.open&&!0===e.close||(e.invalid=!0,0))),e.isOpenOrClose=e=>"open"===e.type||"close"===e.type||!0===e.open||!0===e.close,e.reduce=e=>e.reduce(((e,t)=>("text"===t.type&&e.push(t.value),"range"===t.type&&(t.type="text"),e)),[]),e.flatten=(...e)=>{const t=[],n=e=>{for(let r=0;r<e.length;r++){let o=e[r];Array.isArray(o)?n(o):void 0!==o&&t.push(o)}return t};return n(e),t}),se;var e}function ie(){if(K)return D;K=1;const e=ae();return D=(t,n={})=>{let r=(t,o={})=>{let s=n.escapeInvalid&&e.isInvalidBrace(o),a=!0===t.invalid&&!0===n.escapeInvalid,i="";if(t.value)return(s||a)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)i+=r(e);return i};return r(t)}}
|
2
|
+
/*!
|
3
|
+
* is-number <https://github.com/jonschlinkert/is-number>
|
4
|
+
*
|
5
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
6
|
+
* Released under the MIT License.
|
7
|
+
*/function ue(){return F?U:(F=1,U=function(e){return"number"==typeof e?e-e==0:"string"==typeof e&&""!==e.trim()&&(Number.isFinite?Number.isFinite(+e):isFinite(+e))})}
|
8
|
+
/*!
|
9
|
+
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
10
|
+
*
|
11
|
+
* Copyright (c) 2015-present, Jon Schlinkert.
|
12
|
+
* Released under the MIT License.
|
13
|
+
*/function pe(){if(q)return Q;q=1;const e=ue(),t=(n,s,a)=>{if(!1===e(n))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===s||n===s)return String(n);if(!1===e(s))throw new TypeError("toRegexRange: expected the second argument to be a number.");let i={relaxZeros:!0,...a};"boolean"==typeof i.strictZeros&&(i.relaxZeros=!1===i.strictZeros);let u=n+":"+s+"="+String(i.relaxZeros)+String(i.shorthand)+String(i.capture)+String(i.wrap);if(t.cache.hasOwnProperty(u))return t.cache[u].result;let p=Math.min(n,s),l=Math.max(n,s);if(1===Math.abs(p-l)){let e=n+"|"+s;return i.capture?`(${e})`:!1===i.wrap?e:`(?:${e})`}let f=c(n)||c(s),g={min:n,max:s,a:p,b:l},d=[],h=[];if(f&&(g.isPadded=f,g.maxLen=String(g.max).length),p<0){h=r(l<0?Math.abs(l):1,Math.abs(p),g,i),p=g.a=0}return l>=0&&(d=r(p,l,g,i)),g.negatives=h,g.positives=d,g.result=function(e,t,n){let r=o(e,t,"-",!1)||[],s=o(t,e,"",!1)||[],a=o(e,t,"-?",!0)||[];return r.concat(a).concat(s).join("|")}(h,d),!0===i.capture?g.result=`(${g.result})`:!1!==i.wrap&&d.length+h.length>1&&(g.result=`(?:${g.result})`),t.cache[u]=g,g.result};function n(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=function(e,t){let n=[];for(let r=0;r<e.length;r++)n.push([e[r],t[r]]);return n}(e,t),o=r.length,s="",a=0;for(let e=0;e<o;e++){let[t,n]=r[e];t===n?s+=t:"0"!==t||"9"!==n?s+=l(t,n):a++}return a&&(s+=!0===n.shorthand?"\\d":"[0-9]"),{pattern:s,count:[a],digits:o}}function r(e,t,r,o){let a,l=function(e,t){let n=1,r=1,o=i(e,n),a=new Set([t]);for(;e<=o&&o<=t;)a.add(o),n+=1,o=i(e,n);for(o=u(t+1,r)-1;e<o&&o<=t;)a.add(o),r+=1,o=u(t+1,r)-1;return a=[...a],a.sort(s),a}(e,t),c=[],g=e;for(let e=0;e<l.length;e++){let t=l[e],s=n(String(g),String(t),o),i="";r.isPadded||!a||a.pattern!==s.pattern?(r.isPadded&&(i=f(t,r,o)),s.string=i+s.pattern+p(s.count),c.push(s),g=t+1,a=s):(a.count.length>1&&a.count.pop(),a.count.push(s.count[0]),a.string=a.pattern+p(a.count),g=t+1)}return c}function o(e,t,n,r,o){let s=[];for(let o of e){let{string:e}=o;r||a(t,"string",e)||s.push(n+e),r&&a(t,"string",e)&&s.push(n+e)}return s}function s(e,t){return e>t?1:t>e?-1:0}function a(e,t,n){return e.some((e=>e[t]===n))}function i(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function u(e,t){return e-e%Math.pow(10,t)}function p(e){let[t=0,n=""]=e;return n||t>1?`{${t+(n?","+n:"")}}`:""}function l(e,t,n){return`[${e}${t-e==1?"":"-"}${t}]`}function c(e){return/^-?(0+)\d/.test(e)}function f(e,t,n){if(!t.isPadded)return e;let r=Math.abs(t.maxLen-String(e).length),o=!1!==n.relaxZeros;switch(r){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${r}}`:`0{${r}}`}}return t.cache={},t.clearCache=()=>t.cache={},Q=t}
|
14
|
+
/*!
|
15
|
+
* fill-range <https://github.com/jonschlinkert/fill-range>
|
16
|
+
*
|
17
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
18
|
+
* Licensed under the MIT License.
|
19
|
+
*/function le(){if(X)return W;X=1;const e=A,t=pe(),n=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),s=e=>{let t=`${e}`,n=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++n];);return n>0},a=(e,t,n)=>{if(t>0){let n="-"===e[0]?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return!1===n?String(e):e},i=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},u=(e,n,r,o)=>{if(r)return t(e,n,{wrap:!1,...o});let s=String.fromCharCode(e);return e===n?s:`[${s}-${String.fromCharCode(n)}]`},p=(e,n,r)=>{if(Array.isArray(e)){let t=!0===r.wrap,n=r.capture?"":"?:";return t?`(${n}${e.join("|")})`:e.join("|")}return t(e,n,r)},l=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),c=(e,t,n)=>{if(!0===n.strictRanges)throw l([e,t]);return[]},f=(e,t,n=1,r={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===r.strictRanges)throw l([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,g=String(e),d=String(t),h=String(n);n=Math.max(Math.abs(n),1);let A=s(g)||s(d)||s(h),R=A?Math.max(g.length,d.length,h.length):0,y=!1===A&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),m=r.transform||(e=>t=>!0===e?Number(t):String(t))(y);if(r.toRegex&&1===n)return u(i(e,R),i(t,R),!0,r);let _={negatives:[],positives:[]},E=[],b=0;for(;f?o>=c:o<=c;)!0===r.toRegex&&n>1?_[(S=o)<0?"negatives":"positives"].push(Math.abs(S)):E.push(a(m(o,b),R,y)),o=f?o-n:o+n,b++;var S;return!0===r.toRegex?n>1?((e,t)=>{e.negatives.sort(((e,t)=>e<t?-1:e>t?1:0)),e.positives.sort(((e,t)=>e<t?-1:e>t?1:0));let n,r=t.capture?"":"?:",o="",s="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(s=`-(${r}${e.negatives.join("|")})`),n=o&&s?`${o}|${s}`:o||s,t.wrap?`(${r}${n})`:n})(_,r):p(E,null,{wrap:!1,...r}):E},g=(e,t,s,a={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,a);if("function"==typeof s)return g(e,t,1,{transform:s});if(n(s))return g(e,t,0,s);let i={...a};return!0===i.capture&&(i.wrap=!0),s=s||i.step||1,o(s)?o(e)&&o(t)?f(e,t,s,i):((e,t,n=1,r={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return c(e,t,r);let s=r.transform||(e=>String.fromCharCode(e)),a=`${e}`.charCodeAt(0),i=`${t}`.charCodeAt(0),l=a>i,f=Math.min(a,i),g=Math.max(a,i);if(r.toRegex&&1===n)return u(f,g,!1,r);let d=[],h=0;for(;l?a>=i:a<=i;)d.push(s(a,h)),a=l?a-n:a+n,h++;return!0===r.toRegex?p(d,null,{wrap:!1,options:r}):d})(e,t,Math.max(Math.abs(s),1),i):null==s||n(s)?g(e,t,1,s):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(s,i)};return W=g}function ce(){if(ne)return te;ne=1;const e=ie(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:a,CHAR_RIGHT_PARENTHESES:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_RIGHT_SQUARE_BRACKET:c,CHAR_DOUBLE_QUOTE:f,CHAR_SINGLE_QUOTE:g,CHAR_NO_BREAK_SPACE:d,CHAR_ZERO_WIDTH_NOBREAK_SPACE:h}=ee?V:(ee=1,V={MAX_LENGTH:65536,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:"\n",CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\ufeff"});return te=(A,R={})=>{if("string"!=typeof A)throw new TypeError("Expected a string");let y=R||{},m="number"==typeof y.maxLength?Math.min(t,y.maxLength):t;if(A.length>m)throw new SyntaxError(`Input length (${A.length}), exceeds max characters (${m})`);let _,E={type:"root",input:A,nodes:[]},b=[E],S=E,C=E,v=0,$=A.length,x=0,w=0;const H=()=>A[x++],k=e=>{if("text"===e.type&&"dot"===C.type&&(C.type="text"),!C||"text"!==C.type||"text"!==e.type)return S.nodes.push(e),e.parent=S,e.prev=C,C=e,e;C.value+=e.value};for(k({type:"bos"});x<$;)if(S=b[b.length-1],_=H(),_!==h&&_!==d)if(_!==n)if(_!==c)if(_!==l)if(_!==a)if(_!==i)if(_!==f&&_!==g&&_!==r)if(_!==u)if(_!==p)if(_===o&&w>0){if(S.ranges>0){S.ranges=0;let t=S.nodes.shift();S.nodes=[t,{type:"text",value:e(S)}]}k({type:"comma",value:_}),S.commas++}else if(_===s&&w>0&&0===S.commas){let e=S.nodes;if(0===w||0===e.length){k({type:"text",value:_});continue}if("dot"===C.type){if(S.range=[],C.value+=_,C.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,C.type="text";continue}S.ranges++,S.args=[];continue}if("range"===C.type){e.pop();let t=e[e.length-1];t.value+=C.value+_,C=t,S.ranges--;continue}k({type:"dot",value:_})}else k({type:"text",value:_});else{if("brace"!==S.type){k({type:"text",value:_});continue}let e="close";S=b.pop(),S.close=!0,k({type:e,value:_}),w--,S=b[b.length-1]}else{w++;let e=C.value&&"$"===C.value.slice(-1)||!0===S.dollar;S=k({type:"brace",open:!0,close:!1,dollar:e,depth:w,commas:0,ranges:0,nodes:[]}),b.push(S),k({type:"open",value:_})}else{let e,t=_;for(!0!==R.keepQuotes&&(_="");x<$&&(e=H());)if(e!==n){if(e===t){!0===R.keepQuotes&&(_+=e);break}_+=e}else _+=e+H();k({type:"text",value:_})}else{if("paren"!==S.type){k({type:"text",value:_});continue}S=b.pop(),k({type:"text",value:_}),S=b[b.length-1]}else S=k({type:"paren",nodes:[]}),b.push(S),k({type:"text",value:_});else{let e;for(v++;x<$&&(e=H());)if(_+=e,e!==l)if(e!==n){if(e===c&&(v--,0===v))break}else _+=H();else v++;k({type:"text",value:_})}else k({type:"text",value:"\\"+_});else k({type:"text",value:(R.keepEscaping?_:"")+H()});do{if(S=b.pop(),"root"!==S.type){S.nodes.forEach((e=>{e.nodes||("open"===e.type&&(e.isOpen=!0),"close"===e.type&&(e.isClose=!0),e.nodes||(e.type="text"),e.invalid=!0)}));let e=b[b.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}}while(b.length>0);return k({type:"eos"}),E},te}function fe(){if(oe)return re;oe=1;const e=ie(),t=function(){if(J)return Z;J=1;const e=le(),t=ae();return Z=(n,r={})=>{let o=(n,s={})=>{let a=t.isInvalidBrace(s),i=!0===n.invalid&&!0===r.escapeInvalid,u=!0===a||!0===i,p=!0===r.escapeInvalid?"\\":"",l="";if(!0===n.isOpen)return p+n.value;if(!0===n.isClose)return p+n.value;if("open"===n.type)return u?p+n.value:"(";if("close"===n.type)return u?p+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":u?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let o=t.reduce(n.nodes),s=e(...o,{...r,wrap:!1,toRegex:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(n.nodes)for(let e of n.nodes)l+=o(e,n);return l};return o(n)}}(),n=function(){if(Y)return z;Y=1;const e=le(),t=ie(),n=ae(),r=(e="",t="",o=!1)=>{let s=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return o?n.flatten(t).map((e=>`{${e}}`)):t;for(let n of e)if(Array.isArray(n))for(let e of n)s.push(r(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),s.push(Array.isArray(e)?r(n,e,o):n+e);return n.flatten(s)};return z=(o,s={})=>{let a=void 0===s.rangeLimit?1e3:s.rangeLimit,i=(o,u={})=>{o.queue=[];let p=u,l=u.queue;for(;"brace"!==p.type&&"root"!==p.type&&p.parent;)p=p.parent,l=p.queue;if(o.invalid||o.dollar)return void l.push(r(l.pop(),t(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void l.push(r(l.pop(),["{}"]));if(o.nodes&&o.ranges>0){let i=n.reduce(o.nodes);if(n.exceedsLimit(...i,s.step,a))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let u=e(...i,s);return 0===u.length&&(u=t(o,s)),l.push(r(l.pop(),u)),void(o.nodes=[])}let c=n.encloseBrace(o),f=o.queue,g=o;for(;"brace"!==g.type&&"root"!==g.type&&g.parent;)g=g.parent,f=g.queue;for(let e=0;e<o.nodes.length;e++){let t=o.nodes[e];"comma"!==t.type||"brace"!==o.type?"close"!==t.type?t.value&&"open"!==t.type?f.push(r(f.pop(),t.value)):t.nodes&&i(t,o):l.push(r(l.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(i(o))}}(),r=ce(),o=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let e=o.create(r,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(o.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(n=[...new Set(n)]),n};return o.parse=(e,t={})=>r(e,t),o.stringify=(t,n={})=>e("string"==typeof t?o.parse(t,n):t,n),o.compile=(e,n={})=>("string"==typeof e&&(e=o.parse(e,n)),t(e,n)),o.expand=(e,t={})=>{"string"==typeof e&&(e=o.parse(e,t));let r=n(e,t);return!0===t.noempty&&(r=r.filter(Boolean)),!0===t.nodupes&&(r=[...new Set(r)]),r},o.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?o.compile(e,t):o.expand(e,t),re=o}var ge,de,he,Ae,Re,ye,me,_e,Ee,be,Se,Ce,ve,$e={};function xe(){if(de)return ge;de=1;const e=R,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",s="[^/]",a=`(?:${o}|$)`,i=`(?:^|${o})`,u=`${r}{1,2}${a}`,p={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:s,END_ANCHOR:a,DOTS_SLASH:u,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${i}${u})`,NO_DOT_SLASH:`(?!${r}{0,1}${a})`,NO_DOTS_SLASH:`(?!${u})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${s}*?`,START_ANCHOR:i},l={...p,SLASH_LITERAL:`[${t}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${r}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${r})`,NO_DOTS:`(?!(?:^|[${t}])${r}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${r}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${r}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`};return ge={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:e.sep,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?l:p}}function we(){return he||(he=1,function(e){const t=R,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:a}=xe();e.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),e.hasRegexChars=e=>s.test(e),e.isRegexChar=t=>1===t.length&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(a,"\\$1"),e.toPosixSlashes=e=>e.replace(r,"/"),e.removeBackslashes=e=>e.replace(o,(e=>"\\"===e?"":e)),e.supportsLookbehinds=()=>{const e=process.version.slice(1).split(".").map(Number);return 3===e.length&&e[0]>=9||8===e[0]&&e[1]>=10},e.isWindows=e=>e&&"boolean"==typeof e.windows?e.windows:!0===n||"\\"===t.sep,e.escapeLast=(t,n,r)=>{const o=t.lastIndexOf(n,r);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,n,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith("./")&&(n=n.slice(2),t.prefix="./"),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?"":"^"}(?:${e})${n.contains?"":"$"}`;return!0===t.negated&&(r=`(?:^(?!${r}).*$)`),r}}($e)),$e}function He(){if(Ee)return _e;Ee=1;const e=R,t=function(){if(Re)return Ae;Re=1;const e=we(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:i,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:p,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:c,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:d,CHAR_RIGHT_SQUARE_BRACKET:h}=xe(),A=e=>e===i||e===r,R=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return Ae=(y,m)=>{const _=m||{},E=y.length-1,b=!0===_.parts||!0===_.scanToEnd,S=[],C=[],v=[];let $,x,w=y,H=-1,k=0,O=0,T=!1,L=!1,N=!1,I=!1,M=!1,j=!1,B=!1,P=!1,G=!1,D=!1,K=0,U={value:"",depth:0,isGlob:!1};const F=()=>H>=E,Q=()=>($=x,w.charCodeAt(++H));for(;H<E;){let e;if(x=Q(),x!==r){if(!0===j||x===u){for(K++;!0!==F()&&(x=Q());)if(x!==r)if(x!==u){if(!0!==j&&x===s&&(x=Q())===s){if(T=U.isBrace=!0,N=U.isGlob=!0,D=!0,!0===b)continue;break}if(!0!==j&&x===o){if(T=U.isBrace=!0,N=U.isGlob=!0,D=!0,!0===b)continue;break}if(x===g&&(K--,0===K)){j=!1,T=U.isBrace=!0,D=!0;break}}else K++;else B=U.backslashes=!0,Q();if(!0===b)continue;break}if(x!==i){if(!0!==_.noext&&!0==(x===c||x===n||x===t||x===f||x===a)&&w.charCodeAt(H+1)===p){if(N=U.isGlob=!0,I=U.isExtglob=!0,D=!0,x===a&&H===k&&(G=!0),!0===b){for(;!0!==F()&&(x=Q());)if(x!==r){if(x===d){N=U.isGlob=!0,D=!0;break}}else B=U.backslashes=!0,x=Q();continue}break}if(x===t){if($===t&&(M=U.isGlobstar=!0),N=U.isGlob=!0,D=!0,!0===b)continue;break}if(x===f){if(N=U.isGlob=!0,D=!0,!0===b)continue;break}if(x===l){for(;!0!==F()&&(e=Q());)if(e!==r){if(e===h){L=U.isBracket=!0,N=U.isGlob=!0,D=!0;break}}else B=U.backslashes=!0,Q();if(!0===b)continue;break}if(!0===_.nonegate||x!==a||H!==k){if(!0!==_.noparen&&x===p){if(N=U.isGlob=!0,!0===b){for(;!0!==F()&&(x=Q());)if(x!==p){if(x===d){D=!0;break}}else B=U.backslashes=!0,x=Q();continue}break}if(!0===N){if(D=!0,!0===b)continue;break}}else P=U.negated=!0,k++}else{if(S.push(H),C.push(U),U={value:"",depth:0,isGlob:!1},!0===D)continue;if($===s&&H===k+1){k+=2;continue}O=H+1}}else B=U.backslashes=!0,x=Q(),x===u&&(j=!0)}!0===_.noext&&(I=!1,N=!1);let q=w,W="",X="";k>0&&(W=w.slice(0,k),w=w.slice(k),O-=k),q&&!0===N&&O>0?(q=w.slice(0,O),X=w.slice(O)):!0===N?(q="",X=w):q=w,q&&""!==q&&"/"!==q&&q!==w&&A(q.charCodeAt(q.length-1))&&(q=q.slice(0,-1)),!0===_.unescape&&(X&&(X=e.removeBackslashes(X)),q&&!0===B&&(q=e.removeBackslashes(q)));const Z={prefix:W,input:y,start:k,base:q,glob:X,isBrace:T,isBracket:L,isGlob:N,isExtglob:I,isGlobstar:M,negated:P,negatedExtglob:G};if(!0===_.tokens&&(Z.maxDepth=0,A(x)||C.push(U),Z.tokens=C),!0===_.parts||!0===_.tokens){let e;for(let t=0;t<S.length;t++){const n=e?e+1:k,r=S[t],o=y.slice(n,r);_.tokens&&(0===t&&0!==k?(C[t].isPrefix=!0,C[t].value=W):C[t].value=o,R(C[t]),Z.maxDepth+=C[t].depth),0===t&&""===o||v.push(o),e=r}if(e&&e+1<y.length){const t=y.slice(e+1);v.push(t),_.tokens&&(C[C.length-1].value=t,R(C[C.length-1]),Z.maxDepth+=C[C.length-1].depth)}Z.slashes=S,Z.parts=v}return Z}}(),n=function(){if(me)return ye;me=1;const e=xe(),t=we(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:a}=e,i=(e,n)=>{if("function"==typeof n.expandRange)return n.expandRange(...e,n);e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch(n){return e.map((e=>t.escapeRegex(e))).join("..")}return r},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,p=(l,c)=>{if("string"!=typeof l)throw new TypeError("Expected a string");l=a[l]||l;const f={...c},g="number"==typeof f.maxLength?Math.min(n,f.maxLength):n;let d=l.length;if(d>g)throw new SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${g}`);const h={type:"bos",value:"",output:f.prepend||""},A=[h],R=f.capture?"":"?:",y=t.isWindows(c),m=e.globChars(y),_=e.extglobChars(m),{DOT_LITERAL:E,PLUS_LITERAL:b,SLASH_LITERAL:S,ONE_CHAR:C,DOTS_SLASH:v,NO_DOT:$,NO_DOT_SLASH:x,NO_DOTS_SLASH:w,QMARK:H,QMARK_NO_DOT:k,STAR:O,START_ANCHOR:T}=m,L=e=>`(${R}(?:(?!${T}${e.dot?v:E}).)*?)`,N=f.dot?"":$,I=f.dot?H:k;let M=!0===f.bash?L(f):O;f.capture&&(M=`(${M})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const j={input:l,index:-1,start:0,dot:!0===f.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:A};l=t.removePrefix(l,j),d=l.length;const B=[],P=[],G=[];let D,K=h;const U=()=>j.index===d-1,F=j.peek=(e=1)=>l[j.index+e],Q=j.advance=()=>l[++j.index]||"",q=()=>l.slice(j.index+1),W=(e="",t=0)=>{j.consumed+=e,j.index+=t},X=e=>{j.output+=null!=e.output?e.output:e.value,W(e.value)},Z=()=>{let e=1;for(;"!"===F()&&("("!==F(2)||"?"===F(3));)Q(),j.start++,e++;return e%2!=0&&(j.negated=!0,j.start++,!0)},J=e=>{j[e]++,G.push(e)},z=e=>{j[e]--,G.pop()},Y=e=>{if("globstar"===K.type){const t=j.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||B.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(j.output=j.output.slice(0,-K.output.length),K.type="star",K.value="*",K.output=M,j.output+=K.output)}if(B.length&&"paren"!==e.type&&(B[B.length-1].inner+=e.value),(e.value||e.output)&&X(e),K&&"text"===K.type&&"text"===e.type)return K.value+=e.value,void(K.output=(K.output||"")+e.value);e.prev=K,A.push(e),K=e},V=(e,t)=>{const n={..._[t],conditions:1,inner:""};n.prev=K,n.parens=j.parens,n.output=j.output;const r=(f.capture?"(":"")+n.open;J("parens"),Y({type:e,value:t,output:j.output?"":C}),Y({type:"paren",extglob:!0,value:Q(),output:r}),B.push(n)},ee=e=>{let t,n=e.close+(f.capture?")":"");if("negate"===e.type){let r=M;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(r=L(f)),(r!==M||U()||/^\)+$/.test(q()))&&(n=e.close=`)$))${r}`),e.inner.includes("*")&&(t=q())&&/^\.[^\\/.]+$/.test(t)){const o=p(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(j.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:D,output:n}),z("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(l)){let e=!1,n=l.replace(s,((t,n,r,o,s,a)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(s?H.repeat(s.length):""):0===a?I+(s?H.repeat(s.length):""):H.repeat(r.length):"."===o?E.repeat(r.length):"*"===o?n?n+o+(s?M:""):M:n?t:`\\${t}`));return!0===e&&(n=!0===f.unescape?n.replace(/\\/g,""):n.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),n===l&&!0===f.contains?(j.output=l,j):(j.output=t.wrapOutput(n,j,c),j)}for(;!U();){if(D=Q(),"\0"===D)continue;if("\\"===D){const e=F();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){D+="\\",Y({type:"text",value:D});continue}const t=/^\\+/.exec(q());let n=0;if(t&&t[0].length>2&&(n=t[0].length,j.index+=n,n%2!=0&&(D+="\\")),!0===f.unescape?D=Q():D+=Q(),0===j.brackets){Y({type:"text",value:D});continue}}if(j.brackets>0&&("]"!==D||"["===K.value||"[^"===K.value)){if(!1!==f.posix&&":"===D){const e=K.value.slice(1);if(e.includes("[")&&(K.posix=!0,e.includes(":"))){const e=K.value.lastIndexOf("["),t=K.value.slice(0,e),n=K.value.slice(e+2),o=r[n];if(o){K.value=t+o,j.backtrack=!0,Q(),h.output||1!==A.indexOf(K)||(h.output=C);continue}}}("["===D&&":"!==F()||"-"===D&&"]"===F())&&(D=`\\${D}`),"]"!==D||"["!==K.value&&"[^"!==K.value||(D=`\\${D}`),!0===f.posix&&"!"===D&&"["===K.value&&(D="^"),K.value+=D,X({value:D});continue}if(1===j.quotes&&'"'!==D){D=t.escapeRegex(D),K.value+=D,X({value:D});continue}if('"'===D){j.quotes=1===j.quotes?0:1,!0===f.keepQuotes&&Y({type:"text",value:D});continue}if("("===D){J("parens"),Y({type:"paren",value:D});continue}if(")"===D){if(0===j.parens&&!0===f.strictBrackets)throw new SyntaxError(u("opening","("));const e=B[B.length-1];if(e&&j.parens===e.parens+1){ee(B.pop());continue}Y({type:"paren",value:D,output:j.parens?")":"\\)"}),z("parens");continue}if("["===D){if(!0!==f.nobracket&&q().includes("]"))J("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));D=`\\${D}`}Y({type:"bracket",value:D});continue}if("]"===D){if(!0===f.nobracket||K&&"bracket"===K.type&&1===K.value.length){Y({type:"text",value:D,output:`\\${D}`});continue}if(0===j.brackets){if(!0===f.strictBrackets)throw new SyntaxError(u("opening","["));Y({type:"text",value:D,output:`\\${D}`});continue}z("brackets");const e=K.value.slice(1);if(!0===K.posix||"^"!==e[0]||e.includes("/")||(D=`/${D}`),K.value+=D,X({value:D}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(K.value);if(j.output=j.output.slice(0,-K.value.length),!0===f.literalBrackets){j.output+=n,K.value=n;continue}K.value=`(${R}${n}|${K.value})`,j.output+=K.value;continue}if("{"===D&&!0!==f.nobrace){J("braces");const e={type:"brace",value:D,output:"(",outputIndex:j.output.length,tokensIndex:j.tokens.length};P.push(e),Y(e);continue}if("}"===D){const e=P[P.length-1];if(!0===f.nobrace||!e){Y({type:"text",value:D,output:D});continue}let t=")";if(!0===e.dots){const e=A.slice(),n=[];for(let t=e.length-1;t>=0&&(A.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=i(n,f),j.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=j.output.slice(0,e.outputIndex),r=j.tokens.slice(e.tokensIndex);e.value=e.output="\\{",D=t="\\}",j.output=n;for(const e of r)j.output+=e.output||e.value}Y({type:"brace",value:D,output:t}),z("braces"),P.pop();continue}if("|"===D){B.length>0&&B[B.length-1].conditions++,Y({type:"text",value:D});continue}if(","===D){let e=D;const t=P[P.length-1];t&&"braces"===G[G.length-1]&&(t.comma=!0,e="|"),Y({type:"comma",value:D,output:e});continue}if("/"===D){if("dot"===K.type&&j.index===j.start+1){j.start=j.index+1,j.consumed="",j.output="",A.pop(),K=h;continue}Y({type:"slash",value:D,output:S});continue}if("."===D){if(j.braces>0&&"dot"===K.type){"."===K.value&&(K.output=E);const e=P[P.length-1];K.type="dots",K.output+=D,K.value+=D,e.dots=!0;continue}if(j.braces+j.parens===0&&"bos"!==K.type&&"slash"!==K.type){Y({type:"text",value:D,output:E});continue}Y({type:"dot",value:D,output:E});continue}if("?"===D){if((!K||"("!==K.value)&&!0!==f.noextglob&&"("===F()&&"?"!==F(2)){V("qmark",D);continue}if(K&&"paren"===K.type){const e=F();let n=D;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===K.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(q()))&&(n=`\\${D}`),Y({type:"text",value:D,output:n});continue}if(!0!==f.dot&&("slash"===K.type||"bos"===K.type)){Y({type:"qmark",value:D,output:k});continue}Y({type:"qmark",value:D,output:H});continue}if("!"===D){if(!0!==f.noextglob&&"("===F()&&("?"!==F(2)||!/[!=<:]/.test(F(3)))){V("negate",D);continue}if(!0!==f.nonegate&&0===j.index){Z();continue}}if("+"===D){if(!0!==f.noextglob&&"("===F()&&"?"!==F(2)){V("plus",D);continue}if(K&&"("===K.value||!1===f.regex){Y({type:"plus",value:D,output:b});continue}if(K&&("bracket"===K.type||"paren"===K.type||"brace"===K.type)||j.parens>0){Y({type:"plus",value:D});continue}Y({type:"plus",value:b});continue}if("@"===D){if(!0!==f.noextglob&&"("===F()&&"?"!==F(2)){Y({type:"at",extglob:!0,value:D,output:""});continue}Y({type:"text",value:D});continue}if("*"!==D){"$"!==D&&"^"!==D||(D=`\\${D}`);const e=o.exec(q());e&&(D+=e[0],j.index+=e[0].length),Y({type:"text",value:D});continue}if(K&&("globstar"===K.type||!0===K.star)){K.type="star",K.star=!0,K.value+=D,K.output=M,j.backtrack=!0,j.globstar=!0,W(D);continue}let e=q();if(!0!==f.noextglob&&/^\([^?]/.test(e)){V("star",D);continue}if("star"===K.type){if(!0===f.noglobstar){W(D);continue}const t=K.prev,n=t.prev,r="slash"===t.type||"bos"===t.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===f.bash&&(!r||e[0]&&"/"!==e[0])){Y({type:"star",value:D,output:""});continue}const s=j.braces>0&&("comma"===t.type||"brace"===t.type),a=B.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!s&&!a){Y({type:"star",value:D,output:""});continue}for(;"/**"===e.slice(0,3);){const t=l[j.index+4];if(t&&"/"!==t)break;e=e.slice(3),W("/**",3)}if("bos"===t.type&&U()){K.type="globstar",K.value+=D,K.output=L(f),j.output=K.output,j.globstar=!0,W(D);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&U()){j.output=j.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=L(f)+(f.strictSlashes?")":"|$)"),K.value+=D,j.globstar=!0,j.output+=t.output+K.output,W(D);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const n=void 0!==e[1]?"|$":"";j.output=j.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=`${L(f)}${S}|${S}${n})`,K.value+=D,j.output+=t.output+K.output,j.globstar=!0,W(D+Q()),Y({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){K.type="globstar",K.value+=D,K.output=`(?:^|${S}|${L(f)}${S})`,j.output=K.output,j.globstar=!0,W(D+Q()),Y({type:"slash",value:"/",output:""});continue}j.output=j.output.slice(0,-K.output.length),K.type="globstar",K.output=L(f),K.value+=D,j.output+=K.output,j.globstar=!0,W(D);continue}const n={type:"star",value:D,output:M};!0!==f.bash?!K||"bracket"!==K.type&&"paren"!==K.type||!0!==f.regex?(j.index!==j.start&&"slash"!==K.type&&"dot"!==K.type||("dot"===K.type?(j.output+=x,K.output+=x):!0===f.dot?(j.output+=w,K.output+=w):(j.output+=N,K.output+=N),"*"!==F()&&(j.output+=C,K.output+=C)),Y(n)):(n.output=D,Y(n)):(n.output=".*?","bos"!==K.type&&"slash"!==K.type||(n.output=N+n.output),Y(n))}for(;j.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","]"));j.output=t.escapeLast(j.output,"["),z("brackets")}for(;j.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing",")"));j.output=t.escapeLast(j.output,"("),z("parens")}for(;j.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(u("closing","}"));j.output=t.escapeLast(j.output,"{"),z("braces")}if(!0===f.strictSlashes||"star"!==K.type&&"bracket"!==K.type||Y({type:"maybe_slash",value:"",output:`${S}?`}),!0===j.backtrack){j.output="";for(const e of j.tokens)j.output+=null!=e.output?e.output:e.value,e.suffix&&(j.output+=e.suffix)}return j};return p.fastpaths=(r,o)=>{const s={...o},i="number"==typeof s.maxLength?Math.min(n,s.maxLength):n,u=r.length;if(u>i)throw new SyntaxError(`Input length: ${u}, exceeds maximum allowed length: ${i}`);r=a[r]||r;const p=t.isWindows(o),{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:g,NO_DOT:d,NO_DOTS:h,NO_DOTS_SLASH:A,STAR:R,START_ANCHOR:y}=e.globChars(p),m=s.dot?h:d,_=s.dot?A:d,E=s.capture?"":"?:";let b=!0===s.bash?".*?":R;s.capture&&(b=`(${b})`);const S=e=>!0===e.noglobstar?b:`(${E}(?:(?!${y}${e.dot?g:l}).)*?)`,C=e=>{switch(e){case"*":return`${m}${f}${b}`;case".*":return`${l}${f}${b}`;case"*.*":return`${m}${b}${l}${f}${b}`;case"*/*":return`${m}${b}${c}${f}${_}${b}`;case"**":return m+S(s);case"**/*":return`(?:${m}${S(s)}${c})?${_}${f}${b}`;case"**/*.*":return`(?:${m}${S(s)}${c})?${_}${b}${l}${f}${b}`;case"**/.*":return`(?:${m}${S(s)}${c})?${l}${f}${b}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=C(t[1]);if(!n)return;return n+l+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let $=C(v);return $&&!0!==s.strictSlashes&&($+=`${c}?`),$},ye=p}(),r=we(),o=xe(),s=(e,t,n=!1)=>{if(Array.isArray(e)){const r=e.map((e=>s(e,t,n))),o=e=>{for(const t of r){const n=t(e);if(n)return n}return!1};return o}const o=(a=e)&&"object"==typeof a&&!Array.isArray(a)&&e.tokens&&e.input;var a;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},u=r.isWindows(t),p=o?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=p.state;delete p.state;let c=()=>!1;if(i.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=s(i.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:a,output:f}=s.test(n,p,t,{glob:e,posix:u}),g={glob:e,state:l,regex:p,posix:u,input:n,output:f,match:a,isMatch:o};return"function"==typeof i.onResult&&i.onResult(g),!1===o?(g.isMatch=!1,!!r&&g):c(n)?("function"==typeof i.onIgnore&&i.onIgnore(g),g.isMatch=!1,!!r&&g):("function"==typeof i.onMatch&&i.onMatch(g),!r||g)};return n&&(f.state=l),f};return s.test=(e,t,n,{glob:o,posix:a}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const i=n||{},u=i.format||(a?r.toPosixSlashes:null);let p=e===o,l=p&&u?u(e):e;return!1===p&&(l=u?u(e):e,p=l===o),!1!==p&&!0!==i.capture||(p=!0===i.matchBase||!0===i.basename?s.matchBase(e,t,n,a):t.exec(l)),{isMatch:Boolean(p),match:p,output:l}},s.matchBase=(t,n,o,a=r.isWindows(o))=>(n instanceof RegExp?n:s.makeRe(n,o)).test(e.basename(t)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map((e=>s.parse(e,t))):n(e,{...t,fastpaths:!1}),s.scan=(e,n)=>t(e,n),s.compileRe=(e,t,n=!1,r=!1)=>{if(!0===n)return e.output;const o=t||{},a=o.contains?"":"^",i=o.contains?"":"$";let u=`${a}(?:${e.output})${i}`;e&&!0===e.negated&&(u=`^(?!${u}).*$`);const p=s.toRegex(u,t);return!0===r&&(p.state=e),p},s.makeRe=(e,t={},r=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let a={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(a.output=n.fastpaths(e,t)),a.output||(a=n(e,t)),s.compileRe(a,t,r,o)},s.toRegex=(e,t)=>{try{const n=t||{};return new RegExp(e,n.flags||(n.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},s.constants=o,_e=s}function ke(){return Se?be:(Se=1,be=He())}var Oe=function(){if(ve)return Ce;ve=1;const e=A,t=fe(),n=ke(),r=we(),o=e=>""===e||"./"===e,s=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,s=new Set,a=new Set,i=0,u=e=>{a.add(e.output),r&&r.onResult&&r.onResult(e)};for(let a=0;a<t.length;a++){let p=n(String(t[a]),{...r,onResult:u},!0),l=p.state.negated||p.state.negatedExtglob;l&&i++;for(let t of e){let e=p(t,!0);(l?!e.isMatch:e.isMatch)&&(l?o.add(e.output):(o.delete(e.output),s.add(e.output)))}}let p=(i===t.length?[...a]:[...s]).filter((e=>!o.has(e)));if(r&&0===p.length){if(!0===r.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===r.nonull||!0===r.nullglob)return r.unescape?t.map((e=>e.replace(/\\/g,""))):t}return p};return s.match=s,s.matcher=(e,t)=>n(e,t),s.any=s.isMatch=(e,t,r)=>n(t,r)(e),s.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,o=[],a=new Set(s(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)a.has(e)||r.add(e);return[...r]},s.contains=(t,n,r)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(n))return n.some((e=>s.contains(t,e,r)));if("string"==typeof n){if(o(t)||o(n))return!1;if(t.includes(n)||t.startsWith("./")&&t.slice(2).includes(n))return!0}return s.isMatch(t,n,{...r,contains:!0})},s.matchKeys=(e,t,n)=>{if(!r.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=s(Object.keys(e),t,n),a={};for(let t of o)a[t]=e[t];return a},s.some=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(o.some((e=>t(e))))return!0}return!1},s.every=(e,t,r)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=n(String(e),r);if(!o.every((e=>t(e))))return!1}return!0},s.all=(t,r,o)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);return[].concat(r).every((e=>n(e,o)(t)))},s.capture=(e,t,o)=>{let s=r.isWindows(o),a=n.makeRe(String(e),{...o,capture:!0}).exec(s?r.toPosixSlashes(t):t);if(a)return a.slice(1).map((e=>void 0===e?"":e))},s.makeRe=(...e)=>n.makeRe(...e),s.scan=(...e)=>n.scan(...e),s.parse=(e,r)=>{let o=[];for(let s of[].concat(e||[]))for(let e of t(String(s),r))o.push(n.parse(e,r));return o},s.braces=(e,n)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return n&&!0===n.nobrace||!/\{.*\}/.test(e)?[e]:t(e,n)},s.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return s.braces(e,{...t,expand:!0})},Ce=s}();const Te='{\n "name": "",\n "version": "0.0.1",\n "description": "",\n "license": "",\n "author": "",\n "files": ["dist"],\n "exports": {\n ".": "./src/index.ts"\n },\n "scripts": {\n },\n "homepage": "",\n "repository": "",\n "bugs": ""\n}'.trimStart(),Le="# $name\n\n## Installation\n\n```bash\nnpm install $name\n# or\npnpm install $name\n# or\nyarn add $name\n```\n\n## Usage\n\n\n## License\n\n$license\n".trimStart();const Ne=new Map;function Ie(n,r){if(Ne.has(n))return Ne.get(n)[r];const o=t.resolve(n,"package.json"),s=JSON.parse(e.readFileSync(o,"utf-8"));return Ne.set(n,s),s[r]}s.command("init [name]").option("-t, --template <template>","the package.json template file path or file content").action((async()=>{const[,n]=s.args,r=process.cwd(),{init:o={}}=P()??{},{wd:a}=w(),i=t.basename(a),{named:u,template:p,bug:l={},readme:c=Le,readmeTemplate:A}=o,R={template:"bug_report.yml",labels:["bug"],...l};let y=c;if(A){const n=t.resolve(a,A);y=e.readFileSync(n,"utf-8")}const m=function(n,r){let o=r??Te,s=!1;try{r&&JSON.parse(r)}catch(e){s=!0}if(s){const s=t.resolve(n,r);o=e.readFileSync(s,"utf-8")}return o}(a,p),{indent:_=" "}=f(m),E={tabSize:_.length,insertSpaces:!0},b=["license","author"];let S=m;for(const e of b)S=d(S,h(S,[e],Ie(a,e),{formattingOptions:E}));let[C,v]=await async function(e,n,{wd:r,cwd:o,workspaceName:s}){const a=o.replace(`${r}/`,"");let i=t.basename(o);if("function"==typeof e)return e(n,{full:r,relative:o});let u,p,l=!1;if("object"==typeof e)if(o===r){const{rule:t}=await g.prompt({type:"list",name:"rule",message:"choose a rule",default:"default",choices:["default"].concat(Object.keys(e))});"default"!==t&&(u=t,p=e[t])}else for(const[t,n]of Object.entries(e)){if(Oe.isMatch(a,t)){u=t,p=n;break}if(Oe.isMatch(`${a}/jiek_ignore_dont_use_same_file_name`,t)){l=!0,u=t,p=n;break}}if(p||(u="packages/*",p=`@${s}/$basename`),!p)throw new Error("no matched rule");if(!n&&l&&(i=await g.prompt({type:"input",name:"name",message:`the matched rule is \`${String(p)}\`, please input the basename\n`}).then((({name:e})=>e))),"function"==typeof p)return p(n,{full:r,relative:o,basename:i});if("string"==typeof p){const e=n??i;return[p.replace(/\$basename/g,e),u?.replace(/\/\*$/g,`/${e}`)]}throw new Error("no matched rule")}(u,n,{wd:a,cwd:r,workspaceName:i});if(!v){const{dir:e}=await g.prompt({type:"input",name:"dir",message:"package directory",default:n});v=e}if(!C){const{name:e}=await g.prompt({type:"input",name:"name",message:"package name",default:n});C=e}S=d(S,h(S,["name"],C,{formattingOptions:E}));let $=Ie(a,"repository");"string"==typeof $&&($={type:"git",url:$,directory:v}),S=d(S,h(S,["repository"],$,{formattingOptions:E}));S=d(S,h(S,["homepage"],`${$?.url}/blob/master/${v}/README.md`,{formattingOptions:E}));let x=R.labels;"function"==typeof x&&(x=x({name:C,dir:v})),x.push(`scope:${C}`);const H=`${$?.url}/issues/new?template=${R.template}&labels=${x.join(",")}`;function k(e){if(!v)throw new Error("pkgDir is not defined");return t.resolve(v,e)}S=d(S,h(S,["bugs"],H,{formattingOptions:E})),e.existsSync(v)||e.mkdirSync(v);const O=k("package.json");if(e.existsSync(O))throw new Error("package.json already exists");e.writeFileSync(O,S),console.log(S,"written to",O);const T=Ie(a,"license"),L=k("README.md");"function"==typeof y&&(y=y({dir:v,packageJson:JSON.parse(S)}));const N=y.replace(/\$name/g,C).replace(/\$license/g,T);e.writeFileSync(L,N)}));const Me=(e,t)=>new Set([...e].filter((e=>t.has(e))));s.command("publish").aliases(["pub","p"]).option("-b, --bumper <bumper>","bump version","patch").option("-p, --preview","preview publish").action((async({preview:o,bumper:s,...a})=>{I();const{value:i={}}=await k()??{},u=Object.entries(i);if(0===u.length)throw new Error("no packages selected");const p=u.map((([e,t])=>{const{type:o,exports:s={}}=t,a="module"===o,i={...t},[u,p]=function({entrypoints:e,pkgIsModule:t,entries:o,config:s,dir:a,noFilter:i,withSource:u,withSuffix:p}){const{build:l={}}=s??{},{crossModuleConvertor:c=!0}=l,f=`./${(e=>r(a??process.cwd(),e))(((...e)=>n(a??process.cwd(),...e))(("object"==typeof l?.output?.dir?l.output.dir.js:l?.output?.dir)??"dist"))}`,[,g]=_(e);o&&Object.entries(g).forEach((([e])=>{o.some((t=>Oe.isMatch(e,t,{matchBase:!0})))||delete g[e]}));const d=i?g:E(g,{skipValue:[/(^|\/)\.jk-noentry/,...b]});return[d,S(d,{outdir:f,withSource:u,withSuffix:p,withConditional:{...c?{import:e=>!t&&0===Me(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==Me(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{}}})]}({entrypoints:s,pkgIsModule:a,config:P(e),dir:e,noFilter:!0,withSource:!0,withSuffix:!0});return i.exports={...u,...p},[e,i]})),l=Object.entries(a).reduce(((e,[t,n])=>(n&&e.push(`--${t}`,n),e)),[]);for(const[n,r]of p){const a=e.readFileSync(t.join(n,"package.json"),"utf-8"),i=JSON.parse(a)??"0.0.0",u=m(i.version,s),{indent:p=" "}=f(a),c={tabSize:p.length,insertSpaces:!0};let g=a;g=d(g,h(g,["version"],u,{formattingOptions:c}));for(const[e,t]of Object.entries(r))if(JSON.stringify(t)!==JSON.stringify(i[e]))if("exports"!==e)g=d(g,h(g,["publishConfig",e],t,{formattingOptions:c}));else{const e=t;for(const[t,n]of Object.entries(e))g=d(g,h(g,["publishConfig","exports",t],n,{formattingOptions:c}));const n=e?.["."],o={};if(n){switch(typeof n){case"string":o["module"===r?.type?"module":"main"]=n;break;case"object":{const e=n;o.main=e.require??e.default,o.module=e.import??e.module??e.default;break}}for(const[e,t]of Object.entries(o))void 0!==t&&(g=d(g,h(g,["publishConfig",e],t,{formattingOptions:c})))}}try{if(e.renameSync(t.join(n,"package.json"),t.join(n,"package.json.bak")),e.writeFileSync(t.join(n,"package.json"),g),console.log(g),o){console.warn("preview mode");continue}y.execSync(["pnpm","publish","--access","public","--no-git-checks",...l].join(" "),{cwd:n,stdio:"inherit"});const r=d(a,h(a,["version"],u,{}));e.writeFileSync(t.join(n,"package.json.bak"),r)}finally{e.unlinkSync(t.join(n,"package.json")),e.renameSync(t.join(n,"package.json.bak"),t.join(n,"package.json"))}}N()})),s.parse(process.argv);
|