@@ -3,13 +3,16 @@ import React from "react";
33import { createRoot } from "react-dom/client" ;
44import { parseCommentAsSandboxOptions } from "./parse-comment-as-sandbox-options" ;
55import { t } from "./localize" ;
6- import { Dependencies , SandpackBundlerFile } from "@codesandbox/sandpack-client/dist/types/types " ;
6+ import type { SandboxInfo } from "@codesandbox/sandpack-client" ;
77
88// Based: SandboxInfo
99export type SandboxOptions = {
1010 files : Record <
1111 string ,
12- SandpackBundlerFile & {
12+ {
13+ code : string ;
14+ readOnly ?: boolean ;
15+ } & {
1316 // prepend code snippet
1417 prependCode ?: string ;
1518 // load the path and fill code with it
@@ -19,13 +22,14 @@ export type SandboxOptions = {
1922 appendCode ?: string ;
2023 }
2124 > ;
22- dependencies ?: Dependencies ;
23- devDependencies ?: Dependencies ;
25+ dependencies ?: SandboxInfo [ "dependencies" ] ;
26+ devDependencies ?: SandboxInfo [ "devDependencies" ] ;
2427 entry ?: string ;
2528 /**
2629 * What template we use, if not defined we infer the template from the dependencies or files.
2730 */
2831 template ?: string ;
32+ options ?: Record < string , any > ; // Refer SandpackInternalProps
2933 honkitSettings ?: {
3034 isOpen : boolean ; // false by default
3135 hideExitButton : boolean ; // false by default
@@ -109,6 +113,8 @@ export const attachToElement = (element: HTMLElement | ChildNode, options: Sandb
109113 environment : "parcel"
110114 } ;
111115 const entry = options . entry ;
116+ const sandpackOptions = options . options ;
117+ console . log ( { sandpackOptions } ) ;
112118 const template = ( options . template ?? "vanilla" ) as SandpackPredefinedTemplate ;
113119 currentRoot . render (
114120 < Sandpack
@@ -117,7 +123,8 @@ export const attachToElement = (element: HTMLElement | ChildNode, options: Sandb
117123 options = { {
118124 startRoute : entry ,
119125 skipEval : false ,
120- autorun : true
126+ autorun : true ,
127+ ...sandpackOptions
121128 } }
122129 template = { template }
123130 />
0 commit comments