@komaci/esm-generator 248.1.3 → 248.1.4
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.
|
@@ -982,8 +982,8 @@ describe('generateGqlImportStatement', () => {
|
|
|
982
982
|
},
|
|
983
983
|
isHoisted: false,
|
|
984
984
|
valid: true,
|
|
985
|
-
generatedImportAlias: '
|
|
986
|
-
importPath: '@salesforce/
|
|
985
|
+
generatedImportAlias: '_123456',
|
|
986
|
+
importPath: '@salesforce/lds/c__component',
|
|
987
987
|
};
|
|
988
988
|
gqlMetadataMap.set('loc_242_801', gqlMetadata);
|
|
989
989
|
const gqlMetadata2 = {
|
|
@@ -999,7 +999,7 @@ describe('generateGqlImportStatement', () => {
|
|
|
999
999
|
},
|
|
1000
1000
|
isHoisted: false,
|
|
1001
1001
|
valid: false,
|
|
1002
|
-
generatedImportAlias: '
|
|
1002
|
+
generatedImportAlias: '_123456789',
|
|
1003
1003
|
importPath: 'temp/path',
|
|
1004
1004
|
};
|
|
1005
1005
|
gqlMetadataMap.set('loc_826_1316', gqlMetadata2);
|
|
@@ -1007,7 +1007,7 @@ describe('generateGqlImportStatement', () => {
|
|
|
1007
1007
|
(0, genericAstGeneration_1.generateGqlImportStatements)(gqlMetadataMap, statements);
|
|
1008
1008
|
expect(statements).toHaveLength(1);
|
|
1009
1009
|
const code = (0, generator_1.default)(statements[0]).code;
|
|
1010
|
-
expect(code).toBe('import
|
|
1010
|
+
expect(code).toBe('import { _123456 } from "@salesforce/lds/c__component";');
|
|
1011
1011
|
});
|
|
1012
1012
|
});
|
|
1013
1013
|
//# sourceMappingURL=genericAstGeneration.spec.js.map
|
|
@@ -85,7 +85,7 @@ function generateResolvableModule(input, scriptKomaciDoc, templateKomaciDocMap,
|
|
|
85
85
|
(0, common_shared_1.mapExportNamesToAdgs)(scriptKomaciDoc.exports, moduleMetadata);
|
|
86
86
|
//we have a gql tag init the map
|
|
87
87
|
if (input.luvioMetadata && input.luvioMetadata?.gqlTag.length > 0) {
|
|
88
|
-
(0, common_shared_1.initGqlMetadata)(input.luvioMetadata.gqlTag, moduleMetadata);
|
|
88
|
+
(0, common_shared_1.initGqlMetadata)(input.luvioMetadata.gqlTag, moduleMetadata, input.moduleInfo.namespace, input.moduleInfo.name);
|
|
89
89
|
}
|
|
90
90
|
if (ast && componentDefaultAdgIndex !== undefined) {
|
|
91
91
|
const { getters, templateStrings, renderFunction } = (0, common_shared_1.getPropertyMetadataFromAst)(ast);
|
|
@@ -299,10 +299,18 @@ exports.addImportStatements = addImportStatements;
|
|
|
299
299
|
* @param statements the ast statement array.
|
|
300
300
|
*/
|
|
301
301
|
function generateGqlImportStatements(gqlMetadata, statements) {
|
|
302
|
+
const importsToMake = new Map();
|
|
302
303
|
gqlMetadata.forEach((value) => {
|
|
303
304
|
if (value.valid) {
|
|
304
|
-
|
|
305
|
-
|
|
305
|
+
let imports = [];
|
|
306
|
+
if (!importsToMake.has(value.importPath)) {
|
|
307
|
+
importsToMake.set(value.importPath, imports);
|
|
308
|
+
const importStatement = t.importDeclaration(imports, t.stringLiteral(value.importPath));
|
|
309
|
+
statements.push(importStatement);
|
|
310
|
+
}
|
|
311
|
+
imports = importsToMake.get(value.importPath);
|
|
312
|
+
const aliasIdentifier = t.identifier(value.generatedImportAlias);
|
|
313
|
+
imports.push(t.importSpecifier(aliasIdentifier, aliasIdentifier));
|
|
306
314
|
}
|
|
307
315
|
});
|
|
308
316
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@komaci/esm-generator",
|
|
3
|
-
"version": "248.1.
|
|
3
|
+
"version": "248.1.4",
|
|
4
4
|
"description": "Komaci generator for ADG ES modules",
|
|
5
5
|
"homepage": "https://komaci.dev/",
|
|
6
6
|
"repository": {
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"@babel/core": "^7.9.0",
|
|
30
30
|
"@babel/generator": "^7.9.0",
|
|
31
31
|
"@babel/types": "^7.9.0",
|
|
32
|
-
"@komaci/common-shared": "248.1.
|
|
33
|
-
"@komaci/static-analyzer": "248.1.
|
|
32
|
+
"@komaci/common-shared": "248.1.4",
|
|
33
|
+
"@komaci/static-analyzer": "248.1.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@komaci/types": "248.1.
|
|
36
|
+
"@komaci/types": "248.1.4",
|
|
37
37
|
"@lwc-platform/sfdc-lwc-compiler": "248.3.9-3.5.0",
|
|
38
38
|
"@lwc/metadata": "3.5.0-0"
|
|
39
39
|
}
|