Skip to content

Commit

Permalink
release v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
roland-reed committed Jan 26, 2018
1 parent 23e039f commit 94a8f1e
Show file tree
Hide file tree
Showing 22 changed files with 151 additions and 83 deletions.
2 changes: 1 addition & 1 deletion build/rollup.ie.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default {
}),

license({
banner: `IE6+,有问题请加QQ 370262116 by 司徒正美 Copyright ${JSON.stringify(
banner: `Maintained by YMFE Copyright ${JSON.stringify(
new Date()
).replace(/T.*|"/g,"")}`
}),
Expand Down
2 changes: 1 addition & 1 deletion build/rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default {
}),

license({
banner: `by 司徒正美 Copyright ${JSON.stringify(new Date()).replace(/T.*|"/g,"")}
banner: `Maintained by YMFE Copyright ${JSON.stringify(new Date()).replace(/T.*|"/g,"")}
IE9+
`
}),
Expand Down
2 changes: 1 addition & 1 deletion build/rollup.selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default {
}),

license({
banner: `此版本带有selection by 司徒正美 Copyright ${JSON.stringify(new Date()).replace(/T.*|"/g,"")}
banner: `Maintained by YMFE Copyright ${JSON.stringify(new Date()).replace(/T.*|"/g,"")}
IE9+
`
}),
Expand Down
8 changes: 3 additions & 5 deletions build/rollup.shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ export default {
}),

license({
banner: `此版本要求浏览器没有createClass, createFactory, PropTypes, isValidElement,
unmountComponentAtNode,unstable_renderSubtreeIntoContainer
QQ 370262116 by 司徒正美 Copyright ${JSON.stringify(
new Date()
).replace(/T.*|"/g, "")}`
banner: `Maintained by YMFE Copyright ${JSON.stringify(
new Date()
).replace(/T.*|"/g, "")}`
}),

replace({
Expand Down
9 changes: 0 additions & 9 deletions build/shim.script.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ var str2 = fs.readFileSync(dir2, "utf-8");
var text2 = str2.replace(/Object\.freeze/g, "extend").replace(/\/\/freeze_start([\s\S]+?)freeze_end/, "");

fs.writeFileSync(dir2, text2, { encoding: "utf8" });
// fs.writeFileSync( path.join(__dirname, "../../antd-test/node_modules/qreact/dist/React.js"), text2, { encoding: "utf8" });
// fs.writeFileSync( path.join(__dirname, "../../react-study/node_modules/anujs/dist/React.js"), text2, { encoding: "utf8" });

// fs.writeFileSync( path.join(__dirname, "../../antd-test/other/React.js"), text2, { encoding: "utf8" });

// fs.writeFileSync( path.join(__dirname, "../../yo-demo/node_modules/anujs/dist/React.js"), text2, { encoding: "utf8" });
// fs.writeFileSync( path.join(__dirname, "../../ani/node_modules/anujs/dist/React.js"), text2, { encoding: "utf8" });

console.log("对React瘦身完毕"); // eslint-disable-line

Expand All @@ -33,9 +26,7 @@ console.log("对ReactIE瘦身完毕"); // eslint-disable-line
var dir4 = path.join(__dirname, "../dist/ReactSelection.js");
var str4 = fs.readFileSync(dir4, "utf-8");
var text4 = str4.replace(/Object\.freeze/g, "extend").replace(/\/\/freeze_start([\s\S]+?)freeze_end/, "");
// fs.writeFileSync(path.join(__dirname, "../../antd-test/node_modules/qreact/dist/ReactSelection.js"), text4, { encoding: "utf8" });

fs.writeFileSync(dir4, text4, { encoding: "utf8" });
// fs.writeFileSync( path.join(__dirname, "../../antd-test/node_modules/anujs/dist/ReactSelection.js"), text2, { encoding: "utf8" });

console.log("对ReactSelection瘦身完毕"); // eslint-disable-line
9 changes: 5 additions & 4 deletions dist/React.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* by 司徒正美 Copyright 2018-01-23
* Maintained by YMFE Copyright 2018-01-26
* IE9+
*/

Expand Down Expand Up @@ -411,7 +411,7 @@ function operateChildren(children, prefix, callback, parent) {
return;
}
}
if (Object(children) === children && !children.type) {
if (Object(children) === children && !children.call && !children.type) {
throw "children中存在非法的对象";
}
callback(children, prefix || ".", parent);
Expand Down Expand Up @@ -2749,7 +2749,8 @@ function render(vnode, container, callback) {
//[Top API] ReactDOM.unstable_renderSubtreeIntoContainer
function unstable_renderSubtreeIntoContainer(lastVnode, nextVnode, container, callback) {
deprecatedWarn("unstable_renderSubtreeIntoContainer");
var parentContext = lastVnode && lastVnode.context || {};
var updater = lastVnode && lastVnode.updater;
var parentContext = updater ? updater.parentContext : {};
return renderByAnu(nextVnode, container, callback, parentContext);
}
//[Top API] ReactDOM.unmountComponentAtNode
Expand Down Expand Up @@ -3080,7 +3081,7 @@ if (win.React && win.React.options) {
React = win.React; //解决引入多个
} else {
React = win.React = win.ReactDOM = {
version: "2.0.0",
version: "2.0.1",
render: render,
hydrate: render,
options: options,
Expand Down
2 changes: 1 addition & 1 deletion dist/React.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ReactDOMServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ function operateChildren(children, prefix, callback, parent) {
return;
}
}
if (Object(children) === children && !children.type) {
if (Object(children) === children && !children.call && !children.type) {
throw "children中存在非法的对象";
}
callback(children, prefix || ".", parent);
Expand Down
2 changes: 1 addition & 1 deletion dist/ReactDOMServer.min.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions dist/ReactIE.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* IE6+,有问题请加QQ 370262116 by 司徒正美 Copyright 2018-01-23
* Maintained by YMFE Copyright 2018-01-26
*/

(function (global, factory) {
Expand Down Expand Up @@ -410,7 +410,7 @@ function operateChildren(children, prefix, callback, parent) {
return;
}
}
if (Object(children) === children && !children.type) {
if (Object(children) === children && !children.call && !children.type) {
throw "children中存在非法的对象";
}
callback(children, prefix || ".", parent);
Expand Down Expand Up @@ -2748,7 +2748,8 @@ function render(vnode, container, callback) {
//[Top API] ReactDOM.unstable_renderSubtreeIntoContainer
function unstable_renderSubtreeIntoContainer(lastVnode, nextVnode, container, callback) {
deprecatedWarn("unstable_renderSubtreeIntoContainer");
var parentContext = lastVnode && lastVnode.context || {};
var updater = lastVnode && lastVnode.updater;
var parentContext = updater ? updater.parentContext : {};
return renderByAnu(nextVnode, container, callback, parentContext);
}
//[Top API] ReactDOM.unmountComponentAtNode
Expand Down Expand Up @@ -3197,6 +3198,7 @@ if (msie < 9) {
function needFix(fn) {
return !/native code/.test(fn);
}

function keysPolyfill() {
//解决IE下Object.keys的性能问题
if (needFix(Object.keys)) {
Expand All @@ -3220,7 +3222,7 @@ if (win.React && win.React.options) {
React = win.React;
} else {
React = win.React = win.ReactDOM = {
version: "2.0.0",
version: "2.0.1",
render: render,
hydrate: render,
Fragment: REACT_FRAGMENT_TYPE,
Expand Down
2 changes: 1 addition & 1 deletion dist/ReactIE.min.js

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions dist/ReactSelection.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* 此版本带有selection by 司徒正美 Copyright 2018-01-23
* Maintained by YMFE Copyright 2018-01-26
* IE9+
*/

Expand Down Expand Up @@ -411,7 +411,7 @@ function operateChildren(children, prefix, callback, parent) {
return;
}
}
if (Object(children) === children && !children.type) {
if (Object(children) === children && !children.call && !children.type) {
throw "children中存在非法的对象";
}
callback(children, prefix || ".", parent);
Expand Down Expand Up @@ -2749,7 +2749,8 @@ function render(vnode, container, callback) {
//[Top API] ReactDOM.unstable_renderSubtreeIntoContainer
function unstable_renderSubtreeIntoContainer(lastVnode, nextVnode, container, callback) {
deprecatedWarn("unstable_renderSubtreeIntoContainer");
var parentContext = lastVnode && lastVnode.context || {};
var updater = lastVnode && lastVnode.updater;
var parentContext = updater ? updater.parentContext : {};
return renderByAnu(nextVnode, container, callback, parentContext);
}
//[Top API] ReactDOM.unmountComponentAtNode
Expand Down Expand Up @@ -3076,7 +3077,7 @@ function diffChildren(lastChildren, nextChildren, parentVnode, parentContext, up
Refs.diffChildren = diffChildren;

var React = {
version: "2.0.0",
version: "2.0.1",
render: render,
hydrate: render,
options: options,
Expand Down
2 changes: 1 addition & 1 deletion dist/ReactSelection.min.js

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions dist/ReactShim.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* 此版本要求浏览器没有createClass, createFactory, PropTypes, isValidElement,
* unmountComponentAtNode,unstable_renderSubtreeIntoContainer
* QQ 370262116 by 司徒正美 Copyright 2018-01-23
* Maintained by YMFE Copyright 2018-01-26
*/

(function (global, factory) {
Expand Down Expand Up @@ -451,7 +449,7 @@ function operateChildren(children, prefix, callback, parent) {
return;
}
}
if (Object(children) === children && !children.type) {
if (Object(children) === children && !children.call && !children.type) {
throw "children中存在非法的对象";
}
callback(children, prefix || ".", parent);
Expand Down Expand Up @@ -2920,7 +2918,7 @@ if (win.React && win.React.options) {
React = win.React;
} else {
React = win.React = win.ReactDOM = {
version: "2.0.0",
version: "2.0.1",
render: render,
hydrate: render,
Fragment: REACT_FRAGMENT_TYPE,
Expand Down
2 changes: 1 addition & 1 deletion dist/ReactShim.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qreact",
"version": "2.0.0",
"version": "2.0.1",
"description": "a mini React-like framework",
"main": "dist/React.js",
"scripts": {
Expand Down
53 changes: 40 additions & 13 deletions src/React.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,42 @@
import { options, REACT_FRAGMENT_TYPE } from "./util";
import { Children } from "./Children";
import {
options,
REACT_FRAGMENT_TYPE
} from "./util";
import {
Children
} from "./Children";
import * as eventSystem from "./event";
import { PropTypes } from "./PropTypes";
import { Component } from "./Component";
import { win as window } from "./browser";
import { createClass } from "./createClass";
import { cloneElement } from "./cloneElement";
import { PureComponent } from "./PureComponent";
import { createElement } from "./createElement";
import { createPortal } from "./createPortal";
import { render, findDOMNode, isValidElement, unmountComponentAtNode, unstable_renderSubtreeIntoContainer } from "./diff";
import {
PropTypes
} from "./PropTypes";
import {
Component
} from "./Component";
import {
win as window
} from "./browser";
import {
createClass
} from "./createClass";
import {
cloneElement
} from "./cloneElement";
import {
PureComponent
} from "./PureComponent";
import {
createElement
} from "./createElement";
import {
createPortal
} from "./createPortal";
import {
render,
findDOMNode,
isValidElement,
unmountComponentAtNode,
unstable_renderSubtreeIntoContainer
} from "./diff";

var React;
if (window.React && window.React.options) {
Expand All @@ -35,11 +62,11 @@ if (window.React && window.React.options) {
unmountComponentAtNode,
unstable_renderSubtreeIntoContainer,
createFactory(type) {
console.warn("createFactory is deprecated"); // eslint-disable-line
console.warn("createFactory is deprecated"); // eslint-disable-line
var factory = createElement.bind(null, type);
factory.type = type;
return factory;
}
};
}
export default React;
export default React;
56 changes: 43 additions & 13 deletions src/ReactIE.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,51 @@
import { options, REACT_FRAGMENT_TYPE, hasOwnProperty } from "./util";
import { Children } from "./Children";
import {
options,
REACT_FRAGMENT_TYPE,
hasOwnProperty
} from "./util";
import {
Children
} from "./Children";
import * as eventSystem from "./event";
import { PropTypes } from "./PropTypes";
import { Component } from "./Component";
import { win as window } from "./browser";
import { createClass } from "./createClass";
import { cloneElement } from "./cloneElement";
import { PureComponent } from "./PureComponent";
import { createElement } from "./createElement";
import { createPortal } from "./createPortal";
import {
PropTypes
} from "./PropTypes";
import {
Component
} from "./Component";
import {
win as window
} from "./browser";
import {
createClass
} from "./createClass";
import {
cloneElement
} from "./cloneElement";
import {
PureComponent
} from "./PureComponent";
import {
createElement
} from "./createElement";
import {
createPortal
} from "./createPortal";

import { render, findDOMNode, isValidElement, unmountComponentAtNode, unstable_renderSubtreeIntoContainer } from "./diff";
import {
render,
findDOMNode,
isValidElement,
unmountComponentAtNode,
unstable_renderSubtreeIntoContainer
} from "./diff";

import "./compat";

function needFix(fn) {
return !/native code/.test(fn);
}

function keysPolyfill() {
//解决IE下Object.keys的性能问题
if (needFix(Object.keys)) {
Expand Down Expand Up @@ -59,11 +89,11 @@ if (window.React && window.React.options) {
unstable_renderSubtreeIntoContainer,

createFactory(type) {
console.warn("createFactory is deprecated"); // eslint-disable-line
console.warn("createFactory is deprecated"); // eslint-disable-line
var factory = createElement.bind(null, type);
factory.type = type;
return factory;
}
};
}
export default React;
export default React;
Loading

0 comments on commit 94a8f1e

Please sign in to comment.