react-server-dom-webpack 0.0.1 → 18.3.0-next-d925a8d0b-20221024
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/LICENSE +21 -0
- package/README.md +5 -0
- package/cjs/react-server-dom-webpack-client.development.js +893 -0
- package/cjs/react-server-dom-webpack-client.production.min.js +26 -0
- package/cjs/react-server-dom-webpack-node-register.js +143 -0
- package/cjs/react-server-dom-webpack-plugin.js +255 -0
- package/cjs/react-server-dom-webpack-server.browser.development.js +2305 -0
- package/cjs/react-server-dom-webpack-server.browser.production.min.js +56 -0
- package/cjs/react-server-dom-webpack-server.node.development.js +2360 -0
- package/cjs/react-server-dom-webpack-server.node.production.min.js +58 -0
- package/client.js +7 -0
- package/esm/package.json +3 -0
- package/esm/react-server-dom-webpack-node-loader.js +277 -0
- package/index.js +12 -1
- package/node-register.js +3 -0
- package/package.json +55 -12
- package/plugin.js +3 -0
- package/server.browser.js +7 -0
- package/server.js +6 -0
- package/server.node.js +7 -0
- package/umd/react-server-dom-webpack-client.development.js +890 -0
- package/umd/react-server-dom-webpack-client.production.min.js +23 -0
- package/umd/react-server-dom-webpack-server.browser.development.js +2301 -0
- package/umd/react-server-dom-webpack-server.browser.production.min.js +49 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
/**
|
2
|
+
* @license React
|
3
|
+
* react-server-dom-webpack-server.node.production.min.js
|
4
|
+
*
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
6
|
+
*
|
7
|
+
* This source code is licensed under the MIT license found in the
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
9
|
+
*/
|
10
|
+
'use strict';var aa=require("util"),ba=require("async_hooks"),ca=require("react");var da=new ba.AsyncLocalStorage,e=null,m=0,n=!0;function p(a,b){a=a.write(b);n=n&&a}
|
11
|
+
function q(a,b){if("string"===typeof b){if(0!==b.length)if(2048<3*b.length)0<m&&(p(a,e.subarray(0,m)),e=new Uint8Array(2048),m=0),p(a,r.encode(b));else{var d=e;0<m&&(d=e.subarray(m));d=r.encodeInto(b,d);var c=d.read;m+=d.written;c<b.length&&(p(a,e),e=new Uint8Array(2048),m=r.encodeInto(b.slice(c),e).written);2048===m&&(p(a,e),e=new Uint8Array(2048),m=0)}}else 0!==b.byteLength&&(2048<b.byteLength?(0<m&&(p(a,e.subarray(0,m)),e=new Uint8Array(2048),m=0),p(a,b)):(d=e.length-m,d<b.byteLength&&(0===d?p(a,
|
12
|
+
e):(e.set(b.subarray(0,d),m),m+=d,p(a,e),b=b.subarray(d)),e=new Uint8Array(2048),m=0),e.set(b,m),m+=b.byteLength,2048===m&&(p(a,e),e=new Uint8Array(2048),m=0)));return n}var r=new aa.TextEncoder;function t(a){return r.encode(a)}
|
13
|
+
var u=JSON.stringify,w=Symbol.for("react.module.reference"),x=Symbol.for("react.element"),ea=Symbol.for("react.fragment"),fa=Symbol.for("react.provider"),ha=Symbol.for("react.server_context"),ia=Symbol.for("react.forward_ref"),ja=Symbol.for("react.suspense"),ka=Symbol.for("react.suspense_list"),la=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),ma=Symbol.for("react.default_value"),na=Symbol.for("react.memo_cache_sentinel");
|
14
|
+
function A(a,b,d,c,f,g,h){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=c;this.attributeNamespace=f;this.mustUseProperty=d;this.propertyName=a;this.type=b;this.sanitizeURL=g;this.removeEmptyString=h}"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){new A(a,0,!1,a,null,!1,!1)});
|
15
|
+
[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){new A(a[0],1,!1,a[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){new A(a,2,!1,a.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){new A(a,2,!1,a,null,!1,!1)});
|
16
|
+
"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){new A(a,3,!1,a.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(a){new A(a,3,!0,a,null,!1,!1)});["capture","download"].forEach(function(a){new A(a,4,!1,a,null,!1,!1)});
|
17
|
+
["cols","rows","size","span"].forEach(function(a){new A(a,6,!1,a,null,!1,!1)});["rowSpan","start"].forEach(function(a){new A(a,5,!1,a.toLowerCase(),null,!1,!1)});var B=/[\-:]([a-z])/g;function C(a){return a[1].toUpperCase()}
|
18
|
+
"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var b=a.replace(B,
|
19
|
+
C);new A(b,1,!1,a,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(B,C);new A(b,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(B,C);new A(b,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(a){new A(a,1,!1,a.toLowerCase(),null,!1,!1)});
|
20
|
+
new A("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(a){new A(a,1,!1,a.toLowerCase(),null,!0,!0)});
|
21
|
+
var D={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,
|
22
|
+
fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},oa=["Webkit","ms","Moz","O"];Object.keys(D).forEach(function(a){oa.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);D[b]=D[a]})});var pa=Array.isArray;t("<script>");t("\x3c/script>");t('<script src="');t('<script type="module" src="');t('" integrity="');t('" async="">\x3c/script>');t("\x3c!-- --\x3e");t(' style="');t(":");t(";");t(" ");t('="');t('"');
|
23
|
+
t('=""');t(">");t("/>");t(' selected=""');t("\n");t("<!DOCTYPE html>");t("</");t(">");t('<template id="');t('"></template>');t("\x3c!--$--\x3e");t('\x3c!--$?--\x3e<template id="');t('"></template>');t("\x3c!--$!--\x3e");t("\x3c!--/$--\x3e");t("<template");t('"');t(' data-dgst="');t(' data-msg="');t(' data-stck="');t("></template>");t('<div hidden id="');t('">');t("</div>");t('<svg aria-hidden="true" style="display:none" id="');t('">');t("</svg>");t('<math aria-hidden="true" style="display:none" id="');
|
24
|
+
t('">');t("</math>");t('<table hidden id="');t('">');t("</table>");t('<table hidden><tbody id="');t('">');t("</tbody></table>");t('<table hidden><tr id="');t('">');t("</tr></table>");t('<table hidden><colgroup id="');t('">');t("</colgroup></table>");t('$RS=function(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};;$RS("');t('$RS("');t('","');t('")\x3c/script>');t('$RC=function(b,c,e){c=document.getElementById(c);c.parentNode.removeChild(c);var a=document.getElementById(b);if(a){b=a.previousSibling;if(e)b.data="$!",a.setAttribute("data-dgst",e);else{e=b.parentNode;a=b.nextSibling;var f=0;do{if(a&&8===a.nodeType){var d=a.data;if("/$"===d)if(0===f)break;else f--;else"$"!==d&&"$?"!==d&&"$!"!==d||f++}d=a.nextSibling;e.removeChild(a);a=d}while(a);for(;c.firstChild;)e.insertBefore(c.firstChild,a);b.data="$"}b._reactRetry&&b._reactRetry()}};;$RC("');
|
25
|
+
t('$RC("');t('$RC=function(b,c,e){c=document.getElementById(c);c.parentNode.removeChild(c);var a=document.getElementById(b);if(a){b=a.previousSibling;if(e)b.data="$!",a.setAttribute("data-dgst",e);else{e=b.parentNode;a=b.nextSibling;var f=0;do{if(a&&8===a.nodeType){var d=a.data;if("/$"===d)if(0===f)break;else f--;else"$"!==d&&"$?"!==d&&"$!"!==d||f++}d=a.nextSibling;e.removeChild(a);a=d}while(a);for(;c.firstChild;)e.insertBefore(c.firstChild,a);b.data="$"}b._reactRetry&&b._reactRetry()}};;$RM=new Map;\n$RR=function(p,q,v){function r(l){this.s=l}for(var t=$RC,u=$RM,m=new Map,n=document,g,e,f=n.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;e=f[d++];)m.set(e.dataset.precedence,g=e);e=0;f=[];for(var c,h,b,a;c=v[e++];){var k=0;h=c[k++];if(b=u.get(h))"l"!==b.s&&f.push(b);else{a=n.createElement("link");a.href=h;a.rel="stylesheet";for(a.dataset.precedence=d=c[k++];b=c[k++];)a.setAttribute(b,c[k++]);b=a._p=new Promise(function(l,w){a.onload=l;a.onerror=w});b.then(r.bind(b,\n"l"),r.bind(b,"e"));u.set(h,b);f.push(b);c=m.get(d)||g;c===g&&(g=a);m.set(d,a);c?c.parentNode.insertBefore(a,c.nextSibling):(d=n.head,d.insertBefore(a,d.firstChild))}}Promise.all(f).then(t.bind(null,p,q,""),t.bind(null,p,q,"Resource failed to load"))};;$RR("');
|
26
|
+
t('$RM=new Map;\n$RR=function(p,q,v){function r(l){this.s=l}for(var t=$RC,u=$RM,m=new Map,n=document,g,e,f=n.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;e=f[d++];)m.set(e.dataset.precedence,g=e);e=0;f=[];for(var c,h,b,a;c=v[e++];){var k=0;h=c[k++];if(b=u.get(h))"l"!==b.s&&f.push(b);else{a=n.createElement("link");a.href=h;a.rel="stylesheet";for(a.dataset.precedence=d=c[k++];b=c[k++];)a.setAttribute(b,c[k++]);b=a._p=new Promise(function(l,w){a.onload=l;a.onerror=w});b.then(r.bind(b,\n"l"),r.bind(b,"e"));u.set(h,b);f.push(b);c=m.get(d)||g;c===g&&(g=a);m.set(d,a);c?c.parentNode.insertBefore(a,c.nextSibling):(d=n.head,d.insertBefore(a,d.firstChild))}}Promise.all(f).then(t.bind(null,p,q,""),t.bind(null,p,q,"Resource failed to load"))};;$RR("');
|
27
|
+
t('$RR("');t('","');t('",');t('"');t(")\x3c/script>");t('$RX=function(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};;$RX("');t('$RX("');t('"');t(")\x3c/script>");t(",");t('<style data-precedence="');t('"></style>');t("[");t(",[");t(",");t("]");var E=null;
|
28
|
+
function F(a,b){if(a!==b){a.context._currentValue=a.parentValue;a=a.parent;var d=b.parent;if(null===a){if(null!==d)throw Error("The stacks must reach the root at the same time. This is a bug in React.");}else{if(null===d)throw Error("The stacks must reach the root at the same time. This is a bug in React.");F(a,d);b.context._currentValue=b.value}}}function qa(a){a.context._currentValue=a.parentValue;a=a.parent;null!==a&&qa(a)}
|
29
|
+
function ra(a){var b=a.parent;null!==b&&ra(b);a.context._currentValue=a.value}function sa(a,b){a.context._currentValue=a.parentValue;a=a.parent;if(null===a)throw Error("The depth must equal at least at zero before reaching the root. This is a bug in React.");a.depth===b.depth?F(a,b):sa(a,b)}
|
30
|
+
function ta(a,b){var d=b.parent;if(null===d)throw Error("The depth must equal at least at zero before reaching the root. This is a bug in React.");a.depth===d.depth?F(a,d):ta(a,d);b.context._currentValue=b.value}function G(a){var b=E;b!==a&&(null===b?ra(a):null===a?qa(b):b.depth===a.depth?F(b,a):b.depth>a.depth?sa(b,a):ta(b,a),E=a)}function ua(a,b){var d=a._currentValue;a._currentValue=b;var c=E;return E=a={parent:c,depth:null===c?0:c.depth+1,context:a,parentValue:d,value:b}}function va(){}
|
31
|
+
function wa(a,b,d){d=a[d];void 0===d?a.push(b):d!==b&&(b.then(va,va),b=d);switch(b.status){case "fulfilled":return b.value;case "rejected":throw b.reason;default:throw"string"!==typeof b.status&&(a=b,a.status="pending",a.then(function(a){if("pending"===b.status){var c=b;c.status="fulfilled";c.value=a}},function(a){if("pending"===b.status){var c=b;c.status="rejected";c.reason=a}})),b;}}var H=null,I=0,J=null;function xa(){var a=J;J=null;return a}function ya(a){return a._currentValue}
|
32
|
+
var Da={useMemo:function(a){return a()},useCallback:function(a){return a},useDebugValue:function(){},useDeferredValue:K,useTransition:K,readContext:ya,useContext:ya,useReducer:K,useRef:K,useState:K,useInsertionEffect:K,useLayoutEffect:K,useImperativeHandle:K,useEffect:K,useId:Aa,useMutableSource:K,useSyncExternalStore:K,useCacheRefresh:function(){return Ba},useMemoCache:function(a){for(var b=Array(a),d=0;d<a;d++)b[d]=na;return b},use:Ca};
|
33
|
+
function K(){throw Error("This Hook is not supported in Server Components.");}function Ba(){throw Error("Refreshing the cache is not supported in Server Components.");}function Aa(){if(null===H)throw Error("useId can only be used while React is rendering");var a=H.identifierCount++;return":"+H.identifierPrefix+"S"+a.toString(32)+":"}
|
34
|
+
function Ca(a){if(null!==a&&"object"===typeof a){if("function"===typeof a.then){var b=I;I+=1;null===J&&(J=[]);return wa(J,a,b)}if(a.$$typeof===ha)return a._currentValue}throw Error("An unsupported type was passed to use(): "+String(a));}function L(){return(new AbortController).signal}function Ea(){if(M)return M;var a=da.getStore();return a?a:new Map}
|
35
|
+
var Fa={getCacheSignal:function(){var a=Ea(),b=a.get(L);void 0===b&&(b=L(),a.set(L,b));return b},getCacheForType:function(a){var b=Ea(),d=b.get(a);void 0===d&&(d=a(),b.set(a,d));return d}},M=null,N=ca.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,O=N.ContextRegistry,P=N.ReactCurrentDispatcher,Q=N.ReactCurrentCache;function Ga(a){console.error(a)}
|
36
|
+
function Ha(a,b,d,c,f){if(null!==Q.current&&Q.current!==Fa)throw Error("Currently React only supports one RSC renderer at a time.");Q.current=Fa;var g=new Set,h=[],k={status:0,fatalError:null,destination:null,bundlerConfig:b,cache:new Map,nextChunkId:0,pendingChunks:0,abortableTasks:g,pingedTasks:h,completedModuleChunks:[],completedJSONChunks:[],completedErrorChunks:[],writtenSymbols:new Map,writtenModules:new Map,writtenProviders:new Map,identifierPrefix:f||"",identifierCount:1,onError:void 0===
|
37
|
+
d?Ga:d,toJSON:function(a,b){return Ia(k,this,a,b)}};k.pendingChunks++;b=Ja(c);a=Ka(k,a,b,g);h.push(a);return k}var La={};function Ma(a){if("fulfilled"===a.status)return a.value;if("rejected"===a.status)throw a.reason;throw a;}
|
38
|
+
function Na(a){switch(a.status){case "fulfilled":case "rejected":break;default:"string"!==typeof a.status&&(a.status="pending",a.then(function(b){"pending"===a.status&&(a.status="fulfilled",a.value=b)},function(b){"pending"===a.status&&(a.status="rejected",a.reason=b)}))}return{$$typeof:y,_payload:a,_init:Ma}}
|
39
|
+
function R(a,b,d,c,f){if(null!==d&&void 0!==d)throw Error("Refs cannot be used in Server Components, nor passed to Client Components.");if("function"===typeof a){if(a.$$typeof===w)return[x,a,b,c];I=0;J=f;c=a(c);return"object"===typeof c&&null!==c&&"function"===typeof c.then?Na(c):c}if("string"===typeof a)return[x,a,b,c];if("symbol"===typeof a)return a===ea?c.children:[x,a,b,c];if(null!=a&&"object"===typeof a){if(a.$$typeof===w)return[x,a,b,c];switch(a.$$typeof){case y:var g=a._init;a=g(a._payload);
|
40
|
+
return R(a,b,d,c,f);case ia:return b=a.render,I=0,J=f,b(c,void 0);case la:return R(a.type,b,d,c,f);case fa:return ua(a._context,c.value),[x,a,b,{value:c.value,children:c.children,__pop:La}]}}throw Error("Unsupported Server Component type: "+S(a));}function Oa(a,b){var d=a.pingedTasks;d.push(b);1===d.length&&setImmediate(function(){return Pa(a)})}function Ka(a,b,d,c){var f={id:a.nextChunkId++,status:0,model:b,context:d,ping:function(){return Oa(a,f)},thenableState:null};c.add(f);return f}
|
41
|
+
function Qa(a,b,d,c){var f=c.filepath+"#"+c.name+(c.async?"#async":""),g=a.writtenModules,h=g.get(f);if(void 0!==h)return b[0]===x&&"1"===d?"@"+h.toString(16):"$"+h.toString(16);try{var k=a.bundlerConfig[c.filepath][c.name];var l=c.async?{id:k.id,chunks:k.chunks,name:k.name,async:!0}:k;a.pendingChunks++;var z=a.nextChunkId++,X=u(l);var Y="M"+z.toString(16)+":"+X+"\n";a.completedModuleChunks.push(Y);g.set(f,z);return b[0]===x&&"1"===d?"@"+z.toString(16):"$"+z.toString(16)}catch(Z){return a.pendingChunks++,
|
42
|
+
b=a.nextChunkId++,d=T(a,Z),U(a,b,d),"$"+b.toString(16)}}function Ra(a){return Object.prototype.toString.call(a).replace(/^\[object (.*)\]$/,function(a,d){return d})}function S(a){switch(typeof a){case "string":return JSON.stringify(10>=a.length?a:a.substr(0,10)+"...");case "object":if(pa(a))return"[...]";a=Ra(a);return"Object"===a?"{...}":a;case "function":return"function";default:return String(a)}}
|
43
|
+
function V(a){if("string"===typeof a)return a;switch(a){case ja:return"Suspense";case ka:return"SuspenseList"}if("object"===typeof a)switch(a.$$typeof){case ia:return V(a.render);case la:return V(a.type);case y:var b=a._payload;a=a._init;try{return V(a(b))}catch(d){}}return""}
|
44
|
+
function W(a,b){var d=Ra(a);if("Object"!==d&&"Array"!==d)return d;d=-1;var c=0;if(pa(a)){var f="[";for(var g=0;g<a.length;g++){0<g&&(f+=", ");var h=a[g];h="object"===typeof h&&null!==h?W(h):S(h);""+g===b?(d=f.length,c=h.length,f+=h):f=10>h.length&&40>f.length+h.length?f+h:f+"..."}f+="]"}else if(a.$$typeof===x)f="<"+V(a.type)+"/>";else{f="{";g=Object.keys(a);for(h=0;h<g.length;h++){0<h&&(f+=", ");var k=g[h],l=JSON.stringify(k);f+=('"'+k+'"'===l?k:l)+": ";l=a[k];l="object"===typeof l&&null!==l?W(l):
|
45
|
+
S(l);k===b?(d=f.length,c=l.length,f+=l):f=10>l.length&&40>f.length+l.length?f+l:f+"..."}f+="}"}return void 0===b?f:-1<d&&0<c?(a=" ".repeat(d)+"^".repeat(c),"\n "+f+"\n "+a):"\n "+f}
|
46
|
+
function Ia(a,b,d,c){switch(c){case x:return"$"}for(;"object"===typeof c&&null!==c&&(c.$$typeof===x||c.$$typeof===y);)try{switch(c.$$typeof){case x:var f=c;c=R(f.type,f.key,f.ref,f.props,null);break;case y:var g=c._init;c=g(c._payload)}}catch(h){if("object"===typeof h&&null!==h&&"function"===typeof h.then)return a.pendingChunks++,a=Ka(a,c,E,a.abortableTasks),c=a.ping,h.then(c,c),a.thenableState=xa(),"@"+a.id.toString(16);a.pendingChunks++;c=a.nextChunkId++;d=T(a,h);U(a,c,d);return"@"+c.toString(16)}if(null===
|
47
|
+
c)return null;if("object"===typeof c){if(c.$$typeof===w)return Qa(a,b,d,c);if(c.$$typeof===fa)return c=c._context._globalName,f=a.writtenProviders,d=f.get(d),void 0===d&&(a.pendingChunks++,d=a.nextChunkId++,f.set(c,d),c="P"+d.toString(16)+":"+c+"\n",a.completedJSONChunks.push(c)),"$"+d.toString(16);if(c===La){a=E;if(null===a)throw Error("Tried to pop a Context at the root of the app. This is a bug in React.");c=a.parentValue;a.context._currentValue=c===ma?a.context._defaultValue:c;E=a.parent;return}return c}if("string"===
|
48
|
+
typeof c)return a="$"===c[0]||"@"===c[0]?"$"+c:c,a;if("boolean"===typeof c||"number"===typeof c||"undefined"===typeof c)return c;if("function"===typeof c){if(c.$$typeof===w)return Qa(a,b,d,c);if(/^on[A-Z]/.test(d))throw Error("Event handlers cannot be passed to Client Component props."+W(b,d)+"\nIf you need interactivity, consider converting part of this to a Client Component.");throw Error("Functions cannot be passed directly to Client Components because they're not serializable."+W(b,d));}if("symbol"===
|
49
|
+
typeof c){f=a.writtenSymbols;g=f.get(c);if(void 0!==g)return"$"+g.toString(16);g=c.description;if(Symbol.for(g)!==c)throw Error("Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for("+(c.description+") cannot be found among global symbols.")+W(b,d));a.pendingChunks++;d=a.nextChunkId++;b=u(g);b="S"+d.toString(16)+":"+b+"\n";a.completedModuleChunks.push(b);f.set(c,d);return"$"+d.toString(16)}if("bigint"===typeof c)throw Error("BigInt ("+c+") is not yet supported in Client Component props."+
|
50
|
+
W(b,d));throw Error("Type "+typeof c+" is not supported in Client Component props."+W(b,d));}function T(a,b){a=a.onError;b=a(b);if(null!=b&&"string"!==typeof b)throw Error('onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "'+typeof b+'" instead');return b||""}
|
51
|
+
function Sa(a,b){null!==a.destination?(a.status=2,a.destination.destroy(b)):(a.status=1,a.fatalError=b)}function U(a,b,d){d={digest:d};b="E"+b.toString(16)+":"+u(d)+"\n";a.completedErrorChunks.push(b)}
|
52
|
+
function Pa(a){var b=P.current,d=M;P.current=Da;M=a.cache;H=a;try{var c=a.pingedTasks;a.pingedTasks=[];for(var f=0;f<c.length;f++){var g=c[f];var h=a;if(0===g.status){G(g.context);try{var k=g.model;if("object"===typeof k&&null!==k&&k.$$typeof===x){var l=k,z=g.thenableState;g.model=k;k=R(l.type,l.key,l.ref,l.props,z);for(g.thenableState=null;"object"===typeof k&&null!==k&&k.$$typeof===x;)l=k,g.model=k,k=R(l.type,l.key,l.ref,l.props,null)}var X=g.id,Y=u(k,h.toJSON);var Z="J"+X.toString(16)+":"+Y+"\n";
|
53
|
+
h.completedJSONChunks.push(Z);h.abortableTasks.delete(g);g.status=1}catch(v){if("object"===typeof v&&null!==v&&"function"===typeof v.then){var za=g.ping;v.then(za,za);g.thenableState=xa()}else{h.abortableTasks.delete(g);g.status=4;var Va=T(h,v);U(h,g.id,Va)}}}}null!==a.destination&&Ta(a,a.destination)}catch(v){T(a,v),Sa(a,v)}finally{P.current=b,M=d,H=null}}
|
54
|
+
function Ta(a,b){e=new Uint8Array(2048);m=0;n=!0;try{for(var d=a.completedModuleChunks,c=0;c<d.length;c++)if(a.pendingChunks--,!q(b,d[c])){a.destination=null;c++;break}d.splice(0,c);var f=a.completedJSONChunks;for(c=0;c<f.length;c++)if(a.pendingChunks--,!q(b,f[c])){a.destination=null;c++;break}f.splice(0,c);var g=a.completedErrorChunks;for(c=0;c<g.length;c++)if(a.pendingChunks--,!q(b,g[c])){a.destination=null;c++;break}g.splice(0,c)}finally{e&&0<m&&b.write(e.subarray(0,m)),e=null,m=0,n=!0}"function"===
|
55
|
+
typeof b.flush&&b.flush();0===a.pendingChunks&&b.end()}function Ua(a){setImmediate(function(){return da.run(a.cache,Pa,a)})}function Wa(a,b){if(1===a.status)a.status=2,b.destroy(a.fatalError);else if(2!==a.status&&null===a.destination){a.destination=b;try{Ta(a,b)}catch(d){T(a,d),Sa(a,d)}}}
|
56
|
+
function Xa(a,b){try{var d=a.abortableTasks;if(0<d.size){var c=T(a,void 0===b?Error("The render was aborted by the server without a reason."):b);a.pendingChunks++;var f=a.nextChunkId++;U(a,f,c);d.forEach(function(b){b.status=3;var c="$"+f.toString(16);b=b.id;c=u(c);c="J"+b.toString(16)+":"+c+"\n";a.completedErrorChunks.push(c)});d.clear()}null!==a.destination&&Ta(a,a.destination)}catch(g){T(a,g),Sa(a,g)}}
|
57
|
+
function Ja(a){if(a){var b=E;G(null);for(var d=0;d<a.length;d++){var c=a[d],f=c[0];c=c[1];O[f]||(O[f]=ca.createServerContext(f,ma));ua(O[f],c)}a=E;G(b);return a}return null}function Ya(a,b){return function(){return Wa(b,a)}}
|
58
|
+
exports.renderToPipeableStream=function(a,b,d){var c=Ha(a,b,d?d.onError:void 0,d?d.context:void 0,d?d.identifierPrefix:void 0),f=!1;Ua(c);return{pipe:function(a){if(f)throw Error("React currently only supports piping to one writable stream.");f=!0;Wa(c,a);a.on("drain",Ya(a,c));return a},abort:function(a){Xa(c,a)}}};
|
package/client.js
ADDED
package/esm/package.json
ADDED
@@ -0,0 +1,277 @@
|
|
1
|
+
/**
|
2
|
+
* @license React
|
3
|
+
* react-server-dom-webpack-node-loader.js
|
4
|
+
*
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
6
|
+
*
|
7
|
+
* This source code is licensed under the MIT license found in the
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
9
|
+
*/
|
10
|
+
|
11
|
+
import { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED } from 'react';
|
12
|
+
import { parse } from 'acorn';
|
13
|
+
|
14
|
+
var ReactSharedInternals = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
15
|
+
|
16
|
+
// by calls to these methods by a Babel plugin.
|
17
|
+
//
|
18
|
+
// In PROD (or in packages without access to React internals),
|
19
|
+
// they are left as they are instead.
|
20
|
+
|
21
|
+
function warn(format) {
|
22
|
+
{
|
23
|
+
{
|
24
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
25
|
+
args[_key - 1] = arguments[_key];
|
26
|
+
}
|
27
|
+
|
28
|
+
printWarning('warn', format, args);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
function printWarning(level, format, args) {
|
34
|
+
// When changing this logic, you might want to also
|
35
|
+
// update consoleWithStackDev.www.js as well.
|
36
|
+
{
|
37
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
38
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
39
|
+
|
40
|
+
if (stack !== '') {
|
41
|
+
format += '%s';
|
42
|
+
args = args.concat([stack]);
|
43
|
+
} // eslint-disable-next-line react-internal/safe-string-coercion
|
44
|
+
|
45
|
+
|
46
|
+
var argsWithFormat = args.map(function (item) {
|
47
|
+
return String(item);
|
48
|
+
}); // Careful: RN currently depends on this prefix
|
49
|
+
|
50
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
51
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
52
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
53
|
+
|
54
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
var assign = Object.assign;
|
59
|
+
|
60
|
+
var warnedAboutConditionsFlag = false;
|
61
|
+
var stashedGetSource = null;
|
62
|
+
var stashedResolve = null;
|
63
|
+
async function resolve(specifier, context, defaultResolve) {
|
64
|
+
// We stash this in case we end up needing to resolve export * statements later.
|
65
|
+
stashedResolve = defaultResolve;
|
66
|
+
|
67
|
+
if (!context.conditions.includes('react-server')) {
|
68
|
+
context = assign({}, context, {
|
69
|
+
conditions: [].concat(context.conditions, ['react-server'])
|
70
|
+
});
|
71
|
+
|
72
|
+
if (!warnedAboutConditionsFlag) {
|
73
|
+
warnedAboutConditionsFlag = true; // eslint-disable-next-line react-internal/no-production-logging
|
74
|
+
|
75
|
+
warn('You did not run Node.js with the `--conditions react-server` flag. ' + 'Any "react-server" override will only work with ESM imports.');
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
var resolved = await defaultResolve(specifier, context, defaultResolve);
|
80
|
+
|
81
|
+
if (resolved.url.endsWith('.server.js')) {
|
82
|
+
var parentURL = context.parentURL;
|
83
|
+
|
84
|
+
if (parentURL && !parentURL.endsWith('.server.js')) {
|
85
|
+
var reason;
|
86
|
+
|
87
|
+
if (specifier.endsWith('.server.js')) {
|
88
|
+
reason = "\"" + specifier + "\"";
|
89
|
+
} else {
|
90
|
+
reason = "\"" + specifier + "\" (which expands to \"" + resolved.url + "\")";
|
91
|
+
}
|
92
|
+
|
93
|
+
throw new Error("Cannot import " + reason + " from \"" + parentURL + "\". " + 'By react-server convention, .server.js files can only be imported from other .server.js files. ' + 'That way nobody accidentally sends these to the client by indirectly importing it.');
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
return resolved;
|
98
|
+
}
|
99
|
+
async function getSource(url, context, defaultGetSource) {
|
100
|
+
// We stash this in case we end up needing to resolve export * statements later.
|
101
|
+
stashedGetSource = defaultGetSource;
|
102
|
+
return defaultGetSource(url, context, defaultGetSource);
|
103
|
+
}
|
104
|
+
|
105
|
+
function addExportNames(names, node) {
|
106
|
+
switch (node.type) {
|
107
|
+
case 'Identifier':
|
108
|
+
names.push(node.name);
|
109
|
+
return;
|
110
|
+
|
111
|
+
case 'ObjectPattern':
|
112
|
+
for (var i = 0; i < node.properties.length; i++) {
|
113
|
+
addExportNames(names, node.properties[i]);
|
114
|
+
}
|
115
|
+
|
116
|
+
return;
|
117
|
+
|
118
|
+
case 'ArrayPattern':
|
119
|
+
for (var _i = 0; _i < node.elements.length; _i++) {
|
120
|
+
var element = node.elements[_i];
|
121
|
+
if (element) addExportNames(names, element);
|
122
|
+
}
|
123
|
+
|
124
|
+
return;
|
125
|
+
|
126
|
+
case 'Property':
|
127
|
+
addExportNames(names, node.value);
|
128
|
+
return;
|
129
|
+
|
130
|
+
case 'AssignmentPattern':
|
131
|
+
addExportNames(names, node.left);
|
132
|
+
return;
|
133
|
+
|
134
|
+
case 'RestElement':
|
135
|
+
addExportNames(names, node.argument);
|
136
|
+
return;
|
137
|
+
|
138
|
+
case 'ParenthesizedExpression':
|
139
|
+
addExportNames(names, node.expression);
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
function resolveClientImport(specifier, parentURL) {
|
145
|
+
// Resolve an import specifier as if it was loaded by the client. This doesn't use
|
146
|
+
// the overrides that this loader does but instead reverts to the default.
|
147
|
+
// This resolution algorithm will not necessarily have the same configuration
|
148
|
+
// as the actual client loader. It should mostly work and if it doesn't you can
|
149
|
+
// always convert to explicit exported names instead.
|
150
|
+
var conditions = ['node', 'import'];
|
151
|
+
|
152
|
+
if (stashedResolve === null) {
|
153
|
+
throw new Error('Expected resolve to have been called before transformSource');
|
154
|
+
}
|
155
|
+
|
156
|
+
return stashedResolve(specifier, {
|
157
|
+
conditions: conditions,
|
158
|
+
parentURL: parentURL
|
159
|
+
}, stashedResolve);
|
160
|
+
}
|
161
|
+
|
162
|
+
async function loadClientImport(url, defaultTransformSource) {
|
163
|
+
if (stashedGetSource === null) {
|
164
|
+
throw new Error('Expected getSource to have been called before transformSource');
|
165
|
+
} // TODO: Validate that this is another module by calling getFormat.
|
166
|
+
|
167
|
+
|
168
|
+
var _await$stashedGetSour = await stashedGetSource(url, {
|
169
|
+
format: 'module'
|
170
|
+
}, stashedGetSource),
|
171
|
+
source = _await$stashedGetSour.source;
|
172
|
+
|
173
|
+
return defaultTransformSource(source, {
|
174
|
+
format: 'module',
|
175
|
+
url: url
|
176
|
+
}, defaultTransformSource);
|
177
|
+
}
|
178
|
+
|
179
|
+
async function parseExportNamesInto(transformedSource, names, parentURL, defaultTransformSource) {
|
180
|
+
var _acorn$parse = parse(transformedSource, {
|
181
|
+
ecmaVersion: '2019',
|
182
|
+
sourceType: 'module'
|
183
|
+
}),
|
184
|
+
body = _acorn$parse.body;
|
185
|
+
|
186
|
+
for (var i = 0; i < body.length; i++) {
|
187
|
+
var node = body[i];
|
188
|
+
|
189
|
+
switch (node.type) {
|
190
|
+
case 'ExportAllDeclaration':
|
191
|
+
if (node.exported) {
|
192
|
+
addExportNames(names, node.exported);
|
193
|
+
continue;
|
194
|
+
} else {
|
195
|
+
var _await$resolveClientI = await resolveClientImport(node.source.value, parentURL),
|
196
|
+
url = _await$resolveClientI.url;
|
197
|
+
|
198
|
+
var _await$loadClientImpo = await loadClientImport(url, defaultTransformSource),
|
199
|
+
source = _await$loadClientImpo.source;
|
200
|
+
|
201
|
+
if (typeof source !== 'string') {
|
202
|
+
throw new Error('Expected the transformed source to be a string.');
|
203
|
+
}
|
204
|
+
|
205
|
+
parseExportNamesInto(source, names, url, defaultTransformSource);
|
206
|
+
continue;
|
207
|
+
}
|
208
|
+
|
209
|
+
case 'ExportDefaultDeclaration':
|
210
|
+
names.push('default');
|
211
|
+
continue;
|
212
|
+
|
213
|
+
case 'ExportNamedDeclaration':
|
214
|
+
if (node.declaration) {
|
215
|
+
if (node.declaration.type === 'VariableDeclaration') {
|
216
|
+
var declarations = node.declaration.declarations;
|
217
|
+
|
218
|
+
for (var j = 0; j < declarations.length; j++) {
|
219
|
+
addExportNames(names, declarations[j].id);
|
220
|
+
}
|
221
|
+
} else {
|
222
|
+
addExportNames(names, node.declaration.id);
|
223
|
+
}
|
224
|
+
}
|
225
|
+
|
226
|
+
if (node.specifiers) {
|
227
|
+
var specifiers = node.specifiers;
|
228
|
+
|
229
|
+
for (var _j = 0; _j < specifiers.length; _j++) {
|
230
|
+
addExportNames(names, specifiers[_j].exported);
|
231
|
+
}
|
232
|
+
}
|
233
|
+
|
234
|
+
continue;
|
235
|
+
}
|
236
|
+
}
|
237
|
+
}
|
238
|
+
|
239
|
+
async function transformSource(source, context, defaultTransformSource) {
|
240
|
+
var transformed = await defaultTransformSource(source, context, defaultTransformSource);
|
241
|
+
|
242
|
+
if (context.format === 'module' && context.url.endsWith('.client.js')) {
|
243
|
+
var transformedSource = transformed.source;
|
244
|
+
|
245
|
+
if (typeof transformedSource !== 'string') {
|
246
|
+
throw new Error('Expected source to have been transformed to a string.');
|
247
|
+
}
|
248
|
+
|
249
|
+
var names = [];
|
250
|
+
await parseExportNamesInto(transformedSource, names, context.url, defaultTransformSource);
|
251
|
+
var newSrc = "const MODULE_REFERENCE = Symbol.for('react.module.reference');\n";
|
252
|
+
|
253
|
+
for (var i = 0; i < names.length; i++) {
|
254
|
+
var name = names[i];
|
255
|
+
|
256
|
+
if (name === 'default') {
|
257
|
+
newSrc += 'export default ';
|
258
|
+
} else {
|
259
|
+
newSrc += 'export const ' + name + ' = ';
|
260
|
+
}
|
261
|
+
|
262
|
+
newSrc += '{ $$typeof: MODULE_REFERENCE, filepath: ';
|
263
|
+
newSrc += JSON.stringify(context.url);
|
264
|
+
newSrc += ', name: ';
|
265
|
+
newSrc += JSON.stringify(name);
|
266
|
+
newSrc += '};\n';
|
267
|
+
}
|
268
|
+
|
269
|
+
return {
|
270
|
+
source: newSrc
|
271
|
+
};
|
272
|
+
}
|
273
|
+
|
274
|
+
return transformed;
|
275
|
+
}
|
276
|
+
|
277
|
+
export { getSource, resolve, transformSource };
|
package/index.js
CHANGED
@@ -1 +1,12 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
+
*
|
4
|
+
* This source code is licensed under the MIT license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
7
|
+
* @flow
|
8
|
+
*/
|
9
|
+
|
10
|
+
'use strict';
|
11
|
+
|
12
|
+
throw new Error('Use react-server-dom-webpack/client instead.');
|
package/node-register.js
ADDED
package/package.json
CHANGED
@@ -1,23 +1,66 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-server-dom-webpack",
|
3
|
-
"version": "0.0.1",
|
4
3
|
"description": "React Server Components bindings for DOM using Webpack. This is intended to be integrated into meta-frameworks. It is not intended to be imported directly.",
|
4
|
+
"version": "18.3.0-next-d925a8d0b-20221024",
|
5
5
|
"keywords": [
|
6
|
-
"react"
|
7
|
-
"blocks"
|
6
|
+
"react"
|
8
7
|
],
|
9
|
-
"
|
10
|
-
|
11
|
-
"url" : "https://github.com/facebook/react.git",
|
12
|
-
"directory": "packages/react-server-dom-webpack"
|
13
|
-
},
|
8
|
+
"homepage": "https://reactjs.org/",
|
9
|
+
"bugs": "https://github.com/facebook/react/issues",
|
14
10
|
"license": "MIT",
|
15
11
|
"files": [
|
16
|
-
"
|
12
|
+
"LICENSE",
|
13
|
+
"README.md",
|
14
|
+
"index.js",
|
15
|
+
"plugin.js",
|
16
|
+
"client.js",
|
17
|
+
"server.js",
|
18
|
+
"server.browser.js",
|
19
|
+
"server.node.js",
|
20
|
+
"node-register.js",
|
21
|
+
"cjs/",
|
22
|
+
"umd/",
|
23
|
+
"esm/"
|
17
24
|
],
|
25
|
+
"exports": {
|
26
|
+
".": "./index.js",
|
27
|
+
"./plugin": "./plugin.js",
|
28
|
+
"./client": "./client.js",
|
29
|
+
"./server": {
|
30
|
+
"react-server": {
|
31
|
+
"node": "./server.node.js",
|
32
|
+
"browser": "./server.browser.js"
|
33
|
+
},
|
34
|
+
"default": "./server.js"
|
35
|
+
},
|
36
|
+
"./server.node": "./server.node.js",
|
37
|
+
"./server.browser": "./server.browser.js",
|
38
|
+
"./node-loader": "./esm/react-server-dom-webpack-node-loader.js",
|
39
|
+
"./node-register": "./node-register.js",
|
40
|
+
"./package.json": "./package.json"
|
41
|
+
},
|
18
42
|
"main": "index.js",
|
43
|
+
"repository": {
|
44
|
+
"type": "git",
|
45
|
+
"url": "https://github.com/facebook/react.git",
|
46
|
+
"directory": "packages/react-server-dom-webpack"
|
47
|
+
},
|
48
|
+
"engines": {
|
49
|
+
"node": ">=0.10.0"
|
50
|
+
},
|
19
51
|
"peerDependencies": {
|
20
|
-
"react": "
|
21
|
-
"react-dom": "
|
52
|
+
"react": "18.3.0-next-d925a8d0b-20221024",
|
53
|
+
"react-dom": "18.3.0-next-d925a8d0b-20221024",
|
54
|
+
"webpack": "^5.59.0"
|
55
|
+
},
|
56
|
+
"dependencies": {
|
57
|
+
"acorn": "^6.2.1",
|
58
|
+
"neo-async": "^2.6.1",
|
59
|
+
"loose-envify": "^1.1.0"
|
60
|
+
},
|
61
|
+
"browserify": {
|
62
|
+
"transform": [
|
63
|
+
"loose-envify"
|
64
|
+
]
|
22
65
|
}
|
23
|
-
}
|
66
|
+
}
|
package/plugin.js
ADDED
package/server.js
ADDED
package/server.node.js
ADDED