@blaze-cache/swr 0.3.0-beta.0 → 0.3.0
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 +12 -5
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -10,11 +10,11 @@ stale-while-revalidate still works.
|
|
|
10
10
|
## Install
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
|
-
npm install @blaze-cache/swr
|
|
13
|
+
npm install @blaze-cache/swr # swr ≥ 2 is a peer dependency
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
`@beta` is npm's dist-tag for
|
|
17
|
-
release.
|
|
16
|
+
`@beta` is npm's dist-tag for prereleases; append it to install a prerelease
|
|
17
|
+
instead of this stable release.
|
|
18
18
|
|
|
19
19
|
## Quick start
|
|
20
20
|
|
|
@@ -145,14 +145,21 @@ mutate('/api/todos'); // SWR's own revalidation for the mounted hook
|
|
|
145
145
|
## Testing
|
|
146
146
|
|
|
147
147
|
```sh
|
|
148
|
-
pnpm --filter @blaze-cache/swr test
|
|
148
|
+
pnpm --filter @blaze-cache/swr test # offline — stubbed fetcher, no network
|
|
149
|
+
pnpm --filter @blaze-cache/swr test:live # live — real public API, needs the network
|
|
149
150
|
```
|
|
150
151
|
|
|
151
|
-
The suite runs against the built package with Node's test runner, started with
|
|
152
|
+
The offline suite runs against the built package with Node's test runner, started with
|
|
152
153
|
`--experimental-test-module-mocks`: the hook test replaces the `swr` module with a
|
|
153
154
|
capture stub, so the exact config `useBlazeSWR` hands to SWR can be asserted without a
|
|
154
155
|
React renderer (the main suite needs none of that).
|
|
155
156
|
|
|
157
|
+
The live suite (4 tests) runs against `api.github.com`, proving the middleware round-trips
|
|
158
|
+
a real response body through the persisted envelope, that a fresh middleware run seeds
|
|
159
|
+
from the mirror with zero network, that a failing fetcher persists nothing, and that a
|
|
160
|
+
revalidation rewrites the same single entry in place. Every live test is skipped unless
|
|
161
|
+
`BLAZE_CACHE_LIVE=1` is set, so the default suite always runs offline.
|
|
162
|
+
|
|
156
163
|
## Documentation
|
|
157
164
|
|
|
158
165
|
Setup and the full integration reference live in the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cache/swr",
|
|
3
|
-
"version": "0.3.0
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Persist SWR in WebAssembly — instant first paint after reload while stale-while-revalidate still works",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"swr",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dist"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@blaze-cache/core": "0.3.0
|
|
38
|
+
"@blaze-cache/core": "0.3.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"swr": "^2.0.0"
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "tsc -p tsconfig.json",
|
|
49
49
|
"test": "pnpm run build && node --experimental-test-module-mocks --test",
|
|
50
|
-
"typecheck": "tsc -p tsconfig.typecheck.json"
|
|
50
|
+
"typecheck": "tsc -p tsconfig.typecheck.json",
|
|
51
|
+
"test:live": "pnpm run build && BLAZE_CACHE_LIVE=1 node --test test/live.test.mjs"
|
|
51
52
|
}
|
|
52
53
|
}
|