@hyext/builder-revues 0.0.1-beta.9 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,4 +3,4 @@
3
3
  * (c) 2024-2024 Alex
4
4
  * Released under the MIT License.
5
5
  */
6
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("fs-extra"),e=require("path"),a=require("@revues/code-compiler"),n=require("os"),o=require("chalk"),i=require("util"),r=require("glob"),u=require("handlebars"),s=require("live-server"),l=require("archiver"),c=require("ramda");function d(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var f,p=d(t),m=d(e),h=d(n),y=d(o),g=d(u),j=d(s),x=d(l),P=d(c);!function(t){t[t.Integration=0]="Integration",t[t.Separate=1]="Separate"}(f||(f={}));const S=m.default.join(h.default.tmpdir(),".revue_cache"),v=f.Integration,w=m.default.resolve(__dirname,"../static"),b="project.config.json";function k(t,e){p.default.copyFileSync(m.default.join(t,b),m.default.join(e,b))}function _(){p.default.existsSync(S)||p.default.mkdirSync(S)}const I=y.default.gray("·");var E=(t=>{t=` ${t}`;return{log(...e){const a=i.format.apply(i.format,e);console.log(y.default.white(t),I,a)},fatal(...e){e[0]instanceof Error&&(e[0]=e[0].message.trim());const a=i.format.apply(i.format,e);console.error(y.default.red(t),I,a),process.exit(1)},success(...e){const a=i.format.apply(i.format,e);console.log(y.default.green(t),I,a)}}})("REVUE");async function U(t,e){_(),await a.compilerManager.init({projectPath:t,outputPath:e,cachePath:S}),await a.compilerManager.compileDev(),k(t,e)}async function T(t,e){_(),function(t){const e=m.default.join(t,"web-adapter.js"),a=require.resolve("@revues/cocos-web-adapter/dist/index.js");p.default.existsSync(e)?p.default.writeFileSync(e,p.default.readFileSync(a)):E.log("The web-adapter.js was not found from project root.")}(t),await a.compilerManager.init({projectPath:t,outputPath:e,cachePath:S}),await a.compilerManager.compileDev(),k(t,e)}const $={test:"//test-extsdk.msstatic.com",prod:"//extsdk-msstatic.cdn.huya.com"};function F(t){return`${$.prod}/sdk/$1/${t.hostId}/${t.extUuid||0}/sdk.js`}function q(t,e,a){const n=p.default.readFileSync(t).toString();p.default.outputFileSync(e,function(t,e,a){return g.default.compile(t,{noEscape:!0})(e,a)}(n,a))}function C(t,e){const n=m.default.join(t,"package"),o=function(t){const e=m.default.join(t,"packageConfig.json");return p.default.readJSONSync(e)}(n),i=o.findIndex((t=>{return(e=t).name===a.pkgFileType.MainPkg&&"."===e.root;var e}));if(-1===i)throw new Error("无法找到主包构建信息");const r=o[i];o.splice(i,1);const u=o;u.length>0&&function(t,e,a,n){const o=m.default.join(t,e.name);a.forEach((e=>{const a=m.default.join(t,e.name),i=m.default.join(a,e.root),r=m.default.join(o,e.root);n&&n(a,o,e),p.default.moveSync(i,r,{overwrite:!0}),p.default.removeSync(m.default.join(t,e.name))}))}(n,r,u,e);const s=m.default.join(w,"framework");if(v===f.Integration){p.default.copySync(s,m.default.join(t,"framework"));const e=m.default.join(t,"sdk");p.default.mkdirSync(e),D(e,"@revues/web-sdk-core"),D(e,"@revues/web-frame")}return{mainPakConf:r,packagePath:n}}function D(t,e){const a=require.resolve(e);let n=m.default.join(a,"../");"dist"===m.default.basename(n)?p.default.copySync(n,t):(n=m.default.resolve(n,"../"),n=m.default.join(n,"dist"),p.default.existsSync(n)?p.default.copySync(n,t):E.log(`Builder can't resolve ${e} entry from ${a}`))}function z(t,e){const{mainPakConf:a,packagePath:n}=C(t),o=m.default.join(w,"template"),i=m.default.join(n,a.name);return function(t){const{mainPath:e,sourcePathPrefix:a,templatePath:n,hyextSDKUrl:o}=t,i={sourcePathPrefix:a,hyextSDKUrl:o},r=[{input:m.default.join(n,"game-frame.hbs"),output:m.default.join(e,"game-frame.html"),data:i},{input:m.default.join(n,"minigame-page-manager.hbs"),output:m.default.join(e,"index.html"),data:i}];r.forEach((t=>{q(t.input,t.output,t.data)}))}({hyextSDKUrl:F({hostId:e.hostId,extUuid:e.extUuid}),sourcePathPrefix:v===f.Integration?m.default.relative(i,t):"",templatePath:o,mainPath:i}),function(t){const e=r.sync("**/**.wasm",{cwd:t,ignore:K,nodir:!0,absolute:!1});console.log("transform wasm to base64 files: \n",e),e.forEach((e=>{const a=m.default.join(t,e),n=p.default.readFileSync(a).toString("base64");p.default.outputFileSync(a+".txt",n)}))}(i),{mainPath:i,main:a,entryPath:"package/"+a.name+"/index.html"}}const K=["node_modules/**/*","**/node_modules/**","**/.git/**",".git/**/*","**/.svn/**",".svn/**/*",".DS_Store","**/.DS_Store"];function M(t,e,a){const n=a.name+".js",o=a.name+".js.map",i=m.default.join(t,n),r=m.default.join(t,o);p.default.existsSync(i)&&p.default.outputFileSync(m.default.join(e,n),p.default.readFileSync(i)),p.default.existsSync(r)&&p.default.outputFileSync(m.default.join(e,o),p.default.readFileSync(r))}function N(t,e){const{mainPakConf:a,packagePath:n}=C(t,M),o=function(t){const e=m.default.join(t,"packageExtConfig.json");return p.default.readJSONSync(e)}(n),i=m.default.join(w,"template"),r=m.default.join(n,a.name);return function(t){const{mainPath:e,sourcePathPrefix:a,templatePath:n,hyextSDKUrl:o,packageExtConfig:i}=t,r={sourcePathPrefix:a,hyextSDKUrl:o,packageExtConfig:JSON.stringify(i)},u=[{input:m.default.join(n,"miniapp-page-manager.hbs"),output:m.default.join(e,"index.html"),data:r},{input:m.default.join(n,"service.hbs"),output:m.default.join(e,"service.html"),data:r}];u.forEach((t=>{q(t.input,t.output,t.data)}))}({hyextSDKUrl:F({hostId:e.hostId,extUuid:e.extUuid}),sourcePathPrefix:v===f.Integration?m.default.relative(r,t):"",packageExtConfig:o,templatePath:i,mainPath:r}),{mainPath:r,main:a,entryPath:"package/"+a.name+"/index.html"}}var R={cert:p.default.readFileSync(m.default.join(w,"./certs/cert.pem")),key:p.default.readFileSync(m.default.join(w,"./certs/key.pem")),passphrase:""};async function O(t,e){const{baseURI:a,extTypes:n,entryInfo:o,outputPath:i}=e,r=m.default.join(i,"build-result"),u={},s=n.map((t=>{const e={type:"HTML",content:{pages:[{path:J(t,o)}],baseURI:a}};return u[t]=e,{type:t,buildResult:{[t]:e}}}));if("development"===t){const t=s.map((t=>p.default.outputFile(m.default.join(r,t.type+".json"),JSON.stringify(t.buildResult,null,2))));await Promise.all(t)}return u}function J(t,e){let a=e.entryPath+`?extType=${t}`;return t.endsWith("_h5")&&(a+="&__module_busi__=kiwi-ExtSDK"),a}const L=t=>{const e=(()=>{const t=h.default.networkInterfaces(),e=P.default.flatten(P.default.values(t));return P.default.filter((t=>/(ipv)?4/gi.test(t.family)&&!/^127\./.test(t.address)),e)})();return e&&e.length>1&&(E.log(`检测到本机有多个 ip 地址:\n- ${e.map((t=>t.address)).join("\n- ")}`),E.log("请在 project.config.json 的 host 中指定正确的 ip"),process.exit(1)),e&&e.length<=0&&(E.log("未能找到本机 ip 地址, 本地开发 app 侧将无法加载小程序"),process.exit(1)),e[0]?.address},W=new Set(["web_video_com","app_panel_h5","zs_anchor_panel_h5","pc_anchor_panel","pc_panel"]);function B(t,e){const a={...e};return function(t){let e=[];t&&0!==t.length?t.forEach((t=>{W.has(t)||e.push(t)})):E.fatal("请在project.config.json相应地方填写supportExtTypes."),e.length>0&&E.fatal(`未支持的小程序类型:${e.join("|")}.`)}(e.supportExtTypes),function(t){null==t.hostId&&(t.hostId="huyaext")}(a),"development"===t&&function(t){t.https=!0,null==t.host&&(t.host=L()||""),null==t.port&&(t.port=18080)}(a),a}function H(t){return`${t.https?"https":"http"}://${t.host}:${t.port}/`}function V(t,e,a){E.log("正在合并分包...");const n=("game"==t.compileType?z:N)(e,a);return E.success("合并分包完成"),n}const A=new class{async build(t){const{inputPath:e,outputPath:a,publicPath:n,projectConfig:o,config:i,extUuid:r}=t,u=B("production",i);p.default.existsSync(a)&&p.default.removeSync(a),await p.default.copy(e,a,{overwrite:!0});const s=V(o,a,{hostId:u.hostId,extUuid:r});return await O("production",{entryInfo:s,baseURI:n,extTypes:u.supportExtTypes,outputPath:a})}async start(t){const{inputPath:e,projectConfig:a,outputPath:n,config:o}=t,i=n||m.default.join(__dirname,"../../temp"),r=B("development",o);"game"==a.compileType?await T(e,i):await U(e,i);const u=V(a,i,{hostId:r.hostId,extUuid:void 0});return E.log("启动 live server 服务..."),E.success("本地访问地址:",H(r)+u.entryPath+"?extType=web_video_com"),function(t){var e={port:t.port,host:t.host,root:t.root,open:!1,ignore:t.ignore,file:"index.html",wait:1e3,mount:t.mount,logLevel:1,https:R};j.default.start(e)}({...r,root:i}),await O("development",{entryInfo:u,baseURI:H(r),extTypes:r.supportExtTypes,outputPath:i})}async release(t){const{contextPath:e,releasePath:a,projectConfig:n}=t;p.default.existsSync(a)&&p.default.removeSync(a);const o=n.projectName||n.projectname||"project",i=m.default.join(a,o);"game"==n.compileType?await T(e,i):await U(e,i);const r=m.default.join(a,o);var u;await(u=r,new Promise(((t,e)=>{const a=p.default.createWriteStream(`${u}.zip`),n=x.default("zip",{zlib:{level:9}});a.on("close",(()=>{const e=n.pointer();t({name:`${m.default.basename(u)}.zip`,size:e})})),n.on("warning",(t=>{if("ENOENT"!==t.code)throw t})),n.on("error",(t=>{throw e(t),t})),n.pipe(a),n.directory(`${u}`,!1),n.finalize()})))}config(){}providedProjectConfig(){}};module.exports=A,exports.default=A;
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("fs-extra"),t=require("path"),a=require("@revues/code-compiler"),n=require("os"),o=require("chalk"),i=require("util"),r=require("glob"),u=require("handlebars"),s=require("tapable"),c=require("live-server"),l=require("archiver"),d=require("ramda");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f,m=p(e),g=p(t),h=p(n),y=p(o),x=p(u),P=p(c),j=p(l),v=p(d);!function(e){e[e.Integration=0]="Integration",e[e.Separate=1]="Separate"}(f||(f={}));const S=h.default.tmpdir(),b=g.default.join(S,".revue_cache"),w=f.Integration,k=g.default.resolve(__dirname,"../static");var U;!function(e){e.miniProgram="miniProgram",e.miniProgramPlugin="miniProgramPlugin",e.miniGame="miniGame",e.miniGamePlugin="miniGamePlugin"}(U||(U={}));const I="project.config.json";function _(e,t){m.default.copyFileSync(g.default.join(e,I),g.default.join(t,I))}function C(){m.default.existsSync(b)||m.default.mkdirSync(b)}async function T(e,t){C(),await a.compilerManager.init({projectPath:e,outputPath:t,cachePath:b}),await a.compilerManager.compileDev(),_(e,t)}async function E(e,t){C(),await a.compilerManager.init({projectPath:e,outputPath:t,cachePath:b,compileSettings:{cocos:!0}}),await a.compilerManager.compileDev(),_(e,t)}const N=y.default.gray("·");var M=(e=>{e=` ${e}`;return{log(...t){const a=i.format.apply(i.format,t);console.log(y.default.white(e),N,a)},fatal(...t){t[0]instanceof Error&&(t[0]=t[0].message.trim());const a=i.format.apply(i.format,t);console.error(y.default.red(e),N,a),process.exit(1)},success(...t){const a=i.format.apply(i.format,t);console.log(y.default.green(e),N,a)}}})("REVUE");const $=Date.now(),O="production"!==process.env.HYEXT_BUILD_ENV?"//test-hd.huya.com/h5/hyext-sentry-setup-script/test/sentry-setup.js":`//a.msstatic.com/huya/hd/h5/hyext-sentry-setup-script/sentry-setup.js?hash=${$}`;function F(e,t,a){const n=m.default.readFileSync(e).toString();m.default.outputFileSync(t,function(e,t,a){return x.default.compile(e,{noEscape:!0})(t,a)}(n,a))}x.default.registerHelper("toJSON",(function(e){return new x.default.SafeString(JSON.stringify(e))}));const q={context:{deviceOrientation:"portrait"},hooks:{onMergedMainPackge:new s.SyncHook(["IOnMergedMainPackge"]),onSrartBefore:new s.SyncHook(["IOnSrartBefore"])}};class D{apply(e){e.hooks.onMergedMainPackge.tap("InjectWebviewUrlParamsPlugin",(t=>{const{compileType:a,mainPath:n}=t,o=a===U.miniGame;if(o){const t=m.default.readJsonSync(g.default.join(n,"game.json"));"string"==typeof t.deviceOrientation&&t.deviceOrientation.includes("landscape")&&(e.context.deviceOrientation="landscape")}e.context.webviewUrlParams={isLandscape:0,disablePopGesture:1,hideStatusBar:o?1:0,hideBar:1,bounces:0}}))}}function R(){const e=q.context.webviewUrlParams;return e?(t=e,Object.keys(t).reduce(((e,a)=>e+`&${a}=${encodeURIComponent(t[a])}`),"")):"";var t}const z={test:"//test-extsdk.msstatic.com",prod:"//extsdk-msstatic.cdn.huya.com"};function B(e,t,n){const o=g.default.join(t,"package"),i=function(e){const t=g.default.join(e,"packageConfig.json");return m.default.readJSONSync(t)}(o),r=i.findIndex((e=>{return(t=e).name===a.pkgFileType.MainPkg&&"."===t.root;var t}));if(-1===r)throw new Error("无法找到主包构建信息");const u=i[r];i.splice(r,1);const s=i;if(s.length>0&&function(e,t,a,n){const o=g.default.join(e,t.name);a.forEach((t=>{const a=g.default.join(e,t.name),i=g.default.join(a,t.root),r=g.default.join(o,t.root);n&&n(a,o,t),m.default.moveSync(i,r,{overwrite:!0}),m.default.removeSync(g.default.join(e,t.name))}))}(o,u,s,n),!e){const e=g.default.join(k,"framework");if(w===f.Integration){m.default.copySync(e,g.default.join(t,"framework"));const a=g.default.join(t,"sdk");m.default.mkdirSync(a),G(a,"@revues/web-sdk-core"),G(a,"@revues/web-frame"),G(a,"@revues/hyext-adapter")}}return{mainPakConf:u,packagePath:o}}function G(e,t){const a=require.resolve(t);let n=g.default.join(a,"../");"dist"===g.default.basename(n)?m.default.copySync(n,e):(n=g.default.resolve(n,"../"),n=g.default.join(n,"dist"),m.default.existsSync(n)?m.default.copySync(n,e):M.log(`Builder can't resolve ${t} entry from ${a}`))}function J(e){const{builderConfig:t,mainPakConf:a,extUuid:n}=e;return t.supportExtTypes.map((e=>{const o=`index_${e}.html`;return{extType:e,entryPath:"package/"+a.name+"/"+o,sdkUrl:(i={extType:e,extUuid:n,hostId:t.hostId,isTestEnv:t.isTestEnv},`${i.isTestEnv?z.test:z.prod}/sdk/${i.extType}/${i.hostId}/${i.extUuid||0}/sdk.js`),entryFilename:o};var i}))}function H(e,t){const a=t.extName,n=t.extUuid,o=t.builderConfig,i=!!t.watch,{mainPakConf:u,packagePath:s}=B(i,e),c=g.default.join(k,"template"),l=g.default.join(s,u.name),d=J({builderConfig:o,mainPakConf:u,extUuid:n});return q.hooks.onMergedMainPackge.call({mainConf:u,mainPath:l,compileType:U.miniGame}),i||(function(e){const{mainPath:t,sourcePathPrefix:a,templatePath:n,entrys:o,debug:i,dev:r,extUuid:u,extName:s}=e,c=[{input:g.default.join(n,"game-frame.hbs"),output:g.default.join(t,"game-frame.html"),data:{sourcePathPrefix:a}}];r&&c.push({input:g.default.join(n,"remote-debugger.hbs"),output:g.default.join(t,"remote-debugger.html"),data:{extUuid:u,paramsStr:R()}});const l=o.map((e=>({input:g.default.join(n,"minigame-page-manager.hbs"),output:g.default.join(t,e.entryFilename),data:{sourcePathPrefix:a,hyextSDKUrl:e.sdkUrl,debug:i,sentryScript:r?void 0:O,extInfo:{extUuid:u,envVersion:r?"develop":"release",extType:e.extType,extName:s},deviceOrientation:q.context.deviceOrientation}})));l.concat(c).forEach((e=>{F(e.input,e.output,e.data)}))}({entrys:d,sourcePathPrefix:w===f.Integration?g.default.relative(l,e):"",templatePath:c,mainPath:l,extUuid:n,extName:a,...t.template}),function(e){const t=r.sync("**/**.wasm",{cwd:e,ignore:L,nodir:!0,absolute:!1});t.length&&console.log("transform wasm to base64 files: \n",t),t.forEach((t=>{const a=g.default.join(e,t),n=m.default.readFileSync(a).toString("base64");m.default.outputFileSync(a+".txt",n)}))}(l)),{entrys:d,mainPublicPath:"package/"+u.name}}const L=["node_modules/**/*","**/node_modules/**","**/.git/**",".git/**/*","**/.svn/**",".svn/**/*",".DS_Store","**/.DS_Store"];function V(e,t,a){const n=a.name+".js",o=a.name+".js.map",i=g.default.join(e,n),r=g.default.join(e,o);m.default.existsSync(i)&&m.default.outputFileSync(g.default.join(t,n),m.default.readFileSync(i)),m.default.existsSync(r)&&m.default.outputFileSync(g.default.join(t,o),m.default.readFileSync(r))}function K(e,t){const a=t.extName,n=t.extUuid,o=t.builderConfig,i=!!t.watch,{mainPakConf:r,packagePath:u}=B(i,e,V),s=function(e){const t=g.default.join(e,"packageExtConfig.json");return m.default.readJSONSync(t)}(u),c=g.default.join(k,"template"),l=g.default.join(u,r.name),d=J({builderConfig:o,mainPakConf:r,extUuid:n});return q.hooks.onMergedMainPackge.call({mainConf:r,mainPath:l,compileType:U.miniProgram}),i||function(e){const{mainPath:t,sourcePathPrefix:a,templatePath:n,entrys:o,packageExtConfig:i,debug:r,dev:u,extUuid:s,extName:c}=e,l=JSON.stringify(i),d=[{input:g.default.join(n,"service.hbs"),output:g.default.join(t,"service.html"),data:{sourcePathPrefix:a}}];u&&d.push({input:g.default.join(n,"remote-debugger.hbs"),output:g.default.join(t,"remote-debugger.html"),data:{extUuid:s,paramsStr:R()}});const p=o.map((e=>({input:g.default.join(n,"miniapp-page-manager.hbs"),output:g.default.join(t,e.entryFilename),data:{sourcePathPrefix:a,packageExtConfig:l,hyextSDKUrl:e.sdkUrl,debug:r,sentryScript:u?void 0:O,extInfo:{extUuid:s,envVersion:u?"develop":"release",version:"",extType:e.extType,extName:c}}})));p.concat(d).forEach((e=>{F(e.input,e.output,e.data)}))}({entrys:d,sourcePathPrefix:w===f.Integration?g.default.relative(l,e):"",packageExtConfig:s,templatePath:c,mainPath:l,extUuid:n,extName:a,...t.template}),{entrys:d,mainPublicPath:"package/"+r.name}}class W{apply(e){e.hooks.onSrartBefore.tap("RemoveUnlessDIrPlugin",(e=>{const{inputPath:t}=e,a=g.default.join(t,"release"),n=g.default.join(t,"dist");X(a),X(n)}))}}function X(e){m.default.existsSync(e)&&m.default.removeSync(e)}var Y={cert:m.default.readFileSync(g.default.join(k,"./certs/cert.pem")),key:m.default.readFileSync(g.default.join(k,"./certs/key.pem")),passphrase:""};async function A(e,t){const{baseURI:a,entrys:n,outputPath:o}=t,i=g.default.join(o,"build-result"),r={},u=R(),s=n.map((e=>{const t={type:"HTML",content:{pages:[{path:Q(e,u)}],baseURI:a}};return r[e.extType]=t,{type:e.extType,buildResult:{[e.extType]:t}}}));if("development"===e){const e=s.map((e=>m.default.outputFile(g.default.join(i,e.type+".json"),JSON.stringify(e.buildResult,null,2))));await Promise.all(e)}return r}function Q(e,t){const a=e.extType;let n=e.entryPath;return a.endsWith("_h5")&&(n+="?__module_busi__=kiwi-ExtSDK"+t),n}const Z=e=>{const t=(()=>{const e=h.default.networkInterfaces(),t=v.default.flatten(v.default.values(e));return v.default.filter((e=>/(ipv)?4/gi.test(e.family)&&!/^127\./.test(e.address)),t)})();return t&&t.length>1&&(M.log(`检测到本机有多个 ip 地址:\n- ${t.map((e=>e.address)).join("\n- ")}`),M.log("请在 project.config.json 的 host 中指定正确的 ip"),process.exit(1)),t&&t.length<=0&&(M.log("未能找到本机 ip 地址, 本地开发 app 侧将无法加载小程序"),process.exit(1)),t[0]?.address},ee=new Set(["app_inner_h5","web_video_com","app_panel_h5","zs_anchor_panel_h5","pc_anchor_panel","pc_panel"]);function te(e,t){const a={...t};return function(e){let t=[];e&&0!==e.length?e.forEach((e=>{ee.has(e)||t.push(e)})):M.fatal("请在project.config.json相应地方填写supportExtTypes."),t.length>0&&M.fatal(`未支持的小程序类型:${t.join("|")}.`)}(t.supportExtTypes),function(e){null==e.hostId&&(e.hostId="huyaext")}(a),"development"===e&&function(e){e.https=!0,null==e.host&&(e.host=Z()||""),null==e.port&&(e.port=18080)}(a),a}function ae(e){return`${e.https?"https":"http"}://${e.host}:${e.port}/`}function ne(e,t,a){M.log("正在合并分包...");const n=("game"==e.compileType?H:K)(t,a);return M.success("合并分包完成"),n}const oe=new class{constructor(){var e;e=q,(new D).apply(e),(new W).apply(e)}async build(e){const{inputPath:t,outputPath:a,publicPath:n,projectConfig:o,config:i,extUuid:r,extName:u}=e,s=te("production",i);m.default.existsSync(a)&&m.default.removeSync(a),await m.default.copy(t,a,{overwrite:!0});const{entrys:c}=ne(o,a,{builderConfig:s,extUuid:r,extName:u});return await A("production",{entrys:c,baseURI:n,outputPath:a})}async start(e){const{debug:t,inputPath:n,projectConfig:o,outputPath:i,config:r}=e;q.hooks.onSrartBefore.call({inputPath:n});const u=(s=g.default.basename(n),g.default.join(S,".revues-projects",s));var s;const c=function(e){const t=e.appId||e.appid;return null==t||""===t?M.fatal("请填写正确的appid"):t.length>10&&M.fatal("appid错误,请登录 https://ext.huya.com/ 在您的小程序概要中查看小程序ID"),t}(o),l=(d=o).projectname||d.projectName||"小程序";var d;const p=te("development",r);"game"==o.compileType?await async function(e,t,n){await E(e,t),a.compilerManager.watch({graphId:"game"},(async(e,t)=>{await a.compilerManager.compileSingleCode({type:e,filePath:t,graphId:"game"}),n&&n()}))}(n,u,(()=>{ne(o,u,{builderConfig:p,watch:!0})})):await async function(e,t,n){await T(e,t),a.compilerManager.watch({graphId:"miniprogram"},(async(e,t)=>{await a.compilerManager.compileSingleCode({type:e,filePath:t,graphId:"miniprogram"}),n&&n()}))}(n,u,(()=>{ne(o,u,{builderConfig:p,watch:!0})}));const{entrys:f,mainPublicPath:m}=ne(o,u,{builderConfig:p,extUuid:c,extName:l,template:{debug:t,dev:!0}});return M.log("启动 live server 服务..."),M.success("本地访问地址:",ae(p)+f[0]?.entryPath),M.success("扫码预览地址:",ae(p)+m+"/remote-debugger.html"),function(e){var t={port:e.port,host:e.host,root:e.root,open:!1,ignore:e.ignore,file:"index.html",wait:1e3,mount:e.mount,logLevel:1,https:Y};P.default.start(t)}({...p,root:u,ignore:"node_modules"}),await A("development",{entrys:f,baseURI:ae(p),outputPath:i})}async release(e){const{contextPath:t,releasePath:a,projectConfig:n}=e;m.default.existsSync(a)&&m.default.removeSync(a),M.log("开始打包");const o=n.projectName||n.projectname||"project",i=g.default.join(a,o);"game"==n.compileType?await E(t,i):await T(t,i);const r=g.default.join(a,o);var u;await(u=r,new Promise(((e,t)=>{const a=m.default.createWriteStream(`${u}.zip`),n=j.default("zip",{zlib:{level:9}});a.on("close",(()=>{const t=n.pointer();e({name:`${g.default.basename(u)}.zip`,size:t})})),n.on("warning",(e=>{if("ENOENT"!==e.code)throw e})),n.on("error",(e=>{throw t(e),e})),n.pipe(a),n.directory(`${u}`,!1),n.finalize()}))),M.success("打包成功,zip包地址:"+r)}config(){}providedProjectConfig(){}clearCache(){try{m.default.existsSync(b)&&m.default.removeSync(b),M.success("项目缓存清除成功~")}catch(e){M.success("项目缓存清除失败 \n"+e.message)}}};module.exports=oe,exports.default=oe;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyext/builder-revues",
3
- "version": "0.0.1-beta.9",
3
+ "version": "1.0.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "diamondloler <857276958@qq.com>",
6
6
  "homepage": "",
@@ -20,12 +20,15 @@
20
20
  "type": "git",
21
21
  "url": "https://git.huya.com/exc/web/remax.git"
22
22
  },
23
- "scripts": {},
23
+ "scripts": {
24
+ "minify": "node scripts/minify"
25
+ },
24
26
  "dependencies": {
25
- "@revues/cocos-web-adapter": "0.0.1-beta.9",
26
- "@revues/code-compiler": "0.0.1-beta.9",
27
- "@revues/web-frame": "0.0.1-beta.9",
28
- "@revues/web-sdk-core": "0.0.1-beta.9",
27
+ "@revues/cocos-web-adapter": "1.0.0",
28
+ "@revues/code-compiler": "1.0.0",
29
+ "@revues/hyext-adapter": "0.0.1-beta.19",
30
+ "@revues/web-frame": "1.0.0",
31
+ "@revues/web-sdk-core": "1.0.0",
29
32
  "archiver": "^7.0.1",
30
33
  "chalk": "^2.4.2",
31
34
  "fs-extra": "8.1.0",
@@ -33,12 +36,14 @@
33
36
  "handlebars": "^4.7.8",
34
37
  "live-server": "^1.2.2",
35
38
  "ramda": "^0.29.1",
39
+ "tapable": "^2.2.1",
36
40
  "util": "^0.12.5"
37
41
  },
38
42
  "devDependencies": {
39
43
  "@types/archiver": "^6.0.2",
40
44
  "@types/live-server": "^1.2.3",
41
- "@types/ramda": "^0.29.11"
45
+ "@types/ramda": "^0.29.11",
46
+ "terser": "^5.31.0"
42
47
  },
