In particular the next release will be my first foray into npm modules as I intend to publish this next release as one. The npm module allows for the following types of customizations:
- Custom viewer layout templates
- Custom viewer script commands
- Being able to selectively include/exclude viewer features to reduce bundle size
These customization options will only be available through the npm module
One major roadblock that has appeared is that we currently include a verbatim copy of our Fusion PHP backend so that certain viewer commands will work:
- Buffer
- Query
- Redline
- Theme
- Feature Information
- QuickPlot
- Search
How does this roadblock us? Well with this PHP backend bundled, the npm module story is more complicated:
- It would involve some serious webpack (or some other post-build) shenanigans to get the backend PHP content deployed in the right place, relative to your custom viewer bundle.
- It bloats the size of the npm module (based on my simulations using npm pack).
- I feel extremely icky publishing a JavaScript library that bundles a PHP backend as a required dependency.
In hindsight, bundling a copy of this Fusion backend is totally not necessary. It is simpler to just make our viewer commands point and talk to the existing Fusion backend. When MapGuide is installed, Fusion and PHP will always be there, so this is a safe assumption to make. It's the same environmental assumption that allows for mapguide-rest to be an easy "drop into www" and it works.
By re-using the existing Fusion backend for these tools, there also another positive side effect. It means we have to also polyfill whatever Fusion viewer APIs are needed for the frontend HTML/JS content of these Fusion widgets to work within mapguide-react-layout without modifications. What this means is that migration should be even easier as we are now polyfilling various common Fusion viewer APIs in addition to the AJAX viewer APIs.
So with this next release, the viewer will now reuse the Fusion backend of your MapGuide installation. As a result, it also means the zip packages for this release will be much smaller as well.
No comments:
Post a Comment