Skip to content

Commit 8f8e329

Browse files
committed
chore: upgrade nuxt dependencies
1 parent 153a816 commit 8f8e329

File tree

8 files changed

+11672
-4109
lines changed

8 files changed

+11672
-4109
lines changed

package.json

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,41 +24,50 @@
2424
"type": "module",
2525
"exports": {
2626
".": {
27-
"types": "./dist/types.d.ts",
27+
"types": "./dist/types.d.mts",
2828
"import": "./dist/module.mjs",
2929
"require": "./dist/module.cjs"
3030
}
3131
},
32-
"main": "./dist/module.cjs",
33-
"types": "./dist/types.d.ts",
32+
"main": "./dist/module.mjs",
33+
"typesVersions": {
34+
"*": {
35+
".": [
36+
"./dist/types.d.mts"
37+
]
38+
}
39+
},
3440
"files": [
3541
"dist"
3642
],
3743
"scripts": {
38-
"prepack": "nuxt-module-build",
44+
"prepack": "nuxt-module-build build",
3945
"dev": "nuxi dev playground",
4046
"dev:build": "nuxi build playground",
41-
"dev:prepare": "nuxt-module-build --stub && nuxt-module-build prepare && nuxi prepare playground",
47+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
4248
"release": "npm run prepack && changelogen --release && git push --follow-tags",
4349
"lint": "eslint .",
4450
"test": "vitest run",
45-
"test:watch": "vitest watch"
51+
"test:watch": "vitest watch",
52+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
4653
},
4754
"dependencies": {
48-
"@nuxt/kit": "^3.7.3"
55+
"@nuxt/kit": "^3.17.2"
4956
},
5057
"devDependencies": {
51-
"@nuxt/devtools": "latest",
52-
"@nuxt/eslint-config": "^0.2.0",
53-
"@nuxt/module-builder": "^0.5.1",
54-
"@nuxt/schema": "^3.7.3",
55-
"@nuxt/test-utils": "^3.7.3",
56-
"@types/node": "^18.17.17",
57-
"changelogen": "^0.5.5",
58-
"eslint": "^8.49.0",
59-
"nuxt": "^3.7.3",
58+
"@nuxt/devtools": "^2.4.0",
59+
"@nuxt/eslint-config": "^1.3.0",
60+
"@nuxt/module-builder": "^1.0.1",
61+
"@nuxt/schema": "^3.17.2",
62+
"@nuxt/test-utils": "^3.18.0",
63+
"@types/node": "latest",
64+
"changelogen": "^0.6.1",
65+
"eslint": "^9.26.0",
66+
"nuxt": "^3.17.2",
67+
"typescript": "~5.8.3",
6068
"playwright": "^1.48.1",
6169
"playwright-core": "^1.39.0",
62-
"vitest": "^0.33.0"
70+
"vitest": "^3.1.2",
71+
"vue-tsc": "^2.2.10"
6372
}
64-
}
73+
}

playground/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"generate": "nuxi generate"
99
},
1010
"devDependencies": {
11-
"nuxt": "latest"
11+
"nuxt": "^3.17.2"
1212
}
1313
}

playground/yarn.lock

Lines changed: 6258 additions & 0 deletions
Large diffs are not rendered by default.

src/runtime/plugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DataObject } from "nuxt-utm";
1+
import type { DataObject } from "nuxt-utm";
22
import {
33
readLocalData,
44
getSessionID,
@@ -10,15 +10,15 @@ import {
1010
} from "./utm";
1111
import { ref } from "vue";
1212
import { defineNuxtPlugin } from "#app";
13-
import { HookResult } from "@unhead/schema";
13+
// import { type HookResult } from "@unhead/schema";
1414

1515
const LOCAL_STORAGE_KEY = "nuxt-utm-data";
1616
const SESSION_ID_KEY = "nuxt-utm-session-id";
1717

1818
export default defineNuxtPlugin((nuxtApp) => {
1919
const data = ref<DataObject[]>([]);
2020

21-
nuxtApp.hook("app:mounted", (): HookResult => {
21+
nuxtApp.hook("app:mounted", (): any => {
2222
data.value = readLocalData(LOCAL_STORAGE_KEY);
2323

2424
const sessionId = getSessionID(SESSION_ID_KEY);

src/runtime/utm.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
import { Ref } from "vue";
2-
import { LocationQuery } from "vue-router";
3-
import { UTMParams, AdditionalInfo, DataObject, GCLIDParams } from "nuxt-utm";
1+
import type { Ref } from "vue";
2+
import type { LocationQuery } from "vue-router";
3+
import type {
4+
UTMParams,
5+
AdditionalInfo,
6+
DataObject,
7+
GCLIDParams,
8+
} from "nuxt-utm";
49

510
export const generateSessionId = () => {
611
return Math.random().toString(36).substring(2, 15);

test/integration.test.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { DataObject } from "nuxt-utm";
1+
import type { DataObject } from "nuxt-utm";
22
import { describe, it, expect, beforeEach } from "vitest";
33
import { fileURLToPath } from "node:url";
44
import { setup, $fetch, createPage } from "@nuxt/test-utils";
5-
import { Page } from "playwright-core";
5+
import type { Page } from "playwright-core";
66

77
describe("ssr", async () => {
88
await setup({
@@ -15,10 +15,10 @@ describe("ssr", async () => {
1515

1616
beforeEach(async () => {
1717
page = await createPage(
18-
"/?utm_source=test_source&utm_medium=test_medium&utm_campaign=test_campaign&utm_term=test_term&utm_content=test_content&gad_source=1&gclid=testKey",
18+
"/?utm_source=test_source&utm_medium=test_medium&utm_campaign=test_campaign&utm_term=test_term&utm_content=test_content&gad_source=1&gclid=testKey"
1919
);
2020
const rawData = await page.evaluate(() =>
21-
window.localStorage.getItem("nuxt-utm-data"),
21+
window.localStorage.getItem("nuxt-utm-data")
2222
);
2323
entries = await JSON.parse(rawData ?? "[]");
2424
});
@@ -70,21 +70,22 @@ describe("ssr", async () => {
7070
it("Doesn't store anything after a page reload with the same UTM params and session", async () => {
7171
await page.reload();
7272
const rawData = await page?.evaluate(() =>
73-
window.localStorage.getItem("nuxt-utm-data"),
73+
window.localStorage.getItem("nuxt-utm-data")
7474
);
7575
entries = await JSON.parse(rawData ?? "[]");
7676
expect(entries.length).toEqual(1);
7777
});
7878

79-
it("Stores a new value if the UTM params are different but the session is the same", async () => {
79+
it.only("Stores a new value if the UTM params are different but the session is the same", async () => {
8080
const urlBase = page.url().split("?")[0];
8181
await page.goto(
82-
`${urlBase}/?utm_source=test_source2&utm_medium=test_medium2&utm_campaign=test_campaign2&utm_term=test_term2&utm_content=test_content2`,
82+
`${urlBase}/?utm_source=test_source2&utm_medium=test_medium2&utm_campaign=test_campaign2&utm_term=test_term2&utm_content=test_content2`
8383
);
8484
const rawData = await page.evaluate(() =>
85-
localStorage.getItem("nuxt-utm-data"),
85+
localStorage.getItem("nuxt-utm-data")
8686
);
8787
entries = await JSON.parse(rawData ?? "[]");
88+
console.log(entries);
8889
expect(entries[0].utmParams).toEqual({
8990
utm_campaign: "test_campaign2",
9091
utm_content: "test_content2",
@@ -96,11 +97,11 @@ describe("ssr", async () => {
9697

9798
it("Stores a new value if the UTM params are the same but the session is different", async () => {
9899
await page.evaluate(() =>
99-
sessionStorage.setItem("nuxt-utm-session-id", "old-session"),
100+
sessionStorage.setItem("nuxt-utm-session-id", "old-session")
100101
);
101102
await page.reload();
102103
const rawData = await page.evaluate(() =>
103-
localStorage.getItem("nuxt-utm-data"),
104+
localStorage.getItem("nuxt-utm-data")
104105
);
105106
entries = await JSON.parse(rawData ?? "[]");
106107
expect(entries[0].utmParams).toEqual({
@@ -124,7 +125,7 @@ describe("ssr", async () => {
124125
it("Doesn't store anything after a page reload with the same UTM params and session", async () => {
125126
await page.reload();
126127
const rawData = await page?.evaluate(() =>
127-
window.localStorage.getItem("nuxt-utm-data"),
128+
window.localStorage.getItem("nuxt-utm-data")
128129
);
129130
entries = await JSON.parse(rawData ?? "[]");
130131
expect(entries.length).toEqual(1);
@@ -133,10 +134,10 @@ describe("ssr", async () => {
133134
it("Stores a new value if the GCLID params are different but the session is the same", async () => {
134135
const urlBase = page.url().split("?")[0];
135136
await page.goto(
136-
`${urlBase}/?utm_source=test_source&utm_medium=test_medium&utm_campaign=test_campaign&utm_term=test_term&utm_content=test_content&gad_source=2&gclid=testKey2`,
137+
`${urlBase}/?utm_source=test_source&utm_medium=test_medium&utm_campaign=test_campaign&utm_term=test_term&utm_content=test_content&gad_source=2&gclid=testKey2`
137138
);
138139
const rawData = await page.evaluate(() =>
139-
localStorage.getItem("nuxt-utm-data"),
140+
localStorage.getItem("nuxt-utm-data")
140141
);
141142
entries = await JSON.parse(rawData ?? "[]");
142143
expect(entries?.[0].gclidParams).toEqual({
@@ -147,11 +148,11 @@ describe("ssr", async () => {
147148

148149
it("Stores a new value if the GCLID params are the same but the session is different", async () => {
149150
await page.evaluate(() =>
150-
sessionStorage.setItem("nuxt-utm-session-id", "old-session"),
151+
sessionStorage.setItem("nuxt-utm-session-id", "old-session")
151152
);
152153
await page.reload();
153154
const rawData = await page.evaluate(() =>
154-
localStorage.getItem("nuxt-utm-data"),
155+
localStorage.getItem("nuxt-utm-data")
155156
);
156157
entries = await JSON.parse(rawData ?? "[]");
157158
expect(entries?.[0].gclidParams).toEqual({

test/unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ref, Ref } from "vue";
2-
import { DataObject } from "nuxt-utm";
1+
import { ref, type Ref } from "vue";
2+
import type { DataObject } from "nuxt-utm";
33
import {
44
isRepeatedEntry,
55
readLocalData,

0 commit comments

Comments
 (0)