@komaci/esm-generator 240.1.5 → 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__/adgAstGeneration.spec.d.ts +2 -0
- package/build/__tests__/adgAstGeneration.spec.js +31 -0
- package/build/__tests__/compositionAstGeneration.spec.d.ts +2 -0
- package/build/__tests__/compositionAstGeneration.spec.js +396 -0
- package/build/__tests__/fixtures-combined-files/exclude-partial-classProps-indirect-importRef-getter/actual.js +5 -1
- package/build/__tests__/fixtures-combined-files/include-all-indirect-importRef-getter-complex/actual.js +5 -1
- package/build/__tests__/fixtures-combined-files/include-class-prop-indirect-importRef-getter/actual.js +5 -1
- 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__/fixtures-script-files/imports/actual.js +5 -1
- package/build/__tests__/fixtures-script-files/imports-namespaced/actual.js +5 -1
- package/build/__tests__/fixtures-script-files/wire-imports/actual.js +5 -1
- package/build/__tests__/functionAstGeneration.spec.d.ts +2 -0
- package/build/__tests__/functionAstGeneration.spec.js +416 -0
- package/build/__tests__/general-komaci-docs/import-types/source.js +5 -1
- package/build/__tests__/general-komaci-docs/template-component/source.js +3 -3
- package/build/__tests__/genericAstGeneration.spec.d.ts +2 -0
- package/build/__tests__/genericAstGeneration.spec.js +877 -0
- package/build/__tests__/index.spec.js +34 -18
- package/build/__tests__/komaci-ast-unit.spec.js +240 -448
- package/build/__tests__/komaci-bundle-module.fixtures.spec.js +1 -0
- package/build/__tests__/komaci-script-module.fixtures.spec.js +5 -1
- package/build/__tests__/komaci-template-module.fixtures.spec.js +2 -1
- package/build/componentAstProcessing.d.ts +34 -0
- package/build/componentAstProcessing.js +105 -0
- package/build/compositionAstGeneration.d.ts +76 -0
- package/build/compositionAstGeneration.js +299 -0
- package/build/functionAstGeneration.d.ts +81 -0
- package/build/functionAstGeneration.js +345 -0
- package/build/genericAstGeneration.d.ts +115 -0
- package/build/genericAstGeneration.js +644 -0
- package/build/index.d.ts +6 -0
- package/build/index.js +77 -89
- package/build/types.d.ts +13 -2
- package/build/types.js +69 -1
- package/package.json +4 -4
- package/build/__tests__/modGenScript.spec.d.ts +0 -2
- package/build/__tests__/modGenScript.spec.js +0 -110
- package/build/__tests__/modGenTemplate.spec.d.ts +0 -2
- package/build/__tests__/modGenTemplate.spec.js +0 -196
- package/build/__tests__/shared.spec.d.ts +0 -2
- package/build/__tests__/shared.spec.js +0 -62
- package/build/__tests__/templateStrings.spec.d.ts +0 -2
- package/build/__tests__/templateStrings.spec.js +0 -130
- package/build/modGenScript.d.ts +0 -38
- package/build/modGenScript.js +0 -1027
- package/build/modGenTemplate.d.ts +0 -37
- package/build/modGenTemplate.js +0 -402
- package/build/shared.d.ts +0 -170
- package/build/shared.js +0 -588
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -20,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
20
24
|
};
|
|
21
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
26
|
const __1 = require("..");
|
|
23
|
-
const modgen = __importStar(require("../
|
|
27
|
+
const modgen = __importStar(require("../genericAstGeneration"));
|
|
24
28
|
describe('Handling errors that throw inside a call to generateKomaciModule', () => {
|
|
25
29
|
it('should return error adg when an error is produced', () => {
|
|
26
30
|
const input = {
|
|
@@ -37,7 +41,8 @@ describe('Handling errors that throw inside a call to generateKomaciModule', ()
|
|
|
37
41
|
},
|
|
38
42
|
};
|
|
39
43
|
const res = (0, __1.generateKomaciModule)(input);
|
|
40
|
-
const expectedModuleFirstHalf = '
|
|
44
|
+
const expectedModuleFirstHalf = 'import registerAdgFunction from "komaci/registerAdgFunction";\n\n' +
|
|
45
|
+
'function adg0(fct, ctx) {\n' +
|
|
41
46
|
' const {\n' +
|
|
42
47
|
' adg\n' +
|
|
43
48
|
' } = fct;\n' +
|
|
@@ -45,10 +50,13 @@ describe('Handling errors that throw inside a call to generateKomaciModule', ()
|
|
|
45
50
|
' t: "ErrorFunction",\n' +
|
|
46
51
|
' c: {\n' +
|
|
47
52
|
' "error": "[komaci esm-generator] unrecognized input type",\n';
|
|
48
|
-
const expectedModuleSecondHalf = '
|
|
53
|
+
const expectedModuleSecondHalf = ' return [];\n' +
|
|
54
|
+
' }, []);\n' +
|
|
55
|
+
'}\n' +
|
|
56
|
+
'\nexport default registerAdgFunction(adg0);';
|
|
49
57
|
const lines = res.split('\n');
|
|
50
|
-
const skipStack = lines.slice(0,
|
|
51
|
-
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');
|
|
52
60
|
expect(skipStack).toBe(expectedModuleFirstHalf);
|
|
53
61
|
expect(skipStackEnd).toBe(expectedModuleSecondHalf);
|
|
54
62
|
});
|
|
@@ -66,23 +74,27 @@ describe('Handling errors that throw inside a call to generateKomaciModule', ()
|
|
|
66
74
|
'test.html': '<html><body><h1>Hey</h1></body></html>',
|
|
67
75
|
},
|
|
68
76
|
};
|
|
69
|
-
const mock = jest.spyOn(modgen, '
|
|
77
|
+
const mock = jest.spyOn(modgen, 'generateResolvableModule');
|
|
70
78
|
mock.mockImplementationOnce(() => {
|
|
71
79
|
throw 'not an error';
|
|
72
80
|
});
|
|
73
81
|
const res = (0, __1.generateKomaciModule)(input);
|
|
74
|
-
const expectedModuleFirstHalf = '
|
|
82
|
+
const expectedModuleFirstHalf = 'import registerAdgFunction from "komaci/registerAdgFunction";\n\n' +
|
|
83
|
+
'function adg0(fct, ctx) {\n' +
|
|
75
84
|
' const {\n' +
|
|
76
85
|
' adg\n' +
|
|
77
86
|
' } = fct;\n' +
|
|
78
87
|
' return adg(undefined, {}, [{\n' +
|
|
79
88
|
' t: "ErrorFunction",\n' +
|
|
80
89
|
' c: {\n' +
|
|
81
|
-
' "error": "[komaci
|
|
82
|
-
const expectedModuleSecondHalf = '
|
|
90
|
+
' "error": "[komaci] Something that is not an error was thrown"\n';
|
|
91
|
+
const expectedModuleSecondHalf = ' return [];\n' +
|
|
92
|
+
' }, []);\n' +
|
|
93
|
+
'}\n' +
|
|
94
|
+
'\nexport default registerAdgFunction(adg0);';
|
|
83
95
|
const lines = res.split('\n');
|
|
84
|
-
const skipStack = lines.slice(0,
|
|
85
|
-
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');
|
|
86
98
|
expect(skipStack).toBe(expectedModuleFirstHalf);
|
|
87
99
|
expect(skipStackEnd).toBe(expectedModuleSecondHalf);
|
|
88
100
|
});
|
|
@@ -100,23 +112,27 @@ describe('Handling errors that throw inside a call to generateKomaciModule', ()
|
|
|
100
112
|
'test.html': '<html><body><h1>Hey</h1></body></html>',
|
|
101
113
|
},
|
|
102
114
|
};
|
|
103
|
-
const mock = jest.spyOn(modgen, '
|
|
115
|
+
const mock = jest.spyOn(modgen, 'generateResolvableModule');
|
|
104
116
|
mock.mockImplementationOnce(() => {
|
|
105
117
|
throw undefined;
|
|
106
118
|
});
|
|
107
119
|
const res = (0, __1.generateKomaciModule)(input);
|
|
108
|
-
const expectedModuleFirstHalf = '
|
|
120
|
+
const expectedModuleFirstHalf = 'import registerAdgFunction from "komaci/registerAdgFunction";\n\n' +
|
|
121
|
+
'function adg0(fct, ctx) {\n' +
|
|
109
122
|
' const {\n' +
|
|
110
123
|
' adg\n' +
|
|
111
124
|
' } = fct;\n' +
|
|
112
125
|
' return adg(undefined, {}, [{\n' +
|
|
113
126
|
' t: "ErrorFunction",\n' +
|
|
114
127
|
' c: {\n' +
|
|
115
|
-
' "error": "[komaci
|
|
116
|
-
const expectedModuleSecondHalf = '
|
|
128
|
+
' "error": "[komaci] Something that is not an error was thrown"\n';
|
|
129
|
+
const expectedModuleSecondHalf = ' return [];\n' +
|
|
130
|
+
' }, []);\n' +
|
|
131
|
+
'}\n' +
|
|
132
|
+
'\nexport default registerAdgFunction(adg0);';
|
|
117
133
|
const lines = res.split('\n');
|
|
118
|
-
const skipStack = lines.slice(0,
|
|
119
|
-
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');
|
|
120
136
|
expect(skipStack).toBe(expectedModuleFirstHalf);
|
|
121
137
|
expect(skipStackEnd).toBe(expectedModuleSecondHalf);
|
|
122
138
|
});
|