BREAKING CHANGE(core): switch to esm

This commit is contained in:
2022-05-28 12:33:10 +02:00
parent dac5342a19
commit 7fa246e0e4
13 changed files with 2463 additions and 19392 deletions

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/webstore',
version: '2.0.0',
description: 'high performance storage in the browser using indexed db'
}

View File

@ -1,2 +1,2 @@
export * from './webstore.classes.typedrequestcache';
export * from './webstore.classes.webstore';
export * from './webstore.classes.typedrequestcache.js';
export * from './webstore.classes.webstore.js';

View File

@ -1,5 +1,5 @@
import { WebStore } from './webstore.classes.webstore';
import * as plugins from './webstore.plugins';
import { WebStore } from './webstore.classes.webstore.js';
import * as plugins from './webstore.plugins.js';
/**
* a cache that can be used to store and retrieve typedrequests

View File

@ -1,4 +1,4 @@
import * as plugins from './webstore.plugins';
import * as plugins from './webstore.plugins.js';
export interface IWebStoreOptions {
dbName: string;
@ -22,6 +22,13 @@ export class WebStore<T = any> {
return;
}
this.initCalled = true;
const smartenv = new plugins.smartenv.Smartenv();
if (!smartenv.isBrowser) {
const fetch = await smartenv.getSafeNodeModule('fake-indexeddb/auto.js');
globalThis.fetch = fetch.default;
}
this.db = await plugins.idb.openDB(this.options.dbName, 1, {
upgrade: (db) => {
db.createObjectStore(this.options.storeName);

View File

@ -1,10 +1,11 @@
// pushrocks scope
import * as lik from '@pushrocks/lik';
import * as smartenv from '@pushrocks/smartenv';
import * as smartjson from '@pushrocks/smartjson';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartrx from '@pushrocks/smartrx';
export { lik, smartjson, smartpromise, smartrx };
export { lik, smartenv, smartjson, smartpromise, smartrx };
// apiglobal scope
import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';