prismic-ts-codegen 0.1.11 → 0.1.13

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.
Files changed (202) hide show
  1. package/dist/_node_modules/quick-lru/index.cjs +234 -0
  2. package/dist/_node_modules/quick-lru/index.cjs.map +1 -0
  3. package/dist/_node_modules/quick-lru/index.js +235 -0
  4. package/dist/_node_modules/quick-lru/index.js.map +1 -0
  5. package/dist/constants.cjs +19 -21
  6. package/dist/constants.cjs.map +1 -1
  7. package/dist/constants.d.ts +2 -3
  8. package/dist/constants.js +19 -21
  9. package/dist/constants.js.map +1 -1
  10. package/dist/generateTypes.cjs +71 -90
  11. package/dist/generateTypes.cjs.map +1 -1
  12. package/dist/generateTypes.d.ts +2 -1
  13. package/dist/generateTypes.js +71 -90
  14. package/dist/generateTypes.js.map +1 -1
  15. package/dist/lib/addBlankLine.cjs +12 -0
  16. package/dist/lib/addBlankLine.cjs.map +1 -0
  17. package/dist/lib/addBlankLine.d.ts +5 -0
  18. package/dist/lib/addBlankLine.js +12 -0
  19. package/dist/lib/addBlankLine.js.map +1 -0
  20. package/dist/lib/addLine.cjs +8 -0
  21. package/dist/lib/addLine.cjs.map +1 -0
  22. package/dist/lib/addLine.d.ts +1 -0
  23. package/dist/lib/addLine.js +8 -0
  24. package/dist/lib/addLine.js.map +1 -0
  25. package/dist/lib/addSection.cjs +8 -0
  26. package/dist/lib/addSection.cjs.map +1 -0
  27. package/dist/lib/addSection.d.ts +1 -0
  28. package/dist/lib/addSection.js +8 -0
  29. package/dist/lib/addSection.js.map +1 -0
  30. package/dist/lib/addTrailingNewLine.cjs +11 -0
  31. package/dist/lib/addTrailingNewLine.cjs.map +1 -0
  32. package/dist/lib/addTrailingNewLine.d.ts +5 -0
  33. package/dist/lib/addTrailingNewLine.js +11 -0
  34. package/dist/lib/addTrailingNewLine.js.map +1 -0
  35. package/dist/lib/buildCustomTypeDataType.cjs +51 -0
  36. package/dist/lib/buildCustomTypeDataType.cjs.map +1 -0
  37. package/dist/lib/buildCustomTypeDataType.d.ts +13 -0
  38. package/dist/lib/buildCustomTypeDataType.js +51 -0
  39. package/dist/lib/buildCustomTypeDataType.js.map +1 -0
  40. package/dist/lib/buildCustomTypeType.cjs +60 -0
  41. package/dist/lib/buildCustomTypeType.cjs.map +1 -0
  42. package/dist/lib/buildCustomTypeType.d.ts +17 -0
  43. package/dist/lib/buildCustomTypeType.js +60 -0
  44. package/dist/lib/buildCustomTypeType.js.map +1 -0
  45. package/dist/lib/buildFieldDocs.cjs +67 -35
  46. package/dist/lib/buildFieldDocs.cjs.map +1 -1
  47. package/dist/lib/buildFieldDocs.d.ts +7 -11
  48. package/dist/lib/buildFieldDocs.js +67 -35
  49. package/dist/lib/buildFieldDocs.js.map +1 -1
  50. package/dist/lib/buildFieldProperties.cjs +300 -0
  51. package/dist/lib/buildFieldProperties.cjs.map +1 -0
  52. package/dist/lib/buildFieldProperties.d.ts +14 -0
  53. package/dist/lib/buildFieldProperties.js +300 -0
  54. package/dist/lib/buildFieldProperties.js.map +1 -0
  55. package/dist/lib/buildSharedSliceType.cjs +140 -0
  56. package/dist/lib/buildSharedSliceType.cjs.map +1 -0
  57. package/dist/lib/buildSharedSliceType.d.ts +16 -0
  58. package/dist/lib/buildSharedSliceType.js +140 -0
  59. package/dist/lib/buildSharedSliceType.js.map +1 -0
  60. package/dist/lib/buildTypeName.cjs +4 -2
  61. package/dist/lib/buildTypeName.cjs.map +1 -1
  62. package/dist/lib/buildTypeName.js +4 -2
  63. package/dist/lib/buildTypeName.js.map +1 -1
  64. package/dist/lib/buildUnion.cjs +7 -0
  65. package/dist/lib/buildUnion.cjs.map +1 -0
  66. package/dist/lib/buildUnion.d.ts +1 -0
  67. package/dist/lib/buildUnion.js +7 -0
  68. package/dist/lib/buildUnion.js.map +1 -0
  69. package/dist/lib/checkHasUIDFIeld.cjs +7 -0
  70. package/dist/lib/checkHasUIDFIeld.cjs.map +1 -0
  71. package/dist/lib/checkHasUIDFIeld.d.ts +2 -0
  72. package/dist/lib/checkHasUIDFIeld.js +7 -0
  73. package/dist/lib/checkHasUIDFIeld.js.map +1 -0
  74. package/dist/lib/getAPIIDPath.cjs +18 -14
  75. package/dist/lib/getAPIIDPath.cjs.map +1 -1
  76. package/dist/lib/getAPIIDPath.d.ts +4 -8
  77. package/dist/lib/getAPIIDPath.js +18 -14
  78. package/dist/lib/getAPIIDPath.js.map +1 -1
  79. package/dist/lib/getCacheKey.cjs +25 -0
  80. package/dist/lib/getCacheKey.cjs.map +1 -0
  81. package/dist/lib/getCacheKey.d.ts +9 -0
  82. package/dist/lib/getCacheKey.js +8 -0
  83. package/dist/lib/getCacheKey.js.map +1 -0
  84. package/dist/lib/getHumanReadableModelName.cjs +13 -17
  85. package/dist/lib/getHumanReadableModelName.cjs.map +1 -1
  86. package/dist/lib/getHumanReadableModelName.d.ts +3 -3
  87. package/dist/lib/getHumanReadableModelName.js +13 -17
  88. package/dist/lib/getHumanReadableModelName.js.map +1 -1
  89. package/dist/lib/{getHumanReadableFieldPath.cjs → getHumanReadablePath.cjs} +8 -8
  90. package/dist/lib/getHumanReadablePath.cjs.map +1 -0
  91. package/dist/lib/getHumanReadablePath.d.ts +6 -0
  92. package/dist/lib/{getHumanReadableFieldPath.js → getHumanReadablePath.js} +8 -8
  93. package/dist/lib/getHumanReadablePath.js.map +1 -0
  94. package/dist/types.d.ts +9 -1
  95. package/package.json +18 -17
  96. package/src/constants.ts +19 -22
  97. package/src/generateTypes.ts +109 -108
  98. package/src/lib/addBlankLine.ts +13 -0
  99. package/src/lib/addLine.ts +5 -0
  100. package/src/lib/addSection.ts +5 -0
  101. package/src/lib/addTrailingNewLine.ts +14 -0
  102. package/src/lib/buildCustomTypeDataType.ts +74 -0
  103. package/src/lib/buildCustomTypeType.ts +101 -0
  104. package/src/lib/buildFieldDocs.ts +128 -68
  105. package/src/lib/buildFieldProperties.ts +513 -0
  106. package/src/lib/buildSharedSliceType.ts +213 -0
  107. package/src/lib/buildTypeName.ts +4 -2
  108. package/src/lib/buildUnion.ts +3 -0
  109. package/src/lib/checkHasUIDFIeld.ts +5 -0
  110. package/src/lib/getAPIIDPath.ts +40 -41
  111. package/src/lib/getCacheKey.ts +13 -0
  112. package/src/lib/getHumanReadableModelName.ts +23 -20
  113. package/src/lib/getHumanReadablePath.ts +24 -0
  114. package/src/types.ts +11 -1
  115. package/dist/lib/addInterfacePropertiesForFields.cjs +0 -489
  116. package/dist/lib/addInterfacePropertiesForFields.cjs.map +0 -1
  117. package/dist/lib/addInterfacePropertiesForFields.d.ts +0 -21
  118. package/dist/lib/addInterfacePropertiesForFields.js +0 -489
  119. package/dist/lib/addInterfacePropertiesForFields.js.map +0 -1
  120. package/dist/lib/addTypeAliasForCustomType.cjs +0 -81
  121. package/dist/lib/addTypeAliasForCustomType.cjs.map +0 -1
  122. package/dist/lib/addTypeAliasForCustomType.d.ts +0 -11
  123. package/dist/lib/addTypeAliasForCustomType.js +0 -81
  124. package/dist/lib/addTypeAliasForCustomType.js.map +0 -1
  125. package/dist/lib/addTypeAliasForSharedSlice.cjs +0 -149
  126. package/dist/lib/addTypeAliasForSharedSlice.cjs.map +0 -1
  127. package/dist/lib/addTypeAliasForSharedSlice.d.ts +0 -10
  128. package/dist/lib/addTypeAliasForSharedSlice.js +0 -149
  129. package/dist/lib/addTypeAliasForSharedSlice.js.map +0 -1
  130. package/dist/lib/buildSharedSliceInterfaceNamePart.cjs +0 -8
  131. package/dist/lib/buildSharedSliceInterfaceNamePart.cjs.map +0 -1
  132. package/dist/lib/buildSharedSliceInterfaceNamePart.d.ts +0 -5
  133. package/dist/lib/buildSharedSliceInterfaceNamePart.js +0 -8
  134. package/dist/lib/buildSharedSliceInterfaceNamePart.js.map +0 -1
  135. package/dist/lib/getFieldDocumentationURL.cjs +0 -8
  136. package/dist/lib/getFieldDocumentationURL.cjs.map +0 -1
  137. package/dist/lib/getFieldDocumentationURL.d.ts +0 -6
  138. package/dist/lib/getFieldDocumentationURL.js +0 -8
  139. package/dist/lib/getFieldDocumentationURL.js.map +0 -1
  140. package/dist/lib/getHumanReadableFieldPath.cjs.map +0 -1
  141. package/dist/lib/getHumanReadableFieldPath.d.ts +0 -10
  142. package/dist/lib/getHumanReadableFieldPath.js.map +0 -1
  143. package/dist/lib/getHumanReadableFieldType.cjs +0 -36
  144. package/dist/lib/getHumanReadableFieldType.cjs.map +0 -1
  145. package/dist/lib/getHumanReadableFieldType.d.ts +0 -6
  146. package/dist/lib/getHumanReadableFieldType.js +0 -36
  147. package/dist/lib/getHumanReadableFieldType.js.map +0 -1
  148. package/dist/lib/getSourceFileText.cjs +0 -9
  149. package/dist/lib/getSourceFileText.cjs.map +0 -1
  150. package/dist/lib/getSourceFileText.d.ts +0 -2
  151. package/dist/lib/getSourceFileText.js +0 -9
  152. package/dist/lib/getSourceFileText.js.map +0 -1
  153. package/dist/lib/hasOwnProperty.cjs +0 -7
  154. package/dist/lib/hasOwnProperty.cjs.map +0 -1
  155. package/dist/lib/hasOwnProperty.d.ts +0 -10
  156. package/dist/lib/hasOwnProperty.js +0 -7
  157. package/dist/lib/hasOwnProperty.js.map +0 -1
  158. package/dist/lib/isCustomTypeModel.cjs +0 -7
  159. package/dist/lib/isCustomTypeModel.cjs.map +0 -1
  160. package/dist/lib/isCustomTypeModel.d.ts +0 -2
  161. package/dist/lib/isCustomTypeModel.js +0 -7
  162. package/dist/lib/isCustomTypeModel.js.map +0 -1
  163. package/dist/lib/isCustomTypeModelField.cjs +0 -7
  164. package/dist/lib/isCustomTypeModelField.cjs.map +0 -1
  165. package/dist/lib/isCustomTypeModelField.d.ts +0 -2
  166. package/dist/lib/isCustomTypeModelField.js +0 -7
  167. package/dist/lib/isCustomTypeModelField.js.map +0 -1
  168. package/dist/lib/isCustomTypeModelSlice.cjs +0 -8
  169. package/dist/lib/isCustomTypeModelSlice.cjs.map +0 -1
  170. package/dist/lib/isCustomTypeModelSlice.d.ts +0 -2
  171. package/dist/lib/isCustomTypeModelSlice.js +0 -8
  172. package/dist/lib/isCustomTypeModelSlice.js.map +0 -1
  173. package/dist/lib/isSharedSliceModel.cjs +0 -8
  174. package/dist/lib/isSharedSliceModel.cjs.map +0 -1
  175. package/dist/lib/isSharedSliceModel.d.ts +0 -2
  176. package/dist/lib/isSharedSliceModel.js +0 -8
  177. package/dist/lib/isSharedSliceModel.js.map +0 -1
  178. package/dist/lib/pascalCase.cjs +0 -8
  179. package/dist/lib/pascalCase.cjs.map +0 -1
  180. package/dist/lib/pascalCase.d.ts +0 -1
  181. package/dist/lib/pascalCase.js +0 -8
  182. package/dist/lib/pascalCase.js.map +0 -1
  183. package/dist/lib/writeFieldDocsDescription.cjs +0 -29
  184. package/dist/lib/writeFieldDocsDescription.cjs.map +0 -1
  185. package/dist/lib/writeFieldDocsDescription.d.ts +0 -13
  186. package/dist/lib/writeFieldDocsDescription.js +0 -29
  187. package/dist/lib/writeFieldDocsDescription.js.map +0 -1
  188. package/src/lib/addInterfacePropertiesForFields.ts +0 -665
  189. package/src/lib/addTypeAliasForCustomType.ts +0 -120
  190. package/src/lib/addTypeAliasForSharedSlice.ts +0 -201
  191. package/src/lib/buildSharedSliceInterfaceNamePart.ts +0 -11
  192. package/src/lib/getFieldDocumentationURL.ts +0 -15
  193. package/src/lib/getHumanReadableFieldPath.ts +0 -36
  194. package/src/lib/getHumanReadableFieldType.ts +0 -55
  195. package/src/lib/getSourceFileText.ts +0 -14
  196. package/src/lib/hasOwnProperty.ts +0 -15
  197. package/src/lib/isCustomTypeModel.ts +0 -5
  198. package/src/lib/isCustomTypeModelField.ts +0 -7
  199. package/src/lib/isCustomTypeModelSlice.ts +0 -14
  200. package/src/lib/isSharedSliceModel.ts +0 -14
  201. package/src/lib/pascalCase.ts +0 -9
  202. package/src/lib/writeFieldDocsDescription.ts +0 -51
