UNPKG

@leafage/server

Version:

The React Server Side Render Framework

29 lines (26 loc) 903 B
/** * @leafage/server v1.3.2 * * Copyright (c) Leafage. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ import path from 'node:path'; import { utils } from '@leafage/toolkit'; import { useMiddleware as _useMiddleware } from '../common/utils.js'; var staticPreset = function staticPreset(ctx) { var staticList = utils.toArray(ctx.context.options.server["static"]).filter(Boolean); if (!ctx.context.options.dev && !/^https?:\/\//.test(ctx.context.options.builder.publicPath)) { staticList.push({ path: ctx.context.options.builder.publicPath, handle: path.join(ctx.context.options.dir.root, ctx.context.options.dir.dist, ctx.context.options.dir.client) }); } staticList.forEach(function (row) { return _useMiddleware(ctx, row); }); }; export { staticPreset };