@skyux/packages 7.0.0-beta.11 → 7.0.0-beta.13

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyux/packages",
3
- "version": "7.0.0-beta.11",
3
+ "version": "7.0.0-beta.13",
4
4
  "author": "Blackbaud, Inc.",
5
5
  "description": "Handles the `ng update` command for SKY UX component libraries.",
6
6
  "keywords": [
@@ -27,57 +27,57 @@
27
27
  "@blackbaud/skyux-lib-code-block": "^7.0.0-beta.0",
28
28
  "@blackbaud/skyux-lib-media": "^7.0.0-beta.0",
29
29
  "@blackbaud/skyux-lib-stache": "^7.0.0-beta.0",
30
- "@skyux-sdk/prettier-schematics": "7.0.0-beta.11",
31
- "@skyux-sdk/testing": "7.0.0-beta.11",
32
- "@skyux/a11y": "7.0.0-beta.11",
33
- "@skyux/action-bars": "7.0.0-beta.11",
34
- "@skyux/ag-grid": "7.0.0-beta.11",
35
- "@skyux/angular-tree-component": "7.0.0-beta.11",
36
- "@skyux/animations": "7.0.0-beta.11",
37
- "@skyux/assets": "7.0.0-beta.11",
38
- "@skyux/autonumeric": "7.0.0-beta.11",
39
- "@skyux/avatar": "7.0.0-beta.11",
40
- "@skyux/colorpicker": "7.0.0-beta.11",
41
- "@skyux/config": "7.0.0-beta.11",
42
- "@skyux/core": "7.0.0-beta.11",
43
- "@skyux/data-manager": "7.0.0-beta.11",
44
- "@skyux/datetime": "7.0.0-beta.11",
30
+ "@skyux-sdk/prettier-schematics": "7.0.0-beta.13",
31
+ "@skyux-sdk/testing": "7.0.0-beta.13",
32
+ "@skyux/a11y": "7.0.0-beta.13",
33
+ "@skyux/action-bars": "7.0.0-beta.13",
34
+ "@skyux/ag-grid": "7.0.0-beta.13",
35
+ "@skyux/angular-tree-component": "7.0.0-beta.13",
36
+ "@skyux/animations": "7.0.0-beta.13",
37
+ "@skyux/assets": "7.0.0-beta.13",
38
+ "@skyux/autonumeric": "7.0.0-beta.13",
39
+ "@skyux/avatar": "7.0.0-beta.13",
40
+ "@skyux/colorpicker": "7.0.0-beta.13",
41
+ "@skyux/config": "7.0.0-beta.13",
42
+ "@skyux/core": "7.0.0-beta.13",
43
+ "@skyux/data-manager": "7.0.0-beta.13",
44
+ "@skyux/datetime": "7.0.0-beta.13",
45
45
  "@skyux/docs-tools": "^7.0.0-beta.0",
46
- "@skyux/errors": "7.0.0-beta.11",
47
- "@skyux/flyout": "7.0.0-beta.11",
48
- "@skyux/forms": "7.0.0-beta.11",
49
- "@skyux/grids": "7.0.0-beta.11",
50
- "@skyux/http": "7.0.0-beta.11",
51
- "@skyux/i18n": "7.0.0-beta.11",
46
+ "@skyux/errors": "7.0.0-beta.13",
47
+ "@skyux/flyout": "7.0.0-beta.13",
48
+ "@skyux/forms": "7.0.0-beta.13",
49
+ "@skyux/grids": "7.0.0-beta.13",
50
+ "@skyux/http": "7.0.0-beta.13",
51
+ "@skyux/i18n": "7.0.0-beta.13",
52
52
  "@skyux/icons": "^5.1.1",
53
- "@skyux/indicators": "7.0.0-beta.11",
54
- "@skyux/inline-form": "7.0.0-beta.11",
55
- "@skyux/layout": "7.0.0-beta.11",
56
- "@skyux/list-builder": "7.0.0-beta.11",
57
- "@skyux/list-builder-common": "7.0.0-beta.11",
58
- "@skyux/list-builder-view-checklist": "7.0.0-beta.11",
59
- "@skyux/list-builder-view-grids": "7.0.0-beta.11",
60
- "@skyux/lists": "7.0.0-beta.11",
61
- "@skyux/lookup": "7.0.0-beta.11",
62
- "@skyux/modals": "7.0.0-beta.11",
63
- "@skyux/navbar": "7.0.0-beta.11",
64
- "@skyux/omnibar-interop": "7.0.0-beta.11",
65
- "@skyux/pages": "7.0.0-beta.11",
66
- "@skyux/phone-field": "7.0.0-beta.11",
67
- "@skyux/popovers": "7.0.0-beta.11",
68
- "@skyux/progress-indicator": "7.0.0-beta.11",
69
- "@skyux/router": "7.0.0-beta.11",
70
- "@skyux/select-field": "7.0.0-beta.11",
71
- "@skyux/split-view": "7.0.0-beta.11",
72
- "@skyux/tabs": "7.0.0-beta.11",
73
- "@skyux/text-editor": "7.0.0-beta.11",
74
- "@skyux/theme": "7.0.0-beta.11",
75
- "@skyux/tiles": "7.0.0-beta.11",
76
- "@skyux/toast": "7.0.0-beta.11",
77
- "@skyux/validation": "7.0.0-beta.11",
78
- "ag-grid-angular": "^27.2.0",
79
- "ag-grid-community": "^27.2.0",
80
- "ag-grid-enterprise": "^27.2.0"
53
+ "@skyux/indicators": "7.0.0-beta.13",
54
+ "@skyux/inline-form": "7.0.0-beta.13",
55
+ "@skyux/layout": "7.0.0-beta.13",
56
+ "@skyux/list-builder": "7.0.0-beta.13",
57
+ "@skyux/list-builder-common": "7.0.0-beta.13",
58
+ "@skyux/list-builder-view-checklist": "7.0.0-beta.13",
59
+ "@skyux/list-builder-view-grids": "7.0.0-beta.13",
60
+ "@skyux/lists": "7.0.0-beta.13",
61
+ "@skyux/lookup": "7.0.0-beta.13",
62
+ "@skyux/modals": "7.0.0-beta.13",
63
+ "@skyux/navbar": "7.0.0-beta.13",
64
+ "@skyux/omnibar-interop": "7.0.0-beta.13",
65
+ "@skyux/pages": "7.0.0-beta.13",
66
+ "@skyux/phone-field": "7.0.0-beta.13",
67
+ "@skyux/popovers": "7.0.0-beta.13",
68
+ "@skyux/progress-indicator": "7.0.0-beta.13",
69
+ "@skyux/router": "7.0.0-beta.13",
70
+ "@skyux/select-field": "7.0.0-beta.13",
71
+ "@skyux/split-view": "7.0.0-beta.13",
72
+ "@skyux/tabs": "7.0.0-beta.13",
73
+ "@skyux/text-editor": "7.0.0-beta.13",
74
+ "@skyux/theme": "7.0.0-beta.13",
75
+ "@skyux/tiles": "7.0.0-beta.13",
76
+ "@skyux/toast": "7.0.0-beta.13",
77
+ "@skyux/validation": "7.0.0-beta.13",
78
+ "ag-grid-angular": "^28.2.1",
79
+ "ag-grid-community": "^28.2.1",
80
+ "ag-grid-enterprise": "^28.2.1"
81
81
  }
