aiot-toolkit 1.0.18-aspect-beta.2 → 1.0.18-beta.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Change Log
2
2
 
3
+ #### [1.0.17] - 2022-04-26
4
+
5
+ - 支持 `scroll` 组件
6
+ - 支持 `maml` 组件(和`image`组件一致)
7
+ - 修复路径为变量时,未转换成绝对路径的问题
8
+ - `server` 命令新增 `--devtool` 配置参数
9
+ - 增加 `maskRepeat` 属性
10
+ - 增加 CSS 属性 `box-shadow`、`text-shadow` 和 `background-blend-mode`
11
+
3
12
  #### [1.0.16] - 2022-12-02
4
13
 
5
14
  - 支持打包应用服务 service 文件
package/README.md CHANGED
@@ -41,6 +41,15 @@ npm run release
41
41
 
42
42
  ### 版本日志(详情请在 node_modules 中查看 CHANGELOG)
43
43
 
44
+ #### [1.0.17] - 2022-04-26
45
+
46
+ - 支持 `scroll` 组件
47
+ - 支持 `maml` 组件(和`image`组件一致)
48
+ - 修复路径为变量时,未转换成绝对路径的问题
49
+ - `server` 命令新增 `--devtool` 配置参数
50
+ - 增加 `maskRepeat` 属性
51
+ - 增加 CSS 属性 `box-shadow`、`text-shadow` 和 `background-blend-mode`
52
+
44
53
  #### [1.0.16] - 2022-12-02
45
54
 
46
55
  - 支持打包应用服务 service 文件
package/bin/index.js CHANGED
@@ -118,6 +118,7 @@ program
118
118
  .description('open server for project')
119
119
  .option('--port <port>', 'specified port')
120
120
  .option('--watch', 'recompile project while file changes')
121
+ .option('--devtool <value>', 'source map config')
121
122
  .option('--clear-records', 'clear device records')
122
123
  .option('--disable-adb', 'disable adb debug')
123
124
  .option('--chrome-path <chrome-path>', 'support for a user specified chrome path')
