fix(api): tree shaking package.json import

Manually tree shaking import statement of package.json
This commit is contained in:
Aiello
2023-02-18 23:21:20 +08:00
committed by GitHub
parent fec193ebaf
commit e31924eadc

View File

@@ -13,7 +13,7 @@
import { select } from 'd3'; import { select } from 'd3';
import { compile, serialize, stringify } from 'stylis'; import { compile, serialize, stringify } from 'stylis';
// @ts-ignore: TODO Fix ts errors // @ts-ignore: TODO Fix ts errors
import pkg from '../package.json'; import { version } from '../package.json';
import * as configApi from './config'; import * as configApi from './config';
import { addDiagrams } from './diagram-api/diagram-orchestration'; import { addDiagrams } from './diagram-api/diagram-orchestration';
import classDb from './diagrams/class/classDb'; import classDb from './diagrams/class/classDb';
@@ -506,9 +506,9 @@ const render = function (
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
// Draw the diagram with the renderer // Draw the diagram with the renderer
try { try {
diag.renderer.draw(text, id, pkg.version, diag); diag.renderer.draw(text, id, version, diag);
} catch (e) { } catch (e) {
errorRenderer.draw(text, id, pkg.version); errorRenderer.draw(text, id, version);
throw e; throw e;
} }
@@ -708,9 +708,9 @@ const renderAsync = async function (
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
// Draw the diagram with the renderer // Draw the diagram with the renderer
try { try {
await diag.renderer.draw(text, id, pkg.version, diag); await diag.renderer.draw(text, id, version, diag);
} catch (e) { } catch (e) {
errorRenderer.draw(text, id, pkg.version); errorRenderer.draw(text, id, version);
throw e; throw e;
} }