{"id":18449761,"url":"https://github.com/alincode/solc-import","last_synced_at":"2025-07-27T14:07:28.445Z","repository":{"id":57365836,"uuid":"166039004","full_name":"alincode/solc-import","owner":"alincode","description":null,"archived":false,"fork":false,"pushed_at":"2019-01-30T16:54:31.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-27T14:04:14.000Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alincode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-16T12:46:28.000Z","updated_at":"2019-10-05T06:18:42.000Z","dependencies_parsed_at":"2022-08-23T20:10:28.500Z","dependency_job_id":null,"html_url":"https://github.com/alincode/solc-import","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alincode/solc-import","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alincode%2Fsolc-import","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alincode%2Fsolc-import/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alincode%2Fsolc-import/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alincode%2Fsolc-import/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alincode","download_url":"https://codeload.github.com/alincode/solc-import/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alincode%2Fsolc-import/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267368926,"owners_count":24076092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T07:21:56.405Z","updated_at":"2025-07-27T14:07:28.428Z","avatar_url":"https://github.com/alincode.png","language":"JavaScript","readme":"# Solc import\n\n![Travis](https://img.shields.io/travis/alincode/solc-import.svg)\n[![codecov](https://codecov.io/gh/alincode/solc-import/branch/master/graph/badge.svg)](https://codecov.io/gh/alincode/solc-import)![npm downloads](https://img.shields.io/npm/dt/solc-import.svg)\n[![Dependency Status](https://img.shields.io/david/alincode/solc-import.svg?style=flat)](https://david-dm.org/alincode/solc-import)\n\n### Install\n\n```sh\nnpm install solc-import\n```\n\n### usage\n\n* combineSource\n\n```js\nlet myDB = new Map();\nmyDB.set('lib.sol', 'library L { function f() internal returns (uint) { return 7; } }');\n\nconst getImportContent = async function (path) {\n  return myDB.get(path);\n};\n\nconst sourceCodeIncludeImport = `\nimport 'lib.sol';\n\ncontract Casino {\n    using SafeMath for uint256;\n    function example(uint256 _value) {\n        uint number = msg.value.add(_value);\n    }\n}`;\n\nlet sources = await solcImport.combineSource(sourceCodeIncludeImport, getImportContent);\n// [{ path: 'lib.sol', content: '....'}]\n\n```\n\n* getImports\n\n```js\nconst sourceCode = `\nimport 'https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol';\n\ncontract Casino {\n    using SafeMath for uint256;\n    function example(uint256 _value) {\n        uint number = msg.value.add(_value);\n    }\n}`;\n\nlet imports = solcImport.getImports(sourceCode);\n// ['https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol']\n```\n\n* getReadCallback\n\n```js\nconst sourceCode = `\npragma solidity \u003e0.4.99 \u003c0.6.0;\n\nimport \"lib.sol\";\n\nlibrary OldLibrary {\n  function someFunction(uint8 a) public returns(bool);\n}\n\ncontract NewContract {\n  function f(uint8 a) public returns (bool) {\n      return OldLibrary.someFunction(a);\n  }\n}`;\n\nlet libContent = 'library L { function f() internal returns (uint) { return 7; } }';\n\nlet myDB = new Map();\nmyDB.set('lib.sol', libContent);\n\nconst getImportContent = async function (path) {\n  return myDB.get(path);\n};\n\nlet readCallback = await solcImport.getReadCallback(sourceCode, getImportContent);  // function\n```\n\n* isExistImport\n\n```js\nconst sourceCode = `\npragma solidity \u003e0.4.99 \u003c0.6.0;\n\nimport \"lib.sol\";\n\nlibrary OldLibrary {\n  function someFunction(uint8 a) public returns(bool);\n}\n\ncontract NewContract {\n  function f(uint8 a) public returns (bool) {\n      return OldLibrary.someFunction(a);\n  }\n}`;\nlet isExist = solcImport.isExistImport(sourceCode); // true\n```\n\n\n## License\nMIT © [alincode](https://github.com/alincode/solc-import)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falincode%2Fsolc-import","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falincode%2Fsolc-import","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falincode%2Fsolc-import/lists"}