Skip to content

Commit

Permalink
Rebuild dist
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Sep 2, 2015
1 parent 4d9fd05 commit 29ee328
Showing 1 changed file with 72 additions and 25 deletions.
97 changes: 72 additions & 25 deletions dist/ReactHotAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ return /******/ (function(modules) { // webpackBootstrap
function proxyClass(InitialClass) {
// Prevent double wrapping.
// Given a proxy class, return the existing proxy managing it.
if (InitialClass.__reactPatchProxy) {
if (Object.prototype.hasOwnProperty.call(InitialClass, '__reactPatchProxy')) {
return InitialClass.__reactPatchProxy;
}

Expand All @@ -608,46 +608,75 @@ return /******/ (function(modules) { // webpackBootstrap
// Point proxy constructor to the proxy prototype
ProxyClass.prototype = prototypeProxy.get();

function update(NextClass) {
if (typeof NextClass !== 'function') {
throw new Error('Expected a constructor.');
}
function update(_x) {
var _again = true;

// Save the next constructor so we call it
CurrentClass = NextClass;
_function: while (_again) {
var NextClass = _x;
mountedInstances = undefined;
_again = false;

// Update the prototype proxy with new methods
var mountedInstances = prototypeProxy.update(NextClass.prototype);
if (typeof NextClass !== 'function') {
throw new Error('Expected a constructor.');
}

// Set up the constructor property so accessing the statics work
ProxyClass.prototype.constructor = ProxyClass;
// Prevent proxy cycles
if (Object.prototype.hasOwnProperty.call(NextClass, '__reactPatchProxy')) {
_x = NextClass.__reactPatchProxy.__getCurrent();
_again = true;
continue _function;
}

// Naïvely proxy static methods and properties
ProxyClass.prototype.constructor.__proto__ = NextClass;
// Save the next constructor so we call it
CurrentClass = NextClass;

// Try to infer displayName
ProxyClass.displayName = NextClass.name || NextClass.displayName;
// Update the prototype proxy with new methods
var mountedInstances = prototypeProxy.update(NextClass.prototype);

// We might have added new methods that need to be auto-bound
mountedInstances.forEach(_bindAutoBindMethods2['default']);
mountedInstances.forEach(_deleteUnknownAutoBindMethods2['default']);
// Set up the constructor property so accessing the statics work
ProxyClass.prototype.constructor = ProxyClass;

// Let the user take care of redrawing
return mountedInstances;
// Naïvely proxy static methods and properties
ProxyClass.prototype.constructor.__proto__ = NextClass;

// Try to infer displayName
ProxyClass.displayName = NextClass.name || NextClass.displayName;

// We might have added new methods that need to be auto-bound
mountedInstances.forEach(_bindAutoBindMethods2['default']);
mountedInstances.forEach(_deleteUnknownAutoBindMethods2['default']);

// Let the user take care of redrawing
return mountedInstances;
}
};

function get() {
return ProxyClass;
}

function getCurrent() {
return CurrentClass;
}

update(InitialClass);

var proxy = {
get: get,
update: update
};
var proxy = { get: get, update: update };

Object.defineProperty(proxy, '__getCurrent', {
configurable: false,
writable: false,
enumerable: false,
value: getCurrent
});

Object.defineProperty(ProxyClass, '__reactPatchProxy', {
configurable: false,
writable: false,
enumerable: false,
value: proxy
});

ProxyClass.__reactPatchProxy = proxy;
return proxy;
}

Expand Down Expand Up @@ -679,6 +708,20 @@ return /******/ (function(modules) { // webpackBootstrap
var current = null;
var mountedInstances = [];

/**
* Creates a proxied toString() method pointing to the current version's toString().
*/
function proxyToString(name) {
// Wrap to always call the current version
return function toString() {
if (typeof current[name] === 'function') {
return current[name].toString();
} else {
return '<method was deleted>';
}
};
}

/**
* Creates a proxied method that calls the current version, whenever available.
*/
Expand All @@ -692,6 +735,8 @@ return /******/ (function(modules) { // webpackBootstrap

// Copy properties of the original function, if any
(0, _lodashObjectAssign2['default'])(proxiedMethod, current[name]);
proxiedMethod.toString = proxyToString(name);

return proxiedMethod;
}

Expand All @@ -704,6 +749,7 @@ return /******/ (function(modules) { // webpackBootstrap
return current.componentDidMount.apply(this, arguments);
}
}
proxiedComponentDidMount.toString = proxyToString('componentDidMount');

/**
* Augments the original componentWillUnmount with instance tracking.
Expand All @@ -718,6 +764,7 @@ return /******/ (function(modules) { // webpackBootstrap
return current.componentWillUnmount.apply(this, arguments);
}
}
proxiedComponentWillUnmount.toString = proxyToString('componentWillUnmount');

/**
* Defines a property on the proxy.
Expand Down

0 comments on commit 29ee328

Please sign in to comment.