@taiga-ui/cdk 2.60.0 → 2.61.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 (76) hide show
  1. package/bundles/taiga-ui-cdk-constants.umd.js +3 -0
  2. package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
  3. package/bundles/taiga-ui-cdk-constants.umd.min.js +1 -1
  4. package/bundles/taiga-ui-cdk-constants.umd.min.js.map +1 -1
  5. package/bundles/taiga-ui-cdk-pipes-keys.umd.js +286 -0
  6. package/bundles/taiga-ui-cdk-pipes-keys.umd.js.map +1 -0
  7. package/bundles/taiga-ui-cdk-pipes-keys.umd.min.js +2 -0
  8. package/bundles/taiga-ui-cdk-pipes-keys.umd.min.js.map +1 -0
  9. package/bundles/taiga-ui-cdk-pipes.umd.js +12 -4
  10. package/bundles/taiga-ui-cdk-pipes.umd.js.map +1 -1
  11. package/bundles/taiga-ui-cdk-pipes.umd.min.js +1 -1
  12. package/constants/index.d.ts +1 -0
  13. package/constants/taiga-ui-cdk-constants.metadata.json +1 -1
  14. package/constants/version.d.ts +1 -0
  15. package/constants/version.js +3 -0
  16. package/esm2015/constants/index.js +2 -1
  17. package/esm2015/constants/version.js +2 -0
  18. package/esm2015/pipes/index.js +2 -1
  19. package/esm2015/pipes/keys/index.js +3 -0
  20. package/esm2015/pipes/keys/keys.module.js +13 -0
  21. package/esm2015/pipes/keys/keys.pipe.js +12 -0
  22. package/esm2015/pipes/keys/taiga-ui-cdk-pipes-keys.js +5 -0
  23. package/esm5/constants/index.js +2 -1
  24. package/esm5/constants/version.js +2 -0
  25. package/esm5/pipes/index.js +2 -1
  26. package/esm5/pipes/keys/index.js +3 -0
  27. package/esm5/pipes/keys/keys.module.js +16 -0
  28. package/esm5/pipes/keys/keys.pipe.js +15 -0
  29. package/esm5/pipes/keys/taiga-ui-cdk-pipes-keys.js +5 -0
  30. package/fesm2015/taiga-ui-cdk-constants.js +3 -1
  31. package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
  32. package/fesm2015/taiga-ui-cdk-pipes-keys.js +27 -0
  33. package/fesm2015/taiga-ui-cdk-pipes-keys.js.map +1 -0
  34. package/fesm2015/taiga-ui-cdk-pipes.js +1 -0
  35. package/fesm2015/taiga-ui-cdk-pipes.js.map +1 -1
  36. package/fesm5/taiga-ui-cdk-constants.js +3 -1
  37. package/fesm5/taiga-ui-cdk-constants.js.map +1 -1
  38. package/fesm5/taiga-ui-cdk-pipes-keys.js +33 -0
  39. package/fesm5/taiga-ui-cdk-pipes-keys.js.map +1 -0
  40. package/fesm5/taiga-ui-cdk-pipes.js +1 -0
  41. package/fesm5/taiga-ui-cdk-pipes.js.map +1 -1
  42. package/package.json +1 -1
  43. package/pipes/index.d.ts +1 -0
  44. package/pipes/keys/index.d.ts +2 -0
  45. package/pipes/keys/keys.module.d.ts +2 -0
  46. package/pipes/keys/keys.pipe.d.ts +4 -0
  47. package/pipes/keys/package.json +13 -0
  48. package/pipes/keys/taiga-ui-cdk-pipes-keys.d.ts +4 -0
  49. package/pipes/keys/taiga-ui-cdk-pipes-keys.metadata.json +1 -0
  50. package/pipes/taiga-ui-cdk-pipes.metadata.json +1 -1
  51. package/schematics/collection.json +6 -0
  52. package/schematics/constants/file-globs.d.ts +2 -0
  53. package/schematics/constants/file-globs.js +10 -0
  54. package/schematics/constants/index.d.ts +1 -0
  55. package/schematics/constants/index.js +4 -0
  56. package/schematics/ng-add/constants/versions.js +2 -2
  57. package/schematics/ng-update/index.d.ts +11 -2
  58. package/schematics/ng-update/index.js +8 -8
  59. package/schematics/ng-update/schema.json +13 -0
  60. package/schematics/ng-update/steps/migrate-date-time.js +45 -1
  61. package/schematics/ng-update/steps/migrate-progress.js +2 -1
  62. package/schematics/ng-update/steps/migrate-sliders/index.js +2 -0
  63. package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.js +4 -3
  64. package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.js +3 -2
  65. package/schematics/ng-update/steps/migrate-templates.js +10 -4
  66. package/schematics/ng-update/steps/replace-deep-import.js +2 -1
  67. package/schematics/ng-update/steps/replace-enums.js +2 -1
  68. package/schematics/ng-update/steps/replace-functions.js +6 -2
  69. package/schematics/ng-update/steps/show-warnings.js +2 -1
  70. package/schematics/utils/angular/ng-module.js +2 -1
  71. package/schematics/utils/get-execution-time.d.ts +1 -0
  72. package/schematics/utils/get-execution-time.js +7 -0
  73. package/schematics/utils/get-named-import-references.js +2 -1
  74. package/schematics/utils/progress.d.ts +1 -0
  75. package/schematics/utils/progress.js +12 -0
  76. package/schematics/utils/templates/get-component-templates.js +1 -1
