@roots/bud-cache 2023.5.12 → 2023.5.22
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.
|
@@ -24,7 +24,7 @@ let InvalidateCacheExtension = class InvalidateCacheExtension extends Extension
|
|
|
24
24
|
*/
|
|
25
25
|
async register(bud) {
|
|
26
26
|
const invalidate = await bud.fs?.exists(this.invalidationFile);
|
|
27
|
-
if (invalidate ||
|
|
27
|
+
if (invalidate || bud.context.force) {
|
|
28
28
|
await bud.fs.remove(this.invalidationFile);
|
|
29
29
|
await bud.fs.remove(bud.cache.cacheDirectory);
|
|
30
30
|
}
|
package/lib/service/index.d.ts
CHANGED
|
@@ -40,9 +40,9 @@ export default class Cache extends Service implements Services.Cache.Service {
|
|
|
40
40
|
*/
|
|
41
41
|
get configuration(): Configuration[`cache`];
|
|
42
42
|
/**
|
|
43
|
-
* {@link Extension.
|
|
43
|
+
* {@link Extension.boot}
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
boot(bud: Bud): Promise<void>;
|
|
46
46
|
/**
|
|
47
47
|
* Flush cache
|
|
48
48
|
*/
|
package/lib/service/index.js
CHANGED
|
@@ -30,8 +30,8 @@ export default class Cache extends Service {
|
|
|
30
30
|
* Type
|
|
31
31
|
*/
|
|
32
32
|
get type() {
|
|
33
|
-
return this.app.hooks.filter(`build.cache.type`,
|
|
34
|
-
? this.app.context.
|
|
33
|
+
return this.app.hooks.filter(`build.cache.type`, isString(this.app.context.cache)
|
|
34
|
+
? this.app.context.cache
|
|
35
35
|
: `filesystem`);
|
|
36
36
|
}
|
|
37
37
|
set type(type) {
|
|
@@ -98,9 +98,9 @@ export default class Cache extends Service {
|
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
|
-
* {@link Extension.
|
|
101
|
+
* {@link Extension.boot}
|
|
102
102
|
*/
|
|
103
|
-
async
|
|
103
|
+
async boot(bud) {
|
|
104
104
|
await bud.extensions.add(InvalidateCacheExtension);
|
|
105
105
|
this.logger.success(`cache initialized`);
|
|
106
106
|
}
|
|
@@ -116,7 +116,7 @@ __decorate([
|
|
|
116
116
|
__metadata("design:type", Function),
|
|
117
117
|
__metadata("design:paramtypes", [Function]),
|
|
118
118
|
__metadata("design:returntype", Promise)
|
|
119
|
-
], Cache.prototype, "
|
|
119
|
+
], Cache.prototype, "boot", null);
|
|
120
120
|
__decorate([
|
|
121
121
|
bind,
|
|
122
122
|
__metadata("design:type", Function),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roots/bud-cache",
|
|
3
|
-
"version": "2023.5.
|
|
3
|
+
"version": "2023.5.22",
|
|
4
4
|
"description": "Config caching",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16"
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"@skypack/package-check": "0.2.2"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@roots/bud-framework": "2023.5.
|
|
89
|
-
"@roots/bud-support": "2023.5.
|
|
88
|
+
"@roots/bud-framework": "2023.5.22",
|
|
89
|
+
"@roots/bud-support": "2023.5.22",
|
|
90
90
|
"strip-ansi": "7.0.1",
|
|
91
91
|
"tslib": "2.5.0"
|
|
92
92
|
},
|
|
@@ -30,7 +30,7 @@ export default class InvalidateCacheExtension extends Extension {
|
|
|
30
30
|
public override async register(bud: Bud) {
|
|
31
31
|
const invalidate = await bud.fs?.exists(this.invalidationFile)
|
|
32
32
|
|
|
33
|
-
if (invalidate ||
|
|
33
|
+
if (invalidate || bud.context.force) {
|
|
34
34
|
await bud.fs.remove(this.invalidationFile)
|
|
35
35
|
await bud.fs.remove(bud.cache.cacheDirectory)
|
|
36
36
|
}
|
package/src/service/index.ts
CHANGED
|
@@ -42,8 +42,8 @@ export default class Cache
|
|
|
42
42
|
public get type(): 'memory' | 'filesystem' {
|
|
43
43
|
return this.app.hooks.filter(
|
|
44
44
|
`build.cache.type`,
|
|
45
|
-
|
|
46
|
-
? this.app.context.
|
|
45
|
+
isString(this.app.context.cache)
|
|
46
|
+
? this.app.context.cache
|
|
47
47
|
: `filesystem`,
|
|
48
48
|
)
|
|
49
49
|
}
|
|
@@ -125,10 +125,10 @@ export default class Cache
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
|
-
* {@link Extension.
|
|
128
|
+
* {@link Extension.boot}
|
|
129
129
|
*/
|
|
130
130
|
@bind
|
|
131
|
-
public override async
|
|
131
|
+
public override async boot(bud: Bud) {
|
|
132
132
|
await bud.extensions.add(InvalidateCacheExtension)
|
|
133
133
|
this.logger.success(`cache initialized`)
|
|
134
134
|
}
|