@roots/bud-cache 6.15.2 → 6.16.1
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/lib/helpers.d.ts +1 -1
- package/lib/service.d.ts +20 -20
- package/lib/service.js +42 -42
- package/package.json +4 -4
- package/src/helpers.ts +11 -10
- package/src/service.ts +57 -61
package/lib/helpers.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { File } from
|
|
1
|
+
import type { File } from '@roots/bud-framework/context';
|
|
2
2
|
export declare const isBuildDependency: (file: File) => boolean;
|
package/lib/service.d.ts
CHANGED
|
@@ -10,15 +10,11 @@ export default class Cache extends Service implements BudCache {
|
|
|
10
10
|
* {@link BudCache.enabled}
|
|
11
11
|
*/
|
|
12
12
|
enabled: boolean;
|
|
13
|
-
set allowCollectingMemory(value: Callback<FileCacheOptions[`allowCollectingMemory`]>);
|
|
14
13
|
/**
|
|
15
14
|
* {@link BudCache.allowCollectingMemory}
|
|
16
15
|
*/
|
|
17
16
|
get allowCollectingMemory(): FileCacheOptions[`allowCollectingMemory`];
|
|
18
|
-
|
|
19
|
-
* {@link Service.boot}
|
|
20
|
-
*/
|
|
21
|
-
boot?(bud: Bud): Promise<void>;
|
|
17
|
+
set allowCollectingMemory(value: Callback<FileCacheOptions[`allowCollectingMemory`]>);
|
|
22
18
|
/**
|
|
23
19
|
*{@link BudCache.buildDependencies}
|
|
24
20
|
*/
|
|
@@ -29,6 +25,25 @@ export default class Cache extends Service implements BudCache {
|
|
|
29
25
|
*/
|
|
30
26
|
get cacheDirectory(): string;
|
|
31
27
|
set cacheDirectory(directory: Callback<FileCacheOptions[`cacheDirectory`]>);
|
|
28
|
+
/**
|
|
29
|
+
* {@link BudCache.name}
|
|
30
|
+
*/
|
|
31
|
+
get name(): string;
|
|
32
|
+
set name(name: string);
|
|
33
|
+
/**
|
|
34
|
+
* {@link BudCache.type}
|
|
35
|
+
*/
|
|
36
|
+
get type(): 'filesystem' | 'memory';
|
|
37
|
+
set type(type: Callback<FileCacheOptions[`type`]>);
|
|
38
|
+
/**
|
|
39
|
+
* {@link BudCache.version}
|
|
40
|
+
*/
|
|
41
|
+
get version(): string | undefined;
|
|
42
|
+
set version(version: string);
|
|
43
|
+
/**
|
|
44
|
+
* {@link Service.boot}
|
|
45
|
+
*/
|
|
46
|
+
boot?(bud: Bud): Promise<void>;
|
|
32
47
|
/**
|
|
33
48
|
* {@link BudCache.configuration}
|
|
34
49
|
* @readonly
|
|
@@ -56,11 +71,6 @@ export default class Cache extends Service implements BudCache {
|
|
|
56
71
|
* Get {@link BudCache.type}
|
|
57
72
|
*/
|
|
58
73
|
getType(): "filesystem" | "memory";
|
|
59
|
-
/**
|
|
60
|
-
* {@link BudCache.name}
|
|
61
|
-
*/
|
|
62
|
-
get name(): string;
|
|
63
|
-
set name(name: string);
|
|
64
74
|
/**
|
|
65
75
|
* {@link BudCache.register}
|
|
66
76
|
*/
|
|
@@ -81,14 +91,4 @@ export default class Cache extends Service implements BudCache {
|
|
|
81
91
|
* Set {@link BudCache.type}
|
|
82
92
|
*/
|
|
83
93
|
setType(type: Callback<FileCacheOptions[`type`]>): this;
|
|
84
|
-
set type(type: Callback<FileCacheOptions[`type`]>);
|
|
85
|
-
/**
|
|
86
|
-
* {@link BudCache.type}
|
|
87
|
-
*/
|
|
88
|
-
get type(): 'filesystem' | 'memory';
|
|
89
|
-
set version(version: string);
|
|
90
|
-
/**
|
|
91
|
-
* {@link BudCache.version}
|
|
92
|
-
*/
|
|
93
|
-
get version(): string | undefined;
|
|
94
94
|
}
|
package/lib/service.js
CHANGED
|
@@ -8,9 +8,6 @@ import isString from '@roots/bud-support/lodash/isString';
|
|
|
8
8
|
* {@link Bud.cache}
|
|
9
9
|
*/
|
|
10
10
|
export default class Cache extends Service {
|
|
11
|
-
set allowCollectingMemory(value) {
|
|
12
|
-
this.app.hooks.on(`build.cache.allowCollectingMemory`, value);
|
|
13
|
-
}
|
|
14
11
|
/**
|
|
15
12
|
* {@link BudCache.allowCollectingMemory}
|
|
16
13
|
*/
|
|
@@ -19,14 +16,8 @@ export default class Cache extends Service {
|
|
|
19
16
|
const value = this.app.hooks.filter(`build.cache.allowCollectingMemory`, fallback);
|
|
20
17
|
return typeof value === `boolean` ? value : fallback;
|
|
21
18
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*/
|
|
25
|
-
async boot(bud) {
|
|
26
|
-
if (bud.context.force === true) {
|
|
27
|
-
await this.flush();
|
|
28
|
-
}
|
|
29
|
-
this.enabled = bud.context.cache !== false;
|
|
19
|
+
set allowCollectingMemory(value) {
|
|
20
|
+
this.app.hooks.on(`build.cache.allowCollectingMemory`, value);
|
|
30
21
|
}
|
|
31
22
|
/**
|
|
32
23
|
*{@link BudCache.buildDependencies}
|
|
@@ -58,6 +49,46 @@ export default class Cache extends Service {
|
|
|
58
49
|
set cacheDirectory(directory) {
|
|
59
50
|
this.app.hooks.on(`build.cache.cacheDirectory`, directory);
|
|
60
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* {@link BudCache.name}
|
|
54
|
+
*/
|
|
55
|
+
get name() {
|
|
56
|
+
const fallback = join(this.app.mode, ...Object.values(this.app.context._ ?? {}));
|
|
57
|
+
return (this.app.hooks.filter(`build.cache.name`, this.app.hooks.filter(`build.name`, fallback)) ?? fallback);
|
|
58
|
+
}
|
|
59
|
+
set name(name) {
|
|
60
|
+
this.app.hooks.on(`build.cache.name`, name);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* {@link BudCache.type}
|
|
64
|
+
*/
|
|
65
|
+
get type() {
|
|
66
|
+
const fallback = isString(this.app.context.cache)
|
|
67
|
+
? this.app.context.cache
|
|
68
|
+
: `filesystem`;
|
|
69
|
+
return this.app.hooks.filter(`build.cache.type`) ?? fallback;
|
|
70
|
+
}
|
|
71
|
+
set type(type) {
|
|
72
|
+
this.app.hooks.on(`build.cache.type`, type);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* {@link BudCache.version}
|
|
76
|
+
*/
|
|
77
|
+
get version() {
|
|
78
|
+
return this.app.hooks.filter(`build.cache.version`, undefined);
|
|
79
|
+
}
|
|
80
|
+
set version(version) {
|
|
81
|
+
this.app.hooks.on(`build.cache.version`, version);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* {@link Service.boot}
|
|
85
|
+
*/
|
|
86
|
+
async boot(bud) {
|
|
87
|
+
if (bud.context.force === true) {
|
|
88
|
+
await this.flush();
|
|
89
|
+
}
|
|
90
|
+
this.enabled = bud.context.cache !== false;
|
|
91
|
+
}
|
|
61
92
|
/**
|
|
62
93
|
* {@link BudCache.configuration}
|
|
63
94
|
* @readonly
|
|
@@ -112,16 +143,6 @@ export default class Cache extends Service {
|
|
|
112
143
|
getType() {
|
|
113
144
|
return this.type;
|
|
114
145
|
}
|
|
115
|
-
/**
|
|
116
|
-
* {@link BudCache.name}
|
|
117
|
-
*/
|
|
118
|
-
get name() {
|
|
119
|
-
const fallback = join(this.app.mode, ...Object.values(this.app.context._ ?? {}));
|
|
120
|
-
return (this.app.hooks.filter(`build.cache.name`, this.app.hooks.filter(`build.name`, fallback)) ?? fallback);
|
|
121
|
-
}
|
|
122
|
-
set name(name) {
|
|
123
|
-
this.app.hooks.on(`build.cache.name`, name);
|
|
124
|
-
}
|
|
125
146
|
/**
|
|
126
147
|
* {@link BudCache.register}
|
|
127
148
|
*/
|
|
@@ -157,27 +178,6 @@ export default class Cache extends Service {
|
|
|
157
178
|
this.type = type;
|
|
158
179
|
return this;
|
|
159
180
|
}
|
|
160
|
-
set type(type) {
|
|
161
|
-
this.app.hooks.on(`build.cache.type`, type);
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* {@link BudCache.type}
|
|
165
|
-
*/
|
|
166
|
-
get type() {
|
|
167
|
-
const fallback = isString(this.app.context.cache)
|
|
168
|
-
? this.app.context.cache
|
|
169
|
-
: `filesystem`;
|
|
170
|
-
return this.app.hooks.filter(`build.cache.type`) ?? fallback;
|
|
171
|
-
}
|
|
172
|
-
set version(version) {
|
|
173
|
-
this.app.hooks.on(`build.cache.version`, version);
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* {@link BudCache.version}
|
|
177
|
-
*/
|
|
178
|
-
get version() {
|
|
179
|
-
return this.app.hooks.filter(`build.cache.version`, undefined);
|
|
180
|
-
}
|
|
181
181
|
}
|
|
182
182
|
__decorate([
|
|
183
183
|
bind
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roots/bud-cache",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.16.1",
|
|
4
4
|
"description": "Config caching",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16"
|
|
@@ -72,10 +72,10 @@
|
|
|
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.16.1",
|
|
76
|
+
"@roots/bud-support": "6.16.1",
|
|
77
77
|
"strip-ansi": "7.1.0",
|
|
78
|
-
"tslib": "2.6.
|
|
78
|
+
"tslib": "2.6.2"
|
|
79
79
|
},
|
|
80
80
|
"volta": {
|
|
81
81
|
"extends": "../../../package.json"
|
package/src/helpers.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {File} from '@roots/bud-framework/context'
|
|
2
2
|
|
|
3
|
-
export const isBuildDependency = (file: File): boolean =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
export const isBuildDependency = (file: File): boolean =>
|
|
4
|
+
[
|
|
5
|
+
`.npmrc`,
|
|
6
|
+
`.pnpmfile`,
|
|
7
|
+
`.yarnrc`,
|
|
8
|
+
`jsconfig`,
|
|
9
|
+
`package`,
|
|
10
|
+
`pnpm-workspace`,
|
|
11
|
+
`tsconfig`,
|
|
12
|
+
].includes(file.name) || file.bud
|
package/src/service.ts
CHANGED
|
@@ -23,12 +23,6 @@ export default class Cache extends Service implements BudCache {
|
|
|
23
23
|
* {@link BudCache.enabled}
|
|
24
24
|
*/
|
|
25
25
|
public declare enabled: boolean
|
|
26
|
-
public set allowCollectingMemory(
|
|
27
|
-
value: Callback<FileCacheOptions[`allowCollectingMemory`]>,
|
|
28
|
-
) {
|
|
29
|
-
this.app.hooks.on(`build.cache.allowCollectingMemory`, value)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
26
|
/**
|
|
33
27
|
* {@link BudCache.allowCollectingMemory}
|
|
34
28
|
*/
|
|
@@ -41,15 +35,10 @@ export default class Cache extends Service implements BudCache {
|
|
|
41
35
|
)
|
|
42
36
|
return typeof value === `boolean` ? value : fallback
|
|
43
37
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
public override async boot?(bud: Bud) {
|
|
49
|
-
if (bud.context.force === true) {
|
|
50
|
-
await this.flush()
|
|
51
|
-
}
|
|
52
|
-
this.enabled = bud.context.cache !== false
|
|
38
|
+
public set allowCollectingMemory(
|
|
39
|
+
value: Callback<FileCacheOptions[`allowCollectingMemory`]>,
|
|
40
|
+
) {
|
|
41
|
+
this.app.hooks.on(`build.cache.allowCollectingMemory`, value)
|
|
53
42
|
}
|
|
54
43
|
|
|
55
44
|
/**
|
|
@@ -89,13 +78,65 @@ export default class Cache extends Service implements BudCache {
|
|
|
89
78
|
fallback
|
|
90
79
|
)
|
|
91
80
|
}
|
|
92
|
-
|
|
93
81
|
public set cacheDirectory(
|
|
94
82
|
directory: Callback<FileCacheOptions[`cacheDirectory`]>,
|
|
95
83
|
) {
|
|
96
84
|
this.app.hooks.on(`build.cache.cacheDirectory`, directory)
|
|
97
85
|
}
|
|
98
86
|
|
|
87
|
+
/**
|
|
88
|
+
* {@link BudCache.name}
|
|
89
|
+
*/
|
|
90
|
+
public get name(): string {
|
|
91
|
+
const fallback = join(
|
|
92
|
+
this.app.mode,
|
|
93
|
+
...Object.values(this.app.context._ ?? {}),
|
|
94
|
+
)
|
|
95
|
+
return (
|
|
96
|
+
this.app.hooks.filter(
|
|
97
|
+
`build.cache.name`,
|
|
98
|
+
this.app.hooks.filter(`build.name`, fallback),
|
|
99
|
+
) ?? fallback
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
public set name(name: string) {
|
|
103
|
+
this.app.hooks.on(`build.cache.name`, name)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* {@link BudCache.type}
|
|
108
|
+
*/
|
|
109
|
+
public get type(): 'filesystem' | 'memory' {
|
|
110
|
+
const fallback = isString(this.app.context.cache)
|
|
111
|
+
? this.app.context.cache
|
|
112
|
+
: `filesystem`
|
|
113
|
+
|
|
114
|
+
return this.app.hooks.filter(`build.cache.type`) ?? fallback
|
|
115
|
+
}
|
|
116
|
+
public set type(type: Callback<FileCacheOptions[`type`]>) {
|
|
117
|
+
this.app.hooks.on(`build.cache.type`, type)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* {@link BudCache.version}
|
|
122
|
+
*/
|
|
123
|
+
public get version(): string | undefined {
|
|
124
|
+
return this.app.hooks.filter(`build.cache.version`, undefined)
|
|
125
|
+
}
|
|
126
|
+
public set version(version: string) {
|
|
127
|
+
this.app.hooks.on(`build.cache.version`, version)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* {@link Service.boot}
|
|
132
|
+
*/
|
|
133
|
+
public override async boot?(bud: Bud) {
|
|
134
|
+
if (bud.context.force === true) {
|
|
135
|
+
await this.flush()
|
|
136
|
+
}
|
|
137
|
+
this.enabled = bud.context.cache !== false
|
|
138
|
+
}
|
|
139
|
+
|
|
99
140
|
/**
|
|
100
141
|
* {@link BudCache.configuration}
|
|
101
142
|
* @readonly
|
|
@@ -153,26 +194,6 @@ export default class Cache extends Service implements BudCache {
|
|
|
153
194
|
return this.type
|
|
154
195
|
}
|
|
155
196
|
|
|
156
|
-
/**
|
|
157
|
-
* {@link BudCache.name}
|
|
158
|
-
*/
|
|
159
|
-
public get name(): string {
|
|
160
|
-
const fallback = join(
|
|
161
|
-
this.app.mode,
|
|
162
|
-
...Object.values(this.app.context._ ?? {}),
|
|
163
|
-
)
|
|
164
|
-
return (
|
|
165
|
-
this.app.hooks.filter(
|
|
166
|
-
`build.cache.name`,
|
|
167
|
-
this.app.hooks.filter(`build.name`, fallback),
|
|
168
|
-
) ?? fallback
|
|
169
|
-
)
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
public set name(name: string) {
|
|
173
|
-
this.app.hooks.on(`build.cache.name`, name)
|
|
174
|
-
}
|
|
175
|
-
|
|
176
197
|
/**
|
|
177
198
|
* {@link BudCache.register}
|
|
178
199
|
*/
|
|
@@ -221,29 +242,4 @@ export default class Cache extends Service implements BudCache {
|
|
|
221
242
|
this.type = type
|
|
222
243
|
return this
|
|
223
244
|
}
|
|
224
|
-
|
|
225
|
-
public set type(type: Callback<FileCacheOptions[`type`]>) {
|
|
226
|
-
this.app.hooks.on(`build.cache.type`, type)
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* {@link BudCache.type}
|
|
231
|
-
*/
|
|
232
|
-
public get type(): 'filesystem' | 'memory' {
|
|
233
|
-
const fallback = isString(this.app.context.cache)
|
|
234
|
-
? this.app.context.cache
|
|
235
|
-
: `filesystem`
|
|
236
|
-
|
|
237
|
-
return this.app.hooks.filter(`build.cache.type`) ?? fallback
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
public set version(version: string) {
|
|
241
|
-
this.app.hooks.on(`build.cache.version`, version)
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* {@link BudCache.version}
|
|
245
|
-
*/
|
|
246
|
-
public get version(): string | undefined {
|
|
247
|
-
return this.app.hooks.filter(`build.cache.version`, undefined)
|
|
248
|
-
}
|
|
249
245
|
}
|