Skip to content

Commit be28672

Browse files
fix(errors): expose custom errors (#1816)
* chore(deps): add class-properties babel plugin * feat(errors): expand list of custom error classes * build(errors): expose errors as a submodule
1 parent e26c5fc commit be28672

File tree

6 files changed

+287
-39
lines changed

6 files changed

+287
-39
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ node_modules
2525
# Generated files
2626
.docusaurus
2727
.cache-loader
28-
.next
2928
www/providers.json
3029
src/providers/index.js
3130
internals
@@ -39,6 +38,7 @@ jwt.d.ts
3938
jwt.js
4039
providers.d.ts
4140
providers.js
41+
errors.js
4242

4343
# Development app
4444
app/next-auth

config/babel.config.json

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"presets": [
33
["@babel/preset-env", { "targets": { "esmodules": true } }]
44
],
5+
"plugins": [
6+
"@babel/plugin-proposal-class-properties"
7+
],
58
"comments": false,
69
"overrides": [
710
{

config/build.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const MODULE_ENTRIES = {
77
PROVIDERS: "providers",
88
ADAPTERS: "adapters",
99
JWT: "jwt",
10+
ERRORS: "errors",
1011
}
1112

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

2224
Object.entries(BUILD_TARGETS).forEach(([target, content]) => {

package-lock.json

+172-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+25-5
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,26 @@
77
"author": "Iain Collins <[email protected]>",
88
"main": "index.js",
99
"types": "./index.d.ts",
10-
"keywords": ["react", "nodejs", "oauth", "jwt", "oauth2", "authentication", "nextjs", "csrf", "oidc", "nextauth"],
10+
"keywords": [
11+
"react",
12+
"nodejs",
13+
"oauth",
14+
"jwt",
15+
"oauth2",
16+
"authentication",
17+
"nextjs",
18+
"csrf",
19+
"oidc",
20+
"nextauth"
21+
],
1122
"exports": {
1223
".": "./dist/server/index.js",
1324
"./jwt": "./dist/lib/jwt.js",
1425
"./adapters": "./dist/adapters/index.js",
1526
"./client": "./dist/client/index.js",
1627
"./providers": "./dist/providers/index.js",
17-
"./providers/*": "./dist/providers/*.js"
28+
"./providers/*": "./dist/providers/*.js",
29+
"./errors": "./dist/lib/errors.js"
1830
},
1931
"scripts": {
2032
"build": "npm run build:js && npm run build:css",
@@ -56,7 +68,8 @@
5668
"client.d.ts",
5769
"jwt.js",
5870
"jwt.d.ts",
59-
"internals"
71+
"internals",
72+
"errors.js"
6073
],
6174
"license": "ISC",
6275
"dependencies": {
@@ -87,6 +100,7 @@
87100
"devDependencies": {
88101
"@babel/cli": "^7.8.4",
89102
"@babel/core": "^7.9.6",
103+
"@babel/plugin-proposal-class-properties": "^7.13.0",
90104
"@babel/preset-env": "^7.9.6",
91105
"@prisma/client": "^2.16.1",
92106
"@semantic-release/commit-analyzer": "^8.0.1",
@@ -157,8 +171,14 @@
157171
"branches": [
158172
"+([0-9])?(.{+([0-9]),x}).x",
159173
"main",
160-
{ "name": "beta", "prerelease": true },
161-
{ "name": "next", "prerelease": true }
174+
{
175+
"name": "beta",
176+
"prerelease": true
177+
},
178+
{
179+
"name": "next",
180+
"prerelease": true
181+
}
162182
]
163183
},
164184
"funding": [

0 commit comments

Comments
 (0)