dom-expressions 0.40.2 → 0.40.3

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 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.40.2",
4
+ "version": "0.40.3",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -24,10 +24,10 @@
24
24
  "seroval-plugins": "~1.3.0"
25
25
  },
26
26
  "devDependencies": {
27
- "babel-plugin-jsx-dom-expressions": "^0.40.1",
27
+ "babel-plugin-jsx-dom-expressions": "^0.40.3",
28
28
  "csstype": "^3.1",
29
29
  "seroval": "~1.3.0",
30
30
  "seroval-plugins": "~1.3.0"
31
31
  },
32
- "gitHead": "2c44b1854b7b2863a506ee32517e6f962804609e"
32
+ "gitHead": "f241fd111f65fcd81f61191056eda59235929536"
33
33
  }
package/src/serializer.js CHANGED
@@ -19,24 +19,28 @@ const ES2017FLAG =
19
19
 
20
20
  const GLOBAL_IDENTIFIER = '_$HY.r'; // TODO this is a pending name
21
21
 
22
- export function createSerializer({ onData, onDone, scopeId, onError }) {
22
+ export function createSerializer({ onData, onDone, scopeId, onError, plugins: customPlugins }) {
23
+ const defaultPlugins = [
24
+ AbortSignalPlugin,
25
+ // BlobPlugin,
26
+ CustomEventPlugin,
27
+ DOMExceptionPlugin,
28
+ EventPlugin,
29
+ // FilePlugin,
30
+ FormDataPlugin,
31
+ HeadersPlugin,
32
+ ReadableStreamPlugin,
33
+ RequestPlugin,
34
+ ResponsePlugin,
35
+ URLSearchParamsPlugin,
36
+ URLPlugin,
37
+ ];
38
+
39
+ const allPlugins = customPlugins ? [...customPlugins, ...defaultPlugins] : defaultPlugins
40
+
23
41
  return new Serializer({
24
42
  scopeId,
25
- plugins: [
26
- AbortSignalPlugin,
27
- // BlobPlugin,
28
- CustomEventPlugin,
29
- DOMExceptionPlugin,
30
- EventPlugin,
31
- // FilePlugin,
32
- FormDataPlugin,
33
- HeadersPlugin,
34
- ReadableStreamPlugin,
35
- RequestPlugin,
36
- ResponsePlugin,
37
- URLSearchParamsPlugin,
38
- URLPlugin,
39
- ],
43
+ plugins: allPlugins,
40
44
  globalIdentifier: GLOBAL_IDENTIFIER,
41
45
  disabledFeatures: ES2017FLAG,
42
46
  onData,
package/src/server.js CHANGED
@@ -25,6 +25,7 @@ export function renderToString(code, options = {}) {
25
25
  let scripts = "";
26
26
  const serializer = createSerializer({
27
27
  scopeId: renderId,
28
+ plugins: options.plugins,
28
29
  onData(script) {
29
30
  if (!scripts) {
30
31
  scripts = getLocalHeaderScript(renderId);
@@ -100,6 +101,7 @@ export function renderToStream(code, options = {}) {
100
101
  };
101
102
  const serializer = createSerializer({
102
103
  scopeId: options.renderId,
104
+ plugins: options.plugins,
103
105
  onData: pushTask,
104
106
  onDone,
105
107
  onError: options.onError
@@ -418,7 +420,7 @@ export function ssrAttribute(key, value, isBoolean) {
418
420
 
419
421
  export function ssrHydrationKey() {
420
422
  const hk = getHydrationKey();
421
- return hk ? ` data-hk=${hk}` : "";
423
+ return hk ? ` data-hk="${hk}"` : "";
422
424
  }
423
425
 
424
426
  export function escape(s, attr) {