graphql-buddy 0.0.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.
Files changed (43) hide show
  1. package/.github/workflows/ci.yml +32 -0
  2. package/.nvmrc +1 -0
  3. package/.prettierignore +1 -0
  4. package/.prettierrc +7 -0
  5. package/LICENSE +21 -0
  6. package/README.md +89 -0
  7. package/dist/api.d.ts +46 -0
  8. package/dist/api.js +13 -0
  9. package/dist/api.js.map +1 -0
  10. package/dist/chunk-Z7B4AQ2U.js +124 -0
  11. package/dist/chunk-Z7B4AQ2U.js.map +1 -0
  12. package/dist/cli.d.ts +1 -0
  13. package/dist/cli.js +122 -0
  14. package/dist/cli.js.map +1 -0
  15. package/eslint.config.ts +168 -0
  16. package/package.json +69 -0
  17. package/pnpm-workspace.yaml +3 -0
  18. package/src/api/commands/bundle.test.ts +138 -0
  19. package/src/api/commands/bundle.ts +29 -0
  20. package/src/api/commands/index.ts +2 -0
  21. package/src/api/commands/validate.test.ts +35 -0
  22. package/src/api/commands/validate.ts +49 -0
  23. package/src/api/index.ts +2 -0
  24. package/src/api/shared/index.ts +1 -0
  25. package/src/api/shared/loadSchema.ts +88 -0
  26. package/src/cli/commands/bundle.ts +62 -0
  27. package/src/cli/commands/index.ts +2 -0
  28. package/src/cli/commands/validate.ts +59 -0
  29. package/src/cli/index.ts +52 -0
  30. package/src/cli/shared/index.ts +1 -0
  31. package/src/cli/shared/parsePathAliases.test.ts +43 -0
  32. package/src/cli/shared/parsePathAliases.ts +25 -0
  33. package/test_fixtures/missing_scalar/schema.graphql +16 -0
  34. package/test_fixtures/multiple_files/Bar.graphql +5 -0
  35. package/test_fixtures/multiple_files/Baz.graphql +5 -0
  36. package/test_fixtures/multiple_files/Foo.graphql +9 -0
  37. package/test_fixtures/multiple_files/Mutation.graphql +9 -0
  38. package/test_fixtures/multiple_files/Query.graphql +5 -0
  39. package/test_fixtures/single_file/schema.graphql +16 -0
  40. package/test_fixtures/single_file_with_extra_deps/schema.graphql +46 -0
  41. package/tsconfig.json +20 -0
  42. package/tsup.config.ts +14 -0
  43. package/vite.config.ts +14 -0
@@ -0,0 +1,5 @@
1
+ #import './Baz.graphql'
2
+
3
+ type Bar {
4
+ baz: Baz
5
+ }
@@ -0,0 +1,5 @@
1
+ type Baz {
2
+ dateCreated: DateTime!
3
+ }
4
+
5
+ scalar DateTime
@@ -0,0 +1,9 @@
1
+ #import './Bar.graphql'
2
+
3
+ type Foo {
4
+ id: ID!
5
+
6
+ name: String
7
+
8
+ bar: Bar
9
+ }
@@ -0,0 +1,9 @@
1
+ #import "./Foo.graphql"
2
+
3
+ type Mutation {
4
+ addFoo(foo: FooInput!): Foo!
5
+ }
6
+
7
+ input FooInput {
8
+ name: String
9
+ }
@@ -0,0 +1,5 @@
1
+ #import "./Foo.graphql"
2
+
3
+ type Query {
4
+ allFoo: [Foo!]!
5
+ }
@@ -0,0 +1,16 @@
1
+ type Query {
2
+ foo: Foo
3
+ bar: Bar
4
+ }
5
+
6
+ type Foo {
7
+ id: ID!
8
+
9
+ displayName: String
10
+ }
11
+
12
+ type Bar {
13
+ id: ID!
14
+
15
+ foo: Foo
16
+ }
@@ -0,0 +1,46 @@
1
+ type Query {
2
+ foo: Foo
3
+ }
4
+
5
+ type Mutation {
6
+ addFooToBar(displayName: String!): Bar
7
+ }
8
+
9
+ type Subscription {
10
+ foo: FooEvent
11
+ }
12
+
13
+ type Foo {
14
+ id: ID!
15
+
16
+ displayName: String
17
+ }
18
+
19
+ type Bar {
20
+ id: ID!
21
+
22
+ foo: Foo
23
+ }
24
+
25
+ type FooEvent {
26
+ foo: Foo!
27
+ }
28
+
29
+ # Baz is not referenced by the graph starting at Query/Mutation/Subscription
30
+ type Baz {
31
+ id: ID!
32
+
33
+ bar: Bar
34
+ qux: Qux
35
+ }
36
+
37
+ # Qux is not referenced by the graph starting at Query/Mutation/Subscription
38
+ type Qux {
39
+ id: ID!
40
+
41
+ dateCreated: DateTime!
42
+ }
43
+
44
+ # DateTIme is not referenced by the graph starting at
45
+ # Query/Mutation/Subscription
46
+ scalar DateTime
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": "src",
4
+ "outDir": "dist",
5
+ "declaration": true,
6
+ "esModuleInterop": true,
7
+ "experimentalDecorators": true,
8
+ "importHelpers": true,
9
+ "lib": ["es2015"],
10
+ "module": "esnext",
11
+ "moduleResolution": "node",
12
+ "skipDefaultLibCheck": true,
13
+ "skipLibCheck": true,
14
+ "sourceMap": true,
15
+ "strict": true,
16
+ "strictNullChecks": true,
17
+ "target": "es2015"
18
+ },
19
+ "include": ["./src/**/*.ts", "./*.ts"]
20
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,14 @@
1
+ import * as tsup from 'tsup';
2
+
3
+ export default tsup.defineConfig({
4
+ entry: {
5
+ api: `src/api/index.ts`,
6
+ cli: `src/cli/index.ts`,
7
+ },
8
+
9
+ format: `esm`,
10
+ clean: true,
11
+ dts: true,
12
+ platform: `node`,
13
+ sourcemap: true,
14
+ });
package/vite.config.ts ADDED
@@ -0,0 +1,14 @@
1
+ import * as vite from 'vitest/config';
2
+
3
+ export default vite.defineConfig({
4
+ test: {
5
+ server: {
6
+ deps: {
7
+ // Required for graphql compatability.
8
+ //
9
+ // See https://github.com/vitejs/vite/issues/7879
10
+ fallbackCJS: true,
11
+ },
12
+ },
13
+ },
14
+ });