Skip to content

Commit

Permalink
add seperate iroh-analysis file to go through all files
Browse files Browse the repository at this point in the history
  • Loading branch information
Driftedboat committed Oct 24, 2024
1 parent 209cf2e commit 829323f
Show file tree
Hide file tree
Showing 8 changed files with 726 additions and 43 deletions.
13 changes: 11 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{
"extends": "nodebb"
}
"env": {
"node": true,
"es6": true
},
"extends": [
"eslint:recommended"
],
"rules": {
"no-undef": "off"
}
}
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ if (nconf.get('setup') || nconf.get('install')) {
require('./src/cli/manage').listEvents();
} else {
require('./src/start').start();
}
}
11 changes: 11 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import pluginReact from "eslint-plugin-react";


export default [
{files: ["**/*.{js,mjs,cjs,jsx}"]},
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
pluginReact.configs.flat.recommended,
];
25 changes: 25 additions & 0 deletions iroh-analyze.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const fs = require('fs');
const path = require('path');
const glob = require('glob');
const Iroh = require('iroh');

let files = glob.sync(path.join(__dirname, 'src/**/*.js'));

files.forEach(file => {
console.log(`Analyzing file: ${file}`);
});

let code = files.map(file => fs.readFileSync(file, 'utf-8')).join('\n');

// Create the Iroh stage with the combined code
let stage = new Iroh.Stage(code);

// Add listeners, if needed
// Example listener to analyze functions:
let listener = stage.addListener(Iroh.FUNCTION);
listener.on("return", (e) => {
console.log(`Function ${e.name} returns value:`, e.return);
});

// Run the stage
eval(stage.script);
14 changes: 8 additions & 6 deletions iroh.config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"analyze": {
"entry": "app.js",
"output": "./iroh-report",
"verbose": true
}
}
"analyze": {
"entry": "simple-app.js",
"output": "./iroh-report",
"verbose": true,
"dynamic": true,
"timeout": 60000
}
}
Loading

0 comments on commit 829323f

Please sign in to comment.