@komaci/esm-generator 240.1.3 → 242.1.0

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.
Files changed (48) hide show
  1. package/build/__tests__/adgAstGeneration.spec.d.ts +2 -0
  2. package/build/__tests__/adgAstGeneration.spec.js +31 -0
  3. package/build/__tests__/compositionAstGeneration.spec.d.ts +2 -0
  4. package/build/__tests__/compositionAstGeneration.spec.js +394 -0
  5. package/build/__tests__/fixtures-combined-files/exclude-partial-classProps-indirect-importRef-getter/actual.js +5 -1
  6. package/build/__tests__/fixtures-combined-files/include-all-indirect-importRef-getter-complex/actual.js +5 -1
  7. package/build/__tests__/fixtures-combined-files/include-class-prop-indirect-importRef-getter/actual.js +5 -1
  8. package/build/__tests__/fixtures-script-files/imports/actual.js +5 -1
  9. package/build/__tests__/fixtures-script-files/imports-namespaced/actual.js +5 -1
  10. package/build/__tests__/fixtures-script-files/wire-imports/actual.js +5 -1
  11. package/build/__tests__/functionAstGeneration.spec.d.ts +2 -0
  12. package/build/__tests__/functionAstGeneration.spec.js +412 -0
  13. package/build/__tests__/general-komaci-docs/import-types/source.js +5 -1
  14. package/build/__tests__/general-komaci-docs/template-component/source.js +3 -3
  15. package/build/__tests__/genericAstGeneration.spec.d.ts +2 -0
  16. package/build/__tests__/genericAstGeneration.spec.js +586 -0
  17. package/build/__tests__/index.spec.js +13 -9
  18. package/build/__tests__/komaci-ast-unit.spec.js +240 -448
  19. package/build/__tests__/komaci-bundle-module.fixtures.spec.js +1 -0
  20. package/build/__tests__/komaci-script-module.fixtures.spec.js +5 -1
  21. package/build/__tests__/komaci-template-module.fixtures.spec.js +2 -1
  22. package/build/componentAstProcessing.d.ts +34 -0
  23. package/build/componentAstProcessing.js +105 -0
  24. package/build/compositionAstGeneration.d.ts +76 -0
  25. package/build/compositionAstGeneration.js +299 -0
  26. package/build/functionAstGeneration.d.ts +81 -0
  27. package/build/functionAstGeneration.js +337 -0
  28. package/build/genericAstGeneration.d.ts +107 -0
  29. package/build/genericAstGeneration.js +600 -0
  30. package/build/index.d.ts +6 -0
  31. package/build/index.js +85 -88
  32. package/build/types.d.ts +13 -2
  33. package/build/types.js +69 -1
  34. package/package.json +4 -4
  35. package/build/__tests__/modGenScript.spec.d.ts +0 -2
  36. package/build/__tests__/modGenScript.spec.js +0 -110
  37. package/build/__tests__/modGenTemplate.spec.d.ts +0 -2
  38. package/build/__tests__/modGenTemplate.spec.js +0 -196
  39. package/build/__tests__/shared.spec.d.ts +0 -2
  40. package/build/__tests__/shared.spec.js +0 -62
  41. package/build/__tests__/templateStrings.spec.d.ts +0 -2
  42. package/build/__tests__/templateStrings.spec.js +0 -130
  43. package/build/modGenScript.d.ts +0 -38
  44. package/build/modGenScript.js +0 -1027
  45. package/build/modGenTemplate.d.ts +0 -37
  46. package/build/modGenTemplate.js +0 -402
  47. package/build/shared.d.ts +0 -170
  48. package/build/shared.js +0 -588
@@ -0,0 +1,337 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
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);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.produceErrorAdgFunction = exports.getInlineFunctionFromTemplateCompositions = exports.getAdgFunctionBody = exports.addExportStatement = exports.composeAdgFunction = exports.getFactoryFuncDeclaration = exports.adgToExpression = exports.sanitizeFunction = exports.hoistLocalFunction = void 0;
27
+ const t = __importStar(require("@babel/types"));
28
+ const common_shared_1 = require("@komaci/common-shared");
29
+ const compositionAstGeneration_1 = require("./compositionAstGeneration");
30
+ const genericAstGeneration_1 = require("./genericAstGeneration");
31
+ const types_1 = require("./types");
32
+ /**
33
+ * Take a local function (getter, template string, etc) and prepare it for the resolvable module
34
+ * - sanitize the function
35
+ * - give the function a module level signature with generated name
36
+ *
37
+ * @param functionMetadata Metadata about the function to hoist
38
+ * @param importMetadata Map of all the import metadata we know about
39
+ *
40
+ * @returns a composed module level function or undefined if we don't have the
41
+ * information for composing the funciton
42
+ */
43
+ function hoistLocalFunction(functionMetadata, importMetadata) {
44
+ if (functionMetadata.componentAstNode && functionMetadata.generatedName) {
45
+ sanitizeFunction(functionMetadata.componentAstNode, importMetadata);
46
+ const propsId = t.identifier(common_shared_1.PROPS);
47
+ const functionBody = t.isClassMethod(functionMetadata.componentAstNode.node)
48
+ ? functionMetadata.componentAstNode.node.body
49
+ : t.blockStatement([
50
+ t.returnStatement(functionMetadata.componentAstNode.node.value),
51
+ ]);
52
+ const hoistedFunction = t.functionDeclaration(t.identifier(functionMetadata.generatedName), [propsId], // make 'props' an input parameter to the hoisted getter
53
+ functionBody);
54
+ return hoistedFunction;
55
+ }
56
+ return undefined;
57
+ }
58
+ exports.hoistLocalFunction = hoistLocalFunction;
59
+ /**
60
+ * Take a function defined on a class and sanitize it's interactions in preparation to be hoisted into resolvable module/
61
+ *
62
+ * Two main things happen during sanitization:
63
+ * - references to imports are updated to their generated name (i.e. i2)
64
+ * - references to `this` are replaced with references to `props`
65
+ *
66
+ * @param nodePath The node to sanitize
67
+ * @param importMetadata Metadata about all the imports we know about
68
+ */
69
+ function sanitizeFunction(nodePath, importMetadata) {
70
+ const Visitors = {
71
+ Identifier(path) {
72
+ if ((path.parent.type === 'MemberExpression' &&
73
+ path.parent.property === path.node) ||
74
+ path.parent.type === 'Decorator') {
75
+ //when a property shares a same name with an import,
76
+ //it will be identified as an import
77
+ //this check skips the scenario
78
+ return;
79
+ }
80
+ const info = importMetadata.get(path.node.name);
81
+ if (info && info.isFromInternalNamespace && info.isFromSupportedLibrary) {
82
+ path.replaceWith(t.identifier(info.generatorAlias)); // replace usage of import specifier
83
+ }
84
+ else if (info &&
85
+ !(info.isFromInternalNamespace && info.isFromSupportedLibrary)) {
86
+ // legit this should never happen but if we somehow missed an edge case somewhere this will prevent a malformed module from going out
87
+ throw new Error(`${common_shared_1.ERROR_PREFIX}: '${path.node.name}' does not map to valid import`);
88
+ }
89
+ },
90
+ MemberExpression(path) {
91
+ if (path.node.object.type === 'ThisExpression') {
92
+ path.replaceWith(t.memberExpression(t.identifier(common_shared_1.PROPS), path.node.property)); // replace this.<var> with props.<var>
93
+ }
94
+ },
95
+ };
96
+ nodePath.traverse(Visitors);
97
+ }
98
+ exports.sanitizeFunction = sanitizeFunction;
99
+ /**
100
+ * Converts a Komaci ADG into a CallExpression to the ADG factory function
101
+ * call for the Resolver API.
102
+ * @param {GeneratorState} generatorState the current state of the esm generator
103
+ * @param {Adg} adg the current ADG to convert into an Expression
104
+ * @returns {t.Expression} Babel Expression representation of the adg() factory function call
105
+ */
106
+ function adgToExpression(adg, moduleMetadata) {
107
+ const params = [];
108
+ // arg1: Parent Class.
109
+ if (adg.parentReference) {
110
+ let exp;
111
+ if (adg.parentReference.type === 'Unresolved') {
112
+ params.push(types_1.ID.UNRESOLVED_VALUE);
113
+ }
114
+ else if (adg.parentReference.type === 'ImportReference') {
115
+ const importId = moduleMetadata.importIndexReference.get(adg.parentReference.value);
116
+ if (importId) {
117
+ const importMetadata = moduleMetadata.importsByName.get(importId);
118
+ if (!importMetadata?.isFromInternalNamespace ||
119
+ !importMetadata.isFromSupportedLibrary) {
120
+ params.push(types_1.ID.UNRESOLVED_VALUE);
121
+ }
122
+ else {
123
+ exp = t.identifier(importMetadata.generatorAlias);
124
+ const parentFunc = t.callExpression(exp, [types_1.ID.FACTORY, types_1.ID.CONTEXT]);
125
+ params.push(parentFunc);
126
+ }
127
+ }
128
+ }
129
+ else {
130
+ if (adg.parentReference.type === 'AdgReference') {
131
+ const adgIndex = adg.parentReference.value;
132
+ const parentAdgRef = moduleMetadata.adgs.get(adgIndex);
133
+ if (parentAdgRef) {
134
+ exp = t.identifier(parentAdgRef.defaultGeneratedName);
135
+ }
136
+ else {
137
+ exp = types_1.ID.UNDEFINED;
138
+ }
139
+ }
140
+ else {
141
+ exp = (0, genericAstGeneration_1.valueToExpression)(adg.parentReference, moduleMetadata);
142
+ }
143
+ const parentFunc = t.callExpression(exp, [types_1.ID.FACTORY, types_1.ID.CONTEXT]);
144
+ params.push(parentFunc);
145
+ }
146
+ }
147
+ else {
148
+ params.push(types_1.ID.UNDEFINED);
149
+ }
150
+ // arg2: Properties object.
151
+ if (adg.properties) {
152
+ const objProps = [];
153
+ for (const [propName, propValue] of adg.properties) {
154
+ objProps.push(t.objectProperty(t.identifier(propName), (0, genericAstGeneration_1.propertyToExpression)(moduleMetadata, propValue)));
155
+ }
156
+ params.push(t.objectExpression(objProps));
157
+ }
158
+ else {
159
+ params.push(t.objectExpression([]));
160
+ }
161
+ // arg3: Functions array.
162
+ const functionsArray = [];
163
+ if (adg.functions) {
164
+ adg.functions.forEach((adgFunc) => {
165
+ const expr = (0, genericAstGeneration_1.functionToExpression)(moduleMetadata, adgFunc);
166
+ if (expr) {
167
+ functionsArray.push(expr);
168
+ }
169
+ else {
170
+ functionsArray.push(null);
171
+ }
172
+ });
173
+ }
174
+ if (functionsArray.length) {
175
+ params.push(t.arrayExpression(functionsArray));
176
+ }
177
+ else {
178
+ params.push(t.arrayExpression([]));
179
+ }
180
+ // arg4: Imported in-line composition function.
181
+ if (adg.compositions) {
182
+ params.push(getInlineFunctionFromTemplateCompositions(moduleMetadata, adg.requiredCompositionFactoryFunctions, adg.compositions));
183
+ }
184
+ else {
185
+ params.push(types_1.ID.DEFAULT_COMP);
186
+ }
187
+ // arg5: pass properties that the template references (only if processing a bundle)
188
+ // this array of t.stringLiterals may include properties mentioned the Template that aren't necessarily
189
+ // defined in the Script. Resolution engine has logic to handle these
190
+ params.push(t.arrayExpression(Array.from(adg.propertiesUsedInTemplate).map((v) => t.stringLiteral(v))));
191
+ return t.callExpression(types_1.ID.ADG_FUNC, params);
192
+ }
193
+ exports.adgToExpression = adgToExpression;
194
+ /**
195
+ * Return the variable declaration done via destructuring the factory object
196
+ * (e.g. const { i, cg } = fct;) or undefined if no fct functions are used.
197
+ * @param factoryFuncs Set of strings that represent used factory functions
198
+ * @returns composed ast statement for factory functions
199
+ */
200
+ function getFactoryFuncDeclaration(factoryFuncs) {
201
+ const fctFunctions = Array.from(factoryFuncs).map((func) => {
202
+ const funcId = types_1.ID[func];
203
+ return t.objectProperty(funcId, funcId, false, true);
204
+ });
205
+ if (fctFunctions.length) {
206
+ const declarator = t.variableDeclarator(t.objectPattern(fctFunctions), types_1.ID.FACTORY);
207
+ return t.variableDeclaration('const', [declarator]);
208
+ }
209
+ }
210
+ exports.getFactoryFuncDeclaration = getFactoryFuncDeclaration;
211
+ /**
212
+ * composes ast statements for a given set of ADG Metadata
213
+ *
214
+ * @param adg the metadata for the adg we want to compose an ast for
215
+ * @param moduleMetadata Metadata about the entire module
216
+ * @returns the declaration for a given adg
217
+ */
218
+ function composeAdgFunction(adg, moduleMetadata) {
219
+ // For each exported Adg create a corresponding export of a function
220
+ // which returns the AdgDefinition described in Resolver API.
221
+ const body = getAdgFunctionBody(adg, moduleMetadata);
222
+ return t.functionDeclaration(t.identifier(adg.defaultGeneratedName), [types_1.ID.FACTORY, types_1.ID.CONTEXT], body);
223
+ }
224
+ exports.composeAdgFunction = composeAdgFunction;
225
+ /**
226
+ * associate composed adgs with their exported names
227
+ * @param adgName the name of the adg
228
+ * @param exportName the name it will be exported as
229
+ * @returns the composed export statement
230
+ */
231
+ function addExportStatement(adgName, exportName) {
232
+ if (exportName === 'default') {
233
+ // e.g. `export default adg0`
234
+ return t.exportDefaultDeclaration(t.identifier(adgName));
235
+ }
236
+ else {
237
+ // e.g. `export const MyComponentClass = adg0`
238
+ return t.exportNamedDeclaration(t.variableDeclaration('const', [
239
+ t.variableDeclarator(t.identifier(exportName), t.identifier(adgName)),
240
+ ]));
241
+ }
242
+ }
243
+ exports.addExportStatement = addExportStatement;
244
+ /**
245
+ * Compose the function that calls the `adg` function with all of it's needful info
246
+ * @param {GeneratorState} generatorState the current state of the esm generator
247
+ * @param {Adg} adg The current ADG for which to compose the babel statements
248
+ * @returns the babel statements to represent the function
249
+ */
250
+ function getAdgFunctionBody(adg, moduleMetadata) {
251
+ const adgFuncCall = adgToExpression(adg, moduleMetadata);
252
+ const fctFuncs = getFactoryFuncDeclaration(adg.requiredAdgFactoryFunctions);
253
+ const funcStatements = [];
254
+ const body = t.blockStatement(funcStatements);
255
+ // Function body will be destructuring of factory object and the return
256
+ // statement for the adg() function call from Resolver API.
257
+ // e.g. `{ const { adg } = fct; return adg({...}); }`
258
+ if (fctFuncs) {
259
+ funcStatements.push(fctFuncs);
260
+ }
261
+ funcStatements.push(t.returnStatement(adgFuncCall));
262
+ return body;
263
+ }
264
+ exports.getAdgFunctionBody = getAdgFunctionBody;
265
+ /**
266
+ * Converts array of template Compositions into a representation that is an inline function
267
+ * @param {GeneratorState} generatorState the current state of esm-generator
268
+ * @param {Composition[]} compositions array of Compositions to convert
269
+ * @returns {t.ArrowFunctionExpression} an inline ArrowFunctionExpression representing the input Compositions
270
+ */
271
+ function getInlineFunctionFromTemplateCompositions(moduleMetadata, requiredFactoryFunctions, compositions) {
272
+ const params = [types_1.ID.FACTORY, types_1.ID.CONTEXT];
273
+ const statements = [];
274
+ const body = t.blockStatement(statements);
275
+ const emptyCompositionsArray = compositions.length < 1;
276
+ const compositionArrayExpr = emptyCompositionsArray
277
+ ? t.arrayExpression([])
278
+ : (0, compositionAstGeneration_1.compositionsToArrayExpression)(moduleMetadata, compositions) ||
279
+ t.arrayExpression([]);
280
+ // function body destructured factory object. e.g. `const { cg } = fct;`
281
+ const fctFuncs = getFactoryFuncDeclaration(requiredFactoryFunctions); // passing in false because we are not processing the script file in this method
282
+ if (fctFuncs && !emptyCompositionsArray) {
283
+ statements.push(fctFuncs);
284
+ }
285
+ statements.push(t.returnStatement(compositionArrayExpr));
286
+ return t.arrowFunctionExpression(params, body);
287
+ }
288
+ exports.getInlineFunctionFromTemplateCompositions = getInlineFunctionFromTemplateCompositions;
289
+ /**
290
+ * A barebones resolvable module default export with a singular node describing the context of an error.
291
+ *
292
+ * We return this instead of a real resolvable module if something throws an error during resolvable module generation
293
+ * @param generatorState The state of the generator for pass through to adgToExpression
294
+ * @param error The error that was thrown
295
+ * @returns A default export representing the error state for this resolvable module
296
+ */
297
+ function produceErrorAdgFunction(moduleMetadata, error) {
298
+ const functionValues = {
299
+ error: {
300
+ type: 'PrimitiveValue',
301
+ value: error instanceof Error
302
+ ? error.message
303
+ : common_shared_1.ERROR_PREFIX + 'Something that is not an error was thrown',
304
+ },
305
+ };
306
+ if (error instanceof Error && error.stack) {
307
+ functionValues.stack = {
308
+ type: 'PrimitiveValue',
309
+ value: error.stack,
310
+ };
311
+ }
312
+ const adg = (0, common_shared_1.initAdgMetadataObject)('adg0');
313
+ adg.compositions = [];
314
+ adg.requiredAdgFactoryFunctions.add(common_shared_1.IdKeys.ADG_FUNC);
315
+ adg.functions.push({
316
+ type: common_shared_1.FunctionTypes.ERROR,
317
+ input: [
318
+ {
319
+ type: 'ObjectValue',
320
+ value: functionValues,
321
+ },
322
+ ],
323
+ });
324
+ adg.requiredAdgFactoryFunctions.add(common_shared_1.IdKeys.ADG_FUNC);
325
+ const adgFuncCall = adgToExpression(adg, moduleMetadata);
326
+ const factoryFuncs = getFactoryFuncDeclaration(adg.requiredAdgFactoryFunctions);
327
+ return t.program([
328
+ t.exportDefaultDeclaration(t.functionDeclaration(null, [types_1.ID.FACTORY, types_1.ID.CONTEXT], t.blockStatement([
329
+ // it is literally impossible for this to be undefined given the adgToExpression call
330
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
331
+ factoryFuncs,
332
+ t.returnStatement(adgFuncCall),
333
+ ]))),
334
+ ]);
335
+ }
336
+ exports.produceErrorAdgFunction = produceErrorAdgFunction;
337
+ //# sourceMappingURL=functionAstGeneration.js.map
@@ -0,0 +1,107 @@
1
+ import { ClassPropertyContext, ErrorFunctionMetadata, FunctionMetadata, ModuleMetadata, WireFunctionMetadata } from '@komaci/common-shared';
2
+ import * as t from '@babel/types';
3
+ import { GeneratorInput } from './types';
4
+ import { Binding, PrimitiveValue, PropertyReference, Value, KomaciDocument } from '@komaci/types';
5
+ /**
6
+ * Compose a resolvable module for a component. There are three types of outputted resolvable modules
7
+ * - A resolvable module built from a component with ONLY a template
8
+ * - A resolvable module built from a component with ONLY a js file
9
+ * - A resolvable module that has both a template a js file
10
+ *
11
+ * Currently we only support JS and template files that match the names of components
12
+ *
13
+ * @param input Generator input
14
+ * @param scriptKomaciDoc The js komaci doc if it exists
15
+ * @param templateKomaciDoc The tempalte komaci doc if it exists
16
+ * @param source string pointing to the source of the script doc if it exists
17
+ * @returns The babel AST for the generated resolvable module
18
+ */
19
+ export declare function generateResolvableModule(input: GeneratorInput, scriptKomaciDoc?: KomaciDocument, templateKomaciDoc?: KomaciDocument, source?: string): t.File;
20
+ /**
21
+ * Adds a babel import decleration to the AST for each Komaci import
22
+ *
23
+ * Note: While this method does not return anything, it does modify the input Statement array.
24
+ *
25
+ * @param {ModuleMetadata} moduleMetadata metadata about the lwc module we are building a resolvable module for
26
+ * @param {Statement[]} statements Array of Statement to be modified by this method for this program
27
+ * @param {{ calledFromGenerateCombinedModule: boolean }} options flag to distinguish whether we have been called
28
+ * to generate a combined module or not.
29
+ */
30
+ export declare function addImportStatements(moduleMetadata: ModuleMetadata, statements: t.Statement[], options: {
31
+ calledFromGenerateCombinedModule: boolean;
32
+ }): void;
33
+ /**
34
+ * Make ast statements for the details about an error we received
35
+ * @param adgFunc The error function metadata
36
+ * @param moduleMetadata metadata about the module as whole
37
+ * @returns ast statemenets representing config for this function node
38
+ */
39
+ export declare function processErrorFunction(adgFunc: ErrorFunctionMetadata, moduleMetadata: ModuleMetadata): t.ObjectProperty[];
40
+ /**
41
+ * Function to generate the object property array for a wire function node type.
42
+ *
43
+ * NOTE: if the obj representing the function is from an unsupported namespace, and it
44
+ * is for a wire function, then leave out the function node from the generated resolvable
45
+ * module, by returning undefined.
46
+ * @param {ImportInfo} importInfo import information against which to check the wire function's validity
47
+ * @param {GeneratorState} generatorState the current state of the esm generator
48
+ * @param {FunctionType} adgFunc a wire function from the adg functions array.
49
+ * @returns {ObjectProperty[]} an representation of the wire function node as array of ObjectProperty
50
+ */
51
+ export declare function processWireFunctionType(adgFunc: WireFunctionMetadata, moduleMetadata: ModuleMetadata): t.ObjectProperty[] | undefined;
52
+ /**
53
+ * Convert any possible value within a Komaci ADG to a babel expression.
54
+ * @param komaciValue the komaci value
55
+ * @param moduleMetadata the module meta data object
56
+ * @returns a babel expression for the komaci value.
57
+ */
58
+ export declare function valueToExpression(komaciValue: Value, moduleMetadata: ModuleMetadata): t.Expression;
59
+ /**
60
+ * Convert a Komaci primitive value to babel expression.
61
+ * @param primitive a primitve value
62
+ * @returns an expression that represents the primitive value.
63
+ */
64
+ export declare function primitiveToExpression(primitive: PrimitiveValue): t.Expression;
65
+ /**
66
+ * Convert binding (or PropertyReference) to a babel expr (e.g. record.value?.Id).
67
+ * @param binding The binding object
68
+ * @param iterationContext If this binding is inside an iteration we need the contextual details about the iteration to build the proper expression
69
+ * @param parseRootOnly There are some cases where we only care about the first piece of the binding. in the example above we might need to only check `record` instead of `record.value?.Id`
70
+ * @returns A composed member expression
71
+ */
72
+ export declare function bindingToExpression(binding: Binding | PropertyReference, iterationContext?: string[], parseRootOnly?: boolean): t.Identifier | t.OptionalMemberExpression;
73
+ /**
74
+ * Convert a single Komaci function to an object expression in the shape of a
75
+ * FunctionDefinition as defined in Resolver API.
76
+ * @param {GeneratorState} generatorState the current esm generator state
77
+ * @param {FunctionType} adgFunc a function from the adg functions arrray.
78
+ * @returns {Expression} a babel Expression if propertly processed or undefined.
79
+ */
80
+ export declare function functionToExpression(moduleMetadata: ModuleMetadata, adgFunc: FunctionMetadata): t.ObjectExpression | undefined;
81
+ /**
82
+ * Convert a single Komaci property to an object expression in the shape of
83
+ * a PropertyDefinition as defined in Resolver API.
84
+ * @param {GeneratorState} generatorState the current state of esm-generator
85
+ * @param {Adg} adg the current ADG from which to seek out FunctionReferences
86
+ * @param {Propery} property the Komaci property to process
87
+ * @returns {Expression} the komaci property converted to an object Expression
88
+ */
89
+ export declare function propertyToExpression(moduleMetadata: ModuleMetadata, property: ClassPropertyContext): t.ObjectExpression;
90
+ /**
91
+ * Adds a default export to the program statements, if no default export that is derived from an AdgReference already exists
92
+ *
93
+ * @returns composed AST statement for undefined default export
94
+ */
95
+ export declare function addUndefinedDefaultExport(): t.ExportDefaultDeclaration;
96
+ /**
97
+ * Adds the dynamic import of target module, but only for bundles (if moduleInfo.type === "bundle").
98
+ *
99
+ * Returns an export named declaration. The declaration is assigned an arrowFunctionExpression, which returns
100
+ * a dynamic import based on the moduleInfo namespace and name.
101
+ * @param moduleName The name of module we're making
102
+ * @param moduleNamespace the namespace for this given module
103
+ * @param targetModule name of the target module if it exists
104
+ * @returns ExportNamedDeclaration containing the statement of the dynamic import of the target module
105
+ */
106
+ export declare function exportNamedDeclarationForDynamicImport(moduleName: string, moduleNamespace: string, targetModule?: string): t.ExportNamedDeclaration;
107
+ //# sourceMappingURL=genericAstGeneration.d.ts.map