Skip to content

Commit 391c366

Browse files
author
Osama Jandali
committed
revert InjectGlobal annotation
- Should not annotate InjectGlobal. - Remove InjectGlobal test fixture.
1 parent 43c03eb commit 391c366

File tree

4 files changed

+3
-35
lines changed

4 files changed

+3
-35
lines changed

src/visitors/uglifyPure.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
import annotateAsPure from "@babel/helper-annotate-as-pure"
22

33
import { useUglifyPure } from '../utils/options'
4-
import { isStyled, isHelper, isInjectGlobalHelper } from '../utils/detectors'
4+
import { isStyled, isHelper } from '../utils/detectors'
55

66
export default (path, state) => {
77
if(useUglifyPure(state)){
88
if(isStyled(path.node,state) ||
99
isStyled(path.node.callee,state) ||
10-
isHelper(path.node.callee,state) ||
11-
isInjectGlobalHelper(path.node.callee,state)
10+
isHelper(path.node.callee,state)
1211
){
1312
if(path.parent.type == 'VariableDeclarator' ||
14-
path.parent.type == 'TaggedTemplateExpression' ||
15-
path.parent.type =='ExpressionStatement'
13+
path.parent.type == 'TaggedTemplateExpression'
1614
){
1715
annotateAsPure(path)
1816
}

test/__snapshots__/index.test.js.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ const DoubleInterpolation = /*#__PURE__*/styled.div.withConfig({
117117
})([[\"{margin:\", props => props.vert, \" \", props => props.hori, \";}\"]]);"
118118
`;
119119
120-
exports[`fixtures should annotate inject global with uglify pure comments 1`] = `"/*#__PURE__*/injectGlobal([[\"\", glob, \"\\n/*! preserve comment */html,body{margin:100000px;padding:\", test, \";}@media (max-width:999px){html,body{margin:0;}}.root{width:100%;}\"]]);"`;
121-
122120
exports[`fixtures should annotate keyframes with uglify pure comments 1`] = `"const Animation = /*#__PURE__*/keyframes([[\"@-webkit-keyframes \"], [\"{0%{opacity:0;}100%{opacity:1;}}@keyframes \"], [\"{0%{opacity:0;}100%{opacity:1;}}\"]]);"`;
123121
124122
exports[`fixtures should annotate styled calls with uglify pure comments 1`] = `

test/fixtures/23-annotate-inject-global-with-uglify-pure-comments/.babelrc

Lines changed: 0 additions & 8 deletions
This file was deleted.

test/fixtures/23-annotate-inject-global-with-uglify-pure-comments/before.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)