{"version":3,"sources":["../src/getContractPath.js","../src/readCache.js","../src/writeCache.js","../src/resolveModuleAsync.js","../src/readCacheSync.js","../src/writeCacheSync.js","../src/resolveModuleSync.js","../src/bundler.js"],"names":["require","createRequire","resolveArtifacts","runPromise","generateRuntime","resolveArtifactsSync","runSync"],"mappings":";;;;;;;;AAMA,IAAM,gBAAA,GAAmB,CAAC,eAAA,EAAiB,gBAAgB,CAAA;AAoB9C,IAAA,eAAA,GAAkB,CAAC,QAAa,KAAA;AAC5C,EAAMA,MAAAA,QAAAA,GAAUC,uBAAc,QAAS,CAAA,QAAA,CAAS,GAAG,CAAI,GAAA,QAAA,GAAW,CAAG,EAAA,QAAQ,CAAG,CAAA,CAAA,CAAA;AAChF,EAAA,KAAA,MAAW,mBAAmB,gBAAkB,EAAA;AAC/C,IAAI,IAAA;AACH,MAAAD,QAAAA,CAAQ,QAAQ,eAAe,CAAA;AAC/B,MAAO,OAAA,eAAA;AAAA,aACC,CAAG,EAAA;AAAA;AAAC;AAEd,EAAQ,OAAA,CAAA,IAAA;AAAA,IACP,qDAAqD,QAAQ,CAAA;AAAA,wCAAA;AAAA,GAE9D;AACA,EAAO,OAAA,eAAA;AACR;;;ACFO,IAAM,YAAY,OAAO,MAAA,EAAQ,KAAO,EAAA,UAAA,EAAY,YAAY,eAAoB,KAAA;AAC1F,EAAI,IAAA;AACH,IAAA,MAAM,eAAkB,GAAA,MAAM,KAAM,CAAA,aAAA,CAAc,UAAU,CAAA;AAE5D,IAAM,MAAA,YAAA,GAAe,OAAM,eAAiB,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,eAAA,CAAA,IAAA,KAAQ,OAAO,IAAK,CAAA,eAAA,CAAgB,IAAI,CAAA,CAAE,MAAS,GAAA,CAAA;AAC/F,IAAA,MAAM,gBAAmB,GAAA,MACxB,MAAO,CAAA,MAAA,CAAA,CAAO,mDAAiB,SAAa,KAAA,EAAE,CAAA,CAAE,IAAK,CAAA,CAAC,QAAa,KAAA,QAAA,CAA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AAAA,IACD,gBAAkB,EAAA,CACK,UACA,EAAA,OAAA,EACC,YACA,eAEvB,KAAA,kBAAA;AAAA,MACC,MAAA;AAAA,MACA,MAAA;AAAA,MACA,GAAA;AAAA,MACA,IAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,eAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA,KACD;AAAA,IACD,oBAAsB,EAAA,CACC,UACA,EAAA,OAAA,EACC,YACA,eAEvB,KAAA,iBAAA;AAAA,MACC,MAAA;AAAA,MACA,MAAA;AAAA,MACA,GAAA;AAAA,MACA,IAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,eAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA,KACD;AAAA,IACD,gBAAkB,EAAA,CACK,UACA,EAAA,OAAA,EACC,YACA,eAEvB,KAAA,kBAAA;AAAA,MACC,MAAA;AAAA,MACA,MAAA;AAAA,MACA,GAAA;AAAA,MACA,IAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA;AAAA,MACA,eAAA;AAAA,MACA,KAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA;AACD,GACF;AACD","file":"index.cjs","sourcesContent":["import { createRequire } from 'node:module'\n\n/**\n * Array of possible contract package names to search for in the project\n * @type {readonly ['tevm/contract', '@tevm/contract']}\n */\nconst contractPackages = ['tevm/contract', '@tevm/contract']\n\n/**\n * Detects which version of the contract package is installed in the project.\n * This function tries to resolve either 'tevm/contract' or '@tevm/contract'\n * from the given base path, and returns the first one it finds.\n *\n * @param {string} basePath - The base directory path to search from\n * @returns {'tevm/contract' | '@tevm/contract'} - The resolved contract package name\n * @throws {Error} - Doesn't throw, but logs a warning if neither package is found\n *\n * @example\n * ```javascript\n * import { getContractPath } from '@tevm/base-bundler'\n *\n * // Get the correct contract package for the current project\n * const contractPackage = getContractPath(process.cwd())\n * console.log(contractPackage) // 'tevm/contract' or '@tevm/contract'\n * ```\n */\nexport const getContractPath = (basePath) => {\n\tconst require = createRequire(basePath.endsWith('/') ? basePath : `${basePath}/`)\n\tfor (const contractPackage of contractPackages) {\n\t\ttry {\n\t\t\trequire.resolve(contractPackage)\n\t\t\treturn contractPackage\n\t\t} catch (e) {}\n\t}\n\tconsole.warn(\n\t\t`Could not find tevm/contract or @tevm/contract in ${basePath}!. Please install it with \\`npm i @tevm/contract\\` \\`pnpm i @tevm/contract\\` or \\`yarn add tevm/contract\\`\nFalling back to attempting tevm/contract`,\n\t)\n\treturn 'tevm/contract'\n}\n","/**\n * Reads Solidity compilation artifacts from the cache asynchronously.\n * This function checks if cached artifacts exist and if they satisfy the requested\n * AST and bytecode inclusion requirements.\n *\n * @param {import('@tevm/compiler').Logger} logger - Logger for error reporting\n * @param {import('@tevm/bundler-cache').Cache} cache - Cache instance to read from\n * @param {string} modulePath - Path to the Solidity module\n * @param {boolean} includeAst - Whether to include AST in the result\n * @param {boolean} includeBytecode - Whether to include bytecode in the result\n * @returns {ReturnType<import('@tevm/bundler-cache').Cache['readArtifacts']>} - The cached artifacts if found and valid, otherwise undefined\n * @throws {Error} - Doesn't throw, but logs errors and returns undefined on failure\n *\n * @example\n * ```javascript\n * import { readCache } from '@tevm/base-bundler'\n * import { createCache } from '@tevm/bundler-cache'\n *\n * const cache = createCache()\n * const logger = console\n *\n * // Read artifacts for Counter.sol\n * const artifacts = await readCache(\n *   logger,\n *   cache,\n *   './contracts/Counter.sol',\n *   true, // include AST\n *   true  // include bytecode\n * )\n *\n * if (artifacts) {\n *   console.log('Cache hit! Using cached artifacts')\n * } else {\n *   console.log('Cache miss. Need to recompile')\n * }\n * ```\n */\nexport const readCache = async (logger, cache, modulePath, includeAst, includeBytecode) => {\n\ttry {\n\t\tconst cachedArtifacts = await cache.readArtifacts(modulePath)\n\n\t\tconst isCachedAsts = () => cachedArtifacts?.asts && Object.keys(cachedArtifacts.asts).length > 0\n\t\tconst isCachedBytecode = () =>\n\t\t\tObject.values(cachedArtifacts?.artifacts ?? {}).some((artifact) => artifact.evm.deployedBytecode)\n\n\t\tif (!cachedArtifacts) {\n\t\t\treturn undefined\n\t\t}\n\t\tif (includeAst && !isCachedAsts()) {\n\t\t\treturn undefined\n\t\t}\n\t\tif (includeBytecode && !isCachedBytecode()) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn cachedArtifacts\n\t} catch (e) {\n\t\tlogger.error(\n\t\t\t`there was an error in tevm plugin reading cache for ${modulePath}. Continuing without cache. This may hurt performance`,\n\t\t)\n\t\tlogger.error(/** @type any */ (e))\n\t\treturn undefined\n\t}\n}\n","/**\n * Writes compilation artifacts and generated code to the cache asynchronously.\n * This function can selectively write artifacts based on the provided flag,\n * and it also writes the generated TypeScript or JavaScript code to the\n * appropriate cache location based on the module type.\n *\n * @param {import('./types.js').Logger} logger - Logger for warning and error reporting\n * @param {import('@tevm/bundler-cache').Cache} cache - Cache instance to write to\n * @param {import('@tevm/compiler').ResolvedArtifacts} artifacts - The compilation artifacts to cache\n * @param {string} code - The generated code content\n * @param {string} modulePath - Path to the Solidity module\n * @param {string} moduleType - Type of module to generate ('dts', 'mjs', 'cjs', 'ts')\n * @param {boolean} writeArtifacts - Whether to write compilation artifacts to cache\n *   This is typically set to false if there was a compilation error, but we still\n *   want to cache error messages in the generated files.\n * @returns {Promise<void>} - A promise that resolves when writing is complete\n * @throws {Error} - Doesn't directly throw, but logs warnings for unsupported module types\n *\n * @example\n * ```javascript\n * import { writeCache } from '@tevm/base-bundler'\n * import { createCache } from '@tevm/bundler-cache'\n *\n * const cache = createCache()\n * const logger = console\n *\n * // After compilation, write results to cache\n * await writeCache(\n *   logger,\n *   cache,\n *   compilationResult, // artifacts from solc compilation\n *   generatedTypeScript, // the generated code\n *   './contracts/Counter.sol',\n *   'dts', // writing .d.ts file\n *   true // write artifacts too\n * )\n * ```\n */\nexport const writeCache = async (\n\tlogger,\n\tcache,\n\tartifacts,\n\tcode,\n\tmodulePath,\n\tmoduleType,\n\t// This is kinda quick and dirty but works for now\n\t// we will skip writing artifacts if there is an error\n\t// but still write dts and mjs files since they always\n\t// fall back to generating an empty file with error messages\n\twriteArtifacts,\n) => {\n\t/**\n\t * @type {Array<Promise<any>>}\n\t */\n\tconst promises = []\n\tif (writeArtifacts) {\n\t\tpromises.push(cache.writeArtifacts(modulePath, artifacts))\n\t}\n\tif (moduleType === 'dts') {\n\t\tpromises.push(cache.writeDts(modulePath, code))\n\t} else if (moduleType === 'mjs') {\n\t\tpromises.push(cache.writeMjs(modulePath, code))\n\t} else {\n\t\tlogger.warn(`No caching for module type ${moduleType}} implemented yet`)\n\t}\n\tawait Promise.all(promises)\n}\n","import { resolveArtifacts } from '@tevm/compiler'\nimport { generateRuntime } from '@tevm/runtime'\nimport { runPromise } from 'effect/Effect'\nimport { readCache } from './readCache.js'\nimport { writeCache } from './writeCache.js'\n\n/**\n * Asynchronously resolves a Solidity module to the specified module format.\n *\n * This function is the core of the bundler's module resolution process. It:\n * 1. Attempts to read from cache first\n * 2. If not cached, compiles the Solidity source and generates artifacts\n * 3. Generates code for the requested module type (dts, mjs, etc.)\n * 4. Writes results to cache (without blocking the resolution)\n * 5. Returns the bundler result\n *\n * @param {import('@tevm/compiler').Logger} logger - Logger for error reporting\n * @param {import('@tevm/config').ResolvedCompilerConfig} config - Compiler configuration\n * @param {import('@tevm/compiler').FileAccessObject} fao - File system access object\n * @param {import('@tevm/solc').Solc} solc - Solidity compiler instance\n * @param {string} modulePath - Path to the Solidity module\n * @param {string} basedir - Base directory for resolving relative paths\n * @param {boolean} includeAst - Whether to include AST in the result\n * @param {boolean} includeBytecode - Whether to include bytecode in the result\n * @param {import('@tevm/runtime').ModuleType} moduleType - Type of module to generate ('dts', 'mjs', 'cjs', 'ts')\n * @param {import('@tevm/bundler-cache').Cache} cache - Cache instance for artifacts\n * @param {'tevm/contract' | '@tevm/contract'} contractPackage - Contract package name to import in generated code\n * @returns {Promise<import('./types.js').BundlerResult>} A promise that resolves to a bundler result object\n * @throws {Error} - Throws if compilation or code generation fails\n *\n * @example\n * ```javascript\n * import { resolveModuleAsync } from '@tevm/base-bundler'\n * import { createCache } from '@tevm/bundler-cache'\n * import { createSolc } from '@tevm/solc'\n * import { loadConfig } from '@tevm/config'\n * import { mkdir, readFile, writeFile } from 'fs/promises'\n * import { existsSync, statSync } from 'fs'\n *\n * // Setup dependencies\n * const config = await loadConfig()\n * const solc = await createSolc()\n * const cache = createCache()\n * const logger = console\n *\n * // File access object\n * const fao = {\n *   readFile: (path, encoding) => readFile(path, { encoding }),\n *   writeFile,\n *   exists: async (path) => existsSync(path),\n *   existsSync,\n *   statSync,\n *   mkdir\n *   // Include other required methods\n * }\n *\n * // Resolve a Solidity file to a TypeScript declaration file\n * const result = await resolveModuleAsync(\n *   logger,\n *   config,\n *   fao,\n *   solc,\n *   './contracts/Counter.sol',\n *   process.cwd(),\n *   true,  // include AST\n *   true,  // include bytecode\n *   'dts', // generate .d.ts file\n *   cache,\n *   '@tevm/contract'\n * )\n *\n * console.log(result.code) // Generated TypeScript declarations\n * ```\n */\nexport const resolveModuleAsync = async (\n\tlogger,\n\tconfig,\n\tfao,\n\tsolc,\n\tmodulePath,\n\tbasedir,\n\tincludeAst,\n\tincludeBytecode,\n\tmoduleType,\n\tcache,\n\tcontractPackage,\n) => {\n\tconst cachedResult = await readCache(logger, cache, modulePath, includeAst, includeBytecode)\n\ttry {\n\t\tconst { solcInput, solcOutput, asts, artifacts, modules } =\n\t\t\tcachedResult ??\n\t\t\t(await resolveArtifacts(modulePath, basedir, logger, config, includeAst, includeBytecode, fao, solc))\n\t\tlet code = ''\n\t\tconst artifactsExist = artifacts && Object.keys(artifacts).length > 0\n\t\tif (artifactsExist) {\n\t\t\tcode = await runPromise(generateRuntime(artifacts, moduleType, includeBytecode, contractPackage))\n\t\t} else {\n\t\t\tconst message = `there were no artifacts for ${modulePath}. This is likely a bug in tevm`\n\t\t\tcode = `// ${message}`\n\t\t\tlogger.warn(message)\n\t\t}\n\n\t\t// The `writeCache` function is intentionally not awaited to allow non-blocking cache writes.\n\t\t// This enables the rest of the module resolution to proceed without waiting for the cache operation to complete.\n\t\twriteCache(\n\t\t\tlogger,\n\t\t\tcache,\n\t\t\t{ solcInput, solcOutput, asts, artifacts, modules },\n\t\t\tcode,\n\t\t\tmodulePath,\n\t\t\tmoduleType,\n\t\t\t// This is kinda quick and dirty but works for now\n\t\t\t// We are skipping writing artifacts if there is an error\n\t\t\t// But still write dts and mjs files since they always\n\t\t\t// fall back to generating an empty file with error messages\n\t\t\tartifactsExist,\n\t\t).catch((e) => {\n\t\t\tlogger.error(e)\n\t\t\tlogger.error('there was an error writing to the cache. This may cause peformance issues')\n\t\t})\n\n\t\treturn {\n\t\t\tsolcInput,\n\t\t\tsolcOutput,\n\t\t\tasts,\n\t\t\tmodules,\n\t\t\tcode,\n\t\t}\n\t} catch (e) {\n\t\tlogger.error(`there was an error in tevm plugin resolving .${moduleType}`)\n\t\tlogger.error(/** @type any */ (e))\n\t\tthrow e\n\t}\n}\n","/**\n * Reads Solidity compilation artifacts from the cache synchronously.\n * This function checks if cached artifacts exist and if they satisfy the requested\n * AST and bytecode inclusion requirements. Use this instead of the async version\n * when working in synchronous contexts (like TypeScript compiler plugins).\n *\n * @param {import('@tevm/compiler').Logger} logger - Logger for error reporting\n * @param {import('@tevm/bundler-cache').Cache} cache - Cache instance to read from\n * @param {string} modulePath - Path to the Solidity module\n * @param {boolean} includeAst - Whether to include AST in the result\n * @param {boolean} includeBytecode - Whether to include bytecode in the result\n * @returns {ReturnType<import('@tevm/bundler-cache').Cache['readArtifactsSync']>} - The cached artifacts if found and valid, otherwise undefined\n * @throws {Error} - Doesn't throw, but logs errors and returns undefined on failure\n *\n * @example\n * ```javascript\n * import { readCacheSync } from '@tevm/base-bundler'\n * import { createCache } from '@tevm/bundler-cache'\n *\n * const cache = createCache()\n * const logger = console\n *\n * // Read artifacts for Counter.sol synchronously\n * const artifacts = readCacheSync(\n *   logger,\n *   cache,\n *   './contracts/Counter.sol',\n *   true, // include AST\n *   true  // include bytecode\n * )\n *\n * if (artifacts) {\n *   console.log('Cache hit! Using cached artifacts')\n * } else {\n *   console.log('Cache miss. Need to recompile')\n * }\n * ```\n */\nexport const readCacheSync = (logger, cache, modulePath, includeAst, includeBytecode) => {\n\ttry {\n\t\tconst cachedArtifacts = cache.readArtifactsSync(modulePath)\n\n\t\tconst isCachedAsts = () => cachedArtifacts?.asts && Object.keys(cachedArtifacts.asts).length > 0\n\t\tconst isCachedBytecode = () =>\n\t\t\tObject.values(cachedArtifacts?.artifacts ?? {}).some((artifact) => artifact.evm.deployedBytecode)\n\n\t\tif (!cachedArtifacts) {\n\t\t\treturn undefined\n\t\t}\n\t\tif (includeAst && !isCachedAsts()) {\n\t\t\treturn undefined\n\t\t}\n\t\tif (includeBytecode && !isCachedBytecode()) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn cachedArtifacts\n\t} catch (e) {\n\t\tlogger.error(\n\t\t\t`there was an error in tevm plugin reading cache for ${modulePath}. Continuing without cache. This may hurt performance`,\n\t\t)\n\t\tlogger.error(/** @type any */ (e))\n\t\treturn undefined\n\t}\n}\n","/**\n * Writes compilation artifacts and generated code to the cache synchronously.\n * This is the synchronous version of writeCache, used primarily for TypeScript compiler\n * plugins that require synchronous operations. It writes artifacts and generated code\n * to the cache based on the module type.\n *\n * @param {import('./types.js').Logger} logger - Logger for warning and error reporting\n * @param {import('@tevm/bundler-cache').Cache} cache - Cache instance to write to\n * @param {import('@tevm/compiler').ResolvedArtifacts} artifacts - The compilation artifacts to cache\n * @param {string} code - The generated code content\n * @param {string} modulePath - Path to the Solidity module\n * @param {string} moduleType - Type of module to generate ('dts', 'mjs', 'cjs', 'ts')\n * @param {boolean} writeArtifacts - Whether to write compilation artifacts to cache\n *   This is typically set to false if there was a compilation error, but we still\n *   want to cache error messages in the generated files.\n * @returns {void} - No return value\n * @throws {Error} - May throw if cache operations fail, also logs warnings for unsupported module types\n *\n * @example\n * ```javascript\n * import { writeCacheSync } from '@tevm/base-bundler'\n * import { createCache } from '@tevm/bundler-cache'\n *\n * const cache = createCache()\n * const logger = console\n *\n * // After compilation, write results to cache synchronously\n * writeCacheSync(\n *   logger,\n *   cache,\n *   compilationResult, // artifacts from solc compilation\n *   generatedTypeScript, // the generated code\n *   './contracts/Counter.sol',\n *   'dts', // writing .d.ts file\n *   true // write artifacts too\n * )\n * ```\n */\nexport const writeCacheSync = (\n\tlogger,\n\tcache,\n\tartifacts,\n\tcode,\n\tmodulePath,\n\tmoduleType,\n\t// This is kinda quick and dirty but works for now\n\t// we will skip writing artifacts if there is an error\n\t// but still write dts and mjs files since they always\n\t// fall back to generating an empty file with error messages\n\twriteArtifacts,\n) => {\n\tif (writeArtifacts) {\n\t\tcache.writeArtifactsSync(modulePath, artifacts)\n\t}\n\tif (moduleType === 'dts') {\n\t\tcache.writeDts(modulePath, code)\n\t} else if (moduleType === 'mjs') {\n\t\tcache.writeMjs(modulePath, code)\n\t} else {\n\t\tlogger.warn(`No caching for module type ${moduleType}} implemented yet`)\n\t}\n}\n","import { resolveArtifactsSync } from '@tevm/compiler'\nimport { generateRuntime } from '@tevm/runtime'\nimport { runSync } from 'effect/Effect'\nimport { readCacheSync } from './readCacheSync.js'\nimport { writeCacheSync } from './writeCacheSync.js'\n\n/**\n * Synchronously resolves a Solidity module to the specified module format.\n *\n * This is the synchronous counterpart to resolveModuleAsync, which:\n * 1. Attempts to read from cache first\n * 2. If not cached, compiles the Solidity source and generates artifacts\n * 3. Generates code for the requested module type (dts, mjs, etc.)\n * 4. Writes results to cache\n * 5. Returns the bundler result\n *\n * This synchronous version is primarily used for TypeScript compiler plugins\n * which require synchronous operations.\n *\n * @param {import('@tevm/compiler').Logger} logger - Logger for error reporting\n * @param {import('@tevm/config').ResolvedCompilerConfig} config - Compiler configuration\n * @param {import('@tevm/compiler').FileAccessObject} fao - File system access object\n * @param {import('@tevm/solc').Solc} solc - Solidity compiler instance\n * @param {string} modulePath - Path to the Solidity module\n * @param {string} basedir - Base directory for resolving relative paths\n * @param {boolean} includeAst - Whether to include AST in the result\n * @param {boolean} includeBytecode - Whether to include bytecode in the result\n * @param {import('@tevm/runtime').ModuleType} moduleType - Type of module to generate ('dts', 'mjs', 'cjs', 'ts')\n * @param {import('@tevm/bundler-cache').Cache} cache - Cache instance for artifacts\n * @param {'tevm/contract' | '@tevm/contract'} contractPackage - Contract package name to import in generated code\n * @returns {import('./types.js').BundlerResult} A bundler result object\n * @throws {Error} - Throws if compilation or code generation fails\n *\n * @example\n * ```javascript\n * import { resolveModuleSync } from '@tevm/base-bundler'\n * import { createCache } from '@tevm/bundler-cache'\n * import { createSolc } from '@tevm/solc'\n * import { loadConfig } from '@tevm/config'\n * import { readFileSync, writeFileSync, existsSync, statSync, mkdirSync } from 'fs'\n *\n * // Setup dependencies\n * const config = loadConfigSync() // Hypothetical sync config loader\n * const solc = createSolcSync() // Hypothetical sync solc creator\n * const cache = createCache()\n * const logger = console\n *\n * // File access object\n * const fao = {\n *   readFileSync,\n *   writeFileSync,\n *   existsSync,\n *   statSync,\n *   mkdirSync,\n *   // Include other required methods\n * }\n *\n * // Resolve a Solidity file to a TypeScript declaration file\n * const result = resolveModuleSync(\n *   logger,\n *   config,\n *   fao,\n *   solc,\n *   './contracts/Counter.sol',\n *   process.cwd(),\n *   true,  // include AST\n *   true,  // include bytecode\n *   'dts', // generate .d.ts file\n *   cache,\n *   '@tevm/contract'\n * )\n *\n * console.log(result.code) // Generated TypeScript declarations\n * ```\n */\nexport const resolveModuleSync = (\n\tlogger,\n\tconfig,\n\tfao,\n\tsolc,\n\tmodulePath,\n\tbasedir,\n\tincludeAst,\n\tincludeBytecode,\n\tmoduleType,\n\tcache,\n\tcontractPackage,\n) => {\n\tconst cachedResult = readCacheSync(logger, cache, modulePath, includeAst, includeBytecode)\n\ttry {\n\t\tconst { solcInput, solcOutput, asts, artifacts, modules } =\n\t\t\tcachedResult ?? resolveArtifactsSync(modulePath, basedir, logger, config, includeAst, includeBytecode, fao, solc)\n\t\tlet code = ''\n\t\tconst artifactsExist = artifacts && Object.keys(artifacts).length > 0\n\t\tif (artifactsExist) {\n\t\t\tcode = runSync(generateRuntime(artifacts, moduleType, includeBytecode, contractPackage))\n\t\t} else {\n\t\t\tconst message = `there were no artifacts for ${modulePath}. This is likely a bug in tevm`\n\t\t\tcode = `// ${message}`\n\t\t\tlogger.warn(message)\n\t\t}\n\n\t\twriteCacheSync(\n\t\t\tlogger,\n\t\t\tcache,\n\t\t\t{ solcInput, solcOutput, asts, artifacts, modules },\n\t\t\tcode,\n\t\t\tmodulePath,\n\t\t\tmoduleType,\n\t\t\t// This is kinda quick and dirty but works for now\n\t\t\t// We are skipping writing artifacts if there is an error\n\t\t\t// But still write dts and mjs files since they always\n\t\t\t// fall back to generating an empty file with error messages\n\t\t\tartifactsExist,\n\t\t)\n\n\t\treturn {\n\t\t\tsolcInput: solcInput ?? undefined,\n\t\t\tsolcOutput: solcOutput ?? undefined,\n\t\t\tasts,\n\t\t\tmodules,\n\t\t\tcode,\n\t\t}\n\t} catch (e) {\n\t\tlogger.error(`there was an error in tevm plugin resolving .${moduleType}`)\n\t\tlogger.error(/** @type any */ (e))\n\t\tthrow e\n\t}\n}\n","import { getContractPath } from './getContractPath.js'\nimport { resolveModuleAsync } from './resolveModuleAsync.js'\nimport { resolveModuleSync } from './resolveModuleSync.js'\n\n/**\n * Creates a bundler instance for processing Solidity files into JavaScript and TypeScript.\n *\n * The bundler is the core component of Tevm's build system, providing the capability to:\n * - Compile Solidity files to ABI, bytecode, and AST\n * - Generate TypeScript type definitions from the ABI\n * - Generate JavaScript or TypeScript code for importing contracts\n * - Cache compilation results for better performance\n * - Support multiple module formats (ESM, CJS, TypeScript)\n *\n * This base bundler is used by all Tevm build plugins including TypeScript,\n * Webpack, Vite, Bun, ESBuild, and others.\n *\n * @param {import('@tevm/config').ResolvedCompilerConfig} config - The Tevm compiler configuration\n * @param {import('./types.js').Logger} logger - Logger for error and info reporting\n * @param {import('./types.js').FileAccessObject} fao - File system access object for reading/writing files\n * @param {import('@tevm/solc').Solc} solc - Solidity compiler instance\n * @param {import('@tevm/bundler-cache').Cache} cache - Cache instance for build artifacts\n * @param {'tevm/contract' | '@tevm/contract' | undefined} [contractPackage] - Optional contract package name\n * @returns {ReturnType<import('./types.js').Bundler>} A bundler instance with methods for resolving Solidity modules\n *\n * @example\n * ```javascript\n * import { bundler } from '@tevm/base-bundler'\n * import { createCache } from '@tevm/bundler-cache'\n * import { readFile, writeFile } from 'fs/promises'\n * import { readFileSync, writeFileSync, existsSync, statSync, mkdirSync } from 'fs'\n * import { mkdir, stat } from 'fs/promises'\n * import { createSolc } from '@tevm/solc'\n * import { loadConfig } from '@tevm/config'\n *\n * // Create a file access object with all required methods\n * const fao = {\n *   // Async methods\n *   readFile: (path, encoding) => readFile(path, { encoding }),\n *   writeFile,\n *   exists: async (path) => existsSync(path),\n *   stat,\n *   mkdir,\n *\n *   // Sync methods\n *   readFileSync: (path, encoding) => readFileSync(path, { encoding }),\n *   writeFileSync,\n *   existsSync,\n *   statSync,\n *   mkdirSync\n * }\n *\n * async function setupBundler() {\n *   // Initialize dependencies\n *   const config = await loadConfig()\n *   const solcCompiler = await createSolc()\n *   const cacheInstance = createCache()\n *\n *   // Create the bundler\n *   const tevmBundler = bundler(\n *     config,\n *     console,\n *     fao,\n *     solcCompiler,\n *     cacheInstance\n *   )\n *\n *   // Process a Solidity file to TypeScript\n *   const result = await tevmBundler.resolveTsModule(\n *     './contracts/ERC20.sol',\n *     process.cwd(),\n *     true,  // include AST\n *     true   // include bytecode\n *   )\n *\n *   console.log(result.code)\n *\n *   // The result contains:\n *   // - code: The generated TypeScript code\n *   // - modules: Information about processed modules\n *   // - solcInput: The input provided to solc\n *   // - solcOutput: The compiler output\n *   // - asts: Abstract Syntax Trees (if requested)\n * }\n *\n * setupBundler().catch(console.error)\n * ```\n */\nexport const bundler = (config, logger, fao, solc, cache, contractPackage) => {\n\tconst _contractPackage = typeof contractPackage === 'string' ? contractPackage : getContractPath(process.cwd())\n\treturn {\n\t\t/** @type {string} */\n\t\tname: 'TevmBaseBundler',\n\t\tconfig,\n\t\tresolveDts: (\n\t\t\t/** @type {string} */ modulePath,\n\t\t\t/** @type {string} */ basedir,\n\t\t\t/** @type {boolean} */ includeAst,\n\t\t\t/** @type {boolean} */ includeBytecode,\n\t\t) =>\n\t\t\tresolveModuleAsync(\n\t\t\t\tlogger,\n\t\t\t\tconfig,\n\t\t\t\tfao,\n\t\t\t\tsolc,\n\t\t\t\tmodulePath,\n\t\t\t\tbasedir,\n\t\t\t\tincludeAst,\n\t\t\t\tincludeBytecode,\n\t\t\t\t'dts',\n\t\t\t\tcache,\n\t\t\t\t_contractPackage,\n\t\t\t),\n\t\tresolveDtsSync: (\n\t\t\t/** @type {string} */ modulePath,\n\t\t\t/** @type {string} */ basedir,\n\t\t\t/** @type {boolean} */ includeAst,\n\t\t\t/** @type {boolean} */ includeBytecode,\n\t\t) =>\n\t\t\tresolveModuleSync(\n\t\t\t\tlogger,\n\t\t\t\tconfig,\n\t\t\t\tfao,\n\t\t\t\tsolc,\n\t\t\t\tmodulePath,\n\t\t\t\tbasedir,\n\t\t\t\tincludeAst,\n\t\t\t\tincludeBytecode,\n\t\t\t\t'dts',\n\t\t\t\tcache,\n\t\t\t\t_contractPackage,\n\t\t\t),\n\t\tresolveTsModuleSync: (\n\t\t\t/** @type {string} */ modulePath,\n\t\t\t/** @type {string} */ basedir,\n\t\t\t/** @type {boolean} */ includeAst,\n\t\t\t/** @type {boolean} */ includeBytecode,\n\t\t) =>\n\t\t\tresolveModuleSync(\n\t\t\t\tlogger,\n\t\t\t\tconfig,\n\t\t\t\tfao,\n\t\t\t\tsolc,\n\t\t\t\tmodulePath,\n\t\t\t\tbasedir,\n\t\t\t\tincludeAst,\n\t\t\t\tincludeBytecode,\n\t\t\t\t'ts',\n\t\t\t\tcache,\n\t\t\t\t_contractPackage,\n\t\t\t),\n\t\tresolveTsModule: (\n\t\t\t/** @type {string} */ modulePath,\n\t\t\t/** @type {string} */ basedir,\n\t\t\t/** @type {boolean} */ includeAst,\n\t\t\t/** @type {boolean} */ includeBytecode,\n\t\t) =>\n\t\t\tresolveModuleAsync(\n\t\t\t\tlogger,\n\t\t\t\tconfig,\n\t\t\t\tfao,\n\t\t\t\tsolc,\n\t\t\t\tmodulePath,\n\t\t\t\tbasedir,\n\t\t\t\tincludeAst,\n\t\t\t\tincludeBytecode,\n\t\t\t\t'ts',\n\t\t\t\tcache,\n\t\t\t\t_contractPackage,\n\t\t\t),\n\t\tresolveCjsModuleSync: (\n\t\t\t/** @type {string} */ modulePath,\n\t\t\t/** @type {string} */ basedir,\n\t\t\t/** @type {boolean} */ includeAst,\n\t\t\t/** @type {boolean} */ includeBytecode,\n\t\t) =>\n\t\t\tresolveModuleSync(\n\t\t\t\tlogger,\n\t\t\t\tconfig,\n\t\t\t\tfao,\n\t\t\t\tsolc,\n\t\t\t\tmodulePath,\n\t\t\t\tbasedir,\n\t\t\t\tincludeAst,\n\t\t\t\tincludeBytecode,\n\t\t\t\t'cjs',\n\t\t\t\tcache,\n\t\t\t\t_contractPackage,\n\t\t\t),\n\t\tresolveCjsModule: (\n\t\t\t/** @type {string} */ modulePath,\n\t\t\t/** @type {string} */ basedir,\n\t\t\t/** @type {boolean} */ includeAst,\n\t\t\t/** @type {boolean} */ includeBytecode,\n\t\t) =>\n\t\t\tresolveModuleAsync(\n\t\t\t\tlogger,\n\t\t\t\tconfig,\n\t\t\t\tfao,\n\t\t\t\tsolc,\n\t\t\t\tmodulePath,\n\t\t\t\tbasedir,\n\t\t\t\tincludeAst,\n\t\t\t\tincludeBytecode,\n\t\t\t\t'cjs',\n\t\t\t\tcache,\n\t\t\t\t_contractPackage,\n\t\t\t),\n\t\tresolveEsmModuleSync: (\n\t\t\t/** @type {string} */ modulePath,\n\t\t\t/** @type {string} */ basedir,\n\t\t\t/** @type {boolean} */ includeAst,\n\t\t\t/** @type {boolean} */ includeBytecode,\n\t\t) =>\n\t\t\tresolveModuleSync(\n\t\t\t\tlogger,\n\t\t\t\tconfig,\n\t\t\t\tfao,\n\t\t\t\tsolc,\n\t\t\t\tmodulePath,\n\t\t\t\tbasedir,\n\t\t\t\tincludeAst,\n\t\t\t\tincludeBytecode,\n\t\t\t\t'mjs',\n\t\t\t\tcache,\n\t\t\t\t_contractPackage,\n\t\t\t),\n\t\tresolveEsmModule: (\n\t\t\t/** @type {string} */ modulePath,\n\t\t\t/** @type {string} */ basedir,\n\t\t\t/** @type {boolean} */ includeAst,\n\t\t\t/** @type {boolean} */ includeBytecode,\n\t\t) =>\n\t\t\tresolveModuleAsync(\n\t\t\t\tlogger,\n\t\t\t\tconfig,\n\t\t\t\tfao,\n\t\t\t\tsolc,\n\t\t\t\tmodulePath,\n\t\t\t\tbasedir,\n\t\t\t\tincludeAst,\n\t\t\t\tincludeBytecode,\n\t\t\t\t'mjs',\n\t\t\t\tcache,\n\t\t\t\t_contractPackage,\n\t\t\t),\n\t}\n}\n"]}