Files
aitbc/dev/env/node_modules/@nomicfoundation/solidity-analyzer/README.md
aitbc 816e258d4c refactor: move brother_node development artifact to dev/test-nodes subdirectory
Development Artifact Cleanup:
 BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location
- dev/test-nodes/brother_node/: Moved from root directory for better organization
- Contains development configuration, test logs, and test chain data
- No impact on production systems - purely development/testing artifact

 DEVELOPMENT ARTIFACTS IDENTIFIED:
- Chain ID: aitbc-brother-chain (test/development chain)
- Ports: 8010 (P2P) and 8011 (RPC) - different from production
- Environment: .env file with test configuration
- Logs: rpc.log and node.log from development testing session (March 15, 2026)

 ROOT DIRECTORY CLEANUP: Removed development clutter from production directory
- brother_node/ moved to dev/test-nodes/brother_node/
- Root directory now contains only production-ready components
- Development artifacts properly organized in dev/ subdirectory

DIRECTORY STRUCTURE IMPROVEMENT:
📁 dev/test-nodes/: Development and testing node configurations
🏗️ Root Directory: Clean production structure with only essential components
🧪 Development Isolation: Test environments separated from production

BENEFITS:
 Clean Production Directory: No development artifacts in root
 Better Organization: Development nodes grouped in dev/ subdirectory
 Clear Separation: Production vs development environments clearly distinguished
 Maintainability: Easier to identify and manage development components

RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
2026-03-30 17:09:06 +02:00

58 lines
1.5 KiB
Markdown
Executable File

# `@nomicfoundation/solidity-analyzer`
`@nomicfoundation/solidity-analyzer` is an N-API library built in Rust, which exposes a single function, which takes the contents of a Solidity source file and returns its imports and version pragmas.
## Installation
```bash
npm install @nomicfoundation/solidity-analyzer
```
## API
```ts
export interface AnalysisResult {
versionPragmas: Array<string>;
imports: Array<string>;
}
export function analyze(input: string): AnalysisResult;
```
## Example
```ts
analyze(`
pragma solidity ^0.8.0;
import "./file.sol";
`);
// { versionPragmas: [ '^0.8.0' ], imports: [ './file.sol' ] }
```
## Goals
This library has two different goals:
1. Being fast
2. Being error-tolerant
Both are achieved by not parsing the Solidity source but just tokenizing it instead. This allows us to create a simple state machine that only recognizes imports and pragmas, ignoring everything else, and recovering from malformed tokens or expressions.
## Browser support
This library doesn't work in a browser.
## Testing
This project has some JavaScript unit tests in `__test__`, and it's also tested using the entire [`smart-contract-sanctuary`](https://github.com/tintinweb/smart-contract-sanctuary).
You can find the scripts to test with the sanctuary in `test-with-sanctuary/`.
## Regenerating `index.js` and `index.d.ts`
These files have to be committed because of our current Github Actions, yet, they are autogenerated.
You can run `cargo clean`, `yarn clean`, and `yarn build` to recreate them.