swc-plugin-minify-graphql 0.4.0 → 0.5.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.
package/README.md CHANGED
@@ -4,16 +4,20 @@
4
4
 
5
5
  ## Compatibility
6
6
 
7
- Since WASM plugins are not backward compatible (see [swc-project/swc#5060][swc-wasm-compat-issue], [Selecting the version - SWC][selecting-swc-core]), use the table below to select the correct plugin version:
7
+ Since WASM plugins are not fully backward compatible (see [swc-project/swc#5060][swc-wasm-compat-issue], [Selecting the version - SWC][selecting-swc-core]), use the table below to select the correct plugin version:
8
8
 
9
9
  | plugin version | used `swc_core` version | potentially compatible `swc_core` versions\* |
10
10
  | -------------: | ----------------------: | :------------------------------------------- |
11
- | `0.4` | `46.0.3` | `>=46` |
11
+ | `0.5` | `55.0.2` | `>=47` |
12
+ | `0.4` | `46.0.3` | `>=46 <47` |
12
13
  | `0.3` | `43.0.1` | `>=40 <46` |
13
14
  | `0.2` | `10.6.1` | `>=10` |
14
15
  | `0.1` | `1.0.2` | `>=0.98.0 <10` |
15
16
 
16
- \* since this plugin uses a very small part of the API, the compatible version ranges are usually larger
17
+ \* since this plugin uses a very small part of the API, the compatible version ranges are sometimes larger
18
+
19
+ > [!NOTE]
20
+ > Version `0.5` and later use `swc_ast_unknown`, which should improve plugin compatibility (see this SWC's [blog post](https://blog.swc.rs/2025-11-4-wasm-backward-compatibility) and PR [swc-project/swc#11100](https://github.com/swc-project/swc/pull/11100) for more info)
17
21
 
18
22
  ## Usage
19
23
 
@@ -116,6 +120,28 @@ const FIELD = /* GraphQL */ `id some ${LONG} FieldName`;
116
120
  const FIELD = /* GraphQL */ `id some${LONG}FieldName`;
117
121
  ```
118
122
 
123
+ ```ts
124
+ const FORMAT = 'long';
125
+
126
+ const IMAGE = /* GraphQL */ `
127
+ id
128
+ url (format: "${FORMAT}")
129
+ `;
130
+
131
+ // will throw error like this:
132
+
133
+ // × failed to minify GraphQL
134
+ // ╭─[input.js:4:1]
135
+ // 3 │
136
+ // 4 │ ╭─▶ const IMAGE = /* GraphQL */ `
137
+ // 5 │ │ id
138
+ // 6 │ ╰─▶ url (format: "${FORMAT}")
139
+ // · ╰─── ┬
140
+ // · ╰─── ╰── unknown token at 112
141
+ // 7 │ `;
142
+ // ╰────
143
+ ```
144
+
119
145
  While the minified code may be correct in some cases, this usage is not intended and can be broken at any time.
120
146
 
121
147
  ### `gql` tag support <!-- spell-checker: ignore gql -->
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swc-plugin-minify-graphql",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "GraphQL query and schema minimizer plugin for SWC",
5
5
  "keywords": [
6
6
  "swc-plugin",