@graphitation/graphql-codegen-supermassive-schema-extraction-plugin 0.1.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 +14 -0
- package/README.md +5 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +60 -0
- package/lib/index.mjs +40 -0
- package/package.json +42 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Change Log - @graphitation/graphql-codegen-supermassive-schema-extraction-plugin
|
|
2
|
+
|
|
3
|
+
This log was last generated on Fri, 24 Jun 2022 17:04:18 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
<!-- Start content -->
|
|
6
|
+
|
|
7
|
+
## 0.1.1
|
|
8
|
+
|
|
9
|
+
Fri, 24 Jun 2022 17:04:18 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- supermassive schema extraction plugin added (jakubvejr@microsoft.com)
|
|
14
|
+
- Bump @graphitation/supermassive to v0.8.5
|
package/README.md
ADDED
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PluginValidateFn, PluginFunction } from "@graphql-codegen/plugin-helpers";
|
|
2
|
+
import { RawClientSideBasePluginConfig } from "@graphql-codegen/visitor-plugin-common";
|
|
3
|
+
declare type PluginConfig = RawClientSideBasePluginConfig & {
|
|
4
|
+
files: string[];
|
|
5
|
+
};
|
|
6
|
+
export declare const plugin: PluginFunction<PluginConfig>;
|
|
7
|
+
export declare const validate: PluginValidateFn<PluginConfig>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,aAAK,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"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
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
|
+
var src_exports = {};
|
|
42
|
+
__export(src_exports, {
|
|
43
|
+
plugin: () => plugin,
|
|
44
|
+
validate: () => validate
|
|
45
|
+
});
|
|
46
|
+
module.exports = __toCommonJS(src_exports);
|
|
47
|
+
var import_typescript = __toESM(require("typescript"));
|
|
48
|
+
var import_graphql2 = require("graphql");
|
|
49
|
+
var import_supermassive = require("@graphitation/supermassive");
|
|
50
|
+
var import_path = require("path");
|
|
51
|
+
const plugin = (schema) => {
|
|
52
|
+
const tsContents = (0, import_supermassive.extractImplicitTypesToTypescript)((0, import_graphql2.parse)((0, import_graphql2.printSchema)(schema)));
|
|
53
|
+
const printer = import_typescript.default.createPrinter();
|
|
54
|
+
return printer.printNode(import_typescript.default.EmitHint.SourceFile, tsContents, tsContents);
|
|
55
|
+
};
|
|
56
|
+
const validate = (schema, documents, config, outputFile) => __async(void 0, null, function* () {
|
|
57
|
+
if ((0, import_path.extname)(outputFile) !== ".ts" && (0, import_path.extname)(outputFile) !== ".tsx") {
|
|
58
|
+
throw new Error(`Plugin "supermassive-typed-document-node" requires extension to be ".ts" or ".tsx"!`);
|
|
59
|
+
}
|
|
60
|
+
});
|
package/lib/index.mjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// src/index.ts
|
|
23
|
+
import ts from "typescript";
|
|
24
|
+
import { printSchema, parse } from "graphql";
|
|
25
|
+
import { extractImplicitTypesToTypescript } from "@graphitation/supermassive";
|
|
26
|
+
import { extname } from "path";
|
|
27
|
+
var plugin = (schema) => {
|
|
28
|
+
const tsContents = extractImplicitTypesToTypescript(parse(printSchema(schema)));
|
|
29
|
+
const printer = ts.createPrinter();
|
|
30
|
+
return printer.printNode(ts.EmitHint.SourceFile, tsContents, tsContents);
|
|
31
|
+
};
|
|
32
|
+
var validate = (schema, documents, config, outputFile) => __async(void 0, null, function* () {
|
|
33
|
+
if (extname(outputFile) !== ".ts" && extname(outputFile) !== ".tsx") {
|
|
34
|
+
throw new Error(`Plugin "supermassive-typed-document-node" requires extension to be ".ts" or ".tsx"!`);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
plugin,
|
|
39
|
+
validate
|
|
40
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@graphitation/graphql-codegen-supermassive-schema-extraction-plugin",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"version": "0.1.1",
|
|
5
|
+
"main": "./lib/index",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/microsoft/graphitation.git",
|
|
9
|
+
"directory": "packages/graphql-codegen-supermassive-schema-extraction-plugin"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "monorepo-scripts build",
|
|
13
|
+
"lint": "monorepo-scripts lint",
|
|
14
|
+
"types": "monorepo-scripts types",
|
|
15
|
+
"just": "monorepo-scripts"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@graphitation/supermassive": "*",
|
|
19
|
+
"@graphql-codegen/plugin-helpers": "^1.18.2",
|
|
20
|
+
"@types/jest": "^26.0.22",
|
|
21
|
+
"monorepo-scripts": "*"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@graphql-codegen/plugin-helpers": ">= 1.18.0 < 2",
|
|
25
|
+
"typescript": "^4.4.3 <4.5.0",
|
|
26
|
+
"@graphitation/supermassive": ">= ^0.8.5"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"typescript": "^4.4.3 <4.5.0"
|
|
30
|
+
},
|
|
31
|
+
"sideEffects": false,
|
|
32
|
+
"access": "public",
|
|
33
|
+
"publishConfig": {},
|
|
34
|
+
"types": "./lib/index.d.ts",
|
|
35
|
+
"module": "./lib/index.mjs",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"import": "./lib/index.mjs",
|
|
39
|
+
"require": "./lib/index.js"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|