@baeta/plugin-graphql 0.0.18 → 0.0.20
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 -0
- package/dist/index.cjs +17 -20
- package/dist/index.js +16 -19
- package/package.json +20 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @baeta/plugin-graphql
|
|
2
2
|
|
|
3
|
+
## 0.0.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#47](https://github.com/andreisergiu98/baeta/pull/47) [`eb7096d`](https://github.com/andreisergiu98/baeta/commit/eb7096d42a53b17bae0a8365eccb795e7ded02e9) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
|
|
8
|
+
|
|
9
|
+
- [#43](https://github.com/andreisergiu98/baeta/pull/43) [`670501b`](https://github.com/andreisergiu98/baeta/commit/670501b2b1cfb1126be3421293b8ccd597c6ffc2) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - bump dependencies
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`eb7096d`](https://github.com/andreisergiu98/baeta/commit/eb7096d42a53b17bae0a8365eccb795e7ded02e9), [`670501b`](https://github.com/andreisergiu98/baeta/commit/670501b2b1cfb1126be3421293b8ccd597c6ffc2)]:
|
|
12
|
+
- @baeta/generator-sdk@0.0.6
|
|
13
|
+
|
|
14
|
+
## 0.0.19
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#40](https://github.com/andreisergiu98/baeta/pull/40) [`9f937f4`](https://github.com/andreisergiu98/baeta/commit/9f937f47d3464a082680047414ee13a76cf6c056) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - normalize config
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`9f937f4`](https://github.com/andreisergiu98/baeta/commit/9f937f47d3464a082680047414ee13a76cf6c056), [`9f937f4`](https://github.com/andreisergiu98/baeta/commit/9f937f47d3464a082680047414ee13a76cf6c056)]:
|
|
21
|
+
- @baeta/generator-sdk@0.0.5
|
|
22
|
+
|
|
3
23
|
## 0.0.18
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -12,7 +12,6 @@ var _generatorsdk = require('@baeta/generator-sdk');
|
|
|
12
12
|
var _core = require('@graphql-codegen/core');
|
|
13
13
|
var _pluginhelpers = require('@graphql-codegen/plugin-helpers');
|
|
14
14
|
var _typescript = require('@graphql-codegen/typescript'); var typescriptPlugin = _interopRequireWildcard(_typescript);
|
|
15
|
-
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
16
15
|
|
|
17
16
|
// utils/cache.ts
|
|
18
17
|
function createCache() {
|
|
@@ -117,7 +116,7 @@ var context_default = { plugin };
|
|
|
117
116
|
// lib/modules/index.ts
|
|
118
117
|
|
|
119
118
|
|
|
120
|
-
|
|
119
|
+
var _path = require('path');
|
|
121
120
|
|
|
122
121
|
// lib/modules/builder.ts
|
|
123
122
|
var _changecaseall = require('change-case-all');
|
|
@@ -181,7 +180,8 @@ function collectUsedTypes(doc) {
|
|
|
181
180
|
if (node.arguments) {
|
|
182
181
|
node.arguments.forEach(findRelated);
|
|
183
182
|
}
|
|
184
|
-
} else if (node.kind === _graphql.Kind.NAMED_TYPE &&
|
|
183
|
+
} else if (node.kind === _graphql.Kind.NAMED_TYPE && // Named type
|
|
184
|
+
!isGraphQLPrimitive(node.name.value)) {
|
|
185
185
|
markAsUsed(node.name.value);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
@@ -297,18 +297,18 @@ function extractModuleDirectory(filepath, basePath) {
|
|
|
297
297
|
const [moduleDirectory] = relativePath.split(sep);
|
|
298
298
|
return moduleDirectory;
|
|
299
299
|
}
|
|
300
|
-
function stripFilename(
|
|
301
|
-
const parsedPath = _parsefilepath2.default.call(void 0,
|
|
300
|
+
function stripFilename(path) {
|
|
301
|
+
const parsedPath = _parsefilepath2.default.call(void 0, path);
|
|
302
302
|
return normalize(parsedPath.dir);
|
|
303
303
|
}
|
|
304
|
-
function normalize(
|
|
305
|
-
return
|
|
304
|
+
function normalize(path) {
|
|
305
|
+
return path.replace(/\\/g, "/");
|
|
306
306
|
}
|
|
307
|
-
function ensureEndsWithSeparator(
|
|
308
|
-
return
|
|
307
|
+
function ensureEndsWithSeparator(path) {
|
|
308
|
+
return path.endsWith(sep) ? path : path + sep;
|
|
309
309
|
}
|
|
310
|
-
function ensureStartsWithSeparator(
|
|
311
|
-
return
|
|
310
|
+
function ensureStartsWithSeparator(path) {
|
|
311
|
+
return path.startsWith(".") ? path.replace(/^(..\/)|(.\/)/, "/") : path.startsWith("/") ? path : `/${path}`;
|
|
312
312
|
}
|
|
313
313
|
function pushUnique(list, item) {
|
|
314
314
|
if (!list.includes(item)) {
|
|
@@ -806,15 +806,12 @@ var preset = {
|
|
|
806
806
|
|
|
807
807
|
// lib/codegen.ts
|
|
808
808
|
async function generate(options) {
|
|
809
|
-
const root = process.cwd();
|
|
810
|
-
const modulesDir = _path2.default.relative(root, options.modulesDir || "modules");
|
|
811
|
-
const extensionsPath = options.extensions && _path2.default.relative(_path2.default.join(modulesDir, "module"), options.extensions);
|
|
812
809
|
const rootConfig = {
|
|
813
810
|
schemas: _pluginhelpers.normalizeInstanceOrArray.call(void 0, options.schemas),
|
|
814
|
-
modulesDir,
|
|
815
|
-
baseTypesPath:
|
|
811
|
+
modulesDir: options.modulesDir,
|
|
812
|
+
baseTypesPath: options.baseTypesPath,
|
|
816
813
|
contextType: options.contextType,
|
|
817
|
-
moduleDefinitionName: options.moduleDefinitionName
|
|
814
|
+
moduleDefinitionName: options.moduleDefinitionName,
|
|
818
815
|
scalars: options.scalars,
|
|
819
816
|
plugins: _pluginhelpers.normalizeConfig.call(void 0, ["typescript", "context"]),
|
|
820
817
|
pluginMap: {
|
|
@@ -833,15 +830,15 @@ async function generate(options) {
|
|
|
833
830
|
}
|
|
834
831
|
const hash = JSON.stringify(schemaPointerMap);
|
|
835
832
|
const result = await cache("schema", hash, async () => {
|
|
836
|
-
return loadSchema(schemaPointerMap,
|
|
833
|
+
return loadSchema(schemaPointerMap, options.cwd);
|
|
837
834
|
});
|
|
838
835
|
const outputs = await preset.buildGeneratesSection({
|
|
839
|
-
baseOutputDir: modulesDir,
|
|
836
|
+
baseOutputDir: options.modulesDir,
|
|
840
837
|
presetConfig: {
|
|
841
838
|
baseTypesPath: rootConfig.baseTypesPath,
|
|
842
839
|
filename: rootConfig.moduleDefinitionName,
|
|
843
840
|
encapsulateModuleTypes: "none",
|
|
844
|
-
extensionsPath
|
|
841
|
+
extensionsPath: options.extensions
|
|
845
842
|
},
|
|
846
843
|
schema: result.outputSchema,
|
|
847
844
|
schemaAst: result.outputSchemaAst,
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,6 @@ import { File } from "@baeta/generator-sdk";
|
|
|
12
12
|
import { codegen as gqlCodegen } from "@graphql-codegen/core";
|
|
13
13
|
import { normalizeConfig, normalizeInstanceOrArray } from "@graphql-codegen/plugin-helpers";
|
|
14
14
|
import * as typescriptPlugin from "@graphql-codegen/typescript";
|
|
15
|
-
import path from "path";
|
|
16
15
|
|
|
17
16
|
// utils/cache.ts
|
|
18
17
|
function createCache() {
|
|
@@ -181,7 +180,8 @@ function collectUsedTypes(doc) {
|
|
|
181
180
|
if (node.arguments) {
|
|
182
181
|
node.arguments.forEach(findRelated);
|
|
183
182
|
}
|
|
184
|
-
} else if (node.kind === Kind.NAMED_TYPE &&
|
|
183
|
+
} else if (node.kind === Kind.NAMED_TYPE && // Named type
|
|
184
|
+
!isGraphQLPrimitive(node.name.value)) {
|
|
185
185
|
markAsUsed(node.name.value);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
@@ -297,18 +297,18 @@ function extractModuleDirectory(filepath, basePath) {
|
|
|
297
297
|
const [moduleDirectory] = relativePath.split(sep);
|
|
298
298
|
return moduleDirectory;
|
|
299
299
|
}
|
|
300
|
-
function stripFilename(
|
|
301
|
-
const parsedPath = parse(
|
|
300
|
+
function stripFilename(path) {
|
|
301
|
+
const parsedPath = parse(path);
|
|
302
302
|
return normalize(parsedPath.dir);
|
|
303
303
|
}
|
|
304
|
-
function normalize(
|
|
305
|
-
return
|
|
304
|
+
function normalize(path) {
|
|
305
|
+
return path.replace(/\\/g, "/");
|
|
306
306
|
}
|
|
307
|
-
function ensureEndsWithSeparator(
|
|
308
|
-
return
|
|
307
|
+
function ensureEndsWithSeparator(path) {
|
|
308
|
+
return path.endsWith(sep) ? path : path + sep;
|
|
309
309
|
}
|
|
310
|
-
function ensureStartsWithSeparator(
|
|
311
|
-
return
|
|
310
|
+
function ensureStartsWithSeparator(path) {
|
|
311
|
+
return path.startsWith(".") ? path.replace(/^(..\/)|(.\/)/, "/") : path.startsWith("/") ? path : `/${path}`;
|
|
312
312
|
}
|
|
313
313
|
function pushUnique(list, item) {
|
|
314
314
|
if (!list.includes(item)) {
|
|
@@ -806,15 +806,12 @@ var preset = {
|
|
|
806
806
|
|
|
807
807
|
// lib/codegen.ts
|
|
808
808
|
async function generate(options) {
|
|
809
|
-
const root = process.cwd();
|
|
810
|
-
const modulesDir = path.relative(root, options.modulesDir || "modules");
|
|
811
|
-
const extensionsPath = options.extensions && path.relative(path.join(modulesDir, "module"), options.extensions);
|
|
812
809
|
const rootConfig = {
|
|
813
810
|
schemas: normalizeInstanceOrArray(options.schemas),
|
|
814
|
-
modulesDir,
|
|
815
|
-
baseTypesPath:
|
|
811
|
+
modulesDir: options.modulesDir,
|
|
812
|
+
baseTypesPath: options.baseTypesPath,
|
|
816
813
|
contextType: options.contextType,
|
|
817
|
-
moduleDefinitionName: options.moduleDefinitionName
|
|
814
|
+
moduleDefinitionName: options.moduleDefinitionName,
|
|
818
815
|
scalars: options.scalars,
|
|
819
816
|
plugins: normalizeConfig(["typescript", "context"]),
|
|
820
817
|
pluginMap: {
|
|
@@ -833,15 +830,15 @@ async function generate(options) {
|
|
|
833
830
|
}
|
|
834
831
|
const hash = JSON.stringify(schemaPointerMap);
|
|
835
832
|
const result = await cache("schema", hash, async () => {
|
|
836
|
-
return loadSchema(schemaPointerMap,
|
|
833
|
+
return loadSchema(schemaPointerMap, options.cwd);
|
|
837
834
|
});
|
|
838
835
|
const outputs = await preset.buildGeneratesSection({
|
|
839
|
-
baseOutputDir: modulesDir,
|
|
836
|
+
baseOutputDir: options.modulesDir,
|
|
840
837
|
presetConfig: {
|
|
841
838
|
baseTypesPath: rootConfig.baseTypesPath,
|
|
842
839
|
filename: rootConfig.moduleDefinitionName,
|
|
843
840
|
encapsulateModuleTypes: "none",
|
|
844
|
-
extensionsPath
|
|
841
|
+
extensionsPath: options.extensions
|
|
845
842
|
},
|
|
846
843
|
schema: result.outputSchema,
|
|
847
844
|
schemaAst: result.outputSchemaAst,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baeta/plugin-graphql",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"homepage": "https://github.com/andreisergiu98/baeta#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/andreisergiu98/baeta/issues"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "https://github.com/andreisergiu98/baeta.git",
|
|
11
|
-
"directory": "
|
|
11
|
+
"directory": "packages/plugin-graphql"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"author": "Andrei Pampu <pampu.andrei@pm.me>",
|
|
@@ -24,32 +24,32 @@
|
|
|
24
24
|
"types": "tsc --noEmit"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@baeta/generator-sdk": "^0.0.
|
|
28
|
-
"@graphql-codegen/core": "^
|
|
29
|
-
"@graphql-codegen/plugin-helpers": "^
|
|
30
|
-
"@graphql-codegen/typescript": "^
|
|
31
|
-
"@graphql-codegen/visitor-plugin-common": "
|
|
32
|
-
"@graphql-tools/apollo-engine-loader": "^7.3.
|
|
33
|
-
"@graphql-tools/code-file-loader": "^7.3.
|
|
34
|
-
"@graphql-tools/git-loader": "^7.2.
|
|
35
|
-
"@graphql-tools/github-loader": "^7.3.
|
|
36
|
-
"@graphql-tools/graphql-file-loader": "^7.5.
|
|
37
|
-
"@graphql-tools/json-file-loader": "^7.4.
|
|
38
|
-
"@graphql-tools/load": "^7.8.
|
|
39
|
-
"@graphql-tools/prisma-loader": "^7.2.
|
|
40
|
-
"@graphql-tools/url-loader": "^7.17.
|
|
41
|
-
"@graphql-tools/utils": "^9.1
|
|
27
|
+
"@baeta/generator-sdk": "^0.0.6",
|
|
28
|
+
"@graphql-codegen/core": "^3.1.0",
|
|
29
|
+
"@graphql-codegen/plugin-helpers": "^4.2.0",
|
|
30
|
+
"@graphql-codegen/typescript": "^3.0.3",
|
|
31
|
+
"@graphql-codegen/visitor-plugin-common": "3.1.0",
|
|
32
|
+
"@graphql-tools/apollo-engine-loader": "^7.3.26",
|
|
33
|
+
"@graphql-tools/code-file-loader": "^7.3.21",
|
|
34
|
+
"@graphql-tools/git-loader": "^7.2.20",
|
|
35
|
+
"@graphql-tools/github-loader": "^7.3.27",
|
|
36
|
+
"@graphql-tools/graphql-file-loader": "^7.5.16",
|
|
37
|
+
"@graphql-tools/json-file-loader": "^7.4.17",
|
|
38
|
+
"@graphql-tools/load": "^7.8.13",
|
|
39
|
+
"@graphql-tools/prisma-loader": "^7.2.66",
|
|
40
|
+
"@graphql-tools/url-loader": "^7.17.14",
|
|
41
|
+
"@graphql-tools/utils": "^9.2.1",
|
|
42
42
|
"auto-bind": "^5.0.1",
|
|
43
43
|
"change-case-all": "1.0.15",
|
|
44
44
|
"parse-filepath": "^1.0.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@baeta/
|
|
47
|
+
"@baeta/builder": "^0.0.0",
|
|
48
48
|
"@baeta/tsconfig": "^0.0.0",
|
|
49
|
-
"@types/node": "^18.11
|
|
49
|
+
"@types/node": "^18.15.11",
|
|
50
50
|
"@types/parse-filepath": "1.0.0",
|
|
51
51
|
"graphql": "^16.6.0",
|
|
52
|
-
"typescript": "^4.9.
|
|
52
|
+
"typescript": "^4.9.5"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"graphql": "^16.6.0"
|