{"version":3,"sources":["../src/rollupPluginTevm.js"],"names":["createUnplugin","tevmUnplugin"],"mappings":";;;;;AA4HO,IAAM,gBAAA,GAAmBA,uBAAA,CAAeC,qBAAY,CAAA,CAAE","file":"index.cjs","sourcesContent":["import { createUnplugin, tevmUnplugin } from '@tevm/unplugin'\n\n/**\n * Creates a Rollup plugin for Tevm that enables direct Solidity imports in JavaScript\n * and TypeScript code.\n *\n * This plugin integrates with Rollup to transform imports of .sol files into JavaScript\n * modules that export Tevm Contract instances. These instances include the contract's ABI,\n * bytecode, and type information, allowing you to interact with Ethereum smart contracts\n * in a type-safe way directly from your JavaScript/TypeScript code.\n *\n * @returns {import('rollup').Plugin} A Rollup plugin that handles Solidity imports\n *\n * @example\n * #### Basic Configuration\n *\n * Add the plugin to your Rollup configuration:\n *\n * ```javascript\n * // rollup.config.js\n * import { defineConfig } from 'rollup'\n * import { rollupPluginTevm } from '@tevm/rollup'\n *\n * export default defineConfig({\n *   input: 'src/index.js',\n *   output: {\n *     dir: 'dist',\n *     format: 'esm',\n *   },\n *   plugins: [rollupPluginTevm()],\n * })\n * ```\n *\n * #### TypeScript Configuration\n *\n * For full TypeScript support including editor integration (code completion, type checking),\n * add the Tevm TypeScript plugin to your tsconfig.json:\n *\n * ```json\n * {\n *   \"compilerOptions\": {\n *     \"plugins\": [{ \"name\": \"tevm/ts-plugin\" }]\n *   }\n * }\n * ```\n *\n * #### Using Imported Contracts\n *\n * Once configured, you can import Solidity files directly and use them with full type safety:\n *\n * ```typescript\n * // Import a Solidity contract directly\n * import { ERC20 } from '@openzeppelin/contracts/token/ERC20/ERC20.sol'\n * import { createMemoryClient } from 'tevm'\n *\n * // Access contract metadata\n * console.log('ABI:', ERC20.abi)\n * console.log('Human-readable ABI:', ERC20.humanReadableAbi)\n * console.log('Bytecode:', ERC20.bytecode)\n *\n * // Create a Tevm client\n * const client = createMemoryClient()\n *\n * // Deploy the contract\n * const deployedContract = await client.deployContract(ERC20, [\n *   \"My Token\",  // constructor arg: name\n *   \"MTK\"        // constructor arg: symbol\n * ])\n *\n * // Call read methods with full type safety\n * const name = await deployedContract.read.name()\n * const symbol = await deployedContract.read.symbol()\n * const decimals = await deployedContract.read.decimals()\n *\n * // Call write methods\n * const tx = await deployedContract.write.transfer(\n *   \"0x70997970C51812dc3A010C7d01b50e0d17dc79C8\", // recipient address\n *   1000n                                         // amount (as BigInt)\n * )\n * ```\n *\n * #### How It Works\n *\n * Under the hood, the plugin transforms Solidity imports into JavaScript modules.\n * For example, importing ERC20.sol generates a module with code like:\n *\n * ```typescript\n * import { createContract } from '@tevm/contract'\n *\n * export const ERC20 = createContract({\n *   name: 'ERC20',\n *   humanReadableAbi: [\n *     'function name() view returns (string)',\n *     'function symbol() view returns (string)',\n *     'function decimals() view returns (uint8)',\n *     'function totalSupply() view returns (uint256)',\n *     'function balanceOf(address) view returns (uint256)',\n *     'function transfer(address,uint256) returns (bool)',\n *     // ... other functions\n *   ],\n *   bytecode: '0x...',\n *   deployedBytecode: '0x...',\n * })\n * ```\n *\n * #### Custom Configuration\n *\n * For custom configuration of the Tevm compiler, add a `tevm.config.json` file to your project root:\n *\n * ```json\n * {\n *   \"foundryProject\": true,       // Is this a Foundry project?\n *   \"libs\": [\"lib\"],              // Library directories to search in\n *   \"remappings\": {               // Import remappings (like in Foundry)\n *     \"foo\": \"vendored/foo\"\n *   },\n *   \"debug\": true,                // Enable debug logging\n *   \"cacheDir\": \".tevm\"           // Cache directory for compiled contracts\n * }\n * ```\n *\n * @see {@link https://tevm.sh/learn/solidity-imports | Tevm Solidity Import Documentation}\n * @see {@link https://rollupjs.org/plugin-development | Rollup Plugin Development}\n */\nexport const rollupPluginTevm = createUnplugin(tevmUnplugin).rollup\n"]}