rip-lang 3.13.14 → 3.13.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rip-lang",
3
- "version": "3.13.14",
3
+ "version": "3.13.15",
4
4
  "description": "A modern language that compiles to JavaScript",
5
5
  "type": "module",
6
6
  "main": "src/compiler.js",
package/src/app.rip CHANGED
@@ -910,9 +910,21 @@ export launch = (appBase = '', opts = {}) ->
910
910
  if opts.bundle
911
911
  bundle = opts.bundle
912
912
  else if opts.bundleUrl
913
- res = await fetch(opts.bundleUrl, cache: 'no-cache')
914
- throw new Error "launch: #{opts.bundleUrl} (#{res.status})" unless res.ok
915
- bundle = res.json!
913
+ headers = {}
914
+ etagKey = "__rip_etag_#{opts.bundleUrl}"
915
+ cached = sessionStorage.getItem(etagKey)
916
+ headers['If-None-Match'] = cached if cached
917
+ res = await fetch(opts.bundleUrl, { headers })
918
+ if res.status is 304
919
+ bundle = JSON.parse(sessionStorage.getItem("#{etagKey}_data"))
920
+ else if res.ok
921
+ bundle = res.json!
922
+ etag = res.headers.get('etag')
923
+ if etag
924
+ sessionStorage.setItem(etagKey, etag)
925
+ sessionStorage.setItem("#{etagKey}_data", JSON.stringify(bundle))
926
+ else
927
+ throw new Error "launch: #{opts.bundleUrl} (#{res.status})"
916
928
  else
917
929
  throw new Error "launch: no bundle or bundleUrl provided"
918
930