Closed dyoder closed 3 months ago
@dchest I have a working model for doing this, but I don't want to apply it across all the packages unless it's acceptable to you.
npm run build
now will build both versions, placing the esm-compatible version into lib-es6
.I've tested this with base64
and utf8
and the tests still pass, although that's unsurprising since we still build into the lib
directory as before. I didn't attempt to get Jasmine to run the tests in lib-es6
as well, but I can do that if this approach makes sense to you. However, I have successfully loaded the module into the browser via an import map, so it's able to find the esm version okay.
If you're agreeable to this approach, I can apply across all the packages and submit a PR. If not, I can try to incorporate your feedback. Or if you have other plans for implementing this, that's fine, too, obviously. Just thought I'd share my work. 🙂
Hi, is this related to the errors I'm getting?
On eslint I use "plugin:@typescript-eslint/recommended-type-checked"
instead of "plugin:@typescript-eslint/recommended"
.
import * as base64 from "@stablelib/base64";
import * as utf8 from "@stablelib/utf8";
import * as hex from "@stablelib/hex";
import * as nacl from "@stablelib/nacl";
Unsafe call of an `any` typed value.eslint[@typescript-eslint/no-unsafe-call](https://typescript-eslint.io/rules/no-unsafe-call)
Unsafe argument of type `any` assigned to a parameter of type `Uint8Array`.eslint[@typescript-eslint/no-unsafe-argument](https://typescript-eslint.io/rules/no-unsafe-argument)
Unsafe member access .decode on an `any` value.eslint[@typescript-eslint/no-unsafe-member-access](https://typescript-eslint.io/rules/no-unsafe-member-access)
function decode(s: string): Uint8Array
I have to use the following:
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
Just curious if this is something on stablelib's types, thank you.
Edit: this is a weird eslint bug that disappeared when i closed and reopened my vscode. Marking as resolved.
Hello @dchest and @dyoder. Hope you are well, didn't know about stable lib until today. Just submitted a draft PR to Tweet-NaCl for ESM. Would love to sync up and help in any way.
Fixed in 2.0.
I'm adding this per @dchest's comment in #28:
FWIW, we need this for our work (we also need this for Tweet-NaCl). If there are no immediate plans to do this, we can submit a PR.