@cloudbase/cals 0.4.9 → 0.4.10
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/code/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/code/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAsE,MAAM,mBAAmB,CAAC;AAGrH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,GAAE,IAAI,GAAG,IAAW,GAAG,SAAS,EAAE,CAsL3F;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,OAAO,GAAE,IAAI,GAAG,IAAW,GAAG,YAAY,CA+J3F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CA6BlF"}
|
|
@@ -112,6 +112,7 @@ function calsToCode(calsJSON, version = 'v1') {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
function genConfig(itemJSON, configFields, configPath, otherConfigFields) {
|
|
115
|
+
var _a;
|
|
115
116
|
const config = (0, lodash_1.pick)(itemJSON, configFields);
|
|
116
117
|
if (otherConfigFields) {
|
|
117
118
|
Object.keys(otherConfigFields).forEach((key) => {
|
|
@@ -119,7 +120,9 @@ function calsToCode(calsJSON, version = 'v1') {
|
|
|
119
120
|
});
|
|
120
121
|
}
|
|
121
122
|
// state, computed 类型以及名称为 ____index____ 的都不生成代码
|
|
122
|
-
config._ignoreResources =
|
|
123
|
+
config._ignoreResources =
|
|
124
|
+
((_a = itemJSON.resources) === null || _a === void 0 ? void 0 : _a.filter((item) => [types_1.ECodeType.STATE, types_1.ECodeType.COMPUTEDN].includes(item.codeType) ||
|
|
125
|
+
item.name === types_1.ECodeName.PLACEHOLDER)) || [];
|
|
123
126
|
// 按 key 排序,这样确保每次生成都一样的顺序,减少冲突
|
|
124
127
|
const newConfig = {};
|
|
125
128
|
Object.keys(config)
|
|
@@ -128,19 +131,19 @@ function calsToCode(calsJSON, version = 'v1') {
|
|
|
128
131
|
addCodeItem(configPath, JSON.stringify(config, null, 2));
|
|
129
132
|
}
|
|
130
133
|
function genCode(resources, basePath = '') {
|
|
131
|
-
const codeResources = (resources || []).filter((item) => item.type === types_1.EResourceType.CODE && item.name !==
|
|
134
|
+
const codeResources = (resources || []).filter((item) => item.type === types_1.EResourceType.CODE && item.name !== types_1.ECodeName.PLACEHOLDER);
|
|
132
135
|
codeResources.forEach((codeItem) => {
|
|
133
136
|
let codePath = '';
|
|
134
137
|
let realBasePath = basePath ? `${basePath}/` : basePath;
|
|
135
138
|
switch (codeItem.codeType) {
|
|
136
139
|
case types_1.ECodeType.THEME:
|
|
137
|
-
codePath = `${realBasePath}
|
|
140
|
+
codePath = `${realBasePath}${types_1.ECodeName.THEME}.less`;
|
|
138
141
|
break;
|
|
139
142
|
case types_1.ECodeType.STYLE:
|
|
140
|
-
codePath = `${realBasePath}
|
|
143
|
+
codePath = `${realBasePath}${types_1.ECodeName.STYLE}.less`;
|
|
141
144
|
break;
|
|
142
145
|
case types_1.ECodeType.LIFECYCLE:
|
|
143
|
-
codePath = `${realBasePath}
|
|
146
|
+
codePath = `${realBasePath}${types_1.ECodeName.LIFECYCLE}.js`;
|
|
144
147
|
break;
|
|
145
148
|
// 这两种类型的文件现在不生成文件,需要存放在 config 中
|
|
146
149
|
case types_1.ECodeType.STATE:
|
|
@@ -150,10 +153,10 @@ function calsToCode(calsJSON, version = 'v1') {
|
|
|
150
153
|
// codePath = `${realBasePath}computed.js`;
|
|
151
154
|
break;
|
|
152
155
|
case types_1.ECodeType.NORMAL_MODULE:
|
|
153
|
-
codePath =
|
|
156
|
+
codePath = `${types_1.ECodeName.NORMAL_MODULE}/${codeItem.name}.js`;
|
|
154
157
|
break;
|
|
155
158
|
case types_1.ECodeType.HANDLER_FN:
|
|
156
|
-
codePath = `${realBasePath}
|
|
159
|
+
codePath = `${realBasePath}${types_1.ECodeName.HANDLER_FN}/${codeItem.name}.js`;
|
|
157
160
|
break;
|
|
158
161
|
}
|
|
159
162
|
if (codePath) {
|
|
@@ -220,6 +223,9 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
220
223
|
};
|
|
221
224
|
calsJSON.items.push(pageItem);
|
|
222
225
|
}
|
|
226
|
+
if (!pageItem.resources) {
|
|
227
|
+
pageItem.resources = [];
|
|
228
|
+
}
|
|
223
229
|
if (versionConfig.pageConfigRegExp.test(codeItem.path)) {
|
|
224
230
|
/**
|
|
225
231
|
* page-config.json
|
|
@@ -12,6 +12,10 @@ export interface IResource extends Record<string, any> {
|
|
|
12
12
|
* 应用/组件 绑定的监听器
|
|
13
13
|
*/
|
|
14
14
|
export interface IListener {
|
|
15
|
+
/**
|
|
16
|
+
* 可选,listener id
|
|
17
|
+
*/
|
|
18
|
+
id?: string;
|
|
15
19
|
/**
|
|
16
20
|
* 可选,是否在捕获阶段响应
|
|
17
21
|
* @default false
|
|
@@ -53,6 +57,10 @@ export interface IDataset {
|
|
|
53
57
|
state?: Record<string, IStateVariable | any>;
|
|
54
58
|
/** 页面/应用 参数 */
|
|
55
59
|
params?: Record<string, IParamsVariable>;
|
|
60
|
+
/**
|
|
61
|
+
* 可选,页面配置名称
|
|
62
|
+
*/
|
|
63
|
+
pageName?: string;
|
|
56
64
|
}
|
|
57
65
|
export interface IStateVariable {
|
|
58
66
|
/** 中文名 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/basic/common.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACpD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,SAAS;AACT,MAAM,WAAW,QAAQ;IACvB,SAAS;IACT,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,GAAG,CAAC,CAAC;IAC7C,eAAe;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/basic/common.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACpD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,SAAS;AACT,MAAM,WAAW,QAAQ;IACvB,SAAS;IACT,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,GAAG,CAAC,CAAC;IAC7C,eAAe;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACzC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW;IACX,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU;IACV,YAAY,EAAE,GAAG,CAAC;CACnB;AAED,aAAa;AACb,MAAM,WAAW,eAAe;IAC9B,UAAU;IACV,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4BAA4B;IAE5B,qBAAqB;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cals",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"description": "Common application specifications",
|
|
5
5
|
"main": "lib/utils/index.js",
|
|
6
6
|
"source": "src/utils/index.ts",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"build:schema": "ts-node src/utils/build.ts",
|
|
14
14
|
"develop": "tsc --watch",
|
|
15
15
|
"docs": "typedoc --options typedoc.json types",
|
|
16
|
-
"test": "jest"
|
|
16
|
+
"test": "jest",
|
|
17
|
+
"test:coverage": "jest --coverage"
|
|
17
18
|
},
|
|
18
19
|
"keywords": [
|
|
19
20
|
"lowcode",
|