11diff --git a/build.js b/build.js
2- index 0884d9ffaa24d0ae3ec020a6faff12b3125b2071..85b82c90346e829bbf723e913f282c80096df061 100644
2+ index 0884d9ffaa24d0ae3ec020a6faff12b3125b2071..0e2a690abb3bd121f6ba7c0855163b816f5a7a70 100644
33--- a/build.js
44+++ b/build.js
5+ @@ -1,5 +1,5 @@
6+ const fs = require('fs');
7+ - const { join, normalize, resolve } = require('path');
8+ + const { join, normalize, resolve, sep } = require('path');
9+ const { totalist } = require('totalist/sync');
10+ const { parse } = require('@polka/url');
11+ const { lookup } = require('mrmime');
512@@ -35,7 +35,7 @@ function viaCache(cache, uri, extns) {
613 }
714 }
@@ -19,6 +26,15 @@ index 0884d9ffaa24d0ae3ec020a6faff12b3125b2071..85b82c90346e829bbf723e913f282c80
1926 headers = toHeaders(name, stats, isEtag);
2027 headers['Cache-Control'] = isEtag ? 'no-cache' : 'no-store';
2128 return { abs, stats, headers };
29+ @@ -161,7 +162,7 @@ module.exports = function (dir, opts={}) {
30+ });
31+ }
32+
33+ - let lookup = opts.dev ? viaLocal.bind(0, dir, isEtag) : viaCache.bind(0, FILES);
34+ + let lookup = opts.dev ? viaLocal.bind(0, dir.endsWith(sep) ? dir : dir + sep, isEtag) : viaCache.bind(0, FILES);
35+
36+ return function (req, res, next) {
37+ let extns = [''];
2238@@ -176,7 +177,7 @@ module.exports = function (dir, opts={}) {
2339 catch (err) { /* malform uri */ }
2440 }
@@ -29,9 +45,16 @@ index 0884d9ffaa24d0ae3ec020a6faff12b3125b2071..85b82c90346e829bbf723e913f282c80
2945
3046 if (isEtag && req.headers['if-none-match'] === data.headers['ETag']) {
3147diff --git a/build.mjs b/build.mjs
32- index c93bbe6bdfb7ad13ee20f0c44d80d6aacdd64087..3dc3e22f09abcae51aef7b75c34dc08b1f6e6abd 100644
48+ index c93bbe6bdfb7ad13ee20f0c44d80d6aacdd64087..9127789c792ffb23022524fd2a6f997286afe0cf 100644
3349--- a/build.mjs
3450+++ b/build.mjs
51+ @@ -1,5 +1,5 @@
52+ import * as fs from 'fs';
53+ - import { join, normalize, resolve } from 'path';
54+ + import { join, normalize, resolve, sep } from 'path';
55+ import { totalist } from 'totalist/sync';
56+ import { parse } from '@polka/url';
57+ import { lookup } from 'mrmime';
3558@@ -35,7 +35,7 @@ function viaCache(cache, uri, extns) {
3659 }
3760 }
@@ -49,6 +72,15 @@ index c93bbe6bdfb7ad13ee20f0c44d80d6aacdd64087..3dc3e22f09abcae51aef7b75c34dc08b
4972 headers = toHeaders(name, stats, isEtag);
5073 headers['Cache-Control'] = isEtag ? 'no-cache' : 'no-store';
5174 return { abs, stats, headers };
75+ @@ -161,7 +162,7 @@ export default function (dir, opts={}) {
76+ });
77+ }
78+
79+ - let lookup = opts.dev ? viaLocal.bind(0, dir, isEtag) : viaCache.bind(0, FILES);
80+ + let lookup = opts.dev ? viaLocal.bind(0, dir.endsWith(sep) ? dir : dir + sep, isEtag) : viaCache.bind(0, FILES);
81+
82+ return function (req, res, next) {
83+ let extns = [''];
5284@@ -176,7 +177,7 @@ export default function (dir, opts={}) {
5385 catch (err) { /* malform uri */ }
5486 }
0 commit comments