use condititional exports of dependencies

This commit is contained in:
Kevin Jahns 2021-05-20 13:00:45 +02:00
parent fdc3ab1565
commit e3615979b4
4 changed files with 2148 additions and 16 deletions

2125
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,13 @@
"bin/*",
"src/*"
],
"exports": {
"./package.json": "./package.json",
".": {
"import": "./src/y-websocket.js",
"require": "./dist/y-websocket.cjs"
}
},
"repository": {
"type": "git",
"url": "git+https://github.com/yjs/y-websocket.git"
@ -45,9 +52,9 @@
]
},
"dependencies": {
"lib0": "^0.2.35",
"lib0": "^0.2.42",
"lodash.debounce": "^4.0.8",
"y-protocols": "^1.0.4"
"y-protocols": "^1.0.5"
},
"devDependencies": {
"rollup": "^1.32.1",
@ -57,7 +64,7 @@
"yjs": "^13.5.0"
},
"peerDependencies": {
"yjs": "^13.5.0"
"yjs": "^13.5.6"
},
"optionalDependencies": {
"ws": "^6.2.1",

View File

@ -8,9 +8,9 @@ export default {
sourcemap: true,
paths: path => {
if (/^lib0\//.test(path)) {
return `lib0/dist${path.slice(4, -3)}.cjs`
return `lib0/dist${path.slice(4)}.cjs`
} else if (/^y-protocols\//.test(path)) {
return `y-protocols/dist${path.slice(11, -3)}.cjs`
return `y-protocols/dist${path.slice(11)}.cjs`
}
return path
}

View File

@ -9,17 +9,17 @@ Unlike stated in the LICENSE file, it is not necessary to include the copyright
/* eslint-env browser */
import * as Y from 'yjs' // eslint-disable-line
import * as bc from 'lib0/broadcastchannel.js'
import * as time from 'lib0/time.js'
import * as encoding from 'lib0/encoding.js'
import * as decoding from 'lib0/decoding.js'
import * as syncProtocol from 'y-protocols/sync.js'
import * as authProtocol from 'y-protocols/auth.js'
import * as awarenessProtocol from 'y-protocols/awareness.js'
import * as mutex from 'lib0/mutex.js'
import { Observable } from 'lib0/observable.js'
import * as math from 'lib0/math.js'
import * as url from 'lib0/url.js'
import * as bc from 'lib0/broadcastchannel'
import * as time from 'lib0/time'
import * as encoding from 'lib0/encoding'
import * as decoding from 'lib0/decoding'
import * as syncProtocol from 'y-protocols/sync'
import * as authProtocol from 'y-protocols/auth'
import * as awarenessProtocol from 'y-protocols/awareness'
import * as mutex from 'lib0/mutex'
import { Observable } from 'lib0/observable'
import * as math from 'lib0/math'
import * as url from 'lib0/url'
const messageSync = 0
const messageQueryAwareness = 3