File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,4 +16,4 @@ tsconfig.json
1616# end managed by sku
1717
1818dist-storybook /
19- src /private /Prism.cjs
19+ src /private /Prism.ts
Original file line number Diff line number Diff line change @@ -12,5 +12,5 @@ tsconfig.json
1212# end managed by sku
1313
1414dist-storybook /
15- src /Private /Prism.cjs
15+ src /Private /Prism.ts
1616lib /
Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ import fs from 'node:fs/promises';
22import path from 'node:path' ;
33import { fileURLToPath } from 'node:url' ;
44
5- const header = `const { Prism, themes } = require('prism-react-renderer'); /* eslint-disable */` ;
6- const footer = `module.exports = { Prism, themes };` ;
5+ const header = `// @ts-nocheck
6+ import { Prism, themes } from 'prism-react-renderer';
7+ const prismInstance = Prism; /* eslint-disable */` ;
8+ const footer = `export { prismInstance as Prism, themes };` ;
79
810// Also see src/private/prismUtils.ts for language names
911const languages = [
@@ -27,13 +29,13 @@ const languageDefinitions = await Promise.all(
2729 ) ,
2830 'utf8' ,
2931 ) ;
30- return `// Language: ${ language } \n\n${ definition } \n\n` ;
32+ return `// Language: ${ language } \n\n(function(Prism) {\n ${ definition } \n})(prismInstance); \n\n` ;
3133 } ) ,
3234) ;
3335
3436const content = [ header , ...languageDefinitions , footer ] . join ( '\n' ) ;
3537
3638await fs . writeFile (
37- path . join ( import . meta. dirname , 'src/private/Prism.cjs ' ) ,
39+ path . join ( import . meta. dirname , 'src/private/Prism.ts ' ) ,
3840 content ,
3941) ;
Original file line number Diff line number Diff line change 11import { Box , Stack } from 'braid-design-system' ;
22import { Highlight , type Token } from 'prism-react-renderer' ;
33
4- import { Prism } from '../private/Prism.cjs ' ;
4+ import { Prism } from '../private/Prism' ;
55import { codeThemes } from '../private/codeThemes' ;
66
77import { useCodeTheme } from './CodeThemeProvider' ;
You can’t perform that action at this time.
0 commit comments