diff --git a/types/.npmignore b/types/.npmignore index 68c1b5eb..0083edb1 100644 --- a/types/.npmignore +++ b/types/.npmignore @@ -1,6 +1,6 @@ .vscode/ -lib/test/ -lib/*.map +lib/**/test/ +lib/**/*.map src/ test/ .eslintrc diff --git a/types/package.json b/types/package.json index d62c29c8..c522fabe 100644 --- a/types/package.json +++ b/types/package.json @@ -11,12 +11,13 @@ "bugs": { "url": "https://github.com/Microsoft/vscode-languageserver-node/issues" }, - "main": "./lib/main.js", - "typings": "./lib/main", + "main": "./lib/umd/main.js", + "typings": "./lib/umd/main", + "module": "./lib/esm/main.js", "scripts": { "prepublish": "npm run compile && npm test", "postpublish": "node ../build/npm/post-publish.js", - "compile": "node ../build/bin/tsc -p ./tsconfig.json", + "compile": "node ../build/bin/tsc -p ./tsconfig.json && node ../build/bin/tsc -p ./tsconfig.esm.json", "watch": "node ../build/bin/tsc -w -p ./tsconfig.json", "test": "node ../node_modules/mocha/bin/_mocha" } diff --git a/types/src/test/textdocument.test.ts b/types/src/test/textdocument.test.ts index c230e08c..c4266264 100644 --- a/types/src/test/textdocument.test.ts +++ b/types/src/test/textdocument.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import assert = require('assert'); +import * as assert from 'assert'; import { TextDocument, Range, Position } from '../main'; suite('Text Document Lines Model Validator', () => { diff --git a/types/test/mocha.opts b/types/test/mocha.opts index 0a137a0e..5df3fcfa 100644 --- a/types/test/mocha.opts +++ b/types/test/mocha.opts @@ -1,4 +1,4 @@ -lib/test +lib/umd/test --recursive --ui tdd --useColors true \ No newline at end of file diff --git a/types/tsconfig.esm.json b/types/tsconfig.esm.json new file mode 100644 index 00000000..2c7faf1c --- /dev/null +++ b/types/tsconfig.esm.json @@ -0,0 +1,16 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "target": "es5", + "module": "es6", + "sourceMap": false, + "declaration": true, + "stripInternal": true, + "lib": [ "es2015" ], + "outDir": "lib/esm", + "rootDir": "src" + }, + "include": [ + "src" + ] +} \ No newline at end of file diff --git a/types/tsconfig.json b/types/tsconfig.json index 984dae58..32de828a 100644 --- a/types/tsconfig.json +++ b/types/tsconfig.json @@ -7,7 +7,7 @@ "declaration": true, "stripInternal": true, "lib": [ "es2015" ], - "outDir": "lib", + "outDir": "lib/umd", "rootDir": "src" }, "include": [