Skip to content

Releases: esm-dev/esm.sh

v125

07 Jun 08:48
@ije ije
Compare
Choose a tag to compare

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.

  • Fix node-fetch import in cjs modules (close #649)
  • Add node:worker_threads polyfill(fake) (close #648)
  • Use denonext target for Deno >= 1.33.2 (close #646)
  • Fix .json.js path (close #645)
  • Fix cache missing content (close #641)
  • Upgrade deno/std to 0.177.1

v124

23 May 09:07
@ije ije
Compare
Choose a tag to compare

Just applied a fix patch for the broken dts walker.

v123

22 May 09:50
@ije ije
Compare
Choose a tag to compare

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! πŸ¦•

Syntax Highlighter-1

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 in version (close #639)
  • Fix findFiles function (close #638)

v122

17 May 09:28
@ije ije
Compare
Choose a tag to compare

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 and X-Esm-Worker-Version headers
  • Fix worker CORS issue (close #631)
  • Fix sub-module resolving (close #633)
  • Fix undefined content-type header (close #635)

v121

15 May 07:10
@ije ije
Compare
Choose a tag to compare

esm.sh v121 includes some bug fix patches:

  • Use browser field for package main if possible
    {
      "name": "pkg",
      "version": "1.0.0",
      "main": "./index.js",
      "browser": {
        "./index.js": "./browser.js"
      }
    }
  • Fix redirects for ?css and GET /build
  • Fix *.js.js module path (close #627)
  • Fix cjs imports (close #629, #626)
  • Add pako to the requireModeAllowList

v120

10 May 12:29
@ije ije
Compare
Choose a tag to compare

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

03 May 11:08
@ije ije
Compare
Choose a tag to compare

esm.sh v119 mainly includes some bug fixes and esbuild upgrading:

  • Fix missed x-typescript-types header for types only packages
  • Fix named import of cjs (close #620)
  • Use STABKE_VERSION for dts build of stableBuild
  • Upgrade esbuild to 0.17.18

v118

03 May 11:07
@ije ije
Compare
Choose a tag to compare

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:

  • feat: add custom build api (#607)
  • esm-cjs-lexer: Support __export(require("...")) pattern (close #611)
  • Add Auth middleware
  • Upgrade stableBuild to v118
  • Remove lit from stableBuild
  • Fix submodule types (close #606)
  • Fix arch for darwin arm64 (#617 by @JLugagne)

v117

21 Apr 14:49
@ije ije
Compare
Choose a tag to compare

esm.sh v117 mainly includes some bug fixes :

  • Fix Buffer ployfill for deno (close #574)
  • Fix dts transformer with submodule (close #599)
  • Fix importing .json as a module (close #601)
  • Fix .wasm module importing (close #602)
  • Fix path /v100/PKG/TARGET/index.js

v116

18 Apr 13:23
@ije ije
Compare
Choose a tag to compare

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)