@graphql-codegen/typescript-graphql-files-modules 2.1.2-alpha-4a7e799f2.0 → 2.2.0-alpha-29eb1293b.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,15 +1,13 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const path = require('path');
6
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validate = exports.plugin = void 0;
4
+ const path_1 = require("path");
7
5
  const plugin = async (schema, documents, { modulePathPrefix = '', relativeToCwd, prefix = '*/', type = 'DocumentNode' }) => {
8
6
  const useRelative = relativeToCwd === true;
9
7
  const mappedDocuments = documents.reduce((prev, documentRecord) => {
10
8
  const fileName = useRelative
11
- ? path.relative(process.cwd(), documentRecord.location)
12
- : path.basename(documentRecord.location);
9
+ ? (0, path_1.relative)(process.cwd(), documentRecord.location)
10
+ : (0, path_1.basename)(documentRecord.location);
13
11
  if (!prev[fileName]) {
14
12
  prev[fileName] = [];
15
13
  }
@@ -35,11 +33,10 @@ declare module '${prefix}${modulePathPrefix}${fileName}' {
35
33
  })
36
34
  .join('\n');
37
35
  };
36
+ exports.plugin = plugin;
38
37
  const validate = async (schema, documents, config, outputFile) => {
39
38
  if (!outputFile.endsWith('.d.ts')) {
40
39
  throw new Error(`Plugin "typescript-graphql-files-modules" requires extension to be ".d.ts"!`);
41
40
  }
42
41
  };
43
-
44
- exports.plugin = plugin;
45
42
  exports.validate = validate;
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -1,6 +1,5 @@
1
- import { relative, basename } from 'path';
2
-
3
- const plugin = async (schema, documents, { modulePathPrefix = '', relativeToCwd, prefix = '*/', type = 'DocumentNode' }) => {
1
+ import { basename, relative } from 'path';
2
+ export const plugin = async (schema, documents, { modulePathPrefix = '', relativeToCwd, prefix = '*/', type = 'DocumentNode' }) => {
4
3
  const useRelative = relativeToCwd === true;
5
4
  const mappedDocuments = documents.reduce((prev, documentRecord) => {
6
5
  const fileName = useRelative
@@ -31,10 +30,8 @@ declare module '${prefix}${modulePathPrefix}${fileName}' {
31
30
  })
32
31
  .join('\n');
33
32
  };
34
- const validate = async (schema, documents, config, outputFile) => {
33
+ export const validate = async (schema, documents, config, outputFile) => {
35
34
  if (!outputFile.endsWith('.d.ts')) {
36
35
  throw new Error(`Plugin "typescript-graphql-files-modules" requires extension to be ".d.ts"!`);
37
36
  }
38
37
  };
39
-
40
- export { plugin, validate };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@graphql-codegen/typescript-graphql-files-modules",
3
- "version": "2.1.2-alpha-4a7e799f2.0",
3
+ "version": "2.2.0-alpha-29eb1293b.0",
4
4
  "description": "GraphQL Code Generator plugin for generating TypeScript module declarations based on GraphQL operations",
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-4a7e799f2.0",
10
- "tslib": "~2.3.0"
9
+ "@graphql-codegen/plugin-helpers": "^2.5.0-alpha-29eb1293b.0",
10
+ "tslib": "~2.4.0"
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
@@ -15,21 +15,28 @@
15
15
  "directory": "packages/plugins/typescript/graphql-files-modules"
16
16
  },
17
17
  "license": "MIT",
18
- "main": "index.js",
19
- "module": "index.mjs",
20
- "typings": "index.d.ts",
18
+ "main": "cjs/index.js",
19
+ "module": "esm/index.js",
20
+ "typings": "typings/index.d.ts",
21
21
  "typescript": {
22
- "definition": "index.d.ts"
22
+ "definition": "typings/index.d.ts"
23
23
  },
24
+ "type": "module",
24
25
  "exports": {
25
- "./package.json": "./package.json",
26
26
  ".": {
27
- "require": "./index.js",
28
- "import": "./index.mjs"
27
+ "require": {
28
+ "types": "./typings/index.d.ts",
29
+ "default": "./cjs/index.js"
30
+ },
31
+ "import": {
32
+ "types": "./typings/index.d.ts",
33
+ "default": "./esm/index.js"
34
+ },
35
+ "default": {
36
+ "types": "./typings/index.d.ts",
37
+ "default": "./esm/index.js"
38
+ }
29
39
  },
30
- "./*": {
31
- "require": "./*.js",
32
- "import": "./*.mjs"
33
- }
40
+ "./package.json": "./package.json"
34
41
  }
35
- }
42
+ }
@@ -14,7 +14,7 @@ export interface TypeScriptFilesModulesPluginConfig {
14
14
  * between generated types.
15
15
  *
16
16
  * @exampleMarkdown
17
- * ```yml
17
+ * ```yaml
18
18
  * generates: src/api/user-service/queries.d.ts
19
19
  * documents: src/api/user-service/queries.graphql
20
20
  * plugins: