@graphitation/apollo-react-relay-duct-tape-compiler 1.0.0 → 1.2.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/CHANGELOG.md CHANGED
@@ -1,12 +1,29 @@
1
1
  # Change Log - @graphitation/apollo-react-relay-duct-tape-compiler
2
2
 
3
- This log was last generated on Mon, 12 Jun 2023 12:50:42 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 20 Jun 2023 11:38:28 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.2.0
8
+
9
+ Tue, 20 Jun 2023 11:38:28 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Bump TS version in dev, move TS to peerDep (mnovikov@microsoft.com)
14
+
15
+ ## 1.1.0
16
+
17
+ Mon, 19 Jun 2023 12:22:22 GMT
18
+
19
+ ### Minor changes
20
+
21
+ - Move to supermassive-ast package (mnovikov@microsoft.com)
22
+ - Bump @graphitation/supermassive-ast to v2.0.0
23
+
7
24
  ## 1.0.0
8
25
 
9
- Mon, 12 Jun 2023 12:50:42 GMT
26
+ Mon, 12 Jun 2023 12:50:51 GMT
10
27
 
11
28
  ### Patches
12
29
 
@@ -72,7 +72,7 @@ function formatModuleFactory(options) {
72
72
  ) : null;
73
73
  let addTypesToRequestDocument;
74
74
  if (options.emitSupermassiveDocuments) {
75
- ({ addTypesToRequestDocument } = yield import("@graphitation/supermassive"));
75
+ ({ addTypesToRequestDocument } = yield import("@graphitation/supermassive-ast"));
76
76
  }
77
77
  function generateExports(moduleName, docText) {
78
78
  const exports = {};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/formatModule.ts"],
4
- "sourcesContent": ["import { parse, print } from \"graphql\";\nimport { optimizeDocumentNode } from \"@graphql-tools/optimize\";\nimport { reduceNodeWatchQueryTransform } from \"./formatModuleTransforms/reduceNodeWatchQueryTransform\";\nimport invariant from \"invariant\";\nimport { stripFragmentReferenceFieldSelectionTransform } from \"./formatModuleTransforms/stripFragmentReferenceFieldSelectionTransform\";\nimport { extractMetadataTransform } from \"./formatModuleTransforms/extractMetadataTransform\";\nimport { buildSchema, Source } from \"graphql\";\nimport { readFileSync } from \"fs\";\nimport dedupeJSONStringify from \"relay-compiler/lib/util/dedupeJSONStringify\";\n\nimport type { DocumentNode } from \"graphql\";\nimport type { FormatModule } from \"relay-compiler/lib/language/RelayLanguagePluginInterface\";\nimport type { CompiledArtefactModule } from \"./types\";\n\nexport interface FormatModuleOptions {\n emitDocuments: boolean;\n emitNarrowObservables: boolean;\n emitQueryDebugComments: boolean;\n emitSupermassiveDocuments: boolean;\n schema: string;\n}\n\nfunction printDocumentComment(document: DocumentNode) {\n return `/*\\n${print(document).trim()}\\n*/`;\n}\n\nexport async function formatModuleFactory(\n options: FormatModuleOptions,\n): Promise<FormatModule> {\n const schema = options.emitNarrowObservables\n ? buildSchema(\n new Source(readFileSync(options.schema, \"utf-8\"), options.schema),\n )\n : null;\n\n let addTypesToRequestDocument:\n | undefined\n | typeof import(\"@graphitation/supermassive\").addTypesToRequestDocument;\n if (options.emitSupermassiveDocuments) {\n ({ addTypesToRequestDocument } = await import(\n \"@graphitation/supermassive\"\n ));\n }\n\n function generateExports(moduleName: string, docText: string) {\n const exports: CompiledArtefactModule = {};\n const originalDocument = parse(docText, { noLocation: true });\n const optimizedDocument = optimizeDocumentNode(originalDocument);\n\n if (!options.emitNarrowObservables) {\n exports.executionQueryDocument = optimizedDocument;\n } else {\n if (!moduleName.endsWith(\"WatchNodeQuery.graphql\")) {\n exports.executionQueryDocument =\n stripFragmentReferenceFieldSelectionTransform(optimizedDocument);\n }\n\n invariant(schema, \"Expected a schema instance\");\n exports.watchQueryDocument = reduceNodeWatchQueryTransform(\n schema,\n optimizedDocument,\n );\n\n exports.metadata = extractMetadataTransform(exports.watchQueryDocument);\n }\n\n if (addTypesToRequestDocument && exports.executionQueryDocument) {\n invariant(schema, \"Expected a schema instance\");\n exports.executionQueryDocument = addTypesToRequestDocument(\n schema,\n exports.executionQueryDocument,\n ) as DocumentNode;\n }\n\n return exports;\n }\n\n return ({ docText, hash, moduleName, typeText }) => {\n const exports = options.emitDocuments\n ? docText && generateExports(moduleName, docText)\n : null;\n const components = [\n typeText,\n exports &&\n options.emitQueryDebugComments &&\n exports.executionQueryDocument &&\n printDocumentComment(exports.executionQueryDocument),\n exports &&\n options.emitQueryDebugComments &&\n exports.watchQueryDocument &&\n printDocumentComment(exports.watchQueryDocument),\n exports &&\n `export const documents: import(\"@graphitation/apollo-react-relay-duct-tape-compiler\").CompiledArtefactModule = ${dedupeJSONStringify(\n exports,\n )};`,\n ].filter(Boolean) as string[];\n\n return `/* tslint:disable */\n/* eslint-disable */\n// @ts-nocheck\n${hash ? `/* ${hash} */\\n` : \"\"}\n${components.join(\"\\n\\n\")}`;\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA6B;AAC7B,sBAAqC;AACrC,2CAA8C;AAC9C,uBAAsB;AACtB,2DAA8D;AAC9D,sCAAyC;AACzC,IAAAA,kBAAoC;AACpC,gBAA6B;AAC7B,iCAAgC;AAchC,SAAS,qBAAqB,UAAwB;AACpD,SAAO;AAAA,MAAO,sBAAM,QAAQ,EAAE,KAAK;AAAA;AACrC;AAEA,SAAsB,oBACpB,SACuB;AAAA;AACvB,UAAM,SAAS,QAAQ,4BACnB;AAAA,MACE,IAAI,2BAAO,wBAAa,QAAQ,QAAQ,OAAO,GAAG,QAAQ,MAAM;AAAA,IAClE,IACA;AAEJ,QAAI;AAGJ,QAAI,QAAQ,2BAA2B;AACrC,OAAC,EAAE,0BAA0B,IAAI,MAAM,OACrC,4BACF;AAAA,IACF;AAEA,aAAS,gBAAgB,YAAoB,SAAiB;AAC5D,YAAM,UAAkC,CAAC;AACzC,YAAM,uBAAmB,sBAAM,SAAS,EAAE,YAAY,KAAK,CAAC;AAC5D,YAAM,wBAAoB,sCAAqB,gBAAgB;AAE/D,UAAI,CAAC,QAAQ,uBAAuB;AAClC,gBAAQ,yBAAyB;AAAA,MACnC,OAAO;AACL,YAAI,CAAC,WAAW,SAAS,wBAAwB,GAAG;AAClD,kBAAQ,6BACN,oGAA8C,iBAAiB;AAAA,QACnE;AAEA,6BAAAC,SAAU,QAAQ,4BAA4B;AAC9C,gBAAQ,yBAAqB;AAAA,UAC3B;AAAA,UACA;AAAA,QACF;AAEA,gBAAQ,eAAW,0DAAyB,QAAQ,kBAAkB;AAAA,MACxE;AAEA,UAAI,6BAA6B,QAAQ,wBAAwB;AAC/D,6BAAAA,SAAU,QAAQ,4BAA4B;AAC9C,gBAAQ,yBAAyB;AAAA,UAC/B;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAEA,WAAO,CAAC,EAAE,SAAS,MAAM,YAAY,SAAS,MAAM;AAClD,YAAM,UAAU,QAAQ,gBACpB,WAAW,gBAAgB,YAAY,OAAO,IAC9C;AACJ,YAAM,aAAa;AAAA,QACjB;AAAA,QACA,WACE,QAAQ,0BACR,QAAQ,0BACR,qBAAqB,QAAQ,sBAAsB;AAAA,QACrD,WACE,QAAQ,0BACR,QAAQ,sBACR,qBAAqB,QAAQ,kBAAkB;AAAA,QACjD,WACE,sHAAkH,2BAAAC;AAAA,UAChH;AAAA,QACF;AAAA,MACJ,EAAE,OAAO,OAAO;AAEhB,aAAO;AAAA;AAAA;AAAA,EAGT,OAAO,MAAM;AAAA,IAAc;AAAA,EAC3B,WAAW,KAAK,MAAM;AAAA,IACtB;AAAA,EACF;AAAA;",
4
+ "sourcesContent": ["import { parse, print } from \"graphql\";\nimport { optimizeDocumentNode } from \"@graphql-tools/optimize\";\nimport { reduceNodeWatchQueryTransform } from \"./formatModuleTransforms/reduceNodeWatchQueryTransform\";\nimport invariant from \"invariant\";\nimport { stripFragmentReferenceFieldSelectionTransform } from \"./formatModuleTransforms/stripFragmentReferenceFieldSelectionTransform\";\nimport { extractMetadataTransform } from \"./formatModuleTransforms/extractMetadataTransform\";\nimport { buildSchema, Source } from \"graphql\";\nimport { readFileSync } from \"fs\";\nimport dedupeJSONStringify from \"relay-compiler/lib/util/dedupeJSONStringify\";\n\nimport type { DocumentNode } from \"graphql\";\nimport type { FormatModule } from \"relay-compiler/lib/language/RelayLanguagePluginInterface\";\nimport type { CompiledArtefactModule } from \"./types\";\n\nexport interface FormatModuleOptions {\n emitDocuments: boolean;\n emitNarrowObservables: boolean;\n emitQueryDebugComments: boolean;\n emitSupermassiveDocuments: boolean;\n schema: string;\n}\n\nfunction printDocumentComment(document: DocumentNode) {\n return `/*\\n${print(document).trim()}\\n*/`;\n}\n\nexport async function formatModuleFactory(\n options: FormatModuleOptions,\n): Promise<FormatModule> {\n const schema = options.emitNarrowObservables\n ? buildSchema(\n new Source(readFileSync(options.schema, \"utf-8\"), options.schema),\n )\n : null;\n\n let addTypesToRequestDocument:\n | undefined\n | typeof import(\"@graphitation/supermassive-ast\").addTypesToRequestDocument;\n if (options.emitSupermassiveDocuments) {\n ({ addTypesToRequestDocument } = await import(\n \"@graphitation/supermassive-ast\"\n ));\n }\n\n function generateExports(moduleName: string, docText: string) {\n const exports: CompiledArtefactModule = {};\n const originalDocument = parse(docText, { noLocation: true });\n const optimizedDocument = optimizeDocumentNode(originalDocument);\n\n if (!options.emitNarrowObservables) {\n exports.executionQueryDocument = optimizedDocument;\n } else {\n if (!moduleName.endsWith(\"WatchNodeQuery.graphql\")) {\n exports.executionQueryDocument =\n stripFragmentReferenceFieldSelectionTransform(optimizedDocument);\n }\n\n invariant(schema, \"Expected a schema instance\");\n exports.watchQueryDocument = reduceNodeWatchQueryTransform(\n schema,\n optimizedDocument,\n );\n\n exports.metadata = extractMetadataTransform(exports.watchQueryDocument);\n }\n\n if (addTypesToRequestDocument && exports.executionQueryDocument) {\n invariant(schema, \"Expected a schema instance\");\n exports.executionQueryDocument = addTypesToRequestDocument(\n schema,\n exports.executionQueryDocument,\n ) as DocumentNode;\n }\n\n return exports;\n }\n\n return ({ docText, hash, moduleName, typeText }) => {\n const exports = options.emitDocuments\n ? docText && generateExports(moduleName, docText)\n : null;\n const components = [\n typeText,\n exports &&\n options.emitQueryDebugComments &&\n exports.executionQueryDocument &&\n printDocumentComment(exports.executionQueryDocument),\n exports &&\n options.emitQueryDebugComments &&\n exports.watchQueryDocument &&\n printDocumentComment(exports.watchQueryDocument),\n exports &&\n `export const documents: import(\"@graphitation/apollo-react-relay-duct-tape-compiler\").CompiledArtefactModule = ${dedupeJSONStringify(\n exports,\n )};`,\n ].filter(Boolean) as string[];\n\n return `/* tslint:disable */\n/* eslint-disable */\n// @ts-nocheck\n${hash ? `/* ${hash} */\\n` : \"\"}\n${components.join(\"\\n\\n\")}`;\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA6B;AAC7B,sBAAqC;AACrC,2CAA8C;AAC9C,uBAAsB;AACtB,2DAA8D;AAC9D,sCAAyC;AACzC,IAAAA,kBAAoC;AACpC,gBAA6B;AAC7B,iCAAgC;AAchC,SAAS,qBAAqB,UAAwB;AACpD,SAAO;AAAA,MAAO,sBAAM,QAAQ,EAAE,KAAK;AAAA;AACrC;AAEA,SAAsB,oBACpB,SACuB;AAAA;AACvB,UAAM,SAAS,QAAQ,4BACnB;AAAA,MACE,IAAI,2BAAO,wBAAa,QAAQ,QAAQ,OAAO,GAAG,QAAQ,MAAM;AAAA,IAClE,IACA;AAEJ,QAAI;AAGJ,QAAI,QAAQ,2BAA2B;AACrC,OAAC,EAAE,0BAA0B,IAAI,MAAM,OACrC,gCACF;AAAA,IACF;AAEA,aAAS,gBAAgB,YAAoB,SAAiB;AAC5D,YAAM,UAAkC,CAAC;AACzC,YAAM,uBAAmB,sBAAM,SAAS,EAAE,YAAY,KAAK,CAAC;AAC5D,YAAM,wBAAoB,sCAAqB,gBAAgB;AAE/D,UAAI,CAAC,QAAQ,uBAAuB;AAClC,gBAAQ,yBAAyB;AAAA,MACnC,OAAO;AACL,YAAI,CAAC,WAAW,SAAS,wBAAwB,GAAG;AAClD,kBAAQ,6BACN,oGAA8C,iBAAiB;AAAA,QACnE;AAEA,6BAAAC,SAAU,QAAQ,4BAA4B;AAC9C,gBAAQ,yBAAqB;AAAA,UAC3B;AAAA,UACA;AAAA,QACF;AAEA,gBAAQ,eAAW,0DAAyB,QAAQ,kBAAkB;AAAA,MACxE;AAEA,UAAI,6BAA6B,QAAQ,wBAAwB;AAC/D,6BAAAA,SAAU,QAAQ,4BAA4B;AAC9C,gBAAQ,yBAAyB;AAAA,UAC/B;AAAA,UACA,QAAQ;AAAA,QACV;AAAA,MACF;AAEA,aAAO;AAAA,IACT;AAEA,WAAO,CAAC,EAAE,SAAS,MAAM,YAAY,SAAS,MAAM;AAClD,YAAM,UAAU,QAAQ,gBACpB,WAAW,gBAAgB,YAAY,OAAO,IAC9C;AACJ,YAAM,aAAa;AAAA,QACjB;AAAA,QACA,WACE,QAAQ,0BACR,QAAQ,0BACR,qBAAqB,QAAQ,sBAAsB;AAAA,QACrD,WACE,QAAQ,0BACR,QAAQ,sBACR,qBAAqB,QAAQ,kBAAkB;AAAA,QACjD,WACE,sHAAkH,2BAAAC;AAAA,UAChH;AAAA,QACF;AAAA,MACJ,EAAE,OAAO,OAAO;AAEhB,aAAO;AAAA;AAAA;AAAA,EAGT,OAAO,MAAM;AAAA,IAAc;AAAA,EAC3B,WAAW,KAAK,MAAM;AAAA,IACtB;AAAA,EACF;AAAA;",
6
6
  "names": ["import_graphql", "invariant", "dedupeJSONStringify"]
7
7
  }
@@ -41,7 +41,7 @@ function formatModuleFactory(options) {
41
41
  ) : null;
42
42
  let addTypesToRequestDocument;
43
43
  if (options.emitSupermassiveDocuments) {
44
- ({ addTypesToRequestDocument } = yield import("@graphitation/supermassive"));
44
+ ({ addTypesToRequestDocument } = yield import("@graphitation/supermassive-ast"));
45
45
  }
46
46
  function generateExports(moduleName, docText) {
47
47
  const exports = {};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/formatModule.ts"],
4
- "sourcesContent": ["import { parse, print } from \"graphql\";\nimport { optimizeDocumentNode } from \"@graphql-tools/optimize\";\nimport { reduceNodeWatchQueryTransform } from \"./formatModuleTransforms/reduceNodeWatchQueryTransform\";\nimport invariant from \"invariant\";\nimport { stripFragmentReferenceFieldSelectionTransform } from \"./formatModuleTransforms/stripFragmentReferenceFieldSelectionTransform\";\nimport { extractMetadataTransform } from \"./formatModuleTransforms/extractMetadataTransform\";\nimport { buildSchema, Source } from \"graphql\";\nimport { readFileSync } from \"fs\";\nimport dedupeJSONStringify from \"relay-compiler/lib/util/dedupeJSONStringify\";\n\nimport type { DocumentNode } from \"graphql\";\nimport type { FormatModule } from \"relay-compiler/lib/language/RelayLanguagePluginInterface\";\nimport type { CompiledArtefactModule } from \"./types\";\n\nexport interface FormatModuleOptions {\n emitDocuments: boolean;\n emitNarrowObservables: boolean;\n emitQueryDebugComments: boolean;\n emitSupermassiveDocuments: boolean;\n schema: string;\n}\n\nfunction printDocumentComment(document: DocumentNode) {\n return `/*\\n${print(document).trim()}\\n*/`;\n}\n\nexport async function formatModuleFactory(\n options: FormatModuleOptions,\n): Promise<FormatModule> {\n const schema = options.emitNarrowObservables\n ? buildSchema(\n new Source(readFileSync(options.schema, \"utf-8\"), options.schema),\n )\n : null;\n\n let addTypesToRequestDocument:\n | undefined\n | typeof import(\"@graphitation/supermassive\").addTypesToRequestDocument;\n if (options.emitSupermassiveDocuments) {\n ({ addTypesToRequestDocument } = await import(\n \"@graphitation/supermassive\"\n ));\n }\n\n function generateExports(moduleName: string, docText: string) {\n const exports: CompiledArtefactModule = {};\n const originalDocument = parse(docText, { noLocation: true });\n const optimizedDocument = optimizeDocumentNode(originalDocument);\n\n if (!options.emitNarrowObservables) {\n exports.executionQueryDocument = optimizedDocument;\n } else {\n if (!moduleName.endsWith(\"WatchNodeQuery.graphql\")) {\n exports.executionQueryDocument =\n stripFragmentReferenceFieldSelectionTransform(optimizedDocument);\n }\n\n invariant(schema, \"Expected a schema instance\");\n exports.watchQueryDocument = reduceNodeWatchQueryTransform(\n schema,\n optimizedDocument,\n );\n\n exports.metadata = extractMetadataTransform(exports.watchQueryDocument);\n }\n\n if (addTypesToRequestDocument && exports.executionQueryDocument) {\n invariant(schema, \"Expected a schema instance\");\n exports.executionQueryDocument = addTypesToRequestDocument(\n schema,\n exports.executionQueryDocument,\n ) as DocumentNode;\n }\n\n return exports;\n }\n\n return ({ docText, hash, moduleName, typeText }) => {\n const exports = options.emitDocuments\n ? docText && generateExports(moduleName, docText)\n : null;\n const components = [\n typeText,\n exports &&\n options.emitQueryDebugComments &&\n exports.executionQueryDocument &&\n printDocumentComment(exports.executionQueryDocument),\n exports &&\n options.emitQueryDebugComments &&\n exports.watchQueryDocument &&\n printDocumentComment(exports.watchQueryDocument),\n exports &&\n `export const documents: import(\"@graphitation/apollo-react-relay-duct-tape-compiler\").CompiledArtefactModule = ${dedupeJSONStringify(\n exports,\n )};`,\n ].filter(Boolean) as string[];\n\n return `/* tslint:disable */\n/* eslint-disable */\n// @ts-nocheck\n${hash ? `/* ${hash} */\\n` : \"\"}\n${components.join(\"\\n\\n\")}`;\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,OAAO,aAAa;AAC7B,SAAS,4BAA4B;AACrC,SAAS,qCAAqC;AAC9C,OAAO,eAAe;AACtB,SAAS,qDAAqD;AAC9D,SAAS,gCAAgC;AACzC,SAAS,aAAa,cAAc;AACpC,SAAS,oBAAoB;AAC7B,OAAO,yBAAyB;AAchC,SAAS,qBAAqB,UAAwB;AACpD,SAAO;AAAA,EAAO,MAAM,QAAQ,EAAE,KAAK;AAAA;AACrC;AAEA,SAAsB,oBACpB,SACuB;AAAA;AACvB,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AAAA;AAAA,EAGT,OAAO,MAAM;AAAA,IAAc;AAAA,EAC3B,WAAW,KAAK,MAAM;AAAA,IACtB;AAAA,EACF;AAAA;",
4
+ "sourcesContent": ["import { parse, print } from \"graphql\";\nimport { optimizeDocumentNode } from \"@graphql-tools/optimize\";\nimport { reduceNodeWatchQueryTransform } from \"./formatModuleTransforms/reduceNodeWatchQueryTransform\";\nimport invariant from \"invariant\";\nimport { stripFragmentReferenceFieldSelectionTransform } from \"./formatModuleTransforms/stripFragmentReferenceFieldSelectionTransform\";\nimport { extractMetadataTransform } from \"./formatModuleTransforms/extractMetadataTransform\";\nimport { buildSchema, Source } from \"graphql\";\nimport { readFileSync } from \"fs\";\nimport dedupeJSONStringify from \"relay-compiler/lib/util/dedupeJSONStringify\";\n\nimport type { DocumentNode } from \"graphql\";\nimport type { FormatModule } from \"relay-compiler/lib/language/RelayLanguagePluginInterface\";\nimport type { CompiledArtefactModule } from \"./types\";\n\nexport interface FormatModuleOptions {\n emitDocuments: boolean;\n emitNarrowObservables: boolean;\n emitQueryDebugComments: boolean;\n emitSupermassiveDocuments: boolean;\n schema: string;\n}\n\nfunction printDocumentComment(document: DocumentNode) {\n return `/*\\n${print(document).trim()}\\n*/`;\n}\n\nexport async function formatModuleFactory(\n options: FormatModuleOptions,\n): Promise<FormatModule> {\n const schema = options.emitNarrowObservables\n ? buildSchema(\n new Source(readFileSync(options.schema, \"utf-8\"), options.schema),\n )\n : null;\n\n let addTypesToRequestDocument:\n | undefined\n | typeof import(\"@graphitation/supermassive-ast\").addTypesToRequestDocument;\n if (options.emitSupermassiveDocuments) {\n ({ addTypesToRequestDocument } = await import(\n \"@graphitation/supermassive-ast\"\n ));\n }\n\n function generateExports(moduleName: string, docText: string) {\n const exports: CompiledArtefactModule = {};\n const originalDocument = parse(docText, { noLocation: true });\n const optimizedDocument = optimizeDocumentNode(originalDocument);\n\n if (!options.emitNarrowObservables) {\n exports.executionQueryDocument = optimizedDocument;\n } else {\n if (!moduleName.endsWith(\"WatchNodeQuery.graphql\")) {\n exports.executionQueryDocument =\n stripFragmentReferenceFieldSelectionTransform(optimizedDocument);\n }\n\n invariant(schema, \"Expected a schema instance\");\n exports.watchQueryDocument = reduceNodeWatchQueryTransform(\n schema,\n optimizedDocument,\n );\n\n exports.metadata = extractMetadataTransform(exports.watchQueryDocument);\n }\n\n if (addTypesToRequestDocument && exports.executionQueryDocument) {\n invariant(schema, \"Expected a schema instance\");\n exports.executionQueryDocument = addTypesToRequestDocument(\n schema,\n exports.executionQueryDocument,\n ) as DocumentNode;\n }\n\n return exports;\n }\n\n return ({ docText, hash, moduleName, typeText }) => {\n const exports = options.emitDocuments\n ? docText && generateExports(moduleName, docText)\n : null;\n const components = [\n typeText,\n exports &&\n options.emitQueryDebugComments &&\n exports.executionQueryDocument &&\n printDocumentComment(exports.executionQueryDocument),\n exports &&\n options.emitQueryDebugComments &&\n exports.watchQueryDocument &&\n printDocumentComment(exports.watchQueryDocument),\n exports &&\n `export const documents: import(\"@graphitation/apollo-react-relay-duct-tape-compiler\").CompiledArtefactModule = ${dedupeJSONStringify(\n exports,\n )};`,\n ].filter(Boolean) as string[];\n\n return `/* tslint:disable */\n/* eslint-disable */\n// @ts-nocheck\n${hash ? `/* ${hash} */\\n` : \"\"}\n${components.join(\"\\n\\n\")}`;\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,OAAO,aAAa;AAC7B,SAAS,4BAA4B;AACrC,SAAS,qCAAqC;AAC9C,OAAO,eAAe;AACtB,SAAS,qDAAqD;AAC9D,SAAS,gCAAgC;AACzC,SAAS,aAAa,cAAc;AACpC,SAAS,oBAAoB;AAC7B,OAAO,yBAAyB;AAchC,SAAS,qBAAqB,UAAwB;AACpD,SAAO;AAAA,EAAO,MAAM,QAAQ,EAAE,KAAK;AAAA;AACrC;AAEA,SAAsB,oBACpB,SACuB;AAAA;AACvB,UAAM,SAAS,QAAQ,wBACnB;AAAA,MACE,IAAI,OAAO,a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C3B,WAAW,KAAK,MAAM;AAAA,IACtB;AAAA,EACF;AAAA;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphitation/apollo-react-relay-duct-tape-compiler",
3
3
  "description": "The build tools to cater to @graphitation/apollo-react-relay-duct-tape's needs.",
4
4
  "license": "MIT",
5
- "version": "1.0.0",
5
+ "version": "1.2.0",
6
6
  "main": "./lib/index.js",
7
7
  "bin": {
8
8
  "duct-tape-compiler": "./lib/cli.js"
@@ -23,11 +23,11 @@
23
23
  "@graphitation/graphql-js-tag": "^0.9.0",
24
24
  "@graphql-tools/optimize": "^1.1.1",
25
25
  "relay-compiler": "^12.0.0",
26
- "relay-compiler-language-typescript": "^15.0.1",
27
- "typescript": "^4.5.0, <4.8.0"
26
+ "relay-compiler-language-typescript": "^15.0.1"
28
27
  },
29
28
  "devDependencies": {
30
29
  "@graphitation/graphql-js-tag": "^0.9.0",
30
+ "@graphitation/supermassive-ast": "*",
31
31
  "@types/dedent": "^0.7.0",
32
32
  "@types/jest": "^26.0.22",
33
33
  "@types/relay-compiler": "^8.0.0",
@@ -36,11 +36,13 @@
36
36
  "monorepo-scripts": "*",
37
37
  "relay-test-utils": "^12.0.0",
38
38
  "relay-test-utils-internal": "^12.0.0",
39
- "ts-node": "^10.4.0"
39
+ "ts-node": "^10.4.0",
40
+ "typescript": "^4.9.5"
40
41
  },
41
42
  "peerDependencies": {
42
43
  "graphql": "^15.0.0",
43
- "@graphitation/supermassive": "^2.4.8"
44
+ "@graphitation/supermassive-ast": "^2.0.0",
45
+ "typescript": "^4.3.5"
44
46
  },
45
47
  "publishConfig": {
46
48
  "access": "public"