-
Notifications
You must be signed in to change notification settings - Fork 352
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
Babel 7 support #104
Babel 7 support #104
Changes from 6 commits
76bb332
798c5de
ab1141a
0d19b83
ca504a0
8930275
2d7f4e6
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 |
---|---|---|
|
@@ -12,7 +12,9 @@ | |
"email": "[email protected]" | ||
} | ||
], | ||
"workspaces": ["packages/@pollyjs/*"], | ||
"workspaces": [ | ||
"packages/@pollyjs/*" | ||
], | ||
"scripts": { | ||
"commitmsg": "commitlint -E GIT_PARAMS", | ||
"build": "lerna run build --ignore=@pollyjs/ember --parallel", | ||
|
@@ -30,24 +32,23 @@ | |
"test:node": "mocha --opts tests/mocha.opts", | ||
"test:jest": "jest", | ||
"test:ember": "lerna run test --stream --no-prefix --scope=@pollyjs/ember", | ||
"server:build": | ||
"yarn build --scope=@pollyjs/node-server --scope=@pollyjs/utils", | ||
"server:build": "yarn build --scope=@pollyjs/node-server --scope=@pollyjs/utils", | ||
"docs:serve": "docsify serve ./docs", | ||
"docs:publish": | ||
"gh-pages --dist docs --dotfiles --message 'chore: Publish docs'", | ||
"docs:publish": "gh-pages --dist docs --dotfiles --message 'chore: Publish docs'", | ||
"release": "lerna publish", | ||
"postrelease": "yarn docs:publish" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.0.0", | ||
"@babel/plugin-external-helpers": "^7.0.0", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.0.0", | ||
"@babel/plugin-transform-runtime": "^7.0.0", | ||
"@babel/preset-env": "^7.0.0", | ||
"@babel/runtime": "^7.0.0", | ||
"@commitlint/cli": "^7.0.0", | ||
"@commitlint/config-conventional": "^7.0.1", | ||
"@commitlint/config-lerna-scopes": "^7.0.0", | ||
"@commitlint/travis-cli": "^7.0.0", | ||
"babel-core": "^6.26.3", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-env": "^1.7.0", | ||
"chai": "^4.1.2", | ||
"deepmerge": "^2.1.1", | ||
"docsify-cli": "^4.2.1", | ||
|
@@ -67,17 +68,17 @@ | |
"npm-run-all": "^4.1.3", | ||
"prettier": "^1.14.2", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.64.1", | ||
"rollup": "^0.65.2", | ||
"rollup-plugin-alias": "^1.4.0", | ||
"rollup-plugin-babel": "^3.0.7", | ||
"rollup-plugin-commonjs": "^9.1.5", | ||
"rollup-plugin-babel": "^4.0.3", | ||
"rollup-plugin-commonjs": "^9.1.6", | ||
"rollup-plugin-json": "^3.0.0", | ||
"rollup-plugin-multi-entry": "^2.0.2", | ||
"rollup-plugin-node-builtins": "^2.1.2", | ||
"rollup-plugin-node-globals": "^1.2.1", | ||
"rollup-plugin-node-resolve": "^3.3.0", | ||
"rollup-plugin-uglify": "^3.0.0", | ||
"rollup-plugin-node-globals": "^1.3.0", | ||
"rollup-plugin-node-resolve": "^3.4.0", | ||
"rollup-plugin-terser": "^2.0.2", | ||
"tap-merge": "^0.3.1", | ||
"testem": "^2.9.2" | ||
"testem": "^2.10.0" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,6 @@ | |
"npm-run-all": "^4.1.3", | ||
"prettier": "^1.14.2", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.64.1" | ||
"rollup": "^0.65.2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,6 @@ | |
"prettier": "^1.14.2", | ||
"puppeteer": "1.7.0", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.64.1" | ||
"rollup": "^0.65.2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,6 @@ | |
"npm-run-all": "^4.1.3", | ||
"prettier": "^1.14.2", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.64.1" | ||
"rollup": "^0.65.2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,6 @@ | |
"npm-run-all": "^4.1.3", | ||
"prettier": "^1.14.2", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.64.1" | ||
"rollup": "^0.65.2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,6 @@ | |
"npm-run-all": "^4.1.3", | ||
"prettier": "^1.14.2", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.64.1" | ||
"rollup": "^0.65.2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
/** | ||
* Create a deferred promise with `resolve` and `reject` methods. | ||
*/ | ||
export default class DeferredPromise extends Promise { | ||
constructor() { | ||
let resolve, reject; | ||
export default function defer() { | ||
let _resolve; | ||
let _reject; | ||
|
||
super((_resolve, _reject) => { | ||
resolve = _resolve; | ||
reject = _reject; | ||
}); | ||
const promise = new Promise((resolve, reject) => { | ||
_resolve = resolve; | ||
_reject = reject; | ||
}); | ||
|
||
this.resolve = resolve; | ||
this.reject = reject; | ||
} | ||
promise.resolve = _resolve; | ||
promise.reject = _reject; | ||
|
||
return promise; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,24 +23,31 @@ describe('Unit | Utils | serializeRequestBody', function() { | |
}); | ||
|
||
it('should handle files', async function() { | ||
expect(await serializeRequestBody(new File(['file'], 'file.txt'))).to.equal( | ||
`data:;base64,${btoa('file')}` | ||
); | ||
expect( | ||
await serializeRequestBody( | ||
new File(['file'], 'file.txt', { | ||
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.
Seems how the type is negotiated when not supplied is a browser quirk. In Chrome 68 if the type is |
||
type: 'text/plain' | ||
}) | ||
) | ||
).to.equal(`data:text/plain;base64,${btoa('file')}`); | ||
}); | ||
|
||
it('should handle form-data', async function() { | ||
const formData = new FormData(); | ||
|
||
formData.append('string', 'string'); | ||
formData.append('array', [1, 2]); | ||
formData.append('blob', new Blob(['blob'])); | ||
formData.append('file', new File(['file'], 'file.txt')); | ||
formData.append('blob', new Blob(['blob'], { type: 'text/plain' })); | ||
formData.append( | ||
'file', | ||
new File(['file'], 'file.txt', { type: 'text/plain' }) | ||
); | ||
|
||
const data = await serializeRequestBody(formData); | ||
|
||
expect(data).to.include('string=string'); | ||
expect(data).to.include('array=1,2'); | ||
expect(data).to.include(`blob=data:;base64,${btoa('blob')}`); | ||
expect(data).to.include(`file=data:;base64,${btoa('file')}`); | ||
expect(data).to.include(`blob=data:text/plain;base64,${btoa('blob')}`); | ||
expect(data).to.include(`file=data:text/plain;base64,${btoa('file')}`); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,6 @@ | |
"npm-run-all": "^4.1.3", | ||
"prettier": "^1.14.2", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.64.1" | ||
"rollup": "^0.65.2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,6 @@ | |
"npm-run-all": "^4.1.3", | ||
"prettier": "^1.14.2", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.64.1" | ||
"rollup": "^0.65.2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,6 @@ | |
"npm-run-all": "^4.1.3", | ||
"prettier": "^1.14.2", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.64.1" | ||
"rollup": "^0.65.2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,6 @@ | |
"npm-run-all": "^4.1.3", | ||
"prettier": "^1.14.2", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.64.1" | ||
"rollup": "^0.65.2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,6 @@ | |
"npm-run-all": "^4.1.3", | ||
"prettier": "^1.14.2", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.64.1" | ||
"rollup": "^0.65.2" | ||
} | ||
} |
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.
Reason: TrySound/rollup-plugin-uglify#45 (comment)