netlify-cli 19.1.1 → 19.1.3

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 (795) hide show
  1. package/dist/commands/api/api.d.ts +4 -0
  2. package/dist/commands/api/api.d.ts.map +1 -0
  3. package/dist/commands/api/api.js +40 -0
  4. package/dist/commands/api/api.js.map +1 -0
  5. package/dist/commands/api/index.d.ts +3 -0
  6. package/dist/commands/api/index.d.ts.map +1 -0
  7. package/dist/commands/api/index.js +14 -0
  8. package/dist/commands/api/index.js.map +1 -0
  9. package/dist/commands/base-command.d.ts +85 -0
  10. package/dist/commands/base-command.d.ts.map +1 -0
  11. package/dist/commands/base-command.js +602 -0
  12. package/dist/commands/base-command.js.map +1 -0
  13. package/dist/commands/blobs/blobs-delete.d.ts +5 -0
  14. package/dist/commands/blobs/blobs-delete.d.ts.map +1 -0
  15. package/dist/commands/blobs/blobs-delete.js +27 -0
  16. package/dist/commands/blobs/blobs-delete.js.map +1 -0
  17. package/dist/commands/blobs/blobs-get.d.ts +8 -0
  18. package/dist/commands/blobs/blobs-get.d.ts.map +1 -0
  19. package/dist/commands/blobs/blobs-get.js +32 -0
  20. package/dist/commands/blobs/blobs-get.js.map +1 -0
  21. package/dist/commands/blobs/blobs-list.d.ts +10 -0
  22. package/dist/commands/blobs/blobs-list.d.ts.map +1 -0
  23. package/dist/commands/blobs/blobs-list.js +37 -0
  24. package/dist/commands/blobs/blobs-list.js.map +1 -0
  25. package/dist/commands/blobs/blobs-set.d.ts +9 -0
  26. package/dist/commands/blobs/blobs-set.d.ts.map +1 -0
  27. package/dist/commands/blobs/blobs-set.js +48 -0
  28. package/dist/commands/blobs/blobs-set.js.map +1 -0
  29. package/dist/commands/blobs/blobs.d.ts +6 -0
  30. package/dist/commands/blobs/blobs.d.ts.map +1 -0
  31. package/dist/commands/blobs/blobs.js +75 -0
  32. package/dist/commands/blobs/blobs.js.map +1 -0
  33. package/dist/commands/build/build.d.ts +6 -0
  34. package/dist/commands/build/build.d.ts.map +1 -0
  35. package/dist/commands/build/build.js +39 -0
  36. package/dist/commands/build/build.js.map +1 -0
  37. package/dist/commands/build/index.d.ts +3 -0
  38. package/dist/commands/build/index.d.ts.map +1 -0
  39. package/dist/commands/build/index.js +14 -0
  40. package/dist/commands/build/index.js.map +1 -0
  41. package/dist/commands/completion/completion.d.ts +5 -0
  42. package/dist/commands/completion/completion.d.ts.map +1 -0
  43. package/dist/commands/completion/completion.js +69 -0
  44. package/dist/commands/completion/completion.js.map +1 -0
  45. package/dist/commands/completion/index.d.ts +3 -0
  46. package/dist/commands/completion/index.d.ts.map +1 -0
  47. package/dist/commands/completion/index.js +27 -0
  48. package/dist/commands/completion/index.js.map +1 -0
  49. package/dist/commands/deploy/deploy.d.ts +4 -0
  50. package/dist/commands/deploy/deploy.d.ts.map +1 -0
  51. package/dist/commands/deploy/deploy.js +720 -0
  52. package/dist/commands/deploy/deploy.js.map +1 -0
  53. package/dist/commands/deploy/index.d.ts +3 -0
  54. package/dist/commands/deploy/index.d.ts.map +1 -0
  55. package/dist/commands/deploy/index.js +107 -0
  56. package/dist/commands/deploy/index.js.map +1 -0
  57. package/dist/commands/dev/dev-exec.d.ts +5 -0
  58. package/dist/commands/dev/dev-exec.d.ts.map +1 -0
  59. package/dist/commands/dev/dev-exec.js +21 -0
  60. package/dist/commands/dev/dev-exec.js.map +1 -0
  61. package/dist/commands/dev/dev.d.ts +5 -0
  62. package/dist/commands/dev/dev.d.ts.map +1 -0
  63. package/dist/commands/dev/dev.js +249 -0
  64. package/dist/commands/dev/dev.js.map +1 -0
  65. package/dist/commands/dev/index.d.ts +2 -0
  66. package/dist/commands/dev/index.d.ts.map +1 -0
  67. package/dist/commands/dev/index.js +2 -0
  68. package/dist/commands/dev/index.js.map +1 -0
  69. package/dist/commands/env/env-clone.d.ts +4 -0
  70. package/dist/commands/env/env-clone.d.ts.map +1 -0
  71. package/dist/commands/env/env-clone.js +83 -0
  72. package/dist/commands/env/env-clone.js.map +1 -0
  73. package/dist/commands/env/env-get.d.ts +4 -0
  74. package/dist/commands/env/env-get.d.ts.map +1 -0
  75. package/dist/commands/env/env-get.js +28 -0
  76. package/dist/commands/env/env-get.js.map +1 -0
  77. package/dist/commands/env/env-import.d.ts +4 -0
  78. package/dist/commands/env/env-import.d.ts.map +1 -0
  79. package/dist/commands/env/env-import.js +78 -0
  80. package/dist/commands/env/env-import.js.map +1 -0
  81. package/dist/commands/env/env-list.d.ts +4 -0
  82. package/dist/commands/env/env-list.d.ts.map +1 -0
  83. package/dist/commands/env/env-list.js +85 -0
  84. package/dist/commands/env/env-list.js.map +1 -0
  85. package/dist/commands/env/env-set.d.ts +4 -0
  86. package/dist/commands/env/env-set.d.ts.map +1 -0
  87. package/dist/commands/env/env-set.js +123 -0
  88. package/dist/commands/env/env-set.js.map +1 -0
  89. package/dist/commands/env/env-unset.d.ts +4 -0
  90. package/dist/commands/env/env-unset.d.ts.map +1 -0
  91. package/dist/commands/env/env-unset.js +76 -0
  92. package/dist/commands/env/env-unset.js.map +1 -0
  93. package/dist/commands/env/env.d.ts +3 -0
  94. package/dist/commands/env/env.d.ts.map +1 -0
  95. package/dist/commands/env/env.js +129 -0
  96. package/dist/commands/env/env.js.map +1 -0
  97. package/dist/commands/env/index.d.ts +2 -0
  98. package/dist/commands/env/index.d.ts.map +1 -0
  99. package/dist/commands/env/index.js +2 -0
  100. package/dist/commands/env/index.js.map +1 -0
  101. package/dist/commands/functions/functions-build.d.ts +4 -0
  102. package/dist/commands/functions/functions-build.d.ts.map +1 -0
  103. package/dist/commands/functions/functions-build.js +27 -0
  104. package/dist/commands/functions/functions-build.js.map +1 -0
  105. package/dist/commands/functions/functions-create.d.ts +4 -0
  106. package/dist/commands/functions/functions-create.d.ts.map +1 -0
  107. package/dist/commands/functions/functions-create.js +635 -0
  108. package/dist/commands/functions/functions-create.js.map +1 -0
  109. package/dist/commands/functions/functions-invoke.d.ts +4 -0
  110. package/dist/commands/functions/functions-invoke.d.ts.map +1 -0
  111. package/dist/commands/functions/functions-invoke.js +210 -0
  112. package/dist/commands/functions/functions-invoke.js.map +1 -0
  113. package/dist/commands/functions/functions-list.d.ts +4 -0
  114. package/dist/commands/functions/functions-list.d.ts.map +1 -0
  115. package/dist/commands/functions/functions-list.js +41 -0
  116. package/dist/commands/functions/functions-list.js.map +1 -0
  117. package/dist/commands/functions/functions-serve.d.ts +4 -0
  118. package/dist/commands/functions/functions-serve.d.ts.map +1 -0
  119. package/dist/commands/functions/functions-serve.js +52 -0
  120. package/dist/commands/functions/functions-serve.js.map +1 -0
  121. package/dist/commands/functions/functions.d.ts +3 -0
  122. package/dist/commands/functions/functions.d.ts.map +1 -0
  123. package/dist/commands/functions/functions.js +101 -0
  124. package/dist/commands/functions/functions.js.map +1 -0
  125. package/dist/commands/functions/index.d.ts +2 -0
  126. package/dist/commands/functions/index.d.ts.map +1 -0
  127. package/dist/commands/functions/index.js +2 -0
  128. package/dist/commands/functions/index.js.map +1 -0
  129. package/dist/commands/index.d.ts +3 -0
  130. package/dist/commands/index.d.ts.map +1 -0
  131. package/dist/commands/index.js +3 -0
  132. package/dist/commands/index.js.map +1 -0
  133. package/dist/commands/init/index.d.ts +3 -0
  134. package/dist/commands/init/index.d.ts.map +1 -0
  135. package/dist/commands/init/index.js +10 -0
  136. package/dist/commands/init/index.js.map +1 -0
  137. package/dist/commands/init/init.d.ts +4 -0
  138. package/dist/commands/init/init.d.ts.map +1 -0
  139. package/dist/commands/init/init.js +194 -0
  140. package/dist/commands/init/init.js.map +1 -0
  141. package/dist/commands/link/index.d.ts +3 -0
  142. package/dist/commands/link/index.d.ts.map +1 -0
  143. package/dist/commands/link/index.js +12 -0
  144. package/dist/commands/link/index.js.map +1 -0
  145. package/dist/commands/link/link.d.ts +4 -0
  146. package/dist/commands/link/link.d.ts.map +1 -0
  147. package/dist/commands/link/link.js +295 -0
  148. package/dist/commands/link/link.js.map +1 -0
  149. package/dist/commands/login/index.d.ts +3 -0
  150. package/dist/commands/login/index.d.ts.map +1 -0
  151. package/dist/commands/login/index.js +10 -0
  152. package/dist/commands/login/index.js.map +1 -0
  153. package/dist/commands/login/login.d.ts +4 -0
  154. package/dist/commands/login/login.d.ts.map +1 -0
  155. package/dist/commands/login/login.js +30 -0
  156. package/dist/commands/login/login.js.map +1 -0
  157. package/dist/commands/logout/index.d.ts +3 -0
  158. package/dist/commands/logout/index.d.ts.map +1 -0
  159. package/dist/commands/logout/index.js +8 -0
  160. package/dist/commands/logout/index.js.map +1 -0
  161. package/dist/commands/logout/logout.d.ts +4 -0
  162. package/dist/commands/logout/logout.d.ts.map +1 -0
  163. package/dist/commands/logout/logout.js +23 -0
  164. package/dist/commands/logout/logout.js.map +1 -0
  165. package/dist/commands/logs/build.d.ts +8 -0
  166. package/dist/commands/logs/build.d.ts.map +1 -0
  167. package/dist/commands/logs/build.js +72 -0
  168. package/dist/commands/logs/build.js.map +1 -0
  169. package/dist/commands/logs/functions.d.ts +4 -0
  170. package/dist/commands/logs/functions.d.ts.map +1 -0
  171. package/dist/commands/logs/functions.js +79 -0
  172. package/dist/commands/logs/functions.js.map +1 -0
  173. package/dist/commands/logs/index.d.ts +5 -0
  174. package/dist/commands/logs/index.d.ts.map +1 -0
  175. package/dist/commands/logs/index.js +40 -0
  176. package/dist/commands/logs/index.js.map +1 -0
  177. package/dist/commands/logs/log-levels.d.ts +11 -0
  178. package/dist/commands/logs/log-levels.d.ts.map +1 -0
  179. package/dist/commands/logs/log-levels.js +12 -0
  180. package/dist/commands/logs/log-levels.js.map +1 -0
  181. package/dist/commands/main.d.ts +38 -0
  182. package/dist/commands/main.d.ts.map +1 -0
  183. package/dist/commands/main.js +215 -0
  184. package/dist/commands/main.js.map +1 -0
  185. package/dist/commands/open/index.d.ts +3 -0
  186. package/dist/commands/open/index.d.ts.map +1 -0
  187. package/dist/commands/open/index.js +32 -0
  188. package/dist/commands/open/index.js.map +1 -0
  189. package/dist/commands/open/open-admin.d.ts +4 -0
  190. package/dist/commands/open/open-admin.d.ts.map +1 -0
  191. package/dist/commands/open/open-admin.js +12 -0
  192. package/dist/commands/open/open-admin.js.map +1 -0
  193. package/dist/commands/open/open-site.d.ts +4 -0
  194. package/dist/commands/open/open-site.d.ts.map +1 -0
  195. package/dist/commands/open/open-site.js +13 -0
  196. package/dist/commands/open/open-site.js.map +1 -0
  197. package/dist/commands/open/open.d.ts +4 -0
  198. package/dist/commands/open/open.d.ts.map +1 -0
  199. package/dist/commands/open/open.js +14 -0
  200. package/dist/commands/open/open.js.map +1 -0
  201. package/dist/commands/recipes/common.d.ts +3 -0
  202. package/dist/commands/recipes/common.d.ts.map +1 -0
  203. package/dist/commands/recipes/common.js +26 -0
  204. package/dist/commands/recipes/common.js.map +1 -0
  205. package/dist/commands/recipes/index.d.ts +3 -0
  206. package/dist/commands/recipes/index.d.ts.map +1 -0
  207. package/dist/commands/recipes/index.js +21 -0
  208. package/dist/commands/recipes/index.js.map +1 -0
  209. package/dist/commands/recipes/recipes-list.d.ts +5 -0
  210. package/dist/commands/recipes/recipes-list.d.ts.map +1 -0
  211. package/dist/commands/recipes/recipes-list.js +15 -0
  212. package/dist/commands/recipes/recipes-list.js.map +1 -0
  213. package/dist/commands/recipes/recipes.d.ts +12 -0
  214. package/dist/commands/recipes/recipes.d.ts.map +1 -0
  215. package/dist/commands/recipes/recipes.js +52 -0
  216. package/dist/commands/recipes/recipes.js.map +1 -0
  217. package/dist/commands/serve/index.d.ts +3 -0
  218. package/dist/commands/serve/index.d.ts.map +1 -0
  219. package/dist/commands/serve/index.js +26 -0
  220. package/dist/commands/serve/index.js.map +1 -0
  221. package/dist/commands/serve/serve.d.ts +4 -0
  222. package/dist/commands/serve/serve.d.ts.map +1 -0
  223. package/dist/commands/serve/serve.js +149 -0
  224. package/dist/commands/serve/serve.js.map +1 -0
  225. package/dist/commands/sites/index.d.ts +2 -0
  226. package/dist/commands/sites/index.d.ts.map +1 -0
  227. package/dist/commands/sites/index.js +2 -0
  228. package/dist/commands/sites/index.js.map +1 -0
  229. package/dist/commands/sites/sites-create-template.d.ts +5 -0
  230. package/dist/commands/sites/sites-create-template.d.ts.map +1 -0
  231. package/dist/commands/sites/sites-create-template.js +230 -0
  232. package/dist/commands/sites/sites-create-template.js.map +1 -0
  233. package/dist/commands/sites/sites-create.d.ts +7 -0
  234. package/dist/commands/sites/sites-create.d.ts.map +1 -0
  235. package/dist/commands/sites/sites-create.js +125 -0
  236. package/dist/commands/sites/sites-create.js.map +1 -0
  237. package/dist/commands/sites/sites-delete.d.ts +4 -0
  238. package/dist/commands/sites/sites-delete.d.ts.map +1 -0
  239. package/dist/commands/sites/sites-delete.js +77 -0
  240. package/dist/commands/sites/sites-delete.js.map +1 -0
  241. package/dist/commands/sites/sites-list.d.ts +4 -0
  242. package/dist/commands/sites/sites-list.d.ts.map +1 -0
  243. package/dist/commands/sites/sites-list.js +59 -0
  244. package/dist/commands/sites/sites-list.js.map +1 -0
  245. package/dist/commands/sites/sites.d.ts +5 -0
  246. package/dist/commands/sites/sites.d.ts.map +1 -0
  247. package/dist/commands/sites/sites.js +77 -0
  248. package/dist/commands/sites/sites.js.map +1 -0
  249. package/dist/commands/status/index.d.ts +3 -0
  250. package/dist/commands/status/index.d.ts.map +1 -0
  251. package/dist/commands/status/index.js +21 -0
  252. package/dist/commands/status/index.js.map +1 -0
  253. package/dist/commands/status/status-hooks.d.ts +4 -0
  254. package/dist/commands/status/status-hooks.d.ts.map +1 -0
  255. package/dist/commands/status/status-hooks.js +29 -0
  256. package/dist/commands/status/status-hooks.js.map +1 -0
  257. package/dist/commands/status/status.d.ts +4 -0
  258. package/dist/commands/status/status.d.ts.map +1 -0
  259. package/dist/commands/status/status.js +78 -0
  260. package/dist/commands/status/status.js.map +1 -0
  261. package/dist/commands/switch/index.d.ts +3 -0
  262. package/dist/commands/switch/index.d.ts.map +1 -0
  263. package/dist/commands/switch/index.js +8 -0
  264. package/dist/commands/switch/index.js.map +1 -0
  265. package/dist/commands/switch/switch.d.ts +4 -0
  266. package/dist/commands/switch/switch.d.ts.map +1 -0
  267. package/dist/commands/switch/switch.js +31 -0
  268. package/dist/commands/switch/switch.js.map +1 -0
  269. package/dist/commands/unlink/index.d.ts +3 -0
  270. package/dist/commands/unlink/index.d.ts.map +1 -0
  271. package/dist/commands/unlink/index.js +8 -0
  272. package/dist/commands/unlink/index.js.map +1 -0
  273. package/dist/commands/unlink/unlink.d.ts +4 -0
  274. package/dist/commands/unlink/unlink.d.ts.map +1 -0
  275. package/dist/commands/unlink/unlink.js +22 -0
  276. package/dist/commands/unlink/unlink.js.map +1 -0
  277. package/dist/commands/watch/index.d.ts +3 -0
  278. package/dist/commands/watch/index.d.ts.map +1 -0
  279. package/dist/commands/watch/index.js +9 -0
  280. package/dist/commands/watch/index.js.map +1 -0
  281. package/dist/commands/watch/watch.d.ts +4 -0
  282. package/dist/commands/watch/watch.d.ts.map +1 -0
  283. package/dist/commands/watch/watch.js +90 -0
  284. package/dist/commands/watch/watch.js.map +1 -0
  285. package/dist/lib/account.d.ts +6 -0
  286. package/dist/lib/account.d.ts.map +1 -0
  287. package/dist/lib/account.js +14 -0
  288. package/dist/lib/account.js.map +1 -0
  289. package/dist/lib/api.d.ts +10 -0
  290. package/dist/lib/api.d.ts.map +1 -0
  291. package/dist/lib/api.js +25 -0
  292. package/dist/lib/api.js.map +1 -0
  293. package/dist/lib/blobs/blobs.d.ts +47 -0
  294. package/dist/lib/blobs/blobs.d.ts.map +1 -0
  295. package/dist/lib/blobs/blobs.js +82 -0
  296. package/dist/lib/blobs/blobs.js.map +1 -0
  297. package/dist/lib/build.d.ts +43 -0
  298. package/dist/lib/build.d.ts.map +1 -0
  299. package/dist/lib/build.js +73 -0
  300. package/dist/lib/build.js.map +1 -0
  301. package/dist/lib/completion/constants.d.ts +2 -0
  302. package/dist/lib/completion/constants.d.ts.map +1 -0
  303. package/dist/lib/completion/constants.js +3 -0
  304. package/dist/lib/completion/constants.js.map +1 -0
  305. package/dist/lib/completion/generate-autocompletion.d.ts +8 -0
  306. package/dist/lib/completion/generate-autocompletion.d.ts.map +1 -0
  307. package/dist/lib/completion/generate-autocompletion.js +42 -0
  308. package/dist/lib/completion/generate-autocompletion.js.map +1 -0
  309. package/dist/lib/completion/get-autocompletion.d.ts +13 -0
  310. package/dist/lib/completion/get-autocompletion.d.ts.map +1 -0
  311. package/dist/lib/completion/get-autocompletion.js +45 -0
  312. package/dist/lib/completion/get-autocompletion.js.map +1 -0
  313. package/dist/lib/completion/index.d.ts +2 -0
  314. package/dist/lib/completion/index.d.ts.map +1 -0
  315. package/dist/lib/completion/index.js +2 -0
  316. package/dist/lib/completion/index.js.map +1 -0
  317. package/dist/lib/completion/script.d.ts +3 -0
  318. package/dist/lib/completion/script.d.ts.map +1 -0
  319. package/dist/lib/completion/script.js +19 -0
  320. package/dist/lib/completion/script.js.map +1 -0
  321. package/dist/lib/edge-functions/bootstrap.d.ts +3 -0
  322. package/dist/lib/edge-functions/bootstrap.d.ts.map +1 -0
  323. package/dist/lib/edge-functions/bootstrap.js +20 -0
  324. package/dist/lib/edge-functions/bootstrap.js.map +1 -0
  325. package/dist/lib/edge-functions/consts.d.ts +11 -0
  326. package/dist/lib/edge-functions/consts.d.ts.map +1 -0
  327. package/dist/lib/edge-functions/consts.js +13 -0
  328. package/dist/lib/edge-functions/consts.js.map +1 -0
  329. package/dist/lib/edge-functions/deploy.d.ts +8 -0
  330. package/dist/lib/edge-functions/deploy.d.ts.map +1 -0
  331. package/dist/lib/edge-functions/deploy.js +34 -0
  332. package/dist/lib/edge-functions/deploy.js.map +1 -0
  333. package/dist/lib/edge-functions/editor-helper.d.ts +9 -0
  334. package/dist/lib/edge-functions/editor-helper.d.ts.map +1 -0
  335. package/dist/lib/edge-functions/editor-helper.js +31 -0
  336. package/dist/lib/edge-functions/editor-helper.js.map +1 -0
  337. package/dist/lib/edge-functions/headers.d.ts +35 -0
  338. package/dist/lib/edge-functions/headers.d.ts.map +1 -0
  339. package/dist/lib/edge-functions/headers.js +42 -0
  340. package/dist/lib/edge-functions/headers.js.map +1 -0
  341. package/dist/lib/edge-functions/proxy.d.ts +39 -0
  342. package/dist/lib/edge-functions/proxy.d.ts.map +1 -0
  343. package/dist/lib/edge-functions/proxy.js +156 -0
  344. package/dist/lib/edge-functions/proxy.js.map +1 -0
  345. package/dist/lib/edge-functions/registry.d.ts +107 -0
  346. package/dist/lib/edge-functions/registry.d.ts.map +1 -0
  347. package/dist/lib/edge-functions/registry.js +451 -0
  348. package/dist/lib/edge-functions/registry.js.map +1 -0
  349. package/dist/lib/exec-fetcher.d.ts +31 -0
  350. package/dist/lib/exec-fetcher.d.ts.map +1 -0
  351. package/dist/lib/exec-fetcher.js +132 -0
  352. package/dist/lib/exec-fetcher.js.map +1 -0
  353. package/dist/lib/fs.d.ts +12 -0
  354. package/dist/lib/fs.d.ts.map +1 -0
  355. package/dist/lib/fs.js +45 -0
  356. package/dist/lib/fs.js.map +1 -0
  357. package/dist/lib/functions/background.d.ts +3 -0
  358. package/dist/lib/functions/background.d.ts.map +1 -0
  359. package/dist/lib/functions/background.js +19 -0
  360. package/dist/lib/functions/background.js.map +1 -0
  361. package/dist/lib/functions/config.d.ts +6 -0
  362. package/dist/lib/functions/config.d.ts.map +1 -0
  363. package/dist/lib/functions/config.js +25 -0
  364. package/dist/lib/functions/config.js.map +1 -0
  365. package/dist/lib/functions/form-submissions-handler.d.ts +11 -0
  366. package/dist/lib/functions/form-submissions-handler.d.ts.map +1 -0
  367. package/dist/lib/functions/form-submissions-handler.js +144 -0
  368. package/dist/lib/functions/form-submissions-handler.js.map +1 -0
  369. package/dist/lib/functions/local-proxy.d.ts +9 -0
  370. package/dist/lib/functions/local-proxy.d.ts.map +1 -0
  371. package/dist/lib/functions/local-proxy.js +40 -0
  372. package/dist/lib/functions/local-proxy.js.map +1 -0
  373. package/dist/lib/functions/memoized-build.d.ts +6 -0
  374. package/dist/lib/functions/memoized-build.d.ts.map +1 -0
  375. package/dist/lib/functions/memoized-build.js +30 -0
  376. package/dist/lib/functions/memoized-build.js.map +1 -0
  377. package/dist/lib/functions/netlify-function.d.ts +71 -0
  378. package/dist/lib/functions/netlify-function.d.ts.map +1 -0
  379. package/dist/lib/functions/netlify-function.js +266 -0
  380. package/dist/lib/functions/netlify-function.js.map +1 -0
  381. package/dist/lib/functions/registry.d.ts +106 -0
  382. package/dist/lib/functions/registry.d.ts.map +1 -0
  383. package/dist/lib/functions/registry.js +485 -0
  384. package/dist/lib/functions/registry.js.map +1 -0
  385. package/dist/lib/functions/runtimes/go/index.d.ts +25 -0
  386. package/dist/lib/functions/runtimes/go/index.d.ts.map +1 -0
  387. package/dist/lib/functions/runtimes/go/index.js +68 -0
  388. package/dist/lib/functions/runtimes/go/index.js.map +1 -0
  389. package/dist/lib/functions/runtimes/index.d.ts +42 -0
  390. package/dist/lib/functions/runtimes/index.d.ts.map +1 -0
  391. package/dist/lib/functions/runtimes/index.js +10 -0
  392. package/dist/lib/functions/runtimes/index.js.map +1 -0
  393. package/dist/lib/functions/runtimes/js/builders/netlify-lambda.d.ts +19 -0
  394. package/dist/lib/functions/runtimes/js/builders/netlify-lambda.d.ts.map +1 -0
  395. package/dist/lib/functions/runtimes/js/builders/netlify-lambda.js +62 -0
  396. package/dist/lib/functions/runtimes/js/builders/netlify-lambda.js.map +1 -0
  397. package/dist/lib/functions/runtimes/js/builders/zisi.d.ts +46 -0
  398. package/dist/lib/functions/runtimes/js/builders/zisi.d.ts.map +1 -0
  399. package/dist/lib/functions/runtimes/js/builders/zisi.js +184 -0
  400. package/dist/lib/functions/runtimes/js/builders/zisi.js.map +1 -0
  401. package/dist/lib/functions/runtimes/js/constants.d.ts +2 -0
  402. package/dist/lib/functions/runtimes/js/constants.d.ts.map +1 -0
  403. package/dist/lib/functions/runtimes/js/constants.js +2 -0
  404. package/dist/lib/functions/runtimes/js/constants.js.map +1 -0
  405. package/dist/lib/functions/runtimes/js/index.d.ts +25 -0
  406. package/dist/lib/functions/runtimes/js/index.d.ts.map +1 -0
  407. package/dist/lib/functions/runtimes/js/index.js +112 -0
  408. package/dist/lib/functions/runtimes/js/index.js.map +1 -0
  409. package/dist/lib/functions/runtimes/js/worker.d.ts +2 -0
  410. package/dist/lib/functions/runtimes/js/worker.d.ts.map +1 -0
  411. package/dist/lib/functions/runtimes/js/worker.js +53 -0
  412. package/dist/lib/functions/runtimes/js/worker.js.map +1 -0
  413. package/dist/lib/functions/runtimes/rust/index.d.ts +25 -0
  414. package/dist/lib/functions/runtimes/rust/index.d.ts.map +1 -0
  415. package/dist/lib/functions/runtimes/rust/index.js +69 -0
  416. package/dist/lib/functions/runtimes/rust/index.js.map +1 -0
  417. package/dist/lib/functions/scheduled.d.ts +17 -0
  418. package/dist/lib/functions/scheduled.d.ts.map +1 -0
  419. package/dist/lib/functions/scheduled.js +81 -0
  420. package/dist/lib/functions/scheduled.js.map +1 -0
  421. package/dist/lib/functions/server.d.ts +31 -0
  422. package/dist/lib/functions/server.d.ts.map +1 -0
  423. package/dist/lib/functions/server.js +303 -0
  424. package/dist/lib/functions/server.js.map +1 -0
  425. package/dist/lib/functions/synchronous.d.ts +8 -0
  426. package/dist/lib/functions/synchronous.d.ts.map +1 -0
  427. package/dist/lib/functions/synchronous.js +141 -0
  428. package/dist/lib/functions/synchronous.js.map +1 -0
  429. package/dist/lib/functions/utils.d.ts +11 -0
  430. package/dist/lib/functions/utils.d.ts.map +1 -0
  431. package/dist/lib/functions/utils.js +47 -0
  432. package/dist/lib/functions/utils.js.map +1 -0
  433. package/dist/lib/geo-location.d.ts +46 -0
  434. package/dist/lib/geo-location.d.ts.map +1 -0
  435. package/dist/lib/geo-location.js +108 -0
  436. package/dist/lib/geo-location.js.map +1 -0
  437. package/dist/lib/http-agent.d.ts +18 -0
  438. package/dist/lib/http-agent.d.ts.map +1 -0
  439. package/dist/lib/http-agent.js +97 -0
  440. package/dist/lib/http-agent.js.map +1 -0
  441. package/dist/lib/images/proxy.d.ts +34 -0
  442. package/dist/lib/images/proxy.d.ts.map +1 -0
  443. package/dist/lib/images/proxy.js +122 -0
  444. package/dist/lib/images/proxy.js.map +1 -0
  445. package/dist/lib/log.d.ts +3 -0
  446. package/dist/lib/log.d.ts.map +1 -0
  447. package/dist/lib/log.js +16 -0
  448. package/dist/lib/log.js.map +1 -0
  449. package/dist/lib/path.d.ts +2 -0
  450. package/dist/lib/path.d.ts.map +1 -0
  451. package/dist/lib/path.js +3 -0
  452. package/dist/lib/path.js.map +1 -0
  453. package/dist/lib/render-error-template.d.ts +3 -0
  454. package/dist/lib/render-error-template.d.ts.map +1 -0
  455. package/dist/lib/render-error-template.js +21 -0
  456. package/dist/lib/render-error-template.js.map +1 -0
  457. package/dist/lib/settings.d.ts +14 -0
  458. package/dist/lib/settings.d.ts.map +1 -0
  459. package/dist/lib/settings.js +19 -0
  460. package/dist/lib/settings.js.map +1 -0
  461. package/dist/lib/spinner.d.ts +23 -0
  462. package/dist/lib/spinner.d.ts.map +1 -0
  463. package/dist/lib/spinner.js +30 -0
  464. package/dist/lib/spinner.js.map +1 -0
  465. package/dist/lib/string.d.ts +2 -0
  466. package/dist/lib/string.d.ts.map +1 -0
  467. package/dist/lib/string.js +6 -0
  468. package/dist/lib/string.js.map +1 -0
  469. package/dist/recipes/ai-context/context.d.ts +33 -0
  470. package/dist/recipes/ai-context/context.d.ts.map +1 -0
  471. package/dist/recipes/ai-context/context.js +101 -0
  472. package/dist/recipes/ai-context/context.js.map +1 -0
  473. package/dist/recipes/ai-context/index.d.ts +4 -0
  474. package/dist/recipes/ai-context/index.d.ts.map +1 -0
  475. package/dist/recipes/ai-context/index.js +86 -0
  476. package/dist/recipes/ai-context/index.js.map +1 -0
  477. package/dist/recipes/blobs-migrate/index.d.ts +9 -0
  478. package/dist/recipes/blobs-migrate/index.d.ts.map +1 -0
  479. package/dist/recipes/blobs-migrate/index.js +77 -0
  480. package/dist/recipes/blobs-migrate/index.js.map +1 -0
  481. package/dist/recipes/vscode/index.d.ts +12 -0
  482. package/dist/recipes/vscode/index.d.ts.map +1 -0
  483. package/dist/recipes/vscode/index.js +91 -0
  484. package/dist/recipes/vscode/index.js.map +1 -0
  485. package/dist/recipes/vscode/settings.d.ts +18 -0
  486. package/dist/recipes/vscode/settings.d.ts.map +1 -0
  487. package/dist/recipes/vscode/settings.js +61 -0
  488. package/dist/recipes/vscode/settings.js.map +1 -0
  489. package/dist/tsconfig.build.tsbuildinfo +1 -0
  490. package/dist/utils/addons/prepare.d.ts +13 -0
  491. package/dist/utils/addons/prepare.d.ts.map +1 -0
  492. package/dist/utils/addons/prepare.js +26 -0
  493. package/dist/utils/addons/prepare.js.map +1 -0
  494. package/dist/utils/banner.d.ts +4 -0
  495. package/dist/utils/banner.d.ts.map +1 -0
  496. package/dist/utils/banner.js +12 -0
  497. package/dist/utils/banner.js.map +1 -0
  498. package/dist/utils/build-info.d.ts +21 -0
  499. package/dist/utils/build-info.d.ts.map +1 -0
  500. package/dist/utils/build-info.js +124 -0
  501. package/dist/utils/build-info.js.map +1 -0
  502. package/dist/utils/command-helpers.d.ts +116 -0
  503. package/dist/utils/command-helpers.d.ts.map +1 -0
  504. package/dist/utils/command-helpers.js +264 -0
  505. package/dist/utils/command-helpers.js.map +1 -0
  506. package/dist/utils/copy-template-dir/copy-template-dir.d.ts +2 -0
  507. package/dist/utils/copy-template-dir/copy-template-dir.d.ts.map +1 -0
  508. package/dist/utils/copy-template-dir/copy-template-dir.js +75 -0
  509. package/dist/utils/copy-template-dir/copy-template-dir.js.map +1 -0
  510. package/dist/utils/create-deferred.d.ts +7 -0
  511. package/dist/utils/create-deferred.d.ts.map +1 -0
  512. package/dist/utils/create-deferred.js +11 -0
  513. package/dist/utils/create-deferred.js.map +1 -0
  514. package/dist/utils/create-stream-promise.d.ts +5 -0
  515. package/dist/utils/create-stream-promise.d.ts.map +1 -0
  516. package/dist/utils/create-stream-promise.js +46 -0
  517. package/dist/utils/create-stream-promise.js.map +1 -0
  518. package/dist/utils/deploy/constants.d.ts +10 -0
  519. package/dist/utils/deploy/constants.d.ts.map +1 -0
  520. package/dist/utils/deploy/constants.js +18 -0
  521. package/dist/utils/deploy/constants.js.map +1 -0
  522. package/dist/utils/deploy/deploy-site.d.ts +24 -0
  523. package/dist/utils/deploy/deploy-site.d.ts.map +1 -0
  524. package/dist/utils/deploy/deploy-site.js +157 -0
  525. package/dist/utils/deploy/deploy-site.js.map +1 -0
  526. package/dist/utils/deploy/hash-config.d.ts +10 -0
  527. package/dist/utils/deploy/hash-config.d.ts.map +1 -0
  528. package/dist/utils/deploy/hash-config.js +26 -0
  529. package/dist/utils/deploy/hash-config.js.map +1 -0
  530. package/dist/utils/deploy/hash-files.d.ts +14 -0
  531. package/dist/utils/deploy/hash-files.d.ts.map +1 -0
  532. package/dist/utils/deploy/hash-files.js +31 -0
  533. package/dist/utils/deploy/hash-files.js.map +1 -0
  534. package/dist/utils/deploy/hash-fns.d.ts +17 -0
  535. package/dist/utils/deploy/hash-fns.d.ts.map +1 -0
  536. package/dist/utils/deploy/hash-fns.js +143 -0
  537. package/dist/utils/deploy/hash-fns.js.map +1 -0
  538. package/dist/utils/deploy/hasher-segments.d.ts +14 -0
  539. package/dist/utils/deploy/hasher-segments.d.ts.map +1 -0
  540. package/dist/utils/deploy/hasher-segments.js +69 -0
  541. package/dist/utils/deploy/hasher-segments.js.map +1 -0
  542. package/dist/utils/deploy/upload-files.d.ts +7 -0
  543. package/dist/utils/deploy/upload-files.d.ts.map +1 -0
  544. package/dist/utils/deploy/upload-files.js +113 -0
  545. package/dist/utils/deploy/upload-files.js.map +1 -0
  546. package/dist/utils/deploy/util.d.ts +5 -0
  547. package/dist/utils/deploy/util.d.ts.map +1 -0
  548. package/dist/utils/deploy/util.js +94 -0
  549. package/dist/utils/deploy/util.js.map +1 -0
  550. package/dist/utils/detect-server-settings.d.ts +15 -0
  551. package/dist/utils/detect-server-settings.d.ts.map +1 -0
  552. package/dist/utils/detect-server-settings.js +252 -0
  553. package/dist/utils/detect-server-settings.js.map +1 -0
  554. package/dist/utils/dev.d.ts +62 -0
  555. package/dist/utils/dev.d.ts.map +1 -0
  556. package/dist/utils/dev.js +197 -0
  557. package/dist/utils/dev.js.map +1 -0
  558. package/dist/utils/dot-env.d.ts +26 -0
  559. package/dist/utils/dot-env.d.ts.map +1 -0
  560. package/dist/utils/dot-env.js +43 -0
  561. package/dist/utils/dot-env.js.map +1 -0
  562. package/dist/utils/env/index.d.ts +100 -0
  563. package/dist/utils/env/index.d.ts.map +1 -0
  564. package/dist/utils/env/index.js +231 -0
  565. package/dist/utils/env/index.js.map +1 -0
  566. package/dist/utils/execa.d.ts +4 -0
  567. package/dist/utils/execa.d.ts.map +1 -0
  568. package/dist/utils/execa.js +16 -0
  569. package/dist/utils/execa.js.map +1 -0
  570. package/dist/utils/feature-flags.d.ts +21 -0
  571. package/dist/utils/feature-flags.d.ts.map +1 -0
  572. package/dist/utils/feature-flags.js +25 -0
  573. package/dist/utils/feature-flags.js.map +1 -0
  574. package/dist/utils/framework-server.d.ts +13 -0
  575. package/dist/utils/framework-server.d.ts.map +1 -0
  576. package/dist/utils/framework-server.js +61 -0
  577. package/dist/utils/framework-server.js.map +1 -0
  578. package/dist/utils/frameworks-api.d.ts +20 -0
  579. package/dist/utils/frameworks-api.d.ts.map +1 -0
  580. package/dist/utils/frameworks-api.js +54 -0
  581. package/dist/utils/frameworks-api.js.map +1 -0
  582. package/dist/utils/functions/constants.d.ts +2 -0
  583. package/dist/utils/functions/constants.d.ts.map +1 -0
  584. package/dist/utils/functions/constants.js +2 -0
  585. package/dist/utils/functions/constants.js.map +1 -0
  586. package/dist/utils/functions/functions.d.ts +35 -0
  587. package/dist/utils/functions/functions.d.ts.map +1 -0
  588. package/dist/utils/functions/functions.js +41 -0
  589. package/dist/utils/functions/functions.js.map +1 -0
  590. package/dist/utils/functions/get-functions.d.ts +10 -0
  591. package/dist/utils/functions/get-functions.d.ts.map +1 -0
  592. package/dist/utils/functions/get-functions.js +35 -0
  593. package/dist/utils/functions/get-functions.js.map +1 -0
  594. package/dist/utils/functions/index.d.ts +4 -0
  595. package/dist/utils/functions/index.d.ts.map +1 -0
  596. package/dist/utils/functions/index.js +4 -0
  597. package/dist/utils/functions/index.js.map +1 -0
  598. package/dist/utils/get-global-config.d.ts +7 -0
  599. package/dist/utils/get-global-config.d.ts.map +1 -0
  600. package/dist/utils/get-global-config.js +41 -0
  601. package/dist/utils/get-global-config.js.map +1 -0
  602. package/dist/utils/get-package-json.d.ts +3 -0
  603. package/dist/utils/get-package-json.d.ts.map +1 -0
  604. package/dist/utils/get-package-json.js +16 -0
  605. package/dist/utils/get-package-json.js.map +1 -0
  606. package/dist/utils/get-repo-data.d.ts +31 -0
  607. package/dist/utils/get-repo-data.d.ts.map +1 -0
  608. package/dist/utils/get-repo-data.js +66 -0
  609. package/dist/utils/get-repo-data.js.map +1 -0
  610. package/dist/utils/get-site.d.ts +2 -0
  611. package/dist/utils/get-site.d.ts.map +1 -0
  612. package/dist/utils/get-site.js +22 -0
  613. package/dist/utils/get-site.js.map +1 -0
  614. package/dist/utils/gh-auth.d.ts +11 -0
  615. package/dist/utils/gh-auth.d.ts.map +1 -0
  616. package/dist/utils/gh-auth.js +105 -0
  617. package/dist/utils/gh-auth.js.map +1 -0
  618. package/dist/utils/gitignore.d.ts +2 -0
  619. package/dist/utils/gitignore.d.ts.map +1 -0
  620. package/dist/utils/gitignore.js +36 -0
  621. package/dist/utils/gitignore.js.map +1 -0
  622. package/dist/utils/headers.d.ts +21 -0
  623. package/dist/utils/headers.d.ts.map +1 -0
  624. package/dist/utils/headers.js +51 -0
  625. package/dist/utils/headers.js.map +1 -0
  626. package/dist/utils/hooks/requires-site-info.d.ts +7 -0
  627. package/dist/utils/hooks/requires-site-info.d.ts.map +1 -0
  628. package/dist/utils/hooks/requires-site-info.js +31 -0
  629. package/dist/utils/hooks/requires-site-info.js.map +1 -0
  630. package/dist/utils/init/config-github.d.ts +21 -0
  631. package/dist/utils/init/config-github.d.ts.map +1 -0
  632. package/dist/utils/init/config-github.js +247 -0
  633. package/dist/utils/init/config-github.js.map +1 -0
  634. package/dist/utils/init/config-manual.d.ts +12 -0
  635. package/dist/utils/init/config-manual.d.ts.map +1 -0
  636. package/dist/utils/init/config-manual.js +109 -0
  637. package/dist/utils/init/config-manual.js.map +1 -0
  638. package/dist/utils/init/config.d.ts +14 -0
  639. package/dist/utils/init/config.d.ts.map +1 -0
  640. package/dist/utils/init/config.js +38 -0
  641. package/dist/utils/init/config.js.map +1 -0
  642. package/dist/utils/init/plugins.d.ts +3 -0
  643. package/dist/utils/init/plugins.d.ts.map +1 -0
  644. package/dist/utils/init/plugins.js +13 -0
  645. package/dist/utils/init/plugins.js.map +1 -0
  646. package/dist/utils/init/utils.d.ts +54 -0
  647. package/dist/utils/init/utils.d.ts.map +1 -0
  648. package/dist/utils/init/utils.js +199 -0
  649. package/dist/utils/init/utils.js.map +1 -0
  650. package/dist/utils/live-tunnel.d.ts +8 -0
  651. package/dist/utils/live-tunnel.d.ts.map +1 -0
  652. package/dist/utils/live-tunnel.js +128 -0
  653. package/dist/utils/live-tunnel.js.map +1 -0
  654. package/dist/utils/multimap.d.ts +6 -0
  655. package/dist/utils/multimap.d.ts.map +1 -0
  656. package/dist/utils/multimap.js +10 -0
  657. package/dist/utils/multimap.js.map +1 -0
  658. package/dist/utils/open-browser.d.ts +7 -0
  659. package/dist/utils/open-browser.d.ts.map +1 -0
  660. package/dist/utils/open-browser.js +33 -0
  661. package/dist/utils/open-browser.js.map +1 -0
  662. package/dist/utils/parse-raw-flags.d.ts +3 -0
  663. package/dist/utils/parse-raw-flags.d.ts.map +1 -0
  664. package/dist/utils/parse-raw-flags.js +54 -0
  665. package/dist/utils/parse-raw-flags.js.map +1 -0
  666. package/dist/utils/prompts/blob-delete-prompts.d.ts +2 -0
  667. package/dist/utils/prompts/blob-delete-prompts.d.ts.map +1 -0
  668. package/dist/utils/prompts/blob-delete-prompts.js +12 -0
  669. package/dist/utils/prompts/blob-delete-prompts.js.map +1 -0
  670. package/dist/utils/prompts/blob-set-prompt.d.ts +2 -0
  671. package/dist/utils/prompts/blob-set-prompt.d.ts.map +1 -0
  672. package/dist/utils/prompts/blob-set-prompt.js +12 -0
  673. package/dist/utils/prompts/blob-set-prompt.js.map +1 -0
  674. package/dist/utils/prompts/confirm-prompt.d.ts +2 -0
  675. package/dist/utils/prompts/confirm-prompt.d.ts.map +1 -0
  676. package/dist/utils/prompts/confirm-prompt.js +21 -0
  677. package/dist/utils/prompts/confirm-prompt.js.map +1 -0
  678. package/dist/utils/prompts/env-clone-prompt.d.ts +11 -0
  679. package/dist/utils/prompts/env-clone-prompt.d.ts.map +1 -0
  680. package/dist/utils/prompts/env-clone-prompt.js +28 -0
  681. package/dist/utils/prompts/env-clone-prompt.js.map +1 -0
  682. package/dist/utils/prompts/env-set-prompts.d.ts +2 -0
  683. package/dist/utils/prompts/env-set-prompts.d.ts.map +1 -0
  684. package/dist/utils/prompts/env-set-prompts.js +12 -0
  685. package/dist/utils/prompts/env-set-prompts.js.map +1 -0
  686. package/dist/utils/prompts/env-unset-prompts.d.ts +8 -0
  687. package/dist/utils/prompts/env-unset-prompts.d.ts.map +1 -0
  688. package/dist/utils/prompts/env-unset-prompts.js +18 -0
  689. package/dist/utils/prompts/env-unset-prompts.js.map +1 -0
  690. package/dist/utils/prompts/prompt-messages.d.ts +25 -0
  691. package/dist/utils/prompts/prompt-messages.d.ts.map +1 -0
  692. package/dist/utils/prompts/prompt-messages.js +26 -0
  693. package/dist/utils/prompts/prompt-messages.js.map +1 -0
  694. package/dist/utils/proxy-server.d.ts +38 -0
  695. package/dist/utils/proxy-server.d.ts.map +1 -0
  696. package/dist/utils/proxy-server.js +50 -0
  697. package/dist/utils/proxy-server.js.map +1 -0
  698. package/dist/utils/proxy.d.ts +10 -0
  699. package/dist/utils/proxy.d.ts.map +1 -0
  700. package/dist/utils/proxy.js +776 -0
  701. package/dist/utils/proxy.js.map +1 -0
  702. package/dist/utils/read-repo-url.d.ts +12 -0
  703. package/dist/utils/read-repo-url.d.ts.map +1 -0
  704. package/dist/utils/read-repo-url.js +62 -0
  705. package/dist/utils/read-repo-url.js.map +1 -0
  706. package/dist/utils/redirects.d.ts +6 -0
  707. package/dist/utils/redirects.d.ts.map +1 -0
  708. package/dist/utils/redirects.js +59 -0
  709. package/dist/utils/redirects.js.map +1 -0
  710. package/dist/utils/request-id.d.ts +2 -0
  711. package/dist/utils/request-id.d.ts.map +1 -0
  712. package/dist/utils/request-id.js +3 -0
  713. package/dist/utils/request-id.js.map +1 -0
  714. package/dist/utils/rules-proxy.d.ts +14 -0
  715. package/dist/utils/rules-proxy.d.ts.map +1 -0
  716. package/dist/utils/rules-proxy.js +103 -0
  717. package/dist/utils/rules-proxy.js.map +1 -0
  718. package/dist/utils/run-build.d.ts +42 -0
  719. package/dist/utils/run-build.d.ts.map +1 -0
  720. package/dist/utils/run-build.js +130 -0
  721. package/dist/utils/run-build.js.map +1 -0
  722. package/dist/utils/run-program.d.ts +3 -0
  723. package/dist/utils/run-program.d.ts.map +1 -0
  724. package/dist/utils/run-program.js +13 -0
  725. package/dist/utils/run-program.js.map +1 -0
  726. package/dist/utils/scripted-commands.d.ts +3 -0
  727. package/dist/utils/scripted-commands.d.ts.map +1 -0
  728. package/dist/utils/scripted-commands.js +18 -0
  729. package/dist/utils/scripted-commands.js.map +1 -0
  730. package/dist/utils/shell.d.ts +8 -0
  731. package/dist/utils/shell.d.ts.map +1 -0
  732. package/dist/utils/shell.js +114 -0
  733. package/dist/utils/shell.js.map +1 -0
  734. package/dist/utils/sign-redirect.d.ts +7 -0
  735. package/dist/utils/sign-redirect.d.ts.map +1 -0
  736. package/dist/utils/sign-redirect.js +16 -0
  737. package/dist/utils/sign-redirect.js.map +1 -0
  738. package/dist/utils/sites/create-template.d.ts +14 -0
  739. package/dist/utils/sites/create-template.d.ts.map +1 -0
  740. package/dist/utils/sites/create-template.js +47 -0
  741. package/dist/utils/sites/create-template.js.map +1 -0
  742. package/dist/utils/sites/utils.d.ts +16 -0
  743. package/dist/utils/sites/utils.d.ts.map +1 -0
  744. package/dist/utils/sites/utils.js +63 -0
  745. package/dist/utils/sites/utils.js.map +1 -0
  746. package/dist/utils/state-config.d.ts +12 -0
  747. package/dist/utils/state-config.d.ts.map +1 -0
  748. package/dist/utils/state-config.js +113 -0
  749. package/dist/utils/state-config.js.map +1 -0
  750. package/dist/utils/static-server.d.ts +10 -0
  751. package/dist/utils/static-server.d.ts.map +1 -0
  752. package/dist/utils/static-server.js +36 -0
  753. package/dist/utils/static-server.js.map +1 -0
  754. package/dist/utils/telemetry/index.d.ts +3 -0
  755. package/dist/utils/telemetry/index.d.ts.map +1 -0
  756. package/dist/utils/telemetry/index.js +3 -0
  757. package/dist/utils/telemetry/index.js.map +1 -0
  758. package/dist/utils/telemetry/report-error.d.ts +10 -0
  759. package/dist/utils/telemetry/report-error.d.ts.map +1 -0
  760. package/dist/utils/telemetry/report-error.js +53 -0
  761. package/dist/utils/telemetry/report-error.js.map +1 -0
  762. package/dist/utils/telemetry/request.d.ts +2 -0
  763. package/dist/utils/telemetry/request.d.ts.map +1 -0
  764. package/dist/utils/telemetry/request.js +41 -0
  765. package/dist/utils/telemetry/request.js.map +1 -0
  766. package/dist/utils/telemetry/telemetry.d.ts +14 -0
  767. package/dist/utils/telemetry/telemetry.d.ts.map +1 -0
  768. package/dist/utils/telemetry/telemetry.js +94 -0
  769. package/dist/utils/telemetry/telemetry.js.map +1 -0
  770. package/dist/utils/telemetry/utils.d.ts +3 -0
  771. package/dist/utils/telemetry/utils.d.ts.map +1 -0
  772. package/dist/utils/telemetry/utils.js +7 -0
  773. package/dist/utils/telemetry/utils.js.map +1 -0
  774. package/dist/utils/telemetry/validation.d.ts +2 -0
  775. package/dist/utils/telemetry/validation.d.ts.map +1 -0
  776. package/dist/utils/telemetry/validation.js +63 -0
  777. package/dist/utils/telemetry/validation.js.map +1 -0
  778. package/dist/utils/types.d.ts +202 -0
  779. package/dist/utils/types.d.ts.map +1 -0
  780. package/dist/utils/types.js +2 -0
  781. package/dist/utils/types.js.map +1 -0
  782. package/dist/utils/validation.d.ts +6 -0
  783. package/dist/utils/validation.d.ts.map +1 -0
  784. package/dist/utils/validation.js +17 -0
  785. package/dist/utils/validation.js.map +1 -0
  786. package/dist/utils/websockets/index.d.ts +3 -0
  787. package/dist/utils/websockets/index.d.ts.map +1 -0
  788. package/dist/utils/websockets/index.js +3 -0
  789. package/dist/utils/websockets/index.js.map +1 -0
  790. package/functions-templates/javascript/scheduled-function/package.json +1 -1
  791. package/functions-templates/typescript/hello-world/package-lock.json +15 -15
  792. package/functions-templates/typescript/hello-world/package.json +1 -1
  793. package/functions-templates/typescript/scheduled-function/package.json +1 -1
  794. package/npm-shrinkwrap.json +32 -48
  795. package/package.json +4 -4
