Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

getInnerRequest.js 830B

123456789101112131415161718192021222324
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. module.exports = function getInnerRequest(resolver, request) {
  7. if(typeof request.__innerRequest === "string" &&
  8. request.__innerRequest_request === request.request &&
  9. request.__innerRequest_relativePath === request.relativePath)
  10. return request.__innerRequest;
  11. let innerRequest;
  12. if(request.request) {
  13. innerRequest = request.request;
  14. if(/^\.\.?\//.test(innerRequest) && request.relativePath) {
  15. innerRequest = resolver.join(request.relativePath, innerRequest);
  16. }
  17. } else {
  18. innerRequest = request.relativePath;
  19. }
  20. request.__innerRequest_request = request.request;
  21. request.__innerRequest_relativePath = request.relativePath;
  22. return request.__innerRequest = innerRequest;
  23. };