From 7b562146de3ec2a761ae2c9c9d6e35675b173484 Mon Sep 17 00:00:00 2001 From: r17x Date: Fri, 19 Jul 2024 15:18:08 +0700 Subject: [PATCH 1/5] feat(react-dom): add experimental module list of experimental bind: * preconnect * prefetchDNS * preinit * preinitModule * preload * preloadModule --- src/ReactDOM.re | 27 +++++++++++++++++++++++++++ src/ReactDOM.rei | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/src/ReactDOM.re b/src/ReactDOM.re index bedb622f2..494185387 100644 --- a/src/ReactDOM.re +++ b/src/ReactDOM.re @@ -477,6 +477,33 @@ external unmountComponentAtNode: Dom.element => unit = [@mel.module "react-dom"] external flushSync: (unit => unit) => unit = "flushSync"; +module Experimental = { + [@deriving jsProperties] + type preOptions = { + [@mel.as "as"] [@mel.optional] + _as: option([ | `script ]), + [@mel.optional] + crossOrigin: option(string), + [@mel.optional] + integrity: option(string), + [@mel.optional] + nonce: option(string), + }; + + [@mel.module "react-dom"] + external preconnect: string => unit = "preconnect"; + [@mel.module "react-dom"] + external prefetchDNS: string => unit = "prefetchDNS"; + [@mel.module "react-dom"] + external preinit: string => unit = "preinit"; + [@mel.module "react-dom"] + external preinitModule: (string, ~options: preOptions=?, unit) => unit = "preinitModule"; + [@mel.module "react-dom"] + external preload: string => unit = "preload"; + [@mel.module "react-dom"] + external preloadModule: (string, ~options: preOptions=?, unit) => unit = "preloadModule"; +} + external domElementToObj: Dom.element => Js.t({..}) = "%identity"; type style = Style.t; diff --git a/src/ReactDOM.rei b/src/ReactDOM.rei index 2310ca3e2..15184c59a 100644 --- a/src/ReactDOM.rei +++ b/src/ReactDOM.rei @@ -478,6 +478,53 @@ external unmountComponentAtNode: Dom.element => unit = [@mel.module "react-dom"] external flushSync: (unit => unit) => unit = "flushSync"; +module Experimental: { + /* This module is used to bind to APIs for future versions of ReactDOM. There is no guarantee of backwards compatibility or stability. */ + + /* + preinitModule and preloadModule options. + https://react.dev/reference/react-dom/preinitModule#parameters + https://react.dev/reference/react-dom/preloadModule#parameters + */ + [@deriving jsProperties] + type preOptions = { + /* a required string. It must be 'script'. */ + [@mel.as "as"] [@mel.optional] + _as: option([ | `script ]), + /* + a required string. It must be "anonymous", "use-credentials", and "". + https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin + */ + [@mel.optional] + crossOrigin: option(string), + /* + A cryptographic hash of the module, to verify its authenticity. + https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity + */ + [@mel.optional] + integrity: option(string), + /* + A cryptographic nonce to allow the module when using a strict Content Security Policy. + https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce + */ + [@mel.optional] + nonce: option(string), + }; + + [@mel.module "react-dom"] + external preconnect: string => unit = "preconnect"; + [@mel.module "react-dom"] + external prefetchDNS: string => unit = "prefetchDNS"; + [@mel.module "react-dom"] + external preinit: string => unit = "preinit"; + [@mel.module "react-dom"] + external preinitModule: (string, ~options: preOptions=?, unit) => unit = "preinitModule"; + [@mel.module "react-dom"] + external preload: string => unit = "preload"; + [@mel.module "react-dom"] + external preloadModule: (string, ~options: preOptions=?, unit) => unit = "preloadModule"; +} + external domElementToObj: Dom.element => Js.t({..}) = "%identity"; type style = Style.t; From 57d426b670bd0af80677eeeba48b1f3c9c7d121c Mon Sep 17 00:00:00 2001 From: r17x Date: Sun, 21 Jul 2024 14:46:03 +0700 Subject: [PATCH 2/5] feat(react-dom): add options to preinit --- src/ReactDOM.re | 18 +++++++++++++++++- src/ReactDOM.rei | 44 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/ReactDOM.re b/src/ReactDOM.re index 494185387..8cfc22a78 100644 --- a/src/ReactDOM.re +++ b/src/ReactDOM.re @@ -478,6 +478,22 @@ external unmountComponentAtNode: Dom.element => unit = external flushSync: (unit => unit) => unit = "flushSync"; module Experimental = { + [@deriving jsProperties] + type preinitOptions = { + [@mel.as "as"] [@mel.optional] + _as: option([ | `script | `style ]), + [@mel.optional] + fetchPriority: option([ `auto | `high | `low ]), + [@mel.optional] + precedence: option([ `reset | `low | `medium | `high ]), + [@mel.optional] + crossOrigin: option(string), + [@mel.optional] + integrity: option(string), + [@mel.optional] + nonce: option(string), + }; + [@deriving jsProperties] type preOptions = { [@mel.as "as"] [@mel.optional] @@ -495,7 +511,7 @@ module Experimental = { [@mel.module "react-dom"] external prefetchDNS: string => unit = "prefetchDNS"; [@mel.module "react-dom"] - external preinit: string => unit = "preinit"; + external preinit: (string, ~options: preinitOptions=?, unit) => unit = "preinit"; [@mel.module "react-dom"] external preinitModule: (string, ~options: preOptions=?, unit) => unit = "preinitModule"; [@mel.module "react-dom"] diff --git a/src/ReactDOM.rei b/src/ReactDOM.rei index 15184c59a..2873d35d4 100644 --- a/src/ReactDOM.rei +++ b/src/ReactDOM.rei @@ -481,6 +481,48 @@ external flushSync: (unit => unit) => unit = "flushSync"; module Experimental: { /* This module is used to bind to APIs for future versions of ReactDOM. There is no guarantee of backwards compatibility or stability. */ + /* + preinit options. + https://react.dev/reference/react-dom/preinit#parameters + */ + [@deriving jsProperties] + type preinitOptions = { + /* possible values: "script" or "style" */ + [@mel.as "as"] [@mel.optional] + _as: option([ | `script | `style ]), + /* + Suggests a relative priority for fetching the resource. + The possible values are auto (the default), high, and low. + */ + [@mel.optional] + fetchPriority: option([ `auto | `high | `low ]), + /* + Required with Stylesheets (`style). Says where to insert the stylesheet relative to others. + Stylesheets with higher precedence can override those with lower precedence. + The possible values are reset, low, medium, high. + */ + [@mel.optional] + precedence: option([ `reset | `low | `medium | `high ]), + /* + a required string. It must be "anonymous", "use-credentials", and "". + https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin + */ + [@mel.optional] + crossOrigin: option(string), + /* + A cryptographic hash of the module, to verify its authenticity. + https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity + */ + [@mel.optional] + integrity: option(string), + /* + A cryptographic nonce to allow the module when using a strict Content Security Policy. + https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce + */ + [@mel.optional] + nonce: option(string), + }; + /* preinitModule and preloadModule options. https://react.dev/reference/react-dom/preinitModule#parameters @@ -516,7 +558,7 @@ module Experimental: { [@mel.module "react-dom"] external prefetchDNS: string => unit = "prefetchDNS"; [@mel.module "react-dom"] - external preinit: string => unit = "preinit"; + external preinit: (string, ~options: preinitOptions=?, unit) => unit = "preinit"; [@mel.module "react-dom"] external preinitModule: (string, ~options: preOptions=?, unit) => unit = "preinitModule"; [@mel.module "react-dom"] From 26e7c3c7bd7ee82d268f3f568b038a82f1234e72 Mon Sep 17 00:00:00 2001 From: r17x Date: Mon, 22 Jul 2024 01:05:37 +0700 Subject: [PATCH 3/5] feat(react-dom): add options to preload --- src/ReactDOM.re | 36 ++++++++++++++++++++++++- src/ReactDOM.rei | 68 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 2 deletions(-) diff --git a/src/ReactDOM.re b/src/ReactDOM.re index 8cfc22a78..e6de4e574 100644 --- a/src/ReactDOM.re +++ b/src/ReactDOM.re @@ -478,6 +478,40 @@ external unmountComponentAtNode: Dom.element => unit = external flushSync: (unit => unit) => unit = "flushSync"; module Experimental = { + type preloadOptions; + + [@mel.obj] + external preloadOptions: ( + ~_as: [ + | `audio + | `document + | `embed + | `fetch + | `font + | `image + | [@mel.as "object"] `object_ + | `script + | `style + | `track + | `video + | `worker + ], + ~fetchPriority: [ `auto | `high | `low ]=?, + ~referrerPolicy: [ + | [@mel.as "no-referrer"] `noReferrer + | [@mel.as "no-referrer-when-downgrade"] `noReferrerWhenDowngrade + | [@mel.as "origin"] `origin + | [@mel.as "origin-when-cross-origin"] `originWhenCrossOrigin + | [@mel.as "unsafe-url"] `unsafeUrl + ]=?, + ~imageSrcSet: string=?, + ~imageSizes: string=?, + ~crossOrigin: string=?, + ~integrity: string=?, + ~nonce: string=?, + unit + ) => preloadOptions; + [@deriving jsProperties] type preinitOptions = { [@mel.as "as"] [@mel.optional] @@ -515,7 +549,7 @@ module Experimental = { [@mel.module "react-dom"] external preinitModule: (string, ~options: preOptions=?, unit) => unit = "preinitModule"; [@mel.module "react-dom"] - external preload: string => unit = "preload"; + external preload: (string, ~options: preloadOptions=?, unit) => unit = "preload"; [@mel.module "react-dom"] external preloadModule: (string, ~options: preOptions=?, unit) => unit = "preloadModule"; } diff --git a/src/ReactDOM.rei b/src/ReactDOM.rei index 2873d35d4..81ae03aa2 100644 --- a/src/ReactDOM.rei +++ b/src/ReactDOM.rei @@ -480,6 +480,72 @@ external flushSync: (unit => unit) => unit = "flushSync"; module Experimental: { /* This module is used to bind to APIs for future versions of ReactDOM. There is no guarantee of backwards compatibility or stability. */ + /* + preload options. + https://react.dev/reference/react-dom/preload#parameters + */ + type preloadOptions; + + [@mel.obj] + external preloadOptions: ( + /* Its possible values are audio, document, embed, fetch, font, image, object, script, style, track, video, worker. */ + ~_as: [ + | `audio + | `document + | `embed + | `fetch + | `font + | `image + | [@mel.as "object"] `object_ + | `script + | `style + | `track + | `video + | `worker + ], + /* + Suggests a relative priority for fetching the resource. + The possible values are auto (the default), high, and low. + */ + ~fetchPriority: [ `auto | `high | `low ]=?, + /* + The Referrer header to send when fetching. + Its possible values are no-referrer-when-downgrade (the default), no-referrer, origin, origin-when-cross-origin, and unsafe-url. + */ + ~referrerPolicy: [ + | [@mel.as "no-referrer"] `noReferrer + | [@mel.as "no-referrer-when-downgrade"] `noReferrerWhenDowngrade + | [@mel.as "origin"] `origin + | [@mel.as "origin-when-cross-origin"] `originWhenCrossOrigin + | [@mel.as "unsafe-url"] `unsafeUrl + ]=?, + /* + For use only with as: "image". Specifies the source set of the image. + https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images + */ + ~imageSrcSet: string=?, + /* + For use only with as: "image". Specifies the source sizes of the image. + https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images + */ + ~imageSizes: string=?, + /* + a required string. It must be "anonymous", "use-credentials", and "". + https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin + */ + ~crossOrigin: string=?, + /* + A cryptographic hash of the module, to verify its authenticity. + https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity + */ + ~integrity: string=?, + /* + A cryptographic nonce to allow the module when using a strict Content Security Policy. + https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce + */ + ~nonce: string=?, + unit + ) => preloadOptions; /* preinit options. @@ -562,7 +628,7 @@ module Experimental: { [@mel.module "react-dom"] external preinitModule: (string, ~options: preOptions=?, unit) => unit = "preinitModule"; [@mel.module "react-dom"] - external preload: string => unit = "preload"; + external preload: (string, ~options: preloadOptions=?, unit) => unit = "preload"; [@mel.module "react-dom"] external preloadModule: (string, ~options: preOptions=?, unit) => unit = "preloadModule"; } From 562c8c5e5583a609064101608fd884c04ad69f19 Mon Sep 17 00:00:00 2001 From: r17x Date: Mon, 22 Jul 2024 03:00:45 +0700 Subject: [PATCH 4/5] feat(react-dom): make all _as property in options is required --- src/ReactDOM.re | 8 ++++---- src/ReactDOM.rei | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ReactDOM.re b/src/ReactDOM.re index e6de4e574..5a103f88d 100644 --- a/src/ReactDOM.re +++ b/src/ReactDOM.re @@ -514,8 +514,8 @@ module Experimental = { [@deriving jsProperties] type preinitOptions = { - [@mel.as "as"] [@mel.optional] - _as: option([ | `script | `style ]), + [@mel.as "as"] + _as: [ | `script | `style ], [@mel.optional] fetchPriority: option([ `auto | `high | `low ]), [@mel.optional] @@ -530,8 +530,8 @@ module Experimental = { [@deriving jsProperties] type preOptions = { - [@mel.as "as"] [@mel.optional] - _as: option([ | `script ]), + [@mel.as "as"] + _as: [ | `script ], [@mel.optional] crossOrigin: option(string), [@mel.optional] diff --git a/src/ReactDOM.rei b/src/ReactDOM.rei index 81ae03aa2..316703d45 100644 --- a/src/ReactDOM.rei +++ b/src/ReactDOM.rei @@ -554,8 +554,8 @@ module Experimental: { [@deriving jsProperties] type preinitOptions = { /* possible values: "script" or "style" */ - [@mel.as "as"] [@mel.optional] - _as: option([ | `script | `style ]), + [@mel.as "as"] + _as: [ | `script | `style ], /* Suggests a relative priority for fetching the resource. The possible values are auto (the default), high, and low. @@ -596,9 +596,9 @@ module Experimental: { */ [@deriving jsProperties] type preOptions = { - /* a required string. It must be 'script'. */ - [@mel.as "as"] [@mel.optional] - _as: option([ | `script ]), + /* It must be 'script'. */ + [@mel.as "as"] + _as: [ | `script ], /* a required string. It must be "anonymous", "use-credentials", and "". https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin From 2906274e8702198628bfd7fc1f06e7660aa036dd Mon Sep 17 00:00:00 2001 From: r17x Date: Mon, 22 Jul 2024 03:04:17 +0700 Subject: [PATCH 5/5] style(react-dom): formatted Experimental module --- src/ReactDOM.re | 82 ++++++++++++++------------ src/ReactDOM.rei | 146 +++++++++++++++++++++++++---------------------- 2 files changed, 122 insertions(+), 106 deletions(-) diff --git a/src/ReactDOM.re b/src/ReactDOM.re index 5a103f88d..7544cadcc 100644 --- a/src/ReactDOM.re +++ b/src/ReactDOM.re @@ -479,47 +479,52 @@ external flushSync: (unit => unit) => unit = "flushSync"; module Experimental = { type preloadOptions; - + [@mel.obj] - external preloadOptions: ( - ~_as: [ - | `audio - | `document - | `embed - | `fetch - | `font - | `image - | [@mel.as "object"] `object_ - | `script - | `style - | `track - | `video - | `worker - ], - ~fetchPriority: [ `auto | `high | `low ]=?, - ~referrerPolicy: [ - | [@mel.as "no-referrer"] `noReferrer - | [@mel.as "no-referrer-when-downgrade"] `noReferrerWhenDowngrade - | [@mel.as "origin"] `origin - | [@mel.as "origin-when-cross-origin"] `originWhenCrossOrigin - | [@mel.as "unsafe-url"] `unsafeUrl - ]=?, + external preloadOptions: + ( + ~_as: [ + | `audio + | `document + | `embed + | `fetch + | `font + | `image + | [@mel.as "object"] `object_ + | `script + | `style + | `track + | `video + | `worker + ], + ~fetchPriority: [ | `auto | `high | `low]=?, + ~referrerPolicy: [ + | [@mel.as "no-referrer"] `noReferrer + | [@mel.as "no-referrer-when-downgrade"] + `noReferrerWhenDowngrade + | [@mel.as "origin"] `origin + | [@mel.as "origin-when-cross-origin"] + `originWhenCrossOrigin + | [@mel.as "unsafe-url"] `unsafeUrl + ] + =?, ~imageSrcSet: string=?, ~imageSizes: string=?, ~crossOrigin: string=?, ~integrity: string=?, ~nonce: string=?, - unit - ) => preloadOptions; + unit + ) => + preloadOptions; [@deriving jsProperties] type preinitOptions = { [@mel.as "as"] - _as: [ | `script | `style ], + _as: [ | `script | `style], [@mel.optional] - fetchPriority: option([ `auto | `high | `low ]), + fetchPriority: option([ | `auto | `high | `low]), [@mel.optional] - precedence: option([ `reset | `low | `medium | `high ]), + precedence: option([ | `reset | `low | `medium | `high]), [@mel.optional] crossOrigin: option(string), [@mel.optional] @@ -531,7 +536,7 @@ module Experimental = { [@deriving jsProperties] type preOptions = { [@mel.as "as"] - _as: [ | `script ], + _as: [ | `script], [@mel.optional] crossOrigin: option(string), [@mel.optional] @@ -540,19 +545,22 @@ module Experimental = { nonce: option(string), }; - [@mel.module "react-dom"] - external preconnect: string => unit = "preconnect"; + [@mel.module "react-dom"] external preconnect: string => unit = "preconnect"; [@mel.module "react-dom"] external prefetchDNS: string => unit = "prefetchDNS"; [@mel.module "react-dom"] - external preinit: (string, ~options: preinitOptions=?, unit) => unit = "preinit"; + external preinit: (string, ~options: preinitOptions=?, unit) => unit = + "preinit"; [@mel.module "react-dom"] - external preinitModule: (string, ~options: preOptions=?, unit) => unit = "preinitModule"; + external preinitModule: (string, ~options: preOptions=?, unit) => unit = + "preinitModule"; [@mel.module "react-dom"] - external preload: (string, ~options: preloadOptions=?, unit) => unit = "preload"; + external preload: (string, ~options: preloadOptions=?, unit) => unit = + "preload"; [@mel.module "react-dom"] - external preloadModule: (string, ~options: preOptions=?, unit) => unit = "preloadModule"; -} + external preloadModule: (string, ~options: preOptions=?, unit) => unit = + "preloadModule"; +}; external domElementToObj: Dom.element => Js.t({..}) = "%identity"; diff --git a/src/ReactDOM.rei b/src/ReactDOM.rei index 316703d45..1433e0859 100644 --- a/src/ReactDOM.rei +++ b/src/ReactDOM.rei @@ -487,65 +487,70 @@ module Experimental: { type preloadOptions; [@mel.obj] - external preloadOptions: ( + external preloadOptions: /* Its possible values are audio, document, embed, fetch, font, image, object, script, style, track, video, worker. */ - ~_as: [ - | `audio - | `document - | `embed - | `fetch - | `font - | `image - | [@mel.as "object"] `object_ - | `script - | `style - | `track - | `video - | `worker - ], - /* - Suggests a relative priority for fetching the resource. - The possible values are auto (the default), high, and low. - */ - ~fetchPriority: [ `auto | `high | `low ]=?, - /* - The Referrer header to send when fetching. - Its possible values are no-referrer-when-downgrade (the default), no-referrer, origin, origin-when-cross-origin, and unsafe-url. - */ - ~referrerPolicy: [ - | [@mel.as "no-referrer"] `noReferrer - | [@mel.as "no-referrer-when-downgrade"] `noReferrerWhenDowngrade - | [@mel.as "origin"] `origin - | [@mel.as "origin-when-cross-origin"] `originWhenCrossOrigin - | [@mel.as "unsafe-url"] `unsafeUrl - ]=?, - /* - For use only with as: "image". Specifies the source set of the image. - https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images - */ - ~imageSrcSet: string=?, - /* - For use only with as: "image". Specifies the source sizes of the image. - https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images - */ - ~imageSizes: string=?, - /* - a required string. It must be "anonymous", "use-credentials", and "". - https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin - */ - ~crossOrigin: string=?, - /* - A cryptographic hash of the module, to verify its authenticity. - https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity - */ - ~integrity: string=?, - /* - A cryptographic nonce to allow the module when using a strict Content Security Policy. - https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce - */ - ~nonce: string=?, - unit - ) => preloadOptions; + ( + ~_as: [ + | `audio + | `document + | `embed + | `fetch + | `font + | `image + | [@mel.as "object"] `object_ + | `script + | `style + | `track + | `video + | `worker + ], + /* + Suggests a relative priority for fetching the resource. + The possible values are auto (the default), high, and low. + */ + ~fetchPriority: [ | `auto | `high | `low]=?, + /* + The Referrer header to send when fetching. + Its possible values are no-referrer-when-downgrade (the default), no-referrer, origin, origin-when-cross-origin, and unsafe-url. + */ + ~referrerPolicy: [ + | [@mel.as "no-referrer"] `noReferrer + | [@mel.as "no-referrer-when-downgrade"] + `noReferrerWhenDowngrade + | [@mel.as "origin"] `origin + | [@mel.as "origin-when-cross-origin"] + `originWhenCrossOrigin + | [@mel.as "unsafe-url"] `unsafeUrl + ] + =?, + /* + For use only with as: "image". Specifies the source set of the image. + https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images + */ + ~imageSrcSet: string=?, + /* + For use only with as: "image". Specifies the source sizes of the image. + https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images + */ + ~imageSizes: string=?, + /* + a required string. It must be "anonymous", "use-credentials", and "". + https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin + */ + ~crossOrigin: string=?, + /* + A cryptographic hash of the module, to verify its authenticity. + https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity + */ + ~integrity: string=?, + /* + A cryptographic nonce to allow the module when using a strict Content Security Policy. + https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce + */ + ~nonce: string=?, + unit + ) => + preloadOptions; /* preinit options. @@ -555,20 +560,20 @@ module Experimental: { type preinitOptions = { /* possible values: "script" or "style" */ [@mel.as "as"] - _as: [ | `script | `style ], + _as: [ | `script | `style], /* Suggests a relative priority for fetching the resource. The possible values are auto (the default), high, and low. */ [@mel.optional] - fetchPriority: option([ `auto | `high | `low ]), + fetchPriority: option([ | `auto | `high | `low]), /* Required with Stylesheets (`style). Says where to insert the stylesheet relative to others. Stylesheets with higher precedence can override those with lower precedence. The possible values are reset, low, medium, high. */ [@mel.optional] - precedence: option([ `reset | `low | `medium | `high ]), + precedence: option([ | `reset | `low | `medium | `high]), /* a required string. It must be "anonymous", "use-credentials", and "". https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin @@ -598,7 +603,7 @@ module Experimental: { type preOptions = { /* It must be 'script'. */ [@mel.as "as"] - _as: [ | `script ], + _as: [ | `script], /* a required string. It must be "anonymous", "use-credentials", and "". https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin @@ -619,19 +624,22 @@ module Experimental: { nonce: option(string), }; - [@mel.module "react-dom"] - external preconnect: string => unit = "preconnect"; + [@mel.module "react-dom"] external preconnect: string => unit = "preconnect"; [@mel.module "react-dom"] external prefetchDNS: string => unit = "prefetchDNS"; [@mel.module "react-dom"] - external preinit: (string, ~options: preinitOptions=?, unit) => unit = "preinit"; + external preinit: (string, ~options: preinitOptions=?, unit) => unit = + "preinit"; [@mel.module "react-dom"] - external preinitModule: (string, ~options: preOptions=?, unit) => unit = "preinitModule"; + external preinitModule: (string, ~options: preOptions=?, unit) => unit = + "preinitModule"; [@mel.module "react-dom"] - external preload: (string, ~options: preloadOptions=?, unit) => unit = "preload"; + external preload: (string, ~options: preloadOptions=?, unit) => unit = + "preload"; [@mel.module "react-dom"] - external preloadModule: (string, ~options: preOptions=?, unit) => unit = "preloadModule"; -} + external preloadModule: (string, ~options: preOptions=?, unit) => unit = + "preloadModule"; +}; external domElementToObj: Dom.element => Js.t({..}) = "%identity";