# @graphitation/ts-transform-graphql-js-tag

> TS transform to convert all instances of "@graphitation/graphql-js-tag" or another graphql tag library to parsed document definitions.

Latest version **1.7.1** (published 2026-07-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @graphitation/ts-transform-graphql-js-tag
pnpm add @graphitation/ts-transform-graphql-js-tag
yarn add @graphitation/ts-transform-graphql-js-tag
bun add @graphitation/ts-transform-graphql-js-tag
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.7.1 |
| Published | 2026-07-14 |
| First published | 2021-10-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 134 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 152 |
| Maintainers | alloy, kenotron_msft, gql-svc, freiksenet, kerrynf, microsoft-oss-releases, celia_account, pavelglac_microsoft, microsoft1es, vrazuvaevms |

## Links

- npm: https://www.npmjs.com/package/@graphitation/ts-transform-graphql-js-tag
- Repository: https://github.com/microsoft/graphitation
- Homepage: https://github.com/microsoft/graphitation#readme
- Issues: https://github.com/microsoft/graphitation/issues
- npm.io page: https://npm.io/package/@graphitation/ts-transform-graphql-js-tag

## Recent versions

- 1.7.1 (latest) — 2026-07-14
- 1.7.1-canary.1 (canary) — 2026-07-02
- 1.1.1 (next) — 2023-09-21
- 0.3.0 (mjs-beta) — 2021-12-14
- 1.7.0 — 2026-07-09
- 1.7.1-canary.0 — 2026-07-02
- 1.6.2-canary.1 — 2026-06-22
- 1.6.2-canary.0 — 2026-06-19
- 1.6.0 — 2025-07-15
- 1.5.0 — 2025-04-02
- 1.4.4 — 2024-10-23
- 1.4.3 — 2024-10-17
- 1.4.2 — 2024-10-17
- 1.4.1 — 2024-10-14
- 1.4.0 — 2024-09-24
- … 12 more at https://npm.io/package/@graphitation/ts-transform-graphql-js-tag/versions

## README

# ts-transform-graphql-js-tag

TS transform to convert all instances of "@graphitation/graphql-js-tag" or another graphql tag library to parsed document definitions.

This is inspired by [ts-transform-graphql-tag](https://github.com/firede/ts-transform-graphql-tag) library, but modified
to fit our use case better and support transformers.

It differs from many transformers in that it doesn't use underlying tag library at all. Instead it uses graphql-js to parse
definitions and output documents.

## Usage

### with `ts-loader`

In the webpack.config.js file in the section where ts-loader is configured as a loader:

```js
// 1. import `getTransformer` from the module
import { getTransformer } = from "@graphitation/ts-transform-graphql-js-tag"

// 2. create a transformer and add getCustomTransformer method to the loader config
var config = {
  // ...
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        loader: "ts-loader",
        options: {
          // ... other loader's options
          getCustomTransformers: () => ({ before: [getTransformer({})] }),
        },
      },
    ],
  },
  // ...
};
```

### Options

- `graphqlTagModule?: string;` - which graphql tag module you are using. Default: `@graphitation/ts-transform-graphql-js-tag`
- `graphqlTagModuleExport?: "default" | string;` - what export from that module is graphql template tag. Default: `gql`.
- `transformer?: (node: FragmentDefinitionNode | OperationDefinitionNode) => unknown` - optional transformer to apply to graphql definitions before
  emitting them. Note that result should be emittable by TypeScript, so it should be a plain object.
- `noEmptyNodes?: boolean;` - when enabled, omit `null`/`undefined` GraphQL AST node properties and empty array GraphQL AST node properties from the
  emitted document. Default: `false`.

---
_Source: https://npm.io/package/@graphitation/ts-transform-graphql-js-tag · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
