Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
fix: correctly import najax for FastBoot
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlafroscia committed Jun 18, 2018
1 parent ad730f9 commit 2f58087
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Expand Up @@ -16,6 +16,9 @@ module.exports = {
env: {
browser: true
},
globals: {
FastBoot: true
},
rules: {
'prettier/prettier': 'error',

Expand Down
2 changes: 1 addition & 1 deletion addon/-private/utils/is-fastboot.js
@@ -1,3 +1,3 @@
/* global FastBoot */
const isFastBoot = typeof FastBoot !== 'undefined';

export default isFastBoot;
6 changes: 3 additions & 3 deletions addon/utils/ajax.js
@@ -1,6 +1,6 @@
/* global najax */
import $ from 'jquery';

import isFastBoot from 'ember-ajax/-private/utils/is-fastboot';

export default (isFastBoot ? najax : $.ajax);
const ajax = isFastBoot ? FastBoot.require('najax') : $.ajax;

export default ajax;
8 changes: 6 additions & 2 deletions package.json
Expand Up @@ -34,7 +34,8 @@
]
},
"dependencies": {
"ember-cli-babel": "^6.14.1"
"ember-cli-babel": "^6.14.1",
"najax": "^1.0.3"
},
"devDependencies": {
"@commitlint/cli": "^7.0.0",
Expand Down Expand Up @@ -80,7 +81,10 @@
"node": "^4.5 || 6.* || >= 7.*"
},
"ember-addon": {
"configPath": "tests/dummy/config"
"configPath": "tests/dummy/config",
"fastbootDependencies": [
"najax"
]
},
"greenkeeper": {
"ignore": [
Expand Down
16 changes: 16 additions & 0 deletions yarn.lock
Expand Up @@ -4708,6 +4708,10 @@ jest-validate@^23.0.0:
leven "^2.1.0"
pretty-format "^23.0.1"

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.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca"
Expand Down Expand Up @@ -5902,6 +5906,14 @@ mute-stream@0.0.7, mute-stream@~0.0.4:
version "0.0.7"
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"

najax@^1.0.3:
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:
version "2.10.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f"
Expand Down Expand Up @@ -6675,6 +6687,10 @@ qs@6.5.1, qs@^6.4.0, qs@~6.5.1:
version "6.5.1"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8"

qs@^6.2.0:
version "6.5.2"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"

qs@~5.2.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/qs/-/qs-5.2.1.tgz#801fee030e0b9450d6385adc48a4cc55b44aedfc"
Expand Down

0 comments on commit 2f58087

Please sign in to comment.