This repository has been archived by the owner on Feb 16, 2022. It is now read-only.
Use external noble/ed25519, fix coverage, remove config #132
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the problem you solved?
In #129 it was reported that
deno coverage
command not supporting import mapshttps://esm.sh/@noble/[email protected]
by @cinnamon-bun.Eventually @cinnamon-bun inlined this library in #130.
I took a closer look at all of this today, and think this is what happened:
Tests began to sporadically fail due to the importing via esm.sh, which automatically transforms NPM packages to be ESM-friendly. This is why we couldn't follow why the code wasn't working: none of us were looking at the transformed code esm.sh was serving. This transformed code had some kind of async leak in it which caused tests to fail.
The inlined version of noble/ed25519 introduced in #130 was still a bit problematic because it imported deno/std/node/crypto (basically a giant crypto polyfill) and still used it even in non-Node environments. This made the web bundle about 1mb in size.
Even without the use of an import map, our coverage commands were still failing due to our usage of
window.indexedDB
anddeno coverage
not supporting the--config
flag which would allow us to import the appropriate types for IndexedDB.What solution are you recommending?
With this solution:
crypto
moduledeno.json
config fileHere's how it's achieved:
deno.json
to get these types, but I have learned that all downstream users would need a similardeno.json
too.deno.json
deno coverage
, which does not support the--config
flag, now works again.noble/ed25519
toscripts/build_npm.ts
so that the NPM build uses the normal NPM build (which includes support for Node'scrypto
).Closes #129
Maybe also #125, as creating a web bundle works locally.