Skip to content

Commit b71b0cf

Browse files
committed
chore: bump deps & snapshots
1 parent 8d956fc commit b71b0cf

File tree

8 files changed

+511
-426
lines changed

8 files changed

+511
-426
lines changed

.nuxtrc

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
imports.autoImport=false
2+
modules[]=@nuxt/scripts

client/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
"generate": "nuxi generate"
1212
},
1313
"devDependencies": {
14-
"@iconify-json/carbon": "^1.2.7",
15-
"@nuxt/devtools-kit": "^2.1.0",
16-
"@nuxt/devtools-ui-kit": "^2.1.0",
14+
"@iconify-json/carbon": "^1.2.8",
15+
"@nuxt/devtools-kit": "^2.1.1",
16+
"@nuxt/devtools-ui-kit": "^2.1.1",
1717
"@nuxt/kit": "^3.15.4",
1818
"nuxt": "^3.15.4",
1919
"vue": "^3.5.13",

docs/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"@iconify-json/heroicons": "^1.2.2",
1313
"@iconify-json/noto": "^1.2.2",
1414
"@iconify-json/ph": "^1.2.2",
15-
"@iconify-json/simple-icons": "^1.2.25",
16-
"@nuxt/content": "^3.2.1",
15+
"@iconify-json/simple-icons": "^1.2.26",
16+
"@nuxt/content": "^3.2.2",
1717
"@nuxt/fonts": "^0.10.3",
1818
"@nuxt/image": "^1.9.0",
1919
"@nuxt/scripts": "workspace:*",
@@ -23,7 +23,7 @@
2323
"@vueuse/core": "^12.7.0",
2424
"@vueuse/nuxt": "^12.7.0",
2525
"nuxt-content-twoslash": "^0.1.2",
26-
"nuxt-llms": "^0.0.2",
26+
"nuxt-llms": "^0.1.0",
2727
"shiki": "^2.3.2"
2828
}
2929
}

package.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@nuxt/scripts",
33
"type": "module",
44
"version": "0.10.5",
5-
"packageManager": "pnpm@10.4.1",
5+
"packageManager": "pnpm@10.5.2",
66
"description": "Load third-party scripts with better performance, privacy and DX in Nuxt Apps.",
77
"author": {
88
"website": "https://harlanzw.com",
@@ -93,40 +93,40 @@
9393
"h3": "^1.15.1",
9494
"magic-string": "^0.30.17",
9595
"ofetch": "^1.4.1",
96-
"ohash": "^1.1.4",
96+
"ohash": "^2.0.7",
9797
"pathe": "^2.0.3",
98-
"pkg-types": "^1.3.1",
98+
"pkg-types": "^2.0.1",
9999
"semver": "^7.7.1",
100100
"sirv": "^3.0.1",
101101
"std-env": "^3.8.0",
102102
"ufo": "^1.5.4",
103103
"unplugin": "^2.2.0",
104104
"unstorage": "^1.15.0",
105-
"valibot": "^1.0.0-rc.1"
105+
"valibot": "^1.0.0-rc.2"
106106
},
107107
"devDependencies": {
108-
"@nuxt/devtools-kit": "^2.1.0",
109-
"@nuxt/devtools-ui-kit": "^2.1.0",
108+
"@nuxt/devtools-kit": "^2.1.1",
109+
"@nuxt/devtools-ui-kit": "^2.1.1",
110110
"@nuxt/eslint-config": "^1.1.0",
111111
"@nuxt/module-builder": "^0.8.4",
112112
"@nuxt/test-utils": "3.17.0",
113113
"@types/semver": "^7.5.8",
114-
"@typescript-eslint/typescript-estree": "^8.24.1",
114+
"@typescript-eslint/typescript-estree": "^8.25.0",
115115
"acorn-loose": "^8.4.0",
116116
"bumpp": "^10.0.3",
117-
"changelogen": "^0.5.7",
117+
"changelogen": "^0.6.0",
118118
"eslint": "9.21.0",
119119
"eslint-plugin-n": "^17.15.1",
120-
"happy-dom": "^17.1.4",
120+
"happy-dom": "^17.1.8",
121121
"knitwork": "^1.2.0",
122122
"nuxt": "catalog:",
123123
"playwright-core": "^1.50.1",
124124
"shiki": "2.3.2",
125125
"typescript": "5.7.3",
126-
"vitest": "^3.0.6",
126+
"vitest": "^3.0.7",
127127
"vue": "^3.5.13",
128128
"vue-router": "^4.5.0",
129-
"vue-tsc": "^2.2.4"
129+
"vue-tsc": "^2.2.6"
130130
},
131131
"resolutions": {
132132
"@nuxt/schema": "catalog:",

pnpm-lock.yaml

+439-351
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/e2e/base.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ describe('base', () => {
2121
await page.waitForTimeout(500)
2222
// get content of #script-src
2323
const text = await page.$eval('#script-src', el => el.textContent)
24-
expect(text).toMatchInlineSnapshot(`"/foo/_scripts/6nd5bD9YCW.js"`)
24+
expect(text).toMatchInlineSnapshot(`"/foo/_scripts/6bEy8slcRmYcRT4E2QbQZ1CMyWw9PpHA7L87BtvSs2U.js"`)
2525
})
2626
})

test/e2e/basic.test.ts

+51-55
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from 'vitest'
22
import { createResolver } from '@nuxt/kit'
3-
import { createPage, setup } from '@nuxt/test-utils/e2e'
3+
import { getBrowser, url, waitForHydration, setup } from '@nuxt/test-utils/e2e'
44
import { parseURL } from 'ufo'
55

66
const { resolve } = createResolver(import.meta.url)
@@ -11,22 +11,43 @@ await setup({
1111
browser: true,
1212
})
1313

14+
async function createPage(path: string, options?: any) {
15+
const logs: { text: string, location: string }[] = []
16+
const browser = await getBrowser()
17+
const page = await browser.newPage(options)
18+
page.addListener('console', (msg) => {
19+
const location = `${parseURL(msg.location().url).pathname}:${msg.location().lineNumber}`
20+
if (!location.startsWith('/_nuxt')) {
21+
logs.push({
22+
text: msg.text(),
23+
location,
24+
})
25+
}
26+
})
27+
const _goto = page.goto.bind(page)
28+
page.goto = async (url2, options2) => {
29+
const waitUntil = options2?.waitUntil
30+
if (waitUntil && ['hydration', 'route'].includes(waitUntil)) {
31+
delete options2.waitUntil
32+
}
33+
const res = await _goto(url2, options2)
34+
await waitForHydration(page, url2, waitUntil)
35+
return res
36+
}
37+
if (path) {
38+
// @ts-expect-error untyped
39+
await page.goto(url(path), options?.javaScriptEnabled === false ? {} : { waitUntil: 'hydration' })
40+
}
41+
// @ts-expect-error untyped
42+
return { page, logs() { return logs } }
43+
}
44+
1445
describe('basic', () => {
1546
it('relative onNuxtReady', async () => {
16-
const page = await createPage('/')
17-
const logs: { text: string, location: string }[] = []
47+
const { page, logs } = await createPage('/')
1848
// visit and collect all logs, we need to do a snapshot on them
19-
page.addListener('console', (msg) => {
20-
const location = `${parseURL(msg.location().url).pathname}:${msg.location().lineNumber}`
21-
if (!location.startsWith('/_nuxt')) {
22-
logs.push({
23-
text: msg.text(),
24-
location,
25-
})
26-
}
27-
})
28-
await page.waitForTimeout(5000)
29-
expect(logs).toMatchInlineSnapshot(`
49+
await page.waitForTimeout(500)
50+
expect(logs()).toMatchInlineSnapshot(`
3051
[
3152
{
3253
"location": "/myScript.js:1",
@@ -44,21 +65,13 @@ describe('basic', () => {
4465
`)
4566
})
4667
it('relative manual', async () => {
47-
const page = await createPage('/manual-trigger')
48-
const logs: { text: string, location: string }[] = []
49-
// visit and collect all logs, we need to do a snapshot on them
50-
page.addListener('console', (msg) => {
51-
logs.push({
52-
text: msg.text(),
53-
location: `${parseURL(msg.location().url).pathname}:${msg.location().lineNumber}`,
54-
})
55-
})
68+
const { page, logs } = await createPage('/manual-trigger')
5669
await page.waitForTimeout(500)
57-
expect(logs.length).toBe(0)
70+
expect(logs().length).toBe(0)
5871
// click button
5972
await page.click('#load-script')
60-
await page.waitForTimeout(5000)
61-
expect(logs).toMatchInlineSnapshot(`
73+
await page.waitForTimeout(500)
74+
expect(logs()).toMatchInlineSnapshot(`
6275
[
6376
{
6477
"location": "/myScript.js:1",
@@ -76,24 +89,16 @@ describe('basic', () => {
7689
`)
7790
})
7891
it('relative visibility', async () => {
79-
const page = await createPage('/visibility-trigger')
80-
const logs: { text: string, location: string }[] = []
81-
// visit and collect all logs, we need to do a snapshot on them
82-
page.addListener('console', (msg) => {
83-
logs.push({
84-
text: msg.text(),
85-
location: `${parseURL(msg.location().url).pathname}:${msg.location().lineNumber}`,
86-
})
87-
})
92+
const { page, logs } = await createPage('/visibility-trigger')
8893
await page.waitForTimeout(500)
89-
expect(logs.length).toBe(0)
94+
expect(logs().length).toBe(0)
9095
// scroll to element
9196
await page.evaluate(() => {
9297
const el = document.querySelector('#el-trigger') as HTMLElement
9398
el.scrollIntoView()
9499
})
95-
await page.waitForTimeout(5000)
96-
expect(logs).toMatchInlineSnapshot(`
100+
await page.waitForTimeout(500)
101+
expect(logs()).toMatchInlineSnapshot(`
97102
[
98103
{
99104
"location": "/myScript.js:1",
@@ -111,20 +116,12 @@ describe('basic', () => {
111116
`)
112117
})
113118
it('relative mouseover', async () => {
114-
const page = await createPage('/mouseover-trigger')
115-
const logs: { text: string, location: string }[] = []
116-
// visit and collect all logs, we need to do a snapshot on them
117-
page.addListener('console', (msg) => {
118-
logs.push({
119-
text: msg.text(),
120-
location: `${parseURL(msg.location().url).pathname}:${msg.location().lineNumber}`,
121-
})
122-
})
119+
const { page, logs } = await createPage('/mouseover-trigger')
123120
await page.waitForTimeout(500)
124-
expect(logs.length).toBe(0)
121+
expect(logs().length).toBe(0)
125122
await page.hover('#el-trigger')
126-
await page.waitForTimeout(5000)
127-
expect(logs).toMatchInlineSnapshot(`
123+
await page.waitForTimeout(500)
124+
expect(logs()).toMatchInlineSnapshot(`
128125
[
129126
{
130127
"location": "/myScript.js:1",
@@ -142,19 +139,18 @@ describe('basic', () => {
142139
`)
143140
})
144141
it('bundle', async () => {
145-
const page = await createPage('/bundle-use-script')
146-
await page.waitForTimeout(500)
142+
const { page } = await createPage('/bundle-use-script')
147143
// get content of #script-src
148144
const text = await page.$eval('#script-src', el => el.textContent)
149-
expect(text).toMatchInlineSnapshot(`"/_scripts/6nd5bD9YCW.js"`)
145+
expect(text).toMatchInlineSnapshot(`"/_scripts/6bEy8slcRmYcRT4E2QbQZ1CMyWw9PpHA7L87BtvSs2U.js"`)
150146
})
151147
})
152148

153149
describe('third-party-capital', () => {
154150
it('expect GA to collect data', {
155151
timeout: 10000,
156152
}, async () => {
157-
const page = await createPage('/tpc/ga')
153+
const { page } = await createPage('/tpc/ga')
158154
await page.waitForTimeout(500)
159155

160156
// wait for the collect request or timeout
@@ -169,7 +165,7 @@ describe('third-party-capital', () => {
169165
it('expect GTM to work collect data', {
170166
timeout: 10000,
171167
}, async () => {
172-
const page = await createPage('/tpc/gtm')
168+
const { page } = await createPage('/tpc/gtm')
173169
await page.waitForTimeout(500)
174170

175171
// wait for the collect request

test/unit/transform.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ describe('nuxtScriptTransformer', () => {
280280

281281
},
282282
)
283-
expect(code).toMatchInlineSnapshot(`"const instance = useScriptNpm({ scriptInput: { src: '/_scripts/soMXoYlUxl.js' }, packageName: 'jsconfetti', version: '1.0.0', file: 'dist/index.js' })"`)
283+
expect(code).toMatchInlineSnapshot(`"const instance = useScriptNpm({ scriptInput: { src: '/_scripts/jKysJQD_rnWtMaRpo62kJcIJ4PsW_O2f1NXNqksJbMk.js' }, packageName: 'jsconfetti', version: '1.0.0', file: 'dist/index.js' })"`)
284284
})
285285

286286
it('useScript broken #1', async () => {
@@ -309,7 +309,7 @@ const _sfc_main = /* @__PURE__ */ _defineComponent({
309309
}
310310
});`,
311311
)
312-
expect(code.includes('useScript(\'/_scripts/JvFMRwu6zQ.js\', {')).toBeTruthy()
312+
expect(code.includes('useScript(\'/_scripts/vFJ41_fzYQOTRPr3v6G1PkI0hc5tMy0HGrgFjhaJhOI.js\', {')).toBeTruthy()
313313
})
314314

315315
describe.todo('fallbackOnSrcOnBundleFail', () => {

0 commit comments

Comments
 (0)