From 2ce9dd81be55441e82da38ff8fca1088e03647e5 Mon Sep 17 00:00:00 2001 From: William Killerud Date: Mon, 19 Aug 2024 12:40:55 +0200 Subject: [PATCH] fix: re-export types from podium/utils as well --- lib/layout.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/layout.js b/lib/layout.js index 03a59f9a..761aea0d 100644 --- a/lib/layout.js +++ b/lib/layout.js @@ -1,11 +1,11 @@ import { - HttpIncoming, + HttpIncoming as HttpIncomingImpl, template, isFunction, pathnameBuilder, uriIsRelative, - AssetCss, - AssetJs, + AssetCss as AssetCssImpl, + AssetJs as AssetJsImpl, } from '@podium/utils'; import * as schema from '@podium/schemas'; import Context from '@podium/context'; @@ -29,6 +29,18 @@ import fs from 'fs'; * @typedef {import('@podium/client').PodiumRedirect} PodiumRedirect * @typedef {import('@podium/client').PodletManifest} PodletManifest * @typedef {import('@podium/client').RegisterOptions} RegisterOptions + * @typedef {import('@podium/utils').AssetCss} AssetCss + * @typedef {import('@podium/utils').AssetJs} AssetJs + * @typedef {import('@podium/utils').PodiumHttpIncoming} PodiumHttpIncoming + * @typedef {import('@podium/utils').PodiumCssAsset} PodiumCssAsset + * @typedef {import('@podium/utils').PodiumJavaScriptAsset} PodiumJavaScriptAsset + */ + +/** + * @template {Record} [T=Record] + * @template {Record} [U=Record] + * @template {Record} [V=Record] + * @typedef {import('@podium/utils').HttpIncoming} HttpIncoming */ const currentDirectory = dirname(fileURLToPath(import.meta.url)); @@ -328,7 +340,7 @@ export default class PodiumLayout { ...clonedOptions, pathname: this.#pathname, }; - this.cssRoute.push(new AssetCss(args)); + this.cssRoute.push(new AssetCssImpl(args)); } /** * Set relative or absolute URLs to Cascading Style Sheets (CSS) assets for the layout. @@ -396,7 +408,7 @@ export default class PodiumLayout { args.data = data; } - this.jsRoute.push(new AssetJs(args)); + this.jsRoute.push(new AssetJsImpl(args)); } /** @@ -586,7 +598,7 @@ export default class PodiumLayout { */ middleware() { return async (req, res, next) => { - const incoming = new HttpIncoming(req, res, res.locals); + const incoming = new HttpIncomingImpl(req, res, res.locals); // @ts-expect-error The API here is a bit odd. You assign a string, but the `set` constructs a URL from it. incoming.url = `${req.protocol}://${req.get('host')}${ req.originalUrl