@remix-run/cloudflare 2.9.2-pre.2 → 2.9.2
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 +3 -63
- package/dist/crypto.js +1 -1
- package/dist/implementations.js +1 -1
- package/dist/index.js +1 -1
- package/dist/sessions/workersKVStorage.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,72 +1,12 @@
|
|
|
1
1
|
# `@remix-run/cloudflare`
|
|
2
2
|
|
|
3
|
-
## 2.9.2
|
|
3
|
+
## 2.9.2
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
+
- Typesafety for single-fetch: `defineLoader`, `defineClientLoader`, `defineAction`, `defineClientAction` ([#9372](https://github.com/remix-run/remix/pull/9372), [#9404](https://github.com/remix-run/remix/pull/9404))
|
|
7
8
|
- Updated dependencies:
|
|
8
|
-
- `@remix-run/server-runtime@2.9.2
|
|
9
|
-
|
|
10
|
-
## 2.9.2-pre.1
|
|
11
|
-
|
|
12
|
-
### Patch Changes
|
|
13
|
-
|
|
14
|
-
- Updated dependencies:
|
|
15
|
-
- `@remix-run/server-runtime@2.9.2-pre.1`
|
|
16
|
-
|
|
17
|
-
## 2.9.2-pre.0
|
|
18
|
-
|
|
19
|
-
### Patch Changes
|
|
20
|
-
|
|
21
|
-
- Typesafety for single-fetch: defineLoader, defineClientLoader, defineAction, defineClientAction ([#9372](https://github.com/remix-run/remix/pull/9372))
|
|
22
|
-
|
|
23
|
-
`defineLoader` and `defineAction` are helpers for authoring `loader`s and `action`s.
|
|
24
|
-
They are identity functions; they don't modify your loader or action at runtime.
|
|
25
|
-
Rather, they exist solely for typesafety by providing types for args and by ensuring valid return types.
|
|
26
|
-
|
|
27
|
-
```ts
|
|
28
|
-
export let loader = defineLoader(({ request }) => {
|
|
29
|
-
// ^? Request
|
|
30
|
-
return { a: 1, b: () => 2 };
|
|
31
|
-
// ^ type error: `b` is not serializable
|
|
32
|
-
});
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Note that `defineLoader` and `defineAction` are not technically necessary for defining loaders and actions if you aren't concerned with typesafety:
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
// this totally works! and typechecking is happy too!
|
|
39
|
-
export let loader = () => {
|
|
40
|
-
return { a: 1 };
|
|
41
|
-
};
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
This means that you can opt-in to `defineLoader` incrementally, one loader at a time.
|
|
45
|
-
|
|
46
|
-
You can return custom responses via the `json`/`defer` utilities, but doing so will revert back to the old JSON-based typesafety mechanism:
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
let loader1 = () => {
|
|
50
|
-
return { a: 1, b: new Date() };
|
|
51
|
-
};
|
|
52
|
-
function Component() {
|
|
53
|
-
let data1 = useLoaderData<typeof loader1>();
|
|
54
|
-
// ^? {a: number, b: Date}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
let loader2 = () => {
|
|
58
|
-
return json({ a: 1, b: new Date() }); // this opts-out of turbo-stream
|
|
59
|
-
};
|
|
60
|
-
function Component2() {
|
|
61
|
-
let data2 = useLoaderData<typeof loader2>();
|
|
62
|
-
// ^? JsonifyObject<{a: number, b: Date}> which is really {a: number, b: string}
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
You can also continue to return totally custom responses with `Response` though this continues to be outside of the typesystem since the built-in `Response` type is not generic
|
|
67
|
-
|
|
68
|
-
- Updated dependencies:
|
|
69
|
-
- `@remix-run/server-runtime@2.9.2-pre.0`
|
|
9
|
+
- `@remix-run/server-runtime@2.9.2`
|
|
70
10
|
|
|
71
11
|
## 2.9.1
|
|
72
12
|
|
package/dist/crypto.js
CHANGED
package/dist/implementations.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remix-run/cloudflare",
|
|
3
|
-
"version": "2.9.2
|
|
3
|
+
"version": "2.9.2",
|
|
4
4
|
"description": "Cloudflare 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
|
"dependencies": {
|
|
17
17
|
"@cloudflare/kv-asset-handler": "^0.1.3",
|
|
18
|
-
"@remix-run/server-runtime": "2.9.2
|
|
18
|
+
"@remix-run/server-runtime": "2.9.2"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@cloudflare/workers-types": "^4.20230518.0",
|