diff --git a/README.md b/README.md index 15f9e3d..8a04288 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ async function main(){ const db = new Database(path.resolve(__dirname, './db')) await db.put('foo', 'bar') console.log( - new TextDecorder().decode(await db.get('foo')) + new TextDecoder().decode(await db.get('foo')) ) // 'bar' } @@ -51,7 +51,7 @@ main() ## Roadmap -- [x] Release 1.0 (2020-07-07) +- [x] Release 1.0 (2020-7-7) - [ ] Support [Deno](https://deno.land) (2020-9-1) ## Benchmark diff --git a/package.json b/package.json index 79b2976..ffedee3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "rippledb", - "version": "1.0.0-rc.9", - "main": "build/port/node.js", + "version": "1.0.0", + "main": "build/port/node", "repository": "https://github.com/heineiuo/rippledb", "author": "heineiuo ", "license": "MIT", @@ -23,8 +23,6 @@ }, "files": [ "build", - "index.d.ts", - "index.js", "LICENSE" ], "devDependencies": { diff --git a/port/node/cleanup.ts b/port/node/cleanup.ts index 39f4802..4153e82 100644 --- a/port/node/cleanup.ts +++ b/port/node/cleanup.ts @@ -1,3 +1,5 @@ +// Rewite to TypeScript https://github.com/jtlapp/node-cleanup/ + const DEFAULT_MESSAGES = { ctrlC: "[ctrl-C]", uncaughtException: "Uncaught exception...", diff --git a/port/node/index.ts b/port/node/index.ts index 14c3d25..3518392 100644 --- a/port/node/index.ts +++ b/port/node/index.ts @@ -1,11 +1,13 @@ -import { InternalDatabase, Env, DatabaseOptions } from "../../src"; import fs from "fs"; import os from "os"; -import { FileHandle } from "../../src/Env"; -import { onExit } from "./cleanup"; +import InternalDatabase from "../../src/Database"; +import { Env, FileHandle } from "../../src/Env"; +import { DatabaseOptions } from "../../src/Options"; import { InternalDBRepairer } from "../../src/DBRepairer"; +import { WriteBatch } from "../../src/WriteBatch"; +import { onExit } from "./cleanup"; -export class NodeEnv implements Env { +class NodeEnv implements Env { platform(): string { return os.platform(); } @@ -50,16 +52,26 @@ export class NodeEnv implements Env { } } -export class Database extends InternalDatabase { +class Database extends InternalDatabase { constructor(dbpath: string, options: DatabaseOptions = {}) { if (!options.env) options.env = new NodeEnv(); super(dbpath, options); } } -export class DBRepairer extends InternalDBRepairer { +class DBRepairer extends InternalDBRepairer { constructor(dbpath: string, options: DatabaseOptions = {}) { if (!options.env) options.env = new NodeEnv(); super(dbpath, options); } } + +export { + WriteBatch, + Env, + NodeEnv, + Database, + DBRepairer, + InternalDBRepairer, + InternalDatabase, +}; diff --git a/src/BitBuffer.ts b/src/BitBuffer.ts index 95774e4..cfcaa04 100644 --- a/src/BitBuffer.ts +++ b/src/BitBuffer.ts @@ -1,4 +1,5 @@ -// https://github.com/wiedi/node-bitbuffer +// Rwrite to TypeScript https://github.com/wiedi/node-bitbuffer + import { Buffer } from "./Buffer"; export default class BitBuffer { diff --git a/src/Buffer.ts b/src/Buffer.ts index c58652b..04ad0bc 100644 --- a/src/Buffer.ts +++ b/src/Buffer.ts @@ -1,3 +1,5 @@ +// Rewrite to TypeScript https://github.com/feross/buffer + export class Buffer extends Uint8Array { static kMaxLength = 0x7fffffff; diff --git a/src/Crc32.ts b/src/Crc32.ts index 74551a1..b14c2ec 100644 --- a/src/Crc32.ts +++ b/src/Crc32.ts @@ -1,3 +1,5 @@ +// Rewrite to TypeScript https://github.com/brianloveswords/buffer-crc32 + import { Buffer } from "./Buffer"; const CRC_TABLE = new Int32Array([ diff --git a/src/LRUCache.ts b/src/LRUCache.ts index 6014328..bc62af3 100644 --- a/src/LRUCache.ts +++ b/src/LRUCache.ts @@ -1,3 +1,5 @@ +// Rewrite to TypeScript https://github.com/isaacs/node-lru-cache + import { Yallist, YallistNode } from "./Yallist"; const MAX = Symbol("max"); diff --git a/src/Yallist.ts b/src/Yallist.ts index df34b71..0610063 100644 --- a/src/Yallist.ts +++ b/src/Yallist.ts @@ -1,3 +1,5 @@ +// Rewrite to TypeScript https://github.com/isaacs/yallist + export class YallistNode { constructor( value: T, diff --git a/src/index.ts b/src/index.ts index 18548c2..84f2675 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,6 +6,7 @@ */ export { default as InternalDatabase } from "./Database"; +export { InternalDBRepairer } from "./DBRepairer"; export { WriteBatch } from "./WriteBatch"; export { Options,