@graphql-tools/load-files 7.0.0-rc-20230519104353-b09f3180 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -88,13 +88,12 @@ const LoadFilesDefaultOptions = {
88
88
  * @param options Additional options
89
89
  */
90
90
  function loadFilesSync(pattern, options = LoadFilesDefaultOptions) {
91
- var _a, _b;
92
91
  const execOptions = { ...LoadFilesDefaultOptions, ...options };
93
92
  const relevantPaths = scanForFilesSync(asArray(pattern).map(path => isDirectorySync(path)
94
93
  ? buildGlob((0, unixify_1.default)(path), execOptions.extensions, execOptions.ignoredExtensions, execOptions.recursive)
95
94
  : (0, unixify_1.default)(path)), options.globOptions);
96
- const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY((_a = execOptions.exportNames) !== null && _a !== void 0 ? _a : []);
97
- 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'));
95
+ const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY(execOptions.exportNames ?? []);
96
+ const requireMethod = execOptions.requireMethod || (0, module_1.createRequire)((0, path_1.join)(options?.globOptions?.cwd || (0, process_1.cwd)(), 'noop.js'));
98
97
  return relevantPaths
99
98
  .map(path => {
100
99
  if (!checkExtension(path, options)) {
@@ -153,15 +152,13 @@ const checkExtension = (path, { extensions, ignoredExtensions }) => {
153
152
  * @param options Additional options
154
153
  */
155
154
  async function loadFiles(pattern, options = LoadFilesDefaultOptions) {
156
- var _a;
157
155
  const execOptions = { ...LoadFilesDefaultOptions, ...options };
158
156
  const relevantPaths = await scanForFiles(await Promise.all(asArray(pattern).map(async (path) => (await isDirectory(path))
159
157
  ? buildGlob((0, unixify_1.default)(path), execOptions.extensions, execOptions.ignoredExtensions, execOptions.recursive)
160
158
  : (0, unixify_1.default)(path))), options.globOptions);
161
- const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY((_a = execOptions.exportNames) !== null && _a !== void 0 ? _a : []);
159
+ const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY(execOptions.exportNames ?? []);
162
160
  const defaultRequireMethod = (path) => Promise.resolve(`${path}`).then(s => tslib_1.__importStar(require(s))).catch(importError => {
163
- var _a;
164
- 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'));
161
+ const cwdRequire = (0, module_1.createRequire)((0, path_1.join)(options?.globOptions?.cwd || (0, process_1.cwd)(), 'noop.js'));
165
162
  try {
166
163
  return cwdRequire(path);
167
164
  }
package/esm/index.js CHANGED
@@ -84,13 +84,12 @@ const LoadFilesDefaultOptions = {
84
84
  * @param options Additional options
85
85
  */
86
86
  export function loadFilesSync(pattern, options = LoadFilesDefaultOptions) {
87
- var _a, _b;
88
87
  const execOptions = { ...LoadFilesDefaultOptions, ...options };
89
88
  const relevantPaths = scanForFilesSync(asArray(pattern).map(path => isDirectorySync(path)
90
89
  ? buildGlob(unixify(path), execOptions.extensions, execOptions.ignoredExtensions, execOptions.recursive)
91
90
  : unixify(path)), options.globOptions);
92
- const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY((_a = execOptions.exportNames) !== null && _a !== void 0 ? _a : []);
93
- 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'));
91
+ const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY(execOptions.exportNames ?? []);
92
+ const requireMethod = execOptions.requireMethod || createRequire(join(options?.globOptions?.cwd || cwd(), 'noop.js'));
94
93
  return relevantPaths
95
94
  .map(path => {
96
95
  if (!checkExtension(path, options)) {
@@ -148,15 +147,13 @@ const checkExtension = (path, { extensions, ignoredExtensions }) => {
148
147
  * @param options Additional options
149
148
  */
150
149
  export async function loadFiles(pattern, options = LoadFilesDefaultOptions) {
151
- var _a;
152
150
  const execOptions = { ...LoadFilesDefaultOptions, ...options };
153
151
  const relevantPaths = await scanForFiles(await Promise.all(asArray(pattern).map(async (path) => (await isDirectory(path))
154
152
  ? buildGlob(unixify(path), execOptions.extensions, execOptions.ignoredExtensions, execOptions.recursive)
155
153
  : unixify(path))), options.globOptions);
156
- const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY((_a = execOptions.exportNames) !== null && _a !== void 0 ? _a : []);
154
+ const extractExports = execOptions.extractExports || DEFAULT_EXTRACT_EXPORTS_FACTORY(execOptions.exportNames ?? []);
157
155
  const defaultRequireMethod = (path) => import(path).catch(importError => {
158
- var _a;
159
- 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'));
156
+ const cwdRequire = createRequire(join(options?.globOptions?.cwd || cwd(), 'noop.js'));
160
157
  try {
161
158
  return cwdRequire(path);
162
159
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/load-files",
3
- "version": "7.0.0-rc-20230519104353-b09f3180",
3
+ "version": "7.0.0",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {