ES6 Modules

54 views
Skip to first unread message

Aaron Mars

unread,
Jun 15, 2016, 2:00:25 PM6/15/16
to vexflow
As discussed in the GitHub issue (#352), I have a really good start with defining all of VexFlow as interdependent ES6 modules.

Here is the broad overview:

  • Remove the concept of a global `Vex` namespace from the VF sources.
    • Instead, use import statements to programmatically define the dependency tree
  • Create an `index.js` file (name can be changed) that re-builds the Vex.* globals.
    • This file imports all necessary modules and adds them to the Vex namespace object.
    • This file is run through Rollup and the result is a single package file that defines Vex, Vex.Flow and all of the other classes inside those.
So far, I have been able to run all of the examples from the VF tutorial page , and it's all good!  Next step will be to get all of the tests to pass without changing their code.

The best thing about this is the code *inside* the sources is unchanged.  I'm just removing the globals, replacing them with module dependencies and then reconstructing the globals elsewhere so a single package can be generated.

Aaron Mars

unread,
Jun 15, 2016, 11:51:57 PM6/15/16
to vexflow
OK.  All tests are passing.
I'm wondering if I could get a quick explanation of the fonts directory.  Currently, I'm just including `vexfolw_font.js`.  It looks like that's what's going on in the Gruntfile.

Are the gonville files used?  If so, how?  If not, is it OK to completely ignore them?

I know there has been talk of SMuFL/Bravura support incoming, and I completely support that, but I just want to deliver something useful now.

Thanks!

-Aaron

Mohit Muthanna Cheppudira

unread,
Jun 16, 2016, 9:54:17 AM6/16/16
to vexflow
Hi Aaron,

All of this sounds great, would love to see the final PR.

Re: fonts, the only file that matters is vexflow_font.js -- the others are not bundled (but vexflow_font is generated from them by hand.)

Mohit.


--
--
You received this message because you are subscribed to the Google
Groups "vexflow" group.
To post to this group, send email to vex...@googlegroups.com
To unsubscribe from this group, send email to
vexflow+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/vexflow?hl=en

---
You received this message because you are subscribed to the Google Groups "vexflow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vexflow+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Mohit Muthanna [mohit (at) muthanna (uhuh) com]

Aaron Mars

unread,
Jun 16, 2016, 3:46:13 PM6/16/16
to vexflow, mo...@muthanna.com
Perfect!
My working branch is linked in the GitHub issue.  I'm cleaning up the diff and making notes of things that changed that aren't directly related to the module stuff.

I'll send the PR later today.
Reply all
Reply to author
Forward
0 new messages