Feature/esmbuild
-
Create bundled es-module
build/asn1.bundle.mjsfor simple browser usage, and Deno support. -
Add basic installation instructions
-
~Include
build/*in repo for certain cdn-providers, e.g. deno.land/x or jsdeliver/gh~
I don't like the idea of keeping bundled (compiled) files in repo.
unpkg cdn-provider allows to use this module without minification
import * as asn1js from "https://unpkg.com/asn1js?module";
Unpkg works great for me, thanks again for the tip.
Having a "standardised" bundle in repo would serve a purpose anyways, enabling all cdn providers to serve the bundle.
If that's not interesting, maybe we can revert the gitignore change but still build the bundle? (and let npm be the source of choice for Deno, and simplify browser usage)
That would make this work:
import { x } from "https://cdn.jsdelivr.net/npm/asn1js@2/build/asn1.bundle.mjs";
Edit: Force pushed a new version of this pull request, without repo-inclusion of build/.
I've published [email protected]. Please try it.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script type="module">
import * as asn1js from "https://unpkg.com/asn1js?module";
const asn = new asn1js.Utf8String({
value: "Hello world",
});
console.log(asn.toString()); // ascii
console.log(asn.toString("hex"));
</script>
</body>
</html>
Console
UTF8String : 'Hello world'
index.html:20 0c0b48656c6c6f20776f726c64
I don't like the idea of keeping the bundle file with included external dependencies in the NPM registry. I guess it's better to compile a bundle file on application later with env requirements.
@microshine
Upgraded fido2-lib @ https://github.com/webauthn-open-source/fido2-lib/pull/85 . Works fine!