Skip to content

Commit

Permalink
fix(regression): output valid jsx (#113)
Browse files Browse the repository at this point in the history
* fix(regression): output valid jsx

* chore(refactor): replace tap with vitest
  • Loading branch information
stipsan authored Oct 10, 2023
1 parent 770d0ce commit f5a0285
Show file tree
Hide file tree
Showing 24 changed files with 464 additions and 785 deletions.
2 changes: 1 addition & 1 deletion demo/components/AnnotatedMap.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'leaflet/dist/leaflet.css'
import React, {useEffect, useState} from 'react'
import {useEffect, useState} from 'react'
import type {ReducedLeafletApi} from './Leaflet'
import {PortableTextTypeComponent} from '../../src'

Expand Down
2 changes: 1 addition & 1 deletion demo/components/CharacterReference.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {MouseEventHandler} from 'react'
import {MouseEventHandler} from 'react'
import {Tooltip, Text, Avatar, Flex, Box, Stack} from '@sanity/ui'
import type {PortableTextMarkComponent} from '../../src'

Expand Down
1 change: 0 additions & 1 deletion demo/components/Code.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import './Code.css'
import React from 'react'
import Refractor from 'react-refractor'
import typescript from 'refractor/lang/typescript'
import {PortableTextComponent} from '../../src'
Expand Down
1 change: 0 additions & 1 deletion demo/components/CurrencyAmount.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import type {PortableTextTypeComponent} from '../../src'

const style = {background: '#eee'}
Expand Down
1 change: 0 additions & 1 deletion demo/components/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import {PortableTextMarkComponent} from '../../src'

interface LinkMark {
Expand Down
1 change: 0 additions & 1 deletion demo/components/LinkableHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import {PortableTextBlockComponent, toPlainText} from '../../src'

/**
Expand Down
1 change: 0 additions & 1 deletion demo/components/SchnauzerList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import type {PortableTextListComponent} from '../../src'

const size = 14
Expand Down
2 changes: 1 addition & 1 deletion demo/components/SpeechSynthesis.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useCallback} from 'react'
import {useCallback} from 'react'
import type {PortableTextMarkComponent} from '../../src'

interface SpeechSynthesisMark {
Expand Down
2 changes: 1 addition & 1 deletion demo/components/TermDefinition.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useCallback, useState} from 'react'
import {useCallback, useState} from 'react'
import {Text, Popover} from '@sanity/ui'
import type {PortableTextMarkComponent} from '../../src'

Expand Down
12 changes: 6 additions & 6 deletions demo/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import {render} from 'react-dom'
import {StrictMode} from 'react'
import {createRoot} from 'react-dom/client'
import {studioTheme, ThemeProvider} from '@sanity/ui'
import {PortableTextComponents} from '../src'
import {PortableText} from '../src/react-portable-text'
Expand Down Expand Up @@ -53,11 +53,11 @@ function Demo() {
return <PortableText value={blocks} components={ptComponents} />
}

render(
<React.StrictMode>
const root = createRoot(document.getElementById('demo-root')!)
root.render(
<StrictMode>
<ThemeProvider theme={studioTheme}>
<Demo />
</ThemeProvider>
</React.StrictMode>,
document.getElementById('demo-root'),
</StrictMode>,
)
35 changes: 14 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,25 @@
"license": "MIT",
"author": "Sanity.io <hello@sanity.io>",
"sideEffects": false,
"type": "module",
"exports": {
".": {
"types": "./dist/react-portable-text.d.ts",
"types": "./dist/index.d.ts",
"source": "./src/index.ts",
"require": "./dist/react-portable-text.js",
"require": "./dist/index.cjs",
"node": {
"module": "./dist/react-portable-text.esm.js",
"import": "./dist/react-portable-text.cjs.mjs"
"module": "./dist/index.js",
"import": "./dist/index.cjs.js"
},
"import": "./dist/react-portable-text.esm.js",
"default": "./dist/react-portable-text.esm.js"
"import": "./dist/index.js",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/react-portable-text.js",
"module": "./dist/react-portable-text.esm.js",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"source": "./src/index.ts",
"types": "./dist/react-portable-text.d.ts",
"types": "./dist/index.d.ts",
"files": [
"dist",
"!dist/stats.html",
Expand All @@ -51,7 +52,7 @@
"prepare": "husky install",
"prepublishOnly": "run-s build lint type-check",
"start": "vite demo",
"test": "tap test/*.test.*",
"test": "vitest",
"type-check": "tsc --noEmit"
},
"commitlint": {
Expand Down Expand Up @@ -91,13 +92,6 @@
"dist/**/"
]
},
"tap": {
"check-coverage": false,
"node-arg": [
"-r",
"esbuild-register"
]
},
"dependencies": {
"@portabletext/toolkit": "^2.0.10",
"@portabletext/types": "^2.0.8"
Expand All @@ -112,7 +106,6 @@
"@types/react": "^18.2.27",
"@types/react-dom": "^18.2.12",
"@types/refractor": "^3.0.3",
"@types/tap": "^15.0.9",
"@types/ws": "^8.5.6",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
Expand All @@ -123,7 +116,7 @@
"esbuild-register": "^3.5.0",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-sanity": "^6.0.0",
"eslint-config-sanity": "^7.0.1",
"eslint-plugin-react": "^7.33.2",
"husky": "^8.0.3",
"leaflet": "^1.9.4",
Expand All @@ -139,9 +132,9 @@
"rimraf": "^5.0.1",
"rollup-plugin-visualizer": "^5.9.2",
"styled-components": "^6.0.8",
"tap": "^16.3.9",
"typescript": "^5.2.2",
"vite": "^4.4.11"
"vite": "^4.4.11",
"vitest": "^0.34.6"
},
"peerDependencies": {
"react": "^17 || ^18"
Expand Down
Loading

0 comments on commit f5a0285

Please sign in to comment.