netlify-cli 19.1.0 → 19.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +40 -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 +85 -0
- package/dist/commands/base-command.d.ts.map +1 -0
- package/dist/commands/base-command.js +602 -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 +37 -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 +75 -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 +14 -0
- package/dist/commands/build/index.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 +69 -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 +720 -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 +107 -0
- package/dist/commands/deploy/index.js.map +1 -0
- package/dist/commands/dev/dev-exec.d.ts +5 -0
- package/dist/commands/dev/dev-exec.d.ts.map +1 -0
- package/dist/commands/dev/dev-exec.js +21 -0
- package/dist/commands/dev/dev-exec.js.map +1 -0
- package/dist/commands/dev/dev.d.ts +5 -0
- package/dist/commands/dev/dev.d.ts.map +1 -0
- package/dist/commands/dev/dev.js +249 -0
- package/dist/commands/dev/dev.js.map +1 -0
- package/dist/commands/dev/index.d.ts +2 -0
- package/dist/commands/dev/index.d.ts.map +1 -0
- package/dist/commands/dev/index.js +2 -0
- package/dist/commands/dev/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 +83 -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 +28 -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 +123 -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 +129 -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 +27 -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 +635 -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 +41 -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 +52 -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 +101 -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 +10 -0
- package/dist/commands/init/index.js.map +1 -0
- package/dist/commands/init/init.d.ts +4 -0
- package/dist/commands/init/init.d.ts.map +1 -0
- package/dist/commands/init/init.js +194 -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 +12 -0
- package/dist/commands/link/index.js.map +1 -0
- package/dist/commands/link/link.d.ts +4 -0
- package/dist/commands/link/link.d.ts.map +1 -0
- package/dist/commands/link/link.js +295 -0
- package/dist/commands/link/link.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 +10 -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 +38 -0
- package/dist/commands/main.d.ts.map +1 -0
- package/dist/commands/main.js +215 -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 +4 -0
- package/dist/commands/open/open-admin.d.ts.map +1 -0
- package/dist/commands/open/open-admin.js +12 -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 +13 -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 +52 -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 +26 -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 +230 -0
- package/dist/commands/sites/sites-create-template.js.map +1 -0
- package/dist/commands/sites/sites-create.d.ts +7 -0
- package/dist/commands/sites/sites-create.d.ts.map +1 -0
- package/dist/commands/sites/sites-create.js +125 -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 +77 -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 +29 -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 +78 -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 +8 -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 +4 -0
- package/dist/commands/watch/watch.d.ts.map +1 -0
- package/dist/commands/watch/watch.js +90 -0
- package/dist/commands/watch/watch.js.map +1 -0
- package/dist/lib/account.d.ts +6 -0
- package/dist/lib/account.d.ts.map +1 -0
- package/dist/lib/account.js +14 -0
- package/dist/lib/account.js.map +1 -0
- package/dist/lib/api.d.ts +10 -0
- package/dist/lib/api.d.ts.map +1 -0
- package/dist/lib/api.js +25 -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 +43 -0
- package/dist/lib/build.d.ts.map +1 -0
- package/dist/lib/build.js +73 -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 +45 -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 +39 -0
- package/dist/lib/edge-functions/proxy.d.ts.map +1 -0
- package/dist/lib/edge-functions/proxy.js +156 -0
- package/dist/lib/edge-functions/proxy.js.map +1 -0
- package/dist/lib/edge-functions/registry.d.ts +107 -0
- package/dist/lib/edge-functions/registry.d.ts.map +1 -0
- package/dist/lib/edge-functions/registry.js +451 -0
- package/dist/lib/edge-functions/registry.js.map +1 -0
- package/dist/lib/exec-fetcher.d.ts +31 -0
- package/dist/lib/exec-fetcher.d.ts.map +1 -0
- package/dist/lib/exec-fetcher.js +132 -0
- package/dist/lib/exec-fetcher.js.map +1 -0
- package/dist/lib/fs.d.ts +12 -0
- package/dist/lib/fs.d.ts.map +1 -0
- package/dist/lib/fs.js +45 -0
- package/dist/lib/fs.js.map +1 -0
- package/dist/lib/functions/background.d.ts +3 -0
- package/dist/lib/functions/background.d.ts.map +1 -0
- package/dist/lib/functions/background.js +19 -0
- package/dist/lib/functions/background.js.map +1 -0
- package/dist/lib/functions/config.d.ts +6 -0
- package/dist/lib/functions/config.d.ts.map +1 -0
- package/dist/lib/functions/config.js +25 -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 +144 -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 +40 -0
- package/dist/lib/functions/local-proxy.js.map +1 -0
- package/dist/lib/functions/memoized-build.d.ts +6 -0
- package/dist/lib/functions/memoized-build.d.ts.map +1 -0
- package/dist/lib/functions/memoized-build.js +30 -0
- package/dist/lib/functions/memoized-build.js.map +1 -0
- package/dist/lib/functions/netlify-function.d.ts +71 -0
- package/dist/lib/functions/netlify-function.d.ts.map +1 -0
- package/dist/lib/functions/netlify-function.js +266 -0
- package/dist/lib/functions/netlify-function.js.map +1 -0
- package/dist/lib/functions/registry.d.ts +106 -0
- package/dist/lib/functions/registry.d.ts.map +1 -0
- package/dist/lib/functions/registry.js +485 -0
- package/dist/lib/functions/registry.js.map +1 -0
- package/dist/lib/functions/runtimes/go/index.d.ts +25 -0
- package/dist/lib/functions/runtimes/go/index.d.ts.map +1 -0
- package/dist/lib/functions/runtimes/go/index.js +68 -0
- package/dist/lib/functions/runtimes/go/index.js.map +1 -0
- package/dist/lib/functions/runtimes/index.d.ts +42 -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/netlify-lambda.d.ts +19 -0
- package/dist/lib/functions/runtimes/js/builders/netlify-lambda.d.ts.map +1 -0
- package/dist/lib/functions/runtimes/js/builders/netlify-lambda.js +62 -0
- package/dist/lib/functions/runtimes/js/builders/netlify-lambda.js.map +1 -0
- package/dist/lib/functions/runtimes/js/builders/zisi.d.ts +46 -0
- package/dist/lib/functions/runtimes/js/builders/zisi.d.ts.map +1 -0
- package/dist/lib/functions/runtimes/js/builders/zisi.js +184 -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 +25 -0
- package/dist/lib/functions/runtimes/js/index.d.ts.map +1 -0
- package/dist/lib/functions/runtimes/js/index.js +112 -0
- package/dist/lib/functions/runtimes/js/index.js.map +1 -0
- package/dist/lib/functions/runtimes/js/worker.d.ts +2 -0
- package/dist/lib/functions/runtimes/js/worker.d.ts.map +1 -0
- package/dist/lib/functions/runtimes/js/worker.js +53 -0
- package/dist/lib/functions/runtimes/js/worker.js.map +1 -0
- package/dist/lib/functions/runtimes/rust/index.d.ts +25 -0
- package/dist/lib/functions/runtimes/rust/index.d.ts.map +1 -0
- package/dist/lib/functions/runtimes/rust/index.js +69 -0
- package/dist/lib/functions/runtimes/rust/index.js.map +1 -0
- package/dist/lib/functions/scheduled.d.ts +17 -0
- package/dist/lib/functions/scheduled.d.ts.map +1 -0
- package/dist/lib/functions/scheduled.js +81 -0
- package/dist/lib/functions/scheduled.js.map +1 -0
- package/dist/lib/functions/server.d.ts +31 -0
- package/dist/lib/functions/server.d.ts.map +1 -0
- package/dist/lib/functions/server.js +303 -0
- package/dist/lib/functions/server.js.map +1 -0
- package/dist/lib/functions/synchronous.d.ts +8 -0
- package/dist/lib/functions/synchronous.d.ts.map +1 -0
- package/dist/lib/functions/synchronous.js +141 -0
- package/dist/lib/functions/synchronous.js.map +1 -0
- package/dist/lib/functions/utils.d.ts +11 -0
- package/dist/lib/functions/utils.d.ts.map +1 -0
- package/dist/lib/functions/utils.js +47 -0
- package/dist/lib/functions/utils.js.map +1 -0
- package/dist/lib/geo-location.d.ts +46 -0
- package/dist/lib/geo-location.d.ts.map +1 -0
- package/dist/lib/geo-location.js +108 -0
- package/dist/lib/geo-location.js.map +1 -0
- package/dist/lib/http-agent.d.ts +18 -0
- package/dist/lib/http-agent.d.ts.map +1 -0
- package/dist/lib/http-agent.js +97 -0
- package/dist/lib/http-agent.js.map +1 -0
- package/dist/lib/images/proxy.d.ts +34 -0
- package/dist/lib/images/proxy.d.ts.map +1 -0
- package/dist/lib/images/proxy.js +122 -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 +3 -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 +33 -0
- package/dist/recipes/ai-context/context.d.ts.map +1 -0
- package/dist/recipes/ai-context/context.js +101 -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 +86 -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 +77 -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 +91 -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/banner.d.ts +4 -0
- package/dist/utils/banner.d.ts.map +1 -0
- package/dist/utils/banner.js +12 -0
- package/dist/utils/banner.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 +124 -0
- package/dist/utils/build-info.js.map +1 -0
- package/dist/utils/command-helpers.d.ts +116 -0
- package/dist/utils/command-helpers.d.ts.map +1 -0
- package/dist/utils/command-helpers.js +264 -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 +75 -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 +24 -0
- package/dist/utils/deploy/deploy-site.d.ts.map +1 -0
- package/dist/utils/deploy/deploy-site.js +157 -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 +14 -0
- package/dist/utils/deploy/hash-files.d.ts.map +1 -0
- package/dist/utils/deploy/hash-files.js +31 -0
- package/dist/utils/deploy/hash-files.js.map +1 -0
- package/dist/utils/deploy/hash-fns.d.ts +17 -0
- package/dist/utils/deploy/hash-fns.d.ts.map +1 -0
- package/dist/utils/deploy/hash-fns.js +143 -0
- package/dist/utils/deploy/hash-fns.js.map +1 -0
- package/dist/utils/deploy/hasher-segments.d.ts +14 -0
- package/dist/utils/deploy/hasher-segments.d.ts.map +1 -0
- package/dist/utils/deploy/hasher-segments.js +69 -0
- package/dist/utils/deploy/hasher-segments.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 +113 -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 +94 -0
- package/dist/utils/deploy/util.js.map +1 -0
- package/dist/utils/detect-server-settings.d.ts +15 -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.d.ts +62 -0
- package/dist/utils/dev.d.ts.map +1 -0
- package/dist/utils/dev.js +197 -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 +100 -0
- package/dist/utils/env/index.d.ts.map +1 -0
- package/dist/utils/env/index.js +231 -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 +16 -0
- package/dist/utils/execa.js.map +1 -0
- package/dist/utils/feature-flags.d.ts +21 -0
- package/dist/utils/feature-flags.d.ts.map +1 -0
- package/dist/utils/feature-flags.js +25 -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 +61 -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 +35 -0
- package/dist/utils/functions/functions.d.ts.map +1 -0
- package/dist/utils/functions/functions.js +41 -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-global-config.d.ts +7 -0
- package/dist/utils/get-global-config.d.ts.map +1 -0
- package/dist/utils/get-global-config.js +41 -0
- package/dist/utils/get-global-config.js.map +1 -0
- package/dist/utils/get-package-json.d.ts +3 -0
- package/dist/utils/get-package-json.d.ts.map +1 -0
- package/dist/utils/get-package-json.js +16 -0
- package/dist/utils/get-package-json.js.map +1 -0
- package/dist/utils/get-repo-data.d.ts +31 -0
- package/dist/utils/get-repo-data.d.ts.map +1 -0
- package/dist/utils/get-repo-data.js +66 -0
- package/dist/utils/get-repo-data.js.map +1 -0
- package/dist/utils/get-site.d.ts +2 -0
- package/dist/utils/get-site.d.ts.map +1 -0
- package/dist/utils/get-site.js +22 -0
- package/dist/utils/get-site.js.map +1 -0
- package/dist/utils/gh-auth.d.ts +11 -0
- package/dist/utils/gh-auth.d.ts.map +1 -0
- package/dist/utils/gh-auth.js +105 -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 +21 -0
- package/dist/utils/headers.d.ts.map +1 -0
- package/dist/utils/headers.js +51 -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 +21 -0
- package/dist/utils/init/config-github.d.ts.map +1 -0
- package/dist/utils/init/config-github.js +247 -0
- package/dist/utils/init/config-github.js.map +1 -0
- package/dist/utils/init/config-manual.d.ts +12 -0
- package/dist/utils/init/config-manual.d.ts.map +1 -0
- package/dist/utils/init/config-manual.js +109 -0
- package/dist/utils/init/config-manual.js.map +1 -0
- package/dist/utils/init/config.d.ts +14 -0
- package/dist/utils/init/config.d.ts.map +1 -0
- package/dist/utils/init/config.js +38 -0
- package/dist/utils/init/config.js.map +1 -0
- package/dist/utils/init/plugins.d.ts +3 -0
- package/dist/utils/init/plugins.d.ts.map +1 -0
- package/dist/utils/init/plugins.js +13 -0
- package/dist/utils/init/plugins.js.map +1 -0
- package/dist/utils/init/utils.d.ts +54 -0
- package/dist/utils/init/utils.d.ts.map +1 -0
- package/dist/utils/init/utils.js +199 -0
- package/dist/utils/init/utils.js.map +1 -0
- package/dist/utils/live-tunnel.d.ts +8 -0
- package/dist/utils/live-tunnel.d.ts.map +1 -0
- package/dist/utils/live-tunnel.js +128 -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/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 +38 -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 +10 -0
- package/dist/utils/proxy.d.ts.map +1 -0
- package/dist/utils/proxy.js +776 -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 +62 -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 +14 -0
- package/dist/utils/rules-proxy.d.ts.map +1 -0
- package/dist/utils/rules-proxy.js +103 -0
- package/dist/utils/rules-proxy.js.map +1 -0
- package/dist/utils/run-build.d.ts +42 -0
- package/dist/utils/run-build.d.ts.map +1 -0
- package/dist/utils/run-build.js +130 -0
- package/dist/utils/run-build.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 +114 -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/state-config.d.ts +12 -0
- package/dist/utils/state-config.d.ts.map +1 -0
- package/dist/utils/state-config.js +113 -0
- package/dist/utils/state-config.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 +53 -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/types.d.ts +202 -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/javascript/scheduled-function/package.json +1 -1
- package/functions-templates/typescript/hello-world/package-lock.json +15 -15
- package/functions-templates/typescript/hello-world/package.json +1 -1
- package/functions-templates/typescript/scheduled-function/package.json +1 -1
- package/npm-shrinkwrap.json +127 -94
- package/package.json +9 -7
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
import { mkdir, stat } from 'fs/promises';
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import { basename, extname, isAbsolute, join, resolve } from 'path';
|
|
4
|
+
import { env } from 'process';
|
|
5
|
+
import { listFunctions } from '@netlify/zip-it-and-ship-it';
|
|
6
|
+
import extractZip from 'extract-zip';
|
|
7
|
+
import { chalk, log, getTerminalLink, NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, warn, watchDebounced, } from '../../utils/command-helpers.js';
|
|
8
|
+
import { INTERNAL_FUNCTIONS_FOLDER, SERVE_FUNCTIONS_FOLDER } from '../../utils/functions/functions.js';
|
|
9
|
+
import { BACKGROUND_FUNCTIONS_WARNING } from '../log.js';
|
|
10
|
+
import { getPathInProject } from '../settings.js';
|
|
11
|
+
import NetlifyFunction from './netlify-function.js';
|
|
12
|
+
import runtimes from './runtimes/index.js';
|
|
13
|
+
export const DEFAULT_FUNCTION_URL_EXPRESSION = /^\/.netlify\/(functions|builders)\/([^/]+).*/;
|
|
14
|
+
const TYPES_PACKAGE = '@netlify/functions';
|
|
15
|
+
const ZIP_EXTENSION = '.zip';
|
|
16
|
+
const isInternalFunction = (func, frameworksAPIFunctionsPath) => func.mainFile.includes(getPathInProject([INTERNAL_FUNCTIONS_FOLDER])) ||
|
|
17
|
+
func.mainFile.includes(frameworksAPIFunctionsPath);
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {"buildError" | "extracted" | "loaded" | "missing-types-package" | "reloaded" | "reloading" | "removed"} FunctionEvent
|
|
20
|
+
*/
|
|
21
|
+
export class FunctionsRegistry {
|
|
22
|
+
/**
|
|
23
|
+
* The functions held by the registry
|
|
24
|
+
*/
|
|
25
|
+
functions = new Map();
|
|
26
|
+
/**
|
|
27
|
+
* File watchers for function files. Maps function names to objects built
|
|
28
|
+
* by the `watchDebounced` utility.
|
|
29
|
+
*/
|
|
30
|
+
functionWatchers = new Map();
|
|
31
|
+
/**
|
|
32
|
+
* Keeps track of whether we've checked whether `TYPES_PACKAGE` is
|
|
33
|
+
* installed.
|
|
34
|
+
*/
|
|
35
|
+
hasCheckedTypesPackage = false;
|
|
36
|
+
/**
|
|
37
|
+
* Context object for Netlify Blobs
|
|
38
|
+
*/
|
|
39
|
+
blobsContext;
|
|
40
|
+
projectRoot;
|
|
41
|
+
isConnected;
|
|
42
|
+
debug;
|
|
43
|
+
frameworksAPIPaths;
|
|
44
|
+
constructor({ blobsContext,
|
|
45
|
+
// @ts-expect-error TS(7031) FIXME: Binding element 'capabilities' implicitly has an '... Remove this comment to see the full error message
|
|
46
|
+
capabilities,
|
|
47
|
+
// @ts-expect-error TS(7031) FIXME: Binding element 'config' implicitly has an 'any' t... Remove this comment to see the full error message
|
|
48
|
+
config, debug = false, frameworksAPIPaths, isConnected = false,
|
|
49
|
+
// @ts-expect-error TS(7031) FIXME: Binding element 'logLambdaCompat' implicitly has a... Remove this comment to see the full error message
|
|
50
|
+
logLambdaCompat,
|
|
51
|
+
// @ts-expect-error TS(7031) FIXME: Binding element 'manifest' implicitly has an 'any'... Remove this comment to see the full error message
|
|
52
|
+
manifest, projectRoot,
|
|
53
|
+
// @ts-expect-error TS(7031) FIXME: Binding element 'settings' implicitly has an 'any'... Remove this comment to see the full error message
|
|
54
|
+
settings,
|
|
55
|
+
// @ts-expect-error TS(7031) FIXME: Binding element 'timeouts' implicitly has an 'any'... Remove this comment to see the full error message
|
|
56
|
+
timeouts, }) {
|
|
57
|
+
// @ts-expect-error TS(2339) FIXME: Property 'capabilities' does not exist on type 'Fu... Remove this comment to see the full error message
|
|
58
|
+
this.capabilities = capabilities;
|
|
59
|
+
// @ts-expect-error TS(2339) FIXME: Property 'config' does not exist on type 'Function... Remove this comment to see the full error message
|
|
60
|
+
this.config = config;
|
|
61
|
+
this.debug = debug;
|
|
62
|
+
this.frameworksAPIPaths = frameworksAPIPaths;
|
|
63
|
+
this.isConnected = isConnected;
|
|
64
|
+
this.projectRoot = projectRoot;
|
|
65
|
+
// @ts-expect-error TS(2339) FIXME: Property 'timeouts' does not exist on type 'Functi... Remove this comment to see the full error message
|
|
66
|
+
this.timeouts = timeouts;
|
|
67
|
+
// @ts-expect-error TS(2339) FIXME: Property 'settings' does not exist on type 'Functi... Remove this comment to see the full error message
|
|
68
|
+
this.settings = settings;
|
|
69
|
+
this.blobsContext = blobsContext;
|
|
70
|
+
/**
|
|
71
|
+
* An object to be shared among all functions in the registry. It can be
|
|
72
|
+
* used to cache the results of the build function — e.g. it's used in
|
|
73
|
+
* the `memoizedBuild` method in the JavaScript runtime.
|
|
74
|
+
*
|
|
75
|
+
* @type {Record<string, unknown>}
|
|
76
|
+
*/
|
|
77
|
+
// @ts-expect-error TS(2339) FIXME: Property 'buildCache' does not exist on type 'Func... Remove this comment to see the full error message
|
|
78
|
+
this.buildCache = {};
|
|
79
|
+
/**
|
|
80
|
+
* File watchers for parent directories where functions live — i.e. the
|
|
81
|
+
* ones supplied to `scan()`. This is a Map because in the future we
|
|
82
|
+
* might have several function directories.
|
|
83
|
+
*
|
|
84
|
+
* @type {Map<string, Awaited<ReturnType<watchDebounced>>>}
|
|
85
|
+
*/
|
|
86
|
+
// @ts-expect-error TS(2339) FIXME: Property 'directoryWatchers' does not exist on typ... Remove this comment to see the full error message
|
|
87
|
+
this.directoryWatchers = new Map();
|
|
88
|
+
/**
|
|
89
|
+
* Whether to log V1 functions as using the "Lambda compatibility mode"
|
|
90
|
+
*
|
|
91
|
+
* @type {boolean}
|
|
92
|
+
*/
|
|
93
|
+
// @ts-expect-error TS(2339) FIXME: Property 'logLambdaCompat' does not exist on type ... Remove this comment to see the full error message
|
|
94
|
+
this.logLambdaCompat = Boolean(logLambdaCompat);
|
|
95
|
+
/**
|
|
96
|
+
* Contents of a `manifest.json` file that can be looked up when dealing
|
|
97
|
+
* with built functions.
|
|
98
|
+
*
|
|
99
|
+
* @type {object}
|
|
100
|
+
*/
|
|
101
|
+
// @ts-expect-error TS(2339) FIXME: Property 'manifest' does not exist on type 'Functi... Remove this comment to see the full error message
|
|
102
|
+
this.manifest = manifest;
|
|
103
|
+
}
|
|
104
|
+
checkTypesPackage() {
|
|
105
|
+
if (this.hasCheckedTypesPackage) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
this.hasCheckedTypesPackage = true;
|
|
109
|
+
const require = createRequire(this.projectRoot);
|
|
110
|
+
try {
|
|
111
|
+
require.resolve(TYPES_PACKAGE, { paths: [this.projectRoot] });
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
// @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
|
|
115
|
+
if (error?.code === 'MODULE_NOT_FOUND') {
|
|
116
|
+
// @ts-expect-error TS(2345) FIXME: Argument of type '{}' is not assignable to paramet... Remove this comment to see the full error message
|
|
117
|
+
FunctionsRegistry.logEvent('missing-types-package', {});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Runs before `scan` and calls any `onDirectoryScan` hooks defined by the
|
|
123
|
+
* runtime before the directory is read. This gives runtime the opportunity
|
|
124
|
+
* to run additional logic when a directory is scanned.
|
|
125
|
+
*/
|
|
126
|
+
static async prepareDirectoryScan(directory) {
|
|
127
|
+
await mkdir(directory, { recursive: true });
|
|
128
|
+
// We give runtimes the opportunity to react to a directory scan and run
|
|
129
|
+
// additional logic before the directory is read. So if they implement a
|
|
130
|
+
// `onDirectoryScan` hook, we run it.
|
|
131
|
+
await Promise.all(Object.values(runtimes).map((runtime) => {
|
|
132
|
+
// @ts-expect-error TS(2339) FIXME: Property 'onDirectoryScan' does not exist on type ... Remove this comment to see the full error message
|
|
133
|
+
if (typeof runtime.onDirectoryScan !== 'function') {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
// @ts-expect-error TS(2339) FIXME: Property 'onDirectoryScan' does not exist on type ... Remove this comment to see the full error message
|
|
137
|
+
return runtime.onDirectoryScan({ directory });
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Builds a function and sets up the appropriate file watchers so that any
|
|
142
|
+
* changes will trigger another build.
|
|
143
|
+
*/
|
|
144
|
+
async buildFunctionAndWatchFiles(func, firstLoad = false) {
|
|
145
|
+
if (!firstLoad) {
|
|
146
|
+
FunctionsRegistry.logEvent('reloading', { func });
|
|
147
|
+
}
|
|
148
|
+
// @ts-expect-error TS(2339) FIXME: Property 'buildCache' does not exist on type 'Func... Remove this comment to see the full error message
|
|
149
|
+
const { error: buildError, includedFiles, srcFilesDiff } = await func.build({ cache: this.buildCache });
|
|
150
|
+
if (buildError) {
|
|
151
|
+
FunctionsRegistry.logEvent('buildError', { func });
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
const event = firstLoad ? 'loaded' : 'reloaded';
|
|
155
|
+
const recommendedExtension = func.getRecommendedExtension();
|
|
156
|
+
if (recommendedExtension) {
|
|
157
|
+
const { filename } = func;
|
|
158
|
+
const newFilename = filename ? `${basename(filename, extname(filename))}${recommendedExtension}` : null;
|
|
159
|
+
const action = newFilename
|
|
160
|
+
? `rename the function file to ${chalk.underline(newFilename)}. Refer to https://ntl.fyi/functions-runtime for more information`
|
|
161
|
+
: `refer to https://ntl.fyi/functions-runtime`;
|
|
162
|
+
const warning = `The function is using the legacy CommonJS format. To start using ES modules, ${action}.`;
|
|
163
|
+
FunctionsRegistry.logEvent(event, { func, warnings: [warning] });
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
FunctionsRegistry.logEvent(event, { func });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (func.isTypeScript()) {
|
|
170
|
+
this.checkTypesPackage();
|
|
171
|
+
}
|
|
172
|
+
// If the build hasn't resulted in any files being added or removed, there
|
|
173
|
+
// is nothing else we need to do.
|
|
174
|
+
if (!srcFilesDiff) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const watcher = this.functionWatchers.get(func.name);
|
|
178
|
+
// If there is already a watcher for this function, we need to unwatch any
|
|
179
|
+
// files that have been removed and watch any files that have been added.
|
|
180
|
+
if (watcher) {
|
|
181
|
+
srcFilesDiff.deleted.forEach((path) => {
|
|
182
|
+
watcher.unwatch(path);
|
|
183
|
+
});
|
|
184
|
+
srcFilesDiff.added.forEach((path) => {
|
|
185
|
+
watcher.add(path);
|
|
186
|
+
});
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
// If there is no watcher for this function but the build produced files,
|
|
190
|
+
// we create a new watcher and watch them.
|
|
191
|
+
if (srcFilesDiff.added.size !== 0) {
|
|
192
|
+
const filesToWatch = [...srcFilesDiff.added, ...includedFiles];
|
|
193
|
+
const newWatcher = await watchDebounced(filesToWatch, {
|
|
194
|
+
onChange: () => {
|
|
195
|
+
this.buildFunctionAndWatchFiles(func, false);
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
this.functionWatchers.set(func.name, newWatcher);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Returns a function by name.
|
|
203
|
+
*/
|
|
204
|
+
get(name) {
|
|
205
|
+
return this.functions.get(name);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Looks for the first function that matches a given URL path. If a match is
|
|
209
|
+
* found, returns an object with the function and the route. If the URL path
|
|
210
|
+
* matches the default functions URL (i.e. can only be for a function) but no
|
|
211
|
+
* function with the given name exists, returns an object with the function
|
|
212
|
+
* and the route set to `null`. Otherwise, `undefined` is returned,
|
|
213
|
+
*/
|
|
214
|
+
async getFunctionForURLPath(urlPath, method, hasStaticFile) {
|
|
215
|
+
// We're constructing a URL object just so that we can extract the path from
|
|
216
|
+
// the incoming URL. It doesn't really matter that we don't have the actual
|
|
217
|
+
// local URL with the correct port.
|
|
218
|
+
const url = new URL(`http://localhost${urlPath}`);
|
|
219
|
+
const defaultURLMatch = url.pathname.match(DEFAULT_FUNCTION_URL_EXPRESSION);
|
|
220
|
+
if (defaultURLMatch) {
|
|
221
|
+
const func = this.get(defaultURLMatch[2]);
|
|
222
|
+
if (!func) {
|
|
223
|
+
return { func: null, route: null };
|
|
224
|
+
}
|
|
225
|
+
const { routes = [] } = (await func.getBuildData()) ?? {};
|
|
226
|
+
if (routes.length !== 0) {
|
|
227
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'route' implicitly has an 'any' type.
|
|
228
|
+
const paths = routes.map((route) => chalk.underline(route.pattern)).join(', ');
|
|
229
|
+
warn(`Function ${chalk.yellow(func.name)} cannot be invoked on ${chalk.underline(url.pathname)}, because the function has the following URL paths defined: ${paths}`);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
return { func, route: null };
|
|
233
|
+
}
|
|
234
|
+
for (const func of this.functions.values()) {
|
|
235
|
+
const route = await func.matchURLPath(url.pathname, method, hasStaticFile);
|
|
236
|
+
if (route) {
|
|
237
|
+
return { func, route };
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Logs an event associated with functions.
|
|
243
|
+
*/
|
|
244
|
+
static logEvent(event, { func, warnings = [] }) {
|
|
245
|
+
let warningsText = '';
|
|
246
|
+
if (warnings.length !== 0) {
|
|
247
|
+
warningsText = ` with warnings:\n${warnings.map((warning) => ` - ${warning}`).join('\n')}`;
|
|
248
|
+
}
|
|
249
|
+
if (event === 'buildError') {
|
|
250
|
+
log(`${NETLIFYDEVERR} ${chalk.red('Failed to load')} function ${chalk.yellow(func?.displayName)}: ${func?.buildError?.message}`);
|
|
251
|
+
}
|
|
252
|
+
if (event === 'extracted') {
|
|
253
|
+
log(`${NETLIFYDEVLOG} ${chalk.green('Extracted')} function ${chalk.yellow(func?.displayName)} from ${func?.mainFile}.`);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (event === 'loaded') {
|
|
257
|
+
const icon = warningsText ? NETLIFYDEVWARN : NETLIFYDEVLOG;
|
|
258
|
+
const color = warningsText ? chalk.yellow : chalk.green;
|
|
259
|
+
const mode =
|
|
260
|
+
// @ts-expect-error TS(2339) FIXME: Property 'logLambdaCompat' does not exist on type ... Remove this comment to see the full error message
|
|
261
|
+
func?.runtimeAPIVersion === 1 && this.logLambdaCompat
|
|
262
|
+
? ` in ${getTerminalLink('Lambda compatibility mode', 'https://ntl.fyi/lambda-compat')}`
|
|
263
|
+
: '';
|
|
264
|
+
log(`${icon} ${color('Loaded')} function ${chalk.yellow(func?.displayName)}${mode}${warningsText}`);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (event === 'missing-types-package') {
|
|
268
|
+
log(`${NETLIFYDEVWARN} For a better experience with TypeScript functions, consider installing the ${chalk.underline(TYPES_PACKAGE)} package. Refer to https://ntl.fyi/function-types for more information.`);
|
|
269
|
+
}
|
|
270
|
+
if (event === 'reloaded') {
|
|
271
|
+
const icon = warningsText ? NETLIFYDEVWARN : NETLIFYDEVLOG;
|
|
272
|
+
const color = warningsText ? chalk.yellow : chalk.green;
|
|
273
|
+
log(`${icon} ${color('Reloaded')} function ${chalk.yellow(func?.displayName)}${warningsText}`);
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (event === 'reloading') {
|
|
277
|
+
log(`${NETLIFYDEVLOG} ${chalk.magenta('Reloading')} function ${chalk.yellow(func?.displayName)}...`);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (event === 'removed') {
|
|
281
|
+
log(`${NETLIFYDEVLOG} ${chalk.magenta('Removed')} function ${chalk.yellow(func?.displayName)}`);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Adds a function to the registry
|
|
286
|
+
*/
|
|
287
|
+
async registerFunction(name, funcBeforeHook, isReload = false) {
|
|
288
|
+
const { runtime } = funcBeforeHook;
|
|
289
|
+
// The `onRegister` hook allows runtimes to modify the function before it's
|
|
290
|
+
// registered, or to prevent it from being registered altogether if the
|
|
291
|
+
// hook returns `null`.
|
|
292
|
+
// @ts-expect-error FIXME
|
|
293
|
+
const func = typeof runtime.onRegister === 'function' ? runtime.onRegister(funcBeforeHook) : funcBeforeHook;
|
|
294
|
+
if (func === null) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
// @ts-expect-error TS(2339) FIXME: Property 'isConnected' does not exist on type 'Fun... Remove this comment to see the full error message
|
|
298
|
+
if (func.isBackground && this.isConnected && !this.capabilities.backgroundFunctions) {
|
|
299
|
+
warn(BACKGROUND_FUNCTIONS_WARNING);
|
|
300
|
+
}
|
|
301
|
+
if (!func.hasValidName()) {
|
|
302
|
+
warn(`Function name '${func.name}' is invalid. It should consist only of alphanumeric characters, hyphen & underscores.`);
|
|
303
|
+
}
|
|
304
|
+
// If the function file is a ZIP, we extract it and rewire its main file to
|
|
305
|
+
// the new location.
|
|
306
|
+
if (extname(func.mainFile) === ZIP_EXTENSION) {
|
|
307
|
+
const unzippedDirectory = await this.unzipFunction(func);
|
|
308
|
+
// If there's a manifest file, look up the function in order to extract
|
|
309
|
+
// the build data.
|
|
310
|
+
// @ts-expect-error TS(2339) FIXME: Property 'manifest' does not exist on type 'Functi... Remove this comment to see the full error message
|
|
311
|
+
const manifestEntry = (this.manifest?.functions || []).find((manifestFunc) => manifestFunc.name === func.name);
|
|
312
|
+
// We found a zipped function that does not have a corresponding entry in
|
|
313
|
+
// the manifest. This shouldn't happen, but we ignore the function in
|
|
314
|
+
// this case.
|
|
315
|
+
if (!manifestEntry) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
if (this.debug) {
|
|
319
|
+
FunctionsRegistry.logEvent('extracted', { func });
|
|
320
|
+
}
|
|
321
|
+
func.buildData = {
|
|
322
|
+
...manifestEntry?.buildData,
|
|
323
|
+
routes: manifestEntry?.routes,
|
|
324
|
+
};
|
|
325
|
+
// When we look at an unzipped function, we don't know whether it uses
|
|
326
|
+
// the legacy entry file format (i.e. `[function name].mjs`) or the new
|
|
327
|
+
// one (i.e. `___netlify-entry-point.mjs`). Let's look for the new one
|
|
328
|
+
// and use it if it exists, otherwise use the old one.
|
|
329
|
+
try {
|
|
330
|
+
const v2EntryPointPath = join(unzippedDirectory, '___netlify-entry-point.mjs');
|
|
331
|
+
await stat(v2EntryPointPath);
|
|
332
|
+
func.mainFile = v2EntryPointPath;
|
|
333
|
+
}
|
|
334
|
+
catch {
|
|
335
|
+
func.mainFile = join(unzippedDirectory, basename(manifestEntry.mainFile));
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
this.buildFunctionAndWatchFiles(func, !isReload);
|
|
340
|
+
}
|
|
341
|
+
this.functions.set(name, func);
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* A proxy to zip-it-and-ship-it's `listFunctions` method. It exists just so
|
|
345
|
+
* that we can mock it in tests.
|
|
346
|
+
*/
|
|
347
|
+
// eslint-disable-next-line class-methods-use-this
|
|
348
|
+
async listFunctions(...args) {
|
|
349
|
+
return await listFunctions(...args);
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Takes a list of directories and scans for functions. It keeps tracks of
|
|
353
|
+
* any functions in those directories that we've previously seen, and takes
|
|
354
|
+
* care of registering and unregistering functions as they come and go.
|
|
355
|
+
*/
|
|
356
|
+
async scan(relativeDirs) {
|
|
357
|
+
const directories = relativeDirs
|
|
358
|
+
.filter((dir) => Boolean(dir))
|
|
359
|
+
.map((dir) => (isAbsolute(dir) ? dir : join(this.projectRoot, dir)));
|
|
360
|
+
// check after filtering to filter out [undefined] for example
|
|
361
|
+
if (directories.length === 0) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
await Promise.all(directories.map((path) => FunctionsRegistry.prepareDirectoryScan(path)));
|
|
365
|
+
const functions = await this.listFunctions(directories, {
|
|
366
|
+
featureFlags: {
|
|
367
|
+
buildRustSource: env.NETLIFY_EXPERIMENTAL_BUILD_RUST_SOURCE === 'true',
|
|
368
|
+
},
|
|
369
|
+
configFileDirectories: [getPathInProject([INTERNAL_FUNCTIONS_FOLDER])],
|
|
370
|
+
// @ts-expect-error TS(2339) FIXME: Property 'config' does not exist on type 'Function... Remove this comment to see the full error message
|
|
371
|
+
config: this.config.functions,
|
|
372
|
+
});
|
|
373
|
+
// user-defined functions take precedence over internal functions,
|
|
374
|
+
// so we want to ignore any internal functions where there's a user-defined one with the same name
|
|
375
|
+
const ignoredFunctions = new Set(functions
|
|
376
|
+
.filter((func) => isInternalFunction(func, this.frameworksAPIPaths.functions.path) &&
|
|
377
|
+
this.functions.has(func.name) &&
|
|
378
|
+
!isInternalFunction(this.functions.get(func.name), this.frameworksAPIPaths.functions.path))
|
|
379
|
+
.map((func) => func.name));
|
|
380
|
+
// Before registering any functions, we look for any functions that were on
|
|
381
|
+
// the previous list but are missing from the new one. We unregister them.
|
|
382
|
+
const deletedFunctions = [...this.functions.values()].filter((oldFunc) => {
|
|
383
|
+
const isFound = functions.some((newFunc) => ignoredFunctions.has(newFunc.name) ||
|
|
384
|
+
(newFunc.name === oldFunc.name && newFunc.mainFile === oldFunc.mainFile));
|
|
385
|
+
return !isFound;
|
|
386
|
+
});
|
|
387
|
+
await Promise.all(deletedFunctions.map((func) => this.unregisterFunction(func)));
|
|
388
|
+
const deletedFunctionNames = new Set(deletedFunctions.map((func) => func.name));
|
|
389
|
+
const addedFunctions = await Promise.all(
|
|
390
|
+
// zip-it-and-ship-it returns an array sorted based on which extension should have precedence,
|
|
391
|
+
// where the last ones precede the previous ones. This is why
|
|
392
|
+
// we reverse the array so we get the right functions precedence in the CLI.
|
|
393
|
+
functions.reverse().map(async ({ displayName, mainFile, name, runtime: runtimeName }) => {
|
|
394
|
+
if (ignoredFunctions.has(name)) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
const runtime = runtimes[runtimeName];
|
|
398
|
+
// If there is no matching runtime, it means this function is not yet
|
|
399
|
+
// supported in Netlify Dev.
|
|
400
|
+
if (runtime === undefined) {
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
// If this function has already been registered, we skip it.
|
|
404
|
+
if (this.functions.has(name)) {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
const func = new NetlifyFunction({
|
|
408
|
+
blobsContext: this.blobsContext,
|
|
409
|
+
// @ts-expect-error TS(2339) FIXME: Property 'config' does not exist on type 'Function... Remove this comment to see the full error message
|
|
410
|
+
config: this.config,
|
|
411
|
+
directory: directories.find((directory) => mainFile.startsWith(directory)),
|
|
412
|
+
mainFile,
|
|
413
|
+
name,
|
|
414
|
+
displayName,
|
|
415
|
+
projectRoot: this.projectRoot,
|
|
416
|
+
runtime,
|
|
417
|
+
// @ts-expect-error TS(2339) FIXME: Property 'timeouts' does not exist on type 'Functi... Remove this comment to see the full error message
|
|
418
|
+
timeoutBackground: this.timeouts.backgroundFunctions,
|
|
419
|
+
// @ts-expect-error TS(2339) FIXME: Property 'timeouts' does not exist on type 'Functi... Remove this comment to see the full error message
|
|
420
|
+
timeoutSynchronous: this.timeouts.syncFunctions,
|
|
421
|
+
// @ts-expect-error TS(2339) FIXME: Property 'settings' does not exist on type 'Functi... Remove this comment to see the full error message
|
|
422
|
+
settings: this.settings,
|
|
423
|
+
});
|
|
424
|
+
// If a function we're registering was also unregistered in this run,
|
|
425
|
+
// then it was a rename. Let's flag it as such so that the messaging
|
|
426
|
+
// is adjusted accordingly.
|
|
427
|
+
const isReload = deletedFunctionNames.has(name);
|
|
428
|
+
await this.registerFunction(name, func, isReload);
|
|
429
|
+
return func;
|
|
430
|
+
}));
|
|
431
|
+
const addedFunctionNames = new Set(addedFunctions.filter(Boolean).map((func) => func?.name));
|
|
432
|
+
deletedFunctions.forEach((func) => {
|
|
433
|
+
// If a function we've unregistered was also registered in this run, then
|
|
434
|
+
// it was a rename that we've already logged. Nothing to do in this case.
|
|
435
|
+
if (addedFunctionNames.has(func.name)) {
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
FunctionsRegistry.logEvent('removed', { func });
|
|
439
|
+
});
|
|
440
|
+
await Promise.all(directories.map((path) => this.setupDirectoryWatcher(path)));
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Creates a watcher that looks at files being added or removed from a
|
|
444
|
+
* functions directory. It doesn't care about files being changed, because
|
|
445
|
+
* those will be handled by each functions' watcher.
|
|
446
|
+
*/
|
|
447
|
+
async setupDirectoryWatcher(directory) {
|
|
448
|
+
// @ts-expect-error TS(2339) FIXME: Property 'directoryWatchers' does not exist on typ... Remove this comment to see the full error message
|
|
449
|
+
if (this.directoryWatchers.has(directory)) {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
const watcher = await watchDebounced(directory, {
|
|
453
|
+
depth: 1,
|
|
454
|
+
onAdd: () => {
|
|
455
|
+
this.scan([directory]);
|
|
456
|
+
},
|
|
457
|
+
onUnlink: () => {
|
|
458
|
+
this.scan([directory]);
|
|
459
|
+
},
|
|
460
|
+
});
|
|
461
|
+
// @ts-expect-error TS(2339) FIXME: Property 'directoryWatchers' does not exist on typ... Remove this comment to see the full error message
|
|
462
|
+
this.directoryWatchers.set(directory, watcher);
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Removes a function from the registry and closes its file watchers.
|
|
466
|
+
*/
|
|
467
|
+
async unregisterFunction(func) {
|
|
468
|
+
const { name } = func;
|
|
469
|
+
this.functions.delete(name);
|
|
470
|
+
const watcher = this.functionWatchers.get(name);
|
|
471
|
+
if (watcher) {
|
|
472
|
+
await watcher.close();
|
|
473
|
+
}
|
|
474
|
+
this.functionWatchers.delete(name);
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Takes a zipped function and extracts its contents to an internal directory.
|
|
478
|
+
*/
|
|
479
|
+
async unzipFunction(func) {
|
|
480
|
+
const targetDirectory = resolve(this.projectRoot, getPathInProject([SERVE_FUNCTIONS_FOLDER, '.unzipped', func.name]));
|
|
481
|
+
await extractZip(func.mainFile, { dir: targetDirectory });
|
|
482
|
+
return targetDirectory;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/lib/functions/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO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AC,IAAI,CAAC,CAAC,CACnE,CAAA;QAED,MAAM,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,CAAA;QAEzD,OAAO,eAAe,CAAA;IACxB,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const name = "go";
|
|
2
|
+
export declare const getBuildFunction: ({ func }: {
|
|
3
|
+
func: any;
|
|
4
|
+
}) => () => Promise<{
|
|
5
|
+
binaryPath: any;
|
|
6
|
+
srcFiles: any[];
|
|
7
|
+
}>;
|
|
8
|
+
export declare const invokeFunction: ({ context, event, func, timeout }: {
|
|
9
|
+
context: any;
|
|
10
|
+
event: any;
|
|
11
|
+
func: any;
|
|
12
|
+
timeout: any;
|
|
13
|
+
}) => Promise<{
|
|
14
|
+
body: any;
|
|
15
|
+
headers: any;
|
|
16
|
+
multiValueHeaders: any;
|
|
17
|
+
statusCode: any;
|
|
18
|
+
} | {
|
|
19
|
+
statusCode: number;
|
|
20
|
+
body?: undefined;
|
|
21
|
+
headers?: undefined;
|
|
22
|
+
multiValueHeaders?: undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const onRegister: (func: any) => any;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/functions/runtimes/go/index.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,IAAI,OAAO,CAAA;AAiCxB,eAAO,MAAM,gBAAgB;;;;;EAK5B,CAAA;AAGD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;EAwB1B,CAAA;AAGD,eAAO,MAAM,UAAU,oBAItB,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { dirname, extname } from 'path';
|
|
2
|
+
import { platform } from 'process';
|
|
3
|
+
import { temporaryFile } from 'tempy';
|
|
4
|
+
import execa from '../../../../utils/execa.js';
|
|
5
|
+
import { runFunctionsProxy } from '../../local-proxy.js';
|
|
6
|
+
const isWindows = platform === 'win32';
|
|
7
|
+
export const name = 'go';
|
|
8
|
+
// @ts-expect-error TS(7031) FIXME: Binding element 'binaryPath' implicitly has an 'an... Remove this comment to see the full error message
|
|
9
|
+
const build = async ({ binaryPath, functionDirectory }) => {
|
|
10
|
+
try {
|
|
11
|
+
await execa('go', ['build', '-o', binaryPath], { cwd: functionDirectory });
|
|
12
|
+
return { binaryPath, srcFiles: [functionDirectory] };
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
const isGoInstalled = await checkGoInstallation({ cwd: functionDirectory });
|
|
16
|
+
if (!isGoInstalled) {
|
|
17
|
+
throw new Error("You don't seem to have Go installed. Go to https://golang.org/doc/install for installation instructions.");
|
|
18
|
+
}
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
// @ts-expect-error TS(7031) FIXME: Binding element 'cwd' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
23
|
+
const checkGoInstallation = async ({ cwd }) => {
|
|
24
|
+
try {
|
|
25
|
+
await execa('go', ['version'], { cwd });
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
// @ts-expect-error TS(7031) FIXME: Binding element 'func' implicitly has an 'any' typ... Remove this comment to see the full error message
|
|
33
|
+
export const getBuildFunction = ({ func }) => {
|
|
34
|
+
const functionDirectory = dirname(func.mainFile);
|
|
35
|
+
const binaryPath = temporaryFile(isWindows ? { extension: 'exe' } : undefined);
|
|
36
|
+
return () => build({ binaryPath, functionDirectory });
|
|
37
|
+
};
|
|
38
|
+
// @ts-expect-error TS(7031) FIXME: Binding element 'context' implicitly has an 'any' ... Remove this comment to see the full error message
|
|
39
|
+
export const invokeFunction = async ({ context, event, func, timeout }) => {
|
|
40
|
+
const { stdout } = await runFunctionsProxy({
|
|
41
|
+
binaryPath: func.buildData.binaryPath,
|
|
42
|
+
context,
|
|
43
|
+
directory: dirname(func.mainFile),
|
|
44
|
+
event,
|
|
45
|
+
name: func.name,
|
|
46
|
+
timeout,
|
|
47
|
+
});
|
|
48
|
+
try {
|
|
49
|
+
const { body, headers, multiValueHeaders, statusCode } = JSON.parse(stdout);
|
|
50
|
+
return {
|
|
51
|
+
body,
|
|
52
|
+
headers,
|
|
53
|
+
multiValueHeaders,
|
|
54
|
+
statusCode,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return {
|
|
59
|
+
statusCode: 500,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
// @ts-expect-error TS(7006) FIXME: Parameter 'func' implicitly has an 'any' type.
|
|
64
|
+
export const onRegister = (func) => {
|
|
65
|
+
const isSource = extname(func.mainFile) === '.go';
|
|
66
|
+
return isSource ? func : null;
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/functions/runtimes/go/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC,OAAO,KAAK,MAAM,4BAA4B,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAExD,MAAM,SAAS,GAAG,QAAQ,KAAK,OAAO,CAAA;AAEtC,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAA;AAExB,2IAA2I;AAC3I,MAAM,KAAK,GAAG,KAAK,EAAE,EAAE,UAAU,EAAE,iBAAiB,EAAE,EAAE,EAAE;IACxD,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,IAA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EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;IACxE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,iBAAiB,CAAC;QACzC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU;QACrC,OAAO;QACP,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;QACjC,KAAK;QACL,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,OAAO;KACR,CAAC,CAAA;IAEF,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QAE3E,OAAO;YACL,IAAI;YACJ,OAAO;YACP,iBAAiB;YACjB,UAAU;SACX,CAAA;IACH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,UAAU,EAAE,GAAG;SAChB,CAAA;IACH,CAAC;AACH,CAAC,CAAA;AAED,kFAAkF;AAClF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,EAAE;IACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAA;IAEjD,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;AAC/B,CAAC,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as go from './go/index.js';
|
|
2
|
+
import * as js from './js/index.js';
|
|
3
|
+
import * as rust from './rust/index.js';
|
|
4
|
+
type BuildFunction = (func: object) => Promise<{
|
|
5
|
+
srcFiles: string[];
|
|
6
|
+
buildPath?: string;
|
|
7
|
+
}>;
|
|
8
|
+
type GetBuildFunction = (params: {
|
|
9
|
+
config: object;
|
|
10
|
+
context: object;
|
|
11
|
+
errorExit: Function;
|
|
12
|
+
func: object;
|
|
13
|
+
functionsDirectory: string;
|
|
14
|
+
projectRoot: string;
|
|
15
|
+
}) => Promise<BuildFunction>;
|
|
16
|
+
type InvokeFunction = (params: {
|
|
17
|
+
context: object;
|
|
18
|
+
event: object;
|
|
19
|
+
func: object;
|
|
20
|
+
timeout: number;
|
|
21
|
+
}) => Promise<{
|
|
22
|
+
body: object;
|
|
23
|
+
statusCode: number;
|
|
24
|
+
}>;
|
|
25
|
+
type OnDirectoryScanFunction = (params: {
|
|
26
|
+
directory: string;
|
|
27
|
+
}) => Promise<void>;
|
|
28
|
+
type OnRegisterFunction = (func: object) => Promise<object | null>;
|
|
29
|
+
export interface Runtime {
|
|
30
|
+
getBuildFunction: GetBuildFunction;
|
|
31
|
+
invokeFunction: InvokeFunction;
|
|
32
|
+
onDirectoryScan?: OnDirectoryScanFunction;
|
|
33
|
+
onRegister?: OnRegisterFunction;
|
|
34
|
+
name: string;
|
|
35
|
+
}
|
|
36
|
+
declare const runtimes: {
|
|
37
|
+
go: typeof go;
|
|
38
|
+
js: typeof js;
|
|
39
|
+
rs: typeof rust;
|
|
40
|
+
};
|
|
41
|
+
export default runtimes;
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|