@graphql-tools/code-file-loader 8.0.1 → 8.0.2-alpha-20230724230242-fecfa0d0

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
@@ -2,18 +2,29 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CodeFileLoader = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const graphql_1 = require("graphql");
6
- const utils_1 = require("@graphql-tools/utils");
7
- const graphql_tag_pluck_1 = require("@graphql-tools/graphql-tag-pluck");
5
+ const fs_1 = require("fs");
6
+ const module_1 = require("module");
7
+ const path_1 = require("path");
8
+ const process_1 = require("process");
8
9
  const globby_1 = tslib_1.__importDefault(require("globby"));
10
+ const graphql_1 = require("graphql");
9
11
  const unixify_1 = tslib_1.__importDefault(require("unixify"));
12
+ const graphql_tag_pluck_1 = require("@graphql-tools/graphql-tag-pluck");
13
+ const utils_1 = require("@graphql-tools/utils");
10
14
  const load_from_module_js_1 = require("./load-from-module.js");
11
- const path_1 = require("path");
12
- const process_1 = require("process");
13
- const fs_1 = require("fs");
14
- const module_1 = require("module");
15
15
  const { readFile, access } = fs_1.promises;
16
- const FILE_EXTENSIONS = ['.ts', '.mts', '.cts', '.tsx', '.js', '.mjs', 'cjs', '.jsx', '.vue', '.svelte'];
16
+ const FILE_EXTENSIONS = [
17
+ '.ts',
18
+ '.mts',
19
+ '.cts',
20
+ '.tsx',
21
+ '.js',
22
+ '.mjs',
23
+ 'cjs',
24
+ '.jsx',
25
+ '.vue',
26
+ '.svelte',
27
+ ];
17
28
  function createGlobbyOptions(options) {
18
29
  return { absolute: true, ...options, ignore: [] };
19
30
  }
