diff --git a/package.json b/package.json index 336a58e1..4a48e265 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "scripts": { "test": "npm run lint", "debug": "concurrently 'rollup -wc rollup.test.js' 'cutest-serve y.test.js -o'", - "lint": "standard && documentation lint src/**", + "lint": "standard", "docs": "esdocs", "serve-docs": "npm run docs && serve ./docs/", "dist": "rollup -c rollup.browser.js; rollup -c rollup.node.js", @@ -18,7 +18,8 @@ }, "files": [ "y.*", - "src/*" + "src/*", + ".esdoc.json" ], "standard": { "ignore": [ diff --git a/src/MessageHandler/deleteSet.js b/src/MessageHandler/deleteSet.js index fc3d7c52..cb4b1c3b 100644 --- a/src/MessageHandler/deleteSet.js +++ b/src/MessageHandler/deleteSet.js @@ -1,5 +1,5 @@ import { deleteItemRange } from '../Struct/Delete.js' -import ID from '../Util/ID/ID.js.js' +import ID from '../Util/ID/ID.js' export function stringifyDeleteSet (y, decoder, strBuilder) { let dsLength = decoder.readUint32() diff --git a/src/MessageHandler/messageToString.js b/src/MessageHandler/messageToString.js index a9d9dec8..4c6e3b72 100644 --- a/src/MessageHandler/messageToString.js +++ b/src/MessageHandler/messageToString.js @@ -2,8 +2,8 @@ import BinaryDecoder from '../Util/Binary/Decoder.js' import { stringifyStructs } from './integrateRemoteStructs.js' import { stringifySyncStep1 } from './syncStep1.js' import { stringifySyncStep2 } from './syncStep2.js' -import ID from '../Util/ID/ID.js.js' -import RootID from '../Util/ID/RootID.js.js' +import ID from '../Util/ID/ID.js' +import RootID from '../Util/ID/RootID.js' import Y from '../Y.js' export function messageToString ([y, buffer]) { diff --git a/src/MessageHandler/syncStep1.js b/src/MessageHandler/syncStep1.js index 5f008ad3..8834d9f0 100644 --- a/src/MessageHandler/syncStep1.js +++ b/src/MessageHandler/syncStep1.js @@ -1,8 +1,8 @@ import BinaryEncoder from '../Util/Binary/Encoder.js' import { readStateSet, writeStateSet } from './stateSet.js' import { writeDeleteSet } from './deleteSet.js' -import ID from '../Util/ID/ID.js.js' -import { RootFakeUserID } from '../Util/ID/RootID.js.js' +import ID from '../Util/ID/ID.js' +import { RootFakeUserID } from '../Util/ID/RootID.js' export function stringifySyncStep1 (y, decoder, strBuilder) { let auth = decoder.readVarString() diff --git a/src/Store/DeleteStore.js b/src/Store/DeleteStore.js index be9b7441..1aa62582 100644 --- a/src/Store/DeleteStore.js +++ b/src/Store/DeleteStore.js @@ -1,5 +1,5 @@ import Tree from '../Util/Tree.js' -import ID from '../Util/ID/ID.js.js' +import ID from '../Util/ID/ID.js' class DSNode { constructor (id, len, gc) { diff --git a/src/Store/OperationStore.js b/src/Store/OperationStore.js index 2ee0cded..fdc74b03 100644 --- a/src/Store/OperationStore.js +++ b/src/Store/OperationStore.js @@ -1,5 +1,5 @@ import Tree from '../Util/Tree.js' -import RootID from '../Util/ID/RootID.js.js' +import RootID from '../Util/ID/RootID.js' import { getStruct } from '../Util/structReferences.js' import { logID } from '../MessageHandler/messageToString.js' diff --git a/src/Store/StateStore.js b/src/Store/StateStore.js index c582e5c3..c46ad072 100644 --- a/src/Store/StateStore.js +++ b/src/Store/StateStore.js @@ -1,4 +1,4 @@ -import ID from '../Util/ID/ID.js.js' +import ID from '../Util/ID/ID.js' export default class StateStore { constructor (y) { diff --git a/src/Struct/Delete.js b/src/Struct/Delete.js index cfe60b9c..2747bbfd 100644 --- a/src/Struct/Delete.js +++ b/src/Struct/Delete.js @@ -1,5 +1,5 @@ -import { getReference } from '../Util/structReferences.js' -import ID from '../Util/ID/ID.js.js' +import { getStructReference } from '../Util/structReferences.js' +import ID from '../Util/ID/ID.js' import { logID } from '../MessageHandler/messageToString.js' /** @@ -79,7 +79,7 @@ export default class Delete { * @param {BinaryEncoder} encoder The encoder to write data to. */ _toBinary (encoder) { - encoder.writeUint8(getReference(this.constructor)) + encoder.writeUint8(getStructReference(this.constructor)) encoder.writeID(this._targetID) encoder.writeVarUint(this._length) } diff --git a/src/Struct/Item.js b/src/Struct/Item.js index f5f83f1e..561bd725 100644 --- a/src/Struct/Item.js +++ b/src/Struct/Item.js @@ -1,6 +1,6 @@ -import { getReference } from '../Util/structReferences.js' -import ID from '../Util/ID/ID.js.js' -import { RootFakeUserID } from '../Util/ID/RootID.js.js' +import { getStructReference } from '../Util/structReferences.js' +import ID from '../Util/ID/ID.js' +import { RootFakeUserID } from '../Util/ID/RootID.js' import Delete from './Delete.js' import { transactionTypeChanged } from '../Transaction.js' @@ -336,7 +336,7 @@ export default class Item { * @param {BinaryEncoder} encoder The encoder to write data to. */ _toBinary (encoder) { - encoder.writeUint8(getReference(this.constructor)) + encoder.writeUint8(getStructReference(this.constructor)) let info = 0 if (this._origin !== null) { info += 0b1 // origin is defined diff --git a/src/Struct/Type.js b/src/Struct/Type.js index afb304a6..692a6e28 100644 --- a/src/Struct/Type.js +++ b/src/Struct/Type.js @@ -1,6 +1,6 @@ import Item from './Item.js' import EventHandler from '../Util/EventHandler.js' -import ID from '../Util/ID/ID.js.js' +import ID from '../Util/ID/ID.js' // restructure children as if they were inserted one after another function integrateChildren (y, start) { diff --git a/src/Types/YArray/YArray.js b/src/Types/YArray/YArray.js index 5ef5e50a..80033781 100644 --- a/src/Types/YArray/YArray.js +++ b/src/Types/YArray/YArray.js @@ -1,8 +1,8 @@ -import Type from '../Struct/Type.js' -import ItemJSON from '../Struct/ItemJSON.js' -import ItemString from '../Struct/ItemString.js' -import { logID } from '../MessageHandler/messageToString.js' -import YEvent from '../Util/YEvent.js' +import Type from '../../Struct/Type.js' +import ItemJSON from '../../Struct/ItemJSON.js' +import ItemString from '../../Struct/ItemString.js' +import { logID } from '../../MessageHandler/messageToString.js' +import YEvent from '../../Util/YEvent.js' /** * Event that describes the changes on a YArray diff --git a/src/Types/YMap/YMap.js b/src/Types/YMap/YMap.js index 6103b127..4ce81e6c 100644 --- a/src/Types/YMap/YMap.js +++ b/src/Types/YMap/YMap.js @@ -1,8 +1,8 @@ -import Type from '../Struct/Type.js' -import Item from '../Struct/Item.js' -import ItemJSON from '../Struct/ItemJSON.js' -import { logID } from '../MessageHandler/messageToString.js' -import YEvent from '../Util/YEvent.js' +import Type from '../../Struct/Type.js' +import Item from '../../Struct/Item.js' +import ItemJSON from '../../Struct/ItemJSON.js' +import { logID } from '../../MessageHandler/messageToString.js' +import YEvent from '../../Util/YEvent.js' /** * Event that describes the changes on a YMap. diff --git a/src/Types/YText/YText.js b/src/Types/YText/YText.js index 3f565e53..ff1e764b 100644 --- a/src/Types/YText/YText.js +++ b/src/Types/YText/YText.js @@ -1,8 +1,8 @@ -import ItemString from '../Struct/ItemString.js' -import ItemEmbed from '../Struct/ItemEmbed.js' -import ItemFormat from '../Struct/ItemFormat.js' -import { logID } from '../MessageHandler/messageToString.js' -import { YArrayEvent, default as YArray } from './YArray.js' +import ItemString from '../../Struct/ItemString.js' +import ItemEmbed from '../../Struct/ItemEmbed.js' +import ItemFormat from '../../Struct/ItemFormat.js' +import { logID } from '../../MessageHandler/messageToString.js' +import { YArrayEvent, default as YArray } from '../YArray/YArray.js' function integrateItem (item, parent, y, left, right) { item._origin = left diff --git a/src/Types/YXml/YXmlElement.js b/src/Types/YXml/YXmlElement.js index 2694c5ee..dfccdf1a 100644 --- a/src/Types/YXml/YXmlElement.js +++ b/src/Types/YXml/YXmlElement.js @@ -1,6 +1,6 @@ import { defaultDomFilter } from './utils.js' -import YMap from '../YMap.js' +import YMap from '../YMap/YMap.js' import { YXmlFragment } from './YXml.js' /** diff --git a/src/Types/YXml/YXmlFragment.js b/src/Types/YXml/YXmlFragment.js index c9e682e2..8faa3a13 100644 --- a/src/Types/YXml/YXmlFragment.js +++ b/src/Types/YXml/YXmlFragment.js @@ -3,7 +3,7 @@ import { defaultDomFilter, applyChangesFromDom, reflectChangesOnDom } from './utils.js' import { beforeTransactionSelectionFixer, afterTransactionSelectionFixer } from './selection.js' -import YArray from '../YArray.js' +import YArray from '../YArray/YArray.js' import YXmlEvent from './YXmlEvent.js' import { YXmlText, YXmlHook } from './YXml.js' import { logID } from '../../MessageHandler/messageToString.js' diff --git a/src/Types/YXml/YXmlHook.js b/src/Types/YXml/YXmlHook.js index a5834ab2..b492ab2d 100644 --- a/src/Types/YXml/YXmlHook.js +++ b/src/Types/YXml/YXmlHook.js @@ -1,4 +1,4 @@ -import YMap from '../YMap.js' +import YMap from '../YMap/YMap.js' import { getHook, addHook } from './hooks.js' /** diff --git a/src/Types/YXml/YXmlText.js b/src/Types/YXml/YXmlText.js index 0e4eb78c..1320a350 100644 --- a/src/Types/YXml/YXmlText.js +++ b/src/Types/YXml/YXmlText.js @@ -1,4 +1,4 @@ -import YText from '../YText.js' +import YText from '../YText/YText.js' /** * Represents text in a Dom Element. In the future this type will also handle diff --git a/src/Util/Binary/Decoder.js b/src/Util/Binary/Decoder.js index f83bf7c1..f6761623 100644 --- a/src/Util/Binary/Decoder.js +++ b/src/Util/Binary/Decoder.js @@ -1,5 +1,5 @@ -import ID from '../Util/ID/ID.js.js' -import { default as RootID, RootFakeUserID } from '../Util/ID/RootID.js.js' +import ID from '../ID/ID.js' +import { default as RootID, RootFakeUserID } from '../ID/RootID.js' /** * A BinaryDecoder handles the decoding of an ArrayBuffer. diff --git a/src/Util/Binary/Encoder.js b/src/Util/Binary/Encoder.js index 436955ba..42e561e4 100644 --- a/src/Util/Binary/Encoder.js +++ b/src/Util/Binary/Encoder.js @@ -1,4 +1,4 @@ -import { RootFakeUserID } from '../Util/ID/RootID.js.js' +import { RootFakeUserID } from '../ID/RootID.js' const bits7 = 0b1111111 const bits8 = 0b11111111 diff --git a/src/Util/ID/RootID.js b/src/Util/ID/RootID.js index 1e4610f9..9e4672c5 100644 --- a/src/Util/ID/RootID.js +++ b/src/Util/ID/RootID.js @@ -1,4 +1,4 @@ -import { getReference } from './structReferences.js' +import { getStructReference } from '../structReferences.js' export const RootFakeUserID = 0xFFFFFF @@ -6,7 +6,7 @@ export default class RootID { constructor (name, typeConstructor) { this.user = RootFakeUserID this.name = name - this.type = getReference(typeConstructor) + this.type = getStructReference(typeConstructor) } equals (id) { return id !== null && id.user === this.user && id.name === this.name && id.type === this.type diff --git a/src/Util/UndoManager.js b/src/Util/UndoManager.js index 963b45d5..a074ce7c 100644 --- a/src/Util/UndoManager.js +++ b/src/Util/UndoManager.js @@ -1,4 +1,4 @@ -import ID from './ID.js' +import ID from './ID/ID.js' class ReverseOperation { constructor (y, transaction) { diff --git a/src/Util/defragmentItemContent.js b/src/Util/defragmentItemContent.js index c160c39a..586c33f1 100644 --- a/src/Util/defragmentItemContent.js +++ b/src/Util/defragmentItemContent.js @@ -1,5 +1,5 @@ -import ID from '../Util/ID/ID.js.js' +import ID from '../Util/ID/ID.js' import ItemJSON from '../Struct/ItemJSON.js' import ItemString from '../Struct/ItemString.js' diff --git a/src/Util/relativePosition.js b/src/Util/relativePosition.js index cd824b67..31974fcf 100644 --- a/src/Util/relativePosition.js +++ b/src/Util/relativePosition.js @@ -1,5 +1,5 @@ -import ID from './ID.js' -import RootID from './RootID.js' +import ID from './ID/ID.js' +import RootID from './ID/RootID.js' /** * A relative position that is based on the Yjs model. In contrast to an diff --git a/src/Y.js b/src/Y.js index 2423d3d2..e06dc940 100644 --- a/src/Y.js +++ b/src/Y.js @@ -2,7 +2,7 @@ import DeleteStore from './Store/DeleteStore.js' import OperationStore from './Store/OperationStore.js' import StateStore from './Store/StateStore.js' import { generateUserID } from './Util/generateUserID.js' -import RootID from './Util/ID/RootID.js.js' +import RootID from './Util/ID/RootID.js' import NamedEventHandler from './Util/NamedEventHandler.js' import Transaction from './Transaction.js' diff --git a/test/red-black-tree.js b/test/red-black-tree.js index 76ab5022..05ac3599 100644 --- a/test/red-black-tree.js +++ b/test/red-black-tree.js @@ -1,5 +1,5 @@ import RedBlackTree from '../src/Util/Tree.js' -import ID from '../src/Util/ID/ID.js.js' +import ID from '../src/Util/ID/ID.js' import Chance from 'chance' import { test, proxyConsole } from 'cutest'