diff --git a/.changeset/remove-unused-helpers.md b/.changeset/remove-unused-helpers.md new file mode 100644 index 000000000000..79be5f9bcd0d --- /dev/null +++ b/.changeset/remove-unused-helpers.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +chore: remove unused helpers diff --git a/packages/kit/src/exports/vite/utils.js b/packages/kit/src/exports/vite/utils.js index 81a6960a2676..996c5fbd8139 100644 --- a/packages/kit/src/exports/vite/utils.js +++ b/packages/kit/src/exports/vite/utils.js @@ -191,8 +191,6 @@ function can_export_remote_module(directory) { export const server_only_module_pattern = /[/.]server\.[^/]+$/; export const server_only_directory_pattern = /\/server\//; -export const strip_virtual_prefix = /** @param {string} id */ (id) => id.replace('\0virtual:', ''); - /** * For `error_for_missing_config('remote functions', 'experimental.remoteFunctions', 'true')`, * returns: diff --git a/packages/kit/src/utils/path.js b/packages/kit/src/utils/path.js deleted file mode 100644 index c9e19de4f721..000000000000 --- a/packages/kit/src/utils/path.js +++ /dev/null @@ -1,23 +0,0 @@ -// This file contains Node-agnostic path utilities so that it can be used in -// environments that do not have access to `node:path` (e.g. Cloudflare Workers). - -/** - * @param {string} from - * @param {string} to - * @returns {string} - */ -export function relative(from, to) { - const from_parts = from.split('/').filter(Boolean); - const to_parts = to.split('/').filter(Boolean); - let i = 0; - while (i < from_parts.length && i < to_parts.length && from_parts[i] === to_parts[i]) i++; - return [...Array(from_parts.length - i).fill('..'), ...to_parts.slice(i)].join('/') || '.'; -} - -/** - * @param {...string} parts - * @returns {string} - */ -export function join(...parts) { - return parts.join('/'); -} diff --git a/packages/kit/src/utils/path.spec.js b/packages/kit/src/utils/path.spec.js deleted file mode 100644 index cfadb5a62247..000000000000 --- a/packages/kit/src/utils/path.spec.js +++ /dev/null @@ -1,32 +0,0 @@ -import { assert, describe } from 'vitest'; -import { relative } from './path.js'; - -describe('relative', (test) => { - test('same path returns .', () => { - assert.equal(relative('/a/b/c', '/a/b/c'), '.'); - }); - - test('sibling path', () => { - assert.equal(relative('/a/b', '/a/c'), '../c'); - }); - - test('child path', () => { - assert.equal(relative('/a', '/a/b/c'), 'b/c'); - }); - - test('parent path', () => { - assert.equal(relative('/a/b/c', '/a'), '../..'); - }); - - test('unrelated paths', () => { - assert.equal(relative('/a/b', '/c/d'), '../../c/d'); - }); - - test('root to child', () => { - assert.equal(relative('/', '/a/b'), 'a/b'); - }); - - test('child to root', () => { - assert.equal(relative('/a/b', '/'), '../..'); - }); -}); diff --git a/packages/kit/src/utils/url.js b/packages/kit/src/utils/url.js index f9de4a596e6b..3eef1bbea9a3 100644 --- a/packages/kit/src/utils/url.js +++ b/packages/kit/src/utils/url.js @@ -82,17 +82,6 @@ export function decode_pathname(pathname) { return pathname.split('%25').map(decodeURI).join('%25'); } -/** @param {Record} params */ -export function decode_params(params) { - for (const key in params) { - // input has already been decoded by decodeURI - // now handle the rest - params[key] = decodeURIComponent(params[key]); - } - - return params; -} - /** * The error when a URL is malformed is not very helpful, so we augment it with the URI * @param {string} uri