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