xdriver 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ ## 文档懒得写,更详细API查看源码 目录:src/ts/
2
+
3
+ ### indexDB
4
+
5
+ ```
6
+ import Driver from 'ndriver';
7
+ const driver = new Driver('demo', version?);
8
+ driver.on("process", function (state) {
9
+ console.log(state)
10
+ })
11
+ driver.open().then(function () {
12
+ var arrPlayers = []
13
+ for(let i=0; i<100; i++) {
14
+ arrPlayers.push({
15
+ name: `韩梅梅${i}`,
16
+ sex: `女${i}`
17
+ })
18
+ }
19
+ driver.createTable({
20
+ name: 'player',
21
+ primaryKey: 'id',
22
+ autoIncrement: true,
23
+ indexes: [
24
+ {name: 'name_index', column: 'name', unique: true},
25
+ ],
26
+ data : arrPlayers
27
+ })
28
+ })
29
+ ```
30
+
31
+ ### API
32
+ #### constructor(name, version?)
33
+ name: 数据库名字
34
+ version: 数据库版本 默认1
35
+ eg: var driver = new Driver('database')
36
+ ### open
37
+ 打开数据库连接 返回promise对象 在resolve中可以创建表或者删除表
38
+ driver.open().then(() => {
39
+ driver.createTable({
40
+ name: 'table',
41
+ primaryKey: 'key',
42
+ indexes: [
43
+ {name: 'name_index', column: 'key', unique: true},
44
+ ],
45
+ })
46
+ })
47
+ #### Driver.prototype.insert(table, data)
48
+ table: 表名
49
+ data: 需要插入的数据 obj or array
50
+ eg: driver.insert({key: 'key', name: '', ...})
51
+ #### Driver.prototype.select(table, keyRange?, limit?)
52
+ table: 表名
53
+ keyRange: KeyRange 包含多种比较操作
54
+ limit: 取出记录数
55
+ eg: driver.select('table', keyRange.eq('key'), 1).then(rs => console.log(rs))
56
+
57
+ #### Driver.prototype.selectByKey(table, key)
58
+ table:表名
59
+ key: 主键
60
+ eg: driver.selectByKey('key').then(rs => console.log(rs))
61
+
62
+ #### Driver.prototype. count (table, keyRange?)
63
+ 根据条件统计记录数
64
+ table: 表名
65
+ keyRange: @see select
66
+ eg: driver.count('table').then(size => console.log(size))
67
+ #### Driver.prototype. update (table, modify, where?)
68
+ 数据更新,如果数据不存在则新增
69
+ table: 表名
70
+ modify: 修改的对象
71
+ where:条件
72
+ eg: driver.update('table', {name: 'xxxx'}, {key: 'key'})
73
+ #### Driver.prototype.delete (table, key)
74
+ table: 表名
75
+ key: 主键
76
+ 根据主键删除
77
+ eg: driver.delete('table', 'key')
78
+
79
+ #### Driver.prototype.truncate(table)
80
+ 清空某张表
81
+ table:表名
82
+
83
+ ### 示例
84
+
85
+ ```
86
+ const driver = new Driver('pallet', 1);
87
+ driver.on("process", function (state) {
88
+ console.log(state)
89
+ })
90
+ driver.open().then(function () {
91
+ var arrPlayers = []
92
+ for(let i=0; i<100; i++) {
93
+ arrPlayers.push({
94
+ name: `韩梅梅${i}`,
95
+ sex: `女${i}`
96
+ })
97
+ }
98
+ driver.createTable({
99
+ name: 'player',
100
+ primaryKey: 'id',
101
+ autoIncrement: true,
102
+ indexes: [
103
+ {name: 'name_index', column: 'name', unique: true},
104
+ ],
105
+ data : arrPlayers
106
+ })
107
+ })
108
+ ```
package/lib/Const.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ export declare const innerDB: any;
2
+ export declare enum TransactionMode {
3
+ READ_ONLY = "readonly",
4
+ READ_WRITE = "readwrite",
5
+ READ_WRITE_FLUSH = "readwriteflush",
6
+ VERSION_CHANGE = "versionchange"
7
+ }
8
+ export declare enum CursorDirection {
9
+ NEXT,
10
+ NEXT_NO_DUPLICATE,
11
+ PREV,
12
+ PREV_NO_DUPLICATE
13
+ }
14
+ export declare class KeyRange {
15
+ static leq(x: any): any;
16
+ static lt(x: any): any;
17
+ static geq(x: any): any;
18
+ static gt(x: any): any;
19
+ static between(x: any, y: any): any;
20
+ static gt_lt(x: any, y: any): any;
21
+ static gt_leq(x: any, y: any): any;
22
+ static geq_lt(x: any, y: any): any;
23
+ static eq(x: any, y: any): any;
24
+ }
25
+ export declare enum IndexdbStatus {
26
+ CONNECT_ING = 0,
27
+ CONNECT_SUCCESS = 1,
28
+ CONNECT_ERROR = 2,
29
+ CONNECT_CHANGE = 3,
30
+ CONNECT_CLOSE = 4,
31
+ DATABASE_ERROR = 0
32
+ }
package/lib/Const.js ADDED
@@ -0,0 +1,57 @@
1
+ let win = window;
2
+ const DBCursor = win.IDBCursor;
3
+ const DBKeyRange = win.IDBKeyRange || win.webkitIDBKeyRange || win.msIDBKeyRange;
4
+ export const innerDB = win.indexedDB || win.mozIndexedDB || win.webkitIndexedDB || win.msIndexedDB;
5
+ const DBTransaction = win.IDBTransaction || win.webkitIDBTransaction || win.msIDBTransaction;
6
+ export var TransactionMode;
7
+ (function (TransactionMode) {
8
+ TransactionMode["READ_ONLY"] = "readonly";
9
+ TransactionMode["READ_WRITE"] = "readwrite";
10
+ TransactionMode["READ_WRITE_FLUSH"] = "readwriteflush";
11
+ TransactionMode["VERSION_CHANGE"] = "versionchange";
12
+ })(TransactionMode || (TransactionMode = {}));
13
+ export var CursorDirection;
14
+ (function (CursorDirection) {
15
+ CursorDirection[CursorDirection["NEXT"] = DBCursor.NEXT] = "NEXT";
16
+ CursorDirection[CursorDirection["NEXT_NO_DUPLICATE"] = DBCursor.NEXT_NO_DUPLICATE] = "NEXT_NO_DUPLICATE";
17
+ CursorDirection[CursorDirection["PREV"] = DBCursor.PREV] = "PREV";
18
+ CursorDirection[CursorDirection["PREV_NO_DUPLICATE"] = DBCursor.PREV_NO_DUPLICATE] = "PREV_NO_DUPLICATE";
19
+ })(CursorDirection || (CursorDirection = {}));
20
+ export class KeyRange {
21
+ static leq(x) {
22
+ return DBKeyRange.upperBound(x);
23
+ }
24
+ static lt(x) {
25
+ return DBKeyRange.upperBound(x, true);
26
+ }
27
+ static geq(x) {
28
+ return DBKeyRange.lowerBound(x);
29
+ }
30
+ static gt(x) {
31
+ return DBKeyRange.lowerBound(x, true);
32
+ }
33
+ static between(x, y) {
34
+ return DBKeyRange.bound(x, y);
35
+ }
36
+ static gt_lt(x, y) {
37
+ return DBKeyRange.bound(x, y, true, true);
38
+ }
39
+ static gt_leq(x, y) {
40
+ return DBKeyRange.bound(x, y, true, false);
41
+ }
42
+ static geq_lt(x, y) {
43
+ return DBKeyRange.bound(x, y, false, true);
44
+ }
45
+ static eq(x, y) {
46
+ return DBKeyRange.only(x);
47
+ }
48
+ }
49
+ export var IndexdbStatus;
50
+ (function (IndexdbStatus) {
51
+ IndexdbStatus[IndexdbStatus["CONNECT_ING"] = 0] = "CONNECT_ING";
52
+ IndexdbStatus[IndexdbStatus["CONNECT_SUCCESS"] = 1] = "CONNECT_SUCCESS";
53
+ IndexdbStatus[IndexdbStatus["CONNECT_ERROR"] = 2] = "CONNECT_ERROR";
54
+ IndexdbStatus[IndexdbStatus["CONNECT_CHANGE"] = 3] = "CONNECT_CHANGE";
55
+ IndexdbStatus[IndexdbStatus["CONNECT_CLOSE"] = 4] = "CONNECT_CLOSE";
56
+ IndexdbStatus[IndexdbStatus["DATABASE_ERROR"] = 0] = "DATABASE_ERROR";
57
+ })(IndexdbStatus || (IndexdbStatus = {}));
@@ -0,0 +1,18 @@
1
+ import Table from "./Table";
2
+ export default class Database {
3
+ private name;
4
+ private version;
5
+ connect: any;
6
+ readonly events: any;
7
+ constructor(name: string, version?: number);
8
+ on(event: any, fn?: Function): this;
9
+ isOpen(): boolean;
10
+ open(name?: string | undefined, version?: number | undefined): Promise<unknown>;
11
+ drop(): Promise<unknown>;
12
+ close(): void;
13
+ createTable(tab: string | object): Table;
14
+ dropTable(tableName: string): any;
15
+ table(tableName: string): Table;
16
+ exists(table: string): any;
17
+ tables(): any;
18
+ }
@@ -0,0 +1,118 @@
1
+ import { _instance } from "./Utils";
2
+ import { IndexdbStatus, innerDB } from "./Const";
3
+ import Table from "./Table";
4
+ export default class Database {
5
+ constructor(name, version) {
6
+ this.version = 1;
7
+ this.events = {
8
+ process: (status) => {
9
+ },
10
+ success: () => {
11
+ console.debug("success");
12
+ },
13
+ close: () => {
14
+ console.debug("close");
15
+ },
16
+ change: () => {
17
+ console.debug("change");
18
+ },
19
+ error: () => {
20
+ }
21
+ };
22
+ this.name = name;
23
+ this.version = version;
24
+ this.connect = null;
25
+ }
26
+ on(event, fn) {
27
+ if (!_instance(event, Object)) {
28
+ Object.keys(event).forEach((e) => this.on(e, event[e]));
29
+ }
30
+ else {
31
+ if (!(event in this.events)) {
32
+ throw new Error(`Unsupport event type ${event}!`);
33
+ }
34
+ this.events[event.toString()] = fn;
35
+ }
36
+ return this;
37
+ }
38
+ isOpen() {
39
+ return this.connect != null;
40
+ }
41
+ open(name, version) {
42
+ this.name = name || this.name;
43
+ this.version = version || this.version;
44
+ const request = innerDB.open(this.name, version);
45
+ this.events.process(IndexdbStatus.CONNECT_ING);
46
+ request.onerror = (e) => {
47
+ const error = e.target.error;
48
+ this.events.process(IndexdbStatus.CONNECT_ERROR);
49
+ this.events.error.call(this, error);
50
+ };
51
+ request.onclose = (e) => {
52
+ this.events.process(IndexdbStatus.CONNECT_CLOSE);
53
+ this.events.close.call(this, e.target.result);
54
+ };
55
+ return new Promise((resolve) => {
56
+ request.onsuccess = (e) => {
57
+ this.connect = e.target.result;
58
+ this.events.process(IndexdbStatus.CONNECT_SUCCESS);
59
+ this.connect.onerror = this.connect.onabort = (e) => {
60
+ const error = e.target.error;
61
+ this.events.process(IndexdbStatus.DATABASE_ERROR);
62
+ this.events.error.call(this, error);
63
+ };
64
+ this.events.success.call(this, this.connect);
65
+ resolve(this);
66
+ };
67
+ request.onupgradeneeded = (e) => {
68
+ this.events.process(IndexdbStatus.CONNECT_SUCCESS);
69
+ this.connect = e.target.result;
70
+ this.events.change.call(this, this.connect);
71
+ resolve(this);
72
+ };
73
+ });
74
+ }
75
+ drop() {
76
+ this.close();
77
+ return new Promise((resolve, reject) => {
78
+ let request = innerDB.deleteDatabase(this.name);
79
+ request.onerror = function (event) {
80
+ reject(event);
81
+ };
82
+ request.onsuccess = function (event) {
83
+ resolve(event);
84
+ };
85
+ });
86
+ }
87
+ close() {
88
+ if (this.isOpen()) {
89
+ this.events.process(IndexdbStatus.CONNECT_CLOSE);
90
+ this.connect.close();
91
+ this.events.close.call(this, this.connect);
92
+ this.connect = null;
93
+ }
94
+ }
95
+ createTable(tab) {
96
+ let table = tab;
97
+ if (_instance(tab, String)) {
98
+ table = { name: tab };
99
+ }
100
+ return new Table(table, this);
101
+ }
102
+ dropTable(tableName) {
103
+ return this.connect.deleteObjectStore(tableName);
104
+ }
105
+ table(tableName) {
106
+ if (!this.exists(tableName)) {
107
+ throw new Error(`table ${tableName} not exists!`);
108
+ }
109
+ return new Table({ name: tableName }, this);
110
+ }
111
+ exists(table) {
112
+ const tables = this.tables();
113
+ return tables && tables.contains(table);
114
+ }
115
+ tables() {
116
+ return this.connect['objectStoreNames'];
117
+ }
118
+ }
@@ -0,0 +1,12 @@
1
+ import { KeyRange } from "./Const";
2
+ import Database from "./Database";
3
+ declare class Driver extends Database {
4
+ insert(table: string, data: Array<any>): Promise<unknown>;
5
+ select(table: string, keyRange?: KeyRange, limit?: number): any;
6
+ selectByKey(table: string, key: any): any;
7
+ count(table: string, keyRange?: KeyRange): any;
8
+ update(table: string, modify: any, where: any): Promise<unknown> | undefined;
9
+ delete(table: string, key: any): void;
10
+ truncate(table: string): void;
11
+ }
12
+ export default Driver;
package/lib/Driver.js ADDED
@@ -0,0 +1,25 @@
1
+ import Database from "./Database";
2
+ class Driver extends Database {
3
+ insert(table, data) {
4
+ return this.table(table).insert(data);
5
+ }
6
+ select(table, keyRange, limit) {
7
+ return this.table(table).query(keyRange, limit);
8
+ }
9
+ selectByKey(table, key) {
10
+ return this.table(table).queryByKey(key);
11
+ }
12
+ count(table, keyRange) {
13
+ return this.table(table).count(keyRange);
14
+ }
15
+ update(table, modify, where) {
16
+ return this.table(table).update(modify, where);
17
+ }
18
+ delete(table, key) {
19
+ return this.table(table).delete(key);
20
+ }
21
+ truncate(table) {
22
+ return this.table(table).clear();
23
+ }
24
+ }
25
+ export default Driver;
package/lib/Table.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ import { KeyRange, CursorDirection } from "./Const";
2
+ import TableIndex from "./TableIndex";
3
+ import Database from "./Database";
4
+ export default class Table {
5
+ readonly name: string;
6
+ readonly primaryKey: string;
7
+ readonly autoIncrement: boolean;
8
+ readonly indexes: Array<TableIndex>;
9
+ readonly database: Database;
10
+ constructor({ name, primaryKey, autoIncrement, indexes, data }: {
11
+ name?: string | undefined;
12
+ primaryKey?: string | undefined;
13
+ autoIncrement?: boolean | undefined;
14
+ indexes?: never[] | undefined;
15
+ data?: never[] | undefined;
16
+ }, database: Database);
17
+ insert(data: Array<any>): Promise<unknown>;
18
+ update(modify: any, where?: any): Promise<unknown> | undefined;
19
+ delete(key: any): void;
20
+ clear(): void;
21
+ dropIndex(name: string): void;
22
+ keys(keyRange?: KeyRange, limit?: number): any;
23
+ count(keyRange?: KeyRange): any;
24
+ query(keyRange?: KeyRange, limit?: number): any;
25
+ queryByKey(key: any): any;
26
+ fetch(keyRange?: KeyRange, direction?: CursorDirection): Promise<unknown>;
27
+ queryByIndex(name: string, key: any): any;
28
+ deplete(direction?: any): Promise<unknown>;
29
+ multiple(indexName: string, each: Function, keyRange?: KeyRange, cursorDirection?: CursorDirection): Promise<unknown>;
30
+ }
package/lib/Table.js ADDED
@@ -0,0 +1,154 @@
1
+ import { _copy, _instance } from "./Utils";
2
+ import { CursorDirection, TransactionMode } from "./Const";
3
+ const _getObjectStore = (table, mode = TransactionMode.READ_ONLY) => {
4
+ const connect = table.database.connect;
5
+ const trans = connect.transaction(table.name, mode);
6
+ trans.oncomplete = (e) => console.debug(e);
7
+ trans.onerror = (e) => console.debug(e);
8
+ return trans.objectStore(table.name);
9
+ };
10
+ const _request = (request, success) => {
11
+ return new Promise((resolve, reject) => {
12
+ request.onsuccess = (e) => {
13
+ !success ? resolve(e.target.result) : success(e.target.result, resolve);
14
+ };
15
+ request.onerror = (e) => {
16
+ reject(e.target.error);
17
+ };
18
+ });
19
+ };
20
+ export default class Table {
21
+ constructor({ name = '', primaryKey = 'id', autoIncrement = true, indexes = [], data = [] }, database) {
22
+ this.primaryKey = "id";
23
+ this.autoIncrement = false;
24
+ this.indexes = [];
25
+ this.name = name;
26
+ this.primaryKey = primaryKey;
27
+ this.autoIncrement = autoIncrement;
28
+ this.database = database;
29
+ if (!database.exists(name)) {
30
+ const store = database.connect.createObjectStore(name, { keyPath: this.primaryKey, autoIncrement });
31
+ indexes.forEach(({ name, column, unique, multiEntry }) => store.createIndex(name, column, { unique, multiEntry }));
32
+ data.forEach(item => store.add(item));
33
+ }
34
+ }
35
+ insert(data) {
36
+ const arr = _instance(data, Array) ? data : [data];
37
+ const store = _getObjectStore(this, TransactionMode.READ_WRITE);
38
+ return new Promise((resolve) => {
39
+ let results = [];
40
+ arr.forEach((item, index) => {
41
+ _request(store.add(item)).then((rs) => {
42
+ results.push(rs);
43
+ if (index + 1 === arr.length)
44
+ resolve(results);
45
+ });
46
+ });
47
+ });
48
+ }
49
+ update(modify, where) {
50
+ const store = _getObjectStore(this, TransactionMode.READ_WRITE);
51
+ if (!where) {
52
+ _request(store.put(modify));
53
+ }
54
+ else {
55
+ return new Promise((resolve, reject) => {
56
+ _request(store.getAll(where)).then((rs) => {
57
+ rs = _instance(rs, Array) ? rs : [rs];
58
+ let rows = [];
59
+ rs.forEach((item, index) => {
60
+ _request(store.put(_copy(modify, item))).then((r) => {
61
+ rows.push(r);
62
+ if (index + 1 === rs.length) {
63
+ resolve(rows);
64
+ }
65
+ });
66
+ });
67
+ }).catch((err) => reject(err));
68
+ });
69
+ }
70
+ }
71
+ delete(key) {
72
+ _request(_getObjectStore(this, TransactionMode.READ_WRITE).delete(key));
73
+ }
74
+ clear() {
75
+ _request(_getObjectStore(this, TransactionMode.READ_WRITE).clear());
76
+ }
77
+ dropIndex(name) {
78
+ _getObjectStore(this, TransactionMode.READ_WRITE).deleteIndex(name);
79
+ }
80
+ keys(keyRange, limit) {
81
+ const store = _getObjectStore(this);
82
+ const request = store.getAllKeys(keyRange, limit);
83
+ return _request(request);
84
+ }
85
+ count(keyRange) {
86
+ const request = _getObjectStore(this).count(keyRange);
87
+ return _request(request);
88
+ }
89
+ query(keyRange, limit) {
90
+ const request = _getObjectStore(this).getAll(keyRange, limit);
91
+ return _request(request);
92
+ }
93
+ queryByKey(key) {
94
+ const request = _getObjectStore(this).get(key);
95
+ return _request(request);
96
+ }
97
+ fetch(keyRange, direction) {
98
+ const store = _getObjectStore(this);
99
+ const request = store.openCursor(null, direction);
100
+ return new Promise((resolve, reject) => {
101
+ let rows = [];
102
+ _request(request, (cursor) => {
103
+ if (!cursor) {
104
+ resolve(rows);
105
+ return;
106
+ }
107
+ rows.push(cursor.value);
108
+ cursor.continue();
109
+ }).catch((err) => {
110
+ reject(err);
111
+ });
112
+ });
113
+ }
114
+ queryByIndex(name, key) {
115
+ const store = _getObjectStore(this);
116
+ const index = store.index(name);
117
+ return _request(index.getAll(key));
118
+ }
119
+ deplete(direction = CursorDirection.NEXT) {
120
+ const store = _getObjectStore(this, TransactionMode.READ_WRITE);
121
+ const request = store.openCursor(null, direction);
122
+ return new Promise((resolve, reject) => {
123
+ let rows = [];
124
+ _request(request, (cursor) => {
125
+ if (!cursor) {
126
+ resolve(rows);
127
+ return;
128
+ }
129
+ rows.push(cursor.value);
130
+ cursor.continue();
131
+ store.delete(cursor.key);
132
+ }).catch((err) => {
133
+ reject(err);
134
+ });
135
+ });
136
+ }
137
+ multiple(indexName, each, keyRange, cursorDirection) {
138
+ const store = _getObjectStore(this);
139
+ const index = store.index(indexName);
140
+ const request = index.openCursor(keyRange, cursorDirection || CursorDirection.NEXT);
141
+ return new Promise((resolve, reject) => {
142
+ let rows = [];
143
+ _request(request, (cursor) => {
144
+ if (!cursor) {
145
+ resolve(rows);
146
+ }
147
+ rows.push(cursor.value);
148
+ cursor.continue();
149
+ }).catch((err) => {
150
+ reject(err);
151
+ });
152
+ });
153
+ }
154
+ }
@@ -0,0 +1,7 @@
1
+ export default class TableIndex {
2
+ readonly name: string;
3
+ readonly column: string;
4
+ readonly unique: boolean;
5
+ readonly multiEntry: boolean;
6
+ constructor(name: string, column: string, unique?: boolean, multiEntry?: boolean);
7
+ }
@@ -0,0 +1,10 @@
1
+ export default class TableIndex {
2
+ constructor(name, column, unique, multiEntry) {
3
+ this.unique = false;
4
+ this.multiEntry = false;
5
+ this.name = name;
6
+ this.column = column;
7
+ this.unique = !!unique;
8
+ this.multiEntry = !!multiEntry;
9
+ }
10
+ }
package/lib/Utils.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function _instance(example: any, type: any): boolean;
2
+ export declare function _copy(src: any, target: any): any;
package/lib/Utils.js ADDED
@@ -0,0 +1,19 @@
1
+ export function _instance(example, type) {
2
+ let pro = type.prototype;
3
+ example = example.__proto__;
4
+ while (true) {
5
+ if (example === null)
6
+ return false;
7
+ if (pro === example)
8
+ return true;
9
+ example = example.__proto__;
10
+ }
11
+ }
12
+ export function _copy(src, target) {
13
+ if (!target)
14
+ return src;
15
+ for (let prop in src) {
16
+ target[prop] = src[prop];
17
+ }
18
+ return target;
19
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { IndexdbStatus, TransactionMode, CursorDirection, KeyRange } from "./Const";
2
+ import Driver from "./Driver";
3
+ import Database from "./Database";
4
+ import Table from "./Table";
5
+ import TableIndex from "./TableIndex";
6
+ export { IndexdbStatus, TransactionMode, CursorDirection, KeyRange, Database, TableIndex, Table };
7
+ export default Driver;
package/lib/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import { IndexdbStatus, TransactionMode, CursorDirection, KeyRange } from "./Const";
2
+ import Driver from "./Driver";
3
+ import Database from "./Database";
4
+ import Table from "./Table";
5
+ import TableIndex from "./TableIndex";
6
+ export { IndexdbStatus, TransactionMode, CursorDirection, KeyRange, Database, TableIndex, Table };
7
+ export default Driver;
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "xdriver",
3
+ "version": "1.0.01",
4
+ "description": "xdriver",
5
+ "main": "./lib/index",
6
+ "files": [
7
+ "lib/"
8
+ ],
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "build": "tsc",
12
+ "build0": "tsc && babel lib --out-dir dist && cd lib && del *.js*",
13
+ "build-test": "tsc && webpack --mode production"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://gitee.com/xxx/indexdb.git"
18
+ },
19
+ "keywords": [
20
+ "storage"
21
+ ],
22
+ "author": "xs",
23
+ "license": "ISC",
24
+ "devDependencies": {
25
+ "babel-cli": "^6.26.0",
26
+ "babel-preset-env": "^1.7.0",
27
+ "babel-preset-es2015": "^6.24.1",
28
+ "babel-preset-stage-2": "^6.24.1",
29
+ "webpack": "^5.64.2",
30
+ "webpack-cli": "^4.9.1",
31
+ "uglifyjs-webpack-plugin": "^2.2.0"
32
+ }
33
+ }