Skip to content

Commit

Permalink
esm builds but umd fails
Browse files Browse the repository at this point in the history
  • Loading branch information
sedghi committed Feb 27, 2023
1 parent cdae5e8 commit d4585e5
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/dicomImageLoader/src/shared/decoders/decodeHTJ2K.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ByteArray } from 'dicom-parser';
import openJphFactory from '@cornerstonejs/codec-openjph/wasmjs';
import openjphWasm from '@cornerstonejs/codec-openjph/wasm';
import openJphFactory from '@cornerstonejs/codec-openjph/dist/openjphjs';
import openjphWasm from '@cornerstonejs/codec-openjph/dist/openjphjs.wasm';

import { LoaderDecodeOptions } from '../../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import type {
J2KDecoder,
OpenJpegModule,
} from '@cornerstonejs/codec-openjpeg/dist/openjpegwasm_decode';
import openJpegFactory from '@cornerstonejs/codec-openjpeg/decodewasmjs';
import openJpegFactory from '@cornerstonejs/codec-openjpeg/dist/openjpegjs_decode';

// Webpack asset/resource copies this to our output folder

// TODO: At some point maybe we can use this instead.
// This is closer to what Webpack 5 wants but it doesn't seem to work now
// const wasm = new URL('./blah.wasm', import.meta.url)
import openjpegWasm from '@cornerstonejs/codec-openjpeg/decodewasm';
import openjpegWasm from '@cornerstonejs/codec-openjpeg/dist/openjpegwasm_decode.wasm';

import { ImageFrame, WebWorkerDecodeConfig } from '../../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import type {
} from '@cornerstonejs/codec-libjpeg-turbo-8bit/dist/libjpegturbowasm_decode';
import { ByteArray } from 'dicom-parser';

import libjpegTurboFactory from '@cornerstonejs/codec-libjpeg-turbo-8bit/decodewasmjs';

// Webpack asset/resource copies this to our output folder
import libjpegTurboWasm from '@cornerstonejs/codec-libjpeg-turbo-8bit/decodewasm';
import libjpegTurboFactory from '@cornerstonejs/codec-libjpeg-turbo-8bit/dist/libjpegturbowasm_decode';
import libjpegTurboWasm from '@cornerstonejs/codec-libjpeg-turbo-8bit/dist/libjpegturbowasm_decode.wasm';

import { ImageFrame } from '../../types';

Expand Down
4 changes: 2 additions & 2 deletions packages/dicomImageLoader/src/shared/decoders/decodeJPEGLS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type {
JpegLSDecoder,
} from '@cornerstonejs/codec-charls/dist/charlswasm_decode';

import charlsFactory from '@cornerstonejs/codec-charls/decodewasmjs';
import charlsWasm from '@cornerstonejs/codec-charls/decodewasm';
import charlsFactory from '@cornerstonejs/codec-charls/dist/charlswasm_decode';
import charlsWasm from '@cornerstonejs/codec-charls/dist/charlswasm_decode.wasm';

import { ByteArray } from 'dicom-parser';
import { ImageFrame, WebWorkerDecodeConfig } from '../../types';
Expand Down
2 changes: 2 additions & 0 deletions packages/dicomImageLoader/src/types/codec-charls.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ declare module '@cornerstonejs/codec-charls/dist/charlswasm_decode' {
declare const Module: EmscriptenModuleFactory<CharlsModule>;
export default Module;
}

declare module '@cornerstonejs/codec-charls/dist/charlswasm_decode.wasm';
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ declare module '@cornerstonejs/codec-libjpeg-turbo-8bit/dist/libjpegturbowasm_de
declare const Module: EmscriptenModuleFactory<OpenJpegModule>;
export default Module;
}

declare module '@cornerstonejs/codec-libjpeg-turbo-8bit/dist/libjpegturbowasm_decode.wasm';
2 changes: 2 additions & 0 deletions packages/dicomImageLoader/src/types/codec-openjpeg.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ declare module '@cornerstonejs/codec-openjpeg/dist/openjpegwasm_decode' {
declare const Module: EmscriptenModuleFactory<OpenJpegModule>;
export default Module;
}

declare module '@cornerstonejs/codec-openjpeg/dist/openjpegwasm_decode.wasm';
27 changes: 27 additions & 0 deletions packages/dicomImageLoader/src/types/codec-openjph.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/// <reference types="emscripten" />

declare module '@cornerstonejs/codec-openjph/dist/openjphjs' {
export class HTJ2KDecoder {
decode: () => any;
getBlockDimensions: () => any;
getColorSpace: () => any;
getDecodedBuffer: () => any;
getEncodedBuffer: (length: number) => any;
getFrameInfo: () => any;
getImageOffset: () => any;
getIsReversible: () => any;
getNumDecompositions: () => any;
getNumLayers: () => any;
getProgressionOrder: () => number;
getTileOffset: () => any;
getTileSize: () => any;
}
export interface OpenJpegModule extends EmscriptenModule {
HTJ2KDecoder: typeof HTJ2KDecoder;
}

declare const Module: EmscriptenModuleFactory<OpenJpegModule>;
export default Module;
}

declare module '@cornerstonejs/codec-openjph/dist/openjphjs.wasm';

0 comments on commit d4585e5

Please sign in to comment.