@remix-run/response 0.2.0 → 0.2.1

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.
@@ -2,7 +2,7 @@
2
2
  * Custom function for computing file digests.
3
3
  *
4
4
  * @param file The file to hash
5
- * @return The computed digest as a string
5
+ * @returns The computed digest as a string
6
6
  *
7
7
  * @example
8
8
  * async (file) => {
@@ -76,7 +76,7 @@ export interface FileResponseOptions {
76
76
  * @param file The file to send
77
77
  * @param request The request object
78
78
  * @param options Configuration options
79
- * @return A `Response` object containing the file
79
+ * @returns A `Response` object containing the file
80
80
  *
81
81
  * @example
82
82
  * import { createFileResponse } from '@remix-run/response/file'
package/dist/lib/file.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import SuperHeaders from '@remix-run/headers';
2
- import { isCompressibleMimeType } from '@remix-run/mime';
2
+ import { isCompressibleMimeType, mimeTypeToContentType } from '@remix-run/mime';
3
3
  /**
4
4
  * Creates a file [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
5
5
  * with full HTTP semantics including ETags, Last-Modified, conditional requests, and Range support.
@@ -7,7 +7,7 @@ import { isCompressibleMimeType } from '@remix-run/mime';
7
7
  * @param file The file to send
8
8
  * @param request The request object
9
9
  * @param options Configuration options
10
- * @return A `Response` object containing the file
10
+ * @returns A `Response` object containing the file
11
11
  *
12
12
  * @example
13
13
  * import { createFileResponse } from '@remix-run/response/file'
@@ -19,7 +19,7 @@ import { isCompressibleMimeType } from '@remix-run/mime';
19
19
  export async function createFileResponse(file, request, options = {}) {
20
20
  let { cacheControl, etag: etagStrategy = 'weak', digest: digestOption = 'SHA-256', lastModified: lastModifiedEnabled = true, acceptRanges: acceptRangesOption, } = options;
21
21
  let headers = new SuperHeaders(request.headers);
22
- let contentType = file.type;
22
+ let contentType = mimeTypeToContentType(file.type);
23
23
  let contentLength = file.size;
24
24
  let etag;
25
25
  if (etagStrategy === 'weak') {
@@ -6,7 +6,7 @@ type HtmlBody = string | SafeHtml | Blob | BufferSource | ReadableStream<Uint8Ar
6
6
  *
7
7
  * @param body The body of the response
8
8
  * @param init The `ResponseInit` object for the response
9
- * @return A `Response` object with a HTML body and the appropriate `Content-Type` header
9
+ * @returns A `Response` object with a HTML body and the appropriate `Content-Type` header
10
10
  */
11
11
  export declare function createHtmlResponse(body: HtmlBody, init?: ResponseInit): Response;
12
12
  export {};
package/dist/lib/html.js CHANGED
@@ -6,7 +6,7 @@ const DOCTYPE = '<!DOCTYPE html>';
6
6
  *
7
7
  * @param body The body of the response
8
8
  * @param init The `ResponseInit` object for the response
9
- * @return A `Response` object with a HTML body and the appropriate `Content-Type` header
9
+ * @returns A `Response` object with a HTML body and the appropriate `Content-Type` header
10
10
  */
11
11
  export function createHtmlResponse(body, init) {
12
12
  let payload = ensureDoctype(body);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix-run/response",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Response helpers for the web Fetch API",
5
5
  "author": "Michael Jackson <mjijackson@gmail.com>",
6
6
  "license": "MIT",
@@ -39,13 +39,13 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^24.6.0",
42
- "typescript": "^5.9.3",
43
- "@remix-run/mime": "0.1.0"
42
+ "@typescript/native-preview": "7.0.0-dev.20251125.1",
43
+ "@remix-run/mime": "0.2.0"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@remix-run/headers": "^0.18.0",
47
- "@remix-run/html-template": "^0.3.0",
48
- "@remix-run/mime": "^0.1.0"
47
+ "@remix-run/mime": "^0.2.0",
48
+ "@remix-run/html-template": "^0.3.0"
49
49
  },
50
50
  "keywords": [
51
51
  "fetch",
@@ -56,9 +56,9 @@
56
56
  "redirect"
57
57
  ],
58
58
  "scripts": {
59
- "build": "tsc -p tsconfig.build.json",
59
+ "build": "tsgo -p tsconfig.build.json",
60
60
  "clean": "git clean -fdX",
61
- "test": "node --disable-warning=ExperimentalWarning --test './src/**/*.test.ts'",
62
- "typecheck": "tsc --noEmit"
61
+ "test": "node --disable-warning=ExperimentalWarning --test",
62
+ "typecheck": "tsgo --noEmit"
63
63
  }
64
64
  }
package/src/lib/file.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import SuperHeaders from '@remix-run/headers'
2
- import { isCompressibleMimeType } from '@remix-run/mime'
2
+ import { isCompressibleMimeType, mimeTypeToContentType } from '@remix-run/mime'
3
3
 
4
4
  /**
5
5
  * Custom function for computing file digests.
6
6
  *
7
7
  * @param file The file to hash
8
- * @return The computed digest as a string
8
+ * @returns The computed digest as a string
9
9
  *
10
10
  * @example
11
11
  * async (file) => {
@@ -81,7 +81,7 @@ export interface FileResponseOptions {
81
81
  * @param file The file to send
82
82
  * @param request The request object
83
83
  * @param options Configuration options
84
- * @return A `Response` object containing the file
84
+ * @returns A `Response` object containing the file
85
85
  *
86
86
  * @example
87
87
  * import { createFileResponse } from '@remix-run/response/file'
@@ -105,7 +105,7 @@ export async function createFileResponse(
105
105
 
106
106
  let headers = new SuperHeaders(request.headers)
107
107
 
108
- let contentType = file.type
108
+ let contentType = mimeTypeToContentType(file.type)
109
109
  let contentLength = file.size
110
110
 
111
111
  let etag: string | undefined
package/src/lib/html.ts CHANGED
@@ -10,7 +10,7 @@ type HtmlBody = string | SafeHtml | Blob | BufferSource | ReadableStream<Uint8Ar
10
10
  *
11
11
  * @param body The body of the response
12
12
  * @param init The `ResponseInit` object for the response
13
- * @return A `Response` object with a HTML body and the appropriate `Content-Type` header
13
+ * @returns A `Response` object with a HTML body and the appropriate `Content-Type` header
14
14
  */
15
15
  export function createHtmlResponse(body: HtmlBody, init?: ResponseInit): Response {
16
16
  let payload: BodyInit = ensureDoctype(body)