@graphql-tools/load-files
Advanced tools
Comparing version 7.0.0-rc-20230519104353-b09f3180 to 7.0.0-rc-20230519104627-f6fea064
@@ -91,3 +91,2 @@ "use strict"; | ||
function loadFilesSync(pattern, options = LoadFilesDefaultOptions) { | ||
var _a, _b; | ||
const execOptions = { ...LoadFilesDefaultOptions, ...options }; | ||
@@ -97,4 +96,4 @@ const relevantPaths = scanForFilesSync(asArray(pattern).map(path => isDirectorySync(path) | ||
: (0, unixify_1.default)(path)), options.globOptions); | ||
const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY((_a = execOptions.exportNames) !== null && _a !== void 0 ? _a : []); | ||
const requireMethod = execOptions.requireMethod || (0, module_1.createRequire)((0, path_1.join)(((_b = options === null || options === void 0 ? void 0 : options.globOptions) === null || _b === void 0 ? void 0 : _b.cwd) || (0, process_1.cwd)(), 'noop.js')); | ||
const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY(execOptions.exportNames ?? []); | ||
const requireMethod = execOptions.requireMethod || (0, module_1.createRequire)((0, path_1.join)(options?.globOptions?.cwd || (0, process_1.cwd)(), 'noop.js')); | ||
return relevantPaths | ||
@@ -158,3 +157,2 @@ .map(path => { | ||
async function loadFiles(pattern, options = LoadFilesDefaultOptions) { | ||
var _a; | ||
const execOptions = { ...LoadFilesDefaultOptions, ...options }; | ||
@@ -164,6 +162,5 @@ const relevantPaths = await scanForFiles(await Promise.all(asArray(pattern).map(async (path) => (await isDirectory(path)) | ||
: (0, unixify_1.default)(path))), options.globOptions); | ||
const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY((_a = execOptions.exportNames) !== null && _a !== void 0 ? _a : []); | ||
const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY(execOptions.exportNames ?? []); | ||
const defaultRequireMethod = (path) => Promise.resolve(`${path}`).then(s => tslib_1.__importStar(require(s))).catch(importError => { | ||
var _a; | ||
const cwdRequire = (0, module_1.createRequire)((0, path_1.join)(((_a = options === null || options === void 0 ? void 0 : options.globOptions) === null || _a === void 0 ? void 0 : _a.cwd) || (0, process_1.cwd)(), 'noop.js')); | ||
const cwdRequire = (0, module_1.createRequire)((0, path_1.join)(options?.globOptions?.cwd || (0, process_1.cwd)(), 'noop.js')); | ||
try { | ||
@@ -170,0 +167,0 @@ return cwdRequire(path); |
@@ -87,3 +87,2 @@ import globby, { sync as globbySync } from 'globby'; | ||
export function loadFilesSync(pattern, options = LoadFilesDefaultOptions) { | ||
var _a, _b; | ||
const execOptions = { ...LoadFilesDefaultOptions, ...options }; | ||
@@ -93,4 +92,4 @@ const relevantPaths = scanForFilesSync(asArray(pattern).map(path => isDirectorySync(path) | ||
: unixify(path)), options.globOptions); | ||
const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY((_a = execOptions.exportNames) !== null && _a !== void 0 ? _a : []); | ||
const requireMethod = execOptions.requireMethod || createRequire(join(((_b = options === null || options === void 0 ? void 0 : options.globOptions) === null || _b === void 0 ? void 0 : _b.cwd) || cwd(), 'noop.js')); | ||
const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY(execOptions.exportNames ?? []); | ||
const requireMethod = execOptions.requireMethod || createRequire(join(options?.globOptions?.cwd || cwd(), 'noop.js')); | ||
return relevantPaths | ||
@@ -153,3 +152,2 @@ .map(path => { | ||
export async function loadFiles(pattern, options = LoadFilesDefaultOptions) { | ||
var _a; | ||
const execOptions = { ...LoadFilesDefaultOptions, ...options }; | ||
@@ -159,6 +157,5 @@ const relevantPaths = await scanForFiles(await Promise.all(asArray(pattern).map(async (path) => (await isDirectory(path)) | ||
: unixify(path))), options.globOptions); | ||
const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY((_a = execOptions.exportNames) !== null && _a !== void 0 ? _a : []); | ||
const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY(execOptions.exportNames ?? []); | ||
const defaultRequireMethod = (path) => import(path).catch(importError => { | ||
var _a; | ||
const cwdRequire = createRequire(join(((_a = options === null || options === void 0 ? void 0 : options.globOptions) === null || _a === void 0 ? void 0 : _a.cwd) || cwd(), 'noop.js')); | ||
const cwdRequire = createRequire(join(options?.globOptions?.cwd || cwd(), 'noop.js')); | ||
try { | ||
@@ -165,0 +162,0 @@ return cwdRequire(path); |
{ | ||
"name": "@graphql-tools/load-files", | ||
"version": "7.0.0-rc-20230519104353-b09f3180", | ||
"version": "7.0.0-rc-20230519104627-f6fea064", | ||
"description": "A set of utils for faster development of GraphQL tools", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18724
415