pkgroll 2.21.1 → 2.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +1 -1
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -20,7 +20,7 @@ var ju=Object.defineProperty;var D=(e,t)=>ju(e,"name",{value:t,configurable:!0})
|
|
|
20
20
|
`:"")+(n?this.indentText({text:this.render(n),spaces:u}):"")}
|
|
21
21
|
`}table({tableData:t,tableOptions:n,tableBreakpoints:u}){return jn(t.map(r=>r.map(s=>this.render(s))),u?Pn(u):n)}flagParameter(t){return t===Boolean?"":t===String?"<string>":t===Number?"<number>":Array.isArray(t)?this.flagParameter(t[0]):"<value>"}flagOperator(t){return" "}flagName(t){const{flag:n,flagFormatted:u,aliasesEnabled:r,aliasFormatted:s}=t;let o="";if(s?o+=`${s}, `:r&&(o+=" "),o+=u,"placeholder"in n&&typeof n.placeholder=="string")o+=`${this.flagOperator(t)}${n.placeholder}`;else{const i=this.flagParameter("type"in n?n.type:n);i&&(o+=`${this.flagOperator(t)}${i}`)}return o}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let n="description"in t?t.description??"":"";if("default"in t){let{default:u}=t;typeof u=="function"&&(u=u()),u&&(n+=` (default: ${this.flagDefault(u)})`)}return n}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(n=>this.render(n)).join(`
|
|
22
22
|
`);if("type"in t&&this[t.type]){const n=this[t.type];if(typeof n=="function")return n.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}}const Oe=v(e=>e.length>0&&!e.includes(" "),"isValidScriptName"),{stringify:R}=JSON,Mn=/[|\\{}()[\]^$+*?.]/;function ie(e){const t=[];let n,u;for(const r of e){if(u)throw new Error(`Invalid parameter: Spread parameter ${R(u)} must be last`);const s=r[0],o=r.at(-1);let i;if(s==="<"&&o===">"&&(i=!0,n))throw new Error(`Invalid parameter: Required parameter ${R(r)} cannot come after optional parameter ${R(n)}`);if(s==="["&&o==="]"&&(i=!1,n=r),i===void 0)throw new Error(`Invalid parameter: ${R(r)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let a=r.slice(1,-1);const l=a.slice(-3)==="...";l&&(u=r,a=a.slice(0,-3));const c=a.match(Mn);if(c)throw new Error(`Invalid parameter: ${R(r)}. Invalid character found ${R(c[0])}`);t.push({name:a,required:i,spread:l})}return t}D(ie,"b"),v(ie,"parseParameters");function ae(e,t,n,u){for(let r=0;r<t.length;r+=1){const{name:s,required:o,spread:i}=t[r],a=In(s);if(a in e)throw new Error(`Invalid parameter: ${R(s)} is used more than once.`);const l=i?n.slice(r):n[r];if(i&&(r=t.length),o&&(!l||i&&l.length===0))return console.error(`Error: Missing required parameter ${R(s)}
|
|
23
|
-
`),u(),process.exit(1);e[a]=l}}D(ae,"v$1"),v(ae,"mapParametersToArguments");function _t(e){return e===void 0||e!==!1}D(_t,"G$1"),v(_t,"helpEnabled");function Se(e,t,n,u){const r={...t.flags},s=t.version&&!("version"in r);s&&(r.version={type:Boolean,description:"Show version"});const{help:o}=t,i=_t(o);i&&!("help"in r)&&(r.help={type:Boolean,alias:"h",description:"Show help"});const a=Dn(r,u,{ignore:t.ignoreArgv}),l=v(()=>{console.log(t.version)},"showVersion");if(s&&a.flags.version===!0)return l(),process.exit(0);const c=new Ln,F=i&&o?.render?o.render:m=>c.render(m),f=v(m=>{const w=_n({...t,...m?{help:m}:{},flags:r});console.log(F(w,c))},"showHelp");if(i&&a.flags.help===!0)return f(),process.exit(0);if(t.parameters){let{parameters:m}=t,w=a._;const O=m.indexOf("--"),$=m.slice(O+1),p=Object.create(null);if(O>-1&&$.length>0){m=m.slice(0,O);const b=a._["--"];w=w.slice(0,-b.length||void 0),ae(p,ie(m),w,f),ae(p,ie($),b,f)}else ae(p,ie(m),w,f);Object.assign(a._,p)}const d={...a,showVersion:l,showHelp:f},g={command:e,...d};if(typeof n=="function"){const m=n(d);if(m&&"then"in m)return Object.assign(Promise.resolve(m),g)}return g}D(Se,"j"),v(Se,"cliBase");function Wt(e,t){const n=new Map;for(const u of t){const r=[u.options.name],{alias:s}=u.options;s&&(Array.isArray(s)?r.push(...s):r.push(s));for(const o of r){if(n.has(o))throw new Error(`Duplicate command name found: ${R(o)}`);n.set(o,u)}}return n.get(e)}D(Wt,"K$1"),v(Wt,"getCommand");function Lt(e,t,n=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!Oe(e.name)))throw new Error(`Invalid script name: ${R(e.name)}`);const u=n[0];if(e.commands&&u&&Oe(u)){const r=Wt(u,e.commands);if(r)return Se(r.options.name,{...r.options,parent:e},r.callback,n.slice(1))}return Se(void 0,e,t,n)}D(Lt,"Q$1"),v(Lt,"cli");function Un(e,t){if(!e)throw new Error("Command options are required");const{name:n}=e;if(n===void 0)throw new Error("Command name is required");if(!Oe(n))throw new Error(`Invalid command name ${JSON.stringify(n)}. Command names must be one word.`);return{options:e,callback:t}}D(Un,"X$1"),v(Un,"command");var Vn="2.21.1";const De=D(e=>_.promises.access(e).then(()=>!0,()=>!1),"fsExists");let M=!0;const q=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let Z=0;if(q.process&&q.process.env&&q.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:n,TERM:u,COLORTERM:r}=q.process.env;t||n||e==="0"?M=!1:e==="1"||e==="2"||e==="3"?M=!0:u==="dumb"?M=!1:"CI"in q.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(s=>s in q.process.env)?M=!0:M=process.stdout.isTTY,M&&(process.platform==="win32"||r&&(r==="truecolor"||r==="24bit")?Z=3:u&&(u.endsWith("-256color")||u.endsWith("256"))?Z=2:Z=1)}let Mt={enabled:M,supportLevel:Z};function zn(e,t,n=1){const u=`\x1B[${e}m`,r=`\x1B[${t}m`,s=new RegExp(`\\x1b\\[${t}m`,"g");return o=>Mt.enabled&&Mt.supportLevel>=n?u+(""+o).replace(s,u)+r:""+o}D(zn,"kolorist");const qn=zn(2,22),Pe=D(e=>e.replaceAll("\\","/"),"slash"),P=D((e,t)=>(!C.isAbsolute(e)&&!e.startsWith(".")&&!e.startsWith("/")&&(e=`./${e}`),t&&!e.endsWith("/")&&(e+="/"),e),"normalizePath"),Jn=D(()=>new Date().toLocaleTimeString(),"currentTime"),le=D((...e)=>console.log(qn(Jn()),...e),"log"),Kn=process.cwd(),ce=D(e=>P(C.relative(Kn,e)),"formatPath"),Gn=D(async e=>{const t=await z.readFile(e,"utf8");try{return Tu(t)}catch(n){throw new Error(`Failed to parse ${ce(e)}: ${n.message}`)}},"readPackageYaml"),Hn=D(async e=>{const t=await z.readFile(e,"utf8");try{return JSON.parse(t)}catch(n){throw new Error(`Failed to parse ${ce(e)}: ${n.message}`)}},"readPackageJson"),Yn=D(async e=>{const t=C.join(e,"package.yaml");if(await De(t))return{packageJson:await Gn(t),packageJsonPath:t};const n=C.join(e,"package.json");if(await De(n))return{packageJson:await Hn(n),packageJsonPath:n};throw new Error(`package.json not found at: ${n} (also checked for package.yaml)`)},"readPackage"),Zn=D(e=>{let t=!1;if(e.includes("=")){const[n,u]=e.split("=");e=u,t=n==="bin"||n==="binary"}return{type:"legacy",source:"cli",outputPath:P(e),isExecutable:t}},"parseCliInputFlag"),Qn=D(({imports:e},t)=>{const n={};if(e)for(const u in e){if(u.startsWith("#"))continue;const r=e[u];typeof r=="string"&&(n[u]=C.join(t,r))}return n},"getAliases"),Xn=D(e=>{const{publishConfig:t}=e;if(!t)return;const n=["bin","main","exports","types","module"];for(const u of n)t[u]&&(e[u]=t[u])},"applyPublishConfig"),U=D(e=>{if(e.endsWith(".mjs"))return"module";if(e.endsWith(".cjs"))return"commonjs";if(e.endsWith(".d.ts")||e.endsWith(".d.cts")||e.endsWith(".d.mts"))return"types"},"getFileType"),er=D(e=>e[0]===".","isPath"),Ut=D(e=>e.slice(1).filter(t=>typeof t=="string"&&t[0]!=="."),"getConditions"),fe=D((e,t,n,u=[n])=>{if(!e)return[];if(typeof e=="string")return[{source:{type:"package.json",path:[...u]},type:n,conditions:[],format:U(e)||t,outputPath:P(e)}];if(Array.isArray(e))return e.flatMap((s,o)=>{const i=[...u,o];return typeof s=="string"?er(s)?{source:{type:"package.json",path:[...i]},type:n,conditions:Ut(i),format:U(s)||t,outputPath:P(s)}:[]:fe(s,t,n,i)});const r=n==="imports"&&u.length===1;return Object.entries(e).flatMap(([s,o])=>{if(r&&s[0]!=="#")return[];const i=[...u,s];if(typeof o=="string"){const a=Ut(i),l={type:n,source:{type:"package.json",path:i},outputPath:P(o),conditions:a};return a.includes("types")?{...l,format:"types"}:{...l,format:U(o)||t}}return fe(o,t,n,i)})},"parsePackageMap"),tr=D((e,t)=>{const n=[],u=e.main;u&&n.push({source:{type:"package.json",path:["main"]},type:"legacy",format:U(u)??t,outputPath:P(u)});const r=e.module;r&&n.push({source:{type:"package.json",path:["module"]},type:"legacy",format:"module",outputPath:P(r)});const s=e.types;s&&n.push({source:{type:"package.json",path:["types"]},type:"legacy",format:"types",outputPath:P(s)});const{bin:o}=e;if(o)if(typeof o=="string")n.push({source:{type:"package.json",path:["bin"]},type:"binary",format:U(o)??t,outputPath:P(o)});else for(const[i,a]of Object.entries(o))n.push({source:{type:"package.json",path:["bin",i]},type:"binary",format:U(a)??t,outputPath:P(a)});if(e.exports){const i=fe(e.exports,t,"exports");n.push(...i)}if(e.imports){const i=fe(e.imports,t,"imports");n.push(...i)}return n},"getPkgEntryPoints"),ur=D(async(e,t)=>{for(const n of t){const u=e+n;if(await De(u))return{srcExtension:n,sourcePath:u}}},"tryExtensions"),Te={".d.ts":[".d.ts",".d.mts",".d.cts",".ts",".tsx",".mts",".cts"],".d.mts":[".d.mts",".d.ts",".d.cts",".ts",".tsx",".mts",".cts"],".d.cts":[".d.cts",".d.ts",".d.mts",".ts",".tsx",".mts",".cts"],".js":[".js",".ts",".tsx",".mts",".cts"],".mjs":[".mjs",".js",".cjs",".mts",".cts",".ts",".tsx"],".cjs":[".cjs",".js",".mjs",".mts",".cts",".ts",".tsx"]},Vt=Object.keys(Te),nr=D(async(e,t)=>{const{outputPath:n}=e,u=Vt.find(o=>n.endsWith(o));if(!u)return{error:`Unsupported extension (must be ${Vt.join("|")})`,exportEntry:e};const r=n.slice(t.dist.length,-u.length),s=await ur(H.join(t.srcResolved,r),Te[u]);return s?{exportEntry:e,distExtension:u,srcdist:t,...s}:{error:`Source file not found: ${H.join(t.src,r)}(${Te[u].join("|")})`,exportEntry:e}},"getSourcePath"),rr=D(async e=>{try{return await z.readdir(e,{withFileTypes:!0})}catch(t){const{code:n}=t;if(n==="ENOENT")return[];throw t}},"safeReaddir"),zt=D(async(e,t)=>{const n=await rr(e);return(await Promise.all(n.map(async r=>{const s=H.join(e,r.name);return r.isDirectory()?zt(s,t):r.isFile()?H.relative(t,s):[]}))).flat()},"getDirectoryFilesRecursive"),qt=new Map,Jt=D(async e=>{let t=qt.get(e);return t||(t=zt(e,e),qt.set(e,t)),t},"getDirectoryFiles"),pe=/\.[^./]+$/,Kt=D((e,t)=>{const n=t.at(-1);if(!e.endsWith(n))return;if(t.some(r=>r.includes("/"))){const r=e.split("/").filter(Boolean);for(let s=1;s<=r.length;s+=1){const o=r.slice(0,s).join("/"),i=o+t.join(o);if(i===e)return i}}else for(let r=1;r<=e.length;r+=1){const s=e.slice(0,r),o=s+t.join(s);if(o===e)return o}},"extractWildcardMatch"),sr=D(async(e,t)=>{const n=Array.from(t).sort((r,s)=>s.dist.length-r.dist.length);return(await Promise.all(e.map(async r=>{if(typeof r.source=="string"||r.source.path[0]!=="exports"&&r.source.path[0]!=="imports"||!r.outputPath.includes("*"))return[r];const s=r.source.path[1];if(!s.includes("*"))return[r];const o=r.outputPath.match(/\.d\.[cm]?ts$/)||r.outputPath.match(pe);if(!o)return[{exportEntry:r,error:`Wildcard pattern must include a file extension (e.g., ".mjs", ".cjs"). Pattern: ${s}`}];const[i]=o,a=r.outputPath.slice(0,-i.length),[l,...c]=a.split("*"),F=l.lastIndexOf("/"),f=F===-1?l:l.slice(0,F+1),d=F>=0?l.slice(F+1):"",g=D($=>{const p=$.replace(pe,""),b=p.split("/").at(-1)||"";if(d&&!b.startsWith(d))return!1;if(c.length===1){const B=c[0];return!(B&&!(B.includes("/")?p:b).endsWith(B))}const k=d?b.slice(d.length):p;return!!Kt(k,c)},"matchesPattern");if(f==="./")return(await Promise.all(n.map(async p=>{const b=p.srcResolved;return(await Jt(b)).flatMap(B=>{if(!g(B))return[];const E=B.replace(pe,"");return[{...r,outputPath:p.dist+E+i}]})}))).flat();const m=n.find(({dist:$})=>f===$||f.startsWith($));if(!m)return[];const w=C.posix.join(m.srcResolved,f.slice(m.dist.length));return(await Jt(w)).flatMap($=>{if(!g($))return[];const p=$.replace(pe,"");if(c.length>1){const b=Kt(p,c);return[{...r,outputPath:f+b+i}]}return[{...r,outputPath:f+p+i}]})}))).flat()},"expandBuildOutputWildcards"),or=D(async(e,t,n)=>{Xn(t);const u=t.type??"commonjs",r=await sr(tr(t,u),e);n.length>0&&r.push(...n.map(o=>({...o,format:U(o.outputPath)??u})));const s=new Map;return await Promise.all(r.map(async o=>{if("error"in o)return o;const i=e.find(({dist:l})=>o.outputPath.startsWith(l));if(!i)return{exportEntry:o,error:"Ignoring file outside of dist directories"};const a=s.get(o.outputPath);if(a){if(a.format!==o.format)throw new Error(`Conflicting export types "${a.format}" & "${o.format}" found for ${o.outputPath}`)}else s.set(o.outputPath,o);return await nr(o,i)}))},"getBuildEntryPoints"),Q=Symbol("entry"),ir=D(e=>{const t=Lu(/\.([cm]?[jt]s|[jt]sx)$/);return{name:"esbuild-transform",transform:D(async(n,u)=>{if(!t(u))return null;const r=await ut(n,{...e,supported:{"import-meta":!0},loader:"default",sourcefile:u.replace(/\.[cm]ts/,".ts")});return{code:r.code,map:r.map||null}},"transform")}},"esbuildTransform"),ar=D(e=>{if(e==="es")return"esm";if(e==="cjs"||e==="iife")return e},"getEsbuildFormat"),Dr=D(e=>({name:"esbuild-minify",renderChunk:D(async(t,n,u)=>{const r=await ut(t,{...e,format:ar(u.format),minify:!0,keepNames:!0});return{code:r.code,map:r.map||null}},"renderChunk")}),"esbuildMinify"),Ie=D((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2],"compareSemver"),Gt=D(({target:e})=>{const t=e.some(n=>{if(n=n.trim(),!n.startsWith("node"))return;const u=n.slice(4).split(".").map(Number),r=[u[0],u[1]??0,u[2]??0];return!(Ie(r,[12,20,0])>=0&&Ie(r,[13,0,0])<0||Ie(r,[14,13,1])>=0)});return{name:"node-builtins",resolveId:D(n=>{const u=n.startsWith("node:");if(t&&u&&(n=n.slice(5)),Uu.includes(n)||u)return{id:n,external:!0}},"resolveId")}},"nodeBuiltins"),lr=D(e=>{const t=e.filter(u=>u.exportEntry.type==="binary");if(t.length===0)return{name:"patch-binary"};let n;return{name:"patch-binary",options:D(()=>{n=new Set(t.flatMap(u=>u.inputNames))},"options"),renderChunk:D((u,r,s)=>{if(!r.isEntry||!r.facadeModuleId||!n.has(r.name))return;const o=new ne(u);return o.prepend(`#!/usr/bin/env node
|
|
23
|
+
`),u(),process.exit(1);e[a]=l}}D(ae,"v$1"),v(ae,"mapParametersToArguments");function _t(e){return e===void 0||e!==!1}D(_t,"G$1"),v(_t,"helpEnabled");function Se(e,t,n,u){const r={...t.flags},s=t.version&&!("version"in r);s&&(r.version={type:Boolean,description:"Show version"});const{help:o}=t,i=_t(o);i&&!("help"in r)&&(r.help={type:Boolean,alias:"h",description:"Show help"});const a=Dn(r,u,{ignore:t.ignoreArgv}),l=v(()=>{console.log(t.version)},"showVersion");if(s&&a.flags.version===!0)return l(),process.exit(0);const c=new Ln,F=i&&o?.render?o.render:m=>c.render(m),f=v(m=>{const w=_n({...t,...m?{help:m}:{},flags:r});console.log(F(w,c))},"showHelp");if(i&&a.flags.help===!0)return f(),process.exit(0);if(t.parameters){let{parameters:m}=t,w=a._;const O=m.indexOf("--"),$=m.slice(O+1),p=Object.create(null);if(O>-1&&$.length>0){m=m.slice(0,O);const b=a._["--"];w=w.slice(0,-b.length||void 0),ae(p,ie(m),w,f),ae(p,ie($),b,f)}else ae(p,ie(m),w,f);Object.assign(a._,p)}const d={...a,showVersion:l,showHelp:f},g={command:e,...d};if(typeof n=="function"){const m=n(d);if(m&&"then"in m)return Object.assign(Promise.resolve(m),g)}return g}D(Se,"j"),v(Se,"cliBase");function Wt(e,t){const n=new Map;for(const u of t){const r=[u.options.name],{alias:s}=u.options;s&&(Array.isArray(s)?r.push(...s):r.push(s));for(const o of r){if(n.has(o))throw new Error(`Duplicate command name found: ${R(o)}`);n.set(o,u)}}return n.get(e)}D(Wt,"K$1"),v(Wt,"getCommand");function Lt(e,t,n=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!Oe(e.name)))throw new Error(`Invalid script name: ${R(e.name)}`);const u=n[0];if(e.commands&&u&&Oe(u)){const r=Wt(u,e.commands);if(r)return Se(r.options.name,{...r.options,parent:e},r.callback,n.slice(1))}return Se(void 0,e,t,n)}D(Lt,"Q$1"),v(Lt,"cli");function Un(e,t){if(!e)throw new Error("Command options are required");const{name:n}=e;if(n===void 0)throw new Error("Command name is required");if(!Oe(n))throw new Error(`Invalid command name ${JSON.stringify(n)}. Command names must be one word.`);return{options:e,callback:t}}D(Un,"X$1"),v(Un,"command");var Vn="2.21.2";const De=D(e=>_.promises.access(e).then(()=>!0,()=>!1),"fsExists");let M=!0;const q=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let Z=0;if(q.process&&q.process.env&&q.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:n,TERM:u,COLORTERM:r}=q.process.env;t||n||e==="0"?M=!1:e==="1"||e==="2"||e==="3"?M=!0:u==="dumb"?M=!1:"CI"in q.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(s=>s in q.process.env)?M=!0:M=process.stdout.isTTY,M&&(process.platform==="win32"||r&&(r==="truecolor"||r==="24bit")?Z=3:u&&(u.endsWith("-256color")||u.endsWith("256"))?Z=2:Z=1)}let Mt={enabled:M,supportLevel:Z};function zn(e,t,n=1){const u=`\x1B[${e}m`,r=`\x1B[${t}m`,s=new RegExp(`\\x1b\\[${t}m`,"g");return o=>Mt.enabled&&Mt.supportLevel>=n?u+(""+o).replace(s,u)+r:""+o}D(zn,"kolorist");const qn=zn(2,22),Pe=D(e=>e.replaceAll("\\","/"),"slash"),P=D((e,t)=>(!C.isAbsolute(e)&&!e.startsWith(".")&&!e.startsWith("/")&&(e=`./${e}`),t&&!e.endsWith("/")&&(e+="/"),e),"normalizePath"),Jn=D(()=>new Date().toLocaleTimeString(),"currentTime"),le=D((...e)=>console.log(qn(Jn()),...e),"log"),Kn=process.cwd(),ce=D(e=>P(C.relative(Kn,e)),"formatPath"),Gn=D(async e=>{const t=await z.readFile(e,"utf8");try{return Tu(t)}catch(n){throw new Error(`Failed to parse ${ce(e)}: ${n.message}`)}},"readPackageYaml"),Hn=D(async e=>{const t=await z.readFile(e,"utf8");try{return JSON.parse(t)}catch(n){throw new Error(`Failed to parse ${ce(e)}: ${n.message}`)}},"readPackageJson"),Yn=D(async e=>{const t=C.join(e,"package.yaml");if(await De(t))return{packageJson:await Gn(t),packageJsonPath:t};const n=C.join(e,"package.json");if(await De(n))return{packageJson:await Hn(n),packageJsonPath:n};throw new Error(`package.json not found at: ${n} (also checked for package.yaml)`)},"readPackage"),Zn=D(e=>{let t=!1;if(e.includes("=")){const[n,u]=e.split("=");e=u,t=n==="bin"||n==="binary"}return{type:"legacy",source:"cli",outputPath:P(e),isExecutable:t}},"parseCliInputFlag"),Qn=D(({imports:e},t)=>{const n={};if(e)for(const u in e){if(u.startsWith("#"))continue;const r=e[u];typeof r=="string"&&(n[u]=C.join(t,r))}return n},"getAliases"),Xn=D(e=>{const{publishConfig:t}=e;if(!t)return;const n=["bin","main","exports","types","module"];for(const u of n)t[u]&&(e[u]=t[u])},"applyPublishConfig"),U=D(e=>{if(e.endsWith(".mjs"))return"module";if(e.endsWith(".cjs"))return"commonjs";if(e.endsWith(".d.ts")||e.endsWith(".d.cts")||e.endsWith(".d.mts"))return"types"},"getFileType"),er=D(e=>e[0]===".","isPath"),Ut=D(e=>e.slice(1).filter(t=>typeof t=="string"&&t[0]!=="."),"getConditions"),fe=D((e,t,n,u=[n])=>{if(!e)return[];if(typeof e=="string")return[{source:{type:"package.json",path:[...u]},type:n,conditions:[],format:U(e)||t,outputPath:P(e)}];if(Array.isArray(e))return e.flatMap((s,o)=>{const i=[...u,o];return typeof s=="string"?er(s)?{source:{type:"package.json",path:[...i]},type:n,conditions:Ut(i),format:U(s)||t,outputPath:P(s)}:[]:fe(s,t,n,i)});const r=n==="imports"&&u.length===1;return Object.entries(e).flatMap(([s,o])=>{if(r&&s[0]!=="#")return[];const i=[...u,s];if(typeof o=="string"){const a=Ut(i),l={type:n,source:{type:"package.json",path:i},outputPath:P(o),conditions:a};return a.includes("types")?{...l,format:"types"}:{...l,format:U(o)||t}}return fe(o,t,n,i)})},"parsePackageMap"),tr=D((e,t)=>{const n=[],u=e.main;u&&n.push({source:{type:"package.json",path:["main"]},type:"legacy",format:U(u)??t,outputPath:P(u)});const r=e.module;r&&n.push({source:{type:"package.json",path:["module"]},type:"legacy",format:"module",outputPath:P(r)});const s=e.types;s&&n.push({source:{type:"package.json",path:["types"]},type:"legacy",format:"types",outputPath:P(s)});const{bin:o}=e;if(o)if(typeof o=="string")n.push({source:{type:"package.json",path:["bin"]},type:"binary",format:U(o)??t,outputPath:P(o)});else for(const[i,a]of Object.entries(o))n.push({source:{type:"package.json",path:["bin",i]},type:"binary",format:U(a)??t,outputPath:P(a)});if(e.exports){const i=fe(e.exports,t,"exports");n.push(...i)}if(e.imports){const i=fe(e.imports,t,"imports");n.push(...i)}return n},"getPkgEntryPoints"),ur=D(async(e,t)=>{for(const n of t){const u=e+n;if(await De(u))return{srcExtension:n,sourcePath:u}}},"tryExtensions"),Te={".d.ts":[".d.ts",".d.mts",".d.cts",".ts",".tsx",".mts",".cts"],".d.mts":[".d.mts",".d.ts",".d.cts",".ts",".tsx",".mts",".cts"],".d.cts":[".d.cts",".d.ts",".d.mts",".ts",".tsx",".mts",".cts"],".js":[".js",".ts",".tsx",".mts",".cts"],".mjs":[".mjs",".js",".cjs",".mts",".cts",".ts",".tsx"],".cjs":[".cjs",".js",".mjs",".mts",".cts",".ts",".tsx"]},Vt=Object.keys(Te),nr=D(async(e,t)=>{const{outputPath:n}=e,u=Vt.find(o=>n.endsWith(o));if(!u)return{error:`Unsupported extension (must be ${Vt.join("|")})`,exportEntry:e};const r=n.slice(t.dist.length,-u.length),s=await ur(H.join(t.srcResolved,r),Te[u]);return s?{exportEntry:e,distExtension:u,srcdist:t,...s}:{error:`Source file not found: ${H.join(t.src,r)}(${Te[u].join("|")})`,exportEntry:e}},"getSourcePath"),rr=D(async e=>{try{return await z.readdir(e,{withFileTypes:!0})}catch(t){const{code:n}=t;if(n==="ENOENT")return[];throw t}},"safeReaddir"),zt=D(async(e,t)=>{const n=await rr(e);return(await Promise.all(n.map(async r=>{const s=H.join(e,r.name);return r.isDirectory()?zt(s,t):r.isFile()?H.relative(t,s):[]}))).flat()},"getDirectoryFilesRecursive"),qt=new Map,Jt=D(async e=>{let t=qt.get(e);return t||(t=zt(e,e),qt.set(e,t)),t},"getDirectoryFiles"),pe=/\.[^./]+$/,Kt=D((e,t)=>{const n=t.at(-1);if(!e.endsWith(n))return;if(t.some(r=>r.includes("/"))){const r=e.split("/").filter(Boolean);for(let s=1;s<=r.length;s+=1){const o=r.slice(0,s).join("/"),i=o+t.join(o);if(i===e)return i}}else for(let r=1;r<=e.length;r+=1){const s=e.slice(0,r),o=s+t.join(s);if(o===e)return o}},"extractWildcardMatch"),sr=D(async(e,t)=>{const n=Array.from(t).sort((r,s)=>s.dist.length-r.dist.length);return(await Promise.all(e.map(async r=>{if(typeof r.source=="string"||r.source.path[0]!=="exports"&&r.source.path[0]!=="imports"||!r.outputPath.includes("*"))return[r];const s=r.source.path[1];if(!s.includes("*"))return[r];const o=r.outputPath.match(/\.d\.[cm]?ts$/)||r.outputPath.match(pe);if(!o)return[{exportEntry:r,error:`Wildcard pattern must include a file extension (e.g., ".mjs", ".cjs"). Pattern: ${s}`}];const[i]=o,a=r.outputPath.slice(0,-i.length),[l,...c]=a.split("*"),F=l.lastIndexOf("/"),f=F===-1?l:l.slice(0,F+1),d=F>=0?l.slice(F+1):"",g=D($=>{const p=$.replace(pe,""),b=p.split("/").at(-1)||"";if(d&&!b.startsWith(d))return!1;if(c.length===1){const B=c[0];return!(B&&!(B.includes("/")?p:b).endsWith(B))}const k=d?b.slice(d.length):p;return!!Kt(k,c)},"matchesPattern");if(f==="./")return(await Promise.all(n.map(async p=>{const b=p.srcResolved;return(await Jt(b)).flatMap(B=>{if(!g(B))return[];const E=B.replace(pe,"");return[{...r,outputPath:p.dist+E+i}]})}))).flat();const m=n.find(({dist:$})=>f===$||f.startsWith($));if(!m)return[];const w=C.posix.join(m.srcResolved,f.slice(m.dist.length));return(await Jt(w)).flatMap($=>{if(!g($))return[];const p=$.replace(pe,"");if(c.length>1){const b=Kt(p,c);return[{...r,outputPath:f+b+i}]}return[{...r,outputPath:f+p+i}]})}))).flat()},"expandBuildOutputWildcards"),or=D(async(e,t,n)=>{Xn(t);const u=t.type??"commonjs",r=await sr(tr(t,u),e);n.length>0&&r.push(...n.map(o=>({...o,format:U(o.outputPath)??u})));const s=new Map;return await Promise.all(r.map(async o=>{if("error"in o)return o;const i=e.find(({dist:l})=>o.outputPath.startsWith(l));if(!i)return{exportEntry:o,error:"Ignoring file outside of dist directories"};const a=s.get(o.outputPath);if(a){if(a.format!==o.format)throw new Error(`Conflicting export types "${a.format}" & "${o.format}" found for ${o.outputPath}`)}else s.set(o.outputPath,o);return await nr(o,i)}))},"getBuildEntryPoints"),Q=Symbol("entry"),ir=D(e=>{const t=Lu(/\.([cm]?[jt]s|[jt]sx)$/);return{name:"esbuild-transform",transform:D(async(n,u)=>{if(!t(u))return null;const r=await ut(n,{...e,supported:{"import-meta":!0},loader:"default",sourcefile:u.replace(/\.[cm]ts/,".ts")});return{code:r.code,map:r.map||null}},"transform")}},"esbuildTransform"),ar=D(e=>{if(e==="es")return"esm";if(e==="cjs"||e==="iife")return e},"getEsbuildFormat"),Dr=D(e=>({name:"esbuild-minify",renderChunk:D(async(t,n,u)=>{const r=await ut(t,{...e,format:ar(u.format),minify:!0,keepNames:!0});return{code:r.code,map:r.map||null}},"renderChunk")}),"esbuildMinify"),Ie=D((e,t)=>e[0]-t[0]||e[1]-t[1]||e[2]-t[2],"compareSemver"),Gt=D(({target:e})=>{const t=e.some(n=>{if(n=n.trim(),!n.startsWith("node"))return;const u=n.slice(4).split(".").map(Number),r=[u[0],u[1]??0,u[2]??0];return!(Ie(r,[12,20,0])>=0&&Ie(r,[13,0,0])<0||Ie(r,[14,13,1])>=0)});return{name:"node-builtins",resolveId:D(n=>{const u=n.startsWith("node:");if(t&&u&&(n=n.slice(5)),Uu.includes(n)||u)return{id:n,external:!0}},"resolveId")}},"nodeBuiltins"),lr=D(e=>{const t=e.filter(u=>u.exportEntry.type==="binary");if(t.length===0)return{name:"patch-binary"};let n;return{name:"patch-binary",options:D(()=>{n=new Set(t.flatMap(u=>u.inputNames))},"options"),renderChunk:D((u,r,s)=>{if(!r.isEntry||!r.facadeModuleId||!n.has(r.name))return;const o=new ne(u);return o.prepend(`#!/usr/bin/env node
|
|
24
24
|
`),{code:o.toString(),map:s.sourcemap?o.generateMap({hires:!0}):void 0}},"renderChunk"),writeBundle:D(async(u,r)=>{const s=new Set(Object.keys(r).map(o=>P(H.join(u.dir,o))));await Promise.all(t.map(async({exportEntry:o})=>{const{outputPath:i}=o;s.has(i)&&await _.promises.chmod(i,493)}))},"writeBundle")}},"patchBinary"),Ne=D((e,t=process.cwd())=>Pe(C.relative(t,e)).split("/").includes("node_modules"),"isFromNodeModules"),Ht=D(()=>{const e=/\.(?:[mc]?js|jsx)$/;return{name:"resolve-js-to-ts",async resolveId(t,n,u){if(n&&e.test(t)){if(!Ne(n)){const i=t.replace(/js(x?)$/,"ts$1");return this.resolve(i,n,u)}const r=await this.resolve(t,n,{...u,skipSelf:!0});if(r)return r;const s=t.replace(/js(x?)$/,"ts$1"),o=await this.resolve(s,n,{...u,skipSelf:!0});if(o)return o}return null}}},"resolveJsToTs"),Yt=D(e=>e!==null&&typeof e=="object","A"),J=D((e,t)=>Object.assign(new Error(`[${e}]: ${t}`),{code:e}),"a"),Zt="ERR_INVALID_PACKAGE_CONFIG",Re="ERR_INVALID_PACKAGE_TARGET",cr="ERR_PACKAGE_PATH_NOT_EXPORTED",fr=/^\d+$/,pr=/^(\.{1,2}|node_modules)$/i,dr=/\/|\\/;var Qt=(e=>(e.Export="exports",e.Import="imports",e))(Qt||{});const _e=D((e,t,n,u,r)=>{if(t==null)return[];if(typeof t=="string"){const[s,...o]=t.split(dr);if(s===".."||o.some(i=>pr.test(i)))throw J(Re,`Invalid "${e}" target "${t}" defined in the package config`);return[r?t.replace(/\*/g,r):t]}if(Array.isArray(t))return t.flatMap(s=>_e(e,s,n,u,r));if(Yt(t)){for(const s of Object.keys(t)){if(fr.test(s))throw J(Zt,"Cannot contain numeric property keys");if(s==="default"||u.includes(s))return _e(e,t[s],n,u,r)}return[]}throw J(Re,`Invalid "${e}" target "${t}"`)},"f"),X="*",Fr=D((e,t)=>{const n=e.indexOf(X),u=t.indexOf(X);return n===u?t.length>e.length:u>n},"m");function hr(e,t){if(!t.includes(X)&&e.hasOwnProperty(t))return[t];let n,u;for(const r of Object.keys(e))if(r.includes(X)){const[s,o,i]=r.split(X);if(i===void 0&&t.startsWith(s)&&t.endsWith(o)){const a=t.slice(s.length,-o.length||void 0);a&&(!n||Fr(n,r))&&(n=r,u=a)}}return[n,u]}D(hr,"d");const mr=D(e=>Object.keys(e).reduce((t,n)=>{const u=n===""||n[0]!==".";if(t===void 0||t===u)return u;throw J(Zt,'"exports" cannot contain some keys starting with "." and some not')},void 0),"p"),gr=/^\w+:/,Cr=D((e,t,n)=>{if(!e)throw new Error('"exports" is required');t=t===""?".":`./${t}`,(typeof e=="string"||Array.isArray(e)||Yt(e)&&mr(e))&&(e={".":e});const[u,r]=hr(e,t),s=_e(Qt.Export,e[u],t,n,r);if(s.length===0)throw J(cr,t==="."?'No "exports" main defined':`Package subpath '${t}' is not defined by "exports"`);for(const o of s)if(!o.startsWith("./")&&!gr.test(o))throw J(Re,`Invalid "exports" target "${o}" defined in the package config`);return s},"v");var Er=Object.defineProperty,h=D((e,t)=>Er(e,"name",{value:t,configurable:!0}),"o");function T(e){return e.startsWith("\\\\?\\")?e:e.replace(/\\/g,"/")}D(T,"h"),h(T,"slash");const We=h(e=>{const t=_[e];return(n,...u)=>{const r=`${e}:${u.join(":")}`;let s=n?.get(r);return s===void 0&&(s=Reflect.apply(t,_,u),n?.set(r,s)),s}},"cacheFs"),I=We("existsSync"),yr=We("readFileSync"),de=We("statSync"),Xt=h((e,t,n)=>{for(;;){const u=C.posix.join(e,t);if(I(n,u))return u;const r=C.dirname(e);if(r===e)return;e=r}},"findUp"),Le=/^\.{1,2}(\/.*)?$/,Me=h(e=>{const t=T(e);return Le.test(t)?t:`./${t}`},"normalizeRelativePath");function eu(e,t=!1){const n=e.length;let u=0,r="",s=0,o=16,i=0,a=0,l=0,c=0,F=0;function f(p,b){let k=0,B=0;for(;k<p;){let E=e.charCodeAt(u);if(E>=48&&E<=57)B=B*16+E-48;else if(E>=65&&E<=70)B=B*16+E-65+10;else if(E>=97&&E<=102)B=B*16+E-97+10;else break;u++,k++}return k<p&&(B=-1),B}D(f,"y"),h(f,"scanHexDigits");function d(p){u=p,r="",s=0,o=16,F=0}D(d,"v"),h(d,"setPosition");function g(){let p=u;if(e.charCodeAt(u)===48)u++;else for(u++;u<e.length&&V(e.charCodeAt(u));)u++;if(u<e.length&&e.charCodeAt(u)===46)if(u++,u<e.length&&V(e.charCodeAt(u)))for(u++;u<e.length&&V(e.charCodeAt(u));)u++;else return F=3,e.substring(p,u);let b=u;if(u<e.length&&(e.charCodeAt(u)===69||e.charCodeAt(u)===101))if(u++,(u<e.length&&e.charCodeAt(u)===43||e.charCodeAt(u)===45)&&u++,u<e.length&&V(e.charCodeAt(u))){for(u++;u<e.length&&V(e.charCodeAt(u));)u++;b=u}else F=3;return e.substring(p,b)}D(g,"j"),h(g,"scanNumber");function m(){let p="",b=u;for(;;){if(u>=n){p+=e.substring(b,u),F=2;break}const k=e.charCodeAt(u);if(k===34){p+=e.substring(b,u),u++;break}if(k===92){if(p+=e.substring(b,u),u++,u>=n){F=2;break}switch(e.charCodeAt(u++)){case 34:p+='"';break;case 92:p+="\\";break;case 47:p+="/";break;case 98:p+="\b";break;case 102:p+="\f";break;case 110:p+=`
|
|
25
25
|
`;break;case 114:p+="\r";break;case 116:p+=" ";break;case 117:const B=f(4);B>=0?p+=String.fromCharCode(B):F=4;break;default:F=5}b=u;continue}if(k>=0&&k<=31)if(K(k)){p+=e.substring(b,u),F=2;break}else F=6;u++}return p}D(m,"d"),h(m,"scanString");function w(){if(r="",F=0,s=u,a=i,c=l,u>=n)return s=n,o=17;let p=e.charCodeAt(u);if(Fe(p)){do u++,r+=String.fromCharCode(p),p=e.charCodeAt(u);while(Fe(p));return o=15}if(K(p))return u++,r+=String.fromCharCode(p),p===13&&e.charCodeAt(u)===10&&(u++,r+=`
|
|
26
26
|
`),i++,l=u,o=14;switch(p){case 123:return u++,o=1;case 125:return u++,o=2;case 91:return u++,o=3;case 93:return u++,o=4;case 58:return u++,o=6;case 44:return u++,o=5;case 34:return u++,r=m(),o=10;case 47:const b=u-1;if(e.charCodeAt(u+1)===47){for(u+=2;u<n&&!K(e.charCodeAt(u));)u++;return r=e.substring(b,u),o=12}if(e.charCodeAt(u+1)===42){u+=2;const k=n-1;let B=!1;for(;u<k;){const E=e.charCodeAt(u);if(E===42&&e.charCodeAt(u+1)===47){u+=2,B=!0;break}u++,K(E)&&(E===13&&e.charCodeAt(u)===10&&u++,i++,l=u)}return B||(u++,F=1),r=e.substring(b,u),o=13}return r+=String.fromCharCode(p),u++,o=16;case 45:if(r+=String.fromCharCode(p),u++,u===n||!V(e.charCodeAt(u)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return r+=g(),o=11;default:for(;u<n&&O(p);)u++,p=e.charCodeAt(u);if(s!==u){switch(r=e.substring(s,u),r){case"true":return o=8;case"false":return o=9;case"null":return o=7}return o=16}return r+=String.fromCharCode(p),u++,o=16}}D(w,"A"),h(w,"scanNext");function O(p){if(Fe(p)||K(p))return!1;switch(p){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}D(O,"E"),h(O,"isUnknownContentCharacter");function $(){let p;do p=w();while(p>=12&&p<=15);return p}return D($,"B"),h($,"scanNextNonTrivia"),{setPosition:d,getPosition:h(()=>u,"getPosition"),scan:t?$:w,getToken:h(()=>o,"getToken"),getTokenValue:h(()=>r,"getTokenValue"),getTokenOffset:h(()=>s,"getTokenOffset"),getTokenLength:h(()=>u-s,"getTokenLength"),getTokenStartLine:h(()=>a,"getTokenStartLine"),getTokenStartCharacter:h(()=>s-c,"getTokenStartCharacter"),getTokenError:h(()=>F,"getTokenError")}}D(eu,"Le"),h(eu,"createScanner");function Fe(e){return e===32||e===9}D(Fe,"X"),h(Fe,"isWhiteSpace");function K(e){return e===10||e===13}D(K,"S"),h(K,"isLineBreak");function V(e){return e>=48&&e<=57}D(V,"$"),h(V,"isDigit");var tu;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(tu||(tu={})),new Array(20).fill(0).map((e,t)=>" ".repeat(t));const G=200;new Array(G).fill(0).map((e,t)=>`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pkgroll",
|
|
3
|
-
"version": "2.21.
|
|
3
|
+
"version": "2.21.2",
|
|
4
4
|
"description": "Zero-config rollup bundler",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"zero config",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"node": ">=18"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@rollup/plugin-alias": "^
|
|
33
|
-
"@rollup/plugin-commonjs": "^
|
|
32
|
+
"@rollup/plugin-alias": "^6.0.0",
|
|
33
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
34
34
|
"@rollup/plugin-dynamic-import-vars": "^2.1.5",
|
|
35
35
|
"@rollup/plugin-inject": "^5.0.5",
|
|
36
36
|
"@rollup/plugin-json": "^6.1.0",
|