(name)
| 17 | // then sanitize the resulting outcome to avoid importing |
| 18 | // anything via `/npm/...` through Rollup |
| 19 | const 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 |
| 38 | const reBundle = (name) => Promise.resolve(`export * from "${name}";\n`); |
no test coverage detected