Skip to content

Commit d00c11b

Browse files
Revert "fix: Properly configure SDK to be distributed as ESM" (#2046)
1 parent c6947e2 commit d00c11b

29 files changed

+92
-96
lines changed

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "@auth0/nextjs-auth0",
33
"version": "4.4.1",
44
"description": "Auth0 Next.js SDK",
5-
"type": "module",
65
"scripts": {
76
"build": "tsc",
87
"build:watch": "tsc -w",
@@ -61,19 +60,19 @@
6160
},
6261
"exports": {
6362
".": {
64-
"default": "./dist/client/index.js"
63+
"import": "./dist/client/index.js"
6564
},
6665
"./server": {
67-
"default": "./dist/server/index.js"
66+
"import": "./dist/server/index.js"
6867
},
6968
"./errors": {
70-
"default": "./dist/errors/index.js"
69+
"import": "./dist/errors/index.js"
7170
},
7271
"./types": {
73-
"default": "./dist/types/index.d.ts"
72+
"import": "./dist/types/index.d.ts"
7473
},
7574
"./testing": {
76-
"default": "./dist/testing/index.js"
75+
"import": "./dist/testing/index.js"
7776
}
7877
},
7978
"dependencies": {

src/client/helpers/get-access-token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AccessTokenError } from "../../errors/index.js";
1+
import { AccessTokenError } from "../../errors";
22

33
export async function getAccessToken() {
44
const tokenRes = await fetch(

src/client/hooks/use-user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import useSWR from "swr";
44

5-
import type { User } from "../../types/index.js";
5+
import type { User } from "../../types";
66

77
export function useUser() {
88
const { data, error, isLoading } = useSWR<User, Error, string>(

src/client/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export { useUser } from "./hooks/use-user.js";
2-
export { getAccessToken } from "./helpers/get-access-token.js";
3-
export { Auth0Provider } from "./providers/auth0-provider.js";
1+
export { useUser } from "./hooks/use-user";
2+
export { getAccessToken } from "./helpers/get-access-token";
3+
export { Auth0Provider } from "./providers/auth0-provider";

src/client/providers/auth0-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import React from "react";
44
import { SWRConfig } from "swr";
55

6-
import { User } from "../../types/index.js";
6+
import { User } from "../../types";
77

88
export function Auth0Provider({
99
user,

src/server/auth-client.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { NextRequest, NextResponse } from "next/server.js";
1+
import { NextRequest, NextResponse } from "next/server";
22
import * as jose from "jose";
33
import * as oauth from "oauth4webapi";
44
import { describe, expect, it, vi } from "vitest";
55

6-
import { generateSecret } from "../test/utils.js";
7-
import { SessionData } from "../types/index.js";
8-
import { AuthClient } from "./auth-client.js";
9-
import { decrypt, encrypt } from "./cookies.js";
10-
import { StatefulSessionStore } from "./session/stateful-session-store.js";
11-
import { StatelessSessionStore } from "./session/stateless-session-store.js";
12-
import { TransactionState, TransactionStore } from "./transaction-store.js";
6+
import { generateSecret } from "../test/utils";
7+
import { SessionData } from "../types";
8+
import { AuthClient } from "./auth-client";
9+
import { decrypt, encrypt } from "./cookies";
10+
import { StatefulSessionStore } from "./session/stateful-session-store";
11+
import { StatelessSessionStore } from "./session/stateless-session-store";
12+
import { TransactionState, TransactionStore } from "./transaction-store";
1313

1414
describe("Authentication Client", async () => {
1515
const DEFAULT = {

src/server/auth-client.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { NextResponse, type NextRequest } from "next/server.js";
1+
import { NextResponse, type NextRequest } from "next/server";
22
import * as jose from "jose";
33
import * as oauth from "oauth4webapi";
44

5-
import packageJson from "../../package.json" with { type: "json" };
5+
import packageJson from "../../package.json";
66
import {
77
AccessTokenError,
88
AccessTokenErrorCode,
@@ -16,7 +16,7 @@ import {
1616
MissingStateError,
1717
OAuth2Error,
1818
SdkError
19-
} from "../errors/index.js";
19+
} from "../errors";
2020
import {
2121
AuthorizationParameters,
2222
ConnectionTokenSet,
@@ -25,16 +25,16 @@ import {
2525
SessionData,
2626
StartInteractiveLoginOptions,
2727
TokenSet
28-
} from "../types/index.js";
28+
} from "../types";
2929
import {
3030
ensureNoLeadingSlash,
3131
ensureTrailingSlash,
3232
removeTrailingSlash
33-
} from "../utils/pathUtils.js";
34-
import { toSafeRedirect } from "../utils/url-helpers.js";
35-
import { AbstractSessionStore } from "./session/abstract-session-store.js";
36-
import { TransactionState, TransactionStore } from "./transaction-store.js";
37-
import { filterClaims } from "./user.js";
33+
} from "../utils/pathUtils";
34+
import { toSafeRedirect } from "../utils/url-helpers";
35+
import { AbstractSessionStore } from "./session/abstract-session-store";
36+
import { TransactionState, TransactionStore } from "./transaction-store";
37+
import { filterClaims } from "./user";
3838

3939
export type BeforeSessionSavedHook = (
4040
session: SessionData,

src/server/chunked-cookies.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
RequestCookies,
88
ResponseCookies,
99
setChunkedCookie
10-
} from "./cookies.js";
10+
} from "./cookies";
1111

1212
// Create mock implementation for RequestCookies and ResponseCookies
1313
const createMocks = () => {

src/server/client.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { IncomingMessage, ServerResponse } from "node:http";
2-
import { cookies } from "next/headers.js";
3-
import { NextRequest, NextResponse } from "next/server.js";
4-
import { NextApiRequest, NextApiResponse } from "next/types.js";
2+
import { cookies } from "next/headers";
3+
import { NextRequest, NextResponse } from "next/server";
4+
import { NextApiRequest, NextApiResponse } from "next/types";
55

66
import {
77
AccessTokenError,
@@ -10,32 +10,32 @@ import {
1010
AccessTokenForConnectionErrorCode,
1111
ConfigurationError,
1212
ConfigurationErrorCode
13-
} from "../errors/index.js";
13+
} from "../errors";
1414
import {
1515
AccessTokenForConnectionOptions,
1616
AuthorizationParameters,
1717
SessionData,
1818
SessionDataStore,
1919
StartInteractiveLoginOptions
20-
} from "../types/index.js";
20+
} from "../types";
2121
import {
2222
AuthClient,
2323
BeforeSessionSavedHook,
2424
OnCallbackHook,
2525
RoutesOptions
26-
} from "./auth-client.js";
27-
import { RequestCookies, ResponseCookies } from "./cookies.js";
26+
} from "./auth-client";
27+
import { RequestCookies, ResponseCookies } from "./cookies";
2828
import {
2929
AbstractSessionStore,
3030
SessionConfiguration,
3131
SessionCookieOptions
32-
} from "./session/abstract-session-store.js";
33-
import { StatefulSessionStore } from "./session/stateful-session-store.js";
34-
import { StatelessSessionStore } from "./session/stateless-session-store.js";
32+
} from "./session/abstract-session-store";
33+
import { StatefulSessionStore } from "./session/stateful-session-store";
34+
import { StatelessSessionStore } from "./session/stateless-session-store";
3535
import {
3636
TransactionCookieOptions,
3737
TransactionStore
38-
} from "./transaction-store.js";
38+
} from "./transaction-store";
3939

4040
export interface Auth0ClientOptions {
4141
// authorization server configuration

src/server/cookies.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, it } from "vitest";
22

3-
import { generateSecret } from "../test/utils.js";
4-
import { decrypt, encrypt } from "./cookies.js";
3+
import { generateSecret } from "../test/utils";
4+
import { decrypt, encrypt } from "./cookies";
55

66
describe("encrypt/decrypt", async () => {
77
const secret = await generateSecret(32);

0 commit comments

Comments
 (0)