Currently, the compiled svgtiler.js file (158kB, 42kB gzipped) has a lot of code that is command-line-specific, and doesn't make sense for a web-only build. Also, we don't include any dependencies in a web build.
[ ] Separate source files into base svgtiler.coffee and nodetiler.coffee which requires svgtiler.coffee.
[ ] Ideally all simulated-on-web imports like path would only be needed in latter, so we could remove these simulations.
[ ] For Node, package.json's bin and main point to nodetiler.js
[ ] Plausibly split into separate files for each class, for easier code navigation.
[ ] Web-specific builds in dist built by rollup or Parcel or webpack
[ ] Full build including CoffeeScript, @babel/standalone for JSX, Stylus, csv/xls parsers, etc.
[ ] Intermediate builds with different subsets?
[ ] May need a bare build seperate from svgtiler.js (in case of further splitting, and to fully avoid require/import).
[ ] Alternatively, can we use code splitting features to automatically load dependencies as needed? This is challenging given how the code is currently written synchronously.
[ ] Alternatively, can we just rely on dependencies being globally attached to window? Ideally each class could specify its dependencies, and expect the user to (lazy) load them before instantiating that class.
[ ] Provide tree-shakable ESM source (I guess in lib). nodetiler.js won't be tree-shakable because of svgtiler megafunction (or can Parcel figure it out?), but that's Node anyway; svgtiler.js (for web) should be possible.
[ ] svgink could similarly split off its CLI code so it doesn't up in any build of svgtiler (as we never need it).
Currently, the compiled
svgtiler.js
file (158kB, 42kB gzipped) has a lot of code that is command-line-specific, and doesn't make sense for a web-only build. Also, we don't include any dependencies in a web build.svgtiler.coffee
andnodetiler.coffee
whichrequire
ssvgtiler.coffee
.path
would only be needed in latter, so we could remove these simulations.package.json
'sbin
andmain
point tonodetiler.js
dist
built by rollup or Parcel or webpack@babel/standalone
for JSX, Stylus, csv/xls parsers, etc.svgtiler.js
(in case of further splitting, and to fully avoidrequire
/import
).window
? Ideally each class could specify its dependencies, and expect the user to (lazy) load them before instantiating that class.lib
).nodetiler.js
won't be tree-shakable because ofsvgtiler
megafunction (or can Parcel figure it out?), but that's Node anyway;svgtiler.js
(for web) should be possible.svgink
could similarly split off its CLI code so it doesn't up in any build ofsvgtiler
(as we never need it).