@solidjs/web 2.0.0-beta.24 → 2.0.0-beta.25
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/frames/dist/client.cjs +19 -0
- package/frames/dist/client.js +19 -0
- package/package.json +7 -6
- package/types/frames/client.d.ts +13 -49
- package/types/frames/server.d.ts +1 -20
- package/types-cjs/frames/client.d.cts +13 -49
- package/types-cjs/frames/server.d.cts +1 -20
package/frames/dist/client.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var solidJs = require('solid-js');
|
|
4
|
+
var client = require('@solidjs/web/server-functions/client');
|
|
4
5
|
var seroval = require('seroval');
|
|
5
6
|
var web = require('seroval-plugins/web');
|
|
6
7
|
|
|
@@ -1283,6 +1284,9 @@ function tableFor(id) {
|
|
|
1283
1284
|
for (const [root, t] of tables) if (id.startsWith(root + ".")) return t;
|
|
1284
1285
|
return undefined;
|
|
1285
1286
|
}
|
|
1287
|
+
function beginStream(frameId) {
|
|
1288
|
+
tables.set(frameId, createJSONDataTable());
|
|
1289
|
+
}
|
|
1286
1290
|
function getFrameHost() {
|
|
1287
1291
|
if (!sharedHost) {
|
|
1288
1292
|
sharedHost = createFrameHost({
|
|
@@ -1452,6 +1456,21 @@ function installServerComponents(host = getFrameHost()) {
|
|
|
1452
1456
|
};
|
|
1453
1457
|
}
|
|
1454
1458
|
g._$SC.impl = (id, props) => documentBoundary(host, id, props);
|
|
1459
|
+
client.configureServerFunctionsClient({
|
|
1460
|
+
responseHandler: createServerComponentHandler({
|
|
1461
|
+
host,
|
|
1462
|
+
capture: () => solidJs.getOwner() ?? undefined,
|
|
1463
|
+
component: frameId => boundaryComponent(host, frameId),
|
|
1464
|
+
onStream: frameId => beginStream(frameId),
|
|
1465
|
+
documentComponent: functionId => g._$SC.c[functionId],
|
|
1466
|
+
intercept: ({
|
|
1467
|
+
id
|
|
1468
|
+
}) => {
|
|
1469
|
+
if (claimedBoundaries.has(id) || !findBoundaryRange(id)) return undefined;
|
|
1470
|
+
return g._$SC.r(id);
|
|
1471
|
+
}
|
|
1472
|
+
})
|
|
1473
|
+
});
|
|
1455
1474
|
}
|
|
1456
1475
|
|
|
1457
1476
|
exports.FRAME_APPLIED_EVENT = FRAME_APPLIED_EVENT;
|
package/frames/dist/client.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getOwner, onCleanup, runWithOwner, sharedConfig, createOwner } from 'solid-js';
|
|
2
|
+
import { configureServerFunctionsClient } from '@solidjs/web/server-functions/client';
|
|
2
3
|
import { fromCrossJSON, Feature } from 'seroval';
|
|
3
4
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
4
5
|
|
|
@@ -1281,6 +1282,9 @@ function tableFor(id) {
|
|
|
1281
1282
|
for (const [root, t] of tables) if (id.startsWith(root + ".")) return t;
|
|
1282
1283
|
return undefined;
|
|
1283
1284
|
}
|
|
1285
|
+
function beginStream(frameId) {
|
|
1286
|
+
tables.set(frameId, createJSONDataTable());
|
|
1287
|
+
}
|
|
1284
1288
|
function getFrameHost() {
|
|
1285
1289
|
if (!sharedHost) {
|
|
1286
1290
|
sharedHost = createFrameHost({
|
|
@@ -1450,6 +1454,21 @@ function installServerComponents(host = getFrameHost()) {
|
|
|
1450
1454
|
};
|
|
1451
1455
|
}
|
|
1452
1456
|
g._$SC.impl = (id, props) => documentBoundary(host, id, props);
|
|
1457
|
+
configureServerFunctionsClient({
|
|
1458
|
+
responseHandler: createServerComponentHandler({
|
|
1459
|
+
host,
|
|
1460
|
+
capture: () => getOwner() ?? undefined,
|
|
1461
|
+
component: frameId => boundaryComponent(host, frameId),
|
|
1462
|
+
onStream: frameId => beginStream(frameId),
|
|
1463
|
+
documentComponent: functionId => g._$SC.c[functionId],
|
|
1464
|
+
intercept: ({
|
|
1465
|
+
id
|
|
1466
|
+
}) => {
|
|
1467
|
+
if (claimedBoundaries.has(id) || !findBoundaryRange(id)) return undefined;
|
|
1468
|
+
return g._$SC.r(id);
|
|
1469
|
+
}
|
|
1470
|
+
})
|
|
1471
|
+
});
|
|
1453
1472
|
}
|
|
1454
1473
|
|
|
1455
1474
|
export { FRAME_APPLIED_EVENT, FRAME_STREAM_HEADER, applyFrameResponse, createFrame, createFrameHost, createFrameInsertable, createJSONDataTable, createServerComponentHandler, getFrameHost, installServerComponents, isFrameStreamResponse };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/web",
|
|
3
3
|
"description": "Solid's web runtime: client rendering, hydration, SSR, and DOM-specific control flow (Portal, Dynamic).",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.25",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -296,25 +296,26 @@
|
|
|
296
296
|
"seroval-plugins": "~1.5.4"
|
|
297
297
|
},
|
|
298
298
|
"peerDependencies": {
|
|
299
|
-
"solid-js": "^2.0.0-beta.
|
|
299
|
+
"solid-js": "^2.0.0-beta.25"
|
|
300
300
|
},
|
|
301
301
|
"devDependencies": {
|
|
302
|
-
"solid-js": "2.0.0-beta.
|
|
302
|
+
"solid-js": "2.0.0-beta.25"
|
|
303
303
|
},
|
|
304
304
|
"scripts": {
|
|
305
305
|
"build": "npm-run-all -nl build:clean types:copy-jsx build:js",
|
|
306
306
|
"build:clean": "rimraf dist/",
|
|
307
307
|
"build:js": "rollup -c",
|
|
308
308
|
"link": "symlink-dir . node_modules/@solidjs/web",
|
|
309
|
-
"types": "npm-run-all -nl types:clean types:copy-jsx types:web types:copy-web types:web-storage types:copy-
|
|
310
|
-
"types:clean": "rimraf types/ types-cjs/ storage/types/ storage/types-cjs/ serialization/types/ serialization/types-cjs/",
|
|
309
|
+
"types": "npm-run-all -nl types:clean types:copy-jsx types:web types:copy-web types:web-storage types:copy-server-functions types:web-frames types:copy-serialization types:copy-frames types:cjs",
|
|
310
|
+
"types:clean": "rimraf types/ types-cjs/ storage/types/ storage/types-cjs/ serialization/types/ serialization/types-cjs/ frames/types/",
|
|
311
311
|
"types:copy-jsx": "ncp ../../node_modules/@dom-expressions/runtime/src/jsx.d.ts ./src/jsx.d.ts && ncp ../../node_modules/@dom-expressions/runtime/src/jsx-properties.d.ts ./src/jsx-properties.d.ts && dom-expressions-jsx-types --input ./src/jsx.d.ts --element \"SolidElement | Node | ArrayElement\" --import 'import type { Element as SolidElement } from \"solid-js\";'",
|
|
312
312
|
"types:web": "tsc --project ./tsconfig.build.json",
|
|
313
313
|
"types:copy-web": "ncp ../../node_modules/@dom-expressions/runtime/src/client.d.ts ./types/client.d.ts && ncp ../../node_modules/@dom-expressions/runtime/src/server.d.ts ./types/server.d.ts && ncp ../../node_modules/@dom-expressions/runtime/src/serializer.d.ts ./types/serializer.d.ts && ncp ../../node_modules/@dom-expressions/runtime/src/response.d.ts ./types/response.d.ts && ncp ./src/jsx.d.ts ./types/jsx.d.ts && ncp ./src/jsx-properties.d.ts ./types/jsx-properties.d.ts",
|
|
314
314
|
"types:web-storage": "tsc --project ./storage/tsconfig.build.json",
|
|
315
|
+
"types:web-frames": "tsc --project ./frames/tsconfig.build.json",
|
|
315
316
|
"types:copy-serialization": "node -e \"fs.mkdirSync('./serialization/types', { recursive: true }); fs.copyFileSync('../../node_modules/@dom-expressions/runtime/src/serializer.d.ts', './serialization/types/index.d.ts');\"",
|
|
316
317
|
"types:copy-server-functions": "node -e \"fs.mkdirSync('./types/server-functions', { recursive: true }); for (const f of ['shared', 'client', 'server']) fs.copyFileSync('../../node_modules/@dom-expressions/runtime/src/server-functions/' + f + '.d.ts', './types/server-functions/' + f + '.d.ts');\"",
|
|
317
|
-
"types:copy-frames": "node -e \"fs.mkdirSync('./types/frames', { recursive: true }); for (const f of ['frame-client', 'frame-transport', 'frame-sink', 'serializer']) fs.copyFileSync('../../node_modules/@dom-expressions/runtime/src/' + f + '.d.ts', './types/frames/' + f + '.d.ts'); for (const f of ['client', 'server']) fs.
|
|
318
|
+
"types:copy-frames": "node -e \"fs.mkdirSync('./types/frames', { recursive: true }); for (const f of ['frame-client', 'frame-transport', 'frame-sink', 'serializer']) fs.copyFileSync('../../node_modules/@dom-expressions/runtime/src/' + f + '.d.ts', './types/frames/' + f + '.d.ts'); for (const f of ['client', 'server']) fs.writeFileSync('./types/frames/' + f + '.d.ts', fs.readFileSync('./frames/types/' + f + '.d.ts', 'utf8').replaceAll('@dom-expressions/runtime/src/', './'));\"",
|
|
318
319
|
"types:cjs": "node ../../scripts/sync-dual-types.mjs ./types ./types-cjs ./storage/types ./storage/types-cjs ./serialization/types ./serialization/types-cjs",
|
|
319
320
|
"test": "vitest run && vitest run --config vite.config.server.mjs && vitest run --config vite.config.hydrate.mjs",
|
|
320
321
|
"test:server": "vitest run --config vite.config.server.mjs",
|
package/types/frames/client.d.ts
CHANGED
|
@@ -1,53 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* boundaries. There is deliberately no server-component API here beyond
|
|
4
|
-
* `installServerComponents()`: `dynamic` + server functions IS the client
|
|
5
|
-
* surface — a server-function call whose response is a frame stream
|
|
6
|
-
* resolves with a stable per-call-site component.
|
|
7
|
-
*
|
|
8
|
-
* Copied next to the runtime's frame d.ts files at publish (see
|
|
9
|
-
* types:copy-frames), so the relative imports below resolve in-place.
|
|
10
|
-
*/
|
|
11
|
-
export {
|
|
12
|
-
createFrame,
|
|
13
|
-
createFrameHost,
|
|
14
|
-
createFrameInsertable,
|
|
15
|
-
FRAME_APPLIED_EVENT
|
|
16
|
-
} from "./frame-client.js";
|
|
17
|
-
export type {
|
|
18
|
-
Frame,
|
|
19
|
-
FrameChunk,
|
|
20
|
-
FrameHost,
|
|
21
|
-
FrameHostOptions,
|
|
22
|
-
FrameOptions,
|
|
23
|
-
FrameWrite,
|
|
24
|
-
Slot,
|
|
25
|
-
SlotContext
|
|
26
|
-
} from "./frame-client.js";
|
|
27
|
-
export {
|
|
28
|
-
FRAME_STREAM_HEADER,
|
|
29
|
-
applyFrameResponse,
|
|
30
|
-
isFrameStreamResponse,
|
|
31
|
-
createServerComponentHandler
|
|
32
|
-
} from "./frame-transport.js";
|
|
1
|
+
export { createFrame, createFrameHost, createFrameInsertable, FRAME_APPLIED_EVENT } from "./frame-client.js";
|
|
2
|
+
export { FRAME_STREAM_HEADER, applyFrameResponse, isFrameStreamResponse, createServerComponentHandler } from "./frame-transport.js";
|
|
33
3
|
export { createJSONDataTable } from "./serializer.js";
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
import type { FrameHost } from "./frame-client.js";
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The app-wide frame host (created on first use): one chunk router, with
|
|
40
|
-
* codec data tables rotated per response — deserializer cross-reference
|
|
41
|
-
* space is stream-scoped by contract.
|
|
42
|
-
*/
|
|
43
|
-
export function getFrameHost(): FrameHost;
|
|
44
|
-
|
|
4
|
+
export declare function getFrameHost(): any;
|
|
45
5
|
/**
|
|
46
6
|
* Installs the server-component transport policy on the server-function
|
|
47
|
-
* client: boundary identity derives from the reactive owner captured at
|
|
48
|
-
* call site,
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
7
|
+
* client: boundary identity derives from the reactive owner captured at
|
|
8
|
+
* each call site (`getOwner`), so distinct `dynamic()` sources get
|
|
9
|
+
* independent boundaries with nothing declared, refetches from the same
|
|
10
|
+
* source resolve to the identical component, and ownerless calls fall back
|
|
11
|
+
* to one boundary per function id.
|
|
12
|
+
*
|
|
13
|
+
* Call once in the client entry (an explicit call — the package is
|
|
14
|
+
* `sideEffects: false`, so a bare import would be tree-shaken away);
|
|
15
|
+
* call again to rebind to a custom host.
|
|
52
16
|
*/
|
|
53
|
-
export function installServerComponents(host?:
|
|
17
|
+
export declare function installServerComponents(host?: any): void;
|
package/types/frames/server.d.ts
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* @solidjs/web/frames — server half. Render server components (functions
|
|
3
|
-
* returned from server functions) to frame-chunk streams, serve them as
|
|
4
|
-
* framed HTTP responses through the server-function handler's
|
|
5
|
-
* transformResult hook, and render them inline during document SSR.
|
|
6
|
-
*
|
|
7
|
-
* Copied next to the runtime's frame d.ts files at publish (see
|
|
8
|
-
* types:copy-frames), so the relative imports below resolve in-place.
|
|
9
|
-
*/
|
|
10
|
-
export {
|
|
11
|
-
renderToFrameStream,
|
|
12
|
-
renderServerComponent,
|
|
13
|
-
serverComponentResponse,
|
|
14
|
-
frameTransformResult,
|
|
15
|
-
createFrameSink,
|
|
16
|
-
frameTransformDirectResult,
|
|
17
|
-
ServerComponentPlugin,
|
|
18
|
-
SERVER_COMPONENT_BOOTSTRAP
|
|
19
|
-
} from "./frame-sink.js";
|
|
20
|
-
export type { FrameAddress, FrameStream, FrameStreamOptions } from "./frame-sink.js";
|
|
1
|
+
export { renderToFrameStream, renderServerComponent, serverComponentResponse, frameTransformResult, createFrameSink, frameTransformDirectResult, ServerComponentPlugin, SERVER_COMPONENT_BOOTSTRAP } from "./frame-sink.js";
|
|
21
2
|
export { FRAME_STREAM_HEADER, isFrameStreamResponse } from "./frame-transport.js";
|
|
@@ -1,53 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* boundaries. There is deliberately no server-component API here beyond
|
|
4
|
-
* `installServerComponents()`: `dynamic` + server functions IS the client
|
|
5
|
-
* surface — a server-function call whose response is a frame stream
|
|
6
|
-
* resolves with a stable per-call-site component.
|
|
7
|
-
*
|
|
8
|
-
* Copied next to the runtime's frame d.ts files at publish (see
|
|
9
|
-
* types:copy-frames), so the relative imports below resolve in-place.
|
|
10
|
-
*/
|
|
11
|
-
export {
|
|
12
|
-
createFrame,
|
|
13
|
-
createFrameHost,
|
|
14
|
-
createFrameInsertable,
|
|
15
|
-
FRAME_APPLIED_EVENT
|
|
16
|
-
} from "./frame-client.cjs";
|
|
17
|
-
export type {
|
|
18
|
-
Frame,
|
|
19
|
-
FrameChunk,
|
|
20
|
-
FrameHost,
|
|
21
|
-
FrameHostOptions,
|
|
22
|
-
FrameOptions,
|
|
23
|
-
FrameWrite,
|
|
24
|
-
Slot,
|
|
25
|
-
SlotContext
|
|
26
|
-
} from "./frame-client.cjs";
|
|
27
|
-
export {
|
|
28
|
-
FRAME_STREAM_HEADER,
|
|
29
|
-
applyFrameResponse,
|
|
30
|
-
isFrameStreamResponse,
|
|
31
|
-
createServerComponentHandler
|
|
32
|
-
} from "./frame-transport.cjs";
|
|
1
|
+
export { createFrame, createFrameHost, createFrameInsertable, FRAME_APPLIED_EVENT } from "./frame-client.cjs";
|
|
2
|
+
export { FRAME_STREAM_HEADER, applyFrameResponse, isFrameStreamResponse, createServerComponentHandler } from "./frame-transport.cjs";
|
|
33
3
|
export { createJSONDataTable } from "./serializer.cjs";
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
import type { FrameHost } from "./frame-client.cjs";
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* The app-wide frame host (created on first use): one chunk router, with
|
|
40
|
-
* codec data tables rotated per response — deserializer cross-reference
|
|
41
|
-
* space is stream-scoped by contract.
|
|
42
|
-
*/
|
|
43
|
-
export function getFrameHost(): FrameHost;
|
|
44
|
-
|
|
4
|
+
export declare function getFrameHost(): any;
|
|
45
5
|
/**
|
|
46
6
|
* Installs the server-component transport policy on the server-function
|
|
47
|
-
* client: boundary identity derives from the reactive owner captured at
|
|
48
|
-
* call site,
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
7
|
+
* client: boundary identity derives from the reactive owner captured at
|
|
8
|
+
* each call site (`getOwner`), so distinct `dynamic()` sources get
|
|
9
|
+
* independent boundaries with nothing declared, refetches from the same
|
|
10
|
+
* source resolve to the identical component, and ownerless calls fall back
|
|
11
|
+
* to one boundary per function id.
|
|
12
|
+
*
|
|
13
|
+
* Call once in the client entry (an explicit call — the package is
|
|
14
|
+
* `sideEffects: false`, so a bare import would be tree-shaken away);
|
|
15
|
+
* call again to rebind to a custom host.
|
|
52
16
|
*/
|
|
53
|
-
export function installServerComponents(host?:
|
|
17
|
+
export declare function installServerComponents(host?: any): void;
|
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* @solidjs/web/frames — server half. Render server components (functions
|
|
3
|
-
* returned from server functions) to frame-chunk streams, serve them as
|
|
4
|
-
* framed HTTP responses through the server-function handler's
|
|
5
|
-
* transformResult hook, and render them inline during document SSR.
|
|
6
|
-
*
|
|
7
|
-
* Copied next to the runtime's frame d.ts files at publish (see
|
|
8
|
-
* types:copy-frames), so the relative imports below resolve in-place.
|
|
9
|
-
*/
|
|
10
|
-
export {
|
|
11
|
-
renderToFrameStream,
|
|
12
|
-
renderServerComponent,
|
|
13
|
-
serverComponentResponse,
|
|
14
|
-
frameTransformResult,
|
|
15
|
-
createFrameSink,
|
|
16
|
-
frameTransformDirectResult,
|
|
17
|
-
ServerComponentPlugin,
|
|
18
|
-
SERVER_COMPONENT_BOOTSTRAP
|
|
19
|
-
} from "./frame-sink.cjs";
|
|
20
|
-
export type { FrameAddress, FrameStream, FrameStreamOptions } from "./frame-sink.cjs";
|
|
1
|
+
export { renderToFrameStream, renderServerComponent, serverComponentResponse, frameTransformResult, createFrameSink, frameTransformDirectResult, ServerComponentPlugin, SERVER_COMPONENT_BOOTSTRAP } from "./frame-sink.cjs";
|
|
21
2
|
export { FRAME_STREAM_HEADER, isFrameStreamResponse } from "./frame-transport.cjs";
|