wooorm / starry-night

Syntax highlighting, like GitHub

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

esm.sh cannot find `source.css.js`

birtles opened this issue · comments

If I open https://esm.sh/@wooorm/starry-night@3.0.0/ I see a bunch of imports like:

/* esm.sh - @wooorm/starry-night@3.0.0 */
import "/v132/@wooorm/starry-night@3.0.0/es2022/source.c.js";
import "/v132/vscode-oniguruma@2.0.1/es2022/vscode-oniguruma.mjs";
import "/v132/@wooorm/starry-night@3.0.0/es2022/source.c++.js";
import "/v132/vscode-textmate@9.0.0/es2022/vscode-textmate.mjs";
import "/v132/@wooorm/starry-night@3.0.0/es2022/source.c.platform.js";
import "/v132/@wooorm/starry-night@3.0.0/es2022/source.cs.js";
import "/v132/@wooorm/starry-night@3.0.0/es2022/source.css.js";
import "/v132/@wooorm/starry-night@3.0.0/es2022/source.css.less.js";
import "/v132/@wooorm/starry-night@3.0.0/es2022/source.css.scss.js";

Opening the first one: https://esm.sh/v132/@wooorm/starry-night@3.0.0/es2022/source.c.js works fine.

However, if I try to open source.css.js by going to https://esm.sh/v132/@wooorm/starry-night@3.0.0/es2022/source.css.js I get "File Not Found".

This appears to be the root cause of the following build error I get when building with deno:

Command failed with exit code 1: deno run --allow-all --no-config --import-map=/opt/buildhome/node-deps/node_modules/@netlify/edge-bundler/deno/vendor/import_map.json --quiet /opt/buildhome/node-deps/node_modules/@netlify/edge-bundler/deno/bundle.ts {basePath:/opt/build/repo,destPath:/tmp/edge-650becb62c763a0008a91779/023c2e8e-d4e8-4758-aa47-08d49427fcba.eszip,externals:[],functions:[{name:markdown-preview,path:/opt/build/repo/netlify/edge-functions/markdown-preview.js}],importMapData:{\imports\:{\unist-util-visit-parents\:\https://esm.sh/unist-util-visit-parents@6.0.1\,\unist-util-visit\:\https://esm.sh/unist-util-visit@5.0.0\,\unified\:\https://esm.sh/unified@10.1.2\,\remark-smartypants\:\https://esm.sh/remark-smartypants@2.0.0\,\remark-rehype\:\https://esm.sh/remark-rehype@10.1.0\,\remark-parse\:\https://esm.sh/remark-parse@10.0.2\,\remark-breaks\:\https://esm.sh/remark-breaks@3.0.3\,\rehype-stringify\:\https://esm.sh/rehype-stringify@9.0.4\,\rehype-sanitize\:\https://esm.sh/rehype-sanitize@5.0.1\,\rehype-external-links\:\https://esm.sh/rehype-external-links@2.1.0\,\normalize-url\:\https://esm.sh/normalize-url@8.0.0\,\hast-util-to-string\:\https://esm.sh/hast-util-to-string@2.0.0\,\email-regex-safe\:\https://esm.sh/email-regex-safe@4.0.0\,\@wooorm/starry-night\:\https://esm.sh/@wooorm/starry-night@3.0.0\,\@netlify/edge-functions\:\https://edge.netlify.com/v1/index.ts\,\netlify:edge\:\https://edge.netlify.com/v1/index.ts?v=legacy\},\scopes\:{}}} (https://ntl.fyi/exit-code-1)
error: Uncaught (in promise) Error: Module not found https://esm.sh/v132/@wooorm/starry-night@3.0.0/denonext/source.css.js.
      const ret = new Error(getStringFromWasm0(arg0, arg1));
                  ^
    at __wbg_new_15d3966e9981a196 (file:///opt/buildhome/node-deps/node_modules/@netlify/edge-bundler/deno/vendor/deno.land/x/eszip@v0.40.0/eszip_wasm.generated.js:417:19)
    at <anonymous> (file:///opt/buildhome/node-deps/node_modules/@netlify/edge-bundler/deno/vendor/deno.land/x/eszip@v0.40.0/eszip_wasm_bg.wasm:1:93412)
    at <anonymous> (file:///opt/buildhome/node-deps/node_modules/@netlify/edge-bundler/deno/vendor/deno.land/x/eszip@v0.40.0/eszip_wasm_bg.wasm:1:1499594)
    at <anonymous> (file:///opt/buildhome/node-deps/node_modules/@netlify/edge-bundler/deno/vendor/deno.land/x/eszip@v0.40.0/eszip_wasm_bg.wasm:1:1938165)
    at __wbg_adapter_40 (file:///opt/buildhome/node-deps/node_modules/@netlify/edge-bundler/deno/vendor/deno.land/x/eszip@v0.40.0/eszip_wasm.generated.js:231:6)
    at real (file:///opt/buildhome/node-deps/node_modules/@netlify/edge-bundler/deno/vendor/deno.land/x/eszip@v0.40.0/eszip_wasm.generated.js:215:14)
    at eventLoopTick (ext:core/01_core.js:182:11)

Did source.css.js somehow fail to get included?

Looks like a bug in esm.sh, my hunch is that it doesn’t understand that source.css does not mean a CSS file, but a JS file, which it has to look up in the export map:

"exports": {
".": "./index.js",
"./*": "./lang/*.js",
"./style/*": "./style/*.css"
},
, which redirects to the file lang/source.css.js.

Best to report it over there!

Thanks! Reported as esm-dev/esm.sh#728.

commented

i will look into

commented

this should be fixed in latest update

Thank you!

Thank you!