vite-plugin-taro 0.7.10-beta.1 → 0.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import{createRequire as e}from"node:module";import t from"@vitejs/plugin-react";import n from"node:path";import{fileURLToPath as r,pathToFileURL as i}from"node:url";import{isCSSRequest as a,normalizePath as o,rolldownVersion as s,transformWithOxc as c,version as l}from"vite";import u from"@tailwindcss/vite";import{RUNTIME_MODULE_ID as d,RolldownMagicString as f,build as p}from"rolldown";import{parseSync as m}from"rolldown/utils";import{existsSync as h,mkdirSync as g,promises as _,readdirSync as v,unlinkSync as y,writeFileSync as b}from"node:fs";import x,{readFile as S,readdir as C,stat as w}from"node:fs/promises";import{dev as ee,viteReporterPlugin as T,viteTransformPlugin as te}from"rolldown/experimental";import{createHash as E,randomUUID as ne}from"node:crypto";import{parseAst as re}from"rolldown/parseAst";import{Scanner as ie}from"@tailwindcss/oxide";import ae,{emitWarning as oe}from"node:process";import{performance as se}from"node:perf_hooks";import{channel as ce,tracingChannel as le}from"node:diagnostics_channel";import{RecursiveTemplate as ue,UnRecursiveTemplate as D,capitalize as de,toCamelCase as fe}from"@tarojs/shared/dist/template.js";import{components as pe}from"vite-plugin-taro-runtime/plugin-platform-tt/runtime-utils";import{components as O}from"vite-plugin-taro-runtime/plugin-platform-weapp/runtime-utils";import{components as k}from"vite-plugin-taro-runtime/plugin-platform-alipay/runtime-utils";var me=Object.create,he=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,_e=Object.getOwnPropertyNames,ve=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty,A=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),be=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=_e(t),a=0,o=i.length,s;a<o;a++)s=i[a],!ye.call(e,s)&&s!==n&&he(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=ge(t,s))||r.enumerable});return e},j=(e,t,n)=>(n=e==null?{}:me(ve(e)),be(t||!e||!e.__esModule||!ye.call(e,`default`)?he(n,`default`,{value:e,enumerable:!0}):n,e)),M=/* @__PURE__ */ e(import.meta.url);const xe=e(import.meta.url);function Se(e){return xe.resolve(`vite-plugin-taro-runtime/${e}`)}const Ce=n.dirname(xe.resolve(`vite-plugin-taro/package.json`)),we={".ts":{root:`src/runtime`,extension:`.ts`},".js":{root:`dist/runtime`,extension:`.js`}}[n.extname(r(import.meta.url))];function Te(e){return o(n.join(Ce,we.root,`${e}${we.extension}`))}const Ee=`virtual:taro/native`;function De(e){let t=Te(e===`h5`?`h5/taro-api`:`client/taro/api`),n=/* @__PURE__ */ new Map([[`virtual:taro/api`,t],[`@tarojs/taro`,t],[`virtual:taro/components`,Te(`client/taro/component`)],[Ee,Te(`client/taro/native`)]]);return{name:`vpt:client-taro`,enforce:`pre`,resolveId:e=>n.get(e)}}function Oe({appPath:e,projectRoot:t}){return o(n.resolve(t,e))}function ke({pagePath:e,projectRoot:t}){return o(n.resolve(t,`src`,`${e}.tsx`))}function Ae(e){return Ne(ke(e))}function je(e){let t=o(e).replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`^${t}(?:\\?.*)?$`)}function Me(e){return o(e.replace(/\?.*$/,``))}function Ne(e){return`/@fs/${o(n.resolve(e))}`}function Pe(e){return{name:`vpt:conditional-directives`,enforce:`pre`,transform:{filter:{id:{include:/^[^?]*\.(?:[cm]?[jt]sx?|css|s[ac]ss|less|styl)(?:\?.*)?$/,exclude:/^[^?]*\/node_modules\//},code:`#if`},handler(t,n){if(Fe(n)&&t.includes(`#if`))return{code:Ie(t,e),map:null}}}}}function Fe(e){let t=Me(e);return!t.includes(`/node_modules/`)&&/\.(?:[cm]?[jt]sx?|css|s[ac]ss|less|styl)$/.test(t)}function Ie(e,t){let n=Array.from(e.matchAll(/[^\n]*(?:\n|$)/g),e=>e[0]),r=[],i=``;for(let e of n){if(!e)continue;let n=Le(e),a=e.match(/\r?\n$/)?.[0]??``;if(!n){i+=r.every(e=>e.active)?e:a;continue}if(n.name===`ifdef`||n.name===`ifndef`){let e=r.every(e=>e.active),i=n.target.toLowerCase()===t,a=n.name===`ifdef`?i:!i;r.push({parentActive:e,matched:a,active:e&&a})}else if(n.name===`else`){let e=r.at(-1);e&&(e.active=e.parentActive&&!e.matched)}else r.pop();i+=a}return i}function Le(e){let t=e.match(/^\s*(?:(?:\/\/)|(?:\/\*))\s*#(ifdef|ifndef|if|elif|else|endif)\b([^*\r\n]*)/);if(!t)return;let n=t[1];if(n===`if`||n===`elif`)throw Error(`vpt no longer supports #${n}; use #ifdef, #ifndef, or #else`);return{name:n,target:t[2].replace(/\*\/$/,``).trim()}}const Re=`es2018`,ze=n.dirname(xe.resolve(`tailwindcss/package.json`)),Be=Te(`h5/app`);function Ve(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}var He=class{scopeTracker;enter;leave;contextEnter={skip:()=>{this._skip=!0},remove:()=>{this._remove=!0},replace:e=>{this._replacement=e}};contextLeave={remove:this.contextEnter.remove,replace:this.contextEnter.replace};_skip=!1;_remove=!1;_replacement=null;constructor(e,t){this.enter=e.enter,this.leave=e.leave,this.scopeTracker=t?.scopeTracker}replace(e,t,n,r){e&&t!==null&&(n===null?e[t]=r:e[t][n]=r)}insert(e,t,n,r){e&&t!==null&&(n===null?e[t]=r:e[t].splice(n,0,r))}remove(e,t,n){e&&t!==null&&(n===null?delete e[t]:e[t].splice(n,1))}},Ue=class extends He{constructor(e,t){super(e,t)}traverse(e,t,n,r){let i={key:null,index:n??null,ast:e},a=this.scopeTracker,o=this.enter,s=this.leave,c=this.contextEnter,l=this.contextLeave,u=(e,t,n,r,d)=>{a&&a.processNodeEnter(e);let f=e,p=!1,m=!1,h=d;if(o&&!d){let s=this._skip,l=this._remove,u=this._replacement;this._skip=!1,this._remove=!1,this._replacement=null,i.key=n,i.index=r,o.call(c,e,t,i),this._replacement&&!this._remove&&(f=this._replacement,m=!0,this.replace(t,n,r,this._replacement),a&&a.processNodeEnter(f)),this._remove&&(p=!0,f=null,this.remove(t,n,r)),this._skip&&(h=!0),this._skip=s,this._remove=l,this._replacement=u}if((!h||a)&&f)for(let e in f){if(e===`type`||e===`start`||e===`end`)continue;let t=f[e];if(t&&typeof t==`object`){if(Array.isArray(t))for(let n=0;n<t.length;n++){let r=t[n];Ve(r)&&u(r,f,e,n,h)===null&&n--}else typeof t.type==`string`&&u(t,f,e,null,h)}}if(a&&(m&&a.processNodeLeave(f),a.processNodeLeave(e)),s&&!d){let a=this._replacement,o=this._remove;this._replacement=null,this._remove=!1,i.key=n,i.index=r,s.call(l,e,t,i),this._replacement&&!this._remove&&(f=this._replacement,p?this.insert(t,n,r,this._replacement):this.replace(t,n,r,this._replacement)),this._remove&&(f=null,this.remove(t,n,r)),this._replacement=a,this._remove=o}return f};if(!Ve(e))return null;if(a&&a.onWalkStart(e),a&&!o&&!s){let t=e=>{a.processNodeEnter(e);for(let n in e){if(n===`type`||n===`start`||n===`end`)continue;let r=e[n];if(r&&typeof r==`object`){if(Array.isArray(r))for(let e=0;e<r.length;e++){let n=r[e];Ve(n)&&t(n)}else typeof r.type==`string`&&t(r)}}a.processNodeLeave(e)};return t(e),e}return u(e,r??null,t??null,n??null,!1)}};function We(e,t){return new Ue({enter:t.enter,leave:t.leave},{scopeTracker:t.scopeTracker}).traverse(e)}const Ge=/* @__PURE__ */ new Set(/* @__PURE__ */ `Program.BlockStatement.StaticBlock.TSModuleBlock.FunctionDeclaration.FunctionExpression.ArrowFunctionExpression.VariableDeclaration.ClassDeclaration.ClassExpression.ImportDeclaration.TSEnumDeclaration.TSModuleDeclaration.TSImportEqualsDeclaration.TSDeclareFunction.TSInterfaceDeclaration.TSTypeAliasDeclaration.TSTypeParameter.TSMappedType.TSEnumBody.TSMethodSignature.TSCallSignatureDeclaration.TSConstructSignatureDeclaration.TSFunctionType.TSConstructorType.TSConditionalType.CatchClause.ForStatement.ForOfStatement.ForInStatement.SwitchStatement`.split(`.`));var Ke=class{scopeIndexStack=[];scopeKeyStack=[];scopeOwnerStack=[];scopeIndexKey=``;scopes=/* @__PURE__ */ new Map;typeScopes=/* @__PURE__ */ new Map;implicitArguments=/* @__PURE__ */ new WeakMap;options;isFrozen=!1;constructor(e={}){this.options=e}onWalkStart=e=>{this.scopeIndexStack.length===0&&e.type!==`Program`&&this.scopeIndexStack.push(0)};pushScope(e){let t=this.scopeIndexStack[this.scopeIndexStack.length-1];this.scopeKeyStack.push(this.scopeIndexKey),this.scopeOwnerStack.push(e),this.scopeIndexStack.push(0),t!==void 0&&(this.scopeIndexKey=this.scopeIndexKey?`${this.scopeIndexKey}-${t}`:`${t}`)}popScope(){this.scopeOwnerStack.pop(),this.scopeIndexStack.pop(),this.scopeIndexStack[this.scopeIndexStack.length-1]!==void 0&&this.scopeIndexStack[this.scopeIndexStack.length-1]++,this.options.preserveExitedScopes||(this.scopes.delete(this.scopeIndexKey),this.typeScopes.delete(this.scopeIndexKey)),this.scopeIndexKey=this.scopeKeyStack.pop()??``}getScopeKeyAt(e){return e===this.scopeKeyStack.length-1?this.scopeIndexKey:this.scopeKeyStack[e+1]}getVarScopeKey(){let e=this.scopeOwnerStack;for(let t=e.length-1;t>=0;t--)switch(e[t].type){case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:case`TSDeclareFunction`:case`Program`:case`StaticBlock`:case`TSModuleBlock`:return this.getScopeKeyAt(t)}return``}declareInNamespace(e,t,n){let r=e.get(n.scope);r||(r=/* @__PURE__ */ new Map,e.set(n.scope,r)),r.set(t,n)}declareIdentifier(e,t,n={value:!0}){this.isFrozen||(n.value&&this.declareInNamespace(this.scopes,e,t),n.type&&this.declareInNamespace(this.typeScopes,e,t))}declareFunctionParameter(e,t){if(this.isFrozen)return;let n=qe(e);for(let e of n)this.declareIdentifier(e.name,new et(e,this.scopeIndexKey,t))}declarePattern(e,t){if(this.isFrozen)return;let n=t.type===`VariableDeclaration`&&t.kind===`var`?this.getVarScopeKey():this.scopeIndexKey,r=qe(e);for(let e of r)this.declareIdentifier(e.name,t.type===`VariableDeclaration`?new rt(e,n,t):t.type===`CatchClause`?new at(e,n,t):new et(e,n,t))}processNodeEnter=e=>{if(Ge.has(e.type))switch(e.type){case`Program`:case`BlockStatement`:case`StaticBlock`:case`SwitchStatement`:case`TSModuleBlock`:case`TSMethodSignature`:case`TSCallSignatureDeclaration`:case`TSConstructSignatureDeclaration`:case`TSFunctionType`:case`TSConstructorType`:case`TSConditionalType`:this.pushScope(e);break;case`FunctionDeclaration`:e.id?.name&&this.declareIdentifier(e.id.name,new tt(e,this.scopeIndexKey)),this.pushScope(e);for(let t of e.params)this.declareFunctionParameter(t,e);break;case`FunctionExpression`:this.pushScope(e),e.id?.name&&this.declareIdentifier(e.id.name,new tt(e,this.scopeIndexKey)),this.pushScope(e);for(let t of e.params)this.declareFunctionParameter(t,e);break;case`ArrowFunctionExpression`:this.pushScope(e);for(let t of e.params)this.declareFunctionParameter(t,e);break;case`VariableDeclaration`:for(let t of e.declarations)this.declarePattern(t.id,e);break;case`ClassDeclaration`:e.id?.name&&this.declareIdentifier(e.id.name,new $e(e.id,this.scopeIndexKey),{value:!0,type:!0}),e.typeParameters&&this.pushScope(e);break;case`ClassExpression`:this.pushScope(e),e.id?.name&&this.declareIdentifier(e.id.name,new $e(e.id,this.scopeIndexKey),{value:!0,type:!0});break;case`ImportDeclaration`:for(let t of e.specifiers){let n=e.importKind===`type`||t.type===`ImportSpecifier`&&t.importKind===`type`;this.declareIdentifier(t.local.name,new it(t,this.scopeIndexKey,e),{value:!n,type:!0})}break;case`TSEnumDeclaration`:case`TSModuleDeclaration`:case`TSImportEqualsDeclaration`:if(e.type===`TSModuleDeclaration`&&e.kind===`global`)break;e.id?.type===`Identifier`&&e.id.name&&this.declareIdentifier(e.id.name,new $e(e.id,this.scopeIndexKey),{value:!0,type:!0});break;case`TSDeclareFunction`:e.id?.name&&this.declareIdentifier(e.id.name,new $e(e.id,this.scopeIndexKey)),this.pushScope(e);break;case`TSInterfaceDeclaration`:case`TSTypeAliasDeclaration`:e.id?.name&&this.declareIdentifier(e.id.name,new $e(e.id,this.scopeIndexKey),{type:!0}),this.pushScope(e);break;case`TSTypeParameter`:e.name?.name&&this.declareIdentifier(e.name.name,new $e(e.name,this.scopeIndexKey),{type:!0});break;case`TSMappedType`:this.pushScope(e),this.declareIdentifier(e.key.name,new $e(e.key,this.scopeIndexKey),{type:!0});break;case`TSEnumBody`:this.pushScope(e);for(let t of e.members)t.id.type===`Identifier`&&this.declareIdentifier(t.id.name,new $e(t.id,this.scopeIndexKey));break;case`CatchClause`:this.pushScope(e),e.param&&this.declarePattern(e.param,e);break;case`ForStatement`:case`ForOfStatement`:case`ForInStatement`:if(this.pushScope(e),e.type===`ForStatement`&&e.init?.type===`VariableDeclaration`)for(let t of e.init.declarations)this.declarePattern(t.id,e.init);else if((e.type===`ForOfStatement`||e.type===`ForInStatement`)&&e.left.type===`VariableDeclaration`)for(let t of e.left.declarations)this.declarePattern(t.id,e.left)}};processNodeLeave=e=>{let t=this.scopeOwnerStack;for(;t.length>0&&t[t.length-1]===e;)this.popScope()};getDeclarationIn(e,t){let n=this.scopeIndexKey;for(;;){let r=e.get(n)?.get(t);if(r)return r;if(!n)return null;let i=n.lastIndexOf(`-`);n=i===-1?``:n.slice(0,i)}}isDeclared(e,t){return this.getDeclaration(e,t)!==null}getDeclaration(e,t){let n=t?.mode??`value`,r=(n===`type`?null:this.getDeclarationIn(this.scopes,e))??(n===`value`?null:this.getDeclarationIn(this.typeScopes,e));if(e===`arguments`&&n!==`type`){let e=this.scopeOwnerStack;for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`FunctionDeclaration`||n.type===`FunctionExpression`){let e=this.getScopeKeyAt(t);if(!r||Ze(e,r.scope)){let t=this.implicitArguments.get(n);return t||(t=new nt(n,e),this.implicitArguments.set(n,t)),t}break}}}return r}getCurrentScope(){return this.scopeIndexKey}isCurrentScopeUnder(e){return Ze(this.scopeIndexKey,e)}freeze(){this.isFrozen=!0,this.scopeIndexStack=[],this.scopeKeyStack=[],this.scopeOwnerStack=[],this.scopeIndexKey=``}};function qe(e){let t=[];function n(e){switch(e.type){case`Identifier`:t.push(e);break;case`AssignmentPattern`:n(e.left);break;case`RestElement`:n(e.argument);break;case`TSParameterProperty`:n(e.parameter);break;case`ArrayPattern`:for(let t of e.elements)t&&n(t.type===`RestElement`?t.argument:t);break;case`ObjectPattern`:for(let t of e.properties)n(t.type===`RestElement`?t.argument:t.value)}}return n(e),t}function Je(e,t){switch(e.type){case`Identifier`:return e===t;case`AssignmentPattern`:return Je(e.left,t);case`RestElement`:return Je(e.argument,t);case`TSParameterProperty`:return Je(e.parameter,t);case`ArrayPattern`:for(let n of e.elements)if(n&&Je(n.type===`RestElement`?n.argument:n,t))return!0;return!1;case`ObjectPattern`:for(let n of e.properties)if(Je(n.type===`RestElement`?n.argument:n.value,t))return!0;return!1}return!1}function Ye(e,t){if(!t||e.type!==`Identifier`)return!1;switch(t.type){case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:case`TSDeclareFunction`:case`TSEmptyBodyFunctionExpression`:if(t.type!==`ArrowFunctionExpression`&&t.id===e)return!0;for(let n of t.params)if(Je(n,e))return!0;return!1;case`ClassDeclaration`:case`ClassExpression`:return t.id===e;case`VariableDeclarator`:return Je(t.id,e);case`CatchClause`:return t.param?Je(t.param,e):!1;case`ImportSpecifier`:return t.local===e;case`ImportDefaultSpecifier`:case`ImportNamespaceSpecifier`:return!0;case`TSEnumDeclaration`:case`TSModuleDeclaration`:return t.id===e;case`TSImportEqualsDeclaration`:return t.id===e;case`TSParameterProperty`:return Je(t.parameter,e)}return!1}function Xe(e,t,n){if(!t)return!1;let r=n?.mode??`value`;if(e.type===`JSXIdentifier`){if(r===`type`)return!1;switch(t.type){case`JSXOpeningElement`:case`JSXClosingElement`:return t.name===e&&!/^[a-z]/.test(e.name);case`JSXMemberExpression`:return t.object===e;case`JSXAttribute`:case`JSXNamespacedName`:return!1}return!1}if(e.type!==`Identifier`||Ye(e,t))return!1;switch(t.type){case`MemberExpression`:return r!==`type`&&(t.object===e||t.computed);case`Property`:return r!==`type`&&(t.value===e||t.computed);case`MethodDefinition`:case`PropertyDefinition`:case`AccessorProperty`:case`TSAbstractMethodDefinition`:case`TSAbstractPropertyDefinition`:case`TSAbstractAccessorProperty`:return r!==`type`&&(t.value===e||t.computed);case`ExportSpecifier`:return r!==`type`&&t.local===e;case`ExportAllDeclaration`:return!1;case`ImportSpecifier`:return!1;case`LabeledStatement`:case`BreakStatement`:case`ContinueStatement`:return!1;case`MetaProperty`:return!1;case`ImportAttribute`:return!1;case`TSEnumMember`:return r!==`type`&&t.id!==e;case`TSMappedType`:return!1;case`TSTypeReference`:return r!==`value`;case`TSQualifiedName`:return r!==`value`&&t.left===e;case`TSClassImplements`:case`TSInterfaceHeritage`:return r!==`value`&&t.expression===e;case`TSTypeParameter`:case`TSInterfaceDeclaration`:case`TSTypeAliasDeclaration`:case`TSPropertySignature`:case`TSMethodSignature`:case`TSIndexSignature`:return!1;case`TSFunctionType`:case`TSConstructorType`:case`TSCallSignatureDeclaration`:case`TSConstructSignatureDeclaration`:return!1}return r!==`type`}function Ze(e,t){return e.length>t.length&&e.startsWith(t)&&(t===``||e[t.length]===`-`)}var Qe=class{scope;node;constructor(e,t){this.node=e,this.scope=t}isUnderScope(e){return Ze(this.scope,e)}},$e=class extends Qe{type=`Identifier`;get start(){return this.node.start}get end(){return this.node.end}},et=class extends Qe{type=`FunctionParam`;fnNode;constructor(e,t,n){super(e,t),this.fnNode=n}get start(){return this.fnNode.start}get end(){return this.fnNode.end}},tt=class extends Qe{type=`Function`;get start(){return this.node.start}get end(){return this.node.end}},nt=class extends Qe{type=`FunctionArguments`;get start(){return this.node.start}get end(){return this.node.end}},rt=class extends Qe{type=`Variable`;variableNode;constructor(e,t,n){super(e,t),this.variableNode=n}get start(){return this.variableNode.start}get end(){return this.variableNode.end}},it=class extends Qe{type=`Import`;importNode;constructor(e,t,n){super(e,t),this.importNode=n}get start(){return this.importNode.start}get end(){return this.importNode.end}},at=class extends Qe{type=`CatchParam`;catchNode;constructor(e,t,n){super(e,t),this.catchNode=n}get start(){return this.catchNode.start}get end(){return this.catchNode.end}};function ot({code:e,filename:t,sourcemap:n,createVisitor:r}){let i=new f(e,{filename:t}),a=m(t,e);if(a.errors.length>0){let e=a.errors.map(e=>e.message).join(`; `);throw Error(`Failed to parse ${t} with Oxc: ${e}`)}We(a.program,{enter:r(i)});let o=n?i.generateMap({file:t,hires:`boundary`,includeContent:!0,source:t}):null;return{code:i.toString(),map:o?{version:o.version,file:o.file,sources:o.sources,sourcesContent:o.sourcesContent,names:o.names,mappings:o.mappings}:null}}const st=e(Se(`components`)).resolve(`@stencil/core/internal/client`),ct=o(st);function lt(){return{name:`vpt:h5-stencil-client`,transform:{filter:{id:je(st)},handler:ut}}}function ut(e,t){if(Me(t)===ct)return ot({code:e,filename:t,sourcemap:!0,createVisitor:dt})}function dt(e){return function(t){if(t.type!==`CallExpression`||t.callee.type!==`MemberExpression`||t.callee.computed||t.callee.object.type!==`Identifier`||t.callee.object.name!==`styleContainerNode`||t.callee.property.type!==`Identifier`||t.callee.property.name!==`insertBefore`)return;let[n,r]=t.arguments;if(t.arguments.length!==2||n?.type!==`Identifier`||n.name!==`styleElm`||r?.type!==`CallExpression`||r.callee.type!==`MemberExpression`||r.callee.computed||r.callee.object.type!==`Identifier`||r.callee.object.name!==`styleContainerNode`||r.callee.property.type!==`Identifier`||r.callee.property.name!==`querySelector`)return;let[i]=r.arguments;i?.type===`Literal`&&i.value===`link`&&e.overwrite(r.start,r.end,`scopeId.startsWith("sc-taro-") ? styleContainerNode.querySelector("style,link[rel=\\"stylesheet\\"]") : styleContainerNode.querySelector("link")`)}}function ft(e){return e.config??{}}function pt(e){let{subPackages:t,subpackages:n,...r}=e.appJson;return{...r,pages:e.pages.map(e=>e.path)}}function mt(e,t){let n=e.split(t).length-1;if(n!==1)throw Error(`Expected one placeholder ${t}, found ${n}`)}function ht(e,t,n,r){let i=new f(e,{filename:t});for(let[t,r]of Object.entries(n)){mt(e,t);let n=e.indexOf(t);i.overwrite(n,n+t.length,r)}return{code:i.toString(),map:r?gt(i,t):null}}function gt(e,t){let n=e.generateMap({file:t,source:t,includeContent:!0,hires:`boundary`});return{version:n.version,file:n.file,sources:n.sources,sourcesContent:n.sourcesContent,names:n.names,mappings:n.mappings}}function _t({code:e,id:t,options:n,projectRoot:r,sourcemap:i}){return ht(e,t,{__VPT_H5_APP_CONFIG__:JSON.stringify({router:{},...pt(n)}),__VPT_H5_ROUTES__:`[${n.pages.map(e=>vt(e,r)).join(`,`)}]`},i??!0)}function vt(e,t){let n=JSON.stringify(Ae({pagePath:e.path,projectRoot:t}));return`{path:${JSON.stringify(e.path)},load:async function(context,params){const page=await import(${n});return [page,context,params]},...${JSON.stringify(ft(e))}}`}function yt(e){return{resolveId({id:t,projectRoot:n}){if(t===`\0vpt:app-component`)return Oe({appPath:e.app,projectRoot:n})},transform({code:t,id:n,projectRoot:r,sourcemap:i=!0}){if(Me(n)===o(Be))return _t({code:t,id:n,options:e,projectRoot:r,sourcemap:i})}}}function bt(e){return[...u({optimize:!1}),lt(),xt(e)]}function xt(e){let t=yt(e);return{name:`vpt:h5`,config(){return{define:Tt(),resolve:{mainFields:[`main:h5`,`browser`,`module`,`jsnext:main`,`jsnext`],alias:[{find:/^tailwindcss(?=\/|$)/,replacement:ze},{find:/^(?:@tarojs\/plugin-platform-h5\/dist|vite-plugin-taro-runtime\/plugin-platform-h5)\/runtime\/apis$/,replacement:Se(`plugin-platform-h5/runtime/apis`)},{find:/^(?:@tarojs\/plugin-platform-h5\/dist|vite-plugin-taro-runtime\/plugin-platform-h5)\/definition\.json$/,replacement:Se(`plugin-platform-h5/definition.json`)},{find:/^(?:@tarojs\/plugin-framework-react\/dist|vite-plugin-taro-runtime\/plugin-framework-react)\/runtime$/,replacement:Se(`plugin-framework-react/runtime`)},{find:/^(?:@tarojs\/runtime|vite-plugin-taro-runtime\/runtime\/h5)$/,replacement:Se(`runtime/h5`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/api$/,replacement:Se(`api`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/taro-h5\/dist\/api\/taro$/,replacement:Se(`taro-h5/dist/api/taro`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/taro-h5\/dist\/api\/index$/,replacement:Se(`taro-h5/dist/api/index`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/components\/global\.css$/,replacement:Se(`components/global.css`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/components\/dist\/taro-components\/taro-components\.css$/,replacement:Se(`components/dist/taro-components/taro-components.css`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/router$/,replacement:Se(`router`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/components$/,replacement:Se(`components`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/components\/dist\/components$/,replacement:Se(`components/dist/components`)}]},optimizeDeps:{include:[`vite-plugin-taro-runtime/plugin-platform-h5/runtime/apis`,`vite-plugin-taro-runtime/plugin-framework-react/runtime`,`vite-plugin-taro-runtime/router`,`vite-plugin-taro-runtime/runtime/h5`,`react-dom/client`],rolldownOptions:{plugins:[Ct(),lt()]}},build:{target:Re}}},resolveId:{order:`pre`,handler(e){return t.resolveId({id:e,projectRoot:this.environment.config.root})}},transform:{order:`pre`,filter:{id:je(Be)},handler(e,n){return t.transform({code:e,id:n,projectRoot:this.environment.config.root,sourcemap:!!this.environment.config.build.sourcemap})}},transformIndexHtml:{order:`pre`,handler(){return St()}}}}function St(){return[{tag:`script`,attrs:{type:`module`},children:`import '${Ne(Be)}'`,injectTo:`body`}]}function Ct(){return{name:`vpt:h5-optimizer-taro`,resolveId:wt}}function wt(e){if(e===`@tarojs/taro`)return Se(`plugin-platform-h5/runtime/apis`)}function Tt(){return{"process.env.FRAMEWORK":JSON.stringify(`react`),"process.env.SUPPORT_TARO_POLYFILL":JSON.stringify(`disabled`),"process.env.TARO_ENV":JSON.stringify(`h5`),"process.env.TARO_PLATFORM":JSON.stringify(`web`),"process.env.SUPPORT_DINGTALK_NAVIGATE":JSON.stringify(`disabled`),DEPRECATED_ADAPTER_COMPONENT:`false`}}function Et(e,t){g(e,{recursive:!0});let r=new Set(t.map(t=>n.resolve(e,t)));for(let t of v(e,{recursive:!0,withFileTypes:!0})){let e=n.resolve(t.parentPath,t.name);!t.isDirectory()&&!r.has(e)&&y(e)}}function Dt(e,t={}){let{cache:n=/* @__PURE__ */ new Map,getCacheKey:r}=t,i=function(t){let i=r?r(t):t;if(n.has(i))return n.get(i);let a=e.call(this,t);return n.set(i,a),a};return i.cache=n,i}const Ot=Te(`mini/amphibious/bootstrap`),kt=Te(`mini/native/app`),At=Te(`mini/capsule/app`),jt=Te(`mini/native/component`),Mt=Te(`mini/capsule/component`),Nt=Te(`mini/native/custom-wrapper`),Pt=Te(`mini/native/page`),Ft=Te(`mini/capsule/page`),It=Se(`runtime/mini`),Lt=d,Rt=`\0vpt:global-binding`,zt=`\0vpt:mini-polyfills`,Bt=`common/vpt/transport.js`,Vt=`\0vpt:page-component`,Ht=[n.resolve(n.dirname(It),`../..`),...[`react`,`react-dom`].map(e=>n.dirname(xe.resolve(`${e}/package.json`)))].map(e=>`${o(e)}/`),Ut=`${o(n.dirname(xe.resolve(`core-js/package.json`)))}/`,Wt=RegExp(`^${Ut.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}`);function Gt(e){let t=o(e);return t===`\0vpt:mini-polyfills`||t===`\0vpt:global-binding`||t.startsWith(Ut)}function Kt(e){let t=o(e);return Ht.some(e=>t.startsWith(e))}const qt=/* @__PURE__ */ new Map([[kt,`native`],[jt,`native`],[Nt,`native`],[Pt,`native`],[At,`entry-capsule`],[Mt,`entry-capsule`],[Ft,`entry-capsule`],[Ot,`amphibious`],[Rt,`amphibious`],[zt,`amphibious`],[Lt,`amphibious`]]);function Jt(e){for(let t of e.moduleIds){let e=qt.get(Me(t));if(e!==void 0)return e}return`normal-capsule`}var Yt=/* @__PURE__ */ A(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c}));function Xt(e){return typeof e==`function`}function Zt(e){let t=e(e=>{Error.call(e),e.stack=(/* @__PURE__ */ Error()).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}const Qt=Zt(e=>function(t){e(this),this.message=t?`${t.length} errors occurred during unsubscription:
|
|
2
2
|
${t.map((e,t)=>`${t+1}) ${e.toString()}`).join(`
|
|
3
3
|
`)}`:``,this.name=`UnsubscriptionError`,this.errors=t});function $t(e,t){if(e){let n=e.indexOf(t);0<=n&&e.splice(n,1)}}var en=class e{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:t}=this;if(t){if(this._parentage=null,Array.isArray(t))for(let e of t)e.remove(this);else t.remove(this)}let{initialTeardown:n}=this;if(Xt(n))try{n()}catch(t){e=t instanceof Qt?t.errors:[t]}let{_finalizers:r}=this;if(r){this._finalizers=null;for(let t of r)try{rn(t)}catch(t){e??=[],t instanceof Qt?e=[...e,...t.errors]:e.push(t)}}if(e)throw new Qt(e)}}add(t){if(t&&t!==this){if(this.closed)rn(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=this._finalizers??[]).push(t)}}}_hasParent(e){let{_parentage:t}=this;return t===e||Array.isArray(t)&&t.includes(e)}_addParent(e){let{_parentage:t}=this;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e}_removeParent(e){let{_parentage:t}=this;t===e?this._parentage=null:Array.isArray(t)&&$t(t,e)}remove(t){let{_finalizers:n}=this;n&&$t(n,t),t instanceof e&&t._removeParent(this)}};en.EMPTY=(()=>{let e=new en;return e.closed=!0,e})();const tn=en.EMPTY;function nn(e){return e instanceof en||e&&`closed`in e&&Xt(e.remove)&&Xt(e.add)&&Xt(e.unsubscribe)}function rn(e){Xt(e)?e():e.unsubscribe()}const an={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},on={setTimeout(e,t,...n){let{delegate:r}=on;return r?.setTimeout?r.setTimeout(e,t,...n):setTimeout(e,t,...n)},clearTimeout(e){let{delegate:t}=on;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function sn(e){on.setTimeout(()=>{let{onUnhandledError:t}=an;if(t)t(e);else throw e})}function cn(){}const ln=fn(`C`,void 0,void 0);function un(e){return fn(`E`,void 0,e)}function dn(e){return fn(`N`,e,void 0)}function fn(e,t,n){return{kind:e,value:t,error:n}}let pn=null;function mn(e){if(an.useDeprecatedSynchronousErrorHandling){let t=!pn;if(t&&(pn={errorThrown:!1,error:null}),e(),t){let{errorThrown:e,error:t}=pn;if(pn=null,e)throw t}}else e()}function hn(e){an.useDeprecatedSynchronousErrorHandling&&pn&&(pn.errorThrown=!0,pn.error=e)}var gn=class extends en{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,nn(e)&&e.add(this)):this.destination=wn}static create(e,t,n){return new bn(e,t,n)}next(e){this.isStopped?Cn(dn(e),this):this._next(e)}error(e){this.isStopped?Cn(un(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?Cn(ln,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}};const _n=Function.prototype.bind;function vn(e,t){return _n.call(e,t)}var yn=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:t}=this;if(t.next)try{t.next(e)}catch(e){xn(e)}}error(e){let{partialObserver:t}=this;if(t.error)try{t.error(e)}catch(e){xn(e)}else xn(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(e){xn(e)}}},bn=class extends gn{constructor(e,t,n){super();let r;if(Xt(e)||!e)r={next:e??void 0,error:t??void 0,complete:n??void 0};else{let t;this&&an.useDeprecatedNextContext?(t=Object.create(e),t.unsubscribe=()=>this.unsubscribe(),r={next:e.next&&vn(e.next,t),error:e.error&&vn(e.error,t),complete:e.complete&&vn(e.complete,t)}):r=e}this.destination=new yn(r)}};function xn(e){an.useDeprecatedSynchronousErrorHandling?hn(e):sn(e)}function Sn(e){throw e}function Cn(e,t){let{onStoppedNotification:n}=an;n&&on.setTimeout(()=>n(e,t))}const wn={closed:!0,next:cn,error:Sn,complete:cn},Tn=typeof Symbol==`function`&&Symbol.observable||`@@observable`;function En(e){return e}function Dn(e){return e.length===0?En:e.length===1?e[0]:function(t){return e.reduce((e,t)=>t(e),t)}}var On=class e{constructor(e){e&&(this._subscribe=e)}lift(t){let n=new e;return n.source=this,n.operator=t,n}subscribe(e,t,n){let r=jn(e)?e:new bn(e,t,n);return mn(()=>{let{operator:e,source:t}=this;r.add(e?e.call(r,t):t?this._subscribe(r):this._trySubscribe(r))}),r}_trySubscribe(e){try{return this._subscribe(e)}catch(t){e.error(t)}}forEach(e,t){return t=kn(t),new t((t,n)=>{let r=new bn({next:t=>{try{e(t)}catch(e){n(e),r.unsubscribe()}},error:n,complete:t});this.subscribe(r)})}_subscribe(e){return this.source?.subscribe(e)}[Tn](){return this}pipe(...e){return Dn(e)(this)}toPromise(e){return e=kn(e),new e((e,t)=>{let n;this.subscribe(e=>n=e,e=>t(e),()=>e(n))})}};On.create=e=>new On(e);function kn(e){return e??an.Promise??Promise}function An(e){return e&&Xt(e.next)&&Xt(e.error)&&Xt(e.complete)}function jn(e){return e&&e instanceof gn||An(e)&&nn(e)}function Mn(e){return Xt(e?.lift)}function Nn(e){return t=>{if(Mn(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError(`Unable to lift unknown Observable type`)}}function Pn(e,t,n,r,i){return new Fn(e,t,n,r,i)}var Fn=class extends gn{constructor(e,t,n,r,i,a){super(e),this.onFinalize=i,this.shouldUnsubscribe=a,this._next=t?function(n){try{t(n)}catch(t){e.error(t)}}:super._next,this._error=r?function(t){try{r(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:t}=this;super.unsubscribe(),!t&&((e=this.onFinalize)==null||e.call(this))}}};const In=Zt(e=>function(){e(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`});var Ln=class extends On{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(e){let t=new Rn(this,this);return t.operator=e,t}_throwIfClosed(){if(this.closed)throw new In}next(e){mn(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||=Array.from(this.observers);for(let t of this.currentObservers)t.next(e)}})}error(e){mn(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=e;let{observers:t}=this;for(;t.length;)t.shift().error(e)}})}complete(){mn(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:e}=this;for(;e.length;)e.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){return this.observers?.length>0}_trySubscribe(e){return this._throwIfClosed(),super._trySubscribe(e)}_subscribe(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)}_innerSubscribe(e){let{hasError:t,isStopped:n,observers:r}=this;return t||n?tn:(this.currentObservers=null,r.push(e),new en(()=>{this.currentObservers=null,$t(r,e)}))}_checkFinalizedStatuses(e){let{hasError:t,thrownError:n,isStopped:r}=this;t?e.error(n):r&&e.complete()}asObservable(){let e=new On;return e.source=this,e}};Ln.create=(e,t)=>new Rn(e,t);var Rn=class extends Ln{constructor(e,t){super(),this.destination=e,this.source=t}next(e){var t,n;(n=(t=this.destination)?.next)==null||n.call(t,e)}error(e){var t,n;(n=(t=this.destination)?.error)==null||n.call(t,e)}complete(){var e,t;(t=(e=this.destination)?.complete)==null||t.call(e)}_subscribe(e){return this.source?.subscribe(e)??tn}};const zn={now(){return(zn.delegate||Date).now()},delegate:void 0};var Bn=class extends en{constructor(e,t){super()}schedule(e,t=0){return this}};const Vn={setInterval(e,t,...n){let{delegate:r}=Vn;return r?.setInterval?r.setInterval(e,t,...n):setInterval(e,t,...n)},clearInterval(e){let{delegate:t}=Vn;return(t?.clearInterval||clearInterval)(e)},delegate:void 0};var Hn=class extends Bn{constructor(e,t){super(e,t),this.scheduler=e,this.work=t,this.pending=!1}schedule(e,t=0){if(this.closed)return this;this.state=e;let n=this.id,r=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id??this.requestAsyncId(r,this.id,t),this}requestAsyncId(e,t,n=0){return Vn.setInterval(e.flush.bind(e,this),n)}recycleAsyncId(e,t,n=0){if(n!=null&&this.delay===n&&this.pending===!1)return t;t!=null&&Vn.clearInterval(t)}execute(e,t){if(this.closed)return/* @__PURE__ */ Error(`executing a cancelled action`);this.pending=!1;let n=this._execute(e,t);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,t){let n=!1,r;try{this.work(e)}catch(e){n=!0,r=e||/* @__PURE__ */ Error(`Scheduled action threw falsy error`)}if(n)return this.unsubscribe(),r}unsubscribe(){if(!this.closed){let{id:e,scheduler:t}=this,{actions:n}=t;this.work=this.state=this.scheduler=null,this.pending=!1,$t(n,this),e!=null&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null,super.unsubscribe()}}},Un=class e{constructor(t,n=e.now){this.schedulerActionCtor=t,this.now=n}schedule(e,t=0,n){return new this.schedulerActionCtor(this,e).schedule(n,t)}};Un.now=zn.now;const Wn=new class extends Un{constructor(e,t=Un.now){super(e,t),this.actions=[],this._active=!1}flush(e){let{actions:t}=this;if(this._active){t.push(e);return}let n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}}(Hn),Gn=Wn,Kn=new On(e=>e.complete());function qn(e){return e&&Xt(e.schedule)}function Jn(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function Yn(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function Xn(e){return this instanceof Xn?(this.v=e,this):new Xn(e)}function Zn(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),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof Xn?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function Qn(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Yn==`function`?Yn(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}const $n=(e=>e&&typeof e.length==`number`&&typeof e!=`function`);function er(e){return Xt(e?.then)}function tr(e){return Xt(e[Tn])}function nr(e){return Symbol.asyncIterator&&Xt(e?.[Symbol.asyncIterator])}function rr(e){return/* @__PURE__ */ TypeError(`You provided ${typeof e==`object`&&e?`an invalid object`:`'${e}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function ir(){return typeof Symbol!=`function`||!Symbol.iterator?`@@iterator`:Symbol.iterator}const ar=ir();function or(e){return Xt(e?.[ar])}function sr(e){return Zn(this,arguments,function*(){let t=e.getReader();try{for(;;){let{value:e,done:n}=yield Xn(t.read());if(n)return yield Xn(void 0);yield yield Xn(e)}}finally{t.releaseLock()}})}function cr(e){return Xt(e?.getReader)}function lr(e){if(e instanceof On)return e;if(e!=null){if(tr(e))return ur(e);if($n(e))return dr(e);if(er(e))return fr(e);if(nr(e))return mr(e);if(or(e))return pr(e);if(cr(e))return hr(e)}throw rr(e)}function ur(e){return new On(t=>{let n=e[Tn]();if(Xt(n.subscribe))return n.subscribe(t);throw TypeError(`Provided object does not correctly implement Symbol.observable`)})}function dr(e){return new On(t=>{for(let n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function fr(e){return new On(t=>{e.then(e=>{t.closed||(t.next(e),t.complete())},e=>t.error(e)).then(null,sn)})}function pr(e){return new On(t=>{for(let n of e)if(t.next(n),t.closed)return;t.complete()})}function mr(e){return new On(t=>{gr(e,t).catch(e=>t.error(e))})}function hr(e){return mr(sr(e))}function gr(e,t){var n,r,i,a;return Jn(this,void 0,void 0,function*(){try{for(n=Qn(e);r=yield n.next(),!r.done;){let e=r.value;if(t.next(e),t.closed)return}}catch(e){i={error:e}}finally{try{r&&!r.done&&(a=n.return)&&(yield a.call(n))}finally{if(i)throw i.error}}t.complete()})}function _r(e,t,n,r=0,i=!1){let a=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(a),!i)return a}const vr=Zt(e=>function(){e(this),this.name=`EmptyError`,this.message=`no elements in sequence`});function yr(e,t){let n=typeof t==`object`;return new Promise((r,i)=>{let a=!1,o;e.subscribe({next:e=>{o=e,a=!0},error:i,complete:()=>{a?r(o):n?r(t.defaultValue):i(new vr)}})})}function br(e,t){let n=typeof t==`object`;return new Promise((r,i)=>{let a=new bn({next:e=>{r(e),a.unsubscribe()},error:i,complete:()=>{n?r(t.defaultValue):i(new vr)}});e.subscribe(a)})}function xr(e){return e instanceof Date&&!isNaN(e)}function Sr(e,t){return Nn((n,r)=>{let i=0;n.subscribe(Pn(r,n=>{r.next(e.call(t,n,i++))}))})}function Cr(e,t,n,r,i,a,o,s){let c=[],l=0,u=0,d=!1,f=()=>{d&&!c.length&&!l&&t.complete()},p=e=>l<r?m(e):c.push(e),m=e=>{a&&t.next(e),l++;let s=!1;lr(n(e,u++)).subscribe(Pn(t,e=>{i?.(e),a?p(e):t.next(e)},()=>{s=!0},void 0,()=>{if(s)try{for(l--;c.length&&l<r;){let e=c.shift();o?_r(t,o,()=>m(e)):m(e)}f()}catch(e){t.error(e)}}))};return e.subscribe(Pn(t,p,()=>{d=!0,f()})),()=>{s?.()}}function wr(e,t,n=1/0){return Xt(t)?wr((n,r)=>Sr((e,i)=>t(n,e,r,i))(lr(e(n,r))),n):(typeof t==`number`&&(n=t),Nn((t,r)=>Cr(t,r,e,n)))}function Tr(e){return new On(t=>{lr(e()).subscribe(t)})}function Er(e=0,t,n=Gn){let r=-1;return t!=null&&(qn(t)?n=t:r=t),new On(t=>{let i=xr(e)?+e-n.now():e;i<0&&(i=0);let a=0;return n.schedule(function(){t.closed||(t.next(a++),0<=r?this.schedule(void 0,r):t.complete())},i)})}function Dr(e,t){return Nn((n,r)=>{let i=0;n.subscribe(Pn(r,n=>e.call(t,n,i++)&&r.next(n)))})}function Or(e){return Nn((t,n)=>{let r=!1,i=null,a=null,o=!1,s=()=>{if(a?.unsubscribe(),a=null,r){r=!1;let e=i;i=null,n.next(e)}o&&n.complete()},c=()=>{a=null,o&&n.complete()};t.subscribe(Pn(n,t=>{r=!0,i=t,a||lr(e(t)).subscribe(a=Pn(n,s,c))},()=>{o=!0,(!r||!a||a.closed)&&n.complete()}))})}function kr(e,t=Wn){return Or(()=>Er(e,t))}function Ar(e){return Nn((t,n)=>{let r=[];return t.subscribe(Pn(n,e=>r.push(e),()=>{n.next(r),n.complete()})),lr(e).subscribe(Pn(n,()=>{let e=r;r=[],n.next(e)},cn)),()=>{r=null}})}function jr(e){return Nn((t,n)=>{let r=null,i=!1,a;r=t.subscribe(Pn(n,void 0,void 0,o=>{a=lr(e(o,jr(e)(t))),r?(r.unsubscribe(),r=null,a.subscribe(n)):i=!0})),i&&(r.unsubscribe(),r=null,a.subscribe(n))})}function Mr(e,t){return Xt(t)?wr(e,t,1):wr(e,1)}var Nr=/* @__PURE__ */ j(Yt(),1);const Pr=`vpt:mini-hmr:control`;function Fr(e,t,n,r){let i=new Ln,a=i.pipe(Dr(e=>e instanceof Error||e.updates.some(({update:e})=>e.type!==`Noop`)));return a.pipe(Ar(a.pipe(kr(e,t))),Dr(e=>e.length>0)).subscribe(e=>{let t=e.findLast(e=>e instanceof Error);t&&r(t);let i=e.filter(e=>!(e instanceof Error));i.length>0&&n({updates:i.flatMap(e=>e.updates),changedFiles:i.flatMap(e=>e.changedFiles)})}),i}const Ir=`hmr/info.js`;function Lr(e){return`module.exports = Object.freeze(${JSON.stringify(e)});\n`}function Rr(e,t){return`@import "./${e}";\n/* vpt-build:${t} */\n`}async function zr(e,t,r){let i=n.join(e,t),a=n.dirname(i);await x.mkdir(a,{recursive:!0});let o=n.join(a,`.${n.basename(i)}.${ne()}.txt`);try{await x.writeFile(o,r),await x.rename(o,i)}finally{await x.rm(o,{force:!0})}}const Br=`/__vpt_hmr__`;function Vr(e,t){let n=new Ln,r=yr(n.pipe(Mr(n=>n.kind===`barrier`?Tr(()=>(n.resolve(),Kn)):Tr(()=>Promise.resolve(e(n.action))).pipe(jr(e=>(t(n.action,e),Kn))))),{defaultValue:void 0});return{complete:async()=>{n.complete(),await r},next(e){n.next({kind:`action`,action:e})},waitForAction(e){return br(n.pipe(Dr(e=>e.kind===`action`),Sr(e=>e.action),Dr(e)))},waitForIdle(){let e=Promise.withResolvers();return n.next({kind:`barrier`,resolve:e.resolve}),e.promise}}}async function Hr(e,t){if(t.oxc===!1)return e;let n=await e;if(Array.isArray(n))return Promise.all(n.map(e=>Hr(e,t)));if(!n||!(`name`in n)||n.name!==`builtin:vite-transform`)return n;let{jsxInject:r,include:i,exclude:a,jsxRefreshInclude:o,jsxRefreshExclude:s,...c}=t.oxc;return te({root:t.root,tsconfig:t.tsconfig,include:i??/\.(m?ts|[jt]sx)$/,exclude:a??/\.js$/,jsxRefreshInclude:o,jsxRefreshExclude:s,isServerConsumer:t.consumer===`server`,jsxInject:r,transformOptions:{...c,sourcemap:!1}})}function Ur({server:e,contract:t,hmrMode:n}){return{name:`vpt:mini-dev-options`,async options(r){let i=Gr(r),a=e.config.build.rolldownOptions.output;if(Array.isArray(a))throw Error(`Mini Program development supports one configured Rolldown output.`);let o=a??{},s=new Set(t.options.pages.map(e=>`${e.path}.js`));Object.assign(i,o,{banner:n.createEntryBanner(s),format:`es`,minify:!0,keepNames:!0,sourcemap:!1}),r.experimental??={};let c=r.experimental.devMode;return r.experimental.devMode={...typeof c==`object`?c:{},implement:await qr(n.runtimeFile),lazy:!1,skipCommonRuntimeInjection:!0},r.plugins=[await Hr(r.plugins,e.environments.client.config),Kr(e)],r}}}function Wr(e){if(!e.output||Array.isArray(e.output))throw Error(`Mini Program development requires exactly one Rolldown output.`);return e.output}function Gr(e){if(Array.isArray(e.output))throw Error(`Mini Program development requires one configured Rolldown output.`);return e.output??={},e.output}function Kr(e){let{build:t,logger:r,logLevel:i,root:a}=e.config;return T({assetsDir:n.join(t.assetsDir,`/`),chunkLimit:2e3,isLib:!!t.lib,isTty:!(!process.stdout.isTTY||process.env.CI),logInfo:(i??`info`)===`info`?e=>r.info(e):void 0,reportCompressedSize:!1,root:a,warnLargeChunks:!1})}const qr=Dt(async function(e){return`__rolldown_runtime__ = (function (globalThis) {\n${(await p({input:e,output:{format:`iife`,minify:!1,sourcemap:!1},write:!1})).output[0].code}\nreturn globalThis.__rolldown_runtime__;\n})(__VPT_GLOBAL__);`});var Jr=class{publishPatches;buildId;pendingPatches=[];hasPublishedPatches=!1;constructor(e){this.publishPatches=e}isCurrentBuild(e){return e===this.buildId}startBuild(){let e=this.buildId,t=ne();return this.buildId=t,this.pendingPatches.length=0,this.hasPublishedPatches=!1,{buildId:t,previousBuildId:e}}async produce(e){this.buildId!==void 0&&e.length!==0&&(this.pendingPatches.push(...e),await this.publishPatches({buildId:this.buildId,patches:this.pendingPatches}),this.hasPublishedPatches=!0)}isBaselineCurrent(){return!this.hasPublishedPatches}acknowledge(e){let t=0;for(;t<this.pendingPatches.length&&this.pendingPatches[t].seq<=e;)t++;this.pendingPatches.splice(0,t)}};async function Yr({server:e,contract:t,styles:n,hmrMode:r}){let i=ni(e),a=Vr(p,(n,r)=>ei(e.config.logger,`${t.options.target} HMR ${n.kind} failed`,r)),o=(t,n)=>zr(e.config.build.outDir,t,n),s=new Jr(e=>d(r.publish?.(e)));e.ws.on(`vpt:mini-hmr:report`,e=>{a.next({kind:`report`,report:e})});let c=await g(),l=Fr(16,Wn,e=>{a.next({kind:`publish`,result:e})},e=>{a.next({kind:`error`,error:e})});return i._devEngine=c,i.triggerBundleRegenerationIfStale=async()=>!1,i.listen=async()=>{let e=a.waitForAction(e=>e.kind===`output`);await c.run();let{result:t}=await e;if(t instanceof Error)throw t;await c.ensureCurrentBuildFinish(),await a.waitForIdle()},r.rebuildStrategy===`on-failure`&&e.httpServer?.once(`listening`,()=>{a.next({kind:`listening`})}),Qr(e),{close:async()=>{l.complete(),await a.waitForIdle(),await c.ensureCurrentBuildFinish(),await a.complete(),e.ws.send(Pr,{kind:`close`,reason:`host closed`})}};async function u(){if(r.rebuildStrategy===`always`){let{buildId:e}=s.startBuild();await o(t.styles.appFileName,Rr(t.styles.globalFileName,e));return}let n=Xr(e);if(n===void 0)return;e.ws.send(Pr,{kind:`close`,reason:`build replaced`});let{buildId:i,previousBuildId:a}=s.startBuild();a&&await c.removeClient(a),await c.registerClient(i),await f(i,n)}async function d(t){if(t)switch(t.kind){case`write`:await o(t.fileName,t.source);return;case`event`:e.ws.send(t.event,t.data);return}}async function f(n,i){let a={buildId:n,endpoint:Zr(e,i)};await d(r.reset?.()),await o(Ir,Lr(a)),await o(t.styles.appFileName,Rr(t.styles.globalFileName,n))}function p(n){switch(n.kind){case`publish`:return v(n.result);case`error`:ei(e.config.logger,`${t.options.target} HMR update failed`,n.error);return;case`report`:return h(n.report);case`output`:if(n.result instanceof Error){ei(e.config.logger,`${t.options.target} dev build failed`,n.result);return}return m();case`listening`:return u()}}async function m(){await n.finalizeUpdate([],o),await u()}function h(e){if(s.isCurrentBuild(e.buildId))switch(e.kind){case`startup`:s.isBaselineCurrent()||_(`App started after published patches; replacing baseline`);return;case`rebuild`:_(e.reason);return;case`applied`:s.acknowledge(e.seq);return}}async function g(){let n=await i.getRolldownOptions(),o=Wr(n);return ee({...n,plugins:[n.plugins,Ur({server:e,contract:t,hmrMode:r})]},o,{onHmrUpdates:r.rebuildStrategy===`on-failure`?e=>{l.next(e)}:void 0,onOutput:e=>{a.next({kind:`output`,result:e})},rebuildStrategy:r.rebuildStrategy===`always`?`always`:`never`,watch:{skipWrite:!1,useDebounce:!0}})}function _(n){e.config.logger.info(`[vpt] ${t.options.target} full rebuild required: ${n}`),c.triggerFullBuild()}async function v(e){let t=[];for(let{clientId:n,update:r}of e.updates)if(s.isCurrentBuild(n)&&r.type!==`Noop`){if(r.type===`Patch`){t.push(r);continue}_(r.reason||`Rolldown ${r.type} update`);return}await y(t)}async function y(e){if(e.length===0)return;let t=await n.finalizeUpdate(e,o);await s.produce(t),await b(t)}async function b(e){for(let t of e)await c.notifyPayloadDelivered(t.filename)}}function Xr(e){let t=e.httpServer;if(!t)return;let n=t.address();if(n&&typeof n!=`string`)return n.port}function Zr(e,t){let n=typeof e.config.server.ws==`object`?e.config.server.ws:void 0;if(e.config.server.ws===!1||e.config.base!==`/`||n?.path!==`/__vpt_hmr__`||n?.protocol!==void 0||n?.host!==void 0||n?.port!==void 0||n?.clientPort!==void 0||n?.server!==void 0)throw Error(`Mini Program HMR requires Vite WebSocket on the development HTTP server.`);let r=e.config.server.https?`wss`:`ws`,i=new URL(`${r}://${ti(e)}:${t}${Br}`);return i.searchParams.set(`token`,e.config.webSocketToken),i.href}function Qr(e){e.printUrls=()=>{e.config.logger.info(` ${Nr.default.green(`➜`)} ${Nr.default.bold(`Mini Program project`)}: ${Nr.default.cyan($r(e.config.build.outDir,e.config.configFile,e.config.root))}`)}}function $r(e,t,r){let i=t?n.dirname(t):r,a=n.relative(i,e).replaceAll(`\\`,`/`);return a?a.startsWith(`.`)?a:`./${a}`:`.`}function ei(e,t,n){Error.isError(n)?e.error(`[vpt] ${t}`,{error:n}):e.error(`[vpt] ${t} with unknown error: ${n}`)}function ti(e){let t=e.httpServer?.address();return!t||typeof t==`string`||t.address===`0.0.0.0`||t.address===`::`?`127.0.0.1`:t.address.includes(`:`)?`[${t.address}]`:t.address}function ni(e){let t=e.environments.client.bundledDev;if(!t)throw Error(`Vite did not create the Mini Program bundled-development environment.`);return t}const ri=`hmr/patches.js`;function ii(e){return{rebuildStrategy:`on-failure`,runtimeFile:e,plugins:[ci()],createEntryBanner:si,reset:()=>({kind:`write`,fileName:ri,source:ai()}),publish:e=>({kind:`write`,fileName:ri,source:oi(e.buildId,e.patches)})}}function ai(){return`module.exports = undefined;
|
|
4
|
-
`}function oi(e,t){if(t.length===0)throw Error(`Cannot render an empty Mini Program patch range.`);let n=t.map(e=>`{seq: ${e.seq}, changedIds: ${JSON.stringify(e.changedIds)}, factory: (__rolldown_runtime__) => {\n${e.code}\n}}`);return`module.exports = {buildId: ${JSON.stringify(e)}, patches: [${n.join(`,`)}]};\n`}function si(e){return t=>t.name===`app.js`?`__rolldown_runtime__.initialize(require('./${Ir}'));\n`:e.has(t.name)?`__rolldown_runtime__.applyPatches(require('${n.posix.relative(n.posix.dirname(t.fileName),ri)}'));\n`:``}function ci(){return{name:`vpt:mini-page-shell-hmr`,apply:`serve`,transform:{order:`post`,filter:{id:je(Pt)},handler(e){return li(e)}}}}function li(e){let t=`Page(pageConfig)`;if(!e.includes(t))throw Error(`Mini Program Page shell must register pageConfig`);return{code:e.replace(t,`Page(__rolldown_runtime__.injectPageHmr(pageConfig))`),map:null}}function ui(e){return{rebuildStrategy:`on-failure`,runtimeFile:e,plugins:[],createEntryBanner:di,publish:e=>({kind:`event`,event:`vpt:hmr-interpreter:source`,data:{kind:`patches`,buildId:e.buildId,patches:e.patches}})}}function di(e){return e=>e.name===`app.js`?`__rolldown_runtime__.initialize(require('./${Ir}'));\n`:``}function fi(e){return{rebuildStrategy:`always`,runtimeFile:e,plugins:[],createEntryBanner:pi}}function pi(e){return e=>``}function mi(e,t){switch(e?.mode??`devtools`){case`devtools`:return ii(t.devtoolsHmrRuntime);case`interpreter`:return ui(t.interpreterHmrRuntime);case`rebuild`:return fi(t.devtoolsHmrRuntime)}}function hi({capsuleCode:e,componentId:t,capsuleId:n}){let r=0,i=ot({code:e,filename:n,sourcemap:!1,createVisitor(
|
|
4
|
+
`}function oi(e,t){if(t.length===0)throw Error(`Cannot render an empty Mini Program patch range.`);let n=t.map(e=>`{seq: ${e.seq}, changedIds: ${JSON.stringify(e.changedIds)}, factory: (__rolldown_runtime__) => {\n${e.code}\n}}`);return`module.exports = {buildId: ${JSON.stringify(e)}, patches: [${n.join(`,`)}]};\n`}function si(e){return t=>t.name===`app.js`?`__rolldown_runtime__.initialize(require('./${Ir}'));\n`:e.has(t.name)?`__rolldown_runtime__.applyPatches(require('${n.posix.relative(n.posix.dirname(t.fileName),ri)}'));\n`:``}function ci(){return{name:`vpt:mini-page-shell-hmr`,apply:`serve`,transform:{order:`post`,filter:{id:je(Pt)},handler(e){return li(e)}}}}function li(e){let t=`Page(pageConfig)`;if(!e.includes(t))throw Error(`Mini Program Page shell must register pageConfig`);return{code:e.replace(t,`Page(__rolldown_runtime__.injectPageHmr(pageConfig))`),map:null}}function ui(e){return{rebuildStrategy:`on-failure`,runtimeFile:e,plugins:[],createEntryBanner:di,publish:e=>({kind:`event`,event:`vpt:hmr-interpreter:source`,data:{kind:`patches`,buildId:e.buildId,patches:e.patches}})}}function di(e){return e=>e.name===`app.js`?`__rolldown_runtime__.initialize(require('./${Ir}'));\n`:``}function fi(e){return{rebuildStrategy:`always`,runtimeFile:e,plugins:[],createEntryBanner:pi}}function pi(e){return e=>``}function mi(e,t){switch(e?.mode??`devtools`){case`devtools`:return ii(t.devtoolsHmrRuntime);case`interpreter`:return ui(t.interpreterHmrRuntime);case`rebuild`:return fi(t.devtoolsHmrRuntime)}}function hi({capsuleCode:e,componentId:t,capsuleId:n}){let r=0,i=ot({code:e,filename:n,sourcemap:!1,createVisitor(n){return n.appendRight(e.length,`
|
|
5
|
+
import.meta.hot.accept()
|
|
6
|
+
`),e=>{if(e.type!==`CallExpression`||e.callee.type!==`Identifier`)return;let i=e.arguments[0];e.callee.name===`createPageConfig`&&i?.type===`Identifier`&&i.name===`PageComponent`&&(r++,n.overwrite(i.start,i.end,`__rolldown_runtime__.resolvePageComponent(${JSON.stringify(t)}, PageComponent)`))}}});if(r!==1)throw Error(`Expected one Page config component argument, found ${r}`);return i}const gi=`/@react-refresh`,_i=o(n.join(n.dirname(xe.resolve(`react-reconciler/package.json`)),`cjs/react-reconciler.development.js`));function vi(){return[{name:`vpt:mini-react-refresh-runtime`,apply:`serve`,config(){return{define:{queueMicrotask:`globalThis.queueMicrotask`,"window.$RefreshReg$":`globalThis.$RefreshReg$`,"window.$RefreshSig$":`globalThis.$RefreshSig$`,"window.__registerBeforePerformReactRefresh":`globalThis.__registerBeforePerformReactRefresh`,"window.__getReactRefreshIgnoredExports":`globalThis.__getReactRefreshIgnoredExports`}}},transform:{order:`post`,filter:{id:je(gi)},handler(e){return yi(e)}}},{name:`vpt:mini-react-refresh-renderer-dependency`,apply:`serve`,transform:{order:`post`,filter:{id:je(_i)},handler(e){return bi(e)}}}]}function yi(e){return{code:`${e}
|
|
5
7
|
injectIntoGlobalHook(globalThis);
|
|
6
8
|
globalThis.$RefreshReg$ = () => {};
|
|
7
9
|
globalThis.$RefreshSig$ = () => (type) => type;`,map:null}}function bi(e){if(!/\bhook\.inject\(internals\)/.test(e))throw Error(`React Reconciler must inject its renderer into the DevTools hook`);return{code:`import '${gi}'\n${e}`,map:null}}function xi(e){return e.name===`client`}function Si(e,t){let r=mi(e.options.hmr,e.runtime),i=r.reset?.(),a=[e.output.projectConfigFilename,e.output.projectPrivateConfigFilename,e.styles.appFileName,e.styles.globalFileName,...e.options.pages.map(t=>`${t.path}${n.extname(e.styles.appFileName)}`),...r.rebuildStrategy===`on-failure`?[Ir]:[],...i?.kind===`write`?[i.fileName]:[]],s=null,c=!0;return[{name:`vpt:mini-dev`,apply:`serve`,applyToEnvironment:xi,config(){return{define:{"performance.now":`Date.now`},build:{emptyOutDir:!1,sourcemap:!1},experimental:{bundledDev:!0},server:{ws:{path:Br}}}},configureServer:{order:`post`,async handler(n){s=await Yr({server:n,contract:e,styles:t,hmrMode:r})}},generateBundle:{order:`post`,async handler(t,n){Ci(n,e.styles.appFileName),await wi(this)}},writeBundle:{order:`post`,handler(e,t){if(!c)return;let{root:r,build:i}=this.environment.config;Et(n.resolve(r,i.outDir),[...Object.keys(t),...a]),c=!1}},closeBundle(){return s?.close()}},{name:`vpt:mini-page-capsule-hmr`,apply:`serve`,transform:{order:`pre`,filter:{id:je(Ft)},async handler(e,t){let r=await this.resolve(Vt,t);if(!r)throw Error(`Failed to resolve Page component imported by ${t}`);return hi({capsuleCode:e,componentId:o(n.relative(this.environment.config.root,r.id)),capsuleId:t})}}},{name:`vpt:mini-runtime-lowering`,apply:`serve`,transform:{order:`post`,filter:{id:je(Lt)},handler(e){return Ti(e)}}},...r.plugins,...vi()]}function Ci(e,t){delete e[t]}async function wi(e){let{publicDir:t,build:r}=e.environment.config;if(r.copyPublicDir&&t&&h(t))for(let r of await C(t,{recursive:!0,withFileTypes:!0})){if(!r.isFile())continue;let i=n.join(r.parentPath,r.name);e.emitFile({type:`asset`,fileName:o(n.relative(t,i)),source:await S(i)})}}const Ti=Dt(e=>c(e,Lt,{lang:`js`,target:Re,sourcemap:!1,assumptions:{setPublicClassFields:!0}})),Ei=Te(`global/vpt-global`),Di=`common/vpt/global.js`;function Oi(e){function t(t){let r=n.posix.relative(n.posix.dirname(e.getPhysicalChunkId(t)),Di),i=r.startsWith(`.`)?r:`./${r}`;return`require(${JSON.stringify(i)}).vptGlobal`}return[{name:`vpt:mini-global`,resolveId:{filter:{id:je(Rt)},handler(){return Rt}},load:{filter:{id:je(Rt)},handler(){return`export const vptGlobal = __VPT_GLOBAL__;`}},config(){return{build:{rolldownOptions:{transform:{inject:{globalThis:[Rt,`vptGlobal`]}}}}}},renderChunk:{order:`pre`,filter:{code:/__VPT_GLOBAL__/},handler(e,n,r){if(n.moduleIds.includes(`\0vpt:global-binding`)||n.moduleIds.includes(Lt))return c(e,n.fileName,{define:{__VPT_GLOBAL__:t(n)},sourcemap:!!r.sourcemap})}},generateBundle:{order:`post`,async handler(e){let t=await ki({dir:e.dir,minify:e.minify!==!1,sourcemap:e.sourcemap});for(let e of t.output)e.type===`asset`?this.emitFile({type:`asset`,fileName:e.fileName,source:e.source}):this.emitFile({type:`prebuilt-chunk`,fileName:e.fileName,code:e.code,exports:e.exports,facadeModuleId:Ei,isEntry:!0})}}},{name:`vpt:mini-global-dev`,apply:`serve`,renderChunk:{order:`pre`,filter:{code:/__rolldown_runtime__/},handler(e,n){return{code:(n.moduleIds.includes(Lt)?`let __rolldown_runtime__;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-taro",
|
|
3
|
-
"version": "0.7.10
|
|
3
|
+
"version": "0.7.10",
|
|
4
4
|
"author": "sep2",
|
|
5
5
|
"description": "Vite 8 plugin for building one React/Taro codebase for WeChat, Alipay, TikTok, and H5 targets.",
|
|
6
6
|
"type": "module",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"rolldown": "1.2.11",
|
|
68
68
|
"sval": "0.6.12",
|
|
69
69
|
"tailwindcss": "^4.3.3",
|
|
70
|
-
"vite-plugin-taro-runtime": "0.7.10
|
|
70
|
+
"vite-plugin-taro-runtime": "0.7.10"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"react": "^19.3.0",
|