Skip to content

Commit

Permalink
feat: upgrade to unhead@1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Aug 14, 2023
1 parent a46fc8c commit 3b01248
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 87 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
"vue": ">=2.7 || >=3"
},
"dependencies": {
"@unhead/dom": "^1.1.26",
"@unhead/schema": "^1.1.26",
"@unhead/ssr": "^1.1.26",
"@unhead/vue": "^1.1.26"
"@unhead/dom": "^1.3.1",
"@unhead/schema": "^1.3.1",
"@unhead/ssr": "^1.3.1",
"@unhead/vue": "^1.3.1"
},
"devDependencies": {
"@antfu/eslint-config": "^0.36.0",
Expand Down
90 changes: 45 additions & 45 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,4 @@ export {
useHeadSafe,
useServerHead,
useServerHeadSafe,
useTagTitle,
useTagBase,
useTagMeta,
useTagMetaFlat,
useTagLink,
useTagScript,
useTagStyle,
useTagNoscript,
useHtmlAttrs,
useBodyAttrs,
useTitleTemplate,
useServerTagTitle,
useServerTagBase,
useServerTagMeta,
useServerTagMetaFlat,
useServerTagLink,
useServerTagScript,
useServerTagStyle,
useServerTagNoscript,
useServerHtmlAttrs,
useServerBodyAttrs,
useServerTitleTemplate,
} from '@unhead/vue'
2 changes: 0 additions & 2 deletions tests/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ describe('basic', () => {
[
{
"_i": 0,
"_sde": {},
"input": {
"link": [
{
Expand Down Expand Up @@ -52,7 +51,6 @@ describe('basic', () => {
[
{
"_i": 0,
"_sde": {},
"input": [Function],
},
]
Expand Down
8 changes: 3 additions & 5 deletions tests/dedupe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,10 @@ describe('dedupe', () => {
link: [{ rel: 'icon', href: '/favicon.ico', key: 'icon' }],
})
const { headTags } = await renderSSRHead(head.unhead)
expect(headTags).toMatchInlineSnapshot(
`
expect(headTags).toMatchInlineSnapshot(`
"<meta name=\\"description\\" content=\\"test\\">
<link rel=\\"icon\\" href=\\"/favicon.ico\\" data-h-e16a2dd=\\"\\">"
`,
)
<link rel=\\"icon\\" href=\\"/favicon.ico\\" data-hid=\\"e16a2dd\\">"
`)
})

test('dedupes legacy', async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/vite-ssr/vite-ssr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('e2e: vite ssr', async () => {
<meta http-equiv=\\"X-UA-Compatible\\" content=\\"IE=edge\\">
<meta name=\\"viewport\\" content=\\"width=device-width, initial-scale=1.0\\">
<title>count: 0 | @vueuse/head</title>
<base href=\\"/\\"><meta name=\\"custom-priority\\" content=\\"of 1\\"><meta name=\\"global-meta\\" content=\\"some global meta tag\\"><style>body {background: salmon}</style><noscript>This app requires javascript to work</noscript><meta name=\\"description\\" content=\\"desc\\"><meta name=\\"description\\" content=\\"desc 2\\"><meta property=\\"og:locale:alternate\\" content=\\"fr\\"><meta property=\\"og:locale:alternate\\" content=\\"zh\\"><link href=\\"/foo\\" rel=\\"stylesheet\\"><script data-h-1a4cc2a=\\"\\">console.log(\\"counter mount\\")</script>"
<base href=\\"/\\"><meta name=\\"custom-priority\\" content=\\"of 1\\"><meta name=\\"global-meta\\" content=\\"some global meta tag\\"><style>body {background: salmon}</style><noscript>This app requires javascript to work</noscript><meta name=\\"description\\" content=\\"desc\\"><meta name=\\"description\\" content=\\"desc 2\\"><meta property=\\"og:locale:alternate\\" content=\\"fr\\"><meta property=\\"og:locale:alternate\\" content=\\"zh\\"><link href=\\"/foo\\" rel=\\"stylesheet\\"><script data-hid=\\"1a4cc2a\\">console.log(\\"counter mount\\")</script>"
`)

await page.click('button.counter')
Expand Down
2 changes: 1 addition & 1 deletion tests/encoding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('encoding', () => {
'src': 'https://maps.googleapis.com/maps/api/js?key=AIzaSyB41DRUbKWJHPxaFjMAwdrzWzbVKartNGg&callback=initMap&v=weekly',
'data-key': 'AIzaSyD9hQ0Z7Y9XQX8Zjwq7Q9Z2YQ9Z2YQ9Z2Y',
'defer': true,
'body': true,
tagPosition: 'bodyClose',
},
],
})
Expand Down
3 changes: 2 additions & 1 deletion tests/reactivity-types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe('reactivity', () => {
{
children: '* { color: red }',
body: true,
tagPosition: 'bodyClose',
},
],
script: [
Expand All @@ -69,7 +70,7 @@ describe('reactivity', () => {
<meta property=\\"og:locale:alternate\\" content=\\"fr\\">
<meta property=\\"og:locale:alternate\\" content=\\"zh\\">
<link as=\\"style\\" href=\\"/style.css\\">
<script src=\\"foo.js\\" data-h-e959ceb=\\"\\"></script>",
<script src=\\"foo.js\\" data-hid=\\"e959ceb\\"></script>",
"htmlAttrs": " lang=\\"zh\\"",
}
`)
Expand Down
10 changes: 4 additions & 6 deletions tests/vue-ssr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,10 @@ describe('vue ssr', () => {
}),
)

expect(headResult.headTags).toMatchInlineSnapshot(
`
"<script src=\\"test\\" data-h-722c761=\\"\\">console.log('A')</script>
<script data-h-722c761=\\"\\">console.log('B')</script>"
`,
)
expect(headResult.headTags).toMatchInlineSnapshot(`
"<script src=\\"test\\" data-hid=\\"722c761\\">console.log('A')</script>
<script data-hid=\\"722c761\\">console.log('B')</script>"
`)
})

test('#issue 138', async () => {
Expand Down
1 change: 1 addition & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default defineConfig({
},
},
test: {
testTimeout: 30000,
// note: we can't use a dom environment otherwise the tests will think we're
// browser based
globals: true,
Expand Down

0 comments on commit 3b01248

Please sign in to comment.