@fireproof/core 0.15.0-dev → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/LICENSE.md +232 -0
  2. package/README.md +2 -0
  3. package/dist/browser/fireproof.cjs +27910 -14036
  4. package/dist/browser/fireproof.cjs.map +4 -4
  5. package/dist/browser/fireproof.esm.js +27910 -14036
  6. package/dist/browser/fireproof.esm.js.map +4 -4
  7. package/dist/browser/fireproof.iife.js +27910 -14036
  8. package/dist/browser/fireproof.iife.js.map +4 -4
  9. package/dist/node/fireproof.cjs +37969 -24187
  10. package/dist/node/fireproof.cjs.map +4 -4
  11. package/dist/node/fireproof.esm.js +37978 -24185
  12. package/dist/node/fireproof.esm.js.map +4 -4
  13. package/dist/types/crdt-clock.d.ts +2 -2
  14. package/dist/types/crdt-helpers.d.ts +9 -14
  15. package/dist/types/crdt.d.ts +8 -9
  16. package/dist/types/database.d.ts +6 -6
  17. package/dist/types/eb-edge.d.ts +0 -0
  18. package/dist/types/eb-node.d.ts +3 -0
  19. package/dist/types/eb-web.d.ts +3 -0
  20. package/dist/types/fireproof.d.ts +0 -4
  21. package/dist/types/index.d.ts +3 -3
  22. package/dist/types/indexer-helpers.d.ts +3 -3
  23. package/dist/types/types.d.ts +35 -69
  24. package/dist/types/version.d.ts +1 -1
  25. package/dist/types/write-queue.d.ts +3 -3
  26. package/package.json +31 -30
  27. package/dist/memory/fireproof.esm.js +0 -21349
  28. package/dist/memory/fireproof.esm.js.map +0 -7
  29. package/dist/types/commit-queue.d.ts +0 -6
  30. package/dist/types/crypto-ipld.d.ts +0 -20
  31. package/dist/types/crypto-node.d.ts +0 -4
  32. package/dist/types/crypto-web.d.ts +0 -4
  33. package/dist/types/encrypt-helpers.d.ts +0 -8
  34. package/dist/types/encrypted-block.d.ts +0 -44
  35. package/dist/types/loader-helpers.d.ts +0 -5
  36. package/dist/types/loader.d.ts +0 -62
  37. package/dist/types/loaders.d.ts +0 -51
  38. package/dist/types/remote-wal.d.ts +0 -26
  39. package/dist/types/store-browser.d.ts +0 -24
  40. package/dist/types/store-fs.d.ts +0 -26
  41. package/dist/types/store-memory.d.ts +0 -24
  42. package/dist/types/store.d.ts +0 -28
  43. package/dist/types/transaction.d.ts +0 -50
@@ -1,4 +1,4 @@
1
- import { TransactionBlockstore } from './transaction';
1
+ import type { EncryptedBlockstore } from '@fireproof/encrypted-blockstore';
2
2
  import type { DocUpdate, ClockHead } from './types';
3
3
  import { ApplyHeadQueue } from './apply-head-queue';
4
4
  export declare class CRDTClock {
@@ -6,7 +6,7 @@ export declare class CRDTClock {
6
6
  zoomers: Set<() => void>;
7
7
  watchers: Set<(updates: DocUpdate[]) => void>;
8
8
  emptyWatchers: Set<() => void>;
9
- blocks: TransactionBlockstore | null;
9
+ blockstore: EncryptedBlockstore | null;
10
10
  applyHeadQueue: ApplyHeadQueue;
11
11
  constructor();
12
12
  setHead(head: ClockHead): void;
@@ -1,19 +1,14 @@
1
1
  import { Block } from 'multiformats/block';
2
- import { LoggingFetcher, Transaction } from './transaction';
3
- import type { TransactionBlockstore } from './transaction';
4
- import type { DocUpdate, ClockHead, AnyLink, DocValue, BulkResult, ChangesOptions, BlockFetcher } from './types';
5
- export declare function applyBulkUpdateToCrdt(tblocks: Transaction, head: ClockHead, updates: DocUpdate[], options?: object): Promise<BulkResult>;
6
- export declare function getValueFromCrdt(blocks: TransactionBlockstore, head: ClockHead, key: string): Promise<DocValue>;
7
- export declare function readFiles(blocks: TransactionBlockstore | LoggingFetcher, { doc }: DocValue): void;
8
- export declare function clockChangesSince(blocks: TransactionBlockstore | LoggingFetcher, head: ClockHead, since: ClockHead, opts: ChangesOptions): Promise<{
2
+ import { type EncryptedBlockstore, type CompactionFetcher, CarTransaction, BlockFetcher } from '@fireproof/encrypted-blockstore';
3
+ import type { DocUpdate, ClockHead, DocValue, CRDTMeta, ChangesOptions } from './types';
4
+ export declare function applyBulkUpdateToCrdt(tblocks: CarTransaction, head: ClockHead, updates: DocUpdate[], options?: object): Promise<CRDTMeta>;
5
+ export declare function getValueFromCrdt(blocks: EncryptedBlockstore, head: ClockHead, key: string): Promise<DocValue>;
6
+ export declare function readFiles(blocks: EncryptedBlockstore, { doc }: DocValue): void;
7
+ export declare function clockChangesSince(blocks: BlockFetcher, head: ClockHead, since: ClockHead, opts: ChangesOptions): Promise<{
9
8
  result: DocUpdate[];
10
9
  head: ClockHead;
11
10
  }>;
12
- export declare function getAllEntries(blocks: TransactionBlockstore | LoggingFetcher, head: ClockHead): AsyncGenerator<DocUpdate, void, unknown>;
13
- export declare function clockVis(blocks: TransactionBlockstore, head: ClockHead): AsyncGenerator<string, void, unknown>;
14
- export declare function doCompact(blocks: TransactionBlockstore, head: ClockHead): Promise<AnyLink | undefined>;
15
- export declare function getThatBlock({ bytes }: {
16
- cid: string;
17
- bytes: string;
18
- }): Promise<Block<unknown, 113, 18, 1>>;
11
+ export declare function getAllEntries(blocks: BlockFetcher, head: ClockHead): AsyncGenerator<DocUpdate, void, unknown>;
12
+ export declare function clockVis(blocks: EncryptedBlockstore, head: ClockHead): AsyncGenerator<string, void, unknown>;
13
+ export declare function doCompact(blockLog: CompactionFetcher, head: ClockHead): Promise<void>;
19
14
  export declare function getBlock(blocks: BlockFetcher, cidString: string): Promise<Block<unknown, 113, 18, 1>>;
@@ -1,24 +1,23 @@
1
- import { TransactionBlockstore, IndexBlockstore } from './transaction';
2
- import type { DocUpdate, BulkResult, ClockHead, FireproofOptions, ChangesOptions } from './types';
3
- import type { Index } from './index';
1
+ import { EncryptedBlockstore } from '@fireproof/encrypted-blockstore';
2
+ import type { DocUpdate, CRDTMeta, ClockHead, ConfigOpts, ChangesOptions } from './types';
3
+ import { type Index } from './index';
4
4
  import { CRDTClock } from './crdt-clock';
5
5
  export declare class CRDT {
6
6
  name: string | null;
7
- opts: FireproofOptions;
7
+ opts: ConfigOpts;
8
8
  ready: Promise<void>;
9
- blocks: TransactionBlockstore;
10
- indexBlocks: IndexBlockstore;
9
+ blockstore: EncryptedBlockstore;
10
+ indexBlockstore: EncryptedBlockstore;
11
11
  indexers: Map<string, Index>;
12
12
  clock: CRDTClock;
13
- constructor(name?: string, opts?: FireproofOptions);
14
- bulk(updates: DocUpdate[], options?: object): Promise<BulkResult>;
13
+ constructor(name?: string, opts?: ConfigOpts);
14
+ bulk(updates: DocUpdate[], options?: object): Promise<CRDTMeta>;
15
15
  allDocs(): Promise<{
16
16
  result: DocUpdate[];
17
17
  head: ClockHead;
18
18
  }>;
19
19
  vis(): Promise<string>;
20
20
  getBlock(cidString: string): Promise<import("multiformats/dist/types/src/block").Block<unknown, 113, 18, 1>>;
21
- getThatBlock(): Promise<import("multiformats/dist/types/src/block").Block<unknown, 113, 18, 1>>;
22
21
  get(key: string): Promise<import("./types").DocValue | null>;
23
22
  changes(since?: ClockHead, opts?: ChangesOptions): Promise<{
24
23
  result: DocUpdate[];
@@ -1,18 +1,20 @@
1
1
  import { WriteQueue } from './write-queue';
2
2
  import { CRDT } from './crdt';
3
- import type { DocUpdate, ClockHead, Doc, FireproofOptions, MapFn, QueryOpts, ChangesOptions } from './types';
3
+ import type { DocUpdate, ClockHead, Doc, ConfigOpts, MapFn, QueryOpts, ChangesOptions } from './types';
4
4
  import { DbResponse, ChangesResponse } from './types';
5
+ import { EncryptedBlockstore } from '@fireproof/encrypted-blockstore';
5
6
  type DbName = string | null;
6
7
  export declare class Database {
7
8
  static databases: Map<string, Database>;
8
9
  name: DbName;
9
- opts: FireproofOptions;
10
+ opts: ConfigOpts;
10
11
  _listening: boolean;
11
12
  _listeners: Set<ListenerFn>;
12
13
  _noupdate_listeners: Set<ListenerFn>;
13
14
  _crdt: CRDT;
14
15
  _writeQueue: WriteQueue;
15
- constructor(name?: string, opts?: FireproofOptions);
16
+ blockstore: EncryptedBlockstore;
17
+ constructor(name?: string, opts?: ConfigOpts);
16
18
  get(id: string): Promise<Doc>;
17
19
  put(doc: Doc): Promise<DbResponse>;
18
20
  del(id: string): Promise<DbResponse>;
@@ -36,13 +38,11 @@ export declare class Database {
36
38
  rows: import("./types").IndexRow[];
37
39
  }>;
38
40
  compact(): Promise<void>;
39
- getDashboardURL(compact?: boolean): Promise<URL>;
40
- openDashboard(): void;
41
41
  _notify(updates: DocUpdate[]): Promise<void>;
42
42
  _no_update_notify(): Promise<void>;
43
43
  }
44
44
  type UpdateListenerFn = (docs: Doc[]) => Promise<void> | void;
45
45
  type NoUpdateListenerFn = () => Promise<void> | void;
46
46
  type ListenerFn = UpdateListenerFn | NoUpdateListenerFn;
47
- export declare function fireproof(name: string, opts?: FireproofOptions): Database;
47
+ export declare function fireproof(name: string, opts?: ConfigOpts): Database;
48
48
  export {};
File without changes
@@ -0,0 +1,3 @@
1
+ import * as crypto from '@fireproof/encrypted-blockstore/crypto-node';
2
+ import * as store from '@fireproof/encrypted-blockstore/store-node';
3
+ export { store, crypto };
@@ -0,0 +1,3 @@
1
+ import * as crypto from '@fireproof/encrypted-blockstore/crypto-web';
2
+ import * as store from '@fireproof/encrypted-blockstore/store-web';
3
+ export { store, crypto };
@@ -1,7 +1,3 @@
1
1
  export * from './database';
2
- export * from './index';
3
- export * from './loader-helpers';
4
- export * from './store';
5
- export * from './loader';
6
2
 
7
3
  export * from './types';
@@ -1,12 +1,12 @@
1
1
  import type { ClockHead, MapFn, QueryOpts, IdxMeta } from './types';
2
- import { IndexBlockstore } from './transaction';
2
+ import { EncryptedBlockstore } from '@fireproof/encrypted-blockstore';
3
3
  import { IndexTree } from './indexer-helpers';
4
4
  import { CRDT } from './crdt';
5
5
  export declare function index({ _crdt }: {
6
6
  _crdt: CRDT;
7
7
  }, name: string, mapFn?: MapFn, meta?: IdxMeta): Index;
8
8
  export declare class Index {
9
- blocks: IndexBlockstore;
9
+ blockstore: EncryptedBlockstore;
10
10
  crdt: CRDT;
11
11
  name: string | null;
12
12
  mapFn: MapFn | null;
@@ -24,7 +24,7 @@ export declare class Index {
24
24
  }>;
25
25
  _resetIndex(): void;
26
26
  _hydrateIndex(): Promise<void>;
27
- _updateIndex(): Promise<(IdxMeta & import("./types").CarCommit) | {
27
+ _updateIndex(): Promise<import("@fireproof/encrypted-blockstore/dist/types/types").TransactionMeta | {
28
28
  byId: IndexTree;
29
29
  byKey: IndexTree;
30
30
  }>;
@@ -1,7 +1,7 @@
1
1
  import type { Block, Link } from 'multiformats';
2
2
  import { ProllyNode as BaseNode } from 'prolly-trees/base';
3
- import { AnyLink, DocUpdate, MapFn, DocFragment, BlockFetcher, IndexKey, IndexUpdate, QueryOpts, IndexRow } from './types';
4
- import { Transaction } from './transaction';
3
+ import { AnyLink, DocUpdate, MapFn, DocFragment, IndexKey, IndexUpdate, QueryOpts, IndexRow } from './types';
4
+ import { CarTransaction, BlockFetcher } from '@fireproof/encrypted-blockstore';
5
5
  import { CRDT } from './crdt';
6
6
  export declare class IndexTree {
7
7
  cid: AnyLink | null;
@@ -13,7 +13,7 @@ export declare function indexEntriesForChanges(changes: DocUpdate[], mapFn: MapF
13
13
  key: [string, string];
14
14
  value: DocFragment;
15
15
  }[];
16
- export declare function bulkIndex(tblocks: Transaction, inIndex: IndexTree, indexEntries: IndexUpdate[], opts: StaticProllyOptions): Promise<IndexTree>;
16
+ export declare function bulkIndex(tblocks: CarTransaction, inIndex: IndexTree, indexEntries: IndexUpdate[], opts: StaticProllyOptions): Promise<IndexTree>;
17
17
  export declare function loadIndex(tblocks: BlockFetcher, cid: AnyLink, opts: StaticProllyOptions): Promise<ProllyNode>;
18
18
  export declare function applyQuery(crdt: CRDT, resp: {
19
19
  result: IndexRow[];
@@ -1,9 +1,10 @@
1
1
  import type { Link } from 'multiformats'
2
2
  import type { EventLink } from '@alanshaw/pail/clock'
3
3
  import type { EventData } from '@alanshaw/pail/crdt'
4
- import { ClockHead, Doc } from './types'
5
4
 
6
- export type FireproofOptions = {
5
+ import type { DbMeta } from '@fireproof/encrypted-blockstore'
6
+
7
+ export type ConfigOpts = {
7
8
  public?: boolean
8
9
  meta?: DbMeta
9
10
  persistIndexes?: boolean
@@ -14,7 +15,15 @@ export type ClockLink = EventLink<EventData>
14
15
 
15
16
  export type ClockHead = ClockLink[]
16
17
 
17
- export type DocFragment = Uint8Array | string | number | boolean | null | DocFragment[] | { [key: string]: DocFragment }
18
+ export type DocFragment =
19
+ | Uint8Array
20
+ | string
21
+ | number
22
+ | boolean
23
+ | null
24
+ | AnyLink
25
+ | DocFragment[]
26
+ | { [key: string]: DocFragment }
18
27
 
19
28
  export type Doc = DocBody & DocBase
20
29
 
@@ -25,31 +34,25 @@ export type DocBase = {
25
34
  }
26
35
 
27
36
  export type DocFileMeta = {
28
- type: string;
29
- size: number;
30
- cid: AnyLink;
31
- car?: AnyLink;
32
- url?: string;
33
- file?: () => Promise<File>;
37
+ type: string
38
+ size: number
39
+ cid: AnyLink
40
+ car?: AnyLink
41
+ url?: string
42
+ file?: () => Promise<File>
34
43
  }
35
44
 
36
- type DocFiles = {
37
- [key: string]: File | DocFileMeta
38
- }
45
+ export type DocFiles = Record<string, DocFileMeta | File>;
39
46
 
40
- export type FileCarHeader = {
41
- files: AnyLink[]
42
- }
43
- type DocBody = {
44
- _files?: DocFiles
45
- _publicFiles?: DocFiles
46
- [key: string]: DocFragment
47
+ type DocBody = Record<string, DocFragment> & {
48
+ _files?: DocFiles;
49
+ _publicFiles?: DocFiles;
47
50
  }
48
51
 
49
- type DocMeta = {
50
- proof?: DocFragment
51
- clock?: ClockHead
52
- }
52
+ // type DocMeta = {
53
+ // proof?: DocFragment
54
+ // clock?: ClockHead
55
+ // }
53
56
 
54
57
  export type DocUpdate = {
55
58
  key: string
@@ -57,16 +60,12 @@ export type DocUpdate = {
57
60
  del?: boolean
58
61
  clock?: AnyLink
59
62
  }
60
-
63
+ // todo merge into above
61
64
  export type DocValue = {
62
65
  doc?: DocBody
63
66
  del?: boolean
64
67
  }
65
68
 
66
- type IndexCars = {
67
- [key: string]: AnyLink
68
- }
69
-
70
69
  export type IndexKey = [string, string] | string
71
70
 
72
71
  export type IndexUpdate = {
@@ -84,17 +83,13 @@ export type IndexRow = {
84
83
  del?: boolean
85
84
  }
86
85
 
87
- type CarCommit = {
88
- car?: AnyLink
89
- }
90
-
91
- export type BulkResult = {
86
+ export type CRDTMeta = {
92
87
  head: ClockHead
93
88
  }
94
89
 
95
- export type FileResult = {
96
- files: { [key: string]: DocFileMeta }
97
- }
90
+ // export type FileMeta = {
91
+ // files: { [key: string]: DocFileMeta }
92
+ // }
98
93
 
99
94
  export type IdxMeta = {
100
95
  byId: AnyLink
@@ -108,51 +103,22 @@ export type IdxMetaMap = {
108
103
  indexes: Map<string, IdxMeta>
109
104
  }
110
105
 
111
- type CarHeader = {
112
- cars: AnyLink[]
113
- compact: AnyLink[]
114
- }
115
-
116
- export type IdxCarHeader = CarHeader & IdxMetaMap
117
-
118
- export type DbCarHeader = CarHeader & {
119
- head: ClockHead
120
- }
121
-
122
- export type AnyCarHeader = DbCarHeader | IdxCarHeader | FileCarHeader
123
-
124
- export type CarLoaderHeader = DbCarHeader | IdxCarHeader
125
-
126
106
  export type QueryOpts = {
127
107
  descending?: boolean
128
108
  limit?: number
129
109
  includeDocs?: boolean
130
110
  range?: [IndexKey, IndexKey]
131
- key?: DocFragment,
111
+ key?: DocFragment
132
112
  keys?: DocFragment[]
133
113
  prefix?: DocFragment | [DocFragment]
134
114
  }
135
115
 
136
116
  export type AnyLink = Link<unknown, number, number, 1 | 0>
137
117
  export type AnyBlock = { cid: AnyLink; bytes: Uint8Array }
138
- export type AnyDecodedBlock = { cid: AnyLink; bytes: Uint8Array, value: any }
139
-
140
- export type BlockFetcher = { get: (link: AnyLink) => Promise<AnyBlock | undefined> }
141
-
142
- type CallbackFn = (k: DocFragment, v?: DocFragment) => void
143
-
144
- export type MapFn = (doc: Doc, map: CallbackFn) => DocFragment | void
145
-
146
- export type DbMeta = { car: AnyLink, key: string | null }
147
-
148
- export type CommitOpts = { noLoader?: boolean, compact?: boolean, public?: boolean }
149
-
150
- export interface CarMakeable {
151
- entries(): Iterable<AnyBlock>
152
- get(cid: AnyLink): Promise<AnyBlock | undefined>
153
- }
154
-
118
+ export type AnyDecodedBlock = { cid: AnyLink; bytes: Uint8Array; value: any }
155
119
 
120
+ type EmitFn = (k: DocFragment, v?: DocFragment) => void
121
+ export type MapFn = (doc: Doc, emit: EmitFn) => DocFragment | void
156
122
 
157
123
  export type ChangesOptions = {
158
124
  dirty?: boolean
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "0.15.0-dev";
1
+ export declare const PACKAGE_VERSION = "0.16.1";
@@ -1,7 +1,7 @@
1
- import { BulkResult, DocUpdate } from './types';
2
- type WorkerFunction = (tasks: DocUpdate[]) => Promise<BulkResult>;
1
+ import { CRDTMeta, DocUpdate } from './types';
2
+ type WorkerFunction = (tasks: DocUpdate[]) => Promise<CRDTMeta>;
3
3
  export type WriteQueue = {
4
- push(task: DocUpdate): Promise<BulkResult>;
4
+ push(task: DocUpdate): Promise<CRDTMeta>;
5
5
  };
6
6
  export declare function writeQueue(worker: WorkerFunction, payload?: number, unbounded?: boolean): WriteQueue;
7
7
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fireproof/core",
3
- "version": "0.15.0-dev",
3
+ "version": "0.16.1",
4
4
  "description": "Live database for the web.",
5
5
  "main": "./dist/browser/fireproof.cjs",
6
6
  "module": "./dist/browser/fireproof.esm.js",
@@ -33,32 +33,6 @@
33
33
  "dist/types"
34
34
  ],
35
35
  "type": "module",
36
- "scripts": {
37
- "prepublishOnly": "cp ../../README.md . && npm run build:all",
38
- "postpublish": "rm README.md",
39
- "clean": "rm -rf dist/*",
40
- "build:version": "node -p \"'export const PACKAGE_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
41
- "build:esbuild": "node ./scripts/build.js",
42
- "build:_types": "tsc --declaration --outDir dist/types && node ./scripts/types.js",
43
- "build:rollup": "rollup -c scripts/rollup.js",
44
- "build:tsc": "npm run clean && tsc && mkdir dist/tsc && mv dist/*.js dist/tsc/ && node ./scripts/types.js",
45
- "test:watch:follow": "nodemon -w src -w test -e ts,js --exec \"sleep 2 && npm run test:node\"",
46
- "test:node": "node ./scripts/test.js",
47
- "test:browser": "node ./scripts/browser-test.js",
48
- "lint:fix": "eslint --fix '{src,test}/**/*.{js,ts}'",
49
- "lint:exports": "ts-unused-exports tsconfig.json",
50
- "serve": "npx serve-http -p 8080 test/www",
51
- "lint": "eslint 'src/**/*.{js,ts}'",
52
- "analyze": "node ./scripts/analyze.js",
53
- "test:coverage": "c8 --reporter=html --include='dist/*' node ./scripts/test.js && open coverage/src/index.html",
54
- "tsc:watch": "tsc --watch",
55
- "lint:all": "npm run lint:fix && npm run lint:exports",
56
- "test:watch": "nodemon -w src -w test -e ts,js --exec \"npm run build:test && npm run test:node\"",
57
- "test": "npm run build:test && npm run test:node && tsc",
58
- "build:test": "node ./scripts/build.js",
59
- "build": "npm run build:version && npm run build:tsc && npm run build:test && cp dist/browser/fireproof.iife.* test/www/",
60
- "build:all": " npm run build && npm run test:browser"
61
- },
62
36
  "keywords": [
63
37
  "database",
64
38
  "JSON",
@@ -123,7 +97,7 @@
123
97
  "util": "^0.12.5"
124
98
  },
125
99
  "dependencies": {
126
- "@alanshaw/pail": "^0.3.3",
100
+ "@alanshaw/pail": "^0.3.4",
127
101
  "@ipld/car": "^5.2.0",
128
102
  "@ipld/dag-cbor": "^9.0.3",
129
103
  "@ipld/dag-json": "^10.1.2",
@@ -135,6 +109,33 @@
135
109
  "multiformats": "^12.0.1",
136
110
  "p-limit": "^4.0.0",
137
111
  "prolly-trees": "^1.0.4",
138
- "uuidv7": "^0.6.2"
112
+ "uuidv7": "^0.6.2",
113
+ "@fireproof/encrypted-blockstore": "^0.16.10"
114
+ },
115
+ "scripts": {
116
+ "build": "npm run build:version && npm run build:tsc && npm run build:test && cp dist/browser/fireproof.iife.* test/www/",
117
+ "build:all": " npm run build && npm run test:browser",
118
+ "build:clean": "rm -rf dist",
119
+ "build:esbuild": "node ./scripts/build.js",
120
+ "build:rollup": "rollup -c scripts/rollup.js",
121
+ "build:test": "node ./scripts/build.js",
122
+ "build:tsc": "npm run build:clean && tsc && mkdir dist/tsc && mv dist/*.js dist/tsc/ && node ./scripts/types.js",
123
+ "build:version": "node -p \"'export const PACKAGE_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
124
+ "build:_types": "tsc --declaration --outDir dist/types && node ./scripts/types.js",
125
+ "clean": "rm -rf node_modules",
126
+ "test:watch:follow": "nodemon -w src -w test -e ts,js --exec \"sleep 2 && npm run test:node\"",
127
+ "test:node": "node ./scripts/test.js",
128
+ "test:browser": "node ./scripts/browser-test.js",
129
+ "lint:fix": "eslint --fix '{src,test}/**/*.{js,ts}'",
130
+ "lint:exports": "ts-unused-exports tsconfig.json",
131
+ "serve": "npx serve-http -p 8080 test/www",
132
+ "lint": "eslint 'src/**/*.{js,ts}'",
133
+ "analyze": "node ./scripts/analyze.js",
134
+ "test:coverage": "c8 --reporter=html --include='dist/*' node ./scripts/test.js && open coverage/src/index.html",
135
+ "tsc:watch": "tsc --watch",
136
+ "lint:all": "npm run lint:fix && npm run lint:exports",
137
+ "test:watch": "nodemon -w src -w test -e ts,js --exec \"npm run build:test && npm run test:node\"",
138
+ "test": "npm run build:test && npm run test:node && tsc",
139
+ "test:serve": "npx serve-http test/www -p 8080"
139
140
  }
140
- }
141
+ }