11/* eslint-disable @typescript-eslint/no-var-requires */
22/* eslint-disable react/prop-types */
3- import cx from " classnames" ;
4- import { Playground as ReactPlayground , setup } from " code-kitchen" ;
5- import esbuildWasmMeta from " esbuild-wasm/package.json" ;
6- import monacoEditorMeta from " monaco-editor/package.json" ;
7- import React , { useId } from " react" ;
8- import dependencies from " ./dependencies" ;
9- import { pre } from " ./mdx" ;
10- import { useInitMonaco } from " ./use-init-monaco" ;
3+ import cx from ' classnames' ;
4+ import { Playground as ReactPlayground , setup } from ' code-kitchen' ;
5+ import esbuildWasmMeta from ' esbuild-wasm/package.json' ;
6+ import monacoEditorMeta from ' monaco-editor/package.json' ;
7+ import React , { useId } from ' react' ;
8+ import dependencies from ' ./dependencies' ;
9+ import { pre } from ' ./mdx' ;
10+ import { useInitMonaco } from ' ./use-init-monaco' ;
1111
12- const isProd = process . env . NODE_ENV === " production" ;
12+ const isProd = process . env . NODE_ENV === ' production' ;
1313
1414setup ( {
1515 esbuildWasmPath :
16- ( isProd ? " /code-kitchen" : "" ) +
16+ ( isProd ? ' /code-kitchen' : '' ) +
1717 `/libs/esbuild-wasm/${ esbuildWasmMeta . version } ` ,
1818 monacoEditorPath :
19- ( isProd ? " /code-kitchen" : "" ) +
19+ ( isProd ? ' /code-kitchen' : '' ) +
2020 `/libs/monaco-editor/${ monacoEditorMeta . version } /min`
2121} ) ;
2222
@@ -35,7 +35,7 @@ const customRequire = (key: string) => {
3535 return res ;
3636 }
3737
38- throw new Error ( " DEP: " + key + " not found" ) ;
38+ throw new Error ( ' DEP: ' + key + ' not found' ) ;
3939} ;
4040
4141export const Playground = ( {
@@ -52,7 +52,7 @@ export const Playground = ({
5252 name ?: string ;
5353 className ?: string ;
5454 live ?: boolean ;
55- dir ?: "v" | "h" ;
55+ dir ?: 'v' | 'h' ;
5656} ) => {
5757 const hasMounted = useHasMounted ( ) ;
5858
@@ -67,25 +67,25 @@ export const Playground = ({
6767
6868 const files = codeSnippets
6969 . map ( ( codeSnippet : React . ReactElement , index ) => {
70- if ( codeSnippet . type !== " pre" && codeSnippet . type !== pre ) {
70+ if ( codeSnippet . type !== ' pre' && codeSnippet . type !== pre ) {
7171 return undefined ;
7272 }
7373 const { props } = codeSnippet . props . children ;
74- const lang = props . className . split ( " language-" ) [ 1 ] ;
74+ const lang = props . className . split ( ' language-' ) [ 1 ] ;
7575
76- let filename = "" ; // path in the folder structure
76+ let filename = '' ; // path in the folder structure
7777 let hidden = false ; // if the file is available as a tab
7878
7979 if ( props . metastring ) {
80- const [ _filename , ...params ] = props . metastring . split ( " " ) ;
80+ const [ _filename , ...params ] = props . metastring . split ( ' ' ) ;
8181 filename = _filename ;
82- if ( params . includes ( " hidden" ) ) {
82+ if ( params . includes ( ' hidden' ) ) {
8383 hidden = true ;
8484 }
8585 } else {
8686 // The first file is always entryfile
87- if ( [ "ts" , " tsx" , "js" , " jsx" ] . includes ( lang ) && index === 0 ) {
88- filename = " App.jsx" ;
87+ if ( [ 'ts' , ' tsx' , 'js' , ' jsx' ] . includes ( lang ) && index === 0 ) {
88+ filename = ' App.jsx' ;
8989 } else {
9090 throw new Error (
9191 `Code block is missing a filename: ${ props . children } `
@@ -107,7 +107,7 @@ export const Playground = ({
107107 name = { name }
108108 initialFiles = { files }
109109 require = { customRequire }
110- className = { cx ( className , " my-8 h-[512px] relative" ) }
110+ className = { cx ( className , ' my-8 h-[512px] relative' ) }
111111 live = { live }
112112 dir = { dir }
113113 />
0 commit comments