MCPcopy Index your code
hub / github.com/pyscript/pyscript / resolve

Function resolve

core/rollup/3rd-party.cjs:19–35  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

17// then sanitize the resulting outcome to avoid importing
18// anything via `/npm/...` through Rollup
19const resolve = (name) => {
20 const cdn = `${CDN}/${name}@${v(name)}/+esm`;
21 console.debug("fetching", cdn);
22 return fetch(cdn)
23 .then((b) => b.text())
24 .then((text) =>
25 text.replace(
26 /("|')\/npm\/(.+)?\+esm\1/g,
27 // normalize `/npm/module@version/+esm` as
28 // just `module` so that rollup can do the rest
29 (_, quote, module) => {
30 const i = module.lastIndexOf("@");
31 return `${quote}${module.slice(0, i)}${quote}`;
32 },
33 ),
34 );
35};
36
37// create a file rollup can then process and understand
38const reBundle = (name) => Promise.resolve(`export * from "${name}";\n`);

Callers 6

getFunction · 0.85
buildFunction · 0.85
offline.cjsFile · 0.85
3rd-party.cjsFile · 0.85
transientFunction · 0.85
executeFunction · 0.85

Calls 4

debugMethod · 0.80
vFunction · 0.70
fetchFunction · 0.50
textMethod · 0.45

Tested by

no test coverage detected