@cornerstonejs/codemods 5.19.4 → 6.0.0-beta.1
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 +23 -0
- package/package.json +2 -2
- package/registry/cornerstone3d/6/README.md +87 -0
- package/registry/cornerstone3d/6/classes-and-types/README.md +113 -0
- package/registry/cornerstone3d/6/classes-and-types/codemod.yaml +20 -0
- package/registry/cornerstone3d/6/classes-and-types/scripts/classes-and-types.ts +1461 -0
- package/registry/cornerstone3d/6/classes-and-types/scripts/lib.ts +2386 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/tsx/edge-namespace-and-reported/expected.tsx +27 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/tsx/edge-namespace-and-reported/input.tsx +27 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/tsx/edge-namespace-and-reported/metrics.json +36 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/edge-already-6/expected.ts +15 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/edge-already-6/input.ts +15 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/negative-other-packages/expected.ts +11 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/negative-other-packages/input.ts +11 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/ohif-3d-family-of-predicate-or-cast-object/expected.ts +55 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/ohif-3d-family-of-predicate-or-cast-object/input.ts +51 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/ohif-3d-family-of-predicate-or-cast-object/metrics.json +36 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/ohif-types-from-the-types-subpath/expected.ts +26 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/ohif-types-from-the-types-subpath/input.ts +26 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/ohif-types-from-the-types-subpath/metrics.json +52 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/positive-3d-evidence/expected.ts +34 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/positive-3d-evidence/input.ts +30 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/positive-3d-evidence/metrics.json +12 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/positive-classes/expected.ts +35 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/positive-classes/input.ts +35 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/positive-classes/metrics.json +28 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/positive-types-and-casts/expected.ts +46 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/positive-types-and-casts/input.ts +42 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-class-import-cleanup-orphans-shorthand/expected.ts +4 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-class-import-cleanup-orphans-shorthand/input.ts +4 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-class-import-cleanup-orphans-shorthand/metrics.json +12 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-instanceof-check-can-prevent-the-first-mount/expected.ts +24 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-instanceof-check-can-prevent-the-first-mount/input.ts +25 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-instanceof-check-can-prevent-the-first-mount/metrics.json +38 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-instanceof-replacement-inverts-comparison/expected.ts +11 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-instanceof-replacement-inverts-comparison/input.ts +11 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-instanceof-replacement-inverts-comparison/metrics.json +20 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-negative-3d-test-taken-as-3d-viewport/expected.ts +29 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-negative-3d-test-taken-as-3d-viewport/input.ts +29 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-negative-3d-test-taken-as-3d-viewport/metrics.json +20 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-re-exports-of-removed-classes/expected.ts +6 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-re-exports-of-removed-classes/input.ts +6 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-re-exports-of-removed-classes/metrics.json +20 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-type-only-namespace-used-as-value/expected.ts +8 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-type-only-namespace-used-as-value/input.ts +8 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review-type-only-namespace-used-as-value/metrics.json +12 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review2-instanceof-mount-proof-crosses-shadowed-binding/expected.ts +19 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review2-instanceof-mount-proof-crosses-shadowed-binding/input.ts +19 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review2-instanceof-mount-proof-crosses-shadowed-binding/metrics.json +22 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review2-unrelated-discriminator-taken-as-3d-proof/expected.ts +40 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review2-unrelated-discriminator-taken-as-3d-proof/input.ts +40 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review2-unrelated-discriminator-taken-as-3d-proof/metrics.json +28 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review3-conditional-viewport-type-taken-as-3d/expected.ts +39 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review3-conditional-viewport-type-taken-as-3d/input.ts +38 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review3-conditional-viewport-type-taken-as-3d/metrics.json +20 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review4-spread-or-computed-key-overrides-viewport-type/expected.ts +76 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review4-spread-or-computed-key-overrides-viewport-type/input.ts +75 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review4-spread-or-computed-key-overrides-viewport-type/metrics.json +36 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review4-viewport-family-proved-on-another-engine/expected.ts +92 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review4-viewport-family-proved-on-another-engine/input.ts +91 -0
- package/registry/cornerstone3d/6/classes-and-types/tests/typescript/review4-viewport-family-proved-on-another-engine/metrics.json +20 -0
- package/registry/cornerstone3d/6/classes-and-types/workflow.yaml +29 -0
- package/registry/cornerstone3d/6/codemod.yaml +19 -0
- package/registry/cornerstone3d/6/display-sets/README.md +173 -0
- package/registry/cornerstone3d/6/display-sets/codemod.yaml +20 -0
- package/registry/cornerstone3d/6/display-sets/scripts/display-sets.ts +965 -0
- package/registry/cornerstone3d/6/display-sets/scripts/lib.ts +2386 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/edge-reported-shapes/expected.tsx +32 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/edge-reported-shapes/input.tsx +32 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/edge-reported-shapes/metrics.json +84 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/edge-reported-shapes-on-a-typed-engine/expected.tsx +33 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/edge-reported-shapes-on-a-typed-engine/input.tsx +33 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/edge-reported-shapes-on-a-typed-engine/metrics.json +84 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/positive-javascript/expected.js +23 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/positive-javascript/input.js +17 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/review-commonjs-module-gets-es-import/expected.js +10 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/review-commonjs-module-gets-es-import/input.js +10 -0
- package/registry/cornerstone3d/6/display-sets/tests/tsx/review-commonjs-module-gets-es-import/metrics.json +12 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/negative-already-6/expected.ts +20 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/negative-already-6/input.ts +20 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/positive-set-volumes-for-viewports/expected.ts +27 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/positive-set-volumes-for-viewports/input.ts +27 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/positive-set-volumes-for-viewports/metrics.json +12 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/positive-stack-and-volume/expected.ts +37 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/positive-stack-and-volume/input.ts +31 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/positive-stack-and-volume/metrics.json +20 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/positive-video-and-ecg/expected.ts +15 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/positive-video-and-ecg/input.ts +15 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-conditional-mount-breaks-control-flow/expected.ts +26 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-conditional-mount-breaks-control-flow/input.ts +18 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-conditional-mount-breaks-control-flow/metrics.json +20 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-conditional-viewport-lists-and-callback-capture/expected.ts +46 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-conditional-viewport-lists-and-callback-capture/input.ts +21 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-generated-references-resolve-to-shadowing-parameter/expected.ts +23 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-generated-references-resolve-to-shadowing-parameter/input.ts +13 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-optional-mounts-become-unconditional/expected.ts +11 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-optional-mounts-become-unconditional/input.ts +11 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-optional-mounts-become-unconditional/metrics.json +28 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-regenerated-import-drops-comments/expected.ts +22 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-regenerated-import-drops-comments/input.ts +15 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-stack-display-set-id-reused-across-series/expected.ts +41 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-stack-display-set-id-reused-across-series/input.ts +16 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-viewport-like-name-rewrites-unrelated-objects/expected.ts +11 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-viewport-like-name-rewrites-unrelated-objects/input.ts +11 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-viewport-like-name-rewrites-unrelated-objects/metrics.json +20 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-volume-helper-binding-still-used/expected.ts +46 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-volume-helper-binding-still-used/input.ts +17 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-volume-helper-binding-still-used/metrics.json +20 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-volume-registration-references-image-list-outside-block/expected.ts +16 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-volume-registration-references-image-list-outside-block/input.ts +16 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review-volume-registration-references-image-list-outside-block/metrics.json +12 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-bracketed-and-re-exported-data-names/expected.ts +19 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-bracketed-and-re-exported-data-names/input.ts +19 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-bracketed-and-re-exported-data-names/metrics.json +44 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-generic-container-taken-as-viewport/expected.ts +22 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-generic-container-taken-as-viewport/input.ts +22 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-generic-container-taken-as-viewport/metrics.json +36 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-image-list-getter-read-twice/expected.ts +62 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-image-list-getter-read-twice/input.ts +28 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-missing-target-partly-updates-layout/expected.ts +50 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-missing-target-partly-updates-layout/input.ts +25 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-missing-target-partly-updates-layout/metrics.json +12 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-reassigned-receiver-keeps-initializer-evidence/expected.ts +45 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-reassigned-receiver-keeps-initializer-evidence/input.ts +39 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-reassigned-receiver-keeps-initializer-evidence/metrics.json +36 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-stack-ids-collide-across-engines/expected.ts +24 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-stack-ids-collide-across-engines/input.ts +12 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-volume-registration-attaches-another-series/expected.ts +47 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-volume-registration-attaches-another-series/input.ts +42 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review2-volume-registration-attaches-another-series/metrics.json +28 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-computed-option-key-overrides-image-ids/expected.ts +18 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-computed-option-key-overrides-image-ids/input.ts +18 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-computed-option-key-overrides-image-ids/metrics.json +12 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-loop-increment-taken-as-volume-creation/expected.ts +18 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-loop-increment-taken-as-volume-creation/input.ts +18 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-loop-increment-taken-as-volume-creation/metrics.json +12 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-mixed-family-targets-partly-update-layout/expected.ts +42 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-mixed-family-targets-partly-update-layout/input.ts +18 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-ecg-mount-empty-after-the-call/expected.ts +18 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-ecg-mount-empty-after-the-call/input.ts +18 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-ecg-mount-empty-after-the-call/metrics.json +20 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-helper-blocks-async-function/expected.ts +18 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-helper-blocks-async-function/input.ts +18 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-helper-blocks-async-function/metrics.json +12 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-stack-mount-blocks-async-function/expected.ts +19 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-stack-mount-blocks-async-function/input.ts +19 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-stack-mount-blocks-async-function/metrics.json +20 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-video-mount-empty-after-the-call/expected.ts +18 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-video-mount-empty-after-the-call/input.ts +18 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-video-mount-empty-after-the-call/metrics.json +20 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-volume-mount-blocks-async-function/expected.ts +23 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-volume-mount-blocks-async-function/input.ts +23 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-unawaited-volume-mount-blocks-async-function/metrics.json +20 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-viewport-getter-read-three-times/expected.ts +34 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review3-viewport-getter-read-three-times/input.ts +19 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review4-argument-getter-redirects-stack-mount/expected.ts +80 -0
- package/registry/cornerstone3d/6/display-sets/tests/typescript/review4-argument-getter-redirects-stack-mount/input.ts +50 -0
- package/registry/cornerstone3d/6/display-sets/workflow.yaml +29 -0
- package/registry/cornerstone3d/6/events/README.md +65 -0
- package/registry/cornerstone3d/6/events/codemod.yaml +20 -0
- package/registry/cornerstone3d/6/events/scripts/events.ts +442 -0
- package/registry/cornerstone3d/6/events/scripts/lib.ts +2386 -0
- package/registry/cornerstone3d/6/events/tests/tsx/edge-reported-and-conflicts/expected.tsx +18 -0
- package/registry/cornerstone3d/6/events/tests/tsx/edge-reported-and-conflicts/input.tsx +18 -0
- package/registry/cornerstone3d/6/events/tests/tsx/edge-reported-and-conflicts/metrics.json +46 -0
- package/registry/cornerstone3d/6/events/tests/typescript/negative-other-events/expected.ts +10 -0
- package/registry/cornerstone3d/6/events/tests/typescript/negative-other-events/input.ts +10 -0
- package/registry/cornerstone3d/6/events/tests/typescript/ohif-core-events-export/expected.ts +22 -0
- package/registry/cornerstone3d/6/events/tests/typescript/ohif-core-events-export/input.ts +22 -0
- package/registry/cornerstone3d/6/events/tests/typescript/ohif-core-events-export/metrics.json +54 -0
- package/registry/cornerstone3d/6/events/tests/typescript/positive-destructured/expected.ts +20 -0
- package/registry/cornerstone3d/6/events/tests/typescript/positive-destructured/input.ts +20 -0
- package/registry/cornerstone3d/6/events/tests/typescript/positive-destructured/metrics.json +12 -0
- package/registry/cornerstone3d/6/events/tests/typescript/positive-members/expected.ts +16 -0
- package/registry/cornerstone3d/6/events/tests/typescript/positive-members/input.ts +16 -0
- package/registry/cornerstone3d/6/events/tests/typescript/positive-members/metrics.json +52 -0
- package/registry/cornerstone3d/6/events/tests/typescript/review-aliased-event-destructuring-left-silently/expected.ts +5 -0
- package/registry/cornerstone3d/6/events/tests/typescript/review-aliased-event-destructuring-left-silently/input.ts +5 -0
- package/registry/cornerstone3d/6/events/tests/typescript/review-aliased-event-destructuring-left-silently/metrics.json +12 -0
- package/registry/cornerstone3d/6/events/tests/typescript/review-event-destructuring-introduces-undeclared-name/expected.ts +9 -0
- package/registry/cornerstone3d/6/events/tests/typescript/review-event-destructuring-introduces-undeclared-name/input.ts +10 -0
- package/registry/cornerstone3d/6/events/tests/typescript/review-event-destructuring-introduces-undeclared-name/metrics.json +20 -0
- package/registry/cornerstone3d/6/events/tests/typescript/review-removed-event-strings-not-reported/expected.ts +11 -0
- package/registry/cornerstone3d/6/events/tests/typescript/review-removed-event-strings-not-reported/input.ts +11 -0
- package/registry/cornerstone3d/6/events/tests/typescript/review-removed-event-strings-not-reported/metrics.json +28 -0
- package/registry/cornerstone3d/6/events/tests/typescript/review2-quoted-defaulted-and-bracketed-event-keys/expected.ts +15 -0
- package/registry/cornerstone3d/6/events/tests/typescript/review2-quoted-defaulted-and-bracketed-event-keys/input.ts +15 -0
- package/registry/cornerstone3d/6/events/tests/typescript/review2-quoted-defaulted-and-bracketed-event-keys/metrics.json +62 -0
- package/registry/cornerstone3d/6/events/workflow.yaml +29 -0
- package/registry/cornerstone3d/6/settings/README.md +69 -0
- package/registry/cornerstone3d/6/settings/codemod.yaml +20 -0
- package/registry/cornerstone3d/6/settings/scripts/lib.ts +2386 -0
- package/registry/cornerstone3d/6/settings/scripts/settings.ts +647 -0
- package/registry/cornerstone3d/6/settings/tests/tsx/edge-namespace-and-reported/expected.tsx +18 -0
- package/registry/cornerstone3d/6/settings/tests/tsx/edge-namespace-and-reported/input.tsx +18 -0
- package/registry/cornerstone3d/6/settings/tests/tsx/edge-namespace-and-reported/metrics.json +46 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/negative-other-names/expected.ts +18 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/negative-other-names/input.ts +18 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/positive-configuration/expected.ts +27 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/positive-configuration/input.ts +28 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/positive-configuration/metrics.json +46 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/positive-functions/expected.ts +32 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/positive-functions/input.ts +33 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/positive-functions/metrics.json +36 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review-aliased-setting-imports-removed-while-used/expected.ts +10 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review-aliased-setting-imports-removed-while-used/input.ts +9 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review-aliased-setting-imports-removed-while-used/metrics.json +22 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review-generated-references-resolve-to-shadowing-locals/expected.ts +12 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review-generated-references-resolve-to-shadowing-locals/input.ts +12 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review-import-name-collision-calls-undefined/expected.ts +9 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review-import-name-collision-calls-undefined/input.ts +9 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review-import-name-collision-calls-undefined/metrics.json +12 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review-settings-deletes-unrelated-configuration/expected.ts +12 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review-settings-deletes-unrelated-configuration/input.ts +12 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review-settings-deletes-unrelated-configuration/metrics.json +28 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review2-adjacent-obsolete-settings/expected.ts +24 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review2-adjacent-obsolete-settings/input.ts +29 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review2-adjacent-obsolete-settings/metrics.json +12 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review2-nested-cpu-getter-in-rewritten-setting/expected.ts +3 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review2-nested-cpu-getter-in-rewritten-setting/input.ts +3 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review2-nested-cpu-getter-in-rewritten-setting/metrics.json +12 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review2-re-exported-setting-names/expected.ts +1 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review2-re-exported-setting-names/input.ts +1 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review2-re-exported-setting-names/metrics.json +20 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review2-spread-boolean-tuple/expected.ts +6 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review2-spread-boolean-tuple/input.ts +6 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review2-spread-boolean-tuple/metrics.json +22 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review3-shorthand-cpu-setting/expected.ts +13 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review3-shorthand-cpu-setting/input.ts +13 -0
- package/registry/cornerstone3d/6/settings/tests/typescript/review3-shorthand-cpu-setting/metrics.json +12 -0
- package/registry/cornerstone3d/6/settings/workflow.yaml +29 -0
- package/registry/cornerstone3d/6/tools/README.md +59 -0
- package/registry/cornerstone3d/6/tools/codemod.yaml +20 -0
- package/registry/cornerstone3d/6/tools/scripts/lib.ts +2386 -0
- package/registry/cornerstone3d/6/tools/scripts/tools.ts +517 -0
- package/registry/cornerstone3d/6/tools/tests/tsx/edge-removed-names/expected.tsx +36 -0
- package/registry/cornerstone3d/6/tools/tests/tsx/edge-removed-names/input.tsx +36 -0
- package/registry/cornerstone3d/6/tools/tests/tsx/edge-removed-names/metrics.json +60 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/negative-other-modules/expected.ts +13 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/negative-other-modules/input.ts +13 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/positive-moved-modules/expected.ts +11 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/positive-moved-modules/input.ts +11 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/positive-viewport-capabilities-to-core/expected.ts +13 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/positive-viewport-capabilities-to-core/input.ts +13 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/review-moved-import-collides-with-local/expected.ts +7 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/review-moved-import-collides-with-local/input.ts +7 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/review-viewport-capabilities-not-plain/expected.ts +26 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/review-viewport-capabilities-not-plain/input.ts +26 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/review-viewport-capabilities-not-plain/metrics.json +60 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/review2-barrel-re-export-of-moved-module/expected.ts +6 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/review2-barrel-re-export-of-moved-module/input.ts +6 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/review2-barrel-re-export-of-moved-module/metrics.json +28 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/review3-side-effect-and-empty-imports-of-deleted-module/expected.ts +12 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/review3-side-effect-and-empty-imports-of-deleted-module/input.ts +12 -0
- package/registry/cornerstone3d/6/tools/tests/typescript/review3-side-effect-and-empty-imports-of-deleted-module/metrics.json +36 -0
- package/registry/cornerstone3d/6/tools/workflow.yaml +29 -0
- package/registry/cornerstone3d/6/viewport-members/README.md +101 -0
- package/registry/cornerstone3d/6/viewport-members/codemod.yaml +20 -0
- package/registry/cornerstone3d/6/viewport-members/scripts/lib.ts +2386 -0
- package/registry/cornerstone3d/6/viewport-members/scripts/viewport-members.ts +815 -0
- package/registry/cornerstone3d/6/viewport-members/tests/tsx/edge-reported-members/expected.tsx +31 -0
- package/registry/cornerstone3d/6/viewport-members/tests/tsx/edge-reported-members/input.tsx +31 -0
- package/registry/cornerstone3d/6/viewport-members/tests/tsx/edge-reported-members/metrics.json +100 -0
- package/registry/cornerstone3d/6/viewport-members/tests/tsx/edge-reported-members-on-a-typed-viewport/expected.tsx +31 -0
- package/registry/cornerstone3d/6/viewport-members/tests/tsx/edge-reported-members-on-a-typed-viewport/input.tsx +31 -0
- package/registry/cornerstone3d/6/viewport-members/tests/tsx/edge-reported-members-on-a-typed-viewport/metrics.json +100 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/negative-other-receivers/expected.ts +24 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/negative-other-receivers/input.ts +24 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/positive-3d-presentation/expected.ts +11 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/positive-3d-presentation/input.ts +11 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/positive-3d-presentation/metrics.json +28 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/positive-engine-render-frame-of-reference/expected.ts +16 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/positive-engine-render-frame-of-reference/input.ts +16 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/positive-engine-render-frame-of-reference/metrics.json +28 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/positive-presentation-and-view/expected.ts +31 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/positive-presentation-and-view/input.ts +31 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/positive-questions-and-actors/expected.ts +31 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/positive-questions-and-actors/input.ts +26 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/positive-questions-and-actors/metrics.json +22 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/positive-video-and-ecg/expected.ts +15 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/positive-video-and-ecg/input.ts +15 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/positive-video-and-ecg/metrics.json +28 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review-generated-imports-invalidate-file-directives/expected.ts +5 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review-generated-imports-invalidate-file-directives/input.ts +5 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review-generated-imports-invalidate-file-directives/metrics.json +12 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review-quoted-presentation-key-loses-effect/expected.ts +12 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review-quoted-presentation-key-loses-effect/input.ts +12 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review-quoted-presentation-key-loses-effect/metrics.json +12 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review-slice-index-rewrite-mishandles-references/expected.ts +12 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review-slice-index-rewrite-mishandles-references/input.ts +12 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review-slice-index-rewrite-mishandles-references/metrics.json +20 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review-viewport-like-name-rewrites-unrelated-objects/expected.ts +9 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review-viewport-like-name-rewrites-unrelated-objects/input.ts +9 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review-viewport-like-name-rewrites-unrelated-objects/metrics.json +20 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review2-bracket-access-hides-removed-methods/expected.ts +11 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review2-bracket-access-hides-removed-methods/input.ts +11 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review2-bracket-access-hides-removed-methods/metrics.json +36 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review2-re-exported-core-helpers/expected.ts +5 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review2-re-exported-core-helpers/input.ts +5 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review2-re-exported-core-helpers/metrics.json +20 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review3-conditional-mount-drops-presentation/expected.ts +58 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review3-conditional-mount-drops-presentation/input.ts +58 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review3-conditional-mount-drops-presentation/metrics.json +20 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review4-strict-bounds-and-actor-volume-ids/expected.ts +16 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review4-strict-bounds-and-actor-volume-ids/input.ts +16 -0
- package/registry/cornerstone3d/6/viewport-members/tests/typescript/review4-strict-bounds-and-actor-volume-ids/metrics.json +12 -0
- package/registry/cornerstone3d/6/viewport-members/workflow.yaml +29 -0
- package/registry/cornerstone3d/6/viewport-types/README.md +73 -0
- package/registry/cornerstone3d/6/viewport-types/codemod.yaml +20 -0
- package/registry/cornerstone3d/6/viewport-types/scripts/lib.ts +2386 -0
- package/registry/cornerstone3d/6/viewport-types/scripts/viewport-types.ts +714 -0
- package/registry/cornerstone3d/6/viewport-types/tests/tsx/edge-reported-sites/expected.tsx +57 -0
- package/registry/cornerstone3d/6/viewport-types/tests/tsx/edge-reported-sites/input.tsx +57 -0
- package/registry/cornerstone3d/6/viewport-types/tests/tsx/edge-reported-sites/metrics.json +70 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/edge-already-6/expected.ts +25 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/edge-already-6/input.ts +25 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/negative-other-names/expected.ts +22 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/negative-other-names/input.ts +22 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/positive-destructured-viewport-type/expected.ts +68 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/positive-destructured-viewport-type/input.ts +65 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/positive-destructured-viewport-type/metrics.json +46 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/positive-namespaced-and-aliased/expected.ts +20 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/positive-namespaced-and-aliased/input.ts +19 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/positive-namespaced-and-aliased/metrics.json +12 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/positive-strings/expected.ts +25 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/positive-strings/input.ts +24 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/positive-strings/metrics.json +22 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review-destructured-viewport-type-members/expected.ts +19 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review-destructured-viewport-type-members/input.ts +19 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review-destructured-viewport-type-members/metrics.json +12 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review-type-check-can-prevent-the-first-mount/expected.ts +27 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review-type-check-can-prevent-the-first-mount/input.ts +27 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review-type-check-can-prevent-the-first-mount/metrics.json +28 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review-viewport-like-name-rewrites-unrelated-objects/expected.ts +9 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review-viewport-like-name-rewrites-unrelated-objects/input.ts +9 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review-viewport-like-name-rewrites-unrelated-objects/metrics.json +20 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review-viewport-type-pass-changes-unrelated-discriminators/expected.ts +18 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review-viewport-type-pass-changes-unrelated-discriminators/input.ts +18 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review-viewport-type-pass-changes-unrelated-discriminators/metrics.json +30 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review2-mount-proof-crosses-shadowed-binding/expected.ts +42 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review2-mount-proof-crosses-shadowed-binding/input.ts +42 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review2-mount-proof-crosses-shadowed-binding/metrics.json +36 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review2-quoted-defaulted-and-bracketed-viewport-type-keys/expected.ts +10 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review2-quoted-defaulted-and-bracketed-viewport-type-keys/input.ts +10 -0
- package/registry/cornerstone3d/6/viewport-types/tests/typescript/review2-quoted-defaulted-and-bracketed-viewport-type-keys/metrics.json +36 -0
- package/registry/cornerstone3d/6/viewport-types/workflow.yaml +29 -0
- package/registry/cornerstone3d/6/workflow.yaml +26 -0
- package/scripts/test-registry-packages.mjs +86 -0
- package/scripts/validate-registry-packages.mjs +43 -2
package/README.md
CHANGED
|
@@ -17,6 +17,16 @@ Run only the Generic Viewport migration:
|
|
|
17
17
|
npx codemod @cornerstonejs/cornerstone3d-5-generic-viewport
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
Run the full Cornerstone3D 6.0 migration, from the latest 5.x:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npx codemod @cornerstonejs/cornerstone3d-6
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
It prints the sites that it leaves to you as the metrics
|
|
27
|
+
`cornerstone3d-6-manual` and `cornerstone3d-6-review`. See
|
|
28
|
+
[registry/cornerstone3d/6/README.md](registry/cornerstone3d/6/README.md).
|
|
29
|
+
|
|
20
30
|
## Registry Packages
|
|
21
31
|
|
|
22
32
|
This workspace currently includes:
|
|
@@ -35,6 +45,14 @@ The Generic Viewport migration changes:
|
|
|
35
45
|
For simple variable declarations, `getStackViewport(id)` also adds a runtime
|
|
36
46
|
capability guard.
|
|
37
47
|
|
|
48
|
+
- `@cornerstonejs/cornerstone3d-6`: runs the seven Cornerstone3D 6.0
|
|
49
|
+
migration packages in the recommended order: `-settings`,
|
|
50
|
+
`-viewport-types`, `-classes-and-types`, `-events`, `-display-sets`,
|
|
51
|
+
`-viewport-members` and `-tools` (each under
|
|
52
|
+
`@cornerstonejs/cornerstone3d-6-`). Each package keeps a copy of
|
|
53
|
+
`scripts/lib.ts`, because each is published on its own;
|
|
54
|
+
`yarn validate:registry` checks that the copies are equal.
|
|
55
|
+
|
|
38
56
|
## Development
|
|
39
57
|
|
|
40
58
|
Validate all registry packages and run fixture tests:
|
|
@@ -58,6 +76,11 @@ cd packages/codemods
|
|
|
58
76
|
yarn test
|
|
59
77
|
```
|
|
60
78
|
|
|
79
|
+
`yarn test` runs the fixtures of every registry package. A 6.0 package keeps
|
|
80
|
+
the fixtures of `.ts` files in `tests/typescript`, parsed as TypeScript, and
|
|
81
|
+
the others in `tests/tsx`; each `metrics.json` holds the sites that a fixture
|
|
82
|
+
reports.
|
|
83
|
+
|
|
61
84
|
Run a local registry package against a target checkout:
|
|
62
85
|
|
|
63
86
|
```sh
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/codemods",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-beta.1",
|
|
4
4
|
"description": "Codemod registry packages for Cornerstone3D migrations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cornerstone3d",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"clean": "shx rm -rf dist",
|
|
21
21
|
"clean:deep": "pnpm run clean && shx rm -rf node_modules",
|
|
22
22
|
"dev": "pnpm run test",
|
|
23
|
-
"test": "
|
|
23
|
+
"test": "node scripts/test-registry-packages.mjs",
|
|
24
24
|
"validate": "pnpm run validate:registry && pnpm run test",
|
|
25
25
|
"validate:registry": "node scripts/validate-registry-packages.mjs",
|
|
26
26
|
"lint": "oxlint ."
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Cornerstone3D 6.0 Migration
|
|
2
|
+
|
|
3
|
+
Runs the Cornerstone3D 6.0 migration codemods in the recommended order. They
|
|
4
|
+
do the mechanical part of the
|
|
5
|
+
[6.0 upgrade](https://www.cornerstonejs.org/docs/migration-guides/6x/upgrade-step-by-step):
|
|
6
|
+
the renames, and the rewrites that need no knowledge of the application. They
|
|
7
|
+
report every site that needs the application, and they write no comment into
|
|
8
|
+
your code.
|
|
9
|
+
|
|
10
|
+
They change code only where the file shows that it is Cornerstone's: a name
|
|
11
|
+
bound to an import of `@cornerstonejs/*`, a viewport got from a rendering
|
|
12
|
+
engine, an enabled element or a Cornerstone type, a viewport input or a
|
|
13
|
+
configuration that reaches a Cornerstone call. A variable named `viewport`
|
|
14
|
+
alone puts the site in the report. A CommonJS module gets no `import`.
|
|
15
|
+
|
|
16
|
+
They rewrite a site only when every input it depends on has a shape they
|
|
17
|
+
fully understand, and report it otherwise:
|
|
18
|
+
|
|
19
|
+
- A receiver or an engine is shown by a `const`, or by a parameter that the
|
|
20
|
+
file never writes, whose value or top type is Cornerstone's. A `let`, a
|
|
21
|
+
`var`, an assignment and a type argument (`History<Types.IViewport>`) show
|
|
22
|
+
nothing.
|
|
23
|
+
- A mount, a type or a family holds only for the same binding in the same
|
|
24
|
+
function: a shadowing name, a closure, or a test of another value (a
|
|
25
|
+
parameter `type`, a `cardType`) proves nothing.
|
|
26
|
+
- An argument that a rewrite reads twice is read once into a `const` when it
|
|
27
|
+
is not a name, a literal or an array of those; a spread argument is
|
|
28
|
+
reported.
|
|
29
|
+
- A quoted key, a key with a default, a string in brackets and an
|
|
30
|
+
`export { ... } from` name the same member as the plain form: each is
|
|
31
|
+
rewritten or reported.
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
Start from the latest 5.x, on a clean branch.
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
npx codemod @cornerstonejs/cornerstone3d-6
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
To preview changes before writing files:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
npx codemod @cornerstonejs/cornerstone3d-6 --dry-run
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Then run your formatter and your type checker, and work through the report.
|
|
48
|
+
|
|
49
|
+
## The report
|
|
50
|
+
|
|
51
|
+
At the end of the run the tool prints two metrics. Each entry names a rule, a
|
|
52
|
+
file and a line.
|
|
53
|
+
|
|
54
|
+
- `cornerstone3d-6-manual`: a site that the codemod did not change. The rule
|
|
55
|
+
says what it is, for example `setVolumes: the input has callback` or
|
|
56
|
+
`ViewportType.PERSPECTIVE`. Look up the name in
|
|
57
|
+
[Every legacy call and what replaces it](https://www.cornerstonejs.org/docs/migration-guides/6x/api-map).
|
|
58
|
+
- `cornerstone3d-6-review`: a site that the codemod rewrote where the guide
|
|
59
|
+
lists a decision, for example a `STACK_NEW_IMAGE` listener that now hears
|
|
60
|
+
`NEW_IMAGE` for the slices of a volume too, or an `ORTHOGRAPHIC` viewport
|
|
61
|
+
that got the 5.x default orientation `AXIAL` written out.
|
|
62
|
+
|
|
63
|
+
## Included Migrations
|
|
64
|
+
|
|
65
|
+
In the order in which they run:
|
|
66
|
+
|
|
67
|
+
1. `@cornerstonejs/cornerstone3d-6-settings`: the removed settings
|
|
68
|
+
(`useGenericViewport`, `useCPURendering` and the CPU functions).
|
|
69
|
+
2. `@cornerstonejs/cornerstone3d-6-viewport-types`: `STACK`,
|
|
70
|
+
`ORTHOGRAPHIC`, the `_NEXT` names and the `*Next` strings.
|
|
71
|
+
3. `@cornerstonejs/cornerstone3d-6-classes-and-types`: the legacy classes,
|
|
72
|
+
`Types.IStackViewport` and its kin, the deprecated class aliases.
|
|
73
|
+
4. `@cornerstonejs/cornerstone3d-6-events`: `STACK_NEW_IMAGE`,
|
|
74
|
+
`VOLUME_NEW_IMAGE` and `IMAGE_LOAD_ERROR` with their event types.
|
|
75
|
+
5. `@cornerstonejs/cornerstone3d-6-display-sets`: `setStack`, `setVolumes`,
|
|
76
|
+
`setVolumesForViewports`, `setVideo` and `setEcg`.
|
|
77
|
+
6. `@cornerstonejs/cornerstone3d-6-viewport-members`: the legacy members with
|
|
78
|
+
a fixed 6.0 call, such as `resetCamera` and `setProperties`.
|
|
79
|
+
7. `@cornerstonejs/cornerstone3d-6-tools`: two moved modules of the tools,
|
|
80
|
+
and the removed names of the tools.
|
|
81
|
+
|
|
82
|
+
Each package has a README with what it changes and what it reports.
|
|
83
|
+
|
|
84
|
+
## Publishing
|
|
85
|
+
|
|
86
|
+
Publish the seven child packages before this aggregate package. The workflow
|
|
87
|
+
resolves them from the Codemod registry at runtime.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Cornerstone3D 6.0 Classes and Types Migration
|
|
2
|
+
|
|
3
|
+
Rewrites the viewport classes and TypeScript types that Cornerstone3D 6.0
|
|
4
|
+
removes or renames. Step 2 of the
|
|
5
|
+
[upgrade](https://www.cornerstonejs.org/docs/migration-guides/6x/upgrade-step-by-step#step-2-class-checks-and-typescript-types).
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx codemod @cornerstonejs/cornerstone3d-6-classes-and-types
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Changes
|
|
14
|
+
|
|
15
|
+
- `Types.IStackViewport`, `Types.IVolumeViewport` and
|
|
16
|
+
`Types.IBaseVolumeViewport` become `PlanarViewport`;
|
|
17
|
+
`Types.IVideoViewport`, `Types.IWSIViewport` and `Types.IECGViewport`
|
|
18
|
+
become `VideoViewport`, `WSIViewport` and `ECGViewport`. The class comes in
|
|
19
|
+
as a type import of `@cornerstonejs/core`.
|
|
20
|
+
- `Types.IVolumeViewport`, `Types.IBaseVolumeViewport` and
|
|
21
|
+
`BaseVolumeViewport` become `VolumeViewport3D` where the file shows a 3D
|
|
22
|
+
viewport: every viewport input with the id of the `getViewport` call (the
|
|
23
|
+
same string, or the same `const`) has the type `VOLUME_3D`, as a member
|
|
24
|
+
of the core `Enums.ViewportType` or the string `'volume3d'`, and one of
|
|
25
|
+
them is given to the engine of the call (`enableElement(input)`, or
|
|
26
|
+
`setViewports` of an array literal that holds it, also through a `const`;
|
|
27
|
+
the same engine is the same binding, or `new RenderingEngine(id)` and
|
|
28
|
+
`getRenderingEngine(id)` with the same id, also through a `let` whose
|
|
29
|
+
every value is that engine), or the node runs only when the type of that
|
|
30
|
+
viewport equals `VOLUME_3D` (an enclosing `if`, `else` or `case` of the
|
|
31
|
+
same function that compares
|
|
32
|
+
`<viewport>.type`, or a `const` that holds it such as
|
|
33
|
+
`const { type } = viewport`, where `<viewport>` is the binding that the
|
|
34
|
+
cast casts; without a negation or `||`, and a `case` that no case falls
|
|
35
|
+
into). Applications cast 3D viewports to `IVolumeViewport` in 5.x. Where a
|
|
36
|
+
test of `VOLUME_3D` encloses the node and decides nothing (a test of
|
|
37
|
+
another value such as a parameter `type` or a `cardType`, of a shadowing
|
|
38
|
+
name, or outside the function of the node), the type stays and is
|
|
39
|
+
reported. An input counts with its last `viewportId` and `type` entries
|
|
40
|
+
(`['type']` too). An input given to an engine of another string id
|
|
41
|
+
(`new RenderingEngine('a')` against `getRenderingEngine('b')`) does not
|
|
42
|
+
count: viewport ids belong to one engine. A cast of an object literal
|
|
43
|
+
takes the family of the last `type` entry of the object, when no spread
|
|
44
|
+
or computed key after it can replace it:
|
|
45
|
+
`{ ...base, type: Enums.ViewportType.VOLUME_3D } as Types.IVolumeViewport`
|
|
46
|
+
becomes `VolumeViewport3D`.
|
|
47
|
+
- A cast of `getViewport` on a typed rendering engine becomes its type
|
|
48
|
+
argument: `renderingEngine.getViewport(id) as Types.IStackViewport` becomes
|
|
49
|
+
`renderingEngine.getViewport<PlanarViewport>(id)`. On an untyped engine the
|
|
50
|
+
cast stays, with the class.
|
|
51
|
+
- `Types.IGenericViewport` becomes `Types.IViewport`.
|
|
52
|
+
- The legacy classes `StackViewport`, `VolumeViewport` and
|
|
53
|
+
`BaseVolumeViewport` become `PlanarViewport` in a type, and `Viewport`
|
|
54
|
+
becomes `GenericViewport`.
|
|
55
|
+
- `x instanceof StackViewport` becomes `utilities.viewportIsInStackMode(x)`,
|
|
56
|
+
`VolumeViewport` `(utilities.getViewportContentMode(x) === 'volume')` (in
|
|
57
|
+
parentheses where the comparison would bind otherwise),
|
|
58
|
+
`BaseVolumeViewport` `utilities.viewportIsInVolumeMode(x)`. Only after an
|
|
59
|
+
awaited mount of the same binding of `x` (`await x.setStack(...)` and its
|
|
60
|
+
kin) that runs before it in the same function, where `x` is a `const` or a
|
|
61
|
+
parameter that the file never writes: before its first mount a viewport is
|
|
62
|
+
in the mode `empty`, where a 5.x instance check was already true.
|
|
63
|
+
- `GenericVolumeViewport3D`, `VideoGenericViewport`, `WSIGenericViewport`,
|
|
64
|
+
`ECGGenericViewport` and the legacy `LegacyVolumeViewport3D` become
|
|
65
|
+
`VolumeViewport3D`, `VideoViewport`, `WSIViewport` and `ECGViewport`, in
|
|
66
|
+
the import and in every use. A shorthand property and an export keep their
|
|
67
|
+
public name (`{ GenericVolumeViewport3D: VolumeViewport3D }`,
|
|
68
|
+
`export { VolumeViewport3D as GenericVolumeViewport3D }`), and so does a
|
|
69
|
+
re-export of the core.
|
|
70
|
+
|
|
71
|
+
## Reported
|
|
72
|
+
|
|
73
|
+
- Review: each `instanceof` rewrite.
|
|
74
|
+
- Manual: an `instanceof` before a mount
|
|
75
|
+
(`the viewport may not show its data yet`), a legacy class used as a value
|
|
76
|
+
(`new StackViewport(...)`, a shorthand property, an export or a re-export
|
|
77
|
+
of the core; its import stays), a class in brackets on the core namespace
|
|
78
|
+
(`cs['StackViewport']`), an `IVolumeViewport` under a test of
|
|
79
|
+
`VOLUME_3D` that does not show the family, the type of a type predicate
|
|
80
|
+
(`viewport is Types.IVolumeViewport`) whose function names `VOLUME_3D` in
|
|
81
|
+
its body (the body decides when it holds, and a 3D viewport is a
|
|
82
|
+
`VolumeViewport3D`), a cast of an object that names `VOLUME_3D` in
|
|
83
|
+
another place than a last `type` entry, an `IVolumeViewport` whose
|
|
84
|
+
viewport inputs give `VOLUME_3D` and another type, or a type that only
|
|
85
|
+
the running code resolves (`type: flag ? VOLUME_3D : PLANAR`, a name, a
|
|
86
|
+
call, or a `viewportId` or `type` that a spread, a computed key such as
|
|
87
|
+
`[key]: value` or a getter after it can replace, or a type that a spread
|
|
88
|
+
can give: `{ ...base, viewportId }`), an `IVolumeViewport` whose
|
|
89
|
+
`VOLUME_3D` input is not shown on the engine of the call (another engine
|
|
90
|
+
binding, an input from a helper or `push`, `this.renderingEngine`), the
|
|
91
|
+
removed `Types.*ViewportProperties`, `Types.IVolumeInput`,
|
|
92
|
+
`Types.VolumeInputCallback`, `Types.SetAspectRatioOptions` and
|
|
93
|
+
`Types.ImageSetOptions`, a removed or renamed `Types` name
|
|
94
|
+
(`IStackViewport` and its kin, `IGenericViewport`, and the removed names
|
|
95
|
+
above) that a file imports or re-exports from the subpath
|
|
96
|
+
`@cornerstonejs/core/types`, such as
|
|
97
|
+
`import { IStackViewport } from '@cornerstonejs/core/types'` (reported by
|
|
98
|
+
its `Types` name: the rewrites read `Types.X` only), and
|
|
99
|
+
`utilities.isGenericViewport(...)`
|
|
100
|
+
(deprecated: drop the check and keep its true branch).
|
|
101
|
+
|
|
102
|
+
## Development
|
|
103
|
+
|
|
104
|
+
From `packages/codemods`:
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
yarn test
|
|
108
|
+
npx codemod workflow validate -w registry/cornerstone3d/6/classes-and-types
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The fixtures of `.ts` files are in `tests/typescript` (parsed as TypeScript,
|
|
112
|
+
so `<Type>value` casts parse), the others in `tests/tsx`. Each
|
|
113
|
+
`metrics.json` holds the sites that a fixture reports.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
schema_version: '1.0'
|
|
2
|
+
name: '@cornerstonejs/cornerstone3d-6-classes-and-types'
|
|
3
|
+
version: '0.1.0'
|
|
4
|
+
description: 'Rewrite the removed Cornerstone3D viewport classes and TypeScript types to their 6.0 classes.'
|
|
5
|
+
author: 'Cornerstone.js Contributors'
|
|
6
|
+
license: 'MIT'
|
|
7
|
+
workflow: 'workflow.yaml'
|
|
8
|
+
repository: 'https://github.com/cornerstonejs/cornerstone3D'
|
|
9
|
+
category: 'migration'
|
|
10
|
+
targets:
|
|
11
|
+
languages: ['typescript', 'tsx', 'javascript', 'jsx']
|
|
12
|
+
keywords:
|
|
13
|
+
- cornerstone3d
|
|
14
|
+
- migration
|
|
15
|
+
- upgrade
|
|
16
|
+
- v6
|
|
17
|
+
- classes-and-types
|
|
18
|
+
registry:
|
|
19
|
+
access: 'public'
|
|
20
|
+
visibility: 'public'
|