From e91cac6715455fbb2b125c843e17902055ac6ae5 Mon Sep 17 00:00:00 2001 From: mitchellhamilton Date: Sat, 14 Apr 2018 20:00:55 +1000 Subject: [PATCH 1/7] Change stylis options used in insertion tests to the options used by emotion to ensure no regressions when changing to @emotion/stylis --- .../test/__snapshots__/insertion.test.js.snap | 8 ++++---- packages/emotion/test/insertion.test.js | 13 +++++++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/emotion/test/__snapshots__/insertion.test.js.snap b/packages/emotion/test/__snapshots__/insertion.test.js.snap index 54d2dabb8..827f87a38 100644 --- a/packages/emotion/test/__snapshots__/insertion.test.js.snap +++ b/packages/emotion/test/__snapshots__/insertion.test.js.snap @@ -104,7 +104,7 @@ Array [ ".css-37 .List :global(*) :global(+) :global(*){margin-top:10px;}", ".css-37 .List :global(> *){margin-top:10px;}", ".css-37 .List :global(* + *){margin-top:10px;}", - ".foo #bar > baz{color:red;}", + ".css-37 :global(.foo #bar > baz){color:red;}", ".css-37 div :global(.react-select .some-child-of-react-select){color:red;}", ".css-37 .root > :global(*):not(header){color:red;}", ".css-37 a:matches( a +b foo:hover :global(marquee) a) > :hover{color:red;}", @@ -114,7 +114,7 @@ Array [ exports[`cascade isolation nesting 1`] = ` Array [ ".css-39{color:red;}", - "section{color:red;}", + ".css-39 h1 :global(section){color:red;}", ".css-39 h1 h2{color:red;}", ".css-39 div h1,.css-39 span h1{color:red;}", ".css-39 span:hover{color:red;}", @@ -253,8 +253,8 @@ Array [ exports[`nested 1`] = ` Array [ - "div h2{color:red;}", - "div h2 h3{color:blue;}", + ".css-28 :global(div) h2{color:red;}", + ".css-28 :global(div) h2 h3{color:blue;}", ".foo .css-28{width:1px;}", ".foo .css-28:hover{color:black;}", ".foo .css-28 li{color:white;}", diff --git a/packages/emotion/test/insertion.test.js b/packages/emotion/test/insertion.test.js index a18d309c6..7adc0c5c3 100644 --- a/packages/emotion/test/insertion.test.js +++ b/packages/emotion/test/insertion.test.js @@ -227,8 +227,17 @@ const specs = [ } ] -let stylis = new Stylis({ keyframe: false }) -let regularStylis = new Stylis({ keyframe: false }) +let stylisOptions = { + global: false, + preserve: false, + keyframe: false, + semicolon: true, + cascade: true +} + + +let stylis = new Stylis(stylisOptions) +let regularStylis = new Stylis(stylisOptions) specs.forEach((spec, i) => { const newTest = spec.only ? test.only : spec.skip ? test.skip : test From ce3f25e5774d936e9b37849720b6ea58be5eeb32 Mon Sep 17 00:00:00 2001 From: mitchellhamilton Date: Sat, 14 Apr 2018 20:01:46 +1000 Subject: [PATCH 2/7] Prettier --- packages/emotion/test/insertion.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/emotion/test/insertion.test.js b/packages/emotion/test/insertion.test.js index 7adc0c5c3..a4eddf98e 100644 --- a/packages/emotion/test/insertion.test.js +++ b/packages/emotion/test/insertion.test.js @@ -235,7 +235,6 @@ let stylisOptions = { cascade: true } - let stylis = new Stylis(stylisOptions) let regularStylis = new Stylis(stylisOptions) From 40f8983af87bae287f9e79d7053f33478e43b44b Mon Sep 17 00:00:00 2001 From: mitchellhamilton Date: Sat, 14 Apr 2018 20:19:35 +1000 Subject: [PATCH 3/7] Remove usage of emotion-utils --- .flowconfig | 1 - packages/babel-plugin-emotion/package.json | 4 +- packages/babel-plugin-emotion/src/index.js | 4 +- packages/create-emotion-server/package.json | 1 - packages/create-emotion-styled/package.json | 3 +- packages/create-emotion-styled/src/index.js | 7 +- packages/create-emotion/package.json | 5 +- packages/create-emotion/src/index.js | 5 +- packages/create-emotion/src/utils.js | 3 +- packages/emotion-utils/package.json | 40 - packages/emotion-utils/src/hash.js | 51 -- packages/emotion-utils/src/index.js | 54 -- packages/emotion-utils/src/stylis.js | 896 -------------------- packages/site/package.json | 1 - yarn.lock | 35 +- 15 files changed, 32 insertions(+), 1078 deletions(-) delete mode 100644 packages/emotion-utils/package.json delete mode 100644 packages/emotion-utils/src/hash.js delete mode 100644 packages/emotion-utils/src/index.js delete mode 100644 packages/emotion-utils/src/stylis.js diff --git a/.flowconfig b/.flowconfig index 9306582fe..ed0d5b38f 100644 --- a/.flowconfig +++ b/.flowconfig @@ -12,7 +12,6 @@ [options] suppress_comment=.*\\$FlowFixMe -module.name_mapper='^\(emotion-utils\)$' -> '/packages/\1/src' module.name_mapper='^\(create-emotion\)$' -> '/packages/\1/src' module.name_mapper='^\(create-emotion-styled\)$' -> '/packages/\1/src' module.name_mapper='^\(react-emotion\)$' -> '/packages/\1/src' diff --git a/packages/babel-plugin-emotion/package.json b/packages/babel-plugin-emotion/package.json index 9454f1b14..73e618807 100644 --- a/packages/babel-plugin-emotion/package.json +++ b/packages/babel-plugin-emotion/package.json @@ -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.2", "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", diff --git a/packages/babel-plugin-emotion/src/index.js b/packages/babel-plugin-emotion/src/index.js index b2e1ab8a9..6d0472040 100644 --- a/packages/babel-plugin-emotion/src/index.js +++ b/packages/babel-plugin-emotion/src/index.js @@ -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' diff --git a/packages/create-emotion-server/package.json b/packages/create-emotion-server/package.json index 5bacd8927..ce9d5f6fe 100644 --- a/packages/create-emotion-server/package.json +++ b/packages/create-emotion-server/package.json @@ -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" diff --git a/packages/create-emotion-styled/package.json b/packages/create-emotion-styled/package.json index 99c3a2a84..822ce26c5 100644 --- a/packages/create-emotion-styled/package.json +++ b/packages/create-emotion-styled/package.json @@ -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" diff --git a/packages/create-emotion-styled/src/index.js b/packages/create-emotion-styled/src/index.js index 478dc5394..7b48c79dd 100644 --- a/packages/create-emotion-styled/src/index.js +++ b/packages/create-emotion-styled/src/index.js @@ -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' @@ -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};`) } @@ -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', { diff --git a/packages/create-emotion/package.json b/packages/create-emotion/package.json index 847a7cba4..82997702f 100644 --- a/packages/create-emotion/package.json +++ b/packages/create-emotion/package.json @@ -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.2", + "@emotion/unitless": "^0.6.2", "stylis": "^3.5.0", "stylis-rule-sheet": "^0.0.10" }, diff --git a/packages/create-emotion/src/index.js b/packages/create-emotion/src/index.js index 9910ddd20..2268286d7 100644 --- a/packages/create-emotion/src/index.js +++ b/packages/create-emotion/src/index.js @@ -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, @@ -127,7 +128,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' && diff --git a/packages/create-emotion/src/utils.js b/packages/create-emotion/src/utils.js index a9b46a2f3..82fb5a27a 100644 --- a/packages/create-emotion/src/utils.js +++ b/packages/create-emotion/src/utils.js @@ -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 diff --git a/packages/emotion-utils/package.json b/packages/emotion-utils/package.json deleted file mode 100644 index 26105415b..000000000 --- a/packages/emotion-utils/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "emotion-utils", - "version": "9.1.0", - "description": "Shared utilities used by emotion, The Next Generation of CSS-in-JS.", - "main": "dist/index.cjs.js", - "module": "dist/index.es.js", - "files": [ - "src", - "dist" - ], - "scripts": { - "build": "npm-run-all clean rollup", - "clean": "rimraf dist", - "watch": "rollup -c ../../rollup.config.js --watch", - "rollup": "rollup -c ../../rollup.config.js" - }, - "author": "Kye Hohenberger", - "homepage": "https://emotion.sh", - "license": "MIT", - "repository": "https://github.com/emotion-js/emotion/tree/master/packages/emotion-utils", - "keywords": [ - "styles", - "emotion", - "react", - "css", - "css-in-js" - ], - "bugs": { - "url": "https://github.com/emotion-js/emotion/issues" - }, - "dependencies": { - "@emotion/memoize": "^0.6.1" - }, - "devDependencies": { - "babel-plugin-emotion": "^8.0.2-7", - "npm-run-all": "^4.0.2", - "rimraf": "^2.6.1", - "rollup": "^0.51.3" - } -} diff --git a/packages/emotion-utils/src/hash.js b/packages/emotion-utils/src/hash.js deleted file mode 100644 index 2a88b77ee..000000000 --- a/packages/emotion-utils/src/hash.js +++ /dev/null @@ -1,51 +0,0 @@ -// @flow -/* eslint-disable */ -// murmurhash2 via https://github.com/garycourt/murmurhash-js/blob/master/murmurhash2_gc.js - -export function hashString(str: string) { - return murmurhash2_32_gc(str, str.length).toString(36) -} - -function murmurhash2_32_gc(str: string, seed: number) { - var l = str.length, - h = seed ^ l, - i = 0, - k - - while (l >= 4) { - k = - (str.charCodeAt(i) & 0xff) | - ((str.charCodeAt(++i) & 0xff) << 8) | - ((str.charCodeAt(++i) & 0xff) << 16) | - ((str.charCodeAt(++i) & 0xff) << 24) - - k = (k & 0xffff) * 0x5bd1e995 + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16) - k ^= k >>> 24 - k = (k & 0xffff) * 0x5bd1e995 + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16) - - h = - ((h & 0xffff) * 0x5bd1e995 + - ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^ - k - - l -= 4 - ++i - } - - switch (l) { - case 3: - h ^= (str.charCodeAt(i + 2) & 0xff) << 16 - case 2: - h ^= (str.charCodeAt(i + 1) & 0xff) << 8 - case 1: - h ^= str.charCodeAt(i) & 0xff - h = - (h & 0xffff) * 0x5bd1e995 + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16) - } - - h ^= h >>> 13 - h = (h & 0xffff) * 0x5bd1e995 + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16) - h ^= h >>> 15 - - return h >>> 0 -} diff --git a/packages/emotion-utils/src/index.js b/packages/emotion-utils/src/index.js deleted file mode 100644 index d7abc4674..000000000 --- a/packages/emotion-utils/src/index.js +++ /dev/null @@ -1,54 +0,0 @@ -// @flow - -export { default as memoize } from '@emotion/memoize' - -export const STYLES_KEY = '__emotion_styles' - -export const unitless: { [string]: 1 } = { - animationIterationCount: 1, - borderImageOutset: 1, - borderImageSlice: 1, - borderImageWidth: 1, - boxFlex: 1, - boxFlexGroup: 1, - boxOrdinalGroup: 1, - columnCount: 1, - columns: 1, - flex: 1, - flexGrow: 1, - flexPositive: 1, - flexShrink: 1, - flexNegative: 1, - flexOrder: 1, - gridRow: 1, - gridRowEnd: 1, - gridRowSpan: 1, - gridRowStart: 1, - gridColumn: 1, - gridColumnEnd: 1, - gridColumnSpan: 1, - gridColumnStart: 1, - fontWeight: 1, - lineHeight: 1, - opacity: 1, - order: 1, - orphans: 1, - tabSize: 1, - widows: 1, - zIndex: 1, - zoom: 1, - WebkitLineClamp: 1, - - // SVG-related properties - fillOpacity: 1, - floodOpacity: 1, - stopOpacity: 1, - strokeDasharray: 1, - strokeDashoffset: 1, - strokeMiterlimit: 1, - strokeOpacity: 1, - strokeWidth: 1 -} - -export { hashString } from './hash' -export { default as Stylis } from './stylis' diff --git a/packages/emotion-utils/src/stylis.js b/packages/emotion-utils/src/stylis.js deleted file mode 100644 index b722bd537..000000000 --- a/packages/emotion-utils/src/stylis.js +++ /dev/null @@ -1,896 +0,0 @@ -var pa = function fa(ha) { - function V(f, d, c, l, a) { - for ( - var g = 0, - b = 0, - n = 0, - e = 0, - k, - r, - m, - v = 0, - B = 0, - C = 0, - x = 0, - D = 0, - p = 0, - H = 0, - q = 0, - O = (r = 0), - M = 0, - t = 0, - y = c.length, - G = y - 1, - h = '', - u = '', - F = '', - N = '', - I; - q < y; - - ) { - m = c.charCodeAt(q) - q === G && - 0 !== b + e + n + g && - (0 !== b && (m = 47 === b ? 10 : 47), (e = n = g = 0), y++, G++) - if (0 === b + e + n + g) { - if (q === G && (0 < r && (h = h.replace(Q, '')), 0 < h.trim().length)) { - switch (m) { - case 32: - case 9: - case 59: - case 13: - case 10: - break - default: - h += c.charAt(q) - } - m = 59 - } - if (1 === O) - switch (m) { - case 123: - case 125: - case 59: - case 34: - case 39: - case 40: - case 41: - case 44: - O = 0 - case 9: - case 13: - case 10: - case 32: - break - default: - for (O = 0, t = q, k = m, q--, m = 59; t < y; ) - switch (c.charCodeAt(t++)) { - case 10: - case 13: - case 59: - ++q - m = k - t = y - break - case 58: - 0 < r && (++q, (m = k)) - case 123: - t = y - } - } - switch (m) { - case 123: - h = h.trim() - k = h.charCodeAt(0) - x = 1 - for (t = ++q; q < y; ) { - m = c.charCodeAt(q) - switch (m) { - case 123: - x++ - break - case 125: - x-- - } - if (0 === x) break - q++ - } - p = c.substring(t, q) - 0 === k && (k = (h = h.replace(qa, '').trim()).charCodeAt(0)) - switch (k) { - case 64: - 0 < r && (h = h.replace(Q, '')) - r = h.charCodeAt(1) - switch (r) { - case 100: - case 109: - case 115: - case 45: - k = d - break - default: - k = W - } - p = V(d, k, p, r, a + 1) - t = p.length - 0 < X && 0 === t && (t = h.length) - 0 < E && - ((k = ia(W, h, M)), - (I = P(3, p, k, d, J, z, t, r, a, l)), - (h = k.join('')), - void 0 !== I && - 0 === (t = (p = I.trim()).length) && - ((r = 0), (p = ''))) - if (0 < t) - switch (r) { - case 115: - h = h.replace(ra, sa) - case 100: - case 109: - case 45: - p = h + '{' + p + '}' - break - case 107: - h = h.replace(ta, '$1 $2' + (0 < R ? T : '')) - p = h + '{' + p + '}' - p = - 1 === w || (2 === w && U('@' + p, 3)) - ? '@-webkit-' + p + '@' + p - : '@' + p - break - default: - ;(p = h + p), 112 === l && (p = ((u += p), '')) - } - else p = '' - break - default: - p = V(d, ia(d, h, M), p, l, a + 1) - } - F += p - p = M = r = H = O = D = 0 - h = '' - m = c.charCodeAt(++q) - break - case 125: - case 59: - h = (0 < r ? h.replace(Q, '') : h).trim() - if (1 < (t = h.length)) - switch ((0 === H && - ((k = h.charCodeAt(0)), 45 === k || (96 < k && 123 > k)) && - (t = (h = h.replace(' ', ':')).length), - 0 < E && - void 0 !== (I = P(1, h, d, f, J, z, u.length, l, a, l)) && - 0 === (t = (h = I.trim()).length) && - (h = '\x00\x00'), - (k = h.charCodeAt(0)), - (r = h.charCodeAt(1)), - k + r)) { - case 0: - break - case 169: - case 163: - N += h + c.charAt(q) - break - default: - 58 !== h.charCodeAt(t - 1) && - (u += Y(h, k, r, h.charCodeAt(2))) - } - M = r = H = O = D = 0 - h = '' - m = c.charCodeAt(++q) - } - } - switch (m) { - case 13: - case 10: - if (0 === b + e + n + g + ja) - switch (C) { - case 41: - case 39: - case 34: - case 64: - case 126: - case 62: - case 42: - case 43: - case 47: - case 45: - case 58: - case 44: - case 59: - case 123: - case 125: - break - default: - 0 < H && (O = 1) - } - 47 === b ? (b = 0) : 0 === A + D && ((r = 1), (h += '\x00')) - 0 < E * ka && P(0, h, d, f, J, z, u.length, l, a, l) - z = 1 - J++ - break - case 59: - case 125: - if (0 === b + e + n + g) { - z++ - break - } - default: - z++ - k = c.charAt(q) - switch (m) { - case 9: - case 32: - if (0 === e + g + b) - switch (v) { - case 44: - case 58: - case 9: - case 32: - k = '' - break - default: - 32 !== m && (k = ' ') - } - break - case 0: - k = '\\0' - break - case 12: - k = '\\f' - break - case 11: - k = '\\v' - break - case 38: - 0 === e + b + g && 0 < A && ((r = M = 1), (k = '\f' + k)) - break - case 108: - if (0 === e + b + g + K && 0 < H) - switch (q - H) { - case 2: - 112 === v && 58 === c.charCodeAt(q - 3) && (K = v) - case 8: - 111 === B && (K = B) - } - break - case 58: - 0 === e + b + g && (H = q) - break - case 44: - 0 === b + n + e + g && ((r = 1), (k += '\r')) - break - case 34: - 0 === b && (e = e === m ? 0 : 0 === e ? m : e) - break - case 39: - 0 === b && (e = e === m ? 0 : 0 === e ? m : e) - break - case 91: - 0 === e + b + n && g++ - break - case 93: - 0 === e + b + n && g-- - break - case 41: - 0 === e + b + g && n-- - break - case 40: - if (0 === e + b + g) { - if (0 === D) - switch (2 * v + 3 * B) { - case 533: - break - default: - ;(x = 0), (D = 1) - } - n++ - } - break - case 64: - 0 === b + n + e + g + H + p && (p = 1) - break - case 42: - case 47: - if (!(0 < e + g + n)) - switch (b) { - case 0: - switch (2 * m + 3 * c.charCodeAt(q + 1)) { - case 235: - b = 47 - break - case 220: - ;(t = q), (b = 42) - } - break - case 42: - 47 === m && - 42 === v && - (33 === c.charCodeAt(t + 2) && - (u += c.substring(t, q + 1)), - (k = ''), - (b = 0)) - } - } - if (0 === b) { - if (0 === A + e + g + p && 107 !== l && 59 !== m) - switch (m) { - case 44: - case 126: - case 62: - case 43: - case 41: - case 40: - if (0 === D) { - switch (v) { - case 9: - case 32: - case 10: - case 13: - k += '\x00' - break - default: - k = '\x00' + k + (44 === m ? '' : '\x00') - } - r = 1 - } else - switch (m) { - case 40: - D = ++x - break - case 41: - 0 === (D = --x) && ((r = 1), (k += '\x00')) - } - break - case 9: - case 32: - switch (v) { - case 0: - case 123: - case 125: - case 59: - case 44: - case 12: - case 9: - case 32: - case 10: - case 13: - break - default: - 0 === D && ((r = 1), (k += '\x00')) - } - } - h += k - 32 !== m && 9 !== m && (C = m) - } - } - B = v - v = m - q++ - } - t = u.length - 0 < X && - 0 === t && - 0 === F.length && - (0 === d[0].length) === !1 && - (109 !== l || (1 === d.length && (0 < A ? L : S) === d[0])) && - (t = d.join(',').length + 2) - if (0 < t) { - if (0 === A && 107 !== l) { - c = 0 - g = d.length - for (b = Array(g); c < g; ++c) { - v = d[c].split(ua) - B = '' - C = 0 - for (y = v.length; C < y; ++C) - if (!(0 === (x = (e = v[C]).length) && 1 < y)) { - q = B.charCodeAt(B.length - 1) - M = e.charCodeAt(0) - n = '' - if (0 !== C) - switch (q) { - case 42: - case 126: - case 62: - case 43: - case 32: - case 40: - break - default: - n = ' ' - } - switch (M) { - case 38: - e = n + L - case 126: - case 62: - case 43: - case 32: - case 41: - case 40: - break - case 91: - e = n + e + L - break - case 58: - switch (2 * e.charCodeAt(1) + 3 * e.charCodeAt(2)) { - case 530: - if (0 < Z) { - e = n + e.substring(8, x - 1) - break - } - default: - if (1 > C || 1 > v[C - 1].length) e = n + L + e - } - break - case 44: - n = '' - default: - e = - 1 < x && 0 < e.indexOf(':') - ? n + e.replace(va, '$1' + L + '$2') - : n + e + L - } - B += e - } - b[c] = B.replace(Q, '').trim() - } - d = b - } - k = d - if ( - 0 < E && - ((I = P(2, u, k, f, J, z, t, l, a, l)), - void 0 !== I && 0 === (u = I).length) - ) - return N + u + F - u = k.join(',') + '{' + u + '}' - if (0 !== w * K) { - 2 !== w || U(u, 2) || (K = 0) - switch (K) { - case 111: - u = u.replace(wa, ':-moz-$1') + u - break - case 112: - u = - u.replace(aa, '::-webkit-input-$1') + - u.replace(aa, '::-moz-$1') + - u.replace(aa, ':-ms-input-$1') + - u - } - K = 0 - } - } - return N + u + F - } - function ia(f, d, c) { - var l = d.trim().split(xa) - d = l - var a = l.length, - g = f.length - switch (g) { - case 0: - case 1: - var b = 0 - for (f = 0 === g ? '' : f[0] + ' '; b < a; ++b) - d[b] = la(f, d[b], c, g).trim() - break - default: - var n = (b = 0) - for (d = []; b < a; ++b) - for (var e = 0; e < g; ++e) d[n++] = la(f[e] + ' ', l[b], c, g).trim() - } - return d - } - function la(f, d, c, l) { - var a = d.charCodeAt(0) - 33 > a && (a = (d = d.trim()).charCodeAt(0)) - switch (a) { - case 38: - switch (A + l) { - case 0: - case 1: - if (0 === f.trim().length) break - default: - return d.replace(F, '$1' + f.trim()) - } - break - case 58: - switch (d.charCodeAt(1)) { - case 103: - if (0 < Z && 0 < A) return d.replace(ya, '$1').replace(F, '$1' + S) - break - default: - return f.trim() + d.replace(F, '$1' + f.trim()) - } - default: - if (0 < c * A && 0 < d.indexOf('\f')) - return d.replace(F, (58 === f.charCodeAt(0) ? '' : '$1') + f.trim()) - } - return f + d - } - function Y(f, d, c, l) { - var a = f + ';', - g = 2 * d + 3 * c + 4 * l - if (944 === g) { - f = a.length - var b = a.indexOf(':', 9) + 1 - d = a.substring(0, b).trim() - c = a.substring(b, f - 1).trim() - switch (a.charCodeAt(9) * R) { - case 0: - break - case 45: - if (110 !== a.charCodeAt(10)) break - default: - for ( - a = c.split(((c = ''), za)), b = l = 0, f = a.length; - l < f; - b = 0, ++l - ) { - g = a[l] - for (var n = g.split(Aa); (g = n[b]); ) { - var e = g.charCodeAt(0) - if ( - 1 === R && - ((64 < e && 90 > e) || - (96 < e && 123 > e) || - 95 === e || - (45 === e && 45 !== g.charCodeAt(1))) - ) - switch (isNaN(parseFloat(g)) + (-1 !== g.indexOf('('))) { - case 1: - switch (g) { - case 'infinite': - case 'alternate': - case 'backwards': - case 'running': - case 'normal': - case 'forwards': - case 'both': - case 'none': - case 'linear': - case 'ease': - case 'ease-in': - case 'ease-out': - case 'ease-in-out': - case 'paused': - case 'reverse': - case 'alternate-reverse': - case 'inherit': - case 'initial': - case 'unset': - case 'step-start': - case 'step-end': - break - default: - g += T - } - } - n[b++] = g - } - c += (0 === l ? '' : ',') + n.join(' ') - } - } - c = d + c + ';' - return 1 === w || (2 === w && U(c, 1)) ? '-webkit-' + c + c : c - } - if (0 === w || (2 === w && !U(a, 1))) return a - switch (g) { - case 1015: - return 97 === a.charCodeAt(10) ? '-webkit-' + a + a : a - case 951: - return 116 === a.charCodeAt(3) ? '-webkit-' + a + a : a - case 963: - return 110 === a.charCodeAt(5) ? '-webkit-' + a + a : a - case 1009: - if (100 !== a.charCodeAt(4)) break - case 969: - case 942: - return '-webkit-' + a + a - case 978: - return '-webkit-' + a + '-moz-' + a + a - case 1019: - case 983: - return '-webkit-' + a + '-moz-' + a + '-ms-' + a + a - case 883: - return 45 === a.charCodeAt(8) ? '-webkit-' + a + a : a - case 932: - if (45 === a.charCodeAt(4)) - switch (a.charCodeAt(5)) { - case 103: - return ( - '-webkit-box-' + - a.replace('-grow', '') + - '-webkit-' + - a + - '-ms-' + - a.replace('grow', 'positive') + - a - ) - case 115: - return ( - '-webkit-' + a + '-ms-' + a.replace('shrink', 'negative') + a - ) - case 98: - return ( - '-webkit-' + - a + - '-ms-' + - a.replace('basis', 'preferred-size') + - a - ) - } - return '-webkit-' + a + '-ms-' + a + a - case 964: - return '-webkit-' + a + '-ms-flex-' + a + a - case 1023: - if (99 !== a.charCodeAt(8)) break - b = a - .substring(a.indexOf(':', 15)) - .replace('flex-', '') - .replace('space-between', 'justify') - return '-webkit-box-pack' + b + '-webkit-' + a + '-ms-flex-pack' + b + a - case 1005: - return Ba.test(a) - ? a.replace(ma, ':-webkit-') + a.replace(ma, ':-moz-') + a - : a - case 1e3: - b = a.substring(13).trim() - d = b.indexOf('-') + 1 - switch (b.charCodeAt(0) + b.charCodeAt(d)) { - case 226: - b = a.replace(N, 'tb') - break - case 232: - b = a.replace(N, 'tb-rl') - break - case 220: - b = a.replace(N, 'lr') - break - default: - return a - } - return '-webkit-' + a + '-ms-' + b + a - case 1017: - if (-1 === a.indexOf('sticky', 9)) break - case 975: - d = (a = f).length - 10 - b = (33 === a.charCodeAt(d) ? a.substring(0, d) : a) - .substring(f.indexOf(':', 7) + 1) - .trim() - switch ((g = b.charCodeAt(0) + (b.charCodeAt(7) | 0))) { - case 203: - if (111 > b.charCodeAt(8)) break - case 115: - a = a.replace(b, '-webkit-' + b) + ';' + a - break - case 207: - case 102: - a = - a.replace(b, '-webkit-' + (102 < g ? 'inline-' : '') + 'box') + - ';' + - a.replace(b, '-webkit-' + b) + - ';' + - a.replace(b, '-ms-' + b + 'box') + - ';' + - a - } - return a + ';' - case 938: - if (45 === a.charCodeAt(5)) - switch (a.charCodeAt(6)) { - case 105: - return ( - (b = a.replace('-items', '')), - '-webkit-' + a + '-webkit-box-' + b + '-ms-flex-' + b + a - ) - case 115: - return '-webkit-' + a + '-ms-flex-item-' + a.replace(na, '') + a - default: - return ( - '-webkit-' + - a + - '-ms-flex-line-pack' + - a.replace('align-content', '').replace(na, '') + - a - ) - } - break - case 973: - case 989: - if (45 !== a.charCodeAt(3) || 122 === a.charCodeAt(4)) break - case 931: - case 953: - if (!0 === Ca.test(f)) - return 115 === (b = f.substring(f.indexOf(':') + 1)).charCodeAt(0) - ? Y(f.replace('stretch', 'fill-available'), d, c, l).replace( - ':fill-available', - ':stretch' - ) - : a.replace(b, '-webkit-' + b) + - a.replace(b, '-moz-' + b.replace('fill-', '')) + - a - break - case 962: - if ( - ((a = - '-webkit-' + a + (102 === a.charCodeAt(5) ? '-ms-' + a : '') + a), - 211 === c + l && - 105 === a.charCodeAt(13) && - 0 < a.indexOf('transform', 10)) - ) - return ( - a.substring(0, a.indexOf(';', 27) + 1).replace(Da, '$1-webkit-$2') + - a - ) - } - return a - } - function U(f, d) { - var c = f.indexOf(1 === d ? ':' : '{'), - l = f.substring(0, 3 !== d ? c : 10) - c = f.substring(c + 1, f.length - 1) - return ba(2 !== d ? l : l.replace(Ea, '$1'), c, d) - } - function sa(f, d) { - var c = Y(d, d.charCodeAt(0), d.charCodeAt(1), d.charCodeAt(2)) - return c !== d + ';' - ? c.replace(Fa, ' or ($1)').substring(4) - : '(' + d + ')' - } - function P(f, d, c, l, a, g, b, n, e, k) { - for (var r = 0, m = d, v; r < E; ++r) - switch ((v = ca[r].call(G, f, m, c, l, a, g, b, n, e, k))) { - case void 0: - case !1: - case !0: - case null: - break - default: - m = v - } - switch (m) { - case void 0: - case !1: - case !0: - case null: - case d: - break - default: - return m - } - } - function da(f) { - switch (f) { - case void 0: - case null: - E = ca.length = 0 - break - default: - switch (f.constructor) { - case Array: - for (var d = 0, c = f.length; d < c; ++d) da(f[d]) - break - case Function: - ca[E++] = f - break - case Boolean: - ka = !!f | 0 - } - } - return da - } - function ea(f) { - for (var d in f) { - var c = f[d] - switch (d) { - case 'keyframe': - R = c | 0 - break - case 'global': - Z = c | 0 - break - case 'cascade': - A = c | 0 - break - case 'compress': - oa = c | 0 - break - case 'semicolon': - ja = c | 0 - break - case 'preserve': - X = c | 0 - break - case 'prefix': - ;(ba = null), - c - ? 'function' !== typeof c ? (w = 1) : ((w = 2), (ba = c)) - : (w = 0) - } - } - return ea - } - function G(f, d) { - if (void 0 !== this && this.constructor === G) return fa(f) - var c = f, - l = c.charCodeAt(0) - 33 > l && (l = (c = c.trim()).charCodeAt(0)) - 0 < R && (T = c.replace(Ga, 91 === l ? '' : '-')) - l = 1 - 1 === A ? (S = c) : (L = c) - c = [S] - if (0 < E) { - var a = P(-1, d, c, c, J, z, 0, 0, 0, 0) - void 0 !== a && 'string' === typeof a && (d = a) - } - var g = V(W, c, d, 0, 0) - 0 < E && - ((a = P(-2, g, c, c, J, z, g.length, 0, 0, 0)), - void 0 !== a && 'string' !== typeof (g = a) && (l = 0)) - L = S = T = '' - K = 0 - z = J = 1 - return 0 === oa * l - ? g - : g - .replace(Q, '') - .replace(Ha, '') - .replace(Ia, '$1') - .replace(Ja, '$1') - .replace(Ka, ' ') - } - var qa = /^\0+/g, - Q = /[\0\r\f]/g, - ma = /: */g, - Ba = /zoo|gra/, - Da = /([,: ])(transform)/g, - za = /,+\s*(?![^(]*[)])/g, - Aa = / +\s*(?![^(]*[)])/g, - ua = / *[\0] */g, - xa = /,\r+?/g, - F = /([\t\r\n ])*\f?&/g, - ya = /:global\(((?:[^\(\)\[\]]*|\[.*\]|\([^\(\)]*\))*)\)/g, - Ga = /\W+/g, - ta = /@(k\w+)\s*(\S*)\s*/, - aa = /::(place)/g, - wa = /:(read-only)/g, - Ha = /\s+(?=[{\];=:>])/g, - Ia = /([[}=:>])\s+/g, - Ja = /(\{[^{]+?);(?=\})/g, - Ka = /\s{2,}/g, - va = /([^\(])(:+) */g, - N = /[svh]\w+-[tblr]{2}/, - ra = /\(\s*(.*)\s*\)/g, - Fa = /([\s\S]*?);/g, - na = /-self|flex-/g, - Ea = /[^]*?(:[rp][el]a[\w-]+)[^]*/, - Ca = /stretch|:\s*\w+\-(?:conte|avail)/, - z = 1, - J = 1, - K = 0, - A = 1, - w = 1, - Z = 1, - oa = 0, - ja = 0, - X = 0, - W = [], - ca = [], - E = 0, - ba = null, - ka = 0, - R = 1, - T = '', - L = '', - S = '' - G.use = da - G.set = ea - void 0 !== ha && ea(ha) - return G -} - -export default pa diff --git a/packages/site/package.json b/packages/site/package.json index 5ed170ffe..b53b76642 100644 --- a/packages/site/package.json +++ b/packages/site/package.json @@ -10,7 +10,6 @@ "dom-iterator": "^0.3.0", "emotion": "^9.1.1", "emotion-server": "^9.1.1", - "emotion-utils": "^9.1.0", "facepaint": "^1.1.2", "gatsby": "^1.9.149", "gatsby-image": "^1.0.31", diff --git a/yarn.lock b/yarn.lock index 5f1a6570d..5f223298e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -659,6 +659,10 @@ unist-util-remove-position "^1.1.1" xtend "^4.0.1" +"@emotion/hash@^0.6.2": + version "0.6.2" + resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.6.2.tgz#4cfe6b57e251aa7f254750ddac7c449ff99c476f" + "@emotion/is-prop-valid@^0.6.1": version "0.6.1" resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-0.6.1.tgz#98a255ac341064ddcf0d84f823b45ae9fb228f91" @@ -669,6 +673,14 @@ version "0.6.1" resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.6.1.tgz#b2de5184e49f518b7115a5e6d0e727643ec531cf" +"@emotion/stylis@^0.6.2": + version "0.6.2" + resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.6.2.tgz#7236eabd043cde98abdd8218840dbc3c73e9eefc" + +"@emotion/unitless@^0.6.2": + version "0.6.2" + resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.6.2.tgz#19a39bda906e5ba45f39f6f7f3512b2740ceab29" + "@types/node@*": version "8.0.49" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.49.tgz#417f86ab4829c629fe561779ee48751e0fe2a11b" @@ -1392,12 +1404,6 @@ babel-macros@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/babel-macros/-/babel-macros-1.0.2.tgz#04475889990243cc58a0afb5ea3308ec6b89e797" -babel-macros@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/babel-macros/-/babel-macros-1.2.0.tgz#39e47ed6d286d4a98f1948d8bab45dac17e4e2d4" - dependencies: - cosmiconfig "3.1.0" - babel-messages@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" @@ -1428,19 +1434,6 @@ babel-plugin-codegen@^1.2.0: babel-template "^6.26.0" require-from-string "^1.2.1" -babel-plugin-emotion@^8.0.2-7: - version "8.0.12" - resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-8.0.12.tgz#2ed844001416b0ae2ff787a06b1804ec5f531c89" - dependencies: - "@babel/helper-module-imports" "7.0.0-beta.32" - babel-macros "^1.2.0" - babel-plugin-syntax-jsx "^6.18.0" - convert-source-map "^1.5.0" - emotion-utils "^8.0.12" - find-root "^1.1.0" - source-map "^0.5.7" - touch "^1.0.0" - babel-plugin-external-helpers@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-external-helpers/-/babel-plugin-external-helpers-6.22.0.tgz#2285f48b02bd5dede85175caf8c62e86adccefa1" @@ -4367,10 +4360,6 @@ emotion-theming@^8.0.2-11: dependencies: hoist-non-react-statics "^2.3.1" -emotion-utils@^8.0.12: - version "8.0.12" - resolved "https://registry.yarnpkg.com/emotion-utils/-/emotion-utils-8.0.12.tgz#5e0fd72db3008f26ce4f80b1972df08841df2168" - encodeurl@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.1.tgz#79e3d58655346909fe6f0f45a5de68103b294d20" From 06a16f667f6facac3cb8d4f05dcb24451708418b Mon Sep 17 00:00:00 2001 From: mitchellhamilton Date: Sat, 14 Apr 2018 20:20:52 +1000 Subject: [PATCH 4/7] Remove unused options for stylis and fix stylis usage in a test --- packages/create-emotion/src/index.js | 5 +---- packages/emotion/test/insertion.test.js | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/create-emotion/src/index.js b/packages/create-emotion/src/index.js index 2268286d7..1592c7969 100644 --- a/packages/create-emotion/src/index.js +++ b/packages/create-emotion/src/index.js @@ -87,10 +87,7 @@ function createEmotion( const insertionPlugin = stylisRuleSheet(insertRule) const stylisOptions: StylisOptions = { - keyframe: false, - global: false, - prefix: options.prefix === undefined ? true : options.prefix, - semicolon: true + prefix: options.prefix === undefined ? true : options.prefix } if (process.env.NODE_ENV !== 'production') { diff --git a/packages/emotion/test/insertion.test.js b/packages/emotion/test/insertion.test.js index a4eddf98e..8181f960a 100644 --- a/packages/emotion/test/insertion.test.js +++ b/packages/emotion/test/insertion.test.js @@ -1,5 +1,5 @@ // @flow -import { Stylis } from 'emotion-utils' +import Stylis from '@emotion/stylis' import stylisRuleSheet from 'stylis-rule-sheet' const specs = [ From b0f524a226ac4df04340e29b5adecd40b1ebc876 Mon Sep 17 00:00:00 2001 From: mitchellhamilton Date: Sat, 14 Apr 2018 23:16:36 +1000 Subject: [PATCH 5/7] Update @emotion/stylis so it's even smaller! --- packages/babel-plugin-emotion/package.json | 2 +- packages/create-emotion/package.json | 2 +- yarn.lock | 37 +++++++++++++++++++--- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/packages/babel-plugin-emotion/package.json b/packages/babel-plugin-emotion/package.json index 73e618807..2c8ea9c2b 100644 --- a/packages/babel-plugin-emotion/package.json +++ b/packages/babel-plugin-emotion/package.json @@ -17,7 +17,7 @@ "@babel/helper-module-imports": "7.0.0-beta.32", "@emotion/hash": "^0.6.2", "@emotion/memoize": "^0.6.1", - "@emotion/stylis": "^0.6.2", + "@emotion/stylis": "^0.6.3", "babel-plugin-macros": "^2.0.0", "babel-plugin-syntax-jsx": "^6.18.0", "convert-source-map": "^1.5.0", diff --git a/packages/create-emotion/package.json b/packages/create-emotion/package.json index 82997702f..3e512f050 100644 --- a/packages/create-emotion/package.json +++ b/packages/create-emotion/package.json @@ -18,7 +18,7 @@ "dependencies": { "@emotion/hash": "^0.6.2", "@emotion/memoize": "^0.6.1", - "@emotion/stylis": "^0.6.2", + "@emotion/stylis": "^0.6.3", "@emotion/unitless": "^0.6.2", "stylis": "^3.5.0", "stylis-rule-sheet": "^0.0.10" diff --git a/yarn.lock b/yarn.lock index 5f223298e..74380c0bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -673,9 +673,9 @@ version "0.6.1" resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.6.1.tgz#b2de5184e49f518b7115a5e6d0e727643ec531cf" -"@emotion/stylis@^0.6.2": - version "0.6.2" - resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.6.2.tgz#7236eabd043cde98abdd8218840dbc3c73e9eefc" +"@emotion/stylis@^0.6.3": + version "0.6.3" + resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.6.3.tgz#4ad87410fbf79f3bc50b3c73e61d17a02604cf7f" "@emotion/unitless@^0.6.2": version "0.6.2" @@ -3541,6 +3541,14 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" +create-react-class@^15.6.0: + version "15.6.3" + resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.3.tgz#2d73237fb3f970ae6ebe011a9e66f46dbca80036" + dependencies: + fbjs "^0.8.9" + loose-envify "^1.3.1" + object-assign "^4.1.1" + cross-env@^3.1.1: version "3.2.4" resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-3.2.4.tgz#9e0585f277864ed421ce756f81a980ff0d698aba" @@ -11214,7 +11222,16 @@ react-dev-utils@^4.2.1: strip-ansi "3.0.1" text-table "0.2.0" -react-dom@^15.6.0, react-dom@^16.0.0, react-dom@^16.2.0: +react-dom@^15.6.0: + version "15.6.2" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.6.2.tgz#41cfadf693b757faf2708443a1d1fd5a02bef730" + dependencies: + fbjs "^0.8.9" + loose-envify "^1.1.0" + object-assign "^4.1.0" + prop-types "^15.5.10" + +react-dom@^16.0.0, react-dom@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.2.0.tgz#69003178601c0ca19b709b33a83369fe6124c044" dependencies: @@ -11328,7 +11345,17 @@ react-test-renderer@^16.2.0: object-assign "^4.1.1" prop-types "^15.6.0" -react@^15.6.0, react@^16.0.0, react@^16.2.0: +react@^15.6.0: + version "15.6.2" + resolved "https://registry.yarnpkg.com/react/-/react-15.6.2.tgz#dba0434ab439cfe82f108f0f511663908179aa72" + dependencies: + create-react-class "^15.6.0" + fbjs "^0.8.9" + loose-envify "^1.1.0" + object-assign "^4.1.0" + prop-types "^15.5.10" + +react@^16.0.0, react@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/react/-/react-16.2.0.tgz#a31bd2dab89bff65d42134fa187f24d054c273ba" dependencies: From fb69a15ff439ba8a9d89a3eddf85e76344afce82 Mon Sep 17 00:00:00 2001 From: mitchellhamilton Date: Sun, 15 Apr 2018 08:34:50 +1000 Subject: [PATCH 6/7] Update @emotion/stylis so it's even smaller!! --- packages/babel-plugin-emotion/package.json | 2 +- packages/create-emotion/package.json | 2 +- yarn.lock | 37 +++------------------- 3 files changed, 7 insertions(+), 34 deletions(-) diff --git a/packages/babel-plugin-emotion/package.json b/packages/babel-plugin-emotion/package.json index 2c8ea9c2b..69b330fb6 100644 --- a/packages/babel-plugin-emotion/package.json +++ b/packages/babel-plugin-emotion/package.json @@ -17,7 +17,7 @@ "@babel/helper-module-imports": "7.0.0-beta.32", "@emotion/hash": "^0.6.2", "@emotion/memoize": "^0.6.1", - "@emotion/stylis": "^0.6.3", + "@emotion/stylis": "^0.6.4", "babel-plugin-macros": "^2.0.0", "babel-plugin-syntax-jsx": "^6.18.0", "convert-source-map": "^1.5.0", diff --git a/packages/create-emotion/package.json b/packages/create-emotion/package.json index 3e512f050..5d0d9a2fc 100644 --- a/packages/create-emotion/package.json +++ b/packages/create-emotion/package.json @@ -18,7 +18,7 @@ "dependencies": { "@emotion/hash": "^0.6.2", "@emotion/memoize": "^0.6.1", - "@emotion/stylis": "^0.6.3", + "@emotion/stylis": "^0.6.4", "@emotion/unitless": "^0.6.2", "stylis": "^3.5.0", "stylis-rule-sheet": "^0.0.10" diff --git a/yarn.lock b/yarn.lock index 74380c0bf..dfdc46018 100644 --- a/yarn.lock +++ b/yarn.lock @@ -673,9 +673,9 @@ version "0.6.1" resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.6.1.tgz#b2de5184e49f518b7115a5e6d0e727643ec531cf" -"@emotion/stylis@^0.6.3": - version "0.6.3" - resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.6.3.tgz#4ad87410fbf79f3bc50b3c73e61d17a02604cf7f" +"@emotion/stylis@^0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.6.4.tgz#ad7dee926df2704745c38bc559b66682f25e711a" "@emotion/unitless@^0.6.2": version "0.6.2" @@ -3541,14 +3541,6 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" -create-react-class@^15.6.0: - version "15.6.3" - resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.6.3.tgz#2d73237fb3f970ae6ebe011a9e66f46dbca80036" - dependencies: - fbjs "^0.8.9" - loose-envify "^1.3.1" - object-assign "^4.1.1" - cross-env@^3.1.1: version "3.2.4" resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-3.2.4.tgz#9e0585f277864ed421ce756f81a980ff0d698aba" @@ -11222,16 +11214,7 @@ react-dev-utils@^4.2.1: strip-ansi "3.0.1" text-table "0.2.0" -react-dom@^15.6.0: - version "15.6.2" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.6.2.tgz#41cfadf693b757faf2708443a1d1fd5a02bef730" - dependencies: - fbjs "^0.8.9" - loose-envify "^1.1.0" - object-assign "^4.1.0" - prop-types "^15.5.10" - -react-dom@^16.0.0, react-dom@^16.2.0: +react-dom@^15.6.0, react-dom@^16.0.0, react-dom@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.2.0.tgz#69003178601c0ca19b709b33a83369fe6124c044" dependencies: @@ -11345,17 +11328,7 @@ react-test-renderer@^16.2.0: object-assign "^4.1.1" prop-types "^15.6.0" -react@^15.6.0: - version "15.6.2" - resolved "https://registry.yarnpkg.com/react/-/react-15.6.2.tgz#dba0434ab439cfe82f108f0f511663908179aa72" - dependencies: - create-react-class "^15.6.0" - fbjs "^0.8.9" - loose-envify "^1.1.0" - object-assign "^4.1.0" - prop-types "^15.5.10" - -react@^16.0.0, react@^16.2.0: +react@^15.6.0, react@^16.0.0, react@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/react/-/react-16.2.0.tgz#a31bd2dab89bff65d42134fa187f24d054c273ba" dependencies: From ecb6ea17b8cd1d2134efe2872be9e33168681e13 Mon Sep 17 00:00:00 2001 From: mitchellhamilton Date: Sun, 15 Apr 2018 10:43:03 +1000 Subject: [PATCH 7/7] Update @emotion/stylis --- packages/babel-plugin-emotion/package.json | 2 +- packages/create-emotion/package.json | 2 +- packages/create-emotion/src/index.js | 13 ++++++------- packages/create-emotion/src/utils.js | 10 ---------- yarn.lock | 6 +++--- 5 files changed, 11 insertions(+), 22 deletions(-) diff --git a/packages/babel-plugin-emotion/package.json b/packages/babel-plugin-emotion/package.json index 69b330fb6..e3910816e 100644 --- a/packages/babel-plugin-emotion/package.json +++ b/packages/babel-plugin-emotion/package.json @@ -17,7 +17,7 @@ "@babel/helper-module-imports": "7.0.0-beta.32", "@emotion/hash": "^0.6.2", "@emotion/memoize": "^0.6.1", - "@emotion/stylis": "^0.6.4", + "@emotion/stylis": "^0.6.5", "babel-plugin-macros": "^2.0.0", "babel-plugin-syntax-jsx": "^6.18.0", "convert-source-map": "^1.5.0", diff --git a/packages/create-emotion/package.json b/packages/create-emotion/package.json index 5d0d9a2fc..30cc4e7bb 100644 --- a/packages/create-emotion/package.json +++ b/packages/create-emotion/package.json @@ -18,7 +18,7 @@ "dependencies": { "@emotion/hash": "^0.6.2", "@emotion/memoize": "^0.6.1", - "@emotion/stylis": "^0.6.4", + "@emotion/stylis": "^0.6.5", "@emotion/unitless": "^0.6.2", "stylis": "^3.5.0", "stylis-rule-sheet": "^0.0.10" diff --git a/packages/create-emotion/src/index.js b/packages/create-emotion/src/index.js index 1592c7969..c501b49ac 100644 --- a/packages/create-emotion/src/index.js +++ b/packages/create-emotion/src/index.js @@ -9,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 @@ -86,12 +86,11 @@ function createEmotion( const insertionPlugin = stylisRuleSheet(insertRule) - const stylisOptions: StylisOptions = { - prefix: options.prefix === undefined ? true : options.prefix - } - - if (process.env.NODE_ENV !== 'production') { - stylisOptions.compress = false + let stylisOptions + if (options.prefix !== undefined) { + stylisOptions = { + prefix: options.prefix + } } const caches = { diff --git a/packages/create-emotion/src/utils.js b/packages/create-emotion/src/utils.js index 82fb5a27a..b81c6a9be 100644 --- a/packages/create-emotion/src/utils.js +++ b/packages/create-emotion/src/utils.js @@ -77,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 -} diff --git a/yarn.lock b/yarn.lock index dfdc46018..3a0c8447a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -673,9 +673,9 @@ version "0.6.1" resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.6.1.tgz#b2de5184e49f518b7115a5e6d0e727643ec531cf" -"@emotion/stylis@^0.6.4": - version "0.6.4" - resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.6.4.tgz#ad7dee926df2704745c38bc559b66682f25e711a" +"@emotion/stylis@^0.6.5": + version "0.6.5" + resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.6.5.tgz#3e1bb0e52307d66212bcd307e2cb4d079f2a0b6a" "@emotion/unitless@^0.6.2": version "0.6.2"