diff options
| author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2019-06-09 15:08:20 +0200 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-06-09 09:08:20 -0400 |
| commit | a115340288d974f141cceb16faac71914402c445 (patch) | |
| tree | 80353d2579e6d6dc9febd449f1f779ffa62c8397 /website | |
| parent | 8ec5276d30dac59ced0ca7e35e07e20644ee2188 (diff) | |
feat: Import maps (#2360)
Diffstat (limited to 'website')
| -rw-r--r-- | website/manual.md | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/website/manual.md b/website/manual.md index 08ac60ab7..684d44c2e 100644 --- a/website/manual.md +++ b/website/manual.md @@ -634,6 +634,7 @@ OPTIONS: --allow-read=<allow-read> Allow file system read access --allow-write=<allow-write> Allow file system write access -c, --config <FILE> Load compiler configuration file + --importmap <FILE> Load import map file --v8-flags=<v8-flags> Set V8 command line options SUBCOMMANDS: @@ -676,6 +677,50 @@ Particularly useful ones: --async-stack-trace ``` +## Import maps + +Deno supports [import maps](https://github.com/WICG/import-maps). + +One can use import map with `--importmap=<FILE>` CLI flag. + +Current limitations: + +- single import map +- no fallback URLs +- Deno does not support `std:` namespace +- Does supports only `file:`, `http:` and `https:` schemes + +Example: + +```js +// import_map.json + +{ + "imports": { + "http/": "https://deno.land/std/http/" + } +} +``` + +```ts +// hello_server.ts + +import { serve } from "http/server.ts"; + +async function main() { + const body = new TextEncoder().encode("Hello World\n"); + for await (const req of serve(":8000")) { + req.respond({ body }); + } +} + +main(); +``` + +```bash +$ deno run --importmap=import_map.json hello_server.ts +``` + ## Internal details ### Deno and Linux analogy |
