@remix-run/node 1.6.5 → 1.6.6

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/CHANGELOG.md CHANGED
@@ -1,25 +1,53 @@
1
1
  # `@remix-run/node`
2
2
 
3
+ ## 1.6.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies:
8
+ - `@remix-run/server-runtime@1.6.6`
9
+
3
10
  ## 1.6.5
4
11
 
5
12
  ### Patch Changes
6
13
 
7
- - We enhanced the type signatures of `loader`/`action` and `useLoaderData`/`useActionData` to make it possible to infer the data type from return type of its related server function.
14
+ - We enhanced the type signatures of `loader`/`action` and
15
+ `useLoaderData`/`useActionData` to make it possible to infer the data type
16
+ from return type of its related server function.
8
17
 
9
- ```tsx
10
- import type { LoaderArgs } from "@remix-run/node";
18
+ To enable this feature, you will need to use the `LoaderArgs` type from
19
+ `@remix-run/node` instead of typing the function directly:
11
20
 
12
- export async function loader(args: LoaderArgs) {
13
- return json({ greeting: "Hello!" }); // TypedResponse<{ greeting: string }>
14
- }
21
+ ```diff
22
+ - import type { LoaderFunction } from "@remix-run/node";
23
+ + import type { LoaderArgs } from "@remix-run/node";
15
24
 
16
- export default function App() {
17
- let data = useLoaderData<typeof loader>(); // { greeting: string }
18
- return <div>{data.greeting}</div>;
19
- }
25
+ - export const loader: LoaderFunction = async (args) => {
26
+ - return json<LoaderData>(data);
27
+ - }
28
+ + export async function loader(args: LoaderArgs) {
29
+ + return json(data);
30
+ + }
20
31
  ```
21
32
 
22
- See the discussion in [#1254](https://github.com/remix-run/remix/pull/1254) for more context.
33
+ Then you can infer the loader data by using `typeof loader` as the type
34
+ variable in `useLoaderData`:
35
+
36
+ ```diff
37
+ - let data = useLoaderData() as LoaderData;
38
+ + let data = useLoaderData<typeof loader>();
39
+ ```
40
+
41
+ The API above is exactly the same for your route `action` and `useActionData`
42
+ via the `ActionArgs` type.
43
+
44
+ With this change you no longer need to manually define a `LoaderData` type
45
+ (huge time and typo saver!), and we serialize all values so that
46
+ `useLoaderData` can't return types that are impossible over the network, such
47
+ as `Date` objects or functions.
48
+
49
+ See the discussions in [#1254](https://github.com/remix-run/remix/pull/1254)
50
+ and [#3276](https://github.com/remix-run/remix/pull/3276) for more context.
23
51
 
24
52
  - Updated dependencies
25
53
  - `@remix-run/server-runtime`
package/dist/base64.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5
2
+ * @remix-run/node v1.6.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/crypto.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5
2
+ * @remix-run/node v1.6.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/fetch.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5
2
+ * @remix-run/node v1.6.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/globals.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5
2
+ * @remix-run/node v1.6.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5
2
+ * @remix-run/node v1.6.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/index.d.ts CHANGED
@@ -6,5 +6,5 @@ export { createFileSessionStorage } from "./sessions/fileStorage";
6
6
  export { createFileUploadHandler as unstable_createFileUploadHandler, NodeOnDiskFile, } from "./upload/fileUploadHandler";
7
7
  export { createCookie, createCookieSessionStorage, createMemorySessionStorage, createSessionStorage, } from "./implementations";
8
8
  export { createReadableStreamFromReadable, readableStreamToString, writeAsyncIterableToWritable, writeReadableStreamToWritable, } from "./stream";
9
- export { createRequestHandler, createSession, isCookie, isSession, json, MaxPartSizeExceededError, redirect, unstable_composeUploadHandlers, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData, } from "@remix-run/server-runtime";
9
+ export { createRequestHandler, createSession, isCookie, isSession, json, JsonFunction, TypedResponse, MaxPartSizeExceededError, redirect, unstable_composeUploadHandlers, unstable_createMemoryUploadHandler, unstable_parseMultipartFormData, } from "@remix-run/server-runtime";
10
10
  export type { ActionArgs, ActionFunction, AppData, AppLoadContext, Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, CreateRequestHandlerFunction, DataFunctionArgs, EntryContext, ErrorBoundaryComponent, HandleDataRequestFunction, HandleDocumentRequestFunction, HeadersFunction, HtmlLinkDescriptor, HtmlMetaDescriptor, LinkDescriptor, LinksFunction, LoaderArgs, LoaderFunction, MemoryUploadHandlerFilterArgs, MemoryUploadHandlerOptions, MetaDescriptor, MetaFunction, PageLinkDescriptor, RequestHandler, RouteComponent, RouteHandle, ServerBuild, ServerEntryModule, Session, SessionData, SessionIdStorageStrategy, SessionStorage, UploadHandler, UploadHandlerPart, } from "@remix-run/server-runtime";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5
2
+ * @remix-run/node v1.6.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -48,10 +48,18 @@ exports.createReadableStreamFromReadable = stream.createReadableStreamFromReadab
48
48
  exports.readableStreamToString = stream.readableStreamToString;
49
49
  exports.writeAsyncIterableToWritable = stream.writeAsyncIterableToWritable;
50
50
  exports.writeReadableStreamToWritable = stream.writeReadableStreamToWritable;
51
+ Object.defineProperty(exports, 'JsonFunction', {
52
+ enumerable: true,
53
+ get: function () { return serverRuntime.JsonFunction; }
54
+ });
51
55
  Object.defineProperty(exports, 'MaxPartSizeExceededError', {
52
56
  enumerable: true,
53
57
  get: function () { return serverRuntime.MaxPartSizeExceededError; }
54
58
  });
59
+ Object.defineProperty(exports, 'TypedResponse', {
60
+ enumerable: true,
61
+ get: function () { return serverRuntime.TypedResponse; }
62
+ });
55
63
  Object.defineProperty(exports, 'createRequestHandler', {
56
64
  enumerable: true,
57
65
  get: function () { return serverRuntime.createRequestHandler; }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5
2
+ * @remix-run/node v1.6.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5
2
+ * @remix-run/node v1.6.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5
2
+ * @remix-run/node v1.6.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5
2
+ * @remix-run/node v1.6.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/dist/stream.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5
2
+ * @remix-run/node v1.6.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5
2
+ * @remix-run/node v1.6.6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remix-run/node",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
4
4
  "description": "Node.js platform abstractions for Remix",
5
5
  "bugs": {
6
6
  "url": "https://github.com/remix-run/remix/issues"
@@ -15,7 +15,7 @@
15
15
  "typings": "dist/index.d.ts",
16
16
  "sideEffects": false,
17
17
  "dependencies": {
18
- "@remix-run/server-runtime": "1.6.5",
18
+ "@remix-run/server-runtime": "1.6.6",
19
19
  "@remix-run/web-fetch": "^4.1.3",
20
20
  "@remix-run/web-file": "^3.0.2",
21
21
  "@remix-run/web-stream": "^1.0.3",