@cloudbase/cals 0.3.34 → 0.3.35-alpha.0
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/parser/cals/index.d.ts +1 -1
- package/lib/parser/cals/index.d.ts.map +1 -1
- package/lib/parser/cals/index.js +2 -12
- package/lib/parser/cals/utils/block/index.d.ts.map +1 -1
- package/lib/parser/cals/utils/code/index.d.ts +35 -0
- package/lib/parser/cals/utils/code/index.d.ts.map +1 -0
- package/lib/parser/cals/utils/code/index.js +419 -0
- package/lib/parser/cals/utils/runtime.d.ts.map +1 -1
- package/lib/parser/cals/utils/runtime.js +2 -7
- package/lib/parser/cals/utils/spinoff/index.d.ts.map +1 -1
- package/lib/parser/cals/utils/style.d.ts.map +1 -1
- package/lib/parser/cals/utils/version/common.d.ts.map +1 -1
- package/lib/parser/cals/utils/version/common.js +3 -6
- package/lib/parser/cals/utils/version/config.d.ts.map +1 -1
- package/lib/parser/cals/utils/version/config.js +1 -6
- package/lib/parser/cals/utils/version/index.d.ts.map +1 -1
- package/lib/parser/cals/utils/version/parses.d.ts.map +1 -1
- package/lib/parser/cals/utils/version/utils.d.ts.map +1 -1
- package/lib/parser/cals/utils/version/utils.js +1 -3
- package/lib/parser/expression/index.d.ts.map +1 -1
- package/lib/parser/expression/index.js +2 -4
- package/lib/parser/index.d.ts +1 -0
- package/lib/parser/index.d.ts.map +1 -1
- package/lib/parser/index.js +7 -1
- package/lib/types/basic/app.d.ts.map +1 -1
- package/lib/types/basic/common.d.ts.map +1 -1
- package/lib/types/basic/component.d.ts +0 -5
- package/lib/types/basic/component.d.ts.map +1 -1
- package/lib/types/basic/datasource.d.ts.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/lcds.d.ts.map +1 -1
- package/lib/types/platform/app.d.ts +4 -0
- package/lib/types/platform/app.d.ts.map +1 -1
- package/lib/types/platform/component.d.ts.map +1 -1
- package/lib/types/platform/datasource.d.ts +2 -2
- package/lib/types/platform/datasource.d.ts.map +1 -1
- package/lib/types/platform/widget/form.d.ts.map +1 -1
- package/lib/types/platform/widget/meta.d.ts.map +1 -1
- package/lib/utils/build.js +8 -8
- package/lib/utils/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/lib/parser/cals/utils/transform/index.d.ts +0 -4
- package/lib/parser/cals/utils/transform/index.d.ts.map +0 -1
- package/lib/parser/cals/utils/transform/index.js +0 -247
- package/lib/tsconfig.tsbuildinfo +0 -1
|
@@ -97,7 +97,6 @@ export declare function serializeComponent(ctx: ISerializeContext & ({
|
|
|
97
97
|
directives?: {
|
|
98
98
|
waIf?: IDynamicValue;
|
|
99
99
|
waFor?: IDynamicValue;
|
|
100
|
-
waForKey?: IDynamicValue;
|
|
101
100
|
};
|
|
102
101
|
listeners?: any[];
|
|
103
102
|
style: any;
|
|
@@ -292,6 +291,7 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
292
291
|
author: string;
|
|
293
292
|
description: string;
|
|
294
293
|
domain?: string;
|
|
294
|
+
originHistoryId?: string;
|
|
295
295
|
};
|
|
296
296
|
dependencies: IDependencies;
|
|
297
297
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../parser/cals/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,cAAc,EAGd,mBAAmB,EACnB,cAAc,EAAE,cAAc;AAC9B,mBAAmB,EACnB,aAAa,EACb,IAAI,EACL,MAAM,aAAa,CAAC;AAErB,OAAO,EAAkC,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAc5F,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,UAAU,mBAAmB;IAC3B,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;IACrB,eAAe,CAAC,EAAE,GAAG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;;;;;;;;;;;;;;;EAkEF;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,IAAI,CAAC,iBAAiB,EAAE,KAAK,GAAG,cAAc,GAAG,wBAAwB,CAAC,EAC/E,IAAI,EAAE,GAAG,GACR,cAAc,CAmDhB;AAWD;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,iBAAiB,GAAG;IACvB,IAAI,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;CAC3C,EACD,SAAS,EAAE,GAAG,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAC9B,eAAe,GAAG,iBAAiB,CAmHrC;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,GAAG,CAwBzE;AAaD,wBAAgB,+BAA+B,CAAC,IAAI,EAAE;IACpD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACzC,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,UAAU,CAAA;KAAE,CAAC;IAC/C,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,CAAA;KAAE,CAAC;CAC1C;;;;;;;mBAIY,MAAM;mBACN,MAAM;sBACH,MAAM;;;6BACwB,OAAO;;;wBACnC,MAAM;;;EA8BvB"}
|
package/lib/parser/cals/index.js
CHANGED
|
@@ -191,7 +191,7 @@ function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlin
|
|
|
191
191
|
return _value;
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
|
-
data[processedKey] =
|
|
194
|
+
data[processedKey] = processedValue;
|
|
195
195
|
}
|
|
196
196
|
extra[originKey] = processedExtra;
|
|
197
197
|
});
|
|
@@ -342,14 +342,6 @@ function serializeDirecties(ctx, directives, scope = 'page') {
|
|
|
342
342
|
scope,
|
|
343
343
|
}).value}`
|
|
344
344
|
: undefined,
|
|
345
|
-
key: directives.waForKey
|
|
346
|
-
? serializeValue({
|
|
347
|
-
ctx,
|
|
348
|
-
key: 'waForKey',
|
|
349
|
-
dynamicValue: directives.waForKey,
|
|
350
|
-
scope,
|
|
351
|
-
}).value
|
|
352
|
-
: undefined,
|
|
353
345
|
};
|
|
354
346
|
for (let key in processed) {
|
|
355
347
|
let map = processed;
|
|
@@ -360,9 +352,8 @@ function serializeDirecties(ctx, directives, scope = 'page') {
|
|
|
360
352
|
return undefined;
|
|
361
353
|
}
|
|
362
354
|
function deserializeDirecties(ctx, directives) {
|
|
363
|
-
let waIf = (directives === null || directives === void 0 ? void 0 : directives[':if'])
|
|
355
|
+
let waIf = (directives === null || directives === void 0 ? void 0 : directives[':if']) != undefined ? deserializeValue(ctx, ':if', directives[':if']).value : { value: true };
|
|
364
356
|
let waFor = (directives === null || directives === void 0 ? void 0 : directives[':for']) ? deserializeValue(ctx, ':for', directives[':for']).value : undefined;
|
|
365
|
-
const waForKey = (directives === null || directives === void 0 ? void 0 : directives.key) ? deserializeValue(ctx, 'key', directives.key).value : undefined;
|
|
366
357
|
if (waFor) {
|
|
367
358
|
let { type, value } = waFor;
|
|
368
359
|
if (type === expression_1.PropBindType.expression) {
|
|
@@ -372,7 +363,6 @@ function deserializeDirecties(ctx, directives) {
|
|
|
372
363
|
let processed = {
|
|
373
364
|
waIf: (waIf === null || waIf === void 0 ? void 0 : waIf.value) === true ? undefined : waIf,
|
|
374
365
|
waFor,
|
|
375
|
-
waForKey,
|
|
376
366
|
};
|
|
377
367
|
for (let key in processed) {
|
|
378
368
|
let map = processed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/block/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAqB,MAAM,mBAAmB,CAAC;AAI1F,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE;QACV,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACtC;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,GAAG,iBAAiB,GAAG,aAAa,CAyD/G"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* clas 与 code 互转
|
|
3
|
+
* 这里的 code 是中间状态的 code,即非最终生成的可运行的项目代码
|
|
4
|
+
*/
|
|
5
|
+
import { IPlatformApp } from '../../../../types';
|
|
6
|
+
export interface ICodeItem {
|
|
7
|
+
path: string;
|
|
8
|
+
code: string;
|
|
9
|
+
conflict?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* CALS 转成 中间状态的代码
|
|
13
|
+
*
|
|
14
|
+
* @params version: v0 - 没有 pages 目录; v1 - 有 pages 目录
|
|
15
|
+
*/
|
|
16
|
+
export declare function calsToCode(calsJSON: IPlatformApp, version?: 'v0' | 'v1'): ICodeItem[];
|
|
17
|
+
/**
|
|
18
|
+
* 中间状态的代码 转成 CALS
|
|
19
|
+
*
|
|
20
|
+
* @params version: v0 - 没有 pages 目录; v1 - 有 pages 目录
|
|
21
|
+
*/
|
|
22
|
+
export declare function codeToCals(codeList: ICodeItem[], version?: 'v0' | 'v1'): IPlatformApp;
|
|
23
|
+
/**
|
|
24
|
+
* 指定目录下的文件转代码
|
|
25
|
+
*/
|
|
26
|
+
export declare function fileToCode(dirPath: string, onlyPath?: boolean): Promise<ICodeItem[]>;
|
|
27
|
+
/**
|
|
28
|
+
* 指定代码内容是否存在冲突未解决
|
|
29
|
+
*/
|
|
30
|
+
export declare function checkForConflicts(code: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 以 from 为准自动解决冲突
|
|
33
|
+
*/
|
|
34
|
+
export declare function autoResolveConflicts(code: string, from: 'theirs' | 'ours'): string;
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/code/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAiC,MAAM,mBAAmB,CAAC;AAMhF,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,CAiL3F;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,OAAO,GAAE,IAAI,GAAG,IAAW,GAAG,YAAY,CA4J3F;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAe,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAqBjG;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"}
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* clas 与 code 互转
|
|
4
|
+
* 这里的 code 是中间状态的 code,即非最终生成的可运行的项目代码
|
|
5
|
+
*/
|
|
6
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.autoResolveConflicts = exports.checkForConflicts = exports.fileToCode = exports.codeToCals = exports.calsToCode = void 0;
|
|
20
|
+
const lodash_1 = require("lodash");
|
|
21
|
+
const glob_1 = __importDefault(require("glob"));
|
|
22
|
+
const path_1 = __importDefault(require("path"));
|
|
23
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
24
|
+
/**
|
|
25
|
+
* CALS 转成 中间状态的代码
|
|
26
|
+
*
|
|
27
|
+
* @params version: v0 - 没有 pages 目录; v1 - 有 pages 目录
|
|
28
|
+
*/
|
|
29
|
+
function calsToCode(calsJSON, version = 'v1') {
|
|
30
|
+
// 边界处理
|
|
31
|
+
if (!calsJSON)
|
|
32
|
+
return [];
|
|
33
|
+
const versionMap = {
|
|
34
|
+
v0: {
|
|
35
|
+
pageDir: '',
|
|
36
|
+
},
|
|
37
|
+
v1: {
|
|
38
|
+
pageDir: 'pages',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
const versionConfig = versionMap[version];
|
|
42
|
+
if (!versionConfig)
|
|
43
|
+
throw "version' value must be v0 or v1";
|
|
44
|
+
const codeList = [];
|
|
45
|
+
/**
|
|
46
|
+
* 生成 pages
|
|
47
|
+
*/
|
|
48
|
+
const pagePaths = [];
|
|
49
|
+
calsJSON.items.forEach((pageItem) => {
|
|
50
|
+
const pagePath = versionConfig.pageDir ? `${versionConfig.pageDir}/${pageItem.id}` : pageItem.id;
|
|
51
|
+
/**
|
|
52
|
+
* 生成 page-config.json
|
|
53
|
+
*/
|
|
54
|
+
// 来自 IPageComponent
|
|
55
|
+
// :class, :style, component, dataVariables, directives, id, listeners, module, type 忽略,所以这里不包含
|
|
56
|
+
const pageConfigFields = ['attributes', 'dataset', 'extra', 'label', 'name'];
|
|
57
|
+
genConfig(pageItem, pageConfigFields, `${pagePath}/page-config.json`);
|
|
58
|
+
/**
|
|
59
|
+
* 生成 page.json
|
|
60
|
+
*/
|
|
61
|
+
addCodeItem(`${pagePath}/page.json`, JSON.stringify(pageItem.items, null, 2));
|
|
62
|
+
/**
|
|
63
|
+
* 生成页面代码
|
|
64
|
+
*/
|
|
65
|
+
genCode(pageItem.resources, pagePath);
|
|
66
|
+
// 记录页面目录路径
|
|
67
|
+
pagePaths.push(pagePath);
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* 生成 app-config.json
|
|
71
|
+
*/
|
|
72
|
+
// 来自 Interface IPlatformApp
|
|
73
|
+
// dataSources, dataVariables 忽略,所以这里不包含
|
|
74
|
+
const appConfigFields = [
|
|
75
|
+
'author',
|
|
76
|
+
'dataset',
|
|
77
|
+
'dependencies',
|
|
78
|
+
'description',
|
|
79
|
+
'envId',
|
|
80
|
+
'extra',
|
|
81
|
+
'id',
|
|
82
|
+
'label',
|
|
83
|
+
'main',
|
|
84
|
+
'name',
|
|
85
|
+
'version',
|
|
86
|
+
];
|
|
87
|
+
const otherConfigFields = {
|
|
88
|
+
// 来自 Interface IPlatformAppExtra
|
|
89
|
+
extra: [
|
|
90
|
+
'appConfig',
|
|
91
|
+
'compHiddenConfig',
|
|
92
|
+
'domain',
|
|
93
|
+
'historyType',
|
|
94
|
+
'maxID',
|
|
95
|
+
'miniprogramPlugins',
|
|
96
|
+
'npmDependencies',
|
|
97
|
+
'plugins',
|
|
98
|
+
'presetColors',
|
|
99
|
+
'rootPath',
|
|
100
|
+
'themeVars',
|
|
101
|
+
'originHistoryId',
|
|
102
|
+
// 额外添加,非标准
|
|
103
|
+
'pages',
|
|
104
|
+
],
|
|
105
|
+
};
|
|
106
|
+
// @ts-ignore
|
|
107
|
+
calsJSON.extra.pages = pagePaths;
|
|
108
|
+
genConfig(calsJSON, appConfigFields, 'app-config.json', otherConfigFields);
|
|
109
|
+
/**
|
|
110
|
+
* 生成全局代码
|
|
111
|
+
*/
|
|
112
|
+
genCode(calsJSON.resources);
|
|
113
|
+
/**
|
|
114
|
+
* 生成 package.json 文件
|
|
115
|
+
*/
|
|
116
|
+
addCodeItem('package.json', JSON.stringify({
|
|
117
|
+
name: calsJSON.name,
|
|
118
|
+
description: calsJSON.description,
|
|
119
|
+
version: calsJSON.version,
|
|
120
|
+
}, null, 2), '');
|
|
121
|
+
return codeList;
|
|
122
|
+
function addCodeItem(path, code, parentDir = 'src') {
|
|
123
|
+
codeList.push({
|
|
124
|
+
path: parentDir ? `${parentDir}/${path}` : path,
|
|
125
|
+
code,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function genConfig(itemJSON, configFields, configPath, otherConfigFields) {
|
|
129
|
+
const config = (0, lodash_1.pick)(itemJSON, configFields);
|
|
130
|
+
if (otherConfigFields) {
|
|
131
|
+
Object.keys(otherConfigFields).forEach((key) => {
|
|
132
|
+
config[key] = (0, lodash_1.pick)(config[key], otherConfigFields[key]);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
// state, computed 类型以及名称为 ____index____ 的都不生成代码
|
|
136
|
+
config._ignoreResources = itemJSON.resources.filter((item) => ['state', 'computed'].includes(item.codeType) || item.name === '____index____');
|
|
137
|
+
// 按 key 排序,这样确保每次生成都一样的顺序,减少冲突
|
|
138
|
+
const newConfig = {};
|
|
139
|
+
Object.keys(config)
|
|
140
|
+
.sort()
|
|
141
|
+
.forEach((key) => (newConfig[key] = config[key]));
|
|
142
|
+
addCodeItem(configPath, JSON.stringify(config, null, 2));
|
|
143
|
+
}
|
|
144
|
+
function genCode(resources, basePath = '') {
|
|
145
|
+
const codeResources = (resources || []).filter((item) => item.type === 'CODE' && item.name !== '____index____');
|
|
146
|
+
codeResources.forEach((codeItem) => {
|
|
147
|
+
let codePath = '';
|
|
148
|
+
let realBasePath = basePath ? `${basePath}/` : basePath;
|
|
149
|
+
switch (codeItem.codeType) {
|
|
150
|
+
case 'theme':
|
|
151
|
+
codePath = `${realBasePath}theme.less`;
|
|
152
|
+
break;
|
|
153
|
+
case 'style':
|
|
154
|
+
codePath = `${realBasePath}style.less`;
|
|
155
|
+
break;
|
|
156
|
+
case 'lifecycle':
|
|
157
|
+
codePath = `${realBasePath}lifecycle.js`;
|
|
158
|
+
break;
|
|
159
|
+
// 这两种类型的文件现在不生成文件,需要存放在 config 中
|
|
160
|
+
case 'state':
|
|
161
|
+
// codePath = `${realBasePath}state.js`;
|
|
162
|
+
break;
|
|
163
|
+
case 'computed':
|
|
164
|
+
// codePath = `${realBasePath}computed.js`;
|
|
165
|
+
break;
|
|
166
|
+
case 'normal-module':
|
|
167
|
+
codePath = `common/${codeItem.name}.js`;
|
|
168
|
+
break;
|
|
169
|
+
case 'handler-fn':
|
|
170
|
+
codePath = `${realBasePath}handler/${codeItem.name}.js`;
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
if (codePath) {
|
|
174
|
+
addCodeItem(codePath, codeItem.code);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
exports.calsToCode = calsToCode;
|
|
180
|
+
/**
|
|
181
|
+
* 中间状态的代码 转成 CALS
|
|
182
|
+
*
|
|
183
|
+
* @params version: v0 - 没有 pages 目录; v1 - 有 pages 目录
|
|
184
|
+
*/
|
|
185
|
+
function codeToCals(codeList, version = 'v1') {
|
|
186
|
+
// 边界处理
|
|
187
|
+
if (!codeList || codeList.length === 0)
|
|
188
|
+
return {};
|
|
189
|
+
const versionMap = {
|
|
190
|
+
v0: {
|
|
191
|
+
pageDir: 'src',
|
|
192
|
+
pageIdRegExp: /src\/(.*?)\/.*/,
|
|
193
|
+
pageConfigRegExp: /src\/.*?\/page-config.json$/,
|
|
194
|
+
pageJSONRegExp: /src\/.*?\/page.json/,
|
|
195
|
+
},
|
|
196
|
+
v1: {
|
|
197
|
+
pageDir: 'src/pages',
|
|
198
|
+
pageIdRegExp: /src\/pages\/(.*?)\/.*/,
|
|
199
|
+
pageConfigRegExp: /src\/pages\/.*?\/page-config.json$/,
|
|
200
|
+
pageJSONRegExp: /src\/pages\/.*?\/page.json/,
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
const versionConfig = versionMap[version];
|
|
204
|
+
if (!versionConfig)
|
|
205
|
+
throw "version' value must be v0 or v1";
|
|
206
|
+
// @ts-ignore
|
|
207
|
+
const calsJSON = {
|
|
208
|
+
items: [],
|
|
209
|
+
resources: [],
|
|
210
|
+
};
|
|
211
|
+
const appConfigCodeItem = codeList.find((item) => item.path === 'src/app-config.json');
|
|
212
|
+
const appConfig = JSON.parse(appConfigCodeItem.code);
|
|
213
|
+
let pagePaths = appConfig.extra.pages;
|
|
214
|
+
codeList.forEach((codeItem) => {
|
|
215
|
+
if (codeItem.path === 'src/app-config.json') {
|
|
216
|
+
/**
|
|
217
|
+
* app-config.json
|
|
218
|
+
*/
|
|
219
|
+
const config = appConfig;
|
|
220
|
+
Object.assign(calsJSON, (0, lodash_1.omit)(config, ['_ignoreResources', 'extra.pages']));
|
|
221
|
+
calsJSON.resources = (0, lodash_1.concat)(calsJSON.resources, config._ignoreResources);
|
|
222
|
+
}
|
|
223
|
+
else if (isPageFile(codeItem.path)) {
|
|
224
|
+
/**
|
|
225
|
+
* page
|
|
226
|
+
*/
|
|
227
|
+
const [, pageId] = codeItem.path.match(versionConfig.pageIdRegExp);
|
|
228
|
+
let pageItem = calsJSON.items.find((item) => item.id === pageId);
|
|
229
|
+
if (!pageItem) {
|
|
230
|
+
pageItem = {
|
|
231
|
+
id: pageId,
|
|
232
|
+
type: 'PAGE',
|
|
233
|
+
resources: [],
|
|
234
|
+
};
|
|
235
|
+
calsJSON.items.push(pageItem);
|
|
236
|
+
}
|
|
237
|
+
if (versionConfig.pageConfigRegExp.test(codeItem.path)) {
|
|
238
|
+
/**
|
|
239
|
+
* page-config.json
|
|
240
|
+
*/
|
|
241
|
+
const config = JSON.parse(codeItem.code);
|
|
242
|
+
const propsConfig = (0, lodash_1.omit)(config, ['_ignoreResources']);
|
|
243
|
+
Object.assign(pageItem, propsConfig);
|
|
244
|
+
pageItem.resources = (0, lodash_1.concat)(pageItem.resources, config._ignoreResources);
|
|
245
|
+
}
|
|
246
|
+
else if (versionConfig.pageJSONRegExp.test(codeItem.path)) {
|
|
247
|
+
/**
|
|
248
|
+
* page.json
|
|
249
|
+
*/
|
|
250
|
+
pageItem.items = JSON.parse(codeItem.code);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
/**
|
|
254
|
+
* page normal codes
|
|
255
|
+
*/
|
|
256
|
+
handleNormalCodes(codeItem, pageId, pageItem.resources);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
else if (codeItem.path.indexOf('src/') === 0) {
|
|
260
|
+
/**
|
|
261
|
+
* global normal codes
|
|
262
|
+
*/
|
|
263
|
+
handleNormalCodes(codeItem, '', calsJSON.resources);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
return calsJSON;
|
|
267
|
+
function handleNormalCodes(codeItem, pageId, resources) {
|
|
268
|
+
const relativePath = !pageId
|
|
269
|
+
? codeItem.path.replace('src/', '')
|
|
270
|
+
: codeItem.path.replace(`${versionConfig.pageDir}/${pageId}/`, '');
|
|
271
|
+
const _pageId = !pageId ? 'global' : pageId;
|
|
272
|
+
const commonVal = {
|
|
273
|
+
code: codeItem.code,
|
|
274
|
+
type: 'CODE',
|
|
275
|
+
system: true,
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* 只处理 path 为 src/theme.less, src/style.less, src/lifecycle.js, src/common/xxx.js, src/pages/xxx/handler/xxx.js
|
|
279
|
+
* 其它视为无效文件忽略
|
|
280
|
+
*/
|
|
281
|
+
switch (relativePath) {
|
|
282
|
+
case 'theme.less':
|
|
283
|
+
calsJSON.resources.push(Object.assign({ name: 'theme', path: `${_pageId}/theme`, codeType: 'theme' }, commonVal));
|
|
284
|
+
break;
|
|
285
|
+
case 'style.less':
|
|
286
|
+
resources.push(Object.assign({ name: 'style', path: `${_pageId}/style`, codeType: 'style' }, commonVal));
|
|
287
|
+
break;
|
|
288
|
+
case 'lifecycle.js':
|
|
289
|
+
resources.push(Object.assign({ name: 'lifecycle', path: `${_pageId}/lifecycle`, codeType: 'lifecycle' }, commonVal));
|
|
290
|
+
break;
|
|
291
|
+
default:
|
|
292
|
+
// page handler
|
|
293
|
+
const handlerMatches = relativePath.match(/^handler\/([^/]*?).js$/);
|
|
294
|
+
if (handlerMatches) {
|
|
295
|
+
const [, name] = handlerMatches;
|
|
296
|
+
resources.push(Object.assign(Object.assign({ name, path: `${_pageId}/handler/${name}`, codeType: 'handler-fn' }, commonVal), { system: false }));
|
|
297
|
+
}
|
|
298
|
+
// globa common
|
|
299
|
+
const commonMatches = relativePath.match(/^common\/([^/]*?).js$/);
|
|
300
|
+
if (commonMatches) {
|
|
301
|
+
const [, name] = commonMatches;
|
|
302
|
+
calsJSON.resources.push(Object.assign({ name, path: `${_pageId}/common/${name}`, codeType: 'normal-module' }, commonVal));
|
|
303
|
+
}
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
function isPageFile(filePath) {
|
|
308
|
+
return pagePaths.map((pagePath) => `src/${pagePath}`).some((pagePath) => filePath.indexOf(pagePath) === 0);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
exports.codeToCals = codeToCals;
|
|
312
|
+
/**
|
|
313
|
+
* 指定目录下的文件转代码
|
|
314
|
+
*/
|
|
315
|
+
function fileToCode(dirPath, onlyPath = false) {
|
|
316
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
317
|
+
const result = yield new Promise((resolve, reject) => {
|
|
318
|
+
// 只包含 js, json, less 文件,其它忽略(因为不属于 weda 的文件)
|
|
319
|
+
(0, glob_1.default)(path_1.default.resolve(dirPath, '**', '*.@(js|json|less)'), {}, function (err, files) {
|
|
320
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
321
|
+
if (err)
|
|
322
|
+
reject(err);
|
|
323
|
+
else {
|
|
324
|
+
const codeList = yield Promise.all(files.map((filePath) => __awaiter(this, void 0, void 0, function* () {
|
|
325
|
+
const codePath = path_1.default.relative(dirPath, filePath);
|
|
326
|
+
const codeContent = onlyPath ? '' : yield fs_extra_1.default.readFile(filePath, 'utf8');
|
|
327
|
+
return {
|
|
328
|
+
path: codePath,
|
|
329
|
+
code: codeContent,
|
|
330
|
+
};
|
|
331
|
+
})));
|
|
332
|
+
resolve(codeList);
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
return result;
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
exports.fileToCode = fileToCode;
|
|
341
|
+
/**
|
|
342
|
+
* 指定代码内容是否存在冲突未解决
|
|
343
|
+
*/
|
|
344
|
+
function checkForConflicts(code) {
|
|
345
|
+
return findAllConflicts(code, true).length > 0;
|
|
346
|
+
}
|
|
347
|
+
exports.checkForConflicts = checkForConflicts;
|
|
348
|
+
/**
|
|
349
|
+
* 以 from 为准自动解决冲突
|
|
350
|
+
*/
|
|
351
|
+
function autoResolveConflicts(code, from) {
|
|
352
|
+
const allConflicts = findAllConflicts(code);
|
|
353
|
+
const lines = code.split('\n');
|
|
354
|
+
const result = [];
|
|
355
|
+
const removeLines = [];
|
|
356
|
+
allConflicts.forEach((conflictItem) => {
|
|
357
|
+
if (from === 'theirs') {
|
|
358
|
+
// 删除上面的
|
|
359
|
+
removeLines.push([conflictItem.start, conflictItem.middle], conflictItem.end);
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
// default is ours
|
|
363
|
+
// 删除下面的
|
|
364
|
+
removeLines.push(conflictItem.start, [conflictItem.middle, conflictItem.end]);
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
lines.forEach((line, idx) => {
|
|
368
|
+
const matched = removeLines.some((rmIdx) => {
|
|
369
|
+
if (Array.isArray(rmIdx)) {
|
|
370
|
+
return idx >= rmIdx[0] && idx <= rmIdx[1];
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
return idx === rmIdx;
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
if (!matched)
|
|
377
|
+
result.push(line);
|
|
378
|
+
});
|
|
379
|
+
return result.join('\n');
|
|
380
|
+
}
|
|
381
|
+
exports.autoResolveConflicts = autoResolveConflicts;
|
|
382
|
+
function findAllConflicts(code, onlyFindFirstOne = false) {
|
|
383
|
+
let allConflicts = [];
|
|
384
|
+
const lines = code.split('\n');
|
|
385
|
+
let oneConflict = { start: -1, middle: -1, end: -1 };
|
|
386
|
+
for (let i = 0, leng = lines.length; i < leng; i++) {
|
|
387
|
+
const line = lines[i];
|
|
388
|
+
if (/^<<<<<<<$/.test(line)) {
|
|
389
|
+
if (oneConflict.start === -1) {
|
|
390
|
+
// 起点
|
|
391
|
+
oneConflict.start = i;
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
// 非起点:一个完整的冲突还未结束,出现起点符号,下边的内容冲突全部无效
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
else if (/^=======$/.test(line)) {
|
|
399
|
+
if (oneConflict.start !== -1) {
|
|
400
|
+
// 有 <<<<<<< 起点符号
|
|
401
|
+
if (oneConflict.middle === -1) {
|
|
402
|
+
// 未有 ======= 中间符号
|
|
403
|
+
oneConflict.middle = i;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
else if (/^>>>>>>>$/.test(line)) {
|
|
408
|
+
if (oneConflict.start !== -1 && oneConflict.middle !== -1) {
|
|
409
|
+
oneConflict.end = i;
|
|
410
|
+
allConflicts.push(oneConflict);
|
|
411
|
+
// 重置
|
|
412
|
+
oneConflict = { start: -1, middle: -1, end: -1 };
|
|
413
|
+
if (onlyFindFirstOne)
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return allConflicts;
|
|
419
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../parser/cals/utils/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA2B,MAAM,kBAAkB,CAAC;AAK1E,wBAAgB,cAAc,CAC5B,UAAU,GAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAoB,EACpD,WAAW,GAAE,MAAM,EAAO,GACzB,MAAM,CAqDR;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../parser/cals/utils/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA2B,MAAM,kBAAkB,CAAC;AAK1E,wBAAgB,cAAc,CAC5B,UAAU,GAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAoB,EACpD,WAAW,GAAE,MAAM,EAAO,GACzB,MAAM,CAqDR;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,OAkCtC;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,CA4B1E;AAED,wBAAgB,aAAa,CAAC,iBAAiB,GAAE,GAAG,EAAO,OAiB1D;AAED,wBAAgB,cAAc,CAAC,SAAS,GAAE,GAAG,EAAO,SAenD;AAGD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAQ,EAAE,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,OAgExE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,QAKjE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,OAWvC"}
|
|
@@ -61,7 +61,7 @@ function readComponents(properties = {}, excludeKeys = []) {
|
|
|
61
61
|
}
|
|
62
62
|
exports.readComponents = readComponents;
|
|
63
63
|
function readDirectives(cmp) {
|
|
64
|
-
var _a
|
|
64
|
+
var _a;
|
|
65
65
|
const directives = {};
|
|
66
66
|
// 默认为 true,节省体积不记录
|
|
67
67
|
if (cmp.data && cmp.data._visible !== true) {
|
|
@@ -90,18 +90,13 @@ function readDirectives(cmp) {
|
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
if (directives.waFor && ((_b = cmp.data) === null || _b === void 0 ? void 0 : _b._waForKey)) {
|
|
94
|
-
directives.waForKey = {
|
|
95
|
-
value: cmp.data._waForKey,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
93
|
return directives;
|
|
99
94
|
}
|
|
100
95
|
exports.readDirectives = readDirectives;
|
|
101
96
|
function readDynamicData(cmp) {
|
|
102
97
|
var _a, _b;
|
|
103
98
|
const data = {};
|
|
104
|
-
const ignoredProps = ['_visible', '_waFor'
|
|
99
|
+
const ignoredProps = ['_visible', '_waFor'];
|
|
105
100
|
// Read data
|
|
106
101
|
for (const prop in cmp.data) {
|
|
107
102
|
if (ignoredProps.indexOf(prop) > -1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/spinoff/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EAMb,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/spinoff/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EAMb,MAAM,mBAAmB,CAAC;AAyH3B;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE;IACR,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,GACA,YAAY,CAqBd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../parser/cals/utils/style.ts"],"names":[],"mappings":"AAEA,wBAAgB,2BAA2B,
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../parser/cals/utils/style.ts"],"names":[],"mappings":"AAEA,wBAAgB,2BAA2B,CAAC,SAAS,GAAE,GAA2B,GAAG,GAAG,CAUvF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/version/common.ts"],"names":[],"mappings":"AAaA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,QAE1C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG,QAczC;AAGD,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,QAOtC;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/version/common.ts"],"names":[],"mappings":"AAaA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,QAE1C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG,QAczC;AAGD,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,QAOtC;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,QAe3C;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,GAAG,QAsFrD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,QA8C3C;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,QAwB3C;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,QAgB9C;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,GAAG,QAQpD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG,QAczC;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,UAAQ,QAiJ/E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,GAAG,QAsCvC"}
|
|
@@ -55,8 +55,7 @@ function translateListeners(comp) {
|
|
|
55
55
|
const { listeners = [] } = xProps;
|
|
56
56
|
listeners.forEach((listenerItem) => {
|
|
57
57
|
const { handler } = listenerItem;
|
|
58
|
-
if (listenerItem.trigger === 'click' ||
|
|
59
|
-
listenerItem.trigger === '__weapps_action_trigger_click') {
|
|
58
|
+
if (listenerItem.trigger === 'click' || listenerItem.trigger === '__weapps_action_trigger_click') {
|
|
60
59
|
listenerItem.trigger = 'tap';
|
|
61
60
|
}
|
|
62
61
|
if (handler.moduleName === 'gsd-kbone') {
|
|
@@ -211,8 +210,7 @@ function translateClassList(comp) {
|
|
|
211
210
|
}
|
|
212
211
|
if (xProps['classNameListBind']) {
|
|
213
212
|
// @ts-ignore
|
|
214
|
-
xProps['classListBind'] =
|
|
215
|
-
xProps['classListBind'] || xProps.classNameListBind;
|
|
213
|
+
xProps['classListBind'] = xProps['classListBind'] || xProps.classNameListBind;
|
|
216
214
|
// @ts-ignore
|
|
217
215
|
xProps.classListBind.value = xProps.classListBind.bindDataPath;
|
|
218
216
|
// @ts-ignore
|
|
@@ -355,8 +353,7 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
355
353
|
}
|
|
356
354
|
catch (e) { }
|
|
357
355
|
if (parent) {
|
|
358
|
-
if (!parent.xComponent ||
|
|
359
|
-
(parent.xComponent && parent.xComponent.name !== 'FormItem')) {
|
|
356
|
+
if (!parent.xComponent || (parent.xComponent && parent.xComponent.name !== 'FormItem')) {
|
|
360
357
|
// add FormItem
|
|
361
358
|
const newFormItemId = (0, utils_1.getId)();
|
|
362
359
|
// @ts-ignore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/version/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAyKH,eAAO,MAAM,sBAAsB,UAMlC,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/version/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAyKH,eAAO,MAAM,sBAAsB,UAMlC,CAAC;AAEF,eAAO,MAAM,mBAAmB,UAgB/B,CAAC;AAEF,eAAO,MAAM,2BAA2B,UAgDvC,CAAC;AAGF,eAAO,MAAM,mCAAmC,UAA8D,CAAC;AAG/G,eAAO,MAAM,4BAA4B,QAA6B,CAAC"}
|
|
@@ -239,11 +239,6 @@ exports.GSD_H5_REACT_COMPONENT_KEYS = [
|
|
|
239
239
|
'Wx-page-mate',
|
|
240
240
|
];
|
|
241
241
|
// 支持选区的组件白名单
|
|
242
|
-
exports.COMPONENT_SELECTABLEBLOCK_WHITELIST = [
|
|
243
|
-
'modeltable',
|
|
244
|
-
'modelcreate',
|
|
245
|
-
'modelupdate',
|
|
246
|
-
'modeldetail',
|
|
247
|
-
];
|
|
242
|
+
exports.COMPONENT_SELECTABLEBLOCK_WHITELIST = ['modeltable', 'modelcreate', 'modelupdate', 'modeldetail'];
|
|
248
243
|
// 支持选区的组件库命名正则表达式
|
|
249
244
|
exports.MODULE_SELECTABLEBLOCK_REGEX = /^cloudbase_bussiness.*$/i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/version/index.ts"],"names":[],"mappings":"AAOA,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/version/index.ts"],"names":[],"mappings":"AAOA,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,OAWzC;AAgCD,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAqBzD"}
|