pkgroll 1.0.2 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -16
- package/dist/cli.js +25 -25
- package/dist/rollup-plugin-dts-bad50ac6.js +24 -0
- package/package.json +4 -4
- package/dist/rollup-plugin-dts-dd9e9b59.js +0 -24
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# pkgroll
|
|
1
|
+
# 📦 🍣 pkgroll
|
|
2
2
|
|
|
3
|
-
Write your code in ESM
|
|
3
|
+
Write your code in ESM & TypeScript and bundle it to get ESM, CommonJS, and type declaration outputs with a single command!
|
|
4
4
|
|
|
5
5
|
### Features
|
|
6
6
|
- **Zero config** Configuration automatically inferred from `package.json`
|
|
@@ -18,7 +18,11 @@ npm install --save-dev pkgroll
|
|
|
18
18
|
## Quick setup
|
|
19
19
|
1. Setup your project with source files in `src` and output in `dist` (configurable).
|
|
20
20
|
|
|
21
|
-
2.
|
|
21
|
+
2. Define package entry-files in `package.json`.
|
|
22
|
+
|
|
23
|
+
[These configurations](https://nodejs.org/api/packages.html#package-entry-points) are for Node.js to determine how to import the package.
|
|
24
|
+
|
|
25
|
+
Pkgroll leverages the same configuration to determine how to build the package.
|
|
22
26
|
|
|
23
27
|
```json5
|
|
24
28
|
{
|
|
@@ -34,11 +38,9 @@ npm install --save-dev pkgroll
|
|
|
34
38
|
|
|
35
39
|
// Define output files for Node.js export maps (https://nodejs.org/api/packages.html#exports)
|
|
36
40
|
"exports": {
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"types": "./dist/file.d.ts"
|
|
41
|
-
}
|
|
41
|
+
"require": "./dist/file.js",
|
|
42
|
+
"import": "./dist/file.mjs",
|
|
43
|
+
"types": "./dist/file.d.ts"
|
|
42
44
|
},
|
|
43
45
|
|
|
44
46
|
// bin files will be compiled to be executable with the Node.js hashbang
|
|
@@ -94,7 +96,7 @@ _Auto-detect_ infers the type by extension or `package.json#type`:
|
|
|
94
96
|
|
|
95
97
|
Packages to externalize are detected by reading dependency types in `package.json`. Only dependencies listed in `devDependencies` are bundled in.
|
|
96
98
|
|
|
97
|
-
When generating type declarations, this also
|
|
99
|
+
When generating type declarations (`.d.ts` files), this also bundles and tree-shakes type dependencies declared in `devDependencies` as well.
|
|
98
100
|
|
|
99
101
|
```json5
|
|
100
102
|
// package.json
|
|
@@ -117,13 +119,13 @@ When generating type declarations, this also applies to dependencies referenced
|
|
|
117
119
|
```
|
|
118
120
|
|
|
119
121
|
### Aliases
|
|
120
|
-
Aliases
|
|
122
|
+
Aliases can be configured in the [import map](https://nodejs.org/api/packages.html#imports), defined in `package.json#imports`.
|
|
121
123
|
|
|
122
124
|
For native Node.js import mapping, all entries must be prefixed with `#` to indicate an internal [subpath import](https://nodejs.org/api/packages.html#subpath-imports). _Pkgroll_ takes advantage of this behavior to define entries that are _not prefixed_ with `#` as an alias.
|
|
123
125
|
|
|
124
126
|
Native Node.js import mapping supports conditional imports (eg. resolving different paths for Node.js and browser), but _Pkgroll_ does not.
|
|
125
127
|
|
|
126
|
-
> ⚠️ Aliases are not supported in type declaration generation. If you need type
|
|
128
|
+
> ⚠️ Aliases are not supported in type declaration generation. If you need type support, do not use aliases.
|
|
127
129
|
|
|
128
130
|
```json5
|
|
129
131
|
{
|
|
@@ -143,7 +145,7 @@ Native Node.js import mapping supports conditional imports (eg. resolving differ
|
|
|
143
145
|
|
|
144
146
|
_Pkgroll_ uses [esbuild](https://esbuild.github.io/) to handle TypeScript and JavaScript transformation and minification.
|
|
145
147
|
|
|
146
|
-
The target specifies the environments the output should support. Depending on the target, it
|
|
148
|
+
The target specifies the environments the output should support. Depending on how new the target is, it can generate less code using newer syntax. Read more about it in the [esbuild docs](https://esbuild.github.io/api/#target).
|
|
147
149
|
|
|
148
150
|
|
|
149
151
|
By default, the target is set to the version of Node.js used. It can be overwritten with the `--target` flag:
|
|
@@ -178,8 +180,8 @@ Because _pkgroll_ uses Rollup, it's able to produce CJS modules that are minimal
|
|
|
178
180
|
|
|
179
181
|
This means you can technically output in CommonJS to get ESM and CommonJS support.
|
|
180
182
|
|
|
181
|
-
####
|
|
182
|
-
Sometimes it's useful to use `require()` or `require.resolve()` in ESM.
|
|
183
|
+
#### `require()` in ESM
|
|
184
|
+
Sometimes it's useful to use `require()` or `require.resolve()` in ESM. ESM code that uses `require()` can be seamlessly compiled to CommonJS, but when compiling to ESM, Node.js will error because `require` doesn't exist in the module scope.
|
|
183
185
|
|
|
184
186
|
When compiling to ESM, _Pkgroll_ detects `require()` usages and shims it with [`createRequire(import.meta.url)`](https://nodejs.org/api/module.html#modulecreaterequirefilename).
|
|
185
187
|
|
|
@@ -199,7 +201,7 @@ pkgroll --watch
|
|
|
199
201
|
## FAQ
|
|
200
202
|
|
|
201
203
|
### Why bundle with Rollup?
|
|
202
|
-
[Rollup](https://rollupjs.org/) has the best tree-shaking performance, outputs simpler code, and produces seamless CommonJS and ESM formats (minimal interop code). Notably, CJS outputs generated by Rollup supports named exports so it can be parsed by Node.js ESM.
|
|
204
|
+
[Rollup](https://rollupjs.org/) has the best tree-shaking performance, outputs simpler code, and produces seamless CommonJS and ESM formats (minimal interop code). Notably, CJS outputs generated by Rollup supports named exports so it can be parsed by Node.js ESM. TypeScript & minification transformations are handled by [esbuild](https://esbuild.github.io/) for speed.
|
|
203
205
|
|
|
204
206
|
### Why bundle Node.js packages?
|
|
205
207
|
|
|
@@ -219,7 +221,7 @@ pkgroll --watch
|
|
|
219
221
|
|
|
220
222
|
Compiling dependencies will make sure new syntax & features are downgraded to support the same environments. And also prevent any unexpected changes from sneaking in during installation.
|
|
221
223
|
|
|
222
|
-
- **Type dependencies** must be declared in the `dependencies`
|
|
224
|
+
- **Type dependencies** must be declared in the `dependencies` object in `package.json` for it to be resolved by the consumer.
|
|
223
225
|
|
|
224
226
|
This can be unintuitive because types are a development enhancement and also adds installation bloat. Bundling filters out unused types and allows type dependencies to be declared in `devDependencies`.
|
|
225
227
|
|
package/dist/cli.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var fs$1=require("fs"),require$$1=require("tty"),rollup=require("rollup"),path$1=require("path"),nodeResolve=require("@rollup/plugin-node-resolve"),commonjs=require("@rollup/plugin-commonjs"),json=require("@rollup/plugin-json"),alias=require("@rollup/plugin-alias"),replace=require("@rollup/plugin-replace"),inject=require("@rollup/plugin-inject"),pluginutils=require("@rollup/pluginutils"),esbuild=require("esbuild"),require$$2=require("module"),MagicString=require("magic-string");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var fs__default$1=_interopDefaultLegacy(fs$1),require$$1__default=_interopDefaultLegacy(require$$1),path__default$1=_interopDefaultLegacy(path$1),nodeResolve__default=_interopDefaultLegacy(nodeResolve),commonjs__default=_interopDefaultLegacy(commonjs),json__default=_interopDefaultLegacy(json),alias__default=_interopDefaultLegacy(alias),replace__default=_interopDefaultLegacy(replace),inject__default=_interopDefaultLegacy(inject),MagicString__default=_interopDefaultLegacy(MagicString);function commonjsRequire(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var m$1=Object.defineProperty,I$2=Object.getOwnPropertyDescriptor,D$1=Object.getOwnPropertyNames,K$2=Object.prototype.hasOwnProperty,L$2=e=>m$1(e,"__esModule",{value:!0}),M$1=(e,t)=>{for(var r in t)m$1(e,r,{get:t[r],enumerable:!0})},R$2=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of D$1(t))!K$2.call(e,a)&&(r||a!=="default")&&m$1(e,a,{get:()=>t[a],enumerable:!(n=I$2(t,a))||n.enumerable});return e},z$2=(e=>(t,r)=>e&&e.get(t)||(r=R$2(L$2({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0),X$2={};M$1(X$2,{default:()=>j$2});var P$2=/-(\w)/g,A$1=e=>e.replace(P$2,(t,r)=>r.toUpperCase()),$$1=/\B([A-Z])/g,B$1=e=>e.replace($$1,"-$1").toLowerCase(),{stringify:u}=JSON,{hasOwnProperty:U$2}=Object.prototype,F=(e,t)=>U$2.call(e,t),W$2=/^--?/,q$2=/[.:=]/,C=e=>{let t=e.replace(W$2,""),r,n=t.match(q$2);if(n!=null&&n.index){let a=n.index;r=t.slice(a+1),t=t.slice(0,a)}return{flagName:t,flagValue:r}},G$2=/[\s.:=]/,J$2=(e,t)=>{let r=`Invalid flag name ${u(t)}:`;if(t.length===0)throw new Error(`${r} flag name cannot be empty}`);if(t.length===1)throw new Error(`${r} single characters are reserved for aliases`);let n=t.match(G$2);if(n)throw new Error(`${r} flag name cannot contain the character ${u(n==null?void 0:n[0])}`);let a;if(P$2.test(t)?a=A$1(t):$$1.test(t)&&(a=B$1(t)),a&&F(e,a))throw new Error(`${r} collides with flag ${u(a)}`)};function E$1(e){let t=new Map;for(let r in e){if(!F(e,r))continue;J$2(e,r);let n=e[r];if(n&&typeof n=="object"){let{alias:a}=n;if(typeof a=="string"){if(a.length===0)throw new Error(`Invalid flag alias ${u(r)}: flag alias cannot be empty`);if(a.length>1)throw new Error(`Invalid flag alias ${u(r)}: flag aliases can only be a single-character`);if(t.has(a))throw new Error(`Flag collision: Alias "${a}" is already used`);t.set(a,{name:r,schema:n})}}}return t}var Z$2=e=>!e||typeof e=="function"?!1:Array.isArray(e)||Array.isArray(e.type),v$2=e=>{let t={};for(let r in e)F(e,r)&&(t[r]=Z$2(e[r])?[]:void 0);return t},h$2=(e,t)=>e===Number&&t===""?Number.NaN:e===Boolean?t!=="false":t,_$2=(e,t)=>{for(let r in e){if(!F(e,r))continue;let n=e[r];if(!n)continue;let a=t[r];if(!(a!==void 0&&!(Array.isArray(a)&&a.length===0))&&"default"in n){let o=n.default;typeof o=="function"&&(o=o()),t[r]=o}}},x$2=(e,t)=>{if(!t)throw new Error(`Missing type on flag "${e}"`);return typeof t=="function"?t:Array.isArray(t)?t[0]:x$2(e,t.type)},H$1=/^-[\da-z]+/i,Q$2=/^--[\w-]{2,}/,S$2="--";function j$2(e,t=process.argv.slice(2)){let r=E$1(e),n={flags:v$2(e),unknownFlags:{},_:Object.assign([],{[S$2]:[]})},a,o=(g,s,Du)=>{let uu=x$2(g,s);Du=h$2(uu,Du),Du!==void 0&&!Number.isNaN(Du)?Array.isArray(n.flags[g])?n.flags[g].push(uu(Du)):n.flags[g]=uu(Du):a=eu=>{Array.isArray(n.flags[g])?n.flags[g].push(uu(h$2(uu,eu||""))):n.flags[g]=uu(h$2(uu,eu||"")),a=void 0}},l=(g,s)=>{g in n.unknownFlags||(n.unknownFlags[g]=[]),s!==void 0?n.unknownFlags[g].push(s):a=(Du=!0)=>{n.unknownFlags[g].push(Du),a=void 0}};for(let g=0;g<t.length;g+=1){let s=t[g];if(s===S$2){let uu=t.slice(g+1);n._[S$2]=uu,n._.push(...uu);break}let Du=H$1.test(s);if(Q$2.test(s)||Du){a&&a();let uu=C(s),{flagValue:eu}=uu,{flagName:tu}=uu;if(Du){for(let nu=0;nu<tu.length;nu+=1){let lu=tu[nu],Cu=r.get(lu),su=nu===tu.length-1;Cu?o(Cu.name,Cu.schema,su?eu:!0):l(lu,su?eu:!0)}continue}let au=e[tu];if(!au){let nu=A$1(tu);au=e[nu],au&&(tu=nu)}if(!au){l(tu,eu);continue}o(tu,au,eu)}else a?a(s):n._.push(s)}return a&&a(),_$2(e,n.flags),n}var dist$3=z$2(X$2),CD=Object.create,p$1=Object.defineProperty,tD=Object.defineProperties,eD=Object.getOwnPropertyDescriptor,ED=Object.getOwnPropertyDescriptors,nD=Object.getOwnPropertyNames,I$1=Object.getOwnPropertySymbols,rD=Object.getPrototypeOf,L$1=Object.prototype.hasOwnProperty,iD=Object.prototype.propertyIsEnumerable,T$1=(e,t,r)=>t in e?p$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,c=(e,t)=>{for(var r in t||(t={}))L$1.call(t,r)&&T$1(e,r,t[r]);if(I$1)for(var r of I$1(t))iD.call(t,r)&&T$1(e,r,t[r]);return e},d=(e,t)=>tD(e,ED(t)),W$1=e=>p$1(e,"__esModule",{value:!0}),oD=(e,t)=>()=>(e&&(t=e(e=0)),t),BD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),sD=(e,t)=>{for(var r in t)p$1(e,r,{get:t[r],enumerable:!0})},v$1=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of nD(t))!L$1.call(e,a)&&(r||a!=="default")&&p$1(e,a,{get:()=>t[a],enumerable:!(n=eD(t,a))||n.enumerable});return e},aD=(e,t)=>v$1(W$1(p$1(e!=null?CD(rD(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),lD=(e=>(t,r)=>e&&e.get(t)||(r=v$1(W$1({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0),i=oD(()=>{}),j$1=BD((e,t)=>{i(),t.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}}),RD={};sD(RD,{breakpoints:()=>FD,default:()=>uD}),i(),i(),i();var N$1=e=>{var t,r,n;let a=(t=process.stdout.columns)!=null?t:Number.POSITIVE_INFINITY;return typeof e=="function"&&(e=e(a)),e||(e={}),Array.isArray(e)?{columns:e,stdoutColumns:a}:{columns:(r=e.columns)!=null?r:[],stdoutColumns:(n=e.stdoutColumns)!=null?n:a}};i(),i(),i(),i(),i();function x$1({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}function h$1(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(x$1(),"")}i();function w(e){return Number.isInteger(e)?e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141):!1}var k=aD(j$1(),1);function f$1(e){if(typeof e!="string"||e.length===0||(e=h$1(e),e.length===0))return 0;e=e.replace((0,k.default)()," ");let t=0;for(let r=0;r<e.length;r++){let n=e.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,t+=w(n)?2:1)}return t}var m=e=>Math.max(...e.split(`
|
|
3
|
-
`).map(
|
|
4
|
-
`)];for(let[
|
|
5
|
-
`?(
|
|
6
|
-
`&&(
|
|
2
|
+
"use strict";var SD=require("fs"),TD=require("tty"),Bu=require("rollup"),ND=require("path"),MD=require("@rollup/plugin-node-resolve"),ID=require("@rollup/plugin-commonjs"),RD=require("@rollup/plugin-json"),LD=require("@rollup/plugin-alias"),qD=require("@rollup/plugin-replace"),WD=require("@rollup/plugin-inject"),UD=require("@rollup/pluginutils"),bu=require("esbuild"),zD=require("module"),VD=require("magic-string");function O(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var P=O(SD),GD=O(TD),x=O(ND),ZD=O(MD),YD=O(ID),JD=O(RD),HD=O(LD),KD=O(qD),QD=O(WD),XD=O(VD);function ue(u){throw new Error('Could not dynamically require "'+u+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var tu=Object.defineProperty,De=Object.getOwnPropertyDescriptor,ee=Object.getOwnPropertyNames,te=Object.prototype.hasOwnProperty,re=u=>tu(u,"__esModule",{value:!0}),ne=(u,D)=>{for(var e in D)tu(u,e,{get:D[e],enumerable:!0})},ae=(u,D,e,t)=>{if(D&&typeof D=="object"||typeof D=="function")for(let r of ee(D))!te.call(u,r)&&(e||r!=="default")&&tu(u,r,{get:()=>D[r],enumerable:!(t=De(D,r))||t.enumerable});return u},oe=(u=>(D,e)=>u&&u.get(D)||(e=ae(re({}),D,1),u&&u.set(D,e),e))(typeof WeakMap!="undefined"?new WeakMap:0),yu={};ne(yu,{default:()=>Be});var Au=/-(\w)/g,vu=u=>u.replace(Au,(D,e)=>e.toUpperCase()),wu=/\B([A-Z])/g,ie=u=>u.replace(wu,"-$1").toLowerCase(),{stringify:L}=JSON,{hasOwnProperty:se}=Object.prototype,J=(u,D)=>se.call(u,D),le=/^--?/,Fe=/[.:=]/,Ce=u=>{let D=u.replace(le,""),e,t=D.match(Fe);if(t!=null&&t.index){let r=t.index;e=D.slice(r+1),D=D.slice(0,r)}return{flagName:D,flagValue:e}},ce=/[\s.:=]/,fe=(u,D)=>{let e=`Invalid flag name ${L(D)}:`;if(D.length===0)throw new Error(`${e} flag name cannot be empty}`);if(D.length===1)throw new Error(`${e} single characters are reserved for aliases`);let t=D.match(ce);if(t)throw new Error(`${e} flag name cannot contain the character ${L(t==null?void 0:t[0])}`);let r;if(Au.test(D)?r=vu(D):wu.test(D)&&(r=ie(D)),r&&J(u,r))throw new Error(`${e} collides with flag ${L(r)}`)};function pe(u){let D=new Map;for(let e in u){if(!J(u,e))continue;fe(u,e);let t=u[e];if(t&&typeof t=="object"){let{alias:r}=t;if(typeof r=="string"){if(r.length===0)throw new Error(`Invalid flag alias ${L(e)}: flag alias cannot be empty`);if(r.length>1)throw new Error(`Invalid flag alias ${L(e)}: flag aliases can only be a single-character`);if(D.has(r))throw new Error(`Flag collision: Alias "${r}" is already used`);D.set(r,{name:e,schema:t})}}}return D}var de=u=>!u||typeof u=="function"?!1:Array.isArray(u)||Array.isArray(u.type),Ee=u=>{let D={};for(let e in u)J(u,e)&&(D[e]=de(u[e])?[]:void 0);return D},ru=(u,D)=>u===Number&&D===""?Number.NaN:u===Boolean?D!=="false":D,ge=(u,D)=>{for(let e in u){if(!J(u,e))continue;let t=u[e];if(!t)continue;let r=D[e];if(!(r!==void 0&&!(Array.isArray(r)&&r.length===0))&&"default"in t){let n=t.default;typeof n=="function"&&(n=n()),D[e]=n}}},$u=(u,D)=>{if(!D)throw new Error(`Missing type on flag "${u}"`);return typeof D=="function"?D:Array.isArray(D)?D[0]:$u(u,D.type)},he=/^-[\da-z]+/i,me=/^--[\w-]{2,}/,nu="--";function Be(u,D=process.argv.slice(2)){let e=pe(u),t={flags:Ee(u),unknownFlags:{},_:Object.assign([],{[nu]:[]})},r,n=(i,o,l)=>{let s=$u(i,o);l=ru(s,l),l!==void 0&&!Number.isNaN(l)?Array.isArray(t.flags[i])?t.flags[i].push(s(l)):t.flags[i]=s(l):r=F=>{Array.isArray(t.flags[i])?t.flags[i].push(s(ru(s,F||""))):t.flags[i]=s(ru(s,F||"")),r=void 0}},a=(i,o)=>{i in t.unknownFlags||(t.unknownFlags[i]=[]),o!==void 0?t.unknownFlags[i].push(o):r=(l=!0)=>{t.unknownFlags[i].push(l),r=void 0}};for(let i=0;i<D.length;i+=1){let o=D[i];if(o===nu){let s=D.slice(i+1);t._[nu]=s,t._.push(...s);break}let l=he.test(o);if(me.test(o)||l){r&&r();let s=Ce(o),{flagValue:F}=s,{flagName:C}=s;if(l){for(let f=0;f<C.length;f+=1){let h=C[f],b=e.get(h),g=f===C.length-1;b?n(b.name,b.schema,g?F:!0):a(h,g?F:!0)}continue}let p=u[C];if(!p){let f=vu(C);p=u[f],p&&(C=f)}if(!p){a(C,F);continue}n(C,p,F)}else r?r(o):t._.push(o)}return r&&r(),ge(u,t.flags),t}var be=oe(yu),ye=Object.create,q=Object.defineProperty,Ae=Object.defineProperties,ve=Object.getOwnPropertyDescriptor,we=Object.getOwnPropertyDescriptors,$e=Object.getOwnPropertyNames,Ou=Object.getOwnPropertySymbols,Oe=Object.getPrototypeOf,ju=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,_u=(u,D,e)=>D in u?q(u,D,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[D]=e,H=(u,D)=>{for(var e in D||(D={}))ju.call(D,e)&&_u(u,e,D[e]);if(Ou)for(var e of Ou(D))je.call(D,e)&&_u(u,e,D[e]);return u},au=(u,D)=>Ae(u,we(D)),Pu=u=>q(u,"__esModule",{value:!0}),_e=(u,D)=>()=>(u&&(D=u(u=0)),D),Pe=(u,D)=>()=>(D||u((D={exports:{}}).exports,D),D.exports),xe=(u,D)=>{for(var e in D)q(u,e,{get:D[e],enumerable:!0})},xu=(u,D,e,t)=>{if(D&&typeof D=="object"||typeof D=="function")for(let r of $e(D))!ju.call(u,r)&&(e||r!=="default")&&q(u,r,{get:()=>D[r],enumerable:!(t=ve(D,r))||t.enumerable});return u},ke=(u,D)=>xu(Pu(q(u!=null?ye(Oe(u)):{},"default",!D&&u&&u.__esModule?{get:()=>u.default,enumerable:!0}:{value:u,enumerable:!0})),u),Se=(u=>(D,e)=>u&&u.get(D)||(e=xu(Pu({}),D,1),u&&u.set(D,e),e))(typeof WeakMap!="undefined"?new WeakMap:0),v=_e(()=>{}),Te=Pe((u,D)=>{v(),D.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}}),ku={};xe(ku,{breakpoints:()=>rt,default:()=>Dt}),v(),v(),v();var Ne=u=>{var D,e,t;let r=(D=process.stdout.columns)!=null?D:Number.POSITIVE_INFINITY;return typeof u=="function"&&(u=u(r)),u||(u={}),Array.isArray(u)?{columns:u,stdoutColumns:r}:{columns:(e=u.columns)!=null?e:[],stdoutColumns:(t=u.stdoutColumns)!=null?t:r}};v(),v(),v(),v(),v();function Me({onlyFirst:u=!1}={}){let D=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(D,u?void 0:"g")}function Su(u){if(typeof u!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof u}\``);return u.replace(Me(),"")}v();function Ie(u){return Number.isInteger(u)?u>=4352&&(u<=4447||u===9001||u===9002||11904<=u&&u<=12871&&u!==12351||12880<=u&&u<=19903||19968<=u&&u<=42182||43360<=u&&u<=43388||44032<=u&&u<=55203||63744<=u&&u<=64255||65040<=u&&u<=65049||65072<=u&&u<=65131||65281<=u&&u<=65376||65504<=u&&u<=65510||110592<=u&&u<=110593||127488<=u&&u<=127569||131072<=u&&u<=262141):!1}var Re=ke(Te(),1);function k(u){if(typeof u!="string"||u.length===0||(u=Su(u),u.length===0))return 0;u=u.replace((0,Re.default)()," ");let D=0;for(let e=0;e<u.length;e++){let t=u.codePointAt(e);t<=31||t>=127&&t<=159||t>=768&&t<=879||(t>65535&&e++,D+=Ie(t)?2:1)}return D}var Tu=u=>Math.max(...u.split(`
|
|
3
|
+
`).map(k)),Le=u=>{let D=[];for(let e of u){let{length:t}=e,r=t-D.length;for(let n=0;n<r;n+=1)D.push(0);for(let n=0;n<t;n+=1){let a=Tu(e[n]);a>D[n]&&(D[n]=a)}}return D};v();var Nu=/^\d+%$/,Mu={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},qe=(u,D)=>{var e;let t=[];for(let r=0;r<u.length;r+=1){let n=(e=D[r])!=null?e:"auto";if(typeof n=="number"||n==="auto"||n==="content-width"||typeof n=="string"&&Nu.test(n)){t.push(au(H({},Mu),{width:n,contentWidth:u[r]}));continue}if(n&&typeof n=="object"){let a=au(H(H({},Mu),n),{contentWidth:u[r]});a.horizontalPadding=a.paddingLeft+a.paddingRight,t.push(a);continue}throw new Error(`Invalid column width: ${JSON.stringify(n)}`)}return t};function We(u,D){for(let e of u){let{width:t}=e;if(t==="content-width"&&(e.width=e.contentWidth),t==="auto"){let o=Math.min(20,e.contentWidth);e.width=o,e.autoOverflow=e.contentWidth-o}if(typeof t=="string"&&Nu.test(t)){let o=Number.parseFloat(t.slice(0,-1))/100;e.width=Math.floor(D*o)-(e.paddingLeft+e.paddingRight)}let{horizontalPadding:r}=e,n=1,a=n+r;if(a>=D){let o=a-D,l=Math.ceil(e.paddingLeft/r*o),s=o-l;e.paddingLeft-=l,e.paddingRight-=s,e.horizontalPadding=e.paddingLeft+e.paddingRight}e.paddingLeftString=e.paddingLeft?" ".repeat(e.paddingLeft):"",e.paddingRightString=e.paddingRight?" ".repeat(e.paddingRight):"";let i=D-e.horizontalPadding;e.width=Math.max(Math.min(e.width,i),n)}}var Iu=()=>Object.assign([],{columns:0});function Ue(u,D){let e=[Iu()],[t]=e;for(let r of u){let n=r.width+r.horizontalPadding;t.columns+n>D&&(t=Iu(),e.push(t)),t.push(r),t.columns+=n}for(let r of e){let n=r.reduce((C,p)=>C+p.width+p.horizontalPadding,0),a=D-n;if(a===0)continue;let i=r.filter(C=>"autoOverflow"in C),o=i.filter(C=>C.autoOverflow>0),l=o.reduce((C,p)=>C+p.autoOverflow,0),s=Math.min(l,a);for(let C of o){let p=Math.floor(C.autoOverflow/l*s);C.width+=p,a-=p}let F=Math.floor(a/i.length);for(let C=0;C<i.length;C+=1){let p=i[C];C===i.length-1?p.width+=a:p.width+=F,a-=F}}return e}function ze(u,D,e){let t=qe(e,D);return We(t,u),Ue(t,u)}v(),v(),v();var ou=10,Ru=(u=0)=>D=>`\x1B[${D+u}m`,Lu=(u=0)=>D=>`\x1B[${38+u};5;${D}m`,qu=(u=0)=>(D,e,t)=>`\x1B[${38+u};2;${D};${e};${t}m`;function Ve(){let u=new Map,D={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};D.color.gray=D.color.blackBright,D.bgColor.bgGray=D.bgColor.bgBlackBright,D.color.grey=D.color.blackBright,D.bgColor.bgGrey=D.bgColor.bgBlackBright;for(let[e,t]of Object.entries(D)){for(let[r,n]of Object.entries(t))D[r]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},t[r]=D[r],u.set(n[0],n[1]);Object.defineProperty(D,e,{value:t,enumerable:!1})}return Object.defineProperty(D,"codes",{value:u,enumerable:!1}),D.color.close="\x1B[39m",D.bgColor.close="\x1B[49m",D.color.ansi=Ru(),D.color.ansi256=Lu(),D.color.ansi16m=qu(),D.bgColor.ansi=Ru(ou),D.bgColor.ansi256=Lu(ou),D.bgColor.ansi16m=qu(ou),Object.defineProperties(D,{rgbToAnsi256:{value:(e,t,r)=>e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value:e=>{let t=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(e.toString(16));if(!t)return[0,0,0];let{colorString:r}=t.groups;r.length===3&&(r=r.split("").map(a=>a+a).join(""));let n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:e=>D.rgbToAnsi256(...D.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,r,n;if(e>=232)t=((e-232)*10+8)/255,r=t,n=t;else{e-=16;let o=e%36;t=Math.floor(e/36)/5,r=Math.floor(o/6)/5,n=o%6/5}let a=Math.max(t,r,n)*2;if(a===0)return 30;let i=30+(Math.round(n)<<2|Math.round(r)<<1|Math.round(t));return a===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,t,r)=>D.ansi256ToAnsi(D.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>D.ansi256ToAnsi(D.hexToAnsi256(e)),enumerable:!1}}),D}var Ge=Ve(),Ze=Ge,K=new Set(["\x1B","\x9B"]),Ye=39,iu="\x07",Wu="[",Je="]",Uu="m",su=`${Je}8;;`,zu=u=>`${K.values().next().value}${Wu}${u}${Uu}`,Vu=u=>`${K.values().next().value}${su}${u}${iu}`,He=u=>u.split(" ").map(D=>k(D)),lu=(u,D,e)=>{let t=[...D],r=!1,n=!1,a=k(Su(u[u.length-1]));for(let[i,o]of t.entries()){let l=k(o);if(a+l<=e?u[u.length-1]+=o:(u.push(o),a=0),K.has(o)&&(r=!0,n=t.slice(i+1).join("").startsWith(su)),r){n?o===iu&&(r=!1,n=!1):o===Uu&&(r=!1);continue}a+=l,a===e&&i<t.length-1&&(u.push(""),a=0)}!a&&u[u.length-1].length>0&&u.length>1&&(u[u.length-2]+=u.pop())},Ke=u=>{let D=u.split(" "),e=D.length;for(;e>0&&!(k(D[e-1])>0);)e--;return e===D.length?u:D.slice(0,e).join(" ")+D.slice(e).join("")},Qe=(u,D,e={})=>{if(e.trim!==!1&&u.trim()==="")return"";let t="",r,n,a=He(u),i=[""];for(let[l,s]of u.split(" ").entries()){e.trim!==!1&&(i[i.length-1]=i[i.length-1].trimStart());let F=k(i[i.length-1]);if(l!==0&&(F>=D&&(e.wordWrap===!1||e.trim===!1)&&(i.push(""),F=0),(F>0||e.trim===!1)&&(i[i.length-1]+=" ",F++)),e.hard&&a[l]>D){let C=D-F,p=1+Math.floor((a[l]-C-1)/D);Math.floor((a[l]-1)/D)<p&&i.push(""),lu(i,s,D);continue}if(F+a[l]>D&&F>0&&a[l]>0){if(e.wordWrap===!1&&F<D){lu(i,s,D);continue}i.push("")}if(F+a[l]>D&&e.wordWrap===!1){lu(i,s,D);continue}i[i.length-1]+=s}e.trim!==!1&&(i=i.map(l=>Ke(l)));let o=[...i.join(`
|
|
4
|
+
`)];for(let[l,s]of o.entries()){if(t+=s,K.has(s)){let{groups:C}=new RegExp(`(?:\\${Wu}(?<code>\\d+)m|\\${su}(?<uri>.*)${iu})`).exec(o.slice(l).join(""))||{groups:{}};if(C.code!==void 0){let p=Number.parseFloat(C.code);r=p===Ye?void 0:p}else C.uri!==void 0&&(n=C.uri.length===0?void 0:C.uri)}let F=Ze.codes.get(Number(r));o[l+1]===`
|
|
5
|
+
`?(n&&(t+=Vu("")),r&&F&&(t+=zu(F))):s===`
|
|
6
|
+
`&&(r&&F&&(t+=zu(r)),n&&(t+=Vu(n)))}return t};function Xe(u,D,e){return String(u).normalize().replace(/\r\n/g,`
|
|
7
7
|
`).split(`
|
|
8
|
-
`).map(
|
|
9
|
-
`)}var
|
|
10
|
-
`);if(
|
|
11
|
-
`))}return
|
|
12
|
-
`)}function
|
|
13
|
-
`)}
|
|
14
|
-
`}}function
|
|
15
|
-
`}}function
|
|
16
|
-
`):
|
|
17
|
-
`)}}}}function
|
|
18
|
-
`)),
|
|
19
|
-
`:"")+(
|
|
20
|
-
`}table({tableData:
|
|
21
|
-
`);if("type"in
|
|
22
|
-
`),
|
|
8
|
+
`).map(t=>Qe(t,D,e)).join(`
|
|
9
|
+
`)}var Gu=u=>Array.from({length:u}).fill("");function ut(u,D){let e=[],t=0;for(let r of u){let n=0,a=r.map(o=>{var l;let s=(l=D[t])!=null?l:"";t+=1,o.preprocess&&(s=o.preprocess(s)),Tu(s)>o.width&&(s=Xe(s,o.width,{hard:!0}));let F=s.split(`
|
|
10
|
+
`);if(o.postprocess){let{postprocess:C}=o;F=F.map((p,f)=>C.call(o,p,f))}return o.paddingTop&&F.unshift(...Gu(o.paddingTop)),o.paddingBottom&&F.push(...Gu(o.paddingBottom)),F.length>n&&(n=F.length),au(H({},o),{lines:F})}),i=[];for(let o=0;o<n;o+=1){let l=a.map(s=>{var F;let C=(F=s.lines[o])!=null?F:"",p=Number.isFinite(s.width)?" ".repeat(s.width-k(C)):"",f=s.paddingLeftString;return s.align==="right"&&(f+=p),f+=C,s.align==="left"&&(f+=p),f+s.paddingRightString}).join("");i.push(l)}e.push(i.join(`
|
|
11
|
+
`))}return e.join(`
|
|
12
|
+
`)}function Dt(u,D){if(!u||u.length===0)return"";let e=Le(u),t=e.length;if(t===0)return"";let{stdoutColumns:r,columns:n}=Ne(D);if(n.length>t)throw new Error(`${n.length} columns defined, but only ${t} columns found`);let a=ze(r,n,e);return u.map(i=>ut(a,i)).join(`
|
|
13
|
+
`)}v();var et=["<",">","=",">=","<="];function tt(u){if(!et.includes(u))throw new TypeError(`Invalid breakpoint operator: ${u}`)}function rt(u){let D=Object.keys(u).map(e=>{let[t,r]=e.split(" ");tt(t);let n=Number.parseInt(r,10);if(Number.isNaN(n))throw new TypeError(`Invalid breakpoint value: ${r}`);let a=u[e];return{operator:t,breakpoint:n,value:a}}).sort((e,t)=>t.breakpoint-e.breakpoint);return e=>{var t;return(t=D.find(({operator:r,breakpoint:n})=>r==="="&&e===n||r===">"&&e>n||r==="<"&&e<n||r===">="&&e>=n||r==="<="&&e<=n))==null?void 0:t.value}}var nt=Se(ku),at=Object.create,W=Object.defineProperty,ot=Object.defineProperties,it=Object.getOwnPropertyDescriptor,st=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertyNames,Zu=Object.getOwnPropertySymbols,Ft=Object.getPrototypeOf,Yu=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable,Ju=(u,D,e)=>D in u?W(u,D,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[D]=e,T=(u,D)=>{for(var e in D||(D={}))Yu.call(D,e)&&Ju(u,e,D[e]);if(Zu)for(var e of Zu(D))Ct.call(D,e)&&Ju(u,e,D[e]);return u},Fu=(u,D)=>ot(u,st(D)),Hu=u=>W(u,"__esModule",{value:!0}),ct=(u,D)=>{for(var e in D)W(u,e,{get:D[e],enumerable:!0})},Ku=(u,D,e,t)=>{if(D&&typeof D=="object"||typeof D=="function")for(let r of lt(D))!Yu.call(u,r)&&(e||r!=="default")&&W(u,r,{get:()=>D[r],enumerable:!(t=it(D,r))||t.enumerable});return u},Cu=(u,D)=>Ku(Hu(W(u!=null?at(Ft(u)):{},"default",!D&&u&&u.__esModule?{get:()=>u.default,enumerable:!0}:{value:u,enumerable:!0})),u),ft=(u=>(D,e)=>u&&u.get(D)||(e=Ku(Hu({}),D,1),u&&u.set(D,e),e))(typeof WeakMap!="undefined"?new WeakMap:0),Qu={};ct(Qu,{cli:()=>St,command:()=>Tt});var pt=Cu(be),dt=u=>u.replace(/[-_ ](\w)/g,(D,e)=>e.toUpperCase()),Et=u=>u.replace(/\B([A-Z])/g,"-$1").toLowerCase(),gt={"> 80":[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"auto"}],"> 40":[{width:"auto",paddingLeft:2,paddingRight:8,preprocess:u=>u.trim()},{width:"100%",paddingLeft:2,paddingBottom:1}],"> 0":{stdoutColumns:1e3,columns:[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"content-width"}]}};function ht(u){let D=!1,e=Object.keys(u).sort((t,r)=>t.localeCompare(r)).map(t=>{let r=u[t],n="alias"in r;return n&&(D=!0),{name:t,flag:r,flagFormatted:`--${Et(t)}`,aliasesEnabled:D,aliasFormatted:n?`-${r.alias}`:void 0}}).map(t=>(t.aliasesEnabled=D,[{type:"flagName",data:t},{type:"flagDescription",data:t}]));return{type:"table",data:{tableData:e,tableBreakpoints:gt}}}var Xu=u=>{var D;return!u||((D=u.version)!=null?D:u.help?u.help.version:void 0)},uD=u=>{var D;let e="parent"in u&&((D=u.parent)==null?void 0:D.name);return(e?`${e} `:"")+u.name};function mt(u){var D;let e=[];u.name&&e.push(uD(u));let t=(D=Xu(u))!=null?D:"parent"in u&&Xu(u.parent);if(t&&e.push(`v${t}`),e.length!==0)return{id:"name",type:"text",data:`${e.join(" ")}
|
|
14
|
+
`}}function Bt(u){let{help:D}=u;if(!(!D||!D.description))return{id:"description",type:"text",data:`${D.description}
|
|
15
|
+
`}}function bt(u){var D;let e=u.help||{};if("usage"in e)return e.usage?{id:"usage",type:"section",data:{title:"Usage:",body:Array.isArray(e.usage)?e.usage.join(`
|
|
16
|
+
`):e.usage}}:void 0;if(u.name){let t=[],r=[uD(u)];if(u.flags&&Object.keys(u.flags).length>0&&r.push("[flags...]"),u.parameters&&u.parameters.length>0){let{parameters:n}=u,a=n.indexOf("--"),i=a>-1&&n.slice(a+1).some(o=>o.startsWith("<"));r.push(n.map(o=>o!=="--"?o:i?"--":"[--]").join(" "))}if(r.length>1&&t.push(r.join(" ")),"commands"in u&&((D=u.commands)==null?void 0:D.length)&&t.push(`${u.name} <command>`),t.length>0)return{id:"usage",type:"section",data:{title:"Usage:",body:t.join(`
|
|
17
|
+
`)}}}}function yt(u){var D;if(!("commands"in u)||!((D=u.commands)!=null&&D.length))return;let e=u.commands.map(t=>[t.options.name,t.options.help?t.options.help.description:""]);return{id:"commands",type:"section",data:{title:"Commands:",body:{type:"table",data:{tableData:e,tableOptions:[{width:"content-width",paddingLeft:2,paddingRight:8}]}},indentBody:0}}}function At(u){if(!(!u.flags||Object.keys(u.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:ht(u.flags),indentBody:0}}}function vt(u){let{help:D}=u;if(!D||!D.examples||D.examples.length===0)return;let{examples:e}=D;if(Array.isArray(e)&&(e=e.join(`
|
|
18
|
+
`)),e)return{id:"examples",type:"section",data:{title:"Examples:",body:e}}}function wt(u){if(!("alias"in u)||!u.alias)return;let{alias:D}=u,e=Array.isArray(D)?D.join(", "):D;return{id:"aliases",type:"section",data:{title:"Aliases:",body:e}}}var $t=u=>[mt,Bt,bt,yt,At,vt,wt].map(D=>D(u)).filter(D=>Boolean(D)),Ot=Cu(GD.default),DD=Cu(nt),jt=Ot.default.WriteStream.prototype.hasColors(),_t=class{text(u){return u}bold(u){return jt?`\x1B[1m${u}\x1B[22m`:u.toLocaleUpperCase()}indentText({text:u,spaces:D}){return u.replace(/^/gm," ".repeat(D))}heading(u){return this.bold(u)}section({title:u,body:D,indentBody:e=2}){return`${(u?`${this.heading(u)}
|
|
19
|
+
`:"")+(D?this.indentText({text:this.render(D),spaces:e}):"")}
|
|
20
|
+
`}table({tableData:u,tableOptions:D,tableBreakpoints:e}){return(0,DD.default)(u.map(t=>t.map(r=>this.render(r))),e?(0,DD.breakpoints)(e):D)}flagParameter(u){return u===Boolean?"":u===String?"<string>":u===Number?"<number>":Array.isArray(u)?this.flagParameter(u[0]):"<value>"}flagOperator(){return" "}flagName({flag:u,flagFormatted:D,aliasesEnabled:e,aliasFormatted:t}){let r="";if(t?r+=`${t}, `:e&&(r+=" "),r+=D,"placeholder"in u&&typeof u.placeholder=="string")r+=`${this.flagOperator()}${u.placeholder}`;else{let n=this.flagParameter("type"in u?u.type:u);n&&(r+=`${this.flagOperator()}${n}`)}return r}flagDefault(u){return JSON.stringify(u)}flagDescription({flag:u}){var D;let e="description"in u&&(D=u.description)!=null?D:"";if("default"in u){let{default:t}=u;typeof t=="function"&&(t=t()),t&&(e+=` (default: ${this.flagDefault(t)})`)}return e}render(u){if(typeof u=="string")return u;if(Array.isArray(u))return u.map(D=>this.render(D)).join(`
|
|
21
|
+
`);if("type"in u&&this[u.type]){let D=this[u.type];if(typeof D=="function")return D.call(this,u.data)}throw new Error(`Invalid node type: ${JSON.stringify(u)}`)}},cu=/^[\w.-]+$/,{stringify:j}=JSON,Pt=/[|\\{}()[\]^$+*?.]/;function fu(u){let D=[],e,t;for(let r of u){if(t)throw new Error(`Invalid parameter: Spread parameter ${j(t)} must be last`);let n=r[0],a=r[r.length-1],i;if(n==="<"&&a===">"&&(i=!0,e))throw new Error(`Invalid parameter: Required parameter ${j(r)} cannot come after optional parameter ${j(e)}`);if(n==="["&&a==="]"&&(i=!1,e=r),i===void 0)throw new Error(`Invalid parameter: ${j(r)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let o=r.slice(1,-1),l=o.slice(-3)==="...";l&&(t=r,o=o.slice(0,-3));let s=o.match(Pt);if(s)throw new Error(`Invalid parameter: ${j(r)}. Invalid character found ${j(s[0])}`);D.push({name:o,required:i,spread:l})}return D}function pu(u,D,e,t){for(let r=0;r<D.length;r+=1){let{name:n,required:a,spread:i}=D[r],o=dt(n);if(o in u)throw new Error(`Invalid parameter: ${j(n)} is used more than once.`);let l=i?e.slice(r):e[r];if(i&&(r=D.length),a&&(!l||i&&l.length===0))return console.error(`Error: Missing required parameter ${j(n)}
|
|
22
|
+
`),t(),process.exit(1);u[o]=l}}function xt(u){return u===void 0||u!==!1}function eD(u,D,e,t){let r=T({},D.flags),n=D.version;n&&(r.version={type:Boolean,description:"Show version"});let{help:a}=D,i=xt(a);i&&!("help"in r)&&(r.help={type:Boolean,alias:"h",description:"Show help"});let o=(0,pt.default)(r,t),l=()=>{console.log(D.version)};if(n&&o.flags.version===!0)return l(),process.exit(0);let s=new _t,F=i&&(a==null?void 0:a.render)?a.render:f=>s.render(f),C=f=>{let h=$t(Fu(T(T({},D),f?{help:f}:{}),{flags:r}));console.log(F(h,s))};if(i&&o.flags.help===!0)return C(),process.exit(0);if(D.parameters){let{parameters:f}=D,h=o._,b=f.indexOf("--"),g=f.slice(b+1),d=Object.create(null);if(b>-1&&g.length>0){f=f.slice(0,b);let c=o._["--"];h=h.slice(0,-c.length||void 0),pu(d,fu(f),h,C),pu(d,fu(g),c,C)}else pu(d,fu(f),h,C);Object.assign(o._,d)}let p=Fu(T({},o),{showVersion:l,showHelp:C});return typeof e=="function"&&e(p),T({command:u},p)}function kt(u,D){let e=new Map;for(let t of D){let r=[t.options.name],{alias:n}=t.options;n&&(Array.isArray(n)?r.push(...n):r.push(n));for(let a of r){if(e.has(a))throw new Error(`Duplicate command name found: ${j(a)}`);e.set(a,t)}}return e.get(u)}function St(u,D,e=process.argv.slice(2)){if(!u)throw new Error("Options is required");if("name"in u&&(!u.name||!cu.test(u.name)))throw new Error(`Invalid script name: ${j(u.name)}`);let t=e[0];if(u.commands&&cu.test(t)){let r=kt(t,u.commands);if(r)return eD(r.options.name,Fu(T({},r.options),{parent:u}),r.callback,e.slice(1))}return eD(void 0,u,D,e)}function Tt(u,D){if(!u)throw new Error("Command options are required");let{name:e}=u;if(u.name===void 0)throw new Error("Command name is required");if(!cu.test(e))throw new Error(`Invalid command name ${JSON.stringify(e)}. Command names must be one word.`);return{options:u,callback:D}}var Nt=ft(Qu);const tD=u=>P.default.promises.access(u).then(()=>!0,()=>!1),Mt=async u=>{const D=x.default.join(u,"package.json");if(!await tD(D))throw new Error(`package.json not found at: ${D}`);const t=await P.default.promises.readFile(D,"utf8");try{return JSON.parse(t)}catch(r){throw new Error(`Cannot parse package.json: ${r.message}`)}},It=/^[/.]/,Q=(u,D)=>(!x.default.isAbsolute(u)&&!It.test(u)&&(u=`./${u}`),D&&!u.endsWith("/")&&(u+="/"),u);var Rt=Object.defineProperty,Lt=Object.defineProperties,qt=Object.getOwnPropertyDescriptors,rD=Object.getOwnPropertySymbols,Wt=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable,nD=(u,D,e)=>D in u?Rt(u,D,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[D]=e,U=(u,D)=>{for(var e in D||(D={}))Wt.call(D,e)&&nD(u,e,D[e]);if(rD)for(var e of rD(D))Ut.call(D,e)&&nD(u,e,D[e]);return u},z=(u,D)=>Lt(u,qt(D));const _=u=>{if(u.endsWith(".mjs"))return"module";if(u.endsWith(".cjs"))return"commonjs"},aD=u=>u.startsWith(".");function oD(u,D,e="exports"){if(u){if(typeof u=="string")return aD(u)?[{outputPath:u,type:_(u)||D,from:e}]:[];if(Array.isArray(u))return u.filter(aD).map((r,n)=>({outputPath:r,type:_(r)||D,from:`${e}[${n}]`}));if(typeof u=="object")return Object.entries(u).flatMap(([t,r])=>{if(typeof r=="string"){const n={outputPath:r,from:`${e}.${t}`};if(t==="require")return z(U({},n),{type:"commonjs"});if(t==="import")return z(U({},n),{type:_(r)||D});if(t==="types")return z(U({},n),{type:"types"});if(t==="node")return z(U({},n),{type:_(r)||D,platform:"node"});if(t==="default")return z(U({},n),{type:_(r)||D})}return oD(r,D,`${e}.${t}`)})}return[]}function N(u,D){D.outputPath=Q(D.outputPath);const{outputPath:e,type:t,platform:r}=D,n=u[e];if(n){if(n.type!==t)throw new Error(`Conflicting export types "${n.type}" & "${t}" found for ${e}`);if(n.platform!==r)throw new Error(`Conflicting export platforms "${n.platform}" & "${r}" found for ${e}`)}u[e]=D}const zt=u=>{var D,e,t,r;const n={},a=(D=u.type)!=null?D:"commonjs";if(u.main){const i=u.main;N(n,{outputPath:i,type:(e=_(i))!=null?e:a,from:"main"})}if(u.module&&N(n,{outputPath:u.module,type:"module",from:"module"}),u.types&&N(n,{outputPath:u.types,type:"types",from:"types"}),u.bin){const{bin:i}=u;if(typeof i=="string")N(n,{outputPath:i,type:(t=_(i))!=null?t:a,isExecutable:!0,from:"bin"});else for(const[o,l]of Object.entries(i))N(n,{outputPath:l,type:(r=_(l))!=null?r:a,isExecutable:!0,from:`bin.${o}`})}if(u.exports){const i=oD(u.exports,a);for(const o of i)N(n,o)}return Object.values(n)},Vt=["peerDependencies","dependencies","optionalDependencies"],Gt=u=>{const D=[];for(const e of Vt){const t=u[e];t&&D.push(...Object.keys(t))}return D},Zt=({imports:u},D)=>{const e={};if(u)for(const t in u){if(t.startsWith("#"))continue;const r=u[t];typeof r=="string"&&(e[t]=x.default.join(D,r))}return e},{stringify:du}=JSON;async function Yt(u,D){for(const e of D){const t=u+e;if(await tD(t))return t}}const iD={".d.ts":[".d.ts",".ts"],".js":[".js",".ts",".tsx"],".mjs":[".mjs",".js",".mts",".ts"],".cjs":[".cjs",".js",".cts",".ts"]};async function Jt(u,D,e){if(!u.outputPath.startsWith(e))throw new Error(`Export path ${du(u.outputPath)} from ${du(`package.json#${u.from}`)} is not in directory ${e}`);const t=D+u.outputPath.slice(e.length);for(const r of Object.keys(iD))if(u.outputPath.endsWith(r)){const n=await Yt(t.slice(0,-r.length),iD[r]);if(n)return n}throw new Error(`Could not find mathing source file for export path ${du(u.outputPath)}`)}var Ht=Object.defineProperty,Kt=Object.defineProperties,Qt=Object.getOwnPropertyDescriptors,sD=Object.getOwnPropertySymbols,Xt=Object.prototype.hasOwnProperty,ur=Object.prototype.propertyIsEnumerable,lD=(u,D,e)=>D in u?Ht(u,D,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[D]=e,Dr=(u,D)=>{for(var e in D||(D={}))Xt.call(D,e)&&lD(u,e,D[e]);if(sD)for(var e of sD(D))ur.call(D,e)&&lD(u,e,D[e]);return u},er=(u,D)=>Kt(u,Qt(D));const Eu="pkgroll:create-require",FD=`IS_ESM${Math.random().toString(36).slice(2)}`,tr=()=>er(Dr({},QD.default({require:Eu})),{name:"create-require",resolveId:u=>u===Eu?u:null,load(u){return u!==Eu?null:`
|
|
23
23
|
import { createRequire } from 'module';
|
|
24
24
|
|
|
25
25
|
export default (
|
|
26
|
-
${
|
|
26
|
+
${FD}
|
|
27
27
|
? createRequire(import.meta.url)
|
|
28
28
|
: require
|
|
29
29
|
);
|
|
30
|
-
`}}),
|
|
31
|
-
`;break;case 114:
|
|
32
|
-
`),
|
|
33
|
-
`),{code:
|
|
30
|
+
`}}),rr=u=>({name:"create-require-insert-format",renderChunk:KD.default({[FD]:u}).renderChunk});var nr=x.default,ar=P.default;function CD(u){return u&&typeof u=="object"&&"default"in u?u:{default:u}}var B=CD(nr),gu=CD(ar);function X(u){const D=/^\\\\\?\\/.test(u),e=/[^\u0000-\u0080]+/.test(u);return D||e?u:u.replace(/\\/g,"/")}function or(u,D){for(;;){const e=B.default.join(u,D);if(gu.default.existsSync(e))return X(e);const t=B.default.dirname(u);if(t===u)return;u=t}}var cD=ue;function ir(u,D){D===void 0&&(D=!1);var e=u.length,t=0,r="",n=0,a=16,i=0,o=0,l=0,s=0,F=0;function C(c,y){for(var w=0,A=0;w<c||!y;){var m=u.charCodeAt(t);if(m>=48&&m<=57)A=A*16+m-48;else if(m>=65&&m<=70)A=A*16+m-65+10;else if(m>=97&&m<=102)A=A*16+m-97+10;else break;t++,w++}return w<c&&(A=-1),A}function p(c){t=c,r="",n=0,a=16,F=0}function f(){var c=t;if(u.charCodeAt(t)===48)t++;else for(t++;t<u.length&&M(u.charCodeAt(t));)t++;if(t<u.length&&u.charCodeAt(t)===46)if(t++,t<u.length&&M(u.charCodeAt(t)))for(t++;t<u.length&&M(u.charCodeAt(t));)t++;else return F=3,u.substring(c,t);var y=t;if(t<u.length&&(u.charCodeAt(t)===69||u.charCodeAt(t)===101))if(t++,(t<u.length&&u.charCodeAt(t)===43||u.charCodeAt(t)===45)&&t++,t<u.length&&M(u.charCodeAt(t))){for(t++;t<u.length&&M(u.charCodeAt(t));)t++;y=t}else F=3;return u.substring(c,y)}function h(){for(var c="",y=t;;){if(t>=e){c+=u.substring(y,t),F=2;break}var w=u.charCodeAt(t);if(w===34){c+=u.substring(y,t),t++;break}if(w===92){if(c+=u.substring(y,t),t++,t>=e){F=2;break}var A=u.charCodeAt(t++);switch(A){case 34:c+='"';break;case 92:c+="\\";break;case 47:c+="/";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+=`
|
|
31
|
+
`;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:var m=C(4,!0);m>=0?c+=String.fromCharCode(m):F=4;break;default:F=5}y=t;continue}if(w>=0&&w<=31)if(V(w)){c+=u.substring(y,t),F=2;break}else F=6;t++}return c}function b(){if(r="",F=0,n=t,o=i,s=l,t>=e)return n=e,a=17;var c=u.charCodeAt(t);if(hu(c)){do t++,r+=String.fromCharCode(c),c=u.charCodeAt(t);while(hu(c));return a=15}if(V(c))return t++,r+=String.fromCharCode(c),c===13&&u.charCodeAt(t)===10&&(t++,r+=`
|
|
32
|
+
`),i++,l=t,a=14;switch(c){case 123:return t++,a=1;case 125:return t++,a=2;case 91:return t++,a=3;case 93:return t++,a=4;case 58:return t++,a=6;case 44:return t++,a=5;case 34:return t++,r=h(),a=10;case 47:var y=t-1;if(u.charCodeAt(t+1)===47){for(t+=2;t<e&&!V(u.charCodeAt(t));)t++;return r=u.substring(y,t),a=12}if(u.charCodeAt(t+1)===42){t+=2;for(var w=e-1,A=!1;t<w;){var m=u.charCodeAt(t);if(m===42&&u.charCodeAt(t+1)===47){t+=2,A=!0;break}t++,V(m)&&(m===13&&u.charCodeAt(t)===10&&t++,i++,l=t)}return A||(t++,F=1),r=u.substring(y,t),a=13}return r+=String.fromCharCode(c),t++,a=16;case 45:if(r+=String.fromCharCode(c),t++,t===e||!M(u.charCodeAt(t)))return a=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return r+=f(),a=11;default:for(;t<e&&g(c);)t++,c=u.charCodeAt(t);if(n!==t){switch(r=u.substring(n,t),r){case"true":return a=8;case"false":return a=9;case"null":return a=7}return a=16}return r+=String.fromCharCode(c),t++,a=16}}function g(c){if(hu(c)||V(c))return!1;switch(c){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function d(){var c;do c=b();while(c>=12&&c<=15);return c}return{setPosition:p,getPosition:function(){return t},scan:D?d:b,getToken:function(){return a},getTokenValue:function(){return r},getTokenOffset:function(){return n},getTokenLength:function(){return t-n},getTokenStartLine:function(){return o},getTokenStartCharacter:function(){return n-s},getTokenError:function(){return F}}}function hu(u){return u===32||u===9||u===11||u===12||u===160||u===5760||u>=8192&&u<=8203||u===8239||u===8287||u===12288||u===65279}function V(u){return u===10||u===13||u===8232||u===8233}function M(u){return u>=48&&u<=57}var uu;(function(u){u.DEFAULT={allowTrailingComma:!1}})(uu||(uu={}));function sr(u,D,e){D===void 0&&(D=[]),e===void 0&&(e=uu.DEFAULT);var t=null,r=[],n=[];function a(o){Array.isArray(r)?r.push(o):t!==null&&(r[t]=o)}var i={onObjectBegin:function(){var o={};a(o),n.push(r),r=o,t=null},onObjectProperty:function(o){t=o},onObjectEnd:function(){r=n.pop()},onArrayBegin:function(){var o=[];a(o),n.push(r),r=o,t=null},onArrayEnd:function(){r=n.pop()},onLiteralValue:a,onError:function(o,l,s){D.push({error:o,offset:l,length:s})}};return lr(u,i,e),r[0]}function lr(u,D,e){e===void 0&&(e=uu.DEFAULT);var t=ir(u,!1);function r(E){return E?function(){return E(t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter())}:function(){return!0}}function n(E){return E?function($){return E($,t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter())}:function(){return!0}}var a=r(D.onObjectBegin),i=n(D.onObjectProperty),o=r(D.onObjectEnd),l=r(D.onArrayBegin),s=r(D.onArrayEnd),F=n(D.onLiteralValue),C=n(D.onSeparator),p=r(D.onComment),f=n(D.onError),h=e&&e.disallowComments,b=e&&e.allowTrailingComma;function g(){for(;;){var E=t.scan();switch(t.getTokenError()){case 4:d(14);break;case 5:d(15);break;case 3:d(13);break;case 1:h||d(11);break;case 2:d(12);break;case 6:d(16);break}switch(E){case 12:case 13:h?d(10):p();break;case 16:d(1);break;case 15:case 14:break;default:return E}}}function d(E,$,Z){if($===void 0&&($=[]),Z===void 0&&(Z=[]),f(E),$.length+Z.length>0)for(var Y=t.getToken();Y!==17;){if($.indexOf(Y)!==-1){g();break}else if(Z.indexOf(Y)!==-1)break;Y=g()}}function c(E){var $=t.getTokenValue();return E?F($):i($),g(),!0}function y(){switch(t.getToken()){case 11:var E=t.getTokenValue(),$=Number(E);isNaN($)&&(d(2),$=0),F($);break;case 7:F(null);break;case 8:F(!0);break;case 9:F(!1);break;default:return!1}return g(),!0}function w(){return t.getToken()!==10?(d(3,[],[2,5]),!1):(c(!1),t.getToken()===6?(C(":"),g(),eu()||d(4,[],[2,5])):d(5,[],[2,5]),!0)}function A(){a(),g();for(var E=!1;t.getToken()!==2&&t.getToken()!==17;){if(t.getToken()===5){if(E||d(4,[],[]),C(","),g(),t.getToken()===2&&b)break}else E&&d(6,[],[]);w()||d(4,[],[2,5]),E=!0}return o(),t.getToken()!==2?d(7,[2],[]):g(),!0}function m(){l(),g();for(var E=!1;t.getToken()!==4&&t.getToken()!==17;){if(t.getToken()===5){if(E||d(4,[],[]),C(","),g(),t.getToken()===4&&b)break}else E&&d(6,[],[]);eu()||d(4,[],[4,5]),E=!0}return s(),t.getToken()!==4?d(8,[4],[]):g(),!0}function eu(){switch(t.getToken()){case 3:return m();case 1:return A();case 10:return c(!0);default:return y()}}return g(),t.getToken()===17?e.allowEmptyContent?!0:(d(4,[],[]),!1):eu()?(t.getToken()!==17&&d(9,[],[]),!0):(d(4,[],[]),!1)}var Fr=sr;const fD=u=>X(/^[./]/.test(u)?u:`./${u}`);var Cr=Object.defineProperty,cr=Object.defineProperties,fr=Object.getOwnPropertyDescriptors,pD=Object.getOwnPropertySymbols,pr=Object.prototype.hasOwnProperty,dr=Object.prototype.propertyIsEnumerable,dD=(u,D,e)=>D in u?Cr(u,D,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[D]=e,I=(u,D)=>{for(var e in D||(D={}))pr.call(D,e)&&dD(u,e,D[e]);if(pD)for(var e of pD(D))dr.call(D,e)&&dD(u,e,D[e]);return u},Er=(u,D)=>cr(u,fr(D));function ED(u){var D,e;const t=gu.default.realpathSync(u),r=B.default.dirname(t),n=gu.default.readFileSync(u,"utf8").trim();let a={};if(n&&(a=Fr(n),!a||typeof a!="object"))throw new SyntaxError(`Failed to parse JSON: ${u}`);if(a.extends){let i=a.extends;try{i=cD.resolve(i,{paths:[B.default.dirname(u)]})}catch(s){if(s.code==="MODULE_NOT_FOUND")try{i=cD.resolve(B.default.join(i,"tsconfig.json"),{paths:[B.default.dirname(u)]})}catch{}}const o=ED(i);if(delete o.references,(D=o.compilerOptions)!=null&&D.baseUrl){const{compilerOptions:s}=o;s.baseUrl=B.default.relative(r,B.default.join(B.default.dirname(i),s.baseUrl))}o.files&&(o.files=o.files.map(s=>B.default.relative(r,B.default.join(B.default.dirname(i),s)))),o.include&&(o.include=o.include.map(s=>B.default.relative(r,B.default.join(B.default.dirname(i),s)))),delete a.extends;const l=Er(I(I({},o),a),{compilerOptions:I(I({},o.compilerOptions),a.compilerOptions)});o.watchOptions&&(l.watchOptions=I(I({},o.watchOptions),a.watchOptions)),a=l}if((e=a.compilerOptions)!=null&&e.baseUrl){const{compilerOptions:i}=a;i.baseUrl=fD(i.baseUrl)}if(a.files&&(a.files=a.files.map(fD)),a.include&&(a.include=a.include.map(X)),a.watchOptions){const{watchOptions:i}=a;i.excludeDirectories&&(i.excludeDirectories=i.excludeDirectories.map(o=>X(B.default.resolve(r,o))))}return a}function gr(u=process.cwd(),D="tsconfig.json"){const e=or(u,D);if(!e)return null;const t=ED(e);return{path:e,config:t}}var hr=gr;const gD=hr();var mr=Object.defineProperty,Br=Object.defineProperties,br=Object.getOwnPropertyDescriptors,hD=Object.getOwnPropertySymbols,yr=Object.prototype.hasOwnProperty,Ar=Object.prototype.propertyIsEnumerable,mD=(u,D,e)=>D in u?mr(u,D,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[D]=e,BD=(u,D)=>{for(var e in D||(D={}))yr.call(D,e)&&mD(u,e,D[e]);if(hD)for(var e of hD(D))Ar.call(D,e)&&mD(u,e,D[e]);return u},bD=(u,D)=>Br(u,br(D));function vr(u){const D=UD.createFilter(/\.([cm]?ts|[jt]sx)$/);return{name:"esbuild-transform",async transform(e,t){var r;if(!D(t))return null;const n=await bu.transform(e,bD(BD({},u),{loader:"default",sourcefile:t.replace(/\.[cm]ts/,".ts"),tsconfigRaw:(r=gD)==null?void 0:r.config}));return{code:n.code,map:n.map||null}}}}const wr=u=>{if(u==="es")return"esm";if(u==="cjs"||u==="iife")return u};function $r(u){return{name:"esbuild-minify",async renderChunk(D,e,t){const r=await bu.transform(D,bD(BD({},u),{format:wr(t.format),minify:!0}));return{code:r.code,map:r.map||null}}}}const mu=(u,D)=>u[0]-D[0]||u[1]-D[1]||u[2]-D[2],yD=({target:u})=>{const D=u.some(e=>{var t,r;if(e=e.trim(),!e.startsWith("node"))return;const n=e.slice(4).split(".").map(Number),a=[n[0],(t=n[1])!=null?t:0,(r=n[2])!=null?r:0];return!(mu(a,[12,20,0])>=0&&mu(a,[13,0,0])<0||mu(a,[14,13,1])>=0)});return{name:"externalize-node-builtins",resolveId:e=>{const t=e.startsWith("node:");if(D&&t&&(e=e.slice(5)),zD.builtinModules.includes(e)||t)return{id:e,external:!0}}}},Or=u=>({name:"patch-binary",renderChunk(D,e,t){if(!e.isEntry||!e.facadeModuleId)return;const r=t.entryFileNames,n=`./${x.default.join(t.dir,r(e))}`;if(u.includes(n)){const a=new XD.default(D);return a.prepend(`#!/usr/bin/env node
|
|
33
|
+
`),{code:a.toString(),map:t.sourcemap?a.generateMap({hires:!0}):void 0}}},async writeBundle(D,e){const t=D.entryFileNames,r=Object.values(e).map(async n=>{const a=n;if(a.isEntry&&a.facadeModuleId){const i=x.default.join(D.dir,t(a));await P.default.promises.chmod(i,493)}});await Promise.all(r)}});function AD(){const u=/\.(?:mjs|cjs)$/,D=/\.(?:mts|cts)$/;return{name:"resolve-typescript-mjs-cjs",resolveId(e,t,r){return u.test(e)&&t&&D.test(t)?this.resolve(e.replace(/js$/,"ts"),t,r):null}}}const vD={async type(u){const D=await Promise.resolve().then(function(){return require("./rollup-plugin-dts-bad50ac6.js")});return{input:[],preserveEntrySignatures:"strict",plugins:[yD(u),AD(),D.default({respectExternal:!0})],output:[],external:[]}},app(u,D,e){const t={target:u.target};return{input:[],preserveEntrySignatures:"strict",plugins:[yD(u),AD(),HD.default({entries:D}),ZD.default({extensions:[".mjs",".js",".ts",".jsx",".tsx",".json"],exportConditions:["node","import","require","default"]}),YD.default(),JD.default(),vr(t),tr(),...u.minify?[$r(t)]:[],Or(e)],output:[],external:[]}}};async function jr(u,D,e,t,r,n){const a=e.filter(({exportEntry:o})=>o.isExecutable).map(({exportEntry:o})=>o.outputPath),i=Object.create(null);for(const{input:o,exportEntry:l}of e){if(l.type==="types"){let f=i.type;f||(f=await vD.type(t),f.external=n,i.type=f),f.input.push(o);const h=".d.ts";f.output=[{dir:D,entryFileNames:b=>P.default.realpathSync.native(b.facadeModuleId).slice(u.length).replace(/\.\w+$/,h),exports:"auto",format:"esm"}];continue}let s=i.app;s||(s=vD.app(t,r,a),s.external=n,i.app=s),s.input.includes(o)||s.input.push(o);const F=s.output,C=x.default.extname(l.outputPath),p=`${l.type}-${C}`;if(!F[p]){const f={dir:D,exports:"auto",format:l.type,chunkFileNames:`[name]-[hash]${C}`,plugins:[rr(l.type==="module")],entryFileNames:h=>P.default.realpathSync.native(h.facadeModuleId).slice(u.length).replace(/\.\w+$/,C)};F.push(f),F[p]=f}}return i}let S=!0;const R=typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{};let wD=0;if(R.process&&R.process.env&&R.process.stdout){const{FORCE_COLOR:u,NODE_DISABLE_COLORS:D,TERM:e}=R.process.env;D||u==="0"?S=!1:u==="1"?S=!0:e==="dumb"?S=!1:"CI"in R.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(t=>t in R.process.env)?S=!0:S=process.stdout.isTTY,S&&(wD=e&&e.endsWith("-256color")?2:1)}let $D={enabled:S,supportLevel:wD};function _r(u,D,e=1){const t=`\x1B[${u}m`,r=`\x1B[${D}m`,n=new RegExp(`\\x1b\\[${D}m`,"g");return a=>$D.enabled&&$D.supportLevel>=e?t+(""+a).replace(n,t)+r:""+a}const Pr=_r(90,39),xr=()=>new Date().toLocaleTimeString(),Du=(...u)=>console.log(`[${Pr(xr())}]`,...u);var OD,jD;const G=Nt.cli({name:"pkgroll",flags:{src:{type:String,description:"Source directory",default:"./src"},dist:{type:String,description:"Distribution directory",default:"./dist"},minify:{type:Boolean,description:"Minify output",alias:"m",default:!1},target:{type:[String],default:[`node${process.versions.node}`],description:"Environments to support. `target` in tsconfig.json is automatically added. Defaults to the current Node.js version.",alias:"t"},watch:{type:Boolean,description:"Watch mode",alias:"w",default:!1}},help:{description:"Minimalistic package bundler"}}),_D=process.cwd(),PD=Q(G.flags.src,!0),xD=Q(G.flags.dist,!0),kD=(jD=(OD=gD)==null?void 0:OD.config.compilerOptions)==null?void 0:jD.target;kD&&G.flags.target.push(kD),(async()=>{const u=await Mt(_D),D=zt(u);if(D.length===0)throw new Error("No export entries found in package.json");const e=await Promise.all(D.map(async a=>({input:await Jt(a,PD,xD),exportEntry:a}))),t=Zt(u,_D),r=Gt(u).filter(a=>!(a in t)).flatMap(a=>[a,new RegExp(`^${a}/`)]),n=await jr(Q(P.default.realpathSync.native(PD),!0),xD,e,G.flags,t,r);G.flags.watch?(Du("Watch initialized"),Object.values(n).map(async a=>{Bu.watch(a).on("event",async o=>{o.code==="BUNDLE_START"&&Du("Building",...Array.isArray(o.input)?o.input:[o.input]),o.code==="BUNDLE_END"&&(await Promise.all(a.output.map(l=>o.result.write(l))),Du("Built",...Array.isArray(o.input)?o.input:[o.input])),o.code==="ERROR"&&Du("Error:",o.error.message)})})):await Promise.all(Object.values(n).map(async a=>{const i=await Bu.rollup(a);return Promise.all(a.output.map(o=>i.write(o)))}))})().catch(u=>{console.error("Error:",u.message),process.exit(1)});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";var Q=Object.defineProperty,Z=Object.defineProperties;var X=Object.getOwnPropertyDescriptors;var O=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var V=(i,e,t)=>e in i?Q(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,C=(i,e)=>{for(var t in e||(e={}))ee.call(e,t)&&V(i,t,e[t]);if(O)for(var t of O(e))te.call(e,t)&&V(i,t,e[t]);return i},K=(i,e)=>Z(i,X(e));var re=require("module"),ne=require("path"),ie=require("magic-string");function se(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}function ae(i){if(i&&i.__esModule)return i;var e=Object.create(null);return i&&Object.keys(i).forEach(function(t){if(t!=="default"){var n=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:function(){return i[t]}})}}),e.default=i,Object.freeze(e)}var T=ae(ne),oe=se(ie),M=require;function ce(){const i=process.cwd();try{return M.resolve("typescript",{paths:[i]})}catch{throw new Error(`Could not find \`typescript\` in ${i}`)}}var r=M(ce());const $=".d.ts",R={getCurrentDirectory:()=>r.sys.getCurrentDirectory(),getNewLine:()=>r.sys.newLine,getCanonicalFileName:r.sys.useCaseSensitiveFileNames?i=>i:i=>i.toLowerCase()},le={declaration:!0,noEmit:!1,emitDeclarationOnly:!0,noEmitOnError:!0,checkJs:!1,declarationMap:!1,skipLibCheck:!0,preserveSymlinks:!0,target:r.ScriptTarget.ESNext};function q(i,e){const t=C(C({},le),e);let n=T.dirname(i),s=[];const o=r.findConfigFile(n,r.sys.fileExists);if(!o)return{dtsFiles:s,dirName:n,compilerOptions:t};n=T.dirname(o);const{config:l,error:c}=r.readConfigFile(o,r.sys.readFile);if(c)return console.error(r.formatDiagnostic(c,R)),{dtsFiles:s,dirName:n,compilerOptions:t};const{fileNames:p,options:m,errors:f}=r.parseJsonConfigFileContent(l,r.sys,n);return s=p.filter(d=>d.endsWith($)),f.length?(console.error(r.formatDiagnostics(f,R)),{dtsFiles:s,dirName:n,compilerOptions:t}):{dtsFiles:s,dirName:n,compilerOptions:C(C({},m),t)}}function pe(i,e){const{dtsFiles:t,compilerOptions:n}=q(i,e);return r.createProgram([i].concat(Array.from(t)),n,r.createCompilerHost(n,!0))}function fe(i,e){const t=[];let n=[],s=new Set,o="",l={};for(let c of i){if(c.endsWith($))continue;c=T.resolve(c);const p=q(c,e);if(p.dtsFiles.forEach(s.add,s),!n.length){n.push(c),{dirName:o,compilerOptions:l}=p;continue}if(p.dirName===o)n.push(c);else{const m=r.createCompilerHost(l,!0),f=r.createProgram(n.concat(Array.from(s)),l,m);t.push(f),n=[c],{dirName:o,compilerOptions:l}=p}}if(n.length){const c=r.createCompilerHost(l,!0),p=r.createProgram(n.concat(Array.from(s)),l,c);t.push(p)}return t}function ue(){let i;try{return{codeFrameColumns:i}=M("@babel/code-frame"),i}catch{try{return{codeFrameColumns:i}=re.createRequire(typeof document=="undefined"?new(require("url")).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("rollup-plugin-dts-bad50ac6.js",document.baseURI).href)("@babel/code-frame"),i}catch{}}}function me(i){const e=i.getSourceFile(),t=e.getLineAndCharacterOfPosition(i.getStart()),n=e.getLineAndCharacterOfPosition(i.getEnd());return{start:{line:t.line+1,column:t.character+1},end:{line:n.line+1,column:n.character+1}}}function de(i){const e=ue(),n=i.getSourceFile().getFullText(),s=me(i);return e?`
|
|
2
|
+
`+e(n,s,{highlightCode:!0}):`
|
|
3
|
+
${s.start.line}:${s.start.column}: \`${i.getFullText().trim()}\``}class h extends Error{constructor(e,t="Syntax not yet supported"){super(`${t}
|
|
4
|
+
${de(e)}`)}}class ye{constructor(e){this.sourceFile=e}findNamespaces(){const e=[],t={};for(const n of this.sourceFile.statements){const s={start:n.getStart(),end:n.getEnd()};if(r.isEmptyStatement(n)){e.unshift({name:"",exports:[],location:s});continue}if((r.isImportDeclaration(n)||r.isExportDeclaration(n))&&n.moduleSpecifier&&r.isStringLiteral(n.moduleSpecifier)){let{text:f}=n.moduleSpecifier;if(f.startsWith(".")&&(f.endsWith(".d.ts")||f.endsWith(".d.cts")||f.endsWith(".d.mts"))){let d=n.moduleSpecifier.getStart()+1,N=n.moduleSpecifier.getEnd()-1;e.unshift({name:"",exports:[],location:{start:d,end:N},textBeforeCodeAfter:f.replace(/\.d\.ts$/,".js").replace(/\.d\.cts$/,".cjs").replace(/\.d\.mts$/,".mjs")})}}if(r.isModuleDeclaration(n)&&n.body&&r.isModuleBlock(n.body)){for(const f of n.body.statements)if(r.isExportDeclaration(f)&&f.exportClause){if(r.isNamespaceExport(f.exportClause))continue;for(const d of f.exportClause.elements)d.propertyName&&d.propertyName.getText()==d.name.getText()&&e.unshift({name:"",exports:[],location:{start:d.propertyName.getEnd(),end:d.name.getEnd()}})}}if(r.isClassDeclaration(n)?t[n.name.getText()]={type:"class",generics:n.typeParameters}:r.isFunctionDeclaration(n)?t[n.name.getText()]={type:"function"}:r.isInterfaceDeclaration(n)?t[n.name.getText()]={type:"interface",generics:n.typeParameters}:r.isTypeAliasDeclaration(n)?t[n.name.getText()]={type:"type",generics:n.typeParameters}:r.isModuleDeclaration(n)&&r.isIdentifier(n.name)?t[n.name.getText()]={type:"namespace"}:r.isEnumDeclaration(n)&&(t[n.name.getText()]={type:"enum"}),!r.isVariableStatement(n))continue;const{declarations:o}=n.declarationList;if(o.length!==1)continue;const l=o[0],c=l.name.getText();if(!l.initializer||!r.isCallExpression(l.initializer)){t[c]={type:"var"};continue}const p=l.initializer.arguments[0];if(!l.initializer.expression.getFullText().includes("/*#__PURE__*/Object.freeze")||!r.isObjectLiteralExpression(p))continue;const m=[];for(const f of p.properties){if(!r.isPropertyAssignment(f)||!(r.isIdentifier(f.name)||r.isStringLiteral(f.name))||f.name.text!=="__proto__"&&!r.isIdentifier(f.initializer))throw new h(f,"Expected a property assignment");f.name.text!=="__proto__"&&m.push({exportedName:f.name.text,localName:f.initializer.getText()})}e.unshift({name:c,exports:m,location:s})}return{namespaces:e,itemTypes:t}}fix(){var e;let t=this.sourceFile.getFullText();const{namespaces:n,itemTypes:s}=this.findNamespaces();for(const o of n){const l=t.slice(o.location.end);t=t.slice(0,o.location.start);for(const{exportedName:c,localName:p}of o.exports)if(c===p){const{type:m,generics:f}=s[p]||{};if(m==="interface"||m==="type"){const d=B(f);t+=`type ${o.name}_${c}${d.in} = ${p}${d.out};
|
|
5
|
+
`}else if(m==="enum"||m==="class"){const d=B(f);t+=`type ${o.name}_${c}${d.in} = ${p}${d.out};
|
|
6
|
+
`,t+=`declare const ${o.name}_${c}: typeof ${p};
|
|
7
|
+
`}else t+=`declare const ${o.name}_${c}: typeof ${p};
|
|
8
|
+
`}if(o.name){t+=`declare namespace ${o.name} {
|
|
9
|
+
`,t+=` export {
|
|
10
|
+
`;for(const{exportedName:c,localName:p}of o.exports)c===p?t+=` ${o.name}_${c} as ${c},
|
|
11
|
+
`:t+=` ${p} as ${c},
|
|
12
|
+
`;t+=` };
|
|
13
|
+
`,t+="}"}t+=(e=o.textBeforeCodeAfter)!==null&&e!==void 0?e:"",t+=l}return t}}function B(i){return!i||!i.length?{in:"",out:""}:{in:`<${i.map(e=>e.getText()).join(", ")}>`,out:`<${i.map(e=>e.name.getText()).join(", ")}>`}}let U=1;function he(i){return S({type:"Program",sourceType:"module",body:[]},{start:i.getFullStart(),end:i.getEnd()})}function ge(i){return{type:"AssignmentPattern",left:{type:"Identifier",name:String(U++)},right:i}}function v(i){return S({type:"Identifier",name:i.getText()},i)}function xe(i){const e=S({type:"FunctionExpression",id:null,params:[],body:{type:"BlockStatement",body:[]}},i),t=S({type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:String(U++)},arguments:[e],optional:!1}},i);return{fn:e,iife:t}}function Se(i,e){return S({type:"FunctionDeclaration",id:S({type:"Identifier",name:r.idText(i)},i),params:[],body:{type:"BlockStatement",body:[]}},e)}function I(i){if(r.isLiteralExpression(i))return{type:"Literal",value:i.text};if(r.isPropertyAccessExpression(i)){if(r.isPrivateIdentifier(i.name))throw new h(i.name);return S({type:"MemberExpression",computed:!1,optional:!1,object:I(i.expression),property:I(i.name)},{start:i.expression.getStart(),end:i.name.getEnd()})}if(r.isIdentifier(i))return v(i);if(i.kind==r.SyntaxKind.NullKeyword)return{type:"Literal",value:null};throw new h(i)}function S(i,e){let t="start"in e?e:{start:e.getStart(),end:e.getEnd()};return Object.assign(i,t)}function L(i,e){return(r.getCombinedModifierFlags(i)&e)===e}function ve({sourceFile:i}){const e=new oe.default(i.getFullText()),t=new Set,n=new Set;let s="";const o=new Map,l=new Map;for(const a of i.statements){if(r.isEmptyStatement(a)){e.remove(a.getStart(),a.getEnd());continue}if(r.isEnumDeclaration(a)||r.isFunctionDeclaration(a)||r.isInterfaceDeclaration(a)||r.isClassDeclaration(a)||r.isTypeAliasDeclaration(a)||r.isModuleDeclaration(a)){if(a.name){const u=a.name.getText();t.add(u),L(a,r.ModifierFlags.ExportDefault)?s=u:L(a,r.ModifierFlags.Export)&&n.add(u),a.flags&r.NodeFlags.GlobalAugmentation||P(u,[_(a),W(a)])}r.isModuleDeclaration(a)&&Te(e,a),z(e,a)}else if(r.isVariableStatement(a)){const{declarations:u}=a.declarationList,g=L(a,r.ModifierFlags.Export);for(const x of a.declarationList.declarations)if(r.isIdentifier(x.name)){const D=x.name.getText();t.add(D),g&&n.add(D)}if(z(e,a),u.length==1){const x=u[0];r.isIdentifier(x.name)&&P(x.name.getText(),[_(a),W(a)])}else{const x=u.slice(),D=x.shift();P(D.name.getText(),[_(a),D.getEnd()]);for(const b of x)r.isIdentifier(b.name)&&P(b.name.getText(),[b.getFullStart(),b.getEnd()])}const{flags:y}=a.declarationList,F=`declare ${y&r.NodeFlags.Let?"let":y&r.NodeFlags.Const?"const":"var"} `,A=a.declarationList.getChildren().find(x=>x.kind===r.SyntaxKind.SyntaxList).getChildren();let E=0;for(const x of A)if(x.kind===r.SyntaxKind.CommaToken)E=x.getStart(),e.remove(E,x.getEnd());else if(E){e.appendLeft(E,`;
|
|
14
|
+
`);const D=x.getFullStart(),b=e.slice(D,x.getStart());let j=b.length-b.trimStart().length;j?e.overwrite(D,D+j,F):e.appendLeft(D,F)}}}for(const a of i.statements)if(f(a),!!L(a,r.ModifierFlags.ExportDefault)&&(r.isFunctionDeclaration(a)||r.isClassDeclaration(a))){if(a.name)continue;s||(s=N("export_default"));const u=a.getChildren(),g=u.findIndex(A=>A.kind===r.SyntaxKind.ClassKeyword||A.kind===r.SyntaxKind.FunctionKeyword),y=u[g],w=u[g+1];w.kind>=r.SyntaxKind.FirstPunctuation&&w.kind<=r.SyntaxKind.LastPunctuation?e.appendLeft(w.getStart(),s):e.appendRight(y.getEnd(),` ${s}`)}for(const a of l.values()){const g=a.pop()[0];for(const y of a)e.move(y[0],y[1],g)}s&&e.append(`
|
|
15
|
+
export default ${s};
|
|
16
|
+
`),n.size&&e.append(`
|
|
17
|
+
export { ${[...n].join(", ")} };
|
|
18
|
+
`);for(const[a,u]of o.entries())e.prepend(`import * as ${u} from "${a}";
|
|
19
|
+
`);const c=i.getLineStarts(),p=new Set;for(const a of i.typeReferenceDirectives){p.add(a.fileName);const{line:u}=i.getLineAndCharacterOfPosition(a.pos),g=c[u];let y=i.getLineEndOfPosition(a.pos);e.slice(y,y+1)==`
|
|
20
|
+
`&&(y+=1),e.remove(g,y)}const m=new Set;for(const a of i.referencedFiles){m.add(T.join(T.dirname(i.fileName),a.fileName));const{line:u}=i.getLineAndCharacterOfPosition(a.pos),g=c[u];let y=i.getLineEndOfPosition(a.pos);e.slice(y,y+1)==`
|
|
21
|
+
`&&(y+=1),e.remove(g,y)}return{code:e,typeReferences:p,fileReferences:m};function f(a){if(r.forEachChild(a,f),r.isImportTypeNode(a)){if(!r.isLiteralTypeNode(a.argument)||!r.isStringLiteral(a.argument.literal))throw new h(a,"inline imports should have a literal argument");const u=a.argument.literal.text,g=a.getChildren(),y=g.find(E=>E.kind===r.SyntaxKind.ImportKeyword).getStart();let w=a.getEnd();const F=g.find(E=>E.kind===r.SyntaxKind.DotToken||E.kind===r.SyntaxKind.LessThanToken);F&&(w=F.getStart());const A=d(u);e.overwrite(y,w,A)}}function d(a){let u=o.get(a);return u||(u=N(a.replace(/[^a-zA-Z0-9_$]/g,()=>"_")),o.set(a,u)),u}function N(a){let u=a;for(;t.has(u);)u=`_${u}`;return t.add(u),u}function P(a,u){let g=l.get(a);if(!g)g=[u],l.set(a,g);else{const y=g[g.length-1];y[1]===u[0]?y[1]=u[1]:g.push(u)}}}function z(i,e){var t;let n=!1;const s=r.isClassDeclaration(e)||r.isFunctionDeclaration(e)||r.isModuleDeclaration(e)||r.isVariableStatement(e);for(const o of(t=e.modifiers)!==null&&t!==void 0?t:[])switch(o.kind){case r.SyntaxKind.ExportKeyword:case r.SyntaxKind.DefaultKeyword:i.remove(o.getStart(),o.getEnd()+1);break;case r.SyntaxKind.DeclareKeyword:n=!0}s&&!n&&i.appendRight(e.getStart(),"declare ")}function Te(i,e){if(!(!e.body||!r.isModuleBlock(e.body))){for(const t of e.body.statements)if(r.isExportDeclaration(t)&&t.exportClause){if(r.isNamespaceExport(t.exportClause))continue;for(const n of t.exportClause.elements)n.propertyName||i.appendLeft(n.name.getEnd(),` as ${n.name.getText()}`)}}}function _(i){const e=i.getFullStart();return e+(G(i,e)?1:0)}function W(i){const e=i.getEnd();return e+(G(i,e)?1:0)}function G(i,e){return i.getSourceFile().getFullText()[e]==`
|
|
22
|
+
`}const Ne=new Set([r.SyntaxKind.LiteralType,r.SyntaxKind.VoidKeyword,r.SyntaxKind.UnknownKeyword,r.SyntaxKind.AnyKeyword,r.SyntaxKind.BooleanKeyword,r.SyntaxKind.NumberKeyword,r.SyntaxKind.StringKeyword,r.SyntaxKind.ObjectKeyword,r.SyntaxKind.NullKeyword,r.SyntaxKind.UndefinedKeyword,r.SyntaxKind.SymbolKeyword,r.SyntaxKind.NeverKeyword,r.SyntaxKind.ThisKeyword,r.SyntaxKind.ThisType,r.SyntaxKind.BigIntKeyword]);class H{constructor({id:e,range:t}){if(this.scopes=[],e)this.declaration=Se(e,t);else{const{iife:n,fn:s}=xe(t);this.iife=n,this.declaration=s}}pushScope(){this.scopes.push(new Set)}popScope(e=1){for(let t=0;t<e;t++)this.scopes.pop()}pushTypeVariable(e){var t;const n=e.getText();(t=this.scopes[this.scopes.length-1])===null||t===void 0||t.add(n)}pushRaw(e){this.declaration.params.push(e)}pushReference(e){let t;if(e.type==="Identifier"?t=e.name:e.type==="MemberExpression"&&e.object.type==="Identifier"&&(t=e.object.name),t){for(const n of this.scopes)if(n.has(t))return}this.pushRaw(ge(e))}pushIdentifierReference(e){this.pushReference(v(e))}convertEntityName(e){return r.isIdentifier(e)?v(e):S({type:"MemberExpression",computed:!1,optional:!1,object:this.convertEntityName(e.left),property:v(e.right)},e)}convertPropertyAccess(e){if(!r.isIdentifier(e.expression)&&!r.isPropertyAccessExpression(e.expression))throw new h(e.expression);if(r.isPrivateIdentifier(e.name))throw new h(e.name);let t=r.isIdentifier(e.expression)?v(e.expression):this.convertPropertyAccess(e.expression);return S({type:"MemberExpression",computed:!1,optional:!1,object:t,property:v(e.name)},e)}convertComputedPropertyName(e){if(!e.name||!r.isComputedPropertyName(e.name))return;const{expression:t}=e.name;if(!r.isLiteralExpression(t)){if(r.isIdentifier(t))return this.pushReference(v(t));if(r.isPropertyAccessExpression(t))return this.pushReference(this.convertPropertyAccess(t));throw new h(t)}}convertParametersAndType(e){this.convertComputedPropertyName(e);const t=this.convertTypeParameters(e.typeParameters);for(const n of e.parameters)this.convertTypeNode(n.type);this.convertTypeNode(e.type),this.popScope(t)}convertHeritageClauses(e){for(const t of e.heritageClauses||[])for(const n of t.types)this.pushReference(I(n.expression)),this.convertTypeArguments(n)}convertTypeArguments(e){if(!!e.typeArguments)for(const t of e.typeArguments)this.convertTypeNode(t)}convertMembers(e){for(const t of e){if(r.isPropertyDeclaration(t)||r.isPropertySignature(t)||r.isIndexSignatureDeclaration(t)){this.convertComputedPropertyName(t),this.convertTypeNode(t.type);continue}if(r.isMethodDeclaration(t)||r.isMethodSignature(t)||r.isConstructorDeclaration(t)||r.isConstructSignatureDeclaration(t)||r.isCallSignatureDeclaration(t)||r.isGetAccessorDeclaration(t)||r.isSetAccessorDeclaration(t))this.convertParametersAndType(t);else throw new h(t)}}convertTypeParameters(e){if(!e)return 0;for(const t of e)this.convertTypeNode(t.constraint),this.convertTypeNode(t.default),this.pushScope(),this.pushTypeVariable(t.name);return e.length}convertTypeNode(e){if(!!e&&!Ne.has(e.kind)){if(r.isTypeReferenceNode(e)){this.pushReference(this.convertEntityName(e.typeName)),this.convertTypeArguments(e);return}if(r.isTypeLiteralNode(e))return this.convertMembers(e.members);if(r.isArrayTypeNode(e))return this.convertTypeNode(e.elementType);if(r.isTupleTypeNode(e)){for(const t of e.elements)this.convertTypeNode(t);return}if(r.isNamedTupleMember(e)||r.isParenthesizedTypeNode(e)||r.isTypeOperatorNode(e)||r.isTypePredicateNode(e))return this.convertTypeNode(e.type);if(r.isUnionTypeNode(e)||r.isIntersectionTypeNode(e)){for(const t of e.types)this.convertTypeNode(t);return}if(r.isMappedTypeNode(e)){const{typeParameter:t,type:n,nameType:s}=e;this.convertTypeNode(t.constraint),this.pushScope(),this.pushTypeVariable(t.name),this.convertTypeNode(n),s&&this.convertTypeNode(s),this.popScope();return}if(r.isConditionalTypeNode(e)){this.convertTypeNode(e.checkType),this.pushScope(),this.convertTypeNode(e.extendsType),this.convertTypeNode(e.trueType),this.convertTypeNode(e.falseType),this.popScope();return}if(r.isIndexedAccessTypeNode(e)){this.convertTypeNode(e.objectType),this.convertTypeNode(e.indexType);return}if(r.isFunctionOrConstructorTypeNode(e)){this.convertParametersAndType(e);return}if(r.isTypeQueryNode(e)){this.pushReference(this.convertEntityName(e.exprName));return}if(r.isRestTypeNode(e)){this.convertTypeNode(e.type);return}if(r.isOptionalTypeNode(e)){this.convertTypeNode(e.type);return}if(r.isTemplateLiteralTypeNode(e)){for(const t of e.templateSpans)this.convertTypeNode(t.type);return}if(r.isInferTypeNode(e)){this.pushTypeVariable(e.typeParameter.name);return}else throw new h(e)}}convertNamespace(e,t=!1){if(this.pushScope(),t&&e.body&&r.isModuleDeclaration(e.body)){this.convertNamespace(e.body,!0);return}if(!e.body||!r.isModuleBlock(e.body))throw new h(e,'namespace must have a "ModuleBlock" body.');const{statements:n}=e.body;for(const s of n){if(r.isEnumDeclaration(s)||r.isFunctionDeclaration(s)||r.isClassDeclaration(s)||r.isInterfaceDeclaration(s)||r.isTypeAliasDeclaration(s)||r.isModuleDeclaration(s)){if(s.name&&r.isIdentifier(s.name))this.pushTypeVariable(s.name);else throw new h(s,"non-Identifier name not supported");continue}if(r.isVariableStatement(s)){for(const o of s.declarationList.declarations)if(r.isIdentifier(o.name))this.pushTypeVariable(o.name);else throw new h(o,"non-Identifier name not supported");continue}if(!r.isExportDeclaration(s))throw new h(s,"namespace child (hoisting) not supported yet")}for(const s of n){if(r.isVariableStatement(s)){for(const o of s.declarationList.declarations)o.type&&this.convertTypeNode(o.type);continue}if(r.isFunctionDeclaration(s)){this.convertParametersAndType(s);continue}if(r.isInterfaceDeclaration(s)||r.isClassDeclaration(s)){const o=this.convertTypeParameters(s.typeParameters);this.convertHeritageClauses(s),this.convertMembers(s.members),this.popScope(o);continue}if(r.isTypeAliasDeclaration(s)){const o=this.convertTypeParameters(s.typeParameters);this.convertTypeNode(s.type),this.popScope(o);continue}if(r.isModuleDeclaration(s)){this.convertNamespace(s,t);continue}if(!r.isEnumDeclaration(s))if(r.isExportDeclaration(s)){if(s.exportClause){if(r.isNamespaceExport(s.exportClause))throw new h(s.exportClause);for(const o of s.exportClause.elements){const l=o.propertyName||o.name;this.pushIdentifierReference(l)}}}else throw new h(s,"namespace child (walking) not supported yet")}this.popScope()}}function De({sourceFile:i}){return new Ee(i).transform()}class Ee{constructor(e){this.sourceFile=e,this.declarations=new Map,this.ast=he(e);for(const t of e.statements)this.convertStatement(t)}transform(){return{ast:this.ast}}pushStatement(e){this.ast.body.push(e)}createDeclaration(e,t){const n={start:e.getFullStart(),end:e.getEnd()};if(!t){const c=new H({range:n});return this.pushStatement(c.iife),c}const s=t.getText(),o=new H({id:t,range:n}),l=this.declarations.get(s);if(l){l.pushIdentifierReference(t),l.declaration.end=n.end;let c=this.ast.body.findIndex(p=>p==l.declaration);for(let p=c+1;p<this.ast.body.length;p++){const m=this.ast.body[p];m.start=m.end=n.end}}else this.pushStatement(o.declaration),this.declarations.set(s,o);return l||o}convertStatement(e){if(r.isEnumDeclaration(e))return this.convertEnumDeclaration(e);if(r.isFunctionDeclaration(e))return this.convertFunctionDeclaration(e);if(r.isInterfaceDeclaration(e)||r.isClassDeclaration(e))return this.convertClassOrInterfaceDeclaration(e);if(r.isTypeAliasDeclaration(e))return this.convertTypeAliasDeclaration(e);if(r.isVariableStatement(e))return this.convertVariableStatement(e);if(r.isExportDeclaration(e)||r.isExportAssignment(e))return this.convertExportDeclaration(e);if(r.isModuleDeclaration(e))return this.convertNamespaceDeclaration(e);if(e.kind==r.SyntaxKind.NamespaceExportDeclaration)return this.removeStatement(e);if(r.isImportDeclaration(e)||r.isImportEqualsDeclaration(e))return this.convertImportDeclaration(e);throw new h(e)}removeStatement(e){this.pushStatement(S({type:"ExpressionStatement",expression:{type:"Literal",value:"pls remove me"}},e))}convertNamespaceDeclaration(e){if(e.flags&r.NodeFlags.GlobalAugmentation||!r.isIdentifier(e.name)){this.createDeclaration(e).convertNamespace(e,!0);return}const n=this.createDeclaration(e,e.name);n.pushIdentifierReference(e.name),n.convertNamespace(e)}convertEnumDeclaration(e){this.createDeclaration(e,e.name).pushIdentifierReference(e.name)}convertFunctionDeclaration(e){if(!e.name)throw new h(e,"FunctionDeclaration should have a name");const t=this.createDeclaration(e,e.name);t.pushIdentifierReference(e.name),t.convertParametersAndType(e)}convertClassOrInterfaceDeclaration(e){if(!e.name)throw new h(e,"ClassDeclaration / InterfaceDeclaration should have a name");const t=this.createDeclaration(e,e.name),n=t.convertTypeParameters(e.typeParameters);t.convertHeritageClauses(e),t.convertMembers(e.members),t.popScope(n)}convertTypeAliasDeclaration(e){const t=this.createDeclaration(e,e.name),n=t.convertTypeParameters(e.typeParameters);t.convertTypeNode(e.type),t.popScope(n)}convertVariableStatement(e){const{declarations:t}=e.declarationList;if(t.length!==1)throw new h(e,"VariableStatement with more than one declaration not yet supported");for(const n of t){if(!r.isIdentifier(n.name))throw new h(e,"VariableDeclaration must have a name");this.createDeclaration(e,n.name).convertTypeNode(n.type)}}convertExportDeclaration(e){if(r.isExportAssignment(e)){this.pushStatement(S({type:"ExportDefaultDeclaration",declaration:I(e.expression)},e));return}const t=e.moduleSpecifier?I(e.moduleSpecifier):void 0;if(!e.exportClause)this.pushStatement(S({type:"ExportAllDeclaration",source:t,exported:null},e));else if(r.isNamespaceExport(e.exportClause))this.pushStatement(S({type:"ExportAllDeclaration",source:t,exported:v(e.exportClause.name)},e));else{const n=[];for(const s of e.exportClause.elements)n.push(this.convertExportSpecifier(s));this.pushStatement(S({type:"ExportNamedDeclaration",declaration:null,specifiers:n,source:t},e))}}convertImportDeclaration(e){if(r.isImportEqualsDeclaration(e)){if(!r.isExternalModuleReference(e.moduleReference))throw new h(e,"ImportEquals should have a literal source.");this.pushStatement(S({type:"ImportDeclaration",specifiers:[{type:"ImportDefaultSpecifier",local:v(e.name)}],source:I(e.moduleReference.expression)},e));return}const t=I(e.moduleSpecifier),n=e.importClause&&e.importClause.namedBindings?this.convertNamedImportBindings(e.importClause.namedBindings):[];e.importClause&&e.importClause.name&&n.push({type:"ImportDefaultSpecifier",local:v(e.importClause.name)}),this.pushStatement(S({type:"ImportDeclaration",specifiers:n,source:t},e))}convertNamedImportBindings(e){return r.isNamedImports(e)?e.elements.map(t=>{const n=v(t.name),s=t.propertyName?v(t.propertyName):n;return{type:"ImportSpecifier",local:n,imported:s}}):[{type:"ImportNamespaceSpecifier",local:v(e.name)}]}convertExportSpecifier(e){const t=v(e.name);return{type:"ExportSpecifier",exported:t,local:e.propertyName?v(e.propertyName):t}}}function k(i,e){return r.createSourceFile(i,e,r.ScriptTarget.Latest,!0)}const we=()=>{const i=new Map,e=new Map;return{name:"dts-transform",options(t){const{onwarn:n}=t;return K(C({},t),{onwarn(s,o){s.code!="CIRCULAR_DEPENDENCY"&&(n?n(s,o):o(s))},treeshake:{moduleSideEffects:"no-external",propertyReadSideEffects:!0,unknownGlobalSideEffects:!1}})},outputOptions(t){return K(C({},t),{chunkFileNames:t.chunkFileNames||"[name]-[hash].d.ts",entryFileNames:t.entryFileNames||"[name].d.ts",format:"es",exports:"named",compact:!1,freeze:!0,interop:!1,namespaceToStringTag:!1,strict:!1})},transform(t,n){let s=k(n,t);const o=ve({sourceFile:s});i.set(s.fileName,o.typeReferences),e.set(s.fileName,o.fileReferences),t=o.code.toString(),s=k(n,t);const l=De({sourceFile:s});return process.env.DTS_DUMP_AST&&(console.log(n),console.log(t),console.log(JSON.stringify(l.ast.body,void 0,2))),{code:t,ast:l.ast,map:o.code.generateMap()}},renderChunk(t,n,s){const o=k(n.fileName,t),l=new ye(o),c=new Set,p=new Set;for(const m of Object.keys(n.modules)){for(const f of i.get(m.split("\\").join("/"))||[])c.add(f);for(const f of e.get(m.split("\\").join("/"))||[]){const d=s.file&&T.dirname(s.file)||n.facadeModuleId&&T.dirname(n.facadeModuleId)||".";let N=T.relative(d,f).split("\\").join("/");N[0]!=="."&&(N="./"+N),p.add(N)}}return t=J(Array.from(p,m=>`/// <reference path="${m}" />`)),t+=J(Array.from(c,m=>`/// <reference types="${m}" />`)),t+=l.fix(),{code:t,map:{mappings:""}}}}};function J(i){return i.length?i.join(`
|
|
23
|
+
`)+`
|
|
24
|
+
`:""}const Y=/\.(t|j)sx?$/,be=(i={})=>{const e=we(),{respectExternal:t=!1,compilerOptions:n={}}=i;let s=[];function o(l){let c,p;return!s.length&&l.endsWith($)?c=!0:(p=s.find(m=>c=m.getSourceFile(l)),!p&&r.sys.fileExists(l)&&(s.push(p=pe(l,n)),c=p.getSourceFile(l))),{source:c,program:p}}return{name:"dts",options(l){let{input:c=[]}=l;if(!Array.isArray(c))c=typeof c=="string"?[c]:Object.values(c);else if(c.length>1){l.input={};for(const p of c){let m=p.replace(/((\.d)?\.(t|j)sx?)$/,"");T.isAbsolute(p)?m=T.basename(m):m=T.normalize(m),l.input[m]=p}}return s=fe(Object.values(c),n),e.options.call(this,l)},outputOptions:e.outputOptions,transform(l,c){const p=(a,u)=>(typeof a=="object"&&(l=a.getFullText()),e.transform.call(this,l,u));if(!Y.test(c))return null;if(c.endsWith($)){const{source:a}=o(c);return a?p(a,c):null}const m=c.replace(Y,$);let f=o(m);if(f.source)return p(f.source,m);if(f=o(c),typeof f.source!="object"||!f.program)return null;let d;const{emitSkipped:N,diagnostics:P}=f.program.emit(f.source,(a,u)=>{l=u,d=p(!0,m)},void 0,!0);if(N){const a=P.filter(u=>u.category===r.DiagnosticCategory.Error);a.length&&(console.error(r.formatDiagnostics(a,R)),this.error("Failed to compile. Check the logs above."))}return d},resolveId(l,c){if(!c)return;c=c.split("\\").join("/");const{resolvedModule:p}=r.nodeModuleNameResolver(l,c,n,r.sys);if(!!p)return!t&&p.isExternalLibraryImport?{id:l,external:!0}:{id:T.resolve(p.resolvedFileName)}},renderChunk:e.renderChunk}};exports.default=be;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pkgroll",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Zero-config rollup bundler",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"zero config",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"typescript": "./src/local-typescript-loader.ts"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"typescript": "
|
|
49
|
+
"typescript": "^4.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"typescript": {
|
|
@@ -74,14 +74,14 @@
|
|
|
74
74
|
"esno": "^0.14.1",
|
|
75
75
|
"execa": "^6.1.0",
|
|
76
76
|
"get-node": "^12.1.0",
|
|
77
|
-
"get-tsconfig": "^3.0.
|
|
77
|
+
"get-tsconfig": "^3.0.1",
|
|
78
78
|
"husky": "^4.3.8",
|
|
79
79
|
"kolorist": "^1.5.1",
|
|
80
80
|
"lint-staged": "^12.3.7",
|
|
81
81
|
"manten": "^0.0.3",
|
|
82
82
|
"rimraf": "^3.0.2",
|
|
83
83
|
"rollup-plugin-dts": "^4.2.0",
|
|
84
|
-
"type-fest": "^2.12.
|
|
84
|
+
"type-fest": "^2.12.2",
|
|
85
85
|
"typescript": "^4.6.3"
|
|
86
86
|
},
|
|
87
87
|
"eslintConfig": {
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";var F=Object.defineProperty,A=Object.defineProperties;var $=Object.getOwnPropertyDescriptors;var I=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var P=(n,e,t)=>e in n?F(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,N=(n,e)=>{for(var t in e||(e={}))L.call(e,t)&&P(n,t,e[t]);if(I)for(var t of I(e))K.call(e,t)&&P(n,t,e[t]);return n},b=(n,e)=>A(n,$(e));var require$$2=require("module"),path=require("path"),MagicString=require("magic-string");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}function _interopNamespace(n){if(n&&n.__esModule)return n;var e=Object.create(null);return n&&Object.keys(n).forEach(function(t){if(t!=="default"){var r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:function(){return n[t]}})}}),e.default=n,Object.freeze(e)}var path__namespace=_interopNamespace(path),MagicString__default=_interopDefaultLegacy(MagicString),require$1=require;function getLocalTypescriptPath(){const n=process.cwd();try{return require$1.resolve("typescript",{paths:[n]})}catch{throw new Error(`Could not find \`typescript\` in ${n}`)}}var ts=require$1(getLocalTypescriptPath());const dts=".d.ts",formatHost={getCurrentDirectory:()=>ts.sys.getCurrentDirectory(),getNewLine:()=>ts.sys.newLine,getCanonicalFileName:ts.sys.useCaseSensitiveFileNames?n=>n:n=>n.toLowerCase()},DEFAULT_OPTIONS={declaration:!0,noEmit:!1,emitDeclarationOnly:!0,noEmitOnError:!0,checkJs:!1,declarationMap:!1,skipLibCheck:!0,preserveSymlinks:!0,target:ts.ScriptTarget.ESNext};function getCompilerOptions(n,e){const t=N(N({},DEFAULT_OPTIONS),e);let r=path__namespace.dirname(n),i=[];const a=ts.findConfigFile(r,ts.sys.fileExists);if(!a)return{dtsFiles:i,dirName:r,compilerOptions:t};r=path__namespace.dirname(a);const{config:c,error:o}=ts.readConfigFile(a,ts.sys.readFile);if(o)return console.error(ts.formatDiagnostic(o,formatHost)),{dtsFiles:i,dirName:r,compilerOptions:t};const{fileNames:l,options:u,errors:p}=ts.parseJsonConfigFileContent(c,ts.sys,r);return i=l.filter(m=>m.endsWith(dts)),p.length?(console.error(ts.formatDiagnostics(p,formatHost)),{dtsFiles:i,dirName:r,compilerOptions:t}):{dtsFiles:i,dirName:r,compilerOptions:N(N({},u),t)}}function createProgram$1(n,e){const{dtsFiles:t,compilerOptions:r}=getCompilerOptions(n,e);return ts.createProgram([n].concat(Array.from(t)),r,ts.createCompilerHost(r,!0))}function createPrograms(n,e){const t=[];let r=[],i=new Set,a="",c={};for(let o of n){if(o.endsWith(dts))continue;o=path__namespace.resolve(o);const l=getCompilerOptions(o,e);if(l.dtsFiles.forEach(i.add,i),!r.length){r.push(o),{dirName:a,compilerOptions:c}=l;continue}if(l.dirName===a)r.push(o);else{const u=ts.createCompilerHost(c,!0),p=ts.createProgram(r.concat(Array.from(i)),c,u);t.push(p),r=[o],{dirName:a,compilerOptions:c}=l}}if(r.length){const o=ts.createCompilerHost(c,!0),l=ts.createProgram(r.concat(Array.from(i)),c,o);t.push(l)}return t}function getCodeFrame(){let n;try{return{codeFrameColumns:n}=require$1("@babel/code-frame"),n}catch{try{return{codeFrameColumns:n}=require$$2.createRequire(typeof document=="undefined"?new(require("url")).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("rollup-plugin-dts-dd9e9b59.js",document.baseURI).href)("@babel/code-frame"),n}catch{}}}function getLocation(n){const e=n.getSourceFile(),t=e.getLineAndCharacterOfPosition(n.getStart()),r=e.getLineAndCharacterOfPosition(n.getEnd());return{start:{line:t.line+1,column:t.character+1},end:{line:r.line+1,column:r.character+1}}}function frameNode(n){const e=getCodeFrame(),r=n.getSourceFile().getFullText(),i=getLocation(n);return e?`
|
|
2
|
-
`+e(r,i,{highlightCode:!0}):`
|
|
3
|
-
${i.start.line}:${i.start.column}: \`${n.getFullText().trim()}\``}class UnsupportedSyntaxError extends Error{constructor(e,t="Syntax not yet supported"){super(`${t}
|
|
4
|
-
${frameNode(e)}`)}}class NamespaceFixer{constructor(e){this.sourceFile=e}findNamespaces(){const e=[],t={};for(const r of this.sourceFile.statements){const i={start:r.getStart(),end:r.getEnd()};if(ts.isEmptyStatement(r)){e.unshift({name:"",exports:[],location:i});continue}if((ts.isImportDeclaration(r)||ts.isExportDeclaration(r))&&r.moduleSpecifier&&ts.isStringLiteral(r.moduleSpecifier)){let{text:p}=r.moduleSpecifier;if(p.startsWith(".")&&(p.endsWith(".d.ts")||p.endsWith(".d.cts")||p.endsWith(".d.mts"))){let m=r.moduleSpecifier.getStart()+1,g=r.moduleSpecifier.getEnd()-1;e.unshift({name:"",exports:[],location:{start:m,end:g},textBeforeCodeAfter:p.replace(/\.d\.ts$/,".js").replace(/\.d\.cts$/,".cjs").replace(/\.d\.mts$/,".mjs")})}}if(ts.isModuleDeclaration(r)&&r.body&&ts.isModuleBlock(r.body)){for(const p of r.body.statements)if(ts.isExportDeclaration(p)&&p.exportClause){if(ts.isNamespaceExport(p.exportClause))continue;for(const m of p.exportClause.elements)m.propertyName&&m.propertyName.getText()==m.name.getText()&&e.unshift({name:"",exports:[],location:{start:m.propertyName.getEnd(),end:m.name.getEnd()}})}}if(ts.isClassDeclaration(r)?t[r.name.getText()]={type:"class",generics:r.typeParameters}:ts.isFunctionDeclaration(r)?t[r.name.getText()]={type:"function"}:ts.isInterfaceDeclaration(r)?t[r.name.getText()]={type:"interface",generics:r.typeParameters}:ts.isTypeAliasDeclaration(r)?t[r.name.getText()]={type:"type",generics:r.typeParameters}:ts.isModuleDeclaration(r)&&ts.isIdentifier(r.name)?t[r.name.getText()]={type:"namespace"}:ts.isEnumDeclaration(r)&&(t[r.name.getText()]={type:"enum"}),!ts.isVariableStatement(r))continue;const{declarations:a}=r.declarationList;if(a.length!==1)continue;const c=a[0],o=c.name.getText();if(!c.initializer||!ts.isCallExpression(c.initializer)){t[o]={type:"var"};continue}const l=c.initializer.arguments[0];if(!c.initializer.expression.getFullText().includes("/*#__PURE__*/Object.freeze")||!ts.isObjectLiteralExpression(l))continue;const u=[];for(const p of l.properties){if(!ts.isPropertyAssignment(p)||!(ts.isIdentifier(p.name)||ts.isStringLiteral(p.name))||p.name.text!=="__proto__"&&!ts.isIdentifier(p.initializer))throw new UnsupportedSyntaxError(p,"Expected a property assignment");p.name.text!=="__proto__"&&u.push({exportedName:p.name.text,localName:p.initializer.getText()})}e.unshift({name:o,exports:u,location:i})}return{namespaces:e,itemTypes:t}}fix(){var e;let t=this.sourceFile.getFullText();const{namespaces:r,itemTypes:i}=this.findNamespaces();for(const a of r){const c=t.slice(a.location.end);t=t.slice(0,a.location.start);for(const{exportedName:o,localName:l}of a.exports)if(o===l){const{type:u,generics:p}=i[l]||{};if(u==="interface"||u==="type"){const m=renderTypeParams(p);t+=`type ${a.name}_${o}${m.in} = ${l}${m.out};
|
|
5
|
-
`}else if(u==="enum"||u==="class"){const m=renderTypeParams(p);t+=`type ${a.name}_${o}${m.in} = ${l}${m.out};
|
|
6
|
-
`,t+=`declare const ${a.name}_${o}: typeof ${l};
|
|
7
|
-
`}else t+=`declare const ${a.name}_${o}: typeof ${l};
|
|
8
|
-
`}if(a.name){t+=`declare namespace ${a.name} {
|
|
9
|
-
`,t+=` export {
|
|
10
|
-
`;for(const{exportedName:o,localName:l}of a.exports)o===l?t+=` ${a.name}_${o} as ${o},
|
|
11
|
-
`:t+=` ${l} as ${o},
|
|
12
|
-
`;t+=` };
|
|
13
|
-
`,t+="}"}t+=(e=a.textBeforeCodeAfter)!==null&&e!==void 0?e:"",t+=c}return t}}function renderTypeParams(n){return!n||!n.length?{in:"",out:""}:{in:`<${n.map(e=>e.getText()).join(", ")}>`,out:`<${n.map(e=>e.name.getText()).join(", ")}>`}}let IDs=1;function createProgram(n){return withStartEnd({type:"Program",sourceType:"module",body:[]},{start:n.getFullStart(),end:n.getEnd()})}function createReference(n){return{type:"AssignmentPattern",left:{type:"Identifier",name:String(IDs++)},right:n}}function createIdentifier(n){return withStartEnd({type:"Identifier",name:n.getText()},n)}function createIIFE(n){const e=withStartEnd({type:"FunctionExpression",id:null,params:[],body:{type:"BlockStatement",body:[]}},n),t=withStartEnd({type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:String(IDs++)},arguments:[e],optional:!1}},n);return{fn:e,iife:t}}function createDeclaration(n,e){return withStartEnd({type:"FunctionDeclaration",id:withStartEnd({type:"Identifier",name:ts.idText(n)},n),params:[],body:{type:"BlockStatement",body:[]}},e)}function convertExpression(n){if(ts.isLiteralExpression(n))return{type:"Literal",value:n.text};if(ts.isPropertyAccessExpression(n)){if(ts.isPrivateIdentifier(n.name))throw new UnsupportedSyntaxError(n.name);return withStartEnd({type:"MemberExpression",computed:!1,optional:!1,object:convertExpression(n.expression),property:convertExpression(n.name)},{start:n.expression.getStart(),end:n.name.getEnd()})}if(ts.isIdentifier(n))return createIdentifier(n);if(n.kind==ts.SyntaxKind.NullKeyword)return{type:"Literal",value:null};throw new UnsupportedSyntaxError(n)}function withStartEnd(n,e){let t="start"in e?e:{start:e.getStart(),end:e.getEnd()};return Object.assign(n,t)}function matchesModifier(n,e){return(ts.getCombinedModifierFlags(n)&e)===e}function preProcess({sourceFile:n}){const e=new MagicString__default.default(n.getFullText()),t=new Set,r=new Set;let i="";const a=new Map,c=new Map;for(const s of n.statements){if(ts.isEmptyStatement(s)){e.remove(s.getStart(),s.getEnd());continue}if(ts.isEnumDeclaration(s)||ts.isFunctionDeclaration(s)||ts.isInterfaceDeclaration(s)||ts.isClassDeclaration(s)||ts.isTypeAliasDeclaration(s)||ts.isModuleDeclaration(s)){if(s.name){const f=s.name.getText();t.add(f),matchesModifier(s,ts.ModifierFlags.ExportDefault)?i=f:matchesModifier(s,ts.ModifierFlags.Export)&&r.add(f),s.flags&ts.NodeFlags.GlobalAugmentation||D(f,[getStart(s),getEnd(s)])}ts.isModuleDeclaration(s)&&duplicateExports(e,s),fixModifiers(e,s)}else if(ts.isVariableStatement(s)){const{declarations:f}=s.declarationList,y=matchesModifier(s,ts.ModifierFlags.Export);for(const h of s.declarationList.declarations)if(ts.isIdentifier(h.name)){const x=h.name.getText();t.add(x),y&&r.add(x)}if(fixModifiers(e,s),f.length==1){const h=f[0];ts.isIdentifier(h.name)&&D(h.name.getText(),[getStart(s),getEnd(s)])}else{const h=f.slice(),x=h.shift();D(x.name.getText(),[getStart(s),x.getEnd()]);for(const T of h)ts.isIdentifier(T.name)&&D(T.name.getText(),[T.getFullStart(),T.getEnd()])}const{flags:d}=s.declarationList,E=`declare ${d&ts.NodeFlags.Let?"let":d&ts.NodeFlags.Const?"const":"var"} `,w=s.declarationList.getChildren().find(h=>h.kind===ts.SyntaxKind.SyntaxList).getChildren();let S=0;for(const h of w)if(h.kind===ts.SyntaxKind.CommaToken)S=h.getStart(),e.remove(S,h.getEnd());else if(S){e.appendLeft(S,`;
|
|
14
|
-
`);const x=h.getFullStart(),T=e.slice(x,h.getStart());let C=T.length-T.trimStart().length;C?e.overwrite(x,x+C,E):e.appendLeft(x,E)}}}for(const s of n.statements)if(p(s),!!matchesModifier(s,ts.ModifierFlags.ExportDefault)&&(ts.isFunctionDeclaration(s)||ts.isClassDeclaration(s))){if(s.name)continue;i||(i=g("export_default"));const f=s.getChildren(),y=f.findIndex(w=>w.kind===ts.SyntaxKind.ClassKeyword||w.kind===ts.SyntaxKind.FunctionKeyword),d=f[y],v=f[y+1];v.kind>=ts.SyntaxKind.FirstPunctuation&&v.kind<=ts.SyntaxKind.LastPunctuation?e.appendLeft(v.getStart(),i):e.appendRight(d.getEnd(),` ${i}`)}for(const s of c.values()){const y=s.pop()[0];for(const d of s)e.move(d[0],d[1],y)}i&&e.append(`
|
|
15
|
-
export default ${i};
|
|
16
|
-
`),r.size&&e.append(`
|
|
17
|
-
export { ${[...r].join(", ")} };
|
|
18
|
-
`);for(const[s,f]of a.entries())e.prepend(`import * as ${f} from "${s}";
|
|
19
|
-
`);const o=n.getLineStarts(),l=new Set;for(const s of n.typeReferenceDirectives){l.add(s.fileName);const{line:f}=n.getLineAndCharacterOfPosition(s.pos),y=o[f];let d=n.getLineEndOfPosition(s.pos);e.slice(d,d+1)==`
|
|
20
|
-
`&&(d+=1),e.remove(y,d)}const u=new Set;for(const s of n.referencedFiles){u.add(path__namespace.join(path__namespace.dirname(n.fileName),s.fileName));const{line:f}=n.getLineAndCharacterOfPosition(s.pos),y=o[f];let d=n.getLineEndOfPosition(s.pos);e.slice(d,d+1)==`
|
|
21
|
-
`&&(d+=1),e.remove(y,d)}return{code:e,typeReferences:l,fileReferences:u};function p(s){if(ts.forEachChild(s,p),ts.isImportTypeNode(s)){if(!ts.isLiteralTypeNode(s.argument)||!ts.isStringLiteral(s.argument.literal))throw new UnsupportedSyntaxError(s,"inline imports should have a literal argument");const f=s.argument.literal.text,y=s.getChildren(),d=y.find(S=>S.kind===ts.SyntaxKind.ImportKeyword).getStart();let v=s.getEnd();const E=y.find(S=>S.kind===ts.SyntaxKind.DotToken||S.kind===ts.SyntaxKind.LessThanToken);E&&(v=E.getStart());const w=m(f);e.overwrite(d,v,w)}}function m(s){let f=a.get(s);return f||(f=g(s.replace(/[^a-zA-Z0-9_$]/g,()=>"_")),a.set(s,f)),f}function g(s){let f=s;for(;t.has(f);)f=`_${f}`;return t.add(f),f}function D(s,f){let y=c.get(s);if(!y)y=[f],c.set(s,y);else{const d=y[y.length-1];d[1]===f[0]?d[1]=f[1]:y.push(f)}}}function fixModifiers(n,e){var t;let r=!1;const i=ts.isClassDeclaration(e)||ts.isFunctionDeclaration(e)||ts.isModuleDeclaration(e)||ts.isVariableStatement(e);for(const a of(t=e.modifiers)!==null&&t!==void 0?t:[])switch(a.kind){case ts.SyntaxKind.ExportKeyword:case ts.SyntaxKind.DefaultKeyword:n.remove(a.getStart(),a.getEnd()+1);break;case ts.SyntaxKind.DeclareKeyword:r=!0}i&&!r&&n.appendRight(e.getStart(),"declare ")}function duplicateExports(n,e){if(!(!e.body||!ts.isModuleBlock(e.body))){for(const t of e.body.statements)if(ts.isExportDeclaration(t)&&t.exportClause){if(ts.isNamespaceExport(t.exportClause))continue;for(const r of t.exportClause.elements)r.propertyName||n.appendLeft(r.name.getEnd(),` as ${r.name.getText()}`)}}}function getStart(n){const e=n.getFullStart();return e+(newlineAt(n,e)?1:0)}function getEnd(n){const e=n.getEnd();return e+(newlineAt(n,e)?1:0)}function newlineAt(n,e){return n.getSourceFile().getFullText()[e]==`
|
|
22
|
-
`}const IGNORE_TYPENODES=new Set([ts.SyntaxKind.LiteralType,ts.SyntaxKind.VoidKeyword,ts.SyntaxKind.UnknownKeyword,ts.SyntaxKind.AnyKeyword,ts.SyntaxKind.BooleanKeyword,ts.SyntaxKind.NumberKeyword,ts.SyntaxKind.StringKeyword,ts.SyntaxKind.ObjectKeyword,ts.SyntaxKind.NullKeyword,ts.SyntaxKind.UndefinedKeyword,ts.SyntaxKind.SymbolKeyword,ts.SyntaxKind.NeverKeyword,ts.SyntaxKind.ThisKeyword,ts.SyntaxKind.ThisType,ts.SyntaxKind.BigIntKeyword]);class DeclarationScope{constructor({id:e,range:t}){if(this.scopes=[],e)this.declaration=createDeclaration(e,t);else{const{iife:r,fn:i}=createIIFE(t);this.iife=r,this.declaration=i}}pushScope(){this.scopes.push(new Set)}popScope(e=1){for(let t=0;t<e;t++)this.scopes.pop()}pushTypeVariable(e){var t;const r=e.getText();(t=this.scopes[this.scopes.length-1])===null||t===void 0||t.add(r)}pushRaw(e){this.declaration.params.push(e)}pushReference(e){let t;if(e.type==="Identifier"?t=e.name:e.type==="MemberExpression"&&e.object.type==="Identifier"&&(t=e.object.name),t){for(const r of this.scopes)if(r.has(t))return}this.pushRaw(createReference(e))}pushIdentifierReference(e){this.pushReference(createIdentifier(e))}convertEntityName(e){return ts.isIdentifier(e)?createIdentifier(e):withStartEnd({type:"MemberExpression",computed:!1,optional:!1,object:this.convertEntityName(e.left),property:createIdentifier(e.right)},e)}convertPropertyAccess(e){if(!ts.isIdentifier(e.expression)&&!ts.isPropertyAccessExpression(e.expression))throw new UnsupportedSyntaxError(e.expression);if(ts.isPrivateIdentifier(e.name))throw new UnsupportedSyntaxError(e.name);let t=ts.isIdentifier(e.expression)?createIdentifier(e.expression):this.convertPropertyAccess(e.expression);return withStartEnd({type:"MemberExpression",computed:!1,optional:!1,object:t,property:createIdentifier(e.name)},e)}convertComputedPropertyName(e){if(!e.name||!ts.isComputedPropertyName(e.name))return;const{expression:t}=e.name;if(!ts.isLiteralExpression(t)){if(ts.isIdentifier(t))return this.pushReference(createIdentifier(t));if(ts.isPropertyAccessExpression(t))return this.pushReference(this.convertPropertyAccess(t));throw new UnsupportedSyntaxError(t)}}convertParametersAndType(e){this.convertComputedPropertyName(e);const t=this.convertTypeParameters(e.typeParameters);for(const r of e.parameters)this.convertTypeNode(r.type);this.convertTypeNode(e.type),this.popScope(t)}convertHeritageClauses(e){for(const t of e.heritageClauses||[])for(const r of t.types)this.pushReference(convertExpression(r.expression)),this.convertTypeArguments(r)}convertTypeArguments(e){if(!!e.typeArguments)for(const t of e.typeArguments)this.convertTypeNode(t)}convertMembers(e){for(const t of e){if(ts.isPropertyDeclaration(t)||ts.isPropertySignature(t)||ts.isIndexSignatureDeclaration(t)){this.convertComputedPropertyName(t),this.convertTypeNode(t.type);continue}if(ts.isMethodDeclaration(t)||ts.isMethodSignature(t)||ts.isConstructorDeclaration(t)||ts.isConstructSignatureDeclaration(t)||ts.isCallSignatureDeclaration(t)||ts.isGetAccessorDeclaration(t)||ts.isSetAccessorDeclaration(t))this.convertParametersAndType(t);else throw new UnsupportedSyntaxError(t)}}convertTypeParameters(e){if(!e)return 0;for(const t of e)this.convertTypeNode(t.constraint),this.convertTypeNode(t.default),this.pushScope(),this.pushTypeVariable(t.name);return e.length}convertTypeNode(e){if(!!e&&!IGNORE_TYPENODES.has(e.kind)){if(ts.isTypeReferenceNode(e)){this.pushReference(this.convertEntityName(e.typeName)),this.convertTypeArguments(e);return}if(ts.isTypeLiteralNode(e))return this.convertMembers(e.members);if(ts.isArrayTypeNode(e))return this.convertTypeNode(e.elementType);if(ts.isTupleTypeNode(e)){for(const t of e.elements)this.convertTypeNode(t);return}if(ts.isNamedTupleMember(e)||ts.isParenthesizedTypeNode(e)||ts.isTypeOperatorNode(e)||ts.isTypePredicateNode(e))return this.convertTypeNode(e.type);if(ts.isUnionTypeNode(e)||ts.isIntersectionTypeNode(e)){for(const t of e.types)this.convertTypeNode(t);return}if(ts.isMappedTypeNode(e)){const{typeParameter:t,type:r,nameType:i}=e;this.convertTypeNode(t.constraint),this.pushScope(),this.pushTypeVariable(t.name),this.convertTypeNode(r),i&&this.convertTypeNode(i),this.popScope();return}if(ts.isConditionalTypeNode(e)){this.convertTypeNode(e.checkType),this.pushScope(),this.convertTypeNode(e.extendsType),this.convertTypeNode(e.trueType),this.convertTypeNode(e.falseType),this.popScope();return}if(ts.isIndexedAccessTypeNode(e)){this.convertTypeNode(e.objectType),this.convertTypeNode(e.indexType);return}if(ts.isFunctionOrConstructorTypeNode(e)){this.convertParametersAndType(e);return}if(ts.isTypeQueryNode(e)){this.pushReference(this.convertEntityName(e.exprName));return}if(ts.isRestTypeNode(e)){this.convertTypeNode(e.type);return}if(ts.isOptionalTypeNode(e)){this.convertTypeNode(e.type);return}if(ts.isTemplateLiteralTypeNode(e)){for(const t of e.templateSpans)this.convertTypeNode(t.type);return}if(ts.isInferTypeNode(e)){this.pushTypeVariable(e.typeParameter.name);return}else throw new UnsupportedSyntaxError(e)}}convertNamespace(e,t=!1){if(this.pushScope(),t&&e.body&&ts.isModuleDeclaration(e.body)){this.convertNamespace(e.body,!0);return}if(!e.body||!ts.isModuleBlock(e.body))throw new UnsupportedSyntaxError(e,'namespace must have a "ModuleBlock" body.');const{statements:r}=e.body;for(const i of r){if(ts.isEnumDeclaration(i)||ts.isFunctionDeclaration(i)||ts.isClassDeclaration(i)||ts.isInterfaceDeclaration(i)||ts.isTypeAliasDeclaration(i)||ts.isModuleDeclaration(i)){if(i.name&&ts.isIdentifier(i.name))this.pushTypeVariable(i.name);else throw new UnsupportedSyntaxError(i,"non-Identifier name not supported");continue}if(ts.isVariableStatement(i)){for(const a of i.declarationList.declarations)if(ts.isIdentifier(a.name))this.pushTypeVariable(a.name);else throw new UnsupportedSyntaxError(a,"non-Identifier name not supported");continue}if(!ts.isExportDeclaration(i))throw new UnsupportedSyntaxError(i,"namespace child (hoisting) not supported yet")}for(const i of r){if(ts.isVariableStatement(i)){for(const a of i.declarationList.declarations)a.type&&this.convertTypeNode(a.type);continue}if(ts.isFunctionDeclaration(i)){this.convertParametersAndType(i);continue}if(ts.isInterfaceDeclaration(i)||ts.isClassDeclaration(i)){const a=this.convertTypeParameters(i.typeParameters);this.convertHeritageClauses(i),this.convertMembers(i.members),this.popScope(a);continue}if(ts.isTypeAliasDeclaration(i)){const a=this.convertTypeParameters(i.typeParameters);this.convertTypeNode(i.type),this.popScope(a);continue}if(ts.isModuleDeclaration(i)){this.convertNamespace(i,t);continue}if(!ts.isEnumDeclaration(i))if(ts.isExportDeclaration(i)){if(i.exportClause){if(ts.isNamespaceExport(i.exportClause))throw new UnsupportedSyntaxError(i.exportClause);for(const a of i.exportClause.elements){const c=a.propertyName||a.name;this.pushIdentifierReference(c)}}}else throw new UnsupportedSyntaxError(i,"namespace child (walking) not supported yet")}this.popScope()}}function convert({sourceFile:n}){return new Transformer(n).transform()}class Transformer{constructor(e){this.sourceFile=e,this.declarations=new Map,this.ast=createProgram(e);for(const t of e.statements)this.convertStatement(t)}transform(){return{ast:this.ast}}pushStatement(e){this.ast.body.push(e)}createDeclaration(e,t){const r={start:e.getFullStart(),end:e.getEnd()};if(!t){const o=new DeclarationScope({range:r});return this.pushStatement(o.iife),o}const i=t.getText(),a=new DeclarationScope({id:t,range:r}),c=this.declarations.get(i);if(c){c.pushIdentifierReference(t),c.declaration.end=r.end;let o=this.ast.body.findIndex(l=>l==c.declaration);for(let l=o+1;l<this.ast.body.length;l++){const u=this.ast.body[l];u.start=u.end=r.end}}else this.pushStatement(a.declaration),this.declarations.set(i,a);return c||a}convertStatement(e){if(ts.isEnumDeclaration(e))return this.convertEnumDeclaration(e);if(ts.isFunctionDeclaration(e))return this.convertFunctionDeclaration(e);if(ts.isInterfaceDeclaration(e)||ts.isClassDeclaration(e))return this.convertClassOrInterfaceDeclaration(e);if(ts.isTypeAliasDeclaration(e))return this.convertTypeAliasDeclaration(e);if(ts.isVariableStatement(e))return this.convertVariableStatement(e);if(ts.isExportDeclaration(e)||ts.isExportAssignment(e))return this.convertExportDeclaration(e);if(ts.isModuleDeclaration(e))return this.convertNamespaceDeclaration(e);if(e.kind==ts.SyntaxKind.NamespaceExportDeclaration)return this.removeStatement(e);if(ts.isImportDeclaration(e)||ts.isImportEqualsDeclaration(e))return this.convertImportDeclaration(e);throw new UnsupportedSyntaxError(e)}removeStatement(e){this.pushStatement(withStartEnd({type:"ExpressionStatement",expression:{type:"Literal",value:"pls remove me"}},e))}convertNamespaceDeclaration(e){if(e.flags&ts.NodeFlags.GlobalAugmentation||!ts.isIdentifier(e.name)){this.createDeclaration(e).convertNamespace(e,!0);return}const r=this.createDeclaration(e,e.name);r.pushIdentifierReference(e.name),r.convertNamespace(e)}convertEnumDeclaration(e){this.createDeclaration(e,e.name).pushIdentifierReference(e.name)}convertFunctionDeclaration(e){if(!e.name)throw new UnsupportedSyntaxError(e,"FunctionDeclaration should have a name");const t=this.createDeclaration(e,e.name);t.pushIdentifierReference(e.name),t.convertParametersAndType(e)}convertClassOrInterfaceDeclaration(e){if(!e.name)throw new UnsupportedSyntaxError(e,"ClassDeclaration / InterfaceDeclaration should have a name");const t=this.createDeclaration(e,e.name),r=t.convertTypeParameters(e.typeParameters);t.convertHeritageClauses(e),t.convertMembers(e.members),t.popScope(r)}convertTypeAliasDeclaration(e){const t=this.createDeclaration(e,e.name),r=t.convertTypeParameters(e.typeParameters);t.convertTypeNode(e.type),t.popScope(r)}convertVariableStatement(e){const{declarations:t}=e.declarationList;if(t.length!==1)throw new UnsupportedSyntaxError(e,"VariableStatement with more than one declaration not yet supported");for(const r of t){if(!ts.isIdentifier(r.name))throw new UnsupportedSyntaxError(e,"VariableDeclaration must have a name");this.createDeclaration(e,r.name).convertTypeNode(r.type)}}convertExportDeclaration(e){if(ts.isExportAssignment(e)){this.pushStatement(withStartEnd({type:"ExportDefaultDeclaration",declaration:convertExpression(e.expression)},e));return}const t=e.moduleSpecifier?convertExpression(e.moduleSpecifier):void 0;if(!e.exportClause)this.pushStatement(withStartEnd({type:"ExportAllDeclaration",source:t,exported:null},e));else if(ts.isNamespaceExport(e.exportClause))this.pushStatement(withStartEnd({type:"ExportAllDeclaration",source:t,exported:createIdentifier(e.exportClause.name)},e));else{const r=[];for(const i of e.exportClause.elements)r.push(this.convertExportSpecifier(i));this.pushStatement(withStartEnd({type:"ExportNamedDeclaration",declaration:null,specifiers:r,source:t},e))}}convertImportDeclaration(e){if(ts.isImportEqualsDeclaration(e)){if(!ts.isExternalModuleReference(e.moduleReference))throw new UnsupportedSyntaxError(e,"ImportEquals should have a literal source.");this.pushStatement(withStartEnd({type:"ImportDeclaration",specifiers:[{type:"ImportDefaultSpecifier",local:createIdentifier(e.name)}],source:convertExpression(e.moduleReference.expression)},e));return}const t=convertExpression(e.moduleSpecifier),r=e.importClause&&e.importClause.namedBindings?this.convertNamedImportBindings(e.importClause.namedBindings):[];e.importClause&&e.importClause.name&&r.push({type:"ImportDefaultSpecifier",local:createIdentifier(e.importClause.name)}),this.pushStatement(withStartEnd({type:"ImportDeclaration",specifiers:r,source:t},e))}convertNamedImportBindings(e){return ts.isNamedImports(e)?e.elements.map(t=>{const r=createIdentifier(t.name),i=t.propertyName?createIdentifier(t.propertyName):r;return{type:"ImportSpecifier",local:r,imported:i}}):[{type:"ImportNamespaceSpecifier",local:createIdentifier(e.name)}]}convertExportSpecifier(e){const t=createIdentifier(e.name);return{type:"ExportSpecifier",exported:t,local:e.propertyName?createIdentifier(e.propertyName):t}}}function parse(n,e){return ts.createSourceFile(n,e,ts.ScriptTarget.Latest,!0)}const transform=()=>{const n=new Map,e=new Map;return{name:"dts-transform",options(t){const{onwarn:r}=t;return b(N({},t),{onwarn(i,a){i.code!="CIRCULAR_DEPENDENCY"&&(r?r(i,a):a(i))},treeshake:{moduleSideEffects:"no-external",propertyReadSideEffects:!0,unknownGlobalSideEffects:!1}})},outputOptions(t){return b(N({},t),{chunkFileNames:t.chunkFileNames||"[name]-[hash].d.ts",entryFileNames:t.entryFileNames||"[name].d.ts",format:"es",exports:"named",compact:!1,freeze:!0,interop:!1,namespaceToStringTag:!1,strict:!1})},transform(t,r){let i=parse(r,t);const a=preProcess({sourceFile:i});n.set(i.fileName,a.typeReferences),e.set(i.fileName,a.fileReferences),t=a.code.toString(),i=parse(r,t);const c=convert({sourceFile:i});return process.env.DTS_DUMP_AST&&(console.log(r),console.log(t),console.log(JSON.stringify(c.ast.body,void 0,2))),{code:t,ast:c.ast,map:a.code.generateMap()}},renderChunk(t,r,i){const a=parse(r.fileName,t),c=new NamespaceFixer(a),o=new Set,l=new Set;for(const u of Object.keys(r.modules)){for(const p of n.get(u.split("\\").join("/"))||[])o.add(p);for(const p of e.get(u.split("\\").join("/"))||[]){const m=i.file&&path__namespace.dirname(i.file)||r.facadeModuleId&&path__namespace.dirname(r.facadeModuleId)||".";let g=path__namespace.relative(m,p).split("\\").join("/");g[0]!=="."&&(g="./"+g),l.add(g)}}return t=writeBlock(Array.from(l,u=>`/// <reference path="${u}" />`)),t+=writeBlock(Array.from(o,u=>`/// <reference types="${u}" />`)),t+=c.fix(),{code:t,map:{mappings:""}}}}};function writeBlock(n){return n.length?n.join(`
|
|
23
|
-
`)+`
|
|
24
|
-
`:""}const tsx=/\.(t|j)sx?$/,plugin=(n={})=>{const e=transform(),{respectExternal:t=!1,compilerOptions:r={}}=n;let i=[];function a(c){let o,l;return!i.length&&c.endsWith(dts)?o=!0:(l=i.find(u=>o=u.getSourceFile(c)),!l&&ts.sys.fileExists(c)&&(i.push(l=createProgram$1(c,r)),o=l.getSourceFile(c))),{source:o,program:l}}return{name:"dts",options(c){let{input:o=[]}=c;if(!Array.isArray(o))o=typeof o=="string"?[o]:Object.values(o);else if(o.length>1){c.input={};for(const l of o){let u=l.replace(/((\.d)?\.(t|j)sx?)$/,"");path__namespace.isAbsolute(l)?u=path__namespace.basename(u):u=path__namespace.normalize(u),c.input[u]=l}}return i=createPrograms(Object.values(o),r),e.options.call(this,c)},outputOptions:e.outputOptions,transform(c,o){const l=(s,f)=>(typeof s=="object"&&(c=s.getFullText()),e.transform.call(this,c,f));if(!tsx.test(o))return null;if(o.endsWith(dts)){const{source:s}=a(o);return s?l(s,o):null}const u=o.replace(tsx,dts);let p=a(u);if(p.source)return l(p.source,u);if(p=a(o),typeof p.source!="object"||!p.program)return null;let m;const{emitSkipped:g,diagnostics:D}=p.program.emit(p.source,(s,f)=>{c=f,m=l(!0,u)},void 0,!0);if(g){const s=D.filter(f=>f.category===ts.DiagnosticCategory.Error);s.length&&(console.error(ts.formatDiagnostics(s,formatHost)),this.error("Failed to compile. Check the logs above."))}return m},resolveId(c,o){if(!o)return;o=o.split("\\").join("/");const{resolvedModule:l}=ts.nodeModuleNameResolver(c,o,r,ts.sys);if(!!l)return!t&&l.isExternalLibraryImport?{id:c,external:!0}:{id:path__namespace.resolve(l.resolvedFileName)}},renderChunk:e.renderChunk}};exports.default=plugin;
|