@graphql-tools/graphql-tag-pluck 7.3.2-alpha-e7752ba5.0 → 7.3.2-alpha-b9e4a92b.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
@@ -8,7 +8,7 @@ const extname_js_1 = require("./libs/extname.js");
8
8
  const visitor_js_1 = tslib_1.__importDefault(require("./visitor.js"));
9
9
  const traverse_1 = tslib_1.__importDefault(require("@babel/traverse"));
10
10
  const utils_js_1 = require("./utils.js");
11
- const graphql_1 = require("@graphql-tools/graphql");
11
+ const graphql_1 = require("graphql");
12
12
  function getDefault(module) {
13
13
  return module.default || module;
14
14
  }
package/esm/index.js CHANGED
@@ -4,7 +4,7 @@ import { getExtNameFromFilePath } from './libs/extname.js';
4
4
  import createVisitor from './visitor.js';
5
5
  import traversePkg from '@babel/traverse';
6
6
  import { freeText } from './utils.js';
7
- import { Source } from '@graphql-tools/graphql';
7
+ import { Source } from 'graphql';
8
8
  function getDefault(module) {
9
9
  return module.default || module;
10
10
  }
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "@graphql-tools/graphql-tag-pluck",
3
- "version": "7.3.2-alpha-e7752ba5.0",
3
+ "version": "7.3.2-alpha-b9e4a92b.0",
4
4
  "description": "Pluck graphql-tag template literals",
5
5
  "sideEffects": false,
6
+ "peerDependencies": {
7
+ "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
8
+ },
6
9
  "dependencies": {
7
- "@graphql-tools/graphql": "0.1.0-alpha-e7752ba5.0",
8
10
  "@babel/parser": "^7.16.8",
9
11
  "@babel/traverse": "^7.16.8",
10
12
  "@babel/types": "^7.16.8",
11
- "@graphql-tools/utils": "8.9.1-alpha-e7752ba5.0",
13
+ "@graphql-tools/utils": "8.9.1-alpha-b9e4a92b.0",
12
14
  "tslib": "^2.4.0"
13
15
  },
14
16
  "repository": {
@@ -27,7 +29,7 @@
27
29
  "exports": {
28
30
  ".": {
29
31
  "require": {
30
- "types": "./typings/index.d.ts",
32
+ "types": "./typings/index.d.cts",
31
33
  "default": "./cjs/index.js"
32
34
  },
33
35
  "import": {
@@ -41,7 +43,7 @@
41
43
  },
42
44
  "./*": {
43
45
  "require": {
44
- "types": "./typings/*.d.ts",
46
+ "types": "./typings/*.d.cts",
45
47
  "default": "./cjs/*.js"
46
48
  },
47
49
  "import": {
@@ -0,0 +1,3 @@
1
+ import { GraphQLTagPluckOptions } from './index.cjs';
2
+ import { ParserOptions } from '@babel/parser';
3
+ export default function generateConfig(filePath: string, code: string, _options: GraphQLTagPluckOptions): ParserOptions;
@@ -0,0 +1,128 @@
1
+ import { PluckedContent } from './visitor.cjs';
2
+ import { Source } from 'graphql';
3
+ /**
4
+ * Additional options for determining how a file is parsed.
5
+ */
6
+ export interface GraphQLTagPluckOptions {
7
+ /**
8
+ * Additional options for determining how a file is parsed.An array of packages that are responsible for exporting the GraphQL string parser function. The following modules are supported by default:
9
+ * ```js
10
+ * {
11
+ * modules: [
12
+ * {
13
+ * // import gql from 'graphql-tag'
14
+ * name: 'graphql-tag',
15
+ * },
16
+ * {
17
+ * name: 'graphql-tag.macro',
18
+ * },
19
+ * {
20
+ * // import { graphql } from 'gatsby'
21
+ * name: 'gatsby',
22
+ * identifier: 'graphql',
23
+ * },
24
+ * {
25
+ * name: 'apollo-server-express',
26
+ * identifier: 'gql',
27
+ * },
28
+ * {
29
+ * name: 'apollo-server',
30
+ * identifier: 'gql',
31
+ * },
32
+ * {
33
+ * name: 'react-relay',
34
+ * identifier: 'graphql',
35
+ * },
36
+ * {
37
+ * name: 'apollo-boost',
38
+ * identifier: 'gql',
39
+ * },
40
+ * {
41
+ * name: 'apollo-server-koa',
42
+ * identifier: 'gql',
43
+ * },
44
+ * {
45
+ * name: 'apollo-server-hapi',
46
+ * identifier: 'gql',
47
+ * },
48
+ * {
49
+ * name: 'apollo-server-fastify',
50
+ * identifier: 'gql',
51
+ * },
52
+ * {
53
+ * name: ' apollo-server-lambda',
54
+ * identifier: 'gql',
55
+ * },
56
+ * {
57
+ * name: 'apollo-server-micro',
58
+ * identifier: 'gql',
59
+ * },
60
+ * {
61
+ * name: 'apollo-server-azure-functions',
62
+ * identifier: 'gql',
63
+ * },
64
+ * {
65
+ * name: 'apollo-server-cloud-functions',
66
+ * identifier: 'gql',
67
+ * },
68
+ * {
69
+ * name: 'apollo-server-cloudflare',
70
+ * identifier: 'gql',
71
+ * },
72
+ * ];
73
+ * }
74
+ * ```
75
+ */
76
+ modules?: Array<{
77
+ name: string;
78
+ identifier?: string;
79
+ }>;
80
+ /**
81
+ * The magic comment anchor to look for when parsing GraphQL strings. Defaults to `graphql`.
82
+ */
83
+ gqlMagicComment?: string;
84
+ /**
85
+ * Allows to use a global identifier instead of a module import.
86
+ * ```js
87
+ * // `graphql` is a global function
88
+ * export const usersQuery = graphql`
89
+ * {
90
+ * users {
91
+ * id
92
+ * name
93
+ * }
94
+ * }
95
+ * `;
96
+ * ```
97
+ */
98
+ globalGqlIdentifierName?: string | string[];
99
+ /**
100
+ * Set to `true` in order to get the found documents as-is, without any changes indentation changes
101
+ */
102
+ skipIndent?: boolean;
103
+ }
104
+ /**
105
+ * Asynchronously plucks GraphQL template literals from a single file.
106
+ *
107
+ * Supported file extensions include: `.js`, `.jsx`, `.ts`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`
108
+ *
109
+ * @param filePath Path to the file containing the code. Required to detect the file type
110
+ * @param code The contents of the file being parsed.
111
+ * @param options Additional options for determining how a file is parsed.
112
+ */
113
+ export declare const gqlPluckFromCodeString: (filePath: string, code: string, options?: GraphQLTagPluckOptions) => Promise<Source[]>;
114
+ /**
115
+ * Synchronously plucks GraphQL template literals from a single file
116
+ *
117
+ * Supported file extensions include: `.js`, `.jsx`, `.ts`, `.tsx`, `.flow`, `.flow.js`, `.flow.jsx`, `.vue`, `.svelte`
118
+ *
119
+ * @param filePath Path to the file containing the code. Required to detect the file type
120
+ * @param code The contents of the file being parsed.
121
+ * @param options Additional options for determining how a file is parsed.
122
+ */
123
+ export declare const gqlPluckFromCodeStringSync: (filePath: string, code: string, options?: GraphQLTagPluckOptions) => Source[];
124
+ export declare function parseCode({ code, filePath, options, }: {
125
+ code: string;
126
+ filePath: string;
127
+ options: GraphQLTagPluckOptions;
128
+ }): PluckedContent[];
@@ -1,5 +1,5 @@
1
1
  import { PluckedContent } from './visitor.js';
2
- import { Source } from '@graphql-tools/graphql';
2
+ import { Source } from 'graphql';
3
3
  /**
4
4
  * Additional options for determining how a file is parsed.
5
5
  */
@@ -0,0 +1 @@
1
+ export declare const getExtNameFromFilePath: (filePath: string) => string;
@@ -0,0 +1,4 @@
1
+ export declare const freeText: (text: string | string[], skipIndentation?: boolean) => string;
2
+ export declare const splitWords: (str: string) => string[];
3
+ export declare const toUpperFirst: (str: string) => string;
4
+ export declare const toCamelCase: (str: string) => string;
@@ -0,0 +1,19 @@
1
+ import { GraphQLTagPluckOptions } from './index.cjs';
2
+ import { Visitor } from '@babel/traverse';
3
+ export declare type PluckedContent = {
4
+ content: string;
5
+ start: number;
6
+ end: number;
7
+ loc: {
8
+ start: {
9
+ line: number;
10
+ column: number;
11
+ };
12
+ end: {
13
+ line: number;
14
+ column: number;
15
+ };
16
+ };
17
+ };
18
+ declare const _default: (code: string, out: any, options?: GraphQLTagPluckOptions) => Visitor<{}>;
19
+ export default _default;