1- import express from "express" ;
21import jsYaml from "js-yaml" ;
32import bootstrapJson from "./bootstrapJson.js" ;
43import mockAuth from "./mockAuth.js" ;
54import singleAppBootstrapJson from "./singleAppBootstrapJson.js" ;
65import standaloneBootstrapJson from "./standaloneBootstrapJson.js" ;
76import serveBricksWithVersions from "./serveBricksWithVersions.js" ;
7+ import { serveBricks } from "@next-core/serve-helpers" ;
88
99const { safeDump, JSON_SCHEMA } = jsYaml ;
1010
@@ -34,7 +34,7 @@ export function getMiddlewares(env) {
3434 } ) ;
3535 middlewares . push ( {
3636 path : `${ baseHref } api/v1/runtime_standalone` ,
37- middleware ( req , res ) {
37+ middleware ( _req , res ) {
3838 res . send ( {
3939 code : 0 ,
4040 data : {
@@ -45,7 +45,7 @@ export function getMiddlewares(env) {
4545 } ) ;
4646 middlewares . push ( {
4747 path : `${ baseHref } api/gateway/micro_app_standalone.runtime.RuntimeMicroAppStandalone/api/v1/micro_app_standalone/runtime/:appId` ,
48- middleware ( req , res ) {
48+ middleware ( _req , res ) {
4949 res . send ( {
5050 code : 0 ,
5151 data : null ,
@@ -54,7 +54,7 @@ export function getMiddlewares(env) {
5454 } ) ;
5555 middlewares . push ( {
5656 path : `${ baseHref } api/gateway/data_exchange.store.ClickHouseInsertData/api/v1/data_exchange/frontend_stat` ,
57- middleware ( req , res ) {
57+ middleware ( _req , res ) {
5858 res . send ( {
5959 code : 0 ,
6060 data : null ,
@@ -67,7 +67,7 @@ export function getMiddlewares(env) {
6767}
6868
6969export function getPreMiddlewares ( env ) {
70- const { baseHref, localMicroApps, localBrickFolders , userConfigByApps } = env ;
70+ const { baseHref, localMicroApps, userConfigByApps } = env ;
7171
7272 /**
7373 * @type {import("webpack-dev-server").Middleware[] }
@@ -81,7 +81,7 @@ export function getPreMiddlewares(env) {
8181 } ) ;
8282 middlewares . push ( {
8383 path : `${ baseHref } sa-static/${ appId } /versions/0.0.0/webroot/conf.yaml` ,
84- middleware ( req , res ) {
84+ middleware ( _req , res ) {
8585 if ( userConfigByApps ) {
8686 const conf = {
8787 user_config_by_apps : userConfigByApps ,
@@ -108,12 +108,10 @@ export function getPreMiddlewares(env) {
108108 middleware : serveBricksWithVersions ( env ) ,
109109 } ) ;
110110
111- for ( const dir of localBrickFolders ) {
112- middlewares . push ( {
113- path : `${ baseHref } bricks/` ,
114- middleware : express . static ( dir ) ,
115- } ) ;
116- }
111+ middlewares . push ( {
112+ path : `${ baseHref } bricks/` ,
113+ middleware : serveBricks ( env ) ,
114+ } ) ;
117115
118116 return middlewares ;
119117}
0 commit comments