@exhaustive-ui/core 22.0.0-rc.2 → 22.0.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.
- package/README.md +1 -1
- package/fesm2022/exhaustive-ui-core-accordion.mjs +5 -0
- package/fesm2022/exhaustive-ui-core-accordion.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-autocomplete.mjs +12 -14
- package/fesm2022/exhaustive-ui-core-autocomplete.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-avatargroup.mjs +3 -9
- package/fesm2022/exhaustive-ui-core-avatargroup.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-badge.mjs +3 -34
- package/fesm2022/exhaustive-ui-core-badge.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-basecomponent.mjs +3 -0
- package/fesm2022/exhaustive-ui-core-basecomponent.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-baseinput.mjs +27 -7
- package/fesm2022/exhaustive-ui-core-baseinput.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-blockui.mjs +13 -1
- package/fesm2022/exhaustive-ui-core-blockui.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-breadcrumb.mjs +1 -1
- package/fesm2022/exhaustive-ui-core-breadcrumb.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-button.mjs +10 -34
- package/fesm2022/exhaustive-ui-core-button.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-carousel.mjs +5 -0
- package/fesm2022/exhaustive-ui-core-carousel.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-cascadeselect.mjs +25 -11
- package/fesm2022/exhaustive-ui-core-cascadeselect.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-checkbox.mjs +1 -1
- package/fesm2022/exhaustive-ui-core-checkbox.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-config.mjs +1 -8
- package/fesm2022/exhaustive-ui-core-config.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-confirmdialog.mjs +1 -1
- package/fesm2022/exhaustive-ui-core-confirmdialog.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-confirmpopup.mjs +3 -8
- package/fesm2022/exhaustive-ui-core-confirmpopup.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-contextmenu.mjs +16 -3
- package/fesm2022/exhaustive-ui-core-contextmenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dataview.mjs +2 -14
- package/fesm2022/exhaustive-ui-core-dataview.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-datepicker.mjs +38 -4
- package/fesm2022/exhaustive-ui-core-datepicker.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dialog.mjs +12 -7
- package/fesm2022/exhaustive-ui-core-dialog.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dock.mjs +1 -1
- package/fesm2022/exhaustive-ui-core-dock.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dom.mjs +9 -2
- package/fesm2022/exhaustive-ui-core-dom.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-drawer.mjs +6 -6
- package/fesm2022/exhaustive-ui-core-drawer.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs +19 -19
- package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-editor.mjs +11 -0
- package/fesm2022/exhaustive-ui-core-editor.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-fileupload.mjs +4 -1
- package/fesm2022/exhaustive-ui-core-fileupload.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-galleria.mjs +12 -0
- package/fesm2022/exhaustive-ui-core-galleria.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-image.mjs +7 -0
- package/fesm2022/exhaustive-ui-core-image.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-imagecompare.mjs +5 -5
- package/fesm2022/exhaustive-ui-core-imagecompare.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inplace.mjs +6 -32
- package/fesm2022/exhaustive-ui-core-inplace.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputgroupaddon.mjs +3 -9
- package/fesm2022/exhaustive-ui-core-inputgroupaddon.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputmask.mjs +54 -27
- package/fesm2022/exhaustive-ui-core-inputmask.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputnumber.mjs +9 -11
- package/fesm2022/exhaustive-ui-core-inputnumber.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputotp.mjs +8 -3
- package/fesm2022/exhaustive-ui-core-inputotp.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-inputtext.mjs +6 -14
- package/fesm2022/exhaustive-ui-core-inputtext.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-listbox.mjs +53 -20
- package/fesm2022/exhaustive-ui-core-listbox.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-megamenu.mjs +4 -1
- package/fesm2022/exhaustive-ui-core-megamenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-menu.mjs +11 -5
- package/fesm2022/exhaustive-ui-core-menu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-menubar.mjs +8 -2
- package/fesm2022/exhaustive-ui-core-menubar.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-message.mjs +5 -10
- package/fesm2022/exhaustive-ui-core-message.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-metergroup.mjs +3 -0
- package/fesm2022/exhaustive-ui-core-metergroup.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-motion.mjs +10 -1
- package/fesm2022/exhaustive-ui-core-motion.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-multiselect.mjs +77 -38
- package/fesm2022/exhaustive-ui-core-multiselect.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-orderlist.mjs +14 -19
- package/fesm2022/exhaustive-ui-core-orderlist.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-organizationchart.mjs +3 -1
- package/fesm2022/exhaustive-ui-core-organizationchart.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-overlay.mjs +28 -0
- package/fesm2022/exhaustive-ui-core-overlay.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-panel.mjs +12 -2
- package/fesm2022/exhaustive-ui-core-panel.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-panelmenu.mjs +61 -13
- package/fesm2022/exhaustive-ui-core-panelmenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-password.mjs +37 -26
- package/fesm2022/exhaustive-ui-core-password.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-picklist.mjs +11 -25
- package/fesm2022/exhaustive-ui-core-picklist.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-popover.mjs +2 -2
- package/fesm2022/exhaustive-ui-core-popover.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-radiobutton.mjs +8 -4
- package/fesm2022/exhaustive-ui-core-radiobutton.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-scroller.mjs +91 -10
- package/fesm2022/exhaustive-ui-core-scroller.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-select.mjs +36 -4
- package/fesm2022/exhaustive-ui-core-select.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-selectbutton.mjs +3 -8
- package/fesm2022/exhaustive-ui-core-selectbutton.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-slider.mjs +6 -0
- package/fesm2022/exhaustive-ui-core-slider.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-speeddial.mjs +1 -1
- package/fesm2022/exhaustive-ui-core-speeddial.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-splitbutton.mjs +1 -1
- package/fesm2022/exhaustive-ui-core-splitbutton.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-stepper.mjs +7 -11
- package/fesm2022/exhaustive-ui-core-stepper.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-steps.mjs +1 -1
- package/fesm2022/exhaustive-ui-core-steps.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-table.mjs +227 -32
- package/fesm2022/exhaustive-ui-core-table.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tabs.mjs +16 -1
- package/fesm2022/exhaustive-ui-core-tabs.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-textarea.mjs +1 -1
- package/fesm2022/exhaustive-ui-core-textarea.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tieredmenu.mjs +60 -16
- package/fesm2022/exhaustive-ui-core-tieredmenu.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-toast.mjs +6 -2
- package/fesm2022/exhaustive-ui-core-toast.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-toggleswitch.mjs +2 -9
- package/fesm2022/exhaustive-ui-core-toggleswitch.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tooltip.mjs +9 -17
- package/fesm2022/exhaustive-ui-core-tooltip.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-tree.mjs +99 -28
- package/fesm2022/exhaustive-ui-core-tree.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-treeselect.mjs +1 -1
- package/fesm2022/exhaustive-ui-core-treeselect.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-treetable.mjs +75 -19
- package/fesm2022/exhaustive-ui-core-treetable.mjs.map +1 -1
- package/fesm2022/exhaustive-ui-core-utils.mjs +15 -0
- package/fesm2022/exhaustive-ui-core-utils.mjs.map +1 -1
- package/package.json +5 -5
- package/schematics/collection.json +1 -1
- package/schematics/migrate-from-primeng/index.js +2 -16
- package/schematics/migrate-from-primeng/schema.json +1 -2
- package/schematics/migrations/config-input-style-to-variant/migration.js +70 -0
- package/schematics/migrations/remove-dead-inputs/migration.js +46 -7
- package/schematics/migrations/removed-exports/migration.js +73 -0
- package/schematics/migrations/renamed-inputs/migration.js +54 -3
- package/schematics/migrations/renamed-outputs/migration.js +89 -0
- package/schematics/migrations/renamed-templates/migration.js +59 -0
- package/schematics/migrations/styleclass-to-class/migration.js +5 -0
- package/schematics/migrations.json +23 -3
- package/schematics/utils/config-signal.js +115 -0
- package/schematics/utils/removed-exports.js +172 -0
- package/schematics/utils/removed-inputs.js +0 -0
- package/schematics/utils/renamed-inputs.js +20 -9
- package/schematics/utils/renamed-outputs.js +154 -0
- package/schematics/utils/renamed-templates.js +142 -0
- package/schematics/utils/versions.json +8 -8
- package/types/exhaustive-ui-core-api.d.ts +0 -10
- package/types/exhaustive-ui-core-autocomplete.d.ts +4 -9
- package/types/exhaustive-ui-core-avatargroup.d.ts +1 -6
- package/types/exhaustive-ui-core-badge.d.ts +1 -14
- package/types/exhaustive-ui-core-basecomponent.d.ts +3 -0
- package/types/exhaustive-ui-core-baseinput.d.ts +3 -3
- package/types/exhaustive-ui-core-button.d.ts +4 -25
- package/types/exhaustive-ui-core-cascadeselect.d.ts +5 -2
- package/types/exhaustive-ui-core-config.d.ts +0 -8
- package/types/exhaustive-ui-core-confirmpopup.d.ts +1 -6
- package/types/exhaustive-ui-core-contextmenu.d.ts +3 -0
- package/types/exhaustive-ui-core-dataview.d.ts +1 -11
- package/types/exhaustive-ui-core-datepicker.d.ts +1 -0
- package/types/exhaustive-ui-core-dialog.d.ts +1 -1
- package/types/exhaustive-ui-core-drawer.d.ts +2 -2
- package/types/exhaustive-ui-core-dynamicdialog.d.ts +3 -12
- package/types/exhaustive-ui-core-editor.d.ts +5 -0
- package/types/exhaustive-ui-core-fileupload.d.ts +3 -0
- package/types/exhaustive-ui-core-galleria.d.ts +12 -0
- package/types/exhaustive-ui-core-image.d.ts +1 -0
- package/types/exhaustive-ui-core-imagecompare.d.ts +2 -2
- package/types/exhaustive-ui-core-inplace.d.ts +3 -11
- package/types/exhaustive-ui-core-inputgroupaddon.d.ts +1 -6
- package/types/exhaustive-ui-core-inputmask.d.ts +2 -2
- package/types/exhaustive-ui-core-inputtext.d.ts +3 -10
- package/types/exhaustive-ui-core-listbox.d.ts +12 -6
- package/types/exhaustive-ui-core-megamenu.d.ts +3 -0
- package/types/exhaustive-ui-core-menu.d.ts +6 -11
- package/types/exhaustive-ui-core-menubar.d.ts +5 -11
- package/types/exhaustive-ui-core-message.d.ts +1 -8
- package/types/exhaustive-ui-core-metergroup.d.ts +3 -0
- package/types/exhaustive-ui-core-multiselect.d.ts +13 -10
- package/types/exhaustive-ui-core-orderlist.d.ts +2 -12
- package/types/exhaustive-ui-core-organizationchart.d.ts +3 -1
- package/types/exhaustive-ui-core-overlay.d.ts +8 -0
- package/types/exhaustive-ui-core-panel.d.ts +2 -0
- package/types/exhaustive-ui-core-panelmenu.d.ts +9 -0
- package/types/exhaustive-ui-core-password.d.ts +19 -14
- package/types/exhaustive-ui-core-picklist.d.ts +1 -16
- package/types/exhaustive-ui-core-radiobutton.d.ts +4 -1
- package/types/exhaustive-ui-core-scroller.d.ts +10 -0
- package/types/exhaustive-ui-core-select.d.ts +11 -27
- package/types/exhaustive-ui-core-selectbutton.d.ts +1 -6
- package/types/exhaustive-ui-core-stepper.d.ts +3 -11
- package/types/exhaustive-ui-core-table.d.ts +32 -4
- package/types/exhaustive-ui-core-tieredmenu.d.ts +8 -0
- package/types/exhaustive-ui-core-toast.d.ts +3 -0
- package/types/exhaustive-ui-core-toggleswitch.d.ts +1 -7
- package/types/exhaustive-ui-core-tooltip.d.ts +3 -10
- package/types/exhaustive-ui-core-tree.d.ts +17 -1
- package/types/exhaustive-ui-core-treetable.d.ts +24 -5
- package/types/exhaustive-ui-core-types-multiselect.d.ts +0 -6
- package/types/exhaustive-ui-core-types-table.d.ts +1 -1
- package/types/exhaustive-ui-core-types-tree.d.ts +5 -0
- package/types/exhaustive-ui-core-utils.d.ts +15 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RENAMED_OUTPUT_GROUPS = void 0;
|
|
4
|
+
exports.default = default_1;
|
|
5
|
+
const package_json_1 = require("../../utils/package-json");
|
|
6
|
+
const removed_outputs_1 = require("../../utils/removed-outputs");
|
|
7
|
+
const renamed_outputs_1 = require("../../utils/renamed-outputs");
|
|
8
|
+
const ORDERLIST = ['p-orderList', 'p-orderlist', 'p-order-list'];
|
|
9
|
+
const MULTISELECT = ['p-multiSelect', 'p-multiselect', 'p-multi-select'];
|
|
10
|
+
/**
|
|
11
|
+
* Outputs renamed in this version to the name the other components already use. The payloads are
|
|
12
|
+
* unchanged, so `$event` keeps the same shape:
|
|
13
|
+
* OrderList's `onFilterEvent` → `onFilter` (still an `OrderListFilterEvent`), Table's
|
|
14
|
+
* `selectAllChange` → `onSelectAllChange` (still `{ originalEvent, checked }`, as on Listbox and
|
|
15
|
+
* MultiSelect), MultiSelect's `onPanelShow`/`onPanelHide` → `onShow`/`onHide` (still the overlay's
|
|
16
|
+
* animation event, the payload Select's `onShow`/`onHide` emit too).
|
|
17
|
+
*/
|
|
18
|
+
exports.RENAMED_OUTPUT_GROUPS = [
|
|
19
|
+
...ORDERLIST.map((selector) => ({ selector, renames: [{ from: 'onFilterEvent', to: 'onFilter' }] })),
|
|
20
|
+
{ selector: 'p-table', renames: [{ from: 'selectAllChange', to: 'onSelectAllChange' }] },
|
|
21
|
+
...MULTISELECT.map((selector) => ({
|
|
22
|
+
selector,
|
|
23
|
+
renames: [
|
|
24
|
+
{ from: 'onPanelShow', to: 'onShow' },
|
|
25
|
+
{ from: 'onPanelHide', to: 'onHide' }
|
|
26
|
+
]
|
|
27
|
+
}))
|
|
28
|
+
];
|
|
29
|
+
/** Names searched for in TypeScript code outside templates (e.g. `multiSelect.onPanelShow.subscribe(...)`), reported for manual review. */
|
|
30
|
+
const LEFTOVER_SCAN_NAMES = ['onFilterEvent', 'selectAllChange', 'onPanelShow', 'onPanelHide'];
|
|
31
|
+
/**
|
|
32
|
+
* Rewrites `(old)="..."` event bindings of the outputs listed in {@link RENAMED_OUTPUT_GROUPS} to
|
|
33
|
+
* their new name, keeping the handler expression. A `[(selectAll)]` two-way binding on p-table
|
|
34
|
+
* relied on the old `selectAllChange` name; it is reported for manual review, since the event
|
|
35
|
+
* carries `{ originalEvent, checked }` rather than a boolean and the two-way form never assigned the
|
|
36
|
+
* right value: bind `[selectAll]` and `(onSelectAllChange)="selectAll = $event.checked"` instead.
|
|
37
|
+
*/
|
|
38
|
+
function default_1() {
|
|
39
|
+
return (tree, context) => {
|
|
40
|
+
let filesChanged = 0;
|
|
41
|
+
let renamedCount = 0;
|
|
42
|
+
const twoWay = [];
|
|
43
|
+
const leftovers = [];
|
|
44
|
+
tree.visit((path) => {
|
|
45
|
+
if (package_json_1.SKIP_DIRS.test(path)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const isHtml = path.endsWith('.html');
|
|
49
|
+
if (!isHtml && !path.endsWith('.ts') && !path.endsWith('.mts')) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const original = tree.read(path)?.toString();
|
|
53
|
+
if (original === undefined) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const result = isHtml ? (0, renamed_outputs_1.renameOutputsInHtml)(original, exports.RENAMED_OUTPUT_GROUPS) : (0, renamed_outputs_1.renameOutputsInTypeScript)(path, original, exports.RENAMED_OUTPUT_GROUPS);
|
|
57
|
+
if (result.changed) {
|
|
58
|
+
tree.overwrite(path, result.text);
|
|
59
|
+
filesChanged++;
|
|
60
|
+
renamedCount += result.renamed.length;
|
|
61
|
+
context.logger.info(`${path}: renamed ${result.renamed.join(', ')}`);
|
|
62
|
+
}
|
|
63
|
+
const twoWayLines = isHtml ? (0, renamed_outputs_1.findTwoWayBindings)(result.text, 'p-table', 'selectAll') : (0, renamed_outputs_1.findTwoWayBindingsInTypeScript)(path, result.text, 'p-table', 'selectAll');
|
|
64
|
+
twoWay.push(...twoWayLines.map((line) => `${path}:${line}`));
|
|
65
|
+
if (!isHtml) {
|
|
66
|
+
leftovers.push(...(0, removed_outputs_1.findLeftoversInTypeScript)(path, result.text, LEFTOVER_SCAN_NAMES).map((line) => `${path}:${line}`));
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
if (renamedCount > 0) {
|
|
70
|
+
context.logger.info(`Renamed ${renamedCount} output binding(s) across ${filesChanged} file(s).`);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
context.logger.info('No bindings of the renamed outputs were found to rename.');
|
|
74
|
+
}
|
|
75
|
+
if (twoWay.length > 0) {
|
|
76
|
+
context.logger.warn(`Found ${twoWay.length} p-table [(selectAll)] binding(s): the change event is now onSelectAllChange and carries { originalEvent, checked }, so bind [selectAll]="x" (onSelectAllChange)="x = $event.checked" instead:`);
|
|
77
|
+
for (const entry of twoWay) {
|
|
78
|
+
context.logger.warn(` ${entry}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (leftovers.length > 0) {
|
|
82
|
+
context.logger.warn(`Found ${leftovers.length} programmatic reference(s) to a renamed output (onFilterEvent → onFilter, selectAllChange → onSelectAllChange, onPanelShow/onPanelHide → onShow/onHide) that need manual review:`);
|
|
83
|
+
for (const leftover of leftovers) {
|
|
84
|
+
context.logger.warn(` ${leftover}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return tree;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RENAMED_TEMPLATE_GROUPS = void 0;
|
|
4
|
+
exports.default = default_1;
|
|
5
|
+
const package_json_1 = require("../../utils/package-json");
|
|
6
|
+
const renamed_templates_1 = require("../../utils/renamed-templates");
|
|
7
|
+
/**
|
|
8
|
+
* Templates removed in this version in favor of the name their deprecation pointed to. MultiSelect's
|
|
9
|
+
* `removetokenicon` → `chipicon`: both received the same `{ class }` context and rendered the same
|
|
10
|
+
* chip remove icon (chipicon won when both were given).
|
|
11
|
+
*/
|
|
12
|
+
exports.RENAMED_TEMPLATE_GROUPS = ['p-multiSelect', 'p-multiselect', 'p-multi-select'].map((selector) => ({ selector, renames: [{ from: 'removetokenicon', to: 'chipicon' }] }));
|
|
13
|
+
/**
|
|
14
|
+
* Renames the templates listed in {@link RENAMED_TEMPLATE_GROUPS} inside the matching elements:
|
|
15
|
+
* `<ng-template #removetokenicon>` and `<ng-template pTemplate="removetokenicon">` become
|
|
16
|
+
* `#chipicon` / `pTemplate="chipicon"`. An element that already projects a `chipicon` template is
|
|
17
|
+
* reported instead: the removed one was never rendered there, delete it by hand.
|
|
18
|
+
*/
|
|
19
|
+
function default_1() {
|
|
20
|
+
return (tree, context) => {
|
|
21
|
+
let filesChanged = 0;
|
|
22
|
+
let renamedCount = 0;
|
|
23
|
+
const conflicts = [];
|
|
24
|
+
tree.visit((path) => {
|
|
25
|
+
if (package_json_1.SKIP_DIRS.test(path)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const isHtml = path.endsWith('.html');
|
|
29
|
+
if (!isHtml && !path.endsWith('.ts') && !path.endsWith('.mts')) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const original = tree.read(path)?.toString();
|
|
33
|
+
if (original === undefined) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const result = isHtml ? (0, renamed_templates_1.renameTemplatesInHtml)(original, exports.RENAMED_TEMPLATE_GROUPS) : (0, renamed_templates_1.renameTemplatesInTypeScript)(path, original, exports.RENAMED_TEMPLATE_GROUPS);
|
|
37
|
+
if (result.changed) {
|
|
38
|
+
tree.overwrite(path, result.text);
|
|
39
|
+
filesChanged++;
|
|
40
|
+
renamedCount += result.renamed.length;
|
|
41
|
+
context.logger.info(`${path}: renamed ${result.renamed.join(', ')} template(s)`);
|
|
42
|
+
}
|
|
43
|
+
conflicts.push(...result.conflictLines.map((line) => `${path}:${line}`));
|
|
44
|
+
});
|
|
45
|
+
if (renamedCount > 0) {
|
|
46
|
+
context.logger.info(`Renamed ${renamedCount} template(s) across ${filesChanged} file(s).`);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
context.logger.info('No removed templates were found to rename.');
|
|
50
|
+
}
|
|
51
|
+
if (conflicts.length > 0) {
|
|
52
|
+
context.logger.warn(`Found ${conflicts.length} p-multiselect element(s) projecting both a removetokenicon and a chipicon template — only chipicon was rendered, delete the removetokenicon one:`);
|
|
53
|
+
for (const conflict of conflicts) {
|
|
54
|
+
context.logger.warn(` ${conflict}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return tree;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -9,22 +9,42 @@
|
|
|
9
9
|
"styleclass-to-class": {
|
|
10
10
|
"version": "22.0.0",
|
|
11
11
|
"factory": "./migrations/styleclass-to-class/migration",
|
|
12
|
-
"description": "Rewrite styleClass/[styleClass] to class/[class] on selectors whose styleClass input was removed in this version in favor of the native class attribute: p-toast, p-message, p-tag, p-skeleton, p-card, p-radiobutton/p-radioButton/p-radio-button, p-progressbar/p-progressBar/p-progress-bar, p-divider, p-progressspinner/p-progressSpinner/p-progress-spinner, p-timeline, p-toolbar, p-avatar, p-chip, p-inputgroup/p-inputGroup/p-input-group, p-iconfield/p-iconField/p-icon-field, p-inputicon/p-inputIcon/p-input-icon, p-toggleswitch/p-toggleSwitch/p-toggle-switch, p-colorpicker/p-colorPicker/p-color-picker, p-metergroup/p-meterGroup/p-meter-group, p-inplace, p-togglebutton/p-toggleButton/p-toggle-button, p-terminal, p-blockui/p-blockUI/p-block-ui, p-badge, p-checkbox/p-checkBox/p-check-box, p-panel, p-dock, p-accordion, p-knob, p-splitter, p-scrollpanel/p-scrollPanel/p-scroll-panel, p-image, p-editor, p-slider, p-paginator, p-organizationchart/p-organizationChart/p-organization-chart, p-carousel, p-dataview/p-dataView/p-data-view, p-splitbutton/p-splitButton/p-split-button, p-password, p-inputnumber/p-inputNumber/p-input-number, p-menubar, p-panelmenu/p-panelMenu/p-panel-menu, p-megamenu/p-megaMenu/p-mega-menu, p-cascadeselect/p-cascadeSelect/p-cascade-select, p-datepicker/p-datePicker/p-date-picker, p-tree, p-select, p-listbox/p-listBox/p-list-box, p-orderlist/p-orderList/p-order-list, p-table, p-autocomplete/p-autoComplete/p-auto-complete, p-multiselect/p-multiSelect/p-multi-select and p-treetable/p-treeTable/p-tree-table."
|
|
12
|
+
"description": "Rewrite styleClass/[styleClass] to class/[class] on selectors whose styleClass input was removed in this version in favor of the native class attribute: p-toast, p-message, p-tag, p-skeleton, p-card, p-radiobutton/p-radioButton/p-radio-button, p-progressbar/p-progressBar/p-progress-bar, p-divider, p-progressspinner/p-progressSpinner/p-progress-spinner, p-timeline, p-toolbar, p-avatar, p-avatarGroup/p-avatar-group/p-avatargroup, p-inputgroup-addon/p-inputGroupAddon, p-chip, p-inputgroup/p-inputGroup/p-input-group, p-iconfield/p-iconField/p-icon-field, p-inputicon/p-inputIcon/p-input-icon, p-toggleswitch/p-toggleSwitch/p-toggle-switch, p-colorpicker/p-colorPicker/p-color-picker, p-metergroup/p-meterGroup/p-meter-group, p-inplace, p-togglebutton/p-toggleButton/p-toggle-button, p-terminal, p-blockui/p-blockUI/p-block-ui, p-badge, p-checkbox/p-checkBox/p-check-box, p-panel, p-dock, p-accordion, p-knob, p-splitter, p-scrollpanel/p-scrollPanel/p-scroll-panel, p-image, p-editor, p-slider, p-paginator, p-organizationchart/p-organizationChart/p-organization-chart, p-carousel, p-dataview/p-dataView/p-data-view, p-splitbutton/p-splitButton/p-split-button, p-password, p-inputnumber/p-inputNumber/p-input-number, p-menubar, p-panelmenu/p-panelMenu/p-panel-menu, p-megamenu/p-megaMenu/p-mega-menu, p-cascadeselect/p-cascadeSelect/p-cascade-select, p-datepicker/p-datePicker/p-date-picker, p-tree, p-select, p-listbox/p-listBox/p-list-box, p-orderlist/p-orderList/p-order-list, p-table, p-autocomplete/p-autoComplete/p-auto-complete, p-multiselect/p-multiSelect/p-multi-select and p-treetable/p-treeTable/p-tree-table."
|
|
13
13
|
},
|
|
14
14
|
"remove-dead-inputs": {
|
|
15
15
|
"version": "22.0.0",
|
|
16
16
|
"factory": "./migrations/remove-dead-inputs/migration",
|
|
17
|
-
"description": "Remove usages of inputs removed in this version that had already stopped doing anything: showTransformOptions, hideTransformOptions, showTransitionOptions and hideTransitionOptions of p-toast; showTransformOptions, hideTransformOptions, showTransitionOptions and hideTransitionOptions of p-toastItem; showTransitionOptions and hideTransitionOptions of p-message; showTransitionOptions and hideTransitionOptions of p-overlay; showTransitionOptions and hideTransitionOptions of p-colorPicker/p-colorpicker/p-color-picker; size of p-overlayBadge/p-overlay-badge/p-overlaybadge; transitionOptions of p-fieldset; transitionOptions of p-panel; transitionOptions of p-accordion; showTransitionOptions and hideTransitionOptions of p-scrollTop/p-scrolltop/p-scroll-top; showTransitionOptions and hideTransitionOptions of p-confirmpopup; inputId of p-togglebutton/p-toggleButton/p-toggle-button; showTransitionOptions, hideTransitionOptions and ariaCloseLabel of p-popover; showTransitionOptions, hideTransitionOptions, modalEnterAnimation and modalLeaveAnimation of p-image; transitionOptions of p-drawer; showTransitionOptions and hideTransitionOptions of p-menu; showTransitionOptions, hideTransitionOptions and plain of p-splitbutton/p-splitButton/p-split-button; showTransitionOptions and hideTransitionOptions of p-password; badgeClass of p-button; autoZIndex, baseZIndex and popup of p-contextMenuSub/p-contextmenu-sub; showTransitionOptions and hideTransitionOptions of p-tieredMenu/p-tieredmenu/p-tiered-menu; autoZIndex and baseZIndex of p-menubar; autoZIndex, baseZIndex, mobileActive, ariaLabel and ariaLabelledBy of p-menubarSub/p-menubarsub; transitionOptions and tabindex of p-panelMenu/p-panelmenu/p-panel-menu; disabled and queryMatches of p-megaMenuSub/p-megamenu-sub; showTransitionOptions, hideTransitionOptions and containerClass of p-galleria; removeStyleClass of p-fileupload/p-fileUpload; inputLabel and emptyMessage of p-cascadeSelect/p-cascadeselect/p-cascade-select; showTransitionOptions and hideTransitionOptions of p-datePicker/p-datepicker/p-date-picker; transitionOptions and rtl of p-dialog; closeAriaLabel, acceptAriaLabel, rejectAriaLabel, rtl, transitionOptions, focusTrap and defaultFocus of p-confirmDialog/p-confirmdialog/p-confirm-dialog; rowNode, root, firstChild and lastChild of p-treeNode; visible and itemSize of p-selectItem; frozenColumns and frozenWidth of p-table; autoZIndex, baseZIndex, showTransitionOptions and hideTransitionOptions of p-autoComplete/p-autocomplete/p-auto-complete; filterFields of p-multiSelect/p-multiselect/p-multi-select. The dead dir input of p-splitbutton/p-splitButton/p-split-button is removed too, but its dir/[dir] bindings are left in place: they keep working as the host element's native dir attribute. Programmatic reads/writes of the removed names are reported for manual review."
|
|
17
|
+
"description": "Remove usages of inputs removed in this version that had already stopped doing anything: showTransformOptions, hideTransformOptions, showTransitionOptions and hideTransitionOptions of p-toast; showTransformOptions, hideTransformOptions, showTransitionOptions and hideTransitionOptions of p-toastItem; showTransitionOptions and hideTransitionOptions of p-message; showTransitionOptions and hideTransitionOptions of p-overlay; showTransitionOptions and hideTransitionOptions of p-colorPicker/p-colorpicker/p-color-picker; size of p-overlayBadge/p-overlay-badge/p-overlaybadge; transitionOptions of p-fieldset; transitionOptions of p-panel; transitionOptions of p-accordion; showTransitionOptions and hideTransitionOptions of p-scrollTop/p-scrolltop/p-scroll-top; showTransitionOptions and hideTransitionOptions of p-confirmpopup; inputId of p-togglebutton/p-toggleButton/p-toggle-button; showTransitionOptions, hideTransitionOptions and ariaCloseLabel of p-popover; showTransitionOptions, hideTransitionOptions, modalEnterAnimation and modalLeaveAnimation of p-image; transitionOptions of p-drawer; showTransitionOptions and hideTransitionOptions of p-menu; showTransitionOptions, hideTransitionOptions and plain of p-splitbutton/p-splitButton/p-split-button; showTransitionOptions and hideTransitionOptions of p-password; badgeClass of p-button; autoZIndex, baseZIndex and popup of p-contextMenuSub/p-contextmenu-sub; showTransitionOptions and hideTransitionOptions of p-tieredMenu/p-tieredmenu/p-tiered-menu; autoZIndex and baseZIndex of p-menubar; autoZIndex, baseZIndex, mobileActive, ariaLabel and ariaLabelledBy of p-menubarSub/p-menubarsub; transitionOptions and tabindex of p-panelMenu/p-panelmenu/p-panel-menu; disabled and queryMatches of p-megaMenuSub/p-megamenu-sub; showTransitionOptions, hideTransitionOptions and containerClass of p-galleria; removeStyleClass of p-fileupload/p-fileUpload; inputLabel and emptyMessage of p-cascadeSelect/p-cascadeselect/p-cascade-select; showTransitionOptions and hideTransitionOptions of p-datePicker/p-datepicker/p-date-picker; transitionOptions and rtl of p-dialog; closeAriaLabel, acceptAriaLabel, rejectAriaLabel, rtl, transitionOptions, focusTrap and defaultFocus of p-confirmDialog/p-confirmdialog/p-confirm-dialog; rowNode, root, firstChild and lastChild of p-treeNode; visible and itemSize of p-selectItem; frozenColumns and frozenWidth of p-table; autoZIndex, baseZIndex, showTransitionOptions and hideTransitionOptions of p-autoComplete/p-autocomplete/p-auto-complete; filterFields of p-multiSelect/p-multiselect/p-multi-select; transitionOptions of p-stepper; autoHighlight of p-autoComplete/p-autocomplete/p-auto-complete; searchLocale of p-listbox/p-listBox/p-list-box; gridStyleClass and trackBy of p-dataView/p-dataview/p-data-view; trackBy and header of p-orderList/p-orderlist/p-order-list; trackBy, sourceTrackBy and targetTrackBy of p-pickList/p-picklist/p-pick-list; size of p-toggleswitch/p-toggleSwitch/p-toggle-switch; tabindex of p-selectButton/p-selectbutton/p-select-button; baseZIndex of p-confirmpopup; ariaLabelAsc and ariaLabelDesc of p-treeTableSortIcon/p-treetable-sort-icon/p-tree-table-sort-icon. The dead dir input of p-splitbutton/p-splitButton/p-split-button is removed too, but its dir/[dir] bindings are left in place: they keep working as the host element's native dir attribute. Programmatic reads/writes of the removed names are reported for manual review."
|
|
18
18
|
},
|
|
19
19
|
"config-overlay-options-signal": {
|
|
20
20
|
"version": "22.0.0",
|
|
21
21
|
"factory": "./migrations/config-overlay-options-signal/migration",
|
|
22
22
|
"description": "Rewrite programmatic access to Exhaustive.overlayOptions, which is a signal in this version: assignments become .set(value) and reads become () calls."
|
|
23
23
|
},
|
|
24
|
+
"renamed-outputs": {
|
|
25
|
+
"version": "22.0.0",
|
|
26
|
+
"factory": "./migrations/renamed-outputs/migration",
|
|
27
|
+
"description": "Rename event bindings of outputs renamed in this version to the name the other components use: onFilterEvent to onFilter on p-orderList/p-orderlist/p-order-list; selectAllChange to onSelectAllChange on p-table; onPanelShow to onShow and onPanelHide to onHide on p-multiSelect/p-multiselect/p-multi-select. The event payloads are unchanged, so $event keeps working. A p-table [(selectAll)] two-way binding, which relied on selectAllChange, is reported for manual review, as are programmatic references to the old names."
|
|
28
|
+
},
|
|
29
|
+
"config-input-style-to-variant": {
|
|
30
|
+
"version": "22.0.0",
|
|
31
|
+
"factory": "./migrations/config-input-style-to-variant/migration",
|
|
32
|
+
"description": "Rename the global inputStyle option, removed in this version, to inputVariant (same values): the inputStyle key of provideExhaustive()/setConfig() config objects, and reads and writes of Exhaustive.inputStyle. Config objects that set both names, receivers that cannot be proven to be the Exhaustive service and template reads are reported for manual review."
|
|
33
|
+
},
|
|
34
|
+
"renamed-templates": {
|
|
35
|
+
"version": "22.0.0",
|
|
36
|
+
"factory": "./migrations/renamed-templates/migration",
|
|
37
|
+
"description": "Rename templates removed in this version to their replacement inside the elements that project them: the removetokenicon template (#removetokenicon or pTemplate=\"removetokenicon\") becomes chipicon in p-multiSelect/p-multiselect/p-multi-select; both receive the same context. An element that already projects a chipicon template is reported for manual review."
|
|
38
|
+
},
|
|
39
|
+
"removed-exports": {
|
|
40
|
+
"version": "22.0.0",
|
|
41
|
+
"factory": "./migrations/removed-exports/migration",
|
|
42
|
+
"description": "Update imports of exports renamed or removed in this version: Password_VALUE_ACCESSOR becomes PASSWORD_VALUE_ACCESSOR; the empty InplaceDisplay/InplaceContent wrapper components are dropped from imports and their <p-inplacedisplay>/<p-inplacecontent> elements become <span> (Inplace projects the pInplaceDisplay/pInplaceContent attributes). Imports of rendering internals that are no longer exported (the SelectItem option component of Select, SafeHtmlPipe, MapperPipe, RadioControlRegistry, MenubarService) are reported for manual review."
|
|
43
|
+
},
|
|
24
44
|
"renamed-inputs": {
|
|
25
45
|
"version": "22.0.0",
|
|
26
46
|
"factory": "./migrations/renamed-inputs/migration",
|
|
27
|
-
"description": "Rename bindings of deprecated input aliases removed in this version to their replacement: showCloseIcon to closable on p-drawer; dropdownAppendTo to appendTo on p-paginator; maxLength to maxlength on p-password; minLength to minQueryLength on p-autoComplete/p-autocomplete/p-auto-complete; containerStyleClass to class and containerStyle to style on p-treeSelect/p-treeselect/p-tree-select; virtualRowHeight to virtualScrollItemSize on p-treeTable/p-treetable/p-tree-table. A tag that already binds the replacement is reported for manual review, as are programmatic reads/writes of the removed names."
|
|
47
|
+
"description": "Rename bindings of deprecated input aliases removed in this version to their replacement: showCloseIcon to closable on p-drawer; dropdownAppendTo to appendTo on p-paginator; maxLength to maxlength on p-password; minLength to minQueryLength on p-autoComplete/p-autocomplete/p-auto-complete; containerStyleClass to class and containerStyle to style on p-treeSelect/p-treeselect/p-tree-select; virtualRowHeight to virtualScrollItemSize on p-treeTable/p-treetable/p-tree-table; filterPlaceHolder to filterPlaceholder on p-listbox/p-listBox/p-list-box and p-multiSelect/p-multiselect/p-multi-select; ariaLabelledby to ariaLabelledBy on p-imageCompare/p-imagecompare/p-image-compare; ariaCloseLabel to closeAriaLabel on p-drawer; content (the alias that set the header template) to headerTemplate on p-dialog; the deprecated pass-through aliases of attribute directives on any element carrying them: ptButtonDirective to pButtonPT on [pButton], ptButtonLabel to pButtonLabelPT on [pButtonLabel], ptButtonIcon to pButtonIconPT on [pButtonIcon], ptBadgeDirective to pBadgePT on [pBadge], ptInputText to pInputTextPT on [pInputText], ptTooltip to pTooltipPT on [pTooltip]; size to badgeSize on [pBadge] placed on a plain element (on a component or an input/select, size belongs to the element). A tag that already binds the replacement is reported for manual review, as are programmatic reads/writes of the removed names."
|
|
28
48
|
}
|
|
29
49
|
}
|
|
30
50
|
}
|
|
@@ -34,6 +34,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.rewriteConfigPropertyToSignal = rewriteConfigPropertyToSignal;
|
|
37
|
+
exports.renameConfigProperty = renameConfigProperty;
|
|
38
|
+
exports.findConfigPropertyAccessesInHtml = findConfigPropertyAccessesInHtml;
|
|
39
|
+
exports.findConfigPropertyAccessesInTypeScript = findConfigPropertyAccessesInTypeScript;
|
|
37
40
|
exports.findConfigPropertyLeftoversInHtml = findConfigPropertyLeftoversInHtml;
|
|
38
41
|
exports.findConfigPropertyLeftoversInTypeScript = findConfigPropertyLeftoversInTypeScript;
|
|
39
42
|
const ts = __importStar(require("typescript"));
|
|
@@ -115,6 +118,118 @@ function rewriteConfigPropertyToSignal(fileName, text, target) {
|
|
|
115
118
|
}
|
|
116
119
|
return { text: result, changed: true, writes, reads, leftovers };
|
|
117
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Renames a config-service property replaced by another one of the same shape, inside one
|
|
123
|
+
* TypeScript source file:
|
|
124
|
+
* - `x.from` becomes `x.to` wherever `x` is provably the service (same rules as
|
|
125
|
+
* rewriteConfigPropertyToSignal), so `config.from()` / `config.from.set(v)` keep working;
|
|
126
|
+
* - a `from` key of an object literal passed directly to one of `configCalls`
|
|
127
|
+
* (`provideExhaustive({ from: v })`, `config.setConfig({ from })`) becomes `to`.
|
|
128
|
+
*
|
|
129
|
+
* Reported instead: accesses on a receiver that only looks like a config object, and object
|
|
130
|
+
* literals that already set `to` next to `from` (the author has to pick one).
|
|
131
|
+
*/
|
|
132
|
+
function renameConfigProperty(fileName, text, target) {
|
|
133
|
+
const sourceFile = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, true);
|
|
134
|
+
const bindings = collectServiceBindings(sourceFile, target.className);
|
|
135
|
+
const edits = [];
|
|
136
|
+
const leftovers = [];
|
|
137
|
+
let renamed = 0;
|
|
138
|
+
const isServiceReceiver = (expression) => {
|
|
139
|
+
const unwrapped = unwrap(expression);
|
|
140
|
+
if (isInjectCall(unwrapped, target.className)) {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
if (ts.isIdentifier(unwrapped)) {
|
|
144
|
+
return bindings.resolvesIdentifier(unwrapped);
|
|
145
|
+
}
|
|
146
|
+
if (ts.isPropertyAccessExpression(unwrapped) && unwrap(unwrapped.expression).kind === ts.SyntaxKind.ThisKeyword) {
|
|
147
|
+
return bindings.resolvesMember(unwrapped);
|
|
148
|
+
}
|
|
149
|
+
return false;
|
|
150
|
+
};
|
|
151
|
+
const isConfigCallArgument = (node) => {
|
|
152
|
+
const call = node.parent;
|
|
153
|
+
if (!call || !ts.isCallExpression(call) || !call.arguments.includes(node)) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
const callee = call.expression;
|
|
157
|
+
const name = ts.isIdentifier(callee) ? callee.text : ts.isPropertyAccessExpression(callee) ? callee.name.text : undefined;
|
|
158
|
+
return name !== undefined && target.configCalls.includes(name);
|
|
159
|
+
};
|
|
160
|
+
const keyOf = (property) => (property.name && (ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)) ? property.name.text : undefined);
|
|
161
|
+
const visit = (node) => {
|
|
162
|
+
if (ts.isPropertyAccessExpression(node) && node.name.text === target.from) {
|
|
163
|
+
if (isServiceReceiver(node.expression)) {
|
|
164
|
+
edits.push({ start: node.name.getStart(sourceFile), end: node.name.getEnd(), replacement: target.to });
|
|
165
|
+
renamed++;
|
|
166
|
+
}
|
|
167
|
+
else if (looksLikeConfigReceiver(node.expression, sourceFile)) {
|
|
168
|
+
leftovers.push(lineOf(sourceFile, node));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
else if (ts.isObjectLiteralExpression(node) && isConfigCallArgument(node)) {
|
|
172
|
+
const old = node.properties.filter((property) => keyOf(property) === target.from);
|
|
173
|
+
if (old.length > 0 && node.properties.some((property) => keyOf(property) === target.to)) {
|
|
174
|
+
leftovers.push(lineOf(sourceFile, old[0]));
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
for (const property of old) {
|
|
178
|
+
if (ts.isShorthandPropertyAssignment(property)) {
|
|
179
|
+
edits.push({ start: property.name.getStart(sourceFile), end: property.name.getEnd(), replacement: `${target.to}: ${target.from}` });
|
|
180
|
+
}
|
|
181
|
+
else if (property.name) {
|
|
182
|
+
const quote = ts.isStringLiteral(property.name) ? property.name.getText(sourceFile)[0] : '';
|
|
183
|
+
edits.push({ start: property.name.getStart(sourceFile), end: property.name.getEnd(), replacement: `${quote}${target.to}${quote}` });
|
|
184
|
+
}
|
|
185
|
+
renamed++;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
ts.forEachChild(node, visit);
|
|
190
|
+
};
|
|
191
|
+
visit(sourceFile);
|
|
192
|
+
if (edits.length === 0) {
|
|
193
|
+
return { text, changed: false, renamed, leftovers };
|
|
194
|
+
}
|
|
195
|
+
edits.sort((a, b) => b.start - a.start);
|
|
196
|
+
let result = text;
|
|
197
|
+
for (const edit of edits) {
|
|
198
|
+
result = result.slice(0, edit.start) + edit.replacement + result.slice(edit.end);
|
|
199
|
+
}
|
|
200
|
+
return { text: result, changed: true, renamed, leftovers };
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Finds every `<receiver>.prop` access of a config-looking receiver inside an HTML fragment, calls
|
|
204
|
+
* included. Returns the 1-based line (relative to the fragment) of each match.
|
|
205
|
+
*/
|
|
206
|
+
function findConfigPropertyAccessesInHtml(html, property) {
|
|
207
|
+
const pattern = new RegExp(`\\b(?:config|primeng|exhaustive)\\w*(?:\\?\\.|\\.)${escapeRegExp(property)}\\b`, 'gi');
|
|
208
|
+
const lines = [];
|
|
209
|
+
for (const match of html.matchAll(pattern)) {
|
|
210
|
+
lines.push(html.slice(0, match.index).split('\n').length);
|
|
211
|
+
}
|
|
212
|
+
return lines;
|
|
213
|
+
}
|
|
214
|
+
/** Same scan, applied to the inline `template:` literals of `@Component` decorators. Returns 1-based lines within the file. */
|
|
215
|
+
function findConfigPropertyAccessesInTypeScript(fileName, text, property) {
|
|
216
|
+
return scanInlineTemplates(fileName, text, (html) => findConfigPropertyAccessesInHtml(html, property));
|
|
217
|
+
}
|
|
218
|
+
function scanInlineTemplates(fileName, text, scan) {
|
|
219
|
+
const sourceFile = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, true);
|
|
220
|
+
const lines = [];
|
|
221
|
+
const visit = (node) => {
|
|
222
|
+
if (ts.isPropertyAssignment(node) && isDirectComponentTemplateProperty(node) && ts.isStringLiteralLike(node.initializer)) {
|
|
223
|
+
const start = node.initializer.getStart(sourceFile) + 1;
|
|
224
|
+
for (const line of scan(node.initializer.text)) {
|
|
225
|
+
lines.push(sourceFile.getLineAndCharacterOfPosition(start).line + line);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
ts.forEachChild(node, visit);
|
|
229
|
+
};
|
|
230
|
+
visit(sourceFile);
|
|
231
|
+
return lines;
|
|
232
|
+
}
|
|
118
233
|
/**
|
|
119
234
|
* Finds `<receiver>.prop` reads of a config-looking receiver inside an HTML fragment — a template
|
|
120
235
|
* file, or the body of an inline `template:` literal — that are not already calls. Returns the
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.replaceElementsInHtml = replaceElementsInHtml;
|
|
37
|
+
exports.applyExportChangesToTypeScript = applyExportChangesToTypeScript;
|
|
38
|
+
const ts = __importStar(require("typescript"));
|
|
39
|
+
const removed_inputs_1 = require("./removed-inputs");
|
|
40
|
+
function applyEdits(text, edits) {
|
|
41
|
+
edits.sort((a, b) => b.start - a.start);
|
|
42
|
+
let result = text;
|
|
43
|
+
for (const edit of edits) {
|
|
44
|
+
result = result.slice(0, edit.start) + edit.replacement + result.slice(edit.end);
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
/** Replaces the opening and closing tags of the removed wrapper elements with their plain replacement. */
|
|
49
|
+
function replaceElementsInHtml(html, elements) {
|
|
50
|
+
const replaced = [];
|
|
51
|
+
let text = html;
|
|
52
|
+
for (const [element, replacement] of Object.entries(elements)) {
|
|
53
|
+
text = text.replace(new RegExp(`<(/?)${(0, removed_inputs_1.escapeRegExp)(element)}(?=[\\s/>])`, 'g'), (_match, slash) => {
|
|
54
|
+
if (!slash) {
|
|
55
|
+
replaced.push(`<${element}> → <${replacement}>`);
|
|
56
|
+
}
|
|
57
|
+
return `<${slash}${replacement}`;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return { text, replaced };
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Applies the export changes to one TypeScript file: renames the imports (and every use) of renamed
|
|
64
|
+
* exports, drops the imports and `imports: [...]` entries of dropped ones, replaces the removed
|
|
65
|
+
* wrapper elements in inline templates and reports imports of names that are no longer exported.
|
|
66
|
+
* An aliased import (`import { Old as Mine }`) only has its imported name renamed.
|
|
67
|
+
*/
|
|
68
|
+
function applyExportChangesToTypeScript(fileName, text, changes) {
|
|
69
|
+
const sourceFile = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, true);
|
|
70
|
+
const edits = [];
|
|
71
|
+
const applied = [];
|
|
72
|
+
const leftovers = [];
|
|
73
|
+
const renamedLocals = new Map();
|
|
74
|
+
const droppedLocals = new Set();
|
|
75
|
+
const lineOf = (node) => sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1;
|
|
76
|
+
for (const statement of sourceFile.statements) {
|
|
77
|
+
if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
const entry = statement.moduleSpecifier.text;
|
|
81
|
+
const bindings = statement.importClause?.namedBindings;
|
|
82
|
+
if (!bindings || !ts.isNamedImports(bindings)) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const renamed = changes.renamed[entry] ?? {};
|
|
86
|
+
const dropped = changes.dropped[entry] ?? [];
|
|
87
|
+
const unexported = changes.unexported[entry] ?? [];
|
|
88
|
+
const kept = [];
|
|
89
|
+
for (const specifier of bindings.elements) {
|
|
90
|
+
const imported = (specifier.propertyName ?? specifier.name).text;
|
|
91
|
+
if (renamed[imported]) {
|
|
92
|
+
const target = specifier.propertyName ?? specifier.name;
|
|
93
|
+
edits.push({ start: target.getStart(sourceFile), end: target.getEnd(), replacement: renamed[imported] });
|
|
94
|
+
if (!specifier.propertyName) {
|
|
95
|
+
renamedLocals.set(imported, renamed[imported]);
|
|
96
|
+
}
|
|
97
|
+
applied.push(`${imported} → ${renamed[imported]}`);
|
|
98
|
+
kept.push(specifier);
|
|
99
|
+
}
|
|
100
|
+
else if (dropped.includes(imported)) {
|
|
101
|
+
droppedLocals.add(specifier.name.text);
|
|
102
|
+
applied.push(`removed ${imported}`);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
if (unexported.includes(imported)) {
|
|
106
|
+
leftovers.push(lineOf(specifier));
|
|
107
|
+
}
|
|
108
|
+
kept.push(specifier);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (kept.length !== bindings.elements.length) {
|
|
112
|
+
if (kept.length === 0 && !statement.importClause?.name) {
|
|
113
|
+
const end = text[statement.getEnd()] === '\n' ? statement.getEnd() + 1 : statement.getEnd();
|
|
114
|
+
edits.push({ start: statement.getStart(sourceFile), end, replacement: '' });
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
// rebuild the specifier list; renamed specifiers are rewritten here rather than by their own edit
|
|
118
|
+
for (let i = edits.length - 1; i >= 0; i--) {
|
|
119
|
+
if (edits[i].start >= bindings.getStart(sourceFile) && edits[i].end <= bindings.getEnd()) {
|
|
120
|
+
edits.splice(i, 1);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const list = kept.map((specifier) => {
|
|
124
|
+
const imported = (specifier.propertyName ?? specifier.name).text;
|
|
125
|
+
const name = renamed[imported] ?? imported;
|
|
126
|
+
return specifier.propertyName ? `${name} as ${specifier.name.text}` : name;
|
|
127
|
+
});
|
|
128
|
+
edits.push({ start: bindings.getStart(sourceFile), end: bindings.getEnd(), replacement: `{ ${list.join(', ')} }` });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const visit = (node) => {
|
|
133
|
+
if (ts.isIdentifier(node) && renamedLocals.has(node.text) && !ts.isImportSpecifier(node.parent)) {
|
|
134
|
+
const isPropertyName = (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) || (ts.isPropertyAssignment(node.parent) && node.parent.name === node);
|
|
135
|
+
if (!isPropertyName) {
|
|
136
|
+
edits.push({ start: node.getStart(sourceFile), end: node.getEnd(), replacement: renamedLocals.get(node.text) });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else if (ts.isArrayLiteralExpression(node) && droppedLocals.size > 0) {
|
|
140
|
+
const elements = node.elements;
|
|
141
|
+
const isDropped = (element) => ts.isIdentifier(element) && droppedLocals.has(element.text);
|
|
142
|
+
if (elements.length > 0 && elements.every(isDropped)) {
|
|
143
|
+
edits.push({ start: elements[0].getStart(sourceFile), end: elements[elements.length - 1].getEnd(), replacement: '' });
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
elements.forEach((element, index) => {
|
|
147
|
+
if (!isDropped(element)) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
// remove the element with the separator after it, or before it when only dropped elements follow
|
|
151
|
+
const keptAfter = elements.slice(index + 1).some((other) => !isDropped(other));
|
|
152
|
+
const start = keptAfter ? element.getStart(sourceFile) : elements[index - 1].getEnd();
|
|
153
|
+
const end = keptAfter ? elements[index + 1].getStart(sourceFile) : element.getEnd();
|
|
154
|
+
edits.push({ start, end, replacement: '' });
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else if (ts.isPropertyAssignment(node) && (0, removed_inputs_1.isDirectComponentTemplateProperty)(node) && ts.isStringLiteralLike(node.initializer)) {
|
|
159
|
+
const result = replaceElementsInHtml(node.initializer.text, changes.elements);
|
|
160
|
+
if (result.replaced.length > 0) {
|
|
161
|
+
edits.push({ start: node.initializer.getStart(sourceFile), end: node.initializer.getEnd(), replacement: (0, removed_inputs_1.encodeLiteralBody)(node.initializer, result.text) });
|
|
162
|
+
applied.push(...result.replaced);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
ts.forEachChild(node, visit);
|
|
166
|
+
};
|
|
167
|
+
visit(sourceFile);
|
|
168
|
+
if (edits.length === 0) {
|
|
169
|
+
return { text, changed: false, applied, leftovers };
|
|
170
|
+
}
|
|
171
|
+
return { text: applyEdits(text, edits), changed: true, applied, leftovers };
|
|
172
|
+
}
|
|
Binary file
|
|
@@ -125,21 +125,32 @@ function applyEdits(text, edits) {
|
|
|
125
125
|
* file or the body of an inline component template).
|
|
126
126
|
*/
|
|
127
127
|
function renameInputsInHtml(html, groups) {
|
|
128
|
-
|
|
128
|
+
// keyed by tag start: several groups can match the same tag (an element carrying both pButton and
|
|
129
|
+
// pTooltip, or two groups of the same directive), so their renames are applied one after the other
|
|
130
|
+
const tags = new Map();
|
|
129
131
|
const renamed = [];
|
|
130
|
-
const conflictLines = [];
|
|
131
132
|
for (const group of groups) {
|
|
132
133
|
for (const tag of (0, removed_inputs_1.findOpeningTags)(html, group.selector)) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
edits.push({ start: tag.start, end: tag.end, replacement: result.text });
|
|
136
|
-
renamed.push(...result.renamed);
|
|
137
|
-
}
|
|
138
|
-
if (result.conflict) {
|
|
139
|
-
conflictLines.push(lineOf(html, tag.start));
|
|
134
|
+
if (group.skipTag?.(tag.name)) {
|
|
135
|
+
continue;
|
|
140
136
|
}
|
|
137
|
+
const current = tags.get(tag.start) ?? { end: tag.end, text: html.slice(tag.start, tag.end), conflict: false };
|
|
138
|
+
const result = renameOnTag(current.text, group.renames);
|
|
139
|
+
renamed.push(...result.renamed);
|
|
140
|
+
tags.set(tag.start, { end: tag.end, text: result.text, conflict: current.conflict || result.conflict });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const edits = [];
|
|
144
|
+
const conflictLines = [];
|
|
145
|
+
for (const [start, tag] of tags) {
|
|
146
|
+
if (tag.text !== html.slice(start, tag.end)) {
|
|
147
|
+
edits.push({ start, end: tag.end, replacement: tag.text });
|
|
148
|
+
}
|
|
149
|
+
if (tag.conflict) {
|
|
150
|
+
conflictLines.push(lineOf(html, start));
|
|
141
151
|
}
|
|
142
152
|
}
|
|
153
|
+
conflictLines.sort((a, b) => a - b);
|
|
143
154
|
if (edits.length === 0) {
|
|
144
155
|
return { text: html, changed: false, renamed, conflictLines };
|
|
145
156
|
}
|