@graphitation/graphql-codegen-supermassive-schema-extraction-plugin 1.2.0 → 2.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/.eslintcache CHANGED
@@ -1 +1 @@
1
- [{"/mnt/vss/_work/1/s/packages/graphql-codegen-supermassive-schema-extraction-plugin/src/index.ts":"1"},{"size":1174,"mtime":1687260856297,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","suppressedMessages":"6","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1fxhjif","/mnt/vss/_work/1/s/packages/graphql-codegen-supermassive-schema-extraction-plugin/src/index.ts",[],[]]
1
+ [{"/mnt/vss/_work/1/s/packages/graphql-codegen-supermassive-schema-extraction-plugin/src/index.ts":"1"},{"size":1175,"mtime":1702983541949,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","suppressedMessages":"6","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"a2ehab","/mnt/vss/_work/1/s/packages/graphql-codegen-supermassive-schema-extraction-plugin/src/index.ts",[],[]]
package/CHANGELOG.md CHANGED
@@ -1,12 +1,30 @@
1
1
  # Change Log - @graphitation/graphql-codegen-supermassive-schema-extraction-plugin
2
2
 
3
- This log was last generated on Tue, 20 Jun 2023 11:38:28 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 19 Dec 2023 11:03:51 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.0.0
8
+
9
+ Tue, 19 Dec 2023 11:03:51 GMT
10
+
11
+ ### Major changes
12
+
13
+ - Update graphql-codegen-supermassive-schema-extraction-plugin for usage with supermassive v3 (vladimir.razuvaev@gmail.com)
14
+ - Bump @graphitation/supermassive to v3.2.7
15
+
16
+ ## 1.2.1
17
+
18
+ Thu, 21 Sep 2023 06:28:45 GMT
19
+
20
+ ### Patches
21
+
22
+ - Add exports entry for types to package.json (sverre.johansen@gmail.com)
23
+ - Bump @graphitation/supermassive-extractors to v2.2.1
24
+
7
25
  ## 1.2.0
8
26
 
9
- Tue, 20 Jun 2023 11:38:28 GMT
27
+ Tue, 20 Jun 2023 11:38:47 GMT
10
28
 
11
29
  ### Minor changes
12
30
 
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Custom GraphQL codegen plugins
2
2
 
3
- ## supermassive-typed-document-node
3
+ ## graphql-codegen-supermassive-schema-extraction-plugin
4
4
 
5
- Do the same stuff as the original typed-document-node plugin except it extends GraphQL AST data to match Supermassive AST
5
+ Encodes type definitions into compact schema format of Supermassive V3.
6
+
7
+ Output file contains JSON, which is faster than JS literal: https://v8.dev/blog/cost-of-javascript-2019#json
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAChB,cAAc,EACf,MAAM,iCAAiC,CAAC;AAMzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAEvF,KAAK,YAAY,GAAG,6BAA6B,GAAG;IAClD,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,cAAc,CAAC,YAAY,CAQ/C,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,gBAAgB,CAAC,YAAY,CAWnD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAChB,cAAc,EACf,MAAM,iCAAiC,CAAC;AAQzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAEvF,KAAK,YAAY,GAAG,6BAA6B,GAAG;IAClD,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,cAAc,CAAC,YAAY,CAS/C,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,gBAAgB,CAAC,YAAY,CAWnD,CAAC"}
package/lib/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var __async = (__this, __arguments, generator) => {
30
20
  return new Promise((resolve, reject) => {
@@ -52,21 +42,22 @@ __export(src_exports, {
52
42
  validate: () => validate
53
43
  });
54
44
  module.exports = __toCommonJS(src_exports);
55
- var import_typescript = __toESM(require("typescript"));
56
45
  var import_graphql2 = require("graphql");
57
- var import_supermassive_extractors = require("@graphitation/supermassive-extractors");
46
+ var import_supermassive = require("@graphitation/supermassive");
58
47
  var import_path = require("path");
59
48
  const plugin = (schema) => {
60
- const tsContents = (0, import_supermassive_extractors.extractImplicitTypesToTypescript)(
61
- (0, import_graphql2.parse)((0, import_graphql2.printSchema)(schema))
49
+ const schemaAST = (0, import_graphql2.parse)((0, import_graphql2.printSchema)(schema));
50
+ const typeDefs = (0, import_supermassive.mergeSchemaDefinitions)(
51
+ { types: {} },
52
+ (0, import_supermassive.encodeASTSchema)(schemaAST)
62
53
  );
63
- const printer = import_typescript.default.createPrinter();
64
- return printer.printNode(import_typescript.default.EmitHint.SourceFile, tsContents, tsContents);
54
+ return `export const definitions = JSON.parse('${JSON.stringify(typeDefs)}');
55
+ `;
65
56
  };
66
57
  const validate = (schema, documents, config, outputFile) => __async(void 0, null, function* () {
67
58
  if ((0, import_path.extname)(outputFile) !== ".ts" && (0, import_path.extname)(outputFile) !== ".tsx") {
68
59
  throw new Error(
69
- `Plugin "supermassive-typed-document-node" requires extension to be ".ts" or ".tsx"!`
60
+ `Plugin "graphql-codegen-supermassive-schema-extraction-plugin" requires extension to be ".ts" or ".tsx"!`
70
61
  );
71
62
  }
72
63
  });
package/lib/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import {\n Types,\n PluginValidateFn,\n PluginFunction,\n} from \"@graphql-codegen/plugin-helpers\";\nimport ts from \"typescript\";\nimport { GraphQLSchema } from \"graphql\";\nimport { printSchema, parse } from \"graphql\";\nimport { extractImplicitTypesToTypescript } from \"@graphitation/supermassive-extractors\";\nimport { extname } from \"path\";\nimport { RawClientSideBasePluginConfig } from \"@graphql-codegen/visitor-plugin-common\";\n\ntype PluginConfig = RawClientSideBasePluginConfig & {\n files: string[];\n};\n\nexport const plugin: PluginFunction<PluginConfig> = (schema: GraphQLSchema) => {\n const tsContents: ts.SourceFile = extractImplicitTypesToTypescript(\n parse(printSchema(schema)),\n );\n\n const printer = ts.createPrinter();\n\n return printer.printNode(ts.EmitHint.SourceFile, tsContents, tsContents);\n};\n\nexport const validate: PluginValidateFn<PluginConfig> = async (\n schema: GraphQLSchema,\n documents: Types.DocumentFile[],\n config,\n outputFile: string,\n) => {\n if (extname(outputFile) !== \".ts\" && extname(outputFile) !== \".tsx\") {\n throw new Error(\n `Plugin \"supermassive-typed-document-node\" requires extension to be \".ts\" or \".tsx\"!`,\n );\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,wBAAe;AAEf,IAAAA,kBAAmC;AACnC,qCAAiD;AACjD,kBAAwB;AAOjB,MAAM,SAAuC,CAAC,WAA0B;AAC7E,QAAM,iBAA4B;AAAA,QAChC,2BAAM,6BAAY,MAAM,CAAC;AAAA,EAC3B;AAEA,QAAM,UAAU,kBAAAC,QAAG,cAAc;AAEjC,SAAO,QAAQ,UAAU,kBAAAA,QAAG,SAAS,YAAY,YAAY,UAAU;AACzE;AAEO,MAAM,WAA2C,CACtD,QACA,WACA,QACA,eACG;AACH,UAAI,qBAAQ,UAAU,MAAM,aAAS,qBAAQ,UAAU,MAAM,QAAQ;AACnE,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;",
6
- "names": ["import_graphql", "ts"]
4
+ "sourcesContent": ["import {\n Types,\n PluginValidateFn,\n PluginFunction,\n} from \"@graphql-codegen/plugin-helpers\";\nimport { GraphQLSchema } from \"graphql\";\nimport { printSchema, parse } from \"graphql\";\nimport {\n encodeASTSchema,\n mergeSchemaDefinitions,\n} from \"@graphitation/supermassive\";\nimport { extname } from \"path\";\nimport { RawClientSideBasePluginConfig } from \"@graphql-codegen/visitor-plugin-common\";\n\ntype PluginConfig = RawClientSideBasePluginConfig & {\n files: string[];\n};\n\nexport const plugin: PluginFunction<PluginConfig> = (schema: GraphQLSchema) => {\n const schemaAST = parse(printSchema(schema));\n const typeDefs = mergeSchemaDefinitions(\n { types: {} },\n encodeASTSchema(schemaAST),\n );\n\n return `export const definitions = JSON.parse('${JSON.stringify(typeDefs)}');\n`;\n};\n\nexport const validate: PluginValidateFn<PluginConfig> = async (\n schema: GraphQLSchema,\n documents: Types.DocumentFile[],\n config,\n outputFile: string,\n) => {\n if (extname(outputFile) !== \".ts\" && extname(outputFile) !== \".tsx\") {\n throw new Error(\n `Plugin \"graphql-codegen-supermassive-schema-extraction-plugin\" requires extension to be \".ts\" or \".tsx\"!`,\n );\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,IAAAA,kBAAmC;AACnC,0BAGO;AACP,kBAAwB;AAOjB,MAAM,SAAuC,CAAC,WAA0B;AAC7E,QAAM,gBAAY,2BAAM,6BAAY,MAAM,CAAC;AAC3C,QAAM,eAAW;AAAA,IACf,EAAE,OAAO,CAAC,EAAE;AAAA,QACZ,qCAAgB,SAAS;AAAA,EAC3B;AAEA,SAAO,0CAA0C,KAAK,UAAU,QAAQ;AAAA;AAE1E;AAEO,MAAM,WAA2C,CACtD,QACA,WACA,QACA,eACG;AACH,UAAI,qBAAQ,UAAU,MAAM,aAAS,qBAAQ,UAAU,MAAM,QAAQ;AACnE,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;",
6
+ "names": ["import_graphql"]
7
7
  }
package/lib/index.mjs CHANGED
@@ -20,21 +20,25 @@ var __async = (__this, __arguments, generator) => {
20
20
  };
21
21
 
22
22
  // src/index.ts
23
- import ts from "typescript";
24
23
  import { printSchema, parse } from "graphql";
25
- import { extractImplicitTypesToTypescript } from "@graphitation/supermassive-extractors";
24
+ import {
25
+ encodeASTSchema,
26
+ mergeSchemaDefinitions
27
+ } from "@graphitation/supermassive";
26
28
  import { extname } from "path";
27
29
  var plugin = (schema) => {
28
- const tsContents = extractImplicitTypesToTypescript(
29
- parse(printSchema(schema))
30
+ const schemaAST = parse(printSchema(schema));
31
+ const typeDefs = mergeSchemaDefinitions(
32
+ { types: {} },
33
+ encodeASTSchema(schemaAST)
30
34
  );
31
- const printer = ts.createPrinter();
32
- return printer.printNode(ts.EmitHint.SourceFile, tsContents, tsContents);
35
+ return `export const definitions = JSON.parse('${JSON.stringify(typeDefs)}');
36
+ `;
33
37
  };
34
38
  var validate = (schema, documents, config, outputFile) => __async(void 0, null, function* () {
35
39
  if (extname(outputFile) !== ".ts" && extname(outputFile) !== ".tsx") {
36
40
  throw new Error(
37
- `Plugin "supermassive-typed-document-node" requires extension to be ".ts" or ".tsx"!`
41
+ `Plugin "graphql-codegen-supermassive-schema-extraction-plugin" requires extension to be ".ts" or ".tsx"!`
38
42
  );
39
43
  }
40
44
  });
package/lib/index.mjs.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import {\n Types,\n PluginValidateFn,\n PluginFunction,\n} from \"@graphql-codegen/plugin-helpers\";\nimport ts from \"typescript\";\nimport { GraphQLSchema } from \"graphql\";\nimport { printSchema, parse } from \"graphql\";\nimport { extractImplicitTypesToTypescript } from \"@graphitation/supermassive-extractors\";\nimport { extname } from \"path\";\nimport { RawClientSideBasePluginConfig } from \"@graphql-codegen/visitor-plugin-common\";\n\ntype PluginConfig = RawClientSideBasePluginConfig & {\n files: string[];\n};\n\nexport const plugin: PluginFunction<PluginConfig> = (schema: GraphQLSchema) => {\n const tsContents: ts.SourceFile = extractImplicitTypesToTypescript(\n parse(printSchema(schema)),\n );\n\n const printer = ts.createPrinter();\n\n return printer.printNode(ts.EmitHint.SourceFile, tsContents, tsContents);\n};\n\nexport const validate: PluginValidateFn<PluginConfig> = async (\n schema: GraphQLSchema,\n documents: Types.DocumentFile[],\n config,\n outputFile: string,\n) => {\n if (extname(outputFile) !== \".ts\" && extname(outputFile) !== \".tsx\") {\n throw new Error(\n `Plugin \"supermassive-typed-document-node\" requires extension to be \".ts\" or \".tsx\"!`,\n );\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAKA,OAAO,QAAQ;AAEf,SAAS,aAAa,aAAa;AACnC,SAAS,wCAAwC;AACjD,SAAS,eAAe;AAOjB,IAAM,SAAuC,CAAC,WAA0B;AAC7E,QAAM,aAA4B;AAAA,IAChC,MAAM,YAAY,MAAM,CAAC;AAAA,EAC3B;AAEA,QAAM,UAAU,GAAG,cAAc;AAEjC,SAAO,QAAQ,UAAU,GAAG,SAAS,YAAY,YAAY,UAAU;AACzE;AAEO,IAAM,WAA2C,CACtD,QACA,WACA,QACA,eACG;AACH,MAAI,QAAQ,UAAU,MAAM,SAAS,QAAQ,UAAU,MAAM,QAAQ;AACnE,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import {\n Types,\n PluginValidateFn,\n PluginFunction,\n} from \"@graphql-codegen/plugin-helpers\";\nimport { GraphQLSchema } from \"graphql\";\nimport { printSchema, parse } from \"graphql\";\nimport {\n encodeASTSchema,\n mergeSchemaDefinitions,\n} from \"@graphitation/supermassive\";\nimport { extname } from \"path\";\nimport { RawClientSideBasePluginConfig } from \"@graphql-codegen/visitor-plugin-common\";\n\ntype PluginConfig = RawClientSideBasePluginConfig & {\n files: string[];\n};\n\nexport const plugin: PluginFunction<PluginConfig> = (schema: GraphQLSchema) => {\n const schemaAST = parse(printSchema(schema));\n const typeDefs = mergeSchemaDefinitions(\n { types: {} },\n encodeASTSchema(schemaAST),\n );\n\n return `export const definitions = JSON.parse('${JSON.stringify(typeDefs)}');\n`;\n};\n\nexport const validate: PluginValidateFn<PluginConfig> = async (\n schema: GraphQLSchema,\n documents: Types.DocumentFile[],\n config,\n outputFile: string,\n) => {\n if (extname(outputFile) !== \".ts\" && extname(outputFile) !== \".tsx\") {\n throw new Error(\n `Plugin \"graphql-codegen-supermassive-schema-extraction-plugin\" requires extension to be \".ts\" or \".tsx\"!`,\n );\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,aAAa,aAAa;AACnC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AAOjB,IAAM,SAAuC,CAAC,WAA0B;AAC7E,QAAM,YAAY,MAAM,YAAY,MAAM,CAAC;AAC3C,QAAM,WAAW;AAAA,IACf,EAAE,OAAO,CAAC,EAAE;AAAA,IACZ,gBAAgB,SAAS;AAAA,EAC3B;AAEA,SAAO,0CAA0C,KAAK,UAAU,QAAQ;AAAA;AAE1E;AAEO,IAAM,WAA2C,CACtD,QACA,WACA,QACA,eACG;AACH,MAAI,QAAQ,UAAU,MAAM,SAAS,QAAQ,UAAU,MAAM,QAAQ;AACnE,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@graphitation/graphql-codegen-supermassive-schema-extraction-plugin",
3
3
  "license": "MIT",
4
- "version": "1.2.0",
4
+ "version": "2.0.0",
5
5
  "main": "./lib/index",
6
6
  "repository": {
7
7
  "type": "git",
@@ -17,15 +17,13 @@
17
17
  "devDependencies": {
18
18
  "@graphql-codegen/plugin-helpers": "^1.18.2",
19
19
  "@types/jest": "^26.0.22",
20
- "monorepo-scripts": "*",
21
- "typescript": "^4.9.5"
20
+ "monorepo-scripts": "*"
22
21
  },
23
22
  "peerDependencies": {
24
- "@graphql-codegen/plugin-helpers": ">= 1.18.0 < 2",
25
- "typescript": "^4.3.0"
23
+ "@graphql-codegen/plugin-helpers": ">= 1.18.0 < 2"
26
24
  },
27
25
  "dependencies": {
28
- "@graphitation/supermassive-extractors": "^2.2.0",
26
+ "@graphitation/supermassive": "^3.0.0",
29
27
  "graphql": "^15.0.0"
30
28
  },
31
29
  "sideEffects": false,
@@ -36,7 +34,8 @@
36
34
  "exports": {
37
35
  ".": {
38
36
  "import": "./lib/index.mjs",
39
- "require": "./lib/index.js"
37
+ "require": "./lib/index.js",
38
+ "types": "./lib/index.d.ts"
40
39
  }
41
40
  }
42
41
  }