@cloudbase/cals 1.0.43-alpha.2 → 1.0.43
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 +19 -0
- package/lib/parser/cals/index.d.ts.map +1 -1
- package/lib/parser/cals/index.js +78 -23
- package/lib/parser/cals/utils/code/index.d.ts +5 -0
- package/lib/parser/cals/utils/code/index.d.ts.map +1 -1
- package/lib/parser/cals/utils/code/index.js +4 -3
- package/lib/parser/cals/utils/common.d.ts +6 -2
- package/lib/parser/cals/utils/common.d.ts.map +1 -1
- package/lib/parser/cals/utils/common.js +118 -44
- package/lib/parser/index.d.ts +1 -1
- package/lib/parser/index.d.ts.map +1 -1
- package/lib/parser/index.js +2 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +1 -0
- package/lib/types/lcds.d.ts +49 -1
- package/lib/types/lcds.d.ts.map +1 -1
- package/lib/types/lcds.js +23 -0
- package/lib/types/platform/app.d.ts +7 -0
- package/lib/types/platform/app.d.ts.map +1 -1
- package/lib/types/platform/common.d.ts +6 -0
- package/lib/types/platform/common.d.ts.map +1 -1
- package/lib/types/platform/theme.d.ts +45 -0
- package/lib/types/platform/theme.d.ts.map +1 -0
- package/lib/types/platform/theme.js +2 -0
- package/lib/utils/dts/auto-generated.d.ts +1 -1
- package/lib/utils/dts/auto-generated.d.ts.map +1 -1
- package/lib/utils/dts/auto-generated.js +0 -6
- package/lib/utils/dts/index.d.ts +0 -3
- package/lib/utils/dts/index.d.ts.map +1 -1
- package/lib/utils/dts/index.js +2 -55
- package/package.json +5 -3
- package/lib/utils/version-migrations/common.d.ts +0 -5
- package/lib/utils/version-migrations/common.d.ts.map +0 -1
- package/lib/utils/version-migrations/common.js +0 -29
- package/lib/utils/version-migrations/version4.d.ts +0 -3
- package/lib/utils/version-migrations/version4.d.ts.map +0 -1
- package/lib/utils/version-migrations/version4.js +0 -199
|
@@ -3,6 +3,7 @@ import { IAttributes, IPlatformApp, IPageComponent, IPlatformComponent, IDataSou
|
|
|
3
3
|
IPlatformDataSource, IDependencies, LCDS } from '../../types';
|
|
4
4
|
import { IDynamicValue, PropBindType } from '../expression';
|
|
5
5
|
import { IEventFlow } from '../../types/platform/eventFlow';
|
|
6
|
+
import { IHandler } from '../../utils';
|
|
6
7
|
export { getUsedComps } from './utils/common';
|
|
7
8
|
export { generateDefaultCode } from './utils/template';
|
|
8
9
|
interface IDeserializeContext {
|
|
@@ -194,10 +195,14 @@ export declare function deserializePage(ctx: {
|
|
|
194
195
|
handler: {
|
|
195
196
|
name: string;
|
|
196
197
|
moduleName: string;
|
|
198
|
+
code: string;
|
|
197
199
|
};
|
|
198
200
|
data: {
|
|
199
201
|
[key: string]: IDynamicValue;
|
|
200
202
|
};
|
|
203
|
+
args: {
|
|
204
|
+
[key: string]: IDynamicValue;
|
|
205
|
+
};
|
|
201
206
|
isCapturePhase: boolean;
|
|
202
207
|
noPropagation: boolean;
|
|
203
208
|
}[];
|
|
@@ -209,10 +214,14 @@ export declare function deserializePage(ctx: {
|
|
|
209
214
|
handler: {
|
|
210
215
|
name: string;
|
|
211
216
|
moduleName: string;
|
|
217
|
+
code: string;
|
|
212
218
|
};
|
|
213
219
|
data: {
|
|
214
220
|
[key: string]: IDynamicValue;
|
|
215
221
|
};
|
|
222
|
+
args: {
|
|
223
|
+
[key: string]: IDynamicValue;
|
|
224
|
+
};
|
|
216
225
|
isCapturePhase: boolean;
|
|
217
226
|
noPropagation: boolean;
|
|
218
227
|
}[];
|
|
@@ -258,6 +267,7 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
258
267
|
description: string;
|
|
259
268
|
selectedPageId: string;
|
|
260
269
|
historyType: any;
|
|
270
|
+
theme: import("../../types").ITheme;
|
|
261
271
|
pageInstanceList: {
|
|
262
272
|
isHome: boolean;
|
|
263
273
|
vars: {
|
|
@@ -284,10 +294,14 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
284
294
|
handler: {
|
|
285
295
|
name: string;
|
|
286
296
|
moduleName: string;
|
|
297
|
+
code: string;
|
|
287
298
|
};
|
|
288
299
|
data: {
|
|
289
300
|
[key: string]: IDynamicValue;
|
|
290
301
|
};
|
|
302
|
+
args: {
|
|
303
|
+
[key: string]: IDynamicValue;
|
|
304
|
+
};
|
|
291
305
|
isCapturePhase: boolean;
|
|
292
306
|
noPropagation: boolean;
|
|
293
307
|
}[];
|
|
@@ -299,10 +313,14 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
299
313
|
handler: {
|
|
300
314
|
name: string;
|
|
301
315
|
moduleName: string;
|
|
316
|
+
code: string;
|
|
302
317
|
};
|
|
303
318
|
data: {
|
|
304
319
|
[key: string]: IDynamicValue;
|
|
305
320
|
};
|
|
321
|
+
args: {
|
|
322
|
+
[key: string]: IDynamicValue;
|
|
323
|
+
};
|
|
306
324
|
isCapturePhase: boolean;
|
|
307
325
|
noPropagation: boolean;
|
|
308
326
|
}[];
|
|
@@ -477,4 +495,5 @@ export declare function processTemplatesToDependiencies(templates?: any[]): {
|
|
|
477
495
|
isComposite: boolean;
|
|
478
496
|
schemaVersion: string;
|
|
479
497
|
};
|
|
498
|
+
export declare function generateHandlerParamsDynamicMap(handler: IHandler): any;
|
|
480
499
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/cals/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAuC,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEvH,OAAO,EACL,WAAW,EACX,YAAY,EAGZ,cAAc,EACd,kBAAkB,EAElB,mBAAmB,EACnB,cAAc,EAAE,cAAc;AAC9B,mBAAmB,EACnB,aAAa,EACb,IAAI,EAEL,MAAM,aAAa,CAAC;AAErB,OAAO,EAAkC,aAAa,EAAE,YAAY,EAA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MAAM,UAWvD;AAED,wBAAgB,+BAA+B,CAAC,SAAS,QAAK;;;;;;;;;;;;;;;;;QA4BtD;;;WAGG;;;;;;;EAcV;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,QAAQ,OAchE"}
|
package/lib/parser/cals/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.processTemplatesToDependiencies = exports.parseDependenciesVersion = exports.processDependenciesVersionMap = exports.processListeners = exports.parseVersion = exports.processRuntimeCodeResources = exports.deserializeComponentLibraryMeta = exports.deserializeRuntimeComponent = exports.serializeRuntimeComponent = exports.serializeRuntimeDataset = exports.serializeRuntimePage = exports.deserializeCompositeComponent = exports.deserializePlatformApp = exports.serializePlatformApp = exports.deserializePage = exports.serializeLayouts = exports.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.normalizeQuery = exports.deserializeDataset = exports.deserializeTemplates = exports.serializeDataset = exports.deserializeAttributes = exports.serializeAttributes = exports.deserializeDynamicMap = exports.serializeDynamicMap = exports.deserializeValue = exports.serializeValue = exports.generateDefaultCode = exports.getUsedComps = void 0;
|
|
17
|
+
exports.generateHandlerParamsDynamicMap = exports.processTemplatesToDependiencies = exports.parseDependenciesVersion = exports.processDependenciesVersionMap = exports.processListeners = exports.parseVersion = exports.processRuntimeCodeResources = exports.deserializeComponentLibraryMeta = exports.deserializeRuntimeComponent = exports.serializeRuntimeComponent = exports.serializeRuntimeDataset = exports.serializeRuntimePage = exports.deserializeCompositeComponent = exports.deserializePlatformApp = exports.serializePlatformApp = exports.deserializePage = exports.serializeLayouts = exports.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.normalizeQuery = exports.deserializeDataset = exports.deserializeTemplates = exports.serializeDataset = exports.deserializeAttributes = exports.serializeAttributes = exports.deserializeDynamicMap = exports.serializeDynamicMap = exports.deserializeValue = exports.serializeValue = exports.generateDefaultCode = exports.getUsedComps = void 0;
|
|
18
18
|
const get_1 = __importDefault(require("lodash/get"));
|
|
19
19
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
20
20
|
const unset_1 = __importDefault(require("lodash/unset"));
|
|
@@ -180,7 +180,7 @@ function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlin
|
|
|
180
180
|
scope,
|
|
181
181
|
streamlineDefaultValue,
|
|
182
182
|
});
|
|
183
|
-
let matched = processedKey.match(
|
|
183
|
+
let matched = processedKey.match(DYNAMIC_KEY_REG);
|
|
184
184
|
let originKey = processedKey;
|
|
185
185
|
if (matched) {
|
|
186
186
|
originKey = matched[1];
|
|
@@ -208,7 +208,7 @@ function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlin
|
|
|
208
208
|
return _value;
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
|
-
// 为动态数据且有多级,将{":range.0.label": "$page.dataset.state.test1"}转为{ range: [{ label: "$page.dataset.state.test1"}] }
|
|
211
|
+
// 为动态数据且有多级,将{":range.0.label": "$page.dataset.state.test1"}转为{ range: [{ ":label": "$page.dataset.state.test1"}] }
|
|
212
212
|
if (matched && originKeyArr.length >= 2) {
|
|
213
213
|
(0, set_1.default)(data, replaceWithColon(originKey), (0, cloneDeep_1.default)(processedValue));
|
|
214
214
|
}
|
|
@@ -364,8 +364,8 @@ function serializeDataset(ctx, dataset) {
|
|
|
364
364
|
}
|
|
365
365
|
});
|
|
366
366
|
Object.entries(result.query || {}).forEach(([key, query]) => {
|
|
367
|
-
var _a, _b, _c;
|
|
368
|
-
let { dataSourceName, method, listeners, handler, data } = query, restQuery = __rest(query, ["dataSourceName", "method", "listeners", "handler", "data"]);
|
|
367
|
+
var _a, _b, _c, _d, _e;
|
|
368
|
+
let { dataSourceName, method, listeners, handler, data, args } = query, restQuery = __rest(query, ["dataSourceName", "method", "listeners", "handler", "data", "args"]);
|
|
369
369
|
let mergedData = (_a = serializeDynamicMapWithExtra({
|
|
370
370
|
ctx,
|
|
371
371
|
map: data || {},
|
|
@@ -384,11 +384,22 @@ function serializeDataset(ctx, dataset) {
|
|
|
384
384
|
})) === null || _b === void 0 ? void 0 : _b.data,
|
|
385
385
|
};
|
|
386
386
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
387
|
+
const argsData = (_c = serializeDynamicMapWithExtra({
|
|
388
|
+
ctx,
|
|
389
|
+
map: args.args || {},
|
|
390
|
+
})) === null || _c === void 0 ? void 0 : _c.data;
|
|
391
|
+
let processedHandler = {
|
|
392
|
+
module: handler === null || handler === void 0 ? void 0 : handler.moduleName,
|
|
393
|
+
name: handler === null || handler === void 0 ? void 0 : handler.name,
|
|
394
|
+
code: handler === null || handler === void 0 ? void 0 : handler.code,
|
|
395
|
+
};
|
|
396
|
+
if (((_d = argsData.params) === null || _d === void 0 ? void 0 : _d.length) === 1 && Object.keys(argsData).length === 1 && data) {
|
|
397
|
+
processedHandler.params = data;
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
processedHandler = Object.assign(Object.assign({}, argsData), processedHandler);
|
|
401
|
+
}
|
|
402
|
+
result.query[key] = Object.assign(Object.assign({}, restQuery), { handler: processedHandler, listeners: (_e = listeners === null || listeners === void 0 ? void 0 : listeners.map) === null || _e === void 0 ? void 0 : _e.call(listeners, (listener) => serializeListener(ctx, listener)) });
|
|
392
403
|
});
|
|
393
404
|
return result;
|
|
394
405
|
}
|
|
@@ -439,12 +450,14 @@ function deserializeDataset(ctx, dataset) {
|
|
|
439
450
|
}
|
|
440
451
|
});
|
|
441
452
|
Object.entries(result.query || {}).forEach(([key, query]) => {
|
|
442
|
-
var _a;
|
|
443
|
-
const
|
|
453
|
+
var _a, _b;
|
|
454
|
+
const _c = normalizeQuery(query), { handler, listeners } = _c, restQuery = __rest(_c, ["handler", "listeners"]);
|
|
455
|
+
let paramsDynamicMap = generateHandlerParamsDynamicMap(handler);
|
|
444
456
|
result.query[key] = Object.assign(Object.assign({}, restQuery), { handler: {
|
|
445
457
|
moduleName: handler === null || handler === void 0 ? void 0 : handler.module,
|
|
446
458
|
name: (handler === null || handler === void 0 ? void 0 : handler.name) || '',
|
|
447
|
-
|
|
459
|
+
code: handler === null || handler === void 0 ? void 0 : handler.code,
|
|
460
|
+
}, data: deserializeDynamicMap(ctx, ((_a = paramsDynamicMap.params) === null || _a === void 0 ? void 0 : _a[0]) || {}), args: deserializeDynamicMap(ctx, paramsDynamicMap), listeners: (_b = listeners === null || listeners === void 0 ? void 0 : listeners.map) === null || _b === void 0 ? void 0 : _b.call(listeners, (listener) => {
|
|
448
461
|
return deserializeListener(ctx, listener);
|
|
449
462
|
}) });
|
|
450
463
|
});
|
|
@@ -546,10 +559,15 @@ function deserializeDirecties(ctx, directives) {
|
|
|
546
559
|
* heander 更新为表达式
|
|
547
560
|
*/
|
|
548
561
|
function serializeListener(ctx, listener) {
|
|
562
|
+
var _a;
|
|
549
563
|
const { data, extra = {} } = serializeDynamicMapWithExtra({
|
|
550
564
|
ctx,
|
|
551
565
|
map: listener.data,
|
|
552
566
|
}) || {};
|
|
567
|
+
const { data: args, extra: argsExtra = {} } = serializeDynamicMapWithExtra({
|
|
568
|
+
ctx,
|
|
569
|
+
map: listener.args || {},
|
|
570
|
+
}) || {};
|
|
553
571
|
const platfromListener = {
|
|
554
572
|
id: listener.key,
|
|
555
573
|
eventName: listener.trigger,
|
|
@@ -557,29 +575,50 @@ function serializeListener(ctx, listener) {
|
|
|
557
575
|
handler: {
|
|
558
576
|
name: listener.handler.name,
|
|
559
577
|
module: /^comp-\w+$/.test(listener.handler.moduleName) ? '$comp' : listener.handler.moduleName,
|
|
560
|
-
|
|
578
|
+
code: listener.handler.code,
|
|
561
579
|
},
|
|
562
580
|
isCapturePhase: listener.isCapturePhase,
|
|
563
581
|
};
|
|
564
|
-
if (Object.keys(
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
platfromListener.
|
|
582
|
+
if (((_a = args.params) === null || _a === void 0 ? void 0 : _a.length) === 1 && Object.keys(args).length === 1 && data) {
|
|
583
|
+
platfromListener.handler.params = data;
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
platfromListener.handler = Object.assign(Object.assign({}, args), platfromListener.handler);
|
|
569
587
|
}
|
|
588
|
+
Object.entries({
|
|
589
|
+
handlerParamExtraData: extra,
|
|
590
|
+
handlerAragsExtraData: argsExtra,
|
|
591
|
+
}).forEach(([key, value]) => {
|
|
592
|
+
if (Object.keys(value).some((k) => extra[k] !== undefined)) {
|
|
593
|
+
if (!platfromListener.extra) {
|
|
594
|
+
platfromListener.extra = {};
|
|
595
|
+
}
|
|
596
|
+
platfromListener.extra[key] = value;
|
|
597
|
+
}
|
|
598
|
+
});
|
|
570
599
|
return platfromListener;
|
|
571
600
|
}
|
|
572
601
|
function deserializeListener(ctx, listener) {
|
|
573
|
-
var _a, _b, _c, _d;
|
|
602
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
603
|
+
let paramsDynamicMap = generateHandlerParamsDynamicMap(listener.handler);
|
|
604
|
+
let argsExtra = (_a = listener === null || listener === void 0 ? void 0 : listener.extra) === null || _a === void 0 ? void 0 : _a.handlerAragsExtraData;
|
|
605
|
+
if (!argsExtra && ((_b = listener === null || listener === void 0 ? void 0 : listener.extra) === null || _b === void 0 ? void 0 : _b.handlerAragsExtraData)) {
|
|
606
|
+
argsExtra = Object.entries((_c = listener === null || listener === void 0 ? void 0 : listener.extra) === null || _c === void 0 ? void 0 : _c.handlerAragsExtraData).reduce((map, [key, value]) => {
|
|
607
|
+
map[`params.0.${key}`] = value;
|
|
608
|
+
return map;
|
|
609
|
+
}, {});
|
|
610
|
+
}
|
|
574
611
|
let processed = {
|
|
575
612
|
key: listener.id,
|
|
576
613
|
trigger: listener.eventName,
|
|
577
614
|
type: listener.type,
|
|
578
615
|
handler: {
|
|
579
|
-
name: (
|
|
580
|
-
moduleName: (
|
|
616
|
+
name: (_d = listener.handler) === null || _d === void 0 ? void 0 : _d.name,
|
|
617
|
+
moduleName: (_e = listener.handler) === null || _e === void 0 ? void 0 : _e.module,
|
|
618
|
+
code: (_f = listener.handler) === null || _f === void 0 ? void 0 : _f.code,
|
|
581
619
|
},
|
|
582
|
-
data: deserializeDynamicMap(ctx, ((
|
|
620
|
+
data: deserializeDynamicMap(ctx, ((_g = paramsDynamicMap.params) === null || _g === void 0 ? void 0 : _g[0]) || {}, ((_h = listener === null || listener === void 0 ? void 0 : listener.extra) === null || _h === void 0 ? void 0 : _h.handlerParamExtraData) || {}),
|
|
621
|
+
args: deserializeDynamicMap(ctx, paramsDynamicMap, argsExtra),
|
|
583
622
|
isCapturePhase: !!listener.isCapturePhase,
|
|
584
623
|
// TODO
|
|
585
624
|
noPropagation: !!listener.noPropagation,
|
|
@@ -901,6 +940,7 @@ function serializePlatformApp(data, optsions) {
|
|
|
901
940
|
dataVariables: (0, runtime_1.getValidValue)(vars === null || vars === void 0 ? void 0 : vars.data.map((item) => serializeDataVariables(ctx, item))),
|
|
902
941
|
dependencies: calsDependencies,
|
|
903
942
|
templates: serializeLayouts(ctx, layouts),
|
|
943
|
+
theme: data.theme,
|
|
904
944
|
extra: Object.assign(Object.assign(Object.assign({}, restExtra), restData), { miniprogramPlugins, historyType: data.historyType, npmDependencies: data.npmDependencies || {}, plugins: data.plugins, maxID: data.maxID, rootPath: data.rootPath, themeVars: data.themeVars, presetColors: data.presetColors, appConfig: data.appConfig, lastDependencies }),
|
|
905
945
|
};
|
|
906
946
|
return processed;
|
|
@@ -931,6 +971,7 @@ function deserializePlatformApp(data, optsions) {
|
|
|
931
971
|
description: data.description,
|
|
932
972
|
selectedPageId: homePageId,
|
|
933
973
|
historyType,
|
|
974
|
+
theme: data.theme,
|
|
934
975
|
pageInstanceList: (data.items || []).map((page) => deserializePage(ctx, page)),
|
|
935
976
|
// lowCodes: data.resources || [],
|
|
936
977
|
lowCodes: (data.resources || [])
|
|
@@ -1392,3 +1433,17 @@ function processTemplatesToDependiencies(templates = []) {
|
|
|
1392
1433
|
};
|
|
1393
1434
|
}
|
|
1394
1435
|
exports.processTemplatesToDependiencies = processTemplatesToDependiencies;
|
|
1436
|
+
function generateHandlerParamsDynamicMap(handler) {
|
|
1437
|
+
const isArguments = !(handler === null || handler === void 0 ? void 0 : handler.params) || Array.isArray(handler === null || handler === void 0 ? void 0 : handler.params);
|
|
1438
|
+
let handerParam = {
|
|
1439
|
+
params: isArguments ? (handler === null || handler === void 0 ? void 0 : handler.params) || [] : [handler === null || handler === void 0 ? void 0 : handler.params],
|
|
1440
|
+
};
|
|
1441
|
+
Object.entries(handler || {}).forEach(([key, value]) => {
|
|
1442
|
+
if (/^:params\./.test(key) || key === ':params') {
|
|
1443
|
+
const processedKey = isArguments ? key : key.replace(/^:params/, ':params.0');
|
|
1444
|
+
handerParam[processedKey] = value;
|
|
1445
|
+
}
|
|
1446
|
+
});
|
|
1447
|
+
return handerParam;
|
|
1448
|
+
}
|
|
1449
|
+
exports.generateHandlerParamsDynamicMap = generateHandlerParamsDynamicMap;
|
|
@@ -28,4 +28,9 @@ export declare function checkForConflicts(code: string): boolean;
|
|
|
28
28
|
* 以 from 为准自动解决冲突
|
|
29
29
|
*/
|
|
30
30
|
export declare function autoResolveConflicts(code: string, from: 'theirs' | 'ours'): string;
|
|
31
|
+
export declare function findAllConflicts(code: string, onlyFindFirstOne?: boolean): {
|
|
32
|
+
start: number;
|
|
33
|
+
middle: number;
|
|
34
|
+
end: number;
|
|
35
|
+
}[];
|
|
31
36
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,EAAsE,MAAM,mBA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AM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CA6BlF;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,gBAAgB,GAAE,OAAe,GAChC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,CAoClD"}
|
|
@@ -7,7 +7,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.autoResolveConflicts = exports.checkForConflicts = exports.codeToCals = exports.calsToCode = void 0;
|
|
10
|
+
exports.findAllConflicts = exports.autoResolveConflicts = exports.checkForConflicts = exports.codeToCals = exports.calsToCode = void 0;
|
|
11
11
|
const types_1 = require("../../../../types");
|
|
12
12
|
const pick_1 = __importDefault(require("lodash/pick"));
|
|
13
13
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
@@ -357,7 +357,7 @@ function findAllConflicts(code, onlyFindFirstOne = false) {
|
|
|
357
357
|
let oneConflict = { start: -1, middle: -1, end: -1 };
|
|
358
358
|
for (let i = 0, leng = lines.length; i < leng; i++) {
|
|
359
359
|
const line = lines[i];
|
|
360
|
-
if (
|
|
360
|
+
if (/^<<<<<<<.*/.test(line)) {
|
|
361
361
|
if (oneConflict.start === -1) {
|
|
362
362
|
// 起点
|
|
363
363
|
oneConflict.start = i;
|
|
@@ -376,7 +376,7 @@ function findAllConflicts(code, onlyFindFirstOne = false) {
|
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
else if (
|
|
379
|
+
else if (/^>>>>>>>.*/.test(line)) {
|
|
380
380
|
if (oneConflict.start !== -1 && oneConflict.middle !== -1) {
|
|
381
381
|
oneConflict.end = i;
|
|
382
382
|
allConflicts.push(oneConflict);
|
|
@@ -389,3 +389,4 @@ function findAllConflicts(code, onlyFindFirstOne = false) {
|
|
|
389
389
|
}
|
|
390
390
|
return allConflicts;
|
|
391
391
|
}
|
|
392
|
+
exports.findAllConflicts = findAllConflicts;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IPlatformApp } from '../../../types';
|
|
2
2
|
import { IDataBind } from '../../expression/index';
|
|
3
|
-
declare type
|
|
3
|
+
declare type IUsedComponentResources = {
|
|
4
4
|
[libName: string]: Set<string>;
|
|
5
5
|
};
|
|
6
6
|
export declare function camelcase(str: string, firstUpperCase?: boolean): string;
|
|
@@ -9,10 +9,14 @@ export declare const isEmptyObj: (obj: object) => boolean;
|
|
|
9
9
|
export declare function isValidStyleBind(styleBind: IDataBind): boolean;
|
|
10
10
|
export declare function isValidClassNameListBind(classNameListBind: IDataBind): boolean;
|
|
11
11
|
export declare function getUsedComps(apps: IPlatformApp[], dependencies: any[], options?: {
|
|
12
|
+
withAction?: boolean;
|
|
12
13
|
/**
|
|
13
14
|
* templates 按需引入
|
|
14
15
|
*/
|
|
15
16
|
streamline: boolean;
|
|
16
|
-
}):
|
|
17
|
+
}): IUsedComponentResources | {
|
|
18
|
+
component: IUsedComponentResources;
|
|
19
|
+
action: Record<string, Set<string>>;
|
|
20
|
+
};
|
|
17
21
|
export {};
|
|
18
22
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/common.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAElF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAsBnD,aAAK,uBAAuB,GAAG;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAOlE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,UAAQ,UAQ5D;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,WAErC;AAED,eAAO,MAAM,UAAU,QAAS,MAAM,YAUrC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,WAQpD;AAED,wBAAgB,wBAAwB,CAAC,iBAAiB,EAAE,SAAS,WAQpE;AAyJD,wBAAgB,YAAY,CAE1B,IAAI,EAAE,YAAY,EAAE,EAEpB,YAAY,EAAE,GAAG,EAAE,EACnB,OAAO,CAAC,EAAE;IACR,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB,GACA,uBAAuB,GAAG;IAAE,SAAS,EAAE,uBAAuB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,CA+EvG"}
|
|
@@ -49,20 +49,45 @@ function isValidClassNameListBind(classNameListBind) {
|
|
|
49
49
|
}
|
|
50
50
|
exports.isValidClassNameListBind = isValidClassNameListBind;
|
|
51
51
|
// 递归查询属性树所使用的组件
|
|
52
|
-
function getUsedCompsFromProperties(properties,
|
|
52
|
+
function getUsedCompsFromProperties(properties, usedMeta) {
|
|
53
53
|
for (const id in properties) {
|
|
54
|
-
const { xComponent, properties: children } = properties[id];
|
|
54
|
+
const { xComponent, properties: children, xProps = {} } = properties[id];
|
|
55
55
|
if (xComponent) {
|
|
56
56
|
// 记录使用到的组件库和组件
|
|
57
57
|
const { moduleName: libName, name: compName } = xComponent;
|
|
58
|
-
if (!
|
|
59
|
-
|
|
58
|
+
if (!usedMeta.component[libName]) {
|
|
59
|
+
usedMeta.component[libName] = new Set();
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
usedMeta.component[libName].add(compName);
|
|
62
62
|
}
|
|
63
|
+
for (const listener of (xProps === null || xProps === void 0 ? void 0 : xProps.listeners) || []) {
|
|
64
|
+
if (listener.type === utils_1.ActionType.Material) {
|
|
65
|
+
const { moduleName, name } = listener.handler || {};
|
|
66
|
+
const libName = moduleName || utils_1.OFFICIAL_LIB_KEY;
|
|
67
|
+
if (!usedMeta.action[libName]) {
|
|
68
|
+
usedMeta.action[libName] = new Set();
|
|
69
|
+
}
|
|
70
|
+
usedMeta.action[libName].add(name);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* @deprecated
|
|
75
|
+
* generic-component 协议待定,并未启用
|
|
76
|
+
* Handle generic component props
|
|
77
|
+
*/
|
|
78
|
+
// Object.keys(xProps?.data || {}).map((p) => {
|
|
79
|
+
// const { value } = xProps.data?.[p] as any;
|
|
80
|
+
// if (/^\w+:\w+$/.test(value)) {
|
|
81
|
+
// const [libName, name] = value.split(':');
|
|
82
|
+
// if (!usedMeta.component[libName]) {
|
|
83
|
+
// usedMeta.component[libName] = new Set();
|
|
84
|
+
// }
|
|
85
|
+
// usedMeta.component[libName].add(name);
|
|
86
|
+
// }
|
|
87
|
+
// });
|
|
63
88
|
if (children) {
|
|
64
89
|
// 遍历下一层属性树
|
|
65
|
-
getUsedCompsFromProperties(children,
|
|
90
|
+
getUsedCompsFromProperties(children, usedMeta);
|
|
66
91
|
}
|
|
67
92
|
}
|
|
68
93
|
}
|
|
@@ -74,10 +99,40 @@ function getUsedCompsFromIPlatformComponent(comp, used, options) {
|
|
|
74
99
|
// 非 slot
|
|
75
100
|
if (comp.component) {
|
|
76
101
|
const module = comp.module || utils_1.OFFICIAL_LIB_KEY;
|
|
77
|
-
if (!used[module]) {
|
|
78
|
-
used[module] = new Set([]);
|
|
102
|
+
if (!used.component[module]) {
|
|
103
|
+
used.component[module] = new Set([]);
|
|
79
104
|
}
|
|
80
|
-
used[module].add(comp.component);
|
|
105
|
+
used.component[module].add(comp.component);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated
|
|
109
|
+
* generic-component 协议待定,并未启用
|
|
110
|
+
* Handle generic component props
|
|
111
|
+
*/
|
|
112
|
+
// Object.entries(comp.attributes || {}).forEach(([key, value]) => {
|
|
113
|
+
// if (/^\w+:\w+$/.test(value)) {
|
|
114
|
+
// const [module, name] = value.split(':');
|
|
115
|
+
// const libName = module || OFFICIAL_LIB_KEY;
|
|
116
|
+
// if (!used.component[libName]) {
|
|
117
|
+
// used.component[libName] = new Set<string>([]);
|
|
118
|
+
// }
|
|
119
|
+
// used.component[module].add(name);
|
|
120
|
+
// }
|
|
121
|
+
// });
|
|
122
|
+
if (options === null || options === void 0 ? void 0 : options.withAction) {
|
|
123
|
+
const { listeners = [] } = comp;
|
|
124
|
+
listeners.forEach((listener) => {
|
|
125
|
+
var _a, _b;
|
|
126
|
+
if (listener.type === utils_1.ActionType.Material) {
|
|
127
|
+
const module = listener.handler.module || utils_1.OFFICIAL_LIB_KEY;
|
|
128
|
+
if (!used.action[module]) {
|
|
129
|
+
used.action[module] = new Set([]);
|
|
130
|
+
}
|
|
131
|
+
if ((_a = listener.handler) === null || _a === void 0 ? void 0 : _a.name) {
|
|
132
|
+
used.action[module].add((_b = listener.handler) === null || _b === void 0 ? void 0 : _b.name);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
81
136
|
}
|
|
82
137
|
(_b = (_a = comp.items) === null || _a === void 0 ? void 0 : _a.forEach) === null || _b === void 0 ? void 0 : _b.call(_a, (item) => {
|
|
83
138
|
getUsedCompsFromIPlatformComponent(item, used, options);
|
|
@@ -86,22 +141,22 @@ function getUsedCompsFromIPlatformComponent(comp, used, options) {
|
|
|
86
141
|
// 递归查询复合组件库所使用的组件
|
|
87
142
|
function getUsedCompsFromCompositedLibsRecursively(
|
|
88
143
|
// 已知的被使用到的组件
|
|
89
|
-
|
|
144
|
+
usedMeta,
|
|
90
145
|
// 已知的被遍历过的组件
|
|
91
146
|
checkedComps,
|
|
92
147
|
// 全量复合组件库
|
|
93
148
|
compositedLibMap,
|
|
94
149
|
// 新增的被使用到的组件
|
|
95
|
-
|
|
150
|
+
addedUsedMeta) {
|
|
96
151
|
// 开始遍历已知的被使用到的组件库
|
|
97
|
-
Object.keys(
|
|
152
|
+
Object.keys(usedMeta.component).forEach((libName) => {
|
|
98
153
|
if (!compositedLibMap.has(libName)) {
|
|
99
154
|
// 不是复合组件库, 不需要继续遍历
|
|
100
155
|
return;
|
|
101
156
|
}
|
|
102
157
|
// 遍历复合组件库
|
|
103
158
|
const lib = compositedLibMap.get(libName);
|
|
104
|
-
const cmpNames =
|
|
159
|
+
const cmpNames = usedMeta.component[libName];
|
|
105
160
|
cmpNames.forEach((cmpName) => {
|
|
106
161
|
// 找到复合组件的内容
|
|
107
162
|
const cmp = lib.components.find((c) => c.name === cmpName);
|
|
@@ -116,20 +171,22 @@ addedUsedComps) {
|
|
|
116
171
|
}
|
|
117
172
|
// 该复合组件第一次入栈, 则需要记录并继续递归它的内容
|
|
118
173
|
checkedComps.push(cmp);
|
|
119
|
-
const
|
|
174
|
+
const usedMetaOfThisComp = { component: {}, action: {} };
|
|
120
175
|
// 和遍历应用内容一样, 遍历低码组件内容, 寻找出组件自身引用的所有组件
|
|
121
|
-
getUsedCompsFromProperties(cmp.componentInstances,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
176
|
+
getUsedCompsFromProperties(cmp.componentInstances, usedMetaOfThisComp);
|
|
177
|
+
['component', 'action'].forEach((type) => {
|
|
178
|
+
Object.keys(usedMetaOfThisComp[type]).forEach((libName) => {
|
|
179
|
+
// 开始记录新增的被使用的组件库
|
|
180
|
+
if (!addedUsedMeta[type][libName]) {
|
|
181
|
+
addedUsedMeta[type][libName] = usedMetaOfThisComp[type][libName];
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
usedMetaOfThisComp[type][libName].forEach((n) => addedUsedMeta[type][libName].add(n));
|
|
185
|
+
}
|
|
186
|
+
});
|
|
130
187
|
});
|
|
131
188
|
// 递归遍历
|
|
132
|
-
getUsedCompsFromCompositedLibsRecursively(
|
|
189
|
+
getUsedCompsFromCompositedLibsRecursively(usedMetaOfThisComp, checkedComps, compositedLibMap, addedUsedMeta);
|
|
133
190
|
});
|
|
134
191
|
});
|
|
135
192
|
}
|
|
@@ -139,38 +196,52 @@ function getUsedComps(
|
|
|
139
196
|
apps,
|
|
140
197
|
// 分库后的组件库 denpendienicy
|
|
141
198
|
dependencies, options) {
|
|
142
|
-
const { streamline = false } = options || {};
|
|
199
|
+
const { streamline = false, withAction = false } = options || {};
|
|
143
200
|
const { templates = [] } = (apps === null || apps === void 0 ? void 0 : apps[0]) || {};
|
|
144
|
-
const comps = streamline ? [...dependencies, (0, index_1.processTemplatesToDependiencies)(templates)] : dependencies;
|
|
201
|
+
const comps = streamline && templates.length ? [...dependencies, (0, index_1.processTemplatesToDependiencies)(templates)] : dependencies;
|
|
145
202
|
// 1. 寻找应用内容里用到的所有组件
|
|
146
203
|
// 1.1 寻找主子应用各自的内容里所用到的组件
|
|
147
204
|
const appUsedComps = apps.map((app) => {
|
|
148
205
|
var _a, _b, _c, _d;
|
|
149
|
-
const
|
|
206
|
+
const usedMeta = {
|
|
207
|
+
component: {},
|
|
208
|
+
action: {},
|
|
209
|
+
};
|
|
150
210
|
// 主子包模式下, 可能没有应用内容
|
|
151
211
|
(_b = (_a = app.items) === null || _a === void 0 ? void 0 : _a.forEach) === null || _b === void 0 ? void 0 : _b.call(_a, (page) => {
|
|
152
212
|
var _a, _b;
|
|
153
213
|
(_b = (_a = page === null || page === void 0 ? void 0 : page.items) === null || _a === void 0 ? void 0 : _a.forEach) === null || _b === void 0 ? void 0 : _b.call(_a, (comp) => {
|
|
154
|
-
getUsedCompsFromIPlatformComponent(comp,
|
|
214
|
+
getUsedCompsFromIPlatformComponent(comp, usedMeta, options);
|
|
155
215
|
});
|
|
156
216
|
});
|
|
157
217
|
if (!streamline) {
|
|
158
218
|
(_d = (_c = app.templates) === null || _c === void 0 ? void 0 : _c.forEach) === null || _d === void 0 ? void 0 : _d.call(_c, (template) => {
|
|
159
219
|
var _a;
|
|
160
220
|
(_a = template.items) === null || _a === void 0 ? void 0 : _a.forEach((comp) => {
|
|
161
|
-
getUsedCompsFromIPlatformComponent(comp,
|
|
221
|
+
getUsedCompsFromIPlatformComponent(comp, usedMeta, options);
|
|
162
222
|
});
|
|
163
223
|
});
|
|
164
224
|
}
|
|
165
|
-
return
|
|
225
|
+
return usedMeta;
|
|
166
226
|
});
|
|
167
227
|
// 1.2 合并主子包所有用到的组件
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
228
|
+
const mergeAppUsedMeta = appUsedComps.reduce((meta, item) => {
|
|
229
|
+
if (!meta.component) {
|
|
230
|
+
meta.component = {};
|
|
171
231
|
}
|
|
172
|
-
|
|
173
|
-
|
|
232
|
+
if (!meta.action) {
|
|
233
|
+
meta.action = {};
|
|
234
|
+
}
|
|
235
|
+
['component', 'action'].forEach((type) => {
|
|
236
|
+
Object.entries(item[type] || {}).forEach(([libName]) => {
|
|
237
|
+
meta[type][libName] = new Set([
|
|
238
|
+
...Array.from(item[type][libName]),
|
|
239
|
+
...Array.from(meta[type][libName] || []),
|
|
240
|
+
]);
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
return meta;
|
|
244
|
+
}, { component: {}, action: {} });
|
|
174
245
|
// 2. 寻找应用内容的复合组件里嵌套的其他组件(复合组件即低码组件)
|
|
175
246
|
// 2.1 过滤出复合组件库
|
|
176
247
|
const compositedLibMap = new Map();
|
|
@@ -180,15 +251,18 @@ dependencies, options) {
|
|
|
180
251
|
}
|
|
181
252
|
});
|
|
182
253
|
// 2.2 递归查询复合组件库所使用的组件
|
|
183
|
-
const
|
|
184
|
-
getUsedCompsFromCompositedLibsRecursively(
|
|
254
|
+
const libUsedMeta = { component: {}, action: {} };
|
|
255
|
+
getUsedCompsFromCompositedLibsRecursively(mergeAppUsedMeta, [], compositedLibMap, libUsedMeta);
|
|
185
256
|
// 3. 合并[应用内容用到的组件]和[复合组件库用到的组件]
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
257
|
+
const allMeta = { component: {}, action: {} };
|
|
258
|
+
['component', 'action'].forEach((type) => {
|
|
259
|
+
allMeta[type] = [mergeAppUsedMeta[type], libUsedMeta[type]].reduce((comps, item) => {
|
|
260
|
+
for (const libName in item) {
|
|
261
|
+
comps[libName] = new Set([...Array.from(item[libName]), ...Array.from(comps[libName] || [])]);
|
|
262
|
+
}
|
|
263
|
+
return comps;
|
|
264
|
+
}, {});
|
|
265
|
+
});
|
|
266
|
+
return withAction ? allMeta : allMeta.component;
|
|
193
267
|
}
|
|
194
268
|
exports.getUsedComps = getUsedComps;
|
package/lib/parser/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './cals/index';
|
|
2
2
|
export { upgrageToVersion2 } from './cals/utils/version';
|
|
3
3
|
export { processComponentModule } from './cals/utils/spinoff';
|
|
4
|
-
export { calsToCode, codeToCals, type ICodeItem, checkForConflicts, autoResolveConflicts } from './cals/utils/code';
|
|
4
|
+
export { calsToCode, codeToCals, type ICodeItem, checkForConflicts, autoResolveConflicts, findAllConflicts } from './cals/utils/code';
|
|
5
5
|
export { parseComponentCals } from './cals/utils/block';
|
|
6
6
|
export { ActionType, type IDataBind, PropBindType } from './expression/index';
|
|
7
7
|
export { processCommonStyle2CSSProperties, processCSSProperties2Rem, processCSSPropertiesUnit, } from './cals/utils/style';
|