Updating NPM dependencies
This commit is contained in:
18
node_modules/jest-resolve/build/ModuleNotFoundError.d.ts
generated
vendored
Normal file
18
node_modules/jest-resolve/build/ModuleNotFoundError.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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 type { Config } from '@jest/types';
|
||||
export default class ModuleNotFoundError extends Error {
|
||||
code: string;
|
||||
hint?: string;
|
||||
requireStack?: Array<Config.Path>;
|
||||
siblingWithSimilarExtensionFound?: boolean;
|
||||
moduleName?: string;
|
||||
private _originalMessage?;
|
||||
constructor(message: string, moduleName?: string);
|
||||
buildMessage(rootDir: Config.Path): void;
|
||||
static duckType(error: ModuleNotFoundError): ModuleNotFoundError;
|
||||
}
|
||||
147
node_modules/jest-resolve/build/ModuleNotFoundError.js
generated
vendored
Normal file
147
node_modules/jest-resolve/build/ModuleNotFoundError.js
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _slash() {
|
||||
const data = _interopRequireDefault(require('slash'));
|
||||
|
||||
_slash = 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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
class ModuleNotFoundError extends Error {
|
||||
constructor(message, moduleName) {
|
||||
super(message);
|
||||
|
||||
_defineProperty(this, 'code', 'MODULE_NOT_FOUND');
|
||||
|
||||
_defineProperty(this, 'hint', void 0);
|
||||
|
||||
_defineProperty(this, 'requireStack', void 0);
|
||||
|
||||
_defineProperty(this, 'siblingWithSimilarExtensionFound', void 0);
|
||||
|
||||
_defineProperty(this, 'moduleName', void 0);
|
||||
|
||||
_defineProperty(this, '_originalMessage', void 0);
|
||||
|
||||
this._originalMessage = message;
|
||||
this.moduleName = moduleName;
|
||||
}
|
||||
|
||||
buildMessage(rootDir) {
|
||||
var _this$requireStack;
|
||||
|
||||
if (!this._originalMessage) {
|
||||
this._originalMessage = this.message || '';
|
||||
}
|
||||
|
||||
let message = this._originalMessage;
|
||||
|
||||
if (
|
||||
((_this$requireStack = this.requireStack) === null ||
|
||||
_this$requireStack === void 0
|
||||
? void 0
|
||||
: _this$requireStack.length) &&
|
||||
this.requireStack.length > 1
|
||||
) {
|
||||
message += `
|
||||
|
||||
Require stack:
|
||||
${this.requireStack
|
||||
.map(p => p.replace(`${rootDir}${path().sep}`, ''))
|
||||
.map(_slash().default)
|
||||
.join('\n ')}
|
||||
`;
|
||||
}
|
||||
|
||||
if (this.hint) {
|
||||
message += this.hint;
|
||||
}
|
||||
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
static duckType(error) {
|
||||
error.buildMessage = ModuleNotFoundError.prototype.buildMessage;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
exports.default = ModuleNotFoundError;
|
||||
15
node_modules/jest-resolve/build/defaultResolver.d.ts
generated
vendored
15
node_modules/jest-resolve/build/defaultResolver.d.ts
generated
vendored
@@ -4,8 +4,10 @@
|
||||
* 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 { Opts as ResolveOpts } from 'resolve';
|
||||
import type { Config } from '@jest/types';
|
||||
declare type ResolverOptions = {
|
||||
allowPnp?: boolean;
|
||||
basedir: Config.Path;
|
||||
browser?: boolean;
|
||||
defaultResolver: typeof defaultResolver;
|
||||
@@ -13,8 +15,15 @@ declare type ResolverOptions = {
|
||||
moduleDirectory?: Array<string>;
|
||||
paths?: Array<Config.Path>;
|
||||
rootDir?: Config.Path;
|
||||
packageFilter?: ResolveOpts['packageFilter'];
|
||||
};
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface ProcessVersions {
|
||||
pnp?: unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
export default function defaultResolver(path: Config.Path, options: ResolverOptions): Config.Path;
|
||||
export declare const clearDefaultResolverCache: () => void;
|
||||
export declare function clearDefaultResolverCache(): void;
|
||||
export {};
|
||||
//# sourceMappingURL=defaultResolver.d.ts.map
|
||||
1
node_modules/jest-resolve/build/defaultResolver.d.ts.map
generated
vendored
1
node_modules/jest-resolve/build/defaultResolver.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"defaultResolver.d.ts","sourceRoot":"","sources":["../src/defaultResolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAInC,aAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,OAAO,eAAe,CAAC;IACxC,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC;CACvB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,OAAO,EAAE,eAAe,GACvB,MAAM,CAAC,IAAI,CAgBb;AAED,eAAO,MAAM,yBAAyB,YAErC,CAAC"}
|
||||
256
node_modules/jest-resolve/build/defaultResolver.js
generated
vendored
256
node_modules/jest-resolve/build/defaultResolver.js
generated
vendored
@@ -4,32 +4,12 @@ Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = defaultResolver;
|
||||
exports.clearDefaultResolverCache = void 0;
|
||||
exports.clearDefaultResolverCache = clearDefaultResolverCache;
|
||||
|
||||
function _fs() {
|
||||
const data = _interopRequireDefault(require('fs'));
|
||||
function fs() {
|
||||
const data = _interopRequireWildcard(require('graceful-fs'));
|
||||
|
||||
_fs = function _fs() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require('path'));
|
||||
|
||||
_path = function _path() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _browserResolve() {
|
||||
const data = _interopRequireDefault(require('browser-resolve'));
|
||||
|
||||
_browserResolve = function _browserResolve() {
|
||||
fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -39,21 +19,79 @@ function _browserResolve() {
|
||||
function _jestPnpResolver() {
|
||||
const data = _interopRequireDefault(require('jest-pnp-resolver'));
|
||||
|
||||
_jestPnpResolver = function _jestPnpResolver() {
|
||||
_jestPnpResolver = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _isBuiltinModule = _interopRequireDefault(require('./isBuiltinModule'));
|
||||
function _resolve() {
|
||||
const data = require('resolve');
|
||||
|
||||
var _nodeModulesPaths = _interopRequireDefault(require('./nodeModulesPaths'));
|
||||
_resolve = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
|
||||
_jestUtil = 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.
|
||||
*
|
||||
@@ -61,142 +99,34 @@ function _interopRequireDefault(obj) {
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
function defaultResolver(path, options) {
|
||||
// @ts-ignore: the "pnp" version named isn't in DefinitelyTyped
|
||||
if (process.versions.pnp) {
|
||||
if (process.versions.pnp && options.allowPnp !== false) {
|
||||
return (0, _jestPnpResolver().default)(path, options);
|
||||
}
|
||||
|
||||
const resolve = options.browser
|
||||
? _browserResolve().default.sync
|
||||
: resolveSync;
|
||||
return resolve(path, {
|
||||
const result = (0, _resolve().sync)(path, {
|
||||
basedir: options.basedir,
|
||||
defaultResolver,
|
||||
extensions: options.extensions,
|
||||
isDirectory,
|
||||
isFile,
|
||||
moduleDirectory: options.moduleDirectory,
|
||||
packageFilter: options.packageFilter,
|
||||
paths: options.paths,
|
||||
rootDir: options.rootDir
|
||||
});
|
||||
preserveSymlinks: false,
|
||||
realpathSync
|
||||
}); // Dereference symlinks to ensure we don't create a separate
|
||||
// module instance depending on how it was referenced.
|
||||
|
||||
return realpathSync(result);
|
||||
}
|
||||
|
||||
const clearDefaultResolverCache = () => {
|
||||
function clearDefaultResolverCache() {
|
||||
checkedPaths.clear();
|
||||
};
|
||||
|
||||
exports.clearDefaultResolverCache = clearDefaultResolverCache;
|
||||
const REGEX_RELATIVE_IMPORT = /^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[\\\/])/;
|
||||
|
||||
function resolveSync(target, options) {
|
||||
const basedir = options.basedir;
|
||||
const extensions = options.extensions || ['.js'];
|
||||
const paths = options.paths || [];
|
||||
|
||||
if (REGEX_RELATIVE_IMPORT.test(target)) {
|
||||
// resolve relative import
|
||||
const resolveTarget = _path().default.resolve(basedir, target);
|
||||
|
||||
const result = tryResolve(resolveTarget);
|
||||
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
// otherwise search for node_modules
|
||||
const dirs = (0, _nodeModulesPaths.default)(basedir, {
|
||||
moduleDirectory: options.moduleDirectory,
|
||||
paths
|
||||
});
|
||||
|
||||
for (let i = 0; i < dirs.length; i++) {
|
||||
const resolveTarget = _path().default.join(dirs[i], target);
|
||||
|
||||
const result = tryResolve(resolveTarget);
|
||||
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((0, _isBuiltinModule.default)(target)) {
|
||||
return target;
|
||||
}
|
||||
|
||||
const err = new Error(
|
||||
"Cannot find module '" + target + "' from '" + basedir + "'"
|
||||
);
|
||||
err.code = 'MODULE_NOT_FOUND';
|
||||
throw err;
|
||||
/*
|
||||
* contextual helper functions
|
||||
*/
|
||||
|
||||
function tryResolve(name) {
|
||||
const dir = _path().default.dirname(name);
|
||||
|
||||
let result;
|
||||
|
||||
if (isDirectory(dir)) {
|
||||
result = resolveAsFile(name) || resolveAsDirectory(name);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
// Dereference symlinks to ensure we don't create a separate
|
||||
// module instance depending on how it was referenced.
|
||||
result = _fs().default.realpathSync(result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function resolveAsFile(name) {
|
||||
if (isFile(name)) {
|
||||
return name;
|
||||
}
|
||||
|
||||
for (let i = 0; i < extensions.length; i++) {
|
||||
const file = name + extensions[i];
|
||||
|
||||
if (isFile(file)) {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function resolveAsDirectory(name) {
|
||||
if (!isDirectory(name)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const pkgfile = _path().default.join(name, 'package.json');
|
||||
|
||||
let pkgmain;
|
||||
|
||||
try {
|
||||
const body = _fs().default.readFileSync(pkgfile, 'utf8');
|
||||
|
||||
pkgmain = JSON.parse(body).main;
|
||||
} catch (e) {}
|
||||
|
||||
if (pkgmain && !isCurrentDirectory(pkgmain)) {
|
||||
const resolveTarget = _path().default.resolve(name, pkgmain);
|
||||
|
||||
const result = tryResolve(resolveTarget);
|
||||
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return resolveAsFile(_path().default.join(name, 'index'));
|
||||
}
|
||||
checkedRealpathPaths.clear();
|
||||
}
|
||||
|
||||
var IPathType;
|
||||
|
||||
(function(IPathType) {
|
||||
(function (IPathType) {
|
||||
IPathType[(IPathType['FILE'] = 1)] = 'FILE';
|
||||
IPathType[(IPathType['DIRECTORY'] = 2)] = 'DIRECTORY';
|
||||
IPathType[(IPathType['OTHER'] = 3)] = 'OTHER';
|
||||
@@ -214,7 +144,7 @@ function statSyncCached(path) {
|
||||
let stat;
|
||||
|
||||
try {
|
||||
stat = _fs().default.statSync(path);
|
||||
stat = fs().statSync(path);
|
||||
} catch (e) {
|
||||
if (!(e && (e.code === 'ENOENT' || e.code === 'ENOTDIR'))) {
|
||||
throw e;
|
||||
@@ -234,6 +164,26 @@ function statSyncCached(path) {
|
||||
checkedPaths.set(path, IPathType.OTHER);
|
||||
return IPathType.OTHER;
|
||||
}
|
||||
|
||||
const checkedRealpathPaths = new Map();
|
||||
|
||||
function realpathCached(path) {
|
||||
let result = checkedRealpathPaths.get(path);
|
||||
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = (0, _jestUtil().tryRealpath)(path);
|
||||
checkedRealpathPaths.set(path, result);
|
||||
|
||||
if (path !== result) {
|
||||
// also cache the result in case it's ever referenced directly - no reason to `realpath` that as well
|
||||
checkedRealpathPaths.set(result, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/*
|
||||
* helper functions
|
||||
*/
|
||||
@@ -246,8 +196,6 @@ function isDirectory(dir) {
|
||||
return statSyncCached(dir) === IPathType.DIRECTORY;
|
||||
}
|
||||
|
||||
const CURRENT_DIRECTORY = _path().default.resolve('.');
|
||||
|
||||
function isCurrentDirectory(testPath) {
|
||||
return CURRENT_DIRECTORY === _path().default.resolve(testPath);
|
||||
function realpathSync(file) {
|
||||
return realpathCached(file);
|
||||
}
|
||||
|
||||
17
node_modules/jest-resolve/build/index.d.ts
generated
vendored
17
node_modules/jest-resolve/build/index.d.ts
generated
vendored
@@ -4,9 +4,11 @@
|
||||
* 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 { ModuleMap } from 'jest-haste-map';
|
||||
import { ResolverConfig } from './types';
|
||||
import type { Config } from '@jest/types';
|
||||
import type { ModuleMap } from 'jest-haste-map';
|
||||
import ModuleNotFoundError from './ModuleNotFoundError';
|
||||
import shouldLoadAsEsm from './shouldLoadAsEsm';
|
||||
import type { ResolverConfig } from './types';
|
||||
declare type FindNodeModuleConfig = {
|
||||
basedir: Config.Path;
|
||||
browser?: boolean;
|
||||
@@ -15,6 +17,7 @@ declare type FindNodeModuleConfig = {
|
||||
paths?: Array<Config.Path>;
|
||||
resolver?: Config.Path | null;
|
||||
rootDir?: Config.Path;
|
||||
throwIfNotFound?: boolean;
|
||||
};
|
||||
declare type BooleanObject = Record<string, boolean>;
|
||||
declare namespace Resolver {
|
||||
@@ -22,6 +25,7 @@ declare namespace Resolver {
|
||||
skipNodeResolution?: boolean;
|
||||
paths?: Array<Config.Path>;
|
||||
};
|
||||
type ResolverType = Resolver;
|
||||
}
|
||||
declare class Resolver {
|
||||
private readonly _options;
|
||||
@@ -31,13 +35,17 @@ declare class Resolver {
|
||||
private readonly _modulePathCache;
|
||||
private readonly _supportsNativePlatform;
|
||||
constructor(moduleMap: ModuleMap, options: ResolverConfig);
|
||||
static ModuleNotFoundError: typeof ModuleNotFoundError;
|
||||
static tryCastModuleNotFoundError(error: unknown): ModuleNotFoundError | null;
|
||||
static clearDefaultResolverCache(): void;
|
||||
static findNodeModule(path: Config.Path, options: FindNodeModuleConfig): Config.Path | null;
|
||||
static unstable_shouldLoadAsEsm: typeof shouldLoadAsEsm;
|
||||
resolveModuleFromDirIfExists(dirname: Config.Path, moduleName: string, options?: Resolver.ResolveModuleConfig): Config.Path | null;
|
||||
resolveModule(from: Config.Path, moduleName: string, options?: Resolver.ResolveModuleConfig): Config.Path;
|
||||
private _isAliasModule;
|
||||
isCoreModule(moduleName: string): boolean;
|
||||
getModule(name: string): Config.Path | null;
|
||||
getModulePath(from: Config.Path, moduleName: string): string;
|
||||
getModulePath(from: Config.Path, moduleName: string): Config.Path;
|
||||
getPackage(name: string): Config.Path | null;
|
||||
getMockModule(from: Config.Path, name: string): Config.Path | null;
|
||||
getModulePaths(from: Config.Path): Array<Config.Path>;
|
||||
@@ -50,4 +58,3 @@ declare class Resolver {
|
||||
resolveStubModuleName(from: Config.Path, moduleName: string): Config.Path | null;
|
||||
}
|
||||
export = Resolver;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/jest-resolve/build/index.d.ts.map
generated
vendored
1
node_modules/jest-resolve/build/index.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
||||
298
node_modules/jest-resolve/build/index.js
generated
vendored
298
node_modules/jest-resolve/build/index.js
generated
vendored
@@ -1,19 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require('path'));
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
_path = function _path() {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _realpathNative() {
|
||||
const data = require('realpath-native');
|
||||
|
||||
_realpathNative = function _realpathNative() {
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -23,46 +13,89 @@ function _realpathNative() {
|
||||
function _chalk() {
|
||||
const data = _interopRequireDefault(require('chalk'));
|
||||
|
||||
_chalk = function _chalk() {
|
||||
_chalk = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _nodeModulesPaths = _interopRequireDefault(require('./nodeModulesPaths'));
|
||||
function _slash() {
|
||||
const data = _interopRequireDefault(require('slash'));
|
||||
|
||||
_slash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
|
||||
_jestUtil = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var _ModuleNotFoundError = _interopRequireDefault(
|
||||
require('./ModuleNotFoundError')
|
||||
);
|
||||
|
||||
var _defaultResolver = _interopRequireWildcard(require('./defaultResolver'));
|
||||
|
||||
var _isBuiltinModule = _interopRequireDefault(require('./isBuiltinModule'));
|
||||
|
||||
var _defaultResolver = _interopRequireWildcard(require('./defaultResolver'));
|
||||
var _nodeModulesPaths = _interopRequireDefault(require('./nodeModulesPaths'));
|
||||
|
||||
var _shouldLoadAsEsm = _interopRequireWildcard(require('./shouldLoadAsEsm'));
|
||||
|
||||
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;
|
||||
} else {
|
||||
var newObj = {};
|
||||
if (obj != null) {
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: {};
|
||||
if (desc.get || desc.set) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
return newObj;
|
||||
}
|
||||
}
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
@@ -81,15 +114,13 @@ function _defineProperty(obj, key, value) {
|
||||
|
||||
const NATIVE_PLATFORM = 'native'; // We might be inside a symlink.
|
||||
|
||||
const cwd = process.cwd();
|
||||
const resolvedCwd = (0, _realpathNative().sync)(cwd) || cwd;
|
||||
const NODE_PATH = process.env.NODE_PATH;
|
||||
const resolvedCwd = (0, _jestUtil().tryRealpath)(process.cwd());
|
||||
const {NODE_PATH} = process.env;
|
||||
const nodePaths = NODE_PATH
|
||||
? NODE_PATH.split(_path().default.delimiter)
|
||||
? NODE_PATH.split(path().delimiter)
|
||||
.filter(Boolean) // The resolver expects absolute paths.
|
||||
.map(p => _path().default.resolve(resolvedCwd, p))
|
||||
.map(p => path().resolve(resolvedCwd, p))
|
||||
: undefined;
|
||||
/* eslint-disable-next-line no-redeclare */
|
||||
|
||||
class Resolver {
|
||||
constructor(moduleMap, options) {
|
||||
@@ -106,7 +137,6 @@ class Resolver {
|
||||
_defineProperty(this, '_supportsNativePlatform', void 0);
|
||||
|
||||
this._options = {
|
||||
browser: options.browser,
|
||||
defaultPlatform: options.defaultPlatform,
|
||||
extensions: options.extensions,
|
||||
hasCoreModules:
|
||||
@@ -127,8 +157,23 @@ class Resolver {
|
||||
this._modulePathCache = new Map();
|
||||
}
|
||||
|
||||
static tryCastModuleNotFoundError(error) {
|
||||
if (error instanceof _ModuleNotFoundError.default) {
|
||||
return error;
|
||||
}
|
||||
|
||||
const casted = error;
|
||||
|
||||
if (casted.code === 'MODULE_NOT_FOUND') {
|
||||
return _ModuleNotFoundError.default.duckType(casted);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static clearDefaultResolverCache() {
|
||||
(0, _defaultResolver.clearDefaultResolverCache)();
|
||||
(0, _shouldLoadAsEsm.clearCachedLookups)();
|
||||
}
|
||||
|
||||
static findNodeModule(path, options) {
|
||||
@@ -147,15 +192,19 @@ class Resolver {
|
||||
paths: paths ? (nodePaths || []).concat(paths) : nodePaths,
|
||||
rootDir: options.rootDir
|
||||
});
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
if (options.throwIfNotFound) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
} // unstable as it should be replaced by https://github.com/nodejs/modules/issues/393, and we don't want people to use it
|
||||
|
||||
resolveModuleFromDirIfExists(dirname, moduleName, options) {
|
||||
const paths = (options && options.paths) || this._options.modulePaths;
|
||||
const moduleDirectory = this._options.moduleDirectories;
|
||||
const key = dirname + _path().default.delimiter + moduleName;
|
||||
const key = dirname + path().delimiter + moduleName;
|
||||
const defaultPlatform = this._options.defaultPlatform;
|
||||
|
||||
const extensions = this._options.extensions.slice();
|
||||
@@ -195,23 +244,21 @@ class Resolver {
|
||||
// exist and aren't mocked.
|
||||
|
||||
const skipResolution =
|
||||
options &&
|
||||
options.skipNodeResolution &&
|
||||
!moduleName.includes(_path().default.sep);
|
||||
options && options.skipNodeResolution && !moduleName.includes(path().sep);
|
||||
|
||||
const resolveNodeModule = name =>
|
||||
const resolveNodeModule = (name, throwIfNotFound = false) =>
|
||||
Resolver.findNodeModule(name, {
|
||||
basedir: dirname,
|
||||
browser: this._options.browser,
|
||||
extensions,
|
||||
moduleDirectory,
|
||||
paths,
|
||||
resolver: this._options.resolver,
|
||||
rootDir: this._options.rootDir
|
||||
rootDir: this._options.rootDir,
|
||||
throwIfNotFound
|
||||
});
|
||||
|
||||
if (!skipResolution) {
|
||||
module = resolveNodeModule(moduleName);
|
||||
module = resolveNodeModule(moduleName, Boolean(process.versions.pnp));
|
||||
|
||||
if (module) {
|
||||
this._moduleNameCache.set(key, module);
|
||||
@@ -226,9 +273,9 @@ class Resolver {
|
||||
|
||||
if (hastePackage) {
|
||||
try {
|
||||
const module = _path().default.join.apply(
|
||||
_path().default,
|
||||
[_path().default.dirname(hastePackage)].concat(parts)
|
||||
const module = path().join.apply(
|
||||
path(),
|
||||
[path().dirname(hastePackage)].concat(parts)
|
||||
); // try resolving with custom resolver first to support extensions,
|
||||
// then fallback to require.resolve
|
||||
|
||||
@@ -238,15 +285,14 @@ class Resolver {
|
||||
this._moduleNameCache.set(key, resolvedModule);
|
||||
|
||||
return resolvedModule;
|
||||
} catch (ignoredError) {}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
resolveModule(from, moduleName, options) {
|
||||
const dirname = _path().default.dirname(from);
|
||||
|
||||
const dirname = path().dirname(from);
|
||||
const module =
|
||||
this.resolveStubModuleName(from, moduleName) ||
|
||||
this.resolveModuleFromDirIfExists(dirname, moduleName, options);
|
||||
@@ -254,18 +300,30 @@ class Resolver {
|
||||
// produces an error based on the dirname but we have the actual current
|
||||
// module name available.
|
||||
|
||||
const relativePath = _path().default.relative(dirname, from);
|
||||
|
||||
const err = new Error(
|
||||
`Cannot find module '${moduleName}' from '${relativePath || '.'}'`
|
||||
const relativePath =
|
||||
(0, _slash().default)(path().relative(this._options.rootDir, from)) ||
|
||||
'.';
|
||||
throw new _ModuleNotFoundError.default(
|
||||
`Cannot find module '${moduleName}' from '${relativePath}'`,
|
||||
moduleName
|
||||
);
|
||||
err.code = 'MODULE_NOT_FOUND';
|
||||
throw err;
|
||||
}
|
||||
|
||||
_isAliasModule(moduleName) {
|
||||
const moduleNameMapper = this._options.moduleNameMapper;
|
||||
|
||||
if (!moduleNameMapper) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return moduleNameMapper.some(({regex}) => regex.test(moduleName));
|
||||
}
|
||||
|
||||
isCoreModule(moduleName) {
|
||||
return (
|
||||
this._options.hasCoreModules && (0, _isBuiltinModule.default)(moduleName)
|
||||
this._options.hasCoreModules &&
|
||||
(0, _isBuiltinModule.default)(moduleName) &&
|
||||
!this._isAliasModule(moduleName)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -278,13 +336,11 @@ class Resolver {
|
||||
}
|
||||
|
||||
getModulePath(from, moduleName) {
|
||||
if (moduleName[0] !== '.' || _path().default.isAbsolute(moduleName)) {
|
||||
if (moduleName[0] !== '.' || path().isAbsolute(moduleName)) {
|
||||
return moduleName;
|
||||
}
|
||||
|
||||
return _path().default.normalize(
|
||||
_path().default.dirname(from) + '/' + moduleName
|
||||
);
|
||||
return path().normalize(path().dirname(from) + '/' + moduleName);
|
||||
}
|
||||
|
||||
getPackage(name) {
|
||||
@@ -335,7 +391,7 @@ class Resolver {
|
||||
|
||||
getModuleID(virtualMocks, from, _moduleName) {
|
||||
const moduleName = _moduleName || '';
|
||||
const key = from + _path().default.delimiter + moduleName;
|
||||
const key = from + path().delimiter + moduleName;
|
||||
|
||||
const cachedModuleID = this._moduleIDCache.get(key);
|
||||
|
||||
@@ -349,8 +405,7 @@ class Resolver {
|
||||
|
||||
const mockPath = this._getMockPath(from, moduleName);
|
||||
|
||||
const sep = _path().default.delimiter;
|
||||
|
||||
const sep = path().delimiter;
|
||||
const id =
|
||||
moduleType +
|
||||
sep +
|
||||
@@ -398,8 +453,7 @@ class Resolver {
|
||||
}
|
||||
|
||||
resolveStubModuleName(from, moduleName) {
|
||||
const dirname = _path().default.dirname(from);
|
||||
|
||||
const dirname = path().dirname(from);
|
||||
const paths = this._options.modulePaths;
|
||||
|
||||
const extensions = this._options.extensions.slice();
|
||||
@@ -422,35 +476,29 @@ class Resolver {
|
||||
}
|
||||
|
||||
if (moduleNameMapper) {
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (
|
||||
var _iterator = moduleNameMapper[Symbol.iterator](), _step;
|
||||
!(_iteratorNormalCompletion = (_step = _iterator.next()).done);
|
||||
_iteratorNormalCompletion = true
|
||||
) {
|
||||
const _step$value = _step.value,
|
||||
mappedModuleName = _step$value.moduleName,
|
||||
regex = _step$value.regex;
|
||||
|
||||
if (regex.test(moduleName)) {
|
||||
// Note: once a moduleNameMapper matches the name, it must result
|
||||
// in a module, or else an error is thrown.
|
||||
const matches = moduleName.match(regex);
|
||||
const updatedName = matches
|
||||
? mappedModuleName.replace(
|
||||
for (const {moduleName: mappedModuleName, regex} of moduleNameMapper) {
|
||||
if (regex.test(moduleName)) {
|
||||
// Note: once a moduleNameMapper matches the name, it must result
|
||||
// in a module, or else an error is thrown.
|
||||
const matches = moduleName.match(regex);
|
||||
const mapModuleName = matches
|
||||
? moduleName =>
|
||||
moduleName.replace(
|
||||
/\$([0-9]+)/g,
|
||||
(_, index) => matches[parseInt(index, 10)]
|
||||
)
|
||||
: mappedModuleName;
|
||||
const module =
|
||||
: moduleName => moduleName;
|
||||
const possibleModuleNames = Array.isArray(mappedModuleName)
|
||||
? mappedModuleName
|
||||
: [mappedModuleName];
|
||||
let module = null;
|
||||
|
||||
for (const possibleModuleName of possibleModuleNames) {
|
||||
const updatedName = mapModuleName(possibleModuleName);
|
||||
module =
|
||||
this.getModule(updatedName) ||
|
||||
Resolver.findNodeModule(updatedName, {
|
||||
basedir: dirname,
|
||||
browser: this._options.browser,
|
||||
extensions,
|
||||
moduleDirectory,
|
||||
paths,
|
||||
@@ -458,31 +506,22 @@ class Resolver {
|
||||
rootDir: this._options.rootDir
|
||||
});
|
||||
|
||||
if (!module) {
|
||||
throw createNoMappedModuleFoundError(
|
||||
moduleName,
|
||||
updatedName,
|
||||
mappedModuleName,
|
||||
regex,
|
||||
resolver
|
||||
);
|
||||
if (module) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return module;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
if (!module) {
|
||||
throw createNoMappedModuleFoundError(
|
||||
moduleName,
|
||||
mapModuleName,
|
||||
mappedModuleName,
|
||||
regex,
|
||||
resolver
|
||||
);
|
||||
}
|
||||
|
||||
return module;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -491,23 +530,34 @@ class Resolver {
|
||||
}
|
||||
}
|
||||
|
||||
_defineProperty(Resolver, 'ModuleNotFoundError', _ModuleNotFoundError.default);
|
||||
|
||||
_defineProperty(Resolver, 'unstable_shouldLoadAsEsm', _shouldLoadAsEsm.default);
|
||||
|
||||
const createNoMappedModuleFoundError = (
|
||||
moduleName,
|
||||
updatedName,
|
||||
mapModuleName,
|
||||
mappedModuleName,
|
||||
regex,
|
||||
resolver
|
||||
) => {
|
||||
const mappedAs = Array.isArray(mappedModuleName)
|
||||
? JSON.stringify(mappedModuleName.map(mapModuleName), null, 2)
|
||||
: mappedModuleName;
|
||||
const original = Array.isArray(mappedModuleName)
|
||||
? JSON.stringify(mappedModuleName, null, 6) // using 6 because of misalignment when nested below
|
||||
.slice(0, -1) + ' ]' /// align last bracket correctly as well
|
||||
: mappedModuleName;
|
||||
const error = new Error(
|
||||
_chalk().default.red(`${_chalk().default.bold('Configuration error')}:
|
||||
|
||||
Could not locate module ${_chalk().default.bold(moduleName)} mapped as:
|
||||
${_chalk().default.bold(updatedName)}.
|
||||
${_chalk().default.bold(mappedAs)}.
|
||||
|
||||
Please check your configuration for these entries:
|
||||
{
|
||||
"moduleNameMapper": {
|
||||
"${regex.toString()}": "${_chalk().default.bold(mappedModuleName)}"
|
||||
"${regex.toString()}": "${_chalk().default.bold(original)}"
|
||||
},
|
||||
"resolver": ${_chalk().default.bold(String(resolver))}
|
||||
}`)
|
||||
|
||||
1
node_modules/jest-resolve/build/isBuiltinModule.d.ts
generated
vendored
1
node_modules/jest-resolve/build/isBuiltinModule.d.ts
generated
vendored
@@ -5,4 +5,3 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
export default function isBuiltinModule(module: string): boolean;
|
||||
//# sourceMappingURL=isBuiltinModule.d.ts.map
|
||||
1
node_modules/jest-resolve/build/isBuiltinModule.d.ts.map
generated
vendored
1
node_modules/jest-resolve/build/isBuiltinModule.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"isBuiltinModule.d.ts","sourceRoot":"","sources":["../src/isBuiltinModule.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE/D"}
|
||||
8
node_modules/jest-resolve/build/isBuiltinModule.js
generated
vendored
8
node_modules/jest-resolve/build/isBuiltinModule.js
generated
vendored
@@ -5,10 +5,10 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.default = isBuiltinModule;
|
||||
|
||||
function _module2() {
|
||||
function _module() {
|
||||
const data = _interopRequireDefault(require('module'));
|
||||
|
||||
_module2 = function _module2() {
|
||||
_module = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -27,8 +27,8 @@ function _interopRequireDefault(obj) {
|
||||
*/
|
||||
const EXPERIMENTAL_MODULES = ['worker_threads'];
|
||||
const BUILTIN_MODULES = new Set(
|
||||
_module2().default.builtinModules
|
||||
? _module2().default.builtinModules.concat(EXPERIMENTAL_MODULES)
|
||||
_module().default.builtinModules
|
||||
? _module().default.builtinModules.concat(EXPERIMENTAL_MODULES)
|
||||
: Object.keys(process.binding('natives'))
|
||||
.filter(module => !/^internal\//.test(module))
|
||||
.concat(EXPERIMENTAL_MODULES)
|
||||
|
||||
3
node_modules/jest-resolve/build/nodeModulesPaths.d.ts
generated
vendored
3
node_modules/jest-resolve/build/nodeModulesPaths.d.ts
generated
vendored
@@ -6,11 +6,10 @@
|
||||
*
|
||||
* Adapted from: https://github.com/substack/node-resolve
|
||||
*/
|
||||
import { Config } from '@jest/types';
|
||||
import type { Config } from '@jest/types';
|
||||
declare type NodeModulesPathsOptions = {
|
||||
moduleDirectory?: Array<string>;
|
||||
paths?: Array<Config.Path>;
|
||||
};
|
||||
export default function nodeModulesPaths(basedir: Config.Path, options: NodeModulesPathsOptions): Array<Config.Path>;
|
||||
export {};
|
||||
//# sourceMappingURL=nodeModulesPaths.d.ts.map
|
||||
1
node_modules/jest-resolve/build/nodeModulesPaths.d.ts.map
generated
vendored
1
node_modules/jest-resolve/build/nodeModulesPaths.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"nodeModulesPaths.d.ts","sourceRoot":"","sources":["../src/nodeModulesPaths.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAGnC,aAAK,uBAAuB,GAAG;IAC7B,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;CAC5B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,OAAO,EAAE,MAAM,CAAC,IAAI,EACpB,OAAO,EAAE,uBAAuB,GAC/B,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAmDpB"}
|
||||
70
node_modules/jest-resolve/build/nodeModulesPaths.js
generated
vendored
70
node_modules/jest-resolve/build/nodeModulesPaths.js
generated
vendored
@@ -5,28 +5,66 @@ Object.defineProperty(exports, '__esModule', {
|
||||
});
|
||||
exports.default = nodeModulesPaths;
|
||||
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require('path'));
|
||||
function path() {
|
||||
const data = _interopRequireWildcard(require('path'));
|
||||
|
||||
_path = function _path() {
|
||||
path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _realpathNative() {
|
||||
const data = require('realpath-native');
|
||||
function _jestUtil() {
|
||||
const data = require('jest-util');
|
||||
|
||||
_realpathNative = function _realpathNative() {
|
||||
_jestUtil = 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,8 +82,7 @@ function nodeModulesPaths(basedir, options) {
|
||||
: ['node_modules']; // ensure that `basedir` is an absolute path at this point,
|
||||
// resolving against the process' current working directory
|
||||
|
||||
const basedirAbs = _path().default.resolve(basedir);
|
||||
|
||||
const basedirAbs = path().resolve(basedir);
|
||||
let prefix = '/';
|
||||
|
||||
if (/^([A-Za-z]:)/.test(basedirAbs)) {
|
||||
@@ -58,19 +95,18 @@ function nodeModulesPaths(basedir, options) {
|
||||
let physicalBasedir;
|
||||
|
||||
try {
|
||||
physicalBasedir = (0, _realpathNative().sync)(basedirAbs);
|
||||
} catch (err) {
|
||||
physicalBasedir = (0, _jestUtil().tryRealpath)(basedirAbs);
|
||||
} catch {
|
||||
// realpath can throw, e.g. on mapped drives
|
||||
physicalBasedir = basedirAbs;
|
||||
}
|
||||
|
||||
const paths = [physicalBasedir];
|
||||
|
||||
let parsed = _path().default.parse(physicalBasedir);
|
||||
let parsed = path().parse(physicalBasedir);
|
||||
|
||||
while (parsed.dir !== paths[paths.length - 1]) {
|
||||
paths.push(parsed.dir);
|
||||
parsed = _path().default.parse(parsed.dir);
|
||||
parsed = path().parse(parsed.dir);
|
||||
}
|
||||
|
||||
const dirs = paths
|
||||
@@ -78,11 +114,11 @@ function nodeModulesPaths(basedir, options) {
|
||||
(dirs, aPath) =>
|
||||
dirs.concat(
|
||||
modules.map(moduleDir =>
|
||||
_path().default.isAbsolute(moduleDir)
|
||||
path().isAbsolute(moduleDir)
|
||||
? aPath === basedirAbs
|
||||
? moduleDir
|
||||
: ''
|
||||
: _path().default.join(prefix, aPath, moduleDir)
|
||||
: path().join(prefix, aPath, moduleDir)
|
||||
)
|
||||
),
|
||||
[]
|
||||
|
||||
9
node_modules/jest-resolve/build/shouldLoadAsEsm.d.ts
generated
vendored
Normal file
9
node_modules/jest-resolve/build/shouldLoadAsEsm.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* 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 type { Config } from '@jest/types';
|
||||
export declare function clearCachedLookups(): void;
|
||||
export default function cachedShouldLoadAsEsm(path: Config.Path): boolean;
|
||||
113
node_modules/jest-resolve/build/shouldLoadAsEsm.js
generated
vendored
Normal file
113
node_modules/jest-resolve/build/shouldLoadAsEsm.js
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.clearCachedLookups = clearCachedLookups;
|
||||
exports.default = cachedShouldLoadAsEsm;
|
||||
|
||||
function _path() {
|
||||
const data = require('path');
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _vm() {
|
||||
const data = require('vm');
|
||||
|
||||
_vm = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _readPkgUp() {
|
||||
const data = _interopRequireDefault(require('read-pkg-up'));
|
||||
|
||||
_readPkgUp = 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.
|
||||
*/
|
||||
// @ts-expect-error: experimental, not added to the types
|
||||
const runtimeSupportsVmModules = typeof _vm().SyntheticModule === 'function';
|
||||
const cachedFileLookups = new Map();
|
||||
const cachedDirLookups = new Map();
|
||||
|
||||
function clearCachedLookups() {
|
||||
cachedFileLookups.clear();
|
||||
cachedDirLookups.clear();
|
||||
}
|
||||
|
||||
function cachedShouldLoadAsEsm(path) {
|
||||
let cachedLookup = cachedFileLookups.get(path);
|
||||
|
||||
if (cachedLookup === undefined) {
|
||||
cachedLookup = shouldLoadAsEsm(path);
|
||||
cachedFileLookups.set(path, cachedLookup);
|
||||
}
|
||||
|
||||
return cachedLookup;
|
||||
} // this is a bad version of what https://github.com/nodejs/modules/issues/393 would provide
|
||||
|
||||
function shouldLoadAsEsm(path) {
|
||||
if (!runtimeSupportsVmModules) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const extension = (0, _path().extname)(path);
|
||||
|
||||
if (extension === '.mjs') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (extension === '.cjs') {
|
||||
return false;
|
||||
} // this isn't correct - we might wanna load any file as a module (using synthetic module)
|
||||
// do we need an option to Jest so people can opt in to ESM for non-js?
|
||||
|
||||
if (extension !== '.js') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const cwd = (0, _path().dirname)(path);
|
||||
let cachedLookup = cachedDirLookups.get(cwd);
|
||||
|
||||
if (cachedLookup === undefined) {
|
||||
cachedLookup = cachedPkgCheck(cwd);
|
||||
cachedFileLookups.set(cwd, cachedLookup);
|
||||
}
|
||||
|
||||
return cachedLookup;
|
||||
}
|
||||
|
||||
function cachedPkgCheck(cwd) {
|
||||
// TODO: can we cache lookups somehow?
|
||||
const pkg = _readPkgUp().default.sync({
|
||||
cwd,
|
||||
normalize: false
|
||||
});
|
||||
|
||||
if (!pkg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return pkg.packageJson.type === 'module';
|
||||
}
|
||||
8
node_modules/jest-resolve/build/types.d.ts
generated
vendored
8
node_modules/jest-resolve/build/types.d.ts
generated
vendored
@@ -4,22 +4,20 @@
|
||||
* 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 type { Config } from '@jest/types';
|
||||
export declare type ResolverConfig = {
|
||||
browser?: boolean;
|
||||
defaultPlatform?: string | null;
|
||||
extensions: Array<string>;
|
||||
hasCoreModules: boolean;
|
||||
moduleDirectories: Array<string>;
|
||||
moduleNameMapper?: Array<ModuleNameMapperConfig> | null;
|
||||
modulePaths: Array<Config.Path>;
|
||||
modulePaths?: Array<Config.Path>;
|
||||
platforms?: Array<string>;
|
||||
resolver?: Config.Path | null;
|
||||
rootDir: Config.Path;
|
||||
};
|
||||
declare type ModuleNameMapperConfig = {
|
||||
regex: RegExp;
|
||||
moduleName: string;
|
||||
moduleName: string | Array<string>;
|
||||
};
|
||||
export {};
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
1
node_modules/jest-resolve/build/types.d.ts.map
generated
vendored
1
node_modules/jest-resolve/build/types.d.ts.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAEnC,oBAAY,cAAc,GAAG;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,gBAAgB,CAAC,EAAE,KAAK,CAAC,sBAAsB,CAAC,GAAG,IAAI,CAAC;IACxD,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC;CACtB,CAAC;AAEF,aAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
||||
Reference in New Issue
Block a user