1 | import { Change } from './change';
|
2 | import { Host } from './change';
|
3 | /**
|
4 | * Adds imports to mainFile and adds toBootstrap to the array of providers
|
5 | * in bootstrap, if not present
|
6 | * @param mainFile main.ts
|
7 | * @param imports Object { importedClass: ['path/to/import/from', defaultStyleImport?] }
|
8 | * @param toBootstrap
|
9 | */
|
10 | export declare function bootstrapItem(mainFile: string, imports: {
|
11 | [key: string]: (string | boolean)[];
|
12 | }, toBootstrap: string): Change[];
|
13 | /**
|
14 | * Add Import `import { symbolName } from fileName` if the import doesn't exit
|
15 | * already. Assumes fileToEdit can be resolved and accessed.
|
16 | * @param fileToEdit (file we want to add import to)
|
17 | * @param symbolName (item to import)
|
18 | * @param fileName (path to the file)
|
19 | * @param isDefault (if true, import follows style for importing default exports)
|
20 | * @return Change
|
21 | */
|
22 | export declare function insertImport(fileToEdit: string, symbolName: string, fileName: string, isDefault?: boolean): Change;
|
23 | /**
|
24 | * Inserts a path to the new route into src/routes.ts if it doesn't exist
|
25 | * @param routesFile
|
26 | * @param pathOptions
|
27 | * @return Change[]
|
28 | * @throws Error if routesFile has multiple export default or none.
|
29 | */
|
30 | export declare function addPathToRoutes(routesFile: string, pathOptions: any): Change[];
|
31 | /**
|
32 | * Add more properties to the route object in routes.ts
|
33 | * @param routesFile routes.ts
|
34 | * @param routes Object {route: [key, value]}
|
35 | */
|
36 | export declare function addItemsToRouteProperties(routesFile: string, routes: {
|
37 | [key: string]: string[];
|
38 | }): Change[];
|
39 | /**
|
40 | * Verifies that a component file exports a class of the component
|
41 | * @param file
|
42 | * @param componentName
|
43 | * @return whether file exports componentName
|
44 | */
|
45 | export declare function confirmComponentExport(file: string, componentName: string): boolean;
|
46 | /**
|
47 | * Resolve a path to a component file. If the path begins with path.sep, it is treated to be
|
48 | * absolute from the app/ directory. Otherwise, it is relative to currDir
|
49 | * @param projectRoot
|
50 | * @param currentDir
|
51 | * @param filePath componentName or path to componentName
|
52 | * @return component file name
|
53 | * @throw Error if component file referenced by path is not found
|
54 | */
|
55 | export declare function resolveComponentPath(projectRoot: string, currentDir: string, filePath: string): string;
|
56 | /**
|
57 | * Sort changes in decreasing order and apply them.
|
58 | * @param changes
|
59 | * @param host
|
60 | * @return Promise
|
61 | */
|
62 | export declare function applyChanges(changes: Change[], host?: Host): Promise<void>;
|