Skip to content

Commit

Permalink
v116
Browse files Browse the repository at this point in the history
  • Loading branch information
ije committed Apr 18, 2023
1 parent cffa844 commit 2558673
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change Log

## v116

- Support modules/assets from Github repo (close #588)
- Update `nativeNodePackages` (close #591)
- Fix dep import url of cjs module (close #592)
- Add support of resolving `typesVersions` (close #593)
- Fix `exports` glob condition resloving (close #594)
- Remove shebang (close #596)
- Fix missed build version of dts files (close #589)

## v115

- Return JavaScript modules for `?module` query with `wasm` files
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RUN apt-get update -y && apt-get install -y xz-utils
RUN useradd -u 1000 -m esm
RUN mkdir /esm && chown esm:esm /esm
RUN git clone https://github.com/esm-dev/esm.sh /esm/esm.sh
RUN git checkout v115
RUN git checkout v116

USER esm
WORKDIR /esm
Expand Down
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

# esm.sh

A fast, global content delivery network for [NPM](http://npmjs.org/) packages with **ES Module** format.
A fast, global content delivery network (CDN) for modern(es2015+) web development.

## Import from URL
<p>
<a href="https://discord.gg/Xkn239au"><img src="https://img.shields.io/discord/1097820016893763684?color=%23008181&label=Chat&labelColor=%23111&logo=discord&logoColor=%23aaaaaa" alt="Chat"></a>
<a href="https://twitter.com/intent/follow?screen_name=jexia_"><img src="https://img.shields.io/twitter/follow/jexia_?style=social" alt="Twitter"></a>
</p>

## Import from NPM

```javascript
import React from "https://esm.sh/[email protected]"
Expand All @@ -30,6 +35,16 @@ or import non-module(js) as following:
import "https://esm.sh/[email protected]/package.json" assert { type: "json" }
```

## Import from GitHub Repo

You can also import modules/assets from a github repo: `esm.sh/gh/OWNER/REPO/PATH`

```javascript
import sfMeta from "https:/esms.h/gh/superfluid-finance/metadata"
```

or load a svg image from a github repo: https://esm.sh/gh/microsoft/fluentui-emoji/assets/Alien/Flat/alien_flat.svg

### Specify Dependencies

By default, esm.sh rewrites import specifiers based on the package dependencies. To specify the version of these dependencies, you can add the `?deps=PACKAGE@VERSION` query. To specify multiple dependencies, separate them with a comma, like this: `[email protected],[email protected]`.
Expand Down Expand Up @@ -71,8 +86,8 @@ Import maps supports [**trailing slash**](https://github.com/WICG/import-maps#pa
```json
{
"imports": {
"react-dom": "https://esm.sh/[email protected]?pin=v115&dev",
"react-dom/": "https://esm.sh/[email protected]&pin=v115&dev/",
"react-dom": "https://esm.sh/[email protected]?pin=v116&dev",
"react-dom/": "https://esm.sh/[email protected]&pin=v116&dev/",
}
}
```
Expand Down Expand Up @@ -256,9 +271,9 @@ To ensure stable and consistent behavior, you may want to pin the build version
The `?pin` query allows you to specify a specific build version of a module, which is an **immutable** cached version stored on the esm.sh CDN.

```javascript
import React from "https://esm.sh/react-dom?pin=v115"
import React from "https://esm.sh/react-dom?pin=v116"
// or use version prefix
import React from "https://esm.sh/v115/react-dom"
import React from "https://esm.sh/v116/react-dom"
```

By using the `?pin` query in the import statement, you can rest assured that the version of the module you're using will not change, even if updates are pushed to the esm.sh server. This helps ensure the stability and reliability of your application.
Expand Down
2 changes: 1 addition & 1 deletion server/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package server

const (
// esm.sh build version
VERSION = 115
VERSION = 116
// esm.sh stable build version, used for UI libraries like react, to make sure the runtime is single copy
// change this carefully
STABLE_VERSION = 112
Expand Down

0 comments on commit 2558673

Please sign in to comment.