@@ -136,7 +136,7 @@ class ProjectPreprocessor {
136
136
137
137
if ( project . kind === "extension" ) {
138
138
// 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
140
140
const parents = this . processedProjects [ project . id ] . parents ;
141
141
for ( let i = parents . length - 1 ; i >= 0 ; i -- ) {
142
142
parents [ i ] . dependencies . splice ( parents [ i ] . dependencies . indexOf ( project ) , 1 ) ;
@@ -272,7 +272,7 @@ class ProjectPreprocessor {
272
272
return false ; // ignore this project
273
273
}
274
274
275
- if ( project . specVersion !== "0.1" && project . specVersion !== "1.0" ) {
275
+ if ( project . specVersion !== "0.1" && project . specVersion !== "1.0" && project . specVersion !== "1.1a" ) {
276
276
throw new Error (
277
277
`Unsupported specification version ${ project . specVersion } defined for project ` +
278
278
`${ project . id } . ` +
@@ -330,7 +330,8 @@ class ProjectPreprocessor {
330
330
331
331
if ( ! extension . specVersion ) {
332
332
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" ) {
334
335
throw new Error (
335
336
`Unsupported specification version ${ extension . specVersion } defined for extension ` +
336
337
`${ extension . metadata . name } . ` +
@@ -354,6 +355,13 @@ class ProjectPreprocessor {
354
355
case "server-middleware" :
355
356
this . handleServerMiddleware ( extension ) ;
356
357
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 ;
357
365
default :
358
366
throw new Error ( `Unknown extension type '${ extension . type } ' for ${ extension . id } ` ) ;
359
367
}
@@ -514,6 +522,17 @@ class ProjectPreprocessor {
514
522
const middlewarePath = path . join ( extension . path , extension . middleware . path ) ;
515
523
middlewareRepository . addMiddleware ( extension . metadata . name , middlewarePath ) ;
516
524
}
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
+ }
517
536
}
518
537
519
538
/**
0 commit comments