@@ -133,7 +133,7 @@ class ProjectPreprocessor {
133
133
134
134
if ( project . kind === "extension" ) {
135
135
// Not a project but an extension
136
- // => remove it as from any known projects that depend on it
136
+ // => remove it from any known projects that depend on it
137
137
const parents = this . processedProjects [ project . id ] . parents ;
138
138
for ( let i = parents . length - 1 ; i >= 0 ; i -- ) {
139
139
parents [ i ] . dependencies . splice ( parents [ i ] . dependencies . indexOf ( project ) , 1 ) ;
@@ -269,7 +269,7 @@ class ProjectPreprocessor {
269
269
return false ; // ignore this project
270
270
}
271
271
272
- if ( project . specVersion !== "0.1" && project . specVersion !== "1.0" ) {
272
+ if ( project . specVersion !== "0.1" && project . specVersion !== "1.0" && project . specVersion !== "1.1a" ) {
273
273
throw new Error (
274
274
`Unsupported specification version ${ project . specVersion } defined for project ` +
275
275
`${ project . id } . ` +
@@ -327,7 +327,8 @@ class ProjectPreprocessor {
327
327
328
328
if ( ! extension . specVersion ) {
329
329
throw new Error ( `No specification version defined for extension ${ extension . metadata . name } ` ) ;
330
- } else if ( extension . specVersion !== "0.1" && extension . specVersion !== "1.0" ) {
330
+ } else if ( extension . specVersion !== "0.1" && extension . specVersion !== "1.0" &&
331
+ extension . specVersion !== "1.1a" ) {
331
332
throw new Error (
332
333
`Unsupported specification version ${ extension . specVersion } defined for extension ` +
333
334
`${ extension . metadata . name } . ` +
@@ -351,6 +352,13 @@ class ProjectPreprocessor {
351
352
case "server-middleware" :
352
353
this . handleServerMiddleware ( extension ) ;
353
354
break ;
355
+ case "proxy-configuration" :
356
+ if ( extension . specVersion !== "1.1a" ) {
357
+ throw new Error ( `Extensions of type "proxy-configuration"
358
+ must use specification version "1.1a"` ) ;
359
+ }
360
+ this . handleProxyConfiguration ( extension ) ;
361
+ break ;
354
362
default :
355
363
throw new Error ( `Unknown extension type '${ extension . type } ' for ${ extension . id } ` ) ;
356
364
}
@@ -511,6 +519,17 @@ class ProjectPreprocessor {
511
519
const middlewarePath = path . join ( extension . path , extension . middleware . path ) ;
512
520
middlewareRepository . addMiddleware ( extension . metadata . name , middlewarePath ) ;
513
521
}
522
+
523
+ handleProxyConfiguration ( extension ) {
524
+ if ( ! extension . metadata && ! extension . metadata . name ) {
525
+ throw new Error ( `Proxy configuration extension ${ extension . id } is missing 'metadata.name' configuration` ) ;
526
+ }
527
+ if ( ! extension . proxy || ! extension . proxy . configuration ) {
528
+ throw new Error ( `Proxy configuration extension ${ extension . id } is missing 'proxy' configuration` ) ;
529
+ }
530
+ const { proxyConfiguration} = require ( "@ui5/server" ) ;
531
+ proxyConfiguration . addConfiguration ( extension . metadata . name , extension . proxy . configuration ) ;
532
+ }
514
533
}
515
534
516
535
/**
0 commit comments