-
Notifications
You must be signed in to change notification settings - Fork 31
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
Ideas about reducing library size? #41
Comments
The first ~700 lines are enums using https://github.com/IIIF-Commons/vocabulary/blob/master/src/index.ts This should slim things down a little bit. I need to update the references in manifesto (and UV + components...) This is probably a day or two's Open Collective work. I'm minifying manifesto along with other dependencies in the UV build process using uglify. We need to provide a pre-minified version distributed in the npm package. I want to remove exjs at some point, but it's only ~20k. I would also like to remove all of the interfaces - they're unnecessary, but don't impact the built file size. Regarding commonjs and browserify, I've been looking for an alternative to this, but haven't been able to identify another way to build into a single global object from multiple source files without using AMD or System.js. In other smaller projects (like vocabulary) I've simply put everything in one .ts file and compiled to es6. An approach like this could work: microsoft/TypeScript#10178 (comment) |
Thanks for all of the helpful context and suggestions here. I may take a stab at one or two of these and submit a PR. |
Just looking at the outputted UMD module and https://github.com/feross/buffer seems to constitute a significant portion of it. Assuming that's being included as part of I'm wondering if we can just use plain However, I'm pretty sure this will break the commonjs-based tests and mean manifesto is no longer isomorphic (at least for http and https). Currently there's no reason why you couldn't use it as a server-side utility too. |
Githubs fetch polyfill is quite small: https://github.com/github/fetch and could eventually be removed in the future once IE11 and Safari 10 finally disappear! As another option, theres also the isomorphic fetch which is built on top of that for running on node |
Also maybe related, removed jQuery from Manifold using a quick shim around fetch: https://github.com/digirati-co-uk/canvas-panel/blob/master/packages/canvas-panel-core/src/utility/Manifold.js To reduce bundle size there |
@stephenwf I've been working on porting manifold's I'm wondering if a lot of what's in manifold could move to manifesto. The implementation of IExternalResource for example could be made isomorphic using isomorphic-fetch. The stuff around sortable trees could move I think. It's really the "metadata for all the things" method and getting previous and next ranges that make it valuable, i.e. utilities that must have a notion of your current "position" in the manifest. I put this together a while ago: http://edsilv.github.io/redux-experiments/www/ Was thinking to add this to manifold to manage state. I maintain that having a generic IIIF redux store implementation on IIIF Commons would be a desirable thing for everyone. Would be keen to get your thoughts. |
I'd be more inclined to looking at |
@mejackreed isomorphic-fetch, or just plain fetch? I read this the other night that kind of put me off fetch a bit: https://medium.com/@shahata/why-i-wont-be-using-fetch-api-in-my-apps-6900e6c6fe78 |
isomorphic fetch is the same api, it adds a global +1 for Typescript + Redux implementation for Manifold. I think it would make it clearer what should be in manifold and what should be in manifesto if you move to Redux. |
@stephenwf Cool. Excited to move into redux finally. Fetch looks ok - we're really not doing anything too complex other than sending request headers. Keen to use asyc/await syntax with it. So I'm thinking to:
|
👍 to the fetch conversation and how that is moving forward. I haven't really dived too deep into what manifold is doing yet and the relationship to manifesto (I know the theoretical basics) so I don't have strong opinions on that really. But I like the idea of having the Any split off items that you want help on? I know a lot of things are moving around, but let me know if there are ways we can work together to move a few of these things forward together. |
@mejackreed I'm full-time on a project at the moment, can only look at this on weekends really. I think the main thing now is getting |
We could potentially write some auth tests once in manifesto. Not sure how that would work yet... We'd have to spoof an auth server's responses. |
I'd use PR #46 for new work. It's quite far ahead of master and totally refactored. |
Library size is now ~60kb will close for now. |
We chatted briefly about this in Edinburgh, but I wanted to create an issue to explore possible ways to reduce the bundle size (188kB). Have you explored any avenues of doing this?
I've thought about a few options including:
Any other things worth trying here?
The text was updated successfully, but these errors were encountered: