@roots/bud-cache 6.12.3 → 6.13.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.
@@ -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 || (bud.isCLI() && bud.context.args.force)) {
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
  }
@@ -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.booted}
43
+ * {@link Extension.boot}
44
44
  */
45
- booted?(bud: Bud): Promise<void>;
45
+ boot(bud: Bud): Promise<void>;
46
46
  /**
47
47
  * Flush cache
48
48
  */
@@ -10,13 +10,10 @@ import InvalidateCacheExtension from '../invalidate-cache/index.js';
10
10
  * Cache service class
11
11
  */
12
12
  export default class Cache extends Service {
13
- constructor() {
14
- super(...arguments);
15
- /**
16
- * Enabled
17
- */
18
- this.enabled = true;
19
- }
13
+ /**
14
+ * Enabled
15
+ */
16
+ enabled = true;
20
17
  /**
21
18
  * Type
22
19
  */
@@ -30,8 +27,8 @@ export default class Cache extends Service {
30
27
  * Type
31
28
  */
32
29
  get type() {
33
- return this.app.hooks.filter(`build.cache.type`, this.app.isCLI() && isString(this.app.context.args.cache)
34
- ? this.app.context.args.cache
30
+ return this.app.hooks.filter(`build.cache.type`, isString(this.app.context.cache)
31
+ ? this.app.context.cache
35
32
  : `filesystem`);
36
33
  }
37
34
  set type(type) {
@@ -93,14 +90,14 @@ export default class Cache extends Service {
93
90
  cacheDirectory: this.cacheDirectory,
94
91
  idleTimeout: 10000,
95
92
  idleTimeoutForInitialStore: 0,
96
- profile: false,
93
+ profile: this.app.context.debug === true,
97
94
  version: this.app.hooks.filter(`build.cache.version`, this.version),
98
95
  };
99
96
  }
100
97
  /**
101
- * {@link Extension.booted}
98
+ * {@link Extension.boot}
102
99
  */
103
- async booted(bud) {
100
+ async boot(bud) {
104
101
  await bud.extensions.add(InvalidateCacheExtension);
105
102
  this.logger.success(`cache initialized`);
106
103
  }
@@ -116,7 +113,7 @@ __decorate([
116
113
  __metadata("design:type", Function),
117
114
  __metadata("design:paramtypes", [Function]),
118
115
  __metadata("design:returntype", Promise)
119
- ], Cache.prototype, "booted", null);
116
+ ], Cache.prototype, "boot", null);
120
117
  __decorate([
121
118
  bind,
122
119
  __metadata("design:type", Function),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roots/bud-cache",
3
- "version": "6.12.3",
3
+ "version": "6.13.0",
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": "6.12.3",
89
- "@roots/bud-support": "6.12.3",
88
+ "@roots/bud-framework": "6.13.0",
89
+ "@roots/bud-support": "6.13.0",
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 || (bud.isCLI() && bud.context.args.force)) {
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
  }
@@ -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
- this.app.isCLI() && isString(this.app.context.args.cache)
46
- ? this.app.context.args.cache
45
+ isString(this.app.context.cache)
46
+ ? this.app.context.cache
47
47
  : `filesystem`,
48
48
  )
49
49
  }
@@ -119,16 +119,16 @@ export default class Cache
119
119
  cacheDirectory: this.cacheDirectory,
120
120
  idleTimeout: 10000,
121
121
  idleTimeoutForInitialStore: 0,
122
- profile: false,
122
+ profile: this.app.context.debug === true,
123
123
  version: this.app.hooks.filter(`build.cache.version`, this.version),
124
124
  }
125
125
  }
126
126
 
127
127
  /**
128
- * {@link Extension.booted}
128
+ * {@link Extension.boot}
129
129
  */
130
130
  @bind
131
- public override async booted?(bud: Bud) {
131
+ public override async boot(bud: Bud) {
132
132
  await bud.extensions.add(InvalidateCacheExtension)
133
133
  this.logger.success(`cache initialized`)
134
134
  }