Skip to content

Failed to publish package with *.sol exports #1236

@nikicat

Description

@nikicat

Hello, I'm trying to publish a fork of Hardhat to jsr and getting this error:

$ npx jsr publish
(node:1012414) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use `node --trace-deprecation ...` to show where the warning was created)
error: The module's source code could not be parsed: Expected ';', '}' or <eof> at file:///home/.../hardhat/v-next/hardhat/console.sol:2:8

  pragma solidity >=0.4.22 <0.9.0;
         ~~~~~~~~
Command: /home/.../.npm/_npx/91d31d47806d2506/node_modules/jsr/.download/v2.3.7/linux/deno publish --unstable-bare-node-builtins --unstable-sloppy-imports --unstable-byonm --no-check
CWD: /home/.../hardhat/v-next/hardhat
Output: 
Child process exited with: 1

jsr.json contents (I've generated it using pkg-to-jsr):

{
	"name": "@nikicat/hardhat",
	"version": "3.0.16",
	"license": "MIT",
	"exports": {
		".": "./dist/src/index.js",
		"./config": "./dist/src/config.js",
		"./hre": "./dist/src/hre.js",
		"./plugins": "./dist/src/plugins.js",
		"./internal/lsp-helpers": "./dist/src/lsp-helpers.js",
		"./types/arguments": "./dist/src/types/arguments.js",
		"./types/artifacts": "./dist/src/types/artifacts.js",
		"./types/config": "./dist/src/types/config.js",
		"./types/global-options": "./dist/src/types/global-options.js",
		"./types/hooks": "./dist/src/types/hooks.js",
		"./types/hre": "./dist/src/types/hre.js",
		"./types/network": "./dist/src/types/network.js",
		"./types/plugins": "./dist/src/types/plugins.js",
		"./types/providers": "./dist/src/types/providers.js",
		"./types/tasks": "./dist/src/types/tasks.js",
		"./types/test": "./dist/src/types/test.js",
		"./types/user-interruptions": "./dist/src/types/user-interruptions.js",
		"./types/utils": "./dist/src/types/utils.js",
		"./types/solidity": "./dist/src/types/solidity.js",
		"./console.sol": "./console.sol",
		"./internal/coverage": "./dist/src/internal/builtin-plugins/coverage/exports.js",
		"./internal/gas-analytics": "./dist/src/internal/builtin-plugins/gas-analytics/exports.js",
		"./utils/contract-names": "./dist/src/utils/contract-names.js"
	},
	"publish": {
		"include": [
			"dist/src/",
			"src/",
			"templates/",
			"console.sol",
			"coverage.sol",
			"CHANGELOG.md",
			"LICENSE",
			"README.md"
		]
	}
}

I suppose the problem is related to the presence of console.sol file in exports, but it should be exported and it works with npm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions