aiot-toolkit 2.0.3-beta.1 → 2.0.3-beta.11

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.
@@ -1,120 +1,139 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __rest = (this && this.__rest) || function (s, e) {
12
- var t = {};
13
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
- t[p] = s[p];
15
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
- t[p[i]] = s[p[i]];
19
- }
20
- return t;
21
- };
22
- var __importDefault = (this && this.__importDefault) || function (mod) {
23
- return (mod && mod.__esModule) ? mod : { "default": mod };
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- const aiotpack_1 = require("@aiot-toolkit/aiotpack");
27
- const shared_utils_1 = require("@aiot-toolkit/shared-utils");
28
- const path_1 = __importDefault(require("path"));
29
- const fs_extra_1 = __importDefault(require("fs-extra"));
30
- const lodash_1 = __importDefault(require("lodash"));
31
- const file_lane_1 = __importDefault(require("file-lane"));
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "IFileLaneEvents", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _IFileLaneEvents.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "IFileLaneSuccessData", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _IFileLaneEvents.IFileLaneSuccessData;
16
+ }
17
+ });
18
+ exports.default = void 0;
19
+ var _aiotpack = require("@aiot-toolkit/aiotpack");
20
+ var _sharedUtils = require("@aiot-toolkit/shared-utils");
21
+ var _path = _interopRequireDefault(require("path"));
22
+ var _fsExtra = _interopRequireDefault(require("fs-extra"));
23
+ var _lodash = _interopRequireDefault(require("lodash"));
24
+ var _fileLane = _interopRequireDefault(require("file-lane"));
25
+ var _IFileLaneEvents = _interopRequireWildcard(require("file-lane/lib/interface/IFileLaneEvents"));
26
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
27
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
28
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
32
29
  /**
33
30
  * UxBuilderBase
34
31
  */
35
32
  class UxBuilderBase {
36
- constructor(events = {
37
- onBuildSuccess: (data) => shared_utils_1.ColorConsole.info(`build time: ${data.costTime}ms`)
38
- }) {
39
- this.events = events;
40
- /**
41
- * 配置文件
42
- */
43
- this.QUICKAPP_CONFIG = 'quickapp.config.js';
44
- }
45
- /**
46
- * ux项目的build函数
47
- * @param projectPath 项目路径
48
- * @param options 命令参数
49
- * @param watch 是否开启监听
50
- */
51
- build(projectPath, options) {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- if (this.fileLane) {
54
- // 已经在运行中,请先停止
55
- throw new Error('already running, please stop first: builder.stop()');
56
- }
57
- const watch = options.watch || false;
58
- // 项目配置
59
- const uxProjectConfig = new aiotpack_1.UxConfig(projectPath);
60
- // 编译配置
61
- const compilerOption = this.getCompilerOption(projectPath, options);
62
- shared_utils_1.ColorConsole.info('start build: ', {
63
- style: shared_utils_1.ColorConsole.getStyle(shared_utils_1.Loglevel.INFO),
64
- word: JSON.stringify({
65
- projectPath,
66
- options,
67
- watch,
68
- node: process.version,
69
- platform: process.platform,
70
- arch: process.arch,
71
- toolkit: require('../../package.json').version
72
- }, null, 2)
73
- });
74
- // 开始编译项目
75
- this.fileLane = new file_lane_1.default(uxProjectConfig, projectPath, compilerOption, this.events);
76
- yield this.fileLane.start({ watch });
77
- });
33
+ /**
34
+ * 配置文件
35
+ */
36
+ QUICKAPP_CONFIG = 'quickapp.config.js';
37
+ constructor() {
38
+ let events = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
39
+ this.events = events;
40
+ }
41
+
42
+ /**
43
+ * ux项目的build函数
44
+ * @param projectPath 项目路径
45
+ * @param options 命令参数
46
+ * @param watch 是否开启监听
47
+ */
48
+ async build(projectPath, options) {
49
+ if (this.fileLane) {
50
+ // 已经在运行中,请先停止
51
+ throw new Error('already running, please stop first: builder.stop()');
78
52
  }
79
- /**
80
- *
81
- */
82
- stop() {
83
- return __awaiter(this, void 0, void 0, function* () {
84
- var _a;
85
- yield ((_a = this.fileLane) === null || _a === void 0 ? void 0 : _a.stop());
86
- this.fileLane = undefined;
87
- });
88
- }
89
- /**
90
- * 获取build的编译配置
91
- * @param projectPath 项目路径
92
- * @param options 命令参数
93
- */
94
- getCompilerOption(projectPath, options) {
95
- // 读取项目中文件的配置
96
- const quickappConfig = this.readQuickAppConfig(projectPath);
97
- const _a = quickappConfig || {}, { cli } = _a, otherConfig = __rest(_a, ["cli"]);
98
- options = lodash_1.default.merge({}, options, cli);
99
- // 项目配置
100
- const uxProjectConfig = new aiotpack_1.UxConfig(projectPath);
101
- // 编译配置
102
- const compileMode = options.mode || aiotpack_1.CompileMode.DEVELOPMENT;
103
- const compilerOption = lodash_1.default.merge(aiotpack_1.JavascriptDefaultCompileOption, Object.assign(Object.assign({}, options), { projectPath: path_1.default.join(projectPath, uxProjectConfig.output), mode: compileMode }), otherConfig);
104
- return compilerOption;
53
+ const watch = options.watch || false;
54
+ // 项目配置
55
+ const uxProjectConfig = new _aiotpack.UxConfig(projectPath);
56
+ // 编译配置
57
+ const compilerOption = this.getCompilerOption(projectPath, options);
58
+ const log = {
59
+ level: _sharedUtils.Loglevel.INFO,
60
+ message: ['start build: ', {
61
+ word: JSON.stringify({
62
+ projectPath,
63
+ options,
64
+ watch,
65
+ node: process.version,
66
+ platform: process.platform,
67
+ arch: process.arch,
68
+ toolkit: require('../../package.json').version
69
+ }, null, 2)
70
+ }]
71
+ };
72
+ this.handleLogs([log]);
73
+ // 开始编译项目
74
+ this.fileLane = new _fileLane.default(uxProjectConfig, projectPath, compilerOption, this.events);
75
+ await this.fileLane.start({
76
+ watch
77
+ });
78
+ }
79
+ handleLogs(logs) {
80
+ const {
81
+ onLog
82
+ } = this.events;
83
+ if (onLog) {
84
+ onLog(logs);
85
+ } else {
86
+ logs.forEach(log => {
87
+ _sharedUtils.ColorConsole.logger(log);
88
+ });
105
89
  }
106
- readQuickAppConfig(projectPath) {
107
- const path = path_1.default.join(projectPath, this.QUICKAPP_CONFIG);
108
- if (fs_extra_1.default.existsSync(path)) {
109
- try {
110
- const data = require(path);
111
- return data;
112
- }
113
- catch (error) {
114
- shared_utils_1.ColorConsole.throw((error === null || error === void 0 ? void 0 : error.toString()) || '');
115
- }
116
- }
117
- return;
90
+ }
91
+ async dispose() {
92
+ await this.fileLane?.dispose();
93
+ this.fileLane = undefined;
94
+ }
95
+
96
+ /**
97
+ * 获取build的编译配置
98
+ * @param projectPath 项目路径
99
+ * @param options 命令参数
100
+ */
101
+ getCompilerOption(projectPath, options) {
102
+ // 读取项目中文件的配置
103
+ const quickappConfig = this.readQuickAppConfig(projectPath);
104
+ const {
105
+ cli,
106
+ ...otherConfig
107
+ } = quickappConfig || {};
108
+ options = _lodash.default.merge({}, options, cli);
109
+ // 项目配置
110
+ const uxProjectConfig = new _aiotpack.UxConfig(projectPath);
111
+ // 编译配置
112
+ const mode = options.mode || _aiotpack.CompileMode.DEVELOPMENT;
113
+ const compilerOption = _lodash.default.merge({}, _aiotpack.JavascriptDefaultCompileOption, {
114
+ ...options,
115
+ projectPath: _path.default.join(projectPath, uxProjectConfig.output),
116
+ mode
117
+ }, otherConfig);
118
+ return compilerOption;
119
+ }
120
+ readQuickAppConfig(projectPath) {
121
+ const path = _path.default.join(projectPath, this.QUICKAPP_CONFIG);
122
+ if (_fsExtra.default.existsSync(path)) {
123
+ try {
124
+ const data = require(path);
125
+ return data;
126
+ } catch (error) {
127
+ const log = {
128
+ level: _sharedUtils.Loglevel.ERROR,
129
+ message: ['read quickapp.config.js error: ', {
130
+ word: error?.toString() || ''
131
+ }]
132
+ };
133
+ this.handleLogs([log]);
134
+ }
118
135
  }
136
+ return;
137
+ }
119
138
  }
120
- exports.default = UxBuilderBase;
139
+ var _default = exports.default = UxBuilderBase;
@@ -1,28 +1,29 @@
1
- import { CompileMode } from '@aiot-toolkit/aiotpack';
2
1
  import { IParam } from '@aiot-toolkit/commander';
3
- import { Dictionary } from '@aiot-toolkit/shared-utils';
4
2
  import IBuilder from './IBuilder';
5
- import UxBuilderBase from './UxBuilderBase';
6
- interface IUxBuilderOption extends Dictionary {
3
+ import UxBuilderBase, { IUxBuildOption } from './UxBuilderBase';
4
+ export interface IVelaUxBuilderOption extends IUxBuildOption {
7
5
  watch?: boolean;
8
- mode: CompileMode;
9
- enableJsc: boolean;
6
+ enableJsc?: boolean;
10
7
  enableE2e?: boolean;
8
+ enableStats?: boolean;
9
+ optimizeCssAttr?: boolean;
10
+ /**
11
+ * 是否自动补全 manifest.json 中的 features 配置
12
+ */
13
+ completeFeature?: boolean;
11
14
  /**
12
15
  * 此选项控制是否生成,以及如何生成 source map
13
16
  *
14
17
  * @see https://www.webpackjs.com/configuration/devtool/#devtool
15
18
  */
16
19
  devtool?: string;
17
- /**
18
- * 是否自动补全 manifest.json 中的 features 配置
19
- */
20
- completeFeature?: boolean;
20
+ enableProtobuf?: boolean;
21
21
  }
22
+ export declare const velaUxBuilderParams: IParam[];
22
23
  /**
23
24
  * VelaUxBuilder
24
25
  */
25
- declare class VelaUxBuilder extends UxBuilderBase<IUxBuilderOption> implements IBuilder<IUxBuilderOption> {
26
+ declare class VelaUxBuilder extends UxBuilderBase<IVelaUxBuilderOption> implements IBuilder<IVelaUxBuilderOption> {
26
27
  params: IParam[];
27
28
  match(projectPath: string): boolean;
28
29
  }
@@ -1,66 +1,70 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const shared_utils_1 = require("@aiot-toolkit/shared-utils");
7
- const UxBuilderBase_1 = __importDefault(require("./UxBuilderBase"));
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.velaUxBuilderParams = exports.default = void 0;
7
+ var _sharedUtils = require("@aiot-toolkit/shared-utils");
8
+ var _UxBuilderBase = _interopRequireDefault(require("./UxBuilderBase"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ const velaUxBuilderParams = exports.velaUxBuilderParams = [{
11
+ type: 'string',
12
+ name: 'devtool',
13
+ description: 'source map config'
14
+ }, {
15
+ name: 'disable-subpackages',
16
+ description: 'disable subpackages'
17
+ }, {
18
+ type: 'confirm',
19
+ name: 'enable-jsc',
20
+ description: 'enable jsc bundle',
21
+ defaultValue: false
22
+ }, {
23
+ type: 'confirm',
24
+ name: 'enable-protobuf',
25
+ description: 'enable protobuf',
26
+ defaultValue: false
27
+ }, {
28
+ type: 'confirm',
29
+ name: 'enable-e2e',
30
+ description: 'inject test-suite for current project',
31
+ defaultValue: false
32
+ }, {
33
+ type: 'confirm',
34
+ name: 'enable-stats',
35
+ description: 'analyse time and size of webpack output files',
36
+ defaultValue: false
37
+ }, {
38
+ type: 'confirm',
39
+ name: 'optimize-css-attr',
40
+ description: 'optimize css attr',
41
+ defaultValue: false
42
+ }, {
43
+ type: 'confirm',
44
+ name: 'complete-feature',
45
+ description: 'auto complete the features are used in the code into the features field of the manifest.json file',
46
+ defaultValue: false
47
+ }, {
48
+ type: 'confirm',
49
+ name: 'enable-custom-component',
50
+ description: 'deprecated',
51
+ deprecated: 'please remove it now',
52
+ deprecatedVersion: '2.1.0'
53
+ }, {
54
+ type: 'confirm',
55
+ name: 'stats',
56
+ description: 'deprecated',
57
+ deprecated: 'please use `enable-stats` instead',
58
+ deprecatedVersion: '2.1.0'
59
+ }];
60
+
8
61
  /**
9
62
  * VelaUxBuilder
10
63
  */
11
- class VelaUxBuilder extends UxBuilderBase_1.default {
12
- constructor() {
13
- super(...arguments);
14
- this.params = [
15
- {
16
- type: 'string',
17
- name: 'devtool',
18
- description: 'source map config'
19
- },
20
- {
21
- name: 'disable-subpackages',
22
- description: 'disable subpackages'
23
- },
24
- {
25
- type: 'confirm',
26
- name: 'enable-jsc',
27
- description: 'enable jsc bundle',
28
- defaultValue: false
29
- },
30
- {
31
- type: 'confirm',
32
- name: 'enable-protobuf',
33
- description: 'enable protobuf',
34
- defaultValue: false
35
- },
36
- {
37
- type: 'confirm',
38
- name: 'enable-e2e',
39
- description: 'inject test-suite for current project',
40
- defaultValue: false
41
- },
42
- {
43
- type: 'confirm',
44
- name: 'enable-stats',
45
- description: 'analyse time and size of webpack output files',
46
- defaultValue: false
47
- },
48
- {
49
- type: 'confirm',
50
- name: 'optimize-css-attr',
51
- description: 'optimize css attr',
52
- defaultValue: false
53
- },
54
- {
55
- type: 'confirm',
56
- name: 'complete-feature',
57
- description: 'auto complete the features are used in the code into the features field of the manifest.json file',
58
- defaultValue: false
59
- }
60
- ];
61
- }
62
- match(projectPath) {
63
- return shared_utils_1.ProjectType.getProjectType(projectPath) === shared_utils_1.ProjectType.VELA_UX;
64
- }
64
+ class VelaUxBuilder extends _UxBuilderBase.default {
65
+ params = (() => velaUxBuilderParams)();
66
+ match(projectPath) {
67
+ return _sharedUtils.ProjectType.getProjectType(projectPath) === _sharedUtils.ProjectType.VELA_UX;
68
+ }
65
69
  }
66
- exports.default = VelaUxBuilder;
70
+ var _default = exports.default = VelaUxBuilder;
@@ -9,8 +9,10 @@ export interface IBuilderOption {
9
9
  */
10
10
  declare class XtsBuilder implements IBuilder<IBuilderOption> {
11
11
  static readonly PROJECT_TYPE = "xts quick app";
12
+ private fileLane?;
12
13
  match(projectPath: string): boolean;
13
14
  build(projectPath: string, options: IBuilderOption): Promise<void>;
15
+ dispose(): Promise<void>;
14
16
  readonly params: IParam[];
15
17
  }
16
18
  export default XtsBuilder;
@@ -1,87 +1,94 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const aiotpack_1 = require("@aiot-toolkit/aiotpack");
16
- const aiotpack_2 = require("@aiot-toolkit/aiotpack");
17
- const shared_utils_1 = require("@aiot-toolkit/shared-utils");
18
- const file_lane_1 = require("file-lane");
19
- const fs_1 = __importDefault(require("fs"));
20
- const path_1 = __importDefault(require("path"));
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _aiotpack = require("@aiot-toolkit/aiotpack");
8
+ var _sharedUtils = require("@aiot-toolkit/shared-utils");
9
+ var _fileLane = require("file-lane");
10
+ var _fs = _interopRequireDefault(require("fs"));
11
+ var _path = _interopRequireDefault(require("path"));
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
13
  /**
22
14
  * XtsBuilder
23
15
  */
24
16
  class XtsBuilder {
25
- constructor() {
26
- this.params = [
27
- {
28
- name: 'skip',
29
- type: 'string',
30
- description: `Can configure skip steps, comma separated, optional values: ${aiotpack_2.skipList.join(',')}`,
31
- validate(value) {
32
- // TODO: validate 不起作用
33
- const res = shared_utils_1.StringUtil.string2arrayByComma(value);
34
- const unValid = res.find((r) => {
35
- return !aiotpack_2.skipList.includes(r);
36
- });
37
- if (unValid) {
38
- return `${unValid} is unvalidate, validate value are ${aiotpack_2.skipList.join(',')}, Multiple values separated by commas`;
39
- }
40
- return true;
41
- }
42
- }
43
- ];
17
+ static PROJECT_TYPE = 'xts quick app';
18
+ match(projectPath) {
19
+ // app/app.xts 存在视为xts项目
20
+ return _fs.default.existsSync(_path.default.resolve(projectPath, 'app/app.xts'));
21
+ }
22
+ async build(projectPath, options) {
23
+ if (this.fileLane) {
24
+ // 已经在运行中,请先停止
25
+ throw new Error('already running, please stop first: builder.stop()');
44
26
  }
45
- match(projectPath) {
46
- // app/app.xts 存在视为xts项目
47
- return fs_1.default.existsSync(path_1.default.resolve(projectPath, 'app/app.xts'));
27
+ const watch = options.watch || false;
28
+ _sharedUtils.ColorConsole.success('Start build...\n', {
29
+ word: 'ProjectPath: ',
30
+ style: _sharedUtils.ColorConsole.getStyle(_sharedUtils.Loglevel.SUCCESS)
31
+ }, projectPath, '\n', {
32
+ word: 'buildOptions: ',
33
+ style: _sharedUtils.ColorConsole.getStyle(_sharedUtils.Loglevel.SUCCESS)
34
+ }, JSON.stringify(options));
35
+ const compilerOptions = {
36
+ skip: _sharedUtils.StringUtil.string2arrayByComma(options.skip)
37
+ };
38
+ const config = new _aiotpack.XtsConfig(projectPath);
39
+ if (compilerOptions.skip?.includes('xts2ts')) {
40
+ _sharedUtils.ColorConsole.info("### skip compile xts to ts due to --skip ${compilerOptions?.skip.join(',')}");
41
+ const context = _fileLane.FileLaneUtil.createContext(config.output, projectPath);
42
+ const preWorks = config.beforeCompile || [];
43
+ for (let item of preWorks) {
44
+ try {
45
+ await item({
46
+ context,
47
+ config,
48
+ compilerOption: compilerOptions
49
+ });
50
+ } catch (error) {
51
+ // 报错 prework的item error
52
+ }
53
+ }
54
+ const follWorks = config.afterCompile || [];
55
+ for (let item of follWorks) {
56
+ try {
57
+ await item.worker({
58
+ context,
59
+ config,
60
+ compilerOption: compilerOptions
61
+ });
62
+ } catch (error) {
63
+ // 报错 prework的item error
64
+ }
65
+ }
66
+ } else {
67
+ this.fileLane = new _fileLane.FileLane(config, projectPath, compilerOptions);
68
+ this.fileLane.start({
69
+ watch
70
+ });
48
71
  }
49
- build(projectPath, options) {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- var _a;
52
- const watch = options.watch || false;
53
- shared_utils_1.ColorConsole.success('Start build...\n', { word: 'ProjectPath: ', style: shared_utils_1.ColorConsole.getStyle(shared_utils_1.Loglevel.SUCCESS) }, projectPath, '\n', { word: 'buildOptions: ', style: shared_utils_1.ColorConsole.getStyle(shared_utils_1.Loglevel.SUCCESS) }, JSON.stringify(options));
54
- const compilerOptions = {
55
- skip: shared_utils_1.StringUtil.string2arrayByComma(options.skip)
56
- };
57
- const config = new aiotpack_1.XtsConfig(projectPath);
58
- if ((_a = compilerOptions.skip) === null || _a === void 0 ? void 0 : _a.includes('xts2ts')) {
59
- shared_utils_1.ColorConsole.info("### skip compile xts to ts due to --skip ${compilerOptions?.skip.join(',')}");
60
- const context = file_lane_1.FileLaneUtil.createContext(config.output, projectPath);
61
- const preWorks = config.beforeCompile || [];
62
- for (let item of preWorks) {
63
- try {
64
- yield item({ context, config, compilerOption: compilerOptions });
65
- }
66
- catch (error) {
67
- // 报错 prework的item error
68
- }
69
- }
70
- const follWorks = config.afterCompile || [];
71
- for (let item of follWorks) {
72
- try {
73
- yield item.worker({ context, config, compilerOption: compilerOptions });
74
- }
75
- catch (error) {
76
- // 报错 prework的item error
77
- }
78
- }
79
- }
80
- else {
81
- return new file_lane_1.FileLane(config, projectPath, compilerOptions).start({ watch });
82
- }
83
- });
72
+ }
73
+ async dispose() {
74
+ await this.fileLane?.dispose();
75
+ this.fileLane = undefined;
76
+ }
77
+ params = (() => [{
78
+ name: 'skip',
79
+ type: 'string',
80
+ description: `Can configure skip steps, comma separated, optional values: ${_aiotpack.skipList.join(',')}`,
81
+ validate(value) {
82
+ // TODO: validate 不起作用
83
+ const res = _sharedUtils.StringUtil.string2arrayByComma(value);
84
+ const unValid = res.find(r => {
85
+ return !_aiotpack.skipList.includes(r);
86
+ });
87
+ if (unValid) {
88
+ return `${unValid} is unvalidate, validate value are ${_aiotpack.skipList.join(',')}, Multiple values separated by commas`;
89
+ }
90
+ return true;
84
91
  }
92
+ }])();
85
93
  }
86
- XtsBuilder.PROJECT_TYPE = 'xts quick app';
87
- exports.default = XtsBuilder;
94
+ var _default = exports.default = XtsBuilder;