brianleroux/lawnchair

npm package appears to be missing adapters

binki opened this issue · 0 comments

binki commented

I can understand how the main build of lawnchair might only include the 'dom' adapter. But I am interested in taking advantage of the async adapters in the order indexeddb,websql,dom in order to get async when it is available (and even on ancient iOS devices) and only use synchronous DOM Storage as a fallback. With npm packages, one could use sub-package requires like require('lawnchair/src/adapters/indexed-db') in a file which webpack could slurp up when building my webpack (in the future, I haven’t actually converted my app yet).

The idea is that I could write code like this:

'use strict';

const lawnchair = require('lawnchair/src/Lawnchair');
// Register desired adapters
const desiredAdapters = ['indexed-db', 'webkit-sqlite', 'dom'];

// Set Lawnchair on the global object because the adapters require
// that.
window.Lawnchair = lawnchair;

// Unfortunately webpack requires all the requires to be hardcoded.
require('lawnchair/src/adapters/indexed-db');
require('lawnchair/src/adapters/webkit-sqlite');
require('lawnchair/src/adapters/dom');

const thingsStore = new lawnchair({adapter: desiredAdapters, name: 'things'});

Could you adjust the published npm package to include src so that I can do this?