fix types and add type annotations to bundle

This commit is contained in:
Kevin Jahns 2020-03-20 20:46:26 +01:00
parent c5662675d7
commit bb30d8357d
3 changed files with 54 additions and 49 deletions

82
package-lock.json generated
View file

@ -110,6 +110,15 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"@types/simple-peer": {
"version": "9.6.0",
"resolved": "https://registry.npmjs.org/@types/simple-peer/-/simple-peer-9.6.0.tgz",
"integrity": "sha512-X2y6s+vE/3j03hkI90oqld2JH2J/m1L7yFCYYPyFV/whrOK1h4neYvJL3GIE+UcACJacXZqzdmDKudwec18RbA==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"acorn": { "acorn": {
"version": "7.1.1", "version": "7.1.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz",
@ -581,9 +590,9 @@
}, },
"dependencies": { "dependencies": {
"minimist": { "minimist": {
"version": "1.2.0", "version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true "dev": true
} }
} }
@ -1374,9 +1383,9 @@
} }
}, },
"lib0": { "lib0": {
"version": "0.2.15", "version": "0.2.20",
"resolved": "https://registry.npmjs.org/lib0/-/lib0-0.2.15.tgz", "resolved": "https://registry.npmjs.org/lib0/-/lib0-0.2.20.tgz",
"integrity": "sha512-wLwuTNNgtC7EQH0b3w4iqpts69TRFVur74Wta7jwgS2w+r/vPLuGcsBA16VoPgBYME7oxDSjEesJw9p/gHmFEg==", "integrity": "sha512-1PDg2Dp6EVXpGR91GeLccjA3cS4TTGw6K7K+QTjPdk6qL6EybJT6JGuB7vFp0nEppK5T+FJxAZudAxF3oj7fFA==",
"requires": { "requires": {
"isomorphic.js": "^0.1.3" "isomorphic.js": "^0.1.3"
} }
@ -1461,12 +1470,20 @@
"dev": true "dev": true
}, },
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.3",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.3.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==",
"dev": true, "dev": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "^1.2.5"
},
"dependencies": {
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true
}
} }
}, },
"ms": { "ms": {
@ -2132,9 +2149,9 @@
}, },
"dependencies": { "dependencies": {
"minimist": { "minimist": {
"version": "1.2.0", "version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true "dev": true
} }
} }
@ -2266,9 +2283,9 @@
} }
}, },
"typescript": { "typescript": {
"version": "3.7.5", "version": "3.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
"integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
"dev": true "dev": true
}, },
"union": { "union": {
@ -2416,11 +2433,11 @@
"dev": true "dev": true
}, },
"y-protocols": { "y-protocols": {
"version": "0.2.0", "version": "0.2.1",
"resolved": "https://registry.npmjs.org/y-protocols/-/y-protocols-0.2.0.tgz", "resolved": "https://registry.npmjs.org/y-protocols/-/y-protocols-0.2.1.tgz",
"integrity": "sha512-B9MCxMqLZCziLmQFlrXVN7MbIhXzF9bdwePcHzlVFIEHxnEvYIqAQYj4FHS376LBgfcjTUs7T614D+w0bpcJLA==", "integrity": "sha512-gWaDs7LgduEJp5zqXEI86IGfYnMRByd8Piv0VkZ5D3r3kNbnsRyuBx5It5tz95YDrdjGTcfd4SzSxJTvAA1R+w==",
"requires": { "requires": {
"lib0": "^0.2.3" "lib0": "^0.2.20"
} }
}, },
"y18n": { "y18n": {
@ -2529,29 +2546,12 @@
} }
}, },
"yjs": { "yjs": {
"version": "13.0.1", "version": "13.0.4",
"resolved": "https://registry.npmjs.org/yjs/-/yjs-13.0.1.tgz", "resolved": "https://registry.npmjs.org/yjs/-/yjs-13.0.4.tgz",
"integrity": "sha512-j6M241DhLC0HfGub1gtqpnhe1gzSJJiusKaRB1yO0/I92F9C65sIDY4AD/8bY8jiKXiJGfNv8iQ7PUv+tXWTpg==", "integrity": "sha512-baMC0LCS1V1qYQimDmpfevaQNgClpGUM0D56L9R38o0nkhY50P2WQm54t3WVSt5sL8QMcRJUmHu+QXtyNHPziQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"lib0": "^0.2.7" "lib0": "^0.2.12"
},
"dependencies": {
"isomorphic.js": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/isomorphic.js/-/isomorphic.js-0.1.3.tgz",
"integrity": "sha512-pabBRLDwYefSsNS+qCazJ97o7P5xDTrNoxSYFTM09JlZTxPrOEPGKekwqUy3/Np4C4PHnVUXHYsZPOix0jELsA==",
"dev": true
},
"lib0": {
"version": "0.2.12",
"resolved": "https://registry.npmjs.org/lib0/-/lib0-0.2.12.tgz",
"integrity": "sha512-ileLyIMsWqcpyFLP6WMIgD6C7rkwrdYjH6CCFvAnqOhnGcyAl8LmLkiryVNmKW0sLRw/gLcB47LGXJDw0tDlkg==",
"dev": true,
"requires": {
"isomorphic.js": "^0.1.1"
}
}
} }
} }
} }

