@abp/ng.schematics 10.5.0 → 10.6.0-rc.1

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 (259) hide show
  1. package/commands/ai-config/index.d.ts +3 -3
  2. package/commands/ai-config/index.js +88 -88
  3. package/commands/ai-config/index.js.map +1 -1
  4. package/commands/ai-config/model.d.ts +10 -10
  5. package/commands/ai-config/model.js +2 -2
  6. package/commands/api/files-service/proxy/__namespace@dir__/__name@kebab__.service.ts.template +6 -4
  7. package/commands/api/index.d.ts +2 -2
  8. package/commands/api/index.js +139 -138
  9. package/commands/api/index.js.map +1 -1
  10. package/commands/change-theme/index.d.ts +28 -28
  11. package/commands/change-theme/index.js +474 -473
  12. package/commands/change-theme/index.js.map +1 -1
  13. package/commands/change-theme/model.d.ts +5 -5
  14. package/commands/change-theme/model.js +2 -2
  15. package/commands/change-theme/style-map.d.ts +16 -16
  16. package/commands/change-theme/style-map.js +424 -424
  17. package/commands/change-theme/theme-options.enum.d.ts +6 -6
  18. package/commands/change-theme/theme-options.enum.js +11 -11
  19. package/commands/change-theme/theme-options.enum.js.map +1 -1
  20. package/commands/create-lib/index.d.ts +13 -13
  21. package/commands/create-lib/index.js +298 -298
  22. package/commands/create-lib/index.js.map +1 -1
  23. package/commands/create-lib/models/generate-lib-schema.d.ts +20 -20
  24. package/commands/create-lib/models/generate-lib-schema.js +8 -8
  25. package/commands/create-lib/models/generate-lib-schema.js.map +1 -1
  26. package/commands/create-lib/models/index.d.ts +1 -1
  27. package/commands/create-lib/models/index.js +4 -17
  28. package/commands/create-lib/models/index.js.map +1 -1
  29. package/commands/proxy-add/index.d.ts +2 -2
  30. package/commands/proxy-add/index.js +41 -41
  31. package/commands/proxy-add/index.js.map +1 -1
  32. package/commands/proxy-index/index.d.ts +5 -5
  33. package/commands/proxy-index/index.js +14 -14
  34. package/commands/proxy-index/index.js.map +1 -1
  35. package/commands/proxy-refresh/index.d.ts +3 -3
  36. package/commands/proxy-refresh/index.js +27 -27
  37. package/commands/proxy-refresh/index.js.map +1 -1
  38. package/commands/proxy-remove/index.d.ts +3 -3
  39. package/commands/proxy-remove/index.js +33 -33
  40. package/commands/proxy-remove/index.js.map +1 -1
  41. package/commands/ssr-add/index.d.ts +11 -11
  42. package/commands/ssr-add/index.js +360 -361
  43. package/commands/ssr-add/index.js.map +1 -1
  44. package/commands/ssr-add/server/index.d.ts +10 -10
  45. package/commands/ssr-add/server/index.js +209 -205
  46. package/commands/ssr-add/server/index.js.map +1 -1
  47. package/commands/ssr-add/server/index.ts +6 -2
  48. package/constants/api.d.ts +1 -1
  49. package/constants/api.js +4 -4
  50. package/constants/index.d.ts +4 -4
  51. package/constants/index.js +7 -20
  52. package/constants/index.js.map +1 -1
  53. package/constants/proxy.d.ts +4 -4
  54. package/constants/proxy.js +7 -7
  55. package/constants/symbols.d.ts +1 -1
  56. package/constants/symbols.js +4 -4
  57. package/constants/system-types.d.ts +1 -1
  58. package/constants/system-types.js +29 -29
  59. package/constants/volo.d.ts +5 -5
  60. package/constants/volo.js +34 -34
  61. package/enums/binding-source-id.d.ts +8 -7
  62. package/enums/binding-source-id.js +12 -11
  63. package/enums/binding-source-id.js.map +1 -1
  64. package/enums/exception.d.ts +17 -17
  65. package/enums/exception.js +2 -2
  66. package/enums/import-keyword.d.ts +4 -4
  67. package/enums/import-keyword.js +8 -8
  68. package/enums/import-keyword.js.map +1 -1
  69. package/enums/index.d.ts +5 -5
  70. package/enums/index.js +8 -21
  71. package/enums/index.js.map +1 -1
  72. package/enums/method-modifier.d.ts +6 -6
  73. package/enums/method-modifier.js +10 -10
  74. package/enums/method-modifier.js.map +1 -1
  75. package/enums/service-types.d.ts +6 -6
  76. package/enums/service-types.js +10 -10
  77. package/enums/service-types.js.map +1 -1
  78. package/index.d.ts +3 -3
  79. package/index.js +6 -19
  80. package/index.js.map +1 -1
  81. package/models/api-definition.d.ts +97 -93
  82. package/models/api-definition.js +2 -2
  83. package/models/generate-proxy-schema.d.ts +28 -28
  84. package/models/generate-proxy-schema.js +2 -2
  85. package/models/import.d.ts +11 -11
  86. package/models/import.js +13 -13
  87. package/models/index.d.ts +11 -11
  88. package/models/index.js +14 -27
  89. package/models/index.js.map +1 -1
  90. package/models/method.d.ts +36 -34
  91. package/models/method.js +73 -70
  92. package/models/method.js.map +1 -1
  93. package/models/model.d.ts +48 -48
  94. package/models/model.js +76 -76
  95. package/models/model.js.map +1 -1
  96. package/models/project.d.ts +5 -5
  97. package/models/project.js +2 -2
  98. package/models/proxy-config.d.ts +4 -4
  99. package/models/proxy-config.js +2 -2
  100. package/models/rule.d.ts +2 -2
  101. package/models/rule.js +2 -2
  102. package/models/service.d.ts +21 -21
  103. package/models/service.js +11 -11
  104. package/models/tree.d.ts +1 -1
  105. package/models/tree.js +2 -2
  106. package/models/util.d.ts +7 -7
  107. package/models/util.js +2 -2
  108. package/package.json +6 -6
  109. package/utils/angular/add-declaration-to-ng-module.d.ts +20 -20
  110. package/utils/angular/add-declaration-to-ng-module.js +45 -45
  111. package/utils/angular/add-declaration-to-ng-module.js.map +1 -1
  112. package/utils/angular/ast-utils.d.ts +106 -106
  113. package/utils/angular/ast-utils.js +518 -518
  114. package/utils/angular/ast-utils.js.map +1 -1
  115. package/utils/angular/change.d.ts +68 -68
  116. package/utils/angular/change.js +121 -121
  117. package/utils/angular/change.js.map +1 -1
  118. package/utils/angular/dependencies.d.ts +23 -23
  119. package/utils/angular/dependencies.js +56 -56
  120. package/utils/angular/dependencies.js.map +1 -1
  121. package/utils/angular/dependency.d.ts +96 -96
  122. package/utils/angular/dependency.js +123 -122
  123. package/utils/angular/dependency.js.map +1 -1
  124. package/utils/angular/eol.d.ts +8 -8
  125. package/utils/angular/eol.js +22 -23
  126. package/utils/angular/eol.js.map +1 -1
  127. package/utils/angular/find-module.d.ts +33 -33
  128. package/utils/angular/find-module.js +105 -105
  129. package/utils/angular/find-module.js.map +1 -1
  130. package/utils/angular/generate-from-files.d.ts +19 -19
  131. package/utils/angular/generate-from-files.js +48 -49
  132. package/utils/angular/generate-from-files.js.map +1 -1
  133. package/utils/angular/index.d.ts +15 -15
  134. package/utils/angular/index.js +18 -31
  135. package/utils/angular/index.js.map +1 -1
  136. package/utils/angular/json-file.d.ts +24 -24
  137. package/utils/angular/json-file.js +71 -71
  138. package/utils/angular/json-file.js.map +1 -1
  139. package/utils/angular/latest-versions/index.d.ts +28 -28
  140. package/utils/angular/latest-versions/index.js +31 -31
  141. package/utils/angular/ng-ast-utils.d.ts +12 -12
  142. package/utils/angular/ng-ast-utils.js +79 -79
  143. package/utils/angular/ng-ast-utils.js.map +1 -1
  144. package/utils/angular/parse-name.d.ts +13 -13
  145. package/utils/angular/parse-name.js +19 -20
  146. package/utils/angular/parse-name.js.map +1 -1
  147. package/utils/angular/paths.d.ts +8 -8
  148. package/utils/angular/paths.js +17 -18
  149. package/utils/angular/paths.js.map +1 -1
  150. package/utils/angular/project-targets.d.ts +11 -11
  151. package/utils/angular/project-targets.js +21 -22
  152. package/utils/angular/project-targets.js.map +1 -1
  153. package/utils/angular/standalone/app_component.d.ts +29 -29
  154. package/utils/angular/standalone/app_component.js +107 -107
  155. package/utils/angular/standalone/app_component.js.map +1 -1
  156. package/utils/angular/standalone/app_config.d.ts +23 -23
  157. package/utils/angular/standalone/app_config.js +89 -89
  158. package/utils/angular/standalone/app_config.js.map +1 -1
  159. package/utils/angular/standalone/code_block.d.ts +53 -53
  160. package/utils/angular/standalone/code_block.js +80 -79
  161. package/utils/angular/standalone/code_block.js.map +1 -1
  162. package/utils/angular/standalone/index.d.ts +9 -9
  163. package/utils/angular/standalone/index.js +13 -13
  164. package/utils/angular/standalone/rules.d.ts +45 -45
  165. package/utils/angular/standalone/rules.js +187 -188
  166. package/utils/angular/standalone/rules.js.map +1 -1
  167. package/utils/angular/standalone/util.d.ts +35 -35
  168. package/utils/angular/standalone/util.js +135 -135
  169. package/utils/angular/standalone/util.js.map +1 -1
  170. package/utils/angular/test/create-app-module.d.ts +9 -9
  171. package/utils/angular/test/create-app-module.js +14 -15
  172. package/utils/angular/test/create-app-module.js.map +1 -1
  173. package/utils/angular/test/get-file-content.d.ts +9 -9
  174. package/utils/angular/test/get-file-content.js +17 -18
  175. package/utils/angular/test/get-file-content.js.map +1 -1
  176. package/utils/angular/test/index.d.ts +9 -9
  177. package/utils/angular/test/index.js +12 -25
  178. package/utils/angular/test/index.js.map +1 -1
  179. package/utils/angular/validation.d.ts +10 -10
  180. package/utils/angular/validation.js +28 -28
  181. package/utils/angular/validation.js.map +1 -1
  182. package/utils/angular/workspace-models.d.ts +167 -167
  183. package/utils/angular/workspace-models.js +43 -43
  184. package/utils/angular/workspace-models.js.map +1 -1
  185. package/utils/angular/workspace.d.ts +65 -65
  186. package/utils/angular/workspace.js +135 -135
  187. package/utils/angular/workspace.js.map +1 -1
  188. package/utils/angular-schematic/generate-lib.d.ts +3 -3
  189. package/utils/angular-schematic/generate-lib.js +52 -53
  190. package/utils/angular-schematic/generate-lib.js.map +1 -1
  191. package/utils/angular-schematic/index.d.ts +1 -1
  192. package/utils/angular-schematic/index.js +4 -17
  193. package/utils/angular-schematic/index.js.map +1 -1
  194. package/utils/api.d.ts +2 -2
  195. package/utils/api.js +7 -8
  196. package/utils/api.js.map +1 -1
  197. package/utils/ast.d.ts +5 -5
  198. package/utils/ast.js +28 -28
  199. package/utils/ast.js.map +1 -1
  200. package/utils/barrel.d.ts +4 -4
  201. package/utils/barrel.js +86 -87
  202. package/utils/barrel.js.map +1 -1
  203. package/utils/common.d.ts +11 -11
  204. package/utils/common.js +78 -78
  205. package/utils/common.js.map +1 -1
  206. package/utils/enum.d.ts +18 -18
  207. package/utils/enum.js +39 -40
  208. package/utils/enum.js.map +1 -1
  209. package/utils/file.d.ts +2 -2
  210. package/utils/file.js +8 -9
  211. package/utils/file.js.map +1 -1
  212. package/utils/generics.d.ts +26 -26
  213. package/utils/generics.js +89 -89
  214. package/utils/generics.js.map +1 -1
  215. package/utils/import.d.ts +3 -3
  216. package/utils/import.js +10 -11
  217. package/utils/import.js.map +1 -1
  218. package/utils/index.d.ts +22 -22
  219. package/utils/index.js +25 -38
  220. package/utils/index.js.map +1 -1
  221. package/utils/methods.d.ts +4 -4
  222. package/utils/methods.js +31 -31
  223. package/utils/methods.js.map +1 -1
  224. package/utils/model.d.ts +14 -14
  225. package/utils/model.js +217 -211
  226. package/utils/model.js.map +1 -1
  227. package/utils/namespace.d.ts +1 -1
  228. package/utils/namespace.js +17 -18
  229. package/utils/namespace.js.map +1 -1
  230. package/utils/ng-module.d.ts +46 -46
  231. package/utils/ng-module.js +126 -125
  232. package/utils/ng-module.js.map +1 -1
  233. package/utils/path.d.ts +2 -2
  234. package/utils/path.js +35 -36
  235. package/utils/path.js.map +1 -1
  236. package/utils/rule.d.ts +4 -4
  237. package/utils/rule.js +32 -33
  238. package/utils/rule.js.map +1 -1
  239. package/utils/service.d.ts +8 -8
  240. package/utils/service.js +280 -171
  241. package/utils/service.js.map +1 -1
  242. package/utils/source.d.ts +13 -13
  243. package/utils/source.js +165 -165
  244. package/utils/source.js.map +1 -1
  245. package/utils/standalone.d.ts +59 -59
  246. package/utils/standalone.js +146 -145
  247. package/utils/standalone.js.map +1 -1
  248. package/utils/text.d.ts +10 -10
  249. package/utils/text.js +59 -59
  250. package/utils/text.js.map +1 -1
  251. package/utils/tree.d.ts +14 -14
  252. package/utils/tree.js +83 -83
  253. package/utils/tree.js.map +1 -1
  254. package/utils/type.d.ts +13 -13
  255. package/utils/type.js +112 -113
  256. package/utils/type.js.map +1 -1
  257. package/utils/workspace.d.ts +20 -20
  258. package/utils/workspace.js +113 -114
  259. package/utils/workspace.js.map +1 -1
