react-server-dom-webpack 18.3.0-next-bfb9cbd8c-20230223 → 18.3.0-next-67a61d5bd-20230228
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/cjs/react-server-dom-webpack-node-register.js +6 -6
- package/cjs/react-server-dom-webpack-plugin.js +8 -8
- package/cjs/react-server-dom-webpack-server.node.development.js +2 -3
- package/cjs/react-server-dom-webpack-server.node.production.min.js +2 -2
- package/cjs/react-server-dom-webpack-server.node.unbundled.development.js +2 -3
- package/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +2 -2
- package/esm/react-server-dom-webpack-node-loader.production.min.js +27 -13
- package/package.json +3 -3
@@ -10,12 +10,12 @@
|
|
10
10
|
|
11
11
|
'use strict';
|
12
12
|
|
13
|
-
'use strict';const
|
13
|
+
'use strict';const n=require("acorn"),p=require("url"),r=require("module");
|
14
14
|
module.exports=function(){const h=Symbol.for("react.client.reference"),k=Symbol.for("react.server.reference"),t=Promise.prototype,u=Function.prototype.bind;Function.prototype.bind=function(a){const c=u.apply(this,arguments);if(this.$$typeof===k){const b=Array.prototype.slice.call(arguments,1);c.$$typeof=k;c.$$filepath=this.$$filepath;c.$$name=this.$$name;c.$$bound=this.$$bound.concat(b)}return c};const v={get:function(a,c){switch(c){case "$$typeof":return a.$$typeof;case "filepath":return a.filepath;
|
15
15
|
case "name":return a.name;case "displayName":return;case "async":return a.async;case "defaultProps":return;case "toJSON":return;case Symbol.toPrimitive:return Object.prototype[Symbol.toPrimitive];case "Provider":throw Error("Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider.");}switch(a.name){case "":a=String(c);break;case "*":a=String(c);break;default:a=String(a.name)+"."+String(c)}throw Error("Cannot access "+
|
16
|
-
a+" on the server. You cannot dot into a client module from a server component. You can only pass the imported name through.");},set:function(){throw Error("Cannot assign to a client module from a server module.");}},
|
16
|
+
a+" on the server. You cannot dot into a client module from a server component. You can only pass the imported name through.");},set:function(){throw Error("Cannot assign to a client module from a server module.");}},q={get:function(a,c){switch(c){case "$$typeof":return a.$$typeof;case "filepath":return a.filepath;case "name":return a.name;case "async":return a.async;case "defaultProps":return;case "toJSON":return;case Symbol.toPrimitive:return Object.prototype[Symbol.toPrimitive];case "__esModule":const d=
|
17
17
|
a.filepath;a.default=Object.defineProperties(function(){throw Error("Attempted to call the default export of "+d+" from the server but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.");},{name:{value:""},$$typeof:{value:h},filepath:{value:a.filepath},async:{value:a.async}});return!0;case "then":if(a.then)return a.then;if(a.async)return;var b=Object.defineProperties({},{name:{value:"*"},
|
18
|
-
$$typeof:{value:h},filepath:{value:a.filepath},async:{value:!0}});const e=new Proxy(b,
|
19
|
-
},{name:{value:c},$$typeof:{value:h},filepath:{value:a.filepath},async:{value:a.async}}),b=a[c]=new Proxy(b,v));return b},getPrototypeOf(){return t},set:function(){throw Error("Cannot assign to a client module from a server module.");}},l=r.prototype._compile;r.prototype._compile=function(a,c){if(-1===a.indexOf("use client")&&-1===a.indexOf("use server"))return l.apply(this,arguments);var b=
|
20
|
-
g.type||!g.directive)break;"use client"===g.directive&&(d=!0);"use server"===g.directive&&(e=!0)}if(!d&&!e)return l.apply(this,arguments);if(d&&e)throw Error('Cannot have both "use client" and "use server" directives in the same file.');d&&(b=
|
21
|
-
{$$typeof:{value:k},$$filepath:{value:e},$$name:{value:"*"},$$bound:{value:[]}});else for(d=Object.keys(b),f=0;f<d.length;f++){g=d[f];const
|
18
|
+
$$typeof:{value:h},filepath:{value:a.filepath},async:{value:!0}});const e=new Proxy(b,q);a.status="fulfilled";a.value=e;return a.then=Object.defineProperties(function(f){return Promise.resolve(f(e))},{name:{value:"then"},$$typeof:{value:h},filepath:{value:a.filepath},async:{value:!1}})}b=a[c];b||(b=Object.defineProperties(function(){throw Error("Attempted to call "+String(c)+"() from the server but "+String(c)+" is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.");
|
19
|
+
},{name:{value:c},$$typeof:{value:h},filepath:{value:a.filepath},async:{value:a.async}}),b=a[c]=new Proxy(b,v));return b},getPrototypeOf(){return t},set:function(){throw Error("Cannot assign to a client module from a server module.");}},l=r.prototype._compile;r.prototype._compile=function(a,c){if(-1===a.indexOf("use client")&&-1===a.indexOf("use server"))return l.apply(this,arguments);try{var b=n.parse(a,{ecmaVersion:"2024",sourceType:"source"}).body}catch(m){return console.error("Error parsing %s %s",
|
20
|
+
p,m.message),l.apply(this,arguments)}var d=!1,e=!1;for(var f=0;f<b.length;f++){var g=b[f];if("ExpressionStatement"!==g.type||!g.directive)break;"use client"===g.directive&&(d=!0);"use server"===g.directive&&(e=!0)}if(!d&&!e)return l.apply(this,arguments);if(d&&e)throw Error('Cannot have both "use client" and "use server" directives in the same file.');d&&(b=p.pathToFileURL(c).href,b=Object.defineProperties({},{name:{value:"*"},$$typeof:{value:h},filepath:{value:b},async:{value:!1}}),this.exports=
|
21
|
+
new Proxy(b,q));if(e)if(l.apply(this,arguments),e=p.pathToFileURL(c).href,b=this.exports,"function"===typeof b)Object.defineProperties(b,{$$typeof:{value:k},$$filepath:{value:e},$$name:{value:"*"},$$bound:{value:[]}});else for(d=Object.keys(b),f=0;f<d.length;f++){g=d[f];const m=b[d[f]];"function"===typeof m&&Object.defineProperties(m,{$$typeof:{value:k},$$filepath:{value:e},$$name:{value:g},$$bound:{value:[]}})}}};
|
@@ -10,11 +10,11 @@
|
|
10
10
|
|
11
11
|
'use strict';
|
12
12
|
|
13
|
-
'use strict';var
|
14
|
-
class
|
15
|
-
recursive:!0,include:/\.(js|ts|jsx|tsx)$/}];"string"===typeof b.chunkName?(this.chunkName=b.chunkName,/\[(index|request)\]/.test(this.chunkName)||(this.chunkName+="[index]")):this.chunkName="client[index]";this.clientManifestFilename=b.clientManifestFilename||"react-client-manifest.json";this.ssrManifestFilename=b.ssrManifestFilename||"react-ssr-manifest.json"}apply(b){const
|
16
|
-
{});
|
17
|
-
null,
|
18
|
-
|
19
|
-
Array.from(k).forEach(function(f){const
|
20
|
-
{resource:g,resourceQuery:"",recursive:void 0===a.recursive?!0:a.recursive,regExp:a.include,include:void 0,exclude:a.exclude},(h,
|
13
|
+
'use strict';var p=require("path"),r=require("url"),y=require("neo-async"),z=require("webpack/lib/dependencies/ModuleDependency"),A=require("webpack/lib/dependencies/NullDependency"),B=require("webpack/lib/Template"),C=require("webpack");const D=Array.isArray;class E extends z{constructor(b){super(b)}get type(){return"client-reference"}}const F=require.resolve("../client.browser.js");
|
14
|
+
class G{constructor(b){this.ssrManifestFilename=this.clientManifestFilename=this.chunkName=this.clientReferences=void 0;if(!b||"boolean"!==typeof b.isServer)throw Error("React Server Plugin: You must specify the isServer option as a boolean.");if(b.isServer)throw Error("TODO: Implement the server compiler.");b.clientReferences?"string"!==typeof b.clientReferences&&D(b.clientReferences)?this.clientReferences=b.clientReferences:this.clientReferences=[b.clientReferences]:this.clientReferences=[{directory:".",
|
15
|
+
recursive:!0,include:/\.(js|ts|jsx|tsx)$/}];"string"===typeof b.chunkName?(this.chunkName=b.chunkName,/\[(index|request)\]/.test(this.chunkName)||(this.chunkName+="[index]")):this.chunkName="client[index]";this.clientManifestFilename=b.clientManifestFilename||"react-client-manifest.json";this.ssrManifestFilename=b.ssrManifestFilename||"react-ssr-manifest.json"}apply(b){const l=this;let n,t=!1;b.hooks.beforeCompile.tapAsync("React Server Plugin",(c,a)=>{c=c.contextModuleFactory;const e=b.resolverFactory.get("context",
|
16
|
+
{});l.resolveAllClientFiles(b.context,e,b.inputFileSystem,c,function(d,g){d?a(d):(n=g,a())})});b.hooks.thisCompilation.tap("React Server Plugin",(c,a)=>{a=a.normalModuleFactory;c.dependencyFactories.set(E,a);c.dependencyTemplates.set(E,new A.Template);c=e=>{e.hooks.program.tap("React Server Plugin",()=>{const d=e.state.module;if(d.resource===F&&(t=!0,n))for(let h=0;h<n.length;h++){const m=n[h];var g=l.chunkName.replace(/\[index\]/g,""+h).replace(/\[request\]/g,B.toPath(m.userRequest));g=new C.AsyncDependenciesBlock({name:g},
|
17
|
+
null,m.request);g.addDependency(m);d.addBlock(g)}})};a.hooks.parser.for("javascript/auto").tap("HarmonyModulesPlugin",c);a.hooks.parser.for("javascript/esm").tap("HarmonyModulesPlugin",c);a.hooks.parser.for("javascript/dynamic").tap("HarmonyModulesPlugin",c)});b.hooks.make.tap("React Server Plugin",c=>{c.hooks.processAssets.tap({name:"React Server Plugin",stage:C.Compilation.PROCESS_ASSETS_STAGE_REPORT},function(){if(!1===t)c.warnings.push(new C.WebpackError("Client runtime at react-server-dom-webpack/client was not found. React Server Components module map file "+
|
18
|
+
l.clientManifestFilename+" was not created."));else{var a={},e={};c.chunkGroups.forEach(function(g){function h(k,f){if(/\.(js|ts)x?$/.test(f.resource)){var q=c.moduleGraph.getExportsInfo(f).getProvidedExports(),u={},x={},w=r.pathToFileURL(f.resource).href;void 0!==w&&(["","*"].concat(Array.isArray(q)?q:[]).forEach(function(v){u[v]={id:k,chunks:m,name:v};x[v]={specifier:w,name:v}}),a[w]=u,e[k]=x)}}const m=g.chunks.map(function(k){return k.id});g.chunks.forEach(function(k){k=c.chunkGraph.getChunkModulesIterable(k);
|
19
|
+
Array.from(k).forEach(function(f){const q=c.chunkGraph.getModuleId(f);h(q,f);f.modules&&f.modules.forEach(u=>{h(q,u)})})})});var d=JSON.stringify(a,null,2);c.emitAsset(l.clientManifestFilename,new C.sources.RawSource(d,!1));d=JSON.stringify(e,null,2);c.emitAsset(l.ssrManifestFilename,new C.sources.RawSource(d,!1))}})})}resolveAllClientFiles(b,l,n,t,c){y.map(this.clientReferences,(a,e)=>{"string"===typeof a?e(null,[new E(a)]):l.resolve({},b,a.directory,{},(d,g)=>{if(d)return e(d);t.resolveDependencies(n,
|
20
|
+
{resource:g,resourceQuery:"",recursive:void 0===a.recursive?!0:a.recursive,regExp:a.include,include:void 0,exclude:a.exclude},(h,m)=>{if(h)return e(h);h=m.map(k=>{var f=p.join(g,k.userRequest);f=new E(f);f.userRequest=k.userRequest;return f});e(null,h)})})},(a,e)=>{if(a)return c(a);a=[];for(let d=0;d<e.length;d++)a.push.apply(a,e[d]);c(null,a)})}}module.exports=G;
|
@@ -110,10 +110,9 @@ function writeStringChunk(destination, stringChunk) {
|
|
110
110
|
writtenBytes += written;
|
111
111
|
|
112
112
|
if (read < stringChunk.length) {
|
113
|
-
writeToDestination(destination, currentView);
|
113
|
+
writeToDestination(destination, currentView.subarray(0, writtenBytes));
|
114
114
|
currentView = new Uint8Array(VIEW_SIZE);
|
115
|
-
writtenBytes = textEncoder.encodeInto(stringChunk.slice(read),
|
116
|
-
currentView).written;
|
115
|
+
writtenBytes = textEncoder.encodeInto(stringChunk.slice(read), currentView).written;
|
117
116
|
}
|
118
117
|
|
119
118
|
if (writtenBytes === VIEW_SIZE) {
|
@@ -8,8 +8,8 @@
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
9
9
|
*/
|
10
10
|
'use strict';var aa=require("util"),ba=require("async_hooks"),ca=require("react"),da=new ba.AsyncLocalStorage,f=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,f.subarray(0,m)),f=new Uint8Array(2048),m=0),p(a,r.encode(b));else{var c=f;0<m&&(c=f.subarray(m));c=r.encodeInto(b,c);var d=c.read;m+=c.written;d<b.length&&(p(a,f),f=new Uint8Array(2048),m=r.encodeInto(b.slice(d),f).written);2048===m&&(p(a,f),f=new Uint8Array(2048),m=0)}}else 0!==b.byteLength&&(2048<b.byteLength?(0<m&&(p(a,f.subarray(0,m)),f=new Uint8Array(2048),m=0),p(a,b)):(c=f.length-m,c<b.byteLength&&
|
12
|
-
f):(f.set(b.subarray(0,c),m),m+=c,p(a,f),b=b.subarray(c)),f=new Uint8Array(2048),m=0),f.set(b,m),m+=b.byteLength,2048===m&&(p(a,f),f=new Uint8Array(2048),m=0)));return n}var r=new aa.TextEncoder;function t(a){return r.encode(a)}var u=JSON.stringify;function fa(a,b,c){a=u(c,a.toJSON);return b.toString(16)+":"+a+"\n"}function v(a,b,c){a=u(c);return b.toString(16)+":"+a+"\n"}
|
11
|
+
function q(a,b){if("string"===typeof b){if(0!==b.length)if(2048<3*b.length)0<m&&(p(a,f.subarray(0,m)),f=new Uint8Array(2048),m=0),p(a,r.encode(b));else{var c=f;0<m&&(c=f.subarray(m));c=r.encodeInto(b,c);var d=c.read;m+=c.written;d<b.length&&(p(a,f.subarray(0,m)),f=new Uint8Array(2048),m=r.encodeInto(b.slice(d),f).written);2048===m&&(p(a,f),f=new Uint8Array(2048),m=0)}}else 0!==b.byteLength&&(2048<b.byteLength?(0<m&&(p(a,f.subarray(0,m)),f=new Uint8Array(2048),m=0),p(a,b)):(c=f.length-m,c<b.byteLength&&
|
12
|
+
(0===c?p(a,f):(f.set(b.subarray(0,c),m),m+=c,p(a,f),b=b.subarray(c)),f=new Uint8Array(2048),m=0),f.set(b,m),m+=b.byteLength,2048===m&&(p(a,f),f=new Uint8Array(2048),m=0)));return n}var r=new aa.TextEncoder;function t(a){return r.encode(a)}var u=JSON.stringify;function fa(a,b,c){a=u(c,a.toJSON);return b.toString(16)+":"+a+"\n"}function v(a,b,c){a=u(c);return b.toString(16)+":"+a+"\n"}
|
13
13
|
var x=Symbol.for("react.client.reference"),ha=Symbol.for("react.server.reference"),z=Symbol.for("react.element"),ia=Symbol.for("react.fragment"),ja=Symbol.for("react.provider"),ka=Symbol.for("react.server_context"),la=Symbol.for("react.forward_ref"),ma=Symbol.for("react.suspense"),na=Symbol.for("react.suspense_list"),oa=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),pa=Symbol.for("react.default_value"),qa=Symbol.for("react.memo_cache_sentinel");
|
14
14
|
function B(a,b,c,d,e,g,h){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;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 B(a,0,!1,a,null,!1,!1)});
|
15
15
|
[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){new B(a[0],1,!1,a[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){new B(a,2,!1,a.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){new B(a,2,!1,a,null,!1,!1)});
|
@@ -110,10 +110,9 @@ function writeStringChunk(destination, stringChunk) {
|
|
110
110
|
writtenBytes += written;
|
111
111
|
|
112
112
|
if (read < stringChunk.length) {
|
113
|
-
writeToDestination(destination, currentView);
|
113
|
+
writeToDestination(destination, currentView.subarray(0, writtenBytes));
|
114
114
|
currentView = new Uint8Array(VIEW_SIZE);
|
115
|
-
writtenBytes = textEncoder.encodeInto(stringChunk.slice(read),
|
116
|
-
currentView).written;
|
115
|
+
writtenBytes = textEncoder.encodeInto(stringChunk.slice(read), currentView).written;
|
117
116
|
}
|
118
117
|
|
119
118
|
if (writtenBytes === VIEW_SIZE) {
|
@@ -8,8 +8,8 @@
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
9
9
|
*/
|
10
10
|
'use strict';var aa=require("util"),ba=require("async_hooks"),ca=require("react"),da=new ba.AsyncLocalStorage,f=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,f.subarray(0,m)),f=new Uint8Array(2048),m=0),p(a,r.encode(b));else{var c=f;0<m&&(c=f.subarray(m));c=r.encodeInto(b,c);var d=c.read;m+=c.written;d<b.length&&(p(a,f),f=new Uint8Array(2048),m=r.encodeInto(b.slice(d),f).written);2048===m&&(p(a,f),f=new Uint8Array(2048),m=0)}}else 0!==b.byteLength&&(2048<b.byteLength?(0<m&&(p(a,f.subarray(0,m)),f=new Uint8Array(2048),m=0),p(a,b)):(c=f.length-m,c<b.byteLength&&
|
12
|
-
f):(f.set(b.subarray(0,c),m),m+=c,p(a,f),b=b.subarray(c)),f=new Uint8Array(2048),m=0),f.set(b,m),m+=b.byteLength,2048===m&&(p(a,f),f=new Uint8Array(2048),m=0)));return n}var r=new aa.TextEncoder;function t(a){return r.encode(a)}var u=JSON.stringify;function fa(a,b,c){a=u(c,a.toJSON);return b.toString(16)+":"+a+"\n"}function v(a,b,c){a=u(c);return b.toString(16)+":"+a+"\n"}
|
11
|
+
function q(a,b){if("string"===typeof b){if(0!==b.length)if(2048<3*b.length)0<m&&(p(a,f.subarray(0,m)),f=new Uint8Array(2048),m=0),p(a,r.encode(b));else{var c=f;0<m&&(c=f.subarray(m));c=r.encodeInto(b,c);var d=c.read;m+=c.written;d<b.length&&(p(a,f.subarray(0,m)),f=new Uint8Array(2048),m=r.encodeInto(b.slice(d),f).written);2048===m&&(p(a,f),f=new Uint8Array(2048),m=0)}}else 0!==b.byteLength&&(2048<b.byteLength?(0<m&&(p(a,f.subarray(0,m)),f=new Uint8Array(2048),m=0),p(a,b)):(c=f.length-m,c<b.byteLength&&
|
12
|
+
(0===c?p(a,f):(f.set(b.subarray(0,c),m),m+=c,p(a,f),b=b.subarray(c)),f=new Uint8Array(2048),m=0),f.set(b,m),m+=b.byteLength,2048===m&&(p(a,f),f=new Uint8Array(2048),m=0)));return n}var r=new aa.TextEncoder;function t(a){return r.encode(a)}var u=JSON.stringify;function fa(a,b,c){a=u(c,a.toJSON);return b.toString(16)+":"+a+"\n"}function v(a,b,c){a=u(c);return b.toString(16)+":"+a+"\n"}
|
13
13
|
var x=Symbol.for("react.client.reference"),ha=Symbol.for("react.server.reference"),z=Symbol.for("react.element"),ia=Symbol.for("react.fragment"),ja=Symbol.for("react.provider"),ka=Symbol.for("react.server_context"),la=Symbol.for("react.forward_ref"),ma=Symbol.for("react.suspense"),na=Symbol.for("react.suspense_list"),oa=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),pa=Symbol.for("react.default_value"),qa=Symbol.for("react.memo_cache_sentinel");
|
14
14
|
function B(a,b,c,d,e,g,h){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;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 B(a,0,!1,a,null,!1,!1)});
|
15
15
|
[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){new B(a[0],1,!1,a[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){new B(a,2,!1,a.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){new B(a,2,!1,a,null,!1,!1)});
|
@@ -228,11 +228,18 @@ async function parseExportNamesInto(body, names, parentURL, loader) {
|
|
228
228
|
throw new Error('Expected the transformed source to be a string.');
|
229
229
|
}
|
230
230
|
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
231
|
+
let childBody;
|
232
|
+
|
233
|
+
try {
|
234
|
+
childBody = acorn.parse(source, {
|
235
|
+
ecmaVersion: '2024',
|
236
|
+
sourceType: 'module'
|
237
|
+
}).body;
|
238
|
+
} catch (x) {
|
239
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
240
|
+
console.error('Error parsing %s %s', url, x.message);
|
241
|
+
continue;
|
242
|
+
}
|
236
243
|
|
237
244
|
await parseExportNamesInto(childBody, names, url, loader);
|
238
245
|
continue;
|
@@ -324,11 +331,18 @@ async function transformModuleIfNeeded(source, url, loader) {
|
|
324
331
|
return source;
|
325
332
|
}
|
326
333
|
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
334
|
+
let body;
|
335
|
+
|
336
|
+
try {
|
337
|
+
body = acorn.parse(source, {
|
338
|
+
ecmaVersion: '2024',
|
339
|
+
sourceType: 'module'
|
340
|
+
}).body;
|
341
|
+
} catch (x) {
|
342
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
343
|
+
console.error('Error parsing %s %s', url, x.message);
|
344
|
+
return source;
|
345
|
+
}
|
332
346
|
|
333
347
|
let useClient = false;
|
334
348
|
let useServer = false;
|
@@ -385,9 +399,9 @@ async function transformSource(source, context, defaultTransformSource) {
|
|
385
399
|
return transformed;
|
386
400
|
}
|
387
401
|
async function load(url, context, defaultLoad) {
|
388
|
-
|
389
|
-
const result = await defaultLoad(url, context, defaultLoad);
|
402
|
+
const result = await defaultLoad(url, context, defaultLoad);
|
390
403
|
|
404
|
+
if (result.format === 'module') {
|
391
405
|
if (typeof result.source !== 'string') {
|
392
406
|
throw new Error('Expected source to have been loaded into a string.');
|
393
407
|
}
|
@@ -399,7 +413,7 @@ async function load(url, context, defaultLoad) {
|
|
399
413
|
};
|
400
414
|
}
|
401
415
|
|
402
|
-
return
|
416
|
+
return result;
|
403
417
|
}
|
404
418
|
|
405
419
|
export { getSource, load, resolve, transformSource };
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-server-dom-webpack",
|
3
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-
|
4
|
+
"version": "18.3.0-next-67a61d5bd-20230228",
|
5
5
|
"keywords": [
|
6
6
|
"react"
|
7
7
|
],
|
@@ -78,8 +78,8 @@
|
|
78
78
|
"node": ">=0.10.0"
|
79
79
|
},
|
80
80
|
"peerDependencies": {
|
81
|
-
"react": "18.3.0-next-
|
82
|
-
"react-dom": "18.3.0-next-
|
81
|
+
"react": "18.3.0-next-67a61d5bd-20230228",
|
82
|
+
"react-dom": "18.3.0-next-67a61d5bd-20230228",
|
83
83
|
"webpack": "^5.59.0"
|
84
84
|
},
|
85
85
|
"dependencies": {
|