@sap-ux/ui5-proxy-middleware 1.0.0 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base/constants.d.ts.map +1 -1
- package/dist/base/constants.js.map +1 -1
- package/dist/base/proxy.d.ts +3 -3
- package/dist/base/proxy.d.ts.map +1 -1
- package/dist/base/proxy.js +4 -5
- package/dist/base/proxy.js.map +1 -1
- package/dist/base/utils.d.ts +2 -2
- package/dist/base/utils.d.ts.map +1 -1
- package/dist/base/utils.js +32 -47
- package/dist/base/utils.js.map +1 -1
- package/dist/i18n.d.ts +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js.map +1 -1
- package/dist/ui5/middleware.js +6 -6
- package/dist/ui5/middleware.js.map +1 -1
- package/package.json +10 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/base/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,UAA0E,CAAC;AACxG,eAAO,MAAM,cAAc,6BAA6B,CAAC;AACzD,eAAO,MAAM,uBAAuB,QAAgD,CAAC;AACrF,eAAO,MAAM,YAAY,mDAAmD,CAAC;AAC7E,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/base/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,UAA0E,CAAC;AACxG,eAAO,MAAM,cAAc,6BAA6B,CAAC;AACzD,eAAO,MAAM,uBAAuB,QAAgD,CAAC;AACrF,eAAO,MAAM,YAAY,mDAAmD,CAAC;AAC7E,eAAO,MAAM,qBAAqB,QAAyE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/base/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,CAAC,aAAa,EAAE,qBAAqB,EAAE,+BAA+B,CAAC,CAAC;AAC3F,QAAA,cAAc,GAAG,0BAA0B,CAAC;AAC5C,QAAA,uBAAuB,GAAG,6CAA6C,CAAC;AACxE,QAAA,YAAY,GAAG,gDAAgD,CAAC;AAChE,QAAA,qBAAqB,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/base/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG,CAAC,aAAa,EAAE,qBAAqB,EAAE,+BAA+B,CAAC,CAAC;AAC3F,QAAA,cAAc,GAAG,0BAA0B,CAAC;AAC5C,QAAA,uBAAuB,GAAG,6CAA6C,CAAC;AACxE,QAAA,YAAY,GAAG,gDAAgD,CAAC;AAChE,QAAA,qBAAqB,GAAG,sEAAsE,CAAC"}
|
package/dist/base/proxy.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UI5Config } from './types';
|
|
1
|
+
import type { Options } from 'http-proxy-middleware';
|
|
2
|
+
import type { UI5Config } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Function for proxying UI5 sources.
|
|
5
5
|
*
|
|
@@ -8,5 +8,5 @@ import { UI5Config } from './types';
|
|
|
8
8
|
* @param filter - custom filter function which will be applied to all requests
|
|
9
9
|
* @returns Proxy function to use
|
|
10
10
|
*/
|
|
11
|
-
export declare const ui5Proxy: (config: UI5Config, options?: Options | undefined, filter?:
|
|
11
|
+
export declare const ui5Proxy: (config: UI5Config, options?: Options | undefined, filter?: string | string[] | ((pathname: string, req: import("http-proxy-middleware/dist/types").Request) => boolean) | undefined) => import("http-proxy-middleware").RequestHandler;
|
|
12
12
|
//# sourceMappingURL=proxy.d.ts.map
|
package/dist/base/proxy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/base/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/base/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,WAAY,SAAS,qNA0BzC,CAAC"}
|
package/dist/base/proxy.js
CHANGED
|
@@ -12,7 +12,7 @@ const logger_1 = require("@sap-ux/logger");
|
|
|
12
12
|
* @param filter - custom filter function which will be applied to all requests
|
|
13
13
|
* @returns Proxy function to use
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
exports.ui5Proxy = (config, options, filter) => {
|
|
16
16
|
const logger = new logger_1.ToolsLogger({
|
|
17
17
|
transports: [new logger_1.UI5ToolingTransport({ moduleName: 'ui5-proxy-middleware' })]
|
|
18
18
|
});
|
|
@@ -23,11 +23,11 @@ const ui5Proxy = (config, options, filter) => {
|
|
|
23
23
|
target: config.url,
|
|
24
24
|
changeOrigin: true,
|
|
25
25
|
onProxyReq: (proxyReq, _req, res) => {
|
|
26
|
-
|
|
26
|
+
utils_1.proxyRequestHandler(proxyReq, res, etag, logger);
|
|
27
27
|
},
|
|
28
28
|
pathRewrite: { [config.path]: ui5Ver + config.path },
|
|
29
29
|
onProxyRes: (proxyRes) => {
|
|
30
|
-
|
|
30
|
+
utils_1.proxyResponseHandler(proxyRes, etag);
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
Object.assign(proxyConfig, options);
|
|
@@ -35,7 +35,6 @@ const ui5Proxy = (config, options, filter) => {
|
|
|
35
35
|
if (filter) {
|
|
36
36
|
proxyFilter = filter;
|
|
37
37
|
}
|
|
38
|
-
return
|
|
38
|
+
return http_proxy_middleware_1.createProxyMiddleware(proxyFilter, proxyConfig);
|
|
39
39
|
};
|
|
40
|
-
exports.ui5Proxy = ui5Proxy;
|
|
41
40
|
//# sourceMappingURL=proxy.js.map
|
package/dist/base/proxy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/base/proxy.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/base/proxy.ts"],"names":[],"mappings":";;;AACA,iEAA8D;AAG9D,mCAA+F;AAC/F,2CAAkE;AAElE;;;;;;;GAOG;AACU,QAAA,QAAQ,GAAG,CAAC,MAAiB,EAAE,OAAiB,EAAE,MAAe,EAAE,EAAE;IAC9E,MAAM,MAAM,GAAG,IAAI,oBAAW,CAAC;QAC3B,UAAU,EAAE,CAAC,IAAI,4BAAmB,CAAC,EAAE,UAAU,EAAE,sBAAsB,EAAE,CAAC,CAAC;KAChF,CAAC,CAAC;IACH,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;IACzB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,IAAI,aAAa,GAAG,KAAK,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,WAAW,EAAE,GAAG,CAAC;IACjH,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,MAAM,WAAW,GAAY;QACzB,MAAM,EAAE,MAAM,CAAC,GAAG;QAClB,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,CAAC,QAAuB,EAAE,IAAqB,EAAE,GAAmB,EAAQ,EAAE;YACtF,2BAAmB,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACrD,CAAC;QACD,WAAW,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE;QACpD,UAAU,EAAE,CAAC,QAAyB,EAAQ,EAAE;YAC5C,4BAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACzC,CAAC;KACJ,CAAC;IACF,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACpC,IAAI,WAAW,GAAW,iCAAyB,CAAC;IAEpD,IAAI,MAAM,EAAE;QACR,WAAW,GAAG,MAAM,CAAC;KACxB;IAED,OAAO,6CAAqB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAC3D,CAAC,CAAC"}
|
package/dist/base/utils.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ClientRequest, IncomingMessage, ServerResponse } from 'http';
|
|
2
2
|
import type { ToolsLogger } from '@sap-ux/logger';
|
|
3
3
|
import type { NextFunction, Request, Response } from 'express';
|
|
4
|
-
import { UI5Config } from './types';
|
|
5
|
-
import { SAPJSONSchemaForWebApplicationManifestFile } from './manifest';
|
|
4
|
+
import type { UI5Config } from './types';
|
|
5
|
+
import type { SAPJSONSchemaForWebApplicationManifestFile } from './manifest';
|
|
6
6
|
/**
|
|
7
7
|
* Handler for the proxy response event.
|
|
8
8
|
* Sets an Etag which will be used for re-validation of the cached UI5 sources.
|
package/dist/base/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/base/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/base/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,cA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AAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAG3F;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBvG;AAED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,iBAAwB,MAAM,cAAc,SAAS,EAAE,KAAG,QAAQ,MAAM,GAAG,SAAS,CAqB5G,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,QACjB,OAAO,OACP,QAAQ,QACP,YAAY,cACN,SAAS,EAAE,KACxB,QAAQ,IAAI,CAmBd,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,cAAe,MAAM,OAAO,eAAe,KAAG,OASnF,CAAC"}
|
package/dist/base/utils.js
CHANGED
|
@@ -22,11 +22,10 @@ const i18n_1 = require("../i18n");
|
|
|
22
22
|
* @param proxyRes - proxy response object
|
|
23
23
|
* @param etag - ETag for the cached sources, normally the UI5 version
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
exports.proxyResponseHandler = (proxyRes, etag) => {
|
|
26
26
|
proxyRes.headers['Etag'] = etag;
|
|
27
27
|
proxyRes.headers['cache-control'] = 'no-cache';
|
|
28
28
|
};
|
|
29
|
-
exports.proxyResponseHandler = proxyResponseHandler;
|
|
30
29
|
/**
|
|
31
30
|
* Handler for the proxy request event.
|
|
32
31
|
* Re-validates the cached UI5 sources based on the ETag.
|
|
@@ -37,21 +36,20 @@ exports.proxyResponseHandler = proxyResponseHandler;
|
|
|
37
36
|
* @param etag - Etag of the cached UI5 sources, normally the UI5 version
|
|
38
37
|
* @param logger - Logger for loging the requests
|
|
39
38
|
*/
|
|
40
|
-
|
|
39
|
+
exports.proxyRequestHandler = (proxyReq, res, etag, logger) => {
|
|
41
40
|
logger.info(proxyReq.path);
|
|
42
41
|
if (proxyReq.getHeader('if-none-match') === etag) {
|
|
43
42
|
res.statusCode = 304;
|
|
44
43
|
res.end();
|
|
45
44
|
}
|
|
46
45
|
};
|
|
47
|
-
exports.proxyRequestHandler = proxyRequestHandler;
|
|
48
46
|
/**
|
|
49
47
|
* Get user's proxy configuration.
|
|
50
48
|
*
|
|
51
49
|
* @param yamlProxyServer - proxy server config from yaml file
|
|
52
50
|
* @returns User's proxy configuration or undefined
|
|
53
51
|
*/
|
|
54
|
-
|
|
52
|
+
exports.getCorporateProxyServer = (yamlProxyServer) => {
|
|
55
53
|
return (yamlProxyServer ||
|
|
56
54
|
process.env.FIORI_TOOLS_PROXY ||
|
|
57
55
|
process.env.http_proxy ||
|
|
@@ -61,14 +59,13 @@ const getCorporateProxyServer = (yamlProxyServer) => {
|
|
|
61
59
|
process.env.npm_config_proxy ||
|
|
62
60
|
process.env.npm_config_https_proxy);
|
|
63
61
|
};
|
|
64
|
-
exports.getCorporateProxyServer = getCorporateProxyServer;
|
|
65
62
|
/**
|
|
66
63
|
* Hides the proxy credentials for displaying the proxy configuration in the console.
|
|
67
64
|
*
|
|
68
65
|
* @param proxy - user's proxy server
|
|
69
66
|
* @returns proxy with hidden credentials for displaying in the console
|
|
70
67
|
*/
|
|
71
|
-
|
|
68
|
+
exports.hideProxyCredentials = (proxy) => {
|
|
72
69
|
if (proxy) {
|
|
73
70
|
const forwardSlashIndex = proxy.indexOf('//');
|
|
74
71
|
const atIndex = proxy.indexOf('@');
|
|
@@ -78,7 +75,6 @@ const hideProxyCredentials = (proxy) => {
|
|
|
78
75
|
}
|
|
79
76
|
return proxy;
|
|
80
77
|
};
|
|
81
|
-
exports.hideProxyCredentials = hideProxyCredentials;
|
|
82
78
|
/**
|
|
83
79
|
* Checks if a host is excluded from user's corporate proxy.
|
|
84
80
|
*
|
|
@@ -86,7 +82,7 @@ exports.hideProxyCredentials = hideProxyCredentials;
|
|
|
86
82
|
* @param url - url to be checked
|
|
87
83
|
* @returns true if host is excluded from user's corporate server, false otherwise
|
|
88
84
|
*/
|
|
89
|
-
|
|
85
|
+
exports.isHostExcludedFromProxy = (noProxyConfig, url) => {
|
|
90
86
|
if (noProxyConfig === '*') {
|
|
91
87
|
return true;
|
|
92
88
|
}
|
|
@@ -97,22 +93,19 @@ const isHostExcludedFromProxy = (noProxyConfig, url) => {
|
|
|
97
93
|
if (entry.startsWith('.') && host.endsWith(entry)) {
|
|
98
94
|
isExcluded = true;
|
|
99
95
|
}
|
|
100
|
-
else {
|
|
101
|
-
|
|
102
|
-
isExcluded = true;
|
|
103
|
-
}
|
|
96
|
+
else if (`.${host}`.endsWith(`.${entry}`)) {
|
|
97
|
+
isExcluded = true;
|
|
104
98
|
}
|
|
105
99
|
}
|
|
106
100
|
return isExcluded;
|
|
107
101
|
};
|
|
108
|
-
exports.isHostExcludedFromProxy = isHostExcludedFromProxy;
|
|
109
102
|
/**
|
|
110
103
|
* Returns the name of html file, which is used to preview the application, from the URL.
|
|
111
104
|
*
|
|
112
105
|
* @param url - html request url
|
|
113
106
|
* @returns Name of the html file
|
|
114
107
|
*/
|
|
115
|
-
|
|
108
|
+
exports.getHtmlFile = (url) => {
|
|
116
109
|
let html = url;
|
|
117
110
|
if (html.indexOf('?') !== -1) {
|
|
118
111
|
html = html.split('?')[0].replace(/["']/g, '');
|
|
@@ -125,14 +118,13 @@ const getHtmlFile = (url) => {
|
|
|
125
118
|
}
|
|
126
119
|
return html;
|
|
127
120
|
};
|
|
128
|
-
exports.getHtmlFile = getHtmlFile;
|
|
129
121
|
/**
|
|
130
122
|
* Returns the name of the yaml file, which is used to for the server configuration, from the runtime arguments.
|
|
131
123
|
*
|
|
132
124
|
* @param args - runtime arguments
|
|
133
125
|
* @returns Name of the YAML file
|
|
134
126
|
*/
|
|
135
|
-
|
|
127
|
+
exports.getYamlFile = (args) => {
|
|
136
128
|
let yaml = 'ui5.yaml';
|
|
137
129
|
const index = args.indexOf('--config') !== -1 ? args.indexOf('--config') : args.indexOf('-c');
|
|
138
130
|
if (index !== -1) {
|
|
@@ -140,32 +132,30 @@ const getYamlFile = (args) => {
|
|
|
140
132
|
}
|
|
141
133
|
return yaml;
|
|
142
134
|
};
|
|
143
|
-
exports.getYamlFile = getYamlFile;
|
|
144
135
|
/**
|
|
145
136
|
* Gets the path to the webapp folder from the YAML file.
|
|
146
137
|
*
|
|
147
138
|
* @param ui5YamlPath - path to the yaml file
|
|
148
139
|
* @returns Path to the webapp folder
|
|
149
140
|
*/
|
|
150
|
-
|
|
141
|
+
exports.getWebAppFolderFromYaml = (ui5YamlPath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
151
142
|
var _a, _b, _c;
|
|
152
143
|
let webAppFolder = 'webapp';
|
|
153
|
-
if (
|
|
154
|
-
const ui5Yaml =
|
|
144
|
+
if (fs_1.existsSync(ui5YamlPath)) {
|
|
145
|
+
const ui5Yaml = yaml_1.parseDocument(yield fs_1.promises.readFile(ui5YamlPath, { encoding: 'utf8' })).toJSON();
|
|
155
146
|
if ((_c = (_b = (_a = ui5Yaml.resources) === null || _a === void 0 ? void 0 : _a.configuration) === null || _b === void 0 ? void 0 : _b.paths) === null || _c === void 0 ? void 0 : _c.webapp) {
|
|
156
147
|
webAppFolder = ui5Yaml.resources.configuration.paths.webapp;
|
|
157
148
|
}
|
|
158
149
|
}
|
|
159
150
|
return webAppFolder;
|
|
160
151
|
});
|
|
161
|
-
exports.getWebAppFolderFromYaml = getWebAppFolderFromYaml;
|
|
162
152
|
/**
|
|
163
153
|
* Sends HTML content as a response.
|
|
164
154
|
*
|
|
165
155
|
* @param res - The http response object
|
|
166
156
|
* @param html - The HTML content
|
|
167
157
|
*/
|
|
168
|
-
|
|
158
|
+
exports.setHtmlResponse = (res, html) => {
|
|
169
159
|
if (res['_livereload']) {
|
|
170
160
|
res.write(html);
|
|
171
161
|
res.end();
|
|
@@ -174,23 +164,21 @@ const setHtmlResponse = (res, html) => {
|
|
|
174
164
|
res.status(200).contentType('html').send(html);
|
|
175
165
|
}
|
|
176
166
|
};
|
|
177
|
-
exports.setHtmlResponse = setHtmlResponse;
|
|
178
167
|
/**
|
|
179
168
|
* Gets the manifest.json for a given application.
|
|
180
169
|
*
|
|
181
170
|
* @param args list of runtime arguments
|
|
182
171
|
* @returns The content of the manifest.json
|
|
183
172
|
*/
|
|
184
|
-
|
|
173
|
+
exports.getManifest = (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
185
174
|
const projectRoot = process.cwd();
|
|
186
|
-
const yamlFileName =
|
|
187
|
-
const ui5YamlPath =
|
|
188
|
-
const webAppFolder = yield
|
|
189
|
-
const manifestPath =
|
|
175
|
+
const yamlFileName = exports.getYamlFile(args);
|
|
176
|
+
const ui5YamlPath = path_1.join(projectRoot, yamlFileName);
|
|
177
|
+
const webAppFolder = yield exports.getWebAppFolderFromYaml(ui5YamlPath);
|
|
178
|
+
const manifestPath = path_1.join(projectRoot, webAppFolder, 'manifest.json');
|
|
190
179
|
const manifest = JSON.parse(yield fs_1.promises.readFile(manifestPath, { encoding: 'utf8' }));
|
|
191
180
|
return manifest;
|
|
192
181
|
});
|
|
193
|
-
exports.getManifest = getManifest;
|
|
194
182
|
/**
|
|
195
183
|
* Gets the minUI5Version from the manifest.json.
|
|
196
184
|
*
|
|
@@ -200,7 +188,7 @@ exports.getManifest = getManifest;
|
|
|
200
188
|
function getUI5VersionFromManifest(args) {
|
|
201
189
|
var _a, _b;
|
|
202
190
|
return __awaiter(this, void 0, void 0, function* () {
|
|
203
|
-
const manifest = yield
|
|
191
|
+
const manifest = yield exports.getManifest(args);
|
|
204
192
|
return (_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.dependencies) === null || _b === void 0 ? void 0 : _b.minUI5Version;
|
|
205
193
|
});
|
|
206
194
|
}
|
|
@@ -222,7 +210,7 @@ function resolveUI5Version(version, log) {
|
|
|
222
210
|
ui5VersionLocation =
|
|
223
211
|
process.env.FIORI_TOOLS_UI5_VERSION || process.env.FIORI_TOOLS_UI5_VERSION === ''
|
|
224
212
|
? 'CLI arguments / Run configuration'
|
|
225
|
-
:
|
|
213
|
+
: exports.getYamlFile(process.argv);
|
|
226
214
|
}
|
|
227
215
|
else {
|
|
228
216
|
const minUI5Version = yield getUI5VersionFromManifest(process.argv);
|
|
@@ -232,7 +220,7 @@ function resolveUI5Version(version, log) {
|
|
|
232
220
|
}
|
|
233
221
|
if (log) {
|
|
234
222
|
ui5VersionInfo = ui5Version ? ui5Version : 'latest';
|
|
235
|
-
log.info(
|
|
223
|
+
log.info(i18n_1.t('info.ui5VersionSource', { version: ui5VersionInfo, source: ui5VersionLocation }));
|
|
236
224
|
}
|
|
237
225
|
return ui5Version;
|
|
238
226
|
});
|
|
@@ -245,8 +233,8 @@ exports.resolveUI5Version = resolveUI5Version;
|
|
|
245
233
|
* @param ui5Configs - the configuration of the ui5-proxy-middleware
|
|
246
234
|
* @returns The modified html file content
|
|
247
235
|
*/
|
|
248
|
-
|
|
249
|
-
if (
|
|
236
|
+
exports.injectUI5Url = (htmlFilePath, ui5Configs) => __awaiter(void 0, void 0, void 0, function* () {
|
|
237
|
+
if (fs_1.existsSync(htmlFilePath)) {
|
|
250
238
|
let html = yield fs_1.promises.readFile(htmlFilePath, { encoding: 'utf8' });
|
|
251
239
|
for (const ui5Config of ui5Configs) {
|
|
252
240
|
const ui5Host = ui5Config.url.replace(/\/$/, '');
|
|
@@ -264,7 +252,6 @@ const injectUI5Url = (htmlFilePath, ui5Configs) => __awaiter(void 0, void 0, voi
|
|
|
264
252
|
}
|
|
265
253
|
return undefined;
|
|
266
254
|
});
|
|
267
|
-
exports.injectUI5Url = injectUI5Url;
|
|
268
255
|
/**
|
|
269
256
|
* Injects scripts into the html file, which is used to preview the application.
|
|
270
257
|
*
|
|
@@ -273,18 +260,18 @@ exports.injectUI5Url = injectUI5Url;
|
|
|
273
260
|
* @param next - the next function, used to forward the request to the next available handler
|
|
274
261
|
* @param ui5Configs - the UI5 configuration of the ui5-proxy-middleware
|
|
275
262
|
*/
|
|
276
|
-
|
|
263
|
+
exports.injectScripts = (req, res, next, ui5Configs) => __awaiter(void 0, void 0, void 0, function* () {
|
|
277
264
|
try {
|
|
278
265
|
const projectRoot = process.cwd();
|
|
279
266
|
const args = process.argv;
|
|
280
|
-
const htmlFileName =
|
|
281
|
-
const yamlFileName =
|
|
282
|
-
const ui5YamlPath =
|
|
283
|
-
const webAppFolder = yield
|
|
284
|
-
const htmlFilePath =
|
|
285
|
-
const html = yield
|
|
267
|
+
const htmlFileName = exports.getHtmlFile(req.baseUrl);
|
|
268
|
+
const yamlFileName = exports.getYamlFile(args);
|
|
269
|
+
const ui5YamlPath = path_1.join(projectRoot, yamlFileName);
|
|
270
|
+
const webAppFolder = yield exports.getWebAppFolderFromYaml(ui5YamlPath);
|
|
271
|
+
const htmlFilePath = path_1.join(projectRoot, webAppFolder, htmlFileName);
|
|
272
|
+
const html = yield exports.injectUI5Url(htmlFilePath, ui5Configs);
|
|
286
273
|
if (html) {
|
|
287
|
-
|
|
274
|
+
exports.setHtmlResponse(res, html);
|
|
288
275
|
}
|
|
289
276
|
else {
|
|
290
277
|
next();
|
|
@@ -294,7 +281,6 @@ const injectScripts = (req, res, next, ui5Configs) => __awaiter(void 0, void 0,
|
|
|
294
281
|
next(error);
|
|
295
282
|
}
|
|
296
283
|
});
|
|
297
|
-
exports.injectScripts = injectScripts;
|
|
298
284
|
/**
|
|
299
285
|
* Filters comressed html files from UI5 CDN.
|
|
300
286
|
* Avoid ERR_CONTENT_DECODING_FAILED on http request for gzip'd html files.
|
|
@@ -304,7 +290,7 @@ exports.injectScripts = injectScripts;
|
|
|
304
290
|
* @param req - the http request object
|
|
305
291
|
* @returns True, indicating that the request should be proxied
|
|
306
292
|
*/
|
|
307
|
-
|
|
293
|
+
exports.filterCompressedHtmlFiles = (_pathname, req) => {
|
|
308
294
|
const acceptHeader = req.headers['accept'] || '';
|
|
309
295
|
if (req.headers['accept-encoding'] &&
|
|
310
296
|
(acceptHeader.includes('text/html') || acceptHeader.includes('application/xhtml+xml'))) {
|
|
@@ -312,5 +298,4 @@ const filterCompressedHtmlFiles = (_pathname, req) => {
|
|
|
312
298
|
}
|
|
313
299
|
return true;
|
|
314
300
|
};
|
|
315
|
-
exports.filterCompressedHtmlFiles = filterCompressedHtmlFiles;
|
|
316
301
|
//# sourceMappingURL=utils.js.map
|
package/dist/base/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/base/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,2BAA0C;AAC1C,+BAAqC;AACrC,+BAA4B;AAC5B,2CAA2G;AAE3G,kCAA4B;AAE5B;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/base/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,2BAA0C;AAC1C,+BAAqC;AACrC,+BAA4B;AAC5B,2CAA2G;AAE3G,kCAA4B;AAE5B;;;;;;GAMG;AACU,QAAA,oBAAoB,GAAG,CAAC,QAAyB,EAAE,IAAY,EAAQ,EAAE;IAClF,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;AACnD,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACU,QAAA,mBAAmB,GAAG,CAC/B,QAAuB,EACvB,GAAmB,EACnB,IAAY,EACZ,MAAmB,EACf,EAAE;IACN,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,QAAQ,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,IAAI,EAAE;QAC9C,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;QACrB,GAAG,CAAC,GAAG,EAAE,CAAC;KACb;AACL,CAAC,CAAC;AAEF;;;;;GAKG;AACU,QAAA,uBAAuB,GAAG,CAAC,eAAmC,EAAsB,EAAE;IAC/F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AiB,CAAC,CAAC,CAAC,kDAAkD;KAC5F;IACD,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC"}
|
package/dist/i18n.d.ts
CHANGED
package/dist/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAMxC;;GAEG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAY9C;AAED;;;;;;GAMG;AACH,wBAAgB,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAEzD"}
|
package/dist/i18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,sDAA8B;AAC9B,mHAAyE;AAEzE,MAAM,EAAE,GAAG,sBAAsB,CAAC;AAElC;;GAEG;AACH,SAAsB,QAAQ;;QAC1B,MAAM,iBAAO,CAAC,IAAI,CAAC;YACf,SAAS,EAAE;gBACP,EAAE,EAAE;oBACA,CAAC,EAAE,CAAC,EAAE,wCAAY;iBACrB;aACJ;YACD,GAAG,EAAE,IAAI;YACT,WAAW,EAAE,IAAI;YACjB,SAAS,EAAE,EAAE;YACb,EAAE,EAAE,CAAC,EAAE,CAAC;SACX,CAAC,CAAC;IACP,CAAC;CAAA;AAZD,4BAYC;AAED;;;;;;GAMG;AACH,SAAgB,CAAC,CAAC,GAAW,EAAE,OAAkB;IAC7C,OAAO,iBAAO,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACnC,CAAC;AAFD,cAEC;AAED,QAAQ,EAAE,CAAC"}
|
package/dist/ui5/middleware.js
CHANGED
|
@@ -22,14 +22,14 @@ module.exports = ({ options }) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
22
22
|
});
|
|
23
23
|
const router = express_1.default.Router();
|
|
24
24
|
const config = options.configuration;
|
|
25
|
-
const ui5Version = yield
|
|
25
|
+
const ui5Version = yield base_1.resolveUI5Version(config.version, logger);
|
|
26
26
|
const secure = !!config.secure;
|
|
27
27
|
const debug = !!config.debug;
|
|
28
28
|
const directLoad = !!config.directLoad;
|
|
29
29
|
const noProxyVal = process.env.no_proxy || process.env.npm_config_noproxy;
|
|
30
|
-
const corporateProxyServer =
|
|
30
|
+
const corporateProxyServer = base_1.getCorporateProxyServer(config.proxy);
|
|
31
31
|
// hide user and pass from proxy configuration for displaying it in the terminal
|
|
32
|
-
const proxyInfo =
|
|
32
|
+
const proxyInfo = base_1.hideProxyCredentials(corporateProxyServer);
|
|
33
33
|
const proxyOptions = {
|
|
34
34
|
secure,
|
|
35
35
|
logLevel: debug ? 'debug' : 'info',
|
|
@@ -54,14 +54,14 @@ module.exports = ({ options }) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
54
54
|
}
|
|
55
55
|
for (const ui5Config of ui5Configs) {
|
|
56
56
|
ui5Config.version = ui5Version;
|
|
57
|
-
if (corporateProxyServer && !
|
|
57
|
+
if (corporateProxyServer && !base_1.isHostExcludedFromProxy(noProxyVal, ui5Config.url)) {
|
|
58
58
|
proxyOptions.agent = new https_proxy_agent_1.HttpsProxyAgent(corporateProxyServer);
|
|
59
59
|
}
|
|
60
|
-
router.use(ui5Config.path,
|
|
60
|
+
router.use(ui5Config.path, base_1.ui5Proxy(ui5Config, proxyOptions));
|
|
61
61
|
}
|
|
62
62
|
if (directLoad) {
|
|
63
63
|
router.use(base_1.HTML_MOUNT_PATHS, (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
-
yield
|
|
64
|
+
yield base_1.injectScripts(req, res, next, ui5Configs);
|
|
65
65
|
}));
|
|
66
66
|
}
|
|
67
67
|
return router;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../src/ui5/middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../src/ui5/middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,sDAA8B;AAE9B,yDAAoD;AACpD,2CAAkE;AAElE,kCAQiB;AAEjB,MAAM,CAAC,OAAO,GAAG,CAAO,EAAE,OAAO,EAAqC,EAA2B,EAAE;IAC/F,MAAM,MAAM,GAAG,IAAI,oBAAW,CAAC;QAC3B,UAAU,EAAE,CAAC,IAAI,4BAAmB,CAAC,EAAE,UAAU,EAAE,sBAAsB,EAAE,CAAC,CAAC;KAChF,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,iBAAO,CAAC,MAAM,EAAE,CAAC;IAChC,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IACrC,MAAM,UAAU,GAAG,MAAM,wBAAiB,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACnE,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IAC/B,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;IAC7B,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;IACvC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAC1E,MAAM,oBAAoB,GAAG,8BAAuB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnE,gFAAgF;IAChF,MAAM,SAAS,GAAG,2BAAoB,CAAC,oBA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AI,UAAU,EAAE;QACZ,MAAM,CAAC,GAAG,CAAC,uBAAgB,EAAE,CAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAiB,EAAE;YAClG,MAAM,oBAAa,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QACpD,CAAC,CAAA,CAAC,CAAC;KACN;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAA,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/ui5-proxy-middleware",
|
|
3
3
|
"description": "UI5 proxy middleware",
|
|
4
|
-
"
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
7
|
+
"directory": "packages/ui5-proxy-middleware"
|
|
8
|
+
},
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aui5-proxy-middleware"
|
|
11
|
+
},
|
|
12
|
+
"version": "1.0.3",
|
|
5
13
|
"license": "Apache-2.0",
|
|
6
14
|
"main": "dist/index.js",
|
|
7
15
|
"files": [
|
|
@@ -10,7 +18,7 @@
|
|
|
10
18
|
"ui5.yaml"
|
|
11
19
|
],
|
|
12
20
|
"dependencies": {
|
|
13
|
-
"@sap-ux/logger": "0.1.
|
|
21
|
+
"@sap-ux/logger": "0.1.5",
|
|
14
22
|
"express": "4.17.2",
|
|
15
23
|
"http-proxy-middleware": "2.0.1",
|
|
16
24
|
"https-proxy-agent": "5.0.0",
|