Any import where the beginning portion (up to the first slash) of the
URL does not contain a . is considered a namespaced import.
A namespaced import means that the IMPORT_SERVER (which defaults to
https://import.sh) is prepended to the import URL. For example, these
two import invocations are identical:
import "assert"import "https://import.sh/assert"Let's take a look at importing this [tootallnate/hello][hello] "Hello World" import from GitHub:
import.sh serverThe default IMPORT_SERVER is https://import.sh, which serves GitHub
repositories that are "import-compatible", according to the following
conventions:
import <org>/<repo>.sh suffix/ in the import path, then the default org ([importpw][]) is applied@<version> to the endThe [importpw][] GitHub organization houses the top-level namespace imports.
A top-level import happens when there is no / in the import path.
For example, the assert module includes functions that write simple unit
testing scripts:
Here are some useful top-level imports:
See the [importpw][] org on GitHub for the complete listing of repositories.
Here are some GitHub repositories that are known to be compatible with import:
(Send a pull request if you would like to have an import listed here)
#!/usr/bin/env importimport "tootallnate/hello"
hello# Hello, from @TooTallNate!#!/usr/bin/env importimport "assert"
assert 1 = 2# assertion failed: 1 = 2