From e7bf2701f4ea134b971f0208169179f56b819f72 Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Tue, 9 Jul 2019 18:14:53 -0700 Subject: [PATCH 1/3] Update `serve-handler` to v6.1.0 and enable `etag` option by default Introduces a `--no-etag` flag to opt-out of ETags. --- bin/serve.js | 4 ++++ package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/serve.js b/bin/serve.js index 45e583f3..ea344a7f 100755 --- a/bin/serve.js +++ b/bin/serve.js @@ -327,6 +327,9 @@ const loadConfig = async (cwd, entry, args) => { } } + // "ETag" headers are enabled by default unless `--no-etag` is provided + config.etag = !args['--no-etag']; + return config; }; @@ -340,6 +343,7 @@ const loadConfig = async (cwd, entry, args) => { '--listen': [parseEndpoint], '--single': Boolean, '--debug': Boolean, + '--no-etag': Boolean, '--config': String, '--no-clipboard': Boolean, '--no-compression': Boolean, diff --git a/package.json b/package.json index 9f1d50ae..31fc488b 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "chalk": "2.4.1", "clipboardy": "1.2.3", "compression": "1.7.3", - "serve-handler": "6.0.2", + "serve-handler": "6.1.0", "update-check": "1.5.2" } } diff --git a/yarn.lock b/yarn.lock index bfa73274..3123927e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -977,10 +977,10 @@ semver@^5.5.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== -serve-handler@6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/serve-handler/-/serve-handler-6.0.2.tgz#c5afbace1a4aa28645f26483d64725b45f285048" - integrity sha512-D1zgDpvx9Rgjip6rzY2QBjlZwfr/oiDSg66HipOWkEw1appHn7/mXdVRL6F8+bd1KD117Wch4+4x78OTXQVwDg== +serve-handler@6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/serve-handler/-/serve-handler-6.1.0.tgz#f1606dc6ff8f9029a1ee042c11dfe7903a5cb92e" + integrity sha512-63N075Tn3PsFYcu0NVV7tb367UbiW3gnC+/50ohL4oqOhAG6bmbaWqiRcXQgbzqc0ALBjSAzg7VTfa0Qw4E3hA== dependencies: bytes "3.0.0" content-disposition "0.5.2" From 0e64ae88bb097a8d84fa4b1212dbf21ed0cc3f24 Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Tue, 9 Jul 2019 18:16:42 -0700 Subject: [PATCH 2/3] Move option --- bin/serve.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/serve.js b/bin/serve.js index ea344a7f..60ddf32c 100755 --- a/bin/serve.js +++ b/bin/serve.js @@ -343,10 +343,10 @@ const loadConfig = async (cwd, entry, args) => { '--listen': [parseEndpoint], '--single': Boolean, '--debug': Boolean, - '--no-etag': Boolean, '--config': String, '--no-clipboard': Boolean, '--no-compression': Boolean, + '--no-etag': Boolean, '--symlinks': Boolean, '-h': '--help', '-v': '--version', From cac4d6b18794d5739718dfb4678d72b07770932e Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Tue, 9 Jul 2019 18:26:45 -0700 Subject: [PATCH 3/3] Add `--no-etag` to help output --- bin/serve.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/serve.js b/bin/serve.js index 60ddf32c..ed19ec8f 100755 --- a/bin/serve.js +++ b/bin/serve.js @@ -83,6 +83,8 @@ const getHelp = () => chalk` -n, --no-clipboard Do not copy the local address to the clipboard + --no-etag Send \`Last-Modified\` header instead of \`ETag\` + -S, --symlinks Resolve symlinks instead of showing 404 errors {bold ENDPOINTS}