1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const path_1 = require("path");
|
4 | function shouldServe({ entrypoint, files, requestPath, }) {
|
5 | requestPath = requestPath.replace(/\/$/, '');
|
6 | entrypoint = entrypoint.replace(/\\/, '/');
|
7 | if (entrypoint === requestPath && hasProp(files, entrypoint)) {
|
8 | return true;
|
9 | }
|
10 | const { dir, name } = path_1.parse(entrypoint);
|
11 | if (name === 'index' && dir === requestPath && hasProp(files, entrypoint)) {
|
12 | return true;
|
13 | }
|
14 | return false;
|
15 | }
|
16 | exports.default = shouldServe;
|
17 | function hasProp(obj, key) {
|
18 | return Object.hasOwnProperty.call(obj, key);
|
19 | }
|