🚀 Socket Launch Week 🚀 Day 4: Introducing Historical Analytics.Learn More

react-server-dom-webpack

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-server-dom-webpack - npm Package Compare versions

Comparing version

to
19.1.0-canary-db7dfe05-20250319

@@ -441,3 +441,6 @@ /**

return (
(key = JSON.stringify(parentReference, resolveToJSON)),
(key = JSON.stringify(
{ id: parentReference.id, bound: parentReference.bound },
resolveToJSON
)),
null === formData && (formData = new FormData()),

@@ -507,4 +510,9 @@ (parentReference = nextPartId++),

}
function registerServerReference(proxy, reference) {
knownServerReferences.set(proxy, reference);
function registerBoundServerReference(reference, id, bound) {
knownServerReferences.has(reference) ||
knownServerReferences.set(reference, {
id: id,
originalBind: reference.bind,
bound: bound
});
}

@@ -524,3 +532,3 @@ function createBoundServerReference(metaData, callServer) {

bound = metaData.bound;
registerServerReference(action, { id: id, bound: bound });
registerBoundServerReference(action, id, bound);
return action;

@@ -792,3 +800,8 @@ }

else if (metaData.bound) response = Promise.resolve(metaData.bound);
else return requireModule(serverReference);
else
return (
(response = requireModule(serverReference)),
registerBoundServerReference(response, metaData.id, metaData.bound),
response
);
if (initializingHandler) {

@@ -813,2 +826,3 @@ var handler = initializingHandler;

}
registerBoundServerReference(resolvedValue, metaData.id, metaData.bound);
parentObject[key] = resolvedValue;

@@ -1622,3 +1636,3 @@ "" === key && null === handler.value && (handler.value = resolvedValue);

}
registerServerReference(action, { id: id, bound: null });
registerBoundServerReference(action, id, null);
return action;

@@ -1653,1 +1667,5 @@ };

};
exports.registerServerReference = function (reference, id) {
registerBoundServerReference(reference, id, null);
return reference;
};

@@ -453,3 +453,6 @@ /**

return (
(key = JSON.stringify(parentReference, resolveToJSON)),
(key = JSON.stringify(
{ id: parentReference.id, bound: parentReference.bound },
resolveToJSON
)),
null === formData && (formData = new FormData()),

@@ -550,4 +553,4 @@ (parentReference = nextPartId++),

function defaultEncodeFormAction(identifierPrefix) {
var reference = knownServerReferences.get(this);
if (!reference)
var referenceClosure = knownServerReferences.get(this);
if (!referenceClosure)
throw Error(

@@ -557,18 +560,22 @@ "Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."

var data = null;
if (null !== reference.bound) {
data = boundCache.get(reference);
if (null !== referenceClosure.bound) {
data = boundCache.get(referenceClosure);
data ||
((data = encodeFormData(reference)), boundCache.set(reference, data));
((data = encodeFormData({
id: referenceClosure.id,
bound: referenceClosure.bound
})),
boundCache.set(referenceClosure, data));
if ("rejected" === data.status) throw data.reason;
if ("fulfilled" !== data.status) throw data;
reference = data.value;
referenceClosure = data.value;
var prefixedData = new FormData();
reference.forEach(function (value, key) {
referenceClosure.forEach(function (value, key) {
prefixedData.append("$ACTION_" + identifierPrefix + ":" + key, value);
});
data = prefixedData;
reference = "$ACTION_REF_" + identifierPrefix;
} else reference = "$ACTION_ID_" + reference.id;
referenceClosure = "$ACTION_REF_" + identifierPrefix;
} else referenceClosure = "$ACTION_ID_" + referenceClosure.id;
return {
name: reference,
name: referenceClosure,
method: "POST",

@@ -580,9 +587,9 @@ encType: "multipart/form-data",

function isSignatureEqual(referenceId, numberOfBoundArgs) {
var reference = knownServerReferences.get(this);
if (!reference)
var referenceClosure = knownServerReferences.get(this);
if (!referenceClosure)
throw Error(
"Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
);
if (reference.id !== referenceId) return !1;
var boundPromise = reference.bound;
if (referenceClosure.id !== referenceId) return !1;
var boundPromise = referenceClosure.bound;
if (null === boundPromise) return 0 === numberOfBoundArgs;

@@ -614,23 +621,28 @@ switch (boundPromise.status) {

}
function registerServerReference(proxy, reference$jscomp$0, encodeFormAction) {
Object.defineProperties(proxy, {
$$FORM_ACTION: {
value:
void 0 === encodeFormAction
? defaultEncodeFormAction
: function () {
var reference = knownServerReferences.get(this);
if (!reference)
throw Error(
"Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
);
var boundPromise = reference.bound;
null === boundPromise && (boundPromise = Promise.resolve([]));
return encodeFormAction(reference.id, boundPromise);
}
},
$$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
bind: { value: bind }
});
knownServerReferences.set(proxy, reference$jscomp$0);
function registerBoundServerReference(reference, id, bound, encodeFormAction) {
knownServerReferences.has(reference) ||
(knownServerReferences.set(reference, {
id: id,
originalBind: reference.bind,
bound: bound
}),
Object.defineProperties(reference, {
$$FORM_ACTION: {
value:
void 0 === encodeFormAction
? defaultEncodeFormAction
: function () {
var referenceClosure = knownServerReferences.get(this);
if (!referenceClosure)
throw Error(
"Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
);
var boundPromise = referenceClosure.bound;
null === boundPromise && (boundPromise = Promise.resolve([]));
return encodeFormAction(referenceClosure.id, boundPromise);
}
},
$$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
bind: { value: bind }
}));
}

@@ -640,20 +652,23 @@ var FunctionBind = Function.prototype.bind,

function bind() {
var newFn = FunctionBind.apply(this, arguments),
reference = knownServerReferences.get(this);
if (reference) {
var args = ArraySlice.call(arguments, 1),
boundPromise = null;
boundPromise =
null !== reference.bound
? Promise.resolve(reference.bound).then(function (boundArgs) {
return boundArgs.concat(args);
})
: Promise.resolve(args);
Object.defineProperties(newFn, {
$$FORM_ACTION: { value: this.$$FORM_ACTION },
$$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
bind: { value: bind }
});
knownServerReferences.set(newFn, { id: reference.id, bound: boundPromise });
}
var referenceClosure = knownServerReferences.get(this);
if (!referenceClosure) return FunctionBind.apply(this, arguments);
var newFn = referenceClosure.originalBind.apply(this, arguments),
args = ArraySlice.call(arguments, 1),
boundPromise = null;
boundPromise =
null !== referenceClosure.bound
? Promise.resolve(referenceClosure.bound).then(function (boundArgs) {
return boundArgs.concat(args);
})
: Promise.resolve(args);
knownServerReferences.set(newFn, {
id: referenceClosure.id,
originalBind: newFn.bind,
bound: boundPromise
});
Object.defineProperties(newFn, {
$$FORM_ACTION: { value: this.$$FORM_ACTION },
$$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
bind: { value: bind }
});
return newFn;

@@ -674,3 +689,3 @@ }

bound = metaData.bound;
registerServerReference(action, { id: id, bound: bound }, encodeFormAction);
registerBoundServerReference(action, id, bound, encodeFormAction);
return action;

@@ -683,3 +698,3 @@ }

}
registerServerReference(action, { id: id, bound: null }, encodeFormAction);
registerBoundServerReference(action, id, null, encodeFormAction);
return action;

@@ -949,9 +964,20 @@ }

var serverReference = resolveServerReference(
response._serverReferenceConfig,
metaData.id
);
if ((response = preloadModule(serverReference)))
metaData.bound && (response = Promise.all([response, metaData.bound]));
else if (metaData.bound) response = Promise.resolve(metaData.bound);
else return requireModule(serverReference);
response._serverReferenceConfig,
metaData.id
),
promise = preloadModule(serverReference);
if (promise)
metaData.bound && (promise = Promise.all([promise, metaData.bound]));
else if (metaData.bound) promise = Promise.resolve(metaData.bound);
else
return (
(promise = requireModule(serverReference)),
registerBoundServerReference(
promise,
metaData.id,
metaData.bound,
response._encodeFormAction
),
promise
);
if (initializingHandler) {

@@ -968,3 +994,3 @@ var handler = initializingHandler;

};
response.then(
promise.then(
function () {

@@ -977,2 +1003,8 @@ var resolvedValue = requireModule(serverReference);

}
registerBoundServerReference(
resolvedValue,
metaData.id,
metaData.bound,
response._encodeFormAction
);
parentObject[key] = resolvedValue;

@@ -1821,1 +1853,5 @@ "" === key && null === handler.value && (handler.value = resolvedValue);

};
exports.registerServerReference = function (reference, id, encodeFormAction) {
registerBoundServerReference(reference, id, null, encodeFormAction);
return reference;
};

@@ -454,3 +454,6 @@ /**

return (
(key = JSON.stringify(parentReference, resolveToJSON)),
(key = JSON.stringify(
{ id: parentReference.id, bound: parentReference.bound },
resolveToJSON
)),
null === formData && (formData = new FormData()),

@@ -551,4 +554,4 @@ (parentReference = nextPartId++),

function defaultEncodeFormAction(identifierPrefix) {
var reference = knownServerReferences.get(this);
if (!reference)
var referenceClosure = knownServerReferences.get(this);
if (!referenceClosure)
throw Error(

@@ -558,18 +561,22 @@ "Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."

var data = null;
if (null !== reference.bound) {
data = boundCache.get(reference);
if (null !== referenceClosure.bound) {
data = boundCache.get(referenceClosure);
data ||
((data = encodeFormData(reference)), boundCache.set(reference, data));
((data = encodeFormData({
id: referenceClosure.id,
bound: referenceClosure.bound
})),
boundCache.set(referenceClosure, data));
if ("rejected" === data.status) throw data.reason;
if ("fulfilled" !== data.status) throw data;
reference = data.value;
referenceClosure = data.value;
var prefixedData = new FormData();
reference.forEach(function (value, key) {
referenceClosure.forEach(function (value, key) {
prefixedData.append("$ACTION_" + identifierPrefix + ":" + key, value);
});
data = prefixedData;
reference = "$ACTION_REF_" + identifierPrefix;
} else reference = "$ACTION_ID_" + reference.id;
referenceClosure = "$ACTION_REF_" + identifierPrefix;
} else referenceClosure = "$ACTION_ID_" + referenceClosure.id;
return {
name: reference,
name: referenceClosure,
method: "POST",

@@ -581,9 +588,9 @@ encType: "multipart/form-data",

function isSignatureEqual(referenceId, numberOfBoundArgs) {
var reference = knownServerReferences.get(this);
if (!reference)
var referenceClosure = knownServerReferences.get(this);
if (!referenceClosure)
throw Error(
"Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
);
if (reference.id !== referenceId) return !1;
var boundPromise = reference.bound;
if (referenceClosure.id !== referenceId) return !1;
var boundPromise = referenceClosure.bound;
if (null === boundPromise) return 0 === numberOfBoundArgs;

@@ -615,23 +622,28 @@ switch (boundPromise.status) {

}
function registerServerReference(proxy, reference$jscomp$0, encodeFormAction) {
Object.defineProperties(proxy, {
$$FORM_ACTION: {
value:
void 0 === encodeFormAction
? defaultEncodeFormAction
: function () {
var reference = knownServerReferences.get(this);
if (!reference)
throw Error(
"Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
);
var boundPromise = reference.bound;
null === boundPromise && (boundPromise = Promise.resolve([]));
return encodeFormAction(reference.id, boundPromise);
}
},
$$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
bind: { value: bind }
});
knownServerReferences.set(proxy, reference$jscomp$0);
function registerBoundServerReference(reference, id, bound, encodeFormAction) {
knownServerReferences.has(reference) ||
(knownServerReferences.set(reference, {
id: id,
originalBind: reference.bind,
bound: bound
}),
Object.defineProperties(reference, {
$$FORM_ACTION: {
value:
void 0 === encodeFormAction
? defaultEncodeFormAction
: function () {
var referenceClosure = knownServerReferences.get(this);
if (!referenceClosure)
throw Error(
"Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
);
var boundPromise = referenceClosure.bound;
null === boundPromise && (boundPromise = Promise.resolve([]));
return encodeFormAction(referenceClosure.id, boundPromise);
}
},
$$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
bind: { value: bind }
}));
}

@@ -641,20 +653,23 @@ var FunctionBind = Function.prototype.bind,

function bind() {
var newFn = FunctionBind.apply(this, arguments),
reference = knownServerReferences.get(this);
if (reference) {
var args = ArraySlice.call(arguments, 1),
boundPromise = null;
boundPromise =
null !== reference.bound
? Promise.resolve(reference.bound).then(function (boundArgs) {
return boundArgs.concat(args);
})
: Promise.resolve(args);
Object.defineProperties(newFn, {
$$FORM_ACTION: { value: this.$$FORM_ACTION },
$$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
bind: { value: bind }
});
knownServerReferences.set(newFn, { id: reference.id, bound: boundPromise });
}
var referenceClosure = knownServerReferences.get(this);
if (!referenceClosure) return FunctionBind.apply(this, arguments);
var newFn = referenceClosure.originalBind.apply(this, arguments),
args = ArraySlice.call(arguments, 1),
boundPromise = null;
boundPromise =
null !== referenceClosure.bound
? Promise.resolve(referenceClosure.bound).then(function (boundArgs) {
return boundArgs.concat(args);
})
: Promise.resolve(args);
knownServerReferences.set(newFn, {
id: referenceClosure.id,
originalBind: newFn.bind,
bound: boundPromise
});
Object.defineProperties(newFn, {
$$FORM_ACTION: { value: this.$$FORM_ACTION },
$$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
bind: { value: bind }
});
return newFn;

@@ -675,3 +690,3 @@ }

bound = metaData.bound;
registerServerReference(action, { id: id, bound: bound }, encodeFormAction);
registerBoundServerReference(action, id, bound, encodeFormAction);
return action;

@@ -684,3 +699,3 @@ }

}
registerServerReference(action, { id: id, bound: null }, encodeFormAction);
registerBoundServerReference(action, id, null, encodeFormAction);
return action;

@@ -950,9 +965,20 @@ }

var serverReference = resolveServerReference(
response._serverReferenceConfig,
metaData.id
);
if ((response = preloadModule(serverReference)))
metaData.bound && (response = Promise.all([response, metaData.bound]));
else if (metaData.bound) response = Promise.resolve(metaData.bound);
else return requireModule(serverReference);
response._serverReferenceConfig,
metaData.id
),
promise = preloadModule(serverReference);
if (promise)
metaData.bound && (promise = Promise.all([promise, metaData.bound]));
else if (metaData.bound) promise = Promise.resolve(metaData.bound);
else
return (
(promise = requireModule(serverReference)),
registerBoundServerReference(
promise,
metaData.id,
metaData.bound,
response._encodeFormAction
),
promise
);
if (initializingHandler) {

@@ -969,3 +995,3 @@ var handler = initializingHandler;

};
response.then(
promise.then(
function () {

@@ -978,2 +1004,8 @@ var resolvedValue = requireModule(serverReference);

}
registerBoundServerReference(
resolvedValue,
metaData.id,
metaData.bound,
response._encodeFormAction
);
parentObject[key] = resolvedValue;

@@ -1870,1 +1902,5 @@ "" === key && null === handler.value && (handler.value = resolvedValue);

};
exports.registerServerReference = function (reference, id, encodeFormAction) {
registerBoundServerReference(reference, id, null, encodeFormAction);
return reference;
};

@@ -419,3 +419,6 @@ /**

return (
(key = JSON.stringify(parentReference, resolveToJSON)),
(key = JSON.stringify(
{ id: parentReference.id, bound: parentReference.bound },
resolveToJSON
)),
null === formData && (formData = new FormData()),

@@ -516,4 +519,4 @@ (parentReference = nextPartId++),

function defaultEncodeFormAction(identifierPrefix) {
var reference = knownServerReferences.get(this);
if (!reference)
var referenceClosure = knownServerReferences.get(this);
if (!referenceClosure)
throw Error(

@@ -523,18 +526,22 @@ "Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."

var data = null;
if (null !== reference.bound) {
data = boundCache.get(reference);
if (null !== referenceClosure.bound) {
data = boundCache.get(referenceClosure);
data ||
((data = encodeFormData(reference)), boundCache.set(reference, data));
((data = encodeFormData({
id: referenceClosure.id,
bound: referenceClosure.bound
})),
boundCache.set(referenceClosure, data));
if ("rejected" === data.status) throw data.reason;
if ("fulfilled" !== data.status) throw data;
reference = data.value;
referenceClosure = data.value;
var prefixedData = new FormData();
reference.forEach(function (value, key) {
referenceClosure.forEach(function (value, key) {
prefixedData.append("$ACTION_" + identifierPrefix + ":" + key, value);
});
data = prefixedData;
reference = "$ACTION_REF_" + identifierPrefix;
} else reference = "$ACTION_ID_" + reference.id;
referenceClosure = "$ACTION_REF_" + identifierPrefix;
} else referenceClosure = "$ACTION_ID_" + referenceClosure.id;
return {
name: reference,
name: referenceClosure,
method: "POST",

@@ -546,9 +553,9 @@ encType: "multipart/form-data",

function isSignatureEqual(referenceId, numberOfBoundArgs) {
var reference = knownServerReferences.get(this);
if (!reference)
var referenceClosure = knownServerReferences.get(this);
if (!referenceClosure)
throw Error(
"Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
);
if (reference.id !== referenceId) return !1;
var boundPromise = reference.bound;
if (referenceClosure.id !== referenceId) return !1;
var boundPromise = referenceClosure.bound;
if (null === boundPromise) return 0 === numberOfBoundArgs;

@@ -580,23 +587,28 @@ switch (boundPromise.status) {

}
function registerServerReference(proxy, reference$jscomp$0, encodeFormAction) {
Object.defineProperties(proxy, {
$$FORM_ACTION: {
value:
void 0 === encodeFormAction
? defaultEncodeFormAction
: function () {
var reference = knownServerReferences.get(this);
if (!reference)
throw Error(
"Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
);
var boundPromise = reference.bound;
null === boundPromise && (boundPromise = Promise.resolve([]));
return encodeFormAction(reference.id, boundPromise);
}
},
$$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
bind: { value: bind }
});
knownServerReferences.set(proxy, reference$jscomp$0);
function registerBoundServerReference(reference, id, bound, encodeFormAction) {
knownServerReferences.has(reference) ||
(knownServerReferences.set(reference, {
id: id,
originalBind: reference.bind,
bound: bound
}),
Object.defineProperties(reference, {
$$FORM_ACTION: {
value:
void 0 === encodeFormAction
? defaultEncodeFormAction
: function () {
var referenceClosure = knownServerReferences.get(this);
if (!referenceClosure)
throw Error(
"Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React."
);
var boundPromise = referenceClosure.bound;
null === boundPromise && (boundPromise = Promise.resolve([]));
return encodeFormAction(referenceClosure.id, boundPromise);
}
},
$$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
bind: { value: bind }
}));
}

@@ -606,20 +618,23 @@ var FunctionBind = Function.prototype.bind,

function bind() {
var newFn = FunctionBind.apply(this, arguments),
reference = knownServerReferences.get(this);
if (reference) {
var args = ArraySlice.call(arguments, 1),
boundPromise = null;
boundPromise =
null !== reference.bound
? Promise.resolve(reference.bound).then(function (boundArgs) {
return boundArgs.concat(args);
})
: Promise.resolve(args);
Object.defineProperties(newFn, {
$$FORM_ACTION: { value: this.$$FORM_ACTION },
$$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
bind: { value: bind }
});
knownServerReferences.set(newFn, { id: reference.id, bound: boundPromise });
}
var referenceClosure = knownServerReferences.get(this);
if (!referenceClosure) return FunctionBind.apply(this, arguments);
var newFn = referenceClosure.originalBind.apply(this, arguments),
args = ArraySlice.call(arguments, 1),
boundPromise = null;
boundPromise =
null !== referenceClosure.bound
? Promise.resolve(referenceClosure.bound).then(function (boundArgs) {
return boundArgs.concat(args);
})
: Promise.resolve(args);
knownServerReferences.set(newFn, {
id: referenceClosure.id,
originalBind: newFn.bind,
bound: boundPromise
});
Object.defineProperties(newFn, {
$$FORM_ACTION: { value: this.$$FORM_ACTION },
$$IS_SIGNATURE_EQUAL: { value: isSignatureEqual },
bind: { value: bind }
});
return newFn;

@@ -640,3 +655,3 @@ }

bound = metaData.bound;
registerServerReference(action, { id: id, bound: bound }, encodeFormAction);
registerBoundServerReference(action, id, bound, encodeFormAction);
return action;

@@ -649,3 +664,3 @@ }

}
registerServerReference(action, { id: id, bound: null }, encodeFormAction);
registerBoundServerReference(action, id, null, encodeFormAction);
return action;

@@ -915,9 +930,20 @@ }

var serverReference = resolveServerReference(
response._serverReferenceConfig,
metaData.id
);
if ((response = preloadModule(serverReference)))
metaData.bound && (response = Promise.all([response, metaData.bound]));
else if (metaData.bound) response = Promise.resolve(metaData.bound);
else return requireModule(serverReference);
response._serverReferenceConfig,
metaData.id
),
promise = preloadModule(serverReference);
if (promise)
metaData.bound && (promise = Promise.all([promise, metaData.bound]));
else if (metaData.bound) promise = Promise.resolve(metaData.bound);
else
return (
(promise = requireModule(serverReference)),
registerBoundServerReference(
promise,
metaData.id,
metaData.bound,
response._encodeFormAction
),
promise
);
if (initializingHandler) {

@@ -934,3 +960,3 @@ var handler = initializingHandler;

};
response.then(
promise.then(
function () {

@@ -943,2 +969,8 @@ var resolvedValue = requireModule(serverReference);

}
registerBoundServerReference(
resolvedValue,
metaData.id,
metaData.bound,
response._encodeFormAction
);
parentObject[key] = resolvedValue;

@@ -1835,1 +1867,5 @@ "" === key && null === handler.value && (handler.value = resolvedValue);

};
exports.registerServerReference = function (reference, id, encodeFormAction) {
registerBoundServerReference(reference, id, null, encodeFormAction);
return reference;
};

@@ -36,4 +36,5 @@ /**

function _createForOfIteratorHelper(o, allowArrayLike) {
var it;
if ("undefined" === typeof Symbol || null == o[Symbol.iterator]) {
var it =
("undefined" !== typeof Symbol && o[Symbol.iterator]) || o["@@iterator"];
if (!it) {
if (

@@ -67,3 +68,3 @@ Array.isArray(o) ||

s: function () {
it = o[Symbol.iterator]();
it = it.call(o);
},

@@ -70,0 +71,0 @@ n: function () {

@@ -23,3 +23,2 @@ /**

stashedResolve = defaultResolve;
if (!context.conditions.includes('react-server')) {

@@ -29,10 +28,8 @@ context = assign({}, context, {

});
if (!warnedAboutConditionsFlag) {
warnedAboutConditionsFlag = true; // eslint-disable-next-line react-internal/no-production-logging
warnedAboutConditionsFlag = true;
// eslint-disable-next-line react-internal/no-production-logging
console.warn('You did not run Node.js with the `--conditions react-server` flag. ' + 'Any "react-server" override will only work with ESM imports.');
}
}
return await defaultResolve(specifier, context, defaultResolve);

@@ -45,3 +42,2 @@ }

}
function addExportedEntry(exportedEntries, localNames, localName, exportedName, type, loc) {

@@ -52,3 +48,2 @@ if (localNames.has(localName)) {

}
exportedEntries.push({

@@ -65,3 +60,2 @@ localName,

}
function addLocalExportedNames(exportedEntries, localNames, node) {

@@ -72,8 +66,5 @@ switch (node.type) {

return;
case 'ObjectPattern':
for (let i = 0; i < node.properties.length; i++) addLocalExportedNames(exportedEntries, localNames, node.properties[i]);
return;
case 'ArrayPattern':

@@ -84,17 +75,12 @@ for (let i = 0; i < node.elements.length; i++) {

}
return;
case 'Property':
addLocalExportedNames(exportedEntries, localNames, node.value);
return;
case 'AssignmentPattern':
addLocalExportedNames(exportedEntries, localNames, node.left);
return;
case 'RestElement':
addLocalExportedNames(exportedEntries, localNames, node.argument);
return;
case 'ParenthesizedExpression':

@@ -105,13 +91,11 @@ addLocalExportedNames(exportedEntries, localNames, node.expression);

}
function transformServerModule(source, program, url, sourceMap, loader) {
const body = program.body; // This entry list needs to be in source location order.
const body = program.body;
const exportedEntries = []; // Dedupe set.
// This entry list needs to be in source location order.
const exportedEntries = [];
// Dedupe set.
const localNames = new Set();
for (let i = 0; i < body.length; i++) {
const node = body[i];
switch (node.type) {

@@ -121,3 +105,2 @@ case 'ExportAllDeclaration':

break;
case 'ExportDefaultDeclaration':

@@ -131,5 +114,3 @@ if (node.declaration.type === 'Identifier') {

}
continue;
case 'ExportNamedDeclaration':

@@ -139,3 +120,2 @@ if (node.declaration) {

const declarations = node.declaration.declarations;
for (let j = 0; j < declarations.length; j++) {

@@ -149,6 +129,4 @@ addLocalExportedNames(exportedEntries, localNames, declarations[j].id);

}
if (node.specifiers) {
const specifiers = node.specifiers;
for (let j = 0; j < specifiers.length; j++) {

@@ -159,10 +137,7 @@ const specifier = specifiers[j];

}
continue;
}
}
let mappings = sourceMap && typeof sourceMap.mappings === 'string' ? sourceMap.mappings : '';
let newSrc = source;
if (exportedEntries.length > 0) {

@@ -175,3 +150,2 @@ let lastSourceIndex = 0;

let lastMappedLine = 0;
if (sourceMap) {

@@ -193,5 +167,3 @@ // We iterate source mapping entries and our matched exports in parallel to source map

}
nextEntryIdx++;
if (nextEntryIdx < exportedEntries.length) {

@@ -205,17 +177,12 @@ nextEntryLine = exportedEntries[nextEntryIdx].loc.start.line;

}
lastMappedLine = generatedLine;
if (sourceIndex > -1) {
lastSourceIndex = sourceIndex;
}
if (originalLine > -1) {
lastOriginalLine = originalLine;
}
if (originalColumn > -1) {
lastOriginalColumn = originalColumn;
}
if (nameIndex > -1) {

@@ -225,3 +192,2 @@ lastNameIndex = nameIndex;

});
if (nextEntryIdx < exportedEntries.length) {

@@ -236,3 +202,2 @@ if (lastMappedLine === nextEntryLine) {

}
for (let lastIdx = mappings.length - 1; lastIdx >= 0 && mappings[lastIdx] === ';'; lastIdx--) {

@@ -243,11 +208,8 @@ // If the last mapped lines don't contain any segments, we don't get a callback from readMappings

}
sourceLineCount = program.loc.end.line;
if (sourceLineCount < lastMappedLine) {
throw new Error('The source map has more mappings than there are lines.');
} // If the original source string had more lines than there are mappings in the source map.
}
// If the original source string had more lines than there are mappings in the source map.
// Add some extra padding of unmapped lines so that any lines that we add line up.
for (let extraLines = sourceLineCount - lastMappedLine; extraLines > 0; extraLines--) {

@@ -261,7 +223,5 @@ mappings += ';';

let idx = -1;
while ((idx = source.indexOf('\n', idx + 1)) !== -1) {
sourceLineCount++;
}
mappings = 'AAAA' + ';AACA'.repeat(sourceLineCount - 1);

@@ -280,3 +240,2 @@ sourceMap = {

lastMappedLine = sourceLineCount;
for (let i = 0; i < exportedEntries.length; i++) {

@@ -286,24 +245,20 @@ // Point each entry to original location.

entry.originalSource = 0;
entry.originalLine = entry.loc.start.line; // We use column zero since we do the short-hand line-only source maps above.
entry.originalLine = entry.loc.start.line;
// We use column zero since we do the short-hand line-only source maps above.
entry.originalColumn = 0; // entry.loc.start.column;
}
}
newSrc += '\n\n;';
newSrc += 'import {registerServerReference} from "react-server-dom-webpack/server";\n';
if (mappings) {
mappings += ';;';
}
const createMapping = createMappingsSerializer();
const createMapping = createMappingsSerializer(); // Create an empty mapping pointing to where we last left off to reset the counters.
// Create an empty mapping pointing to where we last left off to reset the counters.
let generatedLine = 1;
createMapping(generatedLine, 0, lastSourceIndex, lastOriginalLine, lastOriginalColumn, lastNameIndex);
for (let i = 0; i < exportedEntries.length; i++) {
const entry = exportedEntries[i];
generatedLine++;
if (entry.type !== 'function') {

@@ -313,3 +268,2 @@ // We first check if the export is a function and if so annotate it.

}
newSrc += 'registerServerReference(' + entry.localName + ',';

@@ -321,3 +275,2 @@ newSrc += JSON.stringify(url) + ',';

}
if (sourceMap) {

@@ -328,6 +281,4 @@ // Override with an new mappings and serialize an inline source map.

}
return newSrc;
}
function addExportNames(names, node) {

@@ -338,8 +289,5 @@ switch (node.type) {

return;
case 'ObjectPattern':
for (let i = 0; i < node.properties.length; i++) addExportNames(names, node.properties[i]);
return;
case 'ArrayPattern':

@@ -350,17 +298,12 @@ for (let i = 0; i < node.elements.length; i++) {

}
return;
case 'Property':
addExportNames(names, node.value);
return;
case 'AssignmentPattern':
addExportNames(names, node.left);
return;
case 'RestElement':
addExportNames(names, node.argument);
return;
case 'ParenthesizedExpression':

@@ -371,3 +314,2 @@ addExportNames(names, node.expression);

}
function resolveClientImport(specifier, parentURL) {

@@ -380,7 +322,5 @@ // Resolve an import specifier as if it was loaded by the client. This doesn't use

const conditions = ['node', 'import'];
if (stashedResolve === null) {
throw new Error('Expected resolve to have been called before transformSource');
}
return stashedResolve(specifier, {

@@ -391,7 +331,5 @@ conditions,

}
async function parseExportNamesInto(body, names, parentURL, loader) {
for (let i = 0; i < body.length; i++) {
const node = body[i];
switch (node.type) {

@@ -404,17 +342,13 @@ case 'ExportAllDeclaration':

const _await$resolveClientI = await resolveClientImport(node.source.value, parentURL),
url = _await$resolveClientI.url;
url = _await$resolveClientI.url;
const _await$loader = await loader(url, {
format: 'module',
conditions: [],
importAssertions: {}
}, loader),
source = _await$loader.source;
format: 'module',
conditions: [],
importAssertions: {}
}, loader),
source = _await$loader.source;
if (typeof source !== 'string') {
throw new Error('Expected the transformed source to be a string.');
}
let childBody;
try {

@@ -430,11 +364,8 @@ childBody = acorn.parse(source, {

}
await parseExportNamesInto(childBody, names, url, loader);
continue;
}
case 'ExportDefaultDeclaration':
names.push('default');
continue;
case 'ExportNamedDeclaration':

@@ -444,3 +375,2 @@ if (node.declaration) {

const declarations = node.declaration.declarations;
for (let j = 0; j < declarations.length; j++) {

@@ -453,6 +383,4 @@ addExportNames(names, declarations[j].id);

}
if (node.specifiers) {
const specifiers = node.specifiers;
for (let j = 0; j < specifiers.length; j++) {

@@ -462,3 +390,2 @@ addExportNames(names, specifiers[j].exported);

}
continue;

@@ -468,3 +395,2 @@ }

}
async function transformClientModule(program, url, sourceMap, loader) {

@@ -474,12 +400,8 @@ const body = program.body;

await parseExportNamesInto(body, names, url, loader);
if (names.length === 0) {
return '';
}
let newSrc = 'import {registerClientReference} from "react-server-dom-webpack/server";\n';
for (let i = 0; i < names.length; i++) {
const name = names[i];
if (name === 'default') {

@@ -494,24 +416,20 @@ newSrc += 'export default ';

}
newSrc += '},';
newSrc += JSON.stringify(url) + ',';
newSrc += JSON.stringify(name) + ');\n';
} // TODO: Generate source maps for Client Reference functions so they can point to their
}
// TODO: Generate source maps for Client Reference functions so they can point to their
// original locations.
return newSrc;
}
async function loadClientImport(url, defaultTransformSource) {
if (stashedGetSource === null) {
throw new Error('Expected getSource to have been called before transformSource');
} // TODO: Validate that this is another module by calling getFormat.
}
// TODO: Validate that this is another module by calling getFormat.
const _await$stashedGetSour = await stashedGetSource(url, {
format: 'module'
}, stashedGetSource),
source = _await$stashedGetSour.source;
format: 'module'
}, stashedGetSource),
source = _await$stashedGetSour.source;
const result = await defaultTransformSource(source, {

@@ -526,3 +444,2 @@ format: 'module',

}
async function transformModuleIfNeeded(source, url, loader) {

@@ -534,3 +451,2 @@ // Do a quick check for the exact string. If it doesn't exist, don't

}
let sourceMappingURL = null;

@@ -541,3 +457,2 @@ let sourceMappingStart = 0;

let program;
try {

@@ -548,3 +463,2 @@ program = acorn.parse(source, {

locations: true,
onComment(block, text, start, end, startLoc, endLoc) {

@@ -558,3 +472,2 @@ if (text.startsWith('# sourceMappingURL=') || text.startsWith('@ sourceMappingURL=')) {

}
});

@@ -566,18 +479,13 @@ } catch (x) {

}
let useClient = false;
let useServer = false;
const body = program.body;
for (let i = 0; i < body.length; i++) {
const node = body[i];
if (node.type !== 'ExpressionStatement' || !node.directive) {
break;
}
if (node.directive === 'use client') {
useClient = true;
}
if (node.directive === 'use server') {

@@ -587,15 +495,12 @@ useServer = true;

}
if (!useClient && !useServer) {
return source;
}
if (useClient && useServer) {
throw new Error('Cannot have both "use client" and "use server" directives in the same file.');
}
let sourceMap = null;
if (sourceMappingURL) {
const sourceMapResult = await loader(sourceMappingURL, // $FlowFixMe
const sourceMapResult = await loader(sourceMappingURL,
// $FlowFixMe
{

@@ -611,26 +516,22 @@ format: 'json',

}, loader);
const sourceMapString = typeof sourceMapResult.source === 'string' ? sourceMapResult.source : // $FlowFixMe
const sourceMapString = typeof sourceMapResult.source === 'string' ? sourceMapResult.source :
// $FlowFixMe
sourceMapResult.source.toString('utf8');
sourceMap = JSON.parse(sourceMapString); // Strip the source mapping comment. We'll re-add it below if needed.
sourceMap = JSON.parse(sourceMapString);
// Strip the source mapping comment. We'll re-add it below if needed.
source = source.slice(0, sourceMappingStart) + '\n'.repeat(sourceMappingLines) + source.slice(sourceMappingEnd);
}
if (useClient) {
return transformClientModule(program, url, sourceMap, loader);
}
return transformServerModule(source, program, url, sourceMap);
}
async function transformSource(source, context, defaultTransformSource) {
const transformed = await defaultTransformSource(source, context, defaultTransformSource);
if (context.format === 'module') {
const transformedSource = transformed.source;
if (typeof transformedSource !== 'string') {
throw new Error('Expected source to have been transformed to a string.');
}
const newSrc = await transformModuleIfNeeded(transformedSource, context.url, (url, ctx, defaultLoad) => {

@@ -643,3 +544,2 @@ return loadClientImport(url, defaultTransformSource);

}
return transformed;

@@ -649,3 +549,2 @@ }

const result = await defaultLoad(url, context, defaultLoad);
if (result.format === 'module') {

@@ -655,3 +554,2 @@ if (typeof result.source !== 'string') {

}
const newSrc = await transformModuleIfNeeded(result.source, url, defaultLoad);

@@ -663,3 +561,2 @@ return {

}
return result;

@@ -666,0 +563,0 @@ }

{
"name": "react-server-dom-webpack",
"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.",
"version": "19.1.0-canary-d85cf3e5-20250205",
"version": "19.1.0-canary-db7dfe05-20250319",
"keywords": [

@@ -102,4 +102,4 @@ "react"

"peerDependencies": {
"react": "19.1.0-canary-d85cf3e5-20250205",
"react-dom": "19.1.0-canary-d85cf3e5-20250205",
"react": "19.1.0-canary-db7dfe05-20250319",
"react-dom": "19.1.0-canary-db7dfe05-20250319",
"webpack": "^5.59.0"

@@ -106,0 +106,0 @@ },

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display