@graphitation/apollo-react-relay-duct-tape-compiler 1.6.20 → 1.7.1
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 +20 -2
- package/lib/cli.js +106 -144
- package/lib/cli.js.map +1 -1
- package/lib/cli.mjs +106 -146
- package/lib/cli.mjs.map +1 -1
- package/lib/compilerTransforms/annotateFragmentReferenceTransform.js +6 -21
- package/lib/compilerTransforms/annotateFragmentReferenceTransform.js.map +1 -1
- package/lib/compilerTransforms/annotateFragmentReferenceTransform.mjs +6 -24
- package/lib/compilerTransforms/annotateFragmentReferenceTransform.mjs.map +1 -1
- package/lib/compilerTransforms/emitApolloClientConnectionTransform.js +3 -19
- package/lib/compilerTransforms/emitApolloClientConnectionTransform.js.map +1 -1
- package/lib/compilerTransforms/emitApolloClientConnectionTransform.mjs +3 -21
- package/lib/compilerTransforms/emitApolloClientConnectionTransform.mjs.map +1 -1
- package/lib/compilerTransforms/enableNodeWatchQueryTransform.js +3 -19
- package/lib/compilerTransforms/enableNodeWatchQueryTransform.js.map +1 -1
- package/lib/compilerTransforms/enableNodeWatchQueryTransform.mjs +3 -22
- package/lib/compilerTransforms/enableNodeWatchQueryTransform.mjs.map +1 -1
- package/lib/compilerTransforms/retainConnectionDirectiveTransform.js +3 -19
- package/lib/compilerTransforms/retainConnectionDirectiveTransform.js.map +1 -1
- package/lib/compilerTransforms/retainConnectionDirectiveTransform.mjs +3 -22
- package/lib/compilerTransforms/retainConnectionDirectiveTransform.mjs.map +1 -1
- package/lib/formatModule.js +55 -77
- package/lib/formatModule.js.map +1 -1
- package/lib/formatModule.mjs +55 -78
- package/lib/formatModule.mjs.map +1 -1
- package/lib/formatModuleTransforms/extractMetadataTransform.js +3 -15
- package/lib/formatModuleTransforms/extractMetadataTransform.js.map +1 -1
- package/lib/formatModuleTransforms/extractMetadataTransform.mjs +3 -18
- package/lib/formatModuleTransforms/extractMetadataTransform.mjs.map +1 -1
- package/lib/relayCompilerLanguagePlugin.js +15 -53
- package/lib/relayCompilerLanguagePlugin.js.map +1 -1
- package/lib/relayCompilerLanguagePlugin.mjs +15 -56
- package/lib/relayCompilerLanguagePlugin.mjs.map +1 -1
- package/lib/rewriteGraphitationDirectives.js +3 -19
- package/lib/rewriteGraphitationDirectives.js.map +1 -1
- package/lib/rewriteGraphitationDirectives.mjs +3 -22
- package/lib/rewriteGraphitationDirectives.mjs.map +1 -1
- package/lib/typescriptTransforms/TypeScriptGenerator.js +27 -34
- package/lib/typescriptTransforms/TypeScriptGenerator.js.map +1 -1
- package/lib/typescriptTransforms/TypeScriptGenerator.mjs +27 -37
- package/lib/typescriptTransforms/TypeScriptGenerator.mjs.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
# Change Log - @graphitation/apollo-react-relay-duct-tape-compiler
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Tue, 08 Apr 2025 15:38:15 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.7.1
|
|
8
|
+
|
|
9
|
+
Tue, 08 Apr 2025 15:38:15 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Bump @graphitation/supermassive to v3.10.1
|
|
14
|
+
|
|
15
|
+
## 1.7.0
|
|
16
|
+
|
|
17
|
+
Wed, 02 Apr 2025 11:43:32 GMT
|
|
18
|
+
|
|
19
|
+
### Minor changes
|
|
20
|
+
|
|
21
|
+
- Changed build target from ES6 to ES2018 (vrazuvaev@microsoft.com_msteamsmdb)
|
|
22
|
+
- Bump @graphitation/graphql-js-tag to v0.10.0
|
|
23
|
+
- Bump @graphitation/supermassive to v3.10.0
|
|
24
|
+
|
|
7
25
|
## 1.6.20
|
|
8
26
|
|
|
9
|
-
Fri, 28 Mar 2025 09:
|
|
27
|
+
Fri, 28 Mar 2025 09:57:05 GMT
|
|
10
28
|
|
|
11
29
|
### Patches
|
|
12
30
|
|
package/lib/cli.js
CHANGED
|
@@ -2,27 +2,10 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
|
-
var __defProps = Object.defineProperties;
|
|
6
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
8
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
10
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
11
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
13
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
-
var __spreadValues = (a, b) => {
|
|
15
|
-
for (var prop in b || (b = {}))
|
|
16
|
-
if (__hasOwnProp.call(b, prop))
|
|
17
|
-
__defNormalProp(a, prop, b[prop]);
|
|
18
|
-
if (__getOwnPropSymbols)
|
|
19
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
20
|
-
if (__propIsEnum.call(b, prop))
|
|
21
|
-
__defNormalProp(a, prop, b[prop]);
|
|
22
|
-
}
|
|
23
|
-
return a;
|
|
24
|
-
};
|
|
25
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
26
9
|
var __copyProps = (to, from, except, desc) => {
|
|
27
10
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
11
|
for (let key of __getOwnPropNames(from))
|
|
@@ -39,26 +22,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
39
22
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
40
23
|
mod
|
|
41
24
|
));
|
|
42
|
-
var __async = (__this, __arguments, generator) => {
|
|
43
|
-
return new Promise((resolve, reject) => {
|
|
44
|
-
var fulfilled = (value) => {
|
|
45
|
-
try {
|
|
46
|
-
step(generator.next(value));
|
|
47
|
-
} catch (e) {
|
|
48
|
-
reject(e);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
var rejected = (value) => {
|
|
52
|
-
try {
|
|
53
|
-
step(generator.throw(value));
|
|
54
|
-
} catch (e) {
|
|
55
|
-
reject(e);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
59
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
25
|
var yargs = __toESM(require("yargs"));
|
|
63
26
|
var import_relay_compiler = require("relay-compiler");
|
|
64
27
|
var import_relayCompilerLanguagePlugin = require("./relayCompilerLanguagePlugin");
|
|
@@ -84,116 +47,115 @@ wrapTransform(
|
|
|
84
47
|
import_relay_compiler2.IRTransforms.commonTransforms,
|
|
85
48
|
import_emitApolloClientConnectionTransform.emitApolloClientConnectionTransform
|
|
86
49
|
);
|
|
87
|
-
function main() {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return "V2";
|
|
168
|
-
}
|
|
50
|
+
async function main() {
|
|
51
|
+
const argv = await yargs.scriptName("duct-tape-compiler").options({
|
|
52
|
+
src: {
|
|
53
|
+
demandOption: false,
|
|
54
|
+
default: ".",
|
|
55
|
+
type: "string"
|
|
56
|
+
},
|
|
57
|
+
exclude: {
|
|
58
|
+
demandOption: false,
|
|
59
|
+
type: "string",
|
|
60
|
+
array: true
|
|
61
|
+
},
|
|
62
|
+
include: {
|
|
63
|
+
demandOption: false,
|
|
64
|
+
type: "string",
|
|
65
|
+
array: true
|
|
66
|
+
},
|
|
67
|
+
schema: {
|
|
68
|
+
demandOption: true,
|
|
69
|
+
type: "string"
|
|
70
|
+
},
|
|
71
|
+
validate: {
|
|
72
|
+
demandOption: false,
|
|
73
|
+
default: false,
|
|
74
|
+
type: "boolean"
|
|
75
|
+
},
|
|
76
|
+
verbose: {
|
|
77
|
+
demandOption: false,
|
|
78
|
+
default: false,
|
|
79
|
+
type: "boolean"
|
|
80
|
+
},
|
|
81
|
+
watch: {
|
|
82
|
+
demandOption: false,
|
|
83
|
+
default: false,
|
|
84
|
+
type: "boolean"
|
|
85
|
+
},
|
|
86
|
+
watchman: {
|
|
87
|
+
demandOption: false,
|
|
88
|
+
default: true,
|
|
89
|
+
type: "boolean"
|
|
90
|
+
},
|
|
91
|
+
quiet: {
|
|
92
|
+
demandOption: false,
|
|
93
|
+
default: false,
|
|
94
|
+
type: "boolean"
|
|
95
|
+
},
|
|
96
|
+
emitDocuments: {
|
|
97
|
+
demandOption: false,
|
|
98
|
+
default: true,
|
|
99
|
+
type: "boolean"
|
|
100
|
+
},
|
|
101
|
+
emitNarrowObservables: {
|
|
102
|
+
demandOption: false,
|
|
103
|
+
default: true,
|
|
104
|
+
type: "boolean"
|
|
105
|
+
},
|
|
106
|
+
emitQueryDebugComments: {
|
|
107
|
+
demandOption: false,
|
|
108
|
+
default: false,
|
|
109
|
+
type: "boolean"
|
|
110
|
+
},
|
|
111
|
+
emitSupermassiveDocuments: {
|
|
112
|
+
demandOption: false,
|
|
113
|
+
default: false,
|
|
114
|
+
type: "boolean"
|
|
115
|
+
},
|
|
116
|
+
supermassiveDocumentNodeOutputType: {
|
|
117
|
+
demandOption: false,
|
|
118
|
+
default: "V2",
|
|
119
|
+
type: "string",
|
|
120
|
+
coerce: (value) => {
|
|
121
|
+
switch (value) {
|
|
122
|
+
case "V2":
|
|
123
|
+
return "V2";
|
|
124
|
+
case "V3":
|
|
125
|
+
return "V3";
|
|
126
|
+
case "BOTH":
|
|
127
|
+
return "BOTH";
|
|
128
|
+
default:
|
|
129
|
+
return "V2";
|
|
169
130
|
}
|
|
170
131
|
}
|
|
171
|
-
}).help().argv;
|
|
172
|
-
if (!argv.emitDocuments) {
|
|
173
|
-
argv.emitNarrowObservables = false;
|
|
174
|
-
argv.emitQueryDebugComments = false;
|
|
175
|
-
}
|
|
176
|
-
if (argv.emitNarrowObservables) {
|
|
177
|
-
import_relay_compiler2.IRTransforms.printTransforms.push(import_annotateFragmentReferenceTransform.annotateFragmentReferenceTransform);
|
|
178
|
-
import_relay_compiler2.IRTransforms.commonTransforms.unshift(import_enableNodeWatchQueryTransform.enableNodeWatchQueryTransform);
|
|
179
132
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
133
|
+
}).help().argv;
|
|
134
|
+
if (!argv.emitDocuments) {
|
|
135
|
+
argv.emitNarrowObservables = false;
|
|
136
|
+
argv.emitQueryDebugComments = false;
|
|
137
|
+
}
|
|
138
|
+
if (argv.emitNarrowObservables) {
|
|
139
|
+
import_relay_compiler2.IRTransforms.printTransforms.push(import_annotateFragmentReferenceTransform.annotateFragmentReferenceTransform);
|
|
140
|
+
import_relay_compiler2.IRTransforms.commonTransforms.unshift(import_enableNodeWatchQueryTransform.enableNodeWatchQueryTransform);
|
|
141
|
+
}
|
|
142
|
+
const ductTapeCompilerLanguagePlugin = await (0, import_relayCompilerLanguagePlugin.pluginFactory)(argv);
|
|
143
|
+
return (0, import_relay_compiler.relayCompiler)({
|
|
144
|
+
...argv,
|
|
145
|
+
language: ductTapeCompilerLanguagePlugin,
|
|
146
|
+
extensions: ["ts", "tsx"],
|
|
147
|
+
// FIXME: Why is this not taken from the language plugin?
|
|
148
|
+
include: argv.include || ["**"],
|
|
149
|
+
exclude: [
|
|
150
|
+
"**/node_modules/**",
|
|
151
|
+
"**/__mocks__/**",
|
|
152
|
+
"**/__generated__/**",
|
|
153
|
+
// relay-compiler will treat these as client-side schema extensions
|
|
154
|
+
"**/*.graphql",
|
|
155
|
+
...argv.exclude || []
|
|
156
|
+
],
|
|
157
|
+
noFutureProofEnums: true,
|
|
158
|
+
customScalars: {}
|
|
197
159
|
});
|
|
198
160
|
}
|
|
199
161
|
main().catch((error) => {
|
package/lib/cli.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/cli.ts"],
|
|
4
4
|
"sourcesContent": ["#!/usr/bin/env node\n\n/* istanbul ignore file */\n\nimport * as yargs from \"yargs\";\nimport { relayCompiler } from \"relay-compiler\";\nimport { pluginFactory } from \"./relayCompilerLanguagePlugin\";\n\n// TODO: This needs to be done here to ensure we get to mutate the transforms lists that get used.\nimport { IRTransforms } from \"relay-compiler\";\nimport { IRTransform } from \"relay-compiler/lib/core/CompilerContext\";\nimport { enableNodeWatchQueryTransform } from \"./compilerTransforms/enableNodeWatchQueryTransform\";\nimport { annotateFragmentReferenceTransform } from \"./compilerTransforms/annotateFragmentReferenceTransform\";\nimport { emitApolloClientConnectionTransform } from \"./compilerTransforms/emitApolloClientConnectionTransform\";\nimport { retainConnectionDirectiveTransform } from \"./compilerTransforms/retainConnectionDirectiveTransform\";\n\nfunction wrapTransform(\n transformName: string,\n transforms: IRTransform[],\n wrapperTransform: (wrappedTransform: IRTransform) => IRTransform,\n) {\n const transformIndex = transforms.findIndex(\n (transform) => transform.name === transformName,\n );\n const wrappedTransform = transforms[transformIndex];\n transforms[transformIndex] = wrapperTransform(wrappedTransform);\n}\n\nwrapTransform(\n \"filterDirectivesTransform\",\n IRTransforms.printTransforms,\n retainConnectionDirectiveTransform,\n);\nwrapTransform(\n \"connectionTransform\",\n IRTransforms.commonTransforms,\n emitApolloClientConnectionTransform,\n);\n\nasync function main() {\n const argv = await yargs\n .scriptName(\"duct-tape-compiler\")\n .options({\n src: {\n demandOption: false,\n default: \".\",\n type: \"string\",\n },\n exclude: {\n demandOption: false,\n type: \"string\",\n array: true,\n },\n include: {\n demandOption: false,\n type: \"string\",\n array: true,\n },\n schema: {\n demandOption: true,\n type: \"string\",\n },\n validate: {\n demandOption: false,\n default: false,\n type: \"boolean\",\n },\n verbose: {\n demandOption: false,\n default: false,\n type: \"boolean\",\n },\n watch: {\n demandOption: false,\n default: false,\n type: \"boolean\",\n },\n watchman: {\n demandOption: false,\n default: true,\n type: \"boolean\",\n },\n quiet: {\n demandOption: false,\n default: false,\n type: \"boolean\",\n },\n emitDocuments: {\n demandOption: false,\n default: true,\n type: \"boolean\",\n },\n emitNarrowObservables: {\n demandOption: false,\n default: true,\n type: \"boolean\",\n },\n emitQueryDebugComments: {\n demandOption: false,\n default: false,\n type: \"boolean\",\n },\n emitSupermassiveDocuments: {\n demandOption: false,\n default: false,\n type: \"boolean\",\n },\n supermassiveDocumentNodeOutputType: {\n demandOption: false,\n default: \"V2\",\n type: \"string\",\n coerce: (value) => {\n switch (value) {\n case \"V2\":\n return \"V2\";\n case \"V3\":\n return \"V3\";\n case \"BOTH\":\n return \"BOTH\";\n default:\n return \"V2\";\n }\n },\n },\n })\n .help().argv;\n\n if (!argv.emitDocuments) {\n argv.emitNarrowObservables = false;\n argv.emitQueryDebugComments = false;\n }\n\n if (argv.emitNarrowObservables) {\n // TODO: Moving this up in the list might potentially optimize the query further\n IRTransforms.printTransforms.push(annotateFragmentReferenceTransform);\n IRTransforms.commonTransforms.unshift(enableNodeWatchQueryTransform);\n }\n\n const ductTapeCompilerLanguagePlugin = await pluginFactory(argv);\n\n return relayCompiler({\n ...argv,\n language: ductTapeCompilerLanguagePlugin,\n extensions: [\"ts\", \"tsx\"], // FIXME: Why is this not taken from the language plugin?\n include: argv.include || [\"**\"],\n exclude: [\n \"**/node_modules/**\",\n \"**/__mocks__/**\",\n \"**/__generated__/**\",\n // relay-compiler will treat these as client-side schema extensions\n \"**/*.graphql\",\n ...(argv.exclude || []),\n ],\n noFutureProofEnums: true,\n customScalars: {},\n });\n}\n\nmain().catch((error) => {\n console.error(error);\n process.exit(1);\n});\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,YAAuB;AACvB,4BAA8B;AAC9B,yCAA8B;AAG9B,IAAAA,yBAA6B;AAE7B,2CAA8C;AAC9C,gDAAmD;AACnD,iDAAoD;AACpD,gDAAmD;AAEnD,SA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defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __async = (__this, __arguments, generator) => {
|
|
22
|
-
return new Promise((resolve, reject) => {
|
|
23
|
-
var fulfilled = (value) => {
|
|
24
|
-
try {
|
|
25
|
-
step(generator.next(value));
|
|
26
|
-
} catch (e) {
|
|
27
|
-
reject(e);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
var rejected = (value) => {
|
|
31
|
-
try {
|
|
32
|
-
step(generator.throw(value));
|
|
33
|
-
} catch (e) {
|
|
34
|
-
reject(e);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
38
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
2
|
|
|
42
3
|
// src/cli.ts
|
|
43
4
|
import * as yargs from "yargs";
|
|
@@ -65,116 +26,115 @@ wrapTransform(
|
|
|
65
26
|
IRTransforms.commonTransforms,
|
|
66
27
|
emitApolloClientConnectionTransform
|
|
67
28
|
);
|
|
68
|
-
function main() {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return "V2";
|
|
149
|
-
}
|
|
29
|
+
async function main() {
|
|
30
|
+
const argv = await yargs.scriptName("duct-tape-compiler").options({
|
|
31
|
+
src: {
|
|
32
|
+
demandOption: false,
|
|
33
|
+
default: ".",
|
|
34
|
+
type: "string"
|
|
35
|
+
},
|
|
36
|
+
exclude: {
|
|
37
|
+
demandOption: false,
|
|
38
|
+
type: "string",
|
|
39
|
+
array: true
|
|
40
|
+
},
|
|
41
|
+
include: {
|
|
42
|
+
demandOption: false,
|
|
43
|
+
type: "string",
|
|
44
|
+
array: true
|
|
45
|
+
},
|
|
46
|
+
schema: {
|
|
47
|
+
demandOption: true,
|
|
48
|
+
type: "string"
|
|
49
|
+
},
|
|
50
|
+
validate: {
|
|
51
|
+
demandOption: false,
|
|
52
|
+
default: false,
|
|
53
|
+
type: "boolean"
|
|
54
|
+
},
|
|
55
|
+
verbose: {
|
|
56
|
+
demandOption: false,
|
|
57
|
+
default: false,
|
|
58
|
+
type: "boolean"
|
|
59
|
+
},
|
|
60
|
+
watch: {
|
|
61
|
+
demandOption: false,
|
|
62
|
+
default: false,
|
|
63
|
+
type: "boolean"
|
|
64
|
+
},
|
|
65
|
+
watchman: {
|
|
66
|
+
demandOption: false,
|
|
67
|
+
default: true,
|
|
68
|
+
type: "boolean"
|
|
69
|
+
},
|
|
70
|
+
quiet: {
|
|
71
|
+
demandOption: false,
|
|
72
|
+
default: false,
|
|
73
|
+
type: "boolean"
|
|
74
|
+
},
|
|
75
|
+
emitDocuments: {
|
|
76
|
+
demandOption: false,
|
|
77
|
+
default: true,
|
|
78
|
+
type: "boolean"
|
|
79
|
+
},
|
|
80
|
+
emitNarrowObservables: {
|
|
81
|
+
demandOption: false,
|
|
82
|
+
default: true,
|
|
83
|
+
type: "boolean"
|
|
84
|
+
},
|
|
85
|
+
emitQueryDebugComments: {
|
|
86
|
+
demandOption: false,
|
|
87
|
+
default: false,
|
|
88
|
+
type: "boolean"
|
|
89
|
+
},
|
|
90
|
+
emitSupermassiveDocuments: {
|
|
91
|
+
demandOption: false,
|
|
92
|
+
default: false,
|
|
93
|
+
type: "boolean"
|
|
94
|
+
},
|
|
95
|
+
supermassiveDocumentNodeOutputType: {
|
|
96
|
+
demandOption: false,
|
|
97
|
+
default: "V2",
|
|
98
|
+
type: "string",
|
|
99
|
+
coerce: (value) => {
|
|
100
|
+
switch (value) {
|
|
101
|
+
case "V2":
|
|
102
|
+
return "V2";
|
|
103
|
+
case "V3":
|
|
104
|
+
return "V3";
|
|
105
|
+
case "BOTH":
|
|
106
|
+
return "BOTH";
|
|
107
|
+
default:
|
|
108
|
+
return "V2";
|
|
150
109
|
}
|
|
151
110
|
}
|
|
152
|
-
}).help().argv;
|
|
153
|
-
if (!argv.emitDocuments) {
|
|
154
|
-
argv.emitNarrowObservables = false;
|
|
155
|
-
argv.emitQueryDebugComments = false;
|
|
156
|
-
}
|
|
157
|
-
if (argv.emitNarrowObservables) {
|
|
158
|
-
IRTransforms.printTransforms.push(annotateFragmentReferenceTransform);
|
|
159
|
-
IRTransforms.commonTransforms.unshift(enableNodeWatchQueryTransform);
|
|
160
111
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
112
|
+
}).help().argv;
|
|
113
|
+
if (!argv.emitDocuments) {
|
|
114
|
+
argv.emitNarrowObservables = false;
|
|
115
|
+
argv.emitQueryDebugComments = false;
|
|
116
|
+
}
|
|
117
|
+
if (argv.emitNarrowObservables) {
|
|
118
|
+
IRTransforms.printTransforms.push(annotateFragmentReferenceTransform);
|
|
119
|
+
IRTransforms.commonTransforms.unshift(enableNodeWatchQueryTransform);
|
|
120
|
+
}
|
|
121
|
+
const ductTapeCompilerLanguagePlugin = await pluginFactory(argv);
|
|
122
|
+
return relayCompiler({
|
|
123
|
+
...argv,
|
|
124
|
+
language: ductTapeCompilerLanguagePlugin,
|
|
125
|
+
extensions: ["ts", "tsx"],
|
|
126
|
+
// FIXME: Why is this not taken from the language plugin?
|
|
127
|
+
include: argv.include || ["**"],
|
|
128
|
+
exclude: [
|
|
129
|
+
"**/node_modules/**",
|
|
130
|
+
"**/__mocks__/**",
|
|
131
|
+
"**/__generated__/**",
|
|
132
|
+
// relay-compiler will treat these as client-side schema extensions
|
|
133
|
+
"**/*.graphql",
|
|
134
|
+
...argv.exclude || []
|
|
135
|
+
],
|
|
136
|
+
noFutureProofEnums: true,
|
|
137
|
+
customScalars: {}
|
|
178
138
|
});
|
|
179
139
|
}
|
|
180
140
|
main().catch((error) => {
|
package/lib/cli.mjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/cli.ts"],
|
|
4
4
|
"sourcesContent": ["#!/usr/bin/env node\n\n/* istanbul ignore file */\n\nimport * as yargs from \"yargs\";\nimport { relayCompiler } from \"relay-compiler\";\nimport { pluginFactory } from \"./relayCompilerLanguagePlugin\";\n\n// TODO: This needs to be done here to ensure we get to mutate the transforms lists that get used.\nimport { IRTransforms } from \"relay-compiler\";\nimport { IRTransform } from \"relay-compiler/lib/core/CompilerContext\";\nimport { enableNodeWatchQueryTransform } from \"./compilerTransforms/enableNodeWatchQueryTransform\";\nimport { annotateFragmentReferenceTransform } from \"./compilerTransforms/annotateFragmentReferenceTransform\";\nimport { emitApolloClientConnectionTransform } from \"./compilerTransforms/emitApolloClientConnectionTransform\";\nimport { retainConnectionDirectiveTransform } from \"./compilerTransforms/retainConnectionDirectiveTransform\";\n\nfunction wrapTransform(\n transformName: string,\n transforms: IRTransform[],\n wrapperTransform: (wrappedTransform: IRTransform) => IRTransform,\n) {\n const transformIndex = transforms.findIndex(\n (transform) => transform.name === transformName,\n );\n const wrappedTransform = transforms[transformIndex];\n transforms[transformIndex] = wrapperTransform(wrappedTransform);\n}\n\nwrapTransform(\n \"filterDirectivesTransform\",\n IRTransforms.printTransforms,\n retainConnectionDirectiveTransform,\n);\nwrapTransform(\n \"connectionTransform\",\n IRTransforms.commonTransforms,\n emitApolloClientConnectionTransform,\n);\n\nasync function main() {\n const argv = await yargs\n .scriptName(\"duct-tape-compiler\")\n .options({\n src: {\n demandOption: false,\n default: \".\",\n type: \"string\",\n },\n exclude: {\n demandOption: false,\n type: \"string\",\n array: true,\n },\n include: {\n demandOption: false,\n type: \"string\",\n array: true,\n },\n schema: {\n demandOption: true,\n type: \"string\",\n },\n validate: {\n demandOption: false,\n default: false,\n type: \"boolean\",\n },\n verbose: {\n demandOption: false,\n default: false,\n type: \"boolean\",\n },\n watch: {\n demandOption: false,\n default: false,\n type: \"boolean\",\n },\n watchman: {\n demandOption: false,\n default: true,\n type: \"boolean\",\n },\n quiet: {\n demandOption: false,\n default: false,\n type: \"boolean\",\n },\n emitDocuments: {\n demandOption: false,\n default: true,\n type: \"boolean\",\n },\n emitNarrowObservables: {\n demandOption: false,\n default: true,\n type: \"boolean\",\n },\n emitQueryDebugComments: {\n demandOption: false,\n default: false,\n type: \"boolean\",\n },\n emitSupermassiveDocuments: {\n demandOption: false,\n default: false,\n type: \"boolean\",\n },\n supermassiveDocumentNodeOutputType: {\n demandOption: false,\n default: \"V2\",\n type: \"string\",\n coerce: (value) => {\n switch (value) {\n case \"V2\":\n return \"V2\";\n case \"V3\":\n return \"V3\";\n case \"BOTH\":\n return \"BOTH\";\n default:\n return \"V2\";\n }\n },\n },\n })\n .help().argv;\n\n if (!argv.emitDocuments) {\n argv.emitNarrowObservables = false;\n argv.emitQueryDebugComments = false;\n }\n\n if (argv.emitNarrowObservables) {\n // TODO: Moving this up in the list might potentially optimize the query further\n IRTransforms.printTransforms.push(annotateFragmentReferenceTransform);\n IRTransforms.commonTransforms.unshift(enableNodeWatchQueryTransform);\n }\n\n const ductTapeCompilerLanguagePlugin = await pluginFactory(argv);\n\n return relayCompiler({\n ...argv,\n language: ductTapeCompilerLanguagePlugin,\n extensions: [\"ts\", \"tsx\"], // FIXME: Why is this not taken from the language plugin?\n include: argv.include || [\"**\"],\n exclude: [\n \"**/node_modules/**\",\n \"**/__mocks__/**\",\n \"**/__generated__/**\",\n // relay-compiler will treat these as client-side schema extensions\n \"**/*.graphql\",\n ...(argv.exclude || []),\n ],\n noFutureProofEnums: true,\n customScalars: {},\n });\n}\n\nmain().catch((error) => {\n console.error(error);\n process.exit(1);\n});\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;AAIA,YAAY,WAAW;AACvB,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAG9B,SAAS,oBAAoB;AAE7B,SAAS,qCAAqC;AAC9C,SAAS,0CAA0C;AACnD,SAAS,2CAA2C;AACpD,SAAS,0CAA0C;AAEnD,SAAS,cACP,eACA,YACA,kBACA;AACA,QAAM,iBAAiB,WAAW;AAAA,IAChC,CAAC,cAAc,UAAU,SAAS;AAAA,EACpC;AACA,QAAM,mBAAmB,WAAW,cAAc;AAClD,aAAW,cAAc,IAAI,iBAAiB,gBAAgB;AAChE;AAEA;AAAA,EACE;AAAA,EACA,aAAa;AAAA,EACb;AACF;AACA;AAAA,EACE;AAAA,EACA,aAAa;AAAA,EACb;AACF;AAEA,eAAe,OAAO;AACpB,QAAM,OAAO,MACV,iBAAW,oBAAoB,EAC/B,QAAQ;AAAA,IACP,KAAK;AAAA,MACH,cAAc;AAAA,MACd,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,IACA,SAAS;AAAA,MACP,cAAc;AAAA,MACd,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,SAAS;AAAA,MACP,cAAc;AAAA,MACd,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,QAAQ;AAAA,MACN,cAAc;AAAA,MACd,MAAM;AAAA,IACR;AAAA,IACA,UAAU;AAAA,MACR,cAAc;AAAA,MACd,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,IACA,SAAS;AAAA,MACP,cAAc;AAAA,MACd,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,IACA,OAAO;AAAA,MACL,cAAc;AAAA,MACd,SAAS;AA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