@nx/react
Version:
24 lines (23 loc) • 1.7 kB
TypeScript
import { Tree } from '@nx/devkit';
import type { SourceFile, ObjectLiteralExpression, PropertyAssignment } from 'typescript';
/**
* Adds a Module Federation path to the exposes property of the module federation config
* The assumption here is made the we will only update a TypeScript Module Federation file namely 'module-federation.config.js'
* @param tree Tree for the workspace
* @param projectPath Project path relative to the workspace
* @param moduleName The name of the module to expose
* @param modulePath The path to the module to expose (e.g. './src/my-lib/my-lib.ts')
*/
export declare function addPathToExposes(tree: Tree, projectPath: string, moduleName: string, modulePath: string): void;
/**
* @param tree The workspace tree
* @param remoteName The name of the remote to check
* @returns Remote ProjectConfig if it exists, false otherwise
*/
export declare function checkRemoteExists(tree: Tree, remoteName: string): false | import("@nx/devkit").ProjectConfiguration;
export declare function getRemote(tree: Tree, remoteName: string): import("@nx/devkit").ProjectConfiguration;
export declare function findExposes(sourceFile: SourceFile): ObjectLiteralExpression;
export declare function createObjectEntry(moduleName: string, modulePath: string): PropertyAssignment;
export declare function updateExposesPropertyinAST(source: SourceFile, exposesObject: ObjectLiteralExpression, newEntry: PropertyAssignment): SourceFile;
export declare function writeToConfig(tree: Tree, filename: string, source: SourceFile, updatedSourceFile: SourceFile): void;
export declare function updateExposesProperty(tree: Tree, filename: string, moduleName: string, modulePath: string): void;