@atlaspack/cache 3.1.1-canary.32 → 3.1.1-canary.323
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/CHANGELOG.md +353 -0
- package/dist/FSCache.js +171 -0
- package/dist/IDBCache.browser.js +123 -0
- package/dist/IDBCache.js +10 -0
- package/dist/LMDBLiteCache.js +223 -0
- package/dist/constants.js +5 -0
- package/dist/index.js +19 -0
- package/dist/types.js +2 -0
- package/lib/FSCache.js +35 -3
- package/lib/IDBCache.browser.js +7 -6
- package/lib/IDBCache.js +1 -1
- package/lib/LMDBLiteCache.js +71 -41
- package/lib/types/FSCache.d.ts +27 -0
- package/lib/types/IDBCache.browser.d.ts +22 -0
- package/lib/types/IDBCache.d.ts +4 -0
- package/lib/types/LMDBLiteCache.d.ts +78 -0
- package/lib/types/constants.d.ts +1 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/types.d.ts +2 -0
- package/package.json +13 -14
- package/src/{FSCache.js → FSCache.ts} +30 -15
- package/src/{IDBCache.browser.js → IDBCache.browser.ts} +8 -10
- package/src/{IDBCache.js → IDBCache.ts} +1 -2
- package/src/{LMDBLiteCache.js → LMDBLiteCache.ts} +80 -39
- package/src/{constants.js → constants.ts} +0 -2
- package/src/{index.js → index.ts} +0 -2
- package/src/{types.js → types.ts} +0 -1
- package/test/LMDBLiteCache.test.ts +241 -0
- package/test/workerThreadsTest.js +42 -0
- package/tsconfig.json +27 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/index.d.ts +0 -12
- package/lib/types.d.ts +0 -2
- package/test/LMDBLiteCache.test.js +0 -69
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,358 @@
|
|
|
1
1
|
# @atlaspack/cache
|
|
2
2
|
|
|
3
|
+
## 3.2.36
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`96f1d7f`](https://github.com/atlassian-labs/atlaspack/commit/96f1d7f3efef12ce4f5966e34d00b299fcefb4dd), [`91738fd`](https://github.com/atlassian-labs/atlaspack/commit/91738fd77cb6b3b7acc93e799327ec283d27f7c0), [`38f3569`](https://github.com/atlassian-labs/atlaspack/commit/38f3569a7024357c43274666312bc6d024bfe5f9), [`3f6a3b8`](https://github.com/atlassian-labs/atlaspack/commit/3f6a3b8df4589fd4d65c072281c7f33bd37341d6), [`96f1d7f`](https://github.com/atlassian-labs/atlaspack/commit/96f1d7f3efef12ce4f5966e34d00b299fcefb4dd), [`d8024ce`](https://github.com/atlassian-labs/atlaspack/commit/d8024ce5c9ced1a9bc39144c979138be3a12b2fb), [`308e7ff`](https://github.com/atlassian-labs/atlaspack/commit/308e7ff979c05c1ae97fe6b08a65666b53d86cc7), [`d98c992`](https://github.com/atlassian-labs/atlaspack/commit/d98c992a56121a4f9f6a011ced5e103f96fe3999)]:
|
|
8
|
+
- @atlaspack/rust@3.13.0
|
|
9
|
+
- @atlaspack/feature-flags@2.27.2
|
|
10
|
+
- @atlaspack/fs@2.15.36
|
|
11
|
+
- @atlaspack/logger@2.14.33
|
|
12
|
+
- @atlaspack/utils@3.2.2
|
|
13
|
+
|
|
14
|
+
## 3.2.35
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`a884bd2`](https://github.com/atlassian-labs/atlaspack/commit/a884bd2a6bd6f37d088fb886dd9b88e85328501b), [`25fee72`](https://github.com/atlassian-labs/atlaspack/commit/25fee723d2228d0482ec8a8f1b8379ccd2977ce7), [`6fac01d`](https://github.com/atlassian-labs/atlaspack/commit/6fac01dbb1bfc5b971176c1a1c008297bf4b8f91), [`2f3af93`](https://github.com/atlassian-labs/atlaspack/commit/2f3af9374bcc082e6f4835f6f5a2b98e32ea45b4), [`432d571`](https://github.com/atlassian-labs/atlaspack/commit/432d571ea4e9fc67be12304fcafe8c445e844174), [`042cd95`](https://github.com/atlassian-labs/atlaspack/commit/042cd95a32ad38cd02d57aa3344c36d4e7ab8f9c), [`28f5424`](https://github.com/atlassian-labs/atlaspack/commit/28f5424f7e2080dd4fbbeb1bc5314a530197a23e), [`a884bd2`](https://github.com/atlassian-labs/atlaspack/commit/a884bd2a6bd6f37d088fb886dd9b88e85328501b), [`5710532`](https://github.com/atlassian-labs/atlaspack/commit/57105322b26ce42af2cbfcc0506cff929e50b630), [`44eb8c3`](https://github.com/atlassian-labs/atlaspack/commit/44eb8c388d3e63f1ef5d835aee7aee5d1bb0620f)]:
|
|
19
|
+
- @atlaspack/rust@3.12.0
|
|
20
|
+
- @atlaspack/feature-flags@2.27.1
|
|
21
|
+
- @atlaspack/fs@2.15.35
|
|
22
|
+
- @atlaspack/logger@2.14.32
|
|
23
|
+
- @atlaspack/utils@3.2.1
|
|
24
|
+
|
|
25
|
+
## 3.2.34
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [[`7dd5bd8`](https://github.com/atlassian-labs/atlaspack/commit/7dd5bd89ff60c7b324347d772729eb4c3314f01e), [`c8a0e51`](https://github.com/atlassian-labs/atlaspack/commit/c8a0e51b1096d038a64644ad02fe68383f58682a), [`8eb84ee`](https://github.com/atlassian-labs/atlaspack/commit/8eb84ee61a42bfe87c58079b610802b07a6a13e4), [`71900f3`](https://github.com/atlassian-labs/atlaspack/commit/71900f3508d53c3882ca8ea71501ba3069687d4e), [`73168c2`](https://github.com/atlassian-labs/atlaspack/commit/73168c275a5d9abff9907bcf536b340bca1ed5f0), [`617a318`](https://github.com/atlassian-labs/atlaspack/commit/617a318ddc9419b38360257353fec50b9051ee13), [`2c4953e`](https://github.com/atlassian-labs/atlaspack/commit/2c4953e20dc1a6b012792081667aefeb9340505e), [`3fe7d4e`](https://github.com/atlassian-labs/atlaspack/commit/3fe7d4e821bee162fcbbaf9278b107a5eead944f)]:
|
|
30
|
+
- @atlaspack/rust@3.11.0
|
|
31
|
+
- @atlaspack/feature-flags@2.27.0
|
|
32
|
+
- @atlaspack/utils@3.2.0
|
|
33
|
+
- @atlaspack/fs@2.15.34
|
|
34
|
+
- @atlaspack/logger@2.14.31
|
|
35
|
+
|
|
36
|
+
## 3.2.33
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [[`ec3abe4`](https://github.com/atlassian-labs/atlaspack/commit/ec3abe4dffc98560a850fd2f71fb566577e6c99c), [`c7fe3f7`](https://github.com/atlassian-labs/atlaspack/commit/c7fe3f76f247e9e20299e205e2df0a16c418eaf2), [`cfb4707`](https://github.com/atlassian-labs/atlaspack/commit/cfb4707087498e4fa4dcf10753fe984a248d196b), [`1468695`](https://github.com/atlassian-labs/atlaspack/commit/1468695fc0c9d06f060a6da9e9b0e154f11dff34), [`f31b041`](https://github.com/atlassian-labs/atlaspack/commit/f31b04107e9077c9946aadb99f6f91bb69703bb7), [`8180981`](https://github.com/atlassian-labs/atlaspack/commit/8180981be14c00f9570adb70d3f350bd91d6ec0a), [`ae77e74`](https://github.com/atlassian-labs/atlaspack/commit/ae77e7452a466b43b3fa5bed24d4ba26345ed765), [`f0a496f`](https://github.com/atlassian-labs/atlaspack/commit/f0a496f70fc8652e090cf1b3f6260e8cfbb796e2), [`7d7a55d`](https://github.com/atlassian-labs/atlaspack/commit/7d7a55dd6395ec391a2e4c33b3dec0d1ea477d4c), [`540f253`](https://github.com/atlassian-labs/atlaspack/commit/540f253dfdcd1a5caebbdc0b197319d439404aae)]:
|
|
41
|
+
- @atlaspack/feature-flags@2.26.2
|
|
42
|
+
- @atlaspack/rust@3.10.0
|
|
43
|
+
- @atlaspack/utils@3.1.2
|
|
44
|
+
- @atlaspack/fs@2.15.33
|
|
45
|
+
- @atlaspack/logger@2.14.30
|
|
46
|
+
|
|
47
|
+
## 3.2.32
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- Updated dependencies [[`339b600`](https://github.com/atlassian-labs/atlaspack/commit/339b60095d755742cea50f811d08ccc44a4ae521), [`373ee2d`](https://github.com/atlassian-labs/atlaspack/commit/373ee2d3b5cc315df1e90e647619f915892e2b87)]:
|
|
52
|
+
- @atlaspack/rust@3.9.1
|
|
53
|
+
- @atlaspack/feature-flags@2.26.1
|
|
54
|
+
- @atlaspack/fs@2.15.32
|
|
55
|
+
- @atlaspack/logger@2.14.29
|
|
56
|
+
- @atlaspack/utils@3.1.1
|
|
57
|
+
|
|
58
|
+
## 3.2.31
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- Updated dependencies [[`02f6aa1`](https://github.com/atlassian-labs/atlaspack/commit/02f6aa1906953fc184d2b49c905c2ef815cb878d), [`58527ee`](https://github.com/atlassian-labs/atlaspack/commit/58527eec15c1aebaaadbeb63586f3082c16beae3), [`525898e`](https://github.com/atlassian-labs/atlaspack/commit/525898e33cc229a4bc938ae853732be36d20c01a), [`cfb39a0`](https://github.com/atlassian-labs/atlaspack/commit/cfb39a0d729eb620cf2ca1611750a2bf7a080d08), [`d0c7bea`](https://github.com/atlassian-labs/atlaspack/commit/d0c7bea04458255b4c5d4299600e734b5f919fe1), [`1086c6a`](https://github.com/atlassian-labs/atlaspack/commit/1086c6a2c59271b63b3fb78e6acdb9d3a0dbf354), [`9cd9521`](https://github.com/atlassian-labs/atlaspack/commit/9cd9521978f783046e2ae4ce78f2de7aeb07d073), [`5776be2`](https://github.com/atlassian-labs/atlaspack/commit/5776be21f70a3f2b9471ba33da3ba1a883f21f1a)]:
|
|
63
|
+
- @atlaspack/rust@3.9.0
|
|
64
|
+
- @atlaspack/feature-flags@2.26.0
|
|
65
|
+
- @atlaspack/utils@3.1.0
|
|
66
|
+
- @atlaspack/fs@2.15.31
|
|
67
|
+
- @atlaspack/logger@2.14.28
|
|
68
|
+
|
|
69
|
+
## 3.2.30
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Updated dependencies [[`79a7e22`](https://github.com/atlassian-labs/atlaspack/commit/79a7e22ef119891a2f4180a9d3cc66b38dd52092), [`3da8e69`](https://github.com/atlassian-labs/atlaspack/commit/3da8e690605472d81c531366b65fa9844f8ca337), [`c372f3f`](https://github.com/atlassian-labs/atlaspack/commit/c372f3fd6fce8200d5cf47f41bc7895c6cbb5558), [`17dfea9`](https://github.com/atlassian-labs/atlaspack/commit/17dfea9e9f3169807808520df9c09ebf70dc8b10), [`f1070ec`](https://github.com/atlassian-labs/atlaspack/commit/f1070ec48e99b4ec111a03179c5ab5b74163fab1), [`27fd73f`](https://github.com/atlassian-labs/atlaspack/commit/27fd73fa07d358653f1be6f2d15d72dc5d8fc2fd), [`3091fa3`](https://github.com/atlassian-labs/atlaspack/commit/3091fa36425ecffe3938e55247a035b08cda37a2)]:
|
|
74
|
+
- @atlaspack/feature-flags@2.25.5
|
|
75
|
+
- @atlaspack/rust@3.8.3
|
|
76
|
+
- @atlaspack/utils@3.0.3
|
|
77
|
+
- @atlaspack/fs@2.15.30
|
|
78
|
+
- @atlaspack/logger@2.14.27
|
|
79
|
+
|
|
80
|
+
## 3.2.29
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [[`662d3c6`](https://github.com/atlassian-labs/atlaspack/commit/662d3c627888b16bf27df15cfac5a9094509e93d)]:
|
|
85
|
+
- @atlaspack/feature-flags@2.25.4
|
|
86
|
+
- @atlaspack/fs@2.15.29
|
|
87
|
+
- @atlaspack/utils@3.0.2
|
|
88
|
+
- @atlaspack/logger@2.14.26
|
|
89
|
+
|
|
90
|
+
## 3.2.28
|
|
91
|
+
|
|
92
|
+
### Patch Changes
|
|
93
|
+
|
|
94
|
+
- Updated dependencies [[`236e546`](https://github.com/atlassian-labs/atlaspack/commit/236e5465863dca6044a7191e05260a5b924c342e), [`f07351a`](https://github.com/atlassian-labs/atlaspack/commit/f07351a2398b6a8e5155a2daad77e69b7dcb2b4b)]:
|
|
95
|
+
- @atlaspack/utils@3.0.1
|
|
96
|
+
- @atlaspack/feature-flags@2.25.3
|
|
97
|
+
- @atlaspack/fs@2.15.28
|
|
98
|
+
- @atlaspack/logger@2.14.25
|
|
99
|
+
|
|
100
|
+
## 3.2.27
|
|
101
|
+
|
|
102
|
+
### Patch Changes
|
|
103
|
+
|
|
104
|
+
- Updated dependencies [[`0207171`](https://github.com/atlassian-labs/atlaspack/commit/0207171e59e985c51e105aec2e0a99de174374bd), [`10ee3fa`](https://github.com/atlassian-labs/atlaspack/commit/10ee3fa5b75a92acde8973673d9b3c5b6f3958e5), [`bbe4e28`](https://github.com/atlassian-labs/atlaspack/commit/bbe4e28c89e5e9284bd730075d4d6f2a3cb37b21), [`1180103`](https://github.com/atlassian-labs/atlaspack/commit/118010351ed444f8178988afb3f77807154dd933), [`2bc93b1`](https://github.com/atlassian-labs/atlaspack/commit/2bc93b17cea07fd7cbb68acec84d8471345a22b4)]:
|
|
105
|
+
- @atlaspack/feature-flags@2.25.2
|
|
106
|
+
- @atlaspack/rust@3.8.2
|
|
107
|
+
- @atlaspack/utils@3.0.0
|
|
108
|
+
- @atlaspack/fs@2.15.27
|
|
109
|
+
- @atlaspack/logger@2.14.24
|
|
110
|
+
|
|
111
|
+
## 3.2.26
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- [#785](https://github.com/atlassian-labs/atlaspack/pull/785) [`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922) Thanks [@matt-koko](https://github.com/matt-koko)! - We need to re-publish every package in Atlaspack with the corrected types field.
|
|
116
|
+
|
|
117
|
+
- Updated dependencies [[`0e7dd5e`](https://github.com/atlassian-labs/atlaspack/commit/0e7dd5ec6fbe05aa9e0bb5775a9d0975f206a922), [`686a398`](https://github.com/atlassian-labs/atlaspack/commit/686a398faa1f9e19cbf9274add2c46e246bafba8)]:
|
|
118
|
+
- @atlaspack/build-cache@2.13.6
|
|
119
|
+
- @atlaspack/feature-flags@2.25.1
|
|
120
|
+
- @atlaspack/fs@2.15.26
|
|
121
|
+
- @atlaspack/logger@2.14.23
|
|
122
|
+
- @atlaspack/rust@3.8.1
|
|
123
|
+
- @atlaspack/utils@2.19.3
|
|
124
|
+
|
|
125
|
+
## 3.2.25
|
|
126
|
+
|
|
127
|
+
### Patch Changes
|
|
128
|
+
|
|
129
|
+
- Updated dependencies [[`7a52bab`](https://github.com/atlassian-labs/atlaspack/commit/7a52bab6281e8edbfa66af248eb6f872c6b4b7bd), [`eedcbc4`](https://github.com/atlassian-labs/atlaspack/commit/eedcbc408fc1e86a2a8e25f1a41c57146d8529e1), [`5a0363f`](https://github.com/atlassian-labs/atlaspack/commit/5a0363f1086e81068959b87e92064bed5a11a9b4), [`038e87a`](https://github.com/atlassian-labs/atlaspack/commit/038e87a7858d39556d59d3a2d17db534d45f62c6), [`f6532d7`](https://github.com/atlassian-labs/atlaspack/commit/f6532d7a4f7f007bd4e5e36af04dd466f0b9f572), [`0684997`](https://github.com/atlassian-labs/atlaspack/commit/0684997c127a6204af1376b36e556fddd1ba5557), [`602f8ed`](https://github.com/atlassian-labs/atlaspack/commit/602f8ed9d8381301df8b2cc82c1d5cf6f2f94fec)]:
|
|
130
|
+
- @atlaspack/feature-flags@2.25.0
|
|
131
|
+
- @atlaspack/rust@3.8.0
|
|
132
|
+
- @atlaspack/fs@2.15.25
|
|
133
|
+
- @atlaspack/utils@2.19.2
|
|
134
|
+
- @atlaspack/logger@2.14.22
|
|
135
|
+
|
|
136
|
+
## 3.2.24
|
|
137
|
+
|
|
138
|
+
### Patch Changes
|
|
139
|
+
|
|
140
|
+
- Updated dependencies [[`830261d`](https://github.com/atlassian-labs/atlaspack/commit/830261dcf4a40293090b61cab52fd75d5683c73f), [`53dd47b`](https://github.com/atlassian-labs/atlaspack/commit/53dd47bd6d23cd47f87297347f03a609ab38a03d)]:
|
|
141
|
+
- @atlaspack/feature-flags@2.24.1
|
|
142
|
+
- @atlaspack/rust@3.7.0
|
|
143
|
+
- @atlaspack/fs@2.15.24
|
|
144
|
+
- @atlaspack/utils@2.19.1
|
|
145
|
+
- @atlaspack/logger@2.14.21
|
|
146
|
+
|
|
147
|
+
## 3.2.23
|
|
148
|
+
|
|
149
|
+
### Patch Changes
|
|
150
|
+
|
|
151
|
+
- Updated dependencies [[`f0349a6`](https://github.com/atlassian-labs/atlaspack/commit/f0349a6b9b04755088f121095ca6301a2ada3767), [`a5081c3`](https://github.com/atlassian-labs/atlaspack/commit/a5081c3f9207d28716ee4edd3841de1830ea4b80), [`f930003`](https://github.com/atlassian-labs/atlaspack/commit/f930003364fdc31e5487520ebe256f1a9389f579), [`f930003`](https://github.com/atlassian-labs/atlaspack/commit/f930003364fdc31e5487520ebe256f1a9389f579), [`8843980`](https://github.com/atlassian-labs/atlaspack/commit/88439807be20025fd3433380204ff1205079729e)]:
|
|
152
|
+
- @atlaspack/feature-flags@2.24.0
|
|
153
|
+
- @atlaspack/utils@2.19.0
|
|
154
|
+
- @atlaspack/fs@2.15.23
|
|
155
|
+
- @atlaspack/logger@2.14.20
|
|
156
|
+
|
|
157
|
+
## 3.2.22
|
|
158
|
+
|
|
159
|
+
### Patch Changes
|
|
160
|
+
|
|
161
|
+
- Updated dependencies [[`3cfb7cf`](https://github.com/atlassian-labs/atlaspack/commit/3cfb7cfd90b78a5c48ce717e779ff789769825a3)]:
|
|
162
|
+
- @atlaspack/feature-flags@2.23.2
|
|
163
|
+
- @atlaspack/rust@3.6.2
|
|
164
|
+
- @atlaspack/fs@2.15.22
|
|
165
|
+
- @atlaspack/utils@2.18.4
|
|
166
|
+
- @atlaspack/logger@2.14.19
|
|
167
|
+
|
|
168
|
+
## 3.2.21
|
|
169
|
+
|
|
170
|
+
### Patch Changes
|
|
171
|
+
|
|
172
|
+
- [#742](https://github.com/atlassian-labs/atlaspack/pull/742) [`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd) Thanks [@yamadapc](https://github.com/yamadapc)! - Internal changes and bug fixes to environmentDeduplication flag
|
|
173
|
+
|
|
174
|
+
- Updated dependencies [[`ee040bb`](https://github.com/atlassian-labs/atlaspack/commit/ee040bb6428f29b57d892ddd8107e29077d08ffd), [`889c65c`](https://github.com/atlassian-labs/atlaspack/commit/889c65cd25b811045e26a117e7404f694dde77a2)]:
|
|
175
|
+
- @atlaspack/feature-flags@2.23.1
|
|
176
|
+
- @atlaspack/build-cache@2.13.5
|
|
177
|
+
- @atlaspack/logger@2.14.18
|
|
178
|
+
- @atlaspack/utils@2.18.3
|
|
179
|
+
- @atlaspack/rust@3.6.1
|
|
180
|
+
- @atlaspack/fs@2.15.21
|
|
181
|
+
|
|
182
|
+
## 3.2.20
|
|
183
|
+
|
|
184
|
+
### Patch Changes
|
|
185
|
+
|
|
186
|
+
- Updated dependencies [[`f6b3f22`](https://github.com/atlassian-labs/atlaspack/commit/f6b3f2276c7e417580b49c4879563aab51f156b1)]:
|
|
187
|
+
- @atlaspack/feature-flags@2.23.0
|
|
188
|
+
- @atlaspack/fs@2.15.20
|
|
189
|
+
- @atlaspack/utils@2.18.2
|
|
190
|
+
- @atlaspack/logger@2.14.17
|
|
191
|
+
|
|
192
|
+
## 3.2.19
|
|
193
|
+
|
|
194
|
+
### Patch Changes
|
|
195
|
+
|
|
196
|
+
- Updated dependencies [[`ad26146`](https://github.com/atlassian-labs/atlaspack/commit/ad26146f13b4c1cc65d4a0f9c67060b90ef14ff3), [`f1b48e7`](https://github.com/atlassian-labs/atlaspack/commit/f1b48e7a04e005cef0f36a3e692087a9ecdb6f7a), [`7f5841c`](https://github.com/atlassian-labs/atlaspack/commit/7f5841c39df049f9546cccbeea2a7337e0337b45), [`73dd7ba`](https://github.com/atlassian-labs/atlaspack/commit/73dd7baab69456ef2f6e4a0cc7dbb04f407eb148)]:
|
|
197
|
+
- @atlaspack/rust@3.6.0
|
|
198
|
+
- @atlaspack/feature-flags@2.22.0
|
|
199
|
+
- @atlaspack/fs@2.15.19
|
|
200
|
+
- @atlaspack/logger@2.14.16
|
|
201
|
+
- @atlaspack/utils@2.18.1
|
|
202
|
+
|
|
203
|
+
## 3.2.18
|
|
204
|
+
|
|
205
|
+
### Patch Changes
|
|
206
|
+
|
|
207
|
+
- Updated dependencies [[`23d561e`](https://github.com/atlassian-labs/atlaspack/commit/23d561e51e68b0c38fd1ff4e4fb173e5e7b01cf2)]:
|
|
208
|
+
- @atlaspack/feature-flags@2.21.0
|
|
209
|
+
- @atlaspack/utils@2.18.0
|
|
210
|
+
- @atlaspack/rust@3.5.0
|
|
211
|
+
- @atlaspack/fs@2.15.18
|
|
212
|
+
- @atlaspack/logger@2.14.15
|
|
213
|
+
|
|
214
|
+
## 3.2.17
|
|
215
|
+
|
|
216
|
+
### Patch Changes
|
|
217
|
+
|
|
218
|
+
- [#720](https://github.com/atlassian-labs/atlaspack/pull/720) [`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94) Thanks [@alshdavid](https://github.com/alshdavid)! - Migrate to TypeScript
|
|
219
|
+
|
|
220
|
+
- Updated dependencies [[`d2fd849`](https://github.com/atlassian-labs/atlaspack/commit/d2fd849770fe6305e9c694bd97b1bd905abd9d94), [`12bee0e`](https://github.com/atlassian-labs/atlaspack/commit/12bee0e23f0464d7f6bd3e24fbe0d19c126d587d)]:
|
|
221
|
+
- @atlaspack/feature-flags@2.20.1
|
|
222
|
+
- @atlaspack/build-cache@2.13.4
|
|
223
|
+
- @atlaspack/logger@2.14.14
|
|
224
|
+
- @atlaspack/utils@2.17.4
|
|
225
|
+
- @atlaspack/rust@3.4.2
|
|
226
|
+
- @atlaspack/fs@2.15.17
|
|
227
|
+
|
|
228
|
+
## 3.2.16
|
|
229
|
+
|
|
230
|
+
### Patch Changes
|
|
231
|
+
|
|
232
|
+
- Updated dependencies [[`069de47`](https://github.com/atlassian-labs/atlaspack/commit/069de478e64fb5889f6f2ce023eb510782767fbd)]:
|
|
233
|
+
- @atlaspack/feature-flags@2.20.0
|
|
234
|
+
- @atlaspack/fs@2.15.16
|
|
235
|
+
- @atlaspack/utils@2.17.3
|
|
236
|
+
|
|
237
|
+
## 3.2.15
|
|
238
|
+
|
|
239
|
+
### Patch Changes
|
|
240
|
+
|
|
241
|
+
- Updated dependencies [[`1c7865a`](https://github.com/atlassian-labs/atlaspack/commit/1c7865a64451116d94015e248302435839d347c0), [`a0b959f`](https://github.com/atlassian-labs/atlaspack/commit/a0b959fbf61fc3f820ff03c7e8988945fe40a91a)]:
|
|
242
|
+
- @atlaspack/feature-flags@2.19.2
|
|
243
|
+
- @atlaspack/fs@2.15.15
|
|
244
|
+
- @atlaspack/utils@2.17.2
|
|
245
|
+
|
|
246
|
+
## 3.2.14
|
|
247
|
+
|
|
248
|
+
### Patch Changes
|
|
249
|
+
|
|
250
|
+
- Updated dependencies [[`13aef17`](https://github.com/atlassian-labs/atlaspack/commit/13aef177eea289a6e40d2113b5ec1ac9be18a33d)]:
|
|
251
|
+
- @atlaspack/feature-flags@2.19.1
|
|
252
|
+
- @atlaspack/fs@2.15.14
|
|
253
|
+
- @atlaspack/utils@2.17.1
|
|
254
|
+
|
|
255
|
+
## 3.2.13
|
|
256
|
+
|
|
257
|
+
### Patch Changes
|
|
258
|
+
|
|
259
|
+
- [#697](https://github.com/atlassian-labs/atlaspack/pull/697) [`c9631af`](https://github.com/atlassian-labs/atlaspack/commit/c9631aff284b2c1c27e8a52f9da392ce65d666e8) Thanks [@yamadapc](https://github.com/yamadapc)! - Fix bug where cache large blob operations were not atomic
|
|
260
|
+
|
|
261
|
+
- Updated dependencies [[`dbb4072`](https://github.com/atlassian-labs/atlaspack/commit/dbb40721ebeb45990a14ba04e6b44e7f836fb32d), [`becf977`](https://github.com/atlassian-labs/atlaspack/commit/becf977f625d5ee46dae3d4c679f173bf5f40cc0), [`becf977`](https://github.com/atlassian-labs/atlaspack/commit/becf977f625d5ee46dae3d4c679f173bf5f40cc0), [`c4415a4`](https://github.com/atlassian-labs/atlaspack/commit/c4415a455543d984ca28452c2cb87a794d22497c), [`f0f7c71`](https://github.com/atlassian-labs/atlaspack/commit/f0f7c7168a1d3d18c6f30d2daed611275692b7c5), [`de23e0c`](https://github.com/atlassian-labs/atlaspack/commit/de23e0ce49d5504fe3947ac26640a3d951087da3), [`18a57cf`](https://github.com/atlassian-labs/atlaspack/commit/18a57cf8a4789b2de5ad8e2676f317a26cc91417), [`a5ed1b4`](https://github.com/atlassian-labs/atlaspack/commit/a5ed1b414498560f393ff491af4da25b6e8dde56)]:
|
|
262
|
+
- @atlaspack/feature-flags@2.19.0
|
|
263
|
+
- @atlaspack/utils@2.17.0
|
|
264
|
+
- @atlaspack/rust@3.4.1
|
|
265
|
+
- @atlaspack/fs@2.15.13
|
|
266
|
+
- @atlaspack/logger@2.14.13
|
|
267
|
+
|
|
268
|
+
## 3.2.12
|
|
269
|
+
|
|
270
|
+
### Patch Changes
|
|
271
|
+
|
|
272
|
+
- Updated dependencies [[`c75bf55`](https://github.com/atlassian-labs/atlaspack/commit/c75bf553fff4decc285b5fd499a275853b18f8f2)]:
|
|
273
|
+
- @atlaspack/rust@3.4.0
|
|
274
|
+
- @atlaspack/fs@2.15.12
|
|
275
|
+
- @atlaspack/logger@2.14.12
|
|
276
|
+
- @atlaspack/utils@2.16.1
|
|
277
|
+
|
|
278
|
+
## 3.2.11
|
|
279
|
+
|
|
280
|
+
### Patch Changes
|
|
281
|
+
|
|
282
|
+
- Updated dependencies [[`e8a60ff`](https://github.com/atlassian-labs/atlaspack/commit/e8a60ffbea41caef265786bbf73349771760081c), [`30ee2cf`](https://github.com/atlassian-labs/atlaspack/commit/30ee2cfcd34cf2646ded0eda13fdb80a2a5de529)]:
|
|
283
|
+
- @atlaspack/feature-flags@2.18.4
|
|
284
|
+
- @atlaspack/utils@2.16.0
|
|
285
|
+
- @atlaspack/fs@2.15.11
|
|
286
|
+
|
|
287
|
+
## 3.2.10
|
|
288
|
+
|
|
289
|
+
### Patch Changes
|
|
290
|
+
|
|
291
|
+
- Updated dependencies [[`5ded263`](https://github.com/atlassian-labs/atlaspack/commit/5ded263c7f11b866e8885b81c73e20dd060b25be)]:
|
|
292
|
+
- @atlaspack/feature-flags@2.18.3
|
|
293
|
+
- @atlaspack/fs@2.15.10
|
|
294
|
+
- @atlaspack/utils@2.15.3
|
|
295
|
+
|
|
296
|
+
## 3.2.9
|
|
297
|
+
|
|
298
|
+
### Patch Changes
|
|
299
|
+
|
|
300
|
+
- Updated dependencies [[`644b157`](https://github.com/atlassian-labs/atlaspack/commit/644b157dee72a871acc2d0facf0b87b8eea51956)]:
|
|
301
|
+
- @atlaspack/feature-flags@2.18.2
|
|
302
|
+
- @atlaspack/fs@2.15.9
|
|
303
|
+
- @atlaspack/utils@2.15.2
|
|
304
|
+
|
|
305
|
+
## 3.2.8
|
|
306
|
+
|
|
307
|
+
### Patch Changes
|
|
308
|
+
|
|
309
|
+
- Updated dependencies [[`ef3d622`](https://github.com/atlassian-labs/atlaspack/commit/ef3d6228f4e006702198a19c61e051d194d325cb), [`26aa9c5`](https://github.com/atlassian-labs/atlaspack/commit/26aa9c599d2be45ce1438a74c5fa22f39b9b554b), [`0501255`](https://github.com/atlassian-labs/atlaspack/commit/05012550da35b05ce7d356a8cc29311e7f9afdca)]:
|
|
310
|
+
- @atlaspack/logger@2.14.11
|
|
311
|
+
- @atlaspack/feature-flags@2.18.1
|
|
312
|
+
- @atlaspack/fs@2.15.8
|
|
313
|
+
- @atlaspack/utils@2.15.1
|
|
314
|
+
|
|
315
|
+
## 3.2.7
|
|
316
|
+
|
|
317
|
+
### Patch Changes
|
|
318
|
+
|
|
319
|
+
- Updated dependencies [[`10fbcfb`](https://github.com/atlassian-labs/atlaspack/commit/10fbcfbfa49c7a83da5d7c40983e36e87f524a75), [`85c52d3`](https://github.com/atlassian-labs/atlaspack/commit/85c52d3f7717b3c84a118d18ab98cfbfd71dcbd2), [`e39c6cf`](https://github.com/atlassian-labs/atlaspack/commit/e39c6cf05f7e95ce5420dbcea66f401b1cbd397c)]:
|
|
320
|
+
- @atlaspack/feature-flags@2.18.0
|
|
321
|
+
- @atlaspack/utils@2.15.0
|
|
322
|
+
- @atlaspack/fs@2.15.7
|
|
323
|
+
|
|
324
|
+
## 3.2.6
|
|
325
|
+
|
|
326
|
+
### Patch Changes
|
|
327
|
+
|
|
328
|
+
- Updated dependencies [[`73ea3c4`](https://github.com/atlassian-labs/atlaspack/commit/73ea3c4d85d4401fdd15abcbf988237e890e7ad3), [`b1b3693`](https://github.com/atlassian-labs/atlaspack/commit/b1b369317c66f8a431c170df2ebba4fa5b2e38ef)]:
|
|
329
|
+
- @atlaspack/feature-flags@2.17.0
|
|
330
|
+
- @atlaspack/fs@2.15.6
|
|
331
|
+
- @atlaspack/utils@2.14.11
|
|
332
|
+
|
|
333
|
+
## 3.2.5
|
|
334
|
+
|
|
335
|
+
### Patch Changes
|
|
336
|
+
|
|
337
|
+
- Updated dependencies [[`0999fb7`](https://github.com/atlassian-labs/atlaspack/commit/0999fb78da519a6c7582d212883e515fcf6c1252), [`35fdd4b`](https://github.com/atlassian-labs/atlaspack/commit/35fdd4b52da0af20f74667f7b8adfb2f90279b7c), [`6dd4ccb`](https://github.com/atlassian-labs/atlaspack/commit/6dd4ccb753541de32322d881f973d571dd57e4ca)]:
|
|
338
|
+
- @atlaspack/fs@2.15.5
|
|
339
|
+
- @atlaspack/rust@3.3.5
|
|
340
|
+
- @atlaspack/logger@2.14.10
|
|
341
|
+
- @atlaspack/utils@2.14.10
|
|
342
|
+
|
|
343
|
+
## 3.2.4
|
|
344
|
+
|
|
345
|
+
### Patch Changes
|
|
346
|
+
|
|
347
|
+
- [#583](https://github.com/atlassian-labs/atlaspack/pull/583) [`124b7ff`](https://github.com/atlassian-labs/atlaspack/commit/124b7fff44f71aac9fbad289a9a9509b3dfc9aaa) Thanks [@yamadapc](https://github.com/yamadapc)! - Fix problem where cache writes could start to fail during a V3 build
|
|
348
|
+
|
|
349
|
+
- Updated dependencies [[`124b7ff`](https://github.com/atlassian-labs/atlaspack/commit/124b7fff44f71aac9fbad289a9a9509b3dfc9aaa), [`e052521`](https://github.com/atlassian-labs/atlaspack/commit/e0525210850ed1606146eb86991049cf567c5dec), [`15c6d70`](https://github.com/atlassian-labs/atlaspack/commit/15c6d7000bd89da876bc590aa75b17a619a41896), [`e4d966c`](https://github.com/atlassian-labs/atlaspack/commit/e4d966c3c9c4292c5013372ae65b10d19d4bacc6), [`209692f`](https://github.com/atlassian-labs/atlaspack/commit/209692ffb11eae103a0d65c5e1118a5aa1625818), [`42a775d`](https://github.com/atlassian-labs/atlaspack/commit/42a775de8eec638ad188f3271964170d8c04d84b), [`29c2f10`](https://github.com/atlassian-labs/atlaspack/commit/29c2f106de9679adfb5afa04e1910471dc65a427), [`f4da1e1`](https://github.com/atlassian-labs/atlaspack/commit/f4da1e120e73eeb5e8b8927f05e88f04d6148c7b), [`1ef91fc`](https://github.com/atlassian-labs/atlaspack/commit/1ef91fcc863fdd2831511937083dbbc1263b3d9d)]:
|
|
350
|
+
- @atlaspack/rust@3.3.4
|
|
351
|
+
- @atlaspack/fs@2.15.4
|
|
352
|
+
- @atlaspack/feature-flags@2.16.0
|
|
353
|
+
- @atlaspack/logger@2.14.9
|
|
354
|
+
- @atlaspack/utils@2.14.9
|
|
355
|
+
|
|
3
356
|
## 3.2.3
|
|
4
357
|
|
|
5
358
|
### Patch Changes
|
package/dist/FSCache.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
+
};
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
var _FSCache_instances, _FSCache_getFilePath, _FSCache_unlinkChunks;
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.FSCache = void 0;
|
|
13
|
+
const stream_1 = __importDefault(require("stream"));
|
|
14
|
+
const path_1 = __importDefault(require("path"));
|
|
15
|
+
const util_1 = require("util");
|
|
16
|
+
const rust_1 = require("@atlaspack/rust");
|
|
17
|
+
const feature_flags_1 = require("@atlaspack/feature-flags");
|
|
18
|
+
const logger_1 = __importDefault(require("@atlaspack/logger"));
|
|
19
|
+
const build_cache_1 = require("@atlaspack/build-cache");
|
|
20
|
+
// flowlint-next-line untyped-import:off
|
|
21
|
+
const package_json_1 = __importDefault(require("../package.json"));
|
|
22
|
+
const constants_1 = require("./constants");
|
|
23
|
+
const pipeline = (0, util_1.promisify)(stream_1.default.pipeline);
|
|
24
|
+
class FSCache {
|
|
25
|
+
constructor(fs, cacheDir) {
|
|
26
|
+
_FSCache_instances.add(this);
|
|
27
|
+
this.fs = fs;
|
|
28
|
+
this.dir = cacheDir;
|
|
29
|
+
}
|
|
30
|
+
async ensure() {
|
|
31
|
+
// First, create the main cache directory if necessary.
|
|
32
|
+
await this.fs.mkdirp(this.dir);
|
|
33
|
+
// In parallel, create sub-directories for every possible hex value
|
|
34
|
+
// This speeds up large caches on many file systems since there are fewer files in a single directory.
|
|
35
|
+
let dirPromises = [];
|
|
36
|
+
for (let i = 0; i < 256; i++) {
|
|
37
|
+
dirPromises.push(
|
|
38
|
+
// @ts-expect-error TS2345
|
|
39
|
+
this.fs.mkdirp(path_1.default.join(this.dir, ('00' + i.toString(16)).slice(-2))));
|
|
40
|
+
}
|
|
41
|
+
await Promise.all(dirPromises);
|
|
42
|
+
}
|
|
43
|
+
_getCachePath(cacheId) {
|
|
44
|
+
if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
|
|
45
|
+
const cleanId = (0, rust_1.hashString)(cacheId);
|
|
46
|
+
return path_1.default.join(this.dir, cleanId.slice(0, 2), cleanId.slice(2));
|
|
47
|
+
}
|
|
48
|
+
return path_1.default.join(this.dir, cacheId.slice(0, 2), cacheId.slice(2));
|
|
49
|
+
}
|
|
50
|
+
getStream(key) {
|
|
51
|
+
return this.fs.createReadStream(this._getCachePath(`${key}-large`));
|
|
52
|
+
}
|
|
53
|
+
setStream(key, stream) {
|
|
54
|
+
return pipeline(stream, this.fs.createWriteStream(this._getCachePath(`${key}-large`)));
|
|
55
|
+
}
|
|
56
|
+
has(key) {
|
|
57
|
+
return this.fs.exists(this._getCachePath(key));
|
|
58
|
+
}
|
|
59
|
+
getBlob(key) {
|
|
60
|
+
return this.fs.readFile(this._getCachePath(key));
|
|
61
|
+
}
|
|
62
|
+
async setBlob(key, contents) {
|
|
63
|
+
await this.fs.writeFile(this._getCachePath(key), contents);
|
|
64
|
+
}
|
|
65
|
+
async getBuffer(key) {
|
|
66
|
+
try {
|
|
67
|
+
return await this.fs.readFile(this._getCachePath(key));
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
if (err.code === 'ENOENT') {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
throw err;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
hasLargeBlob(key) {
|
|
79
|
+
return this.fs.exists(__classPrivateFieldGet(this, _FSCache_instances, "m", _FSCache_getFilePath).call(this, key, 0));
|
|
80
|
+
}
|
|
81
|
+
async getLargeBlob(key) {
|
|
82
|
+
const buffers = [];
|
|
83
|
+
for (let i = 0; await this.fs.exists(__classPrivateFieldGet(this, _FSCache_instances, "m", _FSCache_getFilePath).call(this, key, i)); i += 1) {
|
|
84
|
+
const file = this.fs.readFile(__classPrivateFieldGet(this, _FSCache_instances, "m", _FSCache_getFilePath).call(this, key, i));
|
|
85
|
+
buffers.push(file);
|
|
86
|
+
}
|
|
87
|
+
return Buffer.concat(await Promise.all(buffers));
|
|
88
|
+
}
|
|
89
|
+
async setLargeBlob(key, contents, options) {
|
|
90
|
+
const chunks = Math.ceil(contents.length / constants_1.WRITE_LIMIT_CHUNK);
|
|
91
|
+
const writePromises = [];
|
|
92
|
+
if (chunks === 1) {
|
|
93
|
+
// If there's one chunk, don't slice the content
|
|
94
|
+
writePromises.push(
|
|
95
|
+
// @ts-expect-error TS2345
|
|
96
|
+
this.fs.writeFile(__classPrivateFieldGet(this, _FSCache_instances, "m", _FSCache_getFilePath).call(this, key, 0), contents, {
|
|
97
|
+
// @ts-expect-error TS2353
|
|
98
|
+
signal: options?.signal,
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
for (let i = 0; i < chunks; i += 1) {
|
|
103
|
+
writePromises.push(
|
|
104
|
+
// @ts-expect-error TS2345
|
|
105
|
+
this.fs.writeFile(__classPrivateFieldGet(this, _FSCache_instances, "m", _FSCache_getFilePath).call(this, key, i), typeof contents === 'string'
|
|
106
|
+
? contents.slice(i * constants_1.WRITE_LIMIT_CHUNK, (i + 1) * constants_1.WRITE_LIMIT_CHUNK)
|
|
107
|
+
: contents.subarray(i * constants_1.WRITE_LIMIT_CHUNK, (i + 1) * constants_1.WRITE_LIMIT_CHUNK),
|
|
108
|
+
// @ts-expect-error TS2353
|
|
109
|
+
{ signal: options?.signal }));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// If there's already a files following this chunk, it's old and should be removed
|
|
113
|
+
writePromises.push(__classPrivateFieldGet(this, _FSCache_instances, "m", _FSCache_unlinkChunks).call(this, key, chunks));
|
|
114
|
+
await Promise.all(writePromises);
|
|
115
|
+
}
|
|
116
|
+
async deleteLargeBlob(key) {
|
|
117
|
+
const deletePromises = [];
|
|
118
|
+
let i = 0;
|
|
119
|
+
let filePath = __classPrivateFieldGet(this, _FSCache_instances, "m", _FSCache_getFilePath).call(this, key, i);
|
|
120
|
+
while (await this.fs.exists(filePath)) {
|
|
121
|
+
// @ts-expect-error TS2345
|
|
122
|
+
deletePromises.push(this.fs.rimraf(filePath));
|
|
123
|
+
i += 1;
|
|
124
|
+
filePath = __classPrivateFieldGet(this, _FSCache_instances, "m", _FSCache_getFilePath).call(this, key, i);
|
|
125
|
+
}
|
|
126
|
+
await Promise.all(deletePromises);
|
|
127
|
+
}
|
|
128
|
+
async get(key) {
|
|
129
|
+
try {
|
|
130
|
+
let data = await this.fs.readFile(this._getCachePath(key));
|
|
131
|
+
return (0, build_cache_1.deserialize)(data);
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
if (err.code === 'ENOENT') {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
throw err;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async set(key, value) {
|
|
143
|
+
try {
|
|
144
|
+
let blobPath = this._getCachePath(key);
|
|
145
|
+
let data = (0, build_cache_1.serialize)(value);
|
|
146
|
+
await this.fs.writeFile(blobPath, data);
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
logger_1.default.error(err, '@atlaspack/cache');
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
refresh() {
|
|
153
|
+
// NOOP
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.FSCache = FSCache;
|
|
157
|
+
_FSCache_instances = new WeakSet(), _FSCache_getFilePath = function _FSCache_getFilePath(key, index) {
|
|
158
|
+
if ((0, feature_flags_1.getFeatureFlag)('cachePerformanceImprovements')) {
|
|
159
|
+
return path_1.default.join(this.dir, `${(0, rust_1.hashString)(key)}-${index}`);
|
|
160
|
+
}
|
|
161
|
+
return path_1.default.join(this.dir, `${key}-${index}`);
|
|
162
|
+
}, _FSCache_unlinkChunks = async function _FSCache_unlinkChunks(key, index) {
|
|
163
|
+
try {
|
|
164
|
+
await this.fs.unlink(__classPrivateFieldGet(this, _FSCache_instances, "m", _FSCache_getFilePath).call(this, key, index));
|
|
165
|
+
await __classPrivateFieldGet(this, _FSCache_instances, "m", _FSCache_unlinkChunks).call(this, key, index + 1);
|
|
166
|
+
}
|
|
167
|
+
catch (err) {
|
|
168
|
+
// If there's an error, no more chunks are left to delete
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
(0, build_cache_1.registerSerializableClass)(`${package_json_1.default.version}:FSCache`, FSCache);
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.IDBCache = void 0;
|
|
7
|
+
const stream_1 = require("stream");
|
|
8
|
+
const build_cache_1 = require("@atlaspack/build-cache");
|
|
9
|
+
const utils_1 = require("@atlaspack/utils");
|
|
10
|
+
const idb_1 = require("idb");
|
|
11
|
+
const package_json_1 = __importDefault(require("../package.json"));
|
|
12
|
+
const STORE_NAME = 'cache';
|
|
13
|
+
class IDBCache {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.store = (0, idb_1.openDB)('REPL-parcel-cache', 1, {
|
|
16
|
+
upgrade(db) {
|
|
17
|
+
db.createObjectStore(STORE_NAME);
|
|
18
|
+
},
|
|
19
|
+
blocked() { },
|
|
20
|
+
blocking() { },
|
|
21
|
+
terminated() { },
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
ensure() {
|
|
25
|
+
return Promise.resolve();
|
|
26
|
+
}
|
|
27
|
+
serialize() {
|
|
28
|
+
return {
|
|
29
|
+
/*::...null*/
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
static deserialize() {
|
|
33
|
+
return new IDBCache();
|
|
34
|
+
}
|
|
35
|
+
has(key) {
|
|
36
|
+
return Promise.resolve(this.store.get(key) != null);
|
|
37
|
+
}
|
|
38
|
+
async get(key) {
|
|
39
|
+
let data = await (await this.store).get(STORE_NAME, key);
|
|
40
|
+
if (data == null) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return Promise.resolve((0, build_cache_1.deserialize)(data));
|
|
44
|
+
}
|
|
45
|
+
async set(key, value) {
|
|
46
|
+
await (await this.store).put(STORE_NAME, (0, build_cache_1.serialize)(value), key);
|
|
47
|
+
}
|
|
48
|
+
getStream(key) {
|
|
49
|
+
let dataPromise = this.store
|
|
50
|
+
// @ts-expect-error TS7006
|
|
51
|
+
.then((s) => s.get(STORE_NAME, key))
|
|
52
|
+
// @ts-expect-error TS7006
|
|
53
|
+
.then((d) => Buffer.from(d))
|
|
54
|
+
// @ts-expect-error TS7006
|
|
55
|
+
.catch((e) => e);
|
|
56
|
+
const stream = new stream_1.Readable({
|
|
57
|
+
async read() {
|
|
58
|
+
let data = await dataPromise;
|
|
59
|
+
if (data instanceof Error) {
|
|
60
|
+
stream.emit('error', data);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
stream.push(Buffer.from(data));
|
|
64
|
+
stream.push(null);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
return stream;
|
|
69
|
+
}
|
|
70
|
+
async setStream(key, stream) {
|
|
71
|
+
let buf = await (0, utils_1.bufferStream)(stream);
|
|
72
|
+
await (await this.store).put(STORE_NAME, buf, key);
|
|
73
|
+
}
|
|
74
|
+
async getBlob(key) {
|
|
75
|
+
let data = await (await this.store).get(STORE_NAME, key);
|
|
76
|
+
if (data == null) {
|
|
77
|
+
return Promise.reject(new Error(`Key ${key} not found in cache`));
|
|
78
|
+
}
|
|
79
|
+
return Buffer.from(data.buffer);
|
|
80
|
+
}
|
|
81
|
+
async setBlob(key, contents) {
|
|
82
|
+
let data = contents instanceof Uint8Array ? contents : Buffer.from(contents);
|
|
83
|
+
await (await this.store).put(STORE_NAME, data, key);
|
|
84
|
+
}
|
|
85
|
+
// async setBlobs(
|
|
86
|
+
// entries: $ReadOnlyArray<[string, Buffer | string]>,
|
|
87
|
+
// ): Promise<void> {
|
|
88
|
+
// const tx = (await this.store).transaction(STORE_NAME, 'readwrite');
|
|
89
|
+
// await Promise.all([
|
|
90
|
+
// ...entries.map(([key, value]) =>
|
|
91
|
+
// tx.store.put(
|
|
92
|
+
// value instanceof Uint8Array ? value : Buffer.from(value),
|
|
93
|
+
// key,
|
|
94
|
+
// ),
|
|
95
|
+
// ),
|
|
96
|
+
// tx.done,
|
|
97
|
+
// ]);
|
|
98
|
+
// }
|
|
99
|
+
async getBuffer(key) {
|
|
100
|
+
let data = await (await this.store).get(STORE_NAME, key);
|
|
101
|
+
if (data == null) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
return Buffer.from(data.buffer);
|
|
105
|
+
}
|
|
106
|
+
hasLargeBlob(key) {
|
|
107
|
+
return this.has(key);
|
|
108
|
+
}
|
|
109
|
+
getLargeBlob(key) {
|
|
110
|
+
return this.getBlob(key);
|
|
111
|
+
}
|
|
112
|
+
setLargeBlob(key, contents) {
|
|
113
|
+
return this.setBlob(key, contents);
|
|
114
|
+
}
|
|
115
|
+
async deleteLargeBlob(key) {
|
|
116
|
+
await (await this.store).delete(STORE_NAME, key);
|
|
117
|
+
}
|
|
118
|
+
refresh() {
|
|
119
|
+
// NOOP
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.IDBCache = IDBCache;
|
|
123
|
+
(0, build_cache_1.registerSerializableClass)(`${package_json_1.default.version}:IDBCache`, IDBCache);
|
package/dist/IDBCache.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IDBCache = void 0;
|
|
4
|
+
// @ts-expect-error TS2420
|
|
5
|
+
class IDBCache {
|
|
6
|
+
constructor() {
|
|
7
|
+
throw new Error('IDBCache is only supported in the browser');
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.IDBCache = IDBCache;
|