Skip to content

Commit

Permalink
Revert "ensure a cache miss (styled-components#283)"
Browse files Browse the repository at this point in the history
This reverts commit b1dcfda.
  • Loading branch information
khmm12 committed Jul 30, 2020
1 parent ccc15c5 commit 107c26e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils/detectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const VALID_TOP_LEVEL_IMPORT_PATHS = [
'styled-components/native',
'styled-components/primitives',
]
const CACHE_MISS = Symbol('CACHE_MISS');

export const isValidTopLevelImport = x =>
VALID_TOP_LEVEL_IMPORT_PATHS.includes(x)
Expand All @@ -14,15 +13,15 @@ const localNameCache = {}
export const importLocalName = (name, state, bypassCache = false) => {
const cacheKey = name + state.file.opts.filename

if (!bypassCache && cacheKey in localNameCache && localNameCache[cacheKey] !== CACHE_MISS) {
if (!bypassCache && cacheKey in localNameCache) {
return localNameCache[cacheKey]
}

let localName = state.styledRequired
? name === 'default'
? 'styled'
: name
: CACHE_MISS
: false

state.file.path.traverse({
ImportDeclaration: {
Expand Down

0 comments on commit 107c26e

Please sign in to comment.