Skip to content

Commit 24efbee

Browse files
committed
feat(devtools): refactor SEO package integration and update build configuration
1 parent d7df03b commit 24efbee

10 files changed

Lines changed: 161 additions & 51 deletions

File tree

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
"overrides": {
8686
"@tanstack/devtools": "workspace:*",
8787
"@tanstack/devtools-a11y": "workspace:*",
88-
"@tanstack/devtools-seo": "workspace:*",
8988
"@tanstack/react-devtools": "workspace:*",
9089
"@tanstack/preact-devtools": "workspace:*",
9190
"@tanstack/solid-devtools": "workspace:*",

packages/devtools-seo/package.json

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,20 @@
2020
"solid-js"
2121
],
2222
"type": "module",
23-
"types": "dist/index.d.ts",
24-
"module": "dist/index.js",
23+
"types": "dist/esm/index.d.ts",
24+
"module": "dist/esm/index.js",
2525
"exports": {
2626
".": {
27-
"types": "./dist/index.d.ts",
28-
"import": "./dist/index.js"
27+
"import": {
28+
"types": "./dist/esm/index.d.ts",
29+
"default": "./dist/esm/index.js"
30+
}
31+
},
32+
"./react": {
33+
"import": {
34+
"types": "./dist/esm/react/index.d.ts",
35+
"default": "./dist/esm/react/index.js"
36+
}
2937
},
3038
"./package.json": "./package.json"
3139
},
@@ -43,19 +51,28 @@
4351
"test:eslint": "eslint ./src",
4452
"test:types": "tsc",
4553
"test:build": "publint --strict",
46-
"build": "tsup"
54+
"build": "vite build"
4755
},
4856
"dependencies": {
4957
"@tanstack/devtools-ui": "workspace:*",
58+
"@tanstack/devtools-utils": "workspace:*",
5059
"goober": "^2.1.16",
5160
"solid-js": "^1.9.9"
5261
},
5362
"peerDependencies": {
63+
"react": ">=16.8",
5464
"solid-js": ">=1.9.7"
5565
},
66+
"peerDependenciesMeta": {
67+
"react": {
68+
"optional": true
69+
}
70+
},
5671
"devDependencies": {
57-
"tsup": "^8.5.0",
58-
"tsup-preset-solid": "^2.2.0",
72+
"@tanstack/vite-config": "0.4.3",
73+
"@types/react": "^19.2.0",
74+
"react": "^19.2.0",
75+
"vite": "^8.0.0",
5976
"vite-plugin-solid": "^2.11.11"
6077
}
6178
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
'use client'
2+
3+
import { Fragment, createElement, useEffect, useRef } from 'react'
4+
import { render } from 'solid-js/web'
5+
import { ThemeContextProvider } from '@tanstack/devtools-ui'
6+
import { SeoTab } from '../seo-tab'
7+
8+
import type { DevtoolsPanelProps } from '@tanstack/devtools-utils/react'
9+
10+
export interface SeoDevtoolsReactInit extends DevtoolsPanelProps {}
11+
12+
function SeoDevtoolsPanel(props: SeoDevtoolsReactInit) {
13+
const rootRef = useRef<HTMLDivElement>(null)
14+
15+
useEffect(() => {
16+
if (!rootRef.current) {
17+
return
18+
}
19+
20+
const dispose = render(
21+
() => (
22+
<ThemeContextProvider theme={props.theme}>
23+
<SeoTab />
24+
</ThemeContextProvider>
25+
),
26+
rootRef.current,
27+
)
28+
29+
return () => {
30+
dispose()
31+
}
32+
}, [props])
33+
34+
return createElement('div', {
35+
ref: rootRef,
36+
style: { height: '100%' },
37+
})
38+
}
39+
40+
function SeoDevtoolsPanelNoOp() {
41+
return createElement(Fragment)
42+
}
43+
44+
export { SeoDevtoolsPanel, SeoDevtoolsPanelNoOp }
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use client'
2+
3+
export {
4+
SeoDevtoolsPanel,
5+
SeoDevtoolsPanelNoOp,
6+
type SeoDevtoolsReactInit,
7+
} from './SeoDevtools'
8+
9+
export { seoDevtoolsPlugin, seoDevtoolsNoOpPlugin } from './plugin'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { createReactPlugin } from '@tanstack/devtools-utils/react'
2+
import { SeoDevtoolsPanel } from './SeoDevtools'
3+
4+
const [seoDevtoolsPlugin, seoDevtoolsNoOpPlugin] = createReactPlugin({
5+
name: 'TanStack SEO',
6+
Component: SeoDevtoolsPanel,
7+
})
8+
9+
export { seoDevtoolsPlugin, seoDevtoolsNoOpPlugin }

packages/devtools-seo/tsup.config.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { defineConfig, mergeConfig } from 'vitest/config'
2+
import { tanstackViteConfig } from '@tanstack/vite-config'
3+
import solid from 'vite-plugin-solid'
4+
import packageJson from './package.json'
5+
import type { Plugin } from 'vite'
6+
7+
const config = defineConfig({
8+
plugins: [solid() as any satisfies Plugin],
9+
test: {
10+
name: packageJson.name,
11+
dir: './',
12+
watch: false,
13+
environment: 'jsdom',
14+
globals: true,
15+
},
16+
})
17+
18+
export default mergeConfig(
19+
config,
20+
tanstackViteConfig({
21+
entry: ['./src/index.ts', './src/react/index.ts'],
22+
srcDir: './src',
23+
cjs: false,
24+
}),
25+
)

packages/devtools/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
"@solid-primitives/resize-observer": "^2.1.3",
7070
"@tanstack/devtools-client": "workspace:*",
7171
"@tanstack/devtools-event-bus": "workspace:*",
72-
"@tanstack/devtools-seo": "workspace:*",
7372
"@tanstack/devtools-ui": "workspace:*",
7473
"clsx": "^2.1.1",
7574
"goober": "^2.1.16",

packages/devtools/src/tabs/index.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { SeoTab } from '@tanstack/devtools-seo'
2-
import { Cogs, List, PageSearch } from '@tanstack/devtools-ui/icons'
1+
import { Cogs, List } from '@tanstack/devtools-ui/icons'
32
import { SettingsTab } from './settings-tab'
43
import { PluginsTab } from './plugins-tab'
54

@@ -10,12 +9,6 @@ export const tabs = [
109
component: (props: { isOpen: boolean }) => <PluginsTab {...props} />,
1110
icon: () => <List />,
1211
},
13-
{
14-
name: 'SEO',
15-
id: 'seo',
16-
component: () => <SeoTab />,
17-
icon: () => <PageSearch />,
18-
},
1912
{
2013
name: 'Settings',
2114
id: 'settings',

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)