@graphql-codegen/schema-ast 2.5.2 → 2.6.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/cjs/index.js +5 -2
- package/esm/index.js +5 -2
- package/package.json +2 -2
package/cjs/index.js
CHANGED
|
@@ -18,8 +18,11 @@ const plugin = async (schema, _documents, { commentDescriptions = false, include
|
|
|
18
18
|
exports.plugin = plugin;
|
|
19
19
|
const validate = async (_schema, _documents, _config, outputFile, allPlugins) => {
|
|
20
20
|
const singlePlugin = allPlugins.length === 1;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const allowedExtensions = ['.graphql', '.gql'];
|
|
22
|
+
const isAllowedExtension = allowedExtensions.includes((0, path_1.extname)(outputFile));
|
|
23
|
+
if (singlePlugin && !isAllowedExtension) {
|
|
24
|
+
const allowedExtensionsOutput = allowedExtensions.map(extension => `"${extension}"`).join(' or ');
|
|
25
|
+
throw new Error(`Plugin "schema-ast" requires extension to be ${allowedExtensionsOutput}!`);
|
|
23
26
|
}
|
|
24
27
|
};
|
|
25
28
|
exports.validate = validate;
|
package/esm/index.js
CHANGED
|
@@ -14,8 +14,11 @@ export const plugin = async (schema, _documents, { commentDescriptions = false,
|
|
|
14
14
|
};
|
|
15
15
|
export const validate = async (_schema, _documents, _config, outputFile, allPlugins) => {
|
|
16
16
|
const singlePlugin = allPlugins.length === 1;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const allowedExtensions = ['.graphql', '.gql'];
|
|
18
|
+
const isAllowedExtension = allowedExtensions.includes(extname(outputFile));
|
|
19
|
+
if (singlePlugin && !isAllowedExtension) {
|
|
20
|
+
const allowedExtensionsOutput = allowedExtensions.map(extension => `"${extension}"`).join(' or ');
|
|
21
|
+
throw new Error(`Plugin "schema-ast" requires extension to be ${allowedExtensionsOutput}!`);
|
|
19
22
|
}
|
|
20
23
|
};
|
|
21
24
|
export function transformSchemaAST(schema, config) {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/schema-ast",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating a .graphql file from a given schema",
|
|
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": "^3.
|
|
9
|
+
"@graphql-codegen/plugin-helpers": "^3.1.1",
|
|
10
10
|
"@graphql-tools/utils": "^8.8.0",
|
|
11
11
|
"tslib": "~2.4.0"
|
|
12
12
|
},
|