@angular/cdk 8.0.2 → 8.1.0

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 (307) hide show
  1. package/a11y/typings/aria-describer/aria-describer.d.ts +4 -3
  2. package/a11y/typings/index.metadata.json +1 -1
  3. package/bundles/cdk-a11y.umd.js +42 -10
  4. package/bundles/cdk-a11y.umd.js.map +1 -1
  5. package/bundles/cdk-a11y.umd.min.js +1 -1
  6. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  7. package/bundles/cdk-drag-drop.umd.js +511 -81
  8. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  9. package/bundles/cdk-drag-drop.umd.min.js +2 -2
  10. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  11. package/bundles/cdk-overlay.umd.js +15 -13
  12. package/bundles/cdk-overlay.umd.js.map +1 -1
  13. package/bundles/cdk-overlay.umd.min.js +2 -2
  14. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  15. package/bundles/cdk-tree.umd.js +8 -6
  16. package/bundles/cdk-tree.umd.js.map +1 -1
  17. package/bundles/cdk-tree.umd.min.js +1 -1
  18. package/bundles/cdk-tree.umd.min.js.map +1 -1
  19. package/bundles/cdk.umd.js +1 -1
  20. package/bundles/cdk.umd.js.map +1 -1
  21. package/bundles/cdk.umd.min.js +1 -1
  22. package/bundles/cdk.umd.min.js.map +1 -1
  23. package/drag-drop/typings/directives/drag.d.ts +1 -1
  24. package/drag-drop/typings/directives/drop-list.d.ts +2 -0
  25. package/drag-drop/typings/drag-drop-registry.d.ts +2 -0
  26. package/drag-drop/typings/drag-ref.d.ts +10 -1
  27. package/drag-drop/typings/drop-list-ref.d.ts +59 -3
  28. package/drag-drop/typings/index.metadata.json +1 -1
  29. package/esm2015/a11y.js +35 -10
  30. package/esm2015/a11y.js.map +1 -1
  31. package/esm2015/cdk.js +1 -1
  32. package/esm2015/cdk.js.map +1 -1
  33. package/esm2015/drag-drop.js +446 -79
  34. package/esm2015/drag-drop.js.map +1 -1
  35. package/esm2015/overlay.js +14 -12
  36. package/esm2015/overlay.js.map +1 -1
  37. package/esm2015/tree.js +7 -6
  38. package/esm2015/tree.js.map +1 -1
  39. package/esm5/a11y.es5.js +42 -10
  40. package/esm5/a11y.es5.js.map +1 -1
  41. package/esm5/cdk.es5.js +1 -1
  42. package/esm5/cdk.es5.js.map +1 -1
  43. package/esm5/drag-drop.es5.js +509 -79
  44. package/esm5/drag-drop.es5.js.map +1 -1
  45. package/esm5/overlay.es5.js +15 -13
  46. package/esm5/overlay.es5.js.map +1 -1
  47. package/esm5/tree.es5.js +8 -6
  48. package/esm5/tree.es5.js.map +1 -1
  49. package/package.json +4 -4
  50. package/schematics/index.d.ts +1 -0
  51. package/schematics/index.js +1 -0
  52. package/schematics/index.js.map +1 -1
  53. package/schematics/ng-update/data/attribute-selectors.d.ts +1 -1
  54. package/schematics/ng-update/data/attribute-selectors.js +5 -13
  55. package/schematics/ng-update/data/attribute-selectors.js.map +1 -1
  56. package/schematics/ng-update/data/class-names.d.ts +1 -1
  57. package/schematics/ng-update/data/class-names.js +5 -21
  58. package/schematics/ng-update/data/class-names.js.map +1 -1
  59. package/schematics/ng-update/data/constructor-checks.d.ts +1 -1
  60. package/schematics/ng-update/data/constructor-checks.js +3 -5
  61. package/schematics/ng-update/data/constructor-checks.js.map +1 -1
  62. package/schematics/ng-update/data/css-selectors.d.ts +1 -1
  63. package/schematics/ng-update/data/css-selectors.js +1 -1
  64. package/schematics/ng-update/data/css-selectors.js.map +1 -1
  65. package/schematics/ng-update/data/element-selectors.d.ts +1 -1
  66. package/schematics/ng-update/data/element-selectors.js +1 -1
  67. package/schematics/ng-update/data/element-selectors.js.map +1 -1
  68. package/schematics/ng-update/data/input-names.d.ts +1 -1
  69. package/schematics/ng-update/data/input-names.js +13 -37
  70. package/schematics/ng-update/data/input-names.js.map +1 -1
  71. package/schematics/ng-update/data/method-call-checks.d.ts +1 -1
  72. package/schematics/ng-update/data/method-call-checks.js +6 -15
  73. package/schematics/ng-update/data/method-call-checks.js.map +1 -1
  74. package/schematics/ng-update/data/output-names.d.ts +1 -1
  75. package/schematics/ng-update/data/output-names.js +1 -1
  76. package/schematics/ng-update/data/output-names.js.map +1 -1
  77. package/schematics/ng-update/data/property-names.d.ts +1 -1
  78. package/schematics/ng-update/data/property-names.js +19 -59
  79. package/schematics/ng-update/data/property-names.js.map +1 -1
  80. package/schematics/ng-update/html-parsing/elements.js.map +1 -1
  81. package/schematics/ng-update/index.d.ts +0 -2
  82. package/schematics/ng-update/index.js +13 -24
  83. package/schematics/ng-update/index.js.map +1 -1
  84. package/schematics/ng-update/public-api.d.ts +0 -5
  85. package/schematics/ng-update/public-api.js +0 -5
  86. package/schematics/ng-update/public-api.js.map +1 -1
  87. package/schematics/ng-update/typescript/base-types.js.map +1 -1
  88. package/schematics/ng-update/typescript/module-specifiers.js.map +1 -1
  89. package/schematics/ng-update/upgrade-data.d.ts +5 -30
  90. package/schematics/ng-update/upgrade-data.js +4 -34
  91. package/schematics/ng-update/upgrade-data.js.map +1 -1
  92. package/schematics/ng-update/upgrade-rules/attribute-selectors-rule.d.ts +25 -0
  93. package/schematics/ng-update/upgrade-rules/attribute-selectors-rule.js +66 -0
  94. package/schematics/ng-update/upgrade-rules/attribute-selectors-rule.js.map +1 -0
  95. package/schematics/ng-update/upgrade-rules/class-inheritance-rule.d.ts +26 -0
  96. package/schematics/ng-update/upgrade-rules/{class-inheritance/classInheritanceCheckRule.js → class-inheritance-rule.js} +24 -20
  97. package/schematics/ng-update/upgrade-rules/class-inheritance-rule.js.map +1 -0
  98. package/{typings/schematics/ng-update/upgrade-rules/class-names/classNamesIdentifierRule.d.ts → schematics/ng-update/upgrade-rules/class-names-rule.d.ts} +7 -7
  99. package/schematics/ng-update/upgrade-rules/{class-names/classNamesIdentifierRule.js → class-names-rule.js} +19 -24
  100. package/schematics/ng-update/upgrade-rules/class-names-rule.js.map +1 -0
  101. package/schematics/ng-update/upgrade-rules/constructor-signature-rule.d.ts +29 -0
  102. package/schematics/ng-update/upgrade-rules/constructor-signature-rule.js +134 -0
  103. package/schematics/ng-update/upgrade-rules/constructor-signature-rule.js.map +1 -0
  104. package/schematics/ng-update/upgrade-rules/css-selectors-rule.d.ts +25 -0
  105. package/schematics/ng-update/upgrade-rules/css-selectors-rule.js +73 -0
  106. package/schematics/ng-update/upgrade-rules/css-selectors-rule.js.map +1 -0
  107. package/schematics/ng-update/upgrade-rules/element-selectors-rule.d.ts +25 -0
  108. package/schematics/ng-update/upgrade-rules/element-selectors-rule.js +64 -0
  109. package/schematics/ng-update/upgrade-rules/element-selectors-rule.js.map +1 -0
  110. package/schematics/ng-update/upgrade-rules/index.d.ts +13 -4
  111. package/schematics/ng-update/upgrade-rules/index.js +49 -29
  112. package/schematics/ng-update/upgrade-rules/index.js.map +1 -1
  113. package/schematics/ng-update/upgrade-rules/input-names-rule.d.ts +26 -0
  114. package/schematics/ng-update/upgrade-rules/input-names-rule.js +59 -0
  115. package/schematics/ng-update/upgrade-rules/input-names-rule.js.map +1 -0
  116. package/{typings/schematics/ng-update/upgrade-rules/signature-check/methodCallsCheckRule.d.ts → schematics/ng-update/upgrade-rules/method-call-arguments-rule.d.ts} +8 -9
  117. package/schematics/ng-update/upgrade-rules/method-call-arguments-rule.js +60 -0
  118. package/schematics/ng-update/upgrade-rules/method-call-arguments-rule.js.map +1 -0
  119. package/schematics/ng-update/upgrade-rules/misc-template-rule.d.ts +18 -0
  120. package/schematics/ng-update/upgrade-rules/misc-template-rule.js +37 -0
  121. package/schematics/ng-update/upgrade-rules/misc-template-rule.js.map +1 -0
  122. package/schematics/ng-update/upgrade-rules/output-names-rule.d.ts +22 -0
  123. package/schematics/ng-update/upgrade-rules/output-names-rule.js +46 -0
  124. package/schematics/ng-update/upgrade-rules/output-names-rule.js.map +1 -0
  125. package/schematics/ng-update/upgrade-rules/property-names-rule.d.ts +22 -0
  126. package/schematics/ng-update/upgrade-rules/property-names-rule.js +46 -0
  127. package/schematics/ng-update/upgrade-rules/property-names-rule.js.map +1 -0
  128. package/schematics/tsconfig.tsbuildinfo +2895 -3608
  129. package/schematics/update-tool/component-resource-collector.d.ts +41 -0
  130. package/schematics/update-tool/component-resource-collector.js +141 -0
  131. package/schematics/update-tool/component-resource-collector.js.map +1 -0
  132. package/schematics/update-tool/index.d.ts +13 -0
  133. package/schematics/update-tool/index.js +117 -0
  134. package/schematics/update-tool/index.js.map +1 -0
  135. package/schematics/update-tool/migration-rule.d.ts +45 -0
  136. package/schematics/update-tool/migration-rule.js +50 -0
  137. package/schematics/update-tool/migration-rule.js.map +1 -0
  138. package/schematics/update-tool/public-api.d.ts +12 -0
  139. package/schematics/update-tool/public-api.js +18 -0
  140. package/schematics/update-tool/public-api.js.map +1 -0
  141. package/schematics/{ng-update → update-tool}/target-version.d.ts +3 -3
  142. package/schematics/{ng-update → update-tool}/target-version.js +3 -3
  143. package/schematics/update-tool/target-version.js.map +1 -0
  144. package/schematics/update-tool/utils/decorators.d.ts +23 -0
  145. package/schematics/update-tool/utils/decorators.js +37 -0
  146. package/schematics/update-tool/utils/decorators.js.map +1 -0
  147. package/schematics/update-tool/utils/functions.d.ts +14 -0
  148. package/schematics/update-tool/utils/functions.js +20 -0
  149. package/schematics/update-tool/utils/functions.js.map +1 -0
  150. package/schematics/update-tool/utils/imports.d.ts +15 -0
  151. package/schematics/update-tool/utils/imports.js +35 -0
  152. package/schematics/update-tool/utils/imports.js.map +1 -0
  153. package/schematics/update-tool/utils/line-mappings.d.ts +21 -0
  154. package/schematics/update-tool/utils/line-mappings.js +75 -0
  155. package/schematics/update-tool/utils/line-mappings.js.map +1 -0
  156. package/schematics/update-tool/utils/parse-tsconfig.d.ts +9 -0
  157. package/schematics/update-tool/utils/parse-tsconfig.js +22 -0
  158. package/schematics/update-tool/utils/parse-tsconfig.js.map +1 -0
  159. package/schematics/update-tool/utils/property-name.d.ts +18 -0
  160. package/schematics/update-tool/utils/property-name.js +27 -0
  161. package/schematics/update-tool/utils/property-name.js.map +1 -0
  162. package/schematics/update-tool/version-changes.d.ts +32 -0
  163. package/schematics/update-tool/version-changes.js +41 -0
  164. package/schematics/update-tool/version-changes.js.map +1 -0
  165. package/schematics/{ng-update/upgrade-rules → utils}/project-tsconfig-paths.d.ts +4 -1
  166. package/schematics/{ng-update/upgrade-rules → utils}/project-tsconfig-paths.js +31 -20
  167. package/schematics/utils/project-tsconfig-paths.js.map +1 -0
  168. package/typings/a11y/aria-describer/aria-describer.d.ts +4 -3
  169. package/typings/a11y/index.metadata.json +1 -1
  170. package/typings/drag-drop/directives/drag.d.ts +1 -1
  171. package/typings/drag-drop/directives/drop-list.d.ts +2 -0
  172. package/typings/drag-drop/drag-drop-registry.d.ts +2 -0
  173. package/typings/drag-drop/drag-ref.d.ts +10 -1
  174. package/typings/drag-drop/drop-list-ref.d.ts +59 -3
  175. package/typings/drag-drop/index.metadata.json +1 -1
  176. package/typings/esm5/a11y/aria-describer/aria-describer.d.ts +4 -3
  177. package/typings/esm5/a11y/index.metadata.json +1 -1
  178. package/typings/esm5/drag-drop/directives/drag.d.ts +1 -1
  179. package/typings/esm5/drag-drop/directives/drop-list.d.ts +2 -0
  180. package/typings/esm5/drag-drop/drag-drop-registry.d.ts +2 -0
  181. package/typings/esm5/drag-drop/drag-ref.d.ts +10 -1
  182. package/typings/esm5/drag-drop/drop-list-ref.d.ts +59 -3
  183. package/typings/esm5/drag-drop/index.metadata.json +1 -1
  184. package/typings/esm5/index.metadata.json +1 -1
  185. package/typings/index.metadata.json +1 -1
  186. package/typings/schematics/index.d.ts +1 -0
  187. package/typings/schematics/ng-update/data/attribute-selectors.d.ts +1 -1
  188. package/typings/schematics/ng-update/data/class-names.d.ts +1 -1
  189. package/typings/schematics/ng-update/data/constructor-checks.d.ts +1 -1
  190. package/typings/schematics/ng-update/data/css-selectors.d.ts +1 -1
  191. package/typings/schematics/ng-update/data/element-selectors.d.ts +1 -1
  192. package/typings/schematics/ng-update/data/input-names.d.ts +1 -1
  193. package/typings/schematics/ng-update/data/method-call-checks.d.ts +1 -1
  194. package/typings/schematics/ng-update/data/output-names.d.ts +1 -1
  195. package/typings/schematics/ng-update/data/property-names.d.ts +1 -1
  196. package/typings/schematics/ng-update/index.d.ts +0 -2
  197. package/typings/schematics/ng-update/public-api.d.ts +0 -5
  198. package/typings/schematics/ng-update/upgrade-data.d.ts +5 -30
  199. package/typings/schematics/ng-update/upgrade-rules/attribute-selectors-rule.d.ts +25 -0
  200. package/typings/schematics/ng-update/upgrade-rules/class-inheritance-rule.d.ts +26 -0
  201. package/{schematics/ng-update/upgrade-rules/class-names/classNamesIdentifierRule.d.ts → typings/schematics/ng-update/upgrade-rules/class-names-rule.d.ts} +7 -7
  202. package/typings/schematics/ng-update/upgrade-rules/constructor-signature-rule.d.ts +29 -0
  203. package/typings/schematics/ng-update/upgrade-rules/css-selectors-rule.d.ts +25 -0
  204. package/typings/schematics/ng-update/upgrade-rules/element-selectors-rule.d.ts +25 -0
  205. package/typings/schematics/ng-update/upgrade-rules/index.d.ts +13 -4
  206. package/typings/schematics/ng-update/upgrade-rules/input-names-rule.d.ts +26 -0
  207. package/{schematics/ng-update/upgrade-rules/signature-check/methodCallsCheckRule.d.ts → typings/schematics/ng-update/upgrade-rules/method-call-arguments-rule.d.ts} +8 -9
  208. package/typings/schematics/ng-update/upgrade-rules/misc-template-rule.d.ts +18 -0
  209. package/typings/schematics/ng-update/upgrade-rules/output-names-rule.d.ts +22 -0
  210. package/typings/schematics/ng-update/upgrade-rules/property-names-rule.d.ts +22 -0
  211. package/typings/schematics/update-tool/component-resource-collector.d.ts +41 -0
  212. package/typings/schematics/update-tool/index.d.ts +13 -0
  213. package/typings/schematics/update-tool/migration-rule.d.ts +45 -0
  214. package/typings/schematics/update-tool/public-api.d.ts +12 -0
  215. package/typings/schematics/{ng-update → update-tool}/target-version.d.ts +3 -3
  216. package/typings/schematics/update-tool/utils/decorators.d.ts +23 -0
  217. package/typings/schematics/update-tool/utils/functions.d.ts +14 -0
  218. package/typings/schematics/update-tool/utils/imports.d.ts +15 -0
  219. package/typings/schematics/update-tool/utils/line-mappings.d.ts +21 -0
  220. package/typings/schematics/update-tool/utils/parse-tsconfig.d.ts +9 -0
  221. package/typings/schematics/update-tool/utils/property-name.d.ts +18 -0
  222. package/typings/schematics/update-tool/version-changes.d.ts +32 -0
  223. package/typings/schematics/{ng-update/upgrade-rules → utils}/project-tsconfig-paths.d.ts +4 -1
  224. package/schematics/ng-update/target-version.js.map +0 -1
  225. package/schematics/ng-update/tslint/component-file.d.ts +0 -14
  226. package/schematics/ng-update/tslint/component-file.js +0 -31
  227. package/schematics/ng-update/tslint/component-file.js.map +0 -1
  228. package/schematics/ng-update/tslint/component-walker.d.ts +0 -47
  229. package/schematics/ng-update/tslint/component-walker.js +0 -142
  230. package/schematics/ng-update/tslint/component-walker.js.map +0 -1
  231. package/schematics/ng-update/tslint/external-failure-walker.d.ts +0 -25
  232. package/schematics/ng-update/tslint/external-failure-walker.js +0 -38
  233. package/schematics/ng-update/tslint/external-failure-walker.js.map +0 -1
  234. package/schematics/ng-update/upgrade-rules/attribute-selectors/attributeSelectorsStringLiteralRule.d.ts +0 -16
  235. package/schematics/ng-update/upgrade-rules/attribute-selectors/attributeSelectorsStringLiteralRule.js +0 -49
  236. package/schematics/ng-update/upgrade-rules/attribute-selectors/attributeSelectorsStringLiteralRule.js.map +0 -1
  237. package/schematics/ng-update/upgrade-rules/attribute-selectors/attributeSelectorsStylesheetRule.d.ts +0 -31
  238. package/schematics/ng-update/upgrade-rules/attribute-selectors/attributeSelectorsStylesheetRule.js +0 -62
  239. package/schematics/ng-update/upgrade-rules/attribute-selectors/attributeSelectorsStylesheetRule.js.map +0 -1
  240. package/schematics/ng-update/upgrade-rules/attribute-selectors/attributeSelectorsTemplateRule.d.ts +0 -30
  241. package/schematics/ng-update/upgrade-rules/attribute-selectors/attributeSelectorsTemplateRule.js +0 -59
  242. package/schematics/ng-update/upgrade-rules/attribute-selectors/attributeSelectorsTemplateRule.js.map +0 -1
  243. package/schematics/ng-update/upgrade-rules/class-inheritance/classInheritanceCheckRule.d.ts +0 -26
  244. package/schematics/ng-update/upgrade-rules/class-inheritance/classInheritanceCheckRule.js.map +0 -1
  245. package/schematics/ng-update/upgrade-rules/class-names/classNamesIdentifierRule.js.map +0 -1
  246. package/schematics/ng-update/upgrade-rules/css-selectors/cssSelectorsStringLiteralRule.d.ts +0 -24
  247. package/schematics/ng-update/upgrade-rules/css-selectors/cssSelectorsStringLiteralRule.js +0 -53
  248. package/schematics/ng-update/upgrade-rules/css-selectors/cssSelectorsStringLiteralRule.js.map +0 -1
  249. package/schematics/ng-update/upgrade-rules/css-selectors/cssSelectorsStylesheetRule.d.ts +0 -31
  250. package/schematics/ng-update/upgrade-rules/css-selectors/cssSelectorsStylesheetRule.js +0 -63
  251. package/schematics/ng-update/upgrade-rules/css-selectors/cssSelectorsStylesheetRule.js.map +0 -1
  252. package/schematics/ng-update/upgrade-rules/css-selectors/cssSelectorsTemplateRule.d.ts +0 -30
  253. package/schematics/ng-update/upgrade-rules/css-selectors/cssSelectorsTemplateRule.js +0 -62
  254. package/schematics/ng-update/upgrade-rules/css-selectors/cssSelectorsTemplateRule.js.map +0 -1
  255. package/schematics/ng-update/upgrade-rules/element-selectors/elementSelectorsStringLiteralRule.d.ts +0 -24
  256. package/schematics/ng-update/upgrade-rules/element-selectors/elementSelectorsStringLiteralRule.js +0 -50
  257. package/schematics/ng-update/upgrade-rules/element-selectors/elementSelectorsStringLiteralRule.js.map +0 -1
  258. package/schematics/ng-update/upgrade-rules/element-selectors/elementSelectorsStylesheetRule.d.ts +0 -31
  259. package/schematics/ng-update/upgrade-rules/element-selectors/elementSelectorsStylesheetRule.js +0 -60
  260. package/schematics/ng-update/upgrade-rules/element-selectors/elementSelectorsStylesheetRule.js.map +0 -1
  261. package/schematics/ng-update/upgrade-rules/element-selectors/elementSelectorsTemplateRule.d.ts +0 -30
  262. package/schematics/ng-update/upgrade-rules/element-selectors/elementSelectorsTemplateRule.js +0 -59
  263. package/schematics/ng-update/upgrade-rules/element-selectors/elementSelectorsTemplateRule.js.map +0 -1
  264. package/schematics/ng-update/upgrade-rules/input-names/inputNamesStylesheetRule.d.ts +0 -36
  265. package/schematics/ng-update/upgrade-rules/input-names/inputNamesStylesheetRule.js +0 -67
  266. package/schematics/ng-update/upgrade-rules/input-names/inputNamesStylesheetRule.js.map +0 -1
  267. package/schematics/ng-update/upgrade-rules/input-names/inputNamesTemplateRule.d.ts +0 -30
  268. package/schematics/ng-update/upgrade-rules/input-names/inputNamesTemplateRule.js +0 -67
  269. package/schematics/ng-update/upgrade-rules/input-names/inputNamesTemplateRule.js.map +0 -1
  270. package/schematics/ng-update/upgrade-rules/misc-checks/checkTemplateMiscRule.d.ts +0 -23
  271. package/schematics/ng-update/upgrade-rules/misc-checks/checkTemplateMiscRule.js +0 -49
  272. package/schematics/ng-update/upgrade-rules/misc-checks/checkTemplateMiscRule.js.map +0 -1
  273. package/schematics/ng-update/upgrade-rules/output-names/outputNamesTemplateRule.d.ts +0 -30
  274. package/schematics/ng-update/upgrade-rules/output-names/outputNamesTemplateRule.js +0 -67
  275. package/schematics/ng-update/upgrade-rules/output-names/outputNamesTemplateRule.js.map +0 -1
  276. package/schematics/ng-update/upgrade-rules/project-tsconfig-paths.js.map +0 -1
  277. package/schematics/ng-update/upgrade-rules/property-names/propertyNamesAccessRule.d.ts +0 -22
  278. package/schematics/ng-update/upgrade-rules/property-names/propertyNamesAccessRule.js +0 -46
  279. package/schematics/ng-update/upgrade-rules/property-names/propertyNamesAccessRule.js.map +0 -1
  280. package/schematics/ng-update/upgrade-rules/signature-check/constructorSignatureCheckRule.d.ts +0 -16
  281. package/schematics/ng-update/upgrade-rules/signature-check/constructorSignatureCheckRule.js +0 -132
  282. package/schematics/ng-update/upgrade-rules/signature-check/constructorSignatureCheckRule.js.map +0 -1
  283. package/schematics/ng-update/upgrade-rules/signature-check/methodCallsCheckRule.js +0 -58
  284. package/schematics/ng-update/upgrade-rules/signature-check/methodCallsCheckRule.js.map +0 -1
  285. package/schematics/ng-update/upgrade-rules/tslint-config.d.ts +0 -32
  286. package/schematics/ng-update/upgrade-rules/tslint-config.js +0 -87
  287. package/schematics/ng-update/upgrade-rules/tslint-config.js.map +0 -1
  288. package/typings/schematics/ng-update/tslint/component-file.d.ts +0 -14
  289. package/typings/schematics/ng-update/tslint/component-walker.d.ts +0 -47
  290. package/typings/schematics/ng-update/tslint/external-failure-walker.d.ts +0 -25
  291. package/typings/schematics/ng-update/upgrade-rules/attribute-selectors/attributeSelectorsStringLiteralRule.d.ts +0 -16
  292. package/typings/schematics/ng-update/upgrade-rules/attribute-selectors/attributeSelectorsStylesheetRule.d.ts +0 -31
  293. package/typings/schematics/ng-update/upgrade-rules/attribute-selectors/attributeSelectorsTemplateRule.d.ts +0 -30
  294. package/typings/schematics/ng-update/upgrade-rules/class-inheritance/classInheritanceCheckRule.d.ts +0 -26
  295. package/typings/schematics/ng-update/upgrade-rules/css-selectors/cssSelectorsStringLiteralRule.d.ts +0 -24
  296. package/typings/schematics/ng-update/upgrade-rules/css-selectors/cssSelectorsStylesheetRule.d.ts +0 -31
  297. package/typings/schematics/ng-update/upgrade-rules/css-selectors/cssSelectorsTemplateRule.d.ts +0 -30
  298. package/typings/schematics/ng-update/upgrade-rules/element-selectors/elementSelectorsStringLiteralRule.d.ts +0 -24
  299. package/typings/schematics/ng-update/upgrade-rules/element-selectors/elementSelectorsStylesheetRule.d.ts +0 -31
  300. package/typings/schematics/ng-update/upgrade-rules/element-selectors/elementSelectorsTemplateRule.d.ts +0 -30
  301. package/typings/schematics/ng-update/upgrade-rules/input-names/inputNamesStylesheetRule.d.ts +0 -36
  302. package/typings/schematics/ng-update/upgrade-rules/input-names/inputNamesTemplateRule.d.ts +0 -30
  303. package/typings/schematics/ng-update/upgrade-rules/misc-checks/checkTemplateMiscRule.d.ts +0 -23
  304. package/typings/schematics/ng-update/upgrade-rules/output-names/outputNamesTemplateRule.d.ts +0 -30
  305. package/typings/schematics/ng-update/upgrade-rules/property-names/propertyNamesAccessRule.d.ts +0 -22
  306. package/typings/schematics/ng-update/upgrade-rules/signature-check/constructorSignatureCheckRule.d.ts +0 -16
  307. package/typings/schematics/ng-update/upgrade-rules/tslint-config.d.ts +0 -32
