-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: deprecate all functions & types exported from
magicExports
- Loading branch information
1 parent
a609751
commit 1b0e812
Showing
7 changed files
with
423 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
|
||
import * as architect from "@remix-run/architect"; | ||
|
||
const warn = <T extends Function>(fn: T, message: string): T => | ||
((...args: unknown[]) => { | ||
console.warn(message); | ||
|
||
return fn(...args); | ||
}) as unknown as T; | ||
|
||
const getDeprecatedMessage = (functionName: string, packageName: string) => | ||
`All \`remix\` exports are considered deprecated as of v1.3.3. Please import \`${functionName}\` from \`@remix-run/${packageName}\` instead. You can run \`remix migrate --migration replace-remix-imports\` to automatically migrate your code.`; | ||
|
||
// Re-export everything from this package that is available in `remix`. | ||
|
||
export { createArcTableSessionStorage } from "@remix-run/architect"; | ||
/** @deprecated Import `createArcTableSessionStorage` from `@remix-run/architect` instead. */ | ||
export const createArcTableSessionStorage = warn( | ||
architect.createArcTableSessionStorage, | ||
getDeprecatedMessage("createArcTableSessionStorage", "architect") | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
import * as cloudflare from "@remix-run/cloudflare"; | ||
|
||
const warn = <T extends Function>(fn: T, message: string): T => | ||
((...args: unknown[]) => { | ||
console.warn(message); | ||
|
||
return fn(...args); | ||
}) as unknown as T; | ||
|
||
const getDeprecatedMessage = (functionName: string, packageName: string) => | ||
`All \`remix\` exports are considered deprecated as of v1.3.3. Please import \`${functionName}\` from \`@remix-run/${packageName}\` instead. You can run \`remix migrate --migration replace-remix-imports\` to automatically migrate your code.`; | ||
|
||
// Re-export everything from this package that is available in `remix`. | ||
|
||
export { createCloudflareKVSessionStorage } from "@remix-run/cloudflare"; | ||
/** @deprecated Import `createCloudflareKVSessionStorage` from `@remix-run/cloudflare` instead. */ | ||
export const createCloudflareKVSessionStorage = warn( | ||
cloudflare.createCloudflareKVSessionStorage, | ||
getDeprecatedMessage("createCloudflareKVSessionStorage", "cloudflare") | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
import * as cloudflare from "@remix-run/cloudflare"; | ||
|
||
const warn = <T extends Function>(fn: T, message: string): T => | ||
((...args: unknown[]) => { | ||
console.warn(message); | ||
|
||
return fn(...args); | ||
}) as unknown as T; | ||
|
||
const getDeprecatedMessage = (functionName: string, packageName: string) => | ||
`All \`remix\` exports are considered deprecated as of v1.3.3. Please import \`${functionName}\` from \`@remix-run/${packageName}\` instead. You can run \`remix migrate --migration replace-remix-imports\` to automatically migrate your code.`; | ||
|
||
// Re-export everything from this package that is available in `remix`. | ||
|
||
export { createCloudflareKVSessionStorage } from "@remix-run/cloudflare"; | ||
/** @deprecated Import `createCloudflareKVSessionStorage` from `@remix-run/cloudflare` instead. */ | ||
export const createCloudflareKVSessionStorage = warn( | ||
cloudflare.createCloudflareKVSessionStorage, | ||
getDeprecatedMessage("createCloudflareKVSessionStorage", "cloudflare") | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,41 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
|
||
import * as cloudflare from "@remix-run/cloudflare"; | ||
|
||
const warn = <T extends Function>(fn: T, message: string): T => | ||
((...args: unknown[]) => { | ||
console.warn(message); | ||
|
||
return fn(...args); | ||
}) as unknown as T; | ||
|
||
const getDeprecatedMessage = (functionName: string, packageName: string) => | ||
`All \`remix\` exports are considered deprecated as of v1.3.3. Please import \`${functionName}\` from \`@remix-run/${packageName}\` instead. You can run \`remix migrate --migration replace-remix-imports\` to automatically migrate your code.`; | ||
|
||
// Re-export everything from this package that is available in `remix`. | ||
|
||
export { | ||
createCloudflareKVSessionStorage, | ||
createCookie, | ||
createSessionStorage, | ||
createCookieSessionStorage, | ||
createMemorySessionStorage, | ||
} from "@remix-run/cloudflare"; | ||
/** @deprecated Import `createCloudflareKVSessionStorage` from `@remix-run/cloudflare` instead. */ | ||
export const createCloudflareKVSessionStorage = warn( | ||
cloudflare.createCloudflareKVSessionStorage, | ||
getDeprecatedMessage("createCloudflareKVSessionStorage", "cloudflare") | ||
); | ||
/** @deprecated Import `createCookie` from `@remix-run/cloudflare` instead. */ | ||
export const createCookie = warn( | ||
cloudflare.createCookie, | ||
getDeprecatedMessage("createCookie", "cloudflare") | ||
); | ||
/** @deprecated Import `createSessionStorage` from `@remix-run/cloudflare` instead. */ | ||
export const createSessionStorage = warn( | ||
cloudflare.createSessionStorage, | ||
getDeprecatedMessage("createSessionStorage", "cloudflare") | ||
); | ||
/** @deprecated Import `createCookieSessionStorage` from `@remix-run/cloudflare` instead. */ | ||
export const createCookieSessionStorage = warn( | ||
cloudflare.createCookieSessionStorage, | ||
getDeprecatedMessage("createCookieSessionStorage", "cloudflare") | ||
); | ||
/** @deprecated Import `createMemorySessionStorage` from `@remix-run/cloudflare` instead. */ | ||
export const createMemorySessionStorage = warn( | ||
cloudflare.createMemorySessionStorage, | ||
getDeprecatedMessage("createMemorySessionStorage", "cloudflare") | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,62 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
|
||
import * as node from "@remix-run/node"; | ||
import type * as NodeTypes from "@remix-run/node"; | ||
|
||
const warn = <T extends Function>(fn: T, message: string): T => | ||
((...args: unknown[]) => { | ||
console.warn(message); | ||
|
||
return fn(...args); | ||
}) as unknown as T; | ||
|
||
const getDeprecatedMessage = (functionName: string, packageName: string) => | ||
`All \`remix\` exports are considered deprecated as of v1.3.3. Please import \`${functionName}\` from \`@remix-run/${packageName}\` instead. You can run \`remix migrate --migration replace-remix-imports\` to automatically migrate your code.`; | ||
|
||
// Re-export everything from this package that is available in `remix`. | ||
|
||
export { | ||
createCookie, | ||
createSessionStorage, | ||
createCookieSessionStorage, | ||
createMemorySessionStorage, | ||
createFileSessionStorage, | ||
unstable_createFileUploadHandler, | ||
unstable_createMemoryUploadHandler, | ||
unstable_parseMultipartFormData, | ||
} from "@remix-run/node"; | ||
/** @deprecated Import `createCookie` from `@remix-run/node` instead. */ | ||
export const createCookie = warn( | ||
node.createCookie, | ||
getDeprecatedMessage("createCookie", "node") | ||
); | ||
/** @deprecated Import `createSessionStorage` from `@remix-run/node` instead. */ | ||
export const createSessionStorage = warn( | ||
node.createSessionStorage, | ||
getDeprecatedMessage("createSessionStorage", "node") | ||
); | ||
/** @deprecated Import `createCookieSessionStorage` from `@remix-run/node` instead. */ | ||
export const createCookieSessionStorage = warn( | ||
node.createCookieSessionStorage, | ||
getDeprecatedMessage("createCookieSessionStorage", "node") | ||
); | ||
/** @deprecated Import `createMemorySessionStorage` from `@remix-run/node` instead. */ | ||
export const createMemorySessionStorage = warn( | ||
node.createMemorySessionStorage, | ||
getDeprecatedMessage("createMemorySessionStorage", "node") | ||
); | ||
/** @deprecated Import `createFileSessionStorage` from `@remix-run/node` instead. */ | ||
export const createFileSessionStorage = warn( | ||
node.createFileSessionStorage, | ||
getDeprecatedMessage("createFileSessionStorage", "node") | ||
); | ||
/** @deprecated Import `unstable_createFileUploadHandler` from `@remix-run/node` instead. */ | ||
export const unstable_createFileUploadHandler = warn( | ||
node.unstable_createFileUploadHandler, | ||
getDeprecatedMessage("unstable_createFileUploadHandler", "node") | ||
); | ||
/** @deprecated Import `unstable_createMemoryUploadHandler` from `@remix-run/node` instead. */ | ||
export const unstable_createMemoryUploadHandler = warn( | ||
node.unstable_createMemoryUploadHandler, | ||
getDeprecatedMessage("unstable_createMemoryUploadHandler", "node") | ||
); | ||
/** @deprecated Import `unstable_parseMultipartFormData` from `@remix-run/node` instead. */ | ||
export const unstable_parseMultipartFormData = warn( | ||
node.unstable_parseMultipartFormData, | ||
getDeprecatedMessage("unstable_parseMultipartFormData", "node") | ||
); | ||
|
||
export type { UploadHandler, UploadHandlerPart } from "@remix-run/node"; | ||
/** @deprecated Import type `UploadHandler` from `@remix-run/node` instead. */ | ||
export type UploadHandler = NodeTypes.UploadHandler; | ||
/** @deprecated Import type `UploadHandlerArgs` from `@remix-run/node` instead. */ | ||
export type UploadHandlerPart = NodeTypes.UploadHandlerPart; |
Oops, something went wrong.