Update node_modules

This commit is contained in:
crazy-max
2020-01-23 08:49:02 +00:00
parent 80426e98c8
commit c8a47ad4bb
9923 changed files with 950627 additions and 38 deletions

21
node_modules/@jest/transform/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Facebook, Inc. and its affiliates.
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.

View File

@@ -0,0 +1,39 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import { Options, TransformResult } from './types';
export default class ScriptTransformer {
private _cache;
private _config;
private _transformCache;
private _transformConfigCache;
constructor(config: Config.ProjectConfig);
private _getCacheKey;
private _getFileCachePath;
private _getTransformPath;
private _getTransformer;
private _instrumentFile;
private _getRealPath;
preloadTransformer(filepath: Config.Path): void;
transformSource(filepath: Config.Path, content: string, instrument: boolean): {
code: string;
mapCoverage: boolean;
sourceMapPath: string | null;
};
private _transformAndBuildScript;
transform(filename: Config.Path, options: Options, fileSource?: string): TransformResult;
transformJson(filename: Config.Path, options: Options, fileSource: string): string;
requireAndTranspileModule<ModuleType = unknown>(moduleName: string, callback?: (module: ModuleType) => void): ModuleType;
requireAndTranspileModule<ModuleType = unknown>(moduleName: string, callback?: (module: ModuleType) => Promise<void>): Promise<ModuleType>;
/**
* @deprecated use `this.shouldTransform` instead
*/
private _shouldTransform;
shouldTransform(filename: Config.Path): boolean;
}
export declare function createTranspilingRequire(config: Config.ProjectConfig): <TModuleType = unknown>(resolverPath: string, applyInteropRequireDefault?: boolean) => TModuleType;
//# sourceMappingURL=ScriptTransformer.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ScriptTransformer.d.ts","sourceRoot":"","sources":["../src/ScriptTransformer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAanC,OAAO,EACL,OAAO,EACP,eAAe,EAGhB,MAAM,SAAS,CAAC;AAiCjB,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,eAAe,CAAgC;IACvD,OAAO,CAAC,qBAAqB,CAA4B;gBAE7C,MAAM,EAAE,MAAM,CAAC,aAAa;IAsBxC,OAAO,CAAC,YAAY;IA8BpB,OAAO,CAAC,iBAAiB;IAyBzB,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,eAAe;IAgCvB,OAAO,CAAC,eAAe;IAmCvB,OAAO,CAAC,YAAY;IAUpB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,GAAG,IAAI;IAI/C,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO;;;;;IAiG3E,OAAO,CAAC,wBAAwB;IA6ChC,SAAS,CACP,QAAQ,EAAE,MAAM,CAAC,IAAI,EACrB,OAAO,EAAE,OAAO,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,eAAe;IA6BlB,aAAa,CACX,QAAQ,EAAE,MAAM,CAAC,IAAI,EACrB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM;IAkBT,yBAAyB,CAAC,UAAU,GAAG,OAAO,EAC5C,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,GACtC,UAAU;IACb,yBAAyB,CAAC,UAAU,GAAG,OAAO,EAC5C,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GAC/C,OAAO,CAAC,UAAU,CAAC;IAsDtB;;OAEG;IAEH,OAAO,CAAC,gBAAgB;IAIxB,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,GAAG,OAAO;CAQhD;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,sGAepE"}

828
node_modules/@jest/transform/build/ScriptTransformer.js generated vendored Normal file
View File

