@hap-toolkit/server 1.9.7 → 1.9.9-beta.2
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/preview/static/web.js +2 -2
- package/lib/server.js +1 -1
- package/package.json +5 -5
|
@@ -7777,7 +7777,7 @@ var setTimeout = global.setTimeout
|
|
|
7777
7777
|
value: parseFloat(v) + units[0],
|
|
7778
7778
|
reason: function reason(k, v, result) {
|
|
7779
7779
|
return (
|
|
7780
|
-
'
|
|
7780
|
+
'WARN: 属性 `' + $hyphenate$1(k) + '` 没有指定单位,默认为 `' + units[0] + '`'
|
|
7781
7781
|
)
|
|
7782
7782
|
}
|
|
7783
7783
|
}
|
|
@@ -7951,7 +7951,7 @@ var setTimeout = global.setTimeout
|
|
|
7951
7951
|
return {
|
|
7952
7952
|
value: null,
|
|
7953
7953
|
reason: function reason(k, v, result) {
|
|
7954
|
-
return '
|
|
7954
|
+
return 'WARN: 属性`' + $hyphenate$1(k) + '` 的值 `' + v + '` 必须是 none 或者 url(...)'
|
|
7955
7955
|
}
|
|
7956
7956
|
}
|
|
7957
7957
|
},
|
package/lib/server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.launch=launch,exports.stop=stop;var _http=_interopRequireDefault(require("http")),_koa=_interopRequireDefault(require("koa")),_opn=_interopRequireDefault(require("opn")),_portfinder=_interopRequireDefault(require("portfinder")),_sharedUtils=require("@hap-toolkit/shared-utils"),_recordClient=require("@hap-toolkit/shared-utils/lib/record-client"),_config=_interopRequireDefault(require("@hap-toolkit/shared-utils/config"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let server=null;async function launch(e,r){return new Promise(async o=>{try{const s=new _koa.default;let t=_config.default.server.port;t=await _portfinder.default.getPortPromise({port:t}),Object.assign(e.defaults,{serverPort:t}),s.context.conf=e;const{clearRecords:l,openBrowser:n}=e.options;if(l){const{clientRecordPath:e}=_config.default;(0,_recordClient.clearProjectRecord)(e)}for(let e=0,o=r.moduleList.length;e<o;e++){const o=r.moduleList[e];"function"==typeof o.hash.applyRouter&&s.use(o.hash.applyRouter(s).routes())}server=_http.default.Server(s.callback()),s.server=server;for(let e=0,o=r.moduleList.length;e<o;e++){const o=r.moduleList[e];"function"==typeof o.hash.beforeStart&&await o.hash.beforeStart(server,s)}server.listen(t,()=>{const e="http://localhost:"+t,r=(0,_sharedUtils.getIPv4IPAddress)();if(!r)return _sharedUtils.colorconsole.warn("### App Server ### 本机IP地址为空,无法通过WIFI调试"),void o({launchServerError:null,server:server,address:e,previewAddress:e+"/previewAddress"});const s=`http://${r}:${t}`;_sharedUtils.colorconsole.info(`### App Server ### 服务器地址: ${e}, ${s}`),_sharedUtils.colorconsole.info("### App Server ### 请确保手机与App Server处于相同网段"),(0,_sharedUtils.outputQRCodeOnTerminal)(s),n&&(0,_opn.default)(s),o({launchServerError:null,server:server,address:s,previewAddress:e+"/preview"})}),s.on("error",(e,r)=>{_sharedUtils.colorconsole.error("### App Server ### 服务器错误: "+e.message);const s=`出错了!HTTP error code: ${e.status}, 出错信息: ${e.message}`;r&&(r.body=s),o({launchServerError:e,server:server})}),server.on("error",e=>{_sharedUtils.colorconsole.error("### App Server ### 服务器错误: "+e.message),"EADDRINUSE"===e.code&&_sharedUtils.colorconsole.error(`### App Server ### 服务器错误:端口 ${t} 被占用, 请检查`),o({launchServerError:e,server:server})}),process.on("SIGINT",()=>{_sharedUtils.colorconsole.info("### App Server ### SIGINT信号"),_sharedUtils.colorconsole.info("### App Server ### 退出server进程 pid: "+process.pid),process.exit()}),process.on("uncaughtException",e=>{_sharedUtils.colorconsole.error("### App Server ### 未定义的异常, 出错信息: "+e.message),console.error(e)}),process.on("unhandledRejection",(e,r)=>{_sharedUtils.colorconsole.error("### App Server ### 未处理的 rejection, 出错信息: "+e),r.catch(e=>{console.error(e)})})}catch(e){throw _sharedUtils.colorconsole.error("### App Server ### 服务器启动失败: "+e.message),o({launchServerError:e,server:null}),e}})}function stop(){return new Promise(e=>{if(server)try{server.close(r=>{e({stopServerError:r})})}catch(r){throw _sharedUtils.colorconsole.error("### App Server ### 服务器关闭失败: "+r.message),e({stopServerError:r}),r}else e({stopServerError:"no server"})})}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.launch=launch,exports.stop=stop;var _http=_interopRequireDefault(require("http")),_koa=_interopRequireDefault(require("koa")),_opn=_interopRequireDefault(require("opn")),_portfinder=_interopRequireDefault(require("portfinder")),_sharedUtils=require("@hap-toolkit/shared-utils"),_recordClient=require("@hap-toolkit/shared-utils/lib/record-client"),_config=_interopRequireDefault(require("@hap-toolkit/shared-utils/config"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let server=null;async function launch(e,r){return new Promise(async o=>{try{const s=new _koa.default;let t=_config.default.server.port;t=await _portfinder.default.getPortPromise({port:t}),Object.assign(e.defaults,{serverPort:t}),s.context.conf=e;const{clearRecords:l,openBrowser:n}=e.options;if(l){const{clientRecordPath:e}=_config.default;(0,_recordClient.clearProjectRecord)(e)}for(let e=0,o=r.moduleList.length;e<o;e++){const o=r.moduleList[e];"function"==typeof o.hash.applyRouter&&s.use(o.hash.applyRouter(s).routes())}server=_http.default.Server(s.callback()),s.server=server;for(let e=0,o=r.moduleList.length;e<o;e++){const o=r.moduleList[e];"function"==typeof o.hash.beforeStart&&await o.hash.beforeStart(server,s)}server.listen(t,()=>{const e="http://localhost:"+t,r=(0,_sharedUtils.getIPv4IPAddress)();if(!r)return _sharedUtils.colorconsole.warn("### App Server ### 本机IP地址为空,无法通过WIFI调试"),void o({launchServerError:null,server:server,address:e,previewAddress:e+"/previewAddress"});const s=`http://${r}:${t}`;_sharedUtils.colorconsole.info(`### App Server ### 服务器地址: ${e}, ${s}`),_sharedUtils.colorconsole.info("### App Server ### 请确保手机与App Server处于相同网段"),(0,_sharedUtils.outputQRCodeOnTerminal)(s),n&&(0,_opn.default)(s),o({launchServerError:null,server:server,address:s,previewAddress:e+"/preview"})}),s.on("error",(e,r)=>{_sharedUtils.colorconsole.error("### App Server ### 服务器错误: "+e.message);const s=`出错了!HTTP error code: ${e.status}, 出错信息: ${e.message}`;r&&(r.body=s),o({launchServerError:e,server:server})}),server.on("error",e=>{_sharedUtils.colorconsole.error("### App Server ### 服务器错误: "+e.message),"EADDRINUSE"===e.code&&_sharedUtils.colorconsole.error(`### App Server ### 服务器错误:端口 ${t} 被占用, 请检查`),o({launchServerError:e,server:server})}),process.on("SIGINT",()=>{_sharedUtils.colorconsole.info("### App Server ### SIGINT信号"),_sharedUtils.colorconsole.info("### App Server ### 退出server进程 pid: "+process.pid),s.context.adbDebugger._stop(),process.exit()}),process.on("uncaughtException",e=>{_sharedUtils.colorconsole.error("### App Server ### 未定义的异常, 出错信息: "+e.message),console.error(e)}),process.on("unhandledRejection",(e,r)=>{_sharedUtils.colorconsole.error("### App Server ### 未处理的 rejection, 出错信息: "+e),r.catch(e=>{console.error(e)})})}catch(e){throw _sharedUtils.colorconsole.error("### App Server ### 服务器启动失败: "+e.message),o({launchServerError:e,server:null}),e}})}function stop(){return new Promise(e=>{if(server)try{server.close(r=>{e({stopServerError:r})})}catch(r){throw _sharedUtils.colorconsole.error("### App Server ### 服务器关闭失败: "+r.message),e({stopServerError:r}),r}else e({stopServerError:"no server"})})}
|
|
2
2
|
//# sourceMappingURL=server.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hap-toolkit/server",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.9-beta.2",
|
|
4
4
|
"description": "hap server",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=8.0.0"
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@babel/runtime": "^7.9.6",
|
|
25
|
-
"@hap-toolkit/debugger": "1.9.
|
|
26
|
-
"@hap-toolkit/packager": "1.9.
|
|
27
|
-
"@hap-toolkit/shared-utils": "1.9.
|
|
25
|
+
"@hap-toolkit/debugger": "1.9.9-beta.2",
|
|
26
|
+
"@hap-toolkit/packager": "1.9.9-beta.2",
|
|
27
|
+
"@hap-toolkit/shared-utils": "1.9.9-beta.2",
|
|
28
28
|
"crypto-js": "^4.1.1",
|
|
29
29
|
"fs-extra": "^10.0.0",
|
|
30
30
|
"jszip": "^3.4.0",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"qrcode-terminal": "^0.12.0",
|
|
41
41
|
"request": "^2.88.2"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "43c006fb22531c57afaecf64700c80be649a3fea"
|
|
44
44
|
}
|