@remix-run/static-middleware 0.4.3 → 0.4.5

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/README.md CHANGED
@@ -1,21 +1,19 @@
1
1
  # static-middleware
2
2
 
3
- Middleware for serving static files from the filesystem for use with [`@remix-run/fetch-router`](https://github.com/remix-run/remix/tree/main/packages/fetch-router).
4
-
5
- Serves static files from a directory with support for ETags, range requests, and conditional requests.
3
+ Static file serving middleware for Remix. Serves static files from a directory with support for ETags, range requests, and conditional requests.
6
4
 
7
5
  ## Features
8
6
 
9
- - [ETag support](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) (weak and strong)
10
- - [Range request support](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests) (HTTP 206 Partial Content)
11
- - [Conditional request support](https://developer.mozilla.org/en-US/docs/Web/HTTP/Conditional_requests) (If-None-Match, If-Modified-Since)
7
+ - [ETag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) support (weak and strong)
8
+ - [Range requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests) support (HTTP 206 Partial Content)
9
+ - [Conditional request](https://developer.mozilla.org/en-US/docs/Web/HTTP/Conditional_requests) support (If-None-Match, If-Modified-Since)
12
10
  - Path traversal protection
13
- - Automatic fall through to next middleware/handler if file not found
11
+ - Automatic fallback to next middleware/handler if file not found
14
12
 
15
13
  ## Installation
16
14
 
17
15
  ```sh
18
- npm install @remix-run/static-middleware
16
+ npm i remix
19
17
  ```
20
18
 
21
19
  ## Usage
@@ -23,8 +21,8 @@ npm install @remix-run/static-middleware
23
21
  Static middleware is useful for serving static files from a directory.
24
22
 
25
23
  ```ts
26
- import { createRouter } from '@remix-run/fetch-router'
27
- import { staticFiles } from '@remix-run/static-middleware'
24
+ import { createRouter } from 'remix/fetch-router'
25
+ import { staticFiles } from 'remix/static-middleware'
28
26
 
29
27
  let router = createRouter({
30
28
  middleware: [staticFiles('./public')],
@@ -8,7 +8,7 @@ import { type FileResponseOptions } from '@remix-run/response/file';
8
8
  */
9
9
  export type AcceptRangesFunction = (file: File) => boolean;
10
10
  /**
11
- * Options for the `staticFiles` middleware.
11
+ * Options for the {@link staticFiles} middleware in addition to {@link FileResponseOptions}.
12
12
  */
13
13
  export interface StaticFilesOptions extends Omit<FileResponseOptions, 'acceptRanges'> {
14
14
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix-run/static-middleware",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "Middleware for serving static files from the filesystem",
5
5
  "author": "Michael Jackson <mjijackson@gmail.com>",
6
6
  "license": "MIT",
@@ -28,18 +28,18 @@
28
28
  "devDependencies": {
29
29
  "@types/node": "^24.6.0",
30
30
  "@typescript/native-preview": "7.0.0-dev.20251125.1",
31
- "@remix-run/fetch-router": "0.16.0",
32
- "@remix-run/form-data-middleware": "0.1.3",
33
- "@remix-run/method-override-middleware": "0.1.3",
34
- "@remix-run/mime": "0.3.0",
35
- "@remix-run/response": "0.3.1"
31
+ "@remix-run/fetch-router": "0.18.0",
32
+ "@remix-run/form-data-middleware": "0.2.0",
33
+ "@remix-run/method-override-middleware": "0.1.5",
34
+ "@remix-run/mime": "0.4.0",
35
+ "@remix-run/response": "0.3.2"
36
36
  },
37
37
  "dependencies": {
38
- "@remix-run/fetch-router": "^0.16.0",
39
- "@remix-run/fs": "^0.4.1",
40
- "@remix-run/mime": "^0.3.0",
38
+ "@remix-run/fetch-router": "^0.18.0",
39
+ "@remix-run/fs": "^0.4.2",
41
40
  "@remix-run/html-template": "^0.3.0",
42
- "@remix-run/response": "^0.3.1"
41
+ "@remix-run/response": "^0.3.2",
42
+ "@remix-run/mime": "^0.4.0"
43
43
  },
44
44
  "keywords": [
45
45
  "fetch",
@@ -51,7 +51,7 @@
51
51
  "scripts": {
52
52
  "build": "tsgo -p tsconfig.build.json",
53
53
  "clean": "git clean -fdX",
54
- "test": "node --disable-warning=ExperimentalWarning --test",
54
+ "test": "node --test",
55
55
  "typecheck": "tsgo --noEmit"
56
56
  }
57
57
  }
package/src/lib/static.ts CHANGED
@@ -15,7 +15,7 @@ import { generateDirectoryListing } from './directory-listing.ts'
15
15
  export type AcceptRangesFunction = (file: File) => boolean
16
16
 
17
17
  /**
18
- * Options for the `staticFiles` middleware.
18
+ * Options for the {@link staticFiles} middleware in addition to {@link FileResponseOptions}.
19
19
  */
20
20
  export interface StaticFilesOptions extends Omit<FileResponseOptions, 'acceptRanges'> {
21
21
  /**