Skip to content

Commit ba73147

Browse files
committed
chore: rename types + refactor + add 2 more critical hints
1 parent 1f5a7d2 commit ba73147

File tree

14 files changed

+217
-117
lines changed

14 files changed

+217
-117
lines changed

playground/app.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
<template>
2-
<pre>{{ $httpClientHints }}</pre>
2+
<div>
3+
<pre>{{ $httpClientHints }}</pre>
4+
<img
5+
src="/mountains_1.jpg"
6+
sizes="22vw"
7+
>
8+
</div>
39
</template>
410

511
<script setup>
6-
useNuxtApp().$
12+
713
</script>

playground/nuxt.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
export default defineNuxtConfig({
2+
compatibilityDate: '2024-10-11',
3+
devtools: { enabled: true },
24
modules: ['../src/module'],
35

46
httpClientHints: {
57
detectBrowser: true,
68
detectOS: 'windows-11',
7-
http: {
9+
critical: {
10+
width: true,
811
prefersColorScheme: true,
912
},
1013
},
1114

12-
devtools: { enabled: true },
13-
compatibilityDate: '2024-10-11',
1415
})

playground/public/mountains_1.jpg

2.61 MB
Loading

playground/public/mountains_2.jpg

1.18 MB
Loading

src/module.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { createResolver, defineNuxtModule } from '@nuxt/kit'
22
import type { HookResult } from '@nuxt/schema'
3-
import type { HttpClientHints as ModuleOptions } from './types'
3+
import { version } from '../package.json'
4+
import type { HttpClientHintsOptions as ModuleOptions } from './types'
45
import { configure } from './utils/configuration'
56
import type { HttpClientHintsState } from './runtime/shared-types/types'
67

@@ -15,6 +16,10 @@ export default defineNuxtModule<ModuleOptions>({
1516
meta: {
1617
name: 'http-client-hints',
1718
configKey: 'httpClientHints',
19+
compatibility: {
20+
nuxt: '>=3.9.0',
21+
},
22+
version,
1823
},
1924
defaults: () => ({
2025
detectBrowser: false,

src/runtime/plugins/http.client.ts renamed to src/runtime/plugins/critical.client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useHttpClientHintsState } from './state'
22
import { defineNuxtPlugin } from '#imports'
33

44
export default defineNuxtPlugin({
5-
name: 'http-client-hints:http-client:plugin',
5+
name: 'http-client-hints:critical-client:plugin',
66
enforce: 'pre',
77
parallel: true,
88
// @ts-expect-error missing at build time

0 commit comments

Comments
 (0)