@vidact/start 0.2.0-beta.0 → 0.2.0-beta.10
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 +109 -0
- package/README.md +26 -5
- package/dist/client.d.ts +29 -16
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +352 -165
- package/dist/client.js.map +1 -1
- package/dist/index-client.d.ts +5 -4
- package/dist/index-client.js +4 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +4 -4
- package/dist/link-client.d.ts +6 -4
- package/dist/link-client.d.ts.map +1 -1
- package/dist/link-client.js +10 -4
- package/dist/link-client.js.map +1 -1
- package/dist/link-contract.d.ts +12 -7
- package/dist/link-contract.d.ts.map +1 -1
- package/dist/link-contract.js +12 -7
- package/dist/link-contract.js.map +1 -1
- package/dist/link.d.ts +6 -4
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +8 -4
- package/dist/link.js.map +1 -1
- package/dist/router.d.ts +57 -55
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +150 -157
- package/dist/router.js.map +1 -1
- package/dist/server.d.ts +29 -16
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +159 -100
- package/dist/server.js.map +1 -1
- package/dist/snapshot.d.ts +13 -10
- package/dist/snapshot.d.ts.map +1 -1
- package/dist/snapshot.js +19 -20
- package/dist/snapshot.js.map +1 -1
- package/dist/virtual.d.ts +3 -2
- package/dist/virtual.js +1 -2
- package/dist/vite.d.ts +18 -15
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +144 -171
- package/dist/vite.js.map +1 -1
- package/package.json +9 -8
- package/src/client.ts +577 -0
- package/src/index-client.ts +3 -0
- package/src/index.ts +3 -0
- package/src/link-client.ts +11 -0
- package/src/link-contract.ts +20 -0
- package/src/link.ts +10 -0
- package/src/router.ts +282 -0
- package/src/server.ts +295 -0
- package/src/snapshot.ts +40 -0
- package/src/virtual.ts +5 -0
- package/src/vite.ts +256 -0
- package/dist/index-client.d.ts.map +0 -1
- package/dist/index-client.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/virtual.d.ts.map +0 -1
- package/dist/virtual.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,114 @@
|
|
|
1
1
|
# @vidact/start
|
|
2
2
|
|
|
3
|
+
## 0.2.0-beta.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c2c7f1d: Prefetch routes on intent. `Link` now fetches the destination's snapshot and route modules when the pointer rests on it for 50 ms, when it receives focus, or when it is pressed, and the following click reuses that snapshot for up to 30 seconds. Hover and focus prefetching pause while the browser's data saver is on. Opt a link out with `prefetch="none"`, or prefetch from code with `client.prefetch(to)`. Navigations also start downloading route modules alongside the snapshot request instead of after it.
|
|
8
|
+
- @vidact/runtime@0.2.0-beta.10
|
|
9
|
+
- @vidact/vite@0.2.0-beta.10
|
|
10
|
+
|
|
11
|
+
## 0.2.0-beta.9
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- @vidact/vite@0.2.0-beta.9
|
|
16
|
+
- @vidact/runtime@0.2.0-beta.9
|
|
17
|
+
|
|
18
|
+
## 0.2.0-beta.8
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [e480658]
|
|
23
|
+
- @vidact/runtime@0.2.0-beta.8
|
|
24
|
+
- @vidact/vite@0.2.0-beta.8
|
|
25
|
+
|
|
26
|
+
## 0.2.0-beta.7
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- 5d2dd5d: Preserve destination fragments through successful client navigation and redirects.
|
|
31
|
+
- 977b90f: Retain unchanged Start route owners and update their loader, parameter, URL, and child props during client navigation.
|
|
32
|
+
- d35d98f: Stream the Start document shell before pending application resources and support streaming custom document shells.
|
|
33
|
+
- 8ce4ca8: Separate cached document and client-navigation responses with a Vary header.
|
|
34
|
+
- Updated dependencies [ed60a1c]
|
|
35
|
+
- Updated dependencies [977b90f]
|
|
36
|
+
- Updated dependencies [9581420]
|
|
37
|
+
- @vidact/runtime@0.2.0-beta.7
|
|
38
|
+
- @vidact/vite@0.2.0-beta.7
|
|
39
|
+
|
|
40
|
+
## 0.2.0-beta.6
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- @vidact/vite@0.2.0-beta.6
|
|
45
|
+
- @vidact/runtime@0.2.0-beta.6
|
|
46
|
+
|
|
47
|
+
## 0.2.0-beta.5
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- f7fe490: Hydration fixes for server-rendered content the client cannot reproduce immediately.
|
|
52
|
+
|
|
53
|
+
- Keep hydration markers out of raw-text elements. The server no longer emits `<!--vidact:v1:*-->` comments inside `<textarea>`, `<title>`, `<script>` and `<style>`, where the HTML parser turned them into literal text that stayed visible until hydration recovered from the mismatch. The hydrator synthesizes those markers around the element's parsed text node instead, so such elements hydrate in place.
|
|
54
|
+
- Dehydrated Suspense boundaries. When a Suspense child suspends while hydrating server-rendered content — a `lazy` chunk that has not loaded yet, for example — the boundary now keeps the server DOM on screen and swaps in the client render once the resource resolves, instead of publishing the fallback over it, mismatching, and re-mounting the whole root.
|
|
55
|
+
- `@vidact/start` renders the route tree inside a root component on the server. The client mounts the application under a compiled root of its own, which claims a component marker range; without a matching server root every client component claimed the range of the _next_ server component, which surfaced as a hydration mismatch (and a visible fallback flash) on any route whose component has more than one return.
|
|
56
|
+
- `hydrateStart` accepts `onRecoverableError`, and warns on the console by default when hydration has to recover by re-rendering. A silent recovery looks like a working page that merely flashes.
|
|
57
|
+
- Hydration mismatch messages describe the element (`DIV.class[data-x]`) instead of just its tag.
|
|
58
|
+
- Element claiming no longer prefers a candidate that contains an array marker unless the pending structural child is a list. A conditional or Suspense child triggered the same bias, so a class-less wrapper `<div>{cond ? <A/> : <B/>}</div>` could claim an unrelated sibling that happened to hold a keyed list.
|
|
59
|
+
|
|
60
|
+
- Hydration marker protocol `v2`. The server no longer wraps intrinsic elements (`s`) or scalar text (`t`) in marker comments — inside a child slot an element can only be the intrinsic child and a text node the scalar, so the hydrator infers them, splitting a text node that adjacent scalars parsed into. A scalar binding borrows its child-slot markers as its range (no DOM writes) and only creates anchor comments where there is nothing to borrow, such as inside `<textarea>`. The prefix shrank from `vidact:v1` to `v2`; together this removes about 40% of markers and 60% of marker bytes from server HTML. A `v1` render is rejected by a `v2` client and re-rendered, and vice versa.
|
|
61
|
+
|
|
62
|
+
- Updated dependencies [f7fe490]
|
|
63
|
+
- @vidact/runtime@0.2.0-beta.5
|
|
64
|
+
- @vidact/vite@0.2.0-beta.5
|
|
65
|
+
|
|
66
|
+
## 0.2.0-beta.4
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- 917f0be: Re-release CLI
|
|
71
|
+
- Updated dependencies [917f0be]
|
|
72
|
+
- @vidact/runtime@0.2.0-beta.4
|
|
73
|
+
- @vidact/vite@0.2.0-beta.4
|
|
74
|
+
|
|
75
|
+
## 0.2.0-beta.3
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- 917f0be: Release vidact CLI
|
|
80
|
+
- Updated dependencies [917f0be]
|
|
81
|
+
- @vidact/runtime@0.2.0-beta.3
|
|
82
|
+
- @vidact/vite@0.2.0-beta.3
|
|
83
|
+
|
|
84
|
+
## 0.2.0-beta.2
|
|
85
|
+
|
|
86
|
+
### Patch Changes
|
|
87
|
+
|
|
88
|
+
- 9b7d659: Build every package with `tsdown` in unbundle mode instead of `tsc` plus two
|
|
89
|
+
repository scripts. `dist` still mirrors `src` file for file, with the same entry
|
|
90
|
+
points, ESM output, declarations, declaration maps, and source maps, and the
|
|
91
|
+
runtime's tree-shaking budgets are unchanged. The Vidact Start ambient route
|
|
92
|
+
module ships as written so it stays an ambient declaration rather than a module
|
|
93
|
+
augmentation.
|
|
94
|
+
|
|
95
|
+
Packages now publish their `src` directory, so the shipped source maps and
|
|
96
|
+
declaration maps resolve. Vite no longer reports "points to missing source
|
|
97
|
+
files" for Vidact modules, debugging steps into real TypeScript, and go-to-
|
|
98
|
+
definition lands on the source rather than the declaration.
|
|
99
|
+
|
|
100
|
+
- Updated dependencies [9b7d659]
|
|
101
|
+
- @vidact/runtime@0.2.0-beta.2
|
|
102
|
+
- @vidact/vite@0.2.0-beta.2
|
|
103
|
+
|
|
104
|
+
## 0.2.0-beta.1
|
|
105
|
+
|
|
106
|
+
### Patch Changes
|
|
107
|
+
|
|
108
|
+
- Updated dependencies [7765e99]
|
|
109
|
+
- @vidact/runtime@0.2.0-beta.1
|
|
110
|
+
- @vidact/vite@0.2.0-beta.1
|
|
111
|
+
|
|
3
112
|
## 0.2.0-beta.0
|
|
4
113
|
|
|
5
114
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -45,8 +45,8 @@ application. Route components must be named functions so the Vidact compiler
|
|
|
45
45
|
can identify and lower them.
|
|
46
46
|
|
|
47
47
|
`Link` renders an ordinary anchor during SSR. After hydration, unmodified clicks
|
|
48
|
-
on same-origin Start routes request a server loader snapshot,
|
|
49
|
-
route
|
|
48
|
+
on same-origin Start routes request a server loader snapshot, update the retained
|
|
49
|
+
route chain, and update browser history without loading another document.
|
|
50
50
|
External URLs, downloads, modified clicks, `target` links, hash-only links, and
|
|
51
51
|
links with `reloadDocument` retain native browser behavior. Use `replace` to
|
|
52
52
|
replace the current history entry.
|
|
@@ -60,6 +60,27 @@ replace the current history entry.
|
|
|
60
60
|
`hydrateStart()` returns a `StartClient` whose `navigate()` method provides the
|
|
61
61
|
same behavior for programmatic navigation.
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
Links prefetch their route on intent: after the pointer rests on them for 50 ms,
|
|
64
|
+
on focus, or on press. The next navigation to that path and search reuses the
|
|
65
|
+
prefetched snapshot for up to 30 seconds. Use `prefetch="none"` to opt a link
|
|
66
|
+
out, or `client.prefetch(to)` to prefetch from code. Hover and focus prefetching
|
|
67
|
+
pause while the browser's data saver is on.
|
|
68
|
+
|
|
69
|
+
Document HTML and client-navigation snapshots share the same route URL. Start
|
|
70
|
+
marks both successful representations with `Vary: x-vidact-start-navigation`,
|
|
71
|
+
so HTTP caches that honor `Vary` keep them separate. Deployments must preserve
|
|
72
|
+
that response header when adding their own caching rules.
|
|
73
|
+
|
|
74
|
+
The built-in document streams its opening shell as soon as loaders settle. The
|
|
75
|
+
marker-complete application follows after its async resources settle, then the
|
|
76
|
+
snapshot and client script close the document. `renderDocumentShell` customizes
|
|
77
|
+
the strings before and after the application while preserving this behavior.
|
|
78
|
+
The older `renderDocument` callback still receives one `applicationHtml` string
|
|
79
|
+
and therefore buffers the application before returning a response.
|
|
80
|
+
|
|
81
|
+
Start retains the longest common prefix of component-bearing route entries.
|
|
82
|
+
Those components keep their DOM, local state, refs, and effects while their
|
|
83
|
+
`loaderData`, `params`, `requestUrl`, and `children` props update. The first
|
|
84
|
+
changed route entry and all descendants are staged as a new owned suffix, then
|
|
85
|
+
the previous suffix is disposed. Routes without a component do not establish a
|
|
86
|
+
DOM owner.
|
package/dist/client.d.ts
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { RouteManifest, StartComponent } from "./router.js";
|
|
2
|
+
import { CompiledRoot } from "@vidact/runtime";
|
|
3
|
+
//#region src/client.d.ts
|
|
4
|
+
interface HydrateStartOptions {
|
|
5
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
6
|
+
readonly manifest: RouteManifest;
|
|
7
|
+
/**
|
|
8
|
+
* Called when hydration could not attach to the server DOM and the root was rendered
|
|
9
|
+
* client-side instead. Defaults to a console warning: a silent recovery looks like a
|
|
10
|
+
* working page that merely flashes, and is far harder to notice than a warning.
|
|
11
|
+
*/
|
|
12
|
+
readonly onRecoverableError?: (error: unknown) => void;
|
|
13
|
+
readonly root?: ParentNode;
|
|
14
|
+
readonly rootId?: string;
|
|
15
|
+
readonly snapshot?: string;
|
|
16
|
+
readonly snapshotId?: string;
|
|
10
17
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
interface StartNavigateOptions {
|
|
19
|
+
readonly replace?: boolean;
|
|
20
|
+
readonly scroll?: boolean;
|
|
14
21
|
}
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
interface StartClient extends CompiledRoot {
|
|
23
|
+
readonly navigate: (to: string | URL, options?: StartNavigateOptions) => Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Fetches the route's snapshot and code ahead of a navigation. A navigation to the same
|
|
26
|
+
* path and search within 30 seconds uses the prefetched snapshot instead of a new request.
|
|
27
|
+
*/
|
|
28
|
+
readonly prefetch: (to: string | URL) => Promise<void>;
|
|
17
29
|
}
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
declare function hydrateStart(options: HydrateStartOptions): Promise<StartClient>;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { HydrateStartOptions, StartClient, type StartComponent, StartNavigateOptions, hydrateStart };
|
|
20
33
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../src/client.ts"],"mappings":";;;UAqCiB;WACN,eAAe,WAAW;WAC1B,UAAU;;;;;;WAMV,sBAAsB;WACtB,OAAO;WACP;WACA;WACA;;UAGM;WACN;WACA;;UAGM,oBAAoB;WAC1B,WAAW,aAAa,KAAK,UAAU,yBAAyB;;;;;WAKhE,WAAW,aAAa,QAAQ;;iBAkCrB,aAAa,SAAS,sBAAsB,QAAQ"}
|