@graphql-codegen/urql-introspection 2.1.2-alpha-714e0efe9.0 → 2.2.0-alpha-2fbcdb6d3.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.
@@ -1,10 +1,8 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const path = require('path');
6
- const introspection = require('@urql/introspection');
7
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validate = exports.plugin = void 0;
4
+ const path_1 = require("path");
5
+ const introspection_1 = require("@urql/introspection");
8
6
  const extensions = {
9
7
  ts: ['.ts', '.tsx'],
10
8
  js: ['.js', '.jsx'],
@@ -16,8 +14,8 @@ const plugin = async (schema, _documents, pluginConfig, info) => {
16
14
  useTypeImports: false,
17
15
  ...pluginConfig,
18
16
  };
19
- const ext = path.extname(info.outputFile).toLowerCase();
20
- const minifiedData = introspection.minifyIntrospectionQuery(introspection.getIntrospectedSchema(schema), {
17
+ const ext = (0, path_1.extname)(info.outputFile).toLowerCase();
18
+ const minifiedData = (0, introspection_1.minifyIntrospectionQuery)((0, introspection_1.getIntrospectedSchema)(schema), {
21
19
  includeDirectives: config.includeDirectives,
22
20
  includeEnums: config.includeEnums,
23
21
  includeInputs: config.includeInputs,
@@ -38,8 +36,9 @@ export default ${content} as unknown as IntrospectionQuery;`;
38
36
  }
39
37
  throw new Error(`Extension ${ext} is not supported`);
40
38
  };
39
+ exports.plugin = plugin;
41
40
  const validate = async (_schema, _documents, config, outputFile) => {
42
- const ext = path.extname(outputFile).toLowerCase();
41
+ const ext = (0, path_1.extname)(outputFile).toLowerCase();
43
42
  const all = Object.values(extensions).reduce((acc, exts) => [...acc, ...exts], []);
44
43
  if (!all.includes(ext)) {
45
44
  throw new Error(`Plugin "urql-introspection" requires extension to be one of ${all.map(val => val.replace('.', '')).join(', ')}!`);
@@ -51,6 +50,4 @@ const validate = async (_schema, _documents, config, outputFile) => {
51
50
  throw new Error(`Plugin "urql-introspection" doesn't support useTypeImports modules not combined with TypeScript!`);
52
51
  }
53
52
  };
54
-
55
- exports.plugin = plugin;
56
53
  exports.validate = validate;
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -1,12 +1,11 @@
1
1
  import { extname } from 'path';
2
- import { minifyIntrospectionQuery, getIntrospectedSchema } from '@urql/introspection';
3
-
2
+ import { getIntrospectedSchema, minifyIntrospectionQuery } from '@urql/introspection';
4
3
  const extensions = {
5
4
  ts: ['.ts', '.tsx'],
6
5
  js: ['.js', '.jsx'],
7
6
  json: ['.json'],
8
7
  };
9
- const plugin = async (schema, _documents, pluginConfig, info) => {
8
+ export const plugin = async (schema, _documents, pluginConfig, info) => {
10
9
  const config = {
11
10
  module: 'es2015',
12
11
  useTypeImports: false,
@@ -34,7 +33,7 @@ export default ${content} as unknown as IntrospectionQuery;`;
34
33
  }
35
34
  throw new Error(`Extension ${ext} is not supported`);
36
35
  };
37
- const validate = async (_schema, _documents, config, outputFile) => {
36
+ export const validate = async (_schema, _documents, config, outputFile) => {
38
37
  const ext = extname(outputFile).toLowerCase();
39
38
  const all = Object.values(extensions).reduce((acc, exts) => [...acc, ...exts], []);
40
39
  if (!all.includes(ext)) {
@@ -47,5 +46,3 @@ const validate = async (_schema, _documents, config, outputFile) => {
47
46
  throw new Error(`Plugin "urql-introspection" doesn't support useTypeImports modules not combined with TypeScript!`);
48
47
  }
49
48
  };
50
-
51
- export { plugin, validate };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@graphql-codegen/urql-introspection",
3
- "version": "2.1.2-alpha-714e0efe9.0",
3
+ "version": "2.2.0-alpha-2fbcdb6d3.0",
4
4
  "description": "graphql-code-generate plugin for generating fragments matcher introspection file",
5
5
  "peerDependencies": {
6
6
  "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
7
7
  },
8
8
  "dependencies": {
9
- "@graphql-codegen/plugin-helpers": "2.4.2-alpha-714e0efe9.0",
10
- "@urql/introspection": "0.3.1",
11
- "tslib": "~2.3.0"
9
+ "@graphql-codegen/plugin-helpers": "^2.5.0-alpha-2fbcdb6d3.0",
10
+ "@urql/introspection": "0.3.2",
11
+ "tslib": "~2.4.0"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
@@ -16,21 +16,28 @@
16
16
  "directory": "packages/plugins/other/urql-introspection"
17
17
  },
18
18
  "license": "MIT",
19
- "main": "index.js",
20
- "module": "index.mjs",
21
- "typings": "index.d.ts",
19
+ "main": "cjs/index.js",
20
+ "module": "esm/index.js",
21
+ "typings": "typings/index.d.ts",
22
22
  "typescript": {
23
- "definition": "index.d.ts"
23
+ "definition": "typings/index.d.ts"
24
24
  },
25
+ "type": "module",
25
26
  "exports": {
26
- "./package.json": "./package.json",
27
27
  ".": {
28
- "require": "./index.js",
29
- "import": "./index.mjs"
28
+ "require": {
29
+ "types": "./typings/index.d.ts",
30
+ "default": "./cjs/index.js"
31
+ },
32
+ "import": {
33
+ "types": "./typings/index.d.ts",
34
+ "default": "./esm/index.js"
35
+ },
36
+ "default": {
37
+ "types": "./typings/index.d.ts",
38
+ "default": "./esm/index.js"
39
+ }
30
40
  },
31
- "./*": {
32
- "require": "./*.js",
33
- "import": "./*.mjs"
34
- }
41
+ "./package.json": "./package.json"
35
42
  }
36
- }
43
+ }
@@ -16,7 +16,7 @@ export interface UrqlIntrospectionConfig {
16
16
  * @default es2015
17
17
  *
18
18
  * @exampleMarkdown
19
- * ```yml
19
+ * ```yaml
20
20
  * generates:
21
21
  * path/to/file.json:
22
22
  * plugins:
@@ -34,7 +34,7 @@ export interface UrqlIntrospectionConfig {
34
34
  * compatibility with TypeScript's "importsNotUsedAsValues": "error" option
35
35
  *
36
36
  * @example
37
- * ```yml
37
+ * ```yaml
38
38
  * config:
39
39
  * useTypeImports: true
40
40
  * ```
@@ -47,7 +47,7 @@ export interface UrqlIntrospectionConfig {
47
47
  * @description Includes scalar names (instead of an `Any` replacement) in the output when enabled.
48
48
  *
49
49
  * @example
50
- * ```yml
50
+ * ```yaml
51
51
  * config:
52
52
  * includeScalars: true
53
53
  * ```
@@ -60,7 +60,7 @@ export interface UrqlIntrospectionConfig {
60
60
  * @description Includes enums (instead of an `Any` replacement) in the output when enabled.
61
61
  *
62
62
  * @example
63
- * ```yml
63
+ * ```yaml
64
64
  * config:
65
65
  * includeEnums: true
66
66
  * ```
@@ -73,7 +73,7 @@ export interface UrqlIntrospectionConfig {
73
73
  * @description Includes all input objects (instead of an `Any` replacement) in the output when enabled.
74
74
  *
75
75
  * @example
76
- * ```yml
76
+ * ```yaml
77
77
  * config:
78
78
  * includeInputs: true
79
79
  * ```
@@ -86,7 +86,7 @@ export interface UrqlIntrospectionConfig {
86
86
  * @description Includes all directives in the output when enabled.
87
87
  *
88
88
  * @example
89
- * ```yml
89
+ * ```yaml
90
90
  * config:
91
91
  * includeDirectives: true
92
92
  * ```