Skip to content

Commit 85f98e3

Browse files
author
Max Stoiber
committed
Add test case with commonjs plugin
1 parent 4846691 commit 85f98e3

File tree

5 files changed

+82
-2
lines changed

5 files changed

+82
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@babel/plugin-proposal-class-properties": "^7.0.0",
2121
"@babel/preset-env": "^7.0.0",
2222
"babel-core": "7.0.0-bridge.0",
23+
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
2324
"jest": "^23.6.0",
2425
"prettier": "^1.14.2",
2526
"rimraf": "^2.6.2",

test/__snapshots__/index.test.js.snap

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,31 @@ exports.default = _default;
715715
var _StyledDiv = (0, _styledComponents.default)(\\"div\\")(_templateObject());"
716716
`;
717717
718+
exports[`fixtures should transpile css prop add require 1`] = `
719+
"\\"use strict\\";
720+
721+
Object.defineProperty(exports, \\"__esModule\\", {
722+
value: true
723+
});
724+
725+
var _styledComponents = require(\\"styled-components\\");
726+
727+
var _styledComponents2 = _interopRequireDefault(_styledComponents);
728+
729+
var _react = require(\\"react\\");
730+
731+
var _react2 = _interopRequireDefault(_react);
732+
733+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
734+
735+
// @flow
736+
exports.default = () => <_StyledDiv />;
737+
738+
var _StyledDiv = (0, _styledComponents2.default)(\\"div\\")\`
739+
width: 35em;
740+
\`;"
741+
`;
742+
718743
exports[`fixtures should transpile require default 1`] = `
719744
"const styled_default = require(\\"styled-components\\");
720745
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"plugins": [
3+
"transform-es2015-modules-commonjs",
4+
[
5+
"../../../src",
6+
{
7+
"ssr": false,
8+
"displayName": false,
9+
"transpileTemplateLiterals": false,
10+
"minify": false,
11+
"cssProp": true
12+
}
13+
]
14+
]
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @flow
2+
import React from 'react'
3+
4+
export default () => (
5+
<div
6+
css={`
7+
width: 35em;
8+
`}
9+
/>
10+
)

yarn.lock

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,24 @@ babel-plugin-syntax-object-rest-spread@^6.13.0:
908908
version "6.13.0"
909909
resolved "http://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5"
910910

911+
babel-plugin-transform-es2015-modules-commonjs@^6.26.2:
912+
version "6.26.2"
913+
resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz#58a793863a9e7ca870bdc5a881117ffac27db6f3"
914+
integrity sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==
915+
dependencies:
916+
babel-plugin-transform-strict-mode "^6.24.1"
917+
babel-runtime "^6.26.0"
918+
babel-template "^6.26.0"
919+
babel-types "^6.26.0"
920+
921+
babel-plugin-transform-strict-mode@^6.24.1:
922+
version "6.24.1"
923+
resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758"
924+
integrity sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=
925+
dependencies:
926+
babel-runtime "^6.22.0"
927+
babel-types "^6.24.1"
928+
911929
babel-preset-jest@^23.2.0:
912930
version "23.2.0"
913931
resolved "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-23.2.0.tgz#8ec7a03a138f001a1a8fb1e8113652bf1a55da46"
@@ -932,7 +950,18 @@ babel-template@^6.16.0:
932950
babylon "^6.11.0"
933951
lodash "^4.2.0"
934952

935-
babel-traverse@^6.0.0:
953+
babel-template@^6.26.0:
954+
version "6.26.0"
955+
resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02"
956+
integrity sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=
957+
dependencies:
958+
babel-runtime "^6.26.0"
959+
babel-traverse "^6.26.0"
960+
babel-types "^6.26.0"
961+
babylon "^6.18.0"
962+
lodash "^4.17.4"
963+
964+
babel-traverse@^6.0.0, babel-traverse@^6.26.0:
936965
version "6.26.0"
937966
resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee"
938967
dependencies:
@@ -960,7 +989,7 @@ babel-traverse@^6.18.0, babel-traverse@^6.23.0:
960989
invariant "^2.2.0"
961990
lodash "^4.2.0"
962991

963-
babel-types@^6.0.0, babel-types@^6.18.0, babel-types@^6.23.0, babel-types@^6.26.0:
992+
babel-types@^6.0.0, babel-types@^6.18.0, babel-types@^6.23.0, babel-types@^6.24.1, babel-types@^6.26.0:
964993
version "6.26.0"
965994
resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497"
966995
dependencies:

0 commit comments

Comments
 (0)