-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert packages from CJS to ESM (#3531)
### Description - Reconfigure tsconfig and package.json for the utils, core, sdk, and helloworld packages - Update imports to use ESM syntax - Add patch for typechain to address [issue 898](dethcrypto/TypeChain#898) ### Drive-by changes Improve package Readme content ### Related issues Fixes #1354 ### Backward compatibility No: package consumers using CJS will need to modify their imports or update to ESM. See [this popular gist](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#pure-esm-package) for details. ### Testing - [x] CI test coverage which invokes a lot of code via the CLI e2e - [x] Manually test in Warp UI by copying packages - [x] Publish beta packages and test in a few popular bundlers
- Loading branch information
Showing
327 changed files
with
2,558 additions
and
2,187 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 | ||
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 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 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 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 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 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 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 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 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 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'; | ||
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 [signer] = await getSigners(); | ||
return signer; | ||
} |
This file contains 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 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.