@@ -136,7 +136,7 @@ class ProjectPreprocessor {
136136
137137 if ( project . kind === "extension" ) {
138138 // Not a project but an extension
139- // => remove it as from any known projects that depend on it
139+ // => remove it from any known projects that depend on it
140140 const parents = this . processedProjects [ project . id ] . parents ;
141141 for ( let i = parents . length - 1 ; i >= 0 ; i -- ) {
142142 parents [ i ] . dependencies . splice ( parents [ i ] . dependencies . indexOf ( project ) , 1 ) ;
@@ -272,7 +272,7 @@ class ProjectPreprocessor {
272272 return false ; // ignore this project
273273 }
274274
275- if ( project . specVersion !== "0.1" && project . specVersion !== "1.0" ) {
275+ if ( project . specVersion !== "0.1" && project . specVersion !== "1.0" && project . specVersion !== "1.1a" ) {
276276 throw new Error (
277277 `Unsupported specification version ${ project . specVersion } defined for project ` +
278278 `${ project . id } . ` +
@@ -330,7 +330,8 @@ class ProjectPreprocessor {
330330
331331 if ( ! extension . specVersion ) {
332332 throw new Error ( `No specification version defined for extension ${ extension . metadata . name } ` ) ;
333- } else if ( extension . specVersion !== "0.1" && extension . specVersion !== "1.0" ) {
333+ } else if ( extension . specVersion !== "0.1" && extension . specVersion !== "1.0" &&
334+ extension . specVersion !== "1.1a" ) {
334335 throw new Error (
335336 `Unsupported specification version ${ extension . specVersion } defined for extension ` +
336337 `${ extension . metadata . name } . ` +
@@ -354,6 +355,13 @@ class ProjectPreprocessor {
354355 case "server-middleware" :
355356 this . handleServerMiddleware ( extension ) ;
356357 break ;
358+ case "proxy-configuration" :
359+ if ( extension . specVersion !== "1.1a" ) {
360+ throw new Error ( `Extensions of type "proxy-configuration"
361+ must use specification version "1.1a"` ) ;
362+ }
363+ this . handleProxyConfiguration ( extension ) ;
364+ break ;
357365 default :
358366 throw new Error ( `Unknown extension type '${ extension . type } ' for ${ extension . id } ` ) ;
359367 }
@@ -514,6 +522,17 @@ class ProjectPreprocessor {
514522 const middlewarePath = path . join ( extension . path , extension . middleware . path ) ;
515523 middlewareRepository . addMiddleware ( extension . metadata . name , middlewarePath ) ;
516524 }
525+
526+ handleProxyConfiguration ( extension ) {
527+ if ( ! extension . metadata && ! extension . metadata . name ) {
528+ throw new Error ( `Proxy configuration extension ${ extension . id } is missing 'metadata.name' configuration` ) ;
529+ }
530+ if ( ! extension . proxy || ! extension . proxy . configuration ) {
531+ throw new Error ( `Proxy configuration extension ${ extension . id } is missing 'proxy' configuration` ) ;
532+ }
533+ const { proxyConfiguration} = require ( "@ui5/server" ) ;
534+ proxyConfiguration . addConfiguration ( extension . metadata . name , extension . proxy . configuration ) ;
535+ }
517536}
518537
519538/**
0 commit comments