@reapit/elements 5.0.0-beta.77 → 5.0.0-beta.79
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/dist/codemods/apply-textarea-field-sizing/transform.js +14 -11
- package/dist/codemods/at-a-glance-article-card/transform.js +14 -11
- package/dist/codemods/bin.js +1047 -647
- package/dist/codemods/codemods.js +9 -1
- package/dist/codemods/inline-use-click-outside/transform.js +253558 -0
- package/dist/codemods/manifest.json +9 -1
- package/dist/codemods/replace-deprecated-label/transform.js +253627 -0
- package/dist/codemods/rewrite-text-font-imports/transform.js +14 -11
- package/dist/codemods/rewrite-v4-imports/transform.js +14 -11
- package/dist/codemods/rewrite-v5-imports/transform.js +14 -23
- package/dist/codemods/upgrade-deprecated-badge/transform.js +14 -11
- package/dist/codemods/upgrade-deprecated-button/transform.js +14 -11
- package/dist/codemods/upgrade-deprecated-button-group/transform.js +19 -40
- package/dist/codemods/upgrade-deprecated-icon/transform.js +14 -11
- package/dist/codemods/upgrade-deprecated-split-button/transform.js +14 -11
- package/dist/codemods/upgrade-deprecated-tag/transform.js +14 -11
- package/dist/codemods/upgrade-deprecated-use-media-query/transform.js +14 -11
- package/dist/js/app-logo-DI6bR-xZ.js +63 -0
- package/dist/js/{app-switcher-DT-XTre7.js → app-switcher-Bm90a8vK.js} +1 -2
- package/dist/js/autocomplete-control-CZ4Vucbe.js +60 -0
- package/dist/js/checkbox-control-DpvEbZAD.js +24 -0
- package/dist/js/{checkbox-group-control-CGaYWkzO.js → checkbox-group-control-BHPHLTNj.js} +28 -22
- package/dist/js/core/app-switcher.js +1 -1
- package/dist/js/core/autocomplete-control.js +1 -1
- package/dist/js/core/checkbox-control.js +1 -1
- package/dist/js/core/checkbox-group-control.js +1 -1
- package/dist/js/core/date-time-control.js +1 -1
- package/dist/js/core/radio-group-control.js +1 -1
- package/dist/js/core/select-control.js +1 -1
- package/dist/js/core/select-native-control.js +1 -1
- package/dist/js/core/text-control.js +1 -1
- package/dist/js/core/textarea-control.js +1 -1
- package/dist/js/core/top-bar.js +96 -96
- package/dist/js/date-time-control-D3_FLY1i.js +37 -0
- package/dist/js/deprecated/nav.js +1 -1
- package/dist/js/deprecated/page-header.js +1 -1
- package/dist/js/index.js +1700 -1712
- package/dist/js/{nav-responsive-BMQZWB8l.js → nav-responsive-CgrAMnq3.js} +32 -32
- package/dist/js/page-header-mgRtDaDf.js +96 -0
- package/dist/js/{radio-group-control-F5aUqmQr.js → radio-group-control-DpWIWxQk.js} +35 -29
- package/dist/js/{select-control-DNlg4Orc.js → select-control-ClgSoo2Q.js} +22 -20
- package/dist/js/select-native-control-BJdng5Wq.js +37 -0
- package/dist/js/style.css +1 -1
- package/dist/js/text-control-CIDimADU.js +37 -0
- package/dist/js/textarea-control-QGH0MVlk.js +37 -0
- package/dist/js/{top-bar-B9BUqLL8.js → top-bar-BAtb9REF.js} +287 -276
- package/dist/types/core/autocomplete-control/autocomplete-control.d.ts +1 -1
- package/dist/types/core/autocomplete-control/autocomplete-control.d.ts.map +1 -1
- package/dist/types/core/autocomplete-control/autocomplete-control.stories.d.ts +3 -0
- package/dist/types/core/autocomplete-control/autocomplete-control.stories.d.ts.map +1 -1
- package/dist/types/core/checkbox-control/checkbox-control.d.ts +1 -1
- package/dist/types/core/checkbox-control/checkbox-control.d.ts.map +1 -1
- package/dist/types/core/checkbox-control/checkbox-control.stories.d.ts +4 -1
- package/dist/types/core/checkbox-control/checkbox-control.stories.d.ts.map +1 -1
- package/dist/types/core/checkbox-group-control/checkbox-group-control.d.ts.map +1 -1
- package/dist/types/core/checkbox-group-control/checkbox-group-control.stories.d.ts +3 -0
- package/dist/types/core/checkbox-group-control/checkbox-group-control.stories.d.ts.map +1 -1
- package/dist/types/core/checkbox-input/checkbox-input.stories.d.ts +6 -0
- package/dist/types/core/checkbox-input/checkbox-input.stories.d.ts.map +1 -1
- package/dist/types/core/checkbox-input/styles.d.ts.map +1 -1
- package/dist/types/core/combobox/button/button.stories.d.ts +7 -0
- package/dist/types/core/combobox/button/button.stories.d.ts.map +1 -1
- package/dist/types/core/combobox/combobox.stories.d.ts +16 -0
- package/dist/types/core/combobox/combobox.stories.d.ts.map +1 -1
- package/dist/types/core/combobox/styles.d.ts.map +1 -1
- package/dist/types/core/date-time-control/date-time-control.d.ts +1 -1
- package/dist/types/core/date-time-control/date-time-control.d.ts.map +1 -1
- package/dist/types/core/date-time-control/date-time-control.stories.d.ts +3 -0
- package/dist/types/core/date-time-control/date-time-control.stories.d.ts.map +1 -1
- package/dist/types/core/date-time-input/date-time-input.stories.d.ts +6 -0
- package/dist/types/core/date-time-input/date-time-input.stories.d.ts.map +1 -1
- package/dist/types/core/drawer/styles.d.ts.map +1 -1
- package/dist/types/core/radio-group-control/radio-group-control.d.ts.map +1 -1
- package/dist/types/core/radio-group-control/radio-group-control.stories.d.ts +3 -0
- package/dist/types/core/radio-group-control/radio-group-control.stories.d.ts.map +1 -1
- package/dist/types/core/radio-input/radio-input.stories.d.ts +6 -0
- package/dist/types/core/radio-input/radio-input.stories.d.ts.map +1 -1
- package/dist/types/core/radio-input/styles.d.ts.map +1 -1
- package/dist/types/core/select-control/select-control.d.ts +1 -1
- package/dist/types/core/select-control/select-control.d.ts.map +1 -1
- package/dist/types/core/select-control/select-control.stories.d.ts +3 -0
- package/dist/types/core/select-control/select-control.stories.d.ts.map +1 -1
- package/dist/types/core/select-native/select-native.stories.d.ts +6 -0
- package/dist/types/core/select-native/select-native.stories.d.ts.map +1 -1
- package/dist/types/core/select-native/styles.d.ts.map +1 -1
- package/dist/types/core/select-native-control/select-native-control.d.ts +1 -1
- package/dist/types/core/select-native-control/select-native-control.d.ts.map +1 -1
- package/dist/types/core/select-native-control/select-native-control.stories.d.ts +3 -0
- package/dist/types/core/select-native-control/select-native-control.stories.d.ts.map +1 -1
- package/dist/types/core/text-control/text-control.d.ts +1 -1
- package/dist/types/core/text-control/text-control.d.ts.map +1 -1
- package/dist/types/core/text-control/text-control.stories.d.ts +3 -0
- package/dist/types/core/text-control/text-control.stories.d.ts.map +1 -1
- package/dist/types/core/text-input/styles.d.ts.map +1 -1
- package/dist/types/core/text-input/text-input.stories.d.ts +6 -0
- package/dist/types/core/text-input/text-input.stories.d.ts.map +1 -1
- package/dist/types/core/textarea/styles.d.ts.map +1 -1
- package/dist/types/core/textarea/textarea.stories.d.ts +6 -0
- package/dist/types/core/textarea/textarea.stories.d.ts.map +1 -1
- package/dist/types/core/textarea-control/textarea-control.d.ts +1 -1
- package/dist/types/core/textarea-control/textarea-control.d.ts.map +1 -1
- package/dist/types/core/textarea-control/textarea-control.stories.d.ts +3 -0
- package/dist/types/core/textarea-control/textarea-control.stories.d.ts.map +1 -1
- package/dist/types/deprecated/index.d.ts +0 -2
- package/dist/types/deprecated/index.d.ts.map +1 -1
- package/dist/types/deprecated/page-header/page-header.d.ts +7 -2
- package/dist/types/deprecated/page-header/page-header.d.ts.map +1 -1
- package/package.json +20 -23
- package/dist/js/autocomplete-control-BQWChKSS.js +0 -58
- package/dist/js/badge-B1_MUh5J.js +0 -24
- package/dist/js/brand-logo-CI4YsKra.js +0 -74
- package/dist/js/checkbox-control-BGeX2ngp.js +0 -23
- package/dist/js/date-time-control-y5SZfBjd.js +0 -35
- package/dist/js/deprecated/badge.js +0 -8
- package/dist/js/deprecated/tag.js +0 -8
- package/dist/js/icons/add.figma.js +0 -3
- package/dist/js/icons/announcement.figma.js +0 -3
- package/dist/js/icons/app-switcher.figma.js +0 -3
- package/dist/js/icons/archive.figma.js +0 -3
- package/dist/js/icons/arrow-down.figma.js +0 -3
- package/dist/js/icons/arrow-left.figma.js +0 -3
- package/dist/js/icons/arrow-right.figma.js +0 -3
- package/dist/js/icons/arrow-up.figma.js +0 -3
- package/dist/js/icons/asterisk.figma.js +0 -3
- package/dist/js/icons/attachment.figma.js +0 -3
- package/dist/js/icons/automation.figma.js +0 -3
- package/dist/js/icons/bath.figma.js +0 -3
- package/dist/js/icons/bed.figma.js +0 -3
- package/dist/js/icons/bill-bulk.figma.js +0 -3
- package/dist/js/icons/bill.figma.js +0 -3
- package/dist/js/icons/bookmark-bulk.figma.js +0 -3
- package/dist/js/icons/bookmark.figma.js +0 -3
- package/dist/js/icons/buy.figma.js +0 -3
- package/dist/js/icons/calculator.figma.js +0 -3
- package/dist/js/icons/calendar-user.figma.js +0 -3
- package/dist/js/icons/calendar.figma.js +0 -3
- package/dist/js/icons/camera.figma.js +0 -3
- package/dist/js/icons/car.figma.js +0 -3
- package/dist/js/icons/change-log.figma.js +0 -3
- package/dist/js/icons/check-outline.figma.js +0 -3
- package/dist/js/icons/check.figma.js +0 -3
- package/dist/js/icons/checkbox-disabled.figma.js +0 -3
- package/dist/js/icons/checkbox-indeterminate.figma.js +0 -3
- package/dist/js/icons/checkbox-selected.figma.js +0 -3
- package/dist/js/icons/checkbox.figma.js +0 -3
- package/dist/js/icons/chevron-down.figma.js +0 -3
- package/dist/js/icons/chevron-left.figma.js +0 -3
- package/dist/js/icons/chevron-right.figma.js +0 -3
- package/dist/js/icons/chevron-up.figma.js +0 -3
- package/dist/js/icons/circular-add-solid.figma.js +0 -3
- package/dist/js/icons/circular-add.figma.js +0 -3
- package/dist/js/icons/circular-remove-solid.figma.js +0 -3
- package/dist/js/icons/circular-remove.figma.js +0 -3
- package/dist/js/icons/clear.figma.js +0 -3
- package/dist/js/icons/close.figma.js +0 -3
- package/dist/js/icons/cloud.figma.js +0 -3
- package/dist/js/icons/compliance.figma.js +0 -3
- package/dist/js/icons/consolidate.figma.js +0 -3
- package/dist/js/icons/contact.figma.js +0 -3
- package/dist/js/icons/contacts-alt.figma.js +0 -3
- package/dist/js/icons/contacts.figma.js +0 -3
- package/dist/js/icons/copy.figma.js +0 -3
- package/dist/js/icons/dashboard.figma.js +0 -3
- package/dist/js/icons/drag-indicator-alt.figma.js +0 -3
- package/dist/js/icons/drag-indicator.figma.js +0 -3
- package/dist/js/icons/edit.figma.js +0 -3
- package/dist/js/icons/email-disabled.figma.js +0 -3
- package/dist/js/icons/email-fill.figma.js +0 -3
- package/dist/js/icons/email.figma.js +0 -3
- package/dist/js/icons/error.figma.js +0 -3
- package/dist/js/icons/euro.figma.js +0 -3
- package/dist/js/icons/exit.figma.js +0 -3
- package/dist/js/icons/expand.figma.js +0 -3
- package/dist/js/icons/export.figma.js +0 -3
- package/dist/js/icons/favourite.figma.js +0 -3
- package/dist/js/icons/feather.figma.js +0 -3
- package/dist/js/icons/feed.figma.js +0 -3
- package/dist/js/icons/file-attached.figma.js +0 -3
- package/dist/js/icons/file-audio.figma.js +0 -3
- package/dist/js/icons/file-document.figma.js +0 -3
- package/dist/js/icons/file-download.figma.js +0 -3
- package/dist/js/icons/file-excel.figma.js +0 -3
- package/dist/js/icons/file-image.figma.js +0 -3
- package/dist/js/icons/file-pdf.figma.js +0 -3
- package/dist/js/icons/file-powerpoint.figma.js +0 -3
- package/dist/js/icons/file-spreadsheet.figma.js +0 -3
- package/dist/js/icons/file-upload.figma.js +0 -3
- package/dist/js/icons/file-video.figma.js +0 -3
- package/dist/js/icons/file-word.figma.js +0 -3
- package/dist/js/icons/file-zip.figma.js +0 -3
- package/dist/js/icons/file.figma.js +0 -3
- package/dist/js/icons/filter.figma.js +0 -3
- package/dist/js/icons/folder.figma.js +0 -3
- package/dist/js/icons/forward.figma.js +0 -3
- package/dist/js/icons/fullscreen-exit.figma.js +0 -3
- package/dist/js/icons/fullscreen.figma.js +0 -3
- package/dist/js/icons/help.figma.js +0 -3
- package/dist/js/icons/info-outline.figma.js +0 -3
- package/dist/js/icons/info.figma.js +0 -3
- package/dist/js/icons/insights.figma.js +0 -3
- package/dist/js/icons/inspection-template.figma.js +0 -3
- package/dist/js/icons/inspection.figma.js +0 -3
- package/dist/js/icons/insurance.figma.js +0 -3
- package/dist/js/icons/key.figma.js +0 -3
- package/dist/js/icons/keyboard.figma.js +0 -3
- package/dist/js/icons/land-size.figma.js +0 -3
- package/dist/js/icons/laptop.figma.js +0 -3
- package/dist/js/icons/link.figma.js +0 -3
- package/dist/js/icons/location-alt.figma.js +0 -3
- package/dist/js/icons/location-disabled.figma.js +0 -3
- package/dist/js/icons/location-outline.figma.js +0 -3
- package/dist/js/icons/location.figma.js +0 -3
- package/dist/js/icons/lock-outline.figma.js +0 -3
- package/dist/js/icons/lock.figma.js +0 -3
- package/dist/js/icons/maintenance-alt.figma.js +0 -3
- package/dist/js/icons/maintenance.figma.js +0 -3
- package/dist/js/icons/marketplace.figma.js +0 -3
- package/dist/js/icons/menu-alt.figma.js +0 -3
- package/dist/js/icons/menu-collapse.figma.js +0 -3
- package/dist/js/icons/menu-expand.figma.js +0 -3
- package/dist/js/icons/menu.figma.js +0 -3
- package/dist/js/icons/message-alt.figma.js +0 -3
- package/dist/js/icons/message-disabled.figma.js +0 -3
- package/dist/js/icons/message-typing.figma.js +0 -3
- package/dist/js/icons/message.figma.js +0 -3
- package/dist/js/icons/mic-off.figma.js +0 -3
- package/dist/js/icons/mic-on.figma.js +0 -3
- package/dist/js/icons/minus.figma.js +0 -3
- package/dist/js/icons/mobile.figma.js +0 -3
- package/dist/js/icons/money.figma.js +0 -3
- package/dist/js/icons/monitor.figma.js +0 -3
- package/dist/js/icons/mood-happy.figma.js +0 -3
- package/dist/js/icons/mood-neutral.figma.js +0 -3
- package/dist/js/icons/mood-unhappy.figma.js +0 -3
- package/dist/js/icons/more-vert.figma.js +0 -3
- package/dist/js/icons/more.figma.js +0 -3
- package/dist/js/icons/note.figma.js +0 -3
- package/dist/js/icons/notification.figma.js +0 -3
- package/dist/js/icons/payment.figma.js +0 -3
- package/dist/js/icons/people-alt.figma.js +0 -3
- package/dist/js/icons/phone-disabled.figma.js +0 -3
- package/dist/js/icons/phone.figma.js +0 -3
- package/dist/js/icons/photo.figma.js +0 -3
- package/dist/js/icons/pin.figma.js +0 -3
- package/dist/js/icons/pound.figma.js +0 -3
- package/dist/js/icons/power-on.figma.js +0 -3
- package/dist/js/icons/printer.figma.js +0 -3
- package/dist/js/icons/priority-high.figma.js +0 -3
- package/dist/js/icons/priority-low.figma.js +0 -3
- package/dist/js/icons/priority-medium.figma.js +0 -3
- package/dist/js/icons/property-checked.figma.js +0 -3
- package/dist/js/icons/property.figma.js +0 -3
- package/dist/js/icons/radio-disabled.figma.js +0 -3
- package/dist/js/icons/radio-selected.figma.js +0 -3
- package/dist/js/icons/radio.figma.js +0 -3
- package/dist/js/icons/refresh.figma.js +0 -3
- package/dist/js/icons/rent.figma.js +0 -3
- package/dist/js/icons/repeat.figma.js +0 -3
- package/dist/js/icons/reply-all.figma.js +0 -3
- package/dist/js/icons/reply.figma.js +0 -3
- package/dist/js/icons/report.figma.js +0 -3
- package/dist/js/icons/restore.figma.js +0 -3
- package/dist/js/icons/sale.figma.js +0 -3
- package/dist/js/icons/search.figma.js +0 -3
- package/dist/js/icons/send.figma.js +0 -3
- package/dist/js/icons/separator-dot.figma.js +0 -3
- package/dist/js/icons/separator-line.figma.js +0 -3
- package/dist/js/icons/settings-alt.figma.js +0 -3
- package/dist/js/icons/settings.figma.js +0 -3
- package/dist/js/icons/share.figma.js +0 -3
- package/dist/js/icons/skip.figma.js +0 -3
- package/dist/js/icons/social-facebook.figma.js +0 -3
- package/dist/js/icons/social-instagram.figma.js +0 -3
- package/dist/js/icons/social-linkedin.figma.js +0 -3
- package/dist/js/icons/social-x.figma.js +0 -3
- package/dist/js/icons/social-youtube.figma.js +0 -3
- package/dist/js/icons/sort-ascend.figma.js +0 -3
- package/dist/js/icons/sort-descend.figma.js +0 -3
- package/dist/js/icons/sort.figma.js +0 -3
- package/dist/js/icons/sprout.figma.js +0 -3
- package/dist/js/icons/star.figma.js +0 -3
- package/dist/js/icons/status-bad.figma.js +0 -3
- package/dist/js/icons/status-good.figma.js +0 -3
- package/dist/js/icons/status-paused.figma.js +0 -3
- package/dist/js/icons/status-unknown.figma.js +0 -3
- package/dist/js/icons/status.figma.js +0 -3
- package/dist/js/icons/tag.figma.js +0 -3
- package/dist/js/icons/task.figma.js +0 -3
- package/dist/js/icons/time.figma.js +0 -3
- package/dist/js/icons/trash.figma.js +0 -3
- package/dist/js/icons/unarchive.figma.js +0 -3
- package/dist/js/icons/user-outline.figma.js +0 -3
- package/dist/js/icons/user.figma.js +0 -3
- package/dist/js/icons/video.figma.js +0 -3
- package/dist/js/icons/view-disabled.figma.js +0 -3
- package/dist/js/icons/view.figma.js +0 -3
- package/dist/js/icons/w3w.figma.js +0 -3
- package/dist/js/icons/walking.figma.js +0 -3
- package/dist/js/icons/wand.figma.js +0 -3
- package/dist/js/icons/warning-outline.figma.js +0 -3
- package/dist/js/icons/warning.figma.js +0 -3
- package/dist/js/icons/web.figma.js +0 -3
- package/dist/js/icons/workflow.figma.js +0 -3
- package/dist/js/index_react-U2RHnzO6.js +0 -18340
- package/dist/js/page-header-DYxMYNZx.js +0 -87
- package/dist/js/select-native-control-M9D5z1nK.js +0 -35
- package/dist/js/tag-BZTSNcnx.js +0 -24
- package/dist/js/text-control-DRYKDuD6.js +0 -35
- package/dist/js/textarea-control-DSfsLSQu.js +0 -35
- package/dist/types/deprecated/badge/__styles__/index.d.ts +0 -7
- package/dist/types/deprecated/badge/__styles__/index.d.ts.map +0 -1
- package/dist/types/deprecated/badge/__tests__/badge.test.d.ts +0 -2
- package/dist/types/deprecated/badge/__tests__/badge.test.d.ts.map +0 -1
- package/dist/types/deprecated/badge/badge.d.ts +0 -11
- package/dist/types/deprecated/badge/badge.d.ts.map +0 -1
- package/dist/types/deprecated/badge/badge.stories.d.ts +0 -12
- package/dist/types/deprecated/badge/badge.stories.d.ts.map +0 -1
- package/dist/types/deprecated/badge/index.d.ts +0 -3
- package/dist/types/deprecated/badge/index.d.ts.map +0 -1
- package/dist/types/deprecated/tag/__styles__/index.d.ts +0 -7
- package/dist/types/deprecated/tag/__styles__/index.d.ts.map +0 -1
- package/dist/types/deprecated/tag/__tests__/tag.test.d.ts +0 -2
- package/dist/types/deprecated/tag/__tests__/tag.test.d.ts.map +0 -1
- package/dist/types/deprecated/tag/index.d.ts +0 -3
- package/dist/types/deprecated/tag/index.d.ts.map +0 -1
- package/dist/types/deprecated/tag/tag.d.ts +0 -11
- package/dist/types/deprecated/tag/tag.d.ts.map +0 -1
- package/dist/types/deprecated/tag/tag.stories.d.ts +0 -40
- package/dist/types/deprecated/tag/tag.stories.d.ts.map +0 -1
package/dist/codemods/bin.js
CHANGED
|
@@ -207,7 +207,7 @@ var require_typescript = __commonJS({
|
|
|
207
207
|
SymbolDisplayPartKind: /* @__PURE__ */ __name(() => SymbolDisplayPartKind, "SymbolDisplayPartKind"),
|
|
208
208
|
SymbolFlags: /* @__PURE__ */ __name(() => SymbolFlags, "SymbolFlags"),
|
|
209
209
|
SymbolFormatFlags: /* @__PURE__ */ __name(() => SymbolFormatFlags, "SymbolFormatFlags"),
|
|
210
|
-
SyntaxKind: /* @__PURE__ */ __name(() =>
|
|
210
|
+
SyntaxKind: /* @__PURE__ */ __name(() => SyntaxKind12, "SyntaxKind"),
|
|
211
211
|
Ternary: /* @__PURE__ */ __name(() => Ternary, "Ternary"),
|
|
212
212
|
ThrottledCancellationToken: /* @__PURE__ */ __name(() => ThrottledCancellationToken, "ThrottledCancellationToken"),
|
|
213
213
|
TokenClass: /* @__PURE__ */ __name(() => TokenClass, "TokenClass"),
|
|
@@ -2209,7 +2209,7 @@ var require_typescript = __commonJS({
|
|
|
2209
2209
|
tracing: /* @__PURE__ */ __name(() => tracing, "tracing"),
|
|
2210
2210
|
tracingEnabled: /* @__PURE__ */ __name(() => tracingEnabled, "tracingEnabled"),
|
|
2211
2211
|
transferSourceFileChildren: /* @__PURE__ */ __name(() => transferSourceFileChildren, "transferSourceFileChildren"),
|
|
2212
|
-
transform: /* @__PURE__ */ __name(() =>
|
|
2212
|
+
transform: /* @__PURE__ */ __name(() => transform16, "transform"),
|
|
2213
2213
|
transformClassFields: /* @__PURE__ */ __name(() => transformClassFields, "transformClassFields"),
|
|
2214
2214
|
transformDeclarations: /* @__PURE__ */ __name(() => transformDeclarations, "transformDeclarations"),
|
|
2215
2215
|
transformECMAScriptModule: /* @__PURE__ */ __name(() => transformECMAScriptModule, "transformECMAScriptModule"),
|
|
@@ -4293,7 +4293,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
4293
4293
|
function formatSyntaxKind(kind) {
|
|
4294
4294
|
return formatEnum(
|
|
4295
4295
|
kind,
|
|
4296
|
-
|
|
4296
|
+
SyntaxKind12,
|
|
4297
4297
|
/*isFlags*/
|
|
4298
4298
|
false
|
|
4299
4299
|
);
|
|
@@ -5842,7 +5842,7 @@ ${lanes.join("\n")}
|
|
|
5842
5842
|
})(tracingEnabled || (tracingEnabled = {}));
|
|
5843
5843
|
var startTracing = tracingEnabled.startTracing;
|
|
5844
5844
|
var dumpTracingLegend = tracingEnabled.dumpLegend;
|
|
5845
|
-
var
|
|
5845
|
+
var SyntaxKind12 = /* @__PURE__ */ ((SyntaxKind52) => {
|
|
5846
5846
|
SyntaxKind52[SyntaxKind52["Unknown"] = 0] = "Unknown";
|
|
5847
5847
|
SyntaxKind52[SyntaxKind52["EndOfFileToken"] = 1] = "EndOfFileToken";
|
|
5848
5848
|
SyntaxKind52[SyntaxKind52["SingleLineCommentTrivia"] = 2] = "SingleLineCommentTrivia";
|
|
@@ -6348,7 +6348,7 @@ ${lanes.join("\n")}
|
|
|
6348
6348
|
/* LastKeyword */
|
|
6349
6349
|
] = "LastContextualKeyword";
|
|
6350
6350
|
return SyntaxKind52;
|
|
6351
|
-
})(
|
|
6351
|
+
})(SyntaxKind12 || {});
|
|
6352
6352
|
var NodeFlags = /* @__PURE__ */ ((NodeFlags3) => {
|
|
6353
6353
|
NodeFlags3[NodeFlags3["None"] = 0] = "None";
|
|
6354
6354
|
NodeFlags3[NodeFlags3["Let"] = 1] = "Let";
|
|
@@ -173763,7 +173763,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
173763
173763
|
}
|
|
173764
173764
|
__name(getDefaultLibFilePath, "getDefaultLibFilePath");
|
|
173765
173765
|
setObjectAllocator(getServicesObjectAllocator());
|
|
173766
|
-
function
|
|
173766
|
+
function transform16(source, transformers, compilerOptions) {
|
|
173767
173767
|
const diagnostics = [];
|
|
173768
173768
|
compilerOptions = fixupCompilerOptions(compilerOptions, diagnostics);
|
|
173769
173769
|
const nodes = isArray(source) ? source : [source];
|
|
@@ -173782,7 +173782,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
173782
173782
|
result.diagnostics = concatenate(result.diagnostics, diagnostics);
|
|
173783
173783
|
return result;
|
|
173784
173784
|
}
|
|
173785
|
-
__name(
|
|
173785
|
+
__name(transform16, "transform");
|
|
173786
173786
|
var ts_BreakpointResolver_exports = {};
|
|
173787
173787
|
__export2(ts_BreakpointResolver_exports, {
|
|
173788
173788
|
spanInSourceFileAtLocation: /* @__PURE__ */ __name(() => spanInSourceFileAtLocation, "spanInSourceFileAtLocation")
|
|
@@ -206662,7 +206662,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
206662
206662
|
SymbolDisplayPartKind: /* @__PURE__ */ __name(() => SymbolDisplayPartKind, "SymbolDisplayPartKind"),
|
|
206663
206663
|
SymbolFlags: /* @__PURE__ */ __name(() => SymbolFlags, "SymbolFlags"),
|
|
206664
206664
|
SymbolFormatFlags: /* @__PURE__ */ __name(() => SymbolFormatFlags, "SymbolFormatFlags"),
|
|
206665
|
-
SyntaxKind: /* @__PURE__ */ __name(() =>
|
|
206665
|
+
SyntaxKind: /* @__PURE__ */ __name(() => SyntaxKind12, "SyntaxKind"),
|
|
206666
206666
|
Ternary: /* @__PURE__ */ __name(() => Ternary, "Ternary"),
|
|
206667
206667
|
ThrottledCancellationToken: /* @__PURE__ */ __name(() => ThrottledCancellationToken, "ThrottledCancellationToken"),
|
|
206668
206668
|
TokenClass: /* @__PURE__ */ __name(() => TokenClass, "TokenClass"),
|
|
@@ -208664,7 +208664,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
208664
208664
|
tracing: /* @__PURE__ */ __name(() => tracing, "tracing"),
|
|
208665
208665
|
tracingEnabled: /* @__PURE__ */ __name(() => tracingEnabled, "tracingEnabled"),
|
|
208666
208666
|
transferSourceFileChildren: /* @__PURE__ */ __name(() => transferSourceFileChildren, "transferSourceFileChildren"),
|
|
208667
|
-
transform: /* @__PURE__ */ __name(() =>
|
|
208667
|
+
transform: /* @__PURE__ */ __name(() => transform16, "transform"),
|
|
208668
208668
|
transformClassFields: /* @__PURE__ */ __name(() => transformClassFields, "transformClassFields"),
|
|
208669
208669
|
transformDeclarations: /* @__PURE__ */ __name(() => transformDeclarations, "transformDeclarations"),
|
|
208670
208670
|
transformECMAScriptModule: /* @__PURE__ */ __name(() => transformECMAScriptModule, "transformECMAScriptModule"),
|
|
@@ -222035,11 +222035,12 @@ var require_commonjs = __commonJS({
|
|
|
222035
222035
|
}
|
|
222036
222036
|
});
|
|
222037
222037
|
|
|
222038
|
-
// node_modules/.store/@isaacs-brace-expansion-npm-5.0.
|
|
222038
|
+
// node_modules/.store/@isaacs-brace-expansion-npm-5.0.1-79f48d6db7/package/dist/commonjs/index.js
|
|
222039
222039
|
var require_commonjs2 = __commonJS({
|
|
222040
|
-
"node_modules/.store/@isaacs-brace-expansion-npm-5.0.
|
|
222040
|
+
"node_modules/.store/@isaacs-brace-expansion-npm-5.0.1-79f48d6db7/package/dist/commonjs/index.js"(exports) {
|
|
222041
222041
|
"use strict";
|
|
222042
222042
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
222043
|
+
exports.EXPANSION_MAX = void 0;
|
|
222043
222044
|
exports.expand = expand;
|
|
222044
222045
|
var balanced_match_1 = require_commonjs();
|
|
222045
222046
|
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
@@ -222057,6 +222058,7 @@ var require_commonjs2 = __commonJS({
|
|
|
222057
222058
|
var closePattern = /\\}/g;
|
|
222058
222059
|
var commaPattern = /\\,/g;
|
|
222059
222060
|
var periodPattern = /\\./g;
|
|
222061
|
+
exports.EXPANSION_MAX = 1e5;
|
|
222060
222062
|
function numeric(str) {
|
|
222061
222063
|
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
222062
222064
|
}
|
|
@@ -222091,14 +222093,15 @@ var require_commonjs2 = __commonJS({
|
|
|
222091
222093
|
return parts;
|
|
222092
222094
|
}
|
|
222093
222095
|
__name(parseCommaParts, "parseCommaParts");
|
|
222094
|
-
function expand(str) {
|
|
222096
|
+
function expand(str, options = {}) {
|
|
222095
222097
|
if (!str) {
|
|
222096
222098
|
return [];
|
|
222097
222099
|
}
|
|
222100
|
+
const { max = exports.EXPANSION_MAX } = options;
|
|
222098
222101
|
if (str.slice(0, 2) === "{}") {
|
|
222099
222102
|
str = "\\{\\}" + str.slice(2);
|
|
222100
222103
|
}
|
|
222101
|
-
return expand_(escapeBraces(str), true).map(unescapeBraces);
|
|
222104
|
+
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
|
|
222102
222105
|
}
|
|
222103
222106
|
__name(expand, "expand");
|
|
222104
222107
|
function embrace(str) {
|
|
@@ -222117,15 +222120,15 @@ var require_commonjs2 = __commonJS({
|
|
|
222117
222120
|
return i >= y;
|
|
222118
222121
|
}
|
|
222119
222122
|
__name(gte, "gte");
|
|
222120
|
-
function expand_(str, isTop) {
|
|
222123
|
+
function expand_(str, max, isTop) {
|
|
222121
222124
|
const expansions = [];
|
|
222122
222125
|
const m = (0, balanced_match_1.balanced)("{", "}", str);
|
|
222123
222126
|
if (!m)
|
|
222124
222127
|
return [str];
|
|
222125
222128
|
const pre = m.pre;
|
|
222126
|
-
const post = m.post.length ? expand_(m.post, false) : [""];
|
|
222129
|
+
const post = m.post.length ? expand_(m.post, max, false) : [""];
|
|
222127
222130
|
if (/\$$/.test(m.pre)) {
|
|
222128
|
-
for (let k = 0; k < post.length; k++) {
|
|
222131
|
+
for (let k = 0; k < post.length && k < max; k++) {
|
|
222129
222132
|
const expansion = pre + "{" + m.body + "}" + post[k];
|
|
222130
222133
|
expansions.push(expansion);
|
|
222131
222134
|
}
|
|
@@ -222137,7 +222140,7 @@ var require_commonjs2 = __commonJS({
|
|
|
222137
222140
|
if (!isSequence && !isOptions) {
|
|
222138
222141
|
if (m.post.match(/,(?!,).*\}/)) {
|
|
222139
222142
|
str = m.pre + "{" + m.body + escClose + m.post;
|
|
222140
|
-
return expand_(str);
|
|
222143
|
+
return expand_(str, max, true);
|
|
222141
222144
|
}
|
|
222142
222145
|
return [str];
|
|
222143
222146
|
}
|
|
@@ -222147,7 +222150,7 @@ var require_commonjs2 = __commonJS({
|
|
|
222147
222150
|
} else {
|
|
222148
222151
|
n = parseCommaParts(m.body);
|
|
222149
222152
|
if (n.length === 1 && n[0] !== void 0) {
|
|
222150
|
-
n = expand_(n[0], false).map(embrace);
|
|
222153
|
+
n = expand_(n[0], max, false).map(embrace);
|
|
222151
222154
|
if (n.length === 1) {
|
|
222152
222155
|
return post.map((p) => m.pre + n[0] + p);
|
|
222153
222156
|
}
|
|
@@ -222193,11 +222196,11 @@ var require_commonjs2 = __commonJS({
|
|
|
222193
222196
|
} else {
|
|
222194
222197
|
N = [];
|
|
222195
222198
|
for (let j = 0; j < n.length; j++) {
|
|
222196
|
-
N.push.apply(N, expand_(n[j], false));
|
|
222199
|
+
N.push.apply(N, expand_(n[j], max, false));
|
|
222197
222200
|
}
|
|
222198
222201
|
}
|
|
222199
222202
|
for (let j = 0; j < N.length; j++) {
|
|
222200
|
-
for (let k = 0; k < post.length; k++) {
|
|
222203
|
+
for (let k = 0; k < post.length && expansions.length < max; k++) {
|
|
222201
222204
|
const expansion = pre + N[j] + post[k];
|
|
222202
222205
|
if (!isTop || isSequence || expansion) {
|
|
222203
222206
|
expansions.push(expansion);
|
|
@@ -230881,7 +230884,7 @@ var require_ts_morph = __commonJS({
|
|
|
230881
230884
|
const nameNode = node.getNameNode();
|
|
230882
230885
|
if (nameNode == null)
|
|
230883
230886
|
return false;
|
|
230884
|
-
if (
|
|
230887
|
+
if (Node4.isArrayBindingPattern(nameNode) || Node4.isObjectBindingPattern(nameNode))
|
|
230885
230888
|
return nameNode.getElements().some((element) => nodeHasName(element, name));
|
|
230886
230889
|
const nodeName = node.getName != null ? node.getName() : nameNode.getText();
|
|
230887
230890
|
return nodeName === name;
|
|
@@ -231361,7 +231364,7 @@ var require_ts_morph = __commonJS({
|
|
|
231361
231364
|
__name(isNodeAmbientOrInAmbientContext, "isNodeAmbientOrInAmbientContext");
|
|
231362
231365
|
function checkNodeIsAmbient(node) {
|
|
231363
231366
|
const isThisAmbient = (node.getCombinedModifierFlags() & common.ts.ModifierFlags.Ambient) === common.ts.ModifierFlags.Ambient;
|
|
231364
|
-
return isThisAmbient ||
|
|
231367
|
+
return isThisAmbient || Node4.isInterfaceDeclaration(node) || Node4.isTypeAliasDeclaration(node);
|
|
231365
231368
|
}
|
|
231366
231369
|
__name(checkNodeIsAmbient, "checkNodeIsAmbient");
|
|
231367
231370
|
function isStringKind(kind) {
|
|
@@ -231796,15 +231799,15 @@ var require_ts_morph = __commonJS({
|
|
|
231796
231799
|
#getSourceFileForLiteral(literal) {
|
|
231797
231800
|
const parent = literal.getParentOrThrow();
|
|
231798
231801
|
const grandParent = parent.getParent();
|
|
231799
|
-
if (
|
|
231802
|
+
if (Node4.isImportDeclaration(parent) || Node4.isExportDeclaration(parent))
|
|
231800
231803
|
return parent.getModuleSpecifierSourceFile();
|
|
231801
|
-
else if (grandParent != null &&
|
|
231804
|
+
else if (grandParent != null && Node4.isImportEqualsDeclaration(grandParent))
|
|
231802
231805
|
return grandParent.getExternalModuleReferenceSourceFile();
|
|
231803
|
-
else if (grandParent != null &&
|
|
231806
|
+
else if (grandParent != null && Node4.isImportTypeNode(grandParent)) {
|
|
231804
231807
|
const importTypeSymbol = grandParent.getSymbol();
|
|
231805
231808
|
if (importTypeSymbol != null)
|
|
231806
231809
|
return ModuleUtils.getReferencedSourceFileFromSymbol(importTypeSymbol);
|
|
231807
|
-
} else if (
|
|
231810
|
+
} else if (Node4.isCallExpression(parent)) {
|
|
231808
231811
|
const literalSymbol = literal.getSymbol();
|
|
231809
231812
|
if (literalSymbol != null)
|
|
231810
231813
|
return ModuleUtils.getReferencedSourceFileFromSymbol(literalSymbol);
|
|
@@ -231903,7 +231906,7 @@ var require_ts_morph = __commonJS({
|
|
|
231903
231906
|
FormattingKind2[FormattingKind2["None"] = 3] = "None";
|
|
231904
231907
|
})(FormattingKind || (FormattingKind = {}));
|
|
231905
231908
|
function getClassMemberFormatting(parent, member) {
|
|
231906
|
-
if (
|
|
231909
|
+
if (Node4.isAmbientable(parent) && parent.isAmbient())
|
|
231907
231910
|
return FormattingKind.Newline;
|
|
231908
231911
|
if (hasBody$1(member))
|
|
231909
231912
|
return FormattingKind.Blankline;
|
|
@@ -231911,9 +231914,9 @@ var require_ts_morph = __commonJS({
|
|
|
231911
231914
|
}
|
|
231912
231915
|
__name(getClassMemberFormatting, "getClassMemberFormatting");
|
|
231913
231916
|
function hasBody$1(node) {
|
|
231914
|
-
if (
|
|
231917
|
+
if (Node4.isBodyable(node) && node.getBody() != null)
|
|
231915
231918
|
return true;
|
|
231916
|
-
if (
|
|
231919
|
+
if (Node4.isBodied(node))
|
|
231917
231920
|
return true;
|
|
231918
231921
|
return false;
|
|
231919
231922
|
}
|
|
@@ -231938,11 +231941,11 @@ var require_ts_morph = __commonJS({
|
|
|
231938
231941
|
}
|
|
231939
231942
|
__name(getInterfaceMemberFormatting, "getInterfaceMemberFormatting");
|
|
231940
231943
|
function hasBody(node) {
|
|
231941
|
-
if (
|
|
231944
|
+
if (Node4.isBodyable(node) && node.hasBody())
|
|
231942
231945
|
return true;
|
|
231943
|
-
if (
|
|
231946
|
+
if (Node4.isBodied(node))
|
|
231944
231947
|
return true;
|
|
231945
|
-
return
|
|
231948
|
+
return Node4.isInterfaceDeclaration(node) || Node4.isClassDeclaration(node) || Node4.isEnumDeclaration(node);
|
|
231946
231949
|
}
|
|
231947
231950
|
__name(hasBody, "hasBody");
|
|
231948
231951
|
function getStatementedNodeChildFormatting(parent, member) {
|
|
@@ -231956,9 +231959,9 @@ var require_ts_morph = __commonJS({
|
|
|
231956
231959
|
}
|
|
231957
231960
|
__name(getClausedNodeChildFormatting, "getClausedNodeChildFormatting");
|
|
231958
231961
|
function getGeneralFormatting(parent, child) {
|
|
231959
|
-
if (
|
|
231962
|
+
if (Node4.isClassDeclaration(parent))
|
|
231960
231963
|
return getClassMemberFormatting(parent, child);
|
|
231961
|
-
if (
|
|
231964
|
+
if (Node4.isInterfaceDeclaration(parent))
|
|
231962
231965
|
return getInterfaceMemberFormatting();
|
|
231963
231966
|
return getStatementedNodeChildFormatting(parent, child);
|
|
231964
231967
|
}
|
|
@@ -232150,9 +232153,9 @@ var require_ts_morph = __commonJS({
|
|
|
232150
232153
|
function getInsertPosFromIndex(index, syntaxList, children) {
|
|
232151
232154
|
if (index === 0) {
|
|
232152
232155
|
const parent = syntaxList.getParentOrThrow();
|
|
232153
|
-
if (
|
|
232156
|
+
if (Node4.isSourceFile(parent))
|
|
232154
232157
|
return 0;
|
|
232155
|
-
else if (
|
|
232158
|
+
else if (Node4.isCaseClause(parent) || Node4.isDefaultClause(parent)) {
|
|
232156
232159
|
const colonToken = parent.getFirstChildByKindOrThrow(common.SyntaxKind.ColonToken);
|
|
232157
232160
|
return colonToken.getEnd();
|
|
232158
232161
|
}
|
|
@@ -232170,9 +232173,9 @@ var require_ts_morph = __commonJS({
|
|
|
232170
232173
|
function getEndPosFromIndex(index, parent, children, fullText) {
|
|
232171
232174
|
let endPos;
|
|
232172
232175
|
if (index === children.length) {
|
|
232173
|
-
if (
|
|
232176
|
+
if (Node4.isSourceFile(parent))
|
|
232174
232177
|
endPos = parent.getEnd();
|
|
232175
|
-
else if (
|
|
232178
|
+
else if (Node4.isCaseClause(parent) || Node4.isDefaultClause(parent))
|
|
232176
232179
|
endPos = parent.getEnd();
|
|
232177
232180
|
else {
|
|
232178
232181
|
const parentContainer = getParentContainerOrThrow(parent);
|
|
@@ -232189,14 +232192,14 @@ var require_ts_morph = __commonJS({
|
|
|
232189
232192
|
}
|
|
232190
232193
|
__name(getEndPosFromIndex, "getEndPosFromIndex");
|
|
232191
232194
|
function getParentContainerOrThrow(parent) {
|
|
232192
|
-
if (
|
|
232195
|
+
if (Node4.isModuleDeclaration(parent)) {
|
|
232193
232196
|
const innerBody = parent._getInnerBody();
|
|
232194
232197
|
if (innerBody == null)
|
|
232195
232198
|
throw new common.errors.InvalidOperationError("This operation requires the module to have a body.");
|
|
232196
232199
|
return innerBody;
|
|
232197
|
-
} else if (
|
|
232200
|
+
} else if (Node4.isBodied(parent))
|
|
232198
232201
|
return parent.getBody();
|
|
232199
|
-
else if (
|
|
232202
|
+
else if (Node4.isBodyable(parent))
|
|
232200
232203
|
return parent.getBodyOrThrow();
|
|
232201
232204
|
else
|
|
232202
232205
|
return parent;
|
|
@@ -232251,7 +232254,7 @@ var require_ts_morph = __commonJS({
|
|
|
232251
232254
|
const result = [];
|
|
232252
232255
|
for (let i = 0; i < newLength; i++) {
|
|
232253
232256
|
const currentChild = newChildren[index + i];
|
|
232254
|
-
if (allowCommentNodes || !
|
|
232257
|
+
if (allowCommentNodes || !Node4.isCommentNode(currentChild))
|
|
232255
232258
|
result.push(currentChild);
|
|
232256
232259
|
}
|
|
232257
232260
|
return result;
|
|
@@ -232745,7 +232748,7 @@ var require_ts_morph = __commonJS({
|
|
|
232745
232748
|
this.#handler = handler;
|
|
232746
232749
|
}
|
|
232747
232750
|
handleNode(currentNode, newNode, newSourceFile) {
|
|
232748
|
-
if (!
|
|
232751
|
+
if (!Node4.isSourceFile(currentNode))
|
|
232749
232752
|
throw new common.errors.InvalidOperationError(`Can only use a TryOrForgetNodeHandler with a source file.`);
|
|
232750
232753
|
try {
|
|
232751
232754
|
this.#handler.handleNode(currentNode, newNode, newSourceFile);
|
|
@@ -232912,7 +232915,7 @@ var require_ts_morph = __commonJS({
|
|
|
232912
232915
|
const lowerIndex = Math.min(newIndex, oldIndex);
|
|
232913
232916
|
const upperIndex = Math.max(newIndex, oldIndex);
|
|
232914
232917
|
const childrenInNewOrder = getChildrenInNewOrder();
|
|
232915
|
-
const isParentSourceFile =
|
|
232918
|
+
const isParentSourceFile = Node4.isSourceFile(parent.getParentOrThrow());
|
|
232916
232919
|
let finalText = "";
|
|
232917
232920
|
fillPrefixText();
|
|
232918
232921
|
fillTextForIndex(lowerIndex);
|
|
@@ -233283,14 +233286,14 @@ var require_ts_morph = __commonJS({
|
|
|
233283
233286
|
const bodyNode = getBodyNodeOrThrow();
|
|
233284
233287
|
return [bodyNode.getStart() + 1, bodyNode.getEnd() - 1];
|
|
233285
233288
|
function getBodyNodeOrThrow() {
|
|
233286
|
-
if (
|
|
233289
|
+
if (Node4.isModuleDeclaration(node)) {
|
|
233287
233290
|
const bodyNode2 = node._getInnerBody();
|
|
233288
233291
|
if (bodyNode2 == null)
|
|
233289
233292
|
throw new common.errors.InvalidOperationError("This operation requires the module to have a body.");
|
|
233290
233293
|
return bodyNode2;
|
|
233291
|
-
} else if (
|
|
233294
|
+
} else if (Node4.isBodied(node))
|
|
233292
233295
|
return node.getBody();
|
|
233293
|
-
else if (
|
|
233296
|
+
else if (Node4.isBodyable(node))
|
|
233294
233297
|
return node.getBodyOrThrow();
|
|
233295
233298
|
else
|
|
233296
233299
|
common.errors.throwNotImplementedForSyntaxKindError(node.getKind(), node);
|
|
@@ -233480,7 +233483,7 @@ Path: ` + sourceFile.getFilePath() + "\nText: " + JSON.stringify(textManipulator
|
|
|
233480
233483
|
__name(prependCommaAndSeparator, "prependCommaAndSeparator");
|
|
233481
233484
|
function getPreviousNonCommentNode() {
|
|
233482
233485
|
for (let i = insertIndex - 1; i >= 0; i--) {
|
|
233483
|
-
if (!
|
|
233486
|
+
if (!Node4.isCommentNode(currentNodes[i]))
|
|
233484
233487
|
return currentNodes[i];
|
|
233485
233488
|
}
|
|
233486
233489
|
return void 0;
|
|
@@ -233488,7 +233491,7 @@ Path: ` + sourceFile.getFilePath() + "\nText: " + JSON.stringify(textManipulator
|
|
|
233488
233491
|
__name(getPreviousNonCommentNode, "getPreviousNonCommentNode");
|
|
233489
233492
|
function getNextNonCommentNode() {
|
|
233490
233493
|
for (let i = insertIndex; i < currentNodes.length; i++) {
|
|
233491
|
-
if (!
|
|
233494
|
+
if (!Node4.isCommentNode(currentNodes[i]))
|
|
233492
233495
|
return currentNodes[i];
|
|
233493
233496
|
}
|
|
233494
233497
|
return void 0;
|
|
@@ -233546,7 +233549,7 @@ Path: ` + sourceFile.getFilePath() + "\nText: " + JSON.stringify(textManipulator
|
|
|
233546
233549
|
function getChild(child) {
|
|
233547
233550
|
if (child == null)
|
|
233548
233551
|
return child;
|
|
233549
|
-
else if (
|
|
233552
|
+
else if (Node4.isOverloadable(child))
|
|
233550
233553
|
return child.getImplementation() || child;
|
|
233551
233554
|
else
|
|
233552
233555
|
return child;
|
|
@@ -233581,7 +233584,7 @@ Path: ` + sourceFile.getFilePath() + "\nText: " + JSON.stringify(textManipulator
|
|
|
233581
233584
|
let count = 0;
|
|
233582
233585
|
for (let i = index - 1; i >= 0; i--) {
|
|
233583
233586
|
const node = startChildren[i];
|
|
233584
|
-
if (
|
|
233587
|
+
if (Node4.isCommentNode(node)) {
|
|
233585
233588
|
commentCount++;
|
|
233586
233589
|
if (node.getText().startsWith("/**"))
|
|
233587
233590
|
count = commentCount;
|
|
@@ -233659,12 +233662,12 @@ Path: ` + sourceFile.getFilePath() + "\nText: " + JSON.stringify(textManipulator
|
|
|
233659
233662
|
}
|
|
233660
233663
|
__name(removeChildrenWithFormatting, "removeChildrenWithFormatting");
|
|
233661
233664
|
function removeClassMember(classMember) {
|
|
233662
|
-
if (
|
|
233665
|
+
if (Node4.isOverloadable(classMember)) {
|
|
233663
233666
|
if (classMember.isImplementation())
|
|
233664
233667
|
removeClassMembers([...classMember.getOverloads(), classMember]);
|
|
233665
233668
|
else {
|
|
233666
233669
|
const parent = classMember.getParentOrThrow();
|
|
233667
|
-
if (
|
|
233670
|
+
if (Node4.isAmbientable(parent) && parent.isAmbient())
|
|
233668
233671
|
removeClassMembers([classMember]);
|
|
233669
233672
|
else
|
|
233670
233673
|
removeChildren({ children: [classMember], removeFollowingSpaces: true, removeFollowingNewLines: true });
|
|
@@ -234018,7 +234021,7 @@ Path: ` + sourceFile.getFilePath() + "\nText: " + JSON.stringify(textManipulator
|
|
|
234018
234021
|
return this.compilerObject.kind;
|
|
234019
234022
|
}
|
|
234020
234023
|
};
|
|
234021
|
-
var
|
|
234024
|
+
var Node4 = class _Node {
|
|
234022
234025
|
static {
|
|
234023
234026
|
__name(this, "Node");
|
|
234024
234027
|
}
|
|
@@ -234819,10 +234822,10 @@ Node text: ${this.#forgottenText}`;
|
|
|
234819
234822
|
const fileText = compilerSourceFile.getFullText();
|
|
234820
234823
|
let finalText = "";
|
|
234821
234824
|
let lastPos = replaceRange[0];
|
|
234822
|
-
for (const
|
|
234823
|
-
finalText += fileText.substring(lastPos,
|
|
234824
|
-
finalText += printer.printNode(common.ts.EmitHint.Unspecified,
|
|
234825
|
-
lastPos =
|
|
234825
|
+
for (const transform16 of transformations) {
|
|
234826
|
+
finalText += fileText.substring(lastPos, transform16.start);
|
|
234827
|
+
finalText += printer.printNode(common.ts.EmitHint.Unspecified, transform16.compilerNode, transform16.compilerNode.getSourceFile() ?? compilerSourceFile);
|
|
234828
|
+
lastPos = transform16.end;
|
|
234826
234829
|
}
|
|
234827
234830
|
finalText += fileText.substring(lastPos, replaceRange[1]);
|
|
234828
234831
|
return finalText;
|
|
@@ -236736,7 +236739,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
236736
236739
|
}
|
|
236737
236740
|
__name(getWrappedCondition, "getWrappedCondition");
|
|
236738
236741
|
function insertWhiteSpaceTextAtPos(node, insertPos, textOrWriterFunction, methodName) {
|
|
236739
|
-
const parent =
|
|
236742
|
+
const parent = Node4.isSourceFile(node) ? node.getChildSyntaxListOrThrow() : node.getParentSyntaxList() || node.getParentOrThrow();
|
|
236740
236743
|
const newText = getTextFromStringOrWriter(node._getWriterWithQueuedIndentation(), textOrWriterFunction);
|
|
236741
236744
|
if (!/^[\s\r\n]*$/.test(newText))
|
|
236742
236745
|
throw new common.errors.InvalidOperationError(`Cannot insert non-whitespace into ${methodName}.`);
|
|
@@ -236785,7 +236788,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
236785
236788
|
Scope["Protected"] = "protected";
|
|
236786
236789
|
Scope["Private"] = "private";
|
|
236787
236790
|
})(exports.Scope || (exports.Scope = {}));
|
|
236788
|
-
var SyntaxList = class extends
|
|
236791
|
+
var SyntaxList = class extends Node4 {
|
|
236789
236792
|
static {
|
|
236790
236793
|
__name(this, "SyntaxList");
|
|
236791
236794
|
}
|
|
@@ -236807,12 +236810,12 @@ Node text: ${this.#forgottenText}`;
|
|
|
236807
236810
|
else
|
|
236808
236811
|
insertText = " " + insertText;
|
|
236809
236812
|
} else {
|
|
236810
|
-
if (index === 0 &&
|
|
236813
|
+
if (index === 0 && Node4.isSourceFile(parent)) {
|
|
236811
236814
|
if (!insertText.endsWith("\n"))
|
|
236812
236815
|
insertText += newLineKind;
|
|
236813
236816
|
} else {
|
|
236814
236817
|
insertText = newLineKind + insertText;
|
|
236815
|
-
if (!
|
|
236818
|
+
if (!Node4.isSourceFile(parent) && index === initialChildCount && insertText.endsWith("\n"))
|
|
236816
236819
|
insertText = insertText.replace(/\r?\n$/, "");
|
|
236817
236820
|
}
|
|
236818
236821
|
}
|
|
@@ -237072,7 +237075,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
237072
237075
|
if (value === hasExclamationToken)
|
|
237073
237076
|
return this;
|
|
237074
237077
|
if (value) {
|
|
237075
|
-
if (
|
|
237078
|
+
if (Node4.isQuestionTokenable(this))
|
|
237076
237079
|
this.setHasQuestionToken(false);
|
|
237077
237080
|
const colonNode = this.getFirstChildByKind(common.SyntaxKind.ColonToken);
|
|
237078
237081
|
if (colonNode == null)
|
|
@@ -237107,11 +237110,11 @@ Node text: ${this.#forgottenText}`;
|
|
|
237107
237110
|
return this.getExportKeyword() != null;
|
|
237108
237111
|
}
|
|
237109
237112
|
getExportKeyword() {
|
|
237110
|
-
if (
|
|
237113
|
+
if (Node4.isVariableDeclaration(this)) {
|
|
237111
237114
|
const variableStatement = this.getVariableStatement();
|
|
237112
237115
|
return variableStatement?.getExportKeyword();
|
|
237113
237116
|
}
|
|
237114
|
-
if (!
|
|
237117
|
+
if (!Node4.isModifierable(this))
|
|
237115
237118
|
return throwForNotModifierableNode();
|
|
237116
237119
|
return this.getFirstModifierByKind(common.SyntaxKind.ExportKeyword);
|
|
237117
237120
|
}
|
|
@@ -237122,11 +237125,11 @@ Node text: ${this.#forgottenText}`;
|
|
|
237122
237125
|
return this.getDefaultKeyword() != null;
|
|
237123
237126
|
}
|
|
237124
237127
|
getDefaultKeyword() {
|
|
237125
|
-
if (
|
|
237128
|
+
if (Node4.isVariableDeclaration(this)) {
|
|
237126
237129
|
const variableStatement = this.getVariableStatement();
|
|
237127
237130
|
return variableStatement?.getDefaultKeyword();
|
|
237128
237131
|
}
|
|
237129
|
-
if (!
|
|
237132
|
+
if (!Node4.isModifierable(this))
|
|
237130
237133
|
return throwForNotModifierableNode();
|
|
237131
237134
|
return this.getFirstModifierByKind(common.SyntaxKind.DefaultKeyword);
|
|
237132
237135
|
}
|
|
@@ -237186,7 +237189,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
237186
237189
|
setIsDefaultExport(value) {
|
|
237187
237190
|
if (value === this.isDefaultExport())
|
|
237188
237191
|
return this;
|
|
237189
|
-
if (value && !
|
|
237192
|
+
if (value && !Node4.isSourceFile(this.getParentOrThrow()))
|
|
237190
237193
|
throw new common.errors.InvalidOperationError("The parent must be a source file in order to set this node as a default export.");
|
|
237191
237194
|
const sourceFile = this.getSourceFile();
|
|
237192
237195
|
const fileDefaultExportSymbol = sourceFile.getDefaultExportSymbol();
|
|
@@ -237194,7 +237197,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
237194
237197
|
sourceFile.removeDefaultExport(fileDefaultExportSymbol);
|
|
237195
237198
|
if (!value)
|
|
237196
237199
|
return this;
|
|
237197
|
-
if (
|
|
237200
|
+
if (Node4.hasName(this) && shouldWriteAsSeparateStatement.call(this)) {
|
|
237198
237201
|
const parentSyntaxList = this.getFirstAncestorByKindOrThrow(common.SyntaxKind.SyntaxList);
|
|
237199
237202
|
const name = this.getName();
|
|
237200
237203
|
parentSyntaxList.insertChildText(this.getChildIndex() + 1, (writer) => {
|
|
@@ -237206,16 +237209,16 @@ Node text: ${this.#forgottenText}`;
|
|
|
237206
237209
|
}
|
|
237207
237210
|
return this;
|
|
237208
237211
|
function shouldWriteAsSeparateStatement() {
|
|
237209
|
-
if (
|
|
237212
|
+
if (Node4.isEnumDeclaration(this) || Node4.isModuleDeclaration(this) || Node4.isTypeAliasDeclaration(this))
|
|
237210
237213
|
return true;
|
|
237211
|
-
if (
|
|
237214
|
+
if (Node4.isAmbientable(this) && this.isAmbient())
|
|
237212
237215
|
return true;
|
|
237213
237216
|
return false;
|
|
237214
237217
|
}
|
|
237215
237218
|
__name(shouldWriteAsSeparateStatement, "shouldWriteAsSeparateStatement");
|
|
237216
237219
|
}
|
|
237217
237220
|
setIsExported(value) {
|
|
237218
|
-
if (
|
|
237221
|
+
if (Node4.isSourceFile(this.getParentOrThrow()))
|
|
237219
237222
|
this.toggleModifier("default", false);
|
|
237220
237223
|
this.toggleModifier("export", value);
|
|
237221
237224
|
return this;
|
|
@@ -240416,8 +240419,8 @@ Node text: ${this.#forgottenText}`;
|
|
|
240416
240419
|
this._standardWrite(writer, info, () => {
|
|
240417
240420
|
this._context.structurePrinterFactory.forImportDeclaration().printTexts(writer, structures);
|
|
240418
240421
|
}, {
|
|
240419
|
-
previousNewLine: /* @__PURE__ */ __name((previousMember) =>
|
|
240420
|
-
nextNewLine: /* @__PURE__ */ __name((nextMember) =>
|
|
240422
|
+
previousNewLine: /* @__PURE__ */ __name((previousMember) => Node4.isImportDeclaration(previousMember) || isComment(previousMember.compilerNode), "previousNewLine"),
|
|
240423
|
+
nextNewLine: /* @__PURE__ */ __name((nextMember) => Node4.isImportDeclaration(nextMember), "nextNewLine")
|
|
240421
240424
|
});
|
|
240422
240425
|
}, "write")
|
|
240423
240426
|
});
|
|
@@ -240436,7 +240439,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
240436
240439
|
return common.errors.throwIfNullOrUndefined(this.getImportDeclaration(conditionOrModuleSpecifier), message ?? "Expected to find an import with the provided condition.", this);
|
|
240437
240440
|
}
|
|
240438
240441
|
getImportDeclarations() {
|
|
240439
|
-
return this.getStatements().filter(
|
|
240442
|
+
return this.getStatements().filter(Node4.isImportDeclaration);
|
|
240440
240443
|
}
|
|
240441
240444
|
addExportDeclaration(structure) {
|
|
240442
240445
|
return this.addExportDeclarations([structure])[0];
|
|
@@ -240456,8 +240459,8 @@ Node text: ${this.#forgottenText}`;
|
|
|
240456
240459
|
this._standardWrite(writer, info, () => {
|
|
240457
240460
|
this._context.structurePrinterFactory.forExportDeclaration().printTexts(writer, structures);
|
|
240458
240461
|
}, {
|
|
240459
|
-
previousNewLine: /* @__PURE__ */ __name((previousMember) =>
|
|
240460
|
-
nextNewLine: /* @__PURE__ */ __name((nextMember) =>
|
|
240462
|
+
previousNewLine: /* @__PURE__ */ __name((previousMember) => Node4.isExportDeclaration(previousMember) || isComment(previousMember.compilerNode), "previousNewLine"),
|
|
240463
|
+
nextNewLine: /* @__PURE__ */ __name((nextMember) => Node4.isExportDeclaration(nextMember), "nextNewLine")
|
|
240461
240464
|
});
|
|
240462
240465
|
}, "write")
|
|
240463
240466
|
});
|
|
@@ -240476,7 +240479,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
240476
240479
|
return common.errors.throwIfNullOrUndefined(this.getExportDeclaration(conditionOrModuleSpecifier), message ?? "Expected to find an export declaration with the provided condition.", this);
|
|
240477
240480
|
}
|
|
240478
240481
|
getExportDeclarations() {
|
|
240479
|
-
return this.getStatements().filter(
|
|
240482
|
+
return this.getStatements().filter(Node4.isExportDeclaration);
|
|
240480
240483
|
}
|
|
240481
240484
|
addExportAssignment(structure) {
|
|
240482
240485
|
return this.addExportAssignments([structure])[0];
|
|
@@ -240496,8 +240499,8 @@ Node text: ${this.#forgottenText}`;
|
|
|
240496
240499
|
this._standardWrite(writer, info, () => {
|
|
240497
240500
|
this._context.structurePrinterFactory.forExportAssignment().printTexts(writer, structures);
|
|
240498
240501
|
}, {
|
|
240499
|
-
previousNewLine: /* @__PURE__ */ __name((previousMember) =>
|
|
240500
|
-
nextNewLine: /* @__PURE__ */ __name((nextMember) =>
|
|
240502
|
+
previousNewLine: /* @__PURE__ */ __name((previousMember) => Node4.isExportAssignment(previousMember) || isComment(previousMember.compilerNode), "previousNewLine"),
|
|
240503
|
+
nextNewLine: /* @__PURE__ */ __name((nextMember) => Node4.isExportAssignment(nextMember), "nextNewLine")
|
|
240501
240504
|
});
|
|
240502
240505
|
}, "write")
|
|
240503
240506
|
});
|
|
@@ -240509,7 +240512,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
240509
240512
|
return common.errors.throwIfNullOrUndefined(this.getExportAssignment(condition), message ?? "Expected to find an export assignment with the provided condition.", this);
|
|
240510
240513
|
}
|
|
240511
240514
|
getExportAssignments() {
|
|
240512
|
-
return this.getStatements().filter(
|
|
240515
|
+
return this.getStatements().filter(Node4.isExportAssignment);
|
|
240513
240516
|
}
|
|
240514
240517
|
getDefaultExportSymbol() {
|
|
240515
240518
|
const sourceFileSymbol = this.getSymbol();
|
|
@@ -240540,23 +240543,23 @@ Node text: ${this.#forgottenText}`;
|
|
|
240540
240543
|
}
|
|
240541
240544
|
return result;
|
|
240542
240545
|
function* getDeclarationHandlingImportsAndExports(declaration) {
|
|
240543
|
-
if (
|
|
240546
|
+
if (Node4.isExportSpecifier(declaration)) {
|
|
240544
240547
|
for (const d of declaration.getLocalTargetDeclarations())
|
|
240545
240548
|
yield* getDeclarationHandlingImportsAndExports(d);
|
|
240546
|
-
} else if (
|
|
240549
|
+
} else if (Node4.isExportAssignment(declaration)) {
|
|
240547
240550
|
const expression = declaration.getExpression();
|
|
240548
240551
|
if (expression == null || expression.getKind() !== common.SyntaxKind.Identifier) {
|
|
240549
240552
|
yield expression;
|
|
240550
240553
|
return;
|
|
240551
240554
|
}
|
|
240552
240555
|
yield* getDeclarationsForSymbol(expression.getSymbol());
|
|
240553
|
-
} else if (
|
|
240556
|
+
} else if (Node4.isImportSpecifier(declaration)) {
|
|
240554
240557
|
const identifier = declaration.getNameNode();
|
|
240555
240558
|
const symbol = identifier.getSymbol();
|
|
240556
240559
|
if (symbol == null)
|
|
240557
240560
|
return;
|
|
240558
240561
|
yield* getDeclarationsForSymbol(symbol.getAliasedSymbol() || symbol);
|
|
240559
|
-
} else if (
|
|
240562
|
+
} else if (Node4.isImportClause(declaration)) {
|
|
240560
240563
|
const identifier = declaration.getDefaultImport();
|
|
240561
240564
|
if (identifier == null)
|
|
240562
240565
|
return;
|
|
@@ -240564,7 +240567,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
240564
240567
|
if (symbol == null)
|
|
240565
240568
|
return;
|
|
240566
240569
|
yield* getDeclarationsForSymbol(symbol.getAliasedSymbol() || symbol);
|
|
240567
|
-
} else if (
|
|
240570
|
+
} else if (Node4.isNamespaceImport(declaration) || Node4.isNamespaceExport(declaration)) {
|
|
240568
240571
|
const symbol = declaration.getNameNode().getSymbol();
|
|
240569
240572
|
if (symbol == null)
|
|
240570
240573
|
return;
|
|
@@ -240589,7 +240592,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
240589
240592
|
const declaration = defaultExportSymbol.getDeclarations()[0];
|
|
240590
240593
|
if (declaration.compilerNode.kind === common.SyntaxKind.ExportAssignment)
|
|
240591
240594
|
removeChildrenWithFormatting({ children: [declaration], getSiblingFormatting: /* @__PURE__ */ __name(() => FormattingKind.Newline, "getSiblingFormatting") });
|
|
240592
|
-
else if (
|
|
240595
|
+
else if (Node4.isModifierable(declaration)) {
|
|
240593
240596
|
declaration.toggleModifier("default", false);
|
|
240594
240597
|
declaration.toggleModifier("export", false);
|
|
240595
240598
|
}
|
|
@@ -240632,12 +240635,12 @@ Node text: ${this.#forgottenText}`;
|
|
|
240632
240635
|
}
|
|
240633
240636
|
__name(ReferenceFindableNode, "ReferenceFindableNode");
|
|
240634
240637
|
function getNodeForReferences(node) {
|
|
240635
|
-
if (
|
|
240638
|
+
if (Node4.isIdentifier(node) || Node4.isStringLiteral(node))
|
|
240636
240639
|
return node;
|
|
240637
240640
|
const nameNode = node.getNodeProperty("name");
|
|
240638
240641
|
if (nameNode != null)
|
|
240639
240642
|
return nameNode;
|
|
240640
|
-
if (
|
|
240643
|
+
if (Node4.isExportable(node))
|
|
240641
240644
|
return node.getDefaultKeyword() || node;
|
|
240642
240645
|
return node;
|
|
240643
240646
|
}
|
|
@@ -240648,12 +240651,12 @@ Node text: ${this.#forgottenText}`;
|
|
|
240648
240651
|
renameNode(getNodeToRename(this), newName, options);
|
|
240649
240652
|
return this;
|
|
240650
240653
|
function getNodeToRename(thisNode) {
|
|
240651
|
-
if (
|
|
240654
|
+
if (Node4.isIdentifier(thisNode) || Node4.isPrivateIdentifier(thisNode) || Node4.isStringLiteral(thisNode))
|
|
240652
240655
|
return thisNode;
|
|
240653
240656
|
else if (thisNode.getNameNode != null) {
|
|
240654
240657
|
const node = thisNode.getNameNode();
|
|
240655
240658
|
common.errors.throwIfNullOrUndefined(node, "Expected to find a name node when renaming.");
|
|
240656
|
-
if (
|
|
240659
|
+
if (Node4.isArrayBindingPattern(node) || Node4.isObjectBindingPattern(node))
|
|
240657
240660
|
throw new common.errors.NotImplementedError(`Not implemented renameable scenario for ${node.getKindName()}.`);
|
|
240658
240661
|
return node;
|
|
240659
240662
|
} else {
|
|
@@ -240742,7 +240745,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
240742
240745
|
}
|
|
240743
240746
|
__name(NameableNodeInternal, "NameableNodeInternal");
|
|
240744
240747
|
function addNameNode(node, newName) {
|
|
240745
|
-
if (
|
|
240748
|
+
if (Node4.isClassDeclaration(node) || Node4.isClassExpression(node)) {
|
|
240746
240749
|
const classKeyword = node.getFirstChildByKindOrThrow(common.SyntaxKind.ClassKeyword);
|
|
240747
240750
|
insertIntoParentTextRange({
|
|
240748
240751
|
insertPos: classKeyword.getEnd(),
|
|
@@ -240869,7 +240872,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
240869
240872
|
if (value === hasQuestionDotToken)
|
|
240870
240873
|
return this;
|
|
240871
240874
|
if (value) {
|
|
240872
|
-
if (
|
|
240875
|
+
if (Node4.isPropertyAccessExpression(this))
|
|
240873
240876
|
this.getFirstChildByKindOrThrow(common.SyntaxKind.DotToken).replaceWithText("?.");
|
|
240874
240877
|
else {
|
|
240875
240878
|
insertIntoParentTextRange({
|
|
@@ -240879,16 +240882,16 @@ Node text: ${this.#forgottenText}`;
|
|
|
240879
240882
|
});
|
|
240880
240883
|
}
|
|
240881
240884
|
} else {
|
|
240882
|
-
if (
|
|
240885
|
+
if (Node4.isPropertyAccessExpression(this))
|
|
240883
240886
|
questionDotTokenNode.replaceWithText(".");
|
|
240884
240887
|
else
|
|
240885
240888
|
removeChildren({ children: [questionDotTokenNode] });
|
|
240886
240889
|
}
|
|
240887
240890
|
return this;
|
|
240888
240891
|
function getInsertPos2() {
|
|
240889
|
-
if (
|
|
240892
|
+
if (Node4.isCallExpression(this))
|
|
240890
240893
|
return this.getFirstChildByKindOrThrow(common.SyntaxKind.OpenParenToken).getStart();
|
|
240891
|
-
if (
|
|
240894
|
+
if (Node4.isElementAccessExpression(this))
|
|
240892
240895
|
return this.getFirstChildByKindOrThrow(common.SyntaxKind.OpenBracketToken).getStart();
|
|
240893
240896
|
common.errors.throwNotImplementedForSyntaxKindError(this.compilerNode.kind);
|
|
240894
240897
|
}
|
|
@@ -240925,7 +240928,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
240925
240928
|
if (value === hasQuestionToken)
|
|
240926
240929
|
return this;
|
|
240927
240930
|
if (value) {
|
|
240928
|
-
if (
|
|
240931
|
+
if (Node4.isExclamationTokenable(this))
|
|
240929
240932
|
this.setHasExclamationToken(false);
|
|
240930
240933
|
insertIntoParentTextRange({
|
|
240931
240934
|
insertPos: getInsertPos2.call(this),
|
|
@@ -240937,7 +240940,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
240937
240940
|
}
|
|
240938
240941
|
return this;
|
|
240939
240942
|
function getInsertPos2() {
|
|
240940
|
-
if (
|
|
240943
|
+
if (Node4.hasName(this))
|
|
240941
240944
|
return this.getNameNode().getEnd();
|
|
240942
240945
|
const colonNode = this.getFirstChildByKind(common.SyntaxKind.ColonToken);
|
|
240943
240946
|
if (colonNode != null)
|
|
@@ -241063,7 +241066,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
241063
241066
|
const scope = getScopeForNode(this);
|
|
241064
241067
|
if (scope != null)
|
|
241065
241068
|
return scope;
|
|
241066
|
-
if (
|
|
241069
|
+
if (Node4.isParameterDeclaration(this) && this.isReadonly())
|
|
241067
241070
|
return exports.Scope.Public;
|
|
241068
241071
|
return void 0;
|
|
241069
241072
|
}
|
|
@@ -241219,14 +241222,14 @@ Node text: ${this.#forgottenText}`;
|
|
|
241219
241222
|
__name(TextInsertableNode, "TextInsertableNode");
|
|
241220
241223
|
function getValidRange(thisNode) {
|
|
241221
241224
|
const rangeNode = getRangeNode();
|
|
241222
|
-
const openBrace =
|
|
241225
|
+
const openBrace = Node4.isSourceFile(rangeNode) ? void 0 : rangeNode.getPreviousSiblingIfKind(common.SyntaxKind.OpenBraceToken);
|
|
241223
241226
|
const closeBrace = openBrace == null ? void 0 : rangeNode.getNextSiblingIfKind(common.SyntaxKind.CloseBraceToken);
|
|
241224
241227
|
if (openBrace != null && closeBrace != null)
|
|
241225
241228
|
return [openBrace.getEnd(), closeBrace.getStart()];
|
|
241226
241229
|
else
|
|
241227
241230
|
return [rangeNode.getPos(), rangeNode.getEnd()];
|
|
241228
241231
|
function getRangeNode() {
|
|
241229
|
-
if (
|
|
241232
|
+
if (Node4.isSourceFile(thisNode))
|
|
241230
241233
|
return thisNode;
|
|
241231
241234
|
return thisNode.getChildSyntaxListOrThrow();
|
|
241232
241235
|
}
|
|
@@ -241751,7 +241754,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
241751
241754
|
const namedNode = node;
|
|
241752
241755
|
if (namedNode.getNameNode != null)
|
|
241753
241756
|
return namedNode.getNameNode().getEnd();
|
|
241754
|
-
else if (
|
|
241757
|
+
else if (Node4.isCallSignatureDeclaration(node) || Node4.isFunctionTypeNode(node))
|
|
241755
241758
|
return node.getFirstChildByKindOrThrow(common.SyntaxKind.OpenParenToken).getStart();
|
|
241756
241759
|
else
|
|
241757
241760
|
throw new common.errors.NotImplementedError(`Not implemented scenario inserting type parameters for node with kind ${node.getKindName()}.`);
|
|
@@ -241765,7 +241768,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
241765
241768
|
};
|
|
241766
241769
|
}
|
|
241767
241770
|
__name(UnwrappableNode, "UnwrappableNode");
|
|
241768
|
-
var ArrayBindingPattern = class extends
|
|
241771
|
+
var ArrayBindingPattern = class extends Node4 {
|
|
241769
241772
|
static {
|
|
241770
241773
|
__name(this, "ArrayBindingPattern");
|
|
241771
241774
|
}
|
|
@@ -241774,7 +241777,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
241774
241777
|
}
|
|
241775
241778
|
};
|
|
241776
241779
|
var createBase$F = /* @__PURE__ */ __name((ctor) => DotDotDotTokenableNode(InitializerExpressionableNode(BindingNamedNode(ctor))), "createBase$F");
|
|
241777
|
-
var BindingElementBase = createBase$F(
|
|
241780
|
+
var BindingElementBase = createBase$F(Node4);
|
|
241778
241781
|
var BindingElement = class extends BindingElementBase {
|
|
241779
241782
|
static {
|
|
241780
241783
|
__name(this, "BindingElement");
|
|
@@ -241786,7 +241789,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
241786
241789
|
return this._getNodeFromCompilerNodeIfExists(this.compilerNode.propertyName);
|
|
241787
241790
|
}
|
|
241788
241791
|
};
|
|
241789
|
-
var ObjectBindingPattern2 = class extends
|
|
241792
|
+
var ObjectBindingPattern2 = class extends Node4 {
|
|
241790
241793
|
static {
|
|
241791
241794
|
__name(this, "ObjectBindingPattern");
|
|
241792
241795
|
}
|
|
@@ -241823,7 +241826,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
241823
241826
|
};
|
|
241824
241827
|
}
|
|
241825
241828
|
__name(AbstractableNode, "AbstractableNode");
|
|
241826
|
-
var Expression = class extends
|
|
241829
|
+
var Expression = class extends Node4 {
|
|
241827
241830
|
static {
|
|
241828
241831
|
__name(this, "Expression");
|
|
241829
241832
|
}
|
|
@@ -242128,7 +242131,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
242128
242131
|
__name(this, "NonNullExpression");
|
|
242129
242132
|
}
|
|
242130
242133
|
};
|
|
242131
|
-
var ObjectLiteralElement = class extends
|
|
242134
|
+
var ObjectLiteralElement = class extends Node4 {
|
|
242132
242135
|
static {
|
|
242133
242136
|
__name(this, "ObjectLiteralElement");
|
|
242134
242137
|
}
|
|
@@ -242541,7 +242544,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
242541
242544
|
__name(this, "YieldExpression");
|
|
242542
242545
|
}
|
|
242543
242546
|
};
|
|
242544
|
-
var StatementBase = ChildOrderableNode(
|
|
242547
|
+
var StatementBase = ChildOrderableNode(Node4);
|
|
242545
242548
|
var Statement = class extends StatementBase {
|
|
242546
242549
|
static {
|
|
242547
242550
|
__name(this, "Statement");
|
|
@@ -242585,7 +242588,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
242585
242588
|
return getChildSyntaxList.call(this).insertChildText(index, writerFunction);
|
|
242586
242589
|
function getChildSyntaxList() {
|
|
242587
242590
|
const childSyntaxList = this.getChildSyntaxListOrThrow();
|
|
242588
|
-
if (
|
|
242591
|
+
if (Node4.isCaseClause(this) || Node4.isDefaultClause(this)) {
|
|
242589
242592
|
const block = childSyntaxList.getFirstChildIfKind(common.SyntaxKind.Block);
|
|
242590
242593
|
if (block != null)
|
|
242591
242594
|
return block.getChildSyntaxListOrThrow();
|
|
@@ -242626,7 +242629,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
242626
242629
|
});
|
|
242627
242630
|
}
|
|
242628
242631
|
getClasses() {
|
|
242629
|
-
return this.getStatements().filter(
|
|
242632
|
+
return this.getStatements().filter(Node4.isClassDeclaration);
|
|
242630
242633
|
}
|
|
242631
242634
|
getClass(nameOrFindFunction) {
|
|
242632
242635
|
return getNodeByNameOrFindFunction(this.getClasses(), nameOrFindFunction);
|
|
@@ -242656,7 +242659,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
242656
242659
|
});
|
|
242657
242660
|
}
|
|
242658
242661
|
getEnums() {
|
|
242659
|
-
return this.getStatements().filter(
|
|
242662
|
+
return this.getStatements().filter(Node4.isEnumDeclaration);
|
|
242660
242663
|
}
|
|
242661
242664
|
getEnum(nameOrFindFunction) {
|
|
242662
242665
|
return getNodeByNameOrFindFunction(this.getEnums(), nameOrFindFunction);
|
|
@@ -242684,14 +242687,14 @@ Node text: ${this.#forgottenText}`;
|
|
|
242684
242687
|
isAmbient: isNodeAmbientOrInAmbientContext(this)
|
|
242685
242688
|
}).printTexts(writer, structures);
|
|
242686
242689
|
}, {
|
|
242687
|
-
previousNewLine: /* @__PURE__ */ __name((previousMember) => structures[0].hasDeclareKeyword === true &&
|
|
242688
|
-
nextNewLine: /* @__PURE__ */ __name((nextMember) => structures[structures.length - 1].hasDeclareKeyword === true &&
|
|
242690
|
+
previousNewLine: /* @__PURE__ */ __name((previousMember) => structures[0].hasDeclareKeyword === true && Node4.isFunctionDeclaration(previousMember) && previousMember.getBody() == null, "previousNewLine"),
|
|
242691
|
+
nextNewLine: /* @__PURE__ */ __name((nextMember) => structures[structures.length - 1].hasDeclareKeyword === true && Node4.isFunctionDeclaration(nextMember) && nextMember.getBody() == null, "nextNewLine")
|
|
242689
242692
|
});
|
|
242690
242693
|
}, "write")
|
|
242691
242694
|
});
|
|
242692
242695
|
}
|
|
242693
242696
|
getFunctions() {
|
|
242694
|
-
return this.getStatements().filter(
|
|
242697
|
+
return this.getStatements().filter(Node4.isFunctionDeclaration).filter((f) => f.isAmbient() || f.isImplementation());
|
|
242695
242698
|
}
|
|
242696
242699
|
getFunction(nameOrFindFunction) {
|
|
242697
242700
|
return getNodeByNameOrFindFunction(this.getFunctions(), nameOrFindFunction);
|
|
@@ -242721,7 +242724,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
242721
242724
|
});
|
|
242722
242725
|
}
|
|
242723
242726
|
getInterfaces() {
|
|
242724
|
-
return this.getStatements().filter(
|
|
242727
|
+
return this.getStatements().filter(Node4.isInterfaceDeclaration);
|
|
242725
242728
|
}
|
|
242726
242729
|
getInterface(nameOrFindFunction) {
|
|
242727
242730
|
return getNodeByNameOrFindFunction(this.getInterfaces(), nameOrFindFunction);
|
|
@@ -242751,7 +242754,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
242751
242754
|
});
|
|
242752
242755
|
}
|
|
242753
242756
|
getModules() {
|
|
242754
|
-
return this.getStatements().filter(
|
|
242757
|
+
return this.getStatements().filter(Node4.isModuleDeclaration);
|
|
242755
242758
|
}
|
|
242756
242759
|
getModule(nameOrFindFunction) {
|
|
242757
242760
|
return getNodeByNameOrFindFunction(this.getModules(), nameOrFindFunction);
|
|
@@ -242777,14 +242780,14 @@ Node text: ${this.#forgottenText}`;
|
|
|
242777
242780
|
this._standardWrite(writer, info, () => {
|
|
242778
242781
|
this._context.structurePrinterFactory.forTypeAliasDeclaration().printTexts(writer, structures);
|
|
242779
242782
|
}, {
|
|
242780
|
-
previousNewLine: /* @__PURE__ */ __name((previousMember) =>
|
|
242781
|
-
nextNewLine: /* @__PURE__ */ __name((nextMember) =>
|
|
242783
|
+
previousNewLine: /* @__PURE__ */ __name((previousMember) => Node4.isTypeAliasDeclaration(previousMember), "previousNewLine"),
|
|
242784
|
+
nextNewLine: /* @__PURE__ */ __name((nextMember) => Node4.isTypeAliasDeclaration(nextMember), "nextNewLine")
|
|
242782
242785
|
});
|
|
242783
242786
|
}, "write")
|
|
242784
242787
|
});
|
|
242785
242788
|
}
|
|
242786
242789
|
getTypeAliases() {
|
|
242787
|
-
return this.getStatements().filter(
|
|
242790
|
+
return this.getStatements().filter(Node4.isTypeAliasDeclaration);
|
|
242788
242791
|
}
|
|
242789
242792
|
getTypeAlias(nameOrFindFunction) {
|
|
242790
242793
|
return getNodeByNameOrFindFunction(this.getTypeAliases(), nameOrFindFunction);
|
|
@@ -242793,7 +242796,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
242793
242796
|
return common.errors.throwIfNullOrUndefined(this.getTypeAlias(nameOrFindFunction), () => getNotFoundErrorMessageForNameOrFindFunction("type alias", nameOrFindFunction));
|
|
242794
242797
|
}
|
|
242795
242798
|
getVariableStatements() {
|
|
242796
|
-
return this.getStatements().filter(
|
|
242799
|
+
return this.getStatements().filter(Node4.isVariableStatement);
|
|
242797
242800
|
}
|
|
242798
242801
|
getVariableStatement(nameOrFindFunction) {
|
|
242799
242802
|
return this.getVariableStatements().find(getFindFunction());
|
|
@@ -242825,8 +242828,8 @@ Node text: ${this.#forgottenText}`;
|
|
|
242825
242828
|
this._standardWrite(writer, info, () => {
|
|
242826
242829
|
this._context.structurePrinterFactory.forVariableStatement().printTexts(writer, structures);
|
|
242827
242830
|
}, {
|
|
242828
|
-
previousNewLine: /* @__PURE__ */ __name((previousMember) =>
|
|
242829
|
-
nextNewLine: /* @__PURE__ */ __name((nextMember) =>
|
|
242831
|
+
previousNewLine: /* @__PURE__ */ __name((previousMember) => Node4.isVariableStatement(previousMember), "previousNewLine"),
|
|
242832
|
+
nextNewLine: /* @__PURE__ */ __name((nextMember) => Node4.isVariableStatement(nextMember), "nextNewLine")
|
|
242830
242833
|
});
|
|
242831
242834
|
}, "write")
|
|
242832
242835
|
});
|
|
@@ -242845,11 +242848,11 @@ Node text: ${this.#forgottenText}`;
|
|
|
242845
242848
|
}
|
|
242846
242849
|
getStructure() {
|
|
242847
242850
|
const structure = {};
|
|
242848
|
-
if (
|
|
242851
|
+
if (Node4.isBodyable(this) && !this.hasBody())
|
|
242849
242852
|
structure.statements = void 0;
|
|
242850
242853
|
else {
|
|
242851
242854
|
structure.statements = this.getStatements().map((s) => {
|
|
242852
|
-
if (
|
|
242855
|
+
if (Node4._hasStructure(s))
|
|
242853
242856
|
return s.getStructure();
|
|
242854
242857
|
return s.getText({ trimLeadingIndentation: true });
|
|
242855
242858
|
});
|
|
@@ -242857,7 +242860,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
242857
242860
|
return callBaseGetStructure(Base.prototype, this, structure);
|
|
242858
242861
|
}
|
|
242859
242862
|
set(structure) {
|
|
242860
|
-
if (
|
|
242863
|
+
if (Node4.isBodyable(this) && structure.statements == null && structure.hasOwnProperty(common.nameof(structure, "statements")))
|
|
242861
242864
|
this.removeBody();
|
|
242862
242865
|
else if (structure.statements != null) {
|
|
242863
242866
|
const statementCount = this._getCompilerStatementsWithComments().length;
|
|
@@ -242878,17 +242881,17 @@ Node text: ${this.#forgottenText}`;
|
|
|
242878
242881
|
}
|
|
242879
242882
|
}
|
|
242880
242883
|
_getCompilerStatementsContainer() {
|
|
242881
|
-
if (
|
|
242884
|
+
if (Node4.isSourceFile(this) || Node4.isCaseClause(this) || Node4.isDefaultClause(this))
|
|
242882
242885
|
return this.compilerNode;
|
|
242883
|
-
else if (
|
|
242886
|
+
else if (Node4.isModuleDeclaration(this)) {
|
|
242884
242887
|
const body = this._getInnerBody();
|
|
242885
242888
|
if (body == null)
|
|
242886
242889
|
return void 0;
|
|
242887
242890
|
else
|
|
242888
242891
|
return body.compilerNode;
|
|
242889
|
-
} else if (
|
|
242892
|
+
} else if (Node4.isBodyable(this) || Node4.isBodied(this))
|
|
242890
242893
|
return this.getBody()?.compilerNode;
|
|
242891
|
-
else if (
|
|
242894
|
+
else if (Node4.isBlock(this) || Node4.isModuleBlock(this))
|
|
242892
242895
|
return this.compilerNode;
|
|
242893
242896
|
else
|
|
242894
242897
|
throw new common.errors.NotImplementedError(`Could not find the statements for node kind: ${this.getKindName()}, text: ${this.getText()}`);
|
|
@@ -242905,7 +242908,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
242905
242908
|
});
|
|
242906
242909
|
}
|
|
242907
242910
|
_standardWrite(writer, info, writeStructures, opts = {}) {
|
|
242908
|
-
if (info.previousMember != null && (opts.previousNewLine == null || !opts.previousNewLine(info.previousMember)) && !
|
|
242911
|
+
if (info.previousMember != null && (opts.previousNewLine == null || !opts.previousNewLine(info.previousMember)) && !Node4.isCommentNode(info.previousMember)) {
|
|
242909
242912
|
writer.blankLine();
|
|
242910
242913
|
} else if (!info.isStartOfFile) {
|
|
242911
242914
|
writer.newLineIfLastNot();
|
|
@@ -242920,7 +242923,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
242920
242923
|
}
|
|
242921
242924
|
__name(StatementedNode, "StatementedNode");
|
|
242922
242925
|
function addBodyIfNotExists(node) {
|
|
242923
|
-
if (
|
|
242926
|
+
if (Node4.isBodyable(node) && !node.hasBody())
|
|
242924
242927
|
node.addBody();
|
|
242925
242928
|
}
|
|
242926
242929
|
__name(addBodyIfNotExists, "addBodyIfNotExists");
|
|
@@ -242942,7 +242945,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
242942
242945
|
return common.errors.throwIfNullOrUndefined(this.getLabel(), message ?? "Expected to find a label.", this);
|
|
242943
242946
|
}
|
|
242944
242947
|
};
|
|
242945
|
-
var CaseBlockBase = TextInsertableNode(
|
|
242948
|
+
var CaseBlockBase = TextInsertableNode(Node4);
|
|
242946
242949
|
var CaseBlock = class extends CaseBlockBase {
|
|
242947
242950
|
static {
|
|
242948
242951
|
__name(this, "CaseBlock");
|
|
@@ -242963,7 +242966,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
242963
242966
|
}
|
|
242964
242967
|
};
|
|
242965
242968
|
var createBase$u = /* @__PURE__ */ __name((ctor) => JSDocableNode(ExpressionedNode(TextInsertableNode(StatementedNode(ctor)))), "createBase$u");
|
|
242966
|
-
var CaseClauseBase = createBase$u(
|
|
242969
|
+
var CaseClauseBase = createBase$u(Node4);
|
|
242967
242970
|
var CaseClause = class extends CaseClauseBase {
|
|
242968
242971
|
static {
|
|
242969
242972
|
__name(this, "CaseClause");
|
|
@@ -242972,7 +242975,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
242972
242975
|
removeClausedNodeChild(this);
|
|
242973
242976
|
}
|
|
242974
242977
|
};
|
|
242975
|
-
var CatchClauseBase =
|
|
242978
|
+
var CatchClauseBase = Node4;
|
|
242976
242979
|
var CatchClause = class extends CatchClauseBase {
|
|
242977
242980
|
static {
|
|
242978
242981
|
__name(this, "CatchClause");
|
|
@@ -243010,7 +243013,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
243010
243013
|
}
|
|
243011
243014
|
};
|
|
243012
243015
|
var createBase$t = /* @__PURE__ */ __name((ctor) => TextInsertableNode(StatementedNode(ctor)), "createBase$t");
|
|
243013
|
-
var DefaultClauseBase = createBase$t(
|
|
243016
|
+
var DefaultClauseBase = createBase$t(Node4);
|
|
243014
243017
|
var DefaultClause = class extends DefaultClauseBase {
|
|
243015
243018
|
static {
|
|
243016
243019
|
__name(this, "DefaultClause");
|
|
@@ -243100,7 +243103,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
243100
243103
|
}
|
|
243101
243104
|
remove() {
|
|
243102
243105
|
const nodes = [];
|
|
243103
|
-
if (
|
|
243106
|
+
if (Node4.isIfStatement(this.getParentOrThrow()))
|
|
243104
243107
|
nodes.push(this.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.ElseKeyword));
|
|
243105
243108
|
nodes.push(this);
|
|
243106
243109
|
removeStatementedNodeChildren(nodes);
|
|
@@ -243238,7 +243241,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
243238
243241
|
}
|
|
243239
243242
|
getNamespaceExport() {
|
|
243240
243243
|
const exportClause = this.getNodeProperty("exportClause");
|
|
243241
|
-
return exportClause != null &&
|
|
243244
|
+
return exportClause != null && Node4.isNamespaceExport(exportClause) ? exportClause : void 0;
|
|
243242
243245
|
}
|
|
243243
243246
|
getNamespaceExportOrThrow(message) {
|
|
243244
243247
|
return common.errors.throwIfNullOrUndefined(this.getNamespaceExport(), message ?? "Expected to find a namespace export.", this);
|
|
@@ -243256,7 +243259,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
243256
243259
|
textLength: 1
|
|
243257
243260
|
}
|
|
243258
243261
|
});
|
|
243259
|
-
} else if (
|
|
243262
|
+
} else if (Node4.isNamespaceExport(exportClause))
|
|
243260
243263
|
exportClause.getNameNode().replaceWithText(name);
|
|
243261
243264
|
else {
|
|
243262
243265
|
insertIntoParentTextRange({
|
|
@@ -243294,7 +243297,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
243294
243297
|
const moduleSpecifier = this._getNodeFromCompilerNodeIfExists(this.compilerNode.moduleSpecifier);
|
|
243295
243298
|
if (moduleSpecifier == null)
|
|
243296
243299
|
return void 0;
|
|
243297
|
-
if (!
|
|
243300
|
+
if (!Node4.isStringLiteral(moduleSpecifier))
|
|
243298
243301
|
throw new common.errors.InvalidOperationError("Expected the module specifier to be a string literal.");
|
|
243299
243302
|
return moduleSpecifier;
|
|
243300
243303
|
}
|
|
@@ -243313,7 +243316,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
243313
243316
|
if (symbol == null)
|
|
243314
243317
|
return void 0;
|
|
243315
243318
|
const declaration = symbol.getDeclarations()[0];
|
|
243316
|
-
return declaration != null &&
|
|
243319
|
+
return declaration != null && Node4.isSourceFile(declaration) ? declaration : void 0;
|
|
243317
243320
|
}
|
|
243318
243321
|
isModuleSpecifierRelative() {
|
|
243319
243322
|
const moduleSpecifierValue = this.getModuleSpecifierValue();
|
|
@@ -243495,7 +243498,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
243495
243498
|
});
|
|
243496
243499
|
}
|
|
243497
243500
|
__name(setEmptyNamedExport, "setEmptyNamedExport");
|
|
243498
|
-
var ExportSpecifierBase =
|
|
243501
|
+
var ExportSpecifierBase = Node4;
|
|
243499
243502
|
var ExportSpecifier = class extends ExportSpecifierBase {
|
|
243500
243503
|
static {
|
|
243501
243504
|
__name(this, "ExportSpecifier");
|
|
@@ -243631,7 +243634,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
243631
243634
|
}
|
|
243632
243635
|
getStructure() {
|
|
243633
243636
|
const alias = this.getAliasNode();
|
|
243634
|
-
return callBaseGetStructure(
|
|
243637
|
+
return callBaseGetStructure(Node4.prototype, this, {
|
|
243635
243638
|
kind: exports.StructureKind.ExportSpecifier,
|
|
243636
243639
|
alias: alias ? alias.getText() : void 0,
|
|
243637
243640
|
name: this.getNameNode().getText(),
|
|
@@ -243639,7 +243642,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
243639
243642
|
});
|
|
243640
243643
|
}
|
|
243641
243644
|
};
|
|
243642
|
-
var ExternalModuleReferenceBase = ExpressionableNode(
|
|
243645
|
+
var ExternalModuleReferenceBase = ExpressionableNode(Node4);
|
|
243643
243646
|
var ExternalModuleReference = class extends ExternalModuleReferenceBase {
|
|
243644
243647
|
static {
|
|
243645
243648
|
__name(this, "ExternalModuleReference");
|
|
@@ -243649,7 +243652,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
243649
243652
|
}
|
|
243650
243653
|
isRelative() {
|
|
243651
243654
|
const expression = this.getExpression();
|
|
243652
|
-
if (expression == null || !
|
|
243655
|
+
if (expression == null || !Node4.isStringLiteral(expression))
|
|
243653
243656
|
return false;
|
|
243654
243657
|
return ModuleUtils.isModuleSpecifierRelative(expression.getLiteralText());
|
|
243655
243658
|
}
|
|
@@ -243663,7 +243666,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
243663
243666
|
return ModuleUtils.getReferencedSourceFileFromSymbol(symbol);
|
|
243664
243667
|
}
|
|
243665
243668
|
};
|
|
243666
|
-
var ImportAttributeBase = ImportAttributeNamedNode(
|
|
243669
|
+
var ImportAttributeBase = ImportAttributeNamedNode(Node4);
|
|
243667
243670
|
var ImportAttribute = class extends ImportAttributeBase {
|
|
243668
243671
|
static {
|
|
243669
243672
|
__name(this, "ImportAttribute");
|
|
@@ -243684,7 +243687,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
243684
243687
|
});
|
|
243685
243688
|
}
|
|
243686
243689
|
};
|
|
243687
|
-
var ImportAttributesBase =
|
|
243690
|
+
var ImportAttributesBase = Node4;
|
|
243688
243691
|
var ImportAttributes = class extends ImportAttributesBase {
|
|
243689
243692
|
static {
|
|
243690
243693
|
__name(this, "ImportAttributes");
|
|
@@ -243707,7 +243710,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
243707
243710
|
});
|
|
243708
243711
|
}
|
|
243709
243712
|
};
|
|
243710
|
-
var ImportClauseBase =
|
|
243713
|
+
var ImportClauseBase = Node4;
|
|
243711
243714
|
var ImportClause = class extends ImportClauseBase {
|
|
243712
243715
|
static {
|
|
243713
243716
|
__name(this, "ImportClause");
|
|
@@ -243776,13 +243779,13 @@ Node text: ${this.#forgottenText}`;
|
|
|
243776
243779
|
}
|
|
243777
243780
|
getNamespaceImport() {
|
|
243778
243781
|
const namedBindings = this.getNamedBindings();
|
|
243779
|
-
if (namedBindings == null || !
|
|
243782
|
+
if (namedBindings == null || !Node4.isNamespaceImport(namedBindings))
|
|
243780
243783
|
return void 0;
|
|
243781
243784
|
return namedBindings.getNameNode();
|
|
243782
243785
|
}
|
|
243783
243786
|
getNamedImports() {
|
|
243784
243787
|
const namedBindings = this.getNamedBindings();
|
|
243785
|
-
if (namedBindings == null || !
|
|
243788
|
+
if (namedBindings == null || !Node4.isNamedImports(namedBindings))
|
|
243786
243789
|
return [];
|
|
243787
243790
|
return namedBindings.getElements();
|
|
243788
243791
|
}
|
|
@@ -243830,7 +243833,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
243830
243833
|
}
|
|
243831
243834
|
getModuleSpecifier() {
|
|
243832
243835
|
const moduleSpecifier = this._getNodeFromCompilerNode(this.compilerNode.moduleSpecifier);
|
|
243833
|
-
if (!
|
|
243836
|
+
if (!Node4.isStringLiteral(moduleSpecifier))
|
|
243834
243837
|
throw new common.errors.InvalidOperationError("Expected the module specifier to be a string literal.");
|
|
243835
243838
|
return moduleSpecifier;
|
|
243836
243839
|
}
|
|
@@ -244199,14 +244202,14 @@ Node text: ${this.#forgottenText}`;
|
|
|
244199
244202
|
}
|
|
244200
244203
|
isExternalModuleReferenceRelative() {
|
|
244201
244204
|
const moduleReference = this.getModuleReference();
|
|
244202
|
-
if (!
|
|
244205
|
+
if (!Node4.isExternalModuleReference(moduleReference))
|
|
244203
244206
|
return false;
|
|
244204
244207
|
return moduleReference.isRelative();
|
|
244205
244208
|
}
|
|
244206
244209
|
setExternalModuleReference(textOrSourceFile) {
|
|
244207
244210
|
const text = typeof textOrSourceFile === "string" ? textOrSourceFile : this._sourceFile.getRelativePathAsModuleSpecifierTo(textOrSourceFile);
|
|
244208
244211
|
const moduleReference = this.getModuleReference();
|
|
244209
|
-
if (
|
|
244212
|
+
if (Node4.isExternalModuleReference(moduleReference) && moduleReference.getExpression() != null)
|
|
244210
244213
|
moduleReference.getExpressionOrThrow().replaceWithText((writer) => writer.quote(text));
|
|
244211
244214
|
else
|
|
244212
244215
|
moduleReference.replaceWithText((writer) => writer.write("require(").quote(text).write(")"));
|
|
@@ -244217,12 +244220,12 @@ Node text: ${this.#forgottenText}`;
|
|
|
244217
244220
|
}
|
|
244218
244221
|
getExternalModuleReferenceSourceFile() {
|
|
244219
244222
|
const moduleReference = this.getModuleReference();
|
|
244220
|
-
if (!
|
|
244223
|
+
if (!Node4.isExternalModuleReference(moduleReference))
|
|
244221
244224
|
return void 0;
|
|
244222
244225
|
return moduleReference.getReferencedSourceFile();
|
|
244223
244226
|
}
|
|
244224
244227
|
};
|
|
244225
|
-
var ImportSpecifierBase =
|
|
244228
|
+
var ImportSpecifierBase = Node4;
|
|
244226
244229
|
var ImportSpecifier = class extends ImportSpecifierBase {
|
|
244227
244230
|
static {
|
|
244228
244231
|
__name(this, "ImportSpecifier");
|
|
@@ -244367,7 +244370,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
244367
244370
|
}
|
|
244368
244371
|
getParentModule() {
|
|
244369
244372
|
let parent = this.getParentOrThrow();
|
|
244370
|
-
if (!
|
|
244373
|
+
if (!Node4.isModuleBlock(parent))
|
|
244371
244374
|
return void 0;
|
|
244372
244375
|
while (parent.getParentOrThrow().getKind() === common.SyntaxKind.ModuleDeclaration)
|
|
244373
244376
|
parent = parent.getParentOrThrow();
|
|
@@ -244430,7 +244433,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
244430
244433
|
}
|
|
244431
244434
|
getNameNodes() {
|
|
244432
244435
|
const name = this.getNameNode();
|
|
244433
|
-
if (
|
|
244436
|
+
if (Node4.isStringLiteral(name))
|
|
244434
244437
|
return name;
|
|
244435
244438
|
else {
|
|
244436
244439
|
const nodes = [];
|
|
@@ -244502,7 +244505,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
244502
244505
|
}
|
|
244503
244506
|
_getInnerBody() {
|
|
244504
244507
|
let node = this.getBody();
|
|
244505
|
-
while (node != null &&
|
|
244508
|
+
while (node != null && Node4.isBodyable(node) && node.compilerNode.statements == null)
|
|
244506
244509
|
node = node.getBody();
|
|
244507
244510
|
return node;
|
|
244508
244511
|
}
|
|
@@ -244519,7 +244522,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
244519
244522
|
namespaceDec.setHasDeclareKeyword(true);
|
|
244520
244523
|
}
|
|
244521
244524
|
__name(changeToAmbientModuleIfNecessary, "changeToAmbientModuleIfNecessary");
|
|
244522
|
-
var NamedExportsBase =
|
|
244525
|
+
var NamedExportsBase = Node4;
|
|
244523
244526
|
var NamedExports = class extends NamedExportsBase {
|
|
244524
244527
|
static {
|
|
244525
244528
|
__name(this, "NamedExports");
|
|
@@ -244528,7 +244531,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
244528
244531
|
return this.compilerNode.elements.map((e) => this._getNodeFromCompilerNode(e));
|
|
244529
244532
|
}
|
|
244530
244533
|
};
|
|
244531
|
-
var NamedImportsBase =
|
|
244534
|
+
var NamedImportsBase = Node4;
|
|
244532
244535
|
var NamedImports = class extends NamedImportsBase {
|
|
244533
244536
|
static {
|
|
244534
244537
|
__name(this, "NamedImports");
|
|
@@ -244537,7 +244540,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
244537
244540
|
return this.compilerNode.elements.map((e) => this._getNodeFromCompilerNode(e));
|
|
244538
244541
|
}
|
|
244539
244542
|
};
|
|
244540
|
-
var NamespaceExportBase = RenameableNode(
|
|
244543
|
+
var NamespaceExportBase = RenameableNode(Node4);
|
|
244541
244544
|
var NamespaceExport = class extends NamespaceExportBase {
|
|
244542
244545
|
static {
|
|
244543
244546
|
__name(this, "NamespaceExport");
|
|
@@ -244563,7 +244566,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
244563
244566
|
return this._getNodeFromCompilerNode(this.compilerNode.name);
|
|
244564
244567
|
}
|
|
244565
244568
|
};
|
|
244566
|
-
var NamespaceImportBase = RenameableNode(
|
|
244569
|
+
var NamespaceImportBase = RenameableNode(Node4);
|
|
244567
244570
|
var NamespaceImport = class extends NamespaceImportBase {
|
|
244568
244571
|
static {
|
|
244569
244572
|
__name(this, "NamespaceImport");
|
|
@@ -244641,8 +244644,8 @@ Node text: ${this.#forgottenText}`;
|
|
|
244641
244644
|
return useValue ? value : void 0;
|
|
244642
244645
|
}
|
|
244643
244646
|
__name(__runInitializers, "__runInitializers");
|
|
244644
|
-
var SourceFileBase = ModuledNode(TextInsertableNode(StatementedNode(
|
|
244645
|
-
var
|
|
244647
|
+
var SourceFileBase = ModuledNode(TextInsertableNode(StatementedNode(Node4)));
|
|
244648
|
+
var SourceFile15 = (() => {
|
|
244646
244649
|
let _classSuper = SourceFileBase;
|
|
244647
244650
|
let _instanceExtraInitializers = [];
|
|
244648
244651
|
let _isFromExternalLibrary_decorators;
|
|
@@ -245159,7 +245162,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245159
245162
|
function getReferencingNodeFromStringLiteral(literal) {
|
|
245160
245163
|
const parent = literal.getParentOrThrow();
|
|
245161
245164
|
const grandParent = parent.getParent();
|
|
245162
|
-
if (grandParent != null &&
|
|
245165
|
+
if (grandParent != null && Node4.isImportEqualsDeclaration(grandParent))
|
|
245163
245166
|
return grandParent;
|
|
245164
245167
|
else
|
|
245165
245168
|
return parent;
|
|
@@ -245400,7 +245403,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245400
245403
|
}
|
|
245401
245404
|
};
|
|
245402
245405
|
var createBase$m = /* @__PURE__ */ __name((ctor) => OverrideableNode(QuestionTokenableNode(DecoratableNode(ScopeableNode(ReadonlyableNode(ModifierableNode(DotDotDotTokenableNode(TypedNode(InitializerExpressionableNode(BindingNamedNode(ctor)))))))))), "createBase$m");
|
|
245403
|
-
var ParameterDeclarationBase = createBase$m(
|
|
245406
|
+
var ParameterDeclarationBase = createBase$m(Node4);
|
|
245404
245407
|
var ParameterDeclaration = class extends ParameterDeclarationBase {
|
|
245405
245408
|
static {
|
|
245406
245409
|
__name(this, "ParameterDeclaration");
|
|
@@ -245466,7 +245469,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245466
245469
|
if (isParameterWithoutParens())
|
|
245467
245470
|
addParens();
|
|
245468
245471
|
function isParameterWithoutParens() {
|
|
245469
|
-
return
|
|
245472
|
+
return Node4.isArrowFunction(parent) && parent.compilerNode.parameters.length === 1 && parameter.getParentSyntaxListOrThrow().getPreviousSiblingIfKind(common.SyntaxKind.OpenParenToken) == null;
|
|
245470
245473
|
}
|
|
245471
245474
|
__name(isParameterWithoutParens, "isParameterWithoutParens");
|
|
245472
245475
|
function addParens() {
|
|
@@ -245486,17 +245489,17 @@ Node text: ${this.#forgottenText}`;
|
|
|
245486
245489
|
__name(addParens, "addParens");
|
|
245487
245490
|
}
|
|
245488
245491
|
__name(addParensIfNecessary, "addParensIfNecessary");
|
|
245489
|
-
var ClassElement = class extends
|
|
245492
|
+
var ClassElement = class extends Node4 {
|
|
245490
245493
|
static {
|
|
245491
245494
|
__name(this, "ClassElement");
|
|
245492
245495
|
}
|
|
245493
245496
|
remove() {
|
|
245494
245497
|
const parent = this.getParentOrThrow();
|
|
245495
|
-
if (
|
|
245498
|
+
if (Node4.isClassDeclaration(parent) || Node4.isClassExpression(parent))
|
|
245496
245499
|
removeClassMember(this);
|
|
245497
|
-
else if (
|
|
245500
|
+
else if (Node4.isObjectLiteralExpression(parent))
|
|
245498
245501
|
removeCommaSeparatedChild(this);
|
|
245499
|
-
else if (
|
|
245502
|
+
else if (Node4.isInterfaceDeclaration(parent))
|
|
245500
245503
|
removeInterfaceMember(this);
|
|
245501
245504
|
else
|
|
245502
245505
|
common.errors.throwNotImplementedForSyntaxKindError(parent.getKind());
|
|
@@ -245645,7 +245648,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245645
245648
|
index,
|
|
245646
245649
|
parent: this,
|
|
245647
245650
|
write: /* @__PURE__ */ __name((writer, info) => {
|
|
245648
|
-
const previousMemberHasBody = !isAmbient && info.previousMember != null &&
|
|
245651
|
+
const previousMemberHasBody = !isAmbient && info.previousMember != null && Node4.isBodyable(info.previousMember) && info.previousMember.hasBody();
|
|
245649
245652
|
const firstStructureHasBody = !isAmbient && members instanceof Array && structureHasBody(members[0]);
|
|
245650
245653
|
if (previousMemberHasBody || info.previousMember != null && firstStructureHasBody)
|
|
245651
245654
|
writer.blankLineIfLastNot();
|
|
@@ -245656,7 +245659,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245656
245659
|
memberPrinter.printTexts(memberWriter, members);
|
|
245657
245660
|
writer.write(memberWriter.toString());
|
|
245658
245661
|
const lastStructureHasBody = !isAmbient && members instanceof Array && structureHasBody(members[members.length - 1]);
|
|
245659
|
-
const nextMemberHasBody = !isAmbient && info.nextMember != null &&
|
|
245662
|
+
const nextMemberHasBody = !isAmbient && info.nextMember != null && Node4.isBodyable(info.nextMember) && info.nextMember.hasBody();
|
|
245660
245663
|
if (info.nextMember != null && lastStructureHasBody || nextMemberHasBody)
|
|
245661
245664
|
writer.blankLineIfLastNot();
|
|
245662
245665
|
else
|
|
@@ -245687,7 +245690,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245687
245690
|
structures,
|
|
245688
245691
|
expectedKind: common.SyntaxKind.Constructor,
|
|
245689
245692
|
write: /* @__PURE__ */ __name((writer, info) => {
|
|
245690
|
-
if (!isAmbient && info.previousMember != null && !
|
|
245693
|
+
if (!isAmbient && info.previousMember != null && !Node4.isCommentNode(info.previousMember))
|
|
245691
245694
|
writer.blankLineIfLastNot();
|
|
245692
245695
|
else
|
|
245693
245696
|
writer.newLineIfLastNot();
|
|
@@ -245700,7 +245703,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245700
245703
|
});
|
|
245701
245704
|
}
|
|
245702
245705
|
getConstructors() {
|
|
245703
|
-
return this.getMembers().filter((m) =>
|
|
245706
|
+
return this.getMembers().filter((m) => Node4.isConstructorDeclaration(m));
|
|
245704
245707
|
}
|
|
245705
245708
|
addStaticBlock(structure = {}) {
|
|
245706
245709
|
return this.insertStaticBlock(getEndIndexFromArray(this.getMembersWithComments()), structure);
|
|
@@ -245718,7 +245721,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245718
245721
|
structures,
|
|
245719
245722
|
expectedKind: common.SyntaxKind.ClassStaticBlockDeclaration,
|
|
245720
245723
|
write: /* @__PURE__ */ __name((writer, info) => {
|
|
245721
|
-
if (!isAmbient && info.previousMember != null && !
|
|
245724
|
+
if (!isAmbient && info.previousMember != null && !Node4.isCommentNode(info.previousMember))
|
|
245722
245725
|
writer.blankLineIfLastNot();
|
|
245723
245726
|
else
|
|
245724
245727
|
writer.newLineIfLastNot();
|
|
@@ -245731,7 +245734,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245731
245734
|
});
|
|
245732
245735
|
}
|
|
245733
245736
|
getStaticBlocks() {
|
|
245734
|
-
return this.getMembers().filter((m) =>
|
|
245737
|
+
return this.getMembers().filter((m) => Node4.isClassStaticBlockDeclaration(m));
|
|
245735
245738
|
}
|
|
245736
245739
|
addGetAccessor(structure) {
|
|
245737
245740
|
return this.addGetAccessors([structure])[0];
|
|
@@ -245748,7 +245751,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245748
245751
|
structures,
|
|
245749
245752
|
expectedKind: common.SyntaxKind.GetAccessor,
|
|
245750
245753
|
write: /* @__PURE__ */ __name((writer, info) => {
|
|
245751
|
-
if (info.previousMember != null && !
|
|
245754
|
+
if (info.previousMember != null && !Node4.isCommentNode(info.previousMember))
|
|
245752
245755
|
writer.blankLineIfLastNot();
|
|
245753
245756
|
else
|
|
245754
245757
|
writer.newLineIfLastNot();
|
|
@@ -245777,7 +245780,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245777
245780
|
structures,
|
|
245778
245781
|
expectedKind: common.SyntaxKind.SetAccessor,
|
|
245779
245782
|
write: /* @__PURE__ */ __name((writer, info) => {
|
|
245780
|
-
if (info.previousMember != null && !
|
|
245783
|
+
if (info.previousMember != null && !Node4.isCommentNode(info.previousMember))
|
|
245781
245784
|
writer.blankLineIfLastNot();
|
|
245782
245785
|
else
|
|
245783
245786
|
writer.newLineIfLastNot();
|
|
@@ -245806,12 +245809,12 @@ Node text: ${this.#forgottenText}`;
|
|
|
245806
245809
|
structures,
|
|
245807
245810
|
expectedKind: common.SyntaxKind.PropertyDeclaration,
|
|
245808
245811
|
write: /* @__PURE__ */ __name((writer, info) => {
|
|
245809
|
-
if (info.previousMember != null &&
|
|
245812
|
+
if (info.previousMember != null && Node4.hasBody(info.previousMember))
|
|
245810
245813
|
writer.blankLineIfLastNot();
|
|
245811
245814
|
else
|
|
245812
245815
|
writer.newLineIfLastNot();
|
|
245813
245816
|
this._context.structurePrinterFactory.forPropertyDeclaration().printTexts(writer, structures);
|
|
245814
|
-
if (info.nextMember != null &&
|
|
245817
|
+
if (info.nextMember != null && Node4.hasBody(info.nextMember))
|
|
245815
245818
|
writer.blankLineIfLastNot();
|
|
245816
245819
|
else
|
|
245817
245820
|
writer.newLineIfLastNot();
|
|
@@ -245833,7 +245836,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245833
245836
|
return insertChildren(this, {
|
|
245834
245837
|
index,
|
|
245835
245838
|
write: /* @__PURE__ */ __name((writer, info) => {
|
|
245836
|
-
if (!isAmbient && info.previousMember != null && !
|
|
245839
|
+
if (!isAmbient && info.previousMember != null && !Node4.isCommentNode(info.previousMember))
|
|
245837
245840
|
writer.blankLineIfLastNot();
|
|
245838
245841
|
else
|
|
245839
245842
|
writer.newLineIfLastNot();
|
|
@@ -245872,7 +245875,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245872
245875
|
return common.errors.throwIfNullOrUndefined(this.getProperty(nameOrFindFunction), () => getNotFoundErrorMessageForNameOrFindFunction("class property declaration", nameOrFindFunction));
|
|
245873
245876
|
}
|
|
245874
245877
|
getProperties() {
|
|
245875
|
-
return this.getMembers().filter((m) =>
|
|
245878
|
+
return this.getMembers().filter((m) => Node4.isPropertyDeclaration(m));
|
|
245876
245879
|
}
|
|
245877
245880
|
getGetAccessor(nameOrFindFunction) {
|
|
245878
245881
|
return getNodeByNameOrFindFunction(this.getGetAccessors(), nameOrFindFunction);
|
|
@@ -245881,7 +245884,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245881
245884
|
return common.errors.throwIfNullOrUndefined(this.getGetAccessor(nameOrFindFunction), () => getNotFoundErrorMessageForNameOrFindFunction("class getAccessor declaration", nameOrFindFunction));
|
|
245882
245885
|
}
|
|
245883
245886
|
getGetAccessors() {
|
|
245884
|
-
return this.getMembers().filter((m) =>
|
|
245887
|
+
return this.getMembers().filter((m) => Node4.isGetAccessorDeclaration(m));
|
|
245885
245888
|
}
|
|
245886
245889
|
getSetAccessor(nameOrFindFunction) {
|
|
245887
245890
|
return getNodeByNameOrFindFunction(this.getSetAccessors(), nameOrFindFunction);
|
|
@@ -245890,7 +245893,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245890
245893
|
return common.errors.throwIfNullOrUndefined(this.getSetAccessor(nameOrFindFunction), () => getNotFoundErrorMessageForNameOrFindFunction("class setAccessor declaration", nameOrFindFunction));
|
|
245891
245894
|
}
|
|
245892
245895
|
getSetAccessors() {
|
|
245893
|
-
return this.getMembers().filter((m) =>
|
|
245896
|
+
return this.getMembers().filter((m) => Node4.isSetAccessorDeclaration(m));
|
|
245894
245897
|
}
|
|
245895
245898
|
getMethod(nameOrFindFunction) {
|
|
245896
245899
|
return getNodeByNameOrFindFunction(this.getMethods(), nameOrFindFunction);
|
|
@@ -245899,7 +245902,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245899
245902
|
return common.errors.throwIfNullOrUndefined(this.getMethod(nameOrFindFunction), () => getNotFoundErrorMessageForNameOrFindFunction("class method declaration", nameOrFindFunction));
|
|
245900
245903
|
}
|
|
245901
245904
|
getMethods() {
|
|
245902
|
-
return this.getMembers().filter((m) =>
|
|
245905
|
+
return this.getMembers().filter((m) => Node4.isMethodDeclaration(m));
|
|
245903
245906
|
}
|
|
245904
245907
|
getInstanceMethod(nameOrFindFunction) {
|
|
245905
245908
|
return getNodeByNameOrFindFunction(this.getInstanceMethods(), nameOrFindFunction);
|
|
@@ -245927,9 +245930,9 @@ Node text: ${this.#forgottenText}`;
|
|
|
245927
245930
|
}
|
|
245928
245931
|
getInstanceMembers() {
|
|
245929
245932
|
return this.getMembersWithParameterProperties().filter((m) => {
|
|
245930
|
-
if (
|
|
245933
|
+
if (Node4.isConstructorDeclaration(m))
|
|
245931
245934
|
return false;
|
|
245932
|
-
return
|
|
245935
|
+
return Node4.isParameterDeclaration(m) || !m.isStatic();
|
|
245933
245936
|
});
|
|
245934
245937
|
}
|
|
245935
245938
|
getStaticMember(nameOrFindFunction) {
|
|
@@ -245940,14 +245943,14 @@ Node text: ${this.#forgottenText}`;
|
|
|
245940
245943
|
}
|
|
245941
245944
|
getStaticMembers() {
|
|
245942
245945
|
return this.getMembers().filter((m) => {
|
|
245943
|
-
if (
|
|
245946
|
+
if (Node4.isConstructorDeclaration(m))
|
|
245944
245947
|
return false;
|
|
245945
|
-
return !
|
|
245948
|
+
return !Node4.isParameterDeclaration(m) && m.isStatic();
|
|
245946
245949
|
});
|
|
245947
245950
|
}
|
|
245948
245951
|
getMembersWithParameterProperties() {
|
|
245949
245952
|
const members = this.getMembers();
|
|
245950
|
-
const implementationCtors = members.filter((c) =>
|
|
245953
|
+
const implementationCtors = members.filter((c) => Node4.isConstructorDeclaration(c) && c.isImplementation());
|
|
245951
245954
|
for (const ctor of implementationCtors) {
|
|
245952
245955
|
let insertIndex = members.indexOf(ctor) + 1;
|
|
245953
245956
|
for (const param of ctor.getParameters()) {
|
|
@@ -245965,7 +245968,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
245965
245968
|
getMembersWithComments() {
|
|
245966
245969
|
const compilerNode = this.compilerNode;
|
|
245967
245970
|
const members = ExtendedParser.getContainerArray(compilerNode, this.getSourceFile().compilerNode);
|
|
245968
|
-
return getAllMembers(this, members).filter((m) => isSupportedClassMember(m) ||
|
|
245971
|
+
return getAllMembers(this, members).filter((m) => isSupportedClassMember(m) || Node4.isCommentClassElement(m));
|
|
245969
245972
|
}
|
|
245970
245973
|
getMember(nameOrFindFunction) {
|
|
245971
245974
|
return getNodeByNameOrFindFunction(this.getMembers(), nameOrFindFunction);
|
|
@@ -246004,9 +246007,9 @@ Node text: ${this.#forgottenText}`;
|
|
|
246004
246007
|
const isAmbient = isNodeAmbientOrInAmbientContext(classDec);
|
|
246005
246008
|
const members = compilerMembers.map((m) => classDec._getNodeFromCompilerNode(m));
|
|
246006
246009
|
return isAmbient ? members : members.filter((m) => {
|
|
246007
|
-
if (!(
|
|
246010
|
+
if (!(Node4.isConstructorDeclaration(m) || Node4.isMethodDeclaration(m)))
|
|
246008
246011
|
return true;
|
|
246009
|
-
if (
|
|
246012
|
+
if (Node4.isMethodDeclaration(m) && m.isAbstract())
|
|
246010
246013
|
return true;
|
|
246011
246014
|
return m.isImplementation();
|
|
246012
246015
|
});
|
|
@@ -246034,11 +246037,11 @@ Node text: ${this.#forgottenText}`;
|
|
|
246034
246037
|
}
|
|
246035
246038
|
__name(getImmediateDerivedClasses, "getImmediateDerivedClasses");
|
|
246036
246039
|
function isClassPropertyType(m) {
|
|
246037
|
-
return
|
|
246040
|
+
return Node4.isPropertyDeclaration(m) || Node4.isSetAccessorDeclaration(m) || Node4.isGetAccessorDeclaration(m) || Node4.isParameterDeclaration(m);
|
|
246038
246041
|
}
|
|
246039
246042
|
__name(isClassPropertyType, "isClassPropertyType");
|
|
246040
246043
|
function isSupportedClassMember(m) {
|
|
246041
|
-
return
|
|
246044
|
+
return Node4.isMethodDeclaration(m) || Node4.isPropertyDeclaration(m) || Node4.isGetAccessorDeclaration(m) || Node4.isSetAccessorDeclaration(m) || Node4.isConstructorDeclaration(m) || Node4.isClassStaticBlockDeclaration(m);
|
|
246042
246045
|
}
|
|
246043
246046
|
__name(isSupportedClassMember, "isSupportedClassMember");
|
|
246044
246047
|
function insertChildren(classDeclaration, opts) {
|
|
@@ -246111,7 +246114,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
246111
246114
|
typeParameters: this.getTypeParameters().map((p) => p.getStructure()),
|
|
246112
246115
|
properties: [
|
|
246113
246116
|
...parameterProperties.map((p) => {
|
|
246114
|
-
const jsDocComment = p.getParentOrThrow().getJsDocs().map((j) => j.getTags()).flat().filter(
|
|
246117
|
+
const jsDocComment = p.getParentOrThrow().getJsDocs().map((j) => j.getTags()).flat().filter(Node4.isJSDocParameterTag).filter((t) => t.getTagName() === "param" && t.getName() === p.getName() && t.getComment() != null).map((t) => t.getCommentText().trim())[0];
|
|
246115
246118
|
return {
|
|
246116
246119
|
kind: exports.StructureKind.PropertySignature,
|
|
246117
246120
|
docs: jsDocComment == null ? [] : [{ kind: exports.StructureKind.JSDoc, description: jsDocComment }],
|
|
@@ -246190,7 +246193,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
246190
246193
|
name: getAndSet[0].getName(),
|
|
246191
246194
|
type: getAndSet[0].getType().getText(getAndSet[0]),
|
|
246192
246195
|
hasQuestionToken: false,
|
|
246193
|
-
isReadonly: getAndSet.every(
|
|
246196
|
+
isReadonly: getAndSet.every(Node4.isGetAccessorDeclaration)
|
|
246194
246197
|
};
|
|
246195
246198
|
}
|
|
246196
246199
|
__name(getExtractedInterfaceAccessorStructure, "getExtractedInterfaceAccessorStructure");
|
|
@@ -246328,7 +246331,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
246328
246331
|
const thisName = this.getName();
|
|
246329
246332
|
const isStatic = this.isStatic();
|
|
246330
246333
|
return this.getParentOrThrow().forEachChild((sibling) => {
|
|
246331
|
-
if (
|
|
246334
|
+
if (Node4.isSetAccessorDeclaration(sibling) && sibling.getName() === thisName && sibling.isStatic() === isStatic)
|
|
246332
246335
|
return sibling;
|
|
246333
246336
|
return void 0;
|
|
246334
246337
|
});
|
|
@@ -246391,7 +246394,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
246391
246394
|
const thisName = this.getName();
|
|
246392
246395
|
const isStatic = this.isStatic();
|
|
246393
246396
|
return this.getParentOrThrow().forEachChild((sibling) => {
|
|
246394
|
-
if (
|
|
246397
|
+
if (Node4.isGetAccessorDeclaration(sibling) && sibling.getName() === thisName && sibling.isStatic() === isStatic)
|
|
246395
246398
|
return sibling;
|
|
246396
246399
|
return void 0;
|
|
246397
246400
|
});
|
|
@@ -246405,7 +246408,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
246405
246408
|
});
|
|
246406
246409
|
}
|
|
246407
246410
|
};
|
|
246408
|
-
var DecoratorBase = LeftHandSideExpressionedNode(
|
|
246411
|
+
var DecoratorBase = LeftHandSideExpressionedNode(Node4);
|
|
246409
246412
|
var Decorator = class extends DecoratorBase {
|
|
246410
246413
|
static {
|
|
246411
246414
|
__name(this, "Decorator");
|
|
@@ -246421,14 +246424,14 @@ Node text: ${this.#forgottenText}`;
|
|
|
246421
246424
|
return getIdentifierFromName(this._getInnerExpression());
|
|
246422
246425
|
function getIdentifierFromName(expression) {
|
|
246423
246426
|
const identifier = getNameFromExpression(expression);
|
|
246424
|
-
if (!
|
|
246427
|
+
if (!Node4.isIdentifier(identifier)) {
|
|
246425
246428
|
throw new common.errors.NotImplementedError(`Expected the decorator expression '${identifier.getText()}' to be an identifier. Please deal directly with 'getExpression()' on the decorator to handle more complex scenarios.`);
|
|
246426
246429
|
}
|
|
246427
246430
|
return identifier;
|
|
246428
246431
|
}
|
|
246429
246432
|
__name(getIdentifierFromName, "getIdentifierFromName");
|
|
246430
246433
|
function getNameFromExpression(expression) {
|
|
246431
|
-
if (
|
|
246434
|
+
if (Node4.isPropertyAccessExpression(expression))
|
|
246432
246435
|
return expression.getNameNode();
|
|
246433
246436
|
return expression;
|
|
246434
246437
|
}
|
|
@@ -246441,7 +246444,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
246441
246444
|
return this.compilerNode.expression.getText(sourceFile.compilerNode);
|
|
246442
246445
|
}
|
|
246443
246446
|
isDecoratorFactory() {
|
|
246444
|
-
return
|
|
246447
|
+
return Node4.isCallExpression(this._getInnerExpression());
|
|
246445
246448
|
}
|
|
246446
246449
|
setIsDecoratorFactory(isDecoratorFactory) {
|
|
246447
246450
|
if (this.isDecoratorFactory() === isDecoratorFactory)
|
|
@@ -246483,7 +246486,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
246483
246486
|
}
|
|
246484
246487
|
getCallExpression() {
|
|
246485
246488
|
const expression = this._getInnerExpression();
|
|
246486
|
-
return
|
|
246489
|
+
return Node4.isCallExpression(expression) ? expression : void 0;
|
|
246487
246490
|
}
|
|
246488
246491
|
getArguments() {
|
|
246489
246492
|
return this.getCallExpression()?.getArguments() ?? [];
|
|
@@ -246547,7 +246550,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
246547
246550
|
}
|
|
246548
246551
|
_getInnerExpression() {
|
|
246549
246552
|
let expr = this.getExpression();
|
|
246550
|
-
while (
|
|
246553
|
+
while (Node4.isParenthesizedExpression(expr))
|
|
246551
246554
|
expr = expr.getExpression();
|
|
246552
246555
|
return expr;
|
|
246553
246556
|
}
|
|
@@ -246641,7 +246644,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
246641
246644
|
__name(getStarPosIfFirstNonWhitespaceChar, "getStarPosIfFirstNonWhitespaceChar");
|
|
246642
246645
|
}
|
|
246643
246646
|
__name(getTextWithoutStars, "getTextWithoutStars");
|
|
246644
|
-
var JSDocBase =
|
|
246647
|
+
var JSDocBase = Node4;
|
|
246645
246648
|
var JSDoc = class extends JSDocBase {
|
|
246646
246649
|
static {
|
|
246647
246650
|
__name(this, "JSDoc");
|
|
@@ -246790,7 +246793,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
246790
246793
|
});
|
|
246791
246794
|
}
|
|
246792
246795
|
};
|
|
246793
|
-
var TypeNode = class extends
|
|
246796
|
+
var TypeNode = class extends Node4 {
|
|
246794
246797
|
static {
|
|
246795
246798
|
__name(this, "TypeNode");
|
|
246796
246799
|
}
|
|
@@ -246856,9 +246859,9 @@ Node text: ${this.#forgottenText}`;
|
|
|
246856
246859
|
}
|
|
246857
246860
|
setArgument(text) {
|
|
246858
246861
|
const arg = this.getArgument();
|
|
246859
|
-
if (
|
|
246862
|
+
if (Node4.isLiteralTypeNode(arg)) {
|
|
246860
246863
|
const literal = arg.getLiteral();
|
|
246861
|
-
if (
|
|
246864
|
+
if (Node4.isStringLiteral(literal)) {
|
|
246862
246865
|
literal.setLiteralValue(text);
|
|
246863
246866
|
return this;
|
|
246864
246867
|
}
|
|
@@ -247082,7 +247085,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
247082
247085
|
TypeParameterVariance[TypeParameterVariance["InOut"] = 3] = "InOut";
|
|
247083
247086
|
})(exports.TypeParameterVariance || (exports.TypeParameterVariance = {}));
|
|
247084
247087
|
var createBase$c = /* @__PURE__ */ __name((ctor) => ModifierableNode(NamedNode(ctor)), "createBase$c");
|
|
247085
|
-
var TypeParameterDeclarationBase = createBase$c(
|
|
247088
|
+
var TypeParameterDeclarationBase = createBase$c(Node4);
|
|
247086
247089
|
var TypeParameterDeclaration = class extends TypeParameterDeclarationBase {
|
|
247087
247090
|
static {
|
|
247088
247091
|
__name(this, "TypeParameterDeclaration");
|
|
@@ -247275,7 +247278,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
247275
247278
|
__name(this, "JSDocAllType");
|
|
247276
247279
|
}
|
|
247277
247280
|
};
|
|
247278
|
-
var JSDocTagBase =
|
|
247281
|
+
var JSDocTagBase = Node4;
|
|
247279
247282
|
var JSDocTag = class extends JSDocTagBase {
|
|
247280
247283
|
static {
|
|
247281
247284
|
__name(this, "JSDocTag");
|
|
@@ -247438,22 +247441,22 @@ Node text: ${this.#forgottenText}`;
|
|
|
247438
247441
|
__name(this, "JSDocImportTag");
|
|
247439
247442
|
}
|
|
247440
247443
|
};
|
|
247441
|
-
var JSDocLink = class extends
|
|
247444
|
+
var JSDocLink = class extends Node4 {
|
|
247442
247445
|
static {
|
|
247443
247446
|
__name(this, "JSDocLink");
|
|
247444
247447
|
}
|
|
247445
247448
|
};
|
|
247446
|
-
var JSDocLinkCode = class extends
|
|
247449
|
+
var JSDocLinkCode = class extends Node4 {
|
|
247447
247450
|
static {
|
|
247448
247451
|
__name(this, "JSDocLinkCode");
|
|
247449
247452
|
}
|
|
247450
247453
|
};
|
|
247451
|
-
var JSDocLinkPlain = class extends
|
|
247454
|
+
var JSDocLinkPlain = class extends Node4 {
|
|
247452
247455
|
static {
|
|
247453
247456
|
__name(this, "JSDocLinkPlain");
|
|
247454
247457
|
}
|
|
247455
247458
|
};
|
|
247456
|
-
var JSDocMemberName = class extends
|
|
247459
|
+
var JSDocMemberName = class extends Node4 {
|
|
247457
247460
|
static {
|
|
247458
247461
|
__name(this, "JSDocMemberName");
|
|
247459
247462
|
}
|
|
@@ -247466,7 +247469,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
247466
247469
|
return this._getNodeFromCompilerNode(this.compilerNode.type);
|
|
247467
247470
|
}
|
|
247468
247471
|
};
|
|
247469
|
-
var JSDocNameReference = class extends
|
|
247472
|
+
var JSDocNameReference = class extends Node4 {
|
|
247470
247473
|
static {
|
|
247471
247474
|
__name(this, "JSDocNameReference");
|
|
247472
247475
|
}
|
|
@@ -247603,7 +247606,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
247603
247606
|
return common.errors.throwIfNullOrUndefined(this.getConstraint(), message ?? "Expected to find the JS doc template tag's constraint.", this);
|
|
247604
247607
|
}
|
|
247605
247608
|
};
|
|
247606
|
-
var JSDocText = class extends
|
|
247609
|
+
var JSDocText = class extends Node4 {
|
|
247607
247610
|
static {
|
|
247608
247611
|
__name(this, "JSDocText");
|
|
247609
247612
|
}
|
|
@@ -247673,7 +247676,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
247673
247676
|
return this._getNodeFromCompilerNode(this.compilerNode.type);
|
|
247674
247677
|
}
|
|
247675
247678
|
};
|
|
247676
|
-
var CommentEnumMember = class extends
|
|
247679
|
+
var CommentEnumMember = class extends Node4 {
|
|
247677
247680
|
static {
|
|
247678
247681
|
__name(this, "CommentEnumMember");
|
|
247679
247682
|
}
|
|
@@ -247764,7 +247767,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
247764
247767
|
}
|
|
247765
247768
|
};
|
|
247766
247769
|
var createBase$a = /* @__PURE__ */ __name((ctor) => JSDocableNode(InitializerExpressionableNode(PropertyNamedNode(ctor))), "createBase$a");
|
|
247767
|
-
var EnumMemberBase = createBase$a(
|
|
247770
|
+
var EnumMemberBase = createBase$a(Node4);
|
|
247768
247771
|
var EnumMember = class extends EnumMemberBase {
|
|
247769
247772
|
static {
|
|
247770
247773
|
__name(this, "EnumMember");
|
|
@@ -247808,7 +247811,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
247808
247811
|
});
|
|
247809
247812
|
}
|
|
247810
247813
|
};
|
|
247811
|
-
var HeritageClause = class extends
|
|
247814
|
+
var HeritageClause = class extends Node4 {
|
|
247812
247815
|
static {
|
|
247813
247816
|
__name(this, "HeritageClause");
|
|
247814
247817
|
}
|
|
@@ -247837,7 +247840,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
247837
247840
|
__name(getExpressionFromIndex, "getExpressionFromIndex");
|
|
247838
247841
|
}
|
|
247839
247842
|
};
|
|
247840
|
-
var TypeElement = class extends
|
|
247843
|
+
var TypeElement = class extends Node4 {
|
|
247841
247844
|
static {
|
|
247842
247845
|
__name(this, "TypeElement");
|
|
247843
247846
|
}
|
|
@@ -248077,7 +248080,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
248077
248080
|
};
|
|
248078
248081
|
}
|
|
248079
248082
|
__name(CommonIdentifierBase, "CommonIdentifierBase");
|
|
248080
|
-
var ComputedPropertyNameBase = ExpressionedNode(
|
|
248083
|
+
var ComputedPropertyNameBase = ExpressionedNode(Node4);
|
|
248081
248084
|
var ComputedPropertyName = class extends ComputedPropertyNameBase {
|
|
248082
248085
|
static {
|
|
248083
248086
|
__name(this, "ComputedPropertyName");
|
|
@@ -248092,13 +248095,13 @@ Node text: ${this.#forgottenText}`;
|
|
|
248092
248095
|
return this._context.languageService.getImplementations(this);
|
|
248093
248096
|
}
|
|
248094
248097
|
};
|
|
248095
|
-
var PrivateIdentifierBase = CommonIdentifierBase(ReferenceFindableNode(RenameableNode(
|
|
248098
|
+
var PrivateIdentifierBase = CommonIdentifierBase(ReferenceFindableNode(RenameableNode(Node4)));
|
|
248096
248099
|
var PrivateIdentifier = class extends PrivateIdentifierBase {
|
|
248097
248100
|
static {
|
|
248098
248101
|
__name(this, "PrivateIdentifier");
|
|
248099
248102
|
}
|
|
248100
248103
|
};
|
|
248101
|
-
var QualifiedName = class extends
|
|
248104
|
+
var QualifiedName = class extends Node4 {
|
|
248102
248105
|
static {
|
|
248103
248106
|
__name(this, "QualifiedName");
|
|
248104
248107
|
}
|
|
@@ -248109,7 +248112,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
248109
248112
|
return this._getNodeFromCompilerNode(this.compilerNode.right);
|
|
248110
248113
|
}
|
|
248111
248114
|
};
|
|
248112
|
-
var JsxAttributeBase =
|
|
248115
|
+
var JsxAttributeBase = Node4;
|
|
248113
248116
|
var JsxAttribute2 = class extends JsxAttributeBase {
|
|
248114
248117
|
static {
|
|
248115
248118
|
__name(this, "JsxAttribute");
|
|
@@ -248189,7 +248192,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
248189
248192
|
}
|
|
248190
248193
|
};
|
|
248191
248194
|
var createBase$3 = /* @__PURE__ */ __name((ctor) => JsxTagNamedNode(ctor), "createBase$3");
|
|
248192
|
-
var JsxClosingElementBase = createBase$3(
|
|
248195
|
+
var JsxClosingElementBase = createBase$3(Node4);
|
|
248193
248196
|
var JsxClosingElement = class extends JsxClosingElementBase {
|
|
248194
248197
|
static {
|
|
248195
248198
|
__name(this, "JsxClosingElement");
|
|
@@ -248201,7 +248204,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
248201
248204
|
}
|
|
248202
248205
|
};
|
|
248203
248206
|
var JsxElementBase = PrimaryExpression;
|
|
248204
|
-
var
|
|
248207
|
+
var JsxElement4 = class extends JsxElementBase {
|
|
248205
248208
|
static {
|
|
248206
248209
|
__name(this, "JsxElement");
|
|
248207
248210
|
}
|
|
@@ -248294,7 +248297,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
248294
248297
|
return this._getNodeFromCompilerNode(this.compilerNode.closingFragment);
|
|
248295
248298
|
}
|
|
248296
248299
|
};
|
|
248297
|
-
var JsxNamespacedNameBase =
|
|
248300
|
+
var JsxNamespacedNameBase = Node4;
|
|
248298
248301
|
var JsxNamespacedName = class extends JsxNamespacedNameBase {
|
|
248299
248302
|
static {
|
|
248300
248303
|
__name(this, "JsxNamespacedName");
|
|
@@ -248345,7 +248348,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
248345
248348
|
});
|
|
248346
248349
|
}
|
|
248347
248350
|
};
|
|
248348
|
-
var JsxSpreadAttributeBase = ExpressionedNode(
|
|
248351
|
+
var JsxSpreadAttributeBase = ExpressionedNode(Node4);
|
|
248349
248352
|
var JsxSpreadAttribute = class extends JsxSpreadAttributeBase {
|
|
248350
248353
|
static {
|
|
248351
248354
|
__name(this, "JsxSpreadAttribute");
|
|
@@ -248370,7 +248373,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
248370
248373
|
});
|
|
248371
248374
|
}
|
|
248372
248375
|
};
|
|
248373
|
-
var JsxTextBase = LiteralLikeNode(
|
|
248376
|
+
var JsxTextBase = LiteralLikeNode(Node4);
|
|
248374
248377
|
var JsxText = class extends JsxTextBase {
|
|
248375
248378
|
static {
|
|
248376
248379
|
__name(this, "JsxText");
|
|
@@ -248471,9 +248474,9 @@ Node text: ${this.#forgottenText}`;
|
|
|
248471
248474
|
}
|
|
248472
248475
|
};
|
|
248473
248476
|
exports.QuoteKind = void 0;
|
|
248474
|
-
(function(
|
|
248475
|
-
|
|
248476
|
-
|
|
248477
|
+
(function(QuoteKind12) {
|
|
248478
|
+
QuoteKind12["Single"] = "'";
|
|
248479
|
+
QuoteKind12["Double"] = '"';
|
|
248477
248480
|
})(exports.QuoteKind || (exports.QuoteKind = {}));
|
|
248478
248481
|
var RegularExpressionLiteralBase = LiteralExpression;
|
|
248479
248482
|
var RegularExpressionLiteral = class extends RegularExpressionLiteralBase {
|
|
@@ -248594,19 +248597,19 @@ Node text: ${this.#forgottenText}`;
|
|
|
248594
248597
|
return parent.getChildAtIndex(childIndex);
|
|
248595
248598
|
}
|
|
248596
248599
|
};
|
|
248597
|
-
var TemplateHeadBase = LiteralLikeNode(
|
|
248600
|
+
var TemplateHeadBase = LiteralLikeNode(Node4);
|
|
248598
248601
|
var TemplateHead = class extends TemplateHeadBase {
|
|
248599
248602
|
static {
|
|
248600
248603
|
__name(this, "TemplateHead");
|
|
248601
248604
|
}
|
|
248602
248605
|
};
|
|
248603
|
-
var TemplateMiddleBase = LiteralLikeNode(
|
|
248606
|
+
var TemplateMiddleBase = LiteralLikeNode(Node4);
|
|
248604
248607
|
var TemplateMiddle = class extends TemplateMiddleBase {
|
|
248605
248608
|
static {
|
|
248606
248609
|
__name(this, "TemplateMiddle");
|
|
248607
248610
|
}
|
|
248608
248611
|
};
|
|
248609
|
-
var TemplateSpanBase = ExpressionedNode(
|
|
248612
|
+
var TemplateSpanBase = ExpressionedNode(Node4);
|
|
248610
248613
|
var TemplateSpan = class extends TemplateSpanBase {
|
|
248611
248614
|
static {
|
|
248612
248615
|
__name(this, "TemplateSpan");
|
|
@@ -248615,14 +248618,14 @@ Node text: ${this.#forgottenText}`;
|
|
|
248615
248618
|
return this._getNodeFromCompilerNode(this.compilerNode.literal);
|
|
248616
248619
|
}
|
|
248617
248620
|
};
|
|
248618
|
-
var TemplateTailBase = LiteralLikeNode(
|
|
248621
|
+
var TemplateTailBase = LiteralLikeNode(Node4);
|
|
248619
248622
|
var TemplateTail = class extends TemplateTailBase {
|
|
248620
248623
|
static {
|
|
248621
248624
|
__name(this, "TemplateTail");
|
|
248622
248625
|
}
|
|
248623
248626
|
};
|
|
248624
248627
|
var createBase = /* @__PURE__ */ __name((ctor) => ExportGetableNode(ExclamationTokenableNode(TypedNode(InitializerExpressionableNode(BindingNamedNode(ctor))))), "createBase");
|
|
248625
|
-
var VariableDeclarationBase = createBase(
|
|
248628
|
+
var VariableDeclarationBase = createBase(Node4);
|
|
248626
248629
|
var VariableDeclaration2 = class extends VariableDeclarationBase {
|
|
248627
248630
|
static {
|
|
248628
248631
|
__name(this, "VariableDeclaration");
|
|
@@ -248665,7 +248668,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
248665
248668
|
}
|
|
248666
248669
|
getVariableStatement() {
|
|
248667
248670
|
const grandParent = this.getParentOrThrow().getParentOrThrow();
|
|
248668
|
-
return
|
|
248671
|
+
return Node4.isVariableStatement(grandParent) ? grandParent : void 0;
|
|
248669
248672
|
}
|
|
248670
248673
|
set(structure) {
|
|
248671
248674
|
callBaseSet(VariableDeclarationBase.prototype, this, structure);
|
|
@@ -248677,7 +248680,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
248677
248680
|
});
|
|
248678
248681
|
}
|
|
248679
248682
|
};
|
|
248680
|
-
var VariableDeclarationListBase = ModifierableNode(
|
|
248683
|
+
var VariableDeclarationListBase = ModifierableNode(Node4);
|
|
248681
248684
|
var VariableDeclarationList = class extends VariableDeclarationListBase {
|
|
248682
248685
|
static {
|
|
248683
248686
|
__name(this, "VariableDeclarationList");
|
|
@@ -250232,7 +250235,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
250232
250235
|
if (symbol == null)
|
|
250233
250236
|
return false;
|
|
250234
250237
|
const valueDeclaration = symbol.getValueDeclaration();
|
|
250235
|
-
return valueDeclaration != null &&
|
|
250238
|
+
return valueDeclaration != null && Node4.isEnumDeclaration(valueDeclaration);
|
|
250236
250239
|
}
|
|
250237
250240
|
isInterface() {
|
|
250238
250241
|
return this.#hasObjectFlag(common.ObjectFlags.Interface);
|
|
@@ -250320,7 +250323,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
250320
250323
|
const declaration = symbol.getDeclarations()[0];
|
|
250321
250324
|
if (declaration == null)
|
|
250322
250325
|
return void 0;
|
|
250323
|
-
if (!
|
|
250326
|
+
if (!Node4.isTypeParameterDeclaration(declaration))
|
|
250324
250327
|
return void 0;
|
|
250325
250328
|
return declaration;
|
|
250326
250329
|
}
|
|
@@ -250771,7 +250774,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
250771
250774
|
const thisDirectory = this;
|
|
250772
250775
|
return common.FileUtils.getRelativePathTo(this.getPath(), getPath());
|
|
250773
250776
|
function getPath() {
|
|
250774
|
-
return sourceFileDirOrPath instanceof
|
|
250777
|
+
return sourceFileDirOrPath instanceof SourceFile15 ? sourceFileDirOrPath.getFilePath() : sourceFileDirOrPath instanceof _Directory ? sourceFileDirOrPath.getPath() : thisDirectory._context.fileSystemWrapper.getStandardizedAbsolutePath(sourceFileDirOrPath, thisDirectory.getPath());
|
|
250775
250778
|
}
|
|
250776
250779
|
__name(getPath, "getPath");
|
|
250777
250780
|
}
|
|
@@ -250781,7 +250784,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
250781
250784
|
const moduleSpecifier = common.FileUtils.getRelativePathTo(this.getPath(), getPath()).replace(/((\.d\.ts$)|(\.[^/.]+$))/i, "");
|
|
250782
250785
|
return moduleSpecifier.startsWith("../") ? moduleSpecifier : "./" + moduleSpecifier;
|
|
250783
250786
|
function getPath() {
|
|
250784
|
-
return sourceFileDirOrFilePath instanceof
|
|
250787
|
+
return sourceFileDirOrFilePath instanceof SourceFile15 ? getPathForSourceFile(sourceFileDirOrFilePath) : sourceFileDirOrFilePath instanceof _Directory ? getPathForDirectory(sourceFileDirOrFilePath) : getPathForFilePath(thisDirectory._context.fileSystemWrapper.getStandardizedAbsolutePath(sourceFileDirOrFilePath, thisDirectory.getPath()));
|
|
250785
250788
|
function getPathForSourceFile(sourceFile) {
|
|
250786
250789
|
return getPathForFilePath(sourceFile.getFilePath());
|
|
250787
250790
|
}
|
|
@@ -250853,7 +250856,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
250853
250856
|
};
|
|
250854
250857
|
}
|
|
250855
250858
|
static #isAncestorOfDir(ancestor, descendant) {
|
|
250856
|
-
if (descendant instanceof
|
|
250859
|
+
if (descendant instanceof SourceFile15) {
|
|
250857
250860
|
descendant = descendant.getDirectory();
|
|
250858
250861
|
if (ancestor === descendant)
|
|
250859
250862
|
return true;
|
|
@@ -251138,7 +251141,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
251138
251141
|
}
|
|
251139
251142
|
};
|
|
251140
251143
|
var kindToWrapperMappings = {
|
|
251141
|
-
[common.SyntaxKind.SourceFile]:
|
|
251144
|
+
[common.SyntaxKind.SourceFile]: SourceFile15,
|
|
251142
251145
|
[common.SyntaxKind.ArrayBindingPattern]: ArrayBindingPattern,
|
|
251143
251146
|
[common.SyntaxKind.ArrayLiteralExpression]: ArrayLiteralExpression,
|
|
251144
251147
|
[common.SyntaxKind.ArrayType]: ArrayTypeNode,
|
|
@@ -251249,7 +251252,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
251249
251252
|
[common.SyntaxKind.JsxAttribute]: JsxAttribute2,
|
|
251250
251253
|
[common.SyntaxKind.JsxClosingElement]: JsxClosingElement,
|
|
251251
251254
|
[common.SyntaxKind.JsxClosingFragment]: JsxClosingFragment,
|
|
251252
|
-
[common.SyntaxKind.JsxElement]:
|
|
251255
|
+
[common.SyntaxKind.JsxElement]: JsxElement4,
|
|
251253
251256
|
[common.SyntaxKind.JsxExpression]: JsxExpression4,
|
|
251254
251257
|
[common.SyntaxKind.JsxFragment]: JsxFragment4,
|
|
251255
251258
|
[common.SyntaxKind.JsxNamespacedName]: JsxNamespacedName,
|
|
@@ -251330,13 +251333,13 @@ Node text: ${this.#forgottenText}`;
|
|
|
251330
251333
|
[common.SyntaxKind.WhileStatement]: WhileStatement,
|
|
251331
251334
|
[common.SyntaxKind.WithStatement]: WithStatement,
|
|
251332
251335
|
[common.SyntaxKind.YieldExpression]: YieldExpression,
|
|
251333
|
-
[common.SyntaxKind.SemicolonToken]:
|
|
251336
|
+
[common.SyntaxKind.SemicolonToken]: Node4,
|
|
251334
251337
|
[common.SyntaxKind.AnyKeyword]: Expression,
|
|
251335
251338
|
[common.SyntaxKind.BooleanKeyword]: Expression,
|
|
251336
251339
|
[common.SyntaxKind.FalseKeyword]: FalseLiteral,
|
|
251337
251340
|
[common.SyntaxKind.ImportKeyword]: ImportExpression,
|
|
251338
|
-
[common.SyntaxKind.InferKeyword]:
|
|
251339
|
-
[common.SyntaxKind.NeverKeyword]:
|
|
251341
|
+
[common.SyntaxKind.InferKeyword]: Node4,
|
|
251342
|
+
[common.SyntaxKind.NeverKeyword]: Node4,
|
|
251340
251343
|
[common.SyntaxKind.NullKeyword]: NullLiteral,
|
|
251341
251344
|
[common.SyntaxKind.NumberKeyword]: Expression,
|
|
251342
251345
|
[common.SyntaxKind.ObjectKeyword]: Expression,
|
|
@@ -251503,7 +251506,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
251503
251506
|
return new CommentEnumMember(this.#context, compilerNode, sourceFile);
|
|
251504
251507
|
return common.errors.throwNotImplementedForNeverValueError(compilerNode);
|
|
251505
251508
|
}
|
|
251506
|
-
const ctor = kindToWrapperMappings[compilerNode.kind] ||
|
|
251509
|
+
const ctor = kindToWrapperMappings[compilerNode.kind] || Node4;
|
|
251507
251510
|
return new ctor(this.#context, compilerNode, sourceFile);
|
|
251508
251511
|
}
|
|
251509
251512
|
__name(createNode, "createNode");
|
|
@@ -251543,7 +251546,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
251543
251546
|
getSourceFile(compilerSourceFile, options) {
|
|
251544
251547
|
let wasAdded = false;
|
|
251545
251548
|
const sourceFile = this.#sourceFileCacheByFilePath.get(compilerSourceFile.fileName) ?? this.#nodeCache.getOrCreate(compilerSourceFile, () => {
|
|
251546
|
-
const createdSourceFile = new
|
|
251549
|
+
const createdSourceFile = new SourceFile15(this.#context, compilerSourceFile);
|
|
251547
251550
|
if (!options.markInProject)
|
|
251548
251551
|
this.#context.inProjectCoordinator.setSourceFileNotInProject(createdSourceFile);
|
|
251549
251552
|
this.#addSourceFileToCache(createdSourceFile);
|
|
@@ -251637,8 +251640,8 @@ Node text: ${this.#forgottenText}`;
|
|
|
251637
251640
|
return this.#jsDocTagInfoCache.getOrCreate(jsDocTagInfo, () => new JSDocTagInfo(jsDocTagInfo));
|
|
251638
251641
|
}
|
|
251639
251642
|
replaceCompilerNode(oldNode, newNode) {
|
|
251640
|
-
const nodeToReplace = oldNode instanceof
|
|
251641
|
-
const node = oldNode instanceof
|
|
251643
|
+
const nodeToReplace = oldNode instanceof Node4 ? oldNode.compilerNode : oldNode;
|
|
251644
|
+
const node = oldNode instanceof Node4 ? oldNode : this.#nodeCache.get(oldNode);
|
|
251642
251645
|
if (nodeToReplace.kind === common.SyntaxKind.SourceFile && nodeToReplace.fileName !== newNode.fileName) {
|
|
251643
251646
|
const sourceFile = node;
|
|
251644
251647
|
this.#removeCompilerNodeFromCache(nodeToReplace);
|
|
@@ -251683,12 +251686,12 @@ Node text: ${this.#forgottenText}`;
|
|
|
251683
251686
|
for (const node of nodes)
|
|
251684
251687
|
this.#nodeCache.rememberNode(node);
|
|
251685
251688
|
});
|
|
251686
|
-
if (
|
|
251689
|
+
if (Node4.isNode(result))
|
|
251687
251690
|
this.#nodeCache.rememberNode(result);
|
|
251688
251691
|
if (isPromise(result)) {
|
|
251689
251692
|
wasPromise = true;
|
|
251690
251693
|
return result.then((value) => {
|
|
251691
|
-
if (
|
|
251694
|
+
if (Node4.isNode(value))
|
|
251692
251695
|
this.#nodeCache.rememberNode(value);
|
|
251693
251696
|
this.#nodeCache.forgetLastPoint();
|
|
251694
251697
|
return value;
|
|
@@ -252274,7 +252277,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
252274
252277
|
}
|
|
252275
252278
|
};
|
|
252276
252279
|
})();
|
|
252277
|
-
var
|
|
252280
|
+
var Project15 = class {
|
|
252278
252281
|
static {
|
|
252279
252282
|
__name(this, "Project");
|
|
252280
252283
|
}
|
|
@@ -253115,7 +253118,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
253115
253118
|
exports.JsxClosingElement = JsxClosingElement;
|
|
253116
253119
|
exports.JsxClosingElementBase = JsxClosingElementBase;
|
|
253117
253120
|
exports.JsxClosingFragment = JsxClosingFragment;
|
|
253118
|
-
exports.JsxElement =
|
|
253121
|
+
exports.JsxElement = JsxElement4;
|
|
253119
253122
|
exports.JsxElementBase = JsxElementBase;
|
|
253120
253123
|
exports.JsxExpression = JsxExpression4;
|
|
253121
253124
|
exports.JsxExpressionBase = JsxExpressionBase;
|
|
@@ -253178,7 +253181,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
253178
253181
|
exports.NewExpressionBase = NewExpressionBase;
|
|
253179
253182
|
exports.NoSubstitutionTemplateLiteral = NoSubstitutionTemplateLiteral;
|
|
253180
253183
|
exports.NoSubstitutionTemplateLiteralBase = NoSubstitutionTemplateLiteralBase;
|
|
253181
|
-
exports.Node =
|
|
253184
|
+
exports.Node = Node4;
|
|
253182
253185
|
exports.NodeWithTypeArguments = NodeWithTypeArguments;
|
|
253183
253186
|
exports.NodeWithTypeArgumentsBase = NodeWithTypeArgumentsBase;
|
|
253184
253187
|
exports.NonNullExpression = NonNullExpression;
|
|
@@ -253220,7 +253223,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
253220
253223
|
exports.PrivateIdentifier = PrivateIdentifier;
|
|
253221
253224
|
exports.PrivateIdentifierBase = PrivateIdentifierBase;
|
|
253222
253225
|
exports.Program = Program;
|
|
253223
|
-
exports.Project =
|
|
253226
|
+
exports.Project = Project15;
|
|
253224
253227
|
exports.PropertyAccessExpression = PropertyAccessExpression;
|
|
253225
253228
|
exports.PropertyAccessExpressionBase = PropertyAccessExpressionBase;
|
|
253226
253229
|
exports.PropertyAssignment = PropertyAssignment;
|
|
@@ -253258,7 +253261,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
253258
253261
|
exports.ShorthandPropertyAssignmentBase = ShorthandPropertyAssignmentBase;
|
|
253259
253262
|
exports.Signature = Signature;
|
|
253260
253263
|
exports.SignaturedDeclaration = SignaturedDeclaration;
|
|
253261
|
-
exports.SourceFile =
|
|
253264
|
+
exports.SourceFile = SourceFile15;
|
|
253262
253265
|
exports.SourceFileBase = SourceFileBase;
|
|
253263
253266
|
exports.SpreadAssignment = SpreadAssignment;
|
|
253264
253267
|
exports.SpreadAssignmentBase = SpreadAssignmentBase;
|
|
@@ -253635,11 +253638,434 @@ var init_transform2 = __esm({
|
|
|
253635
253638
|
}
|
|
253636
253639
|
});
|
|
253637
253640
|
|
|
253638
|
-
// codemods/
|
|
253641
|
+
// codemods/inline-use-click-outside/transform.ts
|
|
253639
253642
|
var transform_exports3 = {};
|
|
253640
253643
|
__export(transform_exports3, {
|
|
253641
253644
|
default: () => transform3
|
|
253642
253645
|
});
|
|
253646
|
+
function getUseClickOutsideAliases(sourceFile, facadePackage) {
|
|
253647
|
+
const aliases = /* @__PURE__ */ new Set();
|
|
253648
|
+
for (const importDecl of sourceFile.getImportDeclarations()) {
|
|
253649
|
+
const moduleSpecifier = importDecl.getModuleSpecifierValue();
|
|
253650
|
+
if (!isElementsImport(moduleSpecifier, facadePackage)) continue;
|
|
253651
|
+
for (const namedImport of importDecl.getNamedImports()) {
|
|
253652
|
+
if (namedImport.getName() === "useClickOutside") {
|
|
253653
|
+
aliases.add(namedImport.getAliasNode()?.getText() ?? "useClickOutside");
|
|
253654
|
+
}
|
|
253655
|
+
}
|
|
253656
|
+
}
|
|
253657
|
+
return aliases;
|
|
253658
|
+
}
|
|
253659
|
+
function hasIdentifierUsage(sourceFile, identifier) {
|
|
253660
|
+
return sourceFile.getDescendantsOfKind(import_ts_morph3.SyntaxKind.Identifier).filter((node) => node.getText() === identifier).some((node) => node.getParentIfKind(import_ts_morph3.SyntaxKind.ImportSpecifier) === void 0);
|
|
253661
|
+
}
|
|
253662
|
+
function removeUnusedUseClickOutsideImports(sourceFile, aliases, facadePackage) {
|
|
253663
|
+
for (const importDecl of sourceFile.getImportDeclarations().slice()) {
|
|
253664
|
+
if (importDecl.wasForgotten()) continue;
|
|
253665
|
+
const moduleSpecifier = importDecl.getModuleSpecifierValue();
|
|
253666
|
+
if (!isElementsImport(moduleSpecifier, facadePackage)) continue;
|
|
253667
|
+
for (const namedImport of importDecl.getNamedImports().slice()) {
|
|
253668
|
+
if (namedImport.getName() !== "useClickOutside") continue;
|
|
253669
|
+
const alias = namedImport.getAliasNode()?.getText() ?? "useClickOutside";
|
|
253670
|
+
if (!aliases.has(alias)) continue;
|
|
253671
|
+
if (!hasIdentifierUsage(sourceFile, alias)) {
|
|
253672
|
+
namedImport.remove();
|
|
253673
|
+
}
|
|
253674
|
+
}
|
|
253675
|
+
if (importDecl.getNamedImports().length === 0 && !importDecl.getDefaultImport() && !importDecl.getNamespaceImport()) {
|
|
253676
|
+
importDecl.remove();
|
|
253677
|
+
}
|
|
253678
|
+
}
|
|
253679
|
+
}
|
|
253680
|
+
function ensureUseEffectIdentifier(sourceFile) {
|
|
253681
|
+
const reactImports = sourceFile.getImportDeclarations().filter((importDecl) => importDecl.getModuleSpecifierValue() === "react");
|
|
253682
|
+
for (const reactImport of reactImports) {
|
|
253683
|
+
if (reactImport.isTypeOnly()) continue;
|
|
253684
|
+
const existingUseEffect = reactImport.getNamedImports().find((namedImport) => namedImport.getName() === "useEffect");
|
|
253685
|
+
if (!existingUseEffect) continue;
|
|
253686
|
+
if (existingUseEffect.isTypeOnly()) {
|
|
253687
|
+
existingUseEffect.setIsTypeOnly(false);
|
|
253688
|
+
}
|
|
253689
|
+
return existingUseEffect.getAliasNode()?.getText() ?? "useEffect";
|
|
253690
|
+
}
|
|
253691
|
+
const importWithoutNamespace = reactImports.find(
|
|
253692
|
+
(importDecl) => !importDecl.isTypeOnly() && !importDecl.getNamespaceImport()
|
|
253693
|
+
);
|
|
253694
|
+
if (importWithoutNamespace) {
|
|
253695
|
+
importWithoutNamespace.addNamedImport("useEffect");
|
|
253696
|
+
return "useEffect";
|
|
253697
|
+
}
|
|
253698
|
+
sourceFile.addImportDeclaration({
|
|
253699
|
+
moduleSpecifier: "react",
|
|
253700
|
+
namedImports: ["useEffect"]
|
|
253701
|
+
});
|
|
253702
|
+
return "useEffect";
|
|
253703
|
+
}
|
|
253704
|
+
function buildInlinedEffect(refArgText, callbackArgText, useEffectIdentifier, uniqueId) {
|
|
253705
|
+
const refConst = `__inlineUseClickOutsideRef${uniqueId}`;
|
|
253706
|
+
const callbackConst = `__inlineUseClickOutsideOnClickOutside${uniqueId}`;
|
|
253707
|
+
return `const ${refConst} = ${refArgText}
|
|
253708
|
+
const ${callbackConst} = ${callbackArgText}
|
|
253709
|
+
|
|
253710
|
+
${useEffectIdentifier}(() => {
|
|
253711
|
+
const controller = new AbortController()
|
|
253712
|
+
const handleClickOutside = (event) => {
|
|
253713
|
+
const outsideParentElementForClickOutside = ${refConst}.current?.parentElement
|
|
253714
|
+
if (outsideParentElementForClickOutside && !outsideParentElementForClickOutside.contains(event?.target)) {
|
|
253715
|
+
(${callbackConst})()
|
|
253716
|
+
}
|
|
253717
|
+
}
|
|
253718
|
+
|
|
253719
|
+
document.addEventListener('mousedown', handleClickOutside, {
|
|
253720
|
+
signal: controller.signal,
|
|
253721
|
+
})
|
|
253722
|
+
|
|
253723
|
+
return () => {
|
|
253724
|
+
controller.abort()
|
|
253725
|
+
}
|
|
253726
|
+
}, [${refConst}, ${callbackConst}])`;
|
|
253727
|
+
}
|
|
253728
|
+
function annotateUnsupportedStatement(statement) {
|
|
253729
|
+
if (!statement) return;
|
|
253730
|
+
const statementText = statement.getText();
|
|
253731
|
+
if (statementText.includes(TODO_INLINE_MANUALLY)) return;
|
|
253732
|
+
statement.replaceWithText(`${TODO_INLINE_MANUALLY}
|
|
253733
|
+
${statementText}`);
|
|
253734
|
+
}
|
|
253735
|
+
function transform3(source, filePath = "file.tsx", options) {
|
|
253736
|
+
if (!source.includes("useClickOutside")) {
|
|
253737
|
+
return source;
|
|
253738
|
+
}
|
|
253739
|
+
const project = new import_ts_morph3.Project({
|
|
253740
|
+
useInMemoryFileSystem: true,
|
|
253741
|
+
compilerOptions: {
|
|
253742
|
+
jsx: 2
|
|
253743
|
+
},
|
|
253744
|
+
manipulationSettings: {
|
|
253745
|
+
quoteKind: import_ts_morph3.QuoteKind.Single,
|
|
253746
|
+
useTrailingCommas: false
|
|
253747
|
+
}
|
|
253748
|
+
});
|
|
253749
|
+
const sourceFile = project.createSourceFile(filePath, source);
|
|
253750
|
+
const aliases = getUseClickOutsideAliases(sourceFile, options?.facadePackage);
|
|
253751
|
+
if (aliases.size === 0) {
|
|
253752
|
+
return source;
|
|
253753
|
+
}
|
|
253754
|
+
let useEffectIdentifier = "useEffect";
|
|
253755
|
+
let nextUniqueId = 1;
|
|
253756
|
+
const processedUnsupportedStatements = /* @__PURE__ */ new Set();
|
|
253757
|
+
const supportedStatements = /* @__PURE__ */ new Map();
|
|
253758
|
+
const unsupportedStatements = /* @__PURE__ */ new Map();
|
|
253759
|
+
const callExpressions = sourceFile.getDescendantsOfKind(import_ts_morph3.SyntaxKind.CallExpression);
|
|
253760
|
+
for (const callExpression of callExpressions) {
|
|
253761
|
+
if (callExpression.wasForgotten()) continue;
|
|
253762
|
+
const calleeText = callExpression.getExpression().getText();
|
|
253763
|
+
if (!aliases.has(calleeText)) continue;
|
|
253764
|
+
const expressionStatement = callExpression.getParentIfKind(import_ts_morph3.SyntaxKind.ExpressionStatement);
|
|
253765
|
+
if (expressionStatement && callExpression.getArguments().length === 2) {
|
|
253766
|
+
const [refArg, callbackArg] = callExpression.getArguments();
|
|
253767
|
+
supportedStatements.set(expressionStatement.getStart(), {
|
|
253768
|
+
expressionStatement,
|
|
253769
|
+
refArgText: refArg.getText(),
|
|
253770
|
+
callbackArgText: callbackArg.getText()
|
|
253771
|
+
});
|
|
253772
|
+
continue;
|
|
253773
|
+
}
|
|
253774
|
+
const statement = callExpression.getFirstAncestor((ancestor) => import_ts_morph3.Node.isStatement(ancestor));
|
|
253775
|
+
if (!statement) continue;
|
|
253776
|
+
const position = statement.getStart();
|
|
253777
|
+
if (supportedStatements.has(position)) continue;
|
|
253778
|
+
if (processedUnsupportedStatements.has(position)) continue;
|
|
253779
|
+
unsupportedStatements.set(position, statement);
|
|
253780
|
+
processedUnsupportedStatements.add(position);
|
|
253781
|
+
}
|
|
253782
|
+
if (supportedStatements.size > 0) {
|
|
253783
|
+
useEffectIdentifier = ensureUseEffectIdentifier(sourceFile);
|
|
253784
|
+
const orderedSupportedStatements = [...supportedStatements.entries()].sort((a, b) => b[0] - a[0]);
|
|
253785
|
+
for (const [, { expressionStatement, refArgText, callbackArgText }] of orderedSupportedStatements) {
|
|
253786
|
+
if (expressionStatement.wasForgotten()) continue;
|
|
253787
|
+
expressionStatement.replaceWithText(
|
|
253788
|
+
buildInlinedEffect(refArgText, callbackArgText, useEffectIdentifier, nextUniqueId)
|
|
253789
|
+
);
|
|
253790
|
+
nextUniqueId++;
|
|
253791
|
+
}
|
|
253792
|
+
}
|
|
253793
|
+
const orderedUnsupportedStatements = [...unsupportedStatements.entries()].sort((a, b) => b[0] - a[0]);
|
|
253794
|
+
for (const [, statement] of orderedUnsupportedStatements) {
|
|
253795
|
+
if (statement.wasForgotten()) continue;
|
|
253796
|
+
annotateUnsupportedStatement(statement);
|
|
253797
|
+
}
|
|
253798
|
+
removeUnusedUseClickOutsideImports(sourceFile, aliases, options?.facadePackage);
|
|
253799
|
+
return sourceFile.getFullText();
|
|
253800
|
+
}
|
|
253801
|
+
var import_ts_morph3, TODO_INLINE_MANUALLY;
|
|
253802
|
+
var init_transform3 = __esm({
|
|
253803
|
+
"codemods/inline-use-click-outside/transform.ts"() {
|
|
253804
|
+
"use strict";
|
|
253805
|
+
import_ts_morph3 = __toESM(require_ts_morph(), 1);
|
|
253806
|
+
init_elements_import();
|
|
253807
|
+
TODO_INLINE_MANUALLY = "// TODO: Inline useClickOutside manually \u2014 this call shape could not be transformed safely";
|
|
253808
|
+
__name(getUseClickOutsideAliases, "getUseClickOutsideAliases");
|
|
253809
|
+
__name(hasIdentifierUsage, "hasIdentifierUsage");
|
|
253810
|
+
__name(removeUnusedUseClickOutsideImports, "removeUnusedUseClickOutsideImports");
|
|
253811
|
+
__name(ensureUseEffectIdentifier, "ensureUseEffectIdentifier");
|
|
253812
|
+
__name(buildInlinedEffect, "buildInlinedEffect");
|
|
253813
|
+
__name(annotateUnsupportedStatement, "annotateUnsupportedStatement");
|
|
253814
|
+
__name(transform3, "transform");
|
|
253815
|
+
}
|
|
253816
|
+
});
|
|
253817
|
+
|
|
253818
|
+
// codemods/replace-deprecated-label/transform.ts
|
|
253819
|
+
var transform_exports4 = {};
|
|
253820
|
+
__export(transform_exports4, {
|
|
253821
|
+
default: () => transform4
|
|
253822
|
+
});
|
|
253823
|
+
function resolveTargetSpecifier(sourceSpecifier, facadePackage) {
|
|
253824
|
+
if (facadePackage && matchesPackage(sourceSpecifier, facadePackage)) {
|
|
253825
|
+
return sourceSpecifier;
|
|
253826
|
+
}
|
|
253827
|
+
return TARGET_SPECIFIER;
|
|
253828
|
+
}
|
|
253829
|
+
function getDeprecatedLabelAliases(sourceFile, facadePackage) {
|
|
253830
|
+
const aliases = /* @__PURE__ */ new Set();
|
|
253831
|
+
for (const importDecl of sourceFile.getImportDeclarations()) {
|
|
253832
|
+
const moduleSpecifier = importDecl.getModuleSpecifierValue();
|
|
253833
|
+
if (!isElementsImport(moduleSpecifier, facadePackage)) continue;
|
|
253834
|
+
for (const namedImport of importDecl.getNamedImports()) {
|
|
253835
|
+
if (namedImport.getName() === "DeprecatedLabel") {
|
|
253836
|
+
aliases.add(namedImport.getAliasNode()?.getText() ?? "DeprecatedLabel");
|
|
253837
|
+
}
|
|
253838
|
+
}
|
|
253839
|
+
}
|
|
253840
|
+
if (aliases.size === 0 && sourceFile.getImportDeclarations().length === 0) {
|
|
253841
|
+
aliases.add("DeprecatedLabel");
|
|
253842
|
+
}
|
|
253843
|
+
return aliases;
|
|
253844
|
+
}
|
|
253845
|
+
function getDeprecatedLabelPropsAliases(sourceFile, facadePackage) {
|
|
253846
|
+
const aliases = /* @__PURE__ */ new Set();
|
|
253847
|
+
for (const importDecl of sourceFile.getImportDeclarations()) {
|
|
253848
|
+
const moduleSpecifier = importDecl.getModuleSpecifierValue();
|
|
253849
|
+
if (!isElementsImport(moduleSpecifier, facadePackage)) continue;
|
|
253850
|
+
for (const namedImport of importDecl.getNamedImports()) {
|
|
253851
|
+
if (namedImport.getName() === "DeprecatedLabelProps") {
|
|
253852
|
+
aliases.add(namedImport.getAliasNode()?.getText() ?? "DeprecatedLabelProps");
|
|
253853
|
+
}
|
|
253854
|
+
}
|
|
253855
|
+
}
|
|
253856
|
+
if (aliases.size === 0 && sourceFile.getImportDeclarations().length === 0) {
|
|
253857
|
+
aliases.add("DeprecatedLabelProps");
|
|
253858
|
+
}
|
|
253859
|
+
return aliases;
|
|
253860
|
+
}
|
|
253861
|
+
function hasIdentifierUsage2(sourceFile, localNames) {
|
|
253862
|
+
for (const identifier of sourceFile.getDescendantsOfKind(import_ts_morph4.SyntaxKind.Identifier)) {
|
|
253863
|
+
if (!localNames.has(identifier.getText())) continue;
|
|
253864
|
+
const parent = identifier.getParent();
|
|
253865
|
+
if (!parent) continue;
|
|
253866
|
+
const kind = parent.getKind();
|
|
253867
|
+
if (kind === import_ts_morph4.SyntaxKind.ImportSpecifier || kind === import_ts_morph4.SyntaxKind.ExportSpecifier || kind === import_ts_morph4.SyntaxKind.JsxOpeningElement || kind === import_ts_morph4.SyntaxKind.JsxSelfClosingElement || kind === import_ts_morph4.SyntaxKind.JsxClosingElement) {
|
|
253868
|
+
continue;
|
|
253869
|
+
}
|
|
253870
|
+
return true;
|
|
253871
|
+
}
|
|
253872
|
+
return false;
|
|
253873
|
+
}
|
|
253874
|
+
function hasDeprecatedLabelJsxUsage(sourceFile, labelAliases) {
|
|
253875
|
+
const elements = [
|
|
253876
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph4.SyntaxKind.JsxOpeningElement),
|
|
253877
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph4.SyntaxKind.JsxSelfClosingElement)
|
|
253878
|
+
];
|
|
253879
|
+
return elements.some((element) => labelAliases.has(element.getTagNameNode().getText()));
|
|
253880
|
+
}
|
|
253881
|
+
function addImportsToTarget(sourceFile, importsToAdd, targetSpecifier) {
|
|
253882
|
+
if (importsToAdd.length === 0) return;
|
|
253883
|
+
const currentImportDeclarations = sourceFile.getImportDeclarations();
|
|
253884
|
+
let targetDecl = currentImportDeclarations.find(
|
|
253885
|
+
(importDecl) => importDecl.getModuleSpecifierValue() === targetSpecifier
|
|
253886
|
+
);
|
|
253887
|
+
if (!targetDecl) {
|
|
253888
|
+
targetDecl = sourceFile.addImportDeclaration({ moduleSpecifier: targetSpecifier });
|
|
253889
|
+
}
|
|
253890
|
+
for (const { name, alias, isTypeOnly } of importsToAdd) {
|
|
253891
|
+
const existingImport = targetDecl.getNamedImports().find((namedImport) => {
|
|
253892
|
+
return namedImport.getName() === name && namedImport.getAliasNode()?.getText() === alias;
|
|
253893
|
+
});
|
|
253894
|
+
if (existingImport) {
|
|
253895
|
+
if (existingImport.isTypeOnly() && !isTypeOnly) {
|
|
253896
|
+
existingImport.setIsTypeOnly(false);
|
|
253897
|
+
}
|
|
253898
|
+
continue;
|
|
253899
|
+
}
|
|
253900
|
+
if (alias && alias !== name) {
|
|
253901
|
+
const typePrefix = isTypeOnly ? "type " : "";
|
|
253902
|
+
targetDecl.addNamedImport(`${typePrefix}${name} as ${alias}`);
|
|
253903
|
+
} else if (isTypeOnly) {
|
|
253904
|
+
targetDecl.addNamedImport({ name, isTypeOnly: true });
|
|
253905
|
+
} else {
|
|
253906
|
+
targetDecl.addNamedImport(name);
|
|
253907
|
+
}
|
|
253908
|
+
}
|
|
253909
|
+
}
|
|
253910
|
+
function transformImports(sourceFile, needsLabelTextImport, facadePackage) {
|
|
253911
|
+
const importsToAdd = [];
|
|
253912
|
+
const alreadyMigratedPath = facadePackage ? null : TARGET_SPECIFIER;
|
|
253913
|
+
for (const importDecl of sourceFile.getImportDeclarations().slice()) {
|
|
253914
|
+
if (importDecl.wasForgotten()) continue;
|
|
253915
|
+
const moduleSpecifier = importDecl.getModuleSpecifierValue();
|
|
253916
|
+
if (!isElementsImport(moduleSpecifier, facadePackage)) continue;
|
|
253917
|
+
if (alreadyMigratedPath && moduleSpecifier === alreadyMigratedPath) continue;
|
|
253918
|
+
const namedImports = importDecl.getNamedImports();
|
|
253919
|
+
const namedImportsToRemove = [];
|
|
253920
|
+
for (const namedImport of namedImports) {
|
|
253921
|
+
const originalName = namedImport.getName();
|
|
253922
|
+
if (originalName === "DeprecatedLabel") {
|
|
253923
|
+
if (needsLabelTextImport) {
|
|
253924
|
+
importsToAdd.push({
|
|
253925
|
+
name: "LabelText",
|
|
253926
|
+
alias: namedImport.getAliasNode()?.getText(),
|
|
253927
|
+
isTypeOnly: namedImport.isTypeOnly(),
|
|
253928
|
+
targetSpecifier: resolveTargetSpecifier(moduleSpecifier, facadePackage)
|
|
253929
|
+
});
|
|
253930
|
+
}
|
|
253931
|
+
namedImportsToRemove.push(namedImport);
|
|
253932
|
+
continue;
|
|
253933
|
+
}
|
|
253934
|
+
if (originalName === "DeprecatedLabelProps") {
|
|
253935
|
+
if (needsLabelTextImport) {
|
|
253936
|
+
importsToAdd.push({
|
|
253937
|
+
name: "LabelText",
|
|
253938
|
+
isTypeOnly: namedImport.isTypeOnly(),
|
|
253939
|
+
targetSpecifier: resolveTargetSpecifier(moduleSpecifier, facadePackage)
|
|
253940
|
+
});
|
|
253941
|
+
}
|
|
253942
|
+
namedImportsToRemove.push(namedImport);
|
|
253943
|
+
}
|
|
253944
|
+
}
|
|
253945
|
+
namedImportsToRemove.forEach((namedImport) => namedImport.remove());
|
|
253946
|
+
if (importDecl.getNamedImports().length === 0 && !importDecl.getDefaultImport()) {
|
|
253947
|
+
importDecl.remove();
|
|
253948
|
+
}
|
|
253949
|
+
}
|
|
253950
|
+
if (needsLabelTextImport && importsToAdd.length === 0) {
|
|
253951
|
+
importsToAdd.push({
|
|
253952
|
+
name: "LabelText",
|
|
253953
|
+
isTypeOnly: false,
|
|
253954
|
+
targetSpecifier: facadePackage ?? TARGET_SPECIFIER
|
|
253955
|
+
});
|
|
253956
|
+
}
|
|
253957
|
+
const groupedBySpecifier = /* @__PURE__ */ new Map();
|
|
253958
|
+
for (const { targetSpecifier, ...entry } of importsToAdd) {
|
|
253959
|
+
const group = groupedBySpecifier.get(targetSpecifier) ?? [];
|
|
253960
|
+
group.push(entry);
|
|
253961
|
+
groupedBySpecifier.set(targetSpecifier, group);
|
|
253962
|
+
}
|
|
253963
|
+
for (const [specifier, entries] of groupedBySpecifier) {
|
|
253964
|
+
addImportsToTarget(sourceFile, entries, specifier);
|
|
253965
|
+
}
|
|
253966
|
+
}
|
|
253967
|
+
function transformTypeReferences(sourceFile, propsAliases) {
|
|
253968
|
+
for (const typeRef of sourceFile.getDescendantsOfKind(import_ts_morph4.SyntaxKind.TypeReference)) {
|
|
253969
|
+
const typeName = typeRef.getTypeName();
|
|
253970
|
+
if (propsAliases.has(typeName.getText())) {
|
|
253971
|
+
typeName.replaceWithText("LabelText.Props");
|
|
253972
|
+
}
|
|
253973
|
+
}
|
|
253974
|
+
for (const heritage of sourceFile.getDescendantsOfKind(import_ts_morph4.SyntaxKind.ExpressionWithTypeArguments)) {
|
|
253975
|
+
const expression = heritage.getExpression();
|
|
253976
|
+
if (propsAliases.has(expression.getText())) {
|
|
253977
|
+
expression.replaceWithText("LabelText.Props");
|
|
253978
|
+
}
|
|
253979
|
+
}
|
|
253980
|
+
}
|
|
253981
|
+
function transformIdentifierReferences(sourceFile) {
|
|
253982
|
+
for (const identifier of sourceFile.getDescendantsOfKind(import_ts_morph4.SyntaxKind.Identifier)) {
|
|
253983
|
+
if (identifier.getText() !== "DeprecatedLabel") continue;
|
|
253984
|
+
const parent = identifier.getParent();
|
|
253985
|
+
if (!parent) continue;
|
|
253986
|
+
const parentKind = parent.getKind();
|
|
253987
|
+
if (parentKind === import_ts_morph4.SyntaxKind.ImportSpecifier || parentKind === import_ts_morph4.SyntaxKind.ExportSpecifier || parentKind === import_ts_morph4.SyntaxKind.JsxOpeningElement || parentKind === import_ts_morph4.SyntaxKind.JsxSelfClosingElement || parentKind === import_ts_morph4.SyntaxKind.JsxClosingElement) {
|
|
253988
|
+
continue;
|
|
253989
|
+
}
|
|
253990
|
+
identifier.replaceWithText("LabelText");
|
|
253991
|
+
}
|
|
253992
|
+
}
|
|
253993
|
+
function transformJsxElements2(sourceFile, labelAliases) {
|
|
253994
|
+
const elements = [
|
|
253995
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph4.SyntaxKind.JsxOpeningElement),
|
|
253996
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph4.SyntaxKind.JsxSelfClosingElement)
|
|
253997
|
+
];
|
|
253998
|
+
for (const element of elements) {
|
|
253999
|
+
const tagName = element.getTagNameNode();
|
|
254000
|
+
const tagNameText = tagName.getText();
|
|
254001
|
+
if (!labelAliases.has(tagNameText)) continue;
|
|
254002
|
+
if (tagNameText === "DeprecatedLabel") {
|
|
254003
|
+
tagName.replaceWithText("LabelText");
|
|
254004
|
+
}
|
|
254005
|
+
if (element.getKind() === import_ts_morph4.SyntaxKind.JsxOpeningElement) {
|
|
254006
|
+
const parent = element.getParent();
|
|
254007
|
+
if (parent?.getKind() !== import_ts_morph4.SyntaxKind.JsxElement) continue;
|
|
254008
|
+
const jsxElement = parent.asKind(import_ts_morph4.SyntaxKind.JsxElement);
|
|
254009
|
+
const closingTag = jsxElement?.getClosingElement();
|
|
254010
|
+
if (closingTag?.getTagNameNode().getText() === "DeprecatedLabel") {
|
|
254011
|
+
closingTag.getTagNameNode().replaceWithText("LabelText");
|
|
254012
|
+
}
|
|
254013
|
+
}
|
|
254014
|
+
}
|
|
254015
|
+
}
|
|
254016
|
+
function transform4(source, filePath = "file.tsx", options) {
|
|
254017
|
+
if (!source.includes("DeprecatedLabel") && !source.includes("DeprecatedLabelProps")) {
|
|
254018
|
+
return source;
|
|
254019
|
+
}
|
|
254020
|
+
const project = new import_ts_morph4.Project({
|
|
254021
|
+
useInMemoryFileSystem: true,
|
|
254022
|
+
compilerOptions: {
|
|
254023
|
+
jsx: 2
|
|
254024
|
+
// JsxEmit.React
|
|
254025
|
+
},
|
|
254026
|
+
manipulationSettings: {
|
|
254027
|
+
quoteKind: import_ts_morph4.QuoteKind.Single
|
|
254028
|
+
}
|
|
254029
|
+
});
|
|
254030
|
+
const sourceFile = project.createSourceFile(filePath, source);
|
|
254031
|
+
const facadePackage = options?.facadePackage;
|
|
254032
|
+
const labelAliases = getDeprecatedLabelAliases(sourceFile, facadePackage);
|
|
254033
|
+
const propsAliases = getDeprecatedLabelPropsAliases(sourceFile, facadePackage);
|
|
254034
|
+
const hasLabelUsage = hasDeprecatedLabelJsxUsage(sourceFile, labelAliases) || hasIdentifierUsage2(sourceFile, labelAliases);
|
|
254035
|
+
const hasPropsUsage = hasIdentifierUsage2(sourceFile, propsAliases);
|
|
254036
|
+
const needsLabelTextImport = hasLabelUsage || hasPropsUsage;
|
|
254037
|
+
transformImports(sourceFile, needsLabelTextImport, facadePackage);
|
|
254038
|
+
transformTypeReferences(sourceFile, propsAliases);
|
|
254039
|
+
transformIdentifierReferences(sourceFile);
|
|
254040
|
+
transformJsxElements2(sourceFile, labelAliases);
|
|
254041
|
+
return sourceFile.getFullText();
|
|
254042
|
+
}
|
|
254043
|
+
var import_ts_morph4, TARGET_SPECIFIER;
|
|
254044
|
+
var init_transform4 = __esm({
|
|
254045
|
+
"codemods/replace-deprecated-label/transform.ts"() {
|
|
254046
|
+
"use strict";
|
|
254047
|
+
import_ts_morph4 = __toESM(require_ts_morph(), 1);
|
|
254048
|
+
init_elements_import();
|
|
254049
|
+
TARGET_SPECIFIER = "@reapit/elements/core/label-text";
|
|
254050
|
+
__name(resolveTargetSpecifier, "resolveTargetSpecifier");
|
|
254051
|
+
__name(getDeprecatedLabelAliases, "getDeprecatedLabelAliases");
|
|
254052
|
+
__name(getDeprecatedLabelPropsAliases, "getDeprecatedLabelPropsAliases");
|
|
254053
|
+
__name(hasIdentifierUsage2, "hasIdentifierUsage");
|
|
254054
|
+
__name(hasDeprecatedLabelJsxUsage, "hasDeprecatedLabelJsxUsage");
|
|
254055
|
+
__name(addImportsToTarget, "addImportsToTarget");
|
|
254056
|
+
__name(transformImports, "transformImports");
|
|
254057
|
+
__name(transformTypeReferences, "transformTypeReferences");
|
|
254058
|
+
__name(transformIdentifierReferences, "transformIdentifierReferences");
|
|
254059
|
+
__name(transformJsxElements2, "transformJsxElements");
|
|
254060
|
+
__name(transform4, "transform");
|
|
254061
|
+
}
|
|
254062
|
+
});
|
|
254063
|
+
|
|
254064
|
+
// codemods/rewrite-text-font-imports/transform.ts
|
|
254065
|
+
var transform_exports5 = {};
|
|
254066
|
+
__export(transform_exports5, {
|
|
254067
|
+
default: () => transform5
|
|
254068
|
+
});
|
|
253643
254069
|
function isCoreTextImport(moduleSpecifier, facadePackage) {
|
|
253644
254070
|
if (!isElementsImport(moduleSpecifier, facadePackage)) {
|
|
253645
254071
|
return false;
|
|
@@ -253669,7 +254095,7 @@ function groupImportsFromDeclaration(importDecl) {
|
|
|
253669
254095
|
}
|
|
253670
254096
|
return { textImports, fontImports };
|
|
253671
254097
|
}
|
|
253672
|
-
function
|
|
254098
|
+
function transformImports2(sourceFile, facadePackage) {
|
|
253673
254099
|
const importDeclarations = sourceFile.getImportDeclarations();
|
|
253674
254100
|
const coreTextImports = importDeclarations.filter((importDecl) => {
|
|
253675
254101
|
const moduleSpecifier = importDecl.getModuleSpecifierValue();
|
|
@@ -253701,47 +254127,47 @@ function transformImports(sourceFile, facadePackage) {
|
|
|
253701
254127
|
}
|
|
253702
254128
|
}
|
|
253703
254129
|
}
|
|
253704
|
-
function
|
|
254130
|
+
function transform5(source, filePath = "file.tsx", options) {
|
|
253705
254131
|
if (!source.includes("/core/text")) {
|
|
253706
254132
|
return source;
|
|
253707
254133
|
}
|
|
253708
|
-
const project = new
|
|
254134
|
+
const project = new import_ts_morph5.Project({
|
|
253709
254135
|
useInMemoryFileSystem: true,
|
|
253710
254136
|
compilerOptions: {
|
|
253711
254137
|
jsx: 2
|
|
253712
254138
|
// JsxEmit.React
|
|
253713
254139
|
},
|
|
253714
254140
|
manipulationSettings: {
|
|
253715
|
-
quoteKind:
|
|
254141
|
+
quoteKind: import_ts_morph5.QuoteKind.Single,
|
|
253716
254142
|
useTrailingCommas: false
|
|
253717
254143
|
}
|
|
253718
254144
|
});
|
|
253719
254145
|
const sourceFile = project.createSourceFile(filePath, source);
|
|
253720
|
-
|
|
254146
|
+
transformImports2(sourceFile, options?.facadePackage);
|
|
253721
254147
|
let result = sourceFile.getFullText();
|
|
253722
254148
|
result = result.replace(/^(import\s+.*?from\s+'[^']+');$/gm, "$1");
|
|
253723
254149
|
return result;
|
|
253724
254150
|
}
|
|
253725
|
-
var
|
|
253726
|
-
var
|
|
254151
|
+
var import_ts_morph5, TEXT_EXPORTS, FONT_EXPORTS;
|
|
254152
|
+
var init_transform5 = __esm({
|
|
253727
254153
|
"codemods/rewrite-text-font-imports/transform.ts"() {
|
|
253728
254154
|
"use strict";
|
|
253729
|
-
|
|
254155
|
+
import_ts_morph5 = __toESM(require_ts_morph(), 1);
|
|
253730
254156
|
init_elements_import();
|
|
253731
254157
|
TEXT_EXPORTS = /* @__PURE__ */ new Set(["Text", "TextColour", "textColours", "elText"]);
|
|
253732
254158
|
FONT_EXPORTS = /* @__PURE__ */ new Set(["font", "FontSize", "FontWeight", "FontStyle", "fontSizes", "fontWeights"]);
|
|
253733
254159
|
__name(isCoreTextImport, "isCoreTextImport");
|
|
253734
254160
|
__name(buildImportPath, "buildImportPath");
|
|
253735
254161
|
__name(groupImportsFromDeclaration, "groupImportsFromDeclaration");
|
|
253736
|
-
__name(
|
|
253737
|
-
__name(
|
|
254162
|
+
__name(transformImports2, "transformImports");
|
|
254163
|
+
__name(transform5, "transform");
|
|
253738
254164
|
}
|
|
253739
254165
|
});
|
|
253740
254166
|
|
|
253741
254167
|
// codemods/rewrite-v4-imports/transform.ts
|
|
253742
|
-
var
|
|
253743
|
-
__export(
|
|
253744
|
-
default: () =>
|
|
254168
|
+
var transform_exports6 = {};
|
|
254169
|
+
__export(transform_exports6, {
|
|
254170
|
+
default: () => transform6
|
|
253745
254171
|
});
|
|
253746
254172
|
function matchesPackage2(moduleSpecifier, packageName) {
|
|
253747
254173
|
return moduleSpecifier === packageName || moduleSpecifier.startsWith(packageName + "/");
|
|
@@ -253766,7 +254192,7 @@ function getDeprecatedName(name) {
|
|
|
253766
254192
|
}
|
|
253767
254193
|
return null;
|
|
253768
254194
|
}
|
|
253769
|
-
function
|
|
254195
|
+
function transformImports3(sourceFile, facadePackage) {
|
|
253770
254196
|
const importDeclarations = sourceFile.getImportDeclarations();
|
|
253771
254197
|
for (const importDecl of importDeclarations) {
|
|
253772
254198
|
const moduleSpecifier = importDecl.getModuleSpecifierValue();
|
|
@@ -253788,8 +254214,8 @@ function transformImports2(sourceFile, facadePackage) {
|
|
|
253788
254214
|
}
|
|
253789
254215
|
}
|
|
253790
254216
|
}
|
|
253791
|
-
function
|
|
253792
|
-
const project = new
|
|
254217
|
+
function transform6(source, filePath = "file.tsx", options) {
|
|
254218
|
+
const project = new import_ts_morph6.Project({
|
|
253793
254219
|
useInMemoryFileSystem: true,
|
|
253794
254220
|
compilerOptions: {
|
|
253795
254221
|
jsx: 2
|
|
@@ -253797,14 +254223,14 @@ function transform4(source, filePath = "file.tsx", options) {
|
|
|
253797
254223
|
}
|
|
253798
254224
|
});
|
|
253799
254225
|
const sourceFile = project.createSourceFile(filePath, source);
|
|
253800
|
-
|
|
254226
|
+
transformImports3(sourceFile, options?.facadePackage);
|
|
253801
254227
|
return sourceFile.getFullText();
|
|
253802
254228
|
}
|
|
253803
|
-
var
|
|
253804
|
-
var
|
|
254229
|
+
var import_ts_morph6, moduleTransformations;
|
|
254230
|
+
var init_transform6 = __esm({
|
|
253805
254231
|
"codemods/rewrite-v4-imports/transform.ts"() {
|
|
253806
254232
|
"use strict";
|
|
253807
|
-
|
|
254233
|
+
import_ts_morph6 = __toESM(require_ts_morph(), 1);
|
|
253808
254234
|
moduleTransformations = {
|
|
253809
254235
|
// Main Components
|
|
253810
254236
|
Accordion: "DeprecatedAccordion",
|
|
@@ -253954,8 +254380,8 @@ var init_transform4 = __esm({
|
|
|
253954
254380
|
__name(matchesPackage2, "matchesPackage");
|
|
253955
254381
|
__name(isElementsImport2, "isElementsImport");
|
|
253956
254382
|
__name(getDeprecatedName, "getDeprecatedName");
|
|
253957
|
-
__name(
|
|
253958
|
-
__name(
|
|
254383
|
+
__name(transformImports3, "transformImports");
|
|
254384
|
+
__name(transform6, "transform");
|
|
253959
254385
|
}
|
|
253960
254386
|
});
|
|
253961
254387
|
|
|
@@ -254195,9 +254621,6 @@ var init_export_map = __esm({
|
|
|
254195
254621
|
DeprecatedAccordionTitleItemProps: "deprecated/accordion",
|
|
254196
254622
|
DeprecatedAvatar: "deprecated/avatar",
|
|
254197
254623
|
DeprecatedAvatarProps: "deprecated/avatar",
|
|
254198
|
-
DeprecatedBadge: "deprecated/badge",
|
|
254199
|
-
DeprecatedBadgeGroup: "deprecated/badge",
|
|
254200
|
-
DeprecatedBadgeProps: "deprecated/badge",
|
|
254201
254624
|
DeprecatedBreadCrumb: "deprecated/breadcrumb",
|
|
254202
254625
|
DeprecatedBreadCrumbItem: "deprecated/breadcrumb",
|
|
254203
254626
|
DeprecatedBreadCrumbProps: "deprecated/breadcrumb",
|
|
@@ -254277,9 +254700,6 @@ var init_export_map = __esm({
|
|
|
254277
254700
|
DeprecatedTableRowContainerProps: "deprecated/table",
|
|
254278
254701
|
DeprecatedTableSortHeader: "deprecated/table",
|
|
254279
254702
|
DeprecatedTableSortHeaderProps: "deprecated/table",
|
|
254280
|
-
DeprecatedTag: "deprecated/tag",
|
|
254281
|
-
DeprecatedTagGroup: "deprecated/tag",
|
|
254282
|
-
DeprecatedTagProps: "deprecated/tag",
|
|
254283
254703
|
DeprecatedToolTip: "deprecated/tool-tip",
|
|
254284
254704
|
DeprecatedToolTipChild: "deprecated/tool-tip",
|
|
254285
254705
|
DeprecatedToolTipChildProps: "deprecated/tool-tip",
|
|
@@ -254462,9 +254882,6 @@ var init_export_map = __esm({
|
|
|
254462
254882
|
ElDeprecatedAccordionTitleContentWrapper: "deprecated/accordion",
|
|
254463
254883
|
ElDeprecatedAvatar: "deprecated/avatar",
|
|
254464
254884
|
ElDeprecatedAvatarImage: "deprecated/avatar",
|
|
254465
|
-
ElDeprecatedBadge: "deprecated/badge",
|
|
254466
|
-
ElDeprecatedBadgeGroup: "deprecated/badge",
|
|
254467
|
-
ElDeprecatedBadgeGroupInner: "deprecated/badge",
|
|
254468
254885
|
ElDeprecatedBreadCrumbContainer: "deprecated/breadcrumb",
|
|
254469
254886
|
ElDeprecatedBreadCrumbItem: "deprecated/breadcrumb",
|
|
254470
254887
|
ElDeprecatedChipCheckbox: "deprecated/chip",
|
|
@@ -254535,9 +254952,6 @@ var init_export_map = __esm({
|
|
|
254535
254952
|
ElDeprecatedTableRow: "deprecated/table",
|
|
254536
254953
|
ElDeprecatedTableRowContainer: "deprecated/table",
|
|
254537
254954
|
ElDeprecatedTableSortHeader: "deprecated/table",
|
|
254538
|
-
ElDeprecatedTag: "deprecated/tag",
|
|
254539
|
-
ElDeprecatedTagGroup: "deprecated/tag",
|
|
254540
|
-
ElDeprecatedTagGroupInner: "deprecated/tag",
|
|
254541
254955
|
ElDeprecatedToolTipChild: "deprecated/tool-tip",
|
|
254542
254956
|
ElDeprecatedToolTipContainer: "deprecated/tool-tip",
|
|
254543
254957
|
elDialog: "core/dialog",
|
|
@@ -255605,9 +256019,9 @@ var init_export_map = __esm({
|
|
|
255605
256019
|
});
|
|
255606
256020
|
|
|
255607
256021
|
// codemods/rewrite-v5-imports/transform.ts
|
|
255608
|
-
var
|
|
255609
|
-
__export(
|
|
255610
|
-
default: () =>
|
|
256022
|
+
var transform_exports7 = {};
|
|
256023
|
+
__export(transform_exports7, {
|
|
256024
|
+
default: () => transform7
|
|
255611
256025
|
});
|
|
255612
256026
|
function isBarrelImport(moduleSpecifier) {
|
|
255613
256027
|
return moduleSpecifier === "@reapit/elements";
|
|
@@ -255654,48 +256068,48 @@ function transformDeclaration(sourceFile, importDecl) {
|
|
|
255654
256068
|
});
|
|
255655
256069
|
}
|
|
255656
256070
|
}
|
|
255657
|
-
function
|
|
256071
|
+
function transformImports4(sourceFile) {
|
|
255658
256072
|
const importDeclarations = sourceFile.getImportDeclarations();
|
|
255659
256073
|
const barrelImports = importDeclarations.filter((decl) => isBarrelImport(decl.getModuleSpecifierValue()));
|
|
255660
256074
|
for (const decl of barrelImports) {
|
|
255661
256075
|
transformDeclaration(sourceFile, decl);
|
|
255662
256076
|
}
|
|
255663
256077
|
}
|
|
255664
|
-
function
|
|
256078
|
+
function transform7(source, filePath = "file.tsx") {
|
|
255665
256079
|
const hasBarrelImport = source.includes("'@reapit/elements'") || source.includes('"@reapit/elements"');
|
|
255666
256080
|
if (!hasBarrelImport) {
|
|
255667
256081
|
return source;
|
|
255668
256082
|
}
|
|
255669
|
-
const project = new
|
|
256083
|
+
const project = new import_ts_morph7.Project({
|
|
255670
256084
|
useInMemoryFileSystem: true,
|
|
255671
256085
|
compilerOptions: {
|
|
255672
256086
|
jsx: 2
|
|
255673
256087
|
// JsxEmit.React
|
|
255674
256088
|
},
|
|
255675
256089
|
manipulationSettings: {
|
|
255676
|
-
quoteKind:
|
|
256090
|
+
quoteKind: import_ts_morph7.QuoteKind.Single,
|
|
255677
256091
|
useTrailingCommas: false
|
|
255678
256092
|
}
|
|
255679
256093
|
});
|
|
255680
256094
|
const sourceFile = project.createSourceFile(filePath, source);
|
|
255681
|
-
|
|
256095
|
+
transformImports4(sourceFile);
|
|
255682
256096
|
let result = sourceFile.getFullText();
|
|
255683
256097
|
result = result.replace(/^(import\s+.*?\sfrom\s)"([^"]+)"/gm, "$1'$2'");
|
|
255684
256098
|
result = result.replace(/^(import\s+.*?from\s+'[^']+');$/gm, "$1");
|
|
255685
256099
|
return result;
|
|
255686
256100
|
}
|
|
255687
|
-
var
|
|
255688
|
-
var
|
|
256101
|
+
var import_ts_morph7;
|
|
256102
|
+
var init_transform7 = __esm({
|
|
255689
256103
|
"codemods/rewrite-v5-imports/transform.ts"() {
|
|
255690
256104
|
"use strict";
|
|
255691
|
-
|
|
256105
|
+
import_ts_morph7 = __toESM(require_ts_morph(), 1);
|
|
255692
256106
|
init_export_map();
|
|
255693
256107
|
__name(isBarrelImport, "isBarrelImport");
|
|
255694
256108
|
__name(buildSubpathSpecifier, "buildSubpathSpecifier");
|
|
255695
256109
|
__name(serialiseNamedImport, "serialiseNamedImport");
|
|
255696
256110
|
__name(transformDeclaration, "transformDeclaration");
|
|
255697
|
-
__name(
|
|
255698
|
-
__name(
|
|
256111
|
+
__name(transformImports4, "transformImports");
|
|
256112
|
+
__name(transform7, "transform");
|
|
255699
256113
|
}
|
|
255700
256114
|
});
|
|
255701
256115
|
|
|
@@ -256260,9 +256674,9 @@ var init_css_variable_map = __esm({
|
|
|
256260
256674
|
});
|
|
256261
256675
|
|
|
256262
256676
|
// codemods/upgrade-css-variables/transform.ts
|
|
256263
|
-
var
|
|
256264
|
-
__export(
|
|
256265
|
-
default: () =>
|
|
256677
|
+
var transform_exports8 = {};
|
|
256678
|
+
__export(transform_exports8, {
|
|
256679
|
+
default: () => transform8
|
|
256266
256680
|
});
|
|
256267
256681
|
function replaceCssVarCalls(source) {
|
|
256268
256682
|
let result = "";
|
|
@@ -256358,25 +256772,25 @@ function replaceCssVarCalls(source) {
|
|
|
256358
256772
|
}
|
|
256359
256773
|
return result;
|
|
256360
256774
|
}
|
|
256361
|
-
function
|
|
256775
|
+
function transform8(source, _filePath, _options) {
|
|
256362
256776
|
if (!source.includes("var(--")) {
|
|
256363
256777
|
return source;
|
|
256364
256778
|
}
|
|
256365
256779
|
return replaceCssVarCalls(source);
|
|
256366
256780
|
}
|
|
256367
|
-
var
|
|
256781
|
+
var init_transform8 = __esm({
|
|
256368
256782
|
"codemods/upgrade-css-variables/transform.ts"() {
|
|
256369
256783
|
"use strict";
|
|
256370
256784
|
init_css_variable_map();
|
|
256371
256785
|
__name(replaceCssVarCalls, "replaceCssVarCalls");
|
|
256372
|
-
__name(
|
|
256786
|
+
__name(transform8, "transform");
|
|
256373
256787
|
}
|
|
256374
256788
|
});
|
|
256375
256789
|
|
|
256376
256790
|
// codemods/upgrade-deprecated-badge/transform.ts
|
|
256377
|
-
var
|
|
256378
|
-
__export(
|
|
256379
|
-
default: () =>
|
|
256791
|
+
var transform_exports9 = {};
|
|
256792
|
+
__export(transform_exports9, {
|
|
256793
|
+
default: () => transform9
|
|
256380
256794
|
});
|
|
256381
256795
|
function getDeprecatedBadgeAliases(sourceFile, facadePackage) {
|
|
256382
256796
|
const aliases = /* @__PURE__ */ new Set();
|
|
@@ -256410,7 +256824,7 @@ function getDeprecatedBadgeGroupAliases(sourceFile, facadePackage) {
|
|
|
256410
256824
|
}
|
|
256411
256825
|
return aliases;
|
|
256412
256826
|
}
|
|
256413
|
-
function
|
|
256827
|
+
function transformImports5(sourceFile, facadePackage) {
|
|
256414
256828
|
const badgeImportsToAdd = [];
|
|
256415
256829
|
const targetModuleSpecifier = facadePackage ?? "@reapit/elements/core/badge";
|
|
256416
256830
|
const alreadyMigratedPath = facadePackage ? null : "@reapit/elements/core/badge";
|
|
@@ -256472,14 +256886,14 @@ function transformImports4(sourceFile, facadePackage) {
|
|
|
256472
256886
|
}
|
|
256473
256887
|
}
|
|
256474
256888
|
}
|
|
256475
|
-
function
|
|
256476
|
-
for (const typeRef of sourceFile.getDescendantsOfKind(
|
|
256889
|
+
function transformTypeReferences2(sourceFile) {
|
|
256890
|
+
for (const typeRef of sourceFile.getDescendantsOfKind(import_ts_morph8.SyntaxKind.TypeReference)) {
|
|
256477
256891
|
const typeName = typeRef.getTypeName();
|
|
256478
256892
|
if (typeName.getText() === "DeprecatedBadgeProps") {
|
|
256479
256893
|
typeName.replaceWithText("Badge.Props");
|
|
256480
256894
|
}
|
|
256481
256895
|
}
|
|
256482
|
-
for (const heritage of sourceFile.getDescendantsOfKind(
|
|
256896
|
+
for (const heritage of sourceFile.getDescendantsOfKind(import_ts_morph8.SyntaxKind.ExpressionWithTypeArguments)) {
|
|
256483
256897
|
const expression = heritage.getExpression();
|
|
256484
256898
|
if (expression.getText() === "DeprecatedBadgeProps") {
|
|
256485
256899
|
expression.replaceWithText("Badge.Props");
|
|
@@ -256488,12 +256902,12 @@ function transformTypeReferences(sourceFile) {
|
|
|
256488
256902
|
}
|
|
256489
256903
|
function extractStringValue(init) {
|
|
256490
256904
|
const kind = init.getKind();
|
|
256491
|
-
if (kind ===
|
|
256905
|
+
if (kind === import_ts_morph8.SyntaxKind.StringLiteral) {
|
|
256492
256906
|
return init.getLiteralText();
|
|
256493
256907
|
}
|
|
256494
|
-
if (kind ===
|
|
256908
|
+
if (kind === import_ts_morph8.SyntaxKind.JsxExpression) {
|
|
256495
256909
|
const expr = init.getExpression();
|
|
256496
|
-
if (expr?.getKind() ===
|
|
256910
|
+
if (expr?.getKind() === import_ts_morph8.SyntaxKind.StringLiteral) {
|
|
256497
256911
|
return expr.getLiteralText();
|
|
256498
256912
|
}
|
|
256499
256913
|
}
|
|
@@ -256501,8 +256915,8 @@ function extractStringValue(init) {
|
|
|
256501
256915
|
}
|
|
256502
256916
|
function transformBadgeElements(sourceFile, aliases) {
|
|
256503
256917
|
const elements = [
|
|
256504
|
-
...sourceFile.getDescendantsOfKind(
|
|
256505
|
-
...sourceFile.getDescendantsOfKind(
|
|
256918
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph8.SyntaxKind.JsxOpeningElement),
|
|
256919
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph8.SyntaxKind.JsxSelfClosingElement)
|
|
256506
256920
|
];
|
|
256507
256921
|
for (const element of elements) {
|
|
256508
256922
|
const tagName = element.getTagNameNode();
|
|
@@ -256517,8 +256931,8 @@ function transformBadgeElements(sourceFile, aliases) {
|
|
|
256517
256931
|
let hasIntentAttr = false;
|
|
256518
256932
|
let hasColourAttr = false;
|
|
256519
256933
|
for (const attr of attributes) {
|
|
256520
|
-
if (attr.getKind() !==
|
|
256521
|
-
const jsxAttr = attr.asKind(
|
|
256934
|
+
if (attr.getKind() !== import_ts_morph8.SyntaxKind.JsxAttribute) continue;
|
|
256935
|
+
const jsxAttr = attr.asKind(import_ts_morph8.SyntaxKind.JsxAttribute);
|
|
256522
256936
|
const name = jsxAttr.getNameNode().getText();
|
|
256523
256937
|
if (name === "intent") {
|
|
256524
256938
|
hasIntentAttr = true;
|
|
@@ -256539,8 +256953,8 @@ function transformBadgeElements(sourceFile, aliases) {
|
|
|
256539
256953
|
}
|
|
256540
256954
|
if (hasIntentAttr) {
|
|
256541
256955
|
for (const attr of attributes.slice()) {
|
|
256542
|
-
if (attr.getKind() !==
|
|
256543
|
-
const jsxAttr = attr.asKind(
|
|
256956
|
+
if (attr.getKind() !== import_ts_morph8.SyntaxKind.JsxAttribute) continue;
|
|
256957
|
+
const jsxAttr = attr.asKind(import_ts_morph8.SyntaxKind.JsxAttribute);
|
|
256544
256958
|
if (jsxAttr.getNameNode().getText() !== "intent") continue;
|
|
256545
256959
|
if (intentIsDynamic) {
|
|
256546
256960
|
jsxAttr.getNameNode().replaceWithText("colour");
|
|
@@ -256553,10 +256967,10 @@ function transformBadgeElements(sourceFile, aliases) {
|
|
|
256553
256967
|
} else if (!hasColourAttr) {
|
|
256554
256968
|
element.addAttribute({ name: "colour", initializer: '"neutral"' });
|
|
256555
256969
|
}
|
|
256556
|
-
if (element.getKind() ===
|
|
256970
|
+
if (element.getKind() === import_ts_morph8.SyntaxKind.JsxOpeningElement) {
|
|
256557
256971
|
const parent = element.getParent();
|
|
256558
|
-
if (parent?.getKind() ===
|
|
256559
|
-
const closingTag = parent.asKind(
|
|
256972
|
+
if (parent?.getKind() === import_ts_morph8.SyntaxKind.JsxElement) {
|
|
256973
|
+
const closingTag = parent.asKind(import_ts_morph8.SyntaxKind.JsxElement)?.getClosingElement();
|
|
256560
256974
|
if (closingTag?.getTagNameNode().getText() === "DeprecatedBadge") {
|
|
256561
256975
|
closingTag.getTagNameNode().replaceWithText("Badge");
|
|
256562
256976
|
}
|
|
@@ -256566,20 +256980,20 @@ function transformBadgeElements(sourceFile, aliases) {
|
|
|
256566
256980
|
}
|
|
256567
256981
|
function transformBadgeGroupElements(sourceFile, aliases) {
|
|
256568
256982
|
const commentPositions = [];
|
|
256569
|
-
for (const element of sourceFile.getDescendantsOfKind(
|
|
256983
|
+
for (const element of sourceFile.getDescendantsOfKind(import_ts_morph8.SyntaxKind.JsxSelfClosingElement)) {
|
|
256570
256984
|
if (!aliases.has(element.getTagNameNode().getText())) continue;
|
|
256571
256985
|
const startPos = element.getStart();
|
|
256572
256986
|
element.getTagNameNode().replaceWithText("div");
|
|
256573
256987
|
element.addAttribute({ name: "style", initializer: '{{ display: "flex", flexWrap: "wrap", gap: "0.25rem" }}' });
|
|
256574
256988
|
commentPositions.push(startPos);
|
|
256575
256989
|
}
|
|
256576
|
-
for (const element of sourceFile.getDescendantsOfKind(
|
|
256990
|
+
for (const element of sourceFile.getDescendantsOfKind(import_ts_morph8.SyntaxKind.JsxOpeningElement)) {
|
|
256577
256991
|
if (!aliases.has(element.getTagNameNode().getText())) continue;
|
|
256578
256992
|
element.getTagNameNode().replaceWithText("div");
|
|
256579
256993
|
element.addAttribute({ name: "style", initializer: '{{ display: "flex", flexWrap: "wrap", gap: "0.25rem" }}' });
|
|
256580
256994
|
const parent = element.getParent();
|
|
256581
|
-
if (parent?.getKind() ===
|
|
256582
|
-
const closingTag = parent.asKind(
|
|
256995
|
+
if (parent?.getKind() === import_ts_morph8.SyntaxKind.JsxElement) {
|
|
256996
|
+
const closingTag = parent.asKind(import_ts_morph8.SyntaxKind.JsxElement)?.getClosingElement();
|
|
256583
256997
|
if (closingTag && aliases.has(closingTag.getTagNameNode().getText())) {
|
|
256584
256998
|
closingTag.getTagNameNode().replaceWithText("div");
|
|
256585
256999
|
}
|
|
@@ -256592,33 +257006,33 @@ function transformBadgeGroupElements(sourceFile, aliases) {
|
|
|
256592
257006
|
`);
|
|
256593
257007
|
}
|
|
256594
257008
|
}
|
|
256595
|
-
function
|
|
257009
|
+
function transform9(source, filePath = "file.tsx", options) {
|
|
256596
257010
|
if (!source.includes("DeprecatedBadge")) return source;
|
|
256597
|
-
const project = new
|
|
257011
|
+
const project = new import_ts_morph8.Project({
|
|
256598
257012
|
useInMemoryFileSystem: true,
|
|
256599
257013
|
compilerOptions: {
|
|
256600
257014
|
jsx: 2
|
|
256601
257015
|
// JsxEmit.React
|
|
256602
257016
|
},
|
|
256603
257017
|
manipulationSettings: {
|
|
256604
|
-
quoteKind:
|
|
257018
|
+
quoteKind: import_ts_morph8.QuoteKind.Single
|
|
256605
257019
|
}
|
|
256606
257020
|
});
|
|
256607
257021
|
const sourceFile = project.createSourceFile(filePath, source);
|
|
256608
257022
|
const facadePackage = options?.facadePackage;
|
|
256609
257023
|
const badgeAliases = getDeprecatedBadgeAliases(sourceFile, facadePackage);
|
|
256610
257024
|
const badgeGroupAliases = getDeprecatedBadgeGroupAliases(sourceFile, facadePackage);
|
|
256611
|
-
|
|
256612
|
-
|
|
257025
|
+
transformImports5(sourceFile, facadePackage);
|
|
257026
|
+
transformTypeReferences2(sourceFile);
|
|
256613
257027
|
transformBadgeElements(sourceFile, badgeAliases);
|
|
256614
257028
|
transformBadgeGroupElements(sourceFile, badgeGroupAliases);
|
|
256615
257029
|
return sourceFile.getFullText();
|
|
256616
257030
|
}
|
|
256617
|
-
var
|
|
256618
|
-
var
|
|
257031
|
+
var import_ts_morph8, INTENT_TO_COLOUR, IMPORTS_TO_REMOVE, TODO_COMMENT;
|
|
257032
|
+
var init_transform9 = __esm({
|
|
256619
257033
|
"codemods/upgrade-deprecated-badge/transform.ts"() {
|
|
256620
257034
|
"use strict";
|
|
256621
|
-
|
|
257035
|
+
import_ts_morph8 = __toESM(require_ts_morph(), 1);
|
|
256622
257036
|
init_elements_import();
|
|
256623
257037
|
INTENT_TO_COLOUR = {
|
|
256624
257038
|
primary: "neutral",
|
|
@@ -256641,24 +257055,24 @@ var init_transform7 = __esm({
|
|
|
256641
257055
|
"ElDeprecatedBadgeGroup",
|
|
256642
257056
|
"ElDeprecatedBadgeGroupInner"
|
|
256643
257057
|
]);
|
|
256644
|
-
__name(
|
|
256645
|
-
__name(
|
|
257058
|
+
__name(transformImports5, "transformImports");
|
|
257059
|
+
__name(transformTypeReferences2, "transformTypeReferences");
|
|
256646
257060
|
__name(extractStringValue, "extractStringValue");
|
|
256647
257061
|
__name(transformBadgeElements, "transformBadgeElements");
|
|
256648
257062
|
TODO_COMMENT = "{/* TODO: DeprecatedBadgeGroup has no core equivalent \u2014 review this layout */}";
|
|
256649
257063
|
__name(transformBadgeGroupElements, "transformBadgeGroupElements");
|
|
256650
|
-
__name(
|
|
257064
|
+
__name(transform9, "transform");
|
|
256651
257065
|
}
|
|
256652
257066
|
});
|
|
256653
257067
|
|
|
256654
257068
|
// codemods/upgrade-deprecated-button/transform.ts
|
|
256655
|
-
var
|
|
256656
|
-
__export(
|
|
256657
|
-
default: () =>
|
|
257069
|
+
var transform_exports10 = {};
|
|
257070
|
+
__export(transform_exports10, {
|
|
257071
|
+
default: () => transform10
|
|
256658
257072
|
});
|
|
256659
257073
|
function usesDeprecatedIconInJsx(sourceFile) {
|
|
256660
|
-
const jsxElements = sourceFile.getDescendantsOfKind(
|
|
256661
|
-
const jsxSelfClosingElements = sourceFile.getDescendantsOfKind(
|
|
257074
|
+
const jsxElements = sourceFile.getDescendantsOfKind(import_ts_morph9.SyntaxKind.JsxOpeningElement);
|
|
257075
|
+
const jsxSelfClosingElements = sourceFile.getDescendantsOfKind(import_ts_morph9.SyntaxKind.JsxSelfClosingElement);
|
|
256662
257076
|
const allElements = [...jsxElements, ...jsxSelfClosingElements];
|
|
256663
257077
|
return allElements.some((element) => {
|
|
256664
257078
|
const tagName = element.getTagNameNode().getText();
|
|
@@ -256705,8 +257119,8 @@ function addDeprecatedIconImportIfNeeded(sourceFile, facadePackage) {
|
|
|
256705
257119
|
mainImport.addNamedImport("DeprecatedIcon");
|
|
256706
257120
|
}
|
|
256707
257121
|
}
|
|
256708
|
-
function
|
|
256709
|
-
const typeReferences = sourceFile.getDescendantsOfKind(
|
|
257122
|
+
function transformTypeReferences3(sourceFile) {
|
|
257123
|
+
const typeReferences = sourceFile.getDescendantsOfKind(import_ts_morph9.SyntaxKind.TypeReference);
|
|
256710
257124
|
for (const typeRef of typeReferences) {
|
|
256711
257125
|
const typeName = typeRef.getTypeName();
|
|
256712
257126
|
const typeNameText = typeName.getText();
|
|
@@ -256714,7 +257128,7 @@ function transformTypeReferences2(sourceFile) {
|
|
|
256714
257128
|
typeName.replaceWithText("Button.Props");
|
|
256715
257129
|
}
|
|
256716
257130
|
}
|
|
256717
|
-
const heritageExpressions = sourceFile.getDescendantsOfKind(
|
|
257131
|
+
const heritageExpressions = sourceFile.getDescendantsOfKind(import_ts_morph9.SyntaxKind.ExpressionWithTypeArguments);
|
|
256718
257132
|
for (const heritage of heritageExpressions) {
|
|
256719
257133
|
const expression = heritage.getExpression();
|
|
256720
257134
|
const expressionText = expression.getText();
|
|
@@ -256723,7 +257137,7 @@ function transformTypeReferences2(sourceFile) {
|
|
|
256723
257137
|
}
|
|
256724
257138
|
}
|
|
256725
257139
|
}
|
|
256726
|
-
function
|
|
257140
|
+
function transformImports6(sourceFile, facadePackage) {
|
|
256727
257141
|
const buttonImportsToAdd = [];
|
|
256728
257142
|
const importDeclarations = sourceFile.getImportDeclarations().slice();
|
|
256729
257143
|
const elementsTargetSpecifier = "@reapit/elements/core/button";
|
|
@@ -256841,10 +257255,10 @@ function getDeprecatedButtonAliases(sourceFile, facadePackage) {
|
|
|
256841
257255
|
}
|
|
256842
257256
|
return aliases;
|
|
256843
257257
|
}
|
|
256844
|
-
function
|
|
257258
|
+
function transformJsxElements3(sourceFile, aliases) {
|
|
256845
257259
|
const jsxElements = [
|
|
256846
|
-
...sourceFile.getDescendantsOfKind(
|
|
256847
|
-
...sourceFile.getDescendantsOfKind(
|
|
257260
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph9.SyntaxKind.JsxOpeningElement),
|
|
257261
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph9.SyntaxKind.JsxSelfClosingElement)
|
|
256848
257262
|
];
|
|
256849
257263
|
for (const element of jsxElements) {
|
|
256850
257264
|
const tagName = element.getTagNameNode();
|
|
@@ -256863,10 +257277,10 @@ function transformJsxElements2(sourceFile, aliases) {
|
|
|
256863
257277
|
let loadingValue;
|
|
256864
257278
|
let sizeValue;
|
|
256865
257279
|
for (const attr of attributes) {
|
|
256866
|
-
if (attr.getKind() !==
|
|
257280
|
+
if (attr.getKind() !== import_ts_morph9.SyntaxKind.JsxAttribute) {
|
|
256867
257281
|
continue;
|
|
256868
257282
|
}
|
|
256869
|
-
const jsxAttr = attr.asKind(
|
|
257283
|
+
const jsxAttr = attr.asKind(import_ts_morph9.SyntaxKind.JsxAttribute);
|
|
256870
257284
|
const name = jsxAttr.getNameNode().getText();
|
|
256871
257285
|
if (name === "href") {
|
|
256872
257286
|
hasHref = true;
|
|
@@ -256904,10 +257318,10 @@ function transformJsxElements2(sourceFile, aliases) {
|
|
|
256904
257318
|
}
|
|
256905
257319
|
}
|
|
256906
257320
|
for (const attr of attributes.slice()) {
|
|
256907
|
-
if (attr.getKind() !==
|
|
257321
|
+
if (attr.getKind() !== import_ts_morph9.SyntaxKind.JsxAttribute) {
|
|
256908
257322
|
continue;
|
|
256909
257323
|
}
|
|
256910
|
-
const jsxAttr = attr.asKind(
|
|
257324
|
+
const jsxAttr = attr.asKind(import_ts_morph9.SyntaxKind.JsxAttribute);
|
|
256911
257325
|
const name = jsxAttr.getNameNode().getText();
|
|
256912
257326
|
if (name === "intent") {
|
|
256913
257327
|
if (variantValue) {
|
|
@@ -256922,17 +257336,17 @@ function transformJsxElements2(sourceFile, aliases) {
|
|
|
256922
257336
|
const init = jsxAttr.getInitializer();
|
|
256923
257337
|
if (init) {
|
|
256924
257338
|
const kind = init.getKind();
|
|
256925
|
-
if (kind ===
|
|
256926
|
-
const stringLiteral = init.asKind(
|
|
257339
|
+
if (kind === import_ts_morph9.SyntaxKind.StringLiteral) {
|
|
257340
|
+
const stringLiteral = init.asKind(import_ts_morph9.SyntaxKind.StringLiteral);
|
|
256927
257341
|
if (stringLiteral) {
|
|
256928
257342
|
stringLiteral.setLiteralValue("secondary");
|
|
256929
257343
|
}
|
|
256930
|
-
} else if (kind ===
|
|
256931
|
-
const jsxExpr = init.asKind(
|
|
257344
|
+
} else if (kind === import_ts_morph9.SyntaxKind.JsxExpression) {
|
|
257345
|
+
const jsxExpr = init.asKind(import_ts_morph9.SyntaxKind.JsxExpression);
|
|
256932
257346
|
if (jsxExpr) {
|
|
256933
257347
|
const expression = jsxExpr.getExpression();
|
|
256934
|
-
if (expression && expression.getKind() ===
|
|
256935
|
-
const stringLiteral = expression.asKind(
|
|
257348
|
+
if (expression && expression.getKind() === import_ts_morph9.SyntaxKind.StringLiteral) {
|
|
257349
|
+
const stringLiteral = expression.asKind(import_ts_morph9.SyntaxKind.StringLiteral);
|
|
256936
257350
|
if (stringLiteral) {
|
|
256937
257351
|
stringLiteral.setLiteralValue("secondary");
|
|
256938
257352
|
}
|
|
@@ -256944,17 +257358,17 @@ function transformJsxElements2(sourceFile, aliases) {
|
|
|
256944
257358
|
const init = jsxAttr.getInitializer();
|
|
256945
257359
|
if (init) {
|
|
256946
257360
|
const kind = init.getKind();
|
|
256947
|
-
if (kind ===
|
|
256948
|
-
const stringLiteral = init.asKind(
|
|
257361
|
+
if (kind === import_ts_morph9.SyntaxKind.StringLiteral) {
|
|
257362
|
+
const stringLiteral = init.asKind(import_ts_morph9.SyntaxKind.StringLiteral);
|
|
256949
257363
|
if (stringLiteral) {
|
|
256950
257364
|
stringLiteral.setLiteralValue("primary");
|
|
256951
257365
|
}
|
|
256952
|
-
} else if (kind ===
|
|
256953
|
-
const jsxExpr = init.asKind(
|
|
257366
|
+
} else if (kind === import_ts_morph9.SyntaxKind.JsxExpression) {
|
|
257367
|
+
const jsxExpr = init.asKind(import_ts_morph9.SyntaxKind.JsxExpression);
|
|
256954
257368
|
if (jsxExpr) {
|
|
256955
257369
|
const expression = jsxExpr.getExpression();
|
|
256956
|
-
if (expression && expression.getKind() ===
|
|
256957
|
-
const stringLiteral = expression.asKind(
|
|
257370
|
+
if (expression && expression.getKind() === import_ts_morph9.SyntaxKind.StringLiteral) {
|
|
257371
|
+
const stringLiteral = expression.asKind(import_ts_morph9.SyntaxKind.StringLiteral);
|
|
256958
257372
|
if (stringLiteral) {
|
|
256959
257373
|
stringLiteral.setLiteralValue("primary");
|
|
256960
257374
|
}
|
|
@@ -256975,10 +257389,10 @@ function transformJsxElements2(sourceFile, aliases) {
|
|
|
256975
257389
|
let shouldRemove = false;
|
|
256976
257390
|
if (init) {
|
|
256977
257391
|
const kind = init.getKind();
|
|
256978
|
-
if (kind ===
|
|
256979
|
-
const jsxExpr = init.asKind(
|
|
257392
|
+
if (kind === import_ts_morph9.SyntaxKind.JsxExpression) {
|
|
257393
|
+
const jsxExpr = init.asKind(import_ts_morph9.SyntaxKind.JsxExpression);
|
|
256980
257394
|
const expression = jsxExpr?.getExpression();
|
|
256981
|
-
if (expression?.getKind() ===
|
|
257395
|
+
if (expression?.getKind() === import_ts_morph9.SyntaxKind.FalseKeyword) {
|
|
256982
257396
|
shouldRemove = true;
|
|
256983
257397
|
}
|
|
256984
257398
|
}
|
|
@@ -256995,8 +257409,8 @@ function transformJsxElements2(sourceFile, aliases) {
|
|
|
256995
257409
|
}
|
|
256996
257410
|
} else if (name === "size" && sizeValue) {
|
|
256997
257411
|
const init = jsxAttr.getInitializer();
|
|
256998
|
-
if (init && init.getKind() ===
|
|
256999
|
-
const jsxExpr = init.asKind(
|
|
257412
|
+
if (init && init.getKind() === import_ts_morph9.SyntaxKind.JsxExpression) {
|
|
257413
|
+
const jsxExpr = init.asKind(import_ts_morph9.SyntaxKind.JsxExpression);
|
|
257000
257414
|
if (jsxExpr) {
|
|
257001
257415
|
const expression = jsxExpr.getExpression();
|
|
257002
257416
|
if (expression) {
|
|
@@ -257042,10 +257456,10 @@ function transformJsxElements2(sourceFile, aliases) {
|
|
|
257042
257456
|
}
|
|
257043
257457
|
}
|
|
257044
257458
|
}
|
|
257045
|
-
if (element.getKind() ===
|
|
257459
|
+
if (element.getKind() === import_ts_morph9.SyntaxKind.JsxOpeningElement) {
|
|
257046
257460
|
const parent = element.getParent();
|
|
257047
|
-
if (parent && parent.getKind() ===
|
|
257048
|
-
const closingElement = parent.asKind(
|
|
257461
|
+
if (parent && parent.getKind() === import_ts_morph9.SyntaxKind.JsxElement) {
|
|
257462
|
+
const closingElement = parent.asKind(import_ts_morph9.SyntaxKind.JsxElement)?.getClosingElement();
|
|
257049
257463
|
if (closingElement) {
|
|
257050
257464
|
const closingTagName = closingElement.getTagNameNode();
|
|
257051
257465
|
if (closingTagName.getText() === "DeprecatedButton") {
|
|
@@ -257058,19 +257472,19 @@ function transformJsxElements2(sourceFile, aliases) {
|
|
|
257058
257472
|
}
|
|
257059
257473
|
function extractStringOrExpressionValue(init) {
|
|
257060
257474
|
const kind = init.getKind();
|
|
257061
|
-
if (kind ===
|
|
257062
|
-
const stringLiteral = init.asKind(
|
|
257475
|
+
if (kind === import_ts_morph9.SyntaxKind.StringLiteral) {
|
|
257476
|
+
const stringLiteral = init.asKind(import_ts_morph9.SyntaxKind.StringLiteral);
|
|
257063
257477
|
if (stringLiteral) {
|
|
257064
257478
|
return stringLiteral.getLiteralText();
|
|
257065
257479
|
}
|
|
257066
|
-
} else if (kind ===
|
|
257067
|
-
const jsxExpr = init.asKind(
|
|
257480
|
+
} else if (kind === import_ts_morph9.SyntaxKind.JsxExpression) {
|
|
257481
|
+
const jsxExpr = init.asKind(import_ts_morph9.SyntaxKind.JsxExpression);
|
|
257068
257482
|
if (jsxExpr) {
|
|
257069
257483
|
const expression = jsxExpr.getExpression();
|
|
257070
257484
|
if (expression) {
|
|
257071
257485
|
const exprKind = expression.getKind();
|
|
257072
|
-
if (exprKind ===
|
|
257073
|
-
const stringLiteral = expression.asKind(
|
|
257486
|
+
if (exprKind === import_ts_morph9.SyntaxKind.StringLiteral) {
|
|
257487
|
+
const stringLiteral = expression.asKind(import_ts_morph9.SyntaxKind.StringLiteral);
|
|
257074
257488
|
if (stringLiteral) {
|
|
257075
257489
|
return stringLiteral.getLiteralText();
|
|
257076
257490
|
}
|
|
@@ -257082,61 +257496,61 @@ function extractStringOrExpressionValue(init) {
|
|
|
257082
257496
|
}
|
|
257083
257497
|
return void 0;
|
|
257084
257498
|
}
|
|
257085
|
-
function
|
|
257499
|
+
function transform10(source, filePath = "file.tsx", options) {
|
|
257086
257500
|
if (!source.includes("DeprecatedButton")) {
|
|
257087
257501
|
return source;
|
|
257088
257502
|
}
|
|
257089
|
-
const project = new
|
|
257503
|
+
const project = new import_ts_morph9.Project({
|
|
257090
257504
|
useInMemoryFileSystem: true,
|
|
257091
257505
|
compilerOptions: {
|
|
257092
257506
|
jsx: 2
|
|
257093
257507
|
// JsxEmit.React
|
|
257094
257508
|
},
|
|
257095
257509
|
manipulationSettings: {
|
|
257096
|
-
quoteKind:
|
|
257510
|
+
quoteKind: import_ts_morph9.QuoteKind.Single
|
|
257097
257511
|
}
|
|
257098
257512
|
});
|
|
257099
257513
|
const sourceFile = project.createSourceFile(filePath, source);
|
|
257100
257514
|
const deprecatedButtonAliases = getDeprecatedButtonAliases(sourceFile, options?.facadePackage);
|
|
257101
|
-
|
|
257102
|
-
|
|
257103
|
-
|
|
257515
|
+
transformImports6(sourceFile, options?.facadePackage);
|
|
257516
|
+
transformTypeReferences3(sourceFile);
|
|
257517
|
+
transformJsxElements3(sourceFile, deprecatedButtonAliases);
|
|
257104
257518
|
return sourceFile.getFullText();
|
|
257105
257519
|
}
|
|
257106
|
-
var
|
|
257107
|
-
var
|
|
257520
|
+
var import_ts_morph9;
|
|
257521
|
+
var init_transform10 = __esm({
|
|
257108
257522
|
"codemods/upgrade-deprecated-button/transform.ts"() {
|
|
257109
257523
|
"use strict";
|
|
257110
|
-
|
|
257524
|
+
import_ts_morph9 = __toESM(require_ts_morph(), 1);
|
|
257111
257525
|
init_elements_import();
|
|
257112
257526
|
__name(usesDeprecatedIconInJsx, "usesDeprecatedIconInJsx");
|
|
257113
257527
|
__name(hasDeprecatedIconImport, "hasDeprecatedIconImport");
|
|
257114
257528
|
__name(addDeprecatedIconImportIfNeeded, "addDeprecatedIconImportIfNeeded");
|
|
257115
|
-
__name(
|
|
257116
|
-
__name(
|
|
257529
|
+
__name(transformTypeReferences3, "transformTypeReferences");
|
|
257530
|
+
__name(transformImports6, "transformImports");
|
|
257117
257531
|
__name(getDeprecatedButtonAliases, "getDeprecatedButtonAliases");
|
|
257118
|
-
__name(
|
|
257532
|
+
__name(transformJsxElements3, "transformJsxElements");
|
|
257119
257533
|
__name(extractStringOrExpressionValue, "extractStringOrExpressionValue");
|
|
257120
|
-
__name(
|
|
257534
|
+
__name(transform10, "transform");
|
|
257121
257535
|
}
|
|
257122
257536
|
});
|
|
257123
257537
|
|
|
257124
257538
|
// codemods/upgrade-deprecated-button-group/transform.ts
|
|
257125
|
-
var
|
|
257126
|
-
__export(
|
|
257127
|
-
default: () =>
|
|
257539
|
+
var transform_exports11 = {};
|
|
257540
|
+
__export(transform_exports11, {
|
|
257541
|
+
default: () => transform11
|
|
257128
257542
|
});
|
|
257129
257543
|
function shouldUseJsxComment(element) {
|
|
257130
257544
|
let parent = element.getParent();
|
|
257131
257545
|
while (parent) {
|
|
257132
257546
|
const kind = parent.getKind();
|
|
257133
|
-
if (kind ===
|
|
257547
|
+
if (kind === import_ts_morph10.SyntaxKind.JsxElement || kind === import_ts_morph10.SyntaxKind.JsxFragment) {
|
|
257134
257548
|
return true;
|
|
257135
257549
|
}
|
|
257136
|
-
if (kind ===
|
|
257550
|
+
if (kind === import_ts_morph10.SyntaxKind.JsxExpression) {
|
|
257137
257551
|
return false;
|
|
257138
257552
|
}
|
|
257139
|
-
if (kind ===
|
|
257553
|
+
if (kind === import_ts_morph10.SyntaxKind.PropertyAssignment || kind === import_ts_morph10.SyntaxKind.ArrayLiteralExpression || kind === import_ts_morph10.SyntaxKind.VariableDeclaration || kind === import_ts_morph10.SyntaxKind.CallExpression || kind === import_ts_morph10.SyntaxKind.ReturnStatement || kind === import_ts_morph10.SyntaxKind.ArrowFunction) {
|
|
257140
257554
|
return false;
|
|
257141
257555
|
}
|
|
257142
257556
|
parent = parent.getParent();
|
|
@@ -257159,7 +257573,7 @@ function getDeprecatedButtonGroupAliases(sourceFile, facadePackage) {
|
|
|
257159
257573
|
}
|
|
257160
257574
|
return aliases;
|
|
257161
257575
|
}
|
|
257162
|
-
function
|
|
257576
|
+
function transformImports7(sourceFile, facadePackage) {
|
|
257163
257577
|
const importsToAdd = [];
|
|
257164
257578
|
const targetModuleSpecifier = facadePackage ?? "@reapit/elements/core/button-group";
|
|
257165
257579
|
const alreadyMigratedPath = facadePackage ? null : "@reapit/elements/core/button-group";
|
|
@@ -257224,16 +257638,16 @@ function transformImports6(sourceFile, facadePackage) {
|
|
|
257224
257638
|
}
|
|
257225
257639
|
return resolvedLocalName;
|
|
257226
257640
|
}
|
|
257227
|
-
function
|
|
257641
|
+
function transformTypeReferences4(sourceFile) {
|
|
257228
257642
|
let rewrote = false;
|
|
257229
|
-
for (const typeRef of sourceFile.getDescendantsOfKind(
|
|
257643
|
+
for (const typeRef of sourceFile.getDescendantsOfKind(import_ts_morph10.SyntaxKind.TypeReference)) {
|
|
257230
257644
|
const typeName = typeRef.getTypeName();
|
|
257231
257645
|
if (typeName.getText() === "DeprecatedButtonGroupProps") {
|
|
257232
257646
|
typeName.replaceWithText("ButtonGroup.Props");
|
|
257233
257647
|
rewrote = true;
|
|
257234
257648
|
}
|
|
257235
257649
|
}
|
|
257236
|
-
for (const heritage of sourceFile.getDescendantsOfKind(
|
|
257650
|
+
for (const heritage of sourceFile.getDescendantsOfKind(import_ts_morph10.SyntaxKind.ExpressionWithTypeArguments)) {
|
|
257237
257651
|
const expression = heritage.getExpression();
|
|
257238
257652
|
if (expression.getText() === "DeprecatedButtonGroupProps") {
|
|
257239
257653
|
expression.replaceWithText("ButtonGroup.Props");
|
|
@@ -257242,10 +257656,10 @@ function transformTypeReferences3(sourceFile) {
|
|
|
257242
257656
|
}
|
|
257243
257657
|
return rewrote;
|
|
257244
257658
|
}
|
|
257245
|
-
function
|
|
257659
|
+
function transformJsxElements4(sourceFile, aliases) {
|
|
257246
257660
|
const commentInsertions = [];
|
|
257247
|
-
const openingElements = sourceFile.getDescendantsOfKind(
|
|
257248
|
-
const selfClosingElements = sourceFile.getDescendantsOfKind(
|
|
257661
|
+
const openingElements = sourceFile.getDescendantsOfKind(import_ts_morph10.SyntaxKind.JsxOpeningElement).slice();
|
|
257662
|
+
const selfClosingElements = sourceFile.getDescendantsOfKind(import_ts_morph10.SyntaxKind.JsxSelfClosingElement).slice();
|
|
257249
257663
|
for (const element of selfClosingElements) {
|
|
257250
257664
|
if (element.wasForgotten()) continue;
|
|
257251
257665
|
const tagName = element.getTagNameNode();
|
|
@@ -257264,13 +257678,12 @@ function transformJsxElements3(sourceFile, aliases, localName) {
|
|
|
257264
257678
|
}
|
|
257265
257679
|
transformAlignmentProp(element, commentInsertions);
|
|
257266
257680
|
const parent = element.getParent();
|
|
257267
|
-
if (parent?.getKind() ===
|
|
257268
|
-
const jsxElement = parent.asKind(
|
|
257681
|
+
if (parent?.getKind() === import_ts_morph10.SyntaxKind.JsxElement) {
|
|
257682
|
+
const jsxElement = parent.asKind(import_ts_morph10.SyntaxKind.JsxElement);
|
|
257269
257683
|
const closingTag = jsxElement.getClosingElement();
|
|
257270
257684
|
if (closingTag.getTagNameNode().getText() === "DeprecatedButtonGroup") {
|
|
257271
257685
|
closingTag.getTagNameNode().replaceWithText("ButtonGroup");
|
|
257272
257686
|
}
|
|
257273
|
-
wrapChildren(jsxElement, commentInsertions, localName);
|
|
257274
257687
|
}
|
|
257275
257688
|
}
|
|
257276
257689
|
const sorted = commentInsertions.sort((a, b) => b.pos - a.pos);
|
|
@@ -257280,22 +257693,22 @@ function transformJsxElements3(sourceFile, aliases, localName) {
|
|
|
257280
257693
|
}
|
|
257281
257694
|
}
|
|
257282
257695
|
function transformAlignmentProp(element, commentInsertions) {
|
|
257283
|
-
const jsxElement = element.asKind(
|
|
257696
|
+
const jsxElement = element.asKind(import_ts_morph10.SyntaxKind.JsxOpeningElement) ?? element.asKind(import_ts_morph10.SyntaxKind.JsxSelfClosingElement);
|
|
257284
257697
|
if (!jsxElement) return;
|
|
257285
257698
|
const alignmentAttr = jsxElement.getAttribute("alignment");
|
|
257286
257699
|
if (!alignmentAttr) return;
|
|
257287
|
-
const jsxAttr = alignmentAttr.asKind(
|
|
257700
|
+
const jsxAttr = alignmentAttr.asKind(import_ts_morph10.SyntaxKind.JsxAttribute);
|
|
257288
257701
|
if (!jsxAttr) return;
|
|
257289
257702
|
const init = jsxAttr.getInitializer();
|
|
257290
257703
|
let staticValue;
|
|
257291
257704
|
if (!init) {
|
|
257292
257705
|
staticValue = void 0;
|
|
257293
|
-
} else if (init.getKind() ===
|
|
257294
|
-
staticValue = init.asKind(
|
|
257295
|
-
} else if (init.getKind() ===
|
|
257296
|
-
const expr = init.asKind(
|
|
257297
|
-
if (expr?.getKind() ===
|
|
257298
|
-
staticValue = expr.asKind(
|
|
257706
|
+
} else if (init.getKind() === import_ts_morph10.SyntaxKind.StringLiteral) {
|
|
257707
|
+
staticValue = init.asKind(import_ts_morph10.SyntaxKind.StringLiteral).getLiteralText();
|
|
257708
|
+
} else if (init.getKind() === import_ts_morph10.SyntaxKind.JsxExpression) {
|
|
257709
|
+
const expr = init.asKind(import_ts_morph10.SyntaxKind.JsxExpression).getExpression();
|
|
257710
|
+
if (expr?.getKind() === import_ts_morph10.SyntaxKind.StringLiteral) {
|
|
257711
|
+
staticValue = expr.asKind(import_ts_morph10.SyntaxKind.StringLiteral).getLiteralText();
|
|
257299
257712
|
}
|
|
257300
257713
|
}
|
|
257301
257714
|
const mappedValue = staticValue !== void 0 ? ALIGNMENT_TO_JUSTIFY_CONTENT[staticValue] : void 0;
|
|
@@ -257305,48 +257718,28 @@ function transformAlignmentProp(element, commentInsertions) {
|
|
|
257305
257718
|
} else {
|
|
257306
257719
|
const useJsx = shouldUseJsxComment(jsxElement);
|
|
257307
257720
|
const todoText = useJsx ? TODO_DYNAMIC_ALIGNMENT_JSX : TODO_DYNAMIC_ALIGNMENT_JS;
|
|
257308
|
-
const elementStart = jsxElement.getParent()?.getKind() ===
|
|
257721
|
+
const elementStart = jsxElement.getParent()?.getKind() === import_ts_morph10.SyntaxKind.JsxElement ? jsxElement.getParent().getStart() : jsxElement.getStart();
|
|
257309
257722
|
jsxAttr.remove();
|
|
257310
257723
|
commentInsertions.push({ pos: elementStart, text: todoText });
|
|
257311
257724
|
}
|
|
257312
257725
|
}
|
|
257313
|
-
function
|
|
257314
|
-
const itemTag = `${localName}.Item`;
|
|
257315
|
-
const children = jsxElement.getJsxChildren();
|
|
257316
|
-
for (const child of children) {
|
|
257317
|
-
const kind = child.getKind();
|
|
257318
|
-
if (kind === import_ts_morph8.SyntaxKind.JsxText) {
|
|
257319
|
-
continue;
|
|
257320
|
-
}
|
|
257321
|
-
if (kind === import_ts_morph8.SyntaxKind.JsxElement || kind === import_ts_morph8.SyntaxKind.JsxSelfClosingElement) {
|
|
257322
|
-
const tagText = kind === import_ts_morph8.SyntaxKind.JsxElement ? child.asKind(import_ts_morph8.SyntaxKind.JsxElement).getOpeningElement().getTagNameNode().getText() : child.asKind(import_ts_morph8.SyntaxKind.JsxSelfClosingElement).getTagNameNode().getText();
|
|
257323
|
-
if (tagText === itemTag) continue;
|
|
257324
|
-
const childText = child.getText();
|
|
257325
|
-
child.replaceWithText(`<${itemTag}>${childText}</${itemTag}>`);
|
|
257326
|
-
continue;
|
|
257327
|
-
}
|
|
257328
|
-
if (kind === import_ts_morph8.SyntaxKind.JsxExpression) {
|
|
257329
|
-
commentInsertions.push({ pos: child.getStart(), text: TODO_DYNAMIC_CHILDREN });
|
|
257330
|
-
}
|
|
257331
|
-
}
|
|
257332
|
-
}
|
|
257333
|
-
function transform9(source, filePath = "file.tsx", options) {
|
|
257726
|
+
function transform11(source, filePath = "file.tsx", options) {
|
|
257334
257727
|
if (!source.includes("DeprecatedButtonGroup")) return source;
|
|
257335
|
-
const project = new
|
|
257728
|
+
const project = new import_ts_morph10.Project({
|
|
257336
257729
|
useInMemoryFileSystem: true,
|
|
257337
257730
|
compilerOptions: {
|
|
257338
257731
|
jsx: 2
|
|
257339
257732
|
// JsxEmit.React
|
|
257340
257733
|
},
|
|
257341
257734
|
manipulationSettings: {
|
|
257342
|
-
quoteKind:
|
|
257735
|
+
quoteKind: import_ts_morph10.QuoteKind.Single
|
|
257343
257736
|
}
|
|
257344
257737
|
});
|
|
257345
257738
|
const sourceFile = project.createSourceFile(filePath, source);
|
|
257346
257739
|
const facadePackage = options?.facadePackage;
|
|
257347
257740
|
const aliases = getDeprecatedButtonGroupAliases(sourceFile, facadePackage);
|
|
257348
|
-
const importLocalName =
|
|
257349
|
-
const typeRewriteOccurred =
|
|
257741
|
+
const importLocalName = transformImports7(sourceFile, facadePackage);
|
|
257742
|
+
const typeRewriteOccurred = transformTypeReferences4(sourceFile);
|
|
257350
257743
|
if (typeRewriteOccurred && importLocalName === null) {
|
|
257351
257744
|
const targetModuleSpecifier = facadePackage ?? "@reapit/elements/core/button-group";
|
|
257352
257745
|
let targetImportDecl = sourceFile.getImportDeclarations().find((d) => d.getModuleSpecifierValue() === targetModuleSpecifier);
|
|
@@ -257358,15 +257751,14 @@ function transform9(source, filePath = "file.tsx", options) {
|
|
|
257358
257751
|
targetImportDecl.addNamedImport({ name: "ButtonGroup", isTypeOnly: true });
|
|
257359
257752
|
}
|
|
257360
257753
|
}
|
|
257361
|
-
|
|
257362
|
-
transformJsxElements3(sourceFile, aliases, localName);
|
|
257754
|
+
transformJsxElements4(sourceFile, aliases);
|
|
257363
257755
|
return sourceFile.getFullText();
|
|
257364
257756
|
}
|
|
257365
|
-
var
|
|
257366
|
-
var
|
|
257757
|
+
var import_ts_morph10, ALIGNMENT_TO_JUSTIFY_CONTENT, TODO_DYNAMIC_ALIGNMENT_JSX, TODO_DYNAMIC_ALIGNMENT_JS, IMPORTS_TO_REMOVE2;
|
|
257758
|
+
var init_transform11 = __esm({
|
|
257367
257759
|
"codemods/upgrade-deprecated-button-group/transform.ts"() {
|
|
257368
257760
|
"use strict";
|
|
257369
|
-
|
|
257761
|
+
import_ts_morph10 = __toESM(require_ts_morph(), 1);
|
|
257370
257762
|
init_elements_import();
|
|
257371
257763
|
ALIGNMENT_TO_JUSTIFY_CONTENT = {
|
|
257372
257764
|
left: "start",
|
|
@@ -257375,23 +257767,21 @@ var init_transform9 = __esm({
|
|
|
257375
257767
|
};
|
|
257376
257768
|
TODO_DYNAMIC_ALIGNMENT_JSX = "{/* TODO: DeprecatedButtonGroup had a dynamic alignment prop that cannot be migrated automatically */}";
|
|
257377
257769
|
TODO_DYNAMIC_ALIGNMENT_JS = "// TODO: DeprecatedButtonGroup had a dynamic alignment prop that cannot be migrated automatically";
|
|
257378
|
-
TODO_DYNAMIC_CHILDREN = "{/* TODO: wrap each button in this expression in <ButtonGroup.Item> manually */}";
|
|
257379
257770
|
__name(shouldUseJsxComment, "shouldUseJsxComment");
|
|
257380
257771
|
__name(getDeprecatedButtonGroupAliases, "getDeprecatedButtonGroupAliases");
|
|
257381
257772
|
IMPORTS_TO_REMOVE2 = /* @__PURE__ */ new Set(["DeprecatedButtonGroupProps", "DeprecatedButtonGroupAlignment"]);
|
|
257382
|
-
__name(
|
|
257383
|
-
__name(
|
|
257384
|
-
__name(
|
|
257773
|
+
__name(transformImports7, "transformImports");
|
|
257774
|
+
__name(transformTypeReferences4, "transformTypeReferences");
|
|
257775
|
+
__name(transformJsxElements4, "transformJsxElements");
|
|
257385
257776
|
__name(transformAlignmentProp, "transformAlignmentProp");
|
|
257386
|
-
__name(
|
|
257387
|
-
__name(transform9, "transform");
|
|
257777
|
+
__name(transform11, "transform");
|
|
257388
257778
|
}
|
|
257389
257779
|
});
|
|
257390
257780
|
|
|
257391
257781
|
// codemods/upgrade-deprecated-icon/transform.ts
|
|
257392
|
-
var
|
|
257393
|
-
__export(
|
|
257394
|
-
default: () =>
|
|
257782
|
+
var transform_exports12 = {};
|
|
257783
|
+
__export(transform_exports12, {
|
|
257784
|
+
default: () => transform12
|
|
257395
257785
|
});
|
|
257396
257786
|
function getDeprecatedIconAlias(sourceFile, facadePackage) {
|
|
257397
257787
|
const importDeclarations = sourceFile.getImportDeclarations();
|
|
@@ -257413,8 +257803,8 @@ function getDeprecatedIconAlias(sourceFile, facadePackage) {
|
|
|
257413
257803
|
function collectIconUsages(sourceFile, deprecatedIconAlias) {
|
|
257414
257804
|
const iconUsages = /* @__PURE__ */ new Map();
|
|
257415
257805
|
const jsxElements = [
|
|
257416
|
-
...sourceFile.getDescendantsOfKind(
|
|
257417
|
-
...sourceFile.getDescendantsOfKind(
|
|
257806
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph11.SyntaxKind.JsxOpeningElement),
|
|
257807
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph11.SyntaxKind.JsxSelfClosingElement)
|
|
257418
257808
|
];
|
|
257419
257809
|
const validTagNames = ["DeprecatedIcon"];
|
|
257420
257810
|
if (deprecatedIconAlias) {
|
|
@@ -257425,8 +257815,8 @@ function collectIconUsages(sourceFile, deprecatedIconAlias) {
|
|
|
257425
257815
|
if (!validTagNames.includes(tagName)) continue;
|
|
257426
257816
|
const attributes = element.getAttributes();
|
|
257427
257817
|
for (const attr of attributes) {
|
|
257428
|
-
if (attr.getKind() !==
|
|
257429
|
-
const jsxAttr = attr.asKind(
|
|
257818
|
+
if (attr.getKind() !== import_ts_morph11.SyntaxKind.JsxAttribute) continue;
|
|
257819
|
+
const jsxAttr = attr.asKind(import_ts_morph11.SyntaxKind.JsxAttribute);
|
|
257430
257820
|
const name = jsxAttr.getNameNode().getText();
|
|
257431
257821
|
if (name === "icon") {
|
|
257432
257822
|
const init = jsxAttr.getInitializer();
|
|
@@ -257490,15 +257880,15 @@ function mapIntentToColor(intent) {
|
|
|
257490
257880
|
}
|
|
257491
257881
|
function extractStringLiteral(initializer) {
|
|
257492
257882
|
const kind = initializer.getKind();
|
|
257493
|
-
if (kind ===
|
|
257494
|
-
return initializer.asKind(
|
|
257883
|
+
if (kind === import_ts_morph11.SyntaxKind.StringLiteral) {
|
|
257884
|
+
return initializer.asKind(import_ts_morph11.SyntaxKind.StringLiteral)?.getLiteralText() ?? null;
|
|
257495
257885
|
}
|
|
257496
|
-
if (kind ===
|
|
257497
|
-
const jsxExpr = initializer.asKind(
|
|
257886
|
+
if (kind === import_ts_morph11.SyntaxKind.JsxExpression) {
|
|
257887
|
+
const jsxExpr = initializer.asKind(import_ts_morph11.SyntaxKind.JsxExpression);
|
|
257498
257888
|
if (jsxExpr) {
|
|
257499
257889
|
const expression = jsxExpr.getExpression();
|
|
257500
|
-
if (expression && expression.getKind() ===
|
|
257501
|
-
return expression.asKind(
|
|
257890
|
+
if (expression && expression.getKind() === import_ts_morph11.SyntaxKind.StringLiteral) {
|
|
257891
|
+
return expression.asKind(import_ts_morph11.SyntaxKind.StringLiteral)?.getLiteralText() ?? null;
|
|
257502
257892
|
}
|
|
257503
257893
|
}
|
|
257504
257894
|
}
|
|
@@ -257542,11 +257932,11 @@ function removeUnusedDeprecatedIconImport(sourceFile, deprecatedIconAlias, facad
|
|
|
257542
257932
|
const deprecatedIconImport = namedImports.find((namedImport) => namedImport.getName() === "DeprecatedIcon");
|
|
257543
257933
|
if (deprecatedIconImport) {
|
|
257544
257934
|
const importedName = deprecatedIconImport.getAliasNode()?.getText() || deprecatedIconImport.getName();
|
|
257545
|
-
const allIdentifiers = sourceFile.getDescendantsOfKind(
|
|
257935
|
+
const allIdentifiers = sourceFile.getDescendantsOfKind(import_ts_morph11.SyntaxKind.Identifier);
|
|
257546
257936
|
const references = allIdentifiers.filter((id) => id.getText() === importedName);
|
|
257547
257937
|
const usages = references.filter((ref) => {
|
|
257548
257938
|
const parent = ref.getParent();
|
|
257549
|
-
return parent?.getKind() !==
|
|
257939
|
+
return parent?.getKind() !== import_ts_morph11.SyntaxKind.ImportSpecifier;
|
|
257550
257940
|
});
|
|
257551
257941
|
if (usages.length === 0) {
|
|
257552
257942
|
deprecatedIconImport.remove();
|
|
@@ -257556,15 +257946,15 @@ function removeUnusedDeprecatedIconImport(sourceFile, deprecatedIconAlias, facad
|
|
|
257556
257946
|
} else {
|
|
257557
257947
|
const allJsxUsages = usages.every((ref) => {
|
|
257558
257948
|
const parent = ref.getParent();
|
|
257559
|
-
return parent?.getKind() ===
|
|
257949
|
+
return parent?.getKind() === import_ts_morph11.SyntaxKind.JsxOpeningElement || parent?.getKind() === import_ts_morph11.SyntaxKind.JsxSelfClosingElement || parent?.getKind() === import_ts_morph11.SyntaxKind.JsxClosingElement;
|
|
257560
257950
|
});
|
|
257561
257951
|
if (allJsxUsages) {
|
|
257562
257952
|
const validTagNames2 = ["DeprecatedIcon"];
|
|
257563
257953
|
if (deprecatedIconAlias) {
|
|
257564
257954
|
validTagNames2.push(deprecatedIconAlias);
|
|
257565
257955
|
}
|
|
257566
|
-
const selfClosingElements = sourceFile.getDescendantsOfKind(
|
|
257567
|
-
const openingElements = sourceFile.getDescendantsOfKind(
|
|
257956
|
+
const selfClosingElements = sourceFile.getDescendantsOfKind(import_ts_morph11.SyntaxKind.JsxSelfClosingElement);
|
|
257957
|
+
const openingElements = sourceFile.getDescendantsOfKind(import_ts_morph11.SyntaxKind.JsxOpeningElement);
|
|
257568
257958
|
const stillUsedInJsx = [...selfClosingElements, ...openingElements].some(
|
|
257569
257959
|
(element) => validTagNames2.includes(element.getTagNameNode().getText())
|
|
257570
257960
|
);
|
|
@@ -257579,10 +257969,10 @@ function removeUnusedDeprecatedIconImport(sourceFile, deprecatedIconAlias, facad
|
|
|
257579
257969
|
}
|
|
257580
257970
|
}
|
|
257581
257971
|
}
|
|
257582
|
-
function
|
|
257972
|
+
function transformJsxElements5(sourceFile, iconUsages, deprecatedIconAlias) {
|
|
257583
257973
|
const jsxElements = [
|
|
257584
|
-
...sourceFile.getDescendantsOfKind(
|
|
257585
|
-
...sourceFile.getDescendantsOfKind(
|
|
257974
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph11.SyntaxKind.JsxSelfClosingElement),
|
|
257975
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph11.SyntaxKind.JsxOpeningElement)
|
|
257586
257976
|
];
|
|
257587
257977
|
const validTagNames = ["DeprecatedIcon"];
|
|
257588
257978
|
if (deprecatedIconAlias) {
|
|
@@ -257600,8 +257990,8 @@ function transformJsxElements4(sourceFile, iconUsages, deprecatedIconAlias) {
|
|
|
257600
257990
|
const propsToRemove = [];
|
|
257601
257991
|
const propsToPreserve = /* @__PURE__ */ new Map();
|
|
257602
257992
|
for (const attr of attributes) {
|
|
257603
|
-
if (attr.getKind() !==
|
|
257604
|
-
const jsxAttr = attr.asKind(
|
|
257993
|
+
if (attr.getKind() !== import_ts_morph11.SyntaxKind.JsxAttribute) continue;
|
|
257994
|
+
const jsxAttr = attr.asKind(import_ts_morph11.SyntaxKind.JsxAttribute);
|
|
257605
257995
|
const name = jsxAttr.getNameNode().getText();
|
|
257606
257996
|
const init = jsxAttr.getInitializer();
|
|
257607
257997
|
if (name === "icon") {
|
|
@@ -257719,14 +258109,14 @@ function transformJsxElements4(sourceFile, iconUsages, deprecatedIconAlias) {
|
|
|
257719
258109
|
if (needsStyleMerge) {
|
|
257720
258110
|
const existingStyleAttr = propsToPreserve.get("style");
|
|
257721
258111
|
if (existingStyleAttr) {
|
|
257722
|
-
const existingInit = existingStyleAttr.asKind(
|
|
257723
|
-
if (existingInit && existingInit.getKind() ===
|
|
257724
|
-
const jsxExpr = existingInit.asKind(
|
|
258112
|
+
const existingInit = existingStyleAttr.asKind(import_ts_morph11.SyntaxKind.JsxAttribute)?.getInitializer();
|
|
258113
|
+
if (existingInit && existingInit.getKind() === import_ts_morph11.SyntaxKind.JsxExpression) {
|
|
258114
|
+
const jsxExpr = existingInit.asKind(import_ts_morph11.SyntaxKind.JsxExpression);
|
|
257725
258115
|
const expression = jsxExpr?.getExpression();
|
|
257726
258116
|
if (expression) {
|
|
257727
258117
|
const existingStyleText = expression.getText();
|
|
257728
258118
|
const mergedStyle = `{{ ...${existingStyleText}, ${stylesToMerge.join(", ")} }}`;
|
|
257729
|
-
existingStyleAttr.asKind(
|
|
258119
|
+
existingStyleAttr.asKind(import_ts_morph11.SyntaxKind.JsxAttribute)?.setInitializer(mergedStyle);
|
|
257730
258120
|
const useJsxComment = shouldUseJsxComment2(element);
|
|
257731
258121
|
if (!todosNeeded.has(componentName)) {
|
|
257732
258122
|
todosNeeded.set(componentName, /* @__PURE__ */ new Set());
|
|
@@ -257746,10 +258136,10 @@ function transformJsxElements4(sourceFile, iconUsages, deprecatedIconAlias) {
|
|
|
257746
258136
|
todosNeeded.get(componentName).add(commentText);
|
|
257747
258137
|
}
|
|
257748
258138
|
}
|
|
257749
|
-
if (element.getKind() ===
|
|
258139
|
+
if (element.getKind() === import_ts_morph11.SyntaxKind.JsxOpeningElement) {
|
|
257750
258140
|
const parent = element.getParent();
|
|
257751
|
-
if (parent && parent.getKind() ===
|
|
257752
|
-
const closingElement = parent.asKind(
|
|
258141
|
+
if (parent && parent.getKind() === import_ts_morph11.SyntaxKind.JsxElement) {
|
|
258142
|
+
const closingElement = parent.asKind(import_ts_morph11.SyntaxKind.JsxElement)?.getClosingElement();
|
|
257753
258143
|
if (closingElement) {
|
|
257754
258144
|
const closingTagName = closingElement.getTagNameNode();
|
|
257755
258145
|
const closingTagNameText = closingTagName.getText();
|
|
@@ -257791,13 +258181,13 @@ function shouldUseJsxComment2(element) {
|
|
|
257791
258181
|
let parent = element.getParent();
|
|
257792
258182
|
while (parent) {
|
|
257793
258183
|
const kind = parent.getKind();
|
|
257794
|
-
if (kind ===
|
|
258184
|
+
if (kind === import_ts_morph11.SyntaxKind.JsxElement || kind === import_ts_morph11.SyntaxKind.JsxFragment) {
|
|
257795
258185
|
return true;
|
|
257796
258186
|
}
|
|
257797
|
-
if (kind ===
|
|
258187
|
+
if (kind === import_ts_morph11.SyntaxKind.JsxExpression) {
|
|
257798
258188
|
return false;
|
|
257799
258189
|
}
|
|
257800
|
-
if (kind ===
|
|
258190
|
+
if (kind === import_ts_morph11.SyntaxKind.PropertyAssignment || kind === import_ts_morph11.SyntaxKind.ArrayLiteralExpression || kind === import_ts_morph11.SyntaxKind.VariableDeclaration || kind === import_ts_morph11.SyntaxKind.CallExpression || kind === import_ts_morph11.SyntaxKind.ReturnStatement || kind === import_ts_morph11.SyntaxKind.ArrowFunction) {
|
|
257801
258191
|
return false;
|
|
257802
258192
|
}
|
|
257803
258193
|
parent = parent.getParent();
|
|
@@ -257806,8 +258196,8 @@ function shouldUseJsxComment2(element) {
|
|
|
257806
258196
|
}
|
|
257807
258197
|
function collectDeprecatedIconTodoInsertions(sourceFile, alias) {
|
|
257808
258198
|
const jsxElements = [
|
|
257809
|
-
...sourceFile.getDescendantsOfKind(
|
|
257810
|
-
...sourceFile.getDescendantsOfKind(
|
|
258199
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph11.SyntaxKind.JsxSelfClosingElement),
|
|
258200
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph11.SyntaxKind.JsxOpeningElement)
|
|
257811
258201
|
];
|
|
257812
258202
|
const elementsNeedingComments = [];
|
|
257813
258203
|
for (const element of jsxElements) {
|
|
@@ -257818,8 +258208,8 @@ function collectDeprecatedIconTodoInsertions(sourceFile, alias) {
|
|
|
257818
258208
|
let iconValue = null;
|
|
257819
258209
|
let hasIconProp = false;
|
|
257820
258210
|
for (const attr of attributes) {
|
|
257821
|
-
if (attr.getKind() !==
|
|
257822
|
-
const jsxAttr = attr.asKind(
|
|
258211
|
+
if (attr.getKind() !== import_ts_morph11.SyntaxKind.JsxAttribute) continue;
|
|
258212
|
+
const jsxAttr = attr.asKind(import_ts_morph11.SyntaxKind.JsxAttribute);
|
|
257823
258213
|
const name = jsxAttr.getNameNode().getText();
|
|
257824
258214
|
if (name === "icon") {
|
|
257825
258215
|
hasIconProp = true;
|
|
@@ -257859,11 +258249,11 @@ function collectNonJsxUsageTodoInsertions(sourceFile) {
|
|
|
257859
258249
|
const deprecatedIconImport = sourceFile.getImportDeclarations().flatMap((imp) => imp.getNamedImports()).find((named) => named.getName() === "DeprecatedIcon");
|
|
257860
258250
|
if (!deprecatedIconImport) return [];
|
|
257861
258251
|
const actualName = deprecatedIconImport.getAliasNode()?.getText() || deprecatedIconImport.getName();
|
|
257862
|
-
const allIdentifiers = sourceFile.getDescendantsOfKind(
|
|
258252
|
+
const allIdentifiers = sourceFile.getDescendantsOfKind(import_ts_morph11.SyntaxKind.Identifier);
|
|
257863
258253
|
const references = allIdentifiers.filter((id) => id.getText() === actualName);
|
|
257864
258254
|
const nonJsxUsages = references.filter((ref) => {
|
|
257865
258255
|
const parent = ref.getParent();
|
|
257866
|
-
return parent?.getKind() !==
|
|
258256
|
+
return parent?.getKind() !== import_ts_morph11.SyntaxKind.ImportSpecifier && parent?.getKind() !== import_ts_morph11.SyntaxKind.JsxOpeningElement && parent?.getKind() !== import_ts_morph11.SyntaxKind.JsxSelfClosingElement && parent?.getKind() !== import_ts_morph11.SyntaxKind.JsxClosingElement;
|
|
257867
258257
|
});
|
|
257868
258258
|
const message = "TODO: DeprecatedIcon used as value - needs manual migration";
|
|
257869
258259
|
return nonJsxUsages.map((usage) => ({
|
|
@@ -257885,25 +258275,25 @@ function applyInsertions(output, insertions) {
|
|
|
257885
258275
|
}
|
|
257886
258276
|
return result;
|
|
257887
258277
|
}
|
|
257888
|
-
function
|
|
258278
|
+
function transform12(source, filePath = "file.tsx", options) {
|
|
257889
258279
|
if (!source.includes("DeprecatedIcon")) {
|
|
257890
258280
|
return source;
|
|
257891
258281
|
}
|
|
257892
|
-
const project = new
|
|
258282
|
+
const project = new import_ts_morph11.Project({
|
|
257893
258283
|
useInMemoryFileSystem: true,
|
|
257894
258284
|
compilerOptions: {
|
|
257895
258285
|
jsx: 2
|
|
257896
258286
|
// JsxEmit.React
|
|
257897
258287
|
},
|
|
257898
258288
|
manipulationSettings: {
|
|
257899
|
-
quoteKind:
|
|
258289
|
+
quoteKind: import_ts_morph11.QuoteKind.Single
|
|
257900
258290
|
}
|
|
257901
258291
|
});
|
|
257902
258292
|
const sourceFile = project.createSourceFile(filePath, source);
|
|
257903
258293
|
const alias = getDeprecatedIconAlias(sourceFile, options?.facadePackage);
|
|
257904
258294
|
const iconUsages = collectIconUsages(sourceFile, alias);
|
|
257905
258295
|
addIconImports(sourceFile, iconUsages, options?.facadePackage);
|
|
257906
|
-
const todosNeeded =
|
|
258296
|
+
const todosNeeded = transformJsxElements5(sourceFile, iconUsages, alias);
|
|
257907
258297
|
removeUnusedDeprecatedIconImport(sourceFile, alias, options?.facadePackage);
|
|
257908
258298
|
let output = sourceFile.getFullText();
|
|
257909
258299
|
const deprecatedIconInsertions = collectDeprecatedIconTodoInsertions(sourceFile, alias);
|
|
@@ -257915,11 +258305,11 @@ function transform10(source, filePath = "file.tsx", options) {
|
|
|
257915
258305
|
}
|
|
257916
258306
|
return output;
|
|
257917
258307
|
}
|
|
257918
|
-
var
|
|
257919
|
-
var
|
|
258308
|
+
var import_ts_morph11;
|
|
258309
|
+
var init_transform12 = __esm({
|
|
257920
258310
|
"codemods/upgrade-deprecated-icon/transform.ts"() {
|
|
257921
258311
|
"use strict";
|
|
257922
|
-
|
|
258312
|
+
import_ts_morph11 = __toESM(require_ts_morph(), 1);
|
|
257923
258313
|
init_elements_import();
|
|
257924
258314
|
__name(getDeprecatedIconAlias, "getDeprecatedIconAlias");
|
|
257925
258315
|
__name(collectIconUsages, "collectIconUsages");
|
|
@@ -257931,20 +258321,20 @@ var init_transform10 = __esm({
|
|
|
257931
258321
|
__name(camelToKebab, "camelToKebab");
|
|
257932
258322
|
__name(addIconImports, "addIconImports");
|
|
257933
258323
|
__name(removeUnusedDeprecatedIconImport, "removeUnusedDeprecatedIconImport");
|
|
257934
|
-
__name(
|
|
258324
|
+
__name(transformJsxElements5, "transformJsxElements");
|
|
257935
258325
|
__name(addTodoComments, "addTodoComments");
|
|
257936
258326
|
__name(shouldUseJsxComment2, "shouldUseJsxComment");
|
|
257937
258327
|
__name(collectDeprecatedIconTodoInsertions, "collectDeprecatedIconTodoInsertions");
|
|
257938
258328
|
__name(collectNonJsxUsageTodoInsertions, "collectNonJsxUsageTodoInsertions");
|
|
257939
258329
|
__name(applyInsertions, "applyInsertions");
|
|
257940
|
-
__name(
|
|
258330
|
+
__name(transform12, "transform");
|
|
257941
258331
|
}
|
|
257942
258332
|
});
|
|
257943
258333
|
|
|
257944
258334
|
// codemods/upgrade-deprecated-split-button/transform.ts
|
|
257945
|
-
var
|
|
257946
|
-
__export(
|
|
257947
|
-
default: () =>
|
|
258335
|
+
var transform_exports13 = {};
|
|
258336
|
+
__export(transform_exports13, {
|
|
258337
|
+
default: () => transform13
|
|
257948
258338
|
});
|
|
257949
258339
|
function getDeprecatedAliasMap(sourceFile, facadePackage) {
|
|
257950
258340
|
const aliasMap = /* @__PURE__ */ new Map();
|
|
@@ -257968,7 +258358,7 @@ function getDeprecatedAliasMap(sourceFile, facadePackage) {
|
|
|
257968
258358
|
}
|
|
257969
258359
|
return aliasMap;
|
|
257970
258360
|
}
|
|
257971
|
-
function
|
|
258361
|
+
function transformImports8(sourceFile, facadePackage) {
|
|
257972
258362
|
const elementsImportsToAdd = [];
|
|
257973
258363
|
const importDeclarations = sourceFile.getImportDeclarations().slice();
|
|
257974
258364
|
const targetModuleSpecifier = "@reapit/elements/core/split-button";
|
|
@@ -258043,15 +258433,15 @@ function transformImports7(sourceFile, facadePackage) {
|
|
|
258043
258433
|
}
|
|
258044
258434
|
}
|
|
258045
258435
|
}
|
|
258046
|
-
function
|
|
258047
|
-
const typeReferences = sourceFile.getDescendantsOfKind(
|
|
258436
|
+
function transformTypeReferences5(sourceFile) {
|
|
258437
|
+
const typeReferences = sourceFile.getDescendantsOfKind(import_ts_morph12.SyntaxKind.TypeReference);
|
|
258048
258438
|
for (const typeRef of typeReferences) {
|
|
258049
258439
|
const typeName = typeRef.getTypeName();
|
|
258050
258440
|
if (typeName.getText() === "DeprecatedSplitButtonProps") {
|
|
258051
258441
|
typeName.replaceWithText("SplitButton.Props");
|
|
258052
258442
|
}
|
|
258053
258443
|
}
|
|
258054
|
-
const heritageExpressions = sourceFile.getDescendantsOfKind(
|
|
258444
|
+
const heritageExpressions = sourceFile.getDescendantsOfKind(import_ts_morph12.SyntaxKind.ExpressionWithTypeArguments);
|
|
258055
258445
|
for (const heritage of heritageExpressions) {
|
|
258056
258446
|
const expression = heritage.getExpression();
|
|
258057
258447
|
if (expression.getText() === "DeprecatedSplitButtonProps") {
|
|
@@ -258059,30 +258449,30 @@ function transformTypeReferences4(sourceFile) {
|
|
|
258059
258449
|
}
|
|
258060
258450
|
}
|
|
258061
258451
|
}
|
|
258062
|
-
function
|
|
258452
|
+
function transformJsxElements6(sourceFile, aliasMap) {
|
|
258063
258453
|
const todoLines = /* @__PURE__ */ new Set();
|
|
258064
258454
|
const jsxElements = [
|
|
258065
|
-
...sourceFile.getDescendantsOfKind(
|
|
258066
|
-
...sourceFile.getDescendantsOfKind(
|
|
258455
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph12.SyntaxKind.JsxOpeningElement),
|
|
258456
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph12.SyntaxKind.JsxSelfClosingElement)
|
|
258067
258457
|
];
|
|
258068
258458
|
for (const element of jsxElements) {
|
|
258069
258459
|
const tagNameNode = element.getTagNameNode();
|
|
258070
258460
|
const tagNameText = tagNameNode.getText();
|
|
258071
|
-
if (tagNameNode.getKind() ===
|
|
258072
|
-
const propAccess = tagNameNode.asKind(
|
|
258461
|
+
if (tagNameNode.getKind() === import_ts_morph12.SyntaxKind.PropertyAccessExpression) {
|
|
258462
|
+
const propAccess = tagNameNode.asKind(import_ts_morph12.SyntaxKind.PropertyAccessExpression);
|
|
258073
258463
|
const objectText = propAccess.getExpression().getText();
|
|
258074
258464
|
const originalName2 = aliasMap.get(objectText);
|
|
258075
258465
|
if (originalName2 === "DeprecatedSplitButton" && objectText === "DeprecatedSplitButton") {
|
|
258076
258466
|
propAccess.getExpression().replaceWithText("SplitButton");
|
|
258077
258467
|
}
|
|
258078
|
-
if (element.getKind() ===
|
|
258468
|
+
if (element.getKind() === import_ts_morph12.SyntaxKind.JsxOpeningElement) {
|
|
258079
258469
|
const parent = element.getParent();
|
|
258080
|
-
if (parent?.getKind() ===
|
|
258081
|
-
const closingElement = parent.asKind(
|
|
258470
|
+
if (parent?.getKind() === import_ts_morph12.SyntaxKind.JsxElement) {
|
|
258471
|
+
const closingElement = parent.asKind(import_ts_morph12.SyntaxKind.JsxElement)?.getClosingElement();
|
|
258082
258472
|
if (closingElement) {
|
|
258083
258473
|
const closingTag = closingElement.getTagNameNode();
|
|
258084
|
-
if (closingTag.getKind() ===
|
|
258085
|
-
const closingPropAccess = closingTag.asKind(
|
|
258474
|
+
if (closingTag.getKind() === import_ts_morph12.SyntaxKind.PropertyAccessExpression) {
|
|
258475
|
+
const closingPropAccess = closingTag.asKind(import_ts_morph12.SyntaxKind.PropertyAccessExpression);
|
|
258086
258476
|
const closingObjectText = closingPropAccess.getExpression().getText();
|
|
258087
258477
|
if (closingObjectText === "DeprecatedSplitButton") {
|
|
258088
258478
|
closingPropAccess.getExpression().replaceWithText("SplitButton");
|
|
@@ -258100,13 +258490,13 @@ function transformJsxElements5(sourceFile, aliasMap) {
|
|
|
258100
258490
|
if (tagNameText !== originalName) continue;
|
|
258101
258491
|
tagNameNode.replaceWithText(newName);
|
|
258102
258492
|
if (originalName === "DeprecatedSplitButton") {
|
|
258103
|
-
const containingNode = element.getKind() ===
|
|
258493
|
+
const containingNode = element.getKind() === import_ts_morph12.SyntaxKind.JsxOpeningElement ? element.getParent() : element;
|
|
258104
258494
|
todoLines.add(containingNode.getStartLineNumber());
|
|
258105
258495
|
}
|
|
258106
|
-
if (element.getKind() ===
|
|
258496
|
+
if (element.getKind() === import_ts_morph12.SyntaxKind.JsxOpeningElement) {
|
|
258107
258497
|
const parent = element.getParent();
|
|
258108
|
-
if (parent?.getKind() ===
|
|
258109
|
-
const closingElement = parent.asKind(
|
|
258498
|
+
if (parent?.getKind() === import_ts_morph12.SyntaxKind.JsxElement) {
|
|
258499
|
+
const closingElement = parent.asKind(import_ts_morph12.SyntaxKind.JsxElement)?.getClosingElement();
|
|
258110
258500
|
if (closingElement) {
|
|
258111
258501
|
const closingTagName = closingElement.getTagNameNode();
|
|
258112
258502
|
if (closingTagName.getText() === originalName) {
|
|
@@ -258133,34 +258523,34 @@ function insertTodoComments(text, todoLines) {
|
|
|
258133
258523
|
}
|
|
258134
258524
|
return lines.join("\n");
|
|
258135
258525
|
}
|
|
258136
|
-
function
|
|
258526
|
+
function transform13(source, filePath = "file.tsx", options) {
|
|
258137
258527
|
if (!source.includes("DeprecatedSplitButton") && !source.includes("DeprecatedActionButton") && !source.includes("DeprecatedMenuButton") && !source.includes("DeprecatedSplitButtonProps")) {
|
|
258138
258528
|
return source;
|
|
258139
258529
|
}
|
|
258140
|
-
const project = new
|
|
258530
|
+
const project = new import_ts_morph12.Project({
|
|
258141
258531
|
useInMemoryFileSystem: true,
|
|
258142
258532
|
compilerOptions: {
|
|
258143
258533
|
jsx: 2
|
|
258144
258534
|
// JsxEmit.React
|
|
258145
258535
|
},
|
|
258146
258536
|
manipulationSettings: {
|
|
258147
|
-
quoteKind:
|
|
258537
|
+
quoteKind: import_ts_morph12.QuoteKind.Single
|
|
258148
258538
|
}
|
|
258149
258539
|
});
|
|
258150
258540
|
const sourceFile = project.createSourceFile(filePath, source);
|
|
258151
258541
|
const aliasMap = getDeprecatedAliasMap(sourceFile, options?.facadePackage);
|
|
258152
|
-
|
|
258153
|
-
|
|
258154
|
-
const todoLines =
|
|
258542
|
+
transformImports8(sourceFile, options?.facadePackage);
|
|
258543
|
+
transformTypeReferences5(sourceFile);
|
|
258544
|
+
const todoLines = transformJsxElements6(sourceFile, aliasMap);
|
|
258155
258545
|
let result = sourceFile.getFullText();
|
|
258156
258546
|
result = insertTodoComments(result, todoLines);
|
|
258157
258547
|
return result;
|
|
258158
258548
|
}
|
|
258159
|
-
var
|
|
258160
|
-
var
|
|
258549
|
+
var import_ts_morph12, IDENTIFIER_MAP, TODO_COMMENT2;
|
|
258550
|
+
var init_transform13 = __esm({
|
|
258161
258551
|
"codemods/upgrade-deprecated-split-button/transform.ts"() {
|
|
258162
258552
|
"use strict";
|
|
258163
|
-
|
|
258553
|
+
import_ts_morph12 = __toESM(require_ts_morph(), 1);
|
|
258164
258554
|
init_elements_import();
|
|
258165
258555
|
IDENTIFIER_MAP = {
|
|
258166
258556
|
DeprecatedSplitButton: "SplitButton",
|
|
@@ -258173,18 +258563,18 @@ var init_transform11 = __esm({
|
|
|
258173
258563
|
// \`variant="busy"\` on sub-components maps to \`busy="action"\` or \`busy="menu-item"\` on the parent.
|
|
258174
258564
|
// <SplitButton.Menu> now requires \`aria-label\` and children (menu items).`;
|
|
258175
258565
|
__name(getDeprecatedAliasMap, "getDeprecatedAliasMap");
|
|
258176
|
-
__name(
|
|
258177
|
-
__name(
|
|
258178
|
-
__name(
|
|
258566
|
+
__name(transformImports8, "transformImports");
|
|
258567
|
+
__name(transformTypeReferences5, "transformTypeReferences");
|
|
258568
|
+
__name(transformJsxElements6, "transformJsxElements");
|
|
258179
258569
|
__name(insertTodoComments, "insertTodoComments");
|
|
258180
|
-
__name(
|
|
258570
|
+
__name(transform13, "transform");
|
|
258181
258571
|
}
|
|
258182
258572
|
});
|
|
258183
258573
|
|
|
258184
258574
|
// codemods/upgrade-deprecated-tag/transform.ts
|
|
258185
|
-
var
|
|
258186
|
-
__export(
|
|
258187
|
-
default: () =>
|
|
258575
|
+
var transform_exports14 = {};
|
|
258576
|
+
__export(transform_exports14, {
|
|
258577
|
+
default: () => transform14
|
|
258188
258578
|
});
|
|
258189
258579
|
function getDeprecatedTagAliases(sourceFile, facadePackage) {
|
|
258190
258580
|
const aliases = /* @__PURE__ */ new Set();
|
|
@@ -258218,7 +258608,7 @@ function getDeprecatedTagGroupAliases(sourceFile, facadePackage) {
|
|
|
258218
258608
|
}
|
|
258219
258609
|
return aliases;
|
|
258220
258610
|
}
|
|
258221
|
-
function
|
|
258611
|
+
function resolveTargetSpecifier2(sourceSpecifier, canonicalSubpath, facadePackage) {
|
|
258222
258612
|
if (facadePackage && matchesPackage(sourceSpecifier, facadePackage)) {
|
|
258223
258613
|
return sourceSpecifier;
|
|
258224
258614
|
}
|
|
@@ -258227,18 +258617,18 @@ function resolveTargetSpecifier(sourceSpecifier, canonicalSubpath, facadePackage
|
|
|
258227
258617
|
function isInsideTagGroup(element, tagGroupAliases) {
|
|
258228
258618
|
const kind = element.getKind();
|
|
258229
258619
|
let current;
|
|
258230
|
-
if (kind ===
|
|
258620
|
+
if (kind === import_ts_morph13.SyntaxKind.JsxOpeningElement) {
|
|
258231
258621
|
const tagElement = element.getParent();
|
|
258232
|
-
if (!tagElement || tagElement.getKind() !==
|
|
258622
|
+
if (!tagElement || tagElement.getKind() !== import_ts_morph13.SyntaxKind.JsxElement) return false;
|
|
258233
258623
|
current = tagElement.getParent();
|
|
258234
|
-
} else if (kind ===
|
|
258624
|
+
} else if (kind === import_ts_morph13.SyntaxKind.JsxSelfClosingElement) {
|
|
258235
258625
|
current = element.getParent();
|
|
258236
258626
|
} else {
|
|
258237
258627
|
return false;
|
|
258238
258628
|
}
|
|
258239
258629
|
while (current) {
|
|
258240
|
-
if (current.getKind() ===
|
|
258241
|
-
const jsxElement = current.asKind(
|
|
258630
|
+
if (current.getKind() === import_ts_morph13.SyntaxKind.JsxElement) {
|
|
258631
|
+
const jsxElement = current.asKind(import_ts_morph13.SyntaxKind.JsxElement);
|
|
258242
258632
|
if (!jsxElement) return false;
|
|
258243
258633
|
const openingTag = jsxElement.getOpeningElement();
|
|
258244
258634
|
const tagName = openingTag.getTagNameNode().getText();
|
|
@@ -258252,20 +258642,20 @@ function isInsideTagGroup(element, tagGroupAliases) {
|
|
|
258252
258642
|
}
|
|
258253
258643
|
function hasStandaloneTagUsage(sourceFile, tagAliases, tagGroupAliases) {
|
|
258254
258644
|
const elements = [
|
|
258255
|
-
...sourceFile.getDescendantsOfKind(
|
|
258256
|
-
...sourceFile.getDescendantsOfKind(
|
|
258645
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph13.SyntaxKind.JsxOpeningElement),
|
|
258646
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph13.SyntaxKind.JsxSelfClosingElement)
|
|
258257
258647
|
];
|
|
258258
258648
|
for (const element of elements) {
|
|
258259
258649
|
const tagName = element.getTagNameNode().getText();
|
|
258260
258650
|
if (!tagAliases.has(tagName)) continue;
|
|
258261
258651
|
if (!isInsideTagGroup(element, tagGroupAliases)) return true;
|
|
258262
258652
|
}
|
|
258263
|
-
for (const identifier of sourceFile.getDescendantsOfKind(
|
|
258653
|
+
for (const identifier of sourceFile.getDescendantsOfKind(import_ts_morph13.SyntaxKind.Identifier)) {
|
|
258264
258654
|
if (!tagAliases.has(identifier.getText())) continue;
|
|
258265
258655
|
const parent = identifier.getParent();
|
|
258266
258656
|
if (!parent) continue;
|
|
258267
258657
|
const parentKind = parent.getKind();
|
|
258268
|
-
if (parentKind ===
|
|
258658
|
+
if (parentKind === import_ts_morph13.SyntaxKind.ImportSpecifier || parentKind === import_ts_morph13.SyntaxKind.ExportSpecifier || parentKind === import_ts_morph13.SyntaxKind.JsxOpeningElement || parentKind === import_ts_morph13.SyntaxKind.JsxSelfClosingElement || parentKind === import_ts_morph13.SyntaxKind.JsxClosingElement)
|
|
258269
258659
|
continue;
|
|
258270
258660
|
return true;
|
|
258271
258661
|
}
|
|
@@ -258273,22 +258663,22 @@ function hasStandaloneTagUsage(sourceFile, tagAliases, tagGroupAliases) {
|
|
|
258273
258663
|
}
|
|
258274
258664
|
function hasTagGroupUsage(sourceFile, tagGroupAliases) {
|
|
258275
258665
|
const elements = [
|
|
258276
|
-
...sourceFile.getDescendantsOfKind(
|
|
258277
|
-
...sourceFile.getDescendantsOfKind(
|
|
258666
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph13.SyntaxKind.JsxOpeningElement),
|
|
258667
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph13.SyntaxKind.JsxSelfClosingElement)
|
|
258278
258668
|
];
|
|
258279
258669
|
if (elements.some((element) => tagGroupAliases.has(element.getTagNameNode().getText()))) return true;
|
|
258280
|
-
for (const identifier of sourceFile.getDescendantsOfKind(
|
|
258670
|
+
for (const identifier of sourceFile.getDescendantsOfKind(import_ts_morph13.SyntaxKind.Identifier)) {
|
|
258281
258671
|
if (!tagGroupAliases.has(identifier.getText())) continue;
|
|
258282
258672
|
const parent = identifier.getParent();
|
|
258283
258673
|
if (!parent) continue;
|
|
258284
258674
|
const parentKind = parent.getKind();
|
|
258285
|
-
if (parentKind ===
|
|
258675
|
+
if (parentKind === import_ts_morph13.SyntaxKind.ImportSpecifier || parentKind === import_ts_morph13.SyntaxKind.ExportSpecifier || parentKind === import_ts_morph13.SyntaxKind.JsxOpeningElement || parentKind === import_ts_morph13.SyntaxKind.JsxSelfClosingElement || parentKind === import_ts_morph13.SyntaxKind.JsxClosingElement)
|
|
258286
258676
|
continue;
|
|
258287
258677
|
return true;
|
|
258288
258678
|
}
|
|
258289
258679
|
return false;
|
|
258290
258680
|
}
|
|
258291
|
-
function
|
|
258681
|
+
function transformImports9(sourceFile, needsTagImport, needsTagGroupImport, facadePackage) {
|
|
258292
258682
|
const tagImportsToAdd = [];
|
|
258293
258683
|
const tagGroupImportsToAdd = [];
|
|
258294
258684
|
const alreadyMigratedTagPath = facadePackage ? null : "@reapit/elements/core/tag";
|
|
@@ -258310,7 +258700,7 @@ function transformImports8(sourceFile, needsTagImport, needsTagGroupImport, faca
|
|
|
258310
258700
|
name: "Tag",
|
|
258311
258701
|
alias: namedImport.getAliasNode()?.getText(),
|
|
258312
258702
|
isTypeOnly: namedImport.isTypeOnly(),
|
|
258313
|
-
targetSpecifier:
|
|
258703
|
+
targetSpecifier: resolveTargetSpecifier2(moduleSpecifier, "@reapit/elements/core/tag", facadePackage)
|
|
258314
258704
|
});
|
|
258315
258705
|
}
|
|
258316
258706
|
importsToRemove.push(namedImport);
|
|
@@ -258322,7 +258712,7 @@ function transformImports8(sourceFile, needsTagImport, needsTagGroupImport, faca
|
|
|
258322
258712
|
name: "TagGroup",
|
|
258323
258713
|
alias: namedImport.getAliasNode()?.getText(),
|
|
258324
258714
|
isTypeOnly: namedImport.isTypeOnly(),
|
|
258325
|
-
targetSpecifier:
|
|
258715
|
+
targetSpecifier: resolveTargetSpecifier2(moduleSpecifier, "@reapit/elements/core/tag-group", facadePackage)
|
|
258326
258716
|
});
|
|
258327
258717
|
}
|
|
258328
258718
|
importsToRemove.push(namedImport);
|
|
@@ -258358,7 +258748,7 @@ function transformImports8(sourceFile, needsTagImport, needsTagGroupImport, faca
|
|
|
258358
258748
|
tagBySpecifier.set(targetSpecifier, group);
|
|
258359
258749
|
}
|
|
258360
258750
|
for (const [specifier, entries] of tagBySpecifier) {
|
|
258361
|
-
|
|
258751
|
+
addImportsToTarget2(sourceFile, entries, specifier);
|
|
258362
258752
|
}
|
|
258363
258753
|
const tagGroupBySpecifier = /* @__PURE__ */ new Map();
|
|
258364
258754
|
for (const { targetSpecifier, ...entry } of tagGroupImportsToAdd) {
|
|
@@ -258367,10 +258757,10 @@ function transformImports8(sourceFile, needsTagImport, needsTagGroupImport, faca
|
|
|
258367
258757
|
tagGroupBySpecifier.set(targetSpecifier, group);
|
|
258368
258758
|
}
|
|
258369
258759
|
for (const [specifier, entries] of tagGroupBySpecifier) {
|
|
258370
|
-
|
|
258760
|
+
addImportsToTarget2(sourceFile, entries, specifier);
|
|
258371
258761
|
}
|
|
258372
258762
|
}
|
|
258373
|
-
function
|
|
258763
|
+
function addImportsToTarget2(sourceFile, importsToAdd, targetModuleSpecifier) {
|
|
258374
258764
|
if (importsToAdd.length === 0) return;
|
|
258375
258765
|
const currentImportDeclarations = sourceFile.getImportDeclarations();
|
|
258376
258766
|
let targetDecl = currentImportDeclarations.find(
|
|
@@ -258401,31 +258791,31 @@ function addImportsToTarget(sourceFile, importsToAdd, targetModuleSpecifier) {
|
|
|
258401
258791
|
}
|
|
258402
258792
|
}
|
|
258403
258793
|
}
|
|
258404
|
-
function
|
|
258794
|
+
function transformIdentifierReferences2(sourceFile) {
|
|
258405
258795
|
const rewrites = /* @__PURE__ */ new Map([
|
|
258406
258796
|
["DeprecatedTag", "Tag"],
|
|
258407
258797
|
["DeprecatedTagGroup", "TagGroup"]
|
|
258408
258798
|
]);
|
|
258409
|
-
for (const identifier of sourceFile.getDescendantsOfKind(
|
|
258799
|
+
for (const identifier of sourceFile.getDescendantsOfKind(import_ts_morph13.SyntaxKind.Identifier)) {
|
|
258410
258800
|
const text = identifier.getText();
|
|
258411
258801
|
const replacement = rewrites.get(text);
|
|
258412
258802
|
if (!replacement) continue;
|
|
258413
258803
|
const parent = identifier.getParent();
|
|
258414
258804
|
if (!parent) continue;
|
|
258415
258805
|
const parentKind = parent.getKind();
|
|
258416
|
-
if (parentKind ===
|
|
258806
|
+
if (parentKind === import_ts_morph13.SyntaxKind.ImportSpecifier || parentKind === import_ts_morph13.SyntaxKind.ExportSpecifier || parentKind === import_ts_morph13.SyntaxKind.JsxOpeningElement || parentKind === import_ts_morph13.SyntaxKind.JsxSelfClosingElement || parentKind === import_ts_morph13.SyntaxKind.JsxClosingElement)
|
|
258417
258807
|
continue;
|
|
258418
258808
|
identifier.replaceWithText(replacement);
|
|
258419
258809
|
}
|
|
258420
258810
|
}
|
|
258421
|
-
function
|
|
258422
|
-
for (const typeRef of sourceFile.getDescendantsOfKind(
|
|
258811
|
+
function transformTypeReferences6(sourceFile) {
|
|
258812
|
+
for (const typeRef of sourceFile.getDescendantsOfKind(import_ts_morph13.SyntaxKind.TypeReference)) {
|
|
258423
258813
|
const typeName = typeRef.getTypeName();
|
|
258424
258814
|
if (typeName.getText() === "DeprecatedTagProps") {
|
|
258425
258815
|
typeName.replaceWithText("Tag.Props");
|
|
258426
258816
|
}
|
|
258427
258817
|
}
|
|
258428
|
-
for (const heritage of sourceFile.getDescendantsOfKind(
|
|
258818
|
+
for (const heritage of sourceFile.getDescendantsOfKind(import_ts_morph13.SyntaxKind.ExpressionWithTypeArguments)) {
|
|
258429
258819
|
const expression = heritage.getExpression();
|
|
258430
258820
|
if (expression.getText() === "DeprecatedTagProps") {
|
|
258431
258821
|
expression.replaceWithText("Tag.Props");
|
|
@@ -258436,8 +258826,8 @@ function processIntentProp(element) {
|
|
|
258436
258826
|
const attributes = element.getAttributes();
|
|
258437
258827
|
let hasIntentAttr = false;
|
|
258438
258828
|
for (const attr of attributes.slice()) {
|
|
258439
|
-
if (attr.getKind() !==
|
|
258440
|
-
const jsxAttr = attr.asKind(
|
|
258829
|
+
if (attr.getKind() !== import_ts_morph13.SyntaxKind.JsxAttribute) continue;
|
|
258830
|
+
const jsxAttr = attr.asKind(import_ts_morph13.SyntaxKind.JsxAttribute);
|
|
258441
258831
|
const name = jsxAttr.getNameNode().getText();
|
|
258442
258832
|
if (name === "intent") {
|
|
258443
258833
|
hasIntentAttr = true;
|
|
@@ -258449,8 +258839,8 @@ function processIntentProp(element) {
|
|
|
258449
258839
|
function transformTagElements(sourceFile, tagAliases, tagGroupAliases) {
|
|
258450
258840
|
const commentInsertions = [];
|
|
258451
258841
|
const elements = [
|
|
258452
|
-
...sourceFile.getDescendantsOfKind(
|
|
258453
|
-
...sourceFile.getDescendantsOfKind(
|
|
258842
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph13.SyntaxKind.JsxOpeningElement),
|
|
258843
|
+
...sourceFile.getDescendantsOfKind(import_ts_morph13.SyntaxKind.JsxSelfClosingElement)
|
|
258454
258844
|
];
|
|
258455
258845
|
for (const element of elements) {
|
|
258456
258846
|
const tagName = element.getTagNameNode();
|
|
@@ -258474,10 +258864,10 @@ function transformTagElements(sourceFile, tagAliases, tagGroupAliases) {
|
|
|
258474
258864
|
if (hadIntent) {
|
|
258475
258865
|
comments.push(INTENT_REMOVED_TODO);
|
|
258476
258866
|
}
|
|
258477
|
-
if (element.getKind() ===
|
|
258867
|
+
if (element.getKind() === import_ts_morph13.SyntaxKind.JsxOpeningElement) {
|
|
258478
258868
|
const parent = element.getParent();
|
|
258479
|
-
if (parent?.getKind() ===
|
|
258480
|
-
const closingTag = parent.asKind(
|
|
258869
|
+
if (parent?.getKind() === import_ts_morph13.SyntaxKind.JsxElement) {
|
|
258870
|
+
const closingTag = parent.asKind(import_ts_morph13.SyntaxKind.JsxElement)?.getClosingElement();
|
|
258481
258871
|
if (closingTag) {
|
|
258482
258872
|
const closingTagName = closingTag.getTagNameNode().getText();
|
|
258483
258873
|
if (closingTagName === "DeprecatedTag") {
|
|
@@ -258488,7 +258878,7 @@ function transformTagElements(sourceFile, tagAliases, tagGroupAliases) {
|
|
|
258488
258878
|
commentInsertions.push({ position: parent.getStart(), comments });
|
|
258489
258879
|
}
|
|
258490
258880
|
}
|
|
258491
|
-
} else if (element.getKind() ===
|
|
258881
|
+
} else if (element.getKind() === import_ts_morph13.SyntaxKind.JsxSelfClosingElement) {
|
|
258492
258882
|
if (comments.length > 0) {
|
|
258493
258883
|
commentInsertions.push({ position: element.getStart(), comments });
|
|
258494
258884
|
}
|
|
@@ -258502,38 +258892,38 @@ function transformTagElements(sourceFile, tagAliases, tagGroupAliases) {
|
|
|
258502
258892
|
}
|
|
258503
258893
|
}
|
|
258504
258894
|
function transformTagGroupElements(sourceFile, aliases) {
|
|
258505
|
-
for (const element of sourceFile.getDescendantsOfKind(
|
|
258895
|
+
for (const element of sourceFile.getDescendantsOfKind(import_ts_morph13.SyntaxKind.JsxSelfClosingElement)) {
|
|
258506
258896
|
const tagNameText = element.getTagNameNode().getText();
|
|
258507
258897
|
if (!aliases.has(tagNameText)) continue;
|
|
258508
258898
|
if (tagNameText === "DeprecatedTagGroup") {
|
|
258509
258899
|
element.getTagNameNode().replaceWithText("TagGroup");
|
|
258510
258900
|
}
|
|
258511
258901
|
}
|
|
258512
|
-
for (const element of sourceFile.getDescendantsOfKind(
|
|
258902
|
+
for (const element of sourceFile.getDescendantsOfKind(import_ts_morph13.SyntaxKind.JsxOpeningElement)) {
|
|
258513
258903
|
const tagNameText = element.getTagNameNode().getText();
|
|
258514
258904
|
if (!aliases.has(tagNameText)) continue;
|
|
258515
258905
|
if (tagNameText === "DeprecatedTagGroup") {
|
|
258516
258906
|
element.getTagNameNode().replaceWithText("TagGroup");
|
|
258517
258907
|
}
|
|
258518
258908
|
const parent = element.getParent();
|
|
258519
|
-
if (parent?.getKind() ===
|
|
258520
|
-
const closingTag = parent.asKind(
|
|
258909
|
+
if (parent?.getKind() === import_ts_morph13.SyntaxKind.JsxElement) {
|
|
258910
|
+
const closingTag = parent.asKind(import_ts_morph13.SyntaxKind.JsxElement)?.getClosingElement();
|
|
258521
258911
|
if (closingTag?.getTagNameNode().getText() === "DeprecatedTagGroup") {
|
|
258522
258912
|
closingTag.getTagNameNode().replaceWithText("TagGroup");
|
|
258523
258913
|
}
|
|
258524
258914
|
}
|
|
258525
258915
|
}
|
|
258526
258916
|
}
|
|
258527
|
-
function
|
|
258917
|
+
function transform14(source, filePath = "file.tsx", options) {
|
|
258528
258918
|
if (!source.includes("DeprecatedTag")) return source;
|
|
258529
|
-
const project = new
|
|
258919
|
+
const project = new import_ts_morph13.Project({
|
|
258530
258920
|
useInMemoryFileSystem: true,
|
|
258531
258921
|
compilerOptions: {
|
|
258532
258922
|
jsx: 2
|
|
258533
258923
|
// JsxEmit.React
|
|
258534
258924
|
},
|
|
258535
258925
|
manipulationSettings: {
|
|
258536
|
-
quoteKind:
|
|
258926
|
+
quoteKind: import_ts_morph13.QuoteKind.Single
|
|
258537
258927
|
}
|
|
258538
258928
|
});
|
|
258539
258929
|
const sourceFile = project.createSourceFile(filePath, source);
|
|
@@ -258544,18 +258934,18 @@ function transform12(source, filePath = "file.tsx", options) {
|
|
|
258544
258934
|
const needsTagGroup = hasTagGroupUsage(sourceFile, tagGroupAliases);
|
|
258545
258935
|
const hasTagPropsRef = source.includes("DeprecatedTagProps");
|
|
258546
258936
|
const needsTagImport = needsTag || hasTagPropsRef;
|
|
258547
|
-
|
|
258548
|
-
|
|
258549
|
-
|
|
258937
|
+
transformImports9(sourceFile, needsTagImport, needsTagGroup, facadePackage);
|
|
258938
|
+
transformTypeReferences6(sourceFile);
|
|
258939
|
+
transformIdentifierReferences2(sourceFile);
|
|
258550
258940
|
transformTagElements(sourceFile, tagAliases, tagGroupAliases);
|
|
258551
258941
|
transformTagGroupElements(sourceFile, tagGroupAliases);
|
|
258552
258942
|
return sourceFile.getFullText();
|
|
258553
258943
|
}
|
|
258554
|
-
var
|
|
258555
|
-
var
|
|
258944
|
+
var import_ts_morph13, IMPORTS_TO_REMOVE3, STANDALONE_TODO, INTENT_REMOVED_TODO, ALIASED_GROUP_CHILD_TODO;
|
|
258945
|
+
var init_transform14 = __esm({
|
|
258556
258946
|
"codemods/upgrade-deprecated-tag/transform.ts"() {
|
|
258557
258947
|
"use strict";
|
|
258558
|
-
|
|
258948
|
+
import_ts_morph13 = __toESM(require_ts_morph(), 1);
|
|
258559
258949
|
init_elements_import();
|
|
258560
258950
|
__name(getDeprecatedTagAliases, "getDeprecatedTagAliases");
|
|
258561
258951
|
__name(getDeprecatedTagGroupAliases, "getDeprecatedTagGroupAliases");
|
|
@@ -258565,28 +258955,28 @@ var init_transform12 = __esm({
|
|
|
258565
258955
|
"ElDeprecatedTagGroup",
|
|
258566
258956
|
"ElDeprecatedTagGroupInner"
|
|
258567
258957
|
]);
|
|
258568
|
-
__name(
|
|
258958
|
+
__name(resolveTargetSpecifier2, "resolveTargetSpecifier");
|
|
258569
258959
|
__name(isInsideTagGroup, "isInsideTagGroup");
|
|
258570
258960
|
__name(hasStandaloneTagUsage, "hasStandaloneTagUsage");
|
|
258571
258961
|
__name(hasTagGroupUsage, "hasTagGroupUsage");
|
|
258572
|
-
__name(
|
|
258573
|
-
__name(
|
|
258574
|
-
__name(
|
|
258575
|
-
__name(
|
|
258962
|
+
__name(transformImports9, "transformImports");
|
|
258963
|
+
__name(addImportsToTarget2, "addImportsToTarget");
|
|
258964
|
+
__name(transformIdentifierReferences2, "transformIdentifierReferences");
|
|
258965
|
+
__name(transformTypeReferences6, "transformTypeReferences");
|
|
258576
258966
|
STANDALONE_TODO = "{/* TODO: Standalone DeprecatedTag migrated to Tag \u2014 verify this is correct */}";
|
|
258577
258967
|
INTENT_REMOVED_TODO = "{/* TODO: intent prop removed \u2014 the new Tag and TagGroup.Item have no colour/intent equivalent */}";
|
|
258578
258968
|
ALIASED_GROUP_CHILD_TODO = "{/* TODO: This aliased DeprecatedTag is inside a group and should be TagGroup.Item, but the alias resolves to Tag \u2014 replace this with <TagGroup.Item> */}";
|
|
258579
258969
|
__name(processIntentProp, "processIntentProp");
|
|
258580
258970
|
__name(transformTagElements, "transformTagElements");
|
|
258581
258971
|
__name(transformTagGroupElements, "transformTagGroupElements");
|
|
258582
|
-
__name(
|
|
258972
|
+
__name(transform14, "transform");
|
|
258583
258973
|
}
|
|
258584
258974
|
});
|
|
258585
258975
|
|
|
258586
258976
|
// codemods/upgrade-deprecated-use-media-query/transform.ts
|
|
258587
|
-
var
|
|
258588
|
-
__export(
|
|
258589
|
-
default: () =>
|
|
258977
|
+
var transform_exports15 = {};
|
|
258978
|
+
__export(transform_exports15, {
|
|
258979
|
+
default: () => transform15
|
|
258590
258980
|
});
|
|
258591
258981
|
function buildMediaQueryExpression(property) {
|
|
258592
258982
|
const expr = PROPERTY_TO_MEDIA_QUERY[property];
|
|
@@ -258665,22 +259055,22 @@ function neededBreakpointHelpers(propertyNames) {
|
|
|
258665
259055
|
function transformDestructuredUseMediaQuery(sourceFile, useMediaQueryAlias) {
|
|
258666
259056
|
const transformedProperties = [];
|
|
258667
259057
|
const declarationsToProcess = [];
|
|
258668
|
-
for (const varDecl of sourceFile.getDescendantsOfKind(
|
|
259058
|
+
for (const varDecl of sourceFile.getDescendantsOfKind(import_ts_morph14.SyntaxKind.VariableDeclaration)) {
|
|
258669
259059
|
const initializer = varDecl.getInitializer();
|
|
258670
259060
|
if (!initializer) continue;
|
|
258671
|
-
if (initializer.getKind() !==
|
|
258672
|
-
const callExpr = initializer.asKind(
|
|
259061
|
+
if (initializer.getKind() !== import_ts_morph14.SyntaxKind.CallExpression) continue;
|
|
259062
|
+
const callExpr = initializer.asKind(import_ts_morph14.SyntaxKind.CallExpression);
|
|
258673
259063
|
if (callExpr.getExpression().getText() !== useMediaQueryAlias) continue;
|
|
258674
259064
|
const nameNode = varDecl.getNameNode();
|
|
258675
|
-
if (nameNode.getKind() !==
|
|
259065
|
+
if (nameNode.getKind() !== import_ts_morph14.SyntaxKind.ObjectBindingPattern) continue;
|
|
258676
259066
|
declarationsToProcess.push(varDecl);
|
|
258677
259067
|
}
|
|
258678
259068
|
for (const varDecl of declarationsToProcess) {
|
|
258679
259069
|
const varDeclList = varDecl.getParent();
|
|
258680
|
-
if (!varDeclList || varDeclList.getKind() !==
|
|
259070
|
+
if (!varDeclList || varDeclList.getKind() !== import_ts_morph14.SyntaxKind.VariableDeclarationList) continue;
|
|
258681
259071
|
const varStatement = varDeclList.getParent();
|
|
258682
|
-
if (!varStatement || varStatement.getKind() !==
|
|
258683
|
-
const allDeclarations = varDeclList.asKind(
|
|
259072
|
+
if (!varStatement || varStatement.getKind() !== import_ts_morph14.SyntaxKind.VariableStatement) continue;
|
|
259073
|
+
const allDeclarations = varDeclList.asKind(import_ts_morph14.SyntaxKind.VariableDeclarationList)?.getDeclarations() ?? [];
|
|
258684
259074
|
if (allDeclarations.length > 1) {
|
|
258685
259075
|
const existingText = varStatement.getText();
|
|
258686
259076
|
varStatement.replaceWithText(
|
|
@@ -258708,21 +259098,21 @@ ${existingText}`
|
|
|
258708
259098
|
}
|
|
258709
259099
|
function addTodosForNonDestructuredUseMediaQuery(sourceFile, useMediaQueryAlias) {
|
|
258710
259100
|
const declarationsToAnnotate = [];
|
|
258711
|
-
for (const varDecl of sourceFile.getDescendantsOfKind(
|
|
259101
|
+
for (const varDecl of sourceFile.getDescendantsOfKind(import_ts_morph14.SyntaxKind.VariableDeclaration)) {
|
|
258712
259102
|
const initializer = varDecl.getInitializer();
|
|
258713
259103
|
if (!initializer) continue;
|
|
258714
|
-
if (initializer.getKind() !==
|
|
258715
|
-
const callExpr = initializer.asKind(
|
|
259104
|
+
if (initializer.getKind() !== import_ts_morph14.SyntaxKind.CallExpression) continue;
|
|
259105
|
+
const callExpr = initializer.asKind(import_ts_morph14.SyntaxKind.CallExpression);
|
|
258716
259106
|
if (callExpr.getExpression().getText() !== useMediaQueryAlias) continue;
|
|
258717
259107
|
const nameNode = varDecl.getNameNode();
|
|
258718
|
-
if (nameNode.getKind() !==
|
|
259108
|
+
if (nameNode.getKind() !== import_ts_morph14.SyntaxKind.Identifier) continue;
|
|
258719
259109
|
declarationsToAnnotate.push(varDecl);
|
|
258720
259110
|
}
|
|
258721
259111
|
for (const varDecl of declarationsToAnnotate) {
|
|
258722
259112
|
const varDeclList = varDecl.getParent();
|
|
258723
|
-
if (!varDeclList || varDeclList.getKind() !==
|
|
259113
|
+
if (!varDeclList || varDeclList.getKind() !== import_ts_morph14.SyntaxKind.VariableDeclarationList) continue;
|
|
258724
259114
|
const varStatement = varDeclList.getParent();
|
|
258725
|
-
if (!varStatement || varStatement.getKind() !==
|
|
259115
|
+
if (!varStatement || varStatement.getKind() !== import_ts_morph14.SyntaxKind.VariableStatement) continue;
|
|
258726
259116
|
const existingText = varStatement.getText();
|
|
258727
259117
|
varStatement.replaceWithText(
|
|
258728
259118
|
`// TODO: Migrate to useMatchMedia \u2014 see @reapit/elements migration guide
|
|
@@ -258732,14 +259122,14 @@ ${existingText}`
|
|
|
258732
259122
|
}
|
|
258733
259123
|
function transformMediaStateProvider(sourceFile, mediaStateProviderAlias) {
|
|
258734
259124
|
const processElements = /* @__PURE__ */ __name(() => {
|
|
258735
|
-
const jsxElements = sourceFile.getDescendantsOfKind(
|
|
259125
|
+
const jsxElements = sourceFile.getDescendantsOfKind(import_ts_morph14.SyntaxKind.JsxElement);
|
|
258736
259126
|
for (const jsxElement of jsxElements) {
|
|
258737
259127
|
const openingTag = jsxElement.getOpeningElement();
|
|
258738
259128
|
const tagName = openingTag.getTagNameNode().getText();
|
|
258739
259129
|
if (tagName !== mediaStateProviderAlias) continue;
|
|
258740
259130
|
const children = jsxElement.getJsxChildren();
|
|
258741
259131
|
const meaningfulChildren = children.filter((child) => {
|
|
258742
|
-
if (child.getKind() ===
|
|
259132
|
+
if (child.getKind() === import_ts_morph14.SyntaxKind.JsxText) {
|
|
258743
259133
|
return child.getText().trim().length > 0;
|
|
258744
259134
|
}
|
|
258745
259135
|
return true;
|
|
@@ -258772,9 +259162,9 @@ function inlineBreakpointConstants(sourceFile, aliases) {
|
|
|
258772
259162
|
for (const [exportName, alias] of aliases.entries()) {
|
|
258773
259163
|
if (!(exportName in BREAKPOINT_VALUES)) continue;
|
|
258774
259164
|
const value = BREAKPOINT_VALUES[exportName];
|
|
258775
|
-
const identifiers = sourceFile.getDescendantsOfKind(
|
|
259165
|
+
const identifiers = sourceFile.getDescendantsOfKind(import_ts_morph14.SyntaxKind.Identifier).filter((id) => id.getText() === alias).filter((id) => {
|
|
258776
259166
|
const parent = id.getParent();
|
|
258777
|
-
return parent?.getKind() !==
|
|
259167
|
+
return parent?.getKind() !== import_ts_morph14.SyntaxKind.ImportSpecifier;
|
|
258778
259168
|
});
|
|
258779
259169
|
for (const id of identifiers) {
|
|
258780
259170
|
id.replaceWithText(
|
|
@@ -258795,19 +259185,19 @@ function addTodosForMediaStateContext(output, mediaStateContextAlias) {
|
|
|
258795
259185
|
`undefined /* TODO: MediaStateContext has been removed \u2014 migrate to individual useMatchMedia calls */`
|
|
258796
259186
|
);
|
|
258797
259187
|
}
|
|
258798
|
-
function
|
|
259188
|
+
function transform15(source, filePath = "file.tsx", options) {
|
|
258799
259189
|
const hasAny = DEPRECATED_EXPORTS.some((name) => source.includes(name));
|
|
258800
259190
|
if (!hasAny) {
|
|
258801
259191
|
return source;
|
|
258802
259192
|
}
|
|
258803
|
-
const project = new
|
|
259193
|
+
const project = new import_ts_morph14.Project({
|
|
258804
259194
|
useInMemoryFileSystem: true,
|
|
258805
259195
|
compilerOptions: {
|
|
258806
259196
|
jsx: 2
|
|
258807
259197
|
// JsxEmit.React
|
|
258808
259198
|
},
|
|
258809
259199
|
manipulationSettings: {
|
|
258810
|
-
quoteKind:
|
|
259200
|
+
quoteKind: import_ts_morph14.QuoteKind.Single,
|
|
258811
259201
|
useTrailingCommas: false
|
|
258812
259202
|
}
|
|
258813
259203
|
});
|
|
@@ -258852,11 +259242,11 @@ function transform13(source, filePath = "file.tsx", options) {
|
|
|
258852
259242
|
result = result.replace(/^(import\s+.*?from\s+'[^']+\/utils\/(?:match-media|breakpoints)');$/gm, "$1");
|
|
258853
259243
|
return result;
|
|
258854
259244
|
}
|
|
258855
|
-
var
|
|
258856
|
-
var
|
|
259245
|
+
var import_ts_morph14, DEPRECATED_EXPORTS, BREAKPOINT_VALUES, PROPERTY_TO_MEDIA_QUERY;
|
|
259246
|
+
var init_transform15 = __esm({
|
|
258857
259247
|
"codemods/upgrade-deprecated-use-media-query/transform.ts"() {
|
|
258858
259248
|
"use strict";
|
|
258859
|
-
|
|
259249
|
+
import_ts_morph14 = __toESM(require_ts_morph(), 1);
|
|
258860
259250
|
init_elements_import();
|
|
258861
259251
|
DEPRECATED_EXPORTS = [
|
|
258862
259252
|
"useMediaQuery",
|
|
@@ -258896,7 +259286,7 @@ var init_transform13 = __esm({
|
|
|
258896
259286
|
__name(inlineBreakpointConstants, "inlineBreakpointConstants");
|
|
258897
259287
|
__name(addTodosForMediaType, "addTodosForMediaType");
|
|
258898
259288
|
__name(addTodosForMediaStateContext, "addTodosForMediaStateContext");
|
|
258899
|
-
__name(
|
|
259289
|
+
__name(transform15, "transform");
|
|
258900
259290
|
}
|
|
258901
259291
|
});
|
|
258902
259292
|
|
|
@@ -258974,7 +259364,7 @@ Examples:
|
|
|
258974
259364
|
`);
|
|
258975
259365
|
}
|
|
258976
259366
|
__name(printUsage, "printUsage");
|
|
258977
|
-
async function run({ transform:
|
|
259367
|
+
async function run({ transform: transform16, codemodName, args }) {
|
|
258978
259368
|
if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
|
|
258979
259369
|
printUsage(codemodName);
|
|
258980
259370
|
process.exit(0);
|
|
@@ -259040,7 +259430,7 @@ async function run({ transform: transform14, codemodName, args }) {
|
|
|
259040
259430
|
for (const filePath of files) {
|
|
259041
259431
|
try {
|
|
259042
259432
|
const source = readFileSync(filePath, "utf-8");
|
|
259043
|
-
const result =
|
|
259433
|
+
const result = transform16(source, filePath, facadePackage ? { facadePackage } : void 0);
|
|
259044
259434
|
if (result !== source) {
|
|
259045
259435
|
transformedCount++;
|
|
259046
259436
|
const relativePath = relative(process.cwd(), filePath);
|
|
@@ -259062,7 +259452,7 @@ __name(run, "run");
|
|
|
259062
259452
|
// codemods/manifest.json
|
|
259063
259453
|
var manifest_default = {
|
|
259064
259454
|
$schema: "./manifest.schema.json",
|
|
259065
|
-
generated: "2026-03-
|
|
259455
|
+
generated: "2026-03-08T23:38:10.340Z",
|
|
259066
259456
|
codemods: [
|
|
259067
259457
|
{
|
|
259068
259458
|
name: "apply-textarea-field-sizing",
|
|
@@ -259072,6 +259462,14 @@ var manifest_default = {
|
|
|
259072
259462
|
name: "at-a-glance-article-card",
|
|
259073
259463
|
description: "Migrates AtAGlance.Card to AtAGlance.ArticleCard"
|
|
259074
259464
|
},
|
|
259465
|
+
{
|
|
259466
|
+
name: "inline-use-click-outside",
|
|
259467
|
+
description: "Inlines deprecated useClickOutside calls and removes Elements imports"
|
|
259468
|
+
},
|
|
259469
|
+
{
|
|
259470
|
+
name: "replace-deprecated-label",
|
|
259471
|
+
description: "Replaces DeprecatedLabel and DeprecatedLabelProps with LabelText and LabelText.Props"
|
|
259472
|
+
},
|
|
259075
259473
|
{
|
|
259076
259474
|
name: "rewrite-text-font-imports",
|
|
259077
259475
|
description: "Migrates Text and font imports from core/text to utils/text and utils/font"
|
|
@@ -259140,17 +259538,19 @@ __name(validateCodemodName, "validateCodemodName");
|
|
|
259140
259538
|
var transforms = {
|
|
259141
259539
|
"apply-textarea-field-sizing": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform(), transform_exports)), "apply-textarea-field-sizing"),
|
|
259142
259540
|
"at-a-glance-article-card": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform2(), transform_exports2)), "at-a-glance-article-card"),
|
|
259143
|
-
"
|
|
259144
|
-
"
|
|
259145
|
-
"rewrite-
|
|
259146
|
-
"
|
|
259147
|
-
"
|
|
259148
|
-
"upgrade-
|
|
259149
|
-
"upgrade-deprecated-
|
|
259150
|
-
"upgrade-deprecated-
|
|
259151
|
-
"upgrade-deprecated-
|
|
259152
|
-
"upgrade-deprecated-
|
|
259153
|
-
"upgrade-deprecated-
|
|
259541
|
+
"inline-use-click-outside": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform3(), transform_exports3)), "inline-use-click-outside"),
|
|
259542
|
+
"replace-deprecated-label": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform4(), transform_exports4)), "replace-deprecated-label"),
|
|
259543
|
+
"rewrite-text-font-imports": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform5(), transform_exports5)), "rewrite-text-font-imports"),
|
|
259544
|
+
"rewrite-v4-imports": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform6(), transform_exports6)), "rewrite-v4-imports"),
|
|
259545
|
+
"rewrite-v5-imports": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform7(), transform_exports7)), "rewrite-v5-imports"),
|
|
259546
|
+
"upgrade-css-variables": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform8(), transform_exports8)), "upgrade-css-variables"),
|
|
259547
|
+
"upgrade-deprecated-badge": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform9(), transform_exports9)), "upgrade-deprecated-badge"),
|
|
259548
|
+
"upgrade-deprecated-button": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform10(), transform_exports10)), "upgrade-deprecated-button"),
|
|
259549
|
+
"upgrade-deprecated-button-group": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform11(), transform_exports11)), "upgrade-deprecated-button-group"),
|
|
259550
|
+
"upgrade-deprecated-icon": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform12(), transform_exports12)), "upgrade-deprecated-icon"),
|
|
259551
|
+
"upgrade-deprecated-split-button": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform13(), transform_exports13)), "upgrade-deprecated-split-button"),
|
|
259552
|
+
"upgrade-deprecated-tag": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform14(), transform_exports14)), "upgrade-deprecated-tag"),
|
|
259553
|
+
"upgrade-deprecated-use-media-query": /* @__PURE__ */ __name(() => Promise.resolve().then(() => (init_transform15(), transform_exports15)), "upgrade-deprecated-use-media-query")
|
|
259154
259554
|
};
|
|
259155
259555
|
|
|
259156
259556
|
// codemods/bin.ts
|
|
@@ -259273,13 +259673,13 @@ async function handleApply(args) {
|
|
|
259273
259673
|
process.exit(1);
|
|
259274
259674
|
}
|
|
259275
259675
|
const codemodModule = await loader();
|
|
259276
|
-
const
|
|
259277
|
-
if (typeof
|
|
259676
|
+
const transform16 = codemodModule.default;
|
|
259677
|
+
if (typeof transform16 !== "function") {
|
|
259278
259678
|
console.error(`Error: Codemod '${codemodName}' does not export a default transform function`);
|
|
259279
259679
|
process.exit(1);
|
|
259280
259680
|
}
|
|
259281
259681
|
await run({
|
|
259282
|
-
transform:
|
|
259682
|
+
transform: transform16,
|
|
259283
259683
|
codemodName,
|
|
259284
259684
|
args: remainingArgs
|
|
259285
259685
|
});
|