@@ -1,24 +1,23 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.dev/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.getEOL = void 0;
11
- const node_os_1 = require("node:os");
12
- const CRLF = '\r\n';
13
- const LF = '\n';
14
- function getEOL(content) {
15
- const newlines = content.match(/(?:\r?\n)/g);
16
- if (newlines?.length) {
17
- const crlf = newlines.filter(l => l === CRLF).length;
18
- const lf = newlines.length - crlf;
19
- return crlf > lf ? CRLF : LF;
20
- }
21
- return node_os_1.EOL;
22
- }
23
- exports.getEOL = getEOL;
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.dev/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.getEOL = getEOL;
11
+ const node_os_1 = require("node:os");
12
+ const CRLF = '\r\n';
13
+ const LF = '\n';
14
+ function getEOL(content) {
15
+ const newlines = content.match(/(?:\r?\n)/g);
16
+ if (newlines?.length) {
17
+ const crlf = newlines.filter(l => l === CRLF).length;
18
+ const lf = newlines.length - crlf;
19
+ return crlf > lf ? CRLF : LF;
20
+ }
21
+ return node_os_1.EOL;
22
+ }
24
23
  //# sourceMappingURL=eol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eol.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/eol.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,qCAA8B;AAE9B,MAAM,IAAI,GAAG,MAAM,CAAC;AACpB,MAAM,EAAE,GAAG,IAAI,CAAC;AAEhB,SAAgB,MAAM,CAAC,OAAe;IACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAE7C,IAAI,QAAQ,EAAE,MAAM,EAAE;QACpB,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC;QACrD,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;QAElC,OAAO,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9B;IAED,OAAO,aAAG,CAAC;AACb,CAAC;AAXD,wBAWC"}
1
+ {"version":3,"file":"eol.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/eol.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAOH,wBAWC;AAhBD,qCAA8B;AAE9B,MAAM,IAAI,GAAG,MAAM,CAAC;AACpB,MAAM,EAAE,GAAG,IAAI,CAAC;AAEhB,SAAgB,MAAM,CAAC,OAAe;IACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAE7C,IAAI,QAAQ,EAAE,MAAM,EAAE,CAAC;QACrB,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC;QACrD,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;QAElC,OAAO,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/B,CAAC;IAED,OAAO,aAAG,CAAC;AACb,CAAC"}
@@ -1,33 +1,33 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC 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.dev/license
7
- */
8
- import { Path } from '@angular-devkit/core';
9
- import { Tree } from '@angular-devkit/schematics';
10
- export interface ModuleOptions {
11
- module?: string;
12
- name: string;
13
- flat?: boolean;
14
- path?: string;
15
- skipImport?: boolean;
16
- moduleExt?: string;
17
- routingModuleExt?: string;
18
- standalone?: boolean;
19
- }
20
- export declare const MODULE_EXT = ".module.ts";
21
- export declare const ROUTING_MODULE_EXT = "-routing.module.ts";
22
- /**
23
- * Find the module referred by a set of options passed to the schematics.
24
- */
25
- export declare function findModuleFromOptions(host: Tree, options: ModuleOptions): Path | undefined;
26
- /**
27
- * Function to find the "closest" module to a generated file's path.
28
- */
29
- export declare function findModule(host: Tree, generateDir: string, moduleExt?: string, routingModuleExt?: string): Path;
30
- /**
31
- * Build a relative path from one file path to another file path.
32
- */
33
- export declare function buildRelativePath(from: string, to: string): string;
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC 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.dev/license
7
+ */
8
+ import { Path } from '@angular-devkit/core';
9
+ import { Tree } from '@angular-devkit/schematics';
10
+ export interface ModuleOptions {
11
+ module?: string;
12
+ name: string;
13
+ flat?: boolean;
14
+ path?: string;
15
+ skipImport?: boolean;
16
+ moduleExt?: string;
17
+ routingModuleExt?: string;
18
+ standalone?: boolean;
19
+ }
20
+ export declare const MODULE_EXT = ".module.ts";
21
+ export declare const ROUTING_MODULE_EXT = "-routing.module.ts";
22
+ /**
23
+ * Find the module referred by a set of options passed to the schematics.
24
+ */
25
+ export declare function findModuleFromOptions(host: Tree, options: ModuleOptions): Path | undefined;
26
+ /**
27
+ * Function to find the "closest" module to a generated file's path.
28
+ */
29
+ export declare function findModule(host: Tree, generateDir: string, moduleExt?: string, routingModuleExt?: string): Path;
30
+ /**
31
+ * Build a relative path from one file path to another file path.
32
+ */
33
+ export declare function buildRelativePath(from: string, to: string): string;
@@ -1,106 +1,106 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.dev/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.buildRelativePath = exports.findModule = exports.findModuleFromOptions = exports.ROUTING_MODULE_EXT = exports.MODULE_EXT = void 0;
11
- const core_1 = require("@angular-devkit/core");
12
- exports.MODULE_EXT = '.module.ts';
13
- exports.ROUTING_MODULE_EXT = '-routing.module.ts';
14
- /**
15
- * Find the module referred by a set of options passed to the schematics.
16
- */
17
- function findModuleFromOptions(host, options) {
18
- if (options.standalone || options.skipImport) {
19
- return undefined;
20
- }
21
- const moduleExt = options.moduleExt || exports.MODULE_EXT;
22
- const routingModuleExt = options.routingModuleExt || exports.ROUTING_MODULE_EXT;
23
- if (!options.module) {
24
- const pathToCheck = (options.path || '') + '/' + options.name;
25
- return (0, core_1.normalize)(findModule(host, pathToCheck, moduleExt, routingModuleExt));
26
- }
27
- else {
28
- const modulePath = (0, core_1.normalize)(`/${options.path}/${options.module}`);
29
- const componentPath = (0, core_1.normalize)(`/${options.path}/${options.name}`);
30
- const moduleBaseName = (0, core_1.normalize)(modulePath).split('/').pop();
31
- const candidateSet = new Set([(0, core_1.normalize)(options.path || '/')]);
32
- for (let dir = modulePath; dir != core_1.NormalizedRoot; dir = (0, core_1.dirname)(dir)) {
33
- candidateSet.add(dir);
34
- }
35
- for (let dir = componentPath; dir != core_1.NormalizedRoot; dir = (0, core_1.dirname)(dir)) {
36
- candidateSet.add(dir);
37
- }
38
- const candidatesDirs = [...candidateSet].sort((a, b) => b.length - a.length);
39
- for (const c of candidatesDirs) {
40
- const candidateFiles = ['', `${moduleBaseName}.ts`, `${moduleBaseName}${moduleExt}`].map(x => (0, core_1.join)(c, x));
41
- for (const sc of candidateFiles) {
42
- if (host.exists(sc) && host.readText(sc).includes('@NgModule')) {
43
- return (0, core_1.normalize)(sc);
44
- }
45
- }
46
- }
47
- throw new Error(`Specified module '${options.module}' does not exist.\n` +
48
- `Looked in the following directories:\n ${candidatesDirs.join('\n ')}`);
49
- }
50
- }
51
- exports.findModuleFromOptions = findModuleFromOptions;
52
- /**
53
- * Function to find the "closest" module to a generated file's path.
54
- */
55
- function findModule(host, generateDir, moduleExt = exports.MODULE_EXT, routingModuleExt = exports.ROUTING_MODULE_EXT) {
56
- let dir = host.getDir('/' + generateDir);
57
- let foundRoutingModule = false;
58
- while (dir) {
59
- const allMatches = dir.subfiles.filter(p => p.endsWith(moduleExt));
60
- const filteredMatches = allMatches.filter(p => !p.endsWith(routingModuleExt));
61
- foundRoutingModule = foundRoutingModule || allMatches.length !== filteredMatches.length;
62
- if (filteredMatches.length == 1) {
63
- return (0, core_1.join)(dir.path, filteredMatches[0]);
64
- }
65
- else if (filteredMatches.length > 1) {
66
- throw new Error(`More than one module matches. Use the '--skip-import' option to skip importing ` +
67
- 'the component into the closest module or use the module option to specify a module.');
68
- }
69
- dir = dir.parent;
70
- }
71
- const errorMsg = foundRoutingModule
72
- ? 'Could not find a non Routing NgModule.' +
73
- `\nModules with suffix '${routingModuleExt}' are strictly reserved for routing.` +
74
- `\nUse the '--skip-import' option to skip importing in NgModule.`
75
- : `Could not find an NgModule. Use the '--skip-import' option to skip importing in NgModule.`;
76
- throw new Error(errorMsg);
77
- }
78
- exports.findModule = findModule;
79
- /**
80
- * Build a relative path from one file path to another file path.
81
- */
82
- function buildRelativePath(from, to) {
83
- from = (0, core_1.normalize)(from);
84
- to = (0, core_1.normalize)(to);
85
- // Convert to arrays.
86
- const fromParts = from.split('/');
87
- const toParts = to.split('/');
88
- // Remove file names (preserving destination)
89
- fromParts.pop();
90
- const toFileName = toParts.pop();
91
- const relativePath = (0, core_1.relative)((0, core_1.normalize)(fromParts.join('/') || '/'), (0, core_1.normalize)(toParts.join('/') || '/'));
92
- let pathPrefix = '';
93
- // Set the path prefix for same dir or child dir, parent dir starts with `..`
94
- if (!relativePath) {
95
- pathPrefix = '.';
96
- }
97
- else if (!relativePath.startsWith('.')) {
98
- pathPrefix = `./`;
99
- }
100
- if (pathPrefix && !pathPrefix.endsWith('/')) {
101
- pathPrefix += '/';
102
- }
103
- return pathPrefix + (relativePath ? relativePath + '/' : '') + toFileName;
104
- }
105
- exports.buildRelativePath = buildRelativePath;
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.dev/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ROUTING_MODULE_EXT = exports.MODULE_EXT = void 0;
11
+ exports.findModuleFromOptions = findModuleFromOptions;
12
+ exports.findModule = findModule;
13
+ exports.buildRelativePath = buildRelativePath;
14
+ const core_1 = require("@angular-devkit/core");
15
+ exports.MODULE_EXT = '.module.ts';
16
+ exports.ROUTING_MODULE_EXT = '-routing.module.ts';
17
+ /**
18
+ * Find the module referred by a set of options passed to the schematics.
19
+ */
20
+ function findModuleFromOptions(host, options) {
21
+ if (options.standalone || options.skipImport) {
22
+ return undefined;
23
+ }
24
+ const moduleExt = options.moduleExt || exports.MODULE_EXT;
25
+ const routingModuleExt = options.routingModuleExt || exports.ROUTING_MODULE_EXT;
26
+ if (!options.module) {
27
+ const pathToCheck = (options.path || '') + '/' + options.name;
28
+ return (0, core_1.normalize)(findModule(host, pathToCheck, moduleExt, routingModuleExt));
29
+ }
30
+ else {
31
+ const modulePath = (0, core_1.normalize)(`/${options.path}/${options.module}`);
32
+ const componentPath = (0, core_1.normalize)(`/${options.path}/${options.name}`);
33
+ const moduleBaseName = (0, core_1.normalize)(modulePath).split('/').pop();
34
+ const candidateSet = new Set([(0, core_1.normalize)(options.path || '/')]);
35
+ for (let dir = modulePath; dir != core_1.NormalizedRoot; dir = (0, core_1.dirname)(dir)) {
36
+ candidateSet.add(dir);
37
+ }
38
+ for (let dir = componentPath; dir != core_1.NormalizedRoot; dir = (0, core_1.dirname)(dir)) {
39
+ candidateSet.add(dir);
40
+ }
41
+ const candidatesDirs = [...candidateSet].sort((a, b) => b.length - a.length);
42
+ for (const c of candidatesDirs) {
43
+ const candidateFiles = ['', `${moduleBaseName}.ts`, `${moduleBaseName}${moduleExt}`].map(x => (0, core_1.join)(c, x));
44
+ for (const sc of candidateFiles) {
45
+ if (host.exists(sc) && host.readText(sc).includes('@NgModule')) {
46
+ return (0, core_1.normalize)(sc);
47
+ }
48
+ }
49
+ }
50
+ throw new Error(`Specified module '${options.module}' does not exist.\n` +
51
+ `Looked in the following directories:\n ${candidatesDirs.join('\n ')}`);
52
+ }
53
+ }
54
+ /**
55
+ * Function to find the "closest" module to a generated file's path.
56
+ */
57
+ function findModule(host, generateDir, moduleExt = exports.MODULE_EXT, routingModuleExt = exports.ROUTING_MODULE_EXT) {
58
+ let dir = host.getDir('/' + generateDir);
59
+ let foundRoutingModule = false;
60
+ while (dir) {
61
+ const allMatches = dir.subfiles.filter(p => p.endsWith(moduleExt));
62
+ const filteredMatches = allMatches.filter(p => !p.endsWith(routingModuleExt));
63
+ foundRoutingModule = foundRoutingModule || allMatches.length !== filteredMatches.length;
64
+ if (filteredMatches.length == 1) {
65
+ return (0, core_1.join)(dir.path, filteredMatches[0]);
66
+ }
67
+ else if (filteredMatches.length > 1) {
68
+ throw new Error(`More than one module matches. Use the '--skip-import' option to skip importing ` +
69
+ 'the component into the closest module or use the module option to specify a module.');
70
+ }
71
+ dir = dir.parent;
72
+ }
73
+ const errorMsg = foundRoutingModule
74
+ ? 'Could not find a non Routing NgModule.' +
75
+ `\nModules with suffix '${routingModuleExt}' are strictly reserved for routing.` +
76
+ `\nUse the '--skip-import' option to skip importing in NgModule.`
77
+ : `Could not find an NgModule. Use the '--skip-import' option to skip importing in NgModule.`;
78
+ throw new Error(errorMsg);
79
+ }
80
+ /**
81
+ * Build a relative path from one file path to another file path.
82
+ */
83
+ function buildRelativePath(from, to) {
84
+ from = (0, core_1.normalize)(from);
85
+ to = (0, core_1.normalize)(to);
86
+ // Convert to arrays.
87
+ const fromParts = from.split('/');
88
+ const toParts = to.split('/');
89
+ // Remove file names (preserving destination)
90
+ fromParts.pop();
91
+ const toFileName = toParts.pop();
92
+ const relativePath = (0, core_1.relative)((0, core_1.normalize)(fromParts.join('/') || '/'), (0, core_1.normalize)(toParts.join('/') || '/'));
93
+ let pathPrefix = '';
94
+ // Set the path prefix for same dir or child dir, parent dir starts with `..`
95
+ if (!relativePath) {
96
+ pathPrefix = '.';
97
+ }
98
+ else if (!relativePath.startsWith('.')) {
99
+ pathPrefix = `./`;
100
+ }
101
+ if (pathPrefix && !pathPrefix.endsWith('/')) {
102
+ pathPrefix += '/';
103
+ }
104
+ return pathPrefix + (relativePath ? relativePath + '/' : '') + toFileName;
105
+ }
106
106
  //# sourceMappingURL=find-module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-module.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/find-module.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+CAAgG;AAcnF,QAAA,UAAU,GAAG,YAAY,CAAC;AAC1B,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAEvD;;GAEG;AACH,SAAgB,qBAAqB,CAAC,IAAU,EAAE,OAAsB;IACtE,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,EAAE;QAC5C,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,kBAAU,CAAC;IAClD,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,0BAAkB,CAAC;IAExE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;QAE9D,OAAO,IAAA,gBAAS,EAAC,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC;KAC9E;SAAM;QACL,MAAM,UAAU,GAAG,IAAA,gBAAS,EAAC,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACnE,MAAM,aAAa,GAAG,IAAA,gBAAS,EAAC,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACpE,MAAM,cAAc,GAAG,IAAA,gBAAS,EAAC,UAAU,CAAC,CAAC,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H,SAAgB,iBAAiB,CAAC,IAAY,EAAE,EAAU;IACxD,IAAI,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,CAAC;IACvB,EAAE,GAAG,IAAA,gBAAS,EAAC,EAAE,CAAC,CAAC;IAEnB,qBAAqB;IACrB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE9B,6CAA6C;IAC7C,SAAS,CAAC,GAAG,EAAE,CAAC;IAChB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAEjC,MAAM,YAAY,GAAG,IAAA,eAAQ,EAC3B,IAAA,gBAAS,EAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,EACrC,IAAA,gBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CACpC,CAAC;IACF,IAAI,UAAU,GAAG,EAAE,CAAC;IAEpB,6EAA6E;IAC7E,IAAI,CAAC,YAAY,EAAE;QACjB,UAAU,GAAG,GAAG,CAAC;KAClB;SAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACxC,UAAU,GAAG,IAAI,CAAC;KACnB;IACD,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC3C,UAAU,IAAI,GAAG,CAAC;KACnB;IAED,OAAO,UAAU,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC;AAC5E,CAAC;AA7BD,8CA6BC"}
1
+ {"version":3,"file":"find-module.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/find-module.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAsBH,sDA4CC;AAKD,gCAkCC;AA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I,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE9B,6CAA6C;IAC7C,SAAS,CAAC,GAAG,EAAE,CAAC;IAChB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAEjC,MAAM,YAAY,GAAG,IAAA,eAAQ,EAC3B,IAAA,gBAAS,EAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,EACrC,IAAA,gBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CACpC,CAAC;IACF,IAAI,UAAU,GAAG,EAAE,CAAC;IAEpB,6EAA6E;IAC7E,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,UAAU,GAAG,GAAG,CAAC;IACnB,CAAC;SAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzC,UAAU,GAAG,IAAI,CAAC;IACpB,CAAC;IACD,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5C,UAAU,IAAI,GAAG,CAAC;IACpB,CAAC;IAED,OAAO,UAAU,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC;AAC5E,CAAC"}
@@ -1,19 +1,19 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC 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.dev/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- export interface GenerateFromFilesOptions {
10
- flat?: boolean;
11
- name: string;
12
- path?: string;
13
- prefix?: string;
14
- project: string;
15
- skipTests?: boolean;
16
- templateFilesDirectory?: string;
17
- type?: string;
18
- }
19
- export declare function generateFromFiles(options: GenerateFromFilesOptions, extraTemplateValues?: Record<string, string | ((v: string) => string)>): Rule;
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC 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.dev/license
7
+ */
8
+ import { Rule } from '@angular-devkit/schematics';
9
+ export interface GenerateFromFilesOptions {
10
+ flat?: boolean;
11
+ name: string;
12
+ path?: string;
13
+ prefix?: string;
14
+ project: string;
15
+ skipTests?: boolean;
16
+ templateFilesDirectory?: string;
17
+ type?: string;
18
+ }
19
+ export declare function generateFromFiles(options: GenerateFromFilesOptions, extraTemplateValues?: Record<string, string | ((v: string) => string)>): Rule;
@@ -1,50 +1,49 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.dev/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.generateFromFiles = void 0;
11
- const schematics_1 = require("@angular-devkit/schematics");
12
- const parse_name_1 = require("./parse-name");
13
- const validation_1 = require("./validation");
14
- const workspace_1 = require("./workspace");
15
- function generateFromFiles(options, extraTemplateValues = {}) {
16
- return async (host) => {
17
- options.path ?? (options.path = await (0, workspace_1.createDefaultPath)(host, options.project));
18
- options.prefix ?? (options.prefix = '');
19
- options.flat ?? (options.flat = true);
20
- // Schematic templates require a defined type value
21
- options.type ?? (options.type = '');
22
- const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
23
- options.name = parsedPath.name;
24
- options.path = parsedPath.path;
25
- (0, validation_1.validateClassName)(schematics_1.strings.classify(options.name));
26
- const templateFilesDirectory = options.templateFilesDirectory ?? './files';
27
- const templateSource = (0, schematics_1.apply)((0, schematics_1.url)(templateFilesDirectory), [
28
- options.skipTests ? (0, schematics_1.filter)(path => !path.endsWith('.spec.ts.template')) : (0, schematics_1.noop)(),
29
- (0, schematics_1.applyTemplates)({
30
- ...schematics_1.strings,
31
- ...options,
32
- ...extraTemplateValues,
33
- }),
34
- !options.type
35
- ? (0, schematics_1.forEach)((file => {
36
- return file.path.includes('..')
37
- ? {
38
- content: file.content,
39
- path: file.path.replace('..', '.'),
40
- }
41
- : file;
42
- }))
43
- : (0, schematics_1.noop)(),
44
- (0, schematics_1.move)(parsedPath.path + (options.flat ? '' : '/' + schematics_1.strings.dasherize(options.name))),
45
- ]);
46
- return (0, schematics_1.chain)([(0, schematics_1.mergeWith)(templateSource)]);
47
- };
48
- }
49
- exports.generateFromFiles = generateFromFiles;
1
+ "use strict";
2
+ /**
3
+ * @license
4
+ * Copyright Google LLC All Rights Reserved.
5
+ *
6
+ * Use of this source code is governed by an MIT-style license that can be
7
+ * found in the LICENSE file at https://angular.dev/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.generateFromFiles = generateFromFiles;
11
+ const schematics_1 = require("@angular-devkit/schematics");
12
+ const parse_name_1 = require("./parse-name");
13
+ const validation_1 = require("./validation");
14
+ const workspace_1 = require("./workspace");
15
+ function generateFromFiles(options, extraTemplateValues = {}) {
16
+ return async (host) => {
17
+ options.path ?? (options.path = await (0, workspace_1.createDefaultPath)(host, options.project));
18
+ options.prefix ?? (options.prefix = '');
19
+ options.flat ?? (options.flat = true);
20
+ // Schematic templates require a defined type value
21
+ options.type ?? (options.type = '');
22
+ const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
23
+ options.name = parsedPath.name;
24
+ options.path = parsedPath.path;
25
+ (0, validation_1.validateClassName)(schematics_1.strings.classify(options.name));
26
+ const templateFilesDirectory = options.templateFilesDirectory ?? './files';
27
+ const templateSource = (0, schematics_1.apply)((0, schematics_1.url)(templateFilesDirectory), [
28
+ options.skipTests ? (0, schematics_1.filter)(path => !path.endsWith('.spec.ts.template')) : (0, schematics_1.noop)(),
29
+ (0, schematics_1.applyTemplates)({
30
+ ...schematics_1.strings,
31
+ ...options,
32
+ ...extraTemplateValues,
33
+ }),
34
+ !options.type
35
+ ? (0, schematics_1.forEach)((file => {
36
+ return file.path.includes('..')
37
+ ? {
38
+ content: file.content,
39
+ path: file.path.replace('..', '.'),
40
+ }
41
+ : file;
42
+ }))
43
+ : (0, schematics_1.noop)(),
44
+ (0, schematics_1.move)(parsedPath.path + (options.flat ? '' : '/' + schematics_1.strings.dasherize(options.name))),
45
+ ]);
46
+ return (0, schematics_1.chain)([(0, schematics_1.mergeWith)(templateSource)]);
47
+ };
48
+ }
50
49
  //# sourceMappingURL=generate-from-files.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate-from-files.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/generate-from-files.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2DAcoC;AACpC,6CAAyC;AACzC,6CAAiD;AACjD,2CAAgD;AAahD,SAAgB,iBAAiB,CAC/B,OAAiC,EACjC,sBAAwE,EAAE;IAE1E,OAAO,KAAK,EAAE,IAAU,EAAE,EAAE;QAC1B,OAAO,CAAC,IAAI,KAAZ,OAAO,CAAC,IAAI,GAAK,MAAM,IAAA,6BAAiB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,EAAC;QAChE,OAAO,CAAC,MAAM,KAAd,OAAO,CAAC,MAAM,GAAK,EAAE,EAAC;QACtB,OAAO,CAAC,IAAI,KAAZ,OAAO,CAAC,IAAI,GAAK,IAAI,EAAC;QAEtB,mDAAmD;QACnD,OAAO,CAAC,IAAI,KAAZ,OAAO,CAAC,IAAI,GAAK,EAAE,EAAC;QAEpB,MAAM,UAAU,GAAG,IAAA,sBAAS,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC/B,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAE/B,IAAA,8BAAiB,EAAC,oBAAO,CAAC,QAAQ,CAAC,OAAO,CAA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BAAO;gBACV,GAAG,OAAO;gBACV,GAAG,mBAAmB;aACvB,CAAC;YACF,CAAC,OAAO,CAAC,IAAI;gBACX,CAAC,CAAC,IAAA,oBAAO,EAAC,CAAC,IAAI,CAAC,EAAE;oBACd,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;wBAC7B,CAAC,CAAC;4BACE,OAAO,EAAE,IAAI,CAAC,OAAO;4BACrB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;yBACnC;wBACH,CAAC,CAAC,IAAI,CAAC;gBACX,CAAC,CAAiB,CAAC;gBACrB,CAAC,CAAC,IAAA,iBAAI,GAAE;YACV,IAAA,iBAAI,EAAC,UAAU,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,oBAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;SACpF,CAAC,CAAC;QAEH,OAAO,IAAA,kBAAK,EAAC,CAAC,IAAA,sBAAS,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC;AACJ,CAAC"}
@@ -1,15 +1,15 @@
1
- export * from './ast-utils';
2
- export * from './change';
3
- export * from './dependencies';
4
- export * from './find-module';
5
- export * from './generate-from-files';
6
- export * from './json-file';
7
- export * from './ng-ast-utils';
8
- export * from './parse-name';
9
- export * from './paths';
10
- export * from './project-targets';
11
- export * from './validation';
12
- export * from './workspace';
13
- export * from './workspace-models';
14
- export * from './standalone';
15
- export * from './dependency';
1
+ export * from './ast-utils';
2
+ export * from './change';
3
+ export * from './dependencies';
4
+ export * from './find-module';
5
+ export * from './generate-from-files';
6
+ export * from './json-file';
7
+ export * from './ng-ast-utils';
8
+ export * from './parse-name';
9
+ export * from './paths';
10
+ export * from './project-targets';
11
+ export * from './validation';
12
+ export * from './workspace';
13
+ export * from './workspace-models';
14
+ export * from './standalone';
15
+ export * from './dependency';
@@ -1,32 +1,19 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ast-utils"), exports);
18
- __exportStar(require("./change"), exports);
19
- __exportStar(require("./dependencies"), exports);
20
- __exportStar(require("./find-module"), exports);
21
- __exportStar(require("./generate-from-files"), exports);
22
- __exportStar(require("./json-file"), exports);
23
- __exportStar(require("./ng-ast-utils"), exports);
24
- __exportStar(require("./parse-name"), exports);
25
- __exportStar(require("./paths"), exports);
26
- __exportStar(require("./project-targets"), exports);
27
- __exportStar(require("./validation"), exports);
28
- __exportStar(require("./workspace"), exports);
29
- __exportStar(require("./workspace-models"), exports);
30
- __exportStar(require("./standalone"), exports);
31
- __exportStar(require("./dependency"), exports);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./ast-utils"), exports);
5
+ tslib_1.__exportStar(require("./change"), exports);
6
+ tslib_1.__exportStar(require("./dependencies"), exports);
7
+ tslib_1.__exportStar(require("./find-module"), exports);
8
+ tslib_1.__exportStar(require("./generate-from-files"), exports);
9
+ tslib_1.__exportStar(require("./json-file"), exports);
10
+ tslib_1.__exportStar(require("./ng-ast-utils"), exports);
11
+ tslib_1.__exportStar(require("./parse-name"), exports);
12
+ tslib_1.__exportStar(require("./paths"), exports);
13
+ tslib_1.__exportStar(require("./project-targets"), exports);
14
+ tslib_1.__exportStar(require("./validation"), exports);
15
+ tslib_1.__exportStar(require("./workspace"), exports);
16
+ tslib_1.__exportStar(require("./workspace-models"), exports);
17
+ tslib_1.__exportStar(require("./standalone"), exports);
18
+ tslib_1.__exportStar(require("./dependency"), exports);
32
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,iDAA+B;AAC/B,gDAA8B;AAC9B,wDAAsC;AACtC,8CAA4B;AAC5B,iDAA+B;AAC/B,+CAA6B;AAC7B,0CAAwB;AACxB,oDAAkC;AAClC,+CAA6B;AAC7B,8CAA4B;AAC5B,qDAAmC;AACnC,+CAA6B;AAC7B,+CAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/schematics/src/utils/angular/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,mDAAyB;AACzB,yDAA+B;AAC/B,wDAA8B;AAC9B,gEAAsC;AACtC,sDAA4B;AAC5B,yDAA+B;AAC/B,uDAA6B;AAC7B,kDAAwB;AACxB,4DAAkC;AAClC,uDAA6B;AAC7B,sDAA4B;AAC5B,6DAAmC;AACnC,uDAA6B;AAC7B,uDAA6B"}