@abp/ng.schematics 5.0.1 → 5.0.2
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/README.md +3 -3
- package/collection.json +29 -29
- package/commands/api/files-enum/proxy/__namespace@dir__/__name@kebab__.enum.ts.template +8 -8
- package/commands/api/files-model/proxy/__namespace@dir__/models.ts.template +9 -9
- package/commands/api/files-service/proxy/__namespace@dir__/__name@kebab__.service.ts.template +25 -25
- package/commands/api/index.d.ts +2 -2
- package/commands/api/index.js +112 -112
- package/commands/api/schema.json +45 -45
- package/commands/proxy-add/index.d.ts +2 -2
- package/commands/proxy-add/index.js +41 -41
- package/commands/proxy-add/schema.json +45 -45
- package/commands/proxy-index/index.d.ts +4 -4
- package/commands/proxy-index/index.js +14 -14
- package/commands/proxy-index/schema.json +18 -18
- package/commands/proxy-refresh/index.d.ts +3 -3
- package/commands/proxy-refresh/index.js +27 -27
- package/commands/proxy-refresh/schema.json +45 -45
- package/commands/proxy-remove/index.d.ts +3 -3
- package/commands/proxy-remove/index.js +33 -33
- package/commands/proxy-remove/schema.json +45 -45
- package/constants/api.d.ts +1 -1
- package/constants/api.js +4 -4
- package/constants/index.d.ts +4 -4
- package/constants/index.js +16 -16
- package/constants/proxy.d.ts +4 -4
- package/constants/proxy.js +24 -24
- package/constants/system-types.d.ts +1 -1
- package/constants/system-types.js +27 -27
- package/constants/volo.d.ts +1 -1
- package/constants/volo.js +4 -4
- package/enums/binding-source-id.d.ts +6 -6
- package/enums/binding-source-id.js +10 -10
- package/enums/exception.d.ts +16 -16
- package/enums/exception.js +2 -2
- package/enums/import-keyword.d.ts +4 -4
- package/enums/import-keyword.js +8 -8
- package/enums/index.d.ts +4 -4
- package/enums/index.js +16 -16
- package/enums/method-modifier.d.ts +6 -6
- package/enums/method-modifier.js +10 -10
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/models/api-definition.d.ts +72 -72
- package/models/api-definition.js +2 -2
- package/models/generate-proxy-schema.d.ts +18 -18
- package/models/generate-proxy-schema.js +2 -2
- package/models/import.d.ts +11 -11
- package/models/import.js +13 -13
- package/models/index.d.ts +10 -10
- package/models/index.js +22 -22
- package/models/method.d.ts +31 -31
- package/models/method.js +61 -61
- package/models/model.d.ts +48 -48
- package/models/model.js +71 -71
- package/models/project.d.ts +5 -5
- package/models/project.js +2 -2
- package/models/proxy-config.d.ts +4 -4
- package/models/proxy-config.js +2 -2
- package/models/service.d.ts +21 -21
- package/models/service.js +11 -11
- package/models/tree.d.ts +1 -1
- package/models/tree.js +2 -2
- package/models/util.d.ts +7 -7
- package/models/util.js +2 -2
- package/package.json +1 -1
- package/test-setup.d.ts +1 -1
- package/test-setup.js +3 -3
- package/utils/angular/ast-utils.d.ts +115 -115
- package/utils/angular/ast-utils.js +598 -598
- package/utils/angular/change.d.ts +66 -66
- package/utils/angular/change.js +96 -96
- package/utils/angular/config.d.ts +455 -455
- package/utils/angular/config.js +70 -70
- package/utils/angular/dependencies.d.ts +23 -23
- package/utils/angular/dependencies.js +58 -58
- package/utils/angular/find-module.d.ts +35 -35
- package/utils/angular/find-module.js +105 -105
- package/utils/angular/index.d.ts +17 -17
- package/utils/angular/index.js +29 -29
- package/utils/angular/json-file.d.ts +23 -23
- package/utils/angular/json-file.js +61 -61
- package/utils/angular/json-utils.d.ts +14 -14
- package/utils/angular/json-utils.js +158 -158
- package/utils/angular/latest-versions.d.ts +18 -18
- package/utils/angular/latest-versions.js +26 -26
- package/utils/angular/lint-fix.d.ts +9 -9
- package/utils/angular/lint-fix.js +41 -41
- package/utils/angular/ng-ast-utils.d.ts +5 -5
- package/utils/angular/ng-ast-utils.js +75 -75
- package/utils/angular/parse-name.d.ts +13 -13
- package/utils/angular/parse-name.js +21 -21
- package/utils/angular/paths.d.ts +8 -8
- package/utils/angular/paths.js +21 -21
- package/utils/angular/project-targets.d.ts +9 -9
- package/utils/angular/project-targets.js +15 -15
- package/utils/angular/tsconfig.d.ts +16 -16
- package/utils/angular/tsconfig.js +62 -62
- package/utils/angular/validation.d.ts +4 -4
- package/utils/angular/validation.js +73 -73
- package/utils/angular/workspace-models.d.ts +159 -159
- package/utils/angular/workspace-models.js +29 -29
- package/utils/angular/workspace.d.ts +18 -18
- package/utils/angular/workspace.js +75 -75
- package/utils/api.d.ts +2 -2
- package/utils/api.js +8 -8
- package/utils/ast.d.ts +4 -4
- package/utils/ast.js +23 -23
- package/utils/barrel.d.ts +4 -4
- package/utils/barrel.js +92 -92
- package/utils/common.d.ts +6 -6
- package/utils/common.js +33 -33
- package/utils/enum.d.ts +18 -18
- package/utils/enum.js +40 -40
- package/utils/file.d.ts +2 -2
- package/utils/file.js +9 -9
- package/utils/generics.d.ts +24 -24
- package/utils/generics.js +87 -87
- package/utils/import.d.ts +3 -3
- package/utils/import.js +11 -11
- package/utils/index.d.ts +19 -19
- package/utils/index.js +31 -31
- package/utils/model.d.ts +11 -11
- package/utils/model.js +141 -141
- package/utils/namespace.d.ts +1 -1
- package/utils/namespace.js +18 -18
- package/utils/path.d.ts +2 -2
- package/utils/path.js +36 -36
- package/utils/rule.d.ts +4 -4
- package/utils/rule.js +27 -27
- package/utils/service.d.ts +6 -6
- package/utils/service.js +82 -82
- package/utils/source.d.ts +13 -13
- package/utils/source.js +162 -162
- package/utils/text.d.ts +9 -9
- package/utils/text.js +46 -46
- package/utils/tree.d.ts +13 -13
- package/utils/tree.js +56 -56
- package/utils/type.d.ts +12 -12
- package/utils/type.js +102 -102
- package/utils/workspace.d.ts +8 -8
- package/utils/workspace.js +66 -66
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
import * as ts from 'typescript';
|
|
9
|
-
import { Change } from './change';
|
|
10
|
-
/**
|
|
11
|
-
* Add Import `import { symbolName } from fileName` if the import doesn't exit
|
|
12
|
-
* already. Assumes fileToEdit can be resolved and accessed.
|
|
13
|
-
* @param fileToEdit (file we want to add import to)
|
|
14
|
-
* @param symbolName (item to import)
|
|
15
|
-
* @param fileName (path to the file)
|
|
16
|
-
* @param isDefault (if true, import follows style for importing default exports)
|
|
17
|
-
* @return Change
|
|
18
|
-
*/
|
|
19
|
-
export declare function insertImport(source: ts.SourceFile, fileToEdit: string, symbolName: string, fileName: string, isDefault?: boolean): Change;
|
|
20
|
-
/**
|
|
21
|
-
* Find all nodes from the AST in the subtree of node of SyntaxKind kind.
|
|
22
|
-
* @param node
|
|
23
|
-
* @param kind
|
|
24
|
-
* @param max The maximum number of items to return.
|
|
25
|
-
* @param recursive Continue looking for nodes of kind recursive until end
|
|
26
|
-
* the last child even when node of kind has been found.
|
|
27
|
-
* @return all nodes of kind, or [] if none is found
|
|
28
|
-
*/
|
|
29
|
-
export declare function findNodes(node: ts.Node, kind: ts.SyntaxKind, max?: number, recursive?: boolean): ts.Node[];
|
|
30
|
-
/**
|
|
31
|
-
* Find all nodes from the AST in the subtree that satisfy a type guard.
|
|
32
|
-
* @param node
|
|
33
|
-
* @param guard
|
|
34
|
-
* @param max The maximum number of items to return.
|
|
35
|
-
* @param recursive Continue looking for nodes of kind recursive until end
|
|
36
|
-
* the last child even when node of kind has been found.
|
|
37
|
-
* @return all nodes that satisfy the type guard, or [] if none is found
|
|
38
|
-
*/
|
|
39
|
-
export declare function findNodes<T extends ts.Node>(node: ts.Node, guard: (node: ts.Node) => node is T, max?: number, recursive?: boolean): T[];
|
|
40
|
-
/**
|
|
41
|
-
* Get all the nodes from a source.
|
|
42
|
-
* @param sourceFile The source file object.
|
|
43
|
-
* @returns {Array<ts.Node>} An array of all the nodes in the source.
|
|
44
|
-
*/
|
|
45
|
-
export declare function getSourceNodes(sourceFile: ts.SourceFile): ts.Node[];
|
|
46
|
-
export declare function findNode(node: ts.Node, kind: ts.SyntaxKind, text: string): ts.Node | null;
|
|
47
|
-
/**
|
|
48
|
-
* Insert `toInsert` after the last occurence of `ts.SyntaxKind[nodes[i].kind]`
|
|
49
|
-
* or after the last of occurence of `syntaxKind` if the last occurence is a sub child
|
|
50
|
-
* of ts.SyntaxKind[nodes[i].kind] and save the changes in file.
|
|
51
|
-
*
|
|
52
|
-
* @param nodes insert after the last occurence of nodes
|
|
53
|
-
* @param toInsert string to insert
|
|
54
|
-
* @param file file to insert changes into
|
|
55
|
-
* @param fallbackPos position to insert if toInsert happens to be the first occurence
|
|
56
|
-
* @param syntaxKind the ts.SyntaxKind of the subchildren to insert after
|
|
57
|
-
* @return Change instance
|
|
58
|
-
* @throw Error if toInsert is first occurence but fall back is not set
|
|
59
|
-
*/
|
|
60
|
-
export declare function insertAfterLastOccurrence(nodes: ts.Node[], toInsert: string, file: string, fallbackPos: number, syntaxKind?: ts.SyntaxKind): Change;
|
|
61
|
-
export declare function getContentOfKeyLiteral(_source: ts.SourceFile, node: ts.Node): string | null;
|
|
62
|
-
export declare function getDecoratorMetadata(source: ts.SourceFile, identifier: string, module: string): ts.Node[];
|
|
63
|
-
/**
|
|
64
|
-
* Given a source file with @NgModule class(es), find the name of the first @NgModule class.
|
|
65
|
-
*
|
|
66
|
-
* @param source source file containing one or more @NgModule
|
|
67
|
-
* @returns the name of the first @NgModule, or `undefined` if none is found
|
|
68
|
-
*/
|
|
69
|
-
export declare function getFirstNgModuleName(source: ts.SourceFile): string | undefined;
|
|
70
|
-
export declare function getMetadataField(node: ts.ObjectLiteralExpression, metadataField: string): ts.ObjectLiteralElement[];
|
|
71
|
-
export declare function addSymbolToNgModuleMetadata(source: ts.SourceFile, ngModulePath: string, metadataField: string, symbolName: string, importPath?: string | null): Change[];
|
|
72
|
-
/**
|
|
73
|
-
* Custom function to insert a declaration (component, pipe, directive)
|
|
74
|
-
* into NgModule declarations. It also imports the component.
|
|
75
|
-
*/
|
|
76
|
-
export declare function addDeclarationToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
|
|
77
|
-
/**
|
|
78
|
-
* Custom function to insert an NgModule into NgModule imports. It also imports the module.
|
|
79
|
-
*/
|
|
80
|
-
export declare function addImportToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
|
|
81
|
-
/**
|
|
82
|
-
* Custom function to insert a provider into NgModule. It also imports it.
|
|
83
|
-
*/
|
|
84
|
-
export declare function addProviderToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
|
|
85
|
-
/**
|
|
86
|
-
* Custom function to insert an export into NgModule. It also imports it.
|
|
87
|
-
*/
|
|
88
|
-
export declare function addExportToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
|
|
89
|
-
/**
|
|
90
|
-
* Custom function to insert an export into NgModule. It also imports it.
|
|
91
|
-
*/
|
|
92
|
-
export declare function addBootstrapToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
|
|
93
|
-
/**
|
|
94
|
-
* Custom function to insert an entryComponent into NgModule. It also imports it.
|
|
95
|
-
* @deprecated - Since version 9.0.0 with Ivy, entryComponents is no longer necessary.
|
|
96
|
-
*/
|
|
97
|
-
export declare function addEntryComponentToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
|
|
98
|
-
/**
|
|
99
|
-
* Determine if an import already exists.
|
|
100
|
-
*/
|
|
101
|
-
export declare function isImported(source: ts.SourceFile, classifiedName: string, importPath: string): boolean;
|
|
102
|
-
/**
|
|
103
|
-
* This function returns the name of the environment export
|
|
104
|
-
* whether this export is aliased or not. If the environment file
|
|
105
|
-
* is not imported, then it will return `null`.
|
|
106
|
-
*/
|
|
107
|
-
export declare function getEnvironmentExportName(source: ts.SourceFile): string | null;
|
|
108
|
-
/**
|
|
109
|
-
* Returns the RouterModule declaration from NgModule metadata, if any.
|
|
110
|
-
*/
|
|
111
|
-
export declare function getRouterModuleDeclaration(source: ts.SourceFile): ts.Expression | undefined;
|
|
112
|
-
/**
|
|
113
|
-
* Adds a new route declaration to a router module (i.e. has a RouterModule declaration)
|
|
114
|
-
*/
|
|
115
|
-
export declare function addRouteDeclarationToModule(source: ts.SourceFile, fileToAdd: string, routeLiteral: string): Change;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import * as ts from 'typescript';
|
|
9
|
+
import { Change } from './change';
|
|
10
|
+
/**
|
|
11
|
+
* Add Import `import { symbolName } from fileName` if the import doesn't exit
|
|
12
|
+
* already. Assumes fileToEdit can be resolved and accessed.
|
|
13
|
+
* @param fileToEdit (file we want to add import to)
|
|
14
|
+
* @param symbolName (item to import)
|
|
15
|
+
* @param fileName (path to the file)
|
|
16
|
+
* @param isDefault (if true, import follows style for importing default exports)
|
|
17
|
+
* @return Change
|
|
18
|
+
*/
|
|
19
|
+
export declare function insertImport(source: ts.SourceFile, fileToEdit: string, symbolName: string, fileName: string, isDefault?: boolean): Change;
|
|
20
|
+
/**
|
|
21
|
+
* Find all nodes from the AST in the subtree of node of SyntaxKind kind.
|
|
22
|
+
* @param node
|
|
23
|
+
* @param kind
|
|
24
|
+
* @param max The maximum number of items to return.
|
|
25
|
+
* @param recursive Continue looking for nodes of kind recursive until end
|
|
26
|
+
* the last child even when node of kind has been found.
|
|
27
|
+
* @return all nodes of kind, or [] if none is found
|
|
28
|
+
*/
|
|
29
|
+
export declare function findNodes(node: ts.Node, kind: ts.SyntaxKind, max?: number, recursive?: boolean): ts.Node[];
|
|
30
|
+
/**
|
|
31
|
+
* Find all nodes from the AST in the subtree that satisfy a type guard.
|
|
32
|
+
* @param node
|
|
33
|
+
* @param guard
|
|
34
|
+
* @param max The maximum number of items to return.
|
|
35
|
+
* @param recursive Continue looking for nodes of kind recursive until end
|
|
36
|
+
* the last child even when node of kind has been found.
|
|
37
|
+
* @return all nodes that satisfy the type guard, or [] if none is found
|
|
38
|
+
*/
|
|
39
|
+
export declare function findNodes<T extends ts.Node>(node: ts.Node, guard: (node: ts.Node) => node is T, max?: number, recursive?: boolean): T[];
|
|
40
|
+
/**
|
|
41
|
+
* Get all the nodes from a source.
|
|
42
|
+
* @param sourceFile The source file object.
|
|
43
|
+
* @returns {Array<ts.Node>} An array of all the nodes in the source.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getSourceNodes(sourceFile: ts.SourceFile): ts.Node[];
|
|
46
|
+
export declare function findNode(node: ts.Node, kind: ts.SyntaxKind, text: string): ts.Node | null;
|
|
47
|
+
/**
|
|
48
|
+
* Insert `toInsert` after the last occurence of `ts.SyntaxKind[nodes[i].kind]`
|
|
49
|
+
* or after the last of occurence of `syntaxKind` if the last occurence is a sub child
|
|
50
|
+
* of ts.SyntaxKind[nodes[i].kind] and save the changes in file.
|
|
51
|
+
*
|
|
52
|
+
* @param nodes insert after the last occurence of nodes
|
|
53
|
+
* @param toInsert string to insert
|
|
54
|
+
* @param file file to insert changes into
|
|
55
|
+
* @param fallbackPos position to insert if toInsert happens to be the first occurence
|
|
56
|
+
* @param syntaxKind the ts.SyntaxKind of the subchildren to insert after
|
|
57
|
+
* @return Change instance
|
|
58
|
+
* @throw Error if toInsert is first occurence but fall back is not set
|
|
59
|
+
*/
|
|
60
|
+
export declare function insertAfterLastOccurrence(nodes: ts.Node[], toInsert: string, file: string, fallbackPos: number, syntaxKind?: ts.SyntaxKind): Change;
|
|
61
|
+
export declare function getContentOfKeyLiteral(_source: ts.SourceFile, node: ts.Node): string | null;
|
|
62
|
+
export declare function getDecoratorMetadata(source: ts.SourceFile, identifier: string, module: string): ts.Node[];
|
|
63
|
+
/**
|
|
64
|
+
* Given a source file with @NgModule class(es), find the name of the first @NgModule class.
|
|
65
|
+
*
|
|
66
|
+
* @param source source file containing one or more @NgModule
|
|
67
|
+
* @returns the name of the first @NgModule, or `undefined` if none is found
|
|
68
|
+
*/
|
|
69
|
+
export declare function getFirstNgModuleName(source: ts.SourceFile): string | undefined;
|
|
70
|
+
export declare function getMetadataField(node: ts.ObjectLiteralExpression, metadataField: string): ts.ObjectLiteralElement[];
|
|
71
|
+
export declare function addSymbolToNgModuleMetadata(source: ts.SourceFile, ngModulePath: string, metadataField: string, symbolName: string, importPath?: string | null): Change[];
|
|
72
|
+
/**
|
|
73
|
+
* Custom function to insert a declaration (component, pipe, directive)
|
|
74
|
+
* into NgModule declarations. It also imports the component.
|
|
75
|
+
*/
|
|
76
|
+
export declare function addDeclarationToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
|
|
77
|
+
/**
|
|
78
|
+
* Custom function to insert an NgModule into NgModule imports. It also imports the module.
|
|
79
|
+
*/
|
|
80
|
+
export declare function addImportToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
|
|
81
|
+
/**
|
|
82
|
+
* Custom function to insert a provider into NgModule. It also imports it.
|
|
83
|
+
*/
|
|
84
|
+
export declare function addProviderToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
|
|
85
|
+
/**
|
|
86
|
+
* Custom function to insert an export into NgModule. It also imports it.
|
|
87
|
+
*/
|
|
88
|
+
export declare function addExportToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
|
|
89
|
+
/**
|
|
90
|
+
* Custom function to insert an export into NgModule. It also imports it.
|
|
91
|
+
*/
|
|
92
|
+
export declare function addBootstrapToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
|
|
93
|
+
/**
|
|
94
|
+
* Custom function to insert an entryComponent into NgModule. It also imports it.
|
|
95
|
+
* @deprecated - Since version 9.0.0 with Ivy, entryComponents is no longer necessary.
|
|
96
|
+
*/
|
|
97
|
+
export declare function addEntryComponentToModule(source: ts.SourceFile, modulePath: string, classifiedName: string, importPath: string): Change[];
|
|
98
|
+
/**
|
|
99
|
+
* Determine if an import already exists.
|
|
100
|
+
*/
|
|
101
|
+
export declare function isImported(source: ts.SourceFile, classifiedName: string, importPath: string): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* This function returns the name of the environment export
|
|
104
|
+
* whether this export is aliased or not. If the environment file
|
|
105
|
+
* is not imported, then it will return `null`.
|
|
106
|
+
*/
|
|
107
|
+
export declare function getEnvironmentExportName(source: ts.SourceFile): string | null;
|
|
108
|
+
/**
|
|
109
|
+
* Returns the RouterModule declaration from NgModule metadata, if any.
|
|
110
|
+
*/
|
|
111
|
+
export declare function getRouterModuleDeclaration(source: ts.SourceFile): ts.Expression | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Adds a new route declaration to a router module (i.e. has a RouterModule declaration)
|
|
114
|
+
*/
|
|
115
|
+
export declare function addRouteDeclarationToModule(source: ts.SourceFile, fileToAdd: string, routeLiteral: string): Change;
|