@@ -0,0 +1,828 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.createTranspilingRequire = createTranspilingRequire;
exports.default = void 0;
function _crypto() {
const data = require('crypto');
_crypto = function() {
return data;
};
return data;
}
function path() {
const data = _interopRequireWildcard(require('path'));
path = function() {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function() {
return data;
};
return data;
}
function fs() {
const data = _interopRequireWildcard(require('graceful-fs'));
fs = function() {
return data;
};
return data;
}
function _core() {
const data = require('@babel/core');
_core = function() {
return data;
};
return data;
}
function _babelPluginIstanbul() {
const data = _interopRequireDefault(require('babel-plugin-istanbul'));
_babelPluginIstanbul = function() {
return data;
};
return data;
}
function _convertSourceMap() {
const data = require('convert-source-map');
_convertSourceMap = function() {
return data;
};
return data;
}
function _jestHasteMap() {
const data = _interopRequireDefault(require('jest-haste-map'));
_jestHasteMap = function() {
return data;
};
return data;
}
function _fastJsonStableStringify() {
const data = _interopRequireDefault(require('fast-json-stable-stringify'));
_fastJsonStableStringify = function() {
return data;
};
return data;
}
function _slash() {
const data = _interopRequireDefault(require('slash'));
_slash = function() {
return data;
};
return data;
}
function _writeFileAtomic() {
const data = require('write-file-atomic');
_writeFileAtomic = function() {
return data;
};
return data;
}
function _realpathNative() {
const data = require('realpath-native');
_realpathNative = function() {
return data;
};
return data;
}
function _pirates() {
const data = require('pirates');
_pirates = function() {
return data;
};
return data;
}
var _shouldInstrument = _interopRequireDefault(require('./shouldInstrument'));
var _enhanceUnexpectedTokenMessage = _interopRequireDefault(
require('./enhanceUnexpectedTokenMessage')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _getRequireWildcardCache() {
if (typeof WeakMap !== 'function') return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
return {default: obj};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
// Use `require` to avoid TS rootDir
const {version: VERSION} = require('../package.json'); // This data structure is used to avoid recalculating some data every time that
// we need to transform a file. Since ScriptTransformer is instantiated for each
// file we need to keep this object in the local scope of this module.
const projectCaches = new Map(); // To reset the cache for specific changesets (rather than package version).
const CACHE_VERSION = '1';
async function waitForPromiseWithCleanup(promise, cleanup) {
try {
await promise;
} finally {
cleanup();
}
}
class ScriptTransformer {
constructor(config) {
_defineProperty(this, '_cache', void 0);
_defineProperty(this, '_config', void 0);
_defineProperty(this, '_transformCache', void 0);
_defineProperty(this, '_transformConfigCache', void 0);
this._config = config;
this._transformCache = new Map();
this._transformConfigCache = new Map();
const configString = (0, _fastJsonStableStringify().default)(this._config);
let projectCache = projectCaches.get(configString);
if (!projectCache) {
projectCache = {
configString,
ignorePatternsRegExp: calcIgnorePatternRegExp(this._config),
transformRegExp: calcTransformRegExp(this._config),
transformedFiles: new Map()
};
projectCaches.set(configString, projectCache);
}
this._cache = projectCache;
}
_getCacheKey(fileData, filename, instrument) {
const configString = this._cache.configString;
const transformer = this._getTransformer(filename);
if (transformer && typeof transformer.getCacheKey === 'function') {
return (0, _crypto().createHash)('md5')
.update(
transformer.getCacheKey(fileData, filename, configString, {
config: this._config,
instrument,
rootDir: this._config.rootDir
})
)
.update(CACHE_VERSION)
.digest('hex');
} else {
return (0, _crypto().createHash)('md5')
.update(fileData)
.update(configString)
.update(instrument ? 'instrument' : '')
.update(filename)
.update(CACHE_VERSION)
.digest('hex');
}
}
_getFileCachePath(filename, content, instrument) {
const baseCacheDir = _jestHasteMap().default.getCacheFilePath(
this._config.cacheDirectory,
'jest-transform-cache-' + this._config.name,
VERSION
);
const cacheKey = this._getCacheKey(content, filename, instrument); // Create sub folders based on the cacheKey to avoid creating one
// directory with many files.
const cacheDir = path().join(baseCacheDir, cacheKey[0] + cacheKey[1]);
const cacheFilenamePrefix = path()
.basename(filename, path().extname(filename))
.replace(/\W/g, '');
const cachePath = (0, _slash().default)(
path().join(cacheDir, cacheFilenamePrefix + '_' + cacheKey)
);
(0, _jestUtil().createDirectory)(cacheDir);
return cachePath;
}
_getTransformPath(filename) {
const transformRegExp = this._cache.transformRegExp;
if (!transformRegExp) {
return undefined;
}
for (let i = 0; i < transformRegExp.length; i++) {
if (transformRegExp[i][0].test(filename)) {
const transformPath = transformRegExp[i][1];
this._transformConfigCache.set(transformPath, transformRegExp[i][2]);
return transformPath;
}
}
return undefined;
}
_getTransformer(filename) {
let transform = null;
if (!this._config.transform || !this._config.transform.length) {
return null;
}
const transformPath = this._getTransformPath(filename);
if (transformPath) {
const transformer = this._transformCache.get(transformPath);
if (transformer != null) {
return transformer;
}
transform = require(transformPath);
if (!transform) {
throw new TypeError('Jest: a transform must export something.');
}
const transformerConfig = this._transformConfigCache.get(transformPath);
if (typeof transform.createTransformer === 'function') {
transform = transform.createTransformer(transformerConfig);
}
if (typeof transform.process !== 'function') {
throw new TypeError(
'Jest: a transform must export a `process` function.'
);
}
this._transformCache.set(transformPath, transform);
}
return transform;
}
_instrumentFile(filename, content) {
const result = (0, _core().transformSync)(content, {
auxiliaryCommentBefore: ' istanbul ignore next ',
babelrc: false,
caller: {
name: '@jest/transform',
supportsStaticESM: false
},
configFile: false,
filename,
plugins: [
[
_babelPluginIstanbul().default,
{
compact: false,
// files outside `cwd` will not be instrumented
cwd: this._config.rootDir,
exclude: [],
useInlineSourceMaps: false
}
]
]
});
if (result) {
const {code} = result;
if (code) {
return code;
}
}
return content;
}
_getRealPath(filepath) {
try {
return (0, _realpathNative().sync)(filepath) || filepath;
} catch (err) {
return filepath;
}
} // We don't want to expose transformers to the outside - this function is just
// to warm up `this._transformCache`
preloadTransformer(filepath) {
this._getTransformer(filepath);
}
transformSource(filepath, content, instrument) {
const filename = this._getRealPath(filepath);
const transform = this._getTransformer(filename);
const cacheFilePath = this._getFileCachePath(filename, content, instrument);
let sourceMapPath = cacheFilePath + '.map'; // Ignore cache if `config.cache` is set (--no-cache)
let code = this._config.cache ? readCodeCacheFile(cacheFilePath) : null;
const shouldCallTransform = transform && this.shouldTransform(filename); // That means that the transform has a custom instrumentation
// logic and will handle it based on `config.collectCoverage` option
const transformWillInstrument =
shouldCallTransform && transform && transform.canInstrument; // If we handle the coverage instrumentation, we should try to map code
// coverage against original source with any provided source map
const mapCoverage = instrument && !transformWillInstrument;
if (code) {
// This is broken: we return the code, and a path for the source map
// directly from the cache. But, nothing ensures the source map actually
// matches that source code. They could have gotten out-of-sync in case
// two separate processes write concurrently to the same cache files.
return {
code,
mapCoverage,
sourceMapPath
};
}
let transformed = {
code: content,
map: null
};
if (transform && shouldCallTransform) {
const processed = transform.process(content, filename, this._config, {
instrument
});
if (typeof processed === 'string') {
transformed.code = processed;
} else if (processed != null && typeof processed.code === 'string') {
transformed = processed;
} else {
throw new TypeError(
"Jest: a transform's `process` function must return a string, " +
'or an object with `code` key containing this string.'
);
}
}
if (!transformed.map) {
try {
//Could be a potential freeze here.
//See: https://github.com/facebook/jest/pull/5177#discussion_r158883570
const inlineSourceMap = (0, _convertSourceMap().fromSource)(
transformed.code
);
if (inlineSourceMap) {
transformed.map = inlineSourceMap.toJSON();
}
} catch (e) {
const transformPath = this._getTransformPath(filename);
console.warn(
`jest-transform: The source map produced for the file ${filename} ` +
`by ${transformPath} was invalid. Proceeding without source ` +
'mapping for that file.'
);
}
}
if (!transformWillInstrument && instrument) {
code = this._instrumentFile(filename, transformed.code);
} else {
code = transformed.code;
}
if (transformed.map) {
const sourceMapContent =
typeof transformed.map === 'string'
? transformed.map
: JSON.stringify(transformed.map);
writeCacheFile(sourceMapPath, sourceMapContent);
} else {
sourceMapPath = null;
}
writeCodeCacheFile(cacheFilePath, code);
return {
code,
mapCoverage,
sourceMapPath
};
}
_transformAndBuildScript(filename, options, instrument, fileSource) {
const isInternalModule = !!(options && options.isInternalModule);
const isCoreModule = !!(options && options.isCoreModule);
const content = stripShebang(
fileSource || fs().readFileSync(filename, 'utf8')
);
let code = content;
let sourceMapPath = null;
let mapCoverage = false;
const willTransform =
!isInternalModule &&
!isCoreModule &&
(this.shouldTransform(filename) || instrument);
try {
if (willTransform) {
const transformedSource = this.transformSource(
filename,
content,
instrument
);
code = transformedSource.code;
sourceMapPath = transformedSource.sourceMapPath;
mapCoverage = transformedSource.mapCoverage;
}
return {
code,
mapCoverage,
originalCode: content,
sourceMapPath
};
} catch (e) {
throw (0, _enhanceUnexpectedTokenMessage.default)(e);
}
}
transform(filename, options, fileSource) {
let scriptCacheKey = undefined;
let instrument = false;
if (!options.isCoreModule) {
instrument =
options.coverageProvider === 'babel' &&
(0, _shouldInstrument.default)(filename, options, this._config);
scriptCacheKey = getScriptCacheKey(filename, instrument);
const result = this._cache.transformedFiles.get(scriptCacheKey);
if (result) {
return result;
}
}
const result = this._transformAndBuildScript(
filename,
options,
instrument,
fileSource
);
if (scriptCacheKey) {
this._cache.transformedFiles.set(scriptCacheKey, result);
}
return result;
}
transformJson(filename, options, fileSource) {
const isInternalModule = options.isInternalModule;
const isCoreModule = options.isCoreModule;
const willTransform =
!isInternalModule && !isCoreModule && this.shouldTransform(filename);
if (willTransform) {
const {code: transformedJsonSource} = this.transformSource(
filename,
fileSource,
false
);
return transformedJsonSource;
}
return fileSource;
}
requireAndTranspileModule(moduleName, callback) {
// Load the transformer to avoid a cycle where we need to load a
// transformer in order to transform it in the require hooks
this.preloadTransformer(moduleName);
let transforming = false;
const revertHook = (0, _pirates().addHook)(
(code, filename) => {
try {
transforming = true;
return this.transformSource(filename, code, false).code || code;
} finally {
transforming = false;
}
},
{
exts: this._config.moduleFileExtensions.map(ext => `.${ext}`),
ignoreNodeModules: false,
matcher: filename => {
if (transforming) {
// Don't transform any dependency required by the transformer itself
return false;
}
return this.shouldTransform(filename);
}
}
);
const module = require(moduleName);
if (!callback) {
revertHook();
return module;
}
try {
const cbResult = callback(module);
if ((0, _jestUtil().isPromise)(cbResult)) {
return waitForPromiseWithCleanup(cbResult, revertHook).then(
() => module
);
}
} finally {
revertHook();
}
return module;
}
/**
* @deprecated use `this.shouldTransform` instead
*/
// @ts-ignore: Unused and private - remove in Jest 25
_shouldTransform(filename) {
return this.shouldTransform(filename);
}
shouldTransform(filename) {
const ignoreRegexp = this._cache.ignorePatternsRegExp;
const isIgnored = ignoreRegexp ? ignoreRegexp.test(filename) : false;
return (
!!this._config.transform && !!this._config.transform.length && !isIgnored
);
}
}
exports.default = ScriptTransformer;
function createTranspilingRequire(config) {
const transformer = new ScriptTransformer(config);
return function requireAndTranspileModule(
resolverPath,
applyInteropRequireDefault = false
) {
const transpiledModule = transformer.requireAndTranspileModule(
resolverPath
);
return applyInteropRequireDefault
? (0, _jestUtil().interopRequireDefault)(transpiledModule).default
: transpiledModule;
};
}
const removeFile = path => {
try {
fs().unlinkSync(path);
} catch (e) {}
};
const stripShebang = content => {
// If the file data starts with a shebang remove it. Leaves the empty line
// to keep stack trace line numbers correct.
if (content.startsWith('#!')) {
return content.replace(/^#!.*/, '');
} else {
return content;
}
};
/**
* This is like `writeCacheFile` but with an additional sanity checksum. We
* cannot use the same technique for source maps because we expose source map
* cache file paths directly to callsites, with the expectation they can read
* it right away. This is not a great system, because source map cache file
* could get corrupted, out-of-sync, etc.
*/
function writeCodeCacheFile(cachePath, code) {
const checksum = (0, _crypto().createHash)('md5')
.update(code)
.digest('hex');
writeCacheFile(cachePath, checksum + '\n' + code);
}
/**
* Read counterpart of `writeCodeCacheFile`. We verify that the content of the
* file matches the checksum, in case some kind of corruption happened. This
* could happen if an older version of `jest-runtime` writes non-atomically to
* the same cache, for example.
*/
function readCodeCacheFile(cachePath) {
const content = readCacheFile(cachePath);
if (content == null) {
return null;
}
const code = content.substr(33);
const checksum = (0, _crypto().createHash)('md5')
.update(code)
.digest('hex');
if (checksum === content.substr(0, 32)) {
return code;
}
return null;
}
/**
* Writing to the cache atomically relies on 'rename' being atomic on most
* file systems. Doing atomic write reduces the risk of corruption by avoiding
* two processes to write to the same file at the same time. It also reduces
* the risk of reading a file that's being overwritten at the same time.
*/
const writeCacheFile = (cachePath, fileData) => {
try {
(0, _writeFileAtomic().sync)(cachePath, fileData, {
encoding: 'utf8'
});
} catch (e) {
if (cacheWriteErrorSafeToIgnore(e, cachePath)) {
return;
}
e.message =
'jest: failed to cache transform results in: ' +
cachePath +
'\nFailure message: ' +
e.message;
removeFile(cachePath);
throw e;
}
};
/**
* On Windows, renames are not atomic, leading to EPERM exceptions when two
* processes attempt to rename to the same target file at the same time.
* If the target file exists we can be reasonably sure another process has
* legitimately won a cache write race and ignore the error.
*/
const cacheWriteErrorSafeToIgnore = (e, cachePath) =>
process.platform === 'win32' &&
e.code === 'EPERM' &&
fs().existsSync(cachePath);
const readCacheFile = cachePath => {
if (!fs().existsSync(cachePath)) {
return null;
}
let fileData;
try {
fileData = fs().readFileSync(cachePath, 'utf8');
} catch (e) {
e.message =
'jest: failed to read cache file: ' +
cachePath +
'\nFailure message: ' +
e.message;
removeFile(cachePath);
throw e;
}
if (fileData == null) {
// We must have somehow created the file but failed to write to it,
// let's delete it and retry.
removeFile(cachePath);
}
return fileData;
};
const getScriptCacheKey = (filename, instrument) => {
const mtime = fs().statSync(filename).mtime;
return filename + '_' + mtime.getTime() + (instrument ? '_instrumented' : '');
};
const calcIgnorePatternRegExp = config => {
if (
!config.transformIgnorePatterns ||
config.transformIgnorePatterns.length === 0
) {
return undefined;
}
return new RegExp(config.transformIgnorePatterns.join('|'));
};
const calcTransformRegExp = config => {
if (!config.transform.length) {
return undefined;
}
const transformRegexp = [];
for (let i = 0; i < config.transform.length; i++) {
transformRegexp.push([
new RegExp(config.transform[i][0]),
config.transform[i][1],
config.transform[i][2]
]);
}
return transformRegexp;
};

View File

@@ -0,0 +1,13 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export default function handlePotentialSyntaxError(e: Error & {
codeFrame?: string;
}): Error & {
codeFrame?: string | undefined;
};
export declare function enhanceUnexpectedTokenMessage(e: Error): Error;
//# sourceMappingURL=enhanceUnexpectedTokenMessage.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"enhanceUnexpectedTokenMessage.d.ts","sourceRoot":"","sources":["../src/enhanceUnexpectedTokenMessage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAChD,CAAC,EAAE,KAAK,GAAG;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAC;;EAiBhC;AAED,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,KAAK,SA2BrD"}

View File

@@ -0,0 +1,75 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = handlePotentialSyntaxError;
exports.enhanceUnexpectedTokenMessage = enhanceUnexpectedTokenMessage;
function _chalk() {
const data = _interopRequireDefault(require('chalk'));
_chalk = function() {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const DOT = ' \u2022 ';
function handlePotentialSyntaxError(e) {
if (e.codeFrame) {
e.stack = e.message + '\n' + e.codeFrame;
}
if (
// `instanceof` might come from the wrong context
e.name === 'SyntaxError' &&
(e.message.includes('Unexpected token') ||
e.message.includes('Cannot use import')) &&
!e.message.includes(' expected')
) {
throw enhanceUnexpectedTokenMessage(e);
}
return e;
}
function enhanceUnexpectedTokenMessage(e) {
e.stack =
`${_chalk().default.bold.red('Jest encountered an unexpected token')}
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
${DOT}To have some of your "node_modules" files transformed, you can specify a custom ${_chalk().default.bold(
'"transformIgnorePatterns"'
)} in your config.
${DOT}If you need a custom transformation specify a ${_chalk().default.bold(
'"transform"'
)} option in your config.
${DOT}If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the ${_chalk().default.bold(
'"moduleNameMapper"'
)} config option.
You'll find more details and examples of these config options in the docs:
${_chalk().default.cyan('https://jestjs.io/docs/en/configuration.html')}
${_chalk().default.bold.red('Details:')}
` + e.stack;
return e;
}

11
node_modules/@jest/transform/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export { default as ScriptTransformer, createTranspilingRequire, } from './ScriptTransformer';
export { default as shouldInstrument } from './shouldInstrument';
export { Transformer, ShouldInstrumentOptions, Options as TransformationOptions, TransformResult, } from './types';
export { default as handlePotentialSyntaxError } from './enhanceUnexpectedTokenMessage';
//# sourceMappingURL=index.d.ts.map

1
node_modules/@jest/transform/build/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,OAAO,IAAI,iBAAiB,EAC5B,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,OAAO,IAAI,qBAAqB,EAChC,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,OAAO,IAAI,0BAA0B,EAAC,MAAM,iCAAiC,CAAC"}

111
node_modules/@jest/transform/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,111 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
Object.defineProperty(exports, 'ScriptTransformer', {
enumerable: true,
get: function() {
return _ScriptTransformer.default;
}
});
Object.defineProperty(exports, 'createTranspilingRequire', {
enumerable: true,
get: function() {
return _ScriptTransformer.createTranspilingRequire;
}
});
Object.defineProperty(exports, 'shouldInstrument', {
enumerable: true,
get: function() {
return _shouldInstrument.default;
}
});
Object.defineProperty(exports, 'Transformer', {
enumerable: true,
get: function() {
return _types.Transformer;
}
});
Object.defineProperty(exports, 'ShouldInstrumentOptions', {
enumerable: true,
get: function() {
return _types.ShouldInstrumentOptions;
}
});
Object.defineProperty(exports, 'TransformationOptions', {
enumerable: true,
get: function() {
return _types.Options;
}
});
Object.defineProperty(exports, 'TransformResult', {
enumerable: true,
get: function() {
return _types.TransformResult;
}
});
Object.defineProperty(exports, 'handlePotentialSyntaxError', {
enumerable: true,
get: function() {
return _enhanceUnexpectedTokenMessage.default;
}
});
var _ScriptTransformer = _interopRequireWildcard(
require('./ScriptTransformer')
);
var _shouldInstrument = _interopRequireDefault(require('./shouldInstrument'));
var _types = require('./types');
var _enhanceUnexpectedTokenMessage = _interopRequireDefault(
require('./enhanceUnexpectedTokenMessage')
);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _getRequireWildcardCache() {
if (typeof WeakMap !== 'function') return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
return {default: obj};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}

View File

@@ -0,0 +1,10 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { Config } from '@jest/types';
import { ShouldInstrumentOptions } from './types';
export default function shouldInstrument(filename: Config.Path, options: ShouldInstrumentOptions, config: Config.ProjectConfig): boolean;
//# sourceMappingURL=shouldInstrument.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"shouldInstrument.d.ts","sourceRoot":"","sources":["../src/shouldInstrument.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAInC,OAAO,EAAC,uBAAuB,EAAC,MAAM,SAAS,CAAC;AAMhD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,QAAQ,EAAE,MAAM,CAAC,IAAI,EACrB,OAAO,EAAE,uBAAuB,EAChC,MAAM,EAAE,MAAM,CAAC,aAAa,GAC3B,OAAO,CA8ET"}

191
node_modules/@jest/transform/build/shouldInstrument.js generated vendored Normal file
View File

@@ -0,0 +1,191 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = shouldInstrument;
function path() {
const data = _interopRequireWildcard(require('path'));
path = function() {
return data;
};
return data;
}
function _jestRegexUtil() {
const data = require('jest-regex-util');
_jestRegexUtil = function() {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function() {
return data;
};
return data;
}
function _micromatch() {
const data = _interopRequireDefault(require('micromatch'));
_micromatch = function() {
return data;
};
return data;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
function _getRequireWildcardCache() {
if (typeof WeakMap !== 'function') return null;
var cache = new WeakMap();
_getRequireWildcardCache = function() {
return cache;
};
return cache;
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
return {default: obj};
}
var cache = _getRequireWildcardCache();
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor
? Object.getOwnPropertyDescriptor(obj, key)
: null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const MOCKS_PATTERN = new RegExp(
(0, _jestRegexUtil().escapePathForRegex)(
path().sep + '__mocks__' + path().sep
)
);
function shouldInstrument(filename, options, config) {
if (!options.collectCoverage) {
return false;
}
if (
config.forceCoverageMatch.length &&
_micromatch().default.any(filename, config.forceCoverageMatch)
) {
return true;
}
if (
!config.testPathIgnorePatterns.some(pattern => !!filename.match(pattern))
) {
if (config.testRegex.some(regex => new RegExp(regex).test(filename))) {
return false;
}
if (
(0, _micromatch().default)(
[(0, _jestUtil().replacePathSepForGlob)(filename)],
config.testMatch
).length
) {
return false;
}
}
if (
// This configuration field contains an object in the form of:
// {'path/to/file.js': true}
options.collectCoverageOnlyFrom &&
!options.collectCoverageOnlyFrom[filename]
) {
return false;
}
if (
// still cover if `only` is specified
!options.collectCoverageOnlyFrom &&
options.collectCoverageFrom.length &&
(0, _micromatch().default)(
[
(0, _jestUtil().replacePathSepForGlob)(
path().relative(config.rootDir, filename)
)
],
options.collectCoverageFrom
).length === 0
) {
return false;
}
if (
config.coveragePathIgnorePatterns.some(pattern => !!filename.match(pattern))
) {
return false;
}
if (config.globalSetup === filename) {
return false;
}
if (config.globalTeardown === filename) {
return false;
}
if (config.setupFiles.includes(filename)) {
return false;
}
if (config.setupFilesAfterEnv.includes(filename)) {
return false;
}
if (MOCKS_PATTERN.test(filename)) {
return false;
}
if (options.changedFiles && !options.changedFiles.has(filename)) {
return false;
}
return true;
}

44
node_modules/@jest/transform/build/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,44 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { RawSourceMap } from 'source-map';
import { Config } from '@jest/types';
export declare type ShouldInstrumentOptions = Pick<Config.GlobalConfig, 'collectCoverage' | 'collectCoverageFrom' | 'collectCoverageOnlyFrom' | 'coverageProvider'> & {
changedFiles?: Set<Config.Path>;
};
export declare type Options = ShouldInstrumentOptions & Partial<{
isCoreModule: boolean;
isInternalModule: boolean;
}>;
interface FixedRawSourceMap extends Omit<RawSourceMap, 'version'> {
version: number;
}
export declare type TransformedSource = {
code: string;
map?: FixedRawSourceMap | string | null;
};
export declare type TransformResult = {
code: string;
originalCode: string;
mapCoverage: boolean;
sourceMapPath: string | null;
};
export declare type TransformOptions = {
instrument: boolean;
};
export declare type CacheKeyOptions = {
config: Config.ProjectConfig;
instrument: boolean;
rootDir: string;
};
export interface Transformer {
canInstrument?: boolean;
createTransformer?: (options?: any) => Transformer;
getCacheKey?: (fileData: string, filePath: Config.Path, configStr: string, options: CacheKeyOptions) => string;
process: (sourceText: string, sourcePath: Config.Path, config: Config.ProjectConfig, options?: TransformOptions) => string | TransformedSource;
}
export {};
//# sourceMappingURL=types.d.ts.map

1
node_modules/@jest/transform/build/types.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,oBAAY,uBAAuB,GAAG,IAAI,CACxC,MAAM,CAAC,YAAY,EACjB,iBAAiB,GACjB,qBAAqB,GACrB,yBAAyB,GACzB,kBAAkB,CACrB,GAAG;IACF,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CACjC,CAAC;AAEF,oBAAY,OAAO,GAAG,uBAAuB,GAC3C,OAAO,CAAC;IACN,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC,CAAC;AAGL,UAAU,iBAAkB,SAAQ,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAC/D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,oBAAY,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAAC;CACzC,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC7B,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,WAAW,CAAC;IAEnD,WAAW,CAAC,EAAE,CACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,CAAC,IAAI,EACrB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,eAAe,KACrB,MAAM,CAAC;IAEZ,OAAO,EAAE,CACP,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,CAAC,IAAI,EACvB,MAAM,EAAE,MAAM,CAAC,aAAa,EAC5B,OAAO,CAAC,EAAE,gBAAgB,KACvB,MAAM,GAAG,iBAAiB,CAAC;CACjC"}

1
node_modules/@jest/transform/build/types.js generated vendored Normal file
View File

@@ -0,0 +1 @@
'use strict';

View File

@@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter, Ben Noordhuis, and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,133 @@
# graceful-fs
graceful-fs functions as a drop-in replacement for the fs module,
making various improvements.
The improvements are meant to normalize behavior across different
platforms and environments, and to make filesystem access more
resilient to errors.
## Improvements over [fs module](https://nodejs.org/api/fs.html)
* Queues up `open` and `readdir` calls, and retries them once
something closes if there is an EMFILE error from too many file
descriptors.
* fixes `lchmod` for Node versions prior to 0.6.2.
* implements `fs.lutimes` if possible. Otherwise it becomes a noop.
* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or
`lchown` if the user isn't root.
* makes `lchmod` and `lchown` become noops, if not available.
* retries reading a file if `read` results in EAGAIN error.
On Windows, it retries renaming a file for up to one second if `EACCESS`
or `EPERM` error occurs, likely because antivirus software has locked
the directory.
## USAGE
```javascript
// use just like fs
var fs = require('graceful-fs')
// now go and do stuff with it...
fs.readFileSync('some-file-or-whatever')
```
## Global Patching
If you want to patch the global fs module (or any other fs-like
module) you can do this:
```javascript
// Make sure to read the caveat below.
var realFs = require('fs')
var gracefulFs = require('graceful-fs')
gracefulFs.gracefulify(realFs)
```
This should only ever be done at the top-level application layer, in
order to delay on EMFILE errors from any fs-using dependencies. You
should **not** do this in a library, because it can cause unexpected
delays in other parts of the program.
## Changes
This module is fairly stable at this point, and used by a lot of
things. That being said, because it implements a subtle behavior
change in a core part of the node API, even modest changes can be
extremely breaking, and the versioning is thus biased towards
bumping the major when in doubt.
The main change between major versions has been switching between
providing a fully-patched `fs` module vs monkey-patching the node core
builtin, and the approach by which a non-monkey-patched `fs` was
created.
The goal is to trade `EMFILE` errors for slower fs operations. So, if
you try to open a zillion files, rather than crashing, `open`
operations will be queued up and wait for something else to `close`.
There are advantages to each approach. Monkey-patching the fs means
that no `EMFILE` errors can possibly occur anywhere in your
application, because everything is using the same core `fs` module,
which is patched. However, it can also obviously cause undesirable
side-effects, especially if the module is loaded multiple times.
Implementing a separate-but-identical patched `fs` module is more
surgical (and doesn't run the risk of patching multiple times), but
also imposes the challenge of keeping in sync with the core module.
The current approach loads the `fs` module, and then creates a
lookalike object that has all the same methods, except a few that are
patched. It is safe to use in all versions of Node from 0.8 through
7.0.
### v4
* Do not monkey-patch the fs module. This module may now be used as a
drop-in dep, and users can opt into monkey-patching the fs builtin
if their app requires it.
### v3
* Monkey-patch fs, because the eval approach no longer works on recent
node.
* fixed possible type-error throw if rename fails on windows
* verify that we *never* get EMFILE errors
* Ignore ENOSYS from chmod/chown
* clarify that graceful-fs must be used as a drop-in
### v2.1.0
* Use eval rather than monkey-patching fs.
* readdir: Always sort the results
* win32: requeue a file if error has an OK status
### v2.0
* A return to monkey patching
* wrap process.cwd
### v1.1
* wrap readFile
* Wrap fs.writeFile.
* readdir protection
* Don't clobber the fs builtin
* Handle fs.read EAGAIN errors by trying again
* Expose the curOpen counter
* No-op lchown/lchmod if not implemented
* fs.rename patch only for win32
* Patch fs.rename to handle AV software on Windows
* Close #4 Chown should not fail on einval or eperm if non-root
* Fix isaacs/fstream#1 Only wrap fs one time
* Fix #3 Start at 1024 max files, then back off on EMFILE
* lutimes that doens't blow up on Linux
* A full on-rewrite using a queue instead of just swallowing the EMFILE error
* Wrap Read/Write streams as well
### 1.0
* Update engines for node 0.6
* Be lstat-graceful on Windows
* first

View File

@@ -0,0 +1,19 @@
'use strict'
module.exports = clone
function clone (obj) {
if (obj === null || typeof obj !== 'object')
return obj
if (obj instanceof Object)
var copy = { __proto__: obj.__proto__ }
else
var copy = Object.create(null)
Object.getOwnPropertyNames(obj).forEach(function (key) {
Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))
})
return copy
}

View File

@@ -0,0 +1,346 @@
var fs = require('fs')
var polyfills = require('./polyfills.js')
var legacy = require('./legacy-streams.js')
var clone = require('./clone.js')
var util = require('util')
/* istanbul ignore next - node 0.x polyfill */
var gracefulQueue
var previousSymbol
/* istanbul ignore else - node 0.x polyfill */
if (typeof Symbol === 'function' && typeof Symbol.for === 'function') {
gracefulQueue = Symbol.for('graceful-fs.queue')
// This is used in testing by future versions
previousSymbol = Symbol.for('graceful-fs.previous')
} else {
gracefulQueue = '___graceful-fs.queue'
previousSymbol = '___graceful-fs.previous'
}
function noop () {}
var debug = noop
if (util.debuglog)
debug = util.debuglog('gfs4')
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
debug = function() {
var m = util.format.apply(util, arguments)
m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ')
console.error(m)
}
// Once time initialization
if (!global[gracefulQueue]) {
// This queue can be shared by multiple loaded instances
var queue = []
Object.defineProperty(global, gracefulQueue, {
get: function() {
return queue
}
})
// Patch fs.close/closeSync to shared queue version, because we need
// to retry() whenever a close happens *anywhere* in the program.
// This is essential when multiple graceful-fs instances are
// in play at the same time.
fs.close = (function (fs$close) {
function close (fd, cb) {
return fs$close.call(fs, fd, function (err) {
// This function uses the graceful-fs shared queue
if (!err) {
retry()
}
if (typeof cb === 'function')
cb.apply(this, arguments)
})
}
Object.defineProperty(close, previousSymbol, {
value: fs$close
})
return close
})(fs.close)
fs.closeSync = (function (fs$closeSync) {
function closeSync (fd) {
// This function uses the graceful-fs shared queue
fs$closeSync.apply(fs, arguments)
retry()
}
Object.defineProperty(closeSync, previousSymbol, {
value: fs$closeSync
})
return closeSync
})(fs.closeSync)
if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
process.on('exit', function() {
debug(global[gracefulQueue])
require('assert').equal(global[gracefulQueue].length, 0)
})
}
}
module.exports = patch(clone(fs))
if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
module.exports = patch(fs)
fs.__patched = true;
}
function patch (fs) {
// Everything that references the open() function needs to be in here
polyfills(fs)
fs.gracefulify = patch
fs.createReadStream = createReadStream
fs.createWriteStream = createWriteStream
var fs$readFile = fs.readFile
fs.readFile = readFile
function readFile (path, options, cb) {
if (typeof options === 'function')
cb = options, options = null
return go$readFile(path, options, cb)
function go$readFile (path, options, cb) {
return fs$readFile(path, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$readFile, [path, options, cb]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
}
var fs$writeFile = fs.writeFile
fs.writeFile = writeFile
function writeFile (path, data, options, cb) {
if (typeof options === 'function')
cb = options, options = null
return go$writeFile(path, data, options, cb)
function go$writeFile (path, data, options, cb) {
return fs$writeFile(path, data, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$writeFile, [path, data, options, cb]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
}
var fs$appendFile = fs.appendFile
if (fs$appendFile)
fs.appendFile = appendFile
function appendFile (path, data, options, cb) {
if (typeof options === 'function')
cb = options, options = null
return go$appendFile(path, data, options, cb)
function go$appendFile (path, data, options, cb) {
return fs$appendFile(path, data, options, function (err) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$appendFile, [path, data, options, cb]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
}
var fs$readdir = fs.readdir
fs.readdir = readdir
function readdir (path, options, cb) {
var args = [path]
if (typeof options !== 'function') {
args.push(options)
} else {
cb = options
}
args.push(go$readdir$cb)
return go$readdir(args)
function go$readdir$cb (err, files) {
if (files && files.sort)
files.sort()
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$readdir, [args]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
}
}
function go$readdir (args) {
return fs$readdir.apply(fs, args)
}
if (process.version.substr(0, 4) === 'v0.8') {
var legStreams = legacy(fs)
ReadStream = legStreams.ReadStream
WriteStream = legStreams.WriteStream
}
var fs$ReadStream = fs.ReadStream
if (fs$ReadStream) {
ReadStream.prototype = Object.create(fs$ReadStream.prototype)
ReadStream.prototype.open = ReadStream$open
}
var fs$WriteStream = fs.WriteStream
if (fs$WriteStream) {
WriteStream.prototype = Object.create(fs$WriteStream.prototype)
WriteStream.prototype.open = WriteStream$open
}
Object.defineProperty(fs, 'ReadStream', {
get: function () {
return ReadStream
},
set: function (val) {
ReadStream = val
},
enumerable: true,
configurable: true
})
Object.defineProperty(fs, 'WriteStream', {
get: function () {
return WriteStream
},
set: function (val) {
WriteStream = val
},
enumerable: true,
configurable: true
})
// legacy names
var FileReadStream = ReadStream
Object.defineProperty(fs, 'FileReadStream', {
get: function () {
return FileReadStream
},
set: function (val) {
FileReadStream = val
},
enumerable: true,
configurable: true
})
var FileWriteStream = WriteStream
Object.defineProperty(fs, 'FileWriteStream', {
get: function () {
return FileWriteStream
},
set: function (val) {
FileWriteStream = val
},
enumerable: true,
configurable: true
})
function ReadStream (path, options) {
if (this instanceof ReadStream)
return fs$ReadStream.apply(this, arguments), this
else
return ReadStream.apply(Object.create(ReadStream.prototype), arguments)
}
function ReadStream$open () {
var that = this
open(that.path, that.flags, that.mode, function (err, fd) {
if (err) {
if (that.autoClose)
that.destroy()
that.emit('error', err)
} else {
that.fd = fd
that.emit('open', fd)
that.read()
}
})
}
function WriteStream (path, options) {
if (this instanceof WriteStream)
return fs$WriteStream.apply(this, arguments), this
else
return WriteStream.apply(Object.create(WriteStream.prototype), arguments)
}
function WriteStream$open () {
var that = this
open(that.path, that.flags, that.mode, function (err, fd) {
if (err) {
that.destroy()
that.emit('error', err)
} else {
that.fd = fd
that.emit('open', fd)
}
})
}
function createReadStream (path, options) {
return new fs.ReadStream(path, options)
}
function createWriteStream (path, options) {
return new fs.WriteStream(path, options)
}
var fs$open = fs.open
fs.open = open
function open (path, flags, mode, cb) {
if (typeof mode === 'function')
cb = mode, mode = null
return go$open(path, flags, mode, cb)
function go$open (path, flags, mode, cb) {
return fs$open(path, flags, mode, function (err, fd) {
if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))
enqueue([go$open, [path, flags, mode, cb]])
else {
if (typeof cb === 'function')
cb.apply(this, arguments)
retry()
}
})
}
}
return fs
}
function enqueue (elem) {
debug('ENQUEUE', elem[0].name, elem[1])
global[gracefulQueue].push(elem)
}
function retry () {
var elem = global[gracefulQueue].shift()
if (elem) {
debug('RETRY', elem[0].name, elem[1])
elem[0].apply(null, elem[1])
}
}

View File

@@ -0,0 +1,118 @@
var Stream = require('stream').Stream
module.exports = legacy
function legacy (fs) {
return {
ReadStream: ReadStream,
WriteStream: WriteStream
}
function ReadStream (path, options) {
if (!(this instanceof ReadStream)) return new ReadStream(path, options);
Stream.call(this);
var self = this;
this.path = path;
this.fd = null;
this.readable = true;
this.paused = false;
this.flags = 'r';
this.mode = 438; /*=0666*/
this.bufferSize = 64 * 1024;
options = options || {};
// Mixin options into this
var keys = Object.keys(options);
for (var index = 0, length = keys.length; index < length; index++) {
var key = keys[index];
this[key] = options[key];
}
if (this.encoding) this.setEncoding(this.encoding);
if (this.start !== undefined) {
if ('number' !== typeof this.start) {
throw TypeError('start must be a Number');
}
if (this.end === undefined) {
this.end = Infinity;
} else if ('number' !== typeof this.end) {
throw TypeError('end must be a Number');
}
if (this.start > this.end) {
throw new Error('start must be <= end');
}
this.pos = this.start;
}
if (this.fd !== null) {
process.nextTick(function() {
self._read();
});
return;
}
fs.open(this.path, this.flags, this.mode, function (err, fd) {
if (err) {
self.emit('error', err);
self.readable = false;
return;
}
self.fd = fd;
self.emit('open', fd);
self._read();
})
}
function WriteStream (path, options) {
if (!(this instanceof WriteStream)) return new WriteStream(path, options);
Stream.call(this);
this.path = path;
this.fd = null;
this.writable = true;
this.flags = 'w';
this.encoding = 'binary';
this.mode = 438; /*=0666*/
this.bytesWritten = 0;
options = options || {};
// Mixin options into this
var keys = Object.keys(options);
for (var index = 0, length = keys.length; index < length; index++) {
var key = keys[index];
this[key] = options[key];
}
if (this.start !== undefined) {
if ('number' !== typeof this.start) {
throw TypeError('start must be a Number');
}
if (this.start < 0) {
throw new Error('start must be >= zero');
}
this.pos = this.start;
}
this.busy = false;
this._queue = [];
if (this.fd === null) {
this._open = fs.open;
this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);
this.flush();
}
}
}

View File

@@ -0,0 +1,79 @@
{
"_from": "graceful-fs@^4.2.3",
"_id": "graceful-fs@4.2.3",
"_inBundle": false,
"_integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==",
"_location": "/@jest/transform/graceful-fs",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "graceful-fs@^4.2.3",
"name": "graceful-fs",
"escapedName": "graceful-fs",
"rawSpec": "^4.2.3",
"saveSpec": null,
"fetchSpec": "^4.2.3"
},
"_requiredBy": [
"/@jest/transform"
],
"_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz",
"_shasum": "4a12ff1b60376ef09862c2093edd908328be8423",
"_spec": "graceful-fs@^4.2.3",
"_where": "/home/runner/work/ghaction-upx/ghaction-upx/node_modules/@jest/transform",
"bugs": {
"url": "https://github.com/isaacs/node-graceful-fs/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "A drop-in replacement for fs, making various improvements.",
"devDependencies": {
"import-fresh": "^2.0.0",
"mkdirp": "^0.5.0",
"rimraf": "^2.2.8",
"tap": "^12.7.0"
},
"directories": {
"test": "test"
},
"files": [
"fs.js",
"graceful-fs.js",
"legacy-streams.js",
"polyfills.js",
"clone.js"
],
"homepage": "https://github.com/isaacs/node-graceful-fs#readme",
"keywords": [
"fs",
"module",
"reading",
"retry",
"retries",
"queue",
"error",
"errors",
"handling",
"EMFILE",
"EAGAIN",
"EINVAL",
"EPERM",
"EACCESS"
],
"license": "ISC",
"main": "graceful-fs.js",
"name": "graceful-fs",
"repository": {
"type": "git",
"url": "git+https://github.com/isaacs/node-graceful-fs.git"
},
"scripts": {
"postpublish": "git push origin --follow-tags",
"postversion": "npm publish",
"preversion": "npm test",
"test": "node test.js | tap -"
},
"version": "4.2.3"
}

View File

@@ -0,0 +1,342 @@
var constants = require('constants')
var origCwd = process.cwd
var cwd = null
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform
process.cwd = function() {
if (!cwd)
cwd = origCwd.call(process)
return cwd
}
try {
process.cwd()
} catch (er) {}
var chdir = process.chdir
process.chdir = function(d) {
cwd = null
chdir.call(process, d)
}
module.exports = patch
function patch (fs) {
// (re-)implement some things that are known busted or missing.
// lchmod, broken prior to 0.6.2
// back-port the fix here.
if (constants.hasOwnProperty('O_SYMLINK') &&
process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
patchLchmod(fs)
}
// lutimes implementation, or no-op
if (!fs.lutimes) {
patchLutimes(fs)
}
// https://github.com/isaacs/node-graceful-fs/issues/4
// Chown should not fail on einval or eperm if non-root.
// It should not fail on enosys ever, as this just indicates
// that a fs doesn't support the intended operation.
fs.chown = chownFix(fs.chown)
fs.fchown = chownFix(fs.fchown)
fs.lchown = chownFix(fs.lchown)
fs.chmod = chmodFix(fs.chmod)
fs.fchmod = chmodFix(fs.fchmod)
fs.lchmod = chmodFix(fs.lchmod)
fs.chownSync = chownFixSync(fs.chownSync)
fs.fchownSync = chownFixSync(fs.fchownSync)
fs.lchownSync = chownFixSync(fs.lchownSync)
fs.chmodSync = chmodFixSync(fs.chmodSync)
fs.fchmodSync = chmodFixSync(fs.fchmodSync)
fs.lchmodSync = chmodFixSync(fs.lchmodSync)
fs.stat = statFix(fs.stat)
fs.fstat = statFix(fs.fstat)
fs.lstat = statFix(fs.lstat)
fs.statSync = statFixSync(fs.statSync)
fs.fstatSync = statFixSync(fs.fstatSync)
fs.lstatSync = statFixSync(fs.lstatSync)
// if lchmod/lchown do not exist, then make them no-ops
if (!fs.lchmod) {
fs.lchmod = function (path, mode, cb) {
if (cb) process.nextTick(cb)
}
fs.lchmodSync = function () {}
}
if (!fs.lchown) {
fs.lchown = function (path, uid, gid, cb) {
if (cb) process.nextTick(cb)
}
fs.lchownSync = function () {}
}
// on Windows, A/V software can lock the directory, causing this
// to fail with an EACCES or EPERM if the directory contains newly
// created files. Try again on failure, for up to 60 seconds.
// Set the timeout this long because some Windows Anti-Virus, such as Parity
// bit9, may lock files for up to a minute, causing npm package install
// failures. Also, take care to yield the scheduler. Windows scheduling gives
// CPU to a busy looping process, which can cause the program causing the lock
// contention to be starved of CPU by node, so the contention doesn't resolve.
if (platform === "win32") {
fs.rename = (function (fs$rename) { return function (from, to, cb) {
var start = Date.now()
var backoff = 0;
fs$rename(from, to, function CB (er) {
if (er
&& (er.code === "EACCES" || er.code === "EPERM")
&& Date.now() - start < 60000) {
setTimeout(function() {
fs.stat(to, function (stater, st) {
if (stater && stater.code === "ENOENT")
fs$rename(from, to, CB);
else
cb(er)
})
}, backoff)
if (backoff < 100)
backoff += 10;
return;
}
if (cb) cb(er)
})
}})(fs.rename)
}
// if read() returns EAGAIN, then just try it again.
fs.read = (function (fs$read) {
function read (fd, buffer, offset, length, position, callback_) {
var callback
if (callback_ && typeof callback_ === 'function') {
var eagCounter = 0
callback = function (er, _, __) {
if (er && er.code === 'EAGAIN' && eagCounter < 10) {
eagCounter ++
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
}
callback_.apply(this, arguments)
}
}
return fs$read.call(fs, fd, buffer, offset, length, position, callback)
}
// This ensures `util.promisify` works as it does for native `fs.read`.
read.__proto__ = fs$read
return read
})(fs.read)
fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) {
var eagCounter = 0
while (true) {
try {
return fs$readSync.call(fs, fd, buffer, offset, length, position)
} catch (er) {
if (er.code === 'EAGAIN' && eagCounter < 10) {
eagCounter ++
continue
}
throw er
}
}
}})(fs.readSync)
function patchLchmod (fs) {
fs.lchmod = function (path, mode, callback) {
fs.open( path
, constants.O_WRONLY | constants.O_SYMLINK
, mode
, function (err, fd) {
if (err) {
if (callback) callback(err)
return
}
// prefer to return the chmod error, if one occurs,
// but still try to close, and report closing errors if they occur.
fs.fchmod(fd, mode, function (err) {
fs.close(fd, function(err2) {
if (callback) callback(err || err2)
})
})
})
}
fs.lchmodSync = function (path, mode) {
var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)
// prefer to return the chmod error, if one occurs,
// but still try to close, and report closing errors if they occur.
var threw = true
var ret
try {
ret = fs.fchmodSync(fd, mode)
threw = false
} finally {
if (threw) {
try {
fs.closeSync(fd)
} catch (er) {}
} else {
fs.closeSync(fd)
}
}
return ret
}
}
function patchLutimes (fs) {
if (constants.hasOwnProperty("O_SYMLINK")) {
fs.lutimes = function (path, at, mt, cb) {
fs.open(path, constants.O_SYMLINK, function (er, fd) {
if (er) {
if (cb) cb(er)
return
}
fs.futimes(fd, at, mt, function (er) {
fs.close(fd, function (er2) {
if (cb) cb(er || er2)
})
})
})
}
fs.lutimesSync = function (path, at, mt) {
var fd = fs.openSync(path, constants.O_SYMLINK)
var ret
var threw = true
try {
ret = fs.futimesSync(fd, at, mt)
threw = false
} finally {
if (threw) {
try {
fs.closeSync(fd)
} catch (er) {}
} else {
fs.closeSync(fd)
}
}
return ret
}
} else {
fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }
fs.lutimesSync = function () {}
}
}
function chmodFix (orig) {
if (!orig) return orig
return function (target, mode, cb) {
return orig.call(fs, target, mode, function (er) {
if (chownErOk(er)) er = null
if (cb) cb.apply(this, arguments)
})
}
}
function chmodFixSync (orig) {
if (!orig) return orig
return function (target, mode) {
try {
return orig.call(fs, target, mode)
} catch (er) {
if (!chownErOk(er)) throw er
}
}
}
function chownFix (orig) {
if (!orig) return orig
return function (target, uid, gid, cb) {
return orig.call(fs, target, uid, gid, function (er) {
if (chownErOk(er)) er = null
if (cb) cb.apply(this, arguments)
})
}
}
function chownFixSync (orig) {
if (!orig) return orig
return function (target, uid, gid) {
try {
return orig.call(fs, target, uid, gid)
} catch (er) {
if (!chownErOk(er)) throw er
}
}
}
function statFix (orig) {
if (!orig) return orig
// Older versions of Node erroneously returned signed integers for
// uid + gid.
return function (target, options, cb) {
if (typeof options === 'function') {
cb = options
options = null
}
function callback (er, stats) {
if (stats) {
if (stats.uid < 0) stats.uid += 0x100000000
if (stats.gid < 0) stats.gid += 0x100000000
}
if (cb) cb.apply(this, arguments)
}
return options ? orig.call(fs, target, options, callback)
: orig.call(fs, target, callback)
}
}
function statFixSync (orig) {
if (!orig) return orig
// Older versions of Node erroneously returned signed integers for
// uid + gid.
return function (target, options) {
var stats = options ? orig.call(fs, target, options)
: orig.call(fs, target)
if (stats.uid < 0) stats.uid += 0x100000000
if (stats.gid < 0) stats.gid += 0x100000000
return stats;
}
}
// ENOSYS means that the fs doesn't support the op. Just ignore
// that, because it doesn't matter.
//
// if there's no getuid, or if getuid() is something other
// than 0, and the error is EINVAL or EPERM, then just ignore
// it.
//
// This specific case is a silent failure in cp, install, tar,
// and most other unix tools that manage permissions.
//
// When running as root, or if other types of errors are
// encountered, then it's strict.
function chownErOk (er) {
if (!er)
return true
if (er.code === "ENOSYS")
return true
var nonroot = !process.getuid || process.getuid() !== 0
if (nonroot) {
if (er.code === "EINVAL" || er.code === "EPERM")
return true
}
return false
}
}

77
node_modules/@jest/transform/package.json generated vendored Normal file
View File

@@ -0,0 +1,77 @@
{
"_from": "@jest/transform@^25.1.0",
"_id": "@jest/transform@25.1.0",
"_inBundle": false,
"_integrity": "sha512-4ktrQ2TPREVeM+KxB4zskAT84SnmG1vaz4S+51aTefyqn3zocZUnliLLm5Fsl85I3p/kFPN4CRp1RElIfXGegQ==",
"_location": "/@jest/transform",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@jest/transform@^25.1.0",
"name": "@jest/transform",
"escapedName": "@jest%2ftransform",
"scope": "@jest",
"rawSpec": "^25.1.0",
"saveSpec": null,
"fetchSpec": "^25.1.0"
},
"_requiredBy": [
"/@jest/test-result",
"/babel-jest",
"/jest-runtime"
],
"_resolved": "https://registry.npmjs.org/@jest/transform/-/transform-25.1.0.tgz",
"_shasum": "221f354f512b4628d88ce776d5b9e601028ea9da",
"_spec": "@jest/transform@^25.1.0",
"_where": "/home/runner/work/ghaction-upx/ghaction-upx/node_modules/jest-runtime",
"bugs": {
"url": "https://github.com/facebook/jest/issues"
},
"bundleDependencies": false,
"dependencies": {
"@babel/core": "^7.1.0",
"@jest/types": "^25.1.0",
"babel-plugin-istanbul": "^6.0.0",
"chalk": "^3.0.0",
"convert-source-map": "^1.4.0",
"fast-json-stable-stringify": "^2.0.0",
"graceful-fs": "^4.2.3",
"jest-haste-map": "^25.1.0",
"jest-regex-util": "^25.1.0",
"jest-util": "^25.1.0",
"micromatch": "^4.0.2",
"pirates": "^4.0.1",
"realpath-native": "^1.1.0",
"slash": "^3.0.0",
"source-map": "^0.6.1",
"write-file-atomic": "^3.0.0"
},
"deprecated": false,
"devDependencies": {
"@types/babel__core": "^7.1.0",
"@types/convert-source-map": "^1.5.1",
"@types/fast-json-stable-stringify": "^2.0.0",
"@types/graceful-fs": "^4.1.2",
"@types/micromatch": "^4.0.0",
"@types/write-file-atomic": "^3.0.0",
"dedent": "^0.7.0"
},
"engines": {
"node": ">= 8.3"
},
"gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638",
"homepage": "https://github.com/facebook/jest#readme",
"license": "MIT",
"main": "build/index.js",
"name": "@jest/transform",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/facebook/jest.git",
"directory": "packages/jest-transform"
},
"version": "25.1.0"
}