Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: directly use mxGraph value objects #2745

Merged
merged 1 commit into from
Jun 14, 2023

Conversation

tbouffard
Copy link
Member

@tbouffard tbouffard commented Jun 14, 2023

The mxGraph initializer module now exports main mxGraph objects that are used several times in the library. This make the code easier to read and reduce the size of minified bundles.

So, when used, there is no more need to prefix the call of mxGraph object by mxgraph. For instance, instead of writing mxgraph.mxConstants.XXX, it is possible to write mxConstants.XXX.
Notice that in files where both values (from mxGraph) and types (from typed-mxgraph) are imported, the types are aliased to avoid name clash. The convention taken is to postfix the type by Type to make it explicit.

Notes

Refactoring detected during #2366

Size decrease in the minified IIFE bundle: 1554b / 1.51kb
master: 3d36ba7

file before after
bpmn-visualization.esm.js 199 738 198 274
bpmn-visualization.js 1 671 073 1 669 629
bpmn-visualization.min.js 985 679 984 125

No change

  • bpmn-visualization.d.ts: 50913
  • not-supported-ts-versions.d.ts: 932
  • API as HTML doc

The mxgraph initializer module now exports main mxGraph objects that are used several times in the library.
This make the code easier to read and reduce the size of minified bundles.

So, when used, there is no more need to prefix the call of mxGraph object by mxgraph. For instance, instead of writing
`mxgraph.mxConstants.XXX`, it is possible to write `mxConstants.XXX`.
Notice that in files where both values (from mxGraph) and types (from typed-mxgraph) are imported, the types are aliased
to avoid name clash. The convention taken is to postfix the type by `Type` to make it explicit.
@tbouffard tbouffard added the refactoring Code refactoring label Jun 14, 2023
@github-actions
Copy link

github-actions bot commented Jun 14, 2023

♻️ PR Preview c0b8eb7 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@github-actions
Copy link

github-actions bot commented Jun 14, 2023

♻️ PR Preview c0b8eb7 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

96.1% 96.1% Coverage
0.0% 0.0% Duplication

@tbouffard tbouffard marked this pull request as ready for review June 14, 2023 13:34
@tbouffard tbouffard requested a review from csouchet June 14, 2023 13:35
@tbouffard tbouffard merged commit c8e3a1e into master Jun 14, 2023
@tbouffard tbouffard deleted the refactor/simplify_mxgraph_imports_and_usage branch June 14, 2023 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Code refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants