refactor: simplifies library exports and includes reducers as exports

This commit is contained in:
Mark Mankarious
2023-11-03 13:01:17 +00:00
parent 4d4a668950
commit e7c79f0b9b
3 changed files with 20 additions and 30 deletions

View File

@@ -2,19 +2,8 @@ import React, { useEffect } from 'react';
import { ThemeProvider } from '@mui/material/styles';
import { Box } from '@mui/material';
import { theme } from 'src/styles/theme';
import {
Model,
ModelItem,
Icon,
Connector,
Rectangle,
IsoflowProps,
InitialData,
Colors,
Icons
} from 'src/types';
import { IsoflowProps } from 'src/types';
import { setWindowCursor, modelFromModelStore } from 'src/utils';
import { modelSchema } from 'src/schemas/model';
import { useModelStore, ModelProvider } from 'src/stores/modelStore';
import { SceneProvider } from 'src/stores/sceneStore';
import { GlobalStyles } from 'src/styles/GlobalStyles';
@@ -123,21 +112,6 @@ const useIsoflow = () => {
};
};
export {
useIsoflow,
IsoflowProps,
InitialData,
Model,
Icon,
ModelItem,
Rectangle,
Colors,
Icons,
Connector,
modelSchema
};
export const version = PACKAGE_VERSION;
export const initialData = INITIAL_DATA;
export { useIsoflow };
export * from 'src/standaloneExports';
export default Isoflow;

View File

@@ -1,5 +1,21 @@
// This file will be exported as it's own bundle (separate to the main bundle). This is because the main
// bundle requires `window` to be present and so can't be imported into a Node environment.
export * as reducers from 'src/stores/reducers';
export { INITIAL_DATA } from 'src/config';
export { modelSchema } from 'src/schemas/model';
export const version = PACKAGE_VERSION;
export type {
IsoflowProps,
InitialData,
Model,
View,
Views,
ModelItems,
ViewItem,
Icon,
ModelItem,
Rectangle,
Colors,
Icons,
Connector
} from 'src/types';

View File

@@ -7,7 +7,7 @@ module.exports = {
target: 'web',
entry: {
'index': './src/Isoflow.tsx',
'/nodeExports': './src/nodeExports.ts',
'/standaloneExports': './src/standaloneExports.ts',
},
output: {
path: path.resolve(__dirname, '../dist'),