@doracli/helper 0.0.5 → 0.0.8

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/lib/cjs/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";var t=require("@dorabag/file-pro"),n=require("picocolors"),e=require("@dorabag/config-loader"),r=require("@cclr/lang"),o=require("path"),i=require("@cclr/utils"),a=require("fs"),c=require("fs/promises");function u(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}function s(t,n,e,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?n(u):Promise.resolve(u).then(r,o)}function l(t){return function(){var n=this,e=arguments;return new Promise(function(r,o){var i=t.apply(n,e);function a(t){s(i,r,o,a,c,"next",t)}function c(t){s(i,r,o,a,c,"throw",t)}a(void 0)})}}function f(t,n,e){return n=v(n),function(t,n){if(n&&("object"==typeof n||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,y()?Reflect.construct(n,[],v(t).constructor):n.apply(t,e))}function p(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function d(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,S(r.key),r)}}function h(t,n,e){return n&&d(t.prototype,n),e&&d(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function g(t,n,e){return(n=S(n))in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}function y(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(y=function(){return!!t})()}function m(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),e.push.apply(e,r)}return e}function b(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?m(Object(e),!0).forEach(function(n){g(t,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):m(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function C(t,n){if(null==t)return{};var e,r,o=function(t,n){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==n.indexOf(r))continue;e[r]=t[r]}return e}(t,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)e=i[r],-1===n.indexOf(e)&&{}.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}function w(){
2
2
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
3
- var t,n,e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,r,o,i){var u=r&&r.prototype instanceof c?r:c,s=Object.create(u.prototype);return k(s,"_invoke",function(e,r,o){var i,c,u,s=0,l=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(n,e){return i=n,c=0,u=t,p.n=e,a}};function d(e,r){for(c=e,u=r,n=0;!f&&s&&!o&&n<l.length;n++){var o,i=l[n],d=p.p,h=i[2];e>3?(o=h===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=e<2&&d<i[1])?(c=0,p.v=r,p.n=i[1]):d<h&&(o=e<3||i[0]>r||r>h)&&(i[4]=e,i[5]=r,p.n=h,c=0))}if(o||e>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,h),c=l,u=h;(n=c<2?t:u)||!f;){i||(c?c<3?(c>1&&(p.n=-1),d(c,u)):p.n=u:p.v=u);try{if(s=2,i){if(c||(o="next"),n=i[o]){if(!(n=n.call(i,u)))throw TypeError("iterator result is not an object");if(!n.done)return n;u=n.value,c<2&&(c=0)}else 1===c&&(n=i.return)&&n.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=t}else if((n=(f=p.n<0)?u:e.call(r,p))!==a)break}catch(n){i=t,c=1,u=n}finally{s=1}}return{value:n,done:f}}}(e,o,i),!0),s}var a={};function c(){}function u(){}function s(){}n=Object.getPrototypeOf;var l=[][r]?n(n([][r]())):(k(n={},r,function(){return this}),n),f=s.prototype=c.prototype=Object.create(l);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,k(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=s,k(f,"constructor",s),k(s,"constructor",u),u.displayName="GeneratorFunction",k(s,o,"GeneratorFunction"),k(f),k(f,o,"Generator"),k(f,r,function(){return this}),k(f,"toString",function(){return"[object Generator]"}),(w=function(){return{w:i,m:p}})()}function k(t,n,e,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}k=function(t,n,e,r){function i(n,e){k(t,n,function(t){return this._invoke(n,e,t)})}n?o?o(t,n,{value:e,enumerable:!r,configurable:!r,writable:!r}):t[n]=e:(i("next",0),i("throw",1),i("return",2))},k(t,n,e,r)}function x(t,n){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},x(t,n)}function j(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var r,o,i,a,c=[],u=!0,s=!1;try{if(i=(e=e.call(t)).next,0===n);else for(;!(u=(r=i.call(e)).done)&&(c.push(r.value),c.length!==n);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(t,n)||P(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(t){return function(t){if(Array.isArray(t))return u(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||P(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(t){var n=function(t,n){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,n);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==typeof n?n:n+""}function P(t,n){if(t){if("string"==typeof t)return u(t,n);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?u(t,n):void 0}}var D=function(){function t(){p(this,t),g(this,"tsConfig",{}),g(this,"doraConfig",{}),g(this,"packageConfig",{}),g(this,"cdnConfig",{}),g(this,"cmd",{}),g(this,"workRoot","./")}return h(t,[{key:"setCmd",value:function(t){this.cmd=t}},{key:"getCmd",value:function(){return this.cmd}},{key:"setWorkRoot",value:function(t){this.workRoot=t}},{key:"getWorkRoot",value:function(){return this.workRoot}},{key:"setTsConfig",value:function(t){this.tsConfig=t}},{key:"getTsConfig",value:function(){return this.tsConfig}},{key:"setDoraConfig",value:function(t){this.doraConfig=t}},{key:"getDoraConfig",value:function(){return this.doraConfig}},{key:"setCdnConfig",value:function(t){this.cdnConfig=t}},{key:"getCdnConfig",value:function(){return this.cdnConfig}},{key:"setPackageConfig",value:function(t){this.packageConfig=t}},{key:"getPackageConfig",value:function(){return this.packageConfig}},{key:"copy",value:function(){var n=new t;return n.setWorkRoot(this.getWorkRoot()),n.setTsConfig(this.getTsConfig()),n.setDoraConfig(this.getDoraConfig()),n.setPackageConfig(this.getPackageConfig()),n.setCdnConfig(this.getCdnConfig()),n.setCmd(this.getCmd()),n}}])}(),T="@doracli",A=10,E=function(t,n){return t.length>=n?t:t+" ".repeat(n-t.length)},F=function(t){return E(t,5)},L=function(t){return E(t,9).toUpperCase()},H=function(t,e){var r;if(!(A>0)){for(var o=n.bgBlack("[".concat(n.magenta(T),":").concat(n.bold(" ".concat(F(t))),"]")),i=arguments.length,a=new Array(i>2?i-2:0),c=2;c<i;c++)a[c-2]=arguments[c];return(r=console).debug.apply(r,["".concat(o," [").concat(L(e),"]")].concat(a))}},M=function(t,e){var r;if(!(A>10)){for(var o=n.bgBlack("[".concat(n.magenta(T),":").concat(n.bold(" ".concat(F(t))),"]")),i=arguments.length,a=new Array(i>2?i-2:0),c=2;c<i;c++)a[c-2]=arguments[c];return(r=console).log.apply(r,["".concat(o," [").concat(n.yellow(L(e)),"]")].concat(a))}},R=function(t,e){var r;if(!(A>100)){for(var o=n.bgBlack("[".concat(n.magenta(T),":").concat(n.bold(" ".concat(F(t))),"]")),i=arguments.length,a=new Array(i>2?i-2:0),c=2;c<i;c++)a[c-2]=arguments[c];return(r=console).log.apply(r,["".concat(o," [").concat(n.green(L(e)),"]")].concat(a))}},B=function(t,e){var r;if(!(A>1e3)){for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];return(r=console).log.apply(r,[n.bgYellow("[".concat(T,": ").concat(F(t),"] [").concat(L(e),"]"))].concat(i))}},N=function(t,e){var r;if(!(A>1e4)){for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];return(r=console).log.apply(r,[n.bgRed("[".concat(T,": ").concat(F(t),"] [").concat(L(e),"]"))].concat(i))}},W=0,U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"cLogTimeStart-".concat(W);return W++,console.time(t),function(){console.timeEnd(t)}},I=function(t){console.timeEnd(t)},_={log:M,debug:H,error:N,warn:B,info:R,time:U,timeEnd:I},z=function(){var n=l(w().m(function n(e){var r,o,i,a;return w().w(function(n){for(;;)switch(n.p=n.n){case 0:if(r=e.getDoraConfig(),o=r.clear,i=r.output,a=(i||{}).path,n.p=1,o){n.n=2;break}return n.a(2);case 2:if(a){n.n=3;break}return n.a(2);case 3:return n.n=4,t.isValidDir(a);case 4:if(n.v){n.n=5;break}return n.a(2);case 5:return n.n=6,t.cleanTargets(a);case 6:n.n=8;break;case 7:n.p=7,n.v,_.warn("clear","warn","清空目标文件夹失败: ".concat(a));case 8:return n.a(2)}},n,null,[[1,7]])}));return function(t){return n.apply(this,arguments)}}(),q=function(){var n=l(w().m(function n(r){var o,i;return w().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,e.loadConfigFuzzyExt("doracli.config",{rootDir:t.resolveCwd(r)});case 1:if(o=n.v){n.n=2;break}return _.warn("file","undefined","未定义 doracli 配置文件"),n.a(2,null);case 2:return _.debug("file","success","引入 doracli 配置文件成功"),n.a(2,o.default||o);case 3:return n.p=3,i=n.v,_.error("file","fail","引入 doracli 配置文件失败"),console.error(i),n.a(2,Promise.reject(i))}},n,null,[[0,3]])}));return function(t){return n.apply(this,arguments)}}(),J=function(){var n=l(w().m(function n(){var r,o,i,a=arguments;return w().w(function(n){for(;;)switch(n.p=n.n){case 0:return r=a.length>0&&void 0!==a[0]?a[0]:"",n.p=1,n.n=2,e.loadConfig(t.resolveCwd(r,"package.json"));case 2:return o=n.v,_.debug("file","success","引入 package.json 成功"),n.a(2,o);case 3:n.p=3,i=n.v,_.error("file","fail","引入 package.json 失败"),_.debug("file","error",i);case 4:return n.a(2)}},n,null,[[1,3]])}));return function(){return n.apply(this,arguments)}}(),G=function(){var n=l(w().m(function n(r){var o,i;return w().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,e.loadConfig(t.resolveCwd(r,"./tsconfig.json"));case 1:return o=n.v,_.debug("file","success","引入 tsconfig.json 成功"),n.a(2,o);case 2:n.p=2,i=n.v,_.error("file","failed","引入 tsconfig.json 失败"),_.debug("file","error",i);case 3:return n.a(2)}},n,null,[[0,2]])}));return function(t){return n.apply(this,arguments)}}();function V(t){return $.apply(this,arguments)}function $(){return($=l(w().m(function n(r){var o,i;return w().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,e.loadConfigFuzzyExt("cdn",{rootDir:t.resolveCwd(r)});case 1:if(null!=(o=n.v)&&o.default){n.n=2;break}return _.log("file","undefined","未定义 cdn 配置文件"),n.a(2,null);case 2:return _.info("file","success","引入 cdn 成功"),n.a(2,o.default);case 3:return n.p=3,i=n.v,_.error("file","failed","引入 cdn 失败"),_.debug("file","failed",i),n.a(2,null)}},n,null,[[0,3]])}))).apply(this,arguments)}var Y=function(t){return K(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})},X=function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];return n.reduce(function(t,n){return Y(t,n)})},K=function(t,n){if(!n)return t;if(!t)return n;var e=b({},t);for(var o in n)r.isObject(n[o])?e[o]=K(t[o],n[o]):e[o]=n[o];return e};function Q(t,n){try{if(!r.isObject(t))return;return Object.entries(t).reduce(function(t,e){var o=j(e,2),i=o[0],a=o[1];return r.isFunction(a)?t[i]=a(n)||[]:r.isArray(a)&&(t[i]=a),t},{})}catch(t){throw _.error("parse","parseCdnConfig","解析用户cdn配置失败"),new Error(t)}}var Z=function(){var t=l(w().m(function t(n,e){var o,i;return w().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,o=n,!r.isFunction(n)){t.n=2;break}return t.n=1,n(e);case 1:o=t.v;case 2:return t.a(2,o);case 3:throw t.p=3,i=t.v,_.error("resolve ","resolveUserConfigJson","解析用户配置失败"),new Error(i);case 4:return t.a(2)}},t,null,[[0,3]])}));return function(n,e){return t.apply(this,arguments)}}(),tt=["multiple"],nt=["src/index","index"],et=[".ts",".js",".tsx",".jsx"],rt=function(n){var e=nt.reduce(function(t,n){return et.forEach(function(e){t.push("./"+n+e)}),t},[]);return t.lookupFile(e,n)},ot=["index.html","public/index.html"],it=function(n){return t.lookupFile(ot,n)},at=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.getCwd(),o=n.type,i=n.name,a=n.lib,c=n.libList,u=n.alias,s=n.clear,l=n.copy,f=n.dts,p=n.externals,d=n.formatList,h=n.input,g=n.internals,v=n.minimize,y=n.multiple,m=n.output,b=n.rollupConfig,C=n.webpackConfig,w=n.esbuildConfig,k=n.rspackConfig,x=n.format,j=n.serviceConfig,O=h,S=(null==m?void 0:m.path)||"./dist",P=null==m?void 0:m.file,D=[];return y||(t.isValidFilePathSync(O||"")||(O=rt(e)),O||_.error("init","not_found","找不到入口文件"),P=(null==m?void 0:m.file)||t.getFilename(O)),c||(D=a?[a]:null!=d&&d.length?d.map(function(t){return{format:t}}):[{format:x||"cjs"}]),{multiple:!r.isUndefinedOrNull(y)&&y,type:o,name:i,alias:u||{},clear:!r.isUndefinedOrNull(s)&&s,copy:l||[],dts:r.isUndefinedOrNull(f)?{}:f,externals:p||[],formatList:d||["cjs"],libList:D,input:h,internals:g||[],minimize:!r.isUndefinedOrNull(v)&&v,output:m||{path:S,file:P},rollupConfig:b||{},webpackConfig:C||{},esbuildConfig:w||{},rspackConfig:k||{},serviceConfig:j||{}}},ct=function(){var t=l(w().m(function t(n,e){var r;return w().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,q(n);case 1:return r=t.v,t.a(2,Z(r,e));case 2:return t.p=2,t.v,_.log("resolve ","error","doracli.config 解析用户配置失败"),t.a(2,{})}},t,null,[[0,2]])}));return function(n,e){return t.apply(this,arguments)}}(),ut=function(){var t=l(w().m(function t(n){var e;return w().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,J(n);case 1:return e=t.v,t.a(2,e);case 2:return t.p=2,t.v,_.log("resolve ","error","package.json 解析用户配置失败"),t.a(2,{})}},t,null,[[0,2]])}));return function(n){return t.apply(this,arguments)}}(),st=function(){var t=l(w().m(function t(n){var e;return w().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,G(n);case 1:return e=t.v,t.a(2,e);case 2:return t.p=2,t.v,_.log("resolve ","error","tsconfig.json 解析用户配置失败"),t.a(2,{})}},t,null,[[0,2]])}));return function(n){return t.apply(this,arguments)}}(),lt=function(){var t=l(w().m(function t(n,e,r){var o,i,a,c;return w().w(function(t){for(;;)switch(t.n){case 0:return o=n.getWorkRoot(),t.n=1,st(o);case 1:return i=t.v,t.n=2,ct(o,e);case 2:return a=t.v,t.n=3,ut(o);case 3:c=t.v,n.setPackageConfig(c),n.setDoraConfig(at(Y((null==r?void 0:r.doraConfig)||{},a||{}),o)),n.setTsConfig(i);case 4:return t.a(2)}},t)}));return function(n,e,r){return t.apply(this,arguments)}}();function ft(t,n){return pt.apply(this,arguments)}function pt(){return(pt=l(w().m(function t(n,e){var r;return w().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,V(n);case 1:return r=t.v,t.a(2,Q(r,e));case 2:return t.p=2,t.v,_.log("resolve ","resolveUserCdn","解析用户cdn配置失败"),t.a(2,{})}},t,null,[[0,2]])}))).apply(this,arguments)}var dt=["input","output","multiple"],ht=function(t){return t.dev="development",t.prod="production",t}({}),gt=h(function t(n){p(this,t),this.initOptions=n,g(this,"inOutMap",void 0),g(this,"input",void 0),g(this,"context",void 0),g(this,"build",void 0),g(this,"watch",void 0),g(this,"server",void 0)}),vt=function(){function t(){p(this,t),g(this,"headScripts",[]),g(this,"bodyScripts",[]),g(this,"headStyles",[]),g(this,"headTags",[]),g(this,"bodyTags",['<div id="main"></div>'])}return h(t,[{key:"addHeadScripts",value:function(t){var n;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.headScripts=[]),(n=this.headScripts).push.apply(n,O(t))}},{key:"addBodyScripts",value:function(t){var n;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.bodyScripts=[]),(n=this.bodyScripts).push.apply(n,O(t))}},{key:"addHeadStyles",value:function(t){var n;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.headStyles=[]),(n=this.headStyles).push.apply(n,O(t))}},{key:"addHeadTags",value:function(t){var n;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.headTags=[]),(n=this.headTags).push.apply(n,O(t))}},{key:"addBodyTags",value:function(t){var n;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.bodyTags=t),(n=this.bodyTags).push.apply(n,O(t))}},{key:"copy",value:function(){var n=new t;return n.addHeadScripts(this.headScripts,!0),n.addBodyScripts(this.bodyScripts,!0),n.addHeadStyles(this.headStyles,!0),n}},{key:"generateHtmlTemplate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Document",n=this.headScripts.sort(function(t,n){return(t.order||0)-(n.order||0)}).map(function(t){var n=['src="'.concat(t.src,'"'),t.async?"async":"",t.defer?"defer":""].filter(Boolean).join(" ");return"<script ".concat(n,"><\/script>")}).join("\n"),e=this.bodyScripts.sort(function(t,n){return(t.order||0)-(n.order||0)}).map(function(t){var n=['src="'.concat(t.src,'"'),t.async?"async":"",t.defer?"defer":""].filter(Boolean).join(" ");return"<script ".concat(n,"><\/script>")}).join("\n"),r=this.headStyles.sort(function(t,n){return(t.order||0)-(n.order||0)}).map(function(t){var n=['href="'.concat(t.src,'"'),'rel="stylesheet"',t.async?"async":"",t.defer?"defer":""].filter(Boolean).join(" ");return"<link ".concat(n,">")}).join("\n"),o=this.headTags.map(function(t){return t}).join("\n"),i=this.bodyTags.map(function(t){return t}).join("\n");return'<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>'.concat(t,"</title>\n ").concat(o,"\n ").concat(r,"\n ").concat(n,"\n</head>\n<body>\n ").concat(i,"\n ").concat(e,"\n</body>\n</html>")}}])}(),yt=function(){return h(function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";p(this,t),this.publicPath=n,g(this,"assetMap",{}),g(this,"dynamicHtml",new vt),g(this,"initAwaitList",[]),g(this,"assetList",[])},[{key:"updateAssetList",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.assetList=n?t:Array.from(new Set([].concat(O(this.assetList),O(t))))}},{key:"updateAssetMap",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.assetMap=n?t:b(b({},this.assetMap),t),this.initAwaitList.forEach(function(t){return t()}),this.initAwaitList=[]}},{key:"getAssetMap",value:function(){return this.assetMap}},{key:"getModuleAsset",value:function(t){return this.assetMap[t]||{name:t,scripts:[],styles:[],runtimeChunks:[]}}},{key:"getModuleHtml",value:(t=l(w().m(function t(n){var e,r,o=this;return w().w(function(t){for(;;)switch(t.n){case 0:if(0!==Object.keys(this.assetMap).length){t.n=1;break}return t.n=1,new Promise(function(t){o.initAwaitList.push(function(){t()})});case 1:if(e=this.assetMap[n]){t.n=2;break}throw new Error("Module ".concat(n," asset not found."));case 2:return(r=this.dynamicHtml.copy()).addBodyScripts(e.scripts.map(function(t){return{src:t,order:0}})),r.addHeadStyles(e.styles.map(function(t){return{src:t,order:0}})),t.a(2,r.generateHtmlTemplate())}},t,this)})),function(n){return t.apply(this,arguments)})}]);var t}(),mt=function(t){var n,e;return t.selfClosing?"<".concat(t.tagName," ").concat(null===(e=t.attrs)||void 0===e?void 0:e.map(function(t){return"".concat(t.name,'="').concat(t.value,'"')}).join(" ")," />"):"<".concat(t.tagName," ").concat(null===(n=t.attrs)||void 0===n?void 0:n.map(function(t){return"".concat(t.name,'="').concat(t.value,'"')}).join(" "),">").concat((t.children||[]).map(function(t){return"string"==typeof t?t:mt(t)}).join(""),"</").concat(t.tagName,">")},bt=function(t){var n=/<head[^>]*>([\s\S]*?)<\/head>/i.exec(t),e=/<body[^>]*>([\s\S]*?)<\/body>/i.exec(t),r=n?n[1]:"",o=e?e[1]:"";return{head:Ct(r),body:Ct(o)}},Ct=function(t){var n=[],e=[];if(!t)return n;for(var r=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=function(t){for(var n,e=[],r=/([^\s=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>/]+)))?/g;n=r.exec(t);){var o,i,a=n[1],c=null!==(o=null!==(i=n[2])&&void 0!==i?i:n[3])&&void 0!==o?o:n[4];void 0===c?e.push({name:a,value:!0}):e.push({name:a,value:c})}return e},i=0,a=t.length;i<a;){if("<"!==t[i]){var c=t.indexOf("<",i),u=-1===c?a:c,s=t.slice(i,u).trim();if(s&&e.length){var l=e[e.length-1];l.children||(l.children=[]),l.children.push(s)}i=u}else{var f=t.indexOf(">",i+1);if(-1===f)break;var p=t.slice(i+1,f).trim();if(p.startsWith("!")||p.startsWith("?")||p.startsWith("--")){i=f+1;continue}if(p.startsWith("/")){p.slice(1).trim().split(/\s+/)[0].toLowerCase();if(e.length)e[e.length-1].tagName.toLowerCase(),e.pop();i=f+1;continue}var d=p.endsWith("/"),h=p.replace(/\/\s*$/,"").trim(),g=h.search(/\s/),v=(-1===g?h:h.slice(0,g)).toLowerCase(),y=-1===g?"":h.slice(g+1).trim(),m=d||r.has(v),b={tagName:v,attrs:o(y),selfClosing:m,children:[]};if(0===e.length)n.push(b);else{var C=e[e.length-1];C.children||(C.children=[]),C.children.push(b)}m||e.push(b),i=f+1}}return n},wt=function(){function t(n){var e,r;p(this,t),g(this,"head",[]),g(this,"body",[]),this.head=null!==(e=null==n?void 0:n.head)&&void 0!==e?e:[],this.body=null!==(r=null==n?void 0:n.body)&&void 0!==r?r:[]}return h(t,[{key:"addHead",value:function(t){return t?(this.head.push(t),this):this}},{key:"addHeads",value:function(t){var n;return t?((n=this.head).push.apply(n,O(t)),this):this}},{key:"addBody",value:function(t){return t?(this.body.push(t),this):this}},{key:"addBodys",value:function(t){var n;return t?((n=this.body).push.apply(n,O(t)),this):this}},{key:"parseHtmlByFile",value:function(n){var e=a.readFileSync(n,"utf-8"),r=t.parseHtml(e),o=r.head,i=r.body;return this.head=o,this.body=i,this}},{key:"generateHtml",value:function(){return t={head:this.head,body:this.body},n=t.head,e=t.body,"\n <html>\n <head>\n ".concat(n.map(function(t){return mt(t)}).join("\n"),"\n </head>\n <body>\n ").concat(e.map(function(t){return mt(t)}).join("\n"),"\n </body>\n </html>\n ");var t,n,e}},{key:"copy",value:function(){return new t({head:this.head.map(function(t){return b({},t)}),body:this.body.map(function(t){return b({},t)})})}}],[{key:"parseHtml",value:function(t){return bt(t)}}])}(),kt=function(){var t=l(w().m(function t(n,e){var r;return w().w(function(t){for(;;)switch(t.p=t.n){case 0:if(r={doraConfig:null,packageConfig:null,tsconfigConfig:null,cdnConfig:null},t.p=1,!1===(null==e?void 0:e.doraConfig)){t.n=3;break}return t.n=2,q(n);case 2:r.doraConfig=t.v;case 3:t.n=5;break;case 4:t.p=4,t.v;case 5:if(t.p=5,!1===(null==e?void 0:e.packageConfig)){t.n=7;break}return t.n=6,J(n);case 6:r.packageConfig=t.v;case 7:t.n=9;break;case 8:t.p=8,t.v;case 9:if(t.p=9,!1===(null==e?void 0:e.tsconfigConfig)){t.n=11;break}return t.n=10,G(n);case 10:r.tsconfigConfig=t.v;case 11:t.n=13;break;case 12:t.p=12,t.v;case 13:if(t.p=13,!1===(null==e?void 0:e.cdnConfig)){t.n=15;break}return t.n=14,V(n);case 14:r.cdnConfig=t.v;case 15:t.n=17;break;case 16:t.p=16,t.v;case 17:return t.a(2,r)}},t,null,[[13,16],[9,12],[5,8],[1,4]])}));return function(n,e){return t.apply(this,arguments)}}(),xt=function(){var n=l(w().m(function n(e,r){return w().w(function(n){for(;;)switch(n.n){case 0:e.setCdnConfig(r.cdnConfig),e.setDoraConfig(r.doraConfig),e.setTsConfig(r.tsConfig),e.setPackageConfig(r.packageConfig),e.setWorkRoot(r.workRootDir||t.getCwd()),e.setCmd(r.cmd||{});case 1:return n.a(2)}},n)}));return function(t,e){return n.apply(this,arguments)}}(),jt=function(){var t=l(w().m(function t(n){var e;return w().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,it(n);case 1:if(!(e=t.v)){t.n=2;break}return t.a(2,a.readFileSync(e,"utf-8"));case 2:return t.a(2,'\n<html lang="zh-CN">\n <head>\n <meta charset="UTF-8" />\n <meta http-equiv="X-UA-Compatible" content="IE=edge" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>dora</title>\n </head>\n <body>\n <div id="main">welcome use dora !!</div>\n </body>\n</html>\n')}},t)}));return function(n){return t.apply(this,arguments)}}(),Ot=function(){var t=l(w().m(function t(n,e){var r,o,i,a;return w().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Z(n.doraConfig,e);case 1:return r=t.v,o=n.packageConfig||{},i=n.tsconfigConfig||{},t.n=2,Q(n.cdnConfig,e);case 2:return a=t.v,t.a(2,{doraConfig:r,packageConfig:o,tsConfig:i,cdnConfig:a})}},t)}));return function(n,e){return t.apply(this,arguments)}}(),St=["multiple"],Pt=function(){function t(n){var e;return p(this,t),(e=f(this,t)).configCtx=n,e}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&x(t,n)}(t,wt),h(t,[{key:"init",value:(n=l(w().m(function t(){var n,e,r,o;return w().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,jt(this.configCtx.getWorkRoot());case 1:return n=t.v,e=wt.parseHtml(n),r=e.head,o=e.body,this.addHeads(r),this.addBodys(o),t.a(2,this)}},t,this)})),function(){return n.apply(this,arguments)})},{key:"addConfigCdn",value:function(){var t,n,e,r,o=this.configCtx.getCdnConfig();return this.addHeads(null===(t=o.headAfterScript)||void 0===t?void 0:t.map(function(t){return{tagName:"script",attrs:[{name:"src",value:t}]}})),this.addHeads(null===(n=o.headAfterStyle)||void 0===n?void 0:n.map(function(t){return{tagName:"link",attrs:[{name:"href",value:t},{name:"rel",value:"stylesheet"}]}})),this.addBodys(null===(e=o.bodyAfterScript)||void 0===e?void 0:e.map(function(t){return{tagName:"script",attrs:[{name:"src",value:t}]}})),this.addBodys(null===(r=o.bodyBeforeScript)||void 0===r?void 0:r.map(function(t){return{tagName:"script",attrs:[{name:"src",value:t}]}})),this}},{key:"writeToFile",value:function(t){return a.existsSync(t)?a.appendFileSync(t,this.generateHtml(),{}):a.writeFileSync(t,this.generateHtml(),{}),this}},{key:"addBodyScripts",value:function(t){return this.addBodys(t.map(function(t){return{tagName:"script",attrs:[{name:"src",value:t}]}})),this}},{key:"addHeadStyles",value:function(t){return this.addHeads(t.map(function(t){return{tagName:"link",attrs:[{name:"href",value:t},{name:"rel",value:"stylesheet"}]}})),this}},{key:"copy",value:function(){var n=new t(this.configCtx);return n.addHeads(this.head),n.addBodys(this.body),n}}]);var n}(),Dt=function(){var n=l(w().m(function n(){var e,r,i,a=arguments;return w().w(function(n){for(;;)switch(n.n){case 0:return e=a.length>0&&void 0!==a[0]?a[0]:t.getCwd(),r=o.join(e,"tsconfig.json"),n.n=1,t.isValidFilePath(r);case 1:if(n.v){n.n=3;break}return i={$schema:"https://json.schemastore.org/tsconfig",compilerOptions:{target:"esnext",moduleResolution:"node",module:"esnext",noImplicitThis:!1,noImplicitAny:!1,noUnusedLocals:!1,noImplicitReturns:!0,noUnusedParameters:!1,useUnknownInCatchVariables:!1,allowSyntheticDefaultImports:!0,esModuleInterop:!0,emitDecoratorMetadata:!0,experimentalDecorators:!0,preserveConstEnums:!0,strictNullChecks:!0,strictFunctionTypes:!0,strictPropertyInitialization:!0,resolveJsonModule:!0,skipLibCheck:!0,alwaysStrict:!0,sourceMap:!1,paths:{"@/*":["./src/*"]}},exclude:["lib/**"],include:["**/*.ts","**/*.json"]},n.n=2,c.writeFile(r,JSON.stringify(i,null,2));case 2:_.info("init","success","自动注入 tsconfig.json");case 3:return n.a(2)}},n)}));return function(){return n.apply(this,arguments)}}();exports.picocolors=n,exports.CompilerBase=gt,exports.ConfigCtx=D,exports.DynamicHtml=vt,exports.EnvEnum=ht,exports.GenerateConfigHtml=Pt,exports.HtmlAssetManager=yt,exports.HtmlManage=wt,exports.cLog=_,exports.cLogDebugger=H,exports.cLogError=N,exports.cLogMessage=M,exports.cLogSuccess=R,exports.cLogTime=U,exports.cLogTimeEnd=I,exports.cLogWarn=B,exports.clearMw=function(){return function(t){return function(n){return l(w().m(function e(){return w().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,z(t);case 1:return e.a(2,n())}},e)}))}}},exports.collectBaseConfigMw=function(t,n){return function(e){return function(r){return function(){return e.setWorkRoot(t),e.setCmd(n),r()}}}},exports.collectCdnConfigMw=function(t){return function(n){return function(e){return l(w().m(function r(){var o;return w().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,ft(n.getWorkRoot(),t);case 1:return o=r.v,n.setCdnConfig(o||{bodyAfterScript:[],headAfterScript:[],headAfterStyle:[],bodyBeforeScript:[]}),r.a(2,e())}},r)}))}}},exports.collectConfig=lt,exports.collectConfigs=kt,exports.collectDoraConfigMw=function(t){return function(n){return function(e){return l(w().m(function r(){var o;return w().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,ct(n.getWorkRoot(),t);case 1:return o=r.v,n.setDoraConfig(o||{}),r.a(2,e())}},r)}))}}},exports.collectPackageJsonMw=function(){return function(t){return function(n){return l(w().m(function e(){var r;return w().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,J(t.getWorkRoot());case 1:return r=e.v,t.setPackageConfig(r||{}),e.a(2,n())}},e)}))}}},exports.collectTsconfigJsonMw=function(){return function(t){return function(n){return l(w().m(function e(){var r;return w().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,G(t.getWorkRoot());case 1:return r=e.v,t.setTsConfig(r||{}),e.a(2,n())}},e)}))}}},exports.configCtxCollect=xt,exports.configCtxWorkflow=function(t){var n=[];return{use:function(t){return n.push(t),this},getResult:function(){return l(w().m(function e(){return w().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,i.getOnionFun(t,n)(r.noop)();case 1:return e.a(2,t)}},e)}))()}}},exports.createDependFilter=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"exclude",e=t.dependencies,o=t.peerDependencies,i=t.devDependencies,a=t.externals,c=t.internals,u=t.compare,s={},l={};Object.keys(e||{}).forEach(function(t){s[t]=t}),Object.keys(o||{}).forEach(function(t){s[t]=t}),Object.keys(i||{}).forEach(function(t){s[t]=t}),null==a||a.forEach(function(t){r.isString(t)?s[t]=t:r.isPlainObject(t)&&Object.keys(t).forEach(function(n){s[n]=t[n]})}),null==c||c.forEach(function(t){r.isString(t)&&(l[t]=t)});var f="include"===n;return function(t){var n=!1,e=Object.keys(s).find(function(n){return r.isFunction(u)?u(t,n):t.startsWith(n)}),o=Object.keys(l).find(function(n){return r.isFunction(u)?u(t,n):t.startsWith(n)});return f?o?n=!1:e&&(n=s[e]):e?n=s[e]:o&&(n=!1),n}},exports.createEnvParams=function(n){var e=n.workRootDir||"./";return o.isAbsolute(n.workRootDir)||(e=o.join(t.getCwd(),e)),b(b({},n),{},{workRootDir:e})},exports.createOutputList=function(n){var e=n.input,o=n.output,i=n.formatList,a=n.format,c=o.path,u=o.file,s=[];return a?s.push({input:e,format:a,outputFile:u||t.getFilename(e)||"index.js",outputPath:c||"dist"}):r.isArray(i)?i.forEach(function(n){s.push({input:e,format:n,outputFile:u||t.getFilename(e)||"index.js",outputPath:c||"dist"})}):s.push({input:e,format:"iife",outputFile:u||t.getFilename(e)||"index.js",outputPath:c||"dist"}),s},exports.deepMergeObject=K,exports.findInput=rt,exports.findInputHtml=it,exports.getDefaultHtml=jt,exports.getDependencies=function(t){return b(b(b({},t.dependencies),t.peerDependencies),t.devDependencies)},exports.getDoracliConfig=q,exports.getPackageJson=J,exports.getTsPathAlias=function(t){var n=((null==t?void 0:t.compilerOptions)||{}).paths;if(!n)return{};var e={};return Object.entries(n).forEach(function(t){var n=j(t,2),r=n[0],i=n[1],a=r.replace(/\/\*$/,"");if(null!=i&&i.length&&!e[a]){var c=i[0].replace(/\/\*$/,"");e[a]=o.resolve(c)}}),e},exports.getTsconfigJson=G,exports.getUserCdn=V,exports.inputFileDirList=nt,exports.inputFileTypeList=et,exports.inputHtmlFileDirList=ot,exports.insertTsconfig=Dt,exports.mergeDoraCliConfig=Y,exports.mergeDoraCliConfigMutiple=X,exports.parseCdnConfig=Q,exports.parseDoracliConfig=Z,exports.parseHtml=bt,exports.parsetConfig=Ot,exports.resolveCdnConfig=ft,exports.resolveDoraConfig=ct,exports.resolvePackageJson=ut,exports.resolveTsconfigJson=st,exports.setLogLevel=function(t){A=t},exports.splitDoraCliConfig=function(t){var n=t.multiple,e=C(t,tt);return r.isArray(n)?0===n.length?[e]:1===n.length?[X(e,n[0])]:n.map(function(t){return X(e,t)}):[e]},exports.splitDoraConfig=function(t){var n=t.multiple,e=C(t,St);return r.isArray(n)?0===n.length?[e]:1===n.length?[X(n[0],e)]:n.map(function(t){return X(e,t)}):[e]},exports.wholeDoraConfig=at,exports.wholeDoraConfigMw=function(t){return function(n){return function(e){return function(){var o=Y(t,n.getDoraConfig()),i=o.alias,a=o.clear,c=o.copy,u=o.dts,s=o.lib,l=o.format,f=o.libList,p=o.name,d=o.type,h=o.externals,g=o.formatList,v=o.input,y=o.internals,m=o.minimize,b=o.multiple,C=o.output,w=o.rollupConfig,k=o.webpackConfig,x=o.esbuildConfig,j=o.rspackConfig,O=o.serviceConfig,S=o.dtsConfig;return n.setDoraConfig({multiple:!r.isUndefinedOrNull(b)&&b,name:p,type:d,format:l,formatList:g,lib:s,libList:f,alias:i||{},clear:!r.isUndefinedOrNull(a)&&a,copy:c||[],dts:r.isUndefinedOrNull(u)?{}:u,externals:h||[],input:v,internals:y||[],minimize:!r.isUndefinedOrNull(m)&&m,output:C,rollupConfig:w||{},webpackConfig:k||{},esbuildConfig:x||{},rspackConfig:j||{},serviceConfig:O||{},dtsConfig:S}),e()}}}},exports.wholeDoraInoutMw=function(){return function(n){return function(e){return function(){var r=n.getDoraConfig(),o=r.input,i=r.output,a=r.multiple,c=C(r,dt),u=n.getWorkRoot(),s=o,l=(null==i?void 0:i.path)||"./dist",f=null==i?void 0:i.file;return a||(t.isValidFilePathSync(s||"")||(s=rt(u)),s||_.error("init","not_found","找不到入口文件"),f=(null==i?void 0:i.file)||t.getFilename(s)),n.setDoraConfig(b(b({},c),{},{input:s,output:i||{path:l,file:f},multiple:a})),e()}}}};
3
+ var t,n,e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,r,o,i){var u=r&&r.prototype instanceof c?r:c,s=Object.create(u.prototype);return k(s,"_invoke",function(e,r,o){var i,c,u,s=0,l=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(n,e){return i=n,c=0,u=t,p.n=e,a}};function d(e,r){for(c=e,u=r,n=0;!f&&s&&!o&&n<l.length;n++){var o,i=l[n],d=p.p,h=i[2];e>3?(o=h===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=e<2&&d<i[1])?(c=0,p.v=r,p.n=i[1]):d<h&&(o=e<3||i[0]>r||r>h)&&(i[4]=e,i[5]=r,p.n=h,c=0))}if(o||e>1)return a;throw f=!0,r}return function(o,l,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,h),c=l,u=h;(n=c<2?t:u)||!f;){i||(c?c<3?(c>1&&(p.n=-1),d(c,u)):p.n=u:p.v=u);try{if(s=2,i){if(c||(o="next"),n=i[o]){if(!(n=n.call(i,u)))throw TypeError("iterator result is not an object");if(!n.done)return n;u=n.value,c<2&&(c=0)}else 1===c&&(n=i.return)&&n.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=t}else if((n=(f=p.n<0)?u:e.call(r,p))!==a)break}catch(n){i=t,c=1,u=n}finally{s=1}}return{value:n,done:f}}}(e,o,i),!0),s}var a={};function c(){}function u(){}function s(){}n=Object.getPrototypeOf;var l=[][r]?n(n([][r]())):(k(n={},r,function(){return this}),n),f=s.prototype=c.prototype=Object.create(l);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,k(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=s,k(f,"constructor",s),k(s,"constructor",u),u.displayName="GeneratorFunction",k(s,o,"GeneratorFunction"),k(f),k(f,o,"Generator"),k(f,r,function(){return this}),k(f,"toString",function(){return"[object Generator]"}),(w=function(){return{w:i,m:p}})()}function k(t,n,e,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}k=function(t,n,e,r){function i(n,e){k(t,n,function(t){return this._invoke(n,e,t)})}n?o?o(t,n,{value:e,enumerable:!r,configurable:!r,writable:!r}):t[n]=e:(i("next",0),i("throw",1),i("return",2))},k(t,n,e,r)}function x(t,n){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},x(t,n)}function j(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var r,o,i,a,c=[],u=!0,s=!1;try{if(i=(e=e.call(t)).next,0===n);else for(;!(u=(r=i.call(e)).done)&&(c.push(r.value),c.length!==n);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(t,n)||P(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(t){return function(t){if(Array.isArray(t))return u(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||P(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(t){var n=function(t,n){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,n);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==typeof n?n:n+""}function P(t,n){if(t){if("string"==typeof t)return u(t,n);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?u(t,n):void 0}}var D=function(){function t(){p(this,t),g(this,"tsConfig",{}),g(this,"doraConfig",{}),g(this,"packageConfig",{}),g(this,"cdnConfig",{}),g(this,"cmd",{}),g(this,"workRoot","./")}return h(t,[{key:"setCmd",value:function(t){this.cmd=t}},{key:"getCmd",value:function(){return this.cmd}},{key:"setWorkRoot",value:function(t){this.workRoot=t}},{key:"getWorkRoot",value:function(){return this.workRoot}},{key:"setTsConfig",value:function(t){this.tsConfig=t}},{key:"getTsConfig",value:function(){return this.tsConfig}},{key:"setDoraConfig",value:function(t){this.doraConfig=t}},{key:"getDoraConfig",value:function(){return this.doraConfig}},{key:"setCdnConfig",value:function(t){this.cdnConfig=t}},{key:"getCdnConfig",value:function(){return this.cdnConfig}},{key:"setPackageConfig",value:function(t){this.packageConfig=t}},{key:"getPackageConfig",value:function(){return this.packageConfig}},{key:"copy",value:function(){var n=new t;return n.setWorkRoot(this.getWorkRoot()),n.setTsConfig(this.getTsConfig()),n.setDoraConfig(this.getDoraConfig()),n.setPackageConfig(this.getPackageConfig()),n.setCdnConfig(this.getCdnConfig()),n.setCmd(this.getCmd()),n}}])}(),T="@doracli",E=10,A=function(t,n){return t.length>=n?t:t+" ".repeat(n-t.length)},F=function(t){return A(t,5)},L=function(t){return A(t,9).toUpperCase()},H=function(t,e){var r;if(!(E>0)){for(var o=n.bgBlack("[".concat(n.magenta(T),":").concat(n.bold(" ".concat(F(t))),"]")),i=arguments.length,a=new Array(i>2?i-2:0),c=2;c<i;c++)a[c-2]=arguments[c];return(r=console).debug.apply(r,["".concat(o," [").concat(L(e),"]")].concat(a))}},M=function(t,e){var r;if(!(E>10)){for(var o=n.bgBlack("[".concat(n.magenta(T),":").concat(n.bold(" ".concat(F(t))),"]")),i=arguments.length,a=new Array(i>2?i-2:0),c=2;c<i;c++)a[c-2]=arguments[c];return(r=console).log.apply(r,["".concat(o," [").concat(n.yellow(L(e)),"]")].concat(a))}},R=function(t,e){var r;if(!(E>100)){for(var o=n.bgBlack("[".concat(n.magenta(T),":").concat(n.bold(" ".concat(F(t))),"]")),i=arguments.length,a=new Array(i>2?i-2:0),c=2;c<i;c++)a[c-2]=arguments[c];return(r=console).log.apply(r,["".concat(o," [").concat(n.green(L(e)),"]")].concat(a))}},B=function(t,e){var r;if(!(E>1e3)){for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];return(r=console).log.apply(r,[n.bgYellow("[".concat(T,": ").concat(F(t),"] [").concat(L(e),"]"))].concat(i))}},N=function(t,e){var r;if(!(E>1e4)){for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];return(r=console).log.apply(r,[n.bgRed("[".concat(T,": ").concat(F(t),"] [").concat(L(e),"]"))].concat(i))}},W=0,U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"cLogTimeStart-".concat(W);return W++,console.time(t),function(){console.timeEnd(t)}},I=function(t){console.timeEnd(t)},_={log:M,debug:H,error:N,warn:B,info:R,time:U,timeEnd:I},z=function(){var n=l(w().m(function n(e){var r,o,i,a;return w().w(function(n){for(;;)switch(n.p=n.n){case 0:if(r=e.getDoraConfig(),o=r.clear,i=r.output,a=(i||{}).path,n.p=1,o){n.n=2;break}return n.a(2);case 2:if(a){n.n=3;break}return n.a(2);case 3:return n.n=4,t.isValidDir(a);case 4:if(n.v){n.n=5;break}return n.a(2);case 5:return n.n=6,t.cleanTargets(a);case 6:n.n=8;break;case 7:n.p=7,n.v,_.warn("clear","warn","清空目标文件夹失败: ".concat(a));case 8:return n.a(2)}},n,null,[[1,7]])}));return function(t){return n.apply(this,arguments)}}(),q=function(){var n=l(w().m(function n(r){var o,i;return w().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,e.loadConfigFuzzyExt("doracli.config",{rootDir:t.resolveCwd(r)});case 1:if(o=n.v){n.n=2;break}return _.warn("file","undefined","未定义 doracli 配置文件"),n.a(2,null);case 2:return _.debug("file","success","引入 doracli 配置文件成功"),n.a(2,o.default||o);case 3:return n.p=3,i=n.v,_.error("file","fail","引入 doracli 配置文件失败"),console.error(i),n.a(2,Promise.reject(i))}},n,null,[[0,3]])}));return function(t){return n.apply(this,arguments)}}(),J=function(){var n=l(w().m(function n(){var r,o,i,a=arguments;return w().w(function(n){for(;;)switch(n.p=n.n){case 0:return r=a.length>0&&void 0!==a[0]?a[0]:"",n.p=1,n.n=2,e.loadConfig(t.resolveCwd(r,"package.json"));case 2:return o=n.v,_.debug("file","success","引入 package.json 成功"),n.a(2,o);case 3:n.p=3,i=n.v,_.error("file","fail","引入 package.json 失败"),_.debug("file","error",i);case 4:return n.a(2)}},n,null,[[1,3]])}));return function(){return n.apply(this,arguments)}}(),G=function(){var n=l(w().m(function n(r){var o,i;return w().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,e.loadConfig(t.resolveCwd(r,"./tsconfig.json"));case 1:return o=n.v,_.debug("file","success","引入 tsconfig.json 成功"),n.a(2,o);case 2:n.p=2,i=n.v,_.error("file","failed","引入 tsconfig.json 失败"),_.debug("file","error",i);case 3:return n.a(2)}},n,null,[[0,2]])}));return function(t){return n.apply(this,arguments)}}();function V(t){return $.apply(this,arguments)}function $(){return($=l(w().m(function n(r){var o,i;return w().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,e.loadConfigFuzzyExt("cdn",{rootDir:t.resolveCwd(r)});case 1:if(null!=(o=n.v)&&o.default){n.n=2;break}return _.log("file","undefined","未定义 cdn 配置文件"),n.a(2,null);case 2:return _.info("file","success","引入 cdn 成功"),n.a(2,o.default);case 3:return n.p=3,i=n.v,_.error("file","failed","引入 cdn 失败"),_.debug("file","failed",i),n.a(2,null)}},n,null,[[0,3]])}))).apply(this,arguments)}var Y=function(t){return K(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})},X=function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];return n.reduce(function(t,n){return Y(t,n)})},K=function(t,n){if(!n)return t;if(!t)return n;var e=b({},t);for(var o in n)r.isObject(n[o])?e[o]=K(t[o],n[o]):e[o]=n[o];return e};function Q(t,n){try{if(!r.isObject(t))return;return Object.entries(t).reduce(function(t,e){var o=j(e,2),i=o[0],a=o[1];return r.isFunction(a)?t[i]=a(n)||[]:r.isArray(a)&&(t[i]=a),t},{})}catch(t){throw _.error("parse","parseCdnConfig","解析用户cdn配置失败"),new Error(t)}}var Z=function(){var t=l(w().m(function t(n,e){var o,i;return w().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,o=n,!r.isFunction(n)){t.n=2;break}return t.n=1,n(e);case 1:o=t.v;case 2:return t.a(2,o);case 3:throw t.p=3,i=t.v,_.error("resolve ","resolveUserConfigJson","解析用户配置失败"),new Error(i);case 4:return t.a(2)}},t,null,[[0,3]])}));return function(n,e){return t.apply(this,arguments)}}(),tt=["multiple"],nt=["src/index","index"],et=[".ts",".js",".tsx",".jsx"],rt=function(n){var e=nt.reduce(function(t,n){return et.forEach(function(e){t.push("./"+n+e)}),t},[]);return t.lookupFile(e,n)},ot=["index.html","public/index.html"],it=function(n){return t.lookupFile(ot,n)},at=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.getCwd(),o=n.type,i=n.name,a=n.lib,c=n.libList,u=n.alias,s=n.clear,l=n.copy,f=n.dts,p=n.externals,d=n.formatList,h=n.input,g=n.internals,v=n.minimize,y=n.multiple,m=n.output,b=n.rollupConfig,C=n.webpackConfig,w=n.esbuildConfig,k=n.rspackConfig,x=n.format,j=n.serviceConfig,O=h,S=(null==m?void 0:m.path)||"./dist",P=null==m?void 0:m.file,D=[];return y||(t.isValidFilePathSync(O||"")||(O=rt(e)),O||_.error("init","not_found","找不到入口文件"),P=(null==m?void 0:m.file)||t.getFilename(O)),c||(D=a?[a]:null!=d&&d.length?d.map(function(t){return{format:t}}):[{format:x||"cjs"}]),{multiple:!r.isUndefinedOrNull(y)&&y,type:o,name:i,alias:u||{},clear:!r.isUndefinedOrNull(s)&&s,copy:l||[],dts:r.isUndefinedOrNull(f)?{}:f,externals:p||[],formatList:d||["cjs"],libList:D,input:h,internals:g||[],minimize:!r.isUndefinedOrNull(v)&&v,output:m||{path:S,file:P},rollupConfig:b||{},webpackConfig:C||{},esbuildConfig:w||{},rspackConfig:k||{},serviceConfig:j||{}}},ct=function(){var t=l(w().m(function t(n,e){var r;return w().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,q(n);case 1:return r=t.v,t.a(2,Z(r,e));case 2:return t.p=2,t.v,_.log("resolve ","error","doracli.config 解析用户配置失败"),t.a(2,{})}},t,null,[[0,2]])}));return function(n,e){return t.apply(this,arguments)}}(),ut=function(){var t=l(w().m(function t(n){var e;return w().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,J(n);case 1:return e=t.v,t.a(2,e);case 2:return t.p=2,t.v,_.log("resolve ","error","package.json 解析用户配置失败"),t.a(2,{})}},t,null,[[0,2]])}));return function(n){return t.apply(this,arguments)}}(),st=function(){var t=l(w().m(function t(n){var e;return w().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,G(n);case 1:return e=t.v,t.a(2,e);case 2:return t.p=2,t.v,_.log("resolve ","error","tsconfig.json 解析用户配置失败"),t.a(2,{})}},t,null,[[0,2]])}));return function(n){return t.apply(this,arguments)}}(),lt=function(){var t=l(w().m(function t(n,e,r){var o,i,a,c;return w().w(function(t){for(;;)switch(t.n){case 0:return o=n.getWorkRoot(),t.n=1,st(o);case 1:return i=t.v,t.n=2,ct(o,e);case 2:return a=t.v,t.n=3,ut(o);case 3:c=t.v,n.setPackageConfig(c),n.setDoraConfig(at(Y((null==r?void 0:r.doraConfig)||{},a||{}),o)),n.setTsConfig(i);case 4:return t.a(2)}},t)}));return function(n,e,r){return t.apply(this,arguments)}}();function ft(t,n){return pt.apply(this,arguments)}function pt(){return(pt=l(w().m(function t(n,e){var r;return w().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,V(n);case 1:return r=t.v,t.a(2,Q(r,e));case 2:return t.p=2,t.v,_.log("resolve ","resolveUserCdn","解析用户cdn配置失败"),t.a(2,{})}},t,null,[[0,2]])}))).apply(this,arguments)}var dt=["input","output","multiple"],ht=function(t){return t.dev="development",t.prod="production",t}({}),gt=h(function t(n){p(this,t),this.initOptions=n,g(this,"inOutMap",void 0),g(this,"input",void 0),g(this,"context",void 0),g(this,"build",void 0),g(this,"watch",void 0),g(this,"server",void 0)}),vt=function(){function t(){p(this,t),g(this,"headScripts",[]),g(this,"bodyScripts",[]),g(this,"headStyles",[]),g(this,"headTags",[]),g(this,"bodyTags",['<div id="main"></div>'])}return h(t,[{key:"addHeadScripts",value:function(t){var n;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.headScripts=[]),(n=this.headScripts).push.apply(n,O(t))}},{key:"addBodyScripts",value:function(t){var n;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.bodyScripts=[]),(n=this.bodyScripts).push.apply(n,O(t))}},{key:"addHeadStyles",value:function(t){var n;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.headStyles=[]),(n=this.headStyles).push.apply(n,O(t))}},{key:"addHeadTags",value:function(t){var n;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.headTags=[]),(n=this.headTags).push.apply(n,O(t))}},{key:"addBodyTags",value:function(t){var n;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.bodyTags=t),(n=this.bodyTags).push.apply(n,O(t))}},{key:"copy",value:function(){var n=new t;return n.addHeadScripts(this.headScripts,!0),n.addBodyScripts(this.bodyScripts,!0),n.addHeadStyles(this.headStyles,!0),n}},{key:"generateHtmlTemplate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Document",n=this.headScripts.sort(function(t,n){return(t.order||0)-(n.order||0)}).map(function(t){var n=['src="'.concat(t.src,'"'),t.async?"async":"",t.defer?"defer":""].filter(Boolean).join(" ");return"<script ".concat(n,"><\/script>")}).join("\n"),e=this.bodyScripts.sort(function(t,n){return(t.order||0)-(n.order||0)}).map(function(t){var n=['src="'.concat(t.src,'"'),t.async?"async":"",t.defer?"defer":""].filter(Boolean).join(" ");return"<script ".concat(n,"><\/script>")}).join("\n"),r=this.headStyles.sort(function(t,n){return(t.order||0)-(n.order||0)}).map(function(t){var n=['href="'.concat(t.src,'"'),'rel="stylesheet"',t.async?"async":"",t.defer?"defer":""].filter(Boolean).join(" ");return"<link ".concat(n,">")}).join("\n"),o=this.headTags.map(function(t){return t}).join("\n"),i=this.bodyTags.map(function(t){return t}).join("\n");return'<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>'.concat(t,"</title>\n ").concat(o,"\n ").concat(r,"\n ").concat(n,"\n</head>\n<body>\n ").concat(i,"\n ").concat(e,"\n</body>\n</html>")}}])}(),yt=function(){return h(function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";p(this,t),this.publicPath=n,g(this,"assetMap",{}),g(this,"dynamicHtml",new vt),g(this,"initAwaitList",[]),g(this,"assetList",[])},[{key:"updateAssetList",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.assetList=n?t:Array.from(new Set([].concat(O(this.assetList),O(t))))}},{key:"updateAssetMap",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.assetMap=n?t:b(b({},this.assetMap),t),this.initAwaitList.forEach(function(t){return t()}),this.initAwaitList=[]}},{key:"getAssetMap",value:function(){return this.assetMap}},{key:"getModuleAsset",value:function(t){return this.assetMap[t]||{name:t,scripts:[],styles:[],runtimeChunks:[]}}},{key:"getModuleHtml",value:(t=l(w().m(function t(n){var e,r,o=this;return w().w(function(t){for(;;)switch(t.n){case 0:if(0!==Object.keys(this.assetMap).length){t.n=1;break}return t.n=1,new Promise(function(t){o.initAwaitList.push(function(){t()})});case 1:if(e=this.assetMap[n]){t.n=2;break}throw new Error("Module ".concat(n," asset not found."));case 2:return(r=this.dynamicHtml.copy()).addBodyScripts(e.scripts.map(function(t){return{src:t,order:0}})),r.addHeadStyles(e.styles.map(function(t){return{src:t,order:0}})),t.a(2,r.generateHtmlTemplate())}},t,this)})),function(n){return t.apply(this,arguments)})}]);var t}(),mt=function(t){var n,e;return t.selfClosing?"<".concat(t.tagName," ").concat(null===(e=t.attrs)||void 0===e?void 0:e.map(function(t){return"".concat(t.name,'="').concat(t.value,'"')}).join(" ")," />"):"<".concat(t.tagName," ").concat(null===(n=t.attrs)||void 0===n?void 0:n.map(function(t){return"".concat(t.name,'="').concat(t.value,'"')}).join(" "),">").concat((t.children||[]).map(function(t){return"string"==typeof t?t:mt(t)}).join(""),"</").concat(t.tagName,">")},bt=function(t){var n=/<head[^>]*>([\s\S]*?)<\/head>/i.exec(t),e=/<body[^>]*>([\s\S]*?)<\/body>/i.exec(t),r=n?n[1]:"",o=e?e[1]:"";return{head:Ct(r),body:Ct(o)}},Ct=function(t){var n=[],e=[];if(!t)return n;for(var r=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=function(t){for(var n,e=[],r=/([^\s=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>/]+)))?/g;n=r.exec(t);){var o,i,a=n[1],c=null!==(o=null!==(i=n[2])&&void 0!==i?i:n[3])&&void 0!==o?o:n[4];void 0===c?e.push({name:a,value:!0}):e.push({name:a,value:c})}return e},i=0,a=t.length;i<a;){if("<"!==t[i]){var c=t.indexOf("<",i),u=-1===c?a:c,s=t.slice(i,u).trim();if(s&&e.length){var l=e[e.length-1];l.children||(l.children=[]),l.children.push(s)}i=u}else{var f=t.indexOf(">",i+1);if(-1===f)break;var p=t.slice(i+1,f).trim();if(p.startsWith("!")||p.startsWith("?")||p.startsWith("--")){i=f+1;continue}if(p.startsWith("/")){p.slice(1).trim().split(/\s+/)[0].toLowerCase();if(e.length)e[e.length-1].tagName.toLowerCase(),e.pop();i=f+1;continue}var d=p.endsWith("/"),h=p.replace(/\/\s*$/,"").trim(),g=h.search(/\s/),v=(-1===g?h:h.slice(0,g)).toLowerCase(),y=-1===g?"":h.slice(g+1).trim(),m=d||r.has(v),b={tagName:v,attrs:o(y),selfClosing:m,children:[]};if(0===e.length)n.push(b);else{var C=e[e.length-1];C.children||(C.children=[]),C.children.push(b)}m||e.push(b),i=f+1}}return n},wt=function(){function t(n){var e,r;p(this,t),g(this,"head",[]),g(this,"body",[]),this.head=null!==(e=null==n?void 0:n.head)&&void 0!==e?e:[],this.body=null!==(r=null==n?void 0:n.body)&&void 0!==r?r:[]}return h(t,[{key:"addHead",value:function(t){return t?(this.head.push(t),this):this}},{key:"addHeads",value:function(t){var n;return t?((n=this.head).push.apply(n,O(t)),this):this}},{key:"addBody",value:function(t){return t?(this.body.push(t),this):this}},{key:"addBodys",value:function(t){var n;return t?((n=this.body).push.apply(n,O(t)),this):this}},{key:"parseHtmlByFile",value:function(n){var e=a.readFileSync(n,"utf-8"),r=t.parseHtml(e),o=r.head,i=r.body;return this.head=o,this.body=i,this}},{key:"generateHtml",value:function(){return t={head:this.head,body:this.body},n=t.head,e=t.body,"\n <html>\n <head>\n ".concat(n.map(function(t){return mt(t)}).join("\n"),"\n </head>\n <body>\n ").concat(e.map(function(t){return mt(t)}).join("\n"),"\n </body>\n </html>\n ");var t,n,e}},{key:"copy",value:function(){return new t({head:this.head.map(function(t){return b({},t)}),body:this.body.map(function(t){return b({},t)})})}}],[{key:"parseHtml",value:function(t){return bt(t)}}])}(),kt=function(){var t=l(w().m(function t(n,e){var r;return w().w(function(t){for(;;)switch(t.p=t.n){case 0:if(r={doraConfig:null,packageConfig:null,tsconfigConfig:null,cdnConfig:null},t.p=1,!1===(null==e?void 0:e.doraConfig)){t.n=3;break}return t.n=2,q(n);case 2:r.doraConfig=t.v;case 3:t.n=5;break;case 4:t.p=4,t.v;case 5:if(t.p=5,!1===(null==e?void 0:e.packageConfig)){t.n=7;break}return t.n=6,J(n);case 6:r.packageConfig=t.v;case 7:t.n=9;break;case 8:t.p=8,t.v;case 9:if(t.p=9,!1===(null==e?void 0:e.tsconfigConfig)){t.n=11;break}return t.n=10,G(n);case 10:r.tsconfigConfig=t.v;case 11:t.n=13;break;case 12:t.p=12,t.v;case 13:if(t.p=13,!1===(null==e?void 0:e.cdnConfig)){t.n=15;break}return t.n=14,V(n);case 14:r.cdnConfig=t.v;case 15:t.n=17;break;case 16:t.p=16,t.v;case 17:return t.a(2,r)}},t,null,[[13,16],[9,12],[5,8],[1,4]])}));return function(n,e){return t.apply(this,arguments)}}(),xt=function(){var n=l(w().m(function n(e,r){return w().w(function(n){for(;;)switch(n.n){case 0:e.setCdnConfig(r.cdnConfig),e.setDoraConfig(r.doraConfig),e.setTsConfig(r.tsConfig),e.setPackageConfig(r.packageConfig),e.setWorkRoot(r.workRootDir||t.getCwd()),e.setCmd(r.cmd||{});case 1:return n.a(2)}},n)}));return function(t,e){return n.apply(this,arguments)}}(),jt='\n<html lang="zh-CN">\n <head>\n <meta charset="UTF-8" />\n <meta http-equiv="X-UA-Compatible" content="IE=edge" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>dora</title>\n </head>\n <body>\n <div id="main">welcome use dora !!</div>\n </body>\n</html>\n',Ot=function(){var t=l(w().m(function t(n){var e;return w().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,it(n);case 1:if(!(e=t.v)){t.n=2;break}return t.a(2,a.readFileSync(e,"utf-8"));case 2:return t.a(2,jt)}},t)}));return function(n){return t.apply(this,arguments)}}(),St=function(){var t=l(w().m(function t(n,e){var r,o,i,a;return w().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Z(n.doraConfig,e);case 1:return r=t.v,o=n.packageConfig||{},i=n.tsconfigConfig||{},t.n=2,Q(n.cdnConfig,e);case 2:return a=t.v,t.a(2,{doraConfig:r,packageConfig:o,tsConfig:i,cdnConfig:a})}},t)}));return function(n,e){return t.apply(this,arguments)}}(),Pt=["multiple"],Dt=function(){function t(n){var e;return p(this,t),(e=f(this,t)).configCtx=n,e}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&x(t,n)}(t,wt),h(t,[{key:"init",value:(n=l(w().m(function t(){var n,e,r,o;return w().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Ot(this.configCtx.getWorkRoot());case 1:return n=t.v,e=wt.parseHtml(n),r=e.head,o=e.body,this.addHeads(r),this.addBodys(o),t.a(2,this)}},t,this)})),function(){return n.apply(this,arguments)})},{key:"addConfigCdn",value:function(){var t,n,e,r,o=this.configCtx.getCdnConfig();return this.addHeads(null===(t=o.headAfterScript)||void 0===t?void 0:t.map(function(t){return{tagName:"script",attrs:[{name:"src",value:t}]}})),this.addHeads(null===(n=o.headAfterStyle)||void 0===n?void 0:n.map(function(t){return{tagName:"link",attrs:[{name:"href",value:t},{name:"rel",value:"stylesheet"}]}})),this.addBodys(null===(e=o.bodyAfterScript)||void 0===e?void 0:e.map(function(t){return{tagName:"script",attrs:[{name:"src",value:t}]}})),this.addBodys(null===(r=o.bodyBeforeScript)||void 0===r?void 0:r.map(function(t){return{tagName:"script",attrs:[{name:"src",value:t}]}})),this}},{key:"writeToFile",value:function(t){return a.existsSync(t)?a.appendFileSync(t,this.generateHtml(),{}):a.writeFileSync(t,this.generateHtml(),{}),this}},{key:"addBodyScripts",value:function(t){return this.addBodys(t.map(function(t){return{tagName:"script",attrs:[{name:"src",value:t}]}})),this}},{key:"addHeadStyles",value:function(t){return this.addHeads(t.map(function(t){return{tagName:"link",attrs:[{name:"href",value:t},{name:"rel",value:"stylesheet"}]}})),this}},{key:"copy",value:function(){var n=new t(this.configCtx);return n.addHeads(this.head),n.addBodys(this.body),n}}]);var n}(),Tt=function(){var n=l(w().m(function n(){var e,r,i,a=arguments;return w().w(function(n){for(;;)switch(n.n){case 0:return e=a.length>0&&void 0!==a[0]?a[0]:t.getCwd(),r=o.join(e,"tsconfig.json"),n.n=1,t.isValidFilePath(r);case 1:if(n.v){n.n=3;break}return i={$schema:"https://json.schemastore.org/tsconfig",compilerOptions:{target:"esnext",moduleResolution:"node",module:"esnext",noImplicitThis:!1,noImplicitAny:!1,noUnusedLocals:!1,noImplicitReturns:!0,noUnusedParameters:!1,useUnknownInCatchVariables:!1,allowSyntheticDefaultImports:!0,esModuleInterop:!0,emitDecoratorMetadata:!0,experimentalDecorators:!0,preserveConstEnums:!0,strictNullChecks:!0,strictFunctionTypes:!0,strictPropertyInitialization:!0,resolveJsonModule:!0,skipLibCheck:!0,alwaysStrict:!0,sourceMap:!1,paths:{"@/*":["./src/*"]}},exclude:["lib/**"],include:["**/*.ts","**/*.json"]},n.n=2,c.writeFile(r,JSON.stringify(i,null,2));case 2:_.info("init","success","自动注入 tsconfig.json");case 3:return n.a(2)}},n)}));return function(){return n.apply(this,arguments)}}();exports.picocolors=n,exports.CompilerBase=gt,exports.ConfigCtx=D,exports.DynamicHtml=vt,exports.EnvEnum=ht,exports.GenerateConfigHtml=Dt,exports.HtmlAssetManager=yt,exports.HtmlManage=wt,exports.cLog=_,exports.cLogDebugger=H,exports.cLogError=N,exports.cLogMessage=M,exports.cLogSuccess=R,exports.cLogTime=U,exports.cLogTimeEnd=I,exports.cLogWarn=B,exports.clearMw=function(){return function(t){return function(n){return l(w().m(function e(){return w().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,z(t);case 1:return e.a(2,n())}},e)}))}}},exports.collectBaseConfigMw=function(t,n){return function(e){return function(r){return function(){return e.setWorkRoot(t),e.setCmd(n),r()}}}},exports.collectCdnConfigMw=function(t){return function(n){return function(e){return l(w().m(function r(){var o;return w().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,ft(n.getWorkRoot(),t);case 1:return o=r.v,n.setCdnConfig(o||{bodyAfterScript:[],headAfterScript:[],headAfterStyle:[],bodyBeforeScript:[]}),r.a(2,e())}},r)}))}}},exports.collectConfig=lt,exports.collectConfigs=kt,exports.collectDoraConfigMw=function(t){return function(n){return function(e){return l(w().m(function r(){var o;return w().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,ct(n.getWorkRoot(),t);case 1:return o=r.v,n.setDoraConfig(o||{}),r.a(2,e())}},r)}))}}},exports.collectPackageJsonMw=function(){return function(t){return function(n){return l(w().m(function e(){var r;return w().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,J(t.getWorkRoot());case 1:return r=e.v,t.setPackageConfig(r||{}),e.a(2,n())}},e)}))}}},exports.collectTsconfigJsonMw=function(){return function(t){return function(n){return l(w().m(function e(){var r;return w().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,G(t.getWorkRoot());case 1:return r=e.v,t.setTsConfig(r||{}),e.a(2,n())}},e)}))}}},exports.configCtxCollect=xt,exports.configCtxWorkflow=function(t){var n=[];return{use:function(t){return n.push(t),this},getResult:function(){return l(w().m(function e(){return w().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,i.getOnionFun(t,n)(r.noop)();case 1:return e.a(2,t)}},e)}))()}}},exports.createDependFilter=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"exclude",e=t.dependencies,o=t.peerDependencies,i=t.devDependencies,a=t.externals,c=t.internals,u=t.compare,s={},l={};Object.keys(e||{}).forEach(function(t){s[t]=t}),Object.keys(o||{}).forEach(function(t){s[t]=t}),Object.keys(i||{}).forEach(function(t){s[t]=t}),null==a||a.forEach(function(t){r.isString(t)?s[t]=t:r.isPlainObject(t)&&Object.keys(t).forEach(function(n){s[n]=t[n]})}),null==c||c.forEach(function(t){r.isString(t)&&(l[t]=t)});var f="include"===n;return function(t){var n=!1,e=Object.keys(s).find(function(n){return r.isFunction(u)?u(t,n):t.startsWith(n)}),o=Object.keys(l).find(function(n){return r.isFunction(u)?u(t,n):t.startsWith(n)});return f?o?n=!1:e&&(n=s[e]):e?n=s[e]:o&&(n=!1),n}},exports.createEnvParams=function(n){var e=n.workRootDir||"./";return o.isAbsolute(n.workRootDir)||(e=o.join(t.getCwd(),e)),b(b({},n),{},{workRootDir:e})},exports.createOutputList=function(n){var e=n.input,o=n.output,i=n.formatList,a=n.format,c=o.path,u=o.file,s=[];return a?s.push({input:e,format:a,outputFile:u||t.getFilename(e)||"index.js",outputPath:c||"dist"}):r.isArray(i)?i.forEach(function(n){s.push({input:e,format:n,outputFile:u||t.getFilename(e)||"index.js",outputPath:c||"dist"})}):s.push({input:e,format:"iife",outputFile:u||t.getFilename(e)||"index.js",outputPath:c||"dist"}),s},exports.deepMergeObject=K,exports.findInput=rt,exports.findInputHtml=it,exports.getDefaultHtml=Ot,exports.getDependencies=function(t){return b(b(b({},t.dependencies),t.peerDependencies),t.devDependencies)},exports.getDoracliConfig=q,exports.getPackageJson=J,exports.getTsPathAlias=function(t){var n=((null==t?void 0:t.compilerOptions)||{}).paths;if(!n)return{};var e={};return Object.entries(n).forEach(function(t){var n=j(t,2),r=n[0],i=n[1],a=r.replace(/\/\*$/,"");if(null!=i&&i.length&&!e[a]){var c=i[0].replace(/\/\*$/,"");e[a]=o.resolve(c)}}),e},exports.getTsconfigJson=G,exports.getUserCdn=V,exports.htmlDefault=jt,exports.inputFileDirList=nt,exports.inputFileTypeList=et,exports.inputHtmlFileDirList=ot,exports.insertTsconfig=Tt,exports.mergeDoraCliConfig=Y,exports.mergeDoraCliConfigMutiple=X,exports.parseCdnConfig=Q,exports.parseDoracliConfig=Z,exports.parseHtml=bt,exports.parsetConfig=St,exports.resolveCdnConfig=ft,exports.resolveDoraConfig=ct,exports.resolvePackageJson=ut,exports.resolveTsconfigJson=st,exports.setLogLevel=function(t){E=t},exports.splitDoraCliConfig=function(t){var n=t.multiple,e=C(t,tt);return r.isArray(n)?0===n.length?[e]:1===n.length?[X(e,n[0])]:n.map(function(t){return X(e,t)}):[e]},exports.splitDoraConfig=function(t){var n=t.multiple,e=C(t,Pt);return r.isArray(n)?0===n.length?[e]:1===n.length?[X(n[0],e)]:n.map(function(t){return X(e,t)}):[e]},exports.wholeDoraConfig=at,exports.wholeDoraConfigMw=function(t){return function(n){return function(e){return function(){var o=Y(t,n.getDoraConfig()),i=o.alias,a=o.clear,c=o.copy,u=o.dts,s=o.lib,l=o.format,f=o.libList,p=o.name,d=o.type,h=o.externals,g=o.formatList,v=o.input,y=o.internals,m=o.minimize,b=o.multiple,C=o.output,w=o.rollupConfig,k=o.webpackConfig,x=o.esbuildConfig,j=o.rspackConfig,O=o.serviceConfig,S=o.dtsConfig,P=o.browserExtensionConfig;return n.setDoraConfig({multiple:!r.isUndefinedOrNull(b)&&b,name:p,type:d,format:l,formatList:g,lib:s,libList:f,alias:i||{},clear:!r.isUndefinedOrNull(a)&&a,copy:c||[],dts:r.isUndefinedOrNull(u)?{}:u,externals:h||[],input:v,internals:y||[],minimize:!r.isUndefinedOrNull(m)&&m,output:C,rollupConfig:w||{},webpackConfig:k||{},esbuildConfig:x||{},rspackConfig:j||{},serviceConfig:O||{},browserExtensionConfig:P||{},dtsConfig:S}),e()}}}},exports.wholeDoraInoutMw=function(){return function(n){return function(e){return function(){var r=n.getDoraConfig(),o=r.input,i=r.output,a=r.multiple,c=C(r,dt),u=n.getWorkRoot(),s=o,l=(null==i?void 0:i.path)||"./dist",f=null==i?void 0:i.file;return a||(t.isValidFilePathSync(s||"")||(s=rt(u)),s||_.error("init","not_found","找不到入口文件"),f=(null==i?void 0:i.file)||t.getFilename(s)),n.setDoraConfig(b(b({},c),{},{input:s,output:i||{path:l,file:f},multiple:a})),e()}}}};
package/lib/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import{cleanTargets as n,isValidDir as t,resolveCwd as e,lookupFile as r,getCwd as o,isValidFilePathSync as i,getFilename as a,isValidFilePath as u}from"@dorabag/file-pro";import c from"picocolors";export{default as picocolors}from"picocolors";import{loadConfigFuzzyExt as s,loadConfig as f}from"@dorabag/config-loader";import{isObject as l,isFunction as p,isArray as d,isUndefinedOrNull as h,noop as v,isString as g,isPlainObject as y}from"@cclr/lang";import{resolve as m,isAbsolute as b,join as w}from"path";import{getOnionFun as k}from"@cclr/utils";import{readFileSync as C,existsSync as j,writeFileSync as O,appendFileSync as S}from"fs";import{writeFile as P}from"fs/promises";function x(n,t){(null==t||t>n.length)&&(t=n.length);for(var e=0,r=Array(t);e<t;e++)r[e]=n[e];return r}function T(n,t,e,r,o,i,a){try{var u=n[i](a),c=u.value}catch(n){return void e(n)}u.done?t(c):Promise.resolve(c).then(r,o)}function A(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var i=n.apply(t,e);function a(n){T(i,r,o,a,u,"next",n)}function u(n){T(i,r,o,a,u,"throw",n)}a(void 0)})}}function D(n,t,e){return t=L(t),function(n,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(n)}(n,W()?Reflect.construct(t,[],L(n).constructor):t.apply(n,e))}function E(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function R(n,t){for(var e=0;e<t.length;e++){var r=t[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,$(r.key),r)}}function H(n,t,e){return t&&R(n.prototype,t),e&&R(n,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function B(n,t,e){return(t=$(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function L(n){return L=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},L(n)}function W(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(n){}return(W=function(){return!!n})()}function M(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})),e.push.apply(e,r)}return e}function N(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?M(Object(e),!0).forEach(function(t){B(n,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):M(Object(e)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))})}return n}function _(n,t){if(null==n)return{};var e,r,o=function(n,t){if(null==n)return{};var e={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(-1!==t.indexOf(r))continue;e[r]=n[r]}return e}(n,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);for(r=0;r<i.length;r++)e=i[r],-1===t.indexOf(e)&&{}.propertyIsEnumerable.call(n,e)&&(o[e]=n[e])}return o}function I(){
1
+ import{cleanTargets as n,isValidDir as t,resolveCwd as e,lookupFile as r,getCwd as o,isValidFilePathSync as i,getFilename as a,isValidFilePath as u}from"@dorabag/file-pro";import c from"picocolors";export{default as picocolors}from"picocolors";import{loadConfigFuzzyExt as s,loadConfig as f}from"@dorabag/config-loader";import{isObject as l,isFunction as p,isArray as d,isUndefinedOrNull as h,noop as v,isString as g,isPlainObject as y}from"@cclr/lang";import{resolve as m,isAbsolute as b,join as w}from"path";import{getOnionFun as C}from"@cclr/utils";import{readFileSync as k,existsSync as j,writeFileSync as O,appendFileSync as S}from"fs";import{writeFile as P}from"fs/promises";function x(n,t){(null==t||t>n.length)&&(t=n.length);for(var e=0,r=Array(t);e<t;e++)r[e]=n[e];return r}function T(n,t,e,r,o,i,a){try{var u=n[i](a),c=u.value}catch(n){return void e(n)}u.done?t(c):Promise.resolve(c).then(r,o)}function E(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var i=n.apply(t,e);function a(n){T(i,r,o,a,u,"next",n)}function u(n){T(i,r,o,a,u,"throw",n)}a(void 0)})}}function A(n,t,e){return t=L(t),function(n,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(n)}(n,W()?Reflect.construct(t,[],L(n).constructor):t.apply(n,e))}function D(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function R(n,t){for(var e=0;e<t.length;e++){var r=t[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,$(r.key),r)}}function H(n,t,e){return t&&R(n.prototype,t),e&&R(n,e),Object.defineProperty(n,"prototype",{writable:!1}),n}function B(n,t,e){return(t=$(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}function L(n){return L=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},L(n)}function W(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(n){}return(W=function(){return!!n})()}function M(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable})),e.push.apply(e,r)}return e}function N(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?M(Object(e),!0).forEach(function(t){B(n,t,e[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):M(Object(e)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))})}return n}function _(n,t){if(null==n)return{};var e,r,o=function(n,t){if(null==n)return{};var e={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(-1!==t.indexOf(r))continue;e[r]=n[r]}return e}(n,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);for(r=0;r<i.length;r++)e=i[r],-1===t.indexOf(e)&&{}.propertyIsEnumerable.call(n,e)&&(o[e]=n[e])}return o}function I(){
2
2
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
3
- var n,t,e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return F(s,"_invoke",function(e,r,o){var i,u,c,s=0,f=o||[],l=!1,p={p:0,n:0,v:n,a:d,f:d.bind(n,4),d:function(t,e){return i=t,u=0,c=n,p.n=e,a}};function d(e,r){for(u=e,c=r,t=0;!l&&s&&!o&&t<f.length;t++){var o,i=f[t],d=p.p,h=i[2];e>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=n):i[0]<=d&&((o=e<2&&d<i[1])?(u=0,p.v=r,p.n=i[1]):d<h&&(o=e<3||i[0]>r||r>h)&&(i[4]=e,i[5]=r,p.n=h,u=0))}if(o||e>1)return a;throw l=!0,r}return function(o,f,h){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&d(f,h),u=f,c=h;(t=u<2?n:c)||!l;){i||(u?u<3?(u>1&&(p.n=-1),d(u,c)):p.n=c:p.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=n}else if((t=(l=p.n<0)?c:e.call(r,p))!==a)break}catch(t){i=n,u=1,c=t}finally{s=1}}return{value:t,done:l}}}(e,o,i),!0),s}var a={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(F(t={},r,function(){return this}),t),l=s.prototype=u.prototype=Object.create(f);function p(n){return Object.setPrototypeOf?Object.setPrototypeOf(n,s):(n.__proto__=s,F(n,o,"GeneratorFunction")),n.prototype=Object.create(l),n}return c.prototype=s,F(l,"constructor",s),F(s,"constructor",c),c.displayName="GeneratorFunction",F(s,o,"GeneratorFunction"),F(l),F(l,o,"Generator"),F(l,r,function(){return this}),F(l,"toString",function(){return"[object Generator]"}),(I=function(){return{w:i,m:p}})()}function F(n,t,e,r){var o=Object.defineProperty;try{o({},"",{})}catch(n){o=0}F=function(n,t,e,r){function i(t,e){F(n,t,function(n){return this._invoke(t,e,n)})}t?o?o(n,t,{value:e,enumerable:!r,configurable:!r,writable:!r}):n[t]=e:(i("next",0),i("throw",1),i("return",2))},F(n,t,e,r)}function U(n,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,t){return n.__proto__=t,n},U(n,t)}function z(n,t){return function(n){if(Array.isArray(n))return n}(n)||function(n,t){var e=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=e){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(e=e.call(n)).next,0===t);else for(;!(c=(r=i.call(e)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(n){s=!0,o=n}finally{try{if(!c&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(n,t)||J(n,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(n){return function(n){if(Array.isArray(n))return x(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||J(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(n){var t=function(n,t){if("object"!=typeof n||!n)return n;var e=n[Symbol.toPrimitive];if(void 0!==e){var r=e.call(n,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(n)}(n,"string");return"symbol"==typeof t?t:t+""}function J(n,t){if(n){if("string"==typeof n)return x(n,t);var e={}.toString.call(n).slice(8,-1);return"Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(n):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?x(n,t):void 0}}var Y=function(){function n(){E(this,n),B(this,"tsConfig",{}),B(this,"doraConfig",{}),B(this,"packageConfig",{}),B(this,"cdnConfig",{}),B(this,"cmd",{}),B(this,"workRoot","./")}return H(n,[{key:"setCmd",value:function(n){this.cmd=n}},{key:"getCmd",value:function(){return this.cmd}},{key:"setWorkRoot",value:function(n){this.workRoot=n}},{key:"getWorkRoot",value:function(){return this.workRoot}},{key:"setTsConfig",value:function(n){this.tsConfig=n}},{key:"getTsConfig",value:function(){return this.tsConfig}},{key:"setDoraConfig",value:function(n){this.doraConfig=n}},{key:"getDoraConfig",value:function(){return this.doraConfig}},{key:"setCdnConfig",value:function(n){this.cdnConfig=n}},{key:"getCdnConfig",value:function(){return this.cdnConfig}},{key:"setPackageConfig",value:function(n){this.packageConfig=n}},{key:"getPackageConfig",value:function(){return this.packageConfig}},{key:"copy",value:function(){var t=new n;return t.setWorkRoot(this.getWorkRoot()),t.setTsConfig(this.getTsConfig()),t.setDoraConfig(this.getDoraConfig()),t.setPackageConfig(this.getPackageConfig()),t.setCdnConfig(this.getCdnConfig()),t.setCmd(this.getCmd()),t}}])}(),q="@doracli",V=10,X=function(n){V=n},K=function(n,t){return n.length>=t?n:n+" ".repeat(t-n.length)},Q=function(n){return K(n,5)},Z=function(n){return K(n,9).toUpperCase()},nn=function(n,t){var e;if(!(V>0)){for(var r=c.bgBlack("[".concat(c.magenta(q),":").concat(c.bold(" ".concat(Q(n))),"]")),o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];return(e=console).debug.apply(e,["".concat(r," [").concat(Z(t),"]")].concat(i))}},tn=function(n,t){var e;if(!(V>10)){for(var r=c.bgBlack("[".concat(c.magenta(q),":").concat(c.bold(" ".concat(Q(n))),"]")),o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];return(e=console).log.apply(e,["".concat(r," [").concat(c.yellow(Z(t)),"]")].concat(i))}},en=function(n,t){var e;if(!(V>100)){for(var r=c.bgBlack("[".concat(c.magenta(q),":").concat(c.bold(" ".concat(Q(n))),"]")),o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];return(e=console).log.apply(e,["".concat(r," [").concat(c.green(Z(t)),"]")].concat(i))}},rn=function(n,t){var e;if(!(V>1e3)){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return(e=console).log.apply(e,[c.bgYellow("[".concat(q,": ").concat(Q(n),"] [").concat(Z(t),"]"))].concat(o))}},on=function(n,t){var e;if(!(V>1e4)){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return(e=console).log.apply(e,[c.bgRed("[".concat(q,": ").concat(Q(n),"] [").concat(Z(t),"]"))].concat(o))}},an=0,un=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"cLogTimeStart-".concat(an);return an++,console.time(n),function(){console.timeEnd(n)}},cn=function(n){console.timeEnd(n)},sn={log:tn,debug:nn,error:on,warn:rn,info:en,time:un,timeEnd:cn},fn=function(){return function(n){return function(t){return A(I().m(function e(){return I().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,ln(n);case 1:return e.a(2,t())}},e)}))}}},ln=function(){var e=A(I().m(function e(r){var o,i,a,u;return I().w(function(e){for(;;)switch(e.p=e.n){case 0:if(o=r.getDoraConfig(),i=o.clear,a=o.output,u=(a||{}).path,e.p=1,i){e.n=2;break}return e.a(2);case 2:if(u){e.n=3;break}return e.a(2);case 3:return e.n=4,t(u);case 4:if(e.v){e.n=5;break}return e.a(2);case 5:return e.n=6,n(u);case 6:e.n=8;break;case 7:e.p=7,e.v,sn.warn("clear","warn","清空目标文件夹失败: ".concat(u));case 8:return e.a(2)}},e,null,[[1,7]])}));return function(n){return e.apply(this,arguments)}}(),pn=function(n){return N(N(N({},n.dependencies),n.peerDependencies),n.devDependencies)},dn=function(){var n=A(I().m(function n(t){var r,o;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,s("doracli.config",{rootDir:e(t)});case 1:if(r=n.v){n.n=2;break}return sn.warn("file","undefined","未定义 doracli 配置文件"),n.a(2,null);case 2:return sn.debug("file","success","引入 doracli 配置文件成功"),n.a(2,r.default||r);case 3:return n.p=3,o=n.v,sn.error("file","fail","引入 doracli 配置文件失败"),console.error(o),n.a(2,Promise.reject(o))}},n,null,[[0,3]])}));return function(t){return n.apply(this,arguments)}}(),hn=function(){var n=A(I().m(function n(){var t,r,o,i=arguments;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:"",n.p=1,n.n=2,f(e(t,"package.json"));case 2:return r=n.v,sn.debug("file","success","引入 package.json 成功"),n.a(2,r);case 3:n.p=3,o=n.v,sn.error("file","fail","引入 package.json 失败"),sn.debug("file","error",o);case 4:return n.a(2)}},n,null,[[1,3]])}));return function(){return n.apply(this,arguments)}}(),vn=function(){var n=A(I().m(function n(t){var r,o;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,f(e(t,"./tsconfig.json"));case 1:return r=n.v,sn.debug("file","success","引入 tsconfig.json 成功"),n.a(2,r);case 2:n.p=2,o=n.v,sn.error("file","failed","引入 tsconfig.json 失败"),sn.debug("file","error",o);case 3:return n.a(2)}},n,null,[[0,2]])}));return function(t){return n.apply(this,arguments)}}();function gn(n){return yn.apply(this,arguments)}function yn(){return(yn=A(I().m(function n(t){var r,o;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,s("cdn",{rootDir:e(t)});case 1:if(null!=(r=n.v)&&r.default){n.n=2;break}return sn.log("file","undefined","未定义 cdn 配置文件"),n.a(2,null);case 2:return sn.info("file","success","引入 cdn 成功"),n.a(2,r.default);case 3:return n.p=3,o=n.v,sn.error("file","failed","引入 cdn 失败"),sn.debug("file","failed",o),n.a(2,null)}},n,null,[[0,3]])}))).apply(this,arguments)}var mn=function(n){return wn(n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})},bn=function(){for(var n=arguments.length,t=new Array(n),e=0;e<n;e++)t[e]=arguments[e];return t.reduce(function(n,t){return mn(n,t)})},wn=function(n,t){if(!t)return n;if(!n)return t;var e=N({},n);for(var r in t)l(t[r])?e[r]=wn(n[r],t[r]):e[r]=t[r];return e};function kn(n,t){try{if(!l(n))return;return Object.entries(n).reduce(function(n,e){var r=z(e,2),o=r[0],i=r[1];return p(i)?n[o]=i(t)||[]:d(i)&&(n[o]=i),n},{})}catch(n){throw sn.error("parse","parseCdnConfig","解析用户cdn配置失败"),new Error(n)}}var Cn=function(){var n=A(I().m(function n(t,e){var r,o;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:if(n.p=0,r=t,!p(t)){n.n=2;break}return n.n=1,t(e);case 1:r=n.v;case 2:return n.a(2,r);case 3:throw n.p=3,o=n.v,sn.error("resolve ","resolveUserConfigJson","解析用户配置失败"),new Error(o);case 4:return n.a(2)}},n,null,[[0,3]])}));return function(t,e){return n.apply(this,arguments)}}(),jn=["multiple"],On=function(n){var t=n.multiple,e=_(n,jn);return d(t)?0===t.length?[e]:1===t.length?[bn(e,t[0])]:t.map(function(n){return bn(e,n)}):[e]},Sn=["src/index","index"],Pn=[".ts",".js",".tsx",".jsx"],xn=function(n){var t=Sn.reduce(function(n,t){return Pn.forEach(function(e){n.push("./"+t+e)}),n},[]);return r(t,n)},Tn=["index.html","public/index.html"],An=function(n){return r(Tn,n)},Dn=function(n){var t=((null==n?void 0:n.compilerOptions)||{}).paths;if(!t)return{};var e={};return Object.entries(t).forEach(function(n){var t=z(n,2),r=t[0],o=t[1],i=r.replace(/\/\*$/,"");if(null!=o&&o.length&&!e[i]){var a=o[0].replace(/\/\*$/,"");e[i]=m(a)}}),e},En=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o(),e=n.type,r=n.name,u=n.lib,c=n.libList,s=n.alias,f=n.clear,l=n.copy,p=n.dts,d=n.externals,v=n.formatList,g=n.input,y=n.internals,m=n.minimize,b=n.multiple,w=n.output,k=n.rollupConfig,C=n.webpackConfig,j=n.esbuildConfig,O=n.rspackConfig,S=n.format,P=n.serviceConfig,x=g,T=(null==w?void 0:w.path)||"./dist",A=null==w?void 0:w.file,D=[];return b||(i(x||"")||(x=xn(t)),x||sn.error("init","not_found","找不到入口文件"),A=(null==w?void 0:w.file)||a(x)),c||(D=u?[u]:null!=v&&v.length?v.map(function(n){return{format:n}}):[{format:S||"cjs"}]),{multiple:!h(b)&&b,type:e,name:r,alias:s||{},clear:!h(f)&&f,copy:l||[],dts:h(p)?{}:p,externals:d||[],formatList:v||["cjs"],libList:D,input:g,internals:y||[],minimize:!h(m)&&m,output:w||{path:T,file:A},rollupConfig:k||{},webpackConfig:C||{},esbuildConfig:j||{},rspackConfig:O||{},serviceConfig:P||{}}},Rn=function(){var n=A(I().m(function n(t,e){var r;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,dn(t);case 1:return r=n.v,n.a(2,Cn(r,e));case 2:return n.p=2,n.v,sn.log("resolve ","error","doracli.config 解析用户配置失败"),n.a(2,{})}},n,null,[[0,2]])}));return function(t,e){return n.apply(this,arguments)}}(),Hn=function(){var n=A(I().m(function n(t){var e;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,hn(t);case 1:return e=n.v,n.a(2,e);case 2:return n.p=2,n.v,sn.log("resolve ","error","package.json 解析用户配置失败"),n.a(2,{})}},n,null,[[0,2]])}));return function(t){return n.apply(this,arguments)}}(),Bn=function(){var n=A(I().m(function n(t){var e;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,vn(t);case 1:return e=n.v,n.a(2,e);case 2:return n.p=2,n.v,sn.log("resolve ","error","tsconfig.json 解析用户配置失败"),n.a(2,{})}},n,null,[[0,2]])}));return function(t){return n.apply(this,arguments)}}(),Ln=function(){var n=A(I().m(function n(t,e,r){var o,i,a,u;return I().w(function(n){for(;;)switch(n.n){case 0:return o=t.getWorkRoot(),n.n=1,Bn(o);case 1:return i=n.v,n.n=2,Rn(o,e);case 2:return a=n.v,n.n=3,Hn(o);case 3:u=n.v,t.setPackageConfig(u),t.setDoraConfig(En(mn((null==r?void 0:r.doraConfig)||{},a||{}),o)),t.setTsConfig(i);case 4:return n.a(2)}},n)}));return function(t,e,r){return n.apply(this,arguments)}}();function Wn(n,t){return Mn.apply(this,arguments)}function Mn(){return(Mn=A(I().m(function n(t,e){var r;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,gn(t);case 1:return r=n.v,n.a(2,kn(r,e));case 2:return n.p=2,n.v,sn.log("resolve ","resolveUserCdn","解析用户cdn配置失败"),n.a(2,{})}},n,null,[[0,2]])}))).apply(this,arguments)}var Nn=function(){return function(n){return function(t){return A(I().m(function e(){var r;return I().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,hn(n.getWorkRoot());case 1:return r=e.v,n.setPackageConfig(r||{}),e.a(2,t())}},e)}))}}},_n=function(){return function(n){return function(t){return A(I().m(function e(){var r;return I().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,vn(n.getWorkRoot());case 1:return r=e.v,n.setTsConfig(r||{}),e.a(2,t())}},e)}))}}},In=function(n){return function(t){return function(e){return A(I().m(function r(){var o;return I().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,Wn(t.getWorkRoot(),n);case 1:return o=r.v,t.setCdnConfig(o||{bodyAfterScript:[],headAfterScript:[],headAfterStyle:[],bodyBeforeScript:[]}),r.a(2,e())}},r)}))}}},Fn=function(n){return function(t){return function(e){return A(I().m(function r(){var o;return I().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,Rn(t.getWorkRoot(),n);case 1:return o=r.v,t.setDoraConfig(o||{}),r.a(2,e())}},r)}))}}},Un=function(n,t){return function(e){return function(r){return function(){return e.setWorkRoot(n),e.setCmd(t),r()}}}},zn=function(n){return function(t){return function(e){return function(){var r=mn(n,t.getDoraConfig()),o=r.alias,i=r.clear,a=r.copy,u=r.dts,c=r.lib,s=r.format,f=r.libList,l=r.name,p=r.type,d=r.externals,v=r.formatList,g=r.input,y=r.internals,m=r.minimize,b=r.multiple,w=r.output,k=r.rollupConfig,C=r.webpackConfig,j=r.esbuildConfig,O=r.rspackConfig,S=r.serviceConfig,P=r.dtsConfig;return t.setDoraConfig({multiple:!h(b)&&b,name:l,type:p,format:s,formatList:v,lib:c,libList:f,alias:o||{},clear:!h(i)&&i,copy:a||[],dts:h(u)?{}:u,externals:d||[],input:g,internals:y||[],minimize:!h(m)&&m,output:w,rollupConfig:k||{},webpackConfig:C||{},esbuildConfig:j||{},rspackConfig:O||{},serviceConfig:S||{},dtsConfig:P}),e()}}}},Gn=["input","output","multiple"],$n=function(){return function(n){return function(t){return function(){var e=n.getDoraConfig(),r=e.input,o=e.output,u=e.multiple,c=_(e,Gn),s=n.getWorkRoot(),f=r,l=(null==o?void 0:o.path)||"./dist",p=null==o?void 0:o.file;return u||(i(f||"")||(f=xn(s)),f||sn.error("init","not_found","找不到入口文件"),p=(null==o?void 0:o.file)||a(f)),n.setDoraConfig(N(N({},c),{},{input:f,output:o||{path:l,file:p},multiple:u})),t()}}}},Jn=function(n){var t=[];return{use:function(n){return t.push(n),this},getResult:function(){return A(I().m(function e(){return I().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,k(n,t)(v)();case 1:return e.a(2,n)}},e)}))()}}},Yn=function(n){return n.dev="development",n.prod="production",n}({}),qn=H(function n(t){E(this,n),this.initOptions=t,B(this,"inOutMap",void 0),B(this,"input",void 0),B(this,"context",void 0),B(this,"build",void 0),B(this,"watch",void 0),B(this,"server",void 0)}),Vn=function(){function n(){E(this,n),B(this,"headScripts",[]),B(this,"bodyScripts",[]),B(this,"headStyles",[]),B(this,"headTags",[]),B(this,"bodyTags",['<div id="main"></div>'])}return H(n,[{key:"addHeadScripts",value:function(n){var t;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.headScripts=[]),(t=this.headScripts).push.apply(t,G(n))}},{key:"addBodyScripts",value:function(n){var t;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.bodyScripts=[]),(t=this.bodyScripts).push.apply(t,G(n))}},{key:"addHeadStyles",value:function(n){var t;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.headStyles=[]),(t=this.headStyles).push.apply(t,G(n))}},{key:"addHeadTags",value:function(n){var t;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.headTags=[]),(t=this.headTags).push.apply(t,G(n))}},{key:"addBodyTags",value:function(n){var t;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.bodyTags=n),(t=this.bodyTags).push.apply(t,G(n))}},{key:"copy",value:function(){var t=new n;return t.addHeadScripts(this.headScripts,!0),t.addBodyScripts(this.bodyScripts,!0),t.addHeadStyles(this.headStyles,!0),t}},{key:"generateHtmlTemplate",value:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Document",t=this.headScripts.sort(function(n,t){return(n.order||0)-(t.order||0)}).map(function(n){var t=['src="'.concat(n.src,'"'),n.async?"async":"",n.defer?"defer":""].filter(Boolean).join(" ");return"<script ".concat(t,"><\/script>")}).join("\n"),e=this.bodyScripts.sort(function(n,t){return(n.order||0)-(t.order||0)}).map(function(n){var t=['src="'.concat(n.src,'"'),n.async?"async":"",n.defer?"defer":""].filter(Boolean).join(" ");return"<script ".concat(t,"><\/script>")}).join("\n"),r=this.headStyles.sort(function(n,t){return(n.order||0)-(t.order||0)}).map(function(n){var t=['href="'.concat(n.src,'"'),'rel="stylesheet"',n.async?"async":"",n.defer?"defer":""].filter(Boolean).join(" ");return"<link ".concat(t,">")}).join("\n"),o=this.headTags.map(function(n){return n}).join("\n"),i=this.bodyTags.map(function(n){return n}).join("\n");return'<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>'.concat(n,"</title>\n ").concat(o,"\n ").concat(r,"\n ").concat(t,"\n</head>\n<body>\n ").concat(i,"\n ").concat(e,"\n</body>\n</html>")}}])}(),Xn=function(){return H(function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";E(this,n),this.publicPath=t,B(this,"assetMap",{}),B(this,"dynamicHtml",new Vn),B(this,"initAwaitList",[]),B(this,"assetList",[])},[{key:"updateAssetList",value:function(n){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.assetList=t?n:Array.from(new Set([].concat(G(this.assetList),G(n))))}},{key:"updateAssetMap",value:function(n){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.assetMap=t?n:N(N({},this.assetMap),n),this.initAwaitList.forEach(function(n){return n()}),this.initAwaitList=[]}},{key:"getAssetMap",value:function(){return this.assetMap}},{key:"getModuleAsset",value:function(n){return this.assetMap[n]||{name:n,scripts:[],styles:[],runtimeChunks:[]}}},{key:"getModuleHtml",value:(n=A(I().m(function n(t){var e,r,o=this;return I().w(function(n){for(;;)switch(n.n){case 0:if(0!==Object.keys(this.assetMap).length){n.n=1;break}return n.n=1,new Promise(function(n){o.initAwaitList.push(function(){n()})});case 1:if(e=this.assetMap[t]){n.n=2;break}throw new Error("Module ".concat(t," asset not found."));case 2:return(r=this.dynamicHtml.copy()).addBodyScripts(e.scripts.map(function(n){return{src:n,order:0}})),r.addHeadStyles(e.styles.map(function(n){return{src:n,order:0}})),n.a(2,r.generateHtmlTemplate())}},n,this)})),function(t){return n.apply(this,arguments)})}]);var n}(),Kn=function(n){var t,e;return n.selfClosing?"<".concat(n.tagName," ").concat(null===(e=n.attrs)||void 0===e?void 0:e.map(function(n){return"".concat(n.name,'="').concat(n.value,'"')}).join(" ")," />"):"<".concat(n.tagName," ").concat(null===(t=n.attrs)||void 0===t?void 0:t.map(function(n){return"".concat(n.name,'="').concat(n.value,'"')}).join(" "),">").concat((n.children||[]).map(function(n){return"string"==typeof n?n:Kn(n)}).join(""),"</").concat(n.tagName,">")},Qn=function(n){var t=/<head[^>]*>([\s\S]*?)<\/head>/i.exec(n),e=/<body[^>]*>([\s\S]*?)<\/body>/i.exec(n),r=t?t[1]:"",o=e?e[1]:"";return{head:Zn(r),body:Zn(o)}},Zn=function(n){var t=[],e=[];if(!n)return t;for(var r=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=function(n){for(var t,e=[],r=/([^\s=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>/]+)))?/g;t=r.exec(n);){var o,i,a=t[1],u=null!==(o=null!==(i=t[2])&&void 0!==i?i:t[3])&&void 0!==o?o:t[4];void 0===u?e.push({name:a,value:!0}):e.push({name:a,value:u})}return e},i=0,a=n.length;i<a;){if("<"!==n[i]){var u=n.indexOf("<",i),c=-1===u?a:u,s=n.slice(i,c).trim();if(s&&e.length){var f=e[e.length-1];f.children||(f.children=[]),f.children.push(s)}i=c}else{var l=n.indexOf(">",i+1);if(-1===l)break;var p=n.slice(i+1,l).trim();if(p.startsWith("!")||p.startsWith("?")||p.startsWith("--")){i=l+1;continue}if(p.startsWith("/")){p.slice(1).trim().split(/\s+/)[0].toLowerCase();if(e.length)e[e.length-1].tagName.toLowerCase(),e.pop();i=l+1;continue}var d=p.endsWith("/"),h=p.replace(/\/\s*$/,"").trim(),v=h.search(/\s/),g=(-1===v?h:h.slice(0,v)).toLowerCase(),y=-1===v?"":h.slice(v+1).trim(),m=d||r.has(g),b={tagName:g,attrs:o(y),selfClosing:m,children:[]};if(0===e.length)t.push(b);else{var w=e[e.length-1];w.children||(w.children=[]),w.children.push(b)}m||e.push(b),i=l+1}}return t},nt=function(){function n(t){var e,r;E(this,n),B(this,"head",[]),B(this,"body",[]),this.head=null!==(e=null==t?void 0:t.head)&&void 0!==e?e:[],this.body=null!==(r=null==t?void 0:t.body)&&void 0!==r?r:[]}return H(n,[{key:"addHead",value:function(n){return n?(this.head.push(n),this):this}},{key:"addHeads",value:function(n){var t;return n?((t=this.head).push.apply(t,G(n)),this):this}},{key:"addBody",value:function(n){return n?(this.body.push(n),this):this}},{key:"addBodys",value:function(n){var t;return n?((t=this.body).push.apply(t,G(n)),this):this}},{key:"parseHtmlByFile",value:function(t){var e=C(t,"utf-8"),r=n.parseHtml(e),o=r.head,i=r.body;return this.head=o,this.body=i,this}},{key:"generateHtml",value:function(){return n={head:this.head,body:this.body},t=n.head,e=n.body,"\n <html>\n <head>\n ".concat(t.map(function(n){return Kn(n)}).join("\n"),"\n </head>\n <body>\n ").concat(e.map(function(n){return Kn(n)}).join("\n"),"\n </body>\n </html>\n ");var n,t,e}},{key:"copy",value:function(){return new n({head:this.head.map(function(n){return N({},n)}),body:this.body.map(function(n){return N({},n)})})}}],[{key:"parseHtml",value:function(n){return Qn(n)}}])}(),tt=function(){var n=A(I().m(function n(t,e){var r;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:if(r={doraConfig:null,packageConfig:null,tsconfigConfig:null,cdnConfig:null},n.p=1,!1===(null==e?void 0:e.doraConfig)){n.n=3;break}return n.n=2,dn(t);case 2:r.doraConfig=n.v;case 3:n.n=5;break;case 4:n.p=4,n.v;case 5:if(n.p=5,!1===(null==e?void 0:e.packageConfig)){n.n=7;break}return n.n=6,hn(t);case 6:r.packageConfig=n.v;case 7:n.n=9;break;case 8:n.p=8,n.v;case 9:if(n.p=9,!1===(null==e?void 0:e.tsconfigConfig)){n.n=11;break}return n.n=10,vn(t);case 10:r.tsconfigConfig=n.v;case 11:n.n=13;break;case 12:n.p=12,n.v;case 13:if(n.p=13,!1===(null==e?void 0:e.cdnConfig)){n.n=15;break}return n.n=14,gn(t);case 14:r.cdnConfig=n.v;case 15:n.n=17;break;case 16:n.p=16,n.v;case 17:return n.a(2,r)}},n,null,[[13,16],[9,12],[5,8],[1,4]])}));return function(t,e){return n.apply(this,arguments)}}(),et=function(){var n=A(I().m(function n(t,e){return I().w(function(n){for(;;)switch(n.n){case 0:t.setCdnConfig(e.cdnConfig),t.setDoraConfig(e.doraConfig),t.setTsConfig(e.tsConfig),t.setPackageConfig(e.packageConfig),t.setWorkRoot(e.workRootDir||o()),t.setCmd(e.cmd||{});case 1:return n.a(2)}},n)}));return function(t,e){return n.apply(this,arguments)}}(),rt=function(n){var t=n.workRootDir||"./";return b(n.workRootDir)||(t=w(o(),t)),N(N({},n),{},{workRootDir:t})},ot=function(n){var t=n.input,e=n.output,r=n.formatList,o=n.format,i=e.path,u=e.file,c=[];return o?c.push({input:t,format:o,outputFile:u||a(t)||"index.js",outputPath:i||"dist"}):d(r)?r.forEach(function(n){c.push({input:t,format:n,outputFile:u||a(t)||"index.js",outputPath:i||"dist"})}):c.push({input:t,format:"iife",outputFile:u||a(t)||"index.js",outputPath:i||"dist"}),c},it=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"exclude",e=n.dependencies,r=n.peerDependencies,o=n.devDependencies,i=n.externals,a=n.internals,u=n.compare,c={},s={};Object.keys(e||{}).forEach(function(n){c[n]=n}),Object.keys(r||{}).forEach(function(n){c[n]=n}),Object.keys(o||{}).forEach(function(n){c[n]=n}),null==i||i.forEach(function(n){g(n)?c[n]=n:y(n)&&Object.keys(n).forEach(function(t){c[t]=n[t]})}),null==a||a.forEach(function(n){g(n)&&(s[n]=n)});var f="include"===t;return function(n){var t=!1,e=Object.keys(c).find(function(t){return p(u)?u(n,t):n.startsWith(t)}),r=Object.keys(s).find(function(t){return p(u)?u(n,t):n.startsWith(t)});return f?r?t=!1:e&&(t=c[e]):e?t=c[e]:r&&(t=!1),t}},at=function(){var n=A(I().m(function n(t){var e;return I().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,An(t);case 1:if(!(e=n.v)){n.n=2;break}return n.a(2,C(e,"utf-8"));case 2:return n.a(2,'\n<html lang="zh-CN">\n <head>\n <meta charset="UTF-8" />\n <meta http-equiv="X-UA-Compatible" content="IE=edge" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>dora</title>\n </head>\n <body>\n <div id="main">welcome use dora !!</div>\n </body>\n</html>\n')}},n)}));return function(t){return n.apply(this,arguments)}}(),ut=function(){var n=A(I().m(function n(t,e){var r,o,i,a;return I().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,Cn(t.doraConfig,e);case 1:return r=n.v,o=t.packageConfig||{},i=t.tsconfigConfig||{},n.n=2,kn(t.cdnConfig,e);case 2:return a=n.v,n.a(2,{doraConfig:r,packageConfig:o,tsConfig:i,cdnConfig:a})}},n)}));return function(t,e){return n.apply(this,arguments)}}(),ct=["multiple"],st=function(n){var t=n.multiple,e=_(n,ct);return d(t)?0===t.length?[e]:1===t.length?[bn(t[0],e)]:t.map(function(n){return bn(e,n)}):[e]},ft=function(){function n(t){var e;return E(this,n),(e=D(this,n)).configCtx=t,e}return function(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),t&&U(n,t)}(n,nt),H(n,[{key:"init",value:(t=A(I().m(function n(){var t,e,r,o;return I().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,at(this.configCtx.getWorkRoot());case 1:return t=n.v,e=nt.parseHtml(t),r=e.head,o=e.body,this.addHeads(r),this.addBodys(o),n.a(2,this)}},n,this)})),function(){return t.apply(this,arguments)})},{key:"addConfigCdn",value:function(){var n,t,e,r,o=this.configCtx.getCdnConfig();return this.addHeads(null===(n=o.headAfterScript)||void 0===n?void 0:n.map(function(n){return{tagName:"script",attrs:[{name:"src",value:n}]}})),this.addHeads(null===(t=o.headAfterStyle)||void 0===t?void 0:t.map(function(n){return{tagName:"link",attrs:[{name:"href",value:n},{name:"rel",value:"stylesheet"}]}})),this.addBodys(null===(e=o.bodyAfterScript)||void 0===e?void 0:e.map(function(n){return{tagName:"script",attrs:[{name:"src",value:n}]}})),this.addBodys(null===(r=o.bodyBeforeScript)||void 0===r?void 0:r.map(function(n){return{tagName:"script",attrs:[{name:"src",value:n}]}})),this}},{key:"writeToFile",value:function(n){return j(n)?S(n,this.generateHtml(),{}):O(n,this.generateHtml(),{}),this}},{key:"addBodyScripts",value:function(n){return this.addBodys(n.map(function(n){return{tagName:"script",attrs:[{name:"src",value:n}]}})),this}},{key:"addHeadStyles",value:function(n){return this.addHeads(n.map(function(n){return{tagName:"link",attrs:[{name:"href",value:n},{name:"rel",value:"stylesheet"}]}})),this}},{key:"copy",value:function(){var t=new n(this.configCtx);return t.addHeads(this.head),t.addBodys(this.body),t}}]);var t}(),lt=function(){var n=A(I().m(function n(){var t,e,r,i=arguments;return I().w(function(n){for(;;)switch(n.n){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:o(),e=w(t,"tsconfig.json"),n.n=1,u(e);case 1:if(n.v){n.n=3;break}return r={$schema:"https://json.schemastore.org/tsconfig",compilerOptions:{target:"esnext",moduleResolution:"node",module:"esnext",noImplicitThis:!1,noImplicitAny:!1,noUnusedLocals:!1,noImplicitReturns:!0,noUnusedParameters:!1,useUnknownInCatchVariables:!1,allowSyntheticDefaultImports:!0,esModuleInterop:!0,emitDecoratorMetadata:!0,experimentalDecorators:!0,preserveConstEnums:!0,strictNullChecks:!0,strictFunctionTypes:!0,strictPropertyInitialization:!0,resolveJsonModule:!0,skipLibCheck:!0,alwaysStrict:!0,sourceMap:!1,paths:{"@/*":["./src/*"]}},exclude:["lib/**"],include:["**/*.ts","**/*.json"]},n.n=2,P(e,JSON.stringify(r,null,2));case 2:sn.info("init","success","自动注入 tsconfig.json");case 3:return n.a(2)}},n)}));return function(){return n.apply(this,arguments)}}();export{qn as CompilerBase,Y as ConfigCtx,Vn as DynamicHtml,Yn as EnvEnum,ft as GenerateConfigHtml,Xn as HtmlAssetManager,nt as HtmlManage,sn as cLog,nn as cLogDebugger,on as cLogError,tn as cLogMessage,en as cLogSuccess,un as cLogTime,cn as cLogTimeEnd,rn as cLogWarn,fn as clearMw,Un as collectBaseConfigMw,In as collectCdnConfigMw,Ln as collectConfig,tt as collectConfigs,Fn as collectDoraConfigMw,Nn as collectPackageJsonMw,_n as collectTsconfigJsonMw,et as configCtxCollect,Jn as configCtxWorkflow,it as createDependFilter,rt as createEnvParams,ot as createOutputList,wn as deepMergeObject,xn as findInput,An as findInputHtml,at as getDefaultHtml,pn as getDependencies,dn as getDoracliConfig,hn as getPackageJson,Dn as getTsPathAlias,vn as getTsconfigJson,gn as getUserCdn,Sn as inputFileDirList,Pn as inputFileTypeList,Tn as inputHtmlFileDirList,lt as insertTsconfig,mn as mergeDoraCliConfig,bn as mergeDoraCliConfigMutiple,kn as parseCdnConfig,Cn as parseDoracliConfig,Qn as parseHtml,ut as parsetConfig,Wn as resolveCdnConfig,Rn as resolveDoraConfig,Hn as resolvePackageJson,Bn as resolveTsconfigJson,X as setLogLevel,On as splitDoraCliConfig,st as splitDoraConfig,En as wholeDoraConfig,zn as wholeDoraConfigMw,$n as wholeDoraInoutMw};
3
+ var n,t,e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return F(s,"_invoke",function(e,r,o){var i,u,c,s=0,f=o||[],l=!1,p={p:0,n:0,v:n,a:d,f:d.bind(n,4),d:function(t,e){return i=t,u=0,c=n,p.n=e,a}};function d(e,r){for(u=e,c=r,t=0;!l&&s&&!o&&t<f.length;t++){var o,i=f[t],d=p.p,h=i[2];e>3?(o=h===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=n):i[0]<=d&&((o=e<2&&d<i[1])?(u=0,p.v=r,p.n=i[1]):d<h&&(o=e<3||i[0]>r||r>h)&&(i[4]=e,i[5]=r,p.n=h,u=0))}if(o||e>1)return a;throw l=!0,r}return function(o,f,h){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&d(f,h),u=f,c=h;(t=u<2?n:c)||!l;){i||(u?u<3?(u>1&&(p.n=-1),d(u,c)):p.n=c:p.v=c);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=n}else if((t=(l=p.n<0)?c:e.call(r,p))!==a)break}catch(t){i=n,u=1,c=t}finally{s=1}}return{value:t,done:l}}}(e,o,i),!0),s}var a={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(F(t={},r,function(){return this}),t),l=s.prototype=u.prototype=Object.create(f);function p(n){return Object.setPrototypeOf?Object.setPrototypeOf(n,s):(n.__proto__=s,F(n,o,"GeneratorFunction")),n.prototype=Object.create(l),n}return c.prototype=s,F(l,"constructor",s),F(s,"constructor",c),c.displayName="GeneratorFunction",F(s,o,"GeneratorFunction"),F(l),F(l,o,"Generator"),F(l,r,function(){return this}),F(l,"toString",function(){return"[object Generator]"}),(I=function(){return{w:i,m:p}})()}function F(n,t,e,r){var o=Object.defineProperty;try{o({},"",{})}catch(n){o=0}F=function(n,t,e,r){function i(t,e){F(n,t,function(n){return this._invoke(t,e,n)})}t?o?o(n,t,{value:e,enumerable:!r,configurable:!r,writable:!r}):n[t]=e:(i("next",0),i("throw",1),i("return",2))},F(n,t,e,r)}function U(n,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,t){return n.__proto__=t,n},U(n,t)}function z(n,t){return function(n){if(Array.isArray(n))return n}(n)||function(n,t){var e=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=e){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(e=e.call(n)).next,0===t);else for(;!(c=(r=i.call(e)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(n){s=!0,o=n}finally{try{if(!c&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(n,t)||J(n,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(n){return function(n){if(Array.isArray(n))return x(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||J(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(n){var t=function(n,t){if("object"!=typeof n||!n)return n;var e=n[Symbol.toPrimitive];if(void 0!==e){var r=e.call(n,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(n)}(n,"string");return"symbol"==typeof t?t:t+""}function J(n,t){if(n){if("string"==typeof n)return x(n,t);var e={}.toString.call(n).slice(8,-1);return"Object"===e&&n.constructor&&(e=n.constructor.name),"Map"===e||"Set"===e?Array.from(n):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?x(n,t):void 0}}var Y=function(){function n(){D(this,n),B(this,"tsConfig",{}),B(this,"doraConfig",{}),B(this,"packageConfig",{}),B(this,"cdnConfig",{}),B(this,"cmd",{}),B(this,"workRoot","./")}return H(n,[{key:"setCmd",value:function(n){this.cmd=n}},{key:"getCmd",value:function(){return this.cmd}},{key:"setWorkRoot",value:function(n){this.workRoot=n}},{key:"getWorkRoot",value:function(){return this.workRoot}},{key:"setTsConfig",value:function(n){this.tsConfig=n}},{key:"getTsConfig",value:function(){return this.tsConfig}},{key:"setDoraConfig",value:function(n){this.doraConfig=n}},{key:"getDoraConfig",value:function(){return this.doraConfig}},{key:"setCdnConfig",value:function(n){this.cdnConfig=n}},{key:"getCdnConfig",value:function(){return this.cdnConfig}},{key:"setPackageConfig",value:function(n){this.packageConfig=n}},{key:"getPackageConfig",value:function(){return this.packageConfig}},{key:"copy",value:function(){var t=new n;return t.setWorkRoot(this.getWorkRoot()),t.setTsConfig(this.getTsConfig()),t.setDoraConfig(this.getDoraConfig()),t.setPackageConfig(this.getPackageConfig()),t.setCdnConfig(this.getCdnConfig()),t.setCmd(this.getCmd()),t}}])}(),q="@doracli",V=10,X=function(n){V=n},K=function(n,t){return n.length>=t?n:n+" ".repeat(t-n.length)},Q=function(n){return K(n,5)},Z=function(n){return K(n,9).toUpperCase()},nn=function(n,t){var e;if(!(V>0)){for(var r=c.bgBlack("[".concat(c.magenta(q),":").concat(c.bold(" ".concat(Q(n))),"]")),o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];return(e=console).debug.apply(e,["".concat(r," [").concat(Z(t),"]")].concat(i))}},tn=function(n,t){var e;if(!(V>10)){for(var r=c.bgBlack("[".concat(c.magenta(q),":").concat(c.bold(" ".concat(Q(n))),"]")),o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];return(e=console).log.apply(e,["".concat(r," [").concat(c.yellow(Z(t)),"]")].concat(i))}},en=function(n,t){var e;if(!(V>100)){for(var r=c.bgBlack("[".concat(c.magenta(q),":").concat(c.bold(" ".concat(Q(n))),"]")),o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];return(e=console).log.apply(e,["".concat(r," [").concat(c.green(Z(t)),"]")].concat(i))}},rn=function(n,t){var e;if(!(V>1e3)){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return(e=console).log.apply(e,[c.bgYellow("[".concat(q,": ").concat(Q(n),"] [").concat(Z(t),"]"))].concat(o))}},on=function(n,t){var e;if(!(V>1e4)){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return(e=console).log.apply(e,[c.bgRed("[".concat(q,": ").concat(Q(n),"] [").concat(Z(t),"]"))].concat(o))}},an=0,un=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"cLogTimeStart-".concat(an);return an++,console.time(n),function(){console.timeEnd(n)}},cn=function(n){console.timeEnd(n)},sn={log:tn,debug:nn,error:on,warn:rn,info:en,time:un,timeEnd:cn},fn=function(){return function(n){return function(t){return E(I().m(function e(){return I().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,ln(n);case 1:return e.a(2,t())}},e)}))}}},ln=function(){var e=E(I().m(function e(r){var o,i,a,u;return I().w(function(e){for(;;)switch(e.p=e.n){case 0:if(o=r.getDoraConfig(),i=o.clear,a=o.output,u=(a||{}).path,e.p=1,i){e.n=2;break}return e.a(2);case 2:if(u){e.n=3;break}return e.a(2);case 3:return e.n=4,t(u);case 4:if(e.v){e.n=5;break}return e.a(2);case 5:return e.n=6,n(u);case 6:e.n=8;break;case 7:e.p=7,e.v,sn.warn("clear","warn","清空目标文件夹失败: ".concat(u));case 8:return e.a(2)}},e,null,[[1,7]])}));return function(n){return e.apply(this,arguments)}}(),pn=function(n){return N(N(N({},n.dependencies),n.peerDependencies),n.devDependencies)},dn=function(){var n=E(I().m(function n(t){var r,o;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,s("doracli.config",{rootDir:e(t)});case 1:if(r=n.v){n.n=2;break}return sn.warn("file","undefined","未定义 doracli 配置文件"),n.a(2,null);case 2:return sn.debug("file","success","引入 doracli 配置文件成功"),n.a(2,r.default||r);case 3:return n.p=3,o=n.v,sn.error("file","fail","引入 doracli 配置文件失败"),console.error(o),n.a(2,Promise.reject(o))}},n,null,[[0,3]])}));return function(t){return n.apply(this,arguments)}}(),hn=function(){var n=E(I().m(function n(){var t,r,o,i=arguments;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:"",n.p=1,n.n=2,f(e(t,"package.json"));case 2:return r=n.v,sn.debug("file","success","引入 package.json 成功"),n.a(2,r);case 3:n.p=3,o=n.v,sn.error("file","fail","引入 package.json 失败"),sn.debug("file","error",o);case 4:return n.a(2)}},n,null,[[1,3]])}));return function(){return n.apply(this,arguments)}}(),vn=function(){var n=E(I().m(function n(t){var r,o;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,f(e(t,"./tsconfig.json"));case 1:return r=n.v,sn.debug("file","success","引入 tsconfig.json 成功"),n.a(2,r);case 2:n.p=2,o=n.v,sn.error("file","failed","引入 tsconfig.json 失败"),sn.debug("file","error",o);case 3:return n.a(2)}},n,null,[[0,2]])}));return function(t){return n.apply(this,arguments)}}();function gn(n){return yn.apply(this,arguments)}function yn(){return(yn=E(I().m(function n(t){var r,o;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,s("cdn",{rootDir:e(t)});case 1:if(null!=(r=n.v)&&r.default){n.n=2;break}return sn.log("file","undefined","未定义 cdn 配置文件"),n.a(2,null);case 2:return sn.info("file","success","引入 cdn 成功"),n.a(2,r.default);case 3:return n.p=3,o=n.v,sn.error("file","failed","引入 cdn 失败"),sn.debug("file","failed",o),n.a(2,null)}},n,null,[[0,3]])}))).apply(this,arguments)}var mn=function(n){return wn(n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})},bn=function(){for(var n=arguments.length,t=new Array(n),e=0;e<n;e++)t[e]=arguments[e];return t.reduce(function(n,t){return mn(n,t)})},wn=function(n,t){if(!t)return n;if(!n)return t;var e=N({},n);for(var r in t)l(t[r])?e[r]=wn(n[r],t[r]):e[r]=t[r];return e};function Cn(n,t){try{if(!l(n))return;return Object.entries(n).reduce(function(n,e){var r=z(e,2),o=r[0],i=r[1];return p(i)?n[o]=i(t)||[]:d(i)&&(n[o]=i),n},{})}catch(n){throw sn.error("parse","parseCdnConfig","解析用户cdn配置失败"),new Error(n)}}var kn=function(){var n=E(I().m(function n(t,e){var r,o;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:if(n.p=0,r=t,!p(t)){n.n=2;break}return n.n=1,t(e);case 1:r=n.v;case 2:return n.a(2,r);case 3:throw n.p=3,o=n.v,sn.error("resolve ","resolveUserConfigJson","解析用户配置失败"),new Error(o);case 4:return n.a(2)}},n,null,[[0,3]])}));return function(t,e){return n.apply(this,arguments)}}(),jn=["multiple"],On=function(n){var t=n.multiple,e=_(n,jn);return d(t)?0===t.length?[e]:1===t.length?[bn(e,t[0])]:t.map(function(n){return bn(e,n)}):[e]},Sn=["src/index","index"],Pn=[".ts",".js",".tsx",".jsx"],xn=function(n){var t=Sn.reduce(function(n,t){return Pn.forEach(function(e){n.push("./"+t+e)}),n},[]);return r(t,n)},Tn=["index.html","public/index.html"],En=function(n){return r(Tn,n)},An=function(n){var t=((null==n?void 0:n.compilerOptions)||{}).paths;if(!t)return{};var e={};return Object.entries(t).forEach(function(n){var t=z(n,2),r=t[0],o=t[1],i=r.replace(/\/\*$/,"");if(null!=o&&o.length&&!e[i]){var a=o[0].replace(/\/\*$/,"");e[i]=m(a)}}),e},Dn=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o(),e=n.type,r=n.name,u=n.lib,c=n.libList,s=n.alias,f=n.clear,l=n.copy,p=n.dts,d=n.externals,v=n.formatList,g=n.input,y=n.internals,m=n.minimize,b=n.multiple,w=n.output,C=n.rollupConfig,k=n.webpackConfig,j=n.esbuildConfig,O=n.rspackConfig,S=n.format,P=n.serviceConfig,x=g,T=(null==w?void 0:w.path)||"./dist",E=null==w?void 0:w.file,A=[];return b||(i(x||"")||(x=xn(t)),x||sn.error("init","not_found","找不到入口文件"),E=(null==w?void 0:w.file)||a(x)),c||(A=u?[u]:null!=v&&v.length?v.map(function(n){return{format:n}}):[{format:S||"cjs"}]),{multiple:!h(b)&&b,type:e,name:r,alias:s||{},clear:!h(f)&&f,copy:l||[],dts:h(p)?{}:p,externals:d||[],formatList:v||["cjs"],libList:A,input:g,internals:y||[],minimize:!h(m)&&m,output:w||{path:T,file:E},rollupConfig:C||{},webpackConfig:k||{},esbuildConfig:j||{},rspackConfig:O||{},serviceConfig:P||{}}},Rn=function(){var n=E(I().m(function n(t,e){var r;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,dn(t);case 1:return r=n.v,n.a(2,kn(r,e));case 2:return n.p=2,n.v,sn.log("resolve ","error","doracli.config 解析用户配置失败"),n.a(2,{})}},n,null,[[0,2]])}));return function(t,e){return n.apply(this,arguments)}}(),Hn=function(){var n=E(I().m(function n(t){var e;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,hn(t);case 1:return e=n.v,n.a(2,e);case 2:return n.p=2,n.v,sn.log("resolve ","error","package.json 解析用户配置失败"),n.a(2,{})}},n,null,[[0,2]])}));return function(t){return n.apply(this,arguments)}}(),Bn=function(){var n=E(I().m(function n(t){var e;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,vn(t);case 1:return e=n.v,n.a(2,e);case 2:return n.p=2,n.v,sn.log("resolve ","error","tsconfig.json 解析用户配置失败"),n.a(2,{})}},n,null,[[0,2]])}));return function(t){return n.apply(this,arguments)}}(),Ln=function(){var n=E(I().m(function n(t,e,r){var o,i,a,u;return I().w(function(n){for(;;)switch(n.n){case 0:return o=t.getWorkRoot(),n.n=1,Bn(o);case 1:return i=n.v,n.n=2,Rn(o,e);case 2:return a=n.v,n.n=3,Hn(o);case 3:u=n.v,t.setPackageConfig(u),t.setDoraConfig(Dn(mn((null==r?void 0:r.doraConfig)||{},a||{}),o)),t.setTsConfig(i);case 4:return n.a(2)}},n)}));return function(t,e,r){return n.apply(this,arguments)}}();function Wn(n,t){return Mn.apply(this,arguments)}function Mn(){return(Mn=E(I().m(function n(t,e){var r;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,gn(t);case 1:return r=n.v,n.a(2,Cn(r,e));case 2:return n.p=2,n.v,sn.log("resolve ","resolveUserCdn","解析用户cdn配置失败"),n.a(2,{})}},n,null,[[0,2]])}))).apply(this,arguments)}var Nn=function(){return function(n){return function(t){return E(I().m(function e(){var r;return I().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,hn(n.getWorkRoot());case 1:return r=e.v,n.setPackageConfig(r||{}),e.a(2,t())}},e)}))}}},_n=function(){return function(n){return function(t){return E(I().m(function e(){var r;return I().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,vn(n.getWorkRoot());case 1:return r=e.v,n.setTsConfig(r||{}),e.a(2,t())}},e)}))}}},In=function(n){return function(t){return function(e){return E(I().m(function r(){var o;return I().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,Wn(t.getWorkRoot(),n);case 1:return o=r.v,t.setCdnConfig(o||{bodyAfterScript:[],headAfterScript:[],headAfterStyle:[],bodyBeforeScript:[]}),r.a(2,e())}},r)}))}}},Fn=function(n){return function(t){return function(e){return E(I().m(function r(){var o;return I().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,Rn(t.getWorkRoot(),n);case 1:return o=r.v,t.setDoraConfig(o||{}),r.a(2,e())}},r)}))}}},Un=function(n,t){return function(e){return function(r){return function(){return e.setWorkRoot(n),e.setCmd(t),r()}}}},zn=function(n){return function(t){return function(e){return function(){var r=mn(n,t.getDoraConfig()),o=r.alias,i=r.clear,a=r.copy,u=r.dts,c=r.lib,s=r.format,f=r.libList,l=r.name,p=r.type,d=r.externals,v=r.formatList,g=r.input,y=r.internals,m=r.minimize,b=r.multiple,w=r.output,C=r.rollupConfig,k=r.webpackConfig,j=r.esbuildConfig,O=r.rspackConfig,S=r.serviceConfig,P=r.dtsConfig,x=r.browserExtensionConfig;return t.setDoraConfig({multiple:!h(b)&&b,name:l,type:p,format:s,formatList:v,lib:c,libList:f,alias:o||{},clear:!h(i)&&i,copy:a||[],dts:h(u)?{}:u,externals:d||[],input:g,internals:y||[],minimize:!h(m)&&m,output:w,rollupConfig:C||{},webpackConfig:k||{},esbuildConfig:j||{},rspackConfig:O||{},serviceConfig:S||{},browserExtensionConfig:x||{},dtsConfig:P}),e()}}}},Gn=["input","output","multiple"],$n=function(){return function(n){return function(t){return function(){var e=n.getDoraConfig(),r=e.input,o=e.output,u=e.multiple,c=_(e,Gn),s=n.getWorkRoot(),f=r,l=(null==o?void 0:o.path)||"./dist",p=null==o?void 0:o.file;return u||(i(f||"")||(f=xn(s)),f||sn.error("init","not_found","找不到入口文件"),p=(null==o?void 0:o.file)||a(f)),n.setDoraConfig(N(N({},c),{},{input:f,output:o||{path:l,file:p},multiple:u})),t()}}}},Jn=function(n){var t=[];return{use:function(n){return t.push(n),this},getResult:function(){return E(I().m(function e(){return I().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,C(n,t)(v)();case 1:return e.a(2,n)}},e)}))()}}},Yn=function(n){return n.dev="development",n.prod="production",n}({}),qn=H(function n(t){D(this,n),this.initOptions=t,B(this,"inOutMap",void 0),B(this,"input",void 0),B(this,"context",void 0),B(this,"build",void 0),B(this,"watch",void 0),B(this,"server",void 0)}),Vn=function(){function n(){D(this,n),B(this,"headScripts",[]),B(this,"bodyScripts",[]),B(this,"headStyles",[]),B(this,"headTags",[]),B(this,"bodyTags",['<div id="main"></div>'])}return H(n,[{key:"addHeadScripts",value:function(n){var t;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.headScripts=[]),(t=this.headScripts).push.apply(t,G(n))}},{key:"addBodyScripts",value:function(n){var t;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.bodyScripts=[]),(t=this.bodyScripts).push.apply(t,G(n))}},{key:"addHeadStyles",value:function(n){var t;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.headStyles=[]),(t=this.headStyles).push.apply(t,G(n))}},{key:"addHeadTags",value:function(n){var t;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.headTags=[]),(t=this.headTags).push.apply(t,G(n))}},{key:"addBodyTags",value:function(n){var t;arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.bodyTags=n),(t=this.bodyTags).push.apply(t,G(n))}},{key:"copy",value:function(){var t=new n;return t.addHeadScripts(this.headScripts,!0),t.addBodyScripts(this.bodyScripts,!0),t.addHeadStyles(this.headStyles,!0),t}},{key:"generateHtmlTemplate",value:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Document",t=this.headScripts.sort(function(n,t){return(n.order||0)-(t.order||0)}).map(function(n){var t=['src="'.concat(n.src,'"'),n.async?"async":"",n.defer?"defer":""].filter(Boolean).join(" ");return"<script ".concat(t,"><\/script>")}).join("\n"),e=this.bodyScripts.sort(function(n,t){return(n.order||0)-(t.order||0)}).map(function(n){var t=['src="'.concat(n.src,'"'),n.async?"async":"",n.defer?"defer":""].filter(Boolean).join(" ");return"<script ".concat(t,"><\/script>")}).join("\n"),r=this.headStyles.sort(function(n,t){return(n.order||0)-(t.order||0)}).map(function(n){var t=['href="'.concat(n.src,'"'),'rel="stylesheet"',n.async?"async":"",n.defer?"defer":""].filter(Boolean).join(" ");return"<link ".concat(t,">")}).join("\n"),o=this.headTags.map(function(n){return n}).join("\n"),i=this.bodyTags.map(function(n){return n}).join("\n");return'<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>'.concat(n,"</title>\n ").concat(o,"\n ").concat(r,"\n ").concat(t,"\n</head>\n<body>\n ").concat(i,"\n ").concat(e,"\n</body>\n</html>")}}])}(),Xn=function(){return H(function n(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";D(this,n),this.publicPath=t,B(this,"assetMap",{}),B(this,"dynamicHtml",new Vn),B(this,"initAwaitList",[]),B(this,"assetList",[])},[{key:"updateAssetList",value:function(n){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.assetList=t?n:Array.from(new Set([].concat(G(this.assetList),G(n))))}},{key:"updateAssetMap",value:function(n){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.assetMap=t?n:N(N({},this.assetMap),n),this.initAwaitList.forEach(function(n){return n()}),this.initAwaitList=[]}},{key:"getAssetMap",value:function(){return this.assetMap}},{key:"getModuleAsset",value:function(n){return this.assetMap[n]||{name:n,scripts:[],styles:[],runtimeChunks:[]}}},{key:"getModuleHtml",value:(n=E(I().m(function n(t){var e,r,o=this;return I().w(function(n){for(;;)switch(n.n){case 0:if(0!==Object.keys(this.assetMap).length){n.n=1;break}return n.n=1,new Promise(function(n){o.initAwaitList.push(function(){n()})});case 1:if(e=this.assetMap[t]){n.n=2;break}throw new Error("Module ".concat(t," asset not found."));case 2:return(r=this.dynamicHtml.copy()).addBodyScripts(e.scripts.map(function(n){return{src:n,order:0}})),r.addHeadStyles(e.styles.map(function(n){return{src:n,order:0}})),n.a(2,r.generateHtmlTemplate())}},n,this)})),function(t){return n.apply(this,arguments)})}]);var n}(),Kn=function(n){var t,e;return n.selfClosing?"<".concat(n.tagName," ").concat(null===(e=n.attrs)||void 0===e?void 0:e.map(function(n){return"".concat(n.name,'="').concat(n.value,'"')}).join(" ")," />"):"<".concat(n.tagName," ").concat(null===(t=n.attrs)||void 0===t?void 0:t.map(function(n){return"".concat(n.name,'="').concat(n.value,'"')}).join(" "),">").concat((n.children||[]).map(function(n){return"string"==typeof n?n:Kn(n)}).join(""),"</").concat(n.tagName,">")},Qn=function(n){var t=/<head[^>]*>([\s\S]*?)<\/head>/i.exec(n),e=/<body[^>]*>([\s\S]*?)<\/body>/i.exec(n),r=t?t[1]:"",o=e?e[1]:"";return{head:Zn(r),body:Zn(o)}},Zn=function(n){var t=[],e=[];if(!n)return t;for(var r=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=function(n){for(var t,e=[],r=/([^\s=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>/]+)))?/g;t=r.exec(n);){var o,i,a=t[1],u=null!==(o=null!==(i=t[2])&&void 0!==i?i:t[3])&&void 0!==o?o:t[4];void 0===u?e.push({name:a,value:!0}):e.push({name:a,value:u})}return e},i=0,a=n.length;i<a;){if("<"!==n[i]){var u=n.indexOf("<",i),c=-1===u?a:u,s=n.slice(i,c).trim();if(s&&e.length){var f=e[e.length-1];f.children||(f.children=[]),f.children.push(s)}i=c}else{var l=n.indexOf(">",i+1);if(-1===l)break;var p=n.slice(i+1,l).trim();if(p.startsWith("!")||p.startsWith("?")||p.startsWith("--")){i=l+1;continue}if(p.startsWith("/")){p.slice(1).trim().split(/\s+/)[0].toLowerCase();if(e.length)e[e.length-1].tagName.toLowerCase(),e.pop();i=l+1;continue}var d=p.endsWith("/"),h=p.replace(/\/\s*$/,"").trim(),v=h.search(/\s/),g=(-1===v?h:h.slice(0,v)).toLowerCase(),y=-1===v?"":h.slice(v+1).trim(),m=d||r.has(g),b={tagName:g,attrs:o(y),selfClosing:m,children:[]};if(0===e.length)t.push(b);else{var w=e[e.length-1];w.children||(w.children=[]),w.children.push(b)}m||e.push(b),i=l+1}}return t},nt=function(){function n(t){var e,r;D(this,n),B(this,"head",[]),B(this,"body",[]),this.head=null!==(e=null==t?void 0:t.head)&&void 0!==e?e:[],this.body=null!==(r=null==t?void 0:t.body)&&void 0!==r?r:[]}return H(n,[{key:"addHead",value:function(n){return n?(this.head.push(n),this):this}},{key:"addHeads",value:function(n){var t;return n?((t=this.head).push.apply(t,G(n)),this):this}},{key:"addBody",value:function(n){return n?(this.body.push(n),this):this}},{key:"addBodys",value:function(n){var t;return n?((t=this.body).push.apply(t,G(n)),this):this}},{key:"parseHtmlByFile",value:function(t){var e=k(t,"utf-8"),r=n.parseHtml(e),o=r.head,i=r.body;return this.head=o,this.body=i,this}},{key:"generateHtml",value:function(){return n={head:this.head,body:this.body},t=n.head,e=n.body,"\n <html>\n <head>\n ".concat(t.map(function(n){return Kn(n)}).join("\n"),"\n </head>\n <body>\n ").concat(e.map(function(n){return Kn(n)}).join("\n"),"\n </body>\n </html>\n ");var n,t,e}},{key:"copy",value:function(){return new n({head:this.head.map(function(n){return N({},n)}),body:this.body.map(function(n){return N({},n)})})}}],[{key:"parseHtml",value:function(n){return Qn(n)}}])}(),tt=function(){var n=E(I().m(function n(t,e){var r;return I().w(function(n){for(;;)switch(n.p=n.n){case 0:if(r={doraConfig:null,packageConfig:null,tsconfigConfig:null,cdnConfig:null},n.p=1,!1===(null==e?void 0:e.doraConfig)){n.n=3;break}return n.n=2,dn(t);case 2:r.doraConfig=n.v;case 3:n.n=5;break;case 4:n.p=4,n.v;case 5:if(n.p=5,!1===(null==e?void 0:e.packageConfig)){n.n=7;break}return n.n=6,hn(t);case 6:r.packageConfig=n.v;case 7:n.n=9;break;case 8:n.p=8,n.v;case 9:if(n.p=9,!1===(null==e?void 0:e.tsconfigConfig)){n.n=11;break}return n.n=10,vn(t);case 10:r.tsconfigConfig=n.v;case 11:n.n=13;break;case 12:n.p=12,n.v;case 13:if(n.p=13,!1===(null==e?void 0:e.cdnConfig)){n.n=15;break}return n.n=14,gn(t);case 14:r.cdnConfig=n.v;case 15:n.n=17;break;case 16:n.p=16,n.v;case 17:return n.a(2,r)}},n,null,[[13,16],[9,12],[5,8],[1,4]])}));return function(t,e){return n.apply(this,arguments)}}(),et=function(){var n=E(I().m(function n(t,e){return I().w(function(n){for(;;)switch(n.n){case 0:t.setCdnConfig(e.cdnConfig),t.setDoraConfig(e.doraConfig),t.setTsConfig(e.tsConfig),t.setPackageConfig(e.packageConfig),t.setWorkRoot(e.workRootDir||o()),t.setCmd(e.cmd||{});case 1:return n.a(2)}},n)}));return function(t,e){return n.apply(this,arguments)}}(),rt=function(n){var t=n.workRootDir||"./";return b(n.workRootDir)||(t=w(o(),t)),N(N({},n),{},{workRootDir:t})},ot=function(n){var t=n.input,e=n.output,r=n.formatList,o=n.format,i=e.path,u=e.file,c=[];return o?c.push({input:t,format:o,outputFile:u||a(t)||"index.js",outputPath:i||"dist"}):d(r)?r.forEach(function(n){c.push({input:t,format:n,outputFile:u||a(t)||"index.js",outputPath:i||"dist"})}):c.push({input:t,format:"iife",outputFile:u||a(t)||"index.js",outputPath:i||"dist"}),c},it=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"exclude",e=n.dependencies,r=n.peerDependencies,o=n.devDependencies,i=n.externals,a=n.internals,u=n.compare,c={},s={};Object.keys(e||{}).forEach(function(n){c[n]=n}),Object.keys(r||{}).forEach(function(n){c[n]=n}),Object.keys(o||{}).forEach(function(n){c[n]=n}),null==i||i.forEach(function(n){g(n)?c[n]=n:y(n)&&Object.keys(n).forEach(function(t){c[t]=n[t]})}),null==a||a.forEach(function(n){g(n)&&(s[n]=n)});var f="include"===t;return function(n){var t=!1,e=Object.keys(c).find(function(t){return p(u)?u(n,t):n.startsWith(t)}),r=Object.keys(s).find(function(t){return p(u)?u(n,t):n.startsWith(t)});return f?r?t=!1:e&&(t=c[e]):e?t=c[e]:r&&(t=!1),t}},at='\n<html lang="zh-CN">\n <head>\n <meta charset="UTF-8" />\n <meta http-equiv="X-UA-Compatible" content="IE=edge" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <title>dora</title>\n </head>\n <body>\n <div id="main">welcome use dora !!</div>\n </body>\n</html>\n',ut=function(){var n=E(I().m(function n(t){var e;return I().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,En(t);case 1:if(!(e=n.v)){n.n=2;break}return n.a(2,k(e,"utf-8"));case 2:return n.a(2,at)}},n)}));return function(t){return n.apply(this,arguments)}}(),ct=function(){var n=E(I().m(function n(t,e){var r,o,i,a;return I().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,kn(t.doraConfig,e);case 1:return r=n.v,o=t.packageConfig||{},i=t.tsconfigConfig||{},n.n=2,Cn(t.cdnConfig,e);case 2:return a=n.v,n.a(2,{doraConfig:r,packageConfig:o,tsConfig:i,cdnConfig:a})}},n)}));return function(t,e){return n.apply(this,arguments)}}(),st=["multiple"],ft=function(n){var t=n.multiple,e=_(n,st);return d(t)?0===t.length?[e]:1===t.length?[bn(t[0],e)]:t.map(function(n){return bn(e,n)}):[e]},lt=function(){function n(t){var e;return D(this,n),(e=A(this,n)).configCtx=t,e}return function(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),t&&U(n,t)}(n,nt),H(n,[{key:"init",value:(t=E(I().m(function n(){var t,e,r,o;return I().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,ut(this.configCtx.getWorkRoot());case 1:return t=n.v,e=nt.parseHtml(t),r=e.head,o=e.body,this.addHeads(r),this.addBodys(o),n.a(2,this)}},n,this)})),function(){return t.apply(this,arguments)})},{key:"addConfigCdn",value:function(){var n,t,e,r,o=this.configCtx.getCdnConfig();return this.addHeads(null===(n=o.headAfterScript)||void 0===n?void 0:n.map(function(n){return{tagName:"script",attrs:[{name:"src",value:n}]}})),this.addHeads(null===(t=o.headAfterStyle)||void 0===t?void 0:t.map(function(n){return{tagName:"link",attrs:[{name:"href",value:n},{name:"rel",value:"stylesheet"}]}})),this.addBodys(null===(e=o.bodyAfterScript)||void 0===e?void 0:e.map(function(n){return{tagName:"script",attrs:[{name:"src",value:n}]}})),this.addBodys(null===(r=o.bodyBeforeScript)||void 0===r?void 0:r.map(function(n){return{tagName:"script",attrs:[{name:"src",value:n}]}})),this}},{key:"writeToFile",value:function(n){return j(n)?S(n,this.generateHtml(),{}):O(n,this.generateHtml(),{}),this}},{key:"addBodyScripts",value:function(n){return this.addBodys(n.map(function(n){return{tagName:"script",attrs:[{name:"src",value:n}]}})),this}},{key:"addHeadStyles",value:function(n){return this.addHeads(n.map(function(n){return{tagName:"link",attrs:[{name:"href",value:n},{name:"rel",value:"stylesheet"}]}})),this}},{key:"copy",value:function(){var t=new n(this.configCtx);return t.addHeads(this.head),t.addBodys(this.body),t}}]);var t}(),pt=function(){var n=E(I().m(function n(){var t,e,r,i=arguments;return I().w(function(n){for(;;)switch(n.n){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:o(),e=w(t,"tsconfig.json"),n.n=1,u(e);case 1:if(n.v){n.n=3;break}return r={$schema:"https://json.schemastore.org/tsconfig",compilerOptions:{target:"esnext",moduleResolution:"node",module:"esnext",noImplicitThis:!1,noImplicitAny:!1,noUnusedLocals:!1,noImplicitReturns:!0,noUnusedParameters:!1,useUnknownInCatchVariables:!1,allowSyntheticDefaultImports:!0,esModuleInterop:!0,emitDecoratorMetadata:!0,experimentalDecorators:!0,preserveConstEnums:!0,strictNullChecks:!0,strictFunctionTypes:!0,strictPropertyInitialization:!0,resolveJsonModule:!0,skipLibCheck:!0,alwaysStrict:!0,sourceMap:!1,paths:{"@/*":["./src/*"]}},exclude:["lib/**"],include:["**/*.ts","**/*.json"]},n.n=2,P(e,JSON.stringify(r,null,2));case 2:sn.info("init","success","自动注入 tsconfig.json");case 3:return n.a(2)}},n)}));return function(){return n.apply(this,arguments)}}();export{qn as CompilerBase,Y as ConfigCtx,Vn as DynamicHtml,Yn as EnvEnum,lt as GenerateConfigHtml,Xn as HtmlAssetManager,nt as HtmlManage,sn as cLog,nn as cLogDebugger,on as cLogError,tn as cLogMessage,en as cLogSuccess,un as cLogTime,cn as cLogTimeEnd,rn as cLogWarn,fn as clearMw,Un as collectBaseConfigMw,In as collectCdnConfigMw,Ln as collectConfig,tt as collectConfigs,Fn as collectDoraConfigMw,Nn as collectPackageJsonMw,_n as collectTsconfigJsonMw,et as configCtxCollect,Jn as configCtxWorkflow,it as createDependFilter,rt as createEnvParams,ot as createOutputList,wn as deepMergeObject,xn as findInput,En as findInputHtml,ut as getDefaultHtml,pn as getDependencies,dn as getDoracliConfig,hn as getPackageJson,An as getTsPathAlias,vn as getTsconfigJson,gn as getUserCdn,at as htmlDefault,Sn as inputFileDirList,Pn as inputFileTypeList,Tn as inputHtmlFileDirList,pt as insertTsconfig,mn as mergeDoraCliConfig,bn as mergeDoraCliConfigMutiple,Cn as parseCdnConfig,kn as parseDoracliConfig,Qn as parseHtml,ct as parsetConfig,Wn as resolveCdnConfig,Rn as resolveDoraConfig,Hn as resolvePackageJson,Bn as resolveTsconfigJson,X as setLogLevel,On as splitDoraCliConfig,ft as splitDoraConfig,Dn as wholeDoraConfig,zn as wholeDoraConfigMw,$n as wholeDoraInoutMw};
@@ -278,7 +278,7 @@ declare const parseDoracliConfig: (userConfig: TDoraConfigDefine | null, mode: T
278
278
  * @param config 配置项
279
279
  * @returns
280
280
  */
281
- declare const splitDoraCliConfig: (config: TDoraConfig) => {
281
+ declare const splitDoraCliConfig: (config: TDoraConfig) => PartialRecursive<TDoraConfig>[] | {
282
282
  name: string;
283
283
  type: _doracli_type.TConfigType;
284
284
  input: string;
@@ -306,7 +306,8 @@ declare const splitDoraCliConfig: (config: TDoraConfig) => {
306
306
  esbuildConfig?: _doracli_type_src_dora_config_esbuild.TDoraConfigEsbuild;
307
307
  serviceConfig?: Partial<_doracli_type.TDoraConfigService>;
308
308
  dtsConfig?: _doracli_type_src_dora_config_dts.TDoraConfigDts;
309
- }[] | PartialRecursive<TDoraConfig>[];
309
+ browserExtensionConfig?: _doracli_type.TDoraConfigBrowserExtension;
310
+ }[];
310
311
 
311
312
  declare const wholeDoraConfig: (config: PartialRecursive<TDoraConfig>, workRootDir?: string) => TDoraConfig;
312
313
 
@@ -417,9 +418,10 @@ declare const createDependFilter: (options: {
417
418
  compare?: (targetId: string, moduleRuleId: string) => boolean;
418
419
  }, strategy?: "include" | "exclude") => (id: string) => string | false;
419
420
 
421
+ declare const htmlDefault = "\n<html lang=\"zh-CN\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>dora</title>\n </head>\n <body>\n <div id=\"main\">welcome use dora !!</div>\n </body>\n</html>\n";
420
422
  declare const getDefaultHtml: (workRootDir: string) => Promise<string>;
421
423
 
422
- declare const splitDoraConfig: (config: TDoraConfig) => PartialRecursive<TDoraConfig>[] | _doracli_type.TDoraConfigMultiple[] | {
424
+ declare const splitDoraConfig: (config: TDoraConfig) => _doracli_type.TDoraConfigMultiple[] | {
423
425
  name: string;
424
426
  type: _doracli_type.TConfigType;
425
427
  input: string;
@@ -447,7 +449,8 @@ declare const splitDoraConfig: (config: TDoraConfig) => PartialRecursive<TDoraCo
447
449
  esbuildConfig?: _doracli_type_src_dora_config_esbuild.TDoraConfigEsbuild;
448
450
  serviceConfig?: Partial<_doracli_type.TDoraConfigService>;
449
451
  dtsConfig?: _doracli_type_src_dora_config_dts.TDoraConfigDts;
450
- }[];
452
+ browserExtensionConfig?: _doracli_type.TDoraConfigBrowserExtension;
453
+ }[] | PartialRecursive<TDoraConfig>[];
451
454
 
452
- export { CompilerBase, ConfigCtx, DynamicHtml, EnvEnum, GenerateConfigHtml, HtmlAssetManager, HtmlManage, cLog, cLogDebugger, cLogError, cLogMessage, cLogSuccess, cLogTime, cLogTimeEnd, cLogWarn, clearMw, collectBaseConfigMw, collectCdnConfigMw, collectConfig, collectConfigs, collectDoraConfigMw, collectPackageJsonMw, collectTsconfigJsonMw, configCtxCollect, configCtxWorkflow, createDependFilter, createEnvParams, createOutputList, deepMergeObject, findInput, findInputHtml, getDefaultHtml, getDependencies, getDoracliConfig, getPackageJson, getTsPathAlias, getTsconfigJson, getUserCdn, inputFileDirList, inputFileTypeList, inputHtmlFileDirList, insertTsconfig, mergeDoraCliConfig, mergeDoraCliConfigMutiple, parseCdnConfig, parseDoracliConfig, parseHtml, parsetConfig, resolveCdnConfig, resolveDoraConfig, resolvePackageJson, resolveTsconfigJson, setLogLevel, splitDoraCliConfig, splitDoraConfig, wholeDoraConfig, wholeDoraConfigMw, wholeDoraInoutMw };
455
+ export { CompilerBase, ConfigCtx, DynamicHtml, EnvEnum, GenerateConfigHtml, HtmlAssetManager, HtmlManage, cLog, cLogDebugger, cLogError, cLogMessage, cLogSuccess, cLogTime, cLogTimeEnd, cLogWarn, clearMw, collectBaseConfigMw, collectCdnConfigMw, collectConfig, collectConfigs, collectDoraConfigMw, collectPackageJsonMw, collectTsconfigJsonMw, configCtxCollect, configCtxWorkflow, createDependFilter, createEnvParams, createOutputList, deepMergeObject, findInput, findInputHtml, getDefaultHtml, getDependencies, getDoracliConfig, getPackageJson, getTsPathAlias, getTsconfigJson, getUserCdn, htmlDefault, inputFileDirList, inputFileTypeList, inputHtmlFileDirList, insertTsconfig, mergeDoraCliConfig, mergeDoraCliConfigMutiple, parseCdnConfig, parseDoracliConfig, parseHtml, parsetConfig, resolveCdnConfig, resolveDoraConfig, resolvePackageJson, resolveTsconfigJson, setLogLevel, splitDoraCliConfig, splitDoraConfig, wholeDoraConfig, wholeDoraConfigMw, wholeDoraInoutMw };
453
456
  export type { IScriptOptions, TBundleAsset, TCollectType, TOutputSingle, TParseConfigResult, TParsedTag, TParsedTagAttr, TWorkflowApi };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doracli/helper",
3
- "version": "0.0.5",
3
+ "version": "0.0.8",
4
4
  "description": "use helper",
5
5
  "author": "cclr <18843152354@163.com>",
6
6
  "homepage": "",
@@ -29,16 +29,16 @@
29
29
  "g:build": "drr build"
30
30
  },
31
31
  "dependencies": {
32
- "@cclr/lang": "^0.1.49",
33
- "@cclr/utils": "^0.1.49",
34
- "@dorabag/config-loader": "^1.0.16",
35
- "@dorabag/file-pro": "^1.0.10",
36
- "@dorabag/open-browser": "^1.0.16",
37
- "@dorabag/srv-tool": "^1.0.16",
38
- "@doracli/type": "^0.0.5",
32
+ "@cclr/lang": "^0.1.52",
33
+ "@cclr/utils": "^0.1.52",
34
+ "@dorabag/config-loader": "^1.0.17",
35
+ "@dorabag/file-pro": "^1.0.18",
36
+ "@dorabag/open-browser": "^1.0.18",
37
+ "@dorabag/srv-tool": "^1.0.17",
38
+ "@doracli/type": "^0.0.8",
39
39
  "picocolors": "^1.1.1",
40
40
  "webpack": "^5.104.1",
41
41
  "webpack-dev-server": "^5.2.2"
42
42
  },
43
- "gitHead": "ac4c6829b2cec621ecf66b6324843773e8b5141f"
43
+ "gitHead": "f0bd0475ac70c3c95336633ffdab4a4ec9794ca7"
44
44
  }