clean up build script - no more warnings
This commit is contained in:
parent
57975d409e
commit
040808300c
@ -1,4 +1,4 @@
|
||||
import * as Y from '../src/index.js'
|
||||
import * as Y from 'yjs'
|
||||
import { WebsocketProvider } from 'y-websocket'
|
||||
import { prosemirrorPlugin, cursorPlugin } from 'y-prosemirror'
|
||||
|
||||
|
@ -8,12 +8,12 @@
|
||||
"scripts": {
|
||||
"test": "npm run lint && npm run dist && node ./dist/tests.js --repitition-time 50",
|
||||
"test-exhaustive": "npm run lint && npm run dist && node ./dist/tests.js --repitition-time 10000",
|
||||
"dist": "rm -rf dist examples/build && PRODUCTION=1 rollup -c",
|
||||
"dist": "rm -rf dist examples/build && rollup -c",
|
||||
"watch": "rollup -wc",
|
||||
"lint": "standard",
|
||||
"docs": "rm -rf docs; jsdoc --configure ./.jsdoc.json --verbose --readme ./README.v13.md --package ./package.json || true",
|
||||
"serve-docs": "npm run docs && serve ./docs/",
|
||||
"postversion": "npm run dist",
|
||||
"postversion": "PRODUCTION=1 npm run dist",
|
||||
"debug": "concurrently 'live-server --port=3443 --entry-file=test.html' 'npm run watch'",
|
||||
"trace-deopt": "clear && rollup -c && node --trace-deopt dist/test.js",
|
||||
"trace-opt": "clear && rollup -c && node --trace-opt dist/test.js"
|
||||
|
@ -33,7 +33,6 @@ const debugResolve = {
|
||||
}
|
||||
}
|
||||
|
||||
// set this to [] to disable obfuscation
|
||||
const minificationPlugins = process.env.PRODUCTION ? [terser({
|
||||
module: true,
|
||||
compress: {
|
||||
@ -46,13 +45,12 @@ const minificationPlugins = process.env.PRODUCTION ? [terser({
|
||||
},
|
||||
mangle: {
|
||||
toplevel: true
|
||||
// properties: true
|
||||
}
|
||||
})] : []
|
||||
|
||||
export default [{
|
||||
input: './src/index.js',
|
||||
output: {
|
||||
output: [{
|
||||
name: 'Y',
|
||||
file: 'dist/yjs.js',
|
||||
format: 'cjs',
|
||||
@ -63,17 +61,13 @@ export default [{
|
||||
}
|
||||
return path
|
||||
}
|
||||
},
|
||||
plugins: minificationPlugins
|
||||
}, {
|
||||
input: './src/index.js',
|
||||
output: {
|
||||
}, {
|
||||
name: 'Y',
|
||||
file: 'dist/yjs.mjs',
|
||||
format: 'esm',
|
||||
sourcemap: true
|
||||
},
|
||||
plugins: minificationPlugins
|
||||
}],
|
||||
external: id => /^lib0\//.test(id)
|
||||
}, {
|
||||
input: './tests/index.js',
|
||||
output: {
|
||||
@ -91,24 +85,7 @@ export default [{
|
||||
}),
|
||||
commonjs()
|
||||
]
|
||||
},
|
||||
|
||||
/* {
|
||||
input: 'tests/index.js',
|
||||
output: {
|
||||
file: 'dist/y.test.js',
|
||||
format: 'iife',
|
||||
name: 'ytests',
|
||||
sourcemap: true
|
||||
},
|
||||
plugins: [
|
||||
nodeResolve({
|
||||
main: true,
|
||||
module: true
|
||||
}),
|
||||
commonjs()
|
||||
]
|
||||
}, */{
|
||||
}, {
|
||||
input: ['./examples/codemirror.js', './examples/textarea.js', './examples/quill.js', './examples/dom.js', './examples/prosemirror.js'], // fs.readdirSync('./examples').filter(file => /(?<!\.(test|config))\.js$/.test(file)).map(file => './examples/' + file),
|
||||
output: {
|
||||
dir: 'examples/build',
|
||||
|
@ -24,7 +24,7 @@ export { getRelativePosition, fromRelativePosition, equal as equalRelativePositi
|
||||
export { ID, createID, RootFakeUserID, RootID } from './utils/ID.js'
|
||||
export { DeleteStore, DSNode } from './utils/DeleteStore.js'
|
||||
export { deleteItemRange } from './utils/structManipulation.js'
|
||||
export { integrateRemoteStruct, integrateRemoteStructs } from './utils/integrateRemoteStructs.js'
|
||||
export { integrateRemoteStructs } from './utils/integrateRemoteStructs.js'
|
||||
export { isParentOf } from './utils/isParentOf.js'
|
||||
|
||||
export { stringifyItemID } from './utils/structStringify.js'
|
||||
|
@ -112,51 +112,3 @@ export const integrateRemoteStructs = (decoder, y) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: use this above / refactor
|
||||
/**
|
||||
* @param {decoding.Decoder} decoder
|
||||
* @param {Y} y
|
||||
*/
|
||||
export const integrateRemoteStruct = (decoder, y) => {
|
||||
let reference = decoding.readVarUint(decoder)
|
||||
let Constr = getStruct(reference)
|
||||
let struct = new Constr()
|
||||
let decoderPos = decoder.pos
|
||||
let missing = struct._fromBinary(y, decoder)
|
||||
if (missing.length === 0) {
|
||||
while (struct != null) {
|
||||
_integrateRemoteStructHelper(y, struct)
|
||||
struct = null
|
||||
if (y._readyToIntegrate.length > 0) {
|
||||
const missingDef = y._readyToIntegrate.shift()
|
||||
const decoder = missingDef.decoder
|
||||
let oldPos = decoder.pos
|
||||
let missing = missingDef.struct._fromBinary(y, decoder)
|
||||
decoder.pos = oldPos
|
||||
if (missing.length === 0) {
|
||||
struct = missingDef.struct
|
||||
} else {
|
||||
throw new Error('Missing should be empty')
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let _decoder = decoding.createDecoder(decoder.arr.buffer)
|
||||
_decoder.pos = decoderPos
|
||||
let missingEntry = new MissingEntry(_decoder, missing, struct)
|
||||
let missingStructs = y._missingStructs
|
||||
for (let i = missing.length - 1; i >= 0; i--) {
|
||||
let m = missing[i]
|
||||
if (!missingStructs.has(m.user)) {
|
||||
missingStructs.set(m.user, new Map())
|
||||
}
|
||||
let msu = missingStructs.get(m.user)
|
||||
if (!msu.has(m.clock)) {
|
||||
msu.set(m.clock, [])
|
||||
}
|
||||
let mArray = msu = msu.get(m.clock)
|
||||
mArray.push(missingEntry)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,9 @@ export const registerStruct = (reference, structConstructor) => {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export const getStruct = (reference) => {
|
||||
return structs.get(reference)
|
||||
}
|
||||
export const getStruct = structs.get.bind(structs) // reference => structs.get(reference)
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export const getStructReference = (typeConstructor) => {
|
||||
return references.get(typeConstructor)
|
||||
}
|
||||
export const getStructReference = references.get.bind(references) // typeConstructor => references.get(typeConstructor)
|
||||
|
Loading…
x
Reference in New Issue
Block a user