refactor: internal runtime code TS support (#17672)

This is a proof of concept for being able to snapshot TypeScript files.

Currently only a single runtime file is authored in TypeScript -
"runtime/js/01_version.ts".

Not needed infrastructure was removed from "core/snapshot_util.rs".

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
Leo Kettmeir 2023-02-08 22:40:18 +01:00 committed by GitHub
parent bef50416b9
commit 286e5d0be9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 261 additions and 113 deletions

View file

@ -2,7 +2,6 @@
use deno_core::Snapshot;
use log::debug;
use once_cell::sync::Lazy;
use std::path::PathBuf;
pub static RUNTIME_SNAPSHOT: Lazy<Box<[u8]>> = Lazy::new(
#[allow(clippy::uninit_vec)]
@ -35,8 +34,5 @@ pub fn deno_isolate_init() -> Snapshot {
Snapshot::Static(&RUNTIME_SNAPSHOT)
}
pub fn get_99_main() -> PathBuf {
let manifest = env!("CARGO_MANIFEST_DIR");
let path = PathBuf::from(manifest);
path.join("js").join("99_main.js")
}
#[cfg(feature = "snapshot_from_snapshot")]
pub static SOURCE_CODE_FOR_99_MAIN_JS: &str = include_str!("js/99_main.js");