source: imaps-frontend/node_modules/enhanced-resolve/lib/getInnerRequest.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8/** @typedef {import("./Resolver")} Resolver */
9/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */
10
11/**
12 * @param {Resolver} resolver resolver
13 * @param {ResolveRequest} request string
14 * @returns {string} inner request
15 */
16module.exports = function getInnerRequest(resolver, request) {
17 if (
18 typeof request.__innerRequest === "string" &&
19 request.__innerRequest_request === request.request &&
20 request.__innerRequest_relativePath === request.relativePath
21 )
22 return request.__innerRequest;
23 /** @type {string|undefined} */
24 let innerRequest;
25 if (request.request) {
26 innerRequest = request.request;
27 if (/^\.\.?(?:\/|$)/.test(innerRequest) && request.relativePath) {
28 innerRequest = resolver.join(request.relativePath, innerRequest);
29 }
30 } else {
31 innerRequest = request.relativePath;
32 }
33 request.__innerRequest_request = request.request;
34 request.__innerRequest_relativePath = request.relativePath;
35 return (request.__innerRequest = /** @type {string} */ (innerRequest));
36};
Note: See TracBrowser for help on using the repository browser.