remix icon indicating copy to clipboard operation
remix copied to clipboard

feat: deprecate all functions & types exported from `magicExports`

Open MichaelDeBoey opened this issue 3 years ago • 8 comments

I wanted to re-submit #2735 again, as:

  • The first release supporting separate packages was 1.3.3, which was released on 23 Mar 2022 https://github.com/remix-run/remix/releases/tag/v1.3.3
  • The replace-remix-imports migration was added in 1.4.0, which was released on 14 Apr 2022 https://github.com/remix-run/remix/releases/tag/v1.4.0
  • We now export functions/types that aren't available anymore through the remix package, as they're not included in the magicExports anymore (see both @remix-run/cloudflare & @remix-run/node) since 1.5.0
  • We now have a runtime package (@remix-run/deno) that doesn't have any magic exports at all since 1.5.0 https://github.com/remix-run/remix/releases/tag/v1.5.0
  • Our ESLint config is warning with a deprecated message when importing from the remix package since 1.6.0 https://github.com/remix-run/remix/releases/tag/v1.6.0

Original PR description:

As a follow-up of #2731, this will show deprecation warnings in the IDE + in console whenever people aren't using the ESLint config.

Inspired by @pcattori's remark (https://github.com/remix-run/remix/pull/2542#discussion_r838804227) on @mjackson's PR to rename createCloudflareKVSessionStorage to createWorkersKVSessionStorage (#2542).

Since each package is on it's own, I had to copy/paste the warn & getDeprecatedMessage functions over to each package.

If this somehow could be simplified (as this is doing the same thing over & over again), I'd be happy to do so.

MichaelDeBoey avatar May 22 '22 15:05 MichaelDeBoey

@mjackson @ryanflorence Our ESLint config is warning with a deprecated message when importing from the remix package since 1.6.0, so I think we can merge this one as well now? https://github.com/remix-run/remix/releases/tag/v1.6.0

MichaelDeBoey avatar Jun 15 '22 10:06 MichaelDeBoey

This will need a re-write now that #3543 is merged 🙈

MichaelDeBoey avatar Jun 23 '22 08:06 MichaelDeBoey

🦋 Changeset detected

Latest commit: d2e0c1fcd6bb31990c44804795293727006192e1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@remix-run/architect Major
@remix-run/cloudflare Major
@remix-run/node Major
@remix-run/react Major
@remix-run/server-runtime Major
@remix-run/cloudflare-pages Major
@remix-run/cloudflare-workers Major
@remix-run/express Major
@remix-run/netlify Major
@remix-run/vercel Major
@remix-run/deno Major
@remix-run/dev Major
@remix-run/serve Major
create-remix Major
remix Major
@remix-run/eslint-config Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Jul 09 '22 18:07 changeset-bot[bot]

@MichaelDeBoey I've pinged the bosses on this one again and am hoping to have a resolution this week. If approved, do you mind adding a changeset now that we have that work merged?

chaance avatar Jul 10 '22 19:07 chaance

I think now is a great time to officially deprecate using magic exports 👍

Do you know why the tests are failing in the diff view @MichaelDeBoey? Is that something to do with this PR? Or just something that has been happening for a while now? I'd like to clean that up if we can. If the test failures are unrelated to this PR, it's a huge distraction.

Can you also please say more about the approach you're taking here? It looks like you're generating a bunch of code in the build output. Is that right? I think I'd prefer to just write out the code (it's repetitive, I know) instead of introduce more complexity in our build.

mjackson avatar Sep 21 '22 00:09 mjackson

Do you know why the tests are failing in the diff view?

@mjackson If you're talking about the failing tests underneath Unchanged files with check annotations, this has been happening for a while now.

Can you also please say more about the approach you're taking here? It looks like you're generating a bunch of code in the build output. Is that right? I think I'd prefer to just write out the code (it's repetitive, I know) instead of introduce more complexity in our build.

In #3543, @chaance removed all manual magicExports files & replaced it by generating them. The generation script is taking the defined functions/types from rollup.config.js's getMagicExports & creates these magicExports files we had before.

My changes are building upon that script, by wrapping all exported functions in a warn function that's console.warning a deprecation message before calling the actual function (just like we do in #2542).

My changes also add an /** @deprecated **/ typehint to all functions/types & points them towards using the actual packages instead of using 'remix' package.

MichaelDeBoey avatar Sep 21 '22 01:09 MichaelDeBoey

@mjackson We moved to code generation here because having the code in the workspace was causing TypeScript issues when we did our Rollup build overhaul a while back. It was always intended to be temporary as we planned on removing the exports altogether, but we went this route to move a little quicker, as that refactor was blocking other work (specifically, adopting Changesets as noted in https://github.com/remix-run/remix/pull/3543).

chaance avatar Sep 21 '22 19:09 chaance

@MichaelDeBoey Just FYI, the only reason I haven't merged this yet is because I want to time it with an upcoming minor release. Once @brophdawg11 and @jacob-ebey finalize their work integrating React Router 6.4 I'll merge this and ship them together.

Just wanted you to know so you don't need to keep resolving conflicts until we're there!

chaance avatar Oct 20 '22 22:10 chaance

@MichaelDeBoey Ready to merge this if you're able to bring the branch up-to-date 😄

chaance avatar Nov 18 '22 18:11 chaance

@chaance Rebase onto latest dev, so this should be OK to merge now 👍

MichaelDeBoey avatar Nov 18 '22 18:11 MichaelDeBoey