Skip to content

Commit e708387

Browse files
committed
fix: bug of importing useHead
Closes: #1149
1 parent ece3897 commit e708387

File tree

10 files changed

+3282
-2094
lines changed

10 files changed

+3282
-2094
lines changed

Diff for: packages/example/nuxt.config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ import NuxtJsonld from 'nuxt-jsonld';
33
export default defineNuxtConfig({
44
modules: [NuxtJsonld],
55
css: ['@/css/index.css'],
6+
devtools: true,
67
});

Diff for: packages/example/package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44
"version": "0.0.1",
55
"scripts": {
66
"prepare": "yarn workspace nuxt-jsonld build",
7-
"dev": "yarn prepare && nuxi dev",
7+
"dev": "nuxi dev",
88
"build": "yarn prepare && nuxi build",
99
"start": "node ./.output/server/index.mjs"
10+
},
11+
"dependencies": {
12+
"nuxt": "^3.4.1"
13+
},
14+
"devDependencies": {
15+
"@nuxt/devtools": "^0.4.0"
1016
}
1117
}

Diff for: packages/nuxt-jsonld/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"esbuild": "^0.17.14",
3838
"esbuild-jest": "^0.5.0",
3939
"jest": "^29.5.0",
40-
"nuxt": "^3.0.0",
40+
"nuxt": "^3.4.1",
4141
"prettier": "^2.8.7",
4242
"shipjs": "0.26.1",
4343
"tsup": "^6.7.0",

Diff for: packages/nuxt-jsonld/src/runtime/composable.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { computed } from 'vue';
22
import type { JsonLD, JsonLDFunc } from '../types';
3-
import { useHead } from '#head';
3+
import { useHead } from '@unhead/vue';
44

55
const isFunc = (json: JsonLD | JsonLDFunc): json is JsonLDFunc => typeof json === 'function';
66

Diff for: packages/nuxt-jsonld/src/runtime/plugin-impl.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { computed } from 'vue';
2-
import { useHead } from '#head';
2+
import { useHead } from '@unhead/vue';
33

44
export default (nuxtApp) => {
55
const mixin = {

Diff for: packages/nuxt-jsonld/src/runtime/plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineNuxtPlugin } from '#app';
1+
import { defineNuxtPlugin } from 'nuxt/app';
22
import plugin from './plugin-impl';
33

44
export default defineNuxtPlugin(plugin);

Diff for: packages/nuxt-jsonld/test/composable.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { useJsonld } from '../src/runtime/composable';
22
import { ref } from 'vue';
3-
import { useHead } from '#head';
3+
import { useHead } from '@unhead/vue';
44

55
let useHeadArg = undefined;
6-
jest.mock('#head', () => ({
6+
jest.mock('@unhead/vue', () => ({
77
useHead: jest.fn().mockImplementation((arg) => {
88
useHeadArg = arg;
99
}),

Diff for: packages/nuxt-jsonld/test/plugin.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import plugin from '../src/runtime/plugin-impl';
22

33
let useHeadArg = undefined;
4-
jest.mock('#head', () => ({
4+
jest.mock('@unhead/vue', () => ({
55
useHead: jest.fn().mockImplementation((arg) => {
66
useHeadArg = arg;
77
}),

Diff for: packages/nuxt-jsonld/tsconfig.json

-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
"sourceMap": false,
1111
"declaration": true,
1212
"lib": ["ESNext"],
13-
"paths": {
14-
"#app": ["../../node_modules/nuxt/dist/app"],
15-
"#head": ["../../node_modules/nuxt/dist/head/runtime"]
16-
},
1713
"types": ["@nuxt/schema"]
1814
},
1915
"include": ["./src/**/*"]

Diff for: yarn.lock

+3,267-2,082
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)