jiek 0.4.6 → 0.4.7-alpha.10
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +22 -1
- package/bin/jiek.js +9 -5
- package/dist/cli.cjs +4734 -406
- package/dist/cli.d.cts +97 -0
- package/dist/cli.d.ts +96 -1
- package/dist/cli.js +5006 -0
- package/dist/cli.min.cjs +19 -2
- package/dist/cli.min.js +19 -0
- package/dist/index.cjs +0 -1
- package/dist/index.d.cts +58 -0
- package/dist/index.d.ts +47 -46
- package/dist/{index.esm.js → index.js} +0 -1
- package/dist/index.min.cjs +0 -1
- package/dist/index.min.js +1 -0
- package/dist/rollup/index.cjs +4669 -0
- package/dist/rollup/index.d.cts +53 -0
- package/dist/rollup/index.d.ts +53 -0
- package/dist/rollup/index.js +4666 -0
- package/dist/rollup/index.min.cjs +19 -0
- package/dist/rollup/index.min.js +19 -0
- package/package.json +52 -33
- package/src/cli.ts +9 -0
- package/src/commands/base.ts +8 -0
- package/src/commands/build.ts +159 -0
- package/src/commands/init.ts +373 -0
- package/src/commands/publish.ts +156 -0
- package/src/index.ts +8 -0
- package/src/inner.ts +11 -0
- package/src/merge-package-json.ts +75 -0
- package/src/rollup/base.ts +72 -0
- package/src/rollup/index.ts +420 -0
- package/src/rollup/plugins/globals.ts +34 -0
- package/src/rollup/plugins/progress.ts +26 -0
- package/src/rollup/plugins/skip.ts +23 -0
- package/src/rollup/utils/commonOptions.ts +9 -0
- package/src/rollup/utils/externalResolver.ts +21 -0
- package/src/rollup/utils/globalResolver.ts +13 -0
- package/src/rollup/utils/withMinify.ts +18 -0
- package/src/utils/filterSupport.ts +84 -0
- package/src/utils/getExports.ts +100 -0
- package/src/utils/getRoot.ts +16 -0
- package/src/utils/getWD.ts +31 -0
- package/src/utils/loadConfig.ts +93 -0
- package/src/utils/tsRegister.ts +22 -0
- package/dist/base.esm.d.ts +0 -55
- package/dist/cli.cjs.map +0 -1
- package/dist/cli.esm.d.ts +0 -2
- package/dist/cli.esm.js +0 -9
- package/dist/cli.esm.js.map +0 -1
- package/dist/cli.esm.min.js +0 -2
- package/dist/cli.esm.min.js.map +0 -1
- package/dist/cli.min.cjs.map +0 -1
- package/dist/commands/base.esm.js +0 -5
- package/dist/commands/base.esm.js.map +0 -1
- package/dist/commands/base.esm.min.js +0 -2
- package/dist/commands/base.esm.min.js.map +0 -1
- package/dist/commands/build.esm.js +0 -58
- package/dist/commands/build.esm.js.map +0 -1
- package/dist/commands/build.esm.min.js +0 -2
- package/dist/commands/build.esm.min.js.map +0 -1
- package/dist/commands/init.esm.js +0 -271
- package/dist/commands/init.esm.js.map +0 -1
- package/dist/commands/init.esm.min.js +0 -2
- package/dist/commands/init.esm.min.js.map +0 -1
- package/dist/commands/publish.esm.js +0 -87
- package/dist/commands/publish.esm.js.map +0 -1
- package/dist/commands/publish.esm.min.js +0 -2
- package/dist/commands/publish.esm.min.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.esm.d.ts +0 -6
- package/dist/index.esm.js.map +0 -1
- package/dist/index.esm.min.js +0 -2
- package/dist/index.esm.min.js.map +0 -1
- package/dist/index.min.cjs.map +0 -1
- package/dist/inner.esm.js +0 -10
- package/dist/inner.esm.js.map +0 -1
- package/dist/inner.esm.min.js +0 -2
- package/dist/inner.esm.min.js.map +0 -1
- package/dist/merge-package-json.esm.js +0 -64
- package/dist/merge-package-json.esm.js.map +0 -1
- package/dist/merge-package-json.esm.min.js +0 -2
- package/dist/merge-package-json.esm.min.js.map +0 -1
- package/dist/pkg.esm.js +0 -4
- package/dist/pkg.esm.js.map +0 -1
- package/dist/pkg.esm.min.js +0 -2
- package/dist/pkg.esm.min.js.map +0 -1
- package/dist/rollup/plugins/globals.esm.js +0 -31
- package/dist/rollup/plugins/globals.esm.js.map +0 -1
- package/dist/rollup/plugins/globals.esm.min.js +0 -2
- package/dist/rollup/plugins/globals.esm.min.js.map +0 -1
- package/dist/rollup/plugins/skip.esm.js +0 -16
- package/dist/rollup/plugins/skip.esm.js.map +0 -1
- package/dist/rollup/plugins/skip.esm.min.js +0 -2
- package/dist/rollup/plugins/skip.esm.min.js.map +0 -1
- package/dist/rollup/utils/commonOptions.esm.js +0 -9
- package/dist/rollup/utils/commonOptions.esm.js.map +0 -1
- package/dist/rollup/utils/commonOptions.esm.min.js +0 -2
- package/dist/rollup/utils/commonOptions.esm.min.js.map +0 -1
- package/dist/rollup/utils/externalResolver.esm.js +0 -12
- package/dist/rollup/utils/externalResolver.esm.js.map +0 -1
- package/dist/rollup/utils/externalResolver.esm.min.js +0 -2
- package/dist/rollup/utils/externalResolver.esm.min.js.map +0 -1
- package/dist/rollup/utils/globalResolver.esm.js +0 -9
- package/dist/rollup/utils/globalResolver.esm.js.map +0 -1
- package/dist/rollup/utils/globalResolver.esm.min.js +0 -2
- package/dist/rollup/utils/globalResolver.esm.min.js.map +0 -1
- package/dist/rollup/utils/withMinify.esm.js +0 -15
- package/dist/rollup/utils/withMinify.esm.js.map +0 -1
- package/dist/rollup/utils/withMinify.esm.min.js +0 -2
- package/dist/rollup/utils/withMinify.esm.min.js.map +0 -1
- package/dist/rollup.cjs +0 -330
- package/dist/rollup.cjs.map +0 -1
- package/dist/rollup.d.ts +0 -23
- package/dist/rollup.esm.d.ts +0 -23
- package/dist/rollup.esm.js +0 -248
- package/dist/rollup.esm.js.map +0 -1
- package/dist/rollup.esm.min.js +0 -2
- package/dist/rollup.esm.min.js.map +0 -1
- package/dist/rollup.min.cjs +0 -2
- package/dist/rollup.min.cjs.map +0 -1
- package/dist/utils/commondir.esm.js +0 -25
- package/dist/utils/commondir.esm.js.map +0 -1
- package/dist/utils/commondir.esm.min.js +0 -2
- package/dist/utils/commondir.esm.min.js.map +0 -1
- package/dist/utils/filterSupport.esm.js +0 -67
- package/dist/utils/filterSupport.esm.js.map +0 -1
- package/dist/utils/filterSupport.esm.min.js +0 -2
- package/dist/utils/filterSupport.esm.min.js.map +0 -1
- package/dist/utils/getRoot.esm.js +0 -14
- package/dist/utils/getRoot.esm.js.map +0 -1
- package/dist/utils/getRoot.esm.min.js +0 -2
- package/dist/utils/getRoot.esm.min.js.map +0 -1
- package/dist/utils/getWD.esm.js +0 -31
- package/dist/utils/getWD.esm.js.map +0 -1
- package/dist/utils/getWD.esm.min.js +0 -2
- package/dist/utils/getWD.esm.min.js.map +0 -1
- package/dist/utils/loadConfig.esm.js +0 -75
- package/dist/utils/loadConfig.esm.js.map +0 -1
- package/dist/utils/loadConfig.esm.min.js +0 -2
- package/dist/utils/loadConfig.esm.min.js.map +0 -1
- package/dist/utils/tsRegister.esm.js +0 -24
- package/dist/utils/tsRegister.esm.js.map +0 -1
- package/dist/utils/tsRegister.esm.min.js +0 -2
- package/dist/utils/tsRegister.esm.min.js.map +0 -1
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";var e=require("node:fs"),t=require("node:path"),r=require("@jiek/pkger/entrypoints"),n=require("@jiek/rollup-plugin-dts"),o=require("@jiek/utils/getWorkspaceDir"),s=require("@rollup/plugin-commonjs"),i=require("@rollup/plugin-json"),u=require("@rollup/plugin-node-resolve"),a=require("@rollup/plugin-terser"),p=require("execa"),l=require("jsonc-parser"),c=require("util"),f=require("path"),g=require("rollup-plugin-esbuild"),d=require("typescript"),A=require("commander"),h=require("js-yaml"),R=require("node:module");require("@pnpm/filter-workspace-packages");var E,_,y,C,m,v,S,b,x,$,H,T,w,L,O,k,N,I,M,B="undefined"!=typeof document?document.currentScript:null,j={};function P(){return E||(E=1,function(e){e.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,r,n=1,o)=>!1!==o&&(!(!e.isInteger(t)||!e.isInteger(r))&&(Number(r)-Number(t))/Number(n)>=o),e.escapeNode=(e,t=0,r)=>{let n=e.nodes[t];n&&(r&&n.type===r||"open"===n.type||"close"===n.type)&&!0!==n.escaped&&(n.value="\\"+n.value,n.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.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=[],r=e=>{for(let n=0;n<e.length;n++){let o=e[n];Array.isArray(o)?r(o):void 0!==o&&t.push(o)}return t};return r(e),t}}(j)),j}function D(){if(y)return _;y=1;const e=P();return _=(t,r={})=>{let n=(t,o={})=>{let s=r.escapeInvalid&&e.isInvalidBrace(o),i=!0===t.invalid&&!0===r.escapeInvalid,u="";if(t.value)return(s||i)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)u+=n(e);return u};return n(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 G(){return m?C:(m=1,C=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 U(){if(S)return v;S=1;const e=G(),t=(r,s,i)=>{if(!1===e(r))throw new TypeError("toRegexRange: expected the first argument to be a number");if(void 0===s||r===s)return String(r);if(!1===e(s))throw new TypeError("toRegexRange: expected the second argument to be a number.");let u={relaxZeros:!0,...i};"boolean"==typeof u.strictZeros&&(u.relaxZeros=!1===u.strictZeros);let a=r+":"+s+"="+String(u.relaxZeros)+String(u.shorthand)+String(u.capture)+String(u.wrap);if(t.cache.hasOwnProperty(a))return t.cache[a].result;let p=Math.min(r,s),l=Math.max(r,s);if(1===Math.abs(p-l)){let e=r+"|"+s;return u.capture?`(${e})`:!1===u.wrap?e:`(?:${e})`}let f=c(r)||c(s),g={min:r,max:s,a:p,b:l},d=[],A=[];if(f&&(g.isPadded=f,g.maxLen=String(g.max).length),p<0){A=n(l<0?Math.abs(l):1,Math.abs(p),g,u),p=g.a=0}return l>=0&&(d=n(p,l,g,u)),g.negatives=A,g.positives=d,g.result=function(e,t,r){let n=o(e,t,"-",!1)||[],s=o(t,e,"",!1)||[],i=o(e,t,"-?",!0)||[];return n.concat(i).concat(s).join("|")}(A,d),!0===u.capture?g.result=`(${g.result})`:!1!==u.wrap&&d.length+A.length>1&&(g.result=`(?:${g.result})`),t.cache[a]=g,g.result};function r(e,t,r){if(e===t)return{pattern:e,count:[],digits:0};let n=function(e,t){let r=[];for(let n=0;n<e.length;n++)r.push([e[n],t[n]]);return r}(e,t),o=n.length,s="",i=0;for(let e=0;e<o;e++){let[t,r]=n[e];t===r?s+=t:"0"!==t||"9"!==r?s+=l(t,r):i++}return i&&(s+=!0===r.shorthand?"\\d":"[0-9]"),{pattern:s,count:[i],digits:o}}function n(e,t,n,o){let i,l=function(e,t){let r=1,n=1,o=u(e,r),i=new Set([t]);for(;e<=o&&o<=t;)i.add(o),r+=1,o=u(e,r);for(o=a(t+1,n)-1;e<o&&o<=t;)i.add(o),n+=1,o=a(t+1,n)-1;return i=[...i],i.sort(s),i}(e,t),c=[],g=e;for(let e=0;e<l.length;e++){let t=l[e],s=r(String(g),String(t),o),u="";n.isPadded||!i||i.pattern!==s.pattern?(n.isPadded&&(u=f(t,n,o)),s.string=u+s.pattern+p(s.count),c.push(s),g=t+1,i=s):(i.count.length>1&&i.count.pop(),i.count.push(s.count[0]),i.string=i.pattern+p(i.count),g=t+1)}return c}function o(e,t,r,n,o){let s=[];for(let o of e){let{string:e}=o;n||i(t,"string",e)||s.push(r+e),n&&i(t,"string",e)&&s.push(r+e)}return s}function s(e,t){return e>t?1:t>e?-1:0}function i(e,t,r){return e.some((e=>e[t]===r))}function u(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function a(e,t){return e-e%Math.pow(10,t)}function p(e){let[t=0,r=""]=e;return r||t>1?`{${t+(r?","+r:"")}}`:""}function l(e,t,r){return`[${e}${t-e==1?"":"-"}${t}]`}function c(e){return/^-?(0+)\d/.test(e)}function f(e,t,r){if(!t.isPadded)return e;let n=Math.abs(t.maxLen-String(e).length),o=!1!==r.relaxZeros;switch(n){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${n}}`:`0{${n}}`}}return t.cache={},t.clearCache=()=>t.cache={},v=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 K(){if(x)return b;x=1;const e=c,t=U(),r=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),n=e=>"number"==typeof e||"string"==typeof e&&""!==e,o=e=>Number.isInteger(+e),s=e=>{let t=`${e}`,r=-1;if("-"===t[0]&&(t=t.slice(1)),"0"===t)return!1;for(;"0"===t[++r];);return r>0},i=(e,t,r)=>{if(t>0){let r="-"===e[0]?"-":"";r&&(e=e.slice(1)),e=r+e.padStart(r?t-1:t,"0")}return!1===r?String(e):e},u=(e,t)=>{let r="-"===e[0]?"-":"";for(r&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return r?"-"+e:e},a=(e,r,n,o)=>{if(n)return t(e,r,{wrap:!1,...o});let s=String.fromCharCode(e);return e===r?s:`[${s}-${String.fromCharCode(r)}]`},p=(e,r,n)=>{if(Array.isArray(e)){let t=!0===n.wrap,r=n.capture?"":"?:";return t?`(${r}${e.join("|")})`:e.join("|")}return t(e,r,n)},l=(...t)=>new RangeError("Invalid range arguments: "+e.inspect(...t)),f=(e,t,r)=>{if(!0===r.strictRanges)throw l([e,t]);return[]},g=(e,t,r=1,n={})=>{let o=Number(e),c=Number(t);if(!Number.isInteger(o)||!Number.isInteger(c)){if(!0===n.strictRanges)throw l([e,t]);return[]}0===o&&(o=0),0===c&&(c=0);let f=o>c,g=String(e),d=String(t),A=String(r);r=Math.max(Math.abs(r),1);let h=s(g)||s(d)||s(A),R=h?Math.max(g.length,d.length,A.length):0,E=!1===h&&!1===((e,t,r)=>"string"==typeof e||"string"==typeof t||!0===r.stringify)(e,t,n),_=n.transform||(e=>t=>!0===e?Number(t):String(t))(E);if(n.toRegex&&1===r)return a(u(e,R),u(t,R),!0,n);let y={negatives:[],positives:[]},C=[],m=0;for(;f?o>=c:o<=c;)!0===n.toRegex&&r>1?y[(v=o)<0?"negatives":"positives"].push(Math.abs(v)):C.push(i(_(o,m),R,E)),o=f?o-r:o+r,m++;var v;return!0===n.toRegex?r>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 r,n=t.capture?"":"?:",o="",s="";return e.positives.length&&(o=e.positives.join("|")),e.negatives.length&&(s=`-(${n}${e.negatives.join("|")})`),r=o&&s?`${o}|${s}`:o||s,t.wrap?`(${n}${r})`:r})(y,n):p(C,null,{wrap:!1,...n}):C},d=(e,t,s,i={})=>{if(null==t&&n(e))return[e];if(!n(e)||!n(t))return f(e,t,i);if("function"==typeof s)return d(e,t,1,{transform:s});if(r(s))return d(e,t,0,s);let u={...i};return!0===u.capture&&(u.wrap=!0),s=s||u.step||1,o(s)?o(e)&&o(t)?g(e,t,s,u):((e,t,r=1,n={})=>{if(!o(e)&&e.length>1||!o(t)&&t.length>1)return f(e,t,n);let s=n.transform||(e=>String.fromCharCode(e)),i=`${e}`.charCodeAt(0),u=`${t}`.charCodeAt(0),l=i>u,c=Math.min(i,u),g=Math.max(i,u);if(n.toRegex&&1===r)return a(c,g,!1,n);let d=[],A=0;for(;l?i>=u:i<=u;)d.push(s(i,A)),i=l?i-r:i+r,A++;return!0===n.toRegex?p(d,null,{wrap:!1,options:n}):d})(e,t,Math.max(Math.abs(s),1),u):null==s||r(s)?d(e,t,1,s):((e,t)=>{if(!0===t.strictRanges)throw new TypeError(`Expected step "${e}" to be a number`);return[]})(s,u)};return b=d}function q(){if(N)return k;N=1;const e=D(),{MAX_LENGTH:t,CHAR_BACKSLASH:r,CHAR_BACKTICK:n,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:i,CHAR_RIGHT_PARENTHESES:u,CHAR_LEFT_CURLY_BRACE:a,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:A}=O?L:(O=1,L={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 k=(h,R={})=>{if("string"!=typeof h)throw new TypeError("Expected a string");let E=R||{},_="number"==typeof E.maxLength?Math.min(t,E.maxLength):t;if(h.length>_)throw new SyntaxError(`Input length (${h.length}), exceeds max characters (${_})`);let y,C={type:"root",input:h,nodes:[]},m=[C],v=C,S=C,b=0,x=h.length,$=0,H=0;const T=()=>h[$++],w=e=>{if("text"===e.type&&"dot"===S.type&&(S.type="text"),!S||"text"!==S.type||"text"!==e.type)return v.nodes.push(e),e.parent=v,e.prev=S,S=e,e;S.value+=e.value};for(w({type:"bos"});$<x;)if(v=m[m.length-1],y=T(),y!==A&&y!==d)if(y!==r)if(y!==c)if(y!==l)if(y!==i)if(y!==u)if(y!==f&&y!==g&&y!==n)if(y!==a)if(y!==p)if(y===o&&H>0){if(v.ranges>0){v.ranges=0;let t=v.nodes.shift();v.nodes=[t,{type:"text",value:e(v)}]}w({type:"comma",value:y}),v.commas++}else if(y===s&&H>0&&0===v.commas){let e=v.nodes;if(0===H||0===e.length){w({type:"text",value:y});continue}if("dot"===S.type){if(v.range=[],S.value+=y,S.type="range",3!==v.nodes.length&&5!==v.nodes.length){v.invalid=!0,v.ranges=0,S.type="text";continue}v.ranges++,v.args=[];continue}if("range"===S.type){e.pop();let t=e[e.length-1];t.value+=S.value+y,S=t,v.ranges--;continue}w({type:"dot",value:y})}else w({type:"text",value:y});else{if("brace"!==v.type){w({type:"text",value:y});continue}let e="close";v=m.pop(),v.close=!0,w({type:e,value:y}),H--,v=m[m.length-1]}else{H++;let e=S.value&&"$"===S.value.slice(-1)||!0===v.dollar;v=w({type:"brace",open:!0,close:!1,dollar:e,depth:H,commas:0,ranges:0,nodes:[]}),m.push(v),w({type:"open",value:y})}else{let e,t=y;for(!0!==R.keepQuotes&&(y="");$<x&&(e=T());)if(e!==r){if(e===t){!0===R.keepQuotes&&(y+=e);break}y+=e}else y+=e+T();w({type:"text",value:y})}else{if("paren"!==v.type){w({type:"text",value:y});continue}v=m.pop(),w({type:"text",value:y}),v=m[m.length-1]}else v=w({type:"paren",nodes:[]}),m.push(v),w({type:"text",value:y});else{let e;for(b++;$<x&&(e=T());)if(y+=e,e!==l)if(e!==r){if(e===c&&(b--,0===b))break}else y+=T();else b++;w({type:"text",value:y})}else w({type:"text",value:"\\"+y});else w({type:"text",value:(R.keepEscaping?y:"")+T()});do{if(v=m.pop(),"root"!==v.type){v.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=m[m.length-1],t=e.nodes.indexOf(v);e.nodes.splice(t,1,...v.nodes)}}while(m.length>0);return w({type:"eos"}),C},k}function F(){if(M)return I;M=1;const e=D(),t=function(){if(H)return $;H=1;const e=K(),t=P();return $=(r,n={})=>{let o=(r,s={})=>{let i=t.isInvalidBrace(s),u=!0===r.invalid&&!0===n.escapeInvalid,a=!0===i||!0===u,p=!0===n.escapeInvalid?"\\":"",l="";if(!0===r.isOpen)return p+r.value;if(!0===r.isClose)return p+r.value;if("open"===r.type)return a?p+r.value:"(";if("close"===r.type)return a?p+r.value:")";if("comma"===r.type)return"comma"===r.prev.type?"":a?r.value:"|";if(r.value)return r.value;if(r.nodes&&r.ranges>0){let o=t.reduce(r.nodes),s=e(...o,{...n,wrap:!1,toRegex:!0});if(0!==s.length)return o.length>1&&s.length>1?`(${s})`:s}if(r.nodes)for(let e of r.nodes)l+=o(e,r);return l};return o(r)}}(),r=function(){if(w)return T;w=1;const e=K(),t=D(),r=P(),n=(e="",t="",o=!1)=>{let s=[];if(e=[].concat(e),!(t=[].concat(t)).length)return e;if(!e.length)return o?r.flatten(t).map((e=>`{${e}}`)):t;for(let r of e)if(Array.isArray(r))for(let e of r)s.push(n(e,t,o));else for(let e of t)!0===o&&"string"==typeof e&&(e=`{${e}}`),s.push(Array.isArray(e)?n(r,e,o):r+e);return r.flatten(s)};return T=(o,s={})=>{let i=void 0===s.rangeLimit?1e3:s.rangeLimit,u=(o,a={})=>{o.queue=[];let p=a,l=a.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(n(l.pop(),t(o,s)));if("brace"===o.type&&!0!==o.invalid&&2===o.nodes.length)return void l.push(n(l.pop(),["{}"]));if(o.nodes&&o.ranges>0){let u=r.reduce(o.nodes);if(r.exceedsLimit(...u,s.step,i))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let a=e(...u,s);return 0===a.length&&(a=t(o,s)),l.push(n(l.pop(),a)),void(o.nodes=[])}let c=r.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(n(f.pop(),t.value)):t.nodes&&u(t,o):l.push(n(l.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return r.flatten(u(o))}}(),n=q(),o=(e,t={})=>{let r=[];if(Array.isArray(e))for(let n of e){let e=o.create(n,t);Array.isArray(e)?r.push(...e):r.push(e)}else r=[].concat(o.create(e,t));return t&&!0===t.expand&&!0===t.nodupes&&(r=[...new Set(r)]),r};return o.parse=(e,t={})=>n(e,t),o.stringify=(t,r={})=>e("string"==typeof t?o.parse(t,r):t,r),o.compile=(e,r={})=>("string"==typeof e&&(e=o.parse(e,r)),t(e,r)),o.expand=(e,t={})=>{"string"==typeof e&&(e=o.parse(e,t));let n=r(e,t);return!0===t.noempty&&(n=n.filter(Boolean)),!0===t.nodupes&&(n=[...new Set(n)]),n},o.create=(e,t={})=>""===e||e.length<3?[e]:!0!==t.expand?o.compile(e,t):o.expand(e,t),I=o}var Q,W,X,Z,Y,V,z,J,ee,te,re,ne,oe,se={};function ie(){if(W)return Q;W=1;const e=f,t="\\\\/",r=`[^${t}]`,n="\\.",o="\\/",s="[^/]",i=`(?:${o}|$)`,u=`(?:^|${o})`,a=`${n}{1,2}${i}`,p={DOT_LITERAL:n,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:s,END_ANCHOR:i,DOTS_SLASH:a,NO_DOT:`(?!${n})`,NO_DOTS:`(?!${u}${a})`,NO_DOT_SLASH:`(?!${n}{0,1}${i})`,NO_DOTS_SLASH:`(?!${a})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${s}*?`,START_ANCHOR:u},l={...p,SLASH_LITERAL:`[${t}]`,QMARK:r,STAR:`${r}*?`,DOTS_SLASH:`${n}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${n})`,NO_DOTS:`(?!(?:^|[${t}])${n}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${n}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${n}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`};return Q={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 ue(){return X||(X=1,function(e){const t=f,r="win32"===process.platform,{REGEX_BACKSLASH:n,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:i}=ie();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(i,"\\$1"),e.toPosixSlashes=e=>e.replace(n,"/"),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===r||"\\"===t.sep,e.escapeLast=(t,r,n)=>{const o=t.lastIndexOf(r,n);return-1===o?t:"\\"===t[o-1]?e.escapeLast(t,r,o-1):`${t.slice(0,o)}\\${t.slice(o)}`},e.removePrefix=(e,t={})=>{let r=e;return r.startsWith("./")&&(r=r.slice(2),t.prefix="./"),r},e.wrapOutput=(e,t={},r={})=>{let n=`${r.contains?"":"^"}(?:${e})${r.contains?"":"$"}`;return!0===t.negated&&(n=`(?:^(?!${n}).*$)`),n}}(se)),se}function ae(){if(ee)return J;ee=1;const e=f,t=function(){if(Y)return Z;Y=1;const e=ue(),{CHAR_ASTERISK:t,CHAR_AT:r,CHAR_BACKWARD_SLASH:n,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:i,CHAR_FORWARD_SLASH:u,CHAR_LEFT_CURLY_BRACE:a,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:A}=ie(),h=e=>e===u||e===n,R=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return Z=(E,_)=>{const y=_||{},C=E.length-1,m=!0===y.parts||!0===y.scanToEnd,v=[],S=[],b=[];let x,$,H=E,T=-1,w=0,L=0,O=!1,k=!1,N=!1,I=!1,M=!1,B=!1,j=!1,P=!1,D=!1,G=!1,U=0,K={value:"",depth:0,isGlob:!1};const q=()=>T>=C,F=()=>(x=$,H.charCodeAt(++T));for(;T<C;){let e;if($=F(),$!==n){if(!0===B||$===a){for(U++;!0!==q()&&($=F());)if($!==n)if($!==a){if(!0!==B&&$===s&&($=F())===s){if(O=K.isBrace=!0,N=K.isGlob=!0,G=!0,!0===m)continue;break}if(!0!==B&&$===o){if(O=K.isBrace=!0,N=K.isGlob=!0,G=!0,!0===m)continue;break}if($===g&&(U--,0===U)){B=!1,O=K.isBrace=!0,G=!0;break}}else U++;else j=K.backslashes=!0,F();if(!0===m)continue;break}if($!==u){if(!0!==y.noext&&!0==($===c||$===r||$===t||$===f||$===i)&&H.charCodeAt(T+1)===p){if(N=K.isGlob=!0,I=K.isExtglob=!0,G=!0,$===i&&T===w&&(D=!0),!0===m){for(;!0!==q()&&($=F());)if($!==n){if($===d){N=K.isGlob=!0,G=!0;break}}else j=K.backslashes=!0,$=F();continue}break}if($===t){if(x===t&&(M=K.isGlobstar=!0),N=K.isGlob=!0,G=!0,!0===m)continue;break}if($===f){if(N=K.isGlob=!0,G=!0,!0===m)continue;break}if($===l){for(;!0!==q()&&(e=F());)if(e!==n){if(e===A){k=K.isBracket=!0,N=K.isGlob=!0,G=!0;break}}else j=K.backslashes=!0,F();if(!0===m)continue;break}if(!0===y.nonegate||$!==i||T!==w){if(!0!==y.noparen&&$===p){if(N=K.isGlob=!0,!0===m){for(;!0!==q()&&($=F());)if($!==p){if($===d){G=!0;break}}else j=K.backslashes=!0,$=F();continue}break}if(!0===N){if(G=!0,!0===m)continue;break}}else P=K.negated=!0,w++}else{if(v.push(T),S.push(K),K={value:"",depth:0,isGlob:!1},!0===G)continue;if(x===s&&T===w+1){w+=2;continue}L=T+1}}else j=K.backslashes=!0,$=F(),$===a&&(B=!0)}!0===y.noext&&(I=!1,N=!1);let Q=H,W="",X="";w>0&&(W=H.slice(0,w),H=H.slice(w),L-=w),Q&&!0===N&&L>0?(Q=H.slice(0,L),X=H.slice(L)):!0===N?(Q="",X=H):Q=H,Q&&""!==Q&&"/"!==Q&&Q!==H&&h(Q.charCodeAt(Q.length-1))&&(Q=Q.slice(0,-1)),!0===y.unescape&&(X&&(X=e.removeBackslashes(X)),Q&&!0===j&&(Q=e.removeBackslashes(Q)));const Z={prefix:W,input:E,start:w,base:Q,glob:X,isBrace:O,isBracket:k,isGlob:N,isExtglob:I,isGlobstar:M,negated:P,negatedExtglob:D};if(!0===y.tokens&&(Z.maxDepth=0,h($)||S.push(K),Z.tokens=S),!0===y.parts||!0===y.tokens){let e;for(let t=0;t<v.length;t++){const r=e?e+1:w,n=v[t],o=E.slice(r,n);y.tokens&&(0===t&&0!==w?(S[t].isPrefix=!0,S[t].value=W):S[t].value=o,R(S[t]),Z.maxDepth+=S[t].depth),0===t&&""===o||b.push(o),e=n}if(e&&e+1<E.length){const t=E.slice(e+1);b.push(t),y.tokens&&(S[S.length-1].value=t,R(S[S.length-1]),Z.maxDepth+=S[S.length-1].depth)}Z.slashes=v,Z.parts=b}return Z}}(),r=function(){if(z)return V;z=1;const e=ie(),t=ue(),{MAX_LENGTH:r,POSIX_REGEX_SOURCE:n,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:i}=e,u=(e,r)=>{if("function"==typeof r.expandRange)return r.expandRange(...e,r);e.sort();const n=`[${e.join("-")}]`;try{new RegExp(n)}catch(r){return e.map((e=>t.escapeRegex(e))).join("..")}return n},a=(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=i[l]||l;const f={...c},g="number"==typeof f.maxLength?Math.min(r,f.maxLength):r;let d=l.length;if(d>g)throw new SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${g}`);const A={type:"bos",value:"",output:f.prepend||""},h=[A],R=f.capture?"":"?:",E=t.isWindows(c),_=e.globChars(E),y=e.extglobChars(_),{DOT_LITERAL:C,PLUS_LITERAL:m,SLASH_LITERAL:v,ONE_CHAR:S,DOTS_SLASH:b,NO_DOT:x,NO_DOT_SLASH:$,NO_DOTS_SLASH:H,QMARK:T,QMARK_NO_DOT:w,STAR:L,START_ANCHOR:O}=_,k=e=>`(${R}(?:(?!${O}${e.dot?b:C}).)*?)`,N=f.dot?"":x,I=f.dot?T:w;let M=!0===f.bash?k(f):L;f.capture&&(M=`(${M})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const B={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:h};l=t.removePrefix(l,B),d=l.length;const j=[],P=[],D=[];let G,U=A;const K=()=>B.index===d-1,q=B.peek=(e=1)=>l[B.index+e],F=B.advance=()=>l[++B.index]||"",Q=()=>l.slice(B.index+1),W=(e="",t=0)=>{B.consumed+=e,B.index+=t},X=e=>{B.output+=null!=e.output?e.output:e.value,W(e.value)},Z=()=>{let e=1;for(;"!"===q()&&("("!==q(2)||"?"===q(3));)F(),B.start++,e++;return e%2!=0&&(B.negated=!0,B.start++,!0)},Y=e=>{B[e]++,D.push(e)},V=e=>{B[e]--,D.pop()},z=e=>{if("globstar"===U.type){const t=B.braces>0&&("comma"===e.type||"brace"===e.type),r=!0===e.extglob||j.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||r||(B.output=B.output.slice(0,-U.output.length),U.type="star",U.value="*",U.output=M,B.output+=U.output)}if(j.length&&"paren"!==e.type&&(j[j.length-1].inner+=e.value),(e.value||e.output)&&X(e),U&&"text"===U.type&&"text"===e.type)return U.value+=e.value,void(U.output=(U.output||"")+e.value);e.prev=U,h.push(e),U=e},J=(e,t)=>{const r={...y[t],conditions:1,inner:""};r.prev=U,r.parens=B.parens,r.output=B.output;const n=(f.capture?"(":"")+r.open;Y("parens"),z({type:e,value:t,output:B.output?"":S}),z({type:"paren",extglob:!0,value:F(),output:n}),j.push(r)},ee=e=>{let t,r=e.close+(f.capture?")":"");if("negate"===e.type){let n=M;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(n=k(f)),(n!==M||K()||/^\)+$/.test(Q()))&&(r=e.close=`)$))${n}`),e.inner.includes("*")&&(t=Q())&&/^\.[^\\/.]+$/.test(t)){const o=p(t,{...c,fastpaths:!1}).output;r=e.close=`)${o})${n})`}"bos"===e.prev.type&&(B.negatedExtglob=!0)}z({type:"paren",extglob:!0,value:G,output:r}),V("parens")};if(!1!==f.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(l)){let e=!1,r=l.replace(s,((t,r,n,o,s,i)=>"\\"===o?(e=!0,t):"?"===o?r?r+o+(s?T.repeat(s.length):""):0===i?I+(s?T.repeat(s.length):""):T.repeat(n.length):"."===o?C.repeat(n.length):"*"===o?r?r+o+(s?M:""):M:r?t:`\\${t}`));return!0===e&&(r=!0===f.unescape?r.replace(/\\/g,""):r.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),r===l&&!0===f.contains?(B.output=l,B):(B.output=t.wrapOutput(r,B,c),B)}for(;!K();){if(G=F(),"\0"===G)continue;if("\\"===G){const e=q();if("/"===e&&!0!==f.bash)continue;if("."===e||";"===e)continue;if(!e){G+="\\",z({type:"text",value:G});continue}const t=/^\\+/.exec(Q());let r=0;if(t&&t[0].length>2&&(r=t[0].length,B.index+=r,r%2!=0&&(G+="\\")),!0===f.unescape?G=F():G+=F(),0===B.brackets){z({type:"text",value:G});continue}}if(B.brackets>0&&("]"!==G||"["===U.value||"[^"===U.value)){if(!1!==f.posix&&":"===G){const e=U.value.slice(1);if(e.includes("[")&&(U.posix=!0,e.includes(":"))){const e=U.value.lastIndexOf("["),t=U.value.slice(0,e),r=U.value.slice(e+2),o=n[r];if(o){U.value=t+o,B.backtrack=!0,F(),A.output||1!==h.indexOf(U)||(A.output=S);continue}}}("["===G&&":"!==q()||"-"===G&&"]"===q())&&(G=`\\${G}`),"]"!==G||"["!==U.value&&"[^"!==U.value||(G=`\\${G}`),!0===f.posix&&"!"===G&&"["===U.value&&(G="^"),U.value+=G,X({value:G});continue}if(1===B.quotes&&'"'!==G){G=t.escapeRegex(G),U.value+=G,X({value:G});continue}if('"'===G){B.quotes=1===B.quotes?0:1,!0===f.keepQuotes&&z({type:"text",value:G});continue}if("("===G){Y("parens"),z({type:"paren",value:G});continue}if(")"===G){if(0===B.parens&&!0===f.strictBrackets)throw new SyntaxError(a("opening","("));const e=j[j.length-1];if(e&&B.parens===e.parens+1){ee(j.pop());continue}z({type:"paren",value:G,output:B.parens?")":"\\)"}),V("parens");continue}if("["===G){if(!0!==f.nobracket&&Q().includes("]"))Y("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(a("closing","]"));G=`\\${G}`}z({type:"bracket",value:G});continue}if("]"===G){if(!0===f.nobracket||U&&"bracket"===U.type&&1===U.value.length){z({type:"text",value:G,output:`\\${G}`});continue}if(0===B.brackets){if(!0===f.strictBrackets)throw new SyntaxError(a("opening","["));z({type:"text",value:G,output:`\\${G}`});continue}V("brackets");const e=U.value.slice(1);if(!0===U.posix||"^"!==e[0]||e.includes("/")||(G=`/${G}`),U.value+=G,X({value:G}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const r=t.escapeRegex(U.value);if(B.output=B.output.slice(0,-U.value.length),!0===f.literalBrackets){B.output+=r,U.value=r;continue}U.value=`(${R}${r}|${U.value})`,B.output+=U.value;continue}if("{"===G&&!0!==f.nobrace){Y("braces");const e={type:"brace",value:G,output:"(",outputIndex:B.output.length,tokensIndex:B.tokens.length};P.push(e),z(e);continue}if("}"===G){const e=P[P.length-1];if(!0===f.nobrace||!e){z({type:"text",value:G,output:G});continue}let t=")";if(!0===e.dots){const e=h.slice(),r=[];for(let t=e.length-1;t>=0&&(h.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&r.unshift(e[t].value);t=u(r,f),B.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const r=B.output.slice(0,e.outputIndex),n=B.tokens.slice(e.tokensIndex);e.value=e.output="\\{",G=t="\\}",B.output=r;for(const e of n)B.output+=e.output||e.value}z({type:"brace",value:G,output:t}),V("braces"),P.pop();continue}if("|"===G){j.length>0&&j[j.length-1].conditions++,z({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="|"),z({type:"comma",value:G,output:e});continue}if("/"===G){if("dot"===U.type&&B.index===B.start+1){B.start=B.index+1,B.consumed="",B.output="",h.pop(),U=A;continue}z({type:"slash",value:G,output:v});continue}if("."===G){if(B.braces>0&&"dot"===U.type){"."===U.value&&(U.output=C);const e=P[P.length-1];U.type="dots",U.output+=G,U.value+=G,e.dots=!0;continue}if(B.braces+B.parens===0&&"bos"!==U.type&&"slash"!==U.type){z({type:"text",value:G,output:C});continue}z({type:"dot",value:G,output:C});continue}if("?"===G){if((!U||"("!==U.value)&&!0!==f.noextglob&&"("===q()&&"?"!==q(2)){J("qmark",G);continue}if(U&&"paren"===U.type){const e=q();let r=G;if("<"===e&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");("("===U.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(Q()))&&(r=`\\${G}`),z({type:"text",value:G,output:r});continue}if(!0!==f.dot&&("slash"===U.type||"bos"===U.type)){z({type:"qmark",value:G,output:w});continue}z({type:"qmark",value:G,output:T});continue}if("!"===G){if(!0!==f.noextglob&&"("===q()&&("?"!==q(2)||!/[!=<:]/.test(q(3)))){J("negate",G);continue}if(!0!==f.nonegate&&0===B.index){Z();continue}}if("+"===G){if(!0!==f.noextglob&&"("===q()&&"?"!==q(2)){J("plus",G);continue}if(U&&"("===U.value||!1===f.regex){z({type:"plus",value:G,output:m});continue}if(U&&("bracket"===U.type||"paren"===U.type||"brace"===U.type)||B.parens>0){z({type:"plus",value:G});continue}z({type:"plus",value:m});continue}if("@"===G){if(!0!==f.noextglob&&"("===q()&&"?"!==q(2)){z({type:"at",extglob:!0,value:G,output:""});continue}z({type:"text",value:G});continue}if("*"!==G){"$"!==G&&"^"!==G||(G=`\\${G}`);const e=o.exec(Q());e&&(G+=e[0],B.index+=e[0].length),z({type:"text",value:G});continue}if(U&&("globstar"===U.type||!0===U.star)){U.type="star",U.star=!0,U.value+=G,U.output=M,B.backtrack=!0,B.globstar=!0,W(G);continue}let e=Q();if(!0!==f.noextglob&&/^\([^?]/.test(e)){J("star",G);continue}if("star"===U.type){if(!0===f.noglobstar){W(G);continue}const t=U.prev,r=t.prev,n="slash"===t.type||"bos"===t.type,o=r&&("star"===r.type||"globstar"===r.type);if(!0===f.bash&&(!n||e[0]&&"/"!==e[0])){z({type:"star",value:G,output:""});continue}const s=B.braces>0&&("comma"===t.type||"brace"===t.type),i=j.length&&("pipe"===t.type||"paren"===t.type);if(!n&&"paren"!==t.type&&!s&&!i){z({type:"star",value:G,output:""});continue}for(;"/**"===e.slice(0,3);){const t=l[B.index+4];if(t&&"/"!==t)break;e=e.slice(3),W("/**",3)}if("bos"===t.type&&K()){U.type="globstar",U.value+=G,U.output=k(f),B.output=U.output,B.globstar=!0,W(G);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&K()){B.output=B.output.slice(0,-(t.output+U.output).length),t.output=`(?:${t.output}`,U.type="globstar",U.output=k(f)+(f.strictSlashes?")":"|$)"),U.value+=G,B.globstar=!0,B.output+=t.output+U.output,W(G);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const r=void 0!==e[1]?"|$":"";B.output=B.output.slice(0,-(t.output+U.output).length),t.output=`(?:${t.output}`,U.type="globstar",U.output=`${k(f)}${v}|${v}${r})`,U.value+=G,B.output+=t.output+U.output,B.globstar=!0,W(G+F()),z({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){U.type="globstar",U.value+=G,U.output=`(?:^|${v}|${k(f)}${v})`,B.output=U.output,B.globstar=!0,W(G+F()),z({type:"slash",value:"/",output:""});continue}B.output=B.output.slice(0,-U.output.length),U.type="globstar",U.output=k(f),U.value+=G,B.output+=U.output,B.globstar=!0,W(G);continue}const r={type:"star",value:G,output:M};!0!==f.bash?!U||"bracket"!==U.type&&"paren"!==U.type||!0!==f.regex?(B.index!==B.start&&"slash"!==U.type&&"dot"!==U.type||("dot"===U.type?(B.output+=$,U.output+=$):!0===f.dot?(B.output+=H,U.output+=H):(B.output+=N,U.output+=N),"*"!==q()&&(B.output+=S,U.output+=S)),z(r)):(r.output=G,z(r)):(r.output=".*?","bos"!==U.type&&"slash"!==U.type||(r.output=N+r.output),z(r))}for(;B.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(a("closing","]"));B.output=t.escapeLast(B.output,"["),V("brackets")}for(;B.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(a("closing",")"));B.output=t.escapeLast(B.output,"("),V("parens")}for(;B.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(a("closing","}"));B.output=t.escapeLast(B.output,"{"),V("braces")}if(!0===f.strictSlashes||"star"!==U.type&&"bracket"!==U.type||z({type:"maybe_slash",value:"",output:`${v}?`}),!0===B.backtrack){B.output="";for(const e of B.tokens)B.output+=null!=e.output?e.output:e.value,e.suffix&&(B.output+=e.suffix)}return B};return p.fastpaths=(n,o)=>{const s={...o},u="number"==typeof s.maxLength?Math.min(r,s.maxLength):r,a=n.length;if(a>u)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${u}`);n=i[n]||n;const p=t.isWindows(o),{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:g,NO_DOT:d,NO_DOTS:A,NO_DOTS_SLASH:h,STAR:R,START_ANCHOR:E}=e.globChars(p),_=s.dot?A:d,y=s.dot?h:d,C=s.capture?"":"?:";let m=!0===s.bash?".*?":R;s.capture&&(m=`(${m})`);const v=e=>!0===e.noglobstar?m:`(${C}(?:(?!${E}${e.dot?g:l}).)*?)`,S=e=>{switch(e){case"*":return`${_}${f}${m}`;case".*":return`${l}${f}${m}`;case"*.*":return`${_}${m}${l}${f}${m}`;case"*/*":return`${_}${m}${c}${f}${y}${m}`;case"**":return _+v(s);case"**/*":return`(?:${_}${v(s)}${c})?${y}${f}${m}`;case"**/*.*":return`(?:${_}${v(s)}${c})?${y}${m}${l}${f}${m}`;case"**/.*":return`(?:${_}${v(s)}${c})?${l}${f}${m}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const r=S(t[1]);if(!r)return;return r+l+t[2]}}},b=t.removePrefix(n,{negated:!1,prefix:""});let x=S(b);return x&&!0!==s.strictSlashes&&(x+=`${c}?`),x},V=p}(),n=ue(),o=ie(),s=(e,t,r=!1)=>{if(Array.isArray(e)){const n=e.map((e=>s(e,t,r))),o=e=>{for(const t of n){const r=t(e);if(r)return r}return!1};return o}const o=(i=e)&&"object"==typeof i&&!Array.isArray(i)&&e.tokens&&e.input;var i;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const u=t||{},a=n.isWindows(t),p=o?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=p.state;delete p.state;let c=()=>!1;if(u.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=s(u.ignore,e,r)}const f=(r,n=!1)=>{const{isMatch:o,match:i,output:f}=s.test(r,p,t,{glob:e,posix:a}),g={glob:e,state:l,regex:p,posix:a,input:r,output:f,match:i,isMatch:o};return"function"==typeof u.onResult&&u.onResult(g),!1===o?(g.isMatch=!1,!!n&&g):c(r)?("function"==typeof u.onIgnore&&u.onIgnore(g),g.isMatch=!1,!!n&&g):("function"==typeof u.onMatch&&u.onMatch(g),!n||g)};return r&&(f.state=l),f};return s.test=(e,t,r,{glob:o,posix:i}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const u=r||{},a=u.format||(i?n.toPosixSlashes:null);let p=e===o,l=p&&a?a(e):e;return!1===p&&(l=a?a(e):e,p=l===o),!1!==p&&!0!==u.capture||(p=!0===u.matchBase||!0===u.basename?s.matchBase(e,t,r,i):t.exec(l)),{isMatch:Boolean(p),match:p,output:l}},s.matchBase=(t,r,o,i=n.isWindows(o))=>(r instanceof RegExp?r:s.makeRe(r,o)).test(e.basename(t)),s.isMatch=(e,t,r)=>s(t,r)(e),s.parse=(e,t)=>Array.isArray(e)?e.map((e=>s.parse(e,t))):r(e,{...t,fastpaths:!1}),s.scan=(e,r)=>t(e,r),s.compileRe=(e,t,r=!1,n=!1)=>{if(!0===r)return e.output;const o=t||{},i=o.contains?"":"^",u=o.contains?"":"$";let a=`${i}(?:${e.output})${u}`;e&&!0===e.negated&&(a=`^(?!${a}).*$`);const p=s.toRegex(a,t);return!0===n&&(p.state=e),p},s.makeRe=(e,t={},n=!1,o=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(i.output=r.fastpaths(e,t)),i.output||(i=r(e,t)),s.compileRe(i,t,n,o)},s.toRegex=(e,t)=>{try{const r=t||{};return new RegExp(e,r.flags||(r.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},s.constants=o,J=s}function pe(){return re?te:(re=1,te=ae())}var le=function(){if(oe)return ne;oe=1;const e=c,t=F(),r=pe(),n=ue(),o=e=>""===e||"./"===e,s=(e,t,n)=>{t=[].concat(t),e=[].concat(e);let o=new Set,s=new Set,i=new Set,u=0,a=e=>{i.add(e.output),n&&n.onResult&&n.onResult(e)};for(let i=0;i<t.length;i++){let p=r(String(t[i]),{...n,onResult:a},!0),l=p.state.negated||p.state.negatedExtglob;l&&u++;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=(u===t.length?[...i]:[...s]).filter((e=>!o.has(e)));if(n&&0===p.length){if(!0===n.failglob)throw new Error(`No matches found for "${t.join(", ")}"`);if(!0===n.nonull||!0===n.nullglob)return n.unescape?t.map((e=>e.replace(/\\/g,""))):t}return p};return s.match=s,s.matcher=(e,t)=>r(e,t),s.any=s.isMatch=(e,t,n)=>r(t,n)(e),s.not=(e,t,r={})=>{t=[].concat(t).map(String);let n=new Set,o=[],i=new Set(s(e,t,{...r,onResult:e=>{r.onResult&&r.onResult(e),o.push(e.output)}}));for(let e of o)i.has(e)||n.add(e);return[...n]},s.contains=(t,r,n)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);if(Array.isArray(r))return r.some((e=>s.contains(t,e,n)));if("string"==typeof r){if(o(t)||o(r))return!1;if(t.includes(r)||t.startsWith("./")&&t.slice(2).includes(r))return!0}return s.isMatch(t,r,{...n,contains:!0})},s.matchKeys=(e,t,r)=>{if(!n.isObject(e))throw new TypeError("Expected the first argument to be an object");let o=s(Object.keys(e),t,r),i={};for(let t of o)i[t]=e[t];return i},s.some=(e,t,n)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=r(String(e),n);if(o.some((e=>t(e))))return!0}return!1},s.every=(e,t,n)=>{let o=[].concat(e);for(let e of[].concat(t)){let t=r(String(e),n);if(!o.every((e=>t(e))))return!1}return!0},s.all=(t,n,o)=>{if("string"!=typeof t)throw new TypeError(`Expected a string: "${e.inspect(t)}"`);return[].concat(n).every((e=>r(e,o)(t)))},s.capture=(e,t,o)=>{let s=n.isWindows(o),i=r.makeRe(String(e),{...o,capture:!0}).exec(s?n.toPosixSlashes(t):t);if(i)return i.slice(1).map((e=>void 0===e?"":e))},s.makeRe=(...e)=>r.makeRe(...e),s.scan=(...e)=>r.scan(...e),s.parse=(e,n)=>{let o=[];for(let s of[].concat(e||[]))for(let e of t(String(s),n))o.push(r.parse(e,n));return o},s.braces=(e,r)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return r&&!0===r.nobrace||!/\{.*\}/.test(e)?[e]:t(e,r)},s.braceExpand=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");return s.braces(e,{...t,expand:!0})},ne=s}();const ce=(e,t)=>new Set([...e].filter((e=>t.has(e))));let fe;function ge(){if(fe)return fe;const e=A.program.getOptionValue("root");return fe=e?t.isAbsolute(e)?e:t.resolve(process.cwd(),e):void 0,fe}let de,Ae="";try{R.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:B&&B.src||new URL("index.min.cjs",document.baseURI).href).resolve("@pnpm/filter-workspace-packages"),Ae="pnpm"}catch{}""!==Ae&&A.program.option("-f, --filter <filter>","filter packages");let he,Re=!1;function Ee(e){try{return require.resolve(e),!0}catch(e){return!1}}const _e=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of _e)if(Ee(e)){he=e;break}let ye="jiek.config";var Ce=(e={})=>{const{onEvent:t}=e;return{name:"progress",buildStart:()=>t?.("start","Start building..."),buildEnd:()=>t?.("end","Build completed!"),resolveId:{order:"post",handler:e=>t?.("resolve",`Resolving ${e}...`)},load:{order:"post",handler:e=>t?.("load",`Loading ${e}...`)},transform:{order:"post",handler:(e,r)=>t?.("transform",`Transforming ${r}...`)}}},me=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const{JIEK_ROOT:ve,JIEK_ENTRIES:Se}=process.env,be=ve??o.getWorkspaceDir(),xe={},$e=[i()],He=function(r){const{wd:n}=function(){if(de)return{wd:de,notWorkspace:Re};const e=ge();if(void 0!==e){const t=o.isWorkspaceDir(e,Ae);return Re=!t,de=e,{wd:de,notWorkspace:Re}}try{de=o.getWorkspaceDir(Ae)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;de=e,Re=!0}return{wd:de,notWorkspace:Re}}();let s=A.program.getOptionValue("configPath");if(s){if(!e.existsSync(s))throw new Error(`config file not found: ${s}`);t.isAbsolute(s)||(s=t.resolve(n,s))}else s=function(r,n){const o=!!he;function s(o){const s=[t.resolve(process.cwd(),`${ye}.${o}`),t.resolve(process.cwd(),`.${ye}.${o}`),t.resolve(r,`${ye}.${o}`),t.resolve(r,`.${ye}.${o}`)];n&&s.unshift(t.resolve(n,`${ye}.${o}`),t.resolve(n,`.${ye}.${o}`));for(const t of s)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return ye=s("js")??ye,ye=s("json")??ye,ye=s("yaml")??ye,o&&(ye=s("ts")??ye),t.resolve(r,ye)}(n,r);const i=t.extname(s);let u;switch(i){case".js":u=require(s);break;case".json":return require(s);case".yaml":return h.load(e.readFileSync(s,"utf-8"));case".ts":if(he){require(he),u=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":u={};break;default:throw new Error(`unsupported config file type: ${i}`)}if(!u)throw new Error("config file is empty");return u.default??u}()??{},{build:Te={}}=He,we=`./${t.relative(process.cwd(),t.resolve(("object"==typeof Te?.output?.dir?Te.output.dir.js:Te?.output?.dir)??"dist"))}`,Le=/\.(css|s[ac]ss|less|styl)$/,Oe=e=>t.resolve(be,e),ke=e=>e.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())).replace(/(?:^|-)(\w)/g,((e,t)=>t.toUpperCase())),Ne=(e,t=Te?.output?.minify)=>!1===t?[e]:"only-minify"===t?[{...e,file:e.file?.replace(/(\.[cm]?js)$/,".min$1"),plugins:[...e.plugins??[],a()]}]:[e,{...e,file:e.file?.replace(/(\.[cm]?js)$/,".min$1"),plugins:[...e.plugins??[],a()]}],Ie=r=>{r=t.resolve(r);const n=t.dirname(r),{extends:o,...s}=(i=r,e.existsSync(i)&&e.statSync(i).isFile()?l.parse(e.readFileSync(i,"utf-8"),[],{allowTrailingComma:!0,allowEmptyContent:!0}):{});var i;const u=(a=o?Array.isArray(o)?o:[o]:[],a?.map((e=>t.resolve(n,e)))??[]);var a;return 0===u.length?s:u.map(Ie).reduce(((e,{compilerOptions:t={},references:r,...n})=>({...e,...n,compilerOptions:{...e.compilerOptions,...t}})),s)},Me=(e,r)=>{e=t.resolve(e),r=t.resolve(r);const n=t.dirname(e),o=Ie(e),[s,i,u,a]=[o.references?.map((({path:e})=>e)),o.files,o.include,o.exclude].map((e=>e?.map((e=>t.resolve(n,e)))??[]));if(a.length>0&&a.some((e=>le.isMatch(r,e))))return;if(0===o.files?.length&&0===o.include?.length)return;let p=!1;if(p||(p=i.length>0&&i.includes(r)),p||(p=u.length>0&&u.some((e=>le.isMatch(r,e)))),p)return o.compilerOptions??{};if(!(o.files&&o.files.length>0||o.include&&o.include.length>0)){s.reverse();for(const e of s){const t=Me(e,r);if(t)return t}return o.compilerOptions}},Be=({path:r,name:o,input:i,output:a,external:l,pkgIsModule:c,conditionals:f},A={})=>{const h=f.includes("import"),R=f.includes("require"),E=f.includes("browser");let _;[Oe("tsconfig.json"),Oe("tsconfig.dts.json")].forEach((t=>{e.existsSync(t)&&e.statSync(t).isFile()&&(_=t)}));let y={};if(_){const e=Me(_,t.resolve(i)),{options:r,errors:n}=d.convertCompilerOptionsFromJson(e,t.dirname(_));if(n.length>0)throw new Error(n.map((e=>e.messageText)).join("\n"));y=r}const C=[...f,...y.customConditions??[]],m={type:"progress",data:{name:o,path:r,exportConditions:C,input:i}},v=A?.output?.dir;return[{input:i,external:l,output:[...Ne({file:a,name:o,sourcemap:"object"==typeof A?.output?.sourcemap?A.output.sourcemap.js:A?.output?.sourcemap,format:h?"esm":R?"cjs":E?"umd":c?"esm":"cjs",strict:"object"==typeof A?.output?.strict?A.output.strict.js:A?.output?.strict})],plugins:[u.nodeResolve({exportConditions:C}),import("rollup-plugin-postcss").then((({default:e})=>e({extract:t.resolve(a.replace(/\.[cm]?js$/,".css")),minimize:!0}))).catch((()=>{})),g(),s(),Ce({onEvent:(e,t)=>p.sendMessage({...m,data:{...m.data,event:e,message:t,tags:["js"]}})})]},{input:i,external:l,output:[{dir:t.resolve(("object"==typeof v?v.dts:v)??"dist"),sourcemap:"object"==typeof A?.output?.sourcemap?A.output.sourcemap.dts:A?.output?.sourcemap,entryFileNames:()=>a.replace(`${we}/`,"").replace(/(\.[cm]?)js$/,".d$1ts"),strict:"object"==typeof A?.output?.strict?A.output.strict.dts:A?.output?.strict}],plugins:[u.nodeResolve({exportConditions:C}),me({patterns:[Le]}),n.dts({respectExternal:!0,compilerOptions:y}),Ce({onEvent:(e,t)=>p.sendMessage({...m,data:{...m.data,event:e,message:t,tags:["dts"]}})})]}]};exports.template=function(n){const{name:o,type:s,exports:i}=n,u="module"===s;if(!o)throw new Error("package.json name is required");if(!i)throw new Error("package.json exports is required");const a=Se?.split(",").map((e=>e.trim())).map((e=>({index:"."}[e]??e))),l=ke(o),c=function(t=process.cwd()){const r="string"==typeof t?e.existsSync(`${t}/package.json`)?JSON.parse(e.readFileSync(`${t}/package.json`,"utf-8")):{}:t,{dependencies:n={},peerDependencies:o={},optionalDependencies:s={}}=r;return Object.keys(n).concat(Object.keys(o)).concat(Object.keys(s)).map((e=>new RegExp(`^${e}(/.*)?$`))).concat([/^node:/])}(n),[f,g]=function({entrypoints:e,pkgIsModule:n,entries:o,config:s,dir:i,noFilter:u,withSource:a,withSuffix:p}){const{build:l={}}=s??{},{crossModuleConvertor:c=!0}=l,f=`./${g=((...e)=>t.resolve(i??process.cwd(),...e))(("object"==typeof l?.output?.dir?l.output.dir.js:l?.output?.dir)??"dist"),t.relative(i??process.cwd(),g)}`;var g;const[,d]=r.resolveEntrypoints(e);o&&Object.entries(d).forEach((([e])=>{o.some((t=>le.isMatch(e,t,{matchBase:!0})))||delete d[e]}));const A=u?d:r.filterLeafs(d,{skipValue:[/(^|\/)\.jk-noentry/,...r.DEFAULT_SKIP_VALUES]}),h=c?{import:e=>!n&&0===ce(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!n||0!==ce(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{};return[A,r.entrypoints2Exports(A,{outdir:f,withSource:a,withSuffix:p,withConditional:{...h}})]}({entrypoints:i,pkgIsModule:u,entries:a,config:He}),d=new Map;r.getAllLeafs(f,(({keys:e,value:t})=>{if("string"==typeof t){const r=d.get(t)??[];d.set(t,r),r.push(e)}return!1}));const A=[];return d.forEach(((e,t)=>e.forEach((e=>{const[n,...o]=e,s=l+("."===n?"":ke(n)),i=((e,t)=>t.reduce(((e,t)=>{if("string"==typeof e)throw new Error("key not found in exports");if(!(t in e))throw new Error(`key ${t} not found in exports`);return e[t]}),e))(g,e),a={path:n,name:s,input:t,external:c,pkgIsModule:u};switch(typeof i){case"string":A.push(...Be({...a,output:i,conditionals:o},Te));break;case"object":r.getAllLeafs(i,(({keys:e,value:t})=>{const r=[...new Set([...o,...e])];return"string"==typeof t&&A.push(...Be({...a,output:t,conditionals:r},Te)),!1}))}})))),p.sendMessage({type:"init",data:{leafMap:d,targetsLength:A.length}}),A.map((e=>({...xe,...e,plugins:[...$e,e.plugins]})))};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import e from"node:fs";import t,{resolve as n,relative as r,dirname as o}from"node:path";import{resolveEntrypoints as s,filterLeafs as i,DEFAULT_SKIP_VALUES as u,entrypoints2Exports as a,getAllLeafs as p}from"@jiek/pkger/entrypoints";import{dts as l}from"@jiek/rollup-plugin-dts";import{isWorkspaceDir as c,getWorkspaceDir as f}from"@jiek/utils/getWorkspaceDir";import g from"@rollup/plugin-commonjs";import d from"@rollup/plugin-json";import{nodeResolve as A}from"@rollup/plugin-node-resolve";import h from"@rollup/plugin-terser";import{sendMessage as R}from"execa";import{parse as E}from"jsonc-parser";import _ from"util";import y from"path";import m from"rollup-plugin-esbuild";import C from"typescript";import{program as S}from"commander";import{load as b}from"js-yaml";import{createRequire as v}from"node:module";import"@pnpm/filter-workspace-packages";var x,$,H,T,w,L,O,k,N,I,M,B,j,P,G,D,K,U,F,Q={};function W(){return x||(x=1,(e=Q).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}),Q;var e}function X(){if(H)return $;H=1;const e=W();return $=(t,n={})=>{let r=(t,o={})=>{let s=n.escapeInvalid&&e.isInvalidBrace(o),i=!0===t.invalid&&!0===n.escapeInvalid,u="";if(t.value)return(s||i)&&e.isOpenOrClose(t)?"\\"+t.value:t.value;if(t.value)return t.value;if(t.nodes)for(let e of t.nodes)u+=r(e);return u};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 q(){return w?T:(w=1,T=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 Z(){if(O)return L;O=1;const e=q(),t=(n,s,i)=>{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 u={relaxZeros:!0,...i};"boolean"==typeof u.strictZeros&&(u.relaxZeros=!1===u.strictZeros);let a=n+":"+s+"="+String(u.relaxZeros)+String(u.shorthand)+String(u.capture)+String(u.wrap);if(t.cache.hasOwnProperty(a))return t.cache[a].result;let p=Math.min(n,s),l=Math.max(n,s);if(1===Math.abs(p-l)){let e=n+"|"+s;return u.capture?`(${e})`:!1===u.wrap?e:`(?:${e})`}let f=c(n)||c(s),g={min:n,max:s,a:p,b:l},d=[],A=[];if(f&&(g.isPadded=f,g.maxLen=String(g.max).length),p<0){A=r(l<0?Math.abs(l):1,Math.abs(p),g,u),p=g.a=0}return l>=0&&(d=r(p,l,g,u)),g.negatives=A,g.positives=d,g.result=function(e,t,n){let r=o(e,t,"-",!1)||[],s=o(t,e,"",!1)||[],i=o(e,t,"-?",!0)||[];return r.concat(i).concat(s).join("|")}(A,d),!0===u.capture?g.result=`(${g.result})`:!1!==u.wrap&&d.length+A.length>1&&(g.result=`(?:${g.result})`),t.cache[a]=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="",i=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):i++}return i&&(s+=!0===n.shorthand?"\\d":"[0-9]"),{pattern:s,count:[i],digits:o}}function r(e,t,r,o){let i,l=function(e,t){let n=1,r=1,o=u(e,n),i=new Set([t]);for(;e<=o&&o<=t;)i.add(o),n+=1,o=u(e,n);for(o=a(t+1,r)-1;e<o&&o<=t;)i.add(o),r+=1,o=a(t+1,r)-1;return i=[...i],i.sort(s),i}(e,t),c=[],g=e;for(let e=0;e<l.length;e++){let t=l[e],s=n(String(g),String(t),o),u="";r.isPadded||!i||i.pattern!==s.pattern?(r.isPadded&&(u=f(t,r,o)),s.string=u+s.pattern+p(s.count),c.push(s),g=t+1,i=s):(i.count.length>1&&i.count.pop(),i.count.push(s.count[0]),i.string=i.pattern+p(i.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||i(t,"string",e)||s.push(n+e),r&&i(t,"string",e)&&s.push(n+e)}return s}function s(e,t){return e>t?1:t>e?-1:0}function i(e,t,n){return e.some((e=>e[t]===n))}function u(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function a(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={},L=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 Y(){if(N)return k;N=1;const e=_,t=Z(),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},i=(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},u=(e,t)=>{let n="-"===e[0]?"-":"";for(n&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return n?"-"+e:e},a=(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),A=String(n);n=Math.max(Math.abs(n),1);let h=s(g)||s(d)||s(A),R=h?Math.max(g.length,d.length,A.length):0,E=!1===h&&!1===((e,t,n)=>"string"==typeof e||"string"==typeof t||!0===n.stringify)(e,t,r),_=r.transform||(e=>t=>!0===e?Number(t):String(t))(E);if(r.toRegex&&1===n)return a(u(e,R),u(t,R),!0,r);let y={negatives:[],positives:[]},m=[],C=0;for(;f?o>=c:o<=c;)!0===r.toRegex&&n>1?y[(S=o)<0?"negatives":"positives"].push(Math.abs(S)):m.push(i(_(o,C),R,E)),o=f?o-n:o+n,C++;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})(y,r):p(m,null,{wrap:!1,...r}):m},g=(e,t,s,i={})=>{if(null==t&&r(e))return[e];if(!r(e)||!r(t))return c(e,t,i);if("function"==typeof s)return g(e,t,1,{transform:s});if(n(s))return g(e,t,0,s);let u={...i};return!0===u.capture&&(u.wrap=!0),s=s||u.step||1,o(s)?o(e)&&o(t)?f(e,t,s,u):((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)),i=`${e}`.charCodeAt(0),u=`${t}`.charCodeAt(0),l=i>u,f=Math.min(i,u),g=Math.max(i,u);if(r.toRegex&&1===n)return a(f,g,!1,r);let d=[],A=0;for(;l?i>=u:i<=u;)d.push(s(i,A)),i=l?i-n:i+n,A++;return!0===r.toRegex?p(d,null,{wrap:!1,options:r}):d})(e,t,Math.max(Math.abs(s),1),u):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,u)};return k=g}function z(){if(K)return D;K=1;const e=X(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:i,CHAR_RIGHT_PARENTHESES:u,CHAR_LEFT_CURLY_BRACE:a,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:A}=G?P:(G=1,P={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 D=(h,R={})=>{if("string"!=typeof h)throw new TypeError("Expected a string");let E=R||{},_="number"==typeof E.maxLength?Math.min(t,E.maxLength):t;if(h.length>_)throw new SyntaxError(`Input length (${h.length}), exceeds max characters (${_})`);let y,m={type:"root",input:h,nodes:[]},C=[m],S=m,b=m,v=0,x=h.length,$=0,H=0;const T=()=>h[$++],w=e=>{if("text"===e.type&&"dot"===b.type&&(b.type="text"),!b||"text"!==b.type||"text"!==e.type)return S.nodes.push(e),e.parent=S,e.prev=b,b=e,e;b.value+=e.value};for(w({type:"bos"});$<x;)if(S=C[C.length-1],y=T(),y!==A&&y!==d)if(y!==n)if(y!==c)if(y!==l)if(y!==i)if(y!==u)if(y!==f&&y!==g&&y!==r)if(y!==a)if(y!==p)if(y===o&&H>0){if(S.ranges>0){S.ranges=0;let t=S.nodes.shift();S.nodes=[t,{type:"text",value:e(S)}]}w({type:"comma",value:y}),S.commas++}else if(y===s&&H>0&&0===S.commas){let e=S.nodes;if(0===H||0===e.length){w({type:"text",value:y});continue}if("dot"===b.type){if(S.range=[],b.value+=y,b.type="range",3!==S.nodes.length&&5!==S.nodes.length){S.invalid=!0,S.ranges=0,b.type="text";continue}S.ranges++,S.args=[];continue}if("range"===b.type){e.pop();let t=e[e.length-1];t.value+=b.value+y,b=t,S.ranges--;continue}w({type:"dot",value:y})}else w({type:"text",value:y});else{if("brace"!==S.type){w({type:"text",value:y});continue}let e="close";S=C.pop(),S.close=!0,w({type:e,value:y}),H--,S=C[C.length-1]}else{H++;let e=b.value&&"$"===b.value.slice(-1)||!0===S.dollar;S=w({type:"brace",open:!0,close:!1,dollar:e,depth:H,commas:0,ranges:0,nodes:[]}),C.push(S),w({type:"open",value:y})}else{let e,t=y;for(!0!==R.keepQuotes&&(y="");$<x&&(e=T());)if(e!==n){if(e===t){!0===R.keepQuotes&&(y+=e);break}y+=e}else y+=e+T();w({type:"text",value:y})}else{if("paren"!==S.type){w({type:"text",value:y});continue}S=C.pop(),w({type:"text",value:y}),S=C[C.length-1]}else S=w({type:"paren",nodes:[]}),C.push(S),w({type:"text",value:y});else{let e;for(v++;$<x&&(e=T());)if(y+=e,e!==l)if(e!==n){if(e===c&&(v--,0===v))break}else y+=T();else v++;w({type:"text",value:y})}else w({type:"text",value:"\\"+y});else w({type:"text",value:(R.keepEscaping?y:"")+T()});do{if(S=C.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=C[C.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}}while(C.length>0);return w({type:"eos"}),m},D}function V(){if(F)return U;F=1;const e=X(),t=function(){if(M)return I;M=1;const e=Y(),t=W();return I=(n,r={})=>{let o=(n,s={})=>{let i=t.isInvalidBrace(s),u=!0===n.invalid&&!0===r.escapeInvalid,a=!0===i||!0===u,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 a?p+n.value:"(";if("close"===n.type)return a?p+n.value:")";if("comma"===n.type)return"comma"===n.prev.type?"":a?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(j)return B;j=1;const e=Y(),t=X(),n=W(),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 B=(o,s={})=>{let i=void 0===s.rangeLimit?1e3:s.rangeLimit,u=(o,a={})=>{o.queue=[];let p=a,l=a.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 u=n.reduce(o.nodes);if(n.exceedsLimit(...u,s.step,i))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let a=e(...u,s);return 0===a.length&&(a=t(o,s)),l.push(r(l.pop(),a)),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&&u(t,o):l.push(r(l.pop(),f,c)):(1===e&&f.push(""),f.push(""))}return f};return n.flatten(u(o))}}(),r=z(),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),U=o}var J,ee,te,ne,re,oe,se,ie,ue,ae,pe,le,ce,fe={};function ge(){if(ee)return J;ee=1;const e=y,t="\\\\/",n=`[^${t}]`,r="\\.",o="\\/",s="[^/]",i=`(?:${o}|$)`,u=`(?:^|${o})`,a=`${r}{1,2}${i}`,p={DOT_LITERAL:r,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:o,ONE_CHAR:"(?=.)",QMARK:s,END_ANCHOR:i,DOTS_SLASH:a,NO_DOT:`(?!${r})`,NO_DOTS:`(?!${u}${a})`,NO_DOT_SLASH:`(?!${r}{0,1}${i})`,NO_DOTS_SLASH:`(?!${a})`,QMARK_NO_DOT:`[^.${o}]`,STAR:`${s}*?`,START_ANCHOR:u},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 J={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 de(){return te||(te=1,function(e){const t=y,n="win32"===process.platform,{REGEX_BACKSLASH:r,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_GLOBAL:i}=ge();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(i,"\\$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}}(fe)),fe}function Ae(){if(ue)return ie;ue=1;const e=y,t=function(){if(re)return ne;re=1;const e=de(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:i,CHAR_FORWARD_SLASH:u,CHAR_LEFT_CURLY_BRACE:a,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:A}=ge(),h=e=>e===u||e===r,R=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};return ne=(E,_)=>{const y=_||{},m=E.length-1,C=!0===y.parts||!0===y.scanToEnd,S=[],b=[],v=[];let x,$,H=E,T=-1,w=0,L=0,O=!1,k=!1,N=!1,I=!1,M=!1,B=!1,j=!1,P=!1,G=!1,D=!1,K=0,U={value:"",depth:0,isGlob:!1};const F=()=>T>=m,Q=()=>(x=$,H.charCodeAt(++T));for(;T<m;){let e;if($=Q(),$!==r){if(!0===B||$===a){for(K++;!0!==F()&&($=Q());)if($!==r)if($!==a){if(!0!==B&&$===s&&($=Q())===s){if(O=U.isBrace=!0,N=U.isGlob=!0,D=!0,!0===C)continue;break}if(!0!==B&&$===o){if(O=U.isBrace=!0,N=U.isGlob=!0,D=!0,!0===C)continue;break}if($===g&&(K--,0===K)){B=!1,O=U.isBrace=!0,D=!0;break}}else K++;else j=U.backslashes=!0,Q();if(!0===C)continue;break}if($!==u){if(!0!==y.noext&&!0==($===c||$===n||$===t||$===f||$===i)&&H.charCodeAt(T+1)===p){if(N=U.isGlob=!0,I=U.isExtglob=!0,D=!0,$===i&&T===w&&(G=!0),!0===C){for(;!0!==F()&&($=Q());)if($!==r){if($===d){N=U.isGlob=!0,D=!0;break}}else j=U.backslashes=!0,$=Q();continue}break}if($===t){if(x===t&&(M=U.isGlobstar=!0),N=U.isGlob=!0,D=!0,!0===C)continue;break}if($===f){if(N=U.isGlob=!0,D=!0,!0===C)continue;break}if($===l){for(;!0!==F()&&(e=Q());)if(e!==r){if(e===A){k=U.isBracket=!0,N=U.isGlob=!0,D=!0;break}}else j=U.backslashes=!0,Q();if(!0===C)continue;break}if(!0===y.nonegate||$!==i||T!==w){if(!0!==y.noparen&&$===p){if(N=U.isGlob=!0,!0===C){for(;!0!==F()&&($=Q());)if($!==p){if($===d){D=!0;break}}else j=U.backslashes=!0,$=Q();continue}break}if(!0===N){if(D=!0,!0===C)continue;break}}else P=U.negated=!0,w++}else{if(S.push(T),b.push(U),U={value:"",depth:0,isGlob:!1},!0===D)continue;if(x===s&&T===w+1){w+=2;continue}L=T+1}}else j=U.backslashes=!0,$=Q(),$===a&&(B=!0)}!0===y.noext&&(I=!1,N=!1);let W=H,X="",q="";w>0&&(X=H.slice(0,w),H=H.slice(w),L-=w),W&&!0===N&&L>0?(W=H.slice(0,L),q=H.slice(L)):!0===N?(W="",q=H):W=H,W&&""!==W&&"/"!==W&&W!==H&&h(W.charCodeAt(W.length-1))&&(W=W.slice(0,-1)),!0===y.unescape&&(q&&(q=e.removeBackslashes(q)),W&&!0===j&&(W=e.removeBackslashes(W)));const Z={prefix:X,input:E,start:w,base:W,glob:q,isBrace:O,isBracket:k,isGlob:N,isExtglob:I,isGlobstar:M,negated:P,negatedExtglob:G};if(!0===y.tokens&&(Z.maxDepth=0,h($)||b.push(U),Z.tokens=b),!0===y.parts||!0===y.tokens){let e;for(let t=0;t<S.length;t++){const n=e?e+1:w,r=S[t],o=E.slice(n,r);y.tokens&&(0===t&&0!==w?(b[t].isPrefix=!0,b[t].value=X):b[t].value=o,R(b[t]),Z.maxDepth+=b[t].depth),0===t&&""===o||v.push(o),e=r}if(e&&e+1<E.length){const t=E.slice(e+1);v.push(t),y.tokens&&(b[b.length-1].value=t,R(b[b.length-1]),Z.maxDepth+=b[b.length-1].depth)}Z.slashes=S,Z.parts=v}return Z}}(),n=function(){if(se)return oe;se=1;const e=ge(),t=de(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:i}=e,u=(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},a=(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=i[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 A={type:"bos",value:"",output:f.prepend||""},h=[A],R=f.capture?"":"?:",E=t.isWindows(c),_=e.globChars(E),y=e.extglobChars(_),{DOT_LITERAL:m,PLUS_LITERAL:C,SLASH_LITERAL:S,ONE_CHAR:b,DOTS_SLASH:v,NO_DOT:x,NO_DOT_SLASH:$,NO_DOTS_SLASH:H,QMARK:T,QMARK_NO_DOT:w,STAR:L,START_ANCHOR:O}=_,k=e=>`(${R}(?:(?!${O}${e.dot?v:m}).)*?)`,N=f.dot?"":x,I=f.dot?T:w;let M=!0===f.bash?k(f):L;f.capture&&(M=`(${M})`),"boolean"==typeof f.noext&&(f.noextglob=f.noext);const B={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:h};l=t.removePrefix(l,B),d=l.length;const j=[],P=[],G=[];let D,K=A;const U=()=>B.index===d-1,F=B.peek=(e=1)=>l[B.index+e],Q=B.advance=()=>l[++B.index]||"",W=()=>l.slice(B.index+1),X=(e="",t=0)=>{B.consumed+=e,B.index+=t},q=e=>{B.output+=null!=e.output?e.output:e.value,X(e.value)},Z=()=>{let e=1;for(;"!"===F()&&("("!==F(2)||"?"===F(3));)Q(),B.start++,e++;return e%2!=0&&(B.negated=!0,B.start++,!0)},Y=e=>{B[e]++,G.push(e)},z=e=>{B[e]--,G.pop()},V=e=>{if("globstar"===K.type){const t=B.braces>0&&("comma"===e.type||"brace"===e.type),n=!0===e.extglob||j.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||n||(B.output=B.output.slice(0,-K.output.length),K.type="star",K.value="*",K.output=M,B.output+=K.output)}if(j.length&&"paren"!==e.type&&(j[j.length-1].inner+=e.value),(e.value||e.output)&&q(e),K&&"text"===K.type&&"text"===e.type)return K.value+=e.value,void(K.output=(K.output||"")+e.value);e.prev=K,h.push(e),K=e},J=(e,t)=>{const n={...y[t],conditions:1,inner:""};n.prev=K,n.parens=B.parens,n.output=B.output;const r=(f.capture?"(":"")+n.open;Y("parens"),V({type:e,value:t,output:B.output?"":b}),V({type:"paren",extglob:!0,value:Q(),output:r}),j.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=k(f)),(r!==M||U()||/^\)+$/.test(W()))&&(n=e.close=`)$))${r}`),e.inner.includes("*")&&(t=W())&&/^\.[^\\/.]+$/.test(t)){const o=p(t,{...c,fastpaths:!1}).output;n=e.close=`)${o})${r})`}"bos"===e.prev.type&&(B.negatedExtglob=!0)}V({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,i)=>"\\"===o?(e=!0,t):"?"===o?n?n+o+(s?T.repeat(s.length):""):0===i?I+(s?T.repeat(s.length):""):T.repeat(r.length):"."===o?m.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?(B.output=l,B):(B.output=t.wrapOutput(n,B,c),B)}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+="\\",V({type:"text",value:D});continue}const t=/^\\+/.exec(W());let n=0;if(t&&t[0].length>2&&(n=t[0].length,B.index+=n,n%2!=0&&(D+="\\")),!0===f.unescape?D=Q():D+=Q(),0===B.brackets){V({type:"text",value:D});continue}}if(B.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,B.backtrack=!0,Q(),A.output||1!==h.indexOf(K)||(A.output=b);continue}}}("["===D&&":"!==F()||"-"===D&&"]"===F())&&(D=`\\${D}`),"]"!==D||"["!==K.value&&"[^"!==K.value||(D=`\\${D}`),!0===f.posix&&"!"===D&&"["===K.value&&(D="^"),K.value+=D,q({value:D});continue}if(1===B.quotes&&'"'!==D){D=t.escapeRegex(D),K.value+=D,q({value:D});continue}if('"'===D){B.quotes=1===B.quotes?0:1,!0===f.keepQuotes&&V({type:"text",value:D});continue}if("("===D){Y("parens"),V({type:"paren",value:D});continue}if(")"===D){if(0===B.parens&&!0===f.strictBrackets)throw new SyntaxError(a("opening","("));const e=j[j.length-1];if(e&&B.parens===e.parens+1){ee(j.pop());continue}V({type:"paren",value:D,output:B.parens?")":"\\)"}),z("parens");continue}if("["===D){if(!0!==f.nobracket&&W().includes("]"))Y("brackets");else{if(!0!==f.nobracket&&!0===f.strictBrackets)throw new SyntaxError(a("closing","]"));D=`\\${D}`}V({type:"bracket",value:D});continue}if("]"===D){if(!0===f.nobracket||K&&"bracket"===K.type&&1===K.value.length){V({type:"text",value:D,output:`\\${D}`});continue}if(0===B.brackets){if(!0===f.strictBrackets)throw new SyntaxError(a("opening","["));V({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,q({value:D}),!1===f.literalBrackets||t.hasRegexChars(e))continue;const n=t.escapeRegex(K.value);if(B.output=B.output.slice(0,-K.value.length),!0===f.literalBrackets){B.output+=n,K.value=n;continue}K.value=`(${R}${n}|${K.value})`,B.output+=K.value;continue}if("{"===D&&!0!==f.nobrace){Y("braces");const e={type:"brace",value:D,output:"(",outputIndex:B.output.length,tokensIndex:B.tokens.length};P.push(e),V(e);continue}if("}"===D){const e=P[P.length-1];if(!0===f.nobrace||!e){V({type:"text",value:D,output:D});continue}let t=")";if(!0===e.dots){const e=h.slice(),n=[];for(let t=e.length-1;t>=0&&(h.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&n.unshift(e[t].value);t=u(n,f),B.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const n=B.output.slice(0,e.outputIndex),r=B.tokens.slice(e.tokensIndex);e.value=e.output="\\{",D=t="\\}",B.output=n;for(const e of r)B.output+=e.output||e.value}V({type:"brace",value:D,output:t}),z("braces"),P.pop();continue}if("|"===D){j.length>0&&j[j.length-1].conditions++,V({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="|"),V({type:"comma",value:D,output:e});continue}if("/"===D){if("dot"===K.type&&B.index===B.start+1){B.start=B.index+1,B.consumed="",B.output="",h.pop(),K=A;continue}V({type:"slash",value:D,output:S});continue}if("."===D){if(B.braces>0&&"dot"===K.type){"."===K.value&&(K.output=m);const e=P[P.length-1];K.type="dots",K.output+=D,K.value+=D,e.dots=!0;continue}if(B.braces+B.parens===0&&"bos"!==K.type&&"slash"!==K.type){V({type:"text",value:D,output:m});continue}V({type:"dot",value:D,output:m});continue}if("?"===D){if((!K||"("!==K.value)&&!0!==f.noextglob&&"("===F()&&"?"!==F(2)){J("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(W()))&&(n=`\\${D}`),V({type:"text",value:D,output:n});continue}if(!0!==f.dot&&("slash"===K.type||"bos"===K.type)){V({type:"qmark",value:D,output:w});continue}V({type:"qmark",value:D,output:T});continue}if("!"===D){if(!0!==f.noextglob&&"("===F()&&("?"!==F(2)||!/[!=<:]/.test(F(3)))){J("negate",D);continue}if(!0!==f.nonegate&&0===B.index){Z();continue}}if("+"===D){if(!0!==f.noextglob&&"("===F()&&"?"!==F(2)){J("plus",D);continue}if(K&&"("===K.value||!1===f.regex){V({type:"plus",value:D,output:C});continue}if(K&&("bracket"===K.type||"paren"===K.type||"brace"===K.type)||B.parens>0){V({type:"plus",value:D});continue}V({type:"plus",value:C});continue}if("@"===D){if(!0!==f.noextglob&&"("===F()&&"?"!==F(2)){V({type:"at",extglob:!0,value:D,output:""});continue}V({type:"text",value:D});continue}if("*"!==D){"$"!==D&&"^"!==D||(D=`\\${D}`);const e=o.exec(W());e&&(D+=e[0],B.index+=e[0].length),V({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,B.backtrack=!0,B.globstar=!0,X(D);continue}let e=W();if(!0!==f.noextglob&&/^\([^?]/.test(e)){J("star",D);continue}if("star"===K.type){if(!0===f.noglobstar){X(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])){V({type:"star",value:D,output:""});continue}const s=B.braces>0&&("comma"===t.type||"brace"===t.type),i=j.length&&("pipe"===t.type||"paren"===t.type);if(!r&&"paren"!==t.type&&!s&&!i){V({type:"star",value:D,output:""});continue}for(;"/**"===e.slice(0,3);){const t=l[B.index+4];if(t&&"/"!==t)break;e=e.slice(3),X("/**",3)}if("bos"===t.type&&U()){K.type="globstar",K.value+=D,K.output=k(f),B.output=K.output,B.globstar=!0,X(D);continue}if("slash"===t.type&&"bos"!==t.prev.type&&!o&&U()){B.output=B.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=k(f)+(f.strictSlashes?")":"|$)"),K.value+=D,B.globstar=!0,B.output+=t.output+K.output,X(D);continue}if("slash"===t.type&&"bos"!==t.prev.type&&"/"===e[0]){const n=void 0!==e[1]?"|$":"";B.output=B.output.slice(0,-(t.output+K.output).length),t.output=`(?:${t.output}`,K.type="globstar",K.output=`${k(f)}${S}|${S}${n})`,K.value+=D,B.output+=t.output+K.output,B.globstar=!0,X(D+Q()),V({type:"slash",value:"/",output:""});continue}if("bos"===t.type&&"/"===e[0]){K.type="globstar",K.value+=D,K.output=`(?:^|${S}|${k(f)}${S})`,B.output=K.output,B.globstar=!0,X(D+Q()),V({type:"slash",value:"/",output:""});continue}B.output=B.output.slice(0,-K.output.length),K.type="globstar",K.output=k(f),K.value+=D,B.output+=K.output,B.globstar=!0,X(D);continue}const n={type:"star",value:D,output:M};!0!==f.bash?!K||"bracket"!==K.type&&"paren"!==K.type||!0!==f.regex?(B.index!==B.start&&"slash"!==K.type&&"dot"!==K.type||("dot"===K.type?(B.output+=$,K.output+=$):!0===f.dot?(B.output+=H,K.output+=H):(B.output+=N,K.output+=N),"*"!==F()&&(B.output+=b,K.output+=b)),V(n)):(n.output=D,V(n)):(n.output=".*?","bos"!==K.type&&"slash"!==K.type||(n.output=N+n.output),V(n))}for(;B.brackets>0;){if(!0===f.strictBrackets)throw new SyntaxError(a("closing","]"));B.output=t.escapeLast(B.output,"["),z("brackets")}for(;B.parens>0;){if(!0===f.strictBrackets)throw new SyntaxError(a("closing",")"));B.output=t.escapeLast(B.output,"("),z("parens")}for(;B.braces>0;){if(!0===f.strictBrackets)throw new SyntaxError(a("closing","}"));B.output=t.escapeLast(B.output,"{"),z("braces")}if(!0===f.strictSlashes||"star"!==K.type&&"bracket"!==K.type||V({type:"maybe_slash",value:"",output:`${S}?`}),!0===B.backtrack){B.output="";for(const e of B.tokens)B.output+=null!=e.output?e.output:e.value,e.suffix&&(B.output+=e.suffix)}return B};return p.fastpaths=(r,o)=>{const s={...o},u="number"==typeof s.maxLength?Math.min(n,s.maxLength):n,a=r.length;if(a>u)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${u}`);r=i[r]||r;const p=t.isWindows(o),{DOT_LITERAL:l,SLASH_LITERAL:c,ONE_CHAR:f,DOTS_SLASH:g,NO_DOT:d,NO_DOTS:A,NO_DOTS_SLASH:h,STAR:R,START_ANCHOR:E}=e.globChars(p),_=s.dot?A:d,y=s.dot?h:d,m=s.capture?"":"?:";let C=!0===s.bash?".*?":R;s.capture&&(C=`(${C})`);const S=e=>!0===e.noglobstar?C:`(${m}(?:(?!${E}${e.dot?g:l}).)*?)`,b=e=>{switch(e){case"*":return`${_}${f}${C}`;case".*":return`${l}${f}${C}`;case"*.*":return`${_}${C}${l}${f}${C}`;case"*/*":return`${_}${C}${c}${f}${y}${C}`;case"**":return _+S(s);case"**/*":return`(?:${_}${S(s)}${c})?${y}${f}${C}`;case"**/*.*":return`(?:${_}${S(s)}${c})?${y}${C}${l}${f}${C}`;case"**/.*":return`(?:${_}${S(s)}${c})?${l}${f}${C}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const n=b(t[1]);if(!n)return;return n+l+t[2]}}},v=t.removePrefix(r,{negated:!1,prefix:""});let x=b(v);return x&&!0!==s.strictSlashes&&(x+=`${c}?`),x},oe=p}(),r=de(),o=ge(),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=(i=e)&&"object"==typeof i&&!Array.isArray(i)&&e.tokens&&e.input;var i;if(""===e||"string"!=typeof e&&!o)throw new TypeError("Expected pattern to be a non-empty string");const u=t||{},a=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(u.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};c=s(u.ignore,e,n)}const f=(n,r=!1)=>{const{isMatch:o,match:i,output:f}=s.test(n,p,t,{glob:e,posix:a}),g={glob:e,state:l,regex:p,posix:a,input:n,output:f,match:i,isMatch:o};return"function"==typeof u.onResult&&u.onResult(g),!1===o?(g.isMatch=!1,!!r&&g):c(n)?("function"==typeof u.onIgnore&&u.onIgnore(g),g.isMatch=!1,!!r&&g):("function"==typeof u.onMatch&&u.onMatch(g),!r||g)};return n&&(f.state=l),f};return s.test=(e,t,n,{glob:o,posix:i}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const u=n||{},a=u.format||(i?r.toPosixSlashes:null);let p=e===o,l=p&&a?a(e):e;return!1===p&&(l=a?a(e):e,p=l===o),!1!==p&&!0!==u.capture||(p=!0===u.matchBase||!0===u.basename?s.matchBase(e,t,n,i):t.exec(l)),{isMatch:Boolean(p),match:p,output:l}},s.matchBase=(t,n,o,i=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||{},i=o.contains?"":"^",u=o.contains?"":"$";let a=`${i}(?:${e.output})${u}`;e&&!0===e.negated&&(a=`^(?!${a}).*$`);const p=s.toRegex(a,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 i={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(i.output=n.fastpaths(e,t)),i.output||(i=n(e,t)),s.compileRe(i,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,ie=s}function he(){return pe?ae:(pe=1,ae=Ae())}var Re=function(){if(ce)return le;ce=1;const e=_,t=V(),n=he(),r=de(),o=e=>""===e||"./"===e,s=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let o=new Set,s=new Set,i=new Set,u=0,a=e=>{i.add(e.output),r&&r.onResult&&r.onResult(e)};for(let i=0;i<t.length;i++){let p=n(String(t[i]),{...r,onResult:a},!0),l=p.state.negated||p.state.negatedExtglob;l&&u++;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=(u===t.length?[...i]:[...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=[],i=new Set(s(e,t,{...n,onResult:e=>{n.onResult&&n.onResult(e),o.push(e.output)}}));for(let e of o)i.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),i={};for(let t of o)i[t]=e[t];return i},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),i=n.makeRe(String(e),{...o,capture:!0}).exec(s?r.toPosixSlashes(t):t);if(i)return i.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})},le=s}();const Ee=(e,t)=>new Set([...e].filter((e=>t.has(e))));let _e;function ye(){if(_e)return _e;const e=S.getOptionValue("root");return _e=e?t.isAbsolute(e)?e:t.resolve(process.cwd(),e):void 0,_e}let me,Ce="";try{v(import.meta.url).resolve("@pnpm/filter-workspace-packages"),Ce="pnpm"}catch{}""!==Ce&&S.option("-f, --filter <filter>","filter packages");let Se,be=!1;function ve(e){try{return require.resolve(e),!0}catch(e){return!1}}const xe=[process.env.JIEK_TS_REGISTER,"esbuild-register","@swc-node/register","ts-node/register"].filter(Boolean);for(const e of xe)if(ve(e)){Se=e;break}let $e="jiek.config";var He=(e={})=>{const{onEvent:t}=e;return{name:"progress",buildStart:()=>t?.("start","Start building..."),buildEnd:()=>t?.("end","Build completed!"),resolveId:{order:"post",handler:e=>t?.("resolve",`Resolving ${e}...`)},load:{order:"post",handler:e=>t?.("load",`Loading ${e}...`)},transform:{order:"post",handler:(e,n)=>t?.("transform",`Transforming ${n}...`)}}},Te=(e={})=>({name:"skip",load(t){if(e.patterns?.some((e=>"string"==typeof e?t.includes(e):e.test(t))))return""}});const{JIEK_ROOT:we,JIEK_ENTRIES:Le}=process.env,Oe=we??f(),ke={},Ne=[d()],Ie=function(n){const{wd:r}=function(){if(me)return{wd:me,notWorkspace:be};const e=ye();if(void 0!==e){const t=c(e,Ce);return be=!t,me=e,{wd:me,notWorkspace:be}}try{me=f(Ce)}catch(t){if(!("message"in t)||"workspace root not found"!==t.message)throw t;me=e,be=!0}return{wd:me,notWorkspace:be}}();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=!!Se;function s(o){const s=[t.resolve(process.cwd(),`${$e}.${o}`),t.resolve(process.cwd(),`.${$e}.${o}`),t.resolve(n,`${$e}.${o}`),t.resolve(n,`.${$e}.${o}`)];r&&s.unshift(t.resolve(r,`${$e}.${o}`),t.resolve(r,`.${$e}.${o}`));for(const t of s)if(e.existsSync(t)&&e.lstatSync(t).isFile())return t}return $e=s("js")??$e,$e=s("json")??$e,$e=s("yaml")??$e,o&&($e=s("ts")??$e),t.resolve(n,$e)}(r,n);const s=t.extname(o);let i;switch(s){case".js":i=require(o);break;case".json":return require(o);case".yaml":return b(e.readFileSync(o,"utf-8"));case".ts":if(Se){require(Se),i=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":i={};break;default:throw new Error(`unsupported config file type: ${s}`)}if(!i)throw new Error("config file is empty");return i.default??i}()??{},{build:Me={}}=Ie,Be=`./${r(process.cwd(),n(("object"==typeof Me?.output?.dir?Me.output.dir.js:Me?.output?.dir)??"dist"))}`,je=/\.(css|s[ac]ss|less|styl)$/,Pe=e=>n(Oe,e),Ge=e=>e.replace(/[@|/-](\w)/g,((e,t)=>t.toUpperCase())).replace(/(?:^|-)(\w)/g,((e,t)=>t.toUpperCase())),De=(e,t=Me?.output?.minify)=>!1===t?[e]:"only-minify"===t?[{...e,file:e.file?.replace(/(\.[cm]?js)$/,".min$1"),plugins:[...e.plugins??[],h()]}]:[e,{...e,file:e.file?.replace(/(\.[cm]?js)$/,".min$1"),plugins:[...e.plugins??[],h()]}],Ke=t=>{t=n(t);const r=o(t),{extends:s,...i}=(u=t,e.existsSync(u)&&e.statSync(u).isFile()?E(e.readFileSync(u,"utf-8"),[],{allowTrailingComma:!0,allowEmptyContent:!0}):{});var u;const a=(p=s?Array.isArray(s)?s:[s]:[],p?.map((e=>n(r,e)))??[]);var p;return 0===a.length?i:a.map(Ke).reduce(((e,{compilerOptions:t={},references:n,...r})=>({...e,...r,compilerOptions:{...e.compilerOptions,...t}})),i)},Ue=(e,t)=>{e=n(e),t=n(t);const r=o(e),s=Ke(e),[i,u,a,p]=[s.references?.map((({path:e})=>e)),s.files,s.include,s.exclude].map((e=>e?.map((e=>n(r,e)))??[]));if(p.length>0&&p.some((e=>Re.isMatch(t,e))))return;if(0===s.files?.length&&0===s.include?.length)return;let l=!1;if(l||(l=u.length>0&&u.includes(t)),l||(l=a.length>0&&a.some((e=>Re.isMatch(t,e)))),l)return s.compilerOptions??{};if(!(s.files&&s.files.length>0||s.include&&s.include.length>0)){i.reverse();for(const e of i){const n=Ue(e,t);if(n)return n}return s.compilerOptions}},Fe=({path:t,name:r,input:s,output:i,external:u,pkgIsModule:a,conditionals:p},c={})=>{const f=p.includes("import"),d=p.includes("require"),h=p.includes("browser");let E;[Pe("tsconfig.json"),Pe("tsconfig.dts.json")].forEach((t=>{e.existsSync(t)&&e.statSync(t).isFile()&&(E=t)}));let _={};if(E){const e=Ue(E,n(s)),{options:t,errors:r}=C.convertCompilerOptionsFromJson(e,o(E));if(r.length>0)throw new Error(r.map((e=>e.messageText)).join("\n"));_=t}const y=[...p,..._.customConditions??[]],S={type:"progress",data:{name:r,path:t,exportConditions:y,input:s}},b=c?.output?.dir;return[{input:s,external:u,output:[...De({file:i,name:r,sourcemap:"object"==typeof c?.output?.sourcemap?c.output.sourcemap.js:c?.output?.sourcemap,format:f?"esm":d?"cjs":h?"umd":a?"esm":"cjs",strict:"object"==typeof c?.output?.strict?c.output.strict.js:c?.output?.strict})],plugins:[A({exportConditions:y}),import("rollup-plugin-postcss").then((({default:e})=>e({extract:n(i.replace(/\.[cm]?js$/,".css")),minimize:!0}))).catch((()=>{})),m(),g(),He({onEvent:(e,t)=>R({...S,data:{...S.data,event:e,message:t,tags:["js"]}})})]},{input:s,external:u,output:[{dir:n(("object"==typeof b?b.dts:b)??"dist"),sourcemap:"object"==typeof c?.output?.sourcemap?c.output.sourcemap.dts:c?.output?.sourcemap,entryFileNames:()=>i.replace(`${Be}/`,"").replace(/(\.[cm]?)js$/,".d$1ts"),strict:"object"==typeof c?.output?.strict?c.output.strict.dts:c?.output?.strict}],plugins:[A({exportConditions:y}),Te({patterns:[je]}),l({respectExternal:!0,compilerOptions:_}),He({onEvent:(e,t)=>R({...S,data:{...S.data,event:e,message:t,tags:["dts"]}})})]}]};function Qe(t){const{name:o,type:l,exports:c}=t,f="module"===l;if(!o)throw new Error("package.json name is required");if(!c)throw new Error("package.json exports is required");const g=Le?.split(",").map((e=>e.trim())).map((e=>({index:"."}[e]??e))),d=Ge(o),A=function(t=process.cwd()){const n="string"==typeof t?e.existsSync(`${t}/package.json`)?JSON.parse(e.readFileSync(`${t}/package.json`,"utf-8")):{}:t,{dependencies:r={},peerDependencies:o={},optionalDependencies:s={}}=n;return Object.keys(r).concat(Object.keys(o)).concat(Object.keys(s)).map((e=>new RegExp(`^${e}(/.*)?$`))).concat([/^node:/])}(t),[h,E]=function({entrypoints:e,pkgIsModule:t,entries:o,config:p,dir:l,noFilter:c,withSource:f,withSuffix:g}){const{build:d={}}=p??{},{crossModuleConvertor:A=!0}=d,h=`./${(e=>r(l??process.cwd(),e))(((...e)=>n(l??process.cwd(),...e))(("object"==typeof d?.output?.dir?d.output.dir.js:d?.output?.dir)??"dist"))}`,[,R]=s(e);o&&Object.entries(R).forEach((([e])=>{o.some((t=>Re.isMatch(e,t,{matchBase:!0})))||delete R[e]}));const E=c?R:i(R,{skipValue:[/(^|\/)\.jk-noentry/,...u]});return[E,a(E,{outdir:h,withSource:f,withSuffix:g,withConditional:{...A?{import:e=>!t&&0===Ee(new Set(e.conditionals),new Set(["import","module"])).size&&e.dist.replace(/\.js$/,".mjs"),require:e=>!(!t||0!==Ee(new Set(e.conditionals),new Set(["require","node"])).size)&&e.dist.replace(/\.js$/,".cjs")}:{}}})]}({entrypoints:c,pkgIsModule:f,entries:g,config:Ie}),_=new Map;p(h,(({keys:e,value:t})=>{if("string"==typeof t){const n=_.get(t)??[];_.set(t,n),n.push(e)}return!1}));const y=[];return _.forEach(((e,t)=>e.forEach((e=>{const[n,...r]=e,o=d+("."===n?"":Ge(n)),s=((e,t)=>t.reduce(((e,t)=>{if("string"==typeof e)throw new Error("key not found in exports");if(!(t in e))throw new Error(`key ${t} not found in exports`);return e[t]}),e))(E,e),i={path:n,name:o,input:t,external:A,pkgIsModule:f};switch(typeof s){case"string":y.push(...Fe({...i,output:s,conditionals:r},Me));break;case"object":p(s,(({keys:e,value:t})=>{const n=[...new Set([...r,...e])];return"string"==typeof t&&y.push(...Fe({...i,output:t,conditionals:n},Me)),!1}))}})))),R({type:"init",data:{leafMap:_,targetsLength:y.length}}),y.map((e=>({...ke,...e,plugins:[...Ne,e.plugins]})))}export{Qe as template};
|
package/package.json
CHANGED
@@ -1,60 +1,85 @@
|
|
1
1
|
{
|
2
2
|
"name": "jiek",
|
3
|
-
"
|
3
|
+
"type": "module",
|
4
|
+
"version": "0.4.7-alpha.10",
|
4
5
|
"description": "YiJie's personal kits.",
|
5
6
|
"bin": {
|
6
7
|
"jiek": "bin/jiek.js",
|
7
8
|
"jk": "bin/jiek.js"
|
8
9
|
},
|
9
|
-
"jiek": {
|
10
|
-
"noBrowser": true
|
11
|
-
},
|
12
10
|
"files": [
|
13
|
-
"dist"
|
11
|
+
"dist",
|
12
|
+
"src",
|
13
|
+
"bin",
|
14
|
+
"LICENSE",
|
15
|
+
"README.md"
|
14
16
|
],
|
17
|
+
"typesVersions": {
|
18
|
+
"<5.0": {
|
19
|
+
"*": [
|
20
|
+
"*",
|
21
|
+
"./dist/*",
|
22
|
+
"./dist/*/index.d.ts"
|
23
|
+
]
|
24
|
+
}
|
25
|
+
},
|
15
26
|
"exports": {
|
16
27
|
"./package.json": "./package.json",
|
17
28
|
".": {
|
18
|
-
"
|
19
|
-
"import": "./dist/index.esm.js",
|
29
|
+
"source": "./src/index.ts",
|
20
30
|
"require": "./dist/index.cjs",
|
21
|
-
"
|
31
|
+
"default": "./dist/index.js"
|
22
32
|
},
|
23
33
|
"./cli": {
|
24
|
-
"
|
25
|
-
"import": "./dist/cli.esm.js",
|
34
|
+
"source": "./src/cli.ts",
|
26
35
|
"require": "./dist/cli.cjs",
|
27
|
-
"
|
36
|
+
"default": "./dist/cli.js"
|
28
37
|
},
|
29
38
|
"./rollup": {
|
30
|
-
"
|
31
|
-
"
|
32
|
-
"
|
33
|
-
|
39
|
+
"source": "./src/rollup/index.ts",
|
40
|
+
"require": "./dist/rollup/index.cjs",
|
41
|
+
"default": "./dist/rollup/index.js"
|
42
|
+
},
|
43
|
+
"./cli.js": {
|
44
|
+
"source": "./src/cli.ts",
|
45
|
+
"require": "./dist/cli.cjs",
|
46
|
+
"default": "./dist/cli.js"
|
47
|
+
},
|
48
|
+
"./rollup.js": {
|
49
|
+
"source": "./src/rollup/index.ts",
|
50
|
+
"require": "./dist/rollup/index.cjs",
|
51
|
+
"default": "./dist/rollup/index.js"
|
34
52
|
}
|
35
53
|
},
|
54
|
+
"imports": {
|
55
|
+
"#~/*": "./src/*"
|
56
|
+
},
|
36
57
|
"dependencies": {
|
58
|
+
"@jiek/rollup-plugin-dts": "^6.1.1",
|
59
|
+
"@rollup/plugin-commonjs": "^28.0.0",
|
37
60
|
"@rollup/plugin-json": "^6.0.1",
|
61
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
38
62
|
"@rollup/plugin-terser": "^0.4.4",
|
39
63
|
"autoprefixer": "^10.4.16",
|
40
64
|
"cli-progress": "^3.12.0",
|
41
65
|
"commander": "^12.0.0",
|
42
66
|
"detect-indent": "^6.1.0",
|
67
|
+
"execa": "9.3.1",
|
43
68
|
"inquirer": "^8.2.6",
|
44
69
|
"js-yaml": "^4.1.0",
|
45
70
|
"jsonc-parser": "^3.2.1",
|
46
|
-
"micromatch": "^4.0.5",
|
47
71
|
"rollup": "^4.1.5",
|
48
72
|
"rollup-plugin-copy": "^3.5.0",
|
49
|
-
"@jiek/rollup-plugin-dts": "^6.1.1",
|
50
73
|
"rollup-plugin-esbuild": "^6.1.0",
|
51
|
-
"
|
52
|
-
"@jiek/pkger": "0.
|
53
|
-
"@jiek/utils": "0.2.
|
74
|
+
"typescript": "^5.0.0",
|
75
|
+
"@jiek/pkger": "^0.2.0",
|
76
|
+
"@jiek/utils": "^0.2.1"
|
54
77
|
},
|
55
78
|
"optionalDependencies": {
|
56
79
|
"@pnpm/filter-workspace-packages": "^7.2.13",
|
57
|
-
"esbuild-register": "^3.5.0"
|
80
|
+
"esbuild-register": "^3.5.0",
|
81
|
+
"postcss": "^8.4.47",
|
82
|
+
"rollup-plugin-postcss": "^4.0.2"
|
58
83
|
},
|
59
84
|
"devDependencies": {
|
60
85
|
"@npm/types": "^1.0.2",
|
@@ -64,18 +89,12 @@
|
|
64
89
|
"@types/inquirer": "^9.0.7",
|
65
90
|
"@types/js-yaml": "^4.0.9",
|
66
91
|
"@types/micromatch": "^4.0.6",
|
67
|
-
"esbuild-register": "^3.5.0"
|
92
|
+
"esbuild-register": "^3.5.0",
|
93
|
+
"micromatch": "^4.0.5",
|
94
|
+
"node-sass": "^9.0.0",
|
95
|
+
"postcss": "^8.4.47",
|
96
|
+
"rollup-plugin-postcss": "^4.0.2"
|
68
97
|
},
|
69
|
-
"types": "./dist/index.d.ts",
|
70
98
|
"main": "./dist/index.cjs",
|
71
|
-
"module": "./dist/index.
|
72
|
-
"typesVersions": {
|
73
|
-
"<5.0": {
|
74
|
-
"*": [
|
75
|
-
"*",
|
76
|
-
"./dist/*",
|
77
|
-
"./dist/*/index.esm.d.ts"
|
78
|
-
]
|
79
|
-
}
|
80
|
-
}
|
99
|
+
"module": "./dist/index.js"
|
81
100
|
}
|
package/src/cli.ts
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
import '../rollup/base'
|
2
|
+
|
3
|
+
import fs from 'node:fs'
|
4
|
+
import { createRequire } from 'node:module'
|
5
|
+
import path from 'node:path'
|
6
|
+
|
7
|
+
import { MultiBar, Presets } from 'cli-progress'
|
8
|
+
import { program } from 'commander'
|
9
|
+
import { execaCommand } from 'execa'
|
10
|
+
|
11
|
+
import { actionDone, actionRestore } from '../inner'
|
12
|
+
import type { RollupProgressEvent } from '../rollup/base'
|
13
|
+
import { getSelectedProjectsGraph } from '../utils/filterSupport'
|
14
|
+
import { loadConfig } from '../utils/loadConfig'
|
15
|
+
import { tsRegisterName } from '../utils/tsRegister'
|
16
|
+
|
17
|
+
const FILE_TEMPLATE = (manifest: unknown) => (`
|
18
|
+
const manifest = ${JSON.stringify(manifest, null, 2)}
|
19
|
+
module.exports = require('jiek/rollup').template(manifest)
|
20
|
+
`.trimStart())
|
21
|
+
|
22
|
+
const require = createRequire(import.meta.url)
|
23
|
+
|
24
|
+
program
|
25
|
+
.command('build')
|
26
|
+
.option('-s, --silent', "Don't display logs.")
|
27
|
+
.option('-e, --entries <ENTRIES>', "Specify the entries of the package.json's 'exports' field.(support glob)")
|
28
|
+
.action(async ({
|
29
|
+
silent,
|
30
|
+
entries
|
31
|
+
}: {
|
32
|
+
silent: boolean
|
33
|
+
entries: string
|
34
|
+
}) => {
|
35
|
+
actionRestore()
|
36
|
+
const { build } = loadConfig()
|
37
|
+
silent = silent ?? build?.silent ?? false
|
38
|
+
const {
|
39
|
+
wd,
|
40
|
+
value = {}
|
41
|
+
} = await getSelectedProjectsGraph() ?? {}
|
42
|
+
|
43
|
+
if (Object.keys(value).length === 0) {
|
44
|
+
throw new Error('no package found')
|
45
|
+
}
|
46
|
+
const wdNodeModules = path.resolve(wd, 'node_modules')
|
47
|
+
if (!fs.existsSync(wdNodeModules)) {
|
48
|
+
fs.mkdirSync(wdNodeModules)
|
49
|
+
}
|
50
|
+
const jiekTempDir = (...paths: string[]) => path.resolve(wdNodeModules, '.jiek', ...paths)
|
51
|
+
if (!fs.existsSync(jiekTempDir())) {
|
52
|
+
fs.mkdirSync(jiekTempDir())
|
53
|
+
}
|
54
|
+
|
55
|
+
const rollupBinaryPath = require.resolve('rollup')
|
56
|
+
.replace(/dist\/rollup.js$/, 'dist/bin/rollup')
|
57
|
+
const multiBars = new MultiBar({
|
58
|
+
clearOnComplete: false,
|
59
|
+
hideCursor: true,
|
60
|
+
format: '- {bar} | {status} | {input} | {message}'
|
61
|
+
}, Presets.shades_classic)
|
62
|
+
let i = 0
|
63
|
+
await Promise.all(
|
64
|
+
Object.entries(value).map(async ([dir, manifest]) => {
|
65
|
+
// TODO support auto build child packages in workspaces
|
66
|
+
const escapeManifestName = manifest.name?.replace(/^@/g, '').replace(/\//g, '+')
|
67
|
+
const configFile = jiekTempDir(
|
68
|
+
`${escapeManifestName ?? `anonymous-${i++}`}.rollup.config.js`
|
69
|
+
)
|
70
|
+
fs.writeFileSync(configFile, FILE_TEMPLATE(manifest))
|
71
|
+
let prefix = ''
|
72
|
+
if (tsRegisterName) {
|
73
|
+
prefix = `node -r ${tsRegisterName} `
|
74
|
+
}
|
75
|
+
// TODO replace with `spawn` to support watch mode
|
76
|
+
const command = `${prefix}${rollupBinaryPath} --silent -c ${configFile}`
|
77
|
+
const child = execaCommand(command, {
|
78
|
+
ipc: true,
|
79
|
+
cwd: dir,
|
80
|
+
env: {
|
81
|
+
...process.env,
|
82
|
+
JIEK_ROOT: wd,
|
83
|
+
JIEK_ENTRIES: entries
|
84
|
+
}
|
85
|
+
})
|
86
|
+
const bars: Record<string, ReturnType<typeof multiBars.create>> = {}
|
87
|
+
let inputMaxLen = 10
|
88
|
+
child.on('message', (e: RollupProgressEvent) => {
|
89
|
+
if (e.type === 'debug') console.log(...(Array.isArray(e.data) ? e.data : [e.data]))
|
90
|
+
})
|
91
|
+
!silent && child.on('message', (e: RollupProgressEvent) => {
|
92
|
+
if (e.type === 'init') {
|
93
|
+
const { leafMap, targetsLength } = e.data
|
94
|
+
const leafs = Array
|
95
|
+
.from(leafMap.entries())
|
96
|
+
.flatMap(([input, pathAndCondiions]) =>
|
97
|
+
pathAndCondiions.map(([path, ...conditions]) => ({
|
98
|
+
input,
|
99
|
+
path,
|
100
|
+
conditions
|
101
|
+
}))
|
102
|
+
)
|
103
|
+
console.log(`Package '${manifest.name}' has ${targetsLength} targets to build`)
|
104
|
+
leafs.forEach(({ input }) => {
|
105
|
+
inputMaxLen = Math.max(inputMaxLen, input.length)
|
106
|
+
})
|
107
|
+
leafs.forEach(({ input, path }) => {
|
108
|
+
const key = `${input}:${path}`
|
109
|
+
if (bars[key]) return
|
110
|
+
bars[key] = multiBars.create(50, 0, {
|
111
|
+
input: input.padEnd(inputMaxLen),
|
112
|
+
status: 'waiting'.padEnd(10)
|
113
|
+
}, {
|
114
|
+
barsize: 20,
|
115
|
+
linewrap: true
|
116
|
+
})
|
117
|
+
})
|
118
|
+
}
|
119
|
+
if (e.type === 'progress') {
|
120
|
+
const {
|
121
|
+
path,
|
122
|
+
tags,
|
123
|
+
input,
|
124
|
+
event,
|
125
|
+
message
|
126
|
+
} = e.data
|
127
|
+
const bar = bars[`${input}:${path}`]
|
128
|
+
if (!bar) return
|
129
|
+
bar.update(
|
130
|
+
{
|
131
|
+
start: 0,
|
132
|
+
resolve: 20,
|
133
|
+
end: 50
|
134
|
+
}[event ?? 'start'] ?? 0,
|
135
|
+
{
|
136
|
+
input: input.padEnd(inputMaxLen),
|
137
|
+
status: event?.padEnd(10),
|
138
|
+
message: `${tags?.join(', ')}: ${message}`
|
139
|
+
}
|
140
|
+
)
|
141
|
+
}
|
142
|
+
})
|
143
|
+
await new Promise<void>((resolve, reject) => {
|
144
|
+
let errorStr = ''
|
145
|
+
child.stderr?.on('data', (data) => {
|
146
|
+
errorStr += data
|
147
|
+
})
|
148
|
+
child.once('exit', (code) =>
|
149
|
+
code === 0
|
150
|
+
? resolve()
|
151
|
+
: reject(new Error(`rollup build failed:\n${errorStr}`)))
|
152
|
+
})
|
153
|
+
})
|
154
|
+
).finally(() => {
|
155
|
+
multiBars.stop()
|
156
|
+
})
|
157
|
+
|
158
|
+
actionDone()
|
159
|
+
})
|