
Product
Microsoft Teams Notifications Are Now Available in Socket
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.
Run CommonJS script in sandbox with customized style
my-runner uses vm module for mocking an CommonJS's script environment. So we can make the environment as your wish.
For example, jest uses customized environment for running test files. And we could use it running browser's script.
npm install my-runner
# or use yarn
yarn add my-runner
const myRunner = require('my-runner')
myRunner.runFile('/path/to/file.js').module.exports
npm i my-runner -g
my-runner --help
Run code script
code {string}opts {{}} (optional, default {})
opts.rootDir string? The run environment's root directory path.opts.myrunnerrc boolean? Whether or not to look up .my-runnerrc or my-runner.config.js file.opts.preset ({} | Function | {name: string, options: any})? A preset that is used as a base for configuration.opts.moduleNameMapper Object<string, string>? A map from regular expressions to module names that allow to stub out resources, like images or styles with a single module.opts.modulePathIgnorePatterns Array<string>? An array of regexp pattern strings that are matched against all module paths before those paths are to be considered 'visible' to the module loader.opts.modulePaths Array<string>? An array of absolute paths to additional locations to search when resolving modules. Use NODE_PATH env variable by default.opts.moduleFileExtensions Array<string> An array of file extensions your modules use. (optional, default ['.js','.json','.jsx','.ts','.tsx','.node'])opts.moduleDirectories Array<string> An array of directory names to be searched recursively up from the requiring module's location. (optional, default ['node_modules'])opts.preserveSymlinks boolean? preserveSymlinksopts.resolver Function? This option allows the use of a custom resolver. More information see jest.opts.browser boolean Respect Browserify's "browser" field in package.json when resolving modules. (optional, default false)opts.transformIgnorePatterns Array<string> An array of regexp pattern strings that are matched against all source file paths before transformation. If the test path matches any of the patterns, it will not be transformed. (optional, default ['/node_modules/'])opts.transform Object<string, (string | Function | {name: string, options: any})> A map from regular expressions to paths to transformers. A transformer is a module that provides a synchronous function for transforming source files. (optional, default {})opts.globalSetup string? This option allows the use of a custom global setup module which exports an async function that is triggered once.opts.globals Object? A set of global variables that need to be available in environments.opts.transformContext Function? A sync function for transforming context.opts.global any The reference on global environment. (optional, default {...global})opts.moduleCache {}? The reference of require.cacheopts.moduleMain {}? The reference of require.mainopts.fs Object The fs module. (optional, default require('fs'))opts.vm Object The vm module. (optional, default require('vm'))Returns RunResult
Run file script
Returns RunResult
Type: {module: {exports}, exports, require, global}
The default options
my-runner had injected myRunner in global.
for example, Mocking prop-types and setting moduleNameMapper to be {"^prop-types$": "/path/to/mock-prop-types.js"}
myRunnerrequireActualRequires the actual module rather than the mock module.
Functiongit checkout -b feature-new or git checkout -b fix-which-buggit commit -am 'feat: some description (close #123)' or git commit -am 'fix: some description (fix #123)'git pushThis library is written and maintained by imcuttle, moyuyc95@gmail.com.
MIT - imcuttle 🐟
FAQs
Run CommonJS script in sandbox with customized style
The npm package my-runner receives a total of 14 weekly downloads. As such, my-runner popularity was classified as not popular.
We found that my-runner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.

Security News
Socket CTO Ahmad Nassri joins AppSec leaders at Black Hat to discuss active malware, package manager risks, and software supply chain defense.