Skip to content
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

Major: 1.0 #64

Merged
merged 79 commits into from
Jun 10, 2020
Merged

Major: 1.0 #64

merged 79 commits into from
Jun 10, 2020

Conversation

lukeed
Copy link
Owner

@lukeed lukeed commented May 23, 2020

TODO

lukeed and others added 30 commits June 23, 2019 16:12
- still optimized
- adds ETag support to "dev" mode
- adds brotli/gzip support to "dev" mode
- Related: #3
* fix(sirv-cli): use `host` for port availability

* Add support for ETag-based caching

When providing an ETag header on responses, the client automatically sends that header value on subsequent requests for the matching resource as an `If-None-Match` request header. If the ETag value received in `If-None-Match` is the same as the ETag computed by the disk crawl, a 304 "Not Modified" status can be returned along with an empty body to indicate that the requestor's cached value should be used.

* chore: use existing `isEtag` var

Co-authored-by: Luke Edwards <luke.edwards05@gmail.com>
# Conflicts:
#	lerna.json
#	package.json
#	packages/sirv-cli/boot.js
#	packages/sirv-cli/package.json
#	packages/sirv/index.js
#	packages/sirv/package.json
- Node 8.x is already End of Life (2019-12-31)
lukeed and others added 6 commits May 26, 2020 08:57
* Add option to specify asset paths for SPAs

Allows asset path prefixes to be specified by the CLI when running in
single-page mode.

If a path is requested that doesn't exist, and that path matches one of
the asset path prefixes, the request will 404 instead of retuning a 200
containing the root index.

Fixes #44

* fix: ensure `assets` array & preload prep work

* chore: add `assets` tests

* chore: update options definition

* update `--single` & `--assets` text

Co-authored-by: Luke Edwards <luke.edwards05@gmail.com>
@lukeed
Copy link
Owner Author

lukeed commented Jun 1, 2020

So, I'm thinking about reverting (or reworking) the most recent --assets feature.

Right now (in stable and next versions), when --single is enabled, there's been a problem with too many things falling back to the index.html page. For example, requesting /file.js would send down the /index.html response when file.js doesn't actually exist.

In this WIP-1.0, when --single is enabled, any URL that ends with an extension will automatically circumvent the "index.html fallback" behavior. The use of --assets is merely a way to add additional prefixes/patterns that should circumvent the fallback.

I'm thinking that the ends-with-extension check is good enough for 99% of use cases... If you're ignoring other things, it's probably not asset related, and so I don't think the flag should be labeled as such.

Instead, how about --ignore, -I to explicitly control which paths should ignore the --single fallback?

Interested in feedback. This is the remaining hurdle for 1.0

}
let extensions = opts.extensions || ['html', 'htm'];
let gzips = opts.gzip && extensions.map(x => `${x}.gz`).concat('gz');
let brots = opts.brotli && extensions.map(x => `${x}.br`).concat('br');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback please decodeURIComponent because this issue is back: #21

if (brots && /(br|brotli)/i.test(val)) extns.unshift(...brots);
extns.push(...extensions); // [...br, ...gz, orig, ...exts]

let pathname = req.path || parser(req, true).pathname;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback please decodeURIComponent because this issue is back: #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants