This commit is contained in:
2025-06-16 13:37:14 +02:00
parent ac273655e6
commit a8b82208f7
5100 changed files with 737524 additions and 2 deletions

43
node_modules/@prefresh/utils/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
const compareSignatures = (prev, next) => {
const prevSignature = self.__PREFRESH__.getSignature(prev) || {};
const nextSignature = self.__PREFRESH__.getSignature(next) || {};
if (
prevSignature.key !== nextSignature.key ||
self.__PREFRESH__.computeKey(prevSignature) !==
self.__PREFRESH__.computeKey(nextSignature) ||
nextSignature.forceReset
) {
self.__PREFRESH__.replaceComponent(prev, next, true);
} else {
self.__PREFRESH__.replaceComponent(prev, next, false);
}
};
export const flush = () => {
const pending = [...self.__PREFRESH__.getPendingUpdates()];
self.__PREFRESH__.flush();
if (pending.length > 0) {
pending.forEach(([prev, next]) => {
compareSignatures(prev, next);
});
}
};
export const isComponent = exportValue => {
if (typeof exportValue === 'function') {
if (
exportValue.prototype != null &&
exportValue.prototype.isReactComponent
) {
return true;
}
const name = exportValue.name || exportValue.displayName;
return (
typeof name === 'string' && name[0] && name[0] == name[0].toUpperCase()
);
}
return false;
};