Skip to content

Commit

Permalink
feat(remix-cloudflare): deprecate createCloudflareKVSessionStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Sep 3, 2022
1 parent ed5759c commit 5c74477
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-dancers-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/cloudflare": minor
---

Rename `createCloudflareKVSessionStorage` to `createWorkersKVSessionStorage`
1 change: 1 addition & 0 deletions integration/cf-compiler-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ test.describe("cloudflare compiler", () => {
"createMemorySessionStorage",
"createSessionStorage",
"createSession",
"createCloudflareKVSessionStorage",
"isCookie",
"isSession",
"json",
Expand Down
20 changes: 16 additions & 4 deletions packages/remix-cloudflare/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import "./globals";

export {
import {createWorkersKVSessionStorage} from './sessions/workersKVStorage';

const warn = <T extends Function>(fn: T, message: string): T =>
((...args: unknown[]) => {
console.warn(message);

return fn(...args);
}) as unknown as T;


/** @deprecated Use `createWorkersKVSessionStorage` instead. */
export const createCloudflareKVSessionStorage = warn(
createWorkersKVSessionStorage,
// TODO: Deprecate createCloudflareKVSessionStorage
createWorkersKVSessionStorage as createCloudflareKVSessionStorage,
} from "./sessions/workersKVStorage";
"`createCloudflareKVSessionStorage` is deprecated. Please use `createWorkersKVSessionStorage` instead.",
);

export { createWorkersKVSessionStorage } from "./sessions/workersKVStorage";

export {
createCookie,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const packageExports: Record<Package, Exports> = {
type: [...defaultAdapterExports.type],
},
cloudflare: {
value: [...defaultRuntimeExports.value, "createCloudflareKVSessionStorage"],
value: [...defaultRuntimeExports.value, "createCloudflareKVSessionStorage", "createWorkersKVSessionStorage"],
type: [...defaultRuntimeExports.type],
},
"cloudflare-pages": {
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-eslint-config/rules/packageExports.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const architectSpecificExports = {
};

const cloudflareSpecificExports = {
value: ["createCloudflareKVSessionStorage"],
value: ["createCloudflareKVSessionStorage", "createWorkersKVSessionStorage"],
type: [],
};

Expand Down

0 comments on commit 5c74477

Please sign in to comment.