@@ -339,11 +339,20 @@ function validateCompatibilityDate(log: Log, compatibilityDate: string) {
339339 return compatibilityDate ;
340340}
341341
342- function buildJsonBindings ( bindings : Record < string , Json > ) : Worker_Binding [ ] {
343- return Object . entries ( bindings ) . map ( ( [ name , value ] ) => ( {
344- name,
345- json : JSON . stringify ( value ) ,
346- } ) ) ;
342+ function buildBindings ( bindings : Record < string , Json > ) : Worker_Binding [ ] {
343+ return Object . entries ( bindings ) . map ( ( [ name , value ] ) => {
344+ if ( typeof value === "string" ) {
345+ return {
346+ name,
347+ text : value ,
348+ } ;
349+ } else {
350+ return {
351+ name,
352+ json : JSON . stringify ( value ) ,
353+ } ;
354+ }
355+ } ) ;
347356}
348357
349358const WRAPPED_MODULE_PREFIX = "miniflare-internal:wrapped:" ;
@@ -368,7 +377,7 @@ export const CORE_PLUGIN: Plugin<
368377 const bindings : Awaitable < Worker_Binding > [ ] = [ ] ;
369378
370379 if ( options . bindings !== undefined ) {
371- bindings . push ( ...buildJsonBindings ( options . bindings ) ) ;
380+ bindings . push ( ...buildBindings ( options . bindings ) ) ;
372381 }
373382 if ( options . wasmBindings !== undefined ) {
374383 bindings . push (
@@ -424,7 +433,7 @@ export const CORE_PLUGIN: Plugin<
424433 // Build binding
425434 const moduleName = workerNameToWrappedModule ( scriptName ) ;
426435 const innerBindings =
427- bindings === undefined ? [ ] : buildJsonBindings ( bindings ) ;
436+ bindings === undefined ? [ ] : buildBindings ( bindings ) ;
428437 // `scriptName`'s bindings will be added to `innerBindings` when
429438 // assembling the config
430439 return {
0 commit comments