Skip to content

Commit

Permalink
Merge pull request #169 from lambtron/main
Browse files Browse the repository at this point in the history
Add JSR in import docs
  • Loading branch information
stevekrouse authored Jun 19, 2024
2 parents a585f23 + cf66fcf commit 432296e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/content/docs/reference/import.mdx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
title: Importing
description: Import code from vals, NPM, and URLs
lastUpdated: 2024-03-18
description: Import code from vals, NPM, JSR, and URLs
lastUpdated: 2024-06-19
---

One of the best features of Val Town is the ability to import modules. There are thousands
of modules written in JavaScript and TypeScript that you can instantly
import to extend and supercharge your vals.

Val Town supports importing code from a variety of sources, including other vals on Val Town,
[NPM](https://www.npmjs.com/), [esm.sh](https://esm.sh/), [deno.land](https://deno.land/x).
[NPM](https://www.npmjs.com/), [JSR](https://jsr.io), [esm.sh](https://esm.sh/), [deno.land](https://deno.land/x).
You can also import code from arbitrary URLs if they provide the correct `Content-Type` header
and contain JavaScript or TypeScript.
Imports in Val Town work the same as in Deno, so you can [learn more from their docs](https://docs.deno.com/runtime/manual/basics/modules/).
Expand Down Expand Up @@ -51,6 +51,14 @@ information.

:::

## JSR

Val Town supports importing [JSR](https://jsr.io) modules. Simply add `jsr:` and `@` in front of the module name:

```ts
import { concat } from "jsr:@std/bytes";
```

## HTTP Imports

To import from a URL, like from `esm.sh`, you just specify the full url. For
Expand Down

0 comments on commit 432296e

Please sign in to comment.