神刀安全网

Embeds console output to the code

codemo

Embeds console output to the code

Installation

npm i -S codemo

Usage

const codemo = require('codemo')  codemo   .process("console.log('Hello world!')")   .then(result => consle.log(result))

The result will be

console.log('Hello world!') //> Hello world!

API

codemo.process(code, [opts])

Return a promise with the resulting file combined with output.

  • opts.cwd – the directory in which the code should be executed
  • opts.es6 – whether the code is written using ES6

codemo.processFile(filePath, [opts])

Return a promise with the resulting file combined with output.

  • opts.es6 – whether the code is written using ES6

License

MIT © Zoltan Kochan

Dependencies

  • acorn: ECMAScript parser
  • babel-runtime: babel selfContained runtime
  • callsites: Get callsites from the V8 stack trace API
  • cross-spawn-async: Cross platform child_process#spawn
  • file-position: Given a row/column number, return the index of that character within the whole string
  • lodash.partition: The lodash method _.partition exported as a module.
  • normalize-newline: Normalize the newline characters in a string to /n
  • normalize-path: Normalize file path slashes to be unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes.
  • promise.prototype.finally : A polyfill for Promise.prototype.finally for ES6 compliant promises
  • rollup: Next-generation ES6 module bundler
  • rollup-plugin-babel: Seamless integration between Rollup and Babel.
  • rollup-plugin-includepaths : Rollup plugin to use relative paths in your project files
  • source-map: Generates and consumes source maps

Dev Dependencies

  • babel-cli: Babel command line.
  • babel-plugin-add-module-exports : Fix babel/babel#2212
  • babel-plugin-transform-runtime : Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals
  • babel-preset-es2015: Babel preset for all es2015 plugins.
  • babel-register: babel require hook
  • chai: BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
  • core-js: Standard library
  • cz-conventional-changelog : Commitizen adapter following the conventional-changelog format.
  • eslint: An AST-based pattern checker for JavaScript.
  • eslint-config-standard : JavaScript Standard Style – ESLint Shareable Config
  • eslint-plugin-promise : Enforce best practices for JavaScript promises
  • eslint-plugin-standard : ESlint Plugin for the Standard Linter
  • ghooks: Simple git hooks
  • istanbul: Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests
  • mocha: simple, flexible, fun test framework
  • mos: A pluggable module that injects content into your markdown files via hidden JavaScript snippets
  • promise.prototype.finally : A polyfill for Promise.prototype.finally for ES6 compliant promises
  • semantic-release: automated semver compliant package publishing
  • validate-commit-msg: Script to validate a commit message follows the conventional changelog standard

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Embeds console output to the code

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址