-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
1,256 additions
and
463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
/coverage | ||
/es | ||
/lib | ||
/dist | ||
/tmp | ||
|
||
# Files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> | ||
<title>Demo</title> | ||
</head> | ||
<body> | ||
<pre> | ||
npx serve . | ||
open http://localhost:5000/example | ||
</pre> | ||
<pre id="log"></pre> | ||
<script type="module"> | ||
import createFetch, {query, headers} from './dist/index.js' | ||
|
||
const myFetch = createFetch(fetch, [ | ||
query(), | ||
headers({'x-requested-with': 'fetch'}), | ||
]) | ||
myFetch('/', {query: {foo: 'bar'}}).then(r => { | ||
console.info(r) | ||
log.textContent = [...r.headers].join('\n') | ||
}) | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import babel from 'rollup-plugin-babel' | ||
import builtins from 'rollup-plugin-node-builtins' | ||
import {terser} from 'rollup-plugin-terser' | ||
import pkg from './package.json' | ||
|
||
export default [ | ||
{ | ||
input: 'src/index.js', | ||
output: [ | ||
// | ||
{file: pkg.main, format: 'cjs'}, | ||
{file: pkg.module, format: 'es'}, | ||
], | ||
plugins: [babel()], | ||
}, | ||
// ES build for unpkg CDN | ||
{ | ||
input: 'src/index.js', | ||
output: {file: pkg.unpkg, format: 'es', indent: false}, | ||
plugins: [ | ||
babel({ | ||
babelrc: false, | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
loose: true, | ||
useBuiltIns: 'entry', | ||
targets: { | ||
// https://caniuse.com/#search=modules | ||
browsers: ['Chrome 61', 'Firefox 60', 'Safari 10.1'], | ||
}, | ||
}, | ||
], | ||
], | ||
}), | ||
// shims `querystring` | ||
builtins(), | ||
terser(), | ||
], | ||
}, | ||
] |
Oops, something went wrong.