Skip to content

Commit e79ff3c

Browse files
authored
chore(deps): upgrade dependencies (#92)
* chore(deps): upgrade dependencies * chore: format with prettier v3
1 parent 2ba3bf2 commit e79ff3c

11 files changed

+4805
-5951
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#
247247
on how to run this plugin with hotreload in the studio.
248248

249249
### UI Workshop
250+
250251
Run
251252
`workshop dev`
252253

jest.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@ module.exports = {
55
testEnvironment: 'node',
66
testPathIgnorePatterns: ['.yalc', 'node_modules', '.idea', 'lib', '.parcel-cache'],
77
globals: {
8-
'ts-jest': {
9-
babelConfig: true,
10-
},
118
crypto: {
129
getRandomValues: (arr) => crypto.randomBytes(arr.length),
1310
},
1411
},
1512
transform: {
16-
'^.+\\.(ts|tsx)?$': 'ts-jest',
13+
'^.+\\.(ts|tsx)?$': ['ts-jest', {babelConfig: true}],
1714
'^.+\\.(mjs|js|jsx)$': 'babel-jest',
1815
},
1916
transformIgnorePatterns: ['node_modules/(?!(nanoid|uuid|get-random-values-esm))'],

package-lock.json

Lines changed: 4660 additions & 5803 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -57,70 +57,70 @@
5757
"watch": "pkg-utils watch --strict"
5858
},
5959
"dependencies": {
60-
"@codemirror/autocomplete": "^6.1.0",
61-
"@codemirror/commands": "^6.0.1",
62-
"@codemirror/lang-html": "^6.4.0",
60+
"@codemirror/autocomplete": "^6.11.1",
61+
"@codemirror/commands": "^6.3.2",
62+
"@codemirror/lang-html": "^6.4.7",
6363
"@codemirror/lang-java": "^6.0.1",
64-
"@codemirror/lang-javascript": "^6.1.2",
64+
"@codemirror/lang-javascript": "^6.2.1",
6565
"@codemirror/lang-json": "^6.0.1",
66-
"@codemirror/lang-markdown": "^6.0.5",
66+
"@codemirror/lang-markdown": "^6.2.3",
6767
"@codemirror/lang-php": "^6.0.1",
68-
"@codemirror/lang-sql": "^6.3.3",
69-
"@codemirror/language": "^6.2.1",
70-
"@codemirror/legacy-modes": "^6.3.1",
71-
"@codemirror/search": "^6.0.1",
72-
"@codemirror/state": "^6.1.0",
73-
"@codemirror/view": "^6.1.1",
68+
"@codemirror/lang-sql": "^6.5.4",
69+
"@codemirror/language": "^6.9.3",
70+
"@codemirror/legacy-modes": "^6.3.3",
71+
"@codemirror/search": "^6.5.5",
72+
"@codemirror/state": "^6.3.2",
73+
"@codemirror/view": "^6.22.1",
7474
"@juggle/resize-observer": "^3.3.1",
75-
"@lezer/highlight": "^1.0.0",
75+
"@lezer/highlight": "^1.2.0",
7676
"@sanity/icons": "^2.0.0",
7777
"@sanity/incompatible-plugin": "^1.0.4",
7878
"@sanity/ui": "^1.0.0",
79-
"@uiw/codemirror-themes": "^4.19.4",
80-
"@uiw/react-codemirror": "^4.19.4"
79+
"@uiw/codemirror-themes": "^4.21.21",
80+
"@uiw/react-codemirror": "^4.21.21"
8181
},
8282
"devDependencies": {
8383
"@babel/core": "^7.20.12",
8484
"@babel/preset-env": "^7.18.10",
85-
"@babel/preset-react": "^7.18.6",
85+
"@babel/preset-react": "^7.23.3",
8686
"@commitlint/cli": "^17.2.0",
8787
"@commitlint/config-conventional": "^17.2.0",
8888
"@sanity/icons": "^2.2.2",
89-
"@sanity/pkg-utils": "^2.1.1",
89+
"@sanity/pkg-utils": "^3.3.0",
9090
"@sanity/plugin-kit": "^3.1.2",
91-
"@sanity/semantic-release-preset": "^4.0.0",
91+
"@sanity/semantic-release-preset": "^4.1.6",
9292
"@sanity/ui-workshop": "^1.2.0",
9393
"@sanity/ui-workshop-plugin-sanity": "^1.0.0",
94-
"@testing-library/jest-dom": "^5.16.5",
95-
"@testing-library/react": "^14.0.0",
96-
"@types/jest": "^29.1.2",
97-
"@types/react": "^18.0.26",
98-
"@types/styled-components": "^5.1.25",
99-
"@typescript-eslint/eslint-plugin": "^5.48.0",
100-
"@typescript-eslint/parser": "^5.48.0",
101-
"eslint": "^8.31.0",
102-
"eslint-config-prettier": "^8.6.0",
103-
"eslint-config-sanity": "^6.0.0",
104-
"eslint-plugin-prettier": "^4.2.1",
105-
"eslint-plugin-react": "^7.31.11",
94+
"@testing-library/jest-dom": "^6.1.5",
95+
"@testing-library/react": "^14.1.2",
96+
"@types/jest": "^29.5.10",
97+
"@types/react": "^18.2.39",
98+
"@types/styled-components": "^5.1.32",
99+
"@typescript-eslint/eslint-plugin": "^6.13.1",
100+
"@typescript-eslint/parser": "^6.13.1",
101+
"eslint": "^8.54.0",
102+
"eslint-config-prettier": "^9.0.0",
103+
"eslint-config-sanity": "^7.0.1",
104+
"eslint-plugin-prettier": "^5.0.1",
105+
"eslint-plugin-react": "^7.33.2",
106106
"eslint-plugin-react-hooks": "^4.6.0",
107107
"husky": "^8.0.1",
108-
"jest": "^28.1.3",
109-
"jest-environment-jsdom": "^28.1.3",
110-
"lint-staged": "^13.0.3",
108+
"jest": "^29.7.0",
109+
"jest-environment-jsdom": "^29.7.0",
110+
"lint-staged": "^15.1.0",
111111
"npm-run-all": "^4.1.5",
112-
"prettier": "^2.8.1",
112+
"prettier": "^3.1.0",
113113
"prettier-plugin-packagejson": "^2.3.0",
114114
"react": "^18.2.0",
115115
"react-dom": "^18.2.0",
116116
"react-is": "^18.2.0",
117-
"rimraf": "^5.0.0",
117+
"rimraf": "^5.0.5",
118118
"sanity": "^3.2.3",
119119
"sanity-extra": "^1.0.0",
120120
"sanity-testing-library": "^1.0.0",
121-
"styled-components": "^5.3.6",
122-
"ts-jest": "^28.0.7",
123-
"typescript": "^5.0.0"
121+
"styled-components": "^6.1.1",
122+
"ts-jest": "^29.1.1",
123+
"typescript": "^5.3.2"
124124
},
125125
"peerDependencies": {
126126
"react": "^18",

src/CodeInput.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function CodeInput(props: CodeInputProps) {
7777

7878
const onHighlightChange = useCallback(
7979
(lines: number[]) => onChange(set(lines, ['highlightedLines'])),
80-
[onChange]
80+
[onChange],
8181
)
8282

8383
const handleCodeChange = useCallback(
@@ -90,7 +90,7 @@ export function CodeInput(props: CodeInputProps) {
9090
code ? set(code, path) : unset(path),
9191
])
9292
},
93-
[onChange, type]
93+
[onChange, type],
9494
)
9595
const {languages, language, languageMode} = useLanguageMode(props.schemaType, props.value)
9696

@@ -132,7 +132,7 @@ export function CodeInput(props: CodeInputProps) {
132132
elementProps.onBlur,
133133
readOnly,
134134
value,
135-
]
135+
],
136136
)
137137

