-
Notifications
You must be signed in to change notification settings - Fork 605
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
[WIP] FastBoot compatibility #819
Changes from 6 commits
ae80d84
d5fc4b4
3a1ee59
8276cc7
0c81f8c
472418b
8254f87
82088b6
ffbfcbe
afd8d80
9e859a6
c787dc9
8a54e82
c46e600
f0478e7
6a61dcf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Ember from 'ember'; | ||
|
||
const { computed, inject: { service } } = Ember; | ||
|
||
export default Ember.Mixin.create({ | ||
|
||
fastboot: service(), | ||
|
||
isNotFastBoot: computed.not('fastboot.isFastBoot'), | ||
|
||
/** | ||
* When there's a need to raise network requests from the server | ||
* during Server Side Rendering(SSR) via FastBoot, | ||
* the JS Fetch API doesn't work with absolute urls. | ||
* This property gives the URL prefix for those network calls. | ||
* */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't it the other way around? it doesn't work with relative URLs, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. danngit, you're right. I don't think we need it anymore if I use ajax service. |
||
appURL: computed(function() { | ||
let url = ''; | ||
if (this.get('fastboot.isFastBoot')) { | ||
let protocol = this.get('fastboot.request.protocol'); | ||
let host = this.get('fastboot.request.host'); | ||
url = `${protocol}://${host}`; | ||
} | ||
return url; | ||
}), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment here might be valuable to understand why we need this |
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import Ember from 'ember'; | ||
import fetch from 'fetch'; | ||
import FastbootUtils from '../mixins/fastboot-utils'; | ||
|
||
export default Ember.Route.extend(FastbootUtils, { | ||
|
||
export default Ember.Route.extend({ | ||
activate() { | ||
Ember.$.getJSON('/logout', () => { | ||
fetch(`${this.get('appURL')}/logout`, () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should probably use |
||
Ember.run(() => { | ||
this.session.logoutUser(); | ||
this.transitionTo('index'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Ember from 'ember'; | ||
import FastbootUtilsMixin from 'cargo/mixins/fastboot-utils'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('Unit | Mixin | fastboot utils'); | ||
|
||
// Replace this with your real tests. | ||
test('it works', function(assert) { | ||
let FastbootUtilsObject = Ember.Object.extend(FastbootUtilsMixin); | ||
let subject = FastbootUtilsObject.create(); | ||
assert.ok(subject); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1772,7 +1772,7 @@ compressible@~2.0.8: | |
dependencies: | ||
mime-db ">= 1.27.0 < 2" | ||
|
||
compression@^1.4.4: | ||
compression@^1.4.4, compression@^1.6.2: | ||
version "1.6.2" | ||
resolved "https://registry.yarnpkg.com/compression/-/compression-1.6.2.tgz#cceb121ecc9d09c52d7ad0c3350ea93ddd402bc3" | ||
dependencies: | ||
|
@@ -1849,6 +1849,10 @@ [email protected]: | |
version "0.3.1" | ||
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" | ||
|
||
cookie@^0.2.3: | ||
version "0.2.4" | ||
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.2.4.tgz#a8c155aa7b9b2cf2c4d32ebc7b9a0aa288ccc6bd" | ||
|
||
copy-dereference@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/copy-dereference/-/copy-dereference-1.0.0.tgz#6b131865420fd81b413ba994b44d3655311152b6" | ||
|
@@ -1865,6 +1869,12 @@ core-object@^1.1.0: | |
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/core-object/-/core-object-1.1.0.tgz#86d63918733cf9da1a5aae729e62c0a88e66ad0a" | ||
|
||
core-object@^2.0.5: | ||
version "2.1.1" | ||
resolved "https://registry.yarnpkg.com/core-object/-/core-object-2.1.1.tgz#4b7a5f1edefcb1e6d0dcb58eab1b9f90bfc666a8" | ||
dependencies: | ||
chalk "^1.1.3" | ||
|
||
core-object@^3.1.3: | ||
version "3.1.3" | ||
resolved "https://registry.yarnpkg.com/core-object/-/core-object-3.1.3.tgz#df399b3311bdb0c909e8aae8929fc3c1c4b25880" | ||
|
@@ -2156,6 +2166,32 @@ ember-cli-eslint@^4.0.0: | |
rsvp "^3.2.1" | ||
walk-sync "^0.3.0" | ||
|
||
ember-cli-fastboot@^1.0.0-rc.5: | ||
version "1.0.0-rc.5" | ||
resolved "https://registry.yarnpkg.com/ember-cli-fastboot/-/ember-cli-fastboot-1.0.0-rc.5.tgz#4f1a5919f1c6bf00850c8412669510fe642b77c3" | ||
dependencies: | ||
broccoli-concat "^3.2.2" | ||
broccoli-funnel "^1.2.0" | ||
broccoli-merge-trees "^1.1.1" | ||
broccoli-plugin "^1.2.1" | ||
broccoli-stew "^1.2.0" | ||
chalk "^1.1.3" | ||
compression "^1.6.2" | ||
core-object "^2.0.5" | ||
debug "^2.2.0" | ||
ember-cli-babel "^5.1.7" | ||
ember-cli-version-checker "^1.3.1" | ||
exists-sync "0.0.4" | ||
express "^4.8.5" | ||
fastboot "1.0.0-rc.6" | ||
fastboot-express-middleware "1.0.0-rc.7" | ||
json-stable-stringify "^1.0.1" | ||
lodash.defaults "^4.0.1" | ||
lodash.uniq "^4.2.0" | ||
md5-hex "^1.3.0" | ||
rsvp "^3.0.16" | ||
silent-error "^1.0.0" | ||
|
||
ember-cli-get-component-path-option@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/ember-cli-get-component-path-option/-/ember-cli-get-component-path-option-1.0.0.tgz#0d7b595559e2f9050abed804f1d8eff1b08bc771" | ||
|
@@ -2388,7 +2424,7 @@ ember-cli-valid-component-name@^1.0.0: | |
dependencies: | ||
silent-error "^1.0.0" | ||
|
||
ember-cli-version-checker@^1.0.2, ember-cli-version-checker@^1.1.4, ember-cli-version-checker@^1.1.6, ember-cli-version-checker@^1.1.7, ember-cli-version-checker@^1.2.0: | ||
ember-cli-version-checker@^1.0.2, ember-cli-version-checker@^1.1.4, ember-cli-version-checker@^1.1.6, ember-cli-version-checker@^1.1.7, ember-cli-version-checker@^1.2.0, ember-cli-version-checker@^1.3.1: | ||
version "1.3.1" | ||
resolved "https://registry.yarnpkg.com/ember-cli-version-checker/-/ember-cli-version-checker-1.3.1.tgz#0bc2d134c830142da64bf9627a0eded10b61ae72" | ||
dependencies: | ||
|
@@ -2974,7 +3010,11 @@ expand-tilde@^1.2.2: | |
dependencies: | ||
os-homedir "^1.0.1" | ||
|
||
express@^4.10.7, express@^4.12.3: | ||
[email protected]: | ||
version "0.0.4" | ||
resolved "https://registry.yarnpkg.com/express-cluster/-/express-cluster-0.0.4.tgz#7aa5c39779bbc7550a30525d02b4c022e40b8798" | ||
|
||
express@^4.10.7, express@^4.12.3, express@^4.13.3, express@^4.8.5: | ||
version "4.15.3" | ||
resolved "https://registry.yarnpkg.com/express/-/express-4.15.3.tgz#bab65d0f03aa80c358408972fc700f916944b662" | ||
dependencies: | ||
|
@@ -3068,6 +3108,30 @@ fast-sourcemap-concat@^1.0.1: | |
source-map "^0.4.2" | ||
source-map-url "^0.3.0" | ||
|
||
[email protected]: | ||
version "1.0.0-rc.7" | ||
resolved "https://registry.yarnpkg.com/fastboot-express-middleware/-/fastboot-express-middleware-1.0.0-rc.7.tgz#285dee01734d40bafe983cefb63e7df0c680f282" | ||
dependencies: | ||
chalk "^1.1.3" | ||
fastboot "^1.0.0-rc.3" | ||
|
||
[email protected], fastboot@^1.0.0-rc.3: | ||
version "1.0.0-rc.6" | ||
resolved "https://registry.yarnpkg.com/fastboot/-/fastboot-1.0.0-rc.6.tgz#09af88b41d1b31fda96be425c857e34b2323115b" | ||
dependencies: | ||
chalk "^0.5.1" | ||
cookie "^0.2.3" | ||
debug "^2.1.0" | ||
exists-sync "0.0.3" | ||
express "^4.13.3" | ||
express-cluster "0.0.4" | ||
glob "^4.0.5" | ||
minimist "^1.2.0" | ||
najax "^1.0.1" | ||
rsvp "^3.0.16" | ||
simple-dom "^0.3.0" | ||
source-map-support "^0.4.0" | ||
|
||
faye-websocket@~0.10.0: | ||
version "0.10.0" | ||
resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.10.0.tgz#4e492f8d04dfb6f89003507f6edbf2d501e7c6f4" | ||
|
@@ -3386,6 +3450,15 @@ [email protected], glob@^7.0.4, glob@^7.0.5: | |
once "^1.3.0" | ||
path-is-absolute "^1.0.0" | ||
|
||
glob@^4.0.5: | ||
version "4.5.3" | ||
resolved "https://registry.yarnpkg.com/glob/-/glob-4.5.3.tgz#c6cb73d3226c1efef04de3c56d012f03377ee15f" | ||
dependencies: | ||
inflight "^1.0.4" | ||
inherits "2" | ||
minimatch "^2.0.1" | ||
once "^1.3.0" | ||
|
||
glob@^5.0.10, glob@^5.0.15: | ||
version "5.0.15" | ||
resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" | ||
|
@@ -3929,6 +4002,10 @@ [email protected]: | |
editions "^1.1.1" | ||
textextensions "1 || 2" | ||
|
||
jquery-deferred@^0.3.0: | ||
version "0.3.1" | ||
resolved "https://registry.yarnpkg.com/jquery-deferred/-/jquery-deferred-0.3.1.tgz#596eca1caaff54f61b110962b23cafea74c35355" | ||
|
||
jquery@^3.1.1: | ||
version "3.2.1" | ||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787" | ||
|
@@ -4193,7 +4270,7 @@ lodash.debounce@^3.1.1: | |
dependencies: | ||
lodash._getnative "^3.0.0" | ||
|
||
lodash.defaults@^4.2.0: | ||
lodash.defaults@^4.0.1, lodash.defaults@^4.2.0: | ||
version "4.2.0" | ||
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" | ||
|
||
|
@@ -4391,6 +4468,12 @@ matcher-collection@^1.0.0, matcher-collection@^1.0.1: | |
dependencies: | ||
minimatch "^3.0.2" | ||
|
||
md5-hex@^1.3.0: | ||
version "1.3.0" | ||
resolved "https://registry.yarnpkg.com/md5-hex/-/md5-hex-1.3.0.tgz#d2c4afe983c4370662179b8cad145219135046c4" | ||
dependencies: | ||
md5-o-matic "^0.1.1" | ||
|
||
md5-hex@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/md5-hex/-/md5-hex-2.0.0.tgz#d0588e9f1c74954492ecd24ac0ac6ce997d92e33" | ||
|
@@ -4583,6 +4666,14 @@ [email protected]: | |
version "0.0.7" | ||
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" | ||
|
||
najax@^1.0.1: | ||
version "1.0.3" | ||
resolved "https://registry.yarnpkg.com/najax/-/najax-1.0.3.tgz#11145f4d910446ea661d8ab7fcef53f6ad164ae5" | ||
dependencies: | ||
jquery-deferred "^0.3.0" | ||
lodash.defaultsdeep "^4.6.0" | ||
qs "^6.2.0" | ||
|
||
nan@^2.3.0, nan@^2.3.2: | ||
version "2.6.2" | ||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45" | ||
|
@@ -5050,7 +5141,7 @@ q@^1.1.2: | |
version "1.5.0" | ||
resolved "https://registry.yarnpkg.com/q/-/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1" | ||
|
||
[email protected], qs@^6.4.0, qs@~6.4.0: | ||
[email protected], qs@^6.2.0, qs@^6.4.0, qs@~6.4.0: | ||
version "6.4.0" | ||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" | ||
|
||
|
@@ -5611,7 +5702,7 @@ source-map-support@^0.2.10: | |
dependencies: | ||
source-map "0.1.32" | ||
|
||
source-map-support@^0.4.2: | ||
source-map-support@^0.4.0, source-map-support@^0.4.2: | ||
version "0.4.15" | ||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.15.tgz#03202df65c06d2bd8c7ec2362a193056fef8d3b1" | ||
dependencies: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is that related to fastboot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related. I just grouped couple of individual set calls. Should've probably kept in a different commit.