[pnpm] Migrate bskyembed (#10482)

This commit is contained in:
Samuel Newman
2026-05-19 21:51:10 +03:00
committed by GitHub
parent 09253457f9
commit 8cea36f3c9
10 changed files with 4700 additions and 3539 deletions
+3 -3
View File
@@ -4,13 +4,13 @@ Install dependencies:
```bash ```bash
cd bskyembed cd bskyembed
yarn pnpm
``` ```
Run the dev server: Run the dev server:
```bash ```bash
yarn dev pnpm dev
``` ```
You can see the embed homepage at http://localhost:5173 You can see the embed homepage at http://localhost:5173
@@ -20,7 +20,7 @@ You can see the embed homepage at http://localhost:5173
In another terminal window, run the snippet dev script: In another terminal window, run the snippet dev script:
```bash ```bash
yarn dev-snippet pnpm dev-snippet
``` ```
You can then see the testbed page at http://localhost:5173/test You can then see the testbed page at http://localhost:5173/test
+8 -2
View File
@@ -1,10 +1,12 @@
// @ts-check // @ts-check
import js from '@eslint/js' import js from '@eslint/js'
import { defineConfig } from 'eslint/config';
import tseslint from 'typescript-eslint' import tseslint from 'typescript-eslint'
import simpleImportSort from 'eslint-plugin-simple-import-sort' import simpleImportSort from 'eslint-plugin-simple-import-sort'
import { importX } from 'eslint-plugin-import-x'
import globals from 'globals' import globals from 'globals'
export default tseslint.config( export default defineConfig(
// Global ignores // Global ignores
{ {
ignores: ['dist/**', 'node_modules/**'], ignores: ['dist/**', 'node_modules/**'],
@@ -14,7 +16,11 @@ export default tseslint.config(
js.configs.recommended, js.configs.recommended,
// TypeScript rules with type checking // TypeScript rules with type checking
...tseslint.configs.recommendedTypeChecked, tseslint.configs.recommendedTypeChecked,
// import-x
importX.flatConfigs.recommended,
importX.flatConfigs.typescript,
// Main configuration // Main configuration
{ {
+12 -8
View File
@@ -7,29 +7,33 @@
"dev-snippet": "tsc --project tsconfig.snippet.json && serve -s dist -p 3000 -n", "dev-snippet": "tsc --project tsconfig.snippet.json && serve -s dist -p 3000 -n",
"build": "tsc && vite build", "build": "tsc && vite build",
"build-snippet": "tsc --project tsconfig.snippet.json", "build-snippet": "tsc --project tsconfig.snippet.json",
"analyze": "ANALYZE=1 vite build",
"lint": "eslint --cache src", "lint": "eslint --cache src",
"typecheck": "tsc --noEmit" "typecheck": "tsc --noEmit",
"format": "prettier -w src"
}, },
"dependencies": { "dependencies": {
"@atproto/api": "^0.15.25", "@atproto/api": "^0.15.25",
"preact": "^10.4.8" "preact": "^10.4.8"
}, },
"devDependencies": { "devDependencies": {
"@preact/preset-vite": "^2.10.2",
"@vitejs/plugin-legacy": "^7.0.0",
"@eslint/js": "^9.18.0", "@eslint/js": "^9.18.0",
"@preact/preset-vite": "^2.10.2",
"@vitejs/plugin-legacy": "^8.0.1",
"autoprefixer": "^10.4.19", "autoprefixer": "^10.4.19",
"eslint": "^9.18.0", "eslint": "^9.18.0",
"eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-import-x": "^4.16.2",
"eslint-plugin-simple-import-sort": "^13.0.0",
"globals": "^15.14.0", "globals": "^15.14.0",
"postcss": "^8.4.38", "postcss": "^8.4.38",
"typescript-eslint": "^8.20.0", "prettier": "^3.8.3",
"serve": "^14.2.5", "serve": "^14.2.5",
"tailwindcss": "^3.4.3", "tailwindcss": "^3.4.3",
"terser": "^5.43.1", "terser": "^5.43.1",
"typescript": "^5.8.3", "typescript": "^6.0.3",
"vite": "^7.0.4", "typescript-eslint": "^8.20.0",
"vite-tsconfig-paths": "^5.1.4" "vite": "^8.0.12",
"vite-bundle-analyzer": "^1.3.8"
}, },
"resolutions": { "resolutions": {
"@types/estree": "1.0.6" "@types/estree": "1.0.6"
+4655
View File
File diff suppressed because it is too large Load Diff
+8
View File
@@ -0,0 +1,8 @@
allowBuilds:
"@sentry/cli": true
"core-js": true
"esbuild": true
"unrs-resolver": true
minimumReleaseAgeExclude:
- '@atproto/*'
- '@bsky.app/*'
+1
View File
@@ -416,6 +416,7 @@ function VideoEmbed({content}: {content: AppBskyEmbedVideo.View}) {
controls controls
playsinline playsinline
preload="metadata" preload="metadata"
// @ts-expect-error https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/video#loading
loading="lazy" loading="lazy"
aria-label={content.alt || undefined} aria-label={content.alt || undefined}
onClickCapture={evt => evt.stopPropagation()} onClickCapture={evt => evt.stopPropagation()}
+3 -5
View File
@@ -1,11 +1,10 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES5", "target": "ES2015",
"lib": ["DOM", "DOM.Iterable", "ESNext"], "lib": ["DOM", "ESNext"],
"types": ["vite/client"], "types": ["vite/client"],
"allowJs": false, "allowJs": false,
"skipLibCheck": true, "skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"strict": true, "strict": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
@@ -17,7 +16,6 @@
"jsx": "react", "jsx": "react",
"jsxFactory": "h", "jsxFactory": "h",
"jsxFragmentFactory": "Fragment", "jsxFragmentFactory": "Fragment",
"downlevelIteration": true
}, },
"include": ["src", "snippet", "vite.config.ts", "*.config.cjs", ".eslintrc.cjs"] "include": ["src", "snippet", "vite.config.ts", "*.config.cjs", "eslint.config.mjs"]
} }
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES5", "target": "ES2015",
"lib": ["DOM", "DOM.Iterable", "ESNext"], "lib": ["DOM", "ESNext"],
"strict": true, "strict": true,
"outDir": "dist" "outDir": "dist"
}, },
+8 -3
View File
@@ -1,10 +1,10 @@
import fs from 'node:fs' import fs from 'node:fs'
import {resolve} from 'node:path' import {resolve} from 'node:path'
import preact from '@preact/preset-vite' import {preact} from '@preact/preset-vite'
import legacy from '@vitejs/plugin-legacy' import legacy from '@vitejs/plugin-legacy'
import type {Plugin, UserConfig} from 'vite' import type {Plugin, UserConfig} from 'vite'
import paths from 'vite-tsconfig-paths' import {analyzer} from 'vite-bundle-analyzer'
/** /**
* World's hackiest router, for dev only. Serves `/post.html` to requests that start with `/embed/` * World's hackiest router, for dev only. Serves `/post.html` to requests that start with `/embed/`
@@ -38,11 +38,13 @@ function devOnlyRouter(): Plugin {
const config: UserConfig = { const config: UserConfig = {
plugins: [ plugins: [
preact(), preact(),
paths(),
legacy({ legacy({
targets: ['defaults', 'not IE 11'], targets: ['defaults', 'not IE 11'],
}), }),
devOnlyRouter(), devOnlyRouter(),
analyzer({
enabled: process.env.ANALYZE === '1',
}),
], ],
build: { build: {
assetsDir: 'static', assetsDir: 'static',
@@ -53,6 +55,9 @@ const config: UserConfig = {
}, },
}, },
}, },
resolve: {
tsconfigPaths: true,
},
} }
export default config export default config
-3516
View File
File diff suppressed because it is too large Load Diff