Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Import maps #2360

Merged
merged 56 commits into from
Jun 9, 2019
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
958f4e9
RecursiveLoad shouldn't own the Isolate
ry Jun 4, 2019
c34ef21
prototype - implement bare specifier
bartlomieju May 13, 2019
0a24861
simple resolve in import maps
bartlomieju May 14, 2019
f9c2cc0
port tests, and package match
bartlomieju May 15, 2019
09767fd
ImportMap.resolve works for empty map
bartlomieju May 16, 2019
75860c1
remove ParsedSpecifier
bartlomieju May 16, 2019
3d70b88
add TODOs
bartlomieju May 16, 2019
83bb648
fmt
bartlomieju May 16, 2019
73ca1ba
manual JSON parsing
bartlomieju May 16, 2019
895d3a2
more tests
bartlomieju May 16, 2019
0ad1378
remove junk files
bartlomieju May 16, 2019
23567af
lint rust
bartlomieju May 16, 2019
5a4f582
use longest match algo
bartlomieju May 16, 2019
dd8b7ee
preserve reading order
bartlomieju May 16, 2019
8e5d6e5
use IndexMap for import map
bartlomieju May 16, 2019
ba242d6
return Result from ImportMap ops
bartlomieju May 16, 2019
30d2b0c
add CLI flag importmap
bartlomieju May 12, 2019
25e7ca8
read ImportMap from file
bartlomieju May 16, 2019
4342f38
add IndexMap to Cargo.toml
bartlomieju May 17, 2019
2f5ccc9
clippy warning
bartlomieju May 17, 2019
a0d0754
fix tests
bartlomieju May 18, 2019
ca1ee6d
create ImportMap in State
bartlomieju May 18, 2019
fdf3595
scopes parsing
bartlomieju May 18, 2019
5c74807
resolve in scopes, tests
bartlomieju May 18, 2019
010eae7
finish scopes tests
bartlomieju May 19, 2019
8b9019e
reorg tests
bartlomieju May 19, 2019
76e3280
more tests
bartlomieju May 19, 2019
3b65c34
tests for builtin modules
bartlomieju May 19, 2019
0b9980a
remove TODOs
bartlomieju May 19, 2019
532df53
lint comments
bartlomieju May 20, 2019
a722062
flatten tests
bartlomieju May 20, 2019
39e98dd
remove excessive json! macro usage
bartlomieju May 20, 2019
86aa1f9
factor out ImportMap::load
bartlomieju May 20, 2019
93c2a9d
rename methods, doc comments
bartlomieju May 20, 2019
b327da1
fix JSON literals
bartlomieju May 20, 2019
7034c92
remove built-in modules support
bartlomieju May 20, 2019
06bed8a
remove unneeded pub modifier
bartlomieju May 20, 2019
508fe43
try to implement Loader.resolve()
bartlomieju May 20, 2019
492606f
move --importmap under deno run
bartlomieju May 20, 2019
1c15f07
incorporate resolving using import map
bartlomieju Jun 5, 2019
e6e09f9
Update 033_import_map.test
bartlomieju Jun 5, 2019
1a4fb73
resolve using import map in 'op_fetch_module_meta_data'
bartlomieju Jun 6, 2019
d5916e2
Merge branch 'master' into feat-import_maps
bartlomieju Jun 6, 2019
c3348f8
fix after merge
bartlomieju Jun 6, 2019
bdccc48
fix flag parsing
bartlomieju Jun 7, 2019
a296f5c
cleanup debug statements
bartlomieju Jun 7, 2019
145cb26
refactor flags
bartlomieju Jun 7, 2019
da80393
impl ImportMapError for DenoError
bartlomieju Jun 8, 2019
2f79dc4
more complex integration test
bartlomieju Jun 8, 2019
42df29c
fmt
bartlomieju Jun 8, 2019
f19d9c9
update website with import map example
bartlomieju Jun 8, 2019
ee75aca
filenames with underscores
bartlomieju Jun 9, 2019
5e888c6
link to spec and examples of import map in CLI
bartlomieju Jun 9, 2019
cedef8b
add feature to serde_json
bartlomieju Jun 9, 2019
5936767
Merge branch 'master' into feat-import_maps
bartlomieju Jun 9, 2019
bcbc92d
Merge branch 'master' into feat-import_maps
bartlomieju Jun 9, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions website/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -676,6 +677,43 @@ 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.

Example:

```js
// import-map.json
bartlomieju marked this conversation as resolved.
Show resolved Hide resolved

{
"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
Expand Down