Skip to content

Commit

Permalink
Merge branch 'next' into corel
Browse files Browse the repository at this point in the history
* next: (68 commits)
  fix(deps): update dependency @sanity/icons to ^3.5.5 (#8105)
  fix(deps): update dependency @sanity/ui to ^2.10.12 (#8108)
  fix(deps): update dependency react-rx to ^4.1.10 (#8109)
  chore(deps): update dependency @sanity/tsdoc to v1.0.153 (#8107)
  chore(deps): update typescript-tooling (#8104)
  fix(deps): update dependency @sanity/icons to ^3.5.5 (#8106)
  feat(typegen): add support for astro (#8098)
  chore(deps): update dependency turbo to ^2.3.3 (#8099)
  fix(deps): Update dev-non-major (#8100)
  fix: `WebSocket is closed before the connection is established` warning (#8042)
  v3.68.1
  fix(deps): update dependency @sanity/presentation to v1.19.13 (#8102)
  v3.68.0
  fix: use consistent `framer-motion` semver range (#8094)
  refactor(core): replace `PortableTextEditor` with `EditorProvider` (#8040)
  fix: improve `SanityDefaultPreview` memoization (#8049)
  fix: tooltip position in announcements popup (#8092)
  fix: replace useMemo with useState (#8095)
  fix: replace unsafe `useMemo` with `useState` (#8047)
  fix: replace `React.createElement` with jsx runtime (#8043)
  ...
  • Loading branch information
bjoerge committed Dec 19, 2024
2 parents f5f6824 + 67abc06 commit 1adb6e3
Show file tree
Hide file tree
Showing 205 changed files with 4,989 additions and 2,899 deletions.
2 changes: 2 additions & 0 deletions .eslintignore.react-compiler
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
**/static/*
**/coverage/*
**/lib/*
**/__tests__/*
**/node_modules/*
**/dist/*
*.json
Expand All @@ -28,3 +29,4 @@ scripts/*
test/*
**/__workshop__/*
packages/sanity/playwright-ct/**
**/@sanity/cli/templates/**
4 changes: 2 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ const sanityNoRestrictedImportsPaths = [
},
{
name: 'react',
importNames: ['default', 'createContext'],
importNames: ['default', 'createContext', 'createElement'],
message:
'Please use named imports, e.g. `import {useEffect, useMemo, type ComponentType} from "react"` instead.\nPlease place "context" in _singletons',
'Please use named imports, e.g. `import {useEffect, useMemo, type ComponentType} from "react"` instead.\nPlease place "context" in _singletons\nPlease use JSX instead of createElement, for example `createElement(Icon)` should be `<Icon />`',
},
]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ vars.PLAYWRIGHT_VERSION }}
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}

- name: Install Playwright Browsers
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,6 @@ yalc.lock
## Documentation Report
scripts/docs-report.md

# Temporary data collected by Million Lint
**/.million/store.json
dev/test-studio/.react-compiler-bailout-report.json
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ public-hoist-pattern[]=prettier-plugin-packagejson

prefer-workspace-packages = true
link-workspace-packages = deep

; Used so that the Million Lint instrumentation to `packages/sanity` and ``packages/sanity/vision` done in the test studio works, without having to add the dependency everywhere
public-hoist-pattern[]=@million/lint
2 changes: 1 addition & 1 deletion dev/depcheck-test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "depcheck-test",
"version": "3.67.1",
"version": "3.68.1",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>"
Expand Down
6 changes: 3 additions & 3 deletions dev/design-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "design-studio",
"version": "3.67.1",
"version": "3.68.1",
"private": true,
"description": "Sanity Design Studio",
"keywords": [
Expand Down Expand Up @@ -31,8 +31,8 @@
"start": "../.bin/sanity start --port 4000"
},
"dependencies": {
"@sanity/icons": "^3.5.2",
"@sanity/ui": "^2.10.9",
"@sanity/icons": "^3.5.5",
"@sanity/ui": "^2.10.12",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sanity": "workspace:*",
Expand Down
8 changes: 4 additions & 4 deletions dev/embedded-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "embedded-studio",
"version": "3.67.1",
"version": "3.68.1",
"private": true,
"scripts": {
"build": "tsc && vite build && sanity manifest extract",
"dev": "vite",
"preview": "vite preview"
},
"dependencies": {
"@sanity/ui": "^2.10.9",
"@sanity/ui": "^2.10.12",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"sanity": "workspace:*",
"styled-components": "^6.1.0"
},
"devDependencies": {
"@types/react": "^18.3.14",
"@types/react-dom": "^18.3.3",
"@types/react": "^18.3.17",
"@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.3.4",
"typescript": "5.7.2",
"vite": "^5.4.11"
Expand Down
6 changes: 3 additions & 3 deletions dev/page-building-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanity-page-building-studio",
"version": "3.67.1",
"version": "3.68.1",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>",
Expand All @@ -13,9 +13,9 @@
},
"dependencies": {
"@sanity/vision": "workspace:*",
"babel-plugin-react-compiler": "19.0.0-beta-37ed2a7-20241206",
"babel-plugin-react-compiler": "19.0.0-beta-201e55d-20241215",
"react": "^18.2.0",
"react-compiler-runtime": "19.0.0-beta-37ed2a7-20241206",
"react-compiler-runtime": "19.0.0-beta-201e55d-20241215",
"react-dom": "^18.2.0",
"react-icons": "^5.2.1",
"sanity": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion dev/starter-next-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanity-starter-next-studio",
"version": "3.67.1",
"version": "3.68.1",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>",
Expand Down
6 changes: 3 additions & 3 deletions dev/starter-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanity-starter-studio",
"version": "3.67.1",
"version": "3.68.1",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>",
Expand All @@ -12,9 +12,9 @@
"start": "../.bin/sanity start --port 3337"
},
"dependencies": {
"babel-plugin-react-compiler": "19.0.0-beta-37ed2a7-20241206",
"babel-plugin-react-compiler": "19.0.0-beta-201e55d-20241215",
"react": "^18.3.1",
"react-compiler-runtime": "19.0.0-beta-37ed2a7-20241206",
"react-compiler-runtime": "19.0.0-beta-201e55d-20241215",
"react-dom": "^18.3.1",
"sanity": "workspace:*",
"styled-components": "^6.1.0"
Expand Down
2 changes: 1 addition & 1 deletion dev/strict-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanity-strict-studio",
"version": "3.67.1",
"version": "3.68.1",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>",
Expand Down
12 changes: 6 additions & 6 deletions dev/studio-e2e-testing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "studio-e2e-testing",
"version": "3.67.1",
"version": "3.68.1",
"private": true,
"keywords": [
"sanity"
Expand All @@ -17,12 +17,12 @@
"dependencies": {
"@sanity/color-input": "^4.0.1",
"@sanity/google-maps-input": "^4.0.0",
"@sanity/icons": "^3.5.2",
"@sanity/ui": "^2.10.9",
"@sanity/vision": "3.67.1",
"babel-plugin-react-compiler": "19.0.0-beta-37ed2a7-20241206",
"@sanity/icons": "^3.5.5",
"@sanity/ui": "^2.10.12",
"@sanity/vision": "3.68.1",
"babel-plugin-react-compiler": "19.0.0-beta-201e55d-20241215",
"react": "^18.3.1",
"react-compiler-runtime": "19.0.0-beta-37ed2a7-20241206",
"react-compiler-runtime": "19.0.0-beta-201e55d-20241215",
"react-dom": "^18.3.1",
"sanity": "workspace:*",
"sanity-plugin-markdown": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion dev/test-create-integration-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "test-create-integration-studio",
"version": "3.67.1",
"version": "3.68.1",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>",
Expand Down
6 changes: 3 additions & 3 deletions dev/test-next-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanity-test-next-studio",
"version": "3.67.1",
"version": "3.68.1",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>",
Expand All @@ -12,8 +12,8 @@
},
"dependencies": {
"@sanity/vision": "workspace:*",
"babel-plugin-react-compiler": "19.0.0-beta-37ed2a7-20241206",
"next": "15.0.4",
"babel-plugin-react-compiler": "19.0.0-beta-201e55d-20241215",
"next": "15.1.1",
"react": "rc",
"react-dom": "rc",
"react-is": "rc",
Expand Down
2 changes: 1 addition & 1 deletion dev/test-next-studio/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"extends": ["//"],
"tasks": {
"build": {
"env": ["REACT_PRODUCTION_PROFILING"],
"env": ["REACT_PRODUCTION_PROFILING", "REACT_MILLION_LINT"],
"outputs": [".next/**", "!.next/cache/**", "out/**"],
"dependsOn": ["^build"]
},
Expand Down
5 changes: 3 additions & 2 deletions dev/test-studio/components/TranslateExample.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {InfoFilledIcon} from '@sanity/icons'
import {Card, Stack, Text} from '@sanity/ui'
import {forwardRef} from 'react'
import {Translate, useTranslation} from 'sanity'

export function TranslateExample() {
export const TranslateExample = forwardRef(function TranslateExample() {
const {t} = useTranslation('testStudio')
return (
<Card padding={4}>
Expand Down Expand Up @@ -60,4 +61,4 @@ export function TranslateExample() {
</Stack>
</Card>
)
}
})
4 changes: 2 additions & 2 deletions dev/test-studio/components/panes/debug/DebugPane.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {ChevronDownIcon, ChevronRightIcon, ControlsIcon, LinkIcon} from '@sanity/icons'
import {Box, Card, Code, Flex, Stack, Text} from '@sanity/ui'
import type * as React from 'react'
import {useMemo} from 'react'
import {useMemo, useState} from 'react'
import {usePaneRouter, type UserComponent} from 'sanity/structure'

function usePaneChildLinkComponent(props: {
Expand Down Expand Up @@ -48,7 +48,7 @@ export const DebugPane: UserComponent = function DebugPane(props) {
// notice that the ID is only created on mount and should not change between
// subsequent re-renders, therefore this ID will only change when the parent
// component re-renders.
const randomId = useMemo(() => Math.floor(Math.random() * 10000000).toString(16), [])
const [randomId] = useState(() => Math.floor(Math.random() * 10000000).toString(16))

return (
<Box height="fill">
Expand Down
19 changes: 10 additions & 9 deletions dev/test-studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sanity-test-studio",
"version": "3.67.1",
"version": "3.68.1",
"private": true,
"license": "MIT",
"author": "Sanity.io <[email protected]>",
Expand All @@ -16,15 +16,15 @@
"workshop:dev": "node -r esbuild-register scripts/workshop/dev.ts"
},
"dependencies": {
"@portabletext/editor": "^1.15.3",
"@portabletext/editor": "^1.16.3",
"@portabletext/react": "^3.0.0",
"@sanity/assist": "^3.0.2",
"@sanity/block-tools": "3.67.1",
"@sanity/block-tools": "3.68.1",
"@sanity/client": "^6.24.1",
"@sanity/color": "^3.0.0",
"@sanity/color-input": "^4.0.1",
"@sanity/google-maps-input": "^4.0.0",
"@sanity/icons": "^3.5.2",
"@sanity/icons": "^3.5.5",
"@sanity/image-url": "^1.0.2",
"@sanity/locale-ko-kr": "^1.0.1",
"@sanity/locale-nb-no": "^1.0.1",
Expand All @@ -35,14 +35,14 @@
"@sanity/migrate": "workspace:*",
"@sanity/preview-url-secret": "^2.0.0",
"@sanity/react-loader": "^1.10.27",
"@sanity/tsdoc": "1.0.150",
"@sanity/tsdoc": "1.0.153",
"@sanity/types": "workspace:*",
"@sanity/ui": "^2.10.9",
"@sanity/ui": "^2.10.12",
"@sanity/ui-workshop": "^1.0.0",
"@sanity/util": "workspace:*",
"@sanity/uuid": "^3.0.1",
"@sanity/vision": "workspace:*",
"@sanity/visual-editing": "2.10.6",
"@sanity/visual-editing": "2.10.10",
"@turf/helpers": "^6.0.1",
"@turf/points-within-polygon": "^5.1.5",
"@vercel/stega": "0.1.2",
Expand All @@ -52,7 +52,7 @@
"lodash": "^4.17.21",
"qs": "^6.10.2",
"react": "^18.3.1",
"react-compiler-runtime": "19.0.0-beta-37ed2a7-20241206",
"react-compiler-runtime": "19.0.0-beta-201e55d-20241215",
"react-dom": "^18.3.1",
"react-refractor": "^2.1.6",
"refractor": "^3.6.0",
Expand All @@ -65,7 +65,8 @@
"styled-components": "^6.1.11"
},
"devDependencies": {
"babel-plugin-react-compiler": "19.0.0-beta-37ed2a7-20241206",
"@million/lint": "1.0.14",
"babel-plugin-react-compiler": "19.0.0-beta-201e55d-20241215",
"chokidar": "^3.6.0",
"vite": "^5.4.11"
}
Expand Down
46 changes: 45 additions & 1 deletion dev/test-studio/sanity.cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@ import path from 'node:path'
import {defineCliConfig} from 'sanity/cli'
import {type UserConfig} from 'vite'

const millionLintEnabled = process.env.REACT_MILLION_LINT === 'true'
const millionInclude: string[] = []
try {
if (millionLintEnabled) {
for (const filePath of require('./.react-compiler-bailout-report.json')) {
millionInclude.push(`**/${filePath}`)
}
}
} catch (err) {
throw new Error('Failed to read lint report, did you run `pnpm report:react-compiler-bailout`?', {
cause: err,
})
}

export default defineCliConfig({
api: {
projectId: 'ppsg7ml5',
Expand All @@ -13,12 +27,42 @@ export default defineCliConfig({
// A) `SANITY_STUDIO_REACT_STRICT_MODE=false pnpm dev`
// B) creating a `.env` file locally that sets the same env variable as above
reactStrictMode: true,
reactCompiler: {target: '18'},
reactCompiler: millionLintEnabled
? {
target: '18',
sources: (filename) => {
/**
* This is the default filter when `sources` is not defined.
* Since we're overriding it we have to ensure we don't accidentally try running the compiler on non-src files from npm.
*/
if (filename.includes('node_modules')) {
return false
}
return millionInclude.every(
(pattern) => !filename.endsWith(`/${pattern.split('**/')[1]}`),
)
},
}
: {target: '18'},
vite(viteConfig: UserConfig): UserConfig {
const reactProductionProfiling = process.env.REACT_PRODUCTION_PROFILING === 'true'

return {
...viteConfig,
plugins: millionLintEnabled
? [
/**
* We're doing a dynamic import here, instead of a static import, to avoid an issue where a WebSocket Server is created by Million for `vite dev` that isn't closed.
* Which leaves `sanity build` hanging, even if the plugin itself isn't actually used.
*/
require('@million/lint').vite({
filter: {
include: millionInclude,
},
}),
...(viteConfig.plugins || []),
]
: viteConfig.plugins,
optimizeDeps: {
...viteConfig.optimizeDeps,
include: ['react/jsx-runtime'],
Expand Down
2 changes: 1 addition & 1 deletion dev/test-studio/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"extends": ["//"],
"tasks": {
"build": {
"env": ["REACT_PRODUCTION_PROFILING"],
"env": ["REACT_PRODUCTION_PROFILING", "REACT_MILLION_LINT"],
"outputs": [".sanity/**", "dist/**", "workshop/scopes.js"]
},
"start": {
Expand Down
Loading

0 comments on commit 1adb6e3

Please sign in to comment.