Skip to content

Commit

Permalink
Merge pull request #196 from FormidableLabs/fix/prismjs-types-dep
Browse files Browse the repository at this point in the history
Fix dependent types for PrismJS
  • Loading branch information
carloskelly13 committed Apr 25, 2023
2 parents 9527418 + 512e610 commit 6959a6c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/cold-cows-joke.md
@@ -0,0 +1,5 @@
---
"prism-react-renderer": patch
---

Fix inclusion of @types dependency for prismjs
2 changes: 1 addition & 1 deletion packages/generate-prism-languages/index.ts
Expand Up @@ -28,7 +28,7 @@ export const languagesToBundle = <const>[
* that starts off assuming Prism lives in global scope. We also need to provide Prism as that
* gets passed into an iffe preventing us from needing to use global scope.
*/
const header = `// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport Prism from "prismjs";\nexport { Prism };`
const header = `// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport * as Prism from "prismjs";\nexport { Prism };`
const prismPath = dirname(require.resolve("prismjs"))

const readLanguageFile = async (language: string): Promise<string> => {
Expand Down
2 changes: 1 addition & 1 deletion packages/prism-react-renderer/package.json
Expand Up @@ -34,7 +34,6 @@
"@testing-library/react": "^14.0.0",
"@types/jest": "^29.5.0",
"@types/node": "^18.15.11",
"@types/prismjs": "^1.26.0",
"@vitejs/plugin-react": "^3.1.0",
"babel-plugin-codegen": "^4.1.5",
"happy-dom": "^9.7.1",
Expand All @@ -50,6 +49,7 @@
"vitest": "^0.30.1"
},
"dependencies": {
"@types/prismjs": "^1.26.0",
"clsx": "^1.2.1"
}
}
2 changes: 1 addition & 1 deletion packages/prism-react-renderer/src/types.ts
@@ -1,5 +1,5 @@
import type { CSSProperties } from "react"
import { Token as PrismToken } from "prismjs"
import type { Token as PrismToken } from "prismjs"

export type Language = string
export type PrismGrammar = Record<string, unknown>
Expand Down
7 changes: 3 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6959a6c

Please sign in to comment.