@roots/bud-cache 6.16.1 → 6.18.0
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.
- package/README.md +3 -3
- package/lib/service.d.ts +3 -3
- package/lib/service.js +15 -9
- package/package.json +3 -3
- package/src/service.ts +17 -13
package/README.md
CHANGED
|
@@ -73,12 +73,12 @@ However, the amount of effort needed to maintain and develop new features and pr
|
|
|
73
73
|
<a href="https://wordpress.com/">
|
|
74
74
|
<img src="https://cdn.roots.io/app/uploads/wordpress.svg" alt="WordPress.com" width="200" height="150"/>
|
|
75
75
|
</a>
|
|
76
|
-
<a href="https://pantheon.io/">
|
|
77
|
-
<img src="https://cdn.roots.io/app/uploads/pantheon.svg" alt="Pantheon" width="200" height="150"/>
|
|
78
|
-
</a>
|
|
79
76
|
<a href="https://worksitesafety.ca/careers/">
|
|
80
77
|
<img src="https://cdn.roots.io/app/uploads/worksite-safety.svg" alt="Worksite Safety" width="200" height="150"/>
|
|
81
78
|
</a>
|
|
82
79
|
<a href="https://www.copiadigital.com/">
|
|
83
80
|
<img src="https://cdn.roots.io/app/uploads/copia-digital.svg" alt="Copia Digital" width="200" height="150"/>
|
|
84
81
|
</a>
|
|
82
|
+
<a href="https://www.freave.com/">
|
|
83
|
+
<img src="https://cdn.roots.io/app/uploads/freave.svg" alt="Freave" width="200" height="150"/>
|
|
84
|
+
</a>
|
package/lib/service.d.ts
CHANGED
|
@@ -33,8 +33,8 @@ export default class Cache extends Service implements BudCache {
|
|
|
33
33
|
/**
|
|
34
34
|
* {@link BudCache.type}
|
|
35
35
|
*/
|
|
36
|
-
get type():
|
|
37
|
-
set type(type: Callback
|
|
36
|
+
get type(): `filesystem` | `memory`;
|
|
37
|
+
set type(type: Callback<`filesystem` | `memory`>);
|
|
38
38
|
/**
|
|
39
39
|
* {@link BudCache.version}
|
|
40
40
|
*/
|
|
@@ -90,5 +90,5 @@ export default class Cache extends Service implements BudCache {
|
|
|
90
90
|
/**
|
|
91
91
|
* Set {@link BudCache.type}
|
|
92
92
|
*/
|
|
93
|
-
setType(type:
|
|
93
|
+
setType(type: `filesystem` | `memory`): this;
|
|
94
94
|
}
|
package/lib/service.js
CHANGED
|
@@ -3,7 +3,6 @@ import { join } from 'node:path';
|
|
|
3
3
|
import { isBuildDependency } from '@roots/bud-cache/helpers';
|
|
4
4
|
import { Service } from '@roots/bud-framework/service';
|
|
5
5
|
import { bind } from '@roots/bud-support/decorators/bind';
|
|
6
|
-
import isString from '@roots/bud-support/lodash/isString';
|
|
7
6
|
/**
|
|
8
7
|
* {@link Bud.cache}
|
|
9
8
|
*/
|
|
@@ -29,9 +28,7 @@ export default class Cache extends Service {
|
|
|
29
28
|
.filter(isBuildDependency)
|
|
30
29
|
.map(({ path }) => path),
|
|
31
30
|
].filter(Boolean));
|
|
32
|
-
const records = {
|
|
33
|
-
bud: [...dependencies],
|
|
34
|
-
};
|
|
31
|
+
const records = { bud: [...dependencies] };
|
|
35
32
|
return (this.app.hooks.filter(`build.cache.buildDependencies`, records) ??
|
|
36
33
|
records);
|
|
37
34
|
}
|
|
@@ -63,10 +60,8 @@ export default class Cache extends Service {
|
|
|
63
60
|
* {@link BudCache.type}
|
|
64
61
|
*/
|
|
65
62
|
get type() {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
: `filesystem`;
|
|
69
|
-
return this.app.hooks.filter(`build.cache.type`) ?? fallback;
|
|
63
|
+
return (this.app.hooks.filter(`build.cache.type`, `filesystem`) ??
|
|
64
|
+
`filesystem`);
|
|
70
65
|
}
|
|
71
66
|
set type(type) {
|
|
72
67
|
this.app.hooks.on(`build.cache.type`, type);
|
|
@@ -97,7 +92,11 @@ export default class Cache extends Service {
|
|
|
97
92
|
if (this.enabled !== true)
|
|
98
93
|
return false;
|
|
99
94
|
if (this.type === `memory`)
|
|
100
|
-
return
|
|
95
|
+
return {
|
|
96
|
+
cacheUnaffected: true,
|
|
97
|
+
maxGenerations: Infinity,
|
|
98
|
+
type: `memory`,
|
|
99
|
+
};
|
|
101
100
|
return {
|
|
102
101
|
allowCollectingMemory: this.allowCollectingMemory,
|
|
103
102
|
buildDependencies: this.buildDependencies,
|
|
@@ -107,6 +106,7 @@ export default class Cache extends Service {
|
|
|
107
106
|
idleTimeout: 100,
|
|
108
107
|
idleTimeoutForInitialStore: 0,
|
|
109
108
|
managedPaths: [this.cacheDirectory, this.app.path(`@modules`)],
|
|
109
|
+
maxMemoryGenerations: Infinity,
|
|
110
110
|
name: this.name,
|
|
111
111
|
profile: this.app.context.debug === true,
|
|
112
112
|
store: `pack`,
|
|
@@ -179,6 +179,12 @@ export default class Cache extends Service {
|
|
|
179
179
|
return this;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
+
__decorate([
|
|
183
|
+
bind
|
|
184
|
+
], Cache.prototype, "boot", null);
|
|
182
185
|
__decorate([
|
|
183
186
|
bind
|
|
184
187
|
], Cache.prototype, "flush", null);
|
|
188
|
+
__decorate([
|
|
189
|
+
bind
|
|
190
|
+
], Cache.prototype, "register", null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roots/bud-cache",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.18.0",
|
|
4
4
|
"description": "Config caching",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16"
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"@skypack/package-check": "0.2.2"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@roots/bud-framework": "6.
|
|
76
|
-
"@roots/bud-support": "6.
|
|
75
|
+
"@roots/bud-framework": "6.18.0",
|
|
76
|
+
"@roots/bud-support": "6.18.0",
|
|
77
77
|
"strip-ansi": "7.1.0",
|
|
78
78
|
"tslib": "2.6.2"
|
|
79
79
|
},
|
package/src/service.ts
CHANGED
|
@@ -13,7 +13,6 @@ import {join} from 'node:path'
|
|
|
13
13
|
import {isBuildDependency} from '@roots/bud-cache/helpers'
|
|
14
14
|
import {Service} from '@roots/bud-framework/service'
|
|
15
15
|
import {bind} from '@roots/bud-support/decorators/bind'
|
|
16
|
-
import isString from '@roots/bud-support/lodash/isString'
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* {@link Bud.cache}
|
|
@@ -53,9 +52,7 @@ export default class Cache extends Service implements BudCache {
|
|
|
53
52
|
.map(({path}) => path),
|
|
54
53
|
].filter(Boolean),
|
|
55
54
|
)
|
|
56
|
-
const records = {
|
|
57
|
-
bud: [...dependencies],
|
|
58
|
-
}
|
|
55
|
+
const records = {bud: [...dependencies]}
|
|
59
56
|
|
|
60
57
|
return (
|
|
61
58
|
this.app.hooks.filter(`build.cache.buildDependencies`, records) ??
|
|
@@ -106,14 +103,13 @@ export default class Cache extends Service implements BudCache {
|
|
|
106
103
|
/**
|
|
107
104
|
* {@link BudCache.type}
|
|
108
105
|
*/
|
|
109
|
-
public get type():
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return this.app.hooks.filter(`build.cache.type`) ?? fallback
|
|
106
|
+
public get type(): `filesystem` | `memory` {
|
|
107
|
+
return (
|
|
108
|
+
this.app.hooks.filter(`build.cache.type`, `filesystem`) ??
|
|
109
|
+
`filesystem`
|
|
110
|
+
)
|
|
115
111
|
}
|
|
116
|
-
public set type(type: Callback
|
|
112
|
+
public set type(type: Callback<`filesystem` | `memory`>) {
|
|
117
113
|
this.app.hooks.on(`build.cache.type`, type)
|
|
118
114
|
}
|
|
119
115
|
|
|
@@ -130,6 +126,7 @@ export default class Cache extends Service implements BudCache {
|
|
|
130
126
|
/**
|
|
131
127
|
* {@link Service.boot}
|
|
132
128
|
*/
|
|
129
|
+
@bind
|
|
133
130
|
public override async boot?(bud: Bud) {
|
|
134
131
|
if (bud.context.force === true) {
|
|
135
132
|
await this.flush()
|
|
@@ -143,7 +140,12 @@ export default class Cache extends Service implements BudCache {
|
|
|
143
140
|
*/
|
|
144
141
|
public get configuration(): Configuration[`cache`] {
|
|
145
142
|
if (this.enabled !== true) return false
|
|
146
|
-
if (this.type === `memory`)
|
|
143
|
+
if (this.type === `memory`)
|
|
144
|
+
return {
|
|
145
|
+
cacheUnaffected: true,
|
|
146
|
+
maxGenerations: Infinity,
|
|
147
|
+
type: `memory`,
|
|
148
|
+
}
|
|
147
149
|
|
|
148
150
|
return {
|
|
149
151
|
allowCollectingMemory: this.allowCollectingMemory,
|
|
@@ -154,6 +156,7 @@ export default class Cache extends Service implements BudCache {
|
|
|
154
156
|
idleTimeout: 100,
|
|
155
157
|
idleTimeoutForInitialStore: 0,
|
|
156
158
|
managedPaths: [this.cacheDirectory, this.app.path(`@modules`)],
|
|
159
|
+
maxMemoryGenerations: Infinity,
|
|
157
160
|
name: this.name,
|
|
158
161
|
profile: this.app.context.debug === true,
|
|
159
162
|
store: `pack`,
|
|
@@ -197,6 +200,7 @@ export default class Cache extends Service implements BudCache {
|
|
|
197
200
|
/**
|
|
198
201
|
* {@link BudCache.register}
|
|
199
202
|
*/
|
|
203
|
+
@bind
|
|
200
204
|
public override async register?(bud: Bud) {
|
|
201
205
|
this.enabled = bud.context.cache !== false
|
|
202
206
|
this.version = bud.context.bud.version
|
|
@@ -238,7 +242,7 @@ export default class Cache extends Service implements BudCache {
|
|
|
238
242
|
/**
|
|
239
243
|
* Set {@link BudCache.type}
|
|
240
244
|
*/
|
|
241
|
-
public setType(type:
|
|
245
|
+
public setType(type: `filesystem` | `memory`) {
|
|
242
246
|
this.type = type
|
|
243
247
|
return this
|
|
244
248
|
}
|