Skip to content

Commit

Permalink
Upgrade to Emotion 9
Browse files Browse the repository at this point in the history
Emotion 9 will be required for Fastboot support, because it will include the PR that I made to get around the document/window issue
  • Loading branch information
alexlafroscia authored and Alex LaFroscia committed Feb 1, 2018
1 parent 10ad743 commit 0b6e751
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 33 deletions.
10 changes: 8 additions & 2 deletions fastboot/instance-initializers/setup-style-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export function initialize(application) {
// Generate the styles that we need to inject into the page
scheduleOnce('afterRender', function() {
const style = document.createElement('style');
const css = emotion.sheet.sheet.reduce((acc, style) => acc + style, '');
const css = Object.values(emotion.caches.inserted).reduce(
(acc, style) => acc + style,
''
);

style.type = 'text/css';
if (style.styleSheet) {
Expand All @@ -22,7 +25,10 @@ export function initialize(application) {
}

// Put IDs into showboe for re-hydration
shoebox.put(FASTBOOT_STYLE_CACHE_NAME, Object.keys(emotion.inserted));
shoebox.put(
FASTBOOT_STYLE_CACHE_NAME,
Object.keys(emotion.caches.inserted)
);

document.head.appendChild(style);
});
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
"test": "ember try:each"
},
"dependencies": {
"babel-plugin-emotion": "^8.0.12",
"babel-plugin-emotion": "9.0.0-2",
"broccoli-merge-trees": "^2.0.0",
"ember-cli-babel": "^6.6.0",
"ember-cli-version-checker": "^2.1.0",
"emotion": "^8.0.12",
"emotion": "9.0.0-2",
"semver": "^5.4.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/pod-styles-js-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ test('it exposes other exports as properties', function(assert) {

test('it strips whitespacing', function(assert) {
assert.equal(
emotion.registered[excessiveWhitespaceClass],
emotion.caches.registered[excessiveWhitespaceClass],
'background-color:grey;padding:1em;'
);
});
67 changes: 39 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,6 @@ babel-helpers@^6.24.1:
babel-runtime "^6.22.0"
babel-template "^6.24.1"

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"
Expand Down Expand Up @@ -549,15 +543,15 @@ babel-plugin-ember-modules-api-polyfill@^2.3.0:
dependencies:
ember-rfc176-data "^0.3.0"

babel-plugin-emotion@^8.0.12:
version "8.0.12"
resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-8.0.12.tgz#2ed844001416b0ae2ff787a06b1804ec5f531c89"
babel-plugin-emotion@9.0.0-2, babel-plugin-emotion@^9.0.0-2:
version "9.0.0-2"
resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-9.0.0-2.tgz#ab14aad0ea06440730ef766b0ead235bd2419b4a"
dependencies:
"@babel/helper-module-imports" "7.0.0-beta.32"
babel-macros "^1.2.0"
babel-plugin-macros "^2.0.0"
babel-plugin-syntax-jsx "^6.18.0"
convert-source-map "^1.5.0"
emotion-utils "^8.0.12"
emotion-utils "^9.0.0-2"
find-root "^1.1.0"
source-map "^0.5.7"
touch "^1.0.0"
Expand All @@ -578,6 +572,12 @@ babel-plugin-jscript@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/babel-plugin-jscript/-/babel-plugin-jscript-1.0.4.tgz#8f342c38276e87a47d5fa0a8bd3d5eb6ccad8fcc"

babel-plugin-macros@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.1.0.tgz#e978fd4c5ee9cca73a809c176524c2e9f4dcccbf"
dependencies:
cosmiconfig "^4.0.0"

babel-plugin-member-expression-literals@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/babel-plugin-member-expression-literals/-/babel-plugin-member-expression-literals-1.0.1.tgz#cc5edb0faa8dc927170e74d6d1c02440021624d3"
Expand Down Expand Up @@ -1853,15 +1853,23 @@ [email protected], core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"

cosmiconfig@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-3.1.0.tgz#640a94bf9847f321800403cd273af60665c73397"
cosmiconfig@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-4.0.0.tgz#760391549580bbd2df1e562bc177b13c290972dc"
dependencies:
is-directory "^0.3.1"
js-yaml "^3.9.0"
parse-json "^3.0.0"
parse-json "^4.0.0"
require-from-string "^2.0.1"

create-emotion@^9.0.0-2:
version "9.0.0-2"
resolved "https://registry.yarnpkg.com/create-emotion/-/create-emotion-9.0.0-2.tgz#8ca525064210a9e3961876c654af9b1b483b2aa0"
dependencies:
emotion-utils "^9.0.0-2"
stylis "^3.3.2"
stylis-rule-sheet "^0.0.5"

cross-spawn@^5.0.1, cross-spawn@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
Expand Down Expand Up @@ -2477,18 +2485,16 @@ ember-try@^0.2.15:
rsvp "^3.0.17"
semver "^5.1.0"

emotion-utils@^8.0.12:
version "8.0.12"
resolved "https://registry.yarnpkg.com/emotion-utils/-/emotion-utils-8.0.12.tgz#5e0fd72db3008f26ce4f80b1972df08841df2168"
emotion-utils@^9.0.0-2:
version "9.0.0-2"
resolved "https://registry.yarnpkg.com/emotion-utils/-/emotion-utils-9.0.0-2.tgz#b4f3b43ae0254cadcf9bf14a4d90081d7c65d1e1"

emotion@^8.0.12:
version "8.0.12"
resolved "https://registry.yarnpkg.com/emotion/-/emotion-8.0.12.tgz#03de11ce26b1b2401c334b94d438652124c514c6"
emotion@9.0.0-2:
version "9.0.0-2"
resolved "https://registry.yarnpkg.com/emotion/-/emotion-9.0.0-2.tgz#36a5ba2ea4c5231c0bfeebfbc33b393b34dee238"
dependencies:
babel-plugin-emotion "^8.0.12"
emotion-utils "^8.0.12"
stylis "^3.3.2"
stylis-rule-sheet "^0.0.5"
babel-plugin-emotion "^9.0.0-2"
create-emotion "^9.0.0-2"

encodeurl@~1.0.1:
version "1.0.1"
Expand Down Expand Up @@ -3742,6 +3748,10 @@ jsesc@~0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d"

json-parse-better-errors@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz#50183cd1b2d25275de069e9e71b467ac9eab973a"

json-schema-traverse@^0.3.0:
version "0.3.1"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340"
Expand Down Expand Up @@ -4722,11 +4732,12 @@ parse-json@^2.2.0:
dependencies:
error-ex "^1.2.0"

parse-json@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-3.0.0.tgz#fa6f47b18e23826ead32f263e744d0e1e847fb13"
parse-json@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0"
dependencies:
error-ex "^1.3.1"
json-parse-better-errors "^1.0.1"

parse-passwd@^1.0.0:
version "1.0.0"
Expand Down

0 comments on commit 0b6e751

Please sign in to comment.