From 924534e98fb2d2d0ff7ea90aff431a1bbce9c9e0 Mon Sep 17 00:00:00 2001 From: Ayo Date: Sun, 29 Oct 2023 11:53:26 +0100 Subject: [PATCH] refactor(core): clean up return types --- packages/core/event-handler.mjs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/core/event-handler.mjs b/packages/core/event-handler.mjs index 37a3555..eda73d7 100644 --- a/packages/core/event-handler.mjs +++ b/packages/core/event-handler.mjs @@ -5,6 +5,7 @@ import { parseScript } from "esprima"; /** * @typedef {import('./define-config.mjs').McFlyConfig} McFlyConfig * @typedef {import('unstorage').Storage} Storage + * @typedef {import('unstorage').StorageValue} StorageValue * @typedef {import('ultrahtml').Node} HtmlNode * @typedef {import('estree').BaseNode} JsNode * @typedef {import('h3').EventHandler} EventHandler @@ -52,7 +53,7 @@ export function useMcFlyRoute({ config, storage }) { * Gets the correct HTML depending on the path requested * @param {string} path * @param {Storage} storage - * @returns + * @returns {Promise} */ async function getHtml(path, storage) { const rawPath = path[path.length - 1] === "/" ? path.slice(0, -1) : path; @@ -69,7 +70,7 @@ async function getHtml(path, storage) { /** * Gets the storage path for a file * @param {string} filename - * @returns string + * @returns {string} */ function getPath(filename) { return `assets:pages${filename}`; @@ -80,7 +81,7 @@ function getPath(filename) { * @param {string} html * @param {'js'} type * @param {Storage} storage - * @returns Promise + * @returns {Promise} */ async function insertRegistry(html, type, storage) { const ast = parse(html); @@ -121,7 +122,7 @@ async function insertRegistry(html, type, storage) { * @param {Array} usedCustomElements * @param {"js" | "ts"} type * @param {Storage} storage - * @returns string + * @returns {Promise} */ async function buildRegistry(usedCustomElements, type, storage) { let registryScript = `