43
- "gitHead": "9ea152ecbbf8e5a4805f3c5e2054eb3aa7c00e12"
48
+ "gitHead": "5408ebecf3994a4ae557728f119b6c52bcbb3b1b"
44
49
  }
@@ -893,23 +893,23 @@ div.wx-picker {
893
893
  position: fixed;
894
894
  width: 100%;
895
895
  left: 0;
896
- bottom: 274px;
896
+ bottom: 0;
897
897
  z-index: 2048;
898
898
  -webkit-backface-visibility: hidden;
899
899
  backface-visibility: hidden;
900
- -webkit-transform: translateY(100%);
900
+ /* -webkit-transform: translateY(100%);
901
901
  transform: translateY(100%);
902
902
  -webkit-transition: -webkit-transform .3s;
903
903
  transition: -webkit-transform .3s;
904
904
  transition: transform .3s;
905
- transition: transform .3s, -webkit-transform .3s;
905
+ transition: transform .3s, -webkit-transform .3s; */
906
906
  -moz-user-select: none;
907
907
  -webkit-user-select: none;
908
908
  -ms-user-select: none
909
909
  }
910
910
 
911
911
  .wx-picker-android {
912
- bottom: 414px
912
+ bottom: 0px
913
913
  }
914
914
 
915
915
  .wx-picker-show {
@@ -3113,7 +3113,8 @@ wx-video .wx-video-slot * {
3113
3113
 
3114
3114
  wx-video video {
3115
3115
  width: 100%;
3116
- height: 100%
3116
+ height: 100%;
3117
+ position: relative;
3117
3118
  }
3118
3119
 
3119
3120
  wx-video .wx-video-playmask {
@@ -3150,7 +3151,7 @@ wx-video .wx-video-bar {
3150
3151
  display: flex;
3151
3152
  -webkit-align-items: center;
3152
3153
  align-items: center;
3153
- padding: 0 10px
3154
+ padding: 0 10px;
3154
3155
  }
3155
3156
 
3156
3157
  wx-video .wx-video-bar.full {