@hyext/builder-revues 0.0.1-beta.3 → 0.0.1-beta.6
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 +6 -0
- package/package.json +13 -13
- package/static/certs/cert.pem +23 -0
- package/static/certs/key.pem +28 -0
- package/static/framework/.DS_Store +0 -0
- package/static/framework/css/index.css +4896 -0
- package/static/framework/script/console.js +1 -0
- package/static/framework/script/game-adapt.js +9715 -0
- package/static/framework/script/game-service.js +27004 -0
- package/static/framework/script/service.js +49536 -0
- package/static/framework/script/view.js +83900 -0
- package/static/framework/script/worker.js +1 -0
- package/static/template/game-frame.hbs +43 -0
- package/static/template/miniapp-page-manager.hbs +38 -0
- package/static/template/minigame-page-manager.hbs +46 -0
package/dist/index.js
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
/*!
|
2
|
+
* @revues/builder-revues
|
3
|
+
* (c) 2024-2024 Alex
|
4
|
+
* Released under the MIT License.
|
5
|
+
*/
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("fs-extra"),t=require("path"),o=require("@revues/code-compiler"),n=require("os"),a=require("chalk"),r=require("util"),i=require("glob"),u=require("handlebars"),s=require("live-server"),l=require("archiver"),c=require("ramda");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f,p=d(e),m=d(t),h=d(n),y=d(a),g=d(u),j=d(s),v=d(l),x=d(c);!function(e){e[e.Integration=0]="Integration",e[e.Separate=1]="Separate"}(f||(f={}));const w=m.default.join(h.default.tmpdir(),".revue_cache"),S=f.Integration,P=m.default.resolve(__dirname,"../static"),_="project.config.json";function b(e,t){p.default.copyFileSync(m.default.join(e,_),m.default.join(t,_))}function I(){p.default.existsSync(w)||p.default.mkdirSync(w)}async function k(e,t){I(),function(e){const t=m.default.join(e,"web-adapter.js"),o=require.resolve("@revues/cocos-web-adapter/dist/index.js");if(!p.default.existsSync(t))throw new Error("The web-adapter.js was not found from project root.");p.default.writeFileSync(t,p.default.readFileSync(o))}(e),await o.compilerManager.init({projectPath:e,outputPath:t,cachePath:w}),await o.compilerManager.compileDev(),b(e,t)}const E=y.default.gray("·");var T=(e=>{e=` ${e}`;return{log(...t){const o=r.format.apply(r.format,t);console.log(y.default.white(e),E,o)},fatal(...t){t[0]instanceof Error&&(t[0]=t[0].message.trim());const o=r.format.apply(r.format,t);console.error(y.default.red(e),E,o),process.exit(1)},success(...t){const o=r.format.apply(r.format,t);console.log(y.default.green(e),E,o)}}})("REVUE");const U={test:"//test-extsdk.msstatic.com",prod:"//extsdk-msstatic.cdn.huya.com"};function $(e){return`${U.prod}/sdk/$1/${e.hostId}/${e.extUuid||0}/sdk.js`}function q(e,t,o){const n=p.default.readFileSync(e).toString();p.default.outputFileSync(t,function(e,t,o){return g.default.compile(e)(t,o)}(n,o))}function F(e,t){const n=m.default.join(e,"package"),a=function(e){const t=m.default.join(e,"packageConfig.json");return p.default.readJSONSync(t)}(n),r=a.findIndex((e=>{return(t=e).name===o.pkgFileType.MainPkg&&"."===t.root;var t}));if(-1===r)throw new Error("无法找到主包构建信息");const u=a[r];a.splice(r,1);const s=a;s.length>0&&function(e,t,o){const n=m.default.join(e,t.name);o.forEach((t=>{const o=m.default.join(e,t.name,t.root),a=m.default.join(n,t.root);p.default.moveSync(o,a,{overwrite:!0}),p.default.removeSync(m.default.join(e,t.name))}))}(n,u,s);const l=m.default.join(P,"framework"),c=m.default.join(P,"template"),d=m.default.join(n,u.name);if(S===f.Integration){p.default.copySync(l,m.default.join(e,"framework"));const t=require.resolve("@revues/web-sdk-core"),o=m.default.join(e,"sdk"),n=m.default.join(o,"web-sdk-core.js");p.default.mkdirSync(o),p.default.outputFileSync(n,p.default.readFileSync(t))}return function(e){const{mainPath:t,sourcePathPrefix:o,templatePath:n,hyextSDKUrl:a}=e,r={sourcePathPrefix:o,hyextSDKUrl:a},i=[{input:m.default.join(n,"game-frame.hbs"),output:m.default.join(t,"game-frame.html"),data:r},{input:m.default.join(n,"minigame-page-manager.hbs"),output:m.default.join(t,"index.html"),data:r}];i.forEach((e=>{q(e.input,e.output,e.data)}))}({hyextSDKUrl:$({hostId:t.hostId,extUuid:t.extUuid}),sourcePathPrefix:S===f.Integration?m.default.relative(d,e):"",templatePath:c,mainPath:d}),function(e){const t=i.sync("**/**.wasm",{cwd:e,ignore:D,nodir:!0,absolute:!1});console.log("transform wasm to base64 files: \n",t),t.forEach((t=>{const o=m.default.join(e,t),n=p.default.readFileSync(o).toString("base64");p.default.outputFileSync(o+".txt",n)}))}(d),{mainPath:d,main:u,entryPath:"package/"+u.name+"/index.html"}}const D=["node_modules/**/*","**/node_modules/**","**/.git/**",".git/**/*","**/.svn/**",".svn/**/*",".DS_Store","**/.DS_Store"];var z={cert:p.default.readFileSync(m.default.join(P,"./certs/cert.pem")),key:p.default.readFileSync(m.default.join(P,"./certs/key.pem")),passphrase:""};async function M(e,t){const{baseURI:o,extTypes:n,entryInfo:a,outputPath:r}=t,i=m.default.join(r,"build-result"),u={},s=n.map((e=>{const t={type:"HTML",content:{pages:[{path:R(e,a)}],baseURI:o}};return u[e]=t,{type:e,buildResult:{[e]:t}}}));if("development"===e){const e=s.map((e=>p.default.outputFile(m.default.join(i,e.type+".json"),JSON.stringify(e.buildResult,null,2))));await Promise.all(e)}return u}function R(e,t){let o=t.entryPath+`?extType=${e}`;return e.endsWith("_h5")&&(o+="&__module_busi__=kiwi-ExtSDK"),o}const C=e=>{const t=(()=>{const e=h.default.networkInterfaces(),t=x.default.flatten(x.default.values(e));return x.default.filter((e=>/(ipv)?4/gi.test(e.family)&&!/^127\./.test(e.address)),t)})();return t&&t.length>1&&(T.log(`检测到本机有多个 ip 地址:\n- ${t.map((e=>e.address)).join("\n- ")}`),T.log("请在 project.config.json 的 host 中指定正确的 ip"),process.exit(1)),t&&t.length<=0&&(T.log("未能找到本机 ip 地址, 本地开发 app 侧将无法加载小程序"),process.exit(1)),t[0]?.address},N=new Set(["web_video_com","app_panel_h5","zs_anchor_panel_h5","pc_anchor_panel","pc_panel"]);function K(e,t){const o={...t};return function(e){let t=[];e&&0!==e.length?e.forEach((e=>{N.has(e)||t.push(e)})):T.fatal("请在project.config.json相应地方填写supportExtTypes."),t.length>0&&T.fatal(`未支持的小程序类型:${t.join("|")}.`)}(t.supportExtTypes),function(e){null==e.hostId&&(e.hostId="huyaext")}(o),"development"===e&&function(e){e.https=!0,null==e.host&&(e.host=C()||""),null==e.port&&(e.port=18080)}(o),o}function O(e){return`${e.https?"https":"http"}://${e.host}:${e.port}/`}const J=new class{async build(e){const{inputPath:t,outputPath:o,publicPath:n,projectConfig:a,config:r,extUuid:i}=e,u=K("production",r);if(p.default.existsSync(o)&&p.default.removeSync(o),await p.default.copy(t,o,{overwrite:!0}),"game"==a.compileType){T.log("正在合并分包...");const e=F(o,{hostId:u.hostId,extUuid:i});return T.success("合并分包完成"),await M("production",{entryInfo:e,baseURI:n,extTypes:u.supportExtTypes,outputPath:o})}}async start(e){const{inputPath:t,projectConfig:o,outputPath:n,config:a}=e,r=n||m.default.join(__dirname,"../../temp"),i=K("development",a);if("game"==o.compileType){await k(t,r),T.log("正在合并分包...");const e=F(r,{hostId:i.hostId,extUuid:void 0});return T.success("合并分包完成"),T.log("启动 live server 服务..."),T.log("本地访问地址:",O(i)+e.entryPath+"?extType=web_video_com"),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:z};j.default.start(t)}({...i,root:r}),await M("development",{entryInfo:e,baseURI:O(i),extTypes:i.supportExtTypes,outputPath:r})}}async release(e){const{contextPath:t,releasePath:n,projectConfig:a}=e;p.default.existsSync(n)&&p.default.removeSync(n);const r=a.projectName||a.projectname||"project",i=m.default.join(n,r);"game"==a.compileType?await k(t,i):await async function(e,t){I(),await o.compilerManager.init({projectPath:e,outputPath:t,cachePath:w}),await o.compilerManager.compileDev(),b(e,t)}(t,i);const u=m.default.join(n,r);var s;await(s=u,new Promise(((e,t)=>{const o=p.default.createWriteStream(`${s}.zip`),n=v.default("zip",{zlib:{level:9}});o.on("close",(()=>{const t=n.pointer();e({name:`${m.default.basename(s)}.zip`,size:t})})),n.on("warning",(e=>{if("ENOENT"!==e.code)throw e})),n.on("error",(e=>{throw t(e),e})),n.pipe(o),n.directory(`${s}`,!1),n.finalize()})))}config(){}providedProjectConfig(){}};module.exports=J,exports.default=J;
|
package/package.json
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hyext/builder-revues",
|
3
|
-
"version": "0.0.1-beta.
|
3
|
+
"version": "0.0.1-beta.6",
|
4
4
|
"description": "> TODO: description",
|
5
5
|
"author": "diamondloler <857276958@qq.com>",
|
6
6
|
"homepage": "",
|
7
7
|
"license": "ISC",
|
8
8
|
"main": "dist",
|
9
9
|
"directories": {
|
10
|
-
"src": "src"
|
11
|
-
"test": "__tests__"
|
10
|
+
"src": "src"
|
12
11
|
},
|
13
12
|
"files": [
|
14
|
-
"dist"
|
13
|
+
"dist",
|
14
|
+
"static"
|
15
15
|
],
|
16
16
|
"publishConfig": {
|
17
17
|
"access": "public"
|
@@ -20,24 +20,24 @@
|
|
20
20
|
"type": "git",
|
21
21
|
"url": "https://git.huya.com/exc/web/remax.git"
|
22
22
|
},
|
23
|
-
"scripts": {
|
24
|
-
"test": "echo \"Error: run tests from root\" && exit 1"
|
25
|
-
},
|
23
|
+
"scripts": {},
|
26
24
|
"dependencies": {
|
27
|
-
"@revues/cocos-web-adapter": "
|
28
|
-
"@revues/code-compiler": "
|
29
|
-
"@revues/web-sdk-core": "
|
25
|
+
"@revues/cocos-web-adapter": "0.0.1-beta.6",
|
26
|
+
"@revues/code-compiler": "0.0.1-beta.6",
|
27
|
+
"@revues/web-sdk-core": "0.0.1-beta.6",
|
30
28
|
"archiver": "^7.0.1",
|
31
|
-
"
|
29
|
+
"chalk": "^2.4.2",
|
30
|
+
"fs-extra": "8.1.0",
|
32
31
|
"glob": "^10.3.10",
|
33
32
|
"handlebars": "^4.7.8",
|
34
33
|
"live-server": "^1.2.2",
|
35
|
-
"ramda": "^0.29.1"
|
34
|
+
"ramda": "^0.29.1",
|
35
|
+
"util": "^0.12.5"
|
36
36
|
},
|
37
37
|
"devDependencies": {
|
38
38
|
"@types/archiver": "^6.0.2",
|
39
39
|
"@types/live-server": "^1.2.3",
|
40
40
|
"@types/ramda": "^0.29.11"
|
41
41
|
},
|
42
|
-
"gitHead": "
|
42
|
+
"gitHead": "0c1d31b26d91ea26c3fd64d1a6707e38ca6c86ff"
|
43
43
|
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIID6zCCAtOgAwIBAgIUPDlH/8sZ9WTUpxrVsQPQgxweFkcwDQYJKoZIhvcNAQEL
|
3
|
+
BQAwgYQxCzAJBgNVBAYTAkNOMRIwEAYDVQQIDAlHdWFuZ0RvbmcxEjAQBgNVBAcM
|
4
|
+
CUd1YW5nemhvdTENMAsGA1UECgwESFVZQTEOMAwGA1UECwwFSFlFWFQxDTALBgNV
|
5
|
+
BAMMBEFsZXgxHzAdBgkqhkiG9w0BCQEWEDg1NzI3Njk1OEBxcS5jb20wHhcNMjQw
|
6
|
+
MzE0MDMwNjA2WhcNMzQwMzEyMDMwNjA2WjCBhDELMAkGA1UEBhMCQ04xEjAQBgNV
|
7
|
+
BAgMCUd1YW5nRG9uZzESMBAGA1UEBwwJR3Vhbmd6aG91MQ0wCwYDVQQKDARIVVlB
|
8
|
+
MQ4wDAYDVQQLDAVIWUVYVDENMAsGA1UEAwwEQWxleDEfMB0GCSqGSIb3DQEJARYQ
|
9
|
+
ODU3Mjc2OTU4QHFxLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
|
10
|
+
AKw2HdDc+7KreihQzErKxvMoGdW6jem9qvwEwGTpy2N9knj2mE4im7MK107zeklI
|
11
|
+
S6BpJrn9uzpWvDpk/beF+nEeKaEGEgxaGVM7YMVVmdlqvfFTc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