@remix-run/node 1.6.5-pre.1 → 1.6.6-pre.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.
package/CHANGELOG.md CHANGED
@@ -1,31 +1,60 @@
1
- # @remix-run/node
1
+ # `@remix-run/node`
2
2
 
3
- ## 1.6.5-pre.1
3
+ ## 1.6.6-pre.1
4
4
 
5
5
  ### Patch Changes
6
6
 
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.
7
+ - Updated dependencies:
8
+ - `@remix-run/server-runtime@1.6.6-pre.1`
8
9
 
9
- ```tsx
10
- import type { LoaderArgs } from "@remix-run/node";
10
+ ## 1.6.6-pre.0
11
11
 
12
- export async function loader(args: LoaderArgs) {
13
- return json({ greeting: "Hello!" }); // TypedResponse<{ greeting: string }>
14
- }
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies:
15
+ - `@remix-run/server-runtime@1.6.6-pre.0`
16
+
17
+ ## 1.6.5
18
+
19
+ ### Patch Changes
20
+
21
+ - We enhanced the type signatures of `loader`/`action` and
22
+ `useLoaderData`/`useActionData` to make it possible to infer the data type
23
+ from return type of its related server function.
24
+
25
+ To enable this feature, you will need to use the `LoaderArgs` type from
26
+ `@remix-run/node` instead of typing the function directly:
15
27
 
16
- export default function App() {
17
- let data = useLoaderData<typeof loader>(); // { greeting: string }
18
- return <div>{data.greeting}</div>;
19
- }
28
+ ```diff
29
+ - import type { LoaderFunction } from "@remix-run/node";
30
+ + import type { LoaderArgs } from "@remix-run/node";
31
+
32
+ - export const loader: LoaderFunction = async (args) => {
33
+ - return json<LoaderData>(data);
34
+ - }
35
+ + export async function loader(args: LoaderArgs) {
36
+ + return json(data);
37
+ + }
20
38
  ```
21
39
 
22
- See the discussion in #1254 for more context.
40
+ Then you can infer the loader data by using `typeof loader` as the type
41
+ variable in `useLoaderData`:
23
42
 
24
- - Updated dependencies
25
- - @remix-run/server-runtime@1.6.5-pre.1
43
+ ```diff
44
+ - let data = useLoaderData() as LoaderData;
45
+ + let data = useLoaderData<typeof loader>();
46
+ ```
26
47
 
27
- ## 1.6.5-pre.0
48
+ The API above is exactly the same for your route `action` and `useActionData`
49
+ via the `ActionArgs` type.
28
50
 
29
- ### Patch Changes
51
+ With this change you no longer need to manually define a `LoaderData` type
52
+ (huge time and typo saver!), and we serialize all values so that
53
+ `useLoaderData` can't return types that are impossible over the network, such
54
+ as `Date` objects or functions.
55
+
56
+ See the discussions in [#1254](https://github.com/remix-run/remix/pull/1254)
57
+ and [#3276](https://github.com/remix-run/remix/pull/3276) for more context.
30
58
 
31
- - @remix-run/server-runtime@1.6.5-pre.0
59
+ - Updated dependencies
60
+ - `@remix-run/server-runtime`
package/dist/base64.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5-pre.1
2
+ * @remix-run/node v1.6.6-pre.1
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-pre.1
2
+ * @remix-run/node v1.6.6-pre.1
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-pre.1
2
+ * @remix-run/node v1.6.6-pre.1
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-pre.1
2
+ * @remix-run/node v1.6.6-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5-pre.1
2
+ * @remix-run/node v1.6.6-pre.1
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-pre.1
2
+ * @remix-run/node v1.6.6-pre.1
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-pre.1
2
+ * @remix-run/node v1.6.6-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5-pre.1
2
+ * @remix-run/node v1.6.6-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5-pre.1
2
+ * @remix-run/node v1.6.6-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5-pre.1
2
+ * @remix-run/node v1.6.6-pre.1
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-pre.1
2
+ * @remix-run/node v1.6.6-pre.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @remix-run/node v1.6.5-pre.1
2
+ * @remix-run/node v1.6.6-pre.1
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-pre.1",
3
+ "version": "1.6.6-pre.1",
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-pre.1",
18
+ "@remix-run/server-runtime": "1.6.6-pre.1",
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",