Skip to content

Conversation

@glynnbird
Copy link
Contributor

@glynnbird glynnbird commented Sep 10, 2025

Overview

Preparation work for Nano 12.

  • Making the library ESM-only - remove any "require" use and replace with equivalent "import".
  • version 12.
  • Update README code to eliminate "require".
  • Remove a bunch of legacy Nano code that dates back to the request/axios days. It's a bit simpler to read now with the "relax" method making the request and handling the response.
  • The ..AsStream variants of the functions are now "async" - i.e. they return a Promise which resolves to a stream, rather than synchronously returning a dummy stream as before. This makes the code easier to maintain, but is a breaking change.

Testing recommendations

All the tests have changed in the require-->import sense, but are functionally identical.

Checklist

  • Code is written and works correctly;
  • Changes are covered by tests;
  • Documentation reflects the changes;

@glynnbird
Copy link
Contributor Author

glynnbird commented Sep 11, 2025

Note to future self: It is possible to turn the ESM into CJS with:

rolldown --input lib/nano.js --file lib/dist.js --format cjs

I think ESM is the future though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant