All Projects → kwelch → Babel Plugin Captains Log

kwelch / Babel Plugin Captains Log

Licence: mit
Babel plugin that injects helpful details into console statements

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Babel Plugin Captains Log

Babel Plugin Sitrep
Log all assignments and the return value of a function with a simple comment
Stars: ✭ 442 (+452.5%)
Mutual labels:  babel, babel-plugin, logging
Htm
Hyperscript Tagged Markup: JSX alternative using standard tagged templates, with compiler support.
Stars: ✭ 7,299 (+9023.75%)
Mutual labels:  babel, babel-plugin
Cabin
🌲 Cabin is the best JavaScript and Node.js logging service and logging npm package
Stars: ✭ 622 (+677.5%)
Mutual labels:  utility, logging
Postjss
Use the power of PostCSS in compiling with JSS
Stars: ✭ 40 (-50%)
Mutual labels:  babel, babel-plugin
I18nize React
Internationalize react apps within a lunch break
Stars: ✭ 389 (+386.25%)
Mutual labels:  babel, babel-plugin
Faster.js
faster.js is a Babel plugin that compiles idiomatic Javascript to faster, micro-optimized Javascript.
Stars: ✭ 429 (+436.25%)
Mutual labels:  babel, babel-plugin
Babel Plugin Styled Components
Improve the debugging experience and add server-side rendering support to styled-components
Stars: ✭ 878 (+997.5%)
Mutual labels:  babel, babel-plugin
Effectfuljs
JavaScript embedded effects compiler
Stars: ✭ 287 (+258.75%)
Mutual labels:  babel, babel-plugin
Babel Plugin Root Import
Add the opportunity to import modules by the root path
Stars: ✭ 1,084 (+1255%)
Mutual labels:  babel, babel-plugin
Babel Plugin Css Prop
Babel plugin to transpile `css` prop to a styled component. (Experimental)
Stars: ✭ 56 (-30%)
Mutual labels:  babel, babel-plugin
Tinker.macro
Evaluate Laravel code at build-time, via Laravel Tinker
Stars: ✭ 56 (-30%)
Mutual labels:  babel, babel-plugin
Babel Plugin React Remove Properties
Babel plugin for removing React properties. 💨
Stars: ✭ 327 (+308.75%)
Mutual labels:  babel, babel-plugin
Babel Plugin Tailwind Components
Use Tailwind with any CSS-in-JS library
Stars: ✭ 320 (+300%)
Mutual labels:  babel, babel-plugin
Sowing Machine
🌱A React UI toolchain & JSX alternative
Stars: ✭ 64 (-20%)
Mutual labels:  babel, babel-plugin
Babel Plugin Css Modules Transform
Extract css class names from required css module files, so we can render it on server.
Stars: ✭ 318 (+297.5%)
Mutual labels:  babel, babel-plugin
Babel Plugin Transform React Remove Prop Types
Remove unnecessary React propTypes from the production build. 🎈
Stars: ✭ 890 (+1012.5%)
Mutual labels:  babel, babel-plugin
Babel Plugin Console
Babel Plugin that adds useful build time console functions 🎮
Stars: ✭ 278 (+247.5%)
Mutual labels:  babel, babel-plugin
Babel Plugin Module Resolver
Custom module resolver plugin for Babel
Stars: ✭ 3,134 (+3817.5%)
Mutual labels:  babel, babel-plugin
Xwasm
[Work In Progress] WebAssembly Packager and WASM tooling for modern frontend
Stars: ✭ 45 (-43.75%)
Mutual labels:  babel, babel-plugin
Babel Plugin Partial Application
[DEPRECATED] Please use https://github.com/citycide/param.macro
Stars: ✭ 60 (-25%)
Mutual labels:  babel, babel-plugin

Captain's Log (☠️)

version downloads Travis Build Status codecov

MIT License All Contributors semantic-release

Watch on GitHub Star on GitHub Tweet

Usage

babel-plugin-captains-log injects helpful details into console statements.

Default behavior:

  • prepend console statement file & location
  • add inject variable name into console statements

Transforms

function add(a = 1, b = 2) {
  console.log(a); // outputs: 1
  return a + b;
}
↓ ↓ ↓ ↓ ↓ ↓
function add(a = 1, b = 2) {
  console.log("simple.js(2:2)", "a", a); // outputs: "simple.js(2:2)" "a" 1
  return a + b;
}

See the Issues for a future features and opportunities to contribute.

Requirements

This is a Babel plugin so it requires Babel v6 to run.

Installation

This module is distributed using npm which comes bundled with node:

npm install --save-dev babel-plugin-captains-log

To include the plugin in your project, create or open your .babelrc file at the root of your project. Then, add namespaces to your plugin list:

{
  plugins: ["babel-plugin-captains-log"]
}

Options

Methods

This option provides control over which console statements are adjusted. Methods is set within your .babelrc as an array.

Default: ["debug", "error", "exception", "info", "log", "warn"]

{
  plugins: [
    ["babel-plugin-captains-log", {
      "methods": ['debug', 'info']
    }]
  ]
}

Ignore Patterns

This option provides control over which files are adjusted. Ignore Patterns is set within your .babelrc as an array of strings.

Default: ["node_modules"]

{
  plugins: [
    ["babel-plugin-captains-log", {
      "ignorePatterns": ["node_modules", ".spec.js"]
    }]
  ]
}

Use a logger other then console

This option provides control over which files are adjusted. Ignore Patterns is set within your .babelrc as an array of strings.

Default: "console"

{
  plugins: [
    ["babel-plugin-captains-log", {
      "loggerName": "logger"
    }]
  ]
}

Flags

Flags are values set for all methods and are used to turn that feature on or off. Flags are not merged with defaults to allow for maximum control.

Variable Name Labels

Default: true

{
  plugins: [
    ["babel-plugin-captains-log", {
      "injectVariableName": true
    }]
  ]
}

File Location Data

Default: true

{
  plugins: [
    ["babel-plugin-captains-log", {
      "injectFileName": true
    }]
  ]
}

Inject Scope (Experimental)

This has a few issues with other plugins particularly react-hot-loader, as it changes method names. Also, it was written for recursion which adds too much noise to the console statement which is against this libraries purpose

Default: false

{
  plugins: [
    ["babel-plugin-captains-log", {
      "injectScope": true
    }]
  ]
}

License

MIT

Contributors

Thanks goes to these wonderful people (emoji key):


Kyle Welch

💻 📖 ⚠️

Maksim

🐛

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].