138138
return (

src/LanguageField.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {CodeInputLanguage} from './types'
44
import {LanguageInput} from './LanguageInput'
55

66
export function LanguageField(
7-
props: MemberFieldProps & {member: FieldMember; language: string; languages: CodeInputLanguage[]}
7+
props: MemberFieldProps & {member: FieldMember; language: string; languages: CodeInputLanguage[]},
88
) {
99
const {member, languages, language, renderItem, renderField, renderPreview} = props
1010

@@ -18,7 +18,7 @@ export function LanguageField(
1818
/>
1919
)
2020
},
21-
[languages, language]
21+
[languages, language],
2222
)
2323

2424
return (

src/LanguageInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function LanguageInput(props: LanguageInputProps) {
1717
const newValue = e.currentTarget.value
1818
onChange(newValue ? set(newValue) : unset())
1919
},
20-
[onChange]
20+
[onChange],
2121
)
2222

2323
return (

src/codemirror/CodeMirrorProxy.tsx

Lines changed: 91 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -25,98 +25,97 @@ export interface CodeMirrorProps extends ReactCodeMirrorProps {
2525
*
2626
* It is also responsible for integrating any CodeMirror extensions.
2727
*/
28-
const CodeMirrorProxy = forwardRef<ReactCodeMirrorRef, CodeMirrorProps>(function CodeMirrorProxy(
29-
props,
30-
ref
31-
) {
32-
const {
33-
basicSetup: basicSetupProp,
34-
highlightLines,
35-
languageMode,
36-
onHighlightChange,
37-
readOnly,
38-
value,
39-
...codeMirrorProps
40-
} = props
41-
42-
const themeCtx = useRootTheme()
43-
const codeMirrorTheme = useCodeMirrorTheme()
44-
const [editorView, setEditorView] = useState<EditorView | undefined>(undefined)
45-
46-
// Resolve extensions
47-
const themeExtension = useThemeExtension()
48-
const fontSizeExtension = useFontSizeExtension({fontSize: 1})
49-
const languageExtension = useLanguageExtension(languageMode)
50-
const highlightLineExtension = useMemo(
51-
() =>
52-
highlightLine({
53-
onHighlightChange,
54-
readOnly,
55-
theme: themeCtx,
56-
}),
57-
[onHighlightChange, readOnly, themeCtx]
58-
)
59-
60-
const extensions = useMemo(() => {
61-
const baseExtensions = [
62-
themeExtension,
63-
fontSizeExtension,
64-
highlightLineExtension,
65-
EditorView.lineWrapping,
66-
]
67-
if (languageExtension) {
68-
return [...baseExtensions, languageExtension]
69-
}
70-
return baseExtensions
71-
}, [fontSizeExtension, highlightLineExtension, languageExtension, themeExtension])
72-
73-
useEffect(() => {
74-
if (editorView) {
75-
setHighlightedLines(editorView, highlightLines ?? [])
76-
}
77-
}, [editorView, highlightLines, value])
78-
79-
const initialState = useMemo(() => {
80-
return {
81-
json: {
82-
doc: value ?? '',
83-
selection: {
84-
main: 0,
85-
ranges: [{anchor: 0, head: 0}],
28+
const CodeMirrorProxy = forwardRef<ReactCodeMirrorRef, CodeMirrorProps>(
29+
function CodeMirrorProxy(props, ref) {
30+
const {
31+
basicSetup: basicSetupProp,
32+
highlightLines,
33+
languageMode,
34+
onHighlightChange,
35+
readOnly,
36+
value,
37+
...codeMirrorProps
38+
} = props
39+
40+
const themeCtx = useRootTheme()
41+
const codeMirrorTheme = useCodeMirrorTheme()
42+
const [editorView, setEditorView] = useState<EditorView | undefined>(undefined)
43+
44+
// Resolve extensions
45+
const themeExtension = useThemeExtension()
46+
const fontSizeExtension = useFontSizeExtension({fontSize: 1})
47+
const languageExtension = useLanguageExtension(languageMode)
48+
const highlightLineExtension = useMemo(
49+
() =>
50+
highlightLine({
51+
onHighlightChange,
52+
readOnly,
53+
theme: themeCtx,
54+
}),
55+
[onHighlightChange, readOnly, themeCtx],
56+
)
57+
58+
const extensions = useMemo(() => {
59+
const baseExtensions = [
60+
themeExtension,
61+
fontSizeExtension,
62+
highlightLineExtension,
63+
EditorView.lineWrapping,
64+
]
65+
if (languageExtension) {
66+
return [...baseExtensions, languageExtension]
67+
}
68+
return baseExtensions
69+
}, [fontSizeExtension, highlightLineExtension, languageExtension, themeExtension])
70+
71+
useEffect(() => {
72+
if (editorView) {
73+
setHighlightedLines(editorView, highlightLines ?? [])
74+
}
75+
}, [editorView, highlightLines, value])
76+
77+
const initialState = useMemo(() => {
78+
return {
79+
json: {
80+
doc: value ?? '',
81+
selection: {
82+
main: 0,
83+
ranges: [{anchor: 0, head: 0}],
84+
},
85+
highlight: highlightLines ?? [],
8686
},
87-
highlight: highlightLines ?? [],
88-
},
89-
fields: highlightState,
90-
}
91-
// only need to calculate this on initial render
92-
// eslint-disable-next-line react-hooks/exhaustive-deps
93-
}, [])
94-
95-
const handleCreateEditor = useCallback((view: EditorView) => {
96-
setEditorView(view)
97-
}, [])
98-
99-
const basicSetup = useMemo(
100-
() =>
101-
basicSetupProp ?? {
102-
highlightActiveLine: false,
103-
},
104-
[basicSetupProp]
105-
)
106-
107-
return (
108-
<CodeMirror
109-
{...codeMirrorProps}
110-
value={value}
111-
ref={ref}
112-
extensions={extensions}
113-
theme={codeMirrorTheme}
114-
onCreateEditor={handleCreateEditor}
115-
initialState={initialState}
116-
basicSetup={basicSetup}
117-
/>
118-
)
119-
})
87+
fields: highlightState,
88+
}
89+
// only need to calculate this on initial render
90+
// eslint-disable-next-line react-hooks/exhaustive-deps
91+
}, [])
92+
93+
const handleCreateEditor = useCallback((view: EditorView) => {
94+
setEditorView(view)
95+
}, [])
96+
97+
const basicSetup = useMemo(
98+
() =>
99+
basicSetupProp ?? {
100+
highlightActiveLine: false,
101+
},
102+
[basicSetupProp],
103+
)
104+
105+
return (
106+
<CodeMirror
107+
{...codeMirrorProps}
108+
value={value}
109+
ref={ref}
110+
extensions={extensions}
111+
theme={codeMirrorTheme}
112+
onCreateEditor={handleCreateEditor}
113+
initialState={initialState}
114+
basicSetup={basicSetup}
115+
/>
116+
)
117+
},
118+
)
120119

121120
function useLanguageExtension(mode?: string) {
122121
const codeConfig = useContext(CodeInputConfigContext)
@@ -130,7 +129,7 @@ function useLanguageExtension(mode?: string) {
130129
const codeMode = modes.find((m) => m.name === mode)
131130
if (!codeMode?.loader) {
132131
console.warn(
133-
`Found no codeMode for language mode ${mode}, syntax highlighting will be disabled.`
132+
`Found no codeMode for language mode ${mode}, syntax highlighting will be disabled.`,
134133
)
135134
}
136135
let active = true

0 commit comments

Comments
 (0)