more
This commit is contained in:
dopeuni444
2025-07-31 12:23:33 +04:00
parent 20b46678b7
commit b5a22951ae
3401 changed files with 331100 additions and 0 deletions

21
unified-ai-platform/node_modules/jest-resolve/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) Meta Platforms, Inc. and 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,240 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.default = void 0;
function _path() {
const data = require('path');
_path = function () {
return data;
};
return data;
}
function _jestPnpResolver() {
const data = _interopRequireDefault(require('jest-pnp-resolver'));
_jestPnpResolver = function () {
return data;
};
return data;
}
function _resolve() {
const data = require('resolve');
_resolve = function () {
return data;
};
return data;
}
var resolve = _interopRequireWildcard(require('resolve.exports'));
var _fileWalkers = require('./fileWalkers');
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== 'function') return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function (nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interopRequireWildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
return {default: obj};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (key !== 'default' && 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 _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* Allows transforming parsed `package.json` contents.
*
* @param pkg - Parsed `package.json` contents.
* @param file - Path to `package.json` file.
* @param dir - Directory that contains the `package.json`.
*
* @returns Transformed `package.json` contents.
*/
/**
* Allows transforming a path within a package.
*
* @param pkg - Parsed `package.json` contents.
* @param path - Path being resolved.
* @param relativePath - Path relative from the `package.json` location.
*
* @returns Relative path that will be joined from the `package.json` location.
*/
const defaultResolver = (path, options) => {
// Yarn 2 adds support to `resolve` automatically so the pnpResolver is only
// needed for Yarn 1 which implements version 1 of the pnp spec
if (process.versions.pnp === '1') {
return (0, _jestPnpResolver().default)(path, options);
}
const resolveOptions = {
...options,
isDirectory: _fileWalkers.isDirectory,
isFile: _fileWalkers.isFile,
preserveSymlinks: false,
readPackageSync,
realpathSync: _fileWalkers.realpathSync
};
const pathToResolve = getPathInModule(path, resolveOptions);
// resolveSync dereferences symlinks to ensure we don't create a separate
// module instance depending on how it was referenced.
const result = (0, _resolve().sync)(pathToResolve, resolveOptions);
return result;
};
var _default = defaultResolver;
/*
* helper functions
*/
exports.default = _default;
function readPackageSync(_, file) {
return (0, _fileWalkers.readPackageCached)(file);
}
function getPathInModule(path, options) {
if (shouldIgnoreRequestForExports(path)) {
return path;
}
if (path.startsWith('#')) {
const closestPackageJson = (0, _fileWalkers.findClosestPackageJson)(
options.basedir
);
if (!closestPackageJson) {
throw new Error(
`Jest: unable to locate closest package.json from ${options.basedir} when resolving import "${path}"`
);
}
const pkg = (0, _fileWalkers.readPackageCached)(closestPackageJson);
const resolved = resolve.imports(
pkg,
path,
createResolveOptions(options.conditions)
);
if (resolved) {
const target = resolved[0];
return target.startsWith('.')
? // internal relative filepath
(0, _path().resolve)((0, _path().dirname)(closestPackageJson), target)
: // this is an external module, re-resolve it
defaultResolver(target, options);
}
if (pkg.imports) {
throw new Error(
'`imports` exists, but no results - this is a bug in Jest. Please report an issue'
);
}
}
const segments = path.split('/');
let moduleName = segments.shift();
if (moduleName) {
if (moduleName.startsWith('@')) {
moduleName = `${moduleName}/${segments.shift()}`;
}
// self-reference
const closestPackageJson = (0, _fileWalkers.findClosestPackageJson)(
options.basedir
);
if (closestPackageJson) {
const pkg = (0, _fileWalkers.readPackageCached)(closestPackageJson);
if (pkg.name === moduleName) {
const resolved = resolve.exports(
pkg,
segments.join('/') || '.',
createResolveOptions(options.conditions)
);
if (resolved) {
return (0, _path().resolve)(
(0, _path().dirname)(closestPackageJson),
resolved[0]
);
}
if (pkg.exports) {
throw new Error(
'`exports` exists, but no results - this is a bug in Jest. Please report an issue'
);
}
}
}
let packageJsonPath = '';
try {
packageJsonPath = (0, _resolve().sync)(
`${moduleName}/package.json`,
options
);
} catch {
// ignore if package.json cannot be found
}
if (packageJsonPath && (0, _fileWalkers.isFile)(packageJsonPath)) {
const pkg = (0, _fileWalkers.readPackageCached)(packageJsonPath);
const resolved = resolve.exports(
pkg,
segments.join('/') || '.',
createResolveOptions(options.conditions)
);
if (resolved) {
return (0, _path().resolve)(
(0, _path().dirname)(packageJsonPath),
resolved[0]
);
}
if (pkg.exports) {
throw new Error(
'`exports` exists, but no results - this is a bug in Jest. Please report an issue'
);
}
}
}
return path;
}
function createResolveOptions(conditions) {
return conditions
? {
conditions,
unsafe: true
}
: // no conditions were passed - let's assume this is Jest internal and it should be `require`
{
browser: false,
require: true
};
}
// if it's a relative import or an absolute path, imports/exports are ignored
const shouldIgnoreRequestForExports = path =>
path.startsWith('.') || (0, _path().isAbsolute)(path);

View File

@@ -0,0 +1,178 @@
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.clearFsCache = clearFsCache;
exports.findClosestPackageJson = findClosestPackageJson;
exports.isDirectory = isDirectory;
exports.isFile = isFile;
exports.readPackageCached = readPackageCached;
exports.realpathSync = realpathSync;
function _path() {
const data = require('path');
_path = function () {
return data;
};
return data;
}
function fs() {
const data = _interopRequireWildcard(require('graceful-fs'));
fs = function () {
return data;
};
return data;
}
function _jestUtil() {
const data = require('jest-util');
_jestUtil = function () {
return data;
};
return data;
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== 'function') return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function (nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interopRequireWildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
return {default: obj};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor =
Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (key !== 'default' && 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) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function clearFsCache() {
checkedPaths.clear();
checkedRealpathPaths.clear();
packageContents.clear();
}
var IPathType = /*#__PURE__*/ (function (IPathType) {
IPathType[(IPathType['FILE'] = 1)] = 'FILE';
IPathType[(IPathType['DIRECTORY'] = 2)] = 'DIRECTORY';
IPathType[(IPathType['OTHER'] = 3)] = 'OTHER';
return IPathType;
})(IPathType || {});
const checkedPaths = new Map();
function statSyncCached(path) {
const result = checkedPaths.get(path);
if (result != null) {
return result;
}
let stat;
try {
// @ts-expect-error TS2554 - throwIfNoEntry is only available in recent version of node, but inclusion of the option is a backward compatible no-op.
stat = fs().statSync(path, {
throwIfNoEntry: false
});
} catch (e) {
if (!(e && (e.code === 'ENOENT' || e.code === 'ENOTDIR'))) {
throw e;
}
}
if (stat) {
if (stat.isFile() || stat.isFIFO()) {
checkedPaths.set(path, IPathType.FILE);
return IPathType.FILE;
} else if (stat.isDirectory()) {
checkedPaths.set(path, IPathType.DIRECTORY);
return IPathType.DIRECTORY;
}
}
checkedPaths.set(path, IPathType.OTHER);
return IPathType.OTHER;
}
const checkedRealpathPaths = new Map();
function realpathCached(path) {
let result = checkedRealpathPaths.get(path);
if (result != null) {
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;
}
const packageContents = new Map();
function readPackageCached(path) {
let result = packageContents.get(path);
if (result != null) {
return result;
}
result = JSON.parse(fs().readFileSync(path, 'utf8'));
packageContents.set(path, result);
return result;
}
// adapted from
// https://github.com/lukeed/escalade/blob/2477005062cdbd8407afc90d3f48f4930354252b/src/sync.js
// to use cached `fs` calls
function findClosestPackageJson(start) {
let dir = (0, _path().resolve)('.', start);
if (!isDirectory(dir)) {
dir = (0, _path().dirname)(dir);
}
while (true) {
const pkgJsonFile = (0, _path().resolve)(dir, './package.json');
const hasPackageJson = isFile(pkgJsonFile);
if (hasPackageJson) {
return pkgJsonFile;
}
const prevDir = dir;
dir = (0, _path().dirname)(dir);
if (prevDir === dir) {
return undefined;
}
}
}
/*
* helper functions
*/
function isFile(file) {
return statSyncCached(file) === IPathType.FILE;
}
function isDirectory(dir) {
return statSyncCached(dir) === IPathType.DIRECTORY;
}
function realpathSync(file) {
return realpathCached(file);
}

View File