@lemon-fe/vite-plugin-micro-frontend 1.2.2 → 1.2.4
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.d.ts +6 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -61,6 +61,11 @@ type DynamicBaseConfig = {
|
|
|
61
61
|
* 示例:`"(window.EARTH_BASE_CONFIG && window.EARTH_BASE_CONFIG.EARTH_ALL_SHARE_HOST ? window.EARTH_BASE_CONFIG.EARTH_ALL_SHARE_HOST.replace(/\\\\/$/, '') : '') + '/app-earth-wms'"`
|
|
62
62
|
*/
|
|
63
63
|
publicPath?: string;
|
|
64
|
+
/**
|
|
65
|
+
* 应用部署子路径(不含首尾 `/`),如 `app-earth-wms`。
|
|
66
|
+
* 当生产 `base` 使用占位符 `/__dynamic_base__/` 时必填,用于 publicPath 拼接与 entry import 兜底改写。
|
|
67
|
+
*/
|
|
68
|
+
appBase?: string;
|
|
64
69
|
/**
|
|
65
70
|
* 移除 HTML 中 `index-*.css` 的 link 与 dynamicBase 注入的对应 preload(样式全部由 JS 注入时使用)。
|
|
66
71
|
*/
|
|
@@ -85,7 +90,7 @@ interface RemoteConfig {
|
|
|
85
90
|
remoteName: string;
|
|
86
91
|
/** 入口文件路径 */
|
|
87
92
|
entry: string;
|
|
88
|
-
/** 是否为 ES Module */
|
|
93
|
+
/** 是否为 ES Module;为 true 时优先 dynamic import,失败则自动降级为 UMD script 加载 */
|
|
89
94
|
isESModule?: boolean;
|
|
90
95
|
}
|
|
91
96
|
/**
|
package/dist/index.js
CHANGED
|
@@ -10,5 +10,5 @@ import*as e from"path";import t,{join as n,basename as r,extname as i,relative a
|
|
|
10
10
|
|
|
11
11
|
return ${L(i)};
|
|
12
12
|
})(${w(this.node)})
|
|
13
|
-
`;return this.replaceWith(p)[0].get("arguments.0")},Ya.splitExportDeclaration=function(){if(!this.isExportDeclaration()||this.isExportAllDeclaration())throw new Error("Only default and named export declarations can be split.");if(this.isExportNamedDeclaration()&&this.get("specifiers").length>0)throw new Error("It doesn't make sense to split exported specifiers.");const e=this.get("declaration");if(this.isExportDefaultDeclaration()){const t=e.isFunctionDeclaration()||e.isClassDeclaration(),n=e.isFunctionExpression()||e.isClassExpression(),r=e.isScope()?e.scope.parent:e.scope;let i=e.node.id,s=!1;i?n&&r.hasBinding(i.name)&&(s=!0,i=r.generateUidIdentifier(i.name)):(s=!0,i=r.generateUidIdentifier("default"),(t||n)&&(e.node.id=L(i)));const a=t?e.node:M("var",[F(L(i),e.node)]),o=B(null,[j(L(i),u("default"))]);return this.insertAfter(o),this.replaceWith(a),s&&r.registerDeclaration(this),this}if(this.get("specifiers").length>0)throw new Error("It doesn't make sense to split exported specifiers.");const t=e.getOuterBindingIdentifiers(),n=Object.keys(t).map(e=>j(u(e),u(e))),r=B(null,n);return this.insertAfter(r),this.replaceWith(e.node),this},Ya.toComputedKey=function(){let e;if(this.isMemberExpression())e=this.node.property;else{if(!this.isProperty()&&!this.isMethod())throw new ReferenceError("todo");e=this.node.key}this.node.computed||d(e)&&(e=v(e.name));return e},Ya.unwrapFunctionEnvironment=function(){if(!this.isArrowFunctionExpression()&&!this.isFunctionExpression()&&!this.isFunctionDeclaration())throw this.buildCodeFrameError("Can only unwrap the environment of a function.");K(this)};var e=zr(),t=function(){if(uo)return Xa;uo=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.statements=Xa.statement=Xa.smart=Xa.program=Xa.expression=Xa.default=void 0;var e=za(),t=yo();const n=Xa.smart=(0,t.default)(e.smart),r=Xa.statement=(0,t.default)(e.statement),i=Xa.statements=(0,t.default)(e.statements),s=Xa.expression=(0,t.default)(e.expression),a=Xa.program=(0,t.default)(e.program);return Xa.default=Object.assign(n.bind(void 0),{smart:n,statement:r,statements:i,expression:s,program:a,ast:n.ast}),Xa}(),n=Di(),r=_o();const{arrowFunctionExpression:i,assignmentExpression:s,binaryExpression:a,blockStatement:o,callExpression:l,conditionalExpression:c,expressionStatement:p,identifier:u,isIdentifier:d,jsxIdentifier:h,logicalExpression:f,LOGICAL_OPERATORS:m,memberExpression:y,metaProperty:T,numericLiteral:g,objectExpression:S,restElement:x,returnStatement:b,sequenceExpression:E,spreadElement:P,stringLiteral:v,super:A,thisExpression:C,toExpression:w,unaryExpression:I,toBindingIdentifierName:N,isFunction:k,isAssignmentPattern:O,isRestElement:_,getFunctionName:D,cloneNode:L,variableDeclaration:M,variableDeclarator:F,exportNamedDeclaration:B,exportSpecifier:j,inherits:R}=e;Ya.arrowFunctionToShadowed=function(){this.isArrowFunctionExpression()&&this.arrowFunctionToExpression()};const U=(0,n.environmentVisitor)({CallExpression(e,{allSuperCalls:t}){e.get("callee").isSuper()&&t.push(e)}});function K(e,t=!0,n=!0,r=!0){let o,p=e.findParent(e=>e.isArrowFunctionExpression()?(null!=o||(o=e),!1):e.isFunction()||e.isProgram()||e.isClassProperty({static:!1})||e.isClassPrivateProperty({static:!1}));const d=p.isClassMethod({kind:"constructor"});if(p.isClassProperty()||p.isClassPrivateProperty())if(o)p=o;else{if(!n)throw e.buildCodeFrameError("Unable to transform arrow inside class property");e.replaceWith(l(i([],w(e.node)),[])),p=e.get("callee"),e=p.get("body")}const{thisPaths:S,argumentsPaths:b,newTargetPaths:N,superProps:k,superCalls:O}=function(e){const t=[],n=[],r=[],i=[],s=[];return e.traverse($,{thisPaths:t,argumentsPaths:n,newTargetPaths:r,superProps:i,superCalls:s}),{thisPaths:t,argumentsPaths:n,newTargetPaths:r,superProps:i,superCalls:s}}(e);if(d&&O.length>0){if(!n)throw O[0].buildCodeFrameError("When using '@babel/plugin-transform-arrow-functions', it's not possible to compile `super()` in an arrow function without compiling classes.\nPlease add '@babel/plugin-transform-classes' to your Babel configuration.");if(!r)throw O[0].buildCodeFrameError("When using '@babel/plugin-transform-parameters', it's not possible to compile `super()` in an arrow function with default or rest parameters without compiling classes.\nPlease add '@babel/plugin-transform-classes' to your Babel configuration.");const e=[];p.traverse(U,{allSuperCalls:e});const t=function(e){return W(e,"supercall",()=>{const t=e.scope.generateUidIdentifier("args");return i([x(t)],l(A(),[P(u(t.name))]))})}(p);e.forEach(e=>{const n=u(t);n.loc=e.node.callee.loc,e.get("callee").replaceWith(n)})}if(b.length>0){const e=W(p,"arguments",()=>{const e=()=>u("arguments");return p.scope.path.isProgram()?c(a("===",I("typeof",e()),v("undefined")),p.scope.buildUndefinedNode(),e()):e()});b.forEach(t=>{const n=u(e);n.loc=t.node.loc,t.replaceWith(n)})}if(N.length>0){const e=W(p,"newtarget",()=>T(u("new"),u("target")));N.forEach(t=>{const n=u(e);n.loc=t.node.loc,t.replaceWith(n)})}if(k.length>0){if(!n)throw k[0].buildCodeFrameError("When using '@babel/plugin-transform-arrow-functions', it's not possible to compile `super.prop` in an arrow function without compiling classes.\nPlease add '@babel/plugin-transform-classes' to your Babel configuration.");k.reduce((e,t)=>e.concat(function(e){if(e.parentPath.isAssignmentExpression()&&"="!==e.parentPath.node.operator){const n=e.parentPath,r=n.node.operator.slice(0,-1),i=n.node.right,a=function(e){return m.includes(e)}(r);if(e.node.computed){const o=e.scope.generateDeclaredUidIdentifier("tmp"),{object:l,property:c}=e.node;n.get("left").replaceWith(y(l,s("=",o,c),!0)),n.get("right").replaceWith(t(a?"=":r,y(l,u(o.name),!0),i))}else{const s=e.node.object,o=e.node.property;n.get("left").replaceWith(y(s,o)),n.get("right").replaceWith(t(a?"=":r,y(s,u(o.name)),i))}return a?n.replaceWith(f(r,n.node.left,n.node.right)):n.node.operator="=",[n.get("left"),n.get("right").get("left")]}if(e.parentPath.isUpdateExpression()){const t=e.parentPath,n=e.scope.generateDeclaredUidIdentifier("tmp"),r=e.node.computed?e.scope.generateDeclaredUidIdentifier("prop"):null,i=[s("=",n,y(e.node.object,r?s("=",r,e.node.property):e.node.property,e.node.computed)),s("=",y(e.node.object,r?u(r.name):e.node.property,e.node.computed),a(e.parentPath.node.operator[0],u(n.name),g(1)))];e.parentPath.node.prefix||i.push(u(n.name)),t.replaceWith(E(i));return[t.get("expressions.0.right"),t.get("expressions.1.left")]}return[e];function t(e,t,n){return"="===e?s("=",t,n):a(e,t,n)}}(t)),[]).forEach(e=>{const t=e.node.computed?"":e.get("property").node.name,n=e.parentPath,r=n.isAssignmentExpression({left:e.node}),a=n.isCallExpression({callee:e.node}),o=n.isTaggedTemplateExpression({tag:e.node}),c=function(e,t,n){const r=t?"set":"get";return W(e,`superprop_${r}:${n||""}`,()=>{const r=[];let a;if(n)a=y(A(),u(n));else{const t=e.scope.generateUidIdentifier("prop");r.unshift(t),a=y(A(),u(t.name),!0)}if(t){const t=e.scope.generateUidIdentifier("value");r.push(t),a=s("=",a,u(t.name))}return i(r,a)})}(p,r,t),d=[];if(e.node.computed&&d.push(e.get("property").node),r){const e=n.node.right;d.push(e)}const h=l(u(c),d);a?(n.unshiftContainer("arguments",C()),e.replaceWith(y(h,u("call"))),S.push(n.get("arguments.0"))):r?n.replaceWith(h):o?(e.replaceWith(l(y(h,u("bind"),!1),[C()])),S.push(e.get("arguments.0"))):e.replaceWith(h)})}let _;return(S.length>0||!t)&&(_=function(e,t){return W(e,"this",n=>{if(!t||!V(e))return C();e.traverse(q,{supers:new WeakSet,thisBinding:n})})}(p,d),(t||d&&V(p))&&(S.forEach(e=>{const t=e.isJSX()?h(_):u(_);t.loc=e.node.loc,e.replaceWith(t)}),t||(_=null))),{thisBinding:_,fnPath:e}}function V(e){return e.isClassMethod()&&!!e.parentPath.parentPath.node.superClass}const q=(0,n.environmentVisitor)({CallExpression(e,{supers:t,thisBinding:n}){e.get("callee").isSuper()&&(t.has(e.node)||(t.add(e.node),e.replaceWithMultiple([e.node,s("=",u(n),u("this"))])))}});function W(e,t,n){const r="binding:"+t;let i=e.getData(r);if(!i){const s=e.scope.generateUidIdentifier(t);i=s.name,e.setData(r,i),e.scope.push({id:s,init:n(i)})}return i}const $=(0,n.environmentVisitor)({ThisExpression(e,{thisPaths:t}){t.push(e)},JSXIdentifier(e,{thisPaths:t}){"this"===e.node.name&&(e.parentPath.isJSXMemberExpression({object:e.node})||e.parentPath.isJSXOpeningElement({name:e.node}))&&t.push(e)},CallExpression(e,{superCalls:t}){e.get("callee").isSuper()&&t.push(e)},MemberExpression(e,{superProps:t}){e.get("object").isSuper()&&t.push(e)},Identifier(e,{argumentsPaths:t}){if(!e.isReferencedIdentifier({name:"arguments"}))return;let n=e.scope;do{if(n.hasOwnBinding("arguments"))return void n.rename("arguments");if(n.path.isFunction()&&!n.path.isArrowFunctionExpression())break}while(n=n.parent);t.push(e)},MetaProperty(e,{newTargetPaths:t}){e.get("meta").isIdentifier({name:"new"})&&e.get("property").isIdentifier({name:"target"})&&t.push(e)}});const J={"ReferencedIdentifier|BindingIdentifier"(e,t){e.node.name===t.name&&(t.needsRename=!0,e.stop())},Scope(e,t){e.scope.hasOwnBinding(t.name)&&e.skip()}};return Ya}var go,So={};function xo(){return go||(go=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._guessExecutionStatusRelativeTo=function(e){return m(this,e,new Map)},e._resolve=y,e.canHaveVariableDeclarationOrExpression=function(){return("init"===this.key||"left"===this.key)&&this.parentPath.isFor()},e.canSwapBetweenExpressionAndStatement=function(e){if("body"!==this.key||!this.parentPath.isArrowFunctionExpression())return!1;if(this.isExpression())return i(e);if(this.isBlockStatement())return s(e);return!1},e.getSource=function(){const e=this.node;if(e.end){const t=this.hub.getCode();if(t)return t.slice(e.start,e.end)}return""},e.isCompletionRecord=function(e){let t=this,n=!0;do{const{type:r,container:i}=t;if(!n&&(t.isFunction()||"StaticBlock"===r))return!!e;if(n=!1,Array.isArray(i)&&t.key!==i.length-1)return!1}while((t=t.parentPath)&&!t.isProgram()&&!t.isDoExpression());return!0},e.isConstantExpression=function(){if(this.isIdentifier()){const e=this.scope.getBinding(this.node.name);return!!e&&e.constant}if(this.isLiteral())return!this.isRegExpLiteral()&&(!this.isTemplateLiteral()||this.get("expressions").every(e=>e.isConstantExpression()));if(this.isUnaryExpression())return"void"===this.node.operator&&this.get("argument").isConstantExpression();if(this.isBinaryExpression()){const{operator:e}=this.node;return"in"!==e&&"instanceof"!==e&&this.get("left").isConstantExpression()&&this.get("right").isConstantExpression()}if(this.isMemberExpression())return!this.node.computed&&this.get("object").isIdentifier({name:"Symbol"})&&!this.scope.hasBinding("Symbol",{noGlobals:!0});if(this.isCallExpression())return 1===this.node.arguments.length&&this.get("callee").matchesPattern("Symbol.for")&&!this.scope.hasBinding("Symbol",{noGlobals:!0})&&this.get("arguments")[0].isStringLiteral();return!1},e.isInStrictMode=function(){const e=(this.isProgram()?this:this.parentPath).find(e=>{if(e.isProgram({sourceType:"module"}))return!0;if(e.isClass())return!0;if(e.isArrowFunctionExpression()&&!e.get("body").isBlockStatement())return!1;let t;if(e.isFunction())t=e.node.body;else{if(!e.isProgram())return!1;t=e.node}for(const e of t.directives)if("use strict"===e.value.value)return!0;return!1});return!!e},e.isNodeType=function(e){return c(this.type,e)},e.isStatementOrBlock=function(){return!this.parentPath.isLabeledStatement()&&!i(this.container)&&n.includes(this.key)},e.isStatic=function(){return this.scope.isStatic(this.node)},e.matchesPattern=function(e,t){return p(this.node,e,t)},e.referencesImport=function(e,t){if(!this.isReferencedIdentifier()){if(this.isJSXMemberExpression()&&this.node.property.name===t||(this.isMemberExpression()||this.isOptionalMemberExpression())&&(this.node.computed?l(this.node.property,{value:t}):this.node.property.name===t)){const t=this.get("object");return t.isReferencedIdentifier()&&t.referencesImport(e,"*")}return!1}const n=this.scope.getBinding(this.node.name);if(!n||"module"!==n.kind)return!1;const r=n.path,i=r.parentPath;if(!i.isImportDeclaration())return!1;if(i.node.source.value!==e)return!1;if(!t)return!0;if(r.isImportDefaultSpecifier()&&"default"===t)return!0;if(r.isImportNamespaceSpecifier()&&"*"===t)return!0;if(r.isImportSpecifier()&&a(r.node.imported,{name:t}))return!0;return!1},e.resolve=function(e,t){return y.call(this,e,t)||this},e.willIMaybeExecuteBefore=function(e){return"after"!==this._guessExecutionStatusRelativeTo(e)};var t=zr();const{STATEMENT_OR_BLOCK_KEYS:n,VISITOR_KEYS:r,isBlockStatement:i,isExpression:s,isIdentifier:a,isLiteral:o,isStringLiteral:l,isType:c,matchesPattern:p}=t;function u(e){return e.isProgram()?e:(e.parentPath.scope.getFunctionParent()||e.parentPath.scope.getProgramParent()).path}function d(e,t){switch(e){case"LogicalExpression":case"AssignmentPattern":return"right"===t;case"ConditionalExpression":case"IfStatement":return"consequent"===t||"alternate"===t;case"WhileStatement":case"DoWhileStatement":case"ForInStatement":case"ForOfStatement":return"body"===t;case"ForStatement":return"body"===t||"update"===t;case"SwitchStatement":return"cases"===t;case"TryStatement":return"handler"===t;case"OptionalMemberExpression":return"property"===t;case"OptionalCallExpression":return"arguments"===t;default:return!1}}function h(e,t){for(let n=0;n<t;n++){const t=e[n];if(d(t.parent.type,t.parentKey))return!0}return!1}e.has=function(e){var t;const n=null==(t=this.node)?void 0:t[e];return n&&Array.isArray(n)?!!n.length:!!n},e.is=e.has,e.isnt=function(e){return!this.has(e)},e.equals=function(e,t){return this.node[e]===t};const f=Symbol();function m(e,t,n){const i={this:u(e),target:u(t)};if(i.target.node!==i.this.node)return function(e,t,n){let r,i=n.get(e.node);if(i){if(r=i.get(t.node))return r===f?"unknown":r}else n.set(e.node,i=new Map);i.set(t.node,f);const s=function(e,t,n){if(!t.isFunctionDeclaration())return"before"===m(e,t,n)?"before":"unknown";if(t.parentPath.isExportDeclaration())return"unknown";const r=t.scope.getBinding(t.node.id.name);if(!r.references)return"before";const i=r.referencePaths;let s;for(const r of i){if(!!r.find(e=>e.node===t.node))continue;if("callee"!==r.key||!r.parentPath.isCallExpression())return"unknown";const i=m(e,r,n);if(s&&s!==i)return"unknown";s=i}return s}(e,t,n);return i.set(t.node,s),s}(e,i.target,n);const s={target:t.getAncestry(),this:e.getAncestry()};if(s.target.includes(e))return"after";if(s.this.includes(t))return"before";let a;const o={target:0,this:0};for(;!a&&o.this<s.this.length;){const e=s.this[o.this];o.target=s.target.indexOf(e),o.target>=0?a=e:o.this++}if(!a)throw new Error("Internal Babel error - The two compared nodes don't appear to belong to the same program.");if(h(s.this,o.this-1)||h(s.target,o.target-1))return"unknown";const l={this:s.this[o.this-1],target:s.target[o.target-1]};if(l.target.listKey&&l.this.listKey&&l.target.container===l.this.container)return l.target.key>l.this.key?"before":"after";const c=r[a.type],p=c.indexOf(l.this.parentKey);return c.indexOf(l.target.parentKey)>p?"before":"after"}function y(e,t){var n;if(null==(n=t)||!n.includes(this))if((t=t||[]).push(this),this.isVariableDeclarator()){if(this.get("id").isIdentifier())return this.get("init").resolve(e,t)}else if(this.isReferencedIdentifier()){const n=this.scope.getBinding(this.node.name);if(!n)return;if(!n.constant)return;if("module"===n.kind)return;if(n.path!==this){const r=n.path.resolve(e,t);if(this.find(e=>e.node===r.node))return;return r}}else{if(this.isTypeCastExpression())return this.get("expression").resolve(e,t);if(e&&this.isMemberExpression()){const n=this.toComputedKey();if(!o(n))return;const r=n.value,i=this.get("object").resolve(e,t);if(i.isObjectExpression()){const n=i.get("properties");for(const i of n){if(!i.isProperty())continue;const n=i.get("key");let s=i.isnt("computed")&&n.isIdentifier({name:r});if(s=s||n.isLiteral({value:r}),s)return i.get("value").resolve(e,t)}}else if(i.isArrayExpression()&&!isNaN(+r)){const n=i.get("elements")[r];if(n)return n.resolve(e,t)}}}}}(So)),So}var bo,Eo={};function Po(){if(bo)return Eo;bo=1,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo._getKey=f,Eo._getPattern=m,Eo.get=function(e,t=!0){!0===t&&(t=this.context);const n=e.split(".");return 1===n.length?f.call(this,e,t):m.call(this,n,t)},Eo.getAllNextSiblings=function(){let e=this.key,t=this.getSibling(++e);const n=[];for(;t.node;)n.push(t),t=this.getSibling(++e);return n},Eo.getAllPrevSiblings=function(){let e=this.key,t=this.getSibling(--e);const n=[];for(;t.node;)n.push(t),t=this.getSibling(--e);return n},Eo.getAssignmentIdentifiers=function(){return n(this.node)},Eo.getBindingIdentifierPaths=function(e=!1,t=!1){const n=[this],i=Object.create(null);for(;n.length;){const s=n.shift();if(!s)continue;if(!s.node)continue;const a=r.keys[s.node.type];if(s.isIdentifier())if(e){(i[s.node.name]=i[s.node.name]||[]).push(s)}else i[s.node.name]=s;else{if(s.isExportDeclaration()){const e=s.get("declaration");e.isDeclaration()&&n.push(e);continue}if(t){if(s.isFunctionDeclaration()){n.push(s.get("id"));continue}if(s.isFunctionExpression())continue}if(a)for(let e=0;e<a.length;e++){const t=a[e],r=s.get(t);Array.isArray(r)?n.push(...r):r.node&&n.push(r)}}}return i},Eo.getBindingIdentifiers=function(e){return r(this.node,e)},Eo.getCompletionRecords=function(e=!1){return h(this,{canHaveBreak:!1,shouldPopulateBreak:!1,inCaseClause:!1,shouldPreserveBreak:e}).map(e=>e.path)},Eo.getNextSibling=function(){return this.getSibling(this.key+1)},Eo.getOpposite=function(){if("left"===this.key)return this.getSibling("right");if("right"===this.key)return this.getSibling("left");return null},Eo.getOuterBindingIdentifierPaths=function(e=!1){return this.getBindingIdentifierPaths(e,!0)},Eo.getOuterBindingIdentifiers=function(e){return i(this.node,e)},Eo.getPrevSibling=function(){return this.getSibling(this.key-1)},Eo.getSibling=function(t){return e.default.get({parentPath:this.parentPath,parent:this.parent,container:this.container,listKey:this.listKey,key:t}).setContext(this.context)};var e=ko(),t=zr();const{getAssignmentIdentifiers:n,getBindingIdentifiers:r,getOuterBindingIdentifiers:i,numericLiteral:s,unaryExpression:a}=t,o=0,l=1;function c(e,t,n){return e&&t.push(...h(e,n)),t}function p(e){e.forEach(e=>{e.type=l})}function u(e,t){e.forEach(e=>{e.path.isBreakStatement({label:null})&&(t?e.path.replaceWith(a("void",s(0))):e.path.remove())})}function d(e,t){const n=[];if(t.canHaveBreak){let r=[];for(let i=0;i<e.length;i++){const s=e[i],a=Object.assign({},t,{inCaseClause:!1});s.isBlockStatement()&&(t.inCaseClause||t.shouldPopulateBreak)?a.shouldPopulateBreak=!0:a.shouldPopulateBreak=!1;const c=h(s,a);if(c.length>0&&c.every(e=>e.type===l)){r.length>0&&c.every(e=>e.path.isBreakStatement({label:null}))?(p(r),n.push(...r),r.some(e=>e.path.isDeclaration())&&(n.push(...c),t.shouldPreserveBreak||u(c,!0)),t.shouldPreserveBreak||u(c,!1)):(n.push(...c),t.shouldPopulateBreak||t.shouldPreserveBreak||u(c,!0));break}if(i===e.length-1)n.push(...c);else{r=[];for(let e=0;e<c.length;e++){const t=c[e];t.type===l&&n.push(t),t.type===o&&r.push(t)}}}}else if(e.length)for(let r=e.length-1;r>=0;r--){const i=h(e[r],t);if(i.length>1||1===i.length&&!i[0].path.isVariableDeclaration()&&!i[0].path.isEmptyStatement()){n.push(...i);break}}return n}function h(e,t){let n=[];if(e.isIfStatement())n=c(e.get("consequent"),n,t),n=c(e.get("alternate"),n,t);else{if(e.isDoExpression()||e.isFor()||e.isWhile()||e.isLabeledStatement())return c(e.get("body"),n,t);if(e.isProgram()||e.isBlockStatement())return d(e.get("body"),t);if(e.isFunction())return h(e.get("body"),t);if(e.isTryStatement())n=c(e.get("block"),n,t),n=c(e.get("handler"),n,t);else{if(e.isCatchClause())return c(e.get("body"),n,t);if(e.isSwitchStatement())return function(e,t,n){let r=[];for(let i=0;i<e.length;i++){const s=h(e[i],n),a=[],c=[];for(const e of s)e.type===o&&a.push(e),e.type===l&&c.push(e);a.length&&(r=a),t.push(...c)}return t.push(...r),t}(e.get("cases"),n,t);if(e.isSwitchCase())return d(e.get("consequent"),{canHaveBreak:!0,shouldPopulateBreak:!1,inCaseClause:!0,shouldPreserveBreak:t.shouldPreserveBreak});e.isBreakStatement()?n.push(function(e){return{type:l,path:e}}(e)):n.push(function(e){return{type:o,path:e}}(e))}}return n}function f(t,n){const r=this.node,i=r[t];return Array.isArray(i)?i.map((s,a)=>e.default.get({listKey:t,parentPath:this,parent:r,container:i,key:a}).setContext(n)):e.default.get({parentPath:this,parent:r,container:r,key:t}).setContext(n)}function m(e,t){let n=this;for(const r of e)n="."===r?n.parentPath:Array.isArray(n)?n[r]:n.get(r,t);return n}return Eo}var vo,Ao,Co,wo,Io,No={};function ko(){if(Ao)return ri;Ao=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.default=ri.SHOULD_STOP=ri.SHOULD_SKIP=ri.REMOVED=void 0;var e=si(),t=vi(),n=Fo(),r=Wi(),i=zr(),s=i,a=Ui(),o=ia(),l=function(){if(sa)return aa;sa=1,Object.defineProperty(aa,"__esModule",{value:!0}),aa.find=function(e){let t=this;do{if(e(t))return t}while(t=t.parentPath);return null},aa.findParent=function(e){let t=this;for(;t=t.parentPath;)if(e(t))return t;return null},aa.getAncestry=function(){let e=this;const t=[];do{t.push(e)}while(e=e.parentPath);return t},aa.getDeepestCommonAncestorFrom=function(e,t){if(!e.length)return this;if(1===e.length)return e[0];let n,r,i=1/0;const s=e.map(e=>{const t=[];do{t.unshift(e)}while((e=e.parentPath)&&e!==this);return t.length<i&&(i=t.length),t}),a=s[0];e:for(let e=0;e<i;e++){const t=a[e];for(const n of s)if(n[e]!==t)break e;n=e,r=t}if(r)return t?t(r,n,s):r;throw new Error("Couldn't find intersection")},aa.getEarliestCommonAncestorFrom=function(e){return this.getDeepestCommonAncestorFrom(e,function(e,n,r){let i;const s=t[e.type];for(const e of r){const t=e[n+1];i?(t.listKey&&i.listKey===t.listKey&&t.key<i.key||s.indexOf(i.parentKey)>s.indexOf(t.parentKey))&&(i=t):i=t}return i})},aa.getFunctionParent=function(){return this.findParent(e=>e.isFunction())},aa.getStatementParent=function(){let e=this;do{if(!e.parentPath||Array.isArray(e.container)&&e.isStatement())break;e=e.parentPath}while(e);if(e&&(e.isProgram()||e.isFile()))throw new Error("File/Program node, we can't possibly find a statement parent to this");return e},aa.inType=function(...e){let t=this;for(;t;){if(e.includes(t.node.type))return!0;t=t.parentPath}return!1},aa.isAncestor=function(e){return e.isDescendant(this)},aa.isDescendant=function(e){return!!this.findParent(t=>t===e)};var e=zr();const{VISITOR_KEYS:t}=e;return aa}(),c=function(){if(pa)return ua;pa=1,Object.defineProperty(ua,"__esModule",{value:!0}),ua._getTypeAnnotation=P,ua.baseTypeStrictlyMatches=function(e){const t=this.getTypeAnnotation(),n=e.getTypeAnnotation();return!(r(t)||!o(t))&&n.type===t.type},ua.couldBeBaseType=function(e){const t=this.getTypeAnnotation();if(r(t))return!0;if(g(t)){for(const n of t.types)if(r(n)||v(e,n,!0))return!0;return!1}return v(e,t,!0)},ua.getTypeAnnotation=function(){let e=this.getData("typeAnnotation");return null!=e||(e=P.call(this)||n(),(T(e)||f(e))&&(e=e.typeAnnotation),this.setData("typeAnnotation",e)),e},ua.isBaseType=function(e,t){return v(e,this.getTypeAnnotation(),t)},ua.isGenericType=function(e){const t=this.getTypeAnnotation();return!("Array"!==e||!(h(t)||i(t)||y(t)))||(l(t)&&c(t.id,{name:e})||m(t)&&c(t.typeName,{name:e}))};var e=Ta(),t=zr();const{anyTypeAnnotation:n,isAnyTypeAnnotation:r,isArrayTypeAnnotation:i,isBooleanTypeAnnotation:s,isEmptyTypeAnnotation:a,isFlowBaseAnnotation:o,isGenericTypeAnnotation:l,isIdentifier:c,isMixedTypeAnnotation:p,isNumberTypeAnnotation:u,isStringTypeAnnotation:d,isTSArrayType:h,isTSTypeAnnotation:f,isTSTypeReference:m,isTupleTypeAnnotation:y,isTypeAnnotation:T,isUnionTypeAnnotation:g,isVoidTypeAnnotation:S,stringTypeAnnotation:x,voidTypeAnnotation:b}=t,E=new WeakSet;function P(){const t=this.node;if(t){if(t.typeAnnotation)return t.typeAnnotation;if(!E.has(t)){E.add(t);try{var r;let n=e[t.type];if(n)return n.call(this,t);if(n=e[this.parentPath.type],null!=(r=n)&&r.validParent)return this.parentPath.getTypeAnnotation()}finally{E.delete(t)}}}else if("init"===this.key&&this.parentPath.isVariableDeclarator()){const e=this.parentPath.parentPath,t=e.parentPath;return"left"===e.key&&t.isForInStatement()?x():"left"===e.key&&t.isForOfStatement()?n():b()}}function v(e,t,n){if("string"===e)return d(t);if("number"===e)return u(t);if("boolean"===e)return s(t);if("any"===e)return r(t);if("mixed"===e)return p(t);if("empty"===e)return a(t);if("void"===e)return S(t);if(n)return!1;throw new Error(`Unknown base type ${e}`)}return ua}(),p=Va(),u=$a(),d=To(),h=xo(),f=_o(),m=f,y=Da(),T=Ba(),g=Po(),S=function(){if(vo)return No;vo=1,Object.defineProperty(No,"__esModule",{value:!0}),No.addComment=function(e,n,r){t(this.node,e,n,r)},No.addComments=function(e,t){n(this.node,e,t)},No.shareCommentsWithSiblings=function(){if("string"==typeof this.key)return;const e=this.node;if(!e)return;const t=e.trailingComments,n=e.leadingComments;if(!t&&!n)return;const i=this.getSibling(this.key-1),s=this.getSibling(this.key+1),a=Boolean(i.node),o=Boolean(s.node);a&&(n&&i.addComments("trailing",r(n,i.node.trailingComments)),t&&!o&&i.addComments("trailing",t)),o&&(t&&s.addComments("leading",r(t,s.node.leadingComments)),n&&!a&&s.addComments("leading",n))};var e=zr();const{addComment:t,addComments:n}=e;function r(e,t){if(null==t||!t.length)return e;const n=new Set(t);return e.filter(e=>!n.has(e))}return No}(),x=_i();const{validate:b}=i,E=t("babel");ri.REMOVED=1,ri.SHOULD_STOP=2,ri.SHOULD_SKIP=4;const P=ri.default=class e{constructor(e,t){this.contexts=[],this.state=null,this._traverseFlags=0,this.skipKeys=null,this.parentPath=null,this.container=null,this.listKey=null,this.key=null,this.node=null,this.type=null,this._store=null,this.parent=t,this.hub=e,this.data=null,this.context=null,this.scope=null}get removed(){return(1&this._traverseFlags)>0}set removed(e){e?this._traverseFlags|=1:this._traverseFlags&=-2}get shouldStop(){return(2&this._traverseFlags)>0}set shouldStop(e){e?this._traverseFlags|=2:this._traverseFlags&=-3}get shouldSkip(){return(4&this._traverseFlags)>0}set shouldSkip(e){e?this._traverseFlags|=4:this._traverseFlags&=-5}static get({hub:t,parentPath:n,parent:r,container:i,listKey:s,key:o}){if(!t&&n&&(t=n.hub),!r)throw new Error("To get a node path the parent needs to exist");const l=i[o],c=a.getOrCreateCachedPaths(r,n);let p=c.get(l);return p||(p=new e(t,r),l&&c.set(l,p)),f.setup.call(p,n,i,s,o),p}getScope(e){return this.isScope()?new r.default(this):e}setData(e,t){return null==this.data&&(this.data=Object.create(null)),this.data[e]=t}getData(e,t){null==this.data&&(this.data=Object.create(null));let n=this.data[e];return void 0===n&&void 0!==t&&(n=this.data[e]=t),n}hasNode(){return null!=this.node}buildCodeFrameError(e,t=SyntaxError){return this.hub.buildError(this.node,e,t)}traverse(e,t){(0,n.default)(this.node,e,this.scope,t,this)}set(e,t){b(this.node,e,t),this.node[e]=t}getPathLocation(){const e=[];let t=this;do{let n=t.key;t.inList&&(n=`${t.listKey}[${n}]`),e.unshift(n)}while(t=t.parentPath);return e.join(".")}debug(e){E.enabled&&E(`${this.getPathLocation()} ${this.type}: ${e}`)}toString(){return(0,o.default)(this.node).code}get inList(){return!!this.listKey}set inList(e){e||(this.listKey=null)}get parentKey(){return this.listKey||this.key}},v={findParent:l.findParent,find:l.find,getFunctionParent:l.getFunctionParent,getStatementParent:l.getStatementParent,getEarliestCommonAncestorFrom:l.getEarliestCommonAncestorFrom,getDeepestCommonAncestorFrom:l.getDeepestCommonAncestorFrom,getAncestry:l.getAncestry,isAncestor:l.isAncestor,isDescendant:l.isDescendant,inType:l.inType,getTypeAnnotation:c.getTypeAnnotation,isBaseType:c.isBaseType,couldBeBaseType:c.couldBeBaseType,baseTypeStrictlyMatches:c.baseTypeStrictlyMatches,isGenericType:c.isGenericType,replaceWithMultiple:p.replaceWithMultiple,replaceWithSourceString:p.replaceWithSourceString,replaceWith:p.replaceWith,replaceExpressionWithStatements:p.replaceExpressionWithStatements,replaceInline:p.replaceInline,evaluateTruthy:u.evaluateTruthy,evaluate:u.evaluate,toComputedKey:d.toComputedKey,ensureBlock:d.ensureBlock,unwrapFunctionEnvironment:d.unwrapFunctionEnvironment,arrowFunctionToExpression:d.arrowFunctionToExpression,splitExportDeclaration:d.splitExportDeclaration,ensureFunctionName:d.ensureFunctionName,matchesPattern:h.matchesPattern,isStatic:h.isStatic,isNodeType:h.isNodeType,canHaveVariableDeclarationOrExpression:h.canHaveVariableDeclarationOrExpression,canSwapBetweenExpressionAndStatement:h.canSwapBetweenExpressionAndStatement,isCompletionRecord:h.isCompletionRecord,isStatementOrBlock:h.isStatementOrBlock,referencesImport:h.referencesImport,getSource:h.getSource,willIMaybeExecuteBefore:h.willIMaybeExecuteBefore,_guessExecutionStatusRelativeTo:h._guessExecutionStatusRelativeTo,resolve:h.resolve,isConstantExpression:h.isConstantExpression,isInStrictMode:h.isInStrictMode,isDenylisted:m.isDenylisted,visit:m.visit,skip:m.skip,skipKey:m.skipKey,stop:m.stop,setContext:m.setContext,requeue:m.requeue,requeueComputedKeyAndDecorators:m.requeueComputedKeyAndDecorators,remove:y.remove,insertBefore:T.insertBefore,insertAfter:T.insertAfter,unshiftContainer:T.unshiftContainer,pushContainer:T.pushContainer,getOpposite:g.getOpposite,getCompletionRecords:g.getCompletionRecords,getSibling:g.getSibling,getPrevSibling:g.getPrevSibling,getNextSibling:g.getNextSibling,getAllNextSiblings:g.getAllNextSiblings,getAllPrevSiblings:g.getAllPrevSiblings,get:g.get,getAssignmentIdentifiers:g.getAssignmentIdentifiers,getBindingIdentifiers:g.getBindingIdentifiers,getOuterBindingIdentifiers:g.getOuterBindingIdentifiers,getBindingIdentifierPaths:g.getBindingIdentifierPaths,getOuterBindingIdentifierPaths:g.getOuterBindingIdentifierPaths,shareCommentsWithSiblings:S.shareCommentsWithSiblings,addComment:S.addComment,addComments:S.addComments};Object.assign(P.prototype,v),P.prototype.arrowFunctionToShadowed=d[String("arrowFunctionToShadowed")],Object.assign(P.prototype,{has:h[String("has")],is:h[String("is")],isnt:h[String("isnt")],equals:h[String("equals")],hoist:T[String("hoist")],updateSiblingKeys:T.updateSiblingKeys,call:m.call,isBlacklisted:m[String("isBlacklisted")],setScope:m.setScope,resync:m.resync,popContext:m.popContext,pushContext:m.pushContext,setup:m.setup,setKey:m.setKey}),P.prototype._guessExecutionStatusRelativeToDifferentFunctions=h._guessExecutionStatusRelativeTo,P.prototype._guessExecutionStatusRelativeToDifferentFunctions=h._guessExecutionStatusRelativeTo,Object.assign(P.prototype,{_getTypeAnnotation:c._getTypeAnnotation,_replaceWith:p._replaceWith,_resolve:h._resolve,_call:m._call,_resyncParent:m._resyncParent,_resyncKey:m._resyncKey,_resyncList:m._resyncList,_resyncRemoved:m._resyncRemoved,_getQueueContexts:m._getQueueContexts,_removeFromScope:y._removeFromScope,_callRemovalHooks:y._callRemovalHooks,_remove:y._remove,_markRemoved:y._markRemoved,_assertUnremoved:y._assertUnremoved,_containerInsert:T._containerInsert,_containerInsertBefore:T._containerInsertBefore,_containerInsertAfter:T._containerInsertAfter,_verifyNodeList:T._verifyNodeList,_getKey:g._getKey,_getPattern:g._getPattern});for(const e of s.TYPES){const t=`is${e}`,n=s[t];P.prototype[t]=function(e){return n(this.node,e)},P.prototype[`assert${e}`]=function(t){if(!n(this.node,t))throw new TypeError(`Expected node path of type ${e}`)}}Object.assign(P.prototype,x);for(const t of Object.keys(e))"_"!==t[0]&&(s.TYPES.includes(t)||s.TYPES.push(t));return ri}function Oo(){if(wo)return ti;wo=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.traverseNode=function(t,r,i,s,a,o,l){const c=n[t.type];if(!c)return!1;const p=new e.default(i,r,s,a);if(l)return(null==o||!o[a.parentKey])&&p.visitQueue([a]);for(const e of c)if((null==o||!o[e])&&p.visit(t,e))return!0;return!1};var e=function(){if(Co)return ni;Co=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.default=void 0;var e=ko(),t=zr(),n=_o();const{VISITOR_KEYS:r}=t;return ni.default=class{constructor(e,t,n,r){this.queue=null,this.priorityQueue=null,this.parentPath=r,this.scope=e,this.state=n,this.opts=t}shouldVisit(e){const t=this.opts;if(t.enter||t.exit)return!0;if(t[e.type])return!0;const n=r[e.type];if(null==n||!n.length)return!1;for(const t of n)if(e[t])return!0;return!1}create(t,n,r,i){return e.default.get({parentPath:this.parentPath,parent:t,container:n,key:r,listKey:i})}maybeQueue(e,t){this.queue&&(t?this.queue.push(e):this.priorityQueue.push(e))}visitMultiple(e,t,n){if(0===e.length)return!1;const r=[];for(let i=0;i<e.length;i++){const s=e[i];s&&this.shouldVisit(s)&&r.push(this.create(t,e,i,n))}return this.visitQueue(r)}visitSingle(e,t){return!!this.shouldVisit(e[t])&&this.visitQueue([this.create(e,e,t)])}visitQueue(e){this.queue=e,this.priorityQueue=[];const t=new WeakSet;let r=!1,i=0;for(;i<e.length;){const s=e[i];if(i++,n.resync.call(s),0!==s.contexts.length&&s.contexts[s.contexts.length-1]===this||n.pushContext.call(s,this),null===s.key)continue;const{node:a}=s;if(!t.has(a)){if(a&&t.add(a),s.visit()){r=!0;break}if(this.priorityQueue.length&&(r=this.visitQueue(this.priorityQueue),this.priorityQueue=[],this.queue=e,r))break}}for(let t=0;t<i;t++)n.popContext.call(e[t]);return this.queue=null,r}visit(e,t){const n=e[t];return!!n&&(Array.isArray(n)?this.visitMultiple(n,e,t):this.visitSingle(e,t))}},ni}();ko();var t=zr();_o();const{VISITOR_KEYS:n}=t;return ti}function _o(){if(Io)return ei;Io=1,Object.defineProperty(ei,"__esModule",{value:!0}),ei._call=s,ei._getQueueContexts=function(){let e=this,t=this.contexts;for(;!t.length&&(e=e.parentPath,e);)t=e.contexts;return t},ei._resyncKey=p,ei._resyncList=u,ei._resyncParent=c,ei._resyncRemoved=function(){null!=this.key&&this.container&&this.container[this.key]===this.node||n._markRemoved.call(this)},ei.call=i,ei.isDenylisted=a,ei.popContext=function(){this.contexts.pop(),this.contexts.length>0?this.setContext(this.contexts[this.contexts.length-1]):this.setContext(void 0)},ei.pushContext=function(e){this.contexts.push(e),this.setContext(e)},ei.requeue=function(e=this){if(e.removed)return;const t=this.contexts;for(const n of t)n.maybeQueue(e)},ei.requeueComputedKeyAndDecorators=function(){const{context:e,node:t}=this;!r.isPrivate(t)&&t.computed&&e.maybeQueue(this.get("key"));if(t.decorators)for(const t of this.get("decorators"))e.maybeQueue(t)},ei.resync=function(){if(this.removed)return;c.call(this),u.call(this),p.call(this)},ei.setContext=function(e){null!=this.skipKeys&&(this.skipKeys={});this._traverseFlags=0,e&&(this.context=e,this.state=e.state,this.opts=e.opts);return l.call(this),this},ei.setKey=d,ei.setScope=l,ei.setup=function(e,t,n,r){this.listKey=n,this.container=t,this.parentPath=e||this.parentPath,d.call(this,r)},ei.skip=function(){this.shouldSkip=!0},ei.skipKey=function(e){null==this.skipKeys&&(this.skipKeys={});this.skipKeys[e]=!0},ei.stop=function(){this._traverseFlags|=t.SHOULD_SKIP|t.SHOULD_STOP},ei.visit=function(){var t,n;if(!this.node)return!1;if(this.isDenylisted())return!1;if(null!=(t=(n=this.opts).shouldSkip)&&t.call(n,this))return!1;const r=this.context;if(this.shouldSkip||i.call(this,"enter"))return this.debug("Skip..."),this.shouldStop;return o(this,r),this.debug("Recursing into..."),this.shouldStop=(0,e.traverseNode)(this.node,this.opts,this.scope,this.state,this,this.skipKeys),o(this,r),i.call(this,"exit"),this.shouldStop};var e=Oo(),t=ko(),n=Da(),r=zr();function i(e){const t=this.opts;return this.debug(e),!(!this.node||!s.call(this,t[e]))||!!this.node&&s.call(this,null==(n=t[this.node.type])?void 0:n[e]);var n}function s(e){if(!e)return!1;for(const t of e){if(!t)continue;const e=this.node;if(!e)return!0;const n=t.call(this.state,this,this.state);if(n&&"object"==typeof n&&"function"==typeof n.then)throw new Error("You appear to be using a plugin with an async traversal visitor, which your current version of Babel does not support. If you're using a published plugin, you may need to upgrade your @babel/core version.");if(n)throw new Error(`Unexpected return value from visitor method ${t}`);if(this.node!==e)return!0;if(this._traverseFlags>0)return!0}return!1}function a(){var e;const t=null!=(e=this.opts.denylist)?e:this.opts.blacklist;return null==t?void 0:t.includes(this.node.type)}function o(e,t){e.context!==t&&(e.context=t,e.state=t.state,e.opts=t.opts)}function l(){var e,t;if(null!=(e=this.opts)&&e.noScope)return;let n,r=this.parentPath;for((("key"===this.key||"decorators"===this.listKey)&&r.isMethod()||"discriminant"===this.key&&r.isSwitchStatement())&&(r=r.parentPath);r&&!n;){var i;if(null!=(i=r.opts)&&i.noScope)return;n=r.scope,r=r.parentPath}this.scope=this.getScope(n),null==(t=this.scope)||t.init()}function c(){this.parentPath&&(this.parent=this.parentPath.node)}function p(){if(this.container&&this.node!==this.container[this.key]){if(Array.isArray(this.container)){for(let e=0;e<this.container.length;e++)if(this.container[e]===this.node)return void d.call(this,e)}else for(const e of Object.keys(this.container))if(this.container[e]===this.node)return void d.call(this,e);this.key=null}}function u(){if(!this.parent||!this.inList)return;const e=this.parent[this.listKey];this.container!==e&&(this.container=e||null)}function d(e){var t;this.key=e,this.node=this.container[this.key],this.type=null==(t=this.node)?void 0:t.type}return ei.isBlacklisted=a,ei}var Do,Lo,Mo={};function Fo(){return Lo||(Lo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Hub",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(e,"NodePath",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return a.default}}),e.visitors=e.default=void 0,_o();var t=Di();e.visitors=t;var n=zr(),r=Ui(),i=Oo(),s=ko(),a=Wi(),o=(Do||(Do=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.default=void 0,Mo.default=class{getCode(){}getScope(){}addHelper(){throw new Error("Helpers are not supported by the default hub.")}buildError(e,t,n=TypeError){return new n(t)}}),Mo);const{VISITOR_KEYS:l,removeProperties:c,traverseFast:p}=n;function u(e,n={},r,s,a,o){if(e){if(!n.noScope&&!r&&"Program"!==e.type&&"File"!==e.type)throw new Error(`You must pass a scope and parentPath unless traversing a Program/File. Instead of that you tried to traverse a ${e.type} node without passing scope and parentPath.`);if(!a&&o)throw new Error("visitSelf can only be used when providing a NodePath.");l[e.type]&&(t.explode(n),(0,i.traverseNode)(e,n,r,s,a,void 0,o))}}e.default=u,u.visitors=t,u.verify=t.verify,u.explode=t.explode,u.cheap=function(e,t){p(e,t)},u.node=function(e,t,n,r,s,a){(0,i.traverseNode)(e,t,n,r,s,a)},u.clearNode=function(e,t){c(e,t)},u.removeProperties=function(e,t){return p(e,u.clearNode,t),e},u.hasType=function(e,t,n){return(null==n||!n.includes(e.type))&&(e.type===t||p(e,function(e){return null!=n&&n.includes(e.type)?p.skip:e.type===t?p.stop:void 0}))},u.cache=r}(Zr)),Zr}var Bo=Y(Fo()),jo=Y(Ka());function Ro(e){return jo.parse(e,{sourceType:"module",plugins:["jsx","typescript","classProperties","dynamicImport","exportDefaultFrom","exportNamespaceFrom","functionBind","nullishCoalescingOperator","objectRestSpread","optionalChaining","decorators-legacy"],allowAwaitOutsideFunction:!0})}const Uo={is:e=>Qr.isStringLiteral(e),get:e=>e.value},Ko={is:e=>Qr.isNumericLiteral(e),get:e=>e.value},Vo={is:e=>Qr.isBooleanLiteral(e),get:e=>e.value},qo={is:e=>Qr.isNullLiteral(e),get:e=>null},Wo={is:e=>Qr.isIdentifier(e)&&"undefined"===e.name,get(e){}},$o={is:e=>Qr.isObjectExpression(e),get:e=>Go(e)},Jo={is:e=>Qr.isClass(e),get:e=>function(e){function t(e){return"static"in e&&!0===e.static}let n=e.body;if(!Qr.isClassBody(n))return;const r={};return n.body.forEach(e=>{if(t(e)&&Qr.isIdentifier(e.key))if(Qr.isMethod(e)||Qr.isTSDeclareMethod(e))r[e.key.name]=()=>{};else{const t=zo.find(t=>t.is(e.value));t&&(r[e.key.name]=t.get(e.value))}}),r}(e)},Yo={is:e=>Qr.isArrayExpression(e),get:e=>Qo(e)},Xo={is:e=>Qr.isFunctionExpression(e),get:e=>function(){}},Ho={is:e=>Qr.isArrowFunctionExpression(e),get:e=>()=>{}},zo=[Uo,Ko,Vo,qo,Wo,$o,Yo,Jo,Xo,Ho];function Go(e){const t={};return e.properties.forEach(e=>{if(Qr.isObjectMember(e)&&Qr.isIdentifier(e.key))if(Qr.isObjectMethod(e))t[e.key.name]=()=>{};else{const n=zo.find(t=>t.is(e.value));n&&(t[e.key.name]=n.get(e.value))}}),t}function Qo(e){const t=[];return e.elements.forEach(e=>{const n=zo.find(t=>t.is(e));n&&t.push(n.get(e))}),t}function Zo(e){const t=Ro(e);let n;return Bo(t,{Program:{enter(e){const t=e.node,r=function(e){for(const t of e.body)if(Qr.isExportDefaultDeclaration(t))return t.declaration;return null}(t);if(r)if(Qr.isIdentifier(r)){const{name:e}=r;n=function(e){const t={};for(const n of e.programNode.body){let r=n;if(Qr.isExpressionStatement(r)&&(r=r.expression),Qr.isAssignmentExpression(r)&&Qr.isMemberExpression(r.left)&&Qr.isIdentifier(r.left.object)&&r.left.object.name===e.name){const e=zo.find(e=>e.is(Qr.isAssignmentExpression(r)&&r.right));e&&(t[r.left.property.name]=e.get(r.right))}}return t}({programNode:t,name:e})}else if(Qr.isObjectExpression(r))n=Go(r);else if(Qr.isArrayExpression(r))n=Qo(r);else{const e=zo.find(e=>e.is(r));e&&(n=e.get(r))}}}}),n}function el(e){return/^\\\\\?\\/.test(e)?e:e.replace(/\\/g,"/")}const tl={javascript:[".ts",".tsx",".js",".jsx"],css:[".less",".sass",".scss",".stylus",".css"]};function nl(e){const t=tl[e.type];for(const r of t){const t=`${e.fileNameWithoutExt}${r}`,i=el(n(e.base,t));if(p(i))return{path:i,filename:t}}return null}const rl=/^\[(.+?)\]/;function il(e){return p(e)?u(e).filter(t=>{const r=n(e,t),i=d(r),s=i.isDirectory(),a=i.isFile();if(s&&["components","component","utils","util"].includes(t))return!1;if("."===t.charAt(0))return!1;if("_"===t.charAt(0))return!1;if(/\.(test|spec|e2e)\.(j|t)sx?$/.test(t))return!1;if(/\.d\.ts$/.test(t))return!1;if(a){if(!/\.(j|t)sx?$/.test(t))return!1;const e=h(r,"utf-8");try{if(!function(e){const t=Ro(e);let n=!1;return Bo(t,{JSXElement(e){n=!0,e.stop()},JSXFragment(e){n=!0,e.stop()}}),n}(e))return!1}catch(e){throw new Error(`Parse conventional route component ${r} failed, ${e.message}`)}}return!0}):[]}function sl(e,t,s){const{root:a,relDir:o=""}=e,l=n(a,o,s),c=d(l),p=rl.test(s);if(c.isDirectory()){const r=n(o,s),i=nl({base:n(a,r),fileNameWithoutExt:"_layout",type:"javascript"}),l={path:ol(r),routes:ll({...e,relDir:n(r)}),__isDynamic:p,...i?{component:i.path}:{exact:!0,__toMerge:!0}};t.push(al(l,e))}else{const a=r(s,i(s));t.push(al({path:ol(n(o,a)),exact:!0,component:l,__isDynamic:p},e))}return t}function al(e,t){let r;if(e.component){try{r=Zo(h(e.component,"utf-8"))}catch(t){throw new Error(`Parse conventional route component ${e.component} failed, ${t.message}`)}e.component=el(s(n(t.root,".."),e.component)),e.component=`${t.componentPrefix||"@/"}${e.component}`}return{...e,..."object"==typeof r?r:{}}}function ol(e,t){return"/index/index"===(e=`/${e=el(e).split("/").map(e=>((e=e.replace(rl,":$1")).endsWith("$")&&(e=e.slice(0,-1)+"?"),e)).join("/")}`)&&(e="/"),"/"!==(e=e.replace(/\/index$/,"/"))&&"/"===e.slice(-1)&&(e=e.slice(0,-1)),e}function ll(e){const{root:t,relDir:r="",config:i}=e,s=function(e){const t=[],n=[],r=[];return e.forEach(e=>{const{__isDynamic:i,exact:s}=e;delete e.__isDynamic,i?t.push(e):s?n.push(e):r.push(e)}),x(t.length<=1,"We should not have multiple dynamic routes under a directory."),[...n,...r,...t].reduce((e,t)=>(t.__toMerge&&t.routes?e=e.concat(t.routes):e.push(t),e),[])}(il(n(t,r)).reduce(sl.bind(null,e),[]));if(!r){const n=nl({base:t,fileNameWithoutExt:`../${i.singular?"layout":"layouts"}/index`,type:"javascript"});if(n)return[al({path:"/",component:n.path,routes:s},e)]}return s}function cl(t){const n=e.extname(t);if(![".tsx",".ts",".jsx",".js"].includes(n))return!1;try{const e=l.readFileSync(t,"utf-8");return/export\s+default/.test(e)}catch{return!1}}function pl(e){const t={path:e.path||""};if(void 0!==e.exact&&(t.exact=e.exact),e.component){const n=e.component.replace(/\.(tsx|ts|jsx|js)$/,"");t.component=`dynamic({ loader: () => import('${n}'), loading: LoadingComponent})`}return e.title&&"string"==typeof e.title&&(t.title=`$t({ defaultMessage: "${e.title}" })`),!0===e.keepAlive&&(t.keepAlive=!0),e.authority&&Array.isArray(e.authority)&&(t.authority=e.authority),e.routes&&e.routes.length>0&&(t.routes=e.routes.map(pl)),t}function ul(e,t){return ll({root:e,componentPrefix:t.pageAliasPrefix,config:{singular:!1}}).map(pl)}async function dl(t,n){function r(e,t=2){const n=" ".repeat(t),i=" ".repeat(t+2);let s=`${n}{\n`;if(s+=`${i}path: '${e.path}',\n`,void 0!==e.exact&&null!==e.exact&&(s+=`${i}exact: ${e.exact},\n`),void 0!==e.component&&null!==e.component&&(s+=`${i}component: ${e.component},\n`),void 0!==e.title&&null!==e.title&&(s+=`${i}title: ${e.title},\n`),e.authority&&(s+=`${i}authority: ${JSON.stringify(e.authority)},\n`),e.keepAlive&&(s+=`${i}keepAlive: ${e.keepAlive},\n`),e.routes&&e.routes.length>0){s+=`${i}routes: [\n${e.routes.map(e=>r(e,t+2)).join(",\n")}\n${i}],\n`}return s=s.replace(/,\n$/,"\n"),s+=`${n}}`,s}const i=t.map(e=>r(e)).join(",\n"),s=`\n/* eslint-disable */\n// @ts-nocheck\n/**\n * 自动根据 pages 目录生成路由配置\n * 新增、删除、修改组件 title、keepAlive、authority 属性时,会自动更新路由配置\n * 路由组件只支持默认导出\n */\nimport { dynamic } from '@lemon-fe/vite-plugin-micro-frontend/runtime/dynamic';\nimport LoadingComponent from '${n.defaultLoadingComponentPath||"@/components/loading"}';\nimport { $t } from '${n.intlPath||"@/utils/intl"}';\n\nexport const routers = [\n${i}\n];\n`;try{const t=e.resolve(process.cwd(),".prettierrc");let n={};if(l.existsSync(t))try{const e=l.readFileSync(t,"utf-8");n=JSON.parse(e)}catch(e){console.warn("⚠️ 读取 prettier 配置失败,使用默认配置:",e)}const r={parser:"typescript",...n};return await y.format(s,r)}catch(e){return console.error("格式化代码失败:",e),s}}async function hl(t={}){const{pagesDir:n,outputPath:r,routeTemplate:i={}}=t,s=n||e.resolve(process.cwd(),"src/pages"),a=r||e.resolve(process.cwd(),"src/routes.ts");if(!l.existsSync(s))return void console.warn("⚠️ pages 目录不存在:",s);const o=ul(s,i),c=await dl(o,i);l.writeFileSync(a,c),console.log("✅ 路由已生成:",a)}function fl(t={}){const{pagesDir:n,outputPath:r,watch:i=!0,ignoreDirs:s=["components","utils","hooks","typings"],routeTemplate:a={}}=t;let o=!1,c=null,p=!1,u="";const d=n||e.resolve(process.cwd(),"src/pages"),h=r||e.resolve(process.cwd(),"src/routes.ts"),f=async()=>{if(!l.existsSync(d))return void console.warn("⚠️ pages 目录不存在:",d);const e=ul(d,a),t=await dl(e,a);t!==u&&(u=t,l.writeFileSync(h,t),console.log("✅ 路由已生成:",h))},y=()=>{c&&(c.close(),c=null,o=!1)};return{name:"micro-frontend:routes",enforce:"pre",configureServer(e){p||(f(),p=!0),(()=>{if(o||!i)return;if(!l.existsSync(d))return;const e=["**/node_modules/**","**/*.d.ts","**/*.less","**/*.css","**/*.scss","**/*.sass",h,...s.map(e=>`**/${e}/**`)];c=m.watch(d,{ignored:e,persistent:!0,ignoreInitial:!0}),c.on("add",e=>{cl(e)&&f()}).on("unlink",e=>{cl(e)&&f()}).on("addDir",e=>{f()}).on("unlinkDir",e=>{f()}).on("error",e=>{console.error("❌ 文件监听错误:",e)}),o=!0})(),e.httpServer?.on("close",y)},buildStart(){p||(f(),p=!0)}}}function ml(t){const{remotes:n,outputPath:r}=t,i=r||e.resolve(process.cwd(),"src/utils/mf.tsx"),s=function(e){const t=function(e){return e.reduce((e,t)=>(e[t.aliasName||t.remoteName]=t,e),{})}(e),n=JSON.stringify(t,null,2);return"/* eslint-disable */\nimport { lazy, Suspense, type ReactNode, type ComponentType } from 'react';\n\n// 远程模块配置\nconst remotes = __REMOTES_JSON__ as const;\n\ntype RemoteAlias = keyof typeof remotes;\ntype ModuleSpecifier = `${RemoteAlias}/${string}`;\n\n// 多个入口文件之间共享的变量\nconst entryShared = (window as any).__entry_shared__ || {};\n\n// 脚本加载状态: undefined=未加载, Promise=加载中, true=已完成\nconst scriptCache: Record<string, Promise<void> | true | undefined> = {};\n\n/**\n * [MF-MIGRATION] 以下为修复「关沙箱子应用覆盖 window[remoteName] 后 container.get 丢失」的新增状态:\n * - remoteContainerCache:在宿主内持久保存联邦容器引用,不依赖 window 上的全局名。\n * - esModuleImportUrl:ESM 远程首次 dynamic import 的完整路径(含 query),重试时复用同一 URL,避免 ?t= 变化导致重复实例化 remote。\n */\nconst remoteContainerCache: Record<string, unknown> = {};\nconst esModuleImportUrl: Record<string, string> = {};\n\n/**\n * 获取多入口共享变量(懒初始化单例)\n */\nexport function getEntryShared<T>(key: string, init: () => T): T {\n return (entryShared[key] ??= init()) as T;\n}\n\n/**\n * 安全加载远程组件\n */\nexport function safeRemoteComponent<T extends ComponentType<any>>(opts: {\n moduleSpecifier: ModuleSpecifier;\n fallbackComponent: T;\n loadingElement?: ReactNode;\n}): T {\n const LazyComponent = lazy<T>(() =>\n loadRemoteModule(opts.moduleSpecifier, { default: opts.fallbackComponent }),\n );\n\n return ((props: any) => (\n <Suspense fallback={opts.loadingElement ?? null}>\n <LazyComponent {...props} />\n </Suspense>\n )) as T;\n}\n\n// ============ 内部实现 ============\n\n/** [MF-MIGRATION] 优先使用缓存的容器,避免子应用污染 window 后读错对象。 */\nfunction pickFederationContainer(remoteName: string): { get: (s: string) => Promise<() => unknown> } | null {\n const cached = remoteContainerCache[remoteName];\n if (cached && typeof (cached as { get?: unknown }).get === 'function') {\n return cached as { get: (s: string) => Promise<() => unknown> };\n }\n const fromWindow = (window as any)[remoteName];\n if (fromWindow && typeof fromWindow.get === 'function') {\n remoteContainerCache[remoteName] = fromWindow;\n return fromWindow;\n }\n return null;\n}\n\n/** [MF-MIGRATION] 首次成功解析到的容器写入缓存,供后续路由切换后仍使用同一引用。 */\nfunction rememberFederationContainer(remoteName: string, container: unknown) {\n if (container && typeof (container as { get?: unknown }).get === 'function') {\n remoteContainerCache[remoteName] = container;\n }\n}\n\nasync function loadRemoteModule<T>(specifier: ModuleSpecifier, fallback: T): Promise<T> {\n try {\n const slashIndex = specifier.indexOf('/');\n const alias = specifier.slice(0, slashIndex) as RemoteAlias;\n const moduleName = specifier.slice(slashIndex + 1);\n const remote = remotes[alias];\n\n if (!remote) {\n console.error(`[MF] Unknown remote alias: \"${alias}\"`);\n return fallback;\n }\n\n // Some remotes may not have isESModule property, default to false if missing\n const isESModule = (remote as any).isESModule ?? false;\n\n // [MF-MIGRATION] 先正常加载;若 window 已被其它子应用占用且缓存仍空,再清 script 状态重试一次。\n await loadScriptOnce(remote.remoteName, remote.entry, isESModule);\n let container = pickFederationContainer(remote.remoteName);\n if (!container) {\n scriptCache[remote.remoteName] = undefined;\n delete remoteContainerCache[remote.remoteName];\n await loadScriptOnce(remote.remoteName, remote.entry, isESModule);\n container = pickFederationContainer(remote.remoteName);\n }\n\n if (!container) {\n console.error(\n `[MF] Container \"${remote.remoteName}\" not found or invalid (expected get() on window or cache)`,\n );\n return fallback;\n }\n\n // 对于 ES Module 联邦,需要先调用 init 初始化共享模块\n // if (isESModule && typeof container.init === 'function') {\n // // 初始化共享作用域(如果还没有初始化过)\n // const shareScope = (window as any).__federation_shared__ || {};\n // (window as any).__federation_shared__ = shareScope;\n // await container.init(shareScope);\n // }\n\n const factory = await container.get(`./${moduleName}`);\n const module = factory();\n\n // 确保返回 { default: Component } 格式给 React.lazy\n if (module && typeof module === 'object' && 'default' in module) {\n return module as T;\n }\n\n // 如果模块本身就是组件,包装成 { default: Component }\n return { default: module } as T;\n } catch (e) {\n console.error('[MF] Load remote module failed:', e);\n return fallback;\n }\n}\n\nasync function loadScriptOnce(name: string, url: string, isESModule?: boolean): Promise<void> {\n const cached = scriptCache[name];\n\n if (cached === true) return;\n if (cached) return cached;\n\n const promise = (async () => {\n const baseUrl = window.location.origin;\n\n // ES Module 格式\n if (isESModule) {\n try {\n // [MF-MIGRATION] 首次生成带 ?t= 的 URL 并记住;重试 load 时复用,避免 duplicate remote runtime。\n const fullUrl = esModuleImportUrl[name] ?? `${url}?t=${Date.now()}`;\n if (!esModuleImportUrl[name]) {\n esModuleImportUrl[name] = fullUrl;\n }\n\n const module = await import(/* @vite-ignore */ `${baseUrl}${fullUrl}`);\n\n // Vite Module Federation 通常直接导出 get/init,而不是 default\n const container = module.default || module;\n\n // 验证容器是否有效\n if (typeof container.get !== 'function') {\n console.error('[MF] Invalid container: missing get() method', container);\n throw new Error(`Container \"${name}\" has no get() method`);\n }\n\n (window as any)[name] = container;\n // [MF-MIGRATION] 与 window 同步写入缓存,后续以缓存为准。\n rememberFederationContainer(name, container);\n return;\n } catch (e) {\n console.error('[MF] ES Module load failed:', e);\n throw e; // 对于明确指定 isESModule 的情况,不应该回退\n }\n }\n\n // 回退到 UMD 格式\n const fullUrl = `${url}?t=${Date.now()}`;\n await new Promise<void>((resolve, reject) => {\n const script = document.createElement('script');\n script.src = fullUrl;\n script.async = true;\n script.onload = () => resolve();\n script.onerror = reject;\n document.head.appendChild(script);\n });\n\n // [MF-MIGRATION] UMD 由脚本挂到 window,加载完成后抽一次有效容器进缓存。\n rememberFederationContainer(name, (window as any)[name]);\n })().then(\n () => {\n scriptCache[name] = true;\n },\n e => {\n scriptCache[name] = undefined;\n throw e;\n },\n );\n\n scriptCache[name] = promise;\n return promise;\n}\n".replace("__REMOTES_JSON__",n)}(n),a=e.dirname(i);if(l.existsSync(a)||l.mkdirSync(a,{recursive:!0}),l.existsSync(i)){if(l.readFileSync(i,"utf-8")===s)return}l.writeFileSync(i,s),console.log("✅ mf.tsx 已生成:",i)}function yl(e){return{name:"micro-frontend:mf-generator",enforce:"pre",configResolved(){ml(e)},buildStart(){ml(e)}}}const Tl=f(import.meta.url);let gl={};try{const e=Tl.resolve("@module-federation/dts-plugin/dynamic-remote-type-hints-plugin");gl["@module-federation/dts-plugin/dynamic-remote-type-hints-plugin"]=e}catch{}function Sl(e){return e.replace(/\\/g,"/")}function xl(t){const n=function(t){const n={},r=[".tsx",".ts"];if(!l.existsSync(t))return n;const i=l.readdirSync(t,{withFileTypes:!0});for(const s of i)if(s.isDirectory()){const r=e.join(t,s.name),i=["index.tsx","index.ts"];let a=null;for(const t of i){const n=e.join(r,t);if(l.existsSync(n)){a=n;break}}if(a){const t=Sl(e.relative(process.cwd(),a));n[`./${s.name}`]=`./${t}`}else console.warn(`⚠️ ${s.name} 目录下没有找到入口文件,已忽略`)}else{const i=e.extname(s.name);if(r.includes(i)){const r=e.join(t,s.name),a=Sl(e.relative(process.cwd(),r));n[`./${e.basename(s.name,i)}`]=`./${a}`}}return n}(e.resolve(process.cwd(),t.exposesDir??"src/exposes"));return{...n,...t.exposes||{}}}function bl(t){const n={dts:!1,...t},r=[];r.push(0===Object.keys(gl).length?{name:"mf-dts-plugin-alias",config:()=>({})}:{name:"mf-dts-plugin-alias",enforce:"pre",config:()=>({resolve:{alias:gl}})});const i=function(e,t){if(!e||0===e.length)return;const n={};for(const r of e){const{remoteName:e,entry:i}=r,s=i.startsWith("/")?i:`/${i}`;if(i.startsWith("http"))n[e]=i;else if(t){const r=t.endsWith("/")?t.slice(0,-1):t;n[e]=`${r}${s}`}n[e]=s}return n}(n.remotes,n.devHost),s=xl(n);return r.push(b({filename:n.filename||"remote.js",hostInitInjectLocation:n.hostInitInjectLocation||"entry",...n,remotes:i,exposes:s})),r.push(yl({remotes:n.remotes??[],outputPath:n.outputPath?e.resolve(process.cwd(),n.outputPath):"src/utils/mf.tsx"})),r}function El(e,t,n){if(e)return"function"==typeof e?e.apply(t,n):e.handler.apply(t,n)}function Pl(e,t){let n;const{transformIndexHtml:r=!0,transformIndexHtmlConfig:i}=e;return{name:"micro-frontend:dynamic-base-deferred",enforce:"post",apply:"build",configResolved:e=>(n=E({publicPath:t(),transformIndexHtml:r,transformIndexHtmlConfig:i}),El(n.configResolved,n,[e])),generateBundle(e,t,r){if(n?.generateBundle)return El(n.generateBundle,n,[e,t,r])}}}function vl(e,t){const{transformIndexHtml:n=!0,removeIndexCssPreload:r=!1}=e,i=[];return n&&i.push({name:"micro-frontend: rewrite-inline-dynamic-base-import",enforce:"post",transformIndexHtml(e){const n=t();return e.replace(/import\('\/app-earth-allpay\/([^']+)'\)/g,`import(${n} + '/$1')`)}}),r&&i.push({name:"micro-frontend:remove-index-css-preload",enforce:"post",apply:"build",transformIndexHtml(e){let t=e.replace(/<link[^>]*rel=["']stylesheet["'][^>]*href=["'](?:\\\/)?index-[^"']+\.css["'][^>]*>/gi,"");return t=t.replace(/,\{"parentTagName":"head","tagName":"link","attrs":\{"rel":"stylesheet","crossorigin":"","href":"\/index-[^"]+\.css"\}\}/g,""),t}}),i}function Al(e){const t={publicPath:""},n=function(e){return"boolean"==typeof e?{}:e}(e),r=()=>t.publicPath,i={name:"micro-frontend:dynamic-base-init",enforce:"pre",apply:"build",config(n,r){t.publicPath=function(e,t){if("boolean"==typeof t)return t?`(window.EARTH_BASE_CONFIG && window.EARTH_BASE_CONFIG.EARTH_ALL_SHARE_HOST ? window.EARTH_BASE_CONFIG.EARTH_ALL_SHARE_HOST.replace(/\\/$/, '') : '') + ${JSON.stringify(e.base)}`:"";const n=t.publicPath?.trim();return n||`(window.EARTH_BASE_CONFIG && window.EARTH_BASE_CONFIG.EARTH_ALL_SHARE_HOST ? window.EARTH_BASE_CONFIG.EARTH_ALL_SHARE_HOST.replace(/\\/$/, '') : '') + ${JSON.stringify(e.base)}`}(n,e)}};return[i,Pl(n,r),...vl(n,r)]}const Cl=P(import.meta.url);function wl(){let e="";return{name:"micro-frontend:antd-external",enforce:"pre",config(n,r){const i=Cl.resolve("antd/es/index.js"),s=c.readFileSync(i,"utf-8"),a=new Set,o=/export\s*\{\s*default\s+as\s+(\w+)\s*\}/g;let l;for(;l=o.exec(s);)a.add(l[1]);const p=/export\s+var\s+(\w+)\s*=/g;for(;l=p.exec(s);)a.add(l[1]);const u=`/**\n * 自动生成的 antd 代理文件\n * 由 autoExternalAntd 插件生成,请勿手动修改\n */\nconst antd = (window as any).antd;\n\n${[...a].map(e=>`export const ${e} = antd.${e};`).join("\n")}\n\nexport default antd;\n`;e=t.resolve(process.cwd(),"src/.external/antd.ts"),c.mkdirSync(t.dirname(e),{recursive:!0}),c.writeFileSync(e,u);const d=n.resolve?.alias,h=Array.isArray(d)?d:d?Object.entries(d).map(([e,t])=>({find:e,replacement:t})):[];return{resolve:{alias:[...h,{find:/^antd$/,replacement:e}]}}}}}const Il={pagesDir:"src/pages",outputPath:"src/routes.ts",watch:!0,ignoreDirs:["components","utils","hooks","typings"],routeTemplate:{defaultLoadingComponentPath:"@/components/loading",intlPath:"@/utils/intl"}},Nl="__microFrontendOptions";function kl(t){const{appName:n,federation:r,routes:i,htmlTransform:s=!0,qiankun:o,dynamicBase:l}=t,c=[];if(c.push({name:"micro-frontend:options",[Nl]:t}),s){const e="object"==typeof s?s:{};c.push($(e))}const p="object"==typeof i?Object.assign(Il,i):Il;if(c.push(fl({pagesDir:p.pagesDir?e.resolve(process.cwd(),p.pagesDir):void 0,outputPath:p.outputPath?e.resolve(process.cwd(),p.outputPath):void 0,watch:p.watch,ignoreDirs:p.ignoreDirs,routeTemplate:p.routeTemplate})),!1!==o?.enabled){const e=o?.name||n,t="development"===process.env.NODE_ENV;c.push(a(e,{useDevMode:t}))}return r&&(c.push(...bl(r)),c.push(j({relativeCSSInjection:!0}))),l&&c.push(...Al(l)),c}export{Nl as MICRO_FRONTEND_OPTIONS_KEY,wl as autoExternalAntd,j as cssInjectedByJsPlugin,$ as devHmrPlugin,bl as federationPlugin,ml as generateMf,hl as generateRoutesToFile,Al as getDynamicBasePlugins,ll as getRoutes,yl as mfGeneratorPlugin,kl as microFrontendPlugins,fl as pagesRoutesPlugin};
|
|
13
|
+
`;return this.replaceWith(p)[0].get("arguments.0")},Ya.splitExportDeclaration=function(){if(!this.isExportDeclaration()||this.isExportAllDeclaration())throw new Error("Only default and named export declarations can be split.");if(this.isExportNamedDeclaration()&&this.get("specifiers").length>0)throw new Error("It doesn't make sense to split exported specifiers.");const e=this.get("declaration");if(this.isExportDefaultDeclaration()){const t=e.isFunctionDeclaration()||e.isClassDeclaration(),n=e.isFunctionExpression()||e.isClassExpression(),r=e.isScope()?e.scope.parent:e.scope;let i=e.node.id,s=!1;i?n&&r.hasBinding(i.name)&&(s=!0,i=r.generateUidIdentifier(i.name)):(s=!0,i=r.generateUidIdentifier("default"),(t||n)&&(e.node.id=L(i)));const a=t?e.node:M("var",[F(L(i),e.node)]),o=B(null,[j(L(i),u("default"))]);return this.insertAfter(o),this.replaceWith(a),s&&r.registerDeclaration(this),this}if(this.get("specifiers").length>0)throw new Error("It doesn't make sense to split exported specifiers.");const t=e.getOuterBindingIdentifiers(),n=Object.keys(t).map(e=>j(u(e),u(e))),r=B(null,n);return this.insertAfter(r),this.replaceWith(e.node),this},Ya.toComputedKey=function(){let e;if(this.isMemberExpression())e=this.node.property;else{if(!this.isProperty()&&!this.isMethod())throw new ReferenceError("todo");e=this.node.key}this.node.computed||d(e)&&(e=v(e.name));return e},Ya.unwrapFunctionEnvironment=function(){if(!this.isArrowFunctionExpression()&&!this.isFunctionExpression()&&!this.isFunctionDeclaration())throw this.buildCodeFrameError("Can only unwrap the environment of a function.");K(this)};var e=zr(),t=function(){if(uo)return Xa;uo=1,Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.statements=Xa.statement=Xa.smart=Xa.program=Xa.expression=Xa.default=void 0;var e=za(),t=yo();const n=Xa.smart=(0,t.default)(e.smart),r=Xa.statement=(0,t.default)(e.statement),i=Xa.statements=(0,t.default)(e.statements),s=Xa.expression=(0,t.default)(e.expression),a=Xa.program=(0,t.default)(e.program);return Xa.default=Object.assign(n.bind(void 0),{smart:n,statement:r,statements:i,expression:s,program:a,ast:n.ast}),Xa}(),n=Di(),r=_o();const{arrowFunctionExpression:i,assignmentExpression:s,binaryExpression:a,blockStatement:o,callExpression:l,conditionalExpression:c,expressionStatement:p,identifier:u,isIdentifier:d,jsxIdentifier:h,logicalExpression:f,LOGICAL_OPERATORS:m,memberExpression:y,metaProperty:T,numericLiteral:g,objectExpression:S,restElement:x,returnStatement:b,sequenceExpression:E,spreadElement:P,stringLiteral:v,super:A,thisExpression:C,toExpression:w,unaryExpression:I,toBindingIdentifierName:N,isFunction:k,isAssignmentPattern:O,isRestElement:_,getFunctionName:D,cloneNode:L,variableDeclaration:M,variableDeclarator:F,exportNamedDeclaration:B,exportSpecifier:j,inherits:R}=e;Ya.arrowFunctionToShadowed=function(){this.isArrowFunctionExpression()&&this.arrowFunctionToExpression()};const U=(0,n.environmentVisitor)({CallExpression(e,{allSuperCalls:t}){e.get("callee").isSuper()&&t.push(e)}});function K(e,t=!0,n=!0,r=!0){let o,p=e.findParent(e=>e.isArrowFunctionExpression()?(null!=o||(o=e),!1):e.isFunction()||e.isProgram()||e.isClassProperty({static:!1})||e.isClassPrivateProperty({static:!1}));const d=p.isClassMethod({kind:"constructor"});if(p.isClassProperty()||p.isClassPrivateProperty())if(o)p=o;else{if(!n)throw e.buildCodeFrameError("Unable to transform arrow inside class property");e.replaceWith(l(i([],w(e.node)),[])),p=e.get("callee"),e=p.get("body")}const{thisPaths:S,argumentsPaths:b,newTargetPaths:N,superProps:k,superCalls:O}=function(e){const t=[],n=[],r=[],i=[],s=[];return e.traverse($,{thisPaths:t,argumentsPaths:n,newTargetPaths:r,superProps:i,superCalls:s}),{thisPaths:t,argumentsPaths:n,newTargetPaths:r,superProps:i,superCalls:s}}(e);if(d&&O.length>0){if(!n)throw O[0].buildCodeFrameError("When using '@babel/plugin-transform-arrow-functions', it's not possible to compile `super()` in an arrow function without compiling classes.\nPlease add '@babel/plugin-transform-classes' to your Babel configuration.");if(!r)throw O[0].buildCodeFrameError("When using '@babel/plugin-transform-parameters', it's not possible to compile `super()` in an arrow function with default or rest parameters without compiling classes.\nPlease add '@babel/plugin-transform-classes' to your Babel configuration.");const e=[];p.traverse(U,{allSuperCalls:e});const t=function(e){return W(e,"supercall",()=>{const t=e.scope.generateUidIdentifier("args");return i([x(t)],l(A(),[P(u(t.name))]))})}(p);e.forEach(e=>{const n=u(t);n.loc=e.node.callee.loc,e.get("callee").replaceWith(n)})}if(b.length>0){const e=W(p,"arguments",()=>{const e=()=>u("arguments");return p.scope.path.isProgram()?c(a("===",I("typeof",e()),v("undefined")),p.scope.buildUndefinedNode(),e()):e()});b.forEach(t=>{const n=u(e);n.loc=t.node.loc,t.replaceWith(n)})}if(N.length>0){const e=W(p,"newtarget",()=>T(u("new"),u("target")));N.forEach(t=>{const n=u(e);n.loc=t.node.loc,t.replaceWith(n)})}if(k.length>0){if(!n)throw k[0].buildCodeFrameError("When using '@babel/plugin-transform-arrow-functions', it's not possible to compile `super.prop` in an arrow function without compiling classes.\nPlease add '@babel/plugin-transform-classes' to your Babel configuration.");k.reduce((e,t)=>e.concat(function(e){if(e.parentPath.isAssignmentExpression()&&"="!==e.parentPath.node.operator){const n=e.parentPath,r=n.node.operator.slice(0,-1),i=n.node.right,a=function(e){return m.includes(e)}(r);if(e.node.computed){const o=e.scope.generateDeclaredUidIdentifier("tmp"),{object:l,property:c}=e.node;n.get("left").replaceWith(y(l,s("=",o,c),!0)),n.get("right").replaceWith(t(a?"=":r,y(l,u(o.name),!0),i))}else{const s=e.node.object,o=e.node.property;n.get("left").replaceWith(y(s,o)),n.get("right").replaceWith(t(a?"=":r,y(s,u(o.name)),i))}return a?n.replaceWith(f(r,n.node.left,n.node.right)):n.node.operator="=",[n.get("left"),n.get("right").get("left")]}if(e.parentPath.isUpdateExpression()){const t=e.parentPath,n=e.scope.generateDeclaredUidIdentifier("tmp"),r=e.node.computed?e.scope.generateDeclaredUidIdentifier("prop"):null,i=[s("=",n,y(e.node.object,r?s("=",r,e.node.property):e.node.property,e.node.computed)),s("=",y(e.node.object,r?u(r.name):e.node.property,e.node.computed),a(e.parentPath.node.operator[0],u(n.name),g(1)))];e.parentPath.node.prefix||i.push(u(n.name)),t.replaceWith(E(i));return[t.get("expressions.0.right"),t.get("expressions.1.left")]}return[e];function t(e,t,n){return"="===e?s("=",t,n):a(e,t,n)}}(t)),[]).forEach(e=>{const t=e.node.computed?"":e.get("property").node.name,n=e.parentPath,r=n.isAssignmentExpression({left:e.node}),a=n.isCallExpression({callee:e.node}),o=n.isTaggedTemplateExpression({tag:e.node}),c=function(e,t,n){const r=t?"set":"get";return W(e,`superprop_${r}:${n||""}`,()=>{const r=[];let a;if(n)a=y(A(),u(n));else{const t=e.scope.generateUidIdentifier("prop");r.unshift(t),a=y(A(),u(t.name),!0)}if(t){const t=e.scope.generateUidIdentifier("value");r.push(t),a=s("=",a,u(t.name))}return i(r,a)})}(p,r,t),d=[];if(e.node.computed&&d.push(e.get("property").node),r){const e=n.node.right;d.push(e)}const h=l(u(c),d);a?(n.unshiftContainer("arguments",C()),e.replaceWith(y(h,u("call"))),S.push(n.get("arguments.0"))):r?n.replaceWith(h):o?(e.replaceWith(l(y(h,u("bind"),!1),[C()])),S.push(e.get("arguments.0"))):e.replaceWith(h)})}let _;return(S.length>0||!t)&&(_=function(e,t){return W(e,"this",n=>{if(!t||!V(e))return C();e.traverse(q,{supers:new WeakSet,thisBinding:n})})}(p,d),(t||d&&V(p))&&(S.forEach(e=>{const t=e.isJSX()?h(_):u(_);t.loc=e.node.loc,e.replaceWith(t)}),t||(_=null))),{thisBinding:_,fnPath:e}}function V(e){return e.isClassMethod()&&!!e.parentPath.parentPath.node.superClass}const q=(0,n.environmentVisitor)({CallExpression(e,{supers:t,thisBinding:n}){e.get("callee").isSuper()&&(t.has(e.node)||(t.add(e.node),e.replaceWithMultiple([e.node,s("=",u(n),u("this"))])))}});function W(e,t,n){const r="binding:"+t;let i=e.getData(r);if(!i){const s=e.scope.generateUidIdentifier(t);i=s.name,e.setData(r,i),e.scope.push({id:s,init:n(i)})}return i}const $=(0,n.environmentVisitor)({ThisExpression(e,{thisPaths:t}){t.push(e)},JSXIdentifier(e,{thisPaths:t}){"this"===e.node.name&&(e.parentPath.isJSXMemberExpression({object:e.node})||e.parentPath.isJSXOpeningElement({name:e.node}))&&t.push(e)},CallExpression(e,{superCalls:t}){e.get("callee").isSuper()&&t.push(e)},MemberExpression(e,{superProps:t}){e.get("object").isSuper()&&t.push(e)},Identifier(e,{argumentsPaths:t}){if(!e.isReferencedIdentifier({name:"arguments"}))return;let n=e.scope;do{if(n.hasOwnBinding("arguments"))return void n.rename("arguments");if(n.path.isFunction()&&!n.path.isArrowFunctionExpression())break}while(n=n.parent);t.push(e)},MetaProperty(e,{newTargetPaths:t}){e.get("meta").isIdentifier({name:"new"})&&e.get("property").isIdentifier({name:"target"})&&t.push(e)}});const J={"ReferencedIdentifier|BindingIdentifier"(e,t){e.node.name===t.name&&(t.needsRename=!0,e.stop())},Scope(e,t){e.scope.hasOwnBinding(t.name)&&e.skip()}};return Ya}var go,So={};function xo(){return go||(go=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._guessExecutionStatusRelativeTo=function(e){return m(this,e,new Map)},e._resolve=y,e.canHaveVariableDeclarationOrExpression=function(){return("init"===this.key||"left"===this.key)&&this.parentPath.isFor()},e.canSwapBetweenExpressionAndStatement=function(e){if("body"!==this.key||!this.parentPath.isArrowFunctionExpression())return!1;if(this.isExpression())return i(e);if(this.isBlockStatement())return s(e);return!1},e.getSource=function(){const e=this.node;if(e.end){const t=this.hub.getCode();if(t)return t.slice(e.start,e.end)}return""},e.isCompletionRecord=function(e){let t=this,n=!0;do{const{type:r,container:i}=t;if(!n&&(t.isFunction()||"StaticBlock"===r))return!!e;if(n=!1,Array.isArray(i)&&t.key!==i.length-1)return!1}while((t=t.parentPath)&&!t.isProgram()&&!t.isDoExpression());return!0},e.isConstantExpression=function(){if(this.isIdentifier()){const e=this.scope.getBinding(this.node.name);return!!e&&e.constant}if(this.isLiteral())return!this.isRegExpLiteral()&&(!this.isTemplateLiteral()||this.get("expressions").every(e=>e.isConstantExpression()));if(this.isUnaryExpression())return"void"===this.node.operator&&this.get("argument").isConstantExpression();if(this.isBinaryExpression()){const{operator:e}=this.node;return"in"!==e&&"instanceof"!==e&&this.get("left").isConstantExpression()&&this.get("right").isConstantExpression()}if(this.isMemberExpression())return!this.node.computed&&this.get("object").isIdentifier({name:"Symbol"})&&!this.scope.hasBinding("Symbol",{noGlobals:!0});if(this.isCallExpression())return 1===this.node.arguments.length&&this.get("callee").matchesPattern("Symbol.for")&&!this.scope.hasBinding("Symbol",{noGlobals:!0})&&this.get("arguments")[0].isStringLiteral();return!1},e.isInStrictMode=function(){const e=(this.isProgram()?this:this.parentPath).find(e=>{if(e.isProgram({sourceType:"module"}))return!0;if(e.isClass())return!0;if(e.isArrowFunctionExpression()&&!e.get("body").isBlockStatement())return!1;let t;if(e.isFunction())t=e.node.body;else{if(!e.isProgram())return!1;t=e.node}for(const e of t.directives)if("use strict"===e.value.value)return!0;return!1});return!!e},e.isNodeType=function(e){return c(this.type,e)},e.isStatementOrBlock=function(){return!this.parentPath.isLabeledStatement()&&!i(this.container)&&n.includes(this.key)},e.isStatic=function(){return this.scope.isStatic(this.node)},e.matchesPattern=function(e,t){return p(this.node,e,t)},e.referencesImport=function(e,t){if(!this.isReferencedIdentifier()){if(this.isJSXMemberExpression()&&this.node.property.name===t||(this.isMemberExpression()||this.isOptionalMemberExpression())&&(this.node.computed?l(this.node.property,{value:t}):this.node.property.name===t)){const t=this.get("object");return t.isReferencedIdentifier()&&t.referencesImport(e,"*")}return!1}const n=this.scope.getBinding(this.node.name);if(!n||"module"!==n.kind)return!1;const r=n.path,i=r.parentPath;if(!i.isImportDeclaration())return!1;if(i.node.source.value!==e)return!1;if(!t)return!0;if(r.isImportDefaultSpecifier()&&"default"===t)return!0;if(r.isImportNamespaceSpecifier()&&"*"===t)return!0;if(r.isImportSpecifier()&&a(r.node.imported,{name:t}))return!0;return!1},e.resolve=function(e,t){return y.call(this,e,t)||this},e.willIMaybeExecuteBefore=function(e){return"after"!==this._guessExecutionStatusRelativeTo(e)};var t=zr();const{STATEMENT_OR_BLOCK_KEYS:n,VISITOR_KEYS:r,isBlockStatement:i,isExpression:s,isIdentifier:a,isLiteral:o,isStringLiteral:l,isType:c,matchesPattern:p}=t;function u(e){return e.isProgram()?e:(e.parentPath.scope.getFunctionParent()||e.parentPath.scope.getProgramParent()).path}function d(e,t){switch(e){case"LogicalExpression":case"AssignmentPattern":return"right"===t;case"ConditionalExpression":case"IfStatement":return"consequent"===t||"alternate"===t;case"WhileStatement":case"DoWhileStatement":case"ForInStatement":case"ForOfStatement":return"body"===t;case"ForStatement":return"body"===t||"update"===t;case"SwitchStatement":return"cases"===t;case"TryStatement":return"handler"===t;case"OptionalMemberExpression":return"property"===t;case"OptionalCallExpression":return"arguments"===t;default:return!1}}function h(e,t){for(let n=0;n<t;n++){const t=e[n];if(d(t.parent.type,t.parentKey))return!0}return!1}e.has=function(e){var t;const n=null==(t=this.node)?void 0:t[e];return n&&Array.isArray(n)?!!n.length:!!n},e.is=e.has,e.isnt=function(e){return!this.has(e)},e.equals=function(e,t){return this.node[e]===t};const f=Symbol();function m(e,t,n){const i={this:u(e),target:u(t)};if(i.target.node!==i.this.node)return function(e,t,n){let r,i=n.get(e.node);if(i){if(r=i.get(t.node))return r===f?"unknown":r}else n.set(e.node,i=new Map);i.set(t.node,f);const s=function(e,t,n){if(!t.isFunctionDeclaration())return"before"===m(e,t,n)?"before":"unknown";if(t.parentPath.isExportDeclaration())return"unknown";const r=t.scope.getBinding(t.node.id.name);if(!r.references)return"before";const i=r.referencePaths;let s;for(const r of i){if(!!r.find(e=>e.node===t.node))continue;if("callee"!==r.key||!r.parentPath.isCallExpression())return"unknown";const i=m(e,r,n);if(s&&s!==i)return"unknown";s=i}return s}(e,t,n);return i.set(t.node,s),s}(e,i.target,n);const s={target:t.getAncestry(),this:e.getAncestry()};if(s.target.includes(e))return"after";if(s.this.includes(t))return"before";let a;const o={target:0,this:0};for(;!a&&o.this<s.this.length;){const e=s.this[o.this];o.target=s.target.indexOf(e),o.target>=0?a=e:o.this++}if(!a)throw new Error("Internal Babel error - The two compared nodes don't appear to belong to the same program.");if(h(s.this,o.this-1)||h(s.target,o.target-1))return"unknown";const l={this:s.this[o.this-1],target:s.target[o.target-1]};if(l.target.listKey&&l.this.listKey&&l.target.container===l.this.container)return l.target.key>l.this.key?"before":"after";const c=r[a.type],p=c.indexOf(l.this.parentKey);return c.indexOf(l.target.parentKey)>p?"before":"after"}function y(e,t){var n;if(null==(n=t)||!n.includes(this))if((t=t||[]).push(this),this.isVariableDeclarator()){if(this.get("id").isIdentifier())return this.get("init").resolve(e,t)}else if(this.isReferencedIdentifier()){const n=this.scope.getBinding(this.node.name);if(!n)return;if(!n.constant)return;if("module"===n.kind)return;if(n.path!==this){const r=n.path.resolve(e,t);if(this.find(e=>e.node===r.node))return;return r}}else{if(this.isTypeCastExpression())return this.get("expression").resolve(e,t);if(e&&this.isMemberExpression()){const n=this.toComputedKey();if(!o(n))return;const r=n.value,i=this.get("object").resolve(e,t);if(i.isObjectExpression()){const n=i.get("properties");for(const i of n){if(!i.isProperty())continue;const n=i.get("key");let s=i.isnt("computed")&&n.isIdentifier({name:r});if(s=s||n.isLiteral({value:r}),s)return i.get("value").resolve(e,t)}}else if(i.isArrayExpression()&&!isNaN(+r)){const n=i.get("elements")[r];if(n)return n.resolve(e,t)}}}}}(So)),So}var bo,Eo={};function Po(){if(bo)return Eo;bo=1,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo._getKey=f,Eo._getPattern=m,Eo.get=function(e,t=!0){!0===t&&(t=this.context);const n=e.split(".");return 1===n.length?f.call(this,e,t):m.call(this,n,t)},Eo.getAllNextSiblings=function(){let e=this.key,t=this.getSibling(++e);const n=[];for(;t.node;)n.push(t),t=this.getSibling(++e);return n},Eo.getAllPrevSiblings=function(){let e=this.key,t=this.getSibling(--e);const n=[];for(;t.node;)n.push(t),t=this.getSibling(--e);return n},Eo.getAssignmentIdentifiers=function(){return n(this.node)},Eo.getBindingIdentifierPaths=function(e=!1,t=!1){const n=[this],i=Object.create(null);for(;n.length;){const s=n.shift();if(!s)continue;if(!s.node)continue;const a=r.keys[s.node.type];if(s.isIdentifier())if(e){(i[s.node.name]=i[s.node.name]||[]).push(s)}else i[s.node.name]=s;else{if(s.isExportDeclaration()){const e=s.get("declaration");e.isDeclaration()&&n.push(e);continue}if(t){if(s.isFunctionDeclaration()){n.push(s.get("id"));continue}if(s.isFunctionExpression())continue}if(a)for(let e=0;e<a.length;e++){const t=a[e],r=s.get(t);Array.isArray(r)?n.push(...r):r.node&&n.push(r)}}}return i},Eo.getBindingIdentifiers=function(e){return r(this.node,e)},Eo.getCompletionRecords=function(e=!1){return h(this,{canHaveBreak:!1,shouldPopulateBreak:!1,inCaseClause:!1,shouldPreserveBreak:e}).map(e=>e.path)},Eo.getNextSibling=function(){return this.getSibling(this.key+1)},Eo.getOpposite=function(){if("left"===this.key)return this.getSibling("right");if("right"===this.key)return this.getSibling("left");return null},Eo.getOuterBindingIdentifierPaths=function(e=!1){return this.getBindingIdentifierPaths(e,!0)},Eo.getOuterBindingIdentifiers=function(e){return i(this.node,e)},Eo.getPrevSibling=function(){return this.getSibling(this.key-1)},Eo.getSibling=function(t){return e.default.get({parentPath:this.parentPath,parent:this.parent,container:this.container,listKey:this.listKey,key:t}).setContext(this.context)};var e=ko(),t=zr();const{getAssignmentIdentifiers:n,getBindingIdentifiers:r,getOuterBindingIdentifiers:i,numericLiteral:s,unaryExpression:a}=t,o=0,l=1;function c(e,t,n){return e&&t.push(...h(e,n)),t}function p(e){e.forEach(e=>{e.type=l})}function u(e,t){e.forEach(e=>{e.path.isBreakStatement({label:null})&&(t?e.path.replaceWith(a("void",s(0))):e.path.remove())})}function d(e,t){const n=[];if(t.canHaveBreak){let r=[];for(let i=0;i<e.length;i++){const s=e[i],a=Object.assign({},t,{inCaseClause:!1});s.isBlockStatement()&&(t.inCaseClause||t.shouldPopulateBreak)?a.shouldPopulateBreak=!0:a.shouldPopulateBreak=!1;const c=h(s,a);if(c.length>0&&c.every(e=>e.type===l)){r.length>0&&c.every(e=>e.path.isBreakStatement({label:null}))?(p(r),n.push(...r),r.some(e=>e.path.isDeclaration())&&(n.push(...c),t.shouldPreserveBreak||u(c,!0)),t.shouldPreserveBreak||u(c,!1)):(n.push(...c),t.shouldPopulateBreak||t.shouldPreserveBreak||u(c,!0));break}if(i===e.length-1)n.push(...c);else{r=[];for(let e=0;e<c.length;e++){const t=c[e];t.type===l&&n.push(t),t.type===o&&r.push(t)}}}}else if(e.length)for(let r=e.length-1;r>=0;r--){const i=h(e[r],t);if(i.length>1||1===i.length&&!i[0].path.isVariableDeclaration()&&!i[0].path.isEmptyStatement()){n.push(...i);break}}return n}function h(e,t){let n=[];if(e.isIfStatement())n=c(e.get("consequent"),n,t),n=c(e.get("alternate"),n,t);else{if(e.isDoExpression()||e.isFor()||e.isWhile()||e.isLabeledStatement())return c(e.get("body"),n,t);if(e.isProgram()||e.isBlockStatement())return d(e.get("body"),t);if(e.isFunction())return h(e.get("body"),t);if(e.isTryStatement())n=c(e.get("block"),n,t),n=c(e.get("handler"),n,t);else{if(e.isCatchClause())return c(e.get("body"),n,t);if(e.isSwitchStatement())return function(e,t,n){let r=[];for(let i=0;i<e.length;i++){const s=h(e[i],n),a=[],c=[];for(const e of s)e.type===o&&a.push(e),e.type===l&&c.push(e);a.length&&(r=a),t.push(...c)}return t.push(...r),t}(e.get("cases"),n,t);if(e.isSwitchCase())return d(e.get("consequent"),{canHaveBreak:!0,shouldPopulateBreak:!1,inCaseClause:!0,shouldPreserveBreak:t.shouldPreserveBreak});e.isBreakStatement()?n.push(function(e){return{type:l,path:e}}(e)):n.push(function(e){return{type:o,path:e}}(e))}}return n}function f(t,n){const r=this.node,i=r[t];return Array.isArray(i)?i.map((s,a)=>e.default.get({listKey:t,parentPath:this,parent:r,container:i,key:a}).setContext(n)):e.default.get({parentPath:this,parent:r,container:r,key:t}).setContext(n)}function m(e,t){let n=this;for(const r of e)n="."===r?n.parentPath:Array.isArray(n)?n[r]:n.get(r,t);return n}return Eo}var vo,Ao,Co,wo,Io,No={};function ko(){if(Ao)return ri;Ao=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.default=ri.SHOULD_STOP=ri.SHOULD_SKIP=ri.REMOVED=void 0;var e=si(),t=vi(),n=Fo(),r=Wi(),i=zr(),s=i,a=Ui(),o=ia(),l=function(){if(sa)return aa;sa=1,Object.defineProperty(aa,"__esModule",{value:!0}),aa.find=function(e){let t=this;do{if(e(t))return t}while(t=t.parentPath);return null},aa.findParent=function(e){let t=this;for(;t=t.parentPath;)if(e(t))return t;return null},aa.getAncestry=function(){let e=this;const t=[];do{t.push(e)}while(e=e.parentPath);return t},aa.getDeepestCommonAncestorFrom=function(e,t){if(!e.length)return this;if(1===e.length)return e[0];let n,r,i=1/0;const s=e.map(e=>{const t=[];do{t.unshift(e)}while((e=e.parentPath)&&e!==this);return t.length<i&&(i=t.length),t}),a=s[0];e:for(let e=0;e<i;e++){const t=a[e];for(const n of s)if(n[e]!==t)break e;n=e,r=t}if(r)return t?t(r,n,s):r;throw new Error("Couldn't find intersection")},aa.getEarliestCommonAncestorFrom=function(e){return this.getDeepestCommonAncestorFrom(e,function(e,n,r){let i;const s=t[e.type];for(const e of r){const t=e[n+1];i?(t.listKey&&i.listKey===t.listKey&&t.key<i.key||s.indexOf(i.parentKey)>s.indexOf(t.parentKey))&&(i=t):i=t}return i})},aa.getFunctionParent=function(){return this.findParent(e=>e.isFunction())},aa.getStatementParent=function(){let e=this;do{if(!e.parentPath||Array.isArray(e.container)&&e.isStatement())break;e=e.parentPath}while(e);if(e&&(e.isProgram()||e.isFile()))throw new Error("File/Program node, we can't possibly find a statement parent to this");return e},aa.inType=function(...e){let t=this;for(;t;){if(e.includes(t.node.type))return!0;t=t.parentPath}return!1},aa.isAncestor=function(e){return e.isDescendant(this)},aa.isDescendant=function(e){return!!this.findParent(t=>t===e)};var e=zr();const{VISITOR_KEYS:t}=e;return aa}(),c=function(){if(pa)return ua;pa=1,Object.defineProperty(ua,"__esModule",{value:!0}),ua._getTypeAnnotation=P,ua.baseTypeStrictlyMatches=function(e){const t=this.getTypeAnnotation(),n=e.getTypeAnnotation();return!(r(t)||!o(t))&&n.type===t.type},ua.couldBeBaseType=function(e){const t=this.getTypeAnnotation();if(r(t))return!0;if(g(t)){for(const n of t.types)if(r(n)||v(e,n,!0))return!0;return!1}return v(e,t,!0)},ua.getTypeAnnotation=function(){let e=this.getData("typeAnnotation");return null!=e||(e=P.call(this)||n(),(T(e)||f(e))&&(e=e.typeAnnotation),this.setData("typeAnnotation",e)),e},ua.isBaseType=function(e,t){return v(e,this.getTypeAnnotation(),t)},ua.isGenericType=function(e){const t=this.getTypeAnnotation();return!("Array"!==e||!(h(t)||i(t)||y(t)))||(l(t)&&c(t.id,{name:e})||m(t)&&c(t.typeName,{name:e}))};var e=Ta(),t=zr();const{anyTypeAnnotation:n,isAnyTypeAnnotation:r,isArrayTypeAnnotation:i,isBooleanTypeAnnotation:s,isEmptyTypeAnnotation:a,isFlowBaseAnnotation:o,isGenericTypeAnnotation:l,isIdentifier:c,isMixedTypeAnnotation:p,isNumberTypeAnnotation:u,isStringTypeAnnotation:d,isTSArrayType:h,isTSTypeAnnotation:f,isTSTypeReference:m,isTupleTypeAnnotation:y,isTypeAnnotation:T,isUnionTypeAnnotation:g,isVoidTypeAnnotation:S,stringTypeAnnotation:x,voidTypeAnnotation:b}=t,E=new WeakSet;function P(){const t=this.node;if(t){if(t.typeAnnotation)return t.typeAnnotation;if(!E.has(t)){E.add(t);try{var r;let n=e[t.type];if(n)return n.call(this,t);if(n=e[this.parentPath.type],null!=(r=n)&&r.validParent)return this.parentPath.getTypeAnnotation()}finally{E.delete(t)}}}else if("init"===this.key&&this.parentPath.isVariableDeclarator()){const e=this.parentPath.parentPath,t=e.parentPath;return"left"===e.key&&t.isForInStatement()?x():"left"===e.key&&t.isForOfStatement()?n():b()}}function v(e,t,n){if("string"===e)return d(t);if("number"===e)return u(t);if("boolean"===e)return s(t);if("any"===e)return r(t);if("mixed"===e)return p(t);if("empty"===e)return a(t);if("void"===e)return S(t);if(n)return!1;throw new Error(`Unknown base type ${e}`)}return ua}(),p=Va(),u=$a(),d=To(),h=xo(),f=_o(),m=f,y=Da(),T=Ba(),g=Po(),S=function(){if(vo)return No;vo=1,Object.defineProperty(No,"__esModule",{value:!0}),No.addComment=function(e,n,r){t(this.node,e,n,r)},No.addComments=function(e,t){n(this.node,e,t)},No.shareCommentsWithSiblings=function(){if("string"==typeof this.key)return;const e=this.node;if(!e)return;const t=e.trailingComments,n=e.leadingComments;if(!t&&!n)return;const i=this.getSibling(this.key-1),s=this.getSibling(this.key+1),a=Boolean(i.node),o=Boolean(s.node);a&&(n&&i.addComments("trailing",r(n,i.node.trailingComments)),t&&!o&&i.addComments("trailing",t)),o&&(t&&s.addComments("leading",r(t,s.node.leadingComments)),n&&!a&&s.addComments("leading",n))};var e=zr();const{addComment:t,addComments:n}=e;function r(e,t){if(null==t||!t.length)return e;const n=new Set(t);return e.filter(e=>!n.has(e))}return No}(),x=_i();const{validate:b}=i,E=t("babel");ri.REMOVED=1,ri.SHOULD_STOP=2,ri.SHOULD_SKIP=4;const P=ri.default=class e{constructor(e,t){this.contexts=[],this.state=null,this._traverseFlags=0,this.skipKeys=null,this.parentPath=null,this.container=null,this.listKey=null,this.key=null,this.node=null,this.type=null,this._store=null,this.parent=t,this.hub=e,this.data=null,this.context=null,this.scope=null}get removed(){return(1&this._traverseFlags)>0}set removed(e){e?this._traverseFlags|=1:this._traverseFlags&=-2}get shouldStop(){return(2&this._traverseFlags)>0}set shouldStop(e){e?this._traverseFlags|=2:this._traverseFlags&=-3}get shouldSkip(){return(4&this._traverseFlags)>0}set shouldSkip(e){e?this._traverseFlags|=4:this._traverseFlags&=-5}static get({hub:t,parentPath:n,parent:r,container:i,listKey:s,key:o}){if(!t&&n&&(t=n.hub),!r)throw new Error("To get a node path the parent needs to exist");const l=i[o],c=a.getOrCreateCachedPaths(r,n);let p=c.get(l);return p||(p=new e(t,r),l&&c.set(l,p)),f.setup.call(p,n,i,s,o),p}getScope(e){return this.isScope()?new r.default(this):e}setData(e,t){return null==this.data&&(this.data=Object.create(null)),this.data[e]=t}getData(e,t){null==this.data&&(this.data=Object.create(null));let n=this.data[e];return void 0===n&&void 0!==t&&(n=this.data[e]=t),n}hasNode(){return null!=this.node}buildCodeFrameError(e,t=SyntaxError){return this.hub.buildError(this.node,e,t)}traverse(e,t){(0,n.default)(this.node,e,this.scope,t,this)}set(e,t){b(this.node,e,t),this.node[e]=t}getPathLocation(){const e=[];let t=this;do{let n=t.key;t.inList&&(n=`${t.listKey}[${n}]`),e.unshift(n)}while(t=t.parentPath);return e.join(".")}debug(e){E.enabled&&E(`${this.getPathLocation()} ${this.type}: ${e}`)}toString(){return(0,o.default)(this.node).code}get inList(){return!!this.listKey}set inList(e){e||(this.listKey=null)}get parentKey(){return this.listKey||this.key}},v={findParent:l.findParent,find:l.find,getFunctionParent:l.getFunctionParent,getStatementParent:l.getStatementParent,getEarliestCommonAncestorFrom:l.getEarliestCommonAncestorFrom,getDeepestCommonAncestorFrom:l.getDeepestCommonAncestorFrom,getAncestry:l.getAncestry,isAncestor:l.isAncestor,isDescendant:l.isDescendant,inType:l.inType,getTypeAnnotation:c.getTypeAnnotation,isBaseType:c.isBaseType,couldBeBaseType:c.couldBeBaseType,baseTypeStrictlyMatches:c.baseTypeStrictlyMatches,isGenericType:c.isGenericType,replaceWithMultiple:p.replaceWithMultiple,replaceWithSourceString:p.replaceWithSourceString,replaceWith:p.replaceWith,replaceExpressionWithStatements:p.replaceExpressionWithStatements,replaceInline:p.replaceInline,evaluateTruthy:u.evaluateTruthy,evaluate:u.evaluate,toComputedKey:d.toComputedKey,ensureBlock:d.ensureBlock,unwrapFunctionEnvironment:d.unwrapFunctionEnvironment,arrowFunctionToExpression:d.arrowFunctionToExpression,splitExportDeclaration:d.splitExportDeclaration,ensureFunctionName:d.ensureFunctionName,matchesPattern:h.matchesPattern,isStatic:h.isStatic,isNodeType:h.isNodeType,canHaveVariableDeclarationOrExpression:h.canHaveVariableDeclarationOrExpression,canSwapBetweenExpressionAndStatement:h.canSwapBetweenExpressionAndStatement,isCompletionRecord:h.isCompletionRecord,isStatementOrBlock:h.isStatementOrBlock,referencesImport:h.referencesImport,getSource:h.getSource,willIMaybeExecuteBefore:h.willIMaybeExecuteBefore,_guessExecutionStatusRelativeTo:h._guessExecutionStatusRelativeTo,resolve:h.resolve,isConstantExpression:h.isConstantExpression,isInStrictMode:h.isInStrictMode,isDenylisted:m.isDenylisted,visit:m.visit,skip:m.skip,skipKey:m.skipKey,stop:m.stop,setContext:m.setContext,requeue:m.requeue,requeueComputedKeyAndDecorators:m.requeueComputedKeyAndDecorators,remove:y.remove,insertBefore:T.insertBefore,insertAfter:T.insertAfter,unshiftContainer:T.unshiftContainer,pushContainer:T.pushContainer,getOpposite:g.getOpposite,getCompletionRecords:g.getCompletionRecords,getSibling:g.getSibling,getPrevSibling:g.getPrevSibling,getNextSibling:g.getNextSibling,getAllNextSiblings:g.getAllNextSiblings,getAllPrevSiblings:g.getAllPrevSiblings,get:g.get,getAssignmentIdentifiers:g.getAssignmentIdentifiers,getBindingIdentifiers:g.getBindingIdentifiers,getOuterBindingIdentifiers:g.getOuterBindingIdentifiers,getBindingIdentifierPaths:g.getBindingIdentifierPaths,getOuterBindingIdentifierPaths:g.getOuterBindingIdentifierPaths,shareCommentsWithSiblings:S.shareCommentsWithSiblings,addComment:S.addComment,addComments:S.addComments};Object.assign(P.prototype,v),P.prototype.arrowFunctionToShadowed=d[String("arrowFunctionToShadowed")],Object.assign(P.prototype,{has:h[String("has")],is:h[String("is")],isnt:h[String("isnt")],equals:h[String("equals")],hoist:T[String("hoist")],updateSiblingKeys:T.updateSiblingKeys,call:m.call,isBlacklisted:m[String("isBlacklisted")],setScope:m.setScope,resync:m.resync,popContext:m.popContext,pushContext:m.pushContext,setup:m.setup,setKey:m.setKey}),P.prototype._guessExecutionStatusRelativeToDifferentFunctions=h._guessExecutionStatusRelativeTo,P.prototype._guessExecutionStatusRelativeToDifferentFunctions=h._guessExecutionStatusRelativeTo,Object.assign(P.prototype,{_getTypeAnnotation:c._getTypeAnnotation,_replaceWith:p._replaceWith,_resolve:h._resolve,_call:m._call,_resyncParent:m._resyncParent,_resyncKey:m._resyncKey,_resyncList:m._resyncList,_resyncRemoved:m._resyncRemoved,_getQueueContexts:m._getQueueContexts,_removeFromScope:y._removeFromScope,_callRemovalHooks:y._callRemovalHooks,_remove:y._remove,_markRemoved:y._markRemoved,_assertUnremoved:y._assertUnremoved,_containerInsert:T._containerInsert,_containerInsertBefore:T._containerInsertBefore,_containerInsertAfter:T._containerInsertAfter,_verifyNodeList:T._verifyNodeList,_getKey:g._getKey,_getPattern:g._getPattern});for(const e of s.TYPES){const t=`is${e}`,n=s[t];P.prototype[t]=function(e){return n(this.node,e)},P.prototype[`assert${e}`]=function(t){if(!n(this.node,t))throw new TypeError(`Expected node path of type ${e}`)}}Object.assign(P.prototype,x);for(const t of Object.keys(e))"_"!==t[0]&&(s.TYPES.includes(t)||s.TYPES.push(t));return ri}function Oo(){if(wo)return ti;wo=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.traverseNode=function(t,r,i,s,a,o,l){const c=n[t.type];if(!c)return!1;const p=new e.default(i,r,s,a);if(l)return(null==o||!o[a.parentKey])&&p.visitQueue([a]);for(const e of c)if((null==o||!o[e])&&p.visit(t,e))return!0;return!1};var e=function(){if(Co)return ni;Co=1,Object.defineProperty(ni,"__esModule",{value:!0}),ni.default=void 0;var e=ko(),t=zr(),n=_o();const{VISITOR_KEYS:r}=t;return ni.default=class{constructor(e,t,n,r){this.queue=null,this.priorityQueue=null,this.parentPath=r,this.scope=e,this.state=n,this.opts=t}shouldVisit(e){const t=this.opts;if(t.enter||t.exit)return!0;if(t[e.type])return!0;const n=r[e.type];if(null==n||!n.length)return!1;for(const t of n)if(e[t])return!0;return!1}create(t,n,r,i){return e.default.get({parentPath:this.parentPath,parent:t,container:n,key:r,listKey:i})}maybeQueue(e,t){this.queue&&(t?this.queue.push(e):this.priorityQueue.push(e))}visitMultiple(e,t,n){if(0===e.length)return!1;const r=[];for(let i=0;i<e.length;i++){const s=e[i];s&&this.shouldVisit(s)&&r.push(this.create(t,e,i,n))}return this.visitQueue(r)}visitSingle(e,t){return!!this.shouldVisit(e[t])&&this.visitQueue([this.create(e,e,t)])}visitQueue(e){this.queue=e,this.priorityQueue=[];const t=new WeakSet;let r=!1,i=0;for(;i<e.length;){const s=e[i];if(i++,n.resync.call(s),0!==s.contexts.length&&s.contexts[s.contexts.length-1]===this||n.pushContext.call(s,this),null===s.key)continue;const{node:a}=s;if(!t.has(a)){if(a&&t.add(a),s.visit()){r=!0;break}if(this.priorityQueue.length&&(r=this.visitQueue(this.priorityQueue),this.priorityQueue=[],this.queue=e,r))break}}for(let t=0;t<i;t++)n.popContext.call(e[t]);return this.queue=null,r}visit(e,t){const n=e[t];return!!n&&(Array.isArray(n)?this.visitMultiple(n,e,t):this.visitSingle(e,t))}},ni}();ko();var t=zr();_o();const{VISITOR_KEYS:n}=t;return ti}function _o(){if(Io)return ei;Io=1,Object.defineProperty(ei,"__esModule",{value:!0}),ei._call=s,ei._getQueueContexts=function(){let e=this,t=this.contexts;for(;!t.length&&(e=e.parentPath,e);)t=e.contexts;return t},ei._resyncKey=p,ei._resyncList=u,ei._resyncParent=c,ei._resyncRemoved=function(){null!=this.key&&this.container&&this.container[this.key]===this.node||n._markRemoved.call(this)},ei.call=i,ei.isDenylisted=a,ei.popContext=function(){this.contexts.pop(),this.contexts.length>0?this.setContext(this.contexts[this.contexts.length-1]):this.setContext(void 0)},ei.pushContext=function(e){this.contexts.push(e),this.setContext(e)},ei.requeue=function(e=this){if(e.removed)return;const t=this.contexts;for(const n of t)n.maybeQueue(e)},ei.requeueComputedKeyAndDecorators=function(){const{context:e,node:t}=this;!r.isPrivate(t)&&t.computed&&e.maybeQueue(this.get("key"));if(t.decorators)for(const t of this.get("decorators"))e.maybeQueue(t)},ei.resync=function(){if(this.removed)return;c.call(this),u.call(this),p.call(this)},ei.setContext=function(e){null!=this.skipKeys&&(this.skipKeys={});this._traverseFlags=0,e&&(this.context=e,this.state=e.state,this.opts=e.opts);return l.call(this),this},ei.setKey=d,ei.setScope=l,ei.setup=function(e,t,n,r){this.listKey=n,this.container=t,this.parentPath=e||this.parentPath,d.call(this,r)},ei.skip=function(){this.shouldSkip=!0},ei.skipKey=function(e){null==this.skipKeys&&(this.skipKeys={});this.skipKeys[e]=!0},ei.stop=function(){this._traverseFlags|=t.SHOULD_SKIP|t.SHOULD_STOP},ei.visit=function(){var t,n;if(!this.node)return!1;if(this.isDenylisted())return!1;if(null!=(t=(n=this.opts).shouldSkip)&&t.call(n,this))return!1;const r=this.context;if(this.shouldSkip||i.call(this,"enter"))return this.debug("Skip..."),this.shouldStop;return o(this,r),this.debug("Recursing into..."),this.shouldStop=(0,e.traverseNode)(this.node,this.opts,this.scope,this.state,this,this.skipKeys),o(this,r),i.call(this,"exit"),this.shouldStop};var e=Oo(),t=ko(),n=Da(),r=zr();function i(e){const t=this.opts;return this.debug(e),!(!this.node||!s.call(this,t[e]))||!!this.node&&s.call(this,null==(n=t[this.node.type])?void 0:n[e]);var n}function s(e){if(!e)return!1;for(const t of e){if(!t)continue;const e=this.node;if(!e)return!0;const n=t.call(this.state,this,this.state);if(n&&"object"==typeof n&&"function"==typeof n.then)throw new Error("You appear to be using a plugin with an async traversal visitor, which your current version of Babel does not support. If you're using a published plugin, you may need to upgrade your @babel/core version.");if(n)throw new Error(`Unexpected return value from visitor method ${t}`);if(this.node!==e)return!0;if(this._traverseFlags>0)return!0}return!1}function a(){var e;const t=null!=(e=this.opts.denylist)?e:this.opts.blacklist;return null==t?void 0:t.includes(this.node.type)}function o(e,t){e.context!==t&&(e.context=t,e.state=t.state,e.opts=t.opts)}function l(){var e,t;if(null!=(e=this.opts)&&e.noScope)return;let n,r=this.parentPath;for((("key"===this.key||"decorators"===this.listKey)&&r.isMethod()||"discriminant"===this.key&&r.isSwitchStatement())&&(r=r.parentPath);r&&!n;){var i;if(null!=(i=r.opts)&&i.noScope)return;n=r.scope,r=r.parentPath}this.scope=this.getScope(n),null==(t=this.scope)||t.init()}function c(){this.parentPath&&(this.parent=this.parentPath.node)}function p(){if(this.container&&this.node!==this.container[this.key]){if(Array.isArray(this.container)){for(let e=0;e<this.container.length;e++)if(this.container[e]===this.node)return void d.call(this,e)}else for(const e of Object.keys(this.container))if(this.container[e]===this.node)return void d.call(this,e);this.key=null}}function u(){if(!this.parent||!this.inList)return;const e=this.parent[this.listKey];this.container!==e&&(this.container=e||null)}function d(e){var t;this.key=e,this.node=this.container[this.key],this.type=null==(t=this.node)?void 0:t.type}return ei.isBlacklisted=a,ei}var Do,Lo,Mo={};function Fo(){return Lo||(Lo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Hub",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(e,"NodePath",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return a.default}}),e.visitors=e.default=void 0,_o();var t=Di();e.visitors=t;var n=zr(),r=Ui(),i=Oo(),s=ko(),a=Wi(),o=(Do||(Do=1,Object.defineProperty(Mo,"__esModule",{value:!0}),Mo.default=void 0,Mo.default=class{getCode(){}getScope(){}addHelper(){throw new Error("Helpers are not supported by the default hub.")}buildError(e,t,n=TypeError){return new n(t)}}),Mo);const{VISITOR_KEYS:l,removeProperties:c,traverseFast:p}=n;function u(e,n={},r,s,a,o){if(e){if(!n.noScope&&!r&&"Program"!==e.type&&"File"!==e.type)throw new Error(`You must pass a scope and parentPath unless traversing a Program/File. Instead of that you tried to traverse a ${e.type} node without passing scope and parentPath.`);if(!a&&o)throw new Error("visitSelf can only be used when providing a NodePath.");l[e.type]&&(t.explode(n),(0,i.traverseNode)(e,n,r,s,a,void 0,o))}}e.default=u,u.visitors=t,u.verify=t.verify,u.explode=t.explode,u.cheap=function(e,t){p(e,t)},u.node=function(e,t,n,r,s,a){(0,i.traverseNode)(e,t,n,r,s,a)},u.clearNode=function(e,t){c(e,t)},u.removeProperties=function(e,t){return p(e,u.clearNode,t),e},u.hasType=function(e,t,n){return(null==n||!n.includes(e.type))&&(e.type===t||p(e,function(e){return null!=n&&n.includes(e.type)?p.skip:e.type===t?p.stop:void 0}))},u.cache=r}(Zr)),Zr}var Bo=Y(Fo()),jo=Y(Ka());function Ro(e){return jo.parse(e,{sourceType:"module",plugins:["jsx","typescript","classProperties","dynamicImport","exportDefaultFrom","exportNamespaceFrom","functionBind","nullishCoalescingOperator","objectRestSpread","optionalChaining","decorators-legacy"],allowAwaitOutsideFunction:!0})}const Uo={is:e=>Qr.isStringLiteral(e),get:e=>e.value},Ko={is:e=>Qr.isNumericLiteral(e),get:e=>e.value},Vo={is:e=>Qr.isBooleanLiteral(e),get:e=>e.value},qo={is:e=>Qr.isNullLiteral(e),get:e=>null},Wo={is:e=>Qr.isIdentifier(e)&&"undefined"===e.name,get(e){}},$o={is:e=>Qr.isObjectExpression(e),get:e=>Go(e)},Jo={is:e=>Qr.isClass(e),get:e=>function(e){function t(e){return"static"in e&&!0===e.static}let n=e.body;if(!Qr.isClassBody(n))return;const r={};return n.body.forEach(e=>{if(t(e)&&Qr.isIdentifier(e.key))if(Qr.isMethod(e)||Qr.isTSDeclareMethod(e))r[e.key.name]=()=>{};else{const t=zo.find(t=>t.is(e.value));t&&(r[e.key.name]=t.get(e.value))}}),r}(e)},Yo={is:e=>Qr.isArrayExpression(e),get:e=>Qo(e)},Xo={is:e=>Qr.isFunctionExpression(e),get:e=>function(){}},Ho={is:e=>Qr.isArrowFunctionExpression(e),get:e=>()=>{}},zo=[Uo,Ko,Vo,qo,Wo,$o,Yo,Jo,Xo,Ho];function Go(e){const t={};return e.properties.forEach(e=>{if(Qr.isObjectMember(e)&&Qr.isIdentifier(e.key))if(Qr.isObjectMethod(e))t[e.key.name]=()=>{};else{const n=zo.find(t=>t.is(e.value));n&&(t[e.key.name]=n.get(e.value))}}),t}function Qo(e){const t=[];return e.elements.forEach(e=>{const n=zo.find(t=>t.is(e));n&&t.push(n.get(e))}),t}function Zo(e){const t=Ro(e);let n;return Bo(t,{Program:{enter(e){const t=e.node,r=function(e){for(const t of e.body)if(Qr.isExportDefaultDeclaration(t))return t.declaration;return null}(t);if(r)if(Qr.isIdentifier(r)){const{name:e}=r;n=function(e){const t={};for(const n of e.programNode.body){let r=n;if(Qr.isExpressionStatement(r)&&(r=r.expression),Qr.isAssignmentExpression(r)&&Qr.isMemberExpression(r.left)&&Qr.isIdentifier(r.left.object)&&r.left.object.name===e.name){const e=zo.find(e=>e.is(Qr.isAssignmentExpression(r)&&r.right));e&&(t[r.left.property.name]=e.get(r.right))}}return t}({programNode:t,name:e})}else if(Qr.isObjectExpression(r))n=Go(r);else if(Qr.isArrayExpression(r))n=Qo(r);else{const e=zo.find(e=>e.is(r));e&&(n=e.get(r))}}}}),n}function el(e){return/^\\\\\?\\/.test(e)?e:e.replace(/\\/g,"/")}const tl={javascript:[".ts",".tsx",".js",".jsx"],css:[".less",".sass",".scss",".stylus",".css"]};function nl(e){const t=tl[e.type];for(const r of t){const t=`${e.fileNameWithoutExt}${r}`,i=el(n(e.base,t));if(p(i))return{path:i,filename:t}}return null}const rl=/^\[(.+?)\]/;function il(e){return p(e)?u(e).filter(t=>{const r=n(e,t),i=d(r),s=i.isDirectory(),a=i.isFile();if(s&&["components","component","utils","util"].includes(t))return!1;if("."===t.charAt(0))return!1;if("_"===t.charAt(0))return!1;if(/\.(test|spec|e2e)\.(j|t)sx?$/.test(t))return!1;if(/\.d\.ts$/.test(t))return!1;if(a){if(!/\.(j|t)sx?$/.test(t))return!1;const e=h(r,"utf-8");try{if(!function(e){const t=Ro(e);let n=!1;return Bo(t,{JSXElement(e){n=!0,e.stop()},JSXFragment(e){n=!0,e.stop()}}),n}(e))return!1}catch(e){throw new Error(`Parse conventional route component ${r} failed, ${e.message}`)}}return!0}):[]}function sl(e,t,s){const{root:a,relDir:o=""}=e,l=n(a,o,s),c=d(l),p=rl.test(s);if(c.isDirectory()){const r=n(o,s),i=nl({base:n(a,r),fileNameWithoutExt:"_layout",type:"javascript"}),l={path:ol(r),routes:ll({...e,relDir:n(r)}),__isDynamic:p,...i?{component:i.path}:{exact:!0,__toMerge:!0}};t.push(al(l,e))}else{const a=r(s,i(s));t.push(al({path:ol(n(o,a)),exact:!0,component:l,__isDynamic:p},e))}return t}function al(e,t){let r;if(e.component){try{r=Zo(h(e.component,"utf-8"))}catch(t){throw new Error(`Parse conventional route component ${e.component} failed, ${t.message}`)}e.component=el(s(n(t.root,".."),e.component)),e.component=`${t.componentPrefix||"@/"}${e.component}`}return{...e,..."object"==typeof r?r:{}}}function ol(e,t){return"/index/index"===(e=`/${e=el(e).split("/").map(e=>((e=e.replace(rl,":$1")).endsWith("$")&&(e=e.slice(0,-1)+"?"),e)).join("/")}`)&&(e="/"),"/"!==(e=e.replace(/\/index$/,"/"))&&"/"===e.slice(-1)&&(e=e.slice(0,-1)),e}function ll(e){const{root:t,relDir:r="",config:i}=e,s=function(e){const t=[],n=[],r=[];return e.forEach(e=>{const{__isDynamic:i,exact:s}=e;delete e.__isDynamic,i?t.push(e):s?n.push(e):r.push(e)}),x(t.length<=1,"We should not have multiple dynamic routes under a directory."),[...n,...r,...t].reduce((e,t)=>(t.__toMerge&&t.routes?e=e.concat(t.routes):e.push(t),e),[])}(il(n(t,r)).reduce(sl.bind(null,e),[]));if(!r){const n=nl({base:t,fileNameWithoutExt:`../${i.singular?"layout":"layouts"}/index`,type:"javascript"});if(n)return[al({path:"/",component:n.path,routes:s},e)]}return s}function cl(t){const n=e.extname(t);if(![".tsx",".ts",".jsx",".js"].includes(n))return!1;try{const e=l.readFileSync(t,"utf-8");return/export\s+default/.test(e)}catch{return!1}}function pl(e){const t={path:e.path||""};if(void 0!==e.exact&&(t.exact=e.exact),e.component){const n=e.component.replace(/\.(tsx|ts|jsx|js)$/,"");t.component=`dynamic({ loader: () => import('${n}'), loading: LoadingComponent})`}return e.title&&"string"==typeof e.title&&(t.title=`$t({ defaultMessage: "${e.title}" })`),!0===e.keepAlive&&(t.keepAlive=!0),e.authority&&Array.isArray(e.authority)&&(t.authority=e.authority),e.routes&&e.routes.length>0&&(t.routes=e.routes.map(pl)),t}function ul(e,t){return ll({root:e,componentPrefix:t.pageAliasPrefix,config:{singular:!1}}).map(pl)}async function dl(t,n){function r(e,t=2){const n=" ".repeat(t),i=" ".repeat(t+2);let s=`${n}{\n`;if(s+=`${i}path: '${e.path}',\n`,void 0!==e.exact&&null!==e.exact&&(s+=`${i}exact: ${e.exact},\n`),void 0!==e.component&&null!==e.component&&(s+=`${i}component: ${e.component},\n`),void 0!==e.title&&null!==e.title&&(s+=`${i}title: ${e.title},\n`),e.authority&&(s+=`${i}authority: ${JSON.stringify(e.authority)},\n`),e.keepAlive&&(s+=`${i}keepAlive: ${e.keepAlive},\n`),e.routes&&e.routes.length>0){s+=`${i}routes: [\n${e.routes.map(e=>r(e,t+2)).join(",\n")}\n${i}],\n`}return s=s.replace(/,\n$/,"\n"),s+=`${n}}`,s}const i=t.map(e=>r(e)).join(",\n"),s=`\n/* eslint-disable */\n// @ts-nocheck\n/**\n * 自动根据 pages 目录生成路由配置\n * 新增、删除、修改组件 title、keepAlive、authority 属性时,会自动更新路由配置\n * 路由组件只支持默认导出\n */\nimport { dynamic } from '@lemon-fe/vite-plugin-micro-frontend/runtime/dynamic';\nimport LoadingComponent from '${n.defaultLoadingComponentPath||"@/components/loading"}';\nimport { $t } from '${n.intlPath||"@/utils/intl"}';\n\nexport const routers = [\n${i}\n];\n`;try{const t=e.resolve(process.cwd(),".prettierrc");let n={};if(l.existsSync(t))try{const e=l.readFileSync(t,"utf-8");n=JSON.parse(e)}catch(e){console.warn("⚠️ 读取 prettier 配置失败,使用默认配置:",e)}const r={parser:"typescript",...n};return await y.format(s,r)}catch(e){return console.error("格式化代码失败:",e),s}}async function hl(t={}){const{pagesDir:n,outputPath:r,routeTemplate:i={}}=t,s=n||e.resolve(process.cwd(),"src/pages"),a=r||e.resolve(process.cwd(),"src/routes.ts");if(!l.existsSync(s))return void console.warn("⚠️ pages 目录不存在:",s);const o=ul(s,i),c=await dl(o,i);l.writeFileSync(a,c),console.log("✅ 路由已生成:",a)}function fl(t={}){const{pagesDir:n,outputPath:r,watch:i=!0,ignoreDirs:s=["components","utils","hooks","typings"],routeTemplate:a={}}=t;let o=!1,c=null,p=!1,u="";const d=n||e.resolve(process.cwd(),"src/pages"),h=r||e.resolve(process.cwd(),"src/routes.ts"),f=async()=>{if(!l.existsSync(d))return void console.warn("⚠️ pages 目录不存在:",d);const e=ul(d,a),t=await dl(e,a);t!==u&&(u=t,l.writeFileSync(h,t),console.log("✅ 路由已生成:",h))},y=()=>{c&&(c.close(),c=null,o=!1)};return{name:"micro-frontend:routes",enforce:"pre",configureServer(e){p||(f(),p=!0),(()=>{if(o||!i)return;if(!l.existsSync(d))return;const e=["**/node_modules/**","**/*.d.ts","**/*.less","**/*.css","**/*.scss","**/*.sass",h,...s.map(e=>`**/${e}/**`)];c=m.watch(d,{ignored:e,persistent:!0,ignoreInitial:!0}),c.on("add",e=>{cl(e)&&f()}).on("unlink",e=>{cl(e)&&f()}).on("addDir",e=>{f()}).on("unlinkDir",e=>{f()}).on("error",e=>{console.error("❌ 文件监听错误:",e)}),o=!0})(),e.httpServer?.on("close",y)},buildStart(){p||(f(),p=!0)}}}function ml(t){const{remotes:n,outputPath:r}=t,i=r||e.resolve(process.cwd(),"src/utils/mf.tsx"),s=function(e){const t=function(e){return e.reduce((e,t)=>(e[t.aliasName||t.remoteName]=t,e),{})}(e),n=JSON.stringify(t,null,2);return"/* eslint-disable */\nimport { lazy, Suspense, type ReactNode, type ComponentType } from 'react';\n\n// 远程模块配置\nconst remotes = __REMOTES_JSON__ as const;\n\ntype RemoteAlias = keyof typeof remotes;\ntype ModuleSpecifier = `${RemoteAlias}/${string}`;\n\n// 多个入口文件之间共享的变量\nconst entryShared = (window as any).__entry_shared__ || {};\n\n// 脚本加载状态: undefined=未加载, Promise=加载中, true=已完成\nconst scriptCache: Record<string, Promise<void> | true | undefined> = {};\n\n/**\n * [MF-MIGRATION] 以下为修复「关沙箱子应用覆盖 window[remoteName] 后 container.get 丢失」的新增状态:\n * - remoteContainerCache:在宿主内持久保存联邦容器引用,不依赖 window 上的全局名。\n * - esModuleImportUrl:ESM 远程首次 dynamic import 的完整路径(含 query),重试时复用同一 URL,避免 ?t= 变化导致重复实例化 remote。\n */\nconst remoteContainerCache: Record<string, unknown> = {};\nconst esModuleImportUrl: Record<string, string> = {};\n\n/**\n * 获取多入口共享变量(懒初始化单例)\n */\nexport function getEntryShared<T>(key: string, init: () => T): T {\n return (entryShared[key] ??= init()) as T;\n}\n\nfunction createVersionedUrl(rawUrl: string): string {\n const target = new URL(rawUrl, window.location.origin);\n target.searchParams.set(\"t\", String(Date.now()));\n return target.href;\n}\n\n/**\n * 安全加载远程组件\n */\nexport function safeRemoteComponent<T extends ComponentType<any>>(opts: {\n moduleSpecifier: ModuleSpecifier;\n fallbackComponent: T;\n loadingElement?: ReactNode;\n}): T {\n const LazyComponent = lazy<T>(() =>\n loadRemoteModule(opts.moduleSpecifier, { default: opts.fallbackComponent }),\n );\n\n return ((props: any) => (\n <Suspense fallback={opts.loadingElement ?? null}>\n <LazyComponent {...props} />\n </Suspense>\n )) as T;\n}\n\n// ============ 内部实现 ============\n\n/** [MF-MIGRATION] 优先使用缓存的容器,避免子应用污染 window 后读错对象。 */\nfunction pickFederationContainer(remoteName: string): { get: (s: string) => Promise<() => unknown> } | null {\n const cached = remoteContainerCache[remoteName];\n if (cached && typeof (cached as { get?: unknown }).get === 'function') {\n return cached as { get: (s: string) => Promise<() => unknown> };\n }\n const fromWindow = (window as any)[remoteName];\n if (fromWindow && typeof fromWindow.get === 'function') {\n remoteContainerCache[remoteName] = fromWindow;\n return fromWindow;\n }\n return null;\n}\n\n/** [MF-MIGRATION] 首次成功解析到的容器写入缓存,供后续路由切换后仍使用同一引用。 */\nfunction rememberFederationContainer(remoteName: string, container: unknown) {\n if (container && typeof (container as { get?: unknown }).get === 'function') {\n remoteContainerCache[remoteName] = container;\n }\n}\n\nasync function loadRemoteModule<T>(specifier: ModuleSpecifier, fallback: T): Promise<T> {\n try {\n const slashIndex = specifier.indexOf('/');\n const alias = specifier.slice(0, slashIndex) as RemoteAlias;\n const moduleName = specifier.slice(slashIndex + 1);\n const remote = remotes[alias];\n\n if (!remote) {\n console.error(`[MF] Unknown remote alias: \"${alias}\"`);\n return fallback;\n }\n\n // Some remotes may not have isESModule property, default to false if missing\n const isESModule = (remote as any).isESModule ?? false;\n\n // [MF-MIGRATION] 先正常加载;若 window 已被其它子应用占用且缓存仍空,再清 script 状态重试一次。\n await loadScriptOnce(remote.remoteName, remote.entry, isESModule);\n let container = pickFederationContainer(remote.remoteName);\n if (!container) {\n scriptCache[remote.remoteName] = undefined;\n delete remoteContainerCache[remote.remoteName];\n await loadScriptOnce(remote.remoteName, remote.entry, isESModule);\n container = pickFederationContainer(remote.remoteName);\n }\n\n if (!container) {\n console.error(\n `[MF] Container \"${remote.remoteName}\" not found or invalid (expected get() on window or cache)`,\n );\n return fallback;\n }\n\n // 对于 ES Module 联邦,需要先调用 init 初始化共享模块\n // if (isESModule && typeof container.init === 'function') {\n // // 初始化共享作用域(如果还没有初始化过)\n // const shareScope = (window as any).__federation_shared__ || {};\n // (window as any).__federation_shared__ = shareScope;\n // await container.init(shareScope);\n // }\n\n const factory = await container.get(`./${moduleName}`);\n const module = factory();\n\n // 确保返回 { default: Component } 格式给 React.lazy\n if (module && typeof module === 'object' && 'default' in module) {\n return module as T;\n }\n\n // 如果模块本身就是组件,包装成 { default: Component }\n return { default: module } as T;\n } catch (e) {\n console.error('[MF] Load remote module failed:', e);\n return fallback;\n }\n}\n\nasync function loadScriptOnce(name: string, url: string, isESModule?: boolean): Promise<void> {\n const cached = scriptCache[name];\n\n if (cached === true) return;\n if (cached) return cached;\n\n const promise = (async () => {\n\n // ES Module 格式\n if (isESModule) {\n try {\n // [MF-MIGRATION] 首次生成带 ?t= 的 URL 并记住;重试 load 时复用,避免 duplicate remote runtime。\n const fullUrl = esModuleImportUrl[name] ?? createVersionedUrl(url);\n if (!esModuleImportUrl[name]) {\n esModuleImportUrl[name] = fullUrl;\n }\n \n\n\n const module = await import(/* @vite-ignore */ `${fullUrl}`);\n\n // Vite Module Federation 通常直接导出 get/init,而不是 default\n const container = module.default || module;\n\n // 验证容器是否有效\n if (typeof container.get !== 'function') {\n console.error('[MF] Invalid container: missing get() method', container);\n throw new Error(`Container \"${name}\" has no get() method`);\n }\n\n (window as any)[name] = container;\n // [MF-MIGRATION] 与 window 同步写入缓存,后续以缓存为准。\n rememberFederationContainer(name, container);\n return;\n } catch (e) {\n console.warn(`[MF] ES Module load failed for \"${name}\", falling back to UMD:`, e);\n }\n }\n\n // UMD 格式(isESModule 为 false,或 ESM 加载失败后自动降级)\n const fullUrl = `${url}?t=${Date.now()}`;\n await new Promise<void>((resolve, reject) => {\n const script = document.createElement('script');\n script.src = fullUrl;\n script.async = true;\n script.onload = () => resolve();\n script.onerror = reject;\n document.head.appendChild(script);\n });\n\n // [MF-MIGRATION] UMD 由脚本挂到 window,加载完成后抽一次有效容器进缓存。\n rememberFederationContainer(name, (window as any)[name]);\n })().then(\n () => {\n scriptCache[name] = true;\n },\n e => {\n scriptCache[name] = undefined;\n throw e;\n },\n );\n\n scriptCache[name] = promise;\n return promise;\n}\n".replace("__REMOTES_JSON__",n)}(n),a=e.dirname(i);if(l.existsSync(a)||l.mkdirSync(a,{recursive:!0}),l.existsSync(i)){if(l.readFileSync(i,"utf-8")===s)return}l.writeFileSync(i,s),console.log("✅ mf.tsx 已生成:",i)}function yl(e){return{name:"micro-frontend:mf-generator",enforce:"pre",configResolved(){ml(e)},buildStart(){ml(e)}}}const Tl=f(import.meta.url);let gl={};try{const e=Tl.resolve("@module-federation/dts-plugin/dynamic-remote-type-hints-plugin");gl["@module-federation/dts-plugin/dynamic-remote-type-hints-plugin"]=e}catch{}function Sl(e){return e.replace(/\\/g,"/")}function xl(t){const n=function(t){const n={},r=[".tsx",".ts"];if(!l.existsSync(t))return n;const i=l.readdirSync(t,{withFileTypes:!0});for(const s of i)if(s.isDirectory()){const r=e.join(t,s.name),i=["index.tsx","index.ts"];let a=null;for(const t of i){const n=e.join(r,t);if(l.existsSync(n)){a=n;break}}if(a){const t=Sl(e.relative(process.cwd(),a));n[`./${s.name}`]=`./${t}`}else console.warn(`⚠️ ${s.name} 目录下没有找到入口文件,已忽略`)}else{const i=e.extname(s.name);if(r.includes(i)){const r=e.join(t,s.name),a=Sl(e.relative(process.cwd(),r));n[`./${e.basename(s.name,i)}`]=`./${a}`}}return n}(e.resolve(process.cwd(),t.exposesDir??"src/exposes"));return{...n,...t.exposes||{}}}function bl(t){const n={dts:!1,...t},r=[];r.push(0===Object.keys(gl).length?{name:"mf-dts-plugin-alias",config:()=>({})}:{name:"mf-dts-plugin-alias",enforce:"pre",config:()=>({resolve:{alias:gl}})});const i=function(e,t,n){if(!e||0===e.length)return;const r={};for(const i of e){const{aliasName:e,remoteName:s,entry:a,isESModule:o}=i,l=e||s,c=a.startsWith("/")?a:`/${a}`;let p;p=a.startsWith("http")?a:t?new URL(c,`${t.replace(/\/$/,"")}/`).href:c,r[l]={type:o?"module":"var",name:l,entry:p,entryGlobalName:s,shareScope:n||"default"}}return r}(n.remotes,n.devHost,n.shareScope),s=xl(n);return r.push(b({filename:n.filename||"remote.js",hostInitInjectLocation:n.hostInitInjectLocation||"entry",...n,remotes:i,exposes:s})),r.push(yl({remotes:n.remotes??[],outputPath:n.outputPath?e.resolve(process.cwd(),n.outputPath):"src/utils/mf.tsx"})),r}function El(e){return e&&"/"!==e?e.replace(/^\/+|\/+$/g,""):""}function Pl(e,t,n){if(!t||!n)return e;const r=function(e){const t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`import\\((['"])\\/${t}\\/([^'"]+)\\1\\)`,"g")}(t);return e.replace(r,`import(${n} + '/$2')`)}function vl(e,t){if("boolean"==typeof t&&!t)return"";const n="boolean"==typeof t?{}:t;if(n.publicPath?.trim())return n.publicPath.trim();const r=function(e,t){const n="boolean"==typeof t?{}:t;if(n.appBase?.trim())return n.appBase.trim().replace(/^\/+|\/+$/g,"");const r=El(e.base);return r&&"__dynamic_base__"!==r?r:""}(e,t),i=r?`/${r}`:e.base??"/";return`(window.EARTH_BASE_CONFIG && window.EARTH_BASE_CONFIG.EARTH_ALL_SHARE_HOST ? window.EARTH_BASE_CONFIG.EARTH_ALL_SHARE_HOST.replace(/\\/$/, '') : '') + ${JSON.stringify(i)}`}function Al(e,t,n){if(e)return"function"==typeof e?e.apply(t,n):e.handler.apply(t,n)}function Cl(e,t){let n;const{transformIndexHtml:r=!0,transformIndexHtmlConfig:i}=e;return{name:"micro-frontend:dynamic-base-deferred",enforce:"post",apply:"build",configResolved:e=>(n=E({publicPath:t(),transformIndexHtml:r,transformIndexHtmlConfig:i}),Al(n.configResolved,n,[e])),generateBundle(e,t,r){if(n?.generateBundle)return Al(n.generateBundle,n,[e,t,r])}}}function wl(e,t,n){const{transformIndexHtml:r=!0,removeIndexCssPreload:i=!1}=e,s=[];if(r){const e=e=>Pl(e,n(),t());s.push({name:"micro-frontend:rewrite-inline-dynamic-base-import",enforce:"post",apply:"build",transformIndexHtml:{order:"post",handler:t=>e(t)},generateBundle(t,n){for(const t of Object.values(n))"asset"===t.type&&t.fileName.endsWith(".html")&&"string"==typeof t.source&&(t.source=e(t.source))}})}return i&&s.push({name:"micro-frontend:remove-index-css-preload",enforce:"post",apply:"build",transformIndexHtml(e){let t=e.replace(/<link[^>]*rel=["']stylesheet["'][^>]*href=["']\/?index-[^"']+\.css["'][^>]*>/gi,"");return t=t.replace(/,\{"parentTagName":"head","tagName":"link","attrs":\{"rel":"stylesheet","crossorigin":"","href":"\/index-[^"]+\.css"\}\}/g,""),t}}),s}function Il(e){const t={publicPath:"",appBasePath:""},n=function(e){return"boolean"==typeof e?{}:e}(e),r=()=>t.publicPath;return[{name:"micro-frontend:dynamic-base-init",enforce:"pre",apply:"build",config(n,r){t.publicPath=vl(n,e),t.appBasePath=El(n.base)}},Cl(n,r),...wl(n,r,()=>t.appBasePath)]}const Nl=P(import.meta.url);function kl(){let e="";return{name:"micro-frontend:antd-external",enforce:"pre",config(n,r){const i=Nl.resolve("antd/es/index.js"),s=c.readFileSync(i,"utf-8"),a=new Set,o=/export\s*\{\s*default\s+as\s+(\w+)\s*\}/g;let l;for(;l=o.exec(s);)a.add(l[1]);const p=/export\s+var\s+(\w+)\s*=/g;for(;l=p.exec(s);)a.add(l[1]);const u=`/**\n * 自动生成的 antd 代理文件\n * 由 autoExternalAntd 插件生成,请勿手动修改\n */\nconst antd = (window as any).antd;\n\n${[...a].map(e=>`export const ${e} = antd.${e};`).join("\n")}\n\nexport default antd;\n`;e=t.resolve(process.cwd(),"src/.external/antd.ts"),c.mkdirSync(t.dirname(e),{recursive:!0}),c.writeFileSync(e,u);const d=n.resolve?.alias,h=Array.isArray(d)?d:d?Object.entries(d).map(([e,t])=>({find:e,replacement:t})):[];return{resolve:{alias:[...h,{find:/^antd$/,replacement:e}]}}}}}const Ol={pagesDir:"src/pages",outputPath:"src/routes.ts",watch:!0,ignoreDirs:["components","utils","hooks","typings"],routeTemplate:{defaultLoadingComponentPath:"@/components/loading",intlPath:"@/utils/intl"}},_l="__microFrontendOptions";function Dl(t){const{appName:n,federation:r,routes:i,htmlTransform:s=!0,qiankun:o,dynamicBase:l}=t,c=[];if(c.push({name:"micro-frontend:options",[_l]:t}),s){const e="object"==typeof s?s:{};c.push($(e))}const p="object"==typeof i?Object.assign(Ol,i):Ol;if(c.push(fl({pagesDir:p.pagesDir?e.resolve(process.cwd(),p.pagesDir):void 0,outputPath:p.outputPath?e.resolve(process.cwd(),p.outputPath):void 0,watch:p.watch,ignoreDirs:p.ignoreDirs,routeTemplate:p.routeTemplate})),!1!==o?.enabled){const e=o?.name||n,t="development"===process.env.NODE_ENV;c.push(a(e,{useDevMode:t}))}return r&&(c.push(...bl(r)),c.push(j({relativeCSSInjection:!0}))),l&&c.push(...Il(l)),c}export{_l as MICRO_FRONTEND_OPTIONS_KEY,kl as autoExternalAntd,j as cssInjectedByJsPlugin,$ as devHmrPlugin,bl as federationPlugin,ml as generateMf,hl as generateRoutesToFile,Il as getDynamicBasePlugins,ll as getRoutes,yl as mfGeneratorPlugin,Dl as microFrontendPlugins,fl as pagesRoutesPlugin};
|
|
14
14
|
//# sourceMappingURL=index.js.map
|