summaryrefslogtreecommitdiff
path: root/runtime/js/01_version.ts
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2023-02-08 22:40:18 +0100
committerGitHub <noreply@github.com>2023-02-08 22:40:18 +0100
commit286e5d0be9bb11a69d55f0eedd4a6678b0d48e7d (patch)
tree37399e924de155fbcbeab975222bdb16f257e228 /runtime/js/01_version.ts
parentbef50416b92a3ed7bf44b361fc5360f9a52c83e6 (diff)
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>
Diffstat (limited to 'runtime/js/01_version.ts')
-rw-r--r--runtime/js/01_version.ts30
1 files changed, 30 insertions, 0 deletions
diff --git a/runtime/js/01_version.ts b/runtime/js/01_version.ts
new file mode 100644
index 000000000..cbbbd8d03
--- /dev/null
+++ b/runtime/js/01_version.ts
@@ -0,0 +1,30 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+
+const primordials = globalThis.__bootstrap.primordials;
+const { ObjectFreeze } = primordials;
+
+interface Version {
+ deno: string;
+ v8: string;
+ typescript: string;
+}
+
+const version: Version = {
+ deno: "",
+ v8: "",
+ typescript: "",
+};
+
+function setVersions(
+ denoVersion,
+ v8Version,
+ tsVersion,
+) {
+ version.deno = denoVersion;
+ version.v8 = v8Version;
+ version.typescript = tsVersion;
+
+ ObjectFreeze(version);
+}
+
+export { setVersions, version };