if the filename doesn't end with ".wasm"
TypeScript
Section titled “TypeScript”JSTime natively supports TypeScript out of the box. All files are transpiled on the fly by JSTime’s fast native transpiler before being executed. Similar to other build tools, JSTime does not perform typechecking; it simply removes type annotations from the file.
$ jstime index.js$ jstime index.jsx$ jstime index.ts$ jstime index.tsxSome aspects of JSTime’s runtime behavior are affected by the contents of your tsconfig.json file. Refer to Runtime > TypeScript page for details.
JSTime supports .jsx and .tsx files out of the box. JSTime’s internal transpiler converts JSX syntax into vanilla JavaScript before execution.
function Component(props: {message: string}) { return ( <body> <h1 style={{color: 'red'}}>{props.message}</h1> </body> );}
console.log();JSTime implements special logging for JSX to make debugging easier.
$ jstime run react.tsxText files
Section titled “Text files”Text files can be imported as strings.
import text from "./text.txt";console.log(text);// => "Hello world!"Hello world!JSON and TOML
Section titled “JSON and TOML”JSON and TOML files can be directly imported from a source file. The contents will be loaded and returned as a JavaScript object.
import pkg from "./package.json";import data from "./data.toml";🚧 Experimental
JSTime has experimental support for WASI, the WebAssembly System Interface. To run a .wasm binary with JSTime:
$ jstime ./my-wasm-app.wasm# if the filename doesn't end with ".wasm"$ jstime run ./my-wasm-app.whateverNote — WASI support is based on wasi-js. Currently, it only supports WASI binaries that use the wasi_snapshot_preview1 or wasi_unstable APIs. JSTime’s implementation is not fully optimized for performance; this will become more of a priority as WASM grows in popularity.