vanilla-jet 1.0.6 → 1.0.7

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.
@@ -126,7 +126,11 @@ class Router {
126
126
 
127
127
  if (extHandled) {
128
128
 
129
- let fs = require('fs'), rep = obj.cwd.replace('core/framework', ''), route = request.path.replace(obj.server.options.base_url, ''), filename = path.join(rep, route), filePrivate = obj.isProtectedFile(route);
129
+ let fs = require('fs'),
130
+ rep = obj.cwd.replace('core/framework', ''),
131
+ route = request.path.replace(obj.server.options.base_url, ''),
132
+ filename = path.join(rep, route),
133
+ filePrivate = obj.isProtectedFile(route);
130
134
 
131
135
  fs.exists(filename, function (exists) {
132
136
 
@@ -134,6 +138,12 @@ class Router {
134
138
 
135
139
  var acceptEncoding = (req.headers['accept-encoding'] != undefined) ? req.headers['accept-encoding'] : '';
136
140
  var fileStream = fs.createReadStream(filename);
141
+
142
+ if (ext === 'js' && !route.match(/vanilla\.min\.js$/)) {
143
+ extHeader['Cache-Control'] = 'public, max-age=15552000';
144
+ extHeader['Expires'] = new Date(Date.now() + 15552000000).toUTCString();
145
+ }
146
+
137
147
  if (acceptEncoding.match(/\bgzip\b/) && compressionMimes[ext] != undefined) {
138
148
  extHeader['Content-Encoding'] = 'gzip';
139
149
  res.writeHead(200, extHeader);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vanilla-jet",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "VannilaJet framework",
5
5
  "main": "index.js",
6
6
  "scripts": {