Skip to content

Commit

Permalink
update yarn install guide, and expose fiber to RHL
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Dec 19, 2018
1 parent 73d30df commit eb365b4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ See https://github.com/parcel-bundler/parcel/pull/850
For any other build system, which may not support aliasing - use yarn name resolution.
See https://twitter.com/sebmck/status/873958247304232961?lang=en for details.
```text
yarn add @hot-loader/react-dom@npm:react-dom
yarn add react-dom@npm:@hot-loader/react-dom
```

# Using webpack-loader
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@hot-loader/react-dom",
"version": "16.7.0-alpha.2.2",
"version": "0.0.0",
"description": "The Hot version of React-DOM",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions patch/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let patchedFiles = [];
const copyFile = (source, dest) => {
const data = readFileSync(source).toString();
const patchedData = patch(data);
if (patchedData) {
if (patchedData !== data) {
patchedFiles.push(dest);
}
writeFileSync(dest, patchedData || data)
Expand Down Expand Up @@ -39,6 +39,6 @@ writeFileSync('../target/package.json', JSON.stringify(Object.assign(pkg, self),
console.log(patchedFiles);

if (patchedFiles.length !== 2) {
throw new Error('expected to patch 1 file');
throw new Error('expected to patch 2 file');
}

20 changes: 10 additions & 10 deletions patch/patch.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
const injectionStart = {
'16.6': [
'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.elementType === element.type)',
'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : hotCompareElements(child.elementType, element.type, updateChild(child)))'
'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : hotCompareElements(child.elementType, element.type, updateChild(child), child.type))'
],
'16.6-compact': [
'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:child.elementType===element.type)',
'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:hotCompareElements(child.elementType,element.type, updateChild(child)))'
'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:hotCompareElements(child.elementType,element.type, updateChild(child), child.type))'
],
'16.4': [
'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : child.type === element.type) {',
'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : hotCompareElements(child.type, element.type, updateChild(child))) {'
'if (child.tag === Fragment ? element.type === REACT_FRAGMENT_TYPE : hotCompareElements(child.type, element.type, updateChild(child), child.type)) {'
],
'16.4-compact': [
'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:child.type===element.type)',
'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:hotCompareElements(child.type,element.type, updateChild(child)))'
'if(child.tag===Fragment?element.type===REACT_FRAGMENT_TYPE:hotCompareElements(child.type,element.type, updateChild(child), child.type))'
],
};

const additional = {
'16.6-update': [
'if (current$$1 !== null && current$$1.elementType === element.type) {',
'if (current$$1 !== null && hotCompareElements(current$$1.elementType, element.type, updateChild(current$$1))) {'
'if (current$$1 !== null && hotCompareElements(current$$1.elementType, element.type, updateChild(current$$1),current$$1.type)) {'
],
'16.6-update-compact': [
'if(current$$1!==null&&current$$1.elementType===element.type)',
'if(current$$1!==null&&hotCompareElements(current$$1.elementType,element.type,updateChild(current$$1)))'
'if(current$$1!==null&&hotCompareElements(current$$1.elementType,element.type,updateChild(current$$1),current$$1.type))'
],
'16.4-update': [
'if (current !== null && current.type === element.type) {',
'if (current !== null && hotCompareElements(current.type, element.type, updateChild(current))) {'
'if (current !== null && hotCompareElements(current.type, element.type, updateChild(current),current.type)) {'
],
'16.4-update-compact': [
'if (current!== null&&current.type===element.type)',
Expand Down Expand Up @@ -72,7 +72,7 @@ const injectionEnd = {
'16.4-compact': defaultEndCompact,
};

const sign = '/** 🔥 this is hot-loader/react-dom 🔥 */';
const sign = '/* 🔥 this is hot-loader/react-dom 🔥 */';

function additionalTransform(source) {
for (const key in additional) {
Expand All @@ -84,7 +84,7 @@ function additionalTransform(source) {
function transform(source) {
if (source.indexOf('reconcileSingleElement') < 0) {
// early reject
return false;
return source;
}
for (const key in injectionStart) {
if (
Expand All @@ -99,7 +99,7 @@ function transform(source) {
return `${sign}\n${result}\n${sign}`;
}
}
return false;
return source;
}

module.exports = transform;
2 changes: 1 addition & 1 deletion source/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ See https://github.com/parcel-bundler/parcel/pull/850
For any other build system, which may not support aliasing - use yarn name resolution.
See https://twitter.com/sebmck/status/873958247304232961?lang=en for details.
```text
yarn add @hot-loader/react-dom@npm:react-dom
yarn add react-dom@npm:@hot-loader/react-dom
```

# Using webpack-loader
Expand Down
2 changes: 1 addition & 1 deletion source/package.base.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hot-loader/react-dom",
"version": "16.7.0-alpha.2.3",
"version": "16.7.0-alpha.2.4",
"description": "The Hot version of React-DOM",
"scripts": {
"build": "node build.js"
Expand Down

0 comments on commit eb365b4

Please sign in to comment.