@onecx/nx-migration-utils 8.0.0-rc.4 → 8.0.0-rc.7

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 (94) hide show
  1. package/README.md +13 -11
  2. package/package.json +1 -1
  3. package/src/index.js +20 -23
  4. package/src/index.js.map +1 -1
  5. package/src/lib/angular/html-templates.utils.js +23 -31
  6. package/src/lib/angular/html-templates.utils.js.map +1 -1
  7. package/src/lib/angular/index.js +16 -19
  8. package/src/lib/angular/index.js.map +1 -1
  9. package/src/lib/angular/model/matching-module.model.js +0 -2
  10. package/src/lib/angular/model/module.model.js +0 -2
  11. package/src/lib/angular/model/provider.model.js +0 -2
  12. package/src/lib/angular/parameters.utils.js +12 -15
  13. package/src/lib/angular/parameters.utils.js.map +1 -1
  14. package/src/lib/angular/replacement-in-files.utils.js +10 -14
  15. package/src/lib/angular/replacement-in-files.utils.js.map +1 -1
  16. package/src/lib/angular/utils/detection/detect-modules-importing-module.utils.js +9 -12
  17. package/src/lib/angular/utils/detection/detect-modules-importing-module.utils.js.map +1 -1
  18. package/src/lib/angular/utils/detection/detect-variables-with-module.utils.js +3 -6
  19. package/src/lib/angular/utils/detection/detect-variables-with-module.utils.js.map +1 -1
  20. package/src/lib/angular/utils/detection/detect-variables-with-provider.utils.js +3 -6
  21. package/src/lib/angular/utils/detection/detect-variables-with-provider.utils.js.map +1 -1
  22. package/src/lib/angular/utils/modification/add-provider-import-if-does-not-exist.utils.js +5 -8
  23. package/src/lib/angular/utils/modification/add-provider-import-if-does-not-exist.utils.js.map +1 -1
  24. package/src/lib/angular/utils/modification/add-provider-import-in-file.utils.js +9 -12
  25. package/src/lib/angular/utils/modification/add-provider-import-in-file.utils.js.map +1 -1
  26. package/src/lib/angular/utils/modification/add-provider-in-module-if-does-not-exist.utils.js +5 -8
  27. package/src/lib/angular/utils/modification/add-provider-in-module-if-does-not-exist.utils.js.map +1 -1
  28. package/src/lib/angular/utils/modification/add-provider-in-module.utils.js +6 -9
  29. package/src/lib/angular/utils/modification/add-provider-in-module.utils.js.map +1 -1
  30. package/src/lib/angular/utils/patterns.utils.js +4 -10
  31. package/src/lib/angular/utils/patterns.utils.js.map +1 -1
  32. package/src/lib/angular/utils/validation/is-provider-import-in-file.utils.js +7 -10
  33. package/src/lib/angular/utils/validation/is-provider-import-in-file.utils.js.map +1 -1
  34. package/src/lib/angular/utils/validation/is-provider-in-module.utils.js +7 -10
  35. package/src/lib/angular/utils/validation/is-provider-in-module.utils.js.map +1 -1
  36. package/src/lib/common-migrations/common-migrate-onecx-to-v6.utils.js +64 -67
  37. package/src/lib/common-migrations/common-migrate-onecx-to-v6.utils.js.map +1 -1
  38. package/src/lib/migrations/jest.config.js +1 -3
  39. package/src/lib/migrations/jest.config.js.map +1 -1
  40. package/src/lib/migrations/v6/remove-pia-imports.js +16 -19
  41. package/src/lib/migrations/v6/remove-pia-imports.js.map +1 -1
  42. package/src/lib/migrations/v6/replace-pia-imports.js +5 -8
  43. package/src/lib/migrations/v6/replace-pia-imports.js.map +1 -1
  44. package/src/lib/migrations/v6/replace-portal-core-module.js +5 -8
  45. package/src/lib/migrations/v6/replace-portal-core-module.js.map +1 -1
  46. package/src/lib/utils/detect-method-calls-in-files.js +16 -19
  47. package/src/lib/utils/detect-method-calls-in-files.js.map +1 -1
  48. package/src/lib/utils/detect-method-calls-in-files.utils.js +22 -26
  49. package/src/lib/utils/detect-method-calls-in-files.utils.js.map +1 -1
  50. package/src/lib/utils/detection/detect-variables-with-identifier.utils.js +7 -10
  51. package/src/lib/utils/detection/detect-variables-with-identifier.utils.js.map +1 -1
  52. package/src/lib/utils/import-statements.utils.js +39 -55
  53. package/src/lib/utils/import-statements.utils.js.map +1 -1
  54. package/src/lib/utils/modification/add-new-import.utils.js +1 -4
  55. package/src/lib/utils/modification/add-new-import.utils.js.map +1 -1
  56. package/src/lib/utils/modification/add-to-first-import.utils.js +6 -9
  57. package/src/lib/utils/modification/add-to-first-import.utils.js.map +1 -1
  58. package/src/lib/utils/modification/remove-import-specifier.utils.js +8 -11
  59. package/src/lib/utils/modification/remove-import-specifier.utils.js.map +1 -1
  60. package/src/lib/utils/modification/remove-json-references.utils.js +1 -4
  61. package/src/lib/utils/modification/remove-json-references.utils.js.map +1 -1
  62. package/src/lib/utils/modification/replace-tag-in-html.utils.js +5 -8
  63. package/src/lib/utils/modification/replace-tag-in-html.utils.js.map +1 -1
  64. package/src/lib/utils/modification/update-json-files.utils.js +6 -9
  65. package/src/lib/utils/modification/update-json-files.utils.js.map +1 -1
  66. package/src/lib/utils/modification/update-style-sheet.utils.js +4 -7
  67. package/src/lib/utils/modification/update-style-sheet.utils.js.map +1 -1
  68. package/src/lib/utils/modification/update-style-sheets.utils.js +9 -12
  69. package/src/lib/utils/modification/update-style-sheets.utils.js.map +1 -1
  70. package/src/lib/utils/patterns.utils.js +5 -12
  71. package/src/lib/utils/patterns.utils.js.map +1 -1
  72. package/src/lib/utils/print-warnings.js +5 -8
  73. package/src/lib/utils/print-warnings.js.map +1 -1
  74. package/src/lib/utils/print-warnings.utils.js +3 -6
  75. package/src/lib/utils/print-warnings.utils.js.map +1 -1
  76. package/src/lib/utils/typescript-files.utils.js +16 -21
  77. package/src/lib/utils/typescript-files.utils.js.map +1 -1
  78. package/src/lib/utils/update-gitignore.utils.js +2 -6
  79. package/src/lib/utils/update-gitignore.utils.js.map +1 -1
  80. package/src/lib/utils/validation/has-html-tag.utils.js +5 -8
  81. package/src/lib/utils/validation/has-html-tag.utils.js.map +1 -1
  82. package/src/lib/utils/validation/is-file-style-sheet.utils.js +1 -4
  83. package/src/lib/utils/validation/is-file-style-sheet.utils.js.map +1 -1
  84. package/src/lib/utils/validation/is-import-in-content.utils.js +5 -8
  85. package/src/lib/utils/validation/is-import-in-content.utils.js.map +1 -1
  86. package/src/lib/utils/validation/is-import-in-file-content.utils.js +5 -8
  87. package/src/lib/utils/validation/is-import-in-file-content.utils.js.map +1 -1
  88. package/src/lib/utils/validation/is-namespace-import-in-content.utils.js +5 -8
  89. package/src/lib/utils/validation/is-namespace-import-in-content.utils.js.map +1 -1
  90. package/src/test-setup.js +3 -5
  91. package/src/test-setup.js.map +1 -1
  92. package/src/version.d.ts +2 -0
  93. package/src/version.js +3 -0
  94. package/src/version.js.map +1 -0
