diff --git a/package.json b/package.json index c98d27449d..8341d032f7 100644 --- a/package.json +++ b/package.json @@ -127,8 +127,9 @@ "@jsonjoy.com/util": "^1.1.0", "arg": "^5.0.2", "hyperdyperid": "^1.2.0", - "sonic-forest": "^1.0.0", - "thingies": "^2.0.0" + "sonic-forest": "^1.0.2", + "thingies": "^2.0.0", + "tree-dump": "^1.0.0" }, "devDependencies": { "@types/benchmark": "^2.1.5", @@ -148,13 +149,6 @@ "typescript": "^5.4.5" }, "jest": { - "verbose": true, - "testEnvironmentOptions": { - "url": "http://localhost/" - }, - "setupFiles": [ - "/src/__tests__/setup.js" - ], "moduleFileExtensions": [ "ts", "js" diff --git a/src/__tests__/setup.js b/src/__tests__/setup.js deleted file mode 100644 index e265fa1747..0000000000 --- a/src/__tests__/setup.js +++ /dev/null @@ -1,2 +0,0 @@ -// Jest setup. -process.env.JEST = true; diff --git a/src/json-crdt-extensions/cnt/index.ts b/src/json-crdt-extensions/cnt/index.ts index ecd6a96ece..b7363e07ab 100644 --- a/src/json-crdt-extensions/cnt/index.ts +++ b/src/json-crdt-extensions/cnt/index.ts @@ -1,12 +1,12 @@ import {delayed} from '../../json-crdt-patch/builder/DelayedValueBuilder'; import {ext} from '../../json-crdt/extensions'; import {ExtensionId} from '../constants'; -import {printTree} from '../../util/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import {NodeApi} from '../../json-crdt/model/api/nodes'; import type {ExtensionDefinition, ObjNode} from '../../json-crdt'; import type {ITimestampStruct} from '../../json-crdt-patch/clock'; import type {ExtensionJsonNode, JsonNode} from '../../json-crdt'; -import type {Printable} from '../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type {ExtensionApi} from '../../json-crdt'; const name = 'cnt'; diff --git a/src/json-crdt-extensions/mval/ValueMv.ts b/src/json-crdt-extensions/mval/ValueMv.ts index d88af29160..ebaffc2818 100644 --- a/src/json-crdt-extensions/mval/ValueMv.ts +++ b/src/json-crdt-extensions/mval/ValueMv.ts @@ -1,8 +1,8 @@ import {ArrNode} from '../../json-crdt/nodes/arr/ArrNode'; -import {printTree} from '../../util/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import type {ITimestampStruct} from '../../json-crdt-patch/clock'; import type {ExtensionJsonNode, JsonNode} from '../../json-crdt'; -import type {Printable} from '../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; export class ValueMv implements ExtensionJsonNode, Printable { public readonly id: ITimestampStruct; diff --git a/src/json-crdt-extensions/peritext/Peritext.ts b/src/json-crdt-extensions/peritext/Peritext.ts index 443a097e9c..e5cba361df 100644 --- a/src/json-crdt-extensions/peritext/Peritext.ts +++ b/src/json-crdt-extensions/peritext/Peritext.ts @@ -1,4 +1,4 @@ -import {printTree} from 'sonic-forest/lib/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import {Anchor} from './rga/constants'; import {Point} from './rga/Point'; import {Range} from './rga/Range'; @@ -11,7 +11,7 @@ import {interval} from '../../json-crdt-patch/clock'; import {CONST, updateNum} from '../../json-hash'; import type {ITimestampStruct} from '../../json-crdt-patch/clock'; import type {Model} from '../../json-crdt/model'; -import type {Printable} from '../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type {StringChunk} from './util/types'; import type {SliceType} from './types'; import type {MarkerSlice} from './slice/MarkerSlice'; diff --git a/src/json-crdt-extensions/peritext/editor/Editor.ts b/src/json-crdt-extensions/peritext/editor/Editor.ts index 5f5f654d99..56ac7a7d1a 100644 --- a/src/json-crdt-extensions/peritext/editor/Editor.ts +++ b/src/json-crdt-extensions/peritext/editor/Editor.ts @@ -6,7 +6,7 @@ import {PersistedSlice} from '../slice/PersistedSlice'; import {Chars} from '../constants'; import type {Range} from '../rga/Range'; import type {Peritext} from '../Peritext'; -import type {Printable} from '../../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type {Point} from '../rga/Point'; import type {SliceType} from '../types'; import type {MarkerSlice} from '../slice/MarkerSlice'; diff --git a/src/json-crdt-extensions/peritext/overlay/MarkerOverlayPoint.ts b/src/json-crdt-extensions/peritext/overlay/MarkerOverlayPoint.ts index 10d40d10b0..ed569c65e1 100644 --- a/src/json-crdt-extensions/peritext/overlay/MarkerOverlayPoint.ts +++ b/src/json-crdt-extensions/peritext/overlay/MarkerOverlayPoint.ts @@ -4,7 +4,7 @@ import type {Anchor} from '../rga/constants'; import type {AbstractRga} from '../../../json-crdt/nodes/rga'; import type {ITimestampStruct} from '../../../json-crdt-patch/clock'; import type {MarkerSlice} from '../slice/MarkerSlice'; -import {printTree} from 'sonic-forest/lib/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; export class MarkerOverlayPoint extends OverlayPoint { /** diff --git a/src/json-crdt-extensions/peritext/overlay/Overlay.ts b/src/json-crdt-extensions/peritext/overlay/Overlay.ts index 21216ff46a..61967d7ca0 100644 --- a/src/json-crdt-extensions/peritext/overlay/Overlay.ts +++ b/src/json-crdt-extensions/peritext/overlay/Overlay.ts @@ -1,5 +1,5 @@ -import {printTree} from 'sonic-forest/lib/print/printTree'; -import {printBinary} from 'sonic-forest/lib/print/printBinary'; +import {printTree} from 'tree-dump/lib/printTree'; +import {printBinary} from 'tree-dump/lib/printBinary'; import {first, insertLeft, insertRight, next, prev, remove} from 'sonic-forest/lib/util'; import {splay} from 'sonic-forest/lib/splay/util'; import {Anchor} from '../rga/constants'; @@ -12,7 +12,7 @@ import {CONST, updateNum} from '../../../json-hash'; import {MarkerSlice} from '../slice/MarkerSlice'; import type {Peritext} from '../Peritext'; import type {Stateful} from '../types'; -import type {Printable} from '../../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type {MutableSlice, Slice} from '../slice/types'; export class Overlay implements Printable, Stateful { diff --git a/src/json-crdt-extensions/peritext/overlay/OverlayPoint.ts b/src/json-crdt-extensions/peritext/overlay/OverlayPoint.ts index af8b785fc7..e0d8092c4f 100644 --- a/src/json-crdt-extensions/peritext/overlay/OverlayPoint.ts +++ b/src/json-crdt-extensions/peritext/overlay/OverlayPoint.ts @@ -1,10 +1,10 @@ import {Point} from '../rga/Point'; import {compare} from '../../../json-crdt-patch/clock'; import {OverlayRef, OverlayRefSliceEnd, OverlayRefSliceStart} from './refs'; -import {printTree} from 'sonic-forest/lib/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import type {MarkerSlice} from '../slice/MarkerSlice'; import type {HeadlessNode} from 'sonic-forest/lib/types'; -import type {Printable} from '../../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type {Slice} from '../slice/types'; /** diff --git a/src/json-crdt-extensions/peritext/rga/Point.ts b/src/json-crdt-extensions/peritext/rga/Point.ts index 30eb117b30..ab87b70bab 100644 --- a/src/json-crdt-extensions/peritext/rga/Point.ts +++ b/src/json-crdt-extensions/peritext/rga/Point.ts @@ -4,7 +4,7 @@ import {ChunkSlice} from '../util/ChunkSlice'; import {updateId} from '../../../json-crdt/hash'; import type {AbstractRga, Chunk} from '../../../json-crdt/nodes/rga'; import type {Stateful} from '../types'; -import type {Printable} from '../../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; /** * A "point" in a rich-text Peritext document. It is a combination of a diff --git a/src/json-crdt-extensions/peritext/rga/Range.ts b/src/json-crdt-extensions/peritext/rga/Range.ts index 3759215c35..c779bc4018 100644 --- a/src/json-crdt-extensions/peritext/rga/Range.ts +++ b/src/json-crdt-extensions/peritext/rga/Range.ts @@ -2,7 +2,7 @@ import {Point} from './Point'; import {Anchor} from './constants'; import {updateNum} from '../../../json-hash'; import type {ITimestampStruct} from '../../../json-crdt-patch/clock'; -import type {Printable} from '../../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type {AbstractRga, Chunk} from '../../../json-crdt/nodes/rga'; import type {Stateful} from '../types'; diff --git a/src/json-crdt-extensions/peritext/slice/Cursor.ts b/src/json-crdt-extensions/peritext/slice/Cursor.ts index 8d1ab3e45a..250499b4d8 100644 --- a/src/json-crdt-extensions/peritext/slice/Cursor.ts +++ b/src/json-crdt-extensions/peritext/slice/Cursor.ts @@ -1,7 +1,7 @@ import {Point} from '../rga/Point'; import {CursorAnchor, SliceBehavior, Tags} from './constants'; import {Range} from '../rga/Range'; -import {printTree} from '../../../util/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import {updateNum} from '../../../json-hash'; import type {ITimestampStruct} from '../../../json-crdt-patch/clock'; import type {Peritext} from '../Peritext'; diff --git a/src/json-crdt-extensions/peritext/slice/PersistedSlice.ts b/src/json-crdt-extensions/peritext/slice/PersistedSlice.ts index 5121fe64a5..f4c05c76c1 100644 --- a/src/json-crdt-extensions/peritext/slice/PersistedSlice.ts +++ b/src/json-crdt-extensions/peritext/slice/PersistedSlice.ts @@ -1,7 +1,7 @@ import {Point} from '../rga/Point'; import {Range} from '../rga/Range'; import {updateNode} from '../../../json-crdt/hash'; -import {printTree} from '../../../util/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import {Anchor} from '../rga/constants'; import {SliceHeaderMask, SliceHeaderShift, SliceBehavior, SliceTupleIndex} from './constants'; import {CONST} from '../../../json-hash'; @@ -15,7 +15,7 @@ import type {ArrChunk} from '../../../json-crdt/nodes'; import type {MutableSlice, SliceUpdateParams} from './types'; import type {Peritext} from '../Peritext'; import type {SliceDto, SliceType, Stateful} from '../types'; -import type {Printable} from '../../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type {AbstractRga} from '../../../json-crdt/nodes/rga'; export class PersistedSlice extends Range implements MutableSlice, Stateful, Printable { diff --git a/src/json-crdt-extensions/peritext/slice/Slices.ts b/src/json-crdt-extensions/peritext/slice/Slices.ts index 0c4f3f0a7f..37314019d9 100644 --- a/src/json-crdt-extensions/peritext/slice/Slices.ts +++ b/src/json-crdt-extensions/peritext/slice/Slices.ts @@ -1,18 +1,18 @@ +import {AvlMap} from 'sonic-forest/lib/avl/AvlMap'; +import {printTree} from 'tree-dump/lib/printTree'; import {PersistedSlice} from './PersistedSlice'; import {Timespan, compare, tss} from '../../../json-crdt-patch/clock'; import {Range} from '../rga/Range'; import {updateRga} from '../../../json-crdt/hash'; import {CONST, updateNum} from '../../../json-hash'; -import {printTree} from '../../../util/print/printTree'; import {SliceBehavior, SliceHeaderShift, SliceTupleIndex} from './constants'; import {MarkerSlice} from './MarkerSlice'; import {VecNode} from '../../../json-crdt/nodes'; -import {AvlMap} from 'sonic-forest/lib/avl/AvlMap'; import type {Slice} from './types'; import type {ITimespanStruct, ITimestampStruct} from '../../../json-crdt-patch/clock'; import type {SliceType, Stateful} from '../types'; import type {Peritext} from '../Peritext'; -import type {Printable} from '../../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type {ArrChunk, ArrNode} from '../../../json-crdt/nodes'; export class Slices implements Stateful, Printable { diff --git a/src/json-crdt-extensions/peritext/util/ChunkSlice.ts b/src/json-crdt-extensions/peritext/util/ChunkSlice.ts index 67fe0a628a..8f775fb4e4 100644 --- a/src/json-crdt-extensions/peritext/util/ChunkSlice.ts +++ b/src/json-crdt-extensions/peritext/util/ChunkSlice.ts @@ -3,7 +3,7 @@ import {updateId} from '../../../json-crdt/hash'; import {ITimestampStruct, Timestamp, toDisplayString} from '../../../json-crdt-patch/clock'; import type {IChunkSlice} from './types'; import type {Stateful} from '../types'; -import type {Printable} from '../../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type {Chunk} from '../../../json-crdt/nodes/rga'; export class ChunkSlice implements IChunkSlice, Stateful, Printable { diff --git a/src/json-crdt-patch/Patch.ts b/src/json-crdt-patch/Patch.ts index a7b667e560..d7db35e185 100644 --- a/src/json-crdt-patch/Patch.ts +++ b/src/json-crdt-patch/Patch.ts @@ -2,7 +2,7 @@ import * as operations from './operations'; import {ITimestampStruct, ts, toDisplayString} from './clock'; import {SESSION} from './constants'; import {encode, decode} from './codec/binary'; -import type {Printable} from '../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; /** * A union type of all possible JSON CRDT patch operations. diff --git a/src/json-crdt-patch/types.ts b/src/json-crdt-patch/types.ts index 3a09671b1d..ac21dbc201 100644 --- a/src/json-crdt-patch/types.ts +++ b/src/json-crdt-patch/types.ts @@ -1,4 +1,4 @@ -import type {Printable} from '../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type {ITimestampStruct} from './clock'; import type {JsonCrdtPatchMnemonic} from './codec/verbose'; diff --git a/src/json-crdt/extensions/Extensions.ts b/src/json-crdt/extensions/Extensions.ts index 65143f027b..21183a1641 100644 --- a/src/json-crdt/extensions/Extensions.ts +++ b/src/json-crdt/extensions/Extensions.ts @@ -1,6 +1,6 @@ -import {printTree} from '../../util/print/printTree'; -import {Printable} from '../../util/print/types'; -import {ExtensionDefinition} from './types'; +import {printTree} from 'tree-dump/lib/printTree'; +import type {ExtensionDefinition} from './types'; +import type {Printable} from 'tree-dump/lib/types'; export class Extensions implements Printable { protected readonly ext: Record = {}; diff --git a/src/json-crdt/log/Log.ts b/src/json-crdt/log/Log.ts index 388daf235d..24decd39a7 100644 --- a/src/json-crdt/log/Log.ts +++ b/src/json-crdt/log/Log.ts @@ -1,10 +1,10 @@ +import {AvlMap} from 'sonic-forest/lib/avl/AvlMap'; +import {first, next} from 'sonic-forest/lib/util'; import {FanOutUnsubscribe} from 'thingies/lib/fanout'; +import {printTree} from 'tree-dump/lib/printTree'; import {ITimestampStruct, Patch, compare} from '../../json-crdt-patch'; -import {printTree} from '../../util/print/printTree'; -import {AvlMap} from 'sonic-forest/lib/avl/AvlMap'; import {Model} from '../model'; -import {first, next} from 'sonic-forest/lib/util'; -import type {Printable} from '../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type {JsonNode} from '../nodes/types'; /** diff --git a/src/json-crdt/model/Model.ts b/src/json-crdt/model/Model.ts index 9aaba10f9d..2889959ea8 100644 --- a/src/json-crdt/model/Model.ts +++ b/src/json-crdt/model/Model.ts @@ -8,11 +8,11 @@ import {ORIGIN, SESSION, SYSTEM_SESSION_TIME} from '../../json-crdt-patch/consta import {randomSessionId} from './util'; import {RootNode, ValNode, VecNode, ObjNode, StrNode, BinNode, ArrNode} from '../nodes'; import {SchemaToJsonNode} from '../schema/types'; -import {printTree} from '../../util/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import {Extensions} from '../extensions/Extensions'; import {AvlMap} from 'sonic-forest/lib/avl/AvlMap'; import type {JsonNode, JsonNodeView} from '../nodes/types'; -import type {Printable} from '../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type {NodeBuilder} from '../../json-crdt-patch'; import type {NodeApi} from './api/nodes'; diff --git a/src/json-crdt/model/api/nodes.ts b/src/json-crdt/model/api/nodes.ts index cb46e21ece..1de93f8932 100644 --- a/src/json-crdt/model/api/nodes.ts +++ b/src/json-crdt/model/api/nodes.ts @@ -4,11 +4,11 @@ import {Path} from '../../../json-pointer'; import {ObjNode, ArrNode, BinNode, ConNode, VecNode, ValNode, StrNode} from '../../nodes'; import {ExtensionApi, ExtensionDefinition, ExtensionJsonNode} from '../../extensions/types'; import {NodeEvents} from './NodeEvents'; -import {printTree} from '../../../util/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import type {JsonNode, JsonNodeView} from '../../nodes'; import type * as types from './proxy'; import type {ModelApi} from './ModelApi'; -import type {Printable} from '../../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type {JsonNodeApi} from './types'; export type ApiPath = string | number | Path | void; diff --git a/src/json-crdt/nodes/arr/ArrNode.ts b/src/json-crdt/nodes/arr/ArrNode.ts index 23977f0424..65499053ed 100644 --- a/src/json-crdt/nodes/arr/ArrNode.ts +++ b/src/json-crdt/nodes/arr/ArrNode.ts @@ -1,10 +1,10 @@ import {AbstractRga, Chunk} from '../rga/AbstractRga'; import {ITimestampStruct, tick} from '../../../json-crdt-patch/clock'; import {Model} from '../../model'; -import {printBinary} from '../../../util/print/printBinary'; -import {printTree} from '../../../util/print/printTree'; +import {printBinary} from 'tree-dump/lib/printBinary'; +import {printTree} from 'tree-dump/lib/printTree'; import type {JsonNode, JsonNodeView} from '..'; -import type {Printable} from '../../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; type E = ITimestampStruct; diff --git a/src/json-crdt/nodes/const/ConNode.ts b/src/json-crdt/nodes/const/ConNode.ts index c729b856a8..51dd0f9fe9 100644 --- a/src/json-crdt/nodes/const/ConNode.ts +++ b/src/json-crdt/nodes/const/ConNode.ts @@ -1,6 +1,6 @@ import {type ITimestampStruct, toDisplayString, Timestamp} from '../../../json-crdt-patch/clock'; import type {JsonNode} from '../types'; -import type {Printable} from '../../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; /** * Represents the `con` type of the JSON CRDT specification. diff --git a/src/json-crdt/nodes/obj/ObjNode.ts b/src/json-crdt/nodes/obj/ObjNode.ts index fb4ad60a68..e16f00cd3e 100644 --- a/src/json-crdt/nodes/obj/ObjNode.ts +++ b/src/json-crdt/nodes/obj/ObjNode.ts @@ -1,7 +1,7 @@ +import {printTree} from 'tree-dump/lib/printTree'; import {compare, ITimestampStruct, toDisplayString} from '../../../json-crdt-patch/clock'; -import {printTree} from '../../../util/print/printTree'; import type {Model} from '../../model'; -import type {Printable} from '../../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type {JsonNode, JsonNodeView} from '..'; /** diff --git a/src/json-crdt/nodes/rga/AbstractRga.ts b/src/json-crdt/nodes/rga/AbstractRga.ts index d8208e015e..1c81df4f92 100644 --- a/src/json-crdt/nodes/rga/AbstractRga.ts +++ b/src/json-crdt/nodes/rga/AbstractRga.ts @@ -13,8 +13,8 @@ import {rSplay, lSplay, llSplay, rrSplay, lrSplay, rlSplay} from 'sonic-forest/l import {splay2} from 'sonic-forest/lib/splay/util2'; import {insert2, remove2} from 'sonic-forest/lib/util2'; import {ORIGIN} from '../../../json-crdt-patch/constants'; -import {printTree} from '../../../util/print/printTree'; -import {printBinary} from '../../../util/print/printBinary'; +import {printTree} from 'tree-dump/lib/printTree'; +import {printBinary} from 'tree-dump/lib/printBinary'; import {printOctets} from '@jsonjoy.com/util/lib/buffers/printOctets'; /** diff --git a/src/json-crdt/nodes/str/__tests__/StrNodeFuzzer.ts b/src/json-crdt/nodes/str/__tests__/StrNodeFuzzer.ts index a3929bb29f..51cd702209 100644 --- a/src/json-crdt/nodes/str/__tests__/StrNodeFuzzer.ts +++ b/src/json-crdt/nodes/str/__tests__/StrNodeFuzzer.ts @@ -3,8 +3,7 @@ import {ITimespanStruct, ITimestampStruct, ClockVector, toDisplayString, ts} fro import {Fuzzer} from '@jsonjoy.com/util/lib/Fuzzer'; import {randomSessionId} from '../../../model/util'; import {StrNode} from '../StrNode'; -import {printTree} from '../../../../util/print/printTree'; -import {Printable} from '../../../../util/print/types'; +import {printTree, Printable} from 'tree-dump'; const printOp = (op: Op) => { if ('content' in op) { diff --git a/src/json-crdt/nodes/val/ValNode.ts b/src/json-crdt/nodes/val/ValNode.ts index a518763c98..f1e51283bf 100644 --- a/src/json-crdt/nodes/val/ValNode.ts +++ b/src/json-crdt/nodes/val/ValNode.ts @@ -1,10 +1,10 @@ import {compare, ITimestampStruct, toDisplayString} from '../../../json-crdt-patch/clock'; import {SESSION} from '../../../json-crdt-patch/constants'; -import {printTree} from '../../../util/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import {UNDEFINED} from '../../model/Model'; import type {JsonNode, JsonNodeView} from '..'; import type {Model} from '../../model'; -import type {Printable} from '../../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; /** * Represents a `val` JSON CRDT node, which is a Last-write-wins (LWW) register. diff --git a/src/json-crdt/nodes/vec/VecNode.ts b/src/json-crdt/nodes/vec/VecNode.ts index 1c79e0e34f..34751fe1b7 100644 --- a/src/json-crdt/nodes/vec/VecNode.ts +++ b/src/json-crdt/nodes/vec/VecNode.ts @@ -1,10 +1,10 @@ import {ConNode} from '../const/ConNode'; import {CRDT_CONSTANTS} from '../../constants'; -import {printTree} from '../../../util/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import {compare, ITimestampStruct, toDisplayString} from '../../../json-crdt-patch/clock'; import type {Model} from '../../model'; import type {JsonNode, JsonNodeView} from '..'; -import type {Printable} from '../../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; /** * Represents a `vec` JSON CRDT node, which is a LWW array. diff --git a/src/json-crdt/nodes/vec/__tests__/VecNode-extension.spec.ts b/src/json-crdt/nodes/vec/__tests__/VecNode-extension.spec.ts index ac2c032f63..e1a5011d48 100644 --- a/src/json-crdt/nodes/vec/__tests__/VecNode-extension.spec.ts +++ b/src/json-crdt/nodes/vec/__tests__/VecNode-extension.spec.ts @@ -1,6 +1,5 @@ import {ITimestampStruct, delayed, s} from '../../../../json-crdt-patch'; -import {printTree} from '../../../../util/print/printTree'; -import {Printable} from '../../../../util/print/types'; +import {printTree, Printable} from 'tree-dump'; import {ext} from '../../../extensions'; import {ExtensionApi, ExtensionDefinition, ExtensionJsonNode} from '../../../extensions/types'; import {Model, NodeApi} from '../../../model'; diff --git a/src/json-text/toTree.ts b/src/json-text/toTree.ts index ebabb543ec..f05967406e 100644 --- a/src/json-text/toTree.ts +++ b/src/json-text/toTree.ts @@ -1,4 +1,4 @@ -import {printTree} from '../util/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import {stringify} from './stringify'; const isPrimitive = (value: unknown): boolean => typeof value !== 'object'; diff --git a/src/json-type-value/ObjectValue.ts b/src/json-type-value/ObjectValue.ts index 6ef74b79f0..ffec779318 100644 --- a/src/json-type-value/ObjectValue.ts +++ b/src/json-type-value/ObjectValue.ts @@ -1,12 +1,12 @@ import {Value} from './Value'; import {toText} from '../json-type/typescript/toText'; import {TypeSystem} from '../json-type/system/TypeSystem'; -import {printTree} from 'sonic-forest/lib/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import type {ResolveType} from '../json-type'; import type * as classes from '../json-type/type'; import type * as ts from '../json-type/typescript/types'; import type {TypeBuilder} from '../json-type/type/TypeBuilder'; -import type {Printable} from 'sonic-forest/lib/print/types'; +import type {Printable} from 'tree-dump/lib/types'; export type UnObjectType = T extends classes.ObjectType ? U : never; export type UnObjectValue = T extends ObjectValue ? U : never; diff --git a/src/json-type/system/TypeAlias.ts b/src/json-type/system/TypeAlias.ts index 071cced893..67d2c5a113 100644 --- a/src/json-type/system/TypeAlias.ts +++ b/src/json-type/system/TypeAlias.ts @@ -1,11 +1,11 @@ -import {printTree} from '../../util/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import {ObjectType} from '../type/classes'; import {toText} from '../typescript/toText'; import {JsonSchemaGenericKeywords, JsonSchemaValueNode} from '../../json-schema'; import {TypeExportContext} from './TypeExportContext'; import type {TypeSystem} from '.'; import type {Type} from '../type'; -import type {Printable} from '../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; import type * as ts from '../typescript/types'; export class TypeAlias implements Printable { diff --git a/src/json-type/system/TypeSystem.ts b/src/json-type/system/TypeSystem.ts index 735170fcb1..bf3b9ae239 100644 --- a/src/json-type/system/TypeSystem.ts +++ b/src/json-type/system/TypeSystem.ts @@ -1,10 +1,10 @@ import {TypeAlias} from './TypeAlias'; import {TypeBuilder} from '../type/TypeBuilder'; import {RefType} from '../type/classes'; -import {printTree} from '../../util/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import type {CustomValidator} from './types'; import type {Type, TypeMap} from '../type'; -import type {Printable} from '../../util/print/types'; +import type {Printable} from 'tree-dump/lib/types'; export class TypeSystem implements Printable { public readonly t = new TypeBuilder(this); diff --git a/src/json-type/system/__tests__/TypeSystem.spec.ts b/src/json-type/system/__tests__/TypeSystem.spec.ts index 69de1c8dfc..032ed57d59 100644 --- a/src/json-type/system/__tests__/TypeSystem.spec.ts +++ b/src/json-type/system/__tests__/TypeSystem.spec.ts @@ -17,31 +17,31 @@ describe('.toString()', () => { }, }); expect(system.toString()).toMatchInlineSnapshot(` - "TypeSystem - ├─ aliases - │ ├─ User0 - │ │ └─ obj - │ │ ├─ "id": - │ │ │ └─ str - │ │ └─ "address"?: - │ │ └─ ref → [Address] - │ ├─ User1 - │ │ └─ ref → [User0] - │ ├─ User - │ │ └─ ref → [User1] - │ ├─ Address0 - │ │ └─ obj - │ │ ├─ "id": - │ │ │ └─ str - │ │ └─ "user"?: - │ │ └─ ref → [User] - │ ├─ Address1 - │ │ └─ ref → [Address0] - │ └─ Address - │ └─ ref → [Address1] - │ - └─ validators - └─ "empty-string"" - `); +"TypeSystem +├─ aliases +│ ├─ User0 +│ │ └─ obj +│ │ ├─ "id": +│ │ │ └─ str +│ │ └─ "address"?: +│ │ └─ ref → [Address] +│ ├─ User1 +│ │ └─ ref → [User0] +│ ├─ User +│ │ └─ ref → [User1] +│ ├─ Address0 +│ │ └─ obj +│ │ ├─ "id": +│ │ │ └─ str +│ │ └─ "user"?: +│ │ └─ ref → [User] +│ ├─ Address1 +│ │ └─ ref → [Address0] +│ └─ Address +│ └─ ref → [Address1] +│ +└─ validators + └─ "empty-string"" +`); }); }); diff --git a/src/json-type/type/classes/AbstractType.ts b/src/json-type/type/classes/AbstractType.ts index a269328f93..9a982090e7 100644 --- a/src/json-type/type/classes/AbstractType.ts +++ b/src/json-type/type/classes/AbstractType.ts @@ -1,6 +1,6 @@ import * as schema from '../../schema'; import {RandomJson} from '../../../json-random'; -import {Printable} from '../../../util/print/types'; +import {Printable} from 'tree-dump/lib/types'; import {ValidatorCodegenContext, ValidatorCodegenContextOptions} from '../../codegen/validator/ValidatorCodegenContext'; import {JsonTypeValidator, ValidationPath} from '../../codegen/validator/types'; import { diff --git a/src/json-type/type/classes/ArrayType.ts b/src/json-type/type/classes/ArrayType.ts index 803335eb02..76b25ae6f4 100644 --- a/src/json-type/type/classes/ArrayType.ts +++ b/src/json-type/type/classes/ArrayType.ts @@ -1,5 +1,7 @@ +import {JsExpression} from '@jsonjoy.com/util/lib/codegen/util/JsExpression'; +import {BinaryJsonEncoder} from '@jsonjoy.com/json-pack/lib/types'; +import {printTree} from 'tree-dump/lib/printTree'; import * as schema from '../../schema'; -import {printTree} from '../../../util/print/printTree'; import {validateMinMax, validateTType} from '../../schema/validate'; import {ValidatorCodegenContext} from '../../codegen/validator/ValidatorCodegenContext'; import {ValidationPath} from '../../codegen/validator/types'; @@ -8,9 +10,7 @@ import {JsonTextEncoderCodegenContext} from '../../codegen/json/JsonTextEncoderC import {CborEncoderCodegenContext} from '../../codegen/binary/CborEncoderCodegenContext'; import {JsonEncoderCodegenContext} from '../../codegen/binary/JsonEncoderCodegenContext'; import {BinaryEncoderCodegenContext} from '../../codegen/binary/BinaryEncoderCodegenContext'; -import {JsExpression} from '@jsonjoy.com/util/lib/codegen/util/JsExpression'; import {MessagePackEncoderCodegenContext} from '../../codegen/binary/MessagePackEncoderCodegenContext'; -import {BinaryJsonEncoder} from '@jsonjoy.com/json-pack/lib/types'; import {CapacityEstimatorCodegenContext} from '../../codegen/capacity/CapacityEstimatorCodegenContext'; import {MaxEncodingOverhead} from '../../../json-size'; import {AbstractType} from './AbstractType'; diff --git a/src/json-type/type/classes/BinaryType.ts b/src/json-type/type/classes/BinaryType.ts index 2c99f2bfe5..06b0a1ae49 100644 --- a/src/json-type/type/classes/BinaryType.ts +++ b/src/json-type/type/classes/BinaryType.ts @@ -1,7 +1,9 @@ +import {JsExpression} from '@jsonjoy.com/util/lib/codegen/util/JsExpression'; +import {BinaryJsonEncoder} from '@jsonjoy.com/json-pack/lib/types'; +import {printTree} from 'tree-dump/lib/printTree'; import * as schema from '../../schema'; import {RandomJson} from '../../../json-random'; import {stringifyBinary} from '../../../json-binary'; -import {printTree} from '../../../util/print/printTree'; import {validateTType} from '../../schema/validate'; import {ValidatorCodegenContext} from '../../codegen/validator/ValidatorCodegenContext'; import {ValidationPath} from '../../codegen/validator/types'; @@ -10,9 +12,7 @@ import {JsonTextEncoderCodegenContext} from '../../codegen/json/JsonTextEncoderC import {CborEncoderCodegenContext} from '../../codegen/binary/CborEncoderCodegenContext'; import {JsonEncoderCodegenContext} from '../../codegen/binary/JsonEncoderCodegenContext'; import {BinaryEncoderCodegenContext} from '../../codegen/binary/BinaryEncoderCodegenContext'; -import {JsExpression} from '@jsonjoy.com/util/lib/codegen/util/JsExpression'; import {MessagePackEncoderCodegenContext} from '../../codegen/binary/MessagePackEncoderCodegenContext'; -import {BinaryJsonEncoder} from '@jsonjoy.com/json-pack/lib/types'; import {CapacityEstimatorCodegenContext} from '../../codegen/capacity/CapacityEstimatorCodegenContext'; import {MaxEncodingOverhead} from '../../../json-size'; import {AbstractType} from './AbstractType'; diff --git a/src/json-type/type/classes/FunctionType.ts b/src/json-type/type/classes/FunctionType.ts index 15cfb5b2b0..98a3a8a9f8 100644 --- a/src/json-type/type/classes/FunctionType.ts +++ b/src/json-type/type/classes/FunctionType.ts @@ -1,5 +1,5 @@ +import {printTree} from 'tree-dump/lib/printTree'; import * as schema from '../../schema'; -import {printTree} from '../../../util/print/printTree'; import {validateTType} from '../../schema/validate'; import {AbstractType} from './AbstractType'; import type {SchemaOf, Type} from '../types'; diff --git a/src/json-type/type/classes/MapType.ts b/src/json-type/type/classes/MapType.ts index ee5afb1f13..47a19b2c11 100644 --- a/src/json-type/type/classes/MapType.ts +++ b/src/json-type/type/classes/MapType.ts @@ -1,7 +1,9 @@ +import {JsExpression} from '@jsonjoy.com/util/lib/codegen/util/JsExpression'; +import {BinaryJsonEncoder} from '@jsonjoy.com/json-pack/lib/types'; +import {asString} from '@jsonjoy.com/util/lib/strings/asString'; +import {printTree} from 'tree-dump/lib/printTree'; import * as schema from '../../schema'; import {RandomJson} from '../../../json-random'; -import {printTree} from '../../../util/print/printTree'; -import {asString} from '@jsonjoy.com/util/lib/strings/asString'; import {validateTType} from '../../schema/validate'; import {ValidatorCodegenContext} from '../../codegen/validator/ValidatorCodegenContext'; import {ValidationPath} from '../../codegen/validator/types'; @@ -10,9 +12,7 @@ import {JsonTextEncoderCodegenContext} from '../../codegen/json/JsonTextEncoderC import {CborEncoderCodegenContext} from '../../codegen/binary/CborEncoderCodegenContext'; import {JsonEncoderCodegenContext} from '../../codegen/binary/JsonEncoderCodegenContext'; import {BinaryEncoderCodegenContext} from '../../codegen/binary/BinaryEncoderCodegenContext'; -import {JsExpression} from '@jsonjoy.com/util/lib/codegen/util/JsExpression'; import {MessagePackEncoderCodegenContext} from '../../codegen/binary/MessagePackEncoderCodegenContext'; -import {BinaryJsonEncoder} from '@jsonjoy.com/json-pack/lib/types'; import {CapacityEstimatorCodegenContext} from '../../codegen/capacity/CapacityEstimatorCodegenContext'; import {MaxEncodingOverhead} from '../../../json-size'; import {AbstractType} from './AbstractType'; diff --git a/src/json-type/type/classes/ObjectType.ts b/src/json-type/type/classes/ObjectType.ts index 44919e7227..75496a3d6b 100644 --- a/src/json-type/type/classes/ObjectType.ts +++ b/src/json-type/type/classes/ObjectType.ts @@ -1,17 +1,17 @@ +import {normalizeAccessor} from '@jsonjoy.com/util/lib/codegen/util/normalizeAccessor'; +import {JsExpression} from '@jsonjoy.com/util/lib/codegen/util/JsExpression'; +import {asString} from '@jsonjoy.com/util/lib/strings/asString'; +import {printTree} from 'tree-dump/lib/printTree'; import * as schema from '../../schema'; import {RandomJson} from '../../../json-random'; -import {printTree} from '../../../util/print/printTree'; -import {asString} from '@jsonjoy.com/util/lib/strings/asString'; import {validateTType, validateWithValidator} from '../../schema/validate'; import {ValidatorCodegenContext} from '../../codegen/validator/ValidatorCodegenContext'; import {ValidationPath} from '../../codegen/validator/types'; import {ValidationError} from '../../constants'; -import {normalizeAccessor} from '@jsonjoy.com/util/lib/codegen/util/normalizeAccessor'; import {canSkipObjectKeyUndefinedCheck} from '../../codegen/validator/util'; import {JsonTextEncoderCodegenContext} from '../../codegen/json/JsonTextEncoderCodegenContext'; import {CborEncoderCodegenContext} from '../../codegen/binary/CborEncoderCodegenContext'; import {JsonEncoderCodegenContext} from '../../codegen/binary/JsonEncoderCodegenContext'; -import {JsExpression} from '@jsonjoy.com/util/lib/codegen/util/JsExpression'; import {MessagePackEncoderCodegenContext} from '../../codegen/binary/MessagePackEncoderCodegenContext'; import {CapacityEstimatorCodegenContext} from '../../codegen/capacity/CapacityEstimatorCodegenContext'; import {MaxEncodingOverhead, maxEncodingCapacity} from '../../../json-size'; diff --git a/src/json-type/type/classes/OrType.ts b/src/json-type/type/classes/OrType.ts index 19cb15c352..3427310200 100644 --- a/src/json-type/type/classes/OrType.ts +++ b/src/json-type/type/classes/OrType.ts @@ -1,5 +1,5 @@ import * as schema from '../../schema'; -import {printTree} from 'sonic-forest/lib/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import {validateTType} from '../../schema/validate'; import {ValidatorCodegenContext} from '../../codegen/validator/ValidatorCodegenContext'; import {ValidationPath} from '../../codegen/validator/types'; diff --git a/src/json-type/type/classes/TupleType.ts b/src/json-type/type/classes/TupleType.ts index eee33adb17..00ac27582d 100644 --- a/src/json-type/type/classes/TupleType.ts +++ b/src/json-type/type/classes/TupleType.ts @@ -1,5 +1,5 @@ import * as schema from '../../schema'; -import {printTree} from 'sonic-forest/lib/print/printTree'; +import {printTree} from 'tree-dump/lib/printTree'; import {validateTType} from '../../schema/validate'; import {ValidatorCodegenContext} from '../../codegen/validator/ValidatorCodegenContext'; import {ValidationPath} from '../../codegen/validator/types'; diff --git a/src/util/print/printBinary.ts b/src/util/print/printBinary.ts deleted file mode 100644 index 08ce931e81..0000000000 --- a/src/util/print/printBinary.ts +++ /dev/null @@ -1 +0,0 @@ -export * from 'sonic-forest/lib/print/printBinary'; diff --git a/src/util/print/printTree.ts b/src/util/print/printTree.ts deleted file mode 100644 index a6b90bbd4d..0000000000 --- a/src/util/print/printTree.ts +++ /dev/null @@ -1 +0,0 @@ -export * from 'sonic-forest/lib/print/printTree'; diff --git a/src/util/print/types.ts b/src/util/print/types.ts deleted file mode 100644 index d84b391b6f..0000000000 --- a/src/util/print/types.ts +++ /dev/null @@ -1 +0,0 @@ -export * from 'sonic-forest/lib/print/types'; diff --git a/yarn.lock b/yarn.lock index 383cabecbd..c63e597a4d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -955,7 +955,6 @@ concat-map@0.0.1: "config-housekeeping@https://github.com/streamich/housekeeping#3532d2abeac159315ddf403d70517859d079c801": version "0.0.0" - uid "3532d2abeac159315ddf403d70517859d079c801" resolved "https://github.com/streamich/housekeeping#3532d2abeac159315ddf403d70517859d079c801" convert-source-map@^2.0.0: @@ -1019,7 +1018,6 @@ diff@^4.0.1: "editing-traces@https://github.com/streamich/editing-traces#6494020428530a6e382378b98d1d7e31334e2d7b": version "0.0.0" - uid "6494020428530a6e382378b98d1d7e31334e2d7b" resolved "https://github.com/streamich/editing-traces#6494020428530a6e382378b98d1d7e31334e2d7b" electron-to-chromium@^1.4.668: @@ -1710,7 +1708,6 @@ jsesc@^2.5.1: "json-crdt-traces@https://github.com/streamich/json-crdt-traces#ec825401dc05cbb74b9e0b3c4d6527399f54d54d": version "0.0.1" - uid ec825401dc05cbb74b9e0b3c4d6527399f54d54d resolved "https://github.com/streamich/json-crdt-traces#ec825401dc05cbb74b9e0b3c4d6527399f54d54d" json-logic-js@^2.0.2: @@ -2068,10 +2065,12 @@ slash@^3.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -sonic-forest@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/sonic-forest/-/sonic-forest-1.0.0.tgz#b0b77d9bca76434f4ef87b61042d041da63f3be5" - integrity sha512-yFO2N4uTUFtgKLw03WWFpN1iEwZySweMsa18XN3Kt0yYrlmVHunC2ZgM+437zDoKISAJHcH3Cg18U7d6tuSgSQ== +sonic-forest@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/sonic-forest/-/sonic-forest-1.0.2.tgz#d80aa621d1cffe75a606ca44789ccff30f5b9ce6" + integrity sha512-2rICdwIJi5kVlehMUVtJeHn3ohh5YZV4pDv0P0c1M11cRz/gXNViItpM94HQwfvnXuzybpqK0LZJgTa3lEwtAw== + dependencies: + tree-dump "^1.0.0" source-map-support@0.5.13: version "0.5.13" @@ -2199,6 +2198,11 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +tree-dump@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/tree-dump/-/tree-dump-1.0.0.tgz#bd5fdece2b36d888ae0d1cf316e653af3de656ea" + integrity sha512-gDLjiHO2JTBf8JtRNCq/tUYZMdI5EFOA3UKWZJddwqVxRjC8jj/tI/pJEocV0hPtJeztEcF2RqufJZYbF/rKEw== + ts-jest@^29.1.2: version "29.1.2" resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.2.tgz#7613d8c81c43c8cb312c6904027257e814c40e09"