@@ -0,0 +1,234 @@
1
+ "use strict";
2
+ class QuickLRU extends Map {
3
+ constructor(options = {}) {
4
+ super();
5
+ if (!(options.maxSize && options.maxSize > 0)) {
6
+ throw new TypeError("`maxSize` must be a number greater than 0");
7
+ }
8
+ if (typeof options.maxAge === "number" && options.maxAge === 0) {
9
+ throw new TypeError("`maxAge` must be a number greater than 0");
10
+ }
11
+ this.maxSize = options.maxSize;
12
+ this.maxAge = options.maxAge || Number.POSITIVE_INFINITY;
13
+ this.onEviction = options.onEviction;
14
+ this.cache = /* @__PURE__ */ new Map();
15
+ this.oldCache = /* @__PURE__ */ new Map();
16
+ this._size = 0;
17
+ }
18
+ // TODO: Use private class methods when targeting Node.js 16.
19
+ _emitEvictions(cache) {
20
+ if (typeof this.onEviction !== "function") {
21
+ return;
22
+ }
23
+ for (const [key, item] of cache) {
24
+ this.onEviction(key, item.value);
25
+ }
26
+ }
27
+ _deleteIfExpired(key, item) {
28
+ if (typeof item.expiry === "number" && item.expiry <= Date.now()) {
29
+ if (typeof this.onEviction === "function") {
30
+ this.onEviction(key, item.value);
31
+ }
32
+ return this.delete(key);
33
+ }
34
+ return false;
35
+ }
36
+ _getOrDeleteIfExpired(key, item) {
37
+ const deleted = this._deleteIfExpired(key, item);
38
+ if (deleted === false) {
39
+ return item.value;
40
+ }
41
+ }
42
+ _getItemValue(key, item) {
43
+ return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;
44
+ }
45
+ _peek(key, cache) {
46
+ const item = cache.get(key);
47
+ return this._getItemValue(key, item);
48
+ }
49
+ _set(key, value) {
50
+ this.cache.set(key, value);
51
+ this._size++;
52
+ if (this._size >= this.maxSize) {
53
+ this._size = 0;
54
+ this._emitEvictions(this.oldCache);
55
+ this.oldCache = this.cache;
56
+ this.cache = /* @__PURE__ */ new Map();
57
+ }
58
+ }
59
+ _moveToRecent(key, item) {
60
+ this.oldCache.delete(key);
61
+ this._set(key, item);
62
+ }
63
+ *_entriesAscending() {
64
+ for (const item of this.oldCache) {
65
+ const [key, value] = item;
66
+ if (!this.cache.has(key)) {
67
+ const deleted = this._deleteIfExpired(key, value);
68
+ if (deleted === false) {
69
+ yield item;
70
+ }
71
+ }
72
+ }
73
+ for (const item of this.cache) {
74
+ const [key, value] = item;
75
+ const deleted = this._deleteIfExpired(key, value);
76
+ if (deleted === false) {
77
+ yield item;
78
+ }
79
+ }
80
+ }
81
+ get(key) {
82
+ if (this.cache.has(key)) {
83
+ const item = this.cache.get(key);
84
+ return this._getItemValue(key, item);
85
+ }
86
+ if (this.oldCache.has(key)) {
87
+ const item = this.oldCache.get(key);
88
+ if (this._deleteIfExpired(key, item) === false) {
89
+ this._moveToRecent(key, item);
90
+ return item.value;
91
+ }
92
+ }
93
+ }
94
+ set(key, value, { maxAge = this.maxAge } = {}) {
95
+ const expiry = typeof maxAge === "number" && maxAge !== Number.POSITIVE_INFINITY ? Date.now() + maxAge : void 0;
96
+ if (this.cache.has(key)) {
97
+ this.cache.set(key, {
98
+ value,
99
+ expiry
100
+ });
101
+ } else {
102
+ this._set(key, { value, expiry });
103
+ }
104
+ }
105
+ has(key) {
106
+ if (this.cache.has(key)) {
107
+ return !this._deleteIfExpired(key, this.cache.get(key));
108
+ }
109
+ if (this.oldCache.has(key)) {
110
+ return !this._deleteIfExpired(key, this.oldCache.get(key));
111
+ }
112
+ return false;
113
+ }
114
+ peek(key) {
115
+ if (this.cache.has(key)) {
116
+ return this._peek(key, this.cache);
117
+ }
118
+ if (this.oldCache.has(key)) {
119
+ return this._peek(key, this.oldCache);
120
+ }
121
+ }
122
+ delete(key) {
123
+ const deleted = this.cache.delete(key);
124
+ if (deleted) {
125
+ this._size--;
126
+ }
127
+ return this.oldCache.delete(key) || deleted;
128
+ }
129
+ clear() {
130
+ this.cache.clear();
131
+ this.oldCache.clear();
132
+ this._size = 0;
133
+ }
134
+ resize(newSize) {
135
+ if (!(newSize && newSize > 0)) {
136
+ throw new TypeError("`maxSize` must be a number greater than 0");
137
+ }
138
+ const items = [...this._entriesAscending()];
139
+ const removeCount = items.length - newSize;
140
+ if (removeCount < 0) {
141
+ this.cache = new Map(items);
142
+ this.oldCache = /* @__PURE__ */ new Map();
143
+ this._size = items.length;
144
+ } else {
145
+ if (removeCount > 0) {
146
+ this._emitEvictions(items.slice(0, removeCount));
147
+ }
148
+ this.oldCache = new Map(items.slice(removeCount));
149
+ this.cache = /* @__PURE__ */ new Map();
150
+ this._size = 0;
151
+ }
152
+ this.maxSize = newSize;
153
+ }
154
+ *keys() {
155
+ for (const [key] of this) {
156
+ yield key;
157
+ }
158
+ }
159
+ *values() {
160
+ for (const [, value] of this) {
161
+ yield value;
162
+ }
163
+ }
164
+ *[Symbol.iterator]() {
165
+ for (const item of this.cache) {
166
+ const [key, value] = item;
167
+ const deleted = this._deleteIfExpired(key, value);
168
+ if (deleted === false) {
169
+ yield [key, value.value];
170
+ }
171
+ }
172
+ for (const item of this.oldCache) {
173
+ const [key, value] = item;
174
+ if (!this.cache.has(key)) {
175
+ const deleted = this._deleteIfExpired(key, value);
176
+ if (deleted === false) {
177
+ yield [key, value.value];
178
+ }
179
+ }
180
+ }
181
+ }
182
+ *entriesDescending() {
183
+ let items = [...this.cache];
184
+ for (let i = items.length - 1; i >= 0; --i) {
185
+ const item = items[i];
186
+ const [key, value] = item;
187
+ const deleted = this._deleteIfExpired(key, value);
188
+ if (deleted === false) {
189
+ yield [key, value.value];
190
+ }
191
+ }
192
+ items = [...this.oldCache];
193
+ for (let i = items.length - 1; i >= 0; --i) {
194
+ const item = items[i];
195
+ const [key, value] = item;
196
+ if (!this.cache.has(key)) {
197
+ const deleted = this._deleteIfExpired(key, value);
198
+ if (deleted === false) {
199
+ yield [key, value.value];
200
+ }
201
+ }
202
+ }
203
+ }
204
+ *entriesAscending() {
205
+ for (const [key, value] of this._entriesAscending()) {
206
+ yield [key, value.value];
207
+ }
208
+ }
209
+ get size() {
210
+ if (!this._size) {
211
+ return this.oldCache.size;
212
+ }
213
+ let oldCacheSize = 0;
214
+ for (const key of this.oldCache.keys()) {
215
+ if (!this.cache.has(key)) {
216
+ oldCacheSize++;
217
+ }
218
+ }
219
+ return Math.min(this._size + oldCacheSize, this.maxSize);
220
+ }
221
+ entries() {
222
+ return this.entriesAscending();
223
+ }
224
+ forEach(callbackFunction, thisArgument = this) {
225
+ for (const [key, value] of this.entriesAscending()) {
226
+ callbackFunction.call(thisArgument, value, key, this);
227
+ }
228
+ }
229
+ get [Symbol.toStringTag]() {
230
+ return JSON.stringify([...this.entriesAscending()]);
231
+ }
232
+ }
233
+ module.exports = QuickLRU;
234
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../node_modules/quick-lru/index.js"],"sourcesContent":["export default class QuickLRU extends Map {\n\tconstructor(options = {}) {\n\t\tsuper();\n\n\t\tif (!(options.maxSize && options.maxSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tif (typeof options.maxAge === 'number' && options.maxAge === 0) {\n\t\t\tthrow new TypeError('`maxAge` must be a number greater than 0');\n\t\t}\n\n\t\t// TODO: Use private class fields when ESLint supports them.\n\t\tthis.maxSize = options.maxSize;\n\t\tthis.maxAge = options.maxAge || Number.POSITIVE_INFINITY;\n\t\tthis.onEviction = options.onEviction;\n\t\tthis.cache = new Map();\n\t\tthis.oldCache = new Map();\n\t\tthis._size = 0;\n\t}\n\n\t// TODO: Use private class methods when targeting Node.js 16.\n\t_emitEvictions(cache) {\n\t\tif (typeof this.onEviction !== 'function') {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const [key, item] of cache) {\n\t\t\tthis.onEviction(key, item.value);\n\t\t}\n\t}\n\n\t_deleteIfExpired(key, item) {\n\t\tif (typeof item.expiry === 'number' && item.expiry <= Date.now()) {\n\t\t\tif (typeof this.onEviction === 'function') {\n\t\t\t\tthis.onEviction(key, item.value);\n\t\t\t}\n\n\t\t\treturn this.delete(key);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t_getOrDeleteIfExpired(key, item) {\n\t\tconst deleted = this._deleteIfExpired(key, item);\n\t\tif (deleted === false) {\n\t\t\treturn item.value;\n\t\t}\n\t}\n\n\t_getItemValue(key, item) {\n\t\treturn item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;\n\t}\n\n\t_peek(key, cache) {\n\t\tconst item = cache.get(key);\n\n\t\treturn this._getItemValue(key, item);\n\t}\n\n\t_set(key, value) {\n\t\tthis.cache.set(key, value);\n\t\tthis._size++;\n\n\t\tif (this._size >= this.maxSize) {\n\t\t\tthis._size = 0;\n\t\t\tthis._emitEvictions(this.oldCache);\n\t\t\tthis.oldCache = this.cache;\n\t\t\tthis.cache = new Map();\n\t\t}\n\t}\n\n\t_moveToRecent(key, item) {\n\t\tthis.oldCache.delete(key);\n\t\tthis._set(key, item);\n\t}\n\n\t* _entriesAscending() {\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key, value] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\t\tif (deleted === false) {\n\t\t\t\t\tyield item;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const item of this.cache) {\n\t\t\tconst [key, value] = item;\n\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\tif (deleted === false) {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t}\n\t}\n\n\tget(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\tconst item = this.cache.get(key);\n\n\t\t\treturn this._getItemValue(key, item);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\tconst item = this.oldCache.get(key);\n\t\t\tif (this._deleteIfExpired(key, item) === false) {\n\t\t\t\tthis._moveToRecent(key, item);\n\t\t\t\treturn item.value;\n\t\t\t}\n\t\t}\n\t}\n\n\tset(key, value, {maxAge = this.maxAge} = {}) {\n\t\tconst expiry =\n\t\t\ttypeof maxAge === 'number' && maxAge !== Number.POSITIVE_INFINITY ?\n\t\t\t\tDate.now() + maxAge :\n\t\t\t\tundefined;\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.set(key, {\n\t\t\t\tvalue,\n\t\t\t\texpiry\n\t\t\t});\n\t\t} else {\n\t\t\tthis._set(key, {value, expiry});\n\t\t}\n\t}\n\n\thas(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn !this._deleteIfExpired(key, this.cache.get(key));\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn !this._deleteIfExpired(key, this.oldCache.get(key));\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpeek(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this._peek(key, this.cache);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn this._peek(key, this.oldCache);\n\t\t}\n\t}\n\n\tdelete(key) {\n\t\tconst deleted = this.cache.delete(key);\n\t\tif (deleted) {\n\t\t\tthis._size--;\n\t\t}\n\n\t\treturn this.oldCache.delete(key) || deleted;\n\t}\n\n\tclear() {\n\t\tthis.cache.clear();\n\t\tthis.oldCache.clear();\n\t\tthis._size = 0;\n\t}\n\n\tresize(newSize) {\n\t\tif (!(newSize && newSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tconst items = [...this._entriesAscending()];\n\t\tconst removeCount = items.length - newSize;\n\t\tif (removeCount < 0) {\n\t\t\tthis.cache = new Map(items);\n\t\t\tthis.oldCache = new Map();\n\t\t\tthis._size = items.length;\n\t\t} else {\n\t\t\tif (removeCount > 0) {\n\t\t\t\tthis._emitEvictions(items.slice(0, removeCount));\n\t\t\t}\n\n\t\t\tthis.oldCache = new Map(items.slice(removeCount));\n\t\t\tthis.cache = new Map();\n\t\t\tthis._size = 0;\n\t\t}\n\n\t\tthis.maxSize = newSize;\n\t}\n\n\t* keys() {\n\t\tfor (const [key] of this) {\n\t\t\tyield key;\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value;\n\t\t}\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tfor (const item of this.cache) {\n\t\t\tconst [key, value] = item;\n\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\tif (deleted === false) {\n\t\t\t\tyield [key, value.value];\n\t\t\t}\n\t\t}\n\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key, value] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\t\tif (deleted === false) {\n\t\t\t\t\tyield [key, value.value];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t* entriesDescending() {\n\t\tlet items = [...this.cache];\n\t\tfor (let i = items.length - 1; i >= 0; --i) {\n\t\t\tconst item = items[i];\n\t\t\tconst [key, value] = item;\n\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\tif (deleted === false) {\n\t\t\t\tyield [key, value.value];\n\t\t\t}\n\t\t}\n\n\t\titems = [...this.oldCache];\n\t\tfor (let i = items.length - 1; i >= 0; --i) {\n\t\t\tconst item = items[i];\n\t\t\tconst [key, value] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\t\tif (deleted === false) {\n\t\t\t\t\tyield [key, value.value];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t* entriesAscending() {\n\t\tfor (const [key, value] of this._entriesAscending()) {\n\t\t\tyield [key, value.value];\n\t\t}\n\t}\n\n\tget size() {\n\t\tif (!this._size) {\n\t\t\treturn this.oldCache.size;\n\t\t}\n\n\t\tlet oldCacheSize = 0;\n\t\tfor (const key of this.oldCache.keys()) {\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\toldCacheSize++;\n\t\t\t}\n\t\t}\n\n\t\treturn Math.min(this._size + oldCacheSize, this.maxSize);\n\t}\n\n\tentries() {\n\t\treturn this.entriesAscending();\n\t}\n\n\tforEach(callbackFunction, thisArgument = this) {\n\t\tfor (const [key, value] of this.entriesAscending()) {\n\t\t\tcallbackFunction.call(thisArgument, value, key, this);\n\t\t}\n\t}\n\n\tget [Symbol.toStringTag]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AA,CAAC;AAAA,EAClD;AACF;;","x_google_ignoreList":[0]}
@@ -0,0 +1,235 @@
1
+ class QuickLRU extends Map {
2
+ constructor(options = {}) {
3
+ super();
4
+ if (!(options.maxSize && options.maxSize > 0)) {
5
+ throw new TypeError("`maxSize` must be a number greater than 0");
6
+ }
7
+ if (typeof options.maxAge === "number" && options.maxAge === 0) {
8
+ throw new TypeError("`maxAge` must be a number greater than 0");
9
+ }
10
+ this.maxSize = options.maxSize;
11
+ this.maxAge = options.maxAge || Number.POSITIVE_INFINITY;
12
+ this.onEviction = options.onEviction;
13
+ this.cache = /* @__PURE__ */ new Map();
14
+ this.oldCache = /* @__PURE__ */ new Map();
15
+ this._size = 0;
16
+ }
17
+ // TODO: Use private class methods when targeting Node.js 16.
18
+ _emitEvictions(cache) {
19
+ if (typeof this.onEviction !== "function") {
20
+ return;
21
+ }
22
+ for (const [key, item] of cache) {
23
+ this.onEviction(key, item.value);
24
+ }
25
+ }
26
+ _deleteIfExpired(key, item) {
27
+ if (typeof item.expiry === "number" && item.expiry <= Date.now()) {
28
+ if (typeof this.onEviction === "function") {
29
+ this.onEviction(key, item.value);
30
+ }
31
+ return this.delete(key);
32
+ }
33
+ return false;
34
+ }
35
+ _getOrDeleteIfExpired(key, item) {
36
+ const deleted = this._deleteIfExpired(key, item);
37
+ if (deleted === false) {
38
+ return item.value;
39
+ }
40
+ }
41
+ _getItemValue(key, item) {
42
+ return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;
43
+ }
44
+ _peek(key, cache) {
45
+ const item = cache.get(key);
46
+ return this._getItemValue(key, item);
47
+ }
48
+ _set(key, value) {
49
+ this.cache.set(key, value);
50
+ this._size++;
51
+ if (this._size >= this.maxSize) {
52
+ this._size = 0;
53
+ this._emitEvictions(this.oldCache);
54
+ this.oldCache = this.cache;
55
+ this.cache = /* @__PURE__ */ new Map();
56
+ }
57
+ }
58
+ _moveToRecent(key, item) {
59
+ this.oldCache.delete(key);
60
+ this._set(key, item);
61
+ }
62
+ *_entriesAscending() {
63
+ for (const item of this.oldCache) {
64
+ const [key, value] = item;
65
+ if (!this.cache.has(key)) {
66
+ const deleted = this._deleteIfExpired(key, value);
67
+ if (deleted === false) {
68
+ yield item;
69
+ }
70
+ }
71
+ }
72
+ for (const item of this.cache) {
73
+ const [key, value] = item;
74
+ const deleted = this._deleteIfExpired(key, value);
75
+ if (deleted === false) {
76
+ yield item;
77
+ }
78
+ }
79
+ }
80
+ get(key) {
81
+ if (this.cache.has(key)) {
82
+ const item = this.cache.get(key);
83
+ return this._getItemValue(key, item);
84
+ }
85
+ if (this.oldCache.has(key)) {
86
+ const item = this.oldCache.get(key);
87
+ if (this._deleteIfExpired(key, item) === false) {
88
+ this._moveToRecent(key, item);
89
+ return item.value;
90
+ }
91
+ }
92
+ }
93
+ set(key, value, { maxAge = this.maxAge } = {}) {
94
+ const expiry = typeof maxAge === "number" && maxAge !== Number.POSITIVE_INFINITY ? Date.now() + maxAge : void 0;
95
+ if (this.cache.has(key)) {
96
+ this.cache.set(key, {
97
+ value,
98
+ expiry
99
+ });
100
+ } else {
101
+ this._set(key, { value, expiry });
102
+ }
103
+ }
104
+ has(key) {
105
+ if (this.cache.has(key)) {
106
+ return !this._deleteIfExpired(key, this.cache.get(key));
107
+ }
108
+ if (this.oldCache.has(key)) {
109
+ return !this._deleteIfExpired(key, this.oldCache.get(key));
110
+ }
111
+ return false;
112
+ }
113
+ peek(key) {
114
+ if (this.cache.has(key)) {
115
+ return this._peek(key, this.cache);
116
+ }
117
+ if (this.oldCache.has(key)) {
118
+ return this._peek(key, this.oldCache);
119
+ }
120
+ }
121
+ delete(key) {
122
+ const deleted = this.cache.delete(key);
123
+ if (deleted) {
124
+ this._size--;
125
+ }
126
+ return this.oldCache.delete(key) || deleted;
127
+ }
128
+ clear() {
129
+ this.cache.clear();
130
+ this.oldCache.clear();
131
+ this._size = 0;
132
+ }
133
+ resize(newSize) {
134
+ if (!(newSize && newSize > 0)) {
135
+ throw new TypeError("`maxSize` must be a number greater than 0");
136
+ }
137
+ const items = [...this._entriesAscending()];
138
+ const removeCount = items.length - newSize;
139
+ if (removeCount < 0) {
140
+ this.cache = new Map(items);
141
+ this.oldCache = /* @__PURE__ */ new Map();
142
+ this._size = items.length;
143
+ } else {
144
+ if (removeCount > 0) {
145
+ this._emitEvictions(items.slice(0, removeCount));
146
+ }
147
+ this.oldCache = new Map(items.slice(removeCount));
148
+ this.cache = /* @__PURE__ */ new Map();
149
+ this._size = 0;
150
+ }
151
+ this.maxSize = newSize;
152
+ }
153
+ *keys() {
154
+ for (const [key] of this) {
155
+ yield key;
156
+ }
157
+ }
158
+ *values() {
159
+ for (const [, value] of this) {
160
+ yield value;
161
+ }
162
+ }
163
+ *[Symbol.iterator]() {
164
+ for (const item of this.cache) {
165
+ const [key, value] = item;
166
+ const deleted = this._deleteIfExpired(key, value);
167
+ if (deleted === false) {
168
+ yield [key, value.value];
169
+ }
170
+ }
171
+ for (const item of this.oldCache) {
172
+ const [key, value] = item;
173
+ if (!this.cache.has(key)) {
174
+ const deleted = this._deleteIfExpired(key, value);
175
+ if (deleted === false) {
176
+ yield [key, value.value];
177
+ }
178
+ }
179
+ }
180
+ }
181
+ *entriesDescending() {
182
+ let items = [...this.cache];
183
+ for (let i = items.length - 1; i >= 0; --i) {
184
+ const item = items[i];
185
+ const [key, value] = item;
186
+ const deleted = this._deleteIfExpired(key, value);
187
+ if (deleted === false) {
188
+ yield [key, value.value];
189
+ }
190
+ }
191
+ items = [...this.oldCache];
192
+ for (let i = items.length - 1; i >= 0; --i) {
193
+ const item = items[i];
194
+ const [key, value] = item;
195
+ if (!this.cache.has(key)) {
196
+ const deleted = this._deleteIfExpired(key, value);
197
+ if (deleted === false) {
198
+ yield [key, value.value];
199
+ }
200
+ }
201
+ }
202
+ }
203
+ *entriesAscending() {
204
+ for (const [key, value] of this._entriesAscending()) {
205
+ yield [key, value.value];
206
+ }
207
+ }
208
+ get size() {
209
+ if (!this._size) {
210
+ return this.oldCache.size;
211
+ }
212
+ let oldCacheSize = 0;
213
+ for (const key of this.oldCache.keys()) {
214
+ if (!this.cache.has(key)) {
215
+ oldCacheSize++;
216
+ }
217
+ }
218
+ return Math.min(this._size + oldCacheSize, this.maxSize);
219
+ }
220
+ entries() {
221
+ return this.entriesAscending();
222
+ }
223
+ forEach(callbackFunction, thisArgument = this) {
224
+ for (const [key, value] of this.entriesAscending()) {
225
+ callbackFunction.call(thisArgument, value, key, this);
226
+ }
227
+ }
228
+ get [Symbol.toStringTag]() {
229
+ return JSON.stringify([...this.entriesAscending()]);
230
+ }
231
+ }
232
+ export {
233
+ QuickLRU as default
234
+ };
235
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../node_modules/quick-lru/index.js"],"sourcesContent":["export default class QuickLRU extends Map {\n\tconstructor(options = {}) {\n\t\tsuper();\n\n\t\tif (!(options.maxSize && options.maxSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tif (typeof options.maxAge === 'number' && options.maxAge === 0) {\n\t\t\tthrow new TypeError('`maxAge` must be a number greater than 0');\n\t\t}\n\n\t\t// TODO: Use private class fields when ESLint supports them.\n\t\tthis.maxSize = options.maxSize;\n\t\tthis.maxAge = options.maxAge || Number.POSITIVE_INFINITY;\n\t\tthis.onEviction = options.onEviction;\n\t\tthis.cache = new Map();\n\t\tthis.oldCache = new Map();\n\t\tthis._size = 0;\n\t}\n\n\t// TODO: Use private class methods when targeting Node.js 16.\n\t_emitEvictions(cache) {\n\t\tif (typeof this.onEviction !== 'function') {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const [key, item] of cache) {\n\t\t\tthis.onEviction(key, item.value);\n\t\t}\n\t}\n\n\t_deleteIfExpired(key, item) {\n\t\tif (typeof item.expiry === 'number' && item.expiry <= Date.now()) {\n\t\t\tif (typeof this.onEviction === 'function') {\n\t\t\t\tthis.onEviction(key, item.value);\n\t\t\t}\n\n\t\t\treturn this.delete(key);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t_getOrDeleteIfExpired(key, item) {\n\t\tconst deleted = this._deleteIfExpired(key, item);\n\t\tif (deleted === false) {\n\t\t\treturn item.value;\n\t\t}\n\t}\n\n\t_getItemValue(key, item) {\n\t\treturn item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;\n\t}\n\n\t_peek(key, cache) {\n\t\tconst item = cache.get(key);\n\n\t\treturn this._getItemValue(key, item);\n\t}\n\n\t_set(key, value) {\n\t\tthis.cache.set(key, value);\n\t\tthis._size++;\n\n\t\tif (this._size >= this.maxSize) {\n\t\t\tthis._size = 0;\n\t\t\tthis._emitEvictions(this.oldCache);\n\t\t\tthis.oldCache = this.cache;\n\t\t\tthis.cache = new Map();\n\t\t}\n\t}\n\n\t_moveToRecent(key, item) {\n\t\tthis.oldCache.delete(key);\n\t\tthis._set(key, item);\n\t}\n\n\t* _entriesAscending() {\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key, value] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\t\tif (deleted === false) {\n\t\t\t\t\tyield item;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const item of this.cache) {\n\t\t\tconst [key, value] = item;\n\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\tif (deleted === false) {\n\t\t\t\tyield item;\n\t\t\t}\n\t\t}\n\t}\n\n\tget(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\tconst item = this.cache.get(key);\n\n\t\t\treturn this._getItemValue(key, item);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\tconst item = this.oldCache.get(key);\n\t\t\tif (this._deleteIfExpired(key, item) === false) {\n\t\t\t\tthis._moveToRecent(key, item);\n\t\t\t\treturn item.value;\n\t\t\t}\n\t\t}\n\t}\n\n\tset(key, value, {maxAge = this.maxAge} = {}) {\n\t\tconst expiry =\n\t\t\ttypeof maxAge === 'number' && maxAge !== Number.POSITIVE_INFINITY ?\n\t\t\t\tDate.now() + maxAge :\n\t\t\t\tundefined;\n\t\tif (this.cache.has(key)) {\n\t\t\tthis.cache.set(key, {\n\t\t\t\tvalue,\n\t\t\t\texpiry\n\t\t\t});\n\t\t} else {\n\t\t\tthis._set(key, {value, expiry});\n\t\t}\n\t}\n\n\thas(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn !this._deleteIfExpired(key, this.cache.get(key));\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn !this._deleteIfExpired(key, this.oldCache.get(key));\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpeek(key) {\n\t\tif (this.cache.has(key)) {\n\t\t\treturn this._peek(key, this.cache);\n\t\t}\n\n\t\tif (this.oldCache.has(key)) {\n\t\t\treturn this._peek(key, this.oldCache);\n\t\t}\n\t}\n\n\tdelete(key) {\n\t\tconst deleted = this.cache.delete(key);\n\t\tif (deleted) {\n\t\t\tthis._size--;\n\t\t}\n\n\t\treturn this.oldCache.delete(key) || deleted;\n\t}\n\n\tclear() {\n\t\tthis.cache.clear();\n\t\tthis.oldCache.clear();\n\t\tthis._size = 0;\n\t}\n\n\tresize(newSize) {\n\t\tif (!(newSize && newSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0');\n\t\t}\n\n\t\tconst items = [...this._entriesAscending()];\n\t\tconst removeCount = items.length - newSize;\n\t\tif (removeCount < 0) {\n\t\t\tthis.cache = new Map(items);\n\t\t\tthis.oldCache = new Map();\n\t\t\tthis._size = items.length;\n\t\t} else {\n\t\t\tif (removeCount > 0) {\n\t\t\t\tthis._emitEvictions(items.slice(0, removeCount));\n\t\t\t}\n\n\t\t\tthis.oldCache = new Map(items.slice(removeCount));\n\t\t\tthis.cache = new Map();\n\t\t\tthis._size = 0;\n\t\t}\n\n\t\tthis.maxSize = newSize;\n\t}\n\n\t* keys() {\n\t\tfor (const [key] of this) {\n\t\t\tyield key;\n\t\t}\n\t}\n\n\t* values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value;\n\t\t}\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tfor (const item of this.cache) {\n\t\t\tconst [key, value] = item;\n\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\tif (deleted === false) {\n\t\t\t\tyield [key, value.value];\n\t\t\t}\n\t\t}\n\n\t\tfor (const item of this.oldCache) {\n\t\t\tconst [key, value] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\t\tif (deleted === false) {\n\t\t\t\t\tyield [key, value.value];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t* entriesDescending() {\n\t\tlet items = [...this.cache];\n\t\tfor (let i = items.length - 1; i >= 0; --i) {\n\t\t\tconst item = items[i];\n\t\t\tconst [key, value] = item;\n\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\tif (deleted === false) {\n\t\t\t\tyield [key, value.value];\n\t\t\t}\n\t\t}\n\n\t\titems = [...this.oldCache];\n\t\tfor (let i = items.length - 1; i >= 0; --i) {\n\t\t\tconst item = items[i];\n\t\t\tconst [key, value] = item;\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\tconst deleted = this._deleteIfExpired(key, value);\n\t\t\t\tif (deleted === false) {\n\t\t\t\t\tyield [key, value.value];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t* entriesAscending() {\n\t\tfor (const [key, value] of this._entriesAscending()) {\n\t\t\tyield [key, value.value];\n\t\t}\n\t}\n\n\tget size() {\n\t\tif (!this._size) {\n\t\t\treturn this.oldCache.size;\n\t\t}\n\n\t\tlet oldCacheSize = 0;\n\t\tfor (const key of this.oldCache.keys()) {\n\t\t\tif (!this.cache.has(key)) {\n\t\t\t\toldCacheSize++;\n\t\t\t}\n\t\t}\n\n\t\treturn Math.min(this._size + oldCacheSize, this.maxSize);\n\t}\n\n\tentries() {\n\t\treturn this.entriesAscending();\n\t}\n\n\tforEach(callbackFunction, thisArgument = this) {\n\t\tfor (const [key, value] of this.entriesAscending()) {\n\t\t\tcallbackFunction.call(thisArgument, value, key, this);\n\t\t}\n\t}\n\n\tget [Symbol.toStringTag]() {\n\t\treturn JSON.stringify([...this.entriesAscending()]);\n\t}\n}\n"],"names":[],"mappings":"AAAe,MAAM,iBAAiB,IAAI;AAAA,EACzC,YAAY,UAAU,IAAI;AACzB;AAEA,QAAI,EAAE,QAAQ,WAAW,QAAQ,UAAU,IAAI;AAC9C,YAAM,IAAI,UAAU,2CAA2C;AAAA,IAC/D;AAED,QAAI,OAAO,QAAQ,WAAW,YAAY,QAAQ,WAAW,GAAG;AAC/D,YAAM,IAAI,UAAU,0CAA0C;AAAA,IAC9D;AAGD,SAAK,UAAU,QAAQ;AACvB,SAAK,SAAS,QAAQ,UAAU,OAAO;AACvC,SAAK,aAAa,QAAQ;AAC1B,SAAK,QAAQ,oBAAI;AACjB,SAAK,WAAW,oBAAI;AACpB,SAAK,QAAQ;AAAA,EACb;AAAA;AAAA,EAGD,eAAe,OAAO;AACrB,QAAI,OAAO,KAAK,eAAe,YAAY;AAC1C;AAAA,IACA;AAED,eAAW,CAAC,KAAK,IAAI,KAAK,OAAO;AAChC,WAAK,WAAW,KAAK,KAAK,KAAK;AAAA,IAC/B;AAAA,EACD;AAAA,EAED,iBAAiB,KAAK,MAAM;AAC3B,QAAI,OAAO,KAAK,WAAW,YAAY,KAAK,UAAU,KAAK,OAAO;AACjE,UAAI,OAAO,KAAK,eAAe,YAAY;AAC1C,aAAK,WAAW,KAAK,KAAK,KAAK;AAAA,MAC/B;AAED,aAAO,KAAK,OAAO,GAAG;AAAA,IACtB;AAED,WAAO;AAAA,EACP;AAAA,EAED,sBAAsB,KAAK,MAAM;AAChC,UAAM,UAAU,KAAK,iBAAiB,KAAK,IAAI;AAC/C,QAAI,YAAY,OAAO;AACtB,aAAO,KAAK;AAAA,IACZ;AAAA,EACD;AAAA,EA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;AACnD,uBAAiB,KAAK,cAAc,OAAO,KAAK,IAAI;AAAA,IACpD;AAAA,EACD;AAAA,EAED,KAAK,OAAO,WAAW,IAAI;AAC1B,WAAO,KAAK,UAAU,CAAC,GAAG,KAAK,iBAAkB,CAAA,CAAC;AAAA,EAClD;AACF;","x_google_ignoreList":[0]}
@@ -1,28 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const BLANK_LINE_IDENTIFIER = "// ___BLANK_LINE_TO_BE_REPLACED___";
4
- const CUSTOM_TYPES_DOCUMENTATION_URL = "https://prismic.io/docs/core-concepts/custom-types";
5
- const SHARED_SLICES_DOCUMENTATION_URL = "https://prismic.io/docs/core-concepts/reusing-slices";
3
+ const CUSTOM_TYPES_DOCUMENTATION_URL = "https://prismic.io/docs/custom-types";
4
+ const SHARED_SLICES_DOCUMENTATION_URL = "https://prismic.io/docs/slice";
6
5
  const FIELD_DOCUMENTATION_URLS = {
7
- UID: "https://prismic.io/docs/core-concepts/uid",
8
- Boolean: "https://prismic.io/docs/core-concepts/boolean",
9
- Color: "https://prismic.io/docs/core-concepts/color",
10
- Date: "https://prismic.io/docs/core-concepts/date",
11
- Timestamp: "https://prismic.io/docs/core-concepts/timestamp",
12
- Number: "https://prismic.io/docs/core-concepts/number",
13
- Text: "https://prismic.io/docs/core-concepts/key-text",
14
- Select: "https://prismic.io/docs/core-concepts/select",
15
- StructuredText: "https://prismic.io/docs/core-concepts/rich-text-title",
16
- Image: "https://prismic.io/docs/core-concepts/image",
17
- Link: "https://prismic.io/docs/core-concepts/link-content-relationship",
18
- Embed: "https://prismic.io/docs/core-concepts/embed",
19
- GeoPoint: "https://prismic.io/docs/core-concepts/geopoint",
20
- Group: "https://prismic.io/docs/core-concepts/group",
21
- IntegrationFields: "https://prismic.io/docs/core-concepts/integration-fields",
22
- Slices: "https://prismic.io/docs/core-concepts/slices",
23
- Choice: "https://prismic.io/docs/core-concepts/slices"
6
+ UID: "https://prismic.io/docs/field#uid",
7
+ Boolean: "https://prismic.io/docs/field#boolean",
8
+ Color: "https://prismic.io/docs/field#color",
9
+ Date: "https://prismic.io/docs/field#date",
10
+ Timestamp: "https://prismic.io/docs/field#timestamp",
11
+ Number: "https://prismic.io/docs/field#number",
12
+ Text: "https://prismic.io/docs/field#key-text",
13
+ Select: "https://prismic.io/docs/field#select",
14
+ StructuredText: "https://prismic.io/docs/field#rich-text-title",
15
+ Image: "https://prismic.io/docs/field#image",
16
+ Link: "https://prismic.io/docs/field#link-content-relationship",
17
+ Embed: "https://prismic.io/docs/field#embed",
18
+ GeoPoint: "https://prismic.io/docs/field#geopoint",
19
+ Group: "https://prismic.io/docs/field#group",
20
+ IntegrationFields: "https://prismic.io/docs/field#integration",
21
+ Slices: "https://prismic.io/docs/field#slices",
22
+ Choice: "https://prismic.io/docs/field#slices"
24
23
  };
25
- exports.BLANK_LINE_IDENTIFIER = BLANK_LINE_IDENTIFIER;
26
24
  exports.CUSTOM_TYPES_DOCUMENTATION_URL = CUSTOM_TYPES_DOCUMENTATION_URL;
27
25
  exports.FIELD_DOCUMENTATION_URLS = FIELD_DOCUMENTATION_URLS;
28
26
  exports.SHARED_SLICES_DOCUMENTATION_URL = SHARED_SLICES_DOCUMENTATION_URL;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.cjs","sources":["../../src/constants.ts"],"sourcesContent":["import type { CustomTypeModelFieldType } from \"@prismicio/client\";\n\nexport const BLANK_LINE_IDENTIFIER = \"// ___BLANK_LINE_TO_BE_REPLACED___\";\n\nexport const CUSTOM_TYPES_DOCUMENTATION_URL =\n\t\"https://prismic.io/docs/core-concepts/custom-types\";\n\nexport const SHARED_SLICES_DOCUMENTATION_URL =\n\t\"https://prismic.io/docs/core-concepts/reusing-slices\";\n\nexport const FIELD_DOCUMENTATION_URLS: Record<\n\tExclude<\n\t\t(typeof CustomTypeModelFieldType)[keyof typeof CustomTypeModelFieldType],\n\t\t\"Range\" | \"Separator\"\n\t>,\n\tstring\n> = {\n\tUID: \"https://prismic.io/docs/core-concepts/uid\",\n\tBoolean: \"https://prismic.io/docs/core-concepts/boolean\",\n\tColor: \"https://prismic.io/docs/core-concepts/color\",\n\tDate: \"https://prismic.io/docs/core-concepts/date\",\n\tTimestamp: \"https://prismic.io/docs/core-concepts/timestamp\",\n\tNumber: \"https://prismic.io/docs/core-concepts/number\",\n\tText: \"https://prismic.io/docs/core-concepts/key-text\",\n\tSelect: \"https://prismic.io/docs/core-concepts/select\",\n\tStructuredText: \"https://prismic.io/docs/core-concepts/rich-text-title\",\n\tImage: \"https://prismic.io/docs/core-concepts/image\",\n\tLink: \"https://prismic.io/docs/core-concepts/link-content-relationship\",\n\tEmbed: \"https://prismic.io/docs/core-concepts/embed\",\n\tGeoPoint: \"https://prismic.io/docs/core-concepts/geopoint\",\n\tGroup: \"https://prismic.io/docs/core-concepts/group\",\n\tIntegrationFields: \"https://prismic.io/docs/core-concepts/integration-fields\",\n\tSlices: \"https://prismic.io/docs/core-concepts/slices\",\n\tChoice: \"https://prismic.io/docs/core-concepts/slices\",\n};\n"],"names":[],"mappings":";;AAEO,MAAM,wBAAwB;AAE9B,MAAM,iCACZ;AAEM,MAAM,kCACZ;AAEM,MAAM,2BAMT;AAAA,EACH,KAAK;AAAA,EACL,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AAAA,EACP,mBAAmB;AAAA,EACnB,QAAQ;AAAA,EACR,QAAQ;;;;;;"}
1
+ {"version":3,"file":"constants.cjs","sources":["../../src/constants.ts"],"sourcesContent":["import type { CustomTypeModelFieldType } from \"@prismicio/client\";\n\nexport const CUSTOM_TYPES_DOCUMENTATION_URL =\n\t\"https://prismic.io/docs/custom-types\";\n\nexport const SHARED_SLICES_DOCUMENTATION_URL = \"https://prismic.io/docs/slice\";\n\nexport const FIELD_DOCUMENTATION_URLS: Record<\n\tExclude<\n\t\t(typeof CustomTypeModelFieldType)[keyof typeof CustomTypeModelFieldType],\n\t\t\"Range\" | \"Separator\"\n\t>,\n\tstring\n> = {\n\tUID: \"https://prismic.io/docs/field#uid\",\n\tBoolean: \"https://prismic.io/docs/field#boolean\",\n\tColor: \"https://prismic.io/docs/field#color\",\n\tDate: \"https://prismic.io/docs/field#date\",\n\tTimestamp: \"https://prismic.io/docs/field#timestamp\",\n\tNumber: \"https://prismic.io/docs/field#number\",\n\tText: \"https://prismic.io/docs/field#key-text\",\n\tSelect: \"https://prismic.io/docs/field#select\",\n\tStructuredText: \"https://prismic.io/docs/field#rich-text-title\",\n\tImage: \"https://prismic.io/docs/field#image\",\n\tLink: \"https://prismic.io/docs/field#link-content-relationship\",\n\tEmbed: \"https://prismic.io/docs/field#embed\",\n\tGeoPoint: \"https://prismic.io/docs/field#geopoint\",\n\tGroup: \"https://prismic.io/docs/field#group\",\n\tIntegrationFields: \"https://prismic.io/docs/field#integration\",\n\tSlices: \"https://prismic.io/docs/field#slices\",\n\tChoice: \"https://prismic.io/docs/field#slices\",\n};\n"],"names":[],"mappings":";;AAEO,MAAM,iCACZ;AAEM,MAAM,kCAAkC;AAExC,MAAM,2BAMT;AAAA,EACH,KAAK;AAAA,EACL,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AAAA,EACP,mBAAmB;AAAA,EACnB,QAAQ;AAAA,EACR,QAAQ;;;;;"}
@@ -1,5 +1,4 @@
1
1
  import type { CustomTypeModelFieldType } from "@prismicio/client";
2
- export declare const BLANK_LINE_IDENTIFIER = "// ___BLANK_LINE_TO_BE_REPLACED___";
3
- export declare const CUSTOM_TYPES_DOCUMENTATION_URL = "https://prismic.io/docs/core-concepts/custom-types";
4
- export declare const SHARED_SLICES_DOCUMENTATION_URL = "https://prismic.io/docs/core-concepts/reusing-slices";
2
+ export declare const CUSTOM_TYPES_DOCUMENTATION_URL = "https://prismic.io/docs/custom-types";
3
+ export declare const SHARED_SLICES_DOCUMENTATION_URL = "https://prismic.io/docs/slice";
5
4
  export declare const FIELD_DOCUMENTATION_URLS: Record<Exclude<(typeof CustomTypeModelFieldType)[keyof typeof CustomTypeModelFieldType], "Range" | "Separator">, string>;
package/dist/constants.js CHANGED
@@ -1,27 +1,25 @@
1
- const BLANK_LINE_IDENTIFIER = "// ___BLANK_LINE_TO_BE_REPLACED___";
2
- const CUSTOM_TYPES_DOCUMENTATION_URL = "https://prismic.io/docs/core-concepts/custom-types";
3
- const SHARED_SLICES_DOCUMENTATION_URL = "https://prismic.io/docs/core-concepts/reusing-slices";
1
+ const CUSTOM_TYPES_DOCUMENTATION_URL = "https://prismic.io/docs/custom-types";
2
+ const SHARED_SLICES_DOCUMENTATION_URL = "https://prismic.io/docs/slice";
4
3
  const FIELD_DOCUMENTATION_URLS = {
5
- UID: "https://prismic.io/docs/core-concepts/uid",
6
- Boolean: "https://prismic.io/docs/core-concepts/boolean",
7
- Color: "https://prismic.io/docs/core-concepts/color",
8
- Date: "https://prismic.io/docs/core-concepts/date",
9
- Timestamp: "https://prismic.io/docs/core-concepts/timestamp",
10
- Number: "https://prismic.io/docs/core-concepts/number",
11
- Text: "https://prismic.io/docs/core-concepts/key-text",
12
- Select: "https://prismic.io/docs/core-concepts/select",
13
- StructuredText: "https://prismic.io/docs/core-concepts/rich-text-title",
14
- Image: "https://prismic.io/docs/core-concepts/image",
15
- Link: "https://prismic.io/docs/core-concepts/link-content-relationship",
16
- Embed: "https://prismic.io/docs/core-concepts/embed",
17
- GeoPoint: "https://prismic.io/docs/core-concepts/geopoint",
18
- Group: "https://prismic.io/docs/core-concepts/group",
19
- IntegrationFields: "https://prismic.io/docs/core-concepts/integration-fields",
20
- Slices: "https://prismic.io/docs/core-concepts/slices",
21
- Choice: "https://prismic.io/docs/core-concepts/slices"
4
+ UID: "https://prismic.io/docs/field#uid",
5
+ Boolean: "https://prismic.io/docs/field#boolean",
6
+ Color: "https://prismic.io/docs/field#color",
7
+ Date: "https://prismic.io/docs/field#date",
8
+ Timestamp: "https://prismic.io/docs/field#timestamp",
9
+ Number: "https://prismic.io/docs/field#number",
10
+ Text: "https://prismic.io/docs/field#key-text",
11
+ Select: "https://prismic.io/docs/field#select",
12
+ StructuredText: "https://prismic.io/docs/field#rich-text-title",
13
+ Image: "https://prismic.io/docs/field#image",
14
+ Link: "https://prismic.io/docs/field#link-content-relationship",
15
+ Embed: "https://prismic.io/docs/field#embed",
16
+ GeoPoint: "https://prismic.io/docs/field#geopoint",
17
+ Group: "https://prismic.io/docs/field#group",
18
+ IntegrationFields: "https://prismic.io/docs/field#integration",
19
+ Slices: "https://prismic.io/docs/field#slices",
20
+ Choice: "https://prismic.io/docs/field#slices"
22
21
  };
23
22
  export {
24
- BLANK_LINE_IDENTIFIER,
25
23
  CUSTOM_TYPES_DOCUMENTATION_URL,
26
24
  FIELD_DOCUMENTATION_URLS,
27
25
  SHARED_SLICES_DOCUMENTATION_URL
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../src/constants.ts"],"sourcesContent":["import type { CustomTypeModelFieldType } from \"@prismicio/client\";\n\nexport const BLANK_LINE_IDENTIFIER = \"// ___BLANK_LINE_TO_BE_REPLACED___\";\n\nexport const CUSTOM_TYPES_DOCUMENTATION_URL =\n\t\"https://prismic.io/docs/core-concepts/custom-types\";\n\nexport const SHARED_SLICES_DOCUMENTATION_URL =\n\t\"https://prismic.io/docs/core-concepts/reusing-slices\";\n\nexport const FIELD_DOCUMENTATION_URLS: Record<\n\tExclude<\n\t\t(typeof CustomTypeModelFieldType)[keyof typeof CustomTypeModelFieldType],\n\t\t\"Range\" | \"Separator\"\n\t>,\n\tstring\n> = {\n\tUID: \"https://prismic.io/docs/core-concepts/uid\",\n\tBoolean: \"https://prismic.io/docs/core-concepts/boolean\",\n\tColor: \"https://prismic.io/docs/core-concepts/color\",\n\tDate: \"https://prismic.io/docs/core-concepts/date\",\n\tTimestamp: \"https://prismic.io/docs/core-concepts/timestamp\",\n\tNumber: \"https://prismic.io/docs/core-concepts/number\",\n\tText: \"https://prismic.io/docs/core-concepts/key-text\",\n\tSelect: \"https://prismic.io/docs/core-concepts/select\",\n\tStructuredText: \"https://prismic.io/docs/core-concepts/rich-text-title\",\n\tImage: \"https://prismic.io/docs/core-concepts/image\",\n\tLink: \"https://prismic.io/docs/core-concepts/link-content-relationship\",\n\tEmbed: \"https://prismic.io/docs/core-concepts/embed\",\n\tGeoPoint: \"https://prismic.io/docs/core-concepts/geopoint\",\n\tGroup: \"https://prismic.io/docs/core-concepts/group\",\n\tIntegrationFields: \"https://prismic.io/docs/core-concepts/integration-fields\",\n\tSlices: \"https://prismic.io/docs/core-concepts/slices\",\n\tChoice: \"https://prismic.io/docs/core-concepts/slices\",\n};\n"],"names":[],"mappings":"AAEO,MAAM,wBAAwB;AAE9B,MAAM,iCACZ;AAEM,MAAM,kCACZ;AAEM,MAAM,2BAMT;AAAA,EACH,KAAK;AAAA,EACL,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AAAA,EACP,mBAAmB;AAAA,EACnB,QAAQ;AAAA,EACR,QAAQ;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../src/constants.ts"],"sourcesContent":["import type { CustomTypeModelFieldType } from \"@prismicio/client\";\n\nexport const CUSTOM_TYPES_DOCUMENTATION_URL =\n\t\"https://prismic.io/docs/custom-types\";\n\nexport const SHARED_SLICES_DOCUMENTATION_URL = \"https://prismic.io/docs/slice\";\n\nexport const FIELD_DOCUMENTATION_URLS: Record<\n\tExclude<\n\t\t(typeof CustomTypeModelFieldType)[keyof typeof CustomTypeModelFieldType],\n\t\t\"Range\" | \"Separator\"\n\t>,\n\tstring\n> = {\n\tUID: \"https://prismic.io/docs/field#uid\",\n\tBoolean: \"https://prismic.io/docs/field#boolean\",\n\tColor: \"https://prismic.io/docs/field#color\",\n\tDate: \"https://prismic.io/docs/field#date\",\n\tTimestamp: \"https://prismic.io/docs/field#timestamp\",\n\tNumber: \"https://prismic.io/docs/field#number\",\n\tText: \"https://prismic.io/docs/field#key-text\",\n\tSelect: \"https://prismic.io/docs/field#select\",\n\tStructuredText: \"https://prismic.io/docs/field#rich-text-title\",\n\tImage: \"https://prismic.io/docs/field#image\",\n\tLink: \"https://prismic.io/docs/field#link-content-relationship\",\n\tEmbed: \"https://prismic.io/docs/field#embed\",\n\tGeoPoint: \"https://prismic.io/docs/field#geopoint\",\n\tGroup: \"https://prismic.io/docs/field#group\",\n\tIntegrationFields: \"https://prismic.io/docs/field#integration\",\n\tSlices: \"https://prismic.io/docs/field#slices\",\n\tChoice: \"https://prismic.io/docs/field#slices\",\n};\n"],"names":[],"mappings":"AAEO,MAAM,iCACZ;AAEM,MAAM,kCAAkC;AAExC,MAAM,2BAMT;AAAA,EACH,KAAK;AAAA,EACL,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AAAA,EACP,mBAAmB;AAAA,EACnB,QAAQ;AAAA,EACR,QAAQ;;"}