@remix-run/static-middleware 0.4.12 → 0.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
-
package/README.md CHANGED
@@ -75,7 +75,7 @@ let router = createRouter({
75
75
 
76
76
  ## Security
77
77
 
78
- - Prevents path traversal attacks (e.g., `../../../etc/passwd`)
78
+ - Prevents path traversal attacks
79
79
  - Only serves files with GET and HEAD requests
80
80
  - Respects the configured root directory boundary
81
81
 
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { staticFiles } from "./lib/static.js";
1
+ export { staticFiles } from './lib/static.js';
@@ -1 +1 @@
1
- {"version":3,"file":"directory-listing.d.ts","sourceRoot":"","sources":["../../src/lib/directory-listing.ts"],"names":[],"mappings":"AAaA,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CAqPnB"}
1
+ {"version":3,"file":"directory-listing.d.ts","sourceRoot":"","sources":["../../src/lib/directory-listing.ts"],"names":[],"mappings":"AAaA,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CAuQnB"}
@@ -47,8 +47,25 @@ export async function generateDirectoryListing(dirPath, pathname) {
47
47
  });
48
48
  // Build table rows
49
49
  let tableRows = [];
50
- let folderIcon = html.raw `<svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M2 3.5h4.5l1.5 1.5h6v8h-12z"/></svg>`;
51
- let fileIcon = html.raw `<svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 2h7l3 3v9H3z"/><path d="M10 2v3h3"/></svg>`;
50
+ let folderIcon = html.raw `<svg
51
+ class="icon"
52
+ viewBox="0 0 16 16"
53
+ fill="none"
54
+ stroke="currentColor"
55
+ stroke-width="1.5"
56
+ >
57
+ <path d="M2 3.5h4.5l1.5 1.5h6v8h-12z" />
58
+ </svg>`;
59
+ let fileIcon = html.raw `<svg
60
+ class="icon"
61
+ viewBox="0 0 16 16"
62
+ fill="none"
63
+ stroke="currentColor"
64
+ stroke-width="1.5"
65
+ >
66
+ <path d="M3 2h7l3 3v9H3z" />
67
+ <path d="M10 2v3h3" />
68
+ </svg>`;
52
69
  // Add parent directory link if not at root
53
70
  if (pathname !== '/' && pathname !== '') {
54
71
  let parentPath = pathname.replace(/\/$/, '').split('/').slice(0, -1).join('/') || '/';
@@ -88,8 +105,9 @@ export async function generateDirectoryListing(dirPath, pathname) {
88
105
  box-sizing: border-box;
89
106
  }
90
107
  body {
91
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
92
- Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
108
+ font-family:
109
+ -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
110
+ 'Open Sans', 'Helvetica Neue', sans-serif;
93
111
  margin: 0;
94
112
  padding: 2rem 1rem;
95
113
  background: #fff;
@@ -3,7 +3,7 @@ import * as fsp from 'node:fs/promises';
3
3
  import { openLazyFile } from '@remix-run/fs';
4
4
  import { detectMimeType } from '@remix-run/mime';
5
5
  import { createFileResponse as sendFile } from '@remix-run/response/file';
6
- import { generateDirectoryListing } from "./directory-listing.js";
6
+ import { generateDirectoryListing } from './directory-listing.js';
7
7
  /**
8
8
  * Creates a middleware that serves static files from the filesystem.
9
9
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix-run/static-middleware",
3
- "version": "0.4.12",
3
+ "version": "0.4.14",
4
4
  "description": "Middleware for serving static files from the filesystem",
5
5
  "author": "Michael Jackson <mjijackson@gmail.com>",
6
6
  "license": "MIT",
@@ -27,21 +27,21 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^24.6.0",
30
- "@typescript/native-preview": "7.0.0-dev.20251125.1",
31
- "@remix-run/assert": "0.3.0",
32
- "@remix-run/method-override-middleware": "0.1.11",
33
- "@remix-run/form-data-middleware": "0.3.3",
34
- "@remix-run/fetch-router": "0.20.0",
35
- "@remix-run/response": "0.3.6",
36
- "@remix-run/test": "0.5.0",
37
- "@remix-run/mime": "0.4.1"
30
+ "@typescript/native-preview": "7.0.0-dev.20260707.2",
31
+ "@remix-run/assert": "^0.3.0",
32
+ "@remix-run/fetch-router": "^0.21.0",
33
+ "@remix-run/form-data-middleware": "^0.3.5",
34
+ "@remix-run/response": "^0.3.8",
35
+ "@remix-run/method-override-middleware": "^0.1.13",
36
+ "@remix-run/test": "^0.6.0",
37
+ "@remix-run/mime": "^0.4.2"
38
38
  },
39
39
  "dependencies": {
40
- "@remix-run/fetch-router": "^0.20.0",
40
+ "@remix-run/fetch-router": "^0.21.0",
41
+ "@remix-run/mime": "^0.4.2",
42
+ "@remix-run/fs": "^0.4.6",
41
43
  "@remix-run/html-template": "^0.3.1",
42
- "@remix-run/fs": "^0.4.5",
43
- "@remix-run/mime": "^0.4.1",
44
- "@remix-run/response": "^0.3.6"
44
+ "@remix-run/response": "^0.3.8"
45
45
  },
46
46
  "keywords": [
47
47
  "fetch",
@@ -53,8 +53,8 @@
53
53
  "scripts": {
54
54
  "build": "tsgo -p tsconfig.build.json",
55
55
  "clean": "git clean -fdX",
56
- "test": "remix-test",
57
- "test:bun": "bun x --bun remix-test",
56
+ "test": "remix test",
57
+ "test:bun": "bun x --bun remix test",
58
58
  "typecheck": "tsgo --noEmit"
59
59
  }
60
60
  }
@@ -60,8 +60,25 @@ export async function generateDirectoryListing(
60
60
  // Build table rows
61
61
  let tableRows = []
62
62
 
63
- let folderIcon = html.raw`<svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M2 3.5h4.5l1.5 1.5h6v8h-12z"/></svg>`
64
- let fileIcon = html.raw`<svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 2h7l3 3v9H3z"/><path d="M10 2v3h3"/></svg>`
63
+ let folderIcon = html.raw`<svg
64
+ class="icon"
65
+ viewBox="0 0 16 16"
66
+ fill="none"
67
+ stroke="currentColor"
68
+ stroke-width="1.5"
69
+ >
70
+ <path d="M2 3.5h4.5l1.5 1.5h6v8h-12z" />
71
+ </svg>`
72
+ let fileIcon = html.raw`<svg
73
+ class="icon"
74
+ viewBox="0 0 16 16"
75
+ fill="none"
76
+ stroke="currentColor"
77
+ stroke-width="1.5"
78
+ >
79
+ <path d="M3 2h7l3 3v9H3z" />
80
+ <path d="M10 2v3h3" />
81
+ </svg>`
65
82
 
66
83
  // Add parent directory link if not at root
67
84
  if (pathname !== '/' && pathname !== '') {
@@ -105,8 +122,9 @@ export async function generateDirectoryListing(
105
122
  box-sizing: border-box;
106
123
  }
107
124
  body {
108
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
109
- Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
125
+ font-family:
126
+ -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
127
+ 'Open Sans', 'Helvetica Neue', sans-serif;
110
128
  margin: 0;
111
129
  padding: 2rem 1rem;
112
130
  background: #fff;