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

Remove emotion-utils and use packages from emotion-js/next #628

Merged
merged 8 commits into from
Apr 16, 2018
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
1 change: 0 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

[options]
suppress_comment=.*\\$FlowFixMe
module.name_mapper='^\(emotion-utils\)$' -> '<PROJECT_ROOT>/packages/\1/src'
module.name_mapper='^\(create-emotion\)$' -> '<PROJECT_ROOT>/packages/\1/src'
module.name_mapper='^\(create-emotion-styled\)$' -> '<PROJECT_ROOT>/packages/\1/src'
module.name_mapper='^\(react-emotion\)$' -> '<PROJECT_ROOT>/packages/\1/src'
Expand Down
4 changes: 3 additions & 1 deletion packages/babel-plugin-emotion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
},
"dependencies": {
"@babel/helper-module-imports": "7.0.0-beta.32",
"@emotion/hash": "^0.6.2",
"@emotion/memoize": "^0.6.1",
"@emotion/stylis": "^0.6.5",
"babel-plugin-macros": "^2.0.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"convert-source-map": "^1.5.0",
"emotion-utils": "^9.1.0",
"find-root": "^1.1.0",
"mkdirp": "^0.5.1",
"source-map": "^0.5.7",
Expand Down
4 changes: 3 additions & 1 deletion packages/babel-plugin-emotion/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import type {
Types,
Babel
} from 'babel-flow-types'
import { hashString, Stylis, memoize } from 'emotion-utils'
import hashString from '@emotion/hash'
import Stylis from '@emotion/stylis'
import memoize from '@emotion/memoize'
import { addSourceMaps } from './source-map'

import cssProps from './css-prop'
Expand Down
1 change: 0 additions & 1 deletion packages/create-emotion-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"clean": "rimraf lib"
},
"dependencies": {
"emotion-utils": "^9.1.0",
"html-tokenize": "^2.0.0",
"multipipe": "^1.0.2",
"through": "^2.3.8"
Expand Down
3 changes: 1 addition & 2 deletions packages/create-emotion-styled/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"watch": "rollup -c ../../rollup.config.js --watch"
},
"dependencies": {
"@emotion/is-prop-valid": "^0.6.1",
"emotion-utils": "^9.1.0"
"@emotion/is-prop-valid": "^0.6.1"
},
"peerDependencies": {
"prop-types": ">= 15"
Expand Down
7 changes: 4 additions & 3 deletions packages/create-emotion-styled/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// @flow
import { STYLES_KEY } from 'emotion-utils'
import type { Emotion, Interpolations } from 'create-emotion'
import { channel, contextTypes } from '../../emotion-theming/src/utils'
import type { ElementType } from 'react'
Expand Down Expand Up @@ -49,7 +48,9 @@ function createEmotionStyled(emotion: Emotion, view: ReactType) {
return function() {
let args = arguments
let styles =
isReal && tag[STYLES_KEY] !== undefined ? tag[STYLES_KEY].slice(0) : []
isReal && tag.__emotion_styles !== undefined
? tag.__emotion_styles.slice(0)
: []
if (identifierName !== undefined) {
styles.push(`label:${identifierName};`)
}
Expand Down Expand Up @@ -140,7 +141,7 @@ function createEmotionStyled(emotion: Emotion, view: ReactType) {
})`

Styled.contextTypes = contextTypes
Styled[STYLES_KEY] = styles
Styled.__emotion_styles = styles
Styled.__emotion_base = baseTag
Styled.__emotion_real = Styled
Object.defineProperty(Styled, 'toString', {
Expand Down
5 changes: 4 additions & 1 deletion packages/create-emotion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"watch": "rollup -c ../../rollup.config.js --watch"
},
"dependencies": {
"emotion-utils": "^9.1.0",
"@emotion/hash": "^0.6.2",
"@emotion/memoize": "^0.6.1",
"@emotion/stylis": "^0.6.5",
"@emotion/unitless": "^0.6.2",
"stylis": "^3.5.0",
"stylis-rule-sheet": "^0.0.10"
},
Expand Down
21 changes: 9 additions & 12 deletions packages/create-emotion/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow
import { hashString, Stylis, STYLES_KEY } from 'emotion-utils'
import hashString from '@emotion/hash'
import Stylis from '@emotion/stylis'
import stylisRuleSheet from 'stylis-rule-sheet'
import {
processStyleName,
Expand All @@ -8,7 +9,7 @@ import {
isBrowser
} from './utils'
import StyleSheet from './sheet'
import type { PrefixOption, StylisOptions, ClassNameArg } from './utils'
import type { PrefixOption, ClassNameArg } from './utils'

type StylisPlugins = Function[] | null | Function

Expand Down Expand Up @@ -85,15 +86,11 @@ function createEmotion(

const insertionPlugin = stylisRuleSheet(insertRule)

const stylisOptions: StylisOptions = {
keyframe: false,
global: false,
prefix: options.prefix === undefined ? true : options.prefix,
semicolon: true
}

if (process.env.NODE_ENV !== 'production') {
stylisOptions.compress = false
let stylisOptions
if (options.prefix !== undefined) {
stylisOptions = {
prefix: options.prefix
}
}

const caches = {
Expand Down Expand Up @@ -127,7 +124,7 @@ function createEmotion(
case 'boolean':
return ''
case 'function':
if (interpolation[STYLES_KEY] !== undefined) {
if (interpolation.__emotion_styles !== undefined) {
let selector = interpolation.toString()
if (
selector === 'NO_COMPONENT_SELECTOR' &&
Expand Down
13 changes: 2 additions & 11 deletions packages/create-emotion/src/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow
import { memoize, unitless } from 'emotion-utils'
import memoize from '@emotion/memoize'
import unitless from '@emotion/unitless'

const hyphenateRegex = /[A-Z]|^ms/g

Expand Down Expand Up @@ -76,13 +77,3 @@ export const isBrowser = typeof document !== 'undefined'
export type PrefixOption =
| boolean
| ((key: string, value: string, context: 1 | 2 | 3) => boolean)

export type StylisOptions = {
keyframe?: boolean,
compress?: boolean,
global?: boolean,
cascade?: boolean,
semicolon?: boolean,
preserve?: boolean,
prefix?: PrefixOption
}
40 changes: 0 additions & 40 deletions packages/emotion-utils/package.json

This file was deleted.

51 changes: 0 additions & 51 deletions packages/emotion-utils/src/hash.js

This file was deleted.

54 changes: 0 additions & 54 deletions packages/emotion-utils/src/index.js

This file was deleted.

Loading