Updating NPM dependencies
This commit is contained in:
117
node_modules/jest-runtime/build/helpers.js
generated
vendored
117
node_modules/jest-runtime/build/helpers.js
generated
vendored
@@ -3,22 +3,12 @@
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.findSiblingsWithFileExtension = void 0;
|
||||
exports.findSiblingsWithFileExtension = exports.decodePossibleOutsideJestVmPath = exports.createOutsideJestVmPath = void 0;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require('path'));
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
_path = function _path() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _slash() {
|
||||
const data = _interopRequireDefault(require('slash'));
|
||||
|
||||
_slash = function _slash() {
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -28,7 +18,17 @@ function _slash() {
|
||||
function _glob() {
|
||||
const data = _interopRequireDefault(require('glob'));
|
||||
|
||||
_glob = function _glob() {
|
||||
_glob = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _slash() {
|
||||
const data = _interopRequireDefault(require('slash'));
|
||||
|
||||
_slash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -39,24 +39,85 @@ 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 OUTSIDE_JEST_VM_PROTOCOL = 'jest-main:'; // String manipulation is easier here, fileURLToPath is only in newer Nodes,
|
||||
// plus setting non-standard protocols on URL objects is difficult.
|
||||
|
||||
const createOutsideJestVmPath = path =>
|
||||
OUTSIDE_JEST_VM_PROTOCOL + '//' + encodeURIComponent(path);
|
||||
|
||||
exports.createOutsideJestVmPath = createOutsideJestVmPath;
|
||||
|
||||
const decodePossibleOutsideJestVmPath = outsideJestVmPath => {
|
||||
if (outsideJestVmPath.startsWith(OUTSIDE_JEST_VM_PROTOCOL)) {
|
||||
return decodeURIComponent(
|
||||
outsideJestVmPath.replace(
|
||||
new RegExp('^' + OUTSIDE_JEST_VM_PROTOCOL + '//'),
|
||||
''
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
exports.decodePossibleOutsideJestVmPath = decodePossibleOutsideJestVmPath;
|
||||
|
||||
const findSiblingsWithFileExtension = (
|
||||
moduleFileExtensions,
|
||||
from,
|
||||
moduleName
|
||||
) => {
|
||||
if (
|
||||
!_path().default.isAbsolute(moduleName) &&
|
||||
_path().default.extname(moduleName) === ''
|
||||
) {
|
||||
const dirname = _path().default.dirname(from);
|
||||
|
||||
const pathToModule = _path().default.resolve(dirname, moduleName);
|
||||
if (!path().isAbsolute(moduleName) && path().extname(moduleName) === '') {
|
||||
const dirname = path().dirname(from);
|
||||
const pathToModule = path().resolve(dirname, moduleName);
|
||||
|
||||
try {
|
||||
const slashedDirname = (0, _slash().default)(dirname);
|
||||
@@ -65,12 +126,8 @@ const findSiblingsWithFileExtension = (
|
||||
.default.sync(`${pathToModule}.*`)
|
||||
.map(match => (0, _slash().default)(match))
|
||||
.map(match => {
|
||||
const relativePath = _path().default.posix.relative(
|
||||
slashedDirname,
|
||||
match
|
||||
);
|
||||
|
||||
return _path().default.posix.dirname(match) === slashedDirname
|
||||
const relativePath = path().posix.relative(slashedDirname, match);
|
||||
return path().posix.dirname(match) === slashedDirname
|
||||
? `./${relativePath}`
|
||||
: relativePath;
|
||||
})
|
||||
@@ -85,10 +142,10 @@ const findSiblingsWithFileExtension = (
|
||||
return (
|
||||
foundMessage +
|
||||
"\n\nYou might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently " +
|
||||
`[${mappedModuleFileExtensions}].\n\nSee https://jestjs.io/docs/en/configuration#modulefileextensions-array-string`
|
||||
`[${mappedModuleFileExtensions}].\n\nSee https://jestjs.io/docs/en/configuration#modulefileextensions-arraystring`
|
||||
);
|
||||
}
|
||||
} catch (ignored) {}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
Reference in New Issue
Block a user