@cloudbase/cals 1.0.25-alpha.0 → 1.0.25
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 +75 -31
- package/lib/parser/cals/index.d.ts.map +1 -1
- package/lib/parser/cals/index.js +81 -33
- package/lib/parser/cals/utils/block/index.d.ts +2 -2
- package/lib/parser/cals/utils/block/index.d.ts.map +1 -1
- package/lib/parser/cals/utils/common.d.ts +7 -1
- package/lib/parser/cals/utils/common.d.ts.map +1 -1
- package/lib/parser/cals/utils/common.js +37 -9
- package/lib/parser/cals/utils/getUsedResources.d.ts.map +1 -1
- package/lib/parser/cals/utils/getUsedResources.js +8 -4
- package/lib/parser/expression/index.d.ts.map +1 -1
- package/lib/parser/expression/index.js +0 -17
- package/lib/types/basic/component.d.ts +0 -5
- package/lib/types/basic/component.d.ts.map +1 -1
- package/lib/types/platform/app.d.ts +3 -1
- package/lib/types/platform/app.d.ts.map +1 -1
- package/lib/types/platform/component.d.ts +3 -11
- package/lib/types/platform/component.d.ts.map +1 -1
- 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 -4
- package/lib/utils/dts/index.d.ts +2 -4
- package/lib/utils/dts/index.d.ts.map +1 -1
- package/lib/utils/dts/index.js +0 -8
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IPlatformListener, IPlatformDataset } from '../../types/platform/common';
|
|
2
|
-
import { IAttributes, IPlatformApp,
|
|
2
|
+
import { IAttributes, IPlatformApp, IPageComponent, IPlatformComponent, IDataSourceVariable, IDataVarMethod, // 勿删,为了生成d.ts
|
|
3
3
|
IPlatformDataSource, IDependencies, LCDS } from '../../types';
|
|
4
4
|
import { IDynamicValue, PropBindType } from '../expression';
|
|
5
5
|
import { IEventFlow } from '../../types/platform/eventFlow';
|
|
@@ -41,7 +41,9 @@ export declare function serializeValue({ ctx, key, dynamicValue, scope, streamli
|
|
|
41
41
|
value: any;
|
|
42
42
|
extra?: any;
|
|
43
43
|
};
|
|
44
|
-
export declare function deserializeValue(ctx:
|
|
44
|
+
export declare function deserializeValue(ctx: {
|
|
45
|
+
page?: IDeserializeContext['page'];
|
|
46
|
+
}, key: string, value: any, extra?: any): {
|
|
45
47
|
key: string;
|
|
46
48
|
value: {
|
|
47
49
|
type: PropBindType;
|
|
@@ -86,7 +88,7 @@ export declare function serializeDataset(ctx: ISerializeContext, dataset: any):
|
|
|
86
88
|
*/
|
|
87
89
|
export declare function deserializeDataset(ctx: IDeserializeContext, dataset: IPlatformDataset): any;
|
|
88
90
|
export declare function normalizeQuery(query: any): any;
|
|
89
|
-
export declare function deserializeDataVariables(
|
|
91
|
+
export declare function deserializeDataVariables(_: any, data: IDataSourceVariable): {
|
|
90
92
|
title: string;
|
|
91
93
|
name: string;
|
|
92
94
|
varType: "datasource";
|
|
@@ -130,19 +132,16 @@ export declare function serializeComponent(ctx: ISerializeContext & ({
|
|
|
130
132
|
} & {
|
|
131
133
|
id: string;
|
|
132
134
|
label?: string;
|
|
133
|
-
}, scope?: 'page' | 'component'):
|
|
134
|
-
export declare function deserializeComponent(ctx: IDeserializeContext, components:
|
|
135
|
+
}, scope?: 'page' | 'component'): IPlatformComponent;
|
|
136
|
+
export declare function deserializeComponent(ctx: IDeserializeContext, components: IPlatformComponent[]): {
|
|
135
137
|
[key: string]: object;
|
|
136
138
|
};
|
|
137
139
|
export declare function serializePage(ctx: Pick<ISerializeContext, 'app' | 'dependencies' | 'dependenciesMap'>, page: any): IPageComponent;
|
|
138
140
|
export declare function deserializePage(ctx: {
|
|
139
|
-
app: Required<IDeserializeContext>['app'];
|
|
140
141
|
dependencies: IDeserializeContext['dependencies'];
|
|
141
142
|
homePageId: string;
|
|
142
143
|
}, page: IPageComponent): {
|
|
143
|
-
id: string;
|
|
144
144
|
isHome: boolean;
|
|
145
|
-
dataset: any;
|
|
146
145
|
vars: {
|
|
147
146
|
data: {
|
|
148
147
|
title: string;
|
|
@@ -157,19 +156,9 @@ export declare function deserializePage(ctx: {
|
|
|
157
156
|
data: {
|
|
158
157
|
[key: string]: IDynamicValue;
|
|
159
158
|
};
|
|
160
|
-
componentInstances: {
|
|
161
|
-
[key: string]: object;
|
|
162
|
-
};
|
|
163
159
|
commonStyle: object;
|
|
164
160
|
staticResourceAttribute: string[];
|
|
165
161
|
hideAdminPortalMenu: boolean;
|
|
166
|
-
lowCodes: {
|
|
167
|
-
type: string;
|
|
168
|
-
code: string;
|
|
169
|
-
description?: string;
|
|
170
|
-
path?: string;
|
|
171
|
-
name: string;
|
|
172
|
-
}[];
|
|
173
162
|
listeners: {
|
|
174
163
|
key: string;
|
|
175
164
|
trigger: string;
|
|
@@ -203,6 +192,18 @@ export declare function deserializePage(ctx: {
|
|
|
203
192
|
label?: string;
|
|
204
193
|
description?: string;
|
|
205
194
|
}[];
|
|
195
|
+
id: string;
|
|
196
|
+
dataset: any;
|
|
197
|
+
componentInstances: {
|
|
198
|
+
[key: string]: object;
|
|
199
|
+
};
|
|
200
|
+
lowCodes: {
|
|
201
|
+
type: string;
|
|
202
|
+
code: string;
|
|
203
|
+
description?: string;
|
|
204
|
+
path?: string;
|
|
205
|
+
name: string;
|
|
206
|
+
}[];
|
|
206
207
|
};
|
|
207
208
|
/**
|
|
208
209
|
* [WeApps协议] to [CALS协议]
|
|
@@ -229,9 +230,7 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
229
230
|
selectedPageId: string;
|
|
230
231
|
historyType: "HASH" | "BROWSER";
|
|
231
232
|
pageInstanceList: {
|
|
232
|
-
id: string;
|
|
233
233
|
isHome: boolean;
|
|
234
|
-
dataset: any;
|
|
235
234
|
vars: {
|
|
236
235
|
data: {
|
|
237
236
|
title: string;
|
|
@@ -246,19 +245,9 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
246
245
|
data: {
|
|
247
246
|
[key: string]: IDynamicValue;
|
|
248
247
|
};
|
|
249
|
-
componentInstances: {
|
|
250
|
-
[key: string]: object;
|
|
251
|
-
};
|
|
252
248
|
commonStyle: object;
|
|
253
249
|
staticResourceAttribute: string[];
|
|
254
250
|
hideAdminPortalMenu: boolean;
|
|
255
|
-
lowCodes: {
|
|
256
|
-
type: string;
|
|
257
|
-
code: string;
|
|
258
|
-
description?: string;
|
|
259
|
-
path?: string;
|
|
260
|
-
name: string;
|
|
261
|
-
}[];
|
|
262
251
|
listeners: {
|
|
263
252
|
key: string;
|
|
264
253
|
trigger: string;
|
|
@@ -292,6 +281,18 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
292
281
|
label?: string;
|
|
293
282
|
description?: string;
|
|
294
283
|
}[];
|
|
284
|
+
id: string;
|
|
285
|
+
dataset: any;
|
|
286
|
+
componentInstances: {
|
|
287
|
+
[key: string]: object;
|
|
288
|
+
};
|
|
289
|
+
lowCodes: {
|
|
290
|
+
type: string;
|
|
291
|
+
code: string;
|
|
292
|
+
description?: string;
|
|
293
|
+
path?: string;
|
|
294
|
+
name: string;
|
|
295
|
+
}[];
|
|
295
296
|
}[];
|
|
296
297
|
lowCodes: {
|
|
297
298
|
type: string;
|
|
@@ -356,6 +357,21 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
356
357
|
dependencies: IDependencies;
|
|
357
358
|
schemaVersion: string;
|
|
358
359
|
};
|
|
360
|
+
declare type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
|
|
361
|
+
export declare function deserializeCompositeComponent(component: ArrayElement<IPlatformApp['templates']>, options: any): {
|
|
362
|
+
id: string;
|
|
363
|
+
dataset: any;
|
|
364
|
+
componentInstances: {
|
|
365
|
+
[key: string]: object;
|
|
366
|
+
};
|
|
367
|
+
lowCodes: {
|
|
368
|
+
type: string;
|
|
369
|
+
code: string;
|
|
370
|
+
description?: string;
|
|
371
|
+
path?: string;
|
|
372
|
+
name: string;
|
|
373
|
+
}[];
|
|
374
|
+
};
|
|
359
375
|
/**
|
|
360
376
|
* page
|
|
361
377
|
* [formily] to [CALS]
|
|
@@ -370,7 +386,7 @@ export declare function serializeRuntimeComponent(ctx: ISerializeContext & {
|
|
|
370
386
|
page: Required<ISerializeContext>['page'];
|
|
371
387
|
}, component: any & {
|
|
372
388
|
id: string;
|
|
373
|
-
}):
|
|
389
|
+
}): IPlatformComponent;
|
|
374
390
|
/**
|
|
375
391
|
* component
|
|
376
392
|
* [CALS] to [formily]
|
|
@@ -431,4 +447,32 @@ export declare function processListeners(listeners: IPlatformListener[], options
|
|
|
431
447
|
};
|
|
432
448
|
export declare function processDependenciesVersionMap(dependencies?: IDependencies): {};
|
|
433
449
|
export declare function parseDependenciesVersion(version: string): string;
|
|
450
|
+
export declare function processTemplatesToDependiencies(templates?: any[]): {
|
|
451
|
+
name: string;
|
|
452
|
+
version: string;
|
|
453
|
+
srcZipUrl: string;
|
|
454
|
+
mpPkgUrl: string;
|
|
455
|
+
actions: any[];
|
|
456
|
+
components: {
|
|
457
|
+
id: any;
|
|
458
|
+
name: any;
|
|
459
|
+
materialName: string;
|
|
460
|
+
componentInstances: {
|
|
461
|
+
[key: string]: object;
|
|
462
|
+
};
|
|
463
|
+
compConfig: any;
|
|
464
|
+
dataForm: any;
|
|
465
|
+
emitEvents: any;
|
|
466
|
+
lowCodes: any[];
|
|
467
|
+
/**
|
|
468
|
+
* @TODO: 二者归一化
|
|
469
|
+
* lcds.Icompinent.meta !== ICompositedComponent.meta
|
|
470
|
+
*/
|
|
471
|
+
meta: any;
|
|
472
|
+
npmDependencies: {};
|
|
473
|
+
listeners: any[];
|
|
474
|
+
}[];
|
|
475
|
+
isComposite: boolean;
|
|
476
|
+
schemaVersion: string;
|
|
477
|
+
};
|
|
434
478
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser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GAAG,IAAI,CAAC,OAAO,CAAA;KAAE,CAAC;CAC1C;;;;;;;mBAIY,MAAM;mBACN,MAAM;sBACH,MAAM;;;6BACwB,OAAO;;;wBACnC,MAAM;;;;;;EAiCvB;AAED,wBAAgB,2BAA2B,CACzC,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EACrC,SAAS,EAAE,GAA4B,EACvC,KAAK,EAAE,MAAM,OAkCd;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,SAAK,EACZ,YAAY,QAAK,GAChB;IACD,qBAAqB,EAAE,OAAO,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,uBAAuB,EAAE,OAAO,CAAC;CAClC,CA+BA;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,iBAAiB,EAAE,EAC9B,OAAO,CAAC,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GAC5B;IACD,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,UAAU,EAAE,UAAU,EAAE,CAAC;CAC1B,CA4DA;AAED,wBAAgB,6BAA6B,CAAC,YAAY,GAAE,aAAkB,MAQ7E;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,UAWvD;AAED,wBAAgB,+BAA+B,CAAC,SAAS,QAAK;;;;;;;;;;;;;;;;;QA4BtD;;;WAGG;;;;;;;EAcV"}
|
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.parseDependenciesVersion = exports.processDependenciesVersionMap = exports.processListeners = exports.parseVersion = exports.processRuntimeCodeResources = exports.deserializeComponentLibraryMeta = exports.deserializeRuntimeComponent = exports.serializeRuntimeComponent = exports.serializeRuntimeDataset = exports.serializeRuntimePage = exports.deserializePlatformApp = exports.serializePlatformApp = exports.deserializePage = exports.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.normalizeQuery = exports.deserializeDataset = exports.serializeDataset = exports.deserializeAttributes = exports.serializeAttributes = exports.deserializeDynamicMap = exports.serializeDynamicMap = exports.deserializeValue = exports.serializeValue = exports.generateDefaultCode = exports.getUsedComps = void 0;
|
|
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.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.normalizeQuery = exports.deserializeDataset = 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"));
|
|
@@ -566,21 +566,21 @@ function serializeDataVariables(ctx, data) {
|
|
|
566
566
|
let { title } = data, restData = __rest(data, ["title"]);
|
|
567
567
|
return Object.assign(Object.assign({ varType: 'datasource' }, restData), { label: title });
|
|
568
568
|
}
|
|
569
|
-
function deserializeDataVariables(
|
|
569
|
+
function deserializeDataVariables(_, data) {
|
|
570
570
|
let { label } = data, restData = __rest(data, ["label"]);
|
|
571
571
|
return Object.assign(Object.assign({}, restData), { title: label });
|
|
572
572
|
}
|
|
573
573
|
exports.deserializeDataVariables = deserializeDataVariables;
|
|
574
|
-
function serializeCodeSource(
|
|
574
|
+
function serializeCodeSource(_, data) {
|
|
575
575
|
const { type } = data;
|
|
576
576
|
return Object.assign(Object.assign({}, data), { type: common_1.EResourceType.CODE, codeType: type });
|
|
577
577
|
}
|
|
578
|
-
function deserializeCodeResource(
|
|
578
|
+
function deserializeCodeResource(_, data) {
|
|
579
579
|
const { type, codeType } = data, resData = __rest(data, ["type", "codeType"]);
|
|
580
580
|
return Object.assign(Object.assign({}, resData), { type: codeType });
|
|
581
581
|
}
|
|
582
582
|
function serializeModuleName(ctx, moduleName, componentName) {
|
|
583
|
-
let {
|
|
583
|
+
let { dependenciesMap = {} } = ctx;
|
|
584
584
|
if (moduleName === utils_1.OFFICIAL_LIB_KEY) {
|
|
585
585
|
moduleName = undefined;
|
|
586
586
|
}
|
|
@@ -592,8 +592,7 @@ function serializeModuleName(ctx, moduleName, componentName) {
|
|
|
592
592
|
}
|
|
593
593
|
return moduleName;
|
|
594
594
|
}
|
|
595
|
-
function deserializeModuleName(
|
|
596
|
-
let { dependenciesMap = {} } = ctx;
|
|
595
|
+
function deserializeModuleName({ dependenciesMap = {} }, componentName, moduleName) {
|
|
597
596
|
/**
|
|
598
597
|
* 无组件库名 且 有组件名
|
|
599
598
|
*/
|
|
@@ -703,7 +702,8 @@ function deserializeComponent(ctx, components) {
|
|
|
703
702
|
};
|
|
704
703
|
if (xComponent.name) {
|
|
705
704
|
xComponent.moduleName =
|
|
706
|
-
deserializeModuleName(ctx, xComponent.name, xComponent.moduleName) ||
|
|
705
|
+
deserializeModuleName({ dependenciesMap: ctx.dependenciesMap }, xComponent.name, xComponent.moduleName) ||
|
|
706
|
+
xComponent.moduleName;
|
|
707
707
|
}
|
|
708
708
|
const xProps = {
|
|
709
709
|
data: deserializeAttributes(ctx, item.attributes, attributeExtraData),
|
|
@@ -800,39 +800,35 @@ function serializePage(ctx, page) {
|
|
|
800
800
|
}
|
|
801
801
|
exports.serializePage = serializePage;
|
|
802
802
|
function deserializePage(ctx, page) {
|
|
803
|
-
var _a, _b, _c, _d, _e
|
|
804
|
-
|
|
803
|
+
var _a, _b, _c, _d, _e;
|
|
804
|
+
const { homePageId } = ctx, _pageCtx = __rest(ctx, ["homePageId"]);
|
|
805
|
+
let pageCtx = Object.assign(Object.assign({}, _pageCtx), { page });
|
|
805
806
|
const { listeners = [], eventFlows } = processListeners((page === null || page === void 0 ? void 0 : page.listeners) || []);
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
isHome: page.id === ctx.homePageId,
|
|
809
|
-
dataset: deserializeDataset(ctx, page.dataset),
|
|
810
|
-
vars: {
|
|
807
|
+
const instance = deserializeInstance(pageCtx, page);
|
|
808
|
+
return Object.assign(Object.assign({}, instance), { isHome: page.id === homePageId, vars: {
|
|
811
809
|
data: ((_a = page.dataVariables) === null || _a === void 0 ? void 0 : _a.map((item) => {
|
|
812
|
-
return deserializeDataVariables(
|
|
810
|
+
return deserializeDataVariables(undefined, item);
|
|
813
811
|
})) || [],
|
|
814
|
-
},
|
|
815
|
-
data: deserializeAttributes(pageCtx, page.attributes, (_b = page === null || page === void 0 ? void 0 : page.extra) === null || _b === void 0 ? void 0 : _b.attributeExtraData),
|
|
816
|
-
componentInstances: deserializeComponent(pageCtx, page.items || []),
|
|
817
|
-
commonStyle: (_c = page === null || page === void 0 ? void 0 : page.extra) === null || _c === void 0 ? void 0 : _c.commonStyle,
|
|
818
|
-
staticResourceAttribute: (_d = page === null || page === void 0 ? void 0 : page.extra) === null || _d === void 0 ? void 0 : _d.staticResourceAttribute,
|
|
819
|
-
hideAdminPortalMenu: (_e = page === null || page === void 0 ? void 0 : page.extra) === null || _e === void 0 ? void 0 : _e.hideAdminPortalMenu,
|
|
820
|
-
lowCodes: (_f = page === null || page === void 0 ? void 0 : page.resources) === null || _f === void 0 ? void 0 : _f.filter((item) => item.type === common_1.EResourceType.CODE && item.name !== common_1.ECodeName.PLACEHOLDER).map((item) => deserializeCodeResource(pageCtx, item)),
|
|
821
|
-
listeners: (listeners === null || listeners === void 0 ? void 0 : listeners.map((item) => {
|
|
812
|
+
}, data: deserializeAttributes(pageCtx, page.attributes, (_b = page === null || page === void 0 ? void 0 : page.extra) === null || _b === void 0 ? void 0 : _b.attributeExtraData), commonStyle: (_c = page === null || page === void 0 ? void 0 : page.extra) === null || _c === void 0 ? void 0 : _c.commonStyle, staticResourceAttribute: (_d = page === null || page === void 0 ? void 0 : page.extra) === null || _d === void 0 ? void 0 : _d.staticResourceAttribute, hideAdminPortalMenu: (_e = page === null || page === void 0 ? void 0 : page.extra) === null || _e === void 0 ? void 0 : _e.hideAdminPortalMenu, listeners: (listeners === null || listeners === void 0 ? void 0 : listeners.map((item) => {
|
|
822
813
|
return deserializeListener(pageCtx, item);
|
|
823
|
-
})) || [],
|
|
824
|
-
eventFlows: (eventFlows === null || eventFlows === void 0 ? void 0 : eventFlows.map((eventFlow) => {
|
|
814
|
+
})) || [], eventFlows: (eventFlows === null || eventFlows === void 0 ? void 0 : eventFlows.map((eventFlow) => {
|
|
825
815
|
var _a, _b;
|
|
826
816
|
return Object.assign(Object.assign({}, eventFlow), { listeners: ((_b = (_a = eventFlow.listeners) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.call(_a, (item) => {
|
|
827
817
|
return deserializeListener(pageCtx, item);
|
|
828
818
|
})) || [] });
|
|
829
|
-
})) || []
|
|
830
|
-
// TODO
|
|
831
|
-
// children: [],
|
|
832
|
-
// styleBindPath: item.styleBindPath,
|
|
833
|
-
};
|
|
819
|
+
})) || [] });
|
|
834
820
|
}
|
|
835
821
|
exports.deserializePage = deserializePage;
|
|
822
|
+
function deserializeInstance(ctx, instance, scope = 'page') {
|
|
823
|
+
var _a;
|
|
824
|
+
const instanceCtx = Object.assign(Object.assign({}, ctx), { page: scope === 'page' ? instance : undefined });
|
|
825
|
+
return {
|
|
826
|
+
id: instance.id || instance.name,
|
|
827
|
+
dataset: deserializeDataset(ctx, instance.dataset),
|
|
828
|
+
componentInstances: deserializeComponent(instanceCtx, instance.items || []),
|
|
829
|
+
lowCodes: (_a = instance === null || instance === void 0 ? void 0 : instance.resources) === null || _a === void 0 ? void 0 : _a.filter((item) => item.type === common_1.EResourceType.CODE && item.name !== common_1.ECodeName.PLACEHOLDER).map((item) => deserializeCodeResource(undefined, item)),
|
|
830
|
+
};
|
|
831
|
+
}
|
|
836
832
|
/**
|
|
837
833
|
* [WeApps协议] to [CALS协议]
|
|
838
834
|
*
|
|
@@ -898,12 +894,12 @@ function deserializePlatformApp(data, optsions) {
|
|
|
898
894
|
// lowCodes: data.resources || [],
|
|
899
895
|
lowCodes: (data.resources || [])
|
|
900
896
|
.filter((item) => item.type === common_1.EResourceType.CODE && item.name !== common_1.ECodeName.PLACEHOLDER)
|
|
901
|
-
.map((item) => deserializeCodeResource(
|
|
897
|
+
.map((item) => deserializeCodeResource(undefined, item)),
|
|
902
898
|
datasources: data.dataSources,
|
|
903
899
|
dataset: deserializeDataset(ctx, data.dataset),
|
|
904
900
|
vars: {
|
|
905
901
|
data: ((_b = data.dataVariables) === null || _b === void 0 ? void 0 : _b.map((item) => {
|
|
906
|
-
return deserializeDataVariables(
|
|
902
|
+
return deserializeDataVariables(undefined, item);
|
|
907
903
|
})) || [],
|
|
908
904
|
},
|
|
909
905
|
compHiddenConfig: compHiddenConfig || {},
|
|
@@ -925,6 +921,14 @@ function deserializePlatformApp(data, optsions) {
|
|
|
925
921
|
return processed;
|
|
926
922
|
}
|
|
927
923
|
exports.deserializePlatformApp = deserializePlatformApp;
|
|
924
|
+
function deserializeCompositeComponent(component, options) {
|
|
925
|
+
const ctx = {
|
|
926
|
+
dependencies: (options === null || options === void 0 ? void 0 : options.dependencies) || [],
|
|
927
|
+
dependenciesMap: processDependenceList2Map(((options === null || options === void 0 ? void 0 : options.dependencies) || [])),
|
|
928
|
+
};
|
|
929
|
+
return deserializeInstance(ctx, component);
|
|
930
|
+
}
|
|
931
|
+
exports.deserializeCompositeComponent = deserializeCompositeComponent;
|
|
928
932
|
/**
|
|
929
933
|
* page
|
|
930
934
|
* [formily] to [CALS]
|
|
@@ -1295,3 +1299,47 @@ function parseDependenciesVersion(version) {
|
|
|
1295
1299
|
}
|
|
1296
1300
|
}
|
|
1297
1301
|
exports.parseDependenciesVersion = parseDependenciesVersion;
|
|
1302
|
+
function processTemplatesToDependiencies(templates = []) {
|
|
1303
|
+
return {
|
|
1304
|
+
name: '$template',
|
|
1305
|
+
version: 'latest',
|
|
1306
|
+
srcZipUrl: '',
|
|
1307
|
+
mpPkgUrl: '',
|
|
1308
|
+
actions: [],
|
|
1309
|
+
components: templates === null || templates === void 0 ? void 0 : templates.map((item /* : ICompositedComponent */) => {
|
|
1310
|
+
var _a, _b, _c;
|
|
1311
|
+
const weappsData = deserializeCompositeComponent(item, { dependencies: [] });
|
|
1312
|
+
return {
|
|
1313
|
+
id: (item.id || item.name),
|
|
1314
|
+
name: item.name || '',
|
|
1315
|
+
materialName: '$template',
|
|
1316
|
+
componentInstances: weappsData.componentInstances,
|
|
1317
|
+
compConfig: item.compConfig || {},
|
|
1318
|
+
dataForm: item.dataForm || ((_a = item.data) === null || _a === void 0 ? void 0 : _a.properties) || {},
|
|
1319
|
+
emitEvents: item.emitEvents ||
|
|
1320
|
+
((_b = item.events) === null || _b === void 0 ? void 0 : _b.map((item) => {
|
|
1321
|
+
return { eventName: item.name, name: item.title };
|
|
1322
|
+
})),
|
|
1323
|
+
lowCodes: ((_c = weappsData.lowCodes) === null || _c === void 0 ? void 0 : _c.map((module) => {
|
|
1324
|
+
var _a, _b;
|
|
1325
|
+
return Object.assign(Object.assign({}, module), { path: (_b = (_a = module.path) === null || _a === void 0 ? void 0 : _a.replace) === null || _b === void 0 ? void 0 : _b.call(_a, /^.*?\//, `$comp/`) });
|
|
1326
|
+
})) || [],
|
|
1327
|
+
/**
|
|
1328
|
+
* @TODO: 二者归一化
|
|
1329
|
+
* lcds.Icompinent.meta !== ICompositedComponent.meta
|
|
1330
|
+
*/
|
|
1331
|
+
meta: item.meta || {
|
|
1332
|
+
title: item.name || '',
|
|
1333
|
+
syncProps: {},
|
|
1334
|
+
inputProps: {},
|
|
1335
|
+
platforms: { mp: {} },
|
|
1336
|
+
},
|
|
1337
|
+
npmDependencies: {},
|
|
1338
|
+
listeners: [],
|
|
1339
|
+
};
|
|
1340
|
+
}),
|
|
1341
|
+
isComposite: true,
|
|
1342
|
+
schemaVersion: '3.0.0',
|
|
1343
|
+
};
|
|
1344
|
+
}
|
|
1345
|
+
exports.processTemplatesToDependiencies = processTemplatesToDependiencies;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPlatformComponent } from '../../../../types';
|
|
2
2
|
interface IParseContext {
|
|
3
3
|
component?: {
|
|
4
4
|
id: string;
|
|
@@ -10,6 +10,6 @@ interface IParseContext {
|
|
|
10
10
|
lowcodeMap: Record<string, any>;
|
|
11
11
|
componentLibMap: Record<string, any>;
|
|
12
12
|
}
|
|
13
|
-
export declare function parseComponentCals(ctx: IParseContext, cals:
|
|
13
|
+
export declare function parseComponentCals(ctx: IParseContext, cals: IPlatformComponent): IParseContext;
|
|
14
14
|
export {};
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,mBAAmB,CAAC;AAK1E,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,kBAAkB,GAAG,aAAa,CAyD9F"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IPlatformApp } from '../../../types';
|
|
1
2
|
import { IDataBind } from '../../expression/index';
|
|
2
3
|
declare type IUsedComps = {
|
|
3
4
|
[libName: string]: Set<string>;
|
|
@@ -7,6 +8,11 @@ export declare function isPlainObject(src: any): boolean;
|
|
|
7
8
|
export declare const isEmptyObj: (obj: object) => boolean;
|
|
8
9
|
export declare function isValidStyleBind(styleBind: IDataBind): boolean;
|
|
9
10
|
export declare function isValidClassNameListBind(classNameListBind: IDataBind): boolean;
|
|
10
|
-
export declare function getUsedComps(apps:
|
|
11
|
+
export declare function getUsedComps(apps: IPlatformApp[], dependencies: any[], options?: {
|
|
12
|
+
/**
|
|
13
|
+
* templates 按需引入
|
|
14
|
+
*/
|
|
15
|
+
streamline: boolean;
|
|
16
|
+
}): IUsedComps;
|
|
11
17
|
export {};
|
|
12
18
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAYnD,aAAK,UAAU,GAAG;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAGrD,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;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAElF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAYnD,aAAK,UAAU,GAAG;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAGrD,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;AA2FD,wBAAgB,YAAY,CAE1B,IAAI,EAAE,YAAY,EAAE,EAEpB,YAAY,EAAE,GAAG,EAAE,EACnB,OAAO,CAAC,EAAE;IACR;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB,cAsDF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getUsedComps = exports.isValidClassNameListBind = exports.isValidStyleBind = exports.isEmptyObj = exports.isPlainObject = exports.camelcase = void 0;
|
|
4
|
+
const utils_1 = require("../../../utils");
|
|
4
5
|
const index_1 = require("../index");
|
|
5
6
|
function camelcase(str, firstUpperCase = false) {
|
|
6
7
|
str = str.replace(/[_-]([a-z])/g, (l) => {
|
|
@@ -65,6 +66,23 @@ function getUsedCompsFromProperties(properties, usedComps) {
|
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* 直接访问 cals 来收集
|
|
71
|
+
*/
|
|
72
|
+
function getUsedCompsFromIPlatformComponent(comp, used, options) {
|
|
73
|
+
var _a, _b;
|
|
74
|
+
// 非 slot
|
|
75
|
+
if (comp.component) {
|
|
76
|
+
const module = comp.module || utils_1.OFFICIAL_LIB_KEY;
|
|
77
|
+
if (!used[module]) {
|
|
78
|
+
used[module] = new Set([]);
|
|
79
|
+
}
|
|
80
|
+
used[module].add(comp.component);
|
|
81
|
+
}
|
|
82
|
+
(_b = (_a = comp.items) === null || _a === void 0 ? void 0 : _a.forEach) === null || _b === void 0 ? void 0 : _b.call(_a, (item) => {
|
|
83
|
+
getUsedCompsFromIPlatformComponent(item, used, options);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
68
86
|
// 递归查询复合组件库所使用的组件
|
|
69
87
|
function getUsedCompsFromCompositedLibsRecursively(
|
|
70
88
|
// 已知的被使用到的组件
|
|
@@ -120,20 +138,30 @@ function getUsedComps(
|
|
|
120
138
|
// 主子包的应用内容
|
|
121
139
|
apps,
|
|
122
140
|
// 分库后的组件库 denpendienicy
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
});
|
|
141
|
+
dependencies, options) {
|
|
142
|
+
const { streamline = false } = options || {};
|
|
143
|
+
const { templates = [] } = (apps === null || apps === void 0 ? void 0 : apps[0]) || {};
|
|
144
|
+
const comps = streamline ? [...dependencies, (0, index_1.processTemplatesToDependiencies)(templates)] : dependencies;
|
|
128
145
|
// 1. 寻找应用内容里用到的所有组件
|
|
129
146
|
// 1.1 寻找主子应用各自的内容里所用到的组件
|
|
130
|
-
const appUsedComps =
|
|
131
|
-
var _a;
|
|
147
|
+
const appUsedComps = apps.map((app) => {
|
|
148
|
+
var _a, _b, _c, _d;
|
|
132
149
|
const usedComps = {};
|
|
133
150
|
// 主子包模式下, 可能没有应用内容
|
|
134
|
-
(_a = app.
|
|
135
|
-
|
|
151
|
+
(_b = (_a = app.items) === null || _a === void 0 ? void 0 : _a.forEach) === null || _b === void 0 ? void 0 : _b.call(_a, (page) => {
|
|
152
|
+
var _a, _b;
|
|
153
|
+
(_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, usedComps, options);
|
|
155
|
+
});
|
|
136
156
|
});
|
|
157
|
+
if (!streamline) {
|
|
158
|
+
(_d = (_c = app.templates) === null || _c === void 0 ? void 0 : _c.forEach) === null || _d === void 0 ? void 0 : _d.call(_c, (template) => {
|
|
159
|
+
var _a;
|
|
160
|
+
(_a = template.items) === null || _a === void 0 ? void 0 : _a.forEach((comp) => {
|
|
161
|
+
getUsedCompsFromIPlatformComponent(comp, usedComps, options);
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
}
|
|
137
165
|
return usedComps;
|
|
138
166
|
});
|
|
139
167
|
// 1.2 合并主子包所有用到的组件
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUsedResources.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/getUsedResources.ts"],"names":[],"mappings":"AAgBA,wBAAgB,gBAAgB,CAE9B,IAAI,EAAE,GAAG,EAAE,GACV,KAAK,CAAC,MAAM,CAAC,CASf;AAiED,wBAAgB,iCAAiC,CAC/C,IAAI,KAAA,EACJ,iBAAiB,cAAsB,EACvC,YAAY,cAAsB;;;EAQnC;
|
|
1
|
+
{"version":3,"file":"getUsedResources.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/getUsedResources.ts"],"names":[],"mappings":"AAgBA,wBAAgB,gBAAgB,CAE9B,IAAI,EAAE,GAAG,EAAE,GACV,KAAK,CAAC,MAAM,CAAC,CASf;AAiED,wBAAgB,iCAAiC,CAC/C,IAAI,KAAA,EACJ,iBAAiB,cAAsB,EACvC,YAAY,cAAsB;;;EAQnC;AAkBD,wBAAgB,wBAAwB,CAAC,MAAM,KAAA,GAAG;IAAE,uBAAuB,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,CAqB3G"}
|
|
@@ -85,12 +85,16 @@ function _simpleGetUsedResourceOfComponent(comp, staticResourceSet = new Set([])
|
|
|
85
85
|
exports._simpleGetUsedResourceOfComponent = _simpleGetUsedResourceOfComponent;
|
|
86
86
|
// 递归遍历模版,找到静态资源
|
|
87
87
|
function getUsedResourcesFromAppRecursively(app, allUsedResources) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
function recursive(list) {
|
|
89
|
+
for (let item of list) {
|
|
90
|
+
_simpleGetUsedResourceOfComponent(item, allUsedResources);
|
|
91
|
+
if (item.items) {
|
|
92
|
+
getUsedResourcesFromAppRecursively(item, allUsedResources);
|
|
93
|
+
}
|
|
92
94
|
}
|
|
93
95
|
}
|
|
96
|
+
recursive(app.items || []);
|
|
97
|
+
recursive(app.templates || []);
|
|
94
98
|
}
|
|
95
99
|
function getNavUsedStaticResource(config) {
|
|
96
100
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/expression/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE3D,eAAO,MAAM,YAAY,EAAE,OAO1B,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;CAcpB,CAAC;AAEF,oBAAY,YAAY;IACtB,MAAM,WAAW;IACjB,KAAK,YAAY;IACjB,QAAQ,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AAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,kBAAkB;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,0BAA0B,CAAC;gBACxB,gBAAgB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,0BAA0B,CAAC;IAWnF;;OAEG;IACH,KAAK;IAwBL,oBAAoB,CAAC,UAAU,EAAE,MAAM;IAIvC,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;IAclE,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;IA+ElE,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;IA4BrE,eAAe,CAAC,cAAc,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAW3E,kBAAkB,CAAC,IAAI,EAAE;QACvB,cAAc,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;QACpC,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B;IAMD,YAAY,CACV,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE;QACJ,cAAc,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;QACpC,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,EACD,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;CAuB3B"}
|
|
@@ -191,15 +191,6 @@ class DynamicValueParser {
|
|
|
191
191
|
case 'dataVar': {
|
|
192
192
|
// 老格式全部都转为 expression 格式
|
|
193
193
|
throw new ParseError({ expression });
|
|
194
|
-
// const typeMap = {
|
|
195
|
-
// state: PropBindType.state,
|
|
196
|
-
// computed: PropBindType.computed,
|
|
197
|
-
// dataVar: PropBindType.dataVar,
|
|
198
|
-
// }
|
|
199
|
-
// options.type = typeMap[memberProperty[1]]
|
|
200
|
-
// options.value = this._replaceExpression(meta)
|
|
201
|
-
// return this.options
|
|
202
|
-
// break
|
|
203
194
|
}
|
|
204
195
|
default: {
|
|
205
196
|
throw new ParseError({ expression });
|
|
@@ -218,14 +209,6 @@ class DynamicValueParser {
|
|
|
218
209
|
case 'dataVar': {
|
|
219
210
|
// 老格式全部都转为 expression 格式
|
|
220
211
|
throw new ParseError({ expression });
|
|
221
|
-
// const typeMap = {
|
|
222
|
-
// state: PropBindType.state,
|
|
223
|
-
// computed: PropBindType.computed,
|
|
224
|
-
// dataVar: PropBindType.dataVar,
|
|
225
|
-
// }
|
|
226
|
-
// options.type = typeMap[memberProperty[1]]
|
|
227
|
-
// options.value = this._replaceExpression(meta)
|
|
228
|
-
// return this.options
|
|
229
212
|
}
|
|
230
213
|
default: {
|
|
231
214
|
throw new ParseError({ expression });
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IDataSourceQuery } from '../platform/query';
|
|
2
1
|
import { IListener, IResource, IDataset } from './common';
|
|
3
2
|
export interface IComponent {
|
|
4
3
|
/**
|
|
@@ -63,10 +62,6 @@ export interface IComponent {
|
|
|
63
62
|
* 可选, 变量集合
|
|
64
63
|
*/
|
|
65
64
|
dataset?: IDataset;
|
|
66
|
-
/**
|
|
67
|
-
* 可选,
|
|
68
|
-
*/
|
|
69
|
-
query?: IDataSourceQuery;
|
|
70
65
|
/**
|
|
71
66
|
* 可选,动态绑定 class,字符串表达式
|
|
72
67
|
* '["1", "2"]'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/types/basic/component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/types/basic/component.ts"],"names":[],"mappings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