@@ -4,14 +4,19 @@ const ng_morph_1 = require("ng-morph");
4
4
  const get_named_import_references_1 = require("../../utils/get-named-import-references");
5
5
  const insert_todo_1 = require("../../utils/insert-todo");
6
6
  const colored_log_1 = require("../../utils/colored-log");
7
+ const get_execution_time_1 = require("../../utils/get-execution-time");
7
8
  function dateTimeMigrations() {
8
9
  colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating taiga date/time...`);
10
+ let start = performance.now();
9
11
  migrateProperty({
10
12
  namedImport: 'TuiDay',
11
13
  moduleSpecifier: '@taiga-ui/cdk',
12
14
  from: 'formattedDay',
13
15
  callback: node => node.replaceWithText(node.getText().replace('formattedDay', 'getFormattedDay("DMY", ".")')),
14
16
  });
17
+ colored_log_1.processLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}TuiDay.formattedDay ` +
18
+ `(${get_execution_time_1.getExecutionTime(start, performance.now())})`);
19
+ start = performance.now();
15
20
  migrateProperty({
16
21
  namedImport: 'TuiDayRange',
17
22
  moduleSpecifier: '@taiga-ui/cdk',
@@ -20,6 +25,9 @@ function dateTimeMigrations() {
20
25
  .getText()
21
26
  .replace('formattedDayRange', 'getFormattedDayRange("DMY", ".")')),
22
27
  });
28
+ colored_log_1.processLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}TuiDayRange.formattedDayRange ` +
29
+ `(${get_execution_time_1.getExecutionTime(start, performance.now())})`);
30
+ start = performance.now();
23
31
  migrateProperty({
24
32
  namedImport: 'TuiDayRange',
25
33
  moduleSpecifier: '@taiga-ui/cdk',
@@ -31,6 +39,8 @@ function dateTimeMigrations() {
31
39
  }
32
40
  },
33
41
  });
42
+ colored_log_1.processLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}TuiDayRange.normalizeParse ` +
43
+ `(${get_execution_time_1.getExecutionTime(start, performance.now())})`);
34
44
  [
35
45
  {
36
46
  namedImport: 'TuiMonthRange',
@@ -68,12 +78,15 @@ function dateTimeMigrations() {
68
78
  message: 'weeksRowsCount has been removed in 3.0. If you need this utils check out this pipe https://github.com/Tinkoff/taiga-ui/tree/main/projects/core/pipes/calendar-sheet',
69
79
  },
70
80
  ].forEach(({ namedImport, field, message }) => {
81
+ start = performance.now();
71
82
  migrateProperty({
72
83
  namedImport,
73
84
  moduleSpecifier: '@taiga-ui/cdk',
74
85
  from: field,
75
86
  callback: node => insertTodoBeforeNode(node, message),
76
87
  });
88
+ colored_log_1.processLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}${namedImport}.${field} ` +
89
+ `(${get_execution_time_1.getExecutionTime(start, performance.now())})`);
77
90
  });
78
91
  colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} date/time migrated \n`);
79
92
  }
@@ -117,12 +130,39 @@ function replaceIdentifier(node, from, callback) {
117
130
  }