82
82
  },
83
83
  "peerDependencies": {
@@ -1,10 +1,15 @@
1
1
  {
2
2
  "schematics": {
3
3
  "noop": {
4
- "version": "7.0.0-beta.11",
4
+ "version": "7.0.0-beta.13",
5
5
  "factory": "./noop/noop.schematic",
6
6
  "description": "Update all SKY UX component packages"
7
7
  },
8
+ "ag-grid-28": {
9
+ "version": "7.0.0-beta.0",
10
+ "factory": "./update-7/ag-grid-28.schematic",
11
+ "description": "Update ag-grid to version 28"
12
+ },
8
13
  "add-autonumeric-dependency": {
9
14
  "version": "7.0.0-beta.0",
10
15
  "factory": "./update-7/add-autonumeric-dependency",
@@ -34,6 +39,11 @@
34
39
  "version": "7.0.0-beta.0",
35
40
  "factory": "./update-7/fix-scss-imports",
36
41
  "description": "Fix SCSS imports"
42
+ },
43
+ "fix-mixed-case-imports": {
44
+ "version": "7.0.0-beta.0",
45
+ "factory": "./update-7/fix-mixed-case-imports",
46
+ "description": "Fix import statements where the file case does not match the filesystem"
37
47
  }
38
48
  }
39
49
  }
@@ -0,0 +1,12 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export declare const UPDATE_TO_VERSION = "28.2.1";
3
+ /**
4
+ * Upgrade to AG Grid 28 and address three breaking changes:
5
+ *
6
+ * - No longer support `@ag-grid-community/all-modules` -- just use the package
7
+ * - Remove `AgGridModule.withComponents` in module import
8
+ * - Column API renamed getSecondaryColumns / setSecondaryColumns
9
+ *
10
+ * Also advise against mixing modules and packages.
11
+ */
12
+ export default function (): Rule;
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UPDATE_TO_VERSION = void 0;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
6
+ const dependencies_1 = require("@schematics/angular/utility/dependencies");
7
+ const workspace_1 = require("../../utility/workspace");
8
+ exports.UPDATE_TO_VERSION = '28.2.1';
9
+ const ANY_MODULE = '@ag-grid-community/';
10
+ const ENT_MODULE = '@ag-grid-enterprise/';
11
+ const AG_GRID = 'ag-grid-community';
12
+ const AG_GRID_ENT = 'ag-grid-enterprise';
13
+ const withComponents = 'AgGridModule.withComponents';
14
+ const forRoot = 'AgGridModule.withComponents';
15
+ /**
16
+ * Check package.json for AG Grid dependencies.
17
+ */
18
+ function readDependencies(tree) {
19
+ const agGridAllModules = (0, dependencies_1.getPackageJsonDependency)(tree, `${ANY_MODULE}all-modules`);
20
+ const agGridDependency = (0, dependencies_1.getPackageJsonDependency)(tree, AG_GRID);
21
+ const agGridAllModulesEnt = (0, dependencies_1.getPackageJsonDependency)(tree, `${ENT_MODULE}all-modules`);
22
+ const agGridDependencyEnt = (0, dependencies_1.getPackageJsonDependency)(tree, AG_GRID_ENT);
23
+ return {
24
+ agGridAllModules,
25
+ agGridDependency,
26
+ agGridAllModulesEnt,
27
+ agGridDependencyEnt,
28
+ };
29
+ }
30
+ /**
31
+ * Remove `@ag-grid-community/all-modules` and `@ag-grid-enterprise/all-modules` from package.json.
32
+ */
33
+ function swapModulesWithPackageDependencies() {
34
+ return (tree, context) => {
35
+ const { agGridAllModules, agGridDependency, agGridAllModulesEnt, agGridDependencyEnt, } = readDependencies(tree);
36
+ // AG Grid is not installed, so we don't need to do anything.
37
+ if (!agGridAllModules &&
38
+ !agGridDependency &&
39
+ !agGridAllModulesEnt &&
40
+ !agGridDependencyEnt) {
41
+ return;
42
+ }
43
+ let type = dependencies_1.NodeDependencyType.Default;
44
+ const overwrite = true;
45
+ const version = exports.UPDATE_TO_VERSION;
46
+ // Determine if there are any community packages that need to be updated.
47
+ if (!agGridDependency && agGridAllModules) {
48
+ type = agGridAllModules.type;
49
+ [AG_GRID, 'ag-grid-angular'].forEach((name) => {
50
+ (0, dependencies_1.addPackageJsonDependency)(tree, { name, overwrite, type, version });
51
+ });
52
+ }
53
+ if (agGridAllModules) {
54
+ (0, dependencies_1.removePackageJsonDependency)(tree, `${ANY_MODULE}all-modules`);
55
+ (0, dependencies_1.removePackageJsonDependency)(tree, `${ANY_MODULE}angular`);
56
+ }
57
+ // Determine if there are any enterprise packages that need to be updated.
58
+ if (!agGridDependencyEnt && agGridAllModulesEnt) {
59
+ type = agGridAllModulesEnt.type;
60
+ (0, dependencies_1.addPackageJsonDependency)(tree, {
61
+ name: AG_GRID_ENT,
62
+ overwrite,
63
+ type,
64
+ version,
65
+ });
66
+ }
67
+ if (agGridAllModulesEnt) {
68
+ (0, dependencies_1.removePackageJsonDependency)(tree, `${ENT_MODULE}all-modules`);
69
+ }
70
+ // Install the new packages.
71
+ if (agGridAllModules || agGridAllModulesEnt) {
72
+ context.addTask(new tasks_1.NodePackageInstallTask());
73
+ }
74
+ };
75
+ }
76
+ /**
77
+ * Replace `@ag-grid-community/all-modules` with `ag-grid-community`/`ag-grid-angular`,
78
+ * and replace `@ag-grid-enterprise/all-modules` with `ag-grid-enterprise`.
79
+ */
80
+ function swapModulesWithPackageInCode(updatedContent, agGridAllModules, agGridAllModulesEnt) {
81
+ // Replace `@ag-grid-community/all-modules` with `ag-grid-community`
82
+ if (agGridAllModules && updatedContent.includes(`${ANY_MODULE}all-modules`)) {
83
+ updatedContent = updatedContent.replace(/@ag-grid-community\/all-modules/g, AG_GRID);
84
+ }
85
+ // Replace `@ag-grid-enterprise/all-modules` with `ag-grid-enterprise`
86
+ if (agGridAllModulesEnt &&
87
+ updatedContent.includes(`${ENT_MODULE}all-modules`)) {
88
+ updatedContent = updatedContent.replace(/@ag-grid-enterprise\/all-modules/g, AG_GRID_ENT);
89
+ }
90
+ // Replace `@ag-grid-community/angular` with `ag-grid-angular`
91
+ if (agGridAllModules && updatedContent.includes(`${ANY_MODULE}angular`)) {
92
+ updatedContent = updatedContent.replace(/@ag-grid-community\/angular/g, 'ag-grid-angular');
93
+ }
94
+ return updatedContent;
95
+ }
96
+ /**
97
+ * Remove `AgGridModule.withComponents` and `AgGridModule.forRoot` in module imports.
98
+ */
99
+ function removeWithComponentsStaticImportsCall(filePath, updatedContent) {
100
+ [withComponents, forRoot].forEach((staticModule) => {
101
+ if ((filePath.endsWith('module.ts') || filePath.endsWith('spec.ts')) &&
102
+ updatedContent.includes(staticModule)) {
103
+ let pos;
104
+ while ((pos = updatedContent.indexOf(staticModule)) !== -1) {
105
+ // Find closing parenthesis after `AgGridModule.withComponents`
106
+ const end = updatedContent.indexOf(')', pos);
107
+ // Leave `AgGridModule`, drop `.withComponents` and `.forRoot`.
108
+ updatedContent = [
109
+ updatedContent.substring(0, pos + 12),
110
+ updatedContent.substring(end + 1),
111
+ ].join('');
112
+ }
113
+ }
114
+ });
115
+ return updatedContent;
116
+ }
117
+ /**
118
+ * Column API renamed getSecondaryColumns / setSecondaryColumns to getSecondaryPivotColumns / setSecondaryPivotColumns.
119
+ */
120
+ function renameColumnApiFunctionsInCode(updatedContent) {
121
+ if (updatedContent.includes(AG_GRID) &&
122
+ updatedContent.includes('etSecondaryColumns(')) {
123
+ updatedContent = updatedContent.replace(/(?<=columnApi\s*)\.(get|set)SecondaryColumns\(/g, (_, x) => `.${x}PivotResultColumns(`);
124
+ }
125
+ return updatedContent;
126
+ }
127
+ /**
128
+ * Grid option renamed suppressCellSelection to suppressCellFocus.
129
+ */
130
+ function renameSuppressCellSelectionGridOptionInCode(updatedContent) {
131
+ if (updatedContent.includes(AG_GRID) &&
132
+ updatedContent.match(/gridOptions/i) &&
133
+ updatedContent.includes('suppressCellSelection')) {
134
+ updatedContent = updatedContent.replace(/\bsuppressCellSelection\b/g, 'suppressCellFocus');
135
+ }
136
+ return updatedContent;
137
+ }
138
+ /**
139
+ * Visit all files and apply the changes.
140
+ */
141
+ function updateSourceFiles() {
142
+ return async (tree, context) => {
143
+ const warned = [];
144
+ function warnOnce(message) {
145
+ if (!warned.includes(message)) {
146
+ warned.push(message);
147
+ context.logger.warn(message);
148
+ }
149
+ }
150
+ const { agGridAllModules, agGridDependency, agGridAllModulesEnt, agGridDependencyEnt, } = readDependencies(tree);
151
+ // AG Grid is not installed, so we don't need to do anything.
152
+ if (!agGridAllModules &&
153
+ !agGridDependency &&
154
+ !agGridAllModulesEnt &&
155
+ !agGridDependencyEnt) {
156
+ return;
157
+ }
158
+ const { workspace } = await (0, workspace_1.getWorkspace)(tree);
159
+ workspace.projects.forEach((project) => {
160
+ tree
161
+ .getDir(project.sourceRoot || project.root)
162
+ .visit((filePath) => {
163
+ // If the file is not a TypeScript file, we can skip it.
164
+ if (!filePath.endsWith('.ts')) {
165
+ return;
166
+ }
167
+ const content = tree.readText(filePath);
168
+ let updatedContent = content;
169
+ // Prompt the user to moderate the use of AG Grid modules
170
+ if (updatedContent.includes(ANY_MODULE) ||
171
+ updatedContent.includes(ENT_MODULE)) {
172
+ warnOnce(`\n
173
+ AG Grid recommends not mixing module and package imports.
174
+ https://ag-grid.com/angular-data-grid/modules/\n\n`);
175
+ }
176
+ updatedContent = swapModulesWithPackageInCode(updatedContent, agGridAllModules, agGridAllModulesEnt);
177
+ updatedContent = removeWithComponentsStaticImportsCall(filePath, updatedContent);
178
+ updatedContent = renameColumnApiFunctionsInCode(updatedContent);
179
+ updatedContent =
180
+ renameSuppressCellSelectionGridOptionInCode(updatedContent);
181
+ if (updatedContent !== content) {
182
+ tree.overwrite(filePath, updatedContent);
183
+ }
184
+ });
185
+ });
186
+ };
187
+ }
188
+ /**
189
+ * Upgrade to AG Grid 28 and address three breaking changes:
190
+ *
191
+ * - No longer support `@ag-grid-community/all-modules` -- just use the package
192
+ * - Remove `AgGridModule.withComponents` in module import
193
+ * - Column API renamed getSecondaryColumns / setSecondaryColumns
194
+ *
195
+ * Also advise against mixing modules and packages.
196
+ */
197
+ function default_1() {
198
+ return (0, schematics_1.chain)([updateSourceFiles(), swapModulesWithPackageDependencies()]);
199
+ }
200
+ exports.default = default_1;
201
+ //# sourceMappingURL=ag-grid-28.schematic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ag-grid-28.schematic.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/migrations/update-7/ag-grid-28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@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const core_1 = require("@angular-devkit/core");
5
+ const ts = tslib_1.__importStar(require("@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript"));
6
+ const path = tslib_1.__importStar(require("path"));
7
+ const workspace_1 = require("../../utility/workspace");
8
+ function updateTypescriptImports(filePath, tree, context) {
9
+ const fileContent = tree.read(filePath)?.toString();
10
+ if (!fileContent) {
11
+ return;
12
+ }
13
+ context.logger.debug(`Checking imports in ${filePath}...`);
14
+ const source = ts.createSourceFile(filePath, fileContent, ts.ScriptTarget.Latest, true);
15
+ // Get all import declarations
16
+ const importDeclarations = source.statements.filter((statement) => statement.kind === ts.SyntaxKind.ImportDeclaration);
17
+ // Just local import targets
18
+ const localImportDeclarations = importDeclarations.filter((importDeclaration) => {
19
+ const importPath = importDeclaration.moduleSpecifier.getText(source);
20
+ const importPathWithoutQuotes = importPath.substring(1, importPath.length - 1);
21
+ return importPathWithoutQuotes.startsWith('.');
22
+ });
23
+ const transformers = [];
24
+ localImportDeclarations.forEach((importDeclaration) => {
25
+ const importPath = importDeclaration.moduleSpecifier.getText(source);
26
+ const importPathWithoutQuotes = importPath.substring(1, importPath.length - 1);
27
+ const absoluteImportPath = path.join(path.dirname(filePath), `${importPathWithoutQuotes}.ts`.replace(/\\/g, '/'));
28
+ const pathFragments = (0, core_1.split)(absoluteImportPath).slice(1);
29
+ const newPath = [];
30
+ let dir = tree.root;
31
+ // Walk the path fragments and check if the case is correct. This approach works on both case-sensitive and case-insensitive file systems.
32
+ for (const pathFragment of pathFragments) {
33
+ if (pathFragment.endsWith('.ts')) {
34
+ if (dir.subfiles.includes(pathFragment)) {
35
+ // File exists. We're done.
36
+ newPath.push(pathFragment.replace(/\.ts$/, ''));
37
+ break;
38
+ }
39
+ // File does not exist. Try to find a file with the same name but different casing.
40
+ const matchingFile = dir.subfiles.find((subFile) => subFile.toLowerCase().includes(pathFragment.toLowerCase()));
41
+ if (matchingFile) {
42
+ // Found a matching file. Use it.
43
+ newPath.push(matchingFile.replace(/\.ts$/, ''));
44
+ break;
45
+ }
46
+ }
47
+ else {
48
+ if (dir.subdirs.includes(pathFragment)) {
49
+ // Sub dir exists. Continue.
50
+ dir = dir.dir(pathFragment);
51
+ newPath.push(pathFragment);
52
+ continue;
53
+ }
54
+ // Dir does not exist. Try to find a dir with the same name but different casing.
55
+ const matchingDir = dir.subdirs.find((subdir) => subdir.toLowerCase().includes(pathFragment.toLowerCase()));
56
+ if (matchingDir) {
57
+ // Found a matching dir. Use it.
58
+ dir = dir.dir(matchingDir);
59
+ newPath.push(matchingDir);
60
+ continue;
61
+ }
62
+ }
63
+ // Nothing found. Can't fix this.
64
+ return;
65
+ }
66
+ const newImportPathAbsolute = (0, core_1.join)(tree.root.path, ...newPath);
67
+ let newImportPathRelative = path.relative((0, core_1.dirname)(filePath), newImportPathAbsolute);
68
+ if (!newImportPathRelative.startsWith('.')) {
69
+ newImportPathRelative = `./${newImportPathRelative}`;
70
+ }
71
+ if (newImportPathRelative !== importPathWithoutQuotes) {
72
+ context.logger.debug(`Updating ${filePath} :: ${importPathWithoutQuotes} -> ${newImportPathRelative}`);
73
+ transformers.push({
74
+ find: importPathWithoutQuotes,
75
+ replace: newImportPathRelative,
76
+ });
77
+ }
78
+ });
79
+ if (transformers.length > 0) {
80
+ let newContent = fileContent;
81
+ transformers.forEach((transformer) => {
82
+ newContent = newContent.replace(transformer.find, transformer.replace);
83
+ });
84
+ tree.overwrite(filePath, newContent);
85
+ }
86
+ }
87
+ async function visitTypescriptFiles(tree, context) {
88
+ const { workspace } = await (0, workspace_1.getWorkspace)(tree);
89
+ workspace.projects.forEach((project, projectName) => {
90
+ context.logger.debug(`Looking for typescript files in project ${projectName}...`);
91
+ tree.getDir(project.root).visit((filePath) => {
92
+ if (filePath.endsWith('.ts')) {
93
+ updateTypescriptImports(filePath, tree, context);
94
+ }
95
+ });
96
+ });
97
+ }
98
+ function default_1() {
99
+ return async (tree, context) => {
100
+ await visitTypescriptFiles(tree, context);
101
+ };
102
+ }
103
+ exports.default = default_1;
104
+ //# sourceMappingURL=fix-mixed-case-imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-mixed-case-imports.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/migrations/update-7/fix-mixed-case-imports.ts"],"names":[],"mappings":";;;AAAA,+CAAkE;AAElE,2HAAqG;AAErG,mDAA6B;AAE7B,uDAAuD;AAEvD,SAAS,uBAAuB,CAC9B,QAAgB,EAChB,IAAU,EACV,OAAyB;IAEzB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IACpD,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO;KACR;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,QAAQ,KAAK,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAChC,QAAQ,EACR,WAAW,EACX,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;IACF,8BAA8B;IAC9B,MAAM,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CACjD,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,iBAAiB,CACxC,CAAC;IAC5B,4BAA4B;IAC5B,MAAM,uBAAuB,GAAG,kBAAkB,CAAC,MAAM,CACvD,CAAC,iBAAiB,EAAE,EAAE;QACpB,MAAM,UAAU,GAAG,iBAAiB,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACrE,MAAM,uBAAuB,GAAG,UAAU,CAAC,SAAS,CAClD,CAAC,EACD,UAAU,CAAC,MAAM,GAAG,CAAC,CACtB,CAAC;QACF,OAAO,uBAAuB,CAAC,UAAU,CAAC,GAAG,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