From 5ac296b1cae522dbf4be2e3c9d703725937301f9 Mon Sep 17 00:00:00 2001 From: Scott Trinh Date: Fri, 5 Apr 2024 11:01:40 -0400 Subject: [PATCH] Allow importing WebAuthnClient from browser Need to separate out this import so that bundlers do not try to import server-only express modules. --- packages/auth-express/package.json | 8 +++++--- packages/auth-express/src/index.ts | 1 - packages/auth-express/src/webauthn.ts | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 packages/auth-express/src/webauthn.ts diff --git a/packages/auth-express/package.json b/packages/auth-express/package.json index 19af6bdd2..ef98c0067 100644 --- a/packages/auth-express/package.json +++ b/packages/auth-express/package.json @@ -11,15 +11,17 @@ }, "license": "Apache-2.0", "sideEffects": false, - "files": [ - "/dist" - ], + "files": ["/dist"], "main": "./dist/index.js", "types": "./dist/index.d.ts", "exports": { ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" + }, + "./webauthn": { + "types": "./dist/webauthn.d.ts", + "default": "./dist/webauthn.js" } }, "scripts": { diff --git a/packages/auth-express/src/index.ts b/packages/auth-express/src/index.ts index 268774c45..ac0cf6f6b 100644 --- a/packages/auth-express/src/index.ts +++ b/packages/auth-express/src/index.ts @@ -22,7 +22,6 @@ import { type RouterStack = (RequestHandler | ErrorRequestHandler)[]; export * from "@edgedb/auth-core/errors"; -export { WebAuthnClient } from "@edgedb/auth-core/webauthn"; export type BuiltinProviderNames = | BuiltinOAuthProviderNames diff --git a/packages/auth-express/src/webauthn.ts b/packages/auth-express/src/webauthn.ts new file mode 100644 index 000000000..e41382e60 --- /dev/null +++ b/packages/auth-express/src/webauthn.ts @@ -0,0 +1 @@ +export { WebAuthnClient } from "@edgedb/auth-core/webauthn";