118
131
  }
119
132
  function replaceIdentifierReferences(identifier, from, callback) {
120
- identifier.findReferencesAsNodes().forEach(ref => {
133
+ identifier
134
+ .findReferencesAsNodes()
135
+ /**
136
+ * `findReferencesAsNodes` has strange behavior.
137
+ * Imagine schematics run on the following file:
138
+ * ```
139
+ * class Dummy {
140
+ * var = 5;
141
+ * method1() {
142
+ * const {var} = this; // (1)
143
+ * return var; // (2)
144
+ * }
145
+ * method2() {
146
+ * const {var} = this; // (3)
147
+ * }
148
+ * }
149
+ * ```
150
+ * If `identifier` is equal to `var` from `method1` (1),
151
+ * then `identifier.findReferencesAsNodes` will return array with 2 references: (2) and (3).
152
+ */
153
+ .filter(ref => !areBothObjectDestructuring(ref, identifier))
154
+ .forEach(ref => {
155
+ if (ref.wasForgotten()) {
156
+ return;
157
+ }
121
158
  let parent = ref.getParent();
122
159
  if ((parent === null || parent === void 0 ? void 0 : parent.getText()) === `this.${identifier.getText()}` ||
123
160
  (parent === null || parent === void 0 ? void 0 : parent.getText()) === identifier.getText()) {
124
161
  replaceIdentifier(parent, from, callback);
125
162
  }
163
+ if (parent === null || parent === void 0 ? void 0 : parent.wasForgotten()) {
164
+ return;
165
+ }
126
166
  if (parent === null || parent === void 0 ? void 0 : parent.getText().startsWith('this')) {
127
167
  parent = parent === null || parent === void 0 ? void 0 : parent.getParent();
128
168
  }
@@ -153,3 +193,7 @@ function insertTodoBeforeNode(node, message) {
153
193
  insert_todo_1.insertTodo(identifier, message);
154
194
  }
155
195
  }
196
+ function areBothObjectDestructuring(ref, identifier) {
197
+ return Boolean(identifier.getFirstAncestorByKind(ng_morph_1.SyntaxKind.BindingElement) &&
198
+ ref.getFirstAncestorByKind(ng_morph_1.SyntaxKind.BindingElement));
199
+ }
@@ -5,11 +5,12 @@ const get_component_templates_1 = require("../../utils/templates/get-component-t
5
5
  const elements_1 = require("../../utils/templates/elements");
6
6
  const template_resource_1 = require("../../utils/templates/template-resource");
7
7
  const colored_log_1 = require("../../utils/colored-log");
8
+ const constants_1 = require("../../constants");
8
9
  exports.DEPRECATED_PROGRESS_PIPES_REG = /\s*\|\s*tuiProgressColorSegments(Async\s*\|\s*async)?/gi;
9
10
  const PROPERTY_FOR_DEPRECATED_PIPES = '[color]';
10
11
  function migrateProgress(fileSystem) {
11
12
  colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating progress bars...`);
12
- const templateResources = get_component_templates_1.getComponentTemplates('**/**.ts');
13
+ const templateResources = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
13
14
  for (const templateResource of templateResources) {
14
15
  replaceProgressColorSegmentsPipe(templateResource, fileSystem);
15
16
  }
@@ -5,7 +5,9 @@ const migrate_input_range_1 = require("./migrate-input-range");
5
5
  const colored_log_1 = require("../../../utils/colored-log");
6
6
  function migrateSliders(fileSystem) {
7
7
  colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating sliders...`);
8
+ colored_log_1.processLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}InputSlider...`);
8
9
  migrate_input_slider_1.migrateInputSlider(fileSystem);
10
+ colored_log_1.processLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}InputRange...`);
9
11
  migrate_input_range_1.migrateInputRange(fileSystem);
10
12
  colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} sliders migrated \n`);
11
13
  }
@@ -5,10 +5,11 @@ const ng_component_input_manipulations_1 = require("../../../utils/templates/ng-
5
5
  const ng_morph_1 = require("ng-morph");
6
6
  const ng_component_1 = require("../../../utils/angular/ng-component");
7
7
  const add_unique_import_1 = require("../../../utils/add-unique-import");
8
+ const constants_1 = require("../../../constants");
8
9
  const MIN_LABELS_MIGRATION_METHOD_NAME = 'tuiMigrationInputRangeMinLabel';
9
10
  const MAX_LABELS_MIGRATION_METHOD_NAME = 'tuiMigrationInputRangeMaxLabel';
10
11
  function migrateInputRange(fileSystem) {
11
- const templateResources = get_component_templates_1.getComponentTemplates('**/**.ts');
12
+ const templateResources = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
12
13
  const COMPONENTS_WITH_MIN_LABELS = new Set();
13
14
  const COMPONENTS_WITH_MAX_LABELS = new Set();
14
15
  for (const templateResource of templateResources) {
@@ -16,7 +17,7 @@ function migrateInputRange(fileSystem) {
16
17
  replaceMaxLabel(templateResource, fileSystem, COMPONENTS_WITH_MAX_LABELS);
17
18
  }
18
19
  save(fileSystem);
19
- for (const componentPath of COMPONENTS_WITH_MIN_LABELS) {
20
+ for (const componentPath of Array.from(COMPONENTS_WITH_MIN_LABELS)) {
20
21
  addMinMaxLabelMethod(componentPath, MIN_LABELS_MIGRATION_METHOD_NAME, [
21
22
  'const currentValue = context.$implicit;',
22
23
  'const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input-range',
@@ -25,7 +26,7 @@ function migrateInputRange(fileSystem) {
25
26
  'return String(currentValue);',
26
27
  ]);
27
28
  }
28
- for (const componentPath of COMPONENTS_WITH_MAX_LABELS) {
29
+ for (const componentPath of Array.from(COMPONENTS_WITH_MAX_LABELS)) {
29
30
  addMinMaxLabelMethod(componentPath, MAX_LABELS_MIGRATION_METHOD_NAME, [
30
31
  'const currentValue = context.$implicit;',
31
32
  'const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input',
@@ -6,8 +6,9 @@ const ng_component_1 = require("../../../utils/angular/ng-component");
6
6
  const add_unique_import_1 = require("../../../utils/add-unique-import");
7
7
  const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
8
8
  const elements_1 = require("../../../utils/templates/elements");
9
+ const constants_1 = require("../../../constants");
9
10
  function migrateInputSlider(fileSystem) {
10
- const templateResources = get_component_templates_1.getComponentTemplates('**/**.ts');
11
+ const templateResources = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
11
12
  const COMPONENTS_WITH_MIN_MAX_LABELS = new Set();
12
13
  for (const templateResource of templateResources) {
13
14
  replaceMinMaxLabels(templateResource, fileSystem, COMPONENTS_WITH_MIN_MAX_LABELS);
@@ -19,7 +20,7 @@ function migrateInputSlider(fileSystem) {
19
20
  fileSystem.commitEdits();
20
21
  ng_morph_1.saveActiveProject();
21
22
  ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, '/', '**/**'));
22
- for (const componentPath of COMPONENTS_WITH_MIN_MAX_LABELS) {
23
+ for (const componentPath of Array.from(COMPONENTS_WITH_MIN_MAX_LABELS)) {
23
24
  addMinMaxLabelMethod(componentPath);
24
25
  }
25
26
  }
@@ -3,17 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const get_component_templates_1 = require("../../utils/templates/get-component-templates");
4
4
  const templates_1 = require("../constants/templates");
5
5
  const elements_1 = require("../../utils/templates/elements");
6
+ const ng_morph_1 = require("ng-morph");
6
7
  const ng_component_input_manipulations_1 = require("../../utils/templates/ng-component-input-manipulations");
7
8
  const template_resource_1 = require("../../utils/templates/template-resource");
8
- const ng_morph_1 = require("ng-morph");
9
9
  const ng_component_1 = require("../../utils/angular/ng-component");
10
10
  const add_unique_import_1 = require("../../utils/add-unique-import");
11
11
  const colored_log_1 = require("../../utils/colored-log");
12
+ const constants_1 = require("../../constants");
13
+ const progress_1 = require("../../utils/progress");
12
14
  const START_TAG_OFFSET = 1;
13
15
  const END_TAG_OFFSET = 2;
14
16
  function migrateTemplates(fileSystem) {
15
17
  colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating templates...`);
16
- const componentWithTemplatesPaths = get_component_templates_1.getComponentTemplates('**/**');
18
+ const componentWithTemplatesPaths = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
17
19
  const actions = [
18
20
  replaceTags,
19
21
  replaceAttrs,
@@ -25,10 +27,14 @@ function migrateTemplates(fileSystem) {
25
27
  migrateTuiHideSelectedPipe,
26
28
  removeInputs,
27
29
  ];
28
- componentWithTemplatesPaths.forEach(resource => {
30
+ componentWithTemplatesPaths.forEach((resource, templateIndex, templates) => {
29
31
  const path = fileSystem.resolve(template_resource_1.getPathFromTemplateResource(resource));
30
32
  const recorder = fileSystem.edit(path);
31
- actions.forEach(action => {
33
+ const isLastTemplate = templateIndex === templates.length - 1;
34
+ actions.forEach((action, actionIndex) => {
35
+ const isLastAction = actionIndex === actions.length - 1;
36
+ const progressLog = `${templateIndex + 1} / ${templates.length} (${action.name}...)`;
37
+ progress_1.printProgress(`${colored_log_1.SMALL_TAB_SYMBOL.repeat(2)}${progressLog}`, isLastTemplate && isLastAction);
32
38
  action({ resource, fileSystem, recorder });
33
39
  });
34
40
  });
@@ -2,10 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ng_morph_1 = require("ng-morph");
4
4
  const colored_log_1 = require("../../utils/colored-log");
5
+ const constants_1 = require("../../constants");
5
6
  const DEEP_REGEX = /(@taiga-ui\/\w+)\/.*/;
6
7
  function replaceDeepImports() {
7
8
  colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing deep imports...`);
8
- const deepImports = ng_morph_1.getImports('**/**.ts').filter(imp => DEEP_REGEX.test(imp.getModuleSpecifier().getLiteralValue()));
9
+ const deepImports = ng_morph_1.getImports(constants_1.ALL_TS_FILES).filter(imp => DEEP_REGEX.test(imp.getModuleSpecifier().getLiteralValue()));
9
10
  ng_morph_1.editImports(deepImports, deepImport => {
10
11
  const specifier = deepImport.moduleSpecifier.replace(DEEP_REGEX, '$1');
11
12
  return { moduleSpecifier: specifier };
@@ -12,6 +12,7 @@ function replaceEnums() {
12
12
  }
13
13
  exports.replaceEnums = replaceEnums;
14
14
  function replaceEnumWithString(enumName, replaceValues, keepAsType = true) {
15
+ var _a;
15
16
  const references = get_named_import_references_1.getNamedImportReferences(enumName);
16
17
  for (let ref of references) {
17
18
  const parent = ref.getParent();
@@ -21,7 +22,7 @@ function replaceEnumWithString(enumName, replaceValues, keepAsType = true) {
21
22
  }
22
23
  if (ng_morph_1.Node.isTypeReferenceNode(parent) && !keepAsType) {
23
24
  const declaration = parent.getParent();
24
- declaration.removeType();
25
+ (_a = declaration.removeType) === null || _a === void 0 ? void 0 : _a.call(declaration);
25
26
  continue;
26
27
  }
27
28
  if (!ng_morph_1.Node.isPropertyAccessExpression(parent)) {
@@ -20,7 +20,7 @@ function replaceDeprecatedFunction() {
20
20
  get_named_import_references_1.getNamedImportReferences(from, moduleSpecifier).forEach(ref => {
21
21
  const parent = ref.getParent();
22
22
  if (ng_morph_1.Node.isImportSpecifier(parent) || ng_morph_1.Node.isCallExpression(parent)) {
23
- parent === null || parent === void 0 ? void 0 : parent.replaceWithText(parent === null || parent === void 0 ? void 0 : parent.getFullText().trim().replace(from, to !== null && to !== void 0 ? to : from));
23
+ parent === null || parent === void 0 ? void 0 : parent.replaceWithText(parent === null || parent === void 0 ? void 0 : parent.getText({ includeJsDocComments: false }).trim().replace(from, to !== null && to !== void 0 ? to : from));
24
24
  }
25
25
  });
26
26
  });
@@ -46,7 +46,11 @@ function replaceClosestElement(references) {
46
46
  }
47
47
  else if (ng_morph_1.Node.isCallExpression(parent)) {
48
48
  const [firstArg, secondArg] = parent.getArguments();
49
- parent.replaceWithText(`${firstArg.getText()}.closest(${secondArg.getText()})`);
49
+ const firstArgText = firstArg.getText();
50
+ const element = firstArgText.includes(' as ') // e.g, `getClosestElement(el as Element, ...)`
51
+ ? `(${firstArgText})`
52
+ : firstArgText;
53
+ parent.replaceWithText(`${element}.closest(${secondArg.getText()})`);
50
54
  }
51
55
  });
52
56
  }
@@ -2,12 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ng_morph_1 = require("ng-morph");
4
4
  const warnings_1 = require("../constants/warnings");
5
+ const constants_1 = require("../../constants");
5
6
  function showWarnings(context) {
6
7
  warnings_1.MIGRATION_WARNINGS.forEach(warning => showWarning(warning, context));
7
8
  }
8
9
  exports.showWarnings = showWarnings;
9
10
  function showWarning({ name, message, moduleSpecifier = '**/**' }, { logger }) {
10
- const references = ng_morph_1.getImports('**/**', {
11
+ const references = ng_morph_1.getImports(constants_1.ALL_TS_FILES, {
11
12
  moduleSpecifier,
12
13
  namedImports: [name],
13
14
  })
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ng_morph_1 = require("ng-morph");
4
+ const constants_1 = require("../../constants");
4
5
  function getNgModules(pattern, query) {
5
6
  return ng_morph_1.getClasses(pattern, query).filter(declaration => !!declaration.getDecorator('NgModule'));
6
7
  }
@@ -9,7 +10,7 @@ exports.getNgModules = getNgModules;
9
10
  * Find NgModule where the component was declared.
10
11
  */
11
12
  function findNgModule(ngComponent) {
12
- const allNgModules = getNgModules('**/**.ts');
13
+ const allNgModules = getNgModules(constants_1.ALL_TS_FILES);
13
14
  return (allNgModules.find(module => {
14
15
  const moduleFile = module.getSourceFile();
15
16
  const imports = ng_morph_1.getImports(moduleFile.getFilePath(), {
@@ -0,0 +1 @@
1
+ export declare function getExecutionTime(t0: number, t1: number): string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function getExecutionTime(t0, t1) {
4
+ const sum = t1 - t0;
5
+ return sum > 1000 ? `${(sum / 1000).toFixed(2)} sec` : `${sum.toFixed(2)} ms`;
6
+ }
7
+ exports.getExecutionTime = getExecutionTime;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ng_morph_1 = require("ng-morph");
4
+ const constants_1 = require("../constants");
4
5
  function getNamedImportReferences(namedImport, moduleSpecifier = '**/**') {
5
- const importDeclarations = ng_morph_1.getImports('**/**', {
6
+ const importDeclarations = ng_morph_1.getImports(constants_1.ALL_TS_FILES, {
6
7
  namedImports: [namedImport],
7
8
  moduleSpecifier: moduleSpecifier,
8
9
  });
@@ -0,0 +1 @@
1
+ export declare function printProgress(progressLog: string, isLastLog?: boolean): void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const readline_1 = require("readline");
4
+ function printProgress(progressLog, isLastLog = false) {
5
+ readline_1.clearLine(process.stdout, 0);
6
+ readline_1.cursorTo(process.stdout, 0);
7
+ process.stdout.write(progressLog);
8
+ if (isLastLog) {
9
+ process.stdout.write('\n');
10
+ }
11
+ }
12
+ exports.printProgress = printProgress;
@@ -17,7 +17,7 @@ function decoratorToTemplateResource(decorator) {
17
17
  const template = metadata.getProperty('template');
18
18
  const componentPath = decorator.getSourceFile().getFilePath();
19
19
  if (templateUrl) {
20
- const templatePath = path.parse(((_a = templateUrl === null || templateUrl === void 0 ? void 0 : templateUrl.getInitializer()) === null || _a === void 0 ? void 0 : _a.getText().replace(/['"]/g, '')) || '');
20
+ const templatePath = path.parse(((_a = templateUrl === null || templateUrl === void 0 ? void 0 : templateUrl.getInitializer()) === null || _a === void 0 ? void 0 : _a.getText().replace(/['"`]/g, '')) || '');
21
21
  return {
22
22
  componentPath,
23
23
  templatePath: getFullTemplatePath(templatePath, path.parse(componentPath)),