@@ -48,7 +59,9 @@ class CodeFileLoader {
48
59
  options = this.getMergedOptions(options);
49
60
  if ((0, utils_1.isValidPath)(pointer)) {
50
61
  if (FILE_EXTENSIONS.find(extension => pointer.endsWith(extension))) {
51
- const normalizedFilePath = (0, path_1.isAbsolute)(pointer) ? pointer : (0, path_1.resolve)(options.cwd || (0, process_1.cwd)(), pointer);
62
+ const normalizedFilePath = (0, path_1.isAbsolute)(pointer)
63
+ ? pointer
64
+ : (0, path_1.resolve)(options.cwd || (0, process_1.cwd)(), pointer);
52
65
  try {
53
66
  await access(normalizedFilePath);
54
67
  return true;
@@ -64,7 +77,9 @@ class CodeFileLoader {
64
77
  options = this.getMergedOptions(options);
65
78
  if ((0, utils_1.isValidPath)(pointer)) {
66
79
  if (FILE_EXTENSIONS.find(extension => pointer.endsWith(extension))) {
67
- const normalizedFilePath = (0, path_1.isAbsolute)(pointer) ? pointer : (0, path_1.resolve)(options.cwd || (0, process_1.cwd)(), pointer);
80
+ const normalizedFilePath = (0, path_1.isAbsolute)(pointer)
81
+ ? pointer
82
+ : (0, path_1.resolve)(options.cwd || (0, process_1.cwd)(), pointer);
68
83
  return (0, fs_1.existsSync)(normalizedFilePath);
69
84
  }
70
85
  }
package/esm/exports.js CHANGED
@@ -1,4 +1,4 @@
1
- import { parse, buildClientSchema, isSchema } from 'graphql';
1
+ import { buildClientSchema, isSchema, parse, } from 'graphql';
2
2
  import { isSchemaAst, isSchemaJson, isSchemaText, isWrappedSchemaJson, pick } from './helpers.js';
3
3
  const identifiersToLookFor = ['default', 'schema', 'typeDefs', 'data'];
4
4
  // Pick exports
package/esm/index.js CHANGED
@@ -1,15 +1,26 @@
1
- import { isSchema, parse } from 'graphql';
2
- import { asArray, isValidPath, parseGraphQLSDL, isDocumentNode, } from '@graphql-tools/utils';
3
- import { gqlPluckFromCodeString, gqlPluckFromCodeStringSync, } from '@graphql-tools/graphql-tag-pluck';
1
+ import { existsSync, promises as fsPromises, readFileSync } from 'fs';
2
+ import { createRequire } from 'module';
3
+ import { isAbsolute, resolve } from 'path';
4
+ import { cwd, env } from 'process';
4
5
  import globby from 'globby';
6
+ import { isSchema, parse } from 'graphql';
5
7
  import unixify from 'unixify';
8
+ import { gqlPluckFromCodeString, gqlPluckFromCodeStringSync, } from '@graphql-tools/graphql-tag-pluck';
9
+ import { asArray, isDocumentNode, isValidPath, parseGraphQLSDL, } from '@graphql-tools/utils';
6
10
  import { tryToLoadFromExport, tryToLoadFromExportSync } from './load-from-module.js';
7
- import { isAbsolute, resolve } from 'path';
8
- import { cwd, env } from 'process';
9
- import { readFileSync, promises as fsPromises, existsSync } from 'fs';
10
- import { createRequire } from 'module';
11
11
  const { readFile, access } = fsPromises;
12
- const FILE_EXTENSIONS = ['.ts', '.mts', '.cts', '.tsx', '.js', '.mjs', 'cjs', '.jsx', '.vue', '.svelte'];
12
+ const FILE_EXTENSIONS = [
13
+ '.ts',
14
+ '.mts',
15
+ '.cts',
16
+ '.tsx',
17
+ '.js',
18
+ '.mjs',
19
+ 'cjs',
20
+ '.jsx',
21
+ '.vue',
22
+ '.svelte',
23
+ ];
13
24
  function createGlobbyOptions(options) {
14
25
  return { absolute: true, ...options, ignore: [] };
15
26
  }
@@ -44,7 +55,9 @@ export class CodeFileLoader {
44
55
  options = this.getMergedOptions(options);
45
56
  if (isValidPath(pointer)) {
46
57
  if (FILE_EXTENSIONS.find(extension => pointer.endsWith(extension))) {
47
- const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd || cwd(), pointer);
58
+ const normalizedFilePath = isAbsolute(pointer)
59
+ ? pointer
60
+ : resolve(options.cwd || cwd(), pointer);
48
61
  try {
49
62
  await access(normalizedFilePath);
50
63
  return true;
@@ -60,7 +73,9 @@ export class CodeFileLoader {
60
73
  options = this.getMergedOptions(options);
61
74
  if (isValidPath(pointer)) {
62
75
  if (FILE_EXTENSIONS.find(extension => pointer.endsWith(extension))) {
63
- const normalizedFilePath = isAbsolute(pointer) ? pointer : resolve(options.cwd || cwd(), pointer);
76
+ const normalizedFilePath = isAbsolute(pointer)
77
+ ? pointer
78
+ : resolve(options.cwd || cwd(), pointer);
64
79
  return existsSync(normalizedFilePath);
65
80
  }
66
81
  }
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@graphql-tools/code-file-loader",
3
- "version": "8.0.1",
3
+ "version": "8.0.2-alpha-20230724230242-fecfa0d0",
4
4
  "description": "A set of utils for faster development of GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
7
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
8
8
  },
9
9
  "dependencies": {
10
+ "@graphql-tools/graphql-tag-pluck": "8.0.2-alpha-20230724230242-fecfa0d0",
10
11
  "@graphql-tools/utils": "^10.0.0",
11
- "@graphql-tools/graphql-tag-pluck": "8.0.1",
12
12
  "globby": "^11.0.3",
13
13
  "tslib": "^2.4.0",
14
14
  "unixify": "^1.0.0"
@@ -1,5 +1,5 @@
1
- import { Source, BaseLoaderOptions, Loader } from '@graphql-tools/utils';
2
1
  import { GraphQLTagPluckOptions } from '@graphql-tools/graphql-tag-pluck';
2
+ import { BaseLoaderOptions, Loader, Source } from '@graphql-tools/utils';
3
3
  export type CodeFileLoaderConfig = {
4
4
  pluckConfig?: GraphQLTagPluckOptions;
5
5
  noPluck?: boolean;
@@ -1,5 +1,5 @@
1
- import { Source, BaseLoaderOptions, Loader } from '@graphql-tools/utils';
2
1
  import { GraphQLTagPluckOptions } from '@graphql-tools/graphql-tag-pluck';
2
+ import { BaseLoaderOptions, Loader, Source } from '@graphql-tools/utils';
3
3
  export type CodeFileLoaderConfig = {
4
4
  pluckConfig?: GraphQLTagPluckOptions;
5
5
  noPluck?: boolean;