2023-12-18 13:12:25 +08:00
|
|
|
/*
|
|
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
|
|
Author Tobias Koppers @sokra
|
|
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
module.exports = function getInnerRequest(resolver, request) {
|
2024-01-16 21:26:16 +08:00
|
|
|
if (
|
|
|
|
typeof request.__innerRequest === "string" &&
|
2023-12-18 13:12:25 +08:00
|
|
|
request.__innerRequest_request === request.request &&
|
2024-01-16 21:26:16 +08:00
|
|
|
request.__innerRequest_relativePath === request.relativePath
|
|
|
|
)
|
2023-12-18 13:12:25 +08:00
|
|
|
return request.__innerRequest;
|
|
|
|
let innerRequest;
|
2024-01-16 21:26:16 +08:00
|
|
|
if (request.request) {
|
2023-12-18 13:12:25 +08:00
|
|
|
innerRequest = request.request;
|
2024-01-16 21:26:16 +08:00
|
|
|
if (/^\.\.?\//.test(innerRequest) && request.relativePath) {
|
2023-12-18 13:12:25 +08:00
|
|
|
innerRequest = resolver.join(request.relativePath, innerRequest);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
innerRequest = request.relativePath;
|
|
|
|
}
|
|
|
|
request.__innerRequest_request = request.request;
|
|
|
|
request.__innerRequest_relativePath = request.relativePath;
|
2024-01-16 21:26:16 +08:00
|
|
|
return (request.__innerRequest = innerRequest);
|
2023-12-18 13:12:25 +08:00
|
|
|
};
|