javivelasco / react-css-themr

Easy theming and composition for CSS Modules.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm build diverges from repository

zverev opened this issue · comments

Hi!

I still have a problem with compiled sources (#29). Seems that npm's lib dir differs from the one I have after building the repo, so I have to npm link to get this work in IE :(

Here is my script to reproduce the issue:

#!/bin/bash

# clone the original repo and build
git clone git@github.com:javivelasco/react-css-themr.git
pushd react-css-themr
npm i
popd

# install package from npm to another directory
mkdir react-css-themr-npm
pushd react-css-themr-npm
echo {} > package.json
npm i react-css-themr
popd

# compare
diff react-css-themr-npm/node_modules/react-css-themr/lib/components/themr.js react-css-themr/lib/components/themr.js

And here is the output:

7,9c7
< var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
< 
< var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
---
> var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
12a11,12
> var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
> 
65c65
<   var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
---
>   var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
69,72c69,71
<     var _DEFAULT_OPTIONS$opti = _extends({}, DEFAULT_OPTIONS, options);
< 
<     var optionComposeTheme = _DEFAULT_OPTIONS$opti.composeTheme;
<     var optionWithRef = _DEFAULT_OPTIONS$opti.withRef;
---
>     var _DEFAULT_OPTIONS$opti = _extends({}, DEFAULT_OPTIONS, options),
>         optionComposeTheme = _DEFAULT_OPTIONS$opti.composeTheme,
>         optionWithRef = _DEFAULT_OPTIONS$opti.withRef;
94c93
<         var _Object$getPrototypeO;
---
>         var _ref;
102c101
<         var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(Themed)).call.apply(_Object$getPrototypeO, [this].concat(args)));
---
>         var _this = _possibleConstructorReturn(this, (_ref = Themed.__proto__ || Object.getPrototypeOf(Themed)).call.apply(_ref, [this].concat(args)));
118,119c117,118
<           var themeNamespace = props.themeNamespace;
<           var theme = props.theme;
---
>           var themeNamespace = props.themeNamespace,
>               theme = props.theme;
167,169d165
<           var _props = this.props;
<           var composeTheme = _props.composeTheme;
<           var themeNamespace = _props.themeNamespace;
171c167,170
<           var props = _objectWithoutProperties(_props, ['composeTheme', 'themeNamespace']); //eslint-disable-line no-unused-vars
---
>           var _props = this.props,
>               composeTheme = _props.composeTheme,
>               themeNamespace = _props.themeNamespace,
>               props = _objectWithoutProperties(_props, ['composeTheme', 'themeNamespace']); //eslint-disable-line no-unused-vars
215c214
<   var original = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
---
>   var original = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

Notice this line:
var _this = _possibleConstructorReturn(this, (_ref = Themed.__proto__ || Object.getPrototypeOf(Themed)).call.apply(_ref, [this].concat(args)));
It seems to be transpiled from super() call in Themed. The key thing is Themed.__proto__. Babel manually creates this property in it's inheritance method implementation for browsers that don't support Object.setPrototypeOf() so IE10 can only access parent Object from this property. Previous compiler version generates the following:
var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(Themed)).call.apply(_Object$getPrototypeO, [this].concat(args)));
This is what npm package contains.
In IE10 Object.getPrototypeOf() returns not we are expect and we have an error.

Please check the npm package. I don't actually understand why could it be diverged from the repo because package.json does have a prepublish script that seems to be correct.

That's weird, maybe a rebuild would fix it?

What actually do you recommend to rebuild?

Don't know WTH is going on. Just published a patch with the latest build and still diverges :S

commented

Something similar is happening to me too. My recent pull request that added typings is not working, as index.d.ts is not included in the npm published version; even though it is not in .gitignore or .npmignore.