From 6e8f781f80f1bf025d9b1f82928a85abc3eeba87 Mon Sep 17 00:00:00 2001 From: yusuke <66258931+yusuke99@users.noreply.github.com> Date: Wed, 2 Sep 2026 12:09:47 +0900 Subject: [PATCH] feat: support pnpm install --- .github/workflows/test.yml | 27 +++++++++++++++++++++ README.md | 15 ++++++++++++ action.yml | 4 +++ dist/index.mjs | 6 ++--- src/index.ts | 6 ++++- src/inputs.test.ts | 13 ++++++++++ src/inputs.ts | 1 + src/install-pnpm.test.ts | 47 ++++++++++++++++++++++++++++++++++++ src/install-pnpm.ts | 10 ++++++++ src/install-sfw.test.ts | 1 + src/install-viteplus.test.ts | 1 + src/run-install.test.ts | 1 + src/types.ts | 1 + src/utils.test.ts | 5 ++++ src/version-file.test.ts | 1 + 15 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 src/install-pnpm.test.ts create mode 100644 src/install-pnpm.ts diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d224423..51a6767 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -808,6 +808,33 @@ jobs: fi echo "OK: composed sfw blocked lodahs (exit $CODE, block-line found)" + test-pnpm: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2 + + - name: Setup Vite+ with global pnpm + uses: ./ + with: + pnpm: true + run-install: false + cache: false + + - name: Verify pnpm is installed globally + shell: bash + run: | + global_list="$(vp list -g pnpm)" + echo "$global_list" + if [[ "$global_list" == *"No global packages matching 'pnpm'"* ]]; then + echo "pnpm was not installed globally" >&2 + exit 1 + fi + pnpm --version + test-azure-runtime: strategy: fail-fast: false diff --git a/README.md b/README.md index 3773e38..1d1f622 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ GitHub Action, GitLab CI/CD remote template, and Azure Pipelines step template t - GitHub Action: cache project dependencies with auto-detection of lock files - Optionally run `vp install` after setup - Optionally wrap `vp install` with [Socket Firewall Free (`sfw`)](https://docs.socket.dev/docs/socket-firewall-free) to block malicious dependencies +- Optionally install pnpm globally - Support for all major package managers (npm, pnpm, yarn, bun) - GitLab CI/CD support through a reusable `include:remote` template - Azure Pipelines support through a reusable step template and compiled runtime @@ -110,6 +111,19 @@ steps: cache: true ``` +### With pnpm + +Certain tools invoke `pnpm` directly without using `vp`. Install +pnpm globally to make its executable available. + +```yaml +steps: + - uses: actions/checkout@v6 + - uses: voidzero-dev/setup-vp@v1.18.0 + with: + pnpm: true +``` + ### Version from `package.json` / Catalog Keep a single source of truth for the Vite+ version by resolving it from the @@ -338,6 +352,7 @@ jobs: | `working-directory` | Project directory used for relative paths, lockfile auto-detection, environment checks, and default install | No | Workspace root | | `run-install` | Run `vp install` after setup. Accepts boolean or YAML object with `cwd`/`args` | No | `true` | | `sfw` | Wrap `vp install` with [Socket Firewall Free](https://docs.socket.dev/docs/socket-firewall-free) (`sfw`) | No | `false` | +| `pnpm` | Install pnpm globally | No | `false` | | `cache` | Enable caching of project dependencies | No | `false` | | `cache-dependency-path` | Path to lock file for cache key generation | No | Auto-detected | | `registry-url` | Optional registry to set up for auth. Sets the registry in `.npmrc` and reads auth from `NODE_AUTH_TOKEN` | No | | diff --git a/action.yml b/action.yml index 55050bf..d9ec92c 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,10 @@ inputs: description: "Wrap `vp install` with Socket Firewall Free (sfw) to block malicious dependency fetches. Works on Linux, macOS, and Windows (macOS/Windows require Vite+ v0.1.23+). See https://docs.socket.dev/docs/socket-firewall-free." required: false default: "false" + pnpm: + description: "Install pnpm globally." + required: false + default: "false" node-version: description: "Node.js version to install via `vp env use`. Omit this input and node-version-file to let Vite+ resolve the version. `vp env default ` sets the user-level default. Vite+ checks the project, this default, and then the latest LTS release." required: false diff --git a/dist/index.mjs b/dist/index.mjs index 3727fcb..fef117e 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -131,7 +131,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\ `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(` `,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){arrayPushArray(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;re.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(includesToken(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=getFirstKeyStartProps(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(includesToken(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(isFlowToken(t.key)&&!includesToken(t.sep,`newline`)){let e=getFirstKeyStartProps(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):includesToken(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!includesToken(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){arrayPushArray(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||includesToken(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=getFirstKeyStartProps(getPrevProps(t));fixFlowSeqItems(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(` `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(` -`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),mi=__commonJSMin((e=>{var t=oi(),n=Ur(),r=Wr(),i=mr(),a=B(),o=fi(),s=pi();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),hi=__commonJSMin((e=>{var t=oi(),n=Ur(),r=Vr(),i=Wr(),a=ar(),o=B(),s=_r(),c=or(),l=yr(),u=xr();ui();var d=di(),f=fi(),p=pi(),h=mi(),g=$n();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=h.parse,e.parseAllDocuments=h.parseAllDocuments,e.parseDocument=h.parseDocument,e.stringify=h.stringify,e.visit=g.visit,e.visitAsync=g.visitAsync})),gi;function $constructor(e,t,n){function init(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:_,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=_.prototype,a=Object.keys(i);for(let e=0;en?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(_,"name",{value:e}),_}var $ZodAsyncError=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};(gi=globalThis).__zod_globalConfig??(gi.__zod_globalConfig={});const _i=globalThis.__zod_globalConfig;function config(e){return e&&Object.assign(_i,e),_i}function jsonStringifyReplacer(e,t){return typeof t==`bigint`?t.toString():t}function cached(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function cleanRegex(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}const vi=Symbol(`evaluating`);function defineLazy(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==vi)return r===void 0&&(r=vi,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}const yi=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function isObject$1(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function clone(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function normalizeParams(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function optionalKeys(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function aborted(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function unwrapMessage(e){return typeof e==`string`?e:e?.message}function finalizeIssue(e,t,n){let r=e.message?e.message:unwrapMessage(e.inst?._zod.def?.error?.(e))??unwrapMessage(t?.error?.(e))??unwrapMessage(n.customError?.(e))??unwrapMessage(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}const initializer=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,jsonStringifyReplacer,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},bi=$constructor(`$ZodError`,initializer),xi=$constructor(`$ZodError`,initializer,{Parent:Error}),Si=(e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new $ZodAsyncError;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>finalizeIssue(e,a,config())));throw yi(t,i?.callee),t}return o.value})(xi),Ci=(e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>finalizeIssue(e,a,config())));throw yi(t,i?.callee),t}return o.value})(xi),wi=(e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new $ZodAsyncError;return a.issues.length?{success:!1,error:new(e??bi)(a.issues.map(e=>finalizeIssue(e,i,config())))}:{success:!0,data:a.value}})(xi),Ti=(e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>finalizeIssue(e,i,config())))}:{success:!0,data:a.value}})(xi),string$1=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ei=/^(?:true|false)$/i,Di=/^null$/i,Oi={major:4,minor:4,patch:3},ki=$constructor(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Oi;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let runChecks=(e,t,n)=>{let r=aborted(e),i;for(let a of t){if(a._zod.def.when){if(explicitlyAborted(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new $ZodAsyncError;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=aborted(e,t))});else{if(e.issues.length===t)continue;r||=aborted(e,t)}}return i?i.then(()=>e):e},handleCanaryResult=(t,n,i)=>{if(aborted(t))return t.aborted=!0,t;let a=runChecks(n,r,i);if(a instanceof Promise){if(i.async===!1)throw new $ZodAsyncError;return a.then(t=>e._zod.parse(t,i))}return e._zod.parse(a,i)};e._zod.run=(t,n)=>{if(n.skipChecks)return e._zod.parse(t,n);if(n.direction===`backward`){let r=e._zod.parse({value:t.value,issues:[]},{...n,skipChecks:!0});return r instanceof Promise?r.then(e=>handleCanaryResult(e,t,n)):handleCanaryResult(r,t,n)}let i=e._zod.parse(t,n);if(i instanceof Promise){if(n.async===!1)throw new $ZodAsyncError;return i.then(e=>runChecks(e,r,n))}return runChecks(i,r,n)}}defineLazy(e,`~standard`,()=>({validate:t=>{try{let n=wi(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ti(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Ai=$constructor(`$ZodString`,(e,t)=>{ki.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??string$1(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),ji=$constructor(`$ZodBoolean`,(e,t)=>{ki.init(e,t),e._zod.pattern=Ei,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Mi=$constructor(`$ZodNull`,(e,t)=>{ki.init(e,t),e._zod.pattern=Di,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}});function handleArrayResult(e,t,n){e.issues.length&&t.issues.push(...prefixIssues(n,e.issues)),t.value[n]=e.value}const Ni=$constructor(`$ZodArray`,(e,t)=>{ki.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;ehandleArrayResult(t,n,e))):handleArrayResult(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function handlePropertyResult(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...prefixIssues(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function normalizeDef(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=optionalKeys(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function handleCatchall(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>handlePropertyResult(e,n,i,t,u,d))):handlePropertyResult(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const Pi=$constructor(`$ZodObject`,(e,t)=>{if(ki.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=cached(()=>normalizeDef(t));defineLazy(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=isObject$1,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>handlePropertyResult(n,t,e,s,r,i))):handlePropertyResult(a,t,e,s,r,i)}return i?handleCatchall(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}});function handleUnionResults(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!aborted(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>finalizeIssue(e,r,config())))}),t)}const Fi=$constructor(`$ZodUnion`,(e,t)=>{ki.init(e,t),defineLazy(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),defineLazy(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),defineLazy(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),defineLazy(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>cleanRegex(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>handleUnionResults(t,r,e,i)):handleUnionResults(o,r,e,i)}});function handleOptionalResult(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Ii=$constructor(`$ZodOptional`,(e,t)=>{ki.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,defineLazy(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),defineLazy(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${cleanRegex(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>handleOptionalResult(e,r)):handleOptionalResult(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}});function _string(e,t){return new e({type:`string`,...normalizeParams(t)})}function _boolean(e,t){return new e({type:`boolean`,...normalizeParams(t)})}function _null$1(e,t){return new e({type:`null`,...normalizeParams(t)})}const Li=$constructor(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);ki.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>Si(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>wi(e,t,n),e.parseAsync=async(t,n)=>Ci(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ti(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>clone(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),Ri=$constructor(`ZodMiniString`,(e,t)=>{Ai.init(e,t),Li.init(e,t)});function string(e){return _string(Ri,e)}const zi=$constructor(`ZodMiniBoolean`,(e,t)=>{ji.init(e,t),Li.init(e,t)});function boolean(e){return _boolean(zi,e)}const Bi=$constructor(`ZodMiniNull`,(e,t)=>{Mi.init(e,t),Li.init(e,t)});function _null(e){return _null$1(Bi,e)}const Vi=$constructor(`ZodMiniArray`,(e,t)=>{Ni.init(e,t),Li.init(e,t)});function array(e,t){return new Vi({type:`array`,element:e,...normalizeParams(t)})}const Hi=$constructor(`ZodMiniObject`,(e,t)=>{Pi.init(e,t),Li.init(e,t),defineLazy(e,`shape`,()=>t.shape)});function object(e,t){let n={type:`object`,shape:e??{},...normalizeParams(t)};return new Hi(n)}const Ui=$constructor(`ZodMiniUnion`,(e,t)=>{Fi.init(e,t),Li.init(e,t)});function union(e,t){return new Ui({type:`union`,options:e,...normalizeParams(t)})}const Wi=$constructor(`ZodMiniOptional`,(e,t)=>{Ii.init(e,t),Li.init(e,t)});function optional(e){return new Wi({type:`optional`,innerType:e})}var Gi=hi();const Ki=new Set([`true`,`True`,`TRUE`]),qi=new Set([`false`,`False`,`FALSE`]);function parseNodeManager(e){if(e){if(Ki.has(e))return!0;if(qi.has(e))return!1;throw Error(`Invalid node-manager input: "${e}". Expected "true", "false", or unset.`)}}const Ji=object({cwd:optional(string()),args:optional(array(string()))}),Yi=union([_null(),boolean(),Ji,array(Ji)]),Xi=`Vite+`,Zi=`vite-plus`;function getInputs(){let e=getInput(`node-version`)||void 0,t=getInput(`node-version-file`)||void 0,n=parseNodeManager(getInput(`node-manager`));if(n===!1&&(e||t))throw Error(`node-manager: false cannot be combined with node-version or node-version-file: installing a Node.js version requires the Vite+ Node.js manager.`);return{version:getInput(`version`),versionFile:getInput(`version-file`)||void 0,nodeVersion:e,nodeVersionFile:t,nodeManager:n,workingDirectory:getInput(`working-directory`)||void 0,runInstall:parseRunInstall(getInput(`run-install`)),sfw:getBooleanInput(`sfw`),cache:getBooleanInput(`cache`),cacheDependencyPath:getInput(`cache-dependency-path`)||void 0,registryUrl:getInput(`registry-url`)||void 0,scope:getInput(`scope`)||void 0}}function parseRunInstall(e){if(!e||e===`false`||e===`null`)return[];if(e===`true`)return[{}];let t=(0,Gi.parse)(e);try{let e=Yi.parse(t);return e?e===!0?[{}]:Array.isArray(e)?e:[e]:[]}catch(e){throw e instanceof bi?Error(`Invalid run-install input: ${e.issues.map(e=>e.message).join(`, `)}`):e}}const Qi=`https://raw.githubusercontent.com/voidzero-dev/vite-plus`,$i=`packages/cli`,ea=/^0\.0\.0-commit\.([0-9a-f]{40})$/i,ta=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function pkgPrNewCommitSha(e){return e.match(ea)?.[1]}function getInstallScriptUrls(e,t=process.platform){let n=t===`win32`?`install.ps1`:`install.sh`,r=installScriptRef(e);return{pinned:r?[`${Qi}/${r}/${$i}/${n}`,`https://cdn.jsdelivr.net/gh/voidzero-dev/vite-plus@${r}/${$i}/${n}`]:[],latest:[`https://viteplus.dev/${n}`,`${Qi}/main/${$i}/${n}`]}}function installScriptRef(e){let t=pkgPrNewCommitSha(e);if(t)return t.toLowerCase();if(ta.test(e))return`v${e}`}function parseInstalledVpVersion$1(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const na=`--connect-timeout 5 --max-time 15`,ra=`SETUP_VP_DIRS_FILE`,ia=/^v?(\d+)\.(\d+)\.\d+(?:-[0-9A-Za-z.-]+)?$/;function supportsVitePlusDirs(e){if(pkgPrNewCommitSha(e))return!0;let t=e.match(ia);if(!t)return!0;let n=Number(t[1]),r=Number(t[2]);return n>0||r>=3}function createVitePlusDirsFile(){return I(xe(),`setup-vp-dirs-${k()}.txt`)}function removeVitePlusDirsFile(e){me(e,{force:!0})}function readVitePlusProbe(e){try{return fe(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}function resolveVitePlusBinDir(e,t,n){if(!t){if(!supportsVitePlusDirs(e))return n;throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}let r=readVitePlusProbe(t),i=r===void 0?void 0:parseVitePlusDirs(r);if(i)return i.bin;if(!(pkgPrNewCommitSha(e)!==void 0||ia.test(e))&&r!==void 0){let e=parseInstalledVpVersion$1(r);if(e!==`unknown`&&!supportsVitePlusDirs(e))return n}throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}function parseVitePlusDirs(e){let t=new Map;for(let n of e.split(/\r?\n/)){let e=n.indexOf(` `);if(e<1)continue;let r=n.slice(0,e).replace(/^\uFEFF/,``),i=n.slice(e+1).trim();i&&t.set(r,i)}let n=t.get(`data`),r=t.get(`bin`),i=t.get(`cache`),a=t.get(`config`),o=t.get(`state`);if(!(!n||!r||!i||!a||!o))return{data:n,bin:r,cache:i,config:a,state:o}}function getInstallScriptCommand(e,t=process.platform,n=!0){return t===`win32`?n?{command:`pwsh`,args:[`-Command`,` +`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),mi=__commonJSMin((e=>{var t=oi(),n=Ur(),r=Wr(),i=mr(),a=B(),o=fi(),s=pi();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),hi=__commonJSMin((e=>{var t=oi(),n=Ur(),r=Vr(),i=Wr(),a=ar(),o=B(),s=_r(),c=or(),l=yr(),u=xr();ui();var d=di(),f=fi(),p=pi(),h=mi(),g=$n();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=h.parse,e.parseAllDocuments=h.parseAllDocuments,e.parseDocument=h.parseDocument,e.stringify=h.stringify,e.visit=g.visit,e.visitAsync=g.visitAsync})),gi;function $constructor(e,t,n){function init(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:_,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=_.prototype,a=Object.keys(i);for(let e=0;en?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(_,"name",{value:e}),_}var $ZodAsyncError=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};(gi=globalThis).__zod_globalConfig??(gi.__zod_globalConfig={});const _i=globalThis.__zod_globalConfig;function config(e){return e&&Object.assign(_i,e),_i}function jsonStringifyReplacer(e,t){return typeof t==`bigint`?t.toString():t}function cached(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function cleanRegex(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}const vi=Symbol(`evaluating`);function defineLazy(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==vi)return r===void 0&&(r=vi,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}const yi=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function isObject$1(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function clone(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function normalizeParams(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function optionalKeys(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}-Number.MAX_VALUE,Number.MAX_VALUE;function aborted(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function unwrapMessage(e){return typeof e==`string`?e:e?.message}function finalizeIssue(e,t,n){let r=e.message?e.message:unwrapMessage(e.inst?._zod.def?.error?.(e))??unwrapMessage(t?.error?.(e))??unwrapMessage(n.customError?.(e))??unwrapMessage(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}const initializer=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,jsonStringifyReplacer,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},bi=$constructor(`$ZodError`,initializer),xi=$constructor(`$ZodError`,initializer,{Parent:Error}),Si=(e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new $ZodAsyncError;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>finalizeIssue(e,a,config())));throw yi(t,i?.callee),t}return o.value})(xi),Ci=(e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>finalizeIssue(e,a,config())));throw yi(t,i?.callee),t}return o.value})(xi),wi=(e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new $ZodAsyncError;return a.issues.length?{success:!1,error:new(e??bi)(a.issues.map(e=>finalizeIssue(e,i,config())))}:{success:!0,data:a.value}})(xi),Ti=(e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>finalizeIssue(e,i,config())))}:{success:!0,data:a.value}})(xi),string$1=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ei=/^(?:true|false)$/i,Di=/^null$/i,Oi={major:4,minor:4,patch:3},ki=$constructor(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Oi;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let runChecks=(e,t,n)=>{let r=aborted(e),i;for(let a of t){if(a._zod.def.when){if(explicitlyAborted(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new $ZodAsyncError;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=aborted(e,t))});else{if(e.issues.length===t)continue;r||=aborted(e,t)}}return i?i.then(()=>e):e},handleCanaryResult=(t,n,i)=>{if(aborted(t))return t.aborted=!0,t;let a=runChecks(n,r,i);if(a instanceof Promise){if(i.async===!1)throw new $ZodAsyncError;return a.then(t=>e._zod.parse(t,i))}return e._zod.parse(a,i)};e._zod.run=(t,n)=>{if(n.skipChecks)return e._zod.parse(t,n);if(n.direction===`backward`){let r=e._zod.parse({value:t.value,issues:[]},{...n,skipChecks:!0});return r instanceof Promise?r.then(e=>handleCanaryResult(e,t,n)):handleCanaryResult(r,t,n)}let i=e._zod.parse(t,n);if(i instanceof Promise){if(n.async===!1)throw new $ZodAsyncError;return i.then(e=>runChecks(e,r,n))}return runChecks(i,r,n)}}defineLazy(e,`~standard`,()=>({validate:t=>{try{let n=wi(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ti(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Ai=$constructor(`$ZodString`,(e,t)=>{ki.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??string$1(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),ji=$constructor(`$ZodBoolean`,(e,t)=>{ki.init(e,t),e._zod.pattern=Ei,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Mi=$constructor(`$ZodNull`,(e,t)=>{ki.init(e,t),e._zod.pattern=Di,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}});function handleArrayResult(e,t,n){e.issues.length&&t.issues.push(...prefixIssues(n,e.issues)),t.value[n]=e.value}const Ni=$constructor(`$ZodArray`,(e,t)=>{ki.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;ehandleArrayResult(t,n,e))):handleArrayResult(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function handlePropertyResult(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...prefixIssues(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function normalizeDef(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=optionalKeys(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function handleCatchall(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>handlePropertyResult(e,n,i,t,u,d))):handlePropertyResult(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const Pi=$constructor(`$ZodObject`,(e,t)=>{if(ki.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=cached(()=>normalizeDef(t));defineLazy(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=isObject$1,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>handlePropertyResult(n,t,e,s,r,i))):handlePropertyResult(a,t,e,s,r,i)}return i?handleCatchall(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}});function handleUnionResults(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!aborted(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>finalizeIssue(e,r,config())))}),t)}const Fi=$constructor(`$ZodUnion`,(e,t)=>{ki.init(e,t),defineLazy(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),defineLazy(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),defineLazy(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),defineLazy(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>cleanRegex(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>handleUnionResults(t,r,e,i)):handleUnionResults(o,r,e,i)}});function handleOptionalResult(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Ii=$constructor(`$ZodOptional`,(e,t)=>{ki.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,defineLazy(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),defineLazy(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${cleanRegex(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>handleOptionalResult(e,r)):handleOptionalResult(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}});function _string(e,t){return new e({type:`string`,...normalizeParams(t)})}function _boolean(e,t){return new e({type:`boolean`,...normalizeParams(t)})}function _null$1(e,t){return new e({type:`null`,...normalizeParams(t)})}const Li=$constructor(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);ki.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>Si(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>wi(e,t,n),e.parseAsync=async(t,n)=>Ci(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ti(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>clone(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),Ri=$constructor(`ZodMiniString`,(e,t)=>{Ai.init(e,t),Li.init(e,t)});function string(e){return _string(Ri,e)}const zi=$constructor(`ZodMiniBoolean`,(e,t)=>{ji.init(e,t),Li.init(e,t)});function boolean(e){return _boolean(zi,e)}const Bi=$constructor(`ZodMiniNull`,(e,t)=>{Mi.init(e,t),Li.init(e,t)});function _null(e){return _null$1(Bi,e)}const Vi=$constructor(`ZodMiniArray`,(e,t)=>{Ni.init(e,t),Li.init(e,t)});function array(e,t){return new Vi({type:`array`,element:e,...normalizeParams(t)})}const Hi=$constructor(`ZodMiniObject`,(e,t)=>{Pi.init(e,t),Li.init(e,t),defineLazy(e,`shape`,()=>t.shape)});function object(e,t){let n={type:`object`,shape:e??{},...normalizeParams(t)};return new Hi(n)}const Ui=$constructor(`ZodMiniUnion`,(e,t)=>{Fi.init(e,t),Li.init(e,t)});function union(e,t){return new Ui({type:`union`,options:e,...normalizeParams(t)})}const Wi=$constructor(`ZodMiniOptional`,(e,t)=>{Ii.init(e,t),Li.init(e,t)});function optional(e){return new Wi({type:`optional`,innerType:e})}var Gi=hi();const Ki=new Set([`true`,`True`,`TRUE`]),qi=new Set([`false`,`False`,`FALSE`]);function parseNodeManager(e){if(e){if(Ki.has(e))return!0;if(qi.has(e))return!1;throw Error(`Invalid node-manager input: "${e}". Expected "true", "false", or unset.`)}}const Ji=object({cwd:optional(string()),args:optional(array(string()))}),Yi=union([_null(),boolean(),Ji,array(Ji)]),Xi=`Vite+`,Zi=`vite-plus`;function getInputs(){let e=getInput(`node-version`)||void 0,t=getInput(`node-version-file`)||void 0,n=parseNodeManager(getInput(`node-manager`));if(n===!1&&(e||t))throw Error(`node-manager: false cannot be combined with node-version or node-version-file: installing a Node.js version requires the Vite+ Node.js manager.`);return{version:getInput(`version`),versionFile:getInput(`version-file`)||void 0,nodeVersion:e,nodeVersionFile:t,nodeManager:n,workingDirectory:getInput(`working-directory`)||void 0,runInstall:parseRunInstall(getInput(`run-install`)),sfw:getBooleanInput(`sfw`),pnpm:getBooleanInput(`pnpm`),cache:getBooleanInput(`cache`),cacheDependencyPath:getInput(`cache-dependency-path`)||void 0,registryUrl:getInput(`registry-url`)||void 0,scope:getInput(`scope`)||void 0}}function parseRunInstall(e){if(!e||e===`false`||e===`null`)return[];if(e===`true`)return[{}];let t=(0,Gi.parse)(e);try{let e=Yi.parse(t);return e?e===!0?[{}]:Array.isArray(e)?e:[e]:[]}catch(e){throw e instanceof bi?Error(`Invalid run-install input: ${e.issues.map(e=>e.message).join(`, `)}`):e}}const Qi=`https://raw.githubusercontent.com/voidzero-dev/vite-plus`,$i=`packages/cli`,ea=/^0\.0\.0-commit\.([0-9a-f]{40})$/i,ta=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function pkgPrNewCommitSha(e){return e.match(ea)?.[1]}function getInstallScriptUrls(e,t=process.platform){let n=t===`win32`?`install.ps1`:`install.sh`,r=installScriptRef(e);return{pinned:r?[`${Qi}/${r}/${$i}/${n}`,`https://cdn.jsdelivr.net/gh/voidzero-dev/vite-plus@${r}/${$i}/${n}`]:[],latest:[`https://viteplus.dev/${n}`,`${Qi}/main/${$i}/${n}`]}}function installScriptRef(e){let t=pkgPrNewCommitSha(e);if(t)return t.toLowerCase();if(ta.test(e))return`v${e}`}function parseInstalledVpVersion$1(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const na=`--connect-timeout 5 --max-time 15`,ra=`SETUP_VP_DIRS_FILE`,ia=/^v?(\d+)\.(\d+)\.\d+(?:-[0-9A-Za-z.-]+)?$/;function supportsVitePlusDirs(e){if(pkgPrNewCommitSha(e))return!0;let t=e.match(ia);if(!t)return!0;let n=Number(t[1]),r=Number(t[2]);return n>0||r>=3}function createVitePlusDirsFile(){return I(xe(),`setup-vp-dirs-${k()}.txt`)}function removeVitePlusDirsFile(e){me(e,{force:!0})}function readVitePlusProbe(e){try{return fe(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}function resolveVitePlusBinDir(e,t,n){if(!t){if(!supportsVitePlusDirs(e))return n;throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}let r=readVitePlusProbe(t),i=r===void 0?void 0:parseVitePlusDirs(r);if(i)return i.bin;if(!(pkgPrNewCommitSha(e)!==void 0||ia.test(e))&&r!==void 0){let e=parseInstalledVpVersion$1(r);if(e!==`unknown`&&!supportsVitePlusDirs(e))return n}throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}function parseVitePlusDirs(e){let t=new Map;for(let n of e.split(/\r?\n/)){let e=n.indexOf(` `);if(e<1)continue;let r=n.slice(0,e).replace(/^\uFEFF/,``),i=n.slice(e+1).trim();i&&t.set(r,i)}let n=t.get(`data`),r=t.get(`bin`),i=t.get(`cache`),a=t.get(`config`),o=t.get(`state`);if(!(!n||!r||!i||!a||!o))return{data:n,bin:r,cache:i,config:a,state:o}}function getInstallScriptCommand(e,t=process.platform,n=!0){return t===`win32`?n?{command:`pwsh`,args:[`-Command`,` $dirsFile = $env:${ra} Set-Content -LiteralPath $dirsFile -Value '' -NoNewline . ([scriptblock]::Create((irm -TimeoutSec 15 ${e}))) @@ -168,7 +168,7 @@ fi `.trim()]}:{command:`bash`,args:[`-c`,` set -o pipefail curl -fsSL ${na} ${e} | bash -`.trim()]}}function getVitePlusHome(){let e=process.platform===`win32`?process.env.USERPROFILE:process.env.HOME;return I(e||ye(),`.vite-plus`)}function isWithin(e,t){let n=ie(t,e);return!re(n)&&n!==`..`&&!n.startsWith(`..${oe}`)}function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}function getWorkspaceDir(){return process.env.GITHUB_WORKSPACE||process.cwd()}function resolvePath(e,t){return re(e)?e:I(t,e)}function getConfiguredProjectDir(e){if(!e.workingDirectory)return getWorkspaceDir();let t=resolvePath(e.workingDirectory,getWorkspaceDir());if(!ue(t))throw Error(`working-directory not found: ${e.workingDirectory} (resolved to ${t})`);if(!L(t).isDirectory())throw Error(`working-directory is not a directory: ${e.workingDirectory} (resolved to ${t})`);return t}function getInstallCwd(e,t){return t?resolvePath(t,e):e}const aa=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function detectLockFile(e,t=getWorkspaceDir(),n=!1){if(e){let n=resolvePath(e,t);if(ue(n)){let e=F(n),t=aa.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let r=pe(t);for(let e of aa)if(r.includes(e.filename)){let r=I(t,e.filename);return n||info(`Auto-detected lock file: ${e.filename}`),{type:e.type,path:r,filename:e.filename}}}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}async function getCacheDirectories(e,t){switch(e){case`npm`:case`pnpm`:case`yarn`:case`bun`:return getViteCacheDir(t);default:return[]}}async function getCommandOutput(e,t,n){let r=`${e} ${t.join(` `)}`;try{let i=await getExecOutput(e,t,{cwd:n?.cwd,silent:!0,ignoreReturnCode:!0});if(i.exitCode===0)return i.stdout.trim();debug(`Command "${r}" exited with code ${i.exitCode}`);return}catch(e){warning(`Failed to run "${r}": ${String(e)}`);return}}async function getViteCacheDir(e){let t=await getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:e});return t?[t]:[]}const oa=2e3;async function installVitePlus(e){let{version:t}=e;info(`Installing ${Xi}@${t}...`);let n={...process.env,VP_VERSION:t,VITE_PLUS_VERSION:t},r=supportsVitePlusDirs(t)?createVitePlusDirsFile():void 0;r?(n.VP_VPDIRS_AWARE=`1`,n[ra]=r):(delete n.VP_VPDIRS_AWARE,delete n[ra]),e.nodeManager!==void 0&&(n.VP_NODE_MANAGER=e.nodeManager?`yes`:`no`);let i=pkgPrNewCommitSha(t);i&&(n.VP_PR_VERSION=i);let{pinned:a,latest:o}=getInstallScriptUrls(t),s=a.length+o.length,c=2*s,l=``,u=0,tryUrls=async e=>{for(let t=0;t<2;t++)for(let t of e){u++;try{let e=await runInstallCommand(t,n);if(e===0)return!0;l=`exit code ${e}`}catch(e){l=e instanceof Error?e.message:String(e)}u0){if(await tryUrls(a)){ensureVitePlusBinInPath(t,r);return}warning(`Could not fetch the install script pinned to ${Xi}@${t}. Falling back to the latest install script. The latest script may not be compatible with ${t}.`)}if(await tryUrls(o)){ensureVitePlusBinInPath(t,r);return}throw Error(`Failed to install ${Xi} after ${c} attempts across ${s} URL(s): ${l}`)}finally{r&&removeVitePlusDirsFile(r)}}async function runInstallCommand(e,t){let n={env:t,ignoreReturnCode:!0},{command:r,args:i}=getInstallScriptCommand(e,process.platform,t.VP_VPDIRS_AWARE===`1`);return exec(r,i,n)}function ensureVitePlusBinInPath(e,t){let n=resolveVitePlusBinDir(e,t,I(getVitePlusHome(),`bin`));process.env.PATH?.split(te).includes(n)||addPath(n)}function getOptions$1(e){let t={followSymbolicLinks:!0,implicitDescendants:!0,matchDirectories:!0,omitBrokenSymbolicLinks:!0,excludeHiddenFiles:!1};return e&&(typeof e.followSymbolicLinks==`boolean`&&(t.followSymbolicLinks=e.followSymbolicLinks,debug(`followSymbolicLinks '${t.followSymbolicLinks}'`)),typeof e.implicitDescendants==`boolean`&&(t.implicitDescendants=e.implicitDescendants,debug(`implicitDescendants '${t.implicitDescendants}'`)),typeof e.matchDirectories==`boolean`&&(t.matchDirectories=e.matchDirectories,debug(`matchDirectories '${t.matchDirectories}'`)),typeof e.omitBrokenSymbolicLinks==`boolean`&&(t.omitBrokenSymbolicLinks=e.omitBrokenSymbolicLinks,debug(`omitBrokenSymbolicLinks '${t.omitBrokenSymbolicLinks}'`)),typeof e.excludeHiddenFiles==`boolean`&&(t.excludeHiddenFiles=e.excludeHiddenFiles,debug(`excludeHiddenFiles '${t.excludeHiddenFiles}'`))),t}const sa=process.platform===`win32`;function dirname$2(e){if(e=safeTrimTrailingSeparator$1(e),sa&&/^\\\\[^\\]+(\\[^\\]+)?$/.test(e))return e;let t=u.dirname(e);return sa&&/^\\\\[^\\]+\\[^\\]+\\$/.test(t)&&(t=safeTrimTrailingSeparator$1(t)),t}function ensureAbsoluteRoot$1(e,t){if(g(e,`ensureAbsoluteRoot parameter 'root' must not be empty`),g(t,`ensureAbsoluteRoot parameter 'itemPath' must not be empty`),hasAbsoluteRoot$1(t))return t;if(sa){if(t.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)){let e=process.cwd();return g(e.match(/^[A-Z]:\\/i),`Expected current directory to start with an absolute drive root. Actual '${e}'`),t[0].toUpperCase()===e[0].toUpperCase()?t.length===2?`${t[0]}:\\${e.substr(3)}`:(e.endsWith(`\\`)||(e+=`\\`),`${t[0]}:\\${e.substr(3)}${t.substr(2)}`):`${t[0]}:\\${t.substr(2)}`}if(normalizeSeparators$1(t).match(/^\\$|^\\[^\\]/)){let e=process.cwd();return g(e.match(/^[A-Z]:\\/i),`Expected current directory to start with an absolute drive root. Actual '${e}'`),`${e[0]}:\\${t.substr(1)}`}}return g(hasAbsoluteRoot$1(e),`ensureAbsoluteRoot parameter 'root' must have an absolute root`),e.endsWith(`/`)||sa&&e.endsWith(`\\`)||(e+=u.sep),e+t}function hasAbsoluteRoot$1(e){return g(e,`hasAbsoluteRoot parameter 'itemPath' must not be empty`),e=normalizeSeparators$1(e),sa?e.startsWith(`\\\\`)||/^[A-Z]:\\/i.test(e):e.startsWith(`/`)}function hasRoot$1(e){return g(e,`isRooted parameter 'itemPath' must not be empty`),e=normalizeSeparators$1(e),sa?e.startsWith(`\\`)||/^[A-Z]:/i.test(e):e.startsWith(`/`)}function normalizeSeparators$1(e){return e||=``,sa?(e=e.replace(/\//g,`\\`),(/^\\\\+[^\\]/.test(e)?`\\`:``)+e.replace(/\\\\+/g,`\\`)):e.replace(/\/\/+/g,`/`)}function safeTrimTrailingSeparator$1(e){return e?(e=normalizeSeparators$1(e),!e.endsWith(u.sep)||e===u.sep||sa&&/^[A-Z]:\\$/i.test(e)?e:e.substr(0,e.length-1)):``}var ca;(function(e){e[e.None=0]=`None`,e[e.Directory=1]=`Directory`,e[e.File=2]=`File`,e[e.All=3]=`All`})(ca||={});const la=process.platform===`win32`;function getSearchPaths$1(e){e=e.filter(e=>!e.negate);let t={};for(let n of e){let e=la?n.searchPath.toUpperCase():n.searchPath;t[e]=`candidate`}let n=[];for(let r of e){let e=la?r.searchPath.toUpperCase():r.searchPath;if(t[e]===`included`)continue;let i=!1,a=e,o=dirname$2(a);for(;o!==a;){if(t[o]){i=!0;break}a=o,o=dirname$2(a)}i||(n.push(r.searchPath),t[e]=`included`)}return n}function match$2(e,t){let n=ca.None;for(let r of e)r.negate?n&=~r.match(t):n|=r.match(t);return n}function partialMatch$1(e,t){return e.some(e=>!e.negate&&e.partialMatch(t))}var ua=__commonJSMin(((e,t)=>{t.exports=function(e,t){for(var r=[],i=0;i{t.exports=balanced;function balanced(e,t,n){e instanceof RegExp&&(e=maybeMatch(e,n)),t instanceof RegExp&&(t=maybeMatch(t,n));var r=range(e,t,n);return r&&{start:r[0],end:r[1],pre:n.slice(0,r[0]),body:n.slice(r[0]+e.length,r[1]),post:n.slice(r[1]+t.length)}}function maybeMatch(e,t){var n=t.match(e);return n?n[0]:null}balanced.range=range;function range(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:(i=r.pop(),i=0?c:l;r.length&&(s=[a,o])}return s}})),fa=__commonJSMin(((e,t)=>{ua();var n=da();t.exports=expandTop;var r=`\0SLASH`+Math.random()+`\0`,i=`\0OPEN`+Math.random()+`\0`,a=`\0CLOSE`+Math.random()+`\0`,o=`\0COMMA`+Math.random()+`\0`,s=`\0PERIOD`+Math.random()+`\0`,c=1e5,l=4e6;function numeric(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function escapeBraces(e){return e.split(`\\\\`).join(r).split(`\\{`).join(i).split(`\\}`).join(a).split(`\\,`).join(o).split(`\\.`).join(s)}function unescapeBraces(e){return e.split(r).join(`\\`).split(i).join(`{`).split(a).join(`}`).split(o).join(`,`).split(s).join(`.`)}function parseCommaParts(e){if(!e)return[``];var t=[],r=n(`{`,`}`,e);if(!r)return e.split(`,`);var i=r.pre,a=r.body,o=r.post,s=i.split(`,`);s[s.length-1]+=`{`+a+`}`;var c=parseCommaParts(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function expandTop(e,t){if(!e)return[];t||={};var n=t.max==null?c:t.max,r=t.maxLength==null?l:t.maxLength;return e.substr(0,2)===`{}`&&(e=`\\{\\}`+e.substr(2)),expand(escapeBraces(e),n,r,!0).map(unescapeBraces)}function embrace(e){return`{`+e+`}`}function isPadded(e){return/^-?0\d/.test(e)}function lte(e,t){return e<=t}function gte(e,t){return e>=t}function combine(e,t,n,r,i,a,o,s){for(var c=[],l=0,u=0;u=i)return c;var f=e[u]+n+r[d];if(!(o&&f.length===t[u])){if(l+f.length>a)return c;c.push(f),s.push(t[u]),l+=f.length}}return c}function expandSequence(e,t,n,r){var i=e.split(/\.\./),a=[];if(i[0]===void 0||i[1]===void 0)return a;var o=numeric(i[0]),s=numeric(i[1]),c=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(numeric(i[2])),1):1,u=lte;s0){var v=Array(g+1).join(`0`);h=p<0?`-`+v+h.slice(1):v+h}}if(f+h.length>r)break;a.push(h),f+=h.length}return a}function expand(e,t,r,i){for(var o=[``],s=[0],c=!1,l=!0,u;;){var d=n(`{`,`}`,e);if(!d)return combine(o,s,e,[``],t,r,c,[]);var f=d.pre;if(/\$$/.test(f))return combine(o,s,e,[``],t,r,c,[]);var p=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(d.body),h=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(d.body),g=p||h,v=d.body.indexOf(`,`)>=0;if(!g&&!v){if(d.post.match(/,(?!,).*\}/)){e=d.pre+`{`+d.body+a+d.post,i=!0,l=!0,c=!1,s=[];for(var y=0;y=t||w+O.length>r)break outer;b.push(O),w+=O.length}}}if(u=[],o=combine(o,s,f,b,t,r,c&&!d.post.length,u),s=u,!d.post.length)break;e=d.post}return o}})),pa=__toESM(__commonJSMin(((e,t)=>{t.exports=minimatch,minimatch.Minimatch=Minimatch;var n=function(){try{return R(`path`)}catch{}}()||{sep:`/`};minimatch.sep=n.sep;var r=minimatch.GLOBSTAR=Minimatch.GLOBSTAR={},i=fa(),a={"!":{open:`(?:(?!(?:`,close:`))[^/]*?)`},"?":{open:`(?:`,close:`)?`},"+":{open:`(?:`,close:`)+`},"*":{open:`(?:`,close:`)*`},"@":{open:`(?:`,close:`)`}},o=`[^/]`,s=o+`*?`,c=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,l=`(?:(?!(?:\\/|^)\\.).)*?`,u=charSet(`().*{}+?[]^$\\!`);function charSet(e){return e.split(``).reduce(function(e,t){return e[t]=!0,e},{})}var d=/\/+/;minimatch.filter=filter;function filter(e,t){return t||={},function(n,r,i){return minimatch(n,e,t)}}function ext(e,t){t||={};var n={};return Object.keys(e).forEach(function(t){n[t]=e[t]}),Object.keys(t).forEach(function(e){n[e]=t[e]}),n}minimatch.defaults=function(e){if(!e||typeof e!=`object`||!Object.keys(e).length)return minimatch;var t=minimatch,m=function(n,r,i){return t(n,r,ext(e,i))};return m.Minimatch=function(n,r){return new t.Minimatch(n,ext(e,r))},m.Minimatch.defaults=function(n){return t.defaults(ext(e,n)).Minimatch},m.filter=function(n,r){return t.filter(n,ext(e,r))},m.defaults=function(n){return t.defaults(ext(e,n))},m.makeRe=function(n,r){return t.makeRe(n,ext(e,r))},m.braceExpand=function(n,r){return t.braceExpand(n,ext(e,r))},m.match=function(n,r,i){return t.match(n,r,ext(e,i))},m},Minimatch.defaults=function(e){return minimatch.defaults(e).Minimatch};function minimatch(e,t,n){return assertValidPattern(t),n||={},!n.nocomment&&t.charAt(0)===`#`?!1:new Minimatch(t,n).match(e)}function Minimatch(e,t){if(!(this instanceof Minimatch))return new Minimatch(e,t);assertValidPattern(e),t||={},e=e.trim(),!t.allowWindowsEscape&&n.sep!==`/`&&(e=e.split(n.sep).join(`/`)),this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion===void 0?200:t.maxGlobstarRecursion,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.make()}Minimatch.prototype.debug=function(){},Minimatch.prototype.make=make;function make(){var e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,n),n=this.globParts=n.map(function(e){return e.split(d)}),this.debug(this.pattern,n),n=n.map(function(e,t,n){return e.map(this.parse,this)},this),this.debug(this.pattern,n),n=n.filter(function(e){return e.indexOf(!1)===-1}),this.debug(this.pattern,n),this.set=n}Minimatch.prototype.parseNegate=parseNegate;function parseNegate(){var e=this.pattern,t=!1,n=this.options,r=0;if(!n.nonegate){for(var i=0,a=e.length;if)throw TypeError(`pattern is too long`)};Minimatch.prototype.parse=parse;var p={};function parse(e,t){assertValidPattern(e);var n=this.options;if(e===`**`){if(n.noglobstar)e=`*`;else return r}if(e===``)return``;var i=``,c=!!n.nocase,l=!1,d=[],f=[],h,g=!1,v=-1,y=-1,b=e.charAt(0)===`.`?``:n.dot?`(?!(?:^|\\/)\\.{1,2}(?:$|\\/))`:`(?!\\.)`,x=this;function clearStateChar(){if(h){switch(h){case`*`:i+=s,c=!0;break;case`?`:i+=o,c=!0;break;default:i+=`\\`+h}x.debug(`clearStateChar %j %j`,h,i),h=!1}}for(var S=0,C=e.length,w;St.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let r=pe(t);for(let e of aa)if(r.includes(e.filename)){let r=I(t,e.filename);return n||info(`Auto-detected lock file: ${e.filename}`),{type:e.type,path:r,filename:e.filename}}}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}async function getCacheDirectories(e,t){switch(e){case`npm`:case`pnpm`:case`yarn`:case`bun`:return getViteCacheDir(t);default:return[]}}async function getCommandOutput(e,t,n){let r=`${e} ${t.join(` `)}`;try{let i=await getExecOutput(e,t,{cwd:n?.cwd,silent:!0,ignoreReturnCode:!0});if(i.exitCode===0)return i.stdout.trim();debug(`Command "${r}" exited with code ${i.exitCode}`);return}catch(e){warning(`Failed to run "${r}": ${String(e)}`);return}}async function getViteCacheDir(e){let t=await getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:e});return t?[t]:[]}const oa=2e3;async function installVitePlus(e){let{version:t}=e;info(`Installing ${Xi}@${t}...`);let n={...process.env,VP_VERSION:t,VITE_PLUS_VERSION:t},r=supportsVitePlusDirs(t)?createVitePlusDirsFile():void 0;r?(n.VP_VPDIRS_AWARE=`1`,n[ra]=r):(delete n.VP_VPDIRS_AWARE,delete n[ra]),e.nodeManager!==void 0&&(n.VP_NODE_MANAGER=e.nodeManager?`yes`:`no`);let i=pkgPrNewCommitSha(t);i&&(n.VP_PR_VERSION=i);let{pinned:a,latest:o}=getInstallScriptUrls(t),s=a.length+o.length,c=2*s,l=``,u=0,tryUrls=async e=>{for(let t=0;t<2;t++)for(let t of e){u++;try{let e=await runInstallCommand(t,n);if(e===0)return!0;l=`exit code ${e}`}catch(e){l=e instanceof Error?e.message:String(e)}u0){if(await tryUrls(a)){ensureVitePlusBinInPath(t,r);return}warning(`Could not fetch the install script pinned to ${Xi}@${t}. Falling back to the latest install script. The latest script may not be compatible with ${t}.`)}if(await tryUrls(o)){ensureVitePlusBinInPath(t,r);return}throw Error(`Failed to install ${Xi} after ${c} attempts across ${s} URL(s): ${l}`)}finally{r&&removeVitePlusDirsFile(r)}}async function runInstallCommand(e,t){let n={env:t,ignoreReturnCode:!0},{command:r,args:i}=getInstallScriptCommand(e,process.platform,t.VP_VPDIRS_AWARE===`1`);return exec(r,i,n)}function ensureVitePlusBinInPath(e,t){let n=resolveVitePlusBinDir(e,t,I(getVitePlusHome(),`bin`));process.env.PATH?.split(te).includes(n)||addPath(n)}async function installPnpm(e){e.pnpm&&(info(`Installing pnpm globally...`),await exec(`vp`,[`install`,`-g`,`pnpm`]))}function getOptions$1(e){let t={followSymbolicLinks:!0,implicitDescendants:!0,matchDirectories:!0,omitBrokenSymbolicLinks:!0,excludeHiddenFiles:!1};return e&&(typeof e.followSymbolicLinks==`boolean`&&(t.followSymbolicLinks=e.followSymbolicLinks,debug(`followSymbolicLinks '${t.followSymbolicLinks}'`)),typeof e.implicitDescendants==`boolean`&&(t.implicitDescendants=e.implicitDescendants,debug(`implicitDescendants '${t.implicitDescendants}'`)),typeof e.matchDirectories==`boolean`&&(t.matchDirectories=e.matchDirectories,debug(`matchDirectories '${t.matchDirectories}'`)),typeof e.omitBrokenSymbolicLinks==`boolean`&&(t.omitBrokenSymbolicLinks=e.omitBrokenSymbolicLinks,debug(`omitBrokenSymbolicLinks '${t.omitBrokenSymbolicLinks}'`)),typeof e.excludeHiddenFiles==`boolean`&&(t.excludeHiddenFiles=e.excludeHiddenFiles,debug(`excludeHiddenFiles '${t.excludeHiddenFiles}'`))),t}const sa=process.platform===`win32`;function dirname$2(e){if(e=safeTrimTrailingSeparator$1(e),sa&&/^\\\\[^\\]+(\\[^\\]+)?$/.test(e))return e;let t=u.dirname(e);return sa&&/^\\\\[^\\]+\\[^\\]+\\$/.test(t)&&(t=safeTrimTrailingSeparator$1(t)),t}function ensureAbsoluteRoot$1(e,t){if(g(e,`ensureAbsoluteRoot parameter 'root' must not be empty`),g(t,`ensureAbsoluteRoot parameter 'itemPath' must not be empty`),hasAbsoluteRoot$1(t))return t;if(sa){if(t.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)){let e=process.cwd();return g(e.match(/^[A-Z]:\\/i),`Expected current directory to start with an absolute drive root. Actual '${e}'`),t[0].toUpperCase()===e[0].toUpperCase()?t.length===2?`${t[0]}:\\${e.substr(3)}`:(e.endsWith(`\\`)||(e+=`\\`),`${t[0]}:\\${e.substr(3)}${t.substr(2)}`):`${t[0]}:\\${t.substr(2)}`}if(normalizeSeparators$1(t).match(/^\\$|^\\[^\\]/)){let e=process.cwd();return g(e.match(/^[A-Z]:\\/i),`Expected current directory to start with an absolute drive root. Actual '${e}'`),`${e[0]}:\\${t.substr(1)}`}}return g(hasAbsoluteRoot$1(e),`ensureAbsoluteRoot parameter 'root' must have an absolute root`),e.endsWith(`/`)||sa&&e.endsWith(`\\`)||(e+=u.sep),e+t}function hasAbsoluteRoot$1(e){return g(e,`hasAbsoluteRoot parameter 'itemPath' must not be empty`),e=normalizeSeparators$1(e),sa?e.startsWith(`\\\\`)||/^[A-Z]:\\/i.test(e):e.startsWith(`/`)}function hasRoot$1(e){return g(e,`isRooted parameter 'itemPath' must not be empty`),e=normalizeSeparators$1(e),sa?e.startsWith(`\\`)||/^[A-Z]:/i.test(e):e.startsWith(`/`)}function normalizeSeparators$1(e){return e||=``,sa?(e=e.replace(/\//g,`\\`),(/^\\\\+[^\\]/.test(e)?`\\`:``)+e.replace(/\\\\+/g,`\\`)):e.replace(/\/\/+/g,`/`)}function safeTrimTrailingSeparator$1(e){return e?(e=normalizeSeparators$1(e),!e.endsWith(u.sep)||e===u.sep||sa&&/^[A-Z]:\\$/i.test(e)?e:e.substr(0,e.length-1)):``}var ca;(function(e){e[e.None=0]=`None`,e[e.Directory=1]=`Directory`,e[e.File=2]=`File`,e[e.All=3]=`All`})(ca||={});const la=process.platform===`win32`;function getSearchPaths$1(e){e=e.filter(e=>!e.negate);let t={};for(let n of e){let e=la?n.searchPath.toUpperCase():n.searchPath;t[e]=`candidate`}let n=[];for(let r of e){let e=la?r.searchPath.toUpperCase():r.searchPath;if(t[e]===`included`)continue;let i=!1,a=e,o=dirname$2(a);for(;o!==a;){if(t[o]){i=!0;break}a=o,o=dirname$2(a)}i||(n.push(r.searchPath),t[e]=`included`)}return n}function match$2(e,t){let n=ca.None;for(let r of e)r.negate?n&=~r.match(t):n|=r.match(t);return n}function partialMatch$1(e,t){return e.some(e=>!e.negate&&e.partialMatch(t))}var ua=__commonJSMin(((e,t)=>{t.exports=function(e,t){for(var r=[],i=0;i{t.exports=balanced;function balanced(e,t,n){e instanceof RegExp&&(e=maybeMatch(e,n)),t instanceof RegExp&&(t=maybeMatch(t,n));var r=range(e,t,n);return r&&{start:r[0],end:r[1],pre:n.slice(0,r[0]),body:n.slice(r[0]+e.length,r[1]),post:n.slice(r[1]+t.length)}}function maybeMatch(e,t){var n=t.match(e);return n?n[0]:null}balanced.range=range;function range(e,t,n){var r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;)u==c?(r.push(u),c=n.indexOf(e,u+1)):r.length==1?s=[r.pop(),l]:(i=r.pop(),i=0?c:l;r.length&&(s=[a,o])}return s}})),fa=__commonJSMin(((e,t)=>{ua();var n=da();t.exports=expandTop;var r=`\0SLASH`+Math.random()+`\0`,i=`\0OPEN`+Math.random()+`\0`,a=`\0CLOSE`+Math.random()+`\0`,o=`\0COMMA`+Math.random()+`\0`,s=`\0PERIOD`+Math.random()+`\0`,c=1e5,l=4e6;function numeric(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function escapeBraces(e){return e.split(`\\\\`).join(r).split(`\\{`).join(i).split(`\\}`).join(a).split(`\\,`).join(o).split(`\\.`).join(s)}function unescapeBraces(e){return e.split(r).join(`\\`).split(i).join(`{`).split(a).join(`}`).split(o).join(`,`).split(s).join(`.`)}function parseCommaParts(e){if(!e)return[``];var t=[],r=n(`{`,`}`,e);if(!r)return e.split(`,`);var i=r.pre,a=r.body,o=r.post,s=i.split(`,`);s[s.length-1]+=`{`+a+`}`;var c=parseCommaParts(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function expandTop(e,t){if(!e)return[];t||={};var n=t.max==null?c:t.max,r=t.maxLength==null?l:t.maxLength;return e.substr(0,2)===`{}`&&(e=`\\{\\}`+e.substr(2)),expand(escapeBraces(e),n,r,!0).map(unescapeBraces)}function embrace(e){return`{`+e+`}`}function isPadded(e){return/^-?0\d/.test(e)}function lte(e,t){return e<=t}function gte(e,t){return e>=t}function combine(e,t,n,r,i,a,o,s){for(var c=[],l=0,u=0;u=i)return c;var f=e[u]+n+r[d];if(!(o&&f.length===t[u])){if(l+f.length>a)return c;c.push(f),s.push(t[u]),l+=f.length}}return c}function expandSequence(e,t,n,r){var i=e.split(/\.\./),a=[];if(i[0]===void 0||i[1]===void 0)return a;var o=numeric(i[0]),s=numeric(i[1]),c=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(numeric(i[2])),1):1,u=lte;s0){var v=Array(g+1).join(`0`);h=p<0?`-`+v+h.slice(1):v+h}}if(f+h.length>r)break;a.push(h),f+=h.length}return a}function expand(e,t,r,i){for(var o=[``],s=[0],c=!1,l=!0,u;;){var d=n(`{`,`}`,e);if(!d)return combine(o,s,e,[``],t,r,c,[]);var f=d.pre;if(/\$$/.test(f))return combine(o,s,e,[``],t,r,c,[]);var p=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(d.body),h=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(d.body),g=p||h,v=d.body.indexOf(`,`)>=0;if(!g&&!v){if(d.post.match(/,(?!,).*\}/)){e=d.pre+`{`+d.body+a+d.post,i=!0,l=!0,c=!1,s=[];for(var y=0;y=t||w+O.length>r)break outer;b.push(O),w+=O.length}}}if(u=[],o=combine(o,s,f,b,t,r,c&&!d.post.length,u),s=u,!d.post.length)break;e=d.post}return o}})),pa=__toESM(__commonJSMin(((e,t)=>{t.exports=minimatch,minimatch.Minimatch=Minimatch;var n=function(){try{return R(`path`)}catch{}}()||{sep:`/`};minimatch.sep=n.sep;var r=minimatch.GLOBSTAR=Minimatch.GLOBSTAR={},i=fa(),a={"!":{open:`(?:(?!(?:`,close:`))[^/]*?)`},"?":{open:`(?:`,close:`)?`},"+":{open:`(?:`,close:`)+`},"*":{open:`(?:`,close:`)*`},"@":{open:`(?:`,close:`)`}},o=`[^/]`,s=o+`*?`,c=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,l=`(?:(?!(?:\\/|^)\\.).)*?`,u=charSet(`().*{}+?[]^$\\!`);function charSet(e){return e.split(``).reduce(function(e,t){return e[t]=!0,e},{})}var d=/\/+/;minimatch.filter=filter;function filter(e,t){return t||={},function(n,r,i){return minimatch(n,e,t)}}function ext(e,t){t||={};var n={};return Object.keys(e).forEach(function(t){n[t]=e[t]}),Object.keys(t).forEach(function(e){n[e]=t[e]}),n}minimatch.defaults=function(e){if(!e||typeof e!=`object`||!Object.keys(e).length)return minimatch;var t=minimatch,m=function(n,r,i){return t(n,r,ext(e,i))};return m.Minimatch=function(n,r){return new t.Minimatch(n,ext(e,r))},m.Minimatch.defaults=function(n){return t.defaults(ext(e,n)).Minimatch},m.filter=function(n,r){return t.filter(n,ext(e,r))},m.defaults=function(n){return t.defaults(ext(e,n))},m.makeRe=function(n,r){return t.makeRe(n,ext(e,r))},m.braceExpand=function(n,r){return t.braceExpand(n,ext(e,r))},m.match=function(n,r,i){return t.match(n,r,ext(e,i))},m},Minimatch.defaults=function(e){return minimatch.defaults(e).Minimatch};function minimatch(e,t,n){return assertValidPattern(t),n||={},!n.nocomment&&t.charAt(0)===`#`?!1:new Minimatch(t,n).match(e)}function Minimatch(e,t){if(!(this instanceof Minimatch))return new Minimatch(e,t);assertValidPattern(e),t||={},e=e.trim(),!t.allowWindowsEscape&&n.sep!==`/`&&(e=e.split(n.sep).join(`/`)),this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion===void 0?200:t.maxGlobstarRecursion,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.make()}Minimatch.prototype.debug=function(){},Minimatch.prototype.make=make;function make(){var e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();var n=this.globSet=this.braceExpand();t.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,n),n=this.globParts=n.map(function(e){return e.split(d)}),this.debug(this.pattern,n),n=n.map(function(e,t,n){return e.map(this.parse,this)},this),this.debug(this.pattern,n),n=n.filter(function(e){return e.indexOf(!1)===-1}),this.debug(this.pattern,n),this.set=n}Minimatch.prototype.parseNegate=parseNegate;function parseNegate(){var e=this.pattern,t=!1,n=this.options,r=0;if(!n.nonegate){for(var i=0,a=e.length;if)throw TypeError(`pattern is too long`)};Minimatch.prototype.parse=parse;var p={};function parse(e,t){assertValidPattern(e);var n=this.options;if(e===`**`){if(n.noglobstar)e=`*`;else return r}if(e===``)return``;var i=``,c=!!n.nocase,l=!1,d=[],f=[],h,g=!1,v=-1,y=-1,b=e.charAt(0)===`.`?``:n.dot?`(?!(?:^|\\/)\\.{1,2}(?:$|\\/))`:`(?!\\.)`,x=this;function clearStateChar(){if(h){switch(h){case`*`:i+=s,c=!0;break;case`?`:i+=o,c=!0;break;default:i+=`\\`+h}x.debug(`clearStateChar %j %j`,h,i),h=!1}}for(var S=0,C=e.length,w;S-1;j--){var M=f[j],N=i.slice(0,M.reStart),P=i.slice(M.reStart,M.reEnd-8),ee=i.slice(M.reEnd-8,M.reEnd),F=i.slice(M.reEnd);ee+=F;var te=N.split(`(`).length-1,ne=F;for(S=0;S=0&&(a=e[o],!a);o--);for(o=0;o=0;o--)if(t[o]===r){c=o;break}var l=t.slice(a,s),u=n?t.slice(s+1):t.slice(s+1,c),d=n?[]:t.slice(c+1);if(l.length){var f=e.slice(i,i+l.length);if(!this._matchOne(f,l,n,0,0))return!1;i+=l.length}var p=0;if(d.length){if(d.length+i>e.length)return!1;var h=e.length-d.length;if(this._matchOne(e,d,n,h,0))p=d.length;else{if(e[e.length-1]!==``||i+d.length===e.length||(h--,!this._matchOne(e,d,n,h,0)))return!1;p=d.length+1}}if(!u.length){var g=!!p;for(o=i;o0,`Parameter 'itemPath' must not be an empty array`);for(let t=0;tPattern$1.getLiteral(e)).filter(e=>!a&&!(a=e===``));this.searchPath=new Path$1(o).toString(),this.rootRegExp=new RegExp(Pattern$1.regExpEscape(o[0]),ga?`i`:``),this.isImplicitPattern=t;let s={dot:!0,nobrace:!0,nocase:ga,nocomment:!0,noext:!0,nonegate:!0};i=ga?i.replace(/\\/g,`/`):i,this.minimatch=new ha(i,s)}match(e){return this.segments[this.segments.length-1]===`**`?(e=normalizeSeparators$1(e),!e.endsWith(u.sep)&&this.isImplicitPattern===!1&&(e=`${e}${u.sep}`)):e=safeTrimTrailingSeparator$1(e),this.minimatch.match(e)?this.trailingSeparator?ca.Directory:ca.All:ca.None}partialMatch(e){return e=safeTrimTrailingSeparator$1(e),dirname$2(e)===e?this.rootRegExp.test(e):this.minimatch.matchOne(e.split(ga?/\\+/:/\/+/),this.minimatch.set[0],!0)}static globEscape(e){return(ga?e:e.replace(/\\/g,`\\\\`)).replace(/(\[)(?=[^/]+\])/g,`[[]`).replace(/\?/g,`[?]`).replace(/\*/g,`[*]`)}static fixupPattern(e,n){g(e,`pattern cannot be empty`);let r=new Path$1(e).segments.map(e=>Pattern$1.getLiteral(e));if(g(r.every((e,t)=>(e!==`.`||t===0)&&e!==`..`),`Invalid pattern '${e}'. Relative pathing '.' and '..' is not allowed.`),g(!hasRoot$1(e)||r[0],`Invalid pattern '${e}'. Root segment must not contain globs.`),e=normalizeSeparators$1(e),e===`.`||e.startsWith(`.${u.sep}`))e=Pattern$1.globEscape(process.cwd())+e.substr(1);else if(e===`~`||e.startsWith(`~${u.sep}`))n||=t.homedir(),g(n,`Unable to determine HOME directory`),g(hasAbsoluteRoot$1(n),`Expected HOME directory to be a rooted path. Actual '${n}'`),e=Pattern$1.globEscape(n)+e.substr(1);else if(ga&&(e.match(/^[A-Z]:$/i)||e.match(/^[A-Z]:[^\\]/i))){let t=ensureAbsoluteRoot$1(`C:\\dummy-root`,e.substr(0,2));e.length>2&&!t.endsWith(`\\`)&&(t+=`\\`),e=Pattern$1.globEscape(t)+e.substr(2)}else if(ga&&(e===`\\`||e.match(/^\\[^\\]/))){let t=ensureAbsoluteRoot$1(`C:\\dummy-root`,`\\`);t.endsWith(`\\`)||(t+=`\\`),e=Pattern$1.globEscape(t)+e.substr(1)}else e=ensureAbsoluteRoot$1(Pattern$1.globEscape(process.cwd()),e);return normalizeSeparators$1(e)}static getLiteral(e){let t=``;for(let n=0;n=0){if(r.length>1)return``;if(r){t+=r,n=i;continue}}}t+=r}return t}static regExpEscape(e){return e.replace(/[[\\^$.|?*+()]/g,`\\$&`)}},SearchState$1=class{constructor(e,t){this.path=e,this.level=t}},__awaiter$13=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},__asyncValues$4=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},verb(`next`),verb(`throw`),verb(`return`),n[Symbol.asyncIterator]=function(){return this},n);function verb(t){n[t]=e[t]&&function(n){return new Promise(function(r,i){n=e[t](n),settle(r,i,n.done,n.value)})}}function settle(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},__await$1=function(e){return this instanceof __await$1?(this.v=e,this):new __await$1(e)},__asyncGenerator$1=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),verb(`next`),verb(`throw`),verb(`return`,awaitReturn),i[Symbol.asyncIterator]=function(){return this},i;function awaitReturn(e){return function(t){return Promise.resolve(t).then(e,reject)}}function verb(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||resume(e,t)})},t&&(i[e]=t(i[e])))}function resume(e,t){try{step(r[e](t))}catch(e){settle(a[0][3],e)}}function step(e){e.value instanceof __await$1?Promise.resolve(e.value.v).then(fulfill,reject):settle(a[0][2],e)}function fulfill(e){resume(`next`,e)}function reject(e){resume(`throw`,e)}function settle(e,t){e(t),a.shift(),a.length&&resume(a[0][0],a[0][1])}};const va=process.platform===`win32`;var ya=class DefaultGlobber$1{constructor(e){this.patterns=[],this.searchPaths=[],this.options=getOptions$1(e)}getSearchPaths(){return this.searchPaths.slice()}glob(){return __awaiter$13(this,void 0,void 0,function*(){var e,t,n,r;let i=[];try{for(var a=!0,o=__asyncValues$4(this.globGenerator()),s;s=yield o.next(),e=s.done,!e;a=!0){r=s.value,a=!1;let e=r;i.push(e)}}catch(e){t={error:e}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return i})}globGenerator(){return __asyncGenerator$1(this,arguments,function*(){let e=getOptions$1(this.options),t=[];for(let n of this.patterns)t.push(n),e.implicitDescendants&&(n.trailingSeparator||n.segments[n.segments.length-1]!==`**`)&&t.push(new _a(n.negate,!0,n.segments.concat(`**`)));let n=[];for(let e of getSearchPaths$1(t)){debug(`Search path '${e}'`);try{yield __await$1(a.promises.lstat(e))}catch(e){if(e.code===`ENOENT`)continue;throw e}n.unshift(new SearchState$1(e,1))}let r=[];for(;n.length;){let i=n.pop(),o=match$2(t,i.path),s=!!o||partialMatch$1(t,i.path);if(!o&&!s)continue;let c=yield __await$1(DefaultGlobber$1.stat(i,e,r));if(c&&!(e.excludeHiddenFiles&&u.basename(i.path).match(/^\./))){if(c.isDirectory()){if(o&ca.Directory&&e.matchDirectories)yield yield __await$1(i.path);else if(!s)continue;let t=i.level+1,r=(yield __await$1(a.promises.readdir(i.path))).map(e=>new SearchState$1(u.join(i.path,e),t));n.push(...r.reverse())}else o&ca.File&&(yield yield __await$1(i.path))}}})}static create(e,t){return __awaiter$13(this,void 0,void 0,function*(){let n=new DefaultGlobber$1(t);va&&(e=e.replace(/\r\n/g,` `),e=e.replace(/\r/g,` `));let r=e.split(` @@ -218,4 +218,4 @@ More info on storage limits: https://docs.github.com/en/billing/managing-billing `));let r=e.split(` `).map(e=>e.trim());for(let e of r)if(!e||e.startsWith(`#`))continue;else n.patterns.push(new ey(e));return n.searchPaths.push(...getSearchPaths(n.patterns)),n})}static stat(e,t,n){return __awaiter$2(this,void 0,void 0,function*(){let r;if(t.followSymbolicLinks)try{r=yield a.promises.stat(e.path)}catch(n){if(n.code===`ENOENT`){if(t.omitBrokenSymbolicLinks){debug(`Broken symlink '${e.path}'`);return}throw Error(`No information found for the path '${e.path}'. This may indicate a broken symbolic link.`)}throw n}else r=yield a.promises.lstat(e.path);if(r.isDirectory()&&t.followSymbolicLinks){let t=yield a.promises.realpath(e.path);for(;n.length>=e.level;)n.pop();if(n.some(e=>e===t)){debug(`Symlink cycle detected for path '${e.path}' and realpath '${t}'`);return}n.push(t)}return r})}},__awaiter$1=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},__asyncValues=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},verb(`next`),verb(`throw`),verb(`return`),n[Symbol.asyncIterator]=function(){return this},n);function verb(t){n[t]=e[t]&&function(n){return new Promise(function(r,i){n=e[t](n),settle(r,i,n.done,n.value)})}}function settle(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}};function hashFiles$1(e,t){return __awaiter$1(this,arguments,void 0,function*(e,t,n=!1){var r,o,s,c;let l=n?info:debug,d=!1,f=t||(process.env.GITHUB_WORKSPACE??process.cwd()),p=i.createHash(`sha256`),h=0;try{for(var g=!0,v=__asyncValues(e.globGenerator()),b;b=yield v.next(),r=b.done,!r;g=!0){c=b.value,g=!1;let e=c;if(l(e),!e.startsWith(`${f}${u.sep}`)){l(`Ignore '${e}' since it is not under GITHUB_WORKSPACE.`);continue}if(a.statSync(e).isDirectory()){l(`Skip directory '${e}'.`);continue}let t=i.createHash(`sha256`);yield y.promisify(Se.pipeline)(a.createReadStream(e),t),p.write(t.digest()),h++,d||=!0}}catch(e){o={error:e}}finally{try{!g&&!r&&(s=v.return)&&(yield s.call(v))}finally{if(o)throw o.error}}return p.end(),d?(l(`Found ${h} files to hash.`),p.digest(`hex`)):(l(`No matches found for glob`),``)})}var __awaiter=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};function create(e,t){return __awaiter(this,void 0,void 0,function*(){return yield ny.create(e,t)})}function hashFiles(e){return __awaiter(this,arguments,void 0,function*(e,t=``,n,r=!1){let i=!0;return n&&typeof n.followSymbolicLinks==`boolean`&&(i=n.followSymbolicLinks),hashFiles$1(yield create(e,{followSymbolicLinks:i}),t,r)})}async function restoreCache(e){let t=getConfiguredProjectDir(e),n=detectLockFile(e.cacheDependencyPath,t);if(!n){warning(e.cacheDependencyPath?`No lock file found for cache-dependency-path: ${e.cacheDependencyPath}. Skipping cache restore.`:`No lock file found in project directory: ${t}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}info(`Using lock file: ${n.path}`);let r=ne(n.path);info(`Resolving dependency cache directory in: ${r}`);let i=await getCacheDirectories(n.type,r);if(!i.length){warning(`No cache directories found for ${n.type} in ${r}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}debug(`Cache paths: ${i.join(`, `)}`),saveState(`CACHE_PATHS`,JSON.stringify(i));let a=process.env.RUNNER_OS||be(),o=ve(),s=await hashFiles(n.path);if(!s)throw Error(`Failed to generate hash for lock file: ${n.path}`);let c=`vite-plus-${a}-${o}-${n.type}-${s}`,l=[`vite-plus-${a}-${o}-${n.type}-`,`vite-plus-${a}-${o}-`];debug(`Primary key: ${c}`),debug(`Restore keys: ${l.join(`, `)}`),saveState(`CACHE_PRIMARY_KEY`,c);let u=await restoreCache$1(i,c,l);u?(info(`Cache restored from key: ${u}`),saveState(`CACHE_MATCHED_KEY`,u),setOutput(`cache-hit`,!0)):(info(`Cache not found`),setOutput(`cache-hit`,!1))}async function saveCache(){let e=getState(`CACHE_PRIMARY_KEY`),t=getState(`CACHE_MATCHED_KEY`),n=getState(`CACHE_PATHS`);if(!e){info(`No cache key found. Skipping cache save.`);return}if(!n){info(`No cache paths found. Skipping cache save.`);return}if(e===t){info(`Cache hit on primary key "${e}". Skipping save.`);return}let r=JSON.parse(n);if(!r.length){info(`Empty cache paths. Skipping cache save.`);return}try{if(await saveCache$1(r,e)===-1){info(`Cache not saved (key already reserved by a concurrent job, or save was skipped).`);return}info(`Cache saved with key: ${e}`)}catch(e){warning(`Failed to save cache: ${String(e)}`)}}function resolveNodeVersionFile(e,t){let n=resolvePath(e,t||getWorkspaceDir()),r;try{r=fe(n,`utf-8`)}catch{throw Error(`node-version-file not found: ${n}`)}let i=F(n),a;if(a=i===`.tool-versions`?parseToolVersions(r):i===`package.json`?parsePackageJson(r):parsePlainVersionFile(r),!a)throw Error(`No Node.js version found in ${e}`);return a=a.replace(/^v/i,``),info(`Resolved Node.js version '${a}' from ${e}`),a}function parsePlainVersionFile(e){for(let t of e.split(` `)){let e=(t.includes(`#`)?t.slice(0,t.indexOf(`#`)):t).trim();if(e)return normalizeNvmAlias(e)}}function normalizeNvmAlias(e){let t=e.toLowerCase();return t===`node`||t===`stable`?`latest`:e}function parseToolVersions(e){for(let t of e.split(` -`)){let e=t.trim();if(!e||e.startsWith(`#`))continue;let[n,...r]=e.split(/\s+/);if(n===`nodejs`||n===`node`){for(let e of r)if(isAsdfInstallableVersion(e))return e}}}function isAsdfInstallableVersion(e){return!!e&&e!==`system`&&!e.startsWith(`ref:`)&&!e.startsWith(`path:`)}function parsePackageJson(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Failed to parse package.json: invalid JSON`)}let n=t.devEngines;if(n?.runtime){let e=findNodeRuntime(n.runtime);if(e)return e}let r=t.engines;if(r?.node&&typeof r.node==`string`)return r.node}function findNodeRuntime(e){let t=Array.isArray(e)?e:[e];for(let e of t)if(e?.name===`node`&&typeof e.version==`string`)return e.version}const ry=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let n=detectLockfileForProject(e,t);if(!n)return;let r=n.filename.endsWith(`.lockb`)?textBunLockBeside(n):n;if(!r){debug(`Cannot read ${n.filename} (binary) to resolve the ${Xi} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let i=parseVitePlusVersionFromLockfile(r,workspaceSubPath(ne(r.path),e));if(i)return info(`Resolved ${Xi} version '${i}' from ${r.filename}`),i;debug(`No ${Xi} version found in ${r.path}`)}function detectLockfileForProject(e,t){if(t)return detectLockFile(t,e,!0);let n=getWorkspaceDir(),r=e;for(;;){let e=detectLockFile(void 0,r,!0);if(e)return e;let t=ne(r);if(r===n||t===r||!isWithin(t,n))break;r=t}}function textBunLockBeside(e){let t=I(ne(e.path),`bun.lock`);return ue(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=ie(e,t);return n?n.split(oe).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=fe(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&ry.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${Zi}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${Zi}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[Zi]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,Gi.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[Zi],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(ry.test(e))return e}}}}function fromYarnLock(e){let t=new Set,n=e.split(/\r?\n/);for(let e=0;e!n.has(authKeyFor(e))),envVarRefs:r}}function writeSupplementalAuth(e){let t=getRunnerNpmrcPath(),n=new Set(e.map(authKeyFor)),r=readNpmrc(t),i=[...(r===void 0?[]:r.split(/\r?\n/)).filter(e=>{let t=e.indexOf(`=`);return t<=0||!n.has(e.slice(0,t).trim().toLowerCase())}),...e.map(buildAuthLine)].join(_e);if(exportVariable(`NPM_CONFIG_USERCONFIG`,t),exportVariable(`PNPM_CONFIG_USERCONFIG`,t),r===i){debug(`Supplemental .npmrc at ${t} already current`);return}he(t,i),info(`Wrote _authToken entries to ${t} for registries: ${e.join(`, `)}`)}function propagateProjectNpmrcAuth(e){let t=I(e,`.npmrc`),n=readNpmrc(t);if(n===void 0)return;let{registriesNeedingAuth:r,envVarRefs:i}=analyzeProjectNpmrc(n);process.env.NODE_AUTH_TOKEN&&r.length>0&&(writeSupplementalAuth(r),i.add(`NODE_AUTH_TOKEN`));let a=[...i].filter(e=>!isReservedEnvVar(e)&&!!process.env[e]);if(a.length===0){debug(`Project .npmrc at ${t}: no auth env vars to propagate`);return}info(`Detected project .npmrc at ${t}. Propagating auth env vars: ${a.join(`, `)}`);for(let e of a)exportVariable(e,process.env[e])}async function runMain(e){saveState(`IS_POST`,`true`);let t=getConfiguredProjectDir(e),n=e.nodeVersion;!n&&e.nodeVersionFile&&(n=resolveNodeVersionFile(e.nodeVersionFile,t));let r=resolveVitePlusVersion(e,t);await installVitePlus({...e,version:r}),e.nodeManager===!1?(info(`Disabling Vite+ Node.js version management via vp env off...`),await exec(`vp`,[`env`,`off`])):n&&(info(`Setting up Node.js ${n} via vp env use...`),await exec(`vp`,[`env`,`use`,n])),e.registryUrl?configAuthentication(e.registryUrl,e.scope):propagateProjectNpmrcAuth(t),e.cache&&await restoreCache(e);let i=await setupSfw(e);e.runInstall.length>0&&await runViteInstall({...e,sfw:i}),await printViteVersion(t)}async function printViteVersion(e){try{let t=(await getExecOutput(`vp`,[`--version`],{cwd:e,silent:!0})).stdout.trim();info(t);let n=parseInstalledVpVersion(t);saveState(`INSTALLED_VERSION`,n),setOutput(`version`,n)}catch(e){warning(`Could not get vp version: ${String(e)}`),setOutput(`version`,`unknown`)}}async function runPost(e){e.cache&&await saveCache()}async function main(){let e=getInputs();getState(`IS_POST`)===`true`?await runPost(e):await runMain(e)}main().catch(e=>{console.error(e),setFailed(e instanceof Error?e.message:String(e))});export{}; \ No newline at end of file +`)){let e=t.trim();if(!e||e.startsWith(`#`))continue;let[n,...r]=e.split(/\s+/);if(n===`nodejs`||n===`node`){for(let e of r)if(isAsdfInstallableVersion(e))return e}}}function isAsdfInstallableVersion(e){return!!e&&e!==`system`&&!e.startsWith(`ref:`)&&!e.startsWith(`path:`)}function parsePackageJson(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Failed to parse package.json: invalid JSON`)}let n=t.devEngines;if(n?.runtime){let e=findNodeRuntime(n.runtime);if(e)return e}let r=t.engines;if(r?.node&&typeof r.node==`string`)return r.node}function findNodeRuntime(e){let t=Array.isArray(e)?e:[e];for(let e of t)if(e?.name===`node`&&typeof e.version==`string`)return e.version}const ry=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let n=detectLockfileForProject(e,t);if(!n)return;let r=n.filename.endsWith(`.lockb`)?textBunLockBeside(n):n;if(!r){debug(`Cannot read ${n.filename} (binary) to resolve the ${Xi} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let i=parseVitePlusVersionFromLockfile(r,workspaceSubPath(ne(r.path),e));if(i)return info(`Resolved ${Xi} version '${i}' from ${r.filename}`),i;debug(`No ${Xi} version found in ${r.path}`)}function detectLockfileForProject(e,t){if(t)return detectLockFile(t,e,!0);let n=getWorkspaceDir(),r=e;for(;;){let e=detectLockFile(void 0,r,!0);if(e)return e;let t=ne(r);if(r===n||t===r||!isWithin(t,n))break;r=t}}function textBunLockBeside(e){let t=I(ne(e.path),`bun.lock`);return ue(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=ie(e,t);return n?n.split(oe).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=fe(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&ry.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${Zi}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${Zi}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[Zi]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,Gi.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[Zi],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(ry.test(e))return e}}}}function fromYarnLock(e){let t=new Set,n=e.split(/\r?\n/);for(let e=0;e!n.has(authKeyFor(e))),envVarRefs:r}}function writeSupplementalAuth(e){let t=getRunnerNpmrcPath(),n=new Set(e.map(authKeyFor)),r=readNpmrc(t),i=[...(r===void 0?[]:r.split(/\r?\n/)).filter(e=>{let t=e.indexOf(`=`);return t<=0||!n.has(e.slice(0,t).trim().toLowerCase())}),...e.map(buildAuthLine)].join(_e);if(exportVariable(`NPM_CONFIG_USERCONFIG`,t),exportVariable(`PNPM_CONFIG_USERCONFIG`,t),r===i){debug(`Supplemental .npmrc at ${t} already current`);return}he(t,i),info(`Wrote _authToken entries to ${t} for registries: ${e.join(`, `)}`)}function propagateProjectNpmrcAuth(e){let t=I(e,`.npmrc`),n=readNpmrc(t);if(n===void 0)return;let{registriesNeedingAuth:r,envVarRefs:i}=analyzeProjectNpmrc(n);process.env.NODE_AUTH_TOKEN&&r.length>0&&(writeSupplementalAuth(r),i.add(`NODE_AUTH_TOKEN`));let a=[...i].filter(e=>!isReservedEnvVar(e)&&!!process.env[e]);if(a.length===0){debug(`Project .npmrc at ${t}: no auth env vars to propagate`);return}info(`Detected project .npmrc at ${t}. Propagating auth env vars: ${a.join(`, `)}`);for(let e of a)exportVariable(e,process.env[e])}async function runMain(e){saveState(`IS_POST`,`true`);let t=getConfiguredProjectDir(e),n=e.nodeVersion;!n&&e.nodeVersionFile&&(n=resolveNodeVersionFile(e.nodeVersionFile,t));let r=resolveVitePlusVersion(e,t);await installVitePlus({...e,version:r}),e.nodeManager===!1?(info(`Disabling Vite+ Node.js version management via vp env off...`),await exec(`vp`,[`env`,`off`])):n&&(info(`Setting up Node.js ${n} via vp env use...`),await exec(`vp`,[`env`,`use`,n])),e.registryUrl?configAuthentication(e.registryUrl,e.scope):propagateProjectNpmrcAuth(t),e.cache&&await restoreCache(e);let i=await setupSfw(e);await installPnpm(e),e.runInstall.length>0&&await runViteInstall({...e,sfw:i}),await printViteVersion(t)}async function printViteVersion(e){try{let t=(await getExecOutput(`vp`,[`--version`],{cwd:e,silent:!0})).stdout.trim();info(t);let n=parseInstalledVpVersion(t);saveState(`INSTALLED_VERSION`,n),setOutput(`version`,n)}catch(e){warning(`Could not get vp version: ${String(e)}`),setOutput(`version`,`unknown`)}}async function runPost(e){e.cache&&await saveCache()}async function main(){let e=getInputs();getState(`IS_POST`)===`true`?await runPost(e):await runMain(e)}main().catch(e=>{console.error(e),setFailed(e instanceof Error?e.message:String(e))});export{}; \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index a1f809f..893608b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,6 +2,7 @@ import { saveState, getState, setFailed, info, setOutput, warning } from "@actio import { exec, getExecOutput } from "@actions/exec"; import { getInputs } from "./inputs.js"; import { installVitePlus } from "./install-viteplus.js"; +import { installPnpm } from "./install-pnpm.js"; import { setupSfw } from "./install-sfw.js"; import { runViteInstall } from "./run-install.js"; import { restoreCache } from "./cache-restore.js"; @@ -59,7 +60,10 @@ async function runMain(inputs: Inputs): Promise { // (downloads our pinned binary), unsupported platform (falls back). const effectiveSfw = await setupSfw(inputs); - // Step 7: Run vp install if requested + // Step 7: Install pnpm globally for tools that invoke `pnpm` directly. + await installPnpm(inputs); + + // Step 8: Run vp install if requested if (inputs.runInstall.length > 0) { await runViteInstall({ ...inputs, sfw: effectiveSfw }); } diff --git a/src/inputs.test.ts b/src/inputs.test.ts index 66dbb64..b5bc787 100644 --- a/src/inputs.test.ts +++ b/src/inputs.test.ts @@ -31,6 +31,7 @@ describe("getInputs", () => { workingDirectory: undefined, runInstall: [], sfw: false, + pnpm: false, cache: false, cacheDependencyPath: undefined, }); @@ -132,6 +133,18 @@ describe("getInputs", () => { expect(inputs.sfw).toBe(true); }); + it("should parse pnpm input", () => { + vi.mocked(getInput).mockReturnValue(""); + vi.mocked(getBooleanInput).mockImplementation((name) => { + if (name === "pnpm") return true; + return false; + }); + + const inputs = getInputs(); + + expect(inputs.pnpm).toBe(true); + }); + it("should parse node-version-file input", () => { vi.mocked(getInput).mockImplementation((name) => { if (name === "node-version-file") return ".nvmrc"; diff --git a/src/inputs.ts b/src/inputs.ts index e1d2a4a..016b2d0 100644 --- a/src/inputs.ts +++ b/src/inputs.ts @@ -26,6 +26,7 @@ export function getInputs(): Inputs { workingDirectory: getInput("working-directory") || undefined, runInstall: parseRunInstall(getInput("run-install")), sfw: getBooleanInput("sfw"), + pnpm: getBooleanInput("pnpm"), cache: getBooleanInput("cache"), cacheDependencyPath: getInput("cache-dependency-path") || undefined, registryUrl: getInput("registry-url") || undefined, diff --git a/src/install-pnpm.test.ts b/src/install-pnpm.test.ts new file mode 100644 index 0000000..f9ae1d5 --- /dev/null +++ b/src/install-pnpm.test.ts @@ -0,0 +1,47 @@ +import { info } from "@actions/core"; +import { exec } from "@actions/exec"; +import { beforeEach, describe, expect, it, vi } from "vite-plus/test"; +import { installPnpm } from "./install-pnpm.js"; +import type { Inputs } from "./types.js"; + +vi.mock("@actions/core", () => ({ + info: vi.fn(), +})); + +vi.mock("@actions/exec", () => ({ + exec: vi.fn(), +})); + +describe("installPnpm", () => { + beforeEach(() => { + vi.resetAllMocks(); + }); + + it("installs pnpm globally when true", async () => { + const inputs: Inputs = { + version: "latest", + runInstall: [{}], + sfw: false, + pnpm: true, + cache: false, + }; + await installPnpm(inputs); + + expect(info).toHaveBeenCalledWith("Installing pnpm globally..."); + expect(exec).toHaveBeenCalledWith("vp", ["install", "-g", "pnpm"]); + }); + + it("does not install pnpm globally when false", async () => { + const inputs: Inputs = { + version: "latest", + runInstall: [{}], + sfw: false, + pnpm: false, + cache: false, + }; + await installPnpm(inputs); + + expect(info).not.toHaveBeenCalled(); + expect(exec).not.toHaveBeenCalled(); + }); +}); diff --git a/src/install-pnpm.ts b/src/install-pnpm.ts new file mode 100644 index 0000000..4125d70 --- /dev/null +++ b/src/install-pnpm.ts @@ -0,0 +1,10 @@ +import { info } from "@actions/core"; +import { exec } from "@actions/exec"; +import type { Inputs } from "./types.js"; + +export async function installPnpm(inputs: Inputs): Promise { + if (!inputs.pnpm) return; + + info("Installing pnpm globally..."); + await exec("vp", ["install", "-g", "pnpm"]); +} diff --git a/src/install-sfw.test.ts b/src/install-sfw.test.ts index 0fda107..343a3b2 100644 --- a/src/install-sfw.test.ts +++ b/src/install-sfw.test.ts @@ -142,6 +142,7 @@ function makeInputs(overrides: Partial = {}): Inputs { workingDirectory: undefined, runInstall: [{}], sfw: true, + pnpm: false, cache: false, cacheDependencyPath: undefined, registryUrl: undefined, diff --git a/src/install-viteplus.test.ts b/src/install-viteplus.test.ts index e71eebe..77df41e 100644 --- a/src/install-viteplus.test.ts +++ b/src/install-viteplus.test.ts @@ -26,6 +26,7 @@ const baseInputs: Inputs = { workingDirectory: undefined, runInstall: [], sfw: false, + pnpm: false, cache: false, cacheDependencyPath: undefined, registryUrl: undefined, diff --git a/src/run-install.test.ts b/src/run-install.test.ts index 09eea13..8be4719 100644 --- a/src/run-install.test.ts +++ b/src/run-install.test.ts @@ -32,6 +32,7 @@ const baseInputs: Inputs = { version: "latest", runInstall: [{}], sfw: true, + pnpm: false, cache: false, }; diff --git a/src/types.ts b/src/types.ts index 8438187..14d06c7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -26,6 +26,7 @@ export interface Inputs { readonly workingDirectory?: string; readonly runInstall: RunInstall[]; readonly sfw: boolean; + readonly pnpm: boolean; readonly cache: boolean; readonly cacheDependencyPath?: string; readonly registryUrl?: string; diff --git a/src/utils.test.ts b/src/utils.test.ts index 3d10c32..46420e8 100644 --- a/src/utils.test.ts +++ b/src/utils.test.ts @@ -297,6 +297,7 @@ describe("getConfiguredProjectDir", () => { workingDirectory: "web", runInstall: [], sfw: false, + pnpm: false, cache: false, cacheDependencyPath: undefined, registryUrl: undefined, @@ -314,6 +315,7 @@ describe("getConfiguredProjectDir", () => { workingDirectory: undefined, runInstall: [], sfw: false, + pnpm: false, cache: false, cacheDependencyPath: undefined, registryUrl: undefined, @@ -333,6 +335,7 @@ describe("getConfiguredProjectDir", () => { workingDirectory: "web", runInstall: [], sfw: false, + pnpm: false, cache: false, cacheDependencyPath: undefined, registryUrl: undefined, @@ -354,6 +357,7 @@ describe("getConfiguredProjectDir", () => { workingDirectory: "web", runInstall: [], sfw: false, + pnpm: false, cache: false, cacheDependencyPath: undefined, registryUrl: undefined, @@ -388,6 +392,7 @@ describe("resolvePath", () => { workingDirectory: "web", runInstall: [], sfw: false, + pnpm: false, cache: false, cacheDependencyPath: undefined, registryUrl: undefined, diff --git a/src/version-file.test.ts b/src/version-file.test.ts index fad15ca..0faf85e 100644 --- a/src/version-file.test.ts +++ b/src/version-file.test.ts @@ -628,6 +628,7 @@ describe("resolveVitePlusVersion (precedence)", () => { workingDirectory: undefined, runInstall: [], sfw: false, + pnpm: false, cache: false, cacheDependencyPath: undefined, registryUrl: undefined,