kopia lustrzana https://github.com/cloudflare/wildebeest
update qwik and qwikCity packages
rodzic
6e7f179216
commit
f7df319831
|
@ -13,8 +13,8 @@
|
|||
"watch": "concurrently \"vite build -w\" \"vite build -w -c adaptors/cloudflare-pages/vite.config.ts\""
|
||||
},
|
||||
"devDependencies": {
|
||||
"@builder.io/qwik": "0.16.2",
|
||||
"@builder.io/qwik-city": "0.1.0-beta8",
|
||||
"@builder.io/qwik": "0.18.1",
|
||||
"@builder.io/qwik-city": "0.2.1",
|
||||
"@types/eslint": "8.4.10",
|
||||
"@types/jest": "^29.2.4",
|
||||
"@types/node": "^18.11.16",
|
||||
|
|
|
@ -9,7 +9,7 @@ import { getPersonByEmail } from 'wildebeest/backend/src/activitypub/actors'
|
|||
import { getErrorHtml } from '~/utils/getErrorHtml/getErrorHtml'
|
||||
import { buildRedirect } from 'wildebeest/functions/oauth/authorize'
|
||||
|
||||
export const clientLoader = loader$<{ DATABASE: D1Database }, Promise<Client>>(async ({ platform, query, html }) => {
|
||||
export const clientLoader = loader$<Promise<Client>, { DATABASE: D1Database }>(async ({ platform, query, html }) => {
|
||||
const client_id = query.get('client_id') || ''
|
||||
let client: Client | null = null
|
||||
try {
|
||||
|
@ -24,8 +24,8 @@ export const clientLoader = loader$<{ DATABASE: D1Database }, Promise<Client>>(a
|
|||
})
|
||||
|
||||
export const userLoader = loader$<
|
||||
{ DATABASE: D1Database; domain: string },
|
||||
Promise<{ email: string; avatar: URL; name: string; url: URL }>
|
||||
Promise<{ email: string; avatar: URL; name: string; url: URL }>,
|
||||
{ DATABASE: D1Database; domain: string }
|
||||
>(async ({ cookie, platform, html, request, redirect, text }) => {
|
||||
const jwt = cookie.get('CF_Authorization')
|
||||
if (jwt === null) {
|
||||
|
@ -68,8 +68,8 @@ export const userLoader = loader$<
|
|||
})
|
||||
|
||||
export default component$(() => {
|
||||
const client = clientLoader.use().value
|
||||
const { email, avatar, name: display_name, url } = userLoader.use().value
|
||||
const client = clientLoader().value
|
||||
const { email, avatar, name: display_name, url } = userLoader().value
|
||||
return (
|
||||
<div class="flex flex-col p-4 items-center">
|
||||
<h1 class="text-center mt-3 mb-5 flex items-center">
|
||||
|
|
|
@ -7,6 +7,6 @@ export const loader = loader$(({ html }) => {
|
|||
})
|
||||
|
||||
export default component$(() => {
|
||||
loader.use()
|
||||
loader()
|
||||
return <></>
|
||||
})
|
||||
|
|
|
@ -15,8 +15,8 @@ import { StatusAccountCard } from '~/components/StatusAccountCard/StatusAccountC
|
|||
import { HtmlContent } from '~/components/HtmlContent/HtmlContent'
|
||||
|
||||
export const statusLoader = loader$<
|
||||
{ DATABASE: D1Database },
|
||||
Promise<{ status: MastodonStatus; statusTextContent: string; context: StatusContext }>
|
||||
Promise<{ status: MastodonStatus; statusTextContent: string; context: StatusContext }>,
|
||||
{ DATABASE: D1Database }
|
||||
>(async ({ request, html, platform, params }) => {
|
||||
const domain = new URL(request.url).hostname
|
||||
let statusText = ''
|
||||
|
@ -46,7 +46,7 @@ export const statusLoader = loader$<
|
|||
})
|
||||
|
||||
export default component$(() => {
|
||||
const loaderData = statusLoader.use().value
|
||||
const loaderData = statusLoader().value
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -111,8 +111,8 @@ export const Info = component$<{ href: string | null }>(({ href }) => {
|
|||
)
|
||||
})
|
||||
|
||||
export const head: DocumentHead = ({ getData }) => {
|
||||
const { status, statusTextContent } = getData(statusLoader)
|
||||
export const head: DocumentHead = ({ resolveValue }) => {
|
||||
const { status, statusTextContent } = resolveValue(statusLoader)
|
||||
|
||||
const title = `${status.account.display_name}: ${statusTextContent.substring(0, 30)}${
|
||||
statusTextContent.length > 30 ? '…' : ''
|
||||
|
|
|
@ -7,11 +7,11 @@ import { getLocalStatuses } from 'wildebeest/functions/api/v1/accounts/[id]/stat
|
|||
import { parseHandle } from 'wildebeest/backend/src/utils/parse'
|
||||
|
||||
export const statusesLoader = loader$<
|
||||
{ DATABASE: D1Database },
|
||||
Promise<{
|
||||
accountId: string
|
||||
statuses: MastodonStatus[]
|
||||
}>
|
||||
}>,
|
||||
{ DATABASE: D1Database }
|
||||
>(async ({ platform, request, html }) => {
|
||||
let statuses: MastodonStatus[] = []
|
||||
let accountId = ''
|
||||
|
@ -34,7 +34,7 @@ export const statusesLoader = loader$<
|
|||
})
|
||||
|
||||
export default component$(() => {
|
||||
const { accountId, statuses } = statusesLoader.use().value
|
||||
const { accountId, statuses } = statusesLoader().value
|
||||
|
||||
return (
|
||||
<div data-testid="account-posts">
|
||||
|
|
|
@ -13,8 +13,8 @@ import * as statusAPI from 'wildebeest/functions/api/v1/statuses/[id]'
|
|||
import { useAccountUrl } from '~/utils/useAccountUrl'
|
||||
|
||||
export const accountPageLoader = loader$<
|
||||
{ DATABASE: D1Database },
|
||||
Promise<{ account: MastodonAccount; accountHandle: string; isValidStatus: boolean }>
|
||||
Promise<{ account: MastodonAccount; accountHandle: string; isValidStatus: boolean }>,
|
||||
{ DATABASE: D1Database }
|
||||
>(async ({ platform, params, request, html }) => {
|
||||
let isValidStatus = false
|
||||
let account: MastodonAccount | null = null
|
||||
|
@ -53,7 +53,7 @@ export const accountPageLoader = loader$<
|
|||
export default component$(() => {
|
||||
useStyles$(styles)
|
||||
|
||||
const pageDetails = accountPageLoader.use().value
|
||||
const pageDetails = accountPageLoader().value
|
||||
const showAccountInfo = !pageDetails.isValidStatus
|
||||
|
||||
const location = useLocation()
|
||||
|
@ -160,8 +160,8 @@ export function getAccountDomain(account: MastodonAccount): string | null {
|
|||
}
|
||||
}
|
||||
|
||||
export const head: DocumentHead = ({ getData, head }) => {
|
||||
const { account, accountHandle } = getData(accountPageLoader)
|
||||
export const head: DocumentHead = ({ resolveValue, head }) => {
|
||||
const { account, accountHandle } = resolveValue(accountPageLoader)
|
||||
|
||||
return getDocumentHead(
|
||||
{
|
||||
|
|
|
@ -8,11 +8,11 @@ import { getLocalStatuses } from 'wildebeest/functions/api/v1/accounts/[id]/stat
|
|||
import { parseHandle } from 'wildebeest/backend/src/utils/parse'
|
||||
|
||||
export const statusesLoader = loader$<
|
||||
{ DATABASE: D1Database },
|
||||
Promise<{
|
||||
accountId: string
|
||||
statuses: MastodonStatus[]
|
||||
}>
|
||||
}>,
|
||||
{ DATABASE: D1Database }
|
||||
>(async ({ platform, request, html }) => {
|
||||
let statuses: MastodonStatus[] = []
|
||||
let accountId = ''
|
||||
|
@ -37,7 +37,7 @@ export const statusesLoader = loader$<
|
|||
export default component$(() => {
|
||||
useStyles$(styles)
|
||||
|
||||
const { accountId, statuses } = statusesLoader.use().value
|
||||
const { accountId, statuses } = statusesLoader().value
|
||||
|
||||
return (
|
||||
<div data-testid="account-posts-and-replies">
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
import { $, component$ } from '@builder.io/qwik'
|
||||
import { DocumentHead, loader$ } from '@builder.io/qwik-city'
|
||||
import { RequestContext } from '@builder.io/qwik-city/middleware/request-handler'
|
||||
import * as timelines from 'wildebeest/functions/api/v1/timelines/public'
|
||||
import { StatusesPanel } from '~/components/StatusesPanel/StatusesPanel'
|
||||
import type { MastodonStatus } from '~/types'
|
||||
import { getDocumentHead } from '~/utils/getDocumentHead'
|
||||
import { getErrorHtml } from '~/utils/getErrorHtml/getErrorHtml'
|
||||
|
||||
export const statusesLoader = loader$<{ DATABASE: D1Database; domain: string }, Promise<MastodonStatus[]>>(
|
||||
export const statusesLoader = loader$<Promise<MastodonStatus[]>, { DATABASE: D1Database; domain: string }>(
|
||||
async ({ platform, html }) => {
|
||||
try {
|
||||
// TODO: use the "trending" API endpoint here.
|
||||
|
@ -24,7 +23,7 @@ export const statusesLoader = loader$<{ DATABASE: D1Database; domain: string },
|
|||
)
|
||||
|
||||
export default component$(() => {
|
||||
const statuses = statusesLoader.use().value
|
||||
const statuses = statusesLoader().value
|
||||
return (
|
||||
<StatusesPanel
|
||||
initialStatuses={statuses}
|
||||
|
@ -47,11 +46,11 @@ export default component$(() => {
|
|||
|
||||
export const requestLoader = loader$(async ({ request }) => {
|
||||
// Manually parse the JSON to ensure that Qwik finds the resulting objects serializable.
|
||||
return JSON.parse(JSON.stringify(request)) as RequestContext
|
||||
return JSON.parse(JSON.stringify(request)) as Request
|
||||
})
|
||||
|
||||
export const head: DocumentHead = ({ getData }) => {
|
||||
const { url } = getData(requestLoader)
|
||||
export const head: DocumentHead = ({ resolveValue }) => {
|
||||
const { url } = resolveValue(requestLoader)
|
||||
return getDocumentHead({
|
||||
title: 'Explore - Wildebeest',
|
||||
og: {
|
||||
|
|
|
@ -11,8 +11,8 @@ import { InstanceConfigContext } from '~/utils/instanceConfig'
|
|||
import { getDocumentHead } from '~/utils/getDocumentHead'
|
||||
|
||||
export const instanceLoader = loader$<
|
||||
{ DATABASE: D1Database; INSTANCE_TITLE: string; INSTANCE_DESCR: string; ADMIN_EMAIL: string },
|
||||
Promise<InstanceConfig>
|
||||
Promise<InstanceConfig>,
|
||||
{ DATABASE: D1Database; INSTANCE_TITLE: string; INSTANCE_DESCR: string; ADMIN_EMAIL: string }
|
||||
>(async ({ platform, html }) => {
|
||||
const env = {
|
||||
INSTANCE_DESCR: platform.INSTANCE_DESCR,
|
||||
|
@ -30,7 +30,7 @@ export const instanceLoader = loader$<
|
|||
})
|
||||
|
||||
export default component$(() => {
|
||||
useContextProvider(InstanceConfigContext, instanceLoader.use().value)
|
||||
useContextProvider(InstanceConfigContext, instanceLoader().value)
|
||||
const commitHash = getCommitHash()
|
||||
|
||||
return (
|
||||
|
@ -64,8 +64,8 @@ export default component$(() => {
|
|||
)
|
||||
})
|
||||
|
||||
export const head: DocumentHead = ({ getData, head }) => {
|
||||
const instance = getData(instanceLoader)
|
||||
export const head: DocumentHead = ({ resolveValue, head }) => {
|
||||
const instance = resolveValue(instanceLoader)
|
||||
|
||||
return getDocumentHead(
|
||||
{
|
||||
|
|
|
@ -4,10 +4,9 @@ import * as timelines from 'wildebeest/functions/api/v1/timelines/public'
|
|||
import { DocumentHead, loader$ } from '@builder.io/qwik-city'
|
||||
import StickyHeader from '~/components/StickyHeader/StickyHeader'
|
||||
import { getDocumentHead } from '~/utils/getDocumentHead'
|
||||
import { RequestContext } from '@builder.io/qwik-city/middleware/request-handler'
|
||||
import { StatusesPanel } from '~/components/StatusesPanel/StatusesPanel'
|
||||
|
||||
export const statusesLoader = loader$<{ DATABASE: D1Database; domain: string }, Promise<MastodonStatus[]>>(
|
||||
export const statusesLoader = loader$<Promise<MastodonStatus[]>, { DATABASE: D1Database; domain: string }>(
|
||||
async ({ platform, html }) => {
|
||||
try {
|
||||
// TODO: use the "trending" API endpoint here.
|
||||
|
@ -22,7 +21,7 @@ export const statusesLoader = loader$<{ DATABASE: D1Database; domain: string },
|
|||
)
|
||||
|
||||
export default component$(() => {
|
||||
const statuses = statusesLoader.use().value
|
||||
const statuses = statusesLoader().value
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -54,11 +53,11 @@ export default component$(() => {
|
|||
|
||||
export const requestLoader = loader$(async ({ request }) => {
|
||||
// Manually parse the JSON to ensure that Qwik finds the resulting objects serializable.
|
||||
return JSON.parse(JSON.stringify(request)) as RequestContext
|
||||
return JSON.parse(JSON.stringify(request)) as Request
|
||||
})
|
||||
|
||||
export const head: DocumentHead = ({ getData }) => {
|
||||
const { url } = getData(requestLoader)
|
||||
export const head: DocumentHead = ({ resolveValue }) => {
|
||||
const { url } = resolveValue(requestLoader)
|
||||
return getDocumentHead({
|
||||
title: 'Federated timeline - Wildebeest',
|
||||
og: {
|
||||
|
|
|
@ -4,10 +4,9 @@ import * as timelines from 'wildebeest/functions/api/v1/timelines/public'
|
|||
import { DocumentHead, loader$ } from '@builder.io/qwik-city'
|
||||
import StickyHeader from '~/components/StickyHeader/StickyHeader'
|
||||
import { getDocumentHead } from '~/utils/getDocumentHead'
|
||||
import { RequestContext } from '@builder.io/qwik-city/middleware/request-handler'
|
||||
import { StatusesPanel } from '~/components/StatusesPanel/StatusesPanel'
|
||||
|
||||
export const statusesLoader = loader$<{ DATABASE: D1Database; domain: string }, Promise<MastodonStatus[]>>(
|
||||
export const statusesLoader = loader$<Promise<MastodonStatus[]>, { DATABASE: D1Database; domain: string }>(
|
||||
async ({ platform, html }) => {
|
||||
try {
|
||||
// TODO: use the "trending" API endpoint here.
|
||||
|
@ -22,7 +21,7 @@ export const statusesLoader = loader$<{ DATABASE: D1Database; domain: string },
|
|||
)
|
||||
|
||||
export default component$(() => {
|
||||
const statuses = statusesLoader.use().value
|
||||
const statuses = statusesLoader().value
|
||||
return (
|
||||
<>
|
||||
<StickyHeader>
|
||||
|
@ -53,11 +52,11 @@ export default component$(() => {
|
|||
|
||||
export const requestLoader = loader$(async ({ request }) => {
|
||||
// Manually parse the JSON to ensure that Qwik finds the resulting objects serializable.
|
||||
return JSON.parse(JSON.stringify(request)) as RequestContext
|
||||
return JSON.parse(JSON.stringify(request)) as Request
|
||||
})
|
||||
|
||||
export const head: DocumentHead = ({ getData }) => {
|
||||
const { url } = getData(requestLoader)
|
||||
export const head: DocumentHead = ({ resolveValue }) => {
|
||||
const { url } = resolveValue(requestLoader)
|
||||
return getDocumentHead({
|
||||
title: 'Local timeline - Wildebeest',
|
||||
og: {
|
||||
|
|
|
@ -6,6 +6,6 @@ export const loader = loader$(({ redirect }) => {
|
|||
})
|
||||
|
||||
export default component$(() => {
|
||||
loader.use()
|
||||
loader()
|
||||
return <></>
|
||||
})
|
||||
|
|
|
@ -297,20 +297,21 @@
|
|||
resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz"
|
||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@builder.io/qwik-city@0.1.0-beta8":
|
||||
version "0.1.0-beta8"
|
||||
resolved "https://registry.yarnpkg.com/@builder.io/qwik-city/-/qwik-city-0.1.0-beta8.tgz#9b94fe568c24e4a3676e36ab27f0c961e3ffcbac"
|
||||
integrity sha512-yDazkJ5wj5Fxl5FiYVopRkDABScZS83m7JWC2Z3MgrzaYn/PNr8V0D6kUTT18pLrQBSXMcAPug6qyapDEUWSgw==
|
||||
"@builder.io/qwik-city@0.2.1":
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/@builder.io/qwik-city/-/qwik-city-0.2.1.tgz#c57f481a75534ff54ddb0f38403acc66b5d02f41"
|
||||
integrity sha512-g+ZC4Neo1XYQ/8uquUp6GKwr0eagpuCyQ3LkAtFhaIARaO67+cZfR6EFLJzf9wz5AVSt8/0QSD7wJEpni1i4IA==
|
||||
dependencies:
|
||||
"@mdx-js/mdx" "2.2.1"
|
||||
"@mdx-js/mdx" "2.3.0"
|
||||
"@types/mdx" "2.0.3"
|
||||
source-map "0.7.4"
|
||||
vfile "5.3.6"
|
||||
vfile "5.3.7"
|
||||
zod "^3.20.6"
|
||||
|
||||
"@builder.io/qwik@0.16.2":
|
||||
version "0.16.2"
|
||||
resolved "https://registry.yarnpkg.com/@builder.io/qwik/-/qwik-0.16.2.tgz#e29d2c001043ed40260eae309948c8d91bae091c"
|
||||
integrity sha512-yq+WXx54PVDJkTse7C7zYcTVIn2g5qHD2buH/iy7nux+fVLd2Qpui7UK1nuioK2Kpf75JfEAH9ZSWIHQl32FKQ==
|
||||
"@builder.io/qwik@0.18.1":
|
||||
version "0.18.1"
|
||||
resolved "https://registry.yarnpkg.com/@builder.io/qwik/-/qwik-0.18.1.tgz#341d01c5749a07230c700a5e4df859b857654cd0"
|
||||
integrity sha512-11qx5Wh6WRxgvHDJDppJORhykzkACUYuu9qRKEGdS3vTkBQ2Rr8NFDjYon2x6+8Wu9WukHk84ANywWnS91gS/w==
|
||||
|
||||
"@cush/relative@^1.0.0":
|
||||
version "1.0.0"
|
||||
|
@ -709,10 +710,10 @@
|
|||
"@jridgewell/resolve-uri" "3.1.0"
|
||||
"@jridgewell/sourcemap-codec" "1.4.14"
|
||||
|
||||
"@mdx-js/mdx@2.2.1":
|
||||
version "2.2.1"
|
||||
resolved "https://registry.npmjs.org/@mdx-js/mdx/-/mdx-2.2.1.tgz"
|
||||
integrity sha512-hZ3ex7exYLJn6FfReq8yTvA6TE53uW9UHJQM9IlSauOuS55J9y8RtA7W+dzp6Yrzr00/U1sd7q+Wf61q6SfiTQ==
|
||||
"@mdx-js/mdx@2.3.0":
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@mdx-js/mdx/-/mdx-2.3.0.tgz#d65d8c3c28f3f46bb0e7cb3bf7613b39980671a9"
|
||||
integrity sha512-jLuwRlz8DQfQNiUCJR50Y09CGPq3fLtmtUQfVrj79E0JWu3dvsVcxVIcfhR5h0iXu+/z++zDrYeiJqifRynJkA==
|
||||
dependencies:
|
||||
"@types/estree-jsx" "^1.0.0"
|
||||
"@types/mdx" "^2.0.0"
|
||||
|
@ -4260,7 +4261,17 @@ vfile-message@^3.0.0:
|
|||
"@types/unist" "^2.0.0"
|
||||
unist-util-stringify-position "^3.0.0"
|
||||
|
||||
vfile@5.3.6, vfile@^5.0.0:
|
||||
vfile@5.3.7:
|
||||
version "5.3.7"
|
||||
resolved "https://registry.yarnpkg.com/vfile/-/vfile-5.3.7.tgz#de0677e6683e3380fafc46544cfe603118826ab7"
|
||||
integrity sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==
|
||||
dependencies:
|
||||
"@types/unist" "^2.0.0"
|
||||
is-buffer "^2.0.0"
|
||||
unist-util-stringify-position "^3.0.0"
|
||||
vfile-message "^3.0.0"
|
||||
|
||||
vfile@^5.0.0:
|
||||
version "5.3.6"
|
||||
resolved "https://registry.npmjs.org/vfile/-/vfile-5.3.6.tgz"
|
||||
integrity sha512-ADBsmerdGBs2WYckrLBEmuETSPyTD4TuLxTrw0DvjirxW1ra4ZwkbzG8ndsv3Q57smvHxo677MHaQrY9yxH8cA==
|
||||
|
@ -4381,6 +4392,11 @@ yocto-queue@^0.1.0:
|
|||
resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz"
|
||||
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
|
||||
|
||||
zod@^3.20.6:
|
||||
version "3.20.6"
|
||||
resolved "https://registry.yarnpkg.com/zod/-/zod-3.20.6.tgz#2f2f08ff81291d47d99e86140fedb4e0db08361a"
|
||||
integrity sha512-oyu0m54SGCtzh6EClBVqDDlAYRz4jrVtKwQ7ZnsEmMI9HnzuZFj8QFwAY1M5uniIYACdGvv0PBWPF2kO0aNofA==
|
||||
|
||||
zwitch@^2.0.0:
|
||||
version "2.0.4"
|
||||
resolved "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz"
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
import { test, expect } from '@playwright/test'
|
||||
|
||||
test('View of custom emojis in an toots author display name', async ({ page, browserName }) => {
|
||||
test.skip(
|
||||
true,
|
||||
'Qwik does no longer provide a way to mock the q-data request' +
|
||||
' so this test needs to be skipped until we either come up with a way to mock the q-data' +
|
||||
' or the custom emojis are implemented in the backend'
|
||||
)
|
||||
|
||||
// this page.route is a hack to mock the custom emojis since they haven't
|
||||
// yet been implemented in the backend (this should be not needed and removed
|
||||
// when those are implemented)
|
||||
|
|
Ładowanie…
Reference in New Issue