deno.land / x / deno_module_playground@0.7 / f_import_from_local_scope.module.js

f_import_from_local_scope.module.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { f_a_o_url_stack_trace } from "./f_a_o_url_stack_trace.module.js"
var f_import_from_local_scope = async function(){ f_import_from_file_url("./o_config.module.js");}var f_import_from_file_url = async function(s_path_relative){ var s_import_meta_url = import.meta.url; var s_import_meta_url_path_to_folder = s_import_meta_url.split("/").slice(0,-1).join("/") var s_import_meta_url_path_to_relative_file = s_import_meta_url_path_to_folder + s_path_relative; // var a_o_url_stack_trace = f_a_o_url_stack_trace(); var o_url = a_o_url_stack_trace.slice(-1)[0]; var s_fileurl_path = o_url.o_URL.href; var s_fileurl_path_to_folder = s_fileurl_path.split("/").slice(0,-1).join("/") var s_fileurl_path_to_relative_file = s_fileurl_path_to_folder + s_path_relative;
try{ var o_stat = Deno.stat(s_fileurl_path_to_relative_file) }catch{ var s_response = await fetch(s_import_meta_url_path_to_relative_file); await Deno.writeTextFile(s_response.body, s_fileurl_path_to_relative_file); console.log(`${s_fileurl_path_to_relative_file}: file not existing yet, has been downloaded`) }
var o = await import(s_fileurl_path_to_relative_file);}

export {f_import_from_local_scope}
deno_module_playground

Version Info

Tagged at
2 years ago

External Dependencies

2 external dependencies