diff --git a/package.json b/package.json index e7c422c..6acd023 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,20 @@ "main": "dist/umd/react-vtk.js", "module": "dist/esm/index.js", "source": "src/index.js", + "exports": { + ".": { + "browser": "./dist/cjs/react-vtk.js", + "umd": "./dist/umd/react-vtk.js", + "import": "./dist/esm/index.js", + "package.json": "./package.json", + "default": "./dist/esm/index.js" + }, + "./light": { + "import": "./dist/esm/light.js", + "default": "./dist/esm/light.js", + "package.json": "./package.json" + } + }, "dependencies": { "@babel/runtime": "^7.12.5" }, diff --git a/src/index.js b/src/index.js index 9b99d12..0446180 100644 --- a/src/index.js +++ b/src/index.js @@ -1,55 +1,4 @@ // Ensure vtk.js classes available for Algorithm and Reader import './AvailableClasses'; -// Get React pieces -import Core from './core/index'; -import Representations from './representations/index'; - -import { - ViewContext, - RepresentationContext, - DataSetContext, - FieldsContext, - DownstreamContext, -} from './core/View'; - -// Core -export const VolumeRepresentation = Core.VolumeRepresentation; -export const SliceRepresentation = Core.SliceRepresentation; -export const VolumeController = Core.VolumeController; -export const PointData = Core.PointData; -export const PolyData = Core.PolyData; -export const Reader = Core.Reader; -export const ShareDataSet = Core.ShareDataSet; -export const View = Core.View; -export const GeometryRepresentation = Core.GeometryRepresentation; -export const Geometry2DRepresentation = Core.Geometry2DRepresentation; -export const GlyphRepresentation = Core.GlyphRepresentation; -export const ImageData = Core.ImageData; -export const DataArray = Core.DataArray; -export const FieldData = Core.FieldData; -export const Algorithm = Core.Algorithm; -export const Calculator = Core.Calculator; -export const CellData = Core.CellData; -export const MultiViewRoot = Core.MultiViewRoot; - -// Representations -export const PointCloudRepresentation = - Representations.PointCloudRepresentation; -export const VolumeDataRepresentation = - Representations.VolumeDataRepresentation; - -// Context -export const Contexts = { - ViewContext, - RepresentationContext, - DataSetContext, - FieldsContext, - DownstreamContext, -}; - -export default { - Core, - Representations, - Contexts, -}; +export * from './light'; diff --git a/src/light.js b/src/light.js new file mode 100644 index 0000000..63a81e5 --- /dev/null +++ b/src/light.js @@ -0,0 +1,52 @@ +// Get React pieces +import Core from './core/index'; +import Representations from './representations/index'; + +import { + ViewContext, + RepresentationContext, + DataSetContext, + FieldsContext, + DownstreamContext, +} from './core/View'; + +// Core +export const VolumeRepresentation = Core.VolumeRepresentation; +export const SliceRepresentation = Core.SliceRepresentation; +export const VolumeController = Core.VolumeController; +export const PointData = Core.PointData; +export const PolyData = Core.PolyData; +export const Reader = Core.Reader; +export const ShareDataSet = Core.ShareDataSet; +export const View = Core.View; +export const GeometryRepresentation = Core.GeometryRepresentation; +export const Geometry2DRepresentation = Core.Geometry2DRepresentation; +export const GlyphRepresentation = Core.GlyphRepresentation; +export const ImageData = Core.ImageData; +export const DataArray = Core.DataArray; +export const FieldData = Core.FieldData; +export const Algorithm = Core.Algorithm; +export const Calculator = Core.Calculator; +export const CellData = Core.CellData; +export const MultiViewRoot = Core.MultiViewRoot; + +// Representations +export const PointCloudRepresentation = + Representations.PointCloudRepresentation; +export const VolumeDataRepresentation = + Representations.VolumeDataRepresentation; + +// Context +export const Contexts = { + ViewContext, + RepresentationContext, + DataSetContext, + FieldsContext, + DownstreamContext, +}; + +export default { + Core, + Representations, + Contexts, +};