Skip to content

Commit

Permalink
update lib0 dep and use native esm module
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Jan 13, 2020
1 parent 6303637 commit 2740761
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 75 deletions.
3 changes: 2 additions & 1 deletion auth.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

import * as Y from 'yjs' // eslint-disable-line
import * as encoding from 'lib0/encoding.js'
import * as decoding from 'lib0/decoding.js'

Expand All @@ -22,7 +23,7 @@ export const writePermissionDenied = (encoder, reason) => {
/**
*
* @param {decoding.Decoder} decoder
* @param {Y} y
* @param {Y.Doc} y
* @param {PermissionDeniedHandler} permissionDeniedHandler
*/
export const readAuthMessage = (decoder, y, permissionDeniedHandler) => {
Expand Down
44 changes: 0 additions & 44 deletions history.js

This file was deleted.

36 changes: 21 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
"name": "y-protocols",
"version": "0.1.0",
"description": "Yjs encoding protocols",
"type": "module",
"files": [
"dist/*",
"auth.js",
"history.js",
"sync.js",
"awareness.js"
],
"scripts": {
"dist": "rm -rf dist && rollup -c",
"test": "echo 'should lint here'",
"lint": "standard",
"preversion": "npm run dist && npm run test",
"version": "npm run dist"
"test": "npm run lint",
"lint": "standard && tsc",
"preversion": "npm run dist && npm run test"
},
"repository": {
"type": "git",
Expand All @@ -36,15 +35,16 @@
},
"homepage": "https://github.com/yjs/y-protocols#readme",
"dependencies": {
"lib0": "^0.1.1"
"lib0": "^0.2.3"
},
"devDependencies": {
"yjs": "13.0.0-94",
"rollup": "^1.1.2",
"rollup-cli": "^1.0.9",
"standard": "^12.0.1"
"standard": "^12.0.1",
"typescript": "^3.7.4",
"yjs": "13.0.0-105"
},
"peerDependenies": {
"yjs": ">13.0.0-98"
"yjs": ">=13.0.0-103"
}
}
6 changes: 3 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ const files = fs.readdirSync('./').filter(file => /(?<!\.(test|config))\.js$/.te
export default files.map(file => ({
input: file,
output: {
file: path.join('./dist', file),
file: path.join('./dist', file.slice(0, -3) + '.cjs'),
format: 'cjs',
paths: path => {
paths: /** @param {any} path */ path => {
if (/^lib0\//.test(path)) {
return `lib0/dist/${path.slice(5)}`
return `lib0/dist/${path.slice(5, -3) + '.cjs'}`
}
return path
}
Expand Down
9 changes: 6 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
Expand All @@ -36,8 +36,11 @@

/* Module Resolution Options */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
"paths": {
"yjs": ["node_modules/yjs/src/index.js"],
"lib0/*": ["node_modules/lib0/*"]
},
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
Expand Down

0 comments on commit 2740761

Please sign in to comment.