diff --git a/packages/addons/addons/client-function-transform/transformer-client.ts b/packages/addons/addons/client-function-transform/transformer-client.ts index 5e4f555..fcb4378 100644 --- a/packages/addons/addons/client-function-transform/transformer-client.ts +++ b/packages/addons/addons/client-function-transform/transformer-client.ts @@ -32,7 +32,7 @@ export const createClientTransformer = ({ libPath, functionsDir }: Transformatio } if (ts.isImportDeclaration(node)) { - return undefined; + return node; } if (!isTransformable(node)) { @@ -41,7 +41,7 @@ export const createClientTransformer = ({ libPath, functionsDir }: Transformatio const decorations = getDecoration(sf, node, DECORATOR_NAME); if (!isNodeExported(node) || !decorations) { - return undefined; + return node; } const [transformedNode, isServiceFunction] = transformNode(node, sf, decorations); @@ -49,7 +49,7 @@ export const createClientTransformer = ({ libPath, functionsDir }: Transformatio return transformedNode ?? node; }; - sf = ts.visitNode(sf, visitor); + sf = ts.visitNode(sf, visitor, ts.isSourceFile); if (hasServiceFunctions) { if (!hasInvokeImport(sf, libPath, NAMED_IMPORTS)) { sf = ts.factory.updateSourceFile(sf, [getImportInvoke(libPath, NAMED_IMPORTS), ...sf.statements]); @@ -94,7 +94,6 @@ export const hasInvokeImport = (sf: ts.SourceFile, libPath: string, namedImports export const getImportInvoke = (libPath: string, namedImports: string[]): ts.Statement => { return ts.factory.createImportDeclaration( - undefined, undefined, ts.factory.createImportClause( false, diff --git a/packages/addons/addons/magellan-shared/node-helpers.ts b/packages/addons/addons/magellan-shared/node-helpers.ts index d42cbd3..cf0469b 100644 --- a/packages/addons/addons/magellan-shared/node-helpers.ts +++ b/packages/addons/addons/magellan-shared/node-helpers.ts @@ -99,7 +99,6 @@ export const getFunctionName = (node: ts.VariableStatement | ts.FunctionDeclarat export const createInvokeImport = (libPath: string, namedImports: string[]): ts.Statement => { return factory.createImportDeclaration( - undefined, undefined, factory.createImportClause( false, diff --git a/packages/addons/addons/magellan-shared/transform-function.ts b/packages/addons/addons/magellan-shared/transform-function.ts index d6da18b..672b2b3 100644 --- a/packages/addons/addons/magellan-shared/transform-function.ts +++ b/packages/addons/addons/magellan-shared/transform-function.ts @@ -111,7 +111,6 @@ export const transformInvocableFunction = ( const parameters = getObjectLiteralsOfNode(node); return factory.updateFunctionDeclaration( node, - node.decorators, node.modifiers, node.asteriskToken, node.name, @@ -133,7 +132,6 @@ export const transformLocalServerFunction = (node: ts.Node): ts.Node => { const newParameters = createObjectifiedParameter(node); return factory.updateFunctionDeclaration( node, - node.decorators, node.modifiers, node.asteriskToken, node.name, @@ -178,9 +176,13 @@ const createObjectifiedParameter = (node: ts.Node): ts.ParameterDeclaration[] => parameters?.map(p => factory.createBindingElement(undefined, undefined, factory.createIdentifier(p.name.getText()), undefined)) ?? [] ); const typeLiteral = factory.createTypeLiteralNode( - parameters?.map(p => factory.createPropertySignature(p.modifiers, p.name.getText(), p.questionToken, p.type)) + parameters?.map(p => factory.createPropertySignature( + // TODO: API clash ModifierLike[] (new) vs. Modifier[] (old) + p.modifiers as any, + p.name.getText(), + p.questionToken, p.type)) ); - return [factory.createParameterDeclaration(undefined, undefined, undefined, bindingPattern, undefined, typeLiteral, undefined)]; + return [factory.createParameterDeclaration(undefined, undefined, bindingPattern, undefined, typeLiteral, undefined)]; }; /** diff --git a/packages/addons/addons/service-function-generate/transformer-server.ts b/packages/addons/addons/service-function-generate/transformer-server.ts index 3c3d191..cdf800e 100644 --- a/packages/addons/addons/service-function-generate/transformer-server.ts +++ b/packages/addons/addons/service-function-generate/transformer-server.ts @@ -52,7 +52,7 @@ export const createServerTransformer = ({ functionsDir }: TransformationArgument return ts.visitEachChild(node, visitor, ctx); }; - return ts.visitNode(sf, visitor); + return ts.visitNode(sf, visitor, ts.isSourceFile); }; }; return platformTransformerFactory;