Skip to content

Commit 39d035b

Browse files
committed
Add default export for better ES module (TypeScript) compatibility (#605)
1 parent 0d4bd9e commit 39d035b

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

packages/authentication/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Test Coverage](https://api.codeclimate.com/v1/badges/65abe50ec85244072ee9/test_coverage)](https://codeclimate.com/github/feathersjs/authentication/test_coverage)
77

88
[![Greenkeeper badge](https://badges.greenkeeper.io/feathersjs/authentication.svg)](https://greenkeeper.io/)
9-
[![Download Status](https://img.shields.io/npm/dm/feathersjs/authentication.svg?style=flat-square)](https://www.npmjs.com/package/@feathersjs/authentication)
9+
[![Download Status](https://img.shields.io/npm/dm/@feathersjs/authentication.svg?style=flat-square)](https://www.npmjs.com/package/@feathersjs/authentication)
1010
[![Slack Status](http://slack.feathersjs.com/badge.svg)](http://slack.feathersjs.com)
1111

1212
> Add Authentication to your FeathersJS app.

packages/authentication/lib/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const socket = require('./socket');
99

1010
const debug = Debug('@feathersjs/authentication:index');
1111

12-
module.exports = function init (config = {}) {
12+
function init (config = {}) {
1313
return function authentication () {
1414
const app = this;
1515
const _super = app.setup;
@@ -72,10 +72,13 @@ module.exports = function init (config = {}) {
7272
return result;
7373
};
7474
};
75-
};
75+
}
76+
77+
module.exports = init;
7678

7779
// Exposed Modules
7880
Object.assign(module.exports, {
81+
default: init,
7982
hooks,
8083
express,
8184
service

packages/authentication/test/index.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ describe('Feathers Authentication', () => {
3131
expect(typeof authentication).to.equal('function');
3232
});
3333

34+
it('exposes default', () => {
35+
expect(typeof authentication.default).to.equal('function');
36+
});
37+
3438
it('exposes hooks', () => {
3539
expect(typeof authentication.hooks).to.equal('object');
3640
});

0 commit comments

Comments
 (0)