package/README.md CHANGED
@@ -1,15 +1,17 @@
1
- # nx-migration-utils
1
+ # @onecx/nx-migration-utils
2
2
 
3
- This library contains helpers for creating NX migrations.
3
+ `@onecx/nx-migration-utils` contains helpers for creating NX migrations.
4
+ More information about OneCX libraries can be found in the [OneCX documentation](https://onecx.github.io/docs/documentation/current/onecx-portal-ui-libs/index.html).
4
5
 
5
- Framework agnostic utility functions are located in the `src/lib/utils` directory and can be imported from `@onecx/nx-migration-utils`.
6
+ ## Installation
6
7
 
7
- Framework specific utilities are located in subdirectories of `src/lib` (e.g. `src/lib/angular`) and can be imported from `@onecx/nx-migration-utils/<framework>`.
8
+ ```bash
9
+ npm install @onecx/nx-migration-utils
10
+ ```
8
11
 
9
- ## Building
10
-
11
- Run `nx build nx-migration-utils` to build the library.
12
-
13
- ## Running unit tests
14
-
15
- Run `nx test nx-migration-utils` to execute the unit tests via [Jest](https://jestjs.io).
12
+ ## Additional Commands
13
+ - `npx nx run nx-migration-utils:build` - Builds the library and outputs the result to the `dist` folder.
14
+ - `npx nx run nx-migration-utils:build-migrations` - Builds the migration files for the library.
15
+ - `npx nx run nx-migration-utils:test` - Runs the unit tests for the library.
16
+ - `npx nx run nx-migration-utils:lint` - Lints the library's codebase.
17
+ - `npx nx run nx-migration-utils:release` - Releases a new version of the library to npm, following semantic versioning guidelines.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onecx/nx-migration-utils",
3
- "version": "8.0.0-rc.4",
3
+ "version": "8.0.0-rc.7",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
package/src/index.js CHANGED
@@ -1,25 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
1
  // General purpose and framework-agnostic utilities for NX migrations
5
- tslib_1.__exportStar(require("./lib/common-migrations/common-migrate-onecx-to-v6.utils"), exports);
6
- tslib_1.__exportStar(require("./lib/utils/detect-method-calls-in-files.utils"), exports);
7
- tslib_1.__exportStar(require("./lib/utils/import-statements.utils"), exports);
8
- tslib_1.__exportStar(require("./lib/utils/print-warnings.utils"), exports);
9
- tslib_1.__exportStar(require("./lib/utils/typescript-files.utils"), exports);
10
- tslib_1.__exportStar(require("./lib/utils/update-gitignore.utils"), exports);
11
- tslib_1.__exportStar(require("./lib/utils/detection/detect-variables-with-identifier.utils"), exports);
12
- tslib_1.__exportStar(require("./lib/utils/modification/update-json-files.utils"), exports);
13
- tslib_1.__exportStar(require("./lib/utils/modification/update-style-sheets.utils"), exports);
14
- tslib_1.__exportStar(require("./lib/utils/modification/update-style-sheet.utils"), exports);
15
- tslib_1.__exportStar(require("./lib/utils/modification/remove-json-references.utils"), exports);
16
- tslib_1.__exportStar(require("./lib/utils/modification/add-new-import.utils"), exports);
17
- tslib_1.__exportStar(require("./lib/utils/modification/add-to-first-import.utils"), exports);
18
- tslib_1.__exportStar(require("./lib/utils/modification/replace-tag-in-html.utils"), exports);
19
- tslib_1.__exportStar(require("./lib/utils/modification/remove-import-specifier.utils"), exports);
20
- tslib_1.__exportStar(require("./lib/utils/validation/is-file-style-sheet.utils"), exports);
21
- tslib_1.__exportStar(require("./lib/utils/validation/has-html-tag.utils"), exports);
22
- tslib_1.__exportStar(require("./lib/utils/validation/is-import-in-content.utils"), exports);
23
- tslib_1.__exportStar(require("./lib/utils/validation/is-namespace-import-in-content.utils"), exports);
24
- tslib_1.__exportStar(require("./lib/utils/validation/is-import-in-file-content.utils"), exports);
2
+ export * from './lib/common-migrations/common-migrate-onecx-to-v6.utils';
3
+ export * from './lib/utils/detect-method-calls-in-files.utils';
4
+ export * from './lib/utils/import-statements.utils';
5
+ export * from './lib/utils/print-warnings.utils';
6
+ export * from './lib/utils/typescript-files.utils';
7
+ export * from './lib/utils/update-gitignore.utils';
8
+ export * from './lib/utils/detection/detect-variables-with-identifier.utils';
9
+ export * from './lib/utils/modification/update-json-files.utils';
10
+ export * from './lib/utils/modification/update-style-sheets.utils';
11
+ export * from './lib/utils/modification/update-style-sheet.utils';
12
+ export * from './lib/utils/modification/remove-json-references.utils';
13
+ export * from './lib/utils/modification/add-new-import.utils';
14
+ export * from './lib/utils/modification/add-to-first-import.utils';
15
+ export * from './lib/utils/modification/replace-tag-in-html.utils';
16
+ export * from './lib/utils/modification/remove-import-specifier.utils';
17
+ export * from './lib/utils/validation/is-file-style-sheet.utils';
18
+ export * from './lib/utils/validation/has-html-tag.utils';
19
+ export * from './lib/utils/validation/is-import-in-content.utils';
20
+ export * from './lib/utils/validation/is-namespace-import-in-content.utils';
21
+ export * from './lib/utils/validation/is-import-in-file-content.utils';
25
22
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/nx-migration-utils/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,mGAAwE;AAExE,yFAA8D;AAC9D,8EAAmD;AACnD,2EAAgD;AAChD,6EAAkD;AAClD,6EAAkD;AAElD,uGAA4E;AAE5E,2FAAgE;AAChE,6FAAkE;AAClE,4FAAiE;AACjE,gGAAqE;AACrE,wFAA6D;AAC7D,6FAAkE;AAClE,6FAAkE;AAClE,iGAAsE;AAGtE,2FAAgE;AAChE,oFAAyD;AACzD,4FAAiE;AACjE,sGAA2E;AAC3E,iGAAsE"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/nx-migration-utils/src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,cAAc,0DAA0D,CAAA;AAExE,cAAc,gDAAgD,CAAA;AAC9D,cAAc,qCAAqC,CAAA;AACnD,cAAc,kCAAkC,CAAA;AAChD,cAAc,oCAAoC,CAAA;AAClD,cAAc,oCAAoC,CAAA;AAElD,cAAc,8DAA8D,CAAA;AAE5E,cAAc,kDAAkD,CAAA;AAChE,cAAc,oDAAoD,CAAA;AAClE,cAAc,mDAAmD,CAAA;AACjE,cAAc,uDAAuD,CAAA;AACrE,cAAc,+CAA+C,CAAA;AAC7D,cAAc,oDAAoD,CAAA;AAClE,cAAc,oDAAoD,CAAA;AAClE,cAAc,wDAAwD,CAAA;AAGtE,cAAc,kDAAkD,CAAA;AAChE,cAAc,2CAA2C,CAAA;AACzD,cAAc,mDAAmD,CAAA;AACjE,cAAc,6DAA6D,CAAA;AAC3E,cAAc,wDAAwD,CAAA"}
@@ -1,17 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceTagInAngularTemplates = replaceTagInAngularTemplates;
4
- exports.replaceTagInInlineAndExternalTemplate = replaceTagInInlineAndExternalTemplate;
5
- exports.replaceTagInInlineTemplates = replaceTagInInlineTemplates;
6
- exports.replaceTagInExternalTemplates = replaceTagInExternalTemplates;
7
- exports.getInlineTemplateNodes = getInlineTemplateNodes;
8
- exports.getExternalTemplatePaths = getExternalTemplatePaths;
9
- const devkit_1 = require("@nx/devkit");
10
- const tsquery_1 = require("@phenomnomnominal/tsquery");
11
- const path_1 = require("path");
12
- const typescript_1 = require("typescript");
13
- const has_html_tag_utils_1 = require("../utils/validation/has-html-tag.utils");
14
- const replace_tag_in_html_utils_1 = require("../utils/modification/replace-tag-in-html.utils");
1
+ import { visitNotIgnoredFiles } from '@nx/devkit';
2
+ import { ast, query, replace } from '@phenomnomnominal/tsquery';
3
+ import { dirname, join } from 'path';
4
+ import { isStringLiteral, ScriptKind } from 'typescript';
5
+ import { hasHtmlTag } from '../utils/validation/has-html-tag.utils';
6
+ import { replaceTagInHtml } from '../utils/modification/replace-tag-in-html.utils';
15
7
  /**
16
8
  * Changes all occurrences of a specific HTML tag name in Angular component templates.
17
9
  * @param tree - The Nx Tree representing the file system.
@@ -19,8 +11,8 @@ const replace_tag_in_html_utils_1 = require("../utils/modification/replace-tag-i
19
11
  * @param oldTagName - The tag name to replace.
20
12
  * @param newTagName - The new tag name to use.
21
13
  */
22
- function replaceTagInAngularTemplates(tree, dirPath, oldTagName, newTagName) {
23
- (0, devkit_1.visitNotIgnoredFiles)(tree, dirPath, (file) => {
14
+ export function replaceTagInAngularTemplates(tree, dirPath, oldTagName, newTagName) {
15
+ visitNotIgnoredFiles(tree, dirPath, (file) => {
24
16
  if (file.endsWith('.ts')) {
25
17
  replaceTagInInlineAndExternalTemplate(tree, file, oldTagName, newTagName);
26
18
  }
@@ -33,12 +25,12 @@ function replaceTagInAngularTemplates(tree, dirPath, oldTagName, newTagName) {
33
25
  * @param oldTagName - The tag name to replace.
34
26
  * @param newTagName - The new tag name to use.
35
27
  */
36
- function replaceTagInInlineAndExternalTemplate(tree, filePath, oldTagName, newTagName) {
28
+ export function replaceTagInInlineAndExternalTemplate(tree, filePath, oldTagName, newTagName) {
37
29
  try {
38
30
  const tsContent = tree.read(filePath, 'utf8');
39
31
  if (!tsContent)
40
32
  return;
41
- const contentAst = (0, tsquery_1.ast)(tsContent);
33
+ const contentAst = ast(tsContent);
42
34
  replaceTagInInlineTemplates(tree, filePath, oldTagName, newTagName);
43
35
  replaceTagInExternalTemplates(tree, filePath, contentAst, oldTagName, newTagName);
44
36
  }
@@ -53,18 +45,18 @@ function replaceTagInInlineAndExternalTemplate(tree, filePath, oldTagName, newTa
53
45
  * @param oldTagName - The tag name to replace.
54
46
  * @param newTagName - The new tag name to use.
55
47
  */
56
- function replaceTagInInlineTemplates(tree, filePath, oldTagName, newTagName) {
48
+ export function replaceTagInInlineTemplates(tree, filePath, oldTagName, newTagName) {
57
49
  const fileContent = tree.read(filePath, 'utf-8');
58
50
  if (!fileContent)
59
51
  return;
60
52
  const querySelectorInlineTemplate = 'PropertyAssignment:has(Identifier[name="template"]) > NoSubstitutionTemplateLiteral';
61
- const updatedContent = (0, tsquery_1.replace)(fileContent, querySelectorInlineTemplate, (node) => {
53
+ const updatedContent = replace(fileContent, querySelectorInlineTemplate, (node) => {
62
54
  const originalText = node.getText();
63
- if (!(0, has_html_tag_utils_1.hasHtmlTag)(tree, originalText, oldTagName))
55
+ if (!hasHtmlTag(tree, originalText, oldTagName))
64
56
  return originalText;
65
- const updatedHtml = (0, replace_tag_in_html_utils_1.replaceTagInHtml)(tree, originalText, oldTagName, newTagName);
57
+ const updatedHtml = replaceTagInHtml(tree, originalText, oldTagName, newTagName);
66
58
  return updatedHtml;
67
- }, typescript_1.ScriptKind.TS);
59
+ }, ScriptKind.TS);
68
60
  if (updatedContent !== fileContent) {
69
61
  tree.write(filePath, updatedContent);
70
62
  }
@@ -77,13 +69,13 @@ function replaceTagInInlineTemplates(tree, filePath, oldTagName, newTagName) {
77
69
  * @param oldTagName - The tag name to replace.
78
70
  * @param newTagName - The new tag name to use.
79
71
  */
80
- function replaceTagInExternalTemplates(tree, filePath, contentAst, oldTagName, newTagName) {
72
+ export function replaceTagInExternalTemplates(tree, filePath, contentAst, oldTagName, newTagName) {
81
73
  const externalTemplates = getExternalTemplatePaths(contentAst, filePath);
82
74
  externalTemplates.forEach((path) => {
83
75
  const html = tree.read(path, 'utf-8');
84
- if (!html || !(0, has_html_tag_utils_1.hasHtmlTag)(tree, path, oldTagName))
76
+ if (!html || !hasHtmlTag(tree, path, oldTagName))
85
77
  return;
86
- const modifiedHtml = (0, replace_tag_in_html_utils_1.replaceTagInHtml)(tree, html, oldTagName, newTagName);
78
+ const modifiedHtml = replaceTagInHtml(tree, html, oldTagName, newTagName);
87
79
  tree.write(path, modifiedHtml);
88
80
  });
89
81
  }
@@ -92,8 +84,8 @@ function replaceTagInExternalTemplates(tree, filePath, contentAst, oldTagName, n
92
84
  * @param contentAst - The parsed TypeScript AST.
93
85
  * @returns An array of inline template nodes.
94
86
  */
95
- function getInlineTemplateNodes(contentAst) {
96
- return (0, tsquery_1.query)(contentAst, 'PropertyAssignment:has(Identifier[name="template"]) > NoSubstitutionTemplateLiteral');
87
+ export function getInlineTemplateNodes(contentAst) {
88
+ return query(contentAst, 'PropertyAssignment:has(Identifier[name="template"]) > NoSubstitutionTemplateLiteral');
97
89
  }
98
90
  /**
99
91
  * Extracts resolved external template file paths from a TypeScript AST.
@@ -101,8 +93,8 @@ function getInlineTemplateNodes(contentAst) {
101
93
  * @param filePath - The path to the TypeScript file.
102
94
  * @returns An array of resolved external HTML file paths.
103
95
  */
104
- function getExternalTemplatePaths(contentAst, filePath) {
105
- const nodes = (0, tsquery_1.query)(contentAst, 'PropertyAssignment:has(Identifier[name="templateUrl"]) > StringLiteral');
106
- return nodes.filter(typescript_1.isStringLiteral).map((node) => (0, path_1.join)((0, path_1.dirname)(filePath), node.text));
96
+ export function getExternalTemplatePaths(contentAst, filePath) {
97
+ const nodes = query(contentAst, 'PropertyAssignment:has(Identifier[name="templateUrl"]) > StringLiteral');
98
+ return nodes.filter(isStringLiteral).map((node) => join(dirname(filePath), node.text));
107
99
  }
108
100
  //# sourceMappingURL=html-templates.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"html-templates.utils.js","sourceRoot":"","sources":["../../../../../../libs/nx-migration-utils/src/lib/angular/html-templates.utils.ts"],"names":[],"mappings":";;AAcA,oEAMC;AASD,sFAkBC;AASD,kEAwBC;AAUD,sEAiBC;AAOD,wDAEC;AAQD,4DAIC;AAhID,uCAAuD;AACvD,uDAA+D;AAC/D,+BAAoC;AACpC,2CAA8D;AAC9D,+EAAmE;AACnE,+FAAkF;AAElF;;;;;;GAMG;AACH,SAAgB,4BAA4B,CAAC,IAAU,EAAE,OAAe,EAAE,UAAkB,EAAE,UAAkB;IAC9G,IAAA,6BAAoB,EAAC,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAC3C,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,qCAAqC,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU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,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;AACxF,CAAC"}
1
+ {"version":3,"file":"html-templates.utils.js","sourceRoot":"","sources":["../../../../../../libs/nx-migration-utils/src/lib/angular/html-templates.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AACpC,OAAO,EAAE,eAAe,EAAQ,UAAU,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAA;AAElF;;;;;;GAMG;AACH,MAAM,UAAU,4BAA4B,CAAC,IAAU,EAAE,OAAe,EAAE,UAAkB,EAAE,UAAkB;IAC9G,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAC3C,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,qCAAqC,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAA;QAC3E,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qCAAqC,CACnD,IAAU,EACV,QAAgB,EAChB,UAAkB,EAClB,UAAkB;IAElB,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAE7C,IAAI,CAAC,SAAS;YAAE,OAAM;QAEtB,MAAM,UAAU,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;QAEjC,2BAA2B,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAA;QACnE,6BAA6B,C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AAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACrC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC;YAAE,OAAM;QAExD,MAAM,YAAY,GAAG,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAA;QAEzE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAgB;IACrD,OAAO,KAAK,CAAC,UAAU,EAAE,qFAAqF,CAAC,CAAA;AACjH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,UAAgB,EAAE,QAAgB;IACzE,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,EAAE,wEAAwE,CAAC,CAAA;IAEzG,OAAO,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;AACxF,CAAC"}
@@ -1,23 +1,20 @@
1
- "use strict";
2
1
  // Angular specific NX migration utilities
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const tslib_1 = require("tslib");
5
2
  // Model
6
- tslib_1.__exportStar(require("./model/matching-module.model"), exports);
7
- tslib_1.__exportStar(require("./model/module.model"), exports);
8
- tslib_1.__exportStar(require("./model/provider.model"), exports);
3
+ export * from './model/matching-module.model';
4
+ export * from './model/module.model';
5
+ export * from './model/provider.model';
9
6
  // Utils
10
- tslib_1.__exportStar(require("./html-templates.utils"), exports);
11
- tslib_1.__exportStar(require("./parameters.utils"), exports);
12
- tslib_1.__exportStar(require("./replacement-in-files.utils"), exports);
13
- tslib_1.__exportStar(require("./utils/patterns.utils"), exports);
14
- tslib_1.__exportStar(require("./utils/detection/detect-modules-importing-module.utils"), exports);
15
- tslib_1.__exportStar(require("./utils/detection/detect-variables-with-module.utils"), exports);
16
- tslib_1.__exportStar(require("./utils/detection/detect-variables-with-provider.utils"), exports);
17
- tslib_1.__exportStar(require("./utils/modification/add-provider-import-if-does-not-exist.utils"), exports);
18
- tslib_1.__exportStar(require("./utils/modification/add-provider-import-in-file.utils"), exports);
19
- tslib_1.__exportStar(require("./utils/modification/add-provider-in-module-if-does-not-exist.utils"), exports);
20
- tslib_1.__exportStar(require("./utils/modification/add-provider-in-module.utils"), exports);
21
- tslib_1.__exportStar(require("./utils/validation/is-provider-import-in-file.utils"), exports);
22
- tslib_1.__exportStar(require("./utils/validation/is-provider-in-module.utils"), exports);
7
+ export * from './html-templates.utils';
8
+ export * from './parameters.utils';
9
+ export * from './replacement-in-files.utils';
10
+ export * from './utils/patterns.utils';
11
+ export * from './utils/detection/detect-modules-importing-module.utils';
12
+ export * from './utils/detection/detect-variables-with-module.utils';
13
+ export * from './utils/detection/detect-variables-with-provider.utils';
14
+ export * from './utils/modification/add-provider-import-if-does-not-exist.utils';
15
+ export * from './utils/modification/add-provider-import-in-file.utils';
16
+ export * from './utils/modification/add-provider-in-module-if-does-not-exist.utils';
17
+ export * from './utils/modification/add-provider-in-module.utils';
18
+ export * from './utils/validation/is-provider-import-in-file.utils';
19
+ export * from './utils/validation/is-provider-in-module.utils';
23
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/nx-migration-utils/src/lib/angular/index.ts"],"names":[],"mappings":";AAAA,0CAA0C;;;AAE1C,QAAQ;AACR,wEAA6C;AAC7C,+DAAoC;AACpC,iEAAsC;AAEtC,QAAQ;AACR,iEAAsC;AACtC,6DAAkC;AAClC,uEAA4C;AAC5C,iEAAsC;AACtC,kGAAuE;AACvE,+FAAoE;AACpE,iGAAsE;AACtE,2GAAgF;AAChF,iGAAsE;AACtE,8GAAmF;AACnF,4FAAiE;AACjE,8FAAmE;AACnE,yFAA8D"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/nx-migration-utils/src/lib/angular/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAE1C,QAAQ;AACR,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AAEtC,QAAQ;AACR,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yDAAyD,CAAA;AACvE,cAAc,sDAAsD,CAAA;AACpE,cAAc,wDAAwD,CAAA;AACtE,cAAc,kEAAkE,CAAA;AAChF,cAAc,wDAAwD,CAAA;AACtE,cAAc,qEAAqE,CAAA;AACnF,cAAc,mDAAmD,CAAA;AACjE,cAAc,qDAAqD,CAAA;AACnE,cAAc,gDAAgD,CAAA"}
@@ -1,3 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  //# sourceMappingURL=matching-module.model.js.map
@@ -1,3 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  //# sourceMappingURL=module.model.js.map
@@ -1,3 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  //# sourceMappingURL=provider.model.js.map
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.removeParameters = removeParameters;
4
- const devkit_1 = require("@nx/devkit");
5
- const tsquery_1 = require("@phenomnomnominal/tsquery");
6
- const typescript_1 = require("typescript");
7
- const detect_method_calls_in_files_utils_1 = require("../utils/detect-method-calls-in-files.utils");
8
- const typescript_files_utils_1 = require("../utils/typescript-files.utils");
1
+ import { visitNotIgnoredFiles } from '@nx/devkit';
2
+ import { ast, replace } from '@phenomnomnominal/tsquery';
3
+ import { ScriptKind } from 'typescript';
4
+ import { getParameterNames } from '../utils/detect-method-calls-in-files.utils';
5
+ import { fileMatchesQuery } from '../utils/typescript-files.utils';
9
6
  /**
10
7
  * Removes constructor parameters of specified class types from TypeScript files.
11
8
  *
@@ -15,18 +12,18 @@ const typescript_files_utils_1 = require("../utils/typescript-files.utils");
15
12
  * @param filterQuery - Optional custom string query to filter files before applying changes.
16
13
  * This can be used to limit the operation to files containing specific content (e.g., a class name or decorator).
17
14
  */
18
- function removeParameters(tree, directoryPath, classNames, filterQuery) {
19
- (0, devkit_1.visitNotIgnoredFiles)(tree, directoryPath, (filePath) => {
15
+ export function removeParameters(tree, directoryPath, classNames, filterQuery) {
16
+ visitNotIgnoredFiles(tree, directoryPath, (filePath) => {
20
17
  if (!filePath.endsWith('.ts'))
21
18
  return;
22
19
  try {
23
20
  const fileContent = tree.read(filePath, 'utf-8');
24
21
  if (!fileContent)
25
22
  return;
26
- const contentAst = (0, tsquery_1.ast)(fileContent);
27
- if (filterQuery && !(0, typescript_files_utils_1.fileMatchesQuery)(fileContent, filterQuery))
23
+ const contentAst = ast(fileContent);
24
+ if (filterQuery && !fileMatchesQuery(fileContent, filterQuery))
28
25
  return;
29
- const parameterNames = classNames.flatMap((className) => (0, detect_method_calls_in_files_utils_1.getParameterNames)(contentAst, className));
26
+ const parameterNames = classNames.flatMap((className) => getParameterNames(contentAst, className));
30
27
  if (!parameterNames.length)
31
28
  return;
32
29
  const parametersQuery = classNames
@@ -35,8 +32,8 @@ function removeParameters(tree, directoryPath, classNames, filterQuery) {
35
32
  const parameterNamesQuery = parameterNames
36
33
  .map((parameterName) => `NewExpression > Identifier[name="${parameterName}"]`)
37
34
  .join(', ');
38
- let updatedContent = (0, tsquery_1.replace)(fileContent, parametersQuery, () => '', typescript_1.ScriptKind.TS);
39
- updatedContent = (0, tsquery_1.replace)(updatedContent, parameterNamesQuery, () => '', typescript_1.ScriptKind.TS);
35
+ let updatedContent = replace(fileContent, parametersQuery, () => '', ScriptKind.TS);
36
+ updatedContent = replace(updatedContent, parameterNamesQuery, () => '', ScriptKind.TS);
40
37
  if (updatedContent !== fileContent) {
41
38
  tree.write(filePath, updatedContent);
42
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"parameters.utils.js","sourceRoot":"","sources":["../../../../../../libs/nx-migration-utils/src/lib/angular/parameters.utils.ts"],"names":[],"mappings":";;AAeA,4CAiCC;AAhDD,uCAAuD;AACvD,uDAAwD;AACxD,2CAAuC;AACvC,oGAA+E;AAC/E,4EAAkE;AAElE;;;;;;;;GAQG;AACH,SAAgB,gBAAgB,CAAC,IAAU,EAAE,aAAqB,EAAE,UAAoB,EAAE,WAAoB;IAC5G,IAAA,6BAAoB,EAAC,IAAI,EAAE,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE;QACrD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAM;QAErC,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YAChD,IAAI,CAAC,WAAW;gBAAE,OAAM;YAExB,MAAM,UAAU,GAAG,IAAA,aAAG,EAAC,WAAW,CAAC,CAAA;YAEnC,IAAI,WAAW,IAAI,CAAC,IAAA,yCAAgB,EAAC,WAAW,EAAE,WAAW,CAAC;gBAAE,OAAM;YAEtE,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAA,sDAAiB,EAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAA;YAClG,IAAI,CAAC,cAAc,CAAC,MAAM;gBAAE,OAAM;YAElC,MAAM,eAAe,GAAG,UAAU;iBAC/B,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,oDAAoD,SAAS,MAAM,CAAC;iBACvF,IAAI,CAAC,IAAI,CAAC,CAAA;YAEb,MAAM,mBAAmB,GAAG,cAAc;i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CAAA;QAC3E,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -1,11 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceInFile = replaceInFile;
4
- exports.replaceInFiles = replaceInFiles;
5
- const devkit_1 = require("@nx/devkit");
6
- const tsquery_1 = require("@phenomnomnominal/tsquery");
7
- const typescript_1 = require("typescript");
8
- const typescript_files_utils_1 = require("../utils/typescript-files.utils");
1
+ import { visitNotIgnoredFiles } from '@nx/devkit';
2
+ import { replace } from '@phenomnomnominal/tsquery';
3
+ import { ScriptKind } from 'typescript';
4
+ import { fileMatchesQuery, removeEmptySlotsFromArrays } from '../utils/typescript-files.utils';
9
5
  /**
10
6
  * Applies a tsquery-based replacement to a single TypeScript file.
11
7
  * @param tree - The Nx virtual file system tree.
@@ -13,14 +9,14 @@ const typescript_files_utils_1 = require("../utils/typescript-files.utils");
13
9
  * @param queryStr - A tsquery selector string used to identify nodes for replacement.
14
10
  * @param replacement - The replacement string. If empty, trailing commas and empty array slots are cleaned up.
15
11
  */
16
- function replaceInFile(tree, filePath, queryStr, replacement) {
12
+ export function replaceInFile(tree, filePath, queryStr, replacement) {
17
13
  try {
18
14
  const fileContent = tree.read(filePath, 'utf-8');
19
15
  if (!fileContent)
20
16
  return;
21
- let updatedContent = (0, tsquery_1.replace)(fileContent, queryStr, () => replacement, typescript_1.ScriptKind.TS);
17
+ let updatedContent = replace(fileContent, queryStr, () => replacement, ScriptKind.TS);
22
18
  if (replacement === '') {
23
- updatedContent = (0, typescript_files_utils_1.removeEmptySlotsFromArrays)(updatedContent);
19
+ updatedContent = removeEmptySlotsFromArrays(updatedContent);
24
20
  }
25
21
  if (updatedContent !== fileContent) {
26
22
  tree.write(filePath, updatedContent);
@@ -37,14 +33,14 @@ function replaceInFile(tree, filePath, queryStr, replacement) {
37
33
  * @param queryStr - A tsquery selector string used to identify nodes for replacement.
38
34
  * @param replacement - The replacement string. If empty, trailing commas and empty array slots are cleaned up.
39
35
  */
40
- function replaceInFiles(tree, directoryPath, queryStr, replacement, filterQuery) {
41
- (0, devkit_1.visitNotIgnoredFiles)(tree, directoryPath, (filePath) => {
36
+ export function replaceInFiles(tree, directoryPath, queryStr, replacement, filterQuery) {
37
+ visitNotIgnoredFiles(tree, directoryPath, (filePath) => {
42
38
  if (!filePath.endsWith('.ts'))
43
39
  return;
44
40
  const fileContent = tree.read(filePath, 'utf-8');
45
41
  if (!fileContent)
46
42
  return;
47
- if (filterQuery && !(0, typescript_files_utils_1.fileMatchesQuery)(fileContent, filterQuery))
43
+ if (filterQuery && !fileMatchesQuery(fileContent, filterQuery))
48
44
  return;
49
45
  replaceInFile(tree, filePath, queryStr, replacement);
50
46
  });
@@ -1 +1 @@
1
- {"version":3,"file":"replacement-in-files.utils.js","sourceRoot":"","sources":["../../../../../../libs/nx-migration-utils/src/lib/angular/replacement-in-files.utils.ts"],"names":[],"mappings":";;AAYA,sCAgBC;AASD,wCAWC;AAhDD,uCAAuD;AACvD,uDAAmD;AACnD,2CAAuC;AACvC,4EAA8F;AAE9F;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,IAAU,EAAE,QAAgB,EAAE,QAAgB,EAAE,WAAmB;IAC/F,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QAChD,IAAI,CAAC,WAAW;YAAE,OAAM;QAExB,IAAI,cAAc,GAAG,IAAA,iBAAO,EAAC,WAAW,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE,uBAAU,CAAC,EAAE,CAAC,CAAA;QACrF,IAAI,WAAW,KAAK,EAAE,EAAE,CAAC;YACvB,cAAc,GAAG,IAAA,mDAA0B,EAAC,cAAc,CAAC,CAAA;QAC7D,CAAC;QAED,IAAI,cAAc,KAAK,WAAW,EAAE,CAAC;YACnC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,QAAQ,IAAI,EAAE,KAAK,CAAC,CAAA;IACxE,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,IAAU,EAAE,aAAqB,EAAE,QAAgB,EAAE,WAAmB,EAAE,WAAoB;IAC3H,IAAA,6BAAoB,EAAC,IAAI,EAAE,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE;QACrD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAM;QAErC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QAChD,IAAI,CAAC,WAAW;YAAE,OAAM;QAExB,IAAI,WAAW,IAAI,CAAC,IAAA,yCAAgB,EAAC,WAAW,EAAE,WAAW,CAAC;YAAE,OAAM;QAEtE,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;IACtD,CAAC,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"replacement-in-files.utils.js","sourceRoot":"","sources":["../../../../../../libs/nx-migration-utils/src/lib/angular/replacement-in-files.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAE9F;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,IAAU,EAAE,QAAgB,EAAE,QAAgB,EAAE,WAAmB;IAC/F,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QAChD,IAAI,CAAC,WAAW;YAAE,OAAM;QAExB,IAAI,cAAc,GAAG,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,CAAC,CAAA;QACrF,IAAI,WAAW,KAAK,EAAE,EAAE,CAAC;YACvB,cAAc,GAAG,0BAA0B,CAAC,cAAc,CAAC,CAAA;QAC7D,CAAC;QAED,IAAI,cAAc,KAAK,WAAW,EAAE,CAAC;YACnC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,QAAQ,IAAI,EAAE,KAAK,CAAC,CAAA;IACxE,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,IAAU,EAAE,aAAqB,EAAE,QAAgB,EAAE,WAAmB,EAAE,WAAoB;IAC3H,oBAAoB,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE;QACrD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAM;QAErC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QAChD,IAAI,CAAC,WAAW;YAAE,OAAM;QAExB,IAAI,WAAW,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,WAAW,CAAC;YAAE,OAAM;QAEtE,aAAa,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;IACtD,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.detectModulesImportingModule = detectModulesImportingModule;
4
- const devkit_1 = require("@nx/devkit");
5
- const tsquery_1 = require("@phenomnomnominal/tsquery");
6
- const patterns_utils_1 = require("../patterns.utils");
1
+ import { visitNotIgnoredFiles } from '@nx/devkit';
2
+ import { ast, query } from '@phenomnomnominal/tsquery';
3
+ import { moduleImportIdentifierPattern } from '../patterns.utils';
7
4
  /**
8
5
  * Detects Angular module definitions that import given module.
9
6
  * @param tree - the file tree to search in
@@ -12,19 +9,19 @@ const patterns_utils_1 = require("../patterns.utils");
12
9
  * @param variablesIncludingModule - the list of variable names containing the module to search for
13
10
  * @returns {MatchingModule[]} a list of found modules that import the module via direct declaration or variable
14
11
  */
15
- function detectModulesImportingModule(tree, rootDir, module, variablesIncludingModule) {
12
+ export function detectModulesImportingModule(tree, rootDir, module, variablesIncludingModule) {
16
13
  const matchingModules = [];
17
14
  // Query for import in module directly
18
- const directImportPattern = (0, patterns_utils_1.moduleImportIdentifierPattern)(module.name);
15
+ const directImportPattern = moduleImportIdentifierPattern(module.name);
19
16
  // Query for import via a variable
20
- const importViaVariablePatterns = variablesIncludingModule.map((name) => (0, patterns_utils_1.moduleImportIdentifierPattern)(name));
21
- (0, devkit_1.visitNotIgnoredFiles)(tree, rootDir, (file) => {
17
+ const importViaVariablePatterns = variablesIncludingModule.map((name) => moduleImportIdentifierPattern(name));
18
+ visitNotIgnoredFiles(tree, rootDir, (file) => {
22
19
  const content = tree.read(file, 'utf-8');
23
20
  if (!content)
24
21
  return;
25
- const contentAst = (0, tsquery_1.ast)(content);
22
+ const contentAst = ast(content);
26
23
  const allPatterns = [...importViaVariablePatterns, directImportPattern].join(', ');
27
- const moduleNamesInFile = (0, tsquery_1.query)(contentAst, allPatterns)
24
+ const moduleNamesInFile = query(contentAst, allPatterns)
28
25
  .map((classDeclaration) => classDeclaration.name?.text)
29
26
  .filter((className) => !!className)
30
27
  .map((className) => {
@@ -1 +1 @@
1
- {"version":3,"file":"detect-modules-importing-module.utils.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-migration-utils/src/lib/angular/utils/detection/detect-modules-importing-module.utils.ts"],"names":[],"mappings":";;A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OAAO,eAAe,CAAA;AACxB,CAAC"}
1
+ {"version":3,"file":"detect-modules-importing-module.utils.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-migration-utils/src/lib/angular/utils/detection/detect-modules-importing-module.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAItD,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAA;AAEjE;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAC1C,IAAU,EACV,OAAe,EACf,MAAc,EACd,wBAAkC;IAElC,MAAM,eAAe,GAAqB,EAAE,CAAA;IAC5C,sCAAsC;IACtC,MAAM,mBAAmB,GAAG,6BAA6B,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACtE,kCAAkC;IAClC,MAAM,yBAAyB,GAAG,wBAAwB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,6BAA6B,CAAC,IAAI,CAAC,CAAC,CAAA;IAE7G,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACxC,IAAI,CAAC,OAAO;YAAE,OAAM;QAEpB,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,CAAA;QAE/B,MAAM,WAAW,GAAG,CAAC,GAAG,yBAAyB,EAAE,mBAAmB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClF,MAAM,iBAAiB,GAAqB,KAAK,CAAmB,UAAU,EAAE,WAAW,CAAC;aACzF,GAAG,CAAC,CAAC,gBAAgB,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC;aACtD,MAAM,CAAC,CAAC,SAAS,EAAuB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;aACvD,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YACjB,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,IAAI;aACf,CAAA;QACH,CAAC,CAAC,CAAA;QACJ,eAAe,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,CAAA;IAC5C,CAAC,CAAC,CAAA;IAEF,OAAO,eAAe,CAAA;AACxB,CAAC"}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.detectVariablesWithModule = detectVariablesWithModule;
4
- const detect_variables_with_identifier_utils_1 = require("../../../utils/detection/detect-variables-with-identifier.utils");
1
+ import { detectVariablesWithIdentifier } from '../../../utils/detection/detect-variables-with-identifier.utils';
5
2
  /**
6
3
  * Detects variables that include the Angular module.
7
4
  * @param tree - the file tree to search in
@@ -9,7 +6,7 @@ const detect_variables_with_identifier_utils_1 = require("../../../utils/detecti
9
6
  * @param module - the module to search for
10
7
  * @returns {string[]} a list of variable names that include the module
11
8
  */
12
- function detectVariablesWithModule(tree, rootDir, module) {
13
- return (0, detect_variables_with_identifier_utils_1.detectVariablesWithIdentifier)(tree, rootDir, module.name);
9
+ export function detectVariablesWithModule(tree, rootDir, module) {
10
+ return detectVariablesWithIdentifier(tree, rootDir, module.name);
14
11
  }
15
12
  //# sourceMappingURL=detect-variables-with-module.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"detect-variables-with-module.utils.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-migration-utils/src/lib/angular/utils/detection/detect-variables-with-module.utils.ts"],"names":[],"mappings":";;AAWA,8DAEC;AAZD,4HAA+G;AAG/G;;;;;;GAMG;AACH,SAAgB,yBAAyB,CAAC,IAAU,EAAE,OAAe,EAAE,MAAc;IACnF,OAAO,IAAA,sEAA6B,EAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;AAClE,CAAC"}
1
+ {"version":3,"file":"detect-variables-with-module.utils.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-migration-utils/src/lib/angular/utils/detection/detect-variables-with-module.utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iEAAiE,CAAA;AAG/G;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAU,EAAE,OAAe,EAAE,MAAc;IACnF,OAAO,6BAA6B,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;AAClE,CAAC"}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.detectVariablesWithProvider = detectVariablesWithProvider;
4
- const detect_variables_with_identifier_utils_1 = require("../../../utils/detection/detect-variables-with-identifier.utils");
1
+ import { detectVariablesWithIdentifier } from '../../../utils/detection/detect-variables-with-identifier.utils';
5
2
  /**
6
3
  * Detects variables that include the Angular provider.
7
4
  * @param tree - the file tree to search in
@@ -9,7 +6,7 @@ const detect_variables_with_identifier_utils_1 = require("../../../utils/detecti
9
6
  * @param provider - the provider to search for
10
7
  * @returns {string[]} a list of variable names that include the provider
11
8
  */
12
- function detectVariablesWithProvider(tree, rootDir, provider) {
13
- return (0, detect_variables_with_identifier_utils_1.detectVariablesWithIdentifier)(tree, rootDir, provider.name);
9
+ export function detectVariablesWithProvider(tree, rootDir, provider) {
10
+ return detectVariablesWithIdentifier(tree, rootDir, provider.name);
14
11
  }
15
12
  //# sourceMappingURL=detect-variables-with-provider.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"detect-variables-with-provider.utils.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-migration-utils/src/lib/angular/utils/detection/detect-variables-with-provider.utils.ts"],"names":[],"mappings":";;AAWA,kEAEC;AAZD,4HAA+G;AAG/G;;;;;;GAMG;AACH,SAAgB,2BAA2B,CAAC,IAAU,EAAE,OAAe,EAAE,QAAkB;IACzF,OAAO,IAAA,sEAA6B,EAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAA;AACpE,CAAC"}
1
+ {"version":3,"file":"detect-variables-with-provider.utils.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-migration-utils/src/lib/angular/utils/detection/detect-variables-with-provider.utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iEAAiE,CAAA;AAG/G;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CAAC,IAAU,EAAE,OAAe,EAAE,QAAkB;IACzF,OAAO,6BAA6B,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAA;AACpE,CAAC"}
@@ -1,21 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addProviderImportIfDoesNotExist = addProviderImportIfDoesNotExist;
4
- const is_provider_import_in_file_utils_1 = require("../validation/is-provider-import-in-file.utils");
5
- const add_provider_import_in_file_utils_1 = require("./add-provider-import-in-file.utils");
1
+ import { isProviderImportInFile } from '../validation/is-provider-import-in-file.utils';
2
+ import { addProviderImportInFile } from './add-provider-import-in-file.utils';
6
3
  /**
7
4
  * Modify the file content so the import for Angular provider exists if it was not present already.
8
5
  * @param tree - the file tree used for file content reading
9
6
  * @param filePath - the path to a file to validate and update
10
7
  * @param provider - angular provider to import
11
8
  */
12
- function addProviderImportIfDoesNotExist(tree, filePath, provider) {
9
+ export function addProviderImportIfDoesNotExist(tree, filePath, provider) {
13
10
  const fileContent = tree.read(filePath, 'utf-8');
14
11
  if (!fileContent)
15
12
  return;
16
13
  let updatedFileContent = fileContent;
17
- if (!(0, is_provider_import_in_file_utils_1.isProviderImportInFile)(updatedFileContent, provider)) {
18
- updatedFileContent = (0, add_provider_import_in_file_utils_1.addProviderImportInFile)(updatedFileContent, provider);
14
+ if (!isProviderImportInFile(updatedFileContent, provider)) {
15
+ updatedFileContent = addProviderImportInFile(updatedFileContent, provider);
19
16
  }
20
17
  if (fileContent !== updatedFileContent) {
21
18
  tree.write(filePath, updatedFileContent);
@@ -1 +1 @@
1
- {"version":3,"file":"add-provider-import-if-does-not-exist.utils.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-migration-utils/src/lib/angular/utils/modification/add-provider-import-if-does-not-exist.utils.ts"],"names":[],"mappings":";;AAWA,0EAaC;AAtBD,qGAAuF;AACvF,2FAA6E;AAE7E;;;;;GAKG;AACH,SAAgB,+BAA+B,CAAC,IAAU,EAAE,QAAgB,EAAE,QAAkB;IAC9F,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAChD,IAAI,CAAC,WAAW;QAAE,OAAM;IAExB,IAAI,kBAAkB,GAAG,WAAW,CAAA;IAEpC,IAAI,CAAC,IAAA,yDAAsB,EAAC,kBAAkB,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC1D,kBAAkB,GAAG,IAAA,2DAAuB,EAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAA;IAC5E,CAAC;IAED,IAAI,WAAW,KAAK,kBAAkB,EAAE,CAAC;QACvC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;IAC1C,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"add-provider-import-if-does-not-exist.utils.js","sourceRoot":"","sources":["../../../../../../../../libs/nx-migration-utils/src/lib/angular/utils/modification/add-provider-import-if-does-not-exist.utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAA;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAE7E;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAAC,IAAU,EAAE,QAAgB,EAAE,QAAkB;IAC9F,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAChD,IAAI,CAAC,WAAW;QAAE,OAAM;IAExB,IAAI,kBAAkB,GAAG,WAAW,CAAA;IAEpC,IAAI,CAAC,sBAAsB,CAAC,kBAAkB,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC1D,kBAAkB,GAAG,uBAAuB,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAA;IAC5E,CAAC;IAED,IAAI,WAAW,KAAK,kBAAkB,EAAE,CAAC;QACvC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;IAC1C,CAAC;AACH,CAAC"}
@@ -1,25 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addProviderImportInFile = addProviderImportInFile;
4
- const add_new_import_utils_1 = require("../../../utils/modification/add-new-import.utils");
5
- const add_to_first_import_utils_1 = require("../../../utils/modification/add-to-first-import.utils");
6
- const is_import_in_content_utils_1 = require("../../../utils/validation/is-import-in-content.utils");
7
- const is_namespace_import_in_content_utils_1 = require("../../../utils/validation/is-namespace-import-in-content.utils");
1
+ import { addNewImport } from '../../../utils/modification/add-new-import.utils';
2
+ import { addToFirstImport } from '../../../utils/modification/add-to-first-import.utils';
3
+ import { isImportInContent } from '../../../utils/validation/is-import-in-content.utils';
4
+ import { isNamespaceImportInContent } from '../../../utils/validation/is-namespace-import-in-content.utils';
8
5
  /**
9
6
  * Add the import for Angular provider in the file.
10
7
  * @param fileContent - the path to a file to modify
11
8
  * @param provider - angular provider to add
12
9
  * @returns {string} modified content of the file with provider imported
13
10
  */
14
- function addProviderImportInFile(fileContent, provider) {
15
- if ((0, is_namespace_import_in_content_utils_1.isNamespaceImportInContent)(fileContent, provider.importPath)) {
11
+ export function addProviderImportInFile(fileContent, provider) {
12
+ if (isNamespaceImportInContent(fileContent, provider.importPath)) {
16
13
  return fileContent;
17
14
  }
18
- else if ((0, is_import_in_content_utils_1.isImportInContent)(fileContent, provider.importPath)) {
19
- return (0, add_to_first_import_utils_1.addToFirstImport)(fileContent, provider.importPath, provider.name);
15
+ else if (isImportInContent(fileContent, provider.importPath)) {
16
+ return addToFirstImport(fileContent, provider.importPath, provider.name);
20
17
  }
21
18
  else {
22
- return (0, add_new_import_utils_1.addNewImport)(fileContent, provider.importPath, [provider.name]);
19
+ return addNewImport(fileContent, provider.importPath, [provider.name]);
23
20
  }
24
21
  }
25
22
  //# sourceMappingURL=add-provider-import-in-file.utils.js.map