diff --git a/src/morphism.ts b/src/morphism.ts index ec3bcc3..27b2160 100644 --- a/src/morphism.ts +++ b/src/morphism.ts @@ -98,8 +98,7 @@ export const petitions = { type: 1, }, }), - /** - * + /** * Enhances a function with additional typings for handling HTTP requests within the 'vixeny' framework. * This function binds the provided Morphism to the rules set by `composer`, producing a typed `Petition`. * The resulting function can be used with `wrap` or can be `composed`, and it's guaranteed to return a `Response` or `Promise`. @@ -118,7 +117,7 @@ export const petitions = { * }); * ``` */ - add: < + add: < FC extends CyclePluginMap, O extends FunRouterOptions, >(o?: O) => @@ -155,7 +154,6 @@ export const petitions = { o, }) as unknown as Petition, /** - * * Enhances a function with additional typings for handling HTTP requests within the 'vixeny' framework. * This function binds the provided Morphism to the rules set by `composer`, producing a typed `Petition`. * The resulting function can be used with `wrap` or can be `composed`, and it's guaranteed to return a `Response` or `Promise`. diff --git a/src/runtime/name.ts b/src/runtime/name.ts index 8237ee2..7958974 100644 --- a/src/runtime/name.ts +++ b/src/runtime/name.ts @@ -8,21 +8,19 @@ * This function is useful for applications that need to adapt their behavior based on the runtime environment. * * ```js - * import { runtime } from 'vixeny' - * - * //logging runtime name - * console.log( - * runtime.name() - * ) + * import runtime from './runtime'; * + * // Logging runtime name + * console.log(runtime()); * ``` */ - +//@ts-nocheck export default () => - //@ts-ignore - typeof Bun !== "undefined" + typeof globalThis.Bun !== "undefined" ? "Bun" - //@ts-ignore - : typeof Bun !== "undefined" + : typeof globalThis.Deno !== "undefined" ? "Deno" - : "Node"; + : typeof process !== "undefined" && typeof process.versions === "object" && + !!process.versions.node + ? "Node" + : "Unknown"; diff --git a/src/staticFiles/composedPaths.ts b/src/staticFiles/composedPaths.ts index 9ad1ae0..3437006 100644 --- a/src/staticFiles/composedPaths.ts +++ b/src/staticFiles/composedPaths.ts @@ -22,8 +22,8 @@ export default (o?: FunRouterOptions) => ((checks) => checks ? staticFileTools.getValidPetitionFromPlugin(o)(checks)( - root, - )(x)(name) + root, + )(x)(name) : ({ path: root.slice(1, -1) + x.slice(name.length - 1), ...mimeIsTrue(f)("." + x.split(".").at(-1)), @@ -63,7 +63,8 @@ export default (o?: FunRouterOptions) => ((checks) => checks ? staticFileTools.getValidPetitionFromPlugin(o)(checks)(root)(x)( - name) + name, + ) : ({ path: root.slice(1, -1) + x.slice(name.length - 1), type: "base", diff --git a/test/staticFile/main.test.ts b/test/staticFile/main.test.ts index b871f99..8dc34d4 100644 --- a/test/staticFile/main.test.ts +++ b/test/staticFile/main.test.ts @@ -71,12 +71,13 @@ test( template: [plugins.staticFilePlugin({ checker: (s) => s.path.includes(".png"), type: "add", - p: (options) => petitions.add()({ - path: options.relativeName.slice(0, -4), - f:() => new Response('hello') - }), + p: (options) => + petitions.add()({ + path: options.relativeName.slice(0, -4), + f: () => new Response("hello"), + }), })], - }).some(p => p.path === "/hello/nested/logo"), + }).some((p) => p.path === "/hello/nested/logo"), true, ), );