@@ -0,0 +1,776 @@
1
+ import { Buffer } from 'buffer';
2
+ import { once } from 'events';
3
+ import { readFile } from 'fs/promises';
4
+ import http from 'http';
5
+ import https from 'https';
6
+ import { isIPv6 } from 'net';
7
+ import { Socket } from 'node:net';
8
+ import { Readable } from 'node:stream';
9
+ import path from 'path';
10
+ import process from 'process';
11
+ import url from 'url';
12
+ import util from 'util';
13
+ import zlib from 'zlib';
14
+ import contentType from 'content-type';
15
+ import cookie from 'cookie';
16
+ import { getProperty } from 'dot-prop';
17
+ import generateETag from 'etag';
18
+ import getAvailablePort from 'get-port';
19
+ import httpProxy from 'http-proxy';
20
+ import { createProxyMiddleware } from 'http-proxy-middleware';
21
+ import { jwtDecode } from 'jwt-decode';
22
+ import { locatePath } from 'locate-path';
23
+ import throttle from 'lodash/throttle.js';
24
+ import pFilter from 'p-filter';
25
+ import { handleProxyRequest, initializeProxy as initializeEdgeFunctionsProxy, isEdgeFunctionsRequest, } from '../lib/edge-functions/proxy.js';
26
+ import { fileExistsAsync, isFileAsync } from '../lib/fs.js';
27
+ import { getFormHandler } from '../lib/functions/form-submissions-handler.js';
28
+ import { DEFAULT_FUNCTION_URL_EXPRESSION } from '../lib/functions/registry.js';
29
+ import { initializeProxy as initializeImageProxy, isImageRequest } from '../lib/images/proxy.js';
30
+ import renderErrorTemplate from '../lib/render-error-template.js';
31
+ import { NETLIFYDEVLOG, NETLIFYDEVWARN, chalk, log } from './command-helpers.js';
32
+ import createStreamPromise from './create-stream-promise.js';
33
+ import { NFFunctionName, NFFunctionRoute, NFRequestID, headersForPath, parseHeaders } from './headers.js';
34
+ import { generateRequestID } from './request-id.js';
35
+ import { createRewriter, onChanges } from './rules-proxy.js';
36
+ import { signRedirect } from './sign-redirect.js';
37
+ const gunzip = util.promisify(zlib.gunzip);
38
+ const gzip = util.promisify(zlib.gzip);
39
+ const brotliDecompress = util.promisify(zlib.brotliDecompress);
40
+ const brotliCompress = util.promisify(zlib.brotliCompress);
41
+ const deflate = util.promisify(zlib.deflate);
42
+ const inflate = util.promisify(zlib.inflate);
43
+ const shouldGenerateETag = Symbol('Internal: response should generate ETag');
44
+ const decompressResponseBody = async function (body, contentEncoding = '') {
45
+ switch (contentEncoding) {
46
+ case 'gzip':
47
+ return await gunzip(body);
48
+ case 'br':
49
+ return await brotliDecompress(body);
50
+ case 'deflate':
51
+ return await inflate(body);
52
+ default:
53
+ return body;
54
+ }
55
+ };
56
+ const compressResponseBody = async function (body, contentEncoding = '') {
57
+ switch (contentEncoding) {
58
+ case 'gzip':
59
+ return await gzip(body);
60
+ case 'br':
61
+ return await brotliCompress(body);
62
+ case 'deflate':
63
+ return await deflate(body);
64
+ default:
65
+ return Buffer.from(body, 'utf8');
66
+ }
67
+ };
68
+ const injectHtml = async function (responseBody, proxyRes, htmlInjections) {
69
+ const decompressedBody = await decompressResponseBody(responseBody, proxyRes.headers['content-encoding']);
70
+ const bodyWithInjections = (htmlInjections ?? []).reduce((accum, htmlInjection) => {
71
+ if (!htmlInjection.html || typeof htmlInjection.html !== 'string') {
72
+ return accum;
73
+ }
74
+ const location = htmlInjection.location ?? 'before_closing_head_tag';
75
+ if (location === 'before_closing_head_tag') {
76
+ accum = accum.replace('</head>', `${htmlInjection.html}</head>`);
77
+ }
78
+ else if (location === 'before_closing_body_tag') {
79
+ accum = accum.replace('</body>', `${htmlInjection.html}</body>`);
80
+ }
81
+ return accum;
82
+ }, decompressedBody.toString());
83
+ return await compressResponseBody(bodyWithInjections, proxyRes.headers['content-encoding']);
84
+ };
85
+ // @ts-expect-error TS(7006) FIXME: Parameter 'errorBuffer' implicitly has an 'any' ty... Remove this comment to see the full error message
86
+ const formatEdgeFunctionError = (errorBuffer, acceptsHtml) => {
87
+ const { error: { message, name, stack }, } = JSON.parse(errorBuffer.toString());
88
+ if (!acceptsHtml) {
89
+ return `${name}: ${message}\n ${stack}`;
90
+ }
91
+ return JSON.stringify({
92
+ errorType: name,
93
+ errorMessage: message,
94
+ trace: stack.split('\\n'),
95
+ });
96
+ };
97
+ function isInternal(url) {
98
+ return url?.startsWith('/.netlify/') ?? false;
99
+ }
100
+ function isFunction(functionsPort, url) {
101
+ return functionsPort && url.match(DEFAULT_FUNCTION_URL_EXPRESSION);
102
+ }
103
+ function getAddonUrl(addonsUrls, req) {
104
+ const matches = req.url?.match(/^\/.netlify\/([^/]+)(\/.*)/);
105
+ const addonUrl = matches && addonsUrls[matches[1]];
106
+ return addonUrl ? `${addonUrl}${matches[2]}` : null;
107
+ }
108
+ const getStatic = async function (pathname, publicFolder) {
109
+ const alternatives = [pathname, ...alternativePathsFor(pathname)].map((filePath) => path.resolve(publicFolder, filePath.slice(1)));
110
+ const file = await locatePath(alternatives);
111
+ if (file === undefined) {
112
+ return false;
113
+ }
114
+ return `/${path.relative(publicFolder, file)}`;
115
+ };
116
+ const isEndpointExists = async function (endpoint, origin) {
117
+ const url = new URL(endpoint, origin);
118
+ try {
119
+ const res = await fetch(url, { method: 'HEAD' });
120
+ return res.status !== 404;
121
+ }
122
+ catch (e) {
123
+ return false;
124
+ }
125
+ };
126
+ // @ts-expect-error TS(7006) FIXME: Parameter 'match' implicitly has an 'any' type.
127
+ const isExternal = function (match) {
128
+ return match.to && match.to.match(/^https?:\/\//);
129
+ };
130
+ // @ts-expect-error TS(7031) FIXME: Binding element 'hash' implicitly has an 'any' typ... Remove this comment to see the full error message
131
+ const stripOrigin = function ({ hash, pathname, search }) {
132
+ return `${pathname}${search}${hash}`;
133
+ };
134
+ const proxyToExternalUrl = function ({ dest, destURL, req, res, }) {
135
+ const handler = createProxyMiddleware({
136
+ target: dest.origin,
137
+ changeOrigin: true,
138
+ pathRewrite: () => destURL,
139
+ // hide logging
140
+ logLevel: 'warn',
141
+ ...(Buffer.isBuffer(req.originalBody) && { buffer: Readable.from(req.originalBody) }),
142
+ });
143
+ // @ts-expect-error TS(2345) FIXME: Argument of type 'Request' is not assignable to parameter of type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
144
+ return handler(req, res, () => { });
145
+ };
146
+ // @ts-expect-error TS(7031) FIXME: Binding element 'addonUrl' implicitly has an 'any'... Remove this comment to see the full error message
147
+ const handleAddonUrl = function ({ addonUrl, req, res }) {
148
+ const dest = new URL(addonUrl);
149
+ const destURL = stripOrigin(dest);
150
+ return proxyToExternalUrl({ req, res, dest, destURL });
151
+ };
152
+ // @ts-expect-error TS(7006) FIXME: Parameter 'match' implicitly has an 'any' type.
153
+ const isRedirect = function (match) {
154
+ return match.status && match.status >= 300 && match.status <= 400;
155
+ };
156
+ // @ts-expect-error TS(7006) FIXME: Parameter 'publicFolder' implicitly has an 'any' t... Remove this comment to see the full error message
157
+ const render404 = async function (publicFolder) {
158
+ const maybe404Page = path.resolve(publicFolder, '404.html');
159
+ try {
160
+ const isFile = await isFileAsync(maybe404Page);
161
+ if (isFile)
162
+ return await readFile(maybe404Page, 'utf-8');
163
+ }
164
+ catch (error) {
165
+ // @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
166
+ console.warn(NETLIFYDEVWARN, 'Error while serving 404.html file', error.message);
167
+ }
168
+ return 'Not Found';
169
+ };
170
+ // Used as an optimization to avoid dual lookups for missing assets
171
+ const assetExtensionRegExp = /\.(html?|png|jpg|js|css|svg|gif|ico|woff|woff2)$/;
172
+ // @ts-expect-error TS(7006) FIXME: Parameter 'url' implicitly has an 'any' type.
173
+ const alternativePathsFor = function (url) {
174
+ if (isFunction(true, url)) {
175
+ return [];
176
+ }
177
+ const paths = [];
178
+ if (url[url.length - 1] === '/') {
179
+ const end = url.length - 1;
180
+ if (url !== '/') {
181
+ paths.push(`${url.slice(0, end)}.html`, `${url.slice(0, end)}.htm`);
182
+ }
183
+ paths.push(`${url}index.html`, `${url}index.htm`);
184
+ }
185
+ else if (!assetExtensionRegExp.test(url)) {
186
+ paths.push(`${url}.html`, `${url}.htm`, `${url}/index.html`, `${url}/index.htm`);
187
+ }
188
+ return paths;
189
+ };
190
+ const notifyActivity = throttle((api, siteId, devServerId) => {
191
+ // eslint-disable-next-line promise/prefer-await-to-callbacks, promise/prefer-await-to-then
192
+ api.markDevServerActivity({ siteId, devServerId }).catch((error) => {
193
+ console.error(`${NETLIFYDEVWARN} Failed to notify activity`, error);
194
+ });
195
+ }, 30 * 1000);
196
+ const serveRedirect = async function ({ env, functionsRegistry, imageProxy, match, options, proxy, req, res, siteInfo, }) {
197
+ if (!match)
198
+ return proxy.web(req, res, options);
199
+ options = options || req.proxyOptions || {};
200
+ options.match = null;
201
+ if (match.force404) {
202
+ res.writeHead(404);
203
+ res.end(await render404(options.publicFolder));
204
+ return;
205
+ }
206
+ if (match.proxyHeaders && Object.keys(match.proxyHeaders).length >= 0) {
207
+ Object.entries(match.proxyHeaders).forEach(([key, value]) => {
208
+ req.headers[key] = value;
209
+ });
210
+ }
211
+ if (match.signingSecret) {
212
+ const signingSecretVar = env[match.signingSecret];
213
+ if (signingSecretVar) {
214
+ req.headers['x-nf-sign'] = signRedirect({
215
+ deployContext: 'dev',
216
+ secret: signingSecretVar.value,
217
+ siteID: siteInfo.id,
218
+ siteURL: siteInfo.url,
219
+ });
220
+ }
221
+ else {
222
+ log(NETLIFYDEVWARN, `Could not sign redirect because environment variable ${chalk.yellow(match.signingSecret)} is not set`);
223
+ }
224
+ }
225
+ if (isFunction(options.functionsPort, req.url)) {
226
+ return proxy.web(req, res, { target: options.functionsServer });
227
+ }
228
+ const urlForAddons = getAddonUrl(options.addonsUrls, req);
229
+ if (urlForAddons) {
230
+ return handleAddonUrl({ req, res, addonUrl: urlForAddons });
231
+ }
232
+ const originalURL = req.url;
233
+ if (match.exceptions && match.exceptions.JWT) {
234
+ // Some values of JWT can start with :, so, make sure to normalize them
235
+ const expectedRoles = new Set(match.exceptions.JWT.split(',').map((value) => (value.startsWith(':') ? value.slice(1) : value)));
236
+ const cookieValues = cookie.parse(req.headers.cookie || '');
237
+ const token = cookieValues.nf_jwt;
238
+ // Serve not found by default
239
+ req.url = '/.netlify/non-existent-path';
240
+ if (token) {
241
+ let jwtValue = {};
242
+ try {
243
+ jwtValue = jwtDecode(token) || {};
244
+ }
245
+ catch (error) {
246
+ // @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
247
+ console.warn(NETLIFYDEVWARN, 'Error while decoding JWT provided in request', error.message);
248
+ res.writeHead(400);
249
+ res.end('Invalid JWT provided. Please see logs for more info.');
250
+ return;
251
+ }
252
+ // @ts-expect-error TS(2339) FIXME: Property 'exp' does not exist on type '{}'.
253
+ if ((jwtValue.exp || 0) < Math.round(Date.now() / MILLISEC_TO_SEC)) {
254
+ console.warn(NETLIFYDEVWARN, 'Expired JWT provided in request', req.url);
255
+ }
256
+ else {
257
+ const presentedRoles = getProperty(jwtValue, options.jwtRolePath) || [];
258
+ if (!Array.isArray(presentedRoles)) {
259
+ console.warn(NETLIFYDEVWARN, `Invalid roles value provided in JWT ${options.jwtRolePath}`, presentedRoles);
260
+ res.writeHead(400);
261
+ res.end('Invalid JWT provided. Please see logs for more info.');
262
+ return;
263
+ }
264
+ // Restore the URL if everything is correct
265
+ if (presentedRoles.some((pr) => expectedRoles.has(pr))) {
266
+ req.url = originalURL;
267
+ }
268
+ }
269
+ }
270
+ }
271
+ const reqUrl = reqToURL(req, req.url);
272
+ const isHiddenProxy = match.proxyHeaders &&
273
+ Object.entries(match.proxyHeaders).some(([key, val]) => key.toLowerCase() === 'x-nf-hidden-proxy' && val === 'true');
274
+ const staticFile = await getStatic(decodeURIComponent(reqUrl.pathname), options.publicFolder);
275
+ const endpointExists = !staticFile &&
276
+ !isHiddenProxy &&
277
+ process.env.NETLIFY_DEV_SERVER_CHECK_SSG_ENDPOINTS &&
278
+ (await isEndpointExists(decodeURIComponent(reqUrl.pathname), options.target));
279
+ if (staticFile || endpointExists) {
280
+ const pathname = staticFile || reqUrl.pathname;
281
+ req.url = encodeURI(pathname) + reqUrl.search;
282
+ // if there is an existing static file and it is not a forced redirect, return the file
283
+ if (!match.force) {
284
+ return proxy.web(req, res, { ...options, staticFile });
285
+ }
286
+ }
287
+ if (match.force || !staticFile || !options.framework || req.method === 'POST') {
288
+ // construct destination URL from redirect rule match
289
+ const dest = new URL(match.to, `${reqUrl.protocol}//${reqUrl.host}`);
290
+ // We pass through request params if the redirect rule
291
+ // doesn't have any query params
292
+ if ([...dest.searchParams].length === 0) {
293
+ dest.searchParams.forEach((_, key) => {
294
+ dest.searchParams.delete(key);
295
+ });
296
+ const requestParams = new URLSearchParams(reqUrl.searchParams);
297
+ requestParams.forEach((val, key) => {
298
+ dest.searchParams.append(key, val);
299
+ });
300
+ }
301
+ let destURL = stripOrigin(dest);
302
+ if (isExternal(match)) {
303
+ if (isRedirect(match)) {
304
+ // This is a redirect, so we set the complete external URL as destination
305
+ destURL = `${dest}`;
306
+ }
307
+ else {
308
+ if (!isHiddenProxy) {
309
+ console.log(`${NETLIFYDEVLOG} Proxying to ${dest}`);
310
+ }
311
+ return proxyToExternalUrl({ req, res, dest, destURL });
312
+ }
313
+ }
314
+ if (isRedirect(match)) {
315
+ console.log(`${NETLIFYDEVLOG} Redirecting ${req.url} to ${destURL}`);
316
+ res.writeHead(match.status, {
317
+ Location: destURL,
318
+ 'Cache-Control': 'no-cache',
319
+ });
320
+ res.end(`Redirecting to ${destURL}`);
321
+ return;
322
+ }
323
+ const ct = req.headers['content-type'] ? contentType.parse(req).type : '';
324
+ if (req.method === 'POST' &&
325
+ !isInternal(req.url) &&
326
+ !isInternal(destURL) &&
327
+ (ct.endsWith('/x-www-form-urlencoded') || ct === 'multipart/form-data')) {
328
+ return proxy.web(req, res, { target: options.functionsServer });
329
+ }
330
+ const destStaticFile = await getStatic(dest.pathname, options.publicFolder);
331
+ const matchingFunction = functionsRegistry &&
332
+ (await functionsRegistry.getFunctionForURLPath(destURL, req.method, () => Boolean(destStaticFile)));
333
+ let statusValue;
334
+ if (match.force ||
335
+ (!staticFile && ((!options.framework && destStaticFile) || isInternal(destURL) || matchingFunction))) {
336
+ req.url = destStaticFile ? destStaticFile + dest.search : destURL;
337
+ const { status } = match;
338
+ statusValue = status;
339
+ console.log(`${NETLIFYDEVLOG} Rewrote URL to`, req.url);
340
+ }
341
+ if (matchingFunction) {
342
+ const functionHeaders = matchingFunction.func
343
+ ? {
344
+ [NFFunctionName]: matchingFunction.func?.name,
345
+ [NFFunctionRoute]: matchingFunction.route,
346
+ }
347
+ : {};
348
+ const url = reqToURL(req, originalURL);
349
+ req.headers['x-netlify-original-pathname'] = url.pathname;
350
+ req.headers['x-netlify-original-search'] = url.search;
351
+ return proxy.web(req, res, { headers: functionHeaders, target: options.functionsServer });
352
+ }
353
+ if (isImageRequest(req)) {
354
+ return imageProxy(req, res);
355
+ }
356
+ const addonUrl = getAddonUrl(options.addonsUrls, req);
357
+ if (addonUrl) {
358
+ return handleAddonUrl({ req, res, addonUrl });
359
+ }
360
+ return proxy.web(req, res, { ...options, status: statusValue });
361
+ }
362
+ return proxy.web(req, res, options);
363
+ };
364
+ // @ts-expect-error TS(7006) FIXME: Parameter 'req' implicitly has an 'any' type.
365
+ const reqToURL = function (req, pathname) {
366
+ return new URL(pathname, `${req.protocol || (req.headers.scheme && `${req.headers.scheme}:`) || 'http:'}//${req.headers.host || req.hostname}`);
367
+ };
368
+ const MILLISEC_TO_SEC = 1e3;
369
+ const initializeProxy = async function ({ config, configPath, distDir, env, host, imageProxy, port, projectDir, siteInfo, }) {
370
+ const proxy = httpProxy.createProxyServer({
371
+ selfHandleResponse: true,
372
+ target: {
373
+ host,
374
+ port,
375
+ },
376
+ });
377
+ const headersFiles = [...new Set([path.resolve(projectDir, '_headers'), path.resolve(distDir, '_headers')])];
378
+ let headers = await parseHeaders({ headersFiles, configPath, config });
379
+ const watchedHeadersFiles = configPath === undefined ? headersFiles : [...headersFiles, configPath];
380
+ onChanges(watchedHeadersFiles, async () => {
381
+ const existingHeadersFiles = await pFilter(watchedHeadersFiles, fileExistsAsync);
382
+ console.log(`${NETLIFYDEVLOG} Reloading headers files from`, existingHeadersFiles.map((headerFile) => path.relative(projectDir, headerFile)));
383
+ headers = await parseHeaders({ headersFiles, configPath, config });
384
+ });
385
+ // @ts-expect-error TS(2339) FIXME: Property 'before' does not exist on type 'Server'.
386
+ proxy.before('web', 'stream', (req) => {
387
+ // See https://github.com/http-party/node-http-proxy/issues/1219#issuecomment-511110375
388
+ if (req.headers.expect) {
389
+ req.__expectHeader = req.headers.expect;
390
+ delete req.headers.expect;
391
+ }
392
+ });
393
+ proxy.on('error', (err, req, res, proxyUrl) => {
394
+ // @ts-expect-error TS(2339) FIXME: Property 'proxyOptions' does not exist on type 'In... Remove this comment to see the full error message
395
+ const options = req.proxyOptions;
396
+ const isConRefused = 'code' in err && err.code === 'ECONNREFUSED';
397
+ if (options?.detectTarget && !(res instanceof Socket) && isConRefused && proxyUrl) {
398
+ // got econnrefused while detectTarget set to true -> try to switch between current ipVer and other (4 to 6 and vice versa)
399
+ // proxyUrl is parsed in http-proxy using url, parsing the same here. Difference between it and
400
+ // URL that hostname not includes [] symbols when using url.parse
401
+ // eslint-disable-next-line n/no-deprecated-api
402
+ const targetUrl = typeof proxyUrl === 'string' ? url.parse(proxyUrl) : proxyUrl;
403
+ const isCurrentHost = targetUrl.hostname === options.targetHostname;
404
+ if (targetUrl.hostname && isCurrentHost) {
405
+ const newHost = isIPv6(targetUrl.hostname) ? '127.0.0.1' : '::1';
406
+ options.target = `http://${isIPv6(newHost) ? `[${newHost}]` : newHost}:${targetUrl.port}`;
407
+ options.targetHostname = newHost;
408
+ options.isChangingTarget = true;
409
+ return proxy.web(req, res, options);
410
+ }
411
+ }
412
+ if (res instanceof http.ServerResponse) {
413
+ res.writeHead(500, {
414
+ 'Content-Type': 'text/plain',
415
+ });
416
+ }
417
+ const message = isEdgeFunctionsRequest(req)
418
+ ? 'There was an error with an Edge Function. Please check the terminal for more details.'
419
+ : 'Could not proxy request.';
420
+ res.end(message);
421
+ });
422
+ proxy.on('proxyReq', (proxyReq, req) => {
423
+ const requestID = generateRequestID();
424
+ proxyReq.setHeader(NFRequestID, requestID);
425
+ req.headers[NFRequestID] = requestID;
426
+ if (isEdgeFunctionsRequest(req)) {
427
+ handleProxyRequest(req, proxyReq);
428
+ }
429
+ // @ts-expect-error TS(2339) FIXME: Property '__expectHeader' does not exist on type '... Remove this comment to see the full error message
430
+ if (req.__expectHeader) {
431
+ // @ts-expect-error TS(2339) FIXME: Property '__expectHeader' does not exist on type '... Remove this comment to see the full error message
432
+ proxyReq.setHeader('Expect', req.__expectHeader);
433
+ }
434
+ // @ts-expect-error TS(2339) FIXME: Property 'originalBody' does not exist on type 'In... Remove this comment to see the full error message
435
+ if (req.originalBody) {
436
+ // @ts-expect-error TS(2339) FIXME: Property 'originalBody' does not exist on type 'In... Remove this comment to see the full error message
437
+ proxyReq.write(req.originalBody);
438
+ }
439
+ });
440
+ proxy.on('proxyRes', (proxyRes, req, res) => {
441
+ res.setHeader('server', 'Netlify');
442
+ const requestID = req.headers[NFRequestID];
443
+ if (requestID) {
444
+ res.setHeader(NFRequestID, requestID);
445
+ }
446
+ // @ts-expect-error TS(2339) FIXME: Property 'proxyOptions' does not exist on type 'In... Remove this comment to see the full error message
447
+ const options = req.proxyOptions;
448
+ if (options.isChangingTarget) {
449
+ // got a response after switching the ipVer for host (and its not an error since we will be in on('error') handler) - let's remember this host now
450
+ // options are not exported in ts for the proxy:
451
+ // @ts-expect-error TS(2339) FIXME: Property 'options' does not exist on type 'In...
452
+ proxy.options.target.host = options.targetHostname;
453
+ options.changeSettings?.({
454
+ frameworkHost: options.targetHostname,
455
+ detectFrameworkHost: false,
456
+ });
457
+ console.log(`${NETLIFYDEVLOG} Switched host to ${options.targetHostname}`);
458
+ }
459
+ if (proxyRes.statusCode === 404 || proxyRes.statusCode === 403) {
460
+ // If a request for `/path` has failed, we'll a few variations like
461
+ // `/path/index.html` to mimic the CDN behavior.
462
+ // @ts-expect-error TS(2339) FIXME: Property 'alternativePaths' does not exist on type... Remove this comment to see the full error message
463
+ if (req.alternativePaths && req.alternativePaths.length !== 0) {
464
+ // @ts-expect-error TS(2339) FIXME: Property 'alternativePaths' does not exist on type... Remove this comment to see the full error message
465
+ req.url = req.alternativePaths.shift();
466
+ // @ts-expect-error TS(2339) FIXME: Property 'proxyOptions' does not exist on type 'In... Remove this comment to see the full error message
467
+ return proxy.web(req, res, req.proxyOptions);
468
+ }
469
+ // The request has failed but we might still have a matching redirect
470
+ // rule (without `force`) that should kick in. This is how we mimic the
471
+ // file shadowing behavior from the CDN.
472
+ if (options && options.match) {
473
+ return serveRedirect({
474
+ // We don't want to match functions at this point because any redirects
475
+ // to functions will have already been processed, so we don't supply a
476
+ // functions registry to `serveRedirect`.
477
+ functionsRegistry: null,
478
+ req,
479
+ res,
480
+ proxy: handlers,
481
+ imageProxy,
482
+ match: options.match,
483
+ options,
484
+ siteInfo,
485
+ env,
486
+ });
487
+ }
488
+ }
489
+ if (options.staticFile && isRedirect({ status: proxyRes.statusCode }) && proxyRes.headers.location) {
490
+ req.url = proxyRes.headers.location;
491
+ return serveRedirect({
492
+ // We don't want to match functions at this point because any redirects
493
+ // to functions will have already been processed, so we don't supply a
494
+ // functions registry to `serveRedirect`.
495
+ functionsRegistry: null,
496
+ req,
497
+ res,
498
+ proxy: handlers,
499
+ imageProxy,
500
+ match: null,
501
+ options,
502
+ siteInfo,
503
+ env,
504
+ });
505
+ }
506
+ // @ts-expect-error TS(7034) FIXME: Variable 'responseData' implicitly has type 'any[]... Remove this comment to see the full error message
507
+ const responseData = [];
508
+ // @ts-expect-error TS(2345) FIXME: Argument of type 'string | undefined' is not assig... Remove this comment to see the full error message
509
+ const requestURL = new URL(req.url, `http://${req.headers.host || '127.0.0.1'}`);
510
+ const headersRules = headersForPath(headers, requestURL.pathname);
511
+ const htmlInjections = config.dev?.processing?.html?.injections &&
512
+ config.dev.processing.html.injections.length !== 0 &&
513
+ proxyRes.headers?.['content-type']?.startsWith('text/html')
514
+ ? config.dev.processing.html.injections
515
+ : undefined;
516
+ // for streamed responses, we can't do etag generation nor error templates.
517
+ // we'll just stream them through!
518
+ // when html_injections are present in dev config, we can't use streamed response
519
+ const isStreamedResponse = proxyRes.headers['content-length'] === undefined;
520
+ if (isStreamedResponse && !htmlInjections) {
521
+ Object.entries(headersRules).forEach(([key, val]) => {
522
+ // @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
523
+ res.setHeader(key, val);
524
+ });
525
+ res.writeHead(options.status || proxyRes.statusCode, proxyRes.headers);
526
+ proxyRes.on('data', function onData(data) {
527
+ res.write(data);
528
+ });
529
+ proxyRes.on('end', function onEnd() {
530
+ res.end();
531
+ });
532
+ return;
533
+ }
534
+ proxyRes.on('data', function onData(data) {
535
+ responseData.push(data);
536
+ });
537
+ proxyRes.on('end', async function onEnd() {
538
+ // @ts-expect-error TS(7005) FIXME: Variable 'responseData' implicitly has an 'any[]' ... Remove this comment to see the full error message
539
+ let responseBody = Buffer.concat(responseData);
540
+ let responseStatus = options.status || proxyRes.statusCode;
541
+ // `req[shouldGenerateETag]` may contain a function that determines
542
+ // whether the response should have an ETag header.
543
+ if (
544
+ // @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
545
+ typeof req[shouldGenerateETag] === 'function' &&
546
+ // @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
547
+ req[shouldGenerateETag]({ statusCode: responseStatus }) === true) {
548
+ const etag = generateETag(responseBody, { weak: true });
549
+ if (req.headers['if-none-match'] === etag) {
550
+ responseStatus = 304;
551
+ }
552
+ res.setHeader('etag', etag);
553
+ }
554
+ Object.entries(headersRules).forEach(([key, val]) => {
555
+ // @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
556
+ res.setHeader(key, val);
557
+ });
558
+ const isUncaughtError = proxyRes.headers['x-nf-uncaught-error'] === '1';
559
+ if (isEdgeFunctionsRequest(req) && isUncaughtError) {
560
+ const acceptsHtml = req.headers && req.headers.accept && req.headers.accept.includes('text/html');
561
+ const decompressedBody = await decompressResponseBody(responseBody, proxyRes.headers['content-encoding']);
562
+ const formattedBody = formatEdgeFunctionError(decompressedBody, acceptsHtml);
563
+ const errorResponse = acceptsHtml
564
+ ? await renderErrorTemplate(formattedBody, '../../src/lib/templates/function-error.html', 'edge function')
565
+ : formattedBody;
566
+ const contentLength = Buffer.from(errorResponse, 'utf8').byteLength;
567
+ res.setHeader('content-length', contentLength);
568
+ res.statusCode = 500;
569
+ res.write(errorResponse);
570
+ return res.end();
571
+ }
572
+ let proxyResHeaders = proxyRes.headers;
573
+ if (htmlInjections) {
574
+ responseBody = await injectHtml(responseBody, proxyRes, htmlInjections);
575
+ proxyResHeaders = {
576
+ ...proxyResHeaders,
577
+ 'content-length': String(responseBody.byteLength),
578
+ };
579
+ delete proxyResHeaders['transfer-encoding'];
580
+ }
581
+ res.writeHead(responseStatus, proxyResHeaders);
582
+ if (responseStatus !== 304) {
583
+ res.write(responseBody);
584
+ }
585
+ res.end();
586
+ });
587
+ });
588
+ const handlers = {
589
+ // @ts-expect-error TS(7006) FIXME: Parameter 'req' implicitly has an 'any' type.
590
+ web: (req, res, options) => {
591
+ const requestURL = new URL(req.url, 'http://127.0.0.1');
592
+ req.proxyOptions = options;
593
+ req.alternativePaths = alternativePathsFor(requestURL.pathname).map((filePath) => filePath + requestURL.search);
594
+ // Ref: https://nodejs.org/api/net.html#net_socket_remoteaddress
595
+ req.headers['x-forwarded-for'] = req.connection.remoteAddress || '';
596
+ return proxy.web(req, res, options);
597
+ },
598
+ // @ts-expect-error TS(7006) FIXME: Parameter 'req' implicitly has an 'any' type.
599
+ ws: (req, socket, head, options) => proxy.ws(req, socket, head, options),
600
+ };
601
+ return handlers;
602
+ };
603
+ const onRequest = async ({ addonsUrls, api, edgeFunctionsProxy, env, functionsRegistry, functionsServer, imageProxy, proxy, rewriter, settings, siteInfo, }, req, res) => {
604
+ req.originalBody =
605
+ req.method && ['GET', 'OPTIONS', 'HEAD'].includes(req.method) ? null : await createStreamPromise(req, BYTES_LIMIT);
606
+ if (isImageRequest(req)) {
607
+ return imageProxy(req, res);
608
+ }
609
+ const edgeFunctionsProxyURL = await edgeFunctionsProxy?.(req);
610
+ if (edgeFunctionsProxyURL !== undefined) {
611
+ return proxy.web(req, res, { target: edgeFunctionsProxyURL });
612
+ }
613
+ const functionMatch = functionsRegistry &&
614
+ (await functionsRegistry.getFunctionForURLPath(req.url, req.method, () => getStatic(decodeURIComponent(reqToURL(req, req.url).pathname), settings.dist ?? '')));
615
+ if (functionMatch) {
616
+ // Setting an internal header with the function name so that we don't
617
+ // have to match the URL again in the functions server.
618
+ /** @type {Record<string, string>} */
619
+ const headers = {};
620
+ if (functionMatch.func) {
621
+ // @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
622
+ headers[NFFunctionName] = functionMatch.func.name;
623
+ }
624
+ if (functionMatch.route) {
625
+ // @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message
626
+ headers[NFFunctionRoute] = functionMatch.route.pattern;
627
+ }
628
+ return proxy.web(req, res, { headers, target: functionsServer });
629
+ }
630
+ const addonUrl = getAddonUrl(addonsUrls, req);
631
+ if (addonUrl) {
632
+ return handleAddonUrl({ req, res, addonUrl });
633
+ }
634
+ const match = await rewriter(req);
635
+ const options = {
636
+ match,
637
+ addonsUrls,
638
+ target: `http://${settings.frameworkHost && isIPv6(settings.frameworkHost) ? `[${settings.frameworkHost}]` : settings.frameworkHost}:${settings.frameworkPort}`,
639
+ detectTarget: settings.detectFrameworkHost,
640
+ targetHostname: settings.frameworkHost,
641
+ publicFolder: settings.dist,
642
+ functionsServer,
643
+ functionsPort: settings.functionsPort,
644
+ jwtRolePath: settings.jwtRolePath,
645
+ framework: settings.framework,
646
+ changeSettings(newSettings) {
647
+ Object.assign(settings, newSettings);
648
+ },
649
+ };
650
+ if (match) {
651
+ // We don't want to generate an ETag for 3xx redirects.
652
+ // @ts-expect-error TS(7031) FIXME: Binding element 'statusCode' implicitly has an 'an... Remove this comment to see the full error message
653
+ req[shouldGenerateETag] = ({ statusCode }) => statusCode < 300 || statusCode >= 400;
654
+ return serveRedirect({ req, res, proxy, imageProxy, match, options, siteInfo, env, functionsRegistry });
655
+ }
656
+ // The request will be served by the framework server, which means we want to
657
+ // generate an ETag unless we're rendering an error page. The only way for
658
+ // us to know that is by looking at the status code
659
+ // @ts-expect-error TS(7031) FIXME: Binding element 'statusCode' implicitly has an 'an... Remove this comment to see the full error message
660
+ req[shouldGenerateETag] = ({ statusCode }) => statusCode >= 200 && statusCode < 300;
661
+ const hasFormSubmissionHandler = functionsRegistry && getFormHandler({ functionsRegistry, logWarning: false });
662
+ const ct = req.headers['content-type'] ? contentType.parse(req).type : '';
663
+ if (hasFormSubmissionHandler &&
664
+ functionsServer &&
665
+ req.method === 'POST' &&
666
+ !isInternal(req.url) &&
667
+ (ct.endsWith('/x-www-form-urlencoded') || ct === 'multipart/form-data')) {
668
+ return proxy.web(req, res, { target: functionsServer });
669
+ }
670
+ if (req.method === 'GET' && api && process.env.NETLIFY_DEV_SERVER_ID) {
671
+ notifyActivity(api, siteInfo.id, process.env.NETLIFY_DEV_SERVER_ID);
672
+ }
673
+ proxy.web(req, res, options);
674
+ };
675
+ export const getProxyUrl = function (settings) {
676
+ const scheme = settings.https ? 'https' : 'http';
677
+ return `${scheme}://localhost:${settings.port}`;
678
+ };
679
+ export const startProxy = async function ({ accountId, addonsUrls, api, blobsContext, command, config, configPath, debug, disableEdgeFunctions, env, functionsRegistry, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, offline, projectDir, repositoryRoot, settings, siteInfo, state, }) {
680
+ const secondaryServerPort = settings.https ? await getAvailablePort() : null;
681
+ const functionsServer = settings.functionsPort ? `http://127.0.0.1:${settings.functionsPort}` : null;
682
+ let edgeFunctionsProxy;
683
+ if (disableEdgeFunctions) {
684
+ log(NETLIFYDEVWARN, 'Edge functions are disabled. Run without the --internal-disable-edge-functions flag to enable them.');
685
+ }
686
+ else {
687
+ edgeFunctionsProxy = await initializeEdgeFunctionsProxy({
688
+ command,
689
+ blobsContext,
690
+ config,
691
+ configPath,
692
+ debug,
693
+ env,
694
+ geolocationMode,
695
+ geoCountry,
696
+ getUpdatedConfig,
697
+ inspectSettings,
698
+ mainPort: settings.port,
699
+ offline,
700
+ passthroughPort: secondaryServerPort || settings.port,
701
+ settings,
702
+ projectDir,
703
+ repositoryRoot,
704
+ siteInfo,
705
+ accountId,
706
+ state,
707
+ });
708
+ }
709
+ const imageProxy = await initializeImageProxy({
710
+ config,
711
+ settings,
712
+ });
713
+ const proxy = await initializeProxy({
714
+ env,
715
+ host: settings.frameworkHost,
716
+ port: settings.frameworkPort,
717
+ distDir: settings.dist,
718
+ projectDir,
719
+ configPath,
720
+ siteInfo,
721
+ imageProxy,
722
+ config,
723
+ });
724
+ const rewriter = await createRewriter({
725
+ config,
726
+ distDir: settings.dist,
727
+ projectDir,
728
+ jwtSecret: settings.jwtSecret,
729
+ jwtRoleClaim: settings.jwtRolePath,
730
+ configPath,
731
+ geoCountry,
732
+ });
733
+ const onRequestWithOptions = onRequest.bind(undefined, {
734
+ proxy,
735
+ rewriter,
736
+ settings,
737
+ addonsUrls,
738
+ functionsRegistry,
739
+ functionsServer,
740
+ edgeFunctionsProxy,
741
+ imageProxy,
742
+ siteInfo,
743
+ env,
744
+ api,
745
+ });
746
+ const primaryServer = settings.https
747
+ ? https.createServer({ cert: settings.https.cert, key: settings.https.key }, onRequestWithOptions)
748
+ : http.createServer(onRequestWithOptions);
749
+ const onUpgrade = async function onUpgrade(req, socket, head) {
750
+ const match = await rewriter(req);
751
+ if (match && !match.force404 && isExternal(match)) {
752
+ const reqUrl = reqToURL(req, req.url);
753
+ const dest = new URL(match.to, `${reqUrl.protocol}//${reqUrl.host}`);
754
+ const destURL = stripOrigin(dest);
755
+ return proxy.ws(req, socket, head, { target: dest.origin, changeOrigin: true, pathRewrite: () => destURL });
756
+ }
757
+ return proxy.ws(req, socket, head, {});
758
+ };
759
+ primaryServer.on('upgrade', onUpgrade);
760
+ primaryServer.listen({ port: settings.port });
761
+ const eventQueue = [once(primaryServer, 'listening')];
762
+ // If we're running the main server on HTTPS, we need to start a secondary
763
+ // server on HTTP for receiving passthrough requests from edge functions.
764
+ // This lets us run the Deno server on HTTP and avoid the complications of
765
+ // Deno talking to Node on HTTPS with potentially untrusted certificates.
766
+ if (secondaryServerPort) {
767
+ const secondaryServer = http.createServer(onRequestWithOptions);
768
+ secondaryServer.on('upgrade', onUpgrade);
769
+ secondaryServer.listen({ port: secondaryServerPort });
770
+ eventQueue.push(once(secondaryServer, 'listening'));
771
+ }
772
+ await Promise.all(eventQueue);
773
+ return getProxyUrl(settings);
774
+ };
775
+ const BYTES_LIMIT = 30;
776
+ //# sourceMappingURL=proxy.js.map