File tree 4 files changed +47
-0
lines changed
deno_facade/module_loader
4 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "workspace" : [],
3
+ "imports" : {
4
+ "postgres" : " npm:postgres@^3.4.5"
5
+ }
6
+ }
Original file line number Diff line number Diff line change
1
+ import postgres from "postgres" ;
2
+
3
+ const sql = postgres ( { /* options */ } ) ;
4
+ console . log ( sql ) ;
5
+
6
+ export default {
7
+ fetch ( ) {
8
+ return new Response ( null ) ;
9
+ } ,
10
+ } ;
Original file line number Diff line number Diff line change @@ -2349,6 +2349,23 @@ async fn test_issue_456() {
2349
2349
tb. exit ( Duration :: from_secs ( TESTBED_DEADLINE_SEC ) ) . await ;
2350
2350
}
2351
2351
2352
+ #[ tokio:: test]
2353
+ #[ serial]
2354
+ async fn test_issue_513 ( ) {
2355
+ let tb = TestBedBuilder :: new ( "./test_cases/main" ) . build ( ) . await ;
2356
+ let resp = tb
2357
+ . request ( |b| {
2358
+ b. uri ( "/issue-513" )
2359
+ . body ( Body :: empty ( ) )
2360
+ . context ( "can't make request" )
2361
+ } )
2362
+ . await
2363
+ . unwrap ( ) ;
2364
+
2365
+ assert_eq ! ( resp. status( ) . as_u16( ) , StatusCode :: OK ) ;
2366
+ tb. exit ( Duration :: from_secs ( TESTBED_DEADLINE_SEC ) ) . await ;
2367
+ }
2368
+
2352
2369
#[ tokio:: test]
2353
2370
#[ serial]
2354
2371
async fn test_supabase_issue_29583 ( ) {
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ use eszip::deno_graph;
69
69
use eszip:: EszipRelativeFileBaseUrl ;
70
70
use eszip:: ModuleKind ;
71
71
use eszip_trait:: AsyncEszipDataRead ;
72
+ use ext_node:: create_host_defined_options;
72
73
use ext_node:: DenoFsNodeResolverEnv ;
73
74
use ext_node:: NodeExtInitServices ;
74
75
use ext_node:: NodeRequireLoader ;
@@ -302,6 +303,19 @@ impl ModuleLoader for EmbeddedModuleLoader {
302
303
}
303
304
}
304
305
306
+ fn get_host_defined_options < ' s > (
307
+ & self ,
308
+ scope : & mut deno_core:: v8:: HandleScope < ' s > ,
309
+ name : & str ,
310
+ ) -> Option < deno_core:: v8:: Local < ' s , deno_core:: v8:: Data > > {
311
+ let name = deno_core:: ModuleSpecifier :: parse ( name) . ok ( ) ?;
312
+ if self . shared . node_resolver . in_npm_package ( & name) {
313
+ Some ( create_host_defined_options ( scope) )
314
+ } else {
315
+ None
316
+ }
317
+ }
318
+
305
319
#[ instrument( level = "debug" , skip_all, fields( specifier = original_specifier. as_str( ) ) ) ]
306
320
fn load (
307
321
& self ,
You can’t perform that action at this time.
0 commit comments