@cornerstonejs/codemods 5.19.3 → 6.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Enums, RenderingEngine, type Types } from '@cornerstonejs/core';
|
|
2
|
+
|
|
3
|
+
const engine = new RenderingEngine('engine');
|
|
4
|
+
|
|
5
|
+
export function spreadAfterType(
|
|
6
|
+
element: HTMLDivElement,
|
|
7
|
+
overrides: Record<string, unknown>
|
|
8
|
+
) {
|
|
9
|
+
engine.enableElement({
|
|
10
|
+
viewportId: 'spread',
|
|
11
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
12
|
+
element,
|
|
13
|
+
...overrides,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return engine.getViewport('spread') as Types.IVolumeViewport;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function computedKeyAfterType(
|
|
20
|
+
element: HTMLDivElement,
|
|
21
|
+
key: string,
|
|
22
|
+
value: Enums.ViewportType
|
|
23
|
+
) {
|
|
24
|
+
engine.enableElement({
|
|
25
|
+
viewportId: 'computed',
|
|
26
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
27
|
+
element,
|
|
28
|
+
[key]: value,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
return engine.getViewport('computed') as Types.IVolumeViewport;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function spreadAfterId(
|
|
35
|
+
element: HTMLDivElement,
|
|
36
|
+
overrides: Record<string, unknown>
|
|
37
|
+
) {
|
|
38
|
+
engine.enableElement({
|
|
39
|
+
viewportId: 'renamed',
|
|
40
|
+
...overrides,
|
|
41
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
42
|
+
element,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return engine.getViewport('renamed') as Types.IVolumeViewport;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function typeFromSpread(
|
|
49
|
+
first: HTMLDivElement,
|
|
50
|
+
second: HTMLDivElement,
|
|
51
|
+
base: Record<string, unknown>
|
|
52
|
+
) {
|
|
53
|
+
engine.enableElement({
|
|
54
|
+
viewportId: 'based',
|
|
55
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
56
|
+
element: first,
|
|
57
|
+
});
|
|
58
|
+
engine.enableElement({ ...base, viewportId: 'based', element: second });
|
|
59
|
+
|
|
60
|
+
return engine.getViewport('based') as Types.IVolumeViewport;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function spreadBeforeEntries(
|
|
64
|
+
element: HTMLDivElement,
|
|
65
|
+
defaults: Record<string, unknown>
|
|
66
|
+
) {
|
|
67
|
+
engine.enableElement({
|
|
68
|
+
...defaults,
|
|
69
|
+
viewportId: 'defaults',
|
|
70
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
71
|
+
element,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return engine.getViewport('defaults') as Types.IVolumeViewport;
|
|
75
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cornerstone3d-6-manual": [
|
|
3
|
+
{
|
|
4
|
+
"cardinality": {
|
|
5
|
+
"file": "input.ts",
|
|
6
|
+
"line": "16",
|
|
7
|
+
"rule": "Types.IVolumeViewport: the inputs of this viewport id do not give one static type"
|
|
8
|
+
},
|
|
9
|
+
"count": 1
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"cardinality": {
|
|
13
|
+
"file": "input.ts",
|
|
14
|
+
"line": "31",
|
|
15
|
+
"rule": "Types.IVolumeViewport: the inputs of this viewport id do not give one static type"
|
|
16
|
+
},
|
|
17
|
+
"count": 1
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"cardinality": {
|
|
21
|
+
"file": "input.ts",
|
|
22
|
+
"line": "45",
|
|
23
|
+
"rule": "Types.IVolumeViewport: the inputs of this viewport id do not give one static type"
|
|
24
|
+
},
|
|
25
|
+
"count": 1
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"cardinality": {
|
|
29
|
+
"file": "input.ts",
|
|
30
|
+
"line": "60",
|
|
31
|
+
"rule": "Types.IVolumeViewport: the inputs of this viewport id do not give one static type"
|
|
32
|
+
},
|
|
33
|
+
"count": 1
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { PlanarViewport, VolumeViewport3D } from '@cornerstonejs/core';
|
|
2
|
+
import {
|
|
3
|
+
Enums,
|
|
4
|
+
RenderingEngine,
|
|
5
|
+
getRenderingEngine,
|
|
6
|
+
type Types,
|
|
7
|
+
} from '@cornerstonejs/core';
|
|
8
|
+
|
|
9
|
+
const MAIN_ENGINE_ID = 'main';
|
|
10
|
+
|
|
11
|
+
let mainEngine;
|
|
12
|
+
|
|
13
|
+
export function otherEngineInput(
|
|
14
|
+
otherEngine: RenderingEngine,
|
|
15
|
+
currentEngine: RenderingEngine,
|
|
16
|
+
element: HTMLDivElement
|
|
17
|
+
) {
|
|
18
|
+
otherEngine.enableElement({
|
|
19
|
+
viewportId: 'unrelated',
|
|
20
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
21
|
+
element,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return currentEngine.getViewport('unrelated') as Types.IVolumeViewport;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function engineOfAnotherId(element: HTMLDivElement) {
|
|
28
|
+
const left = new RenderingEngine('left');
|
|
29
|
+
|
|
30
|
+
left.enableElement({
|
|
31
|
+
viewportId: 'side',
|
|
32
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
33
|
+
element,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return getRenderingEngine('right').getViewport<PlanarViewport>(
|
|
37
|
+
'side'
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function inputsFor(element: HTMLDivElement) {
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
viewportId: 'helper',
|
|
45
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
46
|
+
element,
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function inputsFromAHelper(element: HTMLDivElement) {
|
|
52
|
+
const engine = getRenderingEngine(MAIN_ENGINE_ID);
|
|
53
|
+
|
|
54
|
+
engine.setViewports(inputsFor(element));
|
|
55
|
+
|
|
56
|
+
return engine.getViewport('helper') as Types.IVolumeViewport;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function setUpMain(element: HTMLDivElement) {
|
|
60
|
+
mainEngine = new RenderingEngine(MAIN_ENGINE_ID);
|
|
61
|
+
|
|
62
|
+
const viewportInputArray = [
|
|
63
|
+
{
|
|
64
|
+
viewportId: 'volume',
|
|
65
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
66
|
+
element,
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
mainEngine.setViewports(viewportInputArray);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function volumeOfMain() {
|
|
74
|
+
const engine = getRenderingEngine(MAIN_ENGINE_ID);
|
|
75
|
+
|
|
76
|
+
return engine.getViewport<VolumeViewport3D>('volume');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function sameBinding(
|
|
80
|
+
engine: RenderingEngine,
|
|
81
|
+
element: HTMLDivElement
|
|
82
|
+
) {
|
|
83
|
+
const viewportInput = {
|
|
84
|
+
viewportId: 'local',
|
|
85
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
86
|
+
element,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
engine.enableElement(viewportInput);
|
|
90
|
+
|
|
91
|
+
return engine.getViewport<VolumeViewport3D>('local');
|
|
92
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Enums,
|
|
3
|
+
RenderingEngine,
|
|
4
|
+
getRenderingEngine,
|
|
5
|
+
type Types,
|
|
6
|
+
} from '@cornerstonejs/core';
|
|
7
|
+
|
|
8
|
+
const MAIN_ENGINE_ID = 'main';
|
|
9
|
+
|
|
10
|
+
let mainEngine;
|
|
11
|
+
|
|
12
|
+
export function otherEngineInput(
|
|
13
|
+
otherEngine: RenderingEngine,
|
|
14
|
+
currentEngine: RenderingEngine,
|
|
15
|
+
element: HTMLDivElement
|
|
16
|
+
) {
|
|
17
|
+
otherEngine.enableElement({
|
|
18
|
+
viewportId: 'unrelated',
|
|
19
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
20
|
+
element,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return currentEngine.getViewport('unrelated') as Types.IVolumeViewport;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function engineOfAnotherId(element: HTMLDivElement) {
|
|
27
|
+
const left = new RenderingEngine('left');
|
|
28
|
+
|
|
29
|
+
left.enableElement({
|
|
30
|
+
viewportId: 'side',
|
|
31
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
32
|
+
element,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return getRenderingEngine('right').getViewport(
|
|
36
|
+
'side'
|
|
37
|
+
) as Types.IVolumeViewport;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function inputsFor(element: HTMLDivElement) {
|
|
41
|
+
return [
|
|
42
|
+
{
|
|
43
|
+
viewportId: 'helper',
|
|
44
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
45
|
+
element,
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function inputsFromAHelper(element: HTMLDivElement) {
|
|
51
|
+
const engine = getRenderingEngine(MAIN_ENGINE_ID);
|
|
52
|
+
|
|
53
|
+
engine.setViewports(inputsFor(element));
|
|
54
|
+
|
|
55
|
+
return engine.getViewport('helper') as Types.IVolumeViewport;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function setUpMain(element: HTMLDivElement) {
|
|
59
|
+
mainEngine = new RenderingEngine(MAIN_ENGINE_ID);
|
|
60
|
+
|
|
61
|
+
const viewportInputArray = [
|
|
62
|
+
{
|
|
63
|
+
viewportId: 'volume',
|
|
64
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
65
|
+
element,
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
mainEngine.setViewports(viewportInputArray);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function volumeOfMain() {
|
|
73
|
+
const engine = getRenderingEngine(MAIN_ENGINE_ID);
|
|
74
|
+
|
|
75
|
+
return engine.getViewport('volume') as Types.IVolumeViewport;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function sameBinding(
|
|
79
|
+
engine: RenderingEngine,
|
|
80
|
+
element: HTMLDivElement
|
|
81
|
+
) {
|
|
82
|
+
const viewportInput = {
|
|
83
|
+
viewportId: 'local',
|
|
84
|
+
type: Enums.ViewportType.VOLUME_3D,
|
|
85
|
+
element,
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
engine.enableElement(viewportInput);
|
|
89
|
+
|
|
90
|
+
return engine.getViewport('local') as Types.IVolumeViewport;
|
|
91
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cornerstone3d-6-manual": [
|
|
3
|
+
{
|
|
4
|
+
"cardinality": {
|
|
5
|
+
"file": "input.ts",
|
|
6
|
+
"line": "23",
|
|
7
|
+
"rule": "Types.IVolumeViewport: the 3D input of this viewport id is not tied to the engine of this call"
|
|
8
|
+
},
|
|
9
|
+
"count": 1
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"cardinality": {
|
|
13
|
+
"file": "input.ts",
|
|
14
|
+
"line": "55",
|
|
15
|
+
"rule": "Types.IVolumeViewport: the 3D input of this viewport id is not tied to the engine of this call"
|
|
16
|
+
},
|
|
17
|
+
"count": 1
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
version: '1'
|
|
2
|
+
nodes:
|
|
3
|
+
- id: classes-and-types
|
|
4
|
+
name: Cornerstone3D 6.0 classes and types
|
|
5
|
+
steps:
|
|
6
|
+
- name: Rewrite the classes and types in TypeScript files
|
|
7
|
+
js-ast-grep:
|
|
8
|
+
js_file: scripts/classes-and-types.ts
|
|
9
|
+
language: typescript
|
|
10
|
+
base_path: .
|
|
11
|
+
semantic_analysis: file
|
|
12
|
+
include:
|
|
13
|
+
- '**/*.{ts,mts,cts}'
|
|
14
|
+
exclude:
|
|
15
|
+
- '**/node_modules/**'
|
|
16
|
+
- '**/dist/**'
|
|
17
|
+
- '**/build/**'
|
|
18
|
+
- name: Rewrite the classes and types in TSX and JavaScript files
|
|
19
|
+
js-ast-grep:
|
|
20
|
+
js_file: scripts/classes-and-types.ts
|
|
21
|
+
language: tsx
|
|
22
|
+
base_path: .
|
|
23
|
+
semantic_analysis: file
|
|
24
|
+
include:
|
|
25
|
+
- '**/*.{tsx,js,jsx,mjs,cjs}'
|
|
26
|
+
exclude:
|
|
27
|
+
- '**/node_modules/**'
|
|
28
|
+
- '**/dist/**'
|
|
29
|
+
- '**/build/**'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
schema_version: '1.0'
|
|
2
|
+
name: '@cornerstonejs/cornerstone3d-6'
|
|
3
|
+
version: '0.1.0'
|
|
4
|
+
description: 'Apply the Cornerstone3D 6.0 migration transforms in the recommended order.'
|
|
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
|
+
registry:
|
|
18
|
+
access: 'public'
|
|
19
|
+
visibility: 'public'
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Cornerstone3D 6.0 Display Sets Migration
|
|
2
|
+
|
|
3
|
+
Rewrites the data calls of the legacy viewports to display sets. Step 3 of
|
|
4
|
+
the
|
|
5
|
+
[upgrade](https://www.cornerstonejs.org/docs/migration-guides/6x/upgrade-step-by-step#step-3-the-data).
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx codemod @cornerstonejs/cornerstone3d-6-display-sets
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Changes
|
|
14
|
+
|
|
15
|
+
Only on a viewport that the file shows to come from Cornerstone: a call of
|
|
16
|
+
`getViewport` on a rendering engine made with `new RenderingEngine` or got
|
|
17
|
+
with `getRenderingEngine`, the `viewport` of `getEnabledElement`, a cast or
|
|
18
|
+
annotation whose top type is a Cornerstone viewport type, or a `const` (or a
|
|
19
|
+
parameter that the file never writes) that holds one of these. A name such
|
|
20
|
+
as `viewport` alone, a `let`, a `var` and a container type such as
|
|
21
|
+
`History<Types.IViewport>` are reported.
|
|
22
|
+
|
|
23
|
+
- `viewport.setStack(imageIds, index)` as a statement, on a viewport that is
|
|
24
|
+
a name or a member chain, becomes:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
const displaySetId = JSON.stringify([
|
|
28
|
+
viewport.renderingEngineId,
|
|
29
|
+
viewport.id,
|
|
30
|
+
imageIds[0],
|
|
31
|
+
]);
|
|
32
|
+
utilities.genericViewportDisplaySetMetadataProvider.add(displaySetId, {
|
|
33
|
+
kind: 'planar',
|
|
34
|
+
imageIds,
|
|
35
|
+
initialImageIdIndex: index,
|
|
36
|
+
});
|
|
37
|
+
await viewport.setDisplaySets({ displaySetId });
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The id is the JSON of the rendering engine id, the viewport id and the
|
|
41
|
+
first image id: another series gets another id, so the viewport drops the
|
|
42
|
+
segmentation overlays of the series before, and two engines with a
|
|
43
|
+
viewport of one id never share a registration. JSON keeps the three parts
|
|
44
|
+
apart, so engine `'a:b'` with viewport `'c'` and engine `'a'` with viewport
|
|
45
|
+
`'b:c'` get two ids. The index is 0 when the call had none, as in 5.x. A
|
|
46
|
+
viewport that is a member chain (`holder.viewport`, `this.viewport`, the
|
|
47
|
+
`viewport` of an enabled element), which can be a getter, is read once
|
|
48
|
+
into a fresh `const` first, and so is a name that a write can change (a
|
|
49
|
+
`let`, a `var`, a written parameter) when an argument is not a name, a
|
|
50
|
+
literal or an array of those: a getter or a call in it can assign the
|
|
51
|
+
name, and the old call had read the viewport before its arguments. An
|
|
52
|
+
image list that is not a name, a literal or an array of those (a property
|
|
53
|
+
read, an index, a call) is read once into a fresh `const` after it, as
|
|
54
|
+
the old call read each once and in that order.
|
|
55
|
+
|
|
56
|
+
- `viewport.setVolumes([{ volumeId }])` and
|
|
57
|
+
`setVolumesForViewports(renderingEngine, [{ volumeId }], viewportIds)` as
|
|
58
|
+
statements become a registration under the volume id and
|
|
59
|
+
`setDisplaySets({ displaySetId: volumeId })` on each viewport, when the
|
|
60
|
+
function of the call creates that volume with
|
|
61
|
+
`volumeLoader.createAndCacheVolume(volumeId, { imageIds })` in a statement
|
|
62
|
+
that runs before the call on every path: an expression statement or a
|
|
63
|
+
declaration, not a part of a loop or of an `if` (the increment of a `for`
|
|
64
|
+
that its body leaves with `break` never runs). The volume id is a string
|
|
65
|
+
or a `const` (or an unwritten parameter), the same binding at the creation
|
|
66
|
+
and at the call, and `imageIds` is such a name in scope at the call. The
|
|
67
|
+
options of the creation have no computed key (`['imageIds']`, `[key]`)
|
|
68
|
+
and one `imageIds` only: the loader takes the last entry.
|
|
69
|
+
- `setVolumesForViewports` looks up and checks every viewport first and
|
|
70
|
+
throws, as 5.x did, before the registration and before any mount when one
|
|
71
|
+
is missing or is not planar or 3D (5.x took only viewports with
|
|
72
|
+
`setVolumes`):
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
const viewports = viewportIds.map((viewportId) => {
|
|
76
|
+
const viewport = renderingEngine.getViewport(viewportId);
|
|
77
|
+
|
|
78
|
+
if (!viewport) {
|
|
79
|
+
throw new Error(`Viewport with Id ${viewportId} does not exist`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (
|
|
83
|
+
viewport.type !== Enums.ViewportType.PLANAR &&
|
|
84
|
+
viewport.type !== Enums.ViewportType.VOLUME_3D
|
|
85
|
+
) {
|
|
86
|
+
throw new Error(
|
|
87
|
+
'setVolumesForViewports only supports viewports that implement setVolumes'
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return viewport;
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
utilities.genericViewportDisplaySetMetadataProvider.add(volumeId, {
|
|
95
|
+
kind: 'planar',
|
|
96
|
+
imageIds,
|
|
97
|
+
volumeId,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
await Promise.all(
|
|
101
|
+
viewports.map((viewport) =>
|
|
102
|
+
viewport.setDisplaySets({ displaySetId: volumeId })
|
|
103
|
+
)
|
|
104
|
+
);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
An engine that is not a name is read once into a fresh local, a list of
|
|
108
|
+
viewport ids that is not a name goes in parentheses, and the callback
|
|
109
|
+
names are names that the call does not use.
|
|
110
|
+
|
|
111
|
+
- `setVideo(imageId, frameNumber)` becomes
|
|
112
|
+
`setDisplaySets({ displaySetId: imageId, options: { frameNumber } })`, and
|
|
113
|
+
`setEcg(imageId)` `setDisplaySets({ displaySetId: imageId })`.
|
|
114
|
+
- Each of these calls is rewritten only where the code waits for it, and the
|
|
115
|
+
new mount is waited for in the same way: `setStack`, `setVolumes` and
|
|
116
|
+
`setVolumesForViewports` as an `await` statement; `setVideo` and `setEcg`
|
|
117
|
+
under `await`, as the value of a `return` or as the body of an arrow
|
|
118
|
+
function (the caller gets the promise).
|
|
119
|
+
- Statements that replace the single-statement body of an `if`, an `else`, a
|
|
120
|
+
loop or a `case` go in a block.
|
|
121
|
+
- `utilities` and `Enums` come from the existing core import, or under a
|
|
122
|
+
fresh alias such as `coreUtilities` when a local name hides them at the
|
|
123
|
+
call. An import with comments is edited in place.
|
|
124
|
+
|
|
125
|
+
## Reported
|
|
126
|
+
|
|
127
|
+
- Manual, with the reason `not awaited`: a `setStack`, `setVolumes`,
|
|
128
|
+
`setVideo` or `setEcg` that the code does not wait for, in any function,
|
|
129
|
+
`async` or not; for `setVideo` and `setEcg` also a call under `void`, with
|
|
130
|
+
`.then(...)`, held in a variable or passed as an argument (also to
|
|
131
|
+
`Promise.all`). The 5.x call set part of the view before its
|
|
132
|
+
promise (the image ids and the index of a stack, the image id, frame count
|
|
133
|
+
and source of a video, the image id of an ECG; a volume viewport had a
|
|
134
|
+
camera before its data), so the code after it saw that part. A 6.0
|
|
135
|
+
viewport shows nothing before its mount ends: `await` would change when
|
|
136
|
+
the code after runs, and a mount without `await` would leave that code an
|
|
137
|
+
empty viewport (`stackPrefetch.enable` right after `setStack` finds no
|
|
138
|
+
images). Which one the code needs is for the reader.
|
|
139
|
+
- Manual, with the reason: a `setStack` that is not a statement, is an
|
|
140
|
+
optional call (`viewport?.setStack`), has a spread argument, or whose
|
|
141
|
+
viewport is a call; a `setVolumes` input with `callback`, `blendMode`,
|
|
142
|
+
`slabThickness`, `visibility` or `actorUID`, with more volumes, a volume
|
|
143
|
+
id that is not a string or a `const`, or whose image ids are not known (no
|
|
144
|
+
creation of the same volume id on every path before it in its function,
|
|
145
|
+
or options with a computed key or two `imageIds`); a
|
|
146
|
+
`setVolumesForViewports` that is not awaited (5.x gave a promise that the
|
|
147
|
+
code did not wait for, so the code after it ran before the mounts, and
|
|
148
|
+
the new statements would wait for every mount or throw); a data member in
|
|
149
|
+
brackets (`viewport['setStack']`); an `export { ... } from` of a removed
|
|
150
|
+
data function; `addVolumes`, `addVolumesToViewports`,
|
|
151
|
+
`convertStackToVolumeViewport`, `convertVolumeToStackViewport`,
|
|
152
|
+
`removeVolumeActors`, `setWSI`, `setDataIds`, `setDataList`; a data call
|
|
153
|
+
on something that the file does not show to be a Cornerstone viewport
|
|
154
|
+
(by the name of the method); a reference to `setVolumesForViewports` that
|
|
155
|
+
is not a call, such as a shorthand property (its import stays);
|
|
156
|
+
`'setStack' in viewport`, a read such as
|
|
157
|
+
`typeof viewport.setStack === 'function'`, and their kin (false for every
|
|
158
|
+
6.0 viewport).
|
|
159
|
+
- A CommonJS module (`require('@cornerstonejs/core')`) gets no `import`: its
|
|
160
|
+
calls are reported.
|
|
161
|
+
|
|
162
|
+
## Development
|
|
163
|
+
|
|
164
|
+
From `packages/codemods`:
|
|
165
|
+
|
|
166
|
+
```sh
|
|
167
|
+
yarn test
|
|
168
|
+
npx codemod workflow validate -w registry/cornerstone3d/6/display-sets
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
The fixtures of `.ts` files are in `tests/typescript` (parsed as TypeScript),
|
|
172
|
+
the others, a JavaScript file too, in `tests/tsx`. Each `metrics.json` holds
|
|
173
|
+
the sites that a fixture reports.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
schema_version: '1.0'
|
|
2
|
+
name: '@cornerstonejs/cornerstone3d-6-display-sets'
|
|
3
|
+
version: '0.1.0'
|
|
4
|
+
description: 'Rewrite setStack, setVolumes, setVolumesForViewports, setVideo and setEcg to Cornerstone3D 6.0 display sets.'
|
|
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
|
+
- display-sets
|
|
18
|
+
registry:
|
|
19
|
+
access: 'public'
|
|
20
|
+
visibility: 'public'
|