1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00
denoland-deno/docs/introduction.md

74 lines
2.6 KiB
Markdown
Raw Normal View History

2020-05-06 18:21:13 -04:00
# Introduction
Deno is a JavaScript/TypeScript runtime with secure defaults and a great
developer experience.
It's built on V8, Rust, and Tokio.
## Feature highlights
2020-05-06 18:21:13 -04:00
- Secure by default. No file, network, or environment access (unless explicitly
enabled).
- Supports TypeScript out of the box.
- Ships a single executable (`deno`).
- Has built-in utilities like a dependency inspector (`deno info`) and a code
formatter (`deno fmt`).
- Has
[a set of reviewed (audited) standard
2021-02-11 14:14:23 -05:00
modules](https://github.com/denoland/deno_std) that are guaranteed to work
with Deno.
- Can bundle scripts into a single JavaScript file.
2020-05-06 18:21:13 -04:00
## Philosophy
Deno aims to be a productive and secure scripting environment for the modern
programmer.
Deno will always be distributed as a single executable. Given a URL to a Deno
program, it is runnable with nothing more than
2021-03-05 06:22:28 -05:00
[the ~25 megabyte zipped executable](https://github.com/denoland/deno/releases).
2020-05-06 18:21:13 -04:00
Deno explicitly takes on the role of both runtime and package manager. It uses a
standard browser-compatible protocol for loading modules: URLs.
Among other things, Deno is a great replacement for utility scripts that may
have been historically written with Bash or Python.
2020-05-06 18:21:13 -04:00
## Goals
- Ship as just a single executable (`deno`).
- Provide secure defaults.
2020-05-06 18:21:13 -04:00
- Unless specifically allowed, scripts can't access files, the environment, or
the network.
- Be browser-compatible.
- The subset of Deno programs which are written completely in JavaScript and
do not use the global `Deno` namespace (or feature test for it), ought to
also be able to be run in a modern web browser without change.
- Provide built-in tooling to improve developer experience.
- E.g. unit testing, code formatting, and linting.
- Keep V8 concepts out of user land.
- Serve HTTP efficiently.
2020-05-06 18:21:13 -04:00
## Comparison to Node.js
- Deno does not use `npm`.
- It uses modules referenced as URLs or file paths.
2020-05-06 18:21:13 -04:00
- Deno does not use `package.json` in its module resolution algorithm.
- All async actions in Deno return a promise. Thus Deno provides different APIs
than Node.
- Deno requires explicit permissions for file, network, and environment access.
- Deno always dies on uncaught errors.
- Deno uses "ES Modules" and does not support `require()`. Third party modules
are imported via URLs:
2020-05-06 18:21:13 -04:00
```javascript
import * as log from "https://deno.land/std@$STD_VERSION/log/mod.ts";
2020-05-06 18:21:13 -04:00
```
## Other key behaviors
- Fetch and cache remote code upon first execution, and never update it until
2020-05-06 18:21:13 -04:00
the code is run with the `--reload` flag. (So, this will still work on an
airplane.)
- Modules/files loaded from remote URLs are intended to be immutable and
cacheable.