Skip to content

Commit

Permalink
Reorganize nextjs package
Browse files Browse the repository at this point in the history
  • Loading branch information
frankie567 committed Jun 4, 2024
1 parent 1a4ead9 commit 2977b29
Show file tree
Hide file tree
Showing 18 changed files with 2,249 additions and 1,938 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"eslint.validate": [
"javascript"
Expand Down
10 changes: 7 additions & 3 deletions nextjs/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"name": "@fief/fief/nextjs/react",
"private": true,
"main": "../../build/cjs/nextjs/react.js",
"module": "../../build/esm/nextjs/react.js",
"types": "../../build/esm/nextjs/react.d.ts"
"main": "../../build/cjs/nextjs/react/index.js",
"module": "../../build/esm/nextjs/react/index.js",
"types": "../../build/esm/nextjs/react/index.d.ts",
"peerDependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0"
}
}
3,607 changes: 1,924 additions & 1,683 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"jest": "^29.0.3",
"jest-environment-jsdom": "^29.0.3",
"jest-location-mock": "^2.0.0",
"next": "^13.2.4",
"next": "^14.2.3",
"node-fetch": "^2.7.0",
"node-mocks-http": "^1.11.0",
"ramda": "^0.29.0",
Expand All @@ -74,7 +74,7 @@
},
"dependencies": {
"encoding": "^0.1.13",
"jose": "^4.6.0",
"jose": "^5.4.0",
"path-to-regexp": "^6.2.1"
},
"jest": {}
Expand Down
11 changes: 9 additions & 2 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ const external = [
'crypto',
'jose',
'next',
'next/cache',
'next/headers',
'next/server',
'path-to-regexp',
'react',
'react/jsx-runtime',
];
const globals = {
crypto: 'crypto',
};

export default [
// browser-friendly UMD build
Expand All @@ -24,6 +28,7 @@ export default [
file: 'build/index.umd.js',
format: 'umd',
sourcemap: true,
globals,
},
plugins: [
nodeResolve({
Expand All @@ -44,7 +49,7 @@ export default [
'src/react/index.ts',
'src/express/index.ts',
'src/nextjs/index.ts',
'src/nextjs/react.tsx',
'src/nextjs/react/index.ts',
],
plugins: [
typescript({
Expand All @@ -60,6 +65,7 @@ export default [
sourcemap: true,
preserveModules: true,
preserveModulesRoot: 'src',
globals,
},
],
external,
Expand All @@ -71,7 +77,7 @@ export default [
'src/react/index.ts',
'src/express/index.ts',
'src/nextjs/index.ts',
'src/nextjs/react.tsx',
'src/nextjs/react/index.ts',
],
plugins: [
typescript({
Expand All @@ -88,6 +94,7 @@ export default [
sourcemap: true,
preserveModules: true,
preserveModulesRoot: 'src',
globals,
},
],
external,
Expand Down
3 changes: 2 additions & 1 deletion src/crypto/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ export const getCrypto = (): ICryptoHelper => {
throw new CryptoHelperError('Cannot find a crypto implementation for your environment');
};

export { CryptoHelperError, ICryptoHelper };
export { CryptoHelperError };
export type { ICryptoHelper };
4 changes: 3 additions & 1 deletion src/express/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,12 @@ const createMiddleware = (parameters: FiefAuthParameters) => {
};

export {
AuthenticateRequestParameters,
authorizationSchemeGetter,
cookieGetter,
createMiddleware,
};
export type {
AuthenticateRequestParameters,
IUserInfoCache,
TokenGetter,
};
10 changes: 6 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@
*/

export * as browser from './browser';
export type {
FiefAccessTokenInfo,
FiefParameters,
FiefTokenResponse,
FiefUserInfo,
} from './client';
export {
Fief,
FiefAccessTokenACRTooLow,
FiefAccessTokenExpired,
FiefAccessTokenInfo,
FiefAccessTokenInvalid,
FiefAccessTokenMissingPermission,
FiefAccessTokenMissingScope,
FiefACR,
FiefError,
FiefIdTokenInvalid,
FiefParameters,
FiefRequestError,
FiefTokenResponse,
FiefUserInfo,
} from './client';
export * as crypto from './crypto';
4 changes: 3 additions & 1 deletion src/nextjs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,9 @@ class FiefAuth {
}

export {
AuthenticateRequestParameters,
FiefAuth,
};
export type {
AuthenticateRequestParameters,
IUserInfoCache,
};
236 changes: 0 additions & 236 deletions src/nextjs/react.tsx

This file was deleted.

Loading

0 comments on commit 2977b29

Please sign in to comment.