Open
Description
To further increase parity between JavaScript in Markdown and JavaScript in data loaders, we could add a loader that allows npm:
protocol imports to be automatically loaded from jsDelivr, or we could resolve them to node_modules (just stripping the npm:
prefix). For example, in npm-loader.js
:
export function resolve(specifier, context, nextResolve) {
return specifier.startsWith("npm:")
? {shortCircuit: true, url: `https://cdn.jsdelivr.net/npm/${specifier.slice("npm:".length)}/+esm`}
: nextResolve(specifier, context);
}
And then adding additional args when running node
for data loaders:
node --experimental-network-imports --loader ./npm-loader.js ./data.csv.js