@seniorsistemas/angular-components 19.9.15-develop-11ab86f5 → 19.9.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -84
- package/accordion/README.md +4 -5
- package/accordion/lib/accordion/accordion.module.d.ts +0 -7
- package/alert/lib/alert/alert.module.d.ts +0 -7
- package/badge/README.md +4 -5
- package/badge/lib/badge/badge.module.d.ts +0 -10
- package/bignumber-input/README.md +4 -5
- package/bignumber-input/lib/bignumber-input/bignumber-input.directive.d.ts +39 -16
- package/bignumber-input/lib/bignumber-input/bignumber-input.module.d.ts +0 -7
- package/breadcrumb/README.md +4 -5
- package/breadcrumb/lib/dynamic-breadcrumb/dynamic-breadcrumb.module.d.ts +1 -5
- package/button/lib/button/button.module.d.ts +0 -7
- package/calendar-mask/README.md +4 -5
- package/calendar-mask/lib/calendar-mask/calendar-mask.module.d.ts +0 -7
- package/card/README.md +5 -6
- package/card/lib/card/card.module.d.ts +0 -7
- package/chat/README.md +8 -11
- package/chat/lib/chat/chat.module.d.ts +0 -7
- package/checkbox-list/README.md +4 -5
- package/checkbox-list/lib/checkbox-list/checkbox-list.module.d.ts +0 -7
- package/chips/README.md +4 -5
- package/chips/lib/chips/chips.module.d.ts +0 -7
- package/code-editor/README.md +4 -5
- package/code-editor/lib/code-editor/code-editor.module.d.ts +0 -7
- package/collapse-link/README.md +4 -5
- package/collapse-link/lib/collapse-link/collapse-link.module.d.ts +0 -7
- package/common/lib/angular-components.module.d.ts +0 -9
- package/common/lib/svg-factory/svg-factory.module.d.ts +0 -7
- package/common/public-api.d.ts +0 -1
- package/content-generator/README.md +2 -2
- package/content-generator/lib/content-generator/content-generator.module.d.ts +0 -7
- package/control-errors/README.md +2 -2
- package/control-errors/lib/control-errors/control-errors.module.d.ts +0 -7
- package/country-phone-picker/README.md +2 -2
- package/country-phone-picker/lib/country-phone-picker/country-phone-picker.module.d.ts +0 -7
- package/currency/README.md +1 -1
- package/custom-fields/README.md +3 -14
- package/custom-fields/lib/custom-fields/custom-fields.module.d.ts +0 -7
- package/custom-fields/lib/custom-fields/models/index.d.ts +0 -1
- package/dialog/README.md +1 -1
- package/drawer/README.md +4 -8
- package/drawer/lib/drawer/drawer.module.d.ts +0 -10
- package/dynamic-form/README.md +2 -18
- package/dynamic-form/dynamic-form/dynamic-form.module.d.ts +0 -7
- package/dynamic-form/dynamic-form/form-field/addon-config.d.ts +1 -10
- package/dynamic-form/dynamic-form/form-field/configurations/fields/currency-field.d.ts +15 -15
- package/dynamic-form/dynamic-form/form-field/configurations/fields/number-field.d.ts +6 -8
- package/dynamic-form/dynamic-form/form-field/fields/bignumber/bignumber-field.component.d.ts +2 -5
- package/dynamic-form/dynamic-form/form-field/fields/currency/currency-field.component.d.ts +664 -0
- package/dynamic-form/dynamic-form/form-field/fields/number/number-field.component.d.ts +29 -0
- package/dynamic-form/public-api.d.ts +1 -0
- package/editable-overlay/README.md +2 -2
- package/editable-overlay/lib/editable-overlay/editable-overlay.module.d.ts +0 -7
- package/empty-state/README.md +2 -5
- package/empty-state/lib/empty-state/empty-state.module.d.ts +0 -7
- package/esm2022/accordion/lib/accordion/accordion.module.mjs +1 -8
- package/esm2022/alert/lib/alert/alert.module.mjs +1 -8
- package/esm2022/badge/lib/badge/badge.module.mjs +1 -11
- package/esm2022/bignumber-input/lib/bignumber-input/bignumber-input.directive.mjs +127 -19
- package/esm2022/bignumber-input/lib/bignumber-input/bignumber-input.module.mjs +1 -8
- package/esm2022/breadcrumb/lib/dynamic-breadcrumb/dynamic-breadcrumb.module.mjs +2 -6
- package/esm2022/button/lib/button/button.module.mjs +1 -8
- package/esm2022/calendar-mask/lib/calendar-mask/calendar-mask.module.mjs +1 -8
- package/esm2022/card/lib/card/card.module.mjs +1 -8
- package/esm2022/chat/lib/chat/chat.module.mjs +1 -8
- package/esm2022/checkbox-list/lib/checkbox-list/checkbox-list.module.mjs +1 -8
- package/esm2022/chips/lib/chips/chips.module.mjs +1 -8
- package/esm2022/code-editor/lib/code-editor/code-editor.component.mjs +1 -10
- package/esm2022/code-editor/lib/code-editor/code-editor.module.mjs +15 -9
- package/esm2022/collapse-link/lib/collapse-link/collapse-link.module.mjs +1 -8
- package/esm2022/common/lib/angular-components.module.mjs +1 -10
- package/esm2022/common/lib/svg-factory/svg-factory.module.mjs +1 -8
- package/esm2022/common/public-api.mjs +1 -2
- package/esm2022/content-generator/lib/content-generator/content-generator.module.mjs +1 -8
- package/esm2022/control-errors/lib/control-errors/control-errors.module.mjs +1 -8
- package/esm2022/country-phone-picker/lib/country-phone-picker/country-phone-picker.module.mjs +1 -8
- package/esm2022/country-phone-picker/lib/country-phone-picker/country-phone-picker.service.mjs +3 -4
- package/esm2022/custom-fields/lib/custom-fields/custom-fields.component.mjs +13 -17
- package/esm2022/custom-fields/lib/custom-fields/custom-fields.module.mjs +1 -8
- package/esm2022/custom-fields/lib/custom-fields/custom-fields.service.mjs +3 -4
- package/esm2022/custom-fields/lib/custom-fields/models/custom-field-type.mjs +2 -4
- package/esm2022/custom-fields/lib/custom-fields/models/index.mjs +1 -2
- package/esm2022/drawer/lib/drawer/drawer.module.mjs +1 -11
- package/esm2022/dynamic-form/dynamic-form/dynamic-form.module.mjs +1 -8
- package/esm2022/dynamic-form/dynamic-form/form-field/addon-config.mjs +2 -6
- package/esm2022/dynamic-form/dynamic-form/form-field/configurations/fields/currency-field.mjs +1 -1
- package/esm2022/dynamic-form/dynamic-form/form-field/configurations/fields/number-field.mjs +1 -1
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/bignumber/bignumber-field.component.mjs +10 -33
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/currency/currency-field.component.mjs +96 -0
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/number/number-field.component.mjs +124 -0
- package/esm2022/dynamic-form/public-api.mjs +7 -2
- package/esm2022/editable-overlay/lib/editable-overlay/editable-overlay.module.mjs +1 -8
- package/esm2022/empty-state/lib/empty-state/empty-state.module.mjs +1 -8
- package/esm2022/fieldset/lib/fieldset/fieldset.module.mjs +1 -8
- package/esm2022/file-picker/lib/file-picker/file-picker.module.mjs +1 -8
- package/esm2022/file-picker/lib/file-picker/file-picker.service.mjs +3 -4
- package/esm2022/gantt/lib/gantt/gantt.module.mjs +1 -8
- package/esm2022/global-search/lib/global-search/global-search.module.mjs +1 -19
- package/esm2022/grid-menu/lib/grid-menu/grid-menu.module.mjs +1 -8
- package/esm2022/help-popover/lib/help-popover/help-popover.module.mjs +1 -8
- package/esm2022/image-cropper/lib/image-cropper/image-cropper.module.mjs +1 -12
- package/esm2022/image-cropper/lib/image-cropper/image-cropper.service.mjs +3 -4
- package/esm2022/infinite-scroll/lib/infinite-scroll/infinite-scroll.module.mjs +1 -8
- package/esm2022/info-sign/lib/info-sign/info-sign.module.mjs +1 -8
- package/esm2022/inline-edit/lib/inline-edit/components/fields/inline-edit-number/inline-edit-number.component.mjs +5 -5
- package/esm2022/inline-edit/lib/inline-edit/inline-edit.module.mjs +1 -8
- package/esm2022/input-group/lib/input-group/input-group.module.mjs +1 -8
- package/esm2022/input-mask/lib/input-mask/input-mask.module.mjs +1 -8
- package/esm2022/input-text/lib/input-text/input-text.module.mjs +1 -8
- package/esm2022/insights/lib/insights/insights.module.mjs +1 -11
- package/esm2022/kanban/lib/kanban/kanban-event.service.mjs +3 -4
- package/esm2022/kanban/lib/kanban/kanban.module.mjs +1 -11
- package/esm2022/label-value/lib/label-value/label-value.module.mjs +1 -8
- package/esm2022/loading-state/lib/loading-state/loading-state.module.mjs +1 -8
- package/esm2022/locale/lib/locale/locale.module.mjs +1 -14
- package/esm2022/locale/lib/locale/locale.service.mjs +3 -4
- package/esm2022/locale/lib/locale/options/index.mjs +13 -1
- package/esm2022/locale/lib/locale/pipes/localized-bignumber-impure.pipe.mjs +1 -1
- package/esm2022/locale/lib/locale/pipes/localized-bignumber.pipe.mjs +2 -10
- package/esm2022/locale/public-api.mjs +1 -2
- package/esm2022/localized-number-input/lib/localized-number-input/localized-number-input.directive.mjs +1 -5
- package/esm2022/localized-number-input/lib/localized-number-input/localized-number-input.module.mjs +1 -8
- package/esm2022/mask/lib/mask/mask-formatter.module.mjs +1 -8
- package/esm2022/mouse-events/lib/mouse-events/mouse-events.module.mjs +1 -8
- package/esm2022/navigation-button/lib/navigation-button/navigation-button.module.mjs +1 -8
- package/esm2022/number-input/lib/number-input/number-input.directive.mjs +2 -2
- package/esm2022/number-input/lib/number-input/number-input.module.mjs +2 -9
- package/esm2022/numeric/lib/numeric.module.mjs +1 -8
- package/esm2022/numeric-mask/lib/numeric-mask/numeric-mask.directive.mjs +15 -178
- package/esm2022/numeric-mask/lib/numeric-mask/numeric-mask.module.mjs +1 -8
- package/esm2022/object-card/lib/object-card/object-card.module.mjs +1 -12
- package/esm2022/panel/lib/panel/panel.module.mjs +1 -11
- package/esm2022/password-strength/lib/password-strength/password-strength.module.mjs +1 -8
- package/esm2022/picklist/lib/picklist/picklist.module.mjs +1 -8
- package/esm2022/pin-code-field/lib/pin-code-field.module.mjs +1 -8
- package/esm2022/profile-picture-picker/lib/profile-picture-picker/profile-picture-picker.module.mjs +1 -8
- package/esm2022/progressbar/lib/progressbar/progressbar.module.mjs +1 -8
- package/esm2022/rating-scale/lib/rating-scale/rating-scale.module.mjs +1 -8
- package/esm2022/select/lib/select/select.component.mjs +3 -16
- package/esm2022/select-button/lib/select-button/select-button.module.mjs +1 -8
- package/esm2022/shared/lib/shared/border-button/border-button.module.mjs +1 -8
- package/esm2022/slide-in-bar/lib/slide-in-bar/slide-in-bar.module.mjs +1 -8
- package/esm2022/slide-in-bar/lib/slide-in-bar/slide-in-bar.service.mjs +3 -4
- package/esm2022/slider/lib/slider/slider.module.mjs +1 -8
- package/esm2022/speech-recognition/lib/speech-recognition/speech-recognition.module.mjs +1 -8
- package/esm2022/split-button/lib/split-button/split-button.module.mjs +1 -8
- package/esm2022/stats-card/lib/stats-card/stats-card.module.mjs +1 -8
- package/esm2022/stepper/lib/stepper/stepper.module.mjs +1 -8
- package/esm2022/structure/lib/structure/structure.module.mjs +1 -8
- package/esm2022/switch/lib/switch/switch.module.mjs +1 -8
- package/esm2022/table/lib/table/table.module.mjs +1 -9
- package/esm2022/table-header/lib/table-header/table-header-checkox.module.mjs +1 -8
- package/esm2022/template/lib/template/template.module.mjs +1 -8
- package/esm2022/text-area/lib/text-area.module.mjs +1 -8
- package/esm2022/thumbnail/lib/thumbnail/thumbnail.module.mjs +1 -8
- package/esm2022/thumbnails/lib/thumbnails/thumbnails.module.mjs +1 -8
- package/esm2022/tiered-menu/lib/tiered-menu/tiered-menu.module.mjs +1 -8
- package/esm2022/tile/lib/tile/tile.module.mjs +1 -11
- package/esm2022/timeline/lib/timeline/timeline.module.mjs +1 -8
- package/esm2022/toast/lib/toast/toast.module.mjs +1 -8
- package/esm2022/token-list/lib/token-list/token-list.module.mjs +1 -8
- package/esm2022/tooltip/lib/tooltip/tooltip.module.mjs +1 -8
- package/esm2022/topbar/lib/topbar/topbar.module.mjs +1 -11
- package/esm2022/tree/lib/tree/tree.module.mjs +1 -8
- package/esm2022/workspace-switch/lib/workspace-switch/workspace-switch.module.mjs +1 -8
- package/fesm2022/seniorsistemas-angular-components-accordion.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-accordion.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-alert.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-alert.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-badge.mjs +0 -10
- package/fesm2022/seniorsistemas-angular-components-badge.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-bignumber-input.mjs +126 -25
- package/fesm2022/seniorsistemas-angular-components-bignumber-input.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-breadcrumb.mjs +1 -5
- package/fesm2022/seniorsistemas-angular-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-button.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-button.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-calendar-mask.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-calendar-mask.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-card.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-card.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-chat.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-chat.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-checkbox-list.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-checkbox-list.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-chips.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-chips.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-code-editor.mjs +160 -164
- package/fesm2022/seniorsistemas-angular-components-code-editor.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-collapse-link.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-collapse-link.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-common.mjs +2 -38
- package/fesm2022/seniorsistemas-angular-components-common.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-content-generator.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-content-generator.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-control-errors.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-control-errors.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-country-phone-picker.mjs +2 -10
- package/fesm2022/seniorsistemas-angular-components-country-phone-picker.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-custom-fields.mjs +15 -75
- package/fesm2022/seniorsistemas-angular-components-custom-fields.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-drawer.mjs +0 -10
- package/fesm2022/seniorsistemas-angular-components-drawer.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-dynamic-form.mjs +208 -52
- package/fesm2022/seniorsistemas-angular-components-dynamic-form.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-editable-overlay.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-editable-overlay.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-empty-state.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-empty-state.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-fieldset.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-fieldset.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-file-picker.mjs +2 -10
- package/fesm2022/seniorsistemas-angular-components-file-picker.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-gantt.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-gantt.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-global-search.mjs +0 -18
- package/fesm2022/seniorsistemas-angular-components-global-search.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-grid-menu.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-grid-menu.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-help-popover.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-help-popover.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-image-cropper.mjs +2 -14
- package/fesm2022/seniorsistemas-angular-components-image-cropper.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-infinite-scroll.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-infinite-scroll.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-info-sign.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-info-sign.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-inline-edit.mjs +4 -11
- package/fesm2022/seniorsistemas-angular-components-inline-edit.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-input-group.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-input-group.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-input-mask.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-input-mask.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-input-text.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-input-text.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-insights.mjs +0 -10
- package/fesm2022/seniorsistemas-angular-components-insights.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-kanban.mjs +2 -13
- package/fesm2022/seniorsistemas-angular-components-kanban.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-label-value.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-label-value.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-loading-state.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-loading-state.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-locale.mjs +5 -58
- package/fesm2022/seniorsistemas-angular-components-locale.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-localized-number-input.mjs +0 -11
- package/fesm2022/seniorsistemas-angular-components-localized-number-input.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-mask.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-mask.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-mouse-events.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-mouse-events.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-navigation-button.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-navigation-button.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-number-input.mjs +2 -9
- package/fesm2022/seniorsistemas-angular-components-number-input.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-numeric-mask.mjs +14 -184
- package/fesm2022/seniorsistemas-angular-components-numeric-mask.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-numeric.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-numeric.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-object-card.mjs +0 -11
- package/fesm2022/seniorsistemas-angular-components-object-card.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-panel.mjs +0 -10
- package/fesm2022/seniorsistemas-angular-components-panel.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-password-strength.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-password-strength.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-picklist.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-picklist.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-pin-code-field.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-pin-code-field.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-profile-picture-picker.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-profile-picture-picker.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-progressbar.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-progressbar.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-rating-scale.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-rating-scale.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-select-button.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-select-button.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-select.mjs +2 -15
- package/fesm2022/seniorsistemas-angular-components-select.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-shared.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-shared.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-slide-in-bar.mjs +2 -10
- package/fesm2022/seniorsistemas-angular-components-slide-in-bar.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-slider.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-slider.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-speech-recognition.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-speech-recognition.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-split-button.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-split-button.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-stats-card.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-stats-card.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-stepper.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-stepper.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-structure.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-structure.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-switch.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-switch.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-table-header.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-table-header.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-table.mjs +0 -8
- package/fesm2022/seniorsistemas-angular-components-table.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-template.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-template.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-text-area.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-text-area.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-thumbnail.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-thumbnail.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-thumbnails.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-thumbnails.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-tiered-menu.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-tiered-menu.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-tile.mjs +0 -10
- package/fesm2022/seniorsistemas-angular-components-tile.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-timeline.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-timeline.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-toast.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-toast.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-token-list.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-token-list.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-tooltip.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-tooltip.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-topbar.mjs +0 -10
- package/fesm2022/seniorsistemas-angular-components-topbar.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-tree.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-tree.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-workspace-switch.mjs +0 -7
- package/fesm2022/seniorsistemas-angular-components-workspace-switch.mjs.map +1 -1
- package/fieldset/README.md +2 -2
- package/fieldset/lib/fieldset/fieldset.module.d.ts +0 -7
- package/file-picker/README.md +2 -2
- package/file-picker/lib/file-picker/file-picker.module.d.ts +0 -7
- package/file-upload/README.md +1 -1
- package/gantt/README.md +2 -2
- package/gantt/lib/gantt/gantt.module.d.ts +0 -7
- package/global-search/README.md +2 -5
- package/global-search/lib/global-search/global-search.module.d.ts +0 -18
- package/grid-menu/README.md +4 -5
- package/grid-menu/lib/grid-menu/grid-menu.module.d.ts +0 -7
- package/help-popover/README.md +4 -5
- package/help-popover/lib/help-popover/help-popover.module.d.ts +0 -7
- package/ia-insight/README.md +1 -1
- package/image-cropper/README.md +5 -6
- package/image-cropper/lib/image-cropper/image-cropper.module.d.ts +0 -11
- package/infinite-scroll/README.md +4 -5
- package/infinite-scroll/lib/infinite-scroll/infinite-scroll.module.d.ts +0 -7
- package/info-sign/README.md +4 -5
- package/info-sign/lib/info-sign/info-sign.module.d.ts +0 -7
- package/inline-edit/README.md +4 -5
- package/inline-edit/lib/inline-edit/inline-edit.module.d.ts +0 -7
- package/input-group/lib/input-group/input-group.module.d.ts +0 -7
- package/input-mask/lib/input-mask/input-mask.module.d.ts +0 -7
- package/input-text/lib/input-text/input-text.module.d.ts +0 -7
- package/insights/README.md +4 -6
- package/insights/lib/insights/insights.module.d.ts +0 -10
- package/kanban/README.md +4 -6
- package/kanban/lib/kanban/kanban.module.d.ts +0 -10
- package/label-value/README.md +4 -5
- package/label-value/lib/label-value/label-value.module.d.ts +0 -7
- package/loading-state/README.md +5 -9
- package/loading-state/lib/loading-state/loading-state.module.d.ts +0 -7
- package/locale/lib/locale/locale.module.d.ts +0 -13
- package/locale/lib/locale/pipes/localized-bignumber-impure.pipe.d.ts +2 -2
- package/locale/lib/locale/pipes/localized-bignumber.pipe.d.ts +1 -20
- package/locale/public-api.d.ts +0 -1
- package/localized-number-input/README.md +8 -32
- package/localized-number-input/lib/localized-number-input/localized-number-input.directive.d.ts +0 -4
- package/localized-number-input/lib/localized-number-input/localized-number-input.module.d.ts +0 -7
- package/mask/lib/mask/mask-formatter.module.d.ts +0 -7
- package/mouse-events/README.md +4 -5
- package/mouse-events/lib/mouse-events/mouse-events.module.d.ts +0 -7
- package/navigation-button/README.md +4 -5
- package/navigation-button/lib/navigation-button/navigation-button.module.d.ts +0 -7
- package/number-input/lib/number-input/number-input.directive.d.ts +1 -1
- package/number-input/lib/number-input/number-input.module.d.ts +1 -8
- package/numeric/README.md +5 -6
- package/numeric/lib/numeric.module.d.ts +0 -7
- package/numeric-mask/README.md +1 -44
- package/numeric-mask/lib/numeric-mask/numeric-mask.directive.d.ts +4 -65
- package/numeric-mask/lib/numeric-mask/numeric-mask.module.d.ts +0 -7
- package/object-card/README.md +4 -11
- package/object-card/lib/object-card/object-card.module.d.ts +0 -11
- package/package.json +1 -1
- package/panel/README.md +4 -8
- package/panel/lib/panel/panel.module.d.ts +0 -10
- package/password-strength/README.md +3 -6
- package/password-strength/lib/password-strength/password-strength.module.d.ts +0 -7
- package/picklist/README.md +5 -8
- package/picklist/lib/picklist/picklist.module.d.ts +0 -7
- package/pin-code-field/lib/pin-code-field.module.d.ts +0 -7
- package/product-header/README.md +2 -2
- package/profile-picture-picker/README.md +3 -6
- package/profile-picture-picker/lib/profile-picture-picker/profile-picture-picker.module.d.ts +0 -7
- package/progressbar/README.md +3 -6
- package/progressbar/lib/progressbar/progressbar.module.d.ts +0 -7
- package/rating-scale/README.md +3 -6
- package/rating-scale/lib/rating-scale/rating-scale.module.d.ts +0 -7
- package/schematics/collection.json +0 -40
- package/schematics/migrations.json +1 -5
- package/schematics/utils/ast-utils.js +0 -16
- package/schematics/utils/ast-utils.js.map +1 -1
- package/select/lib/select/select.component.d.ts +0 -8
- package/select-button/README.md +3 -6
- package/select-button/lib/select-button/select-button.module.d.ts +0 -7
- package/shared/lib/shared/border-button/border-button.module.d.ts +0 -7
- package/sidebar/README.md +2 -2
- package/slide-in-bar/README.md +5 -5
- package/slide-in-bar/lib/slide-in-bar/slide-in-bar.module.d.ts +0 -7
- package/slider/README.md +3 -6
- package/slider/lib/slider/slider.module.d.ts +0 -7
- package/speech-recognition/README.md +3 -6
- package/speech-recognition/lib/speech-recognition/speech-recognition.module.d.ts +0 -7
- package/split-button/README.md +3 -6
- package/split-button/lib/split-button/split-button.module.d.ts +0 -7
- package/stats-card/README.md +3 -6
- package/stats-card/lib/stats-card/stats-card.module.d.ts +0 -7
- package/stepper/README.md +3 -6
- package/stepper/lib/stepper/stepper.module.d.ts +0 -7
- package/structure/lib/structure/structure.module.d.ts +0 -7
- package/switch/README.md +3 -6
- package/switch/lib/switch/switch.module.d.ts +0 -7
- package/table/README.md +4 -12
- package/table/lib/table/table.module.d.ts +0 -8
- package/table-header/lib/table-header/table-header-checkox.module.d.ts +0 -7
- package/template/README.md +11 -0
- package/template/lib/template/template.module.d.ts +0 -7
- package/text-area/lib/text-area.module.d.ts +0 -7
- package/text-area-ia/README.md +1 -1
- package/thumbnail/lib/thumbnail/thumbnail.module.d.ts +0 -7
- package/thumbnails/lib/thumbnails/thumbnails.module.d.ts +0 -7
- package/tiered-menu/lib/tiered-menu/tiered-menu.module.d.ts +0 -7
- package/tile/lib/tile/tile.module.d.ts +0 -10
- package/timeline/lib/timeline/timeline.module.d.ts +0 -7
- package/toast/lib/toast/toast.module.d.ts +0 -7
- package/token-list/lib/token-list/token-list.module.d.ts +0 -7
- package/tooltip/lib/tooltip/tooltip.module.d.ts +0 -7
- package/topbar/lib/topbar/topbar.module.d.ts +0 -10
- package/tree/lib/tree/tree.module.d.ts +0 -7
- package/workspace-switch/lib/workspace-switch/workspace-switch.module.d.ts +0 -7
- package/common/lib/provide-angular-components.d.ts +0 -19
- package/custom-fields/lib/custom-fields/models/custom-field-value-parser.d.ts +0 -21
- package/esm2022/common/lib/provide-angular-components.mjs +0 -22
- package/esm2022/custom-fields/lib/custom-fields/models/custom-field-value-parser.mjs +0 -46
- package/esm2022/locale/lib/locale/provide-locale.mjs +0 -42
- package/locale/lib/locale/provide-locale.d.ts +0 -18
- package/schematics/migrations/migrate-app-to-standalone/index.d.ts +0 -32
- package/schematics/migrations/migrate-app-to-standalone/index.js +0 -98
- package/schematics/migrations/migrate-app-to-standalone/index.js.map +0 -1
- package/schematics/migrations/migrate-deprecated-apis/index.d.ts +0 -49
- package/schematics/migrations/migrate-deprecated-apis/index.js +0 -660
- package/schematics/migrations/migrate-deprecated-apis/index.js.map +0 -1
- package/schematics/migrations/migrate-deprecated-datepicker/index.d.ts +0 -31
- package/schematics/migrations/migrate-deprecated-datepicker/index.js +0 -115
- package/schematics/migrations/migrate-deprecated-datepicker/index.js.map +0 -1
- package/schematics/migrations/migrate-deprecated-dynamic-form/index.d.ts +0 -52
- package/schematics/migrations/migrate-deprecated-dynamic-form/index.js +0 -661
- package/schematics/migrations/migrate-deprecated-dynamic-form/index.js.map +0 -1
- package/schematics/migrations/migrate-deprecated-imports/index.d.ts +0 -23
- package/schematics/migrations/migrate-deprecated-imports/index.js +0 -335
- package/schematics/migrations/migrate-deprecated-imports/index.js.map +0 -1
- package/schematics/migrations/migrate-deprecated-selectors/index.d.ts +0 -15
- package/schematics/migrations/migrate-deprecated-selectors/index.js +0 -76
- package/schematics/migrations/migrate-deprecated-selectors/index.js.map +0 -1
- package/schematics/migrations/migrate-modules-to-standalone/index.d.ts +0 -51
- package/schematics/migrations/migrate-modules-to-standalone/index.js +0 -632
- package/schematics/migrations/migrate-modules-to-standalone/index.js.map +0 -1
- package/schematics/migrations/migrate-modules-to-standalone/modules-map.json +0 -1656
- package/schematics/migrations/migrate-v20/index.d.ts +0 -9
- package/schematics/migrations/migrate-v20/index.js +0 -90
- package/schematics/migrations/migrate-v20/index.js.map +0 -1
- package/schematics/migrations/migrate-v20/items.d.ts +0 -7
- package/schematics/migrations/migrate-v20/items.js +0 -54
- package/schematics/migrations/migrate-v20/items.js.map +0 -1
- package/schematics/migrations/migrate-v20/plan.d.ts +0 -32
- package/schematics/migrations/migrate-v20/plan.js +0 -29
- package/schematics/migrations/migrate-v20/plan.js.map +0 -1
- package/schematics/schema/app-standalone.schema.json +0 -21
- package/schematics/schema/migrate-v20.schema.json +0 -33
- package/schematics/schema/scope.schema.json +0 -17
- package/schematics/utils/eol.d.ts +0 -5
- package/schematics/utils/eol.js +0 -17
- package/schematics/utils/eol.js.map +0 -1
- package/schematics/utils/prompt-utils.d.ts +0 -62
- package/schematics/utils/prompt-utils.js +0 -166
- package/schematics/utils/prompt-utils.js.map +0 -1
- package/schematics/utils/report.d.ts +0 -27
- package/schematics/utils/report.js +0 -70
- package/schematics/utils/report.js.map +0 -1
- package/schematics/utils/scope.d.ts +0 -17
- package/schematics/utils/scope.js +0 -55
- package/schematics/utils/scope.js.map +0 -1
- package/schematics/utils/selection.d.ts +0 -21
- package/schematics/utils/selection.js +0 -60
- package/schematics/utils/selection.js.map +0 -1
- package/schematics/utils/symbol-utils.d.ts +0 -31
- package/schematics/utils/symbol-utils.js +0 -202
- package/schematics/utils/symbol-utils.js.map +0 -1
- package/schematics/utils/template-utils.d.ts +0 -62
- package/schematics/utils/template-utils.js +0 -165
- package/schematics/utils/template-utils.js.map +0 -1
- package/schematics/utils/tsconfig-paths.d.ts +0 -5
- package/schematics/utils/tsconfig-paths.js +0 -73
- package/schematics/utils/tsconfig-paths.js.map +0 -1
|
@@ -1,632 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MODULES_MAP = exports.ITEM_ID = void 0;
|
|
4
|
-
exports.isUsedInTemplates = isUsedInTemplates;
|
|
5
|
-
exports.migrateModulesInContent = migrateModulesInContent;
|
|
6
|
-
exports.migrateModulesToStandalone = migrateModulesToStandalone;
|
|
7
|
-
exports.migrate = migrate;
|
|
8
|
-
const path = require("path");
|
|
9
|
-
const ts = require("typescript");
|
|
10
|
-
const ast_utils_1 = require("../../utils/ast-utils");
|
|
11
|
-
const html_utils_1 = require("../../utils/html-utils");
|
|
12
|
-
const report_1 = require("../../utils/report");
|
|
13
|
-
const scope_1 = require("../../utils/scope");
|
|
14
|
-
const modulesMapJson = require("./modules-map.json");
|
|
15
|
-
const eol_1 = require("../../utils/eol");
|
|
16
|
-
const tsconfig_paths_1 = require("../../utils/tsconfig-paths");
|
|
17
|
-
exports.ITEM_ID = 'modules';
|
|
18
|
-
const PACKAGE = '@seniorsistemas/angular-components';
|
|
19
|
-
/** Tabela gerada por `scripts/generate-modules-map.js` (não editar à mão). */
|
|
20
|
-
exports.MODULES_MAP = modulesMapJson;
|
|
21
|
-
// ---------------------------------------------------------------------------------------------------
|
|
22
|
-
// Análise de template
|
|
23
|
-
// ---------------------------------------------------------------------------------------------------
|
|
24
|
-
/** `true` quando o template usa o selector/atributo/pipe descrito em `usedBy` (sem `usedBy`, considera usado). */
|
|
25
|
-
function isUsedInTemplates(usedBy, templates) {
|
|
26
|
-
if (!usedBy)
|
|
27
|
-
return true;
|
|
28
|
-
const text = templates.join('\n');
|
|
29
|
-
const tests = [
|
|
30
|
-
...(usedBy.selector ?? []).map((s) => new RegExp(`<${(0, html_utils_1.escapeRegex)(s)}(?![\\w-])`)),
|
|
31
|
-
...(usedBy.attribute ?? []).map((a) => new RegExp(`(?<![\\w-])${(0, html_utils_1.escapeRegex)(a)}(?![\\w-])`)),
|
|
32
|
-
...(usedBy.pipe ?? []).map((p) => new RegExp(`\\|\\s*${(0, html_utils_1.escapeRegex)(p)}(?!\\w)`)),
|
|
33
|
-
];
|
|
34
|
-
if (tests.length === 0)
|
|
35
|
-
return true;
|
|
36
|
-
return tests.some((re) => re.test(text));
|
|
37
|
-
}
|
|
38
|
-
function propertyOf(obj, name) {
|
|
39
|
-
return obj.properties.find((p) => ts.isPropertyAssignment(p) && (ts.isIdentifier(p.name) || ts.isStringLiteral(p.name)) && p.name.text === name);
|
|
40
|
-
}
|
|
41
|
-
function decoratorName(decorator) {
|
|
42
|
-
const expr = decorator.expression;
|
|
43
|
-
return ts.isCallExpression(expr) && ts.isIdentifier(expr.expression) ? expr.expression.text : undefined;
|
|
44
|
-
}
|
|
45
|
-
function resolveSibling(fromFile, relative) {
|
|
46
|
-
return path.posix.normalize(path.posix.join(path.posix.dirname(fromFile), relative));
|
|
47
|
-
}
|
|
48
|
-
/** Templates (texto) de uma classe `@Component`, `[]` para diretivas/pipes, ou `undefined` se não resolvível. */
|
|
49
|
-
function templatesOfClass(filePath, cls, readFile) {
|
|
50
|
-
const decorators = ts.getDecorators(cls) ?? [];
|
|
51
|
-
const component = decorators.find((d) => decoratorName(d) === 'Component');
|
|
52
|
-
if (!component)
|
|
53
|
-
return decorators.some((d) => ['Directive', 'Pipe'].includes(decoratorName(d) ?? '')) ? [] : undefined;
|
|
54
|
-
const arg = component.expression.arguments[0];
|
|
55
|
-
if (!arg || !ts.isObjectLiteralExpression(arg))
|
|
56
|
-
return undefined;
|
|
57
|
-
const inline = propertyOf(arg, 'template');
|
|
58
|
-
if (inline)
|
|
59
|
-
return [inline.initializer.getText()];
|
|
60
|
-
const url = propertyOf(arg, 'templateUrl');
|
|
61
|
-
if (url && ts.isStringLiteralLike(url.initializer)) {
|
|
62
|
-
const content = readFile(resolveSibling(filePath, url.initializer.text));
|
|
63
|
-
return content === undefined ? undefined : [content];
|
|
64
|
-
}
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
function findClass(sourceFile, name) {
|
|
68
|
-
return sourceFile.statements.find((s) => ts.isClassDeclaration(s) && s.name?.text === name);
|
|
69
|
-
}
|
|
70
|
-
/** Resolve os templates de uma classe declarada no mesmo arquivo ou importada por caminho relativo ou alias do tsconfig. */
|
|
71
|
-
function templatesOfDeclaration(filePath, sourceFile, className, readFile, resolveAlias) {
|
|
72
|
-
const local = findClass(sourceFile, className);
|
|
73
|
-
if (local)
|
|
74
|
-
return templatesOfClass(filePath, local, readFile);
|
|
75
|
-
for (const node of sourceFile.statements) {
|
|
76
|
-
if (!ts.isImportDeclaration(node) || !ts.isStringLiteral(node.moduleSpecifier))
|
|
77
|
-
continue;
|
|
78
|
-
const bindings = node.importClause?.namedBindings;
|
|
79
|
-
if (!bindings || !ts.isNamedImports(bindings))
|
|
80
|
-
continue;
|
|
81
|
-
const element = bindings.elements.find((el) => el.name.text === className);
|
|
82
|
-
if (!element)
|
|
83
|
-
continue;
|
|
84
|
-
const specifier = node.moduleSpecifier.text;
|
|
85
|
-
const bases = specifier.startsWith('.') ? [resolveSibling(filePath, specifier)] : resolveAlias(specifier);
|
|
86
|
-
for (const base of bases) {
|
|
87
|
-
for (const candidate of [`${base}.ts`, `${base}/index.ts`]) {
|
|
88
|
-
const content = readFile(candidate);
|
|
89
|
-
if (content === undefined)
|
|
90
|
-
continue;
|
|
91
|
-
const imported = ts.createSourceFile(candidate, content, ts.ScriptTarget.Latest, true);
|
|
92
|
-
const cls = findClass(imported, (element.propertyName ?? element.name).text);
|
|
93
|
-
return cls ? templatesOfClass(candidate, cls, readFile) : undefined;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return undefined;
|
|
97
|
-
}
|
|
98
|
-
return undefined;
|
|
99
|
-
}
|
|
100
|
-
function resolveScope(filePath, sourceFile, context, readFile, resolveAlias) {
|
|
101
|
-
const obj = context.object;
|
|
102
|
-
if (!obj)
|
|
103
|
-
return { kind: 'none' };
|
|
104
|
-
if (context.owner === 'component') {
|
|
105
|
-
const inline = propertyOf(obj, 'template');
|
|
106
|
-
if (inline)
|
|
107
|
-
return { kind: 'resolved', templates: [inline.initializer.getText()] };
|
|
108
|
-
const url = propertyOf(obj, 'templateUrl');
|
|
109
|
-
if (url && ts.isStringLiteralLike(url.initializer)) {
|
|
110
|
-
const content = readFile(resolveSibling(filePath, url.initializer.text));
|
|
111
|
-
return content === undefined
|
|
112
|
-
? { kind: 'unresolved', reason: `template "${url.initializer.text}" não encontrado` }
|
|
113
|
-
: { kind: 'resolved', templates: [content] };
|
|
114
|
-
}
|
|
115
|
-
return { kind: 'none' };
|
|
116
|
-
}
|
|
117
|
-
const declarations = propertyOf(obj, 'declarations');
|
|
118
|
-
if (!declarations || !ts.isArrayLiteralExpression(declarations.initializer))
|
|
119
|
-
return { kind: 'none' };
|
|
120
|
-
const elements = declarations.initializer.elements;
|
|
121
|
-
if (elements.length === 0)
|
|
122
|
-
return { kind: 'none' };
|
|
123
|
-
const templates = [];
|
|
124
|
-
for (const el of elements) {
|
|
125
|
-
const resolved = ts.isIdentifier(el) ? templatesOfDeclaration(filePath, sourceFile, el.text, readFile, resolveAlias) : undefined;
|
|
126
|
-
if (!resolved) {
|
|
127
|
-
return {
|
|
128
|
-
kind: 'unresolved',
|
|
129
|
-
reason: `não foi possível ler o template de "${el.getText()}" (declarations)`,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
templates.push(...resolved);
|
|
133
|
-
}
|
|
134
|
-
return { kind: 'resolved', templates };
|
|
135
|
-
}
|
|
136
|
-
// ---------------------------------------------------------------------------------------------------
|
|
137
|
-
// Escolha dos símbolos
|
|
138
|
-
// ---------------------------------------------------------------------------------------------------
|
|
139
|
-
function selectSymbols(entry, context, scope, providerOnly) {
|
|
140
|
-
const all = [...entry.standalone, ...entry.transitive];
|
|
141
|
-
if (context.kind === 'exports' || context.kind === 'free')
|
|
142
|
-
return all;
|
|
143
|
-
if (scope.kind === 'resolved') {
|
|
144
|
-
const standalone = entry.standalone.length <= 1
|
|
145
|
-
? entry.standalone
|
|
146
|
-
: entry.standalone.filter((s) => !s.usedBy || isUsedInTemplates(s.usedBy, scope.templates));
|
|
147
|
-
const transitive = entry.transitive.filter((t) => isUsedInTemplates(t.usedBy, scope.templates));
|
|
148
|
-
return [...standalone, ...transitive];
|
|
149
|
-
}
|
|
150
|
-
// `X.forRoot()` sem template para analisar é só configuração: não precisa dos standalones.
|
|
151
|
-
if (providerOnly && scope.kind === 'none')
|
|
152
|
-
return [];
|
|
153
|
-
return all;
|
|
154
|
-
}
|
|
155
|
-
// ---------------------------------------------------------------------------------------------------
|
|
156
|
-
// Utilitários de edição
|
|
157
|
-
// ---------------------------------------------------------------------------------------------------
|
|
158
|
-
function lineIndent(content, pos) {
|
|
159
|
-
const lineStart = content.lastIndexOf('\n', pos - 1) + 1;
|
|
160
|
-
return /^[ \t]*/.exec(content.slice(lineStart, pos))?.[0] ?? '';
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Comentários entre o último elemento e o `]` (ex.: marcadores de gerador de código como
|
|
164
|
-
* `/*{CA:MODULE_IMPORTS:START}*\/`): não pertencem a nenhum elemento e se perderiam ao reconstruir o array.
|
|
165
|
-
*/
|
|
166
|
-
function trailingComments(content, arr) {
|
|
167
|
-
const last = arr.elements[arr.elements.length - 1];
|
|
168
|
-
if (!last)
|
|
169
|
-
return [];
|
|
170
|
-
const tail = content.slice(last.getEnd(), arr.getEnd() - 1).replace(/^\s*,/, '');
|
|
171
|
-
return tail
|
|
172
|
-
.split(/\r?\n/)
|
|
173
|
-
.map((line) => line.trim())
|
|
174
|
-
.filter(Boolean);
|
|
175
|
-
}
|
|
176
|
-
function renderArray(content, arr, items) {
|
|
177
|
-
const kept = trailingComments(content, arr);
|
|
178
|
-
if (items.length === 0 && kept.length === 0)
|
|
179
|
-
return '[]';
|
|
180
|
-
const original = content.slice(arr.getStart(), arr.getEnd());
|
|
181
|
-
if (!original.includes('\n'))
|
|
182
|
-
return `[${items.join(', ')}]`;
|
|
183
|
-
const eol = content.includes('\r\n') ? '\r\n' : '\n';
|
|
184
|
-
const closeIndent = lineIndent(content, arr.getEnd() - 1);
|
|
185
|
-
const first = arr.elements[0];
|
|
186
|
-
const itemIndent = first ? lineIndent(content, first.getStart()) : `${closeIndent} `;
|
|
187
|
-
const trailing = arr.elements.hasTrailingComma || arr.elements.length === 0 ? ',' : '';
|
|
188
|
-
const lines = [];
|
|
189
|
-
if (items.length > 0)
|
|
190
|
-
lines.push(`${items.map((i) => `${itemIndent}${i}`).join(`,${eol}`)}${trailing}`);
|
|
191
|
-
lines.push(...kept.map((c) => `${itemIndent}${c}`));
|
|
192
|
-
return `[${eol}${lines.join(eol)}${eol}${closeIndent}]`;
|
|
193
|
-
}
|
|
194
|
-
function insertPropertyChange(content, obj, text) {
|
|
195
|
-
if (obj.properties.length === 0) {
|
|
196
|
-
return { start: obj.getStart(), end: obj.getEnd(), replacement: `{ ${text} }` };
|
|
197
|
-
}
|
|
198
|
-
const last = obj.properties[obj.properties.length - 1];
|
|
199
|
-
const tail = content.slice(last.getEnd(), obj.getEnd() - 1);
|
|
200
|
-
const commaIndex = tail.indexOf(',');
|
|
201
|
-
const hasTrailingComma = commaIndex !== -1;
|
|
202
|
-
const insertAt = hasTrailingComma ? last.getEnd() + commaIndex + 1 : last.getEnd();
|
|
203
|
-
if (!content.slice(obj.getStart(), obj.getEnd()).includes('\n')) {
|
|
204
|
-
return { start: insertAt, end: insertAt, replacement: `${hasTrailingComma ? ' ' : ', '}${text}` };
|
|
205
|
-
}
|
|
206
|
-
const eol = content.includes('\r\n') ? '\r\n' : '\n';
|
|
207
|
-
const indent = lineIndent(content, last.getStart());
|
|
208
|
-
return {
|
|
209
|
-
start: insertAt,
|
|
210
|
-
end: insertAt,
|
|
211
|
-
replacement: hasTrailingComma ? `${eol}${indent}${text},` : `,${eol}${indent}${text}`,
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
function normalizeText(text) {
|
|
215
|
-
return text.replace(/\s+/g, '');
|
|
216
|
-
}
|
|
217
|
-
function unwrap(expr) {
|
|
218
|
-
let current = expr;
|
|
219
|
-
while (ts.isNonNullExpression(current) ||
|
|
220
|
-
ts.isParenthesizedExpression(current) ||
|
|
221
|
-
ts.isAsExpression(current) ||
|
|
222
|
-
ts.isTypeAssertionExpression(current)) {
|
|
223
|
-
current = current.expression;
|
|
224
|
-
}
|
|
225
|
-
return current;
|
|
226
|
-
}
|
|
227
|
-
function importSpecifier(entrypoint) {
|
|
228
|
-
return entrypoint.startsWith('@') ? entrypoint : `${PACKAGE}/${entrypoint}`;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Remove nomes de um `import { ... } from '<specifier>'` (comparação exata do caminho). Apaga a declaração
|
|
232
|
-
* inteira quando não sobra nada.
|
|
233
|
-
*/
|
|
234
|
-
function removeNamedImports(content, specifier, names) {
|
|
235
|
-
const sourceFile = ts.createSourceFile('_imports.ts', content, ts.ScriptTarget.Latest, true);
|
|
236
|
-
const changes = [];
|
|
237
|
-
for (const node of sourceFile.statements) {
|
|
238
|
-
if (!ts.isImportDeclaration(node) || !ts.isStringLiteral(node.moduleSpecifier))
|
|
239
|
-
continue;
|
|
240
|
-
if (node.moduleSpecifier.text !== specifier)
|
|
241
|
-
continue;
|
|
242
|
-
const bindings = node.importClause?.namedBindings;
|
|
243
|
-
if (!bindings || !ts.isNamedImports(bindings))
|
|
244
|
-
continue;
|
|
245
|
-
const kept = bindings.elements.filter((el) => !names.has(el.name.text));
|
|
246
|
-
if (kept.length === bindings.elements.length)
|
|
247
|
-
continue;
|
|
248
|
-
if (kept.length === 0 && !node.importClause?.name) {
|
|
249
|
-
const trailing = /^[ \t]*\r?\n/.exec(content.slice(node.getEnd()));
|
|
250
|
-
changes.push({ start: node.getStart(), end: node.getEnd() + (trailing ? trailing[0].length : 0), replacement: '' });
|
|
251
|
-
continue;
|
|
252
|
-
}
|
|
253
|
-
const multiline = content.slice(bindings.getStart(), bindings.getEnd()).includes('\n');
|
|
254
|
-
const eol = content.includes('\r\n') ? '\r\n' : '\n';
|
|
255
|
-
const rendered = multiline
|
|
256
|
-
? `{${eol}${kept.map((el) => ` ${el.getText()}`).join(`,${eol}`)},${eol}}`
|
|
257
|
-
: `{ ${kept.map((el) => el.getText()).join(', ')} }`;
|
|
258
|
-
changes.push({ start: bindings.getStart(), end: bindings.getEnd(), replacement: rendered });
|
|
259
|
-
}
|
|
260
|
-
return changes.length > 0 ? (0, ast_utils_1.applyChanges)(content, changes) : content;
|
|
261
|
-
}
|
|
262
|
-
// ---------------------------------------------------------------------------------------------------
|
|
263
|
-
// Migração de um arquivo
|
|
264
|
-
// ---------------------------------------------------------------------------------------------------
|
|
265
|
-
function buildRefs(sourceFile, map) {
|
|
266
|
-
const byKey = new Map(map.modules.map((m) => [`${m.entrypoint}:${m.module}`, m]));
|
|
267
|
-
const refs = new Map();
|
|
268
|
-
for (const node of sourceFile.statements) {
|
|
269
|
-
if (!ts.isImportDeclaration(node) || !ts.isStringLiteral(node.moduleSpecifier))
|
|
270
|
-
continue;
|
|
271
|
-
const specifier = node.moduleSpecifier.text;
|
|
272
|
-
if (!specifier.startsWith(`${PACKAGE}/`))
|
|
273
|
-
continue;
|
|
274
|
-
const entrypoint = specifier.slice(PACKAGE.length + 1);
|
|
275
|
-
const bindings = node.importClause?.namedBindings;
|
|
276
|
-
if (!bindings || !ts.isNamedImports(bindings))
|
|
277
|
-
continue;
|
|
278
|
-
for (const el of bindings.elements) {
|
|
279
|
-
const found = byKey.get(`${entrypoint}:${(el.propertyName ?? el.name).text}`);
|
|
280
|
-
if (found)
|
|
281
|
-
refs.set(el.name.text, { entry: found, specifier });
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
return refs;
|
|
285
|
-
}
|
|
286
|
-
function contextOf(arr) {
|
|
287
|
-
const prop = arr.parent;
|
|
288
|
-
if (!prop || !ts.isPropertyAssignment(prop) || !ts.isIdentifier(prop.name))
|
|
289
|
-
return { kind: 'free', owner: 'none' };
|
|
290
|
-
const obj = prop.parent;
|
|
291
|
-
if (!obj || !ts.isObjectLiteralExpression(obj))
|
|
292
|
-
return { kind: 'free', owner: 'none' };
|
|
293
|
-
let owner = 'none';
|
|
294
|
-
const parent = obj.parent;
|
|
295
|
-
if (parent && ts.isCallExpression(parent) && parent.arguments[0] === obj) {
|
|
296
|
-
const callee = parent.expression;
|
|
297
|
-
const calleeName = ts.isIdentifier(callee)
|
|
298
|
-
? callee.text
|
|
299
|
-
: ts.isPropertyAccessExpression(callee)
|
|
300
|
-
? callee.name.text
|
|
301
|
-
: '';
|
|
302
|
-
if (calleeName === 'configureTestingModule' || calleeName === 'moduleMetadata')
|
|
303
|
-
owner = 'module';
|
|
304
|
-
if (calleeName === 'Component')
|
|
305
|
-
owner = 'component';
|
|
306
|
-
if (calleeName === 'NgModule')
|
|
307
|
-
owner = 'module';
|
|
308
|
-
}
|
|
309
|
-
if (owner === 'none')
|
|
310
|
-
return { kind: 'free', owner, object: obj };
|
|
311
|
-
if (prop.name.text === 'imports') {
|
|
312
|
-
return { kind: owner === 'component' ? 'component-imports' : 'module-imports', object: obj, owner };
|
|
313
|
-
}
|
|
314
|
-
if (prop.name.text === 'exports')
|
|
315
|
-
return { kind: 'exports', object: obj, owner };
|
|
316
|
-
return { kind: 'free', object: obj, owner };
|
|
317
|
-
}
|
|
318
|
-
function migrateModulesInContent(filePath, content, readFile = () => undefined, map = exports.MODULES_MAP, resolveAlias = () => []) {
|
|
319
|
-
if (!content.includes(`${PACKAGE}/`))
|
|
320
|
-
return { updated: content, manual: [] };
|
|
321
|
-
const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);
|
|
322
|
-
const refs = buildRefs(sourceFile, map);
|
|
323
|
-
if (refs.size === 0)
|
|
324
|
-
return { updated: content, manual: [] };
|
|
325
|
-
const manual = [];
|
|
326
|
-
const addManual = (node, message) => {
|
|
327
|
-
manual.push({ line: (0, report_1.lineOf)(content, node.getStart(sourceFile)), message });
|
|
328
|
-
};
|
|
329
|
-
const handled = new Set();
|
|
330
|
-
const needed = new Map();
|
|
331
|
-
const plans = new Map();
|
|
332
|
-
const newProps = new Map();
|
|
333
|
-
const keep = new Set();
|
|
334
|
-
const scopes = new Map();
|
|
335
|
-
const warnedScope = new Set();
|
|
336
|
-
const planOf = (arr) => {
|
|
337
|
-
let plan = plans.get(arr);
|
|
338
|
-
if (!plan) {
|
|
339
|
-
plan = { replace: new Map(), append: [] };
|
|
340
|
-
plans.set(arr, plan);
|
|
341
|
-
}
|
|
342
|
-
return plan;
|
|
343
|
-
};
|
|
344
|
-
const need = (symbol) => {
|
|
345
|
-
needed.set(`${symbol.entrypoint}:${symbol.symbol}`, symbol);
|
|
346
|
-
};
|
|
347
|
-
const scopeFor = (context) => {
|
|
348
|
-
if (!context.object)
|
|
349
|
-
return { kind: 'none' };
|
|
350
|
-
let scope = scopes.get(context.object);
|
|
351
|
-
if (!scope) {
|
|
352
|
-
scope = resolveScope(filePath, sourceFile, context, readFile, resolveAlias);
|
|
353
|
-
scopes.set(context.object, scope);
|
|
354
|
-
}
|
|
355
|
-
return scope;
|
|
356
|
-
};
|
|
357
|
-
const symbolsFor = (node, ref, context, providerOnly) => {
|
|
358
|
-
const scope = scopeFor(context);
|
|
359
|
-
const symbols = selectSymbols(ref.entry, context, scope, providerOnly);
|
|
360
|
-
if (scope.kind === 'unresolved' &&
|
|
361
|
-
(ref.entry.transitive.length > 0 || ref.entry.standalone.length > 1) &&
|
|
362
|
-
!providerOnly) {
|
|
363
|
-
const key = `${ref.entry.module}:${node.getStart(sourceFile)}`;
|
|
364
|
-
if (!warnedScope.has(key)) {
|
|
365
|
-
warnedScope.add(key);
|
|
366
|
-
addManual(node, `${ref.entry.module}: ${scope.reason}; foram adicionados todos os standalones que o módulo reexportava (${symbols
|
|
367
|
-
.map((s) => s.symbol)
|
|
368
|
-
.join(', ')}). Remova os que não forem usados.`);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
if (ref.entry.manual)
|
|
372
|
-
addManual(node, `${ref.entry.module}: ${ref.entry.manual}`);
|
|
373
|
-
symbols.forEach(need);
|
|
374
|
-
return symbols.map((s) => s.symbol);
|
|
375
|
-
};
|
|
376
|
-
/** `X.forRoot(...)` / `X.forChild(...)` onde `X` é um módulo mapeado. */
|
|
377
|
-
const asModuleCall = (expr) => {
|
|
378
|
-
const inner = unwrap(expr);
|
|
379
|
-
if (!ts.isCallExpression(inner) || !ts.isPropertyAccessExpression(inner.expression))
|
|
380
|
-
return undefined;
|
|
381
|
-
const target = inner.expression.expression;
|
|
382
|
-
const form = inner.expression.name.text;
|
|
383
|
-
if (!ts.isIdentifier(target) || (form !== 'forRoot' && form !== 'forChild'))
|
|
384
|
-
return undefined;
|
|
385
|
-
const ref = refs.get(target.text);
|
|
386
|
-
return ref ? { ref, form, call: inner, identifier: target } : undefined;
|
|
387
|
-
};
|
|
388
|
-
const providerText = (call) => {
|
|
389
|
-
const rule = call.ref.entry.forRoot;
|
|
390
|
-
const args = rule.args ? call.call.arguments.map((a) => a.getText(sourceFile)).join(', ') : '';
|
|
391
|
-
return `${rule.replacement}(${args})`;
|
|
392
|
-
};
|
|
393
|
-
const markHandled = (node) => {
|
|
394
|
-
const visit = (n) => {
|
|
395
|
-
handled.add(n);
|
|
396
|
-
ts.forEachChild(n, visit);
|
|
397
|
-
};
|
|
398
|
-
visit(node);
|
|
399
|
-
};
|
|
400
|
-
/**
|
|
401
|
-
* Acrescenta `text` ao array `propName` do objeto (criando a propriedade se não existir).
|
|
402
|
-
* Retorna `false` quando a propriedade existe mas não é um array literal (não editável com segurança).
|
|
403
|
-
*/
|
|
404
|
-
const registerInProp = (obj, propName, text) => {
|
|
405
|
-
if (!obj)
|
|
406
|
-
return false;
|
|
407
|
-
const prop = propertyOf(obj, propName);
|
|
408
|
-
if (prop) {
|
|
409
|
-
if (!ts.isArrayLiteralExpression(prop.initializer))
|
|
410
|
-
return false;
|
|
411
|
-
const plan = planOf(prop.initializer);
|
|
412
|
-
if (!plan.append.some((a) => normalizeText(a) === normalizeText(text)))
|
|
413
|
-
plan.append.push(text);
|
|
414
|
-
return true;
|
|
415
|
-
}
|
|
416
|
-
const byProp = newProps.get(obj) ?? new Map();
|
|
417
|
-
const list = byProp.get(propName) ?? [];
|
|
418
|
-
if (!list.some((a) => normalizeText(a) === normalizeText(text)))
|
|
419
|
-
list.push(text);
|
|
420
|
-
byProp.set(propName, list);
|
|
421
|
-
newProps.set(obj, byProp);
|
|
422
|
-
return true;
|
|
423
|
-
};
|
|
424
|
-
/**
|
|
425
|
-
* Standalone em `exports` de um `NgModule` também precisa estar no `imports` do mesmo módulo
|
|
426
|
-
* (o compilador rejeita standalone só exportado), então acrescenta os símbolos lá.
|
|
427
|
-
*/
|
|
428
|
-
const registerExported = (context, names) => {
|
|
429
|
-
if (context.kind !== 'exports' || context.owner !== 'module')
|
|
430
|
-
return;
|
|
431
|
-
for (const name of names)
|
|
432
|
-
registerInProp(context.object, 'imports', name);
|
|
433
|
-
};
|
|
434
|
-
const processArray = (arr) => {
|
|
435
|
-
const context = contextOf(arr);
|
|
436
|
-
for (const el of arr.elements) {
|
|
437
|
-
// 1. Módulo simples: `XModule`
|
|
438
|
-
if (ts.isIdentifier(el) && refs.has(el.text)) {
|
|
439
|
-
const names = symbolsFor(el, refs.get(el.text), context, false);
|
|
440
|
-
planOf(arr).replace.set(el, names);
|
|
441
|
-
handled.add(el);
|
|
442
|
-
registerExported(context, names);
|
|
443
|
-
continue;
|
|
444
|
-
}
|
|
445
|
-
// 2. `X.forRoot(...)` / `X.forChild()` como elemento do array
|
|
446
|
-
const moduleCall = ts.isCallExpression(unwrap(el)) ? asModuleCall(el) : undefined;
|
|
447
|
-
if (moduleCall) {
|
|
448
|
-
const { ref, form } = moduleCall;
|
|
449
|
-
if (form === 'forChild' && ref.entry.forChild === 'remove') {
|
|
450
|
-
const names = symbolsFor(el, ref, context, false);
|
|
451
|
-
planOf(arr).replace.set(el, names);
|
|
452
|
-
registerExported(context, names);
|
|
453
|
-
markHandled(el);
|
|
454
|
-
}
|
|
455
|
-
else if (form === 'forRoot' && ref.entry.forRoot && context.kind === 'module-imports') {
|
|
456
|
-
const text = providerText(moduleCall);
|
|
457
|
-
if (registerInProp(context.object, 'providers', text)) {
|
|
458
|
-
need({ symbol: ref.entry.forRoot.replacement, entrypoint: ref.entry.forRoot.entrypoint });
|
|
459
|
-
planOf(arr).replace.set(el, symbolsFor(el, ref, context, true));
|
|
460
|
-
markHandled(el);
|
|
461
|
-
}
|
|
462
|
-
else {
|
|
463
|
-
addManual(el, `${ref.entry.module}.forRoot(): "providers" não é um array literal; ` +
|
|
464
|
-
`mova manualmente para ${ref.entry.forRoot.replacement}().`);
|
|
465
|
-
markHandled(el);
|
|
466
|
-
keep.add(moduleCall.identifier.text);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
else if (form === 'forRoot' && ref.entry.forRoot) {
|
|
470
|
-
addManual(el, `${ref.entry.module}.forRoot() em um contexto não reconhecido (ex.: imports de componente standalone): ` +
|
|
471
|
-
`registre ${ref.entry.forRoot.replacement}() nos providers.`);
|
|
472
|
-
markHandled(el);
|
|
473
|
-
keep.add(moduleCall.identifier.text);
|
|
474
|
-
}
|
|
475
|
-
else {
|
|
476
|
-
addManual(el, `${ref.entry.module}.${form}() não tem tratamento automático: migre manualmente.`);
|
|
477
|
-
markHandled(el);
|
|
478
|
-
keep.add(moduleCall.identifier.text);
|
|
479
|
-
}
|
|
480
|
-
continue;
|
|
481
|
-
}
|
|
482
|
-
// 3. `...X.forRoot().providers!`
|
|
483
|
-
if (ts.isSpreadElement(el)) {
|
|
484
|
-
const inner = unwrap(el.expression);
|
|
485
|
-
if (ts.isPropertyAccessExpression(inner) && inner.name.text === 'providers') {
|
|
486
|
-
const call = asModuleCall(inner.expression);
|
|
487
|
-
if (call && call.form === 'forRoot' && call.ref.entry.forRoot) {
|
|
488
|
-
need({ symbol: call.ref.entry.forRoot.replacement, entrypoint: call.ref.entry.forRoot.entrypoint });
|
|
489
|
-
planOf(arr).replace.set(el, [providerText(call)]);
|
|
490
|
-
markHandled(el);
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
continue;
|
|
494
|
-
}
|
|
495
|
-
// 4. `importProvidersFrom(X.forRoot(), outro)`
|
|
496
|
-
if (ts.isCallExpression(el) &&
|
|
497
|
-
ts.isIdentifier(el.expression) &&
|
|
498
|
-
el.expression.text === 'importProvidersFrom') {
|
|
499
|
-
const remaining = [];
|
|
500
|
-
const providers = [];
|
|
501
|
-
let changed = false;
|
|
502
|
-
for (const arg of el.arguments) {
|
|
503
|
-
if (ts.isIdentifier(arg) && refs.has(arg.text)) {
|
|
504
|
-
handled.add(arg);
|
|
505
|
-
changed = true;
|
|
506
|
-
continue;
|
|
507
|
-
}
|
|
508
|
-
const call = asModuleCall(arg);
|
|
509
|
-
if (call && call.form === 'forChild' && call.ref.entry.forChild === 'remove') {
|
|
510
|
-
markHandled(arg);
|
|
511
|
-
changed = true;
|
|
512
|
-
continue;
|
|
513
|
-
}
|
|
514
|
-
if (call && call.form === 'forRoot' && call.ref.entry.forRoot) {
|
|
515
|
-
need({ symbol: call.ref.entry.forRoot.replacement, entrypoint: call.ref.entry.forRoot.entrypoint });
|
|
516
|
-
providers.push(providerText(call));
|
|
517
|
-
markHandled(arg);
|
|
518
|
-
changed = true;
|
|
519
|
-
continue;
|
|
520
|
-
}
|
|
521
|
-
remaining.push(arg.getText(sourceFile));
|
|
522
|
-
}
|
|
523
|
-
if (changed) {
|
|
524
|
-
const texts = [...providers];
|
|
525
|
-
if (remaining.length > 0)
|
|
526
|
-
texts.push(`importProvidersFrom(${remaining.join(', ')})`);
|
|
527
|
-
planOf(arr).replace.set(el, texts);
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
const visitArrays = (node) => {
|
|
533
|
-
if (ts.isArrayLiteralExpression(node))
|
|
534
|
-
processArray(node);
|
|
535
|
-
ts.forEachChild(node, visitArrays);
|
|
536
|
-
};
|
|
537
|
-
visitArrays(sourceFile);
|
|
538
|
-
// Referências a módulos que ficaram fora dos arrays tratados: mantém o import e avisa.
|
|
539
|
-
const visitRefs = (node) => {
|
|
540
|
-
if (ts.isIdentifier(node) && refs.has(node.text) && !handled.has(node)) {
|
|
541
|
-
const parent = node.parent;
|
|
542
|
-
const inImport = parent && (ts.isImportSpecifier(parent) || ts.isImportClause(parent));
|
|
543
|
-
if (!inImport) {
|
|
544
|
-
keep.add(node.text);
|
|
545
|
-
addManual(node, `"${node.text}" é usado fora de um array de imports/providers: migre manualmente.`);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
ts.forEachChild(node, visitRefs);
|
|
549
|
-
};
|
|
550
|
-
visitRefs(sourceFile);
|
|
551
|
-
if (plans.size === 0 && newProps.size === 0) {
|
|
552
|
-
return { updated: content, manual };
|
|
553
|
-
}
|
|
554
|
-
const changes = [];
|
|
555
|
-
const hasComments = (arr) => /\/\/|\/\*/.test(content.slice(arr.getStart(), arr.getEnd()));
|
|
556
|
-
for (const [arr, plan] of plans) {
|
|
557
|
-
const commented = hasComments(arr);
|
|
558
|
-
const existing = new Set();
|
|
559
|
-
for (const el of arr.elements) {
|
|
560
|
-
if (!plan.replace.has(el))
|
|
561
|
-
existing.add(normalizeText(el.getText(sourceFile)));
|
|
562
|
-
}
|
|
563
|
-
const items = [];
|
|
564
|
-
for (const el of arr.elements) {
|
|
565
|
-
const replacement = plan.replace.get(el);
|
|
566
|
-
if (replacement === undefined) {
|
|
567
|
-
items.push(commented ? el.getFullText(sourceFile).trim() : el.getText(sourceFile));
|
|
568
|
-
continue;
|
|
569
|
-
}
|
|
570
|
-
for (const text of replacement) {
|
|
571
|
-
const key = normalizeText(text);
|
|
572
|
-
if (existing.has(key))
|
|
573
|
-
continue;
|
|
574
|
-
existing.add(key);
|
|
575
|
-
items.push(text);
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
for (const text of plan.append) {
|
|
579
|
-
const key = normalizeText(text);
|
|
580
|
-
if (!existing.has(key)) {
|
|
581
|
-
existing.add(key);
|
|
582
|
-
items.push(text);
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
changes.push({ start: arr.getStart(sourceFile), end: arr.getEnd(), replacement: renderArray(content, arr, items) });
|
|
586
|
-
}
|
|
587
|
-
for (const [obj, byProp] of newProps) {
|
|
588
|
-
const text = [...byProp].map(([name, texts]) => `${name}: [${texts.join(', ')}]`).join(', ');
|
|
589
|
-
changes.push(insertPropertyChange(content, obj, text));
|
|
590
|
-
}
|
|
591
|
-
let updated = (0, ast_utils_1.applyChanges)(content, changes);
|
|
592
|
-
for (const symbol of needed.values()) {
|
|
593
|
-
updated = (0, ast_utils_1.ensureNamedImport)(updated, symbol.symbol, importSpecifier(symbol.entrypoint));
|
|
594
|
-
}
|
|
595
|
-
const removeBySpecifier = new Map();
|
|
596
|
-
for (const [local, ref] of refs) {
|
|
597
|
-
if (keep.has(local))
|
|
598
|
-
continue;
|
|
599
|
-
const names = removeBySpecifier.get(ref.specifier) ?? new Set();
|
|
600
|
-
names.add(local);
|
|
601
|
-
removeBySpecifier.set(ref.specifier, names);
|
|
602
|
-
}
|
|
603
|
-
for (const [specifier, names] of removeBySpecifier) {
|
|
604
|
-
updated = removeNamedImports(updated, specifier, names);
|
|
605
|
-
}
|
|
606
|
-
return { updated, manual };
|
|
607
|
-
}
|
|
608
|
-
function migrateModulesToStandalone(options, report) {
|
|
609
|
-
return (tree, context) => {
|
|
610
|
-
const readFile = (filePath) => (tree.exists(filePath) ? tree.readText(filePath) : undefined);
|
|
611
|
-
const resolveAlias = (0, tsconfig_paths_1.createAliasResolver)(tree);
|
|
612
|
-
(0, scope_1.visitScopedFiles)(tree, options, context, (filePath) => {
|
|
613
|
-
if (!filePath.endsWith('.ts') || filePath.endsWith('.d.ts'))
|
|
614
|
-
return;
|
|
615
|
-
const content = tree.readText(filePath);
|
|
616
|
-
if (!content.includes(`${PACKAGE}/`))
|
|
617
|
-
return;
|
|
618
|
-
const { updated, manual } = migrateModulesInContent(filePath, content, readFile, exports.MODULES_MAP, resolveAlias);
|
|
619
|
-
if (updated !== content) {
|
|
620
|
-
tree.overwrite(filePath, (0, eol_1.preserveLineEndings)(content, updated));
|
|
621
|
-
report.markChanged(exports.ITEM_ID, filePath);
|
|
622
|
-
}
|
|
623
|
-
for (const entry of manual) {
|
|
624
|
-
report.addManual(exports.ITEM_ID, { file: filePath, line: entry.line, message: entry.message }, context);
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
};
|
|
628
|
-
}
|
|
629
|
-
function migrate(options = {}) {
|
|
630
|
-
return migrateModulesToStandalone(options, new report_1.MigrationReport());
|
|
631
|
-
}
|
|
632
|
-
//# sourceMappingURL=index.js.map
|