From a143a36745342fc3104ceb1b220bf69a8a9cd335 Mon Sep 17 00:00:00 2001 From: Brian Takita Date: Tue, 14 Mar 2023 09:52:29 -0400 Subject: [PATCH] ESM support (#784) Co-authored-by: Adam Mcgrath Co-authored-by: Adam Mcgrath --- .eslintrc.js | 1 + package.json | 1 + src/index.mjs | 11 +++++++++++ 3 files changed, 13 insertions(+) create mode 100644 src/index.mjs diff --git a/.eslintrc.js b/.eslintrc.js index 31e3bfa06..ae4cd70a4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,6 +5,7 @@ module.exports = { es2017: true, mocha: true, }, + ignorePatterns: ['**/*.mjs'], extends: [ 'eslint:recommended', 'plugin:jsdoc/recommended', diff --git a/package.json b/package.json index 6ba4b5bb5..907388941 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "3.2.0", "description": "SDK for Auth0 API v2", "main": "src/index.js", + "module": "src/index.mjs", "sideEffects": false, "files": [ "src" diff --git a/src/index.mjs b/src/index.mjs new file mode 100644 index 000000000..ed4f486ba --- /dev/null +++ b/src/index.mjs @@ -0,0 +1,11 @@ +import { createRequire } from 'module'; +const require = createRequire(import.meta.url); +/** + * Simple facade for consuming a REST API endpoint. + * + * @external RestClient + * {@link https://github.com/ngonzalvez/rest-facade} + */ +export const ManagementClient = require('./management'); +export const AuthenticationClient = require('./auth'); +export default { ManagementClient, AuthenticationClient }