Spaces:
Paused
Paused
Upload folder using huggingface_hub (part 7)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- shared/node_modules/prettier/plugins/markdown.mjs +0 -0
- shared/node_modules/prettier/plugins/meriyah.d.ts +5 -0
- shared/node_modules/prettier/plugins/meriyah.js +0 -0
- shared/node_modules/prettier/plugins/meriyah.mjs +0 -0
- shared/node_modules/prettier/plugins/postcss.d.ts +11 -0
- shared/node_modules/prettier/plugins/postcss.js +0 -0
- shared/node_modules/prettier/plugins/postcss.mjs +0 -0
- shared/node_modules/prettier/plugins/typescript.d.ts +5 -0
- shared/node_modules/prettier/plugins/typescript.js +0 -0
- shared/node_modules/prettier/plugins/typescript.mjs +0 -0
- shared/node_modules/prettier/plugins/yaml.d.ts +9 -0
- shared/node_modules/prettier/plugins/yaml.js +0 -0
- shared/node_modules/prettier/plugins/yaml.mjs +0 -0
- shared/node_modules/prettier/standalone.d.ts +33 -0
- shared/node_modules/prettier/standalone.js +29 -0
- shared/node_modules/prettier/standalone.mjs +29 -0
- shared/node_modules/rolldown/LICENSE +25 -0
- shared/node_modules/rolldown/README.md +11 -0
- shared/node_modules/rolldown/bin/cli.mjs +2 -0
- shared/node_modules/rolldown/dist/cli.d.mts +1 -0
- shared/node_modules/rolldown/dist/cli.mjs +1191 -0
- shared/node_modules/rolldown/dist/config.d.mts +14 -0
- shared/node_modules/rolldown/dist/config.mjs +4 -0
- shared/node_modules/rolldown/dist/experimental-index.d.mts +270 -0
- shared/node_modules/rolldown/dist/experimental-index.mjs +325 -0
- shared/node_modules/rolldown/dist/experimental-runtime-types.d.ts +107 -0
- shared/node_modules/rolldown/dist/filter-index.d.mts +195 -0
- shared/node_modules/rolldown/dist/filter-index.mjs +380 -0
- shared/node_modules/rolldown/dist/get-log-filter.d.mts +3 -0
- shared/node_modules/rolldown/dist/get-log-filter.mjs +68 -0
- shared/node_modules/rolldown/dist/index.d.mts +4 -0
- shared/node_modules/rolldown/dist/index.mjs +50 -0
- shared/node_modules/rolldown/dist/parallel-plugin-worker.d.mts +1 -0
- shared/node_modules/rolldown/dist/parallel-plugin-worker.mjs +28 -0
- shared/node_modules/rolldown/dist/parallel-plugin.d.mts +13 -0
- shared/node_modules/rolldown/dist/parallel-plugin.mjs +6 -0
- shared/node_modules/rolldown/dist/parse-ast-index.d.mts +32 -0
- shared/node_modules/rolldown/dist/parse-ast-index.mjs +60 -0
- shared/node_modules/rolldown/dist/plugins-index.d.mts +33 -0
- shared/node_modules/rolldown/dist/plugins-index.mjs +40 -0
- shared/node_modules/rolldown/dist/shared/binding-CfwqjDbP.mjs +584 -0
- shared/node_modules/rolldown/dist/shared/binding-DgGsNpT9.d.mts +2024 -0
- shared/node_modules/rolldown/dist/shared/bindingify-input-options-B7_WBoOp.mjs +2241 -0
- shared/node_modules/rolldown/dist/shared/constructors-Bx1tSad6.d.mts +37 -0
- shared/node_modules/rolldown/dist/shared/constructors-DnT9y_13.mjs +68 -0
- shared/node_modules/rolldown/dist/shared/define-config-ChOOV2QZ.d.mts +0 -0
- shared/node_modules/rolldown/dist/shared/define-config-Demdg3_4.mjs +6 -0
- shared/node_modules/rolldown/dist/shared/error-C0TrL0_H.mjs +85 -0
- shared/node_modules/rolldown/dist/shared/get-log-filter-BpNVNJ5-.d.mts +35 -0
- shared/node_modules/rolldown/dist/shared/load-config-BDGEgD4M.mjs +120 -0
shared/node_modules/prettier/plugins/markdown.mjs
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
shared/node_modules/prettier/plugins/meriyah.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Parser } from "../index.js";
|
| 2 |
+
|
| 3 |
+
export declare const parsers: {
|
| 4 |
+
meriyah: Parser;
|
| 5 |
+
};
|
shared/node_modules/prettier/plugins/meriyah.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
shared/node_modules/prettier/plugins/meriyah.mjs
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
shared/node_modules/prettier/plugins/postcss.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Parser, Printer } from "../index.js";
|
| 2 |
+
|
| 3 |
+
export declare const parsers: {
|
| 4 |
+
css: Parser;
|
| 5 |
+
less: Parser;
|
| 6 |
+
scss: Parser;
|
| 7 |
+
};
|
| 8 |
+
|
| 9 |
+
export declare const printers: {
|
| 10 |
+
postcss: Printer;
|
| 11 |
+
};
|
shared/node_modules/prettier/plugins/postcss.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
shared/node_modules/prettier/plugins/postcss.mjs
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
shared/node_modules/prettier/plugins/typescript.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Parser } from "../index.js";
|
| 2 |
+
|
| 3 |
+
export declare const parsers: {
|
| 4 |
+
typescript: Parser;
|
| 5 |
+
};
|
shared/node_modules/prettier/plugins/typescript.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
shared/node_modules/prettier/plugins/typescript.mjs
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
shared/node_modules/prettier/plugins/yaml.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Parser, Printer } from "../index.js";
|
| 2 |
+
|
| 3 |
+
export declare const parsers: {
|
| 4 |
+
yaml: Parser;
|
| 5 |
+
};
|
| 6 |
+
|
| 7 |
+
export declare const printers: {
|
| 8 |
+
yaml: Printer;
|
| 9 |
+
};
|
shared/node_modules/prettier/plugins/yaml.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
shared/node_modules/prettier/plugins/yaml.mjs
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
shared/node_modules/prettier/standalone.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { CursorOptions, CursorResult, Options, SupportInfo } from "./index.js";
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* formatWithCursor both formats the code, and translates a cursor position from unformatted code to formatted code.
|
| 5 |
+
* This is useful for editor integrations, to prevent the cursor from moving when code is formatted
|
| 6 |
+
*
|
| 7 |
+
* The cursorOffset option should be provided, to specify where the cursor is.
|
| 8 |
+
*
|
| 9 |
+
* ```js
|
| 10 |
+
* await prettier.formatWithCursor(" 1", { cursorOffset: 2, parser: "babel" });
|
| 11 |
+
* ```
|
| 12 |
+
* `-> { formatted: "1;\n", cursorOffset: 1 }`
|
| 13 |
+
*/
|
| 14 |
+
export function formatWithCursor(
|
| 15 |
+
source: string,
|
| 16 |
+
options: CursorOptions,
|
| 17 |
+
): Promise<CursorResult>;
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* `format` is used to format text using Prettier. [Options](https://prettier.io/docs/options) may be provided to override the defaults.
|
| 21 |
+
*/
|
| 22 |
+
export function format(source: string, options?: Options): Promise<string>;
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* `check` checks to see if the file has been formatted with Prettier given those options and returns a `Boolean`.
|
| 26 |
+
* This is similar to the `--list-different` parameter in the CLI and is useful for running Prettier in CI scenarios.
|
| 27 |
+
*/
|
| 28 |
+
export function check(source: string, options?: Options): Promise<boolean>;
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Returns an object representing the parsers, languages and file types Prettier supports for the current version.
|
| 32 |
+
*/
|
| 33 |
+
export function getSupportInfo(): Promise<SupportInfo>;
|
shared/node_modules/prettier/standalone.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(function(t){function e(){var o=t();return o.default||o}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var f=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};f.prettier=e()}})(function(){"use strict";var Zn=Object.create;var Je=Object.defineProperty;var eo=Object.getOwnPropertyDescriptor;var to=Object.getOwnPropertyNames;var uo=Object.getPrototypeOf,ro=Object.prototype.hasOwnProperty;var no=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Yt=(e,t)=>{for(var u in t)Je(e,u,{get:t[u],enumerable:!0})},ku=(e,t,u,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of to(t))!ro.call(e,o)&&o!==u&&Je(e,o,{get:()=>t[o],enumerable:!(r=eo(t,o))||r.enumerable});return e};var oo=(e,t,u)=>(u=e!=null?Zn(uo(e)):{},ku(t||!e||!e.__esModule?Je(u,"default",{value:e,enumerable:!0}):u,e)),ao=e=>ku(Je({},"__esModule",{value:!0}),e);var pn=no((af,dn)=>{var bt,At,_t,xt,Bt,$e,bu,Ke,Tt,fn,Nt,Ve,St,wt,Ot,pe,ln,Pt,It,Aa;St=/\/(?![*\/])(?:\[(?:[^\]\\\n\r\u2028\u2029]+|\\.)*\]|[^\/\\\n\r\u2028\u2029]+|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/yu;Ve=/--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y;bt=/(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]+|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/yu;Ot=/(['"])(?:[^'"\\\n\r]+|(?!\1)['"]|\\(?:\r\n|[^]))*(\1)?/y;Nt=/(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y;pe=/[`}](?:[^`\\$]+|\\[^]|\$(?!\{))*(`|\$\{)?/y;It=/[\t\v\f\ufeff\p{Zs}]+/yu;Ke=/\r?\n|[\r\u2028\u2029]/y;Tt=/\/\*(?:[^*]+|\*(?!\/))*(\*\/)?/y;wt=/\/\/.*/y;_t=/[<>.:={}]|\/(?![\/*])/y;At=/[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/yu;xt=/(['"])(?:[^'"]+|(?!\1)['"])*(\1)?/y;Bt=/[^<>{}]+/y;Pt=/^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/;ln=/^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/;$e=/^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;bu=/^(?:return|throw|yield)$/;fn=RegExp(Ke.source);dn.exports=Aa=function*(e,{jsx:t=!1}={}){var u,r,o,n,a,s,i,D,f,l,d,c,p,F;for({length:s}=e,n=0,a="",F=[{tag:"JS"}],u=[],d=0,c=!1;n<s;){switch(D=F[F.length-1],D.tag){case"JS":case"JSNonExpressionParen":case"InterpolationInTemplate":case"InterpolationInJSX":if(e[n]==="/"&&(Pt.test(a)||$e.test(a))&&(St.lastIndex=n,i=St.exec(e))){n=St.lastIndex,a=i[0],c=!0,yield{type:"RegularExpressionLiteral",value:i[0],closed:i[1]!==void 0&&i[1]!=="\\"};continue}if(Ve.lastIndex=n,i=Ve.exec(e)){switch(p=i[0],f=Ve.lastIndex,l=p,p){case"(":a==="?NonExpressionParenKeyword"&&F.push({tag:"JSNonExpressionParen",nesting:d}),d++,c=!1;break;case")":d--,c=!0,D.tag==="JSNonExpressionParen"&&d===D.nesting&&(F.pop(),l="?NonExpressionParenEnd",c=!1);break;case"{":Ve.lastIndex=0,o=!ln.test(a)&&(Pt.test(a)||$e.test(a)),u.push(o),c=!1;break;case"}":switch(D.tag){case"InterpolationInTemplate":if(u.length===D.nesting){pe.lastIndex=n,i=pe.exec(e),n=pe.lastIndex,a=i[0],i[1]==="${"?(a="?InterpolationInTemplate",c=!1,yield{type:"TemplateMiddle",value:i[0]}):(F.pop(),c=!0,yield{type:"TemplateTail",value:i[0],closed:i[1]==="`"});continue}break;case"InterpolationInJSX":if(u.length===D.nesting){F.pop(),n+=1,a="}",yield{type:"JSXPunctuator",value:"}"};continue}}c=u.pop(),l=c?"?ExpressionBraceEnd":"}";break;case"]":c=!0;break;case"++":case"--":l=c?"?PostfixIncDec":"?UnaryIncDec";break;case"<":if(t&&(Pt.test(a)||$e.test(a))){F.push({tag:"JSXTag"}),n+=1,a="<",yield{type:"JSXPunctuator",value:p};continue}c=!1;break;default:c=!1}n=f,a=l,yield{type:"Punctuator",value:p};continue}if(bt.lastIndex=n,i=bt.exec(e)){switch(n=bt.lastIndex,l=i[0],i[0]){case"for":case"if":case"while":case"with":a!=="."&&a!=="?."&&(l="?NonExpressionParenKeyword")}a=l,c=!$e.test(i[0]),yield{type:i[1]==="#"?"PrivateIdentifier":"IdentifierName",value:i[0]};continue}if(Ot.lastIndex=n,i=Ot.exec(e)){n=Ot.lastIndex,a=i[0],c=!0,yield{type:"StringLiteral",value:i[0],closed:i[2]!==void 0};continue}if(Nt.lastIndex=n,i=Nt.exec(e)){n=Nt.lastIndex,a=i[0],c=!0,yield{type:"NumericLiteral",value:i[0]};continue}if(pe.lastIndex=n,i=pe.exec(e)){n=pe.lastIndex,a=i[0],i[1]==="${"?(a="?InterpolationInTemplate",F.push({tag:"InterpolationInTemplate",nesting:u.length}),c=!1,yield{type:"TemplateHead",value:i[0]}):(c=!0,yield{type:"NoSubstitutionTemplate",value:i[0],closed:i[1]==="`"});continue}break;case"JSXTag":case"JSXTagEnd":if(_t.lastIndex=n,i=_t.exec(e)){switch(n=_t.lastIndex,l=i[0],i[0]){case"<":F.push({tag:"JSXTag"});break;case">":F.pop(),a==="/"||D.tag==="JSXTagEnd"?(l="?JSX",c=!0):F.push({tag:"JSXChildren"});break;case"{":F.push({tag:"InterpolationInJSX",nesting:u.length}),l="?InterpolationInJSX",c=!1;break;case"/":a==="<"&&(F.pop(),F[F.length-1].tag==="JSXChildren"&&F.pop(),F.push({tag:"JSXTagEnd"}))}a=l,yield{type:"JSXPunctuator",value:i[0]};continue}if(At.lastIndex=n,i=At.exec(e)){n=At.lastIndex,a=i[0],yield{type:"JSXIdentifier",value:i[0]};continue}if(xt.lastIndex=n,i=xt.exec(e)){n=xt.lastIndex,a=i[0],yield{type:"JSXString",value:i[0],closed:i[2]!==void 0};continue}break;case"JSXChildren":if(Bt.lastIndex=n,i=Bt.exec(e)){n=Bt.lastIndex,a=i[0],yield{type:"JSXText",value:i[0]};continue}switch(e[n]){case"<":F.push({tag:"JSXTag"}),n++,a="<",yield{type:"JSXPunctuator",value:"<"};continue;case"{":F.push({tag:"InterpolationInJSX",nesting:u.length}),n++,a="?InterpolationInJSX",c=!1,yield{type:"JSXPunctuator",value:"{"};continue}}if(It.lastIndex=n,i=It.exec(e)){n=It.lastIndex,yield{type:"WhiteSpace",value:i[0]};continue}if(Ke.lastIndex=n,i=Ke.exec(e)){n=Ke.lastIndex,c=!1,bu.test(a)&&(a="?NoLineTerminatorHere"),yield{type:"LineTerminatorSequence",value:i[0]};continue}if(Tt.lastIndex=n,i=Tt.exec(e)){n=Tt.lastIndex,fn.test(i[0])&&(c=!1,bu.test(a)&&(a="?NoLineTerminatorHere")),yield{type:"MultiLineComment",value:i[0],closed:i[1]!==void 0};continue}if(wt.lastIndex=n,i=wt.exec(e)){n=wt.lastIndex,c=!1,yield{type:"SingleLineComment",value:i[0]};continue}r=String.fromCodePoint(e.codePointAt(n)),n+=r.length,a=r,c=!1,yield{type:D.tag.startsWith("JSX")?"JSXInvalid":"Invalid",value:r}}}});var di={};Yt(di,{__debug:()=>li,check:()=>ci,doc:()=>wu,format:()=>Hn,formatWithCursor:()=>Jn,getSupportInfo:()=>fi,util:()=>Pu,version:()=>Yn});var X=(e,t)=>(u,r,...o)=>u|1&&r==null?void 0:(t.call(r)??r[e]).apply(r,o);var io=String.prototype.replaceAll??function(e,t){return e.global?this.replace(e,t):this.split(e).join(t)},so=X("replaceAll",function(){if(typeof this=="string")return io}),oe=so;var Ne=class{diff(t,u,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);let n=this.castInput(t,r),a=this.castInput(u,r),s=this.removeEmpty(this.tokenize(n,r)),i=this.removeEmpty(this.tokenize(a,r));return this.diffWithOptionsObj(s,i,r,o)}diffWithOptionsObj(t,u,r,o){var n;let a=m=>{if(m=this.postProcess(m,r),o){setTimeout(function(){o(m)},0);return}else return m},s=u.length,i=t.length,D=1,f=s+i;r.maxEditLength!=null&&(f=Math.min(f,r.maxEditLength));let l=(n=r.timeout)!==null&&n!==void 0?n:1/0,d=Date.now()+l,c=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(c[0],u,t,0,r);if(c[0].oldPos+1>=i&&p+1>=s)return a(this.buildValues(c[0].lastComponent,u,t));let F=-1/0,C=1/0,y=()=>{for(let m=Math.max(F,-D);m<=Math.min(C,D);m+=2){let h,E=c[m-1],g=c[m+1];E&&(c[m-1]=void 0);let A=!1;if(g){let Q=g.oldPos-m;A=g&&0<=Q&&Q<s}let J=E&&E.oldPos+1<i;if(!A&&!J){c[m]=void 0;continue}if(!J||A&&E.oldPos<g.oldPos?h=this.addToPath(g,!0,!1,0,r):h=this.addToPath(E,!1,!0,1,r),p=this.extractCommon(h,u,t,m,r),h.oldPos+1>=i&&p+1>=s)return a(this.buildValues(h.lastComponent,u,t))||!0;c[m]=h,h.oldPos+1>=i&&(C=Math.min(C,m-1)),p+1>=s&&(F=Math.max(F,m+1))}D++};if(o)(function m(){setTimeout(function(){if(D>f||Date.now()>d)return o(void 0);y()||m()},0)})();else for(;D<=f&&Date.now()<=d;){let m=y();if(m)return m}}addToPath(t,u,r,o,n){let a=t.lastComponent;return a&&!n.oneChangePerToken&&a.added===u&&a.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:a.count+1,added:u,removed:r,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:u,removed:r,previousComponent:a}}}extractCommon(t,u,r,o,n){let a=u.length,s=r.length,i=t.oldPos,D=i-o,f=0;for(;D+1<a&&i+1<s&&this.equals(r[i+1],u[D+1],n);)D++,i++,f++,n.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return f&&!n.oneChangePerToken&&(t.lastComponent={count:f,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=i,D}equals(t,u,r){return r.comparator?r.comparator(t,u):t===u||!!r.ignoreCase&&t.toLowerCase()===u.toLowerCase()}removeEmpty(t){let u=[];for(let r=0;r<t.length;r++)t[r]&&u.push(t[r]);return u}castInput(t,u){return t}tokenize(t,u){return Array.from(t)}join(t){return t.join("")}postProcess(t,u){return t}get useLongestToken(){return!1}buildValues(t,u,r){let o=[],n;for(;t;)o.push(t),n=t.previousComponent,delete t.previousComponent,t=n;o.reverse();let a=o.length,s=0,i=0,D=0;for(;s<a;s++){let f=o[s];if(f.removed)f.value=this.join(r.slice(D,D+f.count)),D+=f.count;else{if(!f.added&&this.useLongestToken){let l=u.slice(i,i+f.count);l=l.map(function(d,c){let p=r[D+c];return p.length>d.length?p:d}),f.value=this.join(l)}else f.value=this.join(u.slice(i,i+f.count));i+=f.count,f.added||(D+=f.count)}}return o}};var jt=class extends Ne{tokenize(t){return t.slice()}join(t){return t}removeEmpty(t){return t}},vu=new jt;function Ut(e,t,u){return vu.diff(e,t,u)}var Do=()=>{},P=Do;var Lu="cr",Mu="crlf",co="lf",fo=co,Wt="\r",Yu=`\r
|
| 2 |
+
`,He=`
|
| 3 |
+
`,lo=He;function ju(e){let t=e.indexOf(Wt);return t!==-1?e.charAt(t+1)===He?Mu:Lu:fo}function Se(e){return e===Lu?Wt:e===Mu?Yu:lo}var po=new Map([[He,/\n/gu],[Wt,/\r/gu],[Yu,/\r\n/gu]]);function $t(e,t){let u=po.get(t);return e.match(u)?.length??0}var Fo=/\r\n?/gu;function Uu(e){return oe(0,e,Fo,He)}function mo(e){return this[e<0?this.length+e:e]}var Eo=X("at",function(){if(Array.isArray(this)||typeof this=="string")return mo}),b=Eo;var G="string",j="array",U="cursor",I="indent",k="align",v="trim",x="group",w="fill",B="if-break",R="indent-if-break",L="line-suffix",M="line-suffix-boundary",_="line",O="label",T="break-parent",Xe=new Set([U,I,k,v,x,w,B,R,L,M,_,O,T]);function Wu(e){let t=e.length;for(;t>0&&(e[t-1]==="\r"||e[t-1]===`
|
| 4 |
+
`);)t--;return t<e.length?e.slice(0,t):e}function Co(e){if(typeof e=="string")return G;if(Array.isArray(e))return j;if(!e)return;let{type:t}=e;if(Xe.has(t))return t}var H=Co;var ho=e=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(e);function go(e){let t=e===null?"null":typeof e;if(t!=="string"&&t!=="object")return`Unexpected doc '${t}',
|
| 5 |
+
Expected it to be 'string' or 'object'.`;if(H(e))throw new Error("doc is valid.");let u=Object.prototype.toString.call(e);if(u!=="[object Object]")return`Unexpected doc '${u}'.`;let r=ho([...Xe].map(o=>`'${o}'`));return`Unexpected doc.type '${e.type}'.
|
| 6 |
+
Expected it to be ${r}.`}var Vt=class extends Error{name="InvalidDocError";constructor(t){super(go(t)),this.doc=t}},Z=Vt;var $u={};function yo(e,t,u,r){let o=[e];for(;o.length>0;){let n=o.pop();if(n===$u){u(o.pop());continue}u&&o.push(n,$u);let a=H(n);if(!a)throw new Z(n);if(t?.(n)!==!1)switch(a){case j:case w:{let s=a===j?n:n.parts;for(let i=s.length,D=i-1;D>=0;--D)o.push(s[D]);break}case B:o.push(n.flatContents,n.breakContents);break;case x:if(r&&n.expandedStates)for(let s=n.expandedStates.length,i=s-1;i>=0;--i)o.push(n.expandedStates[i]);else o.push(n.contents);break;case k:case I:case R:case O:case L:o.push(n.contents);break;case G:case U:case v:case M:case _:case T:break;default:throw new Z(n)}}}var we=yo;function Pe(e,t){if(typeof e=="string")return t(e);let u=new Map;return r(e);function r(n){if(u.has(n))return u.get(n);let a=o(n);return u.set(n,a),a}function o(n){switch(H(n)){case j:return t(n.map(r));case w:return t({...n,parts:n.parts.map(r)});case B:return t({...n,breakContents:r(n.breakContents),flatContents:r(n.flatContents)});case x:{let{expandedStates:a,contents:s}=n;return a?(a=a.map(r),s=a[0]):s=r(s),t({...n,contents:s,expandedStates:a})}case k:case I:case R:case O:case L:return t({...n,contents:r(n.contents)});case G:case U:case v:case M:case _:case T:return t(n);default:throw new Z(n)}}}function qe(e,t,u){let r=u,o=!1;function n(a){if(o)return!1;let s=t(a);s!==void 0&&(o=!0,r=s)}return we(e,n),r}function bo(e){if(e.type===x&&e.break||e.type===_&&e.hard||e.type===T)return!0}function Gu(e){return qe(e,bo,!1)}function Vu(e){if(e.length>0){let t=b(0,e,-1);!t.expandedStates&&!t.break&&(t.break="propagated")}return null}function zu(e){let t=new Set,u=[];function r(n){if(n.type===T&&Vu(u),n.type===x){if(u.push(n),t.has(n))return!1;t.add(n)}}function o(n){n.type===x&&u.pop().break&&Vu(u)}we(e,r,o,!0)}function Ao(e){return e.type===_&&!e.hard?e.soft?"":" ":e.type===B?e.flatContents:e}function Ju(e){return Pe(e,Ao)}function Ku(e){for(e=[...e];e.length>=2&&b(0,e,-2).type===_&&b(0,e,-1).type===T;)e.length-=2;if(e.length>0){let t=Oe(b(0,e,-1));e[e.length-1]=t}return e}function Oe(e){switch(H(e)){case I:case R:case x:case L:case O:{let t=Oe(e.contents);return{...e,contents:t}}case B:return{...e,breakContents:Oe(e.breakContents),flatContents:Oe(e.flatContents)};case w:return{...e,parts:Ku(e.parts)};case j:return Ku(e);case G:return Wu(e);case k:case U:case v:case M:case _:case T:break;default:throw new Z(e)}return e}function Qe(e){return Oe(xo(e))}function _o(e){switch(H(e)){case w:if(e.parts.every(t=>t===""))return"";break;case x:if(!e.contents&&!e.id&&!e.break&&!e.expandedStates)return"";if(e.contents.type===x&&e.contents.id===e.id&&e.contents.break===e.break&&e.contents.expandedStates===e.expandedStates)return e.contents;break;case k:case I:case R:case L:if(!e.contents)return"";break;case B:if(!e.flatContents&&!e.breakContents)return"";break;case j:{let t=[];for(let u of e){if(!u)continue;let[r,...o]=Array.isArray(u)?u:[u];typeof r=="string"&&typeof b(0,t,-1)=="string"?t[t.length-1]+=r:t.push(r),t.push(...o)}return t.length===0?"":t.length===1?t[0]:t}case G:case U:case v:case M:case _:case O:case T:break;default:throw new Z(e)}return e}function xo(e){return Pe(e,t=>_o(t))}function Hu(e,t=Ze){return Pe(e,u=>typeof u=="string"?Ie(t,u.split(`
|
| 7 |
+
`)):u)}function Bo(e){if(e.type===_)return!0}function Xu(e){return qe(e,Bo,!1)}function Ee(e,t){return e.type===O?{...e,contents:t(e.contents)}:t(e)}var N=P,et=P,qu=P,Qu=P;function ae(e){return N(e),{type:I,contents:e}}function De(e,t){return Qu(e),N(t),{type:k,contents:t,n:e}}function Zu(e){return De(Number.NEGATIVE_INFINITY,e)}function tt(e){return De({type:"root"},e)}function er(e){return De(-1,e)}function ut(e,t,u){N(e);let r=e;if(t>0){for(let o=0;o<Math.floor(t/u);++o)r=ae(r);r=De(t%u,r),r=De(Number.NEGATIVE_INFINITY,r)}return r}var ce={type:T};var ee={type:U};function tr(e){return qu(e),{type:w,parts:e}}function Kt(e,t={}){return N(e),et(t.expandedStates,!0),{type:x,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function ur(e,t){return Kt(e[0],{...t,expandedStates:e})}function rr(e,t="",u={}){return N(e),t!==""&&N(t),{type:B,breakContents:e,flatContents:t,groupId:u.groupId}}function nr(e,t){return N(e),{type:R,contents:e,groupId:t.groupId,negate:t.negate}}function Ie(e,t){N(e),et(t);let u=[];for(let r=0;r<t.length;r++)r!==0&&u.push(e),u.push(t[r]);return u}function or(e,t){return N(t),e?{type:O,label:e,contents:t}:t}var rt={type:_},ar={type:_,soft:!0},ke={type:_,hard:!0},V=[ke,ce],Gt={type:_,hard:!0,literal:!0},Ze=[Gt,ce];function ve(e){return N(e),{type:L,contents:e}}var ir={type:M};var sr={type:v};function te(e){if(!e)return"";if(Array.isArray(e)){let t=[];for(let u of e)if(Array.isArray(u))t.push(...te(u));else{let r=te(u);r!==""&&t.push(r)}return t}return e.type===B?{...e,breakContents:te(e.breakContents),flatContents:te(e.flatContents)}:e.type===x?{...e,contents:te(e.contents),expandedStates:e.expandedStates?.map(te)}:e.type===w?{type:"fill",parts:e.parts.map(te)}:e.contents?{...e,contents:te(e.contents)}:e}function Dr(e){let t=Object.create(null),u=new Set;return r(te(e));function r(n,a,s){if(typeof n=="string")return JSON.stringify(n);if(Array.isArray(n)){let i=n.map(r).filter(Boolean);return i.length===1?i[0]:`[${i.join(", ")}]`}if(n.type===_){let i=s?.[a+1]?.type===T;return n.literal?i?"literalline":"literallineWithoutBreakParent":n.hard?i?"hardline":"hardlineWithoutBreakParent":n.soft?"softline":"line"}if(n.type===T)return s?.[a-1]?.type===_&&s[a-1].hard?void 0:"breakParent";if(n.type===v)return"trim";if(n.type===I)return"indent("+r(n.contents)+")";if(n.type===k)return n.n===Number.NEGATIVE_INFINITY?"dedentToRoot("+r(n.contents)+")":n.n<0?"dedent("+r(n.contents)+")":n.n.type==="root"?"markAsRoot("+r(n.contents)+")":"align("+JSON.stringify(n.n)+", "+r(n.contents)+")";if(n.type===B)return"ifBreak("+r(n.breakContents)+(n.flatContents?", "+r(n.flatContents):"")+(n.groupId?(n.flatContents?"":', ""')+`, { groupId: ${o(n.groupId)} }`:"")+")";if(n.type===R){let i=[];n.negate&&i.push("negate: true"),n.groupId&&i.push(`groupId: ${o(n.groupId)}`);let D=i.length>0?`, { ${i.join(", ")} }`:"";return`indentIfBreak(${r(n.contents)}${D})`}if(n.type===x){let i=[];n.break&&n.break!=="propagated"&&i.push("shouldBreak: true"),n.id&&i.push(`id: ${o(n.id)}`);let D=i.length>0?`, { ${i.join(", ")} }`:"";return n.expandedStates?`conditionalGroup([${n.expandedStates.map(f=>r(f)).join(",")}]${D})`:`group(${r(n.contents)}${D})`}if(n.type===w)return`fill([${n.parts.map(i=>r(i)).join(", ")}])`;if(n.type===L)return"lineSuffix("+r(n.contents)+")";if(n.type===M)return"lineSuffixBoundary";if(n.type===O)return`label(${JSON.stringify(n.label)}, ${r(n.contents)})`;if(n.type===U)return"cursor";throw new Error("Unknown doc type "+n.type)}function o(n){if(typeof n!="symbol")return JSON.stringify(String(n));if(n in t)return t[n];let a=n.description||"symbol";for(let s=0;;s++){let i=a+(s>0?` #${s}`:"");if(!u.has(i))return u.add(i),t[n]=`Symbol.for(${JSON.stringify(i)})`}}}var cr=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0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\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function zt(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function Jt(e){return e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9776&&e<=9783||e>=9800&&e<=9811||e===9855||e>=9866&&e<=9871||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e>=94192&&e<=94198||e>=94208&&e<=101589||e>=101631&&e<=101662||e>=101760&&e<=101874||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128728||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129674||e>=129678&&e<=129734||e===129736||e>=129741&&e<=129756||e>=129759&&e<=129770||e>=129775&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}var fr="\xA9\xAE\u203C\u2049\u2122\u2139\u2194\u2195\u2196\u2197\u2198\u2199\u21A9\u21AA\u2328\u23CF\u23F1\u23F2\u23F8\u23F9\u23FA\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600\u2601\u2602\u2603\u2604\u260E\u2611\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638\u2639\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694\u2695\u2696\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F1\u26F7\u26F8\u26F9\u2702\u2708\u2709\u270C\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u2764\u27A1\u2934\u2935\u2B05\u2B06\u2B07";var To=/[^\x20-\x7F]/u,No=new Set(fr);function So(e){if(!e)return 0;if(!To.test(e))return e.length;e=e.replace(cr(),u=>No.has(u)?" ":" ");let t=0;for(let u of e){let r=u.codePointAt(0);r<=31||r>=127&&r<=159||r>=768&&r<=879||r>=65024&&r<=65039||(t+=zt(r)||Jt(r)?2:1)}return t}var Re=So;var wo={type:0},Oo={type:1},Ht={value:"",length:0,queue:[],get root(){return Ht}};function lr(e,t,u){let r=t.type===1?e.queue.slice(0,-1):[...e.queue,t],o="",n=0,a=0,s=0;for(let p of r)switch(p.type){case 0:f(),u.useTabs?i(1):D(u.tabWidth);break;case 3:{let{string:F}=p;f(),o+=F,n+=F.length;break}case 2:{let{width:F}=p;a+=1,s+=F;break}default:throw new Error(`Unexpected indent comment '${p.type}'.`)}return d(),{...e,value:o,length:n,queue:r};function i(p){o+=" ".repeat(p),n+=u.tabWidth*p}function D(p){o+=" ".repeat(p),n+=p}function f(){u.useTabs?l():d()}function l(){a>0&&i(a),c()}function d(){s>0&&D(s),c()}function c(){a=0,s=0}}function dr(e,t,u){if(!t)return e;if(t.type==="root")return{...e,root:e};if(t===Number.NEGATIVE_INFINITY)return e.root;let r;return typeof t=="number"?t<0?r=Oo:r={type:2,width:t}:r={type:3,string:t},lr(e,r,u)}function pr(e,t){return lr(e,wo,t)}function Po(e){let t=0;for(let u=e.length-1;u>=0;u--){let r=e[u];if(r===" "||r===" ")t++;else break}return t}function Xt(e){let t=Po(e);return{text:t===0?e:e.slice(0,e.length-t),count:t}}var W=Symbol("MODE_BREAK"),q=Symbol("MODE_FLAT"),qt=Symbol("DOC_FILL_PRINTED_LENGTH");function nt(e,t,u,r,o,n){if(u===Number.POSITIVE_INFINITY)return!0;let a=t.length,s=!1,i=[e],D="";for(;u>=0;){if(i.length===0){if(a===0)return!0;i.push(t[--a]);continue}let{mode:f,doc:l}=i.pop(),d=H(l);switch(d){case G:l&&(s&&(D+=" ",u-=1,s=!1),D+=l,u-=Re(l));break;case j:case w:{let c=d===j?l:l.parts,p=l[qt]??0;for(let F=c.length-1;F>=p;F--)i.push({mode:f,doc:c[F]});break}case I:case k:case R:case O:i.push({mode:f,doc:l.contents});break;case v:{let{text:c,count:p}=Xt(D);D=c,u+=p;break}case x:{if(n&&l.break)return!1;let c=l.break?W:f,p=l.expandedStates&&c===W?b(0,l.expandedStates,-1):l.contents;i.push({mode:c,doc:p});break}case B:{let p=(l.groupId?o[l.groupId]||q:f)===W?l.breakContents:l.flatContents;p&&i.push({mode:f,doc:p});break}case _:if(f===W||l.hard)return!0;l.soft||(s=!0);break;case L:r=!0;break;case M:if(r)return!1;break}}return!1}function Ce(e,t){let u=Object.create(null),r=t.printWidth,o=Se(t.endOfLine),n=0,a=[{indent:Ht,mode:W,doc:e}],s="",i=!1,D=[],f=[],l=[],d=[],c=0;for(zu(e);a.length>0;){let{indent:m,mode:h,doc:E}=a.pop();switch(H(E)){case G:{let g=o!==`
|
| 8 |
+
`?oe(0,E,`
|
| 9 |
+
`,o):E;g&&(s+=g,a.length>0&&(n+=Re(g)));break}case j:for(let g=E.length-1;g>=0;g--)a.push({indent:m,mode:h,doc:E[g]});break;case U:if(f.length>=2)throw new Error("There are too many 'cursor' in doc.");f.push(c+s.length);break;case I:a.push({indent:pr(m,t),mode:h,doc:E.contents});break;case k:a.push({indent:dr(m,E.n,t),mode:h,doc:E.contents});break;case v:y();break;case x:switch(h){case q:if(!i){a.push({indent:m,mode:E.break?W:q,doc:E.contents});break}case W:{i=!1;let g={indent:m,mode:q,doc:E.contents},A=r-n,J=D.length>0;if(!E.break&&nt(g,a,A,J,u))a.push(g);else if(E.expandedStates){let Q=b(0,E.expandedStates,-1);if(E.break){a.push({indent:m,mode:W,doc:Q});break}else for(let re=1;re<E.expandedStates.length+1;re++)if(re>=E.expandedStates.length){a.push({indent:m,mode:W,doc:Q});break}else{let Te=E.expandedStates[re],ne={indent:m,mode:q,doc:Te};if(nt(ne,a,A,J,u)){a.push(ne);break}}}else a.push({indent:m,mode:W,doc:E.contents});break}}E.id&&(u[E.id]=b(0,a,-1).mode);break;case w:{let g=r-n,A=E[qt]??0,{parts:J}=E,Q=J.length-A;if(Q===0)break;let re=J[A+0],Te=J[A+1],ne={indent:m,mode:q,doc:re},Rt={indent:m,mode:W,doc:re},Lt=nt(ne,[],g,D.length>0,u,!0);if(Q===1){Lt?a.push(ne):a.push(Rt);break}let Iu={indent:m,mode:q,doc:Te},Mt={indent:m,mode:W,doc:Te};if(Q===2){Lt?a.push(Iu,ne):a.push(Mt,Rt);break}let Xn=J[A+2],qn={indent:m,mode:h,doc:{...E,[qt]:A+2}},Qn=nt({indent:m,mode:q,doc:[re,Te,Xn]},[],g,D.length>0,u,!0);a.push(qn),Qn?a.push(Iu,ne):Lt?a.push(Mt,ne):a.push(Mt,Rt);break}case B:case R:{let g=E.groupId?u[E.groupId]:h;if(g===W){let A=E.type===B?E.breakContents:E.negate?E.contents:ae(E.contents);A&&a.push({indent:m,mode:h,doc:A})}if(g===q){let A=E.type===B?E.flatContents:E.negate?ae(E.contents):E.contents;A&&a.push({indent:m,mode:h,doc:A})}break}case L:D.push({indent:m,mode:h,doc:E.contents});break;case M:D.length>0&&a.push({indent:m,mode:h,doc:ke});break;case _:switch(h){case q:if(E.hard)i=!0;else{E.soft||(s+=" ",n+=1);break}case W:if(D.length>0){a.push({indent:m,mode:h,doc:E},...D.reverse()),D.length=0;break}E.literal?(s+=o,n=0,m.root&&(m.root.value&&(s+=m.root.value),n=m.root.length)):(y(),s+=o+m.value,n=m.length);break}break;case O:a.push({indent:m,mode:h,doc:E.contents});break;case T:break;default:throw new Z(E)}a.length===0&&D.length>0&&(a.push(...D.reverse()),D.length=0)}let p=l.join("")+s,F=[...d,...f];if(F.length!==2)return{formatted:p};let C=F[0];return{formatted:p,cursorNodeStart:C,cursorNodeText:p.slice(C,b(0,F,-1))};function y(){let{text:m,count:h}=Xt(s);m&&(l.push(m),c+=m.length),s="",n-=h,f.length>0&&(d.push(...f.map(E=>Math.min(E,c))),f.length=0)}}function Io(e,t,u=0){let r=0;for(let o=u;o<e.length;++o)e[o]===" "?r=r+t-r%t:r++;return r}var he=Io;var Qt=class{constructor(t){this.stack=[t]}get key(){let{stack:t,siblings:u}=this;return b(0,t,u===null?-2:-4)??null}get index(){return this.siblings===null?null:b(0,this.stack,-2)}get node(){return b(0,this.stack,-1)}get parent(){return this.getNode(1)}get grandparent(){return this.getNode(2)}get isInArray(){return this.siblings!==null}get siblings(){let{stack:t}=this,u=b(0,t,-3);return Array.isArray(u)?u:null}get next(){let{siblings:t}=this;return t===null?null:t[this.index+1]}get previous(){let{siblings:t}=this;return t===null?null:t[this.index-1]}get isFirst(){return this.index===0}get isLast(){let{siblings:t,index:u}=this;return t!==null&&u===t.length-1}get isRoot(){return this.stack.length===1}get root(){return this.stack[0]}get ancestors(){return[...this.#e()]}getName(){let{stack:t}=this,{length:u}=t;return u>1?b(0,t,-2):null}getValue(){return b(0,this.stack,-1)}getNode(t=0){let u=this.#t(t);return u===-1?null:this.stack[u]}getParentNode(t=0){return this.getNode(t+1)}#t(t){let{stack:u}=this;for(let r=u.length-1;r>=0;r-=2)if(!Array.isArray(u[r])&&--t<0)return r;return-1}call(t,...u){let{stack:r}=this,{length:o}=r,n=b(0,r,-1);for(let a of u)n=n?.[a],r.push(a,n);try{return t(this)}finally{r.length=o}}callParent(t,u=0){let r=this.#t(u+1),o=this.stack.splice(r+1);try{return t(this)}finally{this.stack.push(...o)}}each(t,...u){let{stack:r}=this,{length:o}=r,n=b(0,r,-1);for(let a of u)n=n[a],r.push(a,n);try{for(let a=0;a<n.length;++a)r.push(a,n[a]),t(this,a,n),r.length-=2}finally{r.length=o}}map(t,...u){let r=[];return this.each((o,n,a)=>{r[n]=t(o,n,a)},...u),r}match(...t){let u=this.stack.length-1,r=null,o=this.stack[u--];for(let n of t){if(o===void 0)return!1;let a=null;if(typeof r=="number"&&(a=r,r=this.stack[u--],o=this.stack[u--]),n&&!n(o,r,a))return!1;r=this.stack[u--],o=this.stack[u--]}return!0}findAncestor(t){for(let u of this.#e())if(t(u))return u}hasAncestor(t){for(let u of this.#e())if(t(u))return!0;return!1}*#e(){let{stack:t}=this;for(let u=t.length-3;u>=0;u-=2){let r=t[u];Array.isArray(r)||(yield r)}}},Fr=Qt;function ko(e){return e!==null&&typeof e=="object"}var ge=ko;function ye(e){return(t,u,r)=>{let o=!!r?.backwards;if(u===!1)return!1;let{length:n}=t,a=u;for(;a>=0&&a<n;){let s=t.charAt(a);if(e instanceof RegExp){if(!e.test(s))return a}else if(!e.includes(s))return a;o?a--:a++}return a===-1||a===n?a:!1}}var mr=ye(/\s/u),Y=ye(" "),ot=ye(",; "),at=ye(/[^\n\r]/u);var Er=e=>e===`
|
| 10 |
+
`||e==="\r"||e==="\u2028"||e==="\u2029";function vo(e,t,u){let r=!!u?.backwards;if(t===!1)return!1;let o=e.charAt(t);if(r){if(e.charAt(t-1)==="\r"&&o===`
|
| 11 |
+
`)return t-2;if(Er(o))return t-1}else{if(o==="\r"&&e.charAt(t+1)===`
|
| 12 |
+
`)return t+2;if(Er(o))return t+1}return t}var K=vo;function Ro(e,t,u={}){let r=Y(e,u.backwards?t-1:t,u),o=K(e,r,u);return r!==o}var z=Ro;function Lo(e){return Array.isArray(e)&&e.length>0}var Cr=Lo;function*be(e,t){let{getVisitorKeys:u,filter:r=()=>!0}=t,o=n=>ge(n)&&r(n);for(let n of u(e)){let a=e[n];if(Array.isArray(a))for(let s of a)o(s)&&(yield s);else o(a)&&(yield a)}}function*hr(e,t){let u=[e];for(let r=0;r<u.length;r++){let o=u[r];for(let n of be(o,t))yield n,u.push(n)}}function gr(e,t){return be(e,t).next().done}function yr(e,t,u){let{cache:r}=u;if(r.has(e))return r.get(e);let{filter:o}=u;if(!o)return[];let n,a=(u.getChildren?.(e,u)??[...be(e,{getVisitorKeys:u.getVisitorKeys})]).flatMap(D=>(n??(n=[e,...t]),o(D,n)?[D]:yr(D,n,u))),{locStart:s,locEnd:i}=u;return a.sort((D,f)=>s(D)-s(f)||i(D)-i(f)),r.set(e,a),a}var it=yr;function Mo(e){let t=e.type||e.kind||"(unknown type)",u=String(e.name||e.id&&(typeof e.id=="object"?e.id.name:e.id)||e.key&&(typeof e.key=="object"?e.key.name:e.key)||e.value&&(typeof e.value=="object"?"":String(e.value))||e.operator||"");return u.length>20&&(u=u.slice(0,19)+"\u2026"),t+(u?" "+u:"")}function Zt(e,t){(e.comments??(e.comments=[])).push(t),t.printed=!1,t.nodeDescription=Mo(e)}function fe(e,t){t.leading=!0,t.trailing=!1,Zt(e,t)}function ue(e,t,u){t.leading=!1,t.trailing=!1,u&&(t.marker=u),Zt(e,t)}function le(e,t){t.leading=!1,t.trailing=!0,Zt(e,t)}var uu=new WeakMap;function Ar(e,t,u,r,o=[]){let{locStart:n,locEnd:a}=u,s=n(t),i=a(t),D=it(e,o,{cache:uu,locStart:n,locEnd:a,getVisitorKeys:u.getVisitorKeys,filter:u.printer.canAttachComment,getChildren:u.printer.getCommentChildNodes}),f,l,d=0,c=D.length;for(;d<c;){let p=d+c>>1,F=D[p],C=n(F),y=a(F);if(C<=s&&i<=y)return Ar(F,t,u,F,[F,...o]);if(y<=s){f=F,d=p+1;continue}if(i<=C){l=F,c=p;continue}throw new Error("Comment location overlaps with node location")}if(r?.type==="TemplateLiteral"){let{quasis:p}=r,F=tu(p,t,u);f&&tu(p,f,u)!==F&&(f=null),l&&tu(p,l,u)!==F&&(l=null)}return{enclosingNode:r,precedingNode:f,followingNode:l}}var eu=()=>!1;function _r(e,t){let{comments:u}=e;if(delete e.comments,!Cr(u)||!t.printer.canAttachComment)return;let r=[],{printer:{features:{experimental_avoidAstMutation:o},handleComments:n={}},originalText:a}=t,{ownLine:s=eu,endOfLine:i=eu,remaining:D=eu}=n,f=u.map((l,d)=>({...Ar(e,l,t),comment:l,text:a,options:t,ast:e,isLastComment:u.length-1===d}));for(let[l,d]of f.entries()){let{comment:c,precedingNode:p,enclosingNode:F,followingNode:C,text:y,options:m,ast:h,isLastComment:E}=d,g;if(o?g=[d]:(c.enclosingNode=F,c.precedingNode=p,c.followingNode=C,g=[c,y,m,h,E]),Yo(y,m,f,l))c.placement="ownLine",s(...g)||(C?fe(C,c):p?le(p,c):F?ue(F,c):ue(h,c));else if(jo(y,m,f,l))c.placement="endOfLine",i(...g)||(p?le(p,c):C?fe(C,c):F?ue(F,c):ue(h,c));else if(c.placement="remaining",!D(...g))if(p&&C){let A=r.length;A>0&&r[A-1].followingNode!==C&&br(r,m),r.push(d)}else p?le(p,c):C?fe(C,c):F?ue(F,c):ue(h,c)}if(br(r,t),!o)for(let l of u)delete l.precedingNode,delete l.enclosingNode,delete l.followingNode}var xr=e=>!/[\S\n\u2028\u2029]/u.test(e);function Yo(e,t,u,r){let{comment:o,precedingNode:n}=u[r],{locStart:a,locEnd:s}=t,i=a(o);if(n)for(let D=r-1;D>=0;D--){let{comment:f,precedingNode:l}=u[D];if(l!==n||!xr(e.slice(s(f),i)))break;i=a(f)}return z(e,i,{backwards:!0})}function jo(e,t,u,r){let{comment:o,followingNode:n}=u[r],{locStart:a,locEnd:s}=t,i=s(o);if(n)for(let D=r+1;D<u.length;D++){let{comment:f,followingNode:l}=u[D];if(l!==n||!xr(e.slice(i,a(f))))break;i=s(f)}return z(e,i)}function br(e,t){let u=e.length;if(u===0)return;let{precedingNode:r,followingNode:o}=e[0],n=t.locStart(o),a;for(a=u;a>0;--a){let{comment:s,precedingNode:i,followingNode:D}=e[a-1];P(i,r),P(D,o);let f=t.originalText.slice(t.locEnd(s),n);if(t.printer.isGap?.(f,t)??/^[\s(]*$/u.test(f))n=t.locStart(s);else break}for(let[s,{comment:i}]of e.entries())s<a?le(r,i):fe(o,i);for(let s of[r,o])s.comments&&s.comments.length>1&&s.comments.sort((i,D)=>t.locStart(i)-t.locStart(D));e.length=0}function tu(e,t,u){let r=u.locStart(t)-1;for(let o=1;o<e.length;++o)if(r<u.locStart(e[o]))return o-1;return 0}function Uo(e,t){let u=t-1;u=Y(e,u,{backwards:!0}),u=K(e,u,{backwards:!0}),u=Y(e,u,{backwards:!0});let r=K(e,u,{backwards:!0});return u!==r}var Le=Uo;function Br(e,t){let u=e.node;return u.printed=!0,t.printer.printComment(e,t)}function Wo(e,t){let u=e.node,r=[Br(e,t)],{printer:o,originalText:n,locStart:a,locEnd:s}=t;if(o.isBlockComment?.(u)){let f=z(n,s(u))?z(n,a(u),{backwards:!0})?V:rt:" ";r.push(f)}else r.push(V);let D=K(n,Y(n,s(u)));return D!==!1&&z(n,D)&&r.push(V),r}function $o(e,t,u){let r=e.node,o=Br(e,t),{printer:n,originalText:a,locStart:s}=t,i=n.isBlockComment?.(r);if(u?.hasLineSuffix&&!u?.isBlock||z(a,s(r),{backwards:!0})){let D=Le(a,s(r));return{doc:ve([V,D?V:"",o]),isBlock:i,hasLineSuffix:!0}}return!i||u?.hasLineSuffix?{doc:[ve([" ",o]),ce],isBlock:i,hasLineSuffix:!0}:{doc:[" ",o],isBlock:i,hasLineSuffix:!1}}function Vo(e,t){let u=e.node;if(!u)return{};let r=t[Symbol.for("printedComments")];if((u.comments||[]).filter(i=>!r.has(i)).length===0)return{leading:"",trailing:""};let n=[],a=[],s;return e.each(()=>{let i=e.node;if(r?.has(i))return;let{leading:D,trailing:f}=i;D?n.push(Wo(e,t)):f&&(s=$o(e,t,s),a.push(s.doc))},"comments"),{leading:n,trailing:a}}function Tr(e,t,u){let{leading:r,trailing:o}=Vo(e,u);return!r&&!o?t:Ee(t,n=>[r,n,o])}function Nr(e){let{[Symbol.for("comments")]:t,[Symbol.for("printedComments")]:u}=e;for(let r of t){if(!r.printed&&!u.has(r))throw new Error('Comment "'+r.value.trim()+'" was not printed. Please report this error!');delete r.printed}}var Sr=()=>P;var Me=class extends Error{name="ConfigError"},Ye=class extends Error{name="UndefinedParserError"};var wr={checkIgnorePragma:{category:"Special",type:"boolean",default:!1,description:"Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.",cliCategory:"Other"},cursorOffset:{category:"Special",type:"int",default:-1,range:{start:-1,end:1/0,step:1},description:"Print (to stderr) where a cursor at the given position would move to after formatting.",cliCategory:"Editor"},endOfLine:{category:"Global",type:"choice",default:"lf",description:"Which end of line characters to apply.",choices:[{value:"lf",description:"Line Feed only (\\n), common on Linux and macOS as well as inside git repos"},{value:"crlf",description:"Carriage Return + Line Feed characters (\\r\\n), common on Windows"},{value:"cr",description:"Carriage Return character only (\\r), used very rarely"},{value:"auto",description:`Maintain existing
|
| 13 |
+
(mixed values within one file are normalised by looking at what's used after the first line)`}]},filepath:{category:"Special",type:"path",description:"Specify the input filepath. This will be used to do parser inference.",cliName:"stdin-filepath",cliCategory:"Other",cliDescription:"Path to the file to pretend that stdin comes from."},insertPragma:{category:"Special",type:"boolean",default:!1,description:"Insert @format pragma into file's first docblock comment.",cliCategory:"Other"},parser:{category:"Global",type:"choice",default:void 0,description:"Which parser to use.",exception:e=>typeof e=="string"||typeof e=="function",choices:[{value:"flow",description:"Flow"},{value:"babel",description:"JavaScript"},{value:"babel-flow",description:"Flow"},{value:"babel-ts",description:"TypeScript"},{value:"typescript",description:"TypeScript"},{value:"acorn",description:"JavaScript"},{value:"espree",description:"JavaScript"},{value:"meriyah",description:"JavaScript"},{value:"css",description:"CSS"},{value:"less",description:"Less"},{value:"scss",description:"SCSS"},{value:"json",description:"JSON"},{value:"json5",description:"JSON5"},{value:"jsonc",description:"JSON with Comments"},{value:"json-stringify",description:"JSON.stringify"},{value:"graphql",description:"GraphQL"},{value:"markdown",description:"Markdown"},{value:"mdx",description:"MDX"},{value:"vue",description:"Vue"},{value:"yaml",description:"YAML"},{value:"glimmer",description:"Ember / Handlebars"},{value:"html",description:"HTML"},{value:"angular",description:"Angular"},{value:"lwc",description:"Lightning Web Components"},{value:"mjml",description:"MJML"}]},plugins:{type:"path",array:!0,default:[{value:[]}],category:"Global",description:"Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",exception:e=>typeof e=="string"||typeof e=="object",cliName:"plugin",cliCategory:"Config"},printWidth:{category:"Global",type:"int",default:80,description:"The line length where Prettier will try wrap.",range:{start:0,end:1/0,step:1}},rangeEnd:{category:"Special",type:"int",default:1/0,range:{start:0,end:1/0,step:1},description:`Format code ending at a given character offset (exclusive).
|
| 14 |
+
The range will extend forwards to the end of the selected statement.`,cliCategory:"Editor"},rangeStart:{category:"Special",type:"int",default:0,range:{start:0,end:1/0,step:1},description:`Format code starting at a given character offset.
|
| 15 |
+
The range will extend backwards to the start of the first line containing the selected statement.`,cliCategory:"Editor"},requirePragma:{category:"Special",type:"boolean",default:!1,description:"Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.",cliCategory:"Other"},tabWidth:{type:"int",category:"Global",default:2,description:"Number of spaces per indentation level.",range:{start:0,end:1/0,step:1}},useTabs:{category:"Global",type:"boolean",default:!1,description:"Indent with tabs instead of spaces."},embeddedLanguageFormatting:{category:"Global",type:"choice",default:"auto",description:"Control how Prettier formats quoted code embedded in the file.",choices:[{value:"auto",description:"Format embedded code if Prettier can automatically identify it."},{value:"off",description:"Never automatically format embedded code."}]}};function st({plugins:e=[],showDeprecated:t=!1}={}){let u=e.flatMap(o=>o.languages??[]),r=[];for(let o of Go(Object.assign({},...e.map(({options:n})=>n),wr)))!t&&o.deprecated||(Array.isArray(o.choices)&&(t||(o.choices=o.choices.filter(n=>!n.deprecated)),o.name==="parser"&&(o.choices=[...o.choices,...Ko(o.choices,u,e)])),o.pluginDefaults=Object.fromEntries(e.filter(n=>n.defaultOptions?.[o.name]!==void 0).map(n=>[n.name,n.defaultOptions[o.name]])),r.push(o));return{languages:u,options:r}}function*Ko(e,t,u){let r=new Set(e.map(o=>o.value));for(let o of t)if(o.parsers){for(let n of o.parsers)if(!r.has(n)){r.add(n);let a=u.find(i=>i.parsers&&Object.prototype.hasOwnProperty.call(i.parsers,n)),s=o.name;a?.name&&(s+=` (plugin: ${a.name})`),yield{value:n,description:s}}}}function Go(e){let t=[];for(let[u,r]of Object.entries(e)){let o={name:u,...r};Array.isArray(o.default)&&(o.default=b(0,o.default,-1).value),t.push(o)}return t}var zo=Array.prototype.toReversed??function(){return[...this].reverse()},Jo=X("toReversed",function(){if(Array.isArray(this))return zo}),Or=Jo;function Ho(){let e=globalThis,t=e.Deno?.build?.os;return typeof t=="string"?t==="windows":e.navigator?.platform?.startsWith("Win")??e.process?.platform?.startsWith("win")??!1}var Xo=Ho();function Pr(e){if(e=e instanceof URL?e:new URL(e),e.protocol!=="file:")throw new TypeError(`URL must be a file URL: received "${e.protocol}"`);return e}function qo(e){return e=Pr(e),decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function Qo(e){e=Pr(e);let t=decodeURIComponent(e.pathname.replace(/\//g,"\\").replace(/%(?![0-9A-Fa-f]{2})/g,"%25")).replace(/^\\*([A-Za-z]:)(\\|$)/,"$1\\");return e.hostname!==""&&(t=`\\\\${e.hostname}${t}`),t}function ru(e){return Xo?Qo(e):qo(e)}var Ir=e=>String(e).split(/[/\\]/u).pop(),kr=e=>String(e).startsWith("file:");function vr(e,t){if(!t)return;let u=Ir(t).toLowerCase();return e.find(({filenames:r})=>r?.some(o=>o.toLowerCase()===u))??e.find(({extensions:r})=>r?.some(o=>u.endsWith(o)))}function Zo(e,t){if(t)return e.find(({name:u})=>u.toLowerCase()===t)??e.find(({aliases:u})=>u?.includes(t))??e.find(({extensions:u})=>u?.includes(`.${t}`))}var ea=void 0;function Rr(e,t){if(t){if(kr(t))try{t=ru(t)}catch{return}if(typeof t=="string")return e.find(({isSupported:u})=>u?.({filepath:t}))}}function ta(e,t){let u=Or(0,e.plugins).flatMap(o=>o.languages??[]);return(Zo(u,t.language)??vr(u,t.physicalFile)??vr(u,t.file)??Rr(u,t.physicalFile)??Rr(u,t.file)??ea?.(u,t.physicalFile))?.parsers[0]}var Dt=ta;var ie={key:e=>/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(e)?e:JSON.stringify(e),value(e){if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(u=>ie.value(u)).join(", ")}]`;let t=Object.keys(e);return t.length===0?"{}":`{ ${t.map(u=>`${ie.key(u)}: ${ie.value(e[u])}`).join(", ")} }`},pair:({key:e,value:t})=>ie.value({[e]:t})};var nu=new Proxy(String,{get:()=>nu}),$=nu,ou=()=>nu;var Lr=(e,t,{descriptor:u})=>{let r=[`${$.yellow(typeof e=="string"?u.key(e):u.pair(e))} is deprecated`];return t&&r.push(`we now treat it as ${$.blue(typeof t=="string"?u.key(t):u.pair(t))}`),r.join("; ")+"."};var ct=Symbol.for("vnopts.VALUE_NOT_EXIST"),Ae=Symbol.for("vnopts.VALUE_UNCHANGED");var Mr=" ".repeat(2),jr=(e,t,u)=>{let{text:r,list:o}=u.normalizeExpectedResult(u.schemas[e].expected(u)),n=[];return r&&n.push(Yr(e,t,r,u.descriptor)),o&&n.push([Yr(e,t,o.title,u.descriptor)].concat(o.values.map(a=>Ur(a,u.loggerPrintWidth))).join(`
|
| 16 |
+
`)),Wr(n,u.loggerPrintWidth)};function Yr(e,t,u,r){return[`Invalid ${$.red(r.key(e))} value.`,`Expected ${$.blue(u)},`,`but received ${t===ct?$.gray("nothing"):$.red(r.value(t))}.`].join(" ")}function Ur({text:e,list:t},u){let r=[];return e&&r.push(`- ${$.blue(e)}`),t&&r.push([`- ${$.blue(t.title)}:`].concat(t.values.map(o=>Ur(o,u-Mr.length).replace(/^|\n/g,`$&${Mr}`))).join(`
|
| 17 |
+
`)),Wr(r,u)}function Wr(e,t){if(e.length===1)return e[0];let[u,r]=e,[o,n]=e.map(a=>a.split(`
|
| 18 |
+
`,1)[0].length);return o>t&&o>n?r:u}var _e=[],au=[];function ft(e,t,u){if(e===t)return 0;let r=u?.maxDistance,o=e;e.length>t.length&&(e=t,t=o);let n=e.length,a=t.length;for(;n>0&&e.charCodeAt(~-n)===t.charCodeAt(~-a);)n--,a--;let s=0;for(;s<n&&e.charCodeAt(s)===t.charCodeAt(s);)s++;if(n-=s,a-=s,r!==void 0&&a-n>r)return r;if(n===0)return r!==void 0&&a>r?r:a;let i,D,f,l,d=0,c=0;for(;d<n;)au[d]=e.charCodeAt(s+d),_e[d]=++d;for(;c<a;){for(i=t.charCodeAt(s+c),f=c++,D=c,d=0;d<n;d++)l=i===au[d]?f:f+1,f=_e[d],D=_e[d]=f>D?l>D?D+1:l:l>f?f+1:l;if(r!==void 0){let p=D;for(d=0;d<n;d++)_e[d]<p&&(p=_e[d]);if(p>r)return r}}return _e.length=n,au.length=n,r!==void 0&&D>r?r:D}function $r(e,t,u){if(!Array.isArray(t)||t.length===0)return;let r=u?.maxDistance,o=e.length;for(let i of t)if(i===e)return i;if(r===0)return;let n,a=Number.POSITIVE_INFINITY,s=new Set;for(let i of t){if(s.has(i))continue;s.add(i);let D=Math.abs(i.length-o);if(D>=a||r!==void 0&&D>r)continue;let f=Number.isFinite(a)?r===void 0?a:Math.min(a,r):r,l=f===void 0?ft(e,i):ft(e,i,{maxDistance:f});if(r!==void 0&&l>r)continue;let d=l;if(f!==void 0&&l===f&&f===r&&(d=ft(e,i)),d<a&&(a=d,n=i,a===0))break}if(!(r!==void 0&&a>r))return n}var lt=(e,t,{descriptor:u,logger:r,schemas:o})=>{let n=[`Ignored unknown option ${$.yellow(u.pair({key:e,value:t}))}.`],a=$r(e,Object.keys(o),{maxDistance:3});a&&n.push(`Did you mean ${$.blue(u.key(a))}?`),r.warn(n.join(" "))};var ua=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function ra(e,t){let u=new e(t),r=Object.create(u);for(let o of ua)o in t&&(r[o]=na(t[o],u,S.prototype[o].length));return r}var S=class{static create(t){return ra(this,t)}constructor(t){this.name=t.name}default(t){}expected(t){return"nothing"}validate(t,u){return!1}deprecated(t,u){return!1}forward(t,u){}redirect(t,u){}overlap(t,u,r){return t}preprocess(t,u){return t}postprocess(t,u){return Ae}};function na(e,t,u){return typeof e=="function"?(...r)=>e(...r.slice(0,u-1),t,...r.slice(u-1)):()=>e}var dt=class extends S{constructor(t){super(t),this._sourceName=t.sourceName}expected(t){return t.schemas[this._sourceName].expected(t)}validate(t,u){return u.schemas[this._sourceName].validate(t,u)}redirect(t,u){return this._sourceName}};var pt=class extends S{expected(){return"anything"}validate(){return!0}};var Ft=class extends S{constructor({valueSchema:t,name:u=t.name,...r}){super({...r,name:u}),this._valueSchema=t}expected(t){let{text:u,list:r}=t.normalizeExpectedResult(this._valueSchema.expected(t));return{text:u&&`an array of ${u}`,list:r&&{title:"an array of the following values",values:[{list:r}]}}}validate(t,u){if(!Array.isArray(t))return!1;let r=[];for(let o of t){let n=u.normalizeValidateResult(this._valueSchema.validate(o,u),o);n!==!0&&r.push(n.value)}return r.length===0?!0:{value:r}}deprecated(t,u){let r=[];for(let o of t){let n=u.normalizeDeprecatedResult(this._valueSchema.deprecated(o,u),o);n!==!1&&r.push(...n.map(({value:a})=>({value:[a]})))}return r}forward(t,u){let r=[];for(let o of t){let n=u.normalizeForwardResult(this._valueSchema.forward(o,u),o);r.push(...n.map(Vr))}return r}redirect(t,u){let r=[],o=[];for(let n of t){let a=u.normalizeRedirectResult(this._valueSchema.redirect(n,u),n);"remain"in a&&r.push(a.remain),o.push(...a.redirect.map(Vr))}return r.length===0?{redirect:o}:{redirect:o,remain:r}}overlap(t,u){return t.concat(u)}};function Vr({from:e,to:t}){return{from:[e],to:t}}var mt=class extends S{expected(){return"true or false"}validate(t){return typeof t=="boolean"}};function Gr(e,t){let u=Object.create(null);for(let r of e){let o=r[t];if(u[o])throw new Error(`Duplicate ${t} ${JSON.stringify(o)}`);u[o]=r}return u}function zr(e,t){let u=new Map;for(let r of e){let o=r[t];if(u.has(o))throw new Error(`Duplicate ${t} ${JSON.stringify(o)}`);u.set(o,r)}return u}function Jr(){let e=Object.create(null);return t=>{let u=JSON.stringify(t);return e[u]?!0:(e[u]=!0,!1)}}function Hr(e,t){let u=[],r=[];for(let o of e)t(o)?u.push(o):r.push(o);return[u,r]}function Xr(e){return e===Math.floor(e)}function qr(e,t){if(e===t)return 0;let u=typeof e,r=typeof t,o=["undefined","object","boolean","number","string"];return u!==r?o.indexOf(u)-o.indexOf(r):u!=="string"?Number(e)-Number(t):e.localeCompare(t)}function Qr(e){return(...t)=>{let u=e(...t);return typeof u=="string"?new Error(u):u}}function iu(e){return e===void 0?{}:e}function su(e){if(typeof e=="string")return{text:e};let{text:t,list:u}=e;return oa((t||u)!==void 0,"Unexpected `expected` result, there should be at least one field."),u?{text:t,list:{title:u.title,values:u.values.map(su)}}:{text:t}}function Du(e,t){return e===!0?!0:e===!1?{value:t}:e}function cu(e,t,u=!1){return e===!1?!1:e===!0?u?!0:[{value:t}]:"value"in e?[e]:e.length===0?!1:e}function Kr(e,t){return typeof e=="string"||"key"in e?{from:t,to:e}:"from"in e?{from:e.from,to:e.to}:{from:t,to:e.to}}function Et(e,t){return e===void 0?[]:Array.isArray(e)?e.map(u=>Kr(u,t)):[Kr(e,t)]}function fu(e,t){let u=Et(typeof e=="object"&&"redirect"in e?e.redirect:e,t);return u.length===0?{remain:t,redirect:u}:typeof e=="object"&&"remain"in e?{remain:e.remain,redirect:u}:{redirect:u}}function oa(e,t){if(!e)throw new Error(t)}var Ct=class extends S{constructor(t){super(t),this._choices=zr(t.choices.map(u=>u&&typeof u=="object"?u:{value:u}),"value")}expected({descriptor:t}){let u=Array.from(this._choices.keys()).map(a=>this._choices.get(a)).filter(({hidden:a})=>!a).map(a=>a.value).sort(qr).map(t.value),r=u.slice(0,-2),o=u.slice(-2);return{text:r.concat(o.join(" or ")).join(", "),list:{title:"one of the following values",values:u}}}validate(t){return this._choices.has(t)}deprecated(t){let u=this._choices.get(t);return u&&u.deprecated?{value:t}:!1}forward(t){let u=this._choices.get(t);return u?u.forward:void 0}redirect(t){let u=this._choices.get(t);return u?u.redirect:void 0}};var ht=class extends S{expected(){return"a number"}validate(t,u){return typeof t=="number"}};var gt=class extends ht{expected(){return"an integer"}validate(t,u){return u.normalizeValidateResult(super.validate(t,u),t)===!0&&Xr(t)}};var je=class extends S{expected(){return"a string"}validate(t){return typeof t=="string"}};var Zr=ie,en=lt,tn=jr,un=Lr;var yt=class{constructor(t,u){let{logger:r=console,loggerPrintWidth:o=80,descriptor:n=Zr,unknown:a=en,invalid:s=tn,deprecated:i=un,missing:D=()=>!1,required:f=()=>!1,preprocess:l=c=>c,postprocess:d=()=>Ae}=u||{};this._utils={descriptor:n,logger:r||{warn:()=>{}},loggerPrintWidth:o,schemas:Gr(t,"name"),normalizeDefaultResult:iu,normalizeExpectedResult:su,normalizeDeprecatedResult:cu,normalizeForwardResult:Et,normalizeRedirectResult:fu,normalizeValidateResult:Du},this._unknownHandler=a,this._invalidHandler=Qr(s),this._deprecatedHandler=i,this._identifyMissing=(c,p)=>!(c in p)||D(c,p),this._identifyRequired=f,this._preprocess=l,this._postprocess=d,this.cleanHistory()}cleanHistory(){this._hasDeprecationWarned=Jr()}normalize(t){let u={},o=[this._preprocess(t,this._utils)],n=()=>{for(;o.length!==0;){let a=o.shift(),s=this._applyNormalization(a,u);o.push(...s)}};n();for(let a of Object.keys(this._utils.schemas)){let s=this._utils.schemas[a];if(!(a in u)){let i=iu(s.default(this._utils));"value"in i&&o.push({[a]:i.value})}}n();for(let a of Object.keys(this._utils.schemas)){if(!(a in u))continue;let s=this._utils.schemas[a],i=u[a],D=s.postprocess(i,this._utils);D!==Ae&&(this._applyValidation(D,a,s),u[a]=D)}return this._applyPostprocess(u),this._applyRequiredCheck(u),u}_applyNormalization(t,u){let r=[],{knownKeys:o,unknownKeys:n}=this._partitionOptionKeys(t);for(let a of o){let s=this._utils.schemas[a],i=s.preprocess(t[a],this._utils);this._applyValidation(i,a,s);let D=({from:c,to:p})=>{r.push(typeof p=="string"?{[p]:c}:{[p.key]:p.value})},f=({value:c,redirectTo:p})=>{let F=cu(s.deprecated(c,this._utils),i,!0);if(F!==!1)if(F===!0)this._hasDeprecationWarned(a)||this._utils.logger.warn(this._deprecatedHandler(a,p,this._utils));else for(let{value:C}of F){let y={key:a,value:C};if(!this._hasDeprecationWarned(y)){let m=typeof p=="string"?{key:p,value:C}:p;this._utils.logger.warn(this._deprecatedHandler(y,m,this._utils))}}};Et(s.forward(i,this._utils),i).forEach(D);let d=fu(s.redirect(i,this._utils),i);if(d.redirect.forEach(D),"remain"in d){let c=d.remain;u[a]=a in u?s.overlap(u[a],c,this._utils):c,f({value:c})}for(let{from:c,to:p}of d.redirect)f({value:c,redirectTo:p})}for(let a of n){let s=t[a];this._applyUnknownHandler(a,s,u,(i,D)=>{r.push({[i]:D})})}return r}_applyRequiredCheck(t){for(let u of Object.keys(this._utils.schemas))if(this._identifyMissing(u,t)&&this._identifyRequired(u))throw this._invalidHandler(u,ct,this._utils)}_partitionOptionKeys(t){let[u,r]=Hr(Object.keys(t).filter(o=>!this._identifyMissing(o,t)),o=>o in this._utils.schemas);return{knownKeys:u,unknownKeys:r}}_applyValidation(t,u,r){let o=Du(r.validate(t,this._utils),t);if(o!==!0)throw this._invalidHandler(u,o.value,this._utils)}_applyUnknownHandler(t,u,r,o){let n=this._unknownHandler(t,u,this._utils);if(n)for(let a of Object.keys(n)){if(this._identifyMissing(a,n))continue;let s=n[a];a in this._utils.schemas?o(a,s):r[a]=s}}_applyPostprocess(t){let u=this._postprocess(t,this._utils);if(u!==Ae){if(u.delete)for(let r of u.delete)delete t[r];if(u.override){let{knownKeys:r,unknownKeys:o}=this._partitionOptionKeys(u.override);for(let n of r){let a=u.override[n];this._applyValidation(a,n,this._utils.schemas[n]),t[n]=a}for(let n of o){let a=u.override[n];this._applyUnknownHandler(n,a,t,(s,i)=>{let D=this._utils.schemas[s];this._applyValidation(i,s,D),t[s]=i})}}}}};var lu;function ia(e,t,{logger:u=!1,isCLI:r=!1,passThrough:o=!1,FlagSchema:n,descriptor:a}={}){if(r){if(!n)throw new Error("'FlagSchema' option is required.");if(!a)throw new Error("'descriptor' option is required.")}else a=ie;let s=o?Array.isArray(o)?(d,c)=>o.includes(d)?{[d]:c}:void 0:(d,c)=>({[d]:c}):(d,c,p)=>{let{_:F,...C}=p.schemas;return lt(d,c,{...p,schemas:C})},i=sa(t,{isCLI:r,FlagSchema:n}),D=new yt(i,{logger:u,unknown:s,descriptor:a}),f=u!==!1;f&&lu&&(D._hasDeprecationWarned=lu);let l=D.normalize(e);return f&&(lu=D._hasDeprecationWarned),l}function sa(e,{isCLI:t,FlagSchema:u}){let r=[];t&&r.push(pt.create({name:"_"}));for(let o of e)r.push(Da(o,{isCLI:t,optionInfos:e,FlagSchema:u})),o.alias&&t&&r.push(dt.create({name:o.alias,sourceName:o.name}));return r}function Da(e,{isCLI:t,optionInfos:u,FlagSchema:r}){let{name:o}=e,n={name:o},a,s={};switch(e.type){case"int":a=gt,t&&(n.preprocess=Number);break;case"string":a=je;break;case"choice":a=Ct,n.choices=e.choices.map(i=>i?.redirect?{...i,redirect:{to:{key:e.name,value:i.redirect}}}:i);break;case"boolean":a=mt;break;case"flag":a=r,n.flags=u.flatMap(i=>[i.alias,i.description&&i.name,i.oppositeDescription&&`no-${i.name}`].filter(Boolean));break;case"path":a=je;break;default:throw new Error(`Unexpected type ${e.type}`)}if(e.exception?n.validate=(i,D,f)=>e.exception(i)||D.validate(i,f):n.validate=(i,D,f)=>i===void 0||D.validate(i,f),e.redirect&&(s.redirect=i=>i?{to:typeof e.redirect=="string"?e.redirect:{key:e.redirect.option,value:e.redirect.value}}:void 0),e.deprecated&&(s.deprecated=!0),t&&!e.array){let i=n.preprocess||(D=>D);n.preprocess=(D,f,l)=>f.preprocess(i(Array.isArray(D)?b(0,D,-1):D),l)}return e.array?Ft.create({...t?{preprocess:i=>Array.isArray(i)?i:[i]}:{},...s,valueSchema:a.create(n)}):a.create({...n,...s})}var rn=ia;var ca=Array.prototype.findLast??function(e){for(let t=this.length-1;t>=0;t--){let u=this[t];if(e(u,t,this))return u}},fa=X("findLast",function(){if(Array.isArray(this))return ca}),du=fa;var nn=Symbol.for("PRETTIER_IS_FRONT_MATTER"),pu=[];function la(e){return!!e?.[nn]}var de=la;var on=new Set(["yaml","toml"]),Ue=({node:e})=>de(e)&&on.has(e.language);async function Fu(e,t,u,r){let{node:o}=u,{language:n}=o;if(!on.has(n))return;let a=o.value.trim(),s;if(a){let i=n==="yaml"?n:Dt(r,{language:n});if(!i)return;s=a?await e(a,{parser:i}):""}else s=a;return tt([o.startDelimiter,o.explicitLanguage??"",V,s,s?V:"",o.endDelimiter])}function da(e,t){return Ue({node:e})&&(delete t.end,delete t.raw,delete t.value),t}var mu=da;function pa({node:e}){return e.raw}var Eu=pa;var an=new Set(["tokens","comments","parent","enclosingNode","precedingNode","followingNode"]),Fa=e=>Object.keys(e).filter(t=>!an.has(t));function ma(e,t){let u=e?r=>e(r,an):Fa;return t?new Proxy(u,{apply:(r,o,n)=>de(n[0])?pu:Reflect.apply(r,o,n)}):u}var Cu=ma;function gu(e,t){if(!t)throw new Error("parserName is required.");let u=du(0,e,o=>o.parsers&&Object.prototype.hasOwnProperty.call(o.parsers,t));if(u)return u;let r=`Couldn't resolve parser "${t}".`;throw r+=" Plugins must be explicitly added to the standalone bundle.",new Me(r)}function sn(e,t){if(!t)throw new Error("astFormat is required.");let u=du(0,e,o=>o.printers&&Object.prototype.hasOwnProperty.call(o.printers,t));if(u)return u;let r=`Couldn't find plugin for AST format "${t}".`;throw r+=" Plugins must be explicitly added to the standalone bundle.",new Me(r)}function We({plugins:e,parser:t}){let u=gu(e,t);return yu(u,t)}function yu(e,t){let u=e.parsers[t];return typeof u=="function"?u():u}async function Dn(e,t){let u=e.printers[t],r=typeof u=="function"?await u():u;return Ea(r)}var hu=new WeakMap,Q0=Symbol("PRINTER_NORMALIZED_MARK");function Ea(e){if(hu.has(e))return hu.get(e);let{features:t,getVisitorKeys:u,embed:r,massageAstNode:o,print:n,...a}=e;t=ya(t);let s=t.experimental_frontMatterSupport;u=Cu(u,s.massageAstNode||s.embed||s.print);let i=o;o&&s.massageAstNode&&(i=new Proxy(o,{apply(d,c,p){return mu(...p),Reflect.apply(d,c,p)}}));let D=r;if(r){let d;D=new Proxy(r,{get(c,p,F){return p==="getVisitorKeys"?(d??(d=r.getVisitorKeys?Cu(r.getVisitorKeys,s.massageAstNode||s.embed):u),d):Reflect.get(c,p,F)},apply:(c,p,F)=>s.embed&&Ue(...F)?Fu:Reflect.apply(c,p,F)})}let f=n;s.print&&(f=new Proxy(n,{apply(d,c,p){let[F]=p;return de(F.node)?Eu(F):Reflect.apply(d,c,p)}}));let l={features:t,getVisitorKeys:u,embed:D,massageAstNode:i,print:f,...a};return hu.set(e,l),l}var Ca=["clean","embed","print"],ha=Object.fromEntries(Ca.map(e=>[e,!1]));function ga(e){return{...ha,...e}}function ya(e){return{experimental_avoidAstMutation:!1,...e,experimental_frontMatterSupport:ga(e?.experimental_frontMatterSupport)}}var cn={astFormat:"estree",printer:{},originalText:void 0,locStart:null,locEnd:null,getVisitorKeys:null};async function ba(e,t={}){let u={...e};if(!u.parser)if(u.filepath){if(u.parser=Dt(u,{physicalFile:u.filepath}),!u.parser)throw new Ye(`No parser could be inferred for file "${u.filepath}".`)}else throw new Ye("No parser and no file path given, couldn't infer a parser.");let r=st({plugins:e.plugins,showDeprecated:!0}).options,o={...cn,...Object.fromEntries(r.filter(l=>l.default!==void 0).map(l=>[l.name,l.default]))},n=gu(u.plugins,u.parser),a=await yu(n,u.parser);u.astFormat=a.astFormat,u.locEnd=a.locEnd,u.locStart=a.locStart;let s=n.printers?.[a.astFormat]?n:sn(u.plugins,a.astFormat),i=await Dn(s,a.astFormat);u.printer=i,u.getVisitorKeys=i.getVisitorKeys;let D=s.defaultOptions?Object.fromEntries(Object.entries(s.defaultOptions).filter(([,l])=>l!==void 0)):{},f={...o,...D};for(let[l,d]of Object.entries(f))(u[l]===null||u[l]===void 0)&&(u[l]=d);return u.parser==="json"&&(u.trailingComma="none"),rn(u,r,{passThrough:Object.keys(cn),...t})}var se=ba;var Ff=oo(pn(),1);var Au="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",Fn="\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",sf=new RegExp("["+Au+"]"),Df=new RegExp("["+Au+Fn+"]");Au=Fn=null;var _u={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]},cf=new Set(_u.keyword),ff=new Set(_u.strict),lf=new Set(_u.strictBind);var kt=(e,t)=>u=>e(t(u));function En(e){return{keyword:e.cyan,capitalized:e.yellow,jsxIdentifier:e.yellow,punctuator:e.yellow,number:e.magenta,string:e.green,regex:e.magenta,comment:e.gray,invalid:kt(kt(e.white,e.bgRed),e.bold),gutter:e.gray,marker:kt(e.red,e.bold),message:kt(e.red,e.bold),reset:e.reset}}var gf=En(ou(!0)),yf=En(ou(!1));function _a(){return new Proxy({},{get:()=>e=>e})}var mn=/\r\n|[\n\r\u2028\u2029]/;function xa(e,t,u){let r=Object.assign({column:0,line:-1},e.start),o=Object.assign({},r,e.end),{linesAbove:n=2,linesBelow:a=3}=u||{},s=r.line,i=r.column,D=o.line,f=o.column,l=Math.max(s-(n+1),0),d=Math.min(t.length,D+a);s===-1&&(l=0),D===-1&&(d=t.length);let c=D-s,p={};if(c)for(let F=0;F<=c;F++){let C=F+s;if(!i)p[C]=!0;else if(F===0){let y=t[C-1].length;p[C]=[i,y-i+1]}else if(F===c)p[C]=[0,f];else{let y=t[C-F].length;p[C]=[0,y]}}else i===f?i?p[s]=[i,0]:p[s]=!0:p[s]=[i,f-i];return{start:l,end:d,markerLines:p}}function Cn(e,t,u={}){let o=_a(!1),n=e.split(mn),{start:a,end:s,markerLines:i}=xa(t,n,u),D=t.start&&typeof t.start.column=="number",f=String(s).length,d=e.split(mn,s).slice(a,s).map((c,p)=>{let F=a+1+p,y=` ${` ${F}`.slice(-f)} |`,m=i[F],h=!i[F+1];if(m){let E="";if(Array.isArray(m)){let g=c.slice(0,Math.max(m[0]-1,0)).replace(/[^\t]/g," "),A=m[1]||1;E=[`
|
| 19 |
+
`,o.gutter(y.replace(/\d/g," "))," ",g,o.marker("^").repeat(A)].join(""),h&&u.message&&(E+=" "+o.message(u.message))}return[o.marker(">"),o.gutter(y),c.length>0?` ${c}`:"",E].join("")}else return` ${o.gutter(y)}${c.length>0?` ${c}`:""}`}).join(`
|
| 20 |
+
`);return u.message&&!D&&(d=`${" ".repeat(f+1)}${u.message}
|
| 21 |
+
${d}`),d}async function Ba(e,t){let u=await We(t),r=u.preprocess?await u.preprocess(e,t):e;t.originalText=r;let o;try{o=await u.parse(r,t,t)}catch(n){Ta(n,e)}return{text:r,ast:o}}function Ta(e,t){let{loc:u}=e;if(u){let r=Cn(t,u,{highlightCode:!0});throw e.message+=`
|
| 22 |
+
`+r,e.codeFrame=r,e}throw e}var Fe=Ba;async function hn(e,t,u,r,o){if(u.embeddedLanguageFormatting!=="auto")return;let{printer:n}=u,{embed:a}=n;if(!a)return;if(a.length>2)throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/plugins#optional-embed");let{hasPrettierIgnore:s}=n,{getVisitorKeys:i}=a,D=[];d();let f=e.stack;for(let{print:c,node:p,pathStack:F}of D)try{e.stack=F;let C=await c(l,t,e,u);C&&o.set(p,C)}catch(C){if(globalThis.PRETTIER_DEBUG)throw C}e.stack=f;function l(c,p){return Na(c,p,u,r)}function d(){let{node:c}=e;if(c===null||typeof c!="object"||s?.(e))return;for(let F of i(c))Array.isArray(c[F])?e.each(d,F):e.call(d,F);let p=a(e,u);if(p){if(typeof p=="function"){D.push({print:p,node:c,pathStack:[...e.stack]});return}o.set(c,p)}}}async function Na(e,t,u,r){let o=await se({...u,...t,parentParser:u.parser,originalText:e,cursorOffset:void 0,rangeStart:void 0,rangeEnd:void 0},{passThrough:!0}),{ast:n}=await Fe(e,o),a=await r(n,o);return Qe(a)}function Sa(e,t,u,r){let{originalText:o,[Symbol.for("comments")]:n,locStart:a,locEnd:s,[Symbol.for("printedComments")]:i}=t,{node:D}=e,f=a(D),l=s(D);for(let c of n)a(c)>=f&&s(c)<=l&&i.add(c);let{printPrettierIgnored:d}=t.printer;return d?d(e,t,u,r):o.slice(f,l)}var gn=Sa;async function Ge(e,t){({ast:e}=await xu(e,t));let u=new Map,r=new Fr(e),o=Sr(t),n=new Map;await hn(r,s,t,Ge,n);let a=await yn(r,t,s,void 0,n);if(Nr(t),t.cursorOffset>=0){if(t.nodeAfterCursor&&!t.nodeBeforeCursor)return[ee,a];if(t.nodeBeforeCursor&&!t.nodeAfterCursor)return[a,ee]}return a;function s(D,f){return D===void 0||D===r?i(f):Array.isArray(D)?r.call(()=>i(f),...D):r.call(()=>i(f),D)}function i(D){o(r);let f=r.node;if(f==null)return"";let l=ge(f)&&D===void 0;if(l&&u.has(f))return u.get(f);let d=yn(r,t,s,D,n);return l&&u.set(f,d),d}}function yn(e,t,u,r,o){let{node:n}=e,{printer:a}=t,s;switch(a.hasPrettierIgnore?.(e)?s=gn(e,t,u,r):o.has(n)?s=o.get(n):s=a.print(e,t,u,r),n){case t.cursorNode:s=Ee(s,i=>[ee,i,ee]);break;case t.nodeBeforeCursor:s=Ee(s,i=>[i,ee]);break;case t.nodeAfterCursor:s=Ee(s,i=>[ee,i]);break}return a.printComment&&!a.willPrintOwnComments?.(e,t)&&(s=Tr(e,s,t)),s}async function xu(e,t){let u=e.comments??[];t[Symbol.for("comments")]=u,t[Symbol.for("printedComments")]=new Set,_r(e,t);let{printer:{preprocess:r}}=t;return e=r?await r(e,t):e,{ast:e,comments:u}}function wa(e,t){let{cursorOffset:u,locStart:r,locEnd:o,getVisitorKeys:n}=t,a=c=>r(c)<=u&&o(c)>=u,s=e,i=[e];for(let c of hr(e,{getVisitorKeys:n,filter:a}))i.push(c),s=c;if(gr(s,{getVisitorKeys:n}))return{cursorNode:s};let D,f,l=-1,d=Number.POSITIVE_INFINITY;for(;i.length>0&&(D===void 0||f===void 0);){s=i.pop();let c=D!==void 0,p=f!==void 0;for(let F of be(s,{getVisitorKeys:n})){if(!c){let C=o(F);C<=u&&C>l&&(D=F,l=C)}if(!p){let C=r(F);C>=u&&C<d&&(f=F,d=C)}}}return{nodeBeforeCursor:D,nodeAfterCursor:f}}var Bu=wa;function Oa(e,t){let{printer:u}=t,r=u.massageAstNode;if(!r)return e;let{getVisitorKeys:o}=u,{ignoredProperties:n}=r;return a(e);function a(s,i){if(!ge(s))return s;if(Array.isArray(s))return s.map(d=>a(d,i)).filter(Boolean);let D={},f=new Set(o(s));for(let d in s)!Object.prototype.hasOwnProperty.call(s,d)||n?.has(d)||(f.has(d)?D[d]=a(s[d],s):D[d]=s[d]);let l=r(s,D,i);if(l!==null)return l??D}}var bn=Oa;var Pa=Array.prototype.findLastIndex??function(e){for(let t=this.length-1;t>=0;t--){let u=this[t];if(e(u,t,this))return t}return-1},Ia=X("findLastIndex",function(){if(Array.isArray(this))return Pa}),An=Ia;var ka=({parser:e})=>e==="json"||e==="json5"||e==="jsonc"||e==="json-stringify";function va(e,t){return t=new Set(t),e.find(u=>Bn.has(u.type)&&t.has(u))}function _n(e){let t=An(0,e,u=>u.type!=="Program"&&u.type!=="File");return t===-1?e:e.slice(0,t+1)}function Ra(e,t,{locStart:u,locEnd:r}){let[o,...n]=e,[a,...s]=t;if(o===a)return[o,a];let i=u(o);for(let f of _n(s))if(u(f)>=i)a=f;else break;let D=r(a);for(let f of _n(n)){if(r(f)<=D)o=f;else break;if(o===a)break}return[o,a]}function Tu(e,t,u,r,o=[],n){let{locStart:a,locEnd:s}=u,i=a(e),D=s(e);if(t>D||t<i||n==="rangeEnd"&&t===i||n==="rangeStart"&&t===D)return;let f=[e,...o],l=it(e,f,{cache:uu,locStart:a,locEnd:s,getVisitorKeys:u.getVisitorKeys,filter:u.printer.canAttachComment,getChildren:u.printer.getCommentChildNodes});for(let d of l){let c=Tu(d,t,u,r,f,n);if(c)return c}if(r(e,o[0]))return f}function La(e,t){return t!=="DeclareExportDeclaration"&&e!=="TypeParameterDeclaration"&&(e==="Directive"||e==="TypeAlias"||e==="TSExportAssignment"||e.startsWith("Declare")||e.startsWith("TSDeclare")||e.endsWith("Statement")||e.endsWith("Declaration"))}var Bn=new Set(["JsonRoot","ObjectExpression","ArrayExpression","StringLiteral","NumericLiteral","BooleanLiteral","NullLiteral","UnaryExpression","TemplateLiteral"]),Ma=new Set(["OperationDefinition","FragmentDefinition","VariableDefinition","TypeExtensionDefinition","ObjectTypeDefinition","FieldDefinition","DirectiveDefinition","EnumTypeDefinition","EnumValueDefinition","InputValueDefinition","InputObjectTypeDefinition","SchemaDefinition","OperationTypeDefinition","InterfaceTypeDefinition","UnionTypeDefinition","ScalarTypeDefinition"]);function xn(e,t,u){if(!t)return!1;switch(e.parser){case"flow":case"hermes":case"babel":case"babel-flow":case"babel-ts":case"typescript":case"acorn":case"espree":case"meriyah":case"oxc":case"oxc-ts":case"__babel_estree":return La(t.type,u?.type);case"json":case"json5":case"jsonc":case"json-stringify":return Bn.has(t.type);case"graphql":return Ma.has(t.kind);case"vue":return t.tag!=="root"}return!1}function Tn(e,t,u){let{rangeStart:r,rangeEnd:o,locStart:n,locEnd:a}=t;P(o>r);let s=e.slice(r,o).search(/\S/u),i=s===-1;if(!i)for(r+=s;o>r&&!/\S/u.test(e[o-1]);--o);let D=Tu(u,r,t,(c,p)=>xn(t,c,p),[],"rangeStart");if(!D)return;let f=i?D:Tu(u,o,t,c=>xn(t,c),[],"rangeEnd");if(!f)return;let l,d;if(ka(t)){let c=va(D,f);l=c,d=c}else[l,d]=Ra(D,f,t);return[Math.min(n(l),n(d)),Math.max(a(l),a(d))]}var On="\uFEFF",Nn=Symbol("cursor");async function Pn(e,t,u=0){if(!e||e.trim().length===0)return{formatted:"",cursorOffset:-1,comments:[]};let{ast:r,text:o}=await Fe(e,t);t.cursorOffset>=0&&(t={...t,...Bu(r,t)});let n=await Ge(r,t,u);u>0&&(n=ut([V,n],u,t.tabWidth));let a=Ce(n,t);if(u>0){let i=a.formatted.trim();a.cursorNodeStart!==void 0&&(a.cursorNodeStart-=a.formatted.indexOf(i),a.cursorNodeStart<0&&(a.cursorNodeStart=0,a.cursorNodeText=a.cursorNodeText.trimStart()),a.cursorNodeStart+a.cursorNodeText.length>i.length&&(a.cursorNodeText=a.cursorNodeText.trimEnd())),a.formatted=i+Se(t.endOfLine)}let s=t[Symbol.for("comments")];if(t.cursorOffset>=0){let i,D,f,l;if((t.cursorNode||t.nodeBeforeCursor||t.nodeAfterCursor)&&a.cursorNodeText)if(f=a.cursorNodeStart,l=a.cursorNodeText,t.cursorNode)i=t.locStart(t.cursorNode),D=o.slice(i,t.locEnd(t.cursorNode));else{if(!t.nodeBeforeCursor&&!t.nodeAfterCursor)throw new Error("Cursor location must contain at least one of cursorNode, nodeBeforeCursor, nodeAfterCursor");i=t.nodeBeforeCursor?t.locEnd(t.nodeBeforeCursor):0;let y=t.nodeAfterCursor?t.locStart(t.nodeAfterCursor):o.length;D=o.slice(i,y)}else i=0,D=o,f=0,l=a.formatted;let d=t.cursorOffset-i;if(D===l)return{formatted:a.formatted,cursorOffset:f+d,comments:s};let c=D.split("");c.splice(d,0,Nn);let p=l.split(""),F=Ut(c,p),C=f;for(let y of F)if(y.removed){if(y.value.includes(Nn))break}else C+=y.count;return{formatted:a.formatted,cursorOffset:C,comments:s}}return{formatted:a.formatted,cursorOffset:-1,comments:s}}async function Ya(e,t){let{ast:u,text:r}=await Fe(e,t),[o,n]=Tn(r,t,u)??[0,0],a=r.slice(o,n),s=Math.min(o,r.lastIndexOf(`
|
| 23 |
+
`,o)+1),i=r.slice(s,o).match(/^\s*/u)[0],D=he(i,t.tabWidth),f=await Pn(a,{...t,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:t.cursorOffset>o&&t.cursorOffset<=n?t.cursorOffset-o:-1,endOfLine:"lf"},D),l=f.formatted.trimEnd(),{cursorOffset:d}=t;d>n?d+=l.length-a.length:f.cursorOffset>=0&&(d=f.cursorOffset+o);let c=r.slice(0,o)+l+r.slice(n);if(t.endOfLine!=="lf"){let p=Se(t.endOfLine);d>=0&&p===`\r
|
| 24 |
+
`&&(d+=$t(c.slice(0,d),`
|
| 25 |
+
`)),c=oe(0,c,`
|
| 26 |
+
`,p)}return{formatted:c,cursorOffset:d,comments:f.comments}}function Nu(e,t,u){return typeof t!="number"||Number.isNaN(t)||t<0||t>e.length?u:t}function Sn(e,t){let{cursorOffset:u,rangeStart:r,rangeEnd:o}=t;return u=Nu(e,u,-1),r=Nu(e,r,0),o=Nu(e,o,e.length),{...t,cursorOffset:u,rangeStart:r,rangeEnd:o}}function In(e,t){let{cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n}=Sn(e,t),a=e.charAt(0)===On;if(a&&(e=e.slice(1),u--,r--,o--),n==="auto"&&(n=ju(e)),e.includes("\r")){let s=i=>$t(e.slice(0,Math.max(i,0)),`\r
|
| 27 |
+
`);u-=s(u),r-=s(r),o-=s(o),e=Uu(e)}return{hasBOM:a,text:e,options:Sn(e,{...t,cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n})}}async function wn(e,t){let u=await We(t);return!u.hasPragma||u.hasPragma(e)}async function ja(e,t){return(await We(t)).hasIgnorePragma?.(e)}async function Su(e,t){let{hasBOM:u,text:r,options:o}=In(e,await se(t));if(o.rangeStart>=o.rangeEnd&&r!==""||o.requirePragma&&!await wn(r,o)||o.checkIgnorePragma&&await ja(r,o))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let n;return o.rangeStart>0||o.rangeEnd<r.length?n=await Ya(r,o):(!o.requirePragma&&o.insertPragma&&o.printer.insertPragma&&!await wn(r,o)&&(r=o.printer.insertPragma(r)),n=await Pn(r,o)),u&&(n.formatted=On+n.formatted,n.cursorOffset>=0&&n.cursorOffset++),n}async function kn(e,t,u){let{text:r,options:o}=In(e,await se(t)),n=await Fe(r,o);return u&&(u.preprocessForPrint&&(n.ast=await xu(n.ast,o)),u.massage&&(n.ast=bn(n.ast,o))),n}async function vn(e,t){t=await se(t);let u=await Ge(e,t);return Ce(u,t)}async function Rn(e,t){let u=Dr(e),{formatted:r}=await Su(u,{...t,parser:"__js_expression"});return r}async function Ln(e,t){t=await se(t);let{ast:u}=await Fe(e,t);return t.cursorOffset>=0&&(t={...t,...Bu(u,t)}),Ge(u,t)}async function Mn(e,t){return Ce(e,await se(t))}var wu={};Yt(wu,{builders:()=>Wa,printer:()=>$a,utils:()=>Va});var Wa={join:Ie,line:rt,softline:ar,hardline:V,literalline:Ze,group:Kt,conditionalGroup:ur,fill:tr,lineSuffix:ve,lineSuffixBoundary:ir,cursor:ee,breakParent:ce,ifBreak:rr,trim:sr,indent:ae,indentIfBreak:nr,align:De,addAlignmentToDoc:ut,markAsRoot:tt,dedentToRoot:Zu,dedent:er,hardlineWithoutBreakParent:ke,literallineWithoutBreakParent:Gt,label:or,concat:e=>e},$a={printDocToString:Ce},Va={willBreak:Gu,traverseDoc:we,findInDoc:qe,mapDoc:Pe,removeLines:Ju,stripTrailingHardline:Qe,replaceEndOfLine:Hu,canBreak:Xu};var Yn="3.8.3";var Pu={};Yt(Pu,{addDanglingComment:()=>ue,addLeadingComment:()=>fe,addTrailingComment:()=>le,getAlignmentSize:()=>he,getIndentSize:()=>jn,getMaxContinuousCount:()=>Un,getNextNonSpaceNonCommentCharacter:()=>Wn,getNextNonSpaceNonCommentCharacterIndex:()=>ni,getPreferredQuote:()=>Kn,getStringWidth:()=>Re,hasNewline:()=>z,hasNewlineInRange:()=>Gn,hasSpaces:()=>zn,isNextLineEmpty:()=>Di,isNextLineEmptyAfterIndex:()=>vt,isPreviousLineEmpty:()=>ai,makeString:()=>si,skip:()=>ye,skipEverythingButNewLine:()=>at,skipInlineComment:()=>xe,skipNewline:()=>K,skipSpaces:()=>Y,skipToLineEnd:()=>ot,skipTrailingComment:()=>Be,skipWhitespace:()=>mr});function Ka(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let u=t+2;u<e.length;++u)if(e.charAt(u)==="*"&&e.charAt(u+1)==="/")return u+2}return t}var xe=Ka;function Ga(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?at(e,t):t}var Be=Ga;function za(e,t){let u=null,r=t;for(;r!==u;)u=r,r=Y(e,r),r=xe(e,r),r=Be(e,r),r=K(e,r);return r}var ze=za;function Ja(e,t){let u=null,r=t;for(;r!==u;)u=r,r=ot(e,r),r=xe(e,r),r=Y(e,r);return r=Be(e,r),r=K(e,r),r!==!1&&z(e,r)}var vt=Ja;function Ha(e,t){let u=e.lastIndexOf(`
|
| 28 |
+
`);return u===-1?0:he(e.slice(u+1).match(/^[\t ]*/u)[0],t)}var jn=Ha;function Ou(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Xa(e,t){let u=e.matchAll(new RegExp(`(?:${Ou(t)})+`,"gu"));return u.reduce||(u=[...u]),u.reduce((r,[o])=>Math.max(r,o.length),0)/t.length}var Un=Xa;function qa(e,t){let u=ze(e,t);return u===!1?"":e.charAt(u)}var Wn=qa;var $n=Object.freeze({character:"'",codePoint:39}),Vn=Object.freeze({character:'"',codePoint:34}),Qa=Object.freeze({preferred:$n,alternate:Vn}),Za=Object.freeze({preferred:Vn,alternate:$n});function ei(e,t){let{preferred:u,alternate:r}=t===!0||t==="'"?Qa:Za,{length:o}=e,n=0,a=0;for(let s=0;s<o;s++){let i=e.charCodeAt(s);i===u.codePoint?n++:i===r.codePoint&&a++}return(n>a?r:u).character}var Kn=ei;function ti(e,t,u){for(let r=t;r<u;++r)if(e.charAt(r)===`
|
| 29 |
+
`)return!0;return!1}var Gn=ti;function ui(e,t,u={}){return Y(e,u.backwards?t-1:t,u)!==t}var zn=ui;function ri(e,t,u){return ze(e,u(t))}function ni(e,t){return arguments.length===2||typeof t=="number"?ze(e,t):ri(...arguments)}function oi(e,t,u){return Le(e,u(t))}function ai(e,t){return arguments.length===2||typeof t=="number"?Le(e,t):oi(...arguments)}function ii(e,t,u){return vt(e,u(t))}function si(e,t,u){let r=t==='"'?"'":'"',n=oe(0,e,/\\(.)|(["'])/gsu,(a,s,i)=>s===r?s:i===t?"\\"+i:i||(u&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(s)?s:"\\"+s));return t+n+t}function Di(e,t){return arguments.length===2||typeof t=="number"?vt(e,t):ii(...arguments)}function me(e,t=1){return async(...u)=>{let r=u[t]??{},o=r.plugins??[];return u[t]={...r,plugins:Array.isArray(o)?o:Object.values(o)},e(...u)}}var Jn=me(Su);async function Hn(e,t){let{formatted:u}=await Jn(e,{...t,cursorOffset:-1});return u}async function ci(e,t){return await Hn(e,t)===e}var fi=me(st,0),li={parse:me(kn),formatAST:me(vn),formatDoc:me(Rn),printToDoc:me(Ln),printDocToString:me(Mn)};return ao(di);});
|
shared/node_modules/prettier/standalone.mjs
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
var Zn=Object.create;var Mt=Object.defineProperty;var eo=Object.getOwnPropertyDescriptor;var to=Object.getOwnPropertyNames;var uo=Object.getPrototypeOf,ro=Object.prototype.hasOwnProperty;var no=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Yt=(e,t)=>{for(var u in t)Mt(e,u,{get:t[u],enumerable:!0})},oo=(e,t,u,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of to(t))!ro.call(e,o)&&o!==u&&Mt(e,o,{get:()=>t[o],enumerable:!(r=eo(t,o))||r.enumerable});return e};var ao=(e,t,u)=>(u=e!=null?Zn(uo(e)):{},oo(t||!e||!e.__esModule?Mt(u,"default",{value:e,enumerable:!0}):u,e));var dn=no((of,ln)=>{var yt,bt,At,_t,xt,$e,bu,Ke,Bt,cn,Tt,Ve,Nt,St,wt,pe,fn,Ot,Pt,Aa;Nt=/\/(?![*\/])(?:\[(?:[^\]\\\n\r\u2028\u2029]+|\\.)*\]|[^\/\\\n\r\u2028\u2029]+|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/yu;Ve=/--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y;yt=/(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]+|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/yu;wt=/(['"])(?:[^'"\\\n\r]+|(?!\1)['"]|\\(?:\r\n|[^]))*(\1)?/y;Tt=/(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y;pe=/[`}](?:[^`\\$]+|\\[^]|\$(?!\{))*(`|\$\{)?/y;Pt=/[\t\v\f\ufeff\p{Zs}]+/yu;Ke=/\r?\n|[\r\u2028\u2029]/y;Bt=/\/\*(?:[^*]+|\*(?!\/))*(\*\/)?/y;St=/\/\/.*/y;At=/[<>.:={}]|\/(?![\/*])/y;bt=/[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/yu;_t=/(['"])(?:[^'"]+|(?!\1)['"])*(\1)?/y;xt=/[^<>{}]+/y;Ot=/^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/;fn=/^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/;$e=/^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;bu=/^(?:return|throw|yield)$/;cn=RegExp(Ke.source);ln.exports=Aa=function*(e,{jsx:t=!1}={}){var u,r,o,n,a,s,i,D,f,l,d,c,p,F;for({length:s}=e,n=0,a="",F=[{tag:"JS"}],u=[],d=0,c=!1;n<s;){switch(D=F[F.length-1],D.tag){case"JS":case"JSNonExpressionParen":case"InterpolationInTemplate":case"InterpolationInJSX":if(e[n]==="/"&&(Ot.test(a)||$e.test(a))&&(Nt.lastIndex=n,i=Nt.exec(e))){n=Nt.lastIndex,a=i[0],c=!0,yield{type:"RegularExpressionLiteral",value:i[0],closed:i[1]!==void 0&&i[1]!=="\\"};continue}if(Ve.lastIndex=n,i=Ve.exec(e)){switch(p=i[0],f=Ve.lastIndex,l=p,p){case"(":a==="?NonExpressionParenKeyword"&&F.push({tag:"JSNonExpressionParen",nesting:d}),d++,c=!1;break;case")":d--,c=!0,D.tag==="JSNonExpressionParen"&&d===D.nesting&&(F.pop(),l="?NonExpressionParenEnd",c=!1);break;case"{":Ve.lastIndex=0,o=!fn.test(a)&&(Ot.test(a)||$e.test(a)),u.push(o),c=!1;break;case"}":switch(D.tag){case"InterpolationInTemplate":if(u.length===D.nesting){pe.lastIndex=n,i=pe.exec(e),n=pe.lastIndex,a=i[0],i[1]==="${"?(a="?InterpolationInTemplate",c=!1,yield{type:"TemplateMiddle",value:i[0]}):(F.pop(),c=!0,yield{type:"TemplateTail",value:i[0],closed:i[1]==="`"});continue}break;case"InterpolationInJSX":if(u.length===D.nesting){F.pop(),n+=1,a="}",yield{type:"JSXPunctuator",value:"}"};continue}}c=u.pop(),l=c?"?ExpressionBraceEnd":"}";break;case"]":c=!0;break;case"++":case"--":l=c?"?PostfixIncDec":"?UnaryIncDec";break;case"<":if(t&&(Ot.test(a)||$e.test(a))){F.push({tag:"JSXTag"}),n+=1,a="<",yield{type:"JSXPunctuator",value:p};continue}c=!1;break;default:c=!1}n=f,a=l,yield{type:"Punctuator",value:p};continue}if(yt.lastIndex=n,i=yt.exec(e)){switch(n=yt.lastIndex,l=i[0],i[0]){case"for":case"if":case"while":case"with":a!=="."&&a!=="?."&&(l="?NonExpressionParenKeyword")}a=l,c=!$e.test(i[0]),yield{type:i[1]==="#"?"PrivateIdentifier":"IdentifierName",value:i[0]};continue}if(wt.lastIndex=n,i=wt.exec(e)){n=wt.lastIndex,a=i[0],c=!0,yield{type:"StringLiteral",value:i[0],closed:i[2]!==void 0};continue}if(Tt.lastIndex=n,i=Tt.exec(e)){n=Tt.lastIndex,a=i[0],c=!0,yield{type:"NumericLiteral",value:i[0]};continue}if(pe.lastIndex=n,i=pe.exec(e)){n=pe.lastIndex,a=i[0],i[1]==="${"?(a="?InterpolationInTemplate",F.push({tag:"InterpolationInTemplate",nesting:u.length}),c=!1,yield{type:"TemplateHead",value:i[0]}):(c=!0,yield{type:"NoSubstitutionTemplate",value:i[0],closed:i[1]==="`"});continue}break;case"JSXTag":case"JSXTagEnd":if(At.lastIndex=n,i=At.exec(e)){switch(n=At.lastIndex,l=i[0],i[0]){case"<":F.push({tag:"JSXTag"});break;case">":F.pop(),a==="/"||D.tag==="JSXTagEnd"?(l="?JSX",c=!0):F.push({tag:"JSXChildren"});break;case"{":F.push({tag:"InterpolationInJSX",nesting:u.length}),l="?InterpolationInJSX",c=!1;break;case"/":a==="<"&&(F.pop(),F[F.length-1].tag==="JSXChildren"&&F.pop(),F.push({tag:"JSXTagEnd"}))}a=l,yield{type:"JSXPunctuator",value:i[0]};continue}if(bt.lastIndex=n,i=bt.exec(e)){n=bt.lastIndex,a=i[0],yield{type:"JSXIdentifier",value:i[0]};continue}if(_t.lastIndex=n,i=_t.exec(e)){n=_t.lastIndex,a=i[0],yield{type:"JSXString",value:i[0],closed:i[2]!==void 0};continue}break;case"JSXChildren":if(xt.lastIndex=n,i=xt.exec(e)){n=xt.lastIndex,a=i[0],yield{type:"JSXText",value:i[0]};continue}switch(e[n]){case"<":F.push({tag:"JSXTag"}),n++,a="<",yield{type:"JSXPunctuator",value:"<"};continue;case"{":F.push({tag:"InterpolationInJSX",nesting:u.length}),n++,a="?InterpolationInJSX",c=!1,yield{type:"JSXPunctuator",value:"{"};continue}}if(Pt.lastIndex=n,i=Pt.exec(e)){n=Pt.lastIndex,yield{type:"WhiteSpace",value:i[0]};continue}if(Ke.lastIndex=n,i=Ke.exec(e)){n=Ke.lastIndex,c=!1,bu.test(a)&&(a="?NoLineTerminatorHere"),yield{type:"LineTerminatorSequence",value:i[0]};continue}if(Bt.lastIndex=n,i=Bt.exec(e)){n=Bt.lastIndex,cn.test(i[0])&&(c=!1,bu.test(a)&&(a="?NoLineTerminatorHere")),yield{type:"MultiLineComment",value:i[0],closed:i[1]!==void 0};continue}if(St.lastIndex=n,i=St.exec(e)){n=St.lastIndex,c=!1,yield{type:"SingleLineComment",value:i[0]};continue}r=String.fromCodePoint(e.codePointAt(n)),n+=r.length,a=r,c=!1,yield{type:D.tag.startsWith("JSX")?"JSXInvalid":"Invalid",value:r}}}});var Hn={};Yt(Hn,{__debug:()=>li,check:()=>ci,doc:()=>wu,format:()=>Jn,formatWithCursor:()=>zn,getSupportInfo:()=>fi,util:()=>Pu,version:()=>Mn});var X=(e,t)=>(u,r,...o)=>u|1&&r==null?void 0:(t.call(r)??r[e]).apply(r,o);var io=String.prototype.replaceAll??function(e,t){return e.global?this.replace(e,t):this.split(e).join(t)},so=X("replaceAll",function(){if(typeof this=="string")return io}),oe=so;var Ne=class{diff(t,u,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);let n=this.castInput(t,r),a=this.castInput(u,r),s=this.removeEmpty(this.tokenize(n,r)),i=this.removeEmpty(this.tokenize(a,r));return this.diffWithOptionsObj(s,i,r,o)}diffWithOptionsObj(t,u,r,o){var n;let a=m=>{if(m=this.postProcess(m,r),o){setTimeout(function(){o(m)},0);return}else return m},s=u.length,i=t.length,D=1,f=s+i;r.maxEditLength!=null&&(f=Math.min(f,r.maxEditLength));let l=(n=r.timeout)!==null&&n!==void 0?n:1/0,d=Date.now()+l,c=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(c[0],u,t,0,r);if(c[0].oldPos+1>=i&&p+1>=s)return a(this.buildValues(c[0].lastComponent,u,t));let F=-1/0,C=1/0,y=()=>{for(let m=Math.max(F,-D);m<=Math.min(C,D);m+=2){let h,E=c[m-1],g=c[m+1];E&&(c[m-1]=void 0);let A=!1;if(g){let Q=g.oldPos-m;A=g&&0<=Q&&Q<s}let J=E&&E.oldPos+1<i;if(!A&&!J){c[m]=void 0;continue}if(!J||A&&E.oldPos<g.oldPos?h=this.addToPath(g,!0,!1,0,r):h=this.addToPath(E,!1,!0,1,r),p=this.extractCommon(h,u,t,m,r),h.oldPos+1>=i&&p+1>=s)return a(this.buildValues(h.lastComponent,u,t))||!0;c[m]=h,h.oldPos+1>=i&&(C=Math.min(C,m-1)),p+1>=s&&(F=Math.max(F,m+1))}D++};if(o)(function m(){setTimeout(function(){if(D>f||Date.now()>d)return o(void 0);y()||m()},0)})();else for(;D<=f&&Date.now()<=d;){let m=y();if(m)return m}}addToPath(t,u,r,o,n){let a=t.lastComponent;return a&&!n.oneChangePerToken&&a.added===u&&a.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:a.count+1,added:u,removed:r,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:u,removed:r,previousComponent:a}}}extractCommon(t,u,r,o,n){let a=u.length,s=r.length,i=t.oldPos,D=i-o,f=0;for(;D+1<a&&i+1<s&&this.equals(r[i+1],u[D+1],n);)D++,i++,f++,n.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return f&&!n.oneChangePerToken&&(t.lastComponent={count:f,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=i,D}equals(t,u,r){return r.comparator?r.comparator(t,u):t===u||!!r.ignoreCase&&t.toLowerCase()===u.toLowerCase()}removeEmpty(t){let u=[];for(let r=0;r<t.length;r++)t[r]&&u.push(t[r]);return u}castInput(t,u){return t}tokenize(t,u){return Array.from(t)}join(t){return t.join("")}postProcess(t,u){return t}get useLongestToken(){return!1}buildValues(t,u,r){let o=[],n;for(;t;)o.push(t),n=t.previousComponent,delete t.previousComponent,t=n;o.reverse();let a=o.length,s=0,i=0,D=0;for(;s<a;s++){let f=o[s];if(f.removed)f.value=this.join(r.slice(D,D+f.count)),D+=f.count;else{if(!f.added&&this.useLongestToken){let l=u.slice(i,i+f.count);l=l.map(function(d,c){let p=r[D+c];return p.length>d.length?p:d}),f.value=this.join(l)}else f.value=this.join(u.slice(i,i+f.count));i+=f.count,f.added||(D+=f.count)}}return o}};var jt=class extends Ne{tokenize(t){return t.slice()}join(t){return t}removeEmpty(t){return t}},ku=new jt;function Ut(e,t,u){return ku.diff(e,t,u)}var Do=()=>{},P=Do;var Ru="cr",Lu="crlf",co="lf",fo=co,Wt="\r",Mu=`\r
|
| 2 |
+
`,Je=`
|
| 3 |
+
`,lo=Je;function Yu(e){let t=e.indexOf(Wt);return t!==-1?e.charAt(t+1)===Je?Lu:Ru:fo}function Se(e){return e===Ru?Wt:e===Lu?Mu:lo}var po=new Map([[Je,/\n/gu],[Wt,/\r/gu],[Mu,/\r\n/gu]]);function $t(e,t){let u=po.get(t);return e.match(u)?.length??0}var Fo=/\r\n?/gu;function ju(e){return oe(0,e,Fo,Je)}function mo(e){return this[e<0?this.length+e:e]}var Eo=X("at",function(){if(Array.isArray(this)||typeof this=="string")return mo}),b=Eo;var G="string",j="array",U="cursor",I="indent",k="align",v="trim",x="group",w="fill",B="if-break",R="indent-if-break",L="line-suffix",M="line-suffix-boundary",_="line",O="label",T="break-parent",He=new Set([U,I,k,v,x,w,B,R,L,M,_,O,T]);function Uu(e){let t=e.length;for(;t>0&&(e[t-1]==="\r"||e[t-1]===`
|
| 4 |
+
`);)t--;return t<e.length?e.slice(0,t):e}function Co(e){if(typeof e=="string")return G;if(Array.isArray(e))return j;if(!e)return;let{type:t}=e;if(He.has(t))return t}var H=Co;var ho=e=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(e);function go(e){let t=e===null?"null":typeof e;if(t!=="string"&&t!=="object")return`Unexpected doc '${t}',
|
| 5 |
+
Expected it to be 'string' or 'object'.`;if(H(e))throw new Error("doc is valid.");let u=Object.prototype.toString.call(e);if(u!=="[object Object]")return`Unexpected doc '${u}'.`;let r=ho([...He].map(o=>`'${o}'`));return`Unexpected doc.type '${e.type}'.
|
| 6 |
+
Expected it to be ${r}.`}var Vt=class extends Error{name="InvalidDocError";constructor(t){super(go(t)),this.doc=t}},Z=Vt;var Wu={};function yo(e,t,u,r){let o=[e];for(;o.length>0;){let n=o.pop();if(n===Wu){u(o.pop());continue}u&&o.push(n,Wu);let a=H(n);if(!a)throw new Z(n);if(t?.(n)!==!1)switch(a){case j:case w:{let s=a===j?n:n.parts;for(let i=s.length,D=i-1;D>=0;--D)o.push(s[D]);break}case B:o.push(n.flatContents,n.breakContents);break;case x:if(r&&n.expandedStates)for(let s=n.expandedStates.length,i=s-1;i>=0;--i)o.push(n.expandedStates[i]);else o.push(n.contents);break;case k:case I:case R:case O:case L:o.push(n.contents);break;case G:case U:case v:case M:case _:case T:break;default:throw new Z(n)}}}var we=yo;function Pe(e,t){if(typeof e=="string")return t(e);let u=new Map;return r(e);function r(n){if(u.has(n))return u.get(n);let a=o(n);return u.set(n,a),a}function o(n){switch(H(n)){case j:return t(n.map(r));case w:return t({...n,parts:n.parts.map(r)});case B:return t({...n,breakContents:r(n.breakContents),flatContents:r(n.flatContents)});case x:{let{expandedStates:a,contents:s}=n;return a?(a=a.map(r),s=a[0]):s=r(s),t({...n,contents:s,expandedStates:a})}case k:case I:case R:case O:case L:return t({...n,contents:r(n.contents)});case G:case U:case v:case M:case _:case T:return t(n);default:throw new Z(n)}}}function Xe(e,t,u){let r=u,o=!1;function n(a){if(o)return!1;let s=t(a);s!==void 0&&(o=!0,r=s)}return we(e,n),r}function bo(e){if(e.type===x&&e.break||e.type===_&&e.hard||e.type===T)return!0}function Ku(e){return Xe(e,bo,!1)}function $u(e){if(e.length>0){let t=b(0,e,-1);!t.expandedStates&&!t.break&&(t.break="propagated")}return null}function Gu(e){let t=new Set,u=[];function r(n){if(n.type===T&&$u(u),n.type===x){if(u.push(n),t.has(n))return!1;t.add(n)}}function o(n){n.type===x&&u.pop().break&&$u(u)}we(e,r,o,!0)}function Ao(e){return e.type===_&&!e.hard?e.soft?"":" ":e.type===B?e.flatContents:e}function zu(e){return Pe(e,Ao)}function Vu(e){for(e=[...e];e.length>=2&&b(0,e,-2).type===_&&b(0,e,-1).type===T;)e.length-=2;if(e.length>0){let t=Oe(b(0,e,-1));e[e.length-1]=t}return e}function Oe(e){switch(H(e)){case I:case R:case x:case L:case O:{let t=Oe(e.contents);return{...e,contents:t}}case B:return{...e,breakContents:Oe(e.breakContents),flatContents:Oe(e.flatContents)};case w:return{...e,parts:Vu(e.parts)};case j:return Vu(e);case G:return Uu(e);case k:case U:case v:case M:case _:case T:break;default:throw new Z(e)}return e}function qe(e){return Oe(xo(e))}function _o(e){switch(H(e)){case w:if(e.parts.every(t=>t===""))return"";break;case x:if(!e.contents&&!e.id&&!e.break&&!e.expandedStates)return"";if(e.contents.type===x&&e.contents.id===e.id&&e.contents.break===e.break&&e.contents.expandedStates===e.expandedStates)return e.contents;break;case k:case I:case R:case L:if(!e.contents)return"";break;case B:if(!e.flatContents&&!e.breakContents)return"";break;case j:{let t=[];for(let u of e){if(!u)continue;let[r,...o]=Array.isArray(u)?u:[u];typeof r=="string"&&typeof b(0,t,-1)=="string"?t[t.length-1]+=r:t.push(r),t.push(...o)}return t.length===0?"":t.length===1?t[0]:t}case G:case U:case v:case M:case _:case O:case T:break;default:throw new Z(e)}return e}function xo(e){return Pe(e,t=>_o(t))}function Ju(e,t=Qe){return Pe(e,u=>typeof u=="string"?Ie(t,u.split(`
|
| 7 |
+
`)):u)}function Bo(e){if(e.type===_)return!0}function Hu(e){return Xe(e,Bo,!1)}function Ee(e,t){return e.type===O?{...e,contents:t(e.contents)}:t(e)}var N=P,Ze=P,Xu=P,qu=P;function ae(e){return N(e),{type:I,contents:e}}function De(e,t){return qu(e),N(t),{type:k,contents:t,n:e}}function Qu(e){return De(Number.NEGATIVE_INFINITY,e)}function et(e){return De({type:"root"},e)}function Zu(e){return De(-1,e)}function tt(e,t,u){N(e);let r=e;if(t>0){for(let o=0;o<Math.floor(t/u);++o)r=ae(r);r=De(t%u,r),r=De(Number.NEGATIVE_INFINITY,r)}return r}var ce={type:T};var ee={type:U};function er(e){return Xu(e),{type:w,parts:e}}function Kt(e,t={}){return N(e),Ze(t.expandedStates,!0),{type:x,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function tr(e,t){return Kt(e[0],{...t,expandedStates:e})}function ur(e,t="",u={}){return N(e),t!==""&&N(t),{type:B,breakContents:e,flatContents:t,groupId:u.groupId}}function rr(e,t){return N(e),{type:R,contents:e,groupId:t.groupId,negate:t.negate}}function Ie(e,t){N(e),Ze(t);let u=[];for(let r=0;r<t.length;r++)r!==0&&u.push(e),u.push(t[r]);return u}function nr(e,t){return N(t),e?{type:O,label:e,contents:t}:t}var ut={type:_},or={type:_,soft:!0},ke={type:_,hard:!0},V=[ke,ce],Gt={type:_,hard:!0,literal:!0},Qe=[Gt,ce];function ve(e){return N(e),{type:L,contents:e}}var ar={type:M};var ir={type:v};function te(e){if(!e)return"";if(Array.isArray(e)){let t=[];for(let u of e)if(Array.isArray(u))t.push(...te(u));else{let r=te(u);r!==""&&t.push(r)}return t}return e.type===B?{...e,breakContents:te(e.breakContents),flatContents:te(e.flatContents)}:e.type===x?{...e,contents:te(e.contents),expandedStates:e.expandedStates?.map(te)}:e.type===w?{type:"fill",parts:e.parts.map(te)}:e.contents?{...e,contents:te(e.contents)}:e}function sr(e){let t=Object.create(null),u=new Set;return r(te(e));function r(n,a,s){if(typeof n=="string")return JSON.stringify(n);if(Array.isArray(n)){let i=n.map(r).filter(Boolean);return i.length===1?i[0]:`[${i.join(", ")}]`}if(n.type===_){let i=s?.[a+1]?.type===T;return n.literal?i?"literalline":"literallineWithoutBreakParent":n.hard?i?"hardline":"hardlineWithoutBreakParent":n.soft?"softline":"line"}if(n.type===T)return s?.[a-1]?.type===_&&s[a-1].hard?void 0:"breakParent";if(n.type===v)return"trim";if(n.type===I)return"indent("+r(n.contents)+")";if(n.type===k)return n.n===Number.NEGATIVE_INFINITY?"dedentToRoot("+r(n.contents)+")":n.n<0?"dedent("+r(n.contents)+")":n.n.type==="root"?"markAsRoot("+r(n.contents)+")":"align("+JSON.stringify(n.n)+", "+r(n.contents)+")";if(n.type===B)return"ifBreak("+r(n.breakContents)+(n.flatContents?", "+r(n.flatContents):"")+(n.groupId?(n.flatContents?"":', ""')+`, { groupId: ${o(n.groupId)} }`:"")+")";if(n.type===R){let i=[];n.negate&&i.push("negate: true"),n.groupId&&i.push(`groupId: ${o(n.groupId)}`);let D=i.length>0?`, { ${i.join(", ")} }`:"";return`indentIfBreak(${r(n.contents)}${D})`}if(n.type===x){let i=[];n.break&&n.break!=="propagated"&&i.push("shouldBreak: true"),n.id&&i.push(`id: ${o(n.id)}`);let D=i.length>0?`, { ${i.join(", ")} }`:"";return n.expandedStates?`conditionalGroup([${n.expandedStates.map(f=>r(f)).join(",")}]${D})`:`group(${r(n.contents)}${D})`}if(n.type===w)return`fill([${n.parts.map(i=>r(i)).join(", ")}])`;if(n.type===L)return"lineSuffix("+r(n.contents)+")";if(n.type===M)return"lineSuffixBoundary";if(n.type===O)return`label(${JSON.stringify(n.label)}, ${r(n.contents)})`;if(n.type===U)return"cursor";throw new Error("Unknown doc type "+n.type)}function o(n){if(typeof n!="symbol")return JSON.stringify(String(n));if(n in t)return t[n];let a=n.description||"symbol";for(let s=0;;s++){let i=a+(s>0?` #${s}`:"");if(!u.has(i))return u.add(i),t[n]=`Symbol.for(${JSON.stringify(i)})`}}}var Dr=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uD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DC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\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-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;function zt(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function Jt(e){return e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9776&&e<=9783||e>=9800&&e<=9811||e===9855||e>=9866&&e<=9871||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e>=94192&&e<=94198||e>=94208&&e<=101589||e>=101631&&e<=101662||e>=101760&&e<=101874||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128728||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129674||e>=129678&&e<=129734||e===129736||e>=129741&&e<=129756||e>=129759&&e<=129770||e>=129775&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}var cr="\xA9\xAE\u203C\u2049\u2122\u2139\u2194\u2195\u2196\u2197\u2198\u2199\u21A9\u21AA\u2328\u23CF\u23F1\u23F2\u23F8\u23F9\u23FA\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600\u2601\u2602\u2603\u2604\u260E\u2611\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638\u2639\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694\u2695\u2696\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F1\u26F7\u26F8\u26F9\u2702\u2708\u2709\u270C\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u2764\u27A1\u2934\u2935\u2B05\u2B06\u2B07";var To=/[^\x20-\x7F]/u,No=new Set(cr);function So(e){if(!e)return 0;if(!To.test(e))return e.length;e=e.replace(Dr(),u=>No.has(u)?" ":" ");let t=0;for(let u of e){let r=u.codePointAt(0);r<=31||r>=127&&r<=159||r>=768&&r<=879||r>=65024&&r<=65039||(t+=zt(r)||Jt(r)?2:1)}return t}var Re=So;var wo={type:0},Oo={type:1},Ht={value:"",length:0,queue:[],get root(){return Ht}};function fr(e,t,u){let r=t.type===1?e.queue.slice(0,-1):[...e.queue,t],o="",n=0,a=0,s=0;for(let p of r)switch(p.type){case 0:f(),u.useTabs?i(1):D(u.tabWidth);break;case 3:{let{string:F}=p;f(),o+=F,n+=F.length;break}case 2:{let{width:F}=p;a+=1,s+=F;break}default:throw new Error(`Unexpected indent comment '${p.type}'.`)}return d(),{...e,value:o,length:n,queue:r};function i(p){o+=" ".repeat(p),n+=u.tabWidth*p}function D(p){o+=" ".repeat(p),n+=p}function f(){u.useTabs?l():d()}function l(){a>0&&i(a),c()}function d(){s>0&&D(s),c()}function c(){a=0,s=0}}function lr(e,t,u){if(!t)return e;if(t.type==="root")return{...e,root:e};if(t===Number.NEGATIVE_INFINITY)return e.root;let r;return typeof t=="number"?t<0?r=Oo:r={type:2,width:t}:r={type:3,string:t},fr(e,r,u)}function dr(e,t){return fr(e,wo,t)}function Po(e){let t=0;for(let u=e.length-1;u>=0;u--){let r=e[u];if(r===" "||r===" ")t++;else break}return t}function Xt(e){let t=Po(e);return{text:t===0?e:e.slice(0,e.length-t),count:t}}var W=Symbol("MODE_BREAK"),q=Symbol("MODE_FLAT"),qt=Symbol("DOC_FILL_PRINTED_LENGTH");function rt(e,t,u,r,o,n){if(u===Number.POSITIVE_INFINITY)return!0;let a=t.length,s=!1,i=[e],D="";for(;u>=0;){if(i.length===0){if(a===0)return!0;i.push(t[--a]);continue}let{mode:f,doc:l}=i.pop(),d=H(l);switch(d){case G:l&&(s&&(D+=" ",u-=1,s=!1),D+=l,u-=Re(l));break;case j:case w:{let c=d===j?l:l.parts,p=l[qt]??0;for(let F=c.length-1;F>=p;F--)i.push({mode:f,doc:c[F]});break}case I:case k:case R:case O:i.push({mode:f,doc:l.contents});break;case v:{let{text:c,count:p}=Xt(D);D=c,u+=p;break}case x:{if(n&&l.break)return!1;let c=l.break?W:f,p=l.expandedStates&&c===W?b(0,l.expandedStates,-1):l.contents;i.push({mode:c,doc:p});break}case B:{let p=(l.groupId?o[l.groupId]||q:f)===W?l.breakContents:l.flatContents;p&&i.push({mode:f,doc:p});break}case _:if(f===W||l.hard)return!0;l.soft||(s=!0);break;case L:r=!0;break;case M:if(r)return!1;break}}return!1}function Ce(e,t){let u=Object.create(null),r=t.printWidth,o=Se(t.endOfLine),n=0,a=[{indent:Ht,mode:W,doc:e}],s="",i=!1,D=[],f=[],l=[],d=[],c=0;for(Gu(e);a.length>0;){let{indent:m,mode:h,doc:E}=a.pop();switch(H(E)){case G:{let g=o!==`
|
| 8 |
+
`?oe(0,E,`
|
| 9 |
+
`,o):E;g&&(s+=g,a.length>0&&(n+=Re(g)));break}case j:for(let g=E.length-1;g>=0;g--)a.push({indent:m,mode:h,doc:E[g]});break;case U:if(f.length>=2)throw new Error("There are too many 'cursor' in doc.");f.push(c+s.length);break;case I:a.push({indent:dr(m,t),mode:h,doc:E.contents});break;case k:a.push({indent:lr(m,E.n,t),mode:h,doc:E.contents});break;case v:y();break;case x:switch(h){case q:if(!i){a.push({indent:m,mode:E.break?W:q,doc:E.contents});break}case W:{i=!1;let g={indent:m,mode:q,doc:E.contents},A=r-n,J=D.length>0;if(!E.break&&rt(g,a,A,J,u))a.push(g);else if(E.expandedStates){let Q=b(0,E.expandedStates,-1);if(E.break){a.push({indent:m,mode:W,doc:Q});break}else for(let re=1;re<E.expandedStates.length+1;re++)if(re>=E.expandedStates.length){a.push({indent:m,mode:W,doc:Q});break}else{let Te=E.expandedStates[re],ne={indent:m,mode:q,doc:Te};if(rt(ne,a,A,J,u)){a.push(ne);break}}}else a.push({indent:m,mode:W,doc:E.contents});break}}E.id&&(u[E.id]=b(0,a,-1).mode);break;case w:{let g=r-n,A=E[qt]??0,{parts:J}=E,Q=J.length-A;if(Q===0)break;let re=J[A+0],Te=J[A+1],ne={indent:m,mode:q,doc:re},vt={indent:m,mode:W,doc:re},Rt=rt(ne,[],g,D.length>0,u,!0);if(Q===1){Rt?a.push(ne):a.push(vt);break}let Iu={indent:m,mode:q,doc:Te},Lt={indent:m,mode:W,doc:Te};if(Q===2){Rt?a.push(Iu,ne):a.push(Lt,vt);break}let Xn=J[A+2],qn={indent:m,mode:h,doc:{...E,[qt]:A+2}},Qn=rt({indent:m,mode:q,doc:[re,Te,Xn]},[],g,D.length>0,u,!0);a.push(qn),Qn?a.push(Iu,ne):Rt?a.push(Lt,ne):a.push(Lt,vt);break}case B:case R:{let g=E.groupId?u[E.groupId]:h;if(g===W){let A=E.type===B?E.breakContents:E.negate?E.contents:ae(E.contents);A&&a.push({indent:m,mode:h,doc:A})}if(g===q){let A=E.type===B?E.flatContents:E.negate?ae(E.contents):E.contents;A&&a.push({indent:m,mode:h,doc:A})}break}case L:D.push({indent:m,mode:h,doc:E.contents});break;case M:D.length>0&&a.push({indent:m,mode:h,doc:ke});break;case _:switch(h){case q:if(E.hard)i=!0;else{E.soft||(s+=" ",n+=1);break}case W:if(D.length>0){a.push({indent:m,mode:h,doc:E},...D.reverse()),D.length=0;break}E.literal?(s+=o,n=0,m.root&&(m.root.value&&(s+=m.root.value),n=m.root.length)):(y(),s+=o+m.value,n=m.length);break}break;case O:a.push({indent:m,mode:h,doc:E.contents});break;case T:break;default:throw new Z(E)}a.length===0&&D.length>0&&(a.push(...D.reverse()),D.length=0)}let p=l.join("")+s,F=[...d,...f];if(F.length!==2)return{formatted:p};let C=F[0];return{formatted:p,cursorNodeStart:C,cursorNodeText:p.slice(C,b(0,F,-1))};function y(){let{text:m,count:h}=Xt(s);m&&(l.push(m),c+=m.length),s="",n-=h,f.length>0&&(d.push(...f.map(E=>Math.min(E,c))),f.length=0)}}function Io(e,t,u=0){let r=0;for(let o=u;o<e.length;++o)e[o]===" "?r=r+t-r%t:r++;return r}var he=Io;var Qt=class{constructor(t){this.stack=[t]}get key(){let{stack:t,siblings:u}=this;return b(0,t,u===null?-2:-4)??null}get index(){return this.siblings===null?null:b(0,this.stack,-2)}get node(){return b(0,this.stack,-1)}get parent(){return this.getNode(1)}get grandparent(){return this.getNode(2)}get isInArray(){return this.siblings!==null}get siblings(){let{stack:t}=this,u=b(0,t,-3);return Array.isArray(u)?u:null}get next(){let{siblings:t}=this;return t===null?null:t[this.index+1]}get previous(){let{siblings:t}=this;return t===null?null:t[this.index-1]}get isFirst(){return this.index===0}get isLast(){let{siblings:t,index:u}=this;return t!==null&&u===t.length-1}get isRoot(){return this.stack.length===1}get root(){return this.stack[0]}get ancestors(){return[...this.#e()]}getName(){let{stack:t}=this,{length:u}=t;return u>1?b(0,t,-2):null}getValue(){return b(0,this.stack,-1)}getNode(t=0){let u=this.#t(t);return u===-1?null:this.stack[u]}getParentNode(t=0){return this.getNode(t+1)}#t(t){let{stack:u}=this;for(let r=u.length-1;r>=0;r-=2)if(!Array.isArray(u[r])&&--t<0)return r;return-1}call(t,...u){let{stack:r}=this,{length:o}=r,n=b(0,r,-1);for(let a of u)n=n?.[a],r.push(a,n);try{return t(this)}finally{r.length=o}}callParent(t,u=0){let r=this.#t(u+1),o=this.stack.splice(r+1);try{return t(this)}finally{this.stack.push(...o)}}each(t,...u){let{stack:r}=this,{length:o}=r,n=b(0,r,-1);for(let a of u)n=n[a],r.push(a,n);try{for(let a=0;a<n.length;++a)r.push(a,n[a]),t(this,a,n),r.length-=2}finally{r.length=o}}map(t,...u){let r=[];return this.each((o,n,a)=>{r[n]=t(o,n,a)},...u),r}match(...t){let u=this.stack.length-1,r=null,o=this.stack[u--];for(let n of t){if(o===void 0)return!1;let a=null;if(typeof r=="number"&&(a=r,r=this.stack[u--],o=this.stack[u--]),n&&!n(o,r,a))return!1;r=this.stack[u--],o=this.stack[u--]}return!0}findAncestor(t){for(let u of this.#e())if(t(u))return u}hasAncestor(t){for(let u of this.#e())if(t(u))return!0;return!1}*#e(){let{stack:t}=this;for(let u=t.length-3;u>=0;u-=2){let r=t[u];Array.isArray(r)||(yield r)}}},pr=Qt;function ko(e){return e!==null&&typeof e=="object"}var ge=ko;function ye(e){return(t,u,r)=>{let o=!!r?.backwards;if(u===!1)return!1;let{length:n}=t,a=u;for(;a>=0&&a<n;){let s=t.charAt(a);if(e instanceof RegExp){if(!e.test(s))return a}else if(!e.includes(s))return a;o?a--:a++}return a===-1||a===n?a:!1}}var Fr=ye(/\s/u),Y=ye(" "),nt=ye(",; "),ot=ye(/[^\n\r]/u);var mr=e=>e===`
|
| 10 |
+
`||e==="\r"||e==="\u2028"||e==="\u2029";function vo(e,t,u){let r=!!u?.backwards;if(t===!1)return!1;let o=e.charAt(t);if(r){if(e.charAt(t-1)==="\r"&&o===`
|
| 11 |
+
`)return t-2;if(mr(o))return t-1}else{if(o==="\r"&&e.charAt(t+1)===`
|
| 12 |
+
`)return t+2;if(mr(o))return t+1}return t}var K=vo;function Ro(e,t,u={}){let r=Y(e,u.backwards?t-1:t,u),o=K(e,r,u);return r!==o}var z=Ro;function Lo(e){return Array.isArray(e)&&e.length>0}var Er=Lo;function*be(e,t){let{getVisitorKeys:u,filter:r=()=>!0}=t,o=n=>ge(n)&&r(n);for(let n of u(e)){let a=e[n];if(Array.isArray(a))for(let s of a)o(s)&&(yield s);else o(a)&&(yield a)}}function*Cr(e,t){let u=[e];for(let r=0;r<u.length;r++){let o=u[r];for(let n of be(o,t))yield n,u.push(n)}}function hr(e,t){return be(e,t).next().done}function gr(e,t,u){let{cache:r}=u;if(r.has(e))return r.get(e);let{filter:o}=u;if(!o)return[];let n,a=(u.getChildren?.(e,u)??[...be(e,{getVisitorKeys:u.getVisitorKeys})]).flatMap(D=>(n??(n=[e,...t]),o(D,n)?[D]:gr(D,n,u))),{locStart:s,locEnd:i}=u;return a.sort((D,f)=>s(D)-s(f)||i(D)-i(f)),r.set(e,a),a}var at=gr;function Mo(e){let t=e.type||e.kind||"(unknown type)",u=String(e.name||e.id&&(typeof e.id=="object"?e.id.name:e.id)||e.key&&(typeof e.key=="object"?e.key.name:e.key)||e.value&&(typeof e.value=="object"?"":String(e.value))||e.operator||"");return u.length>20&&(u=u.slice(0,19)+"\u2026"),t+(u?" "+u:"")}function Zt(e,t){(e.comments??(e.comments=[])).push(t),t.printed=!1,t.nodeDescription=Mo(e)}function fe(e,t){t.leading=!0,t.trailing=!1,Zt(e,t)}function ue(e,t,u){t.leading=!1,t.trailing=!1,u&&(t.marker=u),Zt(e,t)}function le(e,t){t.leading=!1,t.trailing=!0,Zt(e,t)}var uu=new WeakMap;function br(e,t,u,r,o=[]){let{locStart:n,locEnd:a}=u,s=n(t),i=a(t),D=at(e,o,{cache:uu,locStart:n,locEnd:a,getVisitorKeys:u.getVisitorKeys,filter:u.printer.canAttachComment,getChildren:u.printer.getCommentChildNodes}),f,l,d=0,c=D.length;for(;d<c;){let p=d+c>>1,F=D[p],C=n(F),y=a(F);if(C<=s&&i<=y)return br(F,t,u,F,[F,...o]);if(y<=s){f=F,d=p+1;continue}if(i<=C){l=F,c=p;continue}throw new Error("Comment location overlaps with node location")}if(r?.type==="TemplateLiteral"){let{quasis:p}=r,F=tu(p,t,u);f&&tu(p,f,u)!==F&&(f=null),l&&tu(p,l,u)!==F&&(l=null)}return{enclosingNode:r,precedingNode:f,followingNode:l}}var eu=()=>!1;function Ar(e,t){let{comments:u}=e;if(delete e.comments,!Er(u)||!t.printer.canAttachComment)return;let r=[],{printer:{features:{experimental_avoidAstMutation:o},handleComments:n={}},originalText:a}=t,{ownLine:s=eu,endOfLine:i=eu,remaining:D=eu}=n,f=u.map((l,d)=>({...br(e,l,t),comment:l,text:a,options:t,ast:e,isLastComment:u.length-1===d}));for(let[l,d]of f.entries()){let{comment:c,precedingNode:p,enclosingNode:F,followingNode:C,text:y,options:m,ast:h,isLastComment:E}=d,g;if(o?g=[d]:(c.enclosingNode=F,c.precedingNode=p,c.followingNode=C,g=[c,y,m,h,E]),Yo(y,m,f,l))c.placement="ownLine",s(...g)||(C?fe(C,c):p?le(p,c):F?ue(F,c):ue(h,c));else if(jo(y,m,f,l))c.placement="endOfLine",i(...g)||(p?le(p,c):C?fe(C,c):F?ue(F,c):ue(h,c));else if(c.placement="remaining",!D(...g))if(p&&C){let A=r.length;A>0&&r[A-1].followingNode!==C&&yr(r,m),r.push(d)}else p?le(p,c):C?fe(C,c):F?ue(F,c):ue(h,c)}if(yr(r,t),!o)for(let l of u)delete l.precedingNode,delete l.enclosingNode,delete l.followingNode}var _r=e=>!/[\S\n\u2028\u2029]/u.test(e);function Yo(e,t,u,r){let{comment:o,precedingNode:n}=u[r],{locStart:a,locEnd:s}=t,i=a(o);if(n)for(let D=r-1;D>=0;D--){let{comment:f,precedingNode:l}=u[D];if(l!==n||!_r(e.slice(s(f),i)))break;i=a(f)}return z(e,i,{backwards:!0})}function jo(e,t,u,r){let{comment:o,followingNode:n}=u[r],{locStart:a,locEnd:s}=t,i=s(o);if(n)for(let D=r+1;D<u.length;D++){let{comment:f,followingNode:l}=u[D];if(l!==n||!_r(e.slice(i,a(f))))break;i=s(f)}return z(e,i)}function yr(e,t){let u=e.length;if(u===0)return;let{precedingNode:r,followingNode:o}=e[0],n=t.locStart(o),a;for(a=u;a>0;--a){let{comment:s,precedingNode:i,followingNode:D}=e[a-1];P(i,r),P(D,o);let f=t.originalText.slice(t.locEnd(s),n);if(t.printer.isGap?.(f,t)??/^[\s(]*$/u.test(f))n=t.locStart(s);else break}for(let[s,{comment:i}]of e.entries())s<a?le(r,i):fe(o,i);for(let s of[r,o])s.comments&&s.comments.length>1&&s.comments.sort((i,D)=>t.locStart(i)-t.locStart(D));e.length=0}function tu(e,t,u){let r=u.locStart(t)-1;for(let o=1;o<e.length;++o)if(r<u.locStart(e[o]))return o-1;return 0}function Uo(e,t){let u=t-1;u=Y(e,u,{backwards:!0}),u=K(e,u,{backwards:!0}),u=Y(e,u,{backwards:!0});let r=K(e,u,{backwards:!0});return u!==r}var Le=Uo;function xr(e,t){let u=e.node;return u.printed=!0,t.printer.printComment(e,t)}function Wo(e,t){let u=e.node,r=[xr(e,t)],{printer:o,originalText:n,locStart:a,locEnd:s}=t;if(o.isBlockComment?.(u)){let f=z(n,s(u))?z(n,a(u),{backwards:!0})?V:ut:" ";r.push(f)}else r.push(V);let D=K(n,Y(n,s(u)));return D!==!1&&z(n,D)&&r.push(V),r}function $o(e,t,u){let r=e.node,o=xr(e,t),{printer:n,originalText:a,locStart:s}=t,i=n.isBlockComment?.(r);if(u?.hasLineSuffix&&!u?.isBlock||z(a,s(r),{backwards:!0})){let D=Le(a,s(r));return{doc:ve([V,D?V:"",o]),isBlock:i,hasLineSuffix:!0}}return!i||u?.hasLineSuffix?{doc:[ve([" ",o]),ce],isBlock:i,hasLineSuffix:!0}:{doc:[" ",o],isBlock:i,hasLineSuffix:!1}}function Vo(e,t){let u=e.node;if(!u)return{};let r=t[Symbol.for("printedComments")];if((u.comments||[]).filter(i=>!r.has(i)).length===0)return{leading:"",trailing:""};let n=[],a=[],s;return e.each(()=>{let i=e.node;if(r?.has(i))return;let{leading:D,trailing:f}=i;D?n.push(Wo(e,t)):f&&(s=$o(e,t,s),a.push(s.doc))},"comments"),{leading:n,trailing:a}}function Br(e,t,u){let{leading:r,trailing:o}=Vo(e,u);return!r&&!o?t:Ee(t,n=>[r,n,o])}function Tr(e){let{[Symbol.for("comments")]:t,[Symbol.for("printedComments")]:u}=e;for(let r of t){if(!r.printed&&!u.has(r))throw new Error('Comment "'+r.value.trim()+'" was not printed. Please report this error!');delete r.printed}}var Nr=()=>P;var Me=class extends Error{name="ConfigError"},Ye=class extends Error{name="UndefinedParserError"};var Sr={checkIgnorePragma:{category:"Special",type:"boolean",default:!1,description:"Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.",cliCategory:"Other"},cursorOffset:{category:"Special",type:"int",default:-1,range:{start:-1,end:1/0,step:1},description:"Print (to stderr) where a cursor at the given position would move to after formatting.",cliCategory:"Editor"},endOfLine:{category:"Global",type:"choice",default:"lf",description:"Which end of line characters to apply.",choices:[{value:"lf",description:"Line Feed only (\\n), common on Linux and macOS as well as inside git repos"},{value:"crlf",description:"Carriage Return + Line Feed characters (\\r\\n), common on Windows"},{value:"cr",description:"Carriage Return character only (\\r), used very rarely"},{value:"auto",description:`Maintain existing
|
| 13 |
+
(mixed values within one file are normalised by looking at what's used after the first line)`}]},filepath:{category:"Special",type:"path",description:"Specify the input filepath. This will be used to do parser inference.",cliName:"stdin-filepath",cliCategory:"Other",cliDescription:"Path to the file to pretend that stdin comes from."},insertPragma:{category:"Special",type:"boolean",default:!1,description:"Insert @format pragma into file's first docblock comment.",cliCategory:"Other"},parser:{category:"Global",type:"choice",default:void 0,description:"Which parser to use.",exception:e=>typeof e=="string"||typeof e=="function",choices:[{value:"flow",description:"Flow"},{value:"babel",description:"JavaScript"},{value:"babel-flow",description:"Flow"},{value:"babel-ts",description:"TypeScript"},{value:"typescript",description:"TypeScript"},{value:"acorn",description:"JavaScript"},{value:"espree",description:"JavaScript"},{value:"meriyah",description:"JavaScript"},{value:"css",description:"CSS"},{value:"less",description:"Less"},{value:"scss",description:"SCSS"},{value:"json",description:"JSON"},{value:"json5",description:"JSON5"},{value:"jsonc",description:"JSON with Comments"},{value:"json-stringify",description:"JSON.stringify"},{value:"graphql",description:"GraphQL"},{value:"markdown",description:"Markdown"},{value:"mdx",description:"MDX"},{value:"vue",description:"Vue"},{value:"yaml",description:"YAML"},{value:"glimmer",description:"Ember / Handlebars"},{value:"html",description:"HTML"},{value:"angular",description:"Angular"},{value:"lwc",description:"Lightning Web Components"},{value:"mjml",description:"MJML"}]},plugins:{type:"path",array:!0,default:[{value:[]}],category:"Global",description:"Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",exception:e=>typeof e=="string"||typeof e=="object",cliName:"plugin",cliCategory:"Config"},printWidth:{category:"Global",type:"int",default:80,description:"The line length where Prettier will try wrap.",range:{start:0,end:1/0,step:1}},rangeEnd:{category:"Special",type:"int",default:1/0,range:{start:0,end:1/0,step:1},description:`Format code ending at a given character offset (exclusive).
|
| 14 |
+
The range will extend forwards to the end of the selected statement.`,cliCategory:"Editor"},rangeStart:{category:"Special",type:"int",default:0,range:{start:0,end:1/0,step:1},description:`Format code starting at a given character offset.
|
| 15 |
+
The range will extend backwards to the start of the first line containing the selected statement.`,cliCategory:"Editor"},requirePragma:{category:"Special",type:"boolean",default:!1,description:"Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.",cliCategory:"Other"},tabWidth:{type:"int",category:"Global",default:2,description:"Number of spaces per indentation level.",range:{start:0,end:1/0,step:1}},useTabs:{category:"Global",type:"boolean",default:!1,description:"Indent with tabs instead of spaces."},embeddedLanguageFormatting:{category:"Global",type:"choice",default:"auto",description:"Control how Prettier formats quoted code embedded in the file.",choices:[{value:"auto",description:"Format embedded code if Prettier can automatically identify it."},{value:"off",description:"Never automatically format embedded code."}]}};function it({plugins:e=[],showDeprecated:t=!1}={}){let u=e.flatMap(o=>o.languages??[]),r=[];for(let o of Go(Object.assign({},...e.map(({options:n})=>n),Sr)))!t&&o.deprecated||(Array.isArray(o.choices)&&(t||(o.choices=o.choices.filter(n=>!n.deprecated)),o.name==="parser"&&(o.choices=[...o.choices,...Ko(o.choices,u,e)])),o.pluginDefaults=Object.fromEntries(e.filter(n=>n.defaultOptions?.[o.name]!==void 0).map(n=>[n.name,n.defaultOptions[o.name]])),r.push(o));return{languages:u,options:r}}function*Ko(e,t,u){let r=new Set(e.map(o=>o.value));for(let o of t)if(o.parsers){for(let n of o.parsers)if(!r.has(n)){r.add(n);let a=u.find(i=>i.parsers&&Object.prototype.hasOwnProperty.call(i.parsers,n)),s=o.name;a?.name&&(s+=` (plugin: ${a.name})`),yield{value:n,description:s}}}}function Go(e){let t=[];for(let[u,r]of Object.entries(e)){let o={name:u,...r};Array.isArray(o.default)&&(o.default=b(0,o.default,-1).value),t.push(o)}return t}var zo=Array.prototype.toReversed??function(){return[...this].reverse()},Jo=X("toReversed",function(){if(Array.isArray(this))return zo}),wr=Jo;function Ho(){let e=globalThis,t=e.Deno?.build?.os;return typeof t=="string"?t==="windows":e.navigator?.platform?.startsWith("Win")??e.process?.platform?.startsWith("win")??!1}var Xo=Ho();function Or(e){if(e=e instanceof URL?e:new URL(e),e.protocol!=="file:")throw new TypeError(`URL must be a file URL: received "${e.protocol}"`);return e}function qo(e){return e=Or(e),decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function Qo(e){e=Or(e);let t=decodeURIComponent(e.pathname.replace(/\//g,"\\").replace(/%(?![0-9A-Fa-f]{2})/g,"%25")).replace(/^\\*([A-Za-z]:)(\\|$)/,"$1\\");return e.hostname!==""&&(t=`\\\\${e.hostname}${t}`),t}function ru(e){return Xo?Qo(e):qo(e)}var Pr=e=>String(e).split(/[/\\]/u).pop(),Ir=e=>String(e).startsWith("file:");function kr(e,t){if(!t)return;let u=Pr(t).toLowerCase();return e.find(({filenames:r})=>r?.some(o=>o.toLowerCase()===u))??e.find(({extensions:r})=>r?.some(o=>u.endsWith(o)))}function Zo(e,t){if(t)return e.find(({name:u})=>u.toLowerCase()===t)??e.find(({aliases:u})=>u?.includes(t))??e.find(({extensions:u})=>u?.includes(`.${t}`))}var ea=void 0;function vr(e,t){if(t){if(Ir(t))try{t=ru(t)}catch{return}if(typeof t=="string")return e.find(({isSupported:u})=>u?.({filepath:t}))}}function ta(e,t){let u=wr(0,e.plugins).flatMap(o=>o.languages??[]);return(Zo(u,t.language)??kr(u,t.physicalFile)??kr(u,t.file)??vr(u,t.physicalFile)??vr(u,t.file)??ea?.(u,t.physicalFile))?.parsers[0]}var st=ta;var ie={key:e=>/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(e)?e:JSON.stringify(e),value(e){if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(u=>ie.value(u)).join(", ")}]`;let t=Object.keys(e);return t.length===0?"{}":`{ ${t.map(u=>`${ie.key(u)}: ${ie.value(e[u])}`).join(", ")} }`},pair:({key:e,value:t})=>ie.value({[e]:t})};var nu=new Proxy(String,{get:()=>nu}),$=nu,ou=()=>nu;var Rr=(e,t,{descriptor:u})=>{let r=[`${$.yellow(typeof e=="string"?u.key(e):u.pair(e))} is deprecated`];return t&&r.push(`we now treat it as ${$.blue(typeof t=="string"?u.key(t):u.pair(t))}`),r.join("; ")+"."};var Dt=Symbol.for("vnopts.VALUE_NOT_EXIST"),Ae=Symbol.for("vnopts.VALUE_UNCHANGED");var Lr=" ".repeat(2),Yr=(e,t,u)=>{let{text:r,list:o}=u.normalizeExpectedResult(u.schemas[e].expected(u)),n=[];return r&&n.push(Mr(e,t,r,u.descriptor)),o&&n.push([Mr(e,t,o.title,u.descriptor)].concat(o.values.map(a=>jr(a,u.loggerPrintWidth))).join(`
|
| 16 |
+
`)),Ur(n,u.loggerPrintWidth)};function Mr(e,t,u,r){return[`Invalid ${$.red(r.key(e))} value.`,`Expected ${$.blue(u)},`,`but received ${t===Dt?$.gray("nothing"):$.red(r.value(t))}.`].join(" ")}function jr({text:e,list:t},u){let r=[];return e&&r.push(`- ${$.blue(e)}`),t&&r.push([`- ${$.blue(t.title)}:`].concat(t.values.map(o=>jr(o,u-Lr.length).replace(/^|\n/g,`$&${Lr}`))).join(`
|
| 17 |
+
`)),Ur(r,u)}function Ur(e,t){if(e.length===1)return e[0];let[u,r]=e,[o,n]=e.map(a=>a.split(`
|
| 18 |
+
`,1)[0].length);return o>t&&o>n?r:u}var _e=[],au=[];function ct(e,t,u){if(e===t)return 0;let r=u?.maxDistance,o=e;e.length>t.length&&(e=t,t=o);let n=e.length,a=t.length;for(;n>0&&e.charCodeAt(~-n)===t.charCodeAt(~-a);)n--,a--;let s=0;for(;s<n&&e.charCodeAt(s)===t.charCodeAt(s);)s++;if(n-=s,a-=s,r!==void 0&&a-n>r)return r;if(n===0)return r!==void 0&&a>r?r:a;let i,D,f,l,d=0,c=0;for(;d<n;)au[d]=e.charCodeAt(s+d),_e[d]=++d;for(;c<a;){for(i=t.charCodeAt(s+c),f=c++,D=c,d=0;d<n;d++)l=i===au[d]?f:f+1,f=_e[d],D=_e[d]=f>D?l>D?D+1:l:l>f?f+1:l;if(r!==void 0){let p=D;for(d=0;d<n;d++)_e[d]<p&&(p=_e[d]);if(p>r)return r}}return _e.length=n,au.length=n,r!==void 0&&D>r?r:D}function Wr(e,t,u){if(!Array.isArray(t)||t.length===0)return;let r=u?.maxDistance,o=e.length;for(let i of t)if(i===e)return i;if(r===0)return;let n,a=Number.POSITIVE_INFINITY,s=new Set;for(let i of t){if(s.has(i))continue;s.add(i);let D=Math.abs(i.length-o);if(D>=a||r!==void 0&&D>r)continue;let f=Number.isFinite(a)?r===void 0?a:Math.min(a,r):r,l=f===void 0?ct(e,i):ct(e,i,{maxDistance:f});if(r!==void 0&&l>r)continue;let d=l;if(f!==void 0&&l===f&&f===r&&(d=ct(e,i)),d<a&&(a=d,n=i,a===0))break}if(!(r!==void 0&&a>r))return n}var ft=(e,t,{descriptor:u,logger:r,schemas:o})=>{let n=[`Ignored unknown option ${$.yellow(u.pair({key:e,value:t}))}.`],a=Wr(e,Object.keys(o),{maxDistance:3});a&&n.push(`Did you mean ${$.blue(u.key(a))}?`),r.warn(n.join(" "))};var ua=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function ra(e,t){let u=new e(t),r=Object.create(u);for(let o of ua)o in t&&(r[o]=na(t[o],u,S.prototype[o].length));return r}var S=class{static create(t){return ra(this,t)}constructor(t){this.name=t.name}default(t){}expected(t){return"nothing"}validate(t,u){return!1}deprecated(t,u){return!1}forward(t,u){}redirect(t,u){}overlap(t,u,r){return t}preprocess(t,u){return t}postprocess(t,u){return Ae}};function na(e,t,u){return typeof e=="function"?(...r)=>e(...r.slice(0,u-1),t,...r.slice(u-1)):()=>e}var lt=class extends S{constructor(t){super(t),this._sourceName=t.sourceName}expected(t){return t.schemas[this._sourceName].expected(t)}validate(t,u){return u.schemas[this._sourceName].validate(t,u)}redirect(t,u){return this._sourceName}};var dt=class extends S{expected(){return"anything"}validate(){return!0}};var pt=class extends S{constructor({valueSchema:t,name:u=t.name,...r}){super({...r,name:u}),this._valueSchema=t}expected(t){let{text:u,list:r}=t.normalizeExpectedResult(this._valueSchema.expected(t));return{text:u&&`an array of ${u}`,list:r&&{title:"an array of the following values",values:[{list:r}]}}}validate(t,u){if(!Array.isArray(t))return!1;let r=[];for(let o of t){let n=u.normalizeValidateResult(this._valueSchema.validate(o,u),o);n!==!0&&r.push(n.value)}return r.length===0?!0:{value:r}}deprecated(t,u){let r=[];for(let o of t){let n=u.normalizeDeprecatedResult(this._valueSchema.deprecated(o,u),o);n!==!1&&r.push(...n.map(({value:a})=>({value:[a]})))}return r}forward(t,u){let r=[];for(let o of t){let n=u.normalizeForwardResult(this._valueSchema.forward(o,u),o);r.push(...n.map($r))}return r}redirect(t,u){let r=[],o=[];for(let n of t){let a=u.normalizeRedirectResult(this._valueSchema.redirect(n,u),n);"remain"in a&&r.push(a.remain),o.push(...a.redirect.map($r))}return r.length===0?{redirect:o}:{redirect:o,remain:r}}overlap(t,u){return t.concat(u)}};function $r({from:e,to:t}){return{from:[e],to:t}}var Ft=class extends S{expected(){return"true or false"}validate(t){return typeof t=="boolean"}};function Kr(e,t){let u=Object.create(null);for(let r of e){let o=r[t];if(u[o])throw new Error(`Duplicate ${t} ${JSON.stringify(o)}`);u[o]=r}return u}function Gr(e,t){let u=new Map;for(let r of e){let o=r[t];if(u.has(o))throw new Error(`Duplicate ${t} ${JSON.stringify(o)}`);u.set(o,r)}return u}function zr(){let e=Object.create(null);return t=>{let u=JSON.stringify(t);return e[u]?!0:(e[u]=!0,!1)}}function Jr(e,t){let u=[],r=[];for(let o of e)t(o)?u.push(o):r.push(o);return[u,r]}function Hr(e){return e===Math.floor(e)}function Xr(e,t){if(e===t)return 0;let u=typeof e,r=typeof t,o=["undefined","object","boolean","number","string"];return u!==r?o.indexOf(u)-o.indexOf(r):u!=="string"?Number(e)-Number(t):e.localeCompare(t)}function qr(e){return(...t)=>{let u=e(...t);return typeof u=="string"?new Error(u):u}}function iu(e){return e===void 0?{}:e}function su(e){if(typeof e=="string")return{text:e};let{text:t,list:u}=e;return oa((t||u)!==void 0,"Unexpected `expected` result, there should be at least one field."),u?{text:t,list:{title:u.title,values:u.values.map(su)}}:{text:t}}function Du(e,t){return e===!0?!0:e===!1?{value:t}:e}function cu(e,t,u=!1){return e===!1?!1:e===!0?u?!0:[{value:t}]:"value"in e?[e]:e.length===0?!1:e}function Vr(e,t){return typeof e=="string"||"key"in e?{from:t,to:e}:"from"in e?{from:e.from,to:e.to}:{from:t,to:e.to}}function mt(e,t){return e===void 0?[]:Array.isArray(e)?e.map(u=>Vr(u,t)):[Vr(e,t)]}function fu(e,t){let u=mt(typeof e=="object"&&"redirect"in e?e.redirect:e,t);return u.length===0?{remain:t,redirect:u}:typeof e=="object"&&"remain"in e?{remain:e.remain,redirect:u}:{redirect:u}}function oa(e,t){if(!e)throw new Error(t)}var Et=class extends S{constructor(t){super(t),this._choices=Gr(t.choices.map(u=>u&&typeof u=="object"?u:{value:u}),"value")}expected({descriptor:t}){let u=Array.from(this._choices.keys()).map(a=>this._choices.get(a)).filter(({hidden:a})=>!a).map(a=>a.value).sort(Xr).map(t.value),r=u.slice(0,-2),o=u.slice(-2);return{text:r.concat(o.join(" or ")).join(", "),list:{title:"one of the following values",values:u}}}validate(t){return this._choices.has(t)}deprecated(t){let u=this._choices.get(t);return u&&u.deprecated?{value:t}:!1}forward(t){let u=this._choices.get(t);return u?u.forward:void 0}redirect(t){let u=this._choices.get(t);return u?u.redirect:void 0}};var Ct=class extends S{expected(){return"a number"}validate(t,u){return typeof t=="number"}};var ht=class extends Ct{expected(){return"an integer"}validate(t,u){return u.normalizeValidateResult(super.validate(t,u),t)===!0&&Hr(t)}};var je=class extends S{expected(){return"a string"}validate(t){return typeof t=="string"}};var Qr=ie,Zr=ft,en=Yr,tn=Rr;var gt=class{constructor(t,u){let{logger:r=console,loggerPrintWidth:o=80,descriptor:n=Qr,unknown:a=Zr,invalid:s=en,deprecated:i=tn,missing:D=()=>!1,required:f=()=>!1,preprocess:l=c=>c,postprocess:d=()=>Ae}=u||{};this._utils={descriptor:n,logger:r||{warn:()=>{}},loggerPrintWidth:o,schemas:Kr(t,"name"),normalizeDefaultResult:iu,normalizeExpectedResult:su,normalizeDeprecatedResult:cu,normalizeForwardResult:mt,normalizeRedirectResult:fu,normalizeValidateResult:Du},this._unknownHandler=a,this._invalidHandler=qr(s),this._deprecatedHandler=i,this._identifyMissing=(c,p)=>!(c in p)||D(c,p),this._identifyRequired=f,this._preprocess=l,this._postprocess=d,this.cleanHistory()}cleanHistory(){this._hasDeprecationWarned=zr()}normalize(t){let u={},o=[this._preprocess(t,this._utils)],n=()=>{for(;o.length!==0;){let a=o.shift(),s=this._applyNormalization(a,u);o.push(...s)}};n();for(let a of Object.keys(this._utils.schemas)){let s=this._utils.schemas[a];if(!(a in u)){let i=iu(s.default(this._utils));"value"in i&&o.push({[a]:i.value})}}n();for(let a of Object.keys(this._utils.schemas)){if(!(a in u))continue;let s=this._utils.schemas[a],i=u[a],D=s.postprocess(i,this._utils);D!==Ae&&(this._applyValidation(D,a,s),u[a]=D)}return this._applyPostprocess(u),this._applyRequiredCheck(u),u}_applyNormalization(t,u){let r=[],{knownKeys:o,unknownKeys:n}=this._partitionOptionKeys(t);for(let a of o){let s=this._utils.schemas[a],i=s.preprocess(t[a],this._utils);this._applyValidation(i,a,s);let D=({from:c,to:p})=>{r.push(typeof p=="string"?{[p]:c}:{[p.key]:p.value})},f=({value:c,redirectTo:p})=>{let F=cu(s.deprecated(c,this._utils),i,!0);if(F!==!1)if(F===!0)this._hasDeprecationWarned(a)||this._utils.logger.warn(this._deprecatedHandler(a,p,this._utils));else for(let{value:C}of F){let y={key:a,value:C};if(!this._hasDeprecationWarned(y)){let m=typeof p=="string"?{key:p,value:C}:p;this._utils.logger.warn(this._deprecatedHandler(y,m,this._utils))}}};mt(s.forward(i,this._utils),i).forEach(D);let d=fu(s.redirect(i,this._utils),i);if(d.redirect.forEach(D),"remain"in d){let c=d.remain;u[a]=a in u?s.overlap(u[a],c,this._utils):c,f({value:c})}for(let{from:c,to:p}of d.redirect)f({value:c,redirectTo:p})}for(let a of n){let s=t[a];this._applyUnknownHandler(a,s,u,(i,D)=>{r.push({[i]:D})})}return r}_applyRequiredCheck(t){for(let u of Object.keys(this._utils.schemas))if(this._identifyMissing(u,t)&&this._identifyRequired(u))throw this._invalidHandler(u,Dt,this._utils)}_partitionOptionKeys(t){let[u,r]=Jr(Object.keys(t).filter(o=>!this._identifyMissing(o,t)),o=>o in this._utils.schemas);return{knownKeys:u,unknownKeys:r}}_applyValidation(t,u,r){let o=Du(r.validate(t,this._utils),t);if(o!==!0)throw this._invalidHandler(u,o.value,this._utils)}_applyUnknownHandler(t,u,r,o){let n=this._unknownHandler(t,u,this._utils);if(n)for(let a of Object.keys(n)){if(this._identifyMissing(a,n))continue;let s=n[a];a in this._utils.schemas?o(a,s):r[a]=s}}_applyPostprocess(t){let u=this._postprocess(t,this._utils);if(u!==Ae){if(u.delete)for(let r of u.delete)delete t[r];if(u.override){let{knownKeys:r,unknownKeys:o}=this._partitionOptionKeys(u.override);for(let n of r){let a=u.override[n];this._applyValidation(a,n,this._utils.schemas[n]),t[n]=a}for(let n of o){let a=u.override[n];this._applyUnknownHandler(n,a,t,(s,i)=>{let D=this._utils.schemas[s];this._applyValidation(i,s,D),t[s]=i})}}}}};var lu;function ia(e,t,{logger:u=!1,isCLI:r=!1,passThrough:o=!1,FlagSchema:n,descriptor:a}={}){if(r){if(!n)throw new Error("'FlagSchema' option is required.");if(!a)throw new Error("'descriptor' option is required.")}else a=ie;let s=o?Array.isArray(o)?(d,c)=>o.includes(d)?{[d]:c}:void 0:(d,c)=>({[d]:c}):(d,c,p)=>{let{_:F,...C}=p.schemas;return ft(d,c,{...p,schemas:C})},i=sa(t,{isCLI:r,FlagSchema:n}),D=new gt(i,{logger:u,unknown:s,descriptor:a}),f=u!==!1;f&&lu&&(D._hasDeprecationWarned=lu);let l=D.normalize(e);return f&&(lu=D._hasDeprecationWarned),l}function sa(e,{isCLI:t,FlagSchema:u}){let r=[];t&&r.push(dt.create({name:"_"}));for(let o of e)r.push(Da(o,{isCLI:t,optionInfos:e,FlagSchema:u})),o.alias&&t&&r.push(lt.create({name:o.alias,sourceName:o.name}));return r}function Da(e,{isCLI:t,optionInfos:u,FlagSchema:r}){let{name:o}=e,n={name:o},a,s={};switch(e.type){case"int":a=ht,t&&(n.preprocess=Number);break;case"string":a=je;break;case"choice":a=Et,n.choices=e.choices.map(i=>i?.redirect?{...i,redirect:{to:{key:e.name,value:i.redirect}}}:i);break;case"boolean":a=Ft;break;case"flag":a=r,n.flags=u.flatMap(i=>[i.alias,i.description&&i.name,i.oppositeDescription&&`no-${i.name}`].filter(Boolean));break;case"path":a=je;break;default:throw new Error(`Unexpected type ${e.type}`)}if(e.exception?n.validate=(i,D,f)=>e.exception(i)||D.validate(i,f):n.validate=(i,D,f)=>i===void 0||D.validate(i,f),e.redirect&&(s.redirect=i=>i?{to:typeof e.redirect=="string"?e.redirect:{key:e.redirect.option,value:e.redirect.value}}:void 0),e.deprecated&&(s.deprecated=!0),t&&!e.array){let i=n.preprocess||(D=>D);n.preprocess=(D,f,l)=>f.preprocess(i(Array.isArray(D)?b(0,D,-1):D),l)}return e.array?pt.create({...t?{preprocess:i=>Array.isArray(i)?i:[i]}:{},...s,valueSchema:a.create(n)}):a.create({...n,...s})}var un=ia;var ca=Array.prototype.findLast??function(e){for(let t=this.length-1;t>=0;t--){let u=this[t];if(e(u,t,this))return u}},fa=X("findLast",function(){if(Array.isArray(this))return ca}),du=fa;var rn=Symbol.for("PRETTIER_IS_FRONT_MATTER"),pu=[];function la(e){return!!e?.[rn]}var de=la;var nn=new Set(["yaml","toml"]),Ue=({node:e})=>de(e)&&nn.has(e.language);async function Fu(e,t,u,r){let{node:o}=u,{language:n}=o;if(!nn.has(n))return;let a=o.value.trim(),s;if(a){let i=n==="yaml"?n:st(r,{language:n});if(!i)return;s=a?await e(a,{parser:i}):""}else s=a;return et([o.startDelimiter,o.explicitLanguage??"",V,s,s?V:"",o.endDelimiter])}function da(e,t){return Ue({node:e})&&(delete t.end,delete t.raw,delete t.value),t}var mu=da;function pa({node:e}){return e.raw}var Eu=pa;var on=new Set(["tokens","comments","parent","enclosingNode","precedingNode","followingNode"]),Fa=e=>Object.keys(e).filter(t=>!on.has(t));function ma(e,t){let u=e?r=>e(r,on):Fa;return t?new Proxy(u,{apply:(r,o,n)=>de(n[0])?pu:Reflect.apply(r,o,n)}):u}var Cu=ma;function gu(e,t){if(!t)throw new Error("parserName is required.");let u=du(0,e,o=>o.parsers&&Object.prototype.hasOwnProperty.call(o.parsers,t));if(u)return u;let r=`Couldn't resolve parser "${t}".`;throw r+=" Plugins must be explicitly added to the standalone bundle.",new Me(r)}function an(e,t){if(!t)throw new Error("astFormat is required.");let u=du(0,e,o=>o.printers&&Object.prototype.hasOwnProperty.call(o.printers,t));if(u)return u;let r=`Couldn't find plugin for AST format "${t}".`;throw r+=" Plugins must be explicitly added to the standalone bundle.",new Me(r)}function We({plugins:e,parser:t}){let u=gu(e,t);return yu(u,t)}function yu(e,t){let u=e.parsers[t];return typeof u=="function"?u():u}async function sn(e,t){let u=e.printers[t],r=typeof u=="function"?await u():u;return Ea(r)}var hu=new WeakMap,q0=Symbol("PRINTER_NORMALIZED_MARK");function Ea(e){if(hu.has(e))return hu.get(e);let{features:t,getVisitorKeys:u,embed:r,massageAstNode:o,print:n,...a}=e;t=ya(t);let s=t.experimental_frontMatterSupport;u=Cu(u,s.massageAstNode||s.embed||s.print);let i=o;o&&s.massageAstNode&&(i=new Proxy(o,{apply(d,c,p){return mu(...p),Reflect.apply(d,c,p)}}));let D=r;if(r){let d;D=new Proxy(r,{get(c,p,F){return p==="getVisitorKeys"?(d??(d=r.getVisitorKeys?Cu(r.getVisitorKeys,s.massageAstNode||s.embed):u),d):Reflect.get(c,p,F)},apply:(c,p,F)=>s.embed&&Ue(...F)?Fu:Reflect.apply(c,p,F)})}let f=n;s.print&&(f=new Proxy(n,{apply(d,c,p){let[F]=p;return de(F.node)?Eu(F):Reflect.apply(d,c,p)}}));let l={features:t,getVisitorKeys:u,embed:D,massageAstNode:i,print:f,...a};return hu.set(e,l),l}var Ca=["clean","embed","print"],ha=Object.fromEntries(Ca.map(e=>[e,!1]));function ga(e){return{...ha,...e}}function ya(e){return{experimental_avoidAstMutation:!1,...e,experimental_frontMatterSupport:ga(e?.experimental_frontMatterSupport)}}var Dn={astFormat:"estree",printer:{},originalText:void 0,locStart:null,locEnd:null,getVisitorKeys:null};async function ba(e,t={}){let u={...e};if(!u.parser)if(u.filepath){if(u.parser=st(u,{physicalFile:u.filepath}),!u.parser)throw new Ye(`No parser could be inferred for file "${u.filepath}".`)}else throw new Ye("No parser and no file path given, couldn't infer a parser.");let r=it({plugins:e.plugins,showDeprecated:!0}).options,o={...Dn,...Object.fromEntries(r.filter(l=>l.default!==void 0).map(l=>[l.name,l.default]))},n=gu(u.plugins,u.parser),a=await yu(n,u.parser);u.astFormat=a.astFormat,u.locEnd=a.locEnd,u.locStart=a.locStart;let s=n.printers?.[a.astFormat]?n:an(u.plugins,a.astFormat),i=await sn(s,a.astFormat);u.printer=i,u.getVisitorKeys=i.getVisitorKeys;let D=s.defaultOptions?Object.fromEntries(Object.entries(s.defaultOptions).filter(([,l])=>l!==void 0)):{},f={...o,...D};for(let[l,d]of Object.entries(f))(u[l]===null||u[l]===void 0)&&(u[l]=d);return u.parser==="json"&&(u.trailingComma="none"),un(u,r,{passThrough:Object.keys(Dn),...t})}var se=ba;var pf=ao(dn(),1);var Au="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",pn="\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",af=new RegExp("["+Au+"]"),sf=new RegExp("["+Au+pn+"]");Au=pn=null;var _u={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]},Df=new Set(_u.keyword),cf=new Set(_u.strict),ff=new Set(_u.strictBind);var It=(e,t)=>u=>e(t(u));function mn(e){return{keyword:e.cyan,capitalized:e.yellow,jsxIdentifier:e.yellow,punctuator:e.yellow,number:e.magenta,string:e.green,regex:e.magenta,comment:e.gray,invalid:It(It(e.white,e.bgRed),e.bold),gutter:e.gray,marker:It(e.red,e.bold),message:It(e.red,e.bold),reset:e.reset}}var hf=mn(ou(!0)),gf=mn(ou(!1));function _a(){return new Proxy({},{get:()=>e=>e})}var Fn=/\r\n|[\n\r\u2028\u2029]/;function xa(e,t,u){let r=Object.assign({column:0,line:-1},e.start),o=Object.assign({},r,e.end),{linesAbove:n=2,linesBelow:a=3}=u||{},s=r.line,i=r.column,D=o.line,f=o.column,l=Math.max(s-(n+1),0),d=Math.min(t.length,D+a);s===-1&&(l=0),D===-1&&(d=t.length);let c=D-s,p={};if(c)for(let F=0;F<=c;F++){let C=F+s;if(!i)p[C]=!0;else if(F===0){let y=t[C-1].length;p[C]=[i,y-i+1]}else if(F===c)p[C]=[0,f];else{let y=t[C-F].length;p[C]=[0,y]}}else i===f?i?p[s]=[i,0]:p[s]=!0:p[s]=[i,f-i];return{start:l,end:d,markerLines:p}}function En(e,t,u={}){let o=_a(!1),n=e.split(Fn),{start:a,end:s,markerLines:i}=xa(t,n,u),D=t.start&&typeof t.start.column=="number",f=String(s).length,d=e.split(Fn,s).slice(a,s).map((c,p)=>{let F=a+1+p,y=` ${` ${F}`.slice(-f)} |`,m=i[F],h=!i[F+1];if(m){let E="";if(Array.isArray(m)){let g=c.slice(0,Math.max(m[0]-1,0)).replace(/[^\t]/g," "),A=m[1]||1;E=[`
|
| 19 |
+
`,o.gutter(y.replace(/\d/g," "))," ",g,o.marker("^").repeat(A)].join(""),h&&u.message&&(E+=" "+o.message(u.message))}return[o.marker(">"),o.gutter(y),c.length>0?` ${c}`:"",E].join("")}else return` ${o.gutter(y)}${c.length>0?` ${c}`:""}`}).join(`
|
| 20 |
+
`);return u.message&&!D&&(d=`${" ".repeat(f+1)}${u.message}
|
| 21 |
+
${d}`),d}async function Ba(e,t){let u=await We(t),r=u.preprocess?await u.preprocess(e,t):e;t.originalText=r;let o;try{o=await u.parse(r,t,t)}catch(n){Ta(n,e)}return{text:r,ast:o}}function Ta(e,t){let{loc:u}=e;if(u){let r=En(t,u,{highlightCode:!0});throw e.message+=`
|
| 22 |
+
`+r,e.codeFrame=r,e}throw e}var Fe=Ba;async function Cn(e,t,u,r,o){if(u.embeddedLanguageFormatting!=="auto")return;let{printer:n}=u,{embed:a}=n;if(!a)return;if(a.length>2)throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/plugins#optional-embed");let{hasPrettierIgnore:s}=n,{getVisitorKeys:i}=a,D=[];d();let f=e.stack;for(let{print:c,node:p,pathStack:F}of D)try{e.stack=F;let C=await c(l,t,e,u);C&&o.set(p,C)}catch(C){if(globalThis.PRETTIER_DEBUG)throw C}e.stack=f;function l(c,p){return Na(c,p,u,r)}function d(){let{node:c}=e;if(c===null||typeof c!="object"||s?.(e))return;for(let F of i(c))Array.isArray(c[F])?e.each(d,F):e.call(d,F);let p=a(e,u);if(p){if(typeof p=="function"){D.push({print:p,node:c,pathStack:[...e.stack]});return}o.set(c,p)}}}async function Na(e,t,u,r){let o=await se({...u,...t,parentParser:u.parser,originalText:e,cursorOffset:void 0,rangeStart:void 0,rangeEnd:void 0},{passThrough:!0}),{ast:n}=await Fe(e,o),a=await r(n,o);return qe(a)}function Sa(e,t,u,r){let{originalText:o,[Symbol.for("comments")]:n,locStart:a,locEnd:s,[Symbol.for("printedComments")]:i}=t,{node:D}=e,f=a(D),l=s(D);for(let c of n)a(c)>=f&&s(c)<=l&&i.add(c);let{printPrettierIgnored:d}=t.printer;return d?d(e,t,u,r):o.slice(f,l)}var hn=Sa;async function Ge(e,t){({ast:e}=await xu(e,t));let u=new Map,r=new pr(e),o=Nr(t),n=new Map;await Cn(r,s,t,Ge,n);let a=await gn(r,t,s,void 0,n);if(Tr(t),t.cursorOffset>=0){if(t.nodeAfterCursor&&!t.nodeBeforeCursor)return[ee,a];if(t.nodeBeforeCursor&&!t.nodeAfterCursor)return[a,ee]}return a;function s(D,f){return D===void 0||D===r?i(f):Array.isArray(D)?r.call(()=>i(f),...D):r.call(()=>i(f),D)}function i(D){o(r);let f=r.node;if(f==null)return"";let l=ge(f)&&D===void 0;if(l&&u.has(f))return u.get(f);let d=gn(r,t,s,D,n);return l&&u.set(f,d),d}}function gn(e,t,u,r,o){let{node:n}=e,{printer:a}=t,s;switch(a.hasPrettierIgnore?.(e)?s=hn(e,t,u,r):o.has(n)?s=o.get(n):s=a.print(e,t,u,r),n){case t.cursorNode:s=Ee(s,i=>[ee,i,ee]);break;case t.nodeBeforeCursor:s=Ee(s,i=>[i,ee]);break;case t.nodeAfterCursor:s=Ee(s,i=>[ee,i]);break}return a.printComment&&!a.willPrintOwnComments?.(e,t)&&(s=Br(e,s,t)),s}async function xu(e,t){let u=e.comments??[];t[Symbol.for("comments")]=u,t[Symbol.for("printedComments")]=new Set,Ar(e,t);let{printer:{preprocess:r}}=t;return e=r?await r(e,t):e,{ast:e,comments:u}}function wa(e,t){let{cursorOffset:u,locStart:r,locEnd:o,getVisitorKeys:n}=t,a=c=>r(c)<=u&&o(c)>=u,s=e,i=[e];for(let c of Cr(e,{getVisitorKeys:n,filter:a}))i.push(c),s=c;if(hr(s,{getVisitorKeys:n}))return{cursorNode:s};let D,f,l=-1,d=Number.POSITIVE_INFINITY;for(;i.length>0&&(D===void 0||f===void 0);){s=i.pop();let c=D!==void 0,p=f!==void 0;for(let F of be(s,{getVisitorKeys:n})){if(!c){let C=o(F);C<=u&&C>l&&(D=F,l=C)}if(!p){let C=r(F);C>=u&&C<d&&(f=F,d=C)}}}return{nodeBeforeCursor:D,nodeAfterCursor:f}}var Bu=wa;function Oa(e,t){let{printer:u}=t,r=u.massageAstNode;if(!r)return e;let{getVisitorKeys:o}=u,{ignoredProperties:n}=r;return a(e);function a(s,i){if(!ge(s))return s;if(Array.isArray(s))return s.map(d=>a(d,i)).filter(Boolean);let D={},f=new Set(o(s));for(let d in s)!Object.prototype.hasOwnProperty.call(s,d)||n?.has(d)||(f.has(d)?D[d]=a(s[d],s):D[d]=s[d]);let l=r(s,D,i);if(l!==null)return l??D}}var yn=Oa;var Pa=Array.prototype.findLastIndex??function(e){for(let t=this.length-1;t>=0;t--){let u=this[t];if(e(u,t,this))return t}return-1},Ia=X("findLastIndex",function(){if(Array.isArray(this))return Pa}),bn=Ia;var ka=({parser:e})=>e==="json"||e==="json5"||e==="jsonc"||e==="json-stringify";function va(e,t){return t=new Set(t),e.find(u=>xn.has(u.type)&&t.has(u))}function An(e){let t=bn(0,e,u=>u.type!=="Program"&&u.type!=="File");return t===-1?e:e.slice(0,t+1)}function Ra(e,t,{locStart:u,locEnd:r}){let[o,...n]=e,[a,...s]=t;if(o===a)return[o,a];let i=u(o);for(let f of An(s))if(u(f)>=i)a=f;else break;let D=r(a);for(let f of An(n)){if(r(f)<=D)o=f;else break;if(o===a)break}return[o,a]}function Tu(e,t,u,r,o=[],n){let{locStart:a,locEnd:s}=u,i=a(e),D=s(e);if(t>D||t<i||n==="rangeEnd"&&t===i||n==="rangeStart"&&t===D)return;let f=[e,...o],l=at(e,f,{cache:uu,locStart:a,locEnd:s,getVisitorKeys:u.getVisitorKeys,filter:u.printer.canAttachComment,getChildren:u.printer.getCommentChildNodes});for(let d of l){let c=Tu(d,t,u,r,f,n);if(c)return c}if(r(e,o[0]))return f}function La(e,t){return t!=="DeclareExportDeclaration"&&e!=="TypeParameterDeclaration"&&(e==="Directive"||e==="TypeAlias"||e==="TSExportAssignment"||e.startsWith("Declare")||e.startsWith("TSDeclare")||e.endsWith("Statement")||e.endsWith("Declaration"))}var xn=new Set(["JsonRoot","ObjectExpression","ArrayExpression","StringLiteral","NumericLiteral","BooleanLiteral","NullLiteral","UnaryExpression","TemplateLiteral"]),Ma=new Set(["OperationDefinition","FragmentDefinition","VariableDefinition","TypeExtensionDefinition","ObjectTypeDefinition","FieldDefinition","DirectiveDefinition","EnumTypeDefinition","EnumValueDefinition","InputValueDefinition","InputObjectTypeDefinition","SchemaDefinition","OperationTypeDefinition","InterfaceTypeDefinition","UnionTypeDefinition","ScalarTypeDefinition"]);function _n(e,t,u){if(!t)return!1;switch(e.parser){case"flow":case"hermes":case"babel":case"babel-flow":case"babel-ts":case"typescript":case"acorn":case"espree":case"meriyah":case"oxc":case"oxc-ts":case"__babel_estree":return La(t.type,u?.type);case"json":case"json5":case"jsonc":case"json-stringify":return xn.has(t.type);case"graphql":return Ma.has(t.kind);case"vue":return t.tag!=="root"}return!1}function Bn(e,t,u){let{rangeStart:r,rangeEnd:o,locStart:n,locEnd:a}=t;P(o>r);let s=e.slice(r,o).search(/\S/u),i=s===-1;if(!i)for(r+=s;o>r&&!/\S/u.test(e[o-1]);--o);let D=Tu(u,r,t,(c,p)=>_n(t,c,p),[],"rangeStart");if(!D)return;let f=i?D:Tu(u,o,t,c=>_n(t,c),[],"rangeEnd");if(!f)return;let l,d;if(ka(t)){let c=va(D,f);l=c,d=c}else[l,d]=Ra(D,f,t);return[Math.min(n(l),n(d)),Math.max(a(l),a(d))]}var wn="\uFEFF",Tn=Symbol("cursor");async function On(e,t,u=0){if(!e||e.trim().length===0)return{formatted:"",cursorOffset:-1,comments:[]};let{ast:r,text:o}=await Fe(e,t);t.cursorOffset>=0&&(t={...t,...Bu(r,t)});let n=await Ge(r,t,u);u>0&&(n=tt([V,n],u,t.tabWidth));let a=Ce(n,t);if(u>0){let i=a.formatted.trim();a.cursorNodeStart!==void 0&&(a.cursorNodeStart-=a.formatted.indexOf(i),a.cursorNodeStart<0&&(a.cursorNodeStart=0,a.cursorNodeText=a.cursorNodeText.trimStart()),a.cursorNodeStart+a.cursorNodeText.length>i.length&&(a.cursorNodeText=a.cursorNodeText.trimEnd())),a.formatted=i+Se(t.endOfLine)}let s=t[Symbol.for("comments")];if(t.cursorOffset>=0){let i,D,f,l;if((t.cursorNode||t.nodeBeforeCursor||t.nodeAfterCursor)&&a.cursorNodeText)if(f=a.cursorNodeStart,l=a.cursorNodeText,t.cursorNode)i=t.locStart(t.cursorNode),D=o.slice(i,t.locEnd(t.cursorNode));else{if(!t.nodeBeforeCursor&&!t.nodeAfterCursor)throw new Error("Cursor location must contain at least one of cursorNode, nodeBeforeCursor, nodeAfterCursor");i=t.nodeBeforeCursor?t.locEnd(t.nodeBeforeCursor):0;let y=t.nodeAfterCursor?t.locStart(t.nodeAfterCursor):o.length;D=o.slice(i,y)}else i=0,D=o,f=0,l=a.formatted;let d=t.cursorOffset-i;if(D===l)return{formatted:a.formatted,cursorOffset:f+d,comments:s};let c=D.split("");c.splice(d,0,Tn);let p=l.split(""),F=Ut(c,p),C=f;for(let y of F)if(y.removed){if(y.value.includes(Tn))break}else C+=y.count;return{formatted:a.formatted,cursorOffset:C,comments:s}}return{formatted:a.formatted,cursorOffset:-1,comments:s}}async function Ya(e,t){let{ast:u,text:r}=await Fe(e,t),[o,n]=Bn(r,t,u)??[0,0],a=r.slice(o,n),s=Math.min(o,r.lastIndexOf(`
|
| 23 |
+
`,o)+1),i=r.slice(s,o).match(/^\s*/u)[0],D=he(i,t.tabWidth),f=await On(a,{...t,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:t.cursorOffset>o&&t.cursorOffset<=n?t.cursorOffset-o:-1,endOfLine:"lf"},D),l=f.formatted.trimEnd(),{cursorOffset:d}=t;d>n?d+=l.length-a.length:f.cursorOffset>=0&&(d=f.cursorOffset+o);let c=r.slice(0,o)+l+r.slice(n);if(t.endOfLine!=="lf"){let p=Se(t.endOfLine);d>=0&&p===`\r
|
| 24 |
+
`&&(d+=$t(c.slice(0,d),`
|
| 25 |
+
`)),c=oe(0,c,`
|
| 26 |
+
`,p)}return{formatted:c,cursorOffset:d,comments:f.comments}}function Nu(e,t,u){return typeof t!="number"||Number.isNaN(t)||t<0||t>e.length?u:t}function Nn(e,t){let{cursorOffset:u,rangeStart:r,rangeEnd:o}=t;return u=Nu(e,u,-1),r=Nu(e,r,0),o=Nu(e,o,e.length),{...t,cursorOffset:u,rangeStart:r,rangeEnd:o}}function Pn(e,t){let{cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n}=Nn(e,t),a=e.charAt(0)===wn;if(a&&(e=e.slice(1),u--,r--,o--),n==="auto"&&(n=Yu(e)),e.includes("\r")){let s=i=>$t(e.slice(0,Math.max(i,0)),`\r
|
| 27 |
+
`);u-=s(u),r-=s(r),o-=s(o),e=ju(e)}return{hasBOM:a,text:e,options:Nn(e,{...t,cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n})}}async function Sn(e,t){let u=await We(t);return!u.hasPragma||u.hasPragma(e)}async function ja(e,t){return(await We(t)).hasIgnorePragma?.(e)}async function Su(e,t){let{hasBOM:u,text:r,options:o}=Pn(e,await se(t));if(o.rangeStart>=o.rangeEnd&&r!==""||o.requirePragma&&!await Sn(r,o)||o.checkIgnorePragma&&await ja(r,o))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let n;return o.rangeStart>0||o.rangeEnd<r.length?n=await Ya(r,o):(!o.requirePragma&&o.insertPragma&&o.printer.insertPragma&&!await Sn(r,o)&&(r=o.printer.insertPragma(r)),n=await On(r,o)),u&&(n.formatted=wn+n.formatted,n.cursorOffset>=0&&n.cursorOffset++),n}async function In(e,t,u){let{text:r,options:o}=Pn(e,await se(t)),n=await Fe(r,o);return u&&(u.preprocessForPrint&&(n.ast=await xu(n.ast,o)),u.massage&&(n.ast=yn(n.ast,o))),n}async function kn(e,t){t=await se(t);let u=await Ge(e,t);return Ce(u,t)}async function vn(e,t){let u=sr(e),{formatted:r}=await Su(u,{...t,parser:"__js_expression"});return r}async function Rn(e,t){t=await se(t);let{ast:u}=await Fe(e,t);return t.cursorOffset>=0&&(t={...t,...Bu(u,t)}),Ge(u,t)}async function Ln(e,t){return Ce(e,await se(t))}var wu={};Yt(wu,{builders:()=>Wa,printer:()=>$a,utils:()=>Va});var Wa={join:Ie,line:ut,softline:or,hardline:V,literalline:Qe,group:Kt,conditionalGroup:tr,fill:er,lineSuffix:ve,lineSuffixBoundary:ar,cursor:ee,breakParent:ce,ifBreak:ur,trim:ir,indent:ae,indentIfBreak:rr,align:De,addAlignmentToDoc:tt,markAsRoot:et,dedentToRoot:Qu,dedent:Zu,hardlineWithoutBreakParent:ke,literallineWithoutBreakParent:Gt,label:nr,concat:e=>e},$a={printDocToString:Ce},Va={willBreak:Ku,traverseDoc:we,findInDoc:Xe,mapDoc:Pe,removeLines:zu,stripTrailingHardline:qe,replaceEndOfLine:Ju,canBreak:Hu};var Mn="3.8.3";var Pu={};Yt(Pu,{addDanglingComment:()=>ue,addLeadingComment:()=>fe,addTrailingComment:()=>le,getAlignmentSize:()=>he,getIndentSize:()=>Yn,getMaxContinuousCount:()=>jn,getNextNonSpaceNonCommentCharacter:()=>Un,getNextNonSpaceNonCommentCharacterIndex:()=>ni,getPreferredQuote:()=>Vn,getStringWidth:()=>Re,hasNewline:()=>z,hasNewlineInRange:()=>Kn,hasSpaces:()=>Gn,isNextLineEmpty:()=>Di,isNextLineEmptyAfterIndex:()=>kt,isPreviousLineEmpty:()=>ai,makeString:()=>si,skip:()=>ye,skipEverythingButNewLine:()=>ot,skipInlineComment:()=>xe,skipNewline:()=>K,skipSpaces:()=>Y,skipToLineEnd:()=>nt,skipTrailingComment:()=>Be,skipWhitespace:()=>Fr});function Ka(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let u=t+2;u<e.length;++u)if(e.charAt(u)==="*"&&e.charAt(u+1)==="/")return u+2}return t}var xe=Ka;function Ga(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?ot(e,t):t}var Be=Ga;function za(e,t){let u=null,r=t;for(;r!==u;)u=r,r=Y(e,r),r=xe(e,r),r=Be(e,r),r=K(e,r);return r}var ze=za;function Ja(e,t){let u=null,r=t;for(;r!==u;)u=r,r=nt(e,r),r=xe(e,r),r=Y(e,r);return r=Be(e,r),r=K(e,r),r!==!1&&z(e,r)}var kt=Ja;function Ha(e,t){let u=e.lastIndexOf(`
|
| 28 |
+
`);return u===-1?0:he(e.slice(u+1).match(/^[\t ]*/u)[0],t)}var Yn=Ha;function Ou(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Xa(e,t){let u=e.matchAll(new RegExp(`(?:${Ou(t)})+`,"gu"));return u.reduce||(u=[...u]),u.reduce((r,[o])=>Math.max(r,o.length),0)/t.length}var jn=Xa;function qa(e,t){let u=ze(e,t);return u===!1?"":e.charAt(u)}var Un=qa;var Wn=Object.freeze({character:"'",codePoint:39}),$n=Object.freeze({character:'"',codePoint:34}),Qa=Object.freeze({preferred:Wn,alternate:$n}),Za=Object.freeze({preferred:$n,alternate:Wn});function ei(e,t){let{preferred:u,alternate:r}=t===!0||t==="'"?Qa:Za,{length:o}=e,n=0,a=0;for(let s=0;s<o;s++){let i=e.charCodeAt(s);i===u.codePoint?n++:i===r.codePoint&&a++}return(n>a?r:u).character}var Vn=ei;function ti(e,t,u){for(let r=t;r<u;++r)if(e.charAt(r)===`
|
| 29 |
+
`)return!0;return!1}var Kn=ti;function ui(e,t,u={}){return Y(e,u.backwards?t-1:t,u)!==t}var Gn=ui;function ri(e,t,u){return ze(e,u(t))}function ni(e,t){return arguments.length===2||typeof t=="number"?ze(e,t):ri(...arguments)}function oi(e,t,u){return Le(e,u(t))}function ai(e,t){return arguments.length===2||typeof t=="number"?Le(e,t):oi(...arguments)}function ii(e,t,u){return kt(e,u(t))}function si(e,t,u){let r=t==='"'?"'":'"',n=oe(0,e,/\\(.)|(["'])/gsu,(a,s,i)=>s===r?s:i===t?"\\"+i:i||(u&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(s)?s:"\\"+s));return t+n+t}function Di(e,t){return arguments.length===2||typeof t=="number"?kt(e,t):ii(...arguments)}function me(e,t=1){return async(...u)=>{let r=u[t]??{},o=r.plugins??[];return u[t]={...r,plugins:Array.isArray(o)?o:Object.values(o)},e(...u)}}var zn=me(Su);async function Jn(e,t){let{formatted:u}=await zn(e,{...t,cursorOffset:-1});return u}async function ci(e,t){return await Jn(e,t)===e}var fi=me(it,0),li={parse:me(In),formatAST:me(kn),formatDoc:me(vn),printToDoc:me(Rn),printDocToString:me(Ln)};export{li as __debug,ci as check,Hn as default,wu as doc,Jn as format,zn as formatWithCursor,fi as getSupportInfo,Pu as util,Mn as version};
|
shared/node_modules/rolldown/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2024-present VoidZero Inc. & Contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
| 22 |
+
|
| 23 |
+
end of terms and conditions
|
| 24 |
+
|
| 25 |
+
The licenses of externally maintained libraries from which parts of the Software is derived are listed [here](https://github.com/rolldown/rolldown/blob/main/THIRD-PARTY-LICENSE).
|
shared/node_modules/rolldown/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Rolldown
|
| 2 |
+
|
| 3 |
+
> Fast Rust-based bundler for JavaScript with Rollup-compatible API
|
| 4 |
+
|
| 5 |
+
- ⚡️ Lightning Fast Performance
|
| 6 |
+
- 🔌 Rollup-Compatible APIs
|
| 7 |
+
- ⏩ esbuild Feature Parity
|
| 8 |
+
|
| 9 |
+
Rolldown is primarily designed to serve as the underlying bundler in [Vite](https://vite.dev/), with the goal to replace esbuild and Rollup with one unified build tool. Although designed for Vite, Rolldown is also fully capable of being used as a standalone, general-purpose bundler. It can serve as a drop-in replacement for Rollup in most cases, and can also be used as an esbuild alternative when better chunking control is needed.
|
| 10 |
+
|
| 11 |
+
[Read the Docs to Learn More](https://rolldown.rs).
|
shared/node_modules/rolldown/bin/cli.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
import '../dist/cli.mjs';
|
shared/node_modules/rolldown/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export { };
|
shared/node_modules/rolldown/dist/cli.mjs
ADDED
|
@@ -0,0 +1,1191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { n as onExit, t as watch } from "./shared/watch-eT_pxdfY.mjs";
|
| 2 |
+
import { C as version, S as description } from "./shared/bindingify-input-options-B7_WBoOp.mjs";
|
| 3 |
+
import { t as arraify } from "./shared/misc-CoQm4NHO.mjs";
|
| 4 |
+
import { a as getInputCliKeys, i as getCliSchemaInfo, l as styleText, o as getOutputCliKeys, r as logger, s as validateCliOptions } from "./shared/rolldown-build-abS241_6.mjs";
|
| 5 |
+
import { t as rolldown } from "./shared/rolldown-Bkyb2CgX.mjs";
|
| 6 |
+
import { t as loadConfig } from "./shared/load-config-BDGEgD4M.mjs";
|
| 7 |
+
import path from "node:path";
|
| 8 |
+
import process$1 from "node:process";
|
| 9 |
+
import { performance } from "node:perf_hooks";
|
| 10 |
+
//#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
|
| 11 |
+
function toArr(any) {
|
| 12 |
+
return any == null ? [] : Array.isArray(any) ? any : [any];
|
| 13 |
+
}
|
| 14 |
+
function toVal(out, key, val, opts) {
|
| 15 |
+
var x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
|
| 16 |
+
out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
|
| 17 |
+
}
|
| 18 |
+
function lib_default(args, opts) {
|
| 19 |
+
args = args || [];
|
| 20 |
+
opts = opts || {};
|
| 21 |
+
var k, arr, arg, name, val, out = { _: [] };
|
| 22 |
+
var i = 0, j = 0, idx = 0, len = args.length;
|
| 23 |
+
const alibi = opts.alias !== void 0;
|
| 24 |
+
const strict = opts.unknown !== void 0;
|
| 25 |
+
const defaults = opts.default !== void 0;
|
| 26 |
+
opts.alias = opts.alias || {};
|
| 27 |
+
opts.string = toArr(opts.string);
|
| 28 |
+
opts.boolean = toArr(opts.boolean);
|
| 29 |
+
if (alibi) for (k in opts.alias) {
|
| 30 |
+
arr = opts.alias[k] = toArr(opts.alias[k]);
|
| 31 |
+
for (i = 0; i < arr.length; i++) (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
|
| 32 |
+
}
|
| 33 |
+
for (i = opts.boolean.length; i-- > 0;) {
|
| 34 |
+
arr = opts.alias[opts.boolean[i]] || [];
|
| 35 |
+
for (j = arr.length; j-- > 0;) opts.boolean.push(arr[j]);
|
| 36 |
+
}
|
| 37 |
+
for (i = opts.string.length; i-- > 0;) {
|
| 38 |
+
arr = opts.alias[opts.string[i]] || [];
|
| 39 |
+
for (j = arr.length; j-- > 0;) opts.string.push(arr[j]);
|
| 40 |
+
}
|
| 41 |
+
if (defaults) for (k in opts.default) {
|
| 42 |
+
name = typeof opts.default[k];
|
| 43 |
+
arr = opts.alias[k] = opts.alias[k] || [];
|
| 44 |
+
if (opts[name] !== void 0) {
|
| 45 |
+
opts[name].push(k);
|
| 46 |
+
for (i = 0; i < arr.length; i++) opts[name].push(arr[i]);
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
const keys = strict ? Object.keys(opts.alias) : [];
|
| 50 |
+
for (i = 0; i < len; i++) {
|
| 51 |
+
arg = args[i];
|
| 52 |
+
if (arg === "--") {
|
| 53 |
+
out._ = out._.concat(args.slice(++i));
|
| 54 |
+
break;
|
| 55 |
+
}
|
| 56 |
+
for (j = 0; j < arg.length; j++) if (arg.charCodeAt(j) !== 45) break;
|
| 57 |
+
if (j === 0) out._.push(arg);
|
| 58 |
+
else if (arg.substring(j, j + 3) === "no-") {
|
| 59 |
+
name = arg.substring(j + 3);
|
| 60 |
+
if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
|
| 61 |
+
out[name] = false;
|
| 62 |
+
} else {
|
| 63 |
+
for (idx = j + 1; idx < arg.length; idx++) if (arg.charCodeAt(idx) === 61) break;
|
| 64 |
+
name = arg.substring(j, idx);
|
| 65 |
+
val = arg.substring(++idx) || i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i];
|
| 66 |
+
arr = j === 2 ? [name] : name;
|
| 67 |
+
for (idx = 0; idx < arr.length; idx++) {
|
| 68 |
+
name = arr[idx];
|
| 69 |
+
if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
|
| 70 |
+
toVal(out, name, idx + 1 < arr.length || val, opts);
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
if (defaults) {
|
| 75 |
+
for (k in opts.default) if (out[k] === void 0) out[k] = opts.default[k];
|
| 76 |
+
}
|
| 77 |
+
if (alibi) for (k in out) {
|
| 78 |
+
arr = opts.alias[k] || [];
|
| 79 |
+
while (arr.length > 0) out[arr.shift()] = out[k];
|
| 80 |
+
}
|
| 81 |
+
return out;
|
| 82 |
+
}
|
| 83 |
+
function removeBrackets(v) {
|
| 84 |
+
return v.replace(/[<[].+/, "").trim();
|
| 85 |
+
}
|
| 86 |
+
function findAllBrackets(v) {
|
| 87 |
+
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
|
| 88 |
+
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
|
| 89 |
+
const res = [];
|
| 90 |
+
const parse = (match) => {
|
| 91 |
+
let variadic = false;
|
| 92 |
+
let value = match[1];
|
| 93 |
+
if (value.startsWith("...")) {
|
| 94 |
+
value = value.slice(3);
|
| 95 |
+
variadic = true;
|
| 96 |
+
}
|
| 97 |
+
return {
|
| 98 |
+
required: match[0].startsWith("<"),
|
| 99 |
+
value,
|
| 100 |
+
variadic
|
| 101 |
+
};
|
| 102 |
+
};
|
| 103 |
+
let angledMatch;
|
| 104 |
+
while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(angledMatch));
|
| 105 |
+
let squareMatch;
|
| 106 |
+
while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(squareMatch));
|
| 107 |
+
return res;
|
| 108 |
+
}
|
| 109 |
+
function getMriOptions(options) {
|
| 110 |
+
const result = {
|
| 111 |
+
alias: {},
|
| 112 |
+
boolean: []
|
| 113 |
+
};
|
| 114 |
+
for (const [index, option] of options.entries()) {
|
| 115 |
+
if (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);
|
| 116 |
+
if (option.isBoolean) if (option.negated) {
|
| 117 |
+
if (!options.some((o, i) => {
|
| 118 |
+
return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
|
| 119 |
+
})) result.boolean.push(option.names[0]);
|
| 120 |
+
} else result.boolean.push(option.names[0]);
|
| 121 |
+
}
|
| 122 |
+
return result;
|
| 123 |
+
}
|
| 124 |
+
function findLongest(arr) {
|
| 125 |
+
return arr.sort((a, b) => {
|
| 126 |
+
return a.length > b.length ? -1 : 1;
|
| 127 |
+
})[0];
|
| 128 |
+
}
|
| 129 |
+
function padRight(str, length) {
|
| 130 |
+
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
|
| 131 |
+
}
|
| 132 |
+
function camelcase(input) {
|
| 133 |
+
return input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2) => {
|
| 134 |
+
return p1 + p2.toUpperCase();
|
| 135 |
+
});
|
| 136 |
+
}
|
| 137 |
+
function setDotProp(obj, keys, val) {
|
| 138 |
+
let current = obj;
|
| 139 |
+
for (let i = 0; i < keys.length; i++) {
|
| 140 |
+
const key = keys[i];
|
| 141 |
+
if (i === keys.length - 1) {
|
| 142 |
+
current[key] = val;
|
| 143 |
+
return;
|
| 144 |
+
}
|
| 145 |
+
if (current[key] == null) {
|
| 146 |
+
const nextKeyIsArrayIndex = +keys[i + 1] > -1;
|
| 147 |
+
current[key] = nextKeyIsArrayIndex ? [] : {};
|
| 148 |
+
}
|
| 149 |
+
current = current[key];
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
function setByType(obj, transforms) {
|
| 153 |
+
for (const key of Object.keys(transforms)) {
|
| 154 |
+
const transform = transforms[key];
|
| 155 |
+
if (transform.shouldTransform) {
|
| 156 |
+
obj[key] = [obj[key]].flat();
|
| 157 |
+
if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
+
function getFileName(input) {
|
| 162 |
+
const m = /([^\\/]+)$/.exec(input);
|
| 163 |
+
return m ? m[1] : "";
|
| 164 |
+
}
|
| 165 |
+
function camelcaseOptionName(name) {
|
| 166 |
+
return name.split(".").map((v, i) => {
|
| 167 |
+
return i === 0 ? camelcase(v) : v;
|
| 168 |
+
}).join(".");
|
| 169 |
+
}
|
| 170 |
+
var CACError = class extends Error {
|
| 171 |
+
constructor(message) {
|
| 172 |
+
super(message);
|
| 173 |
+
this.name = "CACError";
|
| 174 |
+
if (typeof Error.captureStackTrace !== "function") this.stack = new Error(message).stack;
|
| 175 |
+
}
|
| 176 |
+
};
|
| 177 |
+
var Option = class {
|
| 178 |
+
rawName;
|
| 179 |
+
description;
|
| 180 |
+
/** Option name */
|
| 181 |
+
name;
|
| 182 |
+
/** Option name and aliases */
|
| 183 |
+
names;
|
| 184 |
+
isBoolean;
|
| 185 |
+
required;
|
| 186 |
+
config;
|
| 187 |
+
negated;
|
| 188 |
+
constructor(rawName, description, config) {
|
| 189 |
+
this.rawName = rawName;
|
| 190 |
+
this.description = description;
|
| 191 |
+
this.config = Object.assign({}, config);
|
| 192 |
+
rawName = rawName.replaceAll(".*", "");
|
| 193 |
+
this.negated = false;
|
| 194 |
+
this.names = removeBrackets(rawName).split(",").map((v) => {
|
| 195 |
+
let name = v.trim().replace(/^-{1,2}/, "");
|
| 196 |
+
if (name.startsWith("no-")) {
|
| 197 |
+
this.negated = true;
|
| 198 |
+
name = name.replace(/^no-/, "");
|
| 199 |
+
}
|
| 200 |
+
return camelcaseOptionName(name);
|
| 201 |
+
}).sort((a, b) => a.length > b.length ? 1 : -1);
|
| 202 |
+
this.name = this.names.at(-1);
|
| 203 |
+
if (this.negated && this.config.default == null) this.config.default = true;
|
| 204 |
+
if (rawName.includes("<")) this.required = true;
|
| 205 |
+
else if (rawName.includes("[")) this.required = false;
|
| 206 |
+
else this.isBoolean = true;
|
| 207 |
+
}
|
| 208 |
+
};
|
| 209 |
+
let runtimeProcessArgs;
|
| 210 |
+
let runtimeInfo;
|
| 211 |
+
if (typeof process !== "undefined") {
|
| 212 |
+
let runtimeName;
|
| 213 |
+
if (typeof Deno !== "undefined" && typeof Deno.version?.deno === "string") runtimeName = "deno";
|
| 214 |
+
else if (typeof Bun !== "undefined" && typeof Bun.version === "string") runtimeName = "bun";
|
| 215 |
+
else runtimeName = "node";
|
| 216 |
+
runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;
|
| 217 |
+
runtimeProcessArgs = process.argv;
|
| 218 |
+
} else if (typeof navigator === "undefined") runtimeInfo = `unknown`;
|
| 219 |
+
else runtimeInfo = `${navigator.platform} ${navigator.userAgent}`;
|
| 220 |
+
var Command = class {
|
| 221 |
+
rawName;
|
| 222 |
+
description;
|
| 223 |
+
config;
|
| 224 |
+
cli;
|
| 225 |
+
options;
|
| 226 |
+
aliasNames;
|
| 227 |
+
name;
|
| 228 |
+
args;
|
| 229 |
+
commandAction;
|
| 230 |
+
usageText;
|
| 231 |
+
versionNumber;
|
| 232 |
+
examples;
|
| 233 |
+
helpCallback;
|
| 234 |
+
globalCommand;
|
| 235 |
+
constructor(rawName, description, config = {}, cli) {
|
| 236 |
+
this.rawName = rawName;
|
| 237 |
+
this.description = description;
|
| 238 |
+
this.config = config;
|
| 239 |
+
this.cli = cli;
|
| 240 |
+
this.options = [];
|
| 241 |
+
this.aliasNames = [];
|
| 242 |
+
this.name = removeBrackets(rawName);
|
| 243 |
+
this.args = findAllBrackets(rawName);
|
| 244 |
+
this.examples = [];
|
| 245 |
+
}
|
| 246 |
+
usage(text) {
|
| 247 |
+
this.usageText = text;
|
| 248 |
+
return this;
|
| 249 |
+
}
|
| 250 |
+
allowUnknownOptions() {
|
| 251 |
+
this.config.allowUnknownOptions = true;
|
| 252 |
+
return this;
|
| 253 |
+
}
|
| 254 |
+
ignoreOptionDefaultValue() {
|
| 255 |
+
this.config.ignoreOptionDefaultValue = true;
|
| 256 |
+
return this;
|
| 257 |
+
}
|
| 258 |
+
version(version, customFlags = "-v, --version") {
|
| 259 |
+
this.versionNumber = version;
|
| 260 |
+
this.option(customFlags, "Display version number");
|
| 261 |
+
return this;
|
| 262 |
+
}
|
| 263 |
+
example(example) {
|
| 264 |
+
this.examples.push(example);
|
| 265 |
+
return this;
|
| 266 |
+
}
|
| 267 |
+
/**
|
| 268 |
+
* Add a option for this command
|
| 269 |
+
* @param rawName Raw option name(s)
|
| 270 |
+
* @param description Option description
|
| 271 |
+
* @param config Option config
|
| 272 |
+
*/
|
| 273 |
+
option(rawName, description, config) {
|
| 274 |
+
const option = new Option(rawName, description, config);
|
| 275 |
+
this.options.push(option);
|
| 276 |
+
return this;
|
| 277 |
+
}
|
| 278 |
+
alias(name) {
|
| 279 |
+
this.aliasNames.push(name);
|
| 280 |
+
return this;
|
| 281 |
+
}
|
| 282 |
+
action(callback) {
|
| 283 |
+
this.commandAction = callback;
|
| 284 |
+
return this;
|
| 285 |
+
}
|
| 286 |
+
/**
|
| 287 |
+
* Check if a command name is matched by this command
|
| 288 |
+
* @param name Command name
|
| 289 |
+
*/
|
| 290 |
+
isMatched(name) {
|
| 291 |
+
return this.name === name || this.aliasNames.includes(name);
|
| 292 |
+
}
|
| 293 |
+
get isDefaultCommand() {
|
| 294 |
+
return this.name === "" || this.aliasNames.includes("!");
|
| 295 |
+
}
|
| 296 |
+
get isGlobalCommand() {
|
| 297 |
+
return this instanceof GlobalCommand;
|
| 298 |
+
}
|
| 299 |
+
/**
|
| 300 |
+
* Check if an option is registered in this command
|
| 301 |
+
* @param name Option name
|
| 302 |
+
*/
|
| 303 |
+
hasOption(name) {
|
| 304 |
+
name = name.split(".")[0];
|
| 305 |
+
return this.options.find((option) => {
|
| 306 |
+
return option.names.includes(name);
|
| 307 |
+
});
|
| 308 |
+
}
|
| 309 |
+
outputHelp() {
|
| 310 |
+
const { name, commands } = this.cli;
|
| 311 |
+
const { versionNumber, options: globalOptions, helpCallback } = this.cli.globalCommand;
|
| 312 |
+
let sections = [{ body: `${name}${versionNumber ? `/${versionNumber}` : ""}` }];
|
| 313 |
+
sections.push({
|
| 314 |
+
title: "Usage",
|
| 315 |
+
body: ` $ ${name} ${this.usageText || this.rawName}`
|
| 316 |
+
});
|
| 317 |
+
if ((this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0) {
|
| 318 |
+
const longestCommandName = findLongest(commands.map((command) => command.rawName));
|
| 319 |
+
sections.push({
|
| 320 |
+
title: "Commands",
|
| 321 |
+
body: commands.map((command) => {
|
| 322 |
+
return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
|
| 323 |
+
}).join("\n")
|
| 324 |
+
}, {
|
| 325 |
+
title: `For more info, run any command with the \`--help\` flag`,
|
| 326 |
+
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
|
| 327 |
+
});
|
| 328 |
+
}
|
| 329 |
+
let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
|
| 330 |
+
if (!this.isGlobalCommand && !this.isDefaultCommand) options = options.filter((option) => option.name !== "version");
|
| 331 |
+
if (options.length > 0) {
|
| 332 |
+
const longestOptionName = findLongest(options.map((option) => option.rawName));
|
| 333 |
+
sections.push({
|
| 334 |
+
title: "Options",
|
| 335 |
+
body: options.map((option) => {
|
| 336 |
+
return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
|
| 337 |
+
}).join("\n")
|
| 338 |
+
});
|
| 339 |
+
}
|
| 340 |
+
if (this.examples.length > 0) sections.push({
|
| 341 |
+
title: "Examples",
|
| 342 |
+
body: this.examples.map((example) => {
|
| 343 |
+
if (typeof example === "function") return example(name);
|
| 344 |
+
return example;
|
| 345 |
+
}).join("\n")
|
| 346 |
+
});
|
| 347 |
+
if (helpCallback) sections = helpCallback(sections) || sections;
|
| 348 |
+
console.info(sections.map((section) => {
|
| 349 |
+
return section.title ? `${section.title}:\n${section.body}` : section.body;
|
| 350 |
+
}).join("\n\n"));
|
| 351 |
+
}
|
| 352 |
+
outputVersion() {
|
| 353 |
+
const { name } = this.cli;
|
| 354 |
+
const { versionNumber } = this.cli.globalCommand;
|
| 355 |
+
if (versionNumber) console.info(`${name}/${versionNumber} ${runtimeInfo}`);
|
| 356 |
+
}
|
| 357 |
+
checkRequiredArgs() {
|
| 358 |
+
const minimalArgsCount = this.args.filter((arg) => arg.required).length;
|
| 359 |
+
if (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \`${this.rawName}\``);
|
| 360 |
+
}
|
| 361 |
+
/**
|
| 362 |
+
* Check if the parsed options contain any unknown options
|
| 363 |
+
*
|
| 364 |
+
* Exit and output error when true
|
| 365 |
+
*/
|
| 366 |
+
checkUnknownOptions() {
|
| 367 |
+
const { options, globalCommand } = this.cli;
|
| 368 |
+
if (!this.config.allowUnknownOptions) {
|
| 369 |
+
for (const name of Object.keys(options)) if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
|
| 370 |
+
}
|
| 371 |
+
}
|
| 372 |
+
/**
|
| 373 |
+
* Check if the required string-type options exist
|
| 374 |
+
*/
|
| 375 |
+
checkOptionValue() {
|
| 376 |
+
const { options: parsedOptions, globalCommand } = this.cli;
|
| 377 |
+
const options = [...globalCommand.options, ...this.options];
|
| 378 |
+
for (const option of options) {
|
| 379 |
+
const value = parsedOptions[option.name.split(".")[0]];
|
| 380 |
+
if (option.required) {
|
| 381 |
+
const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
|
| 382 |
+
if (value === true || value === false && !hasNegated) throw new CACError(`option \`${option.rawName}\` value is missing`);
|
| 383 |
+
}
|
| 384 |
+
}
|
| 385 |
+
}
|
| 386 |
+
/**
|
| 387 |
+
* Check if the number of args is more than expected
|
| 388 |
+
*/
|
| 389 |
+
checkUnusedArgs() {
|
| 390 |
+
const maximumArgsCount = this.args.some((arg) => arg.variadic) ? Infinity : this.args.length;
|
| 391 |
+
if (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg) => `\`${arg}\``).join(", ")}`);
|
| 392 |
+
}
|
| 393 |
+
};
|
| 394 |
+
var GlobalCommand = class extends Command {
|
| 395 |
+
constructor(cli) {
|
| 396 |
+
super("@@global@@", "", {}, cli);
|
| 397 |
+
}
|
| 398 |
+
};
|
| 399 |
+
var CAC = class extends EventTarget {
|
| 400 |
+
/** The program name to display in help and version message */
|
| 401 |
+
name;
|
| 402 |
+
commands;
|
| 403 |
+
globalCommand;
|
| 404 |
+
matchedCommand;
|
| 405 |
+
matchedCommandName;
|
| 406 |
+
/**
|
| 407 |
+
* Raw CLI arguments
|
| 408 |
+
*/
|
| 409 |
+
rawArgs;
|
| 410 |
+
/**
|
| 411 |
+
* Parsed CLI arguments
|
| 412 |
+
*/
|
| 413 |
+
args;
|
| 414 |
+
/**
|
| 415 |
+
* Parsed CLI options, camelCased
|
| 416 |
+
*/
|
| 417 |
+
options;
|
| 418 |
+
showHelpOnExit;
|
| 419 |
+
showVersionOnExit;
|
| 420 |
+
/**
|
| 421 |
+
* @param name The program name to display in help and version message
|
| 422 |
+
*/
|
| 423 |
+
constructor(name = "") {
|
| 424 |
+
super();
|
| 425 |
+
this.name = name;
|
| 426 |
+
this.commands = [];
|
| 427 |
+
this.rawArgs = [];
|
| 428 |
+
this.args = [];
|
| 429 |
+
this.options = {};
|
| 430 |
+
this.globalCommand = new GlobalCommand(this);
|
| 431 |
+
this.globalCommand.usage("<command> [options]");
|
| 432 |
+
}
|
| 433 |
+
/**
|
| 434 |
+
* Add a global usage text.
|
| 435 |
+
*
|
| 436 |
+
* This is not used by sub-commands.
|
| 437 |
+
*/
|
| 438 |
+
usage(text) {
|
| 439 |
+
this.globalCommand.usage(text);
|
| 440 |
+
return this;
|
| 441 |
+
}
|
| 442 |
+
/**
|
| 443 |
+
* Add a sub-command
|
| 444 |
+
*/
|
| 445 |
+
command(rawName, description, config) {
|
| 446 |
+
const command = new Command(rawName, description || "", config, this);
|
| 447 |
+
command.globalCommand = this.globalCommand;
|
| 448 |
+
this.commands.push(command);
|
| 449 |
+
return command;
|
| 450 |
+
}
|
| 451 |
+
/**
|
| 452 |
+
* Add a global CLI option.
|
| 453 |
+
*
|
| 454 |
+
* Which is also applied to sub-commands.
|
| 455 |
+
*/
|
| 456 |
+
option(rawName, description, config) {
|
| 457 |
+
this.globalCommand.option(rawName, description, config);
|
| 458 |
+
return this;
|
| 459 |
+
}
|
| 460 |
+
/**
|
| 461 |
+
* Show help message when `-h, --help` flags appear.
|
| 462 |
+
*
|
| 463 |
+
*/
|
| 464 |
+
help(callback) {
|
| 465 |
+
this.globalCommand.option("-h, --help", "Display this message");
|
| 466 |
+
this.globalCommand.helpCallback = callback;
|
| 467 |
+
this.showHelpOnExit = true;
|
| 468 |
+
return this;
|
| 469 |
+
}
|
| 470 |
+
/**
|
| 471 |
+
* Show version number when `-v, --version` flags appear.
|
| 472 |
+
*
|
| 473 |
+
*/
|
| 474 |
+
version(version, customFlags = "-v, --version") {
|
| 475 |
+
this.globalCommand.version(version, customFlags);
|
| 476 |
+
this.showVersionOnExit = true;
|
| 477 |
+
return this;
|
| 478 |
+
}
|
| 479 |
+
/**
|
| 480 |
+
* Add a global example.
|
| 481 |
+
*
|
| 482 |
+
* This example added here will not be used by sub-commands.
|
| 483 |
+
*/
|
| 484 |
+
example(example) {
|
| 485 |
+
this.globalCommand.example(example);
|
| 486 |
+
return this;
|
| 487 |
+
}
|
| 488 |
+
/**
|
| 489 |
+
* Output the corresponding help message
|
| 490 |
+
* When a sub-command is matched, output the help message for the command
|
| 491 |
+
* Otherwise output the global one.
|
| 492 |
+
*
|
| 493 |
+
*/
|
| 494 |
+
outputHelp() {
|
| 495 |
+
if (this.matchedCommand) this.matchedCommand.outputHelp();
|
| 496 |
+
else this.globalCommand.outputHelp();
|
| 497 |
+
}
|
| 498 |
+
/**
|
| 499 |
+
* Output the version number.
|
| 500 |
+
*
|
| 501 |
+
*/
|
| 502 |
+
outputVersion() {
|
| 503 |
+
this.globalCommand.outputVersion();
|
| 504 |
+
}
|
| 505 |
+
setParsedInfo({ args, options }, matchedCommand, matchedCommandName) {
|
| 506 |
+
this.args = args;
|
| 507 |
+
this.options = options;
|
| 508 |
+
if (matchedCommand) this.matchedCommand = matchedCommand;
|
| 509 |
+
if (matchedCommandName) this.matchedCommandName = matchedCommandName;
|
| 510 |
+
return this;
|
| 511 |
+
}
|
| 512 |
+
unsetMatchedCommand() {
|
| 513 |
+
this.matchedCommand = void 0;
|
| 514 |
+
this.matchedCommandName = void 0;
|
| 515 |
+
}
|
| 516 |
+
/**
|
| 517 |
+
* Parse argv
|
| 518 |
+
*/
|
| 519 |
+
parse(argv, { run = true } = {}) {
|
| 520 |
+
if (!argv) {
|
| 521 |
+
if (!runtimeProcessArgs) throw new Error("No argv provided and runtime process argv is not available.");
|
| 522 |
+
argv = runtimeProcessArgs;
|
| 523 |
+
}
|
| 524 |
+
this.rawArgs = argv;
|
| 525 |
+
if (!this.name) this.name = argv[1] ? getFileName(argv[1]) : "cli";
|
| 526 |
+
let shouldParse = true;
|
| 527 |
+
for (const command of this.commands) {
|
| 528 |
+
const parsed = this.mri(argv.slice(2), command);
|
| 529 |
+
const commandName = parsed.args[0];
|
| 530 |
+
if (command.isMatched(commandName)) {
|
| 531 |
+
shouldParse = false;
|
| 532 |
+
const parsedInfo = {
|
| 533 |
+
...parsed,
|
| 534 |
+
args: parsed.args.slice(1)
|
| 535 |
+
};
|
| 536 |
+
this.setParsedInfo(parsedInfo, command, commandName);
|
| 537 |
+
this.dispatchEvent(new CustomEvent(`command:${commandName}`, { detail: command }));
|
| 538 |
+
}
|
| 539 |
+
}
|
| 540 |
+
if (shouldParse) {
|
| 541 |
+
for (const command of this.commands) if (command.isDefaultCommand) {
|
| 542 |
+
shouldParse = false;
|
| 543 |
+
const parsed = this.mri(argv.slice(2), command);
|
| 544 |
+
this.setParsedInfo(parsed, command);
|
| 545 |
+
this.dispatchEvent(new CustomEvent("command:!", { detail: command }));
|
| 546 |
+
}
|
| 547 |
+
}
|
| 548 |
+
if (shouldParse) {
|
| 549 |
+
const parsed = this.mri(argv.slice(2));
|
| 550 |
+
this.setParsedInfo(parsed);
|
| 551 |
+
}
|
| 552 |
+
if (this.options.help && this.showHelpOnExit) {
|
| 553 |
+
this.outputHelp();
|
| 554 |
+
run = false;
|
| 555 |
+
this.unsetMatchedCommand();
|
| 556 |
+
}
|
| 557 |
+
if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
|
| 558 |
+
this.outputVersion();
|
| 559 |
+
run = false;
|
| 560 |
+
this.unsetMatchedCommand();
|
| 561 |
+
}
|
| 562 |
+
const parsedArgv = {
|
| 563 |
+
args: this.args,
|
| 564 |
+
options: this.options
|
| 565 |
+
};
|
| 566 |
+
if (run) this.runMatchedCommand();
|
| 567 |
+
if (!this.matchedCommand && this.args[0]) this.dispatchEvent(new CustomEvent("command:*", { detail: this.args[0] }));
|
| 568 |
+
return parsedArgv;
|
| 569 |
+
}
|
| 570 |
+
mri(argv, command) {
|
| 571 |
+
const cliOptions = [...this.globalCommand.options, ...command ? command.options : []];
|
| 572 |
+
const mriOptions = getMriOptions(cliOptions);
|
| 573 |
+
let argsAfterDoubleDashes = [];
|
| 574 |
+
const doubleDashesIndex = argv.indexOf("--");
|
| 575 |
+
if (doubleDashesIndex !== -1) {
|
| 576 |
+
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
|
| 577 |
+
argv = argv.slice(0, doubleDashesIndex);
|
| 578 |
+
}
|
| 579 |
+
let parsed = lib_default(argv, mriOptions);
|
| 580 |
+
parsed = Object.keys(parsed).reduce((res, name) => {
|
| 581 |
+
return {
|
| 582 |
+
...res,
|
| 583 |
+
[camelcaseOptionName(name)]: parsed[name]
|
| 584 |
+
};
|
| 585 |
+
}, { _: [] });
|
| 586 |
+
const args = parsed._;
|
| 587 |
+
const options = { "--": argsAfterDoubleDashes };
|
| 588 |
+
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
|
| 589 |
+
const transforms = Object.create(null);
|
| 590 |
+
for (const cliOption of cliOptions) {
|
| 591 |
+
if (!ignoreDefault && cliOption.config.default !== void 0) for (const name of cliOption.names) options[name] = cliOption.config.default;
|
| 592 |
+
if (Array.isArray(cliOption.config.type) && transforms[cliOption.name] === void 0) {
|
| 593 |
+
transforms[cliOption.name] = Object.create(null);
|
| 594 |
+
transforms[cliOption.name].shouldTransform = true;
|
| 595 |
+
transforms[cliOption.name].transformFunction = cliOption.config.type[0];
|
| 596 |
+
}
|
| 597 |
+
}
|
| 598 |
+
for (const key of Object.keys(parsed)) if (key !== "_") {
|
| 599 |
+
setDotProp(options, key.split("."), parsed[key]);
|
| 600 |
+
setByType(options, transforms);
|
| 601 |
+
}
|
| 602 |
+
return {
|
| 603 |
+
args,
|
| 604 |
+
options
|
| 605 |
+
};
|
| 606 |
+
}
|
| 607 |
+
runMatchedCommand() {
|
| 608 |
+
const { args, options, matchedCommand: command } = this;
|
| 609 |
+
if (!command || !command.commandAction) return;
|
| 610 |
+
command.checkUnknownOptions();
|
| 611 |
+
command.checkOptionValue();
|
| 612 |
+
command.checkRequiredArgs();
|
| 613 |
+
command.checkUnusedArgs();
|
| 614 |
+
const actionArgs = [];
|
| 615 |
+
command.args.forEach((arg, index) => {
|
| 616 |
+
if (arg.variadic) actionArgs.push(args.slice(index));
|
| 617 |
+
else actionArgs.push(args[index]);
|
| 618 |
+
});
|
| 619 |
+
actionArgs.push(options);
|
| 620 |
+
return command.commandAction.apply(this, actionArgs);
|
| 621 |
+
}
|
| 622 |
+
};
|
| 623 |
+
/**
|
| 624 |
+
* @param name The program name to display in help and version message
|
| 625 |
+
*/
|
| 626 |
+
const cac = (name = "") => new CAC(name);
|
| 627 |
+
//#endregion
|
| 628 |
+
//#region src/cli/arguments/alias.ts
|
| 629 |
+
const alias = {
|
| 630 |
+
config: {
|
| 631 |
+
abbreviation: "c",
|
| 632 |
+
hint: "filename"
|
| 633 |
+
},
|
| 634 |
+
help: { abbreviation: "h" },
|
| 635 |
+
version: { abbreviation: "v" },
|
| 636 |
+
watch: { abbreviation: "w" },
|
| 637 |
+
dir: {
|
| 638 |
+
abbreviation: "d",
|
| 639 |
+
requireValue: true
|
| 640 |
+
},
|
| 641 |
+
file: {
|
| 642 |
+
abbreviation: "o",
|
| 643 |
+
requireValue: true
|
| 644 |
+
},
|
| 645 |
+
external: { abbreviation: "e" },
|
| 646 |
+
format: { abbreviation: "f" },
|
| 647 |
+
name: { abbreviation: "n" },
|
| 648 |
+
globals: { abbreviation: "g" },
|
| 649 |
+
sourcemap: { abbreviation: "s" },
|
| 650 |
+
minify: { abbreviation: "m" },
|
| 651 |
+
platform: { abbreviation: "p" },
|
| 652 |
+
assetFileNames: { hint: "name" },
|
| 653 |
+
chunkFileNames: { hint: "name" },
|
| 654 |
+
entryFileNames: { hint: "name" },
|
| 655 |
+
externalLiveBindings: { reverse: true },
|
| 656 |
+
treeshake: { reverse: true },
|
| 657 |
+
preserveEntrySignatures: { reverse: true },
|
| 658 |
+
moduleTypes: { hint: "types" }
|
| 659 |
+
};
|
| 660 |
+
//#endregion
|
| 661 |
+
//#region src/cli/arguments/utils.ts
|
| 662 |
+
function setNestedProperty(obj, path, value) {
|
| 663 |
+
const keys = path.split(".");
|
| 664 |
+
let current = obj;
|
| 665 |
+
for (let i = 0; i < keys.length - 1; i++) {
|
| 666 |
+
if (!current[keys[i]]) current[keys[i]] = {};
|
| 667 |
+
current = current[keys[i]];
|
| 668 |
+
}
|
| 669 |
+
const finalKey = keys[keys.length - 1];
|
| 670 |
+
Object.defineProperty(current, finalKey, {
|
| 671 |
+
value,
|
| 672 |
+
writable: true,
|
| 673 |
+
enumerable: true,
|
| 674 |
+
configurable: true
|
| 675 |
+
});
|
| 676 |
+
}
|
| 677 |
+
function camelCaseToKebabCase(str) {
|
| 678 |
+
return str.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
|
| 679 |
+
}
|
| 680 |
+
//#endregion
|
| 681 |
+
//#region src/cli/arguments/normalize.ts
|
| 682 |
+
const reservedKeys = new Set([
|
| 683 |
+
"help",
|
| 684 |
+
"version",
|
| 685 |
+
"config",
|
| 686 |
+
"watch",
|
| 687 |
+
"environment"
|
| 688 |
+
]);
|
| 689 |
+
function normalizeCliOptions(cliOptions, positionals) {
|
| 690 |
+
const [data, errors] = validateCliOptions(cliOptions);
|
| 691 |
+
if (errors?.length) {
|
| 692 |
+
errors.forEach((error) => {
|
| 693 |
+
logger.error(`${error}. You can use \`rolldown -h\` to see the help.`);
|
| 694 |
+
});
|
| 695 |
+
process.exit(1);
|
| 696 |
+
}
|
| 697 |
+
const options = data ?? {};
|
| 698 |
+
const result = {
|
| 699 |
+
input: {},
|
| 700 |
+
output: {},
|
| 701 |
+
help: options.help ?? false,
|
| 702 |
+
version: options.version ?? false,
|
| 703 |
+
watch: options.watch ?? false
|
| 704 |
+
};
|
| 705 |
+
if (typeof options.config === "string") result.config = options.config;
|
| 706 |
+
else if (options.config === true) result.config = "";
|
| 707 |
+
if (options.environment !== void 0) result.environment = options.environment;
|
| 708 |
+
const keysOfInput = new Set(getInputCliKeys());
|
| 709 |
+
const keysOfOutput = new Set(getOutputCliKeys());
|
| 710 |
+
for (let [key, value] of Object.entries(options)) {
|
| 711 |
+
const [primary] = key.split(".");
|
| 712 |
+
if (keysOfInput.has(primary)) setNestedProperty(result.input, key, value);
|
| 713 |
+
else if (keysOfOutput.has(primary)) setNestedProperty(result.output, key, value);
|
| 714 |
+
else if (!reservedKeys.has(key)) {
|
| 715 |
+
logger.error(`Unknown option: ${key}`);
|
| 716 |
+
process.exit(1);
|
| 717 |
+
}
|
| 718 |
+
}
|
| 719 |
+
if (!result.config && positionals.length > 0) if (Array.isArray(result.input.input)) result.input.input.push(...positionals);
|
| 720 |
+
else result.input.input = positionals;
|
| 721 |
+
return result;
|
| 722 |
+
}
|
| 723 |
+
//#endregion
|
| 724 |
+
//#region src/cli/arguments/index.ts
|
| 725 |
+
const schemaInfo = getCliSchemaInfo();
|
| 726 |
+
const options = Object.fromEntries(Object.entries(schemaInfo).filter(([_key, info]) => info.type !== "never").map(([key, info]) => {
|
| 727 |
+
const config = alias[key];
|
| 728 |
+
let description = info?.description ?? config?.description ?? "";
|
| 729 |
+
if (config?.reverse) {
|
| 730 |
+
if (description.startsWith("enable")) description = description.replace("enable", "disable");
|
| 731 |
+
else if (!description.startsWith("Avoid")) description = `disable ${description}`;
|
| 732 |
+
}
|
| 733 |
+
const result = {
|
| 734 |
+
type: info.type === "boolean" ? "boolean" : "string",
|
| 735 |
+
description
|
| 736 |
+
};
|
| 737 |
+
if (config?.abbreviation) result.short = config.abbreviation;
|
| 738 |
+
if (config?.hint) result.hint = config.hint;
|
| 739 |
+
const kebabKey = camelCaseToKebabCase(key);
|
| 740 |
+
return [config?.reverse ? `no-${kebabKey}` : kebabKey, result];
|
| 741 |
+
}));
|
| 742 |
+
const knownKeys = new Set(Object.keys(schemaInfo));
|
| 743 |
+
for (const key of Object.keys(schemaInfo)) {
|
| 744 |
+
const dotIdx = key.indexOf(".");
|
| 745 |
+
if (dotIdx > 0) knownKeys.add(key.substring(0, dotIdx));
|
| 746 |
+
}
|
| 747 |
+
const shortAliases = /* @__PURE__ */ new Set();
|
| 748 |
+
for (const config of Object.values(alias)) if (config?.abbreviation) shortAliases.add(config.abbreviation);
|
| 749 |
+
function parseCliArguments() {
|
| 750 |
+
const cli = cac("rolldown");
|
| 751 |
+
for (const [key, info] of Object.entries(schemaInfo)) {
|
| 752 |
+
if (info.type === "never") continue;
|
| 753 |
+
const config = alias[key];
|
| 754 |
+
let rawName = "";
|
| 755 |
+
if (config?.abbreviation) rawName += `-${config.abbreviation}, `;
|
| 756 |
+
if (config?.reverse) rawName += `--no-${key}`;
|
| 757 |
+
else rawName += `--${key}`;
|
| 758 |
+
if (info.type !== "boolean" && !config?.reverse) if (config?.requireValue) rawName += ` <${config?.hint ?? key}>`;
|
| 759 |
+
else rawName += ` [${config?.hint ?? key}]`;
|
| 760 |
+
cli.option(rawName, info.description ?? config?.description ?? "");
|
| 761 |
+
}
|
| 762 |
+
let parsedInput = [];
|
| 763 |
+
let parsedOptions = {};
|
| 764 |
+
const cmd = cli.command("[...input]", "");
|
| 765 |
+
cmd.allowUnknownOptions();
|
| 766 |
+
cmd.ignoreOptionDefaultValue();
|
| 767 |
+
cmd.action((input, opts) => {
|
| 768 |
+
parsedInput = input;
|
| 769 |
+
parsedOptions = opts;
|
| 770 |
+
});
|
| 771 |
+
try {
|
| 772 |
+
cli.parse(process.argv, { run: true });
|
| 773 |
+
} catch (err) {
|
| 774 |
+
if (err?.name === "CACError") {
|
| 775 |
+
const match = err.message.match(/option `(.+?)` value is missing/);
|
| 776 |
+
if (match) {
|
| 777 |
+
const optName = match[1].replace(/ [<[].*/, "").replace(/^-\w, /, "");
|
| 778 |
+
logger.error(`Option \`${optName}\` requires a value but none was provided.`);
|
| 779 |
+
} else logger.error(err.message);
|
| 780 |
+
process.exit(1);
|
| 781 |
+
}
|
| 782 |
+
throw err;
|
| 783 |
+
}
|
| 784 |
+
delete parsedOptions["--"];
|
| 785 |
+
for (const short of shortAliases) delete parsedOptions[short];
|
| 786 |
+
for (const key of Object.keys(parsedOptions)) if (key === "__proto__" || key === "constructor" || key === "prototype" || key.startsWith("__proto__.") || key.startsWith("constructor.") || key.startsWith("prototype.")) delete parsedOptions[key];
|
| 787 |
+
const unknownKeys = Object.keys(parsedOptions).filter((k) => !knownKeys.has(k));
|
| 788 |
+
if (unknownKeys.length > 0) {
|
| 789 |
+
unknownKeys.sort();
|
| 790 |
+
const single = unknownKeys.length === 1;
|
| 791 |
+
logger.warn(`Option \`${unknownKeys.join(",")}\` ${single ? "is" : "are"} unrecognized. We will ignore ${single ? "this" : "those"} option${single ? "" : "s"}.`);
|
| 792 |
+
}
|
| 793 |
+
const rawArgs = { ...parsedOptions };
|
| 794 |
+
for (const key of unknownKeys) delete parsedOptions[key];
|
| 795 |
+
for (const [key, value] of Object.entries(parsedOptions)) {
|
| 796 |
+
const type = schemaInfo[key]?.type;
|
| 797 |
+
if (Array.isArray(value)) {
|
| 798 |
+
if (type !== "array" && type !== "object") parsedOptions[key] = value[value.length - 1];
|
| 799 |
+
} else if (type === "array" && typeof value === "string") parsedOptions[key] = [value];
|
| 800 |
+
}
|
| 801 |
+
for (const [schemaKey, info] of Object.entries(schemaInfo)) {
|
| 802 |
+
if (info.type !== "object") continue;
|
| 803 |
+
const parts = schemaKey.split(".");
|
| 804 |
+
let parent = parsedOptions;
|
| 805 |
+
for (let i = 0; i < parts.length - 1; i++) parent = parent?.[parts[i]];
|
| 806 |
+
const leafKey = parts[parts.length - 1];
|
| 807 |
+
const value = parent?.[leafKey];
|
| 808 |
+
if (value === void 0) continue;
|
| 809 |
+
const values = Array.isArray(value) ? value : [value];
|
| 810 |
+
if (typeof values[0] !== "string") continue;
|
| 811 |
+
let usedDeprecatedSyntax = false;
|
| 812 |
+
const result = {};
|
| 813 |
+
for (const v of values) for (const pair of String(v).split(",")) {
|
| 814 |
+
const colonIdx = pair.indexOf(":");
|
| 815 |
+
const eqIdx = pair.indexOf("=");
|
| 816 |
+
let k;
|
| 817 |
+
let val;
|
| 818 |
+
if (colonIdx > 0 && (eqIdx === -1 || colonIdx < eqIdx)) {
|
| 819 |
+
k = pair.slice(0, colonIdx);
|
| 820 |
+
val = pair.slice(colonIdx + 1);
|
| 821 |
+
} else if (eqIdx > 0) {
|
| 822 |
+
k = pair.slice(0, eqIdx);
|
| 823 |
+
val = pair.slice(eqIdx + 1);
|
| 824 |
+
usedDeprecatedSyntax = true;
|
| 825 |
+
} else continue;
|
| 826 |
+
result[k] = val;
|
| 827 |
+
}
|
| 828 |
+
if (usedDeprecatedSyntax) {
|
| 829 |
+
const optionName = camelCaseToKebabCase(schemaKey);
|
| 830 |
+
logger.warn(`Using \`key=value\` syntax for \`--${optionName}\` is deprecated. Use \`key:value\` instead.`);
|
| 831 |
+
}
|
| 832 |
+
parent[leafKey] = result;
|
| 833 |
+
}
|
| 834 |
+
return {
|
| 835 |
+
...normalizeCliOptions(parsedOptions, parsedInput),
|
| 836 |
+
rawArgs
|
| 837 |
+
};
|
| 838 |
+
}
|
| 839 |
+
//#endregion
|
| 840 |
+
//#region src/utils/clear-screen.ts
|
| 841 |
+
const CLEAR_SCREEN = "\x1Bc";
|
| 842 |
+
function getClearScreenFunction(options) {
|
| 843 |
+
const isTTY = process.stdout.isTTY;
|
| 844 |
+
const isAnyOptionNotAllowingClearScreen = arraify(options).some(({ watch }) => watch === false || watch?.clearScreen === false);
|
| 845 |
+
if (isTTY && !isAnyOptionNotAllowingClearScreen) return () => {
|
| 846 |
+
process.stdout.write(CLEAR_SCREEN);
|
| 847 |
+
};
|
| 848 |
+
}
|
| 849 |
+
//#endregion
|
| 850 |
+
//#region \0@oxc-project+runtime@0.135.0/helpers/esm/usingCtx.js
|
| 851 |
+
function _usingCtx() {
|
| 852 |
+
var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
|
| 853 |
+
var n = Error();
|
| 854 |
+
return n.name = "SuppressedError", n.error = r, n.suppressed = e, n;
|
| 855 |
+
}, e = {}, n = [];
|
| 856 |
+
function using(r, e) {
|
| 857 |
+
if (null != e) {
|
| 858 |
+
if (Object(e) !== e) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
| 859 |
+
if (r) var o = e[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
|
| 860 |
+
if (void 0 === o && (o = e[Symbol.dispose || Symbol["for"]("Symbol.dispose")], r)) var t = o;
|
| 861 |
+
if ("function" != typeof o) throw new TypeError("Object is not disposable.");
|
| 862 |
+
t && (o = function o() {
|
| 863 |
+
try {
|
| 864 |
+
t.call(e);
|
| 865 |
+
} catch (r) {
|
| 866 |
+
return Promise.reject(r);
|
| 867 |
+
}
|
| 868 |
+
}), n.push({
|
| 869 |
+
v: e,
|
| 870 |
+
d: o,
|
| 871 |
+
a: r
|
| 872 |
+
});
|
| 873 |
+
} else r && n.push({
|
| 874 |
+
d: e,
|
| 875 |
+
a: r
|
| 876 |
+
});
|
| 877 |
+
return e;
|
| 878 |
+
}
|
| 879 |
+
return {
|
| 880 |
+
e,
|
| 881 |
+
u: using.bind(null, !1),
|
| 882 |
+
a: using.bind(null, !0),
|
| 883 |
+
d: function d() {
|
| 884 |
+
var o, t = this.e, s = 0;
|
| 885 |
+
function next() {
|
| 886 |
+
for (; o = n.pop();) try {
|
| 887 |
+
if (!o.a && 1 === s) return s = 0, n.push(o), Promise.resolve().then(next);
|
| 888 |
+
if (o.d) {
|
| 889 |
+
var r = o.d.call(o.v);
|
| 890 |
+
if (o.a) return s |= 2, Promise.resolve(r).then(next, err);
|
| 891 |
+
} else s |= 1;
|
| 892 |
+
} catch (r) {
|
| 893 |
+
return err(r);
|
| 894 |
+
}
|
| 895 |
+
if (1 === s) return t !== e ? Promise.reject(t) : Promise.resolve();
|
| 896 |
+
if (t !== e) throw t;
|
| 897 |
+
}
|
| 898 |
+
function err(n) {
|
| 899 |
+
return t = t !== e ? new r(n, t) : n, next();
|
| 900 |
+
}
|
| 901 |
+
return next();
|
| 902 |
+
}
|
| 903 |
+
};
|
| 904 |
+
}
|
| 905 |
+
//#endregion
|
| 906 |
+
//#region src/cli/commands/bundle.ts
|
| 907 |
+
async function bundleWithConfig(configPath, cliOptions, rawArgs = {}) {
|
| 908 |
+
if (cliOptions.watch) {
|
| 909 |
+
process.env.ROLLUP_WATCH = "true";
|
| 910 |
+
process.env.ROLLDOWN_WATCH = "true";
|
| 911 |
+
}
|
| 912 |
+
const config = await loadConfig(configPath);
|
| 913 |
+
const resolvedConfig = typeof config === "function" ? await config(rawArgs) : config;
|
| 914 |
+
if (typeof resolvedConfig !== "object" || resolvedConfig === null) {
|
| 915 |
+
logger.error(`Invalid configuration from ${configPath}: expected object or array, got ${resolvedConfig}`);
|
| 916 |
+
process.exit(1);
|
| 917 |
+
}
|
| 918 |
+
if (cliOptions.watch) await watchInner(resolvedConfig, cliOptions);
|
| 919 |
+
else await bundleInner(resolvedConfig, cliOptions);
|
| 920 |
+
}
|
| 921 |
+
async function bundleWithCliOptions(cliOptions) {
|
| 922 |
+
try {
|
| 923 |
+
var _usingCtx$1 = _usingCtx();
|
| 924 |
+
if (cliOptions.output.dir || cliOptions.output.file) {
|
| 925 |
+
await (cliOptions.watch ? watchInner : bundleInner)({}, cliOptions);
|
| 926 |
+
return;
|
| 927 |
+
}
|
| 928 |
+
if (cliOptions.watch) {
|
| 929 |
+
logger.error("You must specify `output.dir` to use watch mode");
|
| 930 |
+
process.exit(1);
|
| 931 |
+
}
|
| 932 |
+
const { output: outputs } = await _usingCtx$1.a(await rolldown(cliOptions.input)).generate(cliOptions.output);
|
| 933 |
+
if (outputs.length === 0) {
|
| 934 |
+
logger.error("No output generated");
|
| 935 |
+
process.exit(1);
|
| 936 |
+
}
|
| 937 |
+
for (const file of outputs) {
|
| 938 |
+
if (outputs.length > 1) logger.log(`\n${styleText(["cyan", "bold"], `|→ ${file.fileName}:`)}\n`);
|
| 939 |
+
console.log(file.type === "asset" ? file.source : file.code);
|
| 940 |
+
}
|
| 941 |
+
} catch (_) {
|
| 942 |
+
_usingCtx$1.e = _;
|
| 943 |
+
} finally {
|
| 944 |
+
await _usingCtx$1.d();
|
| 945 |
+
}
|
| 946 |
+
}
|
| 947 |
+
async function watchInner(config, cliOptions) {
|
| 948 |
+
let normalizedConfig = arraify(config).map((option) => {
|
| 949 |
+
return {
|
| 950 |
+
...option,
|
| 951 |
+
...cliOptions.input,
|
| 952 |
+
output: arraify(option.output || {}).map((output) => {
|
| 953 |
+
return {
|
| 954 |
+
...output,
|
| 955 |
+
...cliOptions.output
|
| 956 |
+
};
|
| 957 |
+
})
|
| 958 |
+
};
|
| 959 |
+
});
|
| 960 |
+
const watcher = watch(normalizedConfig);
|
| 961 |
+
onExit((code) => {
|
| 962 |
+
Promise.resolve(watcher.close()).finally(() => {
|
| 963 |
+
process.exit(typeof code === "number" ? code : 0);
|
| 964 |
+
});
|
| 965 |
+
return true;
|
| 966 |
+
});
|
| 967 |
+
const changedFile = [];
|
| 968 |
+
watcher.on("change", (id, event) => {
|
| 969 |
+
if (event.event === "update") changedFile.push(id);
|
| 970 |
+
});
|
| 971 |
+
const clearScreen = getClearScreenFunction(normalizedConfig);
|
| 972 |
+
watcher.on("event", async (event) => {
|
| 973 |
+
switch (event.code) {
|
| 974 |
+
case "START":
|
| 975 |
+
clearScreen?.();
|
| 976 |
+
break;
|
| 977 |
+
case "BUNDLE_START":
|
| 978 |
+
if (changedFile.length > 0) logger.log(`Found ${styleText("bold", changedFile.map(relativeId).join(", "))} changed, rebuilding...`);
|
| 979 |
+
changedFile.length = 0;
|
| 980 |
+
break;
|
| 981 |
+
case "BUNDLE_END":
|
| 982 |
+
await event.result.close();
|
| 983 |
+
logger.success(`Rebuilt ${styleText("bold", relativeId(event.output[0]))} in ${styleText("green", ms(event.duration))}.`);
|
| 984 |
+
break;
|
| 985 |
+
case "ERROR":
|
| 986 |
+
await event.result.close();
|
| 987 |
+
logger.error(event.error);
|
| 988 |
+
break;
|
| 989 |
+
default: break;
|
| 990 |
+
}
|
| 991 |
+
});
|
| 992 |
+
logger.log(`Waiting for changes...`);
|
| 993 |
+
}
|
| 994 |
+
async function bundleInner(config, cliOptions) {
|
| 995 |
+
const startTime = performance.now();
|
| 996 |
+
const result = [];
|
| 997 |
+
const configList = arraify(config);
|
| 998 |
+
for (const config of configList) {
|
| 999 |
+
const outputList = arraify(config.output || {});
|
| 1000 |
+
const build = await rolldown({
|
| 1001 |
+
...config,
|
| 1002 |
+
...cliOptions.input
|
| 1003 |
+
});
|
| 1004 |
+
try {
|
| 1005 |
+
for (const output of outputList) result.push(await build.write({
|
| 1006 |
+
...output,
|
| 1007 |
+
...cliOptions.output
|
| 1008 |
+
}));
|
| 1009 |
+
} finally {
|
| 1010 |
+
await build.close();
|
| 1011 |
+
}
|
| 1012 |
+
}
|
| 1013 |
+
result.forEach(printBundleOutputPretty);
|
| 1014 |
+
logger.log(``);
|
| 1015 |
+
const duration = performance.now() - startTime;
|
| 1016 |
+
logger.success(`rolldown v${version} Finished in ${styleText("green", ms(duration))}`);
|
| 1017 |
+
}
|
| 1018 |
+
function printBundleOutputPretty(output) {
|
| 1019 |
+
const outputEntries = collectOutputEntries(output.output);
|
| 1020 |
+
printOutputEntries(outputEntries, collectOutputLayoutAdjustmentSizes(outputEntries), "<DIR>");
|
| 1021 |
+
}
|
| 1022 |
+
function collectOutputEntries(output) {
|
| 1023 |
+
return output.map((chunk) => ({
|
| 1024 |
+
type: chunk.type,
|
| 1025 |
+
fileName: chunk.fileName,
|
| 1026 |
+
size: chunk.type === "chunk" ? Buffer.byteLength(chunk.code) : Buffer.byteLength(chunk.source)
|
| 1027 |
+
}));
|
| 1028 |
+
}
|
| 1029 |
+
function collectOutputLayoutAdjustmentSizes(entries) {
|
| 1030 |
+
let longest = 0;
|
| 1031 |
+
let biggestSize = 0;
|
| 1032 |
+
for (const entry of entries) {
|
| 1033 |
+
if (entry.fileName.length > longest) longest = entry.fileName.length;
|
| 1034 |
+
if (entry.size > biggestSize) biggestSize = entry.size;
|
| 1035 |
+
}
|
| 1036 |
+
const sizePad = displaySize(biggestSize).length;
|
| 1037 |
+
return {
|
| 1038 |
+
longest,
|
| 1039 |
+
biggestSize,
|
| 1040 |
+
sizePad
|
| 1041 |
+
};
|
| 1042 |
+
}
|
| 1043 |
+
const numberFormatter = new Intl.NumberFormat("en", {
|
| 1044 |
+
maximumFractionDigits: 2,
|
| 1045 |
+
minimumFractionDigits: 2
|
| 1046 |
+
});
|
| 1047 |
+
function displaySize(bytes) {
|
| 1048 |
+
return `${numberFormatter.format(bytes / 1e3)} kB`;
|
| 1049 |
+
}
|
| 1050 |
+
const CHUNK_GROUPS = [{
|
| 1051 |
+
type: "asset",
|
| 1052 |
+
color: "green"
|
| 1053 |
+
}, {
|
| 1054 |
+
type: "chunk",
|
| 1055 |
+
color: "cyan"
|
| 1056 |
+
}];
|
| 1057 |
+
function printOutputEntries(entries, sizeAdjustment, distPath) {
|
| 1058 |
+
for (const group of CHUNK_GROUPS) {
|
| 1059 |
+
const filtered = entries.filter((e) => e.type === group.type);
|
| 1060 |
+
if (!filtered.length) continue;
|
| 1061 |
+
for (const entry of filtered.sort((a, z) => a.size - z.size)) {
|
| 1062 |
+
let log = styleText("dim", withTrailingSlash(distPath));
|
| 1063 |
+
log += styleText(group.color, entry.fileName.padEnd(sizeAdjustment.longest + 2));
|
| 1064 |
+
log += styleText("dim", entry.type);
|
| 1065 |
+
log += styleText("dim", ` │ size: ${displaySize(entry.size).padStart(sizeAdjustment.sizePad)}`);
|
| 1066 |
+
logger.log(log);
|
| 1067 |
+
}
|
| 1068 |
+
}
|
| 1069 |
+
}
|
| 1070 |
+
function withTrailingSlash(path) {
|
| 1071 |
+
if (path[path.length - 1] !== "/") return `${path}/`;
|
| 1072 |
+
return path;
|
| 1073 |
+
}
|
| 1074 |
+
function ms(duration) {
|
| 1075 |
+
return duration < 1e3 ? `${duration.toFixed(2)} ms` : `${(duration / 1e3).toFixed(2)} s`;
|
| 1076 |
+
}
|
| 1077 |
+
function relativeId(id) {
|
| 1078 |
+
if (!path.isAbsolute(id)) return id;
|
| 1079 |
+
return path.relative(path.resolve(), id);
|
| 1080 |
+
}
|
| 1081 |
+
//#endregion
|
| 1082 |
+
//#region src/cli/commands/help.ts
|
| 1083 |
+
const examples = [
|
| 1084 |
+
{
|
| 1085 |
+
title: "Bundle with a config file `rolldown.config.mjs`",
|
| 1086 |
+
command: "rolldown -c rolldown.config.mjs"
|
| 1087 |
+
},
|
| 1088 |
+
{
|
| 1089 |
+
title: "Bundle the `src/main.ts` to `dist` with `cjs` format",
|
| 1090 |
+
command: "rolldown src/main.ts -d dist -f cjs"
|
| 1091 |
+
},
|
| 1092 |
+
{
|
| 1093 |
+
title: "Bundle the `src/main.ts` and handle the `.png` assets to Data URL",
|
| 1094 |
+
command: "rolldown src/main.ts -d dist --moduleTypes .png=dataurl"
|
| 1095 |
+
},
|
| 1096 |
+
{
|
| 1097 |
+
title: "Bundle the `src/main.tsx` and minify the output with sourcemap",
|
| 1098 |
+
command: "rolldown src/main.tsx -d dist -m -s"
|
| 1099 |
+
},
|
| 1100 |
+
{
|
| 1101 |
+
title: "Create self-executing IIFE using external jQuery as `$` and `_`",
|
| 1102 |
+
command: "rolldown src/main.ts -d dist -n bundle -f iife -e jQuery,window._ -g jQuery=$"
|
| 1103 |
+
}
|
| 1104 |
+
];
|
| 1105 |
+
const notes = ["CLI options will override the configuration file.", "For more information, please visit https://rolldown.rs/."];
|
| 1106 |
+
/**
|
| 1107 |
+
* Generates the CLI help text as a string.
|
| 1108 |
+
*/
|
| 1109 |
+
function generateHelpText() {
|
| 1110 |
+
const lines = [];
|
| 1111 |
+
lines.push(`${styleText("gray", `${description} (rolldown v${version})`)}`);
|
| 1112 |
+
lines.push("");
|
| 1113 |
+
lines.push(`${styleText(["bold", "underline"], "USAGE")} ${styleText("cyan", "rolldown -c <config>")} or ${styleText("cyan", "rolldown <input> <options>")}`);
|
| 1114 |
+
lines.push("");
|
| 1115 |
+
lines.push(`${styleText(["bold", "underline"], "OPTIONS")}`);
|
| 1116 |
+
lines.push("");
|
| 1117 |
+
lines.push(Object.entries(options).sort(([a], [b]) => {
|
| 1118 |
+
if (options[a].short && !options[b].short) return -1;
|
| 1119 |
+
if (!options[a].short && options[b].short) return 1;
|
| 1120 |
+
if (options[a].short && options[b].short) return options[a].short.localeCompare(options[b].short);
|
| 1121 |
+
return a.localeCompare(b);
|
| 1122 |
+
}).map(([option, { type, short, hint, description }]) => {
|
| 1123 |
+
let optionStr = ` --${option} `;
|
| 1124 |
+
option = camelCaseToKebabCase(option);
|
| 1125 |
+
if (short) optionStr += `-${short}, `;
|
| 1126 |
+
if (type === "string") optionStr += `<${hint ?? option}>`;
|
| 1127 |
+
if (description && description.length > 0) description = description[0].toUpperCase() + description.slice(1);
|
| 1128 |
+
return styleText("cyan", optionStr.padEnd(30)) + description + (description && description?.endsWith(".") ? "" : ".");
|
| 1129 |
+
}).join("\n"));
|
| 1130 |
+
lines.push("");
|
| 1131 |
+
lines.push(`${styleText(["bold", "underline"], "EXAMPLES")}`);
|
| 1132 |
+
lines.push("");
|
| 1133 |
+
examples.forEach(({ title, command }, ord) => {
|
| 1134 |
+
lines.push(` ${ord + 1}. ${title}:`);
|
| 1135 |
+
lines.push(` ${styleText("cyan", command)}`);
|
| 1136 |
+
lines.push("");
|
| 1137 |
+
});
|
| 1138 |
+
lines.push(`${styleText(["bold", "underline"], "NOTES")}`);
|
| 1139 |
+
lines.push("");
|
| 1140 |
+
notes.forEach((note) => {
|
| 1141 |
+
lines.push(` * ${styleText("gray", note)}`);
|
| 1142 |
+
});
|
| 1143 |
+
return lines.join("\n");
|
| 1144 |
+
}
|
| 1145 |
+
function showHelp() {
|
| 1146 |
+
logger.log(generateHelpText());
|
| 1147 |
+
}
|
| 1148 |
+
//#endregion
|
| 1149 |
+
//#region src/cli/version-check.ts
|
| 1150 |
+
function checkNodeVersion(nodeVersion) {
|
| 1151 |
+
const currentVersion = nodeVersion.split(".");
|
| 1152 |
+
const major = parseInt(currentVersion[0], 10);
|
| 1153 |
+
const minor = parseInt(currentVersion[1], 10);
|
| 1154 |
+
return major === 20 && minor >= 19 || major === 22 && minor >= 12 || major > 22;
|
| 1155 |
+
}
|
| 1156 |
+
//#endregion
|
| 1157 |
+
//#region src/cli/index.ts
|
| 1158 |
+
if (!checkNodeVersion(process$1.versions.node)) logger.warn(`You are using Node.js ${process$1.versions.node}. Rolldown requires Node.js version 20.19+ or 22.12+. Please upgrade your Node.js version.`);
|
| 1159 |
+
async function main() {
|
| 1160 |
+
const { rawArgs, ...cliOptions } = parseCliArguments();
|
| 1161 |
+
if (cliOptions.environment) {
|
| 1162 |
+
const environment = Array.isArray(cliOptions.environment) ? cliOptions.environment : [cliOptions.environment];
|
| 1163 |
+
for (const argument of environment) for (const pair of argument.split(",")) {
|
| 1164 |
+
const [key, ...value] = pair.split(":");
|
| 1165 |
+
process$1.env[key] = value.length === 0 ? String(true) : value.join(":");
|
| 1166 |
+
}
|
| 1167 |
+
}
|
| 1168 |
+
if (cliOptions.help) {
|
| 1169 |
+
showHelp();
|
| 1170 |
+
return;
|
| 1171 |
+
}
|
| 1172 |
+
if (cliOptions.version) {
|
| 1173 |
+
logger.log(`rolldown v${version}`);
|
| 1174 |
+
return;
|
| 1175 |
+
}
|
| 1176 |
+
if (cliOptions.config || cliOptions.config === "") {
|
| 1177 |
+
await bundleWithConfig(cliOptions.config, cliOptions, rawArgs);
|
| 1178 |
+
return;
|
| 1179 |
+
}
|
| 1180 |
+
if ("input" in cliOptions.input) {
|
| 1181 |
+
await bundleWithCliOptions(cliOptions);
|
| 1182 |
+
return;
|
| 1183 |
+
}
|
| 1184 |
+
showHelp();
|
| 1185 |
+
}
|
| 1186 |
+
main().catch((err) => {
|
| 1187 |
+
logger.error(err);
|
| 1188 |
+
process$1.exit(1);
|
| 1189 |
+
});
|
| 1190 |
+
//#endregion
|
| 1191 |
+
export {};
|
shared/node_modules/rolldown/dist/config.d.mts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { I as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-ChOOV2QZ.mjs";
|
| 2 |
+
|
| 3 |
+
//#region src/utils/load-config.d.ts
|
| 4 |
+
/**
|
| 5 |
+
* Load config from a file in a way that Rolldown does.
|
| 6 |
+
*
|
| 7 |
+
* @param configPath The path to the config file. If empty, it will look for `rolldown.config` with supported extensions in the current working directory.
|
| 8 |
+
* @returns The loaded config export
|
| 9 |
+
*
|
| 10 |
+
* @category Config
|
| 11 |
+
*/
|
| 12 |
+
declare function loadConfig(configPath: string): Promise<ConfigExport>;
|
| 13 |
+
//#endregion
|
| 14 |
+
export { VERSION, defineConfig, loadConfig };
|
shared/node_modules/rolldown/dist/config.mjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { x as VERSION } from "./shared/bindingify-input-options-B7_WBoOp.mjs";
|
| 2 |
+
import { t as defineConfig } from "./shared/define-config-Demdg3_4.mjs";
|
| 3 |
+
import { t as loadConfig } from "./shared/load-config-BDGEgD4M.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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { B as ResolveResult, C as BindingViteManifestPluginConfig, G as isolatedDeclaration, I as NapiResolveOptions, K as isolatedDeclarationSync, M as IsolatedDeclarationsResult, O as BindingViteTransformPluginConfig, V as ResolverFactory, _ as BindingTsconfigRawOptions, f as BindingRebuildStrategy, g as BindingTsconfigCompilerOptions, i as BindingClientHmrUpdate, j as IsolatedDeclarationsOptions, n as BindingBundleAnalyzerPluginConfig, q as moduleRunnerTransform, r as BindingBundleState } from "./shared/binding-DgGsNpT9.mjs";
|
| 2 |
+
import { Jt as RolldownOutput, P as BuiltinPlugin, Ut as StringOrRegExp, Xt as freeExternalMemory, Z as defineParallelPlugin, ct as NormalizedOutputOptions, l as InputOptions, zt as OutputOptions } from "./shared/define-config-ChOOV2QZ.mjs";
|
| 3 |
+
import { a as MinifyOptions$1, c as minifySync$1, d as parse$1, f as parseSync$1, i as transformSync$1, l as ParseResult$1, m as resolveTsconfig, n as TransformResult$1, o as MinifyResult$1, p as TsconfigCache$1, r as transform$1, s as minify$1, t as TransformOptions$1, u as ParserOptions$1 } from "./shared/transform-C-XSNVrd.mjs";
|
| 4 |
+
import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, m as viteWebWorkerPostPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWasmFallbackPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-Bx1tSad6.mjs";
|
| 5 |
+
|
| 6 |
+
//#region src/api/dev/dev-options.d.ts
|
| 7 |
+
type DevOnHmrUpdates = (result: Error | {
|
| 8 |
+
updates: BindingClientHmrUpdate[];
|
| 9 |
+
changedFiles: string[];
|
| 10 |
+
}) => void | Promise<void>;
|
| 11 |
+
type DevOnOutput = (result: Error | RolldownOutput) => void | Promise<void>;
|
| 12 |
+
interface DevWatchOptions {
|
| 13 |
+
/**
|
| 14 |
+
* If `true`, files are not written to disk.
|
| 15 |
+
* @default false
|
| 16 |
+
*/
|
| 17 |
+
skipWrite?: boolean;
|
| 18 |
+
/**
|
| 19 |
+
* If `true`, use polling instead of native file system events for watching.
|
| 20 |
+
* @default false
|
| 21 |
+
*/
|
| 22 |
+
usePolling?: boolean;
|
| 23 |
+
/**
|
| 24 |
+
* Poll interval in milliseconds (only used when usePolling is true).
|
| 25 |
+
* @default 100
|
| 26 |
+
*/
|
| 27 |
+
pollInterval?: number;
|
| 28 |
+
/**
|
| 29 |
+
* If `true`, use debounced watcher. If `false`, use non-debounced watcher for immediate responses.
|
| 30 |
+
* @default true
|
| 31 |
+
*/
|
| 32 |
+
useDebounce?: boolean;
|
| 33 |
+
/**
|
| 34 |
+
* Debounce duration in milliseconds (only used when useDebounce is true).
|
| 35 |
+
* @default 10
|
| 36 |
+
*/
|
| 37 |
+
debounceDuration?: number;
|
| 38 |
+
/**
|
| 39 |
+
* Whether to compare file contents for poll-based watchers (only used when usePolling is true).
|
| 40 |
+
* When enabled, poll watchers will check file contents to determine if they actually changed.
|
| 41 |
+
* @default false
|
| 42 |
+
*/
|
| 43 |
+
compareContentsForPolling?: boolean;
|
| 44 |
+
/**
|
| 45 |
+
* Tick rate in milliseconds for debounced watchers (only used when useDebounce is true).
|
| 46 |
+
* Controls how frequently the debouncer checks for events to process.
|
| 47 |
+
* When not specified, the debouncer will auto-select an appropriate tick rate (1/4 of the debounce duration).
|
| 48 |
+
* @default undefined (auto-select)
|
| 49 |
+
*/
|
| 50 |
+
debounceTickRate?: number;
|
| 51 |
+
/**
|
| 52 |
+
* Filter to limit which discovered files are registered with the file watcher.
|
| 53 |
+
*
|
| 54 |
+
* Strings are treated as glob patterns.
|
| 55 |
+
*
|
| 56 |
+
* @default []
|
| 57 |
+
*/
|
| 58 |
+
include?: StringOrRegExp | StringOrRegExp[];
|
| 59 |
+
/**
|
| 60 |
+
* Filter to prevent discovered files from being registered with the file watcher.
|
| 61 |
+
*
|
| 62 |
+
* Strings are treated as glob patterns.
|
| 63 |
+
*
|
| 64 |
+
* @default []
|
| 65 |
+
*/
|
| 66 |
+
exclude?: StringOrRegExp | StringOrRegExp[];
|
| 67 |
+
}
|
| 68 |
+
interface DevOptions {
|
| 69 |
+
onHmrUpdates?: DevOnHmrUpdates;
|
| 70 |
+
onOutput?: DevOnOutput;
|
| 71 |
+
/**
|
| 72 |
+
* Strategy for triggering rebuilds after HMR updates.
|
| 73 |
+
* - `'always'`: Always trigger a rebuild after HMR updates
|
| 74 |
+
* - `'auto'`: Trigger rebuild only if HMR updates contain full reload updates
|
| 75 |
+
* - `'never'`: Never trigger rebuild after HMR updates (default)
|
| 76 |
+
* @default 'auto'
|
| 77 |
+
*/
|
| 78 |
+
rebuildStrategy?: "always" | "auto" | "never";
|
| 79 |
+
watch?: DevWatchOptions;
|
| 80 |
+
}
|
| 81 |
+
//#endregion
|
| 82 |
+
//#region src/api/dev/dev-engine.d.ts
|
| 83 |
+
declare class DevEngine {
|
| 84 |
+
#private;
|
| 85 |
+
static create(inputOptions: InputOptions, outputOptions?: OutputOptions, devOptions?: DevOptions): Promise<DevEngine>;
|
| 86 |
+
private constructor();
|
| 87 |
+
run(): Promise<void>;
|
| 88 |
+
ensureCurrentBuildFinish(): Promise<void>;
|
| 89 |
+
getBundleState(): Promise<BindingBundleState>;
|
| 90 |
+
ensureLatestBuildOutput(): Promise<void>;
|
| 91 |
+
triggerFullBuild(): void;
|
| 92 |
+
invalidate(file: string, firstInvalidatedBy?: string): Promise<BindingClientHmrUpdate[]>;
|
| 93 |
+
registerModules(clientId: string, modules: string[]): Promise<void>;
|
| 94 |
+
removeClient(clientId: string): Promise<void>;
|
| 95 |
+
close(): Promise<void>;
|
| 96 |
+
/**
|
| 97 |
+
* Compile a lazy entry module and return HMR-style patch code.
|
| 98 |
+
*
|
| 99 |
+
* This is called when a dynamically imported module is first requested at runtime.
|
| 100 |
+
* The module was previously stubbed with a proxy, and now we need to compile the
|
| 101 |
+
* actual module and its dependencies.
|
| 102 |
+
*
|
| 103 |
+
* @param moduleId - The absolute file path of the module to compile
|
| 104 |
+
* @param clientId - The client ID requesting this compilation
|
| 105 |
+
* @returns The compiled JavaScript code as a string (HMR patch format)
|
| 106 |
+
*/
|
| 107 |
+
compileEntry(moduleId: string, clientId: string): Promise<string>;
|
| 108 |
+
}
|
| 109 |
+
//#endregion
|
| 110 |
+
//#region src/api/dev/index.d.ts
|
| 111 |
+
declare const dev: typeof DevEngine.create;
|
| 112 |
+
//#endregion
|
| 113 |
+
//#region src/api/experimental.d.ts
|
| 114 |
+
/**
|
| 115 |
+
* This is an experimental API. Its behavior may change in the future.
|
| 116 |
+
*
|
| 117 |
+
* - Calling this API will only execute the `scan/build` stage of rolldown.
|
| 118 |
+
* - `scan` will clean up all resources automatically, but if you want to ensure timely cleanup, you need to wait for the returned promise to resolve.
|
| 119 |
+
*
|
| 120 |
+
* @example To ensure cleanup of resources, use the returned promise to wait for the scan to complete.
|
| 121 |
+
* ```ts
|
| 122 |
+
* import { scan } from 'rolldown/api/experimental';
|
| 123 |
+
*
|
| 124 |
+
* const cleanupPromise = await scan(...);
|
| 125 |
+
* await cleanupPromise;
|
| 126 |
+
* // Now all resources have been cleaned up.
|
| 127 |
+
* ```
|
| 128 |
+
*/
|
| 129 |
+
declare const scan: (rawInputOptions: InputOptions, rawOutputOptions?: {}) => Promise<Promise<void>>;
|
| 130 |
+
//#endregion
|
| 131 |
+
//#region src/builtin-plugin/alias-plugin.d.ts
|
| 132 |
+
type ViteAliasPluginConfig = {
|
| 133 |
+
entries: {
|
| 134 |
+
find: string | RegExp;
|
| 135 |
+
replacement: string;
|
| 136 |
+
}[];
|
| 137 |
+
};
|
| 138 |
+
declare function viteAliasPlugin(config: ViteAliasPluginConfig): BuiltinPlugin;
|
| 139 |
+
//#endregion
|
| 140 |
+
//#region src/builtin-plugin/bundle-analyzer-plugin.d.ts
|
| 141 |
+
/**
|
| 142 |
+
* A plugin that analyzes bundle composition and generates detailed reports.
|
| 143 |
+
*
|
| 144 |
+
* The plugin outputs a file containing detailed information about:
|
| 145 |
+
* - All chunks and their relationships
|
| 146 |
+
* - Modules bundled in each chunk
|
| 147 |
+
* - Import dependencies between chunks
|
| 148 |
+
* - Reachable modules from each entry point
|
| 149 |
+
*
|
| 150 |
+
* @example
|
| 151 |
+
* ```js
|
| 152 |
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
| 153 |
+
*
|
| 154 |
+
* export default {
|
| 155 |
+
* plugins: [
|
| 156 |
+
* bundleAnalyzerPlugin()
|
| 157 |
+
* ]
|
| 158 |
+
* }
|
| 159 |
+
* ```
|
| 160 |
+
*
|
| 161 |
+
* @example
|
| 162 |
+
* **Custom filename**
|
| 163 |
+
* ```js
|
| 164 |
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
| 165 |
+
*
|
| 166 |
+
* export default {
|
| 167 |
+
* plugins: [
|
| 168 |
+
* bundleAnalyzerPlugin({
|
| 169 |
+
* fileName: 'bundle-analysis.json'
|
| 170 |
+
* })
|
| 171 |
+
* ]
|
| 172 |
+
* }
|
| 173 |
+
* ```
|
| 174 |
+
*
|
| 175 |
+
* @example
|
| 176 |
+
* **LLM-friendly markdown output**
|
| 177 |
+
* ```js
|
| 178 |
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
| 179 |
+
*
|
| 180 |
+
* export default {
|
| 181 |
+
* plugins: [
|
| 182 |
+
* bundleAnalyzerPlugin({
|
| 183 |
+
* format: 'md'
|
| 184 |
+
* })
|
| 185 |
+
* ]
|
| 186 |
+
* }
|
| 187 |
+
* ```
|
| 188 |
+
*/
|
| 189 |
+
declare function bundleAnalyzerPlugin(config?: BindingBundleAnalyzerPluginConfig): BuiltinPlugin;
|
| 190 |
+
//#endregion
|
| 191 |
+
//#region src/builtin-plugin/transform-plugin.d.ts
|
| 192 |
+
type TransformPattern = string | RegExp | readonly (RegExp | string)[];
|
| 193 |
+
type TransformPluginConfig = Omit<BindingViteTransformPluginConfig, "include" | "exclude" | "jsxRefreshInclude" | "jsxRefreshExclude" | "yarnPnp"> & {
|
| 194 |
+
include?: TransformPattern;
|
| 195 |
+
exclude?: TransformPattern;
|
| 196 |
+
jsxRefreshInclude?: TransformPattern;
|
| 197 |
+
jsxRefreshExclude?: TransformPattern;
|
| 198 |
+
};
|
| 199 |
+
declare function viteTransformPlugin(config: TransformPluginConfig): BuiltinPlugin;
|
| 200 |
+
//#endregion
|
| 201 |
+
//#region src/builtin-plugin/vite-manifest-plugin.d.ts
|
| 202 |
+
type ViteManifestPluginConfig = Omit<BindingViteManifestPluginConfig, "isLegacy"> & {
|
| 203 |
+
isOutputOptionsForLegacyChunks?: (outputOptions: NormalizedOutputOptions) => boolean;
|
| 204 |
+
};
|
| 205 |
+
declare function viteManifestPlugin(config: ViteManifestPluginConfig): BuiltinPlugin;
|
| 206 |
+
//#endregion
|
| 207 |
+
//#region src/experimental-index.d.ts
|
| 208 |
+
/**
|
| 209 |
+
* In-memory file system for browser builds.
|
| 210 |
+
*
|
| 211 |
+
* This is a re-export of the {@link https://github.com/streamich/memfs | memfs} package used by the WASI runtime.
|
| 212 |
+
* It allows you to read and write files to a virtual filesystem when using rolldown in browser environments.
|
| 213 |
+
*
|
| 214 |
+
* - `fs`: A Node.js-compatible filesystem API (`IFs` from memfs)
|
| 215 |
+
* - `volume`: The underlying `Volume` instance that stores the filesystem state
|
| 216 |
+
*
|
| 217 |
+
* Returns `undefined` in Node.js builds (only available in browser builds via `@rolldown/browser`).
|
| 218 |
+
*
|
| 219 |
+
* @example
|
| 220 |
+
* ```typescript
|
| 221 |
+
* import { memfs } from 'rolldown/experimental';
|
| 222 |
+
*
|
| 223 |
+
* // Write files to virtual filesystem before bundling
|
| 224 |
+
* memfs?.volume.fromJSON({
|
| 225 |
+
* '/src/index.js': 'export const foo = 42;',
|
| 226 |
+
* '/package.json': '{"name": "my-app"}'
|
| 227 |
+
* });
|
| 228 |
+
*
|
| 229 |
+
* // Read files from the virtual filesystem
|
| 230 |
+
* const content = memfs?.fs.readFileSync('/src/index.js', 'utf8');
|
| 231 |
+
* ```
|
| 232 |
+
*
|
| 233 |
+
* @see {@link https://github.com/streamich/memfs} for more information on the memfs API.
|
| 234 |
+
*/
|
| 235 |
+
declare const memfs: {
|
| 236 |
+
fs: any;
|
| 237 |
+
volume: any;
|
| 238 |
+
} | undefined;
|
| 239 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 240 |
+
declare const parse: typeof parse$1;
|
| 241 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 242 |
+
declare const parseSync: typeof parseSync$1;
|
| 243 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 244 |
+
type ParseResult = ParseResult$1;
|
| 245 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 246 |
+
type ParserOptions = ParserOptions$1;
|
| 247 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 248 |
+
declare const minify: typeof minify$1;
|
| 249 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 250 |
+
declare const minifySync: typeof minifySync$1;
|
| 251 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 252 |
+
type MinifyOptions = MinifyOptions$1;
|
| 253 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 254 |
+
type MinifyResult = MinifyResult$1;
|
| 255 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 256 |
+
declare const transform: typeof transform$1;
|
| 257 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 258 |
+
declare const transformSync: typeof transformSync$1;
|
| 259 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 260 |
+
type TransformOptions = TransformOptions$1;
|
| 261 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 262 |
+
type TransformResult = TransformResult$1;
|
| 263 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 264 |
+
declare const TsconfigCache: typeof TsconfigCache$1;
|
| 265 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 266 |
+
type TsconfigRawOptions = BindingTsconfigRawOptions;
|
| 267 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 268 |
+
type TsconfigCompilerOptions = BindingTsconfigCompilerOptions;
|
| 269 |
+
//#endregion
|
| 270 |
+
export { type BindingClientHmrUpdate, BindingRebuildStrategy, DevEngine, type DevOptions, type DevWatchOptions, type IsolatedDeclarationsOptions, type IsolatedDeclarationsResult, MinifyOptions, MinifyResult, ParseResult, ParserOptions, type NapiResolveOptions as ResolveOptions, type ResolveResult, ResolverFactory, TransformOptions, TransformResult, TsconfigCache, TsconfigCompilerOptions, TsconfigRawOptions, bundleAnalyzerPlugin, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, oxcRuntimePlugin, parse, parseSync, resolveTsconfig, scan, transform, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWebWorkerPostPlugin };
|
shared/node_modules/rolldown/dist/experimental-index.mjs
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { n as __toESM, t as require_binding } from "./shared/binding-CfwqjDbP.mjs";
|
| 2 |
+
import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-DGbe3BlX.mjs";
|
| 3 |
+
import { o as transformToRollupOutput } from "./shared/bindingify-input-options-B7_WBoOp.mjs";
|
| 4 |
+
import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-abS241_6.mjs";
|
| 5 |
+
import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-C0TrL0_H.mjs";
|
| 6 |
+
import { n as parseSync$1, t as parse$1 } from "./shared/parse-yrGA-p2H.mjs";
|
| 7 |
+
import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, m as viteWebWorkerPostPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWasmFallbackPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-DnT9y_13.mjs";
|
| 8 |
+
import { a as minify$1, i as transformSync$1, n as resolveTsconfig, o as minifySync$1, r as transform$1, t as TsconfigCache$1 } from "./shared/resolve-tsconfig-D3YLh9ff.mjs";
|
| 9 |
+
import { pathToFileURL } from "node:url";
|
| 10 |
+
//#region src/api/dev/dev-engine.ts
|
| 11 |
+
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
|
| 12 |
+
var DevEngine = class DevEngine {
|
| 13 |
+
#inner;
|
| 14 |
+
#cachedBuildFinishPromise = null;
|
| 15 |
+
static async create(inputOptions, outputOptions = {}, devOptions = {}) {
|
| 16 |
+
inputOptions = await PluginDriver.callOptionsHook(inputOptions);
|
| 17 |
+
const options = await createBundlerOptions(inputOptions, outputOptions, false);
|
| 18 |
+
const userOnHmrUpdates = devOptions.onHmrUpdates;
|
| 19 |
+
const bindingOnHmrUpdates = userOnHmrUpdates ? function(rawResult) {
|
| 20 |
+
const result = normalizeBindingResult(rawResult);
|
| 21 |
+
if (result instanceof Error) {
|
| 22 |
+
userOnHmrUpdates(result);
|
| 23 |
+
return;
|
| 24 |
+
}
|
| 25 |
+
const [updates, changedFiles] = result;
|
| 26 |
+
userOnHmrUpdates({
|
| 27 |
+
updates,
|
| 28 |
+
changedFiles
|
| 29 |
+
});
|
| 30 |
+
} : void 0;
|
| 31 |
+
const userOnOutput = devOptions.onOutput;
|
| 32 |
+
const bindingDevOptions = {
|
| 33 |
+
onHmrUpdates: bindingOnHmrUpdates,
|
| 34 |
+
onOutput: userOnOutput ? function(rawResult) {
|
| 35 |
+
const result = normalizeBindingResult(rawResult);
|
| 36 |
+
if (result instanceof Error) {
|
| 37 |
+
userOnOutput(result);
|
| 38 |
+
return;
|
| 39 |
+
}
|
| 40 |
+
userOnOutput(transformToRollupOutput(result));
|
| 41 |
+
} : void 0,
|
| 42 |
+
rebuildStrategy: devOptions.rebuildStrategy ? devOptions.rebuildStrategy === "always" ? import_binding.BindingRebuildStrategy.Always : devOptions.rebuildStrategy === "auto" ? import_binding.BindingRebuildStrategy.Auto : import_binding.BindingRebuildStrategy.Never : void 0,
|
| 43 |
+
watch: devOptions.watch && {
|
| 44 |
+
skipWrite: devOptions.watch.skipWrite,
|
| 45 |
+
usePolling: devOptions.watch.usePolling,
|
| 46 |
+
pollInterval: devOptions.watch.pollInterval,
|
| 47 |
+
useDebounce: devOptions.watch.useDebounce,
|
| 48 |
+
debounceDuration: devOptions.watch.debounceDuration,
|
| 49 |
+
compareContentsForPolling: devOptions.watch.compareContentsForPolling,
|
| 50 |
+
debounceTickRate: devOptions.watch.debounceTickRate,
|
| 51 |
+
include: normalizedStringOrRegex(devOptions.watch.include),
|
| 52 |
+
exclude: normalizedStringOrRegex(devOptions.watch.exclude)
|
| 53 |
+
}
|
| 54 |
+
};
|
| 55 |
+
return new DevEngine(new import_binding.BindingDevEngine(options.bundlerOptions, bindingDevOptions));
|
| 56 |
+
}
|
| 57 |
+
constructor(inner) {
|
| 58 |
+
this.#inner = inner;
|
| 59 |
+
}
|
| 60 |
+
async run() {
|
| 61 |
+
await this.#inner.run();
|
| 62 |
+
}
|
| 63 |
+
async ensureCurrentBuildFinish() {
|
| 64 |
+
if (this.#cachedBuildFinishPromise) return this.#cachedBuildFinishPromise;
|
| 65 |
+
const promise = this.#inner.ensureCurrentBuildFinish().then(() => {
|
| 66 |
+
this.#cachedBuildFinishPromise = null;
|
| 67 |
+
});
|
| 68 |
+
this.#cachedBuildFinishPromise = promise;
|
| 69 |
+
return promise;
|
| 70 |
+
}
|
| 71 |
+
async getBundleState() {
|
| 72 |
+
return this.#inner.getBundleState();
|
| 73 |
+
}
|
| 74 |
+
async ensureLatestBuildOutput() {
|
| 75 |
+
unwrapBindingResult(await this.#inner.ensureLatestBuildOutput());
|
| 76 |
+
}
|
| 77 |
+
triggerFullBuild() {
|
| 78 |
+
this.#inner.triggerFullBuild();
|
| 79 |
+
}
|
| 80 |
+
async invalidate(file, firstInvalidatedBy) {
|
| 81 |
+
return unwrapBindingResult(await this.#inner.invalidate(file, firstInvalidatedBy));
|
| 82 |
+
}
|
| 83 |
+
async registerModules(clientId, modules) {
|
| 84 |
+
await this.#inner.registerModules(clientId, modules);
|
| 85 |
+
}
|
| 86 |
+
async removeClient(clientId) {
|
| 87 |
+
await this.#inner.removeClient(clientId);
|
| 88 |
+
}
|
| 89 |
+
async close() {
|
| 90 |
+
await this.#inner.close();
|
| 91 |
+
}
|
| 92 |
+
/**
|
| 93 |
+
* Compile a lazy entry module and return HMR-style patch code.
|
| 94 |
+
*
|
| 95 |
+
* This is called when a dynamically imported module is first requested at runtime.
|
| 96 |
+
* The module was previously stubbed with a proxy, and now we need to compile the
|
| 97 |
+
* actual module and its dependencies.
|
| 98 |
+
*
|
| 99 |
+
* @param moduleId - The absolute file path of the module to compile
|
| 100 |
+
* @param clientId - The client ID requesting this compilation
|
| 101 |
+
* @returns The compiled JavaScript code as a string (HMR patch format)
|
| 102 |
+
*/
|
| 103 |
+
async compileEntry(moduleId, clientId) {
|
| 104 |
+
return this.#inner.compileEntry(moduleId, clientId);
|
| 105 |
+
}
|
| 106 |
+
};
|
| 107 |
+
//#endregion
|
| 108 |
+
//#region src/api/dev/index.ts
|
| 109 |
+
const dev = (...args) => DevEngine.create(...args);
|
| 110 |
+
//#endregion
|
| 111 |
+
//#region src/types/external-memory-handle.ts
|
| 112 |
+
const symbolForExternalMemoryHandle = "__rolldown_external_memory_handle__";
|
| 113 |
+
/**
|
| 114 |
+
* Frees the external memory held by the given handle.
|
| 115 |
+
*
|
| 116 |
+
* This is useful when you want to manually release memory held by Rust objects
|
| 117 |
+
* (like `OutputChunk` or `OutputAsset`) before they are garbage collected.
|
| 118 |
+
*
|
| 119 |
+
* @param handle - The object with external memory to free
|
| 120 |
+
* @param keepDataAlive - If true, evaluates all lazy fields before freeing memory (default: false).
|
| 121 |
+
* This will take time to copy data from Rust to JavaScript, but prevents errors
|
| 122 |
+
* when accessing properties after the memory is freed.
|
| 123 |
+
* @returns Status object with `freed` boolean and optional `reason` string.
|
| 124 |
+
* - `{ freed: true }` if memory was successfully freed
|
| 125 |
+
* - `{ freed: false, reason: "..." }` if memory couldn't be freed (e.g., already freed or other references exist)
|
| 126 |
+
*
|
| 127 |
+
* @example
|
| 128 |
+
* ```typescript
|
| 129 |
+
* import { freeExternalMemory } from 'rolldown/experimental';
|
| 130 |
+
*
|
| 131 |
+
* const output = await bundle.generate();
|
| 132 |
+
* const chunk = output.output[0];
|
| 133 |
+
*
|
| 134 |
+
* // Use the chunk...
|
| 135 |
+
*
|
| 136 |
+
* // Manually free the memory (fast, but accessing properties after will throw)
|
| 137 |
+
* const status = freeExternalMemory(chunk); // { freed: true }
|
| 138 |
+
* const statusAgain = freeExternalMemory(chunk); // { freed: false, reason: "Memory has already been freed" }
|
| 139 |
+
*
|
| 140 |
+
* // Keep data alive before freeing (slower, but data remains accessible)
|
| 141 |
+
* freeExternalMemory(chunk, true); // Evaluates all lazy fields first
|
| 142 |
+
* console.log(chunk.code); // OK - data was copied to JavaScript before freeing
|
| 143 |
+
*
|
| 144 |
+
* // Without keepDataAlive, accessing chunk properties after freeing will throw an error
|
| 145 |
+
* ```
|
| 146 |
+
*/
|
| 147 |
+
function freeExternalMemory(handle, keepDataAlive = false) {
|
| 148 |
+
return handle[symbolForExternalMemoryHandle](keepDataAlive);
|
| 149 |
+
}
|
| 150 |
+
//#endregion
|
| 151 |
+
//#region src/api/experimental.ts
|
| 152 |
+
/**
|
| 153 |
+
* This is an experimental API. Its behavior may change in the future.
|
| 154 |
+
*
|
| 155 |
+
* - Calling this API will only execute the `scan/build` stage of rolldown.
|
| 156 |
+
* - `scan` will clean up all resources automatically, but if you want to ensure timely cleanup, you need to wait for the returned promise to resolve.
|
| 157 |
+
*
|
| 158 |
+
* @example To ensure cleanup of resources, use the returned promise to wait for the scan to complete.
|
| 159 |
+
* ```ts
|
| 160 |
+
* import { scan } from 'rolldown/api/experimental';
|
| 161 |
+
*
|
| 162 |
+
* const cleanupPromise = await scan(...);
|
| 163 |
+
* await cleanupPromise;
|
| 164 |
+
* // Now all resources have been cleaned up.
|
| 165 |
+
* ```
|
| 166 |
+
*/
|
| 167 |
+
const scan = async (rawInputOptions, rawOutputOptions = {}) => {
|
| 168 |
+
validateOption("input", rawInputOptions);
|
| 169 |
+
validateOption("output", rawOutputOptions);
|
| 170 |
+
const ret = await createBundlerOptions(await PluginDriver.callOptionsHook(rawInputOptions), rawOutputOptions, false);
|
| 171 |
+
const bundler = new import_binding.BindingBundler();
|
| 172 |
+
if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding.startAsyncRuntime)();
|
| 173 |
+
async function cleanup() {
|
| 174 |
+
await bundler.close();
|
| 175 |
+
await ret.stopWorkers?.();
|
| 176 |
+
(0, import_binding.shutdownAsyncRuntime)();
|
| 177 |
+
RolldownBuild.asyncRuntimeShutdown = true;
|
| 178 |
+
}
|
| 179 |
+
let cleanupPromise = Promise.resolve();
|
| 180 |
+
try {
|
| 181 |
+
unwrapBindingResult(await bundler.scan(ret.bundlerOptions));
|
| 182 |
+
} catch (err) {
|
| 183 |
+
await cleanup();
|
| 184 |
+
throw err;
|
| 185 |
+
} finally {
|
| 186 |
+
cleanupPromise = cleanup();
|
| 187 |
+
}
|
| 188 |
+
return cleanupPromise;
|
| 189 |
+
};
|
| 190 |
+
//#endregion
|
| 191 |
+
//#region src/plugin/parallel-plugin.ts
|
| 192 |
+
function defineParallelPlugin(pluginPath) {
|
| 193 |
+
return (options) => {
|
| 194 |
+
return { _parallel: {
|
| 195 |
+
fileUrl: pathToFileURL(pluginPath).href,
|
| 196 |
+
options
|
| 197 |
+
} };
|
| 198 |
+
};
|
| 199 |
+
}
|
| 200 |
+
//#endregion
|
| 201 |
+
//#region src/builtin-plugin/alias-plugin.ts
|
| 202 |
+
function viteAliasPlugin(config) {
|
| 203 |
+
return new BuiltinPlugin("builtin:vite-alias", config);
|
| 204 |
+
}
|
| 205 |
+
//#endregion
|
| 206 |
+
//#region src/builtin-plugin/bundle-analyzer-plugin.ts
|
| 207 |
+
/**
|
| 208 |
+
* A plugin that analyzes bundle composition and generates detailed reports.
|
| 209 |
+
*
|
| 210 |
+
* The plugin outputs a file containing detailed information about:
|
| 211 |
+
* - All chunks and their relationships
|
| 212 |
+
* - Modules bundled in each chunk
|
| 213 |
+
* - Import dependencies between chunks
|
| 214 |
+
* - Reachable modules from each entry point
|
| 215 |
+
*
|
| 216 |
+
* @example
|
| 217 |
+
* ```js
|
| 218 |
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
| 219 |
+
*
|
| 220 |
+
* export default {
|
| 221 |
+
* plugins: [
|
| 222 |
+
* bundleAnalyzerPlugin()
|
| 223 |
+
* ]
|
| 224 |
+
* }
|
| 225 |
+
* ```
|
| 226 |
+
*
|
| 227 |
+
* @example
|
| 228 |
+
* **Custom filename**
|
| 229 |
+
* ```js
|
| 230 |
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
| 231 |
+
*
|
| 232 |
+
* export default {
|
| 233 |
+
* plugins: [
|
| 234 |
+
* bundleAnalyzerPlugin({
|
| 235 |
+
* fileName: 'bundle-analysis.json'
|
| 236 |
+
* })
|
| 237 |
+
* ]
|
| 238 |
+
* }
|
| 239 |
+
* ```
|
| 240 |
+
*
|
| 241 |
+
* @example
|
| 242 |
+
* **LLM-friendly markdown output**
|
| 243 |
+
* ```js
|
| 244 |
+
* import { bundleAnalyzerPlugin } from 'rolldown/experimental';
|
| 245 |
+
*
|
| 246 |
+
* export default {
|
| 247 |
+
* plugins: [
|
| 248 |
+
* bundleAnalyzerPlugin({
|
| 249 |
+
* format: 'md'
|
| 250 |
+
* })
|
| 251 |
+
* ]
|
| 252 |
+
* }
|
| 253 |
+
* ```
|
| 254 |
+
*/
|
| 255 |
+
function bundleAnalyzerPlugin(config) {
|
| 256 |
+
return new BuiltinPlugin("builtin:bundle-analyzer", config);
|
| 257 |
+
}
|
| 258 |
+
//#endregion
|
| 259 |
+
//#region src/builtin-plugin/transform-plugin.ts
|
| 260 |
+
function viteTransformPlugin(config) {
|
| 261 |
+
return new BuiltinPlugin("builtin:vite-transform", {
|
| 262 |
+
...config,
|
| 263 |
+
include: normalizedStringOrRegex(config.include),
|
| 264 |
+
exclude: normalizedStringOrRegex(config.exclude),
|
| 265 |
+
jsxRefreshInclude: normalizedStringOrRegex(config.jsxRefreshInclude),
|
| 266 |
+
jsxRefreshExclude: normalizedStringOrRegex(config.jsxRefreshExclude),
|
| 267 |
+
yarnPnp: typeof process === "object" && !!process.versions?.pnp
|
| 268 |
+
});
|
| 269 |
+
}
|
| 270 |
+
//#endregion
|
| 271 |
+
//#region src/builtin-plugin/vite-manifest-plugin.ts
|
| 272 |
+
function viteManifestPlugin(config) {
|
| 273 |
+
return new BuiltinPlugin("builtin:vite-manifest", config);
|
| 274 |
+
}
|
| 275 |
+
//#endregion
|
| 276 |
+
//#region src/experimental-index.ts
|
| 277 |
+
/**
|
| 278 |
+
* In-memory file system for browser builds.
|
| 279 |
+
*
|
| 280 |
+
* This is a re-export of the {@link https://github.com/streamich/memfs | memfs} package used by the WASI runtime.
|
| 281 |
+
* It allows you to read and write files to a virtual filesystem when using rolldown in browser environments.
|
| 282 |
+
*
|
| 283 |
+
* - `fs`: A Node.js-compatible filesystem API (`IFs` from memfs)
|
| 284 |
+
* - `volume`: The underlying `Volume` instance that stores the filesystem state
|
| 285 |
+
*
|
| 286 |
+
* Returns `undefined` in Node.js builds (only available in browser builds via `@rolldown/browser`).
|
| 287 |
+
*
|
| 288 |
+
* @example
|
| 289 |
+
* ```typescript
|
| 290 |
+
* import { memfs } from 'rolldown/experimental';
|
| 291 |
+
*
|
| 292 |
+
* // Write files to virtual filesystem before bundling
|
| 293 |
+
* memfs?.volume.fromJSON({
|
| 294 |
+
* '/src/index.js': 'export const foo = 42;',
|
| 295 |
+
* '/package.json': '{"name": "my-app"}'
|
| 296 |
+
* });
|
| 297 |
+
*
|
| 298 |
+
* // Read files from the virtual filesystem
|
| 299 |
+
* const content = memfs?.fs.readFileSync('/src/index.js', 'utf8');
|
| 300 |
+
* ```
|
| 301 |
+
*
|
| 302 |
+
* @see {@link https://github.com/streamich/memfs} for more information on the memfs API.
|
| 303 |
+
*/
|
| 304 |
+
const memfs = void 0;
|
| 305 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 306 |
+
const parse = parse$1;
|
| 307 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 308 |
+
const parseSync = parseSync$1;
|
| 309 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 310 |
+
const minify = minify$1;
|
| 311 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 312 |
+
const minifySync = minifySync$1;
|
| 313 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 314 |
+
const transform = transform$1;
|
| 315 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 316 |
+
const transformSync = transformSync$1;
|
| 317 |
+
/** @deprecated Use from `rolldown/utils` instead. */
|
| 318 |
+
const TsconfigCache = TsconfigCache$1;
|
| 319 |
+
//#endregion
|
| 320 |
+
var BindingRebuildStrategy = import_binding.BindingRebuildStrategy;
|
| 321 |
+
var ResolverFactory = import_binding.ResolverFactory;
|
| 322 |
+
var isolatedDeclaration = import_binding.isolatedDeclaration;
|
| 323 |
+
var isolatedDeclarationSync = import_binding.isolatedDeclarationSync;
|
| 324 |
+
var moduleRunnerTransform = import_binding.moduleRunnerTransform;
|
| 325 |
+
export { BindingRebuildStrategy, DevEngine, ResolverFactory, TsconfigCache, bundleAnalyzerPlugin, defineParallelPlugin, dev, viteDynamicImportVarsPlugin as dynamicImportVarsPlugin, viteDynamicImportVarsPlugin, freeExternalMemory, viteImportGlobPlugin as importGlobPlugin, viteImportGlobPlugin, isolatedDeclaration, isolatedDeclarationPlugin, isolatedDeclarationSync, memfs, minify, minifySync, moduleRunnerTransform, oxcRuntimePlugin, parse, parseSync, resolveTsconfig, scan, transform, transformSync, viteAliasPlugin, viteBuildImportAnalysisPlugin, viteJsonPlugin, viteLoadFallbackPlugin, viteManifestPlugin, viteModulePreloadPolyfillPlugin, viteReactRefreshWrapperPlugin, viteReporterPlugin, viteResolvePlugin, viteTransformPlugin, viteWasmFallbackPlugin, viteWebWorkerPostPlugin };
|
shared/node_modules/rolldown/dist/experimental-runtime-types.d.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* @typedef {{ type: 'hmr:module-registered', modules: string[] }} DevRuntimeMessage
|
| 3 |
+
* @typedef {{ send(message: DevRuntimeMessage): void }} Messenger
|
| 4 |
+
*/
|
| 5 |
+
export class DevRuntime {
|
| 6 |
+
/**
|
| 7 |
+
* @param {Messenger} messenger
|
| 8 |
+
* @param {string} clientId
|
| 9 |
+
*/
|
| 10 |
+
constructor(messenger: Messenger, clientId: string);
|
| 11 |
+
/**
|
| 12 |
+
* Client ID generated at runtime initialization, used for lazy compilation requests.
|
| 13 |
+
* @type {string}
|
| 14 |
+
*/
|
| 15 |
+
clientId: string;
|
| 16 |
+
messenger: Messenger;
|
| 17 |
+
/**
|
| 18 |
+
* @type {Record<string, Module>}
|
| 19 |
+
*/
|
| 20 |
+
modules: Record<string, Module>;
|
| 21 |
+
/**
|
| 22 |
+
* @param {string} _moduleId
|
| 23 |
+
*/
|
| 24 |
+
createModuleHotContext(_moduleId: string): void;
|
| 25 |
+
/**
|
| 26 |
+
* @param {[string, string][]} _boundaries
|
| 27 |
+
*/
|
| 28 |
+
applyUpdates(_boundaries: [string, string][]): void;
|
| 29 |
+
/**
|
| 30 |
+
* @param {string} id
|
| 31 |
+
* @param {{ exports: any }} exportsHolder
|
| 32 |
+
*/
|
| 33 |
+
registerModule(id: string, exportsHolder: {
|
| 34 |
+
exports: any;
|
| 35 |
+
}): void;
|
| 36 |
+
/**
|
| 37 |
+
* @param {string} id
|
| 38 |
+
*/
|
| 39 |
+
loadExports(id: string): any;
|
| 40 |
+
/**
|
| 41 |
+
* __esmMin
|
| 42 |
+
*
|
| 43 |
+
* When `dedup` is truthy and `id` is already registered on the runtime,
|
| 44 |
+
* skip the factory: another lazy blob got there first. HMR patches pass
|
| 45 |
+
* no `dedup` so they always re-run the factory and replace the registered
|
| 46 |
+
* exports.
|
| 47 |
+
*
|
| 48 |
+
* @type {<T>(id: string, fn: any, dedup: any, res: T) => () => T}
|
| 49 |
+
* @internal
|
| 50 |
+
*/
|
| 51 |
+
createEsmInitializer: <T>(id: string, fn: any, dedup: any, res: T) => () => T;
|
| 52 |
+
/**
|
| 53 |
+
* __commonJSMin
|
| 54 |
+
*
|
| 55 |
+
* Same dedup gate as createEsmInitializer. With `dedup` truthy and `id`
|
| 56 |
+
* registered, reuse the registered exports object; otherwise run the
|
| 57 |
+
* factory.
|
| 58 |
+
*
|
| 59 |
+
* @type {<T extends { exports: any }>(id: string, cb: any, dedup: any, mod: { exports: any }, registered: any) => () => T}
|
| 60 |
+
* @internal
|
| 61 |
+
*/
|
| 62 |
+
createCjsInitializer: <T extends {
|
| 63 |
+
exports: any;
|
| 64 |
+
}>(id: string, cb: any, dedup: any, mod: {
|
| 65 |
+
exports: any;
|
| 66 |
+
}, registered: any) => () => T;
|
| 67 |
+
/** @internal */
|
| 68 |
+
__toESM: any;
|
| 69 |
+
/** @internal */
|
| 70 |
+
__toCommonJS: any;
|
| 71 |
+
/** @internal */
|
| 72 |
+
__exportAll: any;
|
| 73 |
+
/**
|
| 74 |
+
* @param {boolean} [isNodeMode]
|
| 75 |
+
* @returns {(mod: any) => any}
|
| 76 |
+
* @internal
|
| 77 |
+
*/
|
| 78 |
+
__toDynamicImportESM: (isNodeMode?: boolean) => (mod: any) => any;
|
| 79 |
+
/** @internal */
|
| 80 |
+
__reExport: any;
|
| 81 |
+
sendModuleRegisteredMessage: (module: string) => void;
|
| 82 |
+
}
|
| 83 |
+
export type DevRuntimeMessage = {
|
| 84 |
+
type: "hmr:module-registered";
|
| 85 |
+
modules: string[];
|
| 86 |
+
};
|
| 87 |
+
export type Messenger = {
|
| 88 |
+
send(message: DevRuntimeMessage): void;
|
| 89 |
+
};
|
| 90 |
+
declare class Module {
|
| 91 |
+
/**
|
| 92 |
+
* @param {string} id
|
| 93 |
+
*/
|
| 94 |
+
constructor(id: string);
|
| 95 |
+
/**
|
| 96 |
+
* @type {{ exports: any }}
|
| 97 |
+
*/
|
| 98 |
+
exportsHolder: {
|
| 99 |
+
exports: any;
|
| 100 |
+
};
|
| 101 |
+
/**
|
| 102 |
+
* @type {string}
|
| 103 |
+
*/
|
| 104 |
+
id: string;
|
| 105 |
+
get exports(): any;
|
| 106 |
+
}
|
| 107 |
+
export {};
|
shared/node_modules/rolldown/dist/filter-index.d.mts
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
| 1 |
+
import { N as withFilter } from "./shared/define-config-ChOOV2QZ.mjs";
|
| 2 |
+
|
| 3 |
+
//#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.1/node_modules/@rolldown/pluginutils/dist/filter/index.d.mts
|
| 4 |
+
//#region src/filter/composable-filters.d.ts
|
| 5 |
+
type StringOrRegExp = string | RegExp;
|
| 6 |
+
type PluginModuleType = 'js' | 'jsx' | 'ts' | 'tsx' | 'json' | 'text' | 'base64' | 'dataurl' | 'binary' | 'empty' | (string & {});
|
| 7 |
+
type FilterExpressionKind = FilterExpression['kind'];
|
| 8 |
+
type FilterExpression = And | Or | Not | Id | ImporterId | ModuleType | Code | Query;
|
| 9 |
+
type TopLevelFilterExpression = Include | Exclude;
|
| 10 |
+
declare class And {
|
| 11 |
+
kind: 'and';
|
| 12 |
+
args: FilterExpression[];
|
| 13 |
+
constructor(...args: FilterExpression[]);
|
| 14 |
+
}
|
| 15 |
+
declare class Or {
|
| 16 |
+
kind: 'or';
|
| 17 |
+
args: FilterExpression[];
|
| 18 |
+
constructor(...args: FilterExpression[]);
|
| 19 |
+
}
|
| 20 |
+
declare class Not {
|
| 21 |
+
kind: 'not';
|
| 22 |
+
expr: FilterExpression;
|
| 23 |
+
constructor(expr: FilterExpression);
|
| 24 |
+
}
|
| 25 |
+
interface QueryFilterObject {
|
| 26 |
+
[key: string]: StringOrRegExp | boolean;
|
| 27 |
+
}
|
| 28 |
+
interface IdParams {
|
| 29 |
+
cleanUrl?: boolean;
|
| 30 |
+
}
|
| 31 |
+
declare class Id {
|
| 32 |
+
kind: 'id';
|
| 33 |
+
pattern: StringOrRegExp;
|
| 34 |
+
params: IdParams;
|
| 35 |
+
constructor(pattern: StringOrRegExp, params?: IdParams);
|
| 36 |
+
}
|
| 37 |
+
declare class ImporterId {
|
| 38 |
+
kind: 'importerId';
|
| 39 |
+
pattern: StringOrRegExp;
|
| 40 |
+
params: IdParams;
|
| 41 |
+
constructor(pattern: StringOrRegExp, params?: IdParams);
|
| 42 |
+
}
|
| 43 |
+
declare class ModuleType {
|
| 44 |
+
kind: 'moduleType';
|
| 45 |
+
pattern: PluginModuleType;
|
| 46 |
+
constructor(pattern: PluginModuleType);
|
| 47 |
+
}
|
| 48 |
+
declare class Code {
|
| 49 |
+
kind: 'code';
|
| 50 |
+
pattern: StringOrRegExp;
|
| 51 |
+
constructor(expr: StringOrRegExp);
|
| 52 |
+
}
|
| 53 |
+
declare class Query {
|
| 54 |
+
kind: 'query';
|
| 55 |
+
key: string;
|
| 56 |
+
pattern: StringOrRegExp | boolean;
|
| 57 |
+
constructor(key: string, pattern: StringOrRegExp | boolean);
|
| 58 |
+
}
|
| 59 |
+
declare class Include {
|
| 60 |
+
kind: 'include';
|
| 61 |
+
expr: FilterExpression;
|
| 62 |
+
constructor(expr: FilterExpression);
|
| 63 |
+
}
|
| 64 |
+
declare class Exclude {
|
| 65 |
+
kind: 'exclude';
|
| 66 |
+
expr: FilterExpression;
|
| 67 |
+
constructor(expr: FilterExpression);
|
| 68 |
+
}
|
| 69 |
+
declare function and(...args: FilterExpression[]): And;
|
| 70 |
+
declare function or(...args: FilterExpression[]): Or;
|
| 71 |
+
declare function not(expr: FilterExpression): Not;
|
| 72 |
+
declare function id(pattern: StringOrRegExp, params?: IdParams): Id;
|
| 73 |
+
declare function importerId(pattern: StringOrRegExp, params?: IdParams): ImporterId;
|
| 74 |
+
declare function moduleType(pattern: PluginModuleType): ModuleType;
|
| 75 |
+
declare function code(pattern: StringOrRegExp): Code;
|
| 76 |
+
declare function query(key: string, pattern: StringOrRegExp | boolean): Query;
|
| 77 |
+
declare function include(expr: FilterExpression): Include;
|
| 78 |
+
declare function exclude(expr: FilterExpression): Exclude;
|
| 79 |
+
/**
|
| 80 |
+
* convert a queryObject to FilterExpression like
|
| 81 |
+
* ```js
|
| 82 |
+
* and(query(k1, v1), query(k2, v2))
|
| 83 |
+
* ```
|
| 84 |
+
* @param queryFilterObject The query filter object needs to be matched.
|
| 85 |
+
* @returns a `And` FilterExpression
|
| 86 |
+
*/
|
| 87 |
+
declare function queries(queryFilter: QueryFilterObject): And;
|
| 88 |
+
declare function interpreter(exprs: TopLevelFilterExpression | TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string): boolean;
|
| 89 |
+
interface InterpreterCtx {
|
| 90 |
+
urlSearchParamsCache?: URLSearchParams;
|
| 91 |
+
}
|
| 92 |
+
declare function interpreterImpl(expr: TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean;
|
| 93 |
+
declare function exprInterpreter(expr: FilterExpression, code?: string, id?: string, moduleType?: PluginModuleType, importerId?: string, ctx?: InterpreterCtx): boolean; //#endregion
|
| 94 |
+
//#region src/filter/filter-vite-plugins.d.ts
|
| 95 |
+
/**
|
| 96 |
+
* Filters out Vite plugins that have `apply: 'serve'` set.
|
| 97 |
+
*
|
| 98 |
+
* Since Rolldown operates in build mode, plugins marked with `apply: 'serve'`
|
| 99 |
+
* are intended only for Vite's dev server and should be excluded from the build process.
|
| 100 |
+
*
|
| 101 |
+
* @param plugins - Array of plugins (can include nested arrays)
|
| 102 |
+
* @returns Filtered array with serve-only plugins removed
|
| 103 |
+
*
|
| 104 |
+
* @example
|
| 105 |
+
* ```ts
|
| 106 |
+
* import { defineConfig } from 'rolldown';
|
| 107 |
+
* import { filterVitePlugins } from '@rolldown/pluginutils';
|
| 108 |
+
* import viteReact from '@vitejs/plugin-react';
|
| 109 |
+
*
|
| 110 |
+
* export default defineConfig({
|
| 111 |
+
* plugins: filterVitePlugins([
|
| 112 |
+
* viteReact(),
|
| 113 |
+
* {
|
| 114 |
+
* name: 'dev-only',
|
| 115 |
+
* apply: 'serve', // This will be filtered out
|
| 116 |
+
* // ...
|
| 117 |
+
* }
|
| 118 |
+
* ])
|
| 119 |
+
* });
|
| 120 |
+
* ```
|
| 121 |
+
*/
|
| 122 |
+
declare function filterVitePlugins<T = any>(plugins: T | T[] | null | undefined | false): T[]; //#endregion
|
| 123 |
+
//#region src/filter/simple-filters.d.ts
|
| 124 |
+
/**
|
| 125 |
+
* Constructs a RegExp that matches the exact string specified.
|
| 126 |
+
*
|
| 127 |
+
* This is useful for plugin hook filters.
|
| 128 |
+
*
|
| 129 |
+
* @param str the string to match.
|
| 130 |
+
* @param flags flags for the RegExp.
|
| 131 |
+
*
|
| 132 |
+
* @example
|
| 133 |
+
* ```ts
|
| 134 |
+
* import { exactRegex } from '@rolldown/pluginutils';
|
| 135 |
+
* const plugin = {
|
| 136 |
+
* name: 'plugin',
|
| 137 |
+
* resolveId: {
|
| 138 |
+
* filter: { id: exactRegex('foo') },
|
| 139 |
+
* handler(id) {} // will only be called for `foo`
|
| 140 |
+
* }
|
| 141 |
+
* }
|
| 142 |
+
* ```
|
| 143 |
+
*/
|
| 144 |
+
declare function exactRegex(str: string, flags?: string): RegExp;
|
| 145 |
+
/**
|
| 146 |
+
* Constructs a RegExp that matches a value that has the specified prefix.
|
| 147 |
+
*
|
| 148 |
+
* This is useful for plugin hook filters.
|
| 149 |
+
*
|
| 150 |
+
* @param str the string to match.
|
| 151 |
+
* @param flags flags for the RegExp.
|
| 152 |
+
*
|
| 153 |
+
* @example
|
| 154 |
+
* ```ts
|
| 155 |
+
* import { prefixRegex } from '@rolldown/pluginutils';
|
| 156 |
+
* const plugin = {
|
| 157 |
+
* name: 'plugin',
|
| 158 |
+
* resolveId: {
|
| 159 |
+
* filter: { id: prefixRegex('foo') },
|
| 160 |
+
* handler(id) {} // will only be called for IDs starting with `foo`
|
| 161 |
+
* }
|
| 162 |
+
* }
|
| 163 |
+
* ```
|
| 164 |
+
*/
|
| 165 |
+
declare function prefixRegex(str: string, flags?: string): RegExp;
|
| 166 |
+
type WidenString<T> = T extends string ? string : T;
|
| 167 |
+
/**
|
| 168 |
+
* Converts a id filter to match with an id with a query.
|
| 169 |
+
*
|
| 170 |
+
* @param input the id filters to convert.
|
| 171 |
+
*
|
| 172 |
+
* @example
|
| 173 |
+
* ```ts
|
| 174 |
+
* import { makeIdFiltersToMatchWithQuery } from '@rolldown/pluginutils';
|
| 175 |
+
* const plugin = {
|
| 176 |
+
* name: 'plugin',
|
| 177 |
+
* transform: {
|
| 178 |
+
* filter: { id: makeIdFiltersToMatchWithQuery(['**' + '/*.js', /\.ts$/]) },
|
| 179 |
+
* // The handler will be called for IDs like:
|
| 180 |
+
* // - foo.js
|
| 181 |
+
* // - foo.js?foo
|
| 182 |
+
* // - foo.txt?foo.js
|
| 183 |
+
* // - foo.ts
|
| 184 |
+
* // - foo.ts?foo
|
| 185 |
+
* // - foo.txt?foo.ts
|
| 186 |
+
* handler(code, id) {}
|
| 187 |
+
* }
|
| 188 |
+
* }
|
| 189 |
+
* ```
|
| 190 |
+
*/
|
| 191 |
+
declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: T): WidenString<T>;
|
| 192 |
+
declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: readonly T[]): WidenString<T>[];
|
| 193 |
+
declare function makeIdFiltersToMatchWithQuery(input: string | RegExp | readonly (string | RegExp)[]): string | RegExp | (string | RegExp)[]; //#endregion
|
| 194 |
+
//#endregion
|
| 195 |
+
export { FilterExpression, FilterExpressionKind, QueryFilterObject, TopLevelFilterExpression, and, code, exactRegex, exclude, exprInterpreter, filterVitePlugins, id, importerId, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query, withFilter };
|
shared/node_modules/rolldown/dist/filter-index.mjs
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { n as isPromiseLike, t as arraify } from "./shared/misc-CoQm4NHO.mjs";
|
| 2 |
+
//#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.1/node_modules/@rolldown/pluginutils/dist/filter-B_mD-HGz.mjs
|
| 3 |
+
const postfixRE = /[?#].*$/;
|
| 4 |
+
function cleanUrl(url) {
|
| 5 |
+
return url.replace(postfixRE, "");
|
| 6 |
+
}
|
| 7 |
+
function extractQueryWithoutFragment(url) {
|
| 8 |
+
const questionMarkIndex = url.indexOf("?");
|
| 9 |
+
if (questionMarkIndex === -1) return "";
|
| 10 |
+
const fragmentIndex = url.indexOf("#", questionMarkIndex);
|
| 11 |
+
if (fragmentIndex === -1) return url.substring(questionMarkIndex);
|
| 12 |
+
else return url.substring(questionMarkIndex, fragmentIndex);
|
| 13 |
+
}
|
| 14 |
+
var And = class {
|
| 15 |
+
kind;
|
| 16 |
+
args;
|
| 17 |
+
constructor(...args) {
|
| 18 |
+
if (args.length === 0) throw new Error("`And` expects at least one operand");
|
| 19 |
+
this.args = args;
|
| 20 |
+
this.kind = "and";
|
| 21 |
+
}
|
| 22 |
+
};
|
| 23 |
+
var Or = class {
|
| 24 |
+
kind;
|
| 25 |
+
args;
|
| 26 |
+
constructor(...args) {
|
| 27 |
+
if (args.length === 0) throw new Error("`Or` expects at least one operand");
|
| 28 |
+
this.args = args;
|
| 29 |
+
this.kind = "or";
|
| 30 |
+
}
|
| 31 |
+
};
|
| 32 |
+
var Not = class {
|
| 33 |
+
kind;
|
| 34 |
+
expr;
|
| 35 |
+
constructor(expr) {
|
| 36 |
+
this.expr = expr;
|
| 37 |
+
this.kind = "not";
|
| 38 |
+
}
|
| 39 |
+
};
|
| 40 |
+
var Id = class {
|
| 41 |
+
kind;
|
| 42 |
+
pattern;
|
| 43 |
+
params;
|
| 44 |
+
constructor(pattern, params) {
|
| 45 |
+
this.pattern = pattern;
|
| 46 |
+
this.kind = "id";
|
| 47 |
+
this.params = params ?? { cleanUrl: false };
|
| 48 |
+
}
|
| 49 |
+
};
|
| 50 |
+
var ImporterId = class {
|
| 51 |
+
kind;
|
| 52 |
+
pattern;
|
| 53 |
+
params;
|
| 54 |
+
constructor(pattern, params) {
|
| 55 |
+
this.pattern = pattern;
|
| 56 |
+
this.kind = "importerId";
|
| 57 |
+
this.params = params ?? { cleanUrl: false };
|
| 58 |
+
}
|
| 59 |
+
};
|
| 60 |
+
var ModuleType = class {
|
| 61 |
+
kind;
|
| 62 |
+
pattern;
|
| 63 |
+
constructor(pattern) {
|
| 64 |
+
this.pattern = pattern;
|
| 65 |
+
this.kind = "moduleType";
|
| 66 |
+
}
|
| 67 |
+
};
|
| 68 |
+
var Code = class {
|
| 69 |
+
kind;
|
| 70 |
+
pattern;
|
| 71 |
+
constructor(expr) {
|
| 72 |
+
this.pattern = expr;
|
| 73 |
+
this.kind = "code";
|
| 74 |
+
}
|
| 75 |
+
};
|
| 76 |
+
var Query = class {
|
| 77 |
+
kind;
|
| 78 |
+
key;
|
| 79 |
+
pattern;
|
| 80 |
+
constructor(key, pattern) {
|
| 81 |
+
this.pattern = pattern;
|
| 82 |
+
this.key = key;
|
| 83 |
+
this.kind = "query";
|
| 84 |
+
}
|
| 85 |
+
};
|
| 86 |
+
var Include = class {
|
| 87 |
+
kind;
|
| 88 |
+
expr;
|
| 89 |
+
constructor(expr) {
|
| 90 |
+
this.expr = expr;
|
| 91 |
+
this.kind = "include";
|
| 92 |
+
}
|
| 93 |
+
};
|
| 94 |
+
var Exclude = class {
|
| 95 |
+
kind;
|
| 96 |
+
expr;
|
| 97 |
+
constructor(expr) {
|
| 98 |
+
this.expr = expr;
|
| 99 |
+
this.kind = "exclude";
|
| 100 |
+
}
|
| 101 |
+
};
|
| 102 |
+
function and(...args) {
|
| 103 |
+
return new And(...args);
|
| 104 |
+
}
|
| 105 |
+
function or(...args) {
|
| 106 |
+
return new Or(...args);
|
| 107 |
+
}
|
| 108 |
+
function not(expr) {
|
| 109 |
+
return new Not(expr);
|
| 110 |
+
}
|
| 111 |
+
function id(pattern, params) {
|
| 112 |
+
return new Id(pattern, params);
|
| 113 |
+
}
|
| 114 |
+
function importerId(pattern, params) {
|
| 115 |
+
return new ImporterId(pattern, params);
|
| 116 |
+
}
|
| 117 |
+
function moduleType(pattern) {
|
| 118 |
+
return new ModuleType(pattern);
|
| 119 |
+
}
|
| 120 |
+
function code(pattern) {
|
| 121 |
+
return new Code(pattern);
|
| 122 |
+
}
|
| 123 |
+
function query(key, pattern) {
|
| 124 |
+
return new Query(key, pattern);
|
| 125 |
+
}
|
| 126 |
+
function include(expr) {
|
| 127 |
+
return new Include(expr);
|
| 128 |
+
}
|
| 129 |
+
function exclude(expr) {
|
| 130 |
+
return new Exclude(expr);
|
| 131 |
+
}
|
| 132 |
+
/**
|
| 133 |
+
* convert a queryObject to FilterExpression like
|
| 134 |
+
* ```js
|
| 135 |
+
* and(query(k1, v1), query(k2, v2))
|
| 136 |
+
* ```
|
| 137 |
+
* @param queryFilterObject The query filter object needs to be matched.
|
| 138 |
+
* @returns a `And` FilterExpression
|
| 139 |
+
*/
|
| 140 |
+
function queries(queryFilter) {
|
| 141 |
+
return and(...Object.entries(queryFilter).map(([key, value]) => {
|
| 142 |
+
return new Query(key, value);
|
| 143 |
+
}));
|
| 144 |
+
}
|
| 145 |
+
function interpreter(exprs, code, id, moduleType, importerId) {
|
| 146 |
+
let arr = [];
|
| 147 |
+
if (Array.isArray(exprs)) arr = exprs;
|
| 148 |
+
else arr = [exprs];
|
| 149 |
+
return interpreterImpl(arr, code, id, moduleType, importerId);
|
| 150 |
+
}
|
| 151 |
+
function interpreterImpl(expr, code, id, moduleType, importerId, ctx = {}) {
|
| 152 |
+
let hasInclude = false;
|
| 153 |
+
for (const e of expr) switch (e.kind) {
|
| 154 |
+
case "include":
|
| 155 |
+
hasInclude = true;
|
| 156 |
+
if (exprInterpreter(e.expr, code, id, moduleType, importerId, ctx)) return true;
|
| 157 |
+
break;
|
| 158 |
+
case "exclude":
|
| 159 |
+
if (exprInterpreter(e.expr, code, id, moduleType, importerId, ctx)) return false;
|
| 160 |
+
break;
|
| 161 |
+
}
|
| 162 |
+
return !hasInclude;
|
| 163 |
+
}
|
| 164 |
+
function exprInterpreter(expr, code, id, moduleType, importerId, ctx = {}) {
|
| 165 |
+
switch (expr.kind) {
|
| 166 |
+
case "and": return expr.args.every((e) => exprInterpreter(e, code, id, moduleType, importerId, ctx));
|
| 167 |
+
case "or": return expr.args.some((e) => exprInterpreter(e, code, id, moduleType, importerId, ctx));
|
| 168 |
+
case "not": return !exprInterpreter(expr.expr, code, id, moduleType, importerId, ctx);
|
| 169 |
+
case "id": {
|
| 170 |
+
if (id === void 0) throw new Error("`id` is required for `id` expression");
|
| 171 |
+
let idToMatch = id;
|
| 172 |
+
if (expr.params.cleanUrl) idToMatch = cleanUrl(idToMatch);
|
| 173 |
+
return typeof expr.pattern === "string" ? idToMatch === expr.pattern : expr.pattern.test(idToMatch);
|
| 174 |
+
}
|
| 175 |
+
case "importerId": {
|
| 176 |
+
if (importerId === void 0) return false;
|
| 177 |
+
let importerIdToMatch = importerId;
|
| 178 |
+
if (expr.params.cleanUrl) importerIdToMatch = cleanUrl(importerIdToMatch);
|
| 179 |
+
return typeof expr.pattern === "string" ? importerIdToMatch === expr.pattern : expr.pattern.test(importerIdToMatch);
|
| 180 |
+
}
|
| 181 |
+
case "moduleType":
|
| 182 |
+
if (moduleType === void 0) throw new Error("`moduleType` is required for `moduleType` expression");
|
| 183 |
+
return moduleType === expr.pattern;
|
| 184 |
+
case "code":
|
| 185 |
+
if (code === void 0) throw new Error("`code` is required for `code` expression");
|
| 186 |
+
return typeof expr.pattern === "string" ? code.includes(expr.pattern) : expr.pattern.test(code);
|
| 187 |
+
case "query": {
|
| 188 |
+
if (id === void 0) throw new Error("`id` is required for `Query` expression");
|
| 189 |
+
if (!ctx.urlSearchParamsCache) {
|
| 190 |
+
let queryString = extractQueryWithoutFragment(id);
|
| 191 |
+
ctx.urlSearchParamsCache = new URLSearchParams(queryString);
|
| 192 |
+
}
|
| 193 |
+
let urlParams = ctx.urlSearchParamsCache;
|
| 194 |
+
if (typeof expr.pattern === "boolean") if (expr.pattern) return urlParams.has(expr.key);
|
| 195 |
+
else return !urlParams.has(expr.key);
|
| 196 |
+
else if (typeof expr.pattern === "string") return urlParams.get(expr.key) === expr.pattern;
|
| 197 |
+
else return expr.pattern.test(urlParams.get(expr.key) ?? "");
|
| 198 |
+
}
|
| 199 |
+
default: throw new Error(`Expression ${JSON.stringify(expr)} is not expected.`);
|
| 200 |
+
}
|
| 201 |
+
}
|
| 202 |
+
/**
|
| 203 |
+
* Filters out Vite plugins that have `apply: 'serve'` set.
|
| 204 |
+
*
|
| 205 |
+
* Since Rolldown operates in build mode, plugins marked with `apply: 'serve'`
|
| 206 |
+
* are intended only for Vite's dev server and should be excluded from the build process.
|
| 207 |
+
*
|
| 208 |
+
* @param plugins - Array of plugins (can include nested arrays)
|
| 209 |
+
* @returns Filtered array with serve-only plugins removed
|
| 210 |
+
*
|
| 211 |
+
* @example
|
| 212 |
+
* ```ts
|
| 213 |
+
* import { defineConfig } from 'rolldown';
|
| 214 |
+
* import { filterVitePlugins } from '@rolldown/pluginutils';
|
| 215 |
+
* import viteReact from '@vitejs/plugin-react';
|
| 216 |
+
*
|
| 217 |
+
* export default defineConfig({
|
| 218 |
+
* plugins: filterVitePlugins([
|
| 219 |
+
* viteReact(),
|
| 220 |
+
* {
|
| 221 |
+
* name: 'dev-only',
|
| 222 |
+
* apply: 'serve', // This will be filtered out
|
| 223 |
+
* // ...
|
| 224 |
+
* }
|
| 225 |
+
* ])
|
| 226 |
+
* });
|
| 227 |
+
* ```
|
| 228 |
+
*/
|
| 229 |
+
function filterVitePlugins(plugins) {
|
| 230 |
+
if (!plugins) return [];
|
| 231 |
+
const pluginArray = Array.isArray(plugins) ? plugins : [plugins];
|
| 232 |
+
const result = [];
|
| 233 |
+
for (const plugin of pluginArray) {
|
| 234 |
+
if (!plugin) continue;
|
| 235 |
+
if (Array.isArray(plugin)) {
|
| 236 |
+
result.push(...filterVitePlugins(plugin));
|
| 237 |
+
continue;
|
| 238 |
+
}
|
| 239 |
+
const pluginWithApply = plugin;
|
| 240 |
+
if ("apply" in pluginWithApply) {
|
| 241 |
+
const applyValue = pluginWithApply.apply;
|
| 242 |
+
if (typeof applyValue === "function") try {
|
| 243 |
+
if (applyValue({}, {
|
| 244 |
+
command: "build",
|
| 245 |
+
mode: "production"
|
| 246 |
+
})) result.push(plugin);
|
| 247 |
+
} catch {
|
| 248 |
+
result.push(plugin);
|
| 249 |
+
}
|
| 250 |
+
else if (applyValue === "serve") continue;
|
| 251 |
+
else result.push(plugin);
|
| 252 |
+
} else result.push(plugin);
|
| 253 |
+
}
|
| 254 |
+
return result;
|
| 255 |
+
}
|
| 256 |
+
/**
|
| 257 |
+
* Constructs a RegExp that matches the exact string specified.
|
| 258 |
+
*
|
| 259 |
+
* This is useful for plugin hook filters.
|
| 260 |
+
*
|
| 261 |
+
* @param str the string to match.
|
| 262 |
+
* @param flags flags for the RegExp.
|
| 263 |
+
*
|
| 264 |
+
* @example
|
| 265 |
+
* ```ts
|
| 266 |
+
* import { exactRegex } from '@rolldown/pluginutils';
|
| 267 |
+
* const plugin = {
|
| 268 |
+
* name: 'plugin',
|
| 269 |
+
* resolveId: {
|
| 270 |
+
* filter: { id: exactRegex('foo') },
|
| 271 |
+
* handler(id) {} // will only be called for `foo`
|
| 272 |
+
* }
|
| 273 |
+
* }
|
| 274 |
+
* ```
|
| 275 |
+
*/
|
| 276 |
+
function exactRegex(str, flags) {
|
| 277 |
+
return new RegExp(`^${escapeRegex(str)}$`, flags);
|
| 278 |
+
}
|
| 279 |
+
/**
|
| 280 |
+
* Constructs a RegExp that matches a value that has the specified prefix.
|
| 281 |
+
*
|
| 282 |
+
* This is useful for plugin hook filters.
|
| 283 |
+
*
|
| 284 |
+
* @param str the string to match.
|
| 285 |
+
* @param flags flags for the RegExp.
|
| 286 |
+
*
|
| 287 |
+
* @example
|
| 288 |
+
* ```ts
|
| 289 |
+
* import { prefixRegex } from '@rolldown/pluginutils';
|
| 290 |
+
* const plugin = {
|
| 291 |
+
* name: 'plugin',
|
| 292 |
+
* resolveId: {
|
| 293 |
+
* filter: { id: prefixRegex('foo') },
|
| 294 |
+
* handler(id) {} // will only be called for IDs starting with `foo`
|
| 295 |
+
* }
|
| 296 |
+
* }
|
| 297 |
+
* ```
|
| 298 |
+
*/
|
| 299 |
+
function prefixRegex(str, flags) {
|
| 300 |
+
return new RegExp(`^${escapeRegex(str)}`, flags);
|
| 301 |
+
}
|
| 302 |
+
const escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g;
|
| 303 |
+
function escapeRegex(str) {
|
| 304 |
+
return str.replace(escapeRegexRE, "\\$&");
|
| 305 |
+
}
|
| 306 |
+
function makeIdFiltersToMatchWithQuery(input) {
|
| 307 |
+
if (!Array.isArray(input)) return makeIdFilterToMatchWithQuery(input);
|
| 308 |
+
return input.map((i) => makeIdFilterToMatchWithQuery(i));
|
| 309 |
+
}
|
| 310 |
+
function makeIdFilterToMatchWithQuery(input) {
|
| 311 |
+
if (typeof input === "string") return `${input}{?*,}`;
|
| 312 |
+
return makeRegexIdFilterToMatchWithQuery(input);
|
| 313 |
+
}
|
| 314 |
+
function makeRegexIdFilterToMatchWithQuery(input) {
|
| 315 |
+
return new RegExp(input.source.replace(/(?<!\\)\$/g, "(?:\\?.*)?$"), input.flags);
|
| 316 |
+
}
|
| 317 |
+
//#endregion
|
| 318 |
+
//#region src/plugin/with-filter.ts
|
| 319 |
+
function withFilterImpl(pluginOption, filterObjectList) {
|
| 320 |
+
if (isPromiseLike(pluginOption)) return pluginOption.then((p) => withFilter(p, filterObjectList));
|
| 321 |
+
if (pluginOption == false || pluginOption == null) return pluginOption;
|
| 322 |
+
if (Array.isArray(pluginOption)) return pluginOption.map((p) => withFilter(p, filterObjectList));
|
| 323 |
+
let plugin = pluginOption;
|
| 324 |
+
let filterObjectIndex = findMatchedFilterObject(plugin.name, filterObjectList);
|
| 325 |
+
if (filterObjectIndex === -1) return plugin;
|
| 326 |
+
let filterObject = filterObjectList[filterObjectIndex];
|
| 327 |
+
Object.keys(plugin).forEach((key) => {
|
| 328 |
+
switch (key) {
|
| 329 |
+
case "transform":
|
| 330 |
+
case "resolveId":
|
| 331 |
+
case "load":
|
| 332 |
+
if (!plugin[key]) return;
|
| 333 |
+
if (typeof plugin[key] === "object") plugin[key].filter = filterObject[key] ?? plugin[key].filter;
|
| 334 |
+
else plugin[key] = {
|
| 335 |
+
handler: plugin[key],
|
| 336 |
+
filter: filterObject[key]
|
| 337 |
+
};
|
| 338 |
+
break;
|
| 339 |
+
default: break;
|
| 340 |
+
}
|
| 341 |
+
});
|
| 342 |
+
return plugin;
|
| 343 |
+
}
|
| 344 |
+
/**
|
| 345 |
+
* A helper function to add plugin hook filters to a plugin or an array of plugins.
|
| 346 |
+
*
|
| 347 |
+
* @example
|
| 348 |
+
* ```ts
|
| 349 |
+
* import yaml from '@rollup/plugin-yaml';
|
| 350 |
+
* import { defineConfig } from 'rolldown';
|
| 351 |
+
* import { withFilter } from 'rolldown/filter';
|
| 352 |
+
*
|
| 353 |
+
* export default defineConfig({
|
| 354 |
+
* plugins: [
|
| 355 |
+
* // Run the transform hook of the `yaml` plugin
|
| 356 |
+
* // only for modules which end in `.yaml`
|
| 357 |
+
* withFilter(
|
| 358 |
+
* yaml({}),
|
| 359 |
+
* { transform: { id: /\.yaml$/ } },
|
| 360 |
+
* ),
|
| 361 |
+
* ],
|
| 362 |
+
* });
|
| 363 |
+
* ```
|
| 364 |
+
*
|
| 365 |
+
* @category Config
|
| 366 |
+
*/
|
| 367 |
+
function withFilter(pluginOption, filterObject) {
|
| 368 |
+
return withFilterImpl(pluginOption, arraify(filterObject));
|
| 369 |
+
}
|
| 370 |
+
function findMatchedFilterObject(pluginName, overrideFilterObjectList) {
|
| 371 |
+
if (overrideFilterObjectList.length === 1 && overrideFilterObjectList[0].pluginNamePattern === void 0) return 0;
|
| 372 |
+
for (let i = 0; i < overrideFilterObjectList.length; i++) for (let j = 0; j < (overrideFilterObjectList[i].pluginNamePattern ?? []).length; j++) {
|
| 373 |
+
let pattern = overrideFilterObjectList[i].pluginNamePattern[j];
|
| 374 |
+
if (typeof pattern === "string" && pattern === pluginName) return i;
|
| 375 |
+
else if (pattern instanceof RegExp && pattern.test(pluginName)) return i;
|
| 376 |
+
}
|
| 377 |
+
return -1;
|
| 378 |
+
}
|
| 379 |
+
//#endregion
|
| 380 |
+
export { and, code, exactRegex, exclude, exprInterpreter, filterVitePlugins, id, importerId, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query, withFilter };
|
shared/node_modules/rolldown/dist/get-log-filter.d.mts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { a as RolldownLog } from "./shared/logging-BSNejiLS.mjs";
|
| 2 |
+
import { n as getLogFilter, t as GetLogFilter } from "./shared/get-log-filter-BpNVNJ5-.mjs";
|
| 3 |
+
export { GetLogFilter, type RolldownLog, type RolldownLog as RollupLog, getLogFilter as default };
|
shared/node_modules/rolldown/dist/get-log-filter.mjs
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/get-log-filter.ts
|
| 2 |
+
/**
|
| 3 |
+
* A helper function to generate log filters using the same syntax as the CLI.
|
| 4 |
+
*
|
| 5 |
+
* @example
|
| 6 |
+
* ```ts
|
| 7 |
+
* import { defineConfig } from 'rolldown';
|
| 8 |
+
* import { getLogFilter } from 'rolldown/getLogFilter';
|
| 9 |
+
*
|
| 10 |
+
* const logFilter = getLogFilter(['code:FOO', 'code:BAR']);
|
| 11 |
+
*
|
| 12 |
+
* export default defineConfig({
|
| 13 |
+
* input: 'main.js',
|
| 14 |
+
* onLog(level, log, handler) {
|
| 15 |
+
* if (logFilter(log)) {
|
| 16 |
+
* handler(level, log);
|
| 17 |
+
* }
|
| 18 |
+
* }
|
| 19 |
+
* });
|
| 20 |
+
* ```
|
| 21 |
+
*
|
| 22 |
+
* @category Config
|
| 23 |
+
*/
|
| 24 |
+
const getLogFilter = (filters) => {
|
| 25 |
+
if (filters.length === 0) return () => true;
|
| 26 |
+
const normalizedFilters = filters.map((filter) => filter.split("&").map((subFilter) => {
|
| 27 |
+
const inverted = subFilter.startsWith("!");
|
| 28 |
+
if (inverted) subFilter = subFilter.slice(1);
|
| 29 |
+
const [key, ...value] = subFilter.split(":");
|
| 30 |
+
return {
|
| 31 |
+
inverted,
|
| 32 |
+
key: key.split("."),
|
| 33 |
+
parts: value.join(":").split("*")
|
| 34 |
+
};
|
| 35 |
+
}));
|
| 36 |
+
return (log) => {
|
| 37 |
+
nextIntersectedFilter: for (const intersectedFilters of normalizedFilters) {
|
| 38 |
+
for (const { inverted, key, parts } of intersectedFilters) {
|
| 39 |
+
const isFilterSatisfied = testFilter(log, key, parts);
|
| 40 |
+
if (inverted ? isFilterSatisfied : !isFilterSatisfied) continue nextIntersectedFilter;
|
| 41 |
+
}
|
| 42 |
+
return true;
|
| 43 |
+
}
|
| 44 |
+
return false;
|
| 45 |
+
};
|
| 46 |
+
};
|
| 47 |
+
const testFilter = (log, key, parts) => {
|
| 48 |
+
let rawValue = log;
|
| 49 |
+
for (let index = 0; index < key.length; index++) {
|
| 50 |
+
if (!rawValue) return false;
|
| 51 |
+
const part = key[index];
|
| 52 |
+
if (!(part in rawValue)) return false;
|
| 53 |
+
rawValue = rawValue[part];
|
| 54 |
+
}
|
| 55 |
+
let value = typeof rawValue === "object" ? JSON.stringify(rawValue) : String(rawValue);
|
| 56 |
+
if (parts.length === 1) return value === parts[0];
|
| 57 |
+
if (!value.startsWith(parts[0])) return false;
|
| 58 |
+
const lastPartIndex = parts.length - 1;
|
| 59 |
+
for (let index = 1; index < lastPartIndex; index++) {
|
| 60 |
+
const part = parts[index];
|
| 61 |
+
const position = value.indexOf(part);
|
| 62 |
+
if (position === -1) return false;
|
| 63 |
+
value = value.slice(position + part.length);
|
| 64 |
+
}
|
| 65 |
+
return value.endsWith(parts[lastPartIndex]);
|
| 66 |
+
};
|
| 67 |
+
//#endregion
|
| 68 |
+
export { getLogFilter as default };
|
shared/node_modules/rolldown/dist/index.d.mts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { a as RolldownLog, i as RolldownError, n as LogLevelOption, o as RolldownLogWithString, r as LogOrStringHandler, t as LogLevel } from "./shared/logging-BSNejiLS.mjs";
|
| 2 |
+
import { z as PreRenderedChunk } from "./shared/binding-DgGsNpT9.mjs";
|
| 3 |
+
import { $ as PluginContextMeta, A as RolldownPluginOption, At as CodeSplittingGroup, B as OutputBundle, Bt as PreRenderedAsset, C as ParallelPluginHooks, Ct as build, D as ResolveIdResult, Dt as BuiltinModuleTag, E as ResolveIdExtraOptions, Et as AdvancedChunksOptions, F as RUNTIME_MODULE_ID, Ft as GeneratedCodePreset, G as EmittedFile, Gt as OutputChunk, H as TransformPluginContext, Ht as PartialNull, I as VERSION, It as GlobalsFunction, J as PluginContext, Jt as RolldownOutput, K as EmittedPrebuiltChunk, Kt as RenderedChunk, L as BundleError, Lt as MinifyOptions, M as TransformResult, Mt as CodeSplittingOptions, Nt as CommentsOptions, O as ResolvedId, Ot as ChunkFileNamesFunction, Pt as GeneratedCodeOptions, Q as MinimalPluginContext, Qt as SourcemapIgnoreListOption, R as ExistingRawSourceMap, Rt as ModuleFormat, S as ObjectHook, St as BuildOptions, T as Plugin, Tt as AdvancedChunksGroup, U as EmittedAsset, V as TreeshakingOptions, W as EmittedChunk, Wt as OutputAsset, X as DefineParallelPluginResult, Y as PluginContextResolveOptions, Yt as SourceMap, Zt as ModuleInfo, _ as HookFilterExtension, _t as RolldownWatcherEvent, a as ChunkOptimizationOptions, at as RolldownFileStats, b as ModuleOptions, bt as rolldown, c as InputOption, ct as NormalizedOutputOptions, d as OptimizationOptions, dt as ChecksOptions, et as GeneralHookFilter, f as WatcherFileWatcherOptions, ft as LoggingFunction, g as FunctionPluginHooks, gt as RolldownWatcher, h as CustomPluginOptions, ht as watch, i as RolldownOptions, it as RolldownDirectoryEntry, j as SourceDescription, jt as CodeSplittingNameFunction, k as RolldownPlugin, kt as ChunkingContext, l as InputOptions, lt as NormalizedInputOptions, m as AsyncPluginHooks, mt as RolldownMagicString, n as RolldownOptionsFunction, nt as ModuleTypeFilter, o as ExternalOption, ot as RolldownFsModule, p as WatcherOptions, pt as WarningHandlerWithDefault, q as GetModuleInfo, qt as RenderedModule, r as defineConfig, rt as BufferEncoding, s as ExternalOptionFunction, st as InternalModuleFormat, t as ConfigExport, tt as HookFilter, u as ModuleTypes, ut as TransformOptions, v as ImportKind, vt as RolldownWatcherWatcherEventMap, w as PartialResolvedId, wt as AddonFunction, x as ModuleType, xt as RolldownBuild, y as LoadResult, yt as WatchOptions, z as SourceMapInput, zt as OutputOptions } from "./shared/define-config-ChOOV2QZ.mjs";
|
| 4 |
+
export { type AddonFunction, type AdvancedChunksGroup, type AdvancedChunksOptions, type AsyncPluginHooks, type BufferEncoding, type BuildOptions, type BuiltinModuleTag, type BundleError, type ChecksOptions, type ChunkFileNamesFunction, type ChunkOptimizationOptions, type ChunkingContext, type CodeSplittingGroup, type CodeSplittingNameFunction, type CodeSplittingOptions, type CommentsOptions, type ConfigExport, type CustomPluginOptions, type DefineParallelPluginResult, type EmittedAsset, type EmittedChunk, type EmittedFile, type EmittedPrebuiltChunk, type ExistingRawSourceMap, type ExternalOption, type ExternalOptionFunction, type FunctionPluginHooks, type GeneralHookFilter, type GeneratedCodeOptions, type GeneratedCodePreset, type GetModuleInfo, type GlobalsFunction, type HookFilter, type HookFilterExtension, type ImportKind, type InputOption, type InputOptions, type InternalModuleFormat, type LoadResult, type LogLevel, type LogLevelOption, type LogOrStringHandler, type LoggingFunction, type MinifyOptions, type MinimalPluginContext, type ModuleFormat, type ModuleInfo, type ModuleOptions, type ModuleType, type ModuleTypeFilter, type ModuleTypes, type NormalizedInputOptions, type NormalizedOutputOptions, type ObjectHook, type OptimizationOptions, type OutputAsset, type OutputBundle, type OutputChunk, type OutputOptions, type ParallelPluginHooks, type PartialNull, type PartialResolvedId, type Plugin, type PluginContext, type PluginContextMeta, type PluginContextResolveOptions, type PreRenderedAsset, type PreRenderedChunk, RUNTIME_MODULE_ID, type RenderedChunk, type RenderedModule, type ResolveIdExtraOptions, type ResolveIdResult, type ResolvedId, type RolldownBuild, type RolldownDirectoryEntry, type RolldownError, type RolldownError as RollupError, type RolldownFileStats, type RolldownFsModule, type RolldownLog, type RolldownLog as RollupLog, type RolldownLogWithString, type RolldownLogWithString as RollupLogWithString, RolldownMagicString, type RolldownOptions, type RolldownOptionsFunction, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatcher, type RolldownWatcherEvent, type RolldownWatcherWatcherEventMap, type SourceDescription, type SourceMap, type SourceMapInput, type SourcemapIgnoreListOption, type TransformOptions, type TransformPluginContext, type TransformResult, type TreeshakingOptions, VERSION, type WarningHandlerWithDefault, type WatchOptions, type WatcherFileWatcherOptions, type WatcherOptions, build, defineConfig, rolldown, watch };
|
shared/node_modules/rolldown/dist/index.mjs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { n as __toESM, t as require_binding } from "./shared/binding-CfwqjDbP.mjs";
|
| 2 |
+
import { n as onExit, t as watch } from "./shared/watch-eT_pxdfY.mjs";
|
| 3 |
+
import { a as RolldownMagicString, b as RUNTIME_MODULE_ID, x as VERSION } from "./shared/bindingify-input-options-B7_WBoOp.mjs";
|
| 4 |
+
import { t as rolldown } from "./shared/rolldown-Bkyb2CgX.mjs";
|
| 5 |
+
import { t as defineConfig } from "./shared/define-config-Demdg3_4.mjs";
|
| 6 |
+
import { isMainThread } from "node:worker_threads";
|
| 7 |
+
//#region src/setup.ts
|
| 8 |
+
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
|
| 9 |
+
if (isMainThread) {
|
| 10 |
+
const subscriberGuard = (0, import_binding.initTraceSubscriber)();
|
| 11 |
+
onExit(() => {
|
| 12 |
+
subscriberGuard?.close();
|
| 13 |
+
});
|
| 14 |
+
}
|
| 15 |
+
//#endregion
|
| 16 |
+
//#region src/api/build.ts
|
| 17 |
+
/**
|
| 18 |
+
* The API similar to esbuild's `build` function.
|
| 19 |
+
*
|
| 20 |
+
* @example
|
| 21 |
+
* ```js
|
| 22 |
+
* import { build } from 'rolldown';
|
| 23 |
+
*
|
| 24 |
+
* const result = await build({
|
| 25 |
+
* input: 'src/main.js',
|
| 26 |
+
* output: {
|
| 27 |
+
* file: 'bundle.js',
|
| 28 |
+
* },
|
| 29 |
+
* });
|
| 30 |
+
* console.log(result);
|
| 31 |
+
* ```
|
| 32 |
+
*
|
| 33 |
+
* @experimental
|
| 34 |
+
* @category Programmatic APIs
|
| 35 |
+
*/
|
| 36 |
+
async function build(options) {
|
| 37 |
+
if (Array.isArray(options)) return Promise.all(options.map((opts) => build(opts)));
|
| 38 |
+
else {
|
| 39 |
+
const { output, write = true, ...inputOptions } = options;
|
| 40 |
+
const build = await rolldown(inputOptions);
|
| 41 |
+
try {
|
| 42 |
+
if (write) return await build.write(output);
|
| 43 |
+
else return await build.generate(output);
|
| 44 |
+
} finally {
|
| 45 |
+
await build.close();
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
//#endregion
|
| 50 |
+
export { RUNTIME_MODULE_ID, RolldownMagicString, VERSION, build, defineConfig, rolldown, watch };
|
shared/node_modules/rolldown/dist/parallel-plugin-worker.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export { };
|
shared/node_modules/rolldown/dist/parallel-plugin-worker.mjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { n as __toESM, t as require_binding } from "./shared/binding-CfwqjDbP.mjs";
|
| 2 |
+
import { n as PluginContextData, r as bindingifyPlugin } from "./shared/bindingify-input-options-B7_WBoOp.mjs";
|
| 3 |
+
import { parentPort, workerData } from "node:worker_threads";
|
| 4 |
+
//#region src/parallel-plugin-worker.ts
|
| 5 |
+
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
|
| 6 |
+
const { registryId, pluginInfos, threadNumber } = workerData;
|
| 7 |
+
(async () => {
|
| 8 |
+
try {
|
| 9 |
+
(0, import_binding.registerPlugins)(registryId, await Promise.all(pluginInfos.map(async (pluginInfo) => {
|
| 10 |
+
const definePluginImpl = (await import(pluginInfo.fileUrl)).default;
|
| 11 |
+
const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
|
| 12 |
+
return {
|
| 13 |
+
index: pluginInfo.index,
|
| 14 |
+
plugin: bindingifyPlugin(plugin, {}, {}, new PluginContextData(() => {}, {}, [], []), [], () => {}, "info", false)
|
| 15 |
+
};
|
| 16 |
+
})));
|
| 17 |
+
parentPort.postMessage({ type: "success" });
|
| 18 |
+
} catch (error) {
|
| 19 |
+
parentPort.postMessage({
|
| 20 |
+
type: "error",
|
| 21 |
+
error
|
| 22 |
+
});
|
| 23 |
+
} finally {
|
| 24 |
+
parentPort.unref();
|
| 25 |
+
}
|
| 26 |
+
})();
|
| 27 |
+
//#endregion
|
| 28 |
+
export {};
|
shared/node_modules/rolldown/dist/parallel-plugin.d.mts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { T as Plugin, Vt as MaybePromise } from "./shared/define-config-ChOOV2QZ.mjs";
|
| 2 |
+
|
| 3 |
+
//#region src/plugin/parallel-plugin-implementation.d.ts
|
| 4 |
+
type ParallelPluginImplementation = Plugin;
|
| 5 |
+
type Context = {
|
| 6 |
+
/**
|
| 7 |
+
* Thread number
|
| 8 |
+
*/
|
| 9 |
+
threadNumber: number;
|
| 10 |
+
};
|
| 11 |
+
declare function defineParallelPluginImplementation<Options>(plugin: (Options: Options, context: Context) => MaybePromise<ParallelPluginImplementation>): (Options: Options, context: Context) => MaybePromise<ParallelPluginImplementation>;
|
| 12 |
+
//#endregion
|
| 13 |
+
export { type Context, type ParallelPluginImplementation, defineParallelPluginImplementation };
|
shared/node_modules/rolldown/dist/parallel-plugin.mjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/plugin/parallel-plugin-implementation.ts
|
| 2 |
+
function defineParallelPluginImplementation(plugin) {
|
| 3 |
+
return plugin;
|
| 4 |
+
}
|
| 5 |
+
//#endregion
|
| 6 |
+
export { defineParallelPluginImplementation };
|
shared/node_modules/rolldown/dist/parse-ast-index.d.mts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { L as ParseResult$1, R as ParserOptions$1 } from "./shared/binding-DgGsNpT9.mjs";
|
| 2 |
+
import { Program } from "@oxc-project/types";
|
| 3 |
+
|
| 4 |
+
//#region src/parse-ast-index.d.ts
|
| 5 |
+
/**
|
| 6 |
+
* @hidden
|
| 7 |
+
*/
|
| 8 |
+
type ParseResult = ParseResult$1;
|
| 9 |
+
/**
|
| 10 |
+
* @hidden
|
| 11 |
+
*/
|
| 12 |
+
type ParserOptions = ParserOptions$1;
|
| 13 |
+
/**
|
| 14 |
+
* Parse code synchronously and return the AST.
|
| 15 |
+
*
|
| 16 |
+
* This function is similar to Rollup's `parseAst` function.
|
| 17 |
+
* Prefer using {@linkcode parseSync} instead of this function as it has more information in the return value.
|
| 18 |
+
*
|
| 19 |
+
* @category Utilities
|
| 20 |
+
*/
|
| 21 |
+
declare function parseAst(sourceText: string, options?: ParserOptions | null, filename?: string): Program;
|
| 22 |
+
/**
|
| 23 |
+
* Parse code asynchronously and return the AST.
|
| 24 |
+
*
|
| 25 |
+
* This function is similar to Rollup's `parseAstAsync` function.
|
| 26 |
+
* Prefer using {@linkcode parseAsync} instead of this function as it has more information in the return value.
|
| 27 |
+
*
|
| 28 |
+
* @category Utilities
|
| 29 |
+
*/
|
| 30 |
+
declare function parseAstAsync(sourceText: string, options?: ParserOptions | null, filename?: string): Promise<Program>;
|
| 31 |
+
//#endregion
|
| 32 |
+
export { ParseResult, ParserOptions, parseAst, parseAstAsync };
|
shared/node_modules/rolldown/dist/parse-ast-index.mjs
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { l as locate, n as error, s as logParseError, t as augmentCodeLocation, u as getCodeFrame } from "./shared/logs-aMKUxRpj.mjs";
|
| 2 |
+
import { n as parseSync, t as parse } from "./shared/parse-yrGA-p2H.mjs";
|
| 3 |
+
//#region src/parse-ast-index.ts
|
| 4 |
+
function wrap(result, filename, sourceText) {
|
| 5 |
+
if (result.errors.length > 0) return normalizeParseError(filename, sourceText, result.errors);
|
| 6 |
+
return result.program;
|
| 7 |
+
}
|
| 8 |
+
function normalizeParseError(filename, sourceText, errors) {
|
| 9 |
+
let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
| 10 |
+
const pos = errors[0]?.labels?.[0]?.start;
|
| 11 |
+
for (let i = 0; i < errors.length; i++) {
|
| 12 |
+
if (i >= 5) {
|
| 13 |
+
message += "\n...";
|
| 14 |
+
break;
|
| 15 |
+
}
|
| 16 |
+
const e = errors[i];
|
| 17 |
+
message += e.message + "\n" + e.labels.map((label) => {
|
| 18 |
+
const location = locate(sourceText, label.start, { offsetLine: 1 });
|
| 19 |
+
if (!location) return;
|
| 20 |
+
return getCodeFrame(sourceText, location.line, location.column);
|
| 21 |
+
}).filter(Boolean).join("\n");
|
| 22 |
+
}
|
| 23 |
+
const log = logParseError(message, filename, pos);
|
| 24 |
+
if (pos !== void 0 && filename) augmentCodeLocation(log, pos, sourceText, filename);
|
| 25 |
+
return error(log);
|
| 26 |
+
}
|
| 27 |
+
const defaultParserOptions = {
|
| 28 |
+
lang: "js",
|
| 29 |
+
preserveParens: false
|
| 30 |
+
};
|
| 31 |
+
/**
|
| 32 |
+
* Parse code synchronously and return the AST.
|
| 33 |
+
*
|
| 34 |
+
* This function is similar to Rollup's `parseAst` function.
|
| 35 |
+
* Prefer using {@linkcode parseSync} instead of this function as it has more information in the return value.
|
| 36 |
+
*
|
| 37 |
+
* @category Utilities
|
| 38 |
+
*/
|
| 39 |
+
function parseAst(sourceText, options, filename) {
|
| 40 |
+
return wrap(parseSync(filename ?? "file.js", sourceText, {
|
| 41 |
+
...defaultParserOptions,
|
| 42 |
+
...options
|
| 43 |
+
}), filename, sourceText);
|
| 44 |
+
}
|
| 45 |
+
/**
|
| 46 |
+
* Parse code asynchronously and return the AST.
|
| 47 |
+
*
|
| 48 |
+
* This function is similar to Rollup's `parseAstAsync` function.
|
| 49 |
+
* Prefer using {@linkcode parseAsync} instead of this function as it has more information in the return value.
|
| 50 |
+
*
|
| 51 |
+
* @category Utilities
|
| 52 |
+
*/
|
| 53 |
+
async function parseAstAsync(sourceText, options, filename) {
|
| 54 |
+
return wrap(await parse(filename ?? "file.js", sourceText, {
|
| 55 |
+
...defaultParserOptions,
|
| 56 |
+
...options
|
| 57 |
+
}), filename, sourceText);
|
| 58 |
+
}
|
| 59 |
+
//#endregion
|
| 60 |
+
export { parseAst, parseAstAsync };
|
shared/node_modules/rolldown/dist/plugins-index.d.mts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { m as BindingReplacePluginConfig } from "./shared/binding-DgGsNpT9.mjs";
|
| 2 |
+
import { P as BuiltinPlugin } from "./shared/define-config-ChOOV2QZ.mjs";
|
| 3 |
+
import { t as esmExternalRequirePlugin } from "./shared/constructors-Bx1tSad6.mjs";
|
| 4 |
+
|
| 5 |
+
//#region src/builtin-plugin/replace-plugin.d.ts
|
| 6 |
+
/**
|
| 7 |
+
* Replaces targeted strings in files while bundling.
|
| 8 |
+
*
|
| 9 |
+
* @example
|
| 10 |
+
* **Basic usage**
|
| 11 |
+
* ```js
|
| 12 |
+
* replacePlugin({
|
| 13 |
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
| 14 |
+
* __buildVersion: 15
|
| 15 |
+
* })
|
| 16 |
+
* ```
|
| 17 |
+
* @example
|
| 18 |
+
* **With options**
|
| 19 |
+
* ```js
|
| 20 |
+
* replacePlugin({
|
| 21 |
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
| 22 |
+
* __buildVersion: 15
|
| 23 |
+
* }, {
|
| 24 |
+
* preventAssignment: false,
|
| 25 |
+
* })
|
| 26 |
+
* ```
|
| 27 |
+
*
|
| 28 |
+
* @see https://rolldown.rs/builtin-plugins/replace
|
| 29 |
+
* @category Builtin Plugins
|
| 30 |
+
*/
|
| 31 |
+
declare function replacePlugin(values?: BindingReplacePluginConfig["values"], options?: Omit<BindingReplacePluginConfig, "values">): BuiltinPlugin;
|
| 32 |
+
//#endregion
|
| 33 |
+
export { esmExternalRequirePlugin, replacePlugin };
|
shared/node_modules/rolldown/dist/plugins-index.mjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-DGbe3BlX.mjs";
|
| 2 |
+
import { t as esmExternalRequirePlugin } from "./shared/constructors-DnT9y_13.mjs";
|
| 3 |
+
//#region src/builtin-plugin/replace-plugin.ts
|
| 4 |
+
/**
|
| 5 |
+
* Replaces targeted strings in files while bundling.
|
| 6 |
+
*
|
| 7 |
+
* @example
|
| 8 |
+
* **Basic usage**
|
| 9 |
+
* ```js
|
| 10 |
+
* replacePlugin({
|
| 11 |
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
| 12 |
+
* __buildVersion: 15
|
| 13 |
+
* })
|
| 14 |
+
* ```
|
| 15 |
+
* @example
|
| 16 |
+
* **With options**
|
| 17 |
+
* ```js
|
| 18 |
+
* replacePlugin({
|
| 19 |
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
| 20 |
+
* __buildVersion: 15
|
| 21 |
+
* }, {
|
| 22 |
+
* preventAssignment: false,
|
| 23 |
+
* })
|
| 24 |
+
* ```
|
| 25 |
+
*
|
| 26 |
+
* @see https://rolldown.rs/builtin-plugins/replace
|
| 27 |
+
* @category Builtin Plugins
|
| 28 |
+
*/
|
| 29 |
+
function replacePlugin(values = {}, options = {}) {
|
| 30 |
+
Object.keys(values).forEach((key) => {
|
| 31 |
+
const value = values[key];
|
| 32 |
+
if (typeof value !== "string") values[key] = String(value);
|
| 33 |
+
});
|
| 34 |
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:replace", {
|
| 35 |
+
...options,
|
| 36 |
+
values
|
| 37 |
+
}));
|
| 38 |
+
}
|
| 39 |
+
//#endregion
|
| 40 |
+
export { esmExternalRequirePlugin, replacePlugin };
|
shared/node_modules/rolldown/dist/shared/binding-CfwqjDbP.mjs
ADDED
|
@@ -0,0 +1,584 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { createRequire } from "node:module";
|
| 2 |
+
//#region \0rolldown/runtime.js
|
| 3 |
+
var __create = Object.create;
|
| 4 |
+
var __defProp = Object.defineProperty;
|
| 5 |
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
| 6 |
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
| 7 |
+
var __getProtoOf = Object.getPrototypeOf;
|
| 8 |
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
| 9 |
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
| 10 |
+
var __copyProps = (to, from, except, desc) => {
|
| 11 |
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
| 12 |
+
key = keys[i];
|
| 13 |
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
| 14 |
+
get: ((k) => from[k]).bind(null, key),
|
| 15 |
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
| 16 |
+
});
|
| 17 |
+
}
|
| 18 |
+
return to;
|
| 19 |
+
};
|
| 20 |
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
| 21 |
+
value: mod,
|
| 22 |
+
enumerable: true
|
| 23 |
+
}) : target, mod));
|
| 24 |
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
| 25 |
+
//#endregion
|
| 26 |
+
//#region src/webcontainer-fallback.cjs
|
| 27 |
+
var require_webcontainer_fallback = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
| 28 |
+
const fs = __require("node:fs");
|
| 29 |
+
const childProcess = __require("node:child_process");
|
| 30 |
+
const version = JSON.parse(fs.readFileSync(__require.resolve("rolldown/package.json"), "utf-8")).version;
|
| 31 |
+
const baseDir = `/tmp/rolldown-${version}`;
|
| 32 |
+
const bindingEntry = `${baseDir}/node_modules/@rolldown/binding-wasm32-wasi/rolldown-binding.wasi.cjs`;
|
| 33 |
+
if (!fs.existsSync(bindingEntry)) {
|
| 34 |
+
const bindingPkg = `@rolldown/binding-wasm32-wasi@${version}`;
|
| 35 |
+
fs.rmSync(baseDir, {
|
| 36 |
+
recursive: true,
|
| 37 |
+
force: true
|
| 38 |
+
});
|
| 39 |
+
fs.mkdirSync(baseDir, { recursive: true });
|
| 40 |
+
console.log(`[rolldown] Downloading ${bindingPkg} on WebContainer...`);
|
| 41 |
+
childProcess.execFileSync("pnpm", ["i", bindingPkg], {
|
| 42 |
+
cwd: baseDir,
|
| 43 |
+
stdio: "inherit"
|
| 44 |
+
});
|
| 45 |
+
}
|
| 46 |
+
module.exports = __require(bindingEntry);
|
| 47 |
+
}));
|
| 48 |
+
//#endregion
|
| 49 |
+
//#region src/binding.cjs
|
| 50 |
+
var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
| 51 |
+
const { readFileSync } = __require("node:fs");
|
| 52 |
+
let nativeBinding = null;
|
| 53 |
+
const loadErrors = [];
|
| 54 |
+
const isMusl = () => {
|
| 55 |
+
let musl = false;
|
| 56 |
+
if (process.platform === "linux") {
|
| 57 |
+
musl = isMuslFromFilesystem();
|
| 58 |
+
if (musl === null) musl = isMuslFromReport();
|
| 59 |
+
if (musl === null) musl = isMuslFromChildProcess();
|
| 60 |
+
}
|
| 61 |
+
return musl;
|
| 62 |
+
};
|
| 63 |
+
const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
|
| 64 |
+
const isMuslFromFilesystem = () => {
|
| 65 |
+
try {
|
| 66 |
+
return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
|
| 67 |
+
} catch {
|
| 68 |
+
return null;
|
| 69 |
+
}
|
| 70 |
+
};
|
| 71 |
+
const isMuslFromReport = () => {
|
| 72 |
+
let report = null;
|
| 73 |
+
if (typeof process.report?.getReport === "function") {
|
| 74 |
+
process.report.excludeNetwork = true;
|
| 75 |
+
report = process.report.getReport();
|
| 76 |
+
}
|
| 77 |
+
if (!report) return null;
|
| 78 |
+
if (report.header && report.header.glibcVersionRuntime) return false;
|
| 79 |
+
if (Array.isArray(report.sharedObjects)) {
|
| 80 |
+
if (report.sharedObjects.some(isFileMusl)) return true;
|
| 81 |
+
}
|
| 82 |
+
return false;
|
| 83 |
+
};
|
| 84 |
+
const isMuslFromChildProcess = () => {
|
| 85 |
+
try {
|
| 86 |
+
return __require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
|
| 87 |
+
} catch (e) {
|
| 88 |
+
return false;
|
| 89 |
+
}
|
| 90 |
+
};
|
| 91 |
+
function requireNative() {
|
| 92 |
+
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) try {
|
| 93 |
+
return __require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
| 94 |
+
} catch (err) {
|
| 95 |
+
loadErrors.push(err);
|
| 96 |
+
}
|
| 97 |
+
else if (process.platform === "android") if (process.arch === "arm64") {
|
| 98 |
+
try {
|
| 99 |
+
return __require("./rolldown-binding.android-arm64.node");
|
| 100 |
+
} catch (e) {
|
| 101 |
+
loadErrors.push(e);
|
| 102 |
+
}
|
| 103 |
+
try {
|
| 104 |
+
const binding = __require("@rolldown/binding-android-arm64");
|
| 105 |
+
const bindingPackageVersion = __require("@rolldown/binding-android-arm64/package.json").version;
|
| 106 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 107 |
+
return binding;
|
| 108 |
+
} catch (e) {
|
| 109 |
+
loadErrors.push(e);
|
| 110 |
+
}
|
| 111 |
+
} else if (process.arch === "arm") {
|
| 112 |
+
try {
|
| 113 |
+
return __require("./rolldown-binding.android-arm-eabi.node");
|
| 114 |
+
} catch (e) {
|
| 115 |
+
loadErrors.push(e);
|
| 116 |
+
}
|
| 117 |
+
try {
|
| 118 |
+
const binding = __require("@rolldown/binding-android-arm-eabi");
|
| 119 |
+
const bindingPackageVersion = __require("@rolldown/binding-android-arm-eabi/package.json").version;
|
| 120 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 121 |
+
return binding;
|
| 122 |
+
} catch (e) {
|
| 123 |
+
loadErrors.push(e);
|
| 124 |
+
}
|
| 125 |
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Android ${process.arch}`));
|
| 126 |
+
else if (process.platform === "win32") if (process.arch === "x64") if (process.config?.variables?.shlib_suffix === "dll.a" || process.config?.variables?.node_target_type === "shared_library") {
|
| 127 |
+
try {
|
| 128 |
+
return __require("./rolldown-binding.win32-x64-gnu.node");
|
| 129 |
+
} catch (e) {
|
| 130 |
+
loadErrors.push(e);
|
| 131 |
+
}
|
| 132 |
+
try {
|
| 133 |
+
const binding = __require("@rolldown/binding-win32-x64-gnu");
|
| 134 |
+
const bindingPackageVersion = __require("@rolldown/binding-win32-x64-gnu/package.json").version;
|
| 135 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 136 |
+
return binding;
|
| 137 |
+
} catch (e) {
|
| 138 |
+
loadErrors.push(e);
|
| 139 |
+
}
|
| 140 |
+
} else {
|
| 141 |
+
try {
|
| 142 |
+
return __require("./rolldown-binding.win32-x64-msvc.node");
|
| 143 |
+
} catch (e) {
|
| 144 |
+
loadErrors.push(e);
|
| 145 |
+
}
|
| 146 |
+
try {
|
| 147 |
+
const binding = __require("@rolldown/binding-win32-x64-msvc");
|
| 148 |
+
const bindingPackageVersion = __require("@rolldown/binding-win32-x64-msvc/package.json").version;
|
| 149 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 150 |
+
return binding;
|
| 151 |
+
} catch (e) {
|
| 152 |
+
loadErrors.push(e);
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
+
else if (process.arch === "ia32") {
|
| 156 |
+
try {
|
| 157 |
+
return __require("./rolldown-binding.win32-ia32-msvc.node");
|
| 158 |
+
} catch (e) {
|
| 159 |
+
loadErrors.push(e);
|
| 160 |
+
}
|
| 161 |
+
try {
|
| 162 |
+
const binding = __require("@rolldown/binding-win32-ia32-msvc");
|
| 163 |
+
const bindingPackageVersion = __require("@rolldown/binding-win32-ia32-msvc/package.json").version;
|
| 164 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 165 |
+
return binding;
|
| 166 |
+
} catch (e) {
|
| 167 |
+
loadErrors.push(e);
|
| 168 |
+
}
|
| 169 |
+
} else if (process.arch === "arm64") {
|
| 170 |
+
try {
|
| 171 |
+
return __require("./rolldown-binding.win32-arm64-msvc.node");
|
| 172 |
+
} catch (e) {
|
| 173 |
+
loadErrors.push(e);
|
| 174 |
+
}
|
| 175 |
+
try {
|
| 176 |
+
const binding = __require("@rolldown/binding-win32-arm64-msvc");
|
| 177 |
+
const bindingPackageVersion = __require("@rolldown/binding-win32-arm64-msvc/package.json").version;
|
| 178 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 179 |
+
return binding;
|
| 180 |
+
} catch (e) {
|
| 181 |
+
loadErrors.push(e);
|
| 182 |
+
}
|
| 183 |
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Windows: ${process.arch}`));
|
| 184 |
+
else if (process.platform === "darwin") {
|
| 185 |
+
try {
|
| 186 |
+
return __require("./rolldown-binding.darwin-universal.node");
|
| 187 |
+
} catch (e) {
|
| 188 |
+
loadErrors.push(e);
|
| 189 |
+
}
|
| 190 |
+
try {
|
| 191 |
+
const binding = __require("@rolldown/binding-darwin-universal");
|
| 192 |
+
const bindingPackageVersion = __require("@rolldown/binding-darwin-universal/package.json").version;
|
| 193 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 194 |
+
return binding;
|
| 195 |
+
} catch (e) {
|
| 196 |
+
loadErrors.push(e);
|
| 197 |
+
}
|
| 198 |
+
if (process.arch === "x64") {
|
| 199 |
+
try {
|
| 200 |
+
return __require("./rolldown-binding.darwin-x64.node");
|
| 201 |
+
} catch (e) {
|
| 202 |
+
loadErrors.push(e);
|
| 203 |
+
}
|
| 204 |
+
try {
|
| 205 |
+
const binding = __require("@rolldown/binding-darwin-x64");
|
| 206 |
+
const bindingPackageVersion = __require("@rolldown/binding-darwin-x64/package.json").version;
|
| 207 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 208 |
+
return binding;
|
| 209 |
+
} catch (e) {
|
| 210 |
+
loadErrors.push(e);
|
| 211 |
+
}
|
| 212 |
+
} else if (process.arch === "arm64") {
|
| 213 |
+
try {
|
| 214 |
+
return __require("./rolldown-binding.darwin-arm64.node");
|
| 215 |
+
} catch (e) {
|
| 216 |
+
loadErrors.push(e);
|
| 217 |
+
}
|
| 218 |
+
try {
|
| 219 |
+
const binding = __require("@rolldown/binding-darwin-arm64");
|
| 220 |
+
const bindingPackageVersion = __require("@rolldown/binding-darwin-arm64/package.json").version;
|
| 221 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 222 |
+
return binding;
|
| 223 |
+
} catch (e) {
|
| 224 |
+
loadErrors.push(e);
|
| 225 |
+
}
|
| 226 |
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on macOS: ${process.arch}`));
|
| 227 |
+
} else if (process.platform === "freebsd") if (process.arch === "x64") {
|
| 228 |
+
try {
|
| 229 |
+
return __require("./rolldown-binding.freebsd-x64.node");
|
| 230 |
+
} catch (e) {
|
| 231 |
+
loadErrors.push(e);
|
| 232 |
+
}
|
| 233 |
+
try {
|
| 234 |
+
const binding = __require("@rolldown/binding-freebsd-x64");
|
| 235 |
+
const bindingPackageVersion = __require("@rolldown/binding-freebsd-x64/package.json").version;
|
| 236 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 237 |
+
return binding;
|
| 238 |
+
} catch (e) {
|
| 239 |
+
loadErrors.push(e);
|
| 240 |
+
}
|
| 241 |
+
} else if (process.arch === "arm64") {
|
| 242 |
+
try {
|
| 243 |
+
return __require("./rolldown-binding.freebsd-arm64.node");
|
| 244 |
+
} catch (e) {
|
| 245 |
+
loadErrors.push(e);
|
| 246 |
+
}
|
| 247 |
+
try {
|
| 248 |
+
const binding = __require("@rolldown/binding-freebsd-arm64");
|
| 249 |
+
const bindingPackageVersion = __require("@rolldown/binding-freebsd-arm64/package.json").version;
|
| 250 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 251 |
+
return binding;
|
| 252 |
+
} catch (e) {
|
| 253 |
+
loadErrors.push(e);
|
| 254 |
+
}
|
| 255 |
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
|
| 256 |
+
else if (process.platform === "linux") if (process.arch === "x64") if (isMusl()) {
|
| 257 |
+
try {
|
| 258 |
+
return __require("./rolldown-binding.linux-x64-musl.node");
|
| 259 |
+
} catch (e) {
|
| 260 |
+
loadErrors.push(e);
|
| 261 |
+
}
|
| 262 |
+
try {
|
| 263 |
+
const binding = __require("@rolldown/binding-linux-x64-musl");
|
| 264 |
+
const bindingPackageVersion = __require("@rolldown/binding-linux-x64-musl/package.json").version;
|
| 265 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 266 |
+
return binding;
|
| 267 |
+
} catch (e) {
|
| 268 |
+
loadErrors.push(e);
|
| 269 |
+
}
|
| 270 |
+
} else {
|
| 271 |
+
try {
|
| 272 |
+
return __require("../rolldown-binding.linux-x64-gnu.node");
|
| 273 |
+
} catch (e) {
|
| 274 |
+
loadErrors.push(e);
|
| 275 |
+
}
|
| 276 |
+
try {
|
| 277 |
+
const binding = __require("@rolldown/binding-linux-x64-gnu");
|
| 278 |
+
const bindingPackageVersion = __require("@rolldown/binding-linux-x64-gnu/package.json").version;
|
| 279 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 280 |
+
return binding;
|
| 281 |
+
} catch (e) {
|
| 282 |
+
loadErrors.push(e);
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
else if (process.arch === "arm64") if (isMusl()) {
|
| 286 |
+
try {
|
| 287 |
+
return __require("./rolldown-binding.linux-arm64-musl.node");
|
| 288 |
+
} catch (e) {
|
| 289 |
+
loadErrors.push(e);
|
| 290 |
+
}
|
| 291 |
+
try {
|
| 292 |
+
const binding = __require("@rolldown/binding-linux-arm64-musl");
|
| 293 |
+
const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-musl/package.json").version;
|
| 294 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 295 |
+
return binding;
|
| 296 |
+
} catch (e) {
|
| 297 |
+
loadErrors.push(e);
|
| 298 |
+
}
|
| 299 |
+
} else {
|
| 300 |
+
try {
|
| 301 |
+
return __require("./rolldown-binding.linux-arm64-gnu.node");
|
| 302 |
+
} catch (e) {
|
| 303 |
+
loadErrors.push(e);
|
| 304 |
+
}
|
| 305 |
+
try {
|
| 306 |
+
const binding = __require("@rolldown/binding-linux-arm64-gnu");
|
| 307 |
+
const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-gnu/package.json").version;
|
| 308 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 309 |
+
return binding;
|
| 310 |
+
} catch (e) {
|
| 311 |
+
loadErrors.push(e);
|
| 312 |
+
}
|
| 313 |
+
}
|
| 314 |
+
else if (process.arch === "arm") if (isMusl()) {
|
| 315 |
+
try {
|
| 316 |
+
return __require("./rolldown-binding.linux-arm-musleabihf.node");
|
| 317 |
+
} catch (e) {
|
| 318 |
+
loadErrors.push(e);
|
| 319 |
+
}
|
| 320 |
+
try {
|
| 321 |
+
const binding = __require("@rolldown/binding-linux-arm-musleabihf");
|
| 322 |
+
const bindingPackageVersion = __require("@rolldown/binding-linux-arm-musleabihf/package.json").version;
|
| 323 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 324 |
+
return binding;
|
| 325 |
+
} catch (e) {
|
| 326 |
+
loadErrors.push(e);
|
| 327 |
+
}
|
| 328 |
+
} else {
|
| 329 |
+
try {
|
| 330 |
+
return __require("./rolldown-binding.linux-arm-gnueabihf.node");
|
| 331 |
+
} catch (e) {
|
| 332 |
+
loadErrors.push(e);
|
| 333 |
+
}
|
| 334 |
+
try {
|
| 335 |
+
const binding = __require("@rolldown/binding-linux-arm-gnueabihf");
|
| 336 |
+
const bindingPackageVersion = __require("@rolldown/binding-linux-arm-gnueabihf/package.json").version;
|
| 337 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 338 |
+
return binding;
|
| 339 |
+
} catch (e) {
|
| 340 |
+
loadErrors.push(e);
|
| 341 |
+
}
|
| 342 |
+
}
|
| 343 |
+
else if (process.arch === "loong64") if (isMusl()) {
|
| 344 |
+
try {
|
| 345 |
+
return __require("./rolldown-binding.linux-loong64-musl.node");
|
| 346 |
+
} catch (e) {
|
| 347 |
+
loadErrors.push(e);
|
| 348 |
+
}
|
| 349 |
+
try {
|
| 350 |
+
const binding = __require("@rolldown/binding-linux-loong64-musl");
|
| 351 |
+
const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-musl/package.json").version;
|
| 352 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 353 |
+
return binding;
|
| 354 |
+
} catch (e) {
|
| 355 |
+
loadErrors.push(e);
|
| 356 |
+
}
|
| 357 |
+
} else {
|
| 358 |
+
try {
|
| 359 |
+
return __require("./rolldown-binding.linux-loong64-gnu.node");
|
| 360 |
+
} catch (e) {
|
| 361 |
+
loadErrors.push(e);
|
| 362 |
+
}
|
| 363 |
+
try {
|
| 364 |
+
const binding = __require("@rolldown/binding-linux-loong64-gnu");
|
| 365 |
+
const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-gnu/package.json").version;
|
| 366 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 367 |
+
return binding;
|
| 368 |
+
} catch (e) {
|
| 369 |
+
loadErrors.push(e);
|
| 370 |
+
}
|
| 371 |
+
}
|
| 372 |
+
else if (process.arch === "riscv64") if (isMusl()) {
|
| 373 |
+
try {
|
| 374 |
+
return __require("./rolldown-binding.linux-riscv64-musl.node");
|
| 375 |
+
} catch (e) {
|
| 376 |
+
loadErrors.push(e);
|
| 377 |
+
}
|
| 378 |
+
try {
|
| 379 |
+
const binding = __require("@rolldown/binding-linux-riscv64-musl");
|
| 380 |
+
const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-musl/package.json").version;
|
| 381 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 382 |
+
return binding;
|
| 383 |
+
} catch (e) {
|
| 384 |
+
loadErrors.push(e);
|
| 385 |
+
}
|
| 386 |
+
} else {
|
| 387 |
+
try {
|
| 388 |
+
return __require("./rolldown-binding.linux-riscv64-gnu.node");
|
| 389 |
+
} catch (e) {
|
| 390 |
+
loadErrors.push(e);
|
| 391 |
+
}
|
| 392 |
+
try {
|
| 393 |
+
const binding = __require("@rolldown/binding-linux-riscv64-gnu");
|
| 394 |
+
const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-gnu/package.json").version;
|
| 395 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 396 |
+
return binding;
|
| 397 |
+
} catch (e) {
|
| 398 |
+
loadErrors.push(e);
|
| 399 |
+
}
|
| 400 |
+
}
|
| 401 |
+
else if (process.arch === "ppc64") {
|
| 402 |
+
try {
|
| 403 |
+
return __require("./rolldown-binding.linux-ppc64-gnu.node");
|
| 404 |
+
} catch (e) {
|
| 405 |
+
loadErrors.push(e);
|
| 406 |
+
}
|
| 407 |
+
try {
|
| 408 |
+
const binding = __require("@rolldown/binding-linux-ppc64-gnu");
|
| 409 |
+
const bindingPackageVersion = __require("@rolldown/binding-linux-ppc64-gnu/package.json").version;
|
| 410 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 411 |
+
return binding;
|
| 412 |
+
} catch (e) {
|
| 413 |
+
loadErrors.push(e);
|
| 414 |
+
}
|
| 415 |
+
} else if (process.arch === "s390x") {
|
| 416 |
+
try {
|
| 417 |
+
return __require("./rolldown-binding.linux-s390x-gnu.node");
|
| 418 |
+
} catch (e) {
|
| 419 |
+
loadErrors.push(e);
|
| 420 |
+
}
|
| 421 |
+
try {
|
| 422 |
+
const binding = __require("@rolldown/binding-linux-s390x-gnu");
|
| 423 |
+
const bindingPackageVersion = __require("@rolldown/binding-linux-s390x-gnu/package.json").version;
|
| 424 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 425 |
+
return binding;
|
| 426 |
+
} catch (e) {
|
| 427 |
+
loadErrors.push(e);
|
| 428 |
+
}
|
| 429 |
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Linux: ${process.arch}`));
|
| 430 |
+
else if (process.platform === "openharmony") if (process.arch === "arm64") {
|
| 431 |
+
try {
|
| 432 |
+
return __require("./rolldown-binding.openharmony-arm64.node");
|
| 433 |
+
} catch (e) {
|
| 434 |
+
loadErrors.push(e);
|
| 435 |
+
}
|
| 436 |
+
try {
|
| 437 |
+
const binding = __require("@rolldown/binding-openharmony-arm64");
|
| 438 |
+
const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm64/package.json").version;
|
| 439 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 440 |
+
return binding;
|
| 441 |
+
} catch (e) {
|
| 442 |
+
loadErrors.push(e);
|
| 443 |
+
}
|
| 444 |
+
} else if (process.arch === "x64") {
|
| 445 |
+
try {
|
| 446 |
+
return __require("./rolldown-binding.openharmony-x64.node");
|
| 447 |
+
} catch (e) {
|
| 448 |
+
loadErrors.push(e);
|
| 449 |
+
}
|
| 450 |
+
try {
|
| 451 |
+
const binding = __require("@rolldown/binding-openharmony-x64");
|
| 452 |
+
const bindingPackageVersion = __require("@rolldown/binding-openharmony-x64/package.json").version;
|
| 453 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 454 |
+
return binding;
|
| 455 |
+
} catch (e) {
|
| 456 |
+
loadErrors.push(e);
|
| 457 |
+
}
|
| 458 |
+
} else if (process.arch === "arm") {
|
| 459 |
+
try {
|
| 460 |
+
return __require("./rolldown-binding.openharmony-arm.node");
|
| 461 |
+
} catch (e) {
|
| 462 |
+
loadErrors.push(e);
|
| 463 |
+
}
|
| 464 |
+
try {
|
| 465 |
+
const binding = __require("@rolldown/binding-openharmony-arm");
|
| 466 |
+
const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm/package.json").version;
|
| 467 |
+
if (bindingPackageVersion !== "1.1.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
| 468 |
+
return binding;
|
| 469 |
+
} catch (e) {
|
| 470 |
+
loadErrors.push(e);
|
| 471 |
+
}
|
| 472 |
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
|
| 473 |
+
else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
|
| 474 |
+
}
|
| 475 |
+
nativeBinding = requireNative();
|
| 476 |
+
const forceWasi = process.env.NAPI_RS_FORCE_WASI === "true" || process.env.NAPI_RS_FORCE_WASI === "error";
|
| 477 |
+
if (!nativeBinding || forceWasi) {
|
| 478 |
+
let wasiBinding = null;
|
| 479 |
+
let wasiBindingError = null;
|
| 480 |
+
try {
|
| 481 |
+
wasiBinding = __require("../rolldown-binding.wasi.cjs");
|
| 482 |
+
nativeBinding = wasiBinding;
|
| 483 |
+
} catch (err) {
|
| 484 |
+
if (forceWasi) wasiBindingError = err;
|
| 485 |
+
}
|
| 486 |
+
if (!nativeBinding || forceWasi) try {
|
| 487 |
+
wasiBinding = __require("@rolldown/binding-wasm32-wasi");
|
| 488 |
+
nativeBinding = wasiBinding;
|
| 489 |
+
} catch (err) {
|
| 490 |
+
if (forceWasi) {
|
| 491 |
+
if (!wasiBindingError) wasiBindingError = err;
|
| 492 |
+
else wasiBindingError.cause = err;
|
| 493 |
+
loadErrors.push(err);
|
| 494 |
+
}
|
| 495 |
+
}
|
| 496 |
+
if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
|
| 497 |
+
const error = /* @__PURE__ */ new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
|
| 498 |
+
error.cause = wasiBindingError;
|
| 499 |
+
throw error;
|
| 500 |
+
}
|
| 501 |
+
}
|
| 502 |
+
if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) try {
|
| 503 |
+
nativeBinding = require_webcontainer_fallback();
|
| 504 |
+
} catch (err) {
|
| 505 |
+
loadErrors.push(err);
|
| 506 |
+
}
|
| 507 |
+
if (!nativeBinding) {
|
| 508 |
+
if (loadErrors.length > 0) throw new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.", { cause: loadErrors.reduce((err, cur) => {
|
| 509 |
+
cur.cause = err;
|
| 510 |
+
return cur;
|
| 511 |
+
}) });
|
| 512 |
+
throw new Error(`Failed to load native binding`);
|
| 513 |
+
}
|
| 514 |
+
module.exports = nativeBinding;
|
| 515 |
+
module.exports.LegalCommentsMode = nativeBinding.LegalCommentsMode;
|
| 516 |
+
module.exports.minify = nativeBinding.minify;
|
| 517 |
+
module.exports.minifySync = nativeBinding.minifySync;
|
| 518 |
+
module.exports.Severity = nativeBinding.Severity;
|
| 519 |
+
module.exports.ParseResult = nativeBinding.ParseResult;
|
| 520 |
+
module.exports.ExportExportNameKind = nativeBinding.ExportExportNameKind;
|
| 521 |
+
module.exports.ExportImportNameKind = nativeBinding.ExportImportNameKind;
|
| 522 |
+
module.exports.ExportLocalNameKind = nativeBinding.ExportLocalNameKind;
|
| 523 |
+
module.exports.ImportNameKind = nativeBinding.ImportNameKind;
|
| 524 |
+
module.exports.parse = nativeBinding.parse;
|
| 525 |
+
module.exports.parseSync = nativeBinding.parseSync;
|
| 526 |
+
module.exports.rawTransferSupported = nativeBinding.rawTransferSupported;
|
| 527 |
+
module.exports.ResolverFactory = nativeBinding.ResolverFactory;
|
| 528 |
+
module.exports.EnforceExtension = nativeBinding.EnforceExtension;
|
| 529 |
+
module.exports.ModuleType = nativeBinding.ModuleType;
|
| 530 |
+
module.exports.sync = nativeBinding.sync;
|
| 531 |
+
module.exports.HelperMode = nativeBinding.HelperMode;
|
| 532 |
+
module.exports.isolatedDeclaration = nativeBinding.isolatedDeclaration;
|
| 533 |
+
module.exports.isolatedDeclarationSync = nativeBinding.isolatedDeclarationSync;
|
| 534 |
+
module.exports.moduleRunnerTransform = nativeBinding.moduleRunnerTransform;
|
| 535 |
+
module.exports.moduleRunnerTransformSync = nativeBinding.moduleRunnerTransformSync;
|
| 536 |
+
module.exports.transform = nativeBinding.transform;
|
| 537 |
+
module.exports.transformSync = nativeBinding.transformSync;
|
| 538 |
+
module.exports.BindingBundleEndEventData = nativeBinding.BindingBundleEndEventData;
|
| 539 |
+
module.exports.BindingBundleErrorEventData = nativeBinding.BindingBundleErrorEventData;
|
| 540 |
+
module.exports.BindingBundler = nativeBinding.BindingBundler;
|
| 541 |
+
module.exports.BindingCallableBuiltinPlugin = nativeBinding.BindingCallableBuiltinPlugin;
|
| 542 |
+
module.exports.BindingChunkingContext = nativeBinding.BindingChunkingContext;
|
| 543 |
+
module.exports.BindingDecodedMap = nativeBinding.BindingDecodedMap;
|
| 544 |
+
module.exports.BindingDevEngine = nativeBinding.BindingDevEngine;
|
| 545 |
+
module.exports.BindingLoadPluginContext = nativeBinding.BindingLoadPluginContext;
|
| 546 |
+
module.exports.BindingMagicString = nativeBinding.BindingMagicString;
|
| 547 |
+
module.exports.BindingModuleInfo = nativeBinding.BindingModuleInfo;
|
| 548 |
+
module.exports.BindingNormalizedOptions = nativeBinding.BindingNormalizedOptions;
|
| 549 |
+
module.exports.BindingOutputAsset = nativeBinding.BindingOutputAsset;
|
| 550 |
+
module.exports.BindingOutputChunk = nativeBinding.BindingOutputChunk;
|
| 551 |
+
module.exports.BindingPluginContext = nativeBinding.BindingPluginContext;
|
| 552 |
+
module.exports.BindingRenderedChunk = nativeBinding.BindingRenderedChunk;
|
| 553 |
+
module.exports.BindingRenderedChunkMeta = nativeBinding.BindingRenderedChunkMeta;
|
| 554 |
+
module.exports.BindingRenderedModule = nativeBinding.BindingRenderedModule;
|
| 555 |
+
module.exports.BindingSourceMap = nativeBinding.BindingSourceMap;
|
| 556 |
+
module.exports.BindingTransformPluginContext = nativeBinding.BindingTransformPluginContext;
|
| 557 |
+
module.exports.BindingWatcher = nativeBinding.BindingWatcher;
|
| 558 |
+
module.exports.BindingWatcherBundler = nativeBinding.BindingWatcherBundler;
|
| 559 |
+
module.exports.BindingWatcherChangeData = nativeBinding.BindingWatcherChangeData;
|
| 560 |
+
module.exports.BindingWatcherEvent = nativeBinding.BindingWatcherEvent;
|
| 561 |
+
module.exports.ParallelJsPluginRegistry = nativeBinding.ParallelJsPluginRegistry;
|
| 562 |
+
module.exports.ScheduledBuild = nativeBinding.ScheduledBuild;
|
| 563 |
+
module.exports.TraceSubscriberGuard = nativeBinding.TraceSubscriberGuard;
|
| 564 |
+
module.exports.TsconfigCache = nativeBinding.TsconfigCache;
|
| 565 |
+
module.exports.BindingAttachDebugInfo = nativeBinding.BindingAttachDebugInfo;
|
| 566 |
+
module.exports.BindingBuiltinPluginName = nativeBinding.BindingBuiltinPluginName;
|
| 567 |
+
module.exports.BindingChunkModuleOrderBy = nativeBinding.BindingChunkModuleOrderBy;
|
| 568 |
+
module.exports.BindingLogLevel = nativeBinding.BindingLogLevel;
|
| 569 |
+
module.exports.BindingPluginOrder = nativeBinding.BindingPluginOrder;
|
| 570 |
+
module.exports.BindingPropertyReadSideEffects = nativeBinding.BindingPropertyReadSideEffects;
|
| 571 |
+
module.exports.BindingPropertyWriteSideEffects = nativeBinding.BindingPropertyWriteSideEffects;
|
| 572 |
+
module.exports.BindingRebuildStrategy = nativeBinding.BindingRebuildStrategy;
|
| 573 |
+
module.exports.collapseSourcemaps = nativeBinding.collapseSourcemaps;
|
| 574 |
+
module.exports.enhancedTransform = nativeBinding.enhancedTransform;
|
| 575 |
+
module.exports.enhancedTransformSync = nativeBinding.enhancedTransformSync;
|
| 576 |
+
module.exports.FilterTokenKind = nativeBinding.FilterTokenKind;
|
| 577 |
+
module.exports.initTraceSubscriber = nativeBinding.initTraceSubscriber;
|
| 578 |
+
module.exports.registerPlugins = nativeBinding.registerPlugins;
|
| 579 |
+
module.exports.resolveTsconfig = nativeBinding.resolveTsconfig;
|
| 580 |
+
module.exports.shutdownAsyncRuntime = nativeBinding.shutdownAsyncRuntime;
|
| 581 |
+
module.exports.startAsyncRuntime = nativeBinding.startAsyncRuntime;
|
| 582 |
+
}));
|
| 583 |
+
//#endregion
|
| 584 |
+
export { __toESM as n, require_binding as t };
|
shared/node_modules/rolldown/dist/shared/binding-DgGsNpT9.d.mts
ADDED
|
@@ -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
+
interface CodegenOptions {
|
| 6 |
+
/**
|
| 7 |
+
* Remove whitespace.
|
| 8 |
+
*
|
| 9 |
+
* @default true
|
| 10 |
+
*/
|
| 11 |
+
removeWhitespace?: boolean;
|
| 12 |
+
/**
|
| 13 |
+
* How to handle legal comments (comments containing `@license`, `@preserve`, or starting with `//!`/`/*!`).
|
| 14 |
+
*
|
| 15 |
+
* * `"none"` - Do not preserve any legal comments.
|
| 16 |
+
* * `"inline"` - Preserve all legal comments inline.
|
| 17 |
+
* * `"eof"` - Move all legal comments to the end of the file.
|
| 18 |
+
* * `"external"` - Extract legal comments without linking.
|
| 19 |
+
* * `{ linked: "path/to/legal.txt" }` - Extract legal comments and add a link comment to the given path.
|
| 20 |
+
*
|
| 21 |
+
* @default "none" (when minifying)
|
| 22 |
+
*/
|
| 23 |
+
legalComments?: 'none' | 'inline' | 'eof' | 'external' | {
|
| 24 |
+
linked: string;
|
| 25 |
+
};
|
| 26 |
+
}
|
| 27 |
+
interface CompressOptions {
|
| 28 |
+
/**
|
| 29 |
+
* Set desired EcmaScript standard version for output.
|
| 30 |
+
*
|
| 31 |
+
* Set `esnext` to enable all target highering.
|
| 32 |
+
*
|
| 33 |
+
* Example:
|
| 34 |
+
*
|
| 35 |
+
* * `'es2015'`
|
| 36 |
+
* * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']`
|
| 37 |
+
*
|
| 38 |
+
* @default 'esnext'
|
| 39 |
+
*
|
| 40 |
+
* @see [oxc#target](https://oxc.rs/docs/guide/usage/transformer/lowering#target)
|
| 41 |
+
*/
|
| 42 |
+
target?: string | Array<string>;
|
| 43 |
+
/**
|
| 44 |
+
* Pass true to discard calls to `console.*`.
|
| 45 |
+
*
|
| 46 |
+
* @default false
|
| 47 |
+
*/
|
| 48 |
+
dropConsole?: boolean;
|
| 49 |
+
/**
|
| 50 |
+
* Remove `debugger;` statements.
|
| 51 |
+
*
|
| 52 |
+
* @default true
|
| 53 |
+
*/
|
| 54 |
+
dropDebugger?: boolean;
|
| 55 |
+
/**
|
| 56 |
+
* Pass `true` to drop unreferenced functions and variables.
|
| 57 |
+
*
|
| 58 |
+
* Simple direct variable assignments do not count as references unless set to `keep_assign`.
|
| 59 |
+
* @default true
|
| 60 |
+
*/
|
| 61 |
+
unused?: boolean | 'keep_assign';
|
| 62 |
+
/** Keep function / class names. */
|
| 63 |
+
keepNames?: CompressOptionsKeepNames;
|
| 64 |
+
/**
|
| 65 |
+
* Join consecutive var, let and const statements.
|
| 66 |
+
*
|
| 67 |
+
* @default true
|
| 68 |
+
*/
|
| 69 |
+
joinVars?: boolean;
|
| 70 |
+
/**
|
| 71 |
+
* Join consecutive simple statements using the comma operator.
|
| 72 |
+
*
|
| 73 |
+
* `a; b` -> `a, b`
|
| 74 |
+
*
|
| 75 |
+
* @default true
|
| 76 |
+
*/
|
| 77 |
+
sequences?: boolean;
|
| 78 |
+
/**
|
| 79 |
+
* Set of label names to drop from the code.
|
| 80 |
+
*
|
| 81 |
+
* Labeled statements matching these names will be removed during minification.
|
| 82 |
+
*
|
| 83 |
+
* @default []
|
| 84 |
+
*/
|
| 85 |
+
dropLabels?: Array<string>;
|
| 86 |
+
/** Limit the maximum number of iterations for debugging purpose. */
|
| 87 |
+
maxIterations?: number;
|
| 88 |
+
/** Treeshake options. */
|
| 89 |
+
treeshake?: TreeShakeOptions;
|
| 90 |
+
}
|
| 91 |
+
interface CompressOptionsKeepNames {
|
| 92 |
+
/**
|
| 93 |
+
* Keep function names so that `Function.prototype.name` is preserved.
|
| 94 |
+
*
|
| 95 |
+
* This does not guarantee that the `undefined` name is preserved.
|
| 96 |
+
*
|
| 97 |
+
* @default false
|
| 98 |
+
*/
|
| 99 |
+
function: boolean;
|
| 100 |
+
/**
|
| 101 |
+
* Keep class names so that `Class.prototype.name` is preserved.
|
| 102 |
+
*
|
| 103 |
+
* This does not guarantee that the `undefined` name is preserved.
|
| 104 |
+
*
|
| 105 |
+
* @default false
|
| 106 |
+
*/
|
| 107 |
+
class: boolean;
|
| 108 |
+
}
|
| 109 |
+
interface MangleOptions {
|
| 110 |
+
/**
|
| 111 |
+
* Pass `true` to mangle names declared in the top level scope.
|
| 112 |
+
*
|
| 113 |
+
* @default true for modules and commonjs, otherwise false
|
| 114 |
+
*/
|
| 115 |
+
toplevel?: boolean;
|
| 116 |
+
/**
|
| 117 |
+
* Preserve `name` property for functions and classes.
|
| 118 |
+
*
|
| 119 |
+
* @default false
|
| 120 |
+
*/
|
| 121 |
+
keepNames?: boolean | MangleOptionsKeepNames;
|
| 122 |
+
/** Debug mangled names. */
|
| 123 |
+
debug?: boolean;
|
| 124 |
+
}
|
| 125 |
+
interface MangleOptionsKeepNames {
|
| 126 |
+
/**
|
| 127 |
+
* Preserve `name` property for functions.
|
| 128 |
+
*
|
| 129 |
+
* @default false
|
| 130 |
+
*/
|
| 131 |
+
function: boolean;
|
| 132 |
+
/**
|
| 133 |
+
* Preserve `name` property for classes.
|
| 134 |
+
*
|
| 135 |
+
* @default false
|
| 136 |
+
*/
|
| 137 |
+
class: boolean;
|
| 138 |
+
}
|
| 139 |
+
interface MinifyOptions {
|
| 140 |
+
/** Use when minifying an ES module. */
|
| 141 |
+
module?: boolean;
|
| 142 |
+
compress?: boolean | CompressOptions;
|
| 143 |
+
mangle?: boolean | MangleOptions;
|
| 144 |
+
codegen?: boolean | CodegenOptions;
|
| 145 |
+
sourcemap?: boolean;
|
| 146 |
+
}
|
| 147 |
+
interface MinifyResult {
|
| 148 |
+
code: string;
|
| 149 |
+
map?: SourceMap;
|
| 150 |
+
errors: Array<OxcError>;
|
| 151 |
+
/**
|
| 152 |
+
* Legal comments extracted from the source code.
|
| 153 |
+
* Only populated when `codegen.legalComments` is `"linked"` or `"external"`.
|
| 154 |
+
*/
|
| 155 |
+
legalComments: Array<string>;
|
| 156 |
+
}
|
| 157 |
+
interface TreeShakeOptions {
|
| 158 |
+
/**
|
| 159 |
+
* Whether to respect the pure annotations.
|
| 160 |
+
*
|
| 161 |
+
* Pure annotations are comments that mark an expression as pure.
|
| 162 |
+
* For example: @__PURE__ or #__NO_SIDE_EFFECTS__.
|
| 163 |
+
*
|
| 164 |
+
* @default true
|
| 165 |
+
*/
|
| 166 |
+
annotations?: boolean;
|
| 167 |
+
/**
|
| 168 |
+
* Whether to treat this function call as pure.
|
| 169 |
+
*
|
| 170 |
+
* This function is called for normal function calls, new calls, and
|
| 171 |
+
* tagged template calls.
|
| 172 |
+
*/
|
| 173 |
+
manualPureFunctions?: Array<string>;
|
| 174 |
+
/**
|
| 175 |
+
* Whether property read accesses have side effects.
|
| 176 |
+
*
|
| 177 |
+
* @default 'always'
|
| 178 |
+
*/
|
| 179 |
+
propertyReadSideEffects?: boolean | 'always';
|
| 180 |
+
/**
|
| 181 |
+
* Whether property write accesses (assignments to member expressions) have side effects.
|
| 182 |
+
*
|
| 183 |
+
* When false, assignments like `obj.prop = value` are considered side-effect-free
|
| 184 |
+
* (assuming the object and value expressions themselves are side-effect-free).
|
| 185 |
+
*
|
| 186 |
+
* @default true
|
| 187 |
+
*/
|
| 188 |
+
propertyWriteSideEffects?: boolean;
|
| 189 |
+
/**
|
| 190 |
+
* Whether accessing a global variable has side effects.
|
| 191 |
+
*
|
| 192 |
+
* Accessing a non-existing global variable will throw an error.
|
| 193 |
+
* Global variable may be a getter that has side effects.
|
| 194 |
+
*
|
| 195 |
+
* @default true
|
| 196 |
+
*/
|
| 197 |
+
unknownGlobalSideEffects?: boolean;
|
| 198 |
+
/**
|
| 199 |
+
* Whether invalid import statements have side effects.
|
| 200 |
+
*
|
| 201 |
+
* Accessing a non-existing import name will throw an error.
|
| 202 |
+
* Also import statements that cannot be resolved will throw an error.
|
| 203 |
+
*
|
| 204 |
+
* @default true
|
| 205 |
+
*/
|
| 206 |
+
invalidImportSideEffects?: boolean;
|
| 207 |
+
}
|
| 208 |
+
interface Comment {
|
| 209 |
+
type: 'Line' | 'Block';
|
| 210 |
+
value: string;
|
| 211 |
+
start: number;
|
| 212 |
+
end: number;
|
| 213 |
+
}
|
| 214 |
+
interface ErrorLabel {
|
| 215 |
+
message: string | null;
|
| 216 |
+
start: number;
|
| 217 |
+
end: number;
|
| 218 |
+
}
|
| 219 |
+
interface OxcError {
|
| 220 |
+
severity: Severity;
|
| 221 |
+
message: string;
|
| 222 |
+
labels: Array<ErrorLabel>;
|
| 223 |
+
helpMessage: string | null;
|
| 224 |
+
codeframe: string | null;
|
| 225 |
+
}
|
| 226 |
+
type Severity = 'Error' | 'Warning' | 'Advice';
|
| 227 |
+
declare class ParseResult {
|
| 228 |
+
get program(): import("@oxc-project/types").Program;
|
| 229 |
+
get module(): EcmaScriptModule;
|
| 230 |
+
get comments(): Array<Comment>;
|
| 231 |
+
get errors(): Array<OxcError>;
|
| 232 |
+
}
|
| 233 |
+
interface DynamicImport {
|
| 234 |
+
start: number;
|
| 235 |
+
end: number;
|
| 236 |
+
moduleRequest: Span;
|
| 237 |
+
}
|
| 238 |
+
interface EcmaScriptModule {
|
| 239 |
+
/**
|
| 240 |
+
* Has ESM syntax.
|
| 241 |
+
*
|
| 242 |
+
* i.e. `import` and `export` statements, and `import.meta`.
|
| 243 |
+
*
|
| 244 |
+
* Dynamic imports `import('foo')` are ignored since they can be used in non-ESM files.
|
| 245 |
+
*/
|
| 246 |
+
hasModuleSyntax: boolean;
|
| 247 |
+
/** Import statements. */
|
| 248 |
+
staticImports: Array<StaticImport>;
|
| 249 |
+
/** Export statements. */
|
| 250 |
+
staticExports: Array<StaticExport>;
|
| 251 |
+
/** Dynamic import expressions. */
|
| 252 |
+
dynamicImports: Array<DynamicImport>;
|
| 253 |
+
/** Span positions` of `import.meta` */
|
| 254 |
+
importMetas: Array<Span>;
|
| 255 |
+
}
|
| 256 |
+
interface ExportExportName {
|
| 257 |
+
kind: ExportExportNameKind;
|
| 258 |
+
name: string | null;
|
| 259 |
+
start: number | null;
|
| 260 |
+
end: number | null;
|
| 261 |
+
}
|
| 262 |
+
type ExportExportNameKind = /** `export { name } */'Name' | /** `export default expression` */'Default' | /** `export * from "mod" */'None';
|
| 263 |
+
interface ExportImportName {
|
| 264 |
+
kind: ExportImportNameKind;
|
| 265 |
+
name: string | null;
|
| 266 |
+
start: number | null;
|
| 267 |
+
end: number | null;
|
| 268 |
+
}
|
| 269 |
+
type ExportImportNameKind = /** `export { name } */'Name' | /** `export * as ns from "mod"` */'All' | /** `export * from "mod"` */'AllButDefault' | /** Does not have a specifier. */'None';
|
| 270 |
+
interface ExportLocalName {
|
| 271 |
+
kind: ExportLocalNameKind;
|
| 272 |
+
name: string | null;
|
| 273 |
+
start: number | null;
|
| 274 |
+
end: number | null;
|
| 275 |
+
}
|
| 276 |
+
type ExportLocalNameKind = /** `export { name } */'Name' | /** `export default expression` */'Default' |
|
| 277 |
+
/**
|
| 278 |
+
* If the exported value is not locally accessible from within the module.
|
| 279 |
+
* `export default function () {}`
|
| 280 |
+
*/
|
| 281 |
+
'None';
|
| 282 |
+
interface ImportName {
|
| 283 |
+
kind: ImportNameKind;
|
| 284 |
+
name: string | null;
|
| 285 |
+
start: number | null;
|
| 286 |
+
end: number | null;
|
| 287 |
+
}
|
| 288 |
+
type ImportNameKind = /** `import { x } from "mod"` */'Name' | /** `import * as ns from "mod"` */'NamespaceObject' | /** `import defaultExport from "mod"` */'Default';
|
| 289 |
+
interface ParserOptions {
|
| 290 |
+
/** Treat the source text as `js`, `jsx`, `ts`, `tsx` or `dts`. */
|
| 291 |
+
lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts';
|
| 292 |
+
/** Treat the source text as `script` or `module` code. */
|
| 293 |
+
sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined;
|
| 294 |
+
/**
|
| 295 |
+
* Return an AST which includes TypeScript-related properties, or excludes them.
|
| 296 |
+
*
|
| 297 |
+
* `'js'` is default for JS / JSX files.
|
| 298 |
+
* `'ts'` is default for TS / TSX files.
|
| 299 |
+
* The type of the file is determined from `lang` option, or extension of provided `filename`.
|
| 300 |
+
*/
|
| 301 |
+
astType?: 'js' | 'ts';
|
| 302 |
+
/**
|
| 303 |
+
* Controls whether the `range` property is included on AST nodes.
|
| 304 |
+
* The `range` property is a `[number, number]` which indicates the start/end offsets
|
| 305 |
+
* of the node in the file contents.
|
| 306 |
+
*
|
| 307 |
+
* @default false
|
| 308 |
+
*/
|
| 309 |
+
range?: boolean;
|
| 310 |
+
/**
|
| 311 |
+
* Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST.
|
| 312 |
+
*
|
| 313 |
+
* If this option is true, parenthesized expressions are represented by
|
| 314 |
+
* (non-standard) `ParenthesizedExpression` and `TSParenthesizedType` nodes that
|
| 315 |
+
* have a single `expression` property containing the expression inside parentheses.
|
| 316 |
+
*
|
| 317 |
+
* @default true
|
| 318 |
+
*/
|
| 319 |
+
preserveParens?: boolean;
|
| 320 |
+
/**
|
| 321 |
+
* Produce semantic errors with an additional AST pass.
|
| 322 |
+
* Semantic errors depend on symbols and scopes, where the parser does not construct.
|
| 323 |
+
* This adds a small performance overhead.
|
| 324 |
+
*
|
| 325 |
+
* @default false
|
| 326 |
+
*/
|
| 327 |
+
showSemanticErrors?: boolean;
|
| 328 |
+
}
|
| 329 |
+
interface Span {
|
| 330 |
+
start: number;
|
| 331 |
+
end: number;
|
| 332 |
+
}
|
| 333 |
+
interface StaticExport {
|
| 334 |
+
start: number;
|
| 335 |
+
end: number;
|
| 336 |
+
entries: Array<StaticExportEntry>;
|
| 337 |
+
}
|
| 338 |
+
interface StaticExportEntry {
|
| 339 |
+
start: number;
|
| 340 |
+
end: number;
|
| 341 |
+
moduleRequest: ValueSpan | null;
|
| 342 |
+
/** The name under which the desired binding is exported by the module`. */
|
| 343 |
+
importName: ExportImportName;
|
| 344 |
+
/** The name used to export this binding by this module. */
|
| 345 |
+
exportName: ExportExportName;
|
| 346 |
+
/** The name that is used to locally access the exported value from within the importing module. */
|
| 347 |
+
localName: ExportLocalName;
|
| 348 |
+
/**
|
| 349 |
+
* Whether the export is a TypeScript `export type`.
|
| 350 |
+
*
|
| 351 |
+
* Examples:
|
| 352 |
+
*
|
| 353 |
+
* ```ts
|
| 354 |
+
* export type * from 'mod';
|
| 355 |
+
* export type * as ns from 'mod';
|
| 356 |
+
* export type { foo };
|
| 357 |
+
* export { type foo }:
|
| 358 |
+
* export type { foo } from 'mod';
|
| 359 |
+
* ```
|
| 360 |
+
*/
|
| 361 |
+
isType: boolean;
|
| 362 |
+
}
|
| 363 |
+
interface StaticImport {
|
| 364 |
+
/** Start of import statement. */
|
| 365 |
+
start: number;
|
| 366 |
+
/** End of import statement. */
|
| 367 |
+
end: number;
|
| 368 |
+
/**
|
| 369 |
+
* Import source.
|
| 370 |
+
*
|
| 371 |
+
* ```js
|
| 372 |
+
* import { foo } from "mod";
|
| 373 |
+
* // ^^^
|
| 374 |
+
* ```
|
| 375 |
+
*/
|
| 376 |
+
moduleRequest: ValueSpan;
|
| 377 |
+
/**
|
| 378 |
+
* Import specifiers.
|
| 379 |
+
*
|
| 380 |
+
* Empty for `import "mod"`.
|
| 381 |
+
*/
|
| 382 |
+
entries: Array<StaticImportEntry>;
|
| 383 |
+
}
|
| 384 |
+
interface StaticImportEntry {
|
| 385 |
+
/**
|
| 386 |
+
* The name under which the desired binding is exported by the module.
|
| 387 |
+
*
|
| 388 |
+
* ```js
|
| 389 |
+
* import { foo } from "mod";
|
| 390 |
+
* // ^^^
|
| 391 |
+
* import { foo as bar } from "mod";
|
| 392 |
+
* // ^^^
|
| 393 |
+
* ```
|
| 394 |
+
*/
|
| 395 |
+
importName: ImportName;
|
| 396 |
+
/**
|
| 397 |
+
* The name that is used to locally access the imported value from within the importing module.
|
| 398 |
+
* ```js
|
| 399 |
+
* import { foo } from "mod";
|
| 400 |
+
* // ^^^
|
| 401 |
+
* import { foo as bar } from "mod";
|
| 402 |
+
* // ^^^
|
| 403 |
+
* ```
|
| 404 |
+
*/
|
| 405 |
+
localName: ValueSpan;
|
| 406 |
+
/**
|
| 407 |
+
* Whether this binding is for a TypeScript type-only import.
|
| 408 |
+
*
|
| 409 |
+
* `true` for the following imports:
|
| 410 |
+
* ```ts
|
| 411 |
+
* import type { foo } from "mod";
|
| 412 |
+
* import { type foo } from "mod";
|
| 413 |
+
* ```
|
| 414 |
+
*/
|
| 415 |
+
isType: boolean;
|
| 416 |
+
}
|
| 417 |
+
interface ValueSpan {
|
| 418 |
+
value: string;
|
| 419 |
+
start: number;
|
| 420 |
+
end: number;
|
| 421 |
+
}
|
| 422 |
+
declare class ResolverFactory {
|
| 423 |
+
constructor(options?: NapiResolveOptions | undefined | null);
|
| 424 |
+
static default(): ResolverFactory;
|
| 425 |
+
/** Clone the resolver using the same underlying cache. */
|
| 426 |
+
cloneWithOptions(options: NapiResolveOptions): ResolverFactory;
|
| 427 |
+
/**
|
| 428 |
+
* Clear the underlying cache.
|
| 429 |
+
*
|
| 430 |
+
* Warning: The caller must ensure that there're no ongoing resolution operations when calling this method. Otherwise, it may cause those operations to return an incorrect result.
|
| 431 |
+
*/
|
| 432 |
+
clearCache(): void;
|
| 433 |
+
/** Synchronously resolve `specifier` at an absolute path to a `directory`. */
|
| 434 |
+
sync(directory: string, request: string): ResolveResult;
|
| 435 |
+
/** Asynchronously resolve `specifier` at an absolute path to a `directory`. */
|
| 436 |
+
async(directory: string, request: string): Promise<ResolveResult>;
|
| 437 |
+
/**
|
| 438 |
+
* Synchronously resolve `specifier` at an absolute path to a `file`.
|
| 439 |
+
*
|
| 440 |
+
* This method automatically discovers tsconfig.json by traversing parent directories.
|
| 441 |
+
*/
|
| 442 |
+
resolveFileSync(file: string, request: string): ResolveResult;
|
| 443 |
+
/**
|
| 444 |
+
* Asynchronously resolve `specifier` at an absolute path to a `file`.
|
| 445 |
+
*
|
| 446 |
+
* This method automatically discovers tsconfig.json by traversing parent directories.
|
| 447 |
+
*/
|
| 448 |
+
resolveFileAsync(file: string, request: string): Promise<ResolveResult>;
|
| 449 |
+
/**
|
| 450 |
+
* Synchronously resolve `specifier` for TypeScript declaration files.
|
| 451 |
+
*
|
| 452 |
+
* `file` is the absolute path to the containing file.
|
| 453 |
+
* Uses TypeScript's `moduleResolution: "bundler"` algorithm.
|
| 454 |
+
*/
|
| 455 |
+
resolveDtsSync(file: string, request: string): ResolveResult;
|
| 456 |
+
/**
|
| 457 |
+
* Asynchronously resolve `specifier` for TypeScript declaration files.
|
| 458 |
+
*
|
| 459 |
+
* `file` is the absolute path to the containing file.
|
| 460 |
+
* Uses TypeScript's `moduleResolution: "bundler"` algorithm.
|
| 461 |
+
*/
|
| 462 |
+
resolveDtsAsync(file: string, request: string): Promise<ResolveResult>;
|
| 463 |
+
}
|
| 464 |
+
/** Node.js builtin module when `Options::builtin_modules` is enabled. */
|
| 465 |
+
interface Builtin {
|
| 466 |
+
/**
|
| 467 |
+
* Resolved module.
|
| 468 |
+
*
|
| 469 |
+
* Always prefixed with "node:" in compliance with the ESM specification.
|
| 470 |
+
*/
|
| 471 |
+
resolved: string;
|
| 472 |
+
/**
|
| 473 |
+
* Whether the request was prefixed with `node:` or not.
|
| 474 |
+
* `fs` -> `false`.
|
| 475 |
+
* `node:fs` returns `true`.
|
| 476 |
+
*/
|
| 477 |
+
isRuntimeModule: boolean;
|
| 478 |
+
}
|
| 479 |
+
declare enum EnforceExtension {
|
| 480 |
+
Auto = 0,
|
| 481 |
+
Enabled = 1,
|
| 482 |
+
Disabled = 2
|
| 483 |
+
}
|
| 484 |
+
type ModuleType = 'module' | 'commonjs' | 'json' | 'wasm' | 'addon';
|
| 485 |
+
/**
|
| 486 |
+
* Module Resolution Options
|
| 487 |
+
*
|
| 488 |
+
* Options are directly ported from [enhanced-resolve](https://github.com/webpack/enhanced-resolve#resolver-options).
|
| 489 |
+
*
|
| 490 |
+
* See [webpack resolve](https://webpack.js.org/configuration/resolve/) for information and examples
|
| 491 |
+
*/
|
| 492 |
+
interface NapiResolveOptions {
|
| 493 |
+
/**
|
| 494 |
+
* Discover tsconfig automatically or use the specified tsconfig.json path.
|
| 495 |
+
*
|
| 496 |
+
* Default `None`
|
| 497 |
+
*/
|
| 498 |
+
tsconfig?: 'auto' | TsconfigOptions;
|
| 499 |
+
/**
|
| 500 |
+
* Alias for [ResolveOptions::alias] and [ResolveOptions::fallback].
|
| 501 |
+
*
|
| 502 |
+
* For the second value of the tuple, `None -> AliasValue::Ignore`, Some(String) ->
|
| 503 |
+
* AliasValue::Path(String)`
|
| 504 |
+
* Create aliases to import or require certain modules more easily.
|
| 505 |
+
* A trailing $ can also be added to the given object's keys to signify an exact match.
|
| 506 |
+
* Default `{}`
|
| 507 |
+
*/
|
| 508 |
+
alias?: Record<string, Array<string | undefined | null>>;
|
| 509 |
+
/**
|
| 510 |
+
* A list of alias fields in description files.
|
| 511 |
+
* Specify a field, such as `browser`, to be parsed according to [this specification](https://github.com/defunctzombie/package-browser-field-spec).
|
| 512 |
+
* Can be a path to json object such as `["path", "to", "exports"]`.
|
| 513 |
+
*
|
| 514 |
+
* Default `[]`
|
| 515 |
+
*/
|
| 516 |
+
aliasFields?: (string | string[])[];
|
| 517 |
+
/**
|
| 518 |
+
* Condition names for exports field which defines entry points of a package.
|
| 519 |
+
* The key order in the exports field is significant. During condition matching, earlier entries have higher priority and take precedence over later entries.
|
| 520 |
+
*
|
| 521 |
+
* Default `[]`
|
| 522 |
+
*/
|
| 523 |
+
conditionNames?: Array<string>;
|
| 524 |
+
/**
|
| 525 |
+
* If true, it will not allow extension-less files.
|
| 526 |
+
* So by default `require('./foo')` works if `./foo` has a `.js` extension,
|
| 527 |
+
* but with this enabled only `require('./foo.js')` will work.
|
| 528 |
+
*
|
| 529 |
+
* Default to `true` when [ResolveOptions::extensions] contains an empty string.
|
| 530 |
+
* Use `Some(false)` to disable the behavior.
|
| 531 |
+
* See <https://github.com/webpack/enhanced-resolve/pull/285>
|
| 532 |
+
*
|
| 533 |
+
* Default None, which is the same as `Some(false)` when the above empty rule is not applied.
|
| 534 |
+
*/
|
| 535 |
+
enforceExtension?: EnforceExtension;
|
| 536 |
+
/**
|
| 537 |
+
* A list of exports fields in description files.
|
| 538 |
+
* Can be a path to json object such as `["path", "to", "exports"]`.
|
| 539 |
+
*
|
| 540 |
+
* Default `[["exports"]]`.
|
| 541 |
+
*/
|
| 542 |
+
exportsFields?: (string | string[])[];
|
| 543 |
+
/**
|
| 544 |
+
* Fields from `package.json` which are used to provide the internal requests of a package
|
| 545 |
+
* (requests starting with # are considered internal).
|
| 546 |
+
*
|
| 547 |
+
* Can be a path to a JSON object such as `["path", "to", "imports"]`.
|
| 548 |
+
*
|
| 549 |
+
* Default `[["imports"]]`.
|
| 550 |
+
*/
|
| 551 |
+
importsFields?: (string | string[])[];
|
| 552 |
+
/**
|
| 553 |
+
* An object which maps extension to extension aliases.
|
| 554 |
+
*
|
| 555 |
+
* Default `{}`
|
| 556 |
+
*/
|
| 557 |
+
extensionAlias?: Record<string, Array<string>>;
|
| 558 |
+
/**
|
| 559 |
+
* Attempt to resolve these extensions in order.
|
| 560 |
+
* If multiple files share the same name but have different extensions,
|
| 561 |
+
* will resolve the one with the extension listed first in the array and skip the rest.
|
| 562 |
+
*
|
| 563 |
+
* Default `[".js", ".json", ".node"]`
|
| 564 |
+
*/
|
| 565 |
+
extensions?: Array<string>;
|
| 566 |
+
/**
|
| 567 |
+
* Redirect module requests when normal resolving fails.
|
| 568 |
+
*
|
| 569 |
+
* Default `{}`
|
| 570 |
+
*/
|
| 571 |
+
fallback?: Record<string, Array<string | undefined | null>>;
|
| 572 |
+
/**
|
| 573 |
+
* Request passed to resolve is already fully specified and extensions or main files are not resolved for it (they are still resolved for internal requests).
|
| 574 |
+
*
|
| 575 |
+
* See also webpack configuration [resolve.fullySpecified](https://webpack.js.org/configuration/module/#resolvefullyspecified)
|
| 576 |
+
*
|
| 577 |
+
* Default `false`
|
| 578 |
+
*/
|
| 579 |
+
fullySpecified?: boolean;
|
| 580 |
+
/**
|
| 581 |
+
* A list of main fields in description files
|
| 582 |
+
*
|
| 583 |
+
* Default `["main"]`.
|
| 584 |
+
*/
|
| 585 |
+
mainFields?: string | string[];
|
| 586 |
+
/**
|
| 587 |
+
* The filename to be used while resolving directories.
|
| 588 |
+
*
|
| 589 |
+
* Default `["index"]`
|
| 590 |
+
*/
|
| 591 |
+
mainFiles?: Array<string>;
|
| 592 |
+
/**
|
| 593 |
+
* A list of directories to resolve modules from, can be absolute path or folder name.
|
| 594 |
+
*
|
| 595 |
+
* Default `["node_modules"]`
|
| 596 |
+
*/
|
| 597 |
+
modules?: string | string[];
|
| 598 |
+
/**
|
| 599 |
+
* Resolve to a context instead of a file.
|
| 600 |
+
*
|
| 601 |
+
* Default `false`
|
| 602 |
+
*/
|
| 603 |
+
resolveToContext?: boolean;
|
| 604 |
+
/**
|
| 605 |
+
* Prefer to resolve module requests as relative requests instead of using modules from node_modules directories.
|
| 606 |
+
*
|
| 607 |
+
* Default `false`
|
| 608 |
+
*/
|
| 609 |
+
preferRelative?: boolean;
|
| 610 |
+
/**
|
| 611 |
+
* Prefer to resolve server-relative urls as absolute paths before falling back to resolve in ResolveOptions::roots.
|
| 612 |
+
*
|
| 613 |
+
* Default `false`
|
| 614 |
+
*/
|
| 615 |
+
preferAbsolute?: boolean;
|
| 616 |
+
/**
|
| 617 |
+
* A list of resolve restrictions to restrict the paths that a request can be resolved on.
|
| 618 |
+
*
|
| 619 |
+
* Default `[]`
|
| 620 |
+
*/
|
| 621 |
+
restrictions?: Array<Restriction>;
|
| 622 |
+
/**
|
| 623 |
+
* A list of directories where requests of server-relative URLs (starting with '/') are resolved.
|
| 624 |
+
* On non-Windows systems these requests are resolved as an absolute path first.
|
| 625 |
+
*
|
| 626 |
+
* Default `[]`
|
| 627 |
+
*/
|
| 628 |
+
roots?: Array<string>;
|
| 629 |
+
/**
|
| 630 |
+
* Whether to resolve symlinks to their symlinked location.
|
| 631 |
+
* When enabled, symlinked resources are resolved to their real path, not their symlinked location.
|
| 632 |
+
* Note that this may cause module resolution to fail when using tools that symlink packages (like npm link).
|
| 633 |
+
*
|
| 634 |
+
* Default `true`
|
| 635 |
+
*/
|
| 636 |
+
symlinks?: boolean;
|
| 637 |
+
/**
|
| 638 |
+
* Whether to read the `NODE_PATH` environment variable and append its entries to `modules`.
|
| 639 |
+
*
|
| 640 |
+
* `NODE_PATH` is a deprecated Node.js feature that is not part of ESM resolution.
|
| 641 |
+
* Set this to `false` to disable the behavior.
|
| 642 |
+
*
|
| 643 |
+
* Default `true`
|
| 644 |
+
*/
|
| 645 |
+
nodePath?: boolean;
|
| 646 |
+
/**
|
| 647 |
+
* Whether to parse [module.builtinModules](https://nodejs.org/api/module.html#modulebuiltinmodules) or not.
|
| 648 |
+
* For example, "zlib" will throw [crate::ResolveError::Builtin] when set to true.
|
| 649 |
+
*
|
| 650 |
+
* Default `false`
|
| 651 |
+
*/
|
| 652 |
+
builtinModules?: boolean;
|
| 653 |
+
/**
|
| 654 |
+
* Resolve [ResolveResult::moduleType].
|
| 655 |
+
*
|
| 656 |
+
* Default `false`
|
| 657 |
+
*/
|
| 658 |
+
moduleType?: boolean;
|
| 659 |
+
/**
|
| 660 |
+
* Allow `exports` field in `require('../directory')`.
|
| 661 |
+
*
|
| 662 |
+
* This is not part of the spec but some vite projects rely on this behavior.
|
| 663 |
+
* See
|
| 664 |
+
* * <https://github.com/vitejs/vite/pull/20252>
|
| 665 |
+
* * <https://github.com/nodejs/node/issues/58827>
|
| 666 |
+
*
|
| 667 |
+
* Default: `false`
|
| 668 |
+
*/
|
| 669 |
+
allowPackageExportsInDirectoryResolve?: boolean;
|
| 670 |
+
}
|
| 671 |
+
interface ResolveResult {
|
| 672 |
+
path?: string;
|
| 673 |
+
error?: string;
|
| 674 |
+
builtin?: Builtin;
|
| 675 |
+
/**
|
| 676 |
+
* Module type for this path.
|
| 677 |
+
*
|
| 678 |
+
* Enable with `ResolveOptions#moduleType`.
|
| 679 |
+
*
|
| 680 |
+
* The module type is computed `ESM_FILE_FORMAT` from the [ESM resolution algorithm specification](https://nodejs.org/docs/latest/api/esm.html#resolution-algorithm-specification).
|
| 681 |
+
*
|
| 682 |
+
* The algorithm uses the file extension or finds the closest `package.json` with the `type` field.
|
| 683 |
+
*/
|
| 684 |
+
moduleType?: ModuleType;
|
| 685 |
+
/** `package.json` path for the given module. */
|
| 686 |
+
packageJsonPath?: string;
|
| 687 |
+
}
|
| 688 |
+
/**
|
| 689 |
+
* Alias Value for [ResolveOptions::alias] and [ResolveOptions::fallback].
|
| 690 |
+
* Use struct because napi don't support structured union now
|
| 691 |
+
*/
|
| 692 |
+
interface Restriction {
|
| 693 |
+
path?: string;
|
| 694 |
+
regex?: string;
|
| 695 |
+
}
|
| 696 |
+
/**
|
| 697 |
+
* Tsconfig Options
|
| 698 |
+
*
|
| 699 |
+
* Derived from [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin#options)
|
| 700 |
+
*/
|
| 701 |
+
interface TsconfigOptions {
|
| 702 |
+
/**
|
| 703 |
+
* Allows you to specify where to find the TypeScript configuration file.
|
| 704 |
+
* You may provide
|
| 705 |
+
* * a relative path to the configuration file. It will be resolved relative to cwd.
|
| 706 |
+
* * an absolute path to the configuration file.
|
| 707 |
+
*/
|
| 708 |
+
configFile: string;
|
| 709 |
+
/**
|
| 710 |
+
* Support for Typescript Project References.
|
| 711 |
+
*
|
| 712 |
+
* * `'auto'`: use the `references` field from tsconfig of `config_file`.
|
| 713 |
+
*/
|
| 714 |
+
references?: 'auto';
|
| 715 |
+
}
|
| 716 |
+
interface SourceMap {
|
| 717 |
+
file?: string;
|
| 718 |
+
mappings: string;
|
| 719 |
+
names: Array<string>;
|
| 720 |
+
sourceRoot?: string;
|
| 721 |
+
sources: Array<string>;
|
| 722 |
+
sourcesContent?: Array<string>;
|
| 723 |
+
version: number;
|
| 724 |
+
x_google_ignoreList?: Array<number>;
|
| 725 |
+
}
|
| 726 |
+
interface CompilerAssumptions {
|
| 727 |
+
ignoreFunctionLength?: boolean;
|
| 728 |
+
noDocumentAll?: boolean;
|
| 729 |
+
objectRestNoSymbols?: boolean;
|
| 730 |
+
pureGetters?: boolean;
|
| 731 |
+
/**
|
| 732 |
+
* When using public class fields, assume that they don't shadow any getter in the current class,
|
| 733 |
+
* in its subclasses or in its superclass. Thus, it's safe to assign them rather than using
|
| 734 |
+
* `Object.defineProperty`.
|
| 735 |
+
*
|
| 736 |
+
* For example:
|
| 737 |
+
*
|
| 738 |
+
* Input:
|
| 739 |
+
* ```js
|
| 740 |
+
* class Test {
|
| 741 |
+
* field = 2;
|
| 742 |
+
*
|
| 743 |
+
* static staticField = 3;
|
| 744 |
+
* }
|
| 745 |
+
* ```
|
| 746 |
+
*
|
| 747 |
+
* When `set_public_class_fields` is `true`, the output will be:
|
| 748 |
+
* ```js
|
| 749 |
+
* class Test {
|
| 750 |
+
* constructor() {
|
| 751 |
+
* this.field = 2;
|
| 752 |
+
* }
|
| 753 |
+
* }
|
| 754 |
+
* Test.staticField = 3;
|
| 755 |
+
* ```
|
| 756 |
+
*
|
| 757 |
+
* Otherwise, the output will be:
|
| 758 |
+
* ```js
|
| 759 |
+
* import _defineProperty from "@oxc-project/runtime/helpers/defineProperty";
|
| 760 |
+
* class Test {
|
| 761 |
+
* constructor() {
|
| 762 |
+
* _defineProperty(this, "field", 2);
|
| 763 |
+
* }
|
| 764 |
+
* }
|
| 765 |
+
* _defineProperty(Test, "staticField", 3);
|
| 766 |
+
* ```
|
| 767 |
+
*
|
| 768 |
+
* NOTE: For TypeScript, if you wanted behavior is equivalent to `useDefineForClassFields: false`, you should
|
| 769 |
+
* set both `set_public_class_fields` and [`crate::TypeScriptOptions::remove_class_fields_without_initializer`]
|
| 770 |
+
* to `true`.
|
| 771 |
+
*/
|
| 772 |
+
setPublicClassFields?: boolean;
|
| 773 |
+
}
|
| 774 |
+
interface DecoratorOptions {
|
| 775 |
+
/**
|
| 776 |
+
* Enables experimental support for decorators, which is a version of decorators that predates the TC39 standardization process.
|
| 777 |
+
*
|
| 778 |
+
* Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification.
|
| 779 |
+
* This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39.
|
| 780 |
+
*
|
| 781 |
+
* @see https://www.typescriptlang.org/tsconfig/#experimentalDecorators
|
| 782 |
+
* @default false
|
| 783 |
+
*/
|
| 784 |
+
legacy?: boolean;
|
| 785 |
+
/**
|
| 786 |
+
* Enables emitting decorator metadata.
|
| 787 |
+
*
|
| 788 |
+
* This option the same as [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata)
|
| 789 |
+
* in TypeScript, and it only works when `legacy` is true.
|
| 790 |
+
*
|
| 791 |
+
* @see https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata
|
| 792 |
+
* @default false
|
| 793 |
+
*/
|
| 794 |
+
emitDecoratorMetadata?: boolean;
|
| 795 |
+
/**
|
| 796 |
+
* Aligns nullable-union `design:type` emission with `--strictNullChecks`.
|
| 797 |
+
*
|
| 798 |
+
* When `true` (default), `T | null` and `T | undefined` emit `Object`, matching tsc strict.
|
| 799 |
+
* When `false`, `null` and `undefined` are elided from the union so the underlying
|
| 800 |
+
* primitive constructor is emitted, matching tsc with `--strictNullChecks=false`
|
| 801 |
+
* and `babel-plugin-transform-typescript-metadata`.
|
| 802 |
+
*
|
| 803 |
+
* @see https://www.typescriptlang.org/tsconfig/#strictNullChecks
|
| 804 |
+
* @default true
|
| 805 |
+
*/
|
| 806 |
+
strictNullChecks?: boolean;
|
| 807 |
+
}
|
| 808 |
+
type HelperMode =
|
| 809 |
+
/**
|
| 810 |
+
* Runtime mode (default): Helper functions are imported from a runtime package.
|
| 811 |
+
*
|
| 812 |
+
* Example:
|
| 813 |
+
*
|
| 814 |
+
* ```js
|
| 815 |
+
* import helperName from "@oxc-project/runtime/helpers/helperName";
|
| 816 |
+
* helperName(...arguments);
|
| 817 |
+
* ```
|
| 818 |
+
*/
|
| 819 |
+
'Runtime' |
|
| 820 |
+
/**
|
| 821 |
+
* External mode: Helper functions are accessed from a global `babelHelpers` object.
|
| 822 |
+
*
|
| 823 |
+
* Example:
|
| 824 |
+
*
|
| 825 |
+
* ```js
|
| 826 |
+
* babelHelpers.helperName(...arguments);
|
| 827 |
+
* ```
|
| 828 |
+
*/
|
| 829 |
+
'External';
|
| 830 |
+
interface Helpers {
|
| 831 |
+
mode?: HelperMode;
|
| 832 |
+
}
|
| 833 |
+
/**
|
| 834 |
+
* TypeScript Isolated Declarations for Standalone DTS Emit (async)
|
| 835 |
+
*
|
| 836 |
+
* Note: This function can be slower than `isolatedDeclarationSync` due to the overhead of spawning a thread.
|
| 837 |
+
*/
|
| 838 |
+
declare function isolatedDeclaration(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): Promise<IsolatedDeclarationsResult>;
|
| 839 |
+
interface IsolatedDeclarationsOptions {
|
| 840 |
+
/**
|
| 841 |
+
* Do not emit declarations for code that has an @internal annotation in its JSDoc comment.
|
| 842 |
+
* This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid.
|
| 843 |
+
*
|
| 844 |
+
* Default: `false`
|
| 845 |
+
*
|
| 846 |
+
* See <https://www.typescriptlang.org/tsconfig/#stripInternal>
|
| 847 |
+
*/
|
| 848 |
+
stripInternal?: boolean;
|
| 849 |
+
sourcemap?: boolean;
|
| 850 |
+
}
|
| 851 |
+
interface IsolatedDeclarationsResult {
|
| 852 |
+
code: string;
|
| 853 |
+
map?: SourceMap;
|
| 854 |
+
errors: Array<OxcError>;
|
| 855 |
+
}
|
| 856 |
+
/** TypeScript Isolated Declarations for Standalone DTS Emit */
|
| 857 |
+
declare function isolatedDeclarationSync(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): IsolatedDeclarationsResult;
|
| 858 |
+
/**
|
| 859 |
+
* Configure how TSX and JSX are transformed.
|
| 860 |
+
*
|
| 861 |
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
|
| 862 |
+
*/
|
| 863 |
+
interface JsxOptions {
|
| 864 |
+
/**
|
| 865 |
+
* Decides which runtime to use.
|
| 866 |
+
*
|
| 867 |
+
* - 'automatic' - auto-import the correct JSX factories
|
| 868 |
+
* - 'classic' - no auto-import
|
| 869 |
+
*
|
| 870 |
+
* @default 'automatic'
|
| 871 |
+
*/
|
| 872 |
+
runtime?: 'classic' | 'automatic';
|
| 873 |
+
/**
|
| 874 |
+
* Emit development-specific information, such as `__source` and `__self`.
|
| 875 |
+
*
|
| 876 |
+
* @default false
|
| 877 |
+
*/
|
| 878 |
+
development?: boolean;
|
| 879 |
+
/**
|
| 880 |
+
* Toggles whether or not to throw an error if an XML namespaced tag name
|
| 881 |
+
* is used.
|
| 882 |
+
*
|
| 883 |
+
* Though the JSX spec allows this, it is disabled by default since React's
|
| 884 |
+
* JSX does not currently have support for it.
|
| 885 |
+
*
|
| 886 |
+
* @default true
|
| 887 |
+
*/
|
| 888 |
+
throwIfNamespace?: boolean;
|
| 889 |
+
/**
|
| 890 |
+
* Mark JSX elements and top-level React method calls as pure for tree shaking.
|
| 891 |
+
*
|
| 892 |
+
* @default true
|
| 893 |
+
*/
|
| 894 |
+
pure?: boolean;
|
| 895 |
+
/**
|
| 896 |
+
* Replaces the import source when importing functions.
|
| 897 |
+
*
|
| 898 |
+
* @default 'react'
|
| 899 |
+
*/
|
| 900 |
+
importSource?: string;
|
| 901 |
+
/**
|
| 902 |
+
* Replace the function used when compiling JSX expressions. It should be a
|
| 903 |
+
* qualified name (e.g. `React.createElement`) or an identifier (e.g.
|
| 904 |
+
* `createElement`).
|
| 905 |
+
*
|
| 906 |
+
* Only used for `classic` {@link runtime}.
|
| 907 |
+
*
|
| 908 |
+
* @default 'React.createElement'
|
| 909 |
+
*/
|
| 910 |
+
pragma?: string;
|
| 911 |
+
/**
|
| 912 |
+
* Replace the component used when compiling JSX fragments. It should be a
|
| 913 |
+
* valid JSX tag name.
|
| 914 |
+
*
|
| 915 |
+
* Only used for `classic` {@link runtime}.
|
| 916 |
+
*
|
| 917 |
+
* @default 'React.Fragment'
|
| 918 |
+
*/
|
| 919 |
+
pragmaFrag?: string;
|
| 920 |
+
/**
|
| 921 |
+
* Enable React Fast Refresh .
|
| 922 |
+
*
|
| 923 |
+
* Conforms to the implementation in {@link https://github.com/facebook/react/tree/v18.3.1/packages/react-refresh}
|
| 924 |
+
*
|
| 925 |
+
* @default false
|
| 926 |
+
*/
|
| 927 |
+
refresh?: boolean | ReactRefreshOptions;
|
| 928 |
+
}
|
| 929 |
+
/**
|
| 930 |
+
* Transform JavaScript code to a Vite Node runnable module.
|
| 931 |
+
*
|
| 932 |
+
* @param filename The name of the file being transformed.
|
| 933 |
+
* @param sourceText the source code itself
|
| 934 |
+
* @param options The options for the transformation. See {@link
|
| 935 |
+
* ModuleRunnerTransformOptions} for more information.
|
| 936 |
+
*
|
| 937 |
+
* @returns an object containing the transformed code, source maps, and any
|
| 938 |
+
* errors that occurred during parsing or transformation.
|
| 939 |
+
*
|
| 940 |
+
* Note: This function can be slower than `moduleRunnerTransformSync` due to the overhead of spawning a thread.
|
| 941 |
+
*
|
| 942 |
+
* @deprecated Only works for Vite.
|
| 943 |
+
*/
|
| 944 |
+
declare function moduleRunnerTransform(filename: string, sourceText: string, options?: ModuleRunnerTransformOptions | undefined | null): Promise<ModuleRunnerTransformResult>;
|
| 945 |
+
interface ModuleRunnerTransformOptions {
|
| 946 |
+
/**
|
| 947 |
+
* Enable source map generation.
|
| 948 |
+
*
|
| 949 |
+
* When `true`, the `sourceMap` field of transform result objects will be populated.
|
| 950 |
+
*
|
| 951 |
+
* @default false
|
| 952 |
+
*
|
| 953 |
+
* @see {@link SourceMap}
|
| 954 |
+
*/
|
| 955 |
+
sourcemap?: boolean;
|
| 956 |
+
}
|
| 957 |
+
interface ModuleRunnerTransformResult {
|
| 958 |
+
/**
|
| 959 |
+
* The transformed code.
|
| 960 |
+
*
|
| 961 |
+
* If parsing failed, this will be an empty string.
|
| 962 |
+
*/
|
| 963 |
+
code: string;
|
| 964 |
+
/**
|
| 965 |
+
* The source map for the transformed code.
|
| 966 |
+
*
|
| 967 |
+
* This will be set if {@link TransformOptions#sourcemap} is `true`.
|
| 968 |
+
*/
|
| 969 |
+
map?: SourceMap;
|
| 970 |
+
deps: Array<string>;
|
| 971 |
+
dynamicDeps: Array<string>;
|
| 972 |
+
/**
|
| 973 |
+
* Parse and transformation errors.
|
| 974 |
+
*
|
| 975 |
+
* Oxc's parser recovers from common syntax errors, meaning that
|
| 976 |
+
* transformed code may still be available even if there are errors in this
|
| 977 |
+
* list.
|
| 978 |
+
*/
|
| 979 |
+
errors: Array<OxcError>;
|
| 980 |
+
}
|
| 981 |
+
interface PluginsOptions {
|
| 982 |
+
styledComponents?: StyledComponentsOptions;
|
| 983 |
+
taggedTemplateEscape?: boolean;
|
| 984 |
+
}
|
| 985 |
+
/** Dynamic gating for {@link ReactCompilerOptions#dynamicGating}. */
|
| 986 |
+
interface ReactCompilerDynamicGating {
|
| 987 |
+
/** Module the gating import comes from. */
|
| 988 |
+
source: string;
|
| 989 |
+
}
|
| 990 |
+
/** Static gating for {@link ReactCompilerOptions#gating}. */
|
| 991 |
+
interface ReactCompilerGating {
|
| 992 |
+
/** Module the gating import comes from. */
|
| 993 |
+
source: string;
|
| 994 |
+
/** Imported specifier used as the gate. */
|
| 995 |
+
importSpecifierName: string;
|
| 996 |
+
}
|
| 997 |
+
/**
|
| 998 |
+
* Options for the experimental [React Compiler](https://github.com/facebook/react/pull/36173).
|
| 999 |
+
*
|
| 1000 |
+
* Mirrors the compiler's `PluginOptions`. The deep `environment` configuration
|
| 1001 |
+
* (inference / validation flags) is not surfaced here.
|
| 1002 |
+
*
|
| 1003 |
+
* @see {@link TransformOptions#reactCompiler}
|
| 1004 |
+
*/
|
| 1005 |
+
interface ReactCompilerOptions {
|
| 1006 |
+
/**
|
| 1007 |
+
* Which functions to compile.
|
| 1008 |
+
*
|
| 1009 |
+
* @default 'infer'
|
| 1010 |
+
*/
|
| 1011 |
+
compilationMode?: 'infer' | 'syntax' | 'annotation' | 'all';
|
| 1012 |
+
/**
|
| 1013 |
+
* What to do when a function cannot be compiled.
|
| 1014 |
+
*
|
| 1015 |
+
* @default 'none'
|
| 1016 |
+
*/
|
| 1017 |
+
panicThreshold?: 'none' | 'critical_errors' | 'all_errors';
|
| 1018 |
+
/**
|
| 1019 |
+
* React runtime version target. `17` and `18` require the
|
| 1020 |
+
* `react-compiler-runtime` package; `19` ships the runtime in `react`.
|
| 1021 |
+
*
|
| 1022 |
+
* @default '19'
|
| 1023 |
+
*/
|
| 1024 |
+
target?: '17' | '18' | '19';
|
| 1025 |
+
/**
|
| 1026 |
+
* Analyze and report diagnostics only; emit no transformed code.
|
| 1027 |
+
*
|
| 1028 |
+
* @default false
|
| 1029 |
+
*/
|
| 1030 |
+
noEmit?: boolean;
|
| 1031 |
+
/**
|
| 1032 |
+
* Compiler output mode.
|
| 1033 |
+
*
|
| 1034 |
+
* @default undefined
|
| 1035 |
+
*/
|
| 1036 |
+
outputMode?: 'client' | 'ssr' | 'lint';
|
| 1037 |
+
/**
|
| 1038 |
+
* Compile even functions marked with the `"use no memo"` / `"use no forget"`
|
| 1039 |
+
* opt-out directives.
|
| 1040 |
+
*
|
| 1041 |
+
* @default false
|
| 1042 |
+
*/
|
| 1043 |
+
ignoreUseNoForget?: boolean;
|
| 1044 |
+
/**
|
| 1045 |
+
* Treat Flow suppression comments as opt-outs.
|
| 1046 |
+
*
|
| 1047 |
+
* @default true
|
| 1048 |
+
*/
|
| 1049 |
+
flowSuppressions?: boolean;
|
| 1050 |
+
/**
|
| 1051 |
+
* Enable `react-native-reanimated` support.
|
| 1052 |
+
*
|
| 1053 |
+
* @default false
|
| 1054 |
+
*/
|
| 1055 |
+
enableReanimated?: boolean;
|
| 1056 |
+
/**
|
| 1057 |
+
* Development mode (extra validation / instrumentation).
|
| 1058 |
+
*
|
| 1059 |
+
* @default false
|
| 1060 |
+
*/
|
| 1061 |
+
isDev?: boolean;
|
| 1062 |
+
/** Source file name, used for the fast-refresh hash and in diagnostics. */
|
| 1063 |
+
filename?: string;
|
| 1064 |
+
/** ESLint rules whose suppressions opt a function out of compilation. */
|
| 1065 |
+
eslintSuppressionRules?: Array<string>;
|
| 1066 |
+
/** Extra directives that opt a function out of compilation. */
|
| 1067 |
+
customOptOutDirectives?: Array<string>;
|
| 1068 |
+
/** Also emit a gated (feature-flagged) version of each compiled function. */
|
| 1069 |
+
gating?: ReactCompilerGating;
|
| 1070 |
+
/** Dynamically-gated compilation. */
|
| 1071 |
+
dynamicGating?: ReactCompilerDynamicGating;
|
| 1072 |
+
}
|
| 1073 |
+
interface ReactRefreshOptions {
|
| 1074 |
+
/**
|
| 1075 |
+
* Specify the identifier of the refresh registration variable.
|
| 1076 |
+
*
|
| 1077 |
+
* @default `$RefreshReg$`.
|
| 1078 |
+
*/
|
| 1079 |
+
refreshReg?: string;
|
| 1080 |
+
/**
|
| 1081 |
+
* Specify the identifier of the refresh signature variable.
|
| 1082 |
+
*
|
| 1083 |
+
* @default `$RefreshSig$`.
|
| 1084 |
+
*/
|
| 1085 |
+
refreshSig?: string;
|
| 1086 |
+
emitFullSignatures?: boolean;
|
| 1087 |
+
}
|
| 1088 |
+
/**
|
| 1089 |
+
* Configure how styled-components are transformed.
|
| 1090 |
+
*
|
| 1091 |
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins#styled-components}
|
| 1092 |
+
*/
|
| 1093 |
+
interface StyledComponentsOptions {
|
| 1094 |
+
/**
|
| 1095 |
+
* Enhances the attached CSS class name on each component with richer output to help
|
| 1096 |
+
* identify your components in the DOM without React DevTools.
|
| 1097 |
+
*
|
| 1098 |
+
* @default true
|
| 1099 |
+
*/
|
| 1100 |
+
displayName?: boolean;
|
| 1101 |
+
/**
|
| 1102 |
+
* Controls whether the `displayName` of a component will be prefixed with the filename
|
| 1103 |
+
* to make the component name as unique as possible.
|
| 1104 |
+
*
|
| 1105 |
+
* @default true
|
| 1106 |
+
*/
|
| 1107 |
+
fileName?: boolean;
|
| 1108 |
+
/**
|
| 1109 |
+
* Adds a unique identifier to every styled component to avoid checksum mismatches
|
| 1110 |
+
* due to different class generation on the client and server during server-side rendering.
|
| 1111 |
+
*
|
| 1112 |
+
* @default true
|
| 1113 |
+
*/
|
| 1114 |
+
ssr?: boolean;
|
| 1115 |
+
/**
|
| 1116 |
+
* Transpiles styled-components tagged template literals to a smaller representation
|
| 1117 |
+
* than what Babel normally creates, helping to reduce bundle size.
|
| 1118 |
+
*
|
| 1119 |
+
* @default true
|
| 1120 |
+
*/
|
| 1121 |
+
transpileTemplateLiterals?: boolean;
|
| 1122 |
+
/**
|
| 1123 |
+
* Minifies CSS content by removing all whitespace and comments from your CSS,
|
| 1124 |
+
* keeping valuable bytes out of your bundles.
|
| 1125 |
+
*
|
| 1126 |
+
* @default true
|
| 1127 |
+
*/
|
| 1128 |
+
minify?: boolean;
|
| 1129 |
+
/**
|
| 1130 |
+
* Enables transformation of JSX `css` prop when using styled-components.
|
| 1131 |
+
*
|
| 1132 |
+
* **Note: This feature is not yet implemented in oxc.**
|
| 1133 |
+
*
|
| 1134 |
+
* @default true
|
| 1135 |
+
*/
|
| 1136 |
+
cssProp?: boolean;
|
| 1137 |
+
/**
|
| 1138 |
+
* Enables "pure annotation" to aid dead code elimination by bundlers.
|
| 1139 |
+
*
|
| 1140 |
+
* @default false
|
| 1141 |
+
*/
|
| 1142 |
+
pure?: boolean;
|
| 1143 |
+
/**
|
| 1144 |
+
* Adds a namespace prefix to component identifiers to ensure class names are unique.
|
| 1145 |
+
*
|
| 1146 |
+
* Example: With `namespace: "my-app"`, generates `componentId: "my-app__sc-3rfj0a-1"`
|
| 1147 |
+
*/
|
| 1148 |
+
namespace?: string;
|
| 1149 |
+
/**
|
| 1150 |
+
* List of file names that are considered meaningless for component naming purposes.
|
| 1151 |
+
*
|
| 1152 |
+
* When the `fileName` option is enabled and a component is in a file with a name
|
| 1153 |
+
* from this list, the directory name will be used instead of the file name for
|
| 1154 |
+
* the component's display name.
|
| 1155 |
+
*
|
| 1156 |
+
* @default `["index"]`
|
| 1157 |
+
*/
|
| 1158 |
+
meaninglessFileNames?: Array<string>;
|
| 1159 |
+
/**
|
| 1160 |
+
* Import paths to be considered as styled-components imports at the top level.
|
| 1161 |
+
*
|
| 1162 |
+
* **Note: This feature is not yet implemented in oxc.**
|
| 1163 |
+
*/
|
| 1164 |
+
topLevelImportPaths?: Array<string>;
|
| 1165 |
+
}
|
| 1166 |
+
/**
|
| 1167 |
+
* Options for transforming a JavaScript or TypeScript file.
|
| 1168 |
+
*
|
| 1169 |
+
* @see {@link transform}
|
| 1170 |
+
*/
|
| 1171 |
+
interface TransformOptions {
|
| 1172 |
+
/** Treat the source text as `js`, `jsx`, `ts`, `tsx`, or `dts`. */
|
| 1173 |
+
lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts';
|
| 1174 |
+
/** Treat the source text as `script` or `module` code. */
|
| 1175 |
+
sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined;
|
| 1176 |
+
/**
|
| 1177 |
+
* The current working directory. Used to resolve relative paths in other
|
| 1178 |
+
* options.
|
| 1179 |
+
*/
|
| 1180 |
+
cwd?: string;
|
| 1181 |
+
/**
|
| 1182 |
+
* Enable source map generation.
|
| 1183 |
+
*
|
| 1184 |
+
* When `true`, the `sourceMap` field of transform result objects will be populated.
|
| 1185 |
+
*
|
| 1186 |
+
* @default false
|
| 1187 |
+
*
|
| 1188 |
+
* @see {@link SourceMap}
|
| 1189 |
+
*/
|
| 1190 |
+
sourcemap?: boolean;
|
| 1191 |
+
/** Set assumptions in order to produce smaller output. */
|
| 1192 |
+
assumptions?: CompilerAssumptions;
|
| 1193 |
+
/**
|
| 1194 |
+
* Configure how TypeScript is transformed.
|
| 1195 |
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript}
|
| 1196 |
+
*/
|
| 1197 |
+
typescript?: TypeScriptOptions;
|
| 1198 |
+
/**
|
| 1199 |
+
* Configure how TSX and JSX are transformed.
|
| 1200 |
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
|
| 1201 |
+
*/
|
| 1202 |
+
jsx?: 'preserve' | JsxOptions;
|
| 1203 |
+
/**
|
| 1204 |
+
* Sets the target environment for the generated JavaScript.
|
| 1205 |
+
*
|
| 1206 |
+
* The lowest target is `es2015`.
|
| 1207 |
+
*
|
| 1208 |
+
* Example:
|
| 1209 |
+
*
|
| 1210 |
+
* * `'es2015'`
|
| 1211 |
+
* * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']`
|
| 1212 |
+
*
|
| 1213 |
+
* @default `esnext` (No transformation)
|
| 1214 |
+
*
|
| 1215 |
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/lowering#target}
|
| 1216 |
+
*/
|
| 1217 |
+
target?: string | Array<string>;
|
| 1218 |
+
/** Behaviour for runtime helpers. */
|
| 1219 |
+
helpers?: Helpers;
|
| 1220 |
+
/**
|
| 1221 |
+
* Define Plugin
|
| 1222 |
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define}
|
| 1223 |
+
*/
|
| 1224 |
+
define?: Record<string, string>;
|
| 1225 |
+
/**
|
| 1226 |
+
* Inject Plugin
|
| 1227 |
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject}
|
| 1228 |
+
*/
|
| 1229 |
+
inject?: Record<string, string | [string, string]>;
|
| 1230 |
+
/** Decorator plugin */
|
| 1231 |
+
decorator?: DecoratorOptions;
|
| 1232 |
+
/**
|
| 1233 |
+
* Enable the experimental [React Compiler](https://github.com/facebook/react/pull/36173).
|
| 1234 |
+
*
|
| 1235 |
+
* `true` enables it with default options; an object enables it with the
|
| 1236 |
+
* given options; `false` or omitted disables it. When enabled, the compiler
|
| 1237 |
+
* runs as the first transform and memoizes React components and hooks.
|
| 1238 |
+
*/
|
| 1239 |
+
reactCompiler?: boolean | ReactCompilerOptions;
|
| 1240 |
+
/**
|
| 1241 |
+
* Third-party plugins to use.
|
| 1242 |
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
|
| 1243 |
+
*/
|
| 1244 |
+
plugins?: PluginsOptions;
|
| 1245 |
+
}
|
| 1246 |
+
interface TypeScriptOptions {
|
| 1247 |
+
jsxPragma?: string;
|
| 1248 |
+
jsxPragmaFrag?: string;
|
| 1249 |
+
onlyRemoveTypeImports?: boolean;
|
| 1250 |
+
allowNamespaces?: boolean;
|
| 1251 |
+
/**
|
| 1252 |
+
* When enabled, type-only class fields are only removed if they are prefixed with the declare modifier:
|
| 1253 |
+
*
|
| 1254 |
+
* @deprecated
|
| 1255 |
+
*
|
| 1256 |
+
* Allowing `declare` fields is built-in support in Oxc without any option. If you want to remove class fields
|
| 1257 |
+
* without initializer, you can use `remove_class_fields_without_initializer: true` instead.
|
| 1258 |
+
*/
|
| 1259 |
+
allowDeclareFields?: boolean;
|
| 1260 |
+
/**
|
| 1261 |
+
* When enabled, class fields without initializers are removed.
|
| 1262 |
+
*
|
| 1263 |
+
* For example:
|
| 1264 |
+
* ```ts
|
| 1265 |
+
* class Foo {
|
| 1266 |
+
* x: number;
|
| 1267 |
+
* y: number = 0;
|
| 1268 |
+
* }
|
| 1269 |
+
* ```
|
| 1270 |
+
* // transform into
|
| 1271 |
+
* ```js
|
| 1272 |
+
* class Foo {
|
| 1273 |
+
* x: number;
|
| 1274 |
+
* }
|
| 1275 |
+
* ```
|
| 1276 |
+
*
|
| 1277 |
+
* The option is used to align with the behavior of TypeScript's `useDefineForClassFields: false` option.
|
| 1278 |
+
* When you want to enable this, you also need to set [`crate::CompilerAssumptions::set_public_class_fields`]
|
| 1279 |
+
* to `true`. The `set_public_class_fields: true` + `remove_class_fields_without_initializer: true` is
|
| 1280 |
+
* equivalent to `useDefineForClassFields: false` in TypeScript.
|
| 1281 |
+
*
|
| 1282 |
+
* When `set_public_class_fields` is true and class-properties plugin is enabled, the above example transforms into:
|
| 1283 |
+
*
|
| 1284 |
+
* ```js
|
| 1285 |
+
* class Foo {
|
| 1286 |
+
* constructor() {
|
| 1287 |
+
* this.y = 0;
|
| 1288 |
+
* }
|
| 1289 |
+
* }
|
| 1290 |
+
* ```
|
| 1291 |
+
*
|
| 1292 |
+
* Defaults to `false`.
|
| 1293 |
+
*/
|
| 1294 |
+
removeClassFieldsWithoutInitializer?: boolean;
|
| 1295 |
+
/**
|
| 1296 |
+
* When true, optimize const enums by inlining their values at usage sites
|
| 1297 |
+
* and removing the enum declaration.
|
| 1298 |
+
*
|
| 1299 |
+
* @default false
|
| 1300 |
+
*/
|
| 1301 |
+
optimizeConstEnums?: boolean;
|
| 1302 |
+
/**
|
| 1303 |
+
* When true, optimize regular (non-const) enums by inlining their member
|
| 1304 |
+
* accesses at usage sites when the member value is statically known.
|
| 1305 |
+
*
|
| 1306 |
+
* Non-exported enum declarations are also removed when all members are
|
| 1307 |
+
* evaluable and no references to the enum as a runtime value exist
|
| 1308 |
+
* (e.g., `console.log(Foo)`, `typeof Foo`, or passing the enum as an argument).
|
| 1309 |
+
*
|
| 1310 |
+
* @default false
|
| 1311 |
+
*/
|
| 1312 |
+
optimizeEnums?: boolean;
|
| 1313 |
+
/**
|
| 1314 |
+
* Also generate a `.d.ts` declaration file for TypeScript files.
|
| 1315 |
+
*
|
| 1316 |
+
* The source file must be compliant with all
|
| 1317 |
+
* [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations)
|
| 1318 |
+
* requirements.
|
| 1319 |
+
*
|
| 1320 |
+
* @default false
|
| 1321 |
+
*/
|
| 1322 |
+
declaration?: IsolatedDeclarationsOptions;
|
| 1323 |
+
/**
|
| 1324 |
+
* Rewrite or remove TypeScript import/export declaration extensions.
|
| 1325 |
+
*
|
| 1326 |
+
* - When set to `rewrite`, it will change `.ts`, `.mts`, `.cts` extensions to `.js`, `.mjs`, `.cjs` respectively.
|
| 1327 |
+
* - When set to `remove`, it will remove `.ts`/`.mts`/`.cts`/`.tsx` extension entirely.
|
| 1328 |
+
* - When set to `true`, it's equivalent to `rewrite`.
|
| 1329 |
+
* - When set to `false` or omitted, no changes will be made to the extensions.
|
| 1330 |
+
*
|
| 1331 |
+
* @default false
|
| 1332 |
+
*/
|
| 1333 |
+
rewriteImportExtensions?: 'rewrite' | 'remove' | boolean;
|
| 1334 |
+
}
|
| 1335 |
+
/** A decoded source map with mappings as an array of arrays instead of VLQ-encoded string. */
|
| 1336 |
+
declare class BindingDecodedMap {
|
| 1337 |
+
/** The source map version (always 3). */
|
| 1338 |
+
get version(): number;
|
| 1339 |
+
/** The generated file name. */
|
| 1340 |
+
get file(): string | null;
|
| 1341 |
+
/** The list of original source files. */
|
| 1342 |
+
get sources(): Array<string>;
|
| 1343 |
+
/** The original source contents (if `includeContent` was true). */
|
| 1344 |
+
get sourcesContent(): Array<string | undefined | null>;
|
| 1345 |
+
/** The list of symbol names used in mappings. */
|
| 1346 |
+
get names(): Array<string>;
|
| 1347 |
+
/**
|
| 1348 |
+
* The decoded mappings as an array of line arrays.
|
| 1349 |
+
* Each line is an array of segments, where each segment is [generatedColumn, sourceIndex, originalLine, originalColumn, nameIndex?].
|
| 1350 |
+
*/
|
| 1351 |
+
get mappings(): Array<Array<Array<number>>>;
|
| 1352 |
+
/** The list of source indices that should be excluded from debugging. */
|
| 1353 |
+
get x_google_ignoreList(): Array<number> | null;
|
| 1354 |
+
}
|
| 1355 |
+
declare class BindingMagicString {
|
| 1356 |
+
constructor(source: string, options?: BindingMagicStringOptions | undefined | null);
|
| 1357 |
+
get original(): string;
|
| 1358 |
+
get filename(): string | null;
|
| 1359 |
+
get indentExclusionRanges(): Array<Array<number>> | Array<number> | null;
|
| 1360 |
+
get ignoreList(): boolean;
|
| 1361 |
+
get offset(): number;
|
| 1362 |
+
set offset(offset: number);
|
| 1363 |
+
replace(from: string, to: string): this;
|
| 1364 |
+
replaceAll(from: string, to: string): this;
|
| 1365 |
+
/**
|
| 1366 |
+
* Returns the UTF-16 offset past the last match, or -1 if no match was found.
|
| 1367 |
+
* The JS wrapper uses this to update `lastIndex` on the caller's RegExp.
|
| 1368 |
+
* Global/sticky behavior is derived from the regex's own flags.
|
| 1369 |
+
*/
|
| 1370 |
+
replaceRegex(from: RegExp, to: string): number;
|
| 1371 |
+
prepend(content: string): this;
|
| 1372 |
+
append(content: string): this;
|
| 1373 |
+
prependLeft(index: number, content: string): this;
|
| 1374 |
+
prependRight(index: number, content: string): this;
|
| 1375 |
+
appendLeft(index: number, content: string): this;
|
| 1376 |
+
appendRight(index: number, content: string): this;
|
| 1377 |
+
overwrite(start: number, end: number, content: string, options?: BindingOverwriteOptions | undefined | null): this;
|
| 1378 |
+
toString(): string;
|
| 1379 |
+
hasChanged(): boolean;
|
| 1380 |
+
length(): number;
|
| 1381 |
+
isEmpty(): boolean;
|
| 1382 |
+
remove(start: number, end: number): this;
|
| 1383 |
+
update(start: number, end: number, content: string, options?: BindingUpdateOptions | undefined | null): this;
|
| 1384 |
+
relocate(start: number, end: number, to: number): this;
|
| 1385 |
+
/**
|
| 1386 |
+
* Alias for `relocate` to match the original magic-string API.
|
| 1387 |
+
* Moves the characters from `start` to `end` to `index`.
|
| 1388 |
+
* Returns `this` for method chaining.
|
| 1389 |
+
*/
|
| 1390 |
+
move(start: number, end: number, index: number): this;
|
| 1391 |
+
indent(indentor?: string | undefined | null, options?: BindingIndentOptions | undefined | null): this;
|
| 1392 |
+
/** Trims whitespace or specified characters from the start and end. */
|
| 1393 |
+
trim(charType?: string | undefined | null): this;
|
| 1394 |
+
/** Trims whitespace or specified characters from the start. */
|
| 1395 |
+
trimStart(charType?: string | undefined | null): this;
|
| 1396 |
+
/** Trims whitespace or specified characters from the end. */
|
| 1397 |
+
trimEnd(charType?: string | undefined | null): this;
|
| 1398 |
+
/** Trims newlines from the start and end. */
|
| 1399 |
+
trimLines(): this;
|
| 1400 |
+
/**
|
| 1401 |
+
* Deprecated method that throws an error directing users to use prependRight or appendLeft.
|
| 1402 |
+
* This matches the original magic-string API which deprecated this method.
|
| 1403 |
+
*/
|
| 1404 |
+
insert(index: number, content: string): void;
|
| 1405 |
+
/** Returns a clone of the MagicString instance. */
|
| 1406 |
+
clone(): BindingMagicString;
|
| 1407 |
+
/** Returns the last character of the generated string, or an empty string if empty. */
|
| 1408 |
+
lastChar(): string;
|
| 1409 |
+
/** Returns the content after the last newline in the generated string. */
|
| 1410 |
+
lastLine(): string;
|
| 1411 |
+
/** Returns the guessed indentation string, or `\t` if none is found. */
|
| 1412 |
+
getIndentString(): string;
|
| 1413 |
+
/** Returns a clone with content outside the specified range removed. */
|
| 1414 |
+
snip(start: number, end: number): BindingMagicString;
|
| 1415 |
+
/**
|
| 1416 |
+
* Resets the portion of the string from `start` to `end` to its original content.
|
| 1417 |
+
* This undoes any modifications made to that range.
|
| 1418 |
+
* Supports negative indices (counting from the end).
|
| 1419 |
+
*/
|
| 1420 |
+
reset(start: number, end: number): this;
|
| 1421 |
+
/**
|
| 1422 |
+
* Returns the content between the specified UTF-16 code unit positions (JS string indices).
|
| 1423 |
+
* Supports negative indices (counting from the end).
|
| 1424 |
+
*
|
| 1425 |
+
* When an index falls in the middle of a surrogate pair, the lone surrogate is
|
| 1426 |
+
* included in the result (matching the original magic-string / JS behavior).
|
| 1427 |
+
* This is done by returning a UTF-16 encoded JS string via `napi_create_string_utf16`.
|
| 1428 |
+
*/
|
| 1429 |
+
slice(start?: number | undefined | null, end?: number | undefined | null): string;
|
| 1430 |
+
/**
|
| 1431 |
+
* Generates a source map for the transformations applied to this MagicString.
|
| 1432 |
+
* Returns a BindingSourceMap object with version, file, sources, sourcesContent, names, mappings.
|
| 1433 |
+
*/
|
| 1434 |
+
generateMap(options?: BindingSourceMapOptions | undefined | null): BindingSourceMap;
|
| 1435 |
+
/**
|
| 1436 |
+
* Generates a decoded source map for the transformations applied to this MagicString.
|
| 1437 |
+
* Returns a BindingDecodedMap object with mappings as an array of arrays.
|
| 1438 |
+
*/
|
| 1439 |
+
generateDecodedMap(options?: BindingSourceMapOptions | undefined | null): BindingDecodedMap;
|
| 1440 |
+
}
|
| 1441 |
+
declare class BindingNormalizedOptions {
|
| 1442 |
+
get input(): Array<string> | Record<string, string>;
|
| 1443 |
+
get cwd(): string;
|
| 1444 |
+
get platform(): 'node' | 'browser' | 'neutral';
|
| 1445 |
+
get shimMissingExports(): boolean;
|
| 1446 |
+
get name(): string | null;
|
| 1447 |
+
get entryFilenames(): string | undefined;
|
| 1448 |
+
get chunkFilenames(): string | undefined;
|
| 1449 |
+
get assetFilenames(): string | undefined;
|
| 1450 |
+
get dir(): string | null;
|
| 1451 |
+
get file(): string | null;
|
| 1452 |
+
get format(): 'es' | 'cjs' | 'iife' | 'umd';
|
| 1453 |
+
get exports(): 'default' | 'named' | 'none' | 'auto';
|
| 1454 |
+
get esModule(): boolean | 'if-default-prop';
|
| 1455 |
+
get codeSplitting(): boolean;
|
| 1456 |
+
get dynamicImportInCjs(): boolean;
|
| 1457 |
+
get sourcemap(): boolean | 'inline' | 'hidden';
|
| 1458 |
+
get sourcemapBaseUrl(): string | null;
|
| 1459 |
+
get banner(): string | undefined | null | undefined;
|
| 1460 |
+
get footer(): string | undefined | null | undefined;
|
| 1461 |
+
get intro(): string | undefined | null | undefined;
|
| 1462 |
+
get outro(): string | undefined | null | undefined;
|
| 1463 |
+
get postBanner(): string | undefined | null | undefined;
|
| 1464 |
+
get postFooter(): string | undefined | null | undefined;
|
| 1465 |
+
get externalLiveBindings(): boolean;
|
| 1466 |
+
get extend(): boolean;
|
| 1467 |
+
get globals(): Record<string, string> | undefined;
|
| 1468 |
+
get hashCharacters(): 'base64' | 'base36' | 'hex';
|
| 1469 |
+
get sourcemapDebugIds(): boolean;
|
| 1470 |
+
get sourcemapExcludeSources(): boolean;
|
| 1471 |
+
get polyfillRequire(): boolean;
|
| 1472 |
+
get minify(): false | 'dce-only' | MinifyOptions;
|
| 1473 |
+
get legalComments(): 'none' | 'inline';
|
| 1474 |
+
get comments(): BindingCommentsOptions;
|
| 1475 |
+
get preserveModules(): boolean;
|
| 1476 |
+
get preserveModulesRoot(): string | undefined;
|
| 1477 |
+
get virtualDirname(): string;
|
| 1478 |
+
get topLevelVar(): boolean;
|
| 1479 |
+
get minifyInternalExports(): boolean;
|
| 1480 |
+
get context(): string;
|
| 1481 |
+
}
|
| 1482 |
+
declare class BindingRenderedChunk {
|
| 1483 |
+
get name(): string;
|
| 1484 |
+
get isEntry(): boolean;
|
| 1485 |
+
get isDynamicEntry(): boolean;
|
| 1486 |
+
get facadeModuleId(): string | null;
|
| 1487 |
+
get moduleIds(): Array<string>;
|
| 1488 |
+
get exports(): Array<string>;
|
| 1489 |
+
get fileName(): string;
|
| 1490 |
+
get modules(): BindingModules;
|
| 1491 |
+
get imports(): Array<string>;
|
| 1492 |
+
get dynamicImports(): Array<string>;
|
| 1493 |
+
}
|
| 1494 |
+
declare class BindingRenderedModule {
|
| 1495 |
+
get code(): string | null;
|
| 1496 |
+
get renderedExports(): Array<string>;
|
| 1497 |
+
}
|
| 1498 |
+
/** A source map object with properties matching the SourceMap V3 specification. */
|
| 1499 |
+
declare class BindingSourceMap {
|
| 1500 |
+
/** The source map version (always 3). */
|
| 1501 |
+
get version(): number;
|
| 1502 |
+
/** The generated file name. */
|
| 1503 |
+
get file(): string | null;
|
| 1504 |
+
/** The list of original source files. */
|
| 1505 |
+
get sources(): Array<string>;
|
| 1506 |
+
/** The original source contents (if `includeContent` was true). */
|
| 1507 |
+
get sourcesContent(): Array<string | undefined | null>;
|
| 1508 |
+
/** The list of symbol names used in mappings. */
|
| 1509 |
+
get names(): Array<string>;
|
| 1510 |
+
/** The VLQ-encoded mappings string. */
|
| 1511 |
+
get mappings(): string;
|
| 1512 |
+
/** The list of source indices that should be excluded from debugging. */
|
| 1513 |
+
get x_google_ignoreList(): Array<number> | null;
|
| 1514 |
+
/** Returns the source map as a JSON string. */
|
| 1515 |
+
toString(): string;
|
| 1516 |
+
/** Returns the source map as a base64-encoded data URL. */
|
| 1517 |
+
toUrl(): string;
|
| 1518 |
+
}
|
| 1519 |
+
/**
|
| 1520 |
+
* Minimal wrapper around a `BundleHandle` for watcher events.
|
| 1521 |
+
* This is returned from watcher event data to allow calling `result.close()`.
|
| 1522 |
+
*/
|
| 1523 |
+
declare class BindingWatcherBundler {
|
| 1524 |
+
close(): Promise<void>;
|
| 1525 |
+
}
|
| 1526 |
+
declare class TsconfigCache {
|
| 1527 |
+
/** Create a new transform cache with auto tsconfig discovery enabled. */
|
| 1528 |
+
constructor(yarnPnp: boolean);
|
| 1529 |
+
/**
|
| 1530 |
+
* Clear the cache.
|
| 1531 |
+
*
|
| 1532 |
+
* Call this when tsconfig files have changed to ensure fresh resolution.
|
| 1533 |
+
*/
|
| 1534 |
+
clear(): void;
|
| 1535 |
+
/** Get the number of cached entries. */
|
| 1536 |
+
size(): number;
|
| 1537 |
+
}
|
| 1538 |
+
type BindingBuiltinPluginName = 'builtin:bundle-analyzer' | 'builtin:esm-external-require' | 'builtin:isolated-declaration' | 'builtin:replace' | 'builtin:vite-alias' | 'builtin:vite-build-import-analysis' | 'builtin:vite-dynamic-import-vars' | 'builtin:vite-import-glob' | 'builtin:vite-json' | 'builtin:vite-load-fallback' | 'builtin:vite-manifest' | 'builtin:vite-module-preload-polyfill' | 'builtin:vite-react-refresh-wrapper' | 'builtin:vite-reporter' | 'builtin:vite-resolve' | 'builtin:vite-transform' | 'builtin:vite-wasm-fallback' | 'builtin:vite-web-worker-post' | 'builtin:oxc-runtime';
|
| 1539 |
+
interface BindingBundleAnalyzerPluginConfig {
|
| 1540 |
+
/** Output filename for the bundle analysis data (default: "analyze-data.json") */
|
| 1541 |
+
fileName?: string;
|
| 1542 |
+
/** Output format: "json" (default) or "md" for LLM-friendly markdown */
|
| 1543 |
+
format?: 'json' | 'md';
|
| 1544 |
+
}
|
| 1545 |
+
interface BindingBundleState {
|
| 1546 |
+
lastFullBuildFailed: boolean;
|
| 1547 |
+
hasStaleOutput: boolean;
|
| 1548 |
+
}
|
| 1549 |
+
interface BindingClientHmrUpdate {
|
| 1550 |
+
clientId: string;
|
| 1551 |
+
update: BindingHmrUpdate;
|
| 1552 |
+
}
|
| 1553 |
+
interface BindingCommentsOptions {
|
| 1554 |
+
legal?: boolean;
|
| 1555 |
+
annotation?: boolean;
|
| 1556 |
+
jsdoc?: boolean;
|
| 1557 |
+
}
|
| 1558 |
+
interface BindingCompilerOptions {
|
| 1559 |
+
baseUrl?: string;
|
| 1560 |
+
paths?: Record<string, Array<string>>;
|
| 1561 |
+
experimentalDecorators?: boolean;
|
| 1562 |
+
emitDecoratorMetadata?: boolean;
|
| 1563 |
+
useDefineForClassFields?: boolean;
|
| 1564 |
+
rewriteRelativeImportExtensions?: boolean;
|
| 1565 |
+
jsx?: string;
|
| 1566 |
+
jsxFactory?: string;
|
| 1567 |
+
jsxFragmentFactory?: string;
|
| 1568 |
+
jsxImportSource?: string;
|
| 1569 |
+
verbatimModuleSyntax?: boolean;
|
| 1570 |
+
preserveValueImports?: boolean;
|
| 1571 |
+
importsNotUsedAsValues?: string;
|
| 1572 |
+
target?: string;
|
| 1573 |
+
module?: string;
|
| 1574 |
+
allowJs?: boolean;
|
| 1575 |
+
rootDirs?: Array<string>;
|
| 1576 |
+
}
|
| 1577 |
+
/** Enhanced transform options with tsconfig and inputMap support. */
|
| 1578 |
+
interface BindingEnhancedTransformOptions {
|
| 1579 |
+
/** Treat the source text as 'js', 'jsx', 'ts', 'tsx', or 'dts'. */
|
| 1580 |
+
lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts';
|
| 1581 |
+
/** Treat the source text as 'script', 'module', 'commonjs', or 'unambiguous'. */
|
| 1582 |
+
sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined;
|
| 1583 |
+
/**
|
| 1584 |
+
* The current working directory. Used to resolve relative paths in other
|
| 1585 |
+
* options.
|
| 1586 |
+
*/
|
| 1587 |
+
cwd?: string;
|
| 1588 |
+
/**
|
| 1589 |
+
* Enable source map generation.
|
| 1590 |
+
*
|
| 1591 |
+
* When `true`, the `sourceMap` field of transform result objects will be populated.
|
| 1592 |
+
*
|
| 1593 |
+
* @default false
|
| 1594 |
+
*/
|
| 1595 |
+
sourcemap?: boolean;
|
| 1596 |
+
/** Set assumptions in order to produce smaller output. */
|
| 1597 |
+
assumptions?: CompilerAssumptions;
|
| 1598 |
+
/**
|
| 1599 |
+
* Configure how TypeScript is transformed.
|
| 1600 |
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript}
|
| 1601 |
+
*/
|
| 1602 |
+
typescript?: TypeScriptOptions;
|
| 1603 |
+
/**
|
| 1604 |
+
* Configure how TSX and JSX are transformed.
|
| 1605 |
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
|
| 1606 |
+
*/
|
| 1607 |
+
jsx?: 'preserve' | JsxOptions;
|
| 1608 |
+
/**
|
| 1609 |
+
* Sets the target environment for the generated JavaScript.
|
| 1610 |
+
*
|
| 1611 |
+
* The lowest target is `es2015`.
|
| 1612 |
+
*
|
| 1613 |
+
* Example:
|
| 1614 |
+
*
|
| 1615 |
+
* * `'es2015'`
|
| 1616 |
+
* * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']`
|
| 1617 |
+
*
|
| 1618 |
+
* @default `esnext` (No transformation)
|
| 1619 |
+
*
|
| 1620 |
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/lowering#target}
|
| 1621 |
+
*/
|
| 1622 |
+
target?: string | Array<string>;
|
| 1623 |
+
/** Behaviour for runtime helpers. */
|
| 1624 |
+
helpers?: Helpers;
|
| 1625 |
+
/**
|
| 1626 |
+
* Define Plugin
|
| 1627 |
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define}
|
| 1628 |
+
*/
|
| 1629 |
+
define?: Record<string, string>;
|
| 1630 |
+
/**
|
| 1631 |
+
* Inject Plugin
|
| 1632 |
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject}
|
| 1633 |
+
*/
|
| 1634 |
+
inject?: Record<string, string | [string, string]>;
|
| 1635 |
+
/** Decorator plugin */
|
| 1636 |
+
decorator?: DecoratorOptions;
|
| 1637 |
+
/**
|
| 1638 |
+
* Third-party plugins to use.
|
| 1639 |
+
* @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
|
| 1640 |
+
*/
|
| 1641 |
+
plugins?: PluginsOptions;
|
| 1642 |
+
/**
|
| 1643 |
+
* Configure tsconfig handling.
|
| 1644 |
+
* - true: Auto-discover and load the nearest tsconfig.json
|
| 1645 |
+
* - TsconfigRawOptions: Use the provided inline tsconfig options
|
| 1646 |
+
*/
|
| 1647 |
+
tsconfig?: boolean | BindingTsconfigRawOptions;
|
| 1648 |
+
/** An input source map to collapse with the output source map. */
|
| 1649 |
+
inputMap?: SourceMap;
|
| 1650 |
+
}
|
| 1651 |
+
/** Result of the enhanced transform API. */
|
| 1652 |
+
interface BindingEnhancedTransformResult {
|
| 1653 |
+
/**
|
| 1654 |
+
* The transformed code.
|
| 1655 |
+
*
|
| 1656 |
+
* If parsing failed, this will be an empty string.
|
| 1657 |
+
*/
|
| 1658 |
+
code: string;
|
| 1659 |
+
/**
|
| 1660 |
+
* The source map for the transformed code.
|
| 1661 |
+
*
|
| 1662 |
+
* This will be set if {@link BindingEnhancedTransformOptions#sourcemap} is `true`.
|
| 1663 |
+
*/
|
| 1664 |
+
map?: SourceMap;
|
| 1665 |
+
/**
|
| 1666 |
+
* The `.d.ts` declaration file for the transformed code. Declarations are
|
| 1667 |
+
* only generated if `declaration` is set to `true` and a TypeScript file
|
| 1668 |
+
* is provided.
|
| 1669 |
+
*
|
| 1670 |
+
* If parsing failed and `declaration` is set, this will be an empty string.
|
| 1671 |
+
*
|
| 1672 |
+
* @see {@link TypeScriptOptions#declaration}
|
| 1673 |
+
* @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
|
| 1674 |
+
*/
|
| 1675 |
+
declaration?: string;
|
| 1676 |
+
/**
|
| 1677 |
+
* Declaration source map. Only generated if both
|
| 1678 |
+
* {@link TypeScriptOptions#declaration declaration} and
|
| 1679 |
+
* {@link BindingEnhancedTransformOptions#sourcemap sourcemap} are set to `true`.
|
| 1680 |
+
*/
|
| 1681 |
+
declarationMap?: SourceMap;
|
| 1682 |
+
/**
|
| 1683 |
+
* Helpers used.
|
| 1684 |
+
*
|
| 1685 |
+
* @internal
|
| 1686 |
+
*
|
| 1687 |
+
* Example:
|
| 1688 |
+
*
|
| 1689 |
+
* ```text
|
| 1690 |
+
* { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" }
|
| 1691 |
+
* ```
|
| 1692 |
+
*/
|
| 1693 |
+
helpersUsed: Record<string, string>;
|
| 1694 |
+
/** Parse and transformation errors. */
|
| 1695 |
+
errors: Array<BindingError>;
|
| 1696 |
+
/** Parse and transformation warnings. */
|
| 1697 |
+
warnings: Array<BindingError>;
|
| 1698 |
+
/** Paths to tsconfig files that were loaded during transformation. */
|
| 1699 |
+
tsconfigFilePaths: Array<string>;
|
| 1700 |
+
}
|
| 1701 |
+
type BindingError = {
|
| 1702 |
+
type: 'JsError';
|
| 1703 |
+
field0: Error;
|
| 1704 |
+
} | {
|
| 1705 |
+
type: 'NativeError';
|
| 1706 |
+
field0: NativeError;
|
| 1707 |
+
};
|
| 1708 |
+
interface BindingEsmExternalRequirePluginConfig {
|
| 1709 |
+
external: Array<BindingStringOrRegex>;
|
| 1710 |
+
skipDuplicateCheck?: boolean;
|
| 1711 |
+
}
|
| 1712 |
+
interface BindingHmrBoundaryOutput {
|
| 1713 |
+
boundary: string;
|
| 1714 |
+
acceptedVia: string;
|
| 1715 |
+
}
|
| 1716 |
+
type BindingHmrUpdate = {
|
| 1717 |
+
type: 'Patch';
|
| 1718 |
+
code: string;
|
| 1719 |
+
filename: string;
|
| 1720 |
+
sourcemap?: string;
|
| 1721 |
+
sourcemapFilename?: string;
|
| 1722 |
+
hmrBoundaries: Array<BindingHmrBoundaryOutput>;
|
| 1723 |
+
} | {
|
| 1724 |
+
type: 'FullReload';
|
| 1725 |
+
reason?: string;
|
| 1726 |
+
} | {
|
| 1727 |
+
type: 'Noop';
|
| 1728 |
+
};
|
| 1729 |
+
interface BindingHookResolveIdExtraArgs {
|
| 1730 |
+
custom?: number;
|
| 1731 |
+
isEntry: boolean;
|
| 1732 |
+
/**
|
| 1733 |
+
* - `import-statement`: `import { foo } from './lib.js';`
|
| 1734 |
+
* - `dynamic-import`: `import('./lib.js')`
|
| 1735 |
+
* - `require-call`: `require('./lib.js')`
|
| 1736 |
+
* - `import-rule`: `@import 'bg-color.css'`
|
| 1737 |
+
* - `url-token`: `url('./icon.png')`
|
| 1738 |
+
* - `new-url`: `new URL('./worker.js', import.meta.url)`
|
| 1739 |
+
* - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})`
|
| 1740 |
+
*/
|
| 1741 |
+
kind: 'import-statement' | 'dynamic-import' | 'require-call' | 'import-rule' | 'url-token' | 'new-url' | 'hot-accept';
|
| 1742 |
+
}
|
| 1743 |
+
interface BindingIndentOptions {
|
| 1744 |
+
exclude?: Array<Array<number>> | Array<number>;
|
| 1745 |
+
}
|
| 1746 |
+
interface BindingIsolatedDeclarationPluginConfig {
|
| 1747 |
+
stripInternal?: boolean;
|
| 1748 |
+
}
|
| 1749 |
+
interface BindingLogLocation {
|
| 1750 |
+
/** 1-based */
|
| 1751 |
+
line: number;
|
| 1752 |
+
/** 0-based position in the line in UTF-16 code units */
|
| 1753 |
+
column: number;
|
| 1754 |
+
file?: string;
|
| 1755 |
+
}
|
| 1756 |
+
interface BindingMagicStringOptions {
|
| 1757 |
+
filename?: string;
|
| 1758 |
+
offset?: number;
|
| 1759 |
+
indentExclusionRanges?: Array<Array<number>> | Array<number>;
|
| 1760 |
+
ignoreList?: boolean;
|
| 1761 |
+
}
|
| 1762 |
+
interface BindingModulePreloadOptions {
|
| 1763 |
+
polyfill: boolean;
|
| 1764 |
+
resolveDependencies?: (filename: string, deps: string[], context: {
|
| 1765 |
+
hostId: string;
|
| 1766 |
+
hostType: 'html' | 'js';
|
| 1767 |
+
}) => string[];
|
| 1768 |
+
}
|
| 1769 |
+
interface BindingModules {
|
| 1770 |
+
values: Array<BindingRenderedModule>;
|
| 1771 |
+
keys: Array<string>;
|
| 1772 |
+
}
|
| 1773 |
+
interface BindingOverwriteOptions {
|
| 1774 |
+
contentOnly?: boolean;
|
| 1775 |
+
}
|
| 1776 |
+
interface BindingPluginContextResolveOptions {
|
| 1777 |
+
/**
|
| 1778 |
+
* - `import-statement`: `import { foo } from './lib.js';`
|
| 1779 |
+
* - `dynamic-import`: `import('./lib.js')`
|
| 1780 |
+
* - `require-call`: `require('./lib.js')`
|
| 1781 |
+
* - `import-rule`: `@import 'bg-color.css'`
|
| 1782 |
+
* - `url-token`: `url('./icon.png')`
|
| 1783 |
+
* - `new-url`: `new URL('./worker.js', import.meta.url)`
|
| 1784 |
+
* - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})`
|
| 1785 |
+
*/
|
| 1786 |
+
importKind?: 'import-statement' | 'dynamic-import' | 'require-call' | 'import-rule' | 'url-token' | 'new-url' | 'hot-accept';
|
| 1787 |
+
isEntry?: boolean;
|
| 1788 |
+
skipSelf?: boolean;
|
| 1789 |
+
custom?: number;
|
| 1790 |
+
vitePluginCustom?: BindingVitePluginCustom;
|
| 1791 |
+
}
|
| 1792 |
+
declare enum BindingRebuildStrategy {
|
| 1793 |
+
Always = 0,
|
| 1794 |
+
Auto = 1,
|
| 1795 |
+
Never = 2
|
| 1796 |
+
}
|
| 1797 |
+
interface BindingRenderBuiltUrlConfig {
|
| 1798 |
+
ssr: boolean;
|
| 1799 |
+
type: 'asset' | 'public';
|
| 1800 |
+
hostId: string;
|
| 1801 |
+
hostType: 'js' | 'css' | 'html';
|
| 1802 |
+
}
|
| 1803 |
+
interface BindingRenderBuiltUrlRet {
|
| 1804 |
+
relative?: boolean;
|
| 1805 |
+
runtime?: string;
|
| 1806 |
+
}
|
| 1807 |
+
interface BindingReplacePluginConfig {
|
| 1808 |
+
values: Record<string, string>;
|
| 1809 |
+
delimiters?: [string, string];
|
| 1810 |
+
preventAssignment?: boolean;
|
| 1811 |
+
objectGuards?: boolean;
|
| 1812 |
+
sourcemap?: boolean;
|
| 1813 |
+
}
|
| 1814 |
+
interface BindingSourceMapOptions {
|
| 1815 |
+
/** The filename for the generated file (goes into `map.file`) */
|
| 1816 |
+
file?: string;
|
| 1817 |
+
/** The filename of the original source (goes into `map.sources`) */
|
| 1818 |
+
source?: string;
|
| 1819 |
+
includeContent?: boolean;
|
| 1820 |
+
/**
|
| 1821 |
+
* Accepts boolean or string: true, false, "boundary"
|
| 1822 |
+
* - true: high-resolution sourcemaps (character-level)
|
| 1823 |
+
* - false: low-resolution sourcemaps (line-level) - default
|
| 1824 |
+
* - "boundary": high-resolution only at word boundaries
|
| 1825 |
+
*/
|
| 1826 |
+
hires?: boolean | string;
|
| 1827 |
+
}
|
| 1828 |
+
interface BindingTransformHookExtraArgs {
|
| 1829 |
+
moduleType: string;
|
| 1830 |
+
}
|
| 1831 |
+
interface BindingTsconfig {
|
| 1832 |
+
files?: Array<string>;
|
| 1833 |
+
include?: Array<string>;
|
| 1834 |
+
exclude?: Array<string>;
|
| 1835 |
+
compilerOptions: BindingCompilerOptions;
|
| 1836 |
+
}
|
| 1837 |
+
/**
|
| 1838 |
+
* TypeScript compiler options for inline tsconfig configuration.
|
| 1839 |
+
*
|
| 1840 |
+
* @category Utilities
|
| 1841 |
+
*/
|
| 1842 |
+
interface BindingTsconfigCompilerOptions {
|
| 1843 |
+
/** Specifies the JSX factory function to use. */
|
| 1844 |
+
jsx?: 'react' | 'react-jsx' | 'react-jsxdev' | 'preserve' | 'react-native';
|
| 1845 |
+
/** Specifies the JSX factory function. */
|
| 1846 |
+
jsxFactory?: string;
|
| 1847 |
+
/** Specifies the JSX fragment factory function. */
|
| 1848 |
+
jsxFragmentFactory?: string;
|
| 1849 |
+
/** Specifies the module specifier for JSX imports. */
|
| 1850 |
+
jsxImportSource?: string;
|
| 1851 |
+
/** Enables experimental decorators. */
|
| 1852 |
+
experimentalDecorators?: boolean;
|
| 1853 |
+
/** Enables decorator metadata emission. */
|
| 1854 |
+
emitDecoratorMetadata?: boolean;
|
| 1855 |
+
/** Preserves module structure of imports/exports. */
|
| 1856 |
+
verbatimModuleSyntax?: boolean;
|
| 1857 |
+
/** Configures how class fields are emitted. */
|
| 1858 |
+
useDefineForClassFields?: boolean;
|
| 1859 |
+
/** The ECMAScript target version. */
|
| 1860 |
+
target?: string;
|
| 1861 |
+
/** @deprecated Use verbatimModuleSyntax instead. */
|
| 1862 |
+
preserveValueImports?: boolean;
|
| 1863 |
+
/** @deprecated Use verbatimModuleSyntax instead. */
|
| 1864 |
+
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error';
|
| 1865 |
+
}
|
| 1866 |
+
/**
|
| 1867 |
+
* Raw tsconfig options for inline configuration.
|
| 1868 |
+
*
|
| 1869 |
+
* @category Utilities
|
| 1870 |
+
*/
|
| 1871 |
+
interface BindingTsconfigRawOptions {
|
| 1872 |
+
/** TypeScript compiler options. */
|
| 1873 |
+
compilerOptions?: BindingTsconfigCompilerOptions;
|
| 1874 |
+
}
|
| 1875 |
+
interface BindingTsconfigResult {
|
| 1876 |
+
tsconfig: BindingTsconfig;
|
| 1877 |
+
tsconfigFilePaths: Array<string>;
|
| 1878 |
+
}
|
| 1879 |
+
interface BindingUpdateOptions {
|
| 1880 |
+
overwrite?: boolean;
|
| 1881 |
+
}
|
| 1882 |
+
interface BindingViteBuildImportAnalysisPluginConfig {
|
| 1883 |
+
preloadCode: string;
|
| 1884 |
+
insertPreload: boolean;
|
| 1885 |
+
optimizeModulePreloadRelativePaths: boolean;
|
| 1886 |
+
renderBuiltUrl: boolean;
|
| 1887 |
+
isRelativeBase: boolean;
|
| 1888 |
+
v2?: BindingViteBuildImportAnalysisPluginV2Config;
|
| 1889 |
+
}
|
| 1890 |
+
interface BindingViteBuildImportAnalysisPluginV2Config {
|
| 1891 |
+
isSsr: boolean;
|
| 1892 |
+
urlBase: string;
|
| 1893 |
+
decodedBase: string;
|
| 1894 |
+
modulePreload: false | BindingModulePreloadOptions;
|
| 1895 |
+
renderBuiltUrl?: (filename: string, type: BindingRenderBuiltUrlConfig) => undefined | string | BindingRenderBuiltUrlRet;
|
| 1896 |
+
}
|
| 1897 |
+
interface BindingViteDynamicImportVarsPluginConfig {
|
| 1898 |
+
sourcemap?: boolean;
|
| 1899 |
+
include?: Array<BindingStringOrRegex>;
|
| 1900 |
+
exclude?: Array<BindingStringOrRegex>;
|
| 1901 |
+
resolver?: (id: string, importer: string) => MaybePromise<string | undefined>;
|
| 1902 |
+
}
|
| 1903 |
+
interface BindingViteImportGlobPluginConfig {
|
| 1904 |
+
root?: string;
|
| 1905 |
+
sourcemap?: boolean;
|
| 1906 |
+
restoreQueryExtension?: boolean;
|
| 1907 |
+
}
|
| 1908 |
+
interface BindingViteJsonPluginConfig {
|
| 1909 |
+
minify?: boolean;
|
| 1910 |
+
namedExports?: boolean;
|
| 1911 |
+
stringify?: BindingViteJsonPluginStringify;
|
| 1912 |
+
}
|
| 1913 |
+
type BindingViteJsonPluginStringify = boolean | string;
|
| 1914 |
+
interface BindingViteManifestPluginConfig {
|
| 1915 |
+
root: string;
|
| 1916 |
+
outPath: string;
|
| 1917 |
+
isEnableV2?: boolean;
|
| 1918 |
+
isLegacy?: (args: BindingNormalizedOptions) => boolean;
|
| 1919 |
+
cssEntries: () => Record<string, string>;
|
| 1920 |
+
}
|
| 1921 |
+
interface BindingViteModulePreloadPolyfillPluginConfig {
|
| 1922 |
+
isServer?: boolean;
|
| 1923 |
+
}
|
| 1924 |
+
interface BindingVitePluginCustom {
|
| 1925 |
+
'vite:import-glob'?: ViteImportGlobMeta;
|
| 1926 |
+
}
|
| 1927 |
+
interface BindingViteReactRefreshWrapperPluginConfig {
|
| 1928 |
+
cwd: string;
|
| 1929 |
+
include?: Array<BindingStringOrRegex>;
|
| 1930 |
+
exclude?: Array<BindingStringOrRegex>;
|
| 1931 |
+
jsxImportSource: string;
|
| 1932 |
+
reactRefreshHost: string;
|
| 1933 |
+
}
|
| 1934 |
+
interface BindingViteReporterPluginConfig {
|
| 1935 |
+
root: string;
|
| 1936 |
+
isTty: boolean;
|
| 1937 |
+
isLib: boolean;
|
| 1938 |
+
assetsDir: string;
|
| 1939 |
+
chunkLimit: number;
|
| 1940 |
+
warnLargeChunks: boolean;
|
| 1941 |
+
reportCompressedSize: boolean;
|
| 1942 |
+
logInfo?: (msg: string) => void;
|
| 1943 |
+
}
|
| 1944 |
+
interface BindingViteResolvePluginConfig {
|
| 1945 |
+
resolveOptions: BindingViteResolvePluginResolveOptions;
|
| 1946 |
+
environmentConsumer: string;
|
| 1947 |
+
environmentName: string;
|
| 1948 |
+
builtins: Array<BindingStringOrRegex>;
|
| 1949 |
+
external: true | string[];
|
| 1950 |
+
noExternal: true | Array<string | RegExp>;
|
| 1951 |
+
dedupe: Array<string>;
|
| 1952 |
+
disableCache?: boolean;
|
| 1953 |
+
legacyInconsistentCjsInterop?: boolean;
|
| 1954 |
+
finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>;
|
| 1955 |
+
finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>;
|
| 1956 |
+
resolveSubpathImports: (id: string, importer: string, isRequire: boolean, scan: boolean) => VoidNullable<string>;
|
| 1957 |
+
onWarn?: (message: string) => void;
|
| 1958 |
+
onDebug?: (message: string) => void;
|
| 1959 |
+
yarnPnp: boolean;
|
| 1960 |
+
}
|
| 1961 |
+
interface BindingViteResolvePluginResolveOptions {
|
| 1962 |
+
isBuild: boolean;
|
| 1963 |
+
isProduction: boolean;
|
| 1964 |
+
asSrc: boolean;
|
| 1965 |
+
preferRelative: boolean;
|
| 1966 |
+
isRequire?: boolean;
|
| 1967 |
+
root: string;
|
| 1968 |
+
scan: boolean;
|
| 1969 |
+
mainFields: Array<string>;
|
| 1970 |
+
conditions: Array<string>;
|
| 1971 |
+
externalConditions: Array<string>;
|
| 1972 |
+
extensions: Array<string>;
|
| 1973 |
+
tryIndex: boolean;
|
| 1974 |
+
tryPrefix?: string;
|
| 1975 |
+
preserveSymlinks: boolean;
|
| 1976 |
+
tsconfigPaths: boolean;
|
| 1977 |
+
}
|
| 1978 |
+
interface BindingViteTransformPluginConfig {
|
| 1979 |
+
root: string;
|
| 1980 |
+
include?: Array<BindingStringOrRegex>;
|
| 1981 |
+
exclude?: Array<BindingStringOrRegex>;
|
| 1982 |
+
jsxRefreshInclude?: Array<BindingStringOrRegex>;
|
| 1983 |
+
jsxRefreshExclude?: Array<BindingStringOrRegex>;
|
| 1984 |
+
isServerConsumer?: boolean;
|
| 1985 |
+
jsxInject?: string;
|
| 1986 |
+
transformOptions?: TransformOptions;
|
| 1987 |
+
yarnPnp?: boolean;
|
| 1988 |
+
}
|
| 1989 |
+
interface ExternalMemoryStatus {
|
| 1990 |
+
freed: boolean;
|
| 1991 |
+
reason?: string;
|
| 1992 |
+
}
|
| 1993 |
+
/** Error emitted from native side, it only contains kind and message, no stack trace. */
|
| 1994 |
+
interface NativeError {
|
| 1995 |
+
kind: string;
|
| 1996 |
+
message: string;
|
| 1997 |
+
/** The id of the file associated with the error */
|
| 1998 |
+
id?: string;
|
| 1999 |
+
/** The exporter associated with the error (for import/export errors) */
|
| 2000 |
+
exporter?: string;
|
| 2001 |
+
/** Location information (line, column, file) */
|
| 2002 |
+
loc?: BindingLogLocation;
|
| 2003 |
+
/** Position in the source file in UTF-16 code units */
|
| 2004 |
+
pos?: number;
|
| 2005 |
+
}
|
| 2006 |
+
interface PreRenderedChunk {
|
| 2007 |
+
/** The name of this chunk, which is used in naming patterns. */
|
| 2008 |
+
name: string;
|
| 2009 |
+
/** Whether this chunk is a static entry point. */
|
| 2010 |
+
isEntry: boolean;
|
| 2011 |
+
/** Whether this chunk is a dynamic entry point. */
|
| 2012 |
+
isDynamicEntry: boolean;
|
| 2013 |
+
/** The id of a module that this chunk corresponds to. */
|
| 2014 |
+
facadeModuleId?: string;
|
| 2015 |
+
/** The list of ids of modules included in this chunk. */
|
| 2016 |
+
moduleIds: Array<string>;
|
| 2017 |
+
/** Exported variable names from this chunk. */
|
| 2018 |
+
exports: Array<string>;
|
| 2019 |
+
}
|
| 2020 |
+
interface ViteImportGlobMeta {
|
| 2021 |
+
isSubImportsPattern?: boolean;
|
| 2022 |
+
}
|
| 2023 |
+
//#endregion
|
| 2024 |
+
export { ExternalMemoryStatus as A, ResolveResult as B, BindingViteManifestPluginConfig as C, BindingViteResolvePluginConfig as D, BindingViteReporterPluginConfig as E, MinifyResult as F, isolatedDeclaration as G, SourceMap as H, NapiResolveOptions as I, isolatedDeclarationSync as K, ParseResult as L, IsolatedDeclarationsResult as M, JsxOptions as N, BindingViteTransformPluginConfig as O, MinifyOptions as P, ParserOptions as R, BindingViteJsonPluginConfig as S, BindingViteReactRefreshWrapperPluginConfig as T, TransformOptions as U, ResolverFactory as V, TsconfigCache as W, BindingTsconfigRawOptions as _, BindingEnhancedTransformOptions as a, BindingViteDynamicImportVarsPluginConfig as b, BindingHookResolveIdExtraArgs as c, BindingPluginContextResolveOptions as d, BindingRebuildStrategy as f, BindingTsconfigCompilerOptions as g, BindingTransformHookExtraArgs as h, BindingClientHmrUpdate as i, IsolatedDeclarationsOptions as j, BindingWatcherBundler as k, BindingIsolatedDeclarationPluginConfig as l, BindingReplacePluginConfig as m, BindingBundleAnalyzerPluginConfig as n, BindingEnhancedTransformResult as o, BindingRenderedChunk as p, moduleRunnerTransform as q, BindingBundleState as r, BindingEsmExternalRequirePluginConfig as s, BindingBuiltinPluginName as t, BindingMagicString as u, BindingTsconfigResult as v, BindingViteModulePreloadPolyfillPluginConfig as w, BindingViteImportGlobPluginConfig as x, BindingViteBuildImportAnalysisPluginConfig as y, PreRenderedChunk as z };
|
shared/node_modules/rolldown/dist/shared/bindingify-input-options-B7_WBoOp.mjs
ADDED
|
@@ -0,0 +1,2241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { n as __toESM, t as require_binding } from "./binding-CfwqjDbP.mjs";
|
| 2 |
+
import { a as logInvalidLogPosition, c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-aMKUxRpj.mjs";
|
| 3 |
+
import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-DGbe3BlX.mjs";
|
| 4 |
+
import { a as unreachable, o as unsupported, r as noop, t as arraify } from "./misc-CoQm4NHO.mjs";
|
| 5 |
+
import { a as bindingifySourcemap, i as unwrapBindingResult, t as aggregateBindingErrorsIntoJsError } from "./error-C0TrL0_H.mjs";
|
| 6 |
+
import { parseAst } from "../parse-ast-index.mjs";
|
| 7 |
+
import path from "node:path";
|
| 8 |
+
import * as filter from "@rolldown/pluginutils";
|
| 9 |
+
import fsp from "node:fs/promises";
|
| 10 |
+
//#region package.json
|
| 11 |
+
var version = "1.1.1";
|
| 12 |
+
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
| 13 |
+
//#endregion
|
| 14 |
+
//#region src/constants/version.ts
|
| 15 |
+
/**
|
| 16 |
+
* The version of Rolldown.
|
| 17 |
+
* @example `'1.0.0'`
|
| 18 |
+
*
|
| 19 |
+
* @category Plugin APIs
|
| 20 |
+
*/
|
| 21 |
+
const VERSION = version;
|
| 22 |
+
//#endregion
|
| 23 |
+
//#region src/constants/index.ts
|
| 24 |
+
/**
|
| 25 |
+
* Runtime helper module ID
|
| 26 |
+
*/
|
| 27 |
+
const RUNTIME_MODULE_ID = "\0rolldown/runtime.js";
|
| 28 |
+
//#endregion
|
| 29 |
+
//#region src/log/logging.ts
|
| 30 |
+
const LOG_LEVEL_SILENT = "silent";
|
| 31 |
+
const LOG_LEVEL_ERROR = "error";
|
| 32 |
+
const LOG_LEVEL_WARN = "warn";
|
| 33 |
+
const LOG_LEVEL_INFO = "info";
|
| 34 |
+
const LOG_LEVEL_DEBUG = "debug";
|
| 35 |
+
const logLevelPriority = {
|
| 36 |
+
[LOG_LEVEL_DEBUG]: 0,
|
| 37 |
+
[LOG_LEVEL_INFO]: 1,
|
| 38 |
+
[LOG_LEVEL_WARN]: 2,
|
| 39 |
+
[LOG_LEVEL_SILENT]: 3
|
| 40 |
+
};
|
| 41 |
+
//#endregion
|
| 42 |
+
//#region src/log/log-handler.ts
|
| 43 |
+
const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
| 44 |
+
function getLogHandler(level, code, logger, pluginName, logLevel) {
|
| 45 |
+
if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
|
| 46 |
+
return (log, pos) => {
|
| 47 |
+
if (pos != null) logger(LOG_LEVEL_WARN, logInvalidLogPosition(pluginName));
|
| 48 |
+
log = normalizeLog(log);
|
| 49 |
+
if (log.code && !log.pluginCode) log.pluginCode = log.code;
|
| 50 |
+
log.code = code;
|
| 51 |
+
log.plugin = pluginName;
|
| 52 |
+
logger(level, log);
|
| 53 |
+
};
|
| 54 |
+
}
|
| 55 |
+
//#endregion
|
| 56 |
+
//#region src/utils/normalize-hook.ts
|
| 57 |
+
function normalizeHook(hook) {
|
| 58 |
+
if (typeof hook === "function" || typeof hook === "string") return {
|
| 59 |
+
handler: hook,
|
| 60 |
+
options: {},
|
| 61 |
+
meta: {}
|
| 62 |
+
};
|
| 63 |
+
if (typeof hook === "object" && hook !== null) {
|
| 64 |
+
const { handler, order, ...options } = hook;
|
| 65 |
+
return {
|
| 66 |
+
handler,
|
| 67 |
+
options,
|
| 68 |
+
meta: { order }
|
| 69 |
+
};
|
| 70 |
+
}
|
| 71 |
+
unreachable("Invalid hook type");
|
| 72 |
+
}
|
| 73 |
+
//#endregion
|
| 74 |
+
//#region src/plugin/minimal-plugin-context.ts
|
| 75 |
+
var MinimalPluginContextImpl = class {
|
| 76 |
+
pluginName;
|
| 77 |
+
hookName;
|
| 78 |
+
info;
|
| 79 |
+
warn;
|
| 80 |
+
debug;
|
| 81 |
+
meta;
|
| 82 |
+
constructor(onLog, logLevel, pluginName, watchMode, hookName) {
|
| 83 |
+
this.pluginName = pluginName;
|
| 84 |
+
this.hookName = hookName;
|
| 85 |
+
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
| 86 |
+
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
| 87 |
+
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
| 88 |
+
this.meta = {
|
| 89 |
+
rollupVersion: "4.23.0",
|
| 90 |
+
rolldownVersion: VERSION,
|
| 91 |
+
watchMode
|
| 92 |
+
};
|
| 93 |
+
}
|
| 94 |
+
error(e) {
|
| 95 |
+
return error(logPluginError(normalizeLog(e), this.pluginName, { hook: this.hookName }));
|
| 96 |
+
}
|
| 97 |
+
};
|
| 98 |
+
//#endregion
|
| 99 |
+
//#region src/types/plain-object-like.ts
|
| 100 |
+
const LAZY_FIELDS_KEY = Symbol("__lazy_fields__");
|
| 101 |
+
/**
|
| 102 |
+
* Base class for classes that use `@lazyProp` decorated properties.
|
| 103 |
+
*
|
| 104 |
+
* **Design Pattern in Rolldown:**
|
| 105 |
+
* This is a common pattern in Rolldown due to its three-layer architecture:
|
| 106 |
+
* TypeScript API → NAPI Bindings → Rust Core
|
| 107 |
+
*
|
| 108 |
+
* **Why we use getters:**
|
| 109 |
+
* For performance - to lazily fetch data from Rust bindings only when needed,
|
| 110 |
+
* rather than eagerly fetching all data during object construction.
|
| 111 |
+
*
|
| 112 |
+
* **The problem:**
|
| 113 |
+
* Getters defined on class prototypes are non-enumerable by default, which breaks:
|
| 114 |
+
* - Object spread operators ({...obj})
|
| 115 |
+
* - Object.keys() and similar methods
|
| 116 |
+
* - Standard JavaScript object semantics
|
| 117 |
+
*
|
| 118 |
+
* **The solution:**
|
| 119 |
+
* This base class automatically converts `@lazyProp` decorated getters into
|
| 120 |
+
* own enumerable getters on each instance during construction.
|
| 121 |
+
*
|
| 122 |
+
* **Result:**
|
| 123 |
+
* Objects get both lazy-loading performance benefits AND plain JavaScript object behavior.
|
| 124 |
+
*
|
| 125 |
+
* @example
|
| 126 |
+
* ```typescript
|
| 127 |
+
* class MyClass extends PlainObjectLike {
|
| 128 |
+
* @lazyProp
|
| 129 |
+
* get myProp() {
|
| 130 |
+
* return fetchFromRustBinding();
|
| 131 |
+
* }
|
| 132 |
+
* }
|
| 133 |
+
* ```
|
| 134 |
+
*/
|
| 135 |
+
var PlainObjectLike = class {
|
| 136 |
+
constructor() {
|
| 137 |
+
setupLazyProperties(this);
|
| 138 |
+
}
|
| 139 |
+
};
|
| 140 |
+
/**
|
| 141 |
+
* Set up lazy properties as own getters on an instance.
|
| 142 |
+
* This is called automatically by the `PlainObjectLike` base class constructor.
|
| 143 |
+
*
|
| 144 |
+
* @param instance - The instance to set up lazy properties on
|
| 145 |
+
* @internal
|
| 146 |
+
*/
|
| 147 |
+
function setupLazyProperties(instance) {
|
| 148 |
+
const lazyFields = instance.constructor[LAZY_FIELDS_KEY];
|
| 149 |
+
if (!lazyFields) return;
|
| 150 |
+
for (const [propertyKey, originalGetter] of lazyFields.entries()) {
|
| 151 |
+
let cachedValue;
|
| 152 |
+
let hasValue = false;
|
| 153 |
+
Object.defineProperty(instance, propertyKey, {
|
| 154 |
+
get() {
|
| 155 |
+
if (!hasValue) {
|
| 156 |
+
cachedValue = originalGetter.call(this);
|
| 157 |
+
hasValue = true;
|
| 158 |
+
}
|
| 159 |
+
return cachedValue;
|
| 160 |
+
},
|
| 161 |
+
enumerable: true,
|
| 162 |
+
configurable: true
|
| 163 |
+
});
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
/**
|
| 167 |
+
* Get all lazy field names from a class instance.
|
| 168 |
+
*
|
| 169 |
+
* @param instance - Instance to inspect
|
| 170 |
+
* @returns Set of lazy property names
|
| 171 |
+
*/
|
| 172 |
+
function getLazyFields(instance) {
|
| 173 |
+
const lazyFields = instance.constructor[LAZY_FIELDS_KEY];
|
| 174 |
+
return lazyFields ? new Set(lazyFields.keys()) : /* @__PURE__ */ new Set();
|
| 175 |
+
}
|
| 176 |
+
//#endregion
|
| 177 |
+
//#region src/decorators/lazy.ts
|
| 178 |
+
/**
|
| 179 |
+
* Decorator that marks a getter as lazy-evaluated and cached.
|
| 180 |
+
*
|
| 181 |
+
* **What "lazy" means here:**
|
| 182 |
+
* 1. Data is lazily fetched from Rust bindings only when the property is accessed (not eagerly on construction)
|
| 183 |
+
* 2. Once fetched, the data is cached for subsequent accesses (performance optimization)
|
| 184 |
+
* 3. Despite being a getter, it behaves like a plain object property (enumerable, appears in Object.keys())
|
| 185 |
+
*
|
| 186 |
+
* **Important**: Properties decorated with `@lazyProp` are defined as own enumerable
|
| 187 |
+
* properties on each instance (not on the prototype). This ensures they:
|
| 188 |
+
* - Appear in Object.keys() and Object.getOwnPropertyNames()
|
| 189 |
+
* - Are included in object spreads ({...obj})
|
| 190 |
+
* - Are enumerable in for...in loops
|
| 191 |
+
*
|
| 192 |
+
* Classes using this decorator must extend `PlainObjectLike` base class.
|
| 193 |
+
*
|
| 194 |
+
* @example
|
| 195 |
+
* ```typescript
|
| 196 |
+
* class MyClass extends PlainObjectLike {
|
| 197 |
+
* @lazyProp
|
| 198 |
+
* get expensiveValue() {
|
| 199 |
+
* return someExpensiveComputation();
|
| 200 |
+
* }
|
| 201 |
+
* }
|
| 202 |
+
* ```
|
| 203 |
+
*/
|
| 204 |
+
function lazyProp(target, propertyKey, descriptor) {
|
| 205 |
+
if (!target.constructor[LAZY_FIELDS_KEY]) target.constructor[LAZY_FIELDS_KEY] = /* @__PURE__ */ new Map();
|
| 206 |
+
const originalGetter = descriptor.get;
|
| 207 |
+
target.constructor[LAZY_FIELDS_KEY].set(propertyKey, originalGetter);
|
| 208 |
+
return {
|
| 209 |
+
enumerable: false,
|
| 210 |
+
configurable: true
|
| 211 |
+
};
|
| 212 |
+
}
|
| 213 |
+
//#endregion
|
| 214 |
+
//#region src/utils/asset-source.ts
|
| 215 |
+
function transformAssetSource(bindingAssetSource) {
|
| 216 |
+
return bindingAssetSource.inner;
|
| 217 |
+
}
|
| 218 |
+
function bindingAssetSource(source) {
|
| 219 |
+
return { inner: source };
|
| 220 |
+
}
|
| 221 |
+
//#endregion
|
| 222 |
+
//#region \0@oxc-project+runtime@0.135.0/helpers/esm/decorate.js
|
| 223 |
+
function __decorate(decorators, target, key, desc) {
|
| 224 |
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
| 225 |
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
| 226 |
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
| 227 |
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
| 228 |
+
}
|
| 229 |
+
//#endregion
|
| 230 |
+
//#region src/types/output-asset-impl.ts
|
| 231 |
+
var OutputAssetImpl = class extends PlainObjectLike {
|
| 232 |
+
bindingAsset;
|
| 233 |
+
type = "asset";
|
| 234 |
+
constructor(bindingAsset) {
|
| 235 |
+
super();
|
| 236 |
+
this.bindingAsset = bindingAsset;
|
| 237 |
+
}
|
| 238 |
+
get fileName() {
|
| 239 |
+
return this.bindingAsset.getFileName();
|
| 240 |
+
}
|
| 241 |
+
get originalFileName() {
|
| 242 |
+
return this.bindingAsset.getOriginalFileName() || null;
|
| 243 |
+
}
|
| 244 |
+
get originalFileNames() {
|
| 245 |
+
return this.bindingAsset.getOriginalFileNames();
|
| 246 |
+
}
|
| 247 |
+
get name() {
|
| 248 |
+
return this.bindingAsset.getName() ?? void 0;
|
| 249 |
+
}
|
| 250 |
+
get names() {
|
| 251 |
+
return this.bindingAsset.getNames();
|
| 252 |
+
}
|
| 253 |
+
get source() {
|
| 254 |
+
return transformAssetSource(this.bindingAsset.getSource());
|
| 255 |
+
}
|
| 256 |
+
__rolldown_external_memory_handle__(keepDataAlive) {
|
| 257 |
+
if (keepDataAlive) this.#evaluateAllLazyFields();
|
| 258 |
+
return this.bindingAsset.dropInner();
|
| 259 |
+
}
|
| 260 |
+
#evaluateAllLazyFields() {
|
| 261 |
+
for (const field of getLazyFields(this)) this[field];
|
| 262 |
+
}
|
| 263 |
+
};
|
| 264 |
+
__decorate([lazyProp], OutputAssetImpl.prototype, "fileName", null);
|
| 265 |
+
__decorate([lazyProp], OutputAssetImpl.prototype, "originalFileName", null);
|
| 266 |
+
__decorate([lazyProp], OutputAssetImpl.prototype, "originalFileNames", null);
|
| 267 |
+
__decorate([lazyProp], OutputAssetImpl.prototype, "name", null);
|
| 268 |
+
__decorate([lazyProp], OutputAssetImpl.prototype, "names", null);
|
| 269 |
+
__decorate([lazyProp], OutputAssetImpl.prototype, "source", null);
|
| 270 |
+
//#endregion
|
| 271 |
+
//#region src/utils/transform-rendered-module.ts
|
| 272 |
+
function transformToRenderedModule(bindingRenderedModule) {
|
| 273 |
+
return {
|
| 274 |
+
get code() {
|
| 275 |
+
return bindingRenderedModule.code;
|
| 276 |
+
},
|
| 277 |
+
get renderedLength() {
|
| 278 |
+
return bindingRenderedModule.code?.length || 0;
|
| 279 |
+
},
|
| 280 |
+
get renderedExports() {
|
| 281 |
+
return bindingRenderedModule.renderedExports;
|
| 282 |
+
}
|
| 283 |
+
};
|
| 284 |
+
}
|
| 285 |
+
//#endregion
|
| 286 |
+
//#region src/utils/transform-rendered-chunk.ts
|
| 287 |
+
function transformRenderedChunk(chunk) {
|
| 288 |
+
let modules = null;
|
| 289 |
+
return {
|
| 290 |
+
type: "chunk",
|
| 291 |
+
get name() {
|
| 292 |
+
return chunk.name;
|
| 293 |
+
},
|
| 294 |
+
get isEntry() {
|
| 295 |
+
return chunk.isEntry;
|
| 296 |
+
},
|
| 297 |
+
get isDynamicEntry() {
|
| 298 |
+
return chunk.isDynamicEntry;
|
| 299 |
+
},
|
| 300 |
+
get facadeModuleId() {
|
| 301 |
+
return chunk.facadeModuleId;
|
| 302 |
+
},
|
| 303 |
+
get moduleIds() {
|
| 304 |
+
return chunk.moduleIds;
|
| 305 |
+
},
|
| 306 |
+
get exports() {
|
| 307 |
+
return chunk.exports;
|
| 308 |
+
},
|
| 309 |
+
get fileName() {
|
| 310 |
+
return chunk.fileName;
|
| 311 |
+
},
|
| 312 |
+
get imports() {
|
| 313 |
+
return chunk.imports;
|
| 314 |
+
},
|
| 315 |
+
get dynamicImports() {
|
| 316 |
+
return chunk.dynamicImports;
|
| 317 |
+
},
|
| 318 |
+
get modules() {
|
| 319 |
+
if (!modules) modules = transformChunkModules(chunk.modules);
|
| 320 |
+
return modules;
|
| 321 |
+
}
|
| 322 |
+
};
|
| 323 |
+
}
|
| 324 |
+
function transformChunkModules(modules) {
|
| 325 |
+
const result = {};
|
| 326 |
+
for (let i = 0; i < modules.values.length; i++) {
|
| 327 |
+
let key = modules.keys[i];
|
| 328 |
+
const mod = modules.values[i];
|
| 329 |
+
result[key] = transformToRenderedModule(mod);
|
| 330 |
+
}
|
| 331 |
+
return result;
|
| 332 |
+
}
|
| 333 |
+
//#endregion
|
| 334 |
+
//#region src/types/output-chunk-impl.ts
|
| 335 |
+
var OutputChunkImpl = class extends PlainObjectLike {
|
| 336 |
+
bindingChunk;
|
| 337 |
+
type = "chunk";
|
| 338 |
+
constructor(bindingChunk) {
|
| 339 |
+
super();
|
| 340 |
+
this.bindingChunk = bindingChunk;
|
| 341 |
+
}
|
| 342 |
+
get fileName() {
|
| 343 |
+
return this.bindingChunk.getFileName();
|
| 344 |
+
}
|
| 345 |
+
get name() {
|
| 346 |
+
return this.bindingChunk.getName();
|
| 347 |
+
}
|
| 348 |
+
get exports() {
|
| 349 |
+
return this.bindingChunk.getExports();
|
| 350 |
+
}
|
| 351 |
+
get isEntry() {
|
| 352 |
+
return this.bindingChunk.getIsEntry();
|
| 353 |
+
}
|
| 354 |
+
get facadeModuleId() {
|
| 355 |
+
return this.bindingChunk.getFacadeModuleId() || null;
|
| 356 |
+
}
|
| 357 |
+
get isDynamicEntry() {
|
| 358 |
+
return this.bindingChunk.getIsDynamicEntry();
|
| 359 |
+
}
|
| 360 |
+
get sourcemapFileName() {
|
| 361 |
+
return this.bindingChunk.getSourcemapFileName() || null;
|
| 362 |
+
}
|
| 363 |
+
get preliminaryFileName() {
|
| 364 |
+
return this.bindingChunk.getPreliminaryFileName();
|
| 365 |
+
}
|
| 366 |
+
get code() {
|
| 367 |
+
return this.bindingChunk.getCode();
|
| 368 |
+
}
|
| 369 |
+
get modules() {
|
| 370 |
+
return transformChunkModules(this.bindingChunk.getModules());
|
| 371 |
+
}
|
| 372 |
+
get imports() {
|
| 373 |
+
return this.bindingChunk.getImports();
|
| 374 |
+
}
|
| 375 |
+
get dynamicImports() {
|
| 376 |
+
return this.bindingChunk.getDynamicImports();
|
| 377 |
+
}
|
| 378 |
+
get moduleIds() {
|
| 379 |
+
return this.bindingChunk.getModuleIds();
|
| 380 |
+
}
|
| 381 |
+
get map() {
|
| 382 |
+
const mapString = this.bindingChunk.getMap();
|
| 383 |
+
return mapString ? transformToRollupSourceMap(mapString) : null;
|
| 384 |
+
}
|
| 385 |
+
__rolldown_external_memory_handle__(keepDataAlive) {
|
| 386 |
+
if (keepDataAlive) this.#evaluateAllLazyFields();
|
| 387 |
+
return this.bindingChunk.dropInner();
|
| 388 |
+
}
|
| 389 |
+
#evaluateAllLazyFields() {
|
| 390 |
+
for (const field of getLazyFields(this)) this[field];
|
| 391 |
+
}
|
| 392 |
+
};
|
| 393 |
+
__decorate([lazyProp], OutputChunkImpl.prototype, "fileName", null);
|
| 394 |
+
__decorate([lazyProp], OutputChunkImpl.prototype, "name", null);
|
| 395 |
+
__decorate([lazyProp], OutputChunkImpl.prototype, "exports", null);
|
| 396 |
+
__decorate([lazyProp], OutputChunkImpl.prototype, "isEntry", null);
|
| 397 |
+
__decorate([lazyProp], OutputChunkImpl.prototype, "facadeModuleId", null);
|
| 398 |
+
__decorate([lazyProp], OutputChunkImpl.prototype, "isDynamicEntry", null);
|
| 399 |
+
__decorate([lazyProp], OutputChunkImpl.prototype, "sourcemapFileName", null);
|
| 400 |
+
__decorate([lazyProp], OutputChunkImpl.prototype, "preliminaryFileName", null);
|
| 401 |
+
__decorate([lazyProp], OutputChunkImpl.prototype, "code", null);
|
| 402 |
+
__decorate([lazyProp], OutputChunkImpl.prototype, "modules", null);
|
| 403 |
+
__decorate([lazyProp], OutputChunkImpl.prototype, "imports", null);
|
| 404 |
+
__decorate([lazyProp], OutputChunkImpl.prototype, "dynamicImports", null);
|
| 405 |
+
__decorate([lazyProp], OutputChunkImpl.prototype, "moduleIds", null);
|
| 406 |
+
__decorate([lazyProp], OutputChunkImpl.prototype, "map", null);
|
| 407 |
+
//#endregion
|
| 408 |
+
//#region src/utils/transform-to-rollup-output.ts
|
| 409 |
+
function transformToRollupSourceMap(map) {
|
| 410 |
+
const obj = {
|
| 411 |
+
...JSON.parse(map),
|
| 412 |
+
toString() {
|
| 413 |
+
return JSON.stringify(obj);
|
| 414 |
+
},
|
| 415 |
+
toUrl() {
|
| 416 |
+
return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
|
| 417 |
+
}
|
| 418 |
+
};
|
| 419 |
+
return obj;
|
| 420 |
+
}
|
| 421 |
+
function transformToRollupOutputChunk(bindingChunk) {
|
| 422 |
+
return new OutputChunkImpl(bindingChunk);
|
| 423 |
+
}
|
| 424 |
+
function transformToMutableRollupOutputChunk(bindingChunk, changed) {
|
| 425 |
+
const chunk = {
|
| 426 |
+
type: "chunk",
|
| 427 |
+
get code() {
|
| 428 |
+
return bindingChunk.getCode();
|
| 429 |
+
},
|
| 430 |
+
fileName: bindingChunk.getFileName(),
|
| 431 |
+
name: bindingChunk.getName(),
|
| 432 |
+
get modules() {
|
| 433 |
+
return transformChunkModules(bindingChunk.getModules());
|
| 434 |
+
},
|
| 435 |
+
get imports() {
|
| 436 |
+
return bindingChunk.getImports();
|
| 437 |
+
},
|
| 438 |
+
get dynamicImports() {
|
| 439 |
+
return bindingChunk.getDynamicImports();
|
| 440 |
+
},
|
| 441 |
+
exports: bindingChunk.getExports(),
|
| 442 |
+
isEntry: bindingChunk.getIsEntry(),
|
| 443 |
+
facadeModuleId: bindingChunk.getFacadeModuleId() || null,
|
| 444 |
+
isDynamicEntry: bindingChunk.getIsDynamicEntry(),
|
| 445 |
+
get moduleIds() {
|
| 446 |
+
return bindingChunk.getModuleIds();
|
| 447 |
+
},
|
| 448 |
+
get map() {
|
| 449 |
+
const map = bindingChunk.getMap();
|
| 450 |
+
return map ? transformToRollupSourceMap(map) : null;
|
| 451 |
+
},
|
| 452 |
+
sourcemapFileName: bindingChunk.getSourcemapFileName() || null,
|
| 453 |
+
preliminaryFileName: bindingChunk.getPreliminaryFileName()
|
| 454 |
+
};
|
| 455 |
+
const cache = {};
|
| 456 |
+
return new Proxy(chunk, {
|
| 457 |
+
get(target, p) {
|
| 458 |
+
if (p in cache) return cache[p];
|
| 459 |
+
const value = target[p];
|
| 460 |
+
cache[p] = value;
|
| 461 |
+
return value;
|
| 462 |
+
},
|
| 463 |
+
set(_target, p, newValue) {
|
| 464 |
+
cache[p] = newValue;
|
| 465 |
+
changed.updated.add(bindingChunk.getFileName());
|
| 466 |
+
return true;
|
| 467 |
+
},
|
| 468 |
+
has(target, p) {
|
| 469 |
+
if (p in cache) return true;
|
| 470 |
+
return p in target;
|
| 471 |
+
}
|
| 472 |
+
});
|
| 473 |
+
}
|
| 474 |
+
function transformToRollupOutputAsset(bindingAsset) {
|
| 475 |
+
return new OutputAssetImpl(bindingAsset);
|
| 476 |
+
}
|
| 477 |
+
function transformToMutableRollupOutputAsset(bindingAsset, changed) {
|
| 478 |
+
const asset = {
|
| 479 |
+
type: "asset",
|
| 480 |
+
fileName: bindingAsset.getFileName(),
|
| 481 |
+
originalFileName: bindingAsset.getOriginalFileName() || null,
|
| 482 |
+
originalFileNames: bindingAsset.getOriginalFileNames(),
|
| 483 |
+
get source() {
|
| 484 |
+
return transformAssetSource(bindingAsset.getSource());
|
| 485 |
+
},
|
| 486 |
+
name: bindingAsset.getName() ?? void 0,
|
| 487 |
+
names: bindingAsset.getNames()
|
| 488 |
+
};
|
| 489 |
+
const cache = {};
|
| 490 |
+
return new Proxy(asset, {
|
| 491 |
+
get(target, p) {
|
| 492 |
+
if (p in cache) return cache[p];
|
| 493 |
+
const value = target[p];
|
| 494 |
+
cache[p] = value;
|
| 495 |
+
return value;
|
| 496 |
+
},
|
| 497 |
+
set(_target, p, newValue) {
|
| 498 |
+
cache[p] = newValue;
|
| 499 |
+
changed.updated.add(bindingAsset.getFileName());
|
| 500 |
+
return true;
|
| 501 |
+
}
|
| 502 |
+
});
|
| 503 |
+
}
|
| 504 |
+
function transformToRollupOutput(output) {
|
| 505 |
+
const { chunks, assets } = output;
|
| 506 |
+
return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk)), ...assets.map((asset) => transformToRollupOutputAsset(asset))] };
|
| 507 |
+
}
|
| 508 |
+
function transformToMutableRollupOutput(output, changed) {
|
| 509 |
+
const { chunks, assets } = output;
|
| 510 |
+
return { output: [...chunks.map((chunk) => transformToMutableRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToMutableRollupOutputAsset(asset, changed))] };
|
| 511 |
+
}
|
| 512 |
+
function transformToOutputBundle(context, output, changed) {
|
| 513 |
+
const bundle = Object.fromEntries(transformToMutableRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
|
| 514 |
+
return new Proxy(bundle, {
|
| 515 |
+
set(_target, _p, _newValue, _receiver) {
|
| 516 |
+
const originalStackTraceLimit = Error.stackTraceLimit;
|
| 517 |
+
Error.stackTraceLimit = 2;
|
| 518 |
+
const message = "This plugin assigns to bundle variable. This is discouraged by Rollup and is not supported by Rolldown. This will be ignored. https://rollupjs.org/plugin-development/#generatebundle:~:text=DANGER,this.emitFile.";
|
| 519 |
+
const stack = (/* @__PURE__ */ new Error(message)).stack ?? message;
|
| 520 |
+
Error.stackTraceLimit = originalStackTraceLimit;
|
| 521 |
+
context.warn({
|
| 522 |
+
message: stack,
|
| 523 |
+
code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
|
| 524 |
+
});
|
| 525 |
+
return true;
|
| 526 |
+
},
|
| 527 |
+
deleteProperty(target, property) {
|
| 528 |
+
if (typeof property === "string") changed.deleted.add(property);
|
| 529 |
+
return true;
|
| 530 |
+
}
|
| 531 |
+
});
|
| 532 |
+
}
|
| 533 |
+
function collectChangedBundle(changed, bundle) {
|
| 534 |
+
const changes = {};
|
| 535 |
+
for (const key in bundle) {
|
| 536 |
+
if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
|
| 537 |
+
const item = bundle[key];
|
| 538 |
+
if (item.type === "asset") changes[key] = {
|
| 539 |
+
filename: item.fileName,
|
| 540 |
+
originalFileNames: item.originalFileNames,
|
| 541 |
+
source: bindingAssetSource(item.source),
|
| 542 |
+
names: item.names
|
| 543 |
+
};
|
| 544 |
+
else changes[key] = {
|
| 545 |
+
code: item.code,
|
| 546 |
+
filename: item.fileName,
|
| 547 |
+
name: item.name,
|
| 548 |
+
isEntry: item.isEntry,
|
| 549 |
+
exports: item.exports,
|
| 550 |
+
modules: {},
|
| 551 |
+
imports: item.imports,
|
| 552 |
+
dynamicImports: item.dynamicImports,
|
| 553 |
+
facadeModuleId: item.facadeModuleId || void 0,
|
| 554 |
+
isDynamicEntry: item.isDynamicEntry,
|
| 555 |
+
moduleIds: item.moduleIds,
|
| 556 |
+
map: bindingifySourcemap(item.map),
|
| 557 |
+
sourcemapFilename: item.sourcemapFileName || void 0,
|
| 558 |
+
preliminaryFilename: item.preliminaryFileName
|
| 559 |
+
};
|
| 560 |
+
}
|
| 561 |
+
return {
|
| 562 |
+
changes,
|
| 563 |
+
deleted: changed.deleted
|
| 564 |
+
};
|
| 565 |
+
}
|
| 566 |
+
//#endregion
|
| 567 |
+
//#region src/binding-magic-string.ts
|
| 568 |
+
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
|
| 569 |
+
Object.defineProperty(import_binding.BindingMagicString.prototype, "isRolldownMagicString", {
|
| 570 |
+
value: true,
|
| 571 |
+
writable: false,
|
| 572 |
+
configurable: false
|
| 573 |
+
});
|
| 574 |
+
function assertString(content, msg) {
|
| 575 |
+
if (typeof content !== "string") throw new TypeError(msg);
|
| 576 |
+
}
|
| 577 |
+
const nativeAppend = import_binding.BindingMagicString.prototype.append;
|
| 578 |
+
const nativePrepend = import_binding.BindingMagicString.prototype.prepend;
|
| 579 |
+
const nativeAppendLeft = import_binding.BindingMagicString.prototype.appendLeft;
|
| 580 |
+
const nativeAppendRight = import_binding.BindingMagicString.prototype.appendRight;
|
| 581 |
+
const nativePrependLeft = import_binding.BindingMagicString.prototype.prependLeft;
|
| 582 |
+
const nativePrependRight = import_binding.BindingMagicString.prototype.prependRight;
|
| 583 |
+
const nativeOverwrite = import_binding.BindingMagicString.prototype.overwrite;
|
| 584 |
+
const nativeUpdate = import_binding.BindingMagicString.prototype.update;
|
| 585 |
+
import_binding.BindingMagicString.prototype.append = function(content) {
|
| 586 |
+
assertString(content, "outro content must be a string");
|
| 587 |
+
return nativeAppend.call(this, content);
|
| 588 |
+
};
|
| 589 |
+
import_binding.BindingMagicString.prototype.prepend = function(content) {
|
| 590 |
+
assertString(content, "outro content must be a string");
|
| 591 |
+
return nativePrepend.call(this, content);
|
| 592 |
+
};
|
| 593 |
+
import_binding.BindingMagicString.prototype.appendLeft = function(index, content) {
|
| 594 |
+
assertString(content, "inserted content must be a string");
|
| 595 |
+
return nativeAppendLeft.call(this, index, content);
|
| 596 |
+
};
|
| 597 |
+
import_binding.BindingMagicString.prototype.appendRight = function(index, content) {
|
| 598 |
+
assertString(content, "inserted content must be a string");
|
| 599 |
+
return nativeAppendRight.call(this, index, content);
|
| 600 |
+
};
|
| 601 |
+
import_binding.BindingMagicString.prototype.prependLeft = function(index, content) {
|
| 602 |
+
assertString(content, "inserted content must be a string");
|
| 603 |
+
return nativePrependLeft.call(this, index, content);
|
| 604 |
+
};
|
| 605 |
+
import_binding.BindingMagicString.prototype.prependRight = function(index, content) {
|
| 606 |
+
assertString(content, "inserted content must be a string");
|
| 607 |
+
return nativePrependRight.call(this, index, content);
|
| 608 |
+
};
|
| 609 |
+
import_binding.BindingMagicString.prototype.overwrite = function(start, end, content, options) {
|
| 610 |
+
assertString(content, "replacement content must be a string");
|
| 611 |
+
return nativeOverwrite.call(this, start, end, content, options);
|
| 612 |
+
};
|
| 613 |
+
import_binding.BindingMagicString.prototype.update = function(start, end, content, options) {
|
| 614 |
+
assertString(content, "replacement content must be a string");
|
| 615 |
+
return nativeUpdate.call(this, start, end, content, options);
|
| 616 |
+
};
|
| 617 |
+
const nativeReplace = import_binding.BindingMagicString.prototype.replace;
|
| 618 |
+
const nativeReplaceAll = import_binding.BindingMagicString.prototype.replaceAll;
|
| 619 |
+
import_binding.BindingMagicString.prototype.replace = function(searchValue, replacement) {
|
| 620 |
+
if (typeof searchValue === "string") return nativeReplace.call(this, searchValue, replacement);
|
| 621 |
+
if (searchValue.global) searchValue.lastIndex = 0;
|
| 622 |
+
const lastMatchEnd = this.replaceRegex(searchValue, replacement);
|
| 623 |
+
if (searchValue.global) searchValue.lastIndex = 0;
|
| 624 |
+
else if (searchValue.sticky) searchValue.lastIndex = lastMatchEnd === -1 ? 0 : lastMatchEnd;
|
| 625 |
+
return this;
|
| 626 |
+
};
|
| 627 |
+
import_binding.BindingMagicString.prototype.replaceAll = function(searchValue, replacement) {
|
| 628 |
+
if (typeof searchValue === "string") return nativeReplaceAll.call(this, searchValue, replacement);
|
| 629 |
+
if (!searchValue.global) throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");
|
| 630 |
+
searchValue.lastIndex = 0;
|
| 631 |
+
this.replaceRegex(searchValue, replacement);
|
| 632 |
+
searchValue.lastIndex = 0;
|
| 633 |
+
return this;
|
| 634 |
+
};
|
| 635 |
+
/**
|
| 636 |
+
* A native MagicString implementation powered by Rust.
|
| 637 |
+
*
|
| 638 |
+
* @experimental
|
| 639 |
+
*/
|
| 640 |
+
const RolldownMagicString = import_binding.BindingMagicString;
|
| 641 |
+
//#endregion
|
| 642 |
+
//#region src/utils/transform-module-info.ts
|
| 643 |
+
function transformModuleInfo(info, option) {
|
| 644 |
+
return {
|
| 645 |
+
get ast() {
|
| 646 |
+
return unsupported("ModuleInfo#ast");
|
| 647 |
+
},
|
| 648 |
+
get code() {
|
| 649 |
+
return info.code;
|
| 650 |
+
},
|
| 651 |
+
id: info.id,
|
| 652 |
+
importers: info.importers,
|
| 653 |
+
dynamicImporters: info.dynamicImporters,
|
| 654 |
+
importedIds: info.importedIds,
|
| 655 |
+
dynamicallyImportedIds: info.dynamicallyImportedIds,
|
| 656 |
+
exports: info.exports,
|
| 657 |
+
isEntry: info.isEntry,
|
| 658 |
+
inputFormat: info.inputFormat,
|
| 659 |
+
...option
|
| 660 |
+
};
|
| 661 |
+
}
|
| 662 |
+
//#endregion
|
| 663 |
+
//#region src/utils/transform-sourcemap.ts
|
| 664 |
+
function isEmptySourcemapFiled(array) {
|
| 665 |
+
if (!array) return true;
|
| 666 |
+
if (array.length === 0 || !array[0]) return true;
|
| 667 |
+
return false;
|
| 668 |
+
}
|
| 669 |
+
function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
|
| 670 |
+
if (!rawMap) return;
|
| 671 |
+
let map = typeof rawMap === "object" ? rawMap : JSON.parse(rawMap);
|
| 672 |
+
if (isEmptySourcemapFiled(map.sourcesContent)) map.sourcesContent = [originalCode];
|
| 673 |
+
if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id) map.sources = [id];
|
| 674 |
+
return map;
|
| 675 |
+
}
|
| 676 |
+
//#endregion
|
| 677 |
+
//#region ../../node_modules/.pnpm/remeda@2.34.1/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
|
| 678 |
+
function e(e, t, n) {
|
| 679 |
+
let r = (n) => e(n, ...t);
|
| 680 |
+
return n === void 0 ? r : Object.assign(r, {
|
| 681 |
+
lazy: n,
|
| 682 |
+
lazyArgs: t
|
| 683 |
+
});
|
| 684 |
+
}
|
| 685 |
+
//#endregion
|
| 686 |
+
//#region ../../node_modules/.pnpm/remeda@2.34.1/node_modules/remeda/dist/purry.js
|
| 687 |
+
function t$1(t, n, r) {
|
| 688 |
+
let i = t.length - n.length;
|
| 689 |
+
if (i === 0) return t(...n);
|
| 690 |
+
if (i === 1) return e(t, n, r);
|
| 691 |
+
throw Error(`Wrong number of arguments`);
|
| 692 |
+
}
|
| 693 |
+
//#endregion
|
| 694 |
+
//#region ../../node_modules/.pnpm/remeda@2.34.1/node_modules/remeda/dist/partition.js
|
| 695 |
+
function t(...t) {
|
| 696 |
+
return t$1(n, t);
|
| 697 |
+
}
|
| 698 |
+
const n = (e, t) => {
|
| 699 |
+
let n = [[], []];
|
| 700 |
+
for (let [r, i] of e.entries()) t(i, r, e) ? n[0].push(i) : n[1].push(i);
|
| 701 |
+
return n;
|
| 702 |
+
};
|
| 703 |
+
//#endregion
|
| 704 |
+
//#region src/plugin/bindingify-hook-filter.ts
|
| 705 |
+
function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
|
| 706 |
+
if (typeof matcher === "string" || matcher instanceof RegExp) return [filter.include(generateAtomMatcher(stringKind, matcher))];
|
| 707 |
+
if (Array.isArray(matcher)) return matcher.map((m) => filter.include(generateAtomMatcher(stringKind, m)));
|
| 708 |
+
let ret = [];
|
| 709 |
+
if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m) => filter.exclude(generateAtomMatcher(stringKind, m))));
|
| 710 |
+
if (matcher.include) ret.push(...arraify(matcher.include).map((m) => filter.include(generateAtomMatcher(stringKind, m))));
|
| 711 |
+
return ret;
|
| 712 |
+
}
|
| 713 |
+
function generateAtomMatcher(kind, matcher) {
|
| 714 |
+
return kind === "code" ? filter.code(matcher) : filter.id(matcher);
|
| 715 |
+
}
|
| 716 |
+
function transformFilterMatcherToFilterExprs(filterOption) {
|
| 717 |
+
if (!filterOption) return;
|
| 718 |
+
if (Array.isArray(filterOption)) return filterOption;
|
| 719 |
+
const { id, code, moduleType } = filterOption;
|
| 720 |
+
let ret = [];
|
| 721 |
+
let idIncludes = [];
|
| 722 |
+
let idExcludes = [];
|
| 723 |
+
let codeIncludes = [];
|
| 724 |
+
let codeExcludes = [];
|
| 725 |
+
if (id) [idIncludes, idExcludes] = t(generalHookFilterMatcherToFilterExprs(id, "id") ?? [], (m) => m.kind === "include");
|
| 726 |
+
if (code) [codeIncludes, codeExcludes] = t(generalHookFilterMatcherToFilterExprs(code, "code") ?? [], (m) => m.kind === "include");
|
| 727 |
+
ret.push(...idExcludes);
|
| 728 |
+
ret.push(...codeExcludes);
|
| 729 |
+
let andExprList = [];
|
| 730 |
+
if (moduleType) {
|
| 731 |
+
let moduleTypes = Array.isArray(moduleType) ? moduleType : moduleType.include ?? [];
|
| 732 |
+
andExprList.push(filter.or(...moduleTypes.map((m) => filter.moduleType(m))));
|
| 733 |
+
}
|
| 734 |
+
if (idIncludes.length) andExprList.push(filter.or(...idIncludes.map((item) => item.expr)));
|
| 735 |
+
if (codeIncludes.length) andExprList.push(filter.or(...codeIncludes.map((item) => item.expr)));
|
| 736 |
+
if (andExprList.length) ret.push(filter.include(filter.and(...andExprList)));
|
| 737 |
+
return ret;
|
| 738 |
+
}
|
| 739 |
+
function bindingifyGeneralHookFilter(stringKind, pattern) {
|
| 740 |
+
let filterExprs = generalHookFilterMatcherToFilterExprs(pattern, stringKind);
|
| 741 |
+
let ret = [];
|
| 742 |
+
if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
|
| 743 |
+
return ret.length > 0 ? { value: ret } : void 0;
|
| 744 |
+
}
|
| 745 |
+
function bindingifyFilterExpr(expr) {
|
| 746 |
+
let list = [];
|
| 747 |
+
bindingifyFilterExprImpl(expr, list);
|
| 748 |
+
return list;
|
| 749 |
+
}
|
| 750 |
+
function containsImporterId(expr) {
|
| 751 |
+
switch (expr.kind) {
|
| 752 |
+
case "and":
|
| 753 |
+
case "or": return expr.args.some(containsImporterId);
|
| 754 |
+
case "not":
|
| 755 |
+
case "include":
|
| 756 |
+
case "exclude": return containsImporterId(expr.expr);
|
| 757 |
+
case "importerId": return true;
|
| 758 |
+
default: return false;
|
| 759 |
+
}
|
| 760 |
+
}
|
| 761 |
+
function assertNoImporterId(filterExprs, hookName) {
|
| 762 |
+
if (filterExprs?.some(containsImporterId)) throw new Error(`The \`importerId\` filter can only be used with the \`resolveId\` hook, but it was used with the \`${hookName}\` hook.`);
|
| 763 |
+
}
|
| 764 |
+
function bindingifyFilterExprImpl(expr, list) {
|
| 765 |
+
switch (expr.kind) {
|
| 766 |
+
case "and": {
|
| 767 |
+
let args = expr.args;
|
| 768 |
+
for (let i = args.length - 1; i >= 0; i--) bindingifyFilterExprImpl(args[i], list);
|
| 769 |
+
list.push({
|
| 770 |
+
kind: "And",
|
| 771 |
+
payload: args.length
|
| 772 |
+
});
|
| 773 |
+
break;
|
| 774 |
+
}
|
| 775 |
+
case "or": {
|
| 776 |
+
let args = expr.args;
|
| 777 |
+
for (let i = args.length - 1; i >= 0; i--) bindingifyFilterExprImpl(args[i], list);
|
| 778 |
+
list.push({
|
| 779 |
+
kind: "Or",
|
| 780 |
+
payload: args.length
|
| 781 |
+
});
|
| 782 |
+
break;
|
| 783 |
+
}
|
| 784 |
+
case "not":
|
| 785 |
+
bindingifyFilterExprImpl(expr.expr, list);
|
| 786 |
+
list.push({ kind: "Not" });
|
| 787 |
+
break;
|
| 788 |
+
case "id":
|
| 789 |
+
list.push({
|
| 790 |
+
kind: "Id",
|
| 791 |
+
payload: expr.pattern
|
| 792 |
+
});
|
| 793 |
+
if (expr.params.cleanUrl) list.push({ kind: "CleanUrl" });
|
| 794 |
+
break;
|
| 795 |
+
case "importerId":
|
| 796 |
+
list.push({
|
| 797 |
+
kind: "ImporterId",
|
| 798 |
+
payload: expr.pattern
|
| 799 |
+
});
|
| 800 |
+
if (expr.params.cleanUrl) list.push({ kind: "CleanUrl" });
|
| 801 |
+
break;
|
| 802 |
+
case "moduleType":
|
| 803 |
+
list.push({
|
| 804 |
+
kind: "ModuleType",
|
| 805 |
+
payload: expr.pattern
|
| 806 |
+
});
|
| 807 |
+
break;
|
| 808 |
+
case "code":
|
| 809 |
+
list.push({
|
| 810 |
+
kind: "Code",
|
| 811 |
+
payload: expr.pattern
|
| 812 |
+
});
|
| 813 |
+
break;
|
| 814 |
+
case "include":
|
| 815 |
+
bindingifyFilterExprImpl(expr.expr, list);
|
| 816 |
+
list.push({ kind: "Include" });
|
| 817 |
+
break;
|
| 818 |
+
case "exclude":
|
| 819 |
+
bindingifyFilterExprImpl(expr.expr, list);
|
| 820 |
+
list.push({ kind: "Exclude" });
|
| 821 |
+
break;
|
| 822 |
+
case "query":
|
| 823 |
+
list.push({
|
| 824 |
+
kind: "QueryKey",
|
| 825 |
+
payload: expr.key
|
| 826 |
+
});
|
| 827 |
+
list.push({
|
| 828 |
+
kind: "QueryValue",
|
| 829 |
+
payload: expr.pattern
|
| 830 |
+
});
|
| 831 |
+
break;
|
| 832 |
+
default: throw new Error(`Unknown filter expression: ${expr}`);
|
| 833 |
+
}
|
| 834 |
+
}
|
| 835 |
+
function bindingifyResolveIdFilter(filterOption) {
|
| 836 |
+
if (!filterOption) return;
|
| 837 |
+
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
| 838 |
+
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
| 839 |
+
}
|
| 840 |
+
function bindingifyLoadFilter(filterOption) {
|
| 841 |
+
if (!filterOption) return;
|
| 842 |
+
if (Array.isArray(filterOption)) {
|
| 843 |
+
assertNoImporterId(filterOption, "load");
|
| 844 |
+
return { value: filterOption.map(bindingifyFilterExpr) };
|
| 845 |
+
}
|
| 846 |
+
return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
|
| 847 |
+
}
|
| 848 |
+
function bindingifyTransformFilter(filterOption) {
|
| 849 |
+
if (!filterOption) return;
|
| 850 |
+
let filterExprs = transformFilterMatcherToFilterExprs(filterOption);
|
| 851 |
+
assertNoImporterId(filterExprs, "transform");
|
| 852 |
+
let ret = [];
|
| 853 |
+
if (filterExprs) ret = filterExprs.map(bindingifyFilterExpr);
|
| 854 |
+
return { value: ret.length > 0 ? ret : void 0 };
|
| 855 |
+
}
|
| 856 |
+
function bindingifyRenderChunkFilter(filterOption) {
|
| 857 |
+
if (!filterOption) return;
|
| 858 |
+
if (Array.isArray(filterOption)) {
|
| 859 |
+
assertNoImporterId(filterOption, "renderChunk");
|
| 860 |
+
return { value: filterOption.map(bindingifyFilterExpr) };
|
| 861 |
+
}
|
| 862 |
+
return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
|
| 863 |
+
}
|
| 864 |
+
//#endregion
|
| 865 |
+
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
| 866 |
+
function bindingifyPluginHookMeta(options) {
|
| 867 |
+
return { order: bindingPluginOrder(options.order) };
|
| 868 |
+
}
|
| 869 |
+
function bindingPluginOrder(order) {
|
| 870 |
+
switch (order) {
|
| 871 |
+
case "post": return import_binding.BindingPluginOrder.Post;
|
| 872 |
+
case "pre": return import_binding.BindingPluginOrder.Pre;
|
| 873 |
+
case null:
|
| 874 |
+
case void 0: return;
|
| 875 |
+
default: throw new Error(`Unknown plugin order: ${order}`);
|
| 876 |
+
}
|
| 877 |
+
}
|
| 878 |
+
//#endregion
|
| 879 |
+
//#region src/plugin/fs.ts
|
| 880 |
+
const fsModule = {
|
| 881 |
+
appendFile: fsp.appendFile,
|
| 882 |
+
copyFile: fsp.copyFile,
|
| 883 |
+
mkdir: fsp.mkdir,
|
| 884 |
+
mkdtemp: fsp.mkdtemp,
|
| 885 |
+
readdir: fsp.readdir,
|
| 886 |
+
readFile: fsp.readFile,
|
| 887 |
+
realpath: fsp.realpath,
|
| 888 |
+
rename: fsp.rename,
|
| 889 |
+
rmdir: fsp.rmdir,
|
| 890 |
+
stat: fsp.stat,
|
| 891 |
+
lstat: fsp.lstat,
|
| 892 |
+
unlink: fsp.unlink,
|
| 893 |
+
writeFile: fsp.writeFile
|
| 894 |
+
};
|
| 895 |
+
//#endregion
|
| 896 |
+
//#region src/plugin/plugin-context.ts
|
| 897 |
+
var PluginContextImpl = class extends MinimalPluginContextImpl {
|
| 898 |
+
outputOptions;
|
| 899 |
+
context;
|
| 900 |
+
data;
|
| 901 |
+
onLog;
|
| 902 |
+
currentLoadingModule;
|
| 903 |
+
fs = fsModule;
|
| 904 |
+
getModuleInfo;
|
| 905 |
+
constructor(outputOptions, context, plugin, data, onLog, logLevel, watchMode, currentLoadingModule) {
|
| 906 |
+
super(onLog, logLevel, plugin.name, watchMode);
|
| 907 |
+
this.outputOptions = outputOptions;
|
| 908 |
+
this.context = context;
|
| 909 |
+
this.data = data;
|
| 910 |
+
this.onLog = onLog;
|
| 911 |
+
this.currentLoadingModule = currentLoadingModule;
|
| 912 |
+
this.getModuleInfo = (id) => this.data.getModuleInfo(id, context);
|
| 913 |
+
}
|
| 914 |
+
async load(options) {
|
| 915 |
+
const id = options.id;
|
| 916 |
+
if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
|
| 917 |
+
const moduleInfo = this.data.getModuleInfo(id, this.context);
|
| 918 |
+
if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
|
| 919 |
+
const rawOptions = {
|
| 920 |
+
meta: options.meta || {},
|
| 921 |
+
moduleSideEffects: options.moduleSideEffects || null,
|
| 922 |
+
invalidate: false
|
| 923 |
+
};
|
| 924 |
+
this.data.updateModuleOption(id, rawOptions);
|
| 925 |
+
let loadPromise = this.data.loadModulePromiseMap.get(id);
|
| 926 |
+
if (!loadPromise) {
|
| 927 |
+
loadPromise = this.context.load(id, options.moduleSideEffects ?? void 0, options.packageJsonPath ?? void 0).catch(() => {
|
| 928 |
+
this.data.loadModulePromiseMap.delete(id);
|
| 929 |
+
});
|
| 930 |
+
this.data.loadModulePromiseMap.set(id, loadPromise);
|
| 931 |
+
}
|
| 932 |
+
await loadPromise;
|
| 933 |
+
return this.data.getModuleInfo(id, this.context);
|
| 934 |
+
}
|
| 935 |
+
async resolve(source, importer, options) {
|
| 936 |
+
let receipt = void 0;
|
| 937 |
+
if (options != null) receipt = this.data.saveResolveOptions(options);
|
| 938 |
+
const vitePluginCustom = Object.entries(options?.custom ?? {}).reduce((acc, [key, value]) => {
|
| 939 |
+
if (key.startsWith("vite:")) (acc ??= {})[key] = value;
|
| 940 |
+
return acc;
|
| 941 |
+
}, void 0);
|
| 942 |
+
const res = await this.context.resolve(source, importer, {
|
| 943 |
+
importKind: options?.kind,
|
| 944 |
+
custom: receipt,
|
| 945 |
+
isEntry: options?.isEntry,
|
| 946 |
+
skipSelf: options?.skipSelf,
|
| 947 |
+
vitePluginCustom
|
| 948 |
+
});
|
| 949 |
+
if (receipt != null) this.data.removeSavedResolveOptions(receipt);
|
| 950 |
+
if (res == null) return null;
|
| 951 |
+
const info = this.data.getModuleOption(res.id) || {};
|
| 952 |
+
return {
|
| 953 |
+
...res,
|
| 954 |
+
external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
| 955 |
+
...info,
|
| 956 |
+
moduleSideEffects: info.moduleSideEffects ?? res.moduleSideEffects ?? null,
|
| 957 |
+
packageJsonPath: res.packageJsonPath
|
| 958 |
+
};
|
| 959 |
+
}
|
| 960 |
+
emitFile = (file) => {
|
| 961 |
+
if (file.type === "prebuilt-chunk") return this.context.emitPrebuiltChunk({
|
| 962 |
+
fileName: file.fileName,
|
| 963 |
+
name: file.name,
|
| 964 |
+
code: file.code,
|
| 965 |
+
exports: file.exports,
|
| 966 |
+
map: bindingifySourcemap(file.map),
|
| 967 |
+
sourcemapFileName: file.sourcemapFileName,
|
| 968 |
+
facadeModuleId: file.facadeModuleId,
|
| 969 |
+
isEntry: file.isEntry,
|
| 970 |
+
isDynamicEntry: file.isDynamicEntry
|
| 971 |
+
});
|
| 972 |
+
if (file.type === "chunk") return this.context.emitChunk({
|
| 973 |
+
preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
|
| 974 |
+
...file
|
| 975 |
+
});
|
| 976 |
+
const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
|
| 977 |
+
const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
|
| 978 |
+
return this.context.emitFile({
|
| 979 |
+
...file,
|
| 980 |
+
originalFileName: file.originalFileName || void 0,
|
| 981 |
+
source: bindingAssetSource(file.source)
|
| 982 |
+
}, filename, fnSanitizedFileName);
|
| 983 |
+
};
|
| 984 |
+
getAssetFileNames(file) {
|
| 985 |
+
if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
|
| 986 |
+
type: "asset",
|
| 987 |
+
name: file.name,
|
| 988 |
+
names: file.name ? [file.name] : [],
|
| 989 |
+
originalFileName: file.originalFileName,
|
| 990 |
+
originalFileNames: file.originalFileName ? [file.originalFileName] : [],
|
| 991 |
+
source: file.source
|
| 992 |
+
});
|
| 993 |
+
}
|
| 994 |
+
getFileName(referenceId) {
|
| 995 |
+
return this.context.getFileName(referenceId);
|
| 996 |
+
}
|
| 997 |
+
getModuleIds() {
|
| 998 |
+
return this.data.getModuleIds(this.context);
|
| 999 |
+
}
|
| 1000 |
+
addWatchFile(id) {
|
| 1001 |
+
this.context.addWatchFile(id);
|
| 1002 |
+
}
|
| 1003 |
+
parse(input, options) {
|
| 1004 |
+
return parseAst(input, options);
|
| 1005 |
+
}
|
| 1006 |
+
};
|
| 1007 |
+
//#endregion
|
| 1008 |
+
//#region src/plugin/load-plugin-context.ts
|
| 1009 |
+
var LoadPluginContextImpl = class extends PluginContextImpl {
|
| 1010 |
+
inner;
|
| 1011 |
+
constructor(outputOptions, context, plugin, data, inner, moduleId, onLog, logLevelOption, watchMode) {
|
| 1012 |
+
super(outputOptions, context, plugin, data, onLog, logLevelOption, watchMode, moduleId);
|
| 1013 |
+
this.inner = inner;
|
| 1014 |
+
}
|
| 1015 |
+
addWatchFile(id) {
|
| 1016 |
+
this.inner.addWatchFile(id);
|
| 1017 |
+
}
|
| 1018 |
+
};
|
| 1019 |
+
//#endregion
|
| 1020 |
+
//#region src/plugin/transform-plugin-context.ts
|
| 1021 |
+
var TransformPluginContextImpl = class extends PluginContextImpl {
|
| 1022 |
+
inner;
|
| 1023 |
+
moduleId;
|
| 1024 |
+
moduleSource;
|
| 1025 |
+
constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption, watchMode) {
|
| 1026 |
+
super(outputOptions, context, plugin, data, onLog, LogLevelOption, watchMode, moduleId);
|
| 1027 |
+
this.inner = inner;
|
| 1028 |
+
this.moduleId = moduleId;
|
| 1029 |
+
this.moduleSource = moduleSource;
|
| 1030 |
+
const getLogHandler = (handler) => (log, pos) => {
|
| 1031 |
+
log = normalizeLog(log);
|
| 1032 |
+
if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
|
| 1033 |
+
log.id = moduleId;
|
| 1034 |
+
log.hook = "transform";
|
| 1035 |
+
handler(log);
|
| 1036 |
+
};
|
| 1037 |
+
this.debug = getLogHandler(this.debug);
|
| 1038 |
+
this.warn = getLogHandler(this.warn);
|
| 1039 |
+
this.info = getLogHandler(this.info);
|
| 1040 |
+
}
|
| 1041 |
+
error(e, pos) {
|
| 1042 |
+
if (typeof e === "string") e = { message: e };
|
| 1043 |
+
if (pos) augmentCodeLocation(e, pos, this.moduleSource, this.moduleId);
|
| 1044 |
+
e.id = this.moduleId;
|
| 1045 |
+
e.hook = "transform";
|
| 1046 |
+
return error(logPluginError(normalizeLog(e), this.pluginName));
|
| 1047 |
+
}
|
| 1048 |
+
getCombinedSourcemap() {
|
| 1049 |
+
return JSON.parse(this.inner.getCombinedSourcemap());
|
| 1050 |
+
}
|
| 1051 |
+
addWatchFile(id) {
|
| 1052 |
+
this.inner.addWatchFile(id);
|
| 1053 |
+
}
|
| 1054 |
+
sendMagicString(s) {
|
| 1055 |
+
this.inner.sendMagicString(s);
|
| 1056 |
+
}
|
| 1057 |
+
};
|
| 1058 |
+
//#endregion
|
| 1059 |
+
//#region src/plugin/bindingify-build-hooks.ts
|
| 1060 |
+
function createPluginContext(args, ctx) {
|
| 1061 |
+
return new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
|
| 1062 |
+
}
|
| 1063 |
+
function bindingifyBuildStart(args) {
|
| 1064 |
+
const hook = args.plugin.buildStart;
|
| 1065 |
+
if (!hook) return {};
|
| 1066 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1067 |
+
return {
|
| 1068 |
+
plugin: async (ctx, opts) => {
|
| 1069 |
+
await handler.call(createPluginContext(args, ctx), args.pluginContextData.getInputOptions(opts));
|
| 1070 |
+
},
|
| 1071 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1072 |
+
};
|
| 1073 |
+
}
|
| 1074 |
+
function bindingifyBuildEnd(args) {
|
| 1075 |
+
const hook = args.plugin.buildEnd;
|
| 1076 |
+
if (!hook) return {};
|
| 1077 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1078 |
+
return {
|
| 1079 |
+
plugin: async (ctx, err) => {
|
| 1080 |
+
await handler.call(createPluginContext(args, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
|
| 1081 |
+
},
|
| 1082 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1083 |
+
};
|
| 1084 |
+
}
|
| 1085 |
+
function bindingifyResolveId(args) {
|
| 1086 |
+
const hook = args.plugin.resolveId;
|
| 1087 |
+
if (!hook) return {};
|
| 1088 |
+
const { handler, meta, options } = normalizeHook(hook);
|
| 1089 |
+
return {
|
| 1090 |
+
plugin: async (ctx, specifier, importer, extraOptions) => {
|
| 1091 |
+
const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
|
| 1092 |
+
const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0, {
|
| 1093 |
+
...extraOptions,
|
| 1094 |
+
custom: contextResolveOptions?.custom
|
| 1095 |
+
});
|
| 1096 |
+
if (ret == null) return;
|
| 1097 |
+
if (ret === false) return {
|
| 1098 |
+
id: specifier,
|
| 1099 |
+
external: true,
|
| 1100 |
+
normalizeExternalId: true
|
| 1101 |
+
};
|
| 1102 |
+
if (typeof ret === "string") return {
|
| 1103 |
+
id: ret,
|
| 1104 |
+
normalizeExternalId: false
|
| 1105 |
+
};
|
| 1106 |
+
let exist = args.pluginContextData.updateModuleOption(ret.id, {
|
| 1107 |
+
meta: ret.meta || {},
|
| 1108 |
+
moduleSideEffects: ret.moduleSideEffects ?? null,
|
| 1109 |
+
invalidate: false
|
| 1110 |
+
});
|
| 1111 |
+
return {
|
| 1112 |
+
id: ret.id,
|
| 1113 |
+
external: ret.external,
|
| 1114 |
+
normalizeExternalId: false,
|
| 1115 |
+
moduleSideEffects: exist.moduleSideEffects ?? void 0,
|
| 1116 |
+
packageJsonPath: ret.packageJsonPath
|
| 1117 |
+
};
|
| 1118 |
+
},
|
| 1119 |
+
meta: bindingifyPluginHookMeta(meta),
|
| 1120 |
+
filter: bindingifyResolveIdFilter(options.filter)
|
| 1121 |
+
};
|
| 1122 |
+
}
|
| 1123 |
+
function bindingifyResolveDynamicImport(args) {
|
| 1124 |
+
const hook = args.plugin.resolveDynamicImport;
|
| 1125 |
+
if (!hook) return {};
|
| 1126 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1127 |
+
return {
|
| 1128 |
+
plugin: async (ctx, specifier, importer) => {
|
| 1129 |
+
const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0);
|
| 1130 |
+
if (ret == null) return;
|
| 1131 |
+
if (ret === false) return {
|
| 1132 |
+
id: specifier,
|
| 1133 |
+
external: true
|
| 1134 |
+
};
|
| 1135 |
+
if (typeof ret === "string") return { id: ret };
|
| 1136 |
+
const result = {
|
| 1137 |
+
id: ret.id,
|
| 1138 |
+
external: ret.external,
|
| 1139 |
+
packageJsonPath: ret.packageJsonPath
|
| 1140 |
+
};
|
| 1141 |
+
if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
|
| 1142 |
+
args.pluginContextData.updateModuleOption(ret.id, {
|
| 1143 |
+
meta: ret.meta || {},
|
| 1144 |
+
moduleSideEffects: ret.moduleSideEffects || null,
|
| 1145 |
+
invalidate: false
|
| 1146 |
+
});
|
| 1147 |
+
return result;
|
| 1148 |
+
},
|
| 1149 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1150 |
+
};
|
| 1151 |
+
}
|
| 1152 |
+
function bindingifyTransform(args) {
|
| 1153 |
+
const hook = args.plugin.transform;
|
| 1154 |
+
if (!hook) return {};
|
| 1155 |
+
const { handler, meta, options } = normalizeHook(hook);
|
| 1156 |
+
return {
|
| 1157 |
+
plugin: async (ctx, code, id, meta) => {
|
| 1158 |
+
let magicStringInstance, astInstance;
|
| 1159 |
+
Object.defineProperties(meta, {
|
| 1160 |
+
magicString: { get() {
|
| 1161 |
+
if (magicStringInstance) return magicStringInstance;
|
| 1162 |
+
magicStringInstance = new RolldownMagicString(code);
|
| 1163 |
+
return magicStringInstance;
|
| 1164 |
+
} },
|
| 1165 |
+
ast: { get() {
|
| 1166 |
+
if (astInstance) return astInstance;
|
| 1167 |
+
let lang = "js";
|
| 1168 |
+
switch (meta.moduleType) {
|
| 1169 |
+
case "js":
|
| 1170 |
+
case "jsx":
|
| 1171 |
+
case "ts":
|
| 1172 |
+
case "tsx":
|
| 1173 |
+
lang = meta.moduleType;
|
| 1174 |
+
break;
|
| 1175 |
+
default: break;
|
| 1176 |
+
}
|
| 1177 |
+
astInstance = parseAst(code, {
|
| 1178 |
+
astType: meta.moduleType.includes("ts") ? "ts" : "js",
|
| 1179 |
+
lang
|
| 1180 |
+
});
|
| 1181 |
+
return astInstance;
|
| 1182 |
+
} }
|
| 1183 |
+
});
|
| 1184 |
+
const transformCtx = new TransformPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel, args.watchMode);
|
| 1185 |
+
const ret = await handler.call(transformCtx, code, id, meta);
|
| 1186 |
+
if (ret == null) return;
|
| 1187 |
+
if (typeof ret === "string") return { code: ret };
|
| 1188 |
+
let moduleOption = args.pluginContextData.updateModuleOption(id, {
|
| 1189 |
+
meta: ret.meta ?? {},
|
| 1190 |
+
moduleSideEffects: ret.moduleSideEffects ?? null,
|
| 1191 |
+
invalidate: false
|
| 1192 |
+
});
|
| 1193 |
+
let normalizedCode = void 0;
|
| 1194 |
+
let map = ret.map;
|
| 1195 |
+
let mapHandledByNativeChannel = false;
|
| 1196 |
+
if (typeof ret.code === "string") normalizedCode = ret.code;
|
| 1197 |
+
else if (ret.code instanceof RolldownMagicString) {
|
| 1198 |
+
let magicString = ret.code;
|
| 1199 |
+
normalizedCode = magicString.toString();
|
| 1200 |
+
let fallbackSourcemap = ctx.sendMagicString(magicString);
|
| 1201 |
+
if (fallbackSourcemap != void 0) map = fallbackSourcemap;
|
| 1202 |
+
else mapHandledByNativeChannel = true;
|
| 1203 |
+
}
|
| 1204 |
+
return {
|
| 1205 |
+
code: normalizedCode,
|
| 1206 |
+
map: bindingifySourcemap(normalizeTransformHookSourcemap(id, code, map)) ?? (mapHandledByNativeChannel || ret.map === null ? null : void 0),
|
| 1207 |
+
moduleSideEffects: moduleOption.moduleSideEffects ?? void 0,
|
| 1208 |
+
moduleType: ret.moduleType
|
| 1209 |
+
};
|
| 1210 |
+
},
|
| 1211 |
+
meta: bindingifyPluginHookMeta(meta),
|
| 1212 |
+
filter: bindingifyTransformFilter(options.filter)
|
| 1213 |
+
};
|
| 1214 |
+
}
|
| 1215 |
+
function bindingifyLoad(args) {
|
| 1216 |
+
const hook = args.plugin.load;
|
| 1217 |
+
if (!hook) return {};
|
| 1218 |
+
const { handler, meta, options } = normalizeHook(hook);
|
| 1219 |
+
return {
|
| 1220 |
+
plugin: async (ctx, id) => {
|
| 1221 |
+
const ret = await handler.call(new LoadPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, args.onLog, args.logLevel, args.watchMode), id);
|
| 1222 |
+
if (ret == null) return;
|
| 1223 |
+
if (typeof ret === "string") return { code: ret };
|
| 1224 |
+
let moduleOption = args.pluginContextData.updateModuleOption(id, {
|
| 1225 |
+
meta: ret.meta || {},
|
| 1226 |
+
moduleSideEffects: ret.moduleSideEffects ?? null,
|
| 1227 |
+
invalidate: false
|
| 1228 |
+
});
|
| 1229 |
+
let map = preProcessSourceMap(ret, id);
|
| 1230 |
+
return {
|
| 1231 |
+
code: ret.code,
|
| 1232 |
+
map: bindingifySourcemap(map),
|
| 1233 |
+
moduleType: ret.moduleType,
|
| 1234 |
+
moduleSideEffects: moduleOption.moduleSideEffects ?? void 0
|
| 1235 |
+
};
|
| 1236 |
+
},
|
| 1237 |
+
meta: bindingifyPluginHookMeta(meta),
|
| 1238 |
+
filter: bindingifyLoadFilter(options.filter)
|
| 1239 |
+
};
|
| 1240 |
+
}
|
| 1241 |
+
function preProcessSourceMap(ret, id) {
|
| 1242 |
+
if (!ret.map) return;
|
| 1243 |
+
let map = typeof ret.map === "object" ? ret.map : JSON.parse(ret.map);
|
| 1244 |
+
if (!isEmptySourcemapFiled(map.sources)) {
|
| 1245 |
+
const directory = path.dirname(id) || ".";
|
| 1246 |
+
const sourceRoot = map.sourceRoot || ".";
|
| 1247 |
+
map.sources = map.sources.map((source) => path.resolve(directory, sourceRoot, source));
|
| 1248 |
+
}
|
| 1249 |
+
return map;
|
| 1250 |
+
}
|
| 1251 |
+
function bindingifyModuleParsed(args) {
|
| 1252 |
+
const hook = args.plugin.moduleParsed;
|
| 1253 |
+
if (!hook) return {};
|
| 1254 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1255 |
+
return {
|
| 1256 |
+
plugin: async (ctx, moduleInfo) => {
|
| 1257 |
+
await handler.call(createPluginContext(args, ctx), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
|
| 1258 |
+
},
|
| 1259 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1260 |
+
};
|
| 1261 |
+
}
|
| 1262 |
+
//#endregion
|
| 1263 |
+
//#region src/plugin/bindingify-output-hooks.ts
|
| 1264 |
+
function bindingifyRenderStart(args) {
|
| 1265 |
+
const hook = args.plugin.renderStart;
|
| 1266 |
+
if (!hook) return {};
|
| 1267 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1268 |
+
return {
|
| 1269 |
+
plugin: async (ctx, opts) => {
|
| 1270 |
+
handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), args.pluginContextData.getOutputOptions(opts), args.pluginContextData.getInputOptions(opts));
|
| 1271 |
+
},
|
| 1272 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1273 |
+
};
|
| 1274 |
+
}
|
| 1275 |
+
function bindingifyRenderChunk(args) {
|
| 1276 |
+
const hook = args.plugin.renderChunk;
|
| 1277 |
+
if (!hook) return {};
|
| 1278 |
+
const { handler, meta, options } = normalizeHook(hook);
|
| 1279 |
+
return {
|
| 1280 |
+
plugin: async (ctx, code, chunk, opts, meta) => {
|
| 1281 |
+
if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
|
| 1282 |
+
const renderChunkMeta = args.pluginContextData.getRenderChunkMeta();
|
| 1283 |
+
let magicStringInstance;
|
| 1284 |
+
if (args.options.experimental?.nativeMagicString) Object.defineProperty(renderChunkMeta, "magicString", {
|
| 1285 |
+
get() {
|
| 1286 |
+
if (magicStringInstance) return magicStringInstance;
|
| 1287 |
+
magicStringInstance = new RolldownMagicString(code);
|
| 1288 |
+
return magicStringInstance;
|
| 1289 |
+
},
|
| 1290 |
+
configurable: true
|
| 1291 |
+
});
|
| 1292 |
+
const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), code, transformRenderedChunk(chunk), args.pluginContextData.getOutputOptions(opts), renderChunkMeta);
|
| 1293 |
+
if (ret == null) return;
|
| 1294 |
+
if (ret instanceof RolldownMagicString) {
|
| 1295 |
+
const normalizedCode = ret.toString();
|
| 1296 |
+
const generatedMap = ret.generateMap();
|
| 1297 |
+
return {
|
| 1298 |
+
code: normalizedCode,
|
| 1299 |
+
map: bindingifySourcemap({
|
| 1300 |
+
file: generatedMap.file,
|
| 1301 |
+
mappings: generatedMap.mappings,
|
| 1302 |
+
names: generatedMap.names,
|
| 1303 |
+
sources: generatedMap.sources,
|
| 1304 |
+
sourcesContent: generatedMap.sourcesContent.map((s) => s ?? null)
|
| 1305 |
+
})
|
| 1306 |
+
};
|
| 1307 |
+
}
|
| 1308 |
+
if (typeof ret === "string") return { code: ret };
|
| 1309 |
+
if (ret.code instanceof RolldownMagicString) {
|
| 1310 |
+
const magicString = ret.code;
|
| 1311 |
+
const normalizedCode = magicString.toString();
|
| 1312 |
+
if (ret.map === null) return {
|
| 1313 |
+
code: normalizedCode,
|
| 1314 |
+
map: null
|
| 1315 |
+
};
|
| 1316 |
+
if (ret.map === void 0) {
|
| 1317 |
+
const generatedMap = magicString.generateMap();
|
| 1318 |
+
return {
|
| 1319 |
+
code: normalizedCode,
|
| 1320 |
+
map: bindingifySourcemap({
|
| 1321 |
+
file: generatedMap.file,
|
| 1322 |
+
mappings: generatedMap.mappings,
|
| 1323 |
+
names: generatedMap.names,
|
| 1324 |
+
sources: generatedMap.sources,
|
| 1325 |
+
sourcesContent: generatedMap.sourcesContent.map((s) => s ?? null)
|
| 1326 |
+
})
|
| 1327 |
+
};
|
| 1328 |
+
}
|
| 1329 |
+
return {
|
| 1330 |
+
code: normalizedCode,
|
| 1331 |
+
map: bindingifySourcemap(ret.map)
|
| 1332 |
+
};
|
| 1333 |
+
}
|
| 1334 |
+
if (ret.map === null) return {
|
| 1335 |
+
code: ret.code,
|
| 1336 |
+
map: null
|
| 1337 |
+
};
|
| 1338 |
+
return {
|
| 1339 |
+
code: ret.code,
|
| 1340 |
+
map: bindingifySourcemap(ret.map)
|
| 1341 |
+
};
|
| 1342 |
+
},
|
| 1343 |
+
meta: bindingifyPluginHookMeta(meta),
|
| 1344 |
+
filter: bindingifyRenderChunkFilter(options.filter)
|
| 1345 |
+
};
|
| 1346 |
+
}
|
| 1347 |
+
function bindingifyAugmentChunkHash(args) {
|
| 1348 |
+
const hook = args.plugin.augmentChunkHash;
|
| 1349 |
+
if (!hook) return {};
|
| 1350 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1351 |
+
return {
|
| 1352 |
+
plugin: async (ctx, chunk) => {
|
| 1353 |
+
return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
|
| 1354 |
+
},
|
| 1355 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1356 |
+
};
|
| 1357 |
+
}
|
| 1358 |
+
function bindingifyRenderError(args) {
|
| 1359 |
+
const hook = args.plugin.renderError;
|
| 1360 |
+
if (!hook) return {};
|
| 1361 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1362 |
+
return {
|
| 1363 |
+
plugin: async (ctx, err) => {
|
| 1364 |
+
handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), aggregateBindingErrorsIntoJsError(err));
|
| 1365 |
+
},
|
| 1366 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1367 |
+
};
|
| 1368 |
+
}
|
| 1369 |
+
function bindingifyGenerateBundle(args) {
|
| 1370 |
+
const hook = args.plugin.generateBundle;
|
| 1371 |
+
if (!hook) return {};
|
| 1372 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1373 |
+
return {
|
| 1374 |
+
plugin: async (ctx, bundle, isWrite, opts) => {
|
| 1375 |
+
const changed = {
|
| 1376 |
+
updated: /* @__PURE__ */ new Set(),
|
| 1377 |
+
deleted: /* @__PURE__ */ new Set()
|
| 1378 |
+
};
|
| 1379 |
+
const context = new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
|
| 1380 |
+
const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
|
| 1381 |
+
await handler.call(context, args.pluginContextData.getOutputOptions(opts), output, isWrite);
|
| 1382 |
+
return collectChangedBundle(changed, output);
|
| 1383 |
+
},
|
| 1384 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1385 |
+
};
|
| 1386 |
+
}
|
| 1387 |
+
function bindingifyWriteBundle(args) {
|
| 1388 |
+
const hook = args.plugin.writeBundle;
|
| 1389 |
+
if (!hook) return {};
|
| 1390 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1391 |
+
return {
|
| 1392 |
+
plugin: async (ctx, bundle, opts) => {
|
| 1393 |
+
const changed = {
|
| 1394 |
+
updated: /* @__PURE__ */ new Set(),
|
| 1395 |
+
deleted: /* @__PURE__ */ new Set()
|
| 1396 |
+
};
|
| 1397 |
+
const context = new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
|
| 1398 |
+
const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
|
| 1399 |
+
await handler.call(context, args.pluginContextData.getOutputOptions(opts), output);
|
| 1400 |
+
return collectChangedBundle(changed, output);
|
| 1401 |
+
},
|
| 1402 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1403 |
+
};
|
| 1404 |
+
}
|
| 1405 |
+
function bindingifyCloseBundle(args) {
|
| 1406 |
+
const hook = args.plugin.closeBundle;
|
| 1407 |
+
if (!hook) return {};
|
| 1408 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1409 |
+
return {
|
| 1410 |
+
plugin: async (ctx, err) => {
|
| 1411 |
+
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
|
| 1412 |
+
},
|
| 1413 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1414 |
+
};
|
| 1415 |
+
}
|
| 1416 |
+
function bindingifyBanner(args) {
|
| 1417 |
+
const hook = args.plugin.banner;
|
| 1418 |
+
if (!hook) return {};
|
| 1419 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1420 |
+
return {
|
| 1421 |
+
plugin: async (ctx, chunk) => {
|
| 1422 |
+
if (typeof handler === "string") return handler;
|
| 1423 |
+
return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
|
| 1424 |
+
},
|
| 1425 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1426 |
+
};
|
| 1427 |
+
}
|
| 1428 |
+
function bindingifyFooter(args) {
|
| 1429 |
+
const hook = args.plugin.footer;
|
| 1430 |
+
if (!hook) return {};
|
| 1431 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1432 |
+
return {
|
| 1433 |
+
plugin: async (ctx, chunk) => {
|
| 1434 |
+
if (typeof handler === "string") return handler;
|
| 1435 |
+
return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
|
| 1436 |
+
},
|
| 1437 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1438 |
+
};
|
| 1439 |
+
}
|
| 1440 |
+
function bindingifyIntro(args) {
|
| 1441 |
+
const hook = args.plugin.intro;
|
| 1442 |
+
if (!hook) return {};
|
| 1443 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1444 |
+
return {
|
| 1445 |
+
plugin: async (ctx, chunk) => {
|
| 1446 |
+
if (typeof handler === "string") return handler;
|
| 1447 |
+
return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
|
| 1448 |
+
},
|
| 1449 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1450 |
+
};
|
| 1451 |
+
}
|
| 1452 |
+
function bindingifyOutro(args) {
|
| 1453 |
+
const hook = args.plugin.outro;
|
| 1454 |
+
if (!hook) return {};
|
| 1455 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1456 |
+
return {
|
| 1457 |
+
plugin: async (ctx, chunk) => {
|
| 1458 |
+
if (typeof handler === "string") return handler;
|
| 1459 |
+
return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
|
| 1460 |
+
},
|
| 1461 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1462 |
+
};
|
| 1463 |
+
}
|
| 1464 |
+
//#endregion
|
| 1465 |
+
//#region src/plugin/bindingify-watch-hooks.ts
|
| 1466 |
+
function bindingifyWatchChange(args) {
|
| 1467 |
+
const hook = args.plugin.watchChange;
|
| 1468 |
+
if (!hook) return {};
|
| 1469 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1470 |
+
return {
|
| 1471 |
+
plugin: async (ctx, id, event) => {
|
| 1472 |
+
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id, { event });
|
| 1473 |
+
},
|
| 1474 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1475 |
+
};
|
| 1476 |
+
}
|
| 1477 |
+
function bindingifyCloseWatcher(args) {
|
| 1478 |
+
const hook = args.plugin.closeWatcher;
|
| 1479 |
+
if (!hook) return {};
|
| 1480 |
+
const { handler, meta } = normalizeHook(hook);
|
| 1481 |
+
return {
|
| 1482 |
+
plugin: async (ctx) => {
|
| 1483 |
+
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
|
| 1484 |
+
},
|
| 1485 |
+
meta: bindingifyPluginHookMeta(meta)
|
| 1486 |
+
};
|
| 1487 |
+
}
|
| 1488 |
+
//#endregion
|
| 1489 |
+
//#region src/plugin/generated/hook-usage.ts
|
| 1490 |
+
var HookUsage = class {
|
| 1491 |
+
bitflag = BigInt(0);
|
| 1492 |
+
constructor() {}
|
| 1493 |
+
union(kind) {
|
| 1494 |
+
this.bitflag |= BigInt(kind);
|
| 1495 |
+
}
|
| 1496 |
+
inner() {
|
| 1497 |
+
return Number(this.bitflag);
|
| 1498 |
+
}
|
| 1499 |
+
};
|
| 1500 |
+
function extractHookUsage(plugin) {
|
| 1501 |
+
let hookUsage = new HookUsage();
|
| 1502 |
+
if (plugin.buildStart) hookUsage.union(1);
|
| 1503 |
+
if (plugin.resolveId) hookUsage.union(2);
|
| 1504 |
+
if (plugin.resolveDynamicImport) hookUsage.union(4);
|
| 1505 |
+
if (plugin.load) hookUsage.union(8);
|
| 1506 |
+
if (plugin.transform) hookUsage.union(16);
|
| 1507 |
+
if (plugin.moduleParsed) hookUsage.union(32);
|
| 1508 |
+
if (plugin.buildEnd) hookUsage.union(64);
|
| 1509 |
+
if (plugin.renderStart) hookUsage.union(128);
|
| 1510 |
+
if (plugin.renderError) hookUsage.union(256);
|
| 1511 |
+
if (plugin.renderChunk) hookUsage.union(512);
|
| 1512 |
+
if (plugin.augmentChunkHash) hookUsage.union(1024);
|
| 1513 |
+
if (plugin.generateBundle) hookUsage.union(2048);
|
| 1514 |
+
if (plugin.writeBundle) hookUsage.union(4096);
|
| 1515 |
+
if (plugin.closeBundle) hookUsage.union(8192);
|
| 1516 |
+
if (plugin.watchChange) hookUsage.union(16384);
|
| 1517 |
+
if (plugin.closeWatcher) hookUsage.union(32768);
|
| 1518 |
+
if (plugin.banner) hookUsage.union(131072);
|
| 1519 |
+
if (plugin.footer) hookUsage.union(262144);
|
| 1520 |
+
if (plugin.intro) hookUsage.union(524288);
|
| 1521 |
+
if (plugin.outro) hookUsage.union(1048576);
|
| 1522 |
+
return hookUsage;
|
| 1523 |
+
}
|
| 1524 |
+
//#endregion
|
| 1525 |
+
//#region src/plugin/bindingify-plugin.ts
|
| 1526 |
+
function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
| 1527 |
+
const args = {
|
| 1528 |
+
plugin,
|
| 1529 |
+
options,
|
| 1530 |
+
outputOptions,
|
| 1531 |
+
pluginContextData,
|
| 1532 |
+
onLog,
|
| 1533 |
+
logLevel,
|
| 1534 |
+
watchMode,
|
| 1535 |
+
normalizedOutputPlugins
|
| 1536 |
+
};
|
| 1537 |
+
const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
|
| 1538 |
+
const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
|
| 1539 |
+
const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args);
|
| 1540 |
+
const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args);
|
| 1541 |
+
const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
|
| 1542 |
+
const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
|
| 1543 |
+
const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
|
| 1544 |
+
const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
|
| 1545 |
+
const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
|
| 1546 |
+
const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
|
| 1547 |
+
const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
|
| 1548 |
+
const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
|
| 1549 |
+
const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
|
| 1550 |
+
const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
|
| 1551 |
+
const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args);
|
| 1552 |
+
const { plugin: footer, meta: footerMeta } = bindingifyFooter(args);
|
| 1553 |
+
const { plugin: intro, meta: introMeta } = bindingifyIntro(args);
|
| 1554 |
+
const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
|
| 1555 |
+
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
|
| 1556 |
+
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
|
| 1557 |
+
let hookUsage = extractHookUsage(plugin).inner();
|
| 1558 |
+
return wrapHandlers({
|
| 1559 |
+
name: plugin.name,
|
| 1560 |
+
buildStart,
|
| 1561 |
+
buildStartMeta,
|
| 1562 |
+
resolveId,
|
| 1563 |
+
resolveIdMeta,
|
| 1564 |
+
resolveIdFilter,
|
| 1565 |
+
resolveDynamicImport,
|
| 1566 |
+
resolveDynamicImportMeta,
|
| 1567 |
+
buildEnd,
|
| 1568 |
+
buildEndMeta,
|
| 1569 |
+
transform,
|
| 1570 |
+
transformMeta,
|
| 1571 |
+
transformFilter,
|
| 1572 |
+
moduleParsed,
|
| 1573 |
+
moduleParsedMeta,
|
| 1574 |
+
load,
|
| 1575 |
+
loadMeta,
|
| 1576 |
+
loadFilter,
|
| 1577 |
+
renderChunk,
|
| 1578 |
+
renderChunkMeta,
|
| 1579 |
+
renderChunkFilter,
|
| 1580 |
+
augmentChunkHash,
|
| 1581 |
+
augmentChunkHashMeta,
|
| 1582 |
+
renderStart,
|
| 1583 |
+
renderStartMeta,
|
| 1584 |
+
renderError,
|
| 1585 |
+
renderErrorMeta,
|
| 1586 |
+
generateBundle,
|
| 1587 |
+
generateBundleMeta,
|
| 1588 |
+
writeBundle,
|
| 1589 |
+
writeBundleMeta,
|
| 1590 |
+
closeBundle,
|
| 1591 |
+
closeBundleMeta,
|
| 1592 |
+
banner,
|
| 1593 |
+
bannerMeta,
|
| 1594 |
+
footer,
|
| 1595 |
+
footerMeta,
|
| 1596 |
+
intro,
|
| 1597 |
+
introMeta,
|
| 1598 |
+
outro,
|
| 1599 |
+
outroMeta,
|
| 1600 |
+
watchChange,
|
| 1601 |
+
watchChangeMeta,
|
| 1602 |
+
closeWatcher,
|
| 1603 |
+
closeWatcherMeta,
|
| 1604 |
+
hookUsage
|
| 1605 |
+
});
|
| 1606 |
+
}
|
| 1607 |
+
function wrapHandlers(plugin) {
|
| 1608 |
+
for (const hookName of [
|
| 1609 |
+
"buildStart",
|
| 1610 |
+
"resolveId",
|
| 1611 |
+
"resolveDynamicImport",
|
| 1612 |
+
"buildEnd",
|
| 1613 |
+
"transform",
|
| 1614 |
+
"moduleParsed",
|
| 1615 |
+
"load",
|
| 1616 |
+
"renderChunk",
|
| 1617 |
+
"augmentChunkHash",
|
| 1618 |
+
"renderStart",
|
| 1619 |
+
"renderError",
|
| 1620 |
+
"generateBundle",
|
| 1621 |
+
"writeBundle",
|
| 1622 |
+
"closeBundle",
|
| 1623 |
+
"banner",
|
| 1624 |
+
"footer",
|
| 1625 |
+
"intro",
|
| 1626 |
+
"outro",
|
| 1627 |
+
"watchChange",
|
| 1628 |
+
"closeWatcher"
|
| 1629 |
+
]) {
|
| 1630 |
+
const handler = plugin[hookName];
|
| 1631 |
+
if (handler) plugin[hookName] = async (...args) => {
|
| 1632 |
+
try {
|
| 1633 |
+
return await handler(...args);
|
| 1634 |
+
} catch (e) {
|
| 1635 |
+
return error(logPluginError(e, plugin.name, {
|
| 1636 |
+
hook: hookName,
|
| 1637 |
+
id: hookName === "transform" ? args[2] : void 0
|
| 1638 |
+
}));
|
| 1639 |
+
}
|
| 1640 |
+
};
|
| 1641 |
+
}
|
| 1642 |
+
return plugin;
|
| 1643 |
+
}
|
| 1644 |
+
//#endregion
|
| 1645 |
+
//#region src/options/normalized-input-options.ts
|
| 1646 |
+
var NormalizedInputOptionsImpl = class extends PlainObjectLike {
|
| 1647 |
+
onLog;
|
| 1648 |
+
inputPlugins;
|
| 1649 |
+
inner;
|
| 1650 |
+
constructor(inner, onLog, inputPlugins) {
|
| 1651 |
+
super();
|
| 1652 |
+
this.onLog = onLog;
|
| 1653 |
+
this.inputPlugins = inputPlugins;
|
| 1654 |
+
this.inner = inner;
|
| 1655 |
+
}
|
| 1656 |
+
get shimMissingExports() {
|
| 1657 |
+
return this.inner.shimMissingExports;
|
| 1658 |
+
}
|
| 1659 |
+
get input() {
|
| 1660 |
+
return this.inner.input;
|
| 1661 |
+
}
|
| 1662 |
+
get cwd() {
|
| 1663 |
+
return this.inner.cwd;
|
| 1664 |
+
}
|
| 1665 |
+
get platform() {
|
| 1666 |
+
return this.inner.platform;
|
| 1667 |
+
}
|
| 1668 |
+
get context() {
|
| 1669 |
+
return this.inner.context;
|
| 1670 |
+
}
|
| 1671 |
+
get plugins() {
|
| 1672 |
+
return this.inputPlugins;
|
| 1673 |
+
}
|
| 1674 |
+
};
|
| 1675 |
+
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "shimMissingExports", null);
|
| 1676 |
+
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "input", null);
|
| 1677 |
+
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "cwd", null);
|
| 1678 |
+
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "platform", null);
|
| 1679 |
+
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "context", null);
|
| 1680 |
+
//#endregion
|
| 1681 |
+
//#region src/options/normalized-output-options.ts
|
| 1682 |
+
var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
|
| 1683 |
+
inner;
|
| 1684 |
+
outputOptions;
|
| 1685 |
+
normalizedOutputPlugins;
|
| 1686 |
+
constructor(inner, outputOptions, normalizedOutputPlugins) {
|
| 1687 |
+
super();
|
| 1688 |
+
this.inner = inner;
|
| 1689 |
+
this.outputOptions = outputOptions;
|
| 1690 |
+
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
| 1691 |
+
}
|
| 1692 |
+
get dir() {
|
| 1693 |
+
return this.inner.dir ?? void 0;
|
| 1694 |
+
}
|
| 1695 |
+
get entryFileNames() {
|
| 1696 |
+
return this.inner.entryFilenames || this.outputOptions.entryFileNames;
|
| 1697 |
+
}
|
| 1698 |
+
get chunkFileNames() {
|
| 1699 |
+
return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
|
| 1700 |
+
}
|
| 1701 |
+
get assetFileNames() {
|
| 1702 |
+
return this.inner.assetFilenames || this.outputOptions.assetFileNames;
|
| 1703 |
+
}
|
| 1704 |
+
get format() {
|
| 1705 |
+
return this.inner.format;
|
| 1706 |
+
}
|
| 1707 |
+
get exports() {
|
| 1708 |
+
return this.inner.exports;
|
| 1709 |
+
}
|
| 1710 |
+
get sourcemap() {
|
| 1711 |
+
return this.inner.sourcemap;
|
| 1712 |
+
}
|
| 1713 |
+
get sourcemapBaseUrl() {
|
| 1714 |
+
return this.inner.sourcemapBaseUrl ?? void 0;
|
| 1715 |
+
}
|
| 1716 |
+
get shimMissingExports() {
|
| 1717 |
+
return this.inner.shimMissingExports;
|
| 1718 |
+
}
|
| 1719 |
+
get name() {
|
| 1720 |
+
return this.inner.name ?? void 0;
|
| 1721 |
+
}
|
| 1722 |
+
get file() {
|
| 1723 |
+
return this.inner.file ?? void 0;
|
| 1724 |
+
}
|
| 1725 |
+
get codeSplitting() {
|
| 1726 |
+
return this.inner.codeSplitting;
|
| 1727 |
+
}
|
| 1728 |
+
/**
|
| 1729 |
+
* @deprecated Use `codeSplitting` instead.
|
| 1730 |
+
*/
|
| 1731 |
+
get inlineDynamicImports() {
|
| 1732 |
+
return !this.inner.codeSplitting;
|
| 1733 |
+
}
|
| 1734 |
+
get dynamicImportInCjs() {
|
| 1735 |
+
return this.inner.dynamicImportInCjs;
|
| 1736 |
+
}
|
| 1737 |
+
get externalLiveBindings() {
|
| 1738 |
+
return this.inner.externalLiveBindings;
|
| 1739 |
+
}
|
| 1740 |
+
get banner() {
|
| 1741 |
+
return normalizeAddon(this.outputOptions.banner);
|
| 1742 |
+
}
|
| 1743 |
+
get footer() {
|
| 1744 |
+
return normalizeAddon(this.outputOptions.footer);
|
| 1745 |
+
}
|
| 1746 |
+
get postBanner() {
|
| 1747 |
+
return normalizeAddon(this.outputOptions.postBanner);
|
| 1748 |
+
}
|
| 1749 |
+
get postFooter() {
|
| 1750 |
+
return normalizeAddon(this.outputOptions.postFooter);
|
| 1751 |
+
}
|
| 1752 |
+
get intro() {
|
| 1753 |
+
return normalizeAddon(this.outputOptions.intro);
|
| 1754 |
+
}
|
| 1755 |
+
get outro() {
|
| 1756 |
+
return normalizeAddon(this.outputOptions.outro);
|
| 1757 |
+
}
|
| 1758 |
+
get esModule() {
|
| 1759 |
+
return this.inner.esModule;
|
| 1760 |
+
}
|
| 1761 |
+
get extend() {
|
| 1762 |
+
return this.inner.extend;
|
| 1763 |
+
}
|
| 1764 |
+
get globals() {
|
| 1765 |
+
return this.inner.globals || this.outputOptions.globals;
|
| 1766 |
+
}
|
| 1767 |
+
get paths() {
|
| 1768 |
+
return this.outputOptions.paths;
|
| 1769 |
+
}
|
| 1770 |
+
get hashCharacters() {
|
| 1771 |
+
return this.inner.hashCharacters;
|
| 1772 |
+
}
|
| 1773 |
+
get sourcemapDebugIds() {
|
| 1774 |
+
return this.inner.sourcemapDebugIds;
|
| 1775 |
+
}
|
| 1776 |
+
get sourcemapExcludeSources() {
|
| 1777 |
+
return this.inner.sourcemapExcludeSources;
|
| 1778 |
+
}
|
| 1779 |
+
get sourcemapIgnoreList() {
|
| 1780 |
+
return this.outputOptions.sourcemapIgnoreList;
|
| 1781 |
+
}
|
| 1782 |
+
get sourcemapPathTransform() {
|
| 1783 |
+
return this.outputOptions.sourcemapPathTransform;
|
| 1784 |
+
}
|
| 1785 |
+
get minify() {
|
| 1786 |
+
let ret = this.inner.minify;
|
| 1787 |
+
if (typeof ret === "object" && ret !== null) {
|
| 1788 |
+
delete ret["codegen"];
|
| 1789 |
+
delete ret["module"];
|
| 1790 |
+
delete ret["sourcemap"];
|
| 1791 |
+
}
|
| 1792 |
+
return ret;
|
| 1793 |
+
}
|
| 1794 |
+
get legalComments() {
|
| 1795 |
+
return this.inner.legalComments;
|
| 1796 |
+
}
|
| 1797 |
+
get comments() {
|
| 1798 |
+
const c = this.inner.comments;
|
| 1799 |
+
return {
|
| 1800 |
+
legal: c.legal ?? true,
|
| 1801 |
+
annotation: c.annotation ?? true,
|
| 1802 |
+
jsdoc: c.jsdoc ?? true
|
| 1803 |
+
};
|
| 1804 |
+
}
|
| 1805 |
+
get polyfillRequire() {
|
| 1806 |
+
return this.inner.polyfillRequire;
|
| 1807 |
+
}
|
| 1808 |
+
get plugins() {
|
| 1809 |
+
return this.normalizedOutputPlugins;
|
| 1810 |
+
}
|
| 1811 |
+
get preserveModules() {
|
| 1812 |
+
return this.inner.preserveModules;
|
| 1813 |
+
}
|
| 1814 |
+
get preserveModulesRoot() {
|
| 1815 |
+
return this.inner.preserveModulesRoot;
|
| 1816 |
+
}
|
| 1817 |
+
get virtualDirname() {
|
| 1818 |
+
return this.inner.virtualDirname;
|
| 1819 |
+
}
|
| 1820 |
+
get topLevelVar() {
|
| 1821 |
+
return this.inner.topLevelVar ?? false;
|
| 1822 |
+
}
|
| 1823 |
+
get minifyInternalExports() {
|
| 1824 |
+
return this.inner.minifyInternalExports ?? false;
|
| 1825 |
+
}
|
| 1826 |
+
};
|
| 1827 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "dir", null);
|
| 1828 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "entryFileNames", null);
|
| 1829 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "chunkFileNames", null);
|
| 1830 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "assetFileNames", null);
|
| 1831 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "format", null);
|
| 1832 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "exports", null);
|
| 1833 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemap", null);
|
| 1834 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapBaseUrl", null);
|
| 1835 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "shimMissingExports", null);
|
| 1836 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "name", null);
|
| 1837 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "file", null);
|
| 1838 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "codeSplitting", null);
|
| 1839 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "inlineDynamicImports", null);
|
| 1840 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "dynamicImportInCjs", null);
|
| 1841 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "externalLiveBindings", null);
|
| 1842 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "banner", null);
|
| 1843 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "footer", null);
|
| 1844 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "postBanner", null);
|
| 1845 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "postFooter", null);
|
| 1846 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "intro", null);
|
| 1847 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "outro", null);
|
| 1848 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "esModule", null);
|
| 1849 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "extend", null);
|
| 1850 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "globals", null);
|
| 1851 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "paths", null);
|
| 1852 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "hashCharacters", null);
|
| 1853 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapDebugIds", null);
|
| 1854 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapExcludeSources", null);
|
| 1855 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapIgnoreList", null);
|
| 1856 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapPathTransform", null);
|
| 1857 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "minify", null);
|
| 1858 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "legalComments", null);
|
| 1859 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "comments", null);
|
| 1860 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "polyfillRequire", null);
|
| 1861 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "plugins", null);
|
| 1862 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "preserveModules", null);
|
| 1863 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "preserveModulesRoot", null);
|
| 1864 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "virtualDirname", null);
|
| 1865 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "topLevelVar", null);
|
| 1866 |
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "minifyInternalExports", null);
|
| 1867 |
+
function normalizeAddon(value) {
|
| 1868 |
+
if (typeof value === "function") return value;
|
| 1869 |
+
return () => value || "";
|
| 1870 |
+
}
|
| 1871 |
+
//#endregion
|
| 1872 |
+
//#region src/plugin/plugin-context-data.ts
|
| 1873 |
+
var PluginContextData = class {
|
| 1874 |
+
onLog;
|
| 1875 |
+
outputOptions;
|
| 1876 |
+
normalizedInputPlugins;
|
| 1877 |
+
normalizedOutputPlugins;
|
| 1878 |
+
moduleOptionMap = /* @__PURE__ */ new Map();
|
| 1879 |
+
resolveOptionsMap = /* @__PURE__ */ new Map();
|
| 1880 |
+
loadModulePromiseMap = /* @__PURE__ */ new Map();
|
| 1881 |
+
renderedChunkMeta = null;
|
| 1882 |
+
normalizedInputOptions = null;
|
| 1883 |
+
normalizedOutputOptions = null;
|
| 1884 |
+
constructor(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins) {
|
| 1885 |
+
this.onLog = onLog;
|
| 1886 |
+
this.outputOptions = outputOptions;
|
| 1887 |
+
this.normalizedInputPlugins = normalizedInputPlugins;
|
| 1888 |
+
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
| 1889 |
+
}
|
| 1890 |
+
updateModuleOption(id, option) {
|
| 1891 |
+
const existing = this.moduleOptionMap.get(id);
|
| 1892 |
+
if (existing) {
|
| 1893 |
+
if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
|
| 1894 |
+
if (option.meta != null) Object.assign(existing.meta, option.meta);
|
| 1895 |
+
if (option.invalidate != null) existing.invalidate = option.invalidate;
|
| 1896 |
+
} else {
|
| 1897 |
+
this.moduleOptionMap.set(id, option);
|
| 1898 |
+
return option;
|
| 1899 |
+
}
|
| 1900 |
+
return existing;
|
| 1901 |
+
}
|
| 1902 |
+
getModuleOption(id) {
|
| 1903 |
+
const option = this.moduleOptionMap.get(id);
|
| 1904 |
+
if (!option) {
|
| 1905 |
+
const raw = {
|
| 1906 |
+
moduleSideEffects: null,
|
| 1907 |
+
meta: {}
|
| 1908 |
+
};
|
| 1909 |
+
this.moduleOptionMap.set(id, raw);
|
| 1910 |
+
return raw;
|
| 1911 |
+
}
|
| 1912 |
+
return option;
|
| 1913 |
+
}
|
| 1914 |
+
getModuleInfo(id, context) {
|
| 1915 |
+
const bindingInfo = context.getModuleInfo(id);
|
| 1916 |
+
if (bindingInfo) {
|
| 1917 |
+
const info = transformModuleInfo(bindingInfo, this.getModuleOption(id));
|
| 1918 |
+
return this.proxyModuleInfo(id, info);
|
| 1919 |
+
}
|
| 1920 |
+
return null;
|
| 1921 |
+
}
|
| 1922 |
+
proxyModuleInfo(id, info) {
|
| 1923 |
+
let moduleSideEffects = info.moduleSideEffects;
|
| 1924 |
+
Object.defineProperty(info, "moduleSideEffects", {
|
| 1925 |
+
get() {
|
| 1926 |
+
return moduleSideEffects;
|
| 1927 |
+
},
|
| 1928 |
+
set: (v) => {
|
| 1929 |
+
this.updateModuleOption(id, {
|
| 1930 |
+
moduleSideEffects: v,
|
| 1931 |
+
meta: info.meta,
|
| 1932 |
+
invalidate: true
|
| 1933 |
+
});
|
| 1934 |
+
moduleSideEffects = v;
|
| 1935 |
+
}
|
| 1936 |
+
});
|
| 1937 |
+
return info;
|
| 1938 |
+
}
|
| 1939 |
+
getModuleIds(context) {
|
| 1940 |
+
return context.getModuleIds().values();
|
| 1941 |
+
}
|
| 1942 |
+
saveResolveOptions(options) {
|
| 1943 |
+
const index = this.resolveOptionsMap.size;
|
| 1944 |
+
this.resolveOptionsMap.set(index, options);
|
| 1945 |
+
return index;
|
| 1946 |
+
}
|
| 1947 |
+
getSavedResolveOptions(receipt) {
|
| 1948 |
+
return this.resolveOptionsMap.get(receipt);
|
| 1949 |
+
}
|
| 1950 |
+
removeSavedResolveOptions(receipt) {
|
| 1951 |
+
this.resolveOptionsMap.delete(receipt);
|
| 1952 |
+
}
|
| 1953 |
+
setRenderChunkMeta(meta) {
|
| 1954 |
+
this.renderedChunkMeta = meta;
|
| 1955 |
+
}
|
| 1956 |
+
getRenderChunkMeta() {
|
| 1957 |
+
return this.renderedChunkMeta;
|
| 1958 |
+
}
|
| 1959 |
+
getInputOptions(opts) {
|
| 1960 |
+
this.normalizedInputOptions ??= new NormalizedInputOptionsImpl(opts, this.onLog, this.normalizedInputPlugins);
|
| 1961 |
+
return this.normalizedInputOptions;
|
| 1962 |
+
}
|
| 1963 |
+
getOutputOptions(opts) {
|
| 1964 |
+
this.normalizedOutputOptions ??= new NormalizedOutputOptionsImpl(opts, this.outputOptions, this.normalizedOutputPlugins);
|
| 1965 |
+
return this.normalizedOutputOptions;
|
| 1966 |
+
}
|
| 1967 |
+
clear() {
|
| 1968 |
+
this.renderedChunkMeta = null;
|
| 1969 |
+
this.loadModulePromiseMap.clear();
|
| 1970 |
+
}
|
| 1971 |
+
};
|
| 1972 |
+
//#endregion
|
| 1973 |
+
//#region src/utils/normalize-transform-options.ts
|
| 1974 |
+
/**
|
| 1975 |
+
* Normalizes transform options by extracting `define`, `inject`, and `dropLabels` separately from OXC transform options.
|
| 1976 |
+
*
|
| 1977 |
+
* Prioritizes values from `transform.define`, `transform.inject`, and `transform.dropLabels` over deprecated top-level options.
|
| 1978 |
+
*/
|
| 1979 |
+
function normalizeTransformOptions(inputOptions) {
|
| 1980 |
+
const transform = inputOptions.transform;
|
| 1981 |
+
const define = transform?.define ? Object.entries(transform.define) : void 0;
|
| 1982 |
+
const inject = transform?.inject;
|
| 1983 |
+
const dropLabels = transform?.dropLabels;
|
| 1984 |
+
let oxcTransformOptions;
|
| 1985 |
+
if (transform) {
|
| 1986 |
+
const { define: _define, inject: _inject, dropLabels: _dropLabels, ...rest } = transform;
|
| 1987 |
+
if (Object.keys(rest).length > 0) {
|
| 1988 |
+
if (rest.jsx === false) rest.jsx = "disable";
|
| 1989 |
+
oxcTransformOptions = rest;
|
| 1990 |
+
}
|
| 1991 |
+
}
|
| 1992 |
+
return {
|
| 1993 |
+
define,
|
| 1994 |
+
inject,
|
| 1995 |
+
dropLabels,
|
| 1996 |
+
oxcTransformOptions
|
| 1997 |
+
};
|
| 1998 |
+
}
|
| 1999 |
+
//#endregion
|
| 2000 |
+
//#region src/utils/bindingify-input-options.ts
|
| 2001 |
+
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedInputPlugins, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
| 2002 |
+
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins);
|
| 2003 |
+
const plugins = rawPlugins.map((plugin) => {
|
| 2004 |
+
if ("_parallel" in plugin) return;
|
| 2005 |
+
if (plugin instanceof BuiltinPlugin) switch (plugin.name) {
|
| 2006 |
+
case "builtin:vite-manifest": return bindingifyManifestPlugin(plugin, pluginContextData);
|
| 2007 |
+
default: return bindingifyBuiltInPlugin(plugin);
|
| 2008 |
+
}
|
| 2009 |
+
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
| 2010 |
+
});
|
| 2011 |
+
const normalizedTransform = normalizeTransformOptions(inputOptions);
|
| 2012 |
+
return {
|
| 2013 |
+
input: bindingifyInput(inputOptions.input),
|
| 2014 |
+
plugins,
|
| 2015 |
+
cwd: inputOptions.cwd ?? process.cwd(),
|
| 2016 |
+
external: bindingifyExternal(inputOptions.external),
|
| 2017 |
+
resolve: bindingifyResolve(inputOptions.resolve),
|
| 2018 |
+
platform: inputOptions.platform,
|
| 2019 |
+
shimMissingExports: inputOptions.shimMissingExports,
|
| 2020 |
+
logLevel: bindingifyLogLevel(logLevel),
|
| 2021 |
+
onLog,
|
| 2022 |
+
treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
|
| 2023 |
+
moduleTypes: inputOptions.moduleTypes,
|
| 2024 |
+
define: normalizedTransform.define,
|
| 2025 |
+
inject: bindingifyInject(normalizedTransform.inject),
|
| 2026 |
+
experimental: bindingifyExperimental(inputOptions.experimental),
|
| 2027 |
+
profilerNames: outputOptions.generatedCode?.profilerNames,
|
| 2028 |
+
transform: normalizedTransform.oxcTransformOptions,
|
| 2029 |
+
watch: bindingifyWatch(inputOptions.watch),
|
| 2030 |
+
dropLabels: normalizedTransform.dropLabels,
|
| 2031 |
+
keepNames: outputOptions.keepNames,
|
| 2032 |
+
checks: inputOptions.checks,
|
| 2033 |
+
deferSyncScanData: () => {
|
| 2034 |
+
let ret = [];
|
| 2035 |
+
pluginContextData.moduleOptionMap.forEach((value, key) => {
|
| 2036 |
+
if (value.invalidate) ret.push({
|
| 2037 |
+
id: key,
|
| 2038 |
+
sideEffects: value.moduleSideEffects ?? void 0
|
| 2039 |
+
});
|
| 2040 |
+
});
|
| 2041 |
+
return ret;
|
| 2042 |
+
},
|
| 2043 |
+
makeAbsoluteExternalsRelative: bindingifyMakeAbsoluteExternalsRelative(inputOptions.makeAbsoluteExternalsRelative),
|
| 2044 |
+
devtools: inputOptions.devtools,
|
| 2045 |
+
invalidateJsSideCache: pluginContextData.clear.bind(pluginContextData),
|
| 2046 |
+
preserveEntrySignatures: bindingifyPreserveEntrySignatures(inputOptions.preserveEntrySignatures),
|
| 2047 |
+
optimization: inputOptions.optimization,
|
| 2048 |
+
context: inputOptions.context,
|
| 2049 |
+
tsconfig: inputOptions.resolve?.tsconfigFilename ?? inputOptions.tsconfig
|
| 2050 |
+
};
|
| 2051 |
+
}
|
| 2052 |
+
function bindingifyDevMode(devMode) {
|
| 2053 |
+
if (devMode) {
|
| 2054 |
+
if (typeof devMode === "boolean") return devMode ? {} : void 0;
|
| 2055 |
+
return devMode;
|
| 2056 |
+
}
|
| 2057 |
+
}
|
| 2058 |
+
function bindingifyAttachDebugInfo(attachDebugInfo) {
|
| 2059 |
+
switch (attachDebugInfo) {
|
| 2060 |
+
case void 0: return;
|
| 2061 |
+
case "full": return import_binding.BindingAttachDebugInfo.Full;
|
| 2062 |
+
case "simple": return import_binding.BindingAttachDebugInfo.Simple;
|
| 2063 |
+
case "none": return import_binding.BindingAttachDebugInfo.None;
|
| 2064 |
+
}
|
| 2065 |
+
}
|
| 2066 |
+
function bindingifyExternal(external) {
|
| 2067 |
+
if (external) {
|
| 2068 |
+
if (typeof external === "function") return (id, importer, isResolved) => {
|
| 2069 |
+
if (id.startsWith("\0")) return false;
|
| 2070 |
+
return external(id, importer, isResolved) ?? false;
|
| 2071 |
+
};
|
| 2072 |
+
return arraify(external);
|
| 2073 |
+
}
|
| 2074 |
+
}
|
| 2075 |
+
function bindingifyExperimental(experimental) {
|
| 2076 |
+
let chunkModulesOrder = import_binding.BindingChunkModuleOrderBy.ExecOrder;
|
| 2077 |
+
if (experimental?.chunkModulesOrder) switch (experimental.chunkModulesOrder) {
|
| 2078 |
+
case "exec-order":
|
| 2079 |
+
chunkModulesOrder = import_binding.BindingChunkModuleOrderBy.ExecOrder;
|
| 2080 |
+
break;
|
| 2081 |
+
case "module-id":
|
| 2082 |
+
chunkModulesOrder = import_binding.BindingChunkModuleOrderBy.ModuleId;
|
| 2083 |
+
break;
|
| 2084 |
+
default: throw new Error(`Unexpected chunkModulesOrder: ${experimental.chunkModulesOrder}`);
|
| 2085 |
+
}
|
| 2086 |
+
return {
|
| 2087 |
+
viteMode: experimental?.viteMode,
|
| 2088 |
+
resolveNewUrlToAsset: experimental?.resolveNewUrlToAsset,
|
| 2089 |
+
devMode: bindingifyDevMode(experimental?.devMode),
|
| 2090 |
+
attachDebugInfo: bindingifyAttachDebugInfo(experimental?.attachDebugInfo),
|
| 2091 |
+
chunkModulesOrder,
|
| 2092 |
+
chunkImportMap: experimental?.chunkImportMap,
|
| 2093 |
+
onDemandWrapping: experimental?.onDemandWrapping,
|
| 2094 |
+
incrementalBuild: experimental?.incrementalBuild,
|
| 2095 |
+
nativeMagicString: experimental?.nativeMagicString,
|
| 2096 |
+
chunkOptimization: experimental?.chunkOptimization,
|
| 2097 |
+
lazyBarrel: experimental?.lazyBarrel
|
| 2098 |
+
};
|
| 2099 |
+
}
|
| 2100 |
+
function bindingifyResolve(resolve) {
|
| 2101 |
+
const yarnPnp = typeof process === "object" && !!process.versions?.pnp;
|
| 2102 |
+
if (resolve) {
|
| 2103 |
+
const { alias, extensionAlias, ...rest } = resolve;
|
| 2104 |
+
return {
|
| 2105 |
+
alias: alias ? Object.entries(alias).map(([name, replacement]) => ({
|
| 2106 |
+
find: name,
|
| 2107 |
+
replacements: replacement === false ? [void 0] : arraify(replacement)
|
| 2108 |
+
})) : void 0,
|
| 2109 |
+
extensionAlias: extensionAlias ? Object.entries(extensionAlias).map(([name, value]) => ({
|
| 2110 |
+
target: name,
|
| 2111 |
+
replacements: value
|
| 2112 |
+
})) : void 0,
|
| 2113 |
+
yarnPnp,
|
| 2114 |
+
...rest
|
| 2115 |
+
};
|
| 2116 |
+
} else return { yarnPnp };
|
| 2117 |
+
}
|
| 2118 |
+
function bindingifyInject(inject) {
|
| 2119 |
+
if (inject) return Object.entries(inject).map(([alias, item]) => {
|
| 2120 |
+
if (Array.isArray(item)) {
|
| 2121 |
+
if (item[1] === "*") return {
|
| 2122 |
+
tagNamespace: true,
|
| 2123 |
+
alias,
|
| 2124 |
+
from: item[0]
|
| 2125 |
+
};
|
| 2126 |
+
return {
|
| 2127 |
+
tagNamed: true,
|
| 2128 |
+
alias,
|
| 2129 |
+
from: item[0],
|
| 2130 |
+
imported: item[1]
|
| 2131 |
+
};
|
| 2132 |
+
} else return {
|
| 2133 |
+
tagNamed: true,
|
| 2134 |
+
imported: "default",
|
| 2135 |
+
alias,
|
| 2136 |
+
from: item
|
| 2137 |
+
};
|
| 2138 |
+
});
|
| 2139 |
+
}
|
| 2140 |
+
function bindingifyLogLevel(logLevel) {
|
| 2141 |
+
switch (logLevel) {
|
| 2142 |
+
case "silent": return import_binding.BindingLogLevel.Silent;
|
| 2143 |
+
case "debug": return import_binding.BindingLogLevel.Debug;
|
| 2144 |
+
case "warn": return import_binding.BindingLogLevel.Warn;
|
| 2145 |
+
case "info": return import_binding.BindingLogLevel.Info;
|
| 2146 |
+
default: throw new Error(`Unexpected log level: ${logLevel}`);
|
| 2147 |
+
}
|
| 2148 |
+
}
|
| 2149 |
+
function bindingifyInput(input) {
|
| 2150 |
+
if (input === void 0) return [];
|
| 2151 |
+
if (typeof input === "string") return [{ import: input }];
|
| 2152 |
+
if (Array.isArray(input)) return input.map((src) => ({ import: src }));
|
| 2153 |
+
return Object.entries(input).map(([name, import_path]) => {
|
| 2154 |
+
return {
|
| 2155 |
+
name,
|
| 2156 |
+
import: import_path
|
| 2157 |
+
};
|
| 2158 |
+
});
|
| 2159 |
+
}
|
| 2160 |
+
function bindingifyWatch(watch) {
|
| 2161 |
+
if (watch) {
|
| 2162 |
+
if (watch.notify) console.warn("The \"watch.notify\" option is deprecated. Please use \"watch.watcher\" instead.");
|
| 2163 |
+
const watcher = {
|
| 2164 |
+
...watch.notify,
|
| 2165 |
+
...watch.watcher
|
| 2166 |
+
};
|
| 2167 |
+
return {
|
| 2168 |
+
buildDelay: watch.buildDelay,
|
| 2169 |
+
skipWrite: watch.skipWrite,
|
| 2170 |
+
usePolling: watcher.usePolling,
|
| 2171 |
+
pollInterval: watcher.pollInterval,
|
| 2172 |
+
compareContentsForPolling: watcher.compareContentsForPolling,
|
| 2173 |
+
useDebounce: watcher.useDebounce,
|
| 2174 |
+
debounceDelay: watcher.debounceDelay,
|
| 2175 |
+
debounceTickRate: watcher.debounceTickRate,
|
| 2176 |
+
include: normalizedStringOrRegex(watch.include),
|
| 2177 |
+
exclude: normalizedStringOrRegex(watch.exclude),
|
| 2178 |
+
onInvalidate: (...args) => watch.onInvalidate?.(...args)
|
| 2179 |
+
};
|
| 2180 |
+
}
|
| 2181 |
+
}
|
| 2182 |
+
function bindingifyTreeshakeOptions(config) {
|
| 2183 |
+
if (config === false) return;
|
| 2184 |
+
if (config === true || config === void 0) return { moduleSideEffects: true };
|
| 2185 |
+
let normalizedConfig = {
|
| 2186 |
+
moduleSideEffects: true,
|
| 2187 |
+
annotations: config.annotations,
|
| 2188 |
+
manualPureFunctions: config.manualPureFunctions,
|
| 2189 |
+
unknownGlobalSideEffects: config.unknownGlobalSideEffects,
|
| 2190 |
+
invalidImportSideEffects: config.invalidImportSideEffects,
|
| 2191 |
+
commonjs: config.commonjs
|
| 2192 |
+
};
|
| 2193 |
+
switch (config.propertyReadSideEffects) {
|
| 2194 |
+
case "always":
|
| 2195 |
+
normalizedConfig.propertyReadSideEffects = import_binding.BindingPropertyReadSideEffects.Always;
|
| 2196 |
+
break;
|
| 2197 |
+
case false:
|
| 2198 |
+
normalizedConfig.propertyReadSideEffects = import_binding.BindingPropertyReadSideEffects.False;
|
| 2199 |
+
break;
|
| 2200 |
+
default:
|
| 2201 |
+
}
|
| 2202 |
+
switch (config.propertyWriteSideEffects) {
|
| 2203 |
+
case "always":
|
| 2204 |
+
normalizedConfig.propertyWriteSideEffects = import_binding.BindingPropertyWriteSideEffects.Always;
|
| 2205 |
+
break;
|
| 2206 |
+
case false:
|
| 2207 |
+
normalizedConfig.propertyWriteSideEffects = import_binding.BindingPropertyWriteSideEffects.False;
|
| 2208 |
+
break;
|
| 2209 |
+
default:
|
| 2210 |
+
}
|
| 2211 |
+
if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
|
| 2212 |
+
else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
|
| 2213 |
+
external: true,
|
| 2214 |
+
sideEffects: false
|
| 2215 |
+
}, {
|
| 2216 |
+
external: false,
|
| 2217 |
+
sideEffects: true
|
| 2218 |
+
}];
|
| 2219 |
+
else normalizedConfig.moduleSideEffects = config.moduleSideEffects;
|
| 2220 |
+
return normalizedConfig;
|
| 2221 |
+
}
|
| 2222 |
+
function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative) {
|
| 2223 |
+
if (makeAbsoluteExternalsRelative === "ifRelativeSource") return { type: "IfRelativeSource" };
|
| 2224 |
+
if (typeof makeAbsoluteExternalsRelative === "boolean") return {
|
| 2225 |
+
type: "Bool",
|
| 2226 |
+
field0: makeAbsoluteExternalsRelative
|
| 2227 |
+
};
|
| 2228 |
+
}
|
| 2229 |
+
function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
|
| 2230 |
+
if (preserveEntrySignatures == void 0) return;
|
| 2231 |
+
else if (typeof preserveEntrySignatures === "string") return {
|
| 2232 |
+
type: "String",
|
| 2233 |
+
field0: preserveEntrySignatures
|
| 2234 |
+
};
|
| 2235 |
+
else return {
|
| 2236 |
+
type: "Bool",
|
| 2237 |
+
field0: preserveEntrySignatures
|
| 2238 |
+
};
|
| 2239 |
+
}
|
| 2240 |
+
//#endregion
|
| 2241 |
+
export { version as C, description as S, LOG_LEVEL_INFO as _, RolldownMagicString as a, RUNTIME_MODULE_ID as b, __decorate as c, PlainObjectLike as d, MinimalPluginContextImpl as f, LOG_LEVEL_ERROR as g, LOG_LEVEL_DEBUG as h, transformModuleInfo as i, transformAssetSource as l, normalizeLog as m, PluginContextData as n, transformToRollupOutput as o, normalizeHook as p, bindingifyPlugin as r, transformRenderedChunk as s, bindingifyInputOptions as t, lazyProp as u, LOG_LEVEL_WARN as v, VERSION as x, logLevelPriority as y };
|
shared/node_modules/rolldown/dist/shared/constructors-Bx1tSad6.d.mts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { D as BindingViteResolvePluginConfig, E as BindingViteReporterPluginConfig, S as BindingViteJsonPluginConfig, T as BindingViteReactRefreshWrapperPluginConfig, b as BindingViteDynamicImportVarsPluginConfig, l as BindingIsolatedDeclarationPluginConfig, s as BindingEsmExternalRequirePluginConfig, w as BindingViteModulePreloadPolyfillPluginConfig, x as BindingViteImportGlobPluginConfig, y as BindingViteBuildImportAnalysisPluginConfig } from "./binding-DgGsNpT9.mjs";
|
| 2 |
+
import { P as BuiltinPlugin, Ut as StringOrRegExp } from "./define-config-ChOOV2QZ.mjs";
|
| 3 |
+
|
| 4 |
+
//#region src/builtin-plugin/constructors.d.ts
|
| 5 |
+
declare function viteModulePreloadPolyfillPlugin(config?: BindingViteModulePreloadPolyfillPluginConfig): BuiltinPlugin;
|
| 6 |
+
type DynamicImportVarsPluginConfig = Omit<BindingViteDynamicImportVarsPluginConfig, "include" | "exclude"> & {
|
| 7 |
+
include?: StringOrRegExp | StringOrRegExp[];
|
| 8 |
+
exclude?: StringOrRegExp | StringOrRegExp[];
|
| 9 |
+
};
|
| 10 |
+
declare function viteDynamicImportVarsPlugin(config?: DynamicImportVarsPluginConfig): BuiltinPlugin;
|
| 11 |
+
declare function viteImportGlobPlugin(config?: BindingViteImportGlobPluginConfig): BuiltinPlugin;
|
| 12 |
+
declare function viteReporterPlugin(config: BindingViteReporterPluginConfig): BuiltinPlugin;
|
| 13 |
+
declare function viteWasmFallbackPlugin(): BuiltinPlugin;
|
| 14 |
+
declare function viteLoadFallbackPlugin(): BuiltinPlugin;
|
| 15 |
+
declare function viteJsonPlugin(config: BindingViteJsonPluginConfig): BuiltinPlugin;
|
| 16 |
+
declare function viteBuildImportAnalysisPlugin(config: BindingViteBuildImportAnalysisPluginConfig): BuiltinPlugin;
|
| 17 |
+
declare function viteResolvePlugin(config: Omit<BindingViteResolvePluginConfig, "yarnPnp">): BuiltinPlugin;
|
| 18 |
+
declare function isolatedDeclarationPlugin(config?: BindingIsolatedDeclarationPluginConfig): BuiltinPlugin;
|
| 19 |
+
declare function viteWebWorkerPostPlugin(): BuiltinPlugin;
|
| 20 |
+
/**
|
| 21 |
+
* A plugin that converts CommonJS require() calls for external dependencies into ESM import statements.
|
| 22 |
+
*
|
| 23 |
+
* @see https://rolldown.rs/builtin-plugins/esm-external-require
|
| 24 |
+
* @category Builtin Plugins
|
| 25 |
+
*/
|
| 26 |
+
declare function esmExternalRequirePlugin(config?: BindingEsmExternalRequirePluginConfig): BuiltinPlugin;
|
| 27 |
+
type ViteReactRefreshWrapperPluginConfig = Omit<BindingViteReactRefreshWrapperPluginConfig, "include" | "exclude"> & {
|
| 28 |
+
include?: StringOrRegExp | StringOrRegExp[];
|
| 29 |
+
exclude?: StringOrRegExp | StringOrRegExp[];
|
| 30 |
+
};
|
| 31 |
+
/**
|
| 32 |
+
* This plugin should not be used for Rolldown.
|
| 33 |
+
*/
|
| 34 |
+
declare function oxcRuntimePlugin(): BuiltinPlugin;
|
| 35 |
+
declare function viteReactRefreshWrapperPlugin(config: ViteReactRefreshWrapperPluginConfig): BuiltinPlugin;
|
| 36 |
+
//#endregion
|
| 37 |
+
export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, viteWebWorkerPostPlugin as m, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWasmFallbackPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };
|
shared/node_modules/rolldown/dist/shared/constructors-DnT9y_13.mjs
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-DGbe3BlX.mjs";
|
| 2 |
+
//#region src/builtin-plugin/constructors.ts
|
| 3 |
+
function viteModulePreloadPolyfillPlugin(config) {
|
| 4 |
+
return new BuiltinPlugin("builtin:vite-module-preload-polyfill", config);
|
| 5 |
+
}
|
| 6 |
+
function viteDynamicImportVarsPlugin(config) {
|
| 7 |
+
if (config) {
|
| 8 |
+
config.include = normalizedStringOrRegex(config.include);
|
| 9 |
+
config.exclude = normalizedStringOrRegex(config.exclude);
|
| 10 |
+
}
|
| 11 |
+
return new BuiltinPlugin("builtin:vite-dynamic-import-vars", config);
|
| 12 |
+
}
|
| 13 |
+
function viteImportGlobPlugin(config) {
|
| 14 |
+
return new BuiltinPlugin("builtin:vite-import-glob", config);
|
| 15 |
+
}
|
| 16 |
+
function viteReporterPlugin(config) {
|
| 17 |
+
return new BuiltinPlugin("builtin:vite-reporter", config);
|
| 18 |
+
}
|
| 19 |
+
function viteWasmFallbackPlugin() {
|
| 20 |
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-wasm-fallback"));
|
| 21 |
+
}
|
| 22 |
+
function viteLoadFallbackPlugin() {
|
| 23 |
+
return new BuiltinPlugin("builtin:vite-load-fallback");
|
| 24 |
+
}
|
| 25 |
+
function viteJsonPlugin(config) {
|
| 26 |
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-json", config));
|
| 27 |
+
}
|
| 28 |
+
function viteBuildImportAnalysisPlugin(config) {
|
| 29 |
+
return new BuiltinPlugin("builtin:vite-build-import-analysis", config);
|
| 30 |
+
}
|
| 31 |
+
function viteResolvePlugin(config) {
|
| 32 |
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-resolve", {
|
| 33 |
+
...config,
|
| 34 |
+
yarnPnp: typeof process === "object" && !!process.versions?.pnp
|
| 35 |
+
}));
|
| 36 |
+
}
|
| 37 |
+
function isolatedDeclarationPlugin(config) {
|
| 38 |
+
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
| 39 |
+
}
|
| 40 |
+
function viteWebWorkerPostPlugin() {
|
| 41 |
+
return new BuiltinPlugin("builtin:vite-web-worker-post");
|
| 42 |
+
}
|
| 43 |
+
/**
|
| 44 |
+
* A plugin that converts CommonJS require() calls for external dependencies into ESM import statements.
|
| 45 |
+
*
|
| 46 |
+
* @see https://rolldown.rs/builtin-plugins/esm-external-require
|
| 47 |
+
* @category Builtin Plugins
|
| 48 |
+
*/
|
| 49 |
+
function esmExternalRequirePlugin(config) {
|
| 50 |
+
const plugin = new BuiltinPlugin("builtin:esm-external-require", config);
|
| 51 |
+
plugin.enforce = "pre";
|
| 52 |
+
return plugin;
|
| 53 |
+
}
|
| 54 |
+
/**
|
| 55 |
+
* This plugin should not be used for Rolldown.
|
| 56 |
+
*/
|
| 57 |
+
function oxcRuntimePlugin() {
|
| 58 |
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:oxc-runtime"));
|
| 59 |
+
}
|
| 60 |
+
function viteReactRefreshWrapperPlugin(config) {
|
| 61 |
+
if (config) {
|
| 62 |
+
config.include = normalizedStringOrRegex(config.include);
|
| 63 |
+
config.exclude = normalizedStringOrRegex(config.exclude);
|
| 64 |
+
}
|
| 65 |
+
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-react-refresh-wrapper", config));
|
| 66 |
+
}
|
| 67 |
+
//#endregion
|
| 68 |
+
export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, viteWebWorkerPostPlugin as m, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWasmFallbackPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };
|
shared/node_modules/rolldown/dist/shared/define-config-ChOOV2QZ.d.mts
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
shared/node_modules/rolldown/dist/shared/define-config-Demdg3_4.mjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//#region src/utils/define-config.ts
|
| 2 |
+
function defineConfig(config) {
|
| 3 |
+
return config;
|
| 4 |
+
}
|
| 5 |
+
//#endregion
|
| 6 |
+
export { defineConfig as t };
|
shared/node_modules/rolldown/dist/shared/error-C0TrL0_H.mjs
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { t as require_binding } from "./binding-CfwqjDbP.mjs";
|
| 2 |
+
//#region src/types/sourcemap.ts
|
| 3 |
+
function bindingifySourcemap(map) {
|
| 4 |
+
if (map == null) return;
|
| 5 |
+
return { inner: typeof map === "string" ? map : {
|
| 6 |
+
file: map.file ?? void 0,
|
| 7 |
+
mappings: map.mappings,
|
| 8 |
+
sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
|
| 9 |
+
sources: map.sources?.map((s) => s ?? void 0),
|
| 10 |
+
sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
|
| 11 |
+
names: map.names,
|
| 12 |
+
x_google_ignoreList: map.x_google_ignoreList,
|
| 13 |
+
debugId: "debugId" in map ? map.debugId : void 0
|
| 14 |
+
} };
|
| 15 |
+
}
|
| 16 |
+
require_binding();
|
| 17 |
+
function unwrapBindingResult(container) {
|
| 18 |
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
|
| 19 |
+
return container;
|
| 20 |
+
}
|
| 21 |
+
function normalizeBindingResult(container) {
|
| 22 |
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
|
| 23 |
+
return container;
|
| 24 |
+
}
|
| 25 |
+
function normalizeBindingError(e) {
|
| 26 |
+
return e.type === "JsError" ? e.field0 : Object.assign(/* @__PURE__ */ new Error(), {
|
| 27 |
+
code: e.field0.kind,
|
| 28 |
+
kind: e.field0.kind,
|
| 29 |
+
message: e.field0.message,
|
| 30 |
+
id: e.field0.id,
|
| 31 |
+
exporter: e.field0.exporter,
|
| 32 |
+
loc: e.field0.loc,
|
| 33 |
+
pos: e.field0.pos,
|
| 34 |
+
stack: void 0
|
| 35 |
+
});
|
| 36 |
+
}
|
| 37 |
+
function aggregateBindingErrorsIntoJsError(rawErrors) {
|
| 38 |
+
const errors = rawErrors.map(normalizeBindingError);
|
| 39 |
+
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
| 40 |
+
for (let i = 0; i < errors.length; i++) {
|
| 41 |
+
summary += "\n";
|
| 42 |
+
if (i >= 5) {
|
| 43 |
+
summary += "...";
|
| 44 |
+
break;
|
| 45 |
+
}
|
| 46 |
+
summary += getErrorMessage(errors[i]);
|
| 47 |
+
}
|
| 48 |
+
const wrapper = new Error(summary);
|
| 49 |
+
Object.defineProperty(wrapper, "errors", {
|
| 50 |
+
configurable: true,
|
| 51 |
+
enumerable: true,
|
| 52 |
+
get: () => errors,
|
| 53 |
+
set: (value) => Object.defineProperty(wrapper, "errors", {
|
| 54 |
+
configurable: true,
|
| 55 |
+
enumerable: true,
|
| 56 |
+
value
|
| 57 |
+
})
|
| 58 |
+
});
|
| 59 |
+
return wrapper;
|
| 60 |
+
}
|
| 61 |
+
function getErrorMessage(e) {
|
| 62 |
+
if (Object.hasOwn(e, "kind")) return e.message;
|
| 63 |
+
let s = "";
|
| 64 |
+
if (e.plugin) s += `[plugin ${e.plugin}]`;
|
| 65 |
+
const id = e.id ?? e.loc?.file;
|
| 66 |
+
if (id) {
|
| 67 |
+
s += " " + id;
|
| 68 |
+
if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
|
| 69 |
+
}
|
| 70 |
+
if (s) s += "\n";
|
| 71 |
+
const message = `${e.name ?? "Error"}: ${e.message}`;
|
| 72 |
+
s += message;
|
| 73 |
+
if (e.frame) s = joinNewLine(s, e.frame);
|
| 74 |
+
if (e.stack) s = joinNewLine(s, e.stack.replace(message, ""));
|
| 75 |
+
if (e.cause) {
|
| 76 |
+
s = joinNewLine(s, "Caused by:");
|
| 77 |
+
s = joinNewLine(s, getErrorMessage(e.cause).split("\n").map((line) => " " + line).join("\n"));
|
| 78 |
+
}
|
| 79 |
+
return s;
|
| 80 |
+
}
|
| 81 |
+
function joinNewLine(s1, s2) {
|
| 82 |
+
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
|
| 83 |
+
}
|
| 84 |
+
//#endregion
|
| 85 |
+
export { bindingifySourcemap as a, unwrapBindingResult as i, normalizeBindingError as n, normalizeBindingResult as r, aggregateBindingErrorsIntoJsError as t };
|
shared/node_modules/rolldown/dist/shared/get-log-filter-BpNVNJ5-.d.mts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { a as RolldownLog } from "./logging-BSNejiLS.mjs";
|
| 2 |
+
|
| 3 |
+
//#region src/get-log-filter.d.ts
|
| 4 |
+
/**
|
| 5 |
+
* @param filters A list of log filters to apply
|
| 6 |
+
* @returns A function that tests whether a log should be output
|
| 7 |
+
*
|
| 8 |
+
* @category Config
|
| 9 |
+
*/
|
| 10 |
+
type GetLogFilter = (filters: string[]) => (log: RolldownLog) => boolean;
|
| 11 |
+
/**
|
| 12 |
+
* A helper function to generate log filters using the same syntax as the CLI.
|
| 13 |
+
*
|
| 14 |
+
* @example
|
| 15 |
+
* ```ts
|
| 16 |
+
* import { defineConfig } from 'rolldown';
|
| 17 |
+
* import { getLogFilter } from 'rolldown/getLogFilter';
|
| 18 |
+
*
|
| 19 |
+
* const logFilter = getLogFilter(['code:FOO', 'code:BAR']);
|
| 20 |
+
*
|
| 21 |
+
* export default defineConfig({
|
| 22 |
+
* input: 'main.js',
|
| 23 |
+
* onLog(level, log, handler) {
|
| 24 |
+
* if (logFilter(log)) {
|
| 25 |
+
* handler(level, log);
|
| 26 |
+
* }
|
| 27 |
+
* }
|
| 28 |
+
* });
|
| 29 |
+
* ```
|
| 30 |
+
*
|
| 31 |
+
* @category Config
|
| 32 |
+
*/
|
| 33 |
+
declare const getLogFilter: GetLogFilter;
|
| 34 |
+
//#endregion
|
| 35 |
+
export { getLogFilter as n, GetLogFilter as t };
|
shared/node_modules/rolldown/dist/shared/load-config-BDGEgD4M.mjs
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { t as rolldown } from "./rolldown-Bkyb2CgX.mjs";
|
| 2 |
+
import fs from "node:fs";
|
| 3 |
+
import path from "node:path";
|
| 4 |
+
import { readdir } from "node:fs/promises";
|
| 5 |
+
import { cwd } from "node:process";
|
| 6 |
+
import { pathToFileURL } from "node:url";
|
| 7 |
+
//#region src/utils/load-config.ts
|
| 8 |
+
async function bundleTsConfig(configFile, isEsm) {
|
| 9 |
+
const dirnameVarName = "injected_original_dirname";
|
| 10 |
+
const filenameVarName = "injected_original_filename";
|
| 11 |
+
const importMetaUrlVarName = "injected_original_import_meta_url";
|
| 12 |
+
const bundle = await rolldown({
|
| 13 |
+
input: configFile,
|
| 14 |
+
platform: "node",
|
| 15 |
+
resolve: { mainFields: ["main"] },
|
| 16 |
+
transform: { define: {
|
| 17 |
+
__dirname: dirnameVarName,
|
| 18 |
+
__filename: filenameVarName,
|
| 19 |
+
"import.meta.url": importMetaUrlVarName,
|
| 20 |
+
"import.meta.dirname": dirnameVarName,
|
| 21 |
+
"import.meta.filename": filenameVarName
|
| 22 |
+
} },
|
| 23 |
+
treeshake: false,
|
| 24 |
+
external: [/^[\w@][^:]/],
|
| 25 |
+
plugins: [{
|
| 26 |
+
name: "inject-file-scope-variables",
|
| 27 |
+
transform: {
|
| 28 |
+
filter: { id: /\.[cm]?[jt]s$/ },
|
| 29 |
+
async handler(code, id) {
|
| 30 |
+
return {
|
| 31 |
+
code: `const ${dirnameVarName} = ${JSON.stringify(path.dirname(id))};const ${filenameVarName} = ${JSON.stringify(id)};const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL(id).href)};` + code,
|
| 32 |
+
map: null
|
| 33 |
+
};
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}]
|
| 37 |
+
});
|
| 38 |
+
const outputDir = path.dirname(configFile);
|
| 39 |
+
const fileName = (await bundle.write({
|
| 40 |
+
dir: outputDir,
|
| 41 |
+
format: isEsm ? "esm" : "cjs",
|
| 42 |
+
sourcemap: "inline",
|
| 43 |
+
entryFileNames: `rolldown.config.[hash]${path.extname(configFile).replace("ts", "js")}`
|
| 44 |
+
})).output.find((chunk) => chunk.type === "chunk" && chunk.isEntry).fileName;
|
| 45 |
+
return path.join(outputDir, fileName);
|
| 46 |
+
}
|
| 47 |
+
const SUPPORTED_JS_CONFIG_FORMATS = [
|
| 48 |
+
".js",
|
| 49 |
+
".mjs",
|
| 50 |
+
".cjs"
|
| 51 |
+
];
|
| 52 |
+
const SUPPORTED_TS_CONFIG_FORMATS = [
|
| 53 |
+
".ts",
|
| 54 |
+
".mts",
|
| 55 |
+
".cts"
|
| 56 |
+
];
|
| 57 |
+
const SUPPORTED_CONFIG_FORMATS = [...SUPPORTED_JS_CONFIG_FORMATS, ...SUPPORTED_TS_CONFIG_FORMATS];
|
| 58 |
+
const DEFAULT_CONFIG_BASE = "rolldown.config";
|
| 59 |
+
async function findConfigFileNameInCwd() {
|
| 60 |
+
const filesInWorkingDirectory = new Set(await readdir(cwd()));
|
| 61 |
+
for (const extension of SUPPORTED_CONFIG_FORMATS) {
|
| 62 |
+
const fileName = `${DEFAULT_CONFIG_BASE}${extension}`;
|
| 63 |
+
if (filesInWorkingDirectory.has(fileName)) return fileName;
|
| 64 |
+
}
|
| 65 |
+
throw new Error("No `rolldown.config` configuration file found.");
|
| 66 |
+
}
|
| 67 |
+
async function loadTsConfig(configFile) {
|
| 68 |
+
const file = await bundleTsConfig(configFile, isFilePathESM(configFile));
|
| 69 |
+
try {
|
| 70 |
+
return (await import(pathToFileURL(file).href)).default;
|
| 71 |
+
} finally {
|
| 72 |
+
fs.unlink(file, () => {});
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
function isFilePathESM(filePath) {
|
| 76 |
+
if (/\.m[jt]s$/.test(filePath)) return true;
|
| 77 |
+
else if (/\.c[jt]s$/.test(filePath)) return false;
|
| 78 |
+
else {
|
| 79 |
+
const pkg = findNearestPackageData(path.dirname(filePath));
|
| 80 |
+
if (pkg) return pkg.type === "module";
|
| 81 |
+
return false;
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
function findNearestPackageData(basedir) {
|
| 85 |
+
while (basedir) {
|
| 86 |
+
const pkgPath = path.join(basedir, "package.json");
|
| 87 |
+
if (tryStatSync(pkgPath)?.isFile()) try {
|
| 88 |
+
return JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
| 89 |
+
} catch {}
|
| 90 |
+
const nextBasedir = path.dirname(basedir);
|
| 91 |
+
if (nextBasedir === basedir) break;
|
| 92 |
+
basedir = nextBasedir;
|
| 93 |
+
}
|
| 94 |
+
return null;
|
| 95 |
+
}
|
| 96 |
+
function tryStatSync(file) {
|
| 97 |
+
try {
|
| 98 |
+
return fs.statSync(file, { throwIfNoEntry: false });
|
| 99 |
+
} catch {}
|
| 100 |
+
}
|
| 101 |
+
/**
|
| 102 |
+
* Load config from a file in a way that Rolldown does.
|
| 103 |
+
*
|
| 104 |
+
* @param configPath The path to the config file. If empty, it will look for `rolldown.config` with supported extensions in the current working directory.
|
| 105 |
+
* @returns The loaded config export
|
| 106 |
+
*
|
| 107 |
+
* @category Config
|
| 108 |
+
*/
|
| 109 |
+
async function loadConfig(configPath) {
|
| 110 |
+
const ext = path.extname(configPath = configPath || await findConfigFileNameInCwd());
|
| 111 |
+
try {
|
| 112 |
+
if (SUPPORTED_JS_CONFIG_FORMATS.includes(ext) || process.env.NODE_OPTIONS?.includes("--import=tsx") && SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return (await import(pathToFileURL(configPath).href)).default;
|
| 113 |
+
else if (SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return await loadTsConfig(path.resolve(configPath));
|
| 114 |
+
else throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${ext}\``);
|
| 115 |
+
} catch (err) {
|
| 116 |
+
throw new Error("Error happened while loading config.", { cause: err });
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
//#endregion
|
| 120 |
+
export { loadConfig as t };
|