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

istanbul-lib-hook

Package Overview
Dependencies
Maintainers
3
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

istanbul-lib-hook - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

21

CHANGELOG.md

@@ -6,4 +6,4 @@ # Change Log

<a name="1.2.1"></a>
## [1.2.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@1.2.0...istanbul-lib-hook@1.2.1) (2018-06-06)
<a name="1.2.2"></a>
## [1.2.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@1.1.0...istanbul-lib-hook@1.2.2) (2018-09-05)

@@ -13,18 +13,21 @@

* pass correct args to tranformer ([#153](https://github.com/istanbuljs/istanbuljs/issues/153)) ([#154](https://github.com/istanbuljs/istanbuljs/issues/154)) ([2b2250f](https://github.com/istanbuljs/istanbuljs/commit/2b2250f))
* Tweak package.json files for republish as latest 1.x. ([#217](https://github.com/istanbuljs/istanbuljs/issues/217)) ([420481d](https://github.com/istanbuljs/istanbuljs/commit/420481d)), closes [#216](https://github.com/istanbuljs/istanbuljs/issues/216)
### BREAKING CHANGES
* leaked into 1.x modules but it was thought they were
never released to latest. Apparently releasing 2.x to latest makes
those unwanted versions of 1.x available.
<a name="1.2.0"></a>
# [1.2.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@1.1.0...istanbul-lib-hook@1.2.0) (2018-03-04)
This patch sets all modules to the latest 1.x version (4.x for
test-exclude). This will allow a new release to be made to revert
release of the breaking changes.
Stop upgrading npm to latest for testing as it's not compatible with
node 4.x.
### Features
* hookRunInThisContext now takes options object rather than filename ([#99](https://github.com/istanbuljs/istanbuljs/issues/99)) ([1504374](https://github.com/istanbuljs/istanbuljs/commit/1504374))
<a name="1.1.0"></a>

@@ -31,0 +34,0 @@ # [1.1.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@1.0.7...istanbul-lib-hook@1.1.0) (2017-10-21)

@@ -14,9 +14,4 @@ /*

return function (code, options) {
options = options || {};
if (typeof options === 'string') {
options = { filename: options };
}
var shouldHook = typeof options.filename === 'string' && matcher(path.resolve(options.filename)),
return function (code, filename) {
var shouldHook = typeof filename === 'string' && matcher(path.resolve(filename)),
transformed,

@@ -27,9 +22,9 @@ changed = false;

if (verbose) {
console.error('Module load hook: transform [' + options.filename + ']');
console.error('Module load hook: transform [' + filename + ']');
}
try {
transformed = transformer(code, options);
transformed = transformer(code, filename);
changed = true;
} catch (ex) {
console.error('Transformation error for', options.filename, '; return original code');
console.error('Transformation error for', filename, '; return original code');
console.error(ex.message || String(ex));

@@ -137,6 +132,6 @@ if (verbose) {

* @static
* @param matcher {Function(filePath)} a function that is called with the filename passed to `vm.runInThisContext`
* @param matcher {Function(filePath)} a function that is called with the filename passed to `vm.createScript`
* Should return a truthy value when transformations need to be applied to the code, a falsy value otherwise
* @param transformer {Function(code, options)} a function called with the original code and the filename passed to
* `vm.runInThisContext`. Should return the transformed code.
* @param transformer {Function(code, filePath)} a function called with the original code and the filename passed to
* `vm.createScript`. Should return the transformed code.
* @param opts {Object} [opts={}] options

@@ -148,5 +143,5 @@ * @param {Boolean} [opts.verbose] write a line to standard error every time the transformer is called

var fn = transformFn(matcher, transformer, opts.verbose);
vm.runInThisContext = function (code, options) {
var ret = fn(code, options);
return originalRunInThisContext(ret.code, options);
vm.runInThisContext = function (code, file) {
var ret = fn(code, file);
return originalRunInThisContext(ret.code, file);
};

@@ -153,0 +148,0 @@ }

{
"name": "istanbul-lib-hook",
"version": "1.2.1",
"version": "1.2.2",
"description": "Hooks for require, vm and script used in istanbul",

@@ -16,8 +16,8 @@ "author": "Krishnan Anantheswaran <kananthmail-github@yahoo.com>",

"dependencies": {
"append-transform": "^1.0.0"
"append-transform": "^0.4.0"
},
"devDependencies": {
"chai": "^4.1.2",
"jshint": "^2.9.5",
"mocha": "^5.2.0"
"chai": "^3.0.0",
"jshint": "^2.8.0",
"mocha": "^3.2.0"
},

@@ -24,0 +24,0 @@ "repository": {

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