@@ -0,0 +1,41 @@
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.io/license
7
+ */
8
+ import * as ts from 'typescript';
9
+ import { LineAndCharacter } from './utils/line-mappings';
10
+ export interface ResolvedResource {
11
+ /** Class declaration that contains this resource. */
12
+ container: ts.ClassDeclaration | null;
13
+ /** File content of the given template. */
14
+ content: string;
15
+ /** Start offset of the resource content (e.g. in the inline source file) */
16
+ start: number;
17
+ /** Whether the given resource is inline or not. */
18
+ inline: boolean;
19
+ /** Path to the file that contains this resource. */
20
+ filePath: string;
21
+ /**
22
+ * Gets the character and line of a given position index in the resource.
23
+ * If the resource is declared inline within a TypeScript source file, the line and
24
+ * character are based on the full source file content.
25
+ */
26
+ getCharacterAndLineOfPosition: (pos: number) => LineAndCharacter;
27
+ }
28
+ /**
29
+ * Collector that can be used to find Angular templates and stylesheets referenced within
30
+ * given TypeScript source files (inline or external referenced files)
31
+ */
32
+ export declare class ComponentResourceCollector {
33
+ typeChecker: ts.TypeChecker;
34
+ resolvedTemplates: ResolvedResource[];
35
+ resolvedStylesheets: ResolvedResource[];
36
+ constructor(typeChecker: ts.TypeChecker);
37
+ visitNode(node: ts.Node): void;
38
+ private _visitClassDeclaration;
39
+ /** Resolves an external stylesheet by reading its content and computing line mappings. */
40
+ resolveExternalStylesheet(filePath: string, container: ts.ClassDeclaration | null): ResolvedResource;
41
+ }
@@ -0,0 +1,141 @@
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.io/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const fs_1 = require("fs");
11
+ const path_1 = require("path");
12
+ const ts = require("typescript");
13
+ const decorators_1 = require("./utils/decorators");
14
+ const functions_1 = require("./utils/functions");
15
+ const line_mappings_1 = require("./utils/line-mappings");
16
+ const property_name_1 = require("./utils/property-name");
17
+ /**
18
+ * Collector that can be used to find Angular templates and stylesheets referenced within
19
+ * given TypeScript source files (inline or external referenced files)
20
+ */
21
+ class ComponentResourceCollector {
22
+ constructor(typeChecker) {
23
+ this.typeChecker = typeChecker;
24
+ this.resolvedTemplates = [];
25
+ this.resolvedStylesheets = [];
26
+ }
27
+ visitNode(node) {
28
+ if (node.kind === ts.SyntaxKind.ClassDeclaration) {
29
+ this._visitClassDeclaration(node);
30
+ }
31
+ }
32
+ _visitClassDeclaration(node) {
33
+ if (!node.decorators || !node.decorators.length) {
34
+ return;
35
+ }
36
+ const ngDecorators = decorators_1.getAngularDecorators(this.typeChecker, node.decorators);
37
+ const componentDecorator = ngDecorators.find(dec => dec.name === 'Component');
38
+ // In case no "@Component" decorator could be found on the current class, skip.
39
+ if (!componentDecorator) {
40
+ return;
41
+ }
42
+ const decoratorCall = componentDecorator.node.expression;
43
+ // In case the component decorator call is not valid, skip this class declaration.
44
+ if (decoratorCall.arguments.length !== 1) {
45
+ return;
46
+ }
47
+ const componentMetadata = functions_1.unwrapExpression(decoratorCall.arguments[0]);
48
+ // Ensure that the component metadata is an object literal expression.
49
+ if (!ts.isObjectLiteralExpression(componentMetadata)) {
50
+ return;
51
+ }
52
+ const sourceFile = node.getSourceFile();
53
+ const sourceFileName = sourceFile.fileName;
54
+ // Walk through all component metadata properties and determine the referenced
55
+ // HTML templates (either external or inline)
56
+ componentMetadata.properties.forEach(property => {
57
+ if (!ts.isPropertyAssignment(property)) {
58
+ return;
59
+ }
60
+ const propertyName = property_name_1.getPropertyNameText(property.name);
61
+ const filePath = path_1.resolve(sourceFileName);
62
+ if (propertyName === 'styles' && ts.isArrayLiteralExpression(property.initializer)) {
63
+ property.initializer.elements.forEach(el => {
64
+ if (ts.isStringLiteralLike(el)) {
65
+ // Need to add an offset of one to the start because the template quotes are
66
+ // not part of the template content.
67
+ const templateStartIdx = el.getStart() + 1;
68
+ this.resolvedStylesheets.push({
69
+ filePath: filePath,
70
+ container: node,
71
+ content: el.text,
72
+ inline: true,
73
+ start: templateStartIdx,
74
+ getCharacterAndLineOfPosition: pos => ts.getLineAndCharacterOfPosition(sourceFile, pos + templateStartIdx),
75
+ });
76
+ }
77
+ });
78
+ }
79
+ // In case there is an inline template specified, ensure that the value is statically
80
+ // analyzable by checking if the initializer is a string literal-like node.
81
+ if (propertyName === 'template' && ts.isStringLiteralLike(property.initializer)) {
82
+ // Need to add an offset of one to the start because the template quotes are
83
+ // not part of the template content.
84
+ const templateStartIdx = property.initializer.getStart() + 1;
85
+ this.resolvedTemplates.push({
86
+ filePath: filePath,
87
+ container: node,
88
+ content: property.initializer.text,
89
+ inline: true,
90
+ start: templateStartIdx,
91
+ getCharacterAndLineOfPosition: pos => ts.getLineAndCharacterOfPosition(sourceFile, pos + templateStartIdx)
92
+ });
93
+ }
94
+ if (propertyName === 'styleUrls' && ts.isArrayLiteralExpression(property.initializer)) {
95
+ property.initializer.elements.forEach(el => {
96
+ if (ts.isStringLiteralLike(el)) {
97
+ const stylesheetPath = path_1.resolve(path_1.dirname(sourceFileName), el.text);
98
+ // In case the stylesheet does not exist in the file system, skip it gracefully.
99
+ if (!fs_1.existsSync(stylesheetPath)) {
100
+ return;
101
+ }
102
+ this.resolvedStylesheets.push(this.resolveExternalStylesheet(stylesheetPath, node));
103
+ }
104
+ });
105
+ }
106
+ if (propertyName === 'templateUrl' && ts.isStringLiteralLike(property.initializer)) {
107
+ const templatePath = path_1.resolve(path_1.dirname(sourceFileName), property.initializer.text);
108
+ // In case the template does not exist in the file system, skip this
109
+ // external template.
110
+ if (!fs_1.existsSync(templatePath)) {
111
+ return;
112
+ }
113
+ const fileContent = fs_1.readFileSync(templatePath, 'utf8');
114
+ const lineStartsMap = line_mappings_1.computeLineStartsMap(fileContent);
115
+ this.resolvedTemplates.push({
116
+ filePath: templatePath,
117
+ container: node,
118
+ content: fileContent,
119
+ inline: false,
120
+ start: 0,
121
+ getCharacterAndLineOfPosition: pos => line_mappings_1.getLineAndCharacterFromPosition(lineStartsMap, pos),
122
+ });
123
+ }
124
+ });
125
+ }
126
+ /** Resolves an external stylesheet by reading its content and computing line mappings. */
127
+ resolveExternalStylesheet(filePath, container) {
128
+ const fileContent = fs_1.readFileSync(filePath, 'utf8');
129
+ const lineStartsMap = line_mappings_1.computeLineStartsMap(fileContent);
130
+ return {
131
+ filePath: filePath,
132
+ container: container,
133
+ content: fileContent,
134
+ inline: false,
135
+ start: 0,
136
+ getCharacterAndLineOfPosition: pos => line_mappings_1.getLineAndCharacterFromPosition(lineStartsMap, pos),
137
+ };
138
+ }
139
+ }
140
+ exports.ComponentResourceCollector = ComponentResourceCollector;
141
+ //# sourceMappingURL=component-resource-collector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-resource-collector.js","sourceRoot":"","sources":["../../../../../src/cdk/schematics/update-tool/component-resource-collector.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,2BAA4C;AAC5C,+BAAsC;AACtC,iCAAiC;AACjC,mDAAwD;AACxD,iDAAmD;AACnD,yDAI+B;AAC/B,yDAA0D;AAqB1D;;;GAGG;AACH,MAAa,0BAA0B;IAIrC,YAAmB,WAA2B;QAA3B,gBAAW,GAAX,WAAW,CAAgB;QAH9C,sBAAiB,GAAuB,EAAE,CAAC;QAC3C,wBAAmB,GAAuB,EAAE,CAAC;IAEI,CAAC;IAElD,SAAS,CAAC,IAAa;QACrB,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,gBAAgB,EAAE;YAChD,IAAI,CAAC,sBAAsB,CAAC,IAA2B,CAAC,CAAC;SAC1D;IACH,CAAC;IAE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,CAAC,CAAC;IACL,CAAC;IAED,0FAA0F;IAC1F,yBAAyB,CAAC,QAAgB,EAAE,SAAmC;QAE7E,MAAM,WAAW,GAAG,iBAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACnD,MAAM,aAAa,GAAG,oCAAoB,CAAC,WAAW,CAAC,CAAC;QAExD,OAAO;YACL,QAAQ,EAAE,QAAQ;YAClB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,WAAW;YACpB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,CAAC;YACR,6BAA6B,EAAE,GAAG,CAAC,EAAE,CAAC,+CAA+B,CAAC,aAAa,EAAE,GAAG,CAAC;SAC1F,CAAC;IACJ,CAAC;CACF;AA9ID,gEA8IC"}
@@ -0,0 +1,13 @@
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.io/license
7
+ */
8
+ import { logging } from '@angular-devkit/core';
9
+ import { Tree } from '@angular-devkit/schematics';
10
+ import { MigrationRule } from './migration-rule';
11
+ import { TargetVersion } from './target-version';
12
+ export declare type Constructor<T> = new (...args: any[]) => T;
13
+ export declare function runMigrationRules<T>(tree: Tree, logger: logging.LoggerApi, tsconfigPath: string, targetVersion: TargetVersion, ruleTypes: Constructor<MigrationRule<T>>[], upgradeData: T, analyzedFiles: Set<string>): boolean;
@@ -0,0 +1,117 @@
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.io/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const core_1 = require("@angular-devkit/core");
11
+ const glob_1 = require("glob");
12
+ const path_1 = require("path");
13
+ const ts = require("typescript");
14
+ const component_resource_collector_1 = require("./component-resource-collector");
15
+ const parse_tsconfig_1 = require("./utils/parse-tsconfig");
16
+ function runMigrationRules(tree, logger, tsconfigPath, targetVersion, ruleTypes, upgradeData, analyzedFiles) {
17
+ // The CLI uses the working directory as the base directory for the
18
+ // virtual file system tree.
19
+ const basePath = process.cwd();
20
+ const parsed = parse_tsconfig_1.parseTsconfigFile(tsconfigPath, path_1.dirname(tsconfigPath));
21
+ const host = ts.createCompilerHost(parsed.options, true);
22
+ // We need to overwrite the host "readFile" method, as we want the TypeScript
23
+ // program to be based on the file contents in the virtual file tree.
24
+ host.readFile = fileName => {
25
+ const buffer = tree.read(getProjectRelativePath(fileName));
26
+ // Strip BOM as otherwise TSC methods (e.g. "getWidth") will return an offset which
27
+ // which breaks the CLI UpdateRecorder. https://github.com/angular/angular/pull/30719
28
+ return buffer ? buffer.toString().replace(/^\uFEFF/, '') : undefined;
29
+ };
30
+ const program = ts.createProgram(parsed.fileNames, parsed.options, host);
31
+ const typeChecker = program.getTypeChecker();
32
+ const rules = [];
33
+ // Create instances of all specified migration rules.
34
+ for (const ruleCtor of ruleTypes) {
35
+ const rule = new ruleCtor(program, typeChecker, targetVersion, upgradeData);
36
+ rule.getUpdateRecorder = getUpdateRecorder;
37
+ rule.init();
38
+ if (rule.ruleEnabled) {
39
+ rules.push(rule);
40
+ }
41
+ }
42
+ const sourceFiles = program.getSourceFiles().filter(f => !f.isDeclarationFile && !program.isSourceFileFromExternalLibrary(f));
43
+ const resourceCollector = new component_resource_collector_1.ComponentResourceCollector(typeChecker);
44
+ const updateRecorderCache = new Map();
45
+ sourceFiles.forEach(sourceFile => {
46
+ const relativePath = getProjectRelativePath(sourceFile.fileName);
47
+ // Do not visit source files which have been checked as part of a
48
+ // previously migrated TypeScript project.
49
+ if (!analyzedFiles.has(relativePath)) {
50
+ _visitTypeScriptNode(sourceFile);
51
+ analyzedFiles.add(relativePath);
52
+ }
53
+ });
54
+ resourceCollector.resolvedTemplates.forEach(template => {
55
+ const relativePath = getProjectRelativePath(template.filePath);
56
+ // Do not visit the template if it has been checked before. Inline
57
+ // templates cannot be referenced multiple times.
58
+ if (template.inline || !analyzedFiles.has(relativePath)) {
59
+ rules.forEach(r => r.visitTemplate(template));
60
+ analyzedFiles.add(relativePath);
61
+ }
62
+ });
63
+ resourceCollector.resolvedStylesheets.forEach(stylesheet => {
64
+ const relativePath = getProjectRelativePath(stylesheet.filePath);
65
+ // Do not visit the stylesheet if it has been checked before. Inline
66
+ // stylesheets cannot be referenced multiple times.
67
+ if (stylesheet.inline || !analyzedFiles.has(relativePath)) {
68
+ rules.forEach(r => r.visitStylesheet(stylesheet));
69
+ analyzedFiles.add(relativePath);
70
+ }
71
+ });
72
+ // In some applications, developers will have global stylesheets which are not specified in any
73
+ // Angular component. Therefore we glob up all CSS and SCSS files outside of node_modules and
74
+ // dist. The files will be read by the individual stylesheet rules and checked.
75
+ // TODO(devversion): double-check if we can solve this in a more elegant way.
76
+ glob_1.sync('!(node_modules|dist)/**/*.+(css|scss)', { absolute: true, cwd: basePath })
77
+ .filter(filePath => !resourceCollector.resolvedStylesheets.some(s => s.filePath === filePath))
78
+ .forEach(filePath => {
79
+ const stylesheet = resourceCollector.resolveExternalStylesheet(filePath, null);
80
+ rules.forEach(r => r.visitStylesheet(stylesheet));
81
+ });
82
+ // Commit all recorded updates in the update recorder. We need to perform the
83
+ // replacements per source file in order to ensure that offsets in the TypeScript
84
+ // program are not incorrectly shifted.
85
+ updateRecorderCache.forEach(recorder => tree.commitUpdate(recorder));
86
+ // Collect all failures reported by individual migration rules.
87
+ const ruleFailures = rules.reduce((res, rule) => res.concat(rule.failures), []);
88
+ // In case there are rule failures, print these to the CLI logger as warnings.
89
+ if (ruleFailures.length) {
90
+ ruleFailures.forEach(({ filePath, message, position }) => {
91
+ const normalizedFilePath = core_1.normalize(path_1.relative(basePath, filePath));
92
+ const lineAndCharacter = `${position.line + 1}:${position.character + 1}`;
93
+ logger.warn(`${normalizedFilePath}@${lineAndCharacter} - ${message}`);
94
+ });
95
+ }
96
+ return !!ruleFailures.length;
97
+ function getUpdateRecorder(filePath) {
98
+ const treeFilePath = path_1.relative(basePath, filePath);
99
+ if (updateRecorderCache.has(treeFilePath)) {
100
+ return updateRecorderCache.get(treeFilePath);
101
+ }
102
+ const treeRecorder = tree.beginUpdate(treeFilePath);
103
+ updateRecorderCache.set(treeFilePath, treeRecorder);
104
+ return treeRecorder;
105
+ }
106
+ function _visitTypeScriptNode(node) {
107
+ rules.forEach(r => r.visitNode(node));
108
+ ts.forEachChild(node, _visitTypeScriptNode);
109
+ resourceCollector.visitNode(node);
110
+ }
111
+ /** Gets the specified path relative to the project root. */
112
+ function getProjectRelativePath(filePath) {
113
+ return path_1.relative(basePath, filePath);
114
+ }
115
+ }
116
+ exports.runMigrationRules = runMigrationRules;
117
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cdk/schematics/update-tool/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,+CAAwD;AAExD,+BAAsC;AACtC,+BAAuC;AACvC,iCAAiC;AAEjC,iFAA0E;AAG1E,2DAAyD;AAIzD,SAAgB,iBAAiB,CAC7B,IAAU,EAAE,MAAyB,EAAE,YAAoB,EAAE,aAA4B,EACzF,SAA0C,EAAE,WAAc,EAC1D,aAA0B;IAC5B,mEAAmE;IACnE,4BAA4B;IAC5B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,kCAAiB,CAAC,YAAY,EAAE,cAAO,CAAC,YAAY,CAAC,CAAC,CAAC;IACtE,MAAM,IAAI,GAAG,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAEzD,6EAA6E;IAC7E,qEAAqE;IACrE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE;QACzB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC3D,mF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AAE,QAAQ,CAAC,CAAC;QAClD,IAAI,mBAAmB,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YACzC,OAAO,mBAAmB,CAAC,GAAG,CAAC,YAAY,CAAE,CAAC;SAC/C;QACD,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QACpD,mBAAmB,CAAC,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QACpD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,SAAS,oBAAoB,CAAC,IAAa;QACzC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QACtC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;QAC5C,iBAAiB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,4DAA4D;IAC5D,SAAS,sBAAsB,CAAC,QAAgB;QAC9C,OAAO,eAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;AACH,CAAC;AAvHD,8CAuHC"}
@@ -0,0 +1,45 @@
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.io/license
7
+ */
8
+ import { UpdateRecorder } from '@angular-devkit/schematics';
9
+ import * as ts from 'typescript';
10
+ import { ResolvedResource } from './component-resource-collector';
11
+ import { TargetVersion } from './target-version';
12
+ import { LineAndCharacter } from './utils/line-mappings';
13
+ export interface MigrationFailure {
14
+ filePath: string;
15
+ message: string;
16
+ position: LineAndCharacter;
17
+ }
18
+ export declare class MigrationRule<T> {
19
+ program: ts.Program;
20
+ typeChecker: ts.TypeChecker;
21
+ targetVersion: TargetVersion;
22
+ upgradeData: T;
23
+ /** List of migration failures that need to be reported. */
24
+ failures: MigrationFailure[];
25
+ /** Whether the migration rule is enabled or not. */
26
+ ruleEnabled: boolean;
27
+ constructor(program: ts.Program, typeChecker: ts.TypeChecker, targetVersion: TargetVersion, upgradeData: T);
28
+ /** Method can be used to perform global analysis of the program. */
29
+ init(): void;
30
+ /**
31
+ * Method that will be called for each node in a given source file. Unlike tslint, this
32
+ * function will only retrieve TypeScript nodes that need to be casted manually. This
33
+ * allows us to only walk the program source files once per program and not per
34
+ * migration rule (significant performance boost).
35
+ */
36
+ visitNode(node: ts.Node): void;
37
+ /** Method that will be called for each Angular template in the program. */
38
+ visitTemplate(template: ResolvedResource): void;
39
+ /** Method that will be called for each stylesheet in the program. */
40
+ visitStylesheet(stylesheet: ResolvedResource): void;
41
+ /** Gets the update recorder for a given source file or resolved template. */
42
+ getUpdateRecorder(filePath: string): UpdateRecorder;
43
+ /** Creates a failure with a specified message at the given node location. */
44
+ createFailureAtNode(node: ts.Node, message: string): void;
45
+ }
@@ -0,0 +1,50 @@
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.io/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const ts = require("typescript");
11
+ class MigrationRule {
12
+ constructor(program, typeChecker, targetVersion, upgradeData) {
13
+ this.program = program;
14
+ this.typeChecker = typeChecker;
15
+ this.targetVersion = targetVersion;
16
+ this.upgradeData = upgradeData;
17
+ /** List of migration failures that need to be reported. */
18
+ this.failures = [];
19
+ /** Whether the migration rule is enabled or not. */
20
+ this.ruleEnabled = true;
21
+ }
22
+ /** Method can be used to perform global analysis of the program. */
23
+ init() { }
24
+ /**
25
+ * Method that will be called for each node in a given source file. Unlike tslint, this
26
+ * function will only retrieve TypeScript nodes that need to be casted manually. This
27
+ * allows us to only walk the program source files once per program and not per
28
+ * migration rule (significant performance boost).
29
+ */
30
+ visitNode(node) { }
31
+ /** Method that will be called for each Angular template in the program. */
32
+ visitTemplate(template) { }
33
+ /** Method that will be called for each stylesheet in the program. */
34
+ visitStylesheet(stylesheet) { }
35
+ /** Gets the update recorder for a given source file or resolved template. */
36
+ getUpdateRecorder(filePath) {
37
+ throw new Error('MigrationRule#getUpdateRecorder is not implemented.');
38
+ }
39
+ /** Creates a failure with a specified message at the given node location. */
40
+ createFailureAtNode(node, message) {
41
+ const sourceFile = node.getSourceFile();
42
+ this.failures.push({
43
+ filePath: sourceFile.fileName,
44
+ position: ts.getLineAndCharacterOfPosition(sourceFile, node.getStart()),
45
+ message: message,
46
+ });
47
+ }
48
+ }
49
+ exports.MigrationRule = MigrationRule;
50
+ //# sourceMappingURL=migration-rule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-rule.js","sourceRoot":"","sources":["../../../../../src/cdk/schematics/update-tool/migration-rule.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAGH,iCAAiC;AAWjC,MAAa,aAAa;IAOxB,YACW,OAAmB,EAAS,WAA2B,EACvD,aAA4B,EAAS,WAAc;QADnD,YAAO,GAAP,OAAO,CAAY;QAAS,gBAAW,GAAX,WAAW,CAAgB;QACvD,kBAAa,GAAb,aAAa,CAAe;QAAS,gBAAW,GAAX,WAAW,CAAG;QAR9D,2DAA2D;QAC3D,aAAQ,GAAuB,EAAE,CAAC;QAElC,oDAAoD;QACpD,gBAAW,GAAG,IAAI,CAAC;IAI8C,CAAC;IAElE,oEAAoE;IACpE,IAAI,KAAU,CAAC;IAEf;;;;;OAKG;IACH,SAAS,CAAC,IAAa,IAAS,CAAC;IAEjC,2EAA2E;IAC3E,aAAa,CAAC,QAA0B,IAAS,CAAC;IAElD,qEAAqE;IACrE,eAAe,CAAC,UAA4B,IAAS,CAAC;IAEtD,6EAA6E;IAC7E,iBAAiB,CAAC,QAAgB;QAChC,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IAED,6EAA6E;IAC7E,mBAAmB,CAAC,IAAa,EAAE,OAAe;QAChD,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YACjB,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,QAAQ,EAAE,EAAE,CAAC,6BAA6B,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACvE,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;IACL,CAAC;CACF;AA1CD,sCA0CC"}
@@ -0,0 +1,12 @@
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.io/license
7
+ */
8
+ export * from './index';
9
+ export * from './target-version';
10
+ export * from './version-changes';
11
+ export * from './migration-rule';
12
+ export * from './component-resource-collector';
@@ -0,0 +1,18 @@
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.io/license
8
+ */
9
+ function __export(m) {
10
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
11
+ }
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __export(require("./index"));
14
+ __export(require("./target-version"));
15
+ __export(require("./version-changes"));
16
+ __export(require("./migration-rule"));
17
+ __export(require("./component-resource-collector"));
18
+ //# sourceMappingURL=public-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../../../../../src/cdk/schematics/update-tool/public-api.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAEH,6BAAwB;AACxB,sCAAiC;AACjC,uCAAkC;AAClC,sCAAiC;AACjC,oDAA+C"}
@@ -7,9 +7,9 @@
7
7
  */
