Skip to content

Commit

Permalink
feat: enable header request Content-Range (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakokazuki authored and ulivz committed Jun 7, 2018
1 parent 5e0651f commit 825877c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
const serve = require('webpack-serve')
const convert = require('koa-connect')
const mount = require('koa-mount')
const range = require('koa-range')
const serveStatic = require('koa-static')
const history = require('connect-history-api-fallback')

Expand Down Expand Up @@ -108,6 +109,10 @@ module.exports = async function dev (sourceDir, cliOptions = {}) {
port,
add: app => {
const userPublic = path.resolve(sourceDir, '.vuepress/public')

// enable range request
app.use(range)

// respect base when serving static files...
if (fs.existsSync(userPublic)) {
app.use(mount(options.publicPath, serveStatic(userPublic)))
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"js-yaml": "^3.11.0",
"koa-connect": "^2.0.1",
"koa-mount": "^3.0.0",
"koa-range": "^0.3.0",
"koa-static": "^4.0.2",
"loader-utils": "^1.1.0",
"lodash.throttle": "^4.1.1",
Expand Down
12 changes: 11 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5060,6 +5060,12 @@ koa-mount@^3.0.0:
debug "^2.6.1"
koa-compose "^3.2.1"

koa-range@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/koa-range/-/koa-range-0.3.0.tgz#3588e3496473a839a1bd264d2a42b1d85bd7feac"
dependencies:
stream-slice "^0.1.2"

koa-send@^4.1.3:
version "4.1.3"
resolved "https://registry.yarnpkg.com/koa-send/-/koa-send-4.1.3.tgz#0822207bbf5253a414c8f1765ebc29fa41353cb6"
Expand Down Expand Up @@ -7616,6 +7622,10 @@ stream-shift@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952"

stream-slice@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/stream-slice/-/stream-slice-0.1.2.tgz#2dc4f4e1b936fb13f3eb39a2def1932798d07a4b"

strict-uri-encode@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
Expand Down Expand Up @@ -8292,7 +8302,7 @@ vue-jest@^2.6.0:
tsconfig "^7.0.0"
vue-template-es2015-compiler "^1.6.0"

vue-loader@^15.2.1:
vue-loader@^15.2.4:
version "15.2.4"
resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-15.2.4.tgz#a7b923123d3cf87230a8ff54a1c16d31a6c5dbb4"
dependencies:
Expand Down

0 comments on commit 825877c

Please sign in to comment.