From b11c73b9ccb41f1a07a787af3eafe4aa2fa945a5 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 27 Jul 2023 22:49:35 +0200 Subject: [PATCH 01/14] fix(nuxt): use correct `javascript` protocol --- packages/nuxt/src/app/composables/router.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nuxt/src/app/composables/router.ts b/packages/nuxt/src/app/composables/router.ts index 131fa17858ad..9767a480669f 100644 --- a/packages/nuxt/src/app/composables/router.ts +++ b/packages/nuxt/src/app/composables/router.ts @@ -136,8 +136,8 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na if (isExternal && !options?.external) { throw new Error('Navigating to external URL is not allowed by default. Use `navigateTo (url, { external: true })`.') } - if (isExternal && parseURL(toPath).protocol === 'script:') { - throw new Error('Cannot navigate to an URL with script protocol.') + if (isExternal && parseURL(toPath).protocol === 'javascript:') { + throw new Error('Cannot navigate to an URL with javascript protocol.') } const inMiddleware = isProcessingMiddleware() From b4db27fbb249cb2f46c8ede0262576428ec997d9 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 27 Jul 2023 23:16:45 +0200 Subject: [PATCH 02/14] Update packages/nuxt/src/app/composables/router.ts --- packages/nuxt/src/app/composables/router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nuxt/src/app/composables/router.ts b/packages/nuxt/src/app/composables/router.ts index 9767a480669f..272009398fe8 100644 --- a/packages/nuxt/src/app/composables/router.ts +++ b/packages/nuxt/src/app/composables/router.ts @@ -136,7 +136,7 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na if (isExternal && !options?.external) { throw new Error('Navigating to external URL is not allowed by default. Use `navigateTo (url, { external: true })`.') } - if (isExternal && parseURL(toPath).protocol === 'javascript:') { + if (isExternal && /^data:javascript:|vbscript:$/.test(parseURL(toPath).protocol)) { throw new Error('Cannot navigate to an URL with javascript protocol.') } From afd885d35484a607e38f212bcb4e986962b4eb2b Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 27 Jul 2023 23:21:05 +0200 Subject: [PATCH 03/14] Apply suggestions from code review --- packages/nuxt/src/app/composables/router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nuxt/src/app/composables/router.ts b/packages/nuxt/src/app/composables/router.ts index 272009398fe8..198eee685238 100644 --- a/packages/nuxt/src/app/composables/router.ts +++ b/packages/nuxt/src/app/composables/router.ts @@ -136,7 +136,7 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na if (isExternal && !options?.external) { throw new Error('Navigating to external URL is not allowed by default. Use `navigateTo (url, { external: true })`.') } - if (isExternal && /^data:javascript:|vbscript:$/.test(parseURL(toPath).protocol)) { + if (isExternal && /^data:javascript:|vbscript:$/.test(parseURL(toPath).protocol || '')) { throw new Error('Cannot navigate to an URL with javascript protocol.') } From b8fbb7bffc7a988333bb8236f02731eac7cf8c60 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 28 Jul 2023 00:49:06 +0200 Subject: [PATCH 04/14] Update packages/nuxt/src/app/composables/router.ts --- packages/nuxt/src/app/composables/router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nuxt/src/app/composables/router.ts b/packages/nuxt/src/app/composables/router.ts index 198eee685238..655b8a7b329b 100644 --- a/packages/nuxt/src/app/composables/router.ts +++ b/packages/nuxt/src/app/composables/router.ts @@ -136,7 +136,7 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na if (isExternal && !options?.external) { throw new Error('Navigating to external URL is not allowed by default. Use `navigateTo (url, { external: true })`.') } - if (isExternal && /^data:javascript:|vbscript:$/.test(parseURL(toPath).protocol || '')) { + if (isExternal && /^(data|javascript|vbscript):$/.test(parseURL(toPath).protocol || '')) { throw new Error('Cannot navigate to an URL with javascript protocol.') } From 681fdba51ef5b347580d6326bf49b73d63bb0b1c Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 28 Jul 2023 09:20:10 +0200 Subject: [PATCH 05/14] refactor: extract regexp + avoid invoking if no protocol --- packages/nuxt/src/app/composables/router.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/nuxt/src/app/composables/router.ts b/packages/nuxt/src/app/composables/router.ts index 655b8a7b329b..8a2dcb045c1c 100644 --- a/packages/nuxt/src/app/composables/router.ts +++ b/packages/nuxt/src/app/composables/router.ts @@ -109,6 +109,12 @@ export interface NavigateToOptions { open?: OpenOptions } +const SCRIPT_PROTOCOLS_RE = /^(data|javascript|vbscript):$/ +function hasScriptProtocol (url: string) { + const protocol = parseURL(url).protocol + return !!protocol && SCRIPT_PROTOCOLS_RE.test(protocol) +} + export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: NavigateToOptions): Promise | false | void | RouteLocationRaw => { if (!to) { to = '/' @@ -136,7 +142,7 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na if (isExternal && !options?.external) { throw new Error('Navigating to external URL is not allowed by default. Use `navigateTo (url, { external: true })`.') } - if (isExternal && /^(data|javascript|vbscript):$/.test(parseURL(toPath).protocol || '')) { + if (isExternal && hasScriptProtocol(toPath)) { throw new Error('Cannot navigate to an URL with javascript protocol.') } From af5b4a34a1d225671032d2742a33f875979272ea Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Fri, 28 Jul 2023 07:24:20 +0000 Subject: [PATCH 06/14] [autofix.ci] apply automated fixes --- test/bundle.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/bundle.test.ts b/test/bundle.test.ts index 2b4c07ba6e92..4baed06af90a 100644 --- a/test/bundle.test.ts +++ b/test/bundle.test.ts @@ -19,7 +19,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM for (const outputDir of ['.output', '.output-inline']) { it('default client bundle size', async () => { const clientStats = await analyzeSizes('**/*.js', join(rootDir, outputDir, 'public')) - expect.soft(roundToKilobytes(clientStats.totalBytes)).toMatchInlineSnapshot('"97.3k"') + expect.soft(roundToKilobytes(clientStats.totalBytes)).toMatchInlineSnapshot('"97.4k"') expect(clientStats.files.map(f => f.replace(/\..*\.js/, '.js'))).toMatchInlineSnapshot(` [ "_nuxt/entry.js", @@ -32,7 +32,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM const serverDir = join(rootDir, '.output/server') const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir) - expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot('"64.4k"') + expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot('"64.6k"') const modules = await analyzeSizes('node_modules/**/*', serverDir) expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"2330k"') From e10e952503039a0cf0dda49ed8dab8bf7953732d Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sat, 29 Jul 2023 08:50:45 +0200 Subject: [PATCH 07/14] chore: bump ufo --- package.json | 2 +- packages/nuxi/package.json | 2 +- packages/nuxt/package.json | 2 +- packages/nuxt/src/app/composables/router.ts | 21 +++++----- packages/schema/package.json | 2 +- packages/test-utils/package.json | 2 +- packages/vite/package.json | 2 +- packages/webpack/package.json | 2 +- pnpm-lock.yaml | 43 +++++++++++---------- 9 files changed, 39 insertions(+), 39 deletions(-) diff --git a/package.json b/package.json index 68f42dc8d02d..9cafb9f1852a 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "semver": "7.5.4", "std-env": "3.3.3", "typescript": "5.0.4", - "ufo": "1.1.2", + "ufo": "1.2.0", "vite": "4.4.7", "vitest": "0.33.0", "vitest-environment-nuxt": "0.10.2", diff --git a/packages/nuxi/package.json b/packages/nuxi/package.json index 656e3ebc1523..f540a3eacb5d 100644 --- a/packages/nuxi/package.json +++ b/packages/nuxi/package.json @@ -47,7 +47,7 @@ "pkg-types": "1.0.3", "scule": "1.0.0", "semver": "7.5.4", - "ufo": "1.1.2", + "ufo": "1.2.0", "unbuild": "latest" }, "optionalDependencies": { diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index 18599013bdd1..b7005aa026e2 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -91,7 +91,7 @@ "prompts": "^2.4.2", "scule": "^1.0.0", "strip-literal": "^1.0.1", - "ufo": "^1.1.2", + "ufo": "^1.2.0", "ultrahtml": "^1.3.0", "uncrypto": "^0.1.3", "unctx": "^2.3.1", diff --git a/packages/nuxt/src/app/composables/router.ts b/packages/nuxt/src/app/composables/router.ts index 8a2dcb045c1c..22e2f0087bfc 100644 --- a/packages/nuxt/src/app/composables/router.ts +++ b/packages/nuxt/src/app/composables/router.ts @@ -2,7 +2,7 @@ import { getCurrentInstance, hasInjectionContext, inject, onUnmounted } from 'vu import type { Ref } from 'vue' import type { NavigationFailure, NavigationGuard, RouteLocationNormalized, RouteLocationPathRaw, RouteLocationRaw, Router, useRoute as _useRoute, useRouter as _useRouter } from '#vue-router' import { sanitizeStatusCode } from 'h3' -import { hasProtocol, joinURL, parseURL, withQuery } from 'ufo' +import { hasProtocol, isScriptProtocol, joinURL, parseURL, withQuery } from 'ufo' import { useNuxtApp, useRuntimeConfig } from '../nuxt' import type { NuxtError } from './error' @@ -109,12 +109,6 @@ export interface NavigateToOptions { open?: OpenOptions } -const SCRIPT_PROTOCOLS_RE = /^(data|javascript|vbscript):$/ -function hasScriptProtocol (url: string) { - const protocol = parseURL(url).protocol - return !!protocol && SCRIPT_PROTOCOLS_RE.test(protocol) -} - export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: NavigateToOptions): Promise | false | void | RouteLocationRaw => { if (!to) { to = '/' @@ -139,11 +133,14 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na } const isExternal = options?.external || hasProtocol(toPath, { acceptRelative: true }) - if (isExternal && !options?.external) { - throw new Error('Navigating to external URL is not allowed by default. Use `navigateTo (url, { external: true })`.') - } - if (isExternal && hasScriptProtocol(toPath)) { - throw new Error('Cannot navigate to an URL with javascript protocol.') + if (isExternal) { + if (!options?.external) { + throw new Error('Navigating to external URL is not allowed by default. Use `navigateTo (url, { external: true })`.') + } + const protocol = parseURL(toPath).protocol + if (protocol && isScriptProtocol(protocol)) { + throw new Error('Cannot navigate to an URL with javascript protocol.') + } } const inMiddleware = isProcessingMiddleware() diff --git a/packages/schema/package.json b/packages/schema/package.json index 30edc67a79bf..4bd30b49a6ad 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -56,7 +56,7 @@ "pkg-types": "^1.0.3", "postcss-import-resolver": "^2.0.0", "std-env": "^3.3.3", - "ufo": "^1.1.2", + "ufo": "^1.2.0", "unimport": "^3.1.0", "untyped": "^1.3.2" }, diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index 08176b7c59ec..d696e4ad9064 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -30,7 +30,7 @@ "get-port-please": "^3.0.1", "ofetch": "^1.1.1", "pathe": "^1.1.1", - "ufo": "^1.1.2" + "ufo": "^1.2.0" }, "devDependencies": { "@jest/globals": "29.6.1", diff --git a/packages/vite/package.json b/packages/vite/package.json index 8b7e94fc2d1e..fff0a6cb25cd 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -55,7 +55,7 @@ "rollup-plugin-visualizer": "^5.9.2", "std-env": "^3.3.3", "strip-literal": "^1.0.1", - "ufo": "^1.1.2", + "ufo": "^1.2.0", "unplugin": "^1.4.0", "vite": "^4.4.7", "vite-node": "^0.33.0", diff --git a/packages/webpack/package.json b/packages/webpack/package.json index 283bb9c8a27b..c6bdebea70f1 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -49,7 +49,7 @@ "pug-plain-loader": "^1.1.0", "std-env": "^3.3.3", "time-fix-plugin": "^2.0.7", - "ufo": "^1.1.2", + "ufo": "^1.2.0", "unplugin": "^1.4.0", "url-loader": "^4.1.1", "vue-bundle-renderer": "^1.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e9836020a44f..dc9556ead45a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -126,8 +126,8 @@ importers: specifier: 5.0.4 version: 5.0.4 ufo: - specifier: 1.1.2 - version: 1.1.2 + specifier: 1.2.0 + version: 1.2.0 vite: specifier: 4.4.7 version: 4.4.7(@types/node@18.17.0) @@ -326,8 +326,8 @@ importers: specifier: 7.5.4 version: 7.5.4 ufo: - specifier: 1.1.2 - version: 1.1.2 + specifier: 1.2.0 + version: 1.2.0 unbuild: specifier: latest version: 1.2.1 @@ -455,8 +455,8 @@ importers: specifier: ^1.0.1 version: 1.0.1 ufo: - specifier: ^1.1.2 - version: 1.1.2 + specifier: ^1.2.0 + version: 1.2.0 ultrahtml: specifier: ^1.3.0 version: 1.3.0 @@ -543,8 +543,8 @@ importers: specifier: ^3.3.3 version: 3.3.3 ufo: - specifier: ^1.1.2 - version: 1.1.2 + specifier: ^1.2.0 + version: 1.2.0 unimport: specifier: ^3.1.0 version: 3.1.0(rollup@3.26.3) @@ -643,8 +643,8 @@ importers: specifier: ^1.1.1 version: 1.1.1 ufo: - specifier: ^1.1.2 - version: 1.1.2 + specifier: ^1.2.0 + version: 1.2.0 vue: specifier: ^3.3.4 version: 3.3.4 @@ -752,8 +752,8 @@ importers: specifier: ^1.0.1 version: 1.0.1 ufo: - specifier: ^1.1.2 - version: 1.1.2 + specifier: ^1.2.0 + version: 1.2.0 unplugin: specifier: ^1.4.0 version: 1.4.0 @@ -882,8 +882,8 @@ importers: specifier: ^2.0.7 version: 2.0.7(webpack@5.88.2) ufo: - specifier: ^1.1.2 - version: 1.1.2 + specifier: ^1.2.0 + version: 1.2.0 unplugin: specifier: ^1.4.0 version: 1.4.0 @@ -5026,7 +5026,7 @@ packages: enhanced-resolve: 5.15.0 mlly: 1.4.0 pathe: 1.1.1 - ufo: 1.1.2 + ufo: 1.2.0 dev: false /fast-deep-equal@3.1.3: @@ -5470,7 +5470,7 @@ packages: destr: 2.0.0 iron-webcrypto: 0.7.0 radix3: 1.0.1 - ufo: 1.1.2 + ufo: 1.2.0 uncrypto: 0.1.3 /happy-dom@10.5.2: @@ -6211,7 +6211,7 @@ packages: mlly: 1.4.0 node-forge: 1.3.1 pathe: 1.1.1 - ufo: 1.1.2 + ufo: 1.2.0 /loader-runner@4.3.0: resolution: {integrity: sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==} @@ -6884,7 +6884,7 @@ packages: dependencies: destr: 2.0.0 node-fetch-native: 1.2.0 - ufo: 1.1.2 + ufo: 1.2.0 /ohash@1.1.2: resolution: {integrity: sha512-9CIOSq5945rI045GFtcO3uudyOkYVY1nyfFxVQp+9BRgslr8jPNiSSrsFGg/BNTUFOLqx0P5tng6G32brIPw0w==} @@ -8550,6 +8550,9 @@ packages: /ufo@1.1.2: resolution: {integrity: sha512-TrY6DsjTQQgyS3E3dBaOXf0TpPD8u9FVrVYmKVegJuFw51n/YB9XPt+U6ydzFG5ZIN7+DIjPbNmXoBj9esYhgQ==} + /ufo@1.2.0: + resolution: {integrity: sha512-RsPyTbqORDNDxqAdQPQBpgqhWle1VcTSou/FraClYlHf6TZnQcGslpLcAphNR+sQW4q5lLWLbOsRlh9j24baQg==} + /ultrahtml@1.3.0: resolution: {integrity: sha512-xmXvE8tC8t4PVqy0/g1fe7H9USY/Brr425q4dD/0QbQMQit7siCtb06+SCqE4GfU24nwsZz8Th1g7L7mm1lL5g==} dev: false @@ -8730,7 +8733,7 @@ packages: mri: 1.2.0 node-fetch-native: 1.2.0 ofetch: 1.1.1 - ufo: 1.1.2 + ufo: 1.2.0 transitivePeerDependencies: - supports-color @@ -9056,7 +9059,7 @@ packages: /vue-bundle-renderer@1.0.3: resolution: {integrity: sha512-EfjX+5TTUl70bki9hPuVp+54JiZOvFIfoWBcfXsSwLzKEiDYyHNi5iX8srnqLIv3YRnvxgbntdcG1WPq0MvffQ==} dependencies: - ufo: 1.1.2 + ufo: 1.2.0 /vue-component-type-helpers@1.6.5: resolution: {integrity: sha512-iGdlqtajmiqed8ptURKPJ/Olz0/mwripVZszg6tygfZSIL9kYFPJTNY6+Q6OjWGznl2L06vxG5HvNvAnWrnzbg==} From 30b95ea716772717fc02af31f2cce25273bc09a2 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sat, 29 Jul 2023 06:54:29 +0000 Subject: [PATCH 08/14] [autofix.ci] apply automated fixes --- test/bundle.test.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/bundle.test.ts b/test/bundle.test.ts index 4baed06af90a..5dcb46867efb 100644 --- a/test/bundle.test.ts +++ b/test/bundle.test.ts @@ -32,10 +32,10 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM const serverDir = join(rootDir, '.output/server') const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir) - expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot('"64.6k"') + expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot('"64.5k"') const modules = await analyzeSizes('node_modules/**/*', serverDir) - expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"2330k"') + expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"2377k"') const packages = modules.files .filter(m => m.endsWith('package.json')) @@ -62,6 +62,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM "devalue", "estree-walker", "h3", + "h3/node_modules/ufo", "has-flag", "hookable", "http-graceful-shutdown", @@ -70,6 +71,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM "ms", "node-fetch-native", "ofetch", + "ofetch/node_modules/ufo", "ohash", "pathe", "radix3", @@ -84,6 +86,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM "unstorage", "vue", "vue-bundle-renderer", + "vue-bundle-renderer/node_modules/ufo", ] `) }) @@ -95,7 +98,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot('"370k"') const modules = await analyzeSizes('node_modules/**/*', serverDir) - expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"591k"') + expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"622k"') const packages = modules.files .filter(m => m.endsWith('package.json')) @@ -112,6 +115,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM "destr", "devalue", "h3", + "h3/node_modules/ufo", "has-flag", "hookable", "http-graceful-shutdown", @@ -120,6 +124,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM "ms", "node-fetch-native", "ofetch", + "ofetch/node_modules/ufo", "ohash", "pathe", "radix3", From 33dc93f72c5e5bd95badeceda15a27ada04ecf24 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sat, 29 Jul 2023 08:59:52 +0200 Subject: [PATCH 09/14] chore: dedupe ufo --- pnpm-lock.yaml | 9 +++------ test/bundle.test.ts | 11 +++-------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dc9556ead45a..68d875223320 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -966,7 +966,7 @@ importers: devDependencies: ufo: specifier: latest - version: 1.1.2 + version: 1.2.0 unplugin: specifier: latest version: 1.4.0 @@ -6580,7 +6580,7 @@ packages: acorn: 8.10.0 pathe: 1.1.1 pkg-types: 1.0.3 - ufo: 1.1.2 + ufo: 1.2.0 /mri@1.2.0: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} @@ -6686,7 +6686,7 @@ packages: serve-static: 1.15.0 source-map-support: 0.5.21 std-env: 3.3.3 - ufo: 1.1.2 + ufo: 1.2.0 uncrypto: 0.1.3 unenv: 1.5.2 unimport: 3.1.0(rollup@3.26.3) @@ -8547,9 +8547,6 @@ packages: resolution: {integrity: sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==} dev: true - /ufo@1.1.2: - resolution: {integrity: sha512-TrY6DsjTQQgyS3E3dBaOXf0TpPD8u9FVrVYmKVegJuFw51n/YB9XPt+U6ydzFG5ZIN7+DIjPbNmXoBj9esYhgQ==} - /ufo@1.2.0: resolution: {integrity: sha512-RsPyTbqORDNDxqAdQPQBpgqhWle1VcTSou/FraClYlHf6TZnQcGslpLcAphNR+sQW4q5lLWLbOsRlh9j24baQg==} diff --git a/test/bundle.test.ts b/test/bundle.test.ts index 5dcb46867efb..3f6ea0c161d9 100644 --- a/test/bundle.test.ts +++ b/test/bundle.test.ts @@ -32,10 +32,10 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM const serverDir = join(rootDir, '.output/server') const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir) - expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot('"64.5k"') + expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot('"64.4k"') const modules = await analyzeSizes('node_modules/**/*', serverDir) - expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"2377k"') + expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"2330k"') const packages = modules.files .filter(m => m.endsWith('package.json')) @@ -62,7 +62,6 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM "devalue", "estree-walker", "h3", - "h3/node_modules/ufo", "has-flag", "hookable", "http-graceful-shutdown", @@ -71,7 +70,6 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM "ms", "node-fetch-native", "ofetch", - "ofetch/node_modules/ufo", "ohash", "pathe", "radix3", @@ -86,7 +84,6 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM "unstorage", "vue", "vue-bundle-renderer", - "vue-bundle-renderer/node_modules/ufo", ] `) }) @@ -98,7 +95,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot('"370k"') const modules = await analyzeSizes('node_modules/**/*', serverDir) - expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"622k"') + expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"591k"') const packages = modules.files .filter(m => m.endsWith('package.json')) @@ -115,7 +112,6 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM "destr", "devalue", "h3", - "h3/node_modules/ufo", "has-flag", "hookable", "http-graceful-shutdown", @@ -124,7 +120,6 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM "ms", "node-fetch-native", "ofetch", - "ofetch/node_modules/ufo", "ohash", "pathe", "radix3", From c9b6469f131c24cf0152b98300658bcdb32abe18 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sat, 29 Jul 2023 07:03:24 +0000 Subject: [PATCH 10/14] [autofix.ci] apply automated fixes --- test/bundle.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/bundle.test.ts b/test/bundle.test.ts index 3f6ea0c161d9..ad59f13d564f 100644 --- a/test/bundle.test.ts +++ b/test/bundle.test.ts @@ -32,7 +32,7 @@ describe.skipIf(process.env.SKIP_BUNDLE_SIZE === 'true' || process.env.ECOSYSTEM const serverDir = join(rootDir, '.output/server') const serverStats = await analyzeSizes(['**/*.mjs', '!node_modules'], serverDir) - expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot('"64.4k"') + expect.soft(roundToKilobytes(serverStats.totalBytes)).toMatchInlineSnapshot('"64.5k"') const modules = await analyzeSizes('node_modules/**/*', serverDir) expect.soft(roundToKilobytes(modules.totalBytes)).toMatchInlineSnapshot('"2330k"') From 84e8357ee814a13cc223de0fea5659f82437f6d8 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sat, 29 Jul 2023 20:02:54 +0100 Subject: [PATCH 11/14] Update packages/nuxt/src/app/composables/router.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Damian Głowala <48835293+DamianGlowala@users.noreply.github.com> --- packages/nuxt/src/app/composables/router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nuxt/src/app/composables/router.ts b/packages/nuxt/src/app/composables/router.ts index 22e2f0087bfc..2a7cebce088d 100644 --- a/packages/nuxt/src/app/composables/router.ts +++ b/packages/nuxt/src/app/composables/router.ts @@ -139,7 +139,7 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na } const protocol = parseURL(toPath).protocol if (protocol && isScriptProtocol(protocol)) { - throw new Error('Cannot navigate to an URL with javascript protocol.') + throw new Error(`Cannot navigate to a URL with '${protocol}:' protocol.`) } } From 9e382495128da9b31635f0100598ea6bf0fb36d1 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sat, 29 Jul 2023 20:03:09 +0100 Subject: [PATCH 12/14] Update packages/nuxt/src/app/composables/router.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Damian Głowala <48835293+DamianGlowala@users.noreply.github.com> --- packages/nuxt/src/app/composables/router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nuxt/src/app/composables/router.ts b/packages/nuxt/src/app/composables/router.ts index 2a7cebce088d..e51724b3e320 100644 --- a/packages/nuxt/src/app/composables/router.ts +++ b/packages/nuxt/src/app/composables/router.ts @@ -135,7 +135,7 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na const isExternal = options?.external || hasProtocol(toPath, { acceptRelative: true }) if (isExternal) { if (!options?.external) { - throw new Error('Navigating to external URL is not allowed by default. Use `navigateTo (url, { external: true })`.') + throw new Error('Navigating to an external URL is not allowed by default. Use `navigateTo (url, { external: true })`.') } const protocol = parseURL(toPath).protocol if (protocol && isScriptProtocol(protocol)) { From 1ec00d6b781bfde8eabbd267465c013073daa2bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20G=C5=82owala?= <48835293+DamianGlowala@users.noreply.github.com> Date: Sat, 29 Jul 2023 21:10:54 +0200 Subject: [PATCH 13/14] fix: remove extra colon already included in the protocol --- packages/nuxt/src/app/composables/router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nuxt/src/app/composables/router.ts b/packages/nuxt/src/app/composables/router.ts index e51724b3e320..57dc5ffb29fd 100644 --- a/packages/nuxt/src/app/composables/router.ts +++ b/packages/nuxt/src/app/composables/router.ts @@ -139,7 +139,7 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na } const protocol = parseURL(toPath).protocol if (protocol && isScriptProtocol(protocol)) { - throw new Error(`Cannot navigate to a URL with '${protocol}:' protocol.`) + throw new Error(`Cannot navigate to a URL with '${protocol}' protocol.`) } } From 13c9dde89d415fb00a2b9e1fcc8b4209b6d16dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20G=C5=82owala?= <48835293+DamianGlowala@users.noreply.github.com> Date: Sun, 30 Jul 2023 11:37:58 +0200 Subject: [PATCH 14/14] Update router.ts --- packages/nuxt/src/app/composables/router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nuxt/src/app/composables/router.ts b/packages/nuxt/src/app/composables/router.ts index 57dc5ffb29fd..905ffe63a8bf 100644 --- a/packages/nuxt/src/app/composables/router.ts +++ b/packages/nuxt/src/app/composables/router.ts @@ -135,7 +135,7 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na const isExternal = options?.external || hasProtocol(toPath, { acceptRelative: true }) if (isExternal) { if (!options?.external) { - throw new Error('Navigating to an external URL is not allowed by default. Use `navigateTo (url, { external: true })`.') + throw new Error('Navigating to an external URL is not allowed by default. Use `navigateTo(url, { external: true })`.') } const protocol = parseURL(toPath).protocol if (protocol && isScriptProtocol(protocol)) {