diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 22e308d..0000000 --- a/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - presets: ["es2015"] -} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 57ddb3a..d3a4e10 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ node_modules/ -lib/ *.sw[po] yarn.lock package-lock.json diff --git a/README.md b/README.md index 9ade18a..309651e 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,4 @@ In most cases, you won't need this at all. ## Development -This module is written in ES6, and uses Babel for compilation. What this means in practice: - -* The source code lives in the `src/` directory. -* After changing this code, make sure to run `npm run build` to compile it. +This module is written in ES6 and uses ESM. diff --git a/index.js b/index.js index 651c499..b0df682 100644 --- a/index.js +++ b/index.js @@ -1 +1,4 @@ -module.exports = require("./lib").default; +/* eslint-disable-next-line no-underscore-dangle */ +const _require = require('esm')(module); + +module.exports = _require('./src/index').default; diff --git a/package.json b/package.json index fa95452..791dd7c 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,10 @@ { "name": "express-ws", - "version": "4.0.0", + "version": "5.0.0", "description": "WebSocket endpoints for Express applications", - "main": "index.js", + "main": "index", + "module": "src/index", "scripts": { - "prepublish": "npm run build", - "build": "babel src/ -d lib/", "lint": "eslint src/" }, "author": "Henning Morud ", @@ -15,10 +14,12 @@ "Andrew Phillips ", "Nicholas Schell ", "Max Truxa ", - "Kræn Hansen " + "Kræn Hansen ", + "Alexis Tyler " ], "license": "BSD-2-Clause", "dependencies": { + "esm": "^3.0.84", "ws": "^6.0.0" }, "peerDependencies": { @@ -44,8 +45,6 @@ }, "homepage": "https://github.com/HenningM/express-ws", "devDependencies": { - "babel-cli": "^6.26.0", - "babel-preset-es2015": "^6.5.0", "eslint": "^4.19.0", "eslint-config-airbnb": "^14.1.0", "eslint-plugin-import": "^2.12.0", diff --git a/src/index.js b/src/index.js index e3d3114..dab6c66 100644 --- a/src/index.js +++ b/src/index.js @@ -60,7 +60,7 @@ export default function expressWs(app, httpServer, options = {}) { dummyResponse.writeHead = function writeHead(statusCode) { if (statusCode > 200) { /* Something in the middleware chain signalled an error. */ - dummyResponse._header = ''; + dummyResponse._header = ''; // eslint-disable-line no-underscore-dangle socket.close(); } };