Skip to content

Commit

Permalink
fix(errors): expose custom errors (#1816)
Browse files Browse the repository at this point in the history
* chore(deps): add class-properties babel plugin

* feat(errors): expand list of custom error classes

* build(errors): expose errors as a submodule
  • Loading branch information
balazsorban44 committed Apr 22, 2021
1 parent e26c5fc commit be28672
Show file tree
Hide file tree
Showing 6 changed files with 287 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ node_modules
# Generated files
.docusaurus
.cache-loader
.next
www/providers.json
src/providers/index.js
internals
Expand All @@ -39,6 +38,7 @@ jwt.d.ts
jwt.js
providers.d.ts
providers.js
errors.js

# Development app
app/next-auth
Expand Down
3 changes: 3 additions & 0 deletions config/babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"presets": [
["@babel/preset-env", { "targets": { "esmodules": true } }]
],
"plugins": [
"@babel/plugin-proposal-class-properties"
],
"comments": false,
"overrides": [
{
Expand Down
2 changes: 2 additions & 0 deletions config/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const MODULE_ENTRIES = {
PROVIDERS: "providers",
ADAPTERS: "adapters",
JWT: "jwt",
ERRORS: "errors",
}

// Building submodule entries
Expand All @@ -17,6 +18,7 @@ const BUILD_TARGETS = {
[`${MODULE_ENTRIES.ADAPTERS}.js`]: "module.exports = require('./dist/adapters').default\n",
[`${MODULE_ENTRIES.PROVIDERS}.js`]: "module.exports = require('./dist/providers').default\n",
[`${MODULE_ENTRIES.JWT}.js`]: "module.exports = require('./dist/lib/jwt').default\n",
[`${MODULE_ENTRIES.ERRORS}.js`]: "module.exports = require('./dist/lib/errors').default\n",
}

Object.entries(BUILD_TARGETS).forEach(([target, content]) => {
Expand Down
180 changes: 172 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 25 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,26 @@
"author": "Iain Collins <me@iaincollins.com>",
"main": "index.js",
"types": "./index.d.ts",
"keywords": ["react", "nodejs", "oauth", "jwt", "oauth2", "authentication", "nextjs", "csrf", "oidc", "nextauth"],
"keywords": [
"react",
"nodejs",
"oauth",
"jwt",
"oauth2",
"authentication",
"nextjs",
"csrf",
"oidc",
"nextauth"
],
"exports": {
".": "./dist/server/index.js",
"./jwt": "./dist/lib/jwt.js",
"./adapters": "./dist/adapters/index.js",
"./client": "./dist/client/index.js",
"./providers": "./dist/providers/index.js",
"./providers/*": "./dist/providers/*.js"
"./providers/*": "./dist/providers/*.js",
"./errors": "./dist/lib/errors.js"
},
"scripts": {
"build": "npm run build:js && npm run build:css",
Expand Down Expand Up @@ -56,7 +68,8 @@
"client.d.ts",
"jwt.js",
"jwt.d.ts",
"internals"
"internals",
"errors.js"
],
"license": "ISC",
"dependencies": {
Expand Down Expand Up @@ -87,6 +100,7 @@
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.6",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/preset-env": "^7.9.6",
"@prisma/client": "^2.16.1",
"@semantic-release/commit-analyzer": "^8.0.1",
Expand Down Expand Up @@ -157,8 +171,14 @@
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"main",
{ "name": "beta", "prerelease": true },
{ "name": "next", "prerelease": true }
{
"name": "beta",
"prerelease": true
},
{
"name": "next",
"prerelease": true
}
]
},
"funding": [
Expand Down

1 comment on commit be28672

@vercel
Copy link

@vercel vercel bot commented on be28672 Apr 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.