ee6aa172b2
This PR adds a `GET /api/unfurl?url=blahblah` endpoint to our worker. I tried out the existing cheerio implementation but it added 300kb to our worker bundle in the end, due to transitive dependencies. So I implemented the same logic with cloudflare's sanctioned streaming HTML parser `HTMLRewriter` and it seems to work fine. I also made the vscode extension do its fetching locally (from the node process so it's not bound by security policies), retaining the cheerio version for that. At the same time I fixed a bug in the RPC layer that was preventing unfurled metadata from loading correctly. In a few months we can retire the bookmark-extractor app by just deleting it in the vercel dashboard. ### Change Type <!-- ❗ Please select a 'Type' label ❗️ --> - [ ] `feature` — New feature - [x] `improvement` — Product improvement - [ ] `api` — API change - [ ] `bugfix` — Bug fix - [ ] `other` — Changes that don't affect SDK users, e.g. internal or .com changes ### Test Plan 1. Add a step-by-step description of how to test your PR here. 2. - [ ] Unit Tests - [ ] End to end tests ### Release Notes - Do link unfurling on the same subdomain as all our other api endpoints.
52 lines
1.5 KiB
JSON
52 lines
1.5 KiB
JSON
{
|
|
"name": "@tldraw/dotcom-worker",
|
|
"description": "A tiny little drawing app (merge server).",
|
|
"version": "2.0.0-alpha.11",
|
|
"private": true,
|
|
"author": {
|
|
"name": "tldraw GB Ltd.",
|
|
"email": "hello@tldraw.com"
|
|
},
|
|
"main": "./src/worker.ts",
|
|
"/* GOTCHA */": "files will include ./dist and index.d.ts by default, add any others you want to include in here",
|
|
"files": [],
|
|
"scripts": {
|
|
"dev": "yarn run -T tsx ../../scripts/workers/dev.ts",
|
|
"test-ci": "lazy inherit",
|
|
"test": "yarn run -T jest",
|
|
"test-coverage": "lazy inherit",
|
|
"check-bundle-size": "yarn run -T tsx ../../scripts/check-worker-bundle.ts --entry src/worker.ts --size-limit-bytes 350000",
|
|
"lint": "yarn run -T tsx ../../scripts/lint.ts"
|
|
},
|
|
"dependencies": {
|
|
"@supabase/auth-helpers-remix": "^0.2.2",
|
|
"@supabase/supabase-js": "^2.33.2",
|
|
"@tldraw/dotcom-shared": "workspace:*",
|
|
"@tldraw/store": "workspace:*",
|
|
"@tldraw/tlschema": "workspace:*",
|
|
"@tldraw/tlsync": "workspace:*",
|
|
"@tldraw/utils": "workspace:*",
|
|
"@tldraw/validate": "workspace:*",
|
|
"itty-router": "^4.0.13",
|
|
"nanoid": "4.0.2",
|
|
"react": "^18.2.0",
|
|
"react-dom": "^18.2.0",
|
|
"toucan-js": "^3.4.0"
|
|
},
|
|
"devDependencies": {
|
|
"@cloudflare/workers-types": "^4.20240620.0",
|
|
"esbuild": "^0.21.5",
|
|
"lazyrepo": "0.0.0-alpha.27",
|
|
"typescript": "^5.3.3",
|
|
"wrangler": "3.62.0"
|
|
},
|
|
"jest": {
|
|
"preset": "config/jest/node",
|
|
"moduleNameMapper": {
|
|
"^~(.*)": "<rootDir>/src/$1"
|
|
},
|
|
"transformIgnorePatterns": [
|
|
"node_modules/(?!(nanoid|escape-string-regexp)/)"
|
|
]
|
|
}
|
|
}
|