Skip to content

v0.8.1

Compare
Choose a tag to compare
@pemrouz pemrouz released this 19 Nov 16:06
· 8 commits to master since this release

Notable Changes

Dynamic Minimum Transpilation (Example: Realtime Hackernews)

  • Resources can now be dynamically transpiled, controlled using the transpile header
  • Transpiled versions are stored in an LRU cache per resource. The size of the cache can be controlled by transpile.limit
  • The limit is set for all resources of type application/javascript to 25 by default
  • That means it will work automatically for all components, you can opt out by setting to 0
  • You can also opt-in for resources that aren't functions. For example in the following case we register a resource (lodash) that is an object with functions as some of it's properties:
// server
const filter = require('lodash.filter')
    , map = require('lodash.map')

ripple('lodash', { filter, map }, { transpile: { limit: 25 }})

// client 
ripple.get('lodash', 'filter') // will return transpiled version 
ripple.subscribe('lodash', 'filter') // will return transpiled version + update on change 
  • Transpilation will work on delta updates too, but these will not use a LRU cache. Dynamically updating part of a resource that happens to be a function seems to be a unusual/niche case, so at a minimum it works - but the main use case that is optimised is resources that are functions.
  • All updates, whether top-level or partial will evict the transpilation cache for that resource, so subscriptions and hot reloading works too
  • Transpilation is done by buble, so bear in mind async/await will not work until this is merged.
  • There are end-to-end tests added for all these use cases
  • In the future:
    • The transpile header will be extended so you can preheat the LRU cache AOT with the transpiled versions you want when you start the server.
    • A fallback option (pending this) will allow you to specify the default transforms if support data does not exist for a particular browser/version (typically apply either no transforms or all transforms)
    • This will work for free if you GET a resource via HTTP

Commits

examples

  • [a953a0d] - feat: add hackernews, sliding-blotter

fn

  • [306e54a] - feat: set transpilation headers by default

needs

  • [a7b35e3] - feat: parallelise loading dependencies

sync

  • [5f9952a] - fix: should allow subscribing to keys as numbers
  • [bf8652a] - feat: dynamically transpile
  • [5c3ecca] - fix: always unwrap streams