chore(deps): update dependency @sveltejs/kit to v2.5.25 #68

Merged
vbrandl merged 5 commits from renovate/sveltejs-kit-2.x-lockfile into main 2024-08-29 10:39:56 +02:00
2 changed files with 7 additions and 7 deletions
Showing only changes of commit 15de87432b - Show all commits

View File

@ -1,4 +1,4 @@
import { safePath, timedExecution } from '$lib';
import safePath, { timedExecution } from '$lib';
import { describe, it, expect } from 'vitest';
describe('safe path', () => {
@ -32,8 +32,8 @@ describe('safe path', () => {
});
describe('timedExecution', () => {
const asyncIdentity = async (v) => v;
const identity = (v) => v;
const asyncIdentity = async <T>(v: T): Promise<T> => v;
const identity = <T>(v: T): T => v;
it('works with async', async () => {
const { executionTime, result } = await timedExecution(() => asyncIdentity(5));

View File

@ -8,7 +8,7 @@ export const log = bunyan.createLogger({
src: true,
});
function safePath(basePath: string, name: string): boolean {
const safePath = (basePath: string, name: string): boolean => {
const fullPath = `${basePath}/${name}`;
const relative = path.relative(basePath, fullPath);
return (
@ -20,7 +20,9 @@ function safePath(basePath: string, name: string): boolean {
// result is not an absolute path
!path.isAbsolute(relative)
);
}
};
export default safePath;
const defaultPath: string = './uploads';
if (!('STORAGE_PATH' in process.env)) {
@ -30,8 +32,6 @@ export const storagePath: string = process.env.STORAGE_PATH ?? defaultPath;
export const requestIdHeader = 'x-request-id';
export default safePath;
export type MaybePromise<T> = T | Promise<T>;
export async function timedExecution<T>(