@baeta/plugin-graphql 0.0.18 → 0.0.19
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 +9 -0
- package/dist/index.cjs +15 -19
- package/dist/index.js +14 -18
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @baeta/plugin-graphql
|
|
2
2
|
|
|
3
|
+
## 0.0.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#40](https://github.com/andreisergiu98/baeta/pull/40) [`9f937f4`](https://github.com/andreisergiu98/baeta/commit/9f937f47d3464a082680047414ee13a76cf6c056) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - normalize config
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`9f937f4`](https://github.com/andreisergiu98/baeta/commit/9f937f47d3464a082680047414ee13a76cf6c056), [`9f937f4`](https://github.com/andreisergiu98/baeta/commit/9f937f47d3464a082680047414ee13a76cf6c056)]:
|
|
10
|
+
- @baeta/generator-sdk@0.0.5
|
|
11
|
+
|
|
3
12
|
## 0.0.18
|
|
4
13
|
|
|
5
14
|
### 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');
|
|
@@ -297,18 +296,18 @@ function extractModuleDirectory(filepath, basePath) {
|
|
|
297
296
|
const [moduleDirectory] = relativePath.split(sep);
|
|
298
297
|
return moduleDirectory;
|
|
299
298
|
}
|
|
300
|
-
function stripFilename(
|
|
301
|
-
const parsedPath = _parsefilepath2.default.call(void 0,
|
|
299
|
+
function stripFilename(path) {
|
|
300
|
+
const parsedPath = _parsefilepath2.default.call(void 0, path);
|
|
302
301
|
return normalize(parsedPath.dir);
|
|
303
302
|
}
|
|
304
|
-
function normalize(
|
|
305
|
-
return
|
|
303
|
+
function normalize(path) {
|
|
304
|
+
return path.replace(/\\/g, "/");
|
|
306
305
|
}
|
|
307
|
-
function ensureEndsWithSeparator(
|
|
308
|
-
return
|
|
306
|
+
function ensureEndsWithSeparator(path) {
|
|
307
|
+
return path.endsWith(sep) ? path : path + sep;
|
|
309
308
|
}
|
|
310
|
-
function ensureStartsWithSeparator(
|
|
311
|
-
return
|
|
309
|
+
function ensureStartsWithSeparator(path) {
|
|
310
|
+
return path.startsWith(".") ? path.replace(/^(..\/)|(.\/)/, "/") : path.startsWith("/") ? path : `/${path}`;
|
|
312
311
|
}
|
|
313
312
|
function pushUnique(list, item) {
|
|
314
313
|
if (!list.includes(item)) {
|
|
@@ -806,15 +805,12 @@ var preset = {
|
|
|
806
805
|
|
|
807
806
|
// lib/codegen.ts
|
|
808
807
|
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
808
|
const rootConfig = {
|
|
813
809
|
schemas: _pluginhelpers.normalizeInstanceOrArray.call(void 0, options.schemas),
|
|
814
|
-
modulesDir,
|
|
815
|
-
baseTypesPath:
|
|
810
|
+
modulesDir: options.modulesDir,
|
|
811
|
+
baseTypesPath: options.baseTypesPath,
|
|
816
812
|
contextType: options.contextType,
|
|
817
|
-
moduleDefinitionName: options.moduleDefinitionName
|
|
813
|
+
moduleDefinitionName: options.moduleDefinitionName,
|
|
818
814
|
scalars: options.scalars,
|
|
819
815
|
plugins: _pluginhelpers.normalizeConfig.call(void 0, ["typescript", "context"]),
|
|
820
816
|
pluginMap: {
|
|
@@ -833,15 +829,15 @@ async function generate(options) {
|
|
|
833
829
|
}
|
|
834
830
|
const hash = JSON.stringify(schemaPointerMap);
|
|
835
831
|
const result = await cache("schema", hash, async () => {
|
|
836
|
-
return loadSchema(schemaPointerMap,
|
|
832
|
+
return loadSchema(schemaPointerMap, options.cwd);
|
|
837
833
|
});
|
|
838
834
|
const outputs = await preset.buildGeneratesSection({
|
|
839
|
-
baseOutputDir: modulesDir,
|
|
835
|
+
baseOutputDir: options.modulesDir,
|
|
840
836
|
presetConfig: {
|
|
841
837
|
baseTypesPath: rootConfig.baseTypesPath,
|
|
842
838
|
filename: rootConfig.moduleDefinitionName,
|
|
843
839
|
encapsulateModuleTypes: "none",
|
|
844
|
-
extensionsPath
|
|
840
|
+
extensionsPath: options.extensions
|
|
845
841
|
},
|
|
846
842
|
schema: result.outputSchema,
|
|
847
843
|
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() {
|
|
@@ -297,18 +296,18 @@ function extractModuleDirectory(filepath, basePath) {
|
|
|
297
296
|
const [moduleDirectory] = relativePath.split(sep);
|
|
298
297
|
return moduleDirectory;
|
|
299
298
|
}
|
|
300
|
-
function stripFilename(
|
|
301
|
-
const parsedPath = parse(
|
|
299
|
+
function stripFilename(path) {
|
|
300
|
+
const parsedPath = parse(path);
|
|
302
301
|
return normalize(parsedPath.dir);
|
|
303
302
|
}
|
|
304
|
-
function normalize(
|
|
305
|
-
return
|
|
303
|
+
function normalize(path) {
|
|
304
|
+
return path.replace(/\\/g, "/");
|
|
306
305
|
}
|
|
307
|
-
function ensureEndsWithSeparator(
|
|
308
|
-
return
|
|
306
|
+
function ensureEndsWithSeparator(path) {
|
|
307
|
+
return path.endsWith(sep) ? path : path + sep;
|
|
309
308
|
}
|
|
310
|
-
function ensureStartsWithSeparator(
|
|
311
|
-
return
|
|
309
|
+
function ensureStartsWithSeparator(path) {
|
|
310
|
+
return path.startsWith(".") ? path.replace(/^(..\/)|(.\/)/, "/") : path.startsWith("/") ? path : `/${path}`;
|
|
312
311
|
}
|
|
313
312
|
function pushUnique(list, item) {
|
|
314
313
|
if (!list.includes(item)) {
|
|
@@ -806,15 +805,12 @@ var preset = {
|
|
|
806
805
|
|
|
807
806
|
// lib/codegen.ts
|
|
808
807
|
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
808
|
const rootConfig = {
|
|
813
809
|
schemas: normalizeInstanceOrArray(options.schemas),
|
|
814
|
-
modulesDir,
|
|
815
|
-
baseTypesPath:
|
|
810
|
+
modulesDir: options.modulesDir,
|
|
811
|
+
baseTypesPath: options.baseTypesPath,
|
|
816
812
|
contextType: options.contextType,
|
|
817
|
-
moduleDefinitionName: options.moduleDefinitionName
|
|
813
|
+
moduleDefinitionName: options.moduleDefinitionName,
|
|
818
814
|
scalars: options.scalars,
|
|
819
815
|
plugins: normalizeConfig(["typescript", "context"]),
|
|
820
816
|
pluginMap: {
|
|
@@ -833,15 +829,15 @@ async function generate(options) {
|
|
|
833
829
|
}
|
|
834
830
|
const hash = JSON.stringify(schemaPointerMap);
|
|
835
831
|
const result = await cache("schema", hash, async () => {
|
|
836
|
-
return loadSchema(schemaPointerMap,
|
|
832
|
+
return loadSchema(schemaPointerMap, options.cwd);
|
|
837
833
|
});
|
|
838
834
|
const outputs = await preset.buildGeneratesSection({
|
|
839
|
-
baseOutputDir: modulesDir,
|
|
835
|
+
baseOutputDir: options.modulesDir,
|
|
840
836
|
presetConfig: {
|
|
841
837
|
baseTypesPath: rootConfig.baseTypesPath,
|
|
842
838
|
filename: rootConfig.moduleDefinitionName,
|
|
843
839
|
encapsulateModuleTypes: "none",
|
|
844
|
-
extensionsPath
|
|
840
|
+
extensionsPath: options.extensions
|
|
845
841
|
},
|
|
846
842
|
schema: result.outputSchema,
|
|
847
843
|
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.19",
|
|
4
4
|
"homepage": "https://github.com/andreisergiu98/baeta#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/andreisergiu98/baeta/issues"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"types": "tsc --noEmit"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@baeta/generator-sdk": "^0.0.
|
|
27
|
+
"@baeta/generator-sdk": "^0.0.5",
|
|
28
28
|
"@graphql-codegen/core": "^2.6.8",
|
|
29
29
|
"@graphql-codegen/plugin-helpers": "^3.1.2",
|
|
30
30
|
"@graphql-codegen/typescript": "^2.8.7",
|