@roots/bud-cache 2023.6.29-129 → 2023.7.5-148

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.
@@ -7,20 +7,20 @@ import { Service } from '@roots/bud-framework/service';
7
7
  */
8
8
  export default class Cache extends Service implements BudCache {
9
9
  /**
10
- * Enabled
10
+ * {@link BudCache.enabled}
11
11
  */
12
12
  enabled: boolean;
13
13
  /**
14
14
  * {@link Extension.boot}
15
15
  */
16
- boot(bud: Bud): Promise<void>;
16
+ boot?(bud: Bud): Promise<void>;
17
17
  /**
18
18
  *{@link BudCache.buildDependencies}
19
19
  */
20
20
  get buildDependencies(): Record<string, Array<string>>;
21
21
  set buildDependencies(dependencies: Record<string, Array<string>>);
22
22
  /**
23
- * Cache directory
23
+ * {@link BudCache.cacheDirectory}
24
24
  */
25
25
  get cacheDirectory(): string;
26
26
  set cacheDirectory(directory: string);
@@ -30,7 +30,7 @@ export default class Cache extends Service implements BudCache {
30
30
  */
31
31
  get configuration(): Configuration[`cache`];
32
32
  /**
33
- * Flush cache
33
+ * {@link BudCache.flush}
34
34
  */
35
35
  flush(): Promise<void>;
36
36
  /**
@@ -38,14 +38,17 @@ export default class Cache extends Service implements BudCache {
38
38
  */
39
39
  get name(): string;
40
40
  set name(name: string);
41
- register(bud: Bud): Promise<void>;
42
41
  /**
43
- * Type
42
+ * {@link BudCache.register}
43
+ */
44
+ register?(bud: Bud): Promise<void>;
45
+ /**
46
+ * {@link BudCache.type}
44
47
  */
45
48
  get type(): 'filesystem' | 'memory';
46
49
  set type(type: 'filesystem' | 'memory');
47
50
  /**
48
- * version
51
+ * {@link BudCache.version}
49
52
  */
50
53
  get version(): string;
51
54
  set version(version: string);
@@ -1,14 +1,14 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
+ import { join } from 'node:path';
2
3
  import { Service } from '@roots/bud-framework/service';
3
4
  import { bind } from '@roots/bud-support/decorators/bind';
4
5
  import isString from '@roots/bud-support/lodash/isString';
5
- import { join } from 'node:path';
6
6
  /**
7
7
  * Cache service class
8
8
  */
9
9
  export default class Cache extends Service {
10
10
  /**
11
- * Enabled
11
+ * {@link BudCache.enabled}
12
12
  */
13
13
  enabled;
14
14
  /**
@@ -37,7 +37,7 @@ export default class Cache extends Service {
37
37
  this.app.hooks.on(`build.cache.buildDependencies`, dependencies);
38
38
  }
39
39
  /**
40
- * Cache directory
40
+ * {@link BudCache.cacheDirectory}
41
41
  */
42
42
  get cacheDirectory() {
43
43
  return this.app.hooks.filter(`build.cache.cacheDirectory`, this.app.path(`@storage`, this.app.label, `cache`));
@@ -70,7 +70,7 @@ export default class Cache extends Service {
70
70
  };
71
71
  }
72
72
  /**
73
- * Flush cache
73
+ * {@link BudCache.flush}
74
74
  */
75
75
  async flush() {
76
76
  await this.app.fs.remove(this.cacheDirectory);
@@ -84,12 +84,15 @@ export default class Cache extends Service {
84
84
  set name(name) {
85
85
  this.app.hooks.on(`build.cache.name`, name);
86
86
  }
87
+ /**
88
+ * {@link BudCache.register}
89
+ */
87
90
  async register(bud) {
88
91
  this.enabled = bud.context.cache !== false;
89
92
  this.version = bud.context.bud.version;
90
93
  }
91
94
  /**
92
- * Type
95
+ * {@link BudCache.type}
93
96
  */
94
97
  get type() {
95
98
  return this.app.hooks.filter(`build.cache.type`, isString(this.app.context.cache)
@@ -100,7 +103,7 @@ export default class Cache extends Service {
100
103
  this.app.hooks.on(`build.cache.type`, type);
101
104
  }
102
105
  /**
103
- * version
106
+ * {@link BudCache.version}
104
107
  */
105
108
  get version() {
106
109
  return this.app.hooks.filter(`build.cache.version`, undefined);
@@ -109,21 +112,9 @@ export default class Cache extends Service {
109
112
  this.app.hooks.on(`build.cache.version`, version);
110
113
  }
111
114
  }
112
- __decorate([
113
- bind,
114
- __metadata("design:type", Function),
115
- __metadata("design:paramtypes", [Function]),
116
- __metadata("design:returntype", Promise)
117
- ], Cache.prototype, "boot", null);
118
115
  __decorate([
119
116
  bind,
120
117
  __metadata("design:type", Function),
121
118
  __metadata("design:paramtypes", []),
122
119
  __metadata("design:returntype", Promise)
123
120
  ], Cache.prototype, "flush", null);
124
- __decorate([
125
- bind,
126
- __metadata("design:type", Function),
127
- __metadata("design:paramtypes", [Function]),
128
- __metadata("design:returntype", Promise)
129
- ], Cache.prototype, "register", null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roots/bud-cache",
3
- "version": "2023.6.29-129",
3
+ "version": "2023.7.5-148",
4
4
  "description": "Config caching",
5
5
  "engines": {
6
6
  "node": ">=16"
@@ -85,10 +85,10 @@
85
85
  "@skypack/package-check": "0.2.2"
86
86
  },
87
87
  "dependencies": {
88
- "@roots/bud-framework": "2023.6.29-129",
89
- "@roots/bud-support": "2023.6.29-129",
88
+ "@roots/bud-framework": "2023.7.5-148",
89
+ "@roots/bud-support": "2023.7.5-148",
90
90
  "strip-ansi": "7.1.0",
91
- "tslib": "2.5.3"
91
+ "tslib": "2.6.0"
92
92
  },
93
93
  "volta": {
94
94
  "extends": "../../../package.json"
@@ -2,25 +2,25 @@ import type {Bud} from '@roots/bud-framework'
2
2
  import type {Configuration} from '@roots/bud-framework/config'
3
3
  import type {Cache as BudCache} from '@roots/bud-framework/services'
4
4
 
5
+ import {join} from 'node:path'
6
+
5
7
  import {Service} from '@roots/bud-framework/service'
6
8
  import {bind} from '@roots/bud-support/decorators/bind'
7
9
  import isString from '@roots/bud-support/lodash/isString'
8
- import {join} from 'node:path'
9
10
 
10
11
  /**
11
12
  * Cache service class
12
13
  */
13
14
  export default class Cache extends Service implements BudCache {
14
15
  /**
15
- * Enabled
16
+ * {@link BudCache.enabled}
16
17
  */
17
18
  public enabled: boolean
18
19
 
19
20
  /**
20
21
  * {@link Extension.boot}
21
22
  */
22
- @bind
23
- public override async boot(bud: Bud) {
23
+ public override async boot?(bud: Bud) {
24
24
  if (bud.context.force === true) {
25
25
  await this.flush()
26
26
  }
@@ -47,7 +47,7 @@ export default class Cache extends Service implements BudCache {
47
47
  }
48
48
 
49
49
  /**
50
- * Cache directory
50
+ * {@link BudCache.cacheDirectory}
51
51
  */
52
52
  public get cacheDirectory(): string {
53
53
  return this.app.hooks.filter(
@@ -82,8 +82,9 @@ export default class Cache extends Service implements BudCache {
82
82
  type: this.type,
83
83
  }
84
84
  }
85
+
85
86
  /**
86
- * Flush cache
87
+ * {@link BudCache.flush}
87
88
  */
88
89
  @bind
89
90
  public async flush(): Promise<void> {
@@ -106,14 +107,16 @@ export default class Cache extends Service implements BudCache {
106
107
  this.app.hooks.on(`build.cache.name`, name)
107
108
  }
108
109
 
109
- @bind
110
- public override async register(bud: Bud) {
110
+ /**
111
+ * {@link BudCache.register}
112
+ */
113
+ public override async register?(bud: Bud) {
111
114
  this.enabled = bud.context.cache !== false
112
115
  this.version = bud.context.bud.version
113
116
  }
114
117
 
115
118
  /**
116
- * Type
119
+ * {@link BudCache.type}
117
120
  */
118
121
  public get type(): 'filesystem' | 'memory' {
119
122
  return this.app.hooks.filter(
@@ -128,7 +131,7 @@ export default class Cache extends Service implements BudCache {
128
131
  }
129
132
 
130
133
  /**
131
- * version
134
+ * {@link BudCache.version}
132
135
  */
133
136
  public get version(): string {
134
137
  return this.app.hooks.filter(`build.cache.version`, undefined)