rename hardhat-solx to hardhat-slang-solx - #8491
Conversation
We rename the package directory, npm package name, and plugin `id` from `hardhat-solx` to `hardhat-slang-solx`, along with the plugin-level identifiers that follow the package's own name: the debug namespaces (`hardhat:solx:*` -> `hardhat:slang-solx:*`), describe-block titles, and fixture project names. The compiler is still called solx, so we leave every reference to the solx compiler itself untouched: the type discriminator, the build profile name, and the error messages that name it.
…low the plugin name We rename the constants and variables whose names follow the plugin rather than the compiler: the exported interface names (`SolxSolidityCompilerUserConfig`, `SolxSolidityCompilerConfig`, `SolxSingleVersionSolidityUserConfig`, `SolxUserConfig`, `SolxConfig`), the internal `SOLX_COMPILER_TYPE` constant, the `SolxCompiler` class (now `SlangSolxCompiler`), the `addSolxDebugInfoSelectors` function (now `addSlangSolxDebugInfoSelectors`), and the `solx-compiler.ts` module and its test. We leave the underlying value changes, the `"solx"` type literal itself, to a later commit.
…AT_SLANG_SOLX We rename the `HARDHAT_SOLX` error category to `HARDHAT_SLANG_SOLX`, along with its `pluginId` and `websiteTitle`. hardhat-slang-solx has never been released, so there is no published error-code contract to preserve the way `HHE27` needed one. The numeric range (110000-119999) and every descriptor's number are untouched, and the error messages themselves keep naming the solx compiler. This is a safe move, the solx plugin has never been released, so as long as the category range remains the same, other errors are unaffected.
…ator to slang-solx `type: "solx"` becomes `type: "slang-solx"` everywhere it's keyed (`SolidityCompilerTypeDefinitions` and the three `PerType` interfaces), along with the pieces that have to track it: the required build profile name, the top-level `HardhatUserConfig.solx` / `HardhatConfig.solx` namespace (now `slangSolx`), and `dangerouslyAllowSolxInProduction` (now `dangerouslyAllowSlangSolxInProduction`).
|
hardhatTotal size of the bundle: List of dependencies (sorted by size) |
compilation-job.ts embeds a plugin's compiler type verbatim in the
build-info id (`solc-${version}-${compilerType}-${jobHash}`), but
BUILD_INFO_FORMAT in edr-artifacts.ts only accepted
`[a-zA-Z][a-zA-Z0-9]*` for that segment. A hyphenated type like
`slang-solx` failed to match, so getBuildInfosAndOutputs silently
dropped the build info, and buildEdrArtifactsWithMetadata's
solcVersion lookup came up empty -- surfacing as:
Error HHE100: An internal invariant was violated: solcVersion
should not be undefined for artifact: 'CounterTest' in
'test/contracts/Counter.t.sol'
We widen the compilerType character class to
`[a-zA-Z][a-zA-Z0-9-]*`, matching what compilation-job.ts already
writes. Verified against the example project: `hardhat test solidity
--build-profile slang-solx` now passes instead of throwing HHE100.
This isn't specific to hardhat-slang-solx -- any compiler type with a
hyphen in its name hit this. It surfaced now because renaming solx's
discriminator to "slang-solx" was the first hyphenated compiler type
to exist.
There was a problem hiding this comment.
Pull request overview
Renames the hardhat-solx plugin to hardhat-slang-solx across the Hardhat monorepo, updating the compiler type discriminator, config namespace, error category, CI wiring, and tests/fixtures to match the new plugin identity.
Changes:
- Renamed the plugin package, plugin id/npm package metadata, and user-facing configuration from
solx/"solx"toslangSolx/"slang-solx". - Updated Hardhat core and tests to handle hyphenated compiler types in build-info IDs.
- Migrated error category naming and updated CI path filters and release/publish helper scripts.
Reviewed changes
Copilot reviewed 31 out of 43 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/verdaccio/publish.ts | Updates excluded package list to the new plugin folder name. |
| scripts/lib/packages.ts | Excludes the renamed plugin folder from releasable packages enumeration. |
| pnpm-lock.yaml | Updates the workspace importer path to packages/hardhat-slang-solx. |
| packages/hardhat/test/internal/builtin-plugins/solidity-test/edr-artifacts.ts | Adds a test ensuring build-info IDs with hyphenated compiler types match. |
| packages/hardhat/src/internal/builtin-plugins/solidity/type-extensions.ts | Updates inline examples/docs to reference slang-solx. |
| packages/hardhat/src/internal/builtin-plugins/solidity/build-system/build-system.ts | Updates log-comment examples for the renamed compiler type. |
| packages/hardhat/src/internal/builtin-plugins/solidity-test/edr-artifacts.ts | Relaxes build-info regex to allow - in compiler type. |
| packages/hardhat-solx/src/type-extensions.ts | Removes old plugin type extensions (file deleted as part of rename). |
| packages/hardhat-slang-solx/tsconfig.json | Adds TS project config for the renamed package. |
| packages/hardhat-slang-solx/test/slang-solx-compiler.ts | Renames compiler class/tests to SlangSolxCompiler and updates imports. |
| packages/hardhat-slang-solx/test/platform.ts | Updates package naming in platform detection tests. |
| packages/hardhat-slang-solx/test/output-augmentation.ts | Updates build profile naming used by integration-style tests. |
| packages/hardhat-slang-solx/test/optimizer-mode.ts | Updates build profile naming in optimizer propagation tests. |
| packages/hardhat-slang-solx/test/mirror-availability.ts | Adds opt-in mirror availability test under the renamed package. |
| packages/hardhat-slang-solx/test/integration.ts | Updates config namespace/profile/type expectations to slangSolx/slang-solx. |
| packages/hardhat-slang-solx/test/hook-handlers/solidity.ts | Updates hook handler tests for new compiler type and error category. |
| packages/hardhat-slang-solx/test/fixture-projects/with-debug-info/package.json | Renames fixture package name to match new plugin. |
| packages/hardhat-slang-solx/test/fixture-projects/with-debug-info/hardhat.config.ts | Updates fixture to use slang-solx profile/type and plugin import naming. |
| packages/hardhat-slang-solx/test/fixture-projects/with-debug-info/contracts/InlineAsm.sol | Adds/relocates fixture contract for debug-info coverage. |
| packages/hardhat-slang-solx/test/fixture-projects/with-debug-info/contracts/Counter.sol | Adds/relocates fixture contract for debug-info coverage. |
| packages/hardhat-slang-solx/test/fixture-projects/with-debug-info/contracts/ConstructorRevert.sol | Adds/relocates fixture contract for debug-info coverage. |
| packages/hardhat-slang-solx/test/fixture-projects/with-debug-info/.gitignore | Adds fixture build output ignores. |
| packages/hardhat-slang-solx/test/fixture-projects/simple/package.json | Renames simple fixture package name to match new plugin. |
| packages/hardhat-slang-solx/test/fixture-projects/simple/hardhat.config.ts | Updates simple fixture to use slang-solx profile/type and plugin import naming. |
| packages/hardhat-slang-solx/test/fixture-projects/simple/contracts/Greeter.sol | Adds/relocates simple fixture contract. |
| packages/hardhat-slang-solx/test/config.ts | Updates config validation/resolution tests for new namespace/type/profile. |
| packages/hardhat-slang-solx/src/type-extensions.ts | Reintroduces type extensions under the renamed compiler type and config namespace. |
| packages/hardhat-slang-solx/src/internal/slang-solx-compiler.ts | Renames compiler class and debug-info augmentation helper. |
| packages/hardhat-slang-solx/src/internal/platform.ts | Switches errors to the new error category. |
| packages/hardhat-slang-solx/src/internal/hook-handlers/solidity.ts | Updates hook logic for new compiler type constant, class name, and debug namespace. |
| packages/hardhat-slang-solx/src/internal/hook-handlers/config.ts | Updates config hooks for new namespace/type/profile and error messaging. |
| packages/hardhat-slang-solx/src/internal/downloader.ts | Updates debug namespace and error category for download failures. |
| packages/hardhat-slang-solx/src/internal/constants.ts | Renames the compiler type constant to SLANG_SOLX_COMPILER_TYPE. |
| packages/hardhat-slang-solx/src/index.ts | Updates plugin id and npm package name, and default export naming. |
| packages/hardhat-slang-solx/README.md | Updates installation/configuration docs for hardhat-slang-solx and slang-solx. |
| packages/hardhat-slang-solx/package.json | Renames package metadata and repository paths for the new package name. |
| packages/hardhat-slang-solx/LICENSE | Adds license file under the renamed package. |
| packages/hardhat-slang-solx/eslint.config.js | Adds eslint config passthrough for the renamed package. |
| packages/hardhat-slang-solx/.prettierignore | Adds prettier ignore rules for dist/fixtures artifacts in the renamed package. |
| packages/hardhat-slang-solx/.gitignore | Adds gitignore rules for the renamed package. |
| packages/hardhat-errors/src/descriptors.ts | Renames the error category to HARDHAT_SLANG_SOLX and updates plugin metadata. |
| .github/workflows/ci.yml | Updates path filters and working directory for the mirror-availability job. |
| .changeset/config.json | Updates changeset ignore list to the new package name. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Suppressed comments (2)
packages/hardhat-slang-solx/src/internal/downloader.ts:19
- The debug namespace changed to
hardhat:slang-solx:*, butpackages/hardhat-utils/test/debug.tsstill lists the oldhardhat:solx:*namespaces (e.g. lines 342-344). This will likely break theselectColordistribution test unless the namespace list is updated to the new names.
packages/hardhat-slang-solx/src/internal/hook-handlers/config.ts:321 resolveSolxConfigreturnsSlangSolxConfigand is only used to populateslangSolx, so the function name no longer matches what it actually resolves. Renaming it (and its call site) toresolveSlangSolxConfigwould avoid confusion during future maintenance.
|
|
||
| export const BUILD_INFO_FORMAT: RegExp = | ||
| /^solc-(?<major>\d+)_(?<minor>\d+)_(?<patch>\d+)(?:-(?<compilerType>[a-zA-Z][a-zA-Z0-9]*))?-[0-9a-fA-F]*$/; | ||
| /^solc-(?<major>\d+)_(?<minor>\d+)_(?<patch>\d+)(?:-(?<compilerType>[a-zA-Z][a-zA-Z0-9-]*))?-[0-9a-fA-F]*$/; |
There was a problem hiding this comment.
This allows us to have a compiler type with a hyphen, so slang-solx, so the build info can be solc-0_8_34-slang-solx-abc123.
But it depends on us keeping this structure: solc-${version}-${compilerType}-${jobHash}. I can see this being a hostage to fortune if we are forced to make a change and need fallback code for the slang-solx users.
Alternatives would be replacing - with another character like _, when writing to file.
| }, | ||
| }, | ||
| HARDHAT_SOLX: { | ||
| HARDHAT_SLANG_SOLX: { |
There was a problem hiding this comment.
I think this is safe. We have not released the plugin, so as long as the range remains the same, we won't affect other error descriptions.
| export interface SolidityCompilerTypeDefinitions { | ||
| solx: true; | ||
| // eslint-disable-next-line @typescript-eslint/naming-convention -- the compiler type discriminator is kebab-case to match the plugin name | ||
| "slang-solx": true; |
There was a problem hiding this comment.
The hyphen here has an unexpected knock on because the compiler type forms part of the file name of artifact outputs.
| export interface SolidityCompilerUserConfigPerType { | ||
| solx: SlangSolxSolidityCompilerUserConfig; | ||
| // eslint-disable-next-line @typescript-eslint/naming-convention -- the compiler type discriminator is kebab-case to match the plugin name | ||
| "slang-solx": SlangSolxSolidityCompilerUserConfig; |
There was a problem hiding this comment.
This is a usability question. The property in hardhat config will be "slang-solx" requiring escaping as a string to support the -. On the whole we would try and avoid that in config properties in JS/TS.
|
The |
The solx compiler backend is part of the broader slang compiler effort, we are renaming the plugin to reflect that reality.
The
hardhat-solxplugin becomeshardhat-slang-solx.In addition to variable, interface and other code level renames, the following user facing changes have been made:
type: "solx"→type: "slang-solx")HARDHAT_SOLX→HARDHAT_SLANG_SOLX) which is safe as the plugin keeps the same category rangeHardhatUserConfig.solx→.slangSolx)Not renamed
The compiler itself is still, for the moment, called
solx— its name, its error message text, its debug-info constants have not been touched. We can migrate these whensolxitself is renamed or optionally update this PR.Review
Tip
Review a commit at a time
The commits initially do file level renames, then code level changes (e.g. interfaces and constants), finally config entries and key values.
Manual testing
Set up
packages/example-projectto compile and test under the renamed plugin:cd packages/example-project pnpm add -D @nomicfoundation/hardhat-slang-solx@workspace:^Add to
hardhat.config.ts:Then: