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

Fixes _types generation and modernizes module resolution. #56

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

MicahZoltu
Copy link
Contributor

Currently, the _types is built using node module resolution, which results in this project generating invalid types. Details about the TypeScript bug can be found at microsoft/TypeScript#60930 (comment) and there are no plans to fix it since node (which is equivalent to node10) is being deprecated in TypeScript soon.

The way this bug manifests is in files like src/_types/core/P256.d.ts where it would previously generate code like:

create: (hash: import("@noble/curves/abstract/utils.js").CHash) => import("@noble/curves/abstract/weierstrass.js").CurveFn;

when it should have generated code like this (which is what is generated after this change):

create: (hash: import("@noble/curves/abstract/utils").CHash) => import("@noble/curves/abstract/weierstrass").CurveFn;

For the cjs build command, I changed from node to node10 to be more explicit/clear, since node was just an alias for node10.

For the esm build command, I changed it to use the tsconfig so it is less likely to get out of sync with the generated types.

Also updated .gitignore to ignore .pnpm-store which had 30,000 files it wanted to commit after I did pnpm install using the recommended version of pnpm.

Currently, the `_types` is built using `node` module resolution, which results in this project generating invalid types.  Details about the TypeScript bug can be found at microsoft/TypeScript#60930 (comment) and there are no plans to fix it since `node` (which is equivalent to `node10`) is being deprecated in TypeScript soon.

The way this bug manifests is in files like `src/_types/core/P256.d.ts` where it would previously generate code like:�```ts
create: (hash: import("@noble/curves/abstract/utils.js").CHash) => import("@noble/curves/abstract/weierstrass.js").CurveFn;
```
when it should have generated code like this (which is what is generated after this change):�```ts
create: (hash: import("@noble/curves/abstract/utils").CHash) => import("@noble/curves/abstract/weierstrass").CurveFn;
```

For the cjs build command, I changed from `node` to `node10` to be more explicit/clear, since `node` was just an alias for `node10`.

For the esm build command, I changed it to use the tsconfig so it is less likely to get out of sync with the generated types.

Also updated .gitignore to ignore `.pnpm-store` which had 30,000 files it wanted to commit after I did `pnpm install` using the recommended version of `pnpm`.
Copy link

vercel bot commented Jan 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ox ❌ Failed (Inspect) Jan 15, 2025 5:52am

@jxom jxom merged commit c3a4290 into wevm:main Jan 15, 2025
2 of 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