Skip to content

Commit

Permalink
Add package.json main field for TypeScript plugin
Browse files Browse the repository at this point in the history
Although the `exports` field should be sufficient, some TypeScript
integrations still rely on the `main` field.

See #474 (comment)
  • Loading branch information
remcohaszing committed Sep 19, 2024
1 parent 8240ab1 commit 6c12960
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-spiders-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mdx-js/typescript-plugin': patch
---

Add the main field
5 changes: 5 additions & 0 deletions .changeset/silly-kiwis-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mdx-js/typescript-plugin': patch
---

Emit type declarations
9 changes: 7 additions & 2 deletions packages/typescript-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
"author": "Remco Haszing <remcohaszing@gmail.com>",
"funding": "https://opencollective.com/unified",
"license": "MIT",
"exports": "./lib/index.cjs",
"main": "./lib/index.cjs",
"exports": {
"types": "./types/index.d.cts",
"default": "./lib/index.cjs"
},
"files": [
"lib"
"lib",
"types"
],
"keywords": [
"IntelliSense",
Expand Down
8 changes: 6 additions & 2 deletions packages/typescript-plugin/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"include": ["lib"],
"references": [{"path": "../language-service/tsconfig.build.json"}],
"compilerOptions": {
"noEmit": true,
"declaration": true,
"emitDeclarationOnly": true,
// https://github.com/microsoft/TypeScript/issues/57652
"resolveJsonModule": true
"resolveJsonModule": true,
"outDir": "types",
"rootDir": "lib"
}
}

0 comments on commit 6c12960

Please sign in to comment.