Mike Wilkerson
Mike Wilkerson
DDeno
Created by Mike Wilkerson on 5/3/2023 in #help
importing scoped NPM packages from other registries
In node, I can create an .npmrc that has rules like this:
@custom:registry=https://npm.example.com/
//npm.example.com/:_authToken=DEADBEEF
@custom:registry=https://npm.example.com/
//npm.example.com/:_authToken=DEADBEEF
See: https://docs.npmjs.com/cli/v7/configuring-npm/npmrc#comments This causes import { foo } from '@custom/foo' to be loaded from that specified registry instead of the default NPM registry, using the configured authToken. It leaves all other NPM packages to continue being retrieved via the default registry. I don't yet see a way to accomplish this with Deno. Is there one? What I've tried: 1. using NPM_CONFIG_REGISTRY This, however, seems to use that configured registry for ALL NPM packages. However, most packages will NOT be found at this specified registry--only the ones in the @custom scope. So when it comes to something like lodash, it fails trying to fetch lodash from npm.example.com. 2. using import maps and DENO_AUTH_TOKEN
{
"imports": {
"@custom/": "https://npm.example.com/"
}
}
{
"imports": {
"@custom/": "https://npm.example.com/"
}
}
And: export DENO_AUTH_TOKENS="DEADBEEF@npm.example.com" The problem with this seems to be that Deno does not treat the response as an NPM package, because the specifier in the import map is https:. I suppose it's treating it as if it were retrieving a deno package from the denoland package registry. Is there a way to specify the private registry URL in the import map and that it should be fetched as an NPM package?
1 replies
DDeno
Created by Mike Wilkerson on 5/3/2023 in #help
Embedding, snapshotting, and 7-bit ascii requirement
What are the differences in how a code module is processed when using load_side_module() versus when building an extension and using .esm() and include_js_files!()? I have an embed scenario working as expected with a JavaScript module, but less efficiently than I'd like (I suppose). I'd like to make it more efficient using snapshotting, but I'm hitting roadblocks that I don't understand. (Details follow...)
15 replies