-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5742 from NomicFoundation/bootstrap-optimizations
Bootstrap time optimizations
- Loading branch information
Showing
6 changed files
with
47 additions
and
24 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
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,10 @@ | ||
import { register } from "tsx/esm/api"; | ||
|
||
// We enable the sourcemaps before loading main, so that everything except this | ||
// small file is loaded with sourcemaps enabled. | ||
process.setSourceMapsEnabled(true); | ||
|
||
// Register tsx | ||
const _unregister = register(); | ||
|
||
// eslint-disable-next-line no-restricted-syntax -- Allow top-level await here | ||
const { main } = await import("./internal/cli/main.js"); | ||
|
||
main(process.argv.slice(2)).catch(() => { | ||
main(process.argv.slice(2), undefined, true).catch(() => { | ||
process.exitCode = 1; | ||
}); |
37 changes: 27 additions & 10 deletions
37
v-next/hardhat/src/internal/builtin-plugins/network-manager/hook-handlers/hre.ts
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,16 +1,33 @@ | ||
import type { HardhatRuntimeEnvironmentHooks } from "../../../../types/hooks.js"; | ||
|
||
import { NetworkManagerImplementation } from "../network-manager.js"; | ||
import type { NetworkManager } from "../../../../types/network.js"; | ||
|
||
export default async (): Promise<Partial<HardhatRuntimeEnvironmentHooks>> => ({ | ||
created: async (context, hre) => { | ||
hre.network = new NetworkManagerImplementation( | ||
hre.globalOptions.network !== "" | ||
? hre.globalOptions.network | ||
: hre.config.defaultNetwork, | ||
hre.config.defaultChainType, | ||
hre.config.networks, | ||
context.hooks, | ||
); | ||
let networkManager: NetworkManager | undefined; | ||
|
||
hre.network = { | ||
async connect(networkName, chainType, networkConfigOverride) { | ||
if (networkManager === undefined) { | ||
const { NetworkManagerImplementation } = await import( | ||
"../network-manager.js" | ||
); | ||
|
||
networkManager = new NetworkManagerImplementation( | ||
hre.globalOptions.network !== "" | ||
? hre.globalOptions.network | ||
: hre.config.defaultNetwork, | ||
hre.config.defaultChainType, | ||
hre.config.networks, | ||
context.hooks, | ||
); | ||
} | ||
|
||
return networkManager.connect( | ||
networkName, | ||
chainType, | ||
networkConfigOverride, | ||
); | ||
}, | ||
}; | ||
}, | ||
}); |
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