@@ -45,16 +45,14 @@ exports.cleanup = function cleanup(BUILD_DIR, DIST_DIR) {
45
45
  * 使用 node 原生模块给予警告
46
46
  */
47
47
  exports.checkBuiltinModules = function checkBuiltinModules({ request }, callback) {
48
+ const packageJson = require(path.join(globalConfig.projectPath, 'package.json'))
48
49
  // 提取 package.json 中的依赖
49
50
  let projectDependencies = []
50
- if (!globalConfig.aspectTemplate.isAspect) {
51
- const packageJson = require(path.join(globalConfig.projectPath, 'package.json'))
52
- if (packageJson.devDependencies) {
53
- projectDependencies = Object.keys(packageJson.devDependencies)
54
- }
55
- if (packageJson.dependencies) {
56
- projectDependencies = projectDependencies.concat(Object.keys(packageJson.dependencies))
57
- }
51
+ if (packageJson.devDependencies) {
52
+ projectDependencies = Object.keys(packageJson.devDependencies)
53
+ }
54
+ if (packageJson.dependencies) {
55
+ projectDependencies = projectDependencies.concat(Object.keys(packageJson.dependencies))
58
56
  }
59
57
 
60
58
  // 枚举 node 原生模块
@@ -109,12 +107,7 @@ exports.checkBuiltinModules = function checkBuiltinModules({ request }, callback
109
107
  * @param {boolean} disableScriptV8V65
110
108
  */
111
109
  exports.setAdaptForV8Version = function setAdaptForV8Version(disableScriptV8V65, manifest, cwd) {
112
- let packageJsonFile
113
- if (globalConfig.aspectTemplate.isAspect) {
114
- packageJsonFile = path.resolve(globalConfig.aspectTemplate.projectPath, 'package.json')
115
- } else {
116
- packageJsonFile = path.resolve(cwd, 'package.json')
117
- }
110
+ const packageJsonFile = path.resolve(cwd, 'package.json')
118
111
  const packageJson = readJson(packageJsonFile)
119
112
  const minPlatformVersion = parseInt(manifest.minPlatformVersion)
120
113
  if (fs.existsSync(packageJsonFile)) {
@@ -100,7 +100,7 @@ module.exports = function genWebpackConf(launchOptions, mode) {
100
100
  // 是否需要设置全局的打包模式为mina-h5
101
101
  const manifestFileTemp = path.resolve(cwd, 'manifest.json')
102
102
  let isMinaH5 = false
103
- if (fs.existsSync(manifestFileTemp) && !globalConfig.aspectTemplate.isAspect) {
103
+ if (fs.existsSync(manifestFileTemp)) {
104
104
  const manifestTemp = readJson(manifestFileTemp)
105
105
  const { deviceTypeList } = manifestTemp
106
106
  const minaH5Type = ['tv', 'tv-h5']
@@ -116,17 +116,9 @@ module.exports = function genWebpackConf(launchOptions, mode) {
116
116
  // 签名文件目录
117
117
  const SIGN_FOLDER = globalConfig.signRoot
118
118
  // 编译文件的目录
119
- let BUILD_DIR
119
+ const BUILD_DIR = path.resolve(cwd, globalConfig.outputPath)
120
120
  // 最终发布目录:setPreviewPkgPathDir为ide传入的路径,用来保存构建的临时预览包
121
- let DIST_DIR
122
- if (globalConfig.aspectTemplate.isAspect) {
123
- BUILD_DIR = path.resolve(globalConfig.aspectTemplate.outputPath, path.basename(cwd))
124
- DIST_DIR = path.resolve(globalConfig.aspectTemplate.outputPath, '')
125
- } else {
126
- BUILD_DIR = path.resolve(cwd, globalConfig.outputPath)
127
- DIST_DIR = launchOptions.setPreviewPkgPath || path.resolve(cwd, globalConfig.releasePath)
128
- }
129
-
121
+ const DIST_DIR = launchOptions.setPreviewPkgPath || path.resolve(cwd, globalConfig.releasePath)
130
122
  // 打包配置文件
131
123
  const manifestFile = path.resolve(SRC_DIR, 'manifest.json')
132
124
 
@@ -141,32 +133,18 @@ module.exports = function genWebpackConf(launchOptions, mode) {
141
133
  // 清理 BUILD_DIR DIST_DIR
142
134
  cleanup(BUILD_DIR, DIST_DIR)
143
135
 
144
- // 将aspect文件夹的config.json文件复制到build文件夹
145
- if (globalConfig.aspectTemplate.isAspect && !globalConfig.aspectTemplate.isApp) {
146
- const configJSON = path.join(cwd, 'config.json')
147
- if (fs.existsSync(configJSON)) {
148
- const sourceStream = fs.createReadStream(configJSON)
149
- const targetStream = fs.createWriteStream(path.join(BUILD_DIR, path.basename(configJSON)))
150
-
151
- sourceStream.pipe(targetStream)
152
- } else {
153
- colorconsole.log(`The path of project ,${configJSON} not exist`)
154
- }
155
- }
156
-
157
136
  let manifest
158
137
  try {
159
138
  manifest = readJson(manifestFile)
160
139
  } catch (e) {
161
140
  throw new KnownError('manifest.json parsing failed!')
162
141
  }
163
- if (!globalConfig.aspectTemplate.isApp) {
164
- validateManifest(SRC_DIR, manifest, compileOptionsObject)
165
142
 
166
- valiedateSitemap(SRC_DIR, manifest)
143
+ validateManifest(SRC_DIR, manifest, compileOptionsObject)
167
144
 
168
- valiedateSkeleton(SRC_DIR, manifest)
169
- }
145
+ valiedateSitemap(SRC_DIR, manifest)
146
+
147
+ valiedateSkeleton(SRC_DIR, manifest)
170
148
 
171
149
  // 是否需要设置全局的打包模式为Mirtos
172
150
  const { deviceTypeList } = manifest
@@ -403,11 +381,15 @@ module.exports = function genWebpackConf(launchOptions, mode) {
403
381
  path: pathMap[dslName]
404
382
  })
405
383
 
406
- const { icon: appIcon, versionName, versionCode, subpackages, workers, banner = '' } = manifest
407
- let appPackageName = manifest.package
408
- if (globalConfig.aspectTemplate.isAspect) {
409
- appPackageName = path.basename(cwd)
410
- }
384
+ const {
385
+ package: appPackageName,
386
+ icon: appIcon,
387
+ versionName,
388
+ versionCode,
389
+ subpackages,
390
+ workers,
391
+ banner = ''
392
+ } = manifest
411
393
  for (let i = 0, len = moduleList.length; i < len; i++) {
412
394
  const fileConf = moduleList[i].path
413
395
  if (fs.existsSync(fileConf)) {
@@ -3,10 +3,9 @@ const path = require('path')
3
3
  const Ajv = require('ajv')
4
4
  const AjvErrors = require('ajv-errors')
5
5
  const manifestSchema = require('./manifest-schema')
6
- const { colorconsole, KnownError, readJson } = require('@aiot-toolkit/shared-utils')
6
+ const { colorconsole, KnownError } = require('@aiot-toolkit/shared-utils')
7
7
  const { compileOptionsMeta } = require('@aiot-toolkit/shared-utils/compilation-config')
8
8
  const { getSkeletonConfig } = require('@aiot-toolkit/packager/lib/common/info')
9
- const globalConfig = require('@aiot-toolkit/shared-utils/config')
10
9
 
11
10
  // 主包保留名
12
11
  const MAIN_PKG_NAME = compileOptionsMeta.MAIN_PKG_NAME
@@ -283,31 +282,3 @@ exports.valiedateSkeleton = function valiedateSkeleton(src, manifest) {
283
282
  })
284
283
  }
285
284
  }
286
- /**
287
- * 校验aspect项目config.json
288
- * @param {string} dirs 文件夹列表
289
- */
290
- exports.validateConfigJson = function(dirs) {
291
- dirs.forEach(async dir => {
292
- const configPath = path.join(globalConfig.aspectTemplate.projectPath, dir, 'config.json')
293
- if (dir !== 'app') {
294
- const isExistConfig = fs.existsSync(configPath)
295
- if (isExistConfig) {
296
- const configJson = await readJson(configPath)
297
- if (!configJson.name) {
298
- colorconsole.error(`Configure file ${configPath} error: name is not exist, please check`)
299
- }
300
- if (!configJson.type) {
301
- colorconsole.error(`Configure file ${configPath} error: type is not exist, please check`)
302
- }
303
- if (!configJson.virtualMachine) {
304
- colorconsole.error(
305
- `Configure file ${configPath} error: virtualMachine is not exist, please check`
306
- )
307
- }
308
- } else {
309
- colorconsole.error(`Configure file error: ${configPath} is not exist, please check`)
310
- }
311
- }
312
- })
313
- }
@@ -1,2 +1,2 @@
1
- "use strict";var _config=_interopRequireDefault(require("@aiot-toolkit/shared-utils/config"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const webpack=require("webpack"),{setCustomConfig:setCustomConfig,colorconsole:colorconsole,getProjectJson:getProjectJson,getManifest:getManifest}=require("@aiot-toolkit/shared-utils"),genWebpackConf=require("../../gen-webpack-conf"),{summaryErrors:summaryErrors,summaryWarnings:summaryWarnings,getAspectEntries:getAspectEntries,cleanOrCreateDir:cleanOrCreateDir}=require("./utils"),{packApp:packApp}=require("../utils"),{validateConfigJson:validateConfigJson}=require("../../gen-webpack-conf/validate"),path=require("path");let appName,watching=null,entries=[];function showVersion(){const e=require("../../package.json").version,t=require("@babel/core/package.json").version,o=require("webpack/package.json").version;colorconsole.info(`aiot-toolkit: ${e}; babel: ${t}; webpack: ${o};`)}function aspectProjectCompiler(e,t,o,r={}){let a=getManifest();appName=a.package||"demo",entries=getAspectEntries(_config.default.aspectTemplate.projectPath,a),validateConfigJson(entries);let n,s=_config.default.aspectTemplate.outputPath,i=_config.default.aspectTemplate.distPath;cleanOrCreateDir(s),cleanOrCreateDir(i);const c=[];return entries.forEach((a=>{_config.default.sourceRoot="./src",_config.default.aspectTemplate.isApp="app"===a,_config.default.aspectTemplate.isApp&&(_config.default.sourceRoot=""),r.cwd=path.join(_config.default.aspectTemplate.projectPath,a),n=singleCompiler(e,t,o,r),c.push(n)})),Promise.all(c)}function singleCompiler(e,t,o,r={}){const a=r.onerror;return new Promise(((n,s)=>{function i(e,t){if(e&&(a&&a(e),colorconsole.error(e)),t){if(t.hasErrors()||t.hasWarnings()){const e=summaryErrors(t),o=summaryWarnings(t);a&&a(e),colorconsole.error(e),colorconsole.warn(o)}t.hasErrors()&&(process.exitCode=1)}}colorconsole.attach(r.log),setCustomConfig(r.cwd),process.env.NODE_PLATFORM=e,process.env.NODE_PHASE=t;const c="prod"===t?"production":"development";try{const e=genWebpackConf(r,c);if(o){const t=webpack(e);watching=t.watch({aggregateTimeout:300},((e,t)=>{i(e,t),n({compileError:e,stats:t,watching:watching})}))}else webpack(e,((e,t)=>{i(e,t),n({compileError:e,stats:t})}))}catch(e){s(e)}}))}showVersion(),module.exports.compile=async function(e,t,o,r={}){var a;let n;return"distributed"===(null===(a=getProjectJson())||void 0===a?void 0:a.projectType)?(_config.default.aspectTemplate.isAspect=!0,n=await aspectProjectCompiler(e,t,o,r),await packApp(appName)):n=await singleCompiler(e,t,o,r),n},module.exports.stopWatch=function(){return new Promise((e=>{watching?watching.close((()=>{watching=null,e({stopWatchError:null})})):e({stopWatchError:"no watching"})}))};
1
+ "use strict";const webpack=require("webpack"),{setCustomConfig:setCustomConfig,colorconsole:colorconsole}=require("@aiot-toolkit/shared-utils"),genWebpackConf=require("../../gen-webpack-conf"),{summaryErrors:summaryErrors,summaryWarnings:summaryWarnings}=require("./utils");let watching=null;function showVersion(){const o=require("../../package.json").version,r=require("@babel/core/package.json").version,e=require("webpack/package.json").version;colorconsole.info(`aiot-toolkit: ${o}; babel: ${r}; webpack: ${e};`)}showVersion(),module.exports.compile=function(o,r,e,s={}){const n=s.onerror;return new Promise(((c,t)=>{function a(o,r){if(o&&(n&&n(o),colorconsole.error(o)),r){if(r.hasErrors()||r.hasWarnings()){const o=summaryErrors(r),e=summaryWarnings(r);n&&n(o),colorconsole.error(o),colorconsole.warn(e)}r.hasErrors()&&(process.exitCode=1)}}colorconsole.attach(s.log),setCustomConfig(s.cwd),process.env.NODE_PLATFORM=o,process.env.NODE_PHASE=r;const i="prod"===r?"production":"development";try{const o=genWebpackConf(s,i);if(e){const r=webpack(o);watching=r.watch({aggregateTimeout:300},((o,r)=>{a(o,r),c({compileError:o,stats:r,watching:watching})}))}else webpack(o,((o,r)=>{a(o,r),c({compileError:o,stats:r})}))}catch(o){t(o)}}))},module.exports.stopWatch=function(){return new Promise((o=>{watching?watching.close((()=>{watching=null,o({stopWatchError:null})})):o({stopWatchError:"no watching"})}))};
2
2
  //# sourceMappingURL=compile.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatDate=formatDate,exports.summaryErrors=summaryErrors,exports.summaryWarnings=summaryWarnings,exports.getQuickappDebuggerUrl=getQuickappDebuggerUrl,exports.getQuickappPreviewUrl=getQuickappPreviewUrl,exports.downloadFile=downloadFile,exports.sendReq=sendReq,exports.getClients=getClients,exports.checkQuickappDir=checkQuickappDir,exports.getCardContent=getCardContent,exports.cleanOrCreateDir=cleanOrCreateDir,exports.getAspectEntries=getAspectEntries;var _fsExtra=_interopRequireDefault(require("fs-extra")),_path=_interopRequireDefault(require("path")),_request=_interopRequireDefault(require("request")),_http=_interopRequireDefault(require("http")),_recordClient=require("@aiot-toolkit/shared-utils/lib/record-client"),_config=require("@aiot-toolkit/shared-utils/config"),_sharedUtils=require("@aiot-toolkit/shared-utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const fsExtra=require("fs-extra");function formatDate(e,t){let r,o,s,n,a,i,l=e;return(e.indexOf("yyyy")>=0||e.indexOf("YYYYY")>=0)&&(r=t.getFullYear(),l=l.replace(/[yY]{4}/g,r)),e.indexOf("MM")>=0&&(o=t.getMonth()+1,l=l.replace(/MM/g,String(o).length<2?"0"+o:o)),e.indexOf("dd")>=0&&(s=t.getDate(),l=l.replace(/dd/g,String(s).length<2?"0"+s:s)),(e.indexOf("hh")>=0||e.indexOf("HH")>=0)&&(n=t.getHours(),l=l.replace(/[hH]{2}/g,String(n).length<2?"0"+n:n)),e.indexOf("mm")>=0&&(a=t.getMinutes(),l=l.replace(/mm/g,String(a).length<2?"0"+a:a)),(e.indexOf("ss")>=0||e.indexOf("SS")>=0)&&(i=t.getSeconds(),l=l.replace(/[sS]{2}/g,String(i).length<2?"0"+i:i)),l}function summaryErrors(e){const t=[];return e.compilation.errors.forEach((e=>{const r=e.message,o=/Can't resolve '(sass-loader|less-loader|stylus-loader)'/.exec(r);if("ModuleNotFoundError"===e.name&&o){let t=o[1];"less-loader"===t?t=`less ${t}`:"sass-loader"===t?t=`node-sass ${t}`:"stylus-loader"===t&&(t=`stylus ${t}`),e.message=` Missing dependency: ${t}, Please execute npm install -D ${t} to install the corresponding dependencies `}const s=e.module?e.module.resource:"";t.push(`${s}\r\n${e.message}`)})),t.join("\n\n")}function summaryWarnings(e){return e.compilation.warnings.map((e=>e.message)).join("\n\n")}const quickapp_url="https://statres.quickapp.cn/quickapp/quickapptool/release/platform/";function getQuickappDebuggerUrl(e){let t=e||"v1080";return _sharedUtils.colorconsole.log(`The version of the Quickapp debugger that started to download is: ${t}`),`${quickapp_url}quickapp_debugger_${t}.apk`}function getQuickappPreviewUrl(e){let t=e||"v1080";return _sharedUtils.colorconsole.log(`The version of the Quickapp debugger that started to download is: ${t}`),`${quickapp_url}quickapp_platform_preview_release_${t}.apk`}function downloadFile(e,t){return _sharedUtils.colorconsole.log(`Start downloading file:${t}, address:${e}`),new Promise((function(r,o){(0,_request.default)(e,(function(s,n,a){if(s||200!==n.statusCode)o(s||new Error(`Download failed, status code:${n.statusCode}`));else{const s=_path.default.join(__dirname,"./apk");_fsExtra.default.ensureDirSync(s);let n=_fsExtra.default.createWriteStream(_path.default.join(s,t));(0,_request.default)(e).pipe(n).on("close",(e=>{e?o(e):r(`Download file ${t} successfully`)}))}}))}))}async function sendReq(e,t,r){return new Promise((o=>{const s=`http://${e.ip}:${e.port}${t}`;let n={host:e.ip,port:e.port,path:t,timeout:3e3};r&&(n=Object.assign({},n,{headers:r}));const a=_http.default.request(n,(e=>{e.on("data",(e=>{_sharedUtils.colorconsole.log(`### App Server ### Request ${s} succeeded`),o(e.toString())}))})).on("error",(e=>{_sharedUtils.colorconsole.error(`### App Server ### Request ${s} error message: ${e.message}`)})).on("timeout",(function(){_sharedUtils.colorconsole.log(`### App Server ### Request ${s} timed out, please try again`),a.abort()}));a.end()}))}async function getClients(){return new Promise((e=>{if(_fsExtra.default.existsSync(_config.clientRecordPath)){const t=(0,_recordClient.getRecords)(_config.clientRecordPath),r=(0,_recordClient.getProjectClients)(t);r.length>0&&e(r)}e(null)}))}function checkQuickappDir(e,t="src"){const r=_path.default.join(e,t,"manifest.json");_fsExtra.default.existsSync(r)||(_sharedUtils.colorconsole.error("Please execute this command under the Quickapp project"),process.exit())}function getCardContent(e){const t=_path.default.join(e,"src","manifest.json"),r=(0,_sharedUtils.readJson)(t).router.widgets||null;return r||_sharedUtils.colorconsole.error("No card configuration in manifest.json"),r}function cleanOrCreateDir(e){try{_fsExtra.default.accessSync(e,_fsExtra.default.constants.F_OK),fsExtra.emptyDirSync(e)}catch(t){_fsExtra.default.mkdirSync(e,{recursive:!0})}}function getAspectEntries(e,t){let r=["app"],o=_fsExtra.default.readdirSync(e,{encoding:"utf8"});const s=_path.default.join(e,"app","manifest.json");t.router||_sharedUtils.colorconsole.error(`Configuration file ${s} error: router is not exsist, please check`);const n=t.router.aspects||null;if(n){Object.keys(n).forEach((e=>{n[e].forEach((e=>{o.includes(e.path)?r.push(e.path):_sharedUtils.colorconsole.throw(`Configuration file ${s} error: ${e.path} is not exist in root directory`)}))}))}else _sharedUtils.colorconsole.error(`Configuration file ${s} error: router.aspect is not exist, please check`);return r}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatDate=formatDate,exports.summaryErrors=summaryErrors,exports.summaryWarnings=summaryWarnings,exports.getQuickappDebuggerUrl=getQuickappDebuggerUrl,exports.getQuickappPreviewUrl=getQuickappPreviewUrl,exports.downloadFile=downloadFile,exports.sendReq=sendReq,exports.getClients=getClients,exports.checkQuickappDir=checkQuickappDir,exports.getCardContent=getCardContent;var _fsExtra=_interopRequireDefault(require("fs-extra")),_path=_interopRequireDefault(require("path")),_request=_interopRequireDefault(require("request")),_http=_interopRequireDefault(require("http")),_recordClient=require("@aiot-toolkit/shared-utils/lib/record-client"),_config=require("@aiot-toolkit/shared-utils/config"),_sharedUtils=require("@aiot-toolkit/shared-utils");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function formatDate(e,t){let r,o,s,n,i,a,l=e;return(e.indexOf("yyyy")>=0||e.indexOf("YYYYY")>=0)&&(r=t.getFullYear(),l=l.replace(/[yY]{4}/g,r)),e.indexOf("MM")>=0&&(o=t.getMonth()+1,l=l.replace(/MM/g,String(o).length<2?"0"+o:o)),e.indexOf("dd")>=0&&(s=t.getDate(),l=l.replace(/dd/g,String(s).length<2?"0"+s:s)),(e.indexOf("hh")>=0||e.indexOf("HH")>=0)&&(n=t.getHours(),l=l.replace(/[hH]{2}/g,String(n).length<2?"0"+n:n)),e.indexOf("mm")>=0&&(i=t.getMinutes(),l=l.replace(/mm/g,String(i).length<2?"0"+i:i)),(e.indexOf("ss")>=0||e.indexOf("SS")>=0)&&(a=t.getSeconds(),l=l.replace(/[sS]{2}/g,String(a).length<2?"0"+a:a)),l}function summaryErrors(e){const t=[];return e.compilation.errors.forEach((e=>{const r=e.message,o=/Can't resolve '(sass-loader|less-loader|stylus-loader)'/.exec(r);if("ModuleNotFoundError"===e.name&&o){let t=o[1];"less-loader"===t?t=`less ${t}`:"sass-loader"===t?t=`node-sass ${t}`:"stylus-loader"===t&&(t=`stylus ${t}`),e.message=` Missing dependency: ${t}, Please execute npm install -D ${t} to install the corresponding dependencies `}const s=e.module?e.module.resource:"";t.push(`${s}\r\n${e.message}`)})),t.join("\n\n")}function summaryWarnings(e){return e.compilation.warnings.map((e=>e.message)).join("\n\n")}const quickapp_url="https://statres.quickapp.cn/quickapp/quickapptool/release/platform/";function getQuickappDebuggerUrl(e){let t=e||"v1080";return _sharedUtils.colorconsole.log(`The version of the Quickapp debugger that started to download is: ${t}`),`${quickapp_url}quickapp_debugger_${t}.apk`}function getQuickappPreviewUrl(e){let t=e||"v1080";return _sharedUtils.colorconsole.log(`The version of the Quickapp debugger that started to download is: ${t}`),`${quickapp_url}quickapp_platform_preview_release_${t}.apk`}function downloadFile(e,t){return _sharedUtils.colorconsole.log(`Start downloading file:${t}, address:${e}`),new Promise((function(r,o){(0,_request.default)(e,(function(s,n,i){if(s||200!==n.statusCode)o(s||new Error(`Download failed, status code:${n.statusCode}`));else{const s=_path.default.join(__dirname,"./apk");_fsExtra.default.ensureDirSync(s);let n=_fsExtra.default.createWriteStream(_path.default.join(s,t));(0,_request.default)(e).pipe(n).on("close",(e=>{e?o(e):r(`Download file ${t} successfully`)}))}}))}))}async function sendReq(e,t,r){return new Promise((o=>{const s=`http://${e.ip}:${e.port}${t}`;let n={host:e.ip,port:e.port,path:t,timeout:3e3};r&&(n=Object.assign({},n,{headers:r}));const i=_http.default.request(n,(e=>{e.on("data",(e=>{_sharedUtils.colorconsole.log(`### App Server ### Request ${s} succeeded`),o(e.toString())}))})).on("error",(e=>{_sharedUtils.colorconsole.error(`### App Server ### Request ${s} error message: ${e.message}`)})).on("timeout",(function(){_sharedUtils.colorconsole.log(`### App Server ### Request ${s} timed out, please try again`),i.abort()}));i.end()}))}async function getClients(){return new Promise((e=>{if(_fsExtra.default.existsSync(_config.clientRecordPath)){const t=(0,_recordClient.getRecords)(_config.clientRecordPath),r=(0,_recordClient.getProjectClients)(t);r.length>0&&e(r)}e(null)}))}function checkQuickappDir(e,t="src"){const r=_path.default.join(e,t,"manifest.json");_fsExtra.default.existsSync(r)||(_sharedUtils.colorconsole.error("Please execute this command under the Quickapp project"),process.exit())}function getCardContent(e){const t=_path.default.join(e,"src","manifest.json"),r=(0,_sharedUtils.readJson)(t).router.widgets||null;return r||_sharedUtils.colorconsole.error("No card configuration in manifest.json"),r}
2
2
  //# sourceMappingURL=utils.js.map
package/lib/utils.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.packApp=packApp;const path=require("path"),{colorconsole:colorconsole}=require("@aiot-toolkit/shared-utils"),{ENTRY_TYPE:ENTRY_TYPE,packFolderToApp:packFolderToApp}=require("@aiot-toolkit/packager/lib/common/utils"),{resolveFile:resolveFile}=require("@aiot-toolkit/packager/lib/common/info"),{isEmptyObject:isEmptyObject}=require("@aiot-toolkit/compiler/lib/utils"),globalConfig=require("@aiot-toolkit/shared-utils/config");async function packApp(e){const o=globalConfig.aspectTemplate.outputPath,t=globalConfig.aspectTemplate.distPath;await packFolderToApp(o,t,e)}exports.resolveEntries=function(e,o,t){if(!e.router)throw Error("No routing configured in manifest.json!");const i={},r=e.router.pages||{},s=[{confs:e.router.widgets||{},type:ENTRY_TYPE.CARD}];s.unshift({confs:r,type:ENTRY_TYPE.PAGE});let a="app";globalConfig.aspectTemplate.isAspect&&!globalConfig.aspectTemplate.isApp&&(a="aspect");const l=resolveFile(path.join(o,a));l||(colorconsole.error(`${a} file does not exist`),process.exit(1)),i[a]="./"+path.relative(t,l)+`?uxType=${ENTRY_TYPE.APP}`,s.forEach((({confs:e,type:r})=>{Object.keys(e).forEach((s=>{const a=e[s],l=path.join(s,a.component);let p;p=globalConfig.aspectTemplate.isAspect?resolveFile(path.join(o,"pages",l)):resolveFile(path.join(o,l)),p||colorconsole.throw(`Compilation failed: please confirm that the file path ${l} configured in manifest.json exists`),/^\//.test(s)&&colorconsole.throw(`Compilation failed: please confirm that '${s}' configured by router.pages in manifest.json is the directory name`);let c=path.relative(t,p);c="./"+c+`?uxType=${r}`,c=c.replace(/\\/g,"/"),i[l]=c}))}));const p=e.workers;p&&p.entries&&p.entries instanceof Array&&p.entries.filter((e=>e.file)).forEach((e=>{i[e.file.replace(/\.js$/,"")]="./src/"+e.file}));const c=e.services;if(!isEmptyObject(c))for(const e in c)Object.hasOwnProperty.call(c,e)&&(i["services/"+e]="./src/"+c[e].path+`?uxType=${ENTRY_TYPE.APP}`);return i};
1
+ "use strict";const path=require("path"),{colorconsole:colorconsole}=require("@aiot-toolkit/shared-utils"),{ENTRY_TYPE:ENTRY_TYPE}=require("@aiot-toolkit/packager/lib/common/utils"),{resolveFile:resolveFile}=require("@aiot-toolkit/packager/lib/common/info"),{isEmptyObject:isEmptyObject}=require("@aiot-toolkit/compiler/lib/utils");exports.resolveEntries=function(e,o,t){if(!e.router)throw Error("No routing configured in manifest.json!");const r={},i=e.router.pages||{},s=e.router.widgets||{},n=[{confs:e.router.floatingWindows||{},type:ENTRY_TYPE.FLOAT},{confs:s,type:ENTRY_TYPE.CARD}];n.unshift({confs:i,type:ENTRY_TYPE.PAGE});const c=resolveFile(path.join(o,"app"));c||(colorconsole.error("app file does not exist"),process.exit(1)),r.app="./"+path.relative(t,c)+`?uxType=${ENTRY_TYPE.APP}`,n.forEach((({confs:e,type:i})=>{Object.keys(e).forEach((s=>{const n=e[s],c=path.join(s,n.component),l=resolveFile(path.join(o,c));l||colorconsole.throw(`Compilation failed: please confirm that the file path ${c} configured in manifest.json exists`),/^\//.test(s)&&colorconsole.throw(`Compilation failed: please confirm that '${s}' configured by router.pages in manifest.json is the directory name`);let a=path.relative(t,l);a="./"+a+`?uxType=${i}`,a=a.replace(/\\/g,"/"),r[c]=a}))}));const l=e.workers;l&&l.entries&&l.entries instanceof Array&&l.entries.filter((e=>e.file)).forEach((e=>{r[e.file.replace(/\.js$/,"")]="./src/"+e.file}));const a=e.services;if(!isEmptyObject(a))for(const e in a)Object.hasOwnProperty.call(a,e)&&(r["services/"+e]="./src/"+a[e].path+`?uxType=${ENTRY_TYPE.APP}`);return r};
2
2
  //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "aiot-toolkit",
3
- "version": "1.0.18-aspect-beta.2",
3
+ "version": "1.0.18-beta.1",
4
4
  "description": "A command line toolkit for developing Aiot Quick Apps.",
5
5
  "engines": {
6
6
  "node": ">=8.0.0"
7
7
  },
8
8
  "dependencies": {
9
- "@aiot-toolkit/compiler": "1.0.18-aspect-beta.2",
10
- "@aiot-toolkit/debugger": "1.0.18-aspect-beta.2",
11
- "@aiot-toolkit/dsl-vue": "1.0.18-aspect-beta.2",
12
- "@aiot-toolkit/dsl-xvm": "1.0.18-aspect-beta.2",
13
- "@aiot-toolkit/packager": "1.0.18-aspect-beta.2",
14
- "@aiot-toolkit/server": "1.0.18-aspect-beta.2",
15
- "@aiot-toolkit/shared-utils": "1.0.18-aspect-beta.2",
9
+ "@aiot-toolkit/compiler": "1.0.18-beta.1",
10
+ "@aiot-toolkit/debugger": "1.0.18-beta.1",
11
+ "@aiot-toolkit/dsl-vue": "1.0.18-beta.1",
12
+ "@aiot-toolkit/dsl-xvm": "1.0.18-beta.1",
13
+ "@aiot-toolkit/packager": "1.0.18-beta.1",
14
+ "@aiot-toolkit/server": "1.0.18-beta.1",
15
+ "@aiot-toolkit/shared-utils": "1.0.18-beta.1",
16
16
  "@babel/core": "^7.9.6",
17
17
  "@babel/plugin-syntax-jsx": "^7.8.3",
18
18
  "@babel/preset-env": "^7.9.6",
@@ -52,5 +52,5 @@
52
52
  "supertest": "^3.3.0",
53
53
  "webpack-cli": "^4.3.0"
54
54
  },
55
- "gitHead": "52a5606db026936f3105aa3396809d4bfa3e5deb"
55
+ "gitHead": "7e0153400365f7688cdb898f8ec560fb4ff11ed3"
56
56
  }