bump lib0 to 0.2 (esm modules)
This commit is contained in:
parent
2cec33dfc8
commit
fc5e19565f
6 changed files with 251 additions and 2406 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
const ws = require('ws')
|
||||
const http = require('http')
|
||||
const map = require('lib0/dist/map.js')
|
||||
const map = require('lib0/dist/map.cjs')
|
||||
|
||||
const wsReadyStateConnecting = 0
|
||||
const wsReadyStateOpen = 1
|
||||
|
|
|
@ -8,6 +8,10 @@ const provider = new WebrtcProvider('prosemirror', ydoc)
|
|||
const yarray = ydoc.get('prosemirror', Y.XmlFragment)
|
||||
|
||||
provider.on('synced', synced => {
|
||||
// NOTE: This is only called when a different browser connects to this client
|
||||
// Windows of the same browser communicate directly with each other
|
||||
// Although this behavior might be subject to change.
|
||||
// It is better not to expect a synced event when using y-webrtc
|
||||
console.log('synced!', synced)
|
||||
})
|
||||
|
||||
|
|
2609
package-lock.json
generated
2609
package-lock.json
generated
File diff suppressed because it is too large
Load diff
21
package.json
21
package.json
|
@ -2,12 +2,13 @@
|
|||
"name": "y-webrtc",
|
||||
"version": "10.0.4",
|
||||
"description": "WebRTC provider for Yjs",
|
||||
"main": "./dist/y-webrtc.js",
|
||||
"main": "./dist/y-webrtc.cjs",
|
||||
"module": "./src/y-webrtc.js",
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"start": "node ./bin/server.js",
|
||||
"debug": "concurrently 'live-server --port=3443 --entry-file=test.html' 'npm run watch'",
|
||||
"debug": "concurrently 'http-server -o index.html' 'npm run watch'",
|
||||
"demo": "concurrently 'http-server -o demo/index.html' 'npm run watch'",
|
||||
"dist": "rm -rf dist && rollup -c",
|
||||
"watch": "rollup -wc",
|
||||
"lint": "standard && tsc",
|
||||
|
@ -41,21 +42,21 @@
|
|||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"lib0": "^0.1.7",
|
||||
"lib0": "^0.2.3",
|
||||
"simple-peer": "^9.6.2",
|
||||
"y-protocols": "^0.1.0"
|
||||
"y-protocols": "^0.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^11.0.1",
|
||||
"@rollup/plugin-node-resolve": "^7.0.0",
|
||||
"concurrently": "^5.0.0",
|
||||
"live-server": "^1.2.1",
|
||||
"rollup": "^1.27.8",
|
||||
"http-server": "^0.12.1",
|
||||
"rollup": "^1.29.0",
|
||||
"rollup-cli": "^1.0.9",
|
||||
"rollup-plugin-commonjs": "^10.1.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-terser": "^5.1.3",
|
||||
"rollup-plugin-terser": "^5.2.0",
|
||||
"standard": "^12.0.1",
|
||||
"typescript": "^3.7.3",
|
||||
"yjs": "^13.0.0-103"
|
||||
"yjs": "^13.0.0-105"
|
||||
},
|
||||
"peerDependenies": {
|
||||
"yjs": ">=13.0.0-103"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import nodeResolve from 'rollup-plugin-node-resolve'
|
||||
import commonjs from 'rollup-plugin-commonjs'
|
||||
import nodeResolve from '@rollup/plugin-node-resolve'
|
||||
import commonjs from '@rollup/plugin-commonjs'
|
||||
import { terser } from 'rollup-plugin-terser'
|
||||
|
||||
// If truthy, it expects all y-* dependencies in the upper directory.
|
||||
|
@ -36,7 +36,7 @@ const debugResolve = {
|
|||
return `${process.cwd()}/../yjs/src/index.js`
|
||||
}
|
||||
if (customModules.has(importee.split('/')[0])) {
|
||||
return `${process.cwd()}/../${importee}/src/${importee}.js`
|
||||
return `${process.cwd()}/../${importee}/src/${importee}.cjs`
|
||||
}
|
||||
if (customLibModules.has(importee.split('/')[0])) {
|
||||
return `${process.cwd()}/../${importee}`
|
||||
|
@ -93,14 +93,14 @@ export default [
|
|||
external: id => /^(lib0|yjs|y-protocols|simple-peer)/.test(id),
|
||||
output: [{
|
||||
name: 'y-webrtc',
|
||||
file: 'dist/y-webrtc.js',
|
||||
file: 'dist/y-webrtc.cjs',
|
||||
format: 'cjs',
|
||||
sourcemap: true,
|
||||
paths: path => {
|
||||
if (/^lib0\//.test(path)) {
|
||||
return `lib0/dist${path.slice(4)}`
|
||||
return `lib0/dist${path.slice(4, -3)}.cjs`
|
||||
} else if (/^y-protocols\//.test(path)) {
|
||||
return `y-protocols/dist${path.slice(11)}`
|
||||
return `y-protocols/dist${path.slice(11, -3)}.cjs`
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
|
|
@ -9,10 +9,7 @@ import * as prng from 'lib0/prng.js'
|
|||
export const testReapeatEncryption = async tc => {
|
||||
const secret = prng.word(tc.prng)
|
||||
const roomName = prng.word(tc.prng)
|
||||
const data = {
|
||||
content: 'just a test',
|
||||
number: 4
|
||||
}
|
||||
const data = prng.uint8Array(tc.prng, 100)
|
||||
|
||||
/**
|
||||
* @type {any}
|
||||
|
@ -24,8 +21,8 @@ export const testReapeatEncryption = async tc => {
|
|||
await t.measureTime('Encryption', async () => {
|
||||
encrypted = await cryptutils.encrypt(data, key)
|
||||
})
|
||||
t.info(`stringified len: ${JSON.stringify(data).length}b`)
|
||||
t.info(`Encrypted len: ${encrypted.length}b`)
|
||||
t.info(`Byte length: ${data.byteLength}b`)
|
||||
t.info(`Encrypted length: ${encrypted.length}b`)
|
||||
await t.measureTime('Decryption', async () => {
|
||||
decrypted = await cryptutils.decrypt(encrypted, key)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue