This commit is contained in:
lalBi94
2023-03-05 13:23:23 +01:00
commit 7bc56c09b5
14034 changed files with 1834369 additions and 0 deletions

184
node_modules/istanbul-lib-hook/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,184 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@3.0.0-alpha.2...istanbul-lib-hook@3.0.0) (2019-12-20)
**Note:** Version bump only for package istanbul-lib-hook
# [3.0.0-alpha.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@3.0.0-alpha.1...istanbul-lib-hook@3.0.0-alpha.2) (2019-12-07)
**Note:** Version bump only for package istanbul-lib-hook
# [3.0.0-alpha.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@3.0.0-alpha.0...istanbul-lib-hook@3.0.0-alpha.1) (2019-10-06)
### Bug Fixes
* **package:** update append-transform to version 2.0.0 ([#466](https://github.com/istanbuljs/istanbuljs/issues/466)) ([7344b2b](https://github.com/istanbuljs/istanbuljs/commit/7344b2b))
# [3.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@2.0.7...istanbul-lib-hook@3.0.0-alpha.0) (2019-06-19)
### Features
* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539))
### BREAKING CHANGES
* Node.js 8 is now required
## [2.0.7](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@2.0.6...istanbul-lib-hook@2.0.7) (2019-04-24)
**Note:** Version bump only for package istanbul-lib-hook
## [2.0.6](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@2.0.5...istanbul-lib-hook@2.0.6) (2019-04-09)
**Note:** Version bump only for package istanbul-lib-hook
## [2.0.5](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@2.0.4...istanbul-lib-hook@2.0.5) (2019-04-03)
**Note:** Version bump only for package istanbul-lib-hook
## [2.0.4](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@2.0.3...istanbul-lib-hook@2.0.4) (2019-03-12)
**Note:** Version bump only for package istanbul-lib-hook
## [2.0.3](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@2.0.2...istanbul-lib-hook@2.0.3) (2019-01-26)
**Note:** Version bump only for package istanbul-lib-hook
<a name="2.0.2"></a>
## [2.0.2](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@2.0.1...istanbul-lib-hook@2.0.2) (2018-12-25)
**Note:** Version bump only for package istanbul-lib-hook
<a name="2.0.1"></a>
## [2.0.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@2.0.0...istanbul-lib-hook@2.0.1) (2018-07-07)
**Note:** Version bump only for package istanbul-lib-hook
<a name="2.0.0"></a>
# [2.0.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@1.2.1...istanbul-lib-hook@2.0.0) (2018-06-06)
### Bug Fixes
* 1.2.x should have been a breaking change ([#181](https://github.com/istanbuljs/istanbuljs/issues/181)) ([2872835](https://github.com/istanbuljs/istanbuljs/commit/2872835))
### BREAKING CHANGES
* the closure provied to hookRequire, hookRunInThisContext, etc., is now passed an object with a filename member, rather than a string representing filename.
<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)
### Bug Fixes
* 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))
<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)
### 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>
# [1.1.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@1.0.7...istanbul-lib-hook@1.1.0) (2017-10-21)
### Features
* hook vm.runInContext ([#90](https://github.com/istanbuljs/istanbuljs/issues/90)) ([9659936](https://github.com/istanbuljs/istanbuljs/commit/9659936))
<a name="1.0.7"></a>
## [1.0.7](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-hook@1.0.6...istanbul-lib-hook@1.0.7) (2017-05-27)
<a name="1.0.6"></a>
## [1.0.6](https://github.com/istanbuljs/istanbul-lib-hook/compare/istanbul-lib-hook@1.0.5...istanbul-lib-hook@1.0.6) (2017-04-29)
<a name="1.0.5"></a>
## [1.0.5](https://github.com/istanbuljs/istanbul-lib-hook/compare/istanbul-lib-hook@1.0.4...istanbul-lib-hook@1.0.5) (2017-03-27)
<a name="1.0.4"></a>
## [1.0.4](https://github.com/istanbuljs/istanbul-lib-hook/compare/istanbul-lib-hook@1.0.3...istanbul-lib-hook@1.0.4) (2017-03-21)
<a name="1.0.3"></a>
## [1.0.3](https://github.com/istanbuljs/istanbul-lib-hook/compare/istanbul-lib-hook@1.0.2...istanbul-lib-hook@1.0.3) (2017-03-21)
<a name="1.0.2"></a>
## [1.0.2](https://github.com/istanbuljs/istanbul-lib-hook/compare/istanbul-lib-hook@1.0.0...istanbul-lib-hook@1.0.2) (2017-03-21)
<a name="1.0.0"></a>
# [1.0.0](https://github.com/istanbuljs/istanbul-lib-hook/compare/v1.0.0-alpha.3...v1.0.0) (2017-01-17)
### Bug Fixes
* update append-transform to version that fixes issues run into by ts-node ([f4aaf79](https://github.com/istanbuljs/istanbul-lib-hook/commit/f4aaf79))

24
node_modules/istanbul-lib-hook/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,24 @@
Copyright 2012-2015 Yahoo! Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Yahoo! Inc. nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

6
node_modules/istanbul-lib-hook/README.md generated vendored Normal file
View File

@@ -0,0 +1,6 @@
# istanbul-lib-hook
[![Greenkeeper badge](https://badges.greenkeeper.io/istanbuljs/istanbul-lib-hook.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/istanbuljs/istanbul-lib-hook.svg?branch=master)](https://travis-ci.org/istanbuljs/istanbul-lib-hook)
Hooks for require, vm and script used in istanbul

6
node_modules/istanbul-lib-hook/index.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
'use strict';
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
module.exports = require('./lib/hook');

237
node_modules/istanbul-lib-hook/lib/hook.js generated vendored Normal file
View File

@@ -0,0 +1,237 @@
'use strict';
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
const path = require('path');
const vm = require('vm');
const appendTransform = require('append-transform');
const originalCreateScript = vm.createScript;
const originalRunInThisContext = vm.runInThisContext;
const originalRunInContext = vm.runInContext;
function transformFn(matcher, transformer, verbose) {
return function(code, options) {
options = options || {};
// prior to 2.x, hookRequire returned filename
// rather than object.
if (typeof options === 'string') {
options = { filename: options };
}
const shouldHook =
typeof options.filename === 'string' &&
matcher(path.resolve(options.filename));
let transformed;
let changed = false;
if (shouldHook) {
if (verbose) {
console.error(
'Module load hook: transform [' + options.filename + ']'
);
}
try {
transformed = transformer(code, options);
changed = true;
} catch (ex) {
console.error(
'Transformation error for',
options.filename,
'; return original code'
);
console.error(ex.message || String(ex));
if (verbose) {
console.error(ex.stack);
}
transformed = code;
}
} else {
transformed = code;
}
return { code: transformed, changed };
};
}
/**
* unloads the required caches, removing all files that would have matched
* the supplied matcher.
* @param {Function} matcher - the match function that accepts a file name and
* returns if that file should be unloaded from the cache.
*/
function unloadRequireCache(matcher) {
/* istanbul ignore else: impossible to test */
if (matcher && typeof require !== 'undefined' && require && require.cache) {
Object.keys(require.cache).forEach(filename => {
if (matcher(filename)) {
delete require.cache[filename];
}
});
}
}
/**
* hooks `require` to return transformed code to the node module loader.
* Exceptions in the transform result in the original code being used instead.
* @method hookRequire
* @static
* @param matcher {Function(filePath)} a function that is called with the absolute path to the file being
* `require`-d. Should return a truthy value when transformations need to be applied to the code, a falsy value otherwise
* @param transformer {Function(code, filePath)} a function called with the original code and the associated path of the file
* from where the code was loaded. Should return the transformed code.
* @param options {Object} options Optional.
* @param {Boolean} [options.verbose] write a line to standard error every time the transformer is called
* @param {Function} [options.postLoadHook] a function that is called with the name of the file being
* required. This is called after the require is processed irrespective of whether it was transformed.
* @returns {Function} a reset function that can be called to remove the hook
*/
function hookRequire(matcher, transformer, options) {
options = options || {};
let disable = false;
const fn = transformFn(matcher, transformer, options.verbose);
const postLoadHook =
options.postLoadHook && typeof options.postLoadHook === 'function'
? options.postLoadHook
: null;
const extensions = options.extensions || ['.js'];
extensions.forEach(ext => {
appendTransform((code, filename) => {
if (disable) {
return code;
}
const ret = fn(code, filename);
if (postLoadHook) {
postLoadHook(filename);
}
return ret.code;
}, ext);
});
return function() {
disable = true;
};
}
/**
* hooks `vm.createScript` to return transformed code out of which a `Script` object will be created.
* Exceptions in the transform result in the original code being used instead.
* @method hookCreateScript
* @static
* @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, filePath)} a function called with the original code and the filename passed to
* `vm.createScript`. Should return the transformed code.
* @param options {Object} options Optional.
* @param {Boolean} [options.verbose] write a line to standard error every time the transformer is called
*/
function hookCreateScript(matcher, transformer, opts) {
opts = opts || {};
const fn = transformFn(matcher, transformer, opts.verbose);
vm.createScript = function(code, file) {
const ret = fn(code, file);
return originalCreateScript(ret.code, file);
};
}
/**
* unhooks vm.createScript, restoring it to its original state.
* @method unhookCreateScript
* @static
*/
function unhookCreateScript() {
vm.createScript = originalCreateScript;
}
/**
* hooks `vm.runInThisContext` to return transformed code.
* @method hookRunInThisContext
* @static
* @param matcher {Function(filePath)} a function that is called with the filename passed to `vm.runInThisContext`
* 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 opts {Object} [opts={}] options
* @param {Boolean} [opts.verbose] write a line to standard error every time the transformer is called
*/
function hookRunInThisContext(matcher, transformer, opts) {
opts = opts || {};
const fn = transformFn(matcher, transformer, opts.verbose);
vm.runInThisContext = function(code, options) {
const ret = fn(code, options);
return originalRunInThisContext(ret.code, options);
};
}
/**
* unhooks vm.runInThisContext, restoring it to its original state.
* @method unhookRunInThisContext
* @static
*/
function unhookRunInThisContext() {
vm.runInThisContext = originalRunInThisContext;
}
/**
* hooks `vm.runInContext` to return transformed code.
* @method hookRunInContext
* @static
* @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, 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
* @param {Boolean} [options.verbose] write a line to standard error every time the transformer is called
*/
function hookRunInContext(matcher, transformer, opts) {
opts = opts || {};
const fn = transformFn(matcher, transformer, opts.verbose);
vm.runInContext = function(code, context, file) {
const ret = fn(code, file);
const coverageVariable = opts.coverageVariable || '__coverage__';
// Refer coverage variable in context to global coverage variable.
// So that coverage data will be written in global coverage variable for unit tests run in vm.runInContext.
// If all unit tests are run in vm.runInContext, no global coverage variable will be generated.
// Thus initialize a global coverage variable here.
if (!global[coverageVariable]) {
global[coverageVariable] = {};
}
context[coverageVariable] = global[coverageVariable];
return originalRunInContext(ret.code, context, file);
};
}
/**
* unhooks vm.runInContext, restoring it to its original state.
* @method unhookRunInContext
* @static
*/
function unhookRunInContext() {
vm.runInContext = originalRunInContext;
}
/**
* istanbul-lib-hook provides mechanisms to transform code in the scope of `require`,
* `vm.createScript`, `vm.runInThisContext` etc.
*
* This mechanism is general and relies on a user-supplied `matcher` function that
* determines when transformations should be performed and a user-supplied `transformer`
* function that performs the actual transform. Instrumenting code for coverage is
* one specific example of useful hooking.
*
* Note that both the `matcher` and `transformer` must execute synchronously.
*
* @module Exports
* @example
* var hook = require('istanbul-lib-hook'),
* myMatcher = function (file) { return file.match(/foo/); },
* myTransformer = function (code, file) {
* return 'console.log("' + file + '");' + code;
* };
*
* hook.hookRequire(myMatcher, myTransformer);
* var foo = require('foo'); //will now print foo's module path to console
*/
module.exports = {
hookRequire,
hookCreateScript,
unhookCreateScript,
hookRunInThisContext,
unhookRunInThisContext,
hookRunInContext,
unhookRunInContext,
unloadRequireCache
};

40
node_modules/istanbul-lib-hook/package.json generated vendored Normal file
View File

@@ -0,0 +1,40 @@
{
"name": "istanbul-lib-hook",
"version": "3.0.0",
"description": "Hooks for require, vm and script used in istanbul",
"author": "Krishnan Anantheswaran <kananthmail-github@yahoo.com>",
"main": "index.js",
"files": [
"lib",
"index.js"
],
"scripts": {
"test": "nyc --nycrc-path=../../monorepo-per-package-full.js mocha"
},
"dependencies": {
"append-transform": "^2.0.0"
},
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^6.2.2",
"nyc": "^15.0.0-beta.2"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/istanbuljs/istanbuljs.git",
"directory": "packages/istanbul-lib-hook"
},
"keywords": [
"istanbul",
"hook"
],
"license": "BSD-3-Clause",
"bugs": {
"url": "https://github.com/istanbuljs/istanbuljs/issues"
},
"homepage": "https://istanbul.js.org/",
"engines": {
"node": ">=8"
},
"gitHead": "5319df684b508ff6fb19fe8b9a6147a3c5924e4b"
}