{"id":32567252,"url":"https://github.com/zewish/vmod","last_synced_at":"2026-05-14T13:41:31.910Z","repository":{"id":57393529,"uuid":"109867653","full_name":"zewish/vmod","owner":"zewish","description":"Virtual module for node.js","archived":false,"fork":false,"pushed_at":"2023-07-28T14:24:16.000Z","size":120,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-29T05:59:49.947Z","etag":null,"topics":["eval","module","nodejs","safe-evaluation","virtual"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zewish.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-07T17:20:33.000Z","updated_at":"2025-02-11T15:49:51.000Z","dependencies_parsed_at":"2022-09-26T16:51:09.585Z","dependency_job_id":null,"html_url":"https://github.com/zewish/vmod","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/zewish/vmod","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zewish%2Fvmod","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zewish%2Fvmod/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zewish%2Fvmod/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zewish%2Fvmod/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zewish","download_url":"https://codeload.github.com/zewish/vmod/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zewish%2Fvmod/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33027704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eval","module","nodejs","safe-evaluation","virtual"],"created_at":"2025-10-29T05:59:39.726Z","updated_at":"2026-05-14T13:41:31.828Z","avatar_url":"https://github.com/zewish.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM version](https://img.shields.io/npm/v/vmod.svg?style=flat-square)](https://www.npmjs.com/package/vmod)\n[![Downloads](https://img.shields.io/npm/dm/vmod.svg?style=flat-square)](https://www.npmjs.com/package/vmod)\n\nVirtual module for node.js - vmod\n\n- Runs in different script context than your current script;\n- Executes a string of code in require-like environment;\n- Allows you to override globals of the sandbox environment;\n- Returns `module.exports` output;\n- Throws errors that can be caught in your current context;\n\nKnown limitations:\n- console.log, console.warn, console.error, etc. output not visible;\n- Modifications to prototypes of some globals not visible in the vmod context;\n- Only CommonJS modules supported;\n\nInstallation\n------------\n```bash\n$ npm install vmod --save\n```\n\nSimple\n------\n```js\nconst vmod = require('vmod');\n\nconsole.log(\n  vmod('module.exports = 123;')\n); // 123\n```\n\nExport function\n---------------\n```js\nconst vmod = require('vmod');\n\nconsole.log(\n  vmod(\n    'module.exports = () =\u003e \"yay!\";'\n  )()\n); // \"yay!\"\n```\n\nRequire External file\n---------------------\n```js\n/*\n./_test-file.js:\nmodule.exports = \"test file data\";\n*/\n\nconst vmod = require('vmod');\n\nconsole.log(\n  vmod(\n    'module.exports = require(\"./_test-file.js\")'\n  )()\n); // \"test file data\"\n```\n\nOverride sandbox variable\n-------------------------\n```js\nconst vmod = require('vmod');\n\nvmod(\n  'module.exports = require(\"./_test-file.js\")',\n  { require: null }\n); // TypeError: require is not a function\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzewish%2Fvmod","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzewish%2Fvmod","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzewish%2Fvmod/lists"}