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