mdx-js / mdx

Markdown for the component era
https://mdxjs.com
MIT License
17.76k stars 1.14k forks source link

Missing "./package.json" in package.json "exports" #2556

Closed artuska closed 2 weeks ago

artuska commented 2 weeks ago

Initial checklist

Problem

Missing "./package.json" in package.json "exports":

"exports": {
   ".": "./index.js",
  "./internal-create-format-aware-processors": "./lib/util/create-format-aware-processors.js",
  "./internal-extnames-to-regex": "./lib/util/extnames-to-regex.js"
},

Solution

Just add "./package.json" in package.json "exports" like that:

"exports": {
  "./package.json": "./package.json",
   ".": "./index.js",
  "./internal-create-format-aware-processors": "./lib/util/create-format-aware-processors.js",
  "./internal-extnames-to-regex": "./lib/util/extnames-to-regex.js"
},

Alternatives

Just add "./package.json" in package.json "exports".

ChristianMurphy commented 2 weeks ago

Welcome @artuska! 👋 I'm open to adding the package to the exports. Could you expand a bit on what you want out of that file? And why or how you want to leverage it?

artuska commented 2 weeks ago

This feature is related to the Vite issue — https://github.com/originjs/vite-plugin-federation/issues/357

ChristianMurphy commented 2 weeks ago

@artuska it looks like a bug in an abandoned module https://github.com/originjs/vite-plugin-federation/issues/597 And that it is no longer recommended https://github.com/originjs/vite-plugin-federation/issues/597#issuecomment-2395491268

Try migrating to https://github.com/module-federation/vite

I'd hold on making changes here because:

  1. it's not clear why the package is needed by the tool in the first place
  2. it's an abandoned tool, and I don't think it's a good idea to try to change the entire npm ecosystem to try to fix abandoned tools
wooorm commented 2 weeks ago

Paraphrasing the argument here, some unmaintained, uncommon, tool is broken and an error can disappear when we add package.json to exports. There are viable alternatives: migrating to a maintained alternative or patch-package. I don’t think that’s a good story for changing things here.

For me, it is intentional that package.jsons are not part of the public API. We can have a discussion about adding them to all packages. We could test a small subset of course and it doesn’t have to be all at once. But still: I’m not convinced yet and that would be a whole discussion about trade offs, so more something for https://github.com/unifiedjs/rfcs or so.

That discussion would have little to do with the arguments here. So, closing this issue for now.

github-actions[bot] commented 2 weeks ago

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.