🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

yjs

Package Overview
Dependencies
Maintainers
0
Versions
300
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yjs - npm Package Compare versions

Comparing version

to
13.6.20

5

dist/src/types/AbstractType.d.ts

@@ -0,1 +1,2 @@

export function warnPrematureAccess(): void;
export class ArraySearchMarker {

@@ -161,3 +162,5 @@ /**

};
export function createMapIterator(map: Map<string, Item>): IterableIterator<Array<any>>;
export function createMapIterator(type: AbstractType<any> & {
_map: Map<string, Item>;
}): IterableIterator<Array<any>>;
import { Item } from "../structs/Item.js";

@@ -164,0 +167,0 @@ import { Transaction } from "../utils/Transaction.js";

6

package.json
{
"name": "yjs",
"version": "13.6.19",
"version": "13.6.20",
"description": "Shared Editing Library",

@@ -16,3 +16,3 @@ "main": "./dist/yjs.cjs",

"clean": "rm -rf dist docs",
"test": "npm run dist && node ./dist/tests.cjs --repetition-time 50",
"test": "npm run dist && NODE_ENV=development node ./dist/tests.cjs --repetition-time 50",
"test-extensive": "npm run lint && npm run dist && node ./dist/tests.cjs --production --repetition-time 10000",

@@ -80,3 +80,3 @@ "dist": "npm run clean && rollup -c && tsc",

"dependencies": {
"lib0": "^0.2.86"
"lib0": "^0.2.98"
},

@@ -83,0 +83,0 @@ "devDependencies": {

@@ -123,2 +123,3 @@

IDE that runs in the browser.
* [ScienHub](https://scienhub.com) - Collaborative LaTeX editor in the browser.

@@ -130,2 +131,3 @@ ## Table of Contents

* [Providers](#providers)
* [Tooling](#tooling)
* [Ports](#ports)

@@ -298,4 +300,10 @@ * [Getting Started](#getting-started)

# Ports
### Tooling
* [y-sweet debugger](https://docs.jamsocket.com/y-sweet/advanced/debugger)
* [liveblocks devtools](https://liveblocks.io/devtools)
* [Yjs inspector](https://inspector.yjs.dev)
### Ports
There are several Yjs-compatible ports to other programming languages.

@@ -302,0 +310,0 @@

@@ -5,2 +5,7 @@ import {

import * as env from 'lib0/environment'
import * as object from 'lib0/object'
const isDevMode = env.getVariable('node_env') === 'development'
export class ContentAny {

@@ -15,2 +20,3 @@ /**

this.arr = arr
isDevMode && object.deepFreeze(arr)
}

@@ -17,0 +23,0 @@

@@ -20,3 +20,9 @@ import {

import * as math from 'lib0/math'
import * as log from 'lib0/logging'
/**
* https://docs.yjs.dev/getting-started/working-with-shared-types#caveats
*/
export const warnPrematureAccess = () => { log.warn('Invalid access: Add Yjs type to a document before reading data.') }
const maxSearchMarker = 80

@@ -219,2 +225,3 @@

export const getTypeChildren = t => {
t.doc ?? warnPrematureAccess()
let s = t._start

@@ -413,2 +420,3 @@ const arr = []

export const typeListSlice = (type, start, end) => {
type.doc ?? warnPrematureAccess()
if (start < 0) {

@@ -449,2 +457,3 @@ start = type._length + start

export const typeListToArray = type => {
type.doc ?? warnPrematureAccess()
const cs = []

@@ -499,2 +508,3 @@ let n = type._start

let n = type._start
type.doc ?? warnPrematureAccess()
while (n !== null) {

@@ -614,2 +624,3 @@ if (n.countable && !n.deleted) {

export const typeListGet = (type, index) => {
type.doc ?? warnPrematureAccess()
const marker = findMarker(type, index)

@@ -883,2 +894,3 @@ let n = type._start

export const typeMapGet = (parent, key) => {
parent.doc ?? warnPrematureAccess()
const val = parent._map.get(key)

@@ -900,2 +912,3 @@ return val !== undefined && !val.deleted ? val.content.getContent()[val.length - 1] : undefined

const res = {}
parent.doc ?? warnPrematureAccess()
parent._map.forEach((value, key) => {

@@ -918,2 +931,3 @@ if (!value.deleted) {

export const typeMapHas = (parent, key) => {
parent.doc ?? warnPrematureAccess()
const val = parent._map.get(key)

@@ -969,3 +983,3 @@ return val !== undefined && !val.deleted

/**
* @param {Map<string,Item>} map
* @param {AbstractType<any> & { _map: Map<string, Item> }} type
* @return {IterableIterator<Array<any>>}

@@ -976,2 +990,5 @@ *

*/
export const createMapIterator = map => iterator.iteratorFilter(map.entries(), /** @param {any} entry */ entry => !entry[1].deleted)
export const createMapIterator = type => {
type.doc ?? warnPrematureAccess()
return iterator.iteratorFilter(type._map.entries(), /** @param {any} entry */ entry => !entry[1].deleted)
}

@@ -19,2 +19,3 @@ /**

transact,
warnPrematureAccess,
ArraySearchMarker, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, Transaction, Item // eslint-disable-line

@@ -108,3 +109,4 @@ } from '../internals.js'

get length () {
return this._prelimContent === null ? this._length : this._prelimContent.length
this.doc ?? warnPrematureAccess()
return this._length
}

@@ -111,0 +113,0 @@

@@ -16,2 +16,3 @@ /**

transact,
warnPrematureAccess,
UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, Transaction, Item // eslint-disable-line

@@ -125,2 +126,3 @@ } from '../internals.js'

toJSON () {
this.doc ?? warnPrematureAccess()
/**

@@ -145,3 +147,3 @@ * @type {Object<string,MapType>}

get size () {
return [...createMapIterator(this._map)].length
return [...createMapIterator(this)].length
}

@@ -155,3 +157,3 @@

keys () {
return iterator.iteratorMap(createMapIterator(this._map), /** @param {any} v */ v => v[0])
return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => v[0])
}

@@ -165,3 +167,3 @@

values () {
return iterator.iteratorMap(createMapIterator(this._map), /** @param {any} v */ v => v[1].content.getContent()[v[1].length - 1])
return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => v[1].content.getContent()[v[1].length - 1])
}

@@ -175,3 +177,3 @@

entries () {
return iterator.iteratorMap(createMapIterator(this._map), /** @param {any} v */ v => /** @type {any} */ ([v[0], v[1].content.getContent()[v[1].length - 1]]))
return iterator.iteratorMap(createMapIterator(this), /** @param {any} v */ v => /** @type {any} */ ([v[0], v[1].content.getContent()[v[1].length - 1]]))
}

@@ -185,2 +187,3 @@

forEach (f) {
this.doc ?? warnPrematureAccess()
this._map.forEach((item, key) => {

@@ -187,0 +190,0 @@ if (!item.deleted) {

@@ -29,2 +29,3 @@ /**

ContentType,
warnPrematureAccess,
ArraySearchMarker, UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, ID, Doc, Item, Snapshot, Transaction // eslint-disable-line

@@ -879,2 +880,3 @@ } from '../internals.js'

get length () {
this.doc ?? warnPrematureAccess()
return this._length

@@ -936,2 +938,3 @@ }

toString () {
this.doc ?? warnPrematureAccess()
let str = ''

@@ -1010,2 +1013,3 @@ /**

toDelta (snapshot, prevSnapshot, computeYChange) {
this.doc ?? warnPrematureAccess()
/**

@@ -1012,0 +1016,0 @@ * @type{Array<any>}

@@ -20,2 +20,3 @@ /**

typeListSlice,
warnPrematureAccess,
UpdateDecoderV1, UpdateDecoderV2, UpdateEncoderV1, UpdateEncoderV2, Doc, ContentType, Transaction, Item, YXmlText, YXmlHook // eslint-disable-line

@@ -70,2 +71,3 @@ } from '../internals.js'

this._firstCall = true
root.doc ?? warnPrematureAccess()
}

@@ -182,2 +184,3 @@

get length () {
this.doc ?? warnPrematureAccess()
return this._prelimContent === null ? this._length : this._prelimContent.length

@@ -184,0 +187,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet