Skip to content

Commit

Permalink
refactor(react)!: rm uSES and require React 18
Browse files Browse the repository at this point in the history
  • Loading branch information
exuanbo committed Dec 7, 2023
1 parent 609ae88 commit 0482660
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .yarn/versions/4759c075.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
releases:
"@codemirror-toolkit/react": minor
11 changes: 4 additions & 7 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,13 @@
"url": "https://github.com/exuanbo/codemirror-toolkit/issues"
},
"homepage": "https://github.com/exuanbo/codemirror-toolkit/tree/main/packages/react#readme",
"dependencies": {
"use-sync-external-store": "^1.2.0"
},
"peerDependencies": {
"@codemirror/state": "^6.0.0",
"@codemirror/view": "^6.0.0",
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"@types/react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"peerDependenciesMeta": {
"@types/react": {
Expand Down
3 changes: 1 addition & 2 deletions packages/react/src/create.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { EditorState } from '@codemirror/state'
import { EditorView } from '@codemirror/view'
import { useCallback, useDebugValue, useEffect } from 'react'
import { useCallback, useDebugValue, useEffect, useSyncExternalStore } from 'react'
import { unstable_batchedUpdates as batch } from 'react-dom'
import { useSyncExternalStore } from 'use-sync-external-store/shim'

import type {
CodeMirror,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Emit
"outDir": "./dist",
// Language and Environment
"jsx": "react",
"jsx": "react-jsx",
"lib": ["ESNext", "DOM", "DOM.Iterable"]
},
"include": ["./src"],
Expand Down
2 changes: 1 addition & 1 deletion packages/react/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createViteConfig } from '@codemirror-toolkit/config/vite.mjs'
export default createViteConfig({
build: {
rollupOptions: {
external: [/^react/, /^use-sync-external-store/],
external: [/^react/],
output: {
interop: (id) => (id === 'react' ? 'esModule' : 'default'),
},
Expand Down
10 changes: 0 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ __metadata:
"@types/use-sync-external-store": ^0.0.3
react: ^18.2.0
react-dom: ^18.2.0
use-sync-external-store: ^1.2.0
peerDependencies:
"@codemirror/state": ^6.0.0
"@codemirror/view": ^6.0.0
Expand Down Expand Up @@ -6617,15 +6616,6 @@ __metadata:
languageName: node
linkType: hard

"use-sync-external-store@npm:^1.2.0":
version: 1.2.0
resolution: "use-sync-external-store@npm:1.2.0"
peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0
checksum: 5c639e0f8da3521d605f59ce5be9e094ca772bd44a4ce7322b055a6f58eeed8dda3c94cabd90c7a41fb6fa852210092008afe48f7038792fd47501f33299116a
languageName: node
linkType: hard

"util-deprecate@npm:^1.0.1":
version: 1.0.2
resolution: "util-deprecate@npm:1.0.2"
Expand Down

0 comments on commit 0482660

Please sign in to comment.