@komaci/common-shared 242.1.0 → 242.1.3
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/build/allowlistNamespaces.d.ts +2 -1
- package/build/allowlistNamespaces.js +8 -2
- package/build/internal-namespaces.json +11 -0
- package/build/moduleMetadata.d.ts +19 -4
- package/build/moduleMetadata.js +67 -12
- package/build/types.d.ts +14 -1
- package/build/utils.d.ts +6 -0
- package/build/utils.js +15 -1
- package/package.json +2 -2
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
export declare const isLocalHtmlImportReference: RegExp;
|
|
1
2
|
/**
|
|
2
3
|
* Determine whether the resource name is in a supported namespace
|
|
3
4
|
* @param resourceName the resource name of the Import, as a string
|
|
4
5
|
* @returns boolean true if the resource name is in a supported namespace
|
|
5
6
|
*/
|
|
6
|
-
export declare function isSupportedNamespace(resourceName: string
|
|
7
|
+
export declare function isSupportedNamespace(resourceName: string): boolean;
|
|
7
8
|
/**
|
|
8
9
|
* Returns true if the given namespace is an internal namespace. Note,
|
|
9
10
|
* case is ignored. e.g., if "flexipage" is defined as a supported namespace, then
|
|
@@ -3,11 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.checkLibraryPathWithRegex = exports.isLibraryValid = exports.getNamespaceFromImport = exports.isNamespaceInternal = exports.isSupportedNamespace = void 0;
|
|
6
|
+
exports.checkLibraryPathWithRegex = exports.isLibraryValid = exports.getNamespaceFromImport = exports.isNamespaceInternal = exports.isSupportedNamespace = exports.isLocalHtmlImportReference = void 0;
|
|
7
7
|
const internal_namespaces_json_1 = __importDefault(require("./internal-namespaces.json"));
|
|
8
8
|
const hardCodedNamespaces = ['lightning', 'laf', 'one', 'force', 'lst', '@salesforce'];
|
|
9
9
|
const internalButNotSupported = ['komaci', 'lwc', 'aura', 'lwr'];
|
|
10
10
|
const allowlistNamespaces = [...hardCodedNamespaces, ...internal_namespaces_json_1.default].filter((ns) => !internalButNotSupported.includes(ns.toLowerCase()));
|
|
11
|
+
exports.isLocalHtmlImportReference = /^.\/.*html$/;
|
|
11
12
|
const allowListLibrariesRegex = [
|
|
12
13
|
/^force\/shared$/,
|
|
13
14
|
/^laf\/transformWire$/,
|
|
@@ -19,6 +20,7 @@ const allowListLibrariesRegex = [
|
|
|
19
20
|
/^laf\/batchingPortable$/,
|
|
20
21
|
/^lightning\/navigation$/,
|
|
21
22
|
/^lightning\/base.*$/,
|
|
23
|
+
exports.isLocalHtmlImportReference,
|
|
22
24
|
];
|
|
23
25
|
/**
|
|
24
26
|
* Determine whether the resource name is in a supported namespace
|
|
@@ -26,9 +28,13 @@ const allowListLibrariesRegex = [
|
|
|
26
28
|
* @returns boolean true if the resource name is in a supported namespace
|
|
27
29
|
*/
|
|
28
30
|
function isSupportedNamespace(resourceName) {
|
|
31
|
+
//checking to see if we are importing a template from a local html file.
|
|
32
|
+
if (exports.isLocalHtmlImportReference.test(resourceName)) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
29
35
|
// check for relative, null, or empty namespaces (which are not allowed)
|
|
30
36
|
// Ex: undefined, '', './app_const1', './parent.html'
|
|
31
|
-
if (
|
|
37
|
+
if (resourceName.startsWith('./')) {
|
|
32
38
|
return false;
|
|
33
39
|
}
|
|
34
40
|
// imports where parent class is for a relative import.
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
"LoyaltyManagement",
|
|
112
112
|
"Lst",
|
|
113
113
|
"Ltng",
|
|
114
|
+
"MCForIndustries",
|
|
114
115
|
"Macros",
|
|
115
116
|
"Membership",
|
|
116
117
|
"Messaging",
|
|
@@ -311,6 +312,7 @@
|
|
|
311
312
|
"commerce_ordersummary",
|
|
312
313
|
"commerce_product_details",
|
|
313
314
|
"commerce_promotions",
|
|
315
|
+
"commerce_search",
|
|
314
316
|
"commerce_store_integrations",
|
|
315
317
|
"commerce_unified_checkout",
|
|
316
318
|
"commerce_unified_coupons",
|
|
@@ -531,6 +533,7 @@
|
|
|
531
533
|
"hc_slack_flows",
|
|
532
534
|
"hcmainstgpu",
|
|
533
535
|
"hcmainstguat",
|
|
536
|
+
"healthcare_crisis_center",
|
|
534
537
|
"healthcloud",
|
|
535
538
|
"healthcloud_iam_flows",
|
|
536
539
|
"healthcloud_patientcard",
|
|
@@ -568,6 +571,7 @@
|
|
|
568
571
|
"industries_mfg_service",
|
|
569
572
|
"industries_mfg_targets",
|
|
570
573
|
"industries_mfg_targets_test",
|
|
574
|
+
"industries_sales_excellence",
|
|
571
575
|
"industries_service_excellence",
|
|
572
576
|
"ins_exp_pc01",
|
|
573
577
|
"ins_exp_pc02",
|
|
@@ -661,6 +665,7 @@
|
|
|
661
665
|
"private_industries_common",
|
|
662
666
|
"process_home",
|
|
663
667
|
"process_migration",
|
|
668
|
+
"publicsector_exp_flows",
|
|
664
669
|
"randa",
|
|
665
670
|
"record_flexipage",
|
|
666
671
|
"records",
|
|
@@ -706,12 +711,14 @@
|
|
|
706
711
|
"runtime_industries_arcgraph",
|
|
707
712
|
"runtime_industries_assessment",
|
|
708
713
|
"runtime_industries_churn_ED",
|
|
714
|
+
"runtime_industries_clause_library",
|
|
709
715
|
"runtime_industries_clm",
|
|
710
716
|
"runtime_industries_components",
|
|
711
717
|
"runtime_industries_documentreader",
|
|
712
718
|
"runtime_industries_epc",
|
|
713
719
|
"runtime_industries_eri",
|
|
714
720
|
"runtime_industries_fsc",
|
|
721
|
+
"runtime_industries_gdf",
|
|
715
722
|
"runtime_industries_healthcare",
|
|
716
723
|
"runtime_industries_insurance",
|
|
717
724
|
"runtime_industries_interaction_decisionmatrix",
|
|
@@ -796,6 +803,7 @@
|
|
|
796
803
|
"runtime_sales_todo_list",
|
|
797
804
|
"runtime_sales_video",
|
|
798
805
|
"runtime_search_federated",
|
|
806
|
+
"runtime_service_easy",
|
|
799
807
|
"runtime_service_fieldservice",
|
|
800
808
|
"runtime_service_gantt",
|
|
801
809
|
"runtime_service_incident_mgmt",
|
|
@@ -819,6 +827,7 @@
|
|
|
819
827
|
"sbaa2",
|
|
820
828
|
"scrt",
|
|
821
829
|
"scrt_setup",
|
|
830
|
+
"se_cadence_flow",
|
|
822
831
|
"se_included_flow",
|
|
823
832
|
"se_scrn_flow",
|
|
824
833
|
"search_dialog",
|
|
@@ -868,6 +877,7 @@
|
|
|
868
877
|
"setup_industries_mfgprogram",
|
|
869
878
|
"setup_industries_objectdetection",
|
|
870
879
|
"setup_industries_referralscoring",
|
|
880
|
+
"setup_industries_scoringframework",
|
|
871
881
|
"setup_industries_smartselling",
|
|
872
882
|
"setup_industries_smarttags",
|
|
873
883
|
"setup_industries_tpm",
|
|
@@ -927,6 +937,7 @@
|
|
|
927
937
|
"setup_service_test",
|
|
928
938
|
"setup_service_usecaseexplorer",
|
|
929
939
|
"setup_service_voice",
|
|
940
|
+
"setup_user_access_policies",
|
|
930
941
|
"sfFma",
|
|
931
942
|
"sfLma",
|
|
932
943
|
"sf_devops",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FunctionType, KomaciDocument } from '@komaci/types';
|
|
2
2
|
import * as t from '@babel/types';
|
|
3
|
-
import { AdgMetadata, ImportDetail, ImportMetadata, ModuleMetadata, PrimingAdapterDefinition, WireFunctionMetadata } from './types';
|
|
3
|
+
import { AdgMetadata, ImportDetail, ImportMetadata, ModuleMetadata, PrimingAdapterDefinition, TemplateImportMetadata, WireFunctionMetadata } from './types';
|
|
4
4
|
/** not all imports are consumed in a statically analyzable way. when we add their metadata, we use this to ack that the komaciDocImportRef for this import is nil */
|
|
5
5
|
export declare const NO_KOMACI_DOC_REF = "nil";
|
|
6
6
|
/**
|
|
@@ -18,8 +18,9 @@ export declare const initAdgMetadataObject: (defaultGeneratedName: string) => Ad
|
|
|
18
18
|
* Process import references from komaci document
|
|
19
19
|
* @param doc the KomaciDocument itself
|
|
20
20
|
* @param moduleMetadata data structure representing metadata about the module we are working on
|
|
21
|
+
* @param templateAdgIndex the index of the template adg
|
|
21
22
|
*/
|
|
22
|
-
export declare const initializeImportMetdataFromKomaciDocument: (doc: KomaciDocument, moduleMetadata: ModuleMetadata,
|
|
23
|
+
export declare const initializeImportMetdataFromKomaciDocument: (doc: KomaciDocument, moduleMetadata: ModuleMetadata, templateAdgIndex?: number) => void;
|
|
23
24
|
/**
|
|
24
25
|
* Update module metadata with information about the given import.
|
|
25
26
|
* @param name import name
|
|
@@ -71,6 +72,14 @@ export declare const addNewImportFromAst: (referencedName: string, namespace: Im
|
|
|
71
72
|
* @param originalImportName (optional) the original name of the import that has been aliases. undefined if no alias.
|
|
72
73
|
*/
|
|
73
74
|
export declare const updateAliasForImport: (lookupName: string, referencedName: string, namespace: ImportDetail, moduleMetadata: ModuleMetadata, originalImportName?: string) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Searches the provided tempalte komaci doc map for a document that corresponds to the provided namesapce.
|
|
77
|
+
* @param resourceName am imports resource name
|
|
78
|
+
* @param templateKomaciDocMap a map of template komaci docs.
|
|
79
|
+
*/
|
|
80
|
+
export declare function getImportTemplateKomaciDocByResourceName(resourceName: string, templateKomaciDocMap?: {
|
|
81
|
+
[fName: string]: KomaciDocument;
|
|
82
|
+
}): KomaciDocument | undefined;
|
|
74
83
|
/**
|
|
75
84
|
* pull all needful import metadata we can from the ast
|
|
76
85
|
* for the most part, we can grab data from the komaci document for imports but sometimes
|
|
@@ -109,7 +118,7 @@ export declare const mapExportNamesToAdgs: (exports: KomaciDocument['exports'],
|
|
|
109
118
|
* @param adgIndex the index of the default adg
|
|
110
119
|
* @param moduleMetadata data structure representing metadata about the module we are working on
|
|
111
120
|
*/
|
|
112
|
-
export declare const
|
|
121
|
+
export declare const addTemplateUsageForAdg: (doc: KomaciDocument, adgIndex: number, moduleMetadata: ModuleMetadata) => void;
|
|
113
122
|
/**
|
|
114
123
|
* Collect functional metadata for a wire this includes
|
|
115
124
|
* - wire function details (name, batch / reducer if priming function)
|
|
@@ -150,11 +159,17 @@ export declare function isImportInvalid(importMetadata: ImportMetadata): boolean
|
|
|
150
159
|
* @param moduleMetadata metadata about the module
|
|
151
160
|
* @returns the index of the default adg
|
|
152
161
|
*/
|
|
153
|
-
export declare function reconcileDefaultAdg(currentDefaultAdgIndex: number | undefined, moduleMetadata: ModuleMetadata): number;
|
|
162
|
+
export declare function reconcileDefaultAdg(currentDefaultAdgIndex: number | undefined, moduleMetadata: ModuleMetadata): number | undefined;
|
|
154
163
|
/**
|
|
155
164
|
* If we process a template and see it has some props we don't know about we can uplift them to the adgs props using this.
|
|
156
165
|
* this is only currently used for template only bundles
|
|
157
166
|
* @param adg The metadata object for a given adg
|
|
158
167
|
*/
|
|
159
168
|
export declare function upliftFakePropsFromTemplate(adg: AdgMetadata): void;
|
|
169
|
+
/**
|
|
170
|
+
* Helper function to determine if an importMetadata object is an instance of a TemplateImportMetadata
|
|
171
|
+
* @param importMetadata the import metadata object
|
|
172
|
+
* @returns true or false;
|
|
173
|
+
*/
|
|
174
|
+
export declare function isTemplateImport(importMetadata: ImportMetadata): importMetadata is TemplateImportMetadata;
|
|
160
175
|
//# sourceMappingURL=moduleMetadata.d.ts.map
|
package/build/moduleMetadata.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.upliftFakePropsFromTemplate = exports.reconcileDefaultAdg = exports.isImportInvalid = exports.reconcilePrimingAdapater = exports.reconcileWireReference = exports.composeWireFunctionMetadata = exports.
|
|
3
|
+
exports.isTemplateImport = exports.upliftFakePropsFromTemplate = exports.reconcileDefaultAdg = exports.isImportInvalid = exports.reconcilePrimingAdapater = exports.reconcileWireReference = exports.composeWireFunctionMetadata = exports.addTemplateUsageForAdg = exports.mapExportNamesToAdgs = exports.initalizeAdgMetadata = exports.collectImportMetadataFromAst = exports.getImportTemplateKomaciDocByResourceName = exports.updateAliasForImport = exports.addNewImportFromAst = exports.reconcileImport = exports.reconcileNamespace = exports.traverseAstImports = exports.composeImportMetadata = exports.initializeImportMetdataFromKomaciDocument = exports.initAdgMetadataObject = exports.initModuleMetadataObject = exports.NO_KOMACI_DOC_REF = void 0;
|
|
4
4
|
const allowlistNamespaces_1 = require("./allowlistNamespaces");
|
|
5
5
|
const komaciDocumentIntrospection_1 = require("./komaciDocumentIntrospection");
|
|
6
6
|
const types_1 = require("./types");
|
|
@@ -20,6 +20,7 @@ const initModuleMetadataObject = () => ({
|
|
|
20
20
|
importIndexReference: new Map(),
|
|
21
21
|
adgs: new Map(),
|
|
22
22
|
exports: {},
|
|
23
|
+
templateKomaciDocMap: {},
|
|
23
24
|
});
|
|
24
25
|
exports.initModuleMetadataObject = initModuleMetadataObject;
|
|
25
26
|
/**
|
|
@@ -41,8 +42,9 @@ exports.initAdgMetadataObject = initAdgMetadataObject;
|
|
|
41
42
|
* Process import references from komaci document
|
|
42
43
|
* @param doc the KomaciDocument itself
|
|
43
44
|
* @param moduleMetadata data structure representing metadata about the module we are working on
|
|
45
|
+
* @param templateAdgIndex the index of the template adg
|
|
44
46
|
*/
|
|
45
|
-
const initializeImportMetdataFromKomaciDocument = (doc, moduleMetadata,
|
|
47
|
+
const initializeImportMetdataFromKomaciDocument = (doc, moduleMetadata, templateAdgIndex) => {
|
|
46
48
|
const namespaces = doc.imports || [];
|
|
47
49
|
for (let i = 0; i < namespaces.length; i++) {
|
|
48
50
|
const importNamespace = namespaces[i];
|
|
@@ -62,14 +64,18 @@ const initializeImportMetdataFromKomaciDocument = (doc, moduleMetadata, fromTemp
|
|
|
62
64
|
const importAlias = moduleMetadata.importsByName.has(name)
|
|
63
65
|
? `${name}-${importNamespace.resourceName}`
|
|
64
66
|
: undefined;
|
|
65
|
-
(0, exports.composeImportMetadata)(name, importNamespace.resourceName, isSupported,
|
|
67
|
+
(0, exports.composeImportMetadata)(name, importNamespace.resourceName, isSupported, templateAdgIndex !== undefined
|
|
68
|
+
? `t${templateAdgIndex}-` + komaciDocImportRef
|
|
69
|
+
: komaciDocImportRef, // to prevent collision in references
|
|
66
70
|
moduleMetadata, importAlias);
|
|
67
71
|
}
|
|
68
72
|
/*
|
|
69
73
|
* For imports from other resolvable modules we know that they will always be only a default import.
|
|
70
74
|
* as such if we see one of these special imports we should snag the component id for this resolvable module
|
|
71
75
|
*/
|
|
72
|
-
const firstItem =
|
|
76
|
+
const firstItem = templateAdgIndex !== undefined
|
|
77
|
+
? `t${templateAdgIndex}-${i}/names/0`
|
|
78
|
+
: `${i}/names/0`;
|
|
73
79
|
const adgImportName = moduleMetadata.importIndexReference.get(firstItem);
|
|
74
80
|
if (namespace.resourceName.startsWith('@salesforce/komaci') && adgImportName) {
|
|
75
81
|
// name reference and the object map are built along side eachother so if one exists so does the ohter
|
|
@@ -106,7 +112,7 @@ const composeImportMetadata = (name, resourceName, isSupported, komaciDocImportR
|
|
|
106
112
|
importKey = `namespace-${resourceName}`;
|
|
107
113
|
importAlias = importKey;
|
|
108
114
|
}
|
|
109
|
-
|
|
115
|
+
let currentImport = {
|
|
110
116
|
name,
|
|
111
117
|
komaciDocImportRef,
|
|
112
118
|
importAlias,
|
|
@@ -117,6 +123,19 @@ const composeImportMetadata = (name, resourceName, isSupported, komaciDocImportR
|
|
|
117
123
|
usedInPriming: false,
|
|
118
124
|
staticallyAnalyzable: true,
|
|
119
125
|
};
|
|
126
|
+
if (allowlistNamespaces_1.isLocalHtmlImportReference.test(resourceName)) {
|
|
127
|
+
const templateKomaciDoc = getImportTemplateKomaciDocByResourceName(resourceName, moduleMetadata.templateKomaciDocMap);
|
|
128
|
+
if (templateKomaciDoc) {
|
|
129
|
+
const templateImport = {
|
|
130
|
+
...currentImport,
|
|
131
|
+
templateKomaciDoc: templateKomaciDoc,
|
|
132
|
+
};
|
|
133
|
+
currentImport = templateImport;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
currentImport.isFromSupportedLibrary = false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
120
139
|
moduleMetadata.importsByName.set(importKey, currentImport);
|
|
121
140
|
// no komaci doc ref means import is not referenced in the komaci document but was from the ast
|
|
122
141
|
if (komaciDocImportRef !== exports.NO_KOMACI_DOC_REF) {
|
|
@@ -180,7 +199,9 @@ const reconcileNamespace = (resourceName, moduleMetadata) => {
|
|
|
180
199
|
if (!namespace) {
|
|
181
200
|
namespace = {
|
|
182
201
|
names: new Set(),
|
|
183
|
-
isSupported:
|
|
202
|
+
isSupported: allowlistNamespaces_1.isLocalHtmlImportReference.exec(resourceName)
|
|
203
|
+
? (0, allowlistNamespaces_1.isSupportedNamespace)(resourceName)
|
|
204
|
+
: (0, allowlistNamespaces_1.isNamespaceInternal)((0, allowlistNamespaces_1.getNamespaceFromImport)(resourceName)),
|
|
184
205
|
resourceName: resourceName,
|
|
185
206
|
isDefaultSpecifier: false,
|
|
186
207
|
isNamespaceSpecifier: false,
|
|
@@ -255,6 +276,23 @@ const updateAliasForImport = (lookupName, referencedName, namespace, moduleMetad
|
|
|
255
276
|
}
|
|
256
277
|
};
|
|
257
278
|
exports.updateAliasForImport = updateAliasForImport;
|
|
279
|
+
/**
|
|
280
|
+
* Searches the provided tempalte komaci doc map for a document that corresponds to the provided namesapce.
|
|
281
|
+
* @param resourceName am imports resource name
|
|
282
|
+
* @param templateKomaciDocMap a map of template komaci docs.
|
|
283
|
+
*/
|
|
284
|
+
function getImportTemplateKomaciDocByResourceName(resourceName, templateKomaciDocMap) {
|
|
285
|
+
let templateImportKomaciDoc;
|
|
286
|
+
if (allowlistNamespaces_1.isLocalHtmlImportReference.test(resourceName)) {
|
|
287
|
+
const segments = (0, utils_1.getFilepathSegments)(resourceName);
|
|
288
|
+
const moduleName = segments[1].slice(1);
|
|
289
|
+
if (templateKomaciDocMap && templateKomaciDocMap[moduleName]) {
|
|
290
|
+
templateImportKomaciDoc = templateKomaciDocMap[moduleName];
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return templateImportKomaciDoc;
|
|
294
|
+
}
|
|
295
|
+
exports.getImportTemplateKomaciDocByResourceName = getImportTemplateKomaciDocByResourceName;
|
|
258
296
|
/**
|
|
259
297
|
* pull all needful import metadata we can from the ast
|
|
260
298
|
* for the most part, we can grab data from the komaci document for imports but sometimes
|
|
@@ -396,7 +434,7 @@ exports.mapExportNamesToAdgs = mapExportNamesToAdgs;
|
|
|
396
434
|
* @param moduleMetadata data structure representing metadata about the module we are working on
|
|
397
435
|
*/
|
|
398
436
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
399
|
-
const
|
|
437
|
+
const addTemplateUsageForAdg = (doc, adgIndex, moduleMetadata) => {
|
|
400
438
|
if (moduleMetadata.adgs.has(adgIndex)) {
|
|
401
439
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
402
440
|
const adg = moduleMetadata.adgs.get(adgIndex);
|
|
@@ -412,13 +450,20 @@ const addTemplateUsageForDefaultAdg = (doc, adgIndex, moduleMetadata) => {
|
|
|
412
450
|
if ((0, komaciDocumentIntrospection_1.isCompositionAComposedAdg)(comp)) {
|
|
413
451
|
adg.requiredCompositionFactoryFunctions.add(types_1.IdKeys.COMPOSED_GRAPH_FUNC);
|
|
414
452
|
if (comp.input.type === 'ImportReference') {
|
|
415
|
-
const
|
|
453
|
+
const visitedImportForTemplate = comp.input.value.startsWith(`t${adgIndex}`);
|
|
454
|
+
const importName = moduleMetadata.importIndexReference.get(visitedImportForTemplate
|
|
455
|
+
? comp.input.value
|
|
456
|
+
: `t${adgIndex}-${comp.input.value}`);
|
|
416
457
|
const importInfo = importName
|
|
417
458
|
? moduleMetadata.importsByName.get(importName)
|
|
418
459
|
: undefined;
|
|
419
460
|
if (importInfo) {
|
|
420
461
|
importInfo.usedInPriming = true;
|
|
421
462
|
}
|
|
463
|
+
//changing the comp node to be what t is referencing
|
|
464
|
+
if (!visitedImportForTemplate) {
|
|
465
|
+
comp.input.value = `t${adgIndex}-${comp.input.value}`;
|
|
466
|
+
}
|
|
422
467
|
}
|
|
423
468
|
}
|
|
424
469
|
else if ((0, komaciDocumentIntrospection_1.isCompositionASlot)(comp)) {
|
|
@@ -438,7 +483,7 @@ const addTemplateUsageForDefaultAdg = (doc, adgIndex, moduleMetadata) => {
|
|
|
438
483
|
}
|
|
439
484
|
}
|
|
440
485
|
};
|
|
441
|
-
exports.
|
|
486
|
+
exports.addTemplateUsageForAdg = addTemplateUsageForAdg;
|
|
442
487
|
/**
|
|
443
488
|
* Collect functional metadata for a wire this includes
|
|
444
489
|
* - wire function details (name, batch / reducer if priming function)
|
|
@@ -561,10 +606,10 @@ exports.isImportInvalid = isImportInvalid;
|
|
|
561
606
|
*/
|
|
562
607
|
function reconcileDefaultAdg(currentDefaultAdgIndex, moduleMetadata) {
|
|
563
608
|
let componentDefaultAdgIndex = currentDefaultAdgIndex;
|
|
564
|
-
if (componentDefaultAdgIndex === undefined) {
|
|
565
|
-
|
|
609
|
+
if (componentDefaultAdgIndex === undefined && moduleMetadata.adgs.size === 0) {
|
|
610
|
+
componentDefaultAdgIndex = moduleMetadata.adgGeneratorIndex++;
|
|
611
|
+
const fakeDefaultAdg = (0, exports.initAdgMetadataObject)(`adg${componentDefaultAdgIndex}`);
|
|
566
612
|
fakeDefaultAdg.requiredAdgFactoryFunctions.add(types_1.IdKeys.ADG_FUNC);
|
|
567
|
-
componentDefaultAdgIndex = 0;
|
|
568
613
|
moduleMetadata.adgs.set(componentDefaultAdgIndex, fakeDefaultAdg);
|
|
569
614
|
moduleMetadata.exports.default = fakeDefaultAdg;
|
|
570
615
|
}
|
|
@@ -588,4 +633,14 @@ function upliftFakePropsFromTemplate(adg) {
|
|
|
588
633
|
}
|
|
589
634
|
}
|
|
590
635
|
exports.upliftFakePropsFromTemplate = upliftFakePropsFromTemplate;
|
|
636
|
+
/**
|
|
637
|
+
* Helper function to determine if an importMetadata object is an instance of a TemplateImportMetadata
|
|
638
|
+
* @param importMetadata the import metadata object
|
|
639
|
+
* @returns true or false;
|
|
640
|
+
*/
|
|
641
|
+
function isTemplateImport(importMetadata) {
|
|
642
|
+
const temp = importMetadata.templateKomaciDoc;
|
|
643
|
+
return temp != undefined;
|
|
644
|
+
}
|
|
645
|
+
exports.isTemplateImport = isTemplateImport;
|
|
591
646
|
//# sourceMappingURL=moduleMetadata.js.map
|
package/build/types.d.ts
CHANGED
|
@@ -118,7 +118,7 @@ export declare type ImportPropertyContext = BasePropertyContext & {
|
|
|
118
118
|
/**
|
|
119
119
|
* Basic details about an Import
|
|
120
120
|
*/
|
|
121
|
-
export declare type
|
|
121
|
+
export declare type BasicImportMetadata = {
|
|
122
122
|
/** The name of the import as defined in the import object on komaci doc */
|
|
123
123
|
name: string;
|
|
124
124
|
/** The alias set for an import in the original module. i.e. `import { item as importAlias } from 'importPath'` */
|
|
@@ -143,6 +143,16 @@ export declare type ImportMetadata = {
|
|
|
143
143
|
*/
|
|
144
144
|
componentId?: string;
|
|
145
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* A type of import that extends the basic import metadata object to include a template komaci doc for an import.
|
|
148
|
+
*/
|
|
149
|
+
export declare type TemplateImportMetadata = BasicImportMetadata & {
|
|
150
|
+
templateKomaciDoc: KomaciDocument;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Main type for import meta data.
|
|
154
|
+
*/
|
|
155
|
+
export declare type ImportMetadata = BasicImportMetadata | TemplateImportMetadata;
|
|
146
156
|
export declare type ImportIndexReference = Record<string, ImportMetadata>;
|
|
147
157
|
/**
|
|
148
158
|
* Map for all class properties and their basic, KomaciDoc analyzable metadata.
|
|
@@ -257,6 +267,9 @@ export declare type ModuleMetadata = {
|
|
|
257
267
|
importIndexReference: Map<string, string>;
|
|
258
268
|
adgs: Map<number, AdgMetadata>;
|
|
259
269
|
exports: Record<string, AdgMetadata>;
|
|
270
|
+
templateKomaciDocMap: {
|
|
271
|
+
[fName: string]: KomaciDocument;
|
|
272
|
+
};
|
|
260
273
|
};
|
|
261
274
|
export declare type ImportBinding = {
|
|
262
275
|
importPath: string;
|
package/build/utils.d.ts
CHANGED
|
@@ -151,4 +151,10 @@ export declare function updateKomaciDocumentWithValidTemplatedStrings(komaciScri
|
|
|
151
151
|
* @param propertyName name of the property to update
|
|
152
152
|
*/
|
|
153
153
|
export declare function addPropertyFunction(adg: Adg, propertyName: string, func: FunctionType): number;
|
|
154
|
+
/**
|
|
155
|
+
* Function to slpit an import path seperated by . EX: ./test.html = [, /test, html ]
|
|
156
|
+
* @param fullFilename the full file name
|
|
157
|
+
* @returns the full file name separated into segments.
|
|
158
|
+
*/
|
|
159
|
+
export declare function getFilepathSegments(fullFilename: string): string[];
|
|
154
160
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/utils.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addPropertyFunction = exports.updateKomaciDocumentWithValidTemplatedStrings = exports.updateKomaciDocumentWithValidGetters = exports.isDeclaredInAst = exports.isExpressionThisOrAlias = exports.getThisAliasDeclaredInGetter = exports.isPropertyNodeUsed = exports.isGetterNodeUsed = exports.isPropertyUsed = exports.getClassMethodName = exports.getVariablesDeclaredInGetter = exports.isExternalModule = exports.getAstContextObject = exports.getAllClassMethods = exports.getAllModuleVaraibles = exports.getAllModuleFunctions = exports.getFromIdentifierOrStringLiteral = exports.collectImportUsage = exports.getMemberVarsFromGetter = exports.implicitConsumptionMetadata = exports.getPropertyMetadataFromAst = exports.TEMPLATED_STRING_FUNCTION = exports.GETTER_FUNCTION = exports.ONE_NS = exports.FORCE_NS = exports.LIGHTNING_NS = void 0;
|
|
3
|
+
exports.getFilepathSegments = exports.addPropertyFunction = exports.updateKomaciDocumentWithValidTemplatedStrings = exports.updateKomaciDocumentWithValidGetters = exports.isDeclaredInAst = exports.isExpressionThisOrAlias = exports.getThisAliasDeclaredInGetter = exports.isPropertyNodeUsed = exports.isGetterNodeUsed = exports.isPropertyUsed = exports.getClassMethodName = exports.getVariablesDeclaredInGetter = exports.isExternalModule = exports.getAstContextObject = exports.getAllClassMethods = exports.getAllModuleVaraibles = exports.getAllModuleFunctions = exports.getFromIdentifierOrStringLiteral = exports.collectImportUsage = exports.getMemberVarsFromGetter = exports.implicitConsumptionMetadata = exports.getPropertyMetadataFromAst = exports.TEMPLATED_STRING_FUNCTION = exports.GETTER_FUNCTION = exports.ONE_NS = exports.FORCE_NS = exports.LIGHTNING_NS = void 0;
|
|
4
4
|
const core_1 = require("@babel/core");
|
|
5
|
+
const types_1 = require("./types");
|
|
5
6
|
exports.LIGHTNING_NS = 'lightning';
|
|
6
7
|
exports.FORCE_NS = 'force';
|
|
7
8
|
exports.ONE_NS = 'one';
|
|
@@ -491,4 +492,17 @@ function addPropertyFunction(adg, propertyName, func) {
|
|
|
491
492
|
return refIndex;
|
|
492
493
|
}
|
|
493
494
|
exports.addPropertyFunction = addPropertyFunction;
|
|
495
|
+
/**
|
|
496
|
+
* Function to slpit an import path seperated by . EX: ./test.html = [, /test, html ]
|
|
497
|
+
* @param fullFilename the full file name
|
|
498
|
+
* @returns the full file name separated into segments.
|
|
499
|
+
*/
|
|
500
|
+
function getFilepathSegments(fullFilename) {
|
|
501
|
+
const segments = fullFilename.split('.');
|
|
502
|
+
if (segments.length < 2) {
|
|
503
|
+
throw new Error(types_1.ERROR_PREFIX + 'unable to determine file type');
|
|
504
|
+
}
|
|
505
|
+
return segments;
|
|
506
|
+
}
|
|
507
|
+
exports.getFilepathSegments = getFilepathSegments;
|
|
494
508
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@komaci/common-shared",
|
|
3
|
-
"version": "242.1.
|
|
3
|
+
"version": "242.1.3",
|
|
4
4
|
"description": "Assets that are shared across Komaci commonjs packages",
|
|
5
5
|
"homepage": "https://komaci.dev/",
|
|
6
6
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"build/komaci-mapping.json"
|
|
30
30
|
],
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@komaci/types": "242.1.
|
|
32
|
+
"@komaci/types": "242.1.3"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/core": "^7.9.0",
|