@tevm/ts-plugin
Version:
A typescript plugin for tevm
1 lines • 50.4 kB
Source Map (JSON)
{"version":3,"sources":["../src/utils/convertSolcAstToTsDefinitionInfo.ts","../src/utils/findContractDefinitionFileNameFromTevmNode.ts","../src/utils/findNode.ts","../src/utils/invariant.ts","../src/utils/isSolidity.ts","../src/utils/isRelativeSolidity.ts","../src/utils/solidityModuleResolver.ts","../src/utils/index.ts","../src/decorators/getDefinitionAtPosition.ts","../src/factories/decorator.ts","../src/factories/logger.ts","../src/factories/index.ts","../src/decorators/getScriptKind.ts","../src/utils/resolveJsonAsConst.ts","../src/decorators/getScriptSnapshot.ts","../src/decorators/resolveModuleNameLiterals.ts","../src/decorators/index.ts","../src/factories/fileAccessObject.ts","../src/tsPlugin.ts","../src/index.ts"],"names":["readFileSync","path","createRequire","bundler","solc","fileName","findAll","node","minimatch","existsSync","writeFileSync","stat","statSync","mkdirSync","mkdir","writeFile","readFile","access","config","runSync","loadConfig","catchTag","logWarning","map","defaultConfig","createCache"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,SAAS,gCAAA,CACf,OAAA,EACA,QAAA,EACA,aAAA,EACA,WACA,EAAA,EAC4B;AAf7B,EAAA,IAAA,EAAA;AAgBC,EAAA,MAAM,CAAC,KAAA,EAAO,MAAM,CAAA,GAAI,OAAA,CAAQ,IAAI,KAAA,CAAM,GAAG,CAAA,CAAE,GAAA,CAAI,MAAM,CAAA;AAEzD,EAAA,IAAI,IAAA,GAAO,GAAG,iBAAA,CAAkB,OAAA;AAChC,EAAA,IAAI,IAAA,GAAO,SAAA;AACX,EAAA,IAAI,OAAA,CAAQ,aAAa,qBAAA,EAAuB;AAC/C,IAAA,IAAA,GAAO,GAAG,iBAAA,CAAkB,eAAA;AAC5B,IAAA,IAAA,GAAO,OAAA,CAAQ,IAAA;AAAA,EAChB,CAAA,MAAA,IAAW,OAAA,CAAQ,QAAA,KAAa,oBAAA,EAAsB;AACrD,IAAA,IAA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{ readFileSync } from 'node:fs'\nimport type { Node } from 'solidity-ast/node.js'\nimport type { SolcInput } from 'solidity-ast/solc.js'\nimport type typescript from 'typescript/lib/tsserverlibrary.js'\n\n/**\n * Adapter from solc to typescript\n * When given basic solc information it will turn it into a TypeScript DefinitionInfo object\n */\nexport function convertSolcAstToTsDefinitionInfo(\n\tastNode: Node,\n\tfileName: string,\n\tcontainerName: string,\n\tsolcInput: SolcInput,\n\tts: typeof typescript,\n): typescript.DefinitionInfo {\n\tconst [start, length] = astNode.src.split(':').map(Number)\n\n\tlet kind = ts.ScriptElementKind.unknown\n\tlet name = 'unknown'\n\tif (astNode.nodeType === 'VariableDeclaration') {\n\t\tkind = ts.ScriptElementKind.variableElement\n\t\tname = astNode.name\n\t} else if (astNode.nodeType === 'FunctionDefinition') {\n\t\tkind = ts.ScriptElementKind.functionElement\n\t\tname = astNode.name\n\t}\n\n\tconst inputLength = solcInput.sources[fileName].content?.length as number\n\tconst actualLength = readFileSync(fileName, 'utf8').length\n\tconst offset = inputLength - actualLength\n\n\t// Create and return the TypeScript DefinitionInfo object\n\treturn {\n\t\tfileName,\n\t\ttextSpan: ts.createTextSpan(start - offset, length),\n\t\tkind,\n\t\tname,\n\t\tcontainerKind: ts.ScriptElementKind.classElement,\n\t\tcontainerName,\n\t}\n}\n","import type typescript from 'typescript/lib/tsserverlibrary.js'\n\nexport function findContractDefinitionFileNameFromTevmNode(\n\tnode: typescript.Node,\n\tlanguageService: typescript.LanguageService,\n\tfileName: string,\n\tts: typeof typescript,\n): string | null {\n\tlet current = node\n\n\twhile (current) {\n\t\tif (!ts.isPropertyAccessExpression(current)) {\n\t\t\tcurrent = current.parent\n\t\t\tcontinue\n\t\t}\n\t\tconst parent = current.expression\n\t\tif (!ts.isCallExpression(parent)) {\n\t\t\tcurrent = current.parent\n\t\t\tcontinue\n\t\t}\n\n\t\tconst grandParent = parent.expression\n\t\tif (!ts.isPropertyAccessExpression(grandParent)) {\n\t\t\tcurrent = current.parent\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!['read', 'write', 'events'].includes(grandParent.name.getText())) {\n\t\t\tcurrent = current.parent\n\t\t\tcontinue\n\t\t}\n\t\tconst contractNode = grandParent.expression\n\t\tconst contractDefinition = languageService.getDefinitionAtPosition(fileName, contractNode.getStart())\n\n\t\tif (!contractDefinition || contractDefinition.length === 0) {\n\t\t\tcurrent = current.parent\n\t\t\tcontinue\n\t\t}\n\n\t\tconst out = contractDefinition[0].fileName\n\n\t\tif (!out.endsWith('.sol')) {\n\t\t\tcurrent = current.parent\n\t\t\tcontinue\n\t\t}\n\n\t\treturn out\n\t}\n\n\treturn null\n}\n","import type typescript from 'typescript/lib/tsserverlibrary.js'\n\n/**\n * Find the typescript node at the given position in the AST\n */\nexport function findNode(rootNode: typescript.Node, position: number): typescript.Node | null {\n\tif (position < 0) {\n\t\tthrow new Error('Position must be non-negative')\n\t}\n\tif (Number.isInteger(position) === false) {\n\t\tthrow new Error('Position must be an integer')\n\t}\n\tlet foundNode: typescript.Node | null = null\n\tfunction visit(node: typescript.Node) {\n\t\tif (position >= node.getStart() && position <= node.getEnd()) {\n\t\t\tfoundNode = node\n\t\t\tnode.forEachChild(visit)\n\t\t}\n\t}\n\trootNode.forEachChild(visit)\n\treturn foundNode\n}\n","export function invariant(condition: any, message: string): asserts condition {\n\tif (!condition) {\n\t\tthrow new Error(message)\n\t}\n}\n","/**\n * Determines if a file path represents a Solidity source file.\n *\n * This utility checks if a path ends with the '.sol' extension while\n * excluding invalid paths like '/.sol' or just '.sol'.\n *\n * @param fileName - The file path or module name to check\n * @returns True if the file appears to be a valid Solidity file, false otherwise\n * @example\n * ```typescript\n * isSolidity('Contract.sol') // true\n * isSolidity('./path/Contract.sol') // true\n * isSolidity('.sol') // false\n * isSolidity('/.sol') // false\n * isSolidity('Contract.js') // false\n * ```\n */\nexport const isSolidity = (fileName: string) =>\n\tfileName.endsWith('.sol') && !fileName.endsWith('/.sol') && fileName !== '.sol'\n","import { isSolidity } from './isSolidity.js'\n\n/**\n * Helper function to determine if a path is a relative import.\n * Checks if the path starts with './' or '../'.\n *\n * @param fileName - The file path to check\n * @returns True if the path is a relative import, false otherwise\n * @internal\n */\nconst isRelative = (fileName: string) => fileName.startsWith('./') || fileName.startsWith('../')\n\n/**\n * Determines if a path is both a Solidity file and a relative import.\n *\n * This is used to distinguish between relative Solidity imports\n * (like './Contract.sol') and package imports (like 'package/Contract.sol'),\n * which need different resolution strategies.\n *\n * @param fileName - The file path to check\n * @returns True if the path is both a relative path and a Solidity file, false otherwise\n * @example\n * ```typescript\n * isRelativeSolidity('./Contract.sol') // true\n * isRelativeSolidity('../Contract.sol') // true\n * isRelativeSolidity('Contract.sol') // false (not relative)\n * isRelativeSolidity('./Contract.js') // false (not Solidity)\n * ```\n */\nexport const isRelativeSolidity = (fileName: string) => isRelative(fileName) && isSolidity(fileName)\n","import { createRequire } from 'node:module'\nimport path from 'node:path'\nimport type typescript from 'typescript/lib/tsserverlibrary.js'\nimport { isRelativeSolidity } from './isRelativeSolidity.js'\nimport { isSolidity } from './isSolidity.js'\n\n/**\n * Resolves a Solidity module name to its filesystem location and TypeScript type information.\n *\n * This utility handles three different import scenarios:\n * 1. Relative Solidity imports (like './Contract.sol')\n * 2. Package Solidity imports (like 'package/Contract.sol')\n * 3. Special case for '@tevm/contract' imports which need special resolution\n *\n * When Solidity files are imported, they're treated as TypeScript declaration files (.d.ts)\n * to provide type checking and IDE support for the contracts.\n *\n * @param moduleName - The module name to resolve (e.g., './Contract.sol')\n * @param ts - TypeScript library instance\n * @param createInfo - Plugin creation information from TypeScript\n * @param containingFile - Path to the file containing the import\n * @returns A resolved module with filename and extension information, or undefined if not resolvable\n */\nexport const solidityModuleResolver = (\n\tmoduleName: string,\n\tts: typeof typescript,\n\tcreateInfo: typescript.server.PluginCreateInfo,\n\tcontainingFile: string,\n): typescript.ResolvedModuleFull | undefined => {\n\tif (isRelativeSolidity(moduleName)) {\n\t\treturn {\n\t\t\textension: ts.Extension.Dts,\n\t\t\tisExternalLibraryImport: false,\n\t\t\tresolvedFileName: path.resolve(path.dirname(containingFile), moduleName),\n\t\t}\n\t}\n\tif (isSolidity(moduleName)) {\n\t\treturn {\n\t\t\textension: ts.Extension.Dts,\n\t\t\tisExternalLibraryImport: false,\n\t\t\tresolvedFileName: createRequire(path.dirname(containingFile)).resolve(moduleName),\n\t\t}\n\t}\n\n\t// to handle the case where the import is coming from a node_module or a different workspace\n\t// we need to always point @tevm/contract to the local version\n\tif (moduleName.startsWith('@tevm/contract')) {\n\t\tconst result = ts.resolveModuleName(\n\t\t\tmoduleName,\n\t\t\tcontainingFile,\n\t\t\tcreateInfo.project.getCompilerOptions(),\n\t\t\tcreateInfo.project,\n\t\t)\n\n\t\tif (result.resolvedModule) {\n\t\t\treturn {\n\t\t\t\textension: ts.Extension.Dts,\n\t\t\t\tisExternalLibraryImport: true,\n\t\t\t\tresolvedFileName: result.resolvedModule.resolvedFileName,\n\t\t\t}\n\t\t}\n\t\tconsole.error('Could not resolve module. Is tevm/core installed?', moduleName, result)\n\t\treturn undefined\n\t}\n\treturn undefined\n}\n","export * from './convertSolcAstToTsDefinitionInfo.js'\nexport * from './findContractDefinitionFileNameFromTevmNode.js'\nexport * from './findNode.js'\nexport * from './invariant.js'\nexport * from './isRelativeSolidity.js'\nexport * from './isSolidity.js'\nexport * from './solidityModuleResolver.js'\n","import { bundler, type FileAccessObject } from '@tevm/base-bundler'\nimport type { Cache } from '@tevm/bundler-cache'\nimport type { ResolvedCompilerConfig } from '@tevm/config'\nimport * as solc from 'solc'\nimport type { Node } from 'solidity-ast/node.js'\nimport type { SolcInput } from 'solidity-ast/solc.js'\nimport { findAll } from 'solidity-ast/utils.js'\nimport type typescript from 'typescript/lib/tsserverlibrary.js'\nimport type { Logger } from '../factories/logger.js'\nimport {\n\tconvertSolcAstToTsDefinitionInfo,\n\tfindContractDefinitionFileNameFromTevmNode,\n\tfindNode,\n} from '../utils/index.js'\n\n/**\n * Decorates the TypeScript LanguageService to provide \"Go to Definition\" support for Solidity contracts.\n *\n * This decorator extends the standard TypeScript language service by:\n * 1. Detecting when a user attempts to navigate to a definition in a Solidity contract\n * 2. Compiling the Solidity source using solc\n * 3. Parsing the AST to find matching function/event definitions\n * 4. Converting Solidity AST nodes to TypeScript definition information\n * 5. Returning these definitions alongside any TypeScript definitions\n *\n * This enables IDE features like \"Go to Definition\" to work seamlessly between TypeScript and Solidity.\n *\n * Note: Unlike other decorators in this codebase, this decorates the language service directly,\n * not the LanguageServiceHost. Future refactoring may generalize this approach.\n *\n * @param service - The TypeScript language service to decorate\n * @param config - Compiler configuration for Solidity files\n * @param logger - Logger instance for debugging information\n * @param ts - TypeScript library instance\n * @param fao - File access object for reading files\n * @param solcCache - Cache instance for solc compilations\n * @returns Decorated TypeScript language service with Solidity definition support\n */\nexport const getDefinitionServiceDecorator = (\n\tservice: typescript.LanguageService,\n\tconfig: ResolvedCompilerConfig,\n\tlogger: Logger,\n\tts: typeof typescript,\n\tfao: FileAccessObject,\n\tsolcCache: Cache,\n): typescript.LanguageService => {\n\tconst getDefinitionAtPosition: typeof service.getDefinitionAtPosition = (fileName, position) => {\n\t\tconst definition = service.getDefinitionAtPosition(fileName, position)\n\t\tconst sourceFile = service.getProgram()?.getSourceFile(fileName)\n\t\tconst node = sourceFile && findNode(sourceFile, position)\n\t\tconst ContractPath = node && findContractDefinitionFileNameFromTevmNode(node, service, fileName, ts)\n\t\tif (!ContractPath) {\n\t\t\treturn definition\n\t\t}\n\t\tconst plugin = bundler(config, logger as any, fao, solc, solcCache)\n\t\tconst includedAst = true\n\t\tconst { asts, solcInput } = plugin.resolveDtsSync(ContractPath, process.cwd(), includedAst, false)\n\t\tif (!asts) {\n\t\t\tlogger.error(`@tevm/ts-plugin: getDefinitionAtPositionDecorator was unable to resolve asts for ${ContractPath}`)\n\t\t\treturn definition\n\t\t}\n\n\t\tconst definitions: Array<{\n\t\t\tnode: Node\n\t\t\tfileName: string\n\t\t}> = []\n\t\tfor (const [fileName, ast] of Object.entries(asts)) {\n\t\t\tfor (const functionDef of findAll('EventDefinition', ast)) {\n\t\t\t\tif (functionDef.name === node?.getText()) {\n\t\t\t\t\tdefinitions.push({\n\t\t\t\t\t\tnode: functionDef,\n\t\t\t\t\t\tfileName,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const functionDef of findAll('FunctionDefinition', ast)) {\n\t\t\t\tif (functionDef.name === node?.getText()) {\n\t\t\t\t\tdefinitions.push({\n\t\t\t\t\t\tnode: functionDef,\n\t\t\t\t\t\tfileName,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!definitions.length) {\n\t\t\tlogger.error(`@tevm/ts-plugin: unable to find definitions ${ContractPath}`)\n\t\t\treturn definition\n\t\t}\n\t\tconst contractName = ContractPath.split('/').pop()?.split('.')[0] ?? 'Contract'\n\t\t// Skip definitions that would require solcInput if it is not available\n\t\tif (!solcInput) {\n\t\t\tlogger.error(`@tevm/ts-plugin: solcInput is undefined for ${ContractPath}`)\n\t\t\treturn definition\n\t\t}\n\t\treturn [\n\t\t\t...definitions.map(({ fileName, node }) =>\n\t\t\t\tconvertSolcAstToTsDefinitionInfo(node, fileName, contractName, { sources: solcInput.sources } as SolcInput, ts),\n\t\t\t),\n\t\t\t...(definition ?? []),\n\t\t]\n\t}\n\n\tconst getDefinitionAndBoundSpan: typeof service.getDefinitionAndBoundSpan = (fileName, position) => {\n\t\tconst definitions = getDefinitionAtPosition(fileName, position)\n\t\tif (!definitions) {\n\t\t\treturn service.getDefinitionAndBoundSpan(fileName, position)\n\t\t}\n\t\tif (!definitions.some((definition) => definition.fileName.endsWith('.sol'))) {\n\t\t\treturn service.getDefinitionAndBoundSpan(fileName, position)\n\t\t}\n\t\t// Logic to determine the appropriate text span for highlighting.\n\t\tconst sourceFile = service.getProgram()?.getSourceFile(fileName)\n\t\tconst node = sourceFile && findNode(sourceFile, position)\n\t\tconst textSpan = node ? ts.createTextSpanFromBounds(node.getStart(), node.getEnd()) : undefined\n\n\t\treturn {\n\t\t\tdefinitions,\n\t\t\ttextSpan: textSpan ?? ts.createTextSpan(0, 0), // Fallback to a zero-length span\n\t\t}\n\t}\n\n\treturn new Proxy(service, {\n\t\tget(target, key) {\n\t\t\tif (key === 'getDefinitionAtPosition') {\n\t\t\t\treturn getDefinitionAtPosition\n\t\t\t}\n\t\t\tif (key === 'getDefinitionAndBoundSpan') {\n\t\t\t\treturn getDefinitionAndBoundSpan\n\t\t\t}\n\t\t\treturn target[key as keyof typeof target]\n\t\t},\n\t})\n}\n","import type { FileAccessObject } from '@tevm/base-bundler'\nimport type { ResolvedCompilerConfig } from '@tevm/config'\nimport type typescript from 'typescript/lib/tsserverlibrary.js'\nimport type { Logger } from './logger.js'\n\n/**\n * Represents a function that transforms a TypeScript LanguageServiceHost.\n *\n * A host decorator takes the original LanguageServiceHost from the TypeScript\n * language service and returns a modified version that alters or extends its behavior.\n * This is the primary mechanism used by this plugin to intercept and modify\n * TypeScript language service operations.\n *\n * @internal\n * @see {@link typescript.LanguageServiceHost}\n */\nexport type HostDecorator = (\n\tcreateInfo: typescript.server.PluginCreateInfo,\n\tts: typeof typescript,\n\tlogger: Logger,\n\tconfig: ResolvedCompilerConfig,\n\tfao: FileAccessObject,\n) => typescript.LanguageServiceHost\n\n/**\n * Type of function passed into createDecorator\n * @see {@link createHostDecorator}\n * @example\n * const decoratorFn: PartialDecorator = (createInfo, ts, logger) => ({\n * getScriptKind: (fileName) => {\n * if (fileName.endsWith('.sol')) {\n * return ts.ScriptKind.TS\n * }\n * return createInfo.languageServiceHost.getScriptKind(fileName)\n * },\n * })\n */\nexport type PartialHostDecorator = (\n\tcreateInfo: typescript.server.PluginCreateInfo,\n\tts: typeof typescript,\n\tlogger: Logger,\n\tconfig: ResolvedCompilerConfig,\n\tfao: FileAccessObject,\n) => Partial<typescript.LanguageServiceHost>\n\n/**\n * Creates a full LanguageServiceHost decorator from a partial decorator function.\n *\n * This factory simplifies creating decorators by allowing you to specify only the\n * methods you want to override. The resulting decorator uses JavaScript Proxy to\n * intercept only the specified methods while delegating all other method calls\n * to the original LanguageServiceHost.\n *\n * @param decorator - A function that returns partial LanguageServiceHost implementation\n * @returns A complete HostDecorator function that can be used to decorate a LanguageServiceHost\n * @see {@link PartialHostDecorator}\n * @example\n * ```typescript\n * // Create a decorator that overrides the getScriptKind method\n * const jsonDecorator = createHostDecorator((createInfo, ts) => ({\n * getScriptKind: (fileName) => {\n * if (fileName.endsWith('.json')) {\n * return ts.ScriptKind.JSON\n * }\n * return createInfo.languageServiceHost.getScriptKind(fileName)\n * }\n * }))\n * ```\n */\nexport const createHostDecorator = (decorator: PartialHostDecorator): HostDecorator => {\n\treturn (createInfo, ...rest) => {\n\t\tconst proxy = decorator(createInfo, ...rest)\n\t\treturn new Proxy(createInfo.languageServiceHost, {\n\t\t\tget(target, key) {\n\t\t\t\t// If the key is one of the keys that are to be proxied, return the proxy value.\n\t\t\t\tif (key in proxy) {\n\t\t\t\t\treturn proxy[key as keyof typescript.LanguageServiceHost]\n\t\t\t\t}\n\t\t\t\t// Otherwise, return the host value.\n\t\t\t\treturn target[key as keyof typescript.LanguageServiceHost]\n\t\t\t},\n\t\t})\n\t}\n}\n\n/**\n * Composes multiple HostDecorator functions into a single decorator.\n *\n * This utility allows combining multiple independent decorators that each modify\n * different aspects of the TypeScript LanguageServiceHost. The decorators are\n * applied in the order they are provided (first to last).\n *\n * The composition works by chaining decorators, where each decorator receives\n * the result of applying all previous decorators.\n *\n * @param decorators - Array of HostDecorator functions to compose\n * @returns A single HostDecorator that applies all the provided decorators\n * @example\n * ```typescript\n * // Combine multiple decorators into one\n * const combinedDecorator = decorateHost(\n * scriptKindDecorator,\n * moduleResolverDecorator,\n * scriptSnapshotDecorator\n * )\n *\n * // Apply all decorators at once\n * const decoratedHost = combinedDecorator(createInfo, typescript, logger, config, fao)\n * ```\n */\nexport const decorateHost = (...decorators: HostDecorator[]): HostDecorator => {\n\treturn (createInfo, ...rest) => {\n\t\tif (decorators.length === 0) {\n\t\t\treturn createInfo.languageServiceHost\n\t\t}\n\n\t\tconst [nextDecorator, ...restDecorators] = decorators\n\n\t\tconst decoratedHost = nextDecorator(createInfo, ...rest)\n\n\t\tconst decoratedCreateInfo = new Proxy(createInfo, {\n\t\t\tget(target, key) {\n\t\t\t\tif (key === 'languageServiceHost') {\n\t\t\t\t\treturn decoratedHost\n\t\t\t\t}\n\t\t\t\treturn target[key as keyof typeof target]\n\t\t\t},\n\t\t})\n\n\t\treturn decorateHost(...restDecorators)(decoratedCreateInfo, ...rest)\n\t}\n}\n","import type typescript from 'typescript/lib/tsserverlibrary.js'\n\n/**\n * Interface for the logger used throughout the ts-plugin.\n * Provides standard logging methods with consistent formatting.\n *\n * All log messages are prefixed with `[tevm-ts-plugin]` for easier identification\n * in TypeScript server logs.\n *\n * @see {@link createLogger} - Factory function to create a logger instance\n */\nexport type Logger = {\n\tinfo: (msg: string) => void\n\twarn: (msg: string) => void\n\terror: (msg: string) => void\n\tlog: (msg: string) => void\n}\n\n/**\n * Creates a logger that forwards messages to the TypeScript language service logger.\n *\n * This factory wraps the TypeScript project service logger to provide consistent\n * formatting and logging levels for the Tevm TypeScript plugin. All messages are\n * prefixed with `[tevm-ts-plugin]` and appropriate level indicators for easier\n * identification in the TypeScript server logs.\n *\n * @param pluginCreateInfo - The TypeScript plugin creation info containing the project service\n * @returns A Logger instance with info, warn, error, and log methods\n * @see {@link Logger} - The logger interface\n *\n * @example\n * ```typescript\n * // Create a logger from plugin creation info\n * const logger = createLogger(createInfo);\n *\n * // Log messages at different levels\n * logger.info('Plugin initialized');\n * logger.warn('Config file not found, using defaults');\n * logger.error('Failed to compile contract');\n * logger.log('Processing file: Contract.sol');\n * ```\n */\nexport const createLogger = (pluginCreateInfo: typescript.server.PluginCreateInfo): Logger => {\n\tconst info = (msg: string) => pluginCreateInfo.project.projectService.logger.info(`[tevm-ts-plugin] ${msg}`)\n\tconst warn = (msg: string) => pluginCreateInfo.project.projectService.logger.info(`[tevm-ts-plugin] warning: ${msg}`)\n\tconst error = (msg: string) => pluginCreateInfo.project.projectService.logger.info(`[tevm-ts-plugin] error: ${msg}`)\n\tconst log = (msg: string) => pluginCreateInfo.project.projectService.logger.info(`[tevm-ts-plugin] log: ${msg}`)\n\treturn { info, warn, error, log }\n}\n","export * from './decorator.js'\nexport * from './logger.js'\n","import { createHostDecorator } from '../factories/index.js'\nimport { isRelativeSolidity, isSolidity } from '../utils/index.js'\n\n/**\n * Decorate `LangaugeServerHost.getScriptKind` to return TS type for `.sol` files\n * This lets the ts-server expect `.sol` files to resolve to `.d.ts` files in `resolveModuleNameLiterals`\n */\nexport const getScriptKindDecorator = createHostDecorator((createInfo, ts, _logger, _config) => {\n\treturn {\n\t\tgetScriptKind: (fileName) => {\n\t\t\t// TODO we should check if it is using ts baseUrl or paths in future\n\t\t\tif (isRelativeSolidity(fileName)) {\n\t\t\t\treturn ts.ScriptKind.TS\n\t\t\t}\n\t\t\tif (isSolidity(fileName)) {\n\t\t\t\treturn ts.ScriptKind.External\n\t\t\t}\n\t\t\tif (!createInfo.languageServiceHost.getScriptKind) {\n\t\t\t\treturn ts.ScriptKind.Unknown\n\t\t\t}\n\t\t\treturn createInfo.languageServiceHost.getScriptKind(fileName)\n\t\t},\n\t}\n})\n","import { minimatch } from 'minimatch'\n\n/**\n * Resolves JSON files as const if they match the config\n * @param config The configuration object\n * @param jsonFilePath The path to the JSON file\n * @param fao File Access Object\n * @param languageServiceHost The language service host\n * @param ts TypeScript object\n * @returns A script snapshot or undefined\n */\nexport const resolveJsonAsConst = (config: any, jsonFilePath: string, fao: any, languageServiceHost: any, ts: any) => {\n\tfor (const matcher of config.jsonAsConst) {\n\t\tif (minimatch(jsonFilePath, matcher)) {\n\t\t\tconst jsonString = fao.readFileSync(jsonFilePath, 'utf8')\n\t\t\treturn ts.ScriptSnapshot.fromString(`export default ${jsonString} as const`)\n\t\t}\n\t}\n\treturn languageServiceHost.getScriptSnapshot(jsonFilePath)\n}\n","import { existsSync, writeFileSync } from 'node:fs'\nimport { bundler } from '@tevm/base-bundler'\nimport type { Cache } from '@tevm/bundler-cache'\nimport * as solc from 'solc'\nimport { createHostDecorator } from '../factories/index.js'\nimport { isSolidity } from '../utils/index.js'\nimport { resolveJsonAsConst } from '../utils/resolveJsonAsConst.js'\n\n/**\n * Decorate `LangaugeServerHost.getScriptSnapshot` to return generated `.d.ts` file for `.sol` files\n * This will allow the language server to provide intellisense for `.sol` files\n * @see https://github.com/wagmi-dev/wagmi/blob/main/packages/cli/src/plugins/foundry.ts\n * TODO replace with modules for code reuse\n */\nexport const getScriptSnapshotDecorator = (solcCache: Cache) =>\n\tcreateHostDecorator(({ languageServiceHost }, ts, logger, config, fao) => {\n\t\treturn {\n\t\t\tgetScriptSnapshot: (filePath) => {\n\t\t\t\tif (filePath.endsWith('.json')) {\n\t\t\t\t\treturn resolveJsonAsConst(config, filePath, fao, languageServiceHost, ts)\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\t!isSolidity(filePath) ||\n\t\t\t\t\t!existsSync(filePath) ||\n\t\t\t\t\texistsSync(`${filePath}.d.ts`) ||\n\t\t\t\t\texistsSync(`${filePath}.ts`)\n\t\t\t\t) {\n\t\t\t\t\treturn languageServiceHost.getScriptSnapshot(filePath)\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst plugin = bundler(config, logger as any, fao, solc, solcCache)\n\t\t\t\t\tconst resolveBytecode = filePath.endsWith('.s.sol')\n\t\t\t\t\tconst snapshot = plugin.resolveDtsSync(filePath, process.cwd(), false, resolveBytecode)\n\t\t\t\t\tif (config.debug) {\n\t\t\t\t\t\twriteFileSync(\n\t\t\t\t\t\t\t`${filePath}.debug.d.ts`,\n\t\t\t\t\t\t\t`// Debug: the following snapshot is what tevm resolves ${filePath} to\\n${snapshot.code}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\treturn ts.ScriptSnapshot.fromString(snapshot.code)\n\t\t\t\t} catch (e) {\n\t\t\t\t\tlogger.error(`@tevm/ts-plugin: getScriptSnapshotDecorator was unable to resolve dts for ${filePath}`)\n\t\t\t\t\tlogger.error(e as any)\n\t\t\t\t\treturn ts.ScriptSnapshot.fromString('export {}')\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t})\n","import { createHostDecorator } from '../factories/index.js'\nimport { solidityModuleResolver } from '../utils/index.js'\nimport { invariant } from '../utils/invariant.js'\n\n/**\n * Decorate `LangaugeServerHost.resolveModuleNameLiterals` to return config object to resolve `.sol` files\n * This tells the ts-server to resolve `.sol` files to `.d.ts` files with `getScriptSnapshot`\n */\nexport const resolveModuleNameLiteralsDecorator = createHostDecorator((createInfo, ts, logger, config) => {\n\treturn {\n\t\tresolveModuleNameLiterals: (moduleNames, containingFile, ...rest) => {\n\t\t\tconst resolvedModules = createInfo.languageServiceHost.resolveModuleNameLiterals?.(\n\t\t\t\tmoduleNames,\n\t\t\t\tcontainingFile,\n\t\t\t\t...rest,\n\t\t\t)\n\n\t\t\treturn moduleNames.map(({ text: moduleName }, index) => {\n\t\t\t\tlet remappedName = moduleName\n\t\t\t\tObject.entries(config.remappings).forEach(([from, to]) => {\n\t\t\t\t\tif (moduleName.startsWith(from)) {\n\t\t\t\t\t\tremappedName = moduleName.replace(from, to)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\tinvariant(resolvedModules, 'Expected \"resolvedModules\" to be defined.')\n\t\t\t\ttry {\n\t\t\t\t\tconst resolvedModule = solidityModuleResolver(remappedName, ts, createInfo, containingFile)\n\t\t\t\t\tif (resolvedModule) {\n\t\t\t\t\t\treturn { resolvedModule }\n\t\t\t\t\t}\n\t\t\t\t\treturn resolvedModules[index]\n\t\t\t\t} catch (e) {\n\t\t\t\t\tlogger.error(e as string)\n\t\t\t\t\treturn resolvedModules[index]\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t}\n})\n","export * from './getScriptKind.js'\nexport * from './getScriptSnapshot.js'\nexport * from './resolveModuleNameLiterals.js'\n","import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'\nimport { access, mkdir, readFile, stat, writeFile } from 'node:fs/promises'\nimport type { FileAccessObject } from '@tevm/base-bundler'\nimport type typescript from 'typescript/lib/tsserverlibrary.js'\n\n/**\n * Creates a FileAccessObject implementation that uses the TypeScript LanguageServiceHost\n * to read and write files.\n *\n * This adapter allows the Tevm bundler to interact with the TypeScript language service's\n * virtual file system rather than directly with the real file system. The LSP maintains\n * its own view of files, which may include unsaved changes not yet written to disk.\n *\n * @param lsHost - The TypeScript language service host providing file access\n * @returns A FileAccessObject implementation that delegates to the LanguageServiceHost\n */\nexport const createFileAccessObject = (lsHost: typescript.LanguageServiceHost): FileAccessObject => {\n\treturn {\n\t\texistsSync: (fileName) => lsHost.fileExists(fileName),\n\t\treadFileSync: (fileName, encoding) => {\n\t\t\tconst file = lsHost.readFile(fileName, encoding)\n\t\t\tif (!file) {\n\t\t\t\tthrow new Error(`@tevm/ts-plugin: unable to read file ${fileName}`)\n\t\t\t}\n\t\t\treturn file\n\t\t},\n\t\twriteFileSync: (fileName, data) => {\n\t\t\tlsHost.writeFile?.(fileName, data)\n\t\t},\n\t\t// TODO clean this up. This works fine only because only the cache needs them and the cache is operating on a real file system and not a virtual one\n\t\t// These are just stubs to match interface since making multiple interfaces is tedious atm\n\t\texists: async (fileName) => {\n\t\t\treturn lsHost.fileExists(fileName)\n\t\t},\n\t\treadFile: async (fileName, encoding) => {\n\t\t\tconst file = lsHost.readFile(fileName, encoding)\n\t\t\tif (!file) {\n\t\t\t\tthrow new Error(`@tevm/ts-plugin: unable to read file ${fileName}`)\n\t\t\t}\n\t\t\treturn file\n\t\t},\n\t\tstat,\n\t\tstatSync,\n\t\tmkdirSync,\n\t\tmkdir,\n\t\twriteFile,\n\t}\n}\n\n/**\n * Creates a FileAccessObject implementation that uses the real filesystem.\n *\n * This implementation directly uses Node.js fs/fs.promises APIs to access the\n * actual filesystem rather than the TypeScript language service's virtual filesystem.\n * It's primarily used for operations that need to persist outside the language\n * service context, such as caching.\n *\n * @returns A FileAccessObject implementation using real filesystem access\n */\nexport const createRealFileAccessObject = (): FileAccessObject => {\n\treturn {\n\t\treadFile,\n\t\texistsSync,\n\t\treadFileSync,\n\t\twriteFileSync,\n\t\tstatSync,\n\t\tstat,\n\t\tmkdirSync,\n\t\tmkdir,\n\t\twriteFile,\n\t\texists: async (fileName) => {\n\t\t\ttry {\n\t\t\t\tawait access(fileName)\n\t\t\t\treturn true\n\t\t\t} catch (_e) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t},\n\t}\n}\n","import { createCache } from '@tevm/bundler-cache'\nimport { defaultConfig, loadConfig } from '@tevm/config'\nimport { catchTag, logWarning, map, runSync } from 'effect/Effect'\nimport type typescript from 'typescript/lib/tsserverlibrary.js'\nimport { getDefinitionServiceDecorator } from './decorators/getDefinitionAtPosition.js'\nimport {\n\tgetScriptKindDecorator,\n\tgetScriptSnapshotDecorator,\n\tresolveModuleNameLiteralsDecorator,\n} from './decorators/index.js'\nimport { createFileAccessObject, createRealFileAccessObject } from './factories/fileAccessObject.js'\nimport { createLogger, decorateHost } from './factories/index.js'\nimport { isSolidity } from './utils/index.js'\n\n/**\n * TypeScript server plugin factory that enables Solidity support in TypeScript.\n * This plugin allows direct importing of .sol files in TypeScript with proper\n * type definitions, code navigation, and IDE support.\n *\n * The plugin works by decorating the TypeScript language service to handle\n * Solidity files, compile them with solc, and provide TypeScript definitions.\n *\n * Add to your tsconfig.json:\n * @example\n * ```json\n * {\n * \"compilerOptions\": {\n * \"plugins\": [{ \"name\": \"tevm-ts-plugin\" }]\n * }\n * }\n * ```\n *\n * @see https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin\n * @see https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin#decorator-creation\n */\nexport const tsPlugin: typescript.server.PluginModuleFactory = (modules) => {\n\treturn {\n\t\tcreate: (createInfo) => {\n\t\t\tconst logger = createLogger(createInfo)\n\n\t\t\tconst config = runSync(\n\t\t\t\tloadConfig(createInfo.project.getCurrentDirectory()).pipe(\n\t\t\t\t\tcatchTag('FailedToReadConfigError', () =>\n\t\t\t\t\t\tlogWarning('Unable to find tevm.config.json. Using default config.').pipe(map(() => defaultConfig)),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t)\n\t\t\t// this fao uses the lsp not the real file system\n\t\t\tconst fao = createFileAccessObject(createInfo.languageServiceHost)\n\t\t\tconst cache = createCache(\n\t\t\t\tconfig.cacheDir,\n\t\t\t\t// this fao uses real file system\n\t\t\t\t// TODO we want to handle the case where fs doesn't exist\n\t\t\t\tcreateRealFileAccessObject(),\n\t\t\t\tcreateInfo.project.getCurrentDirectory(),\n\t\t\t)\n\t\t\tconst service = getDefinitionServiceDecorator(\n\t\t\t\tmodules.typescript.createLanguageService(\n\t\t\t\t\tdecorateHost(getScriptKindDecorator, resolveModuleNameLiteralsDecorator, getScriptSnapshotDecorator(cache))(\n\t\t\t\t\t\tcreateInfo,\n\t\t\t\t\t\tmodules.typescr