8
8
  /** Possible versions that can be automatically migrated by `ng update`. */
9
9
  export declare enum TargetVersion {
10
- V6 = 0,
11
- V7 = 1,
12
- V8 = 2
10
+ V6 = "version 6",
11
+ V7 = "version 7",
12
+ V8 = "version 8"
13
13
  }
14
14
  /**
15
15
  * Returns all versions that are supported by "ng update". The versions are determined
@@ -10,9 +10,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  /** Possible versions that can be automatically migrated by `ng update`. */
11
11
  var TargetVersion;
12
12
  (function (TargetVersion) {
13
- TargetVersion[TargetVersion["V6"] = 0] = "V6";
14
- TargetVersion[TargetVersion["V7"] = 1] = "V7";
15
- TargetVersion[TargetVersion["V8"] = 2] = "V8";
13
+ TargetVersion["V6"] = "version 6";
14
+ TargetVersion["V7"] = "version 7";
15
+ TargetVersion["V8"] = "version 8";
16
16
  })(TargetVersion = exports.TargetVersion || (exports.TargetVersion = {}));
17
17
  /**
18
18
  * Returns all versions that are supported by "ng update". The versions are determined
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target-version.js","sourceRoot":"","sources":["../../../../../src/cdk/schematics/update-tool/target-version.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,2EAA2E;AAC3E,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,iCAAgB,CAAA;IAChB,iCAAgB,CAAA;IAChB,iCAAgB,CAAA;AAClB,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB;AAED;;;GAGG;AACH,SAAgB,kBAAkB;IAChC,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;SAC5B,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,aAAa,CAAC,SAAS,CAAC,KAAK,QAAQ,CAAC,CAAC;AACzE,CAAC;AAHD,gDAGC"}
@@ -0,0 +1,23 @@
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.io/license
7
+ */
8
+ import * as ts from 'typescript';
9
+ import { Import } from './imports';
10
+ export declare type CallExpressionDecorator = ts.Decorator & {
11
+ expression: ts.CallExpression;
12
+ };
13
+ export interface NgDecorator {
14
+ name: string;
15
+ node: CallExpressionDecorator;
16
+ importNode: ts.ImportDeclaration;
17
+ }
18
+ /**
19
+ * Gets all decorators which are imported from an Angular package
20
+ * (e.g. "@angular/core") from a list of decorators.
21
+ */
22
+ export declare function getAngularDecorators(typeChecker: ts.TypeChecker, decorators: ReadonlyArray<ts.Decorator>): NgDecorator[];
23
+ export declare function getCallDecoratorImport(typeChecker: ts.TypeChecker, decorator: ts.Decorator): Import | null;
@@ -0,0 +1,37 @@
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.io/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const ts = require("typescript");
11
+ const imports_1 = require("./imports");
12
+ /**
13
+ * Gets all decorators which are imported from an Angular package
14
+ * (e.g. "@angular/core") from a list of decorators.
15
+ */
16
+ function getAngularDecorators(typeChecker, decorators) {
17
+ return decorators.map(node => ({ node, importData: getCallDecoratorImport(typeChecker, node) }))
18
+ .filter(({ importData }) => importData && importData.importModule.startsWith('@angular/'))
19
+ .map(({ node, importData }) => ({
20
+ node: node,
21
+ name: importData.name,
22
+ importNode: importData.node
23
+ }));
24
+ }
25
+ exports.getAngularDecorators = getAngularDecorators;
26
+ function getCallDecoratorImport(typeChecker, decorator) {
27
+ // Note that this does not cover the edge case where decorators are called from
28
+ // a namespace import: e.g. "@core.Component()". This is not handled by Ngtsc either.
29
+ if (!ts.isCallExpression(decorator.expression) ||
30
+ !ts.isIdentifier(decorator.expression.expression)) {
31
+ return null;
32
+ }
33
+ const identifier = decorator.expression.expression;
34
+ return imports_1.getImportOfIdentifier(typeChecker, identifier);
35
+ }
36
+ exports.getCallDecoratorImport = getCallDecoratorImport;
37
+ //# sourceMappingURL=decorators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../../../src/cdk/schematics/update-tool/utils/decorators.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,iCAAiC;AAEjC,uCAAwD;AAYxD;;;GAGG;AACH,SAAgB,oBAAoB,CAChC,WAA2B,EAAE,UAAuC;IACtE,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,UAAU,EAAE,sBAAsB,CAAC,WAAW,EAAE,IAAI,CAAC,EAAC,CAAC,CAAC;SACzF,MAAM,CAAC,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,UAAU,IAAI,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;SACvF,GAAG,CAAC,CAAC,EAAC,IAAI,EAAE,UAAU,EAAC,EAAE,EAAE,CAAC,CAAC;QACvB,IAAI,EAAE,IAA+B;QACrC,IAAI,EAAE,UAAW,CAAC,IAAI;QACtB,UAAU,EAAE,UAAW,CAAC,IAAI;KAC7B,CAAC,CAAC,CAAC;AACf,CAAC;AATD,oDASC;AAED,SAAgB,sBAAsB,CAClC,WAA2B,EAAE,SAAuB;IACtD,+EAA+E;IAC/E,qFAAqF;IACrF,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,SAAS,CAAC,UAAU,CAAC;QAC1C,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QACrD,OAAO,IAAI,CAAC;KACb;IAED,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC;IACnD,OAAO,+BAAqB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AACxD,CAAC;AAXD,wDAWC"}
@@ -0,0 +1,14 @@
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.io/license
7
+ */
8
+ import * as ts from 'typescript';
9
+ /**
10
+ * Unwraps a given expression TypeScript node. Expressions can be wrapped within multiple
11
+ * parentheses. e.g. "(((({exp}))))()". The function should return the TypeScript node
12
+ * referring to the inner expression. e.g "exp".
13
+ */
14
+ export declare function unwrapExpression(node: ts.Expression | ts.ParenthesizedExpression): ts.Expression;
@@ -0,0 +1,20 @@
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.io/license
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const ts = require("typescript");
11
+ /**
12
+ * Unwraps a given expression TypeScript node. Expressions can be wrapped within multiple
13
+ * parentheses. e.g. "(((({exp}))))()". The function should return the TypeScript node
14
+ * referring to the inner expression. e.g "exp".
15
+ */
16
+ function unwrapExpression(node) {
17
+ return ts.isParenthesizedExpression(node) ? unwrapExpression(node.expression) : node;
18
+ }
19
+ exports.unwrapExpression = unwrapExpression;
20
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../../../src/cdk/schematics/update-tool/utils/functions.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,iCAAiC;AAEjC;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAA8C;IAC7E,OAAO,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACvF,CAAC;AAFD,4CAEC"}
@@ -0,0 +1,15 @@
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.io/license
7
+ */
8
+ import * as ts from 'typescript';
9
+ export declare type Import = {
10
+ name: string;
11
+ importModule: string;
12
+ node: ts.ImportDeclaration;
13
+ };
14
+ /** Gets import information about the specified identifier by using the type checker. */
15
+ export declare function getImportOfIdentifier(typeChecker: ts.TypeChecker, node: ts.Identifier): Import | null;