@skyux/packages 15.0.0-alpha.13 → 15.0.0-alpha.14
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/migrations.json +15 -10
- package/package.json +61 -61
- package/src/schematics/migrations/update-15/add-compat-stylesheets/add-compat-stylesheet.schematic.js +66 -0
- package/src/schematics/migrations/update-15/add-compat-stylesheets/add-compat-stylesheet.schematic.js.map +1 -1
- package/src/schematics/migrations/update-15/remove-select-field/remove-select-field.schematic.d.ts +7 -0
- package/src/schematics/migrations/update-15/remove-select-field/remove-select-field.schematic.js +98 -0
- package/src/schematics/migrations/update-15/remove-select-field/remove-select-field.schematic.js.map +1 -0
- package/src/schematics/rules/convert-grid-to-data-grid/convert-grid-to-data-grid.js +1 -1
- package/src/schematics/rules/convert-page-summary-to-page-header/convert-page-summary-to-page-header.js +1 -1
- package/src/schematics/rules/convert-progress-indicator-wizard-to-tab-wizard/convert-progress-indicator-wizard-to-tab-wizard.js +1 -1
- package/src/schematics/utility/typescript/ng-ast.d.ts +8 -0
- package/src/schematics/utility/typescript/ng-ast.js +34 -17
- package/src/schematics/utility/typescript/ng-ast.js.map +1 -1
- package/src/schematics/utility/typescript/remove-class-reference.d.ts +9 -8
- package/src/schematics/utility/typescript/remove-class-reference.js +32 -16
- package/src/schematics/utility/typescript/remove-class-reference.js.map +1 -1
- package/src/version.js +1 -1
package/migrations.json
CHANGED
|
@@ -1,54 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schematics": {
|
|
3
3
|
"noop": {
|
|
4
|
-
"version": "15.0.0-alpha.
|
|
4
|
+
"version": "15.0.0-alpha.14",
|
|
5
5
|
"factory": "./src/schematics/migrations/all/noop/noop.schematic",
|
|
6
6
|
"description": "Update all SKY UX component packages"
|
|
7
7
|
},
|
|
8
8
|
"i18n-resources-module": {
|
|
9
|
-
"version": "15.0.0-alpha.
|
|
9
|
+
"version": "15.0.0-alpha.14",
|
|
10
10
|
"factory": "./src/schematics/migrations/all/i18n-resources-module/i18n-resources-module.schematic",
|
|
11
11
|
"description": "Regenerate i18n resources modules for libraries."
|
|
12
12
|
},
|
|
13
13
|
"remove-old-compat-stylesheets": {
|
|
14
|
-
"version": "15.0.0-alpha.
|
|
14
|
+
"version": "15.0.0-alpha.14",
|
|
15
15
|
"factory": "./src/schematics/migrations/all/remove-old-compat-stylesheets/remove-old-compat-stylesheets.schematic",
|
|
16
16
|
"description": "Remove backward compatible stylesheets for older versions of SKY UX."
|
|
17
17
|
},
|
|
18
18
|
"workspace-check": {
|
|
19
|
-
"version": "15.0.0-alpha.
|
|
19
|
+
"version": "15.0.0-alpha.14",
|
|
20
20
|
"factory": "./src/schematics/migrations/all/workspace-check/workspace-check.schematic",
|
|
21
21
|
"description": "Log warnings if the workspace is not configured correctly."
|
|
22
22
|
},
|
|
23
23
|
"migrate-dragula-polyfill": {
|
|
24
|
-
"version": "15.0.0-alpha.
|
|
24
|
+
"version": "15.0.0-alpha.14",
|
|
25
25
|
"factory": "./src/schematics/migrations/all/migrate-dragula-polyfill/migrate-dragula-polyfill.schematic",
|
|
26
26
|
"description": "Remove the @skyux/packages/polyfills entry from project config, replacing it with a local copy when Dragula is still installed."
|
|
27
27
|
},
|
|
28
28
|
"remove-timepicker-retain-invalid-values": {
|
|
29
|
-
"version": "15.0.0-alpha.
|
|
29
|
+
"version": "15.0.0-alpha.14",
|
|
30
30
|
"factory": "./src/schematics/migrations/update-15/remove-timepicker-retain-invalid-values/remove-timepicker-retain-invalid-values.schematic",
|
|
31
31
|
"description": "Remove the skyTimepickerRetainInvalidValues input from timepicker inputs since retaining invalid values is now the default behavior."
|
|
32
32
|
},
|
|
33
33
|
"add-compat-stylesheets": {
|
|
34
|
-
"version": "15.0.0-alpha.
|
|
34
|
+
"version": "15.0.0-alpha.14",
|
|
35
35
|
"factory": "./src/schematics/migrations/update-15/add-compat-stylesheets/add-compat-stylesheet.schematic",
|
|
36
36
|
"description": "Add a backwards-compatible stylesheet with styles that have been removed from components in SKY UX 15."
|
|
37
37
|
},
|
|
38
38
|
"migrate-sdk-testing-imports": {
|
|
39
|
-
"version": "15.0.0-alpha.
|
|
39
|
+
"version": "15.0.0-alpha.14",
|
|
40
40
|
"factory": "./src/schematics/migrations/update-15/migrate-sdk-testing-imports/migrate-sdk-testing-imports.schematic",
|
|
41
41
|
"description": "Move SkyAppTestUtility, SkyAppTestUtilityDomEventOptions, and SkyBy imports from the deprecated @skyux-sdk/testing package to @skyux/core/testing."
|
|
42
42
|
},
|
|
43
43
|
"legacy-i18n-services": {
|
|
44
|
-
"version": "15.0.0-alpha.
|
|
44
|
+
"version": "15.0.0-alpha.14",
|
|
45
45
|
"factory": "./src/schematics/migrations/update-15/legacy-i18n-services/legacy-i18n-services.schematic",
|
|
46
46
|
"description": "Replace SkyAppResourcesService and SkyLibResourcesService with their legacy equivalents since the originals now emit whenever the locale changes."
|
|
47
47
|
},
|
|
48
48
|
"fluid-grid-inset": {
|
|
49
|
-
"version": "15.0.0-alpha.
|
|
49
|
+
"version": "15.0.0-alpha.14",
|
|
50
50
|
"factory": "./src/schematics/migrations/update-15/fluid-grid-inset/fluid-grid-inset.schematic",
|
|
51
51
|
"description": "Migrate sky-fluid-grid elements from the deprecated disableMargin input to the new inset input, since hiding the outer margin is now the default behavior."
|
|
52
|
+
},
|
|
53
|
+
"remove-select-field": {
|
|
54
|
+
"version": "15.0.0-alpha.14",
|
|
55
|
+
"factory": "./src/schematics/migrations/update-15/remove-select-field/remove-select-field.schematic",
|
|
56
|
+
"description": "Remove the SkySelectFieldModule import and the @skyux/select-field dependency from projects that do not reference <sky-select-field> in any template."
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyux/packages",
|
|
3
|
-
"version": "15.0.0-alpha.
|
|
3
|
+
"version": "15.0.0-alpha.14",
|
|
4
4
|
"author": "Blackbaud, Inc.",
|
|
5
5
|
"description": "Handles the `ng update` command for SKY UX component libraries.",
|
|
6
6
|
"keywords": [
|
|
@@ -32,71 +32,71 @@
|
|
|
32
32
|
"ng-update": {
|
|
33
33
|
"migrations": "./migrations.json",
|
|
34
34
|
"packageGroup": {
|
|
35
|
-
"@skyux/packages": "15.0.0-alpha.
|
|
35
|
+
"@skyux/packages": "15.0.0-alpha.14",
|
|
36
36
|
"@blackbaud/angular-tree-component": "^1.0.0",
|
|
37
|
-
"@skyux-sdk/eslint-schematics": "15.0.0-alpha.
|
|
38
|
-
"@skyux-sdk/stylelint-schematics": "15.0.0-alpha.
|
|
39
|
-
"@skyux-sdk/testing": "15.0.0-alpha.
|
|
40
|
-
"@skyux-sdk/testing-schematics": "15.0.0-alpha.
|
|
41
|
-
"@skyux-sdk/vitest": "15.0.0-alpha.
|
|
42
|
-
"@skyux/a11y": "15.0.0-alpha.
|
|
43
|
-
"@skyux/action-bars": "15.0.0-alpha.
|
|
44
|
-
"@skyux/ag-grid": "15.0.0-alpha.
|
|
45
|
-
"@skyux/angular-tree-component": "15.0.0-alpha.
|
|
46
|
-
"@skyux/animations": "15.0.0-alpha.
|
|
47
|
-
"@skyux/assets": "15.0.0-alpha.
|
|
48
|
-
"@skyux/autonumeric": "15.0.0-alpha.
|
|
49
|
-
"@skyux/avatar": "15.0.0-alpha.
|
|
50
|
-
"@skyux/charts": "15.0.0-alpha.
|
|
51
|
-
"@skyux/code-examples": "15.0.0-alpha.
|
|
52
|
-
"@skyux/colorpicker": "15.0.0-alpha.
|
|
53
|
-
"@skyux/config": "15.0.0-alpha.
|
|
54
|
-
"@skyux/core": "15.0.0-alpha.
|
|
55
|
-
"@skyux/data-grid": "15.0.0-alpha.
|
|
56
|
-
"@skyux/data-manager": "15.0.0-alpha.
|
|
57
|
-
"@skyux/datetime": "15.0.0-alpha.
|
|
58
|
-
"@skyux/docs-tools": "15.0.0-alpha.
|
|
59
|
-
"@skyux/errors": "15.0.0-alpha.
|
|
60
|
-
"@skyux/filter-bar": "15.0.0-alpha.
|
|
61
|
-
"@skyux/flyout": "15.0.0-alpha.
|
|
62
|
-
"@skyux/forms": "15.0.0-alpha.
|
|
63
|
-
"@skyux/grids": "15.0.0-alpha.
|
|
64
|
-
"@skyux/help-inline": "15.0.0-alpha.
|
|
65
|
-
"@skyux/i18n": "15.0.0-alpha.
|
|
66
|
-
"@skyux/icon": "15.0.0-alpha.
|
|
37
|
+
"@skyux-sdk/eslint-schematics": "15.0.0-alpha.14",
|
|
38
|
+
"@skyux-sdk/stylelint-schematics": "15.0.0-alpha.14",
|
|
39
|
+
"@skyux-sdk/testing": "15.0.0-alpha.14",
|
|
40
|
+
"@skyux-sdk/testing-schematics": "15.0.0-alpha.14",
|
|
41
|
+
"@skyux-sdk/vitest": "15.0.0-alpha.14",
|
|
42
|
+
"@skyux/a11y": "15.0.0-alpha.14",
|
|
43
|
+
"@skyux/action-bars": "15.0.0-alpha.14",
|
|
44
|
+
"@skyux/ag-grid": "15.0.0-alpha.14",
|
|
45
|
+
"@skyux/angular-tree-component": "15.0.0-alpha.14",
|
|
46
|
+
"@skyux/animations": "15.0.0-alpha.14",
|
|
47
|
+
"@skyux/assets": "15.0.0-alpha.14",
|
|
48
|
+
"@skyux/autonumeric": "15.0.0-alpha.14",
|
|
49
|
+
"@skyux/avatar": "15.0.0-alpha.14",
|
|
50
|
+
"@skyux/charts": "15.0.0-alpha.14",
|
|
51
|
+
"@skyux/code-examples": "15.0.0-alpha.14",
|
|
52
|
+
"@skyux/colorpicker": "15.0.0-alpha.14",
|
|
53
|
+
"@skyux/config": "15.0.0-alpha.14",
|
|
54
|
+
"@skyux/core": "15.0.0-alpha.14",
|
|
55
|
+
"@skyux/data-grid": "15.0.0-alpha.14",
|
|
56
|
+
"@skyux/data-manager": "15.0.0-alpha.14",
|
|
57
|
+
"@skyux/datetime": "15.0.0-alpha.14",
|
|
58
|
+
"@skyux/docs-tools": "15.0.0-alpha.14",
|
|
59
|
+
"@skyux/errors": "15.0.0-alpha.14",
|
|
60
|
+
"@skyux/filter-bar": "15.0.0-alpha.14",
|
|
61
|
+
"@skyux/flyout": "15.0.0-alpha.14",
|
|
62
|
+
"@skyux/forms": "15.0.0-alpha.14",
|
|
63
|
+
"@skyux/grids": "15.0.0-alpha.14",
|
|
64
|
+
"@skyux/help-inline": "15.0.0-alpha.14",
|
|
65
|
+
"@skyux/i18n": "15.0.0-alpha.14",
|
|
66
|
+
"@skyux/icon": "15.0.0-alpha.14",
|
|
67
67
|
"@skyux/icons": "^11.4.0",
|
|
68
|
-
"@skyux/indicators": "15.0.0-alpha.
|
|
69
|
-
"@skyux/inline-form": "15.0.0-alpha.
|
|
70
|
-
"@skyux/layout": "15.0.0-alpha.
|
|
71
|
-
"@skyux/list-builder": "15.0.0-alpha.
|
|
72
|
-
"@skyux/list-builder-common": "15.0.0-alpha.
|
|
73
|
-
"@skyux/list-builder-view-checklist": "15.0.0-alpha.
|
|
74
|
-
"@skyux/list-builder-view-grids": "15.0.0-alpha.
|
|
75
|
-
"@skyux/lists": "15.0.0-alpha.
|
|
76
|
-
"@skyux/lookup": "15.0.0-alpha.
|
|
77
|
-
"@skyux/manifest": "15.0.0-alpha.
|
|
78
|
-
"@skyux/modals": "15.0.0-alpha.
|
|
79
|
-
"@skyux/navbar": "15.0.0-alpha.
|
|
80
|
-
"@skyux/pages": "15.0.0-alpha.
|
|
81
|
-
"@skyux/phone-field": "15.0.0-alpha.
|
|
82
|
-
"@skyux/popovers": "15.0.0-alpha.
|
|
83
|
-
"@skyux/progress-indicator": "15.0.0-alpha.
|
|
84
|
-
"@skyux/router": "15.0.0-alpha.
|
|
85
|
-
"@skyux/split-view": "15.0.0-alpha.
|
|
86
|
-
"@skyux/tabs": "15.0.0-alpha.
|
|
87
|
-
"@skyux/text-editor": "15.0.0-alpha.
|
|
88
|
-
"@skyux/theme": "15.0.0-alpha.
|
|
89
|
-
"@skyux/tiles": "15.0.0-alpha.
|
|
90
|
-
"@skyux/toast": "15.0.0-alpha.
|
|
91
|
-
"@skyux/validation": "15.0.0-alpha.
|
|
68
|
+
"@skyux/indicators": "15.0.0-alpha.14",
|
|
69
|
+
"@skyux/inline-form": "15.0.0-alpha.14",
|
|
70
|
+
"@skyux/layout": "15.0.0-alpha.14",
|
|
71
|
+
"@skyux/list-builder": "15.0.0-alpha.14",
|
|
72
|
+
"@skyux/list-builder-common": "15.0.0-alpha.14",
|
|
73
|
+
"@skyux/list-builder-view-checklist": "15.0.0-alpha.14",
|
|
74
|
+
"@skyux/list-builder-view-grids": "15.0.0-alpha.14",
|
|
75
|
+
"@skyux/lists": "15.0.0-alpha.14",
|
|
76
|
+
"@skyux/lookup": "15.0.0-alpha.14",
|
|
77
|
+
"@skyux/manifest": "15.0.0-alpha.14",
|
|
78
|
+
"@skyux/modals": "15.0.0-alpha.14",
|
|
79
|
+
"@skyux/navbar": "15.0.0-alpha.14",
|
|
80
|
+
"@skyux/pages": "15.0.0-alpha.14",
|
|
81
|
+
"@skyux/phone-field": "15.0.0-alpha.14",
|
|
82
|
+
"@skyux/popovers": "15.0.0-alpha.14",
|
|
83
|
+
"@skyux/progress-indicator": "15.0.0-alpha.14",
|
|
84
|
+
"@skyux/router": "15.0.0-alpha.14",
|
|
85
|
+
"@skyux/split-view": "15.0.0-alpha.14",
|
|
86
|
+
"@skyux/tabs": "15.0.0-alpha.14",
|
|
87
|
+
"@skyux/text-editor": "15.0.0-alpha.14",
|
|
88
|
+
"@skyux/theme": "15.0.0-alpha.14",
|
|
89
|
+
"@skyux/tiles": "15.0.0-alpha.14",
|
|
90
|
+
"@skyux/toast": "15.0.0-alpha.14",
|
|
91
|
+
"@skyux/validation": "15.0.0-alpha.14",
|
|
92
92
|
"ag-grid-angular": "^36.1.0",
|
|
93
93
|
"ag-grid-community": "^36.1.0",
|
|
94
94
|
"ag-grid-enterprise": "^36.0.2",
|
|
95
95
|
"autonumeric": "^4.10.10",
|
|
96
|
-
"eslint-config-skyux": "15.0.0-alpha.
|
|
97
|
-
"skyux-eslint": "15.0.0-alpha.
|
|
98
|
-
"skyux-stylelint": "15.0.0-alpha.
|
|
99
|
-
"stylelint-config-skyux": "15.0.0-alpha.
|
|
96
|
+
"eslint-config-skyux": "15.0.0-alpha.14",
|
|
97
|
+
"skyux-eslint": "15.0.0-alpha.14",
|
|
98
|
+
"skyux-stylelint": "15.0.0-alpha.14",
|
|
99
|
+
"stylelint-config-skyux": "15.0.0-alpha.14"
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"typescript": "^6.0.3"
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
|
-
"@blackbaud/skyux-design-tokens": "7.0.0-alpha.
|
|
108
|
+
"@blackbaud/skyux-design-tokens": "7.0.0-alpha.11",
|
|
109
109
|
"fs-extra": "11.3.6",
|
|
110
110
|
"jsonc-parser": "3.3.1",
|
|
111
111
|
"parse5": "7.3.0",
|
|
@@ -29,6 +29,72 @@ Pointer events are no longer disabled on elements with the "sky-btn-disabled" cl
|
|
|
29
29
|
},
|
|
30
30
|
],
|
|
31
31
|
},
|
|
32
|
+
{
|
|
33
|
+
name: '@skyux/layout',
|
|
34
|
+
components: [
|
|
35
|
+
{
|
|
36
|
+
name: 'toolbar',
|
|
37
|
+
styles: [
|
|
38
|
+
{
|
|
39
|
+
css: `
|
|
40
|
+
:root {
|
|
41
|
+
--sky-compat-toolbar-container-padding: var(--sky-comp-toolbar-space-inset-top)
|
|
42
|
+
var(--sky-comp-toolbar-space-inset-right)
|
|
43
|
+
var(--sky-comp-toolbar-space-inset-bottom)
|
|
44
|
+
var(--sky-comp-toolbar-space-inset-left);
|
|
45
|
+
}
|
|
46
|
+
`,
|
|
47
|
+
instructions: `
|
|
48
|
+
The toolbar no longer applies its own left, right, and top padding unless it is inside a page or tab with layout="list". Everywhere else it now inherits the padding of its container, so that its contents line up with the content above and below it. To address this change, remove this block of code, then remove any negative margins or spacing overrides your app applied to compensate for the toolbar's extra padding.`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: '@skyux/filter-bar',
|
|
56
|
+
components: [
|
|
57
|
+
{
|
|
58
|
+
name: 'filter bar',
|
|
59
|
+
styles: [
|
|
60
|
+
{
|
|
61
|
+
css: `
|
|
62
|
+
:root {
|
|
63
|
+
--sky-compat-filter-bar-toolbar-padding: var(--sky-comp-filter_bar-space-inset-top)
|
|
64
|
+
var(--sky-comp-filter_bar-space-inset-right)
|
|
65
|
+
var(--sky-comp-filter_bar-space-inset-bottom)
|
|
66
|
+
var(--sky-comp-filter_bar-space-inset-left);
|
|
67
|
+
}
|
|
68
|
+
`,
|
|
69
|
+
instructions: `
|
|
70
|
+
The filter bar no longer applies its own left, right, and top padding unless it is inside a page or tab with layout="list". Everywhere else it now inherits the padding of its container, so that its filters line up with the content above and below it. To address this change, remove this block of code, then remove any negative margins or spacing overrides your app applied to compensate for the filter bar's extra padding.`,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: '@skyux/lists',
|
|
78
|
+
components: [
|
|
79
|
+
{
|
|
80
|
+
name: 'list summary',
|
|
81
|
+
styles: [
|
|
82
|
+
{
|
|
83
|
+
css: `
|
|
84
|
+
:root {
|
|
85
|
+
--sky-compat-list-summary-padding: var(--sky-comp-list_summary-space-inset-top)
|
|
86
|
+
var(--sky-comp-list_summary-space-inset-right)
|
|
87
|
+
var(--sky-comp-list_summary-space-inset-bottom)
|
|
88
|
+
var(--sky-comp-list_summary-space-inset-left);
|
|
89
|
+
}
|
|
90
|
+
`,
|
|
91
|
+
instructions: `
|
|
92
|
+
The list summary no longer applies its own left and right padding unless it is inside a page or tab with layout="list". Everywhere else it now inherits the padding of its container, so that its summary items line up with the content above and below it. Its top and bottom padding is unchanged. To address this change, remove this block of code, then remove any negative margins or spacing overrides your app applied to compensate for the list summary's extra padding.`,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
32
98
|
],
|
|
33
99
|
};
|
|
34
100
|
function getProjectAppPath(project) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-compat-stylesheet.schematic.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/packages/src/schematics/migrations/update-15/add-compat-stylesheets/add-compat-stylesheet.schematic.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"add-compat-stylesheet.schematic.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/packages/src/schematics/migrations/update-15/add-compat-stylesheets/add-compat-stylesheet.schematic.ts"],"names":[],"mappings":";;AA+OA,4BAqBC;AApQD,2DAA+D;AAC/D,yDAGqC;AACrC,qEAAqE;AAErE,iDAA8C;AAC9C,gDAAyD;AACzD,0DAA2D;AAE3D,MAAM,oBAAoB,GAAG,QAAQ,iBAAO,CAAC,KAAK,aAAa,CAAC;AAYhE,MAAM,YAAY,GAAgB;IAChC,SAAS,EAAE;QACT;YACE,IAAI,EAAE,cAAc;YACpB,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,QAAQ;oBACd,MAAM,EAAE;wBACN;4BACE,GAAG,EAAE;;;;CAIlB;4BACa,YAAY,EAAE;uUAC2S;yBAC1T;qBACF;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,eAAe;YACrB,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,SAAS;oBACf,MAAM,EAAE;wBACN;4BACE,GAAG,EAAE;;;;;;;CAOlB;4BACa,YAAY,EAAE;kaACsY;yBACrZ;qBACF;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,mBAAmB;YACzB,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,YAAY;oBAClB,MAAM,EAAE;wBACN;4BACE,GAAG,EAAE;;;;;;;CAOlB;4BACa,YAAY,EAAE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AAC,UAAU,CAAC,aAAa,CAAC,KAAK,aAAa,EAAE,CAAC;gBAClE,IAAI,MAAM,EAAE,CAAC;oBACX,MAAM,UAAU,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;oBACxD,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;gBAClD,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,MAAM,EAAE,CAAC;YACX,KAAK,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,CAAC;QACzC,CAAC;QAED,OAAO,IAAA,kBAAK,EAAC,KAAK,CAAC,CAAC;IACtB,CAAC,CAAC;AACJ,CAAC"}
|
package/src/schematics/migrations/update-15/remove-select-field/remove-select-field.schematic.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
/**
|
|
3
|
+
* Removes the `SkySelectFieldModule` import from projects that no longer
|
|
4
|
+
* reference `<sky-select-field>` in any template, and drops the
|
|
5
|
+
* `@skyux/select-field` dependency once nothing in the workspace imports it.
|
|
6
|
+
*/
|
|
7
|
+
export default function (): Rule;
|
package/src/schematics/migrations/update-15/remove-select-field/remove-select-field.schematic.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
|
5
|
+
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
6
|
+
const dependencies_2 = require("../../../utility/dependencies");
|
|
7
|
+
const log_once_1 = require("../../../utility/log-once");
|
|
8
|
+
const template_1 = require("../../../utility/template");
|
|
9
|
+
const ng_ast_1 = require("../../../utility/typescript/ng-ast");
|
|
10
|
+
const remove_class_reference_1 = require("../../../utility/typescript/remove-class-reference");
|
|
11
|
+
const visit_project_files_1 = require("../../../utility/visit-project-files");
|
|
12
|
+
const workspace_2 = require("../../../utility/workspace");
|
|
13
|
+
const SELECTOR = 'sky-select-field';
|
|
14
|
+
const CLASS_NAME = 'SkySelectFieldModule';
|
|
15
|
+
const PACKAGE_NAME = '@skyux/select-field';
|
|
16
|
+
function contentHasSelector(content) {
|
|
17
|
+
return (0, template_1.getElementsByTagName)(SELECTOR, (0, template_1.parseTemplate)(content)).length > 0;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* True if any `.html` template or inline `@Component({ template })` anywhere
|
|
21
|
+
* in the project contains a `<sky-select-field>` element.
|
|
22
|
+
*/
|
|
23
|
+
function projectUsesSelectField(tree, sourceRoot) {
|
|
24
|
+
let used = false;
|
|
25
|
+
(0, visit_project_files_1.visitProjectFiles)(tree, sourceRoot, (filePath) => {
|
|
26
|
+
if (used) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (filePath.endsWith('.html')) {
|
|
30
|
+
const content = tree.readText(filePath);
|
|
31
|
+
if (content.includes(`<${SELECTOR}`) && contentHasSelector(content)) {
|
|
32
|
+
used = true;
|
|
33
|
+
}
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (filePath.endsWith('.ts') && !filePath.endsWith('.d.ts')) {
|
|
37
|
+
const content = tree.readText(filePath);
|
|
38
|
+
if (!content.includes(`<${SELECTOR}`)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const source = (0, ng_ast_1.parseSourceFile)(tree, filePath);
|
|
42
|
+
used = (0, ng_ast_1.getInlineTemplates)(source).some((template) => contentHasSelector(content.slice(template.start, template.end)));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return used;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Removes `SkySelectFieldModule` from every decorator `imports` and
|
|
49
|
+
* `exports` array (and the now-unused import statement) throughout the
|
|
50
|
+
* project.
|
|
51
|
+
*/
|
|
52
|
+
function removeModuleReferences(tree, sourceRoot, context) {
|
|
53
|
+
(0, visit_project_files_1.visitProjectFiles)(tree, sourceRoot, (filePath) => {
|
|
54
|
+
if (!filePath.endsWith('.ts') || filePath.endsWith('.d.ts')) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const content = tree.readText(filePath);
|
|
58
|
+
if (!content.includes(CLASS_NAME)) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const source = (0, ng_ast_1.parseSourceFile)(tree, filePath);
|
|
62
|
+
// `SkySelectFieldModule` may be imported under an alias (`SkySelectFieldModule
|
|
63
|
+
// as Foo`); `removeClassReference`/`removeImport` match on the local
|
|
64
|
+
// identifier, so resolve it (and confirm the import exists) up front.
|
|
65
|
+
const localName = (0, ng_ast_1.getLocalImportName)(source, CLASS_NAME, PACKAGE_NAME);
|
|
66
|
+
if (!localName) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const recorder = tree.beginUpdate(filePath);
|
|
70
|
+
const removed = (0, remove_class_reference_1.removeClassReference)(recorder, source, localName, PACKAGE_NAME, ['imports', 'exports']);
|
|
71
|
+
if (removed) {
|
|
72
|
+
tree.commitUpdate(recorder);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
(0, log_once_1.logOnce)(context, 'warn', `The "${CLASS_NAME}" import in "${filePath}" was kept because it is referenced outside a decorator "imports" or "exports" array (for example in a TestBed configuration). Remove the import manually if it is no longer needed.`);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Removes the `SkySelectFieldModule` import from projects that no longer
|
|
81
|
+
* reference `<sky-select-field>` in any template, and drops the
|
|
82
|
+
* `@skyux/select-field` dependency once nothing in the workspace imports it.
|
|
83
|
+
*/
|
|
84
|
+
function default_1() {
|
|
85
|
+
return async (tree, context) => {
|
|
86
|
+
const workspace = await (0, workspace_1.getWorkspace)(tree);
|
|
87
|
+
for (const project of workspace.projects.values()) {
|
|
88
|
+
const sourceRoot = (0, workspace_2.getSourceRoot)(project);
|
|
89
|
+
if (!projectUsesSelectField(tree, sourceRoot)) {
|
|
90
|
+
removeModuleReferences(tree, sourceRoot, context);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (!(await (0, dependencies_2.isPackageUsed)(tree, PACKAGE_NAME))) {
|
|
94
|
+
(0, dependencies_1.removePackageJsonDependency)(tree, PACKAGE_NAME);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=remove-select-field.schematic.js.map
|
package/src/schematics/migrations/update-15/remove-select-field/remove-select-field.schematic.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-select-field.schematic.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/packages/src/schematics/migrations/update-15/remove-select-field/remove-select-field.schematic.ts"],"names":[],"mappings":";;AAmHA,4BAeC;AAjID,2EAAuF;AACvF,qEAAqE;AAErE,gEAA8D;AAC9D,wDAAoD;AACpD,wDAAgF;AAChF,+DAI4C;AAC5C,+FAA0F;AAC1F,8EAAyE;AACzE,0DAA2D;AAE3D,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AACpC,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAC1C,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAE3C,SAAS,kBAAkB,CAAC,OAAe;IACzC,OAAO,IAAA,+BAAoB,EAAC,QAAQ,EAAE,IAAA,wBAAa,EAAC,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAC3E,CAAC;AAED;;;GAGG;AACH,SAAS,sBAAsB,CAAC,IAAU,EAAE,UAAkB;IAC5D,IAAI,IAAI,GAAG,KAAK,CAAC;IAEjB,IAAA,uCAAiB,EAAC,IAAI,EAAE,UAAU,EAAE,CAAC,QAAQ,EAAE,EAAE;QAC/C,IAAI,IAAI,EAAE,CAAC;YACT,OAAO;QACT,CAAC;QAED,IAAI,QAAQ,CAAC,QAAQ,CAA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,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;QAED,IAAI,CAAC,CAAC,MAAM,IAAA,4BAAa,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC;YAC/C,IAAA,0CAA2B,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAClD,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -535,7 +535,7 @@ function convertGridToDataGrid(projectPath) {
|
|
|
535
535
|
},
|
|
536
536
|
() => {
|
|
537
537
|
if (anyConverted) {
|
|
538
|
-
return (0, utility_1.addDependency)('@skyux/data-grid', `15.0.0-alpha.
|
|
538
|
+
return (0, utility_1.addDependency)('@skyux/data-grid', `15.0.0-alpha.14`, {
|
|
539
539
|
existing: utility_1.ExistingBehavior.Skip,
|
|
540
540
|
});
|
|
541
541
|
}
|
|
@@ -198,7 +198,7 @@ function convertPageSummaryToPageHeader(projectPath) {
|
|
|
198
198
|
}
|
|
199
199
|
});
|
|
200
200
|
},
|
|
201
|
-
(0, utility_1.addDependency)('@skyux/pages', `15.0.0-alpha.
|
|
201
|
+
(0, utility_1.addDependency)('@skyux/pages', `15.0.0-alpha.14`, {
|
|
202
202
|
existing: utility_1.ExistingBehavior.Skip,
|
|
203
203
|
}),
|
|
204
204
|
]);
|
|
@@ -296,7 +296,7 @@ function convertProgressIndicatorWizardToTabWizard(options) {
|
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
298
|
},
|
|
299
|
-
(0, utility_1.addDependency)('@skyux/tabs', `15.0.0-alpha.
|
|
299
|
+
(0, utility_1.addDependency)('@skyux/tabs', `15.0.0-alpha.14`, {
|
|
300
300
|
existing: utility_1.ExistingBehavior.Skip,
|
|
301
301
|
}),
|
|
302
302
|
]);
|
|
@@ -10,6 +10,14 @@ export declare function parseSourceFile(tree: Tree, filePath: string): ts.Source
|
|
|
10
10
|
* typed module names, e.g. `import type { Foo } from '@skyux/foo'`.
|
|
11
11
|
*/
|
|
12
12
|
export declare function isImportedFromPackage(sourceFile: ts.Node, identifierName: string, packageName: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the local binding name `identifierName` is imported as from
|
|
15
|
+
* `packageName` (e.g. `Foo` for `import { Bar as Foo } from packageName`), or
|
|
16
|
+
* `undefined` if it isn't imported from that package. Utilities that match on
|
|
17
|
+
* identifier text (e.g. `removeClassReference`) need the local name, not the
|
|
18
|
+
* exported name, since that's what appears at every use site.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getLocalImportName(sourceFile: ts.Node, identifierName: string, packageName: string): string | undefined;
|
|
13
21
|
export declare function getInlineTemplates(sourceFile: ts.SourceFile): {
|
|
14
22
|
start: number;
|
|
15
23
|
end: number;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseSourceFile = parseSourceFile;
|
|
4
4
|
exports.isImportedFromPackage = isImportedFromPackage;
|
|
5
|
+
exports.getLocalImportName = getLocalImportName;
|
|
5
6
|
exports.getInlineTemplates = getInlineTemplates;
|
|
6
7
|
exports.getTemplateUrls = getTemplateUrls;
|
|
7
8
|
exports.getTestingModuleMetadata = getTestingModuleMetadata;
|
|
@@ -32,29 +33,45 @@ function parseSourceFile(tree, filePath) {
|
|
|
32
33
|
* typed module names, e.g. `import type { Foo } from '@skyux/foo'`.
|
|
33
34
|
*/
|
|
34
35
|
function isImportedFromPackage(sourceFile, identifierName, packageName) {
|
|
36
|
+
return (getLocalImportName(sourceFile, identifierName, packageName) !== undefined);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns the `NamedImports` of `importDecl` when it imports from
|
|
40
|
+
* `packageName`, or `undefined` otherwise.
|
|
41
|
+
*/
|
|
42
|
+
function getNamedBindingsFromPackage(importDecl, packageName) {
|
|
43
|
+
if (!importDecl.moduleSpecifier ||
|
|
44
|
+
!typescript_1.default.isStringLiteral(importDecl.moduleSpecifier) ||
|
|
45
|
+
importDecl.moduleSpecifier.text !== packageName) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
const namedBindings = importDecl.importClause?.namedBindings;
|
|
49
|
+
return namedBindings && typescript_1.default.isNamedImports(namedBindings)
|
|
50
|
+
? namedBindings
|
|
51
|
+
: undefined;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns the local binding name `identifierName` is imported as from
|
|
55
|
+
* `packageName` (e.g. `Foo` for `import { Bar as Foo } from packageName`), or
|
|
56
|
+
* `undefined` if it isn't imported from that package. Utilities that match on
|
|
57
|
+
* identifier text (e.g. `removeClassReference`) need the local name, not the
|
|
58
|
+
* exported name, since that's what appears at every use site.
|
|
59
|
+
*/
|
|
60
|
+
function getLocalImportName(sourceFile, identifierName, packageName) {
|
|
35
61
|
const importDeclarations = (0, ast_utils_1.findNodes)(sourceFile, typescript_1.default.SyntaxKind.ImportDeclaration);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
if (importDecl.moduleSpecifier.text !== packageName) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
if (!importDecl.importClause) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
const namedBindings = importDecl.importClause.namedBindings;
|
|
48
|
-
if (!namedBindings || !typescript_1.default.isNamedImports(namedBindings)) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
return namedBindings.elements.some((element) => {
|
|
62
|
+
for (const importDecl of importDeclarations) {
|
|
63
|
+
const namedBindings = getNamedBindingsFromPackage(importDecl, packageName);
|
|
64
|
+
const match = namedBindings?.elements.find((element) => {
|
|
52
65
|
const importedName = element.propertyName
|
|
53
66
|
? element.propertyName.text
|
|
54
67
|
: element.name.text;
|
|
55
68
|
return importedName === identifierName;
|
|
56
69
|
});
|
|
57
|
-
|
|
70
|
+
if (match) {
|
|
71
|
+
return match.name.text;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return undefined;
|
|
58
75
|
}
|
|
59
76
|
function getInlineTemplates(sourceFile) {
|
|
60
77
|
if (isImportedFromPackage(sourceFile, 'Component', '@angular/core')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-ast.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/utility/typescript/ng-ast.ts"],"names":[],"mappings":";;AAcA,0CAgBC;AAMD,
|
|
1
|
+
{"version":3,"file":"ng-ast.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/utility/typescript/ng-ast.ts"],"names":[],"mappings":";;AAcA,0CAgBC;AAMD,sDAQC;AA+BD,gDAwBC;AAED,gDA4BC;AAED,0CAwBC;AAKD,4DAWC;AAKD,sDASC;AAOD,4DAiIC;AAKD,8EAwBC;;AA9VD,+CAA4C;AAE5C,qEAK+C;AAC/C,+DAA0E;AAC1E,oEAA4B;AAE5B;;GAEG;AACH,SAAgB,eAAe,CAAC,IAAU,EAAE,QAAgB;IAC1D,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,wBAAwB,QAAQ,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,2EAA2E;IAC3E,2EAA2E;IAC3E,sEAAsE;IACtE,yEAAyE;IACzE,8CAA8C;IAC9C,OAAO,oBAAE,CAAC,gBAAgB,CACxB,QAAQ,EACR,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EACvB,oBAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,qBAAqB,CACnC,UAAmB,EACnB,cAAsB,EACtB,WAAmB;IAEnB,OAAO,CACL,kBAAkB,CAAC,UAAU,EAAE,cAAc,EAAE,WAAW,CAAC,KAAK,SAAS,CAC1E,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,2BAA2B,CAClC,UAAgC,EAChC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AC;QACpC,CAAC,oBAAE,CAAC,wBAAwB,CAAC,UAAU,CAAC,WAAW,CAAC,EACpD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC;IAC9C,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAC;IAEzC,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAI,CAAC,OAAO,CAAA,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC7E,OAAO,YAAY,CAAC,QAAQ,CAAC,WAAI,CAAC,OAAO,CAAA,GAAG,UAAU,EAAE,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { UpdateRecorder } from '@angular-devkit/schematics';
|
|
2
2
|
import ts from 'typescript';
|
|
3
3
|
/**
|
|
4
|
-
* Removes every reference to `className` from
|
|
5
|
-
* `imports
|
|
6
|
-
* entries stay well-formed, then removes
|
|
7
|
-
* `moduleName` - but only if nothing else in
|
|
8
|
-
* References outside
|
|
9
|
-
* parameter that shadows the import, direct
|
|
10
|
-
* untouched, and the import is kept if any of
|
|
4
|
+
* Removes every reference to `className` from the given `metadataFields`
|
|
5
|
+
* arrays (default `['imports']`) of an Angular decorator, consuming the
|
|
6
|
+
* adjacent comma so the remaining entries stay well-formed, then removes
|
|
7
|
+
* the import of `className` from `moduleName` - but only if nothing else in
|
|
8
|
+
* the file still references it. References outside those decorator arrays
|
|
9
|
+
* (unrelated arrays, a parameter that shadows the import, direct
|
|
10
|
+
* assignments, etc.) are left untouched, and the import is kept if any of
|
|
11
|
+
* those remain.
|
|
11
12
|
*
|
|
12
13
|
* Returns `true` when the import statement was removed, `false` when
|
|
13
14
|
* unhandled references kept it in place.
|
|
14
15
|
*/
|
|
15
|
-
export declare function removeClassReference(recorder: UpdateRecorder, sourceFile: ts.SourceFile, className: string, moduleName: string): boolean;
|
|
16
|
+
export declare function removeClassReference(recorder: UpdateRecorder, sourceFile: ts.SourceFile, className: string, moduleName: string, metadataFields?: readonly string[]): boolean;
|
|
@@ -6,39 +6,55 @@ const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
|
6
6
|
const typescript_1 = tslib_1.__importDefault(require("typescript"));
|
|
7
7
|
const remove_import_1 = require("./remove-import");
|
|
8
8
|
/**
|
|
9
|
-
* True if `array` is the value of
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* grammar, so that link
|
|
9
|
+
* True if `array` is the value of a property (named in `metadataFields`,
|
|
10
|
+
* e.g. `imports: [...]`) on an object literal passed directly to a
|
|
11
|
+
* decorator (e.g. `@Component({ imports: [...] })`). A `PropertyAssignment`'s
|
|
12
|
+
* parent is always an `ObjectLiteralExpression` by grammar, so that link
|
|
13
|
+
* doesn't need its own check.
|
|
14
|
+
*
|
|
15
|
+
* `exports` only exists on Angular's `@NgModule` metadata (`@Component`,
|
|
16
|
+
* `@Directive`, etc. have no such field), so an `exports` array is only
|
|
17
|
+
* treated as decorator metadata when the decorator is `@NgModule`. This
|
|
18
|
+
* keeps `imports` processing available for any decorator (e.g. standalone
|
|
19
|
+
* `@Component` metadata) while preventing an unrelated custom decorator's
|
|
20
|
+
* `exports` array from being mistaken for module metadata.
|
|
13
21
|
*/
|
|
14
|
-
function
|
|
22
|
+
function isDecoratorMetadataArray(array, metadataFields) {
|
|
15
23
|
const property = array.parent;
|
|
16
24
|
if (!typescript_1.default.isPropertyAssignment(property) ||
|
|
17
|
-
property.name.getText()
|
|
25
|
+
!metadataFields.includes(property.name.getText())) {
|
|
18
26
|
return false;
|
|
19
27
|
}
|
|
20
28
|
const call = property.parent.parent;
|
|
21
|
-
|
|
29
|
+
if (!typescript_1.default.isCallExpression(call) || !typescript_1.default.isDecorator(call.parent)) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
if (property.name.getText() === 'exports' &&
|
|
33
|
+
!(typescript_1.default.isIdentifier(call.expression) && call.expression.text === 'NgModule')) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
22
37
|
}
|
|
23
38
|
/**
|
|
24
|
-
* Removes every reference to `className` from
|
|
25
|
-
* `imports
|
|
26
|
-
* entries stay well-formed, then removes
|
|
27
|
-
* `moduleName` - but only if nothing else in
|
|
28
|
-
* References outside
|
|
29
|
-
* parameter that shadows the import, direct
|
|
30
|
-
* untouched, and the import is kept if any of
|
|
39
|
+
* Removes every reference to `className` from the given `metadataFields`
|
|
40
|
+
* arrays (default `['imports']`) of an Angular decorator, consuming the
|
|
41
|
+
* adjacent comma so the remaining entries stay well-formed, then removes
|
|
42
|
+
* the import of `className` from `moduleName` - but only if nothing else in
|
|
43
|
+
* the file still references it. References outside those decorator arrays
|
|
44
|
+
* (unrelated arrays, a parameter that shadows the import, direct
|
|
45
|
+
* assignments, etc.) are left untouched, and the import is kept if any of
|
|
46
|
+
* those remain.
|
|
31
47
|
*
|
|
32
48
|
* Returns `true` when the import statement was removed, `false` when
|
|
33
49
|
* unhandled references kept it in place.
|
|
34
50
|
*/
|
|
35
|
-
function removeClassReference(recorder, sourceFile, className, moduleName) {
|
|
51
|
+
function removeClassReference(recorder, sourceFile, className, moduleName, metadataFields = ['imports']) {
|
|
36
52
|
const endOfImports = (0, ast_utils_1.findNodes)(sourceFile, typescript_1.default.SyntaxKind.ImportDeclaration).reduce((max, node) => Math.max(max, node.getEnd()), 0);
|
|
37
53
|
const references = (0, ast_utils_1.findNodes)(sourceFile, typescript_1.default.SyntaxKind.Identifier).filter((node) => typescript_1.default.isIdentifier(node) &&
|
|
38
54
|
node.text === className &&
|
|
39
55
|
node.getStart() > endOfImports);
|
|
40
56
|
const decoratorArrayReferences = references.filter((reference) => typescript_1.default.isArrayLiteralExpression(reference.parent) &&
|
|
41
|
-
|
|
57
|
+
isDecoratorMetadataArray(reference.parent, metadataFields));
|
|
42
58
|
const hasUnhandledReference = decoratorArrayReferences.length !== references.length;
|
|
43
59
|
decoratorArrayReferences.forEach((reference) => {
|
|
44
60
|
const parent = reference.parent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-class-reference.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/utility/typescript/remove-class-reference.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"remove-class-reference.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/utility/typescript/remove-class-reference.ts"],"names":[],"mappings":";;AAyDA,oDAqDC;;AA7GD,qEAAkE;AAClE,oEAA4B;AAE5B,mDAA+C;AAE/C;;;;;;;;;;;;;GAaG;AACH,SAAS,wBAAwB,CAC/B,KAAgC,EAChC,cAAiC;IAEjC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC;IAC9B,IACE,CAAC,oBAAE,CAAC,oBAAoB,CAAC,QAAQ,CAAC;QAClC,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EACjD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACpC,IAAI,CAAC,oBAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAE,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IACE,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,SAAS;QACrC,CAAC,CAAC,oBAAE,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,EAC1E,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,oB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