prismic-ts-codegen 0.1.16 → 0.1.18

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 (546) hide show
  1. package/bin/prismic-ts-codegen.js +3 -0
  2. package/dist/_node_modules/@babel/code-frame/lib/index.cjs +144 -0
  3. package/dist/_node_modules/@babel/code-frame/lib/index.cjs.map +1 -0
  4. package/dist/_node_modules/@babel/code-frame/lib/index.js +143 -0
  5. package/dist/_node_modules/@babel/code-frame/lib/index.js.map +1 -0
  6. package/dist/_node_modules/@babel/helper-validator-identifier/lib/identifier.cjs +82 -0
  7. package/dist/_node_modules/@babel/helper-validator-identifier/lib/identifier.cjs.map +1 -0
  8. package/dist/_node_modules/@babel/helper-validator-identifier/lib/identifier.js +83 -0
  9. package/dist/_node_modules/@babel/helper-validator-identifier/lib/identifier.js.map +1 -0
  10. package/dist/_node_modules/@babel/helper-validator-identifier/lib/index.cjs +62 -0
  11. package/dist/_node_modules/@babel/helper-validator-identifier/lib/index.cjs.map +1 -0
  12. package/dist/_node_modules/@babel/helper-validator-identifier/lib/index.js +61 -0
  13. package/dist/_node_modules/@babel/helper-validator-identifier/lib/index.js.map +1 -0
  14. package/dist/_node_modules/@babel/helper-validator-identifier/lib/keyword.cjs +35 -0
  15. package/dist/_node_modules/@babel/helper-validator-identifier/lib/keyword.cjs.map +1 -0
  16. package/dist/_node_modules/@babel/helper-validator-identifier/lib/keyword.js +36 -0
  17. package/dist/_node_modules/@babel/helper-validator-identifier/lib/keyword.js.map +1 -0
  18. package/dist/_node_modules/@babel/highlight/lib/index.cjs +100 -0
  19. package/dist/_node_modules/@babel/highlight/lib/index.cjs.map +1 -0
  20. package/dist/_node_modules/@babel/highlight/lib/index.js +99 -0
  21. package/dist/_node_modules/@babel/highlight/lib/index.js.map +1 -0
  22. package/dist/_node_modules/ansi-styles/index.cjs +146 -0
  23. package/dist/_node_modules/ansi-styles/index.cjs.map +1 -0
  24. package/dist/_node_modules/ansi-styles/index.js +146 -0
  25. package/dist/_node_modules/ansi-styles/index.js.map +1 -0
  26. package/dist/_node_modules/arrify/index.cjs +10 -0
  27. package/dist/_node_modules/arrify/index.cjs.map +1 -0
  28. package/dist/_node_modules/arrify/index.js +10 -0
  29. package/dist/_node_modules/arrify/index.js.map +1 -0
  30. package/dist/_node_modules/camelcase/index.cjs +83 -0
  31. package/dist/_node_modules/camelcase/index.cjs.map +1 -0
  32. package/dist/_node_modules/camelcase/index.js +84 -0
  33. package/dist/_node_modules/camelcase/index.js.map +1 -0
  34. package/dist/_node_modules/camelcase-keys/index.cjs +55 -0
  35. package/dist/_node_modules/camelcase-keys/index.cjs.map +1 -0
  36. package/dist/_node_modules/camelcase-keys/index.js +56 -0
  37. package/dist/_node_modules/camelcase-keys/index.js.map +1 -0
  38. package/dist/_node_modules/chalk/index.cjs +172 -0
  39. package/dist/_node_modules/chalk/index.cjs.map +1 -0
  40. package/dist/_node_modules/chalk/index.js +172 -0
  41. package/dist/_node_modules/chalk/index.js.map +1 -0
  42. package/dist/_node_modules/chalk/templates.cjs +108 -0
  43. package/dist/_node_modules/chalk/templates.cjs.map +1 -0
  44. package/dist/_node_modules/chalk/templates.js +108 -0
  45. package/dist/_node_modules/chalk/templates.js.map +1 -0
  46. package/dist/_node_modules/color-convert/conversions.cjs +710 -0
  47. package/dist/_node_modules/color-convert/conversions.cjs.map +1 -0
  48. package/dist/_node_modules/color-convert/conversions.js +710 -0
  49. package/dist/_node_modules/color-convert/conversions.js.map +1 -0
  50. package/dist/_node_modules/color-convert/index.cjs +59 -0
  51. package/dist/_node_modules/color-convert/index.cjs.map +1 -0
  52. package/dist/_node_modules/color-convert/index.js +59 -0
  53. package/dist/_node_modules/color-convert/index.js.map +1 -0
  54. package/dist/_node_modules/color-convert/route.cjs +69 -0
  55. package/dist/_node_modules/color-convert/route.cjs.map +1 -0
  56. package/dist/_node_modules/color-convert/route.js +69 -0
  57. package/dist/_node_modules/color-convert/route.js.map +1 -0
  58. package/dist/_node_modules/color-name/index.cjs +154 -0
  59. package/dist/_node_modules/color-name/index.cjs.map +1 -0
  60. package/dist/_node_modules/color-name/index.js +154 -0
  61. package/dist/_node_modules/color-name/index.js.map +1 -0
  62. package/dist/_node_modules/data-uri-to-buffer/dist/index.cjs +41 -0
  63. package/dist/_node_modules/data-uri-to-buffer/dist/index.cjs.map +1 -0
  64. package/dist/_node_modules/data-uri-to-buffer/dist/index.js +41 -0
  65. package/dist/_node_modules/data-uri-to-buffer/dist/index.js.map +1 -0
  66. package/dist/_node_modules/decamelize/index.cjs +38 -0
  67. package/dist/_node_modules/decamelize/index.cjs.map +1 -0
  68. package/dist/_node_modules/decamelize/index.js +39 -0
  69. package/dist/_node_modules/decamelize/index.js.map +1 -0
  70. package/dist/_node_modules/decamelize-keys/index.cjs +50 -0
  71. package/dist/_node_modules/decamelize-keys/index.cjs.map +1 -0
  72. package/dist/_node_modules/decamelize-keys/index.js +51 -0
  73. package/dist/_node_modules/decamelize-keys/index.js.map +1 -0
  74. package/dist/_node_modules/error-ex/index.cjs +109 -0
  75. package/dist/_node_modules/error-ex/index.cjs.map +1 -0
  76. package/dist/_node_modules/error-ex/index.js +109 -0
  77. package/dist/_node_modules/error-ex/index.js.map +1 -0
  78. package/dist/_node_modules/escape-string-regexp/index.cjs +11 -0
  79. package/dist/_node_modules/escape-string-regexp/index.cjs.map +1 -0
  80. package/dist/_node_modules/escape-string-regexp/index.js +11 -0
  81. package/dist/_node_modules/escape-string-regexp/index.js.map +1 -0
  82. package/dist/_node_modules/fetch-blob/file.cjs +61 -0
  83. package/dist/_node_modules/fetch-blob/file.cjs.map +1 -0
  84. package/dist/_node_modules/fetch-blob/file.js +61 -0
  85. package/dist/_node_modules/fetch-blob/file.js.map +1 -0
  86. package/dist/_node_modules/fetch-blob/index.cjs +223 -0
  87. package/dist/_node_modules/fetch-blob/index.cjs.map +1 -0
  88. package/dist/_node_modules/fetch-blob/index.js +223 -0
  89. package/dist/_node_modules/fetch-blob/index.js.map +1 -0
  90. package/dist/_node_modules/fetch-blob/streams.cjs +43 -0
  91. package/dist/_node_modules/fetch-blob/streams.cjs.map +1 -0
  92. package/dist/_node_modules/fetch-blob/streams.js +42 -0
  93. package/dist/_node_modules/fetch-blob/streams.js.map +1 -0
  94. package/dist/_node_modules/formdata-polyfill/esm.min.cjs +116 -0
  95. package/dist/_node_modules/formdata-polyfill/esm.min.cjs.map +1 -0
  96. package/dist/_node_modules/formdata-polyfill/esm.min.js +116 -0
  97. package/dist/_node_modules/formdata-polyfill/esm.min.js.map +1 -0
  98. package/dist/_node_modules/function-bind/implementation.cjs +47 -0
  99. package/dist/_node_modules/function-bind/implementation.cjs.map +1 -0
  100. package/dist/_node_modules/function-bind/implementation.js +47 -0
  101. package/dist/_node_modules/function-bind/implementation.js.map +1 -0
  102. package/dist/_node_modules/function-bind/index.cjs +7 -0
  103. package/dist/_node_modules/function-bind/index.cjs.map +1 -0
  104. package/dist/_node_modules/function-bind/index.js +7 -0
  105. package/dist/_node_modules/function-bind/index.js.map +1 -0
  106. package/dist/_node_modules/hard-rejection/index.cjs +25 -0
  107. package/dist/_node_modules/hard-rejection/index.cjs.map +1 -0
  108. package/dist/_node_modules/hard-rejection/index.js +26 -0
  109. package/dist/_node_modules/hard-rejection/index.js.map +1 -0
  110. package/dist/_node_modules/has/src/index.cjs +7 -0
  111. package/dist/_node_modules/has/src/index.cjs.map +1 -0
  112. package/dist/_node_modules/has/src/index.js +7 -0
  113. package/dist/_node_modules/has/src/index.js.map +1 -0
  114. package/dist/_node_modules/hosted-git-info/lib/from-url.cjs +93 -0
  115. package/dist/_node_modules/hosted-git-info/lib/from-url.cjs.map +1 -0
  116. package/dist/_node_modules/hosted-git-info/lib/from-url.js +93 -0
  117. package/dist/_node_modules/hosted-git-info/lib/from-url.js.map +1 -0
  118. package/dist/_node_modules/hosted-git-info/lib/hosts.cjs +164 -0
  119. package/dist/_node_modules/hosted-git-info/lib/hosts.cjs.map +1 -0
  120. package/dist/_node_modules/hosted-git-info/lib/hosts.js +164 -0
  121. package/dist/_node_modules/hosted-git-info/lib/hosts.js.map +1 -0
  122. package/dist/_node_modules/hosted-git-info/lib/index.cjs +168 -0
  123. package/dist/_node_modules/hosted-git-info/lib/index.cjs.map +1 -0
  124. package/dist/_node_modules/hosted-git-info/lib/index.js +168 -0
  125. package/dist/_node_modules/hosted-git-info/lib/index.js.map +1 -0
  126. package/dist/_node_modules/hosted-git-info/lib/parse-url.cjs +51 -0
  127. package/dist/_node_modules/hosted-git-info/lib/parse-url.cjs.map +1 -0
  128. package/dist/_node_modules/hosted-git-info/lib/parse-url.js +51 -0
  129. package/dist/_node_modules/hosted-git-info/lib/parse-url.js.map +1 -0
  130. package/dist/_node_modules/indent-string/index.cjs +34 -0
  131. package/dist/_node_modules/indent-string/index.cjs.map +1 -0
  132. package/dist/_node_modules/indent-string/index.js +35 -0
  133. package/dist/_node_modules/indent-string/index.js.map +1 -0
  134. package/dist/_node_modules/is-arrayish/index.cjs +10 -0
  135. package/dist/_node_modules/is-arrayish/index.cjs.map +1 -0
  136. package/dist/_node_modules/is-arrayish/index.js +10 -0
  137. package/dist/_node_modules/is-arrayish/index.js.map +1 -0
  138. package/dist/_node_modules/is-core-module/core.json.cjs +496 -0
  139. package/dist/_node_modules/is-core-module/core.json.cjs.map +1 -0
  140. package/dist/_node_modules/is-core-module/core.json.js +496 -0
  141. package/dist/_node_modules/is-core-module/core.json.js.map +1 -0
  142. package/dist/_node_modules/is-core-module/index.cjs +62 -0
  143. package/dist/_node_modules/is-core-module/index.cjs.map +1 -0
  144. package/dist/_node_modules/is-core-module/index.js +62 -0
  145. package/dist/_node_modules/is-core-module/index.js.map +1 -0
  146. package/dist/_node_modules/is-plain-obj/index.cjs +9 -0
  147. package/dist/_node_modules/is-plain-obj/index.cjs.map +1 -0
  148. package/dist/_node_modules/is-plain-obj/index.js +9 -0
  149. package/dist/_node_modules/is-plain-obj/index.js.map +1 -0
  150. package/dist/_node_modules/js-tokens/index.cjs +27 -0
  151. package/dist/_node_modules/js-tokens/index.cjs.map +1 -0
  152. package/dist/_node_modules/js-tokens/index.js +26 -0
  153. package/dist/_node_modules/js-tokens/index.js.map +1 -0
  154. package/dist/_node_modules/json-parse-even-better-errors/index.cjs +90 -0
  155. package/dist/_node_modules/json-parse-even-better-errors/index.cjs.map +1 -0
  156. package/dist/_node_modules/json-parse-even-better-errors/index.js +90 -0
  157. package/dist/_node_modules/json-parse-even-better-errors/index.js.map +1 -0
  158. package/dist/_node_modules/kind-of/index.cjs +129 -0
  159. package/dist/_node_modules/kind-of/index.cjs.map +1 -0
  160. package/dist/_node_modules/kind-of/index.js +129 -0
  161. package/dist/_node_modules/kind-of/index.js.map +1 -0
  162. package/dist/_node_modules/lines-and-columns/build/index.cjs +67 -0
  163. package/dist/_node_modules/lines-and-columns/build/index.cjs.map +1 -0
  164. package/dist/_node_modules/lines-and-columns/build/index.js +66 -0
  165. package/dist/_node_modules/lines-and-columns/build/index.js.map +1 -0
  166. package/dist/_node_modules/lru-cache/index.cjs +1015 -0
  167. package/dist/_node_modules/lru-cache/index.cjs.map +1 -0
  168. package/dist/_node_modules/lru-cache/index.js +1015 -0
  169. package/dist/_node_modules/lru-cache/index.js.map +1 -0
  170. package/dist/_node_modules/map-obj/index.cjs +49 -0
  171. package/dist/_node_modules/map-obj/index.cjs.map +1 -0
  172. package/dist/_node_modules/map-obj/index.js +50 -0
  173. package/dist/_node_modules/map-obj/index.js.map +1 -0
  174. package/dist/_node_modules/meow/source/index.cjs +88 -0
  175. package/dist/_node_modules/meow/source/index.cjs.map +1 -0
  176. package/dist/_node_modules/meow/source/index.js +89 -0
  177. package/dist/_node_modules/meow/source/index.js.map +1 -0
  178. package/dist/_node_modules/meow/source/options.cjs +83 -0
  179. package/dist/_node_modules/meow/source/options.cjs.map +1 -0
  180. package/dist/_node_modules/meow/source/options.js +83 -0
  181. package/dist/_node_modules/meow/source/options.js.map +1 -0
  182. package/dist/_node_modules/meow/source/parser.cjs +61 -0
  183. package/dist/_node_modules/meow/source/parser.cjs.map +1 -0
  184. package/dist/_node_modules/meow/source/parser.js +61 -0
  185. package/dist/_node_modules/meow/source/parser.js.map +1 -0
  186. package/dist/_node_modules/meow/source/utils.cjs +8 -0
  187. package/dist/_node_modules/meow/source/utils.cjs.map +1 -0
  188. package/dist/_node_modules/meow/source/utils.js +8 -0
  189. package/dist/_node_modules/meow/source/utils.js.map +1 -0
  190. package/dist/_node_modules/meow/source/validate.cjs +102 -0
  191. package/dist/_node_modules/meow/source/validate.cjs.map +1 -0
  192. package/dist/_node_modules/meow/source/validate.js +102 -0
  193. package/dist/_node_modules/meow/source/validate.js.map +1 -0
  194. package/dist/_node_modules/min-indent/index.cjs +12 -0
  195. package/dist/_node_modules/min-indent/index.cjs.map +1 -0
  196. package/dist/_node_modules/min-indent/index.js +13 -0
  197. package/dist/_node_modules/min-indent/index.js.map +1 -0
  198. package/dist/_node_modules/minimist-options/index.cjs +94 -0
  199. package/dist/_node_modules/minimist-options/index.cjs.map +1 -0
  200. package/dist/_node_modules/minimist-options/index.js +95 -0
  201. package/dist/_node_modules/minimist-options/index.js.map +1 -0
  202. package/dist/_node_modules/node-domexception/index.cjs +11 -0
  203. package/dist/_node_modules/node-domexception/index.cjs.map +1 -0
  204. package/dist/_node_modules/node-domexception/index.js +10 -0
  205. package/dist/_node_modules/node-domexception/index.js.map +1 -0
  206. package/dist/_node_modules/node-fetch/src/body.cjs +262 -0
  207. package/dist/_node_modules/node-fetch/src/body.cjs.map +1 -0
  208. package/dist/_node_modules/node-fetch/src/body.js +262 -0
  209. package/dist/_node_modules/node-fetch/src/body.js.map +1 -0
  210. package/dist/_node_modules/node-fetch/src/errors/abort-error.cjs +10 -0
  211. package/dist/_node_modules/node-fetch/src/errors/abort-error.cjs.map +1 -0
  212. package/dist/_node_modules/node-fetch/src/errors/abort-error.js +10 -0
  213. package/dist/_node_modules/node-fetch/src/errors/abort-error.js.map +1 -0
  214. package/dist/_node_modules/node-fetch/src/errors/base.cjs +17 -0
  215. package/dist/_node_modules/node-fetch/src/errors/base.cjs.map +1 -0
  216. package/dist/_node_modules/node-fetch/src/errors/base.js +17 -0
  217. package/dist/_node_modules/node-fetch/src/errors/base.js.map +1 -0
  218. package/dist/_node_modules/node-fetch/src/errors/fetch-error.cjs +19 -0
  219. package/dist/_node_modules/node-fetch/src/errors/fetch-error.cjs.map +1 -0
  220. package/dist/_node_modules/node-fetch/src/errors/fetch-error.js +19 -0
  221. package/dist/_node_modules/node-fetch/src/errors/fetch-error.js.map +1 -0
  222. package/dist/_node_modules/node-fetch/src/headers.cjs +190 -0
  223. package/dist/_node_modules/node-fetch/src/headers.cjs.map +1 -0
  224. package/dist/_node_modules/node-fetch/src/headers.js +190 -0
  225. package/dist/_node_modules/node-fetch/src/headers.js.map +1 -0
  226. package/dist/_node_modules/node-fetch/src/index.cjs +292 -0
  227. package/dist/_node_modules/node-fetch/src/index.cjs.map +1 -0
  228. package/dist/_node_modules/node-fetch/src/index.js +292 -0
  229. package/dist/_node_modules/node-fetch/src/index.js.map +1 -0
  230. package/dist/_node_modules/node-fetch/src/request.cjs +206 -0
  231. package/dist/_node_modules/node-fetch/src/request.cjs.map +1 -0
  232. package/dist/_node_modules/node-fetch/src/request.js +206 -0
  233. package/dist/_node_modules/node-fetch/src/request.js.map +1 -0
  234. package/dist/_node_modules/node-fetch/src/response.cjs +122 -0
  235. package/dist/_node_modules/node-fetch/src/response.cjs.map +1 -0
  236. package/dist/_node_modules/node-fetch/src/response.js +123 -0
  237. package/dist/_node_modules/node-fetch/src/response.js.map +1 -0
  238. package/dist/_node_modules/node-fetch/src/utils/get-search.cjs +12 -0
  239. package/dist/_node_modules/node-fetch/src/utils/get-search.cjs.map +1 -0
  240. package/dist/_node_modules/node-fetch/src/utils/get-search.js +12 -0
  241. package/dist/_node_modules/node-fetch/src/utils/get-search.js.map +1 -0
  242. package/dist/_node_modules/node-fetch/src/utils/is-redirect.cjs +8 -0
  243. package/dist/_node_modules/node-fetch/src/utils/is-redirect.cjs.map +1 -0
  244. package/dist/_node_modules/node-fetch/src/utils/is-redirect.js +8 -0
  245. package/dist/_node_modules/node-fetch/src/utils/is-redirect.js.map +1 -0
  246. package/dist/_node_modules/node-fetch/src/utils/is.cjs +28 -0
  247. package/dist/_node_modules/node-fetch/src/utils/is.cjs.map +1 -0
  248. package/dist/_node_modules/node-fetch/src/utils/is.js +28 -0
  249. package/dist/_node_modules/node-fetch/src/utils/is.js.map +1 -0
  250. package/dist/_node_modules/node-fetch/src/utils/multipart-parser.cjs +356 -0
  251. package/dist/_node_modules/node-fetch/src/utils/multipart-parser.cjs.map +1 -0
  252. package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js +356 -0
  253. package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js.map +1 -0
  254. package/dist/_node_modules/node-fetch/src/utils/referrer.cjs +149 -0
  255. package/dist/_node_modules/node-fetch/src/utils/referrer.cjs.map +1 -0
  256. package/dist/_node_modules/node-fetch/src/utils/referrer.js +149 -0
  257. package/dist/_node_modules/node-fetch/src/utils/referrer.js.map +1 -0
  258. package/dist/_node_modules/normalize-package-data/lib/extract_description.cjs +24 -0
  259. package/dist/_node_modules/normalize-package-data/lib/extract_description.cjs.map +1 -0
  260. package/dist/_node_modules/normalize-package-data/lib/extract_description.js +24 -0
  261. package/dist/_node_modules/normalize-package-data/lib/extract_description.js.map +1 -0
  262. package/dist/_node_modules/normalize-package-data/lib/fixer.cjs +438 -0
  263. package/dist/_node_modules/normalize-package-data/lib/fixer.cjs.map +1 -0
  264. package/dist/_node_modules/normalize-package-data/lib/fixer.js +438 -0
  265. package/dist/_node_modules/normalize-package-data/lib/fixer.js.map +1 -0
  266. package/dist/_node_modules/normalize-package-data/lib/make_warning.cjs +26 -0
  267. package/dist/_node_modules/normalize-package-data/lib/make_warning.cjs.map +1 -0
  268. package/dist/_node_modules/normalize-package-data/lib/make_warning.js +26 -0
  269. package/dist/_node_modules/normalize-package-data/lib/make_warning.js.map +1 -0
  270. package/dist/_node_modules/normalize-package-data/lib/normalize.cjs +58 -0
  271. package/dist/_node_modules/normalize-package-data/lib/normalize.cjs.map +1 -0
  272. package/dist/_node_modules/normalize-package-data/lib/normalize.js +59 -0
  273. package/dist/_node_modules/normalize-package-data/lib/normalize.js.map +1 -0
  274. package/dist/_node_modules/normalize-package-data/lib/typos.json.cjs +41 -0
  275. package/dist/_node_modules/normalize-package-data/lib/typos.json.cjs.map +1 -0
  276. package/dist/_node_modules/normalize-package-data/lib/typos.json.js +41 -0
  277. package/dist/_node_modules/normalize-package-data/lib/typos.json.js.map +1 -0
  278. package/dist/_node_modules/normalize-package-data/lib/warning_messages.json.cjs +90 -0
  279. package/dist/_node_modules/normalize-package-data/lib/warning_messages.json.cjs.map +1 -0
  280. package/dist/_node_modules/normalize-package-data/lib/warning_messages.json.js +90 -0
  281. package/dist/_node_modules/normalize-package-data/lib/warning_messages.json.js.map +1 -0
  282. package/dist/_node_modules/parse-json/index.cjs +54 -0
  283. package/dist/_node_modules/parse-json/index.cjs.map +1 -0
  284. package/dist/_node_modules/parse-json/index.js +55 -0
  285. package/dist/_node_modules/parse-json/index.js.map +1 -0
  286. package/dist/_node_modules/read-pkg/_node_modules/hosted-git-info/git-host-info.cjs +159 -0
  287. package/dist/_node_modules/read-pkg/_node_modules/hosted-git-info/git-host-info.cjs.map +1 -0
  288. package/dist/_node_modules/read-pkg/_node_modules/hosted-git-info/git-host-info.js +159 -0
  289. package/dist/_node_modules/read-pkg/_node_modules/hosted-git-info/git-host-info.js.map +1 -0
  290. package/dist/_node_modules/read-pkg/_node_modules/hosted-git-info/git-host.cjs +88 -0
  291. package/dist/_node_modules/read-pkg/_node_modules/hosted-git-info/git-host.cjs.map +1 -0
  292. package/dist/_node_modules/read-pkg/_node_modules/hosted-git-info/git-host.js +88 -0
  293. package/dist/_node_modules/read-pkg/_node_modules/hosted-git-info/git-host.js.map +1 -0
  294. package/dist/_node_modules/read-pkg/_node_modules/hosted-git-info/index.cjs +180 -0
  295. package/dist/_node_modules/read-pkg/_node_modules/hosted-git-info/index.cjs.map +1 -0
  296. package/dist/_node_modules/read-pkg/_node_modules/hosted-git-info/index.js +180 -0
  297. package/dist/_node_modules/read-pkg/_node_modules/hosted-git-info/index.js.map +1 -0
  298. package/dist/_node_modules/read-pkg/_node_modules/lru-cache/index.cjs +268 -0
  299. package/dist/_node_modules/read-pkg/_node_modules/lru-cache/index.cjs.map +1 -0
  300. package/dist/_node_modules/read-pkg/_node_modules/lru-cache/index.js +268 -0
  301. package/dist/_node_modules/read-pkg/_node_modules/lru-cache/index.js.map +1 -0
  302. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/extract_description.cjs +20 -0
  303. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/extract_description.cjs.map +1 -0
  304. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/extract_description.js +20 -0
  305. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/extract_description.js.map +1 -0
  306. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/fixer.cjs +438 -0
  307. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/fixer.cjs.map +1 -0
  308. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/fixer.js +438 -0
  309. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/fixer.js.map +1 -0
  310. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/make_warning.cjs +26 -0
  311. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/make_warning.cjs.map +1 -0
  312. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/make_warning.js +26 -0
  313. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/make_warning.js.map +1 -0
  314. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/normalize.cjs +58 -0
  315. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/normalize.cjs.map +1 -0
  316. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/normalize.js +59 -0
  317. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/normalize.js.map +1 -0
  318. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/typos.json.cjs +41 -0
  319. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/typos.json.cjs.map +1 -0
  320. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/typos.json.js +41 -0
  321. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/typos.json.js.map +1 -0
  322. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/warning_messages.json.cjs +90 -0
  323. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/warning_messages.json.cjs.map +1 -0
  324. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/warning_messages.json.js +90 -0
  325. package/dist/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/warning_messages.json.js.map +1 -0
  326. package/dist/_node_modules/read-pkg/index.cjs +20 -0
  327. package/dist/_node_modules/read-pkg/index.cjs.map +1 -0
  328. package/dist/_node_modules/read-pkg/index.js +20 -0
  329. package/dist/_node_modules/read-pkg/index.js.map +1 -0
  330. package/dist/_node_modules/read-pkg-up/_node_modules/find-up/index.cjs +48 -0
  331. package/dist/_node_modules/read-pkg-up/_node_modules/find-up/index.cjs.map +1 -0
  332. package/dist/_node_modules/read-pkg-up/_node_modules/find-up/index.js +48 -0
  333. package/dist/_node_modules/read-pkg-up/_node_modules/find-up/index.js.map +1 -0
  334. package/dist/_node_modules/read-pkg-up/_node_modules/locate-path/index.cjs +43 -0
  335. package/dist/_node_modules/read-pkg-up/_node_modules/locate-path/index.cjs.map +1 -0
  336. package/dist/_node_modules/read-pkg-up/_node_modules/locate-path/index.js +43 -0
  337. package/dist/_node_modules/read-pkg-up/_node_modules/locate-path/index.js.map +1 -0
  338. package/dist/_node_modules/read-pkg-up/index.cjs +17 -0
  339. package/dist/_node_modules/read-pkg-up/index.cjs.map +1 -0
  340. package/dist/_node_modules/read-pkg-up/index.js +17 -0
  341. package/dist/_node_modules/read-pkg-up/index.js.map +1 -0
  342. package/dist/_node_modules/redent/index.cjs +8 -0
  343. package/dist/_node_modules/redent/index.cjs.map +1 -0
  344. package/dist/_node_modules/redent/index.js +9 -0
  345. package/dist/_node_modules/redent/index.js.map +1 -0
  346. package/dist/_node_modules/semver/classes/semver.cjs +245 -0
  347. package/dist/_node_modules/semver/classes/semver.cjs.map +1 -0
  348. package/dist/_node_modules/semver/classes/semver.js +245 -0
  349. package/dist/_node_modules/semver/classes/semver.js.map +1 -0
  350. package/dist/_node_modules/semver/functions/clean.cjs +11 -0
  351. package/dist/_node_modules/semver/functions/clean.cjs.map +1 -0
  352. package/dist/_node_modules/semver/functions/clean.js +11 -0
  353. package/dist/_node_modules/semver/functions/clean.js.map +1 -0
  354. package/dist/_node_modules/semver/functions/parse.cjs +20 -0
  355. package/dist/_node_modules/semver/functions/parse.cjs.map +1 -0
  356. package/dist/_node_modules/semver/functions/parse.js +20 -0
  357. package/dist/_node_modules/semver/functions/parse.js.map +1 -0
  358. package/dist/_node_modules/semver/functions/valid.cjs +11 -0
  359. package/dist/_node_modules/semver/functions/valid.cjs.map +1 -0
  360. package/dist/_node_modules/semver/functions/valid.js +11 -0
  361. package/dist/_node_modules/semver/functions/valid.js.map +1 -0
  362. package/dist/_node_modules/semver/internal/constants.cjs +29 -0
  363. package/dist/_node_modules/semver/internal/constants.cjs.map +1 -0
  364. package/dist/_node_modules/semver/internal/constants.js +29 -0
  365. package/dist/_node_modules/semver/internal/constants.js.map +1 -0
  366. package/dist/_node_modules/semver/internal/debug.cjs +7 -0
  367. package/dist/_node_modules/semver/internal/debug.cjs.map +1 -0
  368. package/dist/_node_modules/semver/internal/debug.js +7 -0
  369. package/dist/_node_modules/semver/internal/debug.js.map +1 -0
  370. package/dist/_node_modules/semver/internal/identifiers.cjs +19 -0
  371. package/dist/_node_modules/semver/internal/identifiers.cjs.map +1 -0
  372. package/dist/_node_modules/semver/internal/identifiers.js +19 -0
  373. package/dist/_node_modules/semver/internal/identifiers.js.map +1 -0
  374. package/dist/_node_modules/semver/internal/parse-options.cjs +16 -0
  375. package/dist/_node_modules/semver/internal/parse-options.cjs.map +1 -0
  376. package/dist/_node_modules/semver/internal/parse-options.js +16 -0
  377. package/dist/_node_modules/semver/internal/parse-options.js.map +1 -0
  378. package/dist/_node_modules/semver/internal/re.cjs +82 -0
  379. package/dist/_node_modules/semver/internal/re.cjs.map +1 -0
  380. package/dist/_node_modules/semver/internal/re.js +82 -0
  381. package/dist/_node_modules/semver/internal/re.js.map +1 -0
  382. package/dist/_node_modules/spdx-correct/index.cjs +334 -0
  383. package/dist/_node_modules/spdx-correct/index.cjs.map +1 -0
  384. package/dist/_node_modules/spdx-correct/index.js +334 -0
  385. package/dist/_node_modules/spdx-correct/index.js.map +1 -0
  386. package/dist/_node_modules/spdx-exceptions/index.json.cjs +43 -0
  387. package/dist/_node_modules/spdx-exceptions/index.json.cjs.map +1 -0
  388. package/dist/_node_modules/spdx-exceptions/index.json.js +44 -0
  389. package/dist/_node_modules/spdx-exceptions/index.json.js.map +1 -0
  390. package/dist/_node_modules/spdx-expression-parse/index.cjs +11 -0
  391. package/dist/_node_modules/spdx-expression-parse/index.cjs.map +1 -0
  392. package/dist/_node_modules/spdx-expression-parse/index.js +11 -0
  393. package/dist/_node_modules/spdx-expression-parse/index.js.map +1 -0
  394. package/dist/_node_modules/spdx-expression-parse/parse.cjs +111 -0
  395. package/dist/_node_modules/spdx-expression-parse/parse.cjs.map +1 -0
  396. package/dist/_node_modules/spdx-expression-parse/parse.js +111 -0
  397. package/dist/_node_modules/spdx-expression-parse/parse.js.map +1 -0
  398. package/dist/_node_modules/spdx-expression-parse/scan.cjs +104 -0
  399. package/dist/_node_modules/spdx-expression-parse/scan.cjs.map +1 -0
  400. package/dist/_node_modules/spdx-expression-parse/scan.js +104 -0
  401. package/dist/_node_modules/spdx-expression-parse/scan.js.map +1 -0
  402. package/dist/_node_modules/spdx-license-ids/deprecated.json.cjs +30 -0
  403. package/dist/_node_modules/spdx-license-ids/deprecated.json.cjs.map +1 -0
  404. package/dist/_node_modules/spdx-license-ids/deprecated.json.js +31 -0
  405. package/dist/_node_modules/spdx-license-ids/deprecated.json.js.map +1 -0
  406. package/dist/_node_modules/spdx-license-ids/index.json.cjs +510 -0
  407. package/dist/_node_modules/spdx-license-ids/index.json.cjs.map +1 -0
  408. package/dist/_node_modules/spdx-license-ids/index.json.js +511 -0
  409. package/dist/_node_modules/spdx-license-ids/index.json.js.map +1 -0
  410. package/dist/_node_modules/strip-indent/index.cjs +12 -0
  411. package/dist/_node_modules/strip-indent/index.cjs.map +1 -0
  412. package/dist/_node_modules/strip-indent/index.js +13 -0
  413. package/dist/_node_modules/strip-indent/index.js.map +1 -0
  414. package/dist/_node_modules/supports-color/browser.cjs +8 -0
  415. package/dist/_node_modules/supports-color/browser.cjs.map +1 -0
  416. package/dist/_node_modules/supports-color/browser.js +8 -0
  417. package/dist/_node_modules/supports-color/browser.js.map +1 -0
  418. package/dist/_node_modules/trim-newlines/index.cjs +15 -0
  419. package/dist/_node_modules/trim-newlines/index.cjs.map +1 -0
  420. package/dist/_node_modules/trim-newlines/index.js +15 -0
  421. package/dist/_node_modules/trim-newlines/index.js.map +1 -0
  422. package/dist/_node_modules/validate-npm-package-license/index.cjs +71 -0
  423. package/dist/_node_modules/validate-npm-package-license/index.cjs.map +1 -0
  424. package/dist/_node_modules/validate-npm-package-license/index.js +71 -0
  425. package/dist/_node_modules/validate-npm-package-license/index.js.map +1 -0
  426. package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs +3822 -0
  427. package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.cjs.map +1 -0
  428. package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +3822 -0
  429. package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -0
  430. package/dist/_node_modules/yallist/iterator.cjs +19 -0
  431. package/dist/_node_modules/yallist/iterator.cjs.map +1 -0
  432. package/dist/_node_modules/yallist/iterator.js +19 -0
  433. package/dist/_node_modules/yallist/iterator.js.map +1 -0
  434. package/dist/_node_modules/yallist/yallist.cjs +367 -0
  435. package/dist/_node_modules/yallist/yallist.cjs.map +1 -0
  436. package/dist/_node_modules/yallist/yallist.js +367 -0
  437. package/dist/_node_modules/yallist/yallist.js.map +1 -0
  438. package/dist/_node_modules/yargs-parser/build/lib/index.cjs +56 -0
  439. package/dist/_node_modules/yargs-parser/build/lib/index.cjs.map +1 -0
  440. package/dist/_node_modules/yargs-parser/build/lib/index.js +57 -0
  441. package/dist/_node_modules/yargs-parser/build/lib/index.js.map +1 -0
  442. package/dist/_node_modules/yargs-parser/build/lib/string-utils.cjs +63 -0
  443. package/dist/_node_modules/yargs-parser/build/lib/string-utils.cjs.map +1 -0
  444. package/dist/_node_modules/yargs-parser/build/lib/string-utils.js +63 -0
  445. package/dist/_node_modules/yargs-parser/build/lib/string-utils.js.map +1 -0
  446. package/dist/_node_modules/yargs-parser/build/lib/tokenize-arg-string.cjs +39 -0
  447. package/dist/_node_modules/yargs-parser/build/lib/tokenize-arg-string.cjs.map +1 -0
  448. package/dist/_node_modules/yargs-parser/build/lib/tokenize-arg-string.js +39 -0
  449. package/dist/_node_modules/yargs-parser/build/lib/tokenize-arg-string.js.map +1 -0
  450. package/dist/_node_modules/yargs-parser/build/lib/yargs-parser-types.cjs +15 -0
  451. package/dist/_node_modules/yargs-parser/build/lib/yargs-parser-types.cjs.map +1 -0
  452. package/dist/_node_modules/yargs-parser/build/lib/yargs-parser-types.js +16 -0
  453. package/dist/_node_modules/yargs-parser/build/lib/yargs-parser-types.js.map +1 -0
  454. package/dist/_node_modules/yargs-parser/build/lib/yargs-parser.cjs +847 -0
  455. package/dist/_node_modules/yargs-parser/build/lib/yargs-parser.cjs.map +1 -0
  456. package/dist/_node_modules/yargs-parser/build/lib/yargs-parser.js +847 -0
  457. package/dist/_node_modules/yargs-parser/build/lib/yargs-parser.js.map +1 -0
  458. package/dist/_virtual/_commonjsHelpers.cjs +9 -0
  459. package/dist/_virtual/_commonjsHelpers.cjs.map +1 -0
  460. package/dist/_virtual/_commonjsHelpers.js +9 -0
  461. package/dist/_virtual/_commonjsHelpers.js.map +1 -0
  462. package/dist/_virtual/conversions.cjs +5 -0
  463. package/dist/_virtual/conversions.cjs.map +1 -0
  464. package/dist/_virtual/conversions.js +5 -0
  465. package/dist/_virtual/conversions.js.map +1 -0
  466. package/dist/_virtual/identifier.cjs +5 -0
  467. package/dist/_virtual/identifier.cjs.map +1 -0
  468. package/dist/_virtual/identifier.js +5 -0
  469. package/dist/_virtual/identifier.js.map +1 -0
  470. package/dist/_virtual/index.cjs +5 -0
  471. package/dist/_virtual/index.cjs.map +1 -0
  472. package/dist/_virtual/index.js +5 -0
  473. package/dist/_virtual/index.js.map +1 -0
  474. package/dist/_virtual/index10.cjs +5 -0
  475. package/dist/_virtual/index10.cjs.map +1 -0
  476. package/dist/_virtual/index10.js +5 -0
  477. package/dist/_virtual/index10.js.map +1 -0
  478. package/dist/_virtual/index11.cjs +5 -0
  479. package/dist/_virtual/index11.cjs.map +1 -0
  480. package/dist/_virtual/index11.js +5 -0
  481. package/dist/_virtual/index11.js.map +1 -0
  482. package/dist/_virtual/index2.cjs +5 -0
  483. package/dist/_virtual/index2.cjs.map +1 -0
  484. package/dist/_virtual/index2.js +5 -0
  485. package/dist/_virtual/index2.js.map +1 -0
  486. package/dist/_virtual/index3.cjs +5 -0
  487. package/dist/_virtual/index3.cjs.map +1 -0
  488. package/dist/_virtual/index3.js +5 -0
  489. package/dist/_virtual/index3.js.map +1 -0
  490. package/dist/_virtual/index4.cjs +5 -0
  491. package/dist/_virtual/index4.cjs.map +1 -0
  492. package/dist/_virtual/index4.js +5 -0
  493. package/dist/_virtual/index4.js.map +1 -0
  494. package/dist/_virtual/index5.cjs +5 -0
  495. package/dist/_virtual/index5.cjs.map +1 -0
  496. package/dist/_virtual/index5.js +5 -0
  497. package/dist/_virtual/index5.js.map +1 -0
  498. package/dist/_virtual/index6.cjs +5 -0
  499. package/dist/_virtual/index6.cjs.map +1 -0
  500. package/dist/_virtual/index6.js +5 -0
  501. package/dist/_virtual/index6.js.map +1 -0
  502. package/dist/_virtual/index7.cjs +5 -0
  503. package/dist/_virtual/index7.cjs.map +1 -0
  504. package/dist/_virtual/index7.js +5 -0
  505. package/dist/_virtual/index7.js.map +1 -0
  506. package/dist/_virtual/index8.cjs +5 -0
  507. package/dist/_virtual/index8.cjs.map +1 -0
  508. package/dist/_virtual/index8.js +5 -0
  509. package/dist/_virtual/index8.js.map +1 -0
  510. package/dist/_virtual/index9.cjs +5 -0
  511. package/dist/_virtual/index9.cjs.map +1 -0
  512. package/dist/_virtual/index9.js +5 -0
  513. package/dist/_virtual/index9.js.map +1 -0
  514. package/dist/_virtual/keyword.cjs +5 -0
  515. package/dist/_virtual/keyword.cjs.map +1 -0
  516. package/dist/_virtual/keyword.js +5 -0
  517. package/dist/_virtual/keyword.js.map +1 -0
  518. package/dist/_virtual/ponyfill.es2018.cjs +5 -0
  519. package/dist/_virtual/ponyfill.es2018.cjs.map +1 -0
  520. package/dist/_virtual/ponyfill.es2018.js +5 -0
  521. package/dist/_virtual/ponyfill.es2018.js.map +1 -0
  522. package/dist/_virtual/re.cjs +5 -0
  523. package/dist/_virtual/re.cjs.map +1 -0
  524. package/dist/_virtual/re.js +5 -0
  525. package/dist/_virtual/re.js.map +1 -0
  526. package/dist/cli/loadLocaleIDs.cjs +2 -2
  527. package/dist/cli/loadLocaleIDs.cjs.map +1 -1
  528. package/dist/cli/loadLocaleIDs.js +1 -1
  529. package/dist/cli/loadModels.cjs +2 -2
  530. package/dist/cli/loadModels.cjs.map +1 -1
  531. package/dist/cli/loadModels.js +1 -1
  532. package/dist/cli.cjs +2 -2
  533. package/dist/cli.cjs.map +1 -1
  534. package/dist/cli.js +1 -1
  535. package/dist/lib/buildFieldProperties.cjs +3 -0
  536. package/dist/lib/buildFieldProperties.cjs.map +1 -1
  537. package/dist/lib/buildFieldProperties.js +3 -0
  538. package/dist/lib/buildFieldProperties.js.map +1 -1
  539. package/dist/lib/buildSharedSliceType.cjs +2 -0
  540. package/dist/lib/buildSharedSliceType.cjs.map +1 -1
  541. package/dist/lib/buildSharedSliceType.js +2 -0
  542. package/dist/lib/buildSharedSliceType.js.map +1 -1
  543. package/package.json +2 -2
  544. package/src/lib/buildFieldProperties.ts +3 -0
  545. package/src/lib/buildSharedSliceType.ts +2 -0
  546. package/bin/prismic-ts-codegen.mjs +0 -3
