Unverified Commit 215cc585 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update to copy necessary RSC files from dep (#30505)

Co-authored-by: 's avatarkodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
parent 88131eb7
......@@ -34,8 +34,8 @@ export default function middlewareRSCLoader(this: any) {
${
isServerComponent
? `
import { renderToReadableStream } from 'react-server-dom-webpack/writer.browser.server'
import { createFromReadableStream } from 'react-server-dom-webpack'`
import { renderToReadableStream } from 'next/dist/compiled/react-server-dom-webpack/writer.browser.server'
import { createFromReadableStream } from 'next/dist/compiled/react-server-dom-webpack'`
: ''
}
......
......@@ -657,7 +657,9 @@ if (process.env.__NEXT_RSC) {
serialized?: string
_fresh?: boolean
}) => {
const { createFromFetch } = require('react-server-dom-webpack')
const {
createFromFetch,
} = require('next/dist/compiled/react-server-dom-webpack')
let response = rscCache.get(cacheKey)
// If there is no cache, or there is serialized data already
......
/** @license React vundefined
* react-server-dom-webpack-writer.browser.production.min.server.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';var h=require("react");function m(a){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)d+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function p(a,d){a.enqueue(d);return 0<a.desiredSize}var r=new TextEncoder;function t(a,d){"function"===typeof a.error?a.error(d):a.close()}
var u=JSON.stringify,v=Symbol.for("react.module.reference"),w=60103,x=60107,y=60112,z=60115,A=60116;if("function"===typeof Symbol&&Symbol.for){var B=Symbol.for;w=B("react.element");x=B("react.fragment");y=B("react.forward_ref");z=B("react.memo");A=B("react.lazy")}var C=Array.isArray,D=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;function H(a){console.error(a)}
function I(a,d,c){var b=[],e={status:0,fatalError:null,destination:null,bundlerConfig:d,cache:new Map,nextChunkId:0,pendingChunks:0,pingedSegments:b,completedModuleChunks:[],completedJSONChunks:[],completedErrorChunks:[],writtenSymbols:new Map,writtenModules:new Map,onError:void 0===c?H:c,toJSON:function(a,b){return J(e,this,a,b)}};e.pendingChunks++;a=K(e,a);b.push(a);return e}
function L(a,d,c,b){if(null!==c&&void 0!==c)throw Error(m(379));if("function"===typeof a)return a(b);if("string"===typeof a)return[w,a,d,b];if("symbol"===typeof a)return a===x?b.children:[w,a,d,b];if(null!=a&&"object"===typeof a){if(a.$$typeof===v)return[w,a,d,b];switch(a.$$typeof){case y:return a=a.render,a(b,void 0);case z:return L(a.type,d,c,b)}}throw Error(m(351,M(a)));}
function K(a,d){var c={id:a.nextChunkId++,model:d,ping:function(){var b=a.pingedSegments;b.push(c);1===b.length&&N(a)}};return c}function O(a){return Object.prototype.toString.call(a).replace(/^\[object (.*)\]$/,function(a,c){return c})}function P(a){var d=JSON.stringify(a);return'"'+a+'"'===d?a:d}
function M(a){switch(typeof a){case "string":return JSON.stringify(10>=a.length?a:a.substr(0,10)+"...");case "object":if(C(a))return"[...]";a=O(a);return"Object"===a?"{...}":a;case "function":return"function";default:return String(a)}}
function Q(a,d){if(C(a)){for(var c="[",b=0;b<a.length;b++){0<b&&(c+=", ");if(6<b){c+="...";break}var e=a[b];c=""+b===d&&"object"===typeof e&&null!==e?c+Q(e):c+M(e)}return c+"]"}c="{";b=Object.keys(a);for(e=0;e<b.length;e++){0<e&&(c+=", ");if(6<e){c+="...";break}var k=b[e];c+=P(k)+": ";var f=a[k];c=k===d&&"object"===typeof f&&null!==f?c+Q(f):c+M(f)}return c+"}"}
function J(a,d,c,b){switch(b){case w:return"$";case A:throw Error(m(352));}for(;"object"===typeof b&&null!==b&&b.$$typeof===w;){var e=b;try{b=L(e.type,e.key,e.ref,e.props)}catch(n){if("object"===typeof n&&null!==n&&"function"===typeof n.then)return a.pendingChunks++,a=K(a,b),d=a.ping,n.then(d,d),"@"+a.id.toString(16);S(a,n);a.pendingChunks++;d=a.nextChunkId++;T(a,d,n);return"@"+d.toString(16)}}if(null===b)return null;if("object"===typeof b){if(b.$$typeof===v){e=b.filepath+"#"+b.name;var k=a.writtenModules,
f=k.get(e);if(void 0!==f)return d[0]===w&&"1"===c?"@"+f.toString(16):"$"+f.toString(16);try{var l=a.bundlerConfig[b.filepath][b.name];a.pendingChunks++;var g=a.nextChunkId++,E=u(l),F="M"+g.toString(16)+":"+E+"\n";var G=r.encode(F);a.completedModuleChunks.push(G);k.set(e,g);return d[0]===w&&"1"===c?"@"+g.toString(16):"$"+g.toString(16)}catch(n){return a.pendingChunks++,d=a.nextChunkId++,T(a,d,n),"$"+d.toString(16)}}return b}if("string"===typeof b)return a="$"===b[0]||"@"===b[0]?"$"+b:b,a;if("boolean"===
typeof b||"number"===typeof b||"undefined"===typeof b)return b;if("function"===typeof b){if(/^on[A-Z]/.test(c))throw Error(m(374,P(c),Q(d)));throw Error(m(375,P(c),b.displayName||b.name||"function",Q(d)));}if("symbol"===typeof b){l=a.writtenSymbols;g=l.get(b);if(void 0!==g)return"$"+g.toString(16);g=b.description;if(Symbol.for(g)!==b)throw Error(m(376,b.description,P(c),Q(d)));a.pendingChunks++;d=a.nextChunkId++;c=u(g);c="S"+d.toString(16)+":"+c+"\n";c=r.encode(c);a.completedModuleChunks.push(c);
l.set(b,d);return"$"+d.toString(16)}if("bigint"===typeof b)throw Error(m(377,b,P(c),Q(d)));throw Error(m(378,typeof b,P(c),Q(d)));}function S(a,d){a=a.onError;a(d)}function U(a,d){null!==a.destination?(a.status=2,t(a.destination,d)):(a.status=1,a.fatalError=d)}
function T(a,d,c){var b="";try{if(c instanceof Error){var e=String(c.message);b=String(c.stack)}else e="Error: "+c}catch(k){e="An error occurred but serializing the error message failed."}c={message:e,stack:b};d="E"+d.toString(16)+":"+u(c)+"\n";d=r.encode(d);a.completedErrorChunks.push(d)}
function N(a){var d=D.current,c=V;D.current=W;V=a.cache;try{var b=a.pingedSegments;a.pingedSegments=[];for(var e=0;e<b.length;e++){var k=b[e];var f=a;try{for(var l=k.model;"object"===typeof l&&null!==l&&l.$$typeof===w;){var g=l;k.model=l;l=L(g.type,g.key,g.ref,g.props)}var E=k.id,F=u(l,f.toJSON),G="J"+E.toString(16)+":"+F+"\n";var n=r.encode(G);f.completedJSONChunks.push(n)}catch(q){if("object"===typeof q&&null!==q&&"function"===typeof q.then){var R=k.ping;q.then(R,R)}else S(f,q),T(f,k.id,q)}}null!==
a.destination&&X(a,a.destination)}catch(q){S(a,q),U(a,q)}finally{D.current=d,V=c}}
function X(a,d){for(var c=a.completedModuleChunks,b=0;b<c.length;b++)if(a.pendingChunks--,!p(d,c[b])){a.destination=null;b++;break}c.splice(0,b);c=a.completedJSONChunks;for(b=0;b<c.length;b++)if(a.pendingChunks--,!p(d,c[b])){a.destination=null;b++;break}c.splice(0,b);c=a.completedErrorChunks;for(b=0;b<c.length;b++)if(a.pendingChunks--,!p(d,c[b])){a.destination=null;b++;break}c.splice(0,b);0===a.pendingChunks&&d.close()}function Y(){throw Error(m(373));}function Z(){if(!V)throw Error(m(384));}
var V=null,W={useMemo:function(a){return a()},useCallback:function(a){return a},useDebugValue:function(){},useDeferredValue:Y,useTransition:Y,getCacheForType:function(a){if(!V)throw Error(m(380));var d=V.get(a);void 0===d&&(d=a(),V.set(a,d));return d},readContext:Y,useContext:Y,useReducer:Y,useRef:Y,useState:Y,useInsertionEffect:Y,useLayoutEffect:Y,useImperativeHandle:Y,useEffect:Y,useOpaqueIdentifier:Y,useMutableSource:Y,useSyncExternalStore:Y,useCacheRefresh:function(){return Z}};
exports.renderToReadableStream=function(a,d,c){var b=I(a,d,c?c.onError:void 0),e=new ReadableStream({start:function(){N(b)},pull:function(a){if(e.locked)if(1===b.status)b.status=2,t(a,b.fatalError);else if(2!==b.status){b.destination=a;try{X(b,a)}catch(f){S(b,f),U(b,f)}}},cancel:function(){}});return e};
/** @license React vundefined
* react-server-dom-webpack.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';function h(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var k={stream:!0},l=new Map,n=60103,q=60116;if("function"===typeof Symbol&&Symbol.for){var r=Symbol.for;n=r("react.element");q=r("react.lazy")}
function t(a,b,c){this._status=a;this._value=b;this._response=c}t.prototype.then=function(a){0===this._status?(null===this._value&&(this._value=[]),this._value.push(a)):a()};
function u(a){switch(a._status){case 3:return a._value;case 1:var b=JSON.parse(a._value,a._response._fromJSON);a._status=3;return a._value=b;case 2:b=a._value;for(var c=b.chunks,d=0;d<c.length;d++){var e=l.get(c[d]);if(null!==e)throw e;}c=__webpack_require__(b.id);b="*"===b.name?c:""===b.name?c.__esModule?c.default:c:c[b.name];a._status=3;return a._value=b;case 0:throw a;default:throw a._value;}}function v(){var a=w(this,0);return u(a)}function x(a,b){return new t(3,b,a)}
function y(a){if(null!==a)for(var b=0;b<a.length;b++)(0,a[b])()}function z(a,b){if(0===a._status){var c=a._value;a._status=4;a._value=b;y(c)}}function B(a,b){a._chunks.forEach(function(a){z(a,b)})}function w(a,b){var c=a._chunks,d=c.get(b);d||(d=new t(0,null,a),c.set(b,d));return d}
function C(a,b,c){switch(c[0]){case "$":if("$"===c)return n;if("$"===c[1]||"@"===c[1])return c.substring(1);b=parseInt(c.substring(1),16);a=w(a,b);return u(a);case "@":return b=parseInt(c.substring(1),16),a=w(a,b),{$$typeof:q,_payload:a,_init:u}}return c}
function D(a,b){if(""!==b){var c=b[0],d=b.indexOf(":",1),e=parseInt(b.substring(1,d),16);d=b.substring(d+1);switch(c){case "J":b=a._chunks;(c=b.get(e))?0===c._status&&(a=c._value,c._status=1,c._value=d,y(a)):b.set(e,new t(1,d,a));break;case "M":b=a._chunks;c=b.get(e);d=JSON.parse(d,a._fromJSON);for(var p=d.chunks,g=0;g<p.length;g++){var f=p[g];if(void 0===l.get(f)){var A=__webpack_chunk_load__(f),m=l.set.bind(l,f,null),G=l.set.bind(l,f);A.then(m,G);l.set(f,A)}}c?0===c._status&&(a=c._value,c._status=
2,c._value=d,y(a)):b.set(e,new t(2,d,a));break;case "S":c=JSON.parse(d);a._chunks.set(e,x(a,Symbol.for(c)));break;case "E":b=JSON.parse(d);c=Error(b.message);c.stack=b.stack;b=a._chunks;(d=b.get(e))?z(d,c):b.set(e,new t(4,c,a));break;default:throw Error(h(415));}}}function E(a){return function(b,c){return"string"===typeof c?C(a,this,c):"object"===typeof c&&null!==c?(b=c[0]===n?{$$typeof:n,type:c[1],key:c[2],ref:null,props:c[3],_owner:null}:c,b):c}}
function F(){var a=new TextDecoder;a={_chunks:new Map,readRoot:v,_partialRow:"",_stringDecoder:a};a._fromJSON=E(a);return a}function H(a,b){function c(b){var g=b.value;if(b.done)B(a,Error(h(412)));else{b=g;g=a._stringDecoder;for(var f=b.indexOf(10);-1<f;){var p=a._partialRow;var m=b.subarray(0,f);m=g.decode(m);D(a,p+m);a._partialRow="";b=b.subarray(f+1);f=b.indexOf(10)}a._partialRow+=g.decode(b,k);return e.read().then(c,d)}}function d(b){B(a,b)}var e=b.getReader();e.read().then(c,d)}
exports.createFromFetch=function(a){var b=F();a.then(function(a){H(b,a.body)},function(a){B(b,a)});return b};exports.createFromReadableStream=function(a){var b=F();H(b,a);return b};
exports.createFromXHR=function(a){function b(){for(var b=a.responseText,c=e,f=b.indexOf("\n",c);-1<f;)c=d._partialRow+b.substring(c,f),D(d,c),d._partialRow="",c=f+1,f=b.indexOf("\n",c);d._partialRow+=b.substring(c);e=b.length}function c(){B(d,new TypeError("Network error"))}var d=F(),e=0;a.addEventListener("progress",b);a.addEventListener("load",function(){b();B(d,Error(h(412)))});a.addEventListener("error",c);a.addEventListener("abort",c);a.addEventListener("timeout",c);return d};
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-server-dom-webpack.production.min.js');
} else {
module.exports = require('./cjs/react-server-dom-webpack.development.js');
}
{"name":"react-server-dom-webpack","main":"./index.js"}
\ No newline at end of file
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-server-dom-webpack-writer.browser.production.min.server.js');
} else {
module.exports = require('./cjs/react-server-dom-webpack-writer.browser.development.server.js');
}
......@@ -103,7 +103,6 @@
"raw-body": "2.4.1",
"react-is": "17.0.2",
"react-refresh": "0.8.3",
"react-server-dom-webpack": "0.0.0-experimental-3c4c1c470-20211021",
"regenerator-runtime": "0.13.4",
"stream-browserify": "3.0.0",
"stream-http": "3.1.1",
......@@ -114,8 +113,7 @@
"use-subscription": "1.5.1",
"util": "0.12.4",
"vm-browserify": "1.1.2",
"watchpack": "2.1.1",
"web-streams-polyfill": "3.0.3"
"watchpack": "2.1.1"
},
"peerDependencies": {
"fibers": ">= 3.1.0",
......@@ -244,6 +242,7 @@
"postcss-safe-parser": "6.0.0",
"postcss-scss": "3.0.5",
"postcss-value-parser": "4.1.0",
"react-server-dom-webpack": "0.0.0-experimental-3c4c1c470-20211021",
"resolve-url-loader": "3.1.2",
"sass-loader": "10.2.0",
"schema-utils2": "npm:schema-utils@2.7.1",
......
// eslint-disable-next-line import/no-extraneous-dependencies
const notifier = require('node-notifier')
// eslint-disable-next-line import/no-extraneous-dependencies
const { relative, basename, resolve, join } = require('path')
const { relative, basename, resolve, join, dirname } = require('path')
const fs = require('fs')
export async function next__polyfill_nomodule(task, opts) {
......@@ -554,6 +554,48 @@ export async function ncc_icss_utils(task, opts) {
})
.target('compiled/icss-utils')
}
// eslint-disable-next-line camelcase
export async function copy_react_server_dom_webpack(task, opts) {
await fs.promises.mkdir(
join(__dirname, 'compiled/react-server-dom-webpack'),
{ recursive: true }
)
await fs.promises.writeFile(
join(__dirname, 'compiled/react-server-dom-webpack/package.json'),
JSON.stringify({ name: 'react-server-dom-webpack', main: './index.js' })
)
await task
.source(require.resolve('react-server-dom-webpack'))
.target('compiled/react-server-dom-webpack')
await task
.source(
join(
dirname(require.resolve('react-server-dom-webpack')),
'cjs/react-server-dom-webpack.*'
)
)
.target('compiled/react-server-dom-webpack/cjs')
await task
.source(
join(
dirname(require.resolve('react-server-dom-webpack')),
'cjs/react-server-dom-webpack-writer.browser.*'
)
)
.target('compiled/react-server-dom-webpack/cjs')
await task
.source(
join(
dirname(require.resolve('react-server-dom-webpack')),
'writer.browser.server.js'
)
)
.target('compiled/react-server-dom-webpack')
}
// eslint-disable-next-line camelcase
externals['resolve-url-loader'] = 'next/dist/compiled/resolve-url-loader'
export async function ncc_resolve_url_loader(task, opts) {
......@@ -953,6 +995,7 @@ export async function ncc(task, opts) {
opts
)
await task.parallel(['ncc_babel_bundle_packages'], opts)
await task.parallel(['copy_react_server_dom_webpack'])
}
export async function compile(task, opts) {
......
......@@ -2,8 +2,6 @@
declare module 'next/dist/compiled/babel/plugin-transform-modules-commonjs'
declare module 'next/dist/compiled/babel/plugin-syntax-jsx'
declare module 'browserslist'
declare module 'react-server-dom-webpack/writer.browser.server'
declare module 'react-server-dom-webpack'
declare module 'cssnano-simple' {
const cssnanoSimple: any
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment