1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/enhanced-resolve/lib/getInnerRequest.js

27 lines
816 B
JavaScript
Raw Normal View History

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
};