sanity-plugin-pte-interpolation 1.4.0 → 1.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
@@ -16,11 +16,13 @@ npm install sanity-plugin-pte-interpolation
16
16
 
17
17
  ### Peer dependencies
18
18
 
19
- - `sanity ^3.0.0 || ^4.0.0 || ^5.0.0`
19
+ - `sanity ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0`
20
20
  - `react ^18.0.0 || ^19.0.0`
21
21
  - `@sanity/ui ^2.0.0 || ^3.0.0`
22
22
  - `@sanity/icons ^3.0.0`
23
23
 
24
+ When using `sanity ^6`, follow Sanity's runtime requirements (including Node.js `>=22.12.0`).
25
+
24
26
  ## Usage
25
27
 
26
28
  Call `interpolationVariables()` inside the `of` array of a Portable Text field. It returns a `block` array member augmented with the `pteInterpolationVariable` inline type.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanity-plugin-pte-interpolation",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Sanity Studio plugin for interpolating values into Portable Text Editor fields",
@@ -43,7 +43,7 @@
43
43
  "@sanity/icons": "^3.0.0",
44
44
  "@sanity/ui": "^2.0.0 || ^3.0.0",
45
45
  "react": "^18.0.0 || ^19.0.0",
46
- "sanity": "^3.0.0 || ^4.0.0 || ^5.0.0"
46
+ "sanity": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@sanity/icons": "^3.7.4",
@@ -11,6 +11,11 @@ import {
11
11
  } from '../components/VariableInlineBlock'
12
12
  import type {InterpolationVariable} from '../types'
13
13
 
14
+ vi.mock('sanity', () => ({
15
+ set: (value: string) => ({type: 'set', value}),
16
+ unset: () => ({type: 'unset'}),
17
+ }))
18
+
14
19
  // jsdom does not implement window.matchMedia, which @sanity/ui components depend on
15
20
  Object.defineProperty(window, 'matchMedia', {
16
21
  writable: true,
@@ -1,7 +1,12 @@
1
1
  import {defineArrayMember} from 'sanity'
2
- import {describe, expect, it} from 'vitest'
2
+ import {describe, expect, it, vi} from 'vitest'
3
3
  import {interpolationVariables, VARIABLE_TYPE_PREFIX} from '../interpolationVariables'
4
4
 
5
+ vi.mock('sanity', () => ({
6
+ defineArrayMember: <Definition>(definition: Definition) => definition,
7
+ defineField: <Definition>(definition: Definition) => definition,
8
+ }))
9
+
5
10
  const testVariables = [
6
11
  {id: 'firstName', name: 'First name', description: 'First name of the recipient'},
7
12
  {id: 'email', name: 'Email address'},