2021-01-11 12:13:41 -05:00
|
|
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
2020-08-07 10:55:02 -04:00
|
|
|
|
2020-09-06 15:44:29 -04:00
|
|
|
use deno_core::JsRuntime;
|
2020-09-30 10:51:01 -04:00
|
|
|
use std::path::PathBuf;
|
2020-08-07 10:55:02 -04:00
|
|
|
|
2020-09-30 10:51:01 -04:00
|
|
|
/// Load and execute the javascript code.
|
2020-09-06 15:44:29 -04:00
|
|
|
pub fn init(isolate: &mut JsRuntime) {
|
2020-09-01 16:32:07 -04:00
|
|
|
let files = vec![
|
2021-04-08 09:05:08 -04:00
|
|
|
(
|
|
|
|
"deno:op_crates/web/00_infra.js",
|
|
|
|
include_str!("00_infra.js"),
|
|
|
|
),
|
2020-09-30 10:51:01 -04:00
|
|
|
(
|
2021-02-13 09:58:12 -05:00
|
|
|
"deno:op_crates/web/01_dom_exception.js",
|
|
|
|
include_str!("01_dom_exception.js"),
|
2020-09-30 10:51:01 -04:00
|
|
|
),
|
2021-04-08 09:05:08 -04:00
|
|
|
(
|
|
|
|
"deno:op_crates/web/01_mimesniff.js",
|
|
|
|
include_str!("01_mimesniff.js"),
|
|
|
|
),
|
2020-09-30 10:51:01 -04:00
|
|
|
(
|
2021-02-13 09:58:12 -05:00
|
|
|
"deno:op_crates/web/02_event.js",
|
|
|
|
include_str!("02_event.js"),
|
2020-09-30 10:51:01 -04:00
|
|
|
),
|
2020-10-20 00:05:42 -04:00
|
|
|
(
|
2021-02-13 09:58:12 -05:00
|
|
|
"deno:op_crates/web/03_abort_signal.js",
|
|
|
|
include_str!("03_abort_signal.js"),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"deno:op_crates/web/04_global_interfaces.js",
|
|
|
|
include_str!("04_global_interfaces.js"),
|
2020-10-20 00:05:42 -04:00
|
|
|
),
|
2020-09-30 10:51:01 -04:00
|
|
|
(
|
|
|
|
"deno:op_crates/web/08_text_encoding.js",
|
|
|
|
include_str!("08_text_encoding.js"),
|
|
|
|
),
|
2021-01-07 13:06:08 -05:00
|
|
|
(
|
|
|
|
"deno:op_crates/web/12_location.js",
|
|
|
|
include_str!("12_location.js"),
|
|
|
|
),
|
2020-09-01 16:32:07 -04:00
|
|
|
];
|
2020-09-30 10:51:01 -04:00
|
|
|
for (url, source_code) in files {
|
|
|
|
isolate.execute(url, source_code).unwrap();
|
2020-09-01 16:32:07 -04:00
|
|
|
}
|
2020-08-07 10:55:02 -04:00
|
|
|
}
|
|
|
|
|
2020-09-01 16:32:07 -04:00
|
|
|
pub fn get_declaration() -> PathBuf {
|
2020-09-09 08:23:57 -04:00
|
|
|
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_web.d.ts")
|
2020-08-07 10:55:02 -04:00
|
|
|
}
|