Skip to content

Commit 5fbd8a0

Browse files
committed
chore: resolve type / lint errors
1 parent f2788ff commit 5fbd8a0

File tree

45 files changed

+456
-285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+456
-285
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,11 @@ jobs:
3232
- name: Build
3333
run: pnpm run build
3434

35+
- name: Lint
36+
run: pnpm run lint
37+
38+
- name: Typecheck
39+
run: pnpm run typecheck
40+
3541
- name: Test
3642
run: pnpm run test

build.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ export default defineBuildConfig({
2424
'unstorage',
2525
'unstorage/drivers/fs',
2626
'consola/utils',
27+
'#nitro-internal-virtual/storage',
2728
],
2829
})

client/composables/fetch.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import type { VueHeadClient } from '@unhead/vue'
22
import type { OgImageComponent, OgImageOptions, OgImageRuntimeConfig } from '../../src/runtime/types'
3-
import { appFetch, devtoolsClient, useAsyncData } from '#imports'
3+
import { useAsyncData } from '#imports'
44
import { joinURL } from 'ufo'
5-
import { globalRefreshTime, optionsOverrides, path, refreshTime } from '~/util/logic'
5+
import { globalRefreshTime, optionsOverrides, path, refreshTime } from '../util/logic'
6+
import { appFetch, devtoolsClient } from './rpc'
67

78
export function fetchPathDebug() {
9+
// @ts-expect-error untyped
810
return useAsyncData<{ siteConfig: { url?: string }, options: OgImageOptions, vnodes: Record<string, any> }>(async () => {
911
if (!appFetch.value)
1012
return { siteCofig: {}, options: {}, vnodes: {} }
@@ -42,6 +44,7 @@ export function fetchPathDebug() {
4244
}
4345

4446
export function fetchGlobalDebug() {
47+
// @ts-expect-error untyped
4548
return useAsyncData<{ runtimeConfig: OgImageRuntimeConfig, componentNames: OgImageComponent[] }>('global-debug', () => {
4649
if (!appFetch.value)
4750
return { runtimeConfig: {} }

client/composables/rpc.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { $Fetch } from 'nitropack'
44
import type { ClientFunctions, ServerFunctions } from '../../src/rpc-types'
55
import { onDevtoolsClientConnected } from '@nuxt/devtools-kit/iframe-client'
66
import { ref, watchEffect } from 'vue'
7-
import { globalRefreshTime, path, query, refreshSources } from '~/util/logic'
7+
import { globalRefreshTime, path, query, refreshSources } from '../util/logic'
88

99
export const appFetch = ref<$Fetch>()
1010

@@ -17,23 +17,26 @@ export const colorMode = ref<'dark' | 'light'>('dark')
1717
export const ogImageRpc = ref<BirpcReturn<ServerFunctions>>()
1818

1919
onDevtoolsClientConnected(async (client) => {
20+
// @ts-expect-error untyped
2021
appFetch.value = client.host.app.$fetch
2122
watchEffect(() => {
2223
colorMode.value = client.host.app.colorMode.value
2324
})
2425
const $route = client.host.nuxt.vueApp.config.globalProperties?.$route
2526
query.value = $route.query
2627
path.value = $route.path || '/'
27-
client.host.nuxt.$router.afterEach((route) => {
28+
client.host.nuxt.$router.afterEach((route: any) => {
2829
query.value = route.query
2930
path.value = route.path
3031
refreshSources()
3132
})
3233
devtools.value = client.devtools
3334
devtoolsClient.value = client
35+
// @ts-expect-error untyped
3436
ogImageRpc.value = client.devtools.extendClientRpc<ServerFunctions, ClientFunctions>('nuxt-og-image', {
3537
refreshRouteData(path) {
3638
// if path matches
39+
// @ts-expect-error untyped
3740
if (devtoolsClient.value?.host.nuxt.vueApp.config?.globalProperties?.$route.matched[0].components?.default.__file.includes(path) || path.endsWith('.md'))
3841
refreshSources()
3942
},

docs/content/7.releases/3.v5.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ To avoid hoisting issues with the new Unhead v2, the Nuxt OG Image v5 requires N
1818

1919
Please upgrade your Nuxt to continue using OG Image.
2020

21-
```ts
21+
```bash
2222
nuxi upgrade --force
2323
```

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"files": [
4141
"dist",
42-
"virtual.d.ts"
42+
"types/virtual.d.ts"
4343
],
4444
"engines": {
4545
"node": ">=18.0.0"
@@ -50,7 +50,8 @@
5050
"build:client": "nuxi generate client",
5151
"build:module": "nuxt-build-module build",
5252
"client:dev": "nuxi dev client --port 3030",
53-
"lint": "eslint . --fix",
53+
"lint": "eslint .",
54+
"lint:fix": "eslint . --fix",
5455
"dev": "nuxi dev playground",
5556
"dev:build": "nuxi build playground",
5657
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground && nuxi prepare client",

playground/server/plugins/hooks.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
// @ts-expect-error untyped
12
import { defineNitroPlugin } from '#imports'
23

3-
export default defineNitroPlugin((nitroApp) => {
4-
nitroApp.hooks.hook('nuxt-og-image:context', async (ctx) => {
4+
export default defineNitroPlugin((nitroApp: any) => {
5+
nitroApp.hooks.hook('nuxt-og-image:context', async (ctx: any) => {
56
// eslint-disable-next-line no-console
67
console.log('Nitro hook ctx', !!ctx)
78
})
8-
nitroApp.hooks.hook('nuxt-og-image:satori:vnodes', async (vnodes) => {
9+
nitroApp.hooks.hook('nuxt-og-image:satori:vnodes', async (vnodes: any) => {
910
// eslint-disable-next-line no-console
1011
console.log('Nitro hook vnodes', !!vnodes)
1112
})

src/build/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export async function setupBuildHandler(config: ModuleOptions, resolve: Resolver
7474

7575
async function resolveFilePathSha1(path: string) {
7676
const _path = await resolvePath(path)
77-
return sha1(existsSync(_path) ? await readFile(_path) : path)
77+
return sha1(existsSync(_path) ? await readFile(_path) : Buffer.from(path))
7878
}
7979

8080
function sha1(source: Buffer) {

src/build/tree-shake-plugin.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ export const TreeShakeComposablesPlugin = createUnplugin(() => {
5656
]
5757

5858
const regexp = `(^\\s*)(${composableNames.join('|')})(?=\\((?!\\) \\{))`
59+
// eslint-disable-next-line regexp/no-unused-capturing-group
5960
const COMPOSABLE_RE = new RegExp(regexp, 'm')
61+
6062
const COMPOSABLE_RE_GLOBAL = new RegExp(regexp, 'gm')
6163

6264
return {

src/compatibility.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export const RuntimeCompatibility: Record<string, RuntimeCompatibilitySchema> =
7676
'satori': 'node',
7777
'sharp': false,
7878
'wasm': {
79+
// @ts-expect-error untyped
7980
rollup: {
8081
targetEnv: 'auto-inline',
8182
sync: ['@resvg/resvg-wasm/index_bg.wasm'],

0 commit comments

Comments
 (0)