Skip to content

Commit

Permalink
fix exports
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Nov 19, 2024
1 parent 7fdad3b commit 30e0711
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"./browser/mocks/legacy-image": "./dist/plugins/next-image/alias/next-legacy-image.js",
"./browser/mocks/image-default-loader": "./dist/plugins/next-image/alias/image-default-loader.js",
"./browser/mocks/image-context": "./dist/plugins/next-image/alias/image-context.js",
"./browser/mocks/draft-mode": "./dist/plugins/next-mocks/compatibility/draft-mode.compat.js",
"./browser/mocks/draft-mode.compat": "./dist/plugins/next-mocks/compatibility/draft-mode.compat.js",
"./node/mocks/cache": "./dist/plugins/next-mocks/alias/cache/index.cjs",
"./node/mocks/navigation": "./dist/plugins/next-mocks/alias/navigation/index.cjs",
"./node/mocks/headers": "./dist/plugins/next-mocks/alias/headers/index.cjs",
Expand All @@ -50,7 +50,7 @@
"./node/mocks/legacy-image": "./dist/plugins/next-image/alias/next-legacy-image.cjs",
"./node/mocks/image-default-loader": "./dist/plugins/next-image/alias/image-default-loader.cjs",
"./node/mocks/image-context": "./dist/plugins/next-image/alias/image-context.cjs",
"./node/mocks/draft-mode": "./dist/plugins/next-mocks/compatibility/draft-mode.compat.cjs"
"./node/mocks/draft-mode.compat": "./dist/plugins/next-mocks/compatibility/draft-mode.compat.cjs"
},
"scripts": {
"prepublishOnly": "pnpm build",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/next-mocks/alias/headers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export { headers } from "./headers";
export { cookies } from "./cookies";

// re-exports of the actual module
export * from "next/dist/server/request/headers";
export { UnsafeUnwrappedHeaders } from "next/dist/server/request/headers";

// passthrough mocks - keep original implementation but allow for spying
const draftMode: Mock<() => ReturnType<typeof originalDraftMode>> = fn(
Expand Down
6 changes: 4 additions & 2 deletions src/plugins/next-mocks/compatibility/compatibility-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ export const getCompatibilityAliases = (env: Env) => {
const version = getNextjsVersion();
const result: Record<string, string> = {};

const compatMap = mapping(env);

// biome-ignore lint/complexity/noForEach: <explanation>
Object.keys(mapping).forEach((key) => {
Object.keys(compatMap).forEach((key) => {
if (semver.intersects(version, key)) {
Object.assign(result, mapping(env)[key]);
Object.assign(result, compatMap[key]);
}
});

Expand Down
2 changes: 1 addition & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default defineConfig([
"src/plugins/next-mocks/alias/rsc/server-only.ts",
"src/plugins/next-mocks/alias/dynamic/index.tsx",
"src/mocks/storybook.global.ts",
"src/plugins/next-mocks/alias/compatibility/draft-mode.compat.ts",
"src/plugins/next-mocks/compatibility/draft-mode.compat.ts",
],
splitting: false,
clean: true,
Expand Down

0 comments on commit 30e0711

Please sign in to comment.