Releases: esm-dev/esm.sh
v125
esm.sh v125 has been deployed to the edge(earth), includes some bugfixs and promoted denonext
target for Deno >= 1.33.2 that uses node:
specifier for the node compatibility layer.
v124
v123
In v123, we added a server module for Deno runtime that allows you to serve esm.sh locally with command deno run -A https://esm.sh/server
, zero config and no code need! π¦
Or build your deno app with esm.sh server:
// server.js
import { serve } from "https://esm.sh/v123/server";
β
serve((req) => {
const url = new URL(req.url);
β
// your routes override esm.sh routes
if (url.pathname === "/") {
// using a custom homepage
return new Response("<h1>Welcome to use esm.sh!</h1>", {
headers: { "Content-Type": "text/html" },
});
}
});
// $ deno run -A -r server.js
Warning: currently the server doesn't work with Deno Deploy, we are working on it.
Changelog:
- Add
/server
endpoint for Deno to serve esm.sh locally - Add scope to config (#636 by @johnpangalos)
- Fix
.d.ts
walker (close #640) - Fix packages with
v
prefix inversion
(close #639) - Fix
findFiles
function (close #638)
v122
esm.sh v122 has been deployed to the edge(earth), includes some bugfixs and worker improvement:
- Use stable imports order in cjs modules
We used
map
data structure of Golang to mark requires(imports) in a cjs moudle before v122,
it creates import exprs in random order, that may break the loop imports. - Support more asset extension names
- esm-worker: Use
X-Real-Origin
andX-Esm-Worker-Version
headers - Fix worker
CORS
issue (close #631) - Fix sub-module resolving (close #633)
- Fix undefined content-type header (close #635)
v121
esm.sh v121 includes some bug fix patches:
v120
In v120, we open-sourced the Cloudflare worker that reveals how we handle 10M requests pre day at edge(earth). You can use it to build your own fast CDN easily:
import worker from "esm-worker";
export default worker((req, ctx) => {
// your routes override esm.sh routes
if (ctx.url.pathname === "/") {
return new Response("<h1>Welcome to use esm.sh!</h1>", {
headers: { "content-type": "text/html" },
});
}
})
More details please check esm-worker.
We improved the build API allows you to add types
for your modules, it's useful for types checking and lsp completion:
import { build } from "https://esm.sh/build"
const { url } = await build({
dependencies: {
preact: "^10.13.2",
},
code: `
export { h } from "preact";
`,
types: `
export { h } from "preact"
`,
})
Changelog:
- build-api: Support
types
option - Open-source the cloudflare worker
- Support
HEAD
method - Use empty object instead of
null
for browser exclude (close #613) - Add
zlib-sync
to nativeNodePackages (close #621) - Fix bare path for css/custom build
- Fixing type only packages missing the
X-Typescript-Types
header - cjs-lexer: Fix
exports
resloving - Redirect invalid
*.json
url
v119
v118
in v118, we added an experimental API that allows you to build a module with custom input(code).
import build, { esm } from "https://esm.sh/build"
const ret = await esm`
/* @jsx h */
import { h } from "[email protected]";
import { renderToString } from "[email protected]";
export default () => renderToString(<h1>Hello world!</h1>);
`
// use `build` function
const ret = await build({
dependencies: {
"preact": "^10.13.2",
"preact-render-to-string": "^6.0.2"
},
code: `
/* @jsx h */
import { h } from "preact";
import { renderToString } from "preact-render-to-string";
export default () => renderToString(<h1>Hello world!</h1>);
`
})
const { default: render } = await import(ret.url)
render() // "<h1>Hello world!</h1>"
// use bundled module
const { default: render } = await import(ret.bundleUrl)
Changelog:
v117
v116
In v116, we added new feature to allow you to import modules or load assert from a Github repo: /gh/OWNER/REPO/PATH
. For example:
// ensure there is a `package.json` in the root of the repo
import tslib from "https://esm.sh/gh/microsoft/tslib"
load a svg image via https://esm.sh/gh/microsoft/fluentui-emoji/assets/Party popper/Color/party_popper_color.svg
This also fix some packages with dependency like git+http://github.com/microsoft/tslib
For Deno users, we fixed some missed/incorrect dts by respecting the typesVersions
field of package.json.
Changelog:
- 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)