@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.
Files changed (141) hide show
  1. package/README.md +3 -3
  2. package/collection.json +29 -29
  3. package/commands/api/files-enum/proxy/__namespace@dir__/__name@kebab__.enum.ts.template +8 -8
  4. package/commands/api/files-model/proxy/__namespace@dir__/models.ts.template +9 -9
  5. package/commands/api/files-service/proxy/__namespace@dir__/__name@kebab__.service.ts.template +25 -25
  6. package/commands/api/index.d.ts +2 -2
  7. package/commands/api/index.js +112 -112
  8. package/commands/api/schema.json +45 -45
  9. package/commands/proxy-add/index.d.ts +2 -2
  10. package/commands/proxy-add/index.js +41 -41
  11. package/commands/proxy-add/schema.json +45 -45
  12. package/commands/proxy-index/index.d.ts +4 -4
  13. package/commands/proxy-index/index.js +14 -14
  14. package/commands/proxy-index/schema.json +18 -18
  15. package/commands/proxy-refresh/index.d.ts +3 -3
  16. package/commands/proxy-refresh/index.js +27 -27
  17. package/commands/proxy-refresh/schema.json +45 -45
  18. package/commands/proxy-remove/index.d.ts +3 -3
  19. package/commands/proxy-remove/index.js +33 -33
  20. package/commands/proxy-remove/schema.json +45 -45
  21. package/constants/api.d.ts +1 -1
  22. package/constants/api.js +4 -4
  23. package/constants/index.d.ts +4 -4
  24. package/constants/index.js +16 -16
  25. package/constants/proxy.d.ts +4 -4
  26. package/constants/proxy.js +24 -24
  27. package/constants/system-types.d.ts +1 -1
  28. package/constants/system-types.js +27 -27
  29. package/constants/volo.d.ts +1 -1
  30. package/constants/volo.js +4 -4
  31. package/enums/binding-source-id.d.ts +6 -6
  32. package/enums/binding-source-id.js +10 -10
  33. package/enums/exception.d.ts +16 -16
  34. package/enums/exception.js +2 -2
  35. package/enums/import-keyword.d.ts +4 -4
  36. package/enums/import-keyword.js +8 -8
  37. package/enums/index.d.ts +4 -4
  38. package/enums/index.js +16 -16
  39. package/enums/method-modifier.d.ts +6 -6
  40. package/enums/method-modifier.js +10 -10
  41. package/index.d.ts +1 -1
  42. package/index.js +2 -2
  43. package/models/api-definition.d.ts +72 -72
  44. package/models/api-definition.js +2 -2
  45. package/models/generate-proxy-schema.d.ts +18 -18
  46. package/models/generate-proxy-schema.js +2 -2
  47. package/models/import.d.ts +11 -11
  48. package/models/import.js +13 -13
  49. package/models/index.d.ts +10 -10
  50. package/models/index.js +22 -22
  51. package/models/method.d.ts +31 -31
  52. package/models/method.js +61 -61
  53. package/models/model.d.ts +48 -48
  54. package/models/model.js +71 -71
  55. package/models/project.d.ts +5 -5
  56. package/models/project.js +2 -2
  57. package/models/proxy-config.d.ts +4 -4
  58. package/models/proxy-config.js +2 -2
  59. package/models/service.d.ts +21 -21
  60. package/models/service.js +11 -11
  61. package/models/tree.d.ts +1 -1
  62. package/models/tree.js +2 -2
  63. package/models/util.d.ts +7 -7
  64. package/models/util.js +2 -2
  65. package/package.json +1 -1
  66. package/test-setup.d.ts +1 -1
  67. package/test-setup.js +3 -3
  68. package/utils/angular/ast-utils.d.ts +115 -115
  69. package/utils/angular/ast-utils.js +598 -598
  70. package/utils/angular/change.d.ts +66 -66
  71. package/utils/angular/change.js +96 -96
  72. package/utils/angular/config.d.ts +455 -455
  73. package/utils/angular/config.js +70 -70
  74. package/utils/angular/dependencies.d.ts +23 -23
  75. package/utils/angular/dependencies.js +58 -58
  76. package/utils/angular/find-module.d.ts +35 -35
  77. package/utils/angular/find-module.js +105 -105
  78. package/utils/angular/index.d.ts +17 -17
  79. package/utils/angular/index.js +29 -29
  80. package/utils/angular/json-file.d.ts +23 -23
  81. package/utils/angular/json-file.js +61 -61
  82. package/utils/angular/json-utils.d.ts +14 -14
  83. package/utils/angular/json-utils.js +158 -158
  84. package/utils/angular/latest-versions.d.ts +18 -18
  85. package/utils/angular/latest-versions.js +26 -26
  86. package/utils/angular/lint-fix.d.ts +9 -9
  87. package/utils/angular/lint-fix.js +41 -41
  88. package/utils/angular/ng-ast-utils.d.ts +5 -5
  89. package/utils/angular/ng-ast-utils.js +75 -75
  90. package/utils/angular/parse-name.d.ts +13 -13
  91. package/utils/angular/parse-name.js +21 -21
  92. package/utils/angular/paths.d.ts +8 -8
  93. package/utils/angular/paths.js +21 -21
  94. package/utils/angular/project-targets.d.ts +9 -9
  95. package/utils/angular/project-targets.js +15 -15
  96. package/utils/angular/tsconfig.d.ts +16 -16
  97. package/utils/angular/tsconfig.js +62 -62
  98. package/utils/angular/validation.d.ts +4 -4
  99. package/utils/angular/validation.js +73 -73
  100. package/utils/angular/workspace-models.d.ts +159 -159
  101. package/utils/angular/workspace-models.js +29 -29
  102. package/utils/angular/workspace.d.ts +18 -18
  103. package/utils/angular/workspace.js +75 -75
  104. package/utils/api.d.ts +2 -2
  105. package/utils/api.js +8 -8
  106. package/utils/ast.d.ts +4 -4
  107. package/utils/ast.js +23 -23
  108. package/utils/barrel.d.ts +4 -4
  109. package/utils/barrel.js +92 -92
  110. package/utils/common.d.ts +6 -6
  111. package/utils/common.js +33 -33
  112. package/utils/enum.d.ts +18 -18
  113. package/utils/enum.js +40 -40
  114. package/utils/file.d.ts +2 -2
  115. package/utils/file.js +9 -9
  116. package/utils/generics.d.ts +24 -24
  117. package/utils/generics.js +87 -87
  118. package/utils/import.d.ts +3 -3
  119. package/utils/import.js +11 -11
  120. package/utils/index.d.ts +19 -19
  121. package/utils/index.js +31 -31
  122. package/utils/model.d.ts +11 -11
  123. package/utils/model.js +141 -141
  124. package/utils/namespace.d.ts +1 -1
  125. package/utils/namespace.js +18 -18
  126. package/utils/path.d.ts +2 -2
  127. package/utils/path.js +36 -36
  128. package/utils/rule.d.ts +4 -4
  129. package/utils/rule.js +27 -27
  130. package/utils/service.d.ts +6 -6
  131. package/utils/service.js +82 -82
  132. package/utils/source.d.ts +13 -13
  133. package/utils/source.js +162 -162
  134. package/utils/text.d.ts +9 -9
  135. package/utils/text.js +46 -46
  136. package/utils/tree.d.ts +13 -13
  137. package/utils/tree.js +56 -56
  138. package/utils/type.d.ts +12 -12
  139. package/utils/type.js +102 -102
  140. package/utils/workspace.d.ts +8 -8
  141. 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;