Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

basisjs-tools-instrumenter

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basisjs-tools-instrumenter - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

4

HISTORY.md

@@ -0,1 +1,5 @@

## 2.1.0 (September 5, 2016)
- Pin `babel-core` version to `^6.0.0`
## 2.0.0 (July 26, 2016)

@@ -2,0 +6,0 @@

6

package.json
{
"name": "basisjs-tools-instrumenter",
"description": "JavaScript source code location instrumenter for basisjs-tools",
"version": "2.0.0",
"version": "2.1.0",
"homepage": "https://github.com/basisjs/basisjs-tools-instumenter",

@@ -17,5 +17,5 @@ "repository": "basisjs/basisjs-tools-instrumenter",

"basisjs-tools-ast": "^1.0.0",
"babel-core": "*",
"babel-plugin-source-wrapper": "^2.0.0-alpha.3"
"babel-core": "^6.0.0",
"babel-plugin-source-wrapper": "^2.0.1"
}
}

@@ -1,3 +0,8 @@

Code instrumenter plugin for basisjs-tools.
# basisjs-tools-instrumenter
[![NPM version](https://img.shields.io/npm/v/basisjs-tools-instrumenter.svg)](https://www.npmjs.com/package/basisjs-tools-instrumenter)
[![Dependency Status](https://img.shields.io/david/basisjs/basisjs-tools-instrumenter.svg)](https://david-dm.org/basisjs/basisjs-tools-instrumenter)
Source code instrumenting plugin for [basisjs-tools](https://github.com/basisjs/basisjs-tools). Based on [Babel](https://github.com/babel/babel) and [babel-plugin-source-wrapper](https://github.com/restrry/babel-plugin-source-wrapper).
## Install

@@ -11,2 +16,4 @@

> NOTE: `basisjs-tools` 1.5 or highest is required.
Add to `basis.config` those settings:

@@ -24,4 +31,2 @@

> NOTE: You need basisjs-tools 1.5 or highest, as basisjs-tools starts support for plugins since 1.5.
You could pass additional parameters for plugin:

@@ -57,3 +62,3 @@

Set custom name for wrap function. This function also will be host of API.
Set custom name for API.

@@ -69,3 +74,3 @@ #### blackbox

This plugins process all `.js` files and modify (instrument) code to reach main goal: provide location information about some object or function, i.e. tell where value was defined. Let's look for simple example:
This plugins process all `.js` files and modify (instrument) code to provide location information about some object or function later, i.e. answer to question where value was defined. Let's look for simple example:

@@ -81,3 +86,3 @@ ```js

After instrumenting this code will looks:
It will be instrumented to:

@@ -102,7 +107,7 @@ ```js

As you can see, some expressions was wrapped by function `$devinfo` (it's name by default, but you can set name via `registratorName` function). This function returns first argument as is. But also associates (attach) second argument (meta info) to first argument. `WeakMap` is used for this.
As you can see, some expressions was wrapped by function `$devinfo()` (default name, but you can set it via `registratorName` option). This function returns first argument as is. But associates (attach) second argument (meta data) to first argument. `WeakMap` is used for that.
Meta info contains infomation about range in source wrapped expression in source (`loc` property). It also could store some additional infomation like map of object value ranges for object literals.
Meta data contains infomation about wrapped expression range in source (`loc` property). It can store additional infomation in some cases, e.g. map of object value ranges for object literals.
As code instrumentation pollute original source plugin adds source map to result. This means you'll see original source in browser developer tools instead of instrumented.
Since instrumentation corrupt original code plugin adds source map to result. It means you'll see original source in browser's developer tools instead of instrumented.

@@ -131,3 +136,3 @@ It also process `.html` files to inject required API to global scope, and adds reference to those API to `basisjs-config` if any found.

Plugin could be used with `webpack`. In this case `webpack` should instrument source code by `Babel` and [babel-plugin-source-wrapper](https://github.com/restrry/babel-plugin-source-wrapper) and `basisjs-tools-instrumenter` should do everything else except instrumenting.
Plugin can be used with `webpack`. In this case `webpack` should instrument source code by `Babel` and [babel-plugin-source-wrapper](https://github.com/restrry/babel-plugin-source-wrapper) and `basisjs-tools-instrumenter` should do everything else except instrumenting.

@@ -134,0 +139,0 @@ Settings for Babel in `webpack.config.js`:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc