Skip to content

Commit

Permalink
Merge branch 'main' into fix-runtime-config-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyYolkin authored Nov 3, 2023
2 parents c76398d + 29928d3 commit a2a700b
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 101 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"devalue": "^4.3.2",
"eslint": "^8.52.0",
"eslint-plugin-jsdoc": "^46.8.2",
"jiti": "^1.20.0",
"jiti": "^1.21.0",
"vitest": "^0.34.6"
},
"resolutions": {
Expand All @@ -36,5 +36,5 @@
"engines": {
"node": "^14.16.0 || ^16.11.0 || >=17.0.0"
},
"packageManager": "[email protected].0"
"packageManager": "[email protected].2"
}
6 changes: 3 additions & 3 deletions packages/bridge-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
"devDependencies": {
"@types/lodash.template": "^4.5.2",
"@types/semver": "^7.5.4",
"@unhead/schema": "^1.7.5",
"nitropack": "^2.7.1",
"@unhead/schema": "^1.8.2",
"nitropack": "^2.7.2",
"unbuild": "latest",
"vite": "~4.5.0"
},
"dependencies": {
"c12": "^1.5.1",
"create-require": "^1.1.1",
"defu": "^6.1.3",
"jiti": "^1.20.0",
"jiti": "^1.21.0",
"pathe": "^1.1.1",
"pkg-types": "^1.0.3",
"postcss-import-resolver": "^2.0.0",
Expand Down
12 changes: 6 additions & 6 deletions packages/bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"@nuxt/postcss8": "^1.1.3",
"@nuxt/schema": "3.8.0",
"@nuxt/ui-templates": "^1.3.1",
"@unhead/ssr": "^1.7.4",
"@unhead/vue": "^1.7.4",
"@unhead/ssr": "^1.8.2",
"@unhead/vue": "^1.8.2",
"@vitejs/plugin-legacy": "^4.1.1",
"@vitejs/plugin-vue2": "^2.2.0",
"acorn": "^8.11.2",
Expand All @@ -49,7 +49,7 @@
"knitwork": "^1.0.0",
"magic-string": "^0.30.5",
"mlly": "^1.4.2",
"nitropack": "^2.7.1",
"nitropack": "^2.7.2",
"node-fetch": "^3.3.2",
"nypm": "^0.3.3",
"ofetch": "^1.3.3",
Expand All @@ -60,12 +60,12 @@
"postcss": "^8.4.31",
"postcss-import": "^15.1.0",
"postcss-import-resolver": "^2.0.0",
"postcss-preset-env": "^9.2.0",
"postcss-preset-env": "^9.3.0",
"postcss-url": "^10.1.3",
"scule": "^1.0.0",
"semver": "^7.5.4",
"std-env": "^3.4.3",
"terser": "^5.22.0",
"terser": "^5.24.0",
"ufo": "^1.3.1",
"unctx": "^2.3.1",
"unimport": "^3.4.0",
Expand All @@ -90,5 +90,5 @@
"engines": {
"node": "^14.16.0 || ^16.11.0 || >=17.0.0"
},
"packageManager": "[email protected].0"
"packageManager": "[email protected].2"
}
19 changes: 15 additions & 4 deletions packages/bridge/src/runtime/head/plugins/unhead.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
import { createHead as createClientHead, createServerHead, Vue2ProvideUnheadPlugin } from '@unhead/vue'
import {
createHead as createClientHead,
createServerHead,
setHeadInjectionHandler,
Vue2ProvideUnheadPlugin
} from '@unhead/vue'
import { markRaw } from 'vue'
import { renderSSRHead } from '@unhead/ssr'
import { defineNuxtPlugin } from '../../app'
import { defineNuxtPlugin, useNuxtApp } from '../../app'
// @ts-ignore
import metaConfig from '#build/meta.config.mjs'

export default defineNuxtPlugin((nuxtApp) => {
const createHead = process.server ? createServerHead : createClientHead
const head = createHead()
head.push(markRaw(metaConfig.globalMeta))

// TODO the replacement plugin has issues in Nuxt, needs to be fixed upstream
nuxtApp.vueApp.use(Vue2ProvideUnheadPlugin, head)
nuxtApp.vueApp.use(head)
nuxtApp.vueApp.config.globalProperties.$head = head

// allow useHead to be used outside a Vue context but within a Nuxt context
setHeadInjectionHandler(
// need a fresh instance of the nuxt app to avoid parallel requests interfering with each other
() => useNuxtApp().vueApp.config.globalProperties.$head
)

if (process.server) {
nuxtApp.ssrContext!.renderMeta = async () => {
Expand Down
Loading

0 comments on commit a2a700b

Please sign in to comment.