$
This commit is contained in:
61
node_modules/node-preload/CHANGELOG.md
generated
vendored
Normal file
61
node_modules/node-preload/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [0.2.1](https://github.com/cfware/node-preload/compare/v0.2.0...v0.2.1) (2019-12-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Support jumping between node.js versions ([#7](https://github.com/cfware/node-preload/issues/7)) ([68950a0](https://github.com/cfware/node-preload/commit/68950a07ab153cda5e0b5fec1407973169443bbb)), closes [istanbuljs/nyc#1246](https://github.com/istanbuljs/nyc/issues/1246)
|
||||
|
||||
## [0.2.0](https://github.com/cfware/node-preload/compare/v0.1.4...v0.2.0) (2019-12-16)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* The API is completely rewritten, the export is now an
|
||||
Array.
|
||||
* Propagated variables are no longer supported. For this
|
||||
functionality preload a local module which uses `process-on-spawn`
|
||||
directly.
|
||||
|
||||
### Features
|
||||
|
||||
* Use process-on-spawn ([#6](https://github.com/cfware/node-preload/issues/6)) ([2decb3a](https://github.com/cfware/node-preload/commit/2decb3a32a00084d089d964de6440e9f7817d563))
|
||||
|
||||
## [0.1.4](https://github.com/cfware/node-preload/compare/v0.1.3...v0.1.4) (2019-11-01)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Support running under yarn pnp ([#3](https://github.com/cfware/node-preload/issues/3)) ([15d949b](https://github.com/cfware/node-preload/commit/15d949b)), closes [istanbuljs/nyc#1204](https://github.com/istanbuljs/nyc/issues/1204)
|
||||
|
||||
## [0.1.3](https://github.com/cfware/node-preload/compare/v0.1.2...v0.1.3) (2019-10-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Properly handle backslashes in paths on Node.js 12 ([#2](https://github.com/cfware/node-preload/issues/2)) ([2ad4448](https://github.com/cfware/node-preload/commit/2ad4448))
|
||||
|
||||
## [0.1.2](https://github.com/cfware/node-preload/compare/v0.1.1...v0.1.2) (2019-09-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* esm must be loaded from the internal/preload module ([a5444dd](https://github.com/cfware/node-preload/commit/a5444dd))
|
||||
|
||||
## [0.1.1](https://github.com/cfware/node-preload/compare/v0.1.0...v0.1.1) (2019-09-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add `main` to package.json ([6b39401](https://github.com/cfware/node-preload/commit/6b39401))
|
||||
* Handle situations where a preload might require node-preload. ([3b41164](https://github.com/cfware/node-preload/commit/3b41164))
|
||||
|
||||
## 0.1.0 (2019-09-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Initial implementation ([0818e8c](https://github.com/cfware/node-preload/commit/0818e8c))
|
21
node_modules/node-preload/LICENSE
generated
vendored
Normal file
21
node_modules/node-preload/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 CFWare, LLC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
47
node_modules/node-preload/README.md
generated
vendored
Normal file
47
node_modules/node-preload/README.md
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# node-preload
|
||||
|
||||
[![Travis CI][travis-image]][travis-url]
|
||||
[![Greenkeeper badge][gk-image]](https://greenkeeper.io/)
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![MIT][license-image]](LICENSE)
|
||||
|
||||
Request that Node.js child processes preload modules
|
||||
|
||||
### Install node-preload
|
||||
|
||||
This module requires node.js 8 or above.
|
||||
|
||||
```sh
|
||||
npm i node-preload
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
'use strict';
|
||||
|
||||
const preloadList = require('node-preload');
|
||||
|
||||
// Request that all Node.js child processes preload @babel/register
|
||||
preloadList.push(require.resolve('@babel/register'));
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
Worker threads are not directly supported by this module, results may vary.
|
||||
|
||||
## `node-preload` for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of `node-preload` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-node-preload?utm_source=npm-node-preload&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/node-preload.svg
|
||||
[npm-url]: https://npmjs.org/package/node-preload
|
||||
[travis-image]: https://travis-ci.org/cfware/node-preload.svg?branch=master
|
||||
[travis-url]: https://travis-ci.org/cfware/node-preload
|
||||
[gk-image]: https://badges.greenkeeper.io/cfware/node-preload.svg
|
||||
[downloads-image]: https://img.shields.io/npm/dm/node-preload.svg
|
||||
[downloads-url]: https://npmjs.org/package/node-preload
|
||||
[license-image]: https://img.shields.io/npm/l/node-preload.svg
|
31
node_modules/node-preload/generate-require.js
generated
vendored
Normal file
31
node_modules/node-preload/generate-require.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const needsPathRegExp = /[\\ "]/;
|
||||
|
||||
const needsPathEnv = dir => needsPathRegExp.test(dir);
|
||||
|
||||
function generateRequire(filename) {
|
||||
if (needsPathEnv(filename)) {
|
||||
return `--require ${path.basename(filename)}`;
|
||||
}
|
||||
|
||||
return `--require ${filename}`;
|
||||
}
|
||||
|
||||
function processNodePath(value) {
|
||||
const dir = path.dirname(require.resolve('./preload-path/node-preload.js'));
|
||||
const existing = value === '' ? [] : value.split(path.delimiter);
|
||||
if (existing.includes(dir)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return existing.concat(dir).join(path.delimiter);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
generateRequire,
|
||||
processNodePath,
|
||||
needsPathEnv
|
||||
};
|
21
node_modules/node-preload/hook-spawn.js
generated
vendored
Normal file
21
node_modules/node-preload/hook-spawn.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const processOnSpawn = require('process-on-spawn');
|
||||
const {needsPathEnv, processNodePath} = require('./generate-require.js');
|
||||
const processNodeOptions = require('./process-node-options.js');
|
||||
const preloadList = require('./preload-list.js');
|
||||
const preloadListEnv = require('./preload-list-env.js');
|
||||
|
||||
processOnSpawn.addListener(({env}) => {
|
||||
env.NODE_OPTIONS = processNodeOptions(
|
||||
env.NODE_OPTIONS || /* istanbul ignore next: impossible under nyc 15 */ ''
|
||||
);
|
||||
/* istanbul ignore next */
|
||||
if (needsPathEnv(__dirname)) {
|
||||
env.NODE_PATH = processNodePath(env.NODE_PATH || '');
|
||||
}
|
||||
|
||||
env[preloadListEnv] = preloadList.join(path.delimiter);
|
||||
});
|
5
node_modules/node-preload/index.js
generated
vendored
Normal file
5
node_modules/node-preload/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
require('./hook-spawn.js');
|
||||
|
||||
module.exports = require('./preload-list.js');
|
25
node_modules/node-preload/internal-preload-module.js
generated
vendored
Normal file
25
node_modules/node-preload/internal-preload-module.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
function findInternalPreloadModule() {
|
||||
/* This song-and-dance is to keep esm happy. */
|
||||
let mod = module;
|
||||
const seen = new Set([mod]);
|
||||
while ((mod = mod.parent)) {
|
||||
/* Generally if we're being preloaded then
|
||||
* mod.parent.id should be 'internal/preload' */
|
||||
/* istanbul ignore next: paranoia */
|
||||
if (seen.has(mod)) {
|
||||
return module;
|
||||
}
|
||||
|
||||
seen.add(mod);
|
||||
/* istanbul ignore next: this is hit but coverage cannot be collected */
|
||||
if (mod.id === 'internal/preload') {
|
||||
return mod;
|
||||
}
|
||||
}
|
||||
|
||||
return module;
|
||||
}
|
||||
|
||||
module.exports = findInternalPreloadModule();
|
50
node_modules/node-preload/package.json
generated
vendored
Normal file
50
node_modules/node-preload/package.json
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "node-preload",
|
||||
"version": "0.2.1",
|
||||
"description": "Request that Node.js child processes preload modules",
|
||||
"scripts": {
|
||||
"release": "standard-version --sign",
|
||||
"pretest": "xo",
|
||||
"test": "nyc tape test/*.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"main": "index.js",
|
||||
"author": "Corey Farrell",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cfware/node-preload.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/cfware/node-preload/issues"
|
||||
},
|
||||
"homepage": "https://github.com/cfware/node-preload#readme",
|
||||
"dependencies": {
|
||||
"process-on-spawn": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esm": "^3.2.25",
|
||||
"glob": "^7.1.6",
|
||||
"nyc": "^15.0.0-beta.3",
|
||||
"standard-version": "^7.0.0",
|
||||
"tape": "^4.11.0",
|
||||
"xo": "^0.25.3"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"import/no-unassigned-import": [
|
||||
2,
|
||||
{
|
||||
"allow": [
|
||||
"hook-spawn.js"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"ignores": [
|
||||
"fixtures/esm.js"
|
||||
]
|
||||
}
|
||||
}
|
8
node_modules/node-preload/preload-list-env.js
generated
vendored
Normal file
8
node_modules/node-preload/preload-list-env.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const crypto = require('crypto');
|
||||
|
||||
const hash = crypto.createHash('sha1');
|
||||
hash.update(__filename, 'utf8');
|
||||
|
||||
module.exports = `NODE_PRELOAD_${hash.digest('hex')}`;
|
15
node_modules/node-preload/preload-list.js
generated
vendored
Normal file
15
node_modules/node-preload/preload-list.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const preloadListEnv = require('./preload-list-env.js');
|
||||
|
||||
function getPreloadList() {
|
||||
const env = process.env[preloadListEnv];
|
||||
if (!env) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return env.split(path.delimiter);
|
||||
}
|
||||
|
||||
module.exports = getPreloadList();
|
11
node_modules/node-preload/preload-path/node-preload.js
generated
vendored
Normal file
11
node_modules/node-preload/preload-path/node-preload.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const internalPreloadModule = require('../internal-preload-module.js');
|
||||
const preloadList = require('../preload-list.js');
|
||||
|
||||
require('../hook-spawn.js');
|
||||
|
||||
preloadList.forEach(file => {
|
||||
internalPreloadModule.require(file);
|
||||
});
|
||||
|
16
node_modules/node-preload/process-node-options.js
generated
vendored
Normal file
16
node_modules/node-preload/process-node-options.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
const {generateRequire} = require('./generate-require.js');
|
||||
|
||||
function processNodeOptions(value) {
|
||||
const requireSelf = generateRequire(require.resolve('./preload-path/node-preload.js'));
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (!value.includes(requireSelf)) {
|
||||
value = `${value} ${requireSelf}`;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
module.exports = processNodeOptions;
|
Reference in New Issue
Block a user