-
Notifications
You must be signed in to change notification settings - Fork 529
Convert packages from CJS to ESM #3531
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
Merged
Merged
Changes from 35 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
39f0f56
Upgrade TS and Lint packages
jmrossy d11495c
Merge branch 'main' into rossy/cjs-to-esm
jmrossy fa5bdcc
Convert utils package to ESM
jmrossy ba223b8
Convert core package to ESM
jmrossy 6638dda
CLI tweaks
jmrossy 6d39b0b
Upgrade hardhat packages
jmrossy e00ec64
Invoke typechain manually
jmrossy 755eeca
Convert SDK to ESM
jmrossy 998e93d
Patch typechain esm bug (see #898)
jmrossy 8407f0c
Solidity config simplification
jmrossy 639a96e
Add missing json import assertion
jmrossy 35daae3
Convert helloworld to ESM
jmrossy 606d545
Fixes for helloworld config
jmrossy 69e34e8
Keep infra as CJS
jmrossy ea8bf97
Update and improve package readmes
jmrossy 9efbc26
Add changeset
jmrossy f104384
Merge branch 'main' into rossy/cjs-to-esm
jmrossy 2f2fcde
Allow import assertions in infra
jmrossy 536d742
Merge branch 'main' into rossy/cjs-to-esm
jmrossy c237545
Fix typo from find and replace
jmrossy 7ef159d
Fix cosm-types import
jmrossy 4faebc0
Merge branch 'main' into rossy/cjs-to-esm
jmrossy bb0f82a
Fix errors from merge conflicts
jmrossy e3d188c
Merge branch 'main' into rossy/cjs-to-esm
jmrossy f76f66b
Replace ts-node scripts with tsx
jmrossy 49ebfc0
PR feedback
jmrossy e96c9af
Attempt to fix cosmwasm CI test
jmrossy 7e05cd2
Merge branch 'main' into rossy/cjs-to-esm
jmrossy 50c71bf
Fix merge conflict
jmrossy b9aae60
Convert new code to ESM
jmrossy 4aa7c5d
Fix prettier and CLI ci test
jmrossy 5116a39
Update config path
jmrossy 7ae86d3
Convert Infra package to ESM
jmrossy e161de8
Revert change to core address artifact path
jmrossy 293529a
Remove hardhat from send-messages script
jmrossy 8d08078
Merge branch 'main' into rossy/cjs-to-esm
jmrossy d844059
Send anvil_mine calls from messages script
jmrossy 2d9cd6d
Merge branch 'main' into rossy/cjs-to-esm
jmrossy 3806e47
Address PR feedback
jmrossy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| '@hyperlane-xyz/helloworld': minor | ||
| '@hyperlane-xyz/utils': minor | ||
| '@hyperlane-xyz/cli': minor | ||
| '@hyperlane-xyz/sdk': minor | ||
| '@hyperlane-xyz/core': minor | ||
| --- | ||
|
|
||
| Convert all public hyperlane npm packages from CJS to pure ESM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| node_modules | ||
| dist | ||
| coverage | ||
| coverage | ||
| *.cts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| diff --git a/dist/codegen/createBarrelFiles.js b/dist/codegen/createBarrelFiles.js | ||
jmrossy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| index 4bf574d7f6701bc5a8fcb2c281b5c63f31923e79..7f9cbdbd0491d4fa6338a10b23d06c2665c9d968 100644 | ||
| --- a/dist/codegen/createBarrelFiles.js | ||
| +++ b/dist/codegen/createBarrelFiles.js | ||
| @@ -38,15 +38,13 @@ function createBarrelFiles(paths, { typeOnly, postfix = '', moduleSuffix = '' }) | ||
| const namespacesExports = nestedDirs | ||
| .map((p) => { | ||
| const namespaceIdentifier = (0, normalizeDirName_1.normalizeDirName)(p); | ||
| + const fromFilePath = moduleSuffix ? `'./${p}/index${moduleSuffix}'` : `'./${p}'` | ||
| if (typeOnly) | ||
| return [ | ||
| - `import type * as ${namespaceIdentifier} from './${p}';`, | ||
| + `import type * as ${namespaceIdentifier} from ${fromFilePath};`, | ||
| `export type { ${namespaceIdentifier} };`, | ||
| ].join('\n'); | ||
| - if (moduleSuffix) { | ||
| - return `export * as ${namespaceIdentifier} from './${p}/index${moduleSuffix}';`; | ||
| - } | ||
| - return `export * as ${namespaceIdentifier} from './${p}';`; | ||
| + return `export * as ${namespaceIdentifier} from ${fromFilePath};`; | ||
| }) | ||
| .join('\n'); | ||
| const contracts = (fileReexports[path] || []).sort(); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,19 @@ | ||
| # Hyperlane Solidity | ||
| # Hyperlane Core | ||
|
|
||
| On-chain implementations of Hyperlane in Solidity. | ||
| Hyperlane Core contains the contracts and typechain artifacts for the Hyperlane implementation for EVM. | ||
|
|
||
| ## Setup | ||
| ## Install | ||
|
|
||
| - `yarn install` | ||
| ```bash | ||
| # Install with NPM | ||
| npm install @hyperlane-xyz/utils | ||
|
|
||
| ## Build | ||
| # Or with Yarn | ||
| yarn add @hyperlane-xyz/utils | ||
| ``` | ||
|
|
||
| - `yarn build` | ||
| Note, this package uses [ESM Modules](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#pure-esm-package) | ||
|
|
||
| ## Test | ||
| ## License | ||
|
|
||
| - `yarn test` | ||
| Apache 2.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import type { Wallet } from 'ethers'; | ||
jmrossy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import hre from 'hardhat'; | ||
|
|
||
| export async function getSigners(): Promise<Wallet[]> { | ||
| // @ts-ignore Hardhat type overrides from @nomiclabs/hardhat-ethers don't work | ||
| return hre.ethers.getSigners(); | ||
| } | ||
|
|
||
| export async function getSigner(): Promise<Wallet> { | ||
| const [signers] = await getSigners(); | ||
| return signers; | ||
jmrossy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| { | ||
| "extends": "../tsconfig.json", | ||
| "compilerOptions": { | ||
| "outDir": "./dist", | ||
| "rootDir": "./types" | ||
| }, | ||
| "exclude": ["./test", "hardhat.config.ts", "./dist"], | ||
| "extends": "../tsconfig.json" | ||
| "exclude": ["./test", "hardhat.config.cts", "./dist"] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.