@@ -0,0 +1,1015 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
4
+ const hasAbortController = typeof AbortController === "function";
5
+ const AC = hasAbortController ? AbortController : class AbortController2 {
6
+ constructor() {
7
+ this.signal = new AS();
8
+ }
9
+ abort(reason = new Error("This operation was aborted")) {
10
+ this.signal.reason = this.signal.reason || reason;
11
+ this.signal.aborted = true;
12
+ this.signal.dispatchEvent({
13
+ type: "abort",
14
+ target: this.signal
15
+ });
16
+ }
17
+ };
18
+ const hasAbortSignal = typeof AbortSignal === "function";
19
+ const hasACAbortSignal = typeof AC.AbortSignal === "function";
20
+ const AS = hasAbortSignal ? AbortSignal : hasACAbortSignal ? AC.AbortController : class AbortSignal2 {
21
+ constructor() {
22
+ this.reason = void 0;
23
+ this.aborted = false;
24
+ this._listeners = [];
25
+ }
26
+ dispatchEvent(e) {
27
+ if (e.type === "abort") {
28
+ this.aborted = true;
29
+ this.onabort(e);
30
+ this._listeners.forEach((f) => f(e), this);
31
+ }
32
+ }
33
+ onabort() {
34
+ }
35
+ addEventListener(ev, fn) {
36
+ if (ev === "abort") {
37
+ this._listeners.push(fn);
38
+ }
39
+ }
40
+ removeEventListener(ev, fn) {
41
+ if (ev === "abort") {
42
+ this._listeners = this._listeners.filter((f) => f !== fn);
43
+ }
44
+ }
45
+ };
46
+ const warned = /* @__PURE__ */ new Set();
47
+ const deprecatedOption = (opt, instead) => {
48
+ const code = `LRU_CACHE_OPTION_${opt}`;
49
+ if (shouldWarn(code)) {
50
+ warn(code, `${opt} option`, `options.${instead}`, LRUCache);
51
+ }
52
+ };
53
+ const deprecatedMethod = (method, instead) => {
54
+ const code = `LRU_CACHE_METHOD_${method}`;
55
+ if (shouldWarn(code)) {
56
+ const { prototype } = LRUCache;
57
+ const { get } = Object.getOwnPropertyDescriptor(prototype, method);
58
+ warn(code, `${method} method`, `cache.${instead}()`, get);
59
+ }
60
+ };
61
+ const deprecatedProperty = (field, instead) => {
62
+ const code = `LRU_CACHE_PROPERTY_${field}`;
63
+ if (shouldWarn(code)) {
64
+ const { prototype } = LRUCache;
65
+ const { get } = Object.getOwnPropertyDescriptor(prototype, field);
66
+ warn(code, `${field} property`, `cache.${instead}`, get);
67
+ }
68
+ };
69
+ const emitWarning = (...a) => {
70
+ typeof process === "object" && process && typeof process.emitWarning === "function" ? process.emitWarning(...a) : console.error(...a);
71
+ };
72
+ const shouldWarn = (code) => !warned.has(code);
73
+ const warn = (code, what, instead, fn) => {
74
+ warned.add(code);
75
+ const msg = `The ${what} is deprecated. Please use ${instead} instead.`;
76
+ emitWarning(msg, "DeprecationWarning", code, fn);
77
+ };
78
+ const isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
79
+ const getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null;
80
+ class ZeroArray extends Array {
81
+ constructor(size) {
82
+ super(size);
83
+ this.fill(0);
84
+ }
85
+ }
86
+ class Stack {
87
+ constructor(max) {
88
+ if (max === 0) {
89
+ return [];
90
+ }
91
+ const UintArray = getUintArray(max);
92
+ this.heap = new UintArray(max);
93
+ this.length = 0;
94
+ }
95
+ push(n) {
96
+ this.heap[this.length++] = n;
97
+ }
98
+ pop() {
99
+ return this.heap[--this.length];
100
+ }
101
+ }
102
+ class LRUCache {
103
+ constructor(options = {}) {
104
+ const {
105
+ max = 0,
106
+ ttl,
107
+ ttlResolution = 1,
108
+ ttlAutopurge,
109
+ updateAgeOnGet,
110
+ updateAgeOnHas,
111
+ allowStale,
112
+ dispose,
113
+ disposeAfter,
114
+ noDisposeOnSet,
115
+ noUpdateTTL,
116
+ maxSize = 0,
117
+ maxEntrySize = 0,
118
+ sizeCalculation,
119
+ fetchMethod,
120
+ fetchContext,
121
+ noDeleteOnFetchRejection,
122
+ noDeleteOnStaleGet,
123
+ allowStaleOnFetchRejection,
124
+ allowStaleOnFetchAbort,
125
+ ignoreFetchAbort
126
+ } = options;
127
+ const { length, maxAge, stale } = options instanceof LRUCache ? {} : options;
128
+ if (max !== 0 && !isPosInt(max)) {
129
+ throw new TypeError("max option must be a nonnegative integer");
130
+ }
131
+ const UintArray = max ? getUintArray(max) : Array;
132
+ if (!UintArray) {
133
+ throw new Error("invalid max value: " + max);
134
+ }
135
+ this.max = max;
136
+ this.maxSize = maxSize;
137
+ this.maxEntrySize = maxEntrySize || this.maxSize;
138
+ this.sizeCalculation = sizeCalculation || length;
139
+ if (this.sizeCalculation) {
140
+ if (!this.maxSize && !this.maxEntrySize) {
141
+ throw new TypeError(
142
+ "cannot set sizeCalculation without setting maxSize or maxEntrySize"
143
+ );
144
+ }
145
+ if (typeof this.sizeCalculation !== "function") {
146
+ throw new TypeError("sizeCalculation set to non-function");
147
+ }
148
+ }
149
+ this.fetchMethod = fetchMethod || null;
150
+ if (this.fetchMethod && typeof this.fetchMethod !== "function") {
151
+ throw new TypeError(
152
+ "fetchMethod must be a function if specified"
153
+ );
154
+ }
155
+ this.fetchContext = fetchContext;
156
+ if (!this.fetchMethod && fetchContext !== void 0) {
157
+ throw new TypeError(
158
+ "cannot set fetchContext without fetchMethod"
159
+ );
160
+ }
161
+ this.keyMap = /* @__PURE__ */ new Map();
162
+ this.keyList = new Array(max).fill(null);
163
+ this.valList = new Array(max).fill(null);
164
+ this.next = new UintArray(max);
165
+ this.prev = new UintArray(max);
166
+ this.head = 0;
167
+ this.tail = 0;
168
+ this.free = new Stack(max);
169
+ this.initialFill = 1;
170
+ this.size = 0;
171
+ if (typeof dispose === "function") {
172
+ this.dispose = dispose;
173
+ }
174
+ if (typeof disposeAfter === "function") {
175
+ this.disposeAfter = disposeAfter;
176
+ this.disposed = [];
177
+ } else {
178
+ this.disposeAfter = null;
179
+ this.disposed = null;
180
+ }
181
+ this.noDisposeOnSet = !!noDisposeOnSet;
182
+ this.noUpdateTTL = !!noUpdateTTL;
183
+ this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
184
+ this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
185
+ this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
186
+ this.ignoreFetchAbort = !!ignoreFetchAbort;
187
+ if (this.maxEntrySize !== 0) {
188
+ if (this.maxSize !== 0) {
189
+ if (!isPosInt(this.maxSize)) {
190
+ throw new TypeError(
191
+ "maxSize must be a positive integer if specified"
192
+ );
193
+ }
194
+ }
195
+ if (!isPosInt(this.maxEntrySize)) {
196
+ throw new TypeError(
197
+ "maxEntrySize must be a positive integer if specified"
198
+ );
199
+ }
200
+ this.initializeSizeTracking();
201
+ }
202
+ this.allowStale = !!allowStale || !!stale;
203
+ this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
204
+ this.updateAgeOnGet = !!updateAgeOnGet;
205
+ this.updateAgeOnHas = !!updateAgeOnHas;
206
+ this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
207
+ this.ttlAutopurge = !!ttlAutopurge;
208
+ this.ttl = ttl || maxAge || 0;
209
+ if (this.ttl) {
210
+ if (!isPosInt(this.ttl)) {
211
+ throw new TypeError(
212
+ "ttl must be a positive integer if specified"
213
+ );
214
+ }
215
+ this.initializeTTLTracking();
216
+ }
217
+ if (this.max === 0 && this.ttl === 0 && this.maxSize === 0) {
218
+ throw new TypeError(
219
+ "At least one of max, maxSize, or ttl is required"
220
+ );
221
+ }
222
+ if (!this.ttlAutopurge && !this.max && !this.maxSize) {
223
+ const code = "LRU_CACHE_UNBOUNDED";
224
+ if (shouldWarn(code)) {
225
+ warned.add(code);
226
+ const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.";
227
+ emitWarning(msg, "UnboundedCacheWarning", code, LRUCache);
228
+ }
229
+ }
230
+ if (stale) {
231
+ deprecatedOption("stale", "allowStale");
232
+ }
233
+ if (maxAge) {
234
+ deprecatedOption("maxAge", "ttl");
235
+ }
236
+ if (length) {
237
+ deprecatedOption("length", "sizeCalculation");
238
+ }
239
+ }
240
+ getRemainingTTL(key) {
241
+ return this.has(key, { updateAgeOnHas: false }) ? Infinity : 0;
242
+ }
243
+ initializeTTLTracking() {
244
+ this.ttls = new ZeroArray(this.max);
245
+ this.starts = new ZeroArray(this.max);
246
+ this.setItemTTL = (index, ttl, start = perf.now()) => {
247
+ this.starts[index] = ttl !== 0 ? start : 0;
248
+ this.ttls[index] = ttl;
249
+ if (ttl !== 0 && this.ttlAutopurge) {
250
+ const t = setTimeout(() => {
251
+ if (this.isStale(index)) {
252
+ this.delete(this.keyList[index]);
253
+ }
254
+ }, ttl + 1);
255
+ if (t.unref) {
256
+ t.unref();
257
+ }
258
+ }
259
+ };
260
+ this.updateItemAge = (index) => {
261
+ this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0;
262
+ };
263
+ this.statusTTL = (status, index) => {
264
+ if (status) {
265
+ status.ttl = this.ttls[index];
266
+ status.start = this.starts[index];
267
+ status.now = cachedNow || getNow();
268
+ status.remainingTTL = status.now + status.ttl - status.start;
269
+ }
270
+ };
271
+ let cachedNow = 0;
272
+ const getNow = () => {
273
+ const n = perf.now();
274
+ if (this.ttlResolution > 0) {
275
+ cachedNow = n;
276
+ const t = setTimeout(
277
+ () => cachedNow = 0,
278
+ this.ttlResolution
279
+ );
280
+ if (t.unref) {
281
+ t.unref();
282
+ }
283
+ }
284
+ return n;
285
+ };
286
+ this.getRemainingTTL = (key) => {
287
+ const index = this.keyMap.get(key);
288
+ if (index === void 0) {
289
+ return 0;
290
+ }
291
+ return this.ttls[index] === 0 || this.starts[index] === 0 ? Infinity : this.starts[index] + this.ttls[index] - (cachedNow || getNow());
292
+ };
293
+ this.isStale = (index) => {
294
+ return this.ttls[index] !== 0 && this.starts[index] !== 0 && (cachedNow || getNow()) - this.starts[index] > this.ttls[index];
295
+ };
296
+ }
297
+ updateItemAge(_index) {
298
+ }
299
+ statusTTL(_status, _index) {
300
+ }
301
+ setItemTTL(_index, _ttl, _start) {
302
+ }
303
+ isStale(_index) {
304
+ return false;
305
+ }
306
+ initializeSizeTracking() {
307
+ this.calculatedSize = 0;
308
+ this.sizes = new ZeroArray(this.max);
309
+ this.removeItemSize = (index) => {
310
+ this.calculatedSize -= this.sizes[index];
311
+ this.sizes[index] = 0;
312
+ };
313
+ this.requireSize = (k, v, size, sizeCalculation) => {
314
+ if (this.isBackgroundFetch(v)) {
315
+ return 0;
316
+ }
317
+ if (!isPosInt(size)) {
318
+ if (sizeCalculation) {
319
+ if (typeof sizeCalculation !== "function") {
320
+ throw new TypeError("sizeCalculation must be a function");
321
+ }
322
+ size = sizeCalculation(v, k);
323
+ if (!isPosInt(size)) {
324
+ throw new TypeError(
325
+ "sizeCalculation return invalid (expect positive integer)"
326
+ );
327
+ }
328
+ } else {
329
+ throw new TypeError(
330
+ "invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set."
331
+ );
332
+ }
333
+ }
334
+ return size;
335
+ };
336
+ this.addItemSize = (index, size, status) => {
337
+ this.sizes[index] = size;
338
+ if (this.maxSize) {
339
+ const maxSize = this.maxSize - this.sizes[index];
340
+ while (this.calculatedSize > maxSize) {
341
+ this.evict(true);
342
+ }
343
+ }
344
+ this.calculatedSize += this.sizes[index];
345
+ if (status) {
346
+ status.entrySize = size;
347
+ status.totalCalculatedSize = this.calculatedSize;
348
+ }
349
+ };
350
+ }
351
+ removeItemSize(_index) {
352
+ }
353
+ addItemSize(_index, _size) {
354
+ }
355
+ requireSize(_k, _v, size, sizeCalculation) {
356
+ if (size || sizeCalculation) {
357
+ throw new TypeError(
358
+ "cannot set size without setting maxSize or maxEntrySize on cache"
359
+ );
360
+ }
361
+ }
362
+ *indexes({ allowStale = this.allowStale } = {}) {
363
+ if (this.size) {
364
+ for (let i = this.tail; true; ) {
365
+ if (!this.isValidIndex(i)) {
366
+ break;
367
+ }
368
+ if (allowStale || !this.isStale(i)) {
369
+ yield i;
370
+ }
371
+ if (i === this.head) {
372
+ break;
373
+ } else {
374
+ i = this.prev[i];
375
+ }
376
+ }
377
+ }
378
+ }
379
+ *rindexes({ allowStale = this.allowStale } = {}) {
380
+ if (this.size) {
381
+ for (let i = this.head; true; ) {
382
+ if (!this.isValidIndex(i)) {
383
+ break;
384
+ }
385
+ if (allowStale || !this.isStale(i)) {
386
+ yield i;
387
+ }
388
+ if (i === this.tail) {
389
+ break;
390
+ } else {
391
+ i = this.next[i];
392
+ }
393
+ }
394
+ }
395
+ }
396
+ isValidIndex(index) {
397
+ return index !== void 0 && this.keyMap.get(this.keyList[index]) === index;
398
+ }
399
+ *entries() {
400
+ for (const i of this.indexes()) {
401
+ if (this.valList[i] !== void 0 && this.keyList[i] !== void 0 && !this.isBackgroundFetch(this.valList[i])) {
402
+ yield [this.keyList[i], this.valList[i]];
403
+ }
404
+ }
405
+ }
406
+ *rentries() {
407
+ for (const i of this.rindexes()) {
408
+ if (this.valList[i] !== void 0 && this.keyList[i] !== void 0 && !this.isBackgroundFetch(this.valList[i])) {
409
+ yield [this.keyList[i], this.valList[i]];
410
+ }
411
+ }
412
+ }
413
+ *keys() {
414
+ for (const i of this.indexes()) {
415
+ if (this.keyList[i] !== void 0 && !this.isBackgroundFetch(this.valList[i])) {
416
+ yield this.keyList[i];
417
+ }
418
+ }
419
+ }
420
+ *rkeys() {
421
+ for (const i of this.rindexes()) {
422
+ if (this.keyList[i] !== void 0 && !this.isBackgroundFetch(this.valList[i])) {
423
+ yield this.keyList[i];
424
+ }
425
+ }
426
+ }
427
+ *values() {
428
+ for (const i of this.indexes()) {
429
+ if (this.valList[i] !== void 0 && !this.isBackgroundFetch(this.valList[i])) {
430
+ yield this.valList[i];
431
+ }
432
+ }
433
+ }
434
+ *rvalues() {
435
+ for (const i of this.rindexes()) {
436
+ if (this.valList[i] !== void 0 && !this.isBackgroundFetch(this.valList[i])) {
437
+ yield this.valList[i];
438
+ }
439
+ }
440
+ }
441
+ [Symbol.iterator]() {
442
+ return this.entries();
443
+ }
444
+ find(fn, getOptions) {
445
+ for (const i of this.indexes()) {
446
+ const v = this.valList[i];
447
+ const value = this.isBackgroundFetch(v) ? v.__staleWhileFetching : v;
448
+ if (value === void 0)
449
+ continue;
450
+ if (fn(value, this.keyList[i], this)) {
451
+ return this.get(this.keyList[i], getOptions);
452
+ }
453
+ }
454
+ }
455
+ forEach(fn, thisp = this) {
456
+ for (const i of this.indexes()) {
457
+ const v = this.valList[i];
458
+ const value = this.isBackgroundFetch(v) ? v.__staleWhileFetching : v;
459
+ if (value === void 0)
460
+ continue;
461
+ fn.call(thisp, value, this.keyList[i], this);
462
+ }
463
+ }
464
+ rforEach(fn, thisp = this) {
465
+ for (const i of this.rindexes()) {
466
+ const v = this.valList[i];
467
+ const value = this.isBackgroundFetch(v) ? v.__staleWhileFetching : v;
468
+ if (value === void 0)
469
+ continue;
470
+ fn.call(thisp, value, this.keyList[i], this);
471
+ }
472
+ }
473
+ get prune() {
474
+ deprecatedMethod("prune", "purgeStale");
475
+ return this.purgeStale;
476
+ }
477
+ purgeStale() {
478
+ let deleted = false;
479
+ for (const i of this.rindexes({ allowStale: true })) {
480
+ if (this.isStale(i)) {
481
+ this.delete(this.keyList[i]);
482
+ deleted = true;
483
+ }
484
+ }
485
+ return deleted;
486
+ }
487
+ dump() {
488
+ const arr = [];
489
+ for (const i of this.indexes({ allowStale: true })) {
490
+ const key = this.keyList[i];
491
+ const v = this.valList[i];
492
+ const value = this.isBackgroundFetch(v) ? v.__staleWhileFetching : v;
493
+ if (value === void 0)
494
+ continue;
495
+ const entry = { value };
496
+ if (this.ttls) {
497
+ entry.ttl = this.ttls[i];
498
+ const age = perf.now() - this.starts[i];
499
+ entry.start = Math.floor(Date.now() - age);
500
+ }
501
+ if (this.sizes) {
502
+ entry.size = this.sizes[i];
503
+ }
504
+ arr.unshift([key, entry]);
505
+ }
506
+ return arr;
507
+ }
508
+ load(arr) {
509
+ this.clear();
510
+ for (const [key, entry] of arr) {
511
+ if (entry.start) {
512
+ const age = Date.now() - entry.start;
513
+ entry.start = perf.now() - age;
514
+ }
515
+ this.set(key, entry.value, entry);
516
+ }
517
+ }
518
+ dispose(_v, _k, _reason) {
519
+ }
520
+ set(k, v, {
521
+ ttl = this.ttl,
522
+ start,
523
+ noDisposeOnSet = this.noDisposeOnSet,
524
+ size = 0,
525
+ sizeCalculation = this.sizeCalculation,
526
+ noUpdateTTL = this.noUpdateTTL,
527
+ status
528
+ } = {}) {
529
+ size = this.requireSize(k, v, size, sizeCalculation);
530
+ if (this.maxEntrySize && size > this.maxEntrySize) {
531
+ if (status) {
532
+ status.set = "miss";
533
+ status.maxEntrySizeExceeded = true;
534
+ }
535
+ this.delete(k);
536
+ return this;
537
+ }
538
+ let index = this.size === 0 ? void 0 : this.keyMap.get(k);
539
+ if (index === void 0) {
540
+ index = this.newIndex();
541
+ this.keyList[index] = k;
542
+ this.valList[index] = v;
543
+ this.keyMap.set(k, index);
544
+ this.next[this.tail] = index;
545
+ this.prev[index] = this.tail;
546
+ this.tail = index;
547
+ this.size++;
548
+ this.addItemSize(index, size, status);
549
+ if (status) {
550
+ status.set = "add";
551
+ }
552
+ noUpdateTTL = false;
553
+ } else {
554
+ this.moveToTail(index);
555
+ const oldVal = this.valList[index];
556
+ if (v !== oldVal) {
557
+ if (this.isBackgroundFetch(oldVal)) {
558
+ oldVal.__abortController.abort(new Error("replaced"));
559
+ } else {
560
+ if (!noDisposeOnSet) {
561
+ this.dispose(oldVal, k, "set");
562
+ if (this.disposeAfter) {
563
+ this.disposed.push([oldVal, k, "set"]);
564
+ }
565
+ }
566
+ }
567
+ this.removeItemSize(index);
568
+ this.valList[index] = v;
569
+ this.addItemSize(index, size, status);
570
+ if (status) {
571
+ status.set = "replace";
572
+ const oldValue = oldVal && this.isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
573
+ if (oldValue !== void 0)
574
+ status.oldValue = oldValue;
575
+ }
576
+ } else if (status) {
577
+ status.set = "update";
578
+ }
579
+ }
580
+ if (ttl !== 0 && this.ttl === 0 && !this.ttls) {
581
+ this.initializeTTLTracking();
582
+ }
583
+ if (!noUpdateTTL) {
584
+ this.setItemTTL(index, ttl, start);
585
+ }
586
+ this.statusTTL(status, index);
587
+ if (this.disposeAfter) {
588
+ while (this.disposed.length) {
589
+ this.disposeAfter(...this.disposed.shift());
590
+ }
591
+ }
592
+ return this;
593
+ }
594
+ newIndex() {
595
+ if (this.size === 0) {
596
+ return this.tail;
597
+ }
598
+ if (this.size === this.max && this.max !== 0) {
599
+ return this.evict(false);
600
+ }
601
+ if (this.free.length !== 0) {
602
+ return this.free.pop();
603
+ }
604
+ return this.initialFill++;
605
+ }
606
+ pop() {
607
+ if (this.size) {
608
+ const val = this.valList[this.head];
609
+ this.evict(true);
610
+ return val;
611
+ }
612
+ }
613
+ evict(free) {
614
+ const head = this.head;
615
+ const k = this.keyList[head];
616
+ const v = this.valList[head];
617
+ if (this.isBackgroundFetch(v)) {
618
+ v.__abortController.abort(new Error("evicted"));
619
+ } else {
620
+ this.dispose(v, k, "evict");
621
+ if (this.disposeAfter) {
622
+ this.disposed.push([v, k, "evict"]);
623
+ }
624
+ }
625
+ this.removeItemSize(head);
626
+ if (free) {
627
+ this.keyList[head] = null;
628
+ this.valList[head] = null;
629
+ this.free.push(head);
630
+ }
631
+ this.head = this.next[head];
632
+ this.keyMap.delete(k);
633
+ this.size--;
634
+ return head;
635
+ }
636
+ has(k, { updateAgeOnHas = this.updateAgeOnHas, status } = {}) {
637
+ const index = this.keyMap.get(k);
638
+ if (index !== void 0) {
639
+ if (!this.isStale(index)) {
640
+ if (updateAgeOnHas) {
641
+ this.updateItemAge(index);
642
+ }
643
+ if (status)
644
+ status.has = "hit";
645
+ this.statusTTL(status, index);
646
+ return true;
647
+ } else if (status) {
648
+ status.has = "stale";
649
+ this.statusTTL(status, index);
650
+ }
651
+ } else if (status) {
652
+ status.has = "miss";
653
+ }
654
+ return false;
655
+ }
656
+ // like get(), but without any LRU updating or TTL expiration
657
+ peek(k, { allowStale = this.allowStale } = {}) {
658
+ const index = this.keyMap.get(k);
659
+ if (index !== void 0 && (allowStale || !this.isStale(index))) {
660
+ const v = this.valList[index];
661
+ return this.isBackgroundFetch(v) ? v.__staleWhileFetching : v;
662
+ }
663
+ }
664
+ backgroundFetch(k, index, options, context) {
665
+ const v = index === void 0 ? void 0 : this.valList[index];
666
+ if (this.isBackgroundFetch(v)) {
667
+ return v;
668
+ }
669
+ const ac = new AC();
670
+ if (options.signal) {
671
+ options.signal.addEventListener(
672
+ "abort",
673
+ () => ac.abort(options.signal.reason)
674
+ );
675
+ }
676
+ const fetchOpts = {
677
+ signal: ac.signal,
678
+ options,
679
+ context
680
+ };
681
+ const cb = (v2, updateCache = false) => {
682
+ const { aborted } = ac.signal;
683
+ const ignoreAbort = options.ignoreFetchAbort && v2 !== void 0;
684
+ if (options.status) {
685
+ if (aborted && !updateCache) {
686
+ options.status.fetchAborted = true;
687
+ options.status.fetchError = ac.signal.reason;
688
+ if (ignoreAbort)
689
+ options.status.fetchAbortIgnored = true;
690
+ } else {
691
+ options.status.fetchResolved = true;
692
+ }
693
+ }
694
+ if (aborted && !ignoreAbort && !updateCache) {
695
+ return fetchFail(ac.signal.reason);
696
+ }
697
+ if (this.valList[index] === p) {
698
+ if (v2 === void 0) {
699
+ if (p.__staleWhileFetching) {
700
+ this.valList[index] = p.__staleWhileFetching;
701
+ } else {
702
+ this.delete(k);
703
+ }
704
+ } else {
705
+ if (options.status)
706
+ options.status.fetchUpdated = true;
707
+ this.set(k, v2, fetchOpts.options);
708
+ }
709
+ }
710
+ return v2;
711
+ };
712
+ const eb = (er) => {
713
+ if (options.status) {
714
+ options.status.fetchRejected = true;
715
+ options.status.fetchError = er;
716
+ }
717
+ return fetchFail(er);
718
+ };
719
+ const fetchFail = (er) => {
720
+ const { aborted } = ac.signal;
721
+ const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
722
+ const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
723
+ const noDelete = allowStale || options.noDeleteOnFetchRejection;
724
+ if (this.valList[index] === p) {
725
+ const del = !noDelete || p.__staleWhileFetching === void 0;
726
+ if (del) {
727
+ this.delete(k);
728
+ } else if (!allowStaleAborted) {
729
+ this.valList[index] = p.__staleWhileFetching;
730
+ }
731
+ }
732
+ if (allowStale) {
733
+ if (options.status && p.__staleWhileFetching !== void 0) {
734
+ options.status.returnedStale = true;
735
+ }
736
+ return p.__staleWhileFetching;
737
+ } else if (p.__returned === p) {
738
+ throw er;
739
+ }
740
+ };
741
+ const pcall = (res, rej) => {
742
+ this.fetchMethod(k, v, fetchOpts).then((v2) => res(v2), rej);
743
+ ac.signal.addEventListener("abort", () => {
744
+ if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
745
+ res();
746
+ if (options.allowStaleOnFetchAbort) {
747
+ res = (v2) => cb(v2, true);
748
+ }
749
+ }
750
+ });
751
+ };
752
+ if (options.status)
753
+ options.status.fetchDispatched = true;
754
+ const p = new Promise(pcall).then(cb, eb);
755
+ p.__abortController = ac;
756
+ p.__staleWhileFetching = v;
757
+ p.__returned = null;
758
+ if (index === void 0) {
759
+ this.set(k, p, { ...fetchOpts.options, status: void 0 });
760
+ index = this.keyMap.get(k);
761
+ } else {
762
+ this.valList[index] = p;
763
+ }
764
+ return p;
765
+ }
766
+ isBackgroundFetch(p) {
767
+ return p && typeof p === "object" && typeof p.then === "function" && Object.prototype.hasOwnProperty.call(
768
+ p,
769
+ "__staleWhileFetching"
770
+ ) && Object.prototype.hasOwnProperty.call(p, "__returned") && (p.__returned === p || p.__returned === null);
771
+ }
772
+ // this takes the union of get() and set() opts, because it does both
773
+ async fetch(k, {
774
+ // get options
775
+ allowStale = this.allowStale,
776
+ updateAgeOnGet = this.updateAgeOnGet,
777
+ noDeleteOnStaleGet = this.noDeleteOnStaleGet,
778
+ // set options
779
+ ttl = this.ttl,
780
+ noDisposeOnSet = this.noDisposeOnSet,
781
+ size = 0,
782
+ sizeCalculation = this.sizeCalculation,
783
+ noUpdateTTL = this.noUpdateTTL,
784
+ // fetch exclusive options
785
+ noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
786
+ allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
787
+ ignoreFetchAbort = this.ignoreFetchAbort,
788
+ allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
789
+ fetchContext = this.fetchContext,
790
+ forceRefresh = false,
791
+ status,
792
+ signal
793
+ } = {}) {
794
+ if (!this.fetchMethod) {
795
+ if (status)
796
+ status.fetch = "get";
797
+ return this.get(k, {
798
+ allowStale,
799
+ updateAgeOnGet,
800
+ noDeleteOnStaleGet,
801
+ status
802
+ });
803
+ }
804
+ const options = {
805
+ allowStale,
806
+ updateAgeOnGet,
807
+ noDeleteOnStaleGet,
808
+ ttl,
809
+ noDisposeOnSet,
810
+ size,
811
+ sizeCalculation,
812
+ noUpdateTTL,
813
+ noDeleteOnFetchRejection,
814
+ allowStaleOnFetchRejection,
815
+ allowStaleOnFetchAbort,
816
+ ignoreFetchAbort,
817
+ status,
818
+ signal
819
+ };
820
+ let index = this.keyMap.get(k);
821
+ if (index === void 0) {
822
+ if (status)
823
+ status.fetch = "miss";
824
+ const p = this.backgroundFetch(k, index, options, fetchContext);
825
+ return p.__returned = p;
826
+ } else {
827
+ const v = this.valList[index];
828
+ if (this.isBackgroundFetch(v)) {
829
+ const stale = allowStale && v.__staleWhileFetching !== void 0;
830
+ if (status) {
831
+ status.fetch = "inflight";
832
+ if (stale)
833
+ status.returnedStale = true;
834
+ }
835
+ return stale ? v.__staleWhileFetching : v.__returned = v;
836
+ }
837
+ const isStale = this.isStale(index);
838
+ if (!forceRefresh && !isStale) {
839
+ if (status)
840
+ status.fetch = "hit";
841
+ this.moveToTail(index);
842
+ if (updateAgeOnGet) {
843
+ this.updateItemAge(index);
844
+ }
845
+ this.statusTTL(status, index);
846
+ return v;
847
+ }
848
+ const p = this.backgroundFetch(k, index, options, fetchContext);
849
+ const hasStale = p.__staleWhileFetching !== void 0;
850
+ const staleVal = hasStale && allowStale;
851
+ if (status) {
852
+ status.fetch = hasStale && isStale ? "stale" : "refresh";
853
+ if (staleVal && isStale)
854
+ status.returnedStale = true;
855
+ }
856
+ return staleVal ? p.__staleWhileFetching : p.__returned = p;
857
+ }
858
+ }
859
+ get(k, {
860
+ allowStale = this.allowStale,
861
+ updateAgeOnGet = this.updateAgeOnGet,
862
+ noDeleteOnStaleGet = this.noDeleteOnStaleGet,
863
+ status
864
+ } = {}) {
865
+ const index = this.keyMap.get(k);
866
+ if (index !== void 0) {
867
+ const value = this.valList[index];
868
+ const fetching = this.isBackgroundFetch(value);
869
+ this.statusTTL(status, index);
870
+ if (this.isStale(index)) {
871
+ if (status)
872
+ status.get = "stale";
873
+ if (!fetching) {
874
+ if (!noDeleteOnStaleGet) {
875
+ this.delete(k);
876
+ }
877
+ if (status)
878
+ status.returnedStale = allowStale;
879
+ return allowStale ? value : void 0;
880
+ } else {
881
+ if (status) {
882
+ status.returnedStale = allowStale && value.__staleWhileFetching !== void 0;
883
+ }
884
+ return allowStale ? value.__staleWhileFetching : void 0;
885
+ }
886
+ } else {
887
+ if (status)
888
+ status.get = "hit";
889
+ if (fetching) {
890
+ return value.__staleWhileFetching;
891
+ }
892
+ this.moveToTail(index);
893
+ if (updateAgeOnGet) {
894
+ this.updateItemAge(index);
895
+ }
896
+ return value;
897
+ }
898
+ } else if (status) {
899
+ status.get = "miss";
900
+ }
901
+ }
902
+ connect(p, n) {
903
+ this.prev[n] = p;
904
+ this.next[p] = n;
905
+ }
906
+ moveToTail(index) {
907
+ if (index !== this.tail) {
908
+ if (index === this.head) {
909
+ this.head = this.next[index];
910
+ } else {
911
+ this.connect(this.prev[index], this.next[index]);
912
+ }
913
+ this.connect(this.tail, index);
914
+ this.tail = index;
915
+ }
916
+ }
917
+ get del() {
918
+ deprecatedMethod("del", "delete");
919
+ return this.delete;
920
+ }
921
+ delete(k) {
922
+ let deleted = false;
923
+ if (this.size !== 0) {
924
+ const index = this.keyMap.get(k);
925
+ if (index !== void 0) {
926
+ deleted = true;
927
+ if (this.size === 1) {
928
+ this.clear();
929
+ } else {
930
+ this.removeItemSize(index);
931
+ const v = this.valList[index];
932
+ if (this.isBackgroundFetch(v)) {
933
+ v.__abortController.abort(new Error("deleted"));
934
+ } else {
935
+ this.dispose(v, k, "delete");
936
+ if (this.disposeAfter) {
937
+ this.disposed.push([v, k, "delete"]);
938
+ }
939
+ }
940
+ this.keyMap.delete(k);
941
+ this.keyList[index] = null;
942
+ this.valList[index] = null;
943
+ if (index === this.tail) {
944
+ this.tail = this.prev[index];
945
+ } else if (index === this.head) {
946
+ this.head = this.next[index];
947
+ } else {
948
+ this.next[this.prev[index]] = this.next[index];
949
+ this.prev[this.next[index]] = this.prev[index];
950
+ }
951
+ this.size--;
952
+ this.free.push(index);
953
+ }
954
+ }
955
+ }
956
+ if (this.disposed) {
957
+ while (this.disposed.length) {
958
+ this.disposeAfter(...this.disposed.shift());
959
+ }
960
+ }
961
+ return deleted;
962
+ }
963
+ clear() {
964
+ for (const index of this.rindexes({ allowStale: true })) {
965
+ const v = this.valList[index];
966
+ if (this.isBackgroundFetch(v)) {
967
+ v.__abortController.abort(new Error("deleted"));
968
+ } else {
969
+ const k = this.keyList[index];
970
+ this.dispose(v, k, "delete");
971
+ if (this.disposeAfter) {
972
+ this.disposed.push([v, k, "delete"]);
973
+ }
974
+ }
975
+ }
976
+ this.keyMap.clear();
977
+ this.valList.fill(null);
978
+ this.keyList.fill(null);
979
+ if (this.ttls) {
980
+ this.ttls.fill(0);
981
+ this.starts.fill(0);
982
+ }
983
+ if (this.sizes) {
984
+ this.sizes.fill(0);
985
+ }
986
+ this.head = 0;
987
+ this.tail = 0;
988
+ this.initialFill = 1;
989
+ this.free.length = 0;
990
+ this.calculatedSize = 0;
991
+ this.size = 0;
992
+ if (this.disposed) {
993
+ while (this.disposed.length) {
994
+ this.disposeAfter(...this.disposed.shift());
995
+ }
996
+ }
997
+ }
998
+ get reset() {
999
+ deprecatedMethod("reset", "clear");
1000
+ return this.clear;
1001
+ }
1002
+ get length() {
1003
+ deprecatedProperty("length", "size");
1004
+ return this.size;
1005
+ }
1006
+ static get AbortController() {
1007
+ return AC;
1008
+ }
1009
+ static get AbortSignal() {
1010
+ return AS;
1011
+ }
1012
+ }
1013
+ var lruCache = LRUCache;
1014
+ exports.lruCache = lruCache;
1015
+ //# sourceMappingURL=index.cjs.map