update deps, move idb-bridge to node16 module resolution

This commit is contained in:
Florian Dold 2022-10-13 14:24:20 +02:00
parent 7b40a9f415
commit eb5b075c01
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
18 changed files with 429 additions and 364 deletions

View File

@ -20,12 +20,12 @@
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"ava": "^4.0.1",
"ava": "^4.3.3",
"rimraf": "^3.0.2",
"rollup": "^2.79.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"source-map-support": "^0.5.21",
"typescript": "^4.8.2"
"typescript": "^4.8.4"
},
"dependencies": {
"@gnu-taler/taler-util": "workspace:*",
@ -33,7 +33,7 @@
"fflate": "^0.7.3",
"hash-wasm": "^4.9.0",
"node-fetch": "^3.2.0",
"tslib": "^2.3.1"
"tslib": "^2.4.0"
},
"ava": {
"files": [

View File

@ -46,7 +46,7 @@
"jssha": "^3.2.0",
"mocha": "^9.2.0",
"sass": "1.32.13",
"typescript": "^4.8.2",
"typescript": "^4.8.4",
"ws": "7.4.5"
}
}

View File

@ -16,20 +16,25 @@
"clean": "rimraf dist lib tsconfig.tsbuildinfo",
"pretty": "prettier --write src"
},
"exports": {
".": {
"default": "./lib/index.js"
}
},
"devDependencies": {
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@types/node": "^17.0.17",
"ava": "^4.0.1",
"@types/node": "^18.8.5",
"ava": "^4.3.3",
"esm": "^3.2.25",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"rollup": "^2.79.0",
"typescript": "^4.8.2"
"typescript": "^4.8.4"
},
"dependencies": {
"tslib": "^2.3.1"
"tslib": "^2.4.0"
},
"ava": {
"require": [

View File

@ -1,26 +1,17 @@
import {
DatabaseTransaction,
RecordGetResponse,
RecordGetRequest,
Schema,
Backend,
DatabaseConnection,
DatabaseTransaction,
IndexProperties,
ObjectStoreProperties,
RecordGetRequest,
RecordGetResponse,
RecordStoreRequest,
RecordStoreResponse,
DatabaseConnection,
ObjectStoreProperties,
StoreLevel,
ResultLevel,
IndexProperties,
} from "./backend-interface";
import { Listener } from "./util/FakeEventTarget";
import {
DatabaseDump,
ObjectStoreDump,
IndexRecord,
ObjectStoreRecord,
MemoryBackendDump,
} from "./MemoryBackend";
import { Event, IDBKeyRange } from "./idbtypes";
Schema,
StoreLevel,
} from "./backend-interface.js";
import {
BridgeIDBCursor,
BridgeIDBDatabase,
@ -34,8 +25,21 @@ import {
BridgeIDBVersionChangeEvent,
DatabaseList,
RequestObj,
} from "./bridge-idb";
} from "./bridge-idb.js";
import { Event } from "./idbtypes.js";
import {
DatabaseDump,
IndexRecord,
MemoryBackendDump,
ObjectStoreDump,
ObjectStoreRecord,
} from "./MemoryBackend.js";
import { Listener } from "./util/FakeEventTarget.js";
export * from "./idbtypes.js";
export { MemoryBackend } from "./MemoryBackend.js";
export type { AccessStats } from "./MemoryBackend.js";
export * from "./util/structuredClone.js";
export {
BridgeIDBCursor,
BridgeIDBDatabase,
@ -71,9 +75,6 @@ export type {
Listener,
};
export { MemoryBackend } from "./MemoryBackend";
export type { AccessStats } from "./MemoryBackend";
// globalThis polyfill, see https://mathiasbynens.be/notes/globalthis
(function () {
if (typeof globalThis === "object") return;
@ -123,7 +124,3 @@ export function shimIndexedDB(factory: BridgeIDBFactory): void {
g.IDBTransaction = BridgeIDBTransaction;
g.IDBVersionChangeEvent = BridgeIDBVersionChangeEvent;
}
export * from "./idbtypes";
export * from "./util/structuredClone";

View File

@ -1,22 +1,22 @@
// B+ tree by David Piepgrass. License: MIT
import { ISortedMap, ISortedMapF } from "./interfaces";
import { ISortedMap, ISortedMapF } from "./interfaces.js";
export type {
ISetSource,
ISetSink,
ISet,
ISetF,
ISortedSetSource,
ISortedSet,
ISortedSetF,
IMapSource,
IMapSink,
IMap,
IMapF,
ISortedMapSource,
IMapSink,
IMapSource,
ISet,
ISetF,
ISetSink,
ISetSource,
ISortedMap,
ISortedMapF,
} from "./interfaces";
ISortedMapSource,
ISortedSet,
ISortedSetF,
ISortedSetSource,
} from "./interfaces.js";
export type EditRangeResult<V, R = number> = {
value?: V;
@ -59,15 +59,15 @@ export type DefaultComparable =
| undefined
| (number | string)[]
| {
valueOf: () =>
| number
| string
| Date
| boolean
| null
| undefined
| (number | string)[];
};
valueOf: () =>
| number
| string
| Date
| boolean
| null
| undefined
| (number | string)[];
};
/**
* Compares DefaultComparables to form a strict partial ordering.
@ -216,7 +216,8 @@ export function simpleComparator(a: any, b: any): number {
* @author David Piepgrass
*/
export default class BTree<K = any, V = any>
implements ISortedMapF<K, V>, ISortedMap<K, V> {
implements ISortedMapF<K, V>, ISortedMap<K, V>
{
private _root: BNode<K, V> = EmptyLeaf as BNode<K, V>;
_size: number = 0;
_maxNodeSize: number;
@ -242,7 +243,7 @@ export default class BTree<K = any, V = any>
) {
this._maxNodeSize = maxNodeSize! >= 4 ? Math.min(maxNodeSize!, 256) : 32;
this._compare =
compare || ((defaultComparator as any) as (a: K, b: K) => number);
compare || (defaultComparator as any as (a: K, b: K) => number);
if (entries) this.setPairs(entries);
}
@ -463,7 +464,7 @@ export default class BTree<K = any, V = any>
nu.editAll((k, v, i) => {
return (tmp.value = callback(v, k, i)), tmp as any;
});
return (nu as any) as BTree<K, R>;
return nu as any as BTree<K, R>;
}
/** Performs a reduce operation like the `reduce` method of `Array`.
@ -534,7 +535,7 @@ export default class BTree<K = any, V = any>
: leaf.indexOf(lowestKey, 0, this._compare) - 1;
return iterator<[K, V]>(() => {
jump: for (; ;) {
jump: for (;;) {
switch (state) {
case 0:
if (++i < leaf.keys.length)
@ -550,7 +551,7 @@ export default class BTree<K = any, V = any>
state = 2;
case 2:
// Advance to the next leaf node
for (var level = -1; ;) {
for (var level = -1; ; ) {
if (++level >= nodequeue.length) {
state = 3;
continue jump;
@ -558,9 +559,9 @@ export default class BTree<K = any, V = any>
if (++nodeindex[level] < nodequeue[level].length) break;
}
for (; level > 0; level--) {
nodequeue[level - 1] = (nodequeue[level][
nodeindex[level]
] as BNodeInternal<K, V>).children;
nodequeue[level - 1] = (
nodequeue[level][nodeindex[level]] as BNodeInternal<K, V>
).children;
nodeindex[level - 1] = 0;
}
leaf = nodequeue[0][nodeindex[0]];
@ -606,7 +607,7 @@ export default class BTree<K = any, V = any>
var state = reusedArray !== undefined ? 1 : 0;
return iterator<[K, V]>(() => {
jump: for (; ;) {
jump: for (;;) {
switch (state) {
case 0:
if (--i >= 0)
@ -622,7 +623,7 @@ export default class BTree<K = any, V = any>
state = 2;
case 2:
// Advance to the next leaf node
for (var level = -1; ;) {
for (var level = -1; ; ) {
if (++level >= nodequeue.length) {
state = 3;
continue jump;
@ -630,9 +631,9 @@ export default class BTree<K = any, V = any>
if (--nodeindex[level] >= 0) break;
}
for (; level > 0; level--) {
nodequeue[level - 1] = (nodequeue[level][
nodeindex[level]
] as BNodeInternal<K, V>).children;
nodequeue[level - 1] = (
nodequeue[level][nodeindex[level]] as BNodeInternal<K, V>
).children;
nodeindex[level - 1] = nodequeue[level - 1].length - 1;
}
leaf = nodequeue[0][nodeindex[0]];
@ -763,7 +764,7 @@ export default class BTree<K = any, V = any>
thisLeaf.values[thisLevelIndices[thisLevelIndices.length - 1]];
const valOther =
otherLeaf.values[
otherLevelIndices[otherLevelIndices.length - 1]
otherLevelIndices[otherLevelIndices.length - 1]
];
if (!Object.is(valThis, valOther)) {
const result = different(
@ -782,7 +783,7 @@ export default class BTree<K = any, V = any>
if (otherLeaf && onlyOther) {
const otherVal =
otherLeaf.values[
otherLevelIndices[otherLevelIndices.length - 1]
otherLevelIndices[otherLevelIndices.length - 1]
];
const result = onlyOther(otherCursor.currentKey, otherVal);
if (result && result.break) return result.break;
@ -918,9 +919,10 @@ export default class BTree<K = any, V = any>
levelIndexWalkBack + 1,
);
// Move to new internal node
cursor.currentKey = internalSpine[levelIndexWalkBack][
--levelIndices[levelIndexWalkBack]
].maxKey();
cursor.currentKey =
internalSpine[levelIndexWalkBack][
--levelIndices[levelIndexWalkBack]
].maxKey();
return true;
}
levelIndexWalkBack--;
@ -930,7 +932,7 @@ export default class BTree<K = any, V = any>
} else {
// Move to new leaf value
const valueIndex = --levelIndices[levelsLength - 1];
cursor.currentKey = ((leaf as unknown) as BNode<K, V>).keys[valueIndex];
cursor.currentKey = (leaf as unknown as BNode<K, V>).keys[valueIndex];
return true;
}
} else {
@ -1119,7 +1121,7 @@ export default class BTree<K = any, V = any>
* avoid creating a new array on every iteration.
*/
nextHigherPair(key: K | undefined, reusedArray?: [K, V]): [K, V] | undefined {
reusedArray = reusedArray || (([] as unknown) as [K, V]);
reusedArray = reusedArray || ([] as unknown as [K, V]);
if (key === undefined) {
return this._root.minPair(reusedArray);
}
@ -1146,7 +1148,7 @@ export default class BTree<K = any, V = any>
* avoid creating a new array each time you call this method.
*/
nextLowerPair(key: K | undefined, reusedArray?: [K, V]): [K, V] | undefined {
reusedArray = reusedArray || (([] as unknown) as [K, V]);
reusedArray = reusedArray || ([] as unknown as [K, V]);
if (key === undefined) {
return this._root.maxPair(reusedArray);
}
@ -1178,7 +1180,7 @@ export default class BTree<K = any, V = any>
key,
this._compare,
true,
reusedArray || (([] as unknown) as [K, V]),
reusedArray || ([] as unknown as [K, V]),
);
}
@ -1194,7 +1196,7 @@ export default class BTree<K = any, V = any>
key,
this._compare,
true,
reusedArray || (([] as unknown) as [K, V]),
reusedArray || ([] as unknown as [K, V]),
);
}
@ -1345,7 +1347,7 @@ export default class BTree<K = any, V = any>
this._root = root =
root.keys.length === 0
? EmptyLeaf
: ((root as any) as BNodeInternal<K, V>).children[0];
: (root as any as BNodeInternal<K, V>).children[0];
}
}
@ -1390,7 +1392,7 @@ export default class BTree<K = any, V = any>
height++;
node = node.isLeaf
? undefined
: ((node as unknown) as BNodeInternal<K, V>).children[0];
: (node as unknown as BNodeInternal<K, V>).children[0];
}
return height;
}
@ -1405,9 +1407,12 @@ export default class BTree<K = any, V = any>
var t = this as any;
// Note: all other mutators ultimately call set() or editRange()
// so we don't need to override those others.
t.clear = t.set = t.editRange = function () {
throw new Error("Attempted to modify a frozen BTree");
};
t.clear =
t.set =
t.editRange =
function () {
throw new Error("Attempted to modify a frozen BTree");
};
}
/** Ensures mutations are allowed, reversing the effect of freeze(). */
@ -2191,7 +2196,7 @@ class BNodeInternal<K, V> extends BNode<K, V> {
this.keys.push.apply(this.keys, rhs.keys);
this.children.push.apply(
this.children,
((rhs as any) as BNodeInternal<K, V>).children,
(rhs as any as BNodeInternal<K, V>).children,
);
// If our children are themselves almost empty due to a mass-delete,
// they may need to be merged too (but only the oldLength-1 and its

View File

@ -21,7 +21,7 @@ import {
Event,
EventListenerOrEventListenerObject,
EventListener,
} from "../idbtypes";
} from "../idbtypes.js";
type EventTypeProp =
| "onabort"

