Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dependent types for PrismJS #196

Merged
merged 2 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cold-cows-joke.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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.