mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
A modern runtime for JavaScript and TypeScript.
https://deno.com/
9df175e41d
Few improvements to FFI types: 1. Export `PointerObject` for convenience. It's fairly commonly used in library code and thus should be exported. 2. Fix various comments around `PointerValue` and `UnsafePointer` and expand upon them to better reflect reality. 3. Instead of using a `Record<"value", type>[T]` for determining the type of an FFI symbol parameter use direct `T extends "value" ? type : never` comparison. The last part enables smuggling extra information into the parameter and return value string declarations at the type level. eg. Instead of just `"u8"` the parameter can be `"u8" & { [brand]: T }` for some `T extends number`. That `T` can then be extracted from the parameter to form the TypeScript function's parameter or return value type. Essentially, this enables type-safe FFI! The foremost use-cases for this are enums and pointer safety. These are implemented in the second commit which should enable, in a backwards compatible way, for pointer parameters to declare what sort of pointer they mean, functions to declare what the API definition of the native function is, and for numbers to declare what Enum they stand for (if any). |
||
---|---|---|
.cargo | ||
.devcontainer | ||
.github | ||
bench_util | ||
cli | ||
ext | ||
runtime | ||
test_ffi | ||
test_napi | ||
test_util | ||
tools | ||
.dlint.json | ||
.dprint.json | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
.gitmodules | ||
.rustfmt.toml | ||
Cargo.lock | ||
Cargo.toml | ||
LICENSE.md | ||
README.md | ||
Releases.md | ||
rust-toolchain.toml |
Deno
Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.
Features
- Secure by default. No file, network, or environment access, unless explicitly enabled.
- Provides
web platform functionality and APIs,
e.g. using ES modules, web workers, and
fetch()
. - Supports TypeScript out of the box.
- Ships only a single executable file.
- Built-in tooling including
deno test
,deno fmt
,deno bench
, and more. - Includes a set of reviewed standard modules guaranteed to work with Deno.
- Supports npm.
Install
Shell (Mac, Linux):
curl -fsSL https://deno.land/install.sh | sh
PowerShell (Windows):
irm https://deno.land/install.ps1 | iex
Homebrew (Mac):
brew install deno
Chocolatey (Windows):
choco install deno
Scoop (Windows):
scoop install deno
Build and install from source using Cargo:
cargo install deno --locked
See deno_install and releases for other options.
Getting Started
deno run https://deno.land/std/examples/welcome.ts
Or setup a simple HTTP server:
Deno.serve((_req) => new Response("Hello, World!"));
Additional Resources
- The Deno Manual is a great starting point for additional examples, setting up your environment, using npm, and more.
- Runtime API reference documents all APIs built into Deno CLI.
- Deno Standard Modules do not have external dependencies and are reviewed by the Deno core team.
- deno.land/x is the registry for third party modules.
- Blog is where the Deno team shares important product updates and “how to”s about solving technical problems.
Contributing
We appreciate your help!
To contribute, please read our contributing instructions.