Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dev hint about css object (generated by Babel) being stringified by accident #1569

Merged
merged 1 commit into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/green-worms-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'babel-plugin-emotion': patch
'@emotion/babel-preset-css-prop': patch
---

Add dev hint about css object (generated by Babel) being stringified by accident

Large diffs are not rendered by default.

101 changes: 81 additions & 20 deletions packages/babel-plugin-emotion/__tests__/__snapshots__/css.js.snap

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const SomeComponent = props => (

↓ ↓ ↓ ↓ ↓ ↓

function _EMOTION_STRINGIFIED_CSS_ERROR__() { return \\"You have tried to stringify object returned from \`css\` function. It isn't supposed to be used directly (e.g. as value of the \`className\` prop), but rather handed to emotion so it can handle it (e.g. as value of \`css\` prop).\\"; }

/** @jsx jsx */
import { jsx, css } from '@emotion/core';

Expand All @@ -25,7 +27,8 @@ var _ref = process.env.NODE_ENV === \\"production\\" ? {
} : {
name: \\"zszx19-SomeComponent\\",
styles: \\"color:hotpink;;label:SomeComponent;\\",
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvcmUtd2l0aC1jc3MtaW1wb3J0LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtZIiwiZmlsZSI6ImNvcmUtd2l0aC1jc3MtaW1wb3J0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqIEBqc3gganN4ICovXG5pbXBvcnQgeyBqc3gsIGNzcyB9IGZyb20gJ0BlbW90aW9uL2NvcmUnXG5cbmNvbnN0IFNvbWVDb21wb25lbnQgPSBwcm9wcyA9PiAoXG4gIDxkaXZcbiAgICBjc3M9e2Nzc2BcbiAgICAgIGNvbG9yOiBob3RwaW5rO1xuICAgIGB9XG4gICAgey4uLnByb3BzfVxuICAvPlxuKVxuIl19 */\\"
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvcmUtd2l0aC1jc3MtaW1wb3J0LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtZIiwiZmlsZSI6ImNvcmUtd2l0aC1jc3MtaW1wb3J0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqIEBqc3gganN4ICovXG5pbXBvcnQgeyBqc3gsIGNzcyB9IGZyb20gJ0BlbW90aW9uL2NvcmUnXG5cbmNvbnN0IFNvbWVDb21wb25lbnQgPSBwcm9wcyA9PiAoXG4gIDxkaXZcbiAgICBjc3M9e2Nzc2BcbiAgICAgIGNvbG9yOiBob3RwaW5rO1xuICAgIGB9XG4gICAgey4uLnByb3BzfVxuICAvPlxuKVxuIl19 */\\",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};

const SomeComponent = props => <div css={_ref} {...props} />;"
Expand Down Expand Up @@ -65,6 +68,8 @@ function Logo(props) {

↓ ↓ ↓ ↓ ↓ ↓

function _EMOTION_STRINGIFIED_CSS_ERROR__() { return \\"You have tried to stringify object returned from \`css\` function. It isn't supposed to be used directly (e.g. as value of the \`className\` prop), but rather handed to emotion so it can handle it (e.g. as value of \`css\` prop).\\"; }

// @flow
import * as React from 'react';
import { jsx } from '@emotion/core';
Expand All @@ -75,7 +80,8 @@ var _ref = process.env.NODE_ENV === \\"production\\" ? {
} : {
name: \\"1f6ttp4-Logo\\",
styles: \\"display:block;;label:Logo;\\",
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZ1bmN0aW9uLWRlY2xhcmF0aW9uLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9NIiwiZmlsZSI6ImZ1bmN0aW9uLWRlY2xhcmF0aW9uLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8gQGZsb3dcbmltcG9ydCAqIGFzIFJlYWN0IGZyb20gJ3JlYWN0J1xuaW1wb3J0IHsganN4IH0gZnJvbSAnQGVtb3Rpb24vY29yZSdcblxuZnVuY3Rpb24gTG9nbyhwcm9wcykge1xuICByZXR1cm4gKFxuICAgIDxhXG4gICAgICBjc3M9e3tcbiAgICAgICAgZGlzcGxheTogJ2Jsb2NrJ1xuICAgICAgfX1cbiAgICAvPlxuICApXG59XG4iXX0= */\\"
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZ1bmN0aW9uLWRlY2xhcmF0aW9uLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9NIiwiZmlsZSI6ImZ1bmN0aW9uLWRlY2xhcmF0aW9uLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8gQGZsb3dcbmltcG9ydCAqIGFzIFJlYWN0IGZyb20gJ3JlYWN0J1xuaW1wb3J0IHsganN4IH0gZnJvbSAnQGVtb3Rpb24vY29yZSdcblxuZnVuY3Rpb24gTG9nbyhwcm9wcykge1xuICByZXR1cm4gKFxuICAgIDxhXG4gICAgICBjc3M9e3tcbiAgICAgICAgZGlzcGxheTogJ2Jsb2NrJ1xuICAgICAgfX1cbiAgICAvPlxuICApXG59XG4iXX0= */\\",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};

function Logo(props) {
Expand Down Expand Up @@ -109,6 +115,8 @@ const SomeComponent = props => (

↓ ↓ ↓ ↓ ↓ ↓

function _EMOTION_STRINGIFIED_CSS_ERROR__() { return \\"You have tried to stringify object returned from \`css\` function. It isn't supposed to be used directly (e.g. as value of the \`className\` prop), but rather handed to emotion so it can handle it (e.g. as value of \`css\` prop).\\"; }

/** @jsx jsx */
import { jsx } from '@emotion/core';

Expand All @@ -118,7 +126,8 @@ var _ref = process.env.NODE_ENV === \\"production\\" ? {
} : {
name: \\"zszx19-SomeComponent\\",
styles: \\"color:hotpink;;label:SomeComponent;\\",
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImpzeC1ob2lzdC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLSSIsImZpbGUiOiJqc3gtaG9pc3QuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvKiogQGpzeCBqc3ggKi9cbmltcG9ydCB7IGpzeCB9IGZyb20gJ0BlbW90aW9uL2NvcmUnXG5cbmNvbnN0IFNvbWVDb21wb25lbnQgPSBwcm9wcyA9PiAoXG4gIDxkaXZcbiAgICBjc3M9e3tcbiAgICAgIGNvbG9yOiAnaG90cGluaydcbiAgICB9fVxuICAgIHsuLi5wcm9wc31cbiAgLz5cbilcbiJdfQ== */\\"
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImpzeC1ob2lzdC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLSSIsImZpbGUiOiJqc3gtaG9pc3QuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvKiogQGpzeCBqc3ggKi9cbmltcG9ydCB7IGpzeCB9IGZyb20gJ0BlbW90aW9uL2NvcmUnXG5cbmNvbnN0IFNvbWVDb21wb25lbnQgPSBwcm9wcyA9PiAoXG4gIDxkaXZcbiAgICBjc3M9e3tcbiAgICAgIGNvbG9yOiAnaG90cGluaydcbiAgICB9fVxuICAgIHsuLi5wcm9wc31cbiAgLz5cbilcbiJdfQ== */\\",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};

const SomeComponent = props => <div css={_ref} {...props} />;"
Expand All @@ -142,6 +151,9 @@ function Logo(props) {
↓ ↓ ↓ ↓ ↓ ↓

import _styled from \\"@emotion/styled-base\\";

function _EMOTION_STRINGIFIED_CSS_ERROR__() { return \\"You have tried to stringify object returned from \`css\` function. It isn't supposed to be used directly (e.g. as value of the \`className\` prop), but rather handed to emotion so it can handle it (e.g. as value of \`css\` prop).\\"; }

// @flow
import * as React from 'react';
import { jsx } from '@emotion/core';
Expand All @@ -155,7 +167,8 @@ const MyObject = {
} : {
name: \\"1lrxbo5\\",
styles: \\"color:hotpink;\\",
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9iamVjdC1wcm9wZXJ0eS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNYyIsImZpbGUiOiJvYmplY3QtcHJvcGVydHkuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBAZmxvd1xuaW1wb3J0ICogYXMgUmVhY3QgZnJvbSAncmVhY3QnXG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9jb3JlJ1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnXG5cbmNvbnN0IE15T2JqZWN0ID0ge1xuICBNeVByb3BlcnR5OiBzdHlsZWQuZGl2KHsgY29sb3I6ICdob3RwaW5rJyB9KVxufVxuXG5mdW5jdGlvbiBMb2dvKHByb3BzKSB7XG4gIHJldHVybiA8TXlPYmplY3QuTXlQcm9wZXJ0eSAvPlxufVxuIl19 */\\"
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9iamVjdC1wcm9wZXJ0eS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNYyIsImZpbGUiOiJvYmplY3QtcHJvcGVydHkuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBAZmxvd1xuaW1wb3J0ICogYXMgUmVhY3QgZnJvbSAncmVhY3QnXG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9jb3JlJ1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnXG5cbmNvbnN0IE15T2JqZWN0ID0ge1xuICBNeVByb3BlcnR5OiBzdHlsZWQuZGl2KHsgY29sb3I6ICdob3RwaW5rJyB9KVxufVxuXG5mdW5jdGlvbiBMb2dvKHByb3BzKSB7XG4gIHJldHVybiA8TXlPYmplY3QuTXlQcm9wZXJ0eSAvPlxufVxuIl19 */\\",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
})
};

Expand All @@ -181,6 +194,8 @@ const SomeComponent = props => (

↓ ↓ ↓ ↓ ↓ ↓

function _EMOTION_STRINGIFIED_CSS_ERROR__() { return \\"You have tried to stringify object returned from \`css\` function. It isn't supposed to be used directly (e.g. as value of the \`className\` prop), but rather handed to emotion so it can handle it (e.g. as value of \`css\` prop).\\"; }

/** @jsx jsx */
import { jsx } from '@emotion/core';

Expand All @@ -190,7 +205,8 @@ var _ref = process.env.NODE_ENV === \\"production\\" ? {
} : {
name: \\"dwt66v-SomeComponent\\",
styles: \\"color:hotpink;background-color:green;;label:SomeComponent;\\",
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0YXRpYy1vYmplY3Qtd2l0aC1jYW1lbC1jYXNlLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtJIiwiZmlsZSI6InN0YXRpYy1vYmplY3Qtd2l0aC1jYW1lbC1jYXNlLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqIEBqc3gganN4ICovXG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9jb3JlJ1xuXG5jb25zdCBTb21lQ29tcG9uZW50ID0gcHJvcHMgPT4gKFxuICA8ZGl2XG4gICAgY3NzPXt7XG4gICAgICBjb2xvcjogJ2hvdHBpbmsnLFxuICAgICAgYmFja2dyb3VuZENvbG9yOiAnZ3JlZW4nXG4gICAgfX1cbiAgICB7Li4ucHJvcHN9XG4gIC8+XG4pXG4iXX0= */\\"
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0YXRpYy1vYmplY3Qtd2l0aC1jYW1lbC1jYXNlLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtJIiwiZmlsZSI6InN0YXRpYy1vYmplY3Qtd2l0aC1jYW1lbC1jYXNlLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqIEBqc3gganN4ICovXG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9jb3JlJ1xuXG5jb25zdCBTb21lQ29tcG9uZW50ID0gcHJvcHMgPT4gKFxuICA8ZGl2XG4gICAgY3NzPXt7XG4gICAgICBjb2xvcjogJ2hvdHBpbmsnLFxuICAgICAgYmFja2dyb3VuZENvbG9yOiAnZ3JlZW4nXG4gICAgfX1cbiAgICB7Li4ucHJvcHN9XG4gIC8+XG4pXG4iXX0= */\\",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};

const SomeComponent = props => <div css={_ref} {...props} />;"
Expand Down Expand Up @@ -218,6 +234,8 @@ const SomeComponent = props => {

↓ ↓ ↓ ↓ ↓ ↓

function _EMOTION_STRINGIFIED_CSS_ERROR__() { return \\"You have tried to stringify object returned from \`css\` function. It isn't supposed to be used directly (e.g. as value of the \`className\` prop), but rather handed to emotion so it can handle it (e.g. as value of \`css\` prop).\\"; }

/** @jsx jsx */
import { jsx } from '@emotion/core';

Expand All @@ -227,7 +245,8 @@ var _ref = process.env.NODE_ENV === \\"production\\" ? {
} : {
name: \\"1vvht02-SomeComponent\\",
styles: \\"color:green;:hover{color:hotpink;};label:SomeComponent;\\",
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0YXRpYy1vYmplY3Qtd2l0aC1jaGlsZC1zZWxlY3RvcnMuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBT00iLCJmaWxlIjoic3RhdGljLW9iamVjdC13aXRoLWNoaWxkLXNlbGVjdG9ycy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuXG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9jb3JlJ1xuXG5jb25zdCBTb21lQ29tcG9uZW50ID0gcHJvcHMgPT4ge1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIGNzcz17e1xuICAgICAgICBjb2xvcjogJ2dyZWVuJyxcbiAgICAgICAgJzpob3Zlcic6IHtcbiAgICAgICAgICBjb2xvcjogJ2hvdHBpbmsnXG4gICAgICAgIH1cbiAgICAgIH19XG4gICAgICB7Li4ucHJvcHN9XG4gICAgLz5cbiAgKVxufVxuIl19 */\\"
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0YXRpYy1vYmplY3Qtd2l0aC1jaGlsZC1zZWxlY3RvcnMuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBT00iLCJmaWxlIjoic3RhdGljLW9iamVjdC13aXRoLWNoaWxkLXNlbGVjdG9ycy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuXG5pbXBvcnQgeyBqc3ggfSBmcm9tICdAZW1vdGlvbi9jb3JlJ1xuXG5jb25zdCBTb21lQ29tcG9uZW50ID0gcHJvcHMgPT4ge1xuICByZXR1cm4gKFxuICAgIDxkaXZcbiAgICAgIGNzcz17e1xuICAgICAgICBjb2xvcjogJ2dyZWVuJyxcbiAgICAgICAgJzpob3Zlcic6IHtcbiAgICAgICAgICBjb2xvcjogJ2hvdHBpbmsnXG4gICAgICAgIH1cbiAgICAgIH19XG4gICAgICB7Li4ucHJvcHN9XG4gICAgLz5cbiAgKVxufVxuIl19 */\\",
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
};

const SomeComponent = props => {
Expand Down
Loading