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

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.
@@ -116,9 +116,17 @@ module.exports = function genWebpackConf(launchOptions, mode) {
116
116
  // 签名文件目录
117
117
  const SIGN_FOLDER = globalConfig.signRoot
118
118
  // 编译文件的目录
119
- const BUILD_DIR = path.resolve(cwd, globalConfig.outputPath)
119
+ let BUILD_DIR
120
120
  // 最终发布目录:setPreviewPkgPathDir为ide传入的路径,用来保存构建的临时预览包
121
- const DIST_DIR = launchOptions.setPreviewPkgPath || path.resolve(cwd, globalConfig.releasePath)
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
+
122
130
  // 打包配置文件
123
131
  const manifestFile = path.resolve(SRC_DIR, 'manifest.json')
124
132
 
@@ -398,7 +406,7 @@ module.exports = function genWebpackConf(launchOptions, mode) {
398
406
  const { icon: appIcon, versionName, versionCode, subpackages, workers, banner = '' } = manifest
399
407
  let appPackageName = manifest.package
400
408
  if (globalConfig.aspectTemplate.isAspect) {
401
- appPackageName = manifest.name
409
+ appPackageName = path.basename(cwd)
402
410
  }
403
411
  for (let i = 0, len = moduleList.length; i < len; i++) {
404
412
  const fileConf = moduleList[i].path
@@ -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"),{copyBuildToNewBuild:copyBuildToNewBuild}=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,o=require("@babel/core/package.json").version,t=require("webpack/package.json").version;colorconsole.info(`aiot-toolkit: ${e}; babel: ${o}; webpack: ${t};`)}function aspectProjectCompiler(e,o,t,r={}){let a=getManifest();appName=a.package||"demo",entries=getAspectEntries(_config.default.aspectTemplate.projectPath,a),validateConfigJson(entries);let i,n=_config.default.aspectTemplate.outputPath,s=_config.default.aspectTemplate.distPath;cleanOrCreateDir(n),cleanOrCreateDir(s);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),i=singleCompiler(e,o,t,r),c.push(i)})),Promise.all(c)}function singleCompiler(e,o,t,r={}){const a=r.onerror;return new Promise(((i,n)=>{function s(e,o){if(e&&(a&&a(e),colorconsole.error(e)),o){if(o.hasErrors()||o.hasWarnings()){const e=summaryErrors(o),t=summaryWarnings(o);a&&a(e),colorconsole.error(e),colorconsole.warn(t)}o.hasErrors()&&(process.exitCode=1)}}colorconsole.attach(r.log),setCustomConfig(r.cwd),process.env.NODE_PLATFORM=e,process.env.NODE_PHASE=o;const c="prod"===o?"production":"development";try{const e=genWebpackConf(r,c);if(t){const o=webpack(e);watching=o.watch({aggregateTimeout:300},((e,o)=>{s(e,o),i({compileError:e,stats:o,watching:watching})}))}else webpack(e,((e,o)=>{s(e,o),i({compileError:e,stats:o})}))}catch(e){n(e)}}))}showVersion(),module.exports.compile=async function(e,o,t,r={}){var a;let i;return"distributed"===(null===(a=getProjectJson())||void 0===a?void 0:a.projectType)?(_config.default.aspectTemplate.isAspect=!0,i=await aspectProjectCompiler(e,o,t,r),await copyBuildToNewBuild(entries,appName)):i=await singleCompiler(e,o,t,r),i},module.exports.stopWatch=function(){return new Promise((e=>{watching?watching.close((()=>{watching=null,e({stopWatchError:null})})):e({stopWatchError:"no watching"})}))};
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"})}))};
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",withFileTypes:!0}).map((e=>e.name));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 null, 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,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}
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.copyBuildToNewBuild=copyBuildToNewBuild;var _fs=_interopRequireDefault(require("fs"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const path=require("path"),{colorconsole:colorconsole}=require("@aiot-toolkit/shared-utils"),{ENTRY_TYPE:ENTRY_TYPE,copyFiles:copyFiles,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 copyBuildToNewBuild(e,o){const t=globalConfig.aspectTemplate.projectPath,i=globalConfig.aspectTemplate.outputPath,r=globalConfig.aspectTemplate.distPath;e.forEach((e=>{let o=path.join(t,e,"build"),s=path.join(i,e);_fs.default.existsSync(s)||_fs.default.mkdirSync(s),copyFiles(o,s);let l=path.join(t,e,"dist");copyFiles(l,r)})),await packFolderToApp(r,o)}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 l="app";globalConfig.aspectTemplate.isAspect&&!globalConfig.aspectTemplate.isApp&&(l="aspect");const a=resolveFile(path.join(o,l));a||(colorconsole.error(`${l} file does not exist`),process.exit(1)),i[l]="./"+path.relative(t,a)+`?uxType=${ENTRY_TYPE.APP}`,s.forEach((({confs:e,type:r})=>{Object.keys(e).forEach((s=>{const l=e[s],a=path.join(s,l.component),c=resolveFile(path.join(o,a));c||colorconsole.throw(`Compilation failed: please confirm that the file path ${a} 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 n=path.relative(t,c);n="./"+n+`?uxType=${r}`,n=n.replace(/\\/g,"/"),i[a]=n}))}));const c=e.workers;c&&c.entries&&c.entries instanceof Array&&c.entries.filter((e=>e.file)).forEach((e=>{i[e.file.replace(/\.js$/,"")]="./src/"+e.file}));const n=e.services;if(!isEmptyObject(n))for(const e in n)Object.hasOwnProperty.call(n,e)&&(i["services/"+e]="./src/"+n[e].path+`?uxType=${ENTRY_TYPE.APP}`);return i};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.packApp=packApp;const path=require("path"),fs=require("fs"),{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};
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.1",
3
+ "version": "1.0.18-aspect-beta.3",
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.1",
10
- "@aiot-toolkit/debugger": "1.0.18-aspect-beta.1",
11
- "@aiot-toolkit/dsl-vue": "1.0.18-aspect-beta.1",
12
- "@aiot-toolkit/dsl-xvm": "1.0.18-aspect-beta.1",
13
- "@aiot-toolkit/packager": "1.0.18-aspect-beta.1",
14
- "@aiot-toolkit/server": "1.0.18-aspect-beta.1",
15
- "@aiot-toolkit/shared-utils": "1.0.18-aspect-beta.1",
9
+ "@aiot-toolkit/compiler": "^1.0.18-aspect-beta.3",
10
+ "@aiot-toolkit/debugger": "^1.0.18-aspect-beta.3",
11
+ "@aiot-toolkit/dsl-vue": "^1.0.18-aspect-beta.3",
12
+ "@aiot-toolkit/dsl-xvm": "^1.0.18-aspect-beta.3",
13
+ "@aiot-toolkit/packager": "^1.0.18-aspect-beta.3",
14
+ "@aiot-toolkit/server": "^1.0.18-aspect-beta.3",
15
+ "@aiot-toolkit/shared-utils": "^1.0.18-aspect-beta.3",
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": "14e2beab1e171bcd38efcb519ade86b0e6718b25"
55
+ "gitHead": "49bfaf78d075fbe94eaafb56d6106c192038008c"
56
56
  }