@sap/ux-ui5-tooling 1.12.1 → 1.12.2

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.
@@ -30,7 +30,7 @@ SUBCOMMANDS:
30
30
  | --subtitle | -s | Subtile displayed on Fiori Launchpad tile |
31
31
  | --overwrite | -f | Overwrite existing FLP config (y/n) |
32
32
 
33
- flp-embedded-config - Adds the necessary configuration for running a Fiori application in FLP Embedded Mode. Mandatory parameters
33
+ flp-embedded-config - Adds the necessary configuration for running An SAP Fiori application in FLP Embedded Mode. Mandatory parameters
34
34
  | | | |
35
35
  |---------------|----|----------------------------|
36
36
  | --bspApplication | | The BSP of your application |
@@ -9934,6 +9934,24 @@ var require_follow_redirects = __commonJS({
9934
9934
  var Writable = require("stream").Writable;
9935
9935
  var assert = require("assert");
9936
9936
  var debug = require_debug();
9937
+ var useNativeURL = false;
9938
+ try {
9939
+ assert(new URL2());
9940
+ } catch (error2) {
9941
+ useNativeURL = error2.code === "ERR_INVALID_URL";
9942
+ }
9943
+ var preservedUrlFields = [
9944
+ "auth",
9945
+ "host",
9946
+ "hostname",
9947
+ "href",
9948
+ "path",
9949
+ "pathname",
9950
+ "port",
9951
+ "protocol",
9952
+ "query",
9953
+ "search"
9954
+ ];
9937
9955
  var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
9938
9956
  var eventHandlers = /* @__PURE__ */ Object.create(null);
9939
9957
  events.forEach(function(event) {
@@ -9941,13 +9959,19 @@ var require_follow_redirects = __commonJS({
9941
9959
  this._redirectable.emit(event, arg1, arg2, arg3);
9942
9960
  };
9943
9961
  });
9962
+ var InvalidUrlError = createErrorType(
9963
+ "ERR_INVALID_URL",
9964
+ "Invalid URL",
9965
+ TypeError
9966
+ );
9944
9967
  var RedirectionError = createErrorType(
9945
9968
  "ERR_FR_REDIRECTION_FAILURE",
9946
9969
  "Redirected request failed"
9947
9970
  );
9948
9971
  var TooManyRedirectsError = createErrorType(
9949
9972
  "ERR_FR_TOO_MANY_REDIRECTS",
9950
- "Maximum number of redirects exceeded"
9973
+ "Maximum number of redirects exceeded",
9974
+ RedirectionError
9951
9975
  );
9952
9976
  var MaxBodyLengthExceededError = createErrorType(
9953
9977
  "ERR_FR_MAX_BODY_LENGTH_EXCEEDED",
@@ -9957,6 +9981,7 @@ var require_follow_redirects = __commonJS({
9957
9981
  "ERR_STREAM_WRITE_AFTER_END",
9958
9982
  "write after end"
9959
9983
  );
9984
+ var destroy = Writable.prototype.destroy || noop3;
9960
9985
  function RedirectableRequest(options, responseCallback) {
9961
9986
  Writable.call(this);
9962
9987
  this._sanitizeOptions(options);
@@ -9972,23 +9997,33 @@ var require_follow_redirects = __commonJS({
9972
9997
  }
9973
9998
  var self2 = this;
9974
9999
  this._onNativeResponse = function(response) {
9975
- self2._processResponse(response);
10000
+ try {
10001
+ self2._processResponse(response);
10002
+ } catch (cause) {
10003
+ self2.emit("error", cause instanceof RedirectionError ? cause : new RedirectionError({ cause }));
10004
+ }
9976
10005
  };
9977
10006
  this._performRequest();
9978
10007
  }
9979
10008
  RedirectableRequest.prototype = Object.create(Writable.prototype);
9980
10009
  RedirectableRequest.prototype.abort = function() {
9981
- abortRequest(this._currentRequest);
10010
+ destroyRequest(this._currentRequest);
10011
+ this._currentRequest.abort();
9982
10012
  this.emit("abort");
9983
10013
  };
10014
+ RedirectableRequest.prototype.destroy = function(error2) {
10015
+ destroyRequest(this._currentRequest, error2);
10016
+ destroy.call(this, error2);
10017
+ return this;
10018
+ };
9984
10019
  RedirectableRequest.prototype.write = function(data, encoding, callback) {
9985
10020
  if (this._ending) {
9986
10021
  throw new WriteAfterEndError();
9987
10022
  }
9988
- if (!(typeof data === "string" || typeof data === "object" && "length" in data)) {
10023
+ if (!isString2(data) && !isBuffer2(data)) {
9989
10024
  throw new TypeError("data should be a string, Buffer or Uint8Array");
9990
10025
  }
9991
- if (typeof encoding === "function") {
10026
+ if (isFunction2(encoding)) {
9992
10027
  callback = encoding;
9993
10028
  encoding = null;
9994
10029
  }
@@ -10008,10 +10043,10 @@ var require_follow_redirects = __commonJS({
10008
10043
  }
10009
10044
  };
10010
10045
  RedirectableRequest.prototype.end = function(data, encoding, callback) {
10011
- if (typeof data === "function") {
10046
+ if (isFunction2(data)) {
10012
10047
  callback = data;
10013
10048
  data = encoding = null;
10014
- } else if (typeof encoding === "function") {
10049
+ } else if (isFunction2(encoding)) {
10015
10050
  callback = encoding;
10016
10051
  encoding = null;
10017
10052
  }
@@ -10061,6 +10096,7 @@ var require_follow_redirects = __commonJS({
10061
10096
  self2.removeListener("abort", clearTimer);
10062
10097
  self2.removeListener("error", clearTimer);
10063
10098
  self2.removeListener("response", clearTimer);
10099
+ self2.removeListener("close", clearTimer);
10064
10100
  if (callback) {
10065
10101
  self2.removeListener("timeout", callback);
10066
10102
  }
@@ -10080,6 +10116,7 @@ var require_follow_redirects = __commonJS({
10080
10116
  this.on("abort", clearTimer);
10081
10117
  this.on("error", clearTimer);
10082
10118
  this.on("response", clearTimer);
10119
+ this.on("close", clearTimer);
10083
10120
  return this;
10084
10121
  };
10085
10122
  [
@@ -10123,19 +10160,22 @@ var require_follow_redirects = __commonJS({
10123
10160
  var protocol = this._options.protocol;
10124
10161
  var nativeProtocol = this._options.nativeProtocols[protocol];
10125
10162
  if (!nativeProtocol) {
10126
- this.emit("error", new TypeError("Unsupported protocol " + protocol));
10127
- return;
10163
+ throw new TypeError("Unsupported protocol " + protocol);
10128
10164
  }
10129
10165
  if (this._options.agents) {
10130
- var scheme = protocol.substr(0, protocol.length - 1);
10166
+ var scheme = protocol.slice(0, -1);
10131
10167
  this._options.agent = this._options.agents[scheme];
10132
10168
  }
10133
10169
  var request = this._currentRequest = nativeProtocol.request(this._options, this._onNativeResponse);
10134
- this._currentUrl = url2.format(this._options);
10135
10170
  request._redirectable = this;
10136
- for (var e = 0; e < events.length; e++) {
10137
- request.on(events[e], eventHandlers[events[e]]);
10171
+ for (var event of events) {
10172
+ request.on(event, eventHandlers[event]);
10138
10173
  }
10174
+ this._currentUrl = /^\//.test(this._options.path) ? url2.format(this._options) : (
10175
+ // When making a request to a proxy, […]
10176
+ // a client MUST send the target URI in absolute-form […].
10177
+ this._options.path
10178
+ );
10139
10179
  if (this._isRedirect) {
10140
10180
  var i = 0;
10141
10181
  var self2 = this;
@@ -10166,61 +10206,61 @@ var require_follow_redirects = __commonJS({
10166
10206
  });
10167
10207
  }
10168
10208
  var location = response.headers.location;
10169
- if (location && this._options.followRedirects !== false && statusCode >= 300 && statusCode < 400) {
10170
- abortRequest(this._currentRequest);
10171
- response.destroy();
10172
- if (++this._redirectCount > this._options.maxRedirects) {
10173
- this.emit("error", new TooManyRedirectsError());
10174
- return;
10175
- }
10176
- if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || // RFC7231§6.4.4: The 303 (See Other) status code indicates that
10177
- // the server is redirecting the user agent to a different resource […]
10178
- // A user agent can perform a retrieval request targeting that URI
10179
- // (a GET or HEAD request if using HTTP) […]
10180
- statusCode === 303 && !/^(?:GET|HEAD)$/.test(this._options.method)) {
10181
- this._options.method = "GET";
10182
- this._requestBodyBuffers = [];
10183
- removeMatchingHeaders(/^content-/i, this._options.headers);
10184
- }
10185
- var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
10186
- var currentUrlParts = url2.parse(this._currentUrl);
10187
- var currentHost = currentHostHeader || currentUrlParts.host;
10188
- var currentUrl = /^\w+:/.test(location) ? this._currentUrl : url2.format(Object.assign(currentUrlParts, { host: currentHost }));
10189
- var redirectUrl;
10190
- try {
10191
- redirectUrl = url2.resolve(currentUrl, location);
10192
- } catch (cause) {
10193
- this.emit("error", new RedirectionError(cause));
10194
- return;
10195
- }
10196
- debug("redirecting to", redirectUrl);
10197
- this._isRedirect = true;
10198
- var redirectUrlParts = url2.parse(redirectUrl);
10199
- Object.assign(this._options, redirectUrlParts);
10200
- if (redirectUrlParts.protocol !== currentUrlParts.protocol || !isSameOrSubdomain(redirectUrlParts.host, currentHost)) {
10201
- removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
10202
- }
10203
- if (typeof this._options.beforeRedirect === "function") {
10204
- var responseDetails = { headers: response.headers };
10205
- try {
10206
- this._options.beforeRedirect.call(null, this._options, responseDetails);
10207
- } catch (err) {
10208
- this.emit("error", err);
10209
- return;
10210
- }
10211
- this._sanitizeOptions(this._options);
10212
- }
10213
- try {
10214
- this._performRequest();
10215
- } catch (cause) {
10216
- this.emit("error", new RedirectionError(cause));
10217
- }
10218
- } else {
10209
+ if (!location || this._options.followRedirects === false || statusCode < 300 || statusCode >= 400) {
10219
10210
  response.responseUrl = this._currentUrl;
10220
10211
  response.redirects = this._redirects;
10221
10212
  this.emit("response", response);
10222
10213
  this._requestBodyBuffers = [];
10214
+ return;
10223
10215
  }
10216
+ destroyRequest(this._currentRequest);
10217
+ response.destroy();
10218
+ if (++this._redirectCount > this._options.maxRedirects) {
10219
+ throw new TooManyRedirectsError();
10220
+ }
10221
+ var requestHeaders;
10222
+ var beforeRedirect = this._options.beforeRedirect;
10223
+ if (beforeRedirect) {
10224
+ requestHeaders = Object.assign({
10225
+ // The Host header was set by nativeProtocol.request
10226
+ Host: response.req.getHeader("host")
10227
+ }, this._options.headers);
10228
+ }
10229
+ var method = this._options.method;
10230
+ if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || // RFC7231§6.4.4: The 303 (See Other) status code indicates that
10231
+ // the server is redirecting the user agent to a different resource […]
10232
+ // A user agent can perform a retrieval request targeting that URI
10233
+ // (a GET or HEAD request if using HTTP) […]
10234
+ statusCode === 303 && !/^(?:GET|HEAD)$/.test(this._options.method)) {
10235
+ this._options.method = "GET";
10236
+ this._requestBodyBuffers = [];
10237
+ removeMatchingHeaders(/^content-/i, this._options.headers);
10238
+ }
10239
+ var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
10240
+ var currentUrlParts = parseUrl(this._currentUrl);
10241
+ var currentHost = currentHostHeader || currentUrlParts.host;
10242
+ var currentUrl = /^\w+:/.test(location) ? this._currentUrl : url2.format(Object.assign(currentUrlParts, { host: currentHost }));
10243
+ var redirectUrl = resolveUrl(location, currentUrl);
10244
+ debug("redirecting to", redirectUrl.href);
10245
+ this._isRedirect = true;
10246
+ spreadUrlObject(redirectUrl, this._options);
10247
+ if (redirectUrl.protocol !== currentUrlParts.protocol && redirectUrl.protocol !== "https:" || redirectUrl.host !== currentHost && !isSubdomain(redirectUrl.host, currentHost)) {
10248
+ removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
10249
+ }
10250
+ if (isFunction2(beforeRedirect)) {
10251
+ var responseDetails = {
10252
+ headers: response.headers,
10253
+ statusCode
10254
+ };
10255
+ var requestDetails = {
10256
+ url: currentUrl,
10257
+ method,
10258
+ headers: requestHeaders
10259
+ };
10260
+ beforeRedirect(this._options, responseDetails, requestDetails);
10261
+ this._sanitizeOptions(this._options);
10262
+ }
10263
+ this._performRequest();
10224
10264
  };
10225
10265
  function wrap2(protocols) {
10226
10266
  var exports2 = {
@@ -10233,21 +10273,16 @@ var require_follow_redirects = __commonJS({
10233
10273
  var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
10234
10274
  var wrappedProtocol = exports2[scheme] = Object.create(nativeProtocol);
10235
10275
  function request(input, options, callback) {
10236
- if (typeof input === "string") {
10237
- var urlStr = input;
10238
- try {
10239
- input = urlToOptions(new URL2(urlStr));
10240
- } catch (err) {
10241
- input = url2.parse(urlStr);
10242
- }
10243
- } else if (URL2 && input instanceof URL2) {
10244
- input = urlToOptions(input);
10276
+ if (isURL(input)) {
10277
+ input = spreadUrlObject(input);
10278
+ } else if (isString2(input)) {
10279
+ input = spreadUrlObject(parseUrl(input));
10245
10280
  } else {
10246
10281
  callback = options;
10247
- options = input;
10282
+ options = validateUrl(input);
10248
10283
  input = { protocol };
10249
10284
  }
10250
- if (typeof options === "function") {
10285
+ if (isFunction2(options)) {
10251
10286
  callback = options;
10252
10287
  options = null;
10253
10288
  }
@@ -10256,6 +10291,9 @@ var require_follow_redirects = __commonJS({
10256
10291
  maxBodyLength: exports2.maxBodyLength
10257
10292
  }, input, options);
10258
10293
  options.nativeProtocols = nativeProtocols;
10294
+ if (!isString2(options.host) && !isString2(options.hostname)) {
10295
+ options.hostname = "::1";
10296
+ }
10259
10297
  assert.equal(options.protocol, protocol, "protocol mismatch");
10260
10298
  debug("options", options);
10261
10299
  return new RedirectableRequest(options, callback);
@@ -10274,23 +10312,43 @@ var require_follow_redirects = __commonJS({
10274
10312
  }
10275
10313
  function noop3() {
10276
10314
  }
10277
- function urlToOptions(urlObject) {
10278
- var options = {
10279
- protocol: urlObject.protocol,
10280
- hostname: urlObject.hostname.startsWith("[") ? (
10281
- /* istanbul ignore next */
10282
- urlObject.hostname.slice(1, -1)
10283
- ) : urlObject.hostname,
10284
- hash: urlObject.hash,
10285
- search: urlObject.search,
10286
- pathname: urlObject.pathname,
10287
- path: urlObject.pathname + urlObject.search,
10288
- href: urlObject.href
10289
- };
10290
- if (urlObject.port !== "") {
10291
- options.port = Number(urlObject.port);
10315
+ function parseUrl(input) {
10316
+ var parsed;
10317
+ if (useNativeURL) {
10318
+ parsed = new URL2(input);
10319
+ } else {
10320
+ parsed = validateUrl(url2.parse(input));
10321
+ if (!isString2(parsed.protocol)) {
10322
+ throw new InvalidUrlError({ input });
10323
+ }
10324
+ }
10325
+ return parsed;
10326
+ }
10327
+ function resolveUrl(relative, base) {
10328
+ return useNativeURL ? new URL2(relative, base) : parseUrl(url2.resolve(base, relative));
10329
+ }
10330
+ function validateUrl(input) {
10331
+ if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
10332
+ throw new InvalidUrlError({ input: input.href || input });
10333
+ }
10334
+ if (/^\[/.test(input.host) && !/^\[[:0-9a-f]+\](:\d+)?$/i.test(input.host)) {
10335
+ throw new InvalidUrlError({ input: input.href || input });
10336
+ }
10337
+ return input;
10338
+ }
10339
+ function spreadUrlObject(urlObject, target) {
10340
+ var spread3 = target || {};
10341
+ for (var key of preservedUrlFields) {
10342
+ spread3[key] = urlObject[key];
10343
+ }
10344
+ if (spread3.hostname.startsWith("[")) {
10345
+ spread3.hostname = spread3.hostname.slice(1, -1);
10292
10346
  }
10293
- return options;
10347
+ if (spread3.port !== "") {
10348
+ spread3.port = Number(spread3.port);
10349
+ }
10350
+ spread3.path = spread3.search ? spread3.pathname + spread3.search : spread3.pathname;
10351
+ return spread3;
10294
10352
  }
10295
10353
  function removeMatchingHeaders(regex, headers) {
10296
10354
  var lastValue;
@@ -10302,36 +10360,50 @@ var require_follow_redirects = __commonJS({
10302
10360
  }
10303
10361
  return lastValue === null || typeof lastValue === "undefined" ? void 0 : String(lastValue).trim();
10304
10362
  }
10305
- function createErrorType(code, defaultMessage) {
10306
- function CustomError(cause) {
10363
+ function createErrorType(code, message, baseClass) {
10364
+ function CustomError(properties) {
10307
10365
  Error.captureStackTrace(this, this.constructor);
10308
- if (!cause) {
10309
- this.message = defaultMessage;
10310
- } else {
10311
- this.message = defaultMessage + ": " + cause.message;
10312
- this.cause = cause;
10366
+ Object.assign(this, properties || {});
10367
+ this.code = code;
10368
+ this.message = this.cause ? message + ": " + this.cause.message : message;
10369
+ }
10370
+ CustomError.prototype = new (baseClass || Error)();
10371
+ Object.defineProperties(CustomError.prototype, {
10372
+ constructor: {
10373
+ value: CustomError,
10374
+ enumerable: false
10375
+ },
10376
+ name: {
10377
+ value: "Error [" + code + "]",
10378
+ enumerable: false
10313
10379
  }
10314
- }
10315
- CustomError.prototype = new Error();
10316
- CustomError.prototype.constructor = CustomError;
10317
- CustomError.prototype.name = "Error [" + code + "]";
10318
- CustomError.prototype.code = code;
10380
+ });
10319
10381
  return CustomError;
10320
10382
  }
10321
- function abortRequest(request) {
10322
- for (var e = 0; e < events.length; e++) {
10323
- request.removeListener(events[e], eventHandlers[events[e]]);
10383
+ function destroyRequest(request, error2) {
10384
+ for (var event of events) {
10385
+ request.removeListener(event, eventHandlers[event]);
10324
10386
  }
10325
10387
  request.on("error", noop3);
10326
- request.abort();
10388
+ request.destroy(error2);
10327
10389
  }
10328
- function isSameOrSubdomain(subdomain, domain) {
10329
- if (subdomain === domain) {
10330
- return true;
10331
- }
10332
- const dot = subdomain.length - domain.length - 1;
10390
+ function isSubdomain(subdomain, domain) {
10391
+ assert(isString2(subdomain) && isString2(domain));
10392
+ var dot = subdomain.length - domain.length - 1;
10333
10393
  return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
10334
10394
  }
10395
+ function isString2(value) {
10396
+ return typeof value === "string" || value instanceof String;
10397
+ }
10398
+ function isFunction2(value) {
10399
+ return typeof value === "function";
10400
+ }
10401
+ function isBuffer2(value) {
10402
+ return typeof value === "object" && "length" in value;
10403
+ }
10404
+ function isURL(value) {
10405
+ return URL2 && value instanceof URL2;
10406
+ }
10335
10407
  module2.exports = wrap2({ http: http2, https: https2 });
10336
10408
  module2.exports.wrap = wrap2;
10337
10409
  }