Skip to content

Commit 6959a6c

Browse files
Merge pull request #196 from FormidableLabs/fix/prismjs-types-dep
Fix dependent types for PrismJS
2 parents 9527418 + 512e610 commit 6959a6c

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

.changeset/cold-cows-joke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"prism-react-renderer": patch
3+
---
4+
5+
Fix inclusion of @types dependency for prismjs

packages/generate-prism-languages/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const languagesToBundle = <const>[
2828
* that starts off assuming Prism lives in global scope. We also need to provide Prism as that
2929
* gets passed into an iffe preventing us from needing to use global scope.
3030
*/
31-
const header = `// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport Prism from "prismjs";\nexport { Prism };`
31+
const header = `// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport * as Prism from "prismjs";\nexport { Prism };`
3232
const prismPath = dirname(require.resolve("prismjs"))
3333

3434
const readLanguageFile = async (language: string): Promise<string> => {

packages/prism-react-renderer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"@testing-library/react": "^14.0.0",
3535
"@types/jest": "^29.5.0",
3636
"@types/node": "^18.15.11",
37-
"@types/prismjs": "^1.26.0",
3837
"@vitejs/plugin-react": "^3.1.0",
3938
"babel-plugin-codegen": "^4.1.5",
4039
"happy-dom": "^9.7.1",
@@ -50,6 +49,7 @@
5049
"vitest": "^0.30.1"
5150
},
5251
"dependencies": {
52+
"@types/prismjs": "^1.26.0",
5353
"clsx": "^1.2.1"
5454
}
5555
}

packages/prism-react-renderer/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { CSSProperties } from "react"
2-
import { Token as PrismToken } from "prismjs"
2+
import type { Token as PrismToken } from "prismjs"
33

44
export type Language = string
55
export type PrismGrammar = Record<string, unknown>

pnpm-lock.yaml

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)