Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/hybrid #13

Merged
merged 14 commits into from
Aug 11, 2024
Merged

Feat/hybrid #13

merged 14 commits into from
Aug 11, 2024

Conversation

Nesopie
Copy link
Contributor

@Nesopie Nesopie commented Jun 26, 2024

This PR:

  • adds hybrid support to cjs and esm modules
  • moves buffer usage into Uint8Array

tsconfig.json Outdated
"extends": "./tsconfig.base.json",
"compilerOptions": {
"outDir": "src/esm",
"esModuleInterop": true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

esModuleInterop is only useful for commonjs

ESM does not need interop considerations with ESM.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right..., will move it

Comment on lines 4 to 5
"module": "commonjs",
"outDir": "./src",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module and outDir are both defined in the other configs. Not really needed.

@junderw
Copy link
Member

junderw commented Jun 26, 2024

Can you write a benchmark that compares all these DataView and ArrayBuffers to something simpler?

I think we should add some bit writing functions in uint8array-tool and use those.

But if DataView and ArrayBuffer are fast enough it might be fine.

src/esm/index.js Outdated
bytes: 5
};
// 64 bit
}
else {
const number = tools.readUInt64(buffer, offset + 1, 'LE');
return { value: number, bytes: 9 };
return { numberValue: null, bigintValue: number, bytes: 9 };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if number is <= to Number.MAX_SAFE_INTEGER then return the numberValue.

Copy link
Member

@junderw junderw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 95ff37a

@junderw junderw merged commit 3253bf7 into bitcoinjs:master Aug 11, 2024
3 checks passed
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.

2 participants