d7b80baa31
Currently, we only use native `structuredClone` in the browser, falling back to `JSON.parse(JSON.stringify(...))` elsewhere, despite Node supporting `structuredClone` [since v17](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone) and Cloudflare Workers supporting it [since 2022](https://blog.cloudflare.com/standards-compliant-workers-api/). This PR adjusts our shim to use the native `structuredClone` on all platforms, if available. Additionally, `jsdom` doesn't implement `structuredClone`, a bug [open since 2022](https://github.com/jsdom/jsdom/issues/3363). This PR patches `jsdom` environment in all packages/apps that use it for tests. Also includes a driveby removal of `deepCopy`, a function that is strictly inferior to `structuredClone`. ### Change Type <!-- ❗ Please select a 'Scope' label ❗️ --> - [x] `sdk` — Changes the tldraw SDK - [x] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff <!-- ❗ Please select a 'Type' label ❗️ --> - [ ] `bugfix` — Bug fix - [ ] `feature` — New feature - [x] `improvement` — Improving existing features - [x] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know ### Test Plan 1. A smoke test would be enough - [ ] Unit Tests - [x] End to end tests
69 lines
1.7 KiB
JSON
69 lines
1.7 KiB
JSON
{
|
|
"name": "dotcom",
|
|
"description": "The production app for tldraw.",
|
|
"version": "2.0.0-alpha.11",
|
|
"private": true,
|
|
"author": {
|
|
"name": "tldraw GB Ltd.",
|
|
"email": "hello@tldraw.com"
|
|
},
|
|
"browserslist": [
|
|
"defaults"
|
|
],
|
|
"scripts": {
|
|
"dev": "yarn run -T tsx scripts/dev-app.ts",
|
|
"build": "yarn run -T tsx scripts/build.ts",
|
|
"start": "VITE_PREVIEW=1 yarn run -T tsx scripts/dev-app.ts",
|
|
"lint": "yarn run -T tsx ../../scripts/lint.ts",
|
|
"test-ci": "lazy inherit",
|
|
"test": "yarn run -T jest"
|
|
},
|
|
"dependencies": {
|
|
"@radix-ui/react-popover": "^1.0.7",
|
|
"@sentry/integrations": "^7.34.0",
|
|
"@sentry/react": "^7.77.0",
|
|
"@tldraw/assets": "workspace:*",
|
|
"@tldraw/tlsync": "workspace:*",
|
|
"@tldraw/utils": "workspace:*",
|
|
"@vercel/analytics": "^1.1.1",
|
|
"browser-fs-access": "^0.33.0",
|
|
"idb": "^7.1.1",
|
|
"nanoid": "4.0.2",
|
|
"qrcode": "^1.5.1",
|
|
"react": "^18.2.0",
|
|
"react-dom": "^18.2.0",
|
|
"react-helmet-async": "^1.3.0",
|
|
"react-router-dom": "^6.17.0",
|
|
"tldraw": "workspace:*"
|
|
},
|
|
"devDependencies": {
|
|
"@jest/globals": "30.0.0-alpha.2",
|
|
"@sentry/cli": "^2.25.0",
|
|
"@tldraw/validate": "workspace:*",
|
|
"@types/qrcode": "^1.5.0",
|
|
"@types/react": "^18.2.47",
|
|
"@typescript-eslint/utils": "^5.59.0",
|
|
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
"dotenv": "^16.3.1",
|
|
"eslint": "^8.37.0",
|
|
"fast-glob": "^3.3.1",
|
|
"json5": "^2.2.3",
|
|
"lazyrepo": "0.0.0-alpha.27",
|
|
"vite": "^5.0.0",
|
|
"ws": "^8.16.0"
|
|
},
|
|
"jest": {
|
|
"resolver": "<rootDir>/jestResolver.js",
|
|
"preset": "config/jest/node",
|
|
"roots": [
|
|
"<rootDir>"
|
|
],
|
|
"testEnvironment": "../../../packages/utils/patchedJestJsDom.js",
|
|
"transformIgnorePatterns": [
|
|
"node_modules/(?!(nanoid|nanoevents)/)"
|
|
],
|
|
"setupFiles": [
|
|
"./setupTests.js"
|
|
]
|
|
}
|
|
}
|