@web/dev-server-core
Advanced tools
Comparing version 0.0.0-canary-20230222141205 to 0.0.0-canary-20230328172255
@@ -30,6 +30,6 @@ "use strict"; | ||
this.lruCache = new lru_cache_1.default({ | ||
length: (e, key) => e.body.length + (key ? key.length : 0), | ||
max: 52428800, | ||
sizeCalculation: (e, key) => e.body.length + (key ? key.length : 0), | ||
maxSize: 52428800, | ||
noDisposeOnSet: true, | ||
dispose: cacheKey => { | ||
dispose: (_value, cacheKey) => { | ||
// remove file path -> url mapping when we are no longer caching it | ||
@@ -49,3 +49,3 @@ for (const [filePath, cacheKeysForFilePath] of this.cacheKeysPerFilePath.entries()) { | ||
for (const cacheKey of cacheKeys) { | ||
this.lruCache.del(cacheKey); | ||
this.lruCache.delete(cacheKey); | ||
} | ||
@@ -52,0 +52,0 @@ } |
@@ -37,4 +37,6 @@ "use strict"; | ||
} | ||
// watch files that are served | ||
middlewares.push(watchServedFilesMiddleware_1.watchServedFilesMiddleware(fileWatcher, config.rootDir)); | ||
if (!config.disableFileWatcher) { | ||
// watch files that are served | ||
middlewares.push(watchServedFilesMiddleware_1.watchServedFilesMiddleware(fileWatcher, config.rootDir)); | ||
} | ||
// serves 304 responses if resource hasn't changed | ||
@@ -41,0 +43,0 @@ middlewares.push(etagCacheMiddleware_1.etagCacheMiddleware()); |
@@ -54,3 +54,8 @@ import { Middleware } from 'koa'; | ||
injectWebSocket?: boolean; | ||
/** | ||
* Whether to watch and rebuild served files. | ||
* Useful when you want more control over when files are build (e.g. when doing a test run using @web/test-runner). | ||
*/ | ||
disableFileWatcher?: boolean; | ||
} | ||
//# sourceMappingURL=DevServerCoreConfig.d.ts.map |
{ | ||
"name": "@web/dev-server-core", | ||
"version": "0.0.0-canary-20230222141205", | ||
"version": "0.0.0-canary-20230328172255", | ||
"publishConfig": { | ||
@@ -72,3 +72,3 @@ "access": "public" | ||
"koa-static": "^5.0.0", | ||
"lru-cache": "^6.0.0", | ||
"lru-cache": "^8.0.4", | ||
"mime-types": "^2.1.27", | ||
@@ -83,3 +83,2 @@ "parse5": "^6.0.1", | ||
"@types/koa-static": "^4.0.1", | ||
"@types/lru-cache": "^5.1.0", | ||
"@types/parse5": "^6.0.1", | ||
@@ -86,0 +85,0 @@ "abort-controller": "^3.0.0", |
@@ -33,7 +33,7 @@ import LRUCache from 'lru-cache'; | ||
constructor(private fileWatcher: FSWatcher, private rootDir: string) { | ||
this.lruCache = new LRUCache({ | ||
length: (e, key) => e.body.length + (key ? key.length : 0), | ||
max: 52428800, | ||
this.lruCache = new LRUCache<string, CacheEntry>({ | ||
sizeCalculation: (e, key) => e.body.length + (key ? key.length : 0), | ||
maxSize: 52428800, | ||
noDisposeOnSet: true, | ||
dispose: cacheKey => { | ||
dispose: (_value, cacheKey) => { | ||
// remove file path -> url mapping when we are no longer caching it | ||
@@ -54,3 +54,3 @@ for (const [filePath, cacheKeysForFilePath] of this.cacheKeysPerFilePath.entries()) { | ||
for (const cacheKey of cacheKeys) { | ||
this.lruCache.del(cacheKey); | ||
this.lruCache.delete(cacheKey); | ||
} | ||
@@ -57,0 +57,0 @@ } |
@@ -44,4 +44,6 @@ import { Middleware } from 'koa'; | ||
// watch files that are served | ||
middlewares.push(watchServedFilesMiddleware(fileWatcher, config.rootDir)); | ||
if (!config.disableFileWatcher) { | ||
// watch files that are served | ||
middlewares.push(watchServedFilesMiddleware(fileWatcher, config.rootDir)); | ||
} | ||
@@ -48,0 +50,0 @@ // serves 304 responses if resource hasn't changed |
@@ -59,2 +59,8 @@ import { Middleware } from 'koa'; | ||
injectWebSocket?: boolean; | ||
/** | ||
* Whether to watch and rebuild served files. | ||
* Useful when you want more control over when files are build (e.g. when doing a test run using @web/test-runner). | ||
*/ | ||
disableFileWatcher?: boolean; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
296949
8
5694
+ Addedlru-cache@8.0.5(transitive)
- Removedlru-cache@6.0.0(transitive)
- Removedyallist@4.0.0(transitive)
Updatedlru-cache@^8.0.4