View file

@ -3,6 +3,7 @@
"version": "10.1.2", "version": "10.1.2",
"description": "WebRTC provider for Yjs", "description": "WebRTC provider for Yjs",
"main": "./dist/y-webrtc.cjs", "main": "./dist/y-webrtc.cjs",
"types": "./dist/y-webrtc.d.ts",
"module": "./src/y-webrtc.js", "module": "./src/y-webrtc.js",
"sideEffects": false, "sideEffects": false,
"scripts": { "scripts": {
@ -11,6 +12,7 @@
"demo": "concurrently 'http-server -o demo/index.html' 'npm run watch'", "demo": "concurrently 'http-server -o demo/index.html' 'npm run watch'",
"dist": "rm -rf dist && rollup -c", "dist": "rm -rf dist && rollup -c",
"watch": "rollup -wc", "watch": "rollup -wc",
"test": "npm run lint",
"lint": "standard && tsc", "lint": "standard && tsc",
"preversion": "npm run lint && npm run dist" "preversion": "npm run lint && npm run dist"
}, },
@ -44,18 +46,19 @@
"dependencies": { "dependencies": {
"lib0": "^0.2.20", "lib0": "^0.2.20",
"simple-peer": "^9.6.2", "simple-peer": "^9.6.2",
"y-protocols": "^0.2.0" "y-protocols": "^0.2.1"
}, },
"devDependencies": { "devDependencies": {
"@rollup/plugin-commonjs": "^11.0.1", "@rollup/plugin-commonjs": "^11.0.1",
"@rollup/plugin-node-resolve": "^7.0.0", "@rollup/plugin-node-resolve": "^7.0.0",
"@types/simple-peer": "^9.6.0",
"concurrently": "^5.1.0", "concurrently": "^5.1.0",
"http-server": "^0.12.1", "http-server": "^0.12.1",
"rollup": "^1.30.1", "rollup": "^1.30.1",
"rollup-cli": "^1.0.9", "rollup-cli": "^1.0.9",
"rollup-plugin-terser": "^5.2.0", "rollup-plugin-terser": "^5.2.0",
"standard": "^12.0.1", "standard": "^12.0.1",
"typescript": "^3.7.5", "typescript": "^3.8.3",
"yjs": "^13.0.4" "yjs": "^13.0.4"
}, },
"peerDependenies": { "peerDependenies": {

View file

@ -5,6 +5,9 @@
"lib": ["es2018", "dom"], /* Specify library files to be included in the compilation. */ "lib": ["es2018", "dom"], /* Specify library files to be included in the compilation. */
"allowJs": true, /* Allow javascript files to be compiled. */ "allowJs": true, /* Allow javascript files to be compiled. */
"checkJs": true, /* Report errors in .js files. */ "checkJs": true, /* Report errors in .js files. */
"declaration": true,
"outDir": "./dist",
"rootDir": "./",
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
@ -14,13 +17,13 @@
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */ // "composite": true, /* Enable project compilation */
// "removeComments": true, /* Do not emit comments to output. */ // "removeComments": true, /* Do not emit comments to output. */
"noEmit": true, /* Do not emit outputs. */ "emitDeclarationOnly": true,
// "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */ /* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */ "strict": false, /* Enable all strict type-checking options. */
"noImplicitAny": false, /* 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. */ // "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */
@ -38,7 +41,6 @@
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */ "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
"paths": { "paths": {
"y-protocols/*": ["../y-protocols/*"]
}, },
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "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. */ // "typeRoots": [], /* List of folders to include type definitions from. */
@ -56,8 +58,8 @@
/* Experimental Options */ /* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
// "maxNodeModuleJsDepth": 5 "maxNodeModuleJsDepth": 0
}, },
"exclude": ["../lib0/**/*", "node_modules", "node_modules/**/*", "dist", "dist/**/*.js"], "include": ["./src/y-webrtc.js"],
"include": ["./src/**/*", "./tests/**/*"] "exclude": ["./node_modules/simple-peer/*"]
} }