@komaci/esm-generator 242.1.0 → 242.1.1
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/__tests__/compositionAstGeneration.spec.js +8 -6
- package/build/__tests__/fixtures-combined-files/only-named-export-with-template/actual.d.ts +1 -0
- package/build/__tests__/fixtures-combined-files/only-named-export-with-template/actual.js +2 -0
- package/build/__tests__/functionAstGeneration.spec.js +8 -4
- package/build/__tests__/genericAstGeneration.spec.js +291 -0
- package/build/__tests__/index.spec.js +24 -12
- package/build/compositionAstGeneration.js +1 -1
- package/build/functionAstGeneration.js +21 -13
- package/build/genericAstGeneration.d.ts +10 -2
- package/build/genericAstGeneration.js +55 -11
- package/build/index.js +7 -16
- package/package.json +4 -4
|
@@ -193,7 +193,7 @@ describe('imageToExpression', () => {
|
|
|
193
193
|
});
|
|
194
194
|
describe('compositionToArrayExpression', () => {
|
|
195
195
|
const moduleMetadata = (0, common_shared_1.initModuleMetadataObject)();
|
|
196
|
-
(0, common_shared_1.initializeImportMetdataFromKomaciDocument)(complexDoc, moduleMetadata,
|
|
196
|
+
(0, common_shared_1.initializeImportMetdataFromKomaciDocument)(complexDoc, moduleMetadata, 0);
|
|
197
197
|
it('could handle a single composition', () => {
|
|
198
198
|
const res = (0, compositionAstGeneration_1.compositionsToArrayExpression)(moduleMetadata, [
|
|
199
199
|
complexDoc.compositions[0].compositions[2].compositions[0],
|
|
@@ -215,7 +215,9 @@ describe('compositionToArrayExpression', () => {
|
|
|
215
215
|
});
|
|
216
216
|
describe('compositionToExpression', () => {
|
|
217
217
|
const moduleMetadata = (0, common_shared_1.initModuleMetadataObject)();
|
|
218
|
-
(0, common_shared_1.initializeImportMetdataFromKomaciDocument)(complexDoc, moduleMetadata,
|
|
218
|
+
(0, common_shared_1.initializeImportMetdataFromKomaciDocument)(complexDoc, moduleMetadata, 0);
|
|
219
|
+
moduleMetadata.adgs.set(0, (0, common_shared_1.initAdgMetadataObject)('adg0'));
|
|
220
|
+
(0, common_shared_1.addTemplateUsageForAdg)(complexDoc, 0, moduleMetadata);
|
|
219
221
|
it('effectiely builds a conditional expression for a component with isActive', () => {
|
|
220
222
|
const res = (0, compositionAstGeneration_1.compositionToExpression)(moduleMetadata, complexDoc.compositions[0].compositions[2].compositions[1]);
|
|
221
223
|
expect(res.type).toBe('ConditionalExpression');
|
|
@@ -237,7 +239,7 @@ describe('compositionToExpression', () => {
|
|
|
237
239
|
});
|
|
238
240
|
describe('containerToExpression', () => {
|
|
239
241
|
const moduleMetadata = (0, common_shared_1.initModuleMetadataObject)();
|
|
240
|
-
(0, common_shared_1.initializeImportMetdataFromKomaciDocument)(complexDoc, moduleMetadata,
|
|
242
|
+
(0, common_shared_1.initializeImportMetdataFromKomaciDocument)(complexDoc, moduleMetadata, 0);
|
|
241
243
|
it('uses the element function when container has a key', () => {
|
|
242
244
|
const container = Object.assign({}, complexDoc.compositions[0].compositions[2].compositions[0]);
|
|
243
245
|
container.key = { type: 'Binding', value: 'test' };
|
|
@@ -264,7 +266,7 @@ describe('containerToExpression', () => {
|
|
|
264
266
|
});
|
|
265
267
|
describe('composedAdgToExpression', () => {
|
|
266
268
|
const moduleMetadata = (0, common_shared_1.initModuleMetadataObject)();
|
|
267
|
-
(0, common_shared_1.initializeImportMetdataFromKomaciDocument)(complexDoc, moduleMetadata,
|
|
269
|
+
(0, common_shared_1.initializeImportMetdataFromKomaciDocument)(complexDoc, moduleMetadata, 0);
|
|
268
270
|
it('properly composed composedAdg with no children', () => {
|
|
269
271
|
const res = (0, compositionAstGeneration_1.composedAdgToExpression)(moduleMetadata, complexDoc.compositions[0].compositions[1].compositions[1]
|
|
270
272
|
.compositions[0]);
|
|
@@ -283,7 +285,7 @@ describe('composedAdgToExpression', () => {
|
|
|
283
285
|
});
|
|
284
286
|
describe('iterationToExpression', () => {
|
|
285
287
|
const moduleMetadata = (0, common_shared_1.initModuleMetadataObject)();
|
|
286
|
-
(0, common_shared_1.initializeImportMetdataFromKomaciDocument)(complexDoc, moduleMetadata,
|
|
288
|
+
(0, common_shared_1.initializeImportMetdataFromKomaciDocument)(complexDoc, moduleMetadata, 0);
|
|
287
289
|
it('can compose an iteration factory call from a iterator composition', () => {
|
|
288
290
|
const res = (0, compositionAstGeneration_1.iterationToExpression)(moduleMetadata, {
|
|
289
291
|
type: 'Iteration',
|
|
@@ -297,7 +299,7 @@ describe('iterationToExpression', () => {
|
|
|
297
299
|
type: 'ComposedAdg',
|
|
298
300
|
input: {
|
|
299
301
|
type: 'ImportReference',
|
|
300
|
-
value: '0/names/0',
|
|
302
|
+
value: 't0-0/names/0',
|
|
301
303
|
},
|
|
302
304
|
properties: {
|
|
303
305
|
label: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=actual.d.ts.map
|
|
@@ -377,8 +377,8 @@ describe('adgToExpression', () => {
|
|
|
377
377
|
const result = (0, functionAstGeneration_1.adgToExpression)(adgMetadata, moduleMetadata);
|
|
378
378
|
expect(result).not.toBeUndefined();
|
|
379
379
|
expect(result.arguments).toHaveLength(5);
|
|
380
|
-
expect(result.arguments[0].type).toBe('
|
|
381
|
-
expect(result.arguments[0].
|
|
380
|
+
expect(result.arguments[0].type).toBe('Identifier');
|
|
381
|
+
expect(result.arguments[0].name).toBe('i1');
|
|
382
382
|
expect(result.arguments[1].type).toBe('ObjectExpression');
|
|
383
383
|
expect(result.arguments[2].type).toBe('ArrayExpression');
|
|
384
384
|
expect(result.arguments[2].elements).toHaveLength(0);
|
|
@@ -389,7 +389,9 @@ describe('adgToExpression', () => {
|
|
|
389
389
|
});
|
|
390
390
|
describe('produceErrorAdgFunction', () => {
|
|
391
391
|
it('should produce a resolvable module with an adg with only one node that shows what the error was', () => {
|
|
392
|
-
const expected = `
|
|
392
|
+
const expected = `import registerAdgFunction from "komaci/registerAdgFunction";
|
|
393
|
+
|
|
394
|
+
function adg0(fct, ctx) {
|
|
393
395
|
const {
|
|
394
396
|
adg
|
|
395
397
|
} = fct;
|
|
@@ -402,7 +404,9 @@ describe('produceErrorAdgFunction', () => {
|
|
|
402
404
|
}], (fct, ctx) => {
|
|
403
405
|
return [];
|
|
404
406
|
}, []);
|
|
405
|
-
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export default registerAdgFunction(adg0);`;
|
|
406
410
|
const testError = new Error('something bad happened');
|
|
407
411
|
testError.stack = 'full stack normally';
|
|
408
412
|
const res = (0, functionAstGeneration_1.produceErrorAdgFunction)((0, common_shared_1.initModuleMetadataObject)(), testError);
|
|
@@ -583,4 +583,295 @@ describe('addImportStatements', () => {
|
|
|
583
583
|
expect(combinedImport).not.toBeUndefined();
|
|
584
584
|
});
|
|
585
585
|
});
|
|
586
|
+
describe('collectMetadataForNonDefaultTemplates', () => {
|
|
587
|
+
const templateMap = {};
|
|
588
|
+
beforeEach(() => {
|
|
589
|
+
// fixture-template-files/component-refernece
|
|
590
|
+
templateMap['component-reference'] = {
|
|
591
|
+
compositions: [
|
|
592
|
+
{
|
|
593
|
+
type: 'Container',
|
|
594
|
+
compositions: [
|
|
595
|
+
{
|
|
596
|
+
type: 'ComposedAdg',
|
|
597
|
+
input: {
|
|
598
|
+
type: 'ImportReference',
|
|
599
|
+
value: '0/names/0',
|
|
600
|
+
},
|
|
601
|
+
properties: {},
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
type: 'ComposedAdg',
|
|
605
|
+
input: {
|
|
606
|
+
type: 'ImportReference',
|
|
607
|
+
value: '0/names/0',
|
|
608
|
+
},
|
|
609
|
+
properties: {
|
|
610
|
+
attribute1: {
|
|
611
|
+
type: 'PrimitiveValue',
|
|
612
|
+
value: 'literalString1',
|
|
613
|
+
},
|
|
614
|
+
attribute2: {
|
|
615
|
+
type: 'PrimitiveValue',
|
|
616
|
+
value: 'lteralString2',
|
|
617
|
+
},
|
|
618
|
+
},
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
type: 'ComposedAdg',
|
|
622
|
+
input: {
|
|
623
|
+
type: 'ImportReference',
|
|
624
|
+
value: '0/names/0',
|
|
625
|
+
},
|
|
626
|
+
properties: {
|
|
627
|
+
attribute1: {
|
|
628
|
+
type: 'Binding',
|
|
629
|
+
value: 'record',
|
|
630
|
+
},
|
|
631
|
+
attribute2: {
|
|
632
|
+
type: 'Binding',
|
|
633
|
+
value: 'recordId',
|
|
634
|
+
},
|
|
635
|
+
attribute3: {
|
|
636
|
+
type: 'Binding',
|
|
637
|
+
value: 'record/data/Name',
|
|
638
|
+
},
|
|
639
|
+
},
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
type: 'ComposedAdg',
|
|
643
|
+
input: {
|
|
644
|
+
type: 'ImportReference',
|
|
645
|
+
value: '0/names/0',
|
|
646
|
+
},
|
|
647
|
+
properties: {
|
|
648
|
+
attribute1: {
|
|
649
|
+
type: 'PrimitiveValue',
|
|
650
|
+
value: 'literalString1',
|
|
651
|
+
},
|
|
652
|
+
attribute2: {
|
|
653
|
+
type: 'Binding',
|
|
654
|
+
value: 'recordId',
|
|
655
|
+
},
|
|
656
|
+
attribute3: {
|
|
657
|
+
type: 'PrimitiveValue',
|
|
658
|
+
value: true,
|
|
659
|
+
},
|
|
660
|
+
},
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
type: 'ComposedAdg',
|
|
664
|
+
input: {
|
|
665
|
+
type: 'ImportReference',
|
|
666
|
+
value: '0/names/0',
|
|
667
|
+
},
|
|
668
|
+
properties: {
|
|
669
|
+
attributeUpperCase: {
|
|
670
|
+
type: 'PrimitiveValue',
|
|
671
|
+
value: 'convert kebab to camel',
|
|
672
|
+
},
|
|
673
|
+
},
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
type: 'ComposedAdg',
|
|
677
|
+
input: {
|
|
678
|
+
type: 'ImportReference',
|
|
679
|
+
value: '0/names/0',
|
|
680
|
+
},
|
|
681
|
+
properties: {
|
|
682
|
+
StartsWithUpperCase: {
|
|
683
|
+
type: 'PrimitiveValue',
|
|
684
|
+
value: 'should be StartsWithUpperCase',
|
|
685
|
+
},
|
|
686
|
+
},
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
type: 'ComposedAdg',
|
|
690
|
+
input: {
|
|
691
|
+
type: 'ImportReference',
|
|
692
|
+
value: '1/names/0',
|
|
693
|
+
},
|
|
694
|
+
properties: {},
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
type: 'ComposedAdg',
|
|
698
|
+
input: {
|
|
699
|
+
type: 'ImportReference',
|
|
700
|
+
value: '2/names/0',
|
|
701
|
+
},
|
|
702
|
+
properties: {
|
|
703
|
+
label: {
|
|
704
|
+
type: 'PrimitiveValue',
|
|
705
|
+
value: 'Base',
|
|
706
|
+
},
|
|
707
|
+
title: {
|
|
708
|
+
type: 'PrimitiveValue',
|
|
709
|
+
value: 'Looks like a link',
|
|
710
|
+
},
|
|
711
|
+
variant: {
|
|
712
|
+
type: 'PrimitiveValue',
|
|
713
|
+
value: 'base',
|
|
714
|
+
},
|
|
715
|
+
},
|
|
716
|
+
},
|
|
717
|
+
],
|
|
718
|
+
},
|
|
719
|
+
],
|
|
720
|
+
imports: [
|
|
721
|
+
{
|
|
722
|
+
resourceName: '@salesforce/komaci/c__child1__child1.js',
|
|
723
|
+
names: ['default'],
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
resourceName: '@salesforce/komaci/c__upperCaseInName__upperCaseInName.js',
|
|
727
|
+
names: ['default'],
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
resourceName: '@salesforce/komaci/lightning__button__button.js',
|
|
731
|
+
names: ['default'],
|
|
732
|
+
},
|
|
733
|
+
],
|
|
734
|
+
exports: {
|
|
735
|
+
default: {
|
|
736
|
+
type: 'CompositionReference',
|
|
737
|
+
value: 0,
|
|
738
|
+
},
|
|
739
|
+
},
|
|
740
|
+
};
|
|
741
|
+
//fixture-template-files/conditional-simple
|
|
742
|
+
templateMap['conditional-simple'] = {
|
|
743
|
+
compositions: [
|
|
744
|
+
{
|
|
745
|
+
type: 'Container',
|
|
746
|
+
compositions: [
|
|
747
|
+
{
|
|
748
|
+
type: 'Container',
|
|
749
|
+
isActive: {
|
|
750
|
+
input: {
|
|
751
|
+
type: 'Binding',
|
|
752
|
+
value: 'someCondition',
|
|
753
|
+
},
|
|
754
|
+
negate: false,
|
|
755
|
+
},
|
|
756
|
+
compositions: [
|
|
757
|
+
{
|
|
758
|
+
type: 'ComposedAdg',
|
|
759
|
+
input: {
|
|
760
|
+
type: 'ImportReference',
|
|
761
|
+
value: '0/names/0',
|
|
762
|
+
},
|
|
763
|
+
properties: {},
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
type: 'ComposedAdg',
|
|
767
|
+
input: {
|
|
768
|
+
type: 'ImportReference',
|
|
769
|
+
value: '1/names/0',
|
|
770
|
+
},
|
|
771
|
+
properties: {},
|
|
772
|
+
},
|
|
773
|
+
],
|
|
774
|
+
},
|
|
775
|
+
],
|
|
776
|
+
},
|
|
777
|
+
],
|
|
778
|
+
exports: {
|
|
779
|
+
default: {
|
|
780
|
+
type: 'CompositionReference',
|
|
781
|
+
value: 0,
|
|
782
|
+
},
|
|
783
|
+
},
|
|
784
|
+
imports: [
|
|
785
|
+
{
|
|
786
|
+
resourceName: '@salesforce/komaci/c__child1__child1.js',
|
|
787
|
+
names: ['default'],
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
resourceName: '@salesforce/komaci/c__child2__child2.js',
|
|
791
|
+
names: ['default'],
|
|
792
|
+
},
|
|
793
|
+
],
|
|
794
|
+
};
|
|
795
|
+
});
|
|
796
|
+
it('collects metadata info for non default templates', () => {
|
|
797
|
+
const moduleMetadata = (0, common_shared_1.initModuleMetadataObject)();
|
|
798
|
+
moduleMetadata.templateKomaciDocMap = templateMap;
|
|
799
|
+
moduleMetadata.adgGeneratorIndex = 1;
|
|
800
|
+
const defaultAdg = (0, common_shared_1.initAdgMetadataObject)('adg0');
|
|
801
|
+
moduleMetadata.adgs.set(0, defaultAdg);
|
|
802
|
+
const templateImport = {
|
|
803
|
+
name: 'default',
|
|
804
|
+
komaciDocImportRef: '0/names/0',
|
|
805
|
+
importAlias: 'child1',
|
|
806
|
+
generatorAlias: 'i0',
|
|
807
|
+
resourceName: './conditional-simple',
|
|
808
|
+
staticallyAnalyzable: true,
|
|
809
|
+
templateKomaciDoc: templateMap['conditional-simple'],
|
|
810
|
+
usedInPriming: true,
|
|
811
|
+
isFromInternalNamespace: true,
|
|
812
|
+
isFromSupportedLibrary: true,
|
|
813
|
+
};
|
|
814
|
+
moduleMetadata.importsByName.set('child1', templateImport);
|
|
815
|
+
//assuming that component-reference is the default.
|
|
816
|
+
(0, genericAstGeneration_1.collectMetadataForNonDefaultTemplates)(moduleMetadata, 'component-reference');
|
|
817
|
+
expect(moduleMetadata.adgGeneratorIndex).toBe(2);
|
|
818
|
+
expect(moduleMetadata.importGeneratorIndex).toBe(2);
|
|
819
|
+
expect(moduleMetadata.importIndexReference.get('t1-0/names/0')).not.toBeUndefined();
|
|
820
|
+
expect(moduleMetadata.importIndexReference.get('t1-1/names/0')).not.toBeUndefined();
|
|
821
|
+
});
|
|
822
|
+
it('collects metadata info for non default templates, multiple non default templates', () => {
|
|
823
|
+
templateMap['default-template'] = {};
|
|
824
|
+
const moduleMetadata = (0, common_shared_1.initModuleMetadataObject)();
|
|
825
|
+
moduleMetadata.templateKomaciDocMap = templateMap;
|
|
826
|
+
moduleMetadata.adgGeneratorIndex = 1;
|
|
827
|
+
const defaultAdg = (0, common_shared_1.initAdgMetadataObject)('adg0');
|
|
828
|
+
moduleMetadata.adgs.set(0, defaultAdg);
|
|
829
|
+
const templateImport = {
|
|
830
|
+
name: 'default',
|
|
831
|
+
komaciDocImportRef: '0/names/0',
|
|
832
|
+
importAlias: 'child1',
|
|
833
|
+
generatorAlias: 'i0',
|
|
834
|
+
resourceName: './component-reference',
|
|
835
|
+
staticallyAnalyzable: true,
|
|
836
|
+
templateKomaciDoc: templateMap['component-reference'],
|
|
837
|
+
usedInPriming: true,
|
|
838
|
+
isFromInternalNamespace: true,
|
|
839
|
+
isFromSupportedLibrary: true,
|
|
840
|
+
};
|
|
841
|
+
moduleMetadata.importsByName.set('child1', templateImport);
|
|
842
|
+
const templateImport2 = {
|
|
843
|
+
name: 'default',
|
|
844
|
+
komaciDocImportRef: '1/names/0',
|
|
845
|
+
importAlias: 'child2',
|
|
846
|
+
generatorAlias: 'i1',
|
|
847
|
+
resourceName: './conditional-simple',
|
|
848
|
+
staticallyAnalyzable: true,
|
|
849
|
+
templateKomaciDoc: templateMap['conditional-simple'],
|
|
850
|
+
usedInPriming: true,
|
|
851
|
+
isFromInternalNamespace: true,
|
|
852
|
+
isFromSupportedLibrary: true,
|
|
853
|
+
};
|
|
854
|
+
moduleMetadata.importsByName.set('child2', templateImport2);
|
|
855
|
+
//assuming that component-reference is the default.
|
|
856
|
+
(0, genericAstGeneration_1.collectMetadataForNonDefaultTemplates)(moduleMetadata, 'default-template');
|
|
857
|
+
expect(moduleMetadata.adgGeneratorIndex).toBe(3);
|
|
858
|
+
expect(moduleMetadata.importGeneratorIndex).toBe(5);
|
|
859
|
+
expect(moduleMetadata.importIndexReference.get('t1-0/names/0')).not.toBeUndefined();
|
|
860
|
+
expect(moduleMetadata.importIndexReference.get('t1-1/names/0')).not.toBeUndefined();
|
|
861
|
+
expect(moduleMetadata.importIndexReference.get('t1-2/names/0')).not.toBeUndefined();
|
|
862
|
+
expect(moduleMetadata.importIndexReference.get('t2-0/names/0')).not.toBeUndefined();
|
|
863
|
+
expect(moduleMetadata.importIndexReference.get('t2-1/names/0')).not.toBeUndefined();
|
|
864
|
+
});
|
|
865
|
+
it('no changes when only looking at the default', () => {
|
|
866
|
+
const moduleMetadata = (0, common_shared_1.initModuleMetadataObject)();
|
|
867
|
+
moduleMetadata.templateKomaciDocMap = templateMap;
|
|
868
|
+
moduleMetadata.adgGeneratorIndex = 1;
|
|
869
|
+
const defaultAdg = (0, common_shared_1.initAdgMetadataObject)('adg0');
|
|
870
|
+
moduleMetadata.adgs.set(0, defaultAdg);
|
|
871
|
+
//assuming that component-reference is the default.
|
|
872
|
+
(0, genericAstGeneration_1.collectMetadataForNonDefaultTemplates)(moduleMetadata, 'component-reference');
|
|
873
|
+
expect(moduleMetadata.adgGeneratorIndex).toBe(1);
|
|
874
|
+
expect(moduleMetadata.importGeneratorIndex).toBe(0);
|
|
875
|
+
});
|
|
876
|
+
});
|
|
586
877
|
//# sourceMappingURL=genericAstGeneration.spec.js.map
|
|
@@ -41,7 +41,8 @@ describe('Handling errors that throw inside a call to generateKomaciModule', ()
|
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
43
|
const res = (0, __1.generateKomaciModule)(input);
|
|
44
|
-
const expectedModuleFirstHalf = '
|
|
44
|
+
const expectedModuleFirstHalf = 'import registerAdgFunction from "komaci/registerAdgFunction";\n\n' +
|
|
45
|
+
'function adg0(fct, ctx) {\n' +
|
|
45
46
|
' const {\n' +
|
|
46
47
|
' adg\n' +
|
|
47
48
|
' } = fct;\n' +
|
|
@@ -49,10 +50,13 @@ describe('Handling errors that throw inside a call to generateKomaciModule', ()
|
|
|
49
50
|
' t: "ErrorFunction",\n' +
|
|
50
51
|
' c: {\n' +
|
|
51
52
|
' "error": "[komaci esm-generator] unrecognized input type",\n';
|
|
52
|
-
const expectedModuleSecondHalf = ' return [];\n' +
|
|
53
|
+
const expectedModuleSecondHalf = ' return [];\n' +
|
|
54
|
+
' }, []);\n' +
|
|
55
|
+
'}\n' +
|
|
56
|
+
'\nexport default registerAdgFunction(adg0);';
|
|
53
57
|
const lines = res.split('\n');
|
|
54
|
-
const skipStack = lines.slice(0,
|
|
55
|
-
const skipStackEnd = lines.slice(lines.length -
|
|
58
|
+
const skipStack = lines.slice(0, 10).join('\n') + '\n';
|
|
59
|
+
const skipStackEnd = lines.slice(lines.length - 5).join('\n');
|
|
56
60
|
expect(skipStack).toBe(expectedModuleFirstHalf);
|
|
57
61
|
expect(skipStackEnd).toBe(expectedModuleSecondHalf);
|
|
58
62
|
});
|
|
@@ -75,7 +79,8 @@ describe('Handling errors that throw inside a call to generateKomaciModule', ()
|
|
|
75
79
|
throw 'not an error';
|
|
76
80
|
});
|
|
77
81
|
const res = (0, __1.generateKomaciModule)(input);
|
|
78
|
-
const expectedModuleFirstHalf = '
|
|
82
|
+
const expectedModuleFirstHalf = 'import registerAdgFunction from "komaci/registerAdgFunction";\n\n' +
|
|
83
|
+
'function adg0(fct, ctx) {\n' +
|
|
79
84
|
' const {\n' +
|
|
80
85
|
' adg\n' +
|
|
81
86
|
' } = fct;\n' +
|
|
@@ -83,10 +88,13 @@ describe('Handling errors that throw inside a call to generateKomaciModule', ()
|
|
|
83
88
|
' t: "ErrorFunction",\n' +
|
|
84
89
|
' c: {\n' +
|
|
85
90
|
' "error": "[komaci] Something that is not an error was thrown"\n';
|
|
86
|
-
const expectedModuleSecondHalf = ' return [];\n' +
|
|
91
|
+
const expectedModuleSecondHalf = ' return [];\n' +
|
|
92
|
+
' }, []);\n' +
|
|
93
|
+
'}\n' +
|
|
94
|
+
'\nexport default registerAdgFunction(adg0);';
|
|
87
95
|
const lines = res.split('\n');
|
|
88
|
-
const skipStack = lines.slice(0,
|
|
89
|
-
const skipStackEnd = lines.slice(lines.length -
|
|
96
|
+
const skipStack = lines.slice(0, 10).join('\n') + '\n';
|
|
97
|
+
const skipStackEnd = lines.slice(lines.length - 5).join('\n');
|
|
90
98
|
expect(skipStack).toBe(expectedModuleFirstHalf);
|
|
91
99
|
expect(skipStackEnd).toBe(expectedModuleSecondHalf);
|
|
92
100
|
});
|
|
@@ -109,7 +117,8 @@ describe('Handling errors that throw inside a call to generateKomaciModule', ()
|
|
|
109
117
|
throw undefined;
|
|
110
118
|
});
|
|
111
119
|
const res = (0, __1.generateKomaciModule)(input);
|
|
112
|
-
const expectedModuleFirstHalf = '
|
|
120
|
+
const expectedModuleFirstHalf = 'import registerAdgFunction from "komaci/registerAdgFunction";\n\n' +
|
|
121
|
+
'function adg0(fct, ctx) {\n' +
|
|
113
122
|
' const {\n' +
|
|
114
123
|
' adg\n' +
|
|
115
124
|
' } = fct;\n' +
|
|
@@ -117,10 +126,13 @@ describe('Handling errors that throw inside a call to generateKomaciModule', ()
|
|
|
117
126
|
' t: "ErrorFunction",\n' +
|
|
118
127
|
' c: {\n' +
|
|
119
128
|
' "error": "[komaci] Something that is not an error was thrown"\n';
|
|
120
|
-
const expectedModuleSecondHalf = ' return [];\n' +
|
|
129
|
+
const expectedModuleSecondHalf = ' return [];\n' +
|
|
130
|
+
' }, []);\n' +
|
|
131
|
+
'}\n' +
|
|
132
|
+
'\nexport default registerAdgFunction(adg0);';
|
|
121
133
|
const lines = res.split('\n');
|
|
122
|
-
const skipStack = lines.slice(0,
|
|
123
|
-
const skipStackEnd = lines.slice(lines.length -
|
|
134
|
+
const skipStack = lines.slice(0, 10).join('\n') + '\n';
|
|
135
|
+
const skipStackEnd = lines.slice(lines.length - 5).join('\n');
|
|
124
136
|
expect(skipStack).toBe(expectedModuleFirstHalf);
|
|
125
137
|
expect(skipStackEnd).toBe(expectedModuleSecondHalf);
|
|
126
138
|
});
|
|
@@ -152,7 +152,7 @@ function composedAdgToExpression(moduleMetadata, composedAdg, iterationContext)
|
|
|
152
152
|
const params = [];
|
|
153
153
|
// arg1: Input source to the composed graph function.
|
|
154
154
|
if (composedAdg.input.type === 'ImportReference') {
|
|
155
|
-
const importName = moduleMetadata.importIndexReference.get(
|
|
155
|
+
const importName = moduleMetadata.importIndexReference.get(composedAdg.input.value);
|
|
156
156
|
const importInfo = importName
|
|
157
157
|
? moduleMetadata.importsByName.get(importName)
|
|
158
158
|
: undefined;
|
|
@@ -121,8 +121,7 @@ function adgToExpression(adg, moduleMetadata) {
|
|
|
121
121
|
}
|
|
122
122
|
else {
|
|
123
123
|
exp = t.identifier(importMetadata.generatorAlias);
|
|
124
|
-
|
|
125
|
-
params.push(parentFunc);
|
|
124
|
+
params.push(exp);
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
127
|
}
|
|
@@ -230,14 +229,17 @@ exports.composeAdgFunction = composeAdgFunction;
|
|
|
230
229
|
*/
|
|
231
230
|
function addExportStatement(adgName, exportName) {
|
|
232
231
|
if (exportName === 'default') {
|
|
233
|
-
// e.g. `export default adg0`
|
|
234
|
-
return t.exportDefaultDeclaration(t.identifier(
|
|
232
|
+
// e.g. `export default registerAdgFunction(adg0)`
|
|
233
|
+
return t.exportDefaultDeclaration(t.callExpression(t.identifier('registerAdgFunction'), [
|
|
234
|
+
t.identifier(adgName),
|
|
235
|
+
]));
|
|
235
236
|
}
|
|
236
237
|
else {
|
|
237
|
-
// e.g
|
|
238
|
-
|
|
239
|
-
t.
|
|
238
|
+
// e.g `export const Foo = registerAdgFunction(adg0)`
|
|
239
|
+
const expVar = t.variableDeclarator(t.identifier(exportName), t.callExpression(t.identifier('registerAdgFunction'), [
|
|
240
|
+
t.identifier(adgName),
|
|
240
241
|
]));
|
|
242
|
+
return t.exportNamedDeclaration(t.variableDeclaration('const', [expVar]));
|
|
241
243
|
}
|
|
242
244
|
}
|
|
243
245
|
exports.addExportStatement = addExportStatement;
|
|
@@ -309,6 +311,7 @@ function produceErrorAdgFunction(moduleMetadata, error) {
|
|
|
309
311
|
value: error.stack,
|
|
310
312
|
};
|
|
311
313
|
}
|
|
314
|
+
const registerAdgImport = t.importDeclaration([t.importDefaultSpecifier(t.identifier('registerAdgFunction'))], t.stringLiteral('komaci/registerAdgFunction'));
|
|
312
315
|
const adg = (0, common_shared_1.initAdgMetadataObject)('adg0');
|
|
313
316
|
adg.compositions = [];
|
|
314
317
|
adg.requiredAdgFactoryFunctions.add(common_shared_1.IdKeys.ADG_FUNC);
|
|
@@ -324,13 +327,18 @@ function produceErrorAdgFunction(moduleMetadata, error) {
|
|
|
324
327
|
adg.requiredAdgFactoryFunctions.add(common_shared_1.IdKeys.ADG_FUNC);
|
|
325
328
|
const adgFuncCall = adgToExpression(adg, moduleMetadata);
|
|
326
329
|
const factoryFuncs = getFactoryFuncDeclaration(adg.requiredAdgFactoryFunctions);
|
|
330
|
+
const funcDec = t.functionDeclaration(t.identifier(adg.defaultGeneratedName), [types_1.ID.FACTORY, types_1.ID.CONTEXT], t.blockStatement([
|
|
331
|
+
// it is literally impossible for this to be undefined given the adgToExpression call
|
|
332
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
333
|
+
factoryFuncs,
|
|
334
|
+
t.returnStatement(adgFuncCall),
|
|
335
|
+
]));
|
|
327
336
|
return t.program([
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
]))),
|
|
337
|
+
registerAdgImport,
|
|
338
|
+
funcDec,
|
|
339
|
+
t.exportDefaultDeclaration(t.callExpression(t.identifier('registerAdgFunction'), [
|
|
340
|
+
t.identifier(adg.defaultGeneratedName),
|
|
341
|
+
])),
|
|
334
342
|
]);
|
|
335
343
|
}
|
|
336
344
|
exports.produceErrorAdgFunction = produceErrorAdgFunction;
|
|
@@ -12,11 +12,13 @@ import { Binding, PrimitiveValue, PropertyReference, Value, KomaciDocument } fro
|
|
|
12
12
|
*
|
|
13
13
|
* @param input Generator input
|
|
14
14
|
* @param scriptKomaciDoc The js komaci doc if it exists
|
|
15
|
-
* @param
|
|
15
|
+
* @param templateKomaciDocMap A map of template komaci docs.
|
|
16
16
|
* @param source string pointing to the source of the script doc if it exists
|
|
17
17
|
* @returns The babel AST for the generated resolvable module
|
|
18
18
|
*/
|
|
19
|
-
export declare function generateResolvableModule(input: GeneratorInput, scriptKomaciDoc?: KomaciDocument,
|
|
19
|
+
export declare function generateResolvableModule(input: GeneratorInput, scriptKomaciDoc?: KomaciDocument, templateKomaciDocMap?: {
|
|
20
|
+
[fName: string]: KomaciDocument;
|
|
21
|
+
}, source?: string): t.File;
|
|
20
22
|
/**
|
|
21
23
|
* Adds a babel import decleration to the AST for each Komaci import
|
|
22
24
|
*
|
|
@@ -104,4 +106,10 @@ export declare function addUndefinedDefaultExport(): t.ExportDefaultDeclaration;
|
|
|
104
106
|
* @returns ExportNamedDeclaration containing the statement of the dynamic import of the target module
|
|
105
107
|
*/
|
|
106
108
|
export declare function exportNamedDeclarationForDynamicImport(moduleName: string, moduleNamespace: string, targetModule?: string): t.ExportNamedDeclaration;
|
|
109
|
+
/**
|
|
110
|
+
* Helper function to collect metadata for non default templates.
|
|
111
|
+
* @param templateMap the map of html filenames to its generated komaci document
|
|
112
|
+
* @param defaultTemplateFileName the name of the default template.
|
|
113
|
+
*/
|
|
114
|
+
export declare function collectMetadataForNonDefaultTemplates(moduleMetadata: ModuleMetadata, defaultTemplateFileName: string): void;
|
|
107
115
|
//# sourceMappingURL=genericAstGeneration.d.ts.map
|
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.exportNamedDeclarationForDynamicImport = exports.addUndefinedDefaultExport = exports.propertyToExpression = exports.functionToExpression = exports.bindingToExpression = exports.primitiveToExpression = exports.valueToExpression = exports.processWireFunctionType = exports.processErrorFunction = exports.addImportStatements = exports.generateResolvableModule = void 0;
|
|
26
|
+
exports.collectMetadataForNonDefaultTemplates = exports.exportNamedDeclarationForDynamicImport = exports.addUndefinedDefaultExport = exports.propertyToExpression = exports.functionToExpression = exports.bindingToExpression = exports.primitiveToExpression = exports.valueToExpression = exports.processWireFunctionType = exports.processErrorFunction = exports.addImportStatements = exports.generateResolvableModule = void 0;
|
|
27
27
|
const common_shared_1 = require("@komaci/common-shared");
|
|
28
28
|
const static_analyzer_1 = require("@komaci/static-analyzer");
|
|
29
29
|
const t = __importStar(require("@babel/types"));
|
|
@@ -44,16 +44,24 @@ const CONTEXT_MAPPING = {
|
|
|
44
44
|
*
|
|
45
45
|
* @param input Generator input
|
|
46
46
|
* @param scriptKomaciDoc The js komaci doc if it exists
|
|
47
|
-
* @param
|
|
47
|
+
* @param templateKomaciDocMap A map of template komaci docs.
|
|
48
48
|
* @param source string pointing to the source of the script doc if it exists
|
|
49
49
|
* @returns The babel AST for the generated resolvable module
|
|
50
50
|
*/
|
|
51
|
-
function generateResolvableModule(input, scriptKomaciDoc,
|
|
51
|
+
function generateResolvableModule(input, scriptKomaciDoc, templateKomaciDocMap, source) {
|
|
52
52
|
const moduleMetadata = (0, common_shared_1.initModuleMetadataObject)();
|
|
53
53
|
let componentDefaultAdgIndex;
|
|
54
|
+
if (templateKomaciDocMap) {
|
|
55
|
+
moduleMetadata.templateKomaciDocMap = templateKomaciDocMap;
|
|
56
|
+
}
|
|
57
|
+
//looks for the html file that matches the script filename.
|
|
58
|
+
const defaultTemplateKomaciDoc = moduleMetadata.templateKomaciDocMap &&
|
|
59
|
+
moduleMetadata.templateKomaciDocMap[input.moduleInfo.name]
|
|
60
|
+
? moduleMetadata.templateKomaciDocMap[input.moduleInfo.name]
|
|
61
|
+
: undefined;
|
|
54
62
|
const hasScriptKomaciDoc = scriptKomaciDoc && Object.keys(scriptKomaciDoc).length !== 0;
|
|
55
|
-
const hasTemplateKomaciDoc =
|
|
56
|
-
const combinedModule = scriptKomaciDoc !== undefined &&
|
|
63
|
+
const hasTemplateKomaciDoc = defaultTemplateKomaciDoc && Object.keys(defaultTemplateKomaciDoc).length !== 0;
|
|
64
|
+
const combinedModule = scriptKomaciDoc !== undefined && defaultTemplateKomaciDoc !== undefined;
|
|
57
65
|
const isBundle = input.moduleInfo.type === 'bundle';
|
|
58
66
|
// start of metadata collection
|
|
59
67
|
if (scriptKomaciDoc) {
|
|
@@ -76,13 +84,17 @@ function generateResolvableModule(input, scriptKomaciDoc, templateKomaciDoc, sou
|
|
|
76
84
|
(0, componentAstProcessing_1.processTemplateStrings)(componentDefaultAdgIndex, moduleContext, moduleMetadata, templateStrings);
|
|
77
85
|
}
|
|
78
86
|
}
|
|
87
|
+
//has a default html file
|
|
79
88
|
if (hasTemplateKomaciDoc) {
|
|
80
89
|
componentDefaultAdgIndex = (0, common_shared_1.reconcileDefaultAdg)(componentDefaultAdgIndex, moduleMetadata);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
if (componentDefaultAdgIndex !== undefined) {
|
|
91
|
+
(0, common_shared_1.initializeImportMetdataFromKomaciDocument)(defaultTemplateKomaciDoc, moduleMetadata, componentDefaultAdgIndex);
|
|
92
|
+
(0, common_shared_1.addTemplateUsageForAdg)(defaultTemplateKomaciDoc, componentDefaultAdgIndex, moduleMetadata);
|
|
93
|
+
if (isBundle && !hasScriptKomaciDoc) {
|
|
94
|
+
(0, common_shared_1.upliftFakePropsFromTemplate)(
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
96
|
+
moduleMetadata.adgs.get(componentDefaultAdgIndex));
|
|
97
|
+
}
|
|
86
98
|
}
|
|
87
99
|
}
|
|
88
100
|
// for script only docs we assume there there is still a html file around so we build the import to reference that html
|
|
@@ -92,6 +104,11 @@ function generateResolvableModule(input, scriptKomaciDoc, templateKomaciDoc, sou
|
|
|
92
104
|
newImport.isFromSupportedLibrary = true;
|
|
93
105
|
newImport.generatorAlias = 'comp1';
|
|
94
106
|
}
|
|
107
|
+
//if there is a default komaci doc, its already processed. need to process the rest of the template komaci docs that aren't the default if there is any.
|
|
108
|
+
if (!hasTemplateKomaciDoc ||
|
|
109
|
+
Object.keys(moduleMetadata.templateKomaciDocMap).length > 1) {
|
|
110
|
+
collectMetadataForNonDefaultTemplates(moduleMetadata, input.moduleInfo.name);
|
|
111
|
+
}
|
|
95
112
|
// all metadata collected at this point, time to start building ast
|
|
96
113
|
const statements = [];
|
|
97
114
|
const program = t.program(statements);
|
|
@@ -103,7 +120,7 @@ function generateResolvableModule(input, scriptKomaciDoc, templateKomaciDoc, sou
|
|
|
103
120
|
if (!combinedModule && hasTemplateKomaciDoc) {
|
|
104
121
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
105
122
|
const adg = moduleMetadata.adgs.get(componentDefaultAdgIndex);
|
|
106
|
-
const compositionsArray = (0, compositionAstGeneration_1.compositionsToArrayExpression)(moduleMetadata,
|
|
123
|
+
const compositionsArray = (0, compositionAstGeneration_1.compositionsToArrayExpression)(moduleMetadata, defaultTemplateKomaciDoc.compositions) || t.arrayExpression([]);
|
|
107
124
|
// Create default export of the main template function.
|
|
108
125
|
// e.g. `export default function (fct, ctx) {...}`
|
|
109
126
|
const params = [types_1.ID.FACTORY, types_1.ID.CONTEXT];
|
|
@@ -119,6 +136,11 @@ function generateResolvableModule(input, scriptKomaciDoc, templateKomaciDoc, sou
|
|
|
119
136
|
statements.push(t.exportDefaultDeclaration(t.functionDeclaration(null, params, body)));
|
|
120
137
|
}
|
|
121
138
|
else {
|
|
139
|
+
if (combinedModule || hasScriptKomaciDoc) {
|
|
140
|
+
// add import for registerAdgFunction
|
|
141
|
+
const registerAdgImport = t.importDeclaration([t.importDefaultSpecifier(t.identifier('registerAdgFunction'))], t.stringLiteral('komaci/registerAdgFunction'));
|
|
142
|
+
statements.push(registerAdgImport);
|
|
143
|
+
}
|
|
122
144
|
// uplift local functions from default exported adg
|
|
123
145
|
if (componentDefaultAdgIndex !== undefined) {
|
|
124
146
|
const defaultAdg = moduleMetadata.adgs.get(componentDefaultAdgIndex);
|
|
@@ -597,4 +619,26 @@ function exportNamedDeclarationForDynamicImport(moduleName, moduleNamespace, tar
|
|
|
597
619
|
]));
|
|
598
620
|
}
|
|
599
621
|
exports.exportNamedDeclarationForDynamicImport = exportNamedDeclarationForDynamicImport;
|
|
622
|
+
/**
|
|
623
|
+
* Helper function to collect metadata for non default templates.
|
|
624
|
+
* @param templateMap the map of html filenames to its generated komaci document
|
|
625
|
+
* @param defaultTemplateFileName the name of the default template.
|
|
626
|
+
*/
|
|
627
|
+
function collectMetadataForNonDefaultTemplates(moduleMetadata, defaultTemplateFileName) {
|
|
628
|
+
moduleMetadata.importsByName.forEach((importMetadata) => {
|
|
629
|
+
if ((0, common_shared_1.isTemplateImport)(importMetadata)) {
|
|
630
|
+
const templateKomaciDoc = importMetadata
|
|
631
|
+
.templateKomaciDoc;
|
|
632
|
+
const segs = (0, common_shared_1.getFilepathSegments)(importMetadata.resourceName);
|
|
633
|
+
if (segs[1].replace('/', '') !== defaultTemplateFileName) {
|
|
634
|
+
const templateAdgIndex = moduleMetadata.adgGeneratorIndex++;
|
|
635
|
+
const templateAdgMetadata = (0, common_shared_1.initAdgMetadataObject)(`adg${templateAdgIndex}`);
|
|
636
|
+
moduleMetadata.adgs.set(templateAdgIndex, templateAdgMetadata);
|
|
637
|
+
(0, common_shared_1.initializeImportMetdataFromKomaciDocument)(templateKomaciDoc, moduleMetadata, templateAdgIndex);
|
|
638
|
+
(0, common_shared_1.addTemplateUsageForAdg)(templateKomaciDoc, templateAdgIndex, moduleMetadata);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
exports.collectMetadataForNonDefaultTemplates = collectMetadataForNonDefaultTemplates;
|
|
600
644
|
//# sourceMappingURL=genericAstGeneration.js.map
|
package/build/index.js
CHANGED
|
@@ -55,15 +55,14 @@ exports.generateKomaciModule = generateKomaciModule;
|
|
|
55
55
|
function processGeneratorInputAndState(input) {
|
|
56
56
|
if (input.moduleInfo.type === 'file') {
|
|
57
57
|
// Determine file type based on extension in file name.
|
|
58
|
-
const segments = input.moduleInfo.fileName
|
|
59
|
-
if (segments.length < 2) {
|
|
60
|
-
throw new Error(types_1.ERROR_PREFIX + 'unable to determine file type');
|
|
61
|
-
}
|
|
58
|
+
const segments = (0, common_shared_1.getFilepathSegments)(input.moduleInfo.fileName);
|
|
62
59
|
const fileExt = segments[segments.length - 1];
|
|
63
60
|
let sourceFile;
|
|
64
61
|
const source = (0, componentAstProcessing_1.getComponentSrcJs)(input);
|
|
65
62
|
if (fileExt === 'html') {
|
|
66
|
-
|
|
63
|
+
const templateMap = {};
|
|
64
|
+
templateMap[input.moduleInfo.name] = input.moduleInfo.komaciDoc;
|
|
65
|
+
sourceFile = (0, genericAstGeneration_1.generateResolvableModule)(input, undefined, templateMap, source);
|
|
67
66
|
}
|
|
68
67
|
else if (fileExt === 'js') {
|
|
69
68
|
sourceFile = (0, genericAstGeneration_1.generateResolvableModule)(input, input.moduleInfo.komaciDoc, undefined, source);
|
|
@@ -82,15 +81,9 @@ function processGeneratorInputAndState(input) {
|
|
|
82
81
|
let sourceFile;
|
|
83
82
|
for (const [fullFilename, komaciDoc] of Object.entries(docMap)) {
|
|
84
83
|
// Determine file type based on extension in file name.
|
|
85
|
-
const segments =
|
|
86
|
-
if (segments.length < 2) {
|
|
87
|
-
throw new Error(types_1.ERROR_PREFIX + 'unable to determine file type');
|
|
88
|
-
}
|
|
84
|
+
const segments = (0, common_shared_1.getFilepathSegments)(fullFilename);
|
|
89
85
|
filename = segments[0]; // the filename, up to but not including, the file separator character
|
|
90
86
|
fileExt = segments[segments.length - 1]; // filename extension, not including the separator
|
|
91
|
-
if (filename !== input.moduleInfo.name) {
|
|
92
|
-
continue; // ignore files whose name do not match moduleInfo.name
|
|
93
|
-
}
|
|
94
87
|
let filesObj = {};
|
|
95
88
|
// check for existing map entry in order to append to it
|
|
96
89
|
// to support multiple files per filetype in the future
|
|
@@ -112,11 +105,9 @@ function processGeneratorInputAndState(input) {
|
|
|
112
105
|
const komaciJSDoc = filesMap && filesMap['js'] && filesMap['js'][input.moduleInfo.name]
|
|
113
106
|
? filesMap['js'][input.moduleInfo.name]
|
|
114
107
|
: {};
|
|
115
|
-
const
|
|
116
|
-
? filesMap['html'][input.moduleInfo.name]
|
|
117
|
-
: {};
|
|
108
|
+
const komaciHtmlDocMap = filesMap && filesMap['html'] ? filesMap['html'] : {};
|
|
118
109
|
// eslint-disable-next-line prefer-const
|
|
119
|
-
sourceFile = (0, genericAstGeneration_1.generateResolvableModule)(input, komaciJSDoc,
|
|
110
|
+
sourceFile = (0, genericAstGeneration_1.generateResolvableModule)(input, komaciJSDoc, komaciHtmlDocMap, source);
|
|
120
111
|
// Generate source from constructed AST.
|
|
121
112
|
const babelOutput = (0, generator_1.default)(sourceFile);
|
|
122
113
|
return babelOutput.code;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@komaci/esm-generator",
|
|
3
|
-
"version": "242.1.
|
|
3
|
+
"version": "242.1.1",
|
|
4
4
|
"description": "Komaci generator for ADG ES modules",
|
|
5
5
|
"homepage": "https://komaci.dev/",
|
|
6
6
|
"repository": {
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/core": "^7.9.0",
|
|
30
30
|
"@babel/generator": "^7.9.0",
|
|
31
|
-
"@komaci/common-shared": "242.1.
|
|
32
|
-
"@komaci/static-analyzer": "242.1.
|
|
31
|
+
"@komaci/common-shared": "242.1.1",
|
|
32
|
+
"@komaci/static-analyzer": "242.1.1",
|
|
33
33
|
"o11y": "^240.7.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/types": "^7.9.0",
|
|
37
|
-
"@komaci/types": "242.1.
|
|
37
|
+
"@komaci/types": "242.1.1",
|
|
38
38
|
"@lwc-platform/sfdc-lwc-compiler": "^2.18.0-240.2"
|
|
39
39
|
}
|
|
40
40
|
}
|