Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Support the /+esm endpoint on jsDelivr packages

オープン
#798 コメント 1 件 リアクション 4 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp, javascript, rollup

調査の方向性

No files or tests are named. Start by locating LibMan's provider parsing and jsDelivr download handling, then review how library and file paths are resolved. Done means an agreed /+esm form can fetch package and individual-file ESM endpoints with coverage for the supported syntax.

索引モデルが issue の本文から書いたものです。

説明

Is your feature request related to a problem? Please describe.

Some libraries available through jsDelivr have no default JS file specified by the package author. Libraries packaged for NPM are often meant to be included as CJS modules, with the expectation that the developer will use a tool like webpack or Rollup.js to prepare the code to run client-side. On jsDelivr packages sometimes have this disclaimer under the "install" code snippet:

No default JS file set by the package author so the URL is guessed. You can always browse all package files to use another one.

Luckily jsDelivr provides a more reliable option - fetching the library as an ES module, as illustrated in this example:

<script type="module">
    import coreJs from 'https://cdn.jsdelivr.net/npm/core-js@3.45.0/+esm'
</script>

jsDelivr uses Rollup.js to generate the ESM version of the package and exposes the result when it sees /+esm appended to the URL. This is a very helpful feature provided by the CDN, but as far as I can tell there is currently no way to leverage this feature with LibMan.

Describe the solution you'd like

It would be a nice convenience if there was some way to tell LibMan to fetch pre-bundled libraries from jsDelivr. I think the simplest syntax for this would be:

    {
      "provider": "jsdelivr/esm",
      "library": "core-js@3.45.0",
      "destination": "wwwroot/lib/core-js/index.mjs"
    }

The file name, [library name]/index.mjs, could be inferred, though I believe that is a separate issue.

Describe alternatives you've considered

I did try "tricking" LibMan into fetching a generated ESM for me with something like this:

    {
      "provider": "jsdelivr",
      "library": "core-js@3.45.0",
      "files": [ "/+esm" ]
    }

Of course, that doesn't work because there is no literal "/+esm" file in this package. A more sensible and straightforward alternative syntax might be:

    {
      "provider": "jsdelivr",
      "library": "core-js@3.45.0/+esm"
    }
Additional context

I've found a few examples, like parse and locutus, where the /+esm endpoint is the only install option shown on the download page.

Locutus is an odd example, because the package contains a very large collection of submodules. I've found that jsDelivr supports a form of tree shaking by allowing /+esm to be appended to individual files in the library:

<script type="module">
        import pcre from 'https://cdn.jsdelivr.net/npm/locutus@2.0.32/php/pcre/+esm'
        import sprintf from 'https://cdn.jsdelivr.net/npm/locutus@2.0.32/php/strings/sprintf.js/+esm'
</script>

LibMan might be able to take advantage of this feature as well:

    {
      "provider": "jsdelivr/esm",
      "library": "locutus@2.0.32",
      "destination": "wwwroot/lib/locutus",
      "files": [
        "/php/pcre/index.js",
        "/php/strings/sprintf.js"
      ]
    }
主要言語
C#
スター
486
フォーク
91
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

aspnet/LibraryManager のほかの issue

aspnet/LibraryManager の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。