@depup/netlify-cli 24.3.0-depup.0

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