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,437 @@
|
|
|
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 isErrnoException = (value) => value instanceof Error && Object.hasOwn(value, 'code');
|
|
17
|
+
const isInternalFunction = (func, frameworksAPIFunctionsPath) => func.mainFile.includes(getPathInProject([INTERNAL_FUNCTIONS_FOLDER])) ||
|
|
18
|
+
func.mainFile.includes(frameworksAPIFunctionsPath);
|
|
19
|
+
export class FunctionsRegistry {
|
|
20
|
+
/**
|
|
21
|
+
* The functions held by the registry
|
|
22
|
+
*/
|
|
23
|
+
functions = new Map();
|
|
24
|
+
/**
|
|
25
|
+
* File watchers for function files. Maps function names to objects built
|
|
26
|
+
* by the `watchDebounced` utility.
|
|
27
|
+
*/
|
|
28
|
+
functionWatchers = new Map();
|
|
29
|
+
directoryWatchers;
|
|
30
|
+
/**
|
|
31
|
+
* Keeps track of whether we've checked whether `TYPES_PACKAGE` is
|
|
32
|
+
* installed.
|
|
33
|
+
*/
|
|
34
|
+
hasCheckedTypesPackage = false;
|
|
35
|
+
/**
|
|
36
|
+
* Context object for Netlify Blobs
|
|
37
|
+
*/
|
|
38
|
+
blobsContext;
|
|
39
|
+
buildCommandCache;
|
|
40
|
+
capabilities;
|
|
41
|
+
config;
|
|
42
|
+
debug;
|
|
43
|
+
frameworksAPIPaths;
|
|
44
|
+
isConnected;
|
|
45
|
+
logLambdaCompat;
|
|
46
|
+
manifest;
|
|
47
|
+
projectRoot;
|
|
48
|
+
// TODO(serhalp): This is confusing. Refactor to accept entire settings or rename or something?
|
|
49
|
+
settings;
|
|
50
|
+
timeouts;
|
|
51
|
+
constructor({ blobsContext, capabilities, config, debug = false, frameworksAPIPaths, isConnected = false, logLambdaCompat, manifest, projectRoot, settings, timeouts, }) {
|
|
52
|
+
this.capabilities = capabilities;
|
|
53
|
+
this.config = config;
|
|
54
|
+
this.debug = debug;
|
|
55
|
+
this.frameworksAPIPaths = frameworksAPIPaths;
|
|
56
|
+
this.isConnected = isConnected;
|
|
57
|
+
this.projectRoot = projectRoot;
|
|
58
|
+
this.timeouts = timeouts;
|
|
59
|
+
this.settings = settings;
|
|
60
|
+
this.blobsContext = blobsContext;
|
|
61
|
+
/**
|
|
62
|
+
* An object to be shared among all functions in the registry. It can be
|
|
63
|
+
* used to cache the results of the build function — e.g. it's used in
|
|
64
|
+
* the `memoizedBuild` method in the JavaScript runtime.
|
|
65
|
+
*/
|
|
66
|
+
this.buildCommandCache = {};
|
|
67
|
+
/**
|
|
68
|
+
* File watchers for parent directories where functions live — i.e. the
|
|
69
|
+
* ones supplied to `scan()`. This is a Map because in the future we
|
|
70
|
+
* might have several function directories.
|
|
71
|
+
*/
|
|
72
|
+
this.directoryWatchers = new Map();
|
|
73
|
+
/**
|
|
74
|
+
* Whether to log V1 functions as using the "Lambda compatibility mode"
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
this.logLambdaCompat = Boolean(logLambdaCompat);
|
|
78
|
+
/**
|
|
79
|
+
* Contents of a `manifest.json` file that can be looked up when dealing
|
|
80
|
+
* with built functions.
|
|
81
|
+
*
|
|
82
|
+
*/
|
|
83
|
+
this.manifest = manifest;
|
|
84
|
+
}
|
|
85
|
+
checkTypesPackage() {
|
|
86
|
+
if (this.hasCheckedTypesPackage) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this.hasCheckedTypesPackage = true;
|
|
90
|
+
const require = createRequire(this.projectRoot);
|
|
91
|
+
try {
|
|
92
|
+
require.resolve(TYPES_PACKAGE, { paths: [this.projectRoot] });
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
if (isErrnoException(error) && error.code === 'MODULE_NOT_FOUND') {
|
|
96
|
+
this.logEvent('missing-types-package', {});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// TODO(serhalp): Is this really the right place to do this mutation? Should we do this at all?
|
|
101
|
+
static async prepareDirectory(directory) {
|
|
102
|
+
await mkdir(directory, { recursive: true });
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Builds a function and sets up the appropriate file watchers so that any
|
|
106
|
+
* changes will trigger another build.
|
|
107
|
+
*/
|
|
108
|
+
async buildFunctionAndWatchFiles(func, firstLoad = false) {
|
|
109
|
+
if (!firstLoad) {
|
|
110
|
+
this.logEvent('reloading', { func });
|
|
111
|
+
}
|
|
112
|
+
const { error: buildError, includedFiles, srcFilesDiff } = await func.build({ cache: this.buildCommandCache });
|
|
113
|
+
if (buildError) {
|
|
114
|
+
this.logEvent('buildError', { func });
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
const event = firstLoad ? 'loaded' : 'reloaded';
|
|
118
|
+
const recommendedExtension = func.getRecommendedExtension();
|
|
119
|
+
if (recommendedExtension) {
|
|
120
|
+
const { filename } = func;
|
|
121
|
+
const newFilename = filename ? `${basename(filename, extname(filename))}${recommendedExtension}` : null;
|
|
122
|
+
const action = newFilename
|
|
123
|
+
? `rename the function file to ${chalk.underline(newFilename)}. Refer to https://ntl.fyi/functions-runtime for more information`
|
|
124
|
+
: `refer to https://ntl.fyi/functions-runtime`;
|
|
125
|
+
const warning = `The function is using the legacy CommonJS format. To start using ES modules, ${action}.`;
|
|
126
|
+
this.logEvent(event, { func, warnings: [warning] });
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
this.logEvent(event, { func });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (func.isTypeScript()) {
|
|
133
|
+
this.checkTypesPackage();
|
|
134
|
+
}
|
|
135
|
+
// If the build hasn't resulted in any files being added or removed, there
|
|
136
|
+
// is nothing else we need to do.
|
|
137
|
+
if (!srcFilesDiff) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const watcher = this.functionWatchers.get(func.name);
|
|
141
|
+
// If there is already a watcher for this function, we need to unwatch any
|
|
142
|
+
// files that have been removed and watch any files that have been added.
|
|
143
|
+
if (watcher) {
|
|
144
|
+
srcFilesDiff.deleted.forEach((path) => {
|
|
145
|
+
watcher.unwatch(path);
|
|
146
|
+
});
|
|
147
|
+
srcFilesDiff.added.forEach((path) => {
|
|
148
|
+
watcher.add(path);
|
|
149
|
+
});
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
// If there is no watcher for this function but the build produced files,
|
|
153
|
+
// we create a new watcher and watch them.
|
|
154
|
+
if (srcFilesDiff.added.size !== 0) {
|
|
155
|
+
const filesToWatch = [...srcFilesDiff.added, ...includedFiles];
|
|
156
|
+
const newWatcher = await watchDebounced(filesToWatch, {
|
|
157
|
+
onChange: () => {
|
|
158
|
+
this.buildFunctionAndWatchFiles(func, false);
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
this.functionWatchers.set(func.name, newWatcher);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Returns a function by name.
|
|
166
|
+
*/
|
|
167
|
+
get(name) {
|
|
168
|
+
return this.functions.get(name);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Looks for the first function that matches a given URL path. If a match is
|
|
172
|
+
* found, returns an object with the function and the route. If the URL path
|
|
173
|
+
* matches the default functions URL (i.e. can only be for a function) but no
|
|
174
|
+
* function with the given name exists, returns an object with the function
|
|
175
|
+
* and the route set to `null`. Otherwise, `undefined` is returned,
|
|
176
|
+
*/
|
|
177
|
+
async getFunctionForURLPath(urlPath, method, hasStaticFile) {
|
|
178
|
+
// We're constructing a URL object just so that we can extract the path from
|
|
179
|
+
// the incoming URL. It doesn't really matter that we don't have the actual
|
|
180
|
+
// local URL with the correct port.
|
|
181
|
+
const url = new URL(`http://localhost${urlPath}`);
|
|
182
|
+
const defaultURLMatch = DEFAULT_FUNCTION_URL_EXPRESSION.exec(url.pathname);
|
|
183
|
+
if (defaultURLMatch) {
|
|
184
|
+
const func = this.get(defaultURLMatch[2]);
|
|
185
|
+
if (!func) {
|
|
186
|
+
return { func: null, route: null };
|
|
187
|
+
}
|
|
188
|
+
const { routes = [] } = (await func.getBuildData()) ?? {};
|
|
189
|
+
if (routes.length !== 0) {
|
|
190
|
+
const paths = routes.map((route) => chalk.underline(route.pattern)).join(', ');
|
|
191
|
+
warn(`Function ${chalk.yellow(func.name)} cannot be invoked on ${chalk.underline(url.pathname)}, because the function has the following URL paths defined: ${paths}`);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
return { func, route: null };
|
|
195
|
+
}
|
|
196
|
+
for (const func of this.functions.values()) {
|
|
197
|
+
const route = await func.matchURLPath(url.pathname, method, hasStaticFile);
|
|
198
|
+
if (route) {
|
|
199
|
+
return { func, route };
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Logs an event associated with functions.
|
|
205
|
+
*/
|
|
206
|
+
logEvent(event, { func, warnings = [] }) {
|
|
207
|
+
let warningsText = '';
|
|
208
|
+
if (warnings.length !== 0) {
|
|
209
|
+
warningsText = ` with warnings:\n${warnings.map((warning) => ` - ${warning}`).join('\n')}`;
|
|
210
|
+
}
|
|
211
|
+
if (event === 'buildError') {
|
|
212
|
+
log(`${NETLIFYDEVERR} ${chalk.red('Failed to load')} function ${chalk.yellow(func?.displayName)}: ${func?.buildError?.message ?? ''}`);
|
|
213
|
+
}
|
|
214
|
+
if (event === 'extracted') {
|
|
215
|
+
log(`${NETLIFYDEVLOG} ${chalk.green('Extracted')} function ${chalk.yellow(func?.displayName)} from ${func?.mainFile ?? ''}.`);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (event === 'loaded') {
|
|
219
|
+
const icon = warningsText ? NETLIFYDEVWARN : NETLIFYDEVLOG;
|
|
220
|
+
const color = warningsText ? chalk.yellow : chalk.green;
|
|
221
|
+
const mode = func?.runtimeAPIVersion === 1 && this.logLambdaCompat
|
|
222
|
+
? ` in ${getTerminalLink('Lambda compatibility mode', 'https://ntl.fyi/lambda-compat')}`
|
|
223
|
+
: '';
|
|
224
|
+
log(`${icon} ${color('Loaded')} function ${chalk.yellow(func?.displayName)}${mode}${warningsText}`);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (event === 'missing-types-package') {
|
|
228
|
+
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.`);
|
|
229
|
+
}
|
|
230
|
+
if (event === 'reloaded') {
|
|
231
|
+
const icon = warningsText ? NETLIFYDEVWARN : NETLIFYDEVLOG;
|
|
232
|
+
const color = warningsText ? chalk.yellow : chalk.green;
|
|
233
|
+
log(`${icon} ${color('Reloaded')} function ${chalk.yellow(func?.displayName)}${warningsText}`);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (event === 'reloading') {
|
|
237
|
+
log(`${NETLIFYDEVLOG} ${chalk.magenta('Reloading')} function ${chalk.yellow(func?.displayName)}...`);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if (event === 'removed') {
|
|
241
|
+
log(`${NETLIFYDEVLOG} ${chalk.magenta('Removed')} function ${chalk.yellow(func?.displayName)}`);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Adds a function to the registry
|
|
246
|
+
*/
|
|
247
|
+
async registerFunction(name, funcBeforeHook, isReload = false) {
|
|
248
|
+
const { runtime } = funcBeforeHook;
|
|
249
|
+
// The `onRegister` hook allows runtimes to modify the function before it's
|
|
250
|
+
// registered, or to prevent it from being registered altogether if the
|
|
251
|
+
// hook returns `null`.
|
|
252
|
+
const func = typeof runtime.onRegister === 'function' ? runtime.onRegister(funcBeforeHook) : funcBeforeHook;
|
|
253
|
+
if (func === null) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (func.isBackground && this.isConnected && !this.capabilities.backgroundFunctions) {
|
|
257
|
+
warn(BACKGROUND_FUNCTIONS_WARNING);
|
|
258
|
+
}
|
|
259
|
+
if (!func.hasValidName()) {
|
|
260
|
+
warn(`Function name '${func.name}' is invalid. It should consist only of alphanumeric characters, hyphen & underscores.`);
|
|
261
|
+
}
|
|
262
|
+
// If the function file is a ZIP, we extract it and rewire its main file to
|
|
263
|
+
// the new location.
|
|
264
|
+
if (extname(func.mainFile) === ZIP_EXTENSION) {
|
|
265
|
+
const unzippedDirectory = await this.unzipFunction(func);
|
|
266
|
+
// If there's a manifest file, look up the function in order to extract the build data.
|
|
267
|
+
const manifestEntry = (this.manifest?.functions ?? []).find((manifestFunc) => manifestFunc.name === func.name);
|
|
268
|
+
// We found a zipped function that does not have a corresponding entry in
|
|
269
|
+
// the manifest. This shouldn't happen, but we ignore the function in
|
|
270
|
+
// this case.
|
|
271
|
+
if (!manifestEntry) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (this.debug) {
|
|
275
|
+
this.logEvent('extracted', { func });
|
|
276
|
+
}
|
|
277
|
+
func.buildData = {
|
|
278
|
+
...manifestEntry.buildData,
|
|
279
|
+
routes: manifestEntry.routes,
|
|
280
|
+
};
|
|
281
|
+
// When we look at an unzipped function, we don't know whether it uses
|
|
282
|
+
// the legacy entry file format (i.e. `[function name].mjs`) or the new
|
|
283
|
+
// one (i.e. `___netlify-entry-point.mjs`). Let's look for the new one
|
|
284
|
+
// and use it if it exists, otherwise use the old one.
|
|
285
|
+
try {
|
|
286
|
+
const v2EntryPointPath = join(unzippedDirectory, '___netlify-entry-point.mjs');
|
|
287
|
+
await stat(v2EntryPointPath);
|
|
288
|
+
func.mainFile = v2EntryPointPath;
|
|
289
|
+
}
|
|
290
|
+
catch {
|
|
291
|
+
func.mainFile = join(unzippedDirectory, basename(manifestEntry.mainFile));
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
this.buildFunctionAndWatchFiles(func, !isReload);
|
|
296
|
+
}
|
|
297
|
+
this.functions.set(name, func);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* A proxy to zip-it-and-ship-it's `listFunctions` method. It exists just so
|
|
301
|
+
* that we can mock it in tests.
|
|
302
|
+
*/
|
|
303
|
+
async listFunctions(...args) {
|
|
304
|
+
return await listFunctions(...args);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Takes a list of directories and scans for functions. It keeps tracks of
|
|
308
|
+
* any functions in those directories that we've previously seen, and takes
|
|
309
|
+
* care of registering and unregistering functions as they come and go.
|
|
310
|
+
*/
|
|
311
|
+
async scan(relativeDirs) {
|
|
312
|
+
const directories = relativeDirs
|
|
313
|
+
.filter((dir) => Boolean(dir))
|
|
314
|
+
.map((dir) => (isAbsolute(dir) ? dir : join(this.projectRoot, dir)));
|
|
315
|
+
// check after filtering to filter out [undefined] for example
|
|
316
|
+
if (directories.length === 0) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
await Promise.all(directories.map((path) => FunctionsRegistry.prepareDirectory(path)));
|
|
320
|
+
const functions = await this.listFunctions(directories, {
|
|
321
|
+
featureFlags: {
|
|
322
|
+
buildRustSource: env.NETLIFY_EXPERIMENTAL_BUILD_RUST_SOURCE === 'true',
|
|
323
|
+
},
|
|
324
|
+
configFileDirectories: [getPathInProject([INTERNAL_FUNCTIONS_FOLDER])],
|
|
325
|
+
// @ts-expect-error -- TODO(serhalp): Function config types do not match. Investigate and fix.
|
|
326
|
+
config: this.config.functions,
|
|
327
|
+
});
|
|
328
|
+
// user-defined functions take precedence over internal functions,
|
|
329
|
+
// so we want to ignore any internal functions where there's a user-defined one with the same name
|
|
330
|
+
const ignoredFunctions = new Set(functions
|
|
331
|
+
.filter((func) => isInternalFunction(func, this.frameworksAPIPaths.functions.path) &&
|
|
332
|
+
this.functions.has(func.name) &&
|
|
333
|
+
!isInternalFunction(this.functions.get(func.name), this.frameworksAPIPaths.functions.path))
|
|
334
|
+
.map((func) => func.name));
|
|
335
|
+
// Before registering any functions, we look for any functions that were on
|
|
336
|
+
// the previous list but are missing from the new one. We unregister them.
|
|
337
|
+
const deletedFunctions = [...this.functions.values()].filter((oldFunc) => {
|
|
338
|
+
const isFound = functions.some((newFunc) => ignoredFunctions.has(newFunc.name) ||
|
|
339
|
+
(newFunc.name === oldFunc.name && newFunc.mainFile === oldFunc.mainFile));
|
|
340
|
+
return !isFound;
|
|
341
|
+
});
|
|
342
|
+
await Promise.all(deletedFunctions.map((func) => this.unregisterFunction(func)));
|
|
343
|
+
const deletedFunctionNames = new Set(deletedFunctions.map((func) => func.name));
|
|
344
|
+
const addedFunctions = await Promise.all(
|
|
345
|
+
// zip-it-and-ship-it returns an array sorted based on which extension should have precedence,
|
|
346
|
+
// where the last ones precede the previous ones. This is why
|
|
347
|
+
// we reverse the array so we get the right functions precedence in the CLI.
|
|
348
|
+
functions.reverse().map(async ({ displayName, mainFile, name, runtime: runtimeName }) => {
|
|
349
|
+
if (ignoredFunctions.has(name)) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
const runtime = runtimes[runtimeName];
|
|
353
|
+
// If there is no matching runtime, it means this function is not yet
|
|
354
|
+
// supported in Netlify Dev.
|
|
355
|
+
if (runtime === undefined) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
// If this function has already been registered, we skip it.
|
|
359
|
+
if (this.functions.has(name)) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
const func = new NetlifyFunction({
|
|
363
|
+
blobsContext: this.blobsContext,
|
|
364
|
+
config: this.config,
|
|
365
|
+
directory: directories.find((directory) => mainFile.startsWith(directory)),
|
|
366
|
+
mainFile,
|
|
367
|
+
name,
|
|
368
|
+
displayName,
|
|
369
|
+
projectRoot: this.projectRoot,
|
|
370
|
+
// @ts-expect-error(serhalp) -- I think TS needs to know that a given instance of `runtime` in this loop at
|
|
371
|
+
// this point will have a refined type of only one of the runtime types in the union, and this type is
|
|
372
|
+
// consistent between the `NetlifyFunction` and the `runtime`. But... how do?
|
|
373
|
+
runtime,
|
|
374
|
+
timeoutBackground: this.timeouts.backgroundFunctions,
|
|
375
|
+
timeoutSynchronous: this.timeouts.syncFunctions,
|
|
376
|
+
settings: this.settings,
|
|
377
|
+
});
|
|
378
|
+
// If a function we're registering was also unregistered in this run,
|
|
379
|
+
// then it was a rename. Let's flag it as such so that the messaging
|
|
380
|
+
// is adjusted accordingly.
|
|
381
|
+
const isReload = deletedFunctionNames.has(name);
|
|
382
|
+
await this.registerFunction(name, func, isReload);
|
|
383
|
+
return func;
|
|
384
|
+
}));
|
|
385
|
+
const addedFunctionNames = new Set(addedFunctions.filter(Boolean).map((func) => func?.name));
|
|
386
|
+
deletedFunctions.forEach((func) => {
|
|
387
|
+
// If a function we've unregistered was also registered in this run, then
|
|
388
|
+
// it was a rename that we've already logged. Nothing to do in this case.
|
|
389
|
+
if (addedFunctionNames.has(func.name)) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
this.logEvent('removed', { func });
|
|
393
|
+
});
|
|
394
|
+
await Promise.all(directories.map((path) => this.setupDirectoryWatcher(path)));
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Creates a watcher that looks at files being added or removed from a
|
|
398
|
+
* functions directory. It doesn't care about files being changed, because
|
|
399
|
+
* those will be handled by each functions' watcher.
|
|
400
|
+
*/
|
|
401
|
+
async setupDirectoryWatcher(directory) {
|
|
402
|
+
if (this.directoryWatchers.has(directory)) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
const watcher = await watchDebounced(directory, {
|
|
406
|
+
depth: 1,
|
|
407
|
+
onAdd: () => {
|
|
408
|
+
this.scan([directory]);
|
|
409
|
+
},
|
|
410
|
+
onUnlink: () => {
|
|
411
|
+
this.scan([directory]);
|
|
412
|
+
},
|
|
413
|
+
});
|
|
414
|
+
this.directoryWatchers.set(directory, watcher);
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Removes a function from the registry and closes its file watchers.
|
|
418
|
+
*/
|
|
419
|
+
async unregisterFunction(func) {
|
|
420
|
+
const { name } = func;
|
|
421
|
+
this.functions.delete(name);
|
|
422
|
+
const watcher = this.functionWatchers.get(name);
|
|
423
|
+
if (watcher) {
|
|
424
|
+
await watcher.close();
|
|
425
|
+
}
|
|
426
|
+
this.functionWatchers.delete(name);
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Takes a zipped function and extracts its contents to an internal directory.
|
|
430
|
+
*/
|
|
431
|
+
async unzipFunction(func) {
|
|
432
|
+
const targetDirectory = resolve(this.projectRoot, getPathInProject([SERVE_FUNCTIONS_FOLDER, '.unzipped', func.name]));
|
|
433
|
+
await extractZip(func.mainFile, { dir: targetDirectory });
|
|
434
|
+
return targetDirectory;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
//# 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;AACt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AC;YACD,QAAQ,EAAE,GAAG,EAAE;gBACb,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;YACxB,CAAC;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAChD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CAAC,IAAsC;QAC7D,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;QAErB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAE3B,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAE/C,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,OAAO,CAAC,KAAK,EAAE,CAAA;QACvB,CAAC;QAED,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,IAAsC;QACxD,MAAM,eAAe,GAAG,OAAO,CAC7B,IAAI,CAAC,WAAW,EAChB,gBAAgB,CAAC,CAAC,sBAAsB,EAAE,WAAW,EAAE,IAAI,CAAC,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,11 @@
|
|
|
1
|
+
import type { LambdaEvent } from 'lambda-local';
|
|
2
|
+
import type { BaseBuildResult, BuildFunction, GetBuildFunctionOpts, InvokeFunction, OnRegisterFunction } from '../index.js';
|
|
3
|
+
export declare const name = "go";
|
|
4
|
+
export type GoBuildResult = BaseBuildResult & {
|
|
5
|
+
binaryPath: string;
|
|
6
|
+
};
|
|
7
|
+
export type GoInvokeFunctionResult = LambdaEvent;
|
|
8
|
+
export declare const getBuildFunction: ({ func, }: GetBuildFunctionOpts<GoBuildResult>) => Promise<BuildFunction<GoBuildResult>>;
|
|
9
|
+
export declare const invokeFunction: InvokeFunction<GoBuildResult>;
|
|
10
|
+
export declare const onRegister: OnRegisterFunction<GoBuildResult>;
|
|
11
|
+
//# 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":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EACnB,MAAM,aAAa,CAAA;AAOpB,eAAO,MAAM,IAAI,OAAO,CAAA;AAExB,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG;IAC5C,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAA;AAoChD,eAAO,MAAM,gBAAgB,GAAI,WAE9B,oBAAoB,CAAC,aAAa,CAAC,KAAG,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAM1E,CAAA;AAEH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,aAAa,CA2BxD,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,kBAAkB,CAAC,aAAa,CAIxD,CAAA"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { dirname, extname } from 'path';
|
|
2
|
+
import { platform } from 'process';
|
|
3
|
+
import execa from '../../../../utils/execa.js';
|
|
4
|
+
import { runFunctionsProxy } from '../../local-proxy.js';
|
|
5
|
+
import { temporaryFile } from '../../../../utils/temporary-file.js';
|
|
6
|
+
const isWindows = platform === 'win32';
|
|
7
|
+
export const name = 'go';
|
|
8
|
+
const build = async ({ binaryPath, functionDirectory, }) => {
|
|
9
|
+
try {
|
|
10
|
+
await execa('go', ['build', '-o', binaryPath], { cwd: functionDirectory });
|
|
11
|
+
return { binaryPath, srcFiles: [functionDirectory] };
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
const isGoInstalled = await checkGoInstallation({ cwd: functionDirectory });
|
|
15
|
+
if (!isGoInstalled) {
|
|
16
|
+
throw new Error("You don't seem to have Go installed. Go to https://golang.org/doc/install for installation instructions.");
|
|
17
|
+
}
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const checkGoInstallation = async ({ cwd }) => {
|
|
22
|
+
try {
|
|
23
|
+
await execa('go', ['version'], { cwd });
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export const getBuildFunction = ({ func, }) => Promise.resolve(async () => build({
|
|
31
|
+
binaryPath: temporaryFile(isWindows ? { extension: 'exe' } : undefined),
|
|
32
|
+
functionDirectory: dirname(func.mainFile),
|
|
33
|
+
}));
|
|
34
|
+
export const invokeFunction = async ({ context, event, func, timeout }) => {
|
|
35
|
+
if (func.buildData == null) {
|
|
36
|
+
throw new Error('Cannot invoke a function that has not been built');
|
|
37
|
+
}
|
|
38
|
+
const { stdout } = await runFunctionsProxy({
|
|
39
|
+
binaryPath: func.buildData.binaryPath,
|
|
40
|
+
context,
|
|
41
|
+
directory: dirname(func.mainFile),
|
|
42
|
+
event,
|
|
43
|
+
name: func.name,
|
|
44
|
+
timeout,
|
|
45
|
+
});
|
|
46
|
+
try {
|
|
47
|
+
const { body, headers, multiValueHeaders, statusCode } = JSON.parse(stdout);
|
|
48
|
+
return {
|
|
49
|
+
body,
|
|
50
|
+
headers,
|
|
51
|
+
multiValueHeaders,
|
|
52
|
+
statusCode,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return {
|
|
57
|
+
statusCode: 500,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
export const onRegister = (func) => {
|
|
62
|
+
const isSource = extname(func.mainFile) === '.go';
|
|
63
|
+
return isSource ? func : null;
|
|
64
|
+
};
|
|
65
|
+
//# 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;AAWlC,OAAO,KAAK,MAAM,4BAA4B,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AAEnE,MAAM,SAAS,GAAG,QAAQ,KAAK,OAAO,CAAA;AAEtC,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAA;AAQxB,MAAM,KAAK,GAAG,KAAK,EAAE,EACnB,UAAU,EACV,iBAAiB,GAIlB,EAA0B,EAAE;IAC3B,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,GAAG,EAAE,iBAAiB,EAAE,CAAC,CAAA;QAE1E,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAA;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,aAAa,GAAG,MAAM,mBAAmB,CAAC,EAAE,GAAG,EAAE,iBAAiB,EAAE,CAAC,CAAA;QAE3E,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CACb,0GAA0G,CAC3G,CAAA;QACH,CAAC;QAED,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC,CAAA;AAED,MAAM,mBAAmB,GAAG,KA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ACJ,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,MAAM,CAAC,MAAM,UAAU,GAAsC,CAAC,IAAI,EAAE,EAAE;IACpE,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,55 @@
|
|
|
1
|
+
import type { ExtendedRoute, Route } from '@netlify/zip-it-and-ship-it';
|
|
2
|
+
import type { BuildCommandCache } from '../memoized-build.js';
|
|
3
|
+
import type NetlifyFunction from '../netlify-function.js';
|
|
4
|
+
import type { NormalizedCachedConfigConfig } from '../../../utils/command-helpers.js';
|
|
5
|
+
import * as go from './go/index.js';
|
|
6
|
+
import type { GoInvokeFunctionResult } from './go/index.js';
|
|
7
|
+
import * as js from './js/index.js';
|
|
8
|
+
import type { JsInvokeFunctionResult } from './js/index.js';
|
|
9
|
+
import * as rust from './rust/index.js';
|
|
10
|
+
import type { RustInvokeFunctionResult } from './rust/index.js';
|
|
11
|
+
export type BaseBuildResult = {
|
|
12
|
+
includedFiles?: undefined | string[];
|
|
13
|
+
mainFile?: undefined | string;
|
|
14
|
+
outputModuleFormat?: undefined | string;
|
|
15
|
+
schedule?: undefined | string;
|
|
16
|
+
srcFiles: string[];
|
|
17
|
+
excludedRoutes?: Route[] | undefined;
|
|
18
|
+
routes?: ExtendedRoute[] | undefined;
|
|
19
|
+
runtimeAPIVersion?: number | undefined;
|
|
20
|
+
};
|
|
21
|
+
export type GetBuildFunctionOpts<BuildResult extends BaseBuildResult> = {
|
|
22
|
+
config: NormalizedCachedConfigConfig;
|
|
23
|
+
context?: Record<string, unknown>;
|
|
24
|
+
directory?: string;
|
|
25
|
+
errorExit: (msg: string) => void;
|
|
26
|
+
func: NetlifyFunction<BuildResult>;
|
|
27
|
+
functionsDirectory?: string;
|
|
28
|
+
projectRoot: string;
|
|
29
|
+
};
|
|
30
|
+
export type BuildFunction<BuildResult extends BaseBuildResult, CacheEntry extends Record<string, unknown> = Record<string, unknown>> = ({ cache }: {
|
|
31
|
+
cache?: BuildCommandCache<CacheEntry>;
|
|
32
|
+
}) => Promise<BuildResult>;
|
|
33
|
+
export type GetBuildFunction<BuildResult extends BaseBuildResult, CacheEntry extends Record<string, unknown> = Record<string, unknown>> = (params: GetBuildFunctionOpts<BuildResult>) => Promise<BuildFunction<BuildResult, CacheEntry>>;
|
|
34
|
+
export type InvokeFunctionResult = JsInvokeFunctionResult | GoInvokeFunctionResult | RustInvokeFunctionResult;
|
|
35
|
+
export type InvokeFunction<BuildResult extends BaseBuildResult> = (params: {
|
|
36
|
+
context: Record<string, unknown>;
|
|
37
|
+
environment: Record<string, unknown>;
|
|
38
|
+
event: Record<string, unknown>;
|
|
39
|
+
func: NetlifyFunction<BuildResult>;
|
|
40
|
+
timeout: number;
|
|
41
|
+
}) => Promise<InvokeFunctionResult>;
|
|
42
|
+
export type OnRegisterFunction<BuildResult extends BaseBuildResult> = (func: NetlifyFunction<BuildResult>) => NetlifyFunction<BuildResult> | null;
|
|
43
|
+
export interface Runtime<BuildResult extends BaseBuildResult> {
|
|
44
|
+
getBuildFunction: GetBuildFunction<BuildResult>;
|
|
45
|
+
invokeFunction: InvokeFunction<BuildResult>;
|
|
46
|
+
onRegister?: OnRegisterFunction<BuildResult>;
|
|
47
|
+
name: string;
|
|
48
|
+
}
|
|
49
|
+
declare const runtimes: {
|
|
50
|
+
go: typeof go;
|
|
51
|
+
js: typeof js;
|
|
52
|
+
rs: typeof rust;
|
|
53
|
+
};
|
|
54
|
+
export default runtimes;
|
|
55
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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C,WAAW,SAAS,eAAe,IAAI,CACpE,IAAI,EAAE,eAAe,CAAC,WAAW,CAAC,KAC/B,eAAe,CAAC,WAAW,CAAC,GAAG,IAAI,CAAA;AAExC,MAAM,WAAW,OAAO,CAAC,WAAW,SAAS,eAAe;IAC1D,gBAAgB,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAA;IAC/C,cAAc,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;IAC3C,UAAU,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAA;IAC5C,IAAI,EAAE,MAAM,CAAA;CACb;AAED,QAAA,MAAM,QAAQ;;;;CAIb,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
const runtimes = {
|
|
5
|
+
[go.name]: go,
|
|
6
|
+
[js.name]: js,
|
|
7
|
+
[rust.name]: rust,
|
|
8
|
+
};
|
|
9
|
+
export default runtimes;
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/functions/runtimes/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AAEnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AAEnC,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AAyDvC,MAAM,QAAQ,GAAG;IACf,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE;IACb,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE;IACb,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI;CAClB,CAAA;AAED,eAAe,QAAQ,CAAA"}
|