Skip to content

Commit b52ef3e

Browse files
committed
Add warning to ResourceMapper.
1 parent 49c59e8 commit b52ef3e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

lib/resource-mapper.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,18 @@ const { types, extensions } = require('mime-types')
55
const readdir = promisify(fs.readdir)
66
const HTTPError = require('./http-error')
77

8-
// A ResourceMapper maintains the mapping between HTTP URLs and server filenames,
9-
// following the principles of the “sweet spot” discussed in
10-
// https://www.w3.org/DesignIssues/HTTPFilenameMapping.html
8+
/*
9+
* A ResourceMapper maintains the mapping between HTTP URLs and server filenames,
10+
* following the principles of the “sweet spot” discussed in
11+
* https://www.w3.org/DesignIssues/HTTPFilenameMapping.html
12+
*
13+
* This class implements this mapping in a single place
14+
* such that all components use the exact same logic.
15+
*
16+
* There are few public methods, and we STRONGLY suggest not to create more.
17+
* Exposing too much of the internals would likely give other components
18+
* too much knowledge about the mapping, voiding the purpose of this class.
19+
*/
1120
class ResourceMapper {
1221
constructor ({
1322
rootUrl,

0 commit comments

Comments
 (0)