dom-expressions 0.37.6 → 0.37.8
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/package.json +3 -3
- package/src/client.d.ts +1 -0
- package/src/client.js +3 -0
- package/src/server.d.ts +5 -3
- package/src/server.js +3 -8
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dom-expressions",
|
|
3
3
|
"description": "A Fine-Grained Runtime for Performant DOM Rendering",
|
|
4
|
-
"version": "0.37.
|
|
4
|
+
"version": "0.37.8",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"seroval": "^0.12.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"babel-plugin-jsx-dom-expressions": "^0.37.
|
|
26
|
+
"babel-plugin-jsx-dom-expressions": "^0.37.8",
|
|
27
27
|
"csstype": "^3.1",
|
|
28
28
|
"seroval": "^0.12.0"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "51b297d6ed45d1a3dbbe7a45f2f58b8b524427ab"
|
|
31
31
|
}
|
package/src/client.d.ts
CHANGED
package/src/client.js
CHANGED
|
@@ -549,6 +549,9 @@ export function Hydration(props) {
|
|
|
549
549
|
|
|
550
550
|
function voidFn() {}
|
|
551
551
|
|
|
552
|
+
// experimental
|
|
553
|
+
export const RequestContext = Symbol();
|
|
554
|
+
|
|
552
555
|
// deprecated
|
|
553
556
|
export function innerHTML(parent, content) {
|
|
554
557
|
!sharedConfig.context && (parent.innerHTML = content);
|
package/src/server.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export function renderToString<T>(
|
|
|
3
3
|
options?: {
|
|
4
4
|
nonce?: string;
|
|
5
5
|
renderId?: string;
|
|
6
|
-
onError
|
|
6
|
+
onError?: (err: any) => void;
|
|
7
7
|
}
|
|
8
8
|
): string;
|
|
9
9
|
export function renderToStringAsync<T>(
|
|
@@ -12,7 +12,8 @@ export function renderToStringAsync<T>(
|
|
|
12
12
|
timeoutMs?: number;
|
|
13
13
|
nonce?: string;
|
|
14
14
|
renderId?: string;
|
|
15
|
-
|
|
15
|
+
noScripts?: boolean;
|
|
16
|
+
onError?: (err: any) => void;
|
|
16
17
|
}
|
|
17
18
|
): Promise<string>;
|
|
18
19
|
export function renderToStream<T>(
|
|
@@ -22,7 +23,7 @@ export function renderToStream<T>(
|
|
|
22
23
|
renderId?: string;
|
|
23
24
|
onCompleteShell?: (info: { write: (v: string) => void }) => void;
|
|
24
25
|
onCompleteAll?: (info: { write: (v: string) => void }) => void;
|
|
25
|
-
onError
|
|
26
|
+
onError?: (err: any) => void;
|
|
26
27
|
}
|
|
27
28
|
): {
|
|
28
29
|
pipe: (writable: { write: (v: string) => void }) => void;
|
|
@@ -55,6 +56,7 @@ export function generateHydrationScript(options: { nonce?: string; eventNames?:
|
|
|
55
56
|
export declare const RequestContext: unique symbol;
|
|
56
57
|
export interface RequestEvent {
|
|
57
58
|
request: Request;
|
|
59
|
+
locals: Record<string | number | symbol, any>;
|
|
58
60
|
}
|
|
59
61
|
export function getRequestEvent(): RequestEvent | undefined;
|
|
60
62
|
|
package/src/server.js
CHANGED
|
@@ -28,7 +28,6 @@ export function renderToString(code, options = {}) {
|
|
|
28
28
|
lazy: {},
|
|
29
29
|
assets: [],
|
|
30
30
|
nonce: options.nonce,
|
|
31
|
-
event: {},
|
|
32
31
|
serialize(id, p) {
|
|
33
32
|
!sharedConfig.context.noHydrate && serializer.write(id, p);
|
|
34
33
|
}
|
|
@@ -57,10 +56,11 @@ export function renderToStringAsync(code, options = {}) {
|
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
export function renderToStream(code, options = {}) {
|
|
60
|
-
let { nonce, onCompleteShell, onCompleteAll, renderId } = options;
|
|
59
|
+
let { nonce, onCompleteShell, onCompleteAll, renderId, noScripts } = options;
|
|
61
60
|
let dispose;
|
|
62
61
|
const blockingPromises = [];
|
|
63
62
|
const pushTask = task => {
|
|
63
|
+
if (noScripts) return;
|
|
64
64
|
// TODO is the correct place to put this
|
|
65
65
|
if (!tasks && !firstFlushed) {
|
|
66
66
|
tasks = getLocalHeaderScript(renderId);
|
|
@@ -125,7 +125,6 @@ export function renderToStream(code, options = {}) {
|
|
|
125
125
|
id: renderId || "",
|
|
126
126
|
count: 0,
|
|
127
127
|
async: true,
|
|
128
|
-
event: {},
|
|
129
128
|
resources: {},
|
|
130
129
|
lazy: {},
|
|
131
130
|
suspense: {},
|
|
@@ -546,11 +545,7 @@ function replacePlaceholder(html, key, value) {
|
|
|
546
545
|
export const RequestContext = Symbol();
|
|
547
546
|
|
|
548
547
|
export function getRequestEvent() {
|
|
549
|
-
return (
|
|
550
|
-
(globalThis[RequestContext] && globalThis[RequestContext].getStore()) ||
|
|
551
|
-
(sharedConfig.context && sharedConfig.context.event) ||
|
|
552
|
-
undefined
|
|
553
|
-
);
|
|
548
|
+
return globalThis[RequestContext] ? globalThis[RequestContext].getStore() : undefined;
|
|
554
549
|
}
|
|
555
550
|
|
|
556
551
|
// consider deprecating
|