View File

@ -15,7 +15,7 @@
permissions and limitations under the License.
*/
import { IDBKeyPath } from "../idbtypes";
import { IDBKeyPath } from "../idbtypes.js";
export function normalizeKeyPath(
keyPath: IDBKeyPath | IDBKeyPath[],

View File

@ -2,8 +2,8 @@
"compilerOptions": {
"composite": true,
"lib": ["es6"],
"module": "ESNext",
"moduleResolution": "node",
"module": "ES2020",
"moduleResolution": "Node16",
"target": "ES6",
"allowJs": true,
"noImplicitAny": true,

View File

@ -12,10 +12,10 @@
},
"devDependencies": {
"po2json": "^0.4.5",
"typescript": "^4.8.2"
"typescript": "^4.8.4"
},
"dependencies": {
"@types/node": "^17.0.17",
"@types/node": "^18.8.5",
"glob": "^7.2.0"
}
}

View File

@ -25,16 +25,16 @@
"pretty": "prettier --write src"
},
"devDependencies": {
"@types/node": "^17.0.17",
"ava": "^4.0.1",
"@types/node": "^18.8.5",
"ava": "^4.3.3",
"esbuild": "^0.14.21",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"typescript": "^4.8.2"
"typescript": "^4.8.4"
},
"dependencies": {
"big-integer": "^1.6.51",
"jed": "^1.1.1",
"tslib": "^2.3.1"
"tslib": "^2.4.0"
}
}

View File

@ -29,18 +29,18 @@
"pretty": "prettier --write src"
},
"devDependencies": {
"@types/node": "^17.0.17",
"ava": "^4.0.1",
"@types/node": "^18.8.5",
"ava": "^4.3.3",
"esbuild": "^0.14.21",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"typescript": "^4.8.2"
"typescript": "^4.8.4"
},
"dependencies": {
"big-integer": "^1.6.51",
"fflate": "^0.7.3",
"jed": "^1.1.1",
"tslib": "^2.3.1"
"tslib": "^2.4.0"
},
"ava": {
"files": [

View File

@ -52,7 +52,12 @@ interface URLSearchParams {
export interface URLSearchParamsCtor {
new (
init?: string[][] | Record<string, string> | string | URLSearchParams,
init?:
| URLSearchParams
| string
| Record<string, string | ReadonlyArray<string>>
| Iterable<[string, string]>
| ReadonlyArray<[string, string]>,
): URLSearchParams;
}

View File

@ -34,20 +34,20 @@
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-replace": "^4.0.0",
"@types/node": "^17.0.17",
"@types/node": "^18.8.5",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"rollup": "^2.79.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-terser": "^7.0.2",
"typedoc": "^0.23.14",
"typescript": "^4.8.2"
"typedoc": "^0.23.16",
"typescript": "^4.8.4"
},
"dependencies": {
"@gnu-taler/taler-util": "workspace:*",
"@gnu-taler/taler-wallet-core": "workspace:*",
"axios": "^0.27.2",
"source-map-support": "^0.5.21",
"tslib": "^2.3.1"
"tslib": "^2.4.0"
}
}

View File

@ -495,7 +495,7 @@ export async function lintExchangeDeployment(
verbose: boolean,
cont: boolean,
): Promise<void> {
if (process.getuid() != 0) {
if (process.getuid!() != 0) {
console.log(
"warning: the exchange deployment linter is designed to be run as root",
);

View File

@ -42,7 +42,7 @@
"@gnu-taler/pogen": "workspace:*",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"ava": "^4.0.1",
"ava": "^4.3.3",
"c8": "^7.11.0",
"eslint": "^8.8.0",
"eslint-config-airbnb-typescript": "^16.1.0",
@ -57,18 +57,18 @@
"rollup": "^2.79.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"source-map-resolve": "^0.6.0",
"typedoc": "^0.23.14",
"typescript": "^4.8.2"
"typedoc": "^0.23.16",
"typescript": "^4.8.4"
},
"dependencies": {
"@gnu-taler/idb-bridge": "workspace:*",
"@gnu-taler/taler-util": "workspace:*",
"@types/node": "^17.0.17",
"@types/node": "^18.8.5",
"axios": "^0.27.2",
"big-integer": "^1.6.51",
"fflate": "^0.7.3",
"source-map-support": "^0.5.21",
"tslib": "^2.3.1"
"tslib": "^2.4.0"
},
"ava": {
"files": [

View File

@ -31,17 +31,17 @@
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-replace": "^4.0.0",
"@types/node": "^17.0.17",
"@types/node": "^18.8.5",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"rollup": "^2.79.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-terser": "^7.0.2",
"typescript": "^4.8.2"
"typescript": "^4.8.4"
},
"dependencies": {
"@gnu-taler/taler-util": "workspace:*",
"@gnu-taler/taler-wallet-core": "workspace:*",
"tslib": "^2.3.1"
"tslib": "^2.4.0"
}
}

View File

@ -29,7 +29,7 @@
"preact-router": "3.2.1",
"qr-scanner": "^1.4.1",
"qrcode-generator": "^1.4.4",
"tslib": "^2.3.1",
"tslib": "^2.4.0",
"ws": "7.4.5"
},
"eslintConfig": {
@ -57,10 +57,10 @@
"@testing-library/preact": "^2.0.1",
"@testing-library/preact-hooks": "^1.1.0",
"@types/chai": "^4.3.0",
"@types/chrome": "0.0.176",
"@types/chrome": "0.0.197",
"@types/history": "^4.7.8",
"@types/mocha": "^9.0.0",
"@types/node": "^17.0.8",
"@types/node": "^18.8.5",
"babel-loader": "^8.2.3",
"babel-plugin-transform-react-jsx": "^6.24.1",
"chai": "^4.3.6",
@ -71,7 +71,7 @@
"preact-cli": "^3.3.5",
"preact-render-to-string": "^5.1.19",
"rimraf": "^3.0.2",
"typescript": "^4.8.2"
"typescript": "^4.8.4"
},
"nyc": {
"include": [

File diff suppressed because it is too large Load Diff