@solidjs/router 2.0.0-next.18 → 2.0.0-next.19
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/dist/data/action.js +13 -10
- package/dist/index.js +13 -10
- package/package.json +8 -8
package/dist/data/action.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { $TRACK, action as createSolidAction, createMemo, onCleanup, getOwner } from "solid-js";
|
|
2
2
|
import { isResponseEnvelope, isServer, REVALIDATE_HEADER } from "@solidjs/web";
|
|
3
|
-
import { createServerReference, decodeResponsePayload, subscribeFlightData } from "@solidjs/web/server-functions";
|
|
3
|
+
import { createServerReference, decodeResponsePayload, parseServerFunctionUrl, subscribeFlightData } from "@solidjs/web/server-functions";
|
|
4
4
|
// The explicit /server specifier is safe here: the only call site is
|
|
5
5
|
// server-guarded, so client builds tree-shake the codec away.
|
|
6
6
|
import { decodeFlashCookie } from "@solidjs/web/server-functions/server";
|
|
@@ -49,8 +49,9 @@ export function handleFormAction(evt, router, actionBase) {
|
|
|
49
49
|
throw new Error("Only POST forms are supported for Actions");
|
|
50
50
|
// A registry miss on a server-action url is a direct bind whose module
|
|
51
51
|
// never loaded client-side (server components): the url is self-describing
|
|
52
|
-
// (
|
|
53
|
-
// delegation alone is sufficient, the no-JS path
|
|
52
|
+
// (the id in the path, bound `?args` in the query), so a generic invocation
|
|
53
|
+
// is synthesized from it — delegation alone is sufficient, the no-JS path
|
|
54
|
+
// stays a no-JS fallback.
|
|
54
55
|
// Client-only actions (`https://action/`) are their module's JS by
|
|
55
56
|
// definition, so a miss there falls through to native submission.
|
|
56
57
|
const handler = actions.get(actionRef) || (serverAction && createServerFormAction(actionRef));
|
|
@@ -64,16 +65,17 @@ export function handleFormAction(evt, router, actionBase) {
|
|
|
64
65
|
}
|
|
65
66
|
/**
|
|
66
67
|
* Synthesizes a router action for a server-rendered action url. The url
|
|
67
|
-
* carries everything an invocation needs — the function id
|
|
68
|
-
* `.with()` arguments (plain JSON in
|
|
69
|
-
*
|
|
70
|
-
* FormData is posted to it verbatim
|
|
68
|
+
* carries everything an invocation needs — the function id in the path
|
|
69
|
+
* (`<endpoint>/<id>`) and any bound `.with()` arguments (plain JSON in
|
|
70
|
+
* `?args`, which the server prepends for natural-encoding bodies exactly as
|
|
71
|
+
* it does for no-JS posts) — so the FormData is posted to it verbatim
|
|
72
|
+
* through the server-function transport:
|
|
71
73
|
* submissions, `aria-busy`, redirects, revalidation, and single-flight all
|
|
72
74
|
* flow through the normal action machinery. Registered under the url, so
|
|
73
75
|
* repeat submits reuse it (and a later real registration overrides it).
|
|
74
76
|
*/
|
|
75
77
|
function createServerFormAction(url) {
|
|
76
|
-
const id =
|
|
78
|
+
const id = parseServerFunctionUrl(url);
|
|
77
79
|
if (!id)
|
|
78
80
|
return undefined;
|
|
79
81
|
// typecheck resolves the server half of the dual module; this path only
|
|
@@ -91,8 +93,9 @@ function createServerFormAction(url) {
|
|
|
91
93
|
*/
|
|
92
94
|
export function submitServerForm(router, url, form, data) {
|
|
93
95
|
const handler = actions.get(url) || createServerFormAction(url);
|
|
94
|
-
//
|
|
95
|
-
// resubmit natively (submit() bypasses the delegated
|
|
96
|
+
// not an address (`<endpoint>/<id>`) — not the server function convention;
|
|
97
|
+
// nothing can run it, resubmit natively (submit() bypasses the delegated
|
|
98
|
+
// handler)
|
|
96
99
|
if (!handler)
|
|
97
100
|
return form.submit();
|
|
98
101
|
handler.call({ r: router, f: form }, form.enctype === "multipart/form-data" ? data : new URLSearchParams(data));
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getOwner, runWithOwner, createMemo, createRenderEffect, onCleanup, untrack, createContext, createSignal, useContext, NotReadyError, isPending, DEV, flush, createComponent, createRoot, Show, createEffect, sharedConfig, getObserver, $TRACK, action as action$1 } from 'solid-js';
|
|
2
2
|
import { registerElementClaim, delegateEvents, isServer, getRequestEvent, hasFlashCookie, clearFlashCookie, createComponent as createComponent$1, memo, isServerFunction, getServerFunctionMetadata, getServerFunctionRPC, isResponseEnvelope, REVALIDATE_HEADER } from '@solidjs/web';
|
|
3
|
-
import { subscribeFlightData, decodeResponsePayload, createServerReference } from '@solidjs/web/server-functions';
|
|
3
|
+
import { subscribeFlightData, decodeResponsePayload, parseServerFunctionUrl, createServerReference } from '@solidjs/web/server-functions';
|
|
4
4
|
import { decodeFlashCookie } from '@solidjs/web/server-functions/server';
|
|
5
5
|
|
|
6
6
|
const hasSchemeRegex = /^(?:[a-z0-9]+:)?\/\//i;
|
|
@@ -2545,8 +2545,9 @@ function handleFormAction(evt, router, actionBase) {
|
|
|
2545
2545
|
if (evt.target.method.toUpperCase() !== "POST") throw new Error("Only POST forms are supported for Actions");
|
|
2546
2546
|
// A registry miss on a server-action url is a direct bind whose module
|
|
2547
2547
|
// never loaded client-side (server components): the url is self-describing
|
|
2548
|
-
// (
|
|
2549
|
-
// delegation alone is sufficient, the no-JS path
|
|
2548
|
+
// (the id in the path, bound `?args` in the query), so a generic invocation
|
|
2549
|
+
// is synthesized from it — delegation alone is sufficient, the no-JS path
|
|
2550
|
+
// stays a no-JS fallback.
|
|
2550
2551
|
// Client-only actions (`https://action/`) are their module's JS by
|
|
2551
2552
|
// definition, so a miss there falls through to native submission.
|
|
2552
2553
|
const handler = actions.get(actionRef) || serverAction && createServerFormAction(actionRef);
|
|
@@ -2562,16 +2563,17 @@ function handleFormAction(evt, router, actionBase) {
|
|
|
2562
2563
|
|
|
2563
2564
|
/**
|
|
2564
2565
|
* Synthesizes a router action for a server-rendered action url. The url
|
|
2565
|
-
* carries everything an invocation needs — the function id
|
|
2566
|
-
* `.with()` arguments (plain JSON in
|
|
2567
|
-
*
|
|
2568
|
-
* FormData is posted to it verbatim
|
|
2566
|
+
* carries everything an invocation needs — the function id in the path
|
|
2567
|
+
* (`<endpoint>/<id>`) and any bound `.with()` arguments (plain JSON in
|
|
2568
|
+
* `?args`, which the server prepends for natural-encoding bodies exactly as
|
|
2569
|
+
* it does for no-JS posts) — so the FormData is posted to it verbatim
|
|
2570
|
+
* through the server-function transport:
|
|
2569
2571
|
* submissions, `aria-busy`, redirects, revalidation, and single-flight all
|
|
2570
2572
|
* flow through the normal action machinery. Registered under the url, so
|
|
2571
2573
|
* repeat submits reuse it (and a later real registration overrides it).
|
|
2572
2574
|
*/
|
|
2573
2575
|
function createServerFormAction(url) {
|
|
2574
|
-
const id =
|
|
2576
|
+
const id = parseServerFunctionUrl(url);
|
|
2575
2577
|
if (!id) return undefined;
|
|
2576
2578
|
// typecheck resolves the server half of the dual module; this path only
|
|
2577
2579
|
// runs in the browser, where the client transport's signature applies
|
|
@@ -2591,8 +2593,9 @@ function createServerFormAction(url) {
|
|
|
2591
2593
|
*/
|
|
2592
2594
|
function submitServerForm(router, url, form, data) {
|
|
2593
2595
|
const handler = actions.get(url) || createServerFormAction(url);
|
|
2594
|
-
//
|
|
2595
|
-
// resubmit natively (submit() bypasses the delegated
|
|
2596
|
+
// not an address (`<endpoint>/<id>`) — not the server function convention;
|
|
2597
|
+
// nothing can run it, resubmit natively (submit() bypasses the delegated
|
|
2598
|
+
// handler)
|
|
2596
2599
|
if (!handler) return form.submit();
|
|
2597
2600
|
handler.call({
|
|
2598
2601
|
r: router,
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"Ryan Turnquist"
|
|
7
7
|
],
|
|
8
8
|
"license": "MIT",
|
|
9
|
-
"version": "2.0.0-next.
|
|
9
|
+
"version": "2.0.0-next.19",
|
|
10
10
|
"homepage": "https://github.com/solidjs/solid-router#readme",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
"@rollup/plugin-babel": "6.0.4",
|
|
38
38
|
"@rollup/plugin-node-resolve": "15.3.0",
|
|
39
39
|
"@rollup/plugin-terser": "0.4.4",
|
|
40
|
-
"@solidjs/vite-plugin": "3.0.0-next.
|
|
41
|
-
"@solidjs/web": "^2.0.0-rc.
|
|
40
|
+
"@solidjs/vite-plugin": "3.0.0-next.35",
|
|
41
|
+
"@solidjs/web": "^2.0.0-rc.4",
|
|
42
42
|
"@types/jest": "^29.5.14",
|
|
43
43
|
"@types/node": "^22.10.0",
|
|
44
44
|
"babel-preset-solid": "^2.0.0-rc.2",
|
|
45
45
|
"jsdom": "^25.0.1",
|
|
46
46
|
"prettier": "^3.4.1",
|
|
47
47
|
"rollup": "^4.27.4",
|
|
48
|
-
"solid-js": "^2.0.0-rc.
|
|
48
|
+
"solid-js": "^2.0.0-rc.4",
|
|
49
49
|
"typescript": "^5.7.2",
|
|
50
|
-
"vite": "^
|
|
51
|
-
"vitest": "^
|
|
50
|
+
"vite": "^8.2.2",
|
|
51
|
+
"vitest": "^4.1.11"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@solidjs/web": "^2.0.0-rc.
|
|
55
|
-
"solid-js": "^2.0.0-rc.
|
|
54
|
+
"@solidjs/web": "^2.0.0-rc.4",
|
|
55
|
+
"solid-js": "^2.0.0-rc.4"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "rm -rf dist && tsc && rollup -c",
|