crypto: use map for lazy require cache#40378
Conversation
16f69b2 to
a74731e
Compare
a74731e to
16daadc
Compare
|
The |
|
@jasnell I can tell from the user land snapshot prototype that (at least a basic subset of) crypto works in user land snapshot, which doesn't assume the snapshotted state to be stateless since it'll re-initialize the command line arguments etc. during snapshot dehydration. However I am not yet sure if it's safe to include crypto in the startup snapshot which needs to be stateless, since it's a lot of code to vet for now.. |
|
thank you @jasnell ! I think what I was trying to say is that to my understanding Line 287 in 4f68839 webcrypto: {
configurable: false,
enumerable: true,
get() { return lazyRequire('internal/crypto/webcrypto').crypto; }
},
unless the internal webcrypto: {
configurable: false,
enumerable: true,
get() { return require('internal/crypto/webcrypto').crypto; }
},and for the crypto sub-modules loading, e.g. this: node/lib/internal/crypto/webcrypto.js Line 85 in 4441c3e case 'RSA-OAEP':
return lazyRequire('internal/crypto/rsa')
.rsaKeyGenerate(algorithm, extractable, keyUsages);would be pretty much the same as: case 'RSA-OAEP':
return require('internal/crypto/rsa')
.rsaKeyGenerate(algorithm, extractable, keyUsages);both of the above examples using |
|
This needs a rebase. |
|
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open. |
|
Closing this because it has stalled. Feel free to reopen if this issue/PR is still relevant, or to ping the collaborator who labelled it stalled if you have any questions. |
I'm curious why this
lazyRequirefunction exists. wouldn't it be sufficient enough to callrequiredirectly instead and achieve the same 'lazy' result?if that's the case, I can spin up another PR or repurpose this one.