# parcel-transformer-graphql

> A Parcel transformer which allows importing GraphQL schema files.

Latest version **0.0.1** (published 2021-11-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install parcel-transformer-graphql
pnpm add parcel-transformer-graphql
yarn add parcel-transformer-graphql
bun add parcel-transformer-graphql
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2021-11-23 |
| First published | 2021-11-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^16.0.0 |
| Dependencies | 1 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Amadeus Beckmann |
| Maintainers | llamadeus |
| Keywords | parcel, transformer, graphql |

## Links

- npm: https://www.npmjs.com/package/parcel-transformer-graphql
- npm.io page: https://npm.io/package/parcel-transformer-graphql

## Dependencies (1)

- [@parcel/plugin](https://npm.io/package/@parcel/plugin.md) ^2.0.1

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2021-11-23

## README

# parcel-transformer-graphql

A Parcel transformer which allows importing GraphQL schema files. This transformer will automatically wrap the GraphQL Schema with `gql` from `graphql-tag`.

## Installation

Install the plugin via yarn.
```shell
yarn add --dev parcel-transformer-graphql
```

Alternatively, install it with npm.
```shell
npm install --save-dev parcel-transformer-graphql
```

## Usage

Create a `.parcelrc` file in your project root.
```shell
touch .parcelrc
```

Paste the following content.
```json5
{
  "extends": "@parcel/config-default",
  "transformers": {
    "*.graphql": ["parcel-transformer-graphql"]
  }
}
```

Write your GraphQL schema.
```graphql
# schema.graphql
type Query {
  ping: String!
}

type Mutation {
  noop: Boolean!
}
```

Import the schema in your code
```typescript
import typeDefs from './schema.graphql';

// ...
```

## Typescript declarations

In order for Typescript to understand the content of an imported GraphQL file, create a `types.d.ts` file in your project with the following declarations.
```typescript
declare module '*.graphql' {
  import { DocumentNode } from 'graphql';
  const Schema: DocumentNode;

  export = Schema
}
```

---
_Source: https://npm.io/